aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-09-12 07:02:26 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-09-12 07:02:26 -0400
commitddd559b13f6d2fe3ad68c4b3f5235fd3c2eae4e3 (patch)
treed827bca3fc825a0ac33efbcd493713be40fcc812 /arch/arm
parentcf7a2b4fb6a9b86779930a0a123b0df41aa9208f (diff)
parentf17a1f06d2fa93f4825be572622eb02c4894db4e (diff)
Merge branch 'devel-stable' into devel
Conflicts: MAINTAINERS arch/arm/mm/fault.c
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig231
-rw-r--r--arch/arm/Kconfig.debug1
-rw-r--r--arch/arm/Makefile16
-rw-r--r--arch/arm/boot/Makefile9
-rw-r--r--arch/arm/boot/compressed/head.S184
-rw-r--r--arch/arm/common/vic.c95
-rw-r--r--arch/arm/configs/nhk8815_defconfig1316
-rw-r--r--arch/arm/configs/s5pc100_defconfig892
-rw-r--r--arch/arm/configs/u300_defconfig18
-rw-r--r--arch/arm/include/asm/assembler.h133
-rw-r--r--arch/arm/include/asm/elf.h3
-rw-r--r--arch/arm/include/asm/ftrace.h1
-rw-r--r--arch/arm/include/asm/futex.h1
-rw-r--r--arch/arm/include/asm/memory.h6
-rw-r--r--arch/arm/include/asm/mmu_context.h2
-rw-r--r--arch/arm/include/asm/page-nommu.h3
-rw-r--r--arch/arm/include/asm/ptrace.h8
-rw-r--r--arch/arm/include/asm/tlb.h4
-rw-r--r--arch/arm/include/asm/uaccess.h7
-rw-r--r--arch/arm/include/asm/unified.h126
-rw-r--r--arch/arm/kernel/armksyms.c1
-rw-r--r--arch/arm/kernel/entry-armv.S179
-rw-r--r--arch/arm/kernel/entry-common.S47
-rw-r--r--arch/arm/kernel/entry-header.S92
-rw-r--r--arch/arm/kernel/head-common.S15
-rw-r--r--arch/arm/kernel/head-nommu.S16
-rw-r--r--arch/arm/kernel/head.S28
-rw-r--r--arch/arm/kernel/irq.c2
-rw-r--r--arch/arm/kernel/module.c53
-rw-r--r--arch/arm/kernel/process.c2
-rw-r--r--arch/arm/kernel/ptrace.c8
-rw-r--r--arch/arm/kernel/setup.c28
-rw-r--r--arch/arm/kernel/unwind.c4
-rw-r--r--arch/arm/lib/ashldi3.S4
-rw-r--r--arch/arm/lib/ashrdi3.S4
-rw-r--r--arch/arm/lib/backtrace.S8
-rw-r--r--arch/arm/lib/bitops.h2
-rw-r--r--arch/arm/lib/clear_user.S15
-rw-r--r--arch/arm/lib/copy_from_user.S19
-rw-r--r--arch/arm/lib/copy_template.S24
-rw-r--r--arch/arm/lib/copy_to_user.S19
-rw-r--r--arch/arm/lib/csumpartialcopyuser.S48
-rw-r--r--arch/arm/lib/div64.S4
-rw-r--r--arch/arm/lib/findbit.S34
-rw-r--r--arch/arm/lib/getuser.S5
-rw-r--r--arch/arm/lib/io-writesw-armv4.S5
-rw-r--r--arch/arm/lib/lshrdi3.S4
-rw-r--r--arch/arm/lib/memcpy.S7
-rw-r--r--arch/arm/lib/memmove.S28
-rw-r--r--arch/arm/lib/putuser.S15
-rw-r--r--arch/arm/lib/sha1.S2
-rw-r--r--arch/arm/lib/strncpy_from_user.S2
-rw-r--r--arch/arm/lib/strnlen_user.S2
-rw-r--r--arch/arm/mach-at91/include/mach/at_hdmac.h102
-rw-r--r--arch/arm/mach-ep93xx/dma-m2p.c1
-rw-r--r--arch/arm/mach-integrator/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c16
-rw-r--r--arch/arm/mach-kirkwood/Kconfig6
-rw-r--r--arch/arm/mach-kirkwood/Makefile1
-rw-r--r--arch/arm/mach-kirkwood/common.c5
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h1
-rw-r--r--arch/arm/mach-kirkwood/mpp.h2
-rw-r--r--arch/arm/mach-kirkwood/openrd_base-setup.c84
-rw-r--r--arch/arm/mach-mx1/clock.c86
-rw-r--r--arch/arm/mach-mx1/devices.c87
-rw-r--r--arch/arm/mach-mx1/generic.c7
-rw-r--r--arch/arm/mach-mx1/mx1ads.c10
-rw-r--r--arch/arm/mach-mx1/scb9328.c16
-rw-r--r--arch/arm/mach-mx2/Kconfig35
-rw-r--r--arch/arm/mach-mx2/Makefile3
-rw-r--r--arch/arm/mach-mx2/clock_imx21.c2
-rw-r--r--arch/arm/mach-mx2/clock_imx27.c11
-rw-r--r--arch/arm/mach-mx2/devices.c332
-rw-r--r--arch/arm/mach-mx2/devices.h9
-rw-r--r--arch/arm/mach-mx2/eukrea_cpuimx27.c234
-rw-r--r--arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c249
-rw-r--r--arch/arm/mach-mx2/generic.c12
-rw-r--r--arch/arm/mach-mx2/mx21ads.c44
-rw-r--r--arch/arm/mach-mx2/mx27ads.c38
-rw-r--r--arch/arm/mach-mx2/mx27lite.c2
-rw-r--r--arch/arm/mach-mx2/mx27pdk.c2
-rw-r--r--arch/arm/mach-mx2/pca100.c244
-rw-r--r--arch/arm/mach-mx2/pcm038.c17
-rw-r--r--arch/arm/mach-mx2/pcm970-baseboard.c112
-rw-r--r--arch/arm/mach-mx25/Kconfig9
-rw-r--r--arch/arm/mach-mx25/Makefile3
-rw-r--r--arch/arm/mach-mx25/Makefile.boot3
-rw-r--r--arch/arm/mach-mx25/clock.c219
-rw-r--r--arch/arm/mach-mx25/devices.c402
-rw-r--r--arch/arm/mach-mx25/devices.h19
-rw-r--r--arch/arm/mach-mx25/mm.c76
-rw-r--r--arch/arm/mach-mx25/mx25pdk.c58
-rw-r--r--arch/arm/mach-mx3/Kconfig8
-rw-r--r--arch/arm/mach-mx3/Makefile1
-rw-r--r--arch/arm/mach-mx3/armadillo5x0.c65
-rw-r--r--arch/arm/mach-mx3/clock-imx35.c22
-rw-r--r--arch/arm/mach-mx3/clock.c22
-rw-r--r--arch/arm/mach-mx3/devices.c163
-rw-r--r--arch/arm/mach-mx3/devices.h6
-rw-r--r--arch/arm/mach-mx3/mm.c14
-rw-r--r--arch/arm/mach-mx3/mx31ads.c2
-rw-r--r--arch/arm/mach-mx3/mx31lilly.c2
-rw-r--r--arch/arm/mach-mx3/mx31lite.c7
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c43
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c55
-rw-r--r--arch/arm/mach-mx3/mx31moboard.c134
-rw-r--r--arch/arm/mach-mx3/mx31pdk.c2
-rw-r--r--arch/arm/mach-mx3/mx35pdk.c2
-rw-r--r--arch/arm/mach-mx3/pcm037.c225
-rw-r--r--arch/arm/mach-mx3/pcm037.h11
-rw-r--r--arch/arm/mach-mx3/pcm037_eet.c204
-rw-r--r--arch/arm/mach-mx3/pcm043.c8
-rw-r--r--arch/arm/mach-mx3/qong.c7
-rw-r--r--arch/arm/mach-mxc91231/Kconfig11
-rw-r--r--arch/arm/mach-mxc91231/Makefile2
-rw-r--r--arch/arm/mach-mxc91231/Makefile.boot3
-rw-r--r--arch/arm/mach-mxc91231/clock.c642
-rw-r--r--arch/arm/mach-mxc91231/crm_regs.h399
-rw-r--r--arch/arm/mach-mxc91231/devices.c251
-rw-r--r--arch/arm/mach-mxc91231/devices.h13
-rw-r--r--arch/arm/mach-mxc91231/iomux.c177
-rw-r--r--arch/arm/mach-mxc91231/magx-zn5.c63
-rw-r--r--arch/arm/mach-mxc91231/mm.c94
-rw-r--r--arch/arm/mach-mxc91231/system.c51
-rw-r--r--arch/arm/mach-netx/include/mach/entry-macro.S4
-rw-r--r--arch/arm/mach-nomadik/Kconfig21
-rw-r--r--arch/arm/mach-nomadik/Makefile19
-rw-r--r--arch/arm/mach-nomadik/Makefile.boot4
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c111
-rw-r--r--arch/arm/mach-nomadik/clock.c45
-rw-r--r--arch/arm/mach-nomadik/clock.h14
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c139
-rw-r--r--arch/arm/mach-nomadik/gpio.c396
-rw-r--r--arch/arm/mach-nomadik/i2c-8815nhk.c65
-rw-r--r--arch/arm/mach-nomadik/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-nomadik/include/mach/debug-macro.S22
-rw-r--r--arch/arm/mach-nomadik/include/mach/entry-macro.S43
-rw-r--r--arch/arm/mach-nomadik/include/mach/gpio.h71
-rw-r--r--arch/arm/mach-nomadik/include/mach/hardware.h90
-rw-r--r--arch/arm/mach-nomadik/include/mach/io.h22
-rw-r--r--arch/arm/mach-nomadik/include/mach/irqs.h82
-rw-r--r--arch/arm/mach-nomadik/include/mach/memory.h28
-rw-r--r--arch/arm/mach-nomadik/include/mach/mtu.h45
-rw-r--r--arch/arm/mach-nomadik/include/mach/setup.h22
-rw-r--r--arch/arm/mach-nomadik/include/mach/system.h45
-rw-r--r--arch/arm/mach-nomadik/include/mach/timex.h6
-rw-r--r--arch/arm/mach-nomadik/include/mach/uncompress.h63
-rw-r--r--arch/arm/mach-nomadik/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-nomadik/timer.c164
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-overo.c1
-rw-r--r--arch/arm/mach-omap2/cm.h6
-rw-r--r--arch/arm/mach-omap2/mcbsp.c41
-rw-r--r--arch/arm/mach-omap2/pm.h3
-rw-r--r--arch/arm/mach-omap2/pm24xx.c2
-rw-r--r--arch/arm/mach-omap2/pm34xx.c51
-rw-r--r--arch/arm/mach-omap2/serial.c207
-rw-r--r--arch/arm/mach-orion5x/Kconfig21
-rw-r--r--arch/arm/mach-orion5x/Makefile3
-rw-r--r--arch/arm/mach-orion5x/addr-map.c3
-rw-r--r--arch/arm/mach-orion5x/d2net-setup.c365
-rw-r--r--arch/arm/mach-orion5x/net2big-setup.c431
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa300.h6
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-realview/Kconfig2
-rw-r--r--arch/arm/mach-realview/core.c3
-rw-r--r--arch/arm/mach-realview/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-realview/platsmp.c18
-rw-r--r--arch/arm/mach-s3c2410/Kconfig18
-rw-r--r--arch/arm/mach-s3c2410/Makefile2
-rw-r--r--arch/arm/mach-s3c2410/cpu-freq.c159
-rw-r--r--arch/arm/mach-s3c2410/dma.c11
-rw-r--r--arch/arm/mach-s3c2410/include/mach/gpio-core.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/irqs.h6
-rw-r--r--arch/arm/mach-s3c2410/include/mach/map.h8
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-gpio.h4
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-mem.h10
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h23
-rw-r--r--arch/arm/mach-s3c2410/include/mach/spi.h3
-rw-r--r--arch/arm/mach-s3c2410/irq.c15
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c41
-rw-r--r--arch/arm/mach-s3c2410/pll.c95
-rw-r--r--arch/arm/mach-s3c2410/pm.c12
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c29
-rw-r--r--arch/arm/mach-s3c2412/Kconfig9
-rw-r--r--arch/arm/mach-s3c2412/Makefile1
-rw-r--r--arch/arm/mach-s3c2412/cpu-freq.c257
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c12
-rw-r--r--arch/arm/mach-s3c2440/Kconfig7
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c9
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/map.h1
-rw-r--r--arch/arm/mach-s3c6400/include/mach/map.h8
-rw-r--r--arch/arm/mach-s3c6400/s3c6400.c2
-rw-r--r--arch/arm/mach-s3c6410/Kconfig10
-rw-r--r--arch/arm/mach-s3c6410/Makefile3
-rw-r--r--arch/arm/mach-s3c6410/cpu.c2
-rw-r--r--arch/arm/mach-s3c6410/mach-hmt.c276
-rw-r--r--arch/arm/mach-s3c6410/mach-ncp.c2
-rw-r--r--arch/arm/mach-s3c6410/mach-smdk6410.c26
-rw-r--r--arch/arm/mach-s5pc100/Kconfig22
-rw-r--r--arch/arm/mach-s5pc100/Makefile17
-rw-r--r--arch/arm/mach-s5pc100/Makefile.boot2
-rw-r--r--arch/arm/mach-s5pc100/cpu.c97
-rw-r--r--arch/arm/mach-s5pc100/include/mach/debug-macro.S38
-rw-r--r--arch/arm/mach-s5pc100/include/mach/entry-macro.S50
-rw-r--r--arch/arm/mach-s5pc100/include/mach/gpio-core.h21
-rw-r--r--arch/arm/mach-s5pc100/include/mach/gpio.h146
-rw-r--r--arch/arm/mach-s5pc100/include/mach/hardware.h14
-rw-r--r--arch/arm/mach-s5pc100/include/mach/irqs.h14
-rw-r--r--arch/arm/mach-s5pc100/include/mach/map.h75
-rw-r--r--arch/arm/mach-s5pc100/include/mach/memory.h18
-rw-r--r--arch/arm/mach-s5pc100/include/mach/pwm-clock.h56
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-irq.h24
-rw-r--r--arch/arm/mach-s5pc100/include/mach/system.h24
-rw-r--r--arch/arm/mach-s5pc100/include/mach/tick.h29
-rw-r--r--arch/arm/mach-s5pc100/include/mach/uncompress.h28
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c103
-rw-r--r--arch/arm/mach-u300/core.c4
-rw-r--r--arch/arm/mach-versatile/core.c3
-rw-r--r--arch/arm/mm/Kconfig2
-rw-r--r--arch/arm/mm/alignment.c20
-rw-r--r--arch/arm/mm/cache-v7.S16
-rw-r--r--arch/arm/mm/dma-mapping.c94
-rw-r--r--arch/arm/mm/fault.c23
-rw-r--r--arch/arm/mm/nommu.c1
-rw-r--r--arch/arm/mm/proc-macros.S2
-rw-r--r--arch/arm/mm/proc-v7.S7
-rw-r--r--arch/arm/plat-mxc/Kconfig17
-rw-r--r--arch/arm/plat-mxc/clock.c170
-rw-r--r--arch/arm/plat-mxc/gpio.c42
-rw-r--r--arch/arm/plat-mxc/include/mach/board-armadillo5x0.h7
-rw-r--r--arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx27.h40
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx21ads.h6
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27ads.h6
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27lite.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27pdk.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31ads.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31lilly.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31lite.h3
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31moboard.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31pdk.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx35pdk.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-pcm037.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-pcm038.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-pcm043.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/board-qong.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h19
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S68
-rw-r--r--arch/arm/plat-mxc/include/mach/entry-macro.S3
-rw-r--r--arch/arm/plat-mxc/include/mach/hardware.h8
-rw-r--r--arch/arm/plat-mxc/include/mach/imxfb.h29
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx25.h517
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx3.h27
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mxc91231.h287
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-v3.h35
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux.h6
-rw-r--r--arch/arm/plat-mxc/include/mach/irqs.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/memory.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mx1.h22
-rw-r--r--arch/arm/plat-mxc/include/mach/mx21.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/mx25.h44
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h7
-rw-r--r--arch/arm/plat-mxc/include/mach/mx2x.h18
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx35.h1
-rw-r--r--arch/arm/plat-mxc/include/mach/mx3x.h21
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc.h28
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc91231.h315
-rw-r--r--arch/arm/plat-mxc/include/mach/system.h10
-rw-r--r--arch/arm/plat-mxc/include/mach/timex.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/uncompress.h68
-rw-r--r--arch/arm/plat-mxc/iomux-v3.c15
-rw-r--r--arch/arm/plat-mxc/irq.c6
-rw-r--r--arch/arm/plat-mxc/pwm.c19
-rw-r--r--arch/arm/plat-mxc/system.c29
-rw-r--r--arch/arm/plat-mxc/time.c39
-rw-r--r--arch/arm/plat-omap/cpu-omap.c8
-rw-r--r--arch/arm/plat-omap/gpio.c255
-rw-r--r--arch/arm/plat-omap/include/mach/dma.h88
-rw-r--r--arch/arm/plat-omap/include/mach/mcbsp.h8
-rw-r--r--arch/arm/plat-omap/include/mach/serial.h1
-rw-r--r--arch/arm/plat-omap/mcbsp.c2
-rw-r--r--arch/arm/plat-pxa/gpio.c9
-rw-r--r--arch/arm/plat-s3c/Kconfig5
-rw-r--r--arch/arm/plat-s3c/Makefile6
-rw-r--r--arch/arm/plat-s3c/dev-nand.c30
-rw-r--r--arch/arm/plat-s3c/include/plat/adc.h8
-rw-r--r--arch/arm/plat-s3c/include/plat/cpu-freq.h87
-rw-r--r--arch/arm/plat-s3c/include/plat/cpu.h1
-rw-r--r--arch/arm/plat-s3c/include/plat/devs.h3
-rw-r--r--arch/arm/plat-s3c/include/plat/hwmon.h41
-rw-r--r--arch/arm/plat-s3c/include/plat/map-base.h8
-rw-r--r--arch/arm/plat-s3c/pwm.c (renamed from arch/arm/plat-s3c24xx/pwm.c)5
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig66
-rw-r--r--arch/arm/plat-s3c24xx/Makefile12
-rw-r--r--arch/arm/plat-s3c24xx/adc.c64
-rw-r--r--arch/arm/plat-s3c24xx/cpu-freq-debugfs.c199
-rw-r--r--arch/arm/plat-s3c24xx/cpu-freq.c716
-rw-r--r--arch/arm/plat-s3c24xx/cpu.c2
-rw-r--r--arch/arm/plat-s3c24xx/devs.c71
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h282
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/fiq.h13
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/s3c2410.h1
-rw-r--r--arch/arm/plat-s3c24xx/irq.c36
-rw-r--r--arch/arm/plat-s3c24xx/s3c2410-cpufreq-utils.c64
-rw-r--r--arch/arm/plat-s3c24xx/s3c2410-iotiming.c477
-rw-r--r--arch/arm/plat-s3c24xx/s3c2412-iotiming.c285
-rw-r--r--arch/arm/plat-s3c24xx/s3c2440-cpufreq.c311
-rw-r--r--arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c97
-rw-r--r--arch/arm/plat-s3c24xx/s3c2440-pll-16934400.c127
-rw-r--r--arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c38
-rw-r--r--arch/arm/plat-s3c64xx/Kconfig1
-rw-r--r--arch/arm/plat-s3c64xx/Makefile3
-rw-r--r--arch/arm/plat-s3c64xx/dev-audio.c (renamed from arch/arm/plat-s3c/dev-audio.c)0
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-clock.c4
-rw-r--r--arch/arm/plat-s5pc1xx/Kconfig50
-rw-r--r--arch/arm/plat-s5pc1xx/Makefile26
-rw-r--r--arch/arm/plat-s5pc1xx/cpu.c112
-rw-r--r--arch/arm/plat-s5pc1xx/dev-uart.c174
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/irqs.h182
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/pll.h38
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/regs-clock.h421
-rw-r--r--arch/arm/plat-s5pc1xx/include/plat/s5pc100.h65
-rw-r--r--arch/arm/plat-s5pc1xx/irq.c259
-rw-r--r--arch/arm/plat-s5pc1xx/s5pc100-clock.c1139
-rw-r--r--arch/arm/plat-s5pc1xx/s5pc100-init.c27
-rw-r--r--arch/arm/plat-s5pc1xx/setup-i2c0.c25
-rw-r--r--arch/arm/plat-s5pc1xx/setup-i2c1.c25
-rw-r--r--arch/arm/vfp/entry.S2
-rw-r--r--arch/arm/vfp/vfphw.S48
330 files changed, 20139 insertions, 1662 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5d60508472f0..d778a699f577 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -46,10 +46,6 @@ config GENERIC_CLOCKEVENTS_BROADCAST
46 depends on GENERIC_CLOCKEVENTS 46 depends on GENERIC_CLOCKEVENTS
47 default y if SMP && !LOCAL_TIMERS 47 default y if SMP && !LOCAL_TIMERS
48 48
49config MMU
50 bool
51 default y
52
53config NO_IOPORT 49config NO_IOPORT
54 bool 50 bool
55 51
@@ -126,6 +122,13 @@ config ARCH_HAS_ILOG2_U32
126config ARCH_HAS_ILOG2_U64 122config ARCH_HAS_ILOG2_U64
127 bool 123 bool
128 124
125config ARCH_HAS_CPUFREQ
126 bool
127 help
128 Internal node to signify that the ARCH has CPUFREQ support
129 and that the relevant menu configurations are displayed for
130 it.
131
129config GENERIC_HWEIGHT 132config GENERIC_HWEIGHT
130 bool 133 bool
131 default y 134 default y
@@ -188,6 +191,13 @@ source "kernel/Kconfig.freezer"
188 191
189menu "System Type" 192menu "System Type"
190 193
194config MMU
195 bool "MMU-based Paged Memory Management Support"
196 default y
197 help
198 Select if you want MMU-based virtualised addressing space
199 support by paged memory management. If unsure, say 'Y'.
200
191choice 201choice
192 prompt "ARM system type" 202 prompt "ARM system type"
193 default ARCH_VERSATILE 203 default ARCH_VERSATILE
@@ -203,6 +213,7 @@ config ARCH_AAEC2000
203config ARCH_INTEGRATOR 213config ARCH_INTEGRATOR
204 bool "ARM Ltd. Integrator family" 214 bool "ARM Ltd. Integrator family"
205 select ARM_AMBA 215 select ARM_AMBA
216 select ARCH_HAS_CPUFREQ
206 select HAVE_CLK 217 select HAVE_CLK
207 select COMMON_CLKDEV 218 select COMMON_CLKDEV
208 select ICST525 219 select ICST525
@@ -329,6 +340,20 @@ config ARCH_H720X
329 help 340 help
330 This enables support for systems based on the Hynix HMS720x 341 This enables support for systems based on the Hynix HMS720x
331 342
343config ARCH_NOMADIK
344 bool "STMicroelectronics Nomadik"
345 select ARM_AMBA
346 select ARM_VIC
347 select CPU_ARM926T
348 select HAVE_CLK
349 select COMMON_CLKDEV
350 select GENERIC_TIME
351 select GENERIC_CLOCKEVENTS
352 select GENERIC_GPIO
353 select ARCH_REQUIRE_GPIOLIB
354 help
355 Support for the Nomadik platform by ST-Ericsson
356
332config ARCH_IOP13XX 357config ARCH_IOP13XX
333 bool "IOP13xx-based" 358 bool "IOP13xx-based"
334 depends on MMU 359 depends on MMU
@@ -519,6 +544,7 @@ config ARCH_PXA
519 bool "PXA2xx/PXA3xx-based" 544 bool "PXA2xx/PXA3xx-based"
520 depends on MMU 545 depends on MMU
521 select ARCH_MTD_XIP 546 select ARCH_MTD_XIP
547 select ARCH_HAS_CPUFREQ
522 select GENERIC_GPIO 548 select GENERIC_GPIO
523 select HAVE_CLK 549 select HAVE_CLK
524 select COMMON_CLKDEV 550 select COMMON_CLKDEV
@@ -561,6 +587,7 @@ config ARCH_SA1100
561 select ISA 587 select ISA
562 select ARCH_SPARSEMEM_ENABLE 588 select ARCH_SPARSEMEM_ENABLE
563 select ARCH_MTD_XIP 589 select ARCH_MTD_XIP
590 select ARCH_HAS_CPUFREQ
564 select GENERIC_GPIO 591 select GENERIC_GPIO
565 select GENERIC_TIME 592 select GENERIC_TIME
566 select GENERIC_CLOCKEVENTS 593 select GENERIC_CLOCKEVENTS
@@ -573,6 +600,7 @@ config ARCH_SA1100
573config ARCH_S3C2410 600config ARCH_S3C2410
574 bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443" 601 bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443"
575 select GENERIC_GPIO 602 select GENERIC_GPIO
603 select ARCH_HAS_CPUFREQ
576 select HAVE_CLK 604 select HAVE_CLK
577 help 605 help
578 Samsung S3C2410X CPU based systems, such as the Simtec Electronics 606 Samsung S3C2410X CPU based systems, such as the Simtec Electronics
@@ -583,9 +611,18 @@ config ARCH_S3C64XX
583 bool "Samsung S3C64XX" 611 bool "Samsung S3C64XX"
584 select GENERIC_GPIO 612 select GENERIC_GPIO
585 select HAVE_CLK 613 select HAVE_CLK
614 select ARCH_HAS_CPUFREQ
586 help 615 help
587 Samsung S3C64XX series based systems 616 Samsung S3C64XX series based systems
588 617
618config ARCH_S5PC1XX
619 bool "Samsung S5PC1XX"
620 select GENERIC_GPIO
621 select HAVE_CLK
622 select CPU_V7
623 help
624 Samsung S5PC1XX series based systems
625
589config ARCH_SHARK 626config ARCH_SHARK
590 bool "Shark" 627 bool "Shark"
591 select CPU_SA110 628 select CPU_SA110
@@ -642,6 +679,7 @@ config ARCH_OMAP
642 select GENERIC_GPIO 679 select GENERIC_GPIO
643 select HAVE_CLK 680 select HAVE_CLK
644 select ARCH_REQUIRE_GPIOLIB 681 select ARCH_REQUIRE_GPIOLIB
682 select ARCH_HAS_CPUFREQ
645 select GENERIC_TIME 683 select GENERIC_TIME
646 select GENERIC_CLOCKEVENTS 684 select GENERIC_CLOCKEVENTS
647 help 685 help
@@ -707,6 +745,7 @@ source "arch/arm/mach-kirkwood/Kconfig"
707source "arch/arm/plat-s3c24xx/Kconfig" 745source "arch/arm/plat-s3c24xx/Kconfig"
708source "arch/arm/plat-s3c64xx/Kconfig" 746source "arch/arm/plat-s3c64xx/Kconfig"
709source "arch/arm/plat-s3c/Kconfig" 747source "arch/arm/plat-s3c/Kconfig"
748source "arch/arm/plat-s5pc1xx/Kconfig"
710 749
711if ARCH_S3C2410 750if ARCH_S3C2410
712source "arch/arm/mach-s3c2400/Kconfig" 751source "arch/arm/mach-s3c2400/Kconfig"
@@ -724,6 +763,10 @@ endif
724 763
725source "arch/arm/plat-stmp3xxx/Kconfig" 764source "arch/arm/plat-stmp3xxx/Kconfig"
726 765
766if ARCH_S5PC1XX
767source "arch/arm/mach-s5pc100/Kconfig"
768endif
769
727source "arch/arm/mach-lh7a40x/Kconfig" 770source "arch/arm/mach-lh7a40x/Kconfig"
728 771
729source "arch/arm/mach-h720x/Kconfig" 772source "arch/arm/mach-h720x/Kconfig"
@@ -738,6 +781,8 @@ source "arch/arm/mach-at91/Kconfig"
738 781
739source "arch/arm/plat-mxc/Kconfig" 782source "arch/arm/plat-mxc/Kconfig"
740 783
784source "arch/arm/mach-nomadik/Kconfig"
785
741source "arch/arm/mach-netx/Kconfig" 786source "arch/arm/mach-netx/Kconfig"
742 787
743source "arch/arm/mach-ns9xxx/Kconfig" 788source "arch/arm/mach-ns9xxx/Kconfig"
@@ -986,18 +1031,7 @@ config LOCAL_TIMERS
986 accounting to be spread across the timer interval, preventing a 1031 accounting to be spread across the timer interval, preventing a
987 "thundering herd" at every timer tick. 1032 "thundering herd" at every timer tick.
988 1033
989config PREEMPT 1034source kernel/Kconfig.preempt
990 bool "Preemptible Kernel (EXPERIMENTAL)"
991 depends on EXPERIMENTAL
992 help
993 This option reduces the latency of the kernel when reacting to
994 real-time or interactive events by allowing a low priority process to
995 be preempted even if it is in kernel mode executing a system call.
996 This allows applications to run more reliably even when the system is
997 under load.
998
999 Say Y here if you are building a kernel for a desktop, embedded
1000 or real-time system. Say N if you are unsure.
1001 1035
1002config HZ 1036config HZ
1003 int 1037 int
@@ -1007,6 +1041,21 @@ config HZ
1007 default AT91_TIMER_HZ if ARCH_AT91 1041 default AT91_TIMER_HZ if ARCH_AT91
1008 default 100 1042 default 100
1009 1043
1044config THUMB2_KERNEL
1045 bool "Compile the kernel in Thumb-2 mode"
1046 depends on CPU_V7 && EXPERIMENTAL
1047 select AEABI
1048 select ARM_ASM_UNIFIED
1049 help
1050 By enabling this option, the kernel will be compiled in
1051 Thumb-2 mode. A compiler/assembler that understand the unified
1052 ARM-Thumb syntax is needed.
1053
1054 If unsure, say N.
1055
1056config ARM_ASM_UNIFIED
1057 bool
1058
1010config AEABI 1059config AEABI
1011 bool "Use the ARM EABI to compile the kernel" 1060 bool "Use the ARM EABI to compile the kernel"
1012 help 1061 help
@@ -1270,7 +1319,7 @@ endmenu
1270 1319
1271menu "CPU Power Management" 1320menu "CPU Power Management"
1272 1321
1273if (ARCH_SA1100 || ARCH_INTEGRATOR || ARCH_OMAP || ARCH_PXA || ARCH_S3C64XX) 1322if ARCH_HAS_CPUFREQ
1274 1323
1275source "drivers/cpufreq/Kconfig" 1324source "drivers/cpufreq/Kconfig"
1276 1325
@@ -1305,6 +1354,52 @@ config CPU_FREQ_S3C64XX
1305 bool "CPUfreq support for Samsung S3C64XX CPUs" 1354 bool "CPUfreq support for Samsung S3C64XX CPUs"
1306 depends on CPU_FREQ && CPU_S3C6410 1355 depends on CPU_FREQ && CPU_S3C6410
1307 1356
1357config CPU_FREQ_S3C
1358 bool
1359 help
1360 Internal configuration node for common cpufreq on Samsung SoC
1361
1362config CPU_FREQ_S3C24XX
1363 bool "CPUfreq driver for Samsung S3C24XX series CPUs"
1364 depends on ARCH_S3C2410 && CPU_FREQ && EXPERIMENTAL
1365 select CPU_FREQ_S3C
1366 help
1367 This enables the CPUfreq driver for the Samsung S3C24XX family
1368 of CPUs.
1369
1370 For details, take a look at <file:Documentation/cpu-freq>.
1371
1372 If in doubt, say N.
1373
1374config CPU_FREQ_S3C24XX_PLL
1375 bool "Support CPUfreq changing of PLL frequency"
1376 depends on CPU_FREQ_S3C24XX && EXPERIMENTAL
1377 help
1378 Compile in support for changing the PLL frequency from the
1379 S3C24XX series CPUfreq driver. The PLL takes time to settle
1380 after a frequency change, so by default it is not enabled.
1381
1382 This also means that the PLL tables for the selected CPU(s) will
1383 be built which may increase the size of the kernel image.
1384
1385config CPU_FREQ_S3C24XX_DEBUG
1386 bool "Debug CPUfreq Samsung driver core"
1387 depends on CPU_FREQ_S3C24XX
1388 help
1389 Enable s3c_freq_dbg for the Samsung S3C CPUfreq core
1390
1391config CPU_FREQ_S3C24XX_IODEBUG
1392 bool "Debug CPUfreq Samsung driver IO timing"
1393 depends on CPU_FREQ_S3C24XX
1394 help
1395 Enable s3c_freq_iodbg for the Samsung S3C CPUfreq core
1396
1397config CPU_FREQ_S3C24XX_DEBUGFS
1398 bool "Export debugfs for CPUFreq"
1399 depends on CPU_FREQ_S3C24XX && DEBUG_FS
1400 help
1401 Export status information via debugfs.
1402
1308endif 1403endif
1309 1404
1310source "drivers/cpuidle/Kconfig" 1405source "drivers/cpuidle/Kconfig"
@@ -1406,107 +1501,7 @@ endmenu
1406 1501
1407source "net/Kconfig" 1502source "net/Kconfig"
1408 1503
1409menu "Device Drivers" 1504source "drivers/Kconfig"
1410
1411source "drivers/base/Kconfig"
1412
1413source "drivers/connector/Kconfig"
1414
1415if ALIGNMENT_TRAP || !CPU_CP15_MMU
1416source "drivers/mtd/Kconfig"
1417endif
1418
1419source "drivers/parport/Kconfig"
1420
1421source "drivers/pnp/Kconfig"
1422
1423source "drivers/block/Kconfig"
1424
1425# misc before ide - BLK_DEV_SGIIOC4 depends on SGI_IOC4
1426
1427source "drivers/misc/Kconfig"
1428
1429source "drivers/ide/Kconfig"
1430
1431source "drivers/scsi/Kconfig"
1432
1433source "drivers/ata/Kconfig"
1434
1435source "drivers/md/Kconfig"
1436
1437source "drivers/message/fusion/Kconfig"
1438
1439source "drivers/ieee1394/Kconfig"
1440
1441source "drivers/message/i2o/Kconfig"
1442
1443source "drivers/net/Kconfig"
1444
1445source "drivers/isdn/Kconfig"
1446
1447# input before char - char/joystick depends on it. As does USB.
1448
1449source "drivers/input/Kconfig"
1450
1451source "drivers/char/Kconfig"
1452
1453source "drivers/i2c/Kconfig"
1454
1455source "drivers/spi/Kconfig"
1456
1457source "drivers/gpio/Kconfig"
1458
1459source "drivers/w1/Kconfig"
1460
1461source "drivers/power/Kconfig"
1462
1463source "drivers/hwmon/Kconfig"
1464
1465source "drivers/thermal/Kconfig"
1466
1467source "drivers/watchdog/Kconfig"
1468
1469source "drivers/ssb/Kconfig"
1470
1471#source "drivers/l3/Kconfig"
1472
1473source "drivers/mfd/Kconfig"
1474
1475source "drivers/media/Kconfig"
1476
1477source "drivers/video/Kconfig"
1478
1479source "sound/Kconfig"
1480
1481source "drivers/hid/Kconfig"
1482
1483source "drivers/usb/Kconfig"
1484
1485source "drivers/uwb/Kconfig"
1486
1487source "drivers/mmc/Kconfig"
1488
1489source "drivers/memstick/Kconfig"
1490
1491source "drivers/accessibility/Kconfig"
1492
1493source "drivers/leds/Kconfig"
1494
1495source "drivers/rtc/Kconfig"
1496
1497source "drivers/dma/Kconfig"
1498
1499source "drivers/dca/Kconfig"
1500
1501source "drivers/auxdisplay/Kconfig"
1502
1503source "drivers/regulator/Kconfig"
1504
1505source "drivers/uio/Kconfig"
1506
1507source "drivers/staging/Kconfig"
1508
1509endmenu
1510 1505
1511source "fs/Kconfig" 1506source "fs/Kconfig"
1512 1507
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index a89e4734b8f0..1a6f70e52921 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -8,6 +8,7 @@ source "lib/Kconfig.debug"
8# n, but then RMK will have to kill you ;). 8# n, but then RMK will have to kill you ;).
9config FRAME_POINTER 9config FRAME_POINTER
10 bool 10 bool
11 depends on !THUMB2_KERNEL
11 default y if !ARM_UNWIND 12 default y if !ARM_UNWIND
12 help 13 help
13 If you say N here, the resulting kernel will be slightly smaller and 14 If you say N here, the resulting kernel will be slightly smaller and
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index b9ae98b88a7e..7350557a81e0 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -93,9 +93,16 @@ ifeq ($(CONFIG_ARM_UNWIND),y)
93CFLAGS_ABI +=-funwind-tables 93CFLAGS_ABI +=-funwind-tables
94endif 94endif
95 95
96ifeq ($(CONFIG_THUMB2_KERNEL),y)
97AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=thumb,-Wa$(comma)-mauto-it)
98AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
99CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
100AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb
101endif
102
96# Need -Uarm for gcc < 3.x 103# Need -Uarm for gcc < 3.x
97KBUILD_CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm 104KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
98KBUILD_AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float 105KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
99 106
100CHECKFLAGS += -D__arm__ 107CHECKFLAGS += -D__arm__
101 108
@@ -136,8 +143,10 @@ machine-$(CONFIG_ARCH_MSM) := msm
136machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0 143machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0
137machine-$(CONFIG_ARCH_MX1) := mx1 144machine-$(CONFIG_ARCH_MX1) := mx1
138machine-$(CONFIG_ARCH_MX2) := mx2 145machine-$(CONFIG_ARCH_MX2) := mx2
146machine-$(CONFIG_ARCH_MX25) := mx25
139machine-$(CONFIG_ARCH_MX3) := mx3 147machine-$(CONFIG_ARCH_MX3) := mx3
140machine-$(CONFIG_ARCH_NETX) := netx 148machine-$(CONFIG_ARCH_NETX) := netx
149machine-$(CONFIG_ARCH_NOMADIK) := nomadik
141machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx 150machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx
142machine-$(CONFIG_ARCH_OMAP1) := omap1 151machine-$(CONFIG_ARCH_OMAP1) := omap1
143machine-$(CONFIG_ARCH_OMAP2) := omap2 152machine-$(CONFIG_ARCH_OMAP2) := omap2
@@ -151,6 +160,7 @@ machine-$(CONFIG_ARCH_RPC) := rpc
151machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2440 s3c2442 s3c2443 160machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2440 s3c2442 s3c2443
152machine-$(CONFIG_ARCH_S3C24A0) := s3c24a0 161machine-$(CONFIG_ARCH_S3C24A0) := s3c24a0
153machine-$(CONFIG_ARCH_S3C64XX) := s3c6400 s3c6410 162machine-$(CONFIG_ARCH_S3C64XX) := s3c6400 s3c6410
163machine-$(CONFIG_ARCH_S5PC1XX) := s5pc100
154machine-$(CONFIG_ARCH_SA1100) := sa1100 164machine-$(CONFIG_ARCH_SA1100) := sa1100
155machine-$(CONFIG_ARCH_SHARK) := shark 165machine-$(CONFIG_ARCH_SHARK) := shark
156machine-$(CONFIG_ARCH_STMP378X) := stmp378x 166machine-$(CONFIG_ARCH_STMP378X) := stmp378x
@@ -159,6 +169,7 @@ machine-$(CONFIG_ARCH_U300) := u300
159machine-$(CONFIG_ARCH_VERSATILE) := versatile 169machine-$(CONFIG_ARCH_VERSATILE) := versatile
160machine-$(CONFIG_ARCH_W90X900) := w90x900 170machine-$(CONFIG_ARCH_W90X900) := w90x900
161machine-$(CONFIG_FOOTBRIDGE) := footbridge 171machine-$(CONFIG_FOOTBRIDGE) := footbridge
172machine-$(CONFIG_ARCH_MXC91231) := mxc91231
162 173
163# Platform directory name. This list is sorted alphanumerically 174# Platform directory name. This list is sorted alphanumerically
164# by CONFIG_* macro name. 175# by CONFIG_* macro name.
@@ -169,6 +180,7 @@ plat-$(CONFIG_PLAT_ORION) := orion
169plat-$(CONFIG_PLAT_PXA) := pxa 180plat-$(CONFIG_PLAT_PXA) := pxa
170plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c 181plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c
171plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c 182plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c
183plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx s3c
172plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx 184plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx
173 185
174ifeq ($(CONFIG_ARCH_EBSA110),y) 186ifeq ($(CONFIG_ARCH_EBSA110),y)
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index da226abce2d0..4a590f4113e2 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -61,7 +61,7 @@ endif
61 61
62quiet_cmd_uimage = UIMAGE $@ 62quiet_cmd_uimage = UIMAGE $@
63 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ 63 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
64 -C none -a $(LOADADDR) -e $(LOADADDR) \ 64 -C none -a $(LOADADDR) -e $(STARTADDR) \
65 -n 'Linux-$(KERNELRELEASE)' -d $< $@ 65 -n 'Linux-$(KERNELRELEASE)' -d $< $@
66 66
67ifeq ($(CONFIG_ZBOOT_ROM),y) 67ifeq ($(CONFIG_ZBOOT_ROM),y)
@@ -70,6 +70,13 @@ else
70$(obj)/uImage: LOADADDR=$(ZRELADDR) 70$(obj)/uImage: LOADADDR=$(ZRELADDR)
71endif 71endif
72 72
73ifeq ($(CONFIG_THUMB2_KERNEL),y)
74# Set bit 0 to 1 so that "mov pc, rx" switches to Thumb-2 mode
75$(obj)/uImage: STARTADDR=$(shell echo $(LOADADDR) | sed -e "s/.$$/1/")
76else
77$(obj)/uImage: STARTADDR=$(LOADADDR)
78endif
79
73$(obj)/uImage: $(obj)/zImage FORCE 80$(obj)/uImage: $(obj)/zImage FORCE
74 $(call if_changed,uimage) 81 $(call if_changed,uimage)
75 @echo ' Image $@ is ready' 82 @echo ' Image $@ is ready'
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 4515728c5345..fa6fbf45cf3b 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -140,7 +140,8 @@ start:
140 tst r2, #3 @ not user? 140 tst r2, #3 @ not user?
141 bne not_angel 141 bne not_angel
142 mov r0, #0x17 @ angel_SWIreason_EnterSVC 142 mov r0, #0x17 @ angel_SWIreason_EnterSVC
143 swi 0x123456 @ angel_SWI_ARM 143 ARM( swi 0x123456 ) @ angel_SWI_ARM
144 THUMB( svc 0xab ) @ angel_SWI_THUMB
144not_angel: 145not_angel:
145 mrs r2, cpsr @ turn off interrupts to 146 mrs r2, cpsr @ turn off interrupts to
146 orr r2, r2, #0xc0 @ prevent angel from running 147 orr r2, r2, #0xc0 @ prevent angel from running
@@ -161,7 +162,9 @@ not_angel:
161 162
162 .text 163 .text
163 adr r0, LC0 164 adr r0, LC0
164 ldmia r0, {r1, r2, r3, r4, r5, r6, ip, sp} 165 ARM( ldmia r0, {r1, r2, r3, r4, r5, r6, ip, sp} )
166 THUMB( ldmia r0, {r1, r2, r3, r4, r5, r6, ip} )
167 THUMB( ldr sp, [r0, #28] )
165 subs r0, r0, r1 @ calculate the delta offset 168 subs r0, r0, r1 @ calculate the delta offset
166 169
167 @ if delta is zero, we are 170 @ if delta is zero, we are
@@ -263,22 +266,25 @@ not_relocated: mov r0, #0
263 * r6 = processor ID 266 * r6 = processor ID
264 * r7 = architecture ID 267 * r7 = architecture ID
265 * r8 = atags pointer 268 * r8 = atags pointer
266 * r9-r14 = corrupted 269 * r9-r12,r14 = corrupted
267 */ 270 */
268 add r1, r5, r0 @ end of decompressed kernel 271 add r1, r5, r0 @ end of decompressed kernel
269 adr r2, reloc_start 272 adr r2, reloc_start
270 ldr r3, LC1 273 ldr r3, LC1
271 add r3, r2, r3 274 add r3, r2, r3
2721: ldmia r2!, {r9 - r14} @ copy relocation code 2751: ldmia r2!, {r9 - r12, r14} @ copy relocation code
273 stmia r1!, {r9 - r14} 276 stmia r1!, {r9 - r12, r14}
274 ldmia r2!, {r9 - r14} 277 ldmia r2!, {r9 - r12, r14}
275 stmia r1!, {r9 - r14} 278 stmia r1!, {r9 - r12, r14}
276 cmp r2, r3 279 cmp r2, r3
277 blo 1b 280 blo 1b
278 add sp, r1, #128 @ relocate the stack 281 mov sp, r1
282 add sp, sp, #128 @ relocate the stack
279 283
280 bl cache_clean_flush 284 bl cache_clean_flush
281 add pc, r5, r0 @ call relocation code 285 ARM( add pc, r5, r0 ) @ call relocation code
286 THUMB( add r12, r5, r0 )
287 THUMB( mov pc, r12 ) @ call relocation code
282 288
283/* 289/*
284 * We're not in danger of overwriting ourselves. Do this the simple way. 290 * We're not in danger of overwriting ourselves. Do this the simple way.
@@ -291,6 +297,7 @@ wont_overwrite: mov r0, r4
291 bl decompress_kernel 297 bl decompress_kernel
292 b call_kernel 298 b call_kernel
293 299
300 .align 2
294 .type LC0, #object 301 .type LC0, #object
295LC0: .word LC0 @ r1 302LC0: .word LC0 @ r1
296 .word __bss_start @ r2 303 .word __bss_start @ r2
@@ -431,6 +438,7 @@ ENDPROC(__setup_mmu)
431 438
432__armv4_mmu_cache_on: 439__armv4_mmu_cache_on:
433 mov r12, lr 440 mov r12, lr
441#ifdef CONFIG_MMU
434 bl __setup_mmu 442 bl __setup_mmu
435 mov r0, #0 443 mov r0, #0
436 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 444 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
@@ -444,10 +452,12 @@ __armv4_mmu_cache_on:
444 bl __common_mmu_cache_on 452 bl __common_mmu_cache_on
445 mov r0, #0 453 mov r0, #0
446 mcr p15, 0, r0, c8, c7, 0 @ flush I,D TLBs 454 mcr p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
455#endif
447 mov pc, r12 456 mov pc, r12
448 457
449__armv7_mmu_cache_on: 458__armv7_mmu_cache_on:
450 mov r12, lr 459 mov r12, lr
460#ifdef CONFIG_MMU
451 mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0 461 mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0
452 tst r11, #0xf @ VMSA 462 tst r11, #0xf @ VMSA
453 blne __setup_mmu 463 blne __setup_mmu
@@ -455,9 +465,11 @@ __armv7_mmu_cache_on:
455 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 465 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
456 tst r11, #0xf @ VMSA 466 tst r11, #0xf @ VMSA
457 mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs 467 mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
468#endif
458 mrc p15, 0, r0, c1, c0, 0 @ read control reg 469 mrc p15, 0, r0, c1, c0, 0 @ read control reg
459 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement 470 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
460 orr r0, r0, #0x003c @ write buffer 471 orr r0, r0, #0x003c @ write buffer
472#ifdef CONFIG_MMU
461#ifdef CONFIG_CPU_ENDIAN_BE8 473#ifdef CONFIG_CPU_ENDIAN_BE8
462 orr r0, r0, #1 << 25 @ big-endian page tables 474 orr r0, r0, #1 << 25 @ big-endian page tables
463#endif 475#endif
@@ -465,6 +477,7 @@ __armv7_mmu_cache_on:
465 movne r1, #-1 477 movne r1, #-1
466 mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer 478 mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer
467 mcrne p15, 0, r1, c3, c0, 0 @ load domain access control 479 mcrne p15, 0, r1, c3, c0, 0 @ load domain access control
480#endif
468 mcr p15, 0, r0, c1, c0, 0 @ load control register 481 mcr p15, 0, r0, c1, c0, 0 @ load control register
469 mrc p15, 0, r0, c1, c0, 0 @ and read it back 482 mrc p15, 0, r0, c1, c0, 0 @ and read it back
470 mov r0, #0 483 mov r0, #0
@@ -498,6 +511,7 @@ __arm6_mmu_cache_on:
498 mov pc, r12 511 mov pc, r12
499 512
500__common_mmu_cache_on: 513__common_mmu_cache_on:
514#ifndef CONFIG_THUMB2_KERNEL
501#ifndef DEBUG 515#ifndef DEBUG
502 orr r0, r0, #0x000d @ Write buffer, mmu 516 orr r0, r0, #0x000d @ Write buffer, mmu
503#endif 517#endif
@@ -509,6 +523,7 @@ __common_mmu_cache_on:
5091: mcr p15, 0, r0, c1, c0, 0 @ load control register 5231: mcr p15, 0, r0, c1, c0, 0 @ load control register
510 mrc p15, 0, r0, c1, c0, 0 @ and read it back to 524 mrc p15, 0, r0, c1, c0, 0 @ and read it back to
511 sub pc, lr, r0, lsr #32 @ properly flush pipeline 525 sub pc, lr, r0, lsr #32 @ properly flush pipeline
526#endif
512 527
513/* 528/*
514 * All code following this line is relocatable. It is relocated by 529 * All code following this line is relocatable. It is relocated by
@@ -522,7 +537,7 @@ __common_mmu_cache_on:
522 * r6 = processor ID 537 * r6 = processor ID
523 * r7 = architecture ID 538 * r7 = architecture ID
524 * r8 = atags pointer 539 * r8 = atags pointer
525 * r9-r14 = corrupted 540 * r9-r12,r14 = corrupted
526 */ 541 */
527 .align 5 542 .align 5
528reloc_start: add r9, r5, r0 543reloc_start: add r9, r5, r0
@@ -531,13 +546,14 @@ reloc_start: add r9, r5, r0
531 mov r1, r4 546 mov r1, r4
5321: 5471:
533 .rept 4 548 .rept 4
534 ldmia r5!, {r0, r2, r3, r10 - r14} @ relocate kernel 549 ldmia r5!, {r0, r2, r3, r10 - r12, r14} @ relocate kernel
535 stmia r1!, {r0, r2, r3, r10 - r14} 550 stmia r1!, {r0, r2, r3, r10 - r12, r14}
536 .endr 551 .endr
537 552
538 cmp r5, r9 553 cmp r5, r9
539 blo 1b 554 blo 1b
540 add sp, r1, #128 @ relocate the stack 555 mov sp, r1
556 add sp, sp, #128 @ relocate the stack
541 debug_reloc_end 557 debug_reloc_end
542 558
543call_kernel: bl cache_clean_flush 559call_kernel: bl cache_clean_flush
@@ -571,7 +587,9 @@ call_cache_fn: adr r12, proc_types
571 ldr r2, [r12, #4] @ get mask 587 ldr r2, [r12, #4] @ get mask
572 eor r1, r1, r6 @ (real ^ match) 588 eor r1, r1, r6 @ (real ^ match)
573 tst r1, r2 @ & mask 589 tst r1, r2 @ & mask
574 addeq pc, r12, r3 @ call cache function 590 ARM( addeq pc, r12, r3 ) @ call cache function
591 THUMB( addeq r12, r3 )
592 THUMB( moveq pc, r12 ) @ call cache function
575 add r12, r12, #4*5 593 add r12, r12, #4*5
576 b 1b 594 b 1b
577 595
@@ -589,13 +607,15 @@ call_cache_fn: adr r12, proc_types
589 * methods. Writeback caches _must_ have the flush method 607 * methods. Writeback caches _must_ have the flush method
590 * defined. 608 * defined.
591 */ 609 */
610 .align 2
592 .type proc_types,#object 611 .type proc_types,#object
593proc_types: 612proc_types:
594 .word 0x41560600 @ ARM6/610 613 .word 0x41560600 @ ARM6/610
595 .word 0xffffffe0 614 .word 0xffffffe0
596 b __arm6_mmu_cache_off @ works, but slow 615 W(b) __arm6_mmu_cache_off @ works, but slow
597 b __arm6_mmu_cache_off 616 W(b) __arm6_mmu_cache_off
598 mov pc, lr 617 mov pc, lr
618 THUMB( nop )
599@ b __arm6_mmu_cache_on @ untested 619@ b __arm6_mmu_cache_on @ untested
600@ b __arm6_mmu_cache_off 620@ b __arm6_mmu_cache_off
601@ b __armv3_mmu_cache_flush 621@ b __armv3_mmu_cache_flush
@@ -603,76 +623,84 @@ proc_types:
603 .word 0x00000000 @ old ARM ID 623 .word 0x00000000 @ old ARM ID
604 .word 0x0000f000 624 .word 0x0000f000
605 mov pc, lr 625 mov pc, lr
626 THUMB( nop )
606 mov pc, lr 627 mov pc, lr
628 THUMB( nop )
607 mov pc, lr 629 mov pc, lr
630 THUMB( nop )
608 631
609 .word 0x41007000 @ ARM7/710 632 .word 0x41007000 @ ARM7/710
610 .word 0xfff8fe00 633 .word 0xfff8fe00
611 b __arm7_mmu_cache_off 634 W(b) __arm7_mmu_cache_off
612 b __arm7_mmu_cache_off 635 W(b) __arm7_mmu_cache_off
613 mov pc, lr 636 mov pc, lr
637 THUMB( nop )
614 638
615 .word 0x41807200 @ ARM720T (writethrough) 639 .word 0x41807200 @ ARM720T (writethrough)
616 .word 0xffffff00 640 .word 0xffffff00
617 b __armv4_mmu_cache_on 641 W(b) __armv4_mmu_cache_on
618 b __armv4_mmu_cache_off 642 W(b) __armv4_mmu_cache_off
619 mov pc, lr 643 mov pc, lr
644 THUMB( nop )
620 645
621 .word 0x41007400 @ ARM74x 646 .word 0x41007400 @ ARM74x
622 .word 0xff00ff00 647 .word 0xff00ff00
623 b __armv3_mpu_cache_on 648 W(b) __armv3_mpu_cache_on
624 b __armv3_mpu_cache_off 649 W(b) __armv3_mpu_cache_off
625 b __armv3_mpu_cache_flush 650 W(b) __armv3_mpu_cache_flush
626 651
627 .word 0x41009400 @ ARM94x 652 .word 0x41009400 @ ARM94x
628 .word 0xff00ff00 653 .word 0xff00ff00
629 b __armv4_mpu_cache_on 654 W(b) __armv4_mpu_cache_on
630 b __armv4_mpu_cache_off 655 W(b) __armv4_mpu_cache_off
631 b __armv4_mpu_cache_flush 656 W(b) __armv4_mpu_cache_flush
632 657
633 .word 0x00007000 @ ARM7 IDs 658 .word 0x00007000 @ ARM7 IDs
634 .word 0x0000f000 659 .word 0x0000f000
635 mov pc, lr 660 mov pc, lr
661 THUMB( nop )
636 mov pc, lr 662 mov pc, lr
663 THUMB( nop )
637 mov pc, lr 664 mov pc, lr
665 THUMB( nop )
638 666
639 @ Everything from here on will be the new ID system. 667 @ Everything from here on will be the new ID system.
640 668
641 .word 0x4401a100 @ sa110 / sa1100 669 .word 0x4401a100 @ sa110 / sa1100
642 .word 0xffffffe0 670 .word 0xffffffe0
643 b __armv4_mmu_cache_on 671 W(b) __armv4_mmu_cache_on
644 b __armv4_mmu_cache_off 672 W(b) __armv4_mmu_cache_off
645 b __armv4_mmu_cache_flush 673 W(b) __armv4_mmu_cache_flush
646 674
647 .word 0x6901b110 @ sa1110 675 .word 0x6901b110 @ sa1110
648 .word 0xfffffff0 676 .word 0xfffffff0
649 b __armv4_mmu_cache_on 677 W(b) __armv4_mmu_cache_on
650 b __armv4_mmu_cache_off 678 W(b) __armv4_mmu_cache_off
651 b __armv4_mmu_cache_flush 679 W(b) __armv4_mmu_cache_flush
652 680
653 .word 0x56056930 681 .word 0x56056930
654 .word 0xff0ffff0 @ PXA935 682 .word 0xff0ffff0 @ PXA935
655 b __armv4_mmu_cache_on 683 W(b) __armv4_mmu_cache_on
656 b __armv4_mmu_cache_off 684 W(b) __armv4_mmu_cache_off
657 b __armv4_mmu_cache_flush 685 W(b) __armv4_mmu_cache_flush
658 686
659 .word 0x56158000 @ PXA168 687 .word 0x56158000 @ PXA168
660 .word 0xfffff000 688 .word 0xfffff000
661 b __armv4_mmu_cache_on 689 W(b) __armv4_mmu_cache_on
662 b __armv4_mmu_cache_off 690 W(b) __armv4_mmu_cache_off
663 b __armv5tej_mmu_cache_flush 691 W(b) __armv5tej_mmu_cache_flush
664 692
665 .word 0x56056930 693 .word 0x56056930
666 .word 0xff0ffff0 @ PXA935 694 .word 0xff0ffff0 @ PXA935
667 b __armv4_mmu_cache_on 695 W(b) __armv4_mmu_cache_on
668 b __armv4_mmu_cache_off 696 W(b) __armv4_mmu_cache_off
669 b __armv4_mmu_cache_flush 697 W(b) __armv4_mmu_cache_flush
670 698
671 .word 0x56050000 @ Feroceon 699 .word 0x56050000 @ Feroceon
672 .word 0xff0f0000 700 .word 0xff0f0000
673 b __armv4_mmu_cache_on 701 W(b) __armv4_mmu_cache_on
674 b __armv4_mmu_cache_off 702 W(b) __armv4_mmu_cache_off
675 b __armv5tej_mmu_cache_flush 703 W(b) __armv5tej_mmu_cache_flush
676 704
677#ifdef CONFIG_CPU_FEROCEON_OLD_ID 705#ifdef CONFIG_CPU_FEROCEON_OLD_ID
678 /* this conflicts with the standard ARMv5TE entry */ 706 /* this conflicts with the standard ARMv5TE entry */
@@ -685,47 +713,50 @@ proc_types:
685 713
686 .word 0x66015261 @ FA526 714 .word 0x66015261 @ FA526
687 .word 0xff01fff1 715 .word 0xff01fff1
688 b __fa526_cache_on 716 W(b) __fa526_cache_on
689 b __armv4_mmu_cache_off 717 W(b) __armv4_mmu_cache_off
690 b __fa526_cache_flush 718 W(b) __fa526_cache_flush
691 719
692 @ These match on the architecture ID 720 @ These match on the architecture ID
693 721
694 .word 0x00020000 @ ARMv4T 722 .word 0x00020000 @ ARMv4T
695 .word 0x000f0000 723 .word 0x000f0000
696 b __armv4_mmu_cache_on 724 W(b) __armv4_mmu_cache_on
697 b __armv4_mmu_cache_off 725 W(b) __armv4_mmu_cache_off
698 b __armv4_mmu_cache_flush 726 W(b) __armv4_mmu_cache_flush
699 727
700 .word 0x00050000 @ ARMv5TE 728 .word 0x00050000 @ ARMv5TE
701 .word 0x000f0000 729 .word 0x000f0000
702 b __armv4_mmu_cache_on 730 W(b) __armv4_mmu_cache_on
703 b __armv4_mmu_cache_off 731 W(b) __armv4_mmu_cache_off
704 b __armv4_mmu_cache_flush 732 W(b) __armv4_mmu_cache_flush
705 733
706 .word 0x00060000 @ ARMv5TEJ 734 .word 0x00060000 @ ARMv5TEJ
707 .word 0x000f0000 735 .word 0x000f0000
708 b __armv4_mmu_cache_on 736 W(b) __armv4_mmu_cache_on
709 b __armv4_mmu_cache_off 737 W(b) __armv4_mmu_cache_off
710 b __armv5tej_mmu_cache_flush 738 W(b) __armv4_mmu_cache_flush
711 739
712 .word 0x0007b000 @ ARMv6 740 .word 0x0007b000 @ ARMv6
713 .word 0x000ff000 741 .word 0x000ff000
714 b __armv4_mmu_cache_on 742 W(b) __armv4_mmu_cache_on
715 b __armv4_mmu_cache_off 743 W(b) __armv4_mmu_cache_off
716 b __armv6_mmu_cache_flush 744 W(b) __armv6_mmu_cache_flush
717 745
718 .word 0x000f0000 @ new CPU Id 746 .word 0x000f0000 @ new CPU Id
719 .word 0x000f0000 747 .word 0x000f0000
720 b __armv7_mmu_cache_on 748 W(b) __armv7_mmu_cache_on
721 b __armv7_mmu_cache_off 749 W(b) __armv7_mmu_cache_off
722 b __armv7_mmu_cache_flush 750 W(b) __armv7_mmu_cache_flush
723 751
724 .word 0 @ unrecognised type 752 .word 0 @ unrecognised type
725 .word 0 753 .word 0
726 mov pc, lr 754 mov pc, lr
755 THUMB( nop )
727 mov pc, lr 756 mov pc, lr
757 THUMB( nop )
728 mov pc, lr 758 mov pc, lr
759 THUMB( nop )
729 760
730 .size proc_types, . - proc_types 761 .size proc_types, . - proc_types
731 762
@@ -760,22 +791,30 @@ __armv3_mpu_cache_off:
760 mov pc, lr 791 mov pc, lr
761 792
762__armv4_mmu_cache_off: 793__armv4_mmu_cache_off:
794#ifdef CONFIG_MMU
763 mrc p15, 0, r0, c1, c0 795 mrc p15, 0, r0, c1, c0
764 bic r0, r0, #0x000d 796 bic r0, r0, #0x000d
765 mcr p15, 0, r0, c1, c0 @ turn MMU and cache off 797 mcr p15, 0, r0, c1, c0 @ turn MMU and cache off
766 mov r0, #0 798 mov r0, #0
767 mcr p15, 0, r0, c7, c7 @ invalidate whole cache v4 799 mcr p15, 0, r0, c7, c7 @ invalidate whole cache v4
768 mcr p15, 0, r0, c8, c7 @ invalidate whole TLB v4 800 mcr p15, 0, r0, c8, c7 @ invalidate whole TLB v4
801#endif
769 mov pc, lr 802 mov pc, lr
770 803
771__armv7_mmu_cache_off: 804__armv7_mmu_cache_off:
772 mrc p15, 0, r0, c1, c0 805 mrc p15, 0, r0, c1, c0
806#ifdef CONFIG_MMU
773 bic r0, r0, #0x000d 807 bic r0, r0, #0x000d
808#else
809 bic r0, r0, #0x000c
810#endif
774 mcr p15, 0, r0, c1, c0 @ turn MMU and cache off 811 mcr p15, 0, r0, c1, c0 @ turn MMU and cache off
775 mov r12, lr 812 mov r12, lr
776 bl __armv7_mmu_cache_flush 813 bl __armv7_mmu_cache_flush
777 mov r0, #0 814 mov r0, #0
815#ifdef CONFIG_MMU
778 mcr p15, 0, r0, c8, c7, 0 @ invalidate whole TLB 816 mcr p15, 0, r0, c8, c7, 0 @ invalidate whole TLB
817#endif
779 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTC 818 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTC
780 mcr p15, 0, r0, c7, c10, 4 @ DSB 819 mcr p15, 0, r0, c7, c10, 4 @ DSB
781 mcr p15, 0, r0, c7, c5, 4 @ ISB 820 mcr p15, 0, r0, c7, c5, 4 @ ISB
@@ -852,7 +891,7 @@ __armv7_mmu_cache_flush:
852 b iflush 891 b iflush
853hierarchical: 892hierarchical:
854 mcr p15, 0, r10, c7, c10, 5 @ DMB 893 mcr p15, 0, r10, c7, c10, 5 @ DMB
855 stmfd sp!, {r0-r5, r7, r9, r11} 894 stmfd sp!, {r0-r7, r9-r11}
856 mrc p15, 1, r0, c0, c0, 1 @ read clidr 895 mrc p15, 1, r0, c0, c0, 1 @ read clidr
857 ands r3, r0, #0x7000000 @ extract loc from clidr 896 ands r3, r0, #0x7000000 @ extract loc from clidr
858 mov r3, r3, lsr #23 @ left align loc bit field 897 mov r3, r3, lsr #23 @ left align loc bit field
@@ -877,8 +916,12 @@ loop1:
877loop2: 916loop2:
878 mov r9, r4 @ create working copy of max way size 917 mov r9, r4 @ create working copy of max way size
879loop3: 918loop3:
880 orr r11, r10, r9, lsl r5 @ factor way and cache number into r11 919 ARM( orr r11, r10, r9, lsl r5 ) @ factor way and cache number into r11
881 orr r11, r11, r7, lsl r2 @ factor index number into r11 920 ARM( orr r11, r11, r7, lsl r2 ) @ factor index number into r11
921 THUMB( lsl r6, r9, r5 )
922 THUMB( orr r11, r10, r6 ) @ factor way and cache number into r11
923 THUMB( lsl r6, r7, r2 )
924 THUMB( orr r11, r11, r6 ) @ factor index number into r11
882 mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way 925 mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way
883 subs r9, r9, #1 @ decrement the way 926 subs r9, r9, #1 @ decrement the way
884 bge loop3 927 bge loop3
@@ -889,7 +932,7 @@ skip:
889 cmp r3, r10 932 cmp r3, r10
890 bgt loop1 933 bgt loop1
891finished: 934finished:
892 ldmfd sp!, {r0-r5, r7, r9, r11} 935 ldmfd sp!, {r0-r7, r9-r11}
893 mov r10, #0 @ swith back to cache level 0 936 mov r10, #0 @ swith back to cache level 0
894 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr 937 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
895iflush: 938iflush:
@@ -923,9 +966,13 @@ __armv4_mmu_cache_flush:
923 mov r11, #8 966 mov r11, #8
924 mov r11, r11, lsl r3 @ cache line size in bytes 967 mov r11, r11, lsl r3 @ cache line size in bytes
925no_cache_id: 968no_cache_id:
926 bic r1, pc, #63 @ align to longest cache line 969 mov r1, pc
970 bic r1, r1, #63 @ align to longest cache line
927 add r2, r1, r2 971 add r2, r1, r2
9281: ldr r3, [r1], r11 @ s/w flush D cache 9721:
973 ARM( ldr r3, [r1], r11 ) @ s/w flush D cache
974 THUMB( ldr r3, [r1] ) @ s/w flush D cache
975 THUMB( add r1, r1, r11 )
929 teq r1, r2 976 teq r1, r2
930 bne 1b 977 bne 1b
931 978
@@ -945,6 +992,7 @@ __armv3_mpu_cache_flush:
945 * memory, which again must be relocatable. 992 * memory, which again must be relocatable.
946 */ 993 */
947#ifdef DEBUG 994#ifdef DEBUG
995 .align 2
948 .type phexbuf,#object 996 .type phexbuf,#object
949phexbuf: .space 12 997phexbuf: .space 12
950 .size phexbuf, . - phexbuf 998 .size phexbuf, . - phexbuf
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index 6ed89836e908..920ced0b73c5 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -22,10 +22,20 @@
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25#include <linux/amba/bus.h>
25 26
26#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
27#include <asm/hardware/vic.h> 28#include <asm/hardware/vic.h>
28 29
30static void vic_ack_irq(unsigned int irq)
31{
32 void __iomem *base = get_irq_chip_data(irq);
33 irq &= 31;
34 writel(1 << irq, base + VIC_INT_ENABLE_CLEAR);
35 /* moreover, clear the soft-triggered, in case it was the reason */
36 writel(1 << irq, base + VIC_INT_SOFT_CLEAR);
37}
38
29static void vic_mask_irq(unsigned int irq) 39static void vic_mask_irq(unsigned int irq)
30{ 40{
31 void __iomem *base = get_irq_chip_data(irq); 41 void __iomem *base = get_irq_chip_data(irq);
@@ -253,12 +263,16 @@ static inline void vic_pm_register(void __iomem *base, unsigned int irq, u32 arg
253 263
254static struct irq_chip vic_chip = { 264static struct irq_chip vic_chip = {
255 .name = "VIC", 265 .name = "VIC",
256 .ack = vic_mask_irq, 266 .ack = vic_ack_irq,
257 .mask = vic_mask_irq, 267 .mask = vic_mask_irq,
258 .unmask = vic_unmask_irq, 268 .unmask = vic_unmask_irq,
259 .set_wake = vic_set_wake, 269 .set_wake = vic_set_wake,
260}; 270};
261 271
272/* The PL190 cell from ARM has been modified by ST, so handle both here */
273static void vik_init_st(void __iomem *base, unsigned int irq_start,
274 u32 vic_sources);
275
262/** 276/**
263 * vic_init - initialise a vectored interrupt controller 277 * vic_init - initialise a vectored interrupt controller
264 * @base: iomem base address 278 * @base: iomem base address
@@ -270,6 +284,28 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
270 u32 vic_sources, u32 resume_sources) 284 u32 vic_sources, u32 resume_sources)
271{ 285{
272 unsigned int i; 286 unsigned int i;
287 u32 cellid = 0;
288 enum amba_vendor vendor;
289
290 /* Identify which VIC cell this one is, by reading the ID */
291 for (i = 0; i < 4; i++) {
292 u32 addr = ((u32)base & PAGE_MASK) + 0xfe0 + (i * 4);
293 cellid |= (readl(addr) & 0xff) << (8 * i);
294 }
295 vendor = (cellid >> 12) & 0xff;
296 printk(KERN_INFO "VIC @%p: id 0x%08x, vendor 0x%02x\n",
297 base, cellid, vendor);
298
299 switch(vendor) {
300 case AMBA_VENDOR_ST:
301 vik_init_st(base, irq_start, vic_sources);
302 return;
303 default:
304 printk(KERN_WARNING "VIC: unknown vendor, continuing anyways\n");
305 /* fall through */
306 case AMBA_VENDOR_ARM:
307 break;
308 }
273 309
274 /* Disable all interrupts initially. */ 310 /* Disable all interrupts initially. */
275 311
@@ -306,3 +342,60 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
306 342
307 vic_pm_register(base, irq_start, resume_sources); 343 vic_pm_register(base, irq_start, resume_sources);
308} 344}
345
346/*
347 * The PL190 cell from ARM has been modified by ST to handle 64 interrupts.
348 * The original cell has 32 interrupts, while the modified one has 64,
349 * replocating two blocks 0x00..0x1f in 0x20..0x3f. In that case
350 * the probe function is called twice, with base set to offset 000
351 * and 020 within the page. We call this "second block".
352 */
353static void __init vik_init_st(void __iomem *base, unsigned int irq_start,
354 u32 vic_sources)
355{
356 unsigned int i;
357 int vic_2nd_block = ((unsigned long)base & ~PAGE_MASK) != 0;
358
359 /* Disable all interrupts initially. */
360
361 writel(0, base + VIC_INT_SELECT);
362 writel(0, base + VIC_INT_ENABLE);
363 writel(~0, base + VIC_INT_ENABLE_CLEAR);
364 writel(0, base + VIC_IRQ_STATUS);
365 writel(0, base + VIC_ITCR);
366 writel(~0, base + VIC_INT_SOFT_CLEAR);
367
368 /*
369 * Make sure we clear all existing interrupts. The vector registers
370 * in this cell are after the second block of general registers,
371 * so we can address them using standard offsets, but only from
372 * the second base address, which is 0x20 in the page
373 */
374 if (vic_2nd_block) {
375 writel(0, base + VIC_PL190_VECT_ADDR);
376 for (i = 0; i < 19; i++) {
377 unsigned int value;
378
379 value = readl(base + VIC_PL190_VECT_ADDR);
380 writel(value, base + VIC_PL190_VECT_ADDR);
381 }
382 /* ST has 16 vectors as well, but we don't enable them by now */
383 for (i = 0; i < 16; i++) {
384 void __iomem *reg = base + VIC_VECT_CNTL0 + (i * 4);
385 writel(0, reg);
386 }
387
388 writel(32, base + VIC_PL190_DEF_VECT_ADDR);
389 }
390
391 for (i = 0; i < 32; i++) {
392 if (vic_sources & (1 << i)) {
393 unsigned int irq = irq_start + i;
394
395 set_irq_chip(irq, &vic_chip);
396 set_irq_chip_data(irq, base);
397 set_irq_handler(irq, handle_level_irq);
398 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
399 }
400 }
401}
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
new file mode 100644
index 000000000000..9bb45b932f04
--- /dev/null
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -0,0 +1,1316 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30
4# Tue Jun 23 22:57:16 2009
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_STACKTRACE_SUPPORT=y
14CONFIG_HAVE_LATENCYTOP_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20CONFIG_GENERIC_HWEIGHT=y
21CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
23CONFIG_VECTORS_BASE=0xffff0000
24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25CONFIG_CONSTRUCTORS=y
26
27#
28# General setup
29#
30CONFIG_EXPERIMENTAL=y
31CONFIG_BROKEN_ON_SMP=y
32CONFIG_LOCK_KERNEL=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_AUDIT is not set
43
44#
45# RCU Subsystem
46#
47CONFIG_CLASSIC_RCU=y
48# CONFIG_TREE_RCU is not set
49# CONFIG_PREEMPT_RCU is not set
50# CONFIG_TREE_RCU_TRACE is not set
51# CONFIG_PREEMPT_RCU_TRACE is not set
52CONFIG_IKCONFIG=y
53CONFIG_IKCONFIG_PROC=y
54CONFIG_LOG_BUF_SHIFT=14
55# CONFIG_GROUP_SCHED is not set
56# CONFIG_CGROUPS is not set
57CONFIG_SYSFS_DEPRECATED=y
58CONFIG_SYSFS_DEPRECATED_V2=y
59# CONFIG_RELAY is not set
60# CONFIG_NAMESPACES is not set
61CONFIG_BLK_DEV_INITRD=y
62CONFIG_INITRAMFS_SOURCE=""
63CONFIG_RD_GZIP=y
64# CONFIG_RD_BZIP2 is not set
65# CONFIG_RD_LZMA is not set
66CONFIG_CC_OPTIMIZE_FOR_SIZE=y
67CONFIG_SYSCTL=y
68CONFIG_ANON_INODES=y
69CONFIG_EMBEDDED=y
70CONFIG_UID16=y
71CONFIG_SYSCTL_SYSCALL=y
72CONFIG_KALLSYMS=y
73CONFIG_KALLSYMS_ALL=y
74# CONFIG_KALLSYMS_EXTRA_PASS is not set
75CONFIG_HOTPLUG=y
76CONFIG_PRINTK=y
77CONFIG_BUG=y
78CONFIG_ELF_CORE=y
79CONFIG_BASE_FULL=y
80CONFIG_FUTEX=y
81CONFIG_EPOLL=y
82CONFIG_SIGNALFD=y
83CONFIG_TIMERFD=y
84CONFIG_EVENTFD=y
85CONFIG_SHMEM=y
86CONFIG_AIO=y
87
88#
89# Performance Counters
90#
91CONFIG_VM_EVENT_COUNTERS=y
92# CONFIG_STRIP_ASM_SYMS is not set
93CONFIG_COMPAT_BRK=y
94CONFIG_SLAB=y
95# CONFIG_SLUB is not set
96# CONFIG_SLOB is not set
97# CONFIG_PROFILING is not set
98# CONFIG_MARKERS is not set
99CONFIG_HAVE_OPROFILE=y
100# CONFIG_KPROBES is not set
101CONFIG_HAVE_KPROBES=y
102CONFIG_HAVE_KRETPROBES=y
103CONFIG_HAVE_CLK=y
104
105#
106# GCOV-based kernel profiling
107#
108# CONFIG_SLOW_WORK is not set
109CONFIG_HAVE_GENERIC_DMA_COHERENT=y
110CONFIG_SLABINFO=y
111CONFIG_RT_MUTEXES=y
112CONFIG_BASE_SMALL=0
113CONFIG_MODULES=y
114# CONFIG_MODULE_FORCE_LOAD is not set
115CONFIG_MODULE_UNLOAD=y
116# CONFIG_MODULE_FORCE_UNLOAD is not set
117# CONFIG_MODVERSIONS is not set
118# CONFIG_MODULE_SRCVERSION_ALL is not set
119CONFIG_BLOCK=y
120CONFIG_LBDAF=y
121# CONFIG_BLK_DEV_BSG is not set
122# CONFIG_BLK_DEV_INTEGRITY is not set
123
124#
125# IO Schedulers
126#
127CONFIG_IOSCHED_NOOP=y
128CONFIG_IOSCHED_AS=y
129CONFIG_IOSCHED_DEADLINE=y
130CONFIG_IOSCHED_CFQ=y
131CONFIG_DEFAULT_AS=y
132# CONFIG_DEFAULT_DEADLINE is not set
133# CONFIG_DEFAULT_CFQ is not set
134# CONFIG_DEFAULT_NOOP is not set
135CONFIG_DEFAULT_IOSCHED="anticipatory"
136CONFIG_FREEZER=y
137
138#
139# System Type
140#
141# CONFIG_ARCH_AAEC2000 is not set
142# CONFIG_ARCH_INTEGRATOR is not set
143# CONFIG_ARCH_REALVIEW is not set
144# CONFIG_ARCH_VERSATILE is not set
145# CONFIG_ARCH_AT91 is not set
146# CONFIG_ARCH_CLPS711X is not set
147# CONFIG_ARCH_GEMINI is not set
148# CONFIG_ARCH_EBSA110 is not set
149# CONFIG_ARCH_EP93XX is not set
150# CONFIG_ARCH_FOOTBRIDGE is not set
151# CONFIG_ARCH_MXC is not set
152# CONFIG_ARCH_STMP3XXX is not set
153# CONFIG_ARCH_NETX is not set
154# CONFIG_ARCH_H720X is not set
155CONFIG_ARCH_NOMADIK=y
156# CONFIG_ARCH_IOP13XX is not set
157# CONFIG_ARCH_IOP32X is not set
158# CONFIG_ARCH_IOP33X is not set
159# CONFIG_ARCH_IXP23XX is not set
160# CONFIG_ARCH_IXP2000 is not set
161# CONFIG_ARCH_IXP4XX is not set
162# CONFIG_ARCH_L7200 is not set
163# CONFIG_ARCH_KIRKWOOD is not set
164# CONFIG_ARCH_LOKI is not set
165# CONFIG_ARCH_MV78XX0 is not set
166# CONFIG_ARCH_ORION5X is not set
167# CONFIG_ARCH_MMP is not set
168# CONFIG_ARCH_KS8695 is not set
169# CONFIG_ARCH_NS9XXX is not set
170# CONFIG_ARCH_W90X900 is not set
171# CONFIG_ARCH_PNX4008 is not set
172# CONFIG_ARCH_PXA is not set
173# CONFIG_ARCH_MSM is not set
174# CONFIG_ARCH_RPC is not set
175# CONFIG_ARCH_SA1100 is not set
176# CONFIG_ARCH_S3C2410 is not set
177# CONFIG_ARCH_S3C64XX is not set
178# CONFIG_ARCH_SHARK is not set
179# CONFIG_ARCH_LH7A40X is not set
180# CONFIG_ARCH_U300 is not set
181# CONFIG_ARCH_DAVINCI is not set
182# CONFIG_ARCH_OMAP is not set
183
184#
185# Nomadik boards
186#
187CONFIG_MACH_NOMADIK_8815NHK=y
188CONFIG_NOMADIK_8815=y
189CONFIG_I2C_BITBANG_8815NHK=y
190
191#
192# Processor Type
193#
194CONFIG_CPU_32=y
195CONFIG_CPU_ARM926T=y
196CONFIG_CPU_32v5=y
197CONFIG_CPU_ABRT_EV5TJ=y
198CONFIG_CPU_PABRT_NOIFAR=y
199CONFIG_CPU_CACHE_VIVT=y
200CONFIG_CPU_COPY_V4WB=y
201CONFIG_CPU_TLB_V4WBI=y
202CONFIG_CPU_CP15=y
203CONFIG_CPU_CP15_MMU=y
204
205#
206# Processor Features
207#
208CONFIG_ARM_THUMB=y
209# CONFIG_CPU_ICACHE_DISABLE is not set
210# CONFIG_CPU_DCACHE_DISABLE is not set
211# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
212# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
213CONFIG_OUTER_CACHE=y
214CONFIG_CACHE_L2X0=y
215CONFIG_ARM_VIC=y
216CONFIG_ARM_VIC_NR=2
217CONFIG_COMMON_CLKDEV=y
218
219#
220# Bus support
221#
222CONFIG_ARM_AMBA=y
223# CONFIG_PCI_SYSCALL is not set
224# CONFIG_ARCH_SUPPORTS_MSI is not set
225# CONFIG_PCCARD is not set
226
227#
228# Kernel Features
229#
230# CONFIG_NO_HZ is not set
231# CONFIG_HIGH_RES_TIMERS is not set
232CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
233CONFIG_VMSPLIT_3G=y
234# CONFIG_VMSPLIT_2G is not set
235# CONFIG_VMSPLIT_1G is not set
236CONFIG_PAGE_OFFSET=0xC0000000
237CONFIG_PREEMPT=y
238CONFIG_HZ=100
239CONFIG_AEABI=y
240CONFIG_OABI_COMPAT=y
241# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
242# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
243# CONFIG_HIGHMEM is not set
244CONFIG_SELECT_MEMORY_MODEL=y
245CONFIG_FLATMEM_MANUAL=y
246# CONFIG_DISCONTIGMEM_MANUAL is not set
247# CONFIG_SPARSEMEM_MANUAL is not set
248CONFIG_FLATMEM=y
249CONFIG_FLAT_NODE_MEM_MAP=y
250CONFIG_PAGEFLAGS_EXTENDED=y
251CONFIG_SPLIT_PTLOCK_CPUS=4096
252# CONFIG_PHYS_ADDR_T_64BIT is not set
253CONFIG_ZONE_DMA_FLAG=0
254CONFIG_VIRT_TO_BUS=y
255CONFIG_HAVE_MLOCK=y
256CONFIG_HAVE_MLOCKED_PAGE_BIT=y
257CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
258CONFIG_ALIGNMENT_TRAP=y
259# CONFIG_UACCESS_WITH_MEMCPY is not set
260
261#
262# Boot options
263#
264CONFIG_ZBOOT_ROM_TEXT=0x0
265CONFIG_ZBOOT_ROM_BSS=0x0
266CONFIG_CMDLINE=""
267# CONFIG_XIP_KERNEL is not set
268# CONFIG_KEXEC is not set
269
270#
271# CPU Power Management
272#
273# CONFIG_CPU_IDLE is not set
274
275#
276# Floating point emulation
277#
278
279#
280# At least one emulation must be selected
281#
282CONFIG_FPE_NWFPE=y
283# CONFIG_FPE_NWFPE_XP is not set
284# CONFIG_FPE_FASTFPE is not set
285# CONFIG_VFP is not set
286
287#
288# Userspace binary formats
289#
290CONFIG_BINFMT_ELF=y
291# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
292CONFIG_HAVE_AOUT=y
293# CONFIG_BINFMT_AOUT is not set
294# CONFIG_BINFMT_MISC is not set
295
296#
297# Power management options
298#
299CONFIG_PM=y
300# CONFIG_PM_DEBUG is not set
301CONFIG_PM_SLEEP=y
302CONFIG_SUSPEND=y
303CONFIG_SUSPEND_FREEZER=y
304# CONFIG_APM_EMULATION is not set
305CONFIG_ARCH_SUSPEND_POSSIBLE=y
306CONFIG_NET=y
307
308#
309# Networking options
310#
311CONFIG_PACKET=y
312# CONFIG_PACKET_MMAP is not set
313CONFIG_UNIX=y
314CONFIG_XFRM=y
315# CONFIG_XFRM_USER is not set
316# CONFIG_XFRM_SUB_POLICY is not set
317# CONFIG_XFRM_MIGRATE is not set
318# CONFIG_XFRM_STATISTICS is not set
319CONFIG_NET_KEY=y
320# CONFIG_NET_KEY_MIGRATE is not set
321CONFIG_INET=y
322CONFIG_IP_MULTICAST=y
323CONFIG_IP_ADVANCED_ROUTER=y
324CONFIG_ASK_IP_FIB_HASH=y
325# CONFIG_IP_FIB_TRIE is not set
326CONFIG_IP_FIB_HASH=y
327# CONFIG_IP_MULTIPLE_TABLES is not set
328# CONFIG_IP_ROUTE_MULTIPATH is not set
329# CONFIG_IP_ROUTE_VERBOSE is not set
330CONFIG_IP_PNP=y
331CONFIG_IP_PNP_DHCP=y
332CONFIG_IP_PNP_BOOTP=y
333# CONFIG_IP_PNP_RARP is not set
334CONFIG_NET_IPIP=y
335CONFIG_NET_IPGRE=y
336CONFIG_NET_IPGRE_BROADCAST=y
337CONFIG_IP_MROUTE=y
338# CONFIG_IP_PIMSM_V1 is not set
339# CONFIG_IP_PIMSM_V2 is not set
340# CONFIG_ARPD is not set
341# CONFIG_SYN_COOKIES is not set
342# CONFIG_INET_AH is not set
343# CONFIG_INET_ESP is not set
344# CONFIG_INET_IPCOMP is not set
345# CONFIG_INET_XFRM_TUNNEL is not set
346CONFIG_INET_TUNNEL=y
347CONFIG_INET_XFRM_MODE_TRANSPORT=y
348CONFIG_INET_XFRM_MODE_TUNNEL=y
349CONFIG_INET_XFRM_MODE_BEET=y
350# CONFIG_INET_LRO is not set
351CONFIG_INET_DIAG=y
352CONFIG_INET_TCP_DIAG=y
353# CONFIG_TCP_CONG_ADVANCED is not set
354CONFIG_TCP_CONG_CUBIC=y
355CONFIG_DEFAULT_TCP_CONG="cubic"
356# CONFIG_TCP_MD5SIG is not set
357# CONFIG_IPV6 is not set
358# CONFIG_NETWORK_SECMARK is not set
359# CONFIG_NETFILTER is not set
360# CONFIG_IP_DCCP is not set
361# CONFIG_IP_SCTP is not set
362# CONFIG_TIPC is not set
363# CONFIG_ATM is not set
364# CONFIG_BRIDGE is not set
365# CONFIG_NET_DSA is not set
366# CONFIG_VLAN_8021Q is not set
367# CONFIG_DECNET is not set
368# CONFIG_LLC2 is not set
369# CONFIG_IPX is not set
370# CONFIG_ATALK is not set
371# CONFIG_X25 is not set
372# CONFIG_LAPB is not set
373# CONFIG_ECONET is not set
374# CONFIG_WAN_ROUTER is not set
375# CONFIG_PHONET is not set
376# CONFIG_IEEE802154 is not set
377# CONFIG_NET_SCHED is not set
378# CONFIG_DCB is not set
379
380#
381# Network testing
382#
383# CONFIG_NET_PKTGEN is not set
384# CONFIG_HAMRADIO is not set
385# CONFIG_CAN is not set
386# CONFIG_IRDA is not set
387CONFIG_BT=m
388CONFIG_BT_L2CAP=m
389CONFIG_BT_SCO=m
390CONFIG_BT_RFCOMM=m
391CONFIG_BT_RFCOMM_TTY=y
392CONFIG_BT_BNEP=m
393CONFIG_BT_BNEP_MC_FILTER=y
394CONFIG_BT_BNEP_PROTO_FILTER=y
395CONFIG_BT_HIDP=m
396
397#
398# Bluetooth device drivers
399#
400CONFIG_BT_HCIUART=m
401CONFIG_BT_HCIUART_H4=y
402CONFIG_BT_HCIUART_BCSP=y
403# CONFIG_BT_HCIUART_LL is not set
404CONFIG_BT_HCIVHCI=m
405# CONFIG_AF_RXRPC is not set
406CONFIG_WIRELESS=y
407# CONFIG_CFG80211 is not set
408CONFIG_WIRELESS_OLD_REGULATORY=y
409# CONFIG_WIRELESS_EXT is not set
410# CONFIG_LIB80211 is not set
411
412#
413# CFG80211 needs to be enabled for MAC80211
414#
415CONFIG_MAC80211_DEFAULT_PS_VALUE=0
416# CONFIG_WIMAX is not set
417# CONFIG_RFKILL is not set
418# CONFIG_NET_9P is not set
419
420#
421# Device Drivers
422#
423
424#
425# Generic Driver Options
426#
427CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
428CONFIG_STANDALONE=y
429CONFIG_PREVENT_FIRMWARE_BUILD=y
430CONFIG_FW_LOADER=y
431CONFIG_FIRMWARE_IN_KERNEL=y
432CONFIG_EXTRA_FIRMWARE=""
433# CONFIG_DEBUG_DRIVER is not set
434# CONFIG_DEBUG_DEVRES is not set
435# CONFIG_SYS_HYPERVISOR is not set
436# CONFIG_CONNECTOR is not set
437CONFIG_MTD=y
438# CONFIG_MTD_DEBUG is not set
439# CONFIG_MTD_CONCAT is not set
440CONFIG_MTD_PARTITIONS=y
441CONFIG_MTD_TESTS=m
442# CONFIG_MTD_REDBOOT_PARTS is not set
443# CONFIG_MTD_CMDLINE_PARTS is not set
444# CONFIG_MTD_AFS_PARTS is not set
445# CONFIG_MTD_AR7_PARTS is not set
446
447#
448# User Modules And Translation Layers
449#
450CONFIG_MTD_CHAR=y
451CONFIG_MTD_BLKDEVS=y
452CONFIG_MTD_BLOCK=y
453# CONFIG_FTL is not set
454# CONFIG_NFTL is not set
455# CONFIG_INFTL is not set
456# CONFIG_RFD_FTL is not set
457# CONFIG_SSFDC is not set
458# CONFIG_MTD_OOPS is not set
459
460#
461# RAM/ROM/Flash chip drivers
462#
463# CONFIG_MTD_CFI is not set
464# CONFIG_MTD_JEDECPROBE is not set
465CONFIG_MTD_MAP_BANK_WIDTH_1=y
466CONFIG_MTD_MAP_BANK_WIDTH_2=y
467CONFIG_MTD_MAP_BANK_WIDTH_4=y
468# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
469# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
470# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
471CONFIG_MTD_CFI_I1=y
472CONFIG_MTD_CFI_I2=y
473# CONFIG_MTD_CFI_I4 is not set
474# CONFIG_MTD_CFI_I8 is not set
475# CONFIG_MTD_RAM is not set
476# CONFIG_MTD_ROM is not set
477# CONFIG_MTD_ABSENT is not set
478
479#
480# Mapping drivers for chip access
481#
482# CONFIG_MTD_COMPLEX_MAPPINGS is not set
483# CONFIG_MTD_PLATRAM is not set
484
485#
486# Self-contained MTD device drivers
487#
488# CONFIG_MTD_SLRAM is not set
489# CONFIG_MTD_PHRAM is not set
490# CONFIG_MTD_MTDRAM is not set
491# CONFIG_MTD_BLOCK2MTD is not set
492
493#
494# Disk-On-Chip Device Drivers
495#
496# CONFIG_MTD_DOC2000 is not set
497# CONFIG_MTD_DOC2001 is not set
498# CONFIG_MTD_DOC2001PLUS is not set
499CONFIG_MTD_NAND=y
500CONFIG_MTD_NAND_VERIFY_WRITE=y
501# CONFIG_MTD_NAND_ECC_SMC is not set
502# CONFIG_MTD_NAND_MUSEUM_IDS is not set
503# CONFIG_MTD_NAND_GPIO is not set
504CONFIG_MTD_NAND_IDS=y
505# CONFIG_MTD_NAND_DISKONCHIP is not set
506# CONFIG_MTD_NAND_NANDSIM is not set
507# CONFIG_MTD_NAND_PLATFORM is not set
508CONFIG_MTD_NAND_NOMADIK=y
509CONFIG_MTD_ONENAND=y
510CONFIG_MTD_ONENAND_VERIFY_WRITE=y
511CONFIG_MTD_ONENAND_GENERIC=y
512# CONFIG_MTD_ONENAND_OTP is not set
513# CONFIG_MTD_ONENAND_2X_PROGRAM is not set
514# CONFIG_MTD_ONENAND_SIM is not set
515
516#
517# LPDDR flash memory drivers
518#
519# CONFIG_MTD_LPDDR is not set
520
521#
522# UBI - Unsorted block images
523#
524# CONFIG_MTD_UBI is not set
525# CONFIG_PARPORT is not set
526CONFIG_BLK_DEV=y
527# CONFIG_BLK_DEV_COW_COMMON is not set
528CONFIG_BLK_DEV_LOOP=y
529CONFIG_BLK_DEV_CRYPTOLOOP=y
530# CONFIG_BLK_DEV_NBD is not set
531CONFIG_BLK_DEV_RAM=y
532CONFIG_BLK_DEV_RAM_COUNT=16
533CONFIG_BLK_DEV_RAM_SIZE=4096
534# CONFIG_BLK_DEV_XIP is not set
535# CONFIG_CDROM_PKTCDVD is not set
536# CONFIG_ATA_OVER_ETH is not set
537# CONFIG_MG_DISK is not set
538CONFIG_MISC_DEVICES=y
539# CONFIG_ICS932S401 is not set
540# CONFIG_ENCLOSURE_SERVICES is not set
541# CONFIG_ISL29003 is not set
542# CONFIG_C2PORT is not set
543
544#
545# EEPROM support
546#
547# CONFIG_EEPROM_AT24 is not set
548# CONFIG_EEPROM_LEGACY is not set
549# CONFIG_EEPROM_MAX6875 is not set
550# CONFIG_EEPROM_93CX6 is not set
551CONFIG_HAVE_IDE=y
552# CONFIG_IDE is not set
553
554#
555# SCSI device support
556#
557# CONFIG_RAID_ATTRS is not set
558CONFIG_SCSI=y
559CONFIG_SCSI_DMA=y
560# CONFIG_SCSI_TGT is not set
561# CONFIG_SCSI_NETLINK is not set
562CONFIG_SCSI_PROC_FS=y
563
564#
565# SCSI support type (disk, tape, CD-ROM)
566#
567CONFIG_BLK_DEV_SD=y
568# CONFIG_CHR_DEV_ST is not set
569# CONFIG_CHR_DEV_OSST is not set
570# CONFIG_BLK_DEV_SR is not set
571CONFIG_CHR_DEV_SG=y
572# CONFIG_CHR_DEV_SCH is not set
573CONFIG_SCSI_MULTI_LUN=y
574CONFIG_SCSI_CONSTANTS=y
575CONFIG_SCSI_LOGGING=y
576CONFIG_SCSI_SCAN_ASYNC=y
577CONFIG_SCSI_WAIT_SCAN=m
578
579#
580# SCSI Transports
581#
582# CONFIG_SCSI_SPI_ATTRS is not set
583# CONFIG_SCSI_FC_ATTRS is not set
584# CONFIG_SCSI_ISCSI_ATTRS is not set
585# CONFIG_SCSI_SAS_LIBSAS is not set
586# CONFIG_SCSI_SRP_ATTRS is not set
587CONFIG_SCSI_LOWLEVEL=y
588# CONFIG_ISCSI_TCP is not set
589# CONFIG_LIBFC is not set
590# CONFIG_LIBFCOE is not set
591# CONFIG_SCSI_DEBUG is not set
592# CONFIG_SCSI_DH is not set
593# CONFIG_SCSI_OSD_INITIATOR is not set
594# CONFIG_ATA is not set
595# CONFIG_MD is not set
596CONFIG_NETDEVICES=y
597# CONFIG_DUMMY is not set
598# CONFIG_BONDING is not set
599# CONFIG_MACVLAN is not set
600# CONFIG_EQUALIZER is not set
601CONFIG_TUN=y
602# CONFIG_VETH is not set
603# CONFIG_PHYLIB is not set
604CONFIG_NET_ETHERNET=y
605CONFIG_MII=y
606# CONFIG_AX88796 is not set
607CONFIG_SMC91X=y
608# CONFIG_DM9000 is not set
609# CONFIG_ETHOC is not set
610# CONFIG_SMC911X is not set
611# CONFIG_SMSC911X is not set
612# CONFIG_DNET is not set
613# CONFIG_IBM_NEW_EMAC_ZMII is not set
614# CONFIG_IBM_NEW_EMAC_RGMII is not set
615# CONFIG_IBM_NEW_EMAC_TAH is not set
616# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
617# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
618# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
619# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
620# CONFIG_B44 is not set
621# CONFIG_KS8842 is not set
622CONFIG_NETDEV_1000=y
623CONFIG_NETDEV_10000=y
624
625#
626# Wireless LAN
627#
628# CONFIG_WLAN_PRE80211 is not set
629# CONFIG_WLAN_80211 is not set
630
631#
632# Enable WiMAX (Networking options) to see the WiMAX drivers
633#
634# CONFIG_WAN is not set
635CONFIG_PPP=m
636# CONFIG_PPP_MULTILINK is not set
637# CONFIG_PPP_FILTER is not set
638CONFIG_PPP_ASYNC=m
639CONFIG_PPP_SYNC_TTY=m
640CONFIG_PPP_DEFLATE=m
641CONFIG_PPP_BSDCOMP=m
642CONFIG_PPP_MPPE=m
643CONFIG_PPPOE=m
644# CONFIG_PPPOL2TP is not set
645# CONFIG_SLIP is not set
646CONFIG_SLHC=m
647CONFIG_NETCONSOLE=m
648# CONFIG_NETCONSOLE_DYNAMIC is not set
649CONFIG_NETPOLL=y
650# CONFIG_NETPOLL_TRAP is not set
651CONFIG_NET_POLL_CONTROLLER=y
652# CONFIG_ISDN is not set
653
654#
655# Input device support
656#
657CONFIG_INPUT=y
658# CONFIG_INPUT_FF_MEMLESS is not set
659# CONFIG_INPUT_POLLDEV is not set
660
661#
662# Userland interfaces
663#
664# CONFIG_INPUT_MOUSEDEV is not set
665# CONFIG_INPUT_JOYDEV is not set
666CONFIG_INPUT_EVDEV=y
667# CONFIG_INPUT_EVBUG is not set
668
669#
670# Input Device Drivers
671#
672CONFIG_INPUT_KEYBOARD=y
673# CONFIG_KEYBOARD_ATKBD is not set
674# CONFIG_KEYBOARD_SUNKBD is not set
675# CONFIG_KEYBOARD_LKKBD is not set
676# CONFIG_KEYBOARD_XTKBD is not set
677# CONFIG_KEYBOARD_NEWTON is not set
678# CONFIG_KEYBOARD_STOWAWAY is not set
679# CONFIG_KEYBOARD_GPIO is not set
680CONFIG_INPUT_MOUSE=y
681# CONFIG_MOUSE_PS2 is not set
682# CONFIG_MOUSE_SERIAL is not set
683# CONFIG_MOUSE_APPLETOUCH is not set
684# CONFIG_MOUSE_BCM5974 is not set
685# CONFIG_MOUSE_VSXXXAA is not set
686# CONFIG_MOUSE_GPIO is not set
687# CONFIG_MOUSE_SYNAPTICS_I2C is not set
688# CONFIG_INPUT_JOYSTICK is not set
689# CONFIG_INPUT_TABLET is not set
690# CONFIG_INPUT_TOUCHSCREEN is not set
691# CONFIG_INPUT_MISC is not set
692
693#
694# Hardware I/O ports
695#
696# CONFIG_SERIO is not set
697# CONFIG_GAMEPORT is not set
698
699#
700# Character devices
701#
702CONFIG_VT=y
703CONFIG_CONSOLE_TRANSLATIONS=y
704CONFIG_VT_CONSOLE=y
705CONFIG_HW_CONSOLE=y
706# CONFIG_VT_HW_CONSOLE_BINDING is not set
707CONFIG_DEVKMEM=y
708# CONFIG_SERIAL_NONSTANDARD is not set
709
710#
711# Serial drivers
712#
713# CONFIG_SERIAL_8250 is not set
714
715#
716# Non-8250 serial port support
717#
718# CONFIG_SERIAL_AMBA_PL010 is not set
719CONFIG_SERIAL_AMBA_PL011=y
720CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
721CONFIG_SERIAL_CORE=y
722CONFIG_SERIAL_CORE_CONSOLE=y
723CONFIG_UNIX98_PTYS=y
724# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
725# CONFIG_LEGACY_PTYS is not set
726# CONFIG_IPMI_HANDLER is not set
727# CONFIG_HW_RANDOM is not set
728# CONFIG_R3964 is not set
729# CONFIG_RAW_DRIVER is not set
730# CONFIG_TCG_TPM is not set
731CONFIG_I2C=y
732CONFIG_I2C_BOARDINFO=y
733CONFIG_I2C_CHARDEV=y
734CONFIG_I2C_HELPER_AUTO=y
735CONFIG_I2C_ALGOBIT=y
736
737#
738# I2C Hardware Bus support
739#
740
741#
742# I2C system bus drivers (mostly embedded / system-on-chip)
743#
744CONFIG_I2C_GPIO=y
745# CONFIG_I2C_OCORES is not set
746# CONFIG_I2C_SIMTEC is not set
747
748#
749# External I2C/SMBus adapter drivers
750#
751# CONFIG_I2C_PARPORT_LIGHT is not set
752# CONFIG_I2C_TAOS_EVM is not set
753
754#
755# Other I2C/SMBus bus drivers
756#
757# CONFIG_I2C_PCA_PLATFORM is not set
758# CONFIG_I2C_STUB is not set
759
760#
761# Miscellaneous I2C Chip support
762#
763# CONFIG_DS1682 is not set
764# CONFIG_SENSORS_PCF8574 is not set
765# CONFIG_PCF8575 is not set
766# CONFIG_SENSORS_PCA9539 is not set
767# CONFIG_SENSORS_TSL2550 is not set
768# CONFIG_I2C_DEBUG_CORE is not set
769# CONFIG_I2C_DEBUG_ALGO is not set
770# CONFIG_I2C_DEBUG_BUS is not set
771# CONFIG_I2C_DEBUG_CHIP is not set
772# CONFIG_SPI is not set
773CONFIG_ARCH_REQUIRE_GPIOLIB=y
774CONFIG_GPIOLIB=y
775CONFIG_DEBUG_GPIO=y
776# CONFIG_GPIO_SYSFS is not set
777
778#
779# Memory mapped GPIO expanders:
780#
781# CONFIG_GPIO_PL061 is not set
782
783#
784# I2C GPIO expanders:
785#
786# CONFIG_GPIO_MAX732X is not set
787# CONFIG_GPIO_PCA953X is not set
788# CONFIG_GPIO_PCF857X is not set
789
790#
791# PCI GPIO expanders:
792#
793
794#
795# SPI GPIO expanders:
796#
797# CONFIG_W1 is not set
798# CONFIG_POWER_SUPPLY is not set
799# CONFIG_HWMON is not set
800# CONFIG_THERMAL is not set
801# CONFIG_THERMAL_HWMON is not set
802# CONFIG_WATCHDOG is not set
803CONFIG_SSB_POSSIBLE=y
804
805#
806# Sonics Silicon Backplane
807#
808# CONFIG_SSB is not set
809
810#
811# Multifunction device drivers
812#
813# CONFIG_MFD_CORE is not set
814# CONFIG_MFD_SM501 is not set
815# CONFIG_MFD_ASIC3 is not set
816# CONFIG_HTC_EGPIO is not set
817# CONFIG_HTC_PASIC3 is not set
818# CONFIG_TPS65010 is not set
819# CONFIG_TWL4030_CORE is not set
820# CONFIG_MFD_TMIO is not set
821# CONFIG_MFD_T7L66XB is not set
822# CONFIG_MFD_TC6387XB is not set
823# CONFIG_MFD_TC6393XB is not set
824# CONFIG_PMIC_DA903X is not set
825# CONFIG_MFD_WM8400 is not set
826# CONFIG_MFD_WM8350_I2C is not set
827# CONFIG_MFD_PCF50633 is not set
828# CONFIG_AB3100_CORE is not set
829# CONFIG_MEDIA_SUPPORT is not set
830
831#
832# Graphics support
833#
834# CONFIG_VGASTATE is not set
835# CONFIG_VIDEO_OUTPUT_CONTROL is not set
836# CONFIG_FB is not set
837# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
838
839#
840# Display device support
841#
842# CONFIG_DISPLAY_SUPPORT is not set
843
844#
845# Console display driver support
846#
847# CONFIG_VGA_CONSOLE is not set
848CONFIG_DUMMY_CONSOLE=y
849# CONFIG_SOUND is not set
850CONFIG_HID_SUPPORT=y
851CONFIG_HID=y
852# CONFIG_HID_DEBUG is not set
853# CONFIG_HIDRAW is not set
854# CONFIG_HID_PID is not set
855
856#
857# Special HID drivers
858#
859# CONFIG_HID_APPLE is not set
860# CONFIG_HID_WACOM is not set
861CONFIG_USB_SUPPORT=y
862CONFIG_USB_ARCH_HAS_HCD=y
863# CONFIG_USB_ARCH_HAS_OHCI is not set
864# CONFIG_USB_ARCH_HAS_EHCI is not set
865# CONFIG_USB is not set
866# CONFIG_USB_OTG_WHITELIST is not set
867# CONFIG_USB_OTG_BLACKLIST_HUB is not set
868
869#
870# Enable Host or Gadget support to see Inventra options
871#
872
873#
874# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
875#
876# CONFIG_USB_GADGET is not set
877
878#
879# OTG and related infrastructure
880#
881# CONFIG_MMC is not set
882# CONFIG_MEMSTICK is not set
883# CONFIG_ACCESSIBILITY is not set
884# CONFIG_NEW_LEDS is not set
885CONFIG_RTC_LIB=y
886CONFIG_RTC_CLASS=y
887CONFIG_RTC_HCTOSYS=y
888CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
889# CONFIG_RTC_DEBUG is not set
890
891#
892# RTC interfaces
893#
894CONFIG_RTC_INTF_SYSFS=y
895CONFIG_RTC_INTF_PROC=y
896CONFIG_RTC_INTF_DEV=y
897# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
898# CONFIG_RTC_DRV_TEST is not set
899
900#
901# I2C RTC drivers
902#
903# CONFIG_RTC_DRV_DS1307 is not set
904# CONFIG_RTC_DRV_DS1374 is not set
905# CONFIG_RTC_DRV_DS1672 is not set
906# CONFIG_RTC_DRV_MAX6900 is not set
907# CONFIG_RTC_DRV_RS5C372 is not set
908# CONFIG_RTC_DRV_ISL1208 is not set
909# CONFIG_RTC_DRV_X1205 is not set
910# CONFIG_RTC_DRV_PCF8563 is not set
911# CONFIG_RTC_DRV_PCF8583 is not set
912# CONFIG_RTC_DRV_M41T80 is not set
913# CONFIG_RTC_DRV_S35390A is not set
914# CONFIG_RTC_DRV_FM3130 is not set
915# CONFIG_RTC_DRV_RX8581 is not set
916# CONFIG_RTC_DRV_RX8025 is not set
917
918#
919# SPI RTC drivers
920#
921
922#
923# Platform RTC drivers
924#
925# CONFIG_RTC_DRV_CMOS is not set
926# CONFIG_RTC_DRV_DS1286 is not set
927# CONFIG_RTC_DRV_DS1511 is not set
928# CONFIG_RTC_DRV_DS1553 is not set
929# CONFIG_RTC_DRV_DS1742 is not set
930# CONFIG_RTC_DRV_STK17TA8 is not set
931# CONFIG_RTC_DRV_M48T86 is not set
932# CONFIG_RTC_DRV_M48T35 is not set
933# CONFIG_RTC_DRV_M48T59 is not set
934# CONFIG_RTC_DRV_BQ4802 is not set
935# CONFIG_RTC_DRV_V3020 is not set
936
937#
938# on-CPU RTC drivers
939#
940# CONFIG_RTC_DRV_PL030 is not set
941# CONFIG_RTC_DRV_PL031 is not set
942# CONFIG_DMADEVICES is not set
943# CONFIG_AUXDISPLAY is not set
944# CONFIG_REGULATOR is not set
945# CONFIG_UIO is not set
946# CONFIG_STAGING is not set
947
948#
949# File systems
950#
951CONFIG_EXT2_FS=y
952# CONFIG_EXT2_FS_XATTR is not set
953# CONFIG_EXT2_FS_XIP is not set
954CONFIG_EXT3_FS=y
955# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
956CONFIG_EXT3_FS_XATTR=y
957# CONFIG_EXT3_FS_POSIX_ACL is not set
958# CONFIG_EXT3_FS_SECURITY is not set
959# CONFIG_EXT4_FS is not set
960CONFIG_JBD=y
961CONFIG_FS_MBCACHE=y
962# CONFIG_REISERFS_FS is not set
963# CONFIG_JFS_FS is not set
964CONFIG_FS_POSIX_ACL=y
965# CONFIG_XFS_FS is not set
966# CONFIG_GFS2_FS is not set
967# CONFIG_OCFS2_FS is not set
968# CONFIG_BTRFS_FS is not set
969CONFIG_FILE_LOCKING=y
970CONFIG_FSNOTIFY=y
971CONFIG_DNOTIFY=y
972CONFIG_INOTIFY=y
973CONFIG_INOTIFY_USER=y
974# CONFIG_QUOTA is not set
975# CONFIG_AUTOFS_FS is not set
976# CONFIG_AUTOFS4_FS is not set
977CONFIG_FUSE_FS=y
978# CONFIG_CUSE is not set
979
980#
981# Caches
982#
983# CONFIG_FSCACHE is not set
984
985#
986# CD-ROM/DVD Filesystems
987#
988# CONFIG_ISO9660_FS is not set
989# CONFIG_UDF_FS is not set
990
991#
992# DOS/FAT/NT Filesystems
993#
994CONFIG_FAT_FS=y
995CONFIG_MSDOS_FS=y
996CONFIG_VFAT_FS=y
997CONFIG_FAT_DEFAULT_CODEPAGE=437
998CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
999# CONFIG_NTFS_FS is not set
1000
1001#
1002# Pseudo filesystems
1003#
1004CONFIG_PROC_FS=y
1005CONFIG_PROC_SYSCTL=y
1006CONFIG_PROC_PAGE_MONITOR=y
1007CONFIG_SYSFS=y
1008CONFIG_TMPFS=y
1009# CONFIG_TMPFS_POSIX_ACL is not set
1010# CONFIG_HUGETLB_PAGE is not set
1011# CONFIG_CONFIGFS_FS is not set
1012CONFIG_MISC_FILESYSTEMS=y
1013# CONFIG_ADFS_FS is not set
1014# CONFIG_AFFS_FS is not set
1015# CONFIG_HFS_FS is not set
1016# CONFIG_HFSPLUS_FS is not set
1017# CONFIG_BEFS_FS is not set
1018# CONFIG_BFS_FS is not set
1019# CONFIG_EFS_FS is not set
1020CONFIG_JFFS2_FS=y
1021CONFIG_JFFS2_FS_DEBUG=0
1022CONFIG_JFFS2_FS_WRITEBUFFER=y
1023# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1024# CONFIG_JFFS2_SUMMARY is not set
1025# CONFIG_JFFS2_FS_XATTR is not set
1026# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1027CONFIG_JFFS2_ZLIB=y
1028# CONFIG_JFFS2_LZO is not set
1029CONFIG_JFFS2_RTIME=y
1030# CONFIG_JFFS2_RUBIN is not set
1031# CONFIG_CRAMFS is not set
1032# CONFIG_SQUASHFS is not set
1033# CONFIG_VXFS_FS is not set
1034# CONFIG_MINIX_FS is not set
1035# CONFIG_OMFS_FS is not set
1036# CONFIG_HPFS_FS is not set
1037# CONFIG_QNX4FS_FS is not set
1038# CONFIG_ROMFS_FS is not set
1039# CONFIG_SYSV_FS is not set
1040# CONFIG_UFS_FS is not set
1041# CONFIG_NILFS2_FS is not set
1042CONFIG_NETWORK_FILESYSTEMS=y
1043CONFIG_NFS_FS=y
1044CONFIG_NFS_V3=y
1045CONFIG_NFS_V3_ACL=y
1046# CONFIG_NFS_V4 is not set
1047CONFIG_ROOT_NFS=y
1048# CONFIG_NFSD is not set
1049CONFIG_LOCKD=y
1050CONFIG_LOCKD_V4=y
1051CONFIG_NFS_ACL_SUPPORT=y
1052CONFIG_NFS_COMMON=y
1053CONFIG_SUNRPC=y
1054# CONFIG_RPCSEC_GSS_KRB5 is not set
1055# CONFIG_RPCSEC_GSS_SPKM3 is not set
1056CONFIG_SMB_FS=m
1057# CONFIG_SMB_NLS_DEFAULT is not set
1058CONFIG_CIFS=m
1059# CONFIG_CIFS_STATS is not set
1060CONFIG_CIFS_WEAK_PW_HASH=y
1061# CONFIG_CIFS_XATTR is not set
1062# CONFIG_CIFS_DEBUG2 is not set
1063# CONFIG_CIFS_EXPERIMENTAL is not set
1064# CONFIG_NCP_FS is not set
1065# CONFIG_CODA_FS is not set
1066# CONFIG_AFS_FS is not set
1067
1068#
1069# Partition Types
1070#
1071# CONFIG_PARTITION_ADVANCED is not set
1072CONFIG_MSDOS_PARTITION=y
1073CONFIG_NLS=y
1074CONFIG_NLS_DEFAULT="iso8859-1"
1075CONFIG_NLS_CODEPAGE_437=y
1076# CONFIG_NLS_CODEPAGE_737 is not set
1077# CONFIG_NLS_CODEPAGE_775 is not set
1078# CONFIG_NLS_CODEPAGE_850 is not set
1079# CONFIG_NLS_CODEPAGE_852 is not set
1080# CONFIG_NLS_CODEPAGE_855 is not set
1081# CONFIG_NLS_CODEPAGE_857 is not set
1082# CONFIG_NLS_CODEPAGE_860 is not set
1083# CONFIG_NLS_CODEPAGE_861 is not set
1084# CONFIG_NLS_CODEPAGE_862 is not set
1085# CONFIG_NLS_CODEPAGE_863 is not set
1086# CONFIG_NLS_CODEPAGE_864 is not set
1087# CONFIG_NLS_CODEPAGE_865 is not set
1088# CONFIG_NLS_CODEPAGE_866 is not set
1089# CONFIG_NLS_CODEPAGE_869 is not set
1090# CONFIG_NLS_CODEPAGE_936 is not set
1091# CONFIG_NLS_CODEPAGE_950 is not set
1092# CONFIG_NLS_CODEPAGE_932 is not set
1093# CONFIG_NLS_CODEPAGE_949 is not set
1094# CONFIG_NLS_CODEPAGE_874 is not set
1095# CONFIG_NLS_ISO8859_8 is not set
1096# CONFIG_NLS_CODEPAGE_1250 is not set
1097# CONFIG_NLS_CODEPAGE_1251 is not set
1098CONFIG_NLS_ASCII=y
1099CONFIG_NLS_ISO8859_1=y
1100# CONFIG_NLS_ISO8859_2 is not set
1101# CONFIG_NLS_ISO8859_3 is not set
1102# CONFIG_NLS_ISO8859_4 is not set
1103# CONFIG_NLS_ISO8859_5 is not set
1104# CONFIG_NLS_ISO8859_6 is not set
1105# CONFIG_NLS_ISO8859_7 is not set
1106# CONFIG_NLS_ISO8859_9 is not set
1107# CONFIG_NLS_ISO8859_13 is not set
1108# CONFIG_NLS_ISO8859_14 is not set
1109CONFIG_NLS_ISO8859_15=y
1110# CONFIG_NLS_KOI8_R is not set
1111# CONFIG_NLS_KOI8_U is not set
1112# CONFIG_NLS_UTF8 is not set
1113# CONFIG_DLM is not set
1114
1115#
1116# Kernel hacking
1117#
1118# CONFIG_PRINTK_TIME is not set
1119CONFIG_ENABLE_WARN_DEPRECATED=y
1120# CONFIG_ENABLE_MUST_CHECK is not set
1121CONFIG_FRAME_WARN=1024
1122# CONFIG_MAGIC_SYSRQ is not set
1123# CONFIG_UNUSED_SYMBOLS is not set
1124# CONFIG_DEBUG_FS is not set
1125# CONFIG_HEADERS_CHECK is not set
1126CONFIG_DEBUG_KERNEL=y
1127# CONFIG_DEBUG_SHIRQ is not set
1128CONFIG_DETECT_SOFTLOCKUP=y
1129# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1130CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1131CONFIG_DETECT_HUNG_TASK=y
1132# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
1133CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
1134# CONFIG_SCHED_DEBUG is not set
1135# CONFIG_SCHEDSTATS is not set
1136# CONFIG_TIMER_STATS is not set
1137# CONFIG_DEBUG_OBJECTS is not set
1138# CONFIG_DEBUG_SLAB is not set
1139# CONFIG_DEBUG_KMEMLEAK is not set
1140# CONFIG_DEBUG_PREEMPT is not set
1141# CONFIG_DEBUG_RT_MUTEXES is not set
1142# CONFIG_RT_MUTEX_TESTER is not set
1143# CONFIG_DEBUG_SPINLOCK is not set
1144# CONFIG_DEBUG_MUTEXES is not set
1145# CONFIG_DEBUG_LOCK_ALLOC is not set
1146# CONFIG_PROVE_LOCKING is not set
1147# CONFIG_LOCK_STAT is not set
1148# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1149# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1150# CONFIG_DEBUG_KOBJECT is not set
1151# CONFIG_DEBUG_BUGVERBOSE is not set
1152CONFIG_DEBUG_INFO=y
1153# CONFIG_DEBUG_VM is not set
1154# CONFIG_DEBUG_WRITECOUNT is not set
1155# CONFIG_DEBUG_MEMORY_INIT is not set
1156# CONFIG_DEBUG_LIST is not set
1157# CONFIG_DEBUG_SG is not set
1158# CONFIG_DEBUG_NOTIFIERS is not set
1159# CONFIG_BOOT_PRINTK_DELAY is not set
1160# CONFIG_RCU_TORTURE_TEST is not set
1161# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1162# CONFIG_BACKTRACE_SELF_TEST is not set
1163# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1164# CONFIG_FAULT_INJECTION is not set
1165# CONFIG_LATENCYTOP is not set
1166# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1167# CONFIG_PAGE_POISONING is not set
1168CONFIG_HAVE_FUNCTION_TRACER=y
1169CONFIG_TRACING_SUPPORT=y
1170CONFIG_FTRACE=y
1171# CONFIG_FUNCTION_TRACER is not set
1172# CONFIG_IRQSOFF_TRACER is not set
1173# CONFIG_PREEMPT_TRACER is not set
1174# CONFIG_SCHED_TRACER is not set
1175# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1176# CONFIG_BOOT_TRACER is not set
1177CONFIG_BRANCH_PROFILE_NONE=y
1178# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1179# CONFIG_PROFILE_ALL_BRANCHES is not set
1180# CONFIG_STACK_TRACER is not set
1181# CONFIG_KMEMTRACE is not set
1182# CONFIG_WORKQUEUE_TRACER is not set
1183# CONFIG_BLK_DEV_IO_TRACE is not set
1184# CONFIG_SAMPLES is not set
1185CONFIG_HAVE_ARCH_KGDB=y
1186# CONFIG_KGDB is not set
1187CONFIG_ARM_UNWIND=y
1188# CONFIG_DEBUG_USER is not set
1189# CONFIG_DEBUG_ERRORS is not set
1190# CONFIG_DEBUG_STACK_USAGE is not set
1191# CONFIG_DEBUG_LL is not set
1192
1193#
1194# Security options
1195#
1196# CONFIG_KEYS is not set
1197# CONFIG_SECURITY is not set
1198# CONFIG_SECURITYFS is not set
1199# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1200CONFIG_CRYPTO=y
1201
1202#
1203# Crypto core or helper
1204#
1205# CONFIG_CRYPTO_FIPS is not set
1206CONFIG_CRYPTO_ALGAPI=y
1207CONFIG_CRYPTO_ALGAPI2=y
1208CONFIG_CRYPTO_AEAD2=y
1209CONFIG_CRYPTO_BLKCIPHER=y
1210CONFIG_CRYPTO_BLKCIPHER2=y
1211CONFIG_CRYPTO_HASH=y
1212CONFIG_CRYPTO_HASH2=y
1213CONFIG_CRYPTO_RNG2=y
1214CONFIG_CRYPTO_PCOMP=y
1215CONFIG_CRYPTO_MANAGER=y
1216CONFIG_CRYPTO_MANAGER2=y
1217# CONFIG_CRYPTO_GF128MUL is not set
1218# CONFIG_CRYPTO_NULL is not set
1219CONFIG_CRYPTO_WORKQUEUE=y
1220# CONFIG_CRYPTO_CRYPTD is not set
1221# CONFIG_CRYPTO_AUTHENC is not set
1222# CONFIG_CRYPTO_TEST is not set
1223
1224#
1225# Authenticated Encryption with Associated Data
1226#
1227# CONFIG_CRYPTO_CCM is not set
1228# CONFIG_CRYPTO_GCM is not set
1229# CONFIG_CRYPTO_SEQIV is not set
1230
1231#
1232# Block modes
1233#
1234CONFIG_CRYPTO_CBC=y
1235# CONFIG_CRYPTO_CTR is not set
1236# CONFIG_CRYPTO_CTS is not set
1237CONFIG_CRYPTO_ECB=m
1238# CONFIG_CRYPTO_LRW is not set
1239# CONFIG_CRYPTO_PCBC is not set
1240# CONFIG_CRYPTO_XTS is not set
1241
1242#
1243# Hash modes
1244#
1245# CONFIG_CRYPTO_HMAC is not set
1246# CONFIG_CRYPTO_XCBC is not set
1247
1248#
1249# Digest
1250#
1251# CONFIG_CRYPTO_CRC32C is not set
1252# CONFIG_CRYPTO_MD4 is not set
1253CONFIG_CRYPTO_MD5=y
1254# CONFIG_CRYPTO_MICHAEL_MIC is not set
1255# CONFIG_CRYPTO_RMD128 is not set
1256# CONFIG_CRYPTO_RMD160 is not set
1257# CONFIG_CRYPTO_RMD256 is not set
1258# CONFIG_CRYPTO_RMD320 is not set
1259CONFIG_CRYPTO_SHA1=y
1260# CONFIG_CRYPTO_SHA256 is not set
1261# CONFIG_CRYPTO_SHA512 is not set
1262# CONFIG_CRYPTO_TGR192 is not set
1263# CONFIG_CRYPTO_WP512 is not set
1264
1265#
1266# Ciphers
1267#
1268# CONFIG_CRYPTO_AES is not set
1269# CONFIG_CRYPTO_ANUBIS is not set
1270CONFIG_CRYPTO_ARC4=m
1271# CONFIG_CRYPTO_BLOWFISH is not set
1272# CONFIG_CRYPTO_CAMELLIA is not set
1273# CONFIG_CRYPTO_CAST5 is not set
1274# CONFIG_CRYPTO_CAST6 is not set
1275CONFIG_CRYPTO_DES=y
1276# CONFIG_CRYPTO_FCRYPT is not set
1277# CONFIG_CRYPTO_KHAZAD is not set
1278# CONFIG_CRYPTO_SALSA20 is not set
1279# CONFIG_CRYPTO_SEED is not set
1280# CONFIG_CRYPTO_SERPENT is not set
1281# CONFIG_CRYPTO_TEA is not set
1282# CONFIG_CRYPTO_TWOFISH is not set
1283
1284#
1285# Compression
1286#
1287# CONFIG_CRYPTO_DEFLATE is not set
1288# CONFIG_CRYPTO_ZLIB is not set
1289# CONFIG_CRYPTO_LZO is not set
1290
1291#
1292# Random Number Generation
1293#
1294# CONFIG_CRYPTO_ANSI_CPRNG is not set
1295CONFIG_CRYPTO_HW=y
1296# CONFIG_BINARY_PRINTF is not set
1297
1298#
1299# Library routines
1300#
1301CONFIG_BITREVERSE=y
1302CONFIG_GENERIC_FIND_LAST_BIT=y
1303CONFIG_CRC_CCITT=m
1304# CONFIG_CRC16 is not set
1305# CONFIG_CRC_T10DIF is not set
1306# CONFIG_CRC_ITU_T is not set
1307CONFIG_CRC32=y
1308# CONFIG_CRC7 is not set
1309# CONFIG_LIBCRC32C is not set
1310CONFIG_ZLIB_INFLATE=y
1311CONFIG_ZLIB_DEFLATE=y
1312CONFIG_DECOMPRESS_GZIP=y
1313CONFIG_HAS_IOMEM=y
1314CONFIG_HAS_IOPORT=y
1315CONFIG_HAS_DMA=y
1316CONFIG_NLATTR=y
diff --git a/arch/arm/configs/s5pc100_defconfig b/arch/arm/configs/s5pc100_defconfig
new file mode 100644
index 000000000000..b0d7d3d3a5e3
--- /dev/null
+++ b/arch/arm/configs/s5pc100_defconfig
@@ -0,0 +1,892 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30
4# Wed Jul 1 15:53:07 2009
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_MMU=y
10CONFIG_NO_IOPORT=y
11CONFIG_GENERIC_HARDIRQS=y
12CONFIG_STACKTRACE_SUPPORT=y
13CONFIG_HAVE_LATENCYTOP_SUPPORT=y
14CONFIG_LOCKDEP_SUPPORT=y
15CONFIG_TRACE_IRQFLAGS_SUPPORT=y
16CONFIG_HARDIRQS_SW_RESEND=y
17CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_RWSEM_GENERIC_SPINLOCK=y
19CONFIG_GENERIC_HWEIGHT=y
20CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
22CONFIG_VECTORS_BASE=0xffff0000
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24CONFIG_CONSTRUCTORS=y
25
26#
27# General setup
28#
29CONFIG_EXPERIMENTAL=y
30CONFIG_BROKEN_ON_SMP=y
31CONFIG_INIT_ENV_ARG_LIMIT=32
32CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SWAP=y
35# CONFIG_SYSVIPC is not set
36# CONFIG_BSD_PROCESS_ACCT is not set
37
38#
39# RCU Subsystem
40#
41CONFIG_CLASSIC_RCU=y
42# CONFIG_TREE_RCU is not set
43# CONFIG_PREEMPT_RCU is not set
44# CONFIG_TREE_RCU_TRACE is not set
45# CONFIG_PREEMPT_RCU_TRACE is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=17
48# CONFIG_GROUP_SCHED is not set
49# CONFIG_CGROUPS is not set
50CONFIG_SYSFS_DEPRECATED=y
51CONFIG_SYSFS_DEPRECATED_V2=y
52# CONFIG_RELAY is not set
53CONFIG_NAMESPACES=y
54# CONFIG_UTS_NS is not set
55# CONFIG_USER_NS is not set
56# CONFIG_PID_NS is not set
57CONFIG_BLK_DEV_INITRD=y
58CONFIG_INITRAMFS_SOURCE=""
59CONFIG_RD_GZIP=y
60CONFIG_RD_BZIP2=y
61CONFIG_RD_LZMA=y
62CONFIG_CC_OPTIMIZE_FOR_SIZE=y
63CONFIG_SYSCTL=y
64CONFIG_ANON_INODES=y
65# CONFIG_EMBEDDED is not set
66CONFIG_UID16=y
67CONFIG_SYSCTL_SYSCALL=y
68CONFIG_KALLSYMS=y
69CONFIG_KALLSYMS_ALL=y
70# CONFIG_KALLSYMS_EXTRA_PASS is not set
71CONFIG_HOTPLUG=y
72CONFIG_PRINTK=y
73CONFIG_BUG=y
74CONFIG_ELF_CORE=y
75CONFIG_BASE_FULL=y
76CONFIG_FUTEX=y
77CONFIG_EPOLL=y
78CONFIG_SIGNALFD=y
79CONFIG_TIMERFD=y
80CONFIG_EVENTFD=y
81CONFIG_SHMEM=y
82CONFIG_AIO=y
83
84#
85# Performance Counters
86#
87CONFIG_VM_EVENT_COUNTERS=y
88CONFIG_SLUB_DEBUG=y
89# CONFIG_STRIP_ASM_SYMS is not set
90CONFIG_COMPAT_BRK=y
91# CONFIG_SLAB is not set
92CONFIG_SLUB=y
93# CONFIG_SLOB is not set
94# CONFIG_PROFILING is not set
95# CONFIG_MARKERS is not set
96CONFIG_HAVE_OPROFILE=y
97# CONFIG_KPROBES is not set
98CONFIG_HAVE_KPROBES=y
99CONFIG_HAVE_KRETPROBES=y
100CONFIG_HAVE_CLK=y
101
102#
103# GCOV-based kernel profiling
104#
105# CONFIG_SLOW_WORK is not set
106CONFIG_HAVE_GENERIC_DMA_COHERENT=y
107CONFIG_SLABINFO=y
108CONFIG_RT_MUTEXES=y
109CONFIG_BASE_SMALL=0
110CONFIG_MODULES=y
111# CONFIG_MODULE_FORCE_LOAD is not set
112CONFIG_MODULE_UNLOAD=y
113# CONFIG_MODULE_FORCE_UNLOAD is not set
114# CONFIG_MODVERSIONS is not set
115# CONFIG_MODULE_SRCVERSION_ALL is not set
116CONFIG_BLOCK=y
117CONFIG_LBDAF=y
118# CONFIG_BLK_DEV_BSG is not set
119# CONFIG_BLK_DEV_INTEGRITY is not set
120
121#
122# IO Schedulers
123#
124CONFIG_IOSCHED_NOOP=y
125CONFIG_IOSCHED_AS=y
126CONFIG_IOSCHED_DEADLINE=y
127CONFIG_IOSCHED_CFQ=y
128# CONFIG_DEFAULT_AS is not set
129# CONFIG_DEFAULT_DEADLINE is not set
130CONFIG_DEFAULT_CFQ=y
131# CONFIG_DEFAULT_NOOP is not set
132CONFIG_DEFAULT_IOSCHED="cfq"
133# CONFIG_FREEZER is not set
134
135#
136# System Type
137#
138# CONFIG_ARCH_AAEC2000 is not set
139# CONFIG_ARCH_INTEGRATOR is not set
140# CONFIG_ARCH_REALVIEW is not set
141# CONFIG_ARCH_VERSATILE is not set
142# CONFIG_ARCH_AT91 is not set
143# CONFIG_ARCH_CLPS711X is not set
144# CONFIG_ARCH_GEMINI is not set
145# CONFIG_ARCH_EBSA110 is not set
146# CONFIG_ARCH_EP93XX is not set
147# CONFIG_ARCH_FOOTBRIDGE is not set
148# CONFIG_ARCH_MXC is not set
149# CONFIG_ARCH_STMP3XXX is not set
150# CONFIG_ARCH_NETX is not set
151# CONFIG_ARCH_H720X is not set
152# CONFIG_ARCH_IOP13XX is not set
153# CONFIG_ARCH_IOP32X is not set
154# CONFIG_ARCH_IOP33X is not set
155# CONFIG_ARCH_IXP23XX is not set
156# CONFIG_ARCH_IXP2000 is not set
157# CONFIG_ARCH_IXP4XX is not set
158# CONFIG_ARCH_L7200 is not set
159# CONFIG_ARCH_KIRKWOOD is not set
160# CONFIG_ARCH_LOKI is not set
161# CONFIG_ARCH_MV78XX0 is not set
162# CONFIG_ARCH_ORION5X is not set
163# CONFIG_ARCH_MMP is not set
164# CONFIG_ARCH_KS8695 is not set
165# CONFIG_ARCH_NS9XXX is not set
166# CONFIG_ARCH_W90X900 is not set
167# CONFIG_ARCH_PNX4008 is not set
168# CONFIG_ARCH_PXA is not set
169# CONFIG_ARCH_MSM is not set
170# CONFIG_ARCH_RPC is not set
171# CONFIG_ARCH_SA1100 is not set
172# CONFIG_ARCH_S3C2410 is not set
173# CONFIG_ARCH_S3C64XX is not set
174CONFIG_ARCH_S5PC1XX=y
175# CONFIG_ARCH_SHARK is not set
176# CONFIG_ARCH_LH7A40X is not set
177# CONFIG_ARCH_U300 is not set
178# CONFIG_ARCH_DAVINCI is not set
179# CONFIG_ARCH_OMAP is not set
180CONFIG_PLAT_S3C=y
181
182#
183# Boot options
184#
185# CONFIG_S3C_BOOT_ERROR_RESET is not set
186CONFIG_S3C_BOOT_UART_FORCE_FIFO=y
187
188#
189# Power management
190#
191CONFIG_S3C_LOWLEVEL_UART_PORT=0
192CONFIG_S3C_GPIO_SPACE=0
193CONFIG_S3C_GPIO_TRACK=y
194CONFIG_S3C_GPIO_PULL_UPDOWN=y
195CONFIG_PLAT_S5PC1XX=y
196CONFIG_CPU_S5PC100_INIT=y
197CONFIG_CPU_S5PC100_CLOCK=y
198CONFIG_S5PC100_SETUP_I2C0=y
199CONFIG_CPU_S5PC100=y
200CONFIG_MACH_SMDKC100=y
201
202#
203# Processor Type
204#
205CONFIG_CPU_32=y
206CONFIG_CPU_32v6K=y
207CONFIG_CPU_V7=y
208CONFIG_CPU_32v7=y
209CONFIG_CPU_ABRT_EV7=y
210CONFIG_CPU_PABRT_IFAR=y
211CONFIG_CPU_CACHE_V7=y
212CONFIG_CPU_CACHE_VIPT=y
213CONFIG_CPU_COPY_V6=y
214CONFIG_CPU_TLB_V7=y
215CONFIG_CPU_HAS_ASID=y
216CONFIG_CPU_CP15=y
217CONFIG_CPU_CP15_MMU=y
218
219#
220# Processor Features
221#
222CONFIG_ARM_THUMB=y
223# CONFIG_ARM_THUMBEE is not set
224# CONFIG_CPU_ICACHE_DISABLE is not set
225# CONFIG_CPU_DCACHE_DISABLE is not set
226# CONFIG_CPU_BPREDICT_DISABLE is not set
227CONFIG_HAS_TLS_REG=y
228# CONFIG_ARM_ERRATA_430973 is not set
229# CONFIG_ARM_ERRATA_458693 is not set
230# CONFIG_ARM_ERRATA_460075 is not set
231CONFIG_ARM_VIC=y
232CONFIG_ARM_VIC_NR=2
233
234#
235# Bus support
236#
237# CONFIG_PCI_SYSCALL is not set
238# CONFIG_ARCH_SUPPORTS_MSI is not set
239# CONFIG_PCCARD is not set
240
241#
242# Kernel Features
243#
244CONFIG_VMSPLIT_3G=y
245# CONFIG_VMSPLIT_2G is not set
246# CONFIG_VMSPLIT_1G is not set
247CONFIG_PAGE_OFFSET=0xC0000000
248# CONFIG_PREEMPT is not set
249CONFIG_HZ=100
250CONFIG_AEABI=y
251CONFIG_OABI_COMPAT=y
252# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
253# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
254# CONFIG_HIGHMEM is not set
255CONFIG_SELECT_MEMORY_MODEL=y
256CONFIG_FLATMEM_MANUAL=y
257# CONFIG_DISCONTIGMEM_MANUAL is not set
258# CONFIG_SPARSEMEM_MANUAL is not set
259CONFIG_FLATMEM=y
260CONFIG_FLAT_NODE_MEM_MAP=y
261CONFIG_PAGEFLAGS_EXTENDED=y
262CONFIG_SPLIT_PTLOCK_CPUS=4
263# CONFIG_PHYS_ADDR_T_64BIT is not set
264CONFIG_ZONE_DMA_FLAG=0
265CONFIG_VIRT_TO_BUS=y
266CONFIG_HAVE_MLOCK=y
267CONFIG_HAVE_MLOCKED_PAGE_BIT=y
268CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
269CONFIG_ALIGNMENT_TRAP=y
270# CONFIG_UACCESS_WITH_MEMCPY is not set
271
272#
273# Boot options
274#
275CONFIG_ZBOOT_ROM_TEXT=0
276CONFIG_ZBOOT_ROM_BSS=0
277CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=cramfs init=/linuxrc console=ttySAC2,115200 mem=128M"
278# CONFIG_XIP_KERNEL is not set
279# CONFIG_KEXEC is not set
280
281#
282# CPU Power Management
283#
284# CONFIG_CPU_IDLE is not set
285
286#
287# Floating point emulation
288#
289
290#
291# At least one emulation must be selected
292#
293# CONFIG_FPE_NWFPE is not set
294# CONFIG_FPE_FASTFPE is not set
295# CONFIG_VFP is not set
296
297#
298# Userspace binary formats
299#
300CONFIG_BINFMT_ELF=y
301# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
302CONFIG_HAVE_AOUT=y
303# CONFIG_BINFMT_AOUT is not set
304# CONFIG_BINFMT_MISC is not set
305
306#
307# Power management options
308#
309# CONFIG_PM is not set
310CONFIG_ARCH_SUSPEND_POSSIBLE=y
311# CONFIG_NET is not set
312
313#
314# Device Drivers
315#
316
317#
318# Generic Driver Options
319#
320CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
321CONFIG_STANDALONE=y
322CONFIG_PREVENT_FIRMWARE_BUILD=y
323CONFIG_FW_LOADER=y
324CONFIG_FIRMWARE_IN_KERNEL=y
325CONFIG_EXTRA_FIRMWARE=""
326# CONFIG_DEBUG_DRIVER is not set
327# CONFIG_DEBUG_DEVRES is not set
328# CONFIG_SYS_HYPERVISOR is not set
329# CONFIG_MTD is not set
330# CONFIG_PARPORT is not set
331CONFIG_BLK_DEV=y
332# CONFIG_BLK_DEV_COW_COMMON is not set
333CONFIG_BLK_DEV_LOOP=y
334# CONFIG_BLK_DEV_CRYPTOLOOP is not set
335CONFIG_BLK_DEV_RAM=y
336CONFIG_BLK_DEV_RAM_COUNT=16
337CONFIG_BLK_DEV_RAM_SIZE=8192
338# CONFIG_BLK_DEV_XIP is not set
339# CONFIG_CDROM_PKTCDVD is not set
340# CONFIG_MG_DISK is not set
341CONFIG_MISC_DEVICES=y
342# CONFIG_ICS932S401 is not set
343# CONFIG_ENCLOSURE_SERVICES is not set
344# CONFIG_ISL29003 is not set
345# CONFIG_C2PORT is not set
346
347#
348# EEPROM support
349#
350CONFIG_EEPROM_AT24=y
351# CONFIG_EEPROM_LEGACY is not set
352# CONFIG_EEPROM_MAX6875 is not set
353# CONFIG_EEPROM_93CX6 is not set
354CONFIG_HAVE_IDE=y
355# CONFIG_IDE is not set
356
357#
358# SCSI device support
359#
360# CONFIG_RAID_ATTRS is not set
361# CONFIG_SCSI is not set
362# CONFIG_SCSI_DMA is not set
363# CONFIG_SCSI_NETLINK is not set
364# CONFIG_ATA is not set
365# CONFIG_MD is not set
366
367#
368# Input device support
369#
370CONFIG_INPUT=y
371# CONFIG_INPUT_FF_MEMLESS is not set
372# CONFIG_INPUT_POLLDEV is not set
373
374#
375# Userland interfaces
376#
377CONFIG_INPUT_MOUSEDEV=y
378CONFIG_INPUT_MOUSEDEV_PSAUX=y
379CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
380CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
381# CONFIG_INPUT_JOYDEV is not set
382# CONFIG_INPUT_EVDEV is not set
383# CONFIG_INPUT_EVBUG is not set
384
385#
386# Input Device Drivers
387#
388CONFIG_INPUT_KEYBOARD=y
389CONFIG_KEYBOARD_ATKBD=y
390# CONFIG_KEYBOARD_SUNKBD is not set
391# CONFIG_KEYBOARD_LKKBD is not set
392# CONFIG_KEYBOARD_XTKBD is not set
393# CONFIG_KEYBOARD_NEWTON is not set
394# CONFIG_KEYBOARD_STOWAWAY is not set
395# CONFIG_KEYBOARD_GPIO is not set
396CONFIG_INPUT_MOUSE=y
397CONFIG_MOUSE_PS2=y
398CONFIG_MOUSE_PS2_ALPS=y
399CONFIG_MOUSE_PS2_LOGIPS2PP=y
400CONFIG_MOUSE_PS2_SYNAPTICS=y
401CONFIG_MOUSE_PS2_TRACKPOINT=y
402# CONFIG_MOUSE_PS2_ELANTECH is not set
403# CONFIG_MOUSE_PS2_TOUCHKIT is not set
404# CONFIG_MOUSE_SERIAL is not set
405# CONFIG_MOUSE_APPLETOUCH is not set
406# CONFIG_MOUSE_BCM5974 is not set
407# CONFIG_MOUSE_VSXXXAA is not set
408# CONFIG_MOUSE_GPIO is not set
409# CONFIG_MOUSE_SYNAPTICS_I2C is not set
410# CONFIG_INPUT_JOYSTICK is not set
411# CONFIG_INPUT_TABLET is not set
412# CONFIG_INPUT_TOUCHSCREEN is not set
413# CONFIG_INPUT_MISC is not set
414
415#
416# Hardware I/O ports
417#
418CONFIG_SERIO=y
419CONFIG_SERIO_SERPORT=y
420CONFIG_SERIO_LIBPS2=y
421# CONFIG_SERIO_RAW is not set
422# CONFIG_GAMEPORT is not set
423
424#
425# Character devices
426#
427CONFIG_VT=y
428CONFIG_CONSOLE_TRANSLATIONS=y
429CONFIG_VT_CONSOLE=y
430CONFIG_HW_CONSOLE=y
431# CONFIG_VT_HW_CONSOLE_BINDING is not set
432CONFIG_DEVKMEM=y
433# CONFIG_SERIAL_NONSTANDARD is not set
434
435#
436# Serial drivers
437#
438CONFIG_SERIAL_8250=y
439# CONFIG_SERIAL_8250_CONSOLE is not set
440CONFIG_SERIAL_8250_NR_UARTS=4
441CONFIG_SERIAL_8250_RUNTIME_UARTS=4
442# CONFIG_SERIAL_8250_EXTENDED is not set
443
444#
445# Non-8250 serial port support
446#
447CONFIG_SERIAL_SAMSUNG=y
448CONFIG_SERIAL_SAMSUNG_UARTS=3
449# CONFIG_SERIAL_SAMSUNG_DEBUG is not set
450CONFIG_SERIAL_SAMSUNG_CONSOLE=y
451CONFIG_SERIAL_CORE=y
452CONFIG_SERIAL_CORE_CONSOLE=y
453CONFIG_UNIX98_PTYS=y
454# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
455CONFIG_LEGACY_PTYS=y
456CONFIG_LEGACY_PTY_COUNT=256
457# CONFIG_IPMI_HANDLER is not set
458CONFIG_HW_RANDOM=y
459# CONFIG_HW_RANDOM_TIMERIOMEM is not set
460# CONFIG_R3964 is not set
461# CONFIG_RAW_DRIVER is not set
462# CONFIG_TCG_TPM is not set
463CONFIG_I2C=y
464CONFIG_I2C_BOARDINFO=y
465CONFIG_I2C_CHARDEV=y
466CONFIG_I2C_HELPER_AUTO=y
467
468#
469# I2C Hardware Bus support
470#
471
472#
473# I2C system bus drivers (mostly embedded / system-on-chip)
474#
475# CONFIG_I2C_GPIO is not set
476# CONFIG_I2C_OCORES is not set
477# CONFIG_I2C_SIMTEC is not set
478
479#
480# External I2C/SMBus adapter drivers
481#
482# CONFIG_I2C_PARPORT_LIGHT is not set
483# CONFIG_I2C_TAOS_EVM is not set
484
485#
486# Other I2C/SMBus bus drivers
487#
488# CONFIG_I2C_PCA_PLATFORM is not set
489# CONFIG_I2C_STUB is not set
490
491#
492# Miscellaneous I2C Chip support
493#
494# CONFIG_DS1682 is not set
495# CONFIG_SENSORS_PCF8574 is not set
496# CONFIG_PCF8575 is not set
497# CONFIG_SENSORS_PCA9539 is not set
498# CONFIG_SENSORS_TSL2550 is not set
499# CONFIG_I2C_DEBUG_CORE is not set
500# CONFIG_I2C_DEBUG_ALGO is not set
501# CONFIG_I2C_DEBUG_BUS is not set
502# CONFIG_I2C_DEBUG_CHIP is not set
503# CONFIG_SPI is not set
504CONFIG_ARCH_REQUIRE_GPIOLIB=y
505CONFIG_GPIOLIB=y
506# CONFIG_DEBUG_GPIO is not set
507# CONFIG_GPIO_SYSFS is not set
508
509#
510# Memory mapped GPIO expanders:
511#
512
513#
514# I2C GPIO expanders:
515#
516# CONFIG_GPIO_MAX732X is not set
517# CONFIG_GPIO_PCA953X is not set
518# CONFIG_GPIO_PCF857X is not set
519
520#
521# PCI GPIO expanders:
522#
523
524#
525# SPI GPIO expanders:
526#
527# CONFIG_W1 is not set
528# CONFIG_POWER_SUPPLY is not set
529CONFIG_HWMON=y
530# CONFIG_HWMON_VID is not set
531# CONFIG_SENSORS_AD7414 is not set
532# CONFIG_SENSORS_AD7418 is not set
533# CONFIG_SENSORS_ADM1021 is not set
534# CONFIG_SENSORS_ADM1025 is not set
535# CONFIG_SENSORS_ADM1026 is not set
536# CONFIG_SENSORS_ADM1029 is not set
537# CONFIG_SENSORS_ADM1031 is not set
538# CONFIG_SENSORS_ADM9240 is not set
539# CONFIG_SENSORS_ADT7462 is not set
540# CONFIG_SENSORS_ADT7470 is not set
541# CONFIG_SENSORS_ADT7473 is not set
542# CONFIG_SENSORS_ADT7475 is not set
543# CONFIG_SENSORS_ATXP1 is not set
544# CONFIG_SENSORS_DS1621 is not set
545# CONFIG_SENSORS_F71805F is not set
546# CONFIG_SENSORS_F71882FG is not set
547# CONFIG_SENSORS_F75375S is not set
548# CONFIG_SENSORS_G760A is not set
549# CONFIG_SENSORS_GL518SM is not set
550# CONFIG_SENSORS_GL520SM is not set
551# CONFIG_SENSORS_IT87 is not set
552# CONFIG_SENSORS_LM63 is not set
553# CONFIG_SENSORS_LM75 is not set
554# CONFIG_SENSORS_LM77 is not set
555# CONFIG_SENSORS_LM78 is not set
556# CONFIG_SENSORS_LM80 is not set
557# CONFIG_SENSORS_LM83 is not set
558# CONFIG_SENSORS_LM85 is not set
559# CONFIG_SENSORS_LM87 is not set
560# CONFIG_SENSORS_LM90 is not set
561# CONFIG_SENSORS_LM92 is not set
562# CONFIG_SENSORS_LM93 is not set
563# CONFIG_SENSORS_LTC4215 is not set
564# CONFIG_SENSORS_LTC4245 is not set
565# CONFIG_SENSORS_LM95241 is not set
566# CONFIG_SENSORS_MAX1619 is not set
567# CONFIG_SENSORS_MAX6650 is not set
568# CONFIG_SENSORS_PC87360 is not set
569# CONFIG_SENSORS_PC87427 is not set
570# CONFIG_SENSORS_PCF8591 is not set
571# CONFIG_SENSORS_SHT15 is not set
572# CONFIG_SENSORS_DME1737 is not set
573# CONFIG_SENSORS_SMSC47M1 is not set
574# CONFIG_SENSORS_SMSC47M192 is not set
575# CONFIG_SENSORS_SMSC47B397 is not set
576# CONFIG_SENSORS_ADS7828 is not set
577# CONFIG_SENSORS_THMC50 is not set
578# CONFIG_SENSORS_TMP401 is not set
579# CONFIG_SENSORS_VT1211 is not set
580# CONFIG_SENSORS_W83781D is not set
581# CONFIG_SENSORS_W83791D is not set
582# CONFIG_SENSORS_W83792D is not set
583# CONFIG_SENSORS_W83793 is not set
584# CONFIG_SENSORS_W83L785TS is not set
585# CONFIG_SENSORS_W83L786NG is not set
586# CONFIG_SENSORS_W83627HF is not set
587# CONFIG_SENSORS_W83627EHF is not set
588# CONFIG_HWMON_DEBUG_CHIP is not set
589# CONFIG_THERMAL is not set
590# CONFIG_THERMAL_HWMON is not set
591# CONFIG_WATCHDOG is not set
592CONFIG_SSB_POSSIBLE=y
593
594#
595# Sonics Silicon Backplane
596#
597# CONFIG_SSB is not set
598
599#
600# Multifunction device drivers
601#
602# CONFIG_MFD_CORE is not set
603# CONFIG_MFD_SM501 is not set
604# CONFIG_MFD_ASIC3 is not set
605# CONFIG_HTC_EGPIO is not set
606# CONFIG_HTC_PASIC3 is not set
607# CONFIG_TPS65010 is not set
608# CONFIG_TWL4030_CORE is not set
609# CONFIG_MFD_TMIO is not set
610# CONFIG_MFD_T7L66XB is not set
611# CONFIG_MFD_TC6387XB is not set
612# CONFIG_MFD_TC6393XB is not set
613# CONFIG_PMIC_DA903X is not set
614# CONFIG_MFD_WM8400 is not set
615# CONFIG_MFD_WM8350_I2C is not set
616# CONFIG_MFD_PCF50633 is not set
617# CONFIG_AB3100_CORE is not set
618# CONFIG_MEDIA_SUPPORT is not set
619
620#
621# Graphics support
622#
623# CONFIG_VGASTATE is not set
624# CONFIG_VIDEO_OUTPUT_CONTROL is not set
625# CONFIG_FB is not set
626# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
627
628#
629# Display device support
630#
631# CONFIG_DISPLAY_SUPPORT is not set
632
633#
634# Console display driver support
635#
636# CONFIG_VGA_CONSOLE is not set
637CONFIG_DUMMY_CONSOLE=y
638# CONFIG_SOUND is not set
639CONFIG_HID_SUPPORT=y
640CONFIG_HID=y
641CONFIG_HID_DEBUG=y
642# CONFIG_HIDRAW is not set
643# CONFIG_HID_PID is not set
644
645#
646# Special HID drivers
647#
648CONFIG_USB_SUPPORT=y
649CONFIG_USB_ARCH_HAS_HCD=y
650# CONFIG_USB_ARCH_HAS_OHCI is not set
651# CONFIG_USB_ARCH_HAS_EHCI is not set
652# CONFIG_USB is not set
653
654#
655# Enable Host or Gadget support to see Inventra options
656#
657
658#
659# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
660#
661# CONFIG_USB_GADGET is not set
662
663#
664# OTG and related infrastructure
665#
666CONFIG_MMC=y
667CONFIG_MMC_DEBUG=y
668CONFIG_MMC_UNSAFE_RESUME=y
669
670#
671# MMC/SD/SDIO Card Drivers
672#
673CONFIG_MMC_BLOCK=y
674CONFIG_MMC_BLOCK_BOUNCE=y
675CONFIG_SDIO_UART=y
676# CONFIG_MMC_TEST is not set
677
678#
679# MMC/SD/SDIO Host Controller Drivers
680#
681CONFIG_MMC_SDHCI=y
682# CONFIG_MMC_SDHCI_PLTFM is not set
683# CONFIG_MEMSTICK is not set
684# CONFIG_ACCESSIBILITY is not set
685# CONFIG_NEW_LEDS is not set
686CONFIG_RTC_LIB=y
687# CONFIG_RTC_CLASS is not set
688# CONFIG_DMADEVICES is not set
689# CONFIG_AUXDISPLAY is not set
690# CONFIG_REGULATOR is not set
691# CONFIG_UIO is not set
692# CONFIG_STAGING is not set
693
694#
695# File systems
696#
697CONFIG_EXT2_FS=y
698# CONFIG_EXT2_FS_XATTR is not set
699# CONFIG_EXT2_FS_XIP is not set
700CONFIG_EXT3_FS=y
701# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
702CONFIG_EXT3_FS_XATTR=y
703CONFIG_EXT3_FS_POSIX_ACL=y
704CONFIG_EXT3_FS_SECURITY=y
705# CONFIG_EXT4_FS is not set
706CONFIG_JBD=y
707CONFIG_FS_MBCACHE=y
708# CONFIG_REISERFS_FS is not set
709# CONFIG_JFS_FS is not set
710CONFIG_FS_POSIX_ACL=y
711# CONFIG_XFS_FS is not set
712# CONFIG_GFS2_FS is not set
713# CONFIG_BTRFS_FS is not set
714CONFIG_FILE_LOCKING=y
715CONFIG_FSNOTIFY=y
716CONFIG_DNOTIFY=y
717CONFIG_INOTIFY=y
718CONFIG_INOTIFY_USER=y
719# CONFIG_QUOTA is not set
720# CONFIG_AUTOFS_FS is not set
721# CONFIG_AUTOFS4_FS is not set
722# CONFIG_FUSE_FS is not set
723CONFIG_GENERIC_ACL=y
724
725#
726# Caches
727#
728# CONFIG_FSCACHE is not set
729
730#
731# CD-ROM/DVD Filesystems
732#
733# CONFIG_ISO9660_FS is not set
734# CONFIG_UDF_FS is not set
735
736#
737# DOS/FAT/NT Filesystems
738#
739# CONFIG_MSDOS_FS is not set
740# CONFIG_VFAT_FS is not set
741# CONFIG_NTFS_FS is not set
742
743#
744# Pseudo filesystems
745#
746CONFIG_PROC_FS=y
747CONFIG_PROC_SYSCTL=y
748CONFIG_PROC_PAGE_MONITOR=y
749CONFIG_SYSFS=y
750CONFIG_TMPFS=y
751CONFIG_TMPFS_POSIX_ACL=y
752# CONFIG_HUGETLB_PAGE is not set
753# CONFIG_CONFIGFS_FS is not set
754CONFIG_MISC_FILESYSTEMS=y
755# CONFIG_ADFS_FS is not set
756# CONFIG_AFFS_FS is not set
757# CONFIG_HFS_FS is not set
758# CONFIG_HFSPLUS_FS is not set
759# CONFIG_BEFS_FS is not set
760# CONFIG_BFS_FS is not set
761# CONFIG_EFS_FS is not set
762CONFIG_CRAMFS=y
763# CONFIG_SQUASHFS is not set
764# CONFIG_VXFS_FS is not set
765# CONFIG_MINIX_FS is not set
766# CONFIG_OMFS_FS is not set
767# CONFIG_HPFS_FS is not set
768# CONFIG_QNX4FS_FS is not set
769CONFIG_ROMFS_FS=y
770CONFIG_ROMFS_BACKED_BY_BLOCK=y
771# CONFIG_ROMFS_BACKED_BY_MTD is not set
772# CONFIG_ROMFS_BACKED_BY_BOTH is not set
773CONFIG_ROMFS_ON_BLOCK=y
774# CONFIG_SYSV_FS is not set
775# CONFIG_UFS_FS is not set
776# CONFIG_NILFS2_FS is not set
777
778#
779# Partition Types
780#
781# CONFIG_PARTITION_ADVANCED is not set
782CONFIG_MSDOS_PARTITION=y
783# CONFIG_NLS is not set
784
785#
786# Kernel hacking
787#
788# CONFIG_PRINTK_TIME is not set
789CONFIG_ENABLE_WARN_DEPRECATED=y
790CONFIG_ENABLE_MUST_CHECK=y
791CONFIG_FRAME_WARN=1024
792CONFIG_MAGIC_SYSRQ=y
793# CONFIG_UNUSED_SYMBOLS is not set
794# CONFIG_DEBUG_FS is not set
795# CONFIG_HEADERS_CHECK is not set
796CONFIG_DEBUG_KERNEL=y
797# CONFIG_DEBUG_SHIRQ is not set
798CONFIG_DETECT_SOFTLOCKUP=y
799# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
800CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
801CONFIG_DETECT_HUNG_TASK=y
802# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
803CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
804CONFIG_SCHED_DEBUG=y
805# CONFIG_SCHEDSTATS is not set
806# CONFIG_TIMER_STATS is not set
807# CONFIG_DEBUG_OBJECTS is not set
808# CONFIG_SLUB_DEBUG_ON is not set
809# CONFIG_SLUB_STATS is not set
810# CONFIG_DEBUG_KMEMLEAK is not set
811CONFIG_DEBUG_RT_MUTEXES=y
812CONFIG_DEBUG_PI_LIST=y
813# CONFIG_RT_MUTEX_TESTER is not set
814CONFIG_DEBUG_SPINLOCK=y
815CONFIG_DEBUG_MUTEXES=y
816# CONFIG_DEBUG_LOCK_ALLOC is not set
817# CONFIG_PROVE_LOCKING is not set
818# CONFIG_LOCK_STAT is not set
819CONFIG_DEBUG_SPINLOCK_SLEEP=y
820# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
821# CONFIG_DEBUG_KOBJECT is not set
822CONFIG_DEBUG_BUGVERBOSE=y
823CONFIG_DEBUG_INFO=y
824# CONFIG_DEBUG_VM is not set
825# CONFIG_DEBUG_WRITECOUNT is not set
826CONFIG_DEBUG_MEMORY_INIT=y
827# CONFIG_DEBUG_LIST is not set
828# CONFIG_DEBUG_SG is not set
829# CONFIG_DEBUG_NOTIFIERS is not set
830# CONFIG_BOOT_PRINTK_DELAY is not set
831# CONFIG_RCU_TORTURE_TEST is not set
832# CONFIG_RCU_CPU_STALL_DETECTOR is not set
833# CONFIG_BACKTRACE_SELF_TEST is not set
834# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
835# CONFIG_FAULT_INJECTION is not set
836# CONFIG_LATENCYTOP is not set
837CONFIG_SYSCTL_SYSCALL_CHECK=y
838# CONFIG_PAGE_POISONING is not set
839CONFIG_HAVE_FUNCTION_TRACER=y
840CONFIG_TRACING_SUPPORT=y
841CONFIG_FTRACE=y
842# CONFIG_FUNCTION_TRACER is not set
843# CONFIG_SCHED_TRACER is not set
844# CONFIG_ENABLE_DEFAULT_TRACERS is not set
845# CONFIG_BOOT_TRACER is not set
846CONFIG_BRANCH_PROFILE_NONE=y
847# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
848# CONFIG_PROFILE_ALL_BRANCHES is not set
849# CONFIG_STACK_TRACER is not set
850# CONFIG_KMEMTRACE is not set
851# CONFIG_WORKQUEUE_TRACER is not set
852# CONFIG_BLK_DEV_IO_TRACE is not set
853# CONFIG_SAMPLES is not set
854CONFIG_HAVE_ARCH_KGDB=y
855# CONFIG_KGDB is not set
856CONFIG_ARM_UNWIND=y
857CONFIG_DEBUG_USER=y
858CONFIG_DEBUG_ERRORS=y
859# CONFIG_DEBUG_STACK_USAGE is not set
860CONFIG_DEBUG_LL=y
861# CONFIG_DEBUG_ICEDCC is not set
862CONFIG_DEBUG_S3C_PORT=y
863CONFIG_DEBUG_S3C_UART=0
864
865#
866# Security options
867#
868# CONFIG_KEYS is not set
869# CONFIG_SECURITY is not set
870# CONFIG_SECURITYFS is not set
871# CONFIG_SECURITY_FILE_CAPABILITIES is not set
872# CONFIG_CRYPTO is not set
873# CONFIG_BINARY_PRINTF is not set
874
875#
876# Library routines
877#
878CONFIG_BITREVERSE=y
879CONFIG_GENERIC_FIND_LAST_BIT=y
880# CONFIG_CRC_CCITT is not set
881# CONFIG_CRC16 is not set
882# CONFIG_CRC_T10DIF is not set
883# CONFIG_CRC_ITU_T is not set
884CONFIG_CRC32=y
885# CONFIG_CRC7 is not set
886# CONFIG_LIBCRC32C is not set
887CONFIG_ZLIB_INFLATE=y
888CONFIG_DECOMPRESS_GZIP=y
889CONFIG_DECOMPRESS_BZIP2=y
890CONFIG_DECOMPRESS_LZMA=y
891CONFIG_HAS_IOMEM=y
892CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/u300_defconfig b/arch/arm/configs/u300_defconfig
index 4762d9001298..7d61ae6e75da 100644
--- a/arch/arm/configs/u300_defconfig
+++ b/arch/arm/configs/u300_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31-rc1 3# Linux kernel version: 2.6.31-rc3
4# Thu Jul 2 00:16:59 2009 4# Thu Jul 16 23:36:10 2009
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -9,7 +9,6 @@ CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y 9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y 10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y 11CONFIG_MMU=y
12CONFIG_HAVE_TCM=y
13CONFIG_GENERIC_HARDIRQS=y 12CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y 13CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y 14CONFIG_HAVE_LATENCYTOP_SUPPORT=y
@@ -113,7 +112,7 @@ CONFIG_MODULE_UNLOAD=y
113# CONFIG_MODVERSIONS is not set 112# CONFIG_MODVERSIONS is not set
114# CONFIG_MODULE_SRCVERSION_ALL is not set 113# CONFIG_MODULE_SRCVERSION_ALL is not set
115CONFIG_BLOCK=y 114CONFIG_BLOCK=y
116CONFIG_LBDAF=y 115# CONFIG_LBDAF is not set
117# CONFIG_BLK_DEV_BSG is not set 116# CONFIG_BLK_DEV_BSG is not set
118# CONFIG_BLK_DEV_INTEGRITY is not set 117# CONFIG_BLK_DEV_INTEGRITY is not set
119 118
@@ -542,13 +541,14 @@ CONFIG_INPUT_EVDEV=y
542# 541#
543CONFIG_INPUT_KEYBOARD=y 542CONFIG_INPUT_KEYBOARD=y
544# CONFIG_KEYBOARD_ATKBD is not set 543# CONFIG_KEYBOARD_ATKBD is not set
545# CONFIG_KEYBOARD_SUNKBD is not set
546# CONFIG_KEYBOARD_LKKBD is not set 544# CONFIG_KEYBOARD_LKKBD is not set
547# CONFIG_KEYBOARD_XTKBD is not set 545# CONFIG_KEYBOARD_GPIO is not set
546# CONFIG_KEYBOARD_MATRIX is not set
547# CONFIG_KEYBOARD_LM8323 is not set
548# CONFIG_KEYBOARD_NEWTON is not set 548# CONFIG_KEYBOARD_NEWTON is not set
549# CONFIG_KEYBOARD_STOWAWAY is not set 549# CONFIG_KEYBOARD_STOWAWAY is not set
550# CONFIG_KEYBOARD_LM8323 is not set 550# CONFIG_KEYBOARD_SUNKBD is not set
551# CONFIG_KEYBOARD_GPIO is not set 551# CONFIG_KEYBOARD_XTKBD is not set
552# CONFIG_INPUT_MOUSE is not set 552# CONFIG_INPUT_MOUSE is not set
553# CONFIG_INPUT_JOYSTICK is not set 553# CONFIG_INPUT_JOYSTICK is not set
554# CONFIG_INPUT_TABLET is not set 554# CONFIG_INPUT_TABLET is not set
@@ -911,7 +911,6 @@ CONFIG_REGULATOR=y
911# CONFIG_JFS_FS is not set 911# CONFIG_JFS_FS is not set
912# CONFIG_FS_POSIX_ACL is not set 912# CONFIG_FS_POSIX_ACL is not set
913# CONFIG_XFS_FS is not set 913# CONFIG_XFS_FS is not set
914# CONFIG_GFS2_FS is not set
915# CONFIG_OCFS2_FS is not set 914# CONFIG_OCFS2_FS is not set
916# CONFIG_BTRFS_FS is not set 915# CONFIG_BTRFS_FS is not set
917CONFIG_FILE_LOCKING=y 916CONFIG_FILE_LOCKING=y
@@ -1122,7 +1121,6 @@ CONFIG_GENERIC_FIND_LAST_BIT=y
1122# CONFIG_CRC32 is not set 1121# CONFIG_CRC32 is not set
1123# CONFIG_CRC7 is not set 1122# CONFIG_CRC7 is not set
1124# CONFIG_LIBCRC32C is not set 1123# CONFIG_LIBCRC32C is not set
1125CONFIG_GENERIC_ALLOCATOR=y
1126CONFIG_HAS_IOMEM=y 1124CONFIG_HAS_IOMEM=y
1127CONFIG_HAS_IOPORT=y 1125CONFIG_HAS_IOPORT=y
1128CONFIG_HAS_DMA=y 1126CONFIG_HAS_DMA=y
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 15f8a092b700..00f46d9ce299 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -74,23 +74,56 @@
74 * Enable and disable interrupts 74 * Enable and disable interrupts
75 */ 75 */
76#if __LINUX_ARM_ARCH__ >= 6 76#if __LINUX_ARM_ARCH__ >= 6
77 .macro disable_irq 77 .macro disable_irq_notrace
78 cpsid i 78 cpsid i
79 .endm 79 .endm
80 80
81 .macro enable_irq 81 .macro enable_irq_notrace
82 cpsie i 82 cpsie i
83 .endm 83 .endm
84#else 84#else
85 .macro disable_irq 85 .macro disable_irq_notrace
86 msr cpsr_c, #PSR_I_BIT | SVC_MODE 86 msr cpsr_c, #PSR_I_BIT | SVC_MODE
87 .endm 87 .endm
88 88
89 .macro enable_irq 89 .macro enable_irq_notrace
90 msr cpsr_c, #SVC_MODE 90 msr cpsr_c, #SVC_MODE
91 .endm 91 .endm
92#endif 92#endif
93 93
94 .macro asm_trace_hardirqs_off
95#if defined(CONFIG_TRACE_IRQFLAGS)
96 stmdb sp!, {r0-r3, ip, lr}
97 bl trace_hardirqs_off
98 ldmia sp!, {r0-r3, ip, lr}
99#endif
100 .endm
101
102 .macro asm_trace_hardirqs_on_cond, cond
103#if defined(CONFIG_TRACE_IRQFLAGS)
104 /*
105 * actually the registers should be pushed and pop'd conditionally, but
106 * after bl the flags are certainly clobbered
107 */
108 stmdb sp!, {r0-r3, ip, lr}
109 bl\cond trace_hardirqs_on
110 ldmia sp!, {r0-r3, ip, lr}
111#endif
112 .endm
113
114 .macro asm_trace_hardirqs_on
115 asm_trace_hardirqs_on_cond al
116 .endm
117
118 .macro disable_irq
119 disable_irq_notrace
120 asm_trace_hardirqs_off
121 .endm
122
123 .macro enable_irq
124 asm_trace_hardirqs_on
125 enable_irq_notrace
126 .endm
94/* 127/*
95 * Save the current IRQ state and disable IRQs. Note that this macro 128 * Save the current IRQ state and disable IRQs. Note that this macro
96 * assumes FIQs are enabled, and that the processor is in SVC mode. 129 * assumes FIQs are enabled, and that the processor is in SVC mode.
@@ -104,10 +137,16 @@
104 * Restore interrupt state previously stored in a register. We don't 137 * Restore interrupt state previously stored in a register. We don't
105 * guarantee that this will preserve the flags. 138 * guarantee that this will preserve the flags.
106 */ 139 */
107 .macro restore_irqs, oldcpsr 140 .macro restore_irqs_notrace, oldcpsr
108 msr cpsr_c, \oldcpsr 141 msr cpsr_c, \oldcpsr
109 .endm 142 .endm
110 143
144 .macro restore_irqs, oldcpsr
145 tst \oldcpsr, #PSR_I_BIT
146 asm_trace_hardirqs_on_cond eq
147 restore_irqs_notrace \oldcpsr
148 .endm
149
111#define USER(x...) \ 150#define USER(x...) \
1129999: x; \ 1519999: x; \
113 .section __ex_table,"a"; \ 152 .section __ex_table,"a"; \
@@ -127,3 +166,87 @@
127#endif 166#endif
128#endif 167#endif
129 .endm 168 .endm
169
170#ifdef CONFIG_THUMB2_KERNEL
171 .macro setmode, mode, reg
172 mov \reg, #\mode
173 msr cpsr_c, \reg
174 .endm
175#else
176 .macro setmode, mode, reg
177 msr cpsr_c, #\mode
178 .endm
179#endif
180
181/*
182 * STRT/LDRT access macros with ARM and Thumb-2 variants
183 */
184#ifdef CONFIG_THUMB2_KERNEL
185
186 .macro usraccoff, instr, reg, ptr, inc, off, cond, abort
1879999:
188 .if \inc == 1
189 \instr\cond\()bt \reg, [\ptr, #\off]
190 .elseif \inc == 4
191 \instr\cond\()t \reg, [\ptr, #\off]
192 .else
193 .error "Unsupported inc macro argument"
194 .endif
195
196 .section __ex_table,"a"
197 .align 3
198 .long 9999b, \abort
199 .previous
200 .endm
201
202 .macro usracc, instr, reg, ptr, inc, cond, rept, abort
203 @ explicit IT instruction needed because of the label
204 @ introduced by the USER macro
205 .ifnc \cond,al
206 .if \rept == 1
207 itt \cond
208 .elseif \rept == 2
209 ittt \cond
210 .else
211 .error "Unsupported rept macro argument"
212 .endif
213 .endif
214
215 @ Slightly optimised to avoid incrementing the pointer twice
216 usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort
217 .if \rept == 2
218 usraccoff \instr, \reg, \ptr, \inc, 4, \cond, \abort
219 .endif
220
221 add\cond \ptr, #\rept * \inc
222 .endm
223
224#else /* !CONFIG_THUMB2_KERNEL */
225
226 .macro usracc, instr, reg, ptr, inc, cond, rept, abort
227 .rept \rept
2289999:
229 .if \inc == 1
230 \instr\cond\()bt \reg, [\ptr], #\inc
231 .elseif \inc == 4
232 \instr\cond\()t \reg, [\ptr], #\inc
233 .else
234 .error "Unsupported inc macro argument"
235 .endif
236
237 .section __ex_table,"a"
238 .align 3
239 .long 9999b, \abort
240 .previous
241 .endr
242 .endm
243
244#endif /* CONFIG_THUMB2_KERNEL */
245
246 .macro strusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
247 usracc str, \reg, \ptr, \inc, \cond, \rept, \abort
248 .endm
249
250 .macro ldrusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
251 usracc ldr, \reg, \ptr, \inc, \cond, \rept, \abort
252 .endm
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index c207504de84d..c3b911ee9151 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -55,6 +55,9 @@ typedef struct user_fp elf_fpregset_t;
55#define R_ARM_MOVW_ABS_NC 43 55#define R_ARM_MOVW_ABS_NC 43
56#define R_ARM_MOVT_ABS 44 56#define R_ARM_MOVT_ABS 44
57 57
58#define R_ARM_THM_CALL 10
59#define R_ARM_THM_JUMP24 30
60
58/* 61/*
59 * These are used to set parameters in the core dumps. 62 * These are used to set parameters in the core dumps.
60 */ 63 */
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index d74265cffd86..103f7ee97313 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -7,6 +7,7 @@
7 7
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9extern void mcount(void); 9extern void mcount(void);
10extern void __gnu_mcount_nc(void);
10#endif 11#endif
11 12
12#endif 13#endif
diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
index 9ee743b95de8..bfcc15929a7f 100644
--- a/arch/arm/include/asm/futex.h
+++ b/arch/arm/include/asm/futex.h
@@ -99,6 +99,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
99 __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" 99 __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n"
100 "1: ldrt %0, [%3]\n" 100 "1: ldrt %0, [%3]\n"
101 " teq %0, %1\n" 101 " teq %0, %1\n"
102 " it eq @ explicit IT needed for the 2b label\n"
102 "2: streqt %2, [%3]\n" 103 "2: streqt %2, [%3]\n"
103 "3:\n" 104 "3:\n"
104 " .section __ex_table,\"a\"\n" 105 " .section __ex_table,\"a\"\n"
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 85763db87449..376be1a62866 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -44,7 +44,13 @@
44 * The module space lives between the addresses given by TASK_SIZE 44 * The module space lives between the addresses given by TASK_SIZE
45 * and PAGE_OFFSET - it must be within 32MB of the kernel text. 45 * and PAGE_OFFSET - it must be within 32MB of the kernel text.
46 */ 46 */
47#ifndef CONFIG_THUMB2_KERNEL
47#define MODULES_VADDR (PAGE_OFFSET - 16*1024*1024) 48#define MODULES_VADDR (PAGE_OFFSET - 16*1024*1024)
49#else
50/* smaller range for Thumb-2 symbols relocation (2^24)*/
51#define MODULES_VADDR (PAGE_OFFSET - 8*1024*1024)
52#endif
53
48#if TASK_SIZE > MODULES_VADDR 54#if TASK_SIZE > MODULES_VADDR
49#error Top of user space clashes with start of module space 55#error Top of user space clashes with start of module space
50#endif 56#endif
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index 263fed05ea33..bcdb9291ef0c 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -62,8 +62,10 @@ static inline void check_context(struct mm_struct *mm)
62 62
63static inline void check_context(struct mm_struct *mm) 63static inline void check_context(struct mm_struct *mm)
64{ 64{
65#ifdef CONFIG_MMU
65 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) 66 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
66 __check_kvm_seq(mm); 67 __check_kvm_seq(mm);
68#endif
67} 69}
68 70
69#define init_new_context(tsk,mm) 0 71#define init_new_context(tsk,mm) 0
diff --git a/arch/arm/include/asm/page-nommu.h b/arch/arm/include/asm/page-nommu.h
index 3574c0deb37f..d1b162a18dcb 100644
--- a/arch/arm/include/asm/page-nommu.h
+++ b/arch/arm/include/asm/page-nommu.h
@@ -43,7 +43,4 @@ typedef unsigned long pgprot_t;
43#define __pmd(x) (x) 43#define __pmd(x) (x)
44#define __pgprot(x) (x) 44#define __pgprot(x) (x)
45 45
46extern unsigned long memory_start;
47extern unsigned long memory_end;
48
49#endif 46#endif
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 67b833c9b6b9..bbecccda76d0 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -82,6 +82,14 @@
82#define PSR_ENDSTATE 0 82#define PSR_ENDSTATE 0
83#endif 83#endif
84 84
85/*
86 * These are 'magic' values for PTRACE_PEEKUSR that return info about where a
87 * process is located in memory.
88 */
89#define PT_TEXT_ADDR 0x10000
90#define PT_DATA_ADDR 0x10004
91#define PT_TEXT_END_ADDR 0x10008
92
85#ifndef __ASSEMBLY__ 93#ifndef __ASSEMBLY__
86 94
87/* 95/*
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
index 321c83e43a1e..f41a6f57cd12 100644
--- a/arch/arm/include/asm/tlb.h
+++ b/arch/arm/include/asm/tlb.h
@@ -102,8 +102,8 @@ tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
102} 102}
103 103
104#define tlb_remove_page(tlb,page) free_page_and_swap_cache(page) 104#define tlb_remove_page(tlb,page) free_page_and_swap_cache(page)
105#define pte_free_tlb(tlb, ptep) pte_free((tlb)->mm, ptep) 105#define pte_free_tlb(tlb, ptep, addr) pte_free((tlb)->mm, ptep)
106#define pmd_free_tlb(tlb, pmdp) pmd_free((tlb)->mm, pmdp) 106#define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp)
107 107
108#define tlb_migrate_finish(mm) do { } while (0) 108#define tlb_migrate_finish(mm) do { } while (0)
109 109
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 0da9bc9b3b1d..1d6bd40a4322 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -17,6 +17,7 @@
17#include <asm/memory.h> 17#include <asm/memory.h>
18#include <asm/domain.h> 18#include <asm/domain.h>
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/unified.h>
20 21
21#define VERIFY_READ 0 22#define VERIFY_READ 0
22#define VERIFY_WRITE 1 23#define VERIFY_WRITE 1
@@ -365,8 +366,10 @@ do { \
365 366
366#define __put_user_asm_dword(x,__pu_addr,err) \ 367#define __put_user_asm_dword(x,__pu_addr,err) \
367 __asm__ __volatile__( \ 368 __asm__ __volatile__( \
368 "1: strt " __reg_oper1 ", [%1], #4\n" \ 369 ARM( "1: strt " __reg_oper1 ", [%1], #4\n" ) \
369 "2: strt " __reg_oper0 ", [%1]\n" \ 370 ARM( "2: strt " __reg_oper0 ", [%1]\n" ) \
371 THUMB( "1: strt " __reg_oper1 ", [%1]\n" ) \
372 THUMB( "2: strt " __reg_oper0 ", [%1, #4]\n" ) \
370 "3:\n" \ 373 "3:\n" \
371 " .section .fixup,\"ax\"\n" \ 374 " .section .fixup,\"ax\"\n" \
372 " .align 2\n" \ 375 " .align 2\n" \
diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h
new file mode 100644
index 000000000000..073e85b9b961
--- /dev/null
+++ b/arch/arm/include/asm/unified.h
@@ -0,0 +1,126 @@
1/*
2 * include/asm-arm/unified.h - Unified Assembler Syntax helper macros
3 *
4 * Copyright (C) 2008 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 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#ifndef __ASM_UNIFIED_H
21#define __ASM_UNIFIED_H
22
23#if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED)
24 .syntax unified
25#endif
26
27#ifdef CONFIG_THUMB2_KERNEL
28
29#if __GNUC__ < 4
30#error Thumb-2 kernel requires gcc >= 4
31#endif
32
33/* The CPSR bit describing the instruction set (Thumb) */
34#define PSR_ISETSTATE PSR_T_BIT
35
36#define ARM(x...)
37#define THUMB(x...) x
38#define W(instr) instr.w
39#define BSYM(sym) sym + 1
40
41#else /* !CONFIG_THUMB2_KERNEL */
42
43/* The CPSR bit describing the instruction set (ARM) */
44#define PSR_ISETSTATE 0
45
46#define ARM(x...) x
47#define THUMB(x...)
48#define W(instr) instr
49#define BSYM(sym) sym
50
51#endif /* CONFIG_THUMB2_KERNEL */
52
53#ifndef CONFIG_ARM_ASM_UNIFIED
54
55/*
56 * If the unified assembly syntax isn't used (in ARM mode), these
57 * macros expand to an empty string
58 */
59#ifdef __ASSEMBLY__
60 .macro it, cond
61 .endm
62 .macro itt, cond
63 .endm
64 .macro ite, cond
65 .endm
66 .macro ittt, cond
67 .endm
68 .macro itte, cond
69 .endm
70 .macro itet, cond
71 .endm
72 .macro itee, cond
73 .endm
74 .macro itttt, cond
75 .endm
76 .macro ittte, cond
77 .endm
78 .macro ittet, cond
79 .endm
80 .macro ittee, cond
81 .endm
82 .macro itett, cond
83 .endm
84 .macro itete, cond
85 .endm
86 .macro iteet, cond
87 .endm
88 .macro iteee, cond
89 .endm
90#else /* !__ASSEMBLY__ */
91__asm__(
92" .macro it, cond\n"
93" .endm\n"
94" .macro itt, cond\n"
95" .endm\n"
96" .macro ite, cond\n"
97" .endm\n"
98" .macro ittt, cond\n"
99" .endm\n"
100" .macro itte, cond\n"
101" .endm\n"
102" .macro itet, cond\n"
103" .endm\n"
104" .macro itee, cond\n"
105" .endm\n"
106" .macro itttt, cond\n"
107" .endm\n"
108" .macro ittte, cond\n"
109" .endm\n"
110" .macro ittet, cond\n"
111" .endm\n"
112" .macro ittee, cond\n"
113" .endm\n"
114" .macro itett, cond\n"
115" .endm\n"
116" .macro itete, cond\n"
117" .endm\n"
118" .macro iteet, cond\n"
119" .endm\n"
120" .macro iteee, cond\n"
121" .endm\n");
122#endif /* __ASSEMBLY__ */
123
124#endif /* CONFIG_ARM_ASM_UNIFIED */
125
126#endif /* !__ASM_UNIFIED_H */
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 531e1860e546..0e627705f746 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -186,4 +186,5 @@ EXPORT_SYMBOL(_find_next_bit_be);
186 186
187#ifdef CONFIG_FUNCTION_TRACER 187#ifdef CONFIG_FUNCTION_TRACER
188EXPORT_SYMBOL(mcount); 188EXPORT_SYMBOL(mcount);
189EXPORT_SYMBOL(__gnu_mcount_nc);
189#endif 190#endif
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index fc8af43c5000..3d727a8a23bc 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -34,7 +34,7 @@
34 @ 34 @
35 @ routine called with r0 = irq number, r1 = struct pt_regs * 35 @ routine called with r0 = irq number, r1 = struct pt_regs *
36 @ 36 @
37 adrne lr, 1b 37 adrne lr, BSYM(1b)
38 bne asm_do_IRQ 38 bne asm_do_IRQ
39 39
40#ifdef CONFIG_SMP 40#ifdef CONFIG_SMP
@@ -46,13 +46,13 @@
46 */ 46 */
47 test_for_ipi r0, r6, r5, lr 47 test_for_ipi r0, r6, r5, lr
48 movne r0, sp 48 movne r0, sp
49 adrne lr, 1b 49 adrne lr, BSYM(1b)
50 bne do_IPI 50 bne do_IPI
51 51
52#ifdef CONFIG_LOCAL_TIMERS 52#ifdef CONFIG_LOCAL_TIMERS
53 test_for_ltirq r0, r6, r5, lr 53 test_for_ltirq r0, r6, r5, lr
54 movne r0, sp 54 movne r0, sp
55 adrne lr, 1b 55 adrne lr, BSYM(1b)
56 bne do_local_timer 56 bne do_local_timer
57#endif 57#endif
58#endif 58#endif
@@ -70,7 +70,10 @@
70 */ 70 */
71 .macro inv_entry, reason 71 .macro inv_entry, reason
72 sub sp, sp, #S_FRAME_SIZE 72 sub sp, sp, #S_FRAME_SIZE
73 stmib sp, {r1 - lr} 73 ARM( stmib sp, {r1 - lr} )
74 THUMB( stmia sp, {r0 - r12} )
75 THUMB( str sp, [sp, #S_SP] )
76 THUMB( str lr, [sp, #S_LR] )
74 mov r1, #\reason 77 mov r1, #\reason
75 .endm 78 .endm
76 79
@@ -126,17 +129,24 @@ ENDPROC(__und_invalid)
126 .macro svc_entry, stack_hole=0 129 .macro svc_entry, stack_hole=0
127 UNWIND(.fnstart ) 130 UNWIND(.fnstart )
128 UNWIND(.save {r0 - pc} ) 131 UNWIND(.save {r0 - pc} )
129 sub sp, sp, #(S_FRAME_SIZE + \stack_hole) 132 sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
133#ifdef CONFIG_THUMB2_KERNEL
134 SPFIX( str r0, [sp] ) @ temporarily saved
135 SPFIX( mov r0, sp )
136 SPFIX( tst r0, #4 ) @ test original stack alignment
137 SPFIX( ldr r0, [sp] ) @ restored
138#else
130 SPFIX( tst sp, #4 ) 139 SPFIX( tst sp, #4 )
131 SPFIX( bicne sp, sp, #4 ) 140#endif
132 stmib sp, {r1 - r12} 141 SPFIX( subeq sp, sp, #4 )
142 stmia sp, {r1 - r12}
133 143
134 ldmia r0, {r1 - r3} 144 ldmia r0, {r1 - r3}
135 add r5, sp, #S_SP @ here for interlock avoidance 145 add r5, sp, #S_SP - 4 @ here for interlock avoidance
136 mov r4, #-1 @ "" "" "" "" 146 mov r4, #-1 @ "" "" "" ""
137 add r0, sp, #(S_FRAME_SIZE + \stack_hole) 147 add r0, sp, #(S_FRAME_SIZE + \stack_hole - 4)
138 SPFIX( addne r0, r0, #4 ) 148 SPFIX( addeq r0, r0, #4 )
139 str r1, [sp] @ save the "real" r0 copied 149 str r1, [sp, #-4]! @ save the "real" r0 copied
140 @ from the exception stack 150 @ from the exception stack
141 151
142 mov r1, lr 152 mov r1, lr
@@ -151,6 +161,8 @@ ENDPROC(__und_invalid)
151 @ r4 - orig_r0 (see pt_regs definition in ptrace.h) 161 @ r4 - orig_r0 (see pt_regs definition in ptrace.h)
152 @ 162 @
153 stmia r5, {r0 - r4} 163 stmia r5, {r0 - r4}
164
165 asm_trace_hardirqs_off
154 .endm 166 .endm
155 167
156 .align 5 168 .align 5
@@ -196,9 +208,8 @@ __dabt_svc:
196 @ 208 @
197 @ restore SPSR and restart the instruction 209 @ restore SPSR and restart the instruction
198 @ 210 @
199 ldr r0, [sp, #S_PSR] 211 ldr r2, [sp, #S_PSR]
200 msr spsr_cxsf, r0 212 svc_exit r2 @ return from exception
201 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
202 UNWIND(.fnend ) 213 UNWIND(.fnend )
203ENDPROC(__dabt_svc) 214ENDPROC(__dabt_svc)
204 215
@@ -206,9 +217,6 @@ ENDPROC(__dabt_svc)
206__irq_svc: 217__irq_svc:
207 svc_entry 218 svc_entry
208 219
209#ifdef CONFIG_TRACE_IRQFLAGS
210 bl trace_hardirqs_off
211#endif
212#ifdef CONFIG_PREEMPT 220#ifdef CONFIG_PREEMPT
213 get_thread_info tsk 221 get_thread_info tsk
214 ldr r8, [tsk, #TI_PREEMPT] @ get preempt count 222 ldr r8, [tsk, #TI_PREEMPT] @ get preempt count
@@ -225,13 +233,12 @@ __irq_svc:
225 tst r0, #_TIF_NEED_RESCHED 233 tst r0, #_TIF_NEED_RESCHED
226 blne svc_preempt 234 blne svc_preempt
227#endif 235#endif
228 ldr r0, [sp, #S_PSR] @ irqs are already disabled 236 ldr r4, [sp, #S_PSR] @ irqs are already disabled
229 msr spsr_cxsf, r0
230#ifdef CONFIG_TRACE_IRQFLAGS 237#ifdef CONFIG_TRACE_IRQFLAGS
231 tst r0, #PSR_I_BIT 238 tst r4, #PSR_I_BIT
232 bleq trace_hardirqs_on 239 bleq trace_hardirqs_on
233#endif 240#endif
234 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr 241 svc_exit r4 @ return from exception
235 UNWIND(.fnend ) 242 UNWIND(.fnend )
236ENDPROC(__irq_svc) 243ENDPROC(__irq_svc)
237 244
@@ -266,7 +273,7 @@ __und_svc:
266 @ r0 - instruction 273 @ r0 - instruction
267 @ 274 @
268 ldr r0, [r2, #-4] 275 ldr r0, [r2, #-4]
269 adr r9, 1f 276 adr r9, BSYM(1f)
270 bl call_fpe 277 bl call_fpe
271 278
272 mov r0, sp @ struct pt_regs *regs 279 mov r0, sp @ struct pt_regs *regs
@@ -280,9 +287,8 @@ __und_svc:
280 @ 287 @
281 @ restore SPSR and restart the instruction 288 @ restore SPSR and restart the instruction
282 @ 289 @
283 ldr lr, [sp, #S_PSR] @ Get SVC cpsr 290 ldr r2, [sp, #S_PSR] @ Get SVC cpsr
284 msr spsr_cxsf, lr 291 svc_exit r2 @ return from exception
285 ldmia sp, {r0 - pc}^ @ Restore SVC registers
286 UNWIND(.fnend ) 292 UNWIND(.fnend )
287ENDPROC(__und_svc) 293ENDPROC(__und_svc)
288 294
@@ -323,9 +329,8 @@ __pabt_svc:
323 @ 329 @
324 @ restore SPSR and restart the instruction 330 @ restore SPSR and restart the instruction
325 @ 331 @
326 ldr r0, [sp, #S_PSR] 332 ldr r2, [sp, #S_PSR]
327 msr spsr_cxsf, r0 333 svc_exit r2 @ return from exception
328 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
329 UNWIND(.fnend ) 334 UNWIND(.fnend )
330ENDPROC(__pabt_svc) 335ENDPROC(__pabt_svc)
331 336
@@ -353,7 +358,8 @@ ENDPROC(__pabt_svc)
353 UNWIND(.fnstart ) 358 UNWIND(.fnstart )
354 UNWIND(.cantunwind ) @ don't unwind the user space 359 UNWIND(.cantunwind ) @ don't unwind the user space
355 sub sp, sp, #S_FRAME_SIZE 360 sub sp, sp, #S_FRAME_SIZE
356 stmib sp, {r1 - r12} 361 ARM( stmib sp, {r1 - r12} )
362 THUMB( stmia sp, {r0 - r12} )
357 363
358 ldmia r0, {r1 - r3} 364 ldmia r0, {r1 - r3}
359 add r0, sp, #S_PC @ here for interlock avoidance 365 add r0, sp, #S_PC @ here for interlock avoidance
@@ -372,7 +378,8 @@ ENDPROC(__pabt_svc)
372 @ Also, separately save sp_usr and lr_usr 378 @ Also, separately save sp_usr and lr_usr
373 @ 379 @
374 stmia r0, {r2 - r4} 380 stmia r0, {r2 - r4}
375 stmdb r0, {sp, lr}^ 381 ARM( stmdb r0, {sp, lr}^ )
382 THUMB( store_user_sp_lr r0, r1, S_SP - S_PC )
376 383
377 @ 384 @
378 @ Enable the alignment trap while in kernel mode 385 @ Enable the alignment trap while in kernel mode
@@ -383,6 +390,8 @@ ENDPROC(__pabt_svc)
383 @ Clear FP to mark the first stack frame 390 @ Clear FP to mark the first stack frame
384 @ 391 @
385 zero_fp 392 zero_fp
393
394 asm_trace_hardirqs_off
386 .endm 395 .endm
387 396
388 .macro kuser_cmpxchg_check 397 .macro kuser_cmpxchg_check
@@ -427,7 +436,7 @@ __dabt_usr:
427 @ 436 @
428 enable_irq 437 enable_irq
429 mov r2, sp 438 mov r2, sp
430 adr lr, ret_from_exception 439 adr lr, BSYM(ret_from_exception)
431 b do_DataAbort 440 b do_DataAbort
432 UNWIND(.fnend ) 441 UNWIND(.fnend )
433ENDPROC(__dabt_usr) 442ENDPROC(__dabt_usr)
@@ -437,9 +446,6 @@ __irq_usr:
437 usr_entry 446 usr_entry
438 kuser_cmpxchg_check 447 kuser_cmpxchg_check
439 448
440#ifdef CONFIG_TRACE_IRQFLAGS
441 bl trace_hardirqs_off
442#endif
443 get_thread_info tsk 449 get_thread_info tsk
444#ifdef CONFIG_PREEMPT 450#ifdef CONFIG_PREEMPT
445 ldr r8, [tsk, #TI_PREEMPT] @ get preempt count 451 ldr r8, [tsk, #TI_PREEMPT] @ get preempt count
@@ -452,7 +458,9 @@ __irq_usr:
452 ldr r0, [tsk, #TI_PREEMPT] 458 ldr r0, [tsk, #TI_PREEMPT]
453 str r8, [tsk, #TI_PREEMPT] 459 str r8, [tsk, #TI_PREEMPT]
454 teq r0, r7 460 teq r0, r7
455 strne r0, [r0, -r0] 461 ARM( strne r0, [r0, -r0] )
462 THUMB( movne r0, #0 )
463 THUMB( strne r0, [r0] )
456#endif 464#endif
457#ifdef CONFIG_TRACE_IRQFLAGS 465#ifdef CONFIG_TRACE_IRQFLAGS
458 bl trace_hardirqs_on 466 bl trace_hardirqs_on
@@ -476,9 +484,10 @@ __und_usr:
476 @ 484 @
477 @ r0 - instruction 485 @ r0 - instruction
478 @ 486 @
479 adr r9, ret_from_exception 487 adr r9, BSYM(ret_from_exception)
480 adr lr, __und_usr_unknown 488 adr lr, BSYM(__und_usr_unknown)
481 tst r3, #PSR_T_BIT @ Thumb mode? 489 tst r3, #PSR_T_BIT @ Thumb mode?
490 itet eq @ explicit IT needed for the 1f label
482 subeq r4, r2, #4 @ ARM instr at LR - 4 491 subeq r4, r2, #4 @ ARM instr at LR - 4
483 subne r4, r2, #2 @ Thumb instr at LR - 2 492 subne r4, r2, #2 @ Thumb instr at LR - 2
4841: ldreqt r0, [r4] 4931: ldreqt r0, [r4]
@@ -488,7 +497,10 @@ __und_usr:
488 beq call_fpe 497 beq call_fpe
489 @ Thumb instruction 498 @ Thumb instruction
490#if __LINUX_ARM_ARCH__ >= 7 499#if __LINUX_ARM_ARCH__ >= 7
4912: ldrht r5, [r4], #2 5002:
501 ARM( ldrht r5, [r4], #2 )
502 THUMB( ldrht r5, [r4] )
503 THUMB( add r4, r4, #2 )
492 and r0, r5, #0xf800 @ mask bits 111x x... .... .... 504 and r0, r5, #0xf800 @ mask bits 111x x... .... ....
493 cmp r0, #0xe800 @ 32bit instruction if xx != 0 505 cmp r0, #0xe800 @ 32bit instruction if xx != 0
494 blo __und_usr_unknown 506 blo __und_usr_unknown
@@ -577,9 +589,11 @@ call_fpe:
577 moveq pc, lr 589 moveq pc, lr
578 get_thread_info r10 @ get current thread 590 get_thread_info r10 @ get current thread
579 and r8, r0, #0x00000f00 @ mask out CP number 591 and r8, r0, #0x00000f00 @ mask out CP number
592 THUMB( lsr r8, r8, #8 )
580 mov r7, #1 593 mov r7, #1
581 add r6, r10, #TI_USED_CP 594 add r6, r10, #TI_USED_CP
582 strb r7, [r6, r8, lsr #8] @ set appropriate used_cp[] 595 ARM( strb r7, [r6, r8, lsr #8] ) @ set appropriate used_cp[]
596 THUMB( strb r7, [r6, r8] ) @ set appropriate used_cp[]
583#ifdef CONFIG_IWMMXT 597#ifdef CONFIG_IWMMXT
584 @ Test if we need to give access to iWMMXt coprocessors 598 @ Test if we need to give access to iWMMXt coprocessors
585 ldr r5, [r10, #TI_FLAGS] 599 ldr r5, [r10, #TI_FLAGS]
@@ -587,36 +601,38 @@ call_fpe:
587 movcss r7, r5, lsr #(TIF_USING_IWMMXT + 1) 601 movcss r7, r5, lsr #(TIF_USING_IWMMXT + 1)
588 bcs iwmmxt_task_enable 602 bcs iwmmxt_task_enable
589#endif 603#endif
590 add pc, pc, r8, lsr #6 604 ARM( add pc, pc, r8, lsr #6 )
591 mov r0, r0 605 THUMB( lsl r8, r8, #2 )
592 606 THUMB( add pc, r8 )
593 mov pc, lr @ CP#0 607 nop
594 b do_fpe @ CP#1 (FPE) 608
595 b do_fpe @ CP#2 (FPE) 609 W(mov) pc, lr @ CP#0
596 mov pc, lr @ CP#3 610 W(b) do_fpe @ CP#1 (FPE)
611 W(b) do_fpe @ CP#2 (FPE)
612 W(mov) pc, lr @ CP#3
597#ifdef CONFIG_CRUNCH 613#ifdef CONFIG_CRUNCH
598 b crunch_task_enable @ CP#4 (MaverickCrunch) 614 b crunch_task_enable @ CP#4 (MaverickCrunch)
599 b crunch_task_enable @ CP#5 (MaverickCrunch) 615 b crunch_task_enable @ CP#5 (MaverickCrunch)
600 b crunch_task_enable @ CP#6 (MaverickCrunch) 616 b crunch_task_enable @ CP#6 (MaverickCrunch)
601#else 617#else
602 mov pc, lr @ CP#4 618 W(mov) pc, lr @ CP#4
603 mov pc, lr @ CP#5 619 W(mov) pc, lr @ CP#5
604 mov pc, lr @ CP#6 620 W(mov) pc, lr @ CP#6
605#endif 621#endif
606 mov pc, lr @ CP#7 622 W(mov) pc, lr @ CP#7
607 mov pc, lr @ CP#8 623 W(mov) pc, lr @ CP#8
608 mov pc, lr @ CP#9 624 W(mov) pc, lr @ CP#9
609#ifdef CONFIG_VFP 625#ifdef CONFIG_VFP
610 b do_vfp @ CP#10 (VFP) 626 W(b) do_vfp @ CP#10 (VFP)
611 b do_vfp @ CP#11 (VFP) 627 W(b) do_vfp @ CP#11 (VFP)
612#else 628#else
613 mov pc, lr @ CP#10 (VFP) 629 W(mov) pc, lr @ CP#10 (VFP)
614 mov pc, lr @ CP#11 (VFP) 630 W(mov) pc, lr @ CP#11 (VFP)
615#endif 631#endif
616 mov pc, lr @ CP#12 632 W(mov) pc, lr @ CP#12
617 mov pc, lr @ CP#13 633 W(mov) pc, lr @ CP#13
618 mov pc, lr @ CP#14 (Debug) 634 W(mov) pc, lr @ CP#14 (Debug)
619 mov pc, lr @ CP#15 (Control) 635 W(mov) pc, lr @ CP#15 (Control)
620 636
621#ifdef CONFIG_NEON 637#ifdef CONFIG_NEON
622 .align 6 638 .align 6
@@ -667,7 +683,7 @@ no_fp: mov pc, lr
667__und_usr_unknown: 683__und_usr_unknown:
668 enable_irq 684 enable_irq
669 mov r0, sp 685 mov r0, sp
670 adr lr, ret_from_exception 686 adr lr, BSYM(ret_from_exception)
671 b do_undefinstr 687 b do_undefinstr
672ENDPROC(__und_usr_unknown) 688ENDPROC(__und_usr_unknown)
673 689
@@ -711,7 +727,10 @@ ENTRY(__switch_to)
711 UNWIND(.cantunwind ) 727 UNWIND(.cantunwind )
712 add ip, r1, #TI_CPU_SAVE 728 add ip, r1, #TI_CPU_SAVE
713 ldr r3, [r2, #TI_TP_VALUE] 729 ldr r3, [r2, #TI_TP_VALUE]
714 stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack 730 ARM( stmia ip!, {r4 - sl, fp, sp, lr} ) @ Store most regs on stack
731 THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack
732 THUMB( str sp, [ip], #4 )
733 THUMB( str lr, [ip], #4 )
715#ifdef CONFIG_MMU 734#ifdef CONFIG_MMU
716 ldr r6, [r2, #TI_CPU_DOMAIN] 735 ldr r6, [r2, #TI_CPU_DOMAIN]
717#endif 736#endif
@@ -736,8 +755,12 @@ ENTRY(__switch_to)
736 ldr r0, =thread_notify_head 755 ldr r0, =thread_notify_head
737 mov r1, #THREAD_NOTIFY_SWITCH 756 mov r1, #THREAD_NOTIFY_SWITCH
738 bl atomic_notifier_call_chain 757 bl atomic_notifier_call_chain
758 THUMB( mov ip, r4 )
739 mov r0, r5 759 mov r0, r5
740 ldmia r4, {r4 - sl, fp, sp, pc} @ Load all regs saved previously 760 ARM( ldmia r4, {r4 - sl, fp, sp, pc} ) @ Load all regs saved previously
761 THUMB( ldmia ip!, {r4 - sl, fp} ) @ Load all regs saved previously
762 THUMB( ldr sp, [ip], #4 )
763 THUMB( ldr pc, [ip] )
741 UNWIND(.fnend ) 764 UNWIND(.fnend )
742ENDPROC(__switch_to) 765ENDPROC(__switch_to)
743 766
@@ -772,6 +795,7 @@ ENDPROC(__switch_to)
772 * if your compiled code is not going to use the new instructions for other 795 * if your compiled code is not going to use the new instructions for other
773 * purpose. 796 * purpose.
774 */ 797 */
798 THUMB( .arm )
775 799
776 .macro usr_ret, reg 800 .macro usr_ret, reg
777#ifdef CONFIG_ARM_THUMB 801#ifdef CONFIG_ARM_THUMB
@@ -1020,6 +1044,7 @@ __kuser_helper_version: @ 0xffff0ffc
1020 .globl __kuser_helper_end 1044 .globl __kuser_helper_end
1021__kuser_helper_end: 1045__kuser_helper_end:
1022 1046
1047 THUMB( .thumb )
1023 1048
1024/* 1049/*
1025 * Vector stubs. 1050 * Vector stubs.
@@ -1054,17 +1079,23 @@ vector_\name:
1054 @ Prepare for SVC32 mode. IRQs remain disabled. 1079 @ Prepare for SVC32 mode. IRQs remain disabled.
1055 @ 1080 @
1056 mrs r0, cpsr 1081 mrs r0, cpsr
1057 eor r0, r0, #(\mode ^ SVC_MODE) 1082 eor r0, r0, #(\mode ^ SVC_MODE | PSR_ISETSTATE)
1058 msr spsr_cxsf, r0 1083 msr spsr_cxsf, r0
1059 1084
1060 @ 1085 @
1061 @ the branch table must immediately follow this code 1086 @ the branch table must immediately follow this code
1062 @ 1087 @
1063 and lr, lr, #0x0f 1088 and lr, lr, #0x0f
1089 THUMB( adr r0, 1f )
1090 THUMB( ldr lr, [r0, lr, lsl #2] )
1064 mov r0, sp 1091 mov r0, sp
1065 ldr lr, [pc, lr, lsl #2] 1092 ARM( ldr lr, [pc, lr, lsl #2] )
1066 movs pc, lr @ branch to handler in SVC mode 1093 movs pc, lr @ branch to handler in SVC mode
1067ENDPROC(vector_\name) 1094ENDPROC(vector_\name)
1095
1096 .align 2
1097 @ handler addresses follow this label
10981:
1068 .endm 1099 .endm
1069 1100
1070 .globl __stubs_start 1101 .globl __stubs_start
@@ -1202,14 +1233,16 @@ __stubs_end:
1202 1233
1203 .globl __vectors_start 1234 .globl __vectors_start
1204__vectors_start: 1235__vectors_start:
1205 swi SYS_ERROR0 1236 ARM( swi SYS_ERROR0 )
1206 b vector_und + stubs_offset 1237 THUMB( svc #0 )
1207 ldr pc, .LCvswi + stubs_offset 1238 THUMB( nop )
1208 b vector_pabt + stubs_offset 1239 W(b) vector_und + stubs_offset
1209 b vector_dabt + stubs_offset 1240 W(ldr) pc, .LCvswi + stubs_offset
1210 b vector_addrexcptn + stubs_offset 1241 W(b) vector_pabt + stubs_offset
1211 b vector_irq + stubs_offset 1242 W(b) vector_dabt + stubs_offset
1212 b vector_fiq + stubs_offset 1243 W(b) vector_addrexcptn + stubs_offset
1244 W(b) vector_irq + stubs_offset
1245 W(b) vector_fiq + stubs_offset
1213 1246
1214 .globl __vectors_end 1247 .globl __vectors_end
1215__vectors_end: 1248__vectors_end:
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index bfa7f0af7ede..3657c5328a5b 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -33,14 +33,7 @@ ret_fast_syscall:
33 /* perform architecture specific actions before user return */ 33 /* perform architecture specific actions before user return */
34 arch_ret_to_user r1, lr 34 arch_ret_to_user r1, lr
35 35
36 @ fast_restore_user_regs 36 restore_user_regs fast = 1, offset = S_OFF
37 ldr r1, [sp, #S_OFF + S_PSR] @ get calling cpsr
38 ldr lr, [sp, #S_OFF + S_PC]! @ get pc
39 msr spsr_cxsf, r1 @ save in spsr_svc
40 ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
41 mov r0, r0
42 add sp, sp, #S_FRAME_SIZE - S_PC
43 movs pc, lr @ return & move spsr_svc into cpsr
44 UNWIND(.fnend ) 37 UNWIND(.fnend )
45 38
46/* 39/*
@@ -73,14 +66,7 @@ no_work_pending:
73 /* perform architecture specific actions before user return */ 66 /* perform architecture specific actions before user return */
74 arch_ret_to_user r1, lr 67 arch_ret_to_user r1, lr
75 68
76 @ slow_restore_user_regs 69 restore_user_regs fast = 0, offset = 0
77 ldr r1, [sp, #S_PSR] @ get calling cpsr
78 ldr lr, [sp, #S_PC]! @ get pc
79 msr spsr_cxsf, r1 @ save in spsr_svc
80 ldmdb sp, {r0 - lr}^ @ get calling r0 - lr
81 mov r0, r0
82 add sp, sp, #S_FRAME_SIZE - S_PC
83 movs pc, lr @ return & move spsr_svc into cpsr
84ENDPROC(ret_to_user) 70ENDPROC(ret_to_user)
85 71
86/* 72/*
@@ -132,6 +118,25 @@ ftrace_call:
132 118
133#else 119#else
134 120
121ENTRY(__gnu_mcount_nc)
122 stmdb sp!, {r0-r3, lr}
123 ldr r0, =ftrace_trace_function
124 ldr r2, [r0]
125 adr r0, ftrace_stub
126 cmp r0, r2
127 bne gnu_trace
128 ldmia sp!, {r0-r3, ip, lr}
129 bx ip
130
131gnu_trace:
132 ldr r1, [sp, #20] @ lr of instrumented routine
133 mov r0, lr
134 sub r0, r0, #MCOUNT_INSN_SIZE
135 mov lr, pc
136 mov pc, r2
137 ldmia sp!, {r0-r3, ip, lr}
138 bx ip
139
135ENTRY(mcount) 140ENTRY(mcount)
136 stmdb sp!, {r0-r3, lr} 141 stmdb sp!, {r0-r3, lr}
137 ldr r0, =ftrace_trace_function 142 ldr r0, =ftrace_trace_function
@@ -182,8 +187,10 @@ ftrace_stub:
182ENTRY(vector_swi) 187ENTRY(vector_swi)
183 sub sp, sp, #S_FRAME_SIZE 188 sub sp, sp, #S_FRAME_SIZE
184 stmia sp, {r0 - r12} @ Calling r0 - r12 189 stmia sp, {r0 - r12} @ Calling r0 - r12
185 add r8, sp, #S_PC 190 ARM( add r8, sp, #S_PC )
186 stmdb r8, {sp, lr}^ @ Calling sp, lr 191 ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr
192 THUMB( mov r8, sp )
193 THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr
187 mrs r8, spsr @ called from non-FIQ mode, so ok. 194 mrs r8, spsr @ called from non-FIQ mode, so ok.
188 str lr, [sp, #S_PC] @ Save calling PC 195 str lr, [sp, #S_PC] @ Save calling PC
189 str r8, [sp, #S_PSR] @ Save CPSR 196 str r8, [sp, #S_PSR] @ Save CPSR
@@ -272,7 +279,7 @@ ENTRY(vector_swi)
272 bne __sys_trace 279 bne __sys_trace
273 280
274 cmp scno, #NR_syscalls @ check upper syscall limit 281 cmp scno, #NR_syscalls @ check upper syscall limit
275 adr lr, ret_fast_syscall @ return address 282 adr lr, BSYM(ret_fast_syscall) @ return address
276 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine 283 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
277 284
278 add r1, sp, #S_OFF 285 add r1, sp, #S_OFF
@@ -293,7 +300,7 @@ __sys_trace:
293 mov r0, #0 @ trace entry [IP = 0] 300 mov r0, #0 @ trace entry [IP = 0]
294 bl syscall_trace 301 bl syscall_trace
295 302
296 adr lr, __sys_trace_return @ return address 303 adr lr, BSYM(__sys_trace_return) @ return address
297 mov scno, r0 @ syscall number (possibly new) 304 mov scno, r0 @ syscall number (possibly new)
298 add r1, sp, #S_R0 + S_OFF @ pointer to regs 305 add r1, sp, #S_R0 + S_OFF @ pointer to regs
299 cmp scno, #NR_syscalls @ check upper syscall limit 306 cmp scno, #NR_syscalls @ check upper syscall limit
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 87ab4e157997..a4eaf4f920c5 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -36,11 +36,6 @@
36#endif 36#endif
37 .endm 37 .endm
38 38
39 .macro get_thread_info, rd
40 mov \rd, sp, lsr #13
41 mov \rd, \rd, lsl #13
42 .endm
43
44 .macro alignment_trap, rtemp 39 .macro alignment_trap, rtemp
45#ifdef CONFIG_ALIGNMENT_TRAP 40#ifdef CONFIG_ALIGNMENT_TRAP
46 ldr \rtemp, .LCcralign 41 ldr \rtemp, .LCcralign
@@ -49,6 +44,93 @@
49#endif 44#endif
50 .endm 45 .endm
51 46
47 @
48 @ Store/load the USER SP and LR registers by switching to the SYS
49 @ mode. Useful in Thumb-2 mode where "stm/ldm rd, {sp, lr}^" is not
50 @ available. Should only be called from SVC mode
51 @
52 .macro store_user_sp_lr, rd, rtemp, offset = 0
53 mrs \rtemp, cpsr
54 eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
55 msr cpsr_c, \rtemp @ switch to the SYS mode
56
57 str sp, [\rd, #\offset] @ save sp_usr
58 str lr, [\rd, #\offset + 4] @ save lr_usr
59
60 eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
61 msr cpsr_c, \rtemp @ switch back to the SVC mode
62 .endm
63
64 .macro load_user_sp_lr, rd, rtemp, offset = 0
65 mrs \rtemp, cpsr
66 eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
67 msr cpsr_c, \rtemp @ switch to the SYS mode
68
69 ldr sp, [\rd, #\offset] @ load sp_usr
70 ldr lr, [\rd, #\offset + 4] @ load lr_usr
71
72 eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
73 msr cpsr_c, \rtemp @ switch back to the SVC mode
74 .endm
75
76#ifndef CONFIG_THUMB2_KERNEL
77 .macro svc_exit, rpsr
78 msr spsr_cxsf, \rpsr
79 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
80 .endm
81
82 .macro restore_user_regs, fast = 0, offset = 0
83 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
84 ldr lr, [sp, #\offset + S_PC]! @ get pc
85 msr spsr_cxsf, r1 @ save in spsr_svc
86 .if \fast
87 ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
88 .else
89 ldmdb sp, {r0 - lr}^ @ get calling r0 - lr
90 .endif
91 add sp, sp, #S_FRAME_SIZE - S_PC
92 movs pc, lr @ return & move spsr_svc into cpsr
93 .endm
94
95 .macro get_thread_info, rd
96 mov \rd, sp, lsr #13
97 mov \rd, \rd, lsl #13
98 .endm
99#else /* CONFIG_THUMB2_KERNEL */
100 .macro svc_exit, rpsr
101 ldr r0, [sp, #S_SP] @ top of the stack
102 ldr r1, [sp, #S_PC] @ return address
103 tst r0, #4 @ orig stack 8-byte aligned?
104 stmdb r0, {r1, \rpsr} @ rfe context
105 ldmia sp, {r0 - r12}
106 ldr lr, [sp, #S_LR]
107 addeq sp, sp, #S_FRAME_SIZE - 8 @ aligned
108 addne sp, sp, #S_FRAME_SIZE - 4 @ not aligned
109 rfeia sp!
110 .endm
111
112 .macro restore_user_regs, fast = 0, offset = 0
113 mov r2, sp
114 load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr
115 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
116 ldr lr, [sp, #\offset + S_PC] @ get pc
117 add sp, sp, #\offset + S_SP
118 msr spsr_cxsf, r1 @ save in spsr_svc
119 .if \fast
120 ldmdb sp, {r1 - r12} @ get calling r1 - r12
121 .else
122 ldmdb sp, {r0 - r12} @ get calling r0 - r12
123 .endif
124 add sp, sp, #S_FRAME_SIZE - S_SP
125 movs pc, lr @ return & move spsr_svc into cpsr
126 .endm
127
128 .macro get_thread_info, rd
129 mov \rd, sp
130 lsr \rd, \rd, #13
131 mov \rd, \rd, lsl #13
132 .endm
133#endif /* !CONFIG_THUMB2_KERNEL */
52 134
53/* 135/*
54 * These are the registers used in the syscall handler, and allow us to 136 * These are the registers used in the syscall handler, and allow us to
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 991952c644d1..93ad576b2d74 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -14,6 +14,7 @@
14#define ATAG_CORE 0x54410001 14#define ATAG_CORE 0x54410001
15#define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2) 15#define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2)
16 16
17 .align 2
17 .type __switch_data, %object 18 .type __switch_data, %object
18__switch_data: 19__switch_data:
19 .long __mmap_switched 20 .long __mmap_switched
@@ -51,7 +52,9 @@ __mmap_switched:
51 strcc fp, [r6],#4 52 strcc fp, [r6],#4
52 bcc 1b 53 bcc 1b
53 54
54 ldmia r3, {r4, r5, r6, r7, sp} 55 ARM( ldmia r3, {r4, r5, r6, r7, sp})
56 THUMB( ldmia r3, {r4, r5, r6, r7} )
57 THUMB( ldr sp, [r3, #16] )
55 str r9, [r4] @ Save processor ID 58 str r9, [r4] @ Save processor ID
56 str r1, [r5] @ Save machine type 59 str r1, [r5] @ Save machine type
57 str r2, [r6] @ Save atags pointer 60 str r2, [r6] @ Save atags pointer
@@ -155,7 +158,8 @@ ENDPROC(__error)
155 */ 158 */
156__lookup_processor_type: 159__lookup_processor_type:
157 adr r3, 3f 160 adr r3, 3f
158 ldmda r3, {r5 - r7} 161 ldmia r3, {r5 - r7}
162 add r3, r3, #8
159 sub r3, r3, r7 @ get offset between virt&phys 163 sub r3, r3, r7 @ get offset between virt&phys
160 add r5, r5, r3 @ convert virt addresses to 164 add r5, r5, r3 @ convert virt addresses to
161 add r6, r6, r3 @ physical address space 165 add r6, r6, r3 @ physical address space
@@ -185,9 +189,10 @@ ENDPROC(lookup_processor_type)
185 * Look in <asm/procinfo.h> and arch/arm/kernel/arch.[ch] for 189 * Look in <asm/procinfo.h> and arch/arm/kernel/arch.[ch] for
186 * more information about the __proc_info and __arch_info structures. 190 * more information about the __proc_info and __arch_info structures.
187 */ 191 */
188 .long __proc_info_begin 192 .align 2
1933: .long __proc_info_begin
189 .long __proc_info_end 194 .long __proc_info_end
1903: .long . 1954: .long .
191 .long __arch_info_begin 196 .long __arch_info_begin
192 .long __arch_info_end 197 .long __arch_info_end
193 198
@@ -203,7 +208,7 @@ ENDPROC(lookup_processor_type)
203 * r5 = mach_info pointer in physical address space 208 * r5 = mach_info pointer in physical address space
204 */ 209 */
205__lookup_machine_type: 210__lookup_machine_type:
206 adr r3, 3b 211 adr r3, 4b
207 ldmia r3, {r4, r5, r6} 212 ldmia r3, {r4, r5, r6}
208 sub r3, r3, r4 @ get offset between virt&phys 213 sub r3, r3, r4 @ get offset between virt&phys
209 add r5, r5, r3 @ convert virt addresses to 214 add r5, r5, r3 @ convert virt addresses to
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index cc87e1765ed2..e5dfc2895e24 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -34,7 +34,7 @@
34 */ 34 */
35 .section ".text.head", "ax" 35 .section ".text.head", "ax"
36ENTRY(stext) 36ENTRY(stext)
37 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode 37 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
38 @ and irqs disabled 38 @ and irqs disabled
39#ifndef CONFIG_CPU_CP15 39#ifndef CONFIG_CPU_CP15
40 ldr r9, =CONFIG_PROCESSOR_ID 40 ldr r9, =CONFIG_PROCESSOR_ID
@@ -50,8 +50,10 @@ ENTRY(stext)
50 50
51 ldr r13, __switch_data @ address to jump to after 51 ldr r13, __switch_data @ address to jump to after
52 @ the initialization is done 52 @ the initialization is done
53 adr lr, __after_proc_init @ return (PIC) address 53 adr lr, BSYM(__after_proc_init) @ return (PIC) address
54 add pc, r10, #PROCINFO_INITFUNC 54 ARM( add pc, r10, #PROCINFO_INITFUNC )
55 THUMB( add r12, r10, #PROCINFO_INITFUNC )
56 THUMB( mov pc, r12 )
55ENDPROC(stext) 57ENDPROC(stext)
56 58
57/* 59/*
@@ -59,7 +61,10 @@ ENDPROC(stext)
59 */ 61 */
60__after_proc_init: 62__after_proc_init:
61#ifdef CONFIG_CPU_CP15 63#ifdef CONFIG_CPU_CP15
62 mrc p15, 0, r0, c1, c0, 0 @ read control reg 64 /*
65 * CP15 system control register value returned in r0 from
66 * the CPU init function.
67 */
63#ifdef CONFIG_ALIGNMENT_TRAP 68#ifdef CONFIG_ALIGNMENT_TRAP
64 orr r0, r0, #CR_A 69 orr r0, r0, #CR_A
65#else 70#else
@@ -82,7 +87,8 @@ __after_proc_init:
82 mcr p15, 0, r0, c1, c0, 0 @ write control reg 87 mcr p15, 0, r0, c1, c0, 0 @ write control reg
83#endif /* CONFIG_CPU_CP15 */ 88#endif /* CONFIG_CPU_CP15 */
84 89
85 mov pc, r13 @ clear the BSS and jump 90 mov r3, r13
91 mov pc, r3 @ clear the BSS and jump
86 @ to start_kernel 92 @ to start_kernel
87ENDPROC(__after_proc_init) 93ENDPROC(__after_proc_init)
88 .ltorg 94 .ltorg
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 21e17dc94cb5..38ccbe1d3b2c 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -76,7 +76,7 @@
76 */ 76 */
77 .section ".text.head", "ax" 77 .section ".text.head", "ax"
78ENTRY(stext) 78ENTRY(stext)
79 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode 79 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
80 @ and irqs disabled 80 @ and irqs disabled
81 mrc p15, 0, r9, c0, c0 @ get processor id 81 mrc p15, 0, r9, c0, c0 @ get processor id
82 bl __lookup_processor_type @ r5=procinfo r9=cpuid 82 bl __lookup_processor_type @ r5=procinfo r9=cpuid
@@ -97,8 +97,10 @@ ENTRY(stext)
97 */ 97 */
98 ldr r13, __switch_data @ address to jump to after 98 ldr r13, __switch_data @ address to jump to after
99 @ mmu has been enabled 99 @ mmu has been enabled
100 adr lr, __enable_mmu @ return (PIC) address 100 adr lr, BSYM(__enable_mmu) @ return (PIC) address
101 add pc, r10, #PROCINFO_INITFUNC 101 ARM( add pc, r10, #PROCINFO_INITFUNC )
102 THUMB( add r12, r10, #PROCINFO_INITFUNC )
103 THUMB( mov pc, r12 )
102ENDPROC(stext) 104ENDPROC(stext)
103 105
104#if defined(CONFIG_SMP) 106#if defined(CONFIG_SMP)
@@ -110,7 +112,7 @@ ENTRY(secondary_startup)
110 * the processor type - there is no need to check the machine type 112 * the processor type - there is no need to check the machine type
111 * as it has already been validated by the primary processor. 113 * as it has already been validated by the primary processor.
112 */ 114 */
113 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE 115 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9
114 mrc p15, 0, r9, c0, c0 @ get processor id 116 mrc p15, 0, r9, c0, c0 @ get processor id
115 bl __lookup_processor_type 117 bl __lookup_processor_type
116 movs r10, r5 @ invalid processor? 118 movs r10, r5 @ invalid processor?
@@ -121,12 +123,15 @@ ENTRY(secondary_startup)
121 * Use the page tables supplied from __cpu_up. 123 * Use the page tables supplied from __cpu_up.
122 */ 124 */
123 adr r4, __secondary_data 125 adr r4, __secondary_data
124 ldmia r4, {r5, r7, r13} @ address to jump to after 126 ldmia r4, {r5, r7, r12} @ address to jump to after
125 sub r4, r4, r5 @ mmu has been enabled 127 sub r4, r4, r5 @ mmu has been enabled
126 ldr r4, [r7, r4] @ get secondary_data.pgdir 128 ldr r4, [r7, r4] @ get secondary_data.pgdir
127 adr lr, __enable_mmu @ return address 129 adr lr, BSYM(__enable_mmu) @ return address
128 add pc, r10, #PROCINFO_INITFUNC @ initialise processor 130 mov r13, r12 @ __secondary_switched address
129 @ (return control reg) 131 ARM( add pc, r10, #PROCINFO_INITFUNC ) @ initialise processor
132 @ (return control reg)
133 THUMB( add r12, r10, #PROCINFO_INITFUNC )
134 THUMB( mov pc, r12 )
130ENDPROC(secondary_startup) 135ENDPROC(secondary_startup)
131 136
132 /* 137 /*
@@ -193,8 +198,8 @@ __turn_mmu_on:
193 mcr p15, 0, r0, c1, c0, 0 @ write control reg 198 mcr p15, 0, r0, c1, c0, 0 @ write control reg
194 mrc p15, 0, r3, c0, c0, 0 @ read id reg 199 mrc p15, 0, r3, c0, c0, 0 @ read id reg
195 mov r3, r3 200 mov r3, r3
196 mov r3, r3 201 mov r3, r13
197 mov pc, r13 202 mov pc, r3
198ENDPROC(__turn_mmu_on) 203ENDPROC(__turn_mmu_on)
199 204
200 205
@@ -235,7 +240,8 @@ __create_page_tables:
235 * will be removed by paging_init(). We use our current program 240 * will be removed by paging_init(). We use our current program
236 * counter to determine corresponding section base address. 241 * counter to determine corresponding section base address.
237 */ 242 */
238 mov r6, pc, lsr #20 @ start of kernel section 243 mov r6, pc
244 mov r6, r6, lsr #20 @ start of kernel section
239 orr r3, r7, r6, lsl #20 @ flags + kernel base 245 orr r3, r7, r6, lsl #20 @ flags + kernel base
240 str r3, [r4, r6, lsl #2] @ identity mapping 246 str r3, [r4, r6, lsl #2] @ identity mapping
241 247
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index b7c3490eaa24..c9a8619f3856 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -86,7 +86,7 @@ int show_interrupts(struct seq_file *p, void *v)
86unlock: 86unlock:
87 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 87 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
88 } else if (i == NR_IRQS) { 88 } else if (i == NR_IRQS) {
89#ifdef CONFIG_ARCH_ACORN 89#ifdef CONFIG_FIQ
90 show_fiq_list(p, v); 90 show_fiq_list(p, v);
91#endif 91#endif
92#ifdef CONFIG_SMP 92#ifdef CONFIG_SMP
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index bac03c81489d..f28c5e9c51ea 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -102,6 +102,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
102 unsigned long loc; 102 unsigned long loc;
103 Elf32_Sym *sym; 103 Elf32_Sym *sym;
104 s32 offset; 104 s32 offset;
105 u32 upper, lower, sign, j1, j2;
105 106
106 offset = ELF32_R_SYM(rel->r_info); 107 offset = ELF32_R_SYM(rel->r_info);
107 if (offset < 0 || offset > (symsec->sh_size / sizeof(Elf32_Sym))) { 108 if (offset < 0 || offset > (symsec->sh_size / sizeof(Elf32_Sym))) {
@@ -184,6 +185,58 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
184 (offset & 0x0fff); 185 (offset & 0x0fff);
185 break; 186 break;
186 187
188 case R_ARM_THM_CALL:
189 case R_ARM_THM_JUMP24:
190 upper = *(u16 *)loc;
191 lower = *(u16 *)(loc + 2);
192
193 /*
194 * 25 bit signed address range (Thumb-2 BL and B.W
195 * instructions):
196 * S:I1:I2:imm10:imm11:0
197 * where:
198 * S = upper[10] = offset[24]
199 * I1 = ~(J1 ^ S) = offset[23]
200 * I2 = ~(J2 ^ S) = offset[22]
201 * imm10 = upper[9:0] = offset[21:12]
202 * imm11 = lower[10:0] = offset[11:1]
203 * J1 = lower[13]
204 * J2 = lower[11]
205 */
206 sign = (upper >> 10) & 1;
207 j1 = (lower >> 13) & 1;
208 j2 = (lower >> 11) & 1;
209 offset = (sign << 24) | ((~(j1 ^ sign) & 1) << 23) |
210 ((~(j2 ^ sign) & 1) << 22) |
211 ((upper & 0x03ff) << 12) |
212 ((lower & 0x07ff) << 1);
213 if (offset & 0x01000000)
214 offset -= 0x02000000;
215 offset += sym->st_value - loc;
216
217 /* only Thumb addresses allowed (no interworking) */
218 if (!(offset & 1) ||
219 offset <= (s32)0xff000000 ||
220 offset >= (s32)0x01000000) {
221 printk(KERN_ERR
222 "%s: relocation out of range, section "
223 "%d reloc %d sym '%s'\n", module->name,
224 relindex, i, strtab + sym->st_name);
225 return -ENOEXEC;
226 }
227
228 sign = (offset >> 24) & 1;
229 j1 = sign ^ (~(offset >> 23) & 1);
230 j2 = sign ^ (~(offset >> 22) & 1);
231 *(u16 *)loc = (u16)((upper & 0xf800) | (sign << 10) |
232 ((offset >> 12) & 0x03ff));
233 *(u16 *)(loc + 2) = (u16)((lower & 0xd000) |
234 (j1 << 13) | (j2 << 11) |
235 ((offset >> 1) & 0x07ff));
236 upper = *(u16 *)loc;
237 lower = *(u16 *)(loc + 2);
238 break;
239
187 default: 240 default:
188 printk(KERN_ERR "%s: unknown relocation: %u\n", 241 printk(KERN_ERR "%s: unknown relocation: %u\n",
189 module->name, ELF32_R_TYPE(rel->r_info)); 242 module->name, ELF32_R_TYPE(rel->r_info));
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 39196dff478c..790fbee92ec5 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -388,7 +388,7 @@ pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
388 regs.ARM_r2 = (unsigned long)fn; 388 regs.ARM_r2 = (unsigned long)fn;
389 regs.ARM_r3 = (unsigned long)kernel_thread_exit; 389 regs.ARM_r3 = (unsigned long)kernel_thread_exit;
390 regs.ARM_pc = (unsigned long)kernel_thread_helper; 390 regs.ARM_pc = (unsigned long)kernel_thread_helper;
391 regs.ARM_cpsr = SVC_MODE | PSR_ENDSTATE; 391 regs.ARM_cpsr = SVC_MODE | PSR_ENDSTATE | PSR_ISETSTATE;
392 392
393 return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 393 return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
394} 394}
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 89882a1d0187..a2ea3854cb3c 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -521,7 +521,13 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
521 return -EIO; 521 return -EIO;
522 522
523 tmp = 0; 523 tmp = 0;
524 if (off < sizeof(struct pt_regs)) 524 if (off == PT_TEXT_ADDR)
525 tmp = tsk->mm->start_code;
526 else if (off == PT_DATA_ADDR)
527 tmp = tsk->mm->start_data;
528 else if (off == PT_TEXT_END_ADDR)
529 tmp = tsk->mm->end_code;
530 else if (off < sizeof(struct pt_regs))
525 tmp = get_user_reg(tsk, off >> 2); 531 tmp = get_user_reg(tsk, off >> 2);
526 532
527 return put_user(tmp, ret); 533 return put_user(tmp, ret);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index bc5e4128f9f3..d4d4f77c91b2 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -25,6 +25,7 @@
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27 27
28#include <asm/unified.h>
28#include <asm/cpu.h> 29#include <asm/cpu.h>
29#include <asm/cputype.h> 30#include <asm/cputype.h>
30#include <asm/elf.h> 31#include <asm/elf.h>
@@ -327,25 +328,38 @@ void cpu_init(void)
327 } 328 }
328 329
329 /* 330 /*
331 * Define the placement constraint for the inline asm directive below.
332 * In Thumb-2, msr with an immediate value is not allowed.
333 */
334#ifdef CONFIG_THUMB2_KERNEL
335#define PLC "r"
336#else
337#define PLC "I"
338#endif
339
340 /*
330 * setup stacks for re-entrant exception handlers 341 * setup stacks for re-entrant exception handlers
331 */ 342 */
332 __asm__ ( 343 __asm__ (
333 "msr cpsr_c, %1\n\t" 344 "msr cpsr_c, %1\n\t"
334 "add sp, %0, %2\n\t" 345 "add r14, %0, %2\n\t"
346 "mov sp, r14\n\t"
335 "msr cpsr_c, %3\n\t" 347 "msr cpsr_c, %3\n\t"
336 "add sp, %0, %4\n\t" 348 "add r14, %0, %4\n\t"
349 "mov sp, r14\n\t"
337 "msr cpsr_c, %5\n\t" 350 "msr cpsr_c, %5\n\t"
338 "add sp, %0, %6\n\t" 351 "add r14, %0, %6\n\t"
352 "mov sp, r14\n\t"
339 "msr cpsr_c, %7" 353 "msr cpsr_c, %7"
340 : 354 :
341 : "r" (stk), 355 : "r" (stk),
342 "I" (PSR_F_BIT | PSR_I_BIT | IRQ_MODE), 356 PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
343 "I" (offsetof(struct stack, irq[0])), 357 "I" (offsetof(struct stack, irq[0])),
344 "I" (PSR_F_BIT | PSR_I_BIT | ABT_MODE), 358 PLC (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
345 "I" (offsetof(struct stack, abt[0])), 359 "I" (offsetof(struct stack, abt[0])),
346 "I" (PSR_F_BIT | PSR_I_BIT | UND_MODE), 360 PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE),
347 "I" (offsetof(struct stack, und[0])), 361 "I" (offsetof(struct stack, und[0])),
348 "I" (PSR_F_BIT | PSR_I_BIT | SVC_MODE) 362 PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
349 : "r14"); 363 : "r14");
350} 364}
351 365
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index dd56e11f339a..39baf1128bfa 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -62,7 +62,11 @@ struct unwind_ctrl_block {
62}; 62};
63 63
64enum regs { 64enum regs {
65#ifdef CONFIG_THUMB2_KERNEL
66 FP = 7,
67#else
65 FP = 11, 68 FP = 11,
69#endif
66 SP = 13, 70 SP = 13,
67 LR = 14, 71 LR = 14,
68 PC = 15 72 PC = 15
diff --git a/arch/arm/lib/ashldi3.S b/arch/arm/lib/ashldi3.S
index 1154d924080b..638deb13da1c 100644
--- a/arch/arm/lib/ashldi3.S
+++ b/arch/arm/lib/ashldi3.S
@@ -43,7 +43,9 @@ ENTRY(__aeabi_llsl)
43 rsb ip, r2, #32 43 rsb ip, r2, #32
44 movmi ah, ah, lsl r2 44 movmi ah, ah, lsl r2
45 movpl ah, al, lsl r3 45 movpl ah, al, lsl r3
46 orrmi ah, ah, al, lsr ip 46 ARM( orrmi ah, ah, al, lsr ip )
47 THUMB( lsrmi r3, al, ip )
48 THUMB( orrmi ah, ah, r3 )
47 mov al, al, lsl r2 49 mov al, al, lsl r2
48 mov pc, lr 50 mov pc, lr
49 51
diff --git a/arch/arm/lib/ashrdi3.S b/arch/arm/lib/ashrdi3.S
index 9f8b35572f8c..015e8aa5a1d1 100644
--- a/arch/arm/lib/ashrdi3.S
+++ b/arch/arm/lib/ashrdi3.S
@@ -43,7 +43,9 @@ ENTRY(__aeabi_lasr)
43 rsb ip, r2, #32 43 rsb ip, r2, #32
44 movmi al, al, lsr r2 44 movmi al, al, lsr r2
45 movpl al, ah, asr r3 45 movpl al, ah, asr r3
46 orrmi al, al, ah, lsl ip 46 ARM( orrmi al, al, ah, lsl ip )
47 THUMB( lslmi r3, ah, ip )
48 THUMB( orrmi al, al, r3 )
47 mov ah, ah, asr r2 49 mov ah, ah, asr r2
48 mov pc, lr 50 mov pc, lr
49 51
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S
index b0951d0e8b2c..aaf7220d9e30 100644
--- a/arch/arm/lib/backtrace.S
+++ b/arch/arm/lib/backtrace.S
@@ -38,7 +38,9 @@ ENDPROC(c_backtrace)
38 beq no_frame @ we have no stack frames 38 beq no_frame @ we have no stack frames
39 39
40 tst r1, #0x10 @ 26 or 32-bit mode? 40 tst r1, #0x10 @ 26 or 32-bit mode?
41 moveq mask, #0xfc000003 @ mask for 26-bit 41 ARM( moveq mask, #0xfc000003 )
42 THUMB( moveq mask, #0xfc000000 )
43 THUMB( orreq mask, #0x03 )
42 movne mask, #0 @ mask for 32-bit 44 movne mask, #0 @ mask for 32-bit
43 45
441: stmfd sp!, {pc} @ calculate offset of PC stored 461: stmfd sp!, {pc} @ calculate offset of PC stored
@@ -126,7 +128,9 @@ ENDPROC(c_backtrace)
126 mov reg, #10 128 mov reg, #10
127 mov r7, #0 129 mov r7, #0
1281: mov r3, #1 1301: mov r3, #1
129 tst instr, r3, lsl reg 131 ARM( tst instr, r3, lsl reg )
132 THUMB( lsl r3, reg )
133 THUMB( tst instr, r3 )
130 beq 2f 134 beq 2f
131 add r7, r7, #1 135 add r7, r7, #1
132 teq r7, #6 136 teq r7, #6
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index c7f2627385e7..d42252918bfb 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -60,8 +60,8 @@
60 tst r2, r0, lsl r3 60 tst r2, r0, lsl r3
61 \instr r2, r2, r0, lsl r3 61 \instr r2, r2, r0, lsl r3
62 \store r2, [r1] 62 \store r2, [r1]
63 restore_irqs ip
64 moveq r0, #0 63 moveq r0, #0
64 restore_irqs ip
65 mov pc, lr 65 mov pc, lr
66 .endm 66 .endm
67#endif 67#endif
diff --git a/arch/arm/lib/clear_user.S b/arch/arm/lib/clear_user.S
index 844f56785ebc..1279abd8b886 100644
--- a/arch/arm/lib/clear_user.S
+++ b/arch/arm/lib/clear_user.S
@@ -27,21 +27,20 @@ WEAK(__clear_user)
27 ands ip, r0, #3 27 ands ip, r0, #3
28 beq 1f 28 beq 1f
29 cmp ip, #2 29 cmp ip, #2
30USER( strbt r2, [r0], #1) 30 strusr r2, r0, 1
31USER( strlebt r2, [r0], #1) 31 strusr r2, r0, 1, le
32USER( strltbt r2, [r0], #1) 32 strusr r2, r0, 1, lt
33 rsb ip, ip, #4 33 rsb ip, ip, #4
34 sub r1, r1, ip @ 7 6 5 4 3 2 1 34 sub r1, r1, ip @ 7 6 5 4 3 2 1
351: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7 351: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
36USER( strplt r2, [r0], #4) 36 strusr r2, r0, 4, pl, rept=2
37USER( strplt r2, [r0], #4)
38 bpl 1b 37 bpl 1b
39 adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3 38 adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
40USER( strplt r2, [r0], #4) 39 strusr r2, r0, 4, pl
412: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x 402: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
42USER( strnebt r2, [r0], #1) 41 strusr r2, r0, 1, ne, rept=2
43USER( strnebt r2, [r0], #1)
44 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1 42 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
43 it ne @ explicit IT needed for the label
45USER( strnebt r2, [r0]) 44USER( strnebt r2, [r0])
46 mov r0, #0 45 mov r0, #0
47 ldmfd sp!, {r1, pc} 46 ldmfd sp!, {r1, pc}
diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S
index 56799a165cc4..e4fe124acedc 100644
--- a/arch/arm/lib/copy_from_user.S
+++ b/arch/arm/lib/copy_from_user.S
@@ -33,11 +33,15 @@
33 * Number of bytes NOT copied. 33 * Number of bytes NOT copied.
34 */ 34 */
35 35
36#ifndef CONFIG_THUMB2_KERNEL
37#define LDR1W_SHIFT 0
38#else
39#define LDR1W_SHIFT 1
40#endif
41#define STR1W_SHIFT 0
42
36 .macro ldr1w ptr reg abort 43 .macro ldr1w ptr reg abort
37100: ldrt \reg, [\ptr], #4 44 ldrusr \reg, \ptr, 4, abort=\abort
38 .section __ex_table, "a"
39 .long 100b, \abort
40 .previous
41 .endm 45 .endm
42 46
43 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort 47 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
@@ -53,14 +57,11 @@
53 .endm 57 .endm
54 58
55 .macro ldr1b ptr reg cond=al abort 59 .macro ldr1b ptr reg cond=al abort
56100: ldr\cond\()bt \reg, [\ptr], #1 60 ldrusr \reg, \ptr, 1, \cond, abort=\abort
57 .section __ex_table, "a"
58 .long 100b, \abort
59 .previous
60 .endm 61 .endm
61 62
62 .macro str1w ptr reg abort 63 .macro str1w ptr reg abort
63 str \reg, [\ptr], #4 64 W(str) \reg, [\ptr], #4
64 .endm 65 .endm
65 66
66 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort 67 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 139cce646055..805e3f8fb007 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -57,6 +57,13 @@
57 * 57 *
58 * Restore registers with the values previously saved with the 58 * Restore registers with the values previously saved with the
59 * 'preserv' macro. Called upon code termination. 59 * 'preserv' macro. Called upon code termination.
60 *
61 * LDR1W_SHIFT
62 * STR1W_SHIFT
63 *
64 * Correction to be applied to the "ip" register when branching into
65 * the ldr1w or str1w instructions (some of these macros may expand to
66 * than one 32bit instruction in Thumb-2)
60 */ 67 */
61 68
62 69
@@ -99,9 +106,15 @@
99 106
1005: ands ip, r2, #28 1075: ands ip, r2, #28
101 rsb ip, ip, #32 108 rsb ip, ip, #32
109#if LDR1W_SHIFT > 0
110 lsl ip, ip, #LDR1W_SHIFT
111#endif
102 addne pc, pc, ip @ C is always clear here 112 addne pc, pc, ip @ C is always clear here
103 b 7f 113 b 7f
1046: nop 1146:
115 .rept (1 << LDR1W_SHIFT)
116 W(nop)
117 .endr
105 ldr1w r1, r3, abort=20f 118 ldr1w r1, r3, abort=20f
106 ldr1w r1, r4, abort=20f 119 ldr1w r1, r4, abort=20f
107 ldr1w r1, r5, abort=20f 120 ldr1w r1, r5, abort=20f
@@ -110,9 +123,16 @@
110 ldr1w r1, r8, abort=20f 123 ldr1w r1, r8, abort=20f
111 ldr1w r1, lr, abort=20f 124 ldr1w r1, lr, abort=20f
112 125
126#if LDR1W_SHIFT < STR1W_SHIFT
127 lsl ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
128#elif LDR1W_SHIFT > STR1W_SHIFT
129 lsr ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
130#endif
113 add pc, pc, ip 131 add pc, pc, ip
114 nop 132 nop
115 nop 133 .rept (1 << STR1W_SHIFT)
134 W(nop)
135 .endr
116 str1w r0, r3, abort=20f 136 str1w r0, r3, abort=20f
117 str1w r0, r4, abort=20f 137 str1w r0, r4, abort=20f
118 str1w r0, r5, abort=20f 138 str1w r0, r5, abort=20f
diff --git a/arch/arm/lib/copy_to_user.S b/arch/arm/lib/copy_to_user.S
index 878820f0a320..1a71e1584442 100644
--- a/arch/arm/lib/copy_to_user.S
+++ b/arch/arm/lib/copy_to_user.S
@@ -33,8 +33,15 @@
33 * Number of bytes NOT copied. 33 * Number of bytes NOT copied.
34 */ 34 */
35 35
36#define LDR1W_SHIFT 0
37#ifndef CONFIG_THUMB2_KERNEL
38#define STR1W_SHIFT 0
39#else
40#define STR1W_SHIFT 1
41#endif
42
36 .macro ldr1w ptr reg abort 43 .macro ldr1w ptr reg abort
37 ldr \reg, [\ptr], #4 44 W(ldr) \reg, [\ptr], #4
38 .endm 45 .endm
39 46
40 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort 47 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
@@ -50,10 +57,7 @@
50 .endm 57 .endm
51 58
52 .macro str1w ptr reg abort 59 .macro str1w ptr reg abort
53100: strt \reg, [\ptr], #4 60 strusr \reg, \ptr, 4, abort=\abort
54 .section __ex_table, "a"
55 .long 100b, \abort
56 .previous
57 .endm 61 .endm
58 62
59 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort 63 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
@@ -68,10 +72,7 @@
68 .endm 72 .endm
69 73
70 .macro str1b ptr reg cond=al abort 74 .macro str1b ptr reg cond=al abort
71100: str\cond\()bt \reg, [\ptr], #1 75 strusr \reg, \ptr, 1, \cond, abort=\abort
72 .section __ex_table, "a"
73 .long 100b, \abort
74 .previous
75 .endm 76 .endm
76 77
77 .macro enter reg1 reg2 78 .macro enter reg1 reg2
diff --git a/arch/arm/lib/csumpartialcopyuser.S b/arch/arm/lib/csumpartialcopyuser.S
index 14677fb4b0c4..fd0e9dcd9fdc 100644
--- a/arch/arm/lib/csumpartialcopyuser.S
+++ b/arch/arm/lib/csumpartialcopyuser.S
@@ -26,50 +26,28 @@
26 .endm 26 .endm
27 27
28 .macro load1b, reg1 28 .macro load1b, reg1
299999: ldrbt \reg1, [r0], $1 29 ldrusr \reg1, r0, 1
30 .section __ex_table, "a"
31 .align 3
32 .long 9999b, 6001f
33 .previous
34 .endm 30 .endm
35 31
36 .macro load2b, reg1, reg2 32 .macro load2b, reg1, reg2
379999: ldrbt \reg1, [r0], $1 33 ldrusr \reg1, r0, 1
389998: ldrbt \reg2, [r0], $1 34 ldrusr \reg2, r0, 1
39 .section __ex_table, "a"
40 .long 9999b, 6001f
41 .long 9998b, 6001f
42 .previous
43 .endm 35 .endm
44 36
45 .macro load1l, reg1 37 .macro load1l, reg1
469999: ldrt \reg1, [r0], $4 38 ldrusr \reg1, r0, 4
47 .section __ex_table, "a"
48 .align 3
49 .long 9999b, 6001f
50 .previous
51 .endm 39 .endm
52 40
53 .macro load2l, reg1, reg2 41 .macro load2l, reg1, reg2
549999: ldrt \reg1, [r0], $4 42 ldrusr \reg1, r0, 4
559998: ldrt \reg2, [r0], $4 43 ldrusr \reg2, r0, 4
56 .section __ex_table, "a"
57 .long 9999b, 6001f
58 .long 9998b, 6001f
59 .previous
60 .endm 44 .endm
61 45
62 .macro load4l, reg1, reg2, reg3, reg4 46 .macro load4l, reg1, reg2, reg3, reg4
639999: ldrt \reg1, [r0], $4 47 ldrusr \reg1, r0, 4
649998: ldrt \reg2, [r0], $4 48 ldrusr \reg2, r0, 4
659997: ldrt \reg3, [r0], $4 49 ldrusr \reg3, r0, 4
669996: ldrt \reg4, [r0], $4 50 ldrusr \reg4, r0, 4
67 .section __ex_table, "a"
68 .long 9999b, 6001f
69 .long 9998b, 6001f
70 .long 9997b, 6001f
71 .long 9996b, 6001f
72 .previous
73 .endm 51 .endm
74 52
75/* 53/*
@@ -92,14 +70,14 @@
92 */ 70 */
93 .section .fixup,"ax" 71 .section .fixup,"ax"
94 .align 4 72 .align 4
956001: mov r4, #-EFAULT 739001: mov r4, #-EFAULT
96 ldr r5, [fp, #4] @ *err_ptr 74 ldr r5, [fp, #4] @ *err_ptr
97 str r4, [r5] 75 str r4, [r5]
98 ldmia sp, {r1, r2} @ retrieve dst, len 76 ldmia sp, {r1, r2} @ retrieve dst, len
99 add r2, r2, r1 77 add r2, r2, r1
100 mov r0, #0 @ zero the buffer 78 mov r0, #0 @ zero the buffer
1016002: teq r2, r1 799002: teq r2, r1
102 strneb r0, [r1], #1 80 strneb r0, [r1], #1
103 bne 6002b 81 bne 9002b
104 load_regs 82 load_regs
105 .previous 83 .previous
diff --git a/arch/arm/lib/div64.S b/arch/arm/lib/div64.S
index 1425e789ba86..faa7748142da 100644
--- a/arch/arm/lib/div64.S
+++ b/arch/arm/lib/div64.S
@@ -177,7 +177,9 @@ ENTRY(__do_div64)
177 mov yh, xh, lsr ip 177 mov yh, xh, lsr ip
178 mov yl, xl, lsr ip 178 mov yl, xl, lsr ip
179 rsb ip, ip, #32 179 rsb ip, ip, #32
180 orr yl, yl, xh, lsl ip 180 ARM( orr yl, yl, xh, lsl ip )
181 THUMB( lsl xh, xh, ip )
182 THUMB( orr yl, yl, xh )
181 mov xh, xl, lsl ip 183 mov xh, xl, lsl ip
182 mov xh, xh, lsr ip 184 mov xh, xh, lsr ip
183 mov pc, lr 185 mov pc, lr
diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S
index 8c4defc4f3c4..1e4cbd4e7be9 100644
--- a/arch/arm/lib/findbit.S
+++ b/arch/arm/lib/findbit.S
@@ -25,7 +25,10 @@ ENTRY(_find_first_zero_bit_le)
25 teq r1, #0 25 teq r1, #0
26 beq 3f 26 beq 3f
27 mov r2, #0 27 mov r2, #0
281: ldrb r3, [r0, r2, lsr #3] 281:
29 ARM( ldrb r3, [r0, r2, lsr #3] )
30 THUMB( lsr r3, r2, #3 )
31 THUMB( ldrb r3, [r0, r3] )
29 eors r3, r3, #0xff @ invert bits 32 eors r3, r3, #0xff @ invert bits
30 bne .L_found @ any now set - found zero bit 33 bne .L_found @ any now set - found zero bit
31 add r2, r2, #8 @ next bit pointer 34 add r2, r2, #8 @ next bit pointer
@@ -44,7 +47,9 @@ ENTRY(_find_next_zero_bit_le)
44 beq 3b 47 beq 3b
45 ands ip, r2, #7 48 ands ip, r2, #7
46 beq 1b @ If new byte, goto old routine 49 beq 1b @ If new byte, goto old routine
47 ldrb r3, [r0, r2, lsr #3] 50 ARM( ldrb r3, [r0, r2, lsr #3] )
51 THUMB( lsr r3, r2, #3 )
52 THUMB( ldrb r3, [r0, r3] )
48 eor r3, r3, #0xff @ now looking for a 1 bit 53 eor r3, r3, #0xff @ now looking for a 1 bit
49 movs r3, r3, lsr ip @ shift off unused bits 54 movs r3, r3, lsr ip @ shift off unused bits
50 bne .L_found 55 bne .L_found
@@ -61,7 +66,10 @@ ENTRY(_find_first_bit_le)
61 teq r1, #0 66 teq r1, #0
62 beq 3f 67 beq 3f
63 mov r2, #0 68 mov r2, #0
641: ldrb r3, [r0, r2, lsr #3] 691:
70 ARM( ldrb r3, [r0, r2, lsr #3] )
71 THUMB( lsr r3, r2, #3 )
72 THUMB( ldrb r3, [r0, r3] )
65 movs r3, r3 73 movs r3, r3
66 bne .L_found @ any now set - found zero bit 74 bne .L_found @ any now set - found zero bit
67 add r2, r2, #8 @ next bit pointer 75 add r2, r2, #8 @ next bit pointer
@@ -80,7 +88,9 @@ ENTRY(_find_next_bit_le)
80 beq 3b 88 beq 3b
81 ands ip, r2, #7 89 ands ip, r2, #7
82 beq 1b @ If new byte, goto old routine 90 beq 1b @ If new byte, goto old routine
83 ldrb r3, [r0, r2, lsr #3] 91 ARM( ldrb r3, [r0, r2, lsr #3] )
92 THUMB( lsr r3, r2, #3 )
93 THUMB( ldrb r3, [r0, r3] )
84 movs r3, r3, lsr ip @ shift off unused bits 94 movs r3, r3, lsr ip @ shift off unused bits
85 bne .L_found 95 bne .L_found
86 orr r2, r2, #7 @ if zero, then no bits here 96 orr r2, r2, #7 @ if zero, then no bits here
@@ -95,7 +105,9 @@ ENTRY(_find_first_zero_bit_be)
95 beq 3f 105 beq 3f
96 mov r2, #0 106 mov r2, #0
971: eor r3, r2, #0x18 @ big endian byte ordering 1071: eor r3, r2, #0x18 @ big endian byte ordering
98 ldrb r3, [r0, r3, lsr #3] 108 ARM( ldrb r3, [r0, r3, lsr #3] )
109 THUMB( lsr r3, #3 )
110 THUMB( ldrb r3, [r0, r3] )
99 eors r3, r3, #0xff @ invert bits 111 eors r3, r3, #0xff @ invert bits
100 bne .L_found @ any now set - found zero bit 112 bne .L_found @ any now set - found zero bit
101 add r2, r2, #8 @ next bit pointer 113 add r2, r2, #8 @ next bit pointer
@@ -111,7 +123,9 @@ ENTRY(_find_next_zero_bit_be)
111 ands ip, r2, #7 123 ands ip, r2, #7
112 beq 1b @ If new byte, goto old routine 124 beq 1b @ If new byte, goto old routine
113 eor r3, r2, #0x18 @ big endian byte ordering 125 eor r3, r2, #0x18 @ big endian byte ordering
114 ldrb r3, [r0, r3, lsr #3] 126 ARM( ldrb r3, [r0, r3, lsr #3] )
127 THUMB( lsr r3, #3 )
128 THUMB( ldrb r3, [r0, r3] )
115 eor r3, r3, #0xff @ now looking for a 1 bit 129 eor r3, r3, #0xff @ now looking for a 1 bit
116 movs r3, r3, lsr ip @ shift off unused bits 130 movs r3, r3, lsr ip @ shift off unused bits
117 bne .L_found 131 bne .L_found
@@ -125,7 +139,9 @@ ENTRY(_find_first_bit_be)
125 beq 3f 139 beq 3f
126 mov r2, #0 140 mov r2, #0
1271: eor r3, r2, #0x18 @ big endian byte ordering 1411: eor r3, r2, #0x18 @ big endian byte ordering
128 ldrb r3, [r0, r3, lsr #3] 142 ARM( ldrb r3, [r0, r3, lsr #3] )
143 THUMB( lsr r3, #3 )
144 THUMB( ldrb r3, [r0, r3] )
129 movs r3, r3 145 movs r3, r3
130 bne .L_found @ any now set - found zero bit 146 bne .L_found @ any now set - found zero bit
131 add r2, r2, #8 @ next bit pointer 147 add r2, r2, #8 @ next bit pointer
@@ -141,7 +157,9 @@ ENTRY(_find_next_bit_be)
141 ands ip, r2, #7 157 ands ip, r2, #7
142 beq 1b @ If new byte, goto old routine 158 beq 1b @ If new byte, goto old routine
143 eor r3, r2, #0x18 @ big endian byte ordering 159 eor r3, r2, #0x18 @ big endian byte ordering
144 ldrb r3, [r0, r3, lsr #3] 160 ARM( ldrb r3, [r0, r3, lsr #3] )
161 THUMB( lsr r3, #3 )
162 THUMB( ldrb r3, [r0, r3] )
145 movs r3, r3, lsr ip @ shift off unused bits 163 movs r3, r3, lsr ip @ shift off unused bits
146 bne .L_found 164 bne .L_found
147 orr r2, r2, #7 @ if zero, then no bits here 165 orr r2, r2, #7 @ if zero, then no bits here
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
index 6763088b7607..a1814d927122 100644
--- a/arch/arm/lib/getuser.S
+++ b/arch/arm/lib/getuser.S
@@ -36,8 +36,13 @@ ENTRY(__get_user_1)
36ENDPROC(__get_user_1) 36ENDPROC(__get_user_1)
37 37
38ENTRY(__get_user_2) 38ENTRY(__get_user_2)
39#ifdef CONFIG_THUMB2_KERNEL
402: ldrbt r2, [r0]
413: ldrbt r3, [r0, #1]
42#else
392: ldrbt r2, [r0], #1 432: ldrbt r2, [r0], #1
403: ldrbt r3, [r0] 443: ldrbt r3, [r0]
45#endif
41#ifndef __ARMEB__ 46#ifndef __ARMEB__
42 orr r2, r2, r3, lsl #8 47 orr r2, r2, r3, lsl #8
43#else 48#else
diff --git a/arch/arm/lib/io-writesw-armv4.S b/arch/arm/lib/io-writesw-armv4.S
index d6585612c86b..ff4f71b579ee 100644
--- a/arch/arm/lib/io-writesw-armv4.S
+++ b/arch/arm/lib/io-writesw-armv4.S
@@ -75,7 +75,10 @@ ENTRY(__raw_writesw)
75#endif 75#endif
76 76
77.Loutsw_noalign: 77.Loutsw_noalign:
78 ldr r3, [r1, -r3]! 78 ARM( ldr r3, [r1, -r3]! )
79 THUMB( rsb r3, r3, #0 )
80 THUMB( ldr r3, [r1, r3] )
81 THUMB( sub r1, r3 )
79 subcs r2, r2, #1 82 subcs r2, r2, #1
80 bcs 2f 83 bcs 2f
81 subs r2, r2, #2 84 subs r2, r2, #2
diff --git a/arch/arm/lib/lshrdi3.S b/arch/arm/lib/lshrdi3.S
index 99ea338bf87c..f83d449141f7 100644
--- a/arch/arm/lib/lshrdi3.S
+++ b/arch/arm/lib/lshrdi3.S
@@ -43,7 +43,9 @@ ENTRY(__aeabi_llsr)
43 rsb ip, r2, #32 43 rsb ip, r2, #32
44 movmi al, al, lsr r2 44 movmi al, al, lsr r2
45 movpl al, ah, lsr r3 45 movpl al, ah, lsr r3
46 orrmi al, al, ah, lsl ip 46 ARM( orrmi al, al, ah, lsl ip )
47 THUMB( lslmi r3, ah, ip )
48 THUMB( orrmi al, al, r3 )
47 mov ah, ah, lsr r2 49 mov ah, ah, lsr r2
48 mov pc, lr 50 mov pc, lr
49 51
diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S
index e0d002641d3f..a9b9e2287a09 100644
--- a/arch/arm/lib/memcpy.S
+++ b/arch/arm/lib/memcpy.S
@@ -13,8 +13,11 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15 15
16#define LDR1W_SHIFT 0
17#define STR1W_SHIFT 0
18
16 .macro ldr1w ptr reg abort 19 .macro ldr1w ptr reg abort
17 ldr \reg, [\ptr], #4 20 W(ldr) \reg, [\ptr], #4
18 .endm 21 .endm
19 22
20 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort 23 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
@@ -30,7 +33,7 @@
30 .endm 33 .endm
31 34
32 .macro str1w ptr reg abort 35 .macro str1w ptr reg abort
33 str \reg, [\ptr], #4 36 W(str) \reg, [\ptr], #4
34 .endm 37 .endm
35 38
36 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort 39 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
index 12549187088c..5025c863713d 100644
--- a/arch/arm/lib/memmove.S
+++ b/arch/arm/lib/memmove.S
@@ -75,24 +75,24 @@ ENTRY(memmove)
75 addne pc, pc, ip @ C is always clear here 75 addne pc, pc, ip @ C is always clear here
76 b 7f 76 b 7f
776: nop 776: nop
78 ldr r3, [r1, #-4]! 78 W(ldr) r3, [r1, #-4]!
79 ldr r4, [r1, #-4]! 79 W(ldr) r4, [r1, #-4]!
80 ldr r5, [r1, #-4]! 80 W(ldr) r5, [r1, #-4]!
81 ldr r6, [r1, #-4]! 81 W(ldr) r6, [r1, #-4]!
82 ldr r7, [r1, #-4]! 82 W(ldr) r7, [r1, #-4]!
83 ldr r8, [r1, #-4]! 83 W(ldr) r8, [r1, #-4]!
84 ldr lr, [r1, #-4]! 84 W(ldr) lr, [r1, #-4]!
85 85
86 add pc, pc, ip 86 add pc, pc, ip
87 nop 87 nop
88 nop 88 nop
89 str r3, [r0, #-4]! 89 W(str) r3, [r0, #-4]!
90 str r4, [r0, #-4]! 90 W(str) r4, [r0, #-4]!
91 str r5, [r0, #-4]! 91 W(str) r5, [r0, #-4]!
92 str r6, [r0, #-4]! 92 W(str) r6, [r0, #-4]!
93 str r7, [r0, #-4]! 93 W(str) r7, [r0, #-4]!
94 str r8, [r0, #-4]! 94 W(str) r8, [r0, #-4]!
95 str lr, [r0, #-4]! 95 W(str) lr, [r0, #-4]!
96 96
97 CALGN( bcs 2b ) 97 CALGN( bcs 2b )
98 98
diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S
index 864f3c1c4f18..02fedbf07c0d 100644
--- a/arch/arm/lib/putuser.S
+++ b/arch/arm/lib/putuser.S
@@ -37,6 +37,15 @@ ENDPROC(__put_user_1)
37 37
38ENTRY(__put_user_2) 38ENTRY(__put_user_2)
39 mov ip, r2, lsr #8 39 mov ip, r2, lsr #8
40#ifdef CONFIG_THUMB2_KERNEL
41#ifndef __ARMEB__
422: strbt r2, [r0]
433: strbt ip, [r0, #1]
44#else
452: strbt ip, [r0]
463: strbt r2, [r0, #1]
47#endif
48#else /* !CONFIG_THUMB2_KERNEL */
40#ifndef __ARMEB__ 49#ifndef __ARMEB__
412: strbt r2, [r0], #1 502: strbt r2, [r0], #1
423: strbt ip, [r0] 513: strbt ip, [r0]
@@ -44,6 +53,7 @@ ENTRY(__put_user_2)
442: strbt ip, [r0], #1 532: strbt ip, [r0], #1
453: strbt r2, [r0] 543: strbt r2, [r0]
46#endif 55#endif
56#endif /* CONFIG_THUMB2_KERNEL */
47 mov r0, #0 57 mov r0, #0
48 mov pc, lr 58 mov pc, lr
49ENDPROC(__put_user_2) 59ENDPROC(__put_user_2)
@@ -55,8 +65,13 @@ ENTRY(__put_user_4)
55ENDPROC(__put_user_4) 65ENDPROC(__put_user_4)
56 66
57ENTRY(__put_user_8) 67ENTRY(__put_user_8)
68#ifdef CONFIG_THUMB2_KERNEL
695: strt r2, [r0]
706: strt r3, [r0, #4]
71#else
585: strt r2, [r0], #4 725: strt r2, [r0], #4
596: strt r3, [r0] 736: strt r3, [r0]
74#endif
60 mov r0, #0 75 mov r0, #0
61 mov pc, lr 76 mov pc, lr
62ENDPROC(__put_user_8) 77ENDPROC(__put_user_8)
diff --git a/arch/arm/lib/sha1.S b/arch/arm/lib/sha1.S
index a16fb208c841..09b548cac1a4 100644
--- a/arch/arm/lib/sha1.S
+++ b/arch/arm/lib/sha1.S
@@ -187,6 +187,7 @@ ENTRY(sha_transform)
187 187
188ENDPROC(sha_transform) 188ENDPROC(sha_transform)
189 189
190 .align 2
190.L_sha_K: 191.L_sha_K:
191 .word 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 192 .word 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6
192 193
@@ -195,6 +196,7 @@ ENDPROC(sha_transform)
195 * void sha_init(__u32 *buf) 196 * void sha_init(__u32 *buf)
196 */ 197 */
197 198
199 .align 2
198.L_sha_initial_digest: 200.L_sha_initial_digest:
199 .word 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 201 .word 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
200 202
diff --git a/arch/arm/lib/strncpy_from_user.S b/arch/arm/lib/strncpy_from_user.S
index 330373c26dd9..1c9814f346c6 100644
--- a/arch/arm/lib/strncpy_from_user.S
+++ b/arch/arm/lib/strncpy_from_user.S
@@ -23,7 +23,7 @@
23ENTRY(__strncpy_from_user) 23ENTRY(__strncpy_from_user)
24 mov ip, r1 24 mov ip, r1
251: subs r2, r2, #1 251: subs r2, r2, #1
26USER( ldrplbt r3, [r1], #1) 26 ldrusr r3, r1, 1, pl
27 bmi 2f 27 bmi 2f
28 strb r3, [r0], #1 28 strb r3, [r0], #1
29 teq r3, #0 29 teq r3, #0
diff --git a/arch/arm/lib/strnlen_user.S b/arch/arm/lib/strnlen_user.S
index 90bb9d020836..7855b2906659 100644
--- a/arch/arm/lib/strnlen_user.S
+++ b/arch/arm/lib/strnlen_user.S
@@ -23,7 +23,7 @@
23ENTRY(__strnlen_user) 23ENTRY(__strnlen_user)
24 mov r2, r0 24 mov r2, r0
251: 251:
26USER( ldrbt r3, [r0], #1) 26 ldrusr r3, r0, 1
27 teq r3, #0 27 teq r3, #0
28 beq 2f 28 beq 2f
29 subs r1, r1, #1 29 subs r1, r1, #1
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
new file mode 100644
index 000000000000..187cb58345c0
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
@@ -0,0 +1,102 @@
1/*
2 * Header file for the Atmel AHB DMA Controller driver
3 *
4 * Copyright (C) 2008 Atmel Corporation
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#ifndef AT_HDMAC_H
12#define AT_HDMAC_H
13
14#include <linux/dmaengine.h>
15
16/**
17 * struct at_dma_platform_data - Controller configuration parameters
18 * @nr_channels: Number of channels supported by hardware (max 8)
19 * @cap_mask: dma_capability flags supported by the platform
20 */
21struct at_dma_platform_data {
22 unsigned int nr_channels;
23 dma_cap_mask_t cap_mask;
24};
25
26/**
27 * enum at_dma_slave_width - DMA slave register access width.
28 * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
29 * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
30 * @AT_DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
31 */
32enum at_dma_slave_width {
33 AT_DMA_SLAVE_WIDTH_8BIT = 0,
34 AT_DMA_SLAVE_WIDTH_16BIT,
35 AT_DMA_SLAVE_WIDTH_32BIT,
36};
37
38/**
39 * struct at_dma_slave - Controller-specific information about a slave
40 * @dma_dev: required DMA master device
41 * @tx_reg: physical address of data register used for
42 * memory-to-peripheral transfers
43 * @rx_reg: physical address of data register used for
44 * peripheral-to-memory transfers
45 * @reg_width: peripheral register width
46 * @cfg: Platform-specific initializer for the CFG register
47 * @ctrla: Platform-specific initializer for the CTRLA register
48 */
49struct at_dma_slave {
50 struct device *dma_dev;
51 dma_addr_t tx_reg;
52 dma_addr_t rx_reg;
53 enum at_dma_slave_width reg_width;
54 u32 cfg;
55 u32 ctrla;
56};
57
58
59/* Platform-configurable bits in CFG */
60#define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */
61#define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */
62#define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */
63#define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */
64#define ATC_SRC_H2SEL_SW (0x0 << 9)
65#define ATC_SRC_H2SEL_HW (0x1 << 9)
66#define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */
67#define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */
68#define ATC_DST_H2SEL_SW (0x0 << 13)
69#define ATC_DST_H2SEL_HW (0x1 << 13)
70#define ATC_SOD (0x1 << 16) /* Stop On Done */
71#define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */
72#define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */
73#define ATC_LOCK_IF_L (0x1 << 22) /* Master Interface Arbiter Lock */
74#define ATC_LOCK_IF_L_CHUNK (0x0 << 22)
75#define ATC_LOCK_IF_L_BUFFER (0x1 << 22)
76#define ATC_AHB_PROT_MASK (0x7 << 24) /* AHB Protection */
77#define ATC_FIFOCFG_MASK (0x3 << 28) /* FIFO Request Configuration */
78#define ATC_FIFOCFG_LARGESTBURST (0x0 << 28)
79#define ATC_FIFOCFG_HALFFIFO (0x1 << 28)
80#define ATC_FIFOCFG_ENOUGHSPACE (0x2 << 28)
81
82/* Platform-configurable bits in CTRLA */
83#define ATC_SCSIZE_MASK (0x7 << 16) /* Source Chunk Transfer Size */
84#define ATC_SCSIZE_1 (0x0 << 16)
85#define ATC_SCSIZE_4 (0x1 << 16)
86#define ATC_SCSIZE_8 (0x2 << 16)
87#define ATC_SCSIZE_16 (0x3 << 16)
88#define ATC_SCSIZE_32 (0x4 << 16)
89#define ATC_SCSIZE_64 (0x5 << 16)
90#define ATC_SCSIZE_128 (0x6 << 16)
91#define ATC_SCSIZE_256 (0x7 << 16)
92#define ATC_DCSIZE_MASK (0x7 << 20) /* Destination Chunk Transfer Size */
93#define ATC_DCSIZE_1 (0x0 << 20)
94#define ATC_DCSIZE_4 (0x1 << 20)
95#define ATC_DCSIZE_8 (0x2 << 20)
96#define ATC_DCSIZE_16 (0x3 << 20)
97#define ATC_DCSIZE_32 (0x4 << 20)
98#define ATC_DCSIZE_64 (0x5 << 20)
99#define ATC_DCSIZE_128 (0x6 << 20)
100#define ATC_DCSIZE_256 (0x7 << 20)
101
102#endif /* AT_HDMAC_H */
diff --git a/arch/arm/mach-ep93xx/dma-m2p.c b/arch/arm/mach-ep93xx/dma-m2p.c
index a2df5bb7dff0..dbcac9c40a28 100644
--- a/arch/arm/mach-ep93xx/dma-m2p.c
+++ b/arch/arm/mach-ep93xx/dma-m2p.c
@@ -33,6 +33,7 @@
33#include <linux/err.h> 33#include <linux/err.h>
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/io.h>
36 37
37#include <mach/dma.h> 38#include <mach/dma.h>
38#include <mach/hardware.h> 39#include <mach/hardware.h>
diff --git a/arch/arm/mach-integrator/include/mach/hardware.h b/arch/arm/mach-integrator/include/mach/hardware.h
index 1251319ef9ae..d795642fad22 100644
--- a/arch/arm/mach-integrator/include/mach/hardware.h
+++ b/arch/arm/mach-integrator/include/mach/hardware.h
@@ -36,8 +36,12 @@
36#define PCIO_BASE PCI_IO_VADDR 36#define PCIO_BASE PCI_IO_VADDR
37#define PCIMEM_BASE PCI_MEMORY_VADDR 37#define PCIMEM_BASE PCI_MEMORY_VADDR
38 38
39#ifdef CONFIG_MMU
39/* macro to get at IO space when running virtually */ 40/* macro to get at IO space when running virtually */
40#define IO_ADDRESS(x) (((x) >> 4) + IO_BASE) 41#define IO_ADDRESS(x) (((x) >> 4) + IO_BASE)
42#else
43#define IO_ADDRESS(x) (x)
44#endif
41 45
42#define pcibios_assign_all_busses() 1 46#define pcibios_assign_all_busses() 1
43 47
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 69956cdae3c2..2a318eba1b07 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -49,14 +49,14 @@
49 49
50#define INTCP_PA_CLCD_BASE 0xc0000000 50#define INTCP_PA_CLCD_BASE 0xc0000000
51 51
52#define INTCP_VA_CIC_BASE 0xf1000040 52#define INTCP_VA_CIC_BASE IO_ADDRESS(INTEGRATOR_HDR_BASE) + 0x40
53#define INTCP_VA_PIC_BASE 0xf1400000 53#define INTCP_VA_PIC_BASE IO_ADDRESS(INTEGRATOR_IC_BASE)
54#define INTCP_VA_SIC_BASE 0xfca00000 54#define INTCP_VA_SIC_BASE IO_ADDRESS(0xca000000)
55 55
56#define INTCP_PA_ETH_BASE 0xc8000000 56#define INTCP_PA_ETH_BASE 0xc8000000
57#define INTCP_ETH_SIZE 0x10 57#define INTCP_ETH_SIZE 0x10
58 58
59#define INTCP_VA_CTRL_BASE 0xfcb00000 59#define INTCP_VA_CTRL_BASE IO_ADDRESS(0xcb000000)
60#define INTCP_FLASHPROG 0x04 60#define INTCP_FLASHPROG 0x04
61#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0) 61#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0)
62#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1) 62#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1)
@@ -121,12 +121,12 @@ static struct map_desc intcp_io_desc[] __initdata = {
121 .length = SZ_4K, 121 .length = SZ_4K,
122 .type = MT_DEVICE 122 .type = MT_DEVICE
123 }, { 123 }, {
124 .virtual = 0xfca00000, 124 .virtual = IO_ADDRESS(0xca000000),
125 .pfn = __phys_to_pfn(0xca000000), 125 .pfn = __phys_to_pfn(0xca000000),
126 .length = SZ_4K, 126 .length = SZ_4K,
127 .type = MT_DEVICE 127 .type = MT_DEVICE
128 }, { 128 }, {
129 .virtual = 0xfcb00000, 129 .virtual = IO_ADDRESS(0xcb000000),
130 .pfn = __phys_to_pfn(0xcb000000), 130 .pfn = __phys_to_pfn(0xcb000000),
131 .length = SZ_4K, 131 .length = SZ_4K,
132 .type = MT_DEVICE 132 .type = MT_DEVICE
@@ -394,8 +394,8 @@ static struct platform_device *intcp_devs[] __initdata = {
394 */ 394 */
395static unsigned int mmc_status(struct device *dev) 395static unsigned int mmc_status(struct device *dev)
396{ 396{
397 unsigned int status = readl(0xfca00004); 397 unsigned int status = readl(IO_ADDRESS(0xca000000) + 4);
398 writel(8, 0xfcb00008); 398 writel(8, IO_ADDRESS(0xcb000000) + 8);
399 399
400 return status & 8; 400 return status & 8;
401} 401}
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 25100f7acf4c..0aca451b216d 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -38,6 +38,12 @@ config MACH_TS219
38 Say 'Y' here if you want your kernel to support the 38 Say 'Y' here if you want your kernel to support the
39 QNAP TS-119 and TS-219 Turbo NAS devices. 39 QNAP TS-119 and TS-219 Turbo NAS devices.
40 40
41config MACH_OPENRD_BASE
42 bool "Marvell OpenRD Base Board"
43 help
44 Say 'Y' here if you want your kernel to support the
45 Marvell OpenRD Base Board.
46
41endmenu 47endmenu
42 48
43endif 49endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 9dd680e964d6..80ab0ec90ee1 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -6,5 +6,6 @@ obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o
6obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o 6obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o
7obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o 7obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o
8obj-$(CONFIG_MACH_TS219) += ts219-setup.o 8obj-$(CONFIG_MACH_TS219) += ts219-setup.o
9obj-$(CONFIG_MACH_OPENRD_BASE) += openrd_base-setup.o
9 10
10obj-$(CONFIG_CPU_IDLE) += cpuidle.o 11obj-$(CONFIG_CPU_IDLE) += cpuidle.o
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 0f6919838011..0acb61f3c10b 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -838,7 +838,8 @@ int __init kirkwood_find_tclk(void)
838 u32 dev, rev; 838 u32 dev, rev;
839 839
840 kirkwood_pcie_id(&dev, &rev); 840 kirkwood_pcie_id(&dev, &rev);
841 if (dev == MV88F6281_DEV_ID && rev == MV88F6281_REV_A0) 841 if (dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 ||
842 rev == MV88F6281_REV_A1))
842 return 200000000; 843 return 200000000;
843 844
844 return 166666667; 845 return 166666667;
@@ -872,6 +873,8 @@ static char * __init kirkwood_id(void)
872 return "MV88F6281-Z0"; 873 return "MV88F6281-Z0";
873 else if (rev == MV88F6281_REV_A0) 874 else if (rev == MV88F6281_REV_A0)
874 return "MV88F6281-A0"; 875 return "MV88F6281-A0";
876 else if (rev == MV88F6281_REV_A1)
877 return "MV88F6281-A1";
875 else 878 else
876 return "MV88F6281-Rev-Unsupported"; 879 return "MV88F6281-Rev-Unsupported";
877 } else if (dev == MV88F6192_DEV_ID) { 880 } else if (dev == MV88F6192_DEV_ID) {
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index 07af858814a0..54c132731d2d 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -101,6 +101,7 @@
101#define MV88F6281_DEV_ID 0x6281 101#define MV88F6281_DEV_ID 0x6281
102#define MV88F6281_REV_Z0 0 102#define MV88F6281_REV_Z0 0
103#define MV88F6281_REV_A0 2 103#define MV88F6281_REV_A0 2
104#define MV88F6281_REV_A1 3
104 105
105#define MV88F6192_DEV_ID 0x6192 106#define MV88F6192_DEV_ID 0x6192
106#define MV88F6192_REV_Z0 0 107#define MV88F6192_REV_Z0 0
diff --git a/arch/arm/mach-kirkwood/mpp.h b/arch/arm/mach-kirkwood/mpp.h
index e021a80c2caf..bc74278ed311 100644
--- a/arch/arm/mach-kirkwood/mpp.h
+++ b/arch/arm/mach-kirkwood/mpp.h
@@ -289,7 +289,7 @@
289 289
290#define MPP48_GPIO MPP( 48, 0x0, 1, 1, 0, 0, 0, 1 ) 290#define MPP48_GPIO MPP( 48, 0x0, 1, 1, 0, 0, 0, 1 )
291#define MPP48_TSMP12 MPP( 48, 0x1, 1, 1, 0, 0, 0, 1 ) 291#define MPP48_TSMP12 MPP( 48, 0x1, 1, 1, 0, 0, 0, 1 )
292#define MPP48_TDM_DTX MPP( 48. 0x2, 0, 1, 0, 0, 0, 1 ) 292#define MPP48_TDM_DTX MPP( 48, 0x2, 0, 1, 0, 0, 0, 1 )
293 293
294#define MPP49_GPIO MPP( 49, 0x0, 1, 1, 0, 0, 0, 1 ) 294#define MPP49_GPIO MPP( 49, 0x0, 1, 1, 0, 0, 0, 1 )
295#define MPP49_TSMP9 MPP( 49, 0x1, 1, 1, 0, 0, 0, 1 ) 295#define MPP49_TSMP9 MPP( 49, 0x1, 1, 1, 0, 0, 0, 1 )
diff --git a/arch/arm/mach-kirkwood/openrd_base-setup.c b/arch/arm/mach-kirkwood/openrd_base-setup.c
new file mode 100644
index 000000000000..947dfb8cd5b2
--- /dev/null
+++ b/arch/arm/mach-kirkwood/openrd_base-setup.c
@@ -0,0 +1,84 @@
1/*
2 * arch/arm/mach-kirkwood/openrd_base-setup.c
3 *
4 * Marvell OpenRD Base Board Setup
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#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/partitions.h>
15#include <linux/ata_platform.h>
16#include <linux/mv643xx_eth.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <mach/kirkwood.h>
20#include <plat/mvsdio.h>
21#include "common.h"
22#include "mpp.h"
23
24static struct mtd_partition openrd_base_nand_parts[] = {
25 {
26 .name = "u-boot",
27 .offset = 0,
28 .size = SZ_1M
29 }, {
30 .name = "uImage",
31 .offset = MTDPART_OFS_NXTBLK,
32 .size = SZ_4M
33 }, {
34 .name = "root",
35 .offset = MTDPART_OFS_NXTBLK,
36 .size = MTDPART_SIZ_FULL
37 },
38};
39
40static struct mv643xx_eth_platform_data openrd_base_ge00_data = {
41 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
42};
43
44static struct mv_sata_platform_data openrd_base_sata_data = {
45 .n_ports = 2,
46};
47
48static struct mvsdio_platform_data openrd_base_mvsdio_data = {
49 .gpio_card_detect = 29, /* MPP29 used as SD card detect */
50};
51
52static unsigned int openrd_base_mpp_config[] __initdata = {
53 MPP29_GPIO,
54 0
55};
56
57static void __init openrd_base_init(void)
58{
59 /*
60 * Basic setup. Needs to be called early.
61 */
62 kirkwood_init();
63 kirkwood_mpp_conf(openrd_base_mpp_config);
64
65 kirkwood_uart0_init();
66 kirkwood_nand_init(ARRAY_AND_SIZE(openrd_base_nand_parts), 25);
67
68 kirkwood_ehci_init();
69
70 kirkwood_ge00_init(&openrd_base_ge00_data);
71 kirkwood_sata_init(&openrd_base_sata_data);
72 kirkwood_sdio_init(&openrd_base_mvsdio_data);
73}
74
75MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board")
76 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
77 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
78 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
79 .boot_params = 0x00000100,
80 .init_machine = openrd_base_init,
81 .map_io = kirkwood_map_io,
82 .init_irq = kirkwood_init_irq,
83 .timer = &kirkwood_timer,
84MACHINE_END
diff --git a/arch/arm/mach-mx1/clock.c b/arch/arm/mach-mx1/clock.c
index 0d0f306851d0..d1b588519ad2 100644
--- a/arch/arm/mach-mx1/clock.c
+++ b/arch/arm/mach-mx1/clock.c
@@ -18,11 +18,14 @@
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/list.h>
21#include <linux/math64.h> 22#include <linux/math64.h>
22#include <linux/err.h> 23#include <linux/err.h>
23#include <linux/clk.h> 24#include <linux/clk.h>
24#include <linux/io.h> 25#include <linux/io.h>
25 26
27#include <asm/clkdev.h>
28
26#include <mach/clock.h> 29#include <mach/clock.h>
27#include <mach/hardware.h> 30#include <mach/hardware.h>
28#include <mach/common.h> 31#include <mach/common.h>
@@ -94,7 +97,6 @@ static unsigned long clk16m_get_rate(struct clk *clk)
94} 97}
95 98
96static struct clk clk16m = { 99static struct clk clk16m = {
97 .name = "CLK16M",
98 .get_rate = clk16m_get_rate, 100 .get_rate = clk16m_get_rate,
99 .enable = _clk_enable, 101 .enable = _clk_enable,
100 .enable_reg = CCM_CSCR, 102 .enable_reg = CCM_CSCR,
@@ -111,7 +113,6 @@ static unsigned long clk32_get_rate(struct clk *clk)
111} 113}
112 114
113static struct clk clk32 = { 115static struct clk clk32 = {
114 .name = "CLK32",
115 .get_rate = clk32_get_rate, 116 .get_rate = clk32_get_rate,
116}; 117};
117 118
@@ -121,7 +122,6 @@ static unsigned long clk32_premult_get_rate(struct clk *clk)
121} 122}
122 123
123static struct clk clk32_premult = { 124static struct clk clk32_premult = {
124 .name = "CLK32_premultiplier",
125 .parent = &clk32, 125 .parent = &clk32,
126 .get_rate = clk32_premult_get_rate, 126 .get_rate = clk32_premult_get_rate,
127}; 127};
@@ -156,7 +156,6 @@ static int prem_clk_set_parent(struct clk *clk, struct clk *parent)
156} 156}
157 157
158static struct clk prem_clk = { 158static struct clk prem_clk = {
159 .name = "prem_clk",
160 .set_parent = prem_clk_set_parent, 159 .set_parent = prem_clk_set_parent,
161}; 160};
162 161
@@ -167,7 +166,6 @@ static unsigned long system_clk_get_rate(struct clk *clk)
167} 166}
168 167
169static struct clk system_clk = { 168static struct clk system_clk = {
170 .name = "system_clk",
171 .parent = &prem_clk, 169 .parent = &prem_clk,
172 .get_rate = system_clk_get_rate, 170 .get_rate = system_clk_get_rate,
173}; 171};
@@ -179,7 +177,6 @@ static unsigned long mcu_clk_get_rate(struct clk *clk)
179} 177}
180 178
181static struct clk mcu_clk = { 179static struct clk mcu_clk = {
182 .name = "mcu_clk",
183 .parent = &clk32_premult, 180 .parent = &clk32_premult,
184 .get_rate = mcu_clk_get_rate, 181 .get_rate = mcu_clk_get_rate,
185}; 182};
@@ -195,7 +192,6 @@ static unsigned long fclk_get_rate(struct clk *clk)
195} 192}
196 193
197static struct clk fclk = { 194static struct clk fclk = {
198 .name = "fclk",
199 .parent = &mcu_clk, 195 .parent = &mcu_clk,
200 .get_rate = fclk_get_rate, 196 .get_rate = fclk_get_rate,
201}; 197};
@@ -238,7 +234,6 @@ static int hclk_set_rate(struct clk *clk, unsigned long rate)
238} 234}
239 235
240static struct clk hclk = { 236static struct clk hclk = {
241 .name = "hclk",
242 .parent = &system_clk, 237 .parent = &system_clk,
243 .get_rate = hclk_get_rate, 238 .get_rate = hclk_get_rate,
244 .round_rate = hclk_round_rate, 239 .round_rate = hclk_round_rate,
@@ -280,7 +275,6 @@ static int clk48m_set_rate(struct clk *clk, unsigned long rate)
280} 275}
281 276
282static struct clk clk48m = { 277static struct clk clk48m = {
283 .name = "CLK48M",
284 .parent = &system_clk, 278 .parent = &system_clk,
285 .get_rate = clk48m_get_rate, 279 .get_rate = clk48m_get_rate,
286 .round_rate = clk48m_round_rate, 280 .round_rate = clk48m_round_rate,
@@ -400,21 +394,18 @@ static int perclk3_set_rate(struct clk *clk, unsigned long rate)
400 394
401static struct clk perclk[] = { 395static struct clk perclk[] = {
402 { 396 {
403 .name = "perclk",
404 .id = 0, 397 .id = 0,
405 .parent = &system_clk, 398 .parent = &system_clk,
406 .get_rate = perclk1_get_rate, 399 .get_rate = perclk1_get_rate,
407 .round_rate = perclk1_round_rate, 400 .round_rate = perclk1_round_rate,
408 .set_rate = perclk1_set_rate, 401 .set_rate = perclk1_set_rate,
409 }, { 402 }, {
410 .name = "perclk",
411 .id = 1, 403 .id = 1,
412 .parent = &system_clk, 404 .parent = &system_clk,
413 .get_rate = perclk2_get_rate, 405 .get_rate = perclk2_get_rate,
414 .round_rate = perclk2_round_rate, 406 .round_rate = perclk2_round_rate,
415 .set_rate = perclk2_set_rate, 407 .set_rate = perclk2_set_rate,
416 }, { 408 }, {
417 .name = "perclk",
418 .id = 2, 409 .id = 2,
419 .parent = &system_clk, 410 .parent = &system_clk,
420 .get_rate = perclk3_get_rate, 411 .get_rate = perclk3_get_rate,
@@ -457,12 +448,10 @@ static int clko_set_parent(struct clk *clk, struct clk *parent)
457} 448}
458 449
459static struct clk clko_clk = { 450static struct clk clko_clk = {
460 .name = "clko_clk",
461 .set_parent = clko_set_parent, 451 .set_parent = clko_set_parent,
462}; 452};
463 453
464static struct clk dma_clk = { 454static struct clk dma_clk = {
465 .name = "dma",
466 .parent = &hclk, 455 .parent = &hclk,
467 .round_rate = _clk_parent_round_rate, 456 .round_rate = _clk_parent_round_rate,
468 .set_rate = _clk_parent_set_rate, 457 .set_rate = _clk_parent_set_rate,
@@ -473,7 +462,6 @@ static struct clk dma_clk = {
473}; 462};
474 463
475static struct clk csi_clk = { 464static struct clk csi_clk = {
476 .name = "csi_clk",
477 .parent = &hclk, 465 .parent = &hclk,
478 .round_rate = _clk_parent_round_rate, 466 .round_rate = _clk_parent_round_rate,
479 .set_rate = _clk_parent_set_rate, 467 .set_rate = _clk_parent_set_rate,
@@ -484,7 +472,6 @@ static struct clk csi_clk = {
484}; 472};
485 473
486static struct clk mma_clk = { 474static struct clk mma_clk = {
487 .name = "mma_clk",
488 .parent = &hclk, 475 .parent = &hclk,
489 .round_rate = _clk_parent_round_rate, 476 .round_rate = _clk_parent_round_rate,
490 .set_rate = _clk_parent_set_rate, 477 .set_rate = _clk_parent_set_rate,
@@ -495,7 +482,6 @@ static struct clk mma_clk = {
495}; 482};
496 483
497static struct clk usbd_clk = { 484static struct clk usbd_clk = {
498 .name = "usbd_clk",
499 .parent = &clk48m, 485 .parent = &clk48m,
500 .round_rate = _clk_parent_round_rate, 486 .round_rate = _clk_parent_round_rate,
501 .set_rate = _clk_parent_set_rate, 487 .set_rate = _clk_parent_set_rate,
@@ -506,99 +492,85 @@ static struct clk usbd_clk = {
506}; 492};
507 493
508static struct clk gpt_clk = { 494static struct clk gpt_clk = {
509 .name = "gpt_clk",
510 .parent = &perclk[0], 495 .parent = &perclk[0],
511 .round_rate = _clk_parent_round_rate, 496 .round_rate = _clk_parent_round_rate,
512 .set_rate = _clk_parent_set_rate, 497 .set_rate = _clk_parent_set_rate,
513}; 498};
514 499
515static struct clk uart_clk = { 500static struct clk uart_clk = {
516 .name = "uart",
517 .parent = &perclk[0], 501 .parent = &perclk[0],
518 .round_rate = _clk_parent_round_rate, 502 .round_rate = _clk_parent_round_rate,
519 .set_rate = _clk_parent_set_rate, 503 .set_rate = _clk_parent_set_rate,
520}; 504};
521 505
522static struct clk i2c_clk = { 506static struct clk i2c_clk = {
523 .name = "i2c_clk",
524 .parent = &hclk, 507 .parent = &hclk,
525 .round_rate = _clk_parent_round_rate, 508 .round_rate = _clk_parent_round_rate,
526 .set_rate = _clk_parent_set_rate, 509 .set_rate = _clk_parent_set_rate,
527}; 510};
528 511
529static struct clk spi_clk = { 512static struct clk spi_clk = {
530 .name = "spi_clk",
531 .parent = &perclk[1], 513 .parent = &perclk[1],
532 .round_rate = _clk_parent_round_rate, 514 .round_rate = _clk_parent_round_rate,
533 .set_rate = _clk_parent_set_rate, 515 .set_rate = _clk_parent_set_rate,
534}; 516};
535 517
536static struct clk sdhc_clk = { 518static struct clk sdhc_clk = {
537 .name = "sdhc_clk",
538 .parent = &perclk[1], 519 .parent = &perclk[1],
539 .round_rate = _clk_parent_round_rate, 520 .round_rate = _clk_parent_round_rate,
540 .set_rate = _clk_parent_set_rate, 521 .set_rate = _clk_parent_set_rate,
541}; 522};
542 523
543static struct clk lcdc_clk = { 524static struct clk lcdc_clk = {
544 .name = "lcdc_clk",
545 .parent = &perclk[1], 525 .parent = &perclk[1],
546 .round_rate = _clk_parent_round_rate, 526 .round_rate = _clk_parent_round_rate,
547 .set_rate = _clk_parent_set_rate, 527 .set_rate = _clk_parent_set_rate,
548}; 528};
549 529
550static struct clk mshc_clk = { 530static struct clk mshc_clk = {
551 .name = "mshc_clk",
552 .parent = &hclk, 531 .parent = &hclk,
553 .round_rate = _clk_parent_round_rate, 532 .round_rate = _clk_parent_round_rate,
554 .set_rate = _clk_parent_set_rate, 533 .set_rate = _clk_parent_set_rate,
555}; 534};
556 535
557static struct clk ssi_clk = { 536static struct clk ssi_clk = {
558 .name = "ssi_clk",
559 .parent = &perclk[2], 537 .parent = &perclk[2],
560 .round_rate = _clk_parent_round_rate, 538 .round_rate = _clk_parent_round_rate,
561 .set_rate = _clk_parent_set_rate, 539 .set_rate = _clk_parent_set_rate,
562}; 540};
563 541
564static struct clk rtc_clk = { 542static struct clk rtc_clk = {
565 .name = "rtc_clk",
566 .parent = &clk32, 543 .parent = &clk32,
567}; 544};
568 545
569static struct clk *mxc_clks[] = { 546#define _REGISTER_CLOCK(d, n, c) \
570 &clk16m, 547 { \
571 &clk32, 548 .dev_id = d, \
572 &clk32_premult, 549 .con_id = n, \
573 &prem_clk, 550 .clk = &c, \
574 &system_clk, 551 },
575 &mcu_clk, 552static struct clk_lookup lookups[] __initdata = {
576 &fclk, 553 _REGISTER_CLOCK(NULL, "dma", dma_clk)
577 &hclk, 554 _REGISTER_CLOCK("mx1-camera.0", NULL, csi_clk)
578 &clk48m, 555 _REGISTER_CLOCK(NULL, "mma", mma_clk)
579 &perclk[0], 556 _REGISTER_CLOCK("imx_udc.0", NULL, usbd_clk)
580 &perclk[1], 557 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
581 &perclk[2], 558 _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk)
582 &clko_clk, 559 _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk)
583 &dma_clk, 560 _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk)
584 &csi_clk, 561 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
585 &mma_clk, 562 _REGISTER_CLOCK("spi_imx.0", NULL, spi_clk)
586 &usbd_clk, 563 _REGISTER_CLOCK("imx-mmc.0", NULL, sdhc_clk)
587 &gpt_clk, 564 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
588 &uart_clk, 565 _REGISTER_CLOCK(NULL, "mshc", mshc_clk)
589 &i2c_clk, 566 _REGISTER_CLOCK(NULL, "ssi", ssi_clk)
590 &spi_clk, 567 _REGISTER_CLOCK("mxc_rtc.0", NULL, rtc_clk)
591 &sdhc_clk,
592 &lcdc_clk,
593 &mshc_clk,
594 &ssi_clk,
595 &rtc_clk,
596}; 568};
597 569
598int __init mx1_clocks_init(unsigned long fref) 570int __init mx1_clocks_init(unsigned long fref)
599{ 571{
600 struct clk **clkp;
601 unsigned int reg; 572 unsigned int reg;
573 int i;
602 574
603 /* disable clocks we are able to */ 575 /* disable clocks we are able to */
604 __raw_writel(0, SCM_GCCR); 576 __raw_writel(0, SCM_GCCR);
@@ -620,13 +592,13 @@ int __init mx1_clocks_init(unsigned long fref)
620 reg = (reg & CCM_CSCR_CLKO_MASK) >> CCM_CSCR_CLKO_OFFSET; 592 reg = (reg & CCM_CSCR_CLKO_MASK) >> CCM_CSCR_CLKO_OFFSET;
621 clko_clk.parent = (struct clk *)clko_clocks[reg]; 593 clko_clk.parent = (struct clk *)clko_clocks[reg];
622 594
623 for (clkp = mxc_clks; clkp < mxc_clks + ARRAY_SIZE(mxc_clks); clkp++) 595 for (i = 0; i < ARRAY_SIZE(lookups); i++)
624 clk_register(*clkp); 596 clkdev_add(&lookups[i]);
625 597
626 clk_enable(&hclk); 598 clk_enable(&hclk);
627 clk_enable(&fclk); 599 clk_enable(&fclk);
628 600
629 mxc_timer_init(&gpt_clk); 601 mxc_timer_init(&gpt_clk, IO_ADDRESS(TIM1_BASE_ADDR), TIM1_INT);
630 602
631 return 0; 603 return 0;
632} 604}
diff --git a/arch/arm/mach-mx1/devices.c b/arch/arm/mach-mx1/devices.c
index 76d1ffb48079..b6be29d1cb08 100644
--- a/arch/arm/mach-mx1/devices.c
+++ b/arch/arm/mach-mx1/devices.c
@@ -29,12 +29,11 @@
29#include "devices.h" 29#include "devices.h"
30 30
31static struct resource imx_csi_resources[] = { 31static struct resource imx_csi_resources[] = {
32 [0] = { 32 {
33 .start = 0x00224000, 33 .start = 0x00224000,
34 .end = 0x00224010, 34 .end = 0x00224010,
35 .flags = IORESOURCE_MEM, 35 .flags = IORESOURCE_MEM,
36 }, 36 }, {
37 [1] = {
38 .start = CSI_INT, 37 .start = CSI_INT,
39 .end = CSI_INT, 38 .end = CSI_INT,
40 .flags = IORESOURCE_IRQ, 39 .flags = IORESOURCE_IRQ,
@@ -55,12 +54,11 @@ struct platform_device imx_csi_device = {
55}; 54};
56 55
57static struct resource imx_i2c_resources[] = { 56static struct resource imx_i2c_resources[] = {
58 [0] = { 57 {
59 .start = 0x00217000, 58 .start = 0x00217000,
60 .end = 0x00217010, 59 .end = 0x00217010,
61 .flags = IORESOURCE_MEM, 60 .flags = IORESOURCE_MEM,
62 }, 61 }, {
63 [1] = {
64 .start = I2C_INT, 62 .start = I2C_INT,
65 .end = I2C_INT, 63 .end = I2C_INT,
66 .flags = IORESOURCE_IRQ, 64 .flags = IORESOURCE_IRQ,
@@ -75,22 +73,19 @@ struct platform_device imx_i2c_device = {
75}; 73};
76 74
77static struct resource imx_uart1_resources[] = { 75static struct resource imx_uart1_resources[] = {
78 [0] = { 76 {
79 .start = UART1_BASE_ADDR, 77 .start = UART1_BASE_ADDR,
80 .end = UART1_BASE_ADDR + 0xD0, 78 .end = UART1_BASE_ADDR + 0xD0,
81 .flags = IORESOURCE_MEM, 79 .flags = IORESOURCE_MEM,
82 }, 80 }, {
83 [1] = {
84 .start = UART1_MINT_RX, 81 .start = UART1_MINT_RX,
85 .end = UART1_MINT_RX, 82 .end = UART1_MINT_RX,
86 .flags = IORESOURCE_IRQ, 83 .flags = IORESOURCE_IRQ,
87 }, 84 }, {
88 [2] = {
89 .start = UART1_MINT_TX, 85 .start = UART1_MINT_TX,
90 .end = UART1_MINT_TX, 86 .end = UART1_MINT_TX,
91 .flags = IORESOURCE_IRQ, 87 .flags = IORESOURCE_IRQ,
92 }, 88 }, {
93 [3] = {
94 .start = UART1_MINT_RTS, 89 .start = UART1_MINT_RTS,
95 .end = UART1_MINT_RTS, 90 .end = UART1_MINT_RTS,
96 .flags = IORESOURCE_IRQ, 91 .flags = IORESOURCE_IRQ,
@@ -105,22 +100,19 @@ struct platform_device imx_uart1_device = {
105}; 100};
106 101
107static struct resource imx_uart2_resources[] = { 102static struct resource imx_uart2_resources[] = {
108 [0] = { 103 {
109 .start = UART2_BASE_ADDR, 104 .start = UART2_BASE_ADDR,
110 .end = UART2_BASE_ADDR + 0xD0, 105 .end = UART2_BASE_ADDR + 0xD0,
111 .flags = IORESOURCE_MEM, 106 .flags = IORESOURCE_MEM,
112 }, 107 }, {
113 [1] = {
114 .start = UART2_MINT_RX, 108 .start = UART2_MINT_RX,
115 .end = UART2_MINT_RX, 109 .end = UART2_MINT_RX,
116 .flags = IORESOURCE_IRQ, 110 .flags = IORESOURCE_IRQ,
117 }, 111 }, {
118 [2] = {
119 .start = UART2_MINT_TX, 112 .start = UART2_MINT_TX,
120 .end = UART2_MINT_TX, 113 .end = UART2_MINT_TX,
121 .flags = IORESOURCE_IRQ, 114 .flags = IORESOURCE_IRQ,
122 }, 115 }, {
123 [3] = {
124 .start = UART2_MINT_RTS, 116 .start = UART2_MINT_RTS,
125 .end = UART2_MINT_RTS, 117 .end = UART2_MINT_RTS,
126 .flags = IORESOURCE_IRQ, 118 .flags = IORESOURCE_IRQ,
@@ -135,17 +127,15 @@ struct platform_device imx_uart2_device = {
135}; 127};
136 128
137static struct resource imx_rtc_resources[] = { 129static struct resource imx_rtc_resources[] = {
138 [0] = { 130 {
139 .start = 0x00204000, 131 .start = 0x00204000,
140 .end = 0x00204024, 132 .end = 0x00204024,
141 .flags = IORESOURCE_MEM, 133 .flags = IORESOURCE_MEM,
142 }, 134 }, {
143 [1] = {
144 .start = RTC_INT, 135 .start = RTC_INT,
145 .end = RTC_INT, 136 .end = RTC_INT,
146 .flags = IORESOURCE_IRQ, 137 .flags = IORESOURCE_IRQ,
147 }, 138 }, {
148 [2] = {
149 .start = RTC_SAMINT, 139 .start = RTC_SAMINT,
150 .end = RTC_SAMINT, 140 .end = RTC_SAMINT,
151 .flags = IORESOURCE_IRQ, 141 .flags = IORESOURCE_IRQ,
@@ -160,12 +150,11 @@ struct platform_device imx_rtc_device = {
160}; 150};
161 151
162static struct resource imx_wdt_resources[] = { 152static struct resource imx_wdt_resources[] = {
163 [0] = { 153 {
164 .start = 0x00201000, 154 .start = 0x00201000,
165 .end = 0x00201008, 155 .end = 0x00201008,
166 .flags = IORESOURCE_MEM, 156 .flags = IORESOURCE_MEM,
167 }, 157 }, {
168 [1] = {
169 .start = WDT_INT, 158 .start = WDT_INT,
170 .end = WDT_INT, 159 .end = WDT_INT,
171 .flags = IORESOURCE_IRQ, 160 .flags = IORESOURCE_IRQ,
@@ -180,42 +169,35 @@ struct platform_device imx_wdt_device = {
180}; 169};
181 170
182static struct resource imx_usb_resources[] = { 171static struct resource imx_usb_resources[] = {
183 [0] = { 172 {
184 .start = 0x00212000, 173 .start = 0x00212000,
185 .end = 0x00212148, 174 .end = 0x00212148,
186 .flags = IORESOURCE_MEM, 175 .flags = IORESOURCE_MEM,
187 }, 176 }, {
188 [1] = {
189 .start = USBD_INT0, 177 .start = USBD_INT0,
190 .end = USBD_INT0, 178 .end = USBD_INT0,
191 .flags = IORESOURCE_IRQ, 179 .flags = IORESOURCE_IRQ,
192 }, 180 }, {
193 [2] = {
194 .start = USBD_INT1, 181 .start = USBD_INT1,
195 .end = USBD_INT1, 182 .end = USBD_INT1,
196 .flags = IORESOURCE_IRQ, 183 .flags = IORESOURCE_IRQ,
197 }, 184 }, {
198 [3] = {
199 .start = USBD_INT2, 185 .start = USBD_INT2,
200 .end = USBD_INT2, 186 .end = USBD_INT2,
201 .flags = IORESOURCE_IRQ, 187 .flags = IORESOURCE_IRQ,
202 }, 188 }, {
203 [4] = {
204 .start = USBD_INT3, 189 .start = USBD_INT3,
205 .end = USBD_INT3, 190 .end = USBD_INT3,
206 .flags = IORESOURCE_IRQ, 191 .flags = IORESOURCE_IRQ,
207 }, 192 }, {
208 [5] = {
209 .start = USBD_INT4, 193 .start = USBD_INT4,
210 .end = USBD_INT4, 194 .end = USBD_INT4,
211 .flags = IORESOURCE_IRQ, 195 .flags = IORESOURCE_IRQ,
212 }, 196 }, {
213 [6] = {
214 .start = USBD_INT5, 197 .start = USBD_INT5,
215 .end = USBD_INT5, 198 .end = USBD_INT5,
216 .flags = IORESOURCE_IRQ, 199 .flags = IORESOURCE_IRQ,
217 }, 200 }, {
218 [7] = {
219 .start = USBD_INT6, 201 .start = USBD_INT6,
220 .end = USBD_INT6, 202 .end = USBD_INT6,
221 .flags = IORESOURCE_IRQ, 203 .flags = IORESOURCE_IRQ,
@@ -231,29 +213,26 @@ struct platform_device imx_usb_device = {
231 213
232/* GPIO port description */ 214/* GPIO port description */
233static struct mxc_gpio_port imx_gpio_ports[] = { 215static struct mxc_gpio_port imx_gpio_ports[] = {
234 [0] = { 216 {
235 .chip.label = "gpio-0", 217 .chip.label = "gpio-0",
236 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR), 218 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR),
237 .irq = GPIO_INT_PORTA, 219 .irq = GPIO_INT_PORTA,
238 .virtual_irq_start = MXC_GPIO_IRQ_START 220 .virtual_irq_start = MXC_GPIO_IRQ_START,
239 }, 221 }, {
240 [1] = {
241 .chip.label = "gpio-1", 222 .chip.label = "gpio-1",
242 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100), 223 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
243 .irq = GPIO_INT_PORTB, 224 .irq = GPIO_INT_PORTB,
244 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 225 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
245 }, 226 }, {
246 [2] = {
247 .chip.label = "gpio-2", 227 .chip.label = "gpio-2",
248 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200), 228 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
249 .irq = GPIO_INT_PORTC, 229 .irq = GPIO_INT_PORTC,
250 .virtual_irq_start = MXC_GPIO_IRQ_START + 64 230 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
251 }, 231 }, {
252 [3] = {
253 .chip.label = "gpio-3", 232 .chip.label = "gpio-3",
254 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300), 233 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
255 .irq = GPIO_INT_PORTD, 234 .irq = GPIO_INT_PORTD,
256 .virtual_irq_start = MXC_GPIO_IRQ_START + 96 235 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
257 } 236 }
258}; 237};
259 238
diff --git a/arch/arm/mach-mx1/generic.c b/arch/arm/mach-mx1/generic.c
index 7622c9b38c97..7f9fc1034c08 100644
--- a/arch/arm/mach-mx1/generic.c
+++ b/arch/arm/mach-mx1/generic.c
@@ -41,6 +41,13 @@ static struct map_desc imx_io_desc[] __initdata = {
41void __init mx1_map_io(void) 41void __init mx1_map_io(void)
42{ 42{
43 mxc_set_cpu_type(MXC_CPU_MX1); 43 mxc_set_cpu_type(MXC_CPU_MX1);
44 mxc_arch_reset_init(IO_ADDRESS(WDT_BASE_ADDR));
44 45
45 iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc)); 46 iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc));
46} 47}
48
49void __init mx1_init_irq(void)
50{
51 mxc_init_irq(IO_ADDRESS(AVIC_BASE_ADDR));
52}
53
diff --git a/arch/arm/mach-mx1/mx1ads.c b/arch/arm/mach-mx1/mx1ads.c
index e5b0c0a83c3b..30f04e56fafe 100644
--- a/arch/arm/mach-mx1/mx1ads.c
+++ b/arch/arm/mach-mx1/mx1ads.c
@@ -104,12 +104,10 @@ static struct imxi2c_platform_data mx1ads_i2c_data = {
104 104
105static struct i2c_board_info mx1ads_i2c_devices[] = { 105static struct i2c_board_info mx1ads_i2c_devices[] = {
106 { 106 {
107 I2C_BOARD_INFO("pcf857x", 0x22), 107 I2C_BOARD_INFO("pcf8575", 0x22),
108 .type = "pcf8575",
109 .platform_data = &pcf857x_data[0], 108 .platform_data = &pcf857x_data[0],
110 }, { 109 }, {
111 I2C_BOARD_INFO("pcf857x", 0x24), 110 I2C_BOARD_INFO("pcf8575", 0x24),
112 .type = "pcf8575",
113 .platform_data = &pcf857x_data[1], 111 .platform_data = &pcf857x_data[1],
114 }, 112 },
115}; 113};
@@ -151,7 +149,7 @@ MACHINE_START(MX1ADS, "Freescale MX1ADS")
151 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc, 149 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
152 .boot_params = PHYS_OFFSET + 0x100, 150 .boot_params = PHYS_OFFSET + 0x100,
153 .map_io = mx1_map_io, 151 .map_io = mx1_map_io,
154 .init_irq = mxc_init_irq, 152 .init_irq = mx1_init_irq,
155 .timer = &mx1ads_timer, 153 .timer = &mx1ads_timer,
156 .init_machine = mx1ads_init, 154 .init_machine = mx1ads_init,
157MACHINE_END 155MACHINE_END
@@ -161,7 +159,7 @@ MACHINE_START(MXLADS, "Freescale MXLADS")
161 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc, 159 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
162 .boot_params = PHYS_OFFSET + 0x100, 160 .boot_params = PHYS_OFFSET + 0x100,
163 .map_io = mx1_map_io, 161 .map_io = mx1_map_io,
164 .init_irq = mxc_init_irq, 162 .init_irq = mx1_init_irq,
165 .timer = &mx1ads_timer, 163 .timer = &mx1ads_timer,
166 .init_machine = mx1ads_init, 164 .init_machine = mx1ads_init,
167MACHINE_END 165MACHINE_END
diff --git a/arch/arm/mach-mx1/scb9328.c b/arch/arm/mach-mx1/scb9328.c
index 20e0b5bcdffc..325d98df6053 100644
--- a/arch/arm/mach-mx1/scb9328.c
+++ b/arch/arm/mach-mx1/scb9328.c
@@ -68,22 +68,20 @@ static struct dm9000_plat_data dm9000_platdata = {
68 * to gain access to address latch registers and the data path. 68 * to gain access to address latch registers and the data path.
69 */ 69 */
70static struct resource dm9000x_resources[] = { 70static struct resource dm9000x_resources[] = {
71 [0] = { 71 {
72 .name = "address area", 72 .name = "address area",
73 .start = IMX_CS5_PHYS, 73 .start = IMX_CS5_PHYS,
74 .end = IMX_CS5_PHYS + 1, 74 .end = IMX_CS5_PHYS + 1,
75 .flags = IORESOURCE_MEM /* address access */ 75 .flags = IORESOURCE_MEM, /* address access */
76 }, 76 }, {
77 [1] = {
78 .name = "data area", 77 .name = "data area",
79 .start = IMX_CS5_PHYS + 4, 78 .start = IMX_CS5_PHYS + 4,
80 .end = IMX_CS5_PHYS + 5, 79 .end = IMX_CS5_PHYS + 5,
81 .flags = IORESOURCE_MEM /* data access */ 80 .flags = IORESOURCE_MEM, /* data access */
82 }, 81 }, {
83 [2] = {
84 .start = IRQ_GPIOC(3), 82 .start = IRQ_GPIOC(3),
85 .end = IRQ_GPIOC(3), 83 .end = IRQ_GPIOC(3),
86 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL 84 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
87 }, 85 },
88}; 86};
89 87
@@ -154,7 +152,7 @@ MACHINE_START(SCB9328, "Synertronixx scb9328")
154 .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc, 152 .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc,
155 .boot_params = 0x08000100, 153 .boot_params = 0x08000100,
156 .map_io = mx1_map_io, 154 .map_io = mx1_map_io,
157 .init_irq = mxc_init_irq, 155 .init_irq = mx1_init_irq,
158 .timer = &scb9328_timer, 156 .timer = &scb9328_timer,
159 .init_machine = scb9328_init, 157 .init_machine = scb9328_init,
160MACHINE_END 158MACHINE_END
diff --git a/arch/arm/mach-mx2/Kconfig b/arch/arm/mach-mx2/Kconfig
index c77da586b71d..c8a2eac4d13c 100644
--- a/arch/arm/mach-mx2/Kconfig
+++ b/arch/arm/mach-mx2/Kconfig
@@ -53,6 +53,34 @@ config MACH_PCM970_BASEBOARD
53 53
54endchoice 54endchoice
55 55
56config MACH_EUKREA_CPUIMX27
57 bool "Eukrea CPUIMX27 module"
58 depends on MACH_MX27
59 help
60 Include support for Eukrea CPUIMX27 platform. This includes
61 specific configurations for the module and its peripherals.
62
63config MACH_EUKREA_CPUIMX27_USESDHC2
64 bool "CPUIMX27 integrates SDHC2 module"
65 depends on MACH_EUKREA_CPUIMX27
66 help
67 This adds support for the internal SDHC2 used on CPUIMX27 used
68 for wifi or eMMC.
69
70choice
71 prompt "Baseboard"
72 depends on MACH_EUKREA_CPUIMX27
73 default MACH_EUKREA_MBIMX27_BASEBOARD
74
75config MACH_EUKREA_MBIMX27_BASEBOARD
76 prompt "Eukrea MBIMX27 development board"
77 bool
78 help
79 This adds board specific devices that can be found on Eukrea's
80 MBIMX27 evaluation board.
81
82endchoice
83
56config MACH_MX27_3DS 84config MACH_MX27_3DS
57 bool "MX27PDK platform" 85 bool "MX27PDK platform"
58 depends on MACH_MX27 86 depends on MACH_MX27
@@ -67,4 +95,11 @@ config MACH_MX27LITE
67 Include support for MX27 LITEKIT platform. This includes specific 95 Include support for MX27 LITEKIT platform. This includes specific
68 configurations for the board and its peripherals. 96 configurations for the board and its peripherals.
69 97
98config MACH_PCA100
99 bool "Phytec phyCARD-s (pca100)"
100 depends on MACH_MX27
101 help
102 Include support for phyCARD-s (aka pca100) platform. This
103 includes specific configurations for the module and its peripherals.
104
70endif 105endif
diff --git a/arch/arm/mach-mx2/Makefile b/arch/arm/mach-mx2/Makefile
index b9b1cca4e9bc..19560f045632 100644
--- a/arch/arm/mach-mx2/Makefile
+++ b/arch/arm/mach-mx2/Makefile
@@ -17,4 +17,7 @@ obj-$(CONFIG_MACH_PCM038) += pcm038.o
17obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o 17obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o
18obj-$(CONFIG_MACH_MX27_3DS) += mx27pdk.o 18obj-$(CONFIG_MACH_MX27_3DS) += mx27pdk.o
19obj-$(CONFIG_MACH_MX27LITE) += mx27lite.o 19obj-$(CONFIG_MACH_MX27LITE) += mx27lite.o
20obj-$(CONFIG_MACH_EUKREA_CPUIMX27) += eukrea_cpuimx27.o
21obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o
22obj-$(CONFIG_MACH_PCA100) += pca100.o
20 23
diff --git a/arch/arm/mach-mx2/clock_imx21.c b/arch/arm/mach-mx2/clock_imx21.c
index 0850fb88ec15..eede79855f4a 100644
--- a/arch/arm/mach-mx2/clock_imx21.c
+++ b/arch/arm/mach-mx2/clock_imx21.c
@@ -1004,6 +1004,6 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href)
1004 clk_enable(&uart_clk[0]); 1004 clk_enable(&uart_clk[0]);
1005#endif 1005#endif
1006 1006
1007 mxc_timer_init(&gpt_clk[0]); 1007 mxc_timer_init(&gpt_clk[0], IO_ADDRESS(GPT1_BASE_ADDR), MXC_INT_GPT1);
1008 return 0; 1008 return 0;
1009} 1009}
diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-mx2/clock_imx27.c
index 2c971442f3f2..4089951acb47 100644
--- a/arch/arm/mach-mx2/clock_imx27.c
+++ b/arch/arm/mach-mx2/clock_imx27.c
@@ -643,7 +643,14 @@ static struct clk_lookup lookups[] = {
643 _REGISTER_CLOCK(NULL, "cspi3", cspi3_clk) 643 _REGISTER_CLOCK(NULL, "cspi3", cspi3_clk)
644 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 644 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
645 _REGISTER_CLOCK(NULL, "csi", csi_clk) 645 _REGISTER_CLOCK(NULL, "csi", csi_clk)
646 _REGISTER_CLOCK(NULL, "usb", usb_clk) 646 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk)
647 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk1)
648 _REGISTER_CLOCK("mxc-ehci.0", "usb", usb_clk)
649 _REGISTER_CLOCK("mxc-ehci.0", "usb_ahb", usb_clk1)
650 _REGISTER_CLOCK("mxc-ehci.1", "usb", usb_clk)
651 _REGISTER_CLOCK("mxc-ehci.1", "usb_ahb", usb_clk1)
652 _REGISTER_CLOCK("mxc-ehci.2", "usb", usb_clk)
653 _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_clk1)
647 _REGISTER_CLOCK(NULL, "ssi1", ssi1_clk) 654 _REGISTER_CLOCK(NULL, "ssi1", ssi1_clk)
648 _REGISTER_CLOCK(NULL, "ssi2", ssi2_clk) 655 _REGISTER_CLOCK(NULL, "ssi2", ssi2_clk)
649 _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk) 656 _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk)
@@ -748,7 +755,7 @@ int __init mx27_clocks_init(unsigned long fref)
748 clk_enable(&uart1_clk); 755 clk_enable(&uart1_clk);
749#endif 756#endif
750 757
751 mxc_timer_init(&gpt1_clk); 758 mxc_timer_init(&gpt1_clk, IO_ADDRESS(GPT1_BASE_ADDR), MXC_INT_GPT1);
752 759
753 return 0; 760 return 0;
754} 761}
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
index a0f1b3674327..50199aff0143 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-mx2/devices.c
@@ -40,45 +40,87 @@
40#include "devices.h" 40#include "devices.h"
41 41
42/* 42/*
43 * Resource definition for the MXC IrDA 43 * SPI master controller
44 *
45 * - i.MX1: 2 channel (slighly different register setting)
46 * - i.MX21: 2 channel
47 * - i.MX27: 3 channel
44 */ 48 */
45static struct resource mxc_irda_resources[] = { 49static struct resource mxc_spi_resources0[] = {
46 [0] = { 50 {
47 .start = UART3_BASE_ADDR, 51 .start = CSPI1_BASE_ADDR,
48 .end = UART3_BASE_ADDR + SZ_4K - 1, 52 .end = CSPI1_BASE_ADDR + SZ_4K - 1,
49 .flags = IORESOURCE_MEM, 53 .flags = IORESOURCE_MEM,
54 }, {
55 .start = MXC_INT_CSPI1,
56 .end = MXC_INT_CSPI1,
57 .flags = IORESOURCE_IRQ,
50 }, 58 },
51 [1] = { 59};
52 .start = MXC_INT_UART3, 60
53 .end = MXC_INT_UART3, 61static struct resource mxc_spi_resources1[] = {
54 .flags = IORESOURCE_IRQ, 62 {
63 .start = CSPI2_BASE_ADDR,
64 .end = CSPI2_BASE_ADDR + SZ_4K - 1,
65 .flags = IORESOURCE_MEM,
66 }, {
67 .start = MXC_INT_CSPI2,
68 .end = MXC_INT_CSPI2,
69 .flags = IORESOURCE_IRQ,
55 }, 70 },
56}; 71};
57 72
58/* Platform Data for MXC IrDA */ 73#ifdef CONFIG_MACH_MX27
59struct platform_device mxc_irda_device = { 74static struct resource mxc_spi_resources2[] = {
60 .name = "mxc_irda", 75 {
76 .start = CSPI3_BASE_ADDR,
77 .end = CSPI3_BASE_ADDR + SZ_4K - 1,
78 .flags = IORESOURCE_MEM,
79 }, {
80 .start = MXC_INT_CSPI3,
81 .end = MXC_INT_CSPI3,
82 .flags = IORESOURCE_IRQ,
83 },
84};
85#endif
86
87struct platform_device mxc_spi_device0 = {
88 .name = "spi_imx",
61 .id = 0, 89 .id = 0,
62 .num_resources = ARRAY_SIZE(mxc_irda_resources), 90 .num_resources = ARRAY_SIZE(mxc_spi_resources0),
63 .resource = mxc_irda_resources, 91 .resource = mxc_spi_resources0,
92};
93
94struct platform_device mxc_spi_device1 = {
95 .name = "spi_imx",
96 .id = 1,
97 .num_resources = ARRAY_SIZE(mxc_spi_resources1),
98 .resource = mxc_spi_resources1,
99};
100
101#ifdef CONFIG_MACH_MX27
102struct platform_device mxc_spi_device2 = {
103 .name = "spi_imx",
104 .id = 2,
105 .num_resources = ARRAY_SIZE(mxc_spi_resources2),
106 .resource = mxc_spi_resources2,
64}; 107};
108#endif
65 109
66/* 110/*
67 * General Purpose Timer 111 * General Purpose Timer
68 * - i.MX1: 2 timer (slighly different register handling) 112 * - i.MX21: 3 timers
69 * - i.MX21: 3 timer 113 * - i.MX27: 6 timers
70 * - i.MX27: 6 timer
71 */ 114 */
72 115
73/* We use gpt0 as system timer, so do not add a device for this one */ 116/* We use gpt0 as system timer, so do not add a device for this one */
74 117
75static struct resource timer1_resources[] = { 118static struct resource timer1_resources[] = {
76 [0] = { 119 {
77 .start = GPT2_BASE_ADDR, 120 .start = GPT2_BASE_ADDR,
78 .end = GPT2_BASE_ADDR + 0x17, 121 .end = GPT2_BASE_ADDR + 0x17,
79 .flags = IORESOURCE_MEM 122 .flags = IORESOURCE_MEM,
80 }, 123 }, {
81 [1] = {
82 .start = MXC_INT_GPT2, 124 .start = MXC_INT_GPT2,
83 .end = MXC_INT_GPT2, 125 .end = MXC_INT_GPT2,
84 .flags = IORESOURCE_IRQ, 126 .flags = IORESOURCE_IRQ,
@@ -89,16 +131,15 @@ struct platform_device mxc_gpt1 = {
89 .name = "imx_gpt", 131 .name = "imx_gpt",
90 .id = 1, 132 .id = 1,
91 .num_resources = ARRAY_SIZE(timer1_resources), 133 .num_resources = ARRAY_SIZE(timer1_resources),
92 .resource = timer1_resources 134 .resource = timer1_resources,
93}; 135};
94 136
95static struct resource timer2_resources[] = { 137static struct resource timer2_resources[] = {
96 [0] = { 138 {
97 .start = GPT3_BASE_ADDR, 139 .start = GPT3_BASE_ADDR,
98 .end = GPT3_BASE_ADDR + 0x17, 140 .end = GPT3_BASE_ADDR + 0x17,
99 .flags = IORESOURCE_MEM 141 .flags = IORESOURCE_MEM,
100 }, 142 }, {
101 [1] = {
102 .start = MXC_INT_GPT3, 143 .start = MXC_INT_GPT3,
103 .end = MXC_INT_GPT3, 144 .end = MXC_INT_GPT3,
104 .flags = IORESOURCE_IRQ, 145 .flags = IORESOURCE_IRQ,
@@ -109,17 +150,16 @@ struct platform_device mxc_gpt2 = {
109 .name = "imx_gpt", 150 .name = "imx_gpt",
110 .id = 2, 151 .id = 2,
111 .num_resources = ARRAY_SIZE(timer2_resources), 152 .num_resources = ARRAY_SIZE(timer2_resources),
112 .resource = timer2_resources 153 .resource = timer2_resources,
113}; 154};
114 155
115#ifdef CONFIG_MACH_MX27 156#ifdef CONFIG_MACH_MX27
116static struct resource timer3_resources[] = { 157static struct resource timer3_resources[] = {
117 [0] = { 158 {
118 .start = GPT4_BASE_ADDR, 159 .start = GPT4_BASE_ADDR,
119 .end = GPT4_BASE_ADDR + 0x17, 160 .end = GPT4_BASE_ADDR + 0x17,
120 .flags = IORESOURCE_MEM 161 .flags = IORESOURCE_MEM,
121 }, 162 }, {
122 [1] = {
123 .start = MXC_INT_GPT4, 163 .start = MXC_INT_GPT4,
124 .end = MXC_INT_GPT4, 164 .end = MXC_INT_GPT4,
125 .flags = IORESOURCE_IRQ, 165 .flags = IORESOURCE_IRQ,
@@ -130,16 +170,15 @@ struct platform_device mxc_gpt3 = {
130 .name = "imx_gpt", 170 .name = "imx_gpt",
131 .id = 3, 171 .id = 3,
132 .num_resources = ARRAY_SIZE(timer3_resources), 172 .num_resources = ARRAY_SIZE(timer3_resources),
133 .resource = timer3_resources 173 .resource = timer3_resources,
134}; 174};
135 175
136static struct resource timer4_resources[] = { 176static struct resource timer4_resources[] = {
137 [0] = { 177 {
138 .start = GPT5_BASE_ADDR, 178 .start = GPT5_BASE_ADDR,
139 .end = GPT5_BASE_ADDR + 0x17, 179 .end = GPT5_BASE_ADDR + 0x17,
140 .flags = IORESOURCE_MEM 180 .flags = IORESOURCE_MEM,
141 }, 181 }, {
142 [1] = {
143 .start = MXC_INT_GPT5, 182 .start = MXC_INT_GPT5,
144 .end = MXC_INT_GPT5, 183 .end = MXC_INT_GPT5,
145 .flags = IORESOURCE_IRQ, 184 .flags = IORESOURCE_IRQ,
@@ -150,16 +189,15 @@ struct platform_device mxc_gpt4 = {
150 .name = "imx_gpt", 189 .name = "imx_gpt",
151 .id = 4, 190 .id = 4,
152 .num_resources = ARRAY_SIZE(timer4_resources), 191 .num_resources = ARRAY_SIZE(timer4_resources),
153 .resource = timer4_resources 192 .resource = timer4_resources,
154}; 193};
155 194
156static struct resource timer5_resources[] = { 195static struct resource timer5_resources[] = {
157 [0] = { 196 {
158 .start = GPT6_BASE_ADDR, 197 .start = GPT6_BASE_ADDR,
159 .end = GPT6_BASE_ADDR + 0x17, 198 .end = GPT6_BASE_ADDR + 0x17,
160 .flags = IORESOURCE_MEM 199 .flags = IORESOURCE_MEM,
161 }, 200 }, {
162 [1] = {
163 .start = MXC_INT_GPT6, 201 .start = MXC_INT_GPT6,
164 .end = MXC_INT_GPT6, 202 .end = MXC_INT_GPT6,
165 .flags = IORESOURCE_IRQ, 203 .flags = IORESOURCE_IRQ,
@@ -170,7 +208,7 @@ struct platform_device mxc_gpt5 = {
170 .name = "imx_gpt", 208 .name = "imx_gpt",
171 .id = 5, 209 .id = 5,
172 .num_resources = ARRAY_SIZE(timer5_resources), 210 .num_resources = ARRAY_SIZE(timer5_resources),
173 .resource = timer5_resources 211 .resource = timer5_resources,
174}; 212};
175#endif 213#endif
176 214
@@ -214,11 +252,11 @@ static struct resource mxc_nand_resources[] = {
214 { 252 {
215 .start = NFC_BASE_ADDR, 253 .start = NFC_BASE_ADDR,
216 .end = NFC_BASE_ADDR + 0xfff, 254 .end = NFC_BASE_ADDR + 0xfff,
217 .flags = IORESOURCE_MEM 255 .flags = IORESOURCE_MEM,
218 }, { 256 }, {
219 .start = MXC_INT_NANDFC, 257 .start = MXC_INT_NANDFC,
220 .end = MXC_INT_NANDFC, 258 .end = MXC_INT_NANDFC,
221 .flags = IORESOURCE_IRQ 259 .flags = IORESOURCE_IRQ,
222 }, 260 },
223}; 261};
224 262
@@ -240,8 +278,7 @@ static struct resource mxc_fb[] = {
240 .start = LCDC_BASE_ADDR, 278 .start = LCDC_BASE_ADDR,
241 .end = LCDC_BASE_ADDR + 0xFFF, 279 .end = LCDC_BASE_ADDR + 0xFFF,
242 .flags = IORESOURCE_MEM, 280 .flags = IORESOURCE_MEM,
243 }, 281 }, {
244 {
245 .start = MXC_INT_LCDC, 282 .start = MXC_INT_LCDC,
246 .end = MXC_INT_LCDC, 283 .end = MXC_INT_LCDC,
247 .flags = IORESOURCE_IRQ, 284 .flags = IORESOURCE_IRQ,
@@ -264,11 +301,11 @@ static struct resource mxc_fec_resources[] = {
264 { 301 {
265 .start = FEC_BASE_ADDR, 302 .start = FEC_BASE_ADDR,
266 .end = FEC_BASE_ADDR + 0xfff, 303 .end = FEC_BASE_ADDR + 0xfff,
267 .flags = IORESOURCE_MEM 304 .flags = IORESOURCE_MEM,
268 }, { 305 }, {
269 .start = MXC_INT_FEC, 306 .start = MXC_INT_FEC,
270 .end = MXC_INT_FEC, 307 .end = MXC_INT_FEC,
271 .flags = IORESOURCE_IRQ 308 .flags = IORESOURCE_IRQ,
272 }, 309 },
273}; 310};
274 311
@@ -281,15 +318,14 @@ struct platform_device mxc_fec_device = {
281#endif 318#endif
282 319
283static struct resource mxc_i2c_1_resources[] = { 320static struct resource mxc_i2c_1_resources[] = {
284 [0] = { 321 {
285 .start = I2C_BASE_ADDR, 322 .start = I2C_BASE_ADDR,
286 .end = I2C_BASE_ADDR + 0x0fff, 323 .end = I2C_BASE_ADDR + 0x0fff,
287 .flags = IORESOURCE_MEM 324 .flags = IORESOURCE_MEM,
288 }, 325 }, {
289 [1] = {
290 .start = MXC_INT_I2C, 326 .start = MXC_INT_I2C,
291 .end = MXC_INT_I2C, 327 .end = MXC_INT_I2C,
292 .flags = IORESOURCE_IRQ 328 .flags = IORESOURCE_IRQ,
293 } 329 }
294}; 330};
295 331
@@ -297,20 +333,19 @@ struct platform_device mxc_i2c_device0 = {
297 .name = "imx-i2c", 333 .name = "imx-i2c",
298 .id = 0, 334 .id = 0,
299 .num_resources = ARRAY_SIZE(mxc_i2c_1_resources), 335 .num_resources = ARRAY_SIZE(mxc_i2c_1_resources),
300 .resource = mxc_i2c_1_resources 336 .resource = mxc_i2c_1_resources,
301}; 337};
302 338
303#ifdef CONFIG_MACH_MX27 339#ifdef CONFIG_MACH_MX27
304static struct resource mxc_i2c_2_resources[] = { 340static struct resource mxc_i2c_2_resources[] = {
305 [0] = { 341 {
306 .start = I2C2_BASE_ADDR, 342 .start = I2C2_BASE_ADDR,
307 .end = I2C2_BASE_ADDR + 0x0fff, 343 .end = I2C2_BASE_ADDR + 0x0fff,
308 .flags = IORESOURCE_MEM 344 .flags = IORESOURCE_MEM,
309 }, 345 }, {
310 [1] = {
311 .start = MXC_INT_I2C2, 346 .start = MXC_INT_I2C2,
312 .end = MXC_INT_I2C2, 347 .end = MXC_INT_I2C2,
313 .flags = IORESOURCE_IRQ 348 .flags = IORESOURCE_IRQ,
314 } 349 }
315}; 350};
316 351
@@ -318,17 +353,16 @@ struct platform_device mxc_i2c_device1 = {
318 .name = "imx-i2c", 353 .name = "imx-i2c",
319 .id = 1, 354 .id = 1,
320 .num_resources = ARRAY_SIZE(mxc_i2c_2_resources), 355 .num_resources = ARRAY_SIZE(mxc_i2c_2_resources),
321 .resource = mxc_i2c_2_resources 356 .resource = mxc_i2c_2_resources,
322}; 357};
323#endif 358#endif
324 359
325static struct resource mxc_pwm_resources[] = { 360static struct resource mxc_pwm_resources[] = {
326 [0] = { 361 {
327 .start = PWM_BASE_ADDR, 362 .start = PWM_BASE_ADDR,
328 .end = PWM_BASE_ADDR + 0x0fff, 363 .end = PWM_BASE_ADDR + 0x0fff,
329 .flags = IORESOURCE_MEM 364 .flags = IORESOURCE_MEM,
330 }, 365 }, {
331 [1] = {
332 .start = MXC_INT_PWM, 366 .start = MXC_INT_PWM,
333 .end = MXC_INT_PWM, 367 .end = MXC_INT_PWM,
334 .flags = IORESOURCE_IRQ, 368 .flags = IORESOURCE_IRQ,
@@ -339,28 +373,26 @@ struct platform_device mxc_pwm_device = {
339 .name = "mxc_pwm", 373 .name = "mxc_pwm",
340 .id = 0, 374 .id = 0,
341 .num_resources = ARRAY_SIZE(mxc_pwm_resources), 375 .num_resources = ARRAY_SIZE(mxc_pwm_resources),
342 .resource = mxc_pwm_resources 376 .resource = mxc_pwm_resources,
343}; 377};
344 378
345/* 379/*
346 * Resource definition for the MXC SDHC 380 * Resource definition for the MXC SDHC
347 */ 381 */
348static struct resource mxc_sdhc1_resources[] = { 382static struct resource mxc_sdhc1_resources[] = {
349 [0] = { 383 {
350 .start = SDHC1_BASE_ADDR, 384 .start = SDHC1_BASE_ADDR,
351 .end = SDHC1_BASE_ADDR + SZ_4K - 1, 385 .end = SDHC1_BASE_ADDR + SZ_4K - 1,
352 .flags = IORESOURCE_MEM, 386 .flags = IORESOURCE_MEM,
353 }, 387 }, {
354 [1] = { 388 .start = MXC_INT_SDHC1,
355 .start = MXC_INT_SDHC1, 389 .end = MXC_INT_SDHC1,
356 .end = MXC_INT_SDHC1, 390 .flags = IORESOURCE_IRQ,
357 .flags = IORESOURCE_IRQ, 391 }, {
358 }, 392 .start = DMA_REQ_SDHC1,
359 [2] = { 393 .end = DMA_REQ_SDHC1,
360 .start = DMA_REQ_SDHC1, 394 .flags = IORESOURCE_DMA,
361 .end = DMA_REQ_SDHC1, 395 },
362 .flags = IORESOURCE_DMA
363 },
364}; 396};
365 397
366static u64 mxc_sdhc1_dmamask = 0xffffffffUL; 398static u64 mxc_sdhc1_dmamask = 0xffffffffUL;
@@ -377,21 +409,19 @@ struct platform_device mxc_sdhc_device0 = {
377}; 409};
378 410
379static struct resource mxc_sdhc2_resources[] = { 411static struct resource mxc_sdhc2_resources[] = {
380 [0] = { 412 {
381 .start = SDHC2_BASE_ADDR, 413 .start = SDHC2_BASE_ADDR,
382 .end = SDHC2_BASE_ADDR + SZ_4K - 1, 414 .end = SDHC2_BASE_ADDR + SZ_4K - 1,
383 .flags = IORESOURCE_MEM, 415 .flags = IORESOURCE_MEM,
384 }, 416 }, {
385 [1] = { 417 .start = MXC_INT_SDHC2,
386 .start = MXC_INT_SDHC2, 418 .end = MXC_INT_SDHC2,
387 .end = MXC_INT_SDHC2, 419 .flags = IORESOURCE_IRQ,
388 .flags = IORESOURCE_IRQ, 420 }, {
389 }, 421 .start = DMA_REQ_SDHC2,
390 [2] = { 422 .end = DMA_REQ_SDHC2,
391 .start = DMA_REQ_SDHC2, 423 .flags = IORESOURCE_DMA,
392 .end = DMA_REQ_SDHC2, 424 },
393 .flags = IORESOURCE_DMA
394 },
395}; 425};
396 426
397static u64 mxc_sdhc2_dmamask = 0xffffffffUL; 427static u64 mxc_sdhc2_dmamask = 0xffffffffUL;
@@ -407,35 +437,123 @@ struct platform_device mxc_sdhc_device1 = {
407 .resource = mxc_sdhc2_resources, 437 .resource = mxc_sdhc2_resources,
408}; 438};
409 439
440#ifdef CONFIG_MACH_MX27
441static struct resource otg_resources[] = {
442 {
443 .start = OTG_BASE_ADDR,
444 .end = OTG_BASE_ADDR + 0x1ff,
445 .flags = IORESOURCE_MEM,
446 }, {
447 .start = MXC_INT_USB3,
448 .end = MXC_INT_USB3,
449 .flags = IORESOURCE_IRQ,
450 },
451};
452
453static u64 otg_dmamask = 0xffffffffUL;
454
455/* OTG gadget device */
456struct platform_device mxc_otg_udc_device = {
457 .name = "fsl-usb2-udc",
458 .id = -1,
459 .dev = {
460 .dma_mask = &otg_dmamask,
461 .coherent_dma_mask = 0xffffffffUL,
462 },
463 .resource = otg_resources,
464 .num_resources = ARRAY_SIZE(otg_resources),
465};
466
467/* OTG host */
468struct platform_device mxc_otg_host = {
469 .name = "mxc-ehci",
470 .id = 0,
471 .dev = {
472 .coherent_dma_mask = 0xffffffff,
473 .dma_mask = &otg_dmamask,
474 },
475 .resource = otg_resources,
476 .num_resources = ARRAY_SIZE(otg_resources),
477};
478
479/* USB host 1 */
480
481static u64 usbh1_dmamask = 0xffffffffUL;
482
483static struct resource mxc_usbh1_resources[] = {
484 {
485 .start = OTG_BASE_ADDR + 0x200,
486 .end = OTG_BASE_ADDR + 0x3ff,
487 .flags = IORESOURCE_MEM,
488 }, {
489 .start = MXC_INT_USB1,
490 .end = MXC_INT_USB1,
491 .flags = IORESOURCE_IRQ,
492 },
493};
494
495struct platform_device mxc_usbh1 = {
496 .name = "mxc-ehci",
497 .id = 1,
498 .dev = {
499 .coherent_dma_mask = 0xffffffff,
500 .dma_mask = &usbh1_dmamask,
501 },
502 .resource = mxc_usbh1_resources,
503 .num_resources = ARRAY_SIZE(mxc_usbh1_resources),
504};
505
506/* USB host 2 */
507static u64 usbh2_dmamask = 0xffffffffUL;
508
509static struct resource mxc_usbh2_resources[] = {
510 {
511 .start = OTG_BASE_ADDR + 0x400,
512 .end = OTG_BASE_ADDR + 0x5ff,
513 .flags = IORESOURCE_MEM,
514 }, {
515 .start = MXC_INT_USB2,
516 .end = MXC_INT_USB2,
517 .flags = IORESOURCE_IRQ,
518 },
519};
520
521struct platform_device mxc_usbh2 = {
522 .name = "mxc-ehci",
523 .id = 2,
524 .dev = {
525 .coherent_dma_mask = 0xffffffff,
526 .dma_mask = &usbh2_dmamask,
527 },
528 .resource = mxc_usbh2_resources,
529 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
530};
531#endif
532
410/* GPIO port description */ 533/* GPIO port description */
411static struct mxc_gpio_port imx_gpio_ports[] = { 534static struct mxc_gpio_port imx_gpio_ports[] = {
412 [0] = { 535 {
413 .chip.label = "gpio-0", 536 .chip.label = "gpio-0",
414 .irq = MXC_INT_GPIO, 537 .irq = MXC_INT_GPIO,
415 .base = IO_ADDRESS(GPIO_BASE_ADDR), 538 .base = IO_ADDRESS(GPIO_BASE_ADDR),
416 .virtual_irq_start = MXC_GPIO_IRQ_START, 539 .virtual_irq_start = MXC_GPIO_IRQ_START,
417 }, 540 }, {
418 [1] = {
419 .chip.label = "gpio-1", 541 .chip.label = "gpio-1",
420 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x100), 542 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
421 .virtual_irq_start = MXC_GPIO_IRQ_START + 32, 543 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
422 }, 544 }, {
423 [2] = {
424 .chip.label = "gpio-2", 545 .chip.label = "gpio-2",
425 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x200), 546 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
426 .virtual_irq_start = MXC_GPIO_IRQ_START + 64, 547 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
427 }, 548 }, {
428 [3] = {
429 .chip.label = "gpio-3", 549 .chip.label = "gpio-3",
430 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x300), 550 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
431 .virtual_irq_start = MXC_GPIO_IRQ_START + 96, 551 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
432 }, 552 }, {
433 [4] = {
434 .chip.label = "gpio-4", 553 .chip.label = "gpio-4",
435 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x400), 554 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x400),
436 .virtual_irq_start = MXC_GPIO_IRQ_START + 128, 555 .virtual_irq_start = MXC_GPIO_IRQ_START + 128,
437 }, 556 }, {
438 [5] = {
439 .chip.label = "gpio-5", 557 .chip.label = "gpio-5",
440 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x500), 558 .base = IO_ADDRESS(GPIO_BASE_ADDR + 0x500),
441 .virtual_irq_start = MXC_GPIO_IRQ_START + 160, 559 .virtual_irq_start = MXC_GPIO_IRQ_START + 160,
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
index 049005bb6aa9..d315406d6725 100644
--- a/arch/arm/mach-mx2/devices.h
+++ b/arch/arm/mach-mx2/devices.h
@@ -4,7 +4,6 @@ extern struct platform_device mxc_gpt3;
4extern struct platform_device mxc_gpt4; 4extern struct platform_device mxc_gpt4;
5extern struct platform_device mxc_gpt5; 5extern struct platform_device mxc_gpt5;
6extern struct platform_device mxc_wdt; 6extern struct platform_device mxc_wdt;
7extern struct platform_device mxc_irda_device;
8extern struct platform_device mxc_uart_device0; 7extern struct platform_device mxc_uart_device0;
9extern struct platform_device mxc_uart_device1; 8extern struct platform_device mxc_uart_device1;
10extern struct platform_device mxc_uart_device2; 9extern struct platform_device mxc_uart_device2;
@@ -20,3 +19,11 @@ extern struct platform_device mxc_i2c_device0;
20extern struct platform_device mxc_i2c_device1; 19extern struct platform_device mxc_i2c_device1;
21extern struct platform_device mxc_sdhc_device0; 20extern struct platform_device mxc_sdhc_device0;
22extern struct platform_device mxc_sdhc_device1; 21extern struct platform_device mxc_sdhc_device1;
22extern struct platform_device mxc_otg_udc_device;
23extern struct platform_device mxc_otg_host;
24extern struct platform_device mxc_usbh1;
25extern struct platform_device mxc_usbh2;
26extern struct platform_device mxc_spi_device0;
27extern struct platform_device mxc_spi_device1;
28extern struct platform_device mxc_spi_device2;
29
diff --git a/arch/arm/mach-mx2/eukrea_cpuimx27.c b/arch/arm/mach-mx2/eukrea_cpuimx27.c
new file mode 100644
index 000000000000..7b187606682c
--- /dev/null
+++ b/arch/arm/mach-mx2/eukrea_cpuimx27.c
@@ -0,0 +1,234 @@
1/*
2 * Copyright (C) 2009 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm038.c which is :
5 * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
6 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301, USA.
21 */
22
23#include <linux/i2c.h>
24#include <linux/io.h>
25#include <linux/mtd/plat-ram.h>
26#include <linux/mtd/physmap.h>
27#include <linux/platform_device.h>
28#include <linux/serial_8250.h>
29
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33#include <asm/mach/map.h>
34
35#include <mach/board-eukrea_cpuimx27.h>
36#include <mach/common.h>
37#include <mach/hardware.h>
38#include <mach/i2c.h>
39#include <mach/iomux.h>
40#include <mach/imx-uart.h>
41#include <mach/mxc_nand.h>
42
43#include "devices.h"
44
45static int eukrea_cpuimx27_pins[] = {
46 /* UART1 */
47 PE12_PF_UART1_TXD,
48 PE13_PF_UART1_RXD,
49 PE14_PF_UART1_CTS,
50 PE15_PF_UART1_RTS,
51 /* UART4 */
52 PB26_AF_UART4_RTS,
53 PB28_AF_UART4_TXD,
54 PB29_AF_UART4_CTS,
55 PB31_AF_UART4_RXD,
56 /* FEC */
57 PD0_AIN_FEC_TXD0,
58 PD1_AIN_FEC_TXD1,
59 PD2_AIN_FEC_TXD2,
60 PD3_AIN_FEC_TXD3,
61 PD4_AOUT_FEC_RX_ER,
62 PD5_AOUT_FEC_RXD1,
63 PD6_AOUT_FEC_RXD2,
64 PD7_AOUT_FEC_RXD3,
65 PD8_AF_FEC_MDIO,
66 PD9_AIN_FEC_MDC,
67 PD10_AOUT_FEC_CRS,
68 PD11_AOUT_FEC_TX_CLK,
69 PD12_AOUT_FEC_RXD0,
70 PD13_AOUT_FEC_RX_DV,
71 PD14_AOUT_FEC_RX_CLK,
72 PD15_AOUT_FEC_COL,
73 PD16_AIN_FEC_TX_ER,
74 PF23_AIN_FEC_TX_EN,
75 /* I2C1 */
76 PD17_PF_I2C_DATA,
77 PD18_PF_I2C_CLK,
78 /* SDHC2 */
79 PB4_PF_SD2_D0,
80 PB5_PF_SD2_D1,
81 PB6_PF_SD2_D2,
82 PB7_PF_SD2_D3,
83 PB8_PF_SD2_CMD,
84 PB9_PF_SD2_CLK,
85#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
86 /* Quad UART's IRQ */
87 GPIO_PORTD | 22 | GPIO_GPIO | GPIO_IN,
88 GPIO_PORTD | 23 | GPIO_GPIO | GPIO_IN,
89 GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN,
90 GPIO_PORTD | 30 | GPIO_GPIO | GPIO_IN,
91#endif
92};
93
94static struct physmap_flash_data eukrea_cpuimx27_flash_data = {
95 .width = 2,
96};
97
98static struct resource eukrea_cpuimx27_flash_resource = {
99 .start = 0xc0000000,
100 .end = 0xc3ffffff,
101 .flags = IORESOURCE_MEM,
102};
103
104static struct platform_device eukrea_cpuimx27_nor_mtd_device = {
105 .name = "physmap-flash",
106 .id = 0,
107 .dev = {
108 .platform_data = &eukrea_cpuimx27_flash_data,
109 },
110 .num_resources = 1,
111 .resource = &eukrea_cpuimx27_flash_resource,
112};
113
114static struct imxuart_platform_data uart_pdata[] = {
115 {
116 .flags = IMXUART_HAVE_RTSCTS,
117 }, {
118 .flags = IMXUART_HAVE_RTSCTS,
119 },
120};
121
122static struct mxc_nand_platform_data eukrea_cpuimx27_nand_board_info = {
123 .width = 1,
124 .hw_ecc = 1,
125};
126
127static struct platform_device *platform_devices[] __initdata = {
128 &eukrea_cpuimx27_nor_mtd_device,
129 &mxc_fec_device,
130};
131
132static struct imxi2c_platform_data eukrea_cpuimx27_i2c_1_data = {
133 .bitrate = 100000,
134};
135
136static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {
137 {
138 I2C_BOARD_INFO("pcf8563", 0x51),
139 },
140};
141
142#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
143static struct plat_serial8250_port serial_platform_data[] = {
144 {
145 .mapbase = (unsigned long)(CS3_BASE_ADDR + 0x200000),
146 .irq = IRQ_GPIOB(23),
147 .uartclk = 14745600,
148 .regshift = 1,
149 .iotype = UPIO_MEM,
150 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
151 }, {
152 .mapbase = (unsigned long)(CS3_BASE_ADDR + 0x400000),
153 .irq = IRQ_GPIOB(22),
154 .uartclk = 14745600,
155 .regshift = 1,
156 .iotype = UPIO_MEM,
157 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
158 }, {
159 .mapbase = (unsigned long)(CS3_BASE_ADDR + 0x800000),
160 .irq = IRQ_GPIOB(27),
161 .uartclk = 14745600,
162 .regshift = 1,
163 .iotype = UPIO_MEM,
164 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
165 }, {
166 .mapbase = (unsigned long)(CS3_BASE_ADDR + 0x1000000),
167 .irq = IRQ_GPIOB(30),
168 .uartclk = 14745600,
169 .regshift = 1,
170 .iotype = UPIO_MEM,
171 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
172 }, {
173 }
174};
175
176static struct platform_device serial_device = {
177 .name = "serial8250",
178 .id = 0,
179 .dev = {
180 .platform_data = serial_platform_data,
181 },
182};
183#endif
184
185static void __init eukrea_cpuimx27_init(void)
186{
187 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
188 ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");
189
190 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
191
192 mxc_register_device(&mxc_nand_device, &eukrea_cpuimx27_nand_board_info);
193
194 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
195 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
196
197 mxc_register_device(&mxc_i2c_device0, &eukrea_cpuimx27_i2c_1_data);
198
199 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
200
201#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
202 /* SDHC2 can be used for Wifi */
203 mxc_register_device(&mxc_sdhc_device1, NULL);
204 /* in which case UART4 is also used for Bluetooth */
205 mxc_register_device(&mxc_uart_device3, &uart_pdata[1]);
206#endif
207
208#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
209 platform_device_register(&serial_device);
210#endif
211
212#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
213 eukrea_mbimx27_baseboard_init();
214#endif
215}
216
217static void __init eukrea_cpuimx27_timer_init(void)
218{
219 mx27_clocks_init(26000000);
220}
221
222static struct sys_timer eukrea_cpuimx27_timer = {
223 .init = eukrea_cpuimx27_timer_init,
224};
225
226MACHINE_START(CPUIMX27, "EUKREA CPUIMX27")
227 .phys_io = AIPI_BASE_ADDR,
228 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
229 .boot_params = PHYS_OFFSET + 0x100,
230 .map_io = mx27_map_io,
231 .init_irq = mx27_init_irq,
232 .init_machine = eukrea_cpuimx27_init,
233 .timer = &eukrea_cpuimx27_timer,
234MACHINE_END
diff --git a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c b/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c
new file mode 100644
index 000000000000..7382b6d27ee1
--- /dev/null
+++ b/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c
@@ -0,0 +1,249 @@
1/*
2 * Copyright (C) 2009 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#include <linux/gpio.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/spi/spi.h>
26#include <linux/spi/ads7846.h>
27
28#include <asm/mach/arch.h>
29
30#include <mach/common.h>
31#include <mach/iomux.h>
32#include <mach/imxfb.h>
33#include <mach/hardware.h>
34#include <mach/mmc.h>
35#include <mach/imx-uart.h>
36
37#include "devices.h"
38
39static int eukrea_mbimx27_pins[] = {
40 /* UART2 */
41 PE3_PF_UART2_CTS,
42 PE4_PF_UART2_RTS,
43 PE6_PF_UART2_TXD,
44 PE7_PF_UART2_RXD,
45 /* UART3 */
46 PE8_PF_UART3_TXD,
47 PE9_PF_UART3_RXD,
48 PE10_PF_UART3_CTS,
49 PE11_PF_UART3_RTS,
50 /* UART4 */
51 PB26_AF_UART4_RTS,
52 PB28_AF_UART4_TXD,
53 PB29_AF_UART4_CTS,
54 PB31_AF_UART4_RXD,
55 /* SDHC1*/
56 PE18_PF_SD1_D0,
57 PE19_PF_SD1_D1,
58 PE20_PF_SD1_D2,
59 PE21_PF_SD1_D3,
60 PE22_PF_SD1_CMD,
61 PE23_PF_SD1_CLK,
62 /* display */
63 PA5_PF_LSCLK,
64 PA6_PF_LD0,
65 PA7_PF_LD1,
66 PA8_PF_LD2,
67 PA9_PF_LD3,
68 PA10_PF_LD4,
69 PA11_PF_LD5,
70 PA12_PF_LD6,
71 PA13_PF_LD7,
72 PA14_PF_LD8,
73 PA15_PF_LD9,
74 PA16_PF_LD10,
75 PA17_PF_LD11,
76 PA18_PF_LD12,
77 PA19_PF_LD13,
78 PA20_PF_LD14,
79 PA21_PF_LD15,
80 PA22_PF_LD16,
81 PA23_PF_LD17,
82 PA28_PF_HSYNC,
83 PA29_PF_VSYNC,
84 PA30_PF_CONTRAST,
85 PA31_PF_OE_ACD,
86 /* SPI1 */
87 PD28_PF_CSPI1_SS0,
88 PD29_PF_CSPI1_SCLK,
89 PD30_PF_CSPI1_MISO,
90 PD31_PF_CSPI1_MOSI,
91};
92
93static struct gpio_led gpio_leds[] = {
94 {
95 .name = "led1",
96 .default_trigger = "heartbeat",
97 .active_low = 1,
98 .gpio = GPIO_PORTF | 16,
99 },
100 {
101 .name = "led2",
102 .default_trigger = "none",
103 .active_low = 1,
104 .gpio = GPIO_PORTF | 19,
105 },
106 {
107 .name = "backlight",
108 .default_trigger = "backlight",
109 .active_low = 0,
110 .gpio = GPIO_PORTE | 5,
111 },
112};
113
114static struct gpio_led_platform_data gpio_led_info = {
115 .leds = gpio_leds,
116 .num_leds = ARRAY_SIZE(gpio_leds),
117};
118
119static struct platform_device leds_gpio = {
120 .name = "leds-gpio",
121 .id = -1,
122 .dev = {
123 .platform_data = &gpio_led_info,
124 },
125};
126
127static struct imx_fb_videomode eukrea_mbimx27_modes[] = {
128 {
129 .mode = {
130 .name = "CMO-QGVA",
131 .refresh = 60,
132 .xres = 320,
133 .yres = 240,
134 .pixclock = 156000,
135 .hsync_len = 30,
136 .left_margin = 38,
137 .right_margin = 20,
138 .vsync_len = 3,
139 .upper_margin = 15,
140 .lower_margin = 4,
141 },
142 .pcr = 0xFAD08B80,
143 .bpp = 16,
144 },
145};
146
147static struct imx_fb_platform_data eukrea_mbimx27_fb_data = {
148 .mode = eukrea_mbimx27_modes,
149 .num_modes = ARRAY_SIZE(eukrea_mbimx27_modes),
150
151 .pwmr = 0x00A903FF,
152 .lscr1 = 0x00120300,
153 .dmacr = 0x00040060,
154};
155
156static struct imxuart_platform_data uart_pdata[] = {
157 {
158 .flags = IMXUART_HAVE_RTSCTS,
159 },
160 {
161 .flags = IMXUART_HAVE_RTSCTS,
162 },
163};
164
165#if defined(CONFIG_TOUCHSCREEN_ADS7846)
166 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
167
168#define ADS7846_PENDOWN (GPIO_PORTD | 25)
169
170static void ads7846_dev_init(void)
171{
172 if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) {
173 printk(KERN_ERR "can't get ads746 pen down GPIO\n");
174 return;
175 }
176
177 gpio_direction_input(ADS7846_PENDOWN);
178}
179
180static int ads7846_get_pendown_state(void)
181{
182 return !gpio_get_value(ADS7846_PENDOWN);
183}
184
185static struct ads7846_platform_data ads7846_config __initdata = {
186 .get_pendown_state = ads7846_get_pendown_state,
187 .keep_vref_on = 1,
188};
189
190static struct spi_board_info eukrea_mbimx27_spi_board_info[] __initdata = {
191 [0] = {
192 .modalias = "ads7846",
193 .bus_num = 0,
194 .chip_select = 0,
195 .max_speed_hz = 1500000,
196 .irq = IRQ_GPIOD(25),
197 .platform_data = &ads7846_config,
198 .mode = SPI_MODE_2,
199 },
200};
201
202static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28};
203
204static struct spi_imx_master eukrea_mbimx27_spi_0_data = {
205 .chipselect = eukrea_mbimx27_spi_cs,
206 .num_chipselect = ARRAY_SIZE(eukrea_mbimx27_spi_cs),
207};
208#endif
209
210static struct platform_device *platform_devices[] __initdata = {
211 &leds_gpio,
212};
213
214/*
215 * system init for baseboard usage. Will be called by cpuimx27 init.
216 *
217 * Add platform devices present on this baseboard and init
218 * them from CPU side as far as required to use them later on
219 */
220void __init eukrea_mbimx27_baseboard_init(void)
221{
222 mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins,
223 ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27");
224
225 mxc_register_device(&mxc_uart_device1, &uart_pdata[0]);
226 mxc_register_device(&mxc_uart_device2, &uart_pdata[1]);
227
228 mxc_register_device(&mxc_fb_device, &eukrea_mbimx27_fb_data);
229 mxc_register_device(&mxc_sdhc_device0, NULL);
230
231#if defined(CONFIG_TOUCHSCREEN_ADS7846)
232 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
233 /* SPI and ADS7846 Touchscreen controler init */
234 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
235 mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN);
236 mxc_register_device(&mxc_spi_device0, &eukrea_mbimx27_spi_0_data);
237 spi_register_board_info(eukrea_mbimx27_spi_board_info,
238 ARRAY_SIZE(eukrea_mbimx27_spi_board_info));
239 ads7846_dev_init();
240#endif
241
242 /* Leds configuration */
243 mxc_gpio_mode(GPIO_PORTF | 16 | GPIO_GPIO | GPIO_OUT);
244 mxc_gpio_mode(GPIO_PORTF | 19 | GPIO_GPIO | GPIO_OUT);
245 /* Backlight */
246 mxc_gpio_mode(GPIO_PORTE | 5 | GPIO_GPIO | GPIO_OUT);
247
248 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
249}
diff --git a/arch/arm/mach-mx2/generic.c b/arch/arm/mach-mx2/generic.c
index 169372f69d8f..ae8f759134d1 100644
--- a/arch/arm/mach-mx2/generic.c
+++ b/arch/arm/mach-mx2/generic.c
@@ -72,6 +72,7 @@ static struct map_desc mxc_io_desc[] __initdata = {
72void __init mx21_map_io(void) 72void __init mx21_map_io(void)
73{ 73{
74 mxc_set_cpu_type(MXC_CPU_MX21); 74 mxc_set_cpu_type(MXC_CPU_MX21);
75 mxc_arch_reset_init(IO_ADDRESS(WDOG_BASE_ADDR));
75 76
76 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 77 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
77} 78}
@@ -79,7 +80,18 @@ void __init mx21_map_io(void)
79void __init mx27_map_io(void) 80void __init mx27_map_io(void)
80{ 81{
81 mxc_set_cpu_type(MXC_CPU_MX27); 82 mxc_set_cpu_type(MXC_CPU_MX27);
83 mxc_arch_reset_init(IO_ADDRESS(WDOG_BASE_ADDR));
82 84
83 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 85 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
84} 86}
85 87
88void __init mx27_init_irq(void)
89{
90 mxc_init_irq(IO_ADDRESS(AVIC_BASE_ADDR));
91}
92
93void __init mx21_init_irq(void)
94{
95 mx27_init_irq();
96}
97
diff --git a/arch/arm/mach-mx2/mx21ads.c b/arch/arm/mach-mx2/mx21ads.c
index a5ee461cb405..cf5f77cbc2f1 100644
--- a/arch/arm/mach-mx2/mx21ads.c
+++ b/arch/arm/mach-mx2/mx21ads.c
@@ -164,25 +164,33 @@ static void mx21ads_fb_exit(struct platform_device *pdev)
164 * Connected is a portrait Sharp-QVGA display 164 * Connected is a portrait Sharp-QVGA display
165 * of type: LQ035Q7DB02 165 * of type: LQ035Q7DB02
166 */ 166 */
167static struct imx_fb_platform_data mx21ads_fb_data = { 167static struct imx_fb_videomode mx21ads_modes[] = {
168 .pixclock = 188679, /* in ps */ 168 {
169 .xres = 240, 169 .mode = {
170 .yres = 320, 170 .name = "Sharp-LQ035Q7",
171 171 .refresh = 60,
172 .bpp = 16, 172 .xres = 240,
173 .hsync_len = 2, 173 .yres = 320,
174 .left_margin = 6, 174 .pixclock = 188679, /* in ps (5.3MHz) */
175 .right_margin = 16, 175 .hsync_len = 2,
176 .left_margin = 6,
177 .right_margin = 16,
178 .vsync_len = 1,
179 .upper_margin = 8,
180 .lower_margin = 10,
181 },
182 .pcr = 0xfb108bc7,
183 .bpp = 16,
184 },
185};
176 186
177 .vsync_len = 1, 187static struct imx_fb_platform_data mx21ads_fb_data = {
178 .upper_margin = 8, 188 .mode = mx21ads_modes,
179 .lower_margin = 10, 189 .num_modes = ARRAY_SIZE(mx21ads_modes),
180 .fixed_screen_cpu = 0,
181 190
182 .pcr = 0xFB108BC7, 191 .pwmr = 0x00a903ff,
183 .pwmr = 0x00A901ff, 192 .lscr1 = 0x00120300,
184 .lscr1 = 0x00120300, 193 .dmacr = 0x00020008,
185 .dmacr = 0x00020008,
186 194
187 .init = mx21ads_fb_init, 195 .init = mx21ads_fb_init,
188 .exit = mx21ads_fb_exit, 196 .exit = mx21ads_fb_exit,
@@ -280,7 +288,7 @@ MACHINE_START(MX21ADS, "Freescale i.MX21ADS")
280 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, 288 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
281 .boot_params = PHYS_OFFSET + 0x100, 289 .boot_params = PHYS_OFFSET + 0x100,
282 .map_io = mx21ads_map_io, 290 .map_io = mx21ads_map_io,
283 .init_irq = mxc_init_irq, 291 .init_irq = mx21_init_irq,
284 .init_machine = mx21ads_board_init, 292 .init_machine = mx21ads_board_init,
285 .timer = &mx21ads_timer, 293 .timer = &mx21ads_timer,
286MACHINE_END 294MACHINE_END
diff --git a/arch/arm/mach-mx2/mx27ads.c b/arch/arm/mach-mx2/mx27ads.c
index 02daddac6995..83e412b713e6 100644
--- a/arch/arm/mach-mx2/mx27ads.c
+++ b/arch/arm/mach-mx2/mx27ads.c
@@ -183,20 +183,29 @@ void lcd_power(int on)
183 __raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_CLEAR_REG); 183 __raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_CLEAR_REG);
184} 184}
185 185
186static struct imx_fb_platform_data mx27ads_fb_data = { 186static struct imx_fb_videomode mx27ads_modes[] = {
187 .pixclock = 188679, 187 {
188 .xres = 240, 188 .mode = {
189 .yres = 320, 189 .name = "Sharp-LQ035Q7",
190 190 .refresh = 60,
191 .bpp = 16, 191 .xres = 240,
192 .hsync_len = 1, 192 .yres = 320,
193 .left_margin = 9, 193 .pixclock = 188679, /* in ps (5.3MHz) */
194 .right_margin = 16, 194 .hsync_len = 1,
195 .left_margin = 9,
196 .right_margin = 16,
197 .vsync_len = 1,
198 .upper_margin = 7,
199 .lower_margin = 9,
200 },
201 .bpp = 16,
202 .pcr = 0xFB008BC0,
203 },
204};
195 205
196 .vsync_len = 1, 206static struct imx_fb_platform_data mx27ads_fb_data = {
197 .upper_margin = 7, 207 .mode = mx27ads_modes,
198 .lower_margin = 9, 208 .num_modes = ARRAY_SIZE(mx27ads_modes),
199 .fixed_screen_cpu = 0,
200 209
201 /* 210 /*
202 * - HSYNC active high 211 * - HSYNC active high
@@ -207,7 +216,6 @@ static struct imx_fb_platform_data mx27ads_fb_data = {
207 * - data enable low active 216 * - data enable low active
208 * - enable sharp mode 217 * - enable sharp mode
209 */ 218 */
210 .pcr = 0xFB008BC0,
211 .pwmr = 0x00A903FF, 219 .pwmr = 0x00A903FF,
212 .lscr1 = 0x00120300, 220 .lscr1 = 0x00120300,
213 .dmacr = 0x00020010, 221 .dmacr = 0x00020010,
@@ -330,7 +338,7 @@ MACHINE_START(MX27ADS, "Freescale i.MX27ADS")
330 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, 338 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
331 .boot_params = PHYS_OFFSET + 0x100, 339 .boot_params = PHYS_OFFSET + 0x100,
332 .map_io = mx27ads_map_io, 340 .map_io = mx27ads_map_io,
333 .init_irq = mxc_init_irq, 341 .init_irq = mx27_init_irq,
334 .init_machine = mx27ads_board_init, 342 .init_machine = mx27ads_board_init,
335 .timer = &mx27ads_timer, 343 .timer = &mx27ads_timer,
336MACHINE_END 344MACHINE_END
diff --git a/arch/arm/mach-mx2/mx27lite.c b/arch/arm/mach-mx2/mx27lite.c
index 3ae11cb8c04b..82ea227ea0cf 100644
--- a/arch/arm/mach-mx2/mx27lite.c
+++ b/arch/arm/mach-mx2/mx27lite.c
@@ -89,7 +89,7 @@ MACHINE_START(IMX27LITE, "LogicPD i.MX27LITE")
89 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, 89 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
90 .boot_params = PHYS_OFFSET + 0x100, 90 .boot_params = PHYS_OFFSET + 0x100,
91 .map_io = mx27_map_io, 91 .map_io = mx27_map_io,
92 .init_irq = mxc_init_irq, 92 .init_irq = mx27_init_irq,
93 .init_machine = mx27lite_init, 93 .init_machine = mx27lite_init,
94 .timer = &mx27lite_timer, 94 .timer = &mx27lite_timer,
95MACHINE_END 95MACHINE_END
diff --git a/arch/arm/mach-mx2/mx27pdk.c b/arch/arm/mach-mx2/mx27pdk.c
index 1d9238c7a6c3..6761d1b79e43 100644
--- a/arch/arm/mach-mx2/mx27pdk.c
+++ b/arch/arm/mach-mx2/mx27pdk.c
@@ -89,7 +89,7 @@ MACHINE_START(MX27_3DS, "Freescale MX27PDK")
89 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, 89 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
90 .boot_params = PHYS_OFFSET + 0x100, 90 .boot_params = PHYS_OFFSET + 0x100,
91 .map_io = mx27_map_io, 91 .map_io = mx27_map_io,
92 .init_irq = mxc_init_irq, 92 .init_irq = mx27_init_irq,
93 .init_machine = mx27pdk_init, 93 .init_machine = mx27pdk_init,
94 .timer = &mx27pdk_timer, 94 .timer = &mx27pdk_timer,
95MACHINE_END 95MACHINE_END
diff --git a/arch/arm/mach-mx2/pca100.c b/arch/arm/mach-mx2/pca100.c
new file mode 100644
index 000000000000..fe5b165b88cc
--- /dev/null
+++ b/arch/arm/mach-mx2/pca100.c
@@ -0,0 +1,244 @@
1/*
2 * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
3 * Copyright (C) 2009 Sascha Hauer (kernel@pengutronix.de)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/i2c.h>
23#include <linux/i2c/at24.h>
24#include <linux/dma-mapping.h>
25#include <linux/spi/spi.h>
26#include <linux/spi/eeprom.h>
27#include <linux/irq.h>
28#include <linux/gpio.h>
29
30#include <asm/mach/arch.h>
31#include <asm/mach-types.h>
32#include <mach/common.h>
33#include <mach/hardware.h>
34#include <mach/iomux.h>
35#include <mach/i2c.h>
36#include <asm/mach/time.h>
37#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
38#include <mach/spi.h>
39#endif
40#include <mach/imx-uart.h>
41#include <mach/mxc_nand.h>
42#include <mach/irqs.h>
43#include <mach/mmc.h>
44
45#include "devices.h"
46
47static int pca100_pins[] = {
48 /* UART1 */
49 PE12_PF_UART1_TXD,
50 PE13_PF_UART1_RXD,
51 PE14_PF_UART1_CTS,
52 PE15_PF_UART1_RTS,
53 /* SDHC */
54 PB4_PF_SD2_D0,
55 PB5_PF_SD2_D1,
56 PB6_PF_SD2_D2,
57 PB7_PF_SD2_D3,
58 PB8_PF_SD2_CMD,
59 PB9_PF_SD2_CLK,
60 /* FEC */
61 PD0_AIN_FEC_TXD0,
62 PD1_AIN_FEC_TXD1,
63 PD2_AIN_FEC_TXD2,
64 PD3_AIN_FEC_TXD3,
65 PD4_AOUT_FEC_RX_ER,
66 PD5_AOUT_FEC_RXD1,
67 PD6_AOUT_FEC_RXD2,
68 PD7_AOUT_FEC_RXD3,
69 PD8_AF_FEC_MDIO,
70 PD9_AIN_FEC_MDC,
71 PD10_AOUT_FEC_CRS,
72 PD11_AOUT_FEC_TX_CLK,
73 PD12_AOUT_FEC_RXD0,
74 PD13_AOUT_FEC_RX_DV,
75 PD14_AOUT_FEC_RX_CLK,
76 PD15_AOUT_FEC_COL,
77 PD16_AIN_FEC_TX_ER,
78 PF23_AIN_FEC_TX_EN,
79 /* SSI1 */
80 PC20_PF_SSI1_FS,
81 PC21_PF_SSI1_RXD,
82 PC22_PF_SSI1_TXD,
83 PC23_PF_SSI1_CLK,
84 /* onboard I2C */
85 PC5_PF_I2C2_SDA,
86 PC6_PF_I2C2_SCL,
87 /* external I2C */
88 PD17_PF_I2C_DATA,
89 PD18_PF_I2C_CLK,
90 /* SPI1 */
91 PD25_PF_CSPI1_RDY,
92 PD29_PF_CSPI1_SCLK,
93 PD30_PF_CSPI1_MISO,
94 PD31_PF_CSPI1_MOSI,
95};
96
97static struct imxuart_platform_data uart_pdata = {
98 .flags = IMXUART_HAVE_RTSCTS,
99};
100
101static struct mxc_nand_platform_data pca100_nand_board_info = {
102 .width = 1,
103 .hw_ecc = 1,
104};
105
106static struct platform_device *platform_devices[] __initdata = {
107 &mxc_w1_master_device,
108 &mxc_fec_device,
109};
110
111static struct imxi2c_platform_data pca100_i2c_1_data = {
112 .bitrate = 100000,
113};
114
115static struct at24_platform_data board_eeprom = {
116 .byte_len = 4096,
117 .page_size = 32,
118 .flags = AT24_FLAG_ADDR16,
119};
120
121static struct i2c_board_info pca100_i2c_devices[] = {
122 {
123 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
124 .platform_data = &board_eeprom,
125 }, {
126 I2C_BOARD_INFO("rtc-pcf8563", 0x51),
127 .type = "pcf8563"
128 }, {
129 I2C_BOARD_INFO("lm75", 0x4a),
130 .type = "lm75"
131 }
132};
133
134#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
135static struct spi_eeprom at25320 = {
136 .name = "at25320an",
137 .byte_len = 4096,
138 .page_size = 32,
139 .flags = EE_ADDR2,
140};
141
142static struct spi_board_info pca100_spi_board_info[] __initdata = {
143 {
144 .modalias = "at25",
145 .max_speed_hz = 30000,
146 .bus_num = 0,
147 .chip_select = 1,
148 .platform_data = &at25320,
149 },
150};
151
152static int pca100_spi_cs[] = {GPIO_PORTD + 28, GPIO_PORTD + 27};
153
154static struct spi_imx_master pca100_spi_0_data = {
155 .chipselect = pca100_spi_cs,
156 .num_chipselect = ARRAY_SIZE(pca100_spi_cs),
157};
158#endif
159
160static int pca100_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
161 void *data)
162{
163 int ret;
164
165 ret = request_irq(IRQ_GPIOC(29), detect_irq,
166 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
167 "imx-mmc-detect", data);
168 if (ret)
169 printk(KERN_ERR
170 "pca100: Failed to reuest irq for sd/mmc detection\n");
171
172 return ret;
173}
174
175static void pca100_sdhc2_exit(struct device *dev, void *data)
176{
177 free_irq(IRQ_GPIOC(29), data);
178}
179
180static struct imxmmc_platform_data sdhc_pdata = {
181 .init = pca100_sdhc2_init,
182 .exit = pca100_sdhc2_exit,
183};
184
185static void __init pca100_init(void)
186{
187 int ret;
188
189 ret = mxc_gpio_setup_multiple_pins(pca100_pins,
190 ARRAY_SIZE(pca100_pins), "PCA100");
191 if (ret)
192 printk(KERN_ERR "pca100: Failed to setup pins (%d)\n", ret);
193
194 mxc_register_device(&mxc_uart_device0, &uart_pdata);
195
196 mxc_gpio_mode(GPIO_PORTC | 29 | GPIO_GPIO | GPIO_IN);
197 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
198
199 mxc_register_device(&mxc_nand_device, &pca100_nand_board_info);
200
201 /* only the i2c master 1 is used on this CPU card */
202 i2c_register_board_info(1, pca100_i2c_devices,
203 ARRAY_SIZE(pca100_i2c_devices));
204
205 mxc_register_device(&mxc_i2c_device1, &pca100_i2c_1_data);
206
207 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
208 mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_OUT);
209
210 /* GPIO0_IRQ */
211 mxc_gpio_mode(GPIO_PORTC | 31 | GPIO_GPIO | GPIO_IN);
212 /* GPIO1_IRQ */
213 mxc_gpio_mode(GPIO_PORTC | 25 | GPIO_GPIO | GPIO_IN);
214 /* GPIO2_IRQ */
215 mxc_gpio_mode(GPIO_PORTE | 5 | GPIO_GPIO | GPIO_IN);
216
217#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
218 spi_register_board_info(pca100_spi_board_info,
219 ARRAY_SIZE(pca100_spi_board_info));
220 mxc_register_device(&mxc_spi_device0, &pca100_spi_0_data);
221#endif
222
223 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
224}
225
226static void __init pca100_timer_init(void)
227{
228 mx27_clocks_init(26000000);
229}
230
231static struct sys_timer pca100_timer = {
232 .init = pca100_timer_init,
233};
234
235MACHINE_START(PCA100, "phyCARD-i.MX27")
236 .phys_io = AIPI_BASE_ADDR,
237 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
238 .boot_params = PHYS_OFFSET + 0x100,
239 .map_io = mx27_map_io,
240 .init_irq = mxc_init_irq,
241 .init_machine = pca100_init,
242 .timer = &pca100_timer,
243MACHINE_END
244
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c
index a4628d004343..ee65dda584cf 100644
--- a/arch/arm/mach-mx2/pcm038.c
+++ b/arch/arm/mach-mx2/pcm038.c
@@ -186,17 +186,13 @@ static struct at24_platform_data board_eeprom = {
186}; 186};
187 187
188static struct i2c_board_info pcm038_i2c_devices[] = { 188static struct i2c_board_info pcm038_i2c_devices[] = {
189 [0] = { 189 {
190 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ 190 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
191 .platform_data = &board_eeprom, 191 .platform_data = &board_eeprom,
192 }, 192 }, {
193 [1] = { 193 I2C_BOARD_INFO("pcf8563", 0x51),
194 I2C_BOARD_INFO("rtc-pcf8563", 0x51), 194 }, {
195 .type = "pcf8563"
196 },
197 [2] = {
198 I2C_BOARD_INFO("lm75", 0x4a), 195 I2C_BOARD_INFO("lm75", 0x4a),
199 .type = "lm75"
200 } 196 }
201}; 197};
202 198
@@ -220,6 +216,9 @@ static void __init pcm038_init(void)
220 216
221 mxc_register_device(&mxc_i2c_device1, &pcm038_i2c_1_data); 217 mxc_register_device(&mxc_i2c_device1, &pcm038_i2c_1_data);
222 218
219 /* PE18 for user-LED D40 */
220 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT);
221
223 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 222 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
224 223
225#ifdef CONFIG_MACH_PCM970_BASEBOARD 224#ifdef CONFIG_MACH_PCM970_BASEBOARD
@@ -241,7 +240,7 @@ MACHINE_START(PCM038, "phyCORE-i.MX27")
241 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, 240 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
242 .boot_params = PHYS_OFFSET + 0x100, 241 .boot_params = PHYS_OFFSET + 0x100,
243 .map_io = mx27_map_io, 242 .map_io = mx27_map_io,
244 .init_irq = mxc_init_irq, 243 .init_irq = mx27_init_irq,
245 .init_machine = pcm038_init, 244 .init_machine = pcm038_init,
246 .timer = &pcm038_timer, 245 .timer = &pcm038_timer,
247MACHINE_END 246MACHINE_END
diff --git a/arch/arm/mach-mx2/pcm970-baseboard.c b/arch/arm/mach-mx2/pcm970-baseboard.c
index 6a3acaf57dd4..c261f59b0b4c 100644
--- a/arch/arm/mach-mx2/pcm970-baseboard.c
+++ b/arch/arm/mach-mx2/pcm970-baseboard.c
@@ -19,6 +19,7 @@
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/can/platform/sja1000.h>
22 23
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24 25
@@ -125,40 +126,96 @@ static struct imxmmc_platform_data sdhc_pdata = {
125 .exit = pcm970_sdhc2_exit, 126 .exit = pcm970_sdhc2_exit,
126}; 127};
127 128
128/* 129static struct imx_fb_videomode pcm970_modes[] = {
129 * Connected is a portrait Sharp-QVGA display 130 {
130 * of type: LQ035Q7DH06 131 .mode = {
131 */ 132 .name = "Sharp-LQ035Q7",
132static struct imx_fb_platform_data pcm038_fb_data = { 133 .refresh = 60,
133 .pixclock = 188679, /* in ps (5.3MHz) */ 134 .xres = 240,
134 .xres = 240, 135 .yres = 320,
135 .yres = 320, 136 .pixclock = 188679, /* in ps (5.3MHz) */
136 137 .hsync_len = 7,
137 .bpp = 16, 138 .left_margin = 5,
138 .hsync_len = 7, 139 .right_margin = 16,
139 .left_margin = 5, 140 .vsync_len = 1,
140 .right_margin = 16, 141 .upper_margin = 7,
142 .lower_margin = 9,
143 },
144 /*
145 * - HSYNC active high
146 * - VSYNC active high
147 * - clk notenabled while idle
148 * - clock not inverted
149 * - data not inverted
150 * - data enable low active
151 * - enable sharp mode
152 */
153 .pcr = 0xF00080C0,
154 .bpp = 16,
155 }, {
156 .mode = {
157 .name = "TX090",
158 .refresh = 60,
159 .xres = 240,
160 .yres = 320,
161 .pixclock = 38255,
162 .left_margin = 144,
163 .right_margin = 0,
164 .upper_margin = 7,
165 .lower_margin = 40,
166 .hsync_len = 96,
167 .vsync_len = 1,
168 },
169 /*
170 * - HSYNC active low (1 << 22)
171 * - VSYNC active low (1 << 23)
172 * - clk notenabled while idle
173 * - clock not inverted
174 * - data not inverted
175 * - data enable low active
176 * - enable sharp mode
177 */
178 .pcr = 0xF0008080 | (1<<22) | (1<<23) | (1<<19),
179 .bpp = 32,
180 },
181};
141 182
142 .vsync_len = 1, 183static struct imx_fb_platform_data pcm038_fb_data = {
143 .upper_margin = 7, 184 .mode = pcm970_modes,
144 .lower_margin = 9, 185 .num_modes = ARRAY_SIZE(pcm970_modes),
145 .fixed_screen_cpu = 0,
146 186
147 /*
148 * - HSYNC active high
149 * - VSYNC active high
150 * - clk notenabled while idle
151 * - clock not inverted
152 * - data not inverted
153 * - data enable low active
154 * - enable sharp mode
155 */
156 .pcr = 0xFA0080C0,
157 .pwmr = 0x00A903FF, 187 .pwmr = 0x00A903FF,
158 .lscr1 = 0x00120300, 188 .lscr1 = 0x00120300,
159 .dmacr = 0x00020010, 189 .dmacr = 0x00020010,
160}; 190};
161 191
192static struct resource pcm970_sja1000_resources[] = {
193 {
194 .start = CS4_BASE_ADDR,
195 .end = CS4_BASE_ADDR + 0x100 - 1,
196 .flags = IORESOURCE_MEM,
197 }, {
198 .start = IRQ_GPIOE(19),
199 .end = IRQ_GPIOE(19),
200 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
201 },
202};
203
204struct sja1000_platform_data pcm970_sja1000_platform_data = {
205 .clock = 16000000 / 2,
206 .ocr = 0x40 | 0x18,
207 .cdr = 0x40,
208};
209
210static struct platform_device pcm970_sja1000 = {
211 .name = "sja1000_platform",
212 .dev = {
213 .platform_data = &pcm970_sja1000_platform_data,
214 },
215 .resource = pcm970_sja1000_resources,
216 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
217};
218
162/* 219/*
163 * system init for baseboard usage. Will be called by pcm038 init. 220 * system init for baseboard usage. Will be called by pcm038 init.
164 * 221 *
@@ -172,4 +229,5 @@ void __init pcm970_baseboard_init(void)
172 229
173 mxc_register_device(&mxc_fb_device, &pcm038_fb_data); 230 mxc_register_device(&mxc_fb_device, &pcm038_fb_data);
174 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); 231 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
232 platform_device_register(&pcm970_sja1000);
175} 233}
diff --git a/arch/arm/mach-mx25/Kconfig b/arch/arm/mach-mx25/Kconfig
new file mode 100644
index 000000000000..cc28f56eae80
--- /dev/null
+++ b/arch/arm/mach-mx25/Kconfig
@@ -0,0 +1,9 @@
1if ARCH_MX25
2
3comment "MX25 platforms:"
4
5config MACH_MX25_3DS
6 select ARCH_MXC_IOMUX_V3
7 bool "Support MX25PDK (3DS) Platform"
8
9endif
diff --git a/arch/arm/mach-mx25/Makefile b/arch/arm/mach-mx25/Makefile
new file mode 100644
index 000000000000..fe23836a9f3d
--- /dev/null
+++ b/arch/arm/mach-mx25/Makefile
@@ -0,0 +1,3 @@
1obj-y := mm.o devices.o
2obj-$(CONFIG_ARCH_MX25) += clock.o
3obj-$(CONFIG_MACH_MX25_3DS) += mx25pdk.o
diff --git a/arch/arm/mach-mx25/Makefile.boot b/arch/arm/mach-mx25/Makefile.boot
new file mode 100644
index 000000000000..e1dd366f836b
--- /dev/null
+++ b/arch/arm/mach-mx25/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x80008000
2params_phys-y := 0x80000100
3initrd_phys-y := 0x80800000
diff --git a/arch/arm/mach-mx25/clock.c b/arch/arm/mach-mx25/clock.c
new file mode 100644
index 000000000000..ef26951a5275
--- /dev/null
+++ b/arch/arm/mach-mx25/clock.c
@@ -0,0 +1,219 @@
1/*
2 * Copyright (C) 2009 by Sascha Hauer, Pengutronix
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/list.h>
22#include <linux/clk.h>
23#include <linux/io.h>
24
25#include <asm/clkdev.h>
26
27#include <mach/clock.h>
28#include <mach/hardware.h>
29#include <mach/common.h>
30#include <mach/mx25.h>
31
32#define CRM_BASE MX25_IO_ADDRESS(MX25_CRM_BASE_ADDR)
33
34#define CCM_MPCTL 0x00
35#define CCM_UPCTL 0x04
36#define CCM_CCTL 0x08
37#define CCM_CGCR0 0x0C
38#define CCM_CGCR1 0x10
39#define CCM_CGCR2 0x14
40#define CCM_PCDR0 0x18
41#define CCM_PCDR1 0x1C
42#define CCM_PCDR2 0x20
43#define CCM_PCDR3 0x24
44#define CCM_RCSR 0x28
45#define CCM_CRDR 0x2C
46#define CCM_DCVR0 0x30
47#define CCM_DCVR1 0x34
48#define CCM_DCVR2 0x38
49#define CCM_DCVR3 0x3c
50#define CCM_LTR0 0x40
51#define CCM_LTR1 0x44
52#define CCM_LTR2 0x48
53#define CCM_LTR3 0x4c
54
55static unsigned long get_rate_mpll(void)
56{
57 ulong mpctl = __raw_readl(CRM_BASE + CCM_MPCTL);
58
59 return mxc_decode_pll(mpctl, 24000000);
60}
61
62static unsigned long get_rate_upll(void)
63{
64 ulong mpctl = __raw_readl(CRM_BASE + CCM_UPCTL);
65
66 return mxc_decode_pll(mpctl, 24000000);
67}
68
69unsigned long get_rate_arm(struct clk *clk)
70{
71 unsigned long cctl = readl(CRM_BASE + CCM_CCTL);
72 unsigned long rate = get_rate_mpll();
73
74 if (cctl & (1 << 14))
75 rate = (rate * 3) >> 1;
76
77 return rate / ((cctl >> 30) + 1);
78}
79
80static unsigned long get_rate_ahb(struct clk *clk)
81{
82 unsigned long cctl = readl(CRM_BASE + CCM_CCTL);
83
84 return get_rate_arm(NULL) / (((cctl >> 28) & 0x3) + 1);
85}
86
87static unsigned long get_rate_ipg(struct clk *clk)
88{
89 return get_rate_ahb(NULL) >> 1;
90}
91
92static unsigned long get_rate_per(int per)
93{
94 unsigned long ofs = (per & 0x3) * 8;
95 unsigned long reg = per & ~0x3;
96 unsigned long val = (readl(CRM_BASE + CCM_PCDR0 + reg) >> ofs) & 0x3f;
97 unsigned long fref;
98
99 if (readl(CRM_BASE + 0x64) & (1 << per))
100 fref = get_rate_upll();
101 else
102 fref = get_rate_ipg(NULL);
103
104 return fref / (val + 1);
105}
106
107static unsigned long get_rate_uart(struct clk *clk)
108{
109 return get_rate_per(15);
110}
111
112static unsigned long get_rate_i2c(struct clk *clk)
113{
114 return get_rate_per(6);
115}
116
117static unsigned long get_rate_nfc(struct clk *clk)
118{
119 return get_rate_per(8);
120}
121
122static unsigned long get_rate_otg(struct clk *clk)
123{
124 return 48000000; /* FIXME */
125}
126
127static int clk_cgcr_enable(struct clk *clk)
128{
129 u32 reg;
130
131 reg = __raw_readl(clk->enable_reg);
132 reg |= 1 << clk->enable_shift;
133 __raw_writel(reg, clk->enable_reg);
134
135 return 0;
136}
137
138static void clk_cgcr_disable(struct clk *clk)
139{
140 u32 reg;
141
142 reg = __raw_readl(clk->enable_reg);
143 reg &= ~(1 << clk->enable_shift);
144 __raw_writel(reg, clk->enable_reg);
145}
146
147#define DEFINE_CLOCK(name, i, er, es, gr, sr) \
148 static struct clk name = { \
149 .id = i, \
150 .enable_reg = CRM_BASE + er, \
151 .enable_shift = es, \
152 .get_rate = gr, \
153 .set_rate = sr, \
154 .enable = clk_cgcr_enable, \
155 .disable = clk_cgcr_disable, \
156 }
157
158DEFINE_CLOCK(gpt_clk, 0, CCM_CGCR0, 5, get_rate_ipg, NULL);
159DEFINE_CLOCK(cspi1_clk, 0, CCM_CGCR1, 5, get_rate_ipg, NULL);
160DEFINE_CLOCK(cspi2_clk, 0, CCM_CGCR1, 6, get_rate_ipg, NULL);
161DEFINE_CLOCK(cspi3_clk, 0, CCM_CGCR1, 7, get_rate_ipg, NULL);
162DEFINE_CLOCK(uart1_clk, 0, CCM_CGCR2, 14, get_rate_uart, NULL);
163DEFINE_CLOCK(uart2_clk, 0, CCM_CGCR2, 15, get_rate_uart, NULL);
164DEFINE_CLOCK(uart3_clk, 0, CCM_CGCR2, 16, get_rate_uart, NULL);
165DEFINE_CLOCK(uart4_clk, 0, CCM_CGCR2, 17, get_rate_uart, NULL);
166DEFINE_CLOCK(uart5_clk, 0, CCM_CGCR2, 18, get_rate_uart, NULL);
167DEFINE_CLOCK(nfc_clk, 0, CCM_CGCR0, 8, get_rate_nfc, NULL);
168DEFINE_CLOCK(usbotg_clk, 0, CCM_CGCR0, 28, get_rate_otg, NULL);
169DEFINE_CLOCK(pwm1_clk, 0, CCM_CGCR1, 31, get_rate_ipg, NULL);
170DEFINE_CLOCK(pwm2_clk, 0, CCM_CGCR2, 0, get_rate_ipg, NULL);
171DEFINE_CLOCK(pwm3_clk, 0, CCM_CGCR2, 1, get_rate_ipg, NULL);
172DEFINE_CLOCK(pwm4_clk, 0, CCM_CGCR2, 2, get_rate_ipg, NULL);
173DEFINE_CLOCK(kpp_clk, 0, CCM_CGCR1, 28, get_rate_ipg, NULL);
174DEFINE_CLOCK(tsc_clk, 0, CCM_CGCR2, 13, get_rate_ipg, NULL);
175DEFINE_CLOCK(i2c_clk, 0, CCM_CGCR0, 6, get_rate_i2c, NULL);
176
177#define _REGISTER_CLOCK(d, n, c) \
178 { \
179 .dev_id = d, \
180 .con_id = n, \
181 .clk = &c, \
182 },
183
184static struct clk_lookup lookups[] = {
185 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk)
186 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk)
187 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
188 _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk)
189 _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk)
190 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk)
191 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)
192 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
193 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk)
194 _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk)
195 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk)
196 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk)
197 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk)
198 _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk)
199 _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk)
200 _REGISTER_CLOCK("mxc_pwm.2", NULL, pwm3_clk)
201 _REGISTER_CLOCK("mxc_pwm.3", NULL, pwm4_clk)
202 _REGISTER_CLOCK("mxc-keypad", NULL, kpp_clk)
203 _REGISTER_CLOCK("mx25-adc", NULL, tsc_clk)
204 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
205 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
206 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
207};
208
209int __init mx25_clocks_init(unsigned long fref)
210{
211 int i;
212
213 for (i = 0; i < ARRAY_SIZE(lookups); i++)
214 clkdev_add(&lookups[i]);
215
216 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
217
218 return 0;
219}
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c
new file mode 100644
index 000000000000..eb12de1da42d
--- /dev/null
+++ b/arch/arm/mach-mx25/devices.c
@@ -0,0 +1,402 @@
1#include <linux/platform_device.h>
2#include <linux/gpio.h>
3#include <mach/mx25.h>
4#include <mach/irqs.h>
5
6static struct resource uart0[] = {
7 {
8 .start = 0x43f90000,
9 .end = 0x43f93fff,
10 .flags = IORESOURCE_MEM,
11 }, {
12 .start = 45,
13 .end = 45,
14 .flags = IORESOURCE_IRQ,
15 },
16};
17
18struct platform_device mxc_uart_device0 = {
19 .name = "imx-uart",
20 .id = 0,
21 .resource = uart0,
22 .num_resources = ARRAY_SIZE(uart0),
23};
24
25static struct resource uart1[] = {
26 {
27 .start = 0x43f94000,
28 .end = 0x43f97fff,
29 .flags = IORESOURCE_MEM,
30 }, {
31 .start = 32,
32 .end = 32,
33 .flags = IORESOURCE_IRQ,
34 },
35};
36
37struct platform_device mxc_uart_device1 = {
38 .name = "imx-uart",
39 .id = 1,
40 .resource = uart1,
41 .num_resources = ARRAY_SIZE(uart1),
42};
43
44static struct resource uart2[] = {
45 {
46 .start = 0x5000c000,
47 .end = 0x5000ffff,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = 18,
51 .end = 18,
52 .flags = IORESOURCE_IRQ,
53 },
54};
55
56struct platform_device mxc_uart_device2 = {
57 .name = "imx-uart",
58 .id = 2,
59 .resource = uart2,
60 .num_resources = ARRAY_SIZE(uart2),
61};
62
63static struct resource uart3[] = {
64 {
65 .start = 0x50008000,
66 .end = 0x5000bfff,
67 .flags = IORESOURCE_MEM,
68 }, {
69 .start = 5,
70 .end = 5,
71 .flags = IORESOURCE_IRQ,
72 },
73};
74
75struct platform_device mxc_uart_device3 = {
76 .name = "imx-uart",
77 .id = 3,
78 .resource = uart3,
79 .num_resources = ARRAY_SIZE(uart3),
80};
81
82static struct resource uart4[] = {
83 {
84 .start = 0x5002c000,
85 .end = 0x5002ffff,
86 .flags = IORESOURCE_MEM,
87 }, {
88 .start = 40,
89 .end = 40,
90 .flags = IORESOURCE_IRQ,
91 },
92};
93
94struct platform_device mxc_uart_device4 = {
95 .name = "imx-uart",
96 .id = 4,
97 .resource = uart4,
98 .num_resources = ARRAY_SIZE(uart4),
99};
100
101#define MX25_OTG_BASE_ADDR 0x53FF4000
102
103static u64 otg_dmamask = DMA_BIT_MASK(32);
104
105static struct resource mxc_otg_resources[] = {
106 {
107 .start = MX25_OTG_BASE_ADDR,
108 .end = MX25_OTG_BASE_ADDR + 0x1ff,
109 .flags = IORESOURCE_MEM,
110 }, {
111 .start = 37,
112 .end = 37,
113 .flags = IORESOURCE_IRQ,
114 },
115};
116
117struct platform_device mxc_otg = {
118 .name = "mxc-ehci",
119 .id = 0,
120 .dev = {
121 .coherent_dma_mask = 0xffffffff,
122 .dma_mask = &otg_dmamask,
123 },
124 .resource = mxc_otg_resources,
125 .num_resources = ARRAY_SIZE(mxc_otg_resources),
126};
127
128/* OTG gadget device */
129struct platform_device otg_udc_device = {
130 .name = "fsl-usb2-udc",
131 .id = -1,
132 .dev = {
133 .dma_mask = &otg_dmamask,
134 .coherent_dma_mask = 0xffffffff,
135 },
136 .resource = mxc_otg_resources,
137 .num_resources = ARRAY_SIZE(mxc_otg_resources),
138};
139
140static u64 usbh2_dmamask = DMA_BIT_MASK(32);
141
142static struct resource mxc_usbh2_resources[] = {
143 {
144 .start = MX25_OTG_BASE_ADDR + 0x400,
145 .end = MX25_OTG_BASE_ADDR + 0x5ff,
146 .flags = IORESOURCE_MEM,
147 }, {
148 .start = 35,
149 .end = 35,
150 .flags = IORESOURCE_IRQ,
151 },
152};
153
154struct platform_device mxc_usbh2 = {
155 .name = "mxc-ehci",
156 .id = 1,
157 .dev = {
158 .coherent_dma_mask = 0xffffffff,
159 .dma_mask = &usbh2_dmamask,
160 },
161 .resource = mxc_usbh2_resources,
162 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
163};
164
165static struct resource mxc_spi_resources0[] = {
166 {
167 .start = 0x43fa4000,
168 .end = 0x43fa7fff,
169 .flags = IORESOURCE_MEM,
170 }, {
171 .start = 14,
172 .end = 14,
173 .flags = IORESOURCE_IRQ,
174 },
175};
176
177struct platform_device mxc_spi_device0 = {
178 .name = "spi_imx",
179 .id = 0,
180 .num_resources = ARRAY_SIZE(mxc_spi_resources0),
181 .resource = mxc_spi_resources0,
182};
183
184static struct resource mxc_spi_resources1[] = {
185 {
186 .start = 0x50010000,
187 .end = 0x50013fff,
188 .flags = IORESOURCE_MEM,
189 }, {
190 .start = 13,
191 .end = 13,
192 .flags = IORESOURCE_IRQ,
193 },
194};
195
196struct platform_device mxc_spi_device1 = {
197 .name = "spi_imx",
198 .id = 1,
199 .num_resources = ARRAY_SIZE(mxc_spi_resources1),
200 .resource = mxc_spi_resources1,
201};
202
203static struct resource mxc_spi_resources2[] = {
204 {
205 .start = 0x50004000,
206 .end = 0x50007fff,
207 .flags = IORESOURCE_MEM,
208 }, {
209 .start = 0,
210 .end = 0,
211 .flags = IORESOURCE_IRQ,
212 },
213};
214
215struct platform_device mxc_spi_device2 = {
216 .name = "spi_imx",
217 .id = 2,
218 .num_resources = ARRAY_SIZE(mxc_spi_resources2),
219 .resource = mxc_spi_resources2,
220};
221
222static struct resource mxc_pwm_resources0[] = {
223 {
224 .start = 0x53fe0000,
225 .end = 0x53fe3fff,
226 .flags = IORESOURCE_MEM,
227 }, {
228 .start = 26,
229 .end = 26,
230 .flags = IORESOURCE_IRQ,
231 }
232};
233
234struct platform_device mxc_pwm_device0 = {
235 .name = "mxc_pwm",
236 .id = 0,
237 .num_resources = ARRAY_SIZE(mxc_pwm_resources0),
238 .resource = mxc_pwm_resources0,
239};
240
241static struct resource mxc_pwm_resources1[] = {
242 {
243 .start = 0x53fa0000,
244 .end = 0x53fa3fff,
245 .flags = IORESOURCE_MEM,
246 }, {
247 .start = 36,
248 .end = 36,
249 .flags = IORESOURCE_IRQ,
250 }
251};
252
253struct platform_device mxc_pwm_device1 = {
254 .name = "mxc_pwm",
255 .id = 1,
256 .num_resources = ARRAY_SIZE(mxc_pwm_resources1),
257 .resource = mxc_pwm_resources1,
258};
259
260static struct resource mxc_pwm_resources2[] = {
261 {
262 .start = 0x53fa8000,
263 .end = 0x53fabfff,
264 .flags = IORESOURCE_MEM,
265 }, {
266 .start = 41,
267 .end = 41,
268 .flags = IORESOURCE_IRQ,
269 }
270};
271
272struct platform_device mxc_pwm_device2 = {
273 .name = "mxc_pwm",
274 .id = 2,
275 .num_resources = ARRAY_SIZE(mxc_pwm_resources2),
276 .resource = mxc_pwm_resources2,
277};
278
279static struct resource mxc_keypad_resources[] = {
280 {
281 .start = 0x43fa8000,
282 .end = 0x43fabfff,
283 .flags = IORESOURCE_MEM,
284 }, {
285 .start = 24,
286 .end = 24,
287 .flags = IORESOURCE_IRQ,
288 }
289};
290
291struct platform_device mxc_keypad_device = {
292 .name = "mxc-keypad",
293 .id = -1,
294 .num_resources = ARRAY_SIZE(mxc_keypad_resources),
295 .resource = mxc_keypad_resources,
296};
297
298static struct resource mxc_pwm_resources3[] = {
299 {
300 .start = 0x53fc8000,
301 .end = 0x53fcbfff,
302 .flags = IORESOURCE_MEM,
303 }, {
304 .start = 42,
305 .end = 42,
306 .flags = IORESOURCE_IRQ,
307 }
308};
309
310struct platform_device mxc_pwm_device3 = {
311 .name = "mxc_pwm",
312 .id = 3,
313 .num_resources = ARRAY_SIZE(mxc_pwm_resources3),
314 .resource = mxc_pwm_resources3,
315};
316
317static struct resource mxc_i2c_1_resources[] = {
318 {
319 .start = 0x43f80000,
320 .end = 0x43f83fff,
321 .flags = IORESOURCE_MEM,
322 }, {
323 .start = 3,
324 .end = 3,
325 .flags = IORESOURCE_IRQ,
326 }
327};
328
329struct platform_device mxc_i2c_device0 = {
330 .name = "imx-i2c",
331 .id = 0,
332 .num_resources = ARRAY_SIZE(mxc_i2c_1_resources),
333 .resource = mxc_i2c_1_resources,
334};
335
336static struct resource mxc_i2c_2_resources[] = {
337 {
338 .start = 0x43f98000,
339 .end = 0x43f9bfff,
340 .flags = IORESOURCE_MEM,
341 }, {
342 .start = 4,
343 .end = 4,
344 .flags = IORESOURCE_IRQ,
345 }
346};
347
348struct platform_device mxc_i2c_device1 = {
349 .name = "imx-i2c",
350 .id = 1,
351 .num_resources = ARRAY_SIZE(mxc_i2c_2_resources),
352 .resource = mxc_i2c_2_resources,
353};
354
355static struct resource mxc_i2c_3_resources[] = {
356 {
357 .start = 0x43f84000,
358 .end = 0x43f87fff,
359 .flags = IORESOURCE_MEM,
360 }, {
361 .start = 10,
362 .end = 10,
363 .flags = IORESOURCE_IRQ,
364 }
365};
366
367struct platform_device mxc_i2c_device2 = {
368 .name = "imx-i2c",
369 .id = 2,
370 .num_resources = ARRAY_SIZE(mxc_i2c_3_resources),
371 .resource = mxc_i2c_3_resources,
372};
373
374static struct mxc_gpio_port imx_gpio_ports[] = {
375 {
376 .chip.label = "gpio-0",
377 .base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
378 .irq = 52,
379 .virtual_irq_start = MXC_GPIO_IRQ_START,
380 }, {
381 .chip.label = "gpio-1",
382 .base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
383 .irq = 51,
384 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
385 }, {
386 .chip.label = "gpio-2",
387 .base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
388 .irq = 16,
389 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
390 }, {
391 .chip.label = "gpio-3",
392 .base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
393 .irq = 23,
394 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
395 }
396};
397
398int __init mxc_register_gpios(void)
399{
400 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
401}
402
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h
new file mode 100644
index 000000000000..fe6bf88ad1dd
--- /dev/null
+++ b/arch/arm/mach-mx25/devices.h
@@ -0,0 +1,19 @@
1extern struct platform_device mxc_uart_device0;
2extern struct platform_device mxc_uart_device1;
3extern struct platform_device mxc_uart_device2;
4extern struct platform_device mxc_uart_device3;
5extern struct platform_device mxc_uart_device4;
6extern struct platform_device mxc_otg;
7extern struct platform_device otg_udc_device;
8extern struct platform_device mxc_usbh2;
9extern struct platform_device mxc_spi_device0;
10extern struct platform_device mxc_spi_device1;
11extern struct platform_device mxc_spi_device2;
12extern struct platform_device mxc_pwm_device0;
13extern struct platform_device mxc_pwm_device1;
14extern struct platform_device mxc_pwm_device2;
15extern struct platform_device mxc_pwm_device3;
16extern struct platform_device mxc_keypad_device;
17extern struct platform_device mxc_i2c_device0;
18extern struct platform_device mxc_i2c_device1;
19extern struct platform_device mxc_i2c_device2;
diff --git a/arch/arm/mach-mx25/mm.c b/arch/arm/mach-mx25/mm.c
new file mode 100644
index 000000000000..a7e587ff3e9e
--- /dev/null
+++ b/arch/arm/mach-mx25/mm.c
@@ -0,0 +1,76 @@
1/*
2 * Copyright (C) 1999,2000 Arm Limited
3 * Copyright (C) 2000 Deep Blue Solutions Ltd
4 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
5 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
6 * - add MX31 specific definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/mm.h>
24#include <linux/init.h>
25#include <linux/err.h>
26
27#include <asm/pgtable.h>
28#include <asm/mach/map.h>
29
30#include <mach/common.h>
31#include <mach/hardware.h>
32#include <mach/mx25.h>
33#include <mach/iomux-v3.h>
34
35/*
36 * This table defines static virtual address mappings for I/O regions.
37 * These are the mappings common across all MX3 boards.
38 */
39static struct map_desc mxc_io_desc[] __initdata = {
40 {
41 .virtual = MX25_AVIC_BASE_ADDR_VIRT,
42 .pfn = __phys_to_pfn(MX25_AVIC_BASE_ADDR),
43 .length = MX25_AVIC_SIZE,
44 .type = MT_DEVICE_NONSHARED
45 }, {
46 .virtual = MX25_AIPS1_BASE_ADDR_VIRT,
47 .pfn = __phys_to_pfn(MX25_AIPS1_BASE_ADDR),
48 .length = MX25_AIPS1_SIZE,
49 .type = MT_DEVICE_NONSHARED
50 }, {
51 .virtual = MX25_AIPS2_BASE_ADDR_VIRT,
52 .pfn = __phys_to_pfn(MX25_AIPS2_BASE_ADDR),
53 .length = MX25_AIPS2_SIZE,
54 .type = MT_DEVICE_NONSHARED
55 },
56};
57
58/*
59 * This function initializes the memory map. It is called during the
60 * system startup to create static physical to virtual memory mappings
61 * for the IO modules.
62 */
63void __init mx25_map_io(void)
64{
65 mxc_set_cpu_type(MXC_CPU_MX25);
66 mxc_iomux_v3_init(MX25_IO_ADDRESS(MX25_IOMUXC_BASE_ADDR));
67 mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR));
68
69 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
70}
71
72void __init mx25_init_irq(void)
73{
74 mxc_init_irq((void __iomem *)MX25_AVIC_BASE_ADDR_VIRT);
75}
76
diff --git a/arch/arm/mach-mx25/mx25pdk.c b/arch/arm/mach-mx25/mx25pdk.c
new file mode 100644
index 000000000000..92aa4fd19d99
--- /dev/null
+++ b/arch/arm/mach-mx25/mx25pdk.c
@@ -0,0 +1,58 @@
1#include <linux/types.h>
2#include <linux/init.h>
3#include <linux/clk.h>
4#include <linux/irq.h>
5#include <linux/gpio.h>
6#include <linux/smsc911x.h>
7#include <linux/platform_device.h>
8
9#include <mach/hardware.h>
10#include <asm/mach-types.h>
11#include <asm/mach/arch.h>
12#include <asm/mach/time.h>
13#include <asm/memory.h>
14#include <asm/mach/map.h>
15#include <mach/common.h>
16#include <mach/imx-uart.h>
17#include <mach/mx25.h>
18#include <mach/mxc_nand.h>
19#include "devices.h"
20#include <mach/iomux-v3.h>
21
22static struct imxuart_platform_data uart_pdata = {
23 .flags = IMXUART_HAVE_RTSCTS,
24};
25
26static struct mxc_nand_platform_data nand_board_info = {
27 .width = 1,
28 .hw_ecc = 1,
29};
30
31static void __init mx25pdk_init(void)
32{
33 mxc_register_device(&mxc_uart_device0, &uart_pdata);
34 mxc_register_device(&mxc_usbh2, NULL);
35 mxc_register_device(&mxc_nand_device, &nand_board_info);
36}
37
38
39static void __init mx25pdk_timer_init(void)
40{
41 mx25_clocks_init(26000000);
42}
43
44static struct sys_timer mx25pdk_timer = {
45 .init = mx25pdk_timer_init,
46};
47
48MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
49 /* Maintainer: Freescale Semiconductor, Inc. */
50 .phys_io = MX25_AIPS1_BASE_ADDR,
51 .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
52 .boot_params = PHYS_OFFSET + 0x100,
53 .map_io = mx25_map_io,
54 .init_irq = mx25_init_irq,
55 .init_machine = mx25pdk_init,
56 .timer = &mx25pdk_timer,
57MACHINE_END
58
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 17a21a291e2f..851f2458bf65 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -36,6 +36,14 @@ config MACH_PCM037
36 Include support for Phytec pcm037 platform. This includes 36 Include support for Phytec pcm037 platform. This includes
37 specific configurations for the board and its peripherals. 37 specific configurations for the board and its peripherals.
38 38
39config MACH_PCM037_EET
40 bool "Support pcm037 EET board extensions"
41 depends on MACH_PCM037
42 help
43 Add support for PCM037 EET baseboard extensions. If you are using the
44 OLED display with EET, use "video=mx3fb:CMEL-OLED" kernel
45 command-line parameter.
46
39config MACH_MX31LITE 47config MACH_MX31LITE
40 bool "Support MX31 LITEKIT (LogicPD)" 48 bool "Support MX31 LITEKIT (LogicPD)"
41 select ARCH_MX31 49 select ARCH_MX31
diff --git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index 0322696bd11a..6b9775471be6 100644
--- a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_MACH_MX31ADS) += mx31ads.o
11obj-$(CONFIG_MACH_MX31LILLY) += mx31lilly.o mx31lilly-db.o 11obj-$(CONFIG_MACH_MX31LILLY) += mx31lilly.o mx31lilly-db.o
12obj-$(CONFIG_MACH_MX31LITE) += mx31lite.o 12obj-$(CONFIG_MACH_MX31LITE) += mx31lite.o
13obj-$(CONFIG_MACH_PCM037) += pcm037.o 13obj-$(CONFIG_MACH_PCM037) += pcm037.o
14obj-$(CONFIG_MACH_PCM037_EET) += pcm037_eet.o
14obj-$(CONFIG_MACH_MX31_3DS) += mx31pdk.o 15obj-$(CONFIG_MACH_MX31_3DS) += mx31pdk.o
15obj-$(CONFIG_MACH_MX31MOBOARD) += mx31moboard.o mx31moboard-devboard.o \ 16obj-$(CONFIG_MACH_MX31MOBOARD) += mx31moboard.o mx31moboard-devboard.o \
16 mx31moboard-marxbot.o 17 mx31moboard-marxbot.o
diff --git a/arch/arm/mach-mx3/armadillo5x0.c b/arch/arm/mach-mx3/armadillo5x0.c
index 541181090b37..776c0ee1b3cd 100644
--- a/arch/arm/mach-mx3/armadillo5x0.c
+++ b/arch/arm/mach-mx3/armadillo5x0.c
@@ -31,6 +31,8 @@
31#include <linux/smsc911x.h> 31#include <linux/smsc911x.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/mtd/physmap.h>
35#include <linux/io.h>
34 36
35#include <mach/hardware.h> 37#include <mach/hardware.h>
36#include <asm/mach-types.h> 38#include <asm/mach-types.h>
@@ -46,8 +48,10 @@
46#include <mach/mmc.h> 48#include <mach/mmc.h>
47#include <mach/ipu.h> 49#include <mach/ipu.h>
48#include <mach/mx3fb.h> 50#include <mach/mx3fb.h>
51#include <mach/mxc_nand.h>
49 52
50#include "devices.h" 53#include "devices.h"
54#include "crm_regs.h"
51 55
52static int armadillo5x0_pins[] = { 56static int armadillo5x0_pins[] = {
53 /* UART1 */ 57 /* UART1 */
@@ -93,7 +97,56 @@ static int armadillo5x0_pins[] = {
93 MX31_PIN_FPSHIFT__FPSHIFT, 97 MX31_PIN_FPSHIFT__FPSHIFT,
94 MX31_PIN_DRDY0__DRDY0, 98 MX31_PIN_DRDY0__DRDY0,
95 IOMUX_MODE(MX31_PIN_LCS1, IOMUX_CONFIG_GPIO), /*ADV7125_PSAVE*/ 99 IOMUX_MODE(MX31_PIN_LCS1, IOMUX_CONFIG_GPIO), /*ADV7125_PSAVE*/
100};
96 101
102/*
103 * NAND Flash
104 */
105static struct mxc_nand_platform_data armadillo5x0_nand_flash_pdata = {
106 .width = 1,
107 .hw_ecc = 1,
108};
109
110/*
111 * MTD NOR Flash
112 */
113static struct mtd_partition armadillo5x0_nor_flash_partitions[] = {
114 {
115 .name = "nor.bootloader",
116 .offset = 0x00000000,
117 .size = 4*32*1024,
118 }, {
119 .name = "nor.kernel",
120 .offset = MTDPART_OFS_APPEND,
121 .size = 16*128*1024,
122 }, {
123 .name = "nor.userland",
124 .offset = MTDPART_OFS_APPEND,
125 .size = 110*128*1024,
126 }, {
127 .name = "nor.config",
128 .offset = MTDPART_OFS_APPEND,
129 .size = 1*128*1024,
130 },
131};
132
133static struct physmap_flash_data armadillo5x0_nor_flash_pdata = {
134 .width = 2,
135 .parts = armadillo5x0_nor_flash_partitions,
136 .nr_parts = ARRAY_SIZE(armadillo5x0_nor_flash_partitions),
137};
138
139static struct resource armadillo5x0_nor_flash_resource = {
140 .flags = IORESOURCE_MEM,
141 .start = CS0_BASE_ADDR,
142 .end = CS0_BASE_ADDR + SZ_64M - 1,
143};
144
145static struct platform_device armadillo5x0_nor_flash = {
146 .name = "physmap-flash",
147 .id = -1,
148 .num_resources = 1,
149 .resource = &armadillo5x0_nor_flash_resource,
97}; 150};
98 151
99/* 152/*
@@ -272,6 +325,16 @@ static void __init armadillo5x0_init(void)
272 /* Register FB */ 325 /* Register FB */
273 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 326 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
274 mxc_register_device(&mx3_fb, &mx3fb_pdata); 327 mxc_register_device(&mx3_fb, &mx3fb_pdata);
328
329 /* Register NOR Flash */
330 mxc_register_device(&armadillo5x0_nor_flash,
331 &armadillo5x0_nor_flash_pdata);
332
333 /* Register NAND Flash */
334 mxc_register_device(&mxc_nand_device, &armadillo5x0_nand_flash_pdata);
335
336 /* set NAND page size to 2k if not configured via boot mode pins */
337 __raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR);
275} 338}
276 339
277static void __init armadillo5x0_timer_init(void) 340static void __init armadillo5x0_timer_init(void)
@@ -289,7 +352,7 @@ MACHINE_START(ARMADILLO5X0, "Armadillo-500")
289 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 352 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
290 .boot_params = PHYS_OFFSET + 0x00000100, 353 .boot_params = PHYS_OFFSET + 0x00000100,
291 .map_io = mx31_map_io, 354 .map_io = mx31_map_io,
292 .init_irq = mxc_init_irq, 355 .init_irq = mx31_init_irq,
293 .timer = &armadillo5x0_timer, 356 .timer = &armadillo5x0_timer,
294 .init_machine = armadillo5x0_init, 357 .init_machine = armadillo5x0_init,
295MACHINE_END 358MACHINE_END
diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index 577ee83d1f60..fe5c4217322e 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -273,6 +273,19 @@ static unsigned long get_rate_csi(struct clk *clk)
273 return rate / get_3_3_div((pdr2 >> 16) & 0x3f); 273 return rate / get_3_3_div((pdr2 >> 16) & 0x3f);
274} 274}
275 275
276static unsigned long get_rate_otg(struct clk *clk)
277{
278 unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4);
279 unsigned long rate;
280
281 if (pdr4 & (1 << 9))
282 rate = get_rate_arm();
283 else
284 rate = get_rate_ppll();
285
286 return rate / get_3_3_div((pdr4 >> 22) & 0x3f);
287}
288
276static unsigned long get_rate_ipg_per(struct clk *clk) 289static unsigned long get_rate_ipg_per(struct clk *clk)
277{ 290{
278 unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0); 291 unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0);
@@ -365,7 +378,7 @@ DEFINE_CLOCK(ssi2_clk, 1, CCM_CGR2, 14, get_rate_ssi, NULL);
365DEFINE_CLOCK(uart1_clk, 0, CCM_CGR2, 16, get_rate_uart, NULL); 378DEFINE_CLOCK(uart1_clk, 0, CCM_CGR2, 16, get_rate_uart, NULL);
366DEFINE_CLOCK(uart2_clk, 1, CCM_CGR2, 18, get_rate_uart, NULL); 379DEFINE_CLOCK(uart2_clk, 1, CCM_CGR2, 18, get_rate_uart, NULL);
367DEFINE_CLOCK(uart3_clk, 2, CCM_CGR2, 20, get_rate_uart, NULL); 380DEFINE_CLOCK(uart3_clk, 2, CCM_CGR2, 20, get_rate_uart, NULL);
368DEFINE_CLOCK(usbotg_clk, 0, CCM_CGR2, 22, NULL, NULL); 381DEFINE_CLOCK(usbotg_clk, 0, CCM_CGR2, 22, get_rate_otg, NULL);
369DEFINE_CLOCK(wdog_clk, 0, CCM_CGR2, 24, NULL, NULL); 382DEFINE_CLOCK(wdog_clk, 0, CCM_CGR2, 24, NULL, NULL);
370DEFINE_CLOCK(max_clk, 0, CCM_CGR2, 26, NULL, NULL); 383DEFINE_CLOCK(max_clk, 0, CCM_CGR2, 26, NULL, NULL);
371DEFINE_CLOCK(admux_clk, 0, CCM_CGR2, 30, NULL, NULL); 384DEFINE_CLOCK(admux_clk, 0, CCM_CGR2, 30, NULL, NULL);
@@ -426,7 +439,10 @@ static struct clk_lookup lookups[] = {
426 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 439 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk)
427 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 440 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk)
428 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 441 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
429 _REGISTER_CLOCK(NULL, "usbotg", usbotg_clk) 442 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk)
443 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)
444 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
445 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk)
430 _REGISTER_CLOCK("mxc_wdt.0", NULL, wdog_clk) 446 _REGISTER_CLOCK("mxc_wdt.0", NULL, wdog_clk)
431 _REGISTER_CLOCK(NULL, "max", max_clk) 447 _REGISTER_CLOCK(NULL, "max", max_clk)
432 _REGISTER_CLOCK(NULL, "admux", admux_clk) 448 _REGISTER_CLOCK(NULL, "admux", admux_clk)
@@ -456,7 +472,7 @@ int __init mx35_clocks_init()
456 __raw_writel((3 << 26) | ll, CCM_BASE + CCM_CGR2); 472 __raw_writel((3 << 26) | ll, CCM_BASE + CCM_CGR2);
457 __raw_writel(0, CCM_BASE + CCM_CGR3); 473 __raw_writel(0, CCM_BASE + CCM_CGR3);
458 474
459 mxc_timer_init(&gpt_clk); 475 mxc_timer_init(&gpt_clk, IO_ADDRESS(GPT1_BASE_ADDR), MXC_INT_GPT);
460 476
461 return 0; 477 return 0;
462} 478}
diff --git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
index 8b14239724c9..06bd6180bfc3 100644
--- a/arch/arm/mach-mx3/clock.c
+++ b/arch/arm/mach-mx3/clock.c
@@ -29,6 +29,7 @@
29 29
30#include <mach/clock.h> 30#include <mach/clock.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/mx31.h>
32#include <mach/common.h> 33#include <mach/common.h>
33 34
34#include "crm_regs.h" 35#include "crm_regs.h"
@@ -402,6 +403,11 @@ static unsigned long clk_ckih_get_rate(struct clk *clk)
402 return ckih_rate; 403 return ckih_rate;
403} 404}
404 405
406static unsigned long clk_ckil_get_rate(struct clk *clk)
407{
408 return CKIL_CLK_FREQ;
409}
410
405static struct clk ckih_clk = { 411static struct clk ckih_clk = {
406 .get_rate = clk_ckih_get_rate, 412 .get_rate = clk_ckih_get_rate,
407}; 413};
@@ -508,6 +514,7 @@ DEFINE_CLOCK(usb_clk1, 0, NULL, 0, usb_get_rate, NULL, &usb_pll_clk)
508DEFINE_CLOCK(nfc_clk, 0, NULL, 0, nfc_get_rate, NULL, &ahb_clk); 514DEFINE_CLOCK(nfc_clk, 0, NULL, 0, nfc_get_rate, NULL, &ahb_clk);
509DEFINE_CLOCK(scc_clk, 0, NULL, 0, NULL, NULL, &ipg_clk); 515DEFINE_CLOCK(scc_clk, 0, NULL, 0, NULL, NULL, &ipg_clk);
510DEFINE_CLOCK(ipg_clk, 0, NULL, 0, ipg_get_rate, NULL, &ahb_clk); 516DEFINE_CLOCK(ipg_clk, 0, NULL, 0, ipg_get_rate, NULL, &ahb_clk);
517DEFINE_CLOCK(ckil_clk, 0, NULL, 0, clk_ckil_get_rate, NULL, NULL);
511 518
512#define _REGISTER_CLOCK(d, n, c) \ 519#define _REGISTER_CLOCK(d, n, c) \
513 { \ 520 { \
@@ -518,9 +525,9 @@ DEFINE_CLOCK(ipg_clk, 0, NULL, 0, ipg_get_rate, NULL, &ahb_clk);
518 525
519static struct clk_lookup lookups[] = { 526static struct clk_lookup lookups[] = {
520 _REGISTER_CLOCK(NULL, "emi", emi_clk) 527 _REGISTER_CLOCK(NULL, "emi", emi_clk)
521 _REGISTER_CLOCK(NULL, "cspi", cspi1_clk) 528 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk)
522 _REGISTER_CLOCK(NULL, "cspi", cspi2_clk) 529 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk)
523 _REGISTER_CLOCK(NULL, "cspi", cspi3_clk) 530 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk)
524 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 531 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
525 _REGISTER_CLOCK(NULL, "pwm", pwm_clk) 532 _REGISTER_CLOCK(NULL, "pwm", pwm_clk)
526 _REGISTER_CLOCK(NULL, "wdog", wdog_clk) 533 _REGISTER_CLOCK(NULL, "wdog", wdog_clk)
@@ -531,6 +538,12 @@ static struct clk_lookup lookups[] = {
531 _REGISTER_CLOCK("ipu-core", NULL, ipu_clk) 538 _REGISTER_CLOCK("ipu-core", NULL, ipu_clk)
532 _REGISTER_CLOCK("mx3_sdc_fb", NULL, ipu_clk) 539 _REGISTER_CLOCK("mx3_sdc_fb", NULL, ipu_clk)
533 _REGISTER_CLOCK(NULL, "kpp", kpp_clk) 540 _REGISTER_CLOCK(NULL, "kpp", kpp_clk)
541 _REGISTER_CLOCK("mxc-ehci.0", "usb", usb_clk1)
542 _REGISTER_CLOCK("mxc-ehci.0", "usb_ahb", usb_clk2)
543 _REGISTER_CLOCK("mxc-ehci.1", "usb", usb_clk1)
544 _REGISTER_CLOCK("mxc-ehci.1", "usb_ahb", usb_clk2)
545 _REGISTER_CLOCK("mxc-ehci.2", "usb", usb_clk1)
546 _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_clk2)
534 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk1) 547 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk1)
535 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk2) 548 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk2)
536 _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk) 549 _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk)
@@ -559,6 +572,7 @@ static struct clk_lookup lookups[] = {
559 _REGISTER_CLOCK(NULL, "iim", iim_clk) 572 _REGISTER_CLOCK(NULL, "iim", iim_clk)
560 _REGISTER_CLOCK(NULL, "mpeg4", mpeg4_clk) 573 _REGISTER_CLOCK(NULL, "mpeg4", mpeg4_clk)
561 _REGISTER_CLOCK(NULL, "mbx", mbx_clk) 574 _REGISTER_CLOCK(NULL, "mbx", mbx_clk)
575 _REGISTER_CLOCK("mxc_rtc", NULL, ckil_clk)
562}; 576};
563 577
564int __init mx31_clocks_init(unsigned long fref) 578int __init mx31_clocks_init(unsigned long fref)
@@ -609,7 +623,7 @@ int __init mx31_clocks_init(unsigned long fref)
609 __raw_writel(reg, MXC_CCM_PMCR1); 623 __raw_writel(reg, MXC_CCM_PMCR1);
610 } 624 }
611 625
612 mxc_timer_init(&ipg_clk); 626 mxc_timer_init(&ipg_clk, IO_ADDRESS(GPT1_BASE_ADDR), MXC_INT_GPT);
613 627
614 return 0; 628 return 0;
615} 629}
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index 9e87e08fb121..8a577f367250 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -129,19 +129,17 @@ struct platform_device mxc_uart_device4 = {
129 129
130/* GPIO port description */ 130/* GPIO port description */
131static struct mxc_gpio_port imx_gpio_ports[] = { 131static struct mxc_gpio_port imx_gpio_ports[] = {
132 [0] = { 132 {
133 .chip.label = "gpio-0", 133 .chip.label = "gpio-0",
134 .base = IO_ADDRESS(GPIO1_BASE_ADDR), 134 .base = IO_ADDRESS(GPIO1_BASE_ADDR),
135 .irq = MXC_INT_GPIO1, 135 .irq = MXC_INT_GPIO1,
136 .virtual_irq_start = MXC_GPIO_IRQ_START, 136 .virtual_irq_start = MXC_GPIO_IRQ_START,
137 }, 137 }, {
138 [1] = {
139 .chip.label = "gpio-1", 138 .chip.label = "gpio-1",
140 .base = IO_ADDRESS(GPIO2_BASE_ADDR), 139 .base = IO_ADDRESS(GPIO2_BASE_ADDR),
141 .irq = MXC_INT_GPIO2, 140 .irq = MXC_INT_GPIO2,
142 .virtual_irq_start = MXC_GPIO_IRQ_START + 32, 141 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
143 }, 142 }, {
144 [2] = {
145 .chip.label = "gpio-2", 143 .chip.label = "gpio-2",
146 .base = IO_ADDRESS(GPIO3_BASE_ADDR), 144 .base = IO_ADDRESS(GPIO3_BASE_ADDR),
147 .irq = MXC_INT_GPIO3, 145 .irq = MXC_INT_GPIO3,
@@ -173,11 +171,11 @@ static struct resource mxc_nand_resources[] = {
173 { 171 {
174 .start = 0, /* runtime dependent */ 172 .start = 0, /* runtime dependent */
175 .end = 0, 173 .end = 0,
176 .flags = IORESOURCE_MEM 174 .flags = IORESOURCE_MEM,
177 }, { 175 }, {
178 .start = MXC_INT_NANDFC, 176 .start = MXC_INT_NANDFC,
179 .end = MXC_INT_NANDFC, 177 .end = MXC_INT_NANDFC,
180 .flags = IORESOURCE_IRQ 178 .flags = IORESOURCE_IRQ,
181 }, 179 },
182}; 180};
183 181
@@ -193,8 +191,7 @@ static struct resource mxc_i2c0_resources[] = {
193 .start = I2C_BASE_ADDR, 191 .start = I2C_BASE_ADDR,
194 .end = I2C_BASE_ADDR + SZ_4K - 1, 192 .end = I2C_BASE_ADDR + SZ_4K - 1,
195 .flags = IORESOURCE_MEM, 193 .flags = IORESOURCE_MEM,
196 }, 194 }, {
197 {
198 .start = MXC_INT_I2C, 195 .start = MXC_INT_I2C,
199 .end = MXC_INT_I2C, 196 .end = MXC_INT_I2C,
200 .flags = IORESOURCE_IRQ, 197 .flags = IORESOURCE_IRQ,
@@ -213,8 +210,7 @@ static struct resource mxc_i2c1_resources[] = {
213 .start = I2C2_BASE_ADDR, 210 .start = I2C2_BASE_ADDR,
214 .end = I2C2_BASE_ADDR + SZ_4K - 1, 211 .end = I2C2_BASE_ADDR + SZ_4K - 1,
215 .flags = IORESOURCE_MEM, 212 .flags = IORESOURCE_MEM,
216 }, 213 }, {
217 {
218 .start = MXC_INT_I2C2, 214 .start = MXC_INT_I2C2,
219 .end = MXC_INT_I2C2, 215 .end = MXC_INT_I2C2,
220 .flags = IORESOURCE_IRQ, 216 .flags = IORESOURCE_IRQ,
@@ -233,8 +229,7 @@ static struct resource mxc_i2c2_resources[] = {
233 .start = I2C3_BASE_ADDR, 229 .start = I2C3_BASE_ADDR,
234 .end = I2C3_BASE_ADDR + SZ_4K - 1, 230 .end = I2C3_BASE_ADDR + SZ_4K - 1,
235 .flags = IORESOURCE_MEM, 231 .flags = IORESOURCE_MEM,
236 }, 232 }, {
237 {
238 .start = MXC_INT_I2C3, 233 .start = MXC_INT_I2C3,
239 .end = MXC_INT_I2C3, 234 .end = MXC_INT_I2C3,
240 .flags = IORESOURCE_IRQ, 235 .flags = IORESOURCE_IRQ,
@@ -371,8 +366,8 @@ struct platform_device mx3_camera = {
371 366
372static struct resource otg_resources[] = { 367static struct resource otg_resources[] = {
373 { 368 {
374 .start = OTG_BASE_ADDR, 369 .start = MX31_OTG_BASE_ADDR,
375 .end = OTG_BASE_ADDR + 0x1ff, 370 .end = MX31_OTG_BASE_ADDR + 0x1ff,
376 .flags = IORESOURCE_MEM, 371 .flags = IORESOURCE_MEM,
377 }, { 372 }, {
378 .start = MXC_INT_USB3, 373 .start = MXC_INT_USB3,
@@ -395,16 +390,142 @@ struct platform_device mxc_otg_udc_device = {
395 .num_resources = ARRAY_SIZE(otg_resources), 390 .num_resources = ARRAY_SIZE(otg_resources),
396}; 391};
397 392
393/* OTG host */
394struct platform_device mxc_otg_host = {
395 .name = "mxc-ehci",
396 .id = 0,
397 .dev = {
398 .coherent_dma_mask = 0xffffffff,
399 .dma_mask = &otg_dmamask,
400 },
401 .resource = otg_resources,
402 .num_resources = ARRAY_SIZE(otg_resources),
403};
404
405/* USB host 1 */
406
407static u64 usbh1_dmamask = ~(u32)0;
408
409static struct resource mxc_usbh1_resources[] = {
410 {
411 .start = MX31_OTG_BASE_ADDR + 0x200,
412 .end = MX31_OTG_BASE_ADDR + 0x3ff,
413 .flags = IORESOURCE_MEM,
414 }, {
415 .start = MXC_INT_USB1,
416 .end = MXC_INT_USB1,
417 .flags = IORESOURCE_IRQ,
418 },
419};
420
421struct platform_device mxc_usbh1 = {
422 .name = "mxc-ehci",
423 .id = 1,
424 .dev = {
425 .coherent_dma_mask = 0xffffffff,
426 .dma_mask = &usbh1_dmamask,
427 },
428 .resource = mxc_usbh1_resources,
429 .num_resources = ARRAY_SIZE(mxc_usbh1_resources),
430};
431
432/* USB host 2 */
433static u64 usbh2_dmamask = ~(u32)0;
434
435static struct resource mxc_usbh2_resources[] = {
436 {
437 .start = MX31_OTG_BASE_ADDR + 0x400,
438 .end = MX31_OTG_BASE_ADDR + 0x5ff,
439 .flags = IORESOURCE_MEM,
440 }, {
441 .start = MXC_INT_USB2,
442 .end = MXC_INT_USB2,
443 .flags = IORESOURCE_IRQ,
444 },
445};
446
447struct platform_device mxc_usbh2 = {
448 .name = "mxc-ehci",
449 .id = 2,
450 .dev = {
451 .coherent_dma_mask = 0xffffffff,
452 .dma_mask = &usbh2_dmamask,
453 },
454 .resource = mxc_usbh2_resources,
455 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
456};
457
458/*
459 * SPI master controller
460 * 3 channels
461 */
462static struct resource imx_spi_0_resources[] = {
463 {
464 .start = CSPI1_BASE_ADDR,
465 .end = CSPI1_BASE_ADDR + SZ_4K - 1,
466 .flags = IORESOURCE_MEM,
467 }, {
468 .start = MXC_INT_CSPI1,
469 .end = MXC_INT_CSPI1,
470 .flags = IORESOURCE_IRQ,
471 },
472};
473
474static struct resource imx_spi_1_resources[] = {
475 {
476 .start = CSPI2_BASE_ADDR,
477 .end = CSPI2_BASE_ADDR + SZ_4K - 1,
478 .flags = IORESOURCE_MEM,
479 }, {
480 .start = MXC_INT_CSPI2,
481 .end = MXC_INT_CSPI2,
482 .flags = IORESOURCE_IRQ,
483 },
484};
485
486static struct resource imx_spi_2_resources[] = {
487 {
488 .start = CSPI3_BASE_ADDR,
489 .end = CSPI3_BASE_ADDR + SZ_4K - 1,
490 .flags = IORESOURCE_MEM,
491 }, {
492 .start = MXC_INT_CSPI3,
493 .end = MXC_INT_CSPI3,
494 .flags = IORESOURCE_IRQ,
495 },
496};
497
498struct platform_device imx_spi_device0 = {
499 .name = "spi_imx",
500 .id = 0,
501 .num_resources = ARRAY_SIZE(imx_spi_0_resources),
502 .resource = imx_spi_0_resources,
503};
504
505struct platform_device imx_spi_device1 = {
506 .name = "spi_imx",
507 .id = 1,
508 .num_resources = ARRAY_SIZE(imx_spi_1_resources),
509 .resource = imx_spi_1_resources,
510};
511
512struct platform_device imx_spi_device2 = {
513 .name = "spi_imx",
514 .id = 2,
515 .num_resources = ARRAY_SIZE(imx_spi_2_resources),
516 .resource = imx_spi_2_resources,
517};
518
398#ifdef CONFIG_ARCH_MX35 519#ifdef CONFIG_ARCH_MX35
399static struct resource mxc_fec_resources[] = { 520static struct resource mxc_fec_resources[] = {
400 { 521 {
401 .start = MXC_FEC_BASE_ADDR, 522 .start = MXC_FEC_BASE_ADDR,
402 .end = MXC_FEC_BASE_ADDR + 0xfff, 523 .end = MXC_FEC_BASE_ADDR + 0xfff,
403 .flags = IORESOURCE_MEM 524 .flags = IORESOURCE_MEM,
404 }, { 525 }, {
405 .start = MXC_INT_FEC, 526 .start = MXC_INT_FEC,
406 .end = MXC_INT_FEC, 527 .end = MXC_INT_FEC,
407 .flags = IORESOURCE_IRQ 528 .flags = IORESOURCE_IRQ,
408 }, 529 },
409}; 530};
410 531
@@ -426,6 +547,14 @@ static int mx3_devices_init(void)
426 if (cpu_is_mx35()) { 547 if (cpu_is_mx35()) {
427 mxc_nand_resources[0].start = MX35_NFC_BASE_ADDR; 548 mxc_nand_resources[0].start = MX35_NFC_BASE_ADDR;
428 mxc_nand_resources[0].end = MX35_NFC_BASE_ADDR + 0xfff; 549 mxc_nand_resources[0].end = MX35_NFC_BASE_ADDR + 0xfff;
550 otg_resources[0].start = MX35_OTG_BASE_ADDR;
551 otg_resources[0].end = MX35_OTG_BASE_ADDR + 0x1ff;
552 otg_resources[1].start = MXC_INT_USBOTG;
553 otg_resources[1].end = MXC_INT_USBOTG;
554 mxc_usbh1_resources[0].start = MX35_OTG_BASE_ADDR + 0x400;
555 mxc_usbh1_resources[0].end = MX35_OTG_BASE_ADDR + 0x5ff;
556 mxc_usbh1_resources[1].start = MXC_INT_USBHS;
557 mxc_usbh1_resources[1].end = MXC_INT_USBHS;
429 } 558 }
430 559
431 return 0; 560 return 0;
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index ffd494ddd4ac..79f2be45d139 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -16,5 +16,11 @@ extern struct platform_device mxc_fec_device;
16extern struct platform_device mxcsdhc_device0; 16extern struct platform_device mxcsdhc_device0;
17extern struct platform_device mxcsdhc_device1; 17extern struct platform_device mxcsdhc_device1;
18extern struct platform_device mxc_otg_udc_device; 18extern struct platform_device mxc_otg_udc_device;
19extern struct platform_device mxc_otg_host;
20extern struct platform_device mxc_usbh1;
21extern struct platform_device mxc_usbh2;
19extern struct platform_device mxc_rnga_device; 22extern struct platform_device mxc_rnga_device;
23extern struct platform_device imx_spi_device0;
24extern struct platform_device imx_spi_device1;
25extern struct platform_device imx_spi_device2;
20 26
diff --git a/arch/arm/mach-mx3/mm.c b/arch/arm/mach-mx3/mm.c
index 1f5fdd456cb9..ad5a1122d765 100644
--- a/arch/arm/mach-mx3/mm.c
+++ b/arch/arm/mach-mx3/mm.c
@@ -30,6 +30,7 @@
30 30
31#include <mach/common.h> 31#include <mach/common.h>
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/iomux-v3.h>
33 34
34/*! 35/*!
35 * @file mm.c 36 * @file mm.c
@@ -75,6 +76,7 @@ static struct map_desc mxc_io_desc[] __initdata = {
75void __init mx31_map_io(void) 76void __init mx31_map_io(void)
76{ 77{
77 mxc_set_cpu_type(MXC_CPU_MX31); 78 mxc_set_cpu_type(MXC_CPU_MX31);
79 mxc_arch_reset_init(IO_ADDRESS(WDOG_BASE_ADDR));
78 80
79 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 81 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
80} 82}
@@ -82,10 +84,22 @@ void __init mx31_map_io(void)
82void __init mx35_map_io(void) 84void __init mx35_map_io(void)
83{ 85{
84 mxc_set_cpu_type(MXC_CPU_MX35); 86 mxc_set_cpu_type(MXC_CPU_MX35);
87 mxc_iomux_v3_init(IO_ADDRESS(IOMUXC_BASE_ADDR));
88 mxc_arch_reset_init(IO_ADDRESS(WDOG_BASE_ADDR));
85 89
86 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 90 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
87} 91}
88 92
93void __init mx31_init_irq(void)
94{
95 mxc_init_irq(IO_ADDRESS(AVIC_BASE_ADDR));
96}
97
98void __init mx35_init_irq(void)
99{
100 mx31_init_irq();
101}
102
89#ifdef CONFIG_CACHE_L2X0 103#ifdef CONFIG_CACHE_L2X0
90static int mxc_init_l2x0(void) 104static int mxc_init_l2x0(void)
91{ 105{
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c
index 30e2767a78ae..0497c152be18 100644
--- a/arch/arm/mach-mx3/mx31ads.c
+++ b/arch/arm/mach-mx3/mx31ads.c
@@ -517,7 +517,7 @@ static void __init mx31ads_map_io(void)
517 517
518static void __init mx31ads_init_irq(void) 518static void __init mx31ads_init_irq(void)
519{ 519{
520 mxc_init_irq(); 520 mx31_init_irq();
521 mx31ads_init_expio(); 521 mx31ads_init_expio();
522} 522}
523 523
diff --git a/arch/arm/mach-mx3/mx31lilly.c b/arch/arm/mach-mx3/mx31lilly.c
index 6ab2f163cb95..423025150f6f 100644
--- a/arch/arm/mach-mx3/mx31lilly.c
+++ b/arch/arm/mach-mx3/mx31lilly.c
@@ -148,7 +148,7 @@ MACHINE_START(LILLY1131, "INCO startec LILLY-1131")
148 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 148 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
149 .boot_params = PHYS_OFFSET + 0x100, 149 .boot_params = PHYS_OFFSET + 0x100,
150 .map_io = mx31_map_io, 150 .map_io = mx31_map_io,
151 .init_irq = mxc_init_irq, 151 .init_irq = mx31_init_irq,
152 .init_machine = mx31lilly_board_init, 152 .init_machine = mx31lilly_board_init,
153 .timer = &mx31lilly_timer, 153 .timer = &mx31lilly_timer,
154MACHINE_END 154MACHINE_END
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
index 86fe70fa3e13..a8d57decdfdb 100644
--- a/arch/arm/mach-mx3/mx31lite.c
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -71,12 +71,11 @@ static struct smsc911x_platform_config smsc911x_config = {
71}; 71};
72 72
73static struct resource smsc911x_resources[] = { 73static struct resource smsc911x_resources[] = {
74 [0] = { 74 {
75 .start = CS4_BASE_ADDR, 75 .start = CS4_BASE_ADDR,
76 .end = CS4_BASE_ADDR + 0x100, 76 .end = CS4_BASE_ADDR + 0x100,
77 .flags = IORESOURCE_MEM, 77 .flags = IORESOURCE_MEM,
78 }, 78 }, {
79 [1] = {
80 .start = IOMUX_TO_IRQ(MX31_PIN_SFS6), 79 .start = IOMUX_TO_IRQ(MX31_PIN_SFS6),
81 .end = IOMUX_TO_IRQ(MX31_PIN_SFS6), 80 .end = IOMUX_TO_IRQ(MX31_PIN_SFS6),
82 .flags = IORESOURCE_IRQ, 81 .flags = IORESOURCE_IRQ,
@@ -162,7 +161,7 @@ MACHINE_START(MX31LITE, "LogicPD MX31 LITEKIT")
162 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 161 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
163 .boot_params = PHYS_OFFSET + 0x100, 162 .boot_params = PHYS_OFFSET + 0x100,
164 .map_io = mx31lite_map_io, 163 .map_io = mx31lite_map_io,
165 .init_irq = mxc_init_irq, 164 .init_irq = mx31_init_irq,
166 .init_machine = mxc_board_init, 165 .init_machine = mxc_board_init,
167 .timer = &mx31lite_timer, 166 .timer = &mx31lite_timer,
168MACHINE_END 167MACHINE_END
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 4704405165a1..b3e8f251ac79 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -16,7 +16,6 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <linux/fsl_devices.h>
20#include <linux/gpio.h> 19#include <linux/gpio.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/interrupt.h> 21#include <linux/interrupt.h>
@@ -40,18 +39,6 @@ static unsigned int devboard_pins[] = {
40 MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0, 39 MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0,
41 MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD, 40 MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD,
42 MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29, 41 MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29,
43 /* USB OTG */
44 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
45 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
46 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
47 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
48 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
49 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
50 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
51 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
52 MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR,
53 MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP,
54 MX31_PIN_USB_OC__GPIO1_30,
55}; 42};
56 43
57static struct imxuart_platform_data uart_pdata = { 44static struct imxuart_platform_data uart_pdata = {
@@ -111,33 +98,6 @@ static struct imxmmc_platform_data sdhc2_pdata = {
111 .exit = devboard_sdhc2_exit, 98 .exit = devboard_sdhc2_exit,
112}; 99};
113 100
114static struct fsl_usb2_platform_data usb_pdata = {
115 .operating_mode = FSL_USB2_DR_DEVICE,
116 .phy_mode = FSL_USB2_PHY_ULPI,
117};
118
119#define OTG_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST)
120#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
121
122static void devboard_usbotg_init(void)
123{
124 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, OTG_PAD_CFG);
125 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, OTG_PAD_CFG);
126 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, OTG_PAD_CFG);
127 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, OTG_PAD_CFG);
128 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, OTG_PAD_CFG);
129 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, OTG_PAD_CFG);
130 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, OTG_PAD_CFG);
131 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, OTG_PAD_CFG);
132 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, OTG_PAD_CFG);
133 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, OTG_PAD_CFG);
134 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, OTG_PAD_CFG);
135 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, OTG_PAD_CFG);
136
137 gpio_request(OTG_EN_B, "usb-udc-en");
138 gpio_direction_output(OTG_EN_B, 0);
139}
140
141/* 101/*
142 * system init for baseboard usage. Will be called by mx31moboard init. 102 * system init for baseboard usage. Will be called by mx31moboard init.
143 */ 103 */
@@ -151,7 +111,4 @@ void __init mx31moboard_devboard_init(void)
151 mxc_register_device(&mxc_uart_device1, &uart_pdata); 111 mxc_register_device(&mxc_uart_device1, &uart_pdata);
152 112
153 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); 113 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
154
155 devboard_usbotg_init();
156 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
157} 114}
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 641c3d6153ae..3e2b73051b94 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -16,7 +16,6 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <linux/fsl_devices.h>
20#include <linux/gpio.h> 19#include <linux/gpio.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/interrupt.h> 21#include <linux/interrupt.h>
@@ -48,18 +47,8 @@ static unsigned int marxbot_pins[] = {
48 MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC, 47 MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC,
49 MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1, 48 MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1,
50 MX31_PIN_TXD2__GPIO1_28, 49 MX31_PIN_TXD2__GPIO1_28,
51 /* USB OTG */ 50 /* dsPIC resets */
52 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, 51 MX31_PIN_STXD5__GPIO1_21, MX31_PIN_SRXD5__GPIO1_22,
53 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
54 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
55 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
56 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
57 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
58 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
59 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
60 MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR,
61 MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP,
62 MX31_PIN_USB_OC__GPIO1_30,
63}; 52};
64 53
65#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR) 54#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR)
@@ -115,31 +104,20 @@ static struct imxmmc_platform_data sdhc2_pdata = {
115 .exit = marxbot_sdhc2_exit, 104 .exit = marxbot_sdhc2_exit,
116}; 105};
117 106
118static struct fsl_usb2_platform_data usb_pdata = { 107#define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_STXD5)
119 .operating_mode = FSL_USB2_DR_DEVICE, 108#define DSPICS_RST_B IOMUX_TO_GPIO(MX31_PIN_SRXD5)
120 .phy_mode = FSL_USB2_PHY_ULPI,
121};
122
123#define OTG_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST)
124#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
125 109
126static void marxbot_usbotg_init(void) 110static void dspics_resets_init(void)
127{ 111{
128 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, OTG_PAD_CFG); 112 if (!gpio_request(TRSLAT_RST_B, "translator-rst")) {
129 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, OTG_PAD_CFG); 113 gpio_direction_output(TRSLAT_RST_B, 1);
130 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, OTG_PAD_CFG); 114 gpio_export(TRSLAT_RST_B, false);
131 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, OTG_PAD_CFG); 115 }
132 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, OTG_PAD_CFG); 116
133 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, OTG_PAD_CFG); 117 if (!gpio_request(DSPICS_RST_B, "dspics-rst")) {
134 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, OTG_PAD_CFG); 118 gpio_direction_output(DSPICS_RST_B, 1);
135 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, OTG_PAD_CFG); 119 gpio_export(DSPICS_RST_B, false);
136 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, OTG_PAD_CFG); 120 }
137 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, OTG_PAD_CFG);
138 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, OTG_PAD_CFG);
139 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, OTG_PAD_CFG);
140
141 gpio_request(OTG_EN_B, "usb-udc-en");
142 gpio_direction_output(OTG_EN_B, 0);
143} 121}
144 122
145/* 123/*
@@ -152,8 +130,7 @@ void __init mx31moboard_marxbot_init(void)
152 mxc_iomux_setup_multiple_pins(marxbot_pins, ARRAY_SIZE(marxbot_pins), 130 mxc_iomux_setup_multiple_pins(marxbot_pins, ARRAY_SIZE(marxbot_pins),
153 "marxbot"); 131 "marxbot");
154 132
155 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); 133 dspics_resets_init();
156 134
157 marxbot_usbotg_init(); 135 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
158 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
159} 136}
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index a17f2e411609..d3c6bb26271f 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -16,9 +16,12 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <linux/delay.h>
20#include <linux/fsl_devices.h>
19#include <linux/gpio.h> 21#include <linux/gpio.h>
20#include <linux/init.h> 22#include <linux/init.h>
21#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/leds.h>
22#include <linux/memory.h> 25#include <linux/memory.h>
23#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
24#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
@@ -36,6 +39,7 @@
36#include <mach/iomux-mx3.h> 39#include <mach/iomux-mx3.h>
37#include <mach/i2c.h> 40#include <mach/i2c.h>
38#include <mach/mmc.h> 41#include <mach/mmc.h>
42#include <mach/mx31.h>
39 43
40#include "devices.h" 44#include "devices.h"
41 45
@@ -55,6 +59,26 @@ static unsigned int moboard_pins[] = {
55 MX31_PIN_SD1_DATA1__SD1_DATA1, MX31_PIN_SD1_DATA0__SD1_DATA0, 59 MX31_PIN_SD1_DATA1__SD1_DATA1, MX31_PIN_SD1_DATA0__SD1_DATA0,
56 MX31_PIN_SD1_CLK__SD1_CLK, MX31_PIN_SD1_CMD__SD1_CMD, 60 MX31_PIN_SD1_CLK__SD1_CLK, MX31_PIN_SD1_CMD__SD1_CMD,
57 MX31_PIN_ATA_CS0__GPIO3_26, MX31_PIN_ATA_CS1__GPIO3_27, 61 MX31_PIN_ATA_CS0__GPIO3_26, MX31_PIN_ATA_CS1__GPIO3_27,
62 /* USB reset */
63 MX31_PIN_GPIO1_0__GPIO1_0,
64 /* USB OTG */
65 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
66 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
67 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
68 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
69 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
70 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
71 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
72 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
73 MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR,
74 MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP,
75 MX31_PIN_USB_OC__GPIO1_30,
76 /* LEDs */
77 MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1,
78 MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3,
79 /* SEL */
80 MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
81 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
58}; 82};
59 83
60static struct physmap_flash_data mx31moboard_flash_data = { 84static struct physmap_flash_data mx31moboard_flash_data = {
@@ -142,8 +166,109 @@ static struct imxmmc_platform_data sdhc1_pdata = {
142 .exit = moboard_sdhc1_exit, 166 .exit = moboard_sdhc1_exit,
143}; 167};
144 168
169/*
170 * this pin is dedicated for all mx31moboard systems, so we do it here
171 */
172#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
173
174static void usb_xcvr_reset(void)
175{
176 gpio_request(USB_RESET_B, "usb-reset");
177 gpio_direction_output(USB_RESET_B, 0);
178 mdelay(1);
179 gpio_set_value(USB_RESET_B, 1);
180}
181
182#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
183 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
184
185#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
186
187static void moboard_usbotg_init(void)
188{
189 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
190 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
191 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
192 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
193 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
194 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
195 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
196 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
197 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
198 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
199 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
200 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
201
202 gpio_request(OTG_EN_B, "usb-udc-en");
203 gpio_direction_output(OTG_EN_B, 0);
204}
205
206static struct fsl_usb2_platform_data usb_pdata = {
207 .operating_mode = FSL_USB2_DR_DEVICE,
208 .phy_mode = FSL_USB2_PHY_ULPI,
209};
210
211static struct gpio_led mx31moboard_leds[] = {
212 {
213 .name = "coreboard-led-0:red:running",
214 .default_trigger = "heartbeat",
215 .gpio = IOMUX_TO_GPIO(MX31_PIN_SVEN0),
216 }, {
217 .name = "coreboard-led-1:red",
218 .gpio = IOMUX_TO_GPIO(MX31_PIN_STX0),
219 }, {
220 .name = "coreboard-led-2:red",
221 .gpio = IOMUX_TO_GPIO(MX31_PIN_SRX0),
222 }, {
223 .name = "coreboard-led-3:red",
224 .gpio = IOMUX_TO_GPIO(MX31_PIN_SIMPD0),
225 },
226};
227
228static struct gpio_led_platform_data mx31moboard_led_pdata = {
229 .num_leds = ARRAY_SIZE(mx31moboard_leds),
230 .leds = mx31moboard_leds,
231};
232
233static struct platform_device mx31moboard_leds_device = {
234 .name = "leds-gpio",
235 .id = -1,
236 .dev = {
237 .platform_data = &mx31moboard_led_pdata,
238 },
239};
240
241#define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
242#define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
243#define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
244#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
245
246static void mx31moboard_init_sel_gpios(void)
247{
248 if (!gpio_request(SEL0, "sel0")) {
249 gpio_direction_input(SEL0);
250 gpio_export(SEL0, true);
251 }
252
253 if (!gpio_request(SEL1, "sel1")) {
254 gpio_direction_input(SEL1);
255 gpio_export(SEL1, true);
256 }
257
258 if (!gpio_request(SEL2, "sel2")) {
259 gpio_direction_input(SEL2);
260 gpio_export(SEL2, true);
261 }
262
263 if (!gpio_request(SEL3, "sel3")) {
264 gpio_direction_input(SEL3);
265 gpio_export(SEL3, true);
266 }
267}
268
145static struct platform_device *devices[] __initdata = { 269static struct platform_device *devices[] __initdata = {
146 &mx31moboard_flash, 270 &mx31moboard_flash,
271 &mx31moboard_leds_device,
147}; 272};
148 273
149static int mx31moboard_baseboard; 274static int mx31moboard_baseboard;
@@ -162,11 +287,18 @@ static void __init mxc_board_init(void)
162 mxc_register_device(&mxc_uart_device0, &uart_pdata); 287 mxc_register_device(&mxc_uart_device0, &uart_pdata);
163 mxc_register_device(&mxc_uart_device4, &uart_pdata); 288 mxc_register_device(&mxc_uart_device4, &uart_pdata);
164 289
290 mx31moboard_init_sel_gpios();
291
165 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata); 292 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
166 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata); 293 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
167 294
168 mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata); 295 mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
169 296
297 usb_xcvr_reset();
298
299 moboard_usbotg_init();
300 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
301
170 switch (mx31moboard_baseboard) { 302 switch (mx31moboard_baseboard) {
171 case MX31NOBOARD: 303 case MX31NOBOARD:
172 break; 304 break;
@@ -197,7 +329,7 @@ MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard")
197 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 329 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
198 .boot_params = PHYS_OFFSET + 0x100, 330 .boot_params = PHYS_OFFSET + 0x100,
199 .map_io = mx31_map_io, 331 .map_io = mx31_map_io,
200 .init_irq = mxc_init_irq, 332 .init_irq = mx31_init_irq,
201 .init_machine = mxc_board_init, 333 .init_machine = mxc_board_init,
202 .timer = &mx31moboard_timer, 334 .timer = &mx31moboard_timer,
203MACHINE_END 335MACHINE_END
diff --git a/arch/arm/mach-mx3/mx31pdk.c b/arch/arm/mach-mx3/mx31pdk.c
index c19838d2e369..0f7a2f06bc2d 100644
--- a/arch/arm/mach-mx3/mx31pdk.c
+++ b/arch/arm/mach-mx3/mx31pdk.c
@@ -265,7 +265,7 @@ MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)")
265 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 265 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
266 .boot_params = PHYS_OFFSET + 0x100, 266 .boot_params = PHYS_OFFSET + 0x100,
267 .map_io = mx31pdk_map_io, 267 .map_io = mx31pdk_map_io,
268 .init_irq = mxc_init_irq, 268 .init_irq = mx31_init_irq,
269 .init_machine = mxc_board_init, 269 .init_machine = mxc_board_init,
270 .timer = &mx31pdk_timer, 270 .timer = &mx31pdk_timer,
271MACHINE_END 271MACHINE_END
diff --git a/arch/arm/mach-mx3/mx35pdk.c b/arch/arm/mach-mx3/mx35pdk.c
index 6d15374414b9..6ff186e46ceb 100644
--- a/arch/arm/mach-mx3/mx35pdk.c
+++ b/arch/arm/mach-mx3/mx35pdk.c
@@ -98,7 +98,7 @@ MACHINE_START(MX35_3DS, "Freescale MX35PDK")
98 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 98 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
99 .boot_params = PHYS_OFFSET + 0x100, 99 .boot_params = PHYS_OFFSET + 0x100,
100 .map_io = mx35_map_io, 100 .map_io = mx35_map_io,
101 .init_irq = mxc_init_irq, 101 .init_irq = mx35_init_irq,
102 .init_machine = mxc_board_init, 102 .init_machine = mxc_board_init,
103 .timer = &mx35pdk_timer, 103 .timer = &mx35pdk_timer,
104MACHINE_END 104MACHINE_END
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index c6f61a1f06c8..6cbaabedf386 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -18,7 +18,7 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/init.h> 20#include <linux/init.h>
21 21#include <linux/dma-mapping.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/mtd/plat-ram.h> 24#include <linux/mtd/plat-ram.h>
@@ -32,30 +32,69 @@
32#include <linux/spi/spi.h> 32#include <linux/spi/spi.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/fsl_devices.h> 34#include <linux/fsl_devices.h>
35#include <linux/can/platform/sja1000.h>
36
37#include <media/soc_camera.h>
35 38
36#include <mach/hardware.h>
37#include <asm/mach-types.h> 39#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
39#include <asm/mach/time.h> 41#include <asm/mach/time.h>
40#include <asm/mach/map.h> 42#include <asm/mach/map.h>
43#include <mach/board-pcm037.h>
41#include <mach/common.h> 44#include <mach/common.h>
45#include <mach/hardware.h>
46#include <mach/i2c.h>
42#include <mach/imx-uart.h> 47#include <mach/imx-uart.h>
43#include <mach/iomux-mx3.h> 48#include <mach/iomux-mx3.h>
44#include <mach/ipu.h> 49#include <mach/ipu.h>
45#include <mach/board-pcm037.h> 50#include <mach/mmc.h>
51#include <mach/mx3_camera.h>
46#include <mach/mx3fb.h> 52#include <mach/mx3fb.h>
47#include <mach/mxc_nand.h> 53#include <mach/mxc_nand.h>
48#include <mach/mmc.h>
49#ifdef CONFIG_I2C_IMX
50#include <mach/i2c.h>
51#endif
52 54
53#include "devices.h" 55#include "devices.h"
56#include "pcm037.h"
57
58static enum pcm037_board_variant pcm037_instance = PCM037_PCM970;
59
60static int __init pcm037_variant_setup(char *str)
61{
62 if (!strcmp("eet", str))
63 pcm037_instance = PCM037_EET;
64 else if (strcmp("pcm970", str))
65 pr_warning("Unknown pcm037 baseboard variant %s\n", str);
66
67 return 1;
68}
69
70/* Supported values: "pcm970" (default) and "eet" */
71__setup("pcm037_variant=", pcm037_variant_setup);
72
73enum pcm037_board_variant pcm037_variant(void)
74{
75 return pcm037_instance;
76}
77
78/* UART1 with RTS/CTS handshake signals */
79static unsigned int pcm037_uart1_handshake_pins[] = {
80 MX31_PIN_CTS1__CTS1,
81 MX31_PIN_RTS1__RTS1,
82 MX31_PIN_TXD1__TXD1,
83 MX31_PIN_RXD1__RXD1,
84};
85
86/* UART1 without RTS/CTS handshake signals */
87static unsigned int pcm037_uart1_pins[] = {
88 MX31_PIN_TXD1__TXD1,
89 MX31_PIN_RXD1__RXD1,
90};
54 91
55static unsigned int pcm037_pins[] = { 92static unsigned int pcm037_pins[] = {
56 /* I2C */ 93 /* I2C */
57 MX31_PIN_CSPI2_MOSI__SCL, 94 MX31_PIN_CSPI2_MOSI__SCL,
58 MX31_PIN_CSPI2_MISO__SDA, 95 MX31_PIN_CSPI2_MISO__SDA,
96 MX31_PIN_CSPI2_SS2__I2C3_SDA,
97 MX31_PIN_CSPI2_SCLK__I2C3_SCL,
59 /* SDHC1 */ 98 /* SDHC1 */
60 MX31_PIN_SD1_DATA3__SD1_DATA3, 99 MX31_PIN_SD1_DATA3__SD1_DATA3,
61 MX31_PIN_SD1_DATA2__SD1_DATA2, 100 MX31_PIN_SD1_DATA2__SD1_DATA2,
@@ -73,11 +112,6 @@ static unsigned int pcm037_pins[] = {
73 MX31_PIN_CSPI1_SS0__SS0, 112 MX31_PIN_CSPI1_SS0__SS0,
74 MX31_PIN_CSPI1_SS1__SS1, 113 MX31_PIN_CSPI1_SS1__SS1,
75 MX31_PIN_CSPI1_SS2__SS2, 114 MX31_PIN_CSPI1_SS2__SS2,
76 /* UART1 */
77 MX31_PIN_CTS1__CTS1,
78 MX31_PIN_RTS1__RTS1,
79 MX31_PIN_TXD1__TXD1,
80 MX31_PIN_RXD1__RXD1,
81 /* UART2 */ 115 /* UART2 */
82 MX31_PIN_TXD2__TXD2, 116 MX31_PIN_TXD2__TXD2,
83 MX31_PIN_RXD2__RXD2, 117 MX31_PIN_RXD2__RXD2,
@@ -120,6 +154,24 @@ static unsigned int pcm037_pins[] = {
120 MX31_PIN_D3_SPL__D3_SPL, 154 MX31_PIN_D3_SPL__D3_SPL,
121 MX31_PIN_D3_CLS__D3_CLS, 155 MX31_PIN_D3_CLS__D3_CLS,
122 MX31_PIN_LCS0__GPI03_23, 156 MX31_PIN_LCS0__GPI03_23,
157 /* CSI */
158 IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_GPIO),
159 MX31_PIN_CSI_D6__CSI_D6,
160 MX31_PIN_CSI_D7__CSI_D7,
161 MX31_PIN_CSI_D8__CSI_D8,
162 MX31_PIN_CSI_D9__CSI_D9,
163 MX31_PIN_CSI_D10__CSI_D10,
164 MX31_PIN_CSI_D11__CSI_D11,
165 MX31_PIN_CSI_D12__CSI_D12,
166 MX31_PIN_CSI_D13__CSI_D13,
167 MX31_PIN_CSI_D14__CSI_D14,
168 MX31_PIN_CSI_D15__CSI_D15,
169 MX31_PIN_CSI_HSYNC__CSI_HSYNC,
170 MX31_PIN_CSI_MCLK__CSI_MCLK,
171 MX31_PIN_CSI_PIXCLK__CSI_PIXCLK,
172 MX31_PIN_CSI_VSYNC__CSI_VSYNC,
173 /* GPIO */
174 IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO),
123}; 175};
124 176
125static struct physmap_flash_data pcm037_flash_data = { 177static struct physmap_flash_data pcm037_flash_data = {
@@ -195,12 +247,11 @@ static struct imxuart_platform_data uart_pdata = {
195}; 247};
196 248
197static struct resource smsc911x_resources[] = { 249static struct resource smsc911x_resources[] = {
198 [0] = { 250 {
199 .start = CS1_BASE_ADDR + 0x300, 251 .start = CS1_BASE_ADDR + 0x300,
200 .end = CS1_BASE_ADDR + 0x300 + SZ_64K - 1, 252 .end = CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
201 .flags = IORESOURCE_MEM, 253 .flags = IORESOURCE_MEM,
202 }, 254 }, {
203 [1] = {
204 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), 255 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
205 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), 256 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
206 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 257 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
@@ -250,27 +301,57 @@ static struct mxc_nand_platform_data pcm037_nand_board_info = {
250 .hw_ecc = 1, 301 .hw_ecc = 1,
251}; 302};
252 303
253#ifdef CONFIG_I2C_IMX
254static struct imxi2c_platform_data pcm037_i2c_1_data = { 304static struct imxi2c_platform_data pcm037_i2c_1_data = {
255 .bitrate = 100000, 305 .bitrate = 100000,
256}; 306};
257 307
308static struct imxi2c_platform_data pcm037_i2c_2_data = {
309 .bitrate = 20000,
310};
311
258static struct at24_platform_data board_eeprom = { 312static struct at24_platform_data board_eeprom = {
259 .byte_len = 4096, 313 .byte_len = 4096,
260 .page_size = 32, 314 .page_size = 32,
261 .flags = AT24_FLAG_ADDR16, 315 .flags = AT24_FLAG_ADDR16,
262}; 316};
263 317
318static int pcm037_camera_power(struct device *dev, int on)
319{
320 /* disable or enable the camera in X7 or X8 PCM970 connector */
321 gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), !on);
322 return 0;
323}
324
325static struct i2c_board_info pcm037_i2c_2_devices[] = {
326 {
327 I2C_BOARD_INFO("mt9t031", 0x5d),
328 },
329};
330
331static struct soc_camera_link iclink = {
332 .bus_id = 0, /* Must match with the camera ID */
333 .power = pcm037_camera_power,
334 .board_info = &pcm037_i2c_2_devices[0],
335 .i2c_adapter_id = 2,
336 .module_name = "mt9t031",
337};
338
264static struct i2c_board_info pcm037_i2c_devices[] = { 339static struct i2c_board_info pcm037_i2c_devices[] = {
265 { 340 {
266 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ 341 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
267 .platform_data = &board_eeprom, 342 .platform_data = &board_eeprom,
268 }, { 343 }, {
269 I2C_BOARD_INFO("rtc-pcf8563", 0x51), 344 I2C_BOARD_INFO("pcf8563", 0x51),
270 .type = "pcf8563",
271 } 345 }
272}; 346};
273#endif 347
348static struct platform_device pcm037_camera = {
349 .name = "soc-camera-pdrv",
350 .id = 0,
351 .dev = {
352 .platform_data = &iclink,
353 },
354};
274 355
275/* Not connected by default */ 356/* Not connected by default */
276#ifdef PCM970_SDHC_RW_SWITCH 357#ifdef PCM970_SDHC_RW_SWITCH
@@ -334,9 +415,41 @@ static struct imxmmc_platform_data sdhc_pdata = {
334 .exit = pcm970_sdhc1_exit, 415 .exit = pcm970_sdhc1_exit,
335}; 416};
336 417
418struct mx3_camera_pdata camera_pdata = {
419 .dma_dev = &mx3_ipu.dev,
420 .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
421 .mclk_10khz = 2000,
422};
423
424static int __init pcm037_camera_alloc_dma(const size_t buf_size)
425{
426 dma_addr_t dma_handle;
427 void *buf;
428 int dma;
429
430 if (buf_size < 2 * 1024 * 1024)
431 return -EINVAL;
432
433 buf = dma_alloc_coherent(NULL, buf_size, &dma_handle, GFP_KERNEL);
434 if (!buf) {
435 pr_err("%s: cannot allocate camera buffer-memory\n", __func__);
436 return -ENOMEM;
437 }
438
439 memset(buf, 0, buf_size);
440
441 dma = dma_declare_coherent_memory(&mx3_camera.dev,
442 dma_handle, dma_handle, buf_size,
443 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
444
445 /* The way we call dma_declare_coherent_memory only a malloc can fail */
446 return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM;
447}
448
337static struct platform_device *devices[] __initdata = { 449static struct platform_device *devices[] __initdata = {
338 &pcm037_flash, 450 &pcm037_flash,
339 &pcm037_sram_device, 451 &pcm037_sram_device,
452 &pcm037_camera,
340}; 453};
341 454
342static struct ipu_platform_data mx3_ipu_data = { 455static struct ipu_platform_data mx3_ipu_data = {
@@ -377,6 +490,22 @@ static const struct fb_videomode fb_modedb[] = {
377 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH, 490 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH,
378 .vmode = FB_VMODE_NONINTERLACED, 491 .vmode = FB_VMODE_NONINTERLACED,
379 .flag = 0, 492 .flag = 0,
493 }, {
494 /* 240x320 @ 60 Hz */
495 .name = "CMEL-OLED",
496 .refresh = 60,
497 .xres = 240,
498 .yres = 320,
499 .pixclock = 185925,
500 .left_margin = 9,
501 .right_margin = 16,
502 .upper_margin = 7,
503 .lower_margin = 9,
504 .hsync_len = 1,
505 .vsync_len = 1,
506 .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
507 .vmode = FB_VMODE_NONINTERLACED,
508 .flag = 0,
380 }, 509 },
381}; 510};
382 511
@@ -387,6 +516,33 @@ static struct mx3fb_platform_data mx3fb_pdata = {
387 .num_modes = ARRAY_SIZE(fb_modedb), 516 .num_modes = ARRAY_SIZE(fb_modedb),
388}; 517};
389 518
519static struct resource pcm970_sja1000_resources[] = {
520 {
521 .start = CS5_BASE_ADDR,
522 .end = CS5_BASE_ADDR + 0x100 - 1,
523 .flags = IORESOURCE_MEM,
524 }, {
525 .start = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)),
526 .end = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)),
527 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
528 },
529};
530
531struct sja1000_platform_data pcm970_sja1000_platform_data = {
532 .clock = 16000000 / 2,
533 .ocr = 0x40 | 0x18,
534 .cdr = 0x40,
535};
536
537static struct platform_device pcm970_sja1000 = {
538 .name = "sja1000_platform",
539 .dev = {
540 .platform_data = &pcm970_sja1000_platform_data,
541 },
542 .resource = pcm970_sja1000_resources,
543 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
544};
545
390/* 546/*
391 * Board specific initialization. 547 * Board specific initialization.
392 */ 548 */
@@ -397,6 +553,14 @@ static void __init mxc_board_init(void)
397 mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins), 553 mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
398 "pcm037"); 554 "pcm037");
399 555
556 if (pcm037_variant() == PCM037_EET)
557 mxc_iomux_setup_multiple_pins(pcm037_uart1_pins,
558 ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1");
559 else
560 mxc_iomux_setup_multiple_pins(pcm037_uart1_handshake_pins,
561 ARRAY_SIZE(pcm037_uart1_handshake_pins),
562 "pcm037_uart1");
563
400 platform_add_devices(devices, ARRAY_SIZE(devices)); 564 platform_add_devices(devices, ARRAY_SIZE(devices));
401 565
402 mxc_register_device(&mxc_uart_device0, &uart_pdata); 566 mxc_register_device(&mxc_uart_device0, &uart_pdata);
@@ -415,18 +579,32 @@ static void __init mxc_board_init(void)
415 } 579 }
416 580
417 581
418#ifdef CONFIG_I2C_IMX 582 /* I2C adapters and devices */
419 i2c_register_board_info(1, pcm037_i2c_devices, 583 i2c_register_board_info(1, pcm037_i2c_devices,
420 ARRAY_SIZE(pcm037_i2c_devices)); 584 ARRAY_SIZE(pcm037_i2c_devices));
421 585
422 mxc_register_device(&mxc_i2c_device1, &pcm037_i2c_1_data); 586 mxc_register_device(&mxc_i2c_device1, &pcm037_i2c_1_data);
423#endif 587 mxc_register_device(&mxc_i2c_device2, &pcm037_i2c_2_data);
588
424 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info); 589 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info);
425 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata); 590 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
426 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 591 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
427 mxc_register_device(&mx3_fb, &mx3fb_pdata); 592 mxc_register_device(&mx3_fb, &mx3fb_pdata);
428 if (!gpio_usbotg_hs_activate()) 593 if (!gpio_usbotg_hs_activate())
429 mxc_register_device(&mxc_otg_udc_device, &usb_pdata); 594 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
595
596 /* CSI */
597 /* Camera power: default - off */
598 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), "mt9t031-power");
599 if (!ret)
600 gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1);
601 else
602 iclink.power = NULL;
603
604 if (!pcm037_camera_alloc_dma(4 * 1024 * 1024))
605 mxc_register_device(&mx3_camera, &camera_pdata);
606
607 platform_device_register(&pcm970_sja1000);
430} 608}
431 609
432static void __init pcm037_timer_init(void) 610static void __init pcm037_timer_init(void)
@@ -444,8 +622,7 @@ MACHINE_START(PCM037, "Phytec Phycore pcm037")
444 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 622 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
445 .boot_params = PHYS_OFFSET + 0x100, 623 .boot_params = PHYS_OFFSET + 0x100,
446 .map_io = mx31_map_io, 624 .map_io = mx31_map_io,
447 .init_irq = mxc_init_irq, 625 .init_irq = mx31_init_irq,
448 .init_machine = mxc_board_init, 626 .init_machine = mxc_board_init,
449 .timer = &pcm037_timer, 627 .timer = &pcm037_timer,
450MACHINE_END 628MACHINE_END
451
diff --git a/arch/arm/mach-mx3/pcm037.h b/arch/arm/mach-mx3/pcm037.h
new file mode 100644
index 000000000000..d6929721a5fd
--- /dev/null
+++ b/arch/arm/mach-mx3/pcm037.h
@@ -0,0 +1,11 @@
1#ifndef __PCM037_H__
2#define __PCM037_H__
3
4enum pcm037_board_variant {
5 PCM037_PCM970,
6 PCM037_EET,
7};
8
9extern enum pcm037_board_variant pcm037_variant(void);
10
11#endif
diff --git a/arch/arm/mach-mx3/pcm037_eet.c b/arch/arm/mach-mx3/pcm037_eet.c
new file mode 100644
index 000000000000..fe52fb1bb8b7
--- /dev/null
+++ b/arch/arm/mach-mx3/pcm037_eet.c
@@ -0,0 +1,204 @@
1/*
2 * Copyright (C) 2009
3 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9#include <linux/gpio.h>
10#include <linux/gpio_keys.h>
11#include <linux/input.h>
12#include <linux/platform_device.h>
13#include <linux/spi/spi.h>
14
15#include <mach/common.h>
16#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
17#include <mach/spi.h>
18#endif
19#include <mach/iomux-mx3.h>
20
21#include <asm/mach-types.h>
22
23#include "pcm037.h"
24#include "devices.h"
25
26static unsigned int pcm037_eet_pins[] = {
27 /* SPI #1 */
28 MX31_PIN_CSPI1_MISO__MISO,
29 MX31_PIN_CSPI1_MOSI__MOSI,
30 MX31_PIN_CSPI1_SCLK__SCLK,
31 MX31_PIN_CSPI1_SPI_RDY__SPI_RDY,
32 MX31_PIN_CSPI1_SS0__SS0,
33 MX31_PIN_CSPI1_SS1__SS1,
34 MX31_PIN_CSPI1_SS2__SS2,
35
36 /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
37 IOMUX_MODE(MX31_PIN_KEY_COL7, IOMUX_CONFIG_GPIO),
38 /* GPIO keys */
39 IOMUX_MODE(MX31_PIN_GPIO1_0, IOMUX_CONFIG_GPIO), /* 0 */
40 IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO), /* 1 */
41 IOMUX_MODE(MX31_PIN_GPIO1_2, IOMUX_CONFIG_GPIO), /* 2 */
42 IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO), /* 3 */
43 IOMUX_MODE(MX31_PIN_SVEN0, IOMUX_CONFIG_GPIO), /* 32 */
44 IOMUX_MODE(MX31_PIN_STX0, IOMUX_CONFIG_GPIO), /* 33 */
45 IOMUX_MODE(MX31_PIN_SRX0, IOMUX_CONFIG_GPIO), /* 34 */
46 IOMUX_MODE(MX31_PIN_SIMPD0, IOMUX_CONFIG_GPIO), /* 35 */
47 IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_GPIO), /* 38 */
48 IOMUX_MODE(MX31_PIN_CTS1, IOMUX_CONFIG_GPIO), /* 39 */
49 IOMUX_MODE(MX31_PIN_KEY_ROW4, IOMUX_CONFIG_GPIO), /* 50 */
50 IOMUX_MODE(MX31_PIN_KEY_ROW5, IOMUX_CONFIG_GPIO), /* 51 */
51 IOMUX_MODE(MX31_PIN_KEY_ROW6, IOMUX_CONFIG_GPIO), /* 52 */
52 IOMUX_MODE(MX31_PIN_KEY_ROW7, IOMUX_CONFIG_GPIO), /* 53 */
53
54 /* LEDs */
55 IOMUX_MODE(MX31_PIN_DTR_DTE1, IOMUX_CONFIG_GPIO), /* 44 */
56 IOMUX_MODE(MX31_PIN_DSR_DTE1, IOMUX_CONFIG_GPIO), /* 45 */
57 IOMUX_MODE(MX31_PIN_KEY_COL5, IOMUX_CONFIG_GPIO), /* 55 */
58 IOMUX_MODE(MX31_PIN_KEY_COL6, IOMUX_CONFIG_GPIO), /* 56 */
59};
60
61/* SPI */
62static struct spi_board_info pcm037_spi_dev[] = {
63 {
64 .modalias = "dac124s085",
65 .max_speed_hz = 400000,
66 .bus_num = 0,
67 .chip_select = 0, /* Index in pcm037_spi1_cs[] */
68 .mode = SPI_CPHA,
69 },
70};
71
72/* Platform Data for MXC CSPI */
73#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
74static int pcm037_spi1_cs[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7)};
75
76struct spi_imx_master pcm037_spi1_master = {
77 .chipselect = pcm037_spi1_cs,
78 .num_chipselect = ARRAY_SIZE(pcm037_spi1_cs),
79};
80#endif
81
82/* GPIO-keys input device */
83static struct gpio_keys_button pcm037_gpio_keys[] = {
84 {
85 .type = EV_KEY,
86 .code = KEY_L,
87 .gpio = 0,
88 .desc = "Wheel Manual",
89 .wakeup = 0,
90 }, {
91 .type = EV_KEY,
92 .code = KEY_A,
93 .gpio = 1,
94 .desc = "Wheel AF",
95 .wakeup = 0,
96 }, {
97 .type = EV_KEY,
98 .code = KEY_V,
99 .gpio = 2,
100 .desc = "Wheel View",
101 .wakeup = 0,
102 }, {
103 .type = EV_KEY,
104 .code = KEY_M,
105 .gpio = 3,
106 .desc = "Wheel Menu",
107 .wakeup = 0,
108 }, {
109 .type = EV_KEY,
110 .code = KEY_UP,
111 .gpio = 32,
112 .desc = "Nav Pad Up",
113 .wakeup = 0,
114 }, {
115 .type = EV_KEY,
116 .code = KEY_RIGHT,
117 .gpio = 33,
118 .desc = "Nav Pad Right",
119 .wakeup = 0,
120 }, {
121 .type = EV_KEY,
122 .code = KEY_DOWN,
123 .gpio = 34,
124 .desc = "Nav Pad Down",
125 .wakeup = 0,
126 }, {
127 .type = EV_KEY,
128 .code = KEY_LEFT,
129 .gpio = 35,
130 .desc = "Nav Pad Left",
131 .wakeup = 0,
132 }, {
133 .type = EV_KEY,
134 .code = KEY_ENTER,
135 .gpio = 38,
136 .desc = "Nav Pad Ok",
137 .wakeup = 0,
138 }, {
139 .type = EV_KEY,
140 .code = KEY_O,
141 .gpio = 39,
142 .desc = "Wheel Off",
143 .wakeup = 0,
144 }, {
145 .type = EV_KEY,
146 .code = BTN_FORWARD,
147 .gpio = 50,
148 .desc = "Focus Forward",
149 .wakeup = 0,
150 }, {
151 .type = EV_KEY,
152 .code = BTN_BACK,
153 .gpio = 51,
154 .desc = "Focus Backward",
155 .wakeup = 0,
156 }, {
157 .type = EV_KEY,
158 .code = BTN_MIDDLE,
159 .gpio = 52,
160 .desc = "Release Half",
161 .wakeup = 0,
162 }, {
163 .type = EV_KEY,
164 .code = BTN_EXTRA,
165 .gpio = 53,
166 .desc = "Release Full",
167 .wakeup = 0,
168 },
169};
170
171static struct gpio_keys_platform_data pcm037_gpio_keys_platform_data = {
172 .buttons = pcm037_gpio_keys,
173 .nbuttons = ARRAY_SIZE(pcm037_gpio_keys),
174 .rep = 0, /* No auto-repeat */
175};
176
177static struct platform_device pcm037_gpio_keys_device = {
178 .name = "gpio-keys",
179 .id = -1,
180 .dev = {
181 .platform_data = &pcm037_gpio_keys_platform_data,
182 },
183};
184
185static int eet_init_devices(void)
186{
187 if (!machine_is_pcm037() || pcm037_variant() != PCM037_EET)
188 return 0;
189
190 mxc_iomux_setup_multiple_pins(pcm037_eet_pins,
191 ARRAY_SIZE(pcm037_eet_pins), "pcm037_eet");
192
193 /* SPI */
194 spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev));
195#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
196 mxc_register_device(&mxc_spi_device0, &pcm037_spi1_master);
197#endif
198
199 platform_device_register(&pcm037_gpio_keys_device);
200
201 return 0;
202}
203
204late_initcall(eet_init_devices);
diff --git a/arch/arm/mach-mx3/pcm043.c b/arch/arm/mach-mx3/pcm043.c
index 8d27c324abf2..e18a224671fa 100644
--- a/arch/arm/mach-mx3/pcm043.c
+++ b/arch/arm/mach-mx3/pcm043.c
@@ -133,8 +133,7 @@ static struct i2c_board_info pcm043_i2c_devices[] = {
133 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ 133 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
134 .platform_data = &board_eeprom, 134 .platform_data = &board_eeprom,
135 }, { 135 }, {
136 I2C_BOARD_INFO("rtc-pcf8563", 0x51), 136 I2C_BOARD_INFO("pcf8563", 0x51),
137 .type = "pcf8563",
138 } 137 }
139}; 138};
140#endif 139#endif
@@ -203,7 +202,8 @@ static struct pad_desc pcm043_pads[] = {
203 MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC, 202 MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
204 MX35_PAD_D3_REV__IPU_DISPB_D3_REV, 203 MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
205 MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS, 204 MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
206 MX35_PAD_D3_SPL__IPU_DISPB_D3_SPL 205 /* gpio */
206 MX35_PAD_ATA_CS0__GPIO2_6,
207}; 207};
208 208
209/* 209/*
@@ -245,7 +245,7 @@ MACHINE_START(PCM043, "Phytec Phycore pcm043")
245 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 245 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
246 .boot_params = PHYS_OFFSET + 0x100, 246 .boot_params = PHYS_OFFSET + 0x100,
247 .map_io = mx35_map_io, 247 .map_io = mx35_map_io,
248 .init_irq = mxc_init_irq, 248 .init_irq = mx35_init_irq,
249 .init_machine = mxc_board_init, 249 .init_machine = mxc_board_init,
250 .timer = &pcm043_timer, 250 .timer = &pcm043_timer,
251MACHINE_END 251MACHINE_END
diff --git a/arch/arm/mach-mx3/qong.c b/arch/arm/mach-mx3/qong.c
index 82b31c4ab11f..044511f1b9a9 100644
--- a/arch/arm/mach-mx3/qong.c
+++ b/arch/arm/mach-mx3/qong.c
@@ -81,13 +81,12 @@ static inline void mxc_init_imx_uart(void)
81} 81}
82 82
83static struct resource dnet_resources[] = { 83static struct resource dnet_resources[] = {
84 [0] = { 84 {
85 .name = "dnet-memory", 85 .name = "dnet-memory",
86 .start = QONG_DNET_BASEADDR, 86 .start = QONG_DNET_BASEADDR,
87 .end = QONG_DNET_BASEADDR + QONG_DNET_SIZE - 1, 87 .end = QONG_DNET_BASEADDR + QONG_DNET_SIZE - 1,
88 .flags = IORESOURCE_MEM, 88 .flags = IORESOURCE_MEM,
89 }, 89 }, {
90 [1] = {
91 .start = QONG_FPGA_IRQ, 90 .start = QONG_FPGA_IRQ,
92 .end = QONG_FPGA_IRQ, 91 .end = QONG_FPGA_IRQ,
93 .flags = IORESOURCE_IRQ, 92 .flags = IORESOURCE_IRQ,
@@ -280,7 +279,7 @@ MACHINE_START(QONG, "Dave/DENX QongEVB-LITE")
280 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 279 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
281 .boot_params = PHYS_OFFSET + 0x100, 280 .boot_params = PHYS_OFFSET + 0x100,
282 .map_io = mx31_map_io, 281 .map_io = mx31_map_io,
283 .init_irq = mxc_init_irq, 282 .init_irq = mx31_init_irq,
284 .init_machine = mxc_board_init, 283 .init_machine = mxc_board_init,
285 .timer = &qong_timer, 284 .timer = &qong_timer,
286MACHINE_END 285MACHINE_END
diff --git a/arch/arm/mach-mxc91231/Kconfig b/arch/arm/mach-mxc91231/Kconfig
new file mode 100644
index 000000000000..8e5fa38ebb67
--- /dev/null
+++ b/arch/arm/mach-mxc91231/Kconfig
@@ -0,0 +1,11 @@
1if ARCH_MXC91231
2
3comment "MXC91231 platforms:"
4
5config MACH_MAGX_ZN5
6 bool "Support Motorola Zn5 GSM phone"
7 default n
8 help
9 Include support for Motorola Zn5 GSM phone.
10
11endif
diff --git a/arch/arm/mach-mxc91231/Makefile b/arch/arm/mach-mxc91231/Makefile
new file mode 100644
index 000000000000..011d5e197125
--- /dev/null
+++ b/arch/arm/mach-mxc91231/Makefile
@@ -0,0 +1,2 @@
1obj-y := mm.o clock.o devices.o system.o iomux.o
2obj-$(CONFIG_MACH_MAGX_ZN5) += magx-zn5.o
diff --git a/arch/arm/mach-mxc91231/Makefile.boot b/arch/arm/mach-mxc91231/Makefile.boot
new file mode 100644
index 000000000000..9939a19d99a1
--- /dev/null
+++ b/arch/arm/mach-mxc91231/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x90008000
2params_phys-y := 0x90000100
3initrd_phys-y := 0x90800000
diff --git a/arch/arm/mach-mxc91231/clock.c b/arch/arm/mach-mxc91231/clock.c
new file mode 100644
index 000000000000..ecfa37fef8ad
--- /dev/null
+++ b/arch/arm/mach-mxc91231/clock.c
@@ -0,0 +1,642 @@
1#include <linux/clk.h>
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/io.h>
5
6#include <mach/clock.h>
7#include <mach/hardware.h>
8#include <mach/common.h>
9
10#include <asm/clkdev.h>
11#include <asm/bug.h>
12#include <asm/div64.h>
13
14#include "crm_regs.h"
15
16#define CRM_SMALL_DIVIDER(base, name) \
17 crm_small_divider(base, \
18 base ## _ ## name ## _OFFSET, \
19 base ## _ ## name ## _MASK)
20#define CRM_1DIVIDER(base, name) \
21 crm_divider(base, \
22 base ## _ ## name ## _OFFSET, \
23 base ## _ ## name ## _MASK, 1)
24#define CRM_16DIVIDER(base, name) \
25 crm_divider(base, \
26 base ## _ ## name ## _OFFSET, \
27 base ## _ ## name ## _MASK, 16)
28
29static u32 crm_small_divider(void __iomem *reg, u8 offset, u32 mask)
30{
31 static const u32 crm_small_dividers[] = {
32 2, 3, 4, 5, 6, 8, 10, 12
33 };
34 u8 idx;
35
36 idx = (__raw_readl(reg) & mask) >> offset;
37 if (idx > 7)
38 return 1;
39
40 return crm_small_dividers[idx];
41}
42
43static u32 crm_divider(void __iomem *reg, u8 offset, u32 mask, u32 z)
44{
45 u32 div;
46 div = (__raw_readl(reg) & mask) >> offset;
47 return div ? div : z;
48}
49
50static int _clk_1bit_enable(struct clk *clk)
51{
52 u32 reg;
53
54 reg = __raw_readl(clk->enable_reg);
55 reg |= 1 << clk->enable_shift;
56 __raw_writel(reg, clk->enable_reg);
57
58 return 0;
59}
60
61static void _clk_1bit_disable(struct clk *clk)
62{
63 u32 reg;
64
65 reg = __raw_readl(clk->enable_reg);
66 reg &= ~(1 << clk->enable_shift);
67 __raw_writel(reg, clk->enable_reg);
68}
69
70static int _clk_3bit_enable(struct clk *clk)
71{
72 u32 reg;
73
74 reg = __raw_readl(clk->enable_reg);
75 reg |= 0x7 << clk->enable_shift;
76 __raw_writel(reg, clk->enable_reg);
77
78 return 0;
79}
80
81static void _clk_3bit_disable(struct clk *clk)
82{
83 u32 reg;
84
85 reg = __raw_readl(clk->enable_reg);
86 reg &= ~(0x7 << clk->enable_shift);
87 __raw_writel(reg, clk->enable_reg);
88}
89
90static unsigned long ckih_rate;
91
92static unsigned long clk_ckih_get_rate(struct clk *clk)
93{
94 return ckih_rate;
95}
96
97static struct clk ckih_clk = {
98 .get_rate = clk_ckih_get_rate,
99};
100
101static unsigned long clk_ckih_x2_get_rate(struct clk *clk)
102{
103 return 2 * clk_get_rate(clk->parent);
104}
105
106static struct clk ckih_x2_clk = {
107 .parent = &ckih_clk,
108 .get_rate = clk_ckih_x2_get_rate,
109};
110
111static unsigned long clk_ckil_get_rate(struct clk *clk)
112{
113 return CKIL_CLK_FREQ;
114}
115
116static struct clk ckil_clk = {
117 .get_rate = clk_ckil_get_rate,
118};
119
120/* plls stuff */
121static struct clk mcu_pll_clk;
122static struct clk dsp_pll_clk;
123static struct clk usb_pll_clk;
124
125static struct clk *pll_clk(u8 sel)
126{
127 switch (sel) {
128 case 0:
129 return &mcu_pll_clk;
130 case 1:
131 return &dsp_pll_clk;
132 case 2:
133 return &usb_pll_clk;
134 }
135 BUG();
136}
137
138static void __iomem *pll_base(struct clk *clk)
139{
140 if (clk == &mcu_pll_clk)
141 return MXC_PLL0_BASE;
142 else if (clk == &dsp_pll_clk)
143 return MXC_PLL1_BASE;
144 else if (clk == &usb_pll_clk)
145 return MXC_PLL2_BASE;
146 BUG();
147}
148
149static unsigned long clk_pll_get_rate(struct clk *clk)
150{
151 const void __iomem *pllbase;
152 unsigned long dp_op, dp_mfd, dp_mfn, pll_hfsm, ref_clk, mfi;
153 long mfn, mfn_abs, mfd, pdf;
154 s64 temp;
155 pllbase = pll_base(clk);
156
157 pll_hfsm = __raw_readl(pllbase + MXC_PLL_DP_CTL) & MXC_PLL_DP_CTL_HFSM;
158 if (pll_hfsm == 0) {
159 dp_op = __raw_readl(pllbase + MXC_PLL_DP_OP);
160 dp_mfd = __raw_readl(pllbase + MXC_PLL_DP_MFD);
161 dp_mfn = __raw_readl(pllbase + MXC_PLL_DP_MFN);
162 } else {
163 dp_op = __raw_readl(pllbase + MXC_PLL_DP_HFS_OP);
164 dp_mfd = __raw_readl(pllbase + MXC_PLL_DP_HFS_MFD);
165 dp_mfn = __raw_readl(pllbase + MXC_PLL_DP_HFS_MFN);
166 }
167
168 pdf = dp_op & MXC_PLL_DP_OP_PDF_MASK;
169 mfi = (dp_op >> MXC_PLL_DP_OP_MFI_OFFSET) & MXC_PLL_DP_OP_PDF_MASK;
170 mfi = (mfi <= 5) ? 5 : mfi;
171 mfd = dp_mfd & MXC_PLL_DP_MFD_MASK;
172 mfn = dp_mfn & MXC_PLL_DP_MFN_MASK;
173 mfn = (mfn <= 0x4000000) ? mfn : (mfn - 0x10000000);
174
175 if (mfn < 0)
176 mfn_abs = -mfn;
177 else
178 mfn_abs = mfn;
179
180/* XXX: actually this asumes that ckih is fed to pll, but spec says
181 * that ckih_x2 is also possible. need to check this out.
182 */
183 ref_clk = clk_get_rate(&ckih_clk);
184
185 ref_clk *= 2;
186 ref_clk /= pdf + 1;
187
188 temp = (u64) ref_clk * mfn_abs;
189 do_div(temp, mfd);
190 if (mfn < 0)
191 temp = -temp;
192 temp += ref_clk * mfi;
193
194 return temp;
195}
196
197static int clk_pll_enable(struct clk *clk)
198{
199 void __iomem *ctl;
200 u32 reg;
201
202 ctl = pll_base(clk);
203 reg = __raw_readl(ctl);
204 reg |= (MXC_PLL_DP_CTL_RST | MXC_PLL_DP_CTL_UPEN);
205 __raw_writel(reg, ctl);
206 do {
207 reg = __raw_readl(ctl);
208 } while ((reg & MXC_PLL_DP_CTL_LRF) != MXC_PLL_DP_CTL_LRF);
209 return 0;
210}
211
212static void clk_pll_disable(struct clk *clk)
213{
214 void __iomem *ctl;
215 u32 reg;
216
217 ctl = pll_base(clk);
218 reg = __raw_readl(ctl);
219 reg &= ~(MXC_PLL_DP_CTL_RST | MXC_PLL_DP_CTL_UPEN);
220 __raw_writel(reg, ctl);
221}
222
223static struct clk mcu_pll_clk = {
224 .parent = &ckih_clk,
225 .get_rate = clk_pll_get_rate,
226 .enable = clk_pll_enable,
227 .disable = clk_pll_disable,
228};
229
230static struct clk dsp_pll_clk = {
231 .parent = &ckih_clk,
232 .get_rate = clk_pll_get_rate,
233 .enable = clk_pll_enable,
234 .disable = clk_pll_disable,
235};
236
237static struct clk usb_pll_clk = {
238 .parent = &ckih_clk,
239 .get_rate = clk_pll_get_rate,
240 .enable = clk_pll_enable,
241 .disable = clk_pll_disable,
242};
243/* plls stuff end */
244
245/* ap_ref_clk stuff */
246static struct clk ap_ref_clk;
247
248static unsigned long clk_ap_ref_get_rate(struct clk *clk)
249{
250 u32 ascsr, acsr;
251 u8 ap_pat_ref_div_2, ap_isel, acs, ads;
252
253 ascsr = __raw_readl(MXC_CRMAP_ASCSR);
254 acsr = __raw_readl(MXC_CRMAP_ACSR);
255
256 /* 0 for ckih, 1 for ckih*2 */
257 ap_isel = ascsr & MXC_CRMAP_ASCSR_APISEL;
258 /* reg divider */
259 ap_pat_ref_div_2 = (ascsr >> MXC_CRMAP_ASCSR_AP_PATDIV2_OFFSET) & 0x1;
260 /* undocumented, 1 for disabling divider */
261 ads = (acsr >> MXC_CRMAP_ACSR_ADS_OFFSET) & 0x1;
262 /* 0 for pat_ref, 1 for divider out */
263 acs = acsr & MXC_CRMAP_ACSR_ACS;
264
265 if (acs & !ads)
266 /* use divided clock */
267 return clk_get_rate(clk->parent) / (ap_pat_ref_div_2 ? 2 : 1);
268
269 return clk_get_rate(clk->parent) * (ap_isel ? 2 : 1);
270}
271
272static struct clk ap_ref_clk = {
273 .parent = &ckih_clk,
274 .get_rate = clk_ap_ref_get_rate,
275};
276/* ap_ref_clk stuff end */
277
278/* ap_pre_dfs_clk stuff */
279static struct clk ap_pre_dfs_clk;
280
281static unsigned long clk_ap_pre_dfs_get_rate(struct clk *clk)
282{
283 u32 acsr, ascsr;
284
285 acsr = __raw_readl(MXC_CRMAP_ACSR);
286 ascsr = __raw_readl(MXC_CRMAP_ASCSR);
287
288 if (acsr & MXC_CRMAP_ACSR_ACS) {
289 u8 sel;
290 sel = (ascsr & MXC_CRMAP_ASCSR_APSEL_MASK) >>
291 MXC_CRMAP_ASCSR_APSEL_OFFSET;
292 return clk_get_rate(pll_clk(sel)) /
293 CRM_SMALL_DIVIDER(MXC_CRMAP_ACDR, ARMDIV);
294 }
295 return clk_get_rate(&ap_ref_clk);
296}
297
298static struct clk ap_pre_dfs_clk = {
299 .get_rate = clk_ap_pre_dfs_get_rate,
300};
301/* ap_pre_dfs_clk stuff end */
302
303/* usb_clk stuff */
304static struct clk usb_clk;
305
306static struct clk *clk_usb_parent(struct clk *clk)
307{
308 u32 acsr, ascsr;
309
310 acsr = __raw_readl(MXC_CRMAP_ACSR);
311 ascsr = __raw_readl(MXC_CRMAP_ASCSR);
312
313 if (acsr & MXC_CRMAP_ACSR_ACS) {
314 u8 sel;
315 sel = (ascsr & MXC_CRMAP_ASCSR_USBSEL_MASK) >>
316 MXC_CRMAP_ASCSR_USBSEL_OFFSET;
317 return pll_clk(sel);
318 }
319 return &ap_ref_clk;
320}
321
322static unsigned long clk_usb_get_rate(struct clk *clk)
323{
324 return clk_get_rate(clk->parent) /
325 CRM_SMALL_DIVIDER(MXC_CRMAP_ACDER2, USBDIV);
326}
327
328static struct clk usb_clk = {
329 .enable_reg = MXC_CRMAP_ACDER2,
330 .enable_shift = MXC_CRMAP_ACDER2_USBEN_OFFSET,
331 .get_rate = clk_usb_get_rate,
332 .enable = _clk_1bit_enable,
333 .disable = _clk_1bit_disable,
334};
335/* usb_clk stuff end */
336
337static unsigned long clk_ipg_get_rate(struct clk *clk)
338{
339 return clk_get_rate(clk->parent) / CRM_16DIVIDER(MXC_CRMAP_ACDR, IPDIV);
340}
341
342static unsigned long clk_ahb_get_rate(struct clk *clk)
343{
344 return clk_get_rate(clk->parent) /
345 CRM_16DIVIDER(MXC_CRMAP_ACDR, AHBDIV);
346}
347
348static struct clk ipg_clk = {
349 .parent = &ap_pre_dfs_clk,
350 .get_rate = clk_ipg_get_rate,
351};
352
353static struct clk ahb_clk = {
354 .parent = &ap_pre_dfs_clk,
355 .get_rate = clk_ahb_get_rate,
356};
357
358/* perclk_clk stuff */
359static struct clk perclk_clk;
360
361static unsigned long clk_perclk_get_rate(struct clk *clk)
362{
363 u32 acder2;
364
365 acder2 = __raw_readl(MXC_CRMAP_ACDER2);
366 if (acder2 & MXC_CRMAP_ACDER2_BAUD_ISEL_MASK)
367 return 2 * clk_get_rate(clk->parent);
368
369 return clk_get_rate(clk->parent);
370}
371
372static struct clk perclk_clk = {
373 .parent = &ckih_clk,
374 .get_rate = clk_perclk_get_rate,
375};
376/* perclk_clk stuff end */
377
378/* uart_clk stuff */
379static struct clk uart_clk[];
380
381static unsigned long clk_uart_get_rate(struct clk *clk)
382{
383 u32 div;
384
385 switch (clk->id) {
386 case 0:
387 case 1:
388 div = CRM_SMALL_DIVIDER(MXC_CRMAP_ACDER2, BAUDDIV);
389 break;
390 case 2:
391 div = CRM_SMALL_DIVIDER(MXC_CRMAP_APRA, UART3DIV);
392 break;
393 default:
394 BUG();
395 }
396 return clk_get_rate(clk->parent) / div;
397}
398
399static struct clk uart_clk[] = {
400 {
401 .id = 0,
402 .parent = &perclk_clk,
403 .enable_reg = MXC_CRMAP_APRA,
404 .enable_shift = MXC_CRMAP_APRA_UART1EN_OFFSET,
405 .get_rate = clk_uart_get_rate,
406 .enable = _clk_1bit_enable,
407 .disable = _clk_1bit_disable,
408 }, {
409 .id = 1,
410 .parent = &perclk_clk,
411 .enable_reg = MXC_CRMAP_APRA,
412 .enable_shift = MXC_CRMAP_APRA_UART2EN_OFFSET,
413 .get_rate = clk_uart_get_rate,
414 .enable = _clk_1bit_enable,
415 .disable = _clk_1bit_disable,
416 }, {
417 .id = 2,
418 .parent = &perclk_clk,
419 .enable_reg = MXC_CRMAP_APRA,
420 .enable_shift = MXC_CRMAP_APRA_UART3EN_OFFSET,
421 .get_rate = clk_uart_get_rate,
422 .enable = _clk_1bit_enable,
423 .disable = _clk_1bit_disable,
424 },
425};
426/* uart_clk stuff end */
427
428/* sdhc_clk stuff */
429static struct clk nfc_clk;
430
431static unsigned long clk_nfc_get_rate(struct clk *clk)
432{
433 return clk_get_rate(clk->parent) /
434 CRM_1DIVIDER(MXC_CRMAP_ACDER2, NFCDIV);
435}
436
437static struct clk nfc_clk = {
438 .parent = &ahb_clk,
439 .enable_reg = MXC_CRMAP_ACDER2,
440 .enable_shift = MXC_CRMAP_ACDER2_NFCEN_OFFSET,
441 .get_rate = clk_nfc_get_rate,
442 .enable = _clk_1bit_enable,
443 .disable = _clk_1bit_disable,
444};
445/* sdhc_clk stuff end */
446
447/* sdhc_clk stuff */
448static struct clk sdhc_clk[];
449
450static struct clk *clk_sdhc_parent(struct clk *clk)
451{
452 u32 aprb;
453 u8 sel;
454 u32 mask;
455 int offset;
456
457 aprb = __raw_readl(MXC_CRMAP_APRB);
458
459 switch (clk->id) {
460 case 0:
461 mask = MXC_CRMAP_APRB_SDHC1_ISEL_MASK;
462 offset = MXC_CRMAP_APRB_SDHC1_ISEL_OFFSET;
463 break;
464 case 1:
465 mask = MXC_CRMAP_APRB_SDHC2_ISEL_MASK;
466 offset = MXC_CRMAP_APRB_SDHC2_ISEL_OFFSET;
467 break;
468 default:
469 BUG();
470 }
471 sel = (aprb & mask) >> offset;
472
473 switch (sel) {
474 case 0:
475 return &ckih_clk;
476 case 1:
477 return &ckih_x2_clk;
478 }
479 return &usb_clk;
480}
481
482static unsigned long clk_sdhc_get_rate(struct clk *clk)
483{
484 u32 div;
485
486 switch (clk->id) {
487 case 0:
488 div = CRM_SMALL_DIVIDER(MXC_CRMAP_APRB, SDHC1_DIV);
489 break;
490 case 1:
491 div = CRM_SMALL_DIVIDER(MXC_CRMAP_APRB, SDHC2_DIV);
492 break;
493 default:
494 BUG();
495 }
496
497 return clk_get_rate(clk->parent) / div;
498}
499
500static int clk_sdhc_enable(struct clk *clk)
501{
502 u32 amlpmre1, aprb;
503
504 amlpmre1 = __raw_readl(MXC_CRMAP_AMLPMRE1);
505 aprb = __raw_readl(MXC_CRMAP_APRB);
506 switch (clk->id) {
507 case 0:
508 amlpmre1 |= (0x7 << MXC_CRMAP_AMLPMRE1_MLPME4_OFFSET);
509 aprb |= (0x1 << MXC_CRMAP_APRB_SDHC1EN_OFFSET);
510 break;
511 case 1:
512 amlpmre1 |= (0x7 << MXC_CRMAP_AMLPMRE1_MLPME5_OFFSET);
513 aprb |= (0x1 << MXC_CRMAP_APRB_SDHC2EN_OFFSET);
514 break;
515 }
516 __raw_writel(amlpmre1, MXC_CRMAP_AMLPMRE1);
517 __raw_writel(aprb, MXC_CRMAP_APRB);
518 return 0;
519}
520
521static void clk_sdhc_disable(struct clk *clk)
522{
523 u32 amlpmre1, aprb;
524
525 amlpmre1 = __raw_readl(MXC_CRMAP_AMLPMRE1);
526 aprb = __raw_readl(MXC_CRMAP_APRB);
527 switch (clk->id) {
528 case 0:
529 amlpmre1 &= ~(0x7 << MXC_CRMAP_AMLPMRE1_MLPME4_OFFSET);
530 aprb &= ~(0x1 << MXC_CRMAP_APRB_SDHC1EN_OFFSET);
531 break;
532 case 1:
533 amlpmre1 &= ~(0x7 << MXC_CRMAP_AMLPMRE1_MLPME5_OFFSET);
534 aprb &= ~(0x1 << MXC_CRMAP_APRB_SDHC2EN_OFFSET);
535 break;
536 }
537 __raw_writel(amlpmre1, MXC_CRMAP_AMLPMRE1);
538 __raw_writel(aprb, MXC_CRMAP_APRB);
539}
540
541static struct clk sdhc_clk[] = {
542 {
543 .id = 0,
544 .get_rate = clk_sdhc_get_rate,
545 .enable = clk_sdhc_enable,
546 .disable = clk_sdhc_disable,
547 }, {
548 .id = 1,
549 .get_rate = clk_sdhc_get_rate,
550 .enable = clk_sdhc_enable,
551 .disable = clk_sdhc_disable,
552 },
553};
554/* sdhc_clk stuff end */
555
556/* wdog_clk stuff */
557static struct clk wdog_clk[] = {
558 {
559 .id = 0,
560 .parent = &ipg_clk,
561 .enable_reg = MXC_CRMAP_AMLPMRD,
562 .enable_shift = MXC_CRMAP_AMLPMRD_MLPMD7_OFFSET,
563 .enable = _clk_3bit_enable,
564 .disable = _clk_3bit_disable,
565 }, {
566 .id = 1,
567 .parent = &ipg_clk,
568 .enable_reg = MXC_CRMAP_AMLPMRD,
569 .enable_shift = MXC_CRMAP_AMLPMRD_MLPMD3_OFFSET,
570 .enable = _clk_3bit_enable,
571 .disable = _clk_3bit_disable,
572 },
573};
574/* wdog_clk stuff end */
575
576/* gpt_clk stuff */
577static struct clk gpt_clk = {
578 .parent = &ipg_clk,
579 .enable_reg = MXC_CRMAP_AMLPMRC,
580 .enable_shift = MXC_CRMAP_AMLPMRC_MLPMC4_OFFSET,
581 .enable = _clk_3bit_enable,
582 .disable = _clk_3bit_disable,
583};
584/* gpt_clk stuff end */
585
586/* cspi_clk stuff */
587static struct clk cspi_clk[] = {
588 {
589 .id = 0,
590 .parent = &ipg_clk,
591 .enable_reg = MXC_CRMAP_AMLPMRE2,
592 .enable_shift = MXC_CRMAP_AMLPMRE2_MLPME0_OFFSET,
593 .enable = _clk_3bit_enable,
594 .disable = _clk_3bit_disable,
595 }, {
596 .id = 1,
597 .parent = &ipg_clk,
598 .enable_reg = MXC_CRMAP_AMLPMRE1,
599 .enable_shift = MXC_CRMAP_AMLPMRE1_MLPME6_OFFSET,
600 .enable = _clk_3bit_enable,
601 .disable = _clk_3bit_disable,
602 },
603};
604/* cspi_clk stuff end */
605
606#define _REGISTER_CLOCK(d, n, c) \
607 { \
608 .dev_id = d, \
609 .con_id = n, \
610 .clk = &c, \
611 },
612
613static struct clk_lookup lookups[] = {
614 _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk[0])
615 _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk[1])
616 _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk[2])
617 _REGISTER_CLOCK("mxc-mmc.0", NULL, sdhc_clk[0])
618 _REGISTER_CLOCK("mxc-mmc.1", NULL, sdhc_clk[1])
619 _REGISTER_CLOCK("mxc-wdt.0", NULL, wdog_clk[0])
620 _REGISTER_CLOCK("spi_imx.0", NULL, cspi_clk[0])
621 _REGISTER_CLOCK("spi_imx.1", NULL, cspi_clk[1])
622};
623
624int __init mxc91231_clocks_init(unsigned long fref)
625{
626 void __iomem *gpt_base;
627 int i;
628
629 ckih_rate = fref;
630
631 usb_clk.parent = clk_usb_parent(&usb_clk);
632 sdhc_clk[0].parent = clk_sdhc_parent(&sdhc_clk[0]);
633 sdhc_clk[1].parent = clk_sdhc_parent(&sdhc_clk[1]);
634
635 for (i = 0; i < ARRAY_SIZE(lookups); i++)
636 clkdev_add(&lookups[i]);
637
638 gpt_base = MXC91231_IO_ADDRESS(MXC91231_GPT1_BASE_ADDR);
639 mxc_timer_init(&gpt_clk, gpt_base, MXC91231_INT_GPT);
640
641 return 0;
642}
diff --git a/arch/arm/mach-mxc91231/crm_regs.h b/arch/arm/mach-mxc91231/crm_regs.h
new file mode 100644
index 000000000000..ce4f59058189
--- /dev/null
+++ b/arch/arm/mach-mxc91231/crm_regs.h
@@ -0,0 +1,399 @@
1/*
2 * Copyright 2006 Freescale Semiconductor, Inc.
3 * Copyright 2006-2007 Motorola, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21#ifndef _ARCH_ARM_MACH_MXC91231_CRM_REGS_H_
22#define _ARCH_ARM_MACH_MXC91231_CRM_REGS_H_
23
24#define CKIL_CLK_FREQ 32768
25
26#define MXC_CRM_AP_BASE MXC91231_IO_ADDRESS(MXC91231_CRM_AP_BASE_ADDR)
27#define MXC_CRM_COM_BASE MXC91231_IO_ADDRESS(MXC91231_CRM_COM_BASE_ADDR)
28#define MXC_DSM_BASE MXC91231_IO_ADDRESS(MXC91231_DSM_BASE_ADDR)
29#define MXC_PLL0_BASE MXC91231_IO_ADDRESS(MXC91231_PLL0_BASE_ADDR)
30#define MXC_PLL1_BASE MXC91231_IO_ADDRESS(MXC91231_PLL1_BASE_ADDR)
31#define MXC_PLL2_BASE MXC91231_IO_ADDRESS(MXC91231_PLL2_BASE_ADDR)
32#define MXC_CLKCTL_BASE MXC91231_IO_ADDRESS(MXC91231_CLKCTL_BASE_ADDR)
33
34/* PLL Register Offsets */
35#define MXC_PLL_DP_CTL 0x00
36#define MXC_PLL_DP_CONFIG 0x04
37#define MXC_PLL_DP_OP 0x08
38#define MXC_PLL_DP_MFD 0x0C
39#define MXC_PLL_DP_MFN 0x10
40#define MXC_PLL_DP_HFS_OP 0x1C
41#define MXC_PLL_DP_HFS_MFD 0x20
42#define MXC_PLL_DP_HFS_MFN 0x24
43
44/* PLL Register Bit definitions */
45#define MXC_PLL_DP_CTL_DPDCK0_2_EN 0x1000
46#define MXC_PLL_DP_CTL_ADE 0x800
47#define MXC_PLL_DP_CTL_REF_CLK_DIV 0x400
48#define MXC_PLL_DP_CTL_HFSM 0x80
49#define MXC_PLL_DP_CTL_PRE 0x40
50#define MXC_PLL_DP_CTL_UPEN 0x20
51#define MXC_PLL_DP_CTL_RST 0x10
52#define MXC_PLL_DP_CTL_RCP 0x8
53#define MXC_PLL_DP_CTL_PLM 0x4
54#define MXC_PLL_DP_CTL_BRM0 0x2
55#define MXC_PLL_DP_CTL_LRF 0x1
56
57#define MXC_PLL_DP_OP_MFI_OFFSET 4
58#define MXC_PLL_DP_OP_MFI_MASK 0xF
59#define MXC_PLL_DP_OP_PDF_OFFSET 0
60#define MXC_PLL_DP_OP_PDF_MASK 0xF
61
62#define MXC_PLL_DP_MFD_OFFSET 0
63#define MXC_PLL_DP_MFD_MASK 0x7FFFFFF
64
65#define MXC_PLL_DP_MFN_OFFSET 0
66#define MXC_PLL_DP_MFN_MASK 0x7FFFFFF
67
68/* CRM AP Register Offsets */
69#define MXC_CRMAP_ASCSR (MXC_CRM_AP_BASE + 0x00)
70#define MXC_CRMAP_ACDR (MXC_CRM_AP_BASE + 0x04)
71#define MXC_CRMAP_ACDER1 (MXC_CRM_AP_BASE + 0x08)
72#define MXC_CRMAP_ACDER2 (MXC_CRM_AP_BASE + 0x0C)
73#define MXC_CRMAP_ACGCR (MXC_CRM_AP_BASE + 0x10)
74#define MXC_CRMAP_ACCGCR (MXC_CRM_AP_BASE + 0x14)
75#define MXC_CRMAP_AMLPMRA (MXC_CRM_AP_BASE + 0x18)
76#define MXC_CRMAP_AMLPMRB (MXC_CRM_AP_BASE + 0x1C)
77#define MXC_CRMAP_AMLPMRC (MXC_CRM_AP_BASE + 0x20)
78#define MXC_CRMAP_AMLPMRD (MXC_CRM_AP_BASE + 0x24)
79#define MXC_CRMAP_AMLPMRE1 (MXC_CRM_AP_BASE + 0x28)
80#define MXC_CRMAP_AMLPMRE2 (MXC_CRM_AP_BASE + 0x2C)
81#define MXC_CRMAP_AMLPMRF (MXC_CRM_AP_BASE + 0x30)
82#define MXC_CRMAP_AMLPMRG (MXC_CRM_AP_BASE + 0x34)
83#define MXC_CRMAP_APGCR (MXC_CRM_AP_BASE + 0x38)
84#define MXC_CRMAP_ACSR (MXC_CRM_AP_BASE + 0x3C)
85#define MXC_CRMAP_ADCR (MXC_CRM_AP_BASE + 0x40)
86#define MXC_CRMAP_ACR (MXC_CRM_AP_BASE + 0x44)
87#define MXC_CRMAP_AMCR (MXC_CRM_AP_BASE + 0x48)
88#define MXC_CRMAP_APCR (MXC_CRM_AP_BASE + 0x4C)
89#define MXC_CRMAP_AMORA (MXC_CRM_AP_BASE + 0x50)
90#define MXC_CRMAP_AMORB (MXC_CRM_AP_BASE + 0x54)
91#define MXC_CRMAP_AGPR (MXC_CRM_AP_BASE + 0x58)
92#define MXC_CRMAP_APRA (MXC_CRM_AP_BASE + 0x5C)
93#define MXC_CRMAP_APRB (MXC_CRM_AP_BASE + 0x60)
94#define MXC_CRMAP_APOR (MXC_CRM_AP_BASE + 0x64)
95#define MXC_CRMAP_ADFMR (MXC_CRM_AP_BASE + 0x68)
96
97/* CRM AP Register Bit definitions */
98#define MXC_CRMAP_ASCSR_CRS 0x10000
99#define MXC_CRMAP_ASCSR_AP_PATDIV2_OFFSET 15
100#define MXC_CRMAP_ASCSR_AP_PATREF_DIV2 0x8000
101#define MXC_CRMAP_ASCSR_USBSEL_OFFSET 13
102#define MXC_CRMAP_ASCSR_USBSEL_MASK (0x3 << 13)
103#define MXC_CRMAP_ASCSR_CSISEL_OFFSET 11
104#define MXC_CRMAP_ASCSR_CSISEL_MASK (0x3 << 11)
105#define MXC_CRMAP_ASCSR_SSI2SEL_OFFSET 7
106#define MXC_CRMAP_ASCSR_SSI2SEL_MASK (0x3 << 7)
107#define MXC_CRMAP_ASCSR_SSI1SEL_OFFSET 5
108#define MXC_CRMAP_ASCSR_SSI1SEL_MASK (0x3 << 5)
109#define MXC_CRMAP_ASCSR_APSEL_OFFSET 3
110#define MXC_CRMAP_ASCSR_APSEL_MASK (0x3 << 3)
111#define MXC_CRMAP_ASCSR_AP_PATDIV1_OFFSET 2
112#define MXC_CRMAP_ASCSR_AP_PATREF_DIV1 0x4
113#define MXC_CRMAP_ASCSR_APISEL 0x1
114
115#define MXC_CRMAP_ACDR_ARMDIV_OFFSET 8
116#define MXC_CRMAP_ACDR_ARMDIV_MASK (0xF << 8)
117#define MXC_CRMAP_ACDR_AHBDIV_OFFSET 4
118#define MXC_CRMAP_ACDR_AHBDIV_MASK (0xF << 4)
119#define MXC_CRMAP_ACDR_IPDIV_OFFSET 0
120#define MXC_CRMAP_ACDR_IPDIV_MASK 0xF
121
122#define MXC_CRMAP_ACDER1_CSIEN_OFFSET 30
123#define MXC_CRMAP_ACDER1_CSIDIV_OFFSET 24
124#define MXC_CRMAP_ACDER1_CSIDIV_MASK (0x3F << 24)
125#define MXC_CRMAP_ACDER1_SSI2EN_OFFSET 14
126#define MXC_CRMAP_ACDER1_SSI2DIV_OFFSET 8
127#define MXC_CRMAP_ACDER1_SSI2DIV_MASK (0x3F << 8)
128#define MXC_CRMAP_ACDER1_SSI1EN_OFFSET 6
129#define MXC_CRMAP_ACDER1_SSI1DIV_OFFSET 0
130#define MXC_CRMAP_ACDER1_SSI1DIV_MASK 0x3F
131
132#define MXC_CRMAP_ACDER2_CRCT_CLK_DIV_OFFSET 24
133#define MXC_CRMAP_ACDER2_CRCT_CLK_DIV_MASK (0x7 << 24)
134#define MXC_CRMAP_ACDER2_NFCEN_OFFSET 20
135#define MXC_CRMAP_ACDER2_NFCDIV_OFFSET 16
136#define MXC_CRMAP_ACDER2_NFCDIV_MASK (0xF << 16)
137#define MXC_CRMAP_ACDER2_USBEN_OFFSET 12
138#define MXC_CRMAP_ACDER2_USBDIV_OFFSET 8
139#define MXC_CRMAP_ACDER2_USBDIV_MASK (0xF << 8)
140#define MXC_CRMAP_ACDER2_BAUD_ISEL_OFFSET 5
141#define MXC_CRMAP_ACDER2_BAUD_ISEL_MASK (0x3 << 5)
142#define MXC_CRMAP_ACDER2_BAUDDIV_OFFSET 0
143#define MXC_CRMAP_ACDER2_BAUDDIV_MASK 0xF
144
145#define MXC_CRMAP_AMLPMRA_MLPMA7_OFFSET 22
146#define MXC_CRMAP_AMLPMRA_MLPMA7_MASK (0x7 << 22)
147#define MXC_CRMAP_AMLPMRA_MLPMA6_OFFSET 19
148#define MXC_CRMAP_AMLPMRA_MLPMA6_MASK (0x7 << 19)
149#define MXC_CRMAP_AMLPMRA_MLPMA4_OFFSET 12
150#define MXC_CRMAP_AMLPMRA_MLPMA4_MASK (0x7 << 12)
151#define MXC_CRMAP_AMLPMRA_MLPMA3_OFFSET 9
152#define MXC_CRMAP_AMLPMRA_MLPMA3_MASK (0x7 << 9)
153#define MXC_CRMAP_AMLPMRA_MLPMA2_OFFSET 6
154#define MXC_CRMAP_AMLPMRA_MLPMA2_MASK (0x7 << 6)
155#define MXC_CRMAP_AMLPMRA_MLPMA1_OFFSET 3
156#define MXC_CRMAP_AMLPMRA_MLPMA1_MASK (0x7 << 3)
157
158#define MXC_CRMAP_AMLPMRB_MLPMB0_OFFSET 0
159#define MXC_CRMAP_AMLPMRB_MLPMB0_MASK 0x7
160
161#define MXC_CRMAP_AMLPMRC_MLPMC9_OFFSET 28
162#define MXC_CRMAP_AMLPMRC_MLPMC9_MASK (0x7 << 28)
163#define MXC_CRMAP_AMLPMRC_MLPMC7_OFFSET 22
164#define MXC_CRMAP_AMLPMRC_MLPMC7_MASK (0x7 << 22)
165#define MXC_CRMAP_AMLPMRC_MLPMC5_OFFSET 16
166#define MXC_CRMAP_AMLPMRC_MLPMC5_MASK (0x7 << 16)
167#define MXC_CRMAP_AMLPMRC_MLPMC4_OFFSET 12
168#define MXC_CRMAP_AMLPMRC_MLPMC4_MASK (0x7 << 12)
169#define MXC_CRMAP_AMLPMRC_MLPMC3_OFFSET 9
170#define MXC_CRMAP_AMLPMRC_MLPMC3_MASK (0x7 << 9)
171#define MXC_CRMAP_AMLPMRC_MLPMC2_OFFSET 6
172#define MXC_CRMAP_AMLPMRC_MLPMC2_MASK (0x7 << 6)
173#define MXC_CRMAP_AMLPMRC_MLPMC1_OFFSET 3
174#define MXC_CRMAP_AMLPMRC_MLPMC1_MASK (0x7 << 3)
175#define MXC_CRMAP_AMLPMRC_MLPMC0_OFFSET 0
176#define MXC_CRMAP_AMLPMRC_MLPMC0_MASK 0x7
177
178#define MXC_CRMAP_AMLPMRD_MLPMD7_OFFSET 22
179#define MXC_CRMAP_AMLPMRD_MLPMD7_MASK (0x7 << 22)
180#define MXC_CRMAP_AMLPMRD_MLPMD4_OFFSET 12
181#define MXC_CRMAP_AMLPMRD_MLPMD4_MASK (0x7 << 12)
182#define MXC_CRMAP_AMLPMRD_MLPMD3_OFFSET 9
183#define MXC_CRMAP_AMLPMRD_MLPMD3_MASK (0x7 << 9)
184#define MXC_CRMAP_AMLPMRD_MLPMD2_OFFSET 6
185#define MXC_CRMAP_AMLPMRD_MLPMD2_MASK (0x7 << 6)
186#define MXC_CRMAP_AMLPMRD_MLPMD0_OFFSET 0
187#define MXC_CRMAP_AMLPMRD_MLPMD0_MASK 0x7
188
189#define MXC_CRMAP_AMLPMRE1_MLPME9_OFFSET 28
190#define MXC_CRMAP_AMLPMRE1_MLPME9_MASK (0x7 << 28)
191#define MXC_CRMAP_AMLPMRE1_MLPME8_OFFSET 25
192#define MXC_CRMAP_AMLPMRE1_MLPME8_MASK (0x7 << 25)
193#define MXC_CRMAP_AMLPMRE1_MLPME7_OFFSET 22
194#define MXC_CRMAP_AMLPMRE1_MLPME7_MASK (0x7 << 22)
195#define MXC_CRMAP_AMLPMRE1_MLPME6_OFFSET 19
196#define MXC_CRMAP_AMLPMRE1_MLPME6_MASK (0x7 << 19)
197#define MXC_CRMAP_AMLPMRE1_MLPME5_OFFSET 16
198#define MXC_CRMAP_AMLPMRE1_MLPME5_MASK (0x7 << 16)
199#define MXC_CRMAP_AMLPMRE1_MLPME4_OFFSET 12
200#define MXC_CRMAP_AMLPMRE1_MLPME4_MASK (0x7 << 12)
201#define MXC_CRMAP_AMLPMRE1_MLPME3_OFFSET 9
202#define MXC_CRMAP_AMLPMRE1_MLPME3_MASK (0x7 << 9)
203#define MXC_CRMAP_AMLPMRE1_MLPME2_OFFSET 6
204#define MXC_CRMAP_AMLPMRE1_MLPME2_MASK (0x7 << 6)
205#define MXC_CRMAP_AMLPMRE1_MLPME1_OFFSET 3
206#define MXC_CRMAP_AMLPMRE1_MLPME1_MASK (0x7 << 3)
207#define MXC_CRMAP_AMLPMRE1_MLPME0_OFFSET 0
208#define MXC_CRMAP_AMLPMRE1_MLPME0_MASK 0x7
209
210#define MXC_CRMAP_AMLPMRE2_MLPME0_OFFSET 0
211#define MXC_CRMAP_AMLPMRE2_MLPME0_MASK 0x7
212
213#define MXC_CRMAP_AMLPMRF_MLPMF6_OFFSET 19
214#define MXC_CRMAP_AMLPMRF_MLPMF6_MASK (0x7 << 19)
215#define MXC_CRMAP_AMLPMRF_MLPMF5_OFFSET 16
216#define MXC_CRMAP_AMLPMRF_MLPMF5_MASK (0x7 << 16)
217#define MXC_CRMAP_AMLPMRF_MLPMF3_OFFSET 9
218#define MXC_CRMAP_AMLPMRF_MLPMF3_MASK (0x7 << 9)
219#define MXC_CRMAP_AMLPMRF_MLPMF2_OFFSET 6
220#define MXC_CRMAP_AMLPMRF_MLPMF2_MASK (0x7 << 6)
221#define MXC_CRMAP_AMLPMRF_MLPMF1_OFFSET 3
222#define MXC_CRMAP_AMLPMRF_MLPMF1_MASK (0x7 << 3)
223#define MXC_CRMAP_AMLPMRF_MLPMF0_OFFSET 0
224#define MXC_CRMAP_AMLPMRF_MLPMF0_MASK (0x7 << 0)
225
226#define MXC_CRMAP_AMLPMRG_MLPMG9_OFFSET 28
227#define MXC_CRMAP_AMLPMRG_MLPMG9_MASK (0x7 << 28)
228#define MXC_CRMAP_AMLPMRG_MLPMG7_OFFSET 22
229#define MXC_CRMAP_AMLPMRG_MLPMG7_MASK (0x7 << 22)
230#define MXC_CRMAP_AMLPMRG_MLPMG6_OFFSET 19
231#define MXC_CRMAP_AMLPMRG_MLPMG6_MASK (0x7 << 19)
232#define MXC_CRMAP_AMLPMRG_MLPMG5_OFFSET 16
233#define MXC_CRMAP_AMLPMRG_MLPMG5_MASK (0x7 << 16)
234#define MXC_CRMAP_AMLPMRG_MLPMG4_OFFSET 12
235#define MXC_CRMAP_AMLPMRG_MLPMG4_MASK (0x7 << 12)
236#define MXC_CRMAP_AMLPMRG_MLPMG3_OFFSET 9
237#define MXC_CRMAP_AMLPMRG_MLPMG3_MASK (0x7 << 9)
238#define MXC_CRMAP_AMLPMRG_MLPMG2_OFFSET 6
239#define MXC_CRMAP_AMLPMRG_MLPMG2_MASK (0x7 << 6)
240#define MXC_CRMAP_AMLPMRG_MLPMG1_OFFSET 3
241#define MXC_CRMAP_AMLPMRG_MLPMG1_MASK (0x7 << 3)
242#define MXC_CRMAP_AMLPMRG_MLPMG0_OFFSET 0
243#define MXC_CRMAP_AMLPMRG_MLPMG0_MASK 0x7
244
245#define MXC_CRMAP_AGPR_IPUPAD_OFFSET 20
246#define MXC_CRMAP_AGPR_IPUPAD_MASK (0x7 << 20)
247
248#define MXC_CRMAP_APRA_EL1TEN_OFFSET 29
249#define MXC_CRMAP_APRA_SIMEN_OFFSET 24
250#define MXC_CRMAP_APRA_UART3DIV_OFFSET 17
251#define MXC_CRMAP_APRA_UART3DIV_MASK (0xF << 17)
252#define MXC_CRMAP_APRA_UART3EN_OFFSET 16
253#define MXC_CRMAP_APRA_SAHARA_DIV2_CLKEN_OFFSET 14
254#define MXC_CRMAP_APRA_MQSPIEN_OFFSET 13
255#define MXC_CRMAP_APRA_UART2EN_OFFSET 8
256#define MXC_CRMAP_APRA_UART1EN_OFFSET 0
257
258#define MXC_CRMAP_APRB_SDHC2_ISEL_OFFSET 13
259#define MXC_CRMAP_APRB_SDHC2_ISEL_MASK (0x7 << 13)
260#define MXC_CRMAP_APRB_SDHC2_DIV_OFFSET 9
261#define MXC_CRMAP_APRB_SDHC2_DIV_MASK (0xF << 9)
262#define MXC_CRMAP_APRB_SDHC2EN_OFFSET 8
263#define MXC_CRMAP_APRB_SDHC1_ISEL_OFFSET 5
264#define MXC_CRMAP_APRB_SDHC1_ISEL_MASK (0x7 << 5)
265#define MXC_CRMAP_APRB_SDHC1_DIV_OFFSET 1
266#define MXC_CRMAP_APRB_SDHC1_DIV_MASK (0xF << 1)
267#define MXC_CRMAP_APRB_SDHC1EN_OFFSET 0
268
269#define MXC_CRMAP_ACSR_ADS_OFFSET 8
270#define MXC_CRMAP_ACSR_ADS (0x1 << 8)
271#define MXC_CRMAP_ACSR_ACS 0x1
272
273#define MXC_CRMAP_ADCR_LFDF_0 (0x0 << 8)
274#define MXC_CRMAP_ADCR_LFDF_2 (0x1 << 8)
275#define MXC_CRMAP_ADCR_LFDF_4 (0x2 << 8)
276#define MXC_CRMAP_ADCR_LFDF_8 (0x3 << 8)
277#define MXC_CRMAP_ADCR_LFDF_OFFSET 8
278#define MXC_CRMAP_ADCR_LFDF_MASK (0x3 << 8)
279#define MXC_CRMAP_ADCR_ALT_PLL 0x80
280#define MXC_CRMAP_ADCR_DFS_DIVEN 0x20
281#define MXC_CRMAP_ADCR_DIV_BYP 0x2
282#define MXC_CRMAP_ADCR_VSTAT 0x8
283#define MXC_CRMAP_ADCR_TSTAT 0x10
284#define MXC_CRMAP_ADCR_DVFS_VCTRL 0x10
285#define MXC_CRMAP_ADCR_CLK_ON 0x40
286
287#define MXC_CRMAP_ADFMR_FC_OFFSET 16
288#define MXC_CRMAP_ADFMR_FC_MASK (0x1F << 16)
289#define MXC_CRMAP_ADFMR_MF_OFFSET 1
290#define MXC_CRMAP_ADFMR_MF_MASK (0x3FF << 1)
291#define MXC_CRMAP_ADFMR_DFM_CLK_READY 0x1
292#define MXC_CRMAP_ADFMR_DFM_PWR_DOWN 0x8000
293
294#define MXC_CRMAP_ACR_CKOHS_HIGH (1 << 18)
295#define MXC_CRMAP_ACR_CKOS_HIGH (1 << 16)
296#define MXC_CRMAP_ACR_CKOHS_MASK (0x7 << 12)
297#define MXC_CRMAP_ACR_CKOHD (1 << 11)
298#define MXC_CRMAP_ACR_CKOHDIV_MASK (0xF << 8)
299#define MXC_CRMAP_ACR_CKOHDIV_OFFSET 8
300#define MXC_CRMAP_ACR_CKOD (1 << 7)
301#define MXC_CRMAP_ACR_CKOS_MASK (0x7 << 4)
302
303/* AP Warm reset */
304#define MXC_CRMAP_AMCR_SW_AP (1 << 14)
305
306/* Bit definitions of ACGCR in CRM_AP for tree level clock gating */
307#define MXC_CRMAP_ACGCR_ACG0_STOP_WAIT 0x00000001
308#define MXC_CRMAP_ACGCR_ACG0_STOP 0x00000003
309#define MXC_CRMAP_ACGCR_ACG0_RUN 0x00000007
310#define MXC_CRMAP_ACGCR_ACG0_DISABLED 0x00000000
311
312#define MXC_CRMAP_ACGCR_ACG1_STOP_WAIT 0x00000008
313#define MXC_CRMAP_ACGCR_ACG1_STOP 0x00000018
314#define MXC_CRMAP_ACGCR_ACG1_RUN 0x00000038
315#define MXC_CRMAP_ACGCR_ACG1_DISABLED 0x00000000
316
317#define MXC_CRMAP_ACGCR_ACG2_STOP_WAIT 0x00000040
318#define MXC_CRMAP_ACGCR_ACG2_STOP 0x000000C0
319#define MXC_CRMAP_ACGCR_ACG2_RUN 0x000001C0
320#define MXC_CRMAP_ACGCR_ACG2_DISABLED 0x00000000
321
322#define MXC_CRMAP_ACGCR_ACG3_STOP_WAIT 0x00000200
323#define MXC_CRMAP_ACGCR_ACG3_STOP 0x00000600
324#define MXC_CRMAP_ACGCR_ACG3_RUN 0x00000E00
325#define MXC_CRMAP_ACGCR_ACG3_DISABLED 0x00000000
326
327#define MXC_CRMAP_ACGCR_ACG4_STOP_WAIT 0x00001000
328#define MXC_CRMAP_ACGCR_ACG4_STOP 0x00003000
329#define MXC_CRMAP_ACGCR_ACG4_RUN 0x00007000
330#define MXC_CRMAP_ACGCR_ACG4_DISABLED 0x00000000
331
332#define MXC_CRMAP_ACGCR_ACG5_STOP_WAIT 0x00010000
333#define MXC_CRMAP_ACGCR_ACG5_STOP 0x00030000
334#define MXC_CRMAP_ACGCR_ACG5_RUN 0x00070000
335#define MXC_CRMAP_ACGCR_ACG5_DISABLED 0x00000000
336
337#define MXC_CRMAP_ACGCR_ACG6_STOP_WAIT 0x00080000
338#define MXC_CRMAP_ACGCR_ACG6_STOP 0x00180000
339#define MXC_CRMAP_ACGCR_ACG6_RUN 0x00380000
340#define MXC_CRMAP_ACGCR_ACG6_DISABLED 0x00000000
341
342#define NUM_GATE_CTRL 6
343
344/* CRM COM Register Offsets */
345#define MXC_CRMCOM_CSCR (MXC_CRM_COM_BASE + 0x0C)
346#define MXC_CRMCOM_CCCR (MXC_CRM_COM_BASE + 0x10)
347
348/* CRM COM Bit Definitions */
349#define MXC_CRMCOM_CSCR_PPD1 0x08000000
350#define MXC_CRMCOM_CSCR_CKOHSEL (1 << 18)
351#define MXC_CRMCOM_CSCR_CKOSEL (1 << 17)
352#define MXC_CRMCOM_CCCR_CC_DIV_OFFSET 8
353#define MXC_CRMCOM_CCCR_CC_DIV_MASK (0x1F << 8)
354#define MXC_CRMCOM_CCCR_CC_SEL_OFFSET 0
355#define MXC_CRMCOM_CCCR_CC_SEL_MASK 0x3
356
357/* DSM Register Offsets */
358#define MXC_DSM_SLEEP_TIME (MXC_DSM_BASE + 0x0c)
359#define MXC_DSM_CONTROL0 (MXC_DSM_BASE + 0x20)
360#define MXC_DSM_CONTROL1 (MXC_DSM_BASE + 0x24)
361#define MXC_DSM_CTREN (MXC_DSM_BASE + 0x28)
362#define MXC_DSM_WARM_PER (MXC_DSM_BASE + 0x40)
363#define MXC_DSM_LOCK_PER (MXC_DSM_BASE + 0x44)
364#define MXC_DSM_MGPER (MXC_DSM_BASE + 0x4c)
365#define MXC_DSM_CRM_CONTROL (MXC_DSM_BASE + 0x50)
366
367/* Bit definitions of various registers in DSM */
368#define MXC_DSM_CRM_CTRL_DVFS_BYP 0x00000008
369#define MXC_DSM_CRM_CTRL_DVFS_VCTRL 0x00000004
370#define MXC_DSM_CRM_CTRL_LPMD1 0x00000002
371#define MXC_DSM_CRM_CTRL_LPMD0 0x00000001
372#define MXC_DSM_CRM_CTRL_LPMD_STOP_MODE 0x00000000
373#define MXC_DSM_CRM_CTRL_LPMD_WAIT_MODE 0x00000001
374#define MXC_DSM_CRM_CTRL_LPMD_RUN_MODE 0x00000003
375#define MXC_DSM_CONTROL0_STBY_COMMIT_EN 0x00000200
376#define MXC_DSM_CONTROL0_MSTR_EN 0x00000001
377#define MXC_DSM_CONTROL0_RESTART 0x00000010
378/* Counter Block reset */
379#define MXC_DSM_CONTROL1_CB_RST 0x00000002
380/* State Machine reset */
381#define MXC_DSM_CONTROL1_SM_RST 0x00000004
382/* Bit needed to reset counter block */
383#define MXC_CONTROL1_RST_CNT32 0x00000008
384#define MXC_DSM_CONTROL1_RST_CNT32_EN 0x00000800
385#define MXC_DSM_CONTROL1_SLEEP 0x00000100
386#define MXC_DSM_CONTROL1_WAKEUP_DISABLE 0x00004000
387#define MXC_DSM_CTREN_CNT32 0x00000001
388
389/* Magic Fix enable bit */
390#define MXC_DSM_MGPER_EN_MGFX 0x80000000
391#define MXC_DSM_MGPER_PER_MASK 0x000003FF
392#define MXC_DSM_MGPER_PER(n) (MXC_DSM_MGPER_PER_MASK & n)
393
394/* Address offsets of the CLKCTL registers */
395#define MXC_CLKCTL_GP_CTRL (MXC_CLKCTL_BASE + 0x00)
396#define MXC_CLKCTL_GP_SER (MXC_CLKCTL_BASE + 0x04)
397#define MXC_CLKCTL_GP_CER (MXC_CLKCTL_BASE + 0x08)
398
399#endif /* _ARCH_ARM_MACH_MXC91231_CRM_REGS_H_ */
diff --git a/arch/arm/mach-mxc91231/devices.c b/arch/arm/mach-mxc91231/devices.c
new file mode 100644
index 000000000000..353bd977b393
--- /dev/null
+++ b/arch/arm/mach-mxc91231/devices.c
@@ -0,0 +1,251 @@
1/*
2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/platform_device.h>
22#include <linux/serial.h>
23#include <linux/gpio.h>
24#include <mach/hardware.h>
25#include <mach/irqs.h>
26#include <mach/imx-uart.h>
27
28static struct resource uart0[] = {
29 {
30 .start = MXC91231_UART1_BASE_ADDR,
31 .end = MXC91231_UART1_BASE_ADDR + 0x0B5,
32 .flags = IORESOURCE_MEM,
33 }, {
34 .start = MXC91231_INT_UART1_RX,
35 .end = MXC91231_INT_UART1_RX,
36 .flags = IORESOURCE_IRQ,
37 }, {
38 .start = MXC91231_INT_UART1_TX,
39 .end = MXC91231_INT_UART1_TX,
40 .flags = IORESOURCE_IRQ,
41 }, {
42 .start = MXC91231_INT_UART1_MINT,
43 .end = MXC91231_INT_UART1_MINT,
44 .flags = IORESOURCE_IRQ,
45 },
46};
47
48struct platform_device mxc_uart_device0 = {
49 .name = "imx-uart",
50 .id = 0,
51 .resource = uart0,
52 .num_resources = ARRAY_SIZE(uart0),
53};
54
55static struct resource uart1[] = {
56 {
57 .start = MXC91231_UART2_BASE_ADDR,
58 .end = MXC91231_UART2_BASE_ADDR + 0x0B5,
59 .flags = IORESOURCE_MEM,
60 }, {
61 .start = MXC91231_INT_UART2_RX,
62 .end = MXC91231_INT_UART2_RX,
63 .flags = IORESOURCE_IRQ,
64 }, {
65 .start = MXC91231_INT_UART2_TX,
66 .end = MXC91231_INT_UART2_TX,
67 .flags = IORESOURCE_IRQ,
68 }, {
69 .start = MXC91231_INT_UART2_MINT,
70 .end = MXC91231_INT_UART2_MINT,
71 .flags = IORESOURCE_IRQ,
72 },
73};
74
75struct platform_device mxc_uart_device1 = {
76 .name = "imx-uart",
77 .id = 1,
78 .resource = uart1,
79 .num_resources = ARRAY_SIZE(uart1),
80};
81
82static struct resource uart2[] = {
83 {
84 .start = MXC91231_UART3_BASE_ADDR,
85 .end = MXC91231_UART3_BASE_ADDR + 0x0B5,
86 .flags = IORESOURCE_MEM,
87 }, {
88 .start = MXC91231_INT_UART3_RX,
89 .end = MXC91231_INT_UART3_RX,
90 .flags = IORESOURCE_IRQ,
91 }, {
92 .start = MXC91231_INT_UART3_TX,
93 .end = MXC91231_INT_UART3_TX,
94 .flags = IORESOURCE_IRQ,
95 }, {
96 .start = MXC91231_INT_UART3_MINT,
97 .end = MXC91231_INT_UART3_MINT,
98 .flags = IORESOURCE_IRQ,
99
100 },
101};
102
103struct platform_device mxc_uart_device2 = {
104 .name = "imx-uart",
105 .id = 2,
106 .resource = uart2,
107 .num_resources = ARRAY_SIZE(uart2),
108};
109
110/* GPIO port description */
111static struct mxc_gpio_port mxc_gpio_ports[] = {
112 [0] = {
113 .chip.label = "gpio-0",
114 .base = MXC91231_IO_ADDRESS(MXC91231_GPIO1_AP_BASE_ADDR),
115 .irq = MXC91231_INT_GPIO1,
116 .virtual_irq_start = MXC_GPIO_IRQ_START,
117 },
118 [1] = {
119 .chip.label = "gpio-1",
120 .base = MXC91231_IO_ADDRESS(MXC91231_GPIO2_AP_BASE_ADDR),
121 .irq = MXC91231_INT_GPIO2,
122 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
123 },
124 [2] = {
125 .chip.label = "gpio-2",
126 .base = MXC91231_IO_ADDRESS(MXC91231_GPIO3_AP_BASE_ADDR),
127 .irq = MXC91231_INT_GPIO3,
128 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
129 },
130 [3] = {
131 .chip.label = "gpio-3",
132 .base = MXC91231_IO_ADDRESS(MXC91231_GPIO4_SH_BASE_ADDR),
133 .irq = MXC91231_INT_GPIO4,
134 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
135 },
136};
137
138int __init mxc_register_gpios(void)
139{
140 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
141}
142
143static struct resource mxc_nand_resources[] = {
144 {
145 .start = MXC91231_NFC_BASE_ADDR,
146 .end = MXC91231_NFC_BASE_ADDR + 0xfff,
147 .flags = IORESOURCE_MEM
148 }, {
149 .start = MXC91231_INT_NANDFC,
150 .end = MXC91231_INT_NANDFC,
151 .flags = IORESOURCE_IRQ
152 },
153};
154
155struct platform_device mxc_nand_device = {
156 .name = "mxc_nand",
157 .id = 0,
158 .num_resources = ARRAY_SIZE(mxc_nand_resources),
159 .resource = mxc_nand_resources,
160};
161
162static struct resource mxc_sdhc0_resources[] = {
163 {
164 .start = MXC91231_MMC_SDHC1_BASE_ADDR,
165 .end = MXC91231_MMC_SDHC1_BASE_ADDR + SZ_16K - 1,
166 .flags = IORESOURCE_MEM,
167 }, {
168 .start = MXC91231_INT_MMC_SDHC1,
169 .end = MXC91231_INT_MMC_SDHC1,
170 .flags = IORESOURCE_IRQ,
171 },
172};
173
174static struct resource mxc_sdhc1_resources[] = {
175 {
176 .start = MXC91231_MMC_SDHC2_BASE_ADDR,
177 .end = MXC91231_MMC_SDHC2_BASE_ADDR + SZ_16K - 1,
178 .flags = IORESOURCE_MEM,
179 }, {
180 .start = MXC91231_INT_MMC_SDHC2,
181 .end = MXC91231_INT_MMC_SDHC2,
182 .flags = IORESOURCE_IRQ,
183 },
184};
185
186struct platform_device mxc_sdhc_device0 = {
187 .name = "mxc-mmc",
188 .id = 0,
189 .num_resources = ARRAY_SIZE(mxc_sdhc0_resources),
190 .resource = mxc_sdhc0_resources,
191};
192
193struct platform_device mxc_sdhc_device1 = {
194 .name = "mxc-mmc",
195 .id = 1,
196 .num_resources = ARRAY_SIZE(mxc_sdhc1_resources),
197 .resource = mxc_sdhc1_resources,
198};
199
200static struct resource mxc_cspi0_resources[] = {
201 {
202 .start = MXC91231_CSPI1_BASE_ADDR,
203 .end = MXC91231_CSPI1_BASE_ADDR + 0x20,
204 .flags = IORESOURCE_MEM,
205 }, {
206 .start = MXC91231_INT_CSPI1,
207 .end = MXC91231_INT_CSPI1,
208 .flags = IORESOURCE_IRQ,
209 },
210};
211
212struct platform_device mxc_cspi_device0 = {
213 .name = "spi_imx",
214 .id = 0,
215 .num_resources = ARRAY_SIZE(mxc_cspi0_resources),
216 .resource = mxc_cspi0_resources,
217};
218
219static struct resource mxc_cspi1_resources[] = {
220 {
221 .start = MXC91231_CSPI2_BASE_ADDR,
222 .end = MXC91231_CSPI2_BASE_ADDR + 0x20,
223 .flags = IORESOURCE_MEM,
224 }, {
225 .start = MXC91231_INT_CSPI2,
226 .end = MXC91231_INT_CSPI2,
227 .flags = IORESOURCE_IRQ,
228 },
229};
230
231struct platform_device mxc_cspi_device1 = {
232 .name = "spi_imx",
233 .id = 1,
234 .num_resources = ARRAY_SIZE(mxc_cspi1_resources),
235 .resource = mxc_cspi1_resources,
236};
237
238static struct resource mxc_wdog0_resources[] = {
239 {
240 .start = MXC91231_WDOG1_BASE_ADDR,
241 .end = MXC91231_WDOG1_BASE_ADDR + 0x10,
242 .flags = IORESOURCE_MEM,
243 },
244};
245
246struct platform_device mxc_wdog_device0 = {
247 .name = "mxc-wdt",
248 .id = 0,
249 .num_resources = ARRAY_SIZE(mxc_wdog0_resources),
250 .resource = mxc_wdog0_resources,
251};
diff --git a/arch/arm/mach-mxc91231/devices.h b/arch/arm/mach-mxc91231/devices.h
new file mode 100644
index 000000000000..72a2136ce27d
--- /dev/null
+++ b/arch/arm/mach-mxc91231/devices.h
@@ -0,0 +1,13 @@
1extern struct platform_device mxc_uart_device0;
2extern struct platform_device mxc_uart_device1;
3extern struct platform_device mxc_uart_device2;
4
5extern struct platform_device mxc_nand_device;
6
7extern struct platform_device mxc_sdhc_device0;
8extern struct platform_device mxc_sdhc_device1;
9
10extern struct platform_device mxc_cspi_device0;
11extern struct platform_device mxc_cspi_device1;
12
13extern struct platform_device mxc_wdog_device0;
diff --git a/arch/arm/mach-mxc91231/iomux.c b/arch/arm/mach-mxc91231/iomux.c
new file mode 100644
index 000000000000..405d9b19d891
--- /dev/null
+++ b/arch/arm/mach-mxc91231/iomux.c
@@ -0,0 +1,177 @@
1/*
2 * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
4 * Copyright (C) 2009 by Valentin Longchamp <valentin.longchamp@epfl.ch>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */
20
21#include <linux/module.h>
22#include <linux/spinlock.h>
23#include <linux/io.h>
24#include <linux/kernel.h>
25#include <mach/hardware.h>
26#include <mach/gpio.h>
27#include <mach/iomux-mxc91231.h>
28
29/*
30 * IOMUX register (base) addresses
31 */
32#define IOMUX_AP_BASE MXC91231_IO_ADDRESS(MXC91231_IOMUX_AP_BASE_ADDR)
33#define IOMUX_COM_BASE MXC91231_IO_ADDRESS(MXC91231_IOMUX_COM_BASE_ADDR)
34#define IOMUXSW_AP_MUX_CTL (IOMUX_AP_BASE + 0x000)
35#define IOMUXSW_SP_MUX_CTL (IOMUX_COM_BASE + 0x000)
36#define IOMUXSW_PAD_CTL (IOMUX_COM_BASE + 0x200)
37
38#define IOMUXINT_OBS1 (IOMUX_AP_BASE + 0x600)
39#define IOMUXINT_OBS2 (IOMUX_AP_BASE + 0x004)
40
41static DEFINE_SPINLOCK(gpio_mux_lock);
42
43#define NB_PORTS ((PIN_MAX + 32) / 32)
44#define PIN_GLOBAL_NUM(pin) \
45 (((pin & MUX_SIDE_MASK) >> MUX_SIDE_SHIFT)*PIN_AP_MAX + \
46 ((pin & MUX_REG_MASK) >> MUX_REG_SHIFT)*4 + \
47 ((pin & MUX_FIELD_MASK) >> MUX_FIELD_SHIFT))
48
49unsigned long mxc_pin_alloc_map[NB_PORTS * 32 / BITS_PER_LONG];
50/*
51 * set the mode for a IOMUX pin.
52 */
53int mxc_iomux_mode(const unsigned int pin_mode)
54{
55 u32 side, field, l, mode, ret = 0;
56 void __iomem *reg;
57
58 side = (pin_mode & MUX_SIDE_MASK) >> MUX_SIDE_SHIFT;
59 switch (side) {
60 case MUX_SIDE_AP:
61 reg = IOMUXSW_AP_MUX_CTL;
62 break;
63 case MUX_SIDE_SP:
64 reg = IOMUXSW_SP_MUX_CTL;
65 break;
66 default:
67 return -EINVAL;
68 }
69 reg += ((pin_mode & MUX_REG_MASK) >> MUX_REG_SHIFT) * 4;
70 field = (pin_mode & MUX_FIELD_MASK) >> MUX_FIELD_SHIFT;
71 mode = (pin_mode & MUX_MODE_MASK) >> MUX_MODE_SHIFT;
72
73 spin_lock(&gpio_mux_lock);
74
75 l = __raw_readl(reg);
76 l &= ~(0xff << (field * 8));
77 l |= mode << (field * 8);
78 __raw_writel(l, reg);
79
80 spin_unlock(&gpio_mux_lock);
81
82 return ret;
83}
84EXPORT_SYMBOL(mxc_iomux_mode);
85
86/*
87 * This function configures the pad value for a IOMUX pin.
88 */
89void mxc_iomux_set_pad(enum iomux_pins pin, u32 config)
90{
91 u32 padgrp, field, l;
92 void __iomem *reg;
93
94 padgrp = (pin & MUX_PADGRP_MASK) >> MUX_PADGRP_SHIFT;
95 reg = IOMUXSW_PAD_CTL + (pin + 2) / 3 * 4;
96 field = (pin + 2) % 3;
97
98 pr_debug("%s: reg offset = 0x%x, field = %d\n",
99 __func__, (pin + 2) / 3, field);
100
101 spin_lock(&gpio_mux_lock);
102
103 l = __raw_readl(reg);
104 l &= ~(0x1ff << (field * 10));
105 l |= config << (field * 10);
106 __raw_writel(l, reg);
107
108 spin_unlock(&gpio_mux_lock);
109}
110EXPORT_SYMBOL(mxc_iomux_set_pad);
111
112/*
113 * allocs a single pin:
114 * - reserves the pin so that it is not claimed by another driver
115 * - setups the iomux according to the configuration
116 */
117int mxc_iomux_alloc_pin(const unsigned int pin_mode, const char *label)
118{
119 unsigned pad = PIN_GLOBAL_NUM(pin_mode);
120 if (pad >= (PIN_MAX + 1)) {
121 printk(KERN_ERR "mxc_iomux: Attempt to request nonexistant pin %u for \"%s\"\n",
122 pad, label ? label : "?");
123 return -EINVAL;
124 }
125
126 if (test_and_set_bit(pad, mxc_pin_alloc_map)) {
127 printk(KERN_ERR "mxc_iomux: pin %u already used. Allocation for \"%s\" failed\n",
128 pad, label ? label : "?");
129 return -EBUSY;
130 }
131 mxc_iomux_mode(pin_mode);
132
133 return 0;
134}
135EXPORT_SYMBOL(mxc_iomux_alloc_pin);
136
137int mxc_iomux_setup_multiple_pins(unsigned int *pin_list, unsigned count,
138 const char *label)
139{
140 unsigned int *p = pin_list;
141 int i;
142 int ret = -EINVAL;
143
144 for (i = 0; i < count; i++) {
145 ret = mxc_iomux_alloc_pin(*p, label);
146 if (ret)
147 goto setup_error;
148 p++;
149 }
150 return 0;
151
152setup_error:
153 mxc_iomux_release_multiple_pins(pin_list, i);
154 return ret;
155}
156EXPORT_SYMBOL(mxc_iomux_setup_multiple_pins);
157
158void mxc_iomux_release_pin(const unsigned int pin_mode)
159{
160 unsigned pad = PIN_GLOBAL_NUM(pin_mode);
161
162 if (pad < (PIN_MAX + 1))
163 clear_bit(pad, mxc_pin_alloc_map);
164}
165EXPORT_SYMBOL(mxc_iomux_release_pin);
166
167void mxc_iomux_release_multiple_pins(unsigned int *pin_list, int count)
168{
169 unsigned int *p = pin_list;
170 int i;
171
172 for (i = 0; i < count; i++) {
173 mxc_iomux_release_pin(*p);
174 p++;
175 }
176}
177EXPORT_SYMBOL(mxc_iomux_release_multiple_pins);
diff --git a/arch/arm/mach-mxc91231/magx-zn5.c b/arch/arm/mach-mxc91231/magx-zn5.c
new file mode 100644
index 000000000000..7dbe4ca12efd
--- /dev/null
+++ b/arch/arm/mach-mxc91231/magx-zn5.c
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2009 Dmitriy Taychenachev <dimichxp@gmail.com>
3 *
4 * This file is released under the GPLv2 or later.
5 */
6
7#include <linux/irq.h>
8#include <linux/init.h>
9#include <linux/device.h>
10
11#include <asm/mach-types.h>
12#include <asm/mach/time.h>
13#include <asm/mach/arch.h>
14
15#include <mach/common.h>
16#include <mach/hardware.h>
17#include <mach/iomux-mxc91231.h>
18#include <mach/mmc.h>
19#include <mach/imx-uart.h>
20
21#include "devices.h"
22
23static struct imxuart_platform_data uart_pdata = {
24};
25
26static struct imxmmc_platform_data sdhc_pdata = {
27};
28
29static void __init zn5_init(void)
30{
31 pm_power_off = mxc91231_power_off;
32
33 mxc_iomux_alloc_pin(MXC91231_PIN_SP_USB_DAT_VP__RXD2, "uart2-rx");
34 mxc_iomux_alloc_pin(MXC91231_PIN_SP_USB_SE0_VM__TXD2, "uart2-tx");
35
36 mxc_register_device(&mxc_uart_device1, &uart_pdata);
37 mxc_register_device(&mxc_uart_device0, &uart_pdata);
38
39 mxc_register_device(&mxc_sdhc_device0, &sdhc_pdata);
40
41 mxc_register_device(&mxc_wdog_device0, NULL);
42
43 return;
44}
45
46static void __init zn5_timer_init(void)
47{
48 mxc91231_clocks_init(26000000); /* 26mhz ckih */
49}
50
51struct sys_timer zn5_timer = {
52 .init = zn5_timer_init,
53};
54
55MACHINE_START(MAGX_ZN5, "Motorola Zn5")
56 .phys_io = MXC91231_AIPS1_BASE_ADDR,
57 .io_pg_offst = ((MXC91231_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
58 .boot_params = PHYS_OFFSET + 0x100,
59 .map_io = mxc91231_map_io,
60 .init_irq = mxc91231_init_irq,
61 .timer = &zn5_timer,
62 .init_machine = zn5_init,
63MACHINE_END
diff --git a/arch/arm/mach-mxc91231/mm.c b/arch/arm/mach-mxc91231/mm.c
new file mode 100644
index 000000000000..6becda3ff331
--- /dev/null
+++ b/arch/arm/mach-mxc91231/mm.c
@@ -0,0 +1,94 @@
1/*
2 * Copyright (C) 1999,2000 Arm Limited
3 * Copyright (C) 2000 Deep Blue Solutions Ltd
4 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
5 * Copyright 2004-2005 Freescale Semiconductor, Inc. All Rights Reserved.
6 * - add MXC specific definitions
7 * Copyright 2006 Motorola, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <linux/mm.h>
26#include <linux/init.h>
27#include <mach/hardware.h>
28#include <mach/common.h>
29#include <asm/pgtable.h>
30#include <asm/mach/map.h>
31
32/*
33 * This structure defines the MXC memory map.
34 */
35static struct map_desc mxc_io_desc[] __initdata = {
36 {
37 .virtual = MXC91231_L2CC_BASE_ADDR_VIRT,
38 .pfn = __phys_to_pfn(MXC91231_L2CC_BASE_ADDR),
39 .length = MXC91231_L2CC_SIZE,
40 .type = MT_DEVICE,
41 }, {
42 .virtual = MXC91231_X_MEMC_BASE_ADDR_VIRT,
43 .pfn = __phys_to_pfn(MXC91231_X_MEMC_BASE_ADDR),
44 .length = MXC91231_X_MEMC_SIZE,
45 .type = MT_DEVICE,
46 }, {
47 .virtual = MXC91231_ROMP_BASE_ADDR_VIRT,
48 .pfn = __phys_to_pfn(MXC91231_ROMP_BASE_ADDR),
49 .length = MXC91231_ROMP_SIZE,
50 .type = MT_DEVICE,
51 }, {
52 .virtual = MXC91231_AVIC_BASE_ADDR_VIRT,
53 .pfn = __phys_to_pfn(MXC91231_AVIC_BASE_ADDR),
54 .length = MXC91231_AVIC_SIZE,
55 .type = MT_DEVICE,
56 }, {
57 .virtual = MXC91231_AIPS1_BASE_ADDR_VIRT,
58 .pfn = __phys_to_pfn(MXC91231_AIPS1_BASE_ADDR),
59 .length = MXC91231_AIPS1_SIZE,
60 .type = MT_DEVICE,
61 }, {
62 .virtual = MXC91231_SPBA0_BASE_ADDR_VIRT,
63 .pfn = __phys_to_pfn(MXC91231_SPBA0_BASE_ADDR),
64 .length = MXC91231_SPBA0_SIZE,
65 .type = MT_DEVICE,
66 }, {
67 .virtual = MXC91231_SPBA1_BASE_ADDR_VIRT,
68 .pfn = __phys_to_pfn(MXC91231_SPBA1_BASE_ADDR),
69 .length = MXC91231_SPBA1_SIZE,
70 .type = MT_DEVICE,
71 }, {
72 .virtual = MXC91231_AIPS2_BASE_ADDR_VIRT,
73 .pfn = __phys_to_pfn(MXC91231_AIPS2_BASE_ADDR),
74 .length = MXC91231_AIPS2_SIZE,
75 .type = MT_DEVICE,
76 },
77};
78
79/*
80 * This function initializes the memory map. It is called during the
81 * system startup to create static physical to virtual memory map for
82 * the IO modules.
83 */
84void __init mxc91231_map_io(void)
85{
86 mxc_set_cpu_type(MXC_CPU_MXC91231);
87
88 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
89}
90
91void __init mxc91231_init_irq(void)
92{
93 mxc_init_irq(MXC91231_IO_ADDRESS(MXC91231_AVIC_BASE_ADDR));
94}
diff --git a/arch/arm/mach-mxc91231/system.c b/arch/arm/mach-mxc91231/system.c
new file mode 100644
index 000000000000..736f7efd874a
--- /dev/null
+++ b/arch/arm/mach-mxc91231/system.c
@@ -0,0 +1,51 @@
1/*
2 * Copyright 2009 Dmitriy Taychenachev <dimichxp@gmail.com>
3 *
4 * This file is released under the GPLv2 or later.
5 */
6
7#include <linux/delay.h>
8#include <linux/io.h>
9
10#include <asm/proc-fns.h>
11#include <mach/hardware.h>
12
13#include "crm_regs.h"
14
15#define WDOG_WCR MXC91231_IO_ADDRESS(MXC91231_WDOG1_BASE_ADDR)
16#define WDOG_WCR_OUT_ENABLE (1 << 6)
17#define WDOG_WCR_ASSERT (1 << 5)
18
19void mxc91231_power_off(void)
20{
21 u16 wcr;
22
23 wcr = __raw_readw(WDOG_WCR);
24 wcr |= WDOG_WCR_OUT_ENABLE;
25 wcr &= ~WDOG_WCR_ASSERT;
26 __raw_writew(wcr, WDOG_WCR);
27}
28
29void mxc91231_arch_reset(char mode, const char *cmd)
30{
31 u32 amcr;
32
33 /* Reset the AP using CRM */
34 amcr = __raw_readl(MXC_CRMAP_AMCR);
35 amcr &= ~MXC_CRMAP_AMCR_SW_AP;
36 __raw_writel(amcr, MXC_CRMAP_AMCR);
37
38 mdelay(10);
39 cpu_reset(0);
40}
41
42void mxc91231_prepare_idle(void)
43{
44 u32 crm_ctl;
45
46 /* Go to WAIT mode after WFI */
47 crm_ctl = __raw_readl(MXC_DSM_CRM_CONTROL);
48 crm_ctl &= ~(MXC_DSM_CRM_CTRL_LPMD0 | MXC_DSM_CRM_CTRL_LPMD1);
49 crm_ctl |= MXC_DSM_CRM_CTRL_LPMD_WAIT_MODE;
50 __raw_writel(crm_ctl, MXC_DSM_CRM_CONTROL);
51}
diff --git a/arch/arm/mach-netx/include/mach/entry-macro.S b/arch/arm/mach-netx/include/mach/entry-macro.S
index a1952a0feda6..844f1f9acbdf 100644
--- a/arch/arm/mach-netx/include/mach/entry-macro.S
+++ b/arch/arm/mach-netx/include/mach/entry-macro.S
@@ -24,15 +24,13 @@
24 .endm 24 .endm
25 25
26 .macro get_irqnr_preamble, base, tmp 26 .macro get_irqnr_preamble, base, tmp
27 ldr \base, =io_p2v(0x001ff000)
27 .endm 28 .endm
28 29
29 .macro arch_ret_to_user, tmp1, tmp2 30 .macro arch_ret_to_user, tmp1, tmp2
30 .endm 31 .endm
31 32
32 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 33 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
33 mov \base, #io_p2v(0x00100000)
34 add \base, \base, #0x000ff000
35
36 ldr \irqstat, [\base, #0] 34 ldr \irqstat, [\base, #0]
37 clz \irqnr, \irqstat 35 clz \irqnr, \irqstat
38 rsb \irqnr, \irqnr, #31 36 rsb \irqnr, \irqnr, #31
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
new file mode 100644
index 000000000000..2a02b49c40f0
--- /dev/null
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -0,0 +1,21 @@
1if ARCH_NOMADIK
2
3menu "Nomadik boards"
4
5config MACH_NOMADIK_8815NHK
6 bool "ST 8815 Nomadik Hardware Kit (evaluation board)"
7 select NOMADIK_8815
8
9endmenu
10
11config NOMADIK_8815
12 bool
13
14
15config I2C_BITBANG_8815NHK
16 tristate "Driver for bit-bang busses found on the 8815 NHK"
17 depends on I2C && MACH_NOMADIK_8815NHK
18 select I2C_ALGOBIT
19 default y
20
21endif
diff --git a/arch/arm/mach-nomadik/Makefile b/arch/arm/mach-nomadik/Makefile
new file mode 100644
index 000000000000..412040982a40
--- /dev/null
+++ b/arch/arm/mach-nomadik/Makefile
@@ -0,0 +1,19 @@
1#
2# Makefile for the linux kernel.
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7
8# Object file lists.
9
10obj-y += clock.o timer.o gpio.o
11
12# Cpu revision
13obj-$(CONFIG_NOMADIK_8815) += cpu-8815.o
14
15# Specific board support
16obj-$(CONFIG_MACH_NOMADIK_8815NHK) += board-nhk8815.o
17
18# Nomadik extra devices
19obj-$(CONFIG_I2C_BITBANG_8815NHK) += i2c-8815nhk.o
diff --git a/arch/arm/mach-nomadik/Makefile.boot b/arch/arm/mach-nomadik/Makefile.boot
new file mode 100644
index 000000000000..c7e75acfe6c9
--- /dev/null
+++ b/arch/arm/mach-nomadik/Makefile.boot
@@ -0,0 +1,4 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
4
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
new file mode 100644
index 000000000000..79bdea943eb4
--- /dev/null
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -0,0 +1,111 @@
1/*
2 * linux/arch/arm/mach-nomadik/board-8815nhk.c
3 *
4 * Copyright (C) STMicroelectronics
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 * NHK15 board specifc driver definition
11 */
12#include <linux/types.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/amba/bus.h>
17#include <linux/interrupt.h>
18#include <linux/gpio.h>
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/irq.h>
22#include <mach/setup.h>
23#include "clock.h"
24
25#define __MEM_4K_RESOURCE(x) \
26 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
27
28static struct amba_device uart0_device = {
29 .dev = { .init_name = "uart0" },
30 __MEM_4K_RESOURCE(NOMADIK_UART0_BASE),
31 .irq = {IRQ_UART0, NO_IRQ},
32};
33
34static struct amba_device uart1_device = {
35 .dev = { .init_name = "uart1" },
36 __MEM_4K_RESOURCE(NOMADIK_UART1_BASE),
37 .irq = {IRQ_UART1, NO_IRQ},
38};
39
40static struct amba_device *amba_devs[] __initdata = {
41 &uart0_device,
42 &uart1_device,
43};
44
45/* We have a fixed clock alone, by now */
46static struct clk nhk8815_clk_48 = {
47 .rate = 48*1000*1000,
48};
49
50static struct resource nhk8815_eth_resources[] = {
51 {
52 .name = "smc91x-regs",
53 .start = 0x34000000 + 0x300,
54 .end = 0x34000000 + SZ_64K - 1,
55 .flags = IORESOURCE_MEM,
56 }, {
57 .start = NOMADIK_GPIO_TO_IRQ(115),
58 .end = NOMADIK_GPIO_TO_IRQ(115),
59 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
60 }
61};
62
63static struct platform_device nhk8815_eth_device = {
64 .name = "smc91x",
65 .resource = nhk8815_eth_resources,
66 .num_resources = ARRAY_SIZE(nhk8815_eth_resources),
67};
68
69static int __init nhk8815_eth_init(void)
70{
71 int gpio_nr = 115; /* hardwired in the board */
72 int err;
73
74 err = gpio_request(gpio_nr, "eth_irq");
75 if (!err) err = nmk_gpio_set_mode(gpio_nr, NMK_GPIO_ALT_GPIO);
76 if (!err) err = gpio_direction_input(gpio_nr);
77 if (err)
78 pr_err("Error %i in %s\n", err, __func__);
79 return err;
80}
81device_initcall(nhk8815_eth_init);
82
83static struct platform_device *nhk8815_platform_devices[] __initdata = {
84 &nhk8815_eth_device,
85 /* will add more devices */
86};
87
88static void __init nhk8815_platform_init(void)
89{
90 int i;
91
92 cpu8815_platform_init();
93 platform_add_devices(nhk8815_platform_devices,
94 ARRAY_SIZE(nhk8815_platform_devices));
95
96 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
97 nmdk_clk_create(&nhk8815_clk_48, amba_devs[i]->dev.init_name);
98 amba_device_register(amba_devs[i], &iomem_resource);
99 }
100}
101
102MACHINE_START(NOMADIK, "NHK8815")
103 /* Maintainer: ST MicroElectronics */
104 .phys_io = NOMADIK_UART0_BASE,
105 .io_pg_offst = (IO_ADDRESS(NOMADIK_UART0_BASE) >> 18) & 0xfffc,
106 .boot_params = 0x100,
107 .map_io = cpu8815_map_io,
108 .init_irq = cpu8815_init_irq,
109 .timer = &nomadik_timer,
110 .init_machine = nhk8815_platform_init,
111MACHINE_END
diff --git a/arch/arm/mach-nomadik/clock.c b/arch/arm/mach-nomadik/clock.c
new file mode 100644
index 000000000000..9f92502a0083
--- /dev/null
+++ b/arch/arm/mach-nomadik/clock.c
@@ -0,0 +1,45 @@
1/*
2 * linux/arch/arm/mach-nomadik/clock.c
3 *
4 * Copyright (C) 2009 Alessandro Rubini
5 */
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/errno.h>
9#include <linux/clk.h>
10#include <asm/clkdev.h>
11#include "clock.h"
12
13/*
14 * The nomadik board uses generic clocks, but the serial pl011 file
15 * calls clk_enable(), clk_disable(), clk_get_rate(), so we provide them
16 */
17unsigned long clk_get_rate(struct clk *clk)
18{
19 return clk->rate;
20}
21EXPORT_SYMBOL(clk_get_rate);
22
23/* enable and disable do nothing */
24int clk_enable(struct clk *clk)
25{
26 return 0;
27}
28EXPORT_SYMBOL(clk_enable);
29
30void clk_disable(struct clk *clk)
31{
32}
33EXPORT_SYMBOL(clk_disable);
34
35/* Create a clock structure with the given name */
36int nmdk_clk_create(struct clk *clk, const char *dev_id)
37{
38 struct clk_lookup *clkdev;
39
40 clkdev = clkdev_alloc(clk, NULL, dev_id);
41 if (!clkdev)
42 return -ENOMEM;
43 clkdev_add(clkdev);
44 return 0;
45}
diff --git a/arch/arm/mach-nomadik/clock.h b/arch/arm/mach-nomadik/clock.h
new file mode 100644
index 000000000000..235faec7f627
--- /dev/null
+++ b/arch/arm/mach-nomadik/clock.h
@@ -0,0 +1,14 @@
1
2/*
3 * linux/arch/arm/mach-nomadik/clock.h
4 *
5 * Copyright (C) 2009 Alessandro Rubini
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 */
11struct clk {
12 unsigned long rate;
13};
14extern int nmdk_clk_create(struct clk *clk, const char *dev_id);
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
new file mode 100644
index 000000000000..f93c59634191
--- /dev/null
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -0,0 +1,139 @@
1/*
2 * Copyright STMicroelectronics, 2007.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/types.h>
20#include <linux/init.h>
21#include <linux/device.h>
22#include <linux/amba/bus.h>
23#include <linux/gpio.h>
24
25#include <mach/hardware.h>
26#include <mach/irqs.h>
27#include <asm/mach/map.h>
28#include <asm/hardware/vic.h>
29
30#include <asm/cacheflush.h>
31#include <asm/hardware/cache-l2x0.h>
32
33/* The 8815 has 4 GPIO blocks, let's register them immediately */
34static struct nmk_gpio_platform_data cpu8815_gpio[] = {
35 {
36 .name = "GPIO-0-31",
37 .first_gpio = 0,
38 .first_irq = NOMADIK_GPIO_TO_IRQ(0),
39 .parent_irq = IRQ_GPIO0,
40 }, {
41 .name = "GPIO-32-63",
42 .first_gpio = 32,
43 .first_irq = NOMADIK_GPIO_TO_IRQ(32),
44 .parent_irq = IRQ_GPIO1,
45 }, {
46 .name = "GPIO-64-95",
47 .first_gpio = 64,
48 .first_irq = NOMADIK_GPIO_TO_IRQ(64),
49 .parent_irq = IRQ_GPIO2,
50 }, {
51 .name = "GPIO-96-127", /* 124..127 not routed to pin */
52 .first_gpio = 96,
53 .first_irq = NOMADIK_GPIO_TO_IRQ(96),
54 .parent_irq = IRQ_GPIO3,
55 }
56};
57
58#define __MEM_4K_RESOURCE(x) \
59 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
60
61static struct amba_device cpu8815_amba_gpio[] = {
62 {
63 .dev = {
64 .init_name = "gpio0",
65 .platform_data = cpu8815_gpio + 0,
66 },
67 __MEM_4K_RESOURCE(NOMADIK_GPIO0_BASE),
68 }, {
69 .dev = {
70 .init_name = "gpio1",
71 .platform_data = cpu8815_gpio + 1,
72 },
73 __MEM_4K_RESOURCE(NOMADIK_GPIO1_BASE),
74 }, {
75 .dev = {
76 .init_name = "gpio2",
77 .platform_data = cpu8815_gpio + 2,
78 },
79 __MEM_4K_RESOURCE(NOMADIK_GPIO2_BASE),
80 }, {
81 .dev = {
82 .init_name = "gpio3",
83 .platform_data = cpu8815_gpio + 3,
84 },
85 __MEM_4K_RESOURCE(NOMADIK_GPIO3_BASE),
86 },
87};
88
89static struct amba_device *amba_devs[] __initdata = {
90 cpu8815_amba_gpio + 0,
91 cpu8815_amba_gpio + 1,
92 cpu8815_amba_gpio + 2,
93 cpu8815_amba_gpio + 3,
94};
95
96static int __init cpu8815_init(void)
97{
98 int i;
99
100 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
101 amba_device_register(amba_devs[i], &iomem_resource);
102 return 0;
103}
104arch_initcall(cpu8815_init);
105
106/* All SoC devices live in the same area (see hardware.h) */
107static struct map_desc nomadik_io_desc[] __initdata = {
108 {
109 .virtual = NOMADIK_IO_VIRTUAL,
110 .pfn = __phys_to_pfn(NOMADIK_IO_PHYSICAL),
111 .length = NOMADIK_IO_SIZE,
112 .type = MT_DEVICE,
113 }
114 /* static ram and secured ram may be added later */
115};
116
117void __init cpu8815_map_io(void)
118{
119 iotable_init(nomadik_io_desc, ARRAY_SIZE(nomadik_io_desc));
120}
121
122void __init cpu8815_init_irq(void)
123{
124 /* This modified VIC cell has two register blocks, at 0 and 0x20 */
125 vic_init(io_p2v(NOMADIK_IC_BASE + 0x00), IRQ_VIC_START + 0, ~0, 0);
126 vic_init(io_p2v(NOMADIK_IC_BASE + 0x20), IRQ_VIC_START + 32, ~0, 0);
127}
128
129/*
130 * This function is called from the board init ("init_machine").
131 */
132 void __init cpu8815_platform_init(void)
133{
134#ifdef CONFIG_CACHE_L2X0
135 /* At full speed latency must be >=2, so 0x249 in low bits */
136 l2x0_init(io_p2v(NOMADIK_L2CC_BASE), 0x00730249, 0xfe000fff);
137#endif
138 return;
139}
diff --git a/arch/arm/mach-nomadik/gpio.c b/arch/arm/mach-nomadik/gpio.c
new file mode 100644
index 000000000000..9a09b2791e03
--- /dev/null
+++ b/arch/arm/mach-nomadik/gpio.c
@@ -0,0 +1,396 @@
1/*
2 * Generic GPIO driver for logic cells found in the Nomadik SoC
3 *
4 * Copyright (C) 2008,2009 STMicroelectronics
5 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
6 * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com>
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#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/device.h>
16#include <linux/amba/bus.h>
17#include <linux/io.h>
18#include <linux/gpio.h>
19#include <linux/spinlock.h>
20#include <linux/interrupt.h>
21#include <linux/irq.h>
22
23#include <mach/hardware.h>
24#include <mach/gpio.h>
25
26/*
27 * The GPIO module in the Nomadik family of Systems-on-Chip is an
28 * AMBA device, managing 32 pins and alternate functions. The logic block
29 * is currently only used in the Nomadik.
30 *
31 * Symbols in this file are called "nmk_gpio" for "nomadik gpio"
32 */
33
34#define NMK_GPIO_PER_CHIP 32
35struct nmk_gpio_chip {
36 struct gpio_chip chip;
37 void __iomem *addr;
38 unsigned int parent_irq;
39 spinlock_t *lock;
40 /* Keep track of configured edges */
41 u32 edge_rising;
42 u32 edge_falling;
43};
44
45/* Mode functions */
46int nmk_gpio_set_mode(int gpio, int gpio_mode)
47{
48 struct nmk_gpio_chip *nmk_chip;
49 unsigned long flags;
50 u32 afunc, bfunc, bit;
51
52 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
53 if (!nmk_chip)
54 return -EINVAL;
55
56 bit = 1 << (gpio - nmk_chip->chip.base);
57
58 spin_lock_irqsave(&nmk_chip->lock, flags);
59 afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & ~bit;
60 bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & ~bit;
61 if (gpio_mode & NMK_GPIO_ALT_A)
62 afunc |= bit;
63 if (gpio_mode & NMK_GPIO_ALT_B)
64 bfunc |= bit;
65 writel(afunc, nmk_chip->addr + NMK_GPIO_AFSLA);
66 writel(bfunc, nmk_chip->addr + NMK_GPIO_AFSLB);
67 spin_unlock_irqrestore(&nmk_chip->lock, flags);
68
69 return 0;
70}
71EXPORT_SYMBOL(nmk_gpio_set_mode);
72
73int nmk_gpio_get_mode(int gpio)
74{
75 struct nmk_gpio_chip *nmk_chip;
76 u32 afunc, bfunc, bit;
77
78 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
79 if (!nmk_chip)
80 return -EINVAL;
81
82 bit = 1 << (gpio - nmk_chip->chip.base);
83
84 afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & bit;
85 bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & bit;
86
87 return (afunc ? NMK_GPIO_ALT_A : 0) | (bfunc ? NMK_GPIO_ALT_B : 0);
88}
89EXPORT_SYMBOL(nmk_gpio_get_mode);
90
91
92/* IRQ functions */
93static inline int nmk_gpio_get_bitmask(int gpio)
94{
95 return 1 << (gpio % 32);
96}
97
98static void nmk_gpio_irq_ack(unsigned int irq)
99{
100 int gpio;
101 struct nmk_gpio_chip *nmk_chip;
102
103 gpio = NOMADIK_IRQ_TO_GPIO(irq);
104 nmk_chip = get_irq_chip_data(irq);
105 if (!nmk_chip)
106 return;
107 writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC);
108}
109
110static void nmk_gpio_irq_mask(unsigned int irq)
111{
112 int gpio;
113 struct nmk_gpio_chip *nmk_chip;
114 unsigned long flags;
115 u32 bitmask, reg;
116
117 gpio = NOMADIK_IRQ_TO_GPIO(irq);
118 nmk_chip = get_irq_chip_data(irq);
119 bitmask = nmk_gpio_get_bitmask(gpio);
120 if (!nmk_chip)
121 return;
122
123 /* we must individually clear the two edges */
124 spin_lock_irqsave(&nmk_chip->lock, flags);
125 if (nmk_chip->edge_rising & bitmask) {
126 reg = readl(nmk_chip->addr + NMK_GPIO_RWIMSC);
127 reg &= ~bitmask;
128 writel(reg, nmk_chip->addr + NMK_GPIO_RWIMSC);
129 }
130 if (nmk_chip->edge_falling & bitmask) {
131 reg = readl(nmk_chip->addr + NMK_GPIO_FWIMSC);
132 reg &= ~bitmask;
133 writel(reg, nmk_chip->addr + NMK_GPIO_FWIMSC);
134 }
135 spin_unlock_irqrestore(&nmk_chip->lock, flags);
136};
137
138static void nmk_gpio_irq_unmask(unsigned int irq)
139{
140 int gpio;
141 struct nmk_gpio_chip *nmk_chip;
142 unsigned long flags;
143 u32 bitmask, reg;
144
145 gpio = NOMADIK_IRQ_TO_GPIO(irq);
146 nmk_chip = get_irq_chip_data(irq);
147 bitmask = nmk_gpio_get_bitmask(gpio);
148 if (!nmk_chip)
149 return;
150
151 /* we must individually set the two edges */
152 spin_lock_irqsave(&nmk_chip->lock, flags);
153 if (nmk_chip->edge_rising & bitmask) {
154 reg = readl(nmk_chip->addr + NMK_GPIO_RWIMSC);
155 reg |= bitmask;
156 writel(reg, nmk_chip->addr + NMK_GPIO_RWIMSC);
157 }
158 if (nmk_chip->edge_falling & bitmask) {
159 reg = readl(nmk_chip->addr + NMK_GPIO_FWIMSC);
160 reg |= bitmask;
161 writel(reg, nmk_chip->addr + NMK_GPIO_FWIMSC);
162 }
163 spin_unlock_irqrestore(&nmk_chip->lock, flags);
164}
165
166static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
167{
168 int gpio;
169 struct nmk_gpio_chip *nmk_chip;
170 unsigned long flags;
171 u32 bitmask;
172
173 gpio = NOMADIK_IRQ_TO_GPIO(irq);
174 nmk_chip = get_irq_chip_data(irq);
175 bitmask = nmk_gpio_get_bitmask(gpio);
176 if (!nmk_chip)
177 return -EINVAL;
178
179 if (type & IRQ_TYPE_LEVEL_HIGH)
180 return -EINVAL;
181 if (type & IRQ_TYPE_LEVEL_LOW)
182 return -EINVAL;
183
184 spin_lock_irqsave(&nmk_chip->lock, flags);
185
186 nmk_chip->edge_rising &= ~bitmask;
187 if (type & IRQ_TYPE_EDGE_RISING)
188 nmk_chip->edge_rising |= bitmask;
189 writel(nmk_chip->edge_rising, nmk_chip->addr + NMK_GPIO_RIMSC);
190
191 nmk_chip->edge_falling &= ~bitmask;
192 if (type & IRQ_TYPE_EDGE_FALLING)
193 nmk_chip->edge_falling |= bitmask;
194 writel(nmk_chip->edge_falling, nmk_chip->addr + NMK_GPIO_FIMSC);
195
196 spin_unlock_irqrestore(&nmk_chip->lock, flags);
197
198 nmk_gpio_irq_unmask(irq);
199
200 return 0;
201}
202
203static struct irq_chip nmk_gpio_irq_chip = {
204 .name = "Nomadik-GPIO",
205 .ack = nmk_gpio_irq_ack,
206 .mask = nmk_gpio_irq_mask,
207 .unmask = nmk_gpio_irq_unmask,
208 .set_type = nmk_gpio_irq_set_type,
209};
210
211static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
212{
213 struct nmk_gpio_chip *nmk_chip;
214 struct irq_chip *host_chip;
215 unsigned int gpio_irq;
216 u32 pending;
217 unsigned int first_irq;
218
219 nmk_chip = get_irq_data(irq);
220 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base);
221 while ( (pending = readl(nmk_chip->addr + NMK_GPIO_IS)) ) {
222 gpio_irq = first_irq + __ffs(pending);
223 generic_handle_irq(gpio_irq);
224 }
225 if (0) {/* don't ack parent irq, as ack == disable */
226 host_chip = get_irq_chip(irq);
227 host_chip->ack(irq);
228 }
229}
230
231static int nmk_gpio_init_irq(struct nmk_gpio_chip *nmk_chip)
232{
233 unsigned int first_irq;
234 int i;
235
236 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base);
237 for (i = first_irq; i < first_irq + NMK_GPIO_PER_CHIP; i++) {
238 set_irq_chip(i, &nmk_gpio_irq_chip);
239 set_irq_handler(i, handle_edge_irq);
240 set_irq_flags(i, IRQF_VALID);
241 set_irq_chip_data(i, nmk_chip);
242 }
243 set_irq_chained_handler(nmk_chip->parent_irq, nmk_gpio_irq_handler);
244 set_irq_data(nmk_chip->parent_irq, nmk_chip);
245 return 0;
246}
247
248/* I/O Functions */
249static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
250{
251 struct nmk_gpio_chip *nmk_chip =
252 container_of(chip, struct nmk_gpio_chip, chip);
253
254 writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRC);
255 return 0;
256}
257
258static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
259 int val)
260{
261 struct nmk_gpio_chip *nmk_chip =
262 container_of(chip, struct nmk_gpio_chip, chip);
263
264 writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRS);
265 return 0;
266}
267
268static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset)
269{
270 struct nmk_gpio_chip *nmk_chip =
271 container_of(chip, struct nmk_gpio_chip, chip);
272 u32 bit = 1 << offset;
273
274 return (readl(nmk_chip->addr + NMK_GPIO_DAT) & bit) != 0;
275}
276
277static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset,
278 int val)
279{
280 struct nmk_gpio_chip *nmk_chip =
281 container_of(chip, struct nmk_gpio_chip, chip);
282 u32 bit = 1 << offset;
283
284 if (val)
285 writel(bit, nmk_chip->addr + NMK_GPIO_DATS);
286 else
287 writel(bit, nmk_chip->addr + NMK_GPIO_DATC);
288}
289
290/* This structure is replicated for each GPIO block allocated at probe time */
291static struct gpio_chip nmk_gpio_template = {
292 .direction_input = nmk_gpio_make_input,
293 .get = nmk_gpio_get_input,
294 .direction_output = nmk_gpio_make_output,
295 .set = nmk_gpio_set_output,
296 .ngpio = NMK_GPIO_PER_CHIP,
297 .can_sleep = 0,
298};
299
300static int __init nmk_gpio_probe(struct amba_device *dev, struct amba_id *id)
301{
302 struct nmk_gpio_platform_data *pdata;
303 struct nmk_gpio_chip *nmk_chip;
304 struct gpio_chip *chip;
305 int ret;
306
307 pdata = dev->dev.platform_data;
308 ret = amba_request_regions(dev, pdata->name);
309 if (ret)
310 return ret;
311
312 nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL);
313 if (!nmk_chip) {
314 ret = -ENOMEM;
315 goto out_amba;
316 }
317 /*
318 * The virt address in nmk_chip->addr is in the nomadik register space,
319 * so we can simply convert the resource address, without remapping
320 */
321 nmk_chip->addr = io_p2v(dev->res.start);
322 nmk_chip->chip = nmk_gpio_template;
323 nmk_chip->parent_irq = pdata->parent_irq;
324
325 chip = &nmk_chip->chip;
326 chip->base = pdata->first_gpio;
327 chip->label = pdata->name;
328 chip->dev = &dev->dev;
329 chip->owner = THIS_MODULE;
330
331 ret = gpiochip_add(&nmk_chip->chip);
332 if (ret)
333 goto out_free;
334
335 amba_set_drvdata(dev, nmk_chip);
336
337 nmk_gpio_init_irq(nmk_chip);
338
339 dev_info(&dev->dev, "Bits %i-%i at address %p\n",
340 nmk_chip->chip.base, nmk_chip->chip.base+31, nmk_chip->addr);
341 return 0;
342
343 out_free:
344 kfree(nmk_chip);
345 out_amba:
346 amba_release_regions(dev);
347 dev_err(&dev->dev, "Failure %i for GPIO %i-%i\n", ret,
348 pdata->first_gpio, pdata->first_gpio+31);
349 return ret;
350}
351
352static int nmk_gpio_remove(struct amba_device *dev)
353{
354 struct nmk_gpio_chip *nmk_chip;
355
356 nmk_chip = amba_get_drvdata(dev);
357 gpiochip_remove(&nmk_chip->chip);
358 kfree(nmk_chip);
359 amba_release_regions(dev);
360 return 0;
361}
362
363
364/* We have 0x1f080060 and 0x1f180060, accept both using the mask */
365static struct amba_id nmk_gpio_ids[] = {
366 {
367 .id = 0x1f080060,
368 .mask = 0xffefffff,
369 },
370 {0, 0},
371};
372
373static struct amba_driver nmk_gpio_driver = {
374 .drv = {
375 .owner = THIS_MODULE,
376 .name = "gpio",
377 },
378 .probe = nmk_gpio_probe,
379 .remove = nmk_gpio_remove,
380 .suspend = NULL, /* to be done */
381 .resume = NULL,
382 .id_table = nmk_gpio_ids,
383};
384
385static int __init nmk_gpio_init(void)
386{
387 return amba_driver_register(&nmk_gpio_driver);
388}
389
390arch_initcall(nmk_gpio_init);
391
392MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini");
393MODULE_DESCRIPTION("Nomadik GPIO Driver");
394MODULE_LICENSE("GPL");
395
396
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c
new file mode 100644
index 000000000000..abfe25a08d6b
--- /dev/null
+++ b/arch/arm/mach-nomadik/i2c-8815nhk.c
@@ -0,0 +1,65 @@
1#include <linux/module.h>
2#include <linux/init.h>
3#include <linux/i2c.h>
4#include <linux/i2c-algo-bit.h>
5#include <linux/i2c-gpio.h>
6#include <linux/gpio.h>
7#include <linux/platform_device.h>
8
9/*
10 * There are two busses in the 8815NHK.
11 * They could, in theory, be driven by the hardware component, but we
12 * use bit-bang through GPIO by now, to keep things simple
13 */
14
15static struct i2c_gpio_platform_data nhk8815_i2c_data0 = {
16 /* keep defaults for timeouts; pins are push-pull bidirectional */
17 .scl_pin = 62,
18 .sda_pin = 63,
19};
20
21static struct i2c_gpio_platform_data nhk8815_i2c_data1 = {
22 /* keep defaults for timeouts; pins are push-pull bidirectional */
23 .scl_pin = 53,
24 .sda_pin = 54,
25};
26
27/* first bus: GPIO XX and YY */
28static struct platform_device nhk8815_i2c_dev0 = {
29 .name = "i2c-gpio",
30 .id = 0,
31 .dev = {
32 .platform_data = &nhk8815_i2c_data0,
33 },
34};
35/* second bus: GPIO XX and YY */
36static struct platform_device nhk8815_i2c_dev1 = {
37 .name = "i2c-gpio",
38 .id = 1,
39 .dev = {
40 .platform_data = &nhk8815_i2c_data1,
41 },
42};
43
44static int __init nhk8815_i2c_init(void)
45{
46 nmk_gpio_set_mode(nhk8815_i2c_data0.scl_pin, NMK_GPIO_ALT_GPIO);
47 nmk_gpio_set_mode(nhk8815_i2c_data0.sda_pin, NMK_GPIO_ALT_GPIO);
48 platform_device_register(&nhk8815_i2c_dev0);
49
50 nmk_gpio_set_mode(nhk8815_i2c_data1.scl_pin, NMK_GPIO_ALT_GPIO);
51 nmk_gpio_set_mode(nhk8815_i2c_data1.sda_pin, NMK_GPIO_ALT_GPIO);
52 platform_device_register(&nhk8815_i2c_dev1);
53
54 return 0;
55}
56
57static void __exit nhk8815_i2c_exit(void)
58{
59 platform_device_unregister(&nhk8815_i2c_dev0);
60 platform_device_unregister(&nhk8815_i2c_dev1);
61 return;
62}
63
64module_init(nhk8815_i2c_init);
65module_exit(nhk8815_i2c_exit);
diff --git a/arch/arm/mach-nomadik/include/mach/clkdev.h b/arch/arm/mach-nomadik/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-nomadik/include/mach/debug-macro.S b/arch/arm/mach-nomadik/include/mach/debug-macro.S
new file mode 100644
index 000000000000..e876990e1569
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/debug-macro.S
@@ -0,0 +1,22 @@
1/*
2 * Debugging macro include header
3 *
4 * Copyright (C) 1994-1999 Russell King
5 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11*/
12
13 .macro addruart,rx
14 mrc p15, 0, \rx, c1, c0
15 tst \rx, #1 @ MMU enabled?
16 moveq \rx, #0x10000000 @ physical base address
17 movne \rx, #0xf0000000 @ virtual base
18 add \rx, \rx, #0x00100000
19 add \rx, \rx, #0x000fb000
20 .endm
21
22#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-nomadik/include/mach/entry-macro.S b/arch/arm/mach-nomadik/include/mach/entry-macro.S
new file mode 100644
index 000000000000..49f1aa3bb420
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/entry-macro.S
@@ -0,0 +1,43 @@
1/*
2 * Low-level IRQ helper macros for Nomadik platforms
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <mach/hardware.h>
10#include <mach/irqs.h>
11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp
16 ldr \base, =IO_ADDRESS(NOMADIK_IC_BASE)
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23
24 /* This stanza gets the irq mask from one of two status registers */
25 mov \irqnr, #0
26 ldr \irqstat, [\base, #VIC_REG_IRQSR0] @ get masked status
27 cmp \irqstat, #0
28 bne 1001f
29 add \irqnr, \irqnr, #32
30 ldr \irqstat, [\base, #VIC_REG_IRQSR1] @ get masked status
31
321001: tst \irqstat, #15
33 bne 1002f
34 add \irqnr, \irqnr, #4
35 movs \irqstat, \irqstat, lsr #4
36 bne 1001b
371002: tst \irqstat, #1
38 bne 1003f
39 add \irqnr, \irqnr, #1
40 movs \irqstat, \irqstat, lsr #1
41 bne 1002b
421003: /* EQ will be set if no irqs pending */
43 .endm
diff --git a/arch/arm/mach-nomadik/include/mach/gpio.h b/arch/arm/mach-nomadik/include/mach/gpio.h
new file mode 100644
index 000000000000..61577c9f9a7d
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/gpio.h
@@ -0,0 +1,71 @@
1/*
2 * Structures and registers for GPIO access in the Nomadik SoC
3 *
4 * Copyright (C) 2008 STMicroelectronics
5 * Author: Prafulla WADASKAR <prafulla.wadaskar@st.com>
6 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __ASM_ARCH_GPIO_H
13#define __ASM_ARCH_GPIO_H
14
15#include <asm-generic/gpio.h>
16
17/*
18 * These currently cause a function call to happen, they may be optimized
19 * if needed by adding cpu-specific defines to identify blocks
20 * (see mach-pxa/include/mach/gpio.h as an example using GPLR etc)
21 */
22#define gpio_get_value __gpio_get_value
23#define gpio_set_value __gpio_set_value
24#define gpio_cansleep __gpio_cansleep
25#define gpio_to_irq __gpio_to_irq
26
27/*
28 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
29 * the "gpio" namespace for generic and cross-machine functions
30 */
31
32/* Register in the logic block */
33#define NMK_GPIO_DAT 0x00
34#define NMK_GPIO_DATS 0x04
35#define NMK_GPIO_DATC 0x08
36#define NMK_GPIO_PDIS 0x0c
37#define NMK_GPIO_DIR 0x10
38#define NMK_GPIO_DIRS 0x14
39#define NMK_GPIO_DIRC 0x18
40#define NMK_GPIO_SLPC 0x1c
41#define NMK_GPIO_AFSLA 0x20
42#define NMK_GPIO_AFSLB 0x24
43
44#define NMK_GPIO_RIMSC 0x40
45#define NMK_GPIO_FIMSC 0x44
46#define NMK_GPIO_IS 0x48
47#define NMK_GPIO_IC 0x4c
48#define NMK_GPIO_RWIMSC 0x50
49#define NMK_GPIO_FWIMSC 0x54
50#define NMK_GPIO_WKS 0x58
51
52/* Alternate functions: function C is set in hw by setting both A and B */
53#define NMK_GPIO_ALT_GPIO 0
54#define NMK_GPIO_ALT_A 1
55#define NMK_GPIO_ALT_B 2
56#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
57
58extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
59extern int nmk_gpio_get_mode(int gpio);
60
61/*
62 * Platform data to register a block: only the initial gpio/irq number.
63 */
64struct nmk_gpio_platform_data {
65 char *name;
66 int first_gpio;
67 int first_irq;
68 int parent_irq;
69};
70
71#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-nomadik/include/mach/hardware.h b/arch/arm/mach-nomadik/include/mach/hardware.h
new file mode 100644
index 000000000000..6316dba3bfc8
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/hardware.h
@@ -0,0 +1,90 @@
1/*
2 * This file contains the hardware definitions of the Nomadik.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * YOU should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef __ASM_ARCH_HARDWARE_H
19#define __ASM_ARCH_HARDWARE_H
20
21/* Nomadik registers live from 0x1000.0000 to 0x1023.0000 -- currently */
22#define NOMADIK_IO_VIRTUAL 0xF0000000 /* VA of IO */
23#define NOMADIK_IO_PHYSICAL 0x10000000 /* PA of IO */
24#define NOMADIK_IO_SIZE 0x00300000 /* 3MB for all regs */
25
26/* used in C code, so cast to proper type */
27#define io_p2v(x) ((void __iomem *)(x) \
28 - NOMADIK_IO_PHYSICAL + NOMADIK_IO_VIRTUAL)
29#define io_v2p(x) ((unsigned long)(x) \
30 - NOMADIK_IO_VIRTUAL + NOMADIK_IO_PHYSICAL)
31
32/* used in asm code, so no casts */
33#define IO_ADDRESS(x) ((x) - NOMADIK_IO_PHYSICAL + NOMADIK_IO_VIRTUAL)
34
35/*
36 * Base address defination for Nomadik Onchip Logic Block
37 */
38#define NOMADIK_FSMC_BASE 0x10100000 /* FSMC registers */
39#define NOMADIK_SDRAMC_BASE 0x10110000 /* SDRAM Controller */
40#define NOMADIK_CLCDC_BASE 0x10120000 /* CLCD Controller */
41#define NOMADIK_MDIF_BASE 0x10120000 /* MDIF */
42#define NOMADIK_DMA0_BASE 0x10130000 /* DMA0 Controller */
43#define NOMADIK_IC_BASE 0x10140000 /* Vectored Irq Controller */
44#define NOMADIK_DMA1_BASE 0x10150000 /* DMA1 Controller */
45#define NOMADIK_USB_BASE 0x10170000 /* USB-OTG conf reg base */
46#define NOMADIK_CRYP_BASE 0x10180000 /* Crypto processor */
47#define NOMADIK_SHA1_BASE 0x10190000 /* SHA-1 Processor */
48#define NOMADIK_XTI_BASE 0x101A0000 /* XTI */
49#define NOMADIK_RNG_BASE 0x101B0000 /* Random number generator */
50#define NOMADIK_SRC_BASE 0x101E0000 /* SRC base */
51#define NOMADIK_WDOG_BASE 0x101E1000 /* Watchdog */
52#define NOMADIK_MTU0_BASE 0x101E2000 /* Multiple Timer 0 */
53#define NOMADIK_MTU1_BASE 0x101E3000 /* Multiple Timer 1 */
54#define NOMADIK_GPIO0_BASE 0x101E4000 /* GPIO0 */
55#define NOMADIK_GPIO1_BASE 0x101E5000 /* GPIO1 */
56#define NOMADIK_GPIO2_BASE 0x101E6000 /* GPIO2 */
57#define NOMADIK_GPIO3_BASE 0x101E7000 /* GPIO3 */
58#define NOMADIK_RTC_BASE 0x101E8000 /* Real Time Clock base */
59#define NOMADIK_PMU_BASE 0x101E9000 /* Power Management Unit */
60#define NOMADIK_OWM_BASE 0x101EA000 /* One wire master */
61#define NOMADIK_SCR_BASE 0x101EF000 /* Secure Control registers */
62#define NOMADIK_MSP2_BASE 0x101F0000 /* MSP 2 interface */
63#define NOMADIK_MSP1_BASE 0x101F1000 /* MSP 1 interface */
64#define NOMADIK_UART2_BASE 0x101F2000 /* UART 2 interface */
65#define NOMADIK_SSIRx_BASE 0x101F3000 /* SSI 8-ch rx interface */
66#define NOMADIK_SSITx_BASE 0x101F4000 /* SSI 8-ch tx interface */
67#define NOMADIK_MSHC_BASE 0x101F5000 /* Memory Stick(Pro) Host */
68#define NOMADIK_SDI_BASE 0x101F6000 /* SD-card/MM-Card */
69#define NOMADIK_I2C1_BASE 0x101F7000 /* I2C1 interface */
70#define NOMADIK_I2C0_BASE 0x101F8000 /* I2C0 interface */
71#define NOMADIK_MSP0_BASE 0x101F9000 /* MSP 0 interface */
72#define NOMADIK_FIRDA_BASE 0x101FA000 /* FIrDA interface */
73#define NOMADIK_UART1_BASE 0x101FB000 /* UART 1 interface */
74#define NOMADIK_SSP_BASE 0x101FC000 /* SSP interface */
75#define NOMADIK_UART0_BASE 0x101FD000 /* UART 0 interface */
76#define NOMADIK_SGA_BASE 0x101FE000 /* SGA interface */
77#define NOMADIK_L2CC_BASE 0x10210000 /* L2 Cache controller */
78
79/* Other ranges, not for p2v/v2p */
80#define NOMADIK_BACKUP_RAM 0x80010000
81#define NOMADIK_EBROM 0x80000000 /* Embedded boot ROM */
82#define NOMADIK_HAMACV_DMEM_BASE 0xA0100000 /* HAMACV Data Memory Start */
83#define NOMADIK_HAMACV_DMEM_END 0xA01FFFFF /* HAMACV Data Memory End */
84#define NOMADIK_HAMACA_DMEM 0xA0200000 /* HAMACA Data Memory Space */
85
86#define NOMADIK_FSMC_VA IO_ADDRESS(NOMADIK_FSMC_BASE)
87#define NOMADIK_MTU0_VA IO_ADDRESS(NOMADIK_MTU0_BASE)
88#define NOMADIK_MTU1_VA IO_ADDRESS(NOMADIK_MTU1_BASE)
89
90#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-nomadik/include/mach/io.h b/arch/arm/mach-nomadik/include/mach/io.h
new file mode 100644
index 000000000000..2e1eca1b8243
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/io.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-nomadik/include/mach/io.h (copied from mach-sa1100)
3 *
4 * Copyright (C) 1997-1999 Russell King
5 *
6 * Modifications:
7 * 06-12-1997 RMK Created.
8 * 07-04-1999 RMK Major cleanup
9 */
10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H
12
13#define IO_SPACE_LIMIT 0xffffffff
14
15/*
16 * We don't actually have real ISA nor PCI buses, but there is so many
17 * drivers out there that might just work if we fake them...
18 */
19#define __io(a) __typesafe_io(a)
20#define __mem_pci(a) (a)
21
22#endif
diff --git a/arch/arm/mach-nomadik/include/mach/irqs.h b/arch/arm/mach-nomadik/include/mach/irqs.h
new file mode 100644
index 000000000000..8faabc560398
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/irqs.h
@@ -0,0 +1,82 @@
1/*
2 * mach-nomadik/include/mach/irqs.h
3 *
4 * Copyright (C) ST Microelectronics
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_IRQS_H
21#define __ASM_ARCH_IRQS_H
22
23#include <mach/hardware.h>
24
25#define IRQ_VIC_START 0 /* first VIC interrupt is 0 */
26
27/*
28 * Interrupt numbers generic for all Nomadik Chip cuts
29 */
30#define IRQ_WATCHDOG 0
31#define IRQ_SOFTINT 1
32#define IRQ_CRYPTO 2
33#define IRQ_OWM 3
34#define IRQ_MTU0 4
35#define IRQ_MTU1 5
36#define IRQ_GPIO0 6
37#define IRQ_GPIO1 7
38#define IRQ_GPIO2 8
39#define IRQ_GPIO3 9
40#define IRQ_RTC_RTT 10
41#define IRQ_SSP 11
42#define IRQ_UART0 12
43#define IRQ_DMA1 13
44#define IRQ_CLCD_MDIF 14
45#define IRQ_DMA0 15
46#define IRQ_PWRFAIL 16
47#define IRQ_UART1 17
48#define IRQ_FIRDA 18
49#define IRQ_MSP0 19
50#define IRQ_I2C0 20
51#define IRQ_I2C1 21
52#define IRQ_SDMMC 22
53#define IRQ_USBOTG 23
54#define IRQ_SVA_IT0 24
55#define IRQ_SVA_IT1 25
56#define IRQ_SAA_IT0 26
57#define IRQ_SAA_IT1 27
58#define IRQ_UART2 28
59#define IRQ_MSP2 31
60#define IRQ_L2CC 48
61#define IRQ_HPI 49
62#define IRQ_SKE 50
63#define IRQ_KP 51
64#define IRQ_MEMST 54
65#define IRQ_SGA_IT 58
66#define IRQ_USBM 60
67#define IRQ_MSP1 62
68
69#define NOMADIK_SOC_NR_IRQS 64
70
71/* After chip-specific IRQ numbers we have the GPIO ones */
72#define NOMADIK_NR_GPIO 128 /* last 4 not wired to pins */
73#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + NOMADIK_SOC_NR_IRQS)
74#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - NOMADIK_SOC_NR_IRQS)
75#define NR_IRQS NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO)
76
77/* Following two are used by entry_macro.S, to access our dual-vic */
78#define VIC_REG_IRQSR0 0
79#define VIC_REG_IRQSR1 0x20
80
81#endif /* __ASM_ARCH_IRQS_H */
82
diff --git a/arch/arm/mach-nomadik/include/mach/memory.h b/arch/arm/mach-nomadik/include/mach/memory.h
new file mode 100644
index 000000000000..1e5689d98ecd
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/memory.h
@@ -0,0 +1,28 @@
1/*
2 * mach-nomadik/include/mach/memory.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_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-nomadik/include/mach/mtu.h b/arch/arm/mach-nomadik/include/mach/mtu.h
new file mode 100644
index 000000000000..76da7f085330
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/mtu.h
@@ -0,0 +1,45 @@
1#ifndef __ASM_ARCH_MTU_H
2#define __ASM_ARCH_MTU_H
3
4/*
5 * The MTU device hosts four different counters, with 4 set of
6 * registers. These are register names.
7 */
8
9#define MTU_IMSC 0x00 /* Interrupt mask set/clear */
10#define MTU_RIS 0x04 /* Raw interrupt status */
11#define MTU_MIS 0x08 /* Masked interrupt status */
12#define MTU_ICR 0x0C /* Interrupt clear register */
13
14/* per-timer registers take 0..3 as argument */
15#define MTU_LR(x) (0x10 + 0x10 * (x) + 0x00) /* Load value */
16#define MTU_VAL(x) (0x10 + 0x10 * (x) + 0x04) /* Current value */
17#define MTU_CR(x) (0x10 + 0x10 * (x) + 0x08) /* Control reg */
18#define MTU_BGLR(x) (0x10 + 0x10 * (x) + 0x0c) /* At next overflow */
19
20/* bits for the control register */
21#define MTU_CRn_ENA 0x80
22#define MTU_CRn_PERIODIC 0x40 /* if 0 = free-running */
23#define MTU_CRn_PRESCALE_MASK 0x0c
24#define MTU_CRn_PRESCALE_1 0x00
25#define MTU_CRn_PRESCALE_16 0x04
26#define MTU_CRn_PRESCALE_256 0x08
27#define MTU_CRn_32BITS 0x02
28#define MTU_CRn_ONESHOT 0x01 /* if 0 = wraps reloading from BGLR*/
29
30/* Other registers are usual amba/primecell registers, currently not used */
31#define MTU_ITCR 0xff0
32#define MTU_ITOP 0xff4
33
34#define MTU_PERIPH_ID0 0xfe0
35#define MTU_PERIPH_ID1 0xfe4
36#define MTU_PERIPH_ID2 0xfe8
37#define MTU_PERIPH_ID3 0xfeC
38
39#define MTU_PCELL0 0xff0
40#define MTU_PCELL1 0xff4
41#define MTU_PCELL2 0xff8
42#define MTU_PCELL3 0xffC
43
44#endif /* __ASM_ARCH_MTU_H */
45
diff --git a/arch/arm/mach-nomadik/include/mach/setup.h b/arch/arm/mach-nomadik/include/mach/setup.h
new file mode 100644
index 000000000000..a4e468cf63da
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/setup.h
@@ -0,0 +1,22 @@
1
2/*
3 * These symbols are needed for board-specific files to call their
4 * own cpu-specific files
5 */
6
7#ifndef __ASM_ARCH_SETUP_H
8#define __ASM_ARCH_SETUP_H
9
10#include <asm/mach/time.h>
11#include <linux/init.h>
12
13#ifdef CONFIG_NOMADIK_8815
14
15extern void cpu8815_map_io(void);
16extern void cpu8815_platform_init(void);
17extern void cpu8815_init_irq(void);
18extern struct sys_timer nomadik_timer;
19
20#endif /* NOMADIK_8815 */
21
22#endif /* __ASM_ARCH_SETUP_H */
diff --git a/arch/arm/mach-nomadik/include/mach/system.h b/arch/arm/mach-nomadik/include/mach/system.h
new file mode 100644
index 000000000000..7119f688116e
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/system.h
@@ -0,0 +1,45 @@
1/*
2 * mach-nomadik/include/mach/system.h
3 *
4 * Copyright (C) 2008 STMicroelectronics
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_SYSTEM_H
21#define __ASM_ARCH_SYSTEM_H
22
23#include <linux/io.h>
24#include <mach/hardware.h>
25
26static inline void arch_idle(void)
27{
28 /*
29 * This should do all the clock switching
30 * and wait for interrupt tricks
31 */
32 cpu_do_idle();
33}
34
35static inline void arch_reset(char mode, const char *cmd)
36{
37 void __iomem *src_rstsr = io_p2v(NOMADIK_SRC_BASE + 0x18);
38
39 /* FIXME: use egpio when implemented */
40
41 /* Write anything to Reset status register */
42 writel(1, src_rstsr);
43}
44
45#endif
diff --git a/arch/arm/mach-nomadik/include/mach/timex.h b/arch/arm/mach-nomadik/include/mach/timex.h
new file mode 100644
index 000000000000..318b8896ce96
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/timex.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_ARCH_TIMEX_H
2#define __ASM_ARCH_TIMEX_H
3
4#define CLOCK_TICK_RATE 2400000
5
6#endif
diff --git a/arch/arm/mach-nomadik/include/mach/uncompress.h b/arch/arm/mach-nomadik/include/mach/uncompress.h
new file mode 100644
index 000000000000..071003bc8456
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/uncompress.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2008 STMicroelectronics
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __ASM_ARCH_UNCOMPRESS_H
20#define __ASM_ARCH_UNCOMPRESS_H
21
22#include <asm/setup.h>
23#include <asm/io.h>
24#include <mach/hardware.h>
25
26/* we need the constants in amba/serial.h, but it refers to amba_device */
27struct amba_device;
28#include <linux/amba/serial.h>
29
30#define NOMADIK_UART_DR 0x101FB000
31#define NOMADIK_UART_LCRH 0x101FB02c
32#define NOMADIK_UART_CR 0x101FB030
33#define NOMADIK_UART_FR 0x101FB018
34
35static void putc(const char c)
36{
37 /* Do nothing if the UART is not enabled. */
38 if (!(readb(NOMADIK_UART_CR) & UART01x_CR_UARTEN))
39 return;
40
41 if (c == '\n')
42 putc('\r');
43
44 while (readb(NOMADIK_UART_FR) & UART01x_FR_TXFF)
45 barrier();
46 writeb(c, NOMADIK_UART_DR);
47}
48
49static void flush(void)
50{
51 if (!(readb(NOMADIK_UART_CR) & UART01x_CR_UARTEN))
52 return;
53 while (readb(NOMADIK_UART_FR) & UART01x_FR_BUSY)
54 barrier();
55}
56
57static inline void arch_decomp_setup(void)
58{
59}
60
61#define arch_decomp_wdog() /* nothing to do here */
62
63#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-nomadik/include/mach/vmalloc.h b/arch/arm/mach-nomadik/include/mach/vmalloc.h
new file mode 100644
index 000000000000..be12e31ea528
--- /dev/null
+++ b/arch/arm/mach-nomadik/include/mach/vmalloc.h
@@ -0,0 +1,2 @@
1
2#define VMALLOC_END 0xe8000000
diff --git a/arch/arm/mach-nomadik/timer.c b/arch/arm/mach-nomadik/timer.c
new file mode 100644
index 000000000000..d1738e7061d4
--- /dev/null
+++ b/arch/arm/mach-nomadik/timer.c
@@ -0,0 +1,164 @@
1/*
2 * linux/arch/arm/mach-nomadik/timer.c
3 *
4 * Copyright (C) 2008 STMicroelectronics
5 * Copyright (C) 2009 Alessandro Rubini, somewhat based on at91sam926x
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#include <linux/init.h>
12#include <linux/interrupt.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <linux/clockchips.h>
16#include <linux/jiffies.h>
17#include <asm/mach/time.h>
18#include <mach/mtu.h>
19
20#define TIMER_CTRL 0x80 /* No divisor */
21#define TIMER_PERIODIC 0x40
22#define TIMER_SZ32BIT 0x02
23
24/* Initial value for SRC control register: all timers use MXTAL/8 source */
25#define SRC_CR_INIT_MASK 0x00007fff
26#define SRC_CR_INIT_VAL 0x2aaa8000
27
28static u32 nmdk_count; /* accumulated count */
29static u32 nmdk_cycle; /* write-once */
30static __iomem void *mtu_base;
31
32/*
33 * clocksource: the MTU device is a decrementing counters, so we negate
34 * the value being read.
35 */
36static cycle_t nmdk_read_timer(struct clocksource *cs)
37{
38 u32 count = readl(mtu_base + MTU_VAL(0));
39 return nmdk_count + nmdk_cycle - count;
40
41}
42
43static struct clocksource nmdk_clksrc = {
44 .name = "mtu_0",
45 .rating = 120,
46 .read = nmdk_read_timer,
47 .shift = 20,
48 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
49};
50
51/*
52 * Clockevent device: currently only periodic mode is supported
53 */
54static void nmdk_clkevt_mode(enum clock_event_mode mode,
55 struct clock_event_device *dev)
56{
57 unsigned long flags;
58
59 switch (mode) {
60 case CLOCK_EVT_MODE_PERIODIC:
61 /* enable interrupts -- and count current value? */
62 raw_local_irq_save(flags);
63 writel(readl(mtu_base + MTU_IMSC) | 1, mtu_base + MTU_IMSC);
64 raw_local_irq_restore(flags);
65 break;
66 case CLOCK_EVT_MODE_ONESHOT:
67 BUG(); /* Not supported, yet */
68 /* FALLTHROUGH */
69 case CLOCK_EVT_MODE_SHUTDOWN:
70 case CLOCK_EVT_MODE_UNUSED:
71 /* disable irq */
72 raw_local_irq_save(flags);
73 writel(readl(mtu_base + MTU_IMSC) & ~1, mtu_base + MTU_IMSC);
74 raw_local_irq_restore(flags);
75 break;
76 case CLOCK_EVT_MODE_RESUME:
77 break;
78 }
79}
80
81static struct clock_event_device nmdk_clkevt = {
82 .name = "mtu_0",
83 .features = CLOCK_EVT_FEAT_PERIODIC,
84 .shift = 32,
85 .rating = 100,
86 .set_mode = nmdk_clkevt_mode,
87};
88
89/*
90 * IRQ Handler for the timer 0 of the MTU block. The irq is not shared
91 * as we are the only users of mtu0 by now.
92 */
93static irqreturn_t nmdk_timer_interrupt(int irq, void *dev_id)
94{
95 /* ack: "interrupt clear register" */
96 writel( 1 << 0, mtu_base + MTU_ICR);
97
98 /* we can't count lost ticks, unfortunately */
99 nmdk_count += nmdk_cycle;
100 nmdk_clkevt.event_handler(&nmdk_clkevt);
101
102 return IRQ_HANDLED;
103}
104
105/*
106 * Set up timer interrupt, and return the current time in seconds.
107 */
108static struct irqaction nmdk_timer_irq = {
109 .name = "Nomadik Timer Tick",
110 .flags = IRQF_DISABLED | IRQF_TIMER,
111 .handler = nmdk_timer_interrupt,
112};
113
114static void nmdk_timer_reset(void)
115{
116 u32 cr;
117
118 writel(0, mtu_base + MTU_CR(0)); /* off */
119
120 /* configure load and background-load, and fire it up */
121 writel(nmdk_cycle, mtu_base + MTU_LR(0));
122 writel(nmdk_cycle, mtu_base + MTU_BGLR(0));
123 cr = MTU_CRn_PERIODIC | MTU_CRn_PRESCALE_1 | MTU_CRn_32BITS;
124 writel(cr, mtu_base + MTU_CR(0));
125 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0));
126}
127
128static void __init nmdk_timer_init(void)
129{
130 u32 src_cr;
131 unsigned long rate;
132 int bits;
133
134 rate = CLOCK_TICK_RATE; /* 2.4MHz */
135 nmdk_cycle = (rate + HZ/2) / HZ;
136
137 /* Configure timer sources in "system reset controller" ctrl reg */
138 src_cr = readl(io_p2v(NOMADIK_SRC_BASE));
139 src_cr &= SRC_CR_INIT_MASK;
140 src_cr |= SRC_CR_INIT_VAL;
141 writel(src_cr, io_p2v(NOMADIK_SRC_BASE));
142
143 /* Save global pointer to mtu, used by functions above */
144 mtu_base = io_p2v(NOMADIK_MTU0_BASE);
145
146 /* Init the timer and register clocksource */
147 nmdk_timer_reset();
148
149 nmdk_clksrc.mult = clocksource_hz2mult(rate, nmdk_clksrc.shift);
150 bits = 8*sizeof(nmdk_count);
151 nmdk_clksrc.mask = CLOCKSOURCE_MASK(bits);
152
153 clocksource_register(&nmdk_clksrc);
154
155 /* Register irq and clockevents */
156 setup_irq(IRQ_MTU0, &nmdk_timer_irq);
157 nmdk_clkevt.mult = div_sc(rate, NSEC_PER_SEC, nmdk_clkevt.shift);
158 nmdk_clkevt.cpumask = cpumask_of(0);
159 clockevents_register_device(&nmdk_clkevt);
160}
161
162struct sys_timer nomadik_timer = {
163 .init = nmdk_timer_init,
164};
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 57e477bd89c6..7e1e721f0324 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -39,7 +39,7 @@ static struct platform_device *sdp4430_devices[] __initdata = {
39}; 39};
40 40
41static struct omap_uart_config sdp4430_uart_config __initdata = { 41static struct omap_uart_config sdp4430_uart_config __initdata = {
42 .enabled_uarts = (1 << 0) | (1 << 1) | (1 << 2), 42 .enabled_uarts = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
43}; 43};
44 44
45static struct omap_lcd_config sdp4430_lcd_config __initdata = { 45static struct omap_lcd_config sdp4430_lcd_config __initdata = {
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index dff5528fbfb5..e26af837510b 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -51,6 +51,7 @@
51 51
52#define OVERO_GPIO_BT_XGATE 15 52#define OVERO_GPIO_BT_XGATE 15
53#define OVERO_GPIO_W2W_NRESET 16 53#define OVERO_GPIO_W2W_NRESET 16
54#define OVERO_GPIO_PENDOWN 114
54#define OVERO_GPIO_BT_NRESET 164 55#define OVERO_GPIO_BT_NRESET 164
55#define OVERO_GPIO_USBH_CPEN 168 56#define OVERO_GPIO_USBH_CPEN 168
56#define OVERO_GPIO_USBH_NRESET 183 57#define OVERO_GPIO_USBH_NRESET 183
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index 1d3c93bf86d3..f3c91a1ca391 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -29,9 +29,9 @@
29 * These registers appear once per CM module. 29 * These registers appear once per CM module.
30 */ 30 */
31 31
32#define OMAP3430_CM_REVISION OMAP_CM_REGADDR(OCP_MOD, 0x0000) 32#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
33#define OMAP3430_CM_SYSCONFIG OMAP_CM_REGADDR(OCP_MOD, 0x0010) 33#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
34#define OMAP3430_CM_POLCTRL OMAP_CM_REGADDR(OCP_MOD, 0x009c) 34#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
35 35
36#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070 36#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
37#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) 37#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 99b6e1546311..d7288f1dc64f 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -168,6 +168,42 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
168#define OMAP34XX_MCBSP_PDATA_SZ 0 168#define OMAP34XX_MCBSP_PDATA_SZ 0
169#endif 169#endif
170 170
171static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = {
172 {
173 .phys_base = OMAP44XX_MCBSP1_BASE,
174 .dma_rx_sync = OMAP44XX_DMA_MCBSP1_RX,
175 .dma_tx_sync = OMAP44XX_DMA_MCBSP1_TX,
176 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
177 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
178 .ops = &omap2_mcbsp_ops,
179 },
180 {
181 .phys_base = OMAP44XX_MCBSP2_BASE,
182 .dma_rx_sync = OMAP44XX_DMA_MCBSP2_RX,
183 .dma_tx_sync = OMAP44XX_DMA_MCBSP2_TX,
184 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
185 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
186 .ops = &omap2_mcbsp_ops,
187 },
188 {
189 .phys_base = OMAP44XX_MCBSP3_BASE,
190 .dma_rx_sync = OMAP44XX_DMA_MCBSP3_RX,
191 .dma_tx_sync = OMAP44XX_DMA_MCBSP3_TX,
192 .rx_irq = INT_24XX_MCBSP3_IRQ_RX,
193 .tx_irq = INT_24XX_MCBSP3_IRQ_TX,
194 .ops = &omap2_mcbsp_ops,
195 },
196 {
197 .phys_base = OMAP44XX_MCBSP4_BASE,
198 .dma_rx_sync = OMAP44XX_DMA_MCBSP4_RX,
199 .dma_tx_sync = OMAP44XX_DMA_MCBSP4_TX,
200 .rx_irq = INT_24XX_MCBSP4_IRQ_RX,
201 .tx_irq = INT_24XX_MCBSP4_IRQ_TX,
202 .ops = &omap2_mcbsp_ops,
203 },
204};
205#define OMAP44XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap44xx_mcbsp_pdata)
206
171static int __init omap2_mcbsp_init(void) 207static int __init omap2_mcbsp_init(void)
172{ 208{
173 if (cpu_is_omap2420()) 209 if (cpu_is_omap2420())
@@ -176,6 +212,8 @@ static int __init omap2_mcbsp_init(void)
176 omap_mcbsp_count = OMAP2430_MCBSP_PDATA_SZ; 212 omap_mcbsp_count = OMAP2430_MCBSP_PDATA_SZ;
177 if (cpu_is_omap34xx()) 213 if (cpu_is_omap34xx())
178 omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ; 214 omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ;
215 if (cpu_is_omap44xx())
216 omap_mcbsp_count = OMAP44XX_MCBSP_PDATA_SZ;
179 217
180 mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *), 218 mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *),
181 GFP_KERNEL); 219 GFP_KERNEL);
@@ -191,6 +229,9 @@ static int __init omap2_mcbsp_init(void)
191 if (cpu_is_omap34xx()) 229 if (cpu_is_omap34xx())
192 omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata, 230 omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata,
193 OMAP34XX_MCBSP_PDATA_SZ); 231 OMAP34XX_MCBSP_PDATA_SZ);
232 if (cpu_is_omap44xx())
233 omap_mcbsp_register_board_cfg(omap44xx_mcbsp_pdata,
234 OMAP44XX_MCBSP_PDATA_SZ);
194 235
195 return omap_mcbsp_init(); 236 return omap_mcbsp_init();
196} 237}
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index f7b3baf76678..21201cd4117b 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -11,9 +11,6 @@
11#ifndef __ARCH_ARM_MACH_OMAP2_PM_H 11#ifndef __ARCH_ARM_MACH_OMAP2_PM_H
12#define __ARCH_ARM_MACH_OMAP2_PM_H 12#define __ARCH_ARM_MACH_OMAP2_PM_H
13 13
14extern int omap2_pm_init(void);
15extern int omap3_pm_init(void);
16
17#ifdef CONFIG_PM_DEBUG 14#ifdef CONFIG_PM_DEBUG
18extern void omap2_pm_dump(int mode, int resume, unsigned int us); 15extern void omap2_pm_dump(int mode, int resume, unsigned int us);
19extern int omap2_pm_debug; 16extern int omap2_pm_debug;
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index db1025562fb0..528dbdc26e23 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -470,7 +470,7 @@ static void __init prcm_setup_regs(void)
470 WKUP_MOD, PM_WKEN); 470 WKUP_MOD, PM_WKEN);
471} 471}
472 472
473int __init omap2_pm_init(void) 473static int __init omap2_pm_init(void)
474{ 474{
475 u32 l; 475 u32 l;
476 476
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 841d4c5ed8be..488d595d8e4b 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -39,7 +39,9 @@
39struct power_state { 39struct power_state {
40 struct powerdomain *pwrdm; 40 struct powerdomain *pwrdm;
41 u32 next_state; 41 u32 next_state;
42#ifdef CONFIG_SUSPEND
42 u32 saved_state; 43 u32 saved_state;
44#endif
43 struct list_head node; 45 struct list_head node;
44}; 46};
45 47
@@ -293,6 +295,9 @@ out:
293 local_irq_enable(); 295 local_irq_enable();
294} 296}
295 297
298#ifdef CONFIG_SUSPEND
299static suspend_state_t suspend_state;
300
296static int omap3_pm_prepare(void) 301static int omap3_pm_prepare(void)
297{ 302{
298 disable_hlt(); 303 disable_hlt();
@@ -321,7 +326,6 @@ static int omap3_pm_suspend(void)
321restore: 326restore:
322 /* Restore next_pwrsts */ 327 /* Restore next_pwrsts */
323 list_for_each_entry(pwrst, &pwrst_list, node) { 328 list_for_each_entry(pwrst, &pwrst_list, node) {
324 set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state);
325 state = pwrdm_read_prev_pwrst(pwrst->pwrdm); 329 state = pwrdm_read_prev_pwrst(pwrst->pwrdm);
326 if (state > pwrst->next_state) { 330 if (state > pwrst->next_state) {
327 printk(KERN_INFO "Powerdomain (%s) didn't enter " 331 printk(KERN_INFO "Powerdomain (%s) didn't enter "
@@ -329,6 +333,7 @@ restore:
329 pwrst->pwrdm->name, pwrst->next_state); 333 pwrst->pwrdm->name, pwrst->next_state);
330 ret = -1; 334 ret = -1;
331 } 335 }
336 set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state);
332 } 337 }
333 if (ret) 338 if (ret)
334 printk(KERN_ERR "Could not enter target state in pm_suspend\n"); 339 printk(KERN_ERR "Could not enter target state in pm_suspend\n");
@@ -339,11 +344,11 @@ restore:
339 return ret; 344 return ret;
340} 345}
341 346
342static int omap3_pm_enter(suspend_state_t state) 347static int omap3_pm_enter(suspend_state_t unused)
343{ 348{
344 int ret = 0; 349 int ret = 0;
345 350
346 switch (state) { 351 switch (suspend_state) {
347 case PM_SUSPEND_STANDBY: 352 case PM_SUSPEND_STANDBY:
348 case PM_SUSPEND_MEM: 353 case PM_SUSPEND_MEM:
349 ret = omap3_pm_suspend(); 354 ret = omap3_pm_suspend();
@@ -360,12 +365,30 @@ static void omap3_pm_finish(void)
360 enable_hlt(); 365 enable_hlt();
361} 366}
362 367
368/* Hooks to enable / disable UART interrupts during suspend */
369static int omap3_pm_begin(suspend_state_t state)
370{
371 suspend_state = state;
372 omap_uart_enable_irqs(0);
373 return 0;
374}
375
376static void omap3_pm_end(void)
377{
378 suspend_state = PM_SUSPEND_ON;
379 omap_uart_enable_irqs(1);
380 return;
381}
382
363static struct platform_suspend_ops omap_pm_ops = { 383static struct platform_suspend_ops omap_pm_ops = {
384 .begin = omap3_pm_begin,
385 .end = omap3_pm_end,
364 .prepare = omap3_pm_prepare, 386 .prepare = omap3_pm_prepare,
365 .enter = omap3_pm_enter, 387 .enter = omap3_pm_enter,
366 .finish = omap3_pm_finish, 388 .finish = omap3_pm_finish,
367 .valid = suspend_valid_only_mem, 389 .valid = suspend_valid_only_mem,
368}; 390};
391#endif /* CONFIG_SUSPEND */
369 392
370 393
371/** 394/**
@@ -613,6 +636,24 @@ static void __init prcm_setup_regs(void)
613 /* Clear any pending PRCM interrupts */ 636 /* Clear any pending PRCM interrupts */
614 prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); 637 prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
615 638
639 /* Don't attach IVA interrupts */
640 prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL);
641 prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1);
642 prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3);
643 prm_write_mod_reg(0, OMAP3430_PER_MOD, OMAP3430_PM_IVAGRPSEL);
644
645 /* Clear any pending 'reset' flags */
646 prm_write_mod_reg(0xffffffff, MPU_MOD, RM_RSTST);
647 prm_write_mod_reg(0xffffffff, CORE_MOD, RM_RSTST);
648 prm_write_mod_reg(0xffffffff, OMAP3430_PER_MOD, RM_RSTST);
649 prm_write_mod_reg(0xffffffff, OMAP3430_EMU_MOD, RM_RSTST);
650 prm_write_mod_reg(0xffffffff, OMAP3430_NEON_MOD, RM_RSTST);
651 prm_write_mod_reg(0xffffffff, OMAP3430_DSS_MOD, RM_RSTST);
652 prm_write_mod_reg(0xffffffff, OMAP3430ES2_USBHOST_MOD, RM_RSTST);
653
654 /* Clear any pending PRCM interrupts */
655 prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
656
616 omap3_iva_idle(); 657 omap3_iva_idle();
617 omap3_d2d_idle(); 658 omap3_d2d_idle();
618} 659}
@@ -652,7 +693,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm)
652 return 0; 693 return 0;
653} 694}
654 695
655int __init omap3_pm_init(void) 696static int __init omap3_pm_init(void)
656{ 697{
657 struct power_state *pwrst, *tmp; 698 struct power_state *pwrst, *tmp;
658 int ret; 699 int ret;
@@ -692,7 +733,9 @@ int __init omap3_pm_init(void)
692 _omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend, 733 _omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
693 omap34xx_cpu_suspend_sz); 734 omap34xx_cpu_suspend_sz);
694 735
736#ifdef CONFIG_SUSPEND
695 suspend_set_ops(&omap_pm_ops); 737 suspend_set_ops(&omap_pm_ops);
738#endif /* CONFIG_SUSPEND */
696 739
697 pm_idle = omap3_pm_idle; 740 pm_idle = omap3_pm_idle;
698 741
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index b094c15bfe47..ce22344b94e7 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -54,6 +54,7 @@ struct omap_uart_state {
54 54
55 struct plat_serial8250_port *p; 55 struct plat_serial8250_port *p;
56 struct list_head node; 56 struct list_head node;
57 struct platform_device pdev;
57 58
58#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) 59#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
59 int context_valid; 60 int context_valid;
@@ -68,10 +69,9 @@ struct omap_uart_state {
68#endif 69#endif
69}; 70};
70 71
71static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS];
72static LIST_HEAD(uart_list); 72static LIST_HEAD(uart_list);
73 73
74static struct plat_serial8250_port serial_platform_data[] = { 74static struct plat_serial8250_port serial_platform_data0[] = {
75 { 75 {
76 .membase = IO_ADDRESS(OMAP_UART1_BASE), 76 .membase = IO_ADDRESS(OMAP_UART1_BASE),
77 .mapbase = OMAP_UART1_BASE, 77 .mapbase = OMAP_UART1_BASE,
@@ -81,6 +81,12 @@ static struct plat_serial8250_port serial_platform_data[] = {
81 .regshift = 2, 81 .regshift = 2,
82 .uartclk = OMAP24XX_BASE_BAUD * 16, 82 .uartclk = OMAP24XX_BASE_BAUD * 16,
83 }, { 83 }, {
84 .flags = 0
85 }
86};
87
88static struct plat_serial8250_port serial_platform_data1[] = {
89 {
84 .membase = IO_ADDRESS(OMAP_UART2_BASE), 90 .membase = IO_ADDRESS(OMAP_UART2_BASE),
85 .mapbase = OMAP_UART2_BASE, 91 .mapbase = OMAP_UART2_BASE,
86 .irq = 73, 92 .irq = 73,
@@ -89,6 +95,12 @@ static struct plat_serial8250_port serial_platform_data[] = {
89 .regshift = 2, 95 .regshift = 2,
90 .uartclk = OMAP24XX_BASE_BAUD * 16, 96 .uartclk = OMAP24XX_BASE_BAUD * 16,
91 }, { 97 }, {
98 .flags = 0
99 }
100};
101
102static struct plat_serial8250_port serial_platform_data2[] = {
103 {
92 .membase = IO_ADDRESS(OMAP_UART3_BASE), 104 .membase = IO_ADDRESS(OMAP_UART3_BASE),
93 .mapbase = OMAP_UART3_BASE, 105 .mapbase = OMAP_UART3_BASE,
94 .irq = 74, 106 .irq = 74,
@@ -97,6 +109,16 @@ static struct plat_serial8250_port serial_platform_data[] = {
97 .regshift = 2, 109 .regshift = 2,
98 .uartclk = OMAP24XX_BASE_BAUD * 16, 110 .uartclk = OMAP24XX_BASE_BAUD * 16,
99 }, { 111 }, {
112#ifdef CONFIG_ARCH_OMAP4
113 .membase = IO_ADDRESS(OMAP_UART4_BASE),
114 .mapbase = OMAP_UART4_BASE,
115 .irq = 70,
116 .flags = UPF_BOOT_AUTOCONF,
117 .iotype = UPIO_MEM,
118 .regshift = 2,
119 .uartclk = OMAP24XX_BASE_BAUD * 16,
120 }, {
121#endif
100 .flags = 0 122 .flags = 0
101 } 123 }
102}; 124};
@@ -217,6 +239,40 @@ static inline void omap_uart_disable_clocks(struct omap_uart_state *uart)
217 clk_disable(uart->fck); 239 clk_disable(uart->fck);
218} 240}
219 241
242static void omap_uart_enable_wakeup(struct omap_uart_state *uart)
243{
244 /* Set wake-enable bit */
245 if (uart->wk_en && uart->wk_mask) {
246 u32 v = __raw_readl(uart->wk_en);
247 v |= uart->wk_mask;
248 __raw_writel(v, uart->wk_en);
249 }
250
251 /* Ensure IOPAD wake-enables are set */
252 if (cpu_is_omap34xx() && uart->padconf) {
253 u16 v = omap_ctrl_readw(uart->padconf);
254 v |= OMAP3_PADCONF_WAKEUPENABLE0;
255 omap_ctrl_writew(v, uart->padconf);
256 }
257}
258
259static void omap_uart_disable_wakeup(struct omap_uart_state *uart)
260{
261 /* Clear wake-enable bit */
262 if (uart->wk_en && uart->wk_mask) {
263 u32 v = __raw_readl(uart->wk_en);
264 v &= ~uart->wk_mask;
265 __raw_writel(v, uart->wk_en);
266 }
267
268 /* Ensure IOPAD wake-enables are cleared */
269 if (cpu_is_omap34xx() && uart->padconf) {
270 u16 v = omap_ctrl_readw(uart->padconf);
271 v &= ~OMAP3_PADCONF_WAKEUPENABLE0;
272 omap_ctrl_writew(v, uart->padconf);
273 }
274}
275
220static void omap_uart_smart_idle_enable(struct omap_uart_state *uart, 276static void omap_uart_smart_idle_enable(struct omap_uart_state *uart,
221 int enable) 277 int enable)
222{ 278{
@@ -246,6 +302,11 @@ static void omap_uart_block_sleep(struct omap_uart_state *uart)
246 302
247static void omap_uart_allow_sleep(struct omap_uart_state *uart) 303static void omap_uart_allow_sleep(struct omap_uart_state *uart)
248{ 304{
305 if (device_may_wakeup(&uart->pdev.dev))
306 omap_uart_enable_wakeup(uart);
307 else
308 omap_uart_disable_wakeup(uart);
309
249 if (!uart->clocked) 310 if (!uart->clocked)
250 return; 311 return;
251 312
@@ -292,7 +353,6 @@ void omap_uart_resume_idle(int num)
292 /* Check for normal UART wakeup */ 353 /* Check for normal UART wakeup */
293 if (__raw_readl(uart->wk_st) & uart->wk_mask) 354 if (__raw_readl(uart->wk_st) & uart->wk_mask)
294 omap_uart_block_sleep(uart); 355 omap_uart_block_sleep(uart);
295
296 return; 356 return;
297 } 357 }
298 } 358 }
@@ -346,16 +406,13 @@ static irqreturn_t omap_uart_interrupt(int irq, void *dev_id)
346 return IRQ_NONE; 406 return IRQ_NONE;
347} 407}
348 408
349static u32 sleep_timeout = DEFAULT_TIMEOUT;
350
351static void omap_uart_idle_init(struct omap_uart_state *uart) 409static void omap_uart_idle_init(struct omap_uart_state *uart)
352{ 410{
353 u32 v;
354 struct plat_serial8250_port *p = uart->p; 411 struct plat_serial8250_port *p = uart->p;
355 int ret; 412 int ret;
356 413
357 uart->can_sleep = 0; 414 uart->can_sleep = 0;
358 uart->timeout = sleep_timeout; 415 uart->timeout = DEFAULT_TIMEOUT;
359 setup_timer(&uart->timer, omap_uart_idle_timer, 416 setup_timer(&uart->timer, omap_uart_idle_timer,
360 (unsigned long) uart); 417 (unsigned long) uart);
361 mod_timer(&uart->timer, jiffies + uart->timeout); 418 mod_timer(&uart->timer, jiffies + uart->timeout);
@@ -413,76 +470,101 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
413 uart->padconf = 0; 470 uart->padconf = 0;
414 } 471 }
415 472
416 /* Set wake-enable bit */
417 if (uart->wk_en && uart->wk_mask) {
418 v = __raw_readl(uart->wk_en);
419 v |= uart->wk_mask;
420 __raw_writel(v, uart->wk_en);
421 }
422
423 /* Ensure IOPAD wake-enables are set */
424 if (cpu_is_omap34xx() && uart->padconf) {
425 u16 v;
426
427 v = omap_ctrl_readw(uart->padconf);
428 v |= OMAP3_PADCONF_WAKEUPENABLE0;
429 omap_ctrl_writew(v, uart->padconf);
430 }
431
432 p->flags |= UPF_SHARE_IRQ; 473 p->flags |= UPF_SHARE_IRQ;
433 ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED, 474 ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED,
434 "serial idle", (void *)uart); 475 "serial idle", (void *)uart);
435 WARN_ON(ret); 476 WARN_ON(ret);
436} 477}
437 478
438static ssize_t sleep_timeout_show(struct kobject *kobj, 479void omap_uart_enable_irqs(int enable)
439 struct kobj_attribute *attr, 480{
481 int ret;
482 struct omap_uart_state *uart;
483
484 list_for_each_entry(uart, &uart_list, node) {
485 if (enable)
486 ret = request_irq(uart->p->irq, omap_uart_interrupt,
487 IRQF_SHARED, "serial idle", (void *)uart);
488 else
489 free_irq(uart->p->irq, (void *)uart);
490 }
491}
492
493static ssize_t sleep_timeout_show(struct device *dev,
494 struct device_attribute *attr,
440 char *buf) 495 char *buf)
441{ 496{
442 return sprintf(buf, "%u\n", sleep_timeout / HZ); 497 struct platform_device *pdev = container_of(dev,
498 struct platform_device, dev);
499 struct omap_uart_state *uart = container_of(pdev,
500 struct omap_uart_state, pdev);
501
502 return sprintf(buf, "%u\n", uart->timeout / HZ);
443} 503}
444 504
445static ssize_t sleep_timeout_store(struct kobject *kobj, 505static ssize_t sleep_timeout_store(struct device *dev,
446 struct kobj_attribute *attr, 506 struct device_attribute *attr,
447 const char *buf, size_t n) 507 const char *buf, size_t n)
448{ 508{
449 struct omap_uart_state *uart; 509 struct platform_device *pdev = container_of(dev,
510 struct platform_device, dev);
511 struct omap_uart_state *uart = container_of(pdev,
512 struct omap_uart_state, pdev);
450 unsigned int value; 513 unsigned int value;
451 514
452 if (sscanf(buf, "%u", &value) != 1) { 515 if (sscanf(buf, "%u", &value) != 1) {
453 printk(KERN_ERR "sleep_timeout_store: Invalid value\n"); 516 printk(KERN_ERR "sleep_timeout_store: Invalid value\n");
454 return -EINVAL; 517 return -EINVAL;
455 } 518 }
456 sleep_timeout = value * HZ; 519
457 list_for_each_entry(uart, &uart_list, node) { 520 uart->timeout = value * HZ;
458 uart->timeout = sleep_timeout; 521 if (uart->timeout)
459 if (uart->timeout) 522 mod_timer(&uart->timer, jiffies + uart->timeout);
460 mod_timer(&uart->timer, jiffies + uart->timeout); 523 else
461 else 524 /* A zero value means disable timeout feature */
462 /* A zero value means disable timeout feature */ 525 omap_uart_block_sleep(uart);
463 omap_uart_block_sleep(uart); 526
464 }
465 return n; 527 return n;
466} 528}
467 529
468static struct kobj_attribute sleep_timeout_attr = 530DEVICE_ATTR(sleep_timeout, 0644, sleep_timeout_show, sleep_timeout_store);
469 __ATTR(sleep_timeout, 0644, sleep_timeout_show, sleep_timeout_store); 531#define DEV_CREATE_FILE(dev, attr) WARN_ON(device_create_file(dev, attr))
470
471#else 532#else
472static inline void omap_uart_idle_init(struct omap_uart_state *uart) {} 533static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}
534#define DEV_CREATE_FILE(dev, attr)
473#endif /* CONFIG_PM */ 535#endif /* CONFIG_PM */
474 536
475static struct platform_device serial_device = { 537static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = {
476 .name = "serial8250", 538 {
477 .id = PLAT8250_DEV_PLATFORM, 539 .pdev = {
478 .dev = { 540 .name = "serial8250",
479 .platform_data = serial_platform_data, 541 .id = PLAT8250_DEV_PLATFORM,
542 .dev = {
543 .platform_data = serial_platform_data0,
544 },
545 },
546 }, {
547 .pdev = {
548 .name = "serial8250",
549 .id = PLAT8250_DEV_PLATFORM1,
550 .dev = {
551 .platform_data = serial_platform_data1,
552 },
553 },
554 }, {
555 .pdev = {
556 .name = "serial8250",
557 .id = PLAT8250_DEV_PLATFORM2,
558 .dev = {
559 .platform_data = serial_platform_data2,
560 },
561 },
480 }, 562 },
481}; 563};
482 564
483void __init omap_serial_init(void) 565void __init omap_serial_init(void)
484{ 566{
485 int i, err; 567 int i;
486 const struct omap_uart_config *info; 568 const struct omap_uart_config *info;
487 char name[16]; 569 char name[16];
488 570
@@ -496,14 +578,12 @@ void __init omap_serial_init(void)
496 578
497 if (info == NULL) 579 if (info == NULL)
498 return; 580 return;
499 if (cpu_is_omap44xx()) {
500 for (i = 0; i < OMAP_MAX_NR_PORTS; i++)
501 serial_platform_data[i].irq += 32;
502 }
503 581
504 for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { 582 for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
505 struct plat_serial8250_port *p = serial_platform_data + i;
506 struct omap_uart_state *uart = &omap_uart[i]; 583 struct omap_uart_state *uart = &omap_uart[i];
584 struct platform_device *pdev = &uart->pdev;
585 struct device *dev = &pdev->dev;
586 struct plat_serial8250_port *p = dev->platform_data;
507 587
508 if (!(info->enabled_uarts & (1 << i))) { 588 if (!(info->enabled_uarts & (1 << i))) {
509 p->membase = NULL; 589 p->membase = NULL;
@@ -531,20 +611,21 @@ void __init omap_serial_init(void)
531 uart->num = i; 611 uart->num = i;
532 p->private_data = uart; 612 p->private_data = uart;
533 uart->p = p; 613 uart->p = p;
534 list_add(&uart->node, &uart_list); 614 list_add_tail(&uart->node, &uart_list);
615
616 if (cpu_is_omap44xx())
617 p->irq += 32;
535 618
536 omap_uart_enable_clocks(uart); 619 omap_uart_enable_clocks(uart);
537 omap_uart_reset(uart); 620 omap_uart_reset(uart);
538 omap_uart_idle_init(uart); 621 omap_uart_idle_init(uart);
539 }
540
541 err = platform_device_register(&serial_device);
542
543#ifdef CONFIG_PM
544 if (!err)
545 err = sysfs_create_file(&serial_device.dev.kobj,
546 &sleep_timeout_attr.attr);
547#endif
548 622
623 if (WARN_ON(platform_device_register(pdev)))
624 continue;
625 if ((cpu_is_omap34xx() && uart->padconf) ||
626 (uart->wk_en && uart->wk_mask)) {
627 device_init_wakeup(dev, true);
628 DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout);
629 }
630 }
549} 631}
550
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 2c7035d8dcbf..c3d513cad5ac 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -89,6 +89,27 @@ config MACH_EDMINI_V2
89 Say 'Y' here if you want your kernel to support the 89 Say 'Y' here if you want your kernel to support the
90 LaCie Ethernet Disk mini V2. 90 LaCie Ethernet Disk mini V2.
91 91
92config MACH_D2NET
93 bool "LaCie d2 Network"
94 select I2C_BOARDINFO
95 help
96 Say 'Y' here if you want your kernel to support the
97 LaCie d2 Network NAS.
98
99config MACH_BIGDISK
100 bool "LaCie Big Disk Network"
101 select I2C_BOARDINFO
102 help
103 Say 'Y' here if you want your kernel to support the
104 LaCie Big Disk Network NAS.
105
106config MACH_NET2BIG
107 bool "LaCie 2Big Network"
108 select I2C_BOARDINFO
109 help
110 Say 'Y' here if you want your kernel to support the
111 LaCie 2Big Network NAS.
112
92config MACH_MSS2 113config MACH_MSS2
93 bool "Maxtor Shared Storage II" 114 bool "Maxtor Shared Storage II"
94 help 115 help
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index edc38e2c856f..89772fcd65c7 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -12,6 +12,9 @@ obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o
12obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o 12obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o
13obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o 13obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
14obj-$(CONFIG_MACH_EDMINI_V2) += edmini_v2-setup.o 14obj-$(CONFIG_MACH_EDMINI_V2) += edmini_v2-setup.o
15obj-$(CONFIG_MACH_D2NET) += d2net-setup.o
16obj-$(CONFIG_MACH_BIGDISK) += d2net-setup.o
17obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o
15obj-$(CONFIG_MACH_MSS2) += mss2-setup.o 18obj-$(CONFIG_MACH_MSS2) += mss2-setup.o
16obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o 19obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o
17obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o 20obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index d78731edebb6..1a5d6a0e2602 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -84,7 +84,8 @@ static int __init orion5x_cpu_win_can_remap(int win)
84 orion5x_pcie_id(&dev, &rev); 84 orion5x_pcie_id(&dev, &rev);
85 if ((dev == MV88F5281_DEV_ID && win < 4) 85 if ((dev == MV88F5281_DEV_ID && win < 4)
86 || (dev == MV88F5182_DEV_ID && win < 2) 86 || (dev == MV88F5182_DEV_ID && win < 2)
87 || (dev == MV88F5181_DEV_ID && win < 2)) 87 || (dev == MV88F5181_DEV_ID && win < 2)
88 || (dev == MV88F6183_DEV_ID && win < 4))
88 return 1; 89 return 1;
89 90
90 return 0; 91 return 0;
diff --git a/arch/arm/mach-orion5x/d2net-setup.c b/arch/arm/mach-orion5x/d2net-setup.c
new file mode 100644
index 000000000000..9d4bf763f25b
--- /dev/null
+++ b/arch/arm/mach-orion5x/d2net-setup.c
@@ -0,0 +1,365 @@
1/*
2 * arch/arm/mach-orion5x/d2net-setup.c
3 *
4 * LaCie d2Network and Big Disk Network NAS setup
5 *
6 * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/pci.h>
17#include <linux/irq.h>
18#include <linux/mtd/physmap.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/leds.h>
21#include <linux/gpio_keys.h>
22#include <linux/input.h>
23#include <linux/i2c.h>
24#include <linux/ata_platform.h>
25#include <linux/gpio.h>
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/pci.h>
29#include <mach/orion5x.h>
30#include "common.h"
31#include "mpp.h"
32
33/*****************************************************************************
34 * LaCie d2 Network Info
35 ****************************************************************************/
36
37/*
38 * 512KB NOR flash Device bus boot chip select
39 */
40
41#define D2NET_NOR_BOOT_BASE 0xfff80000
42#define D2NET_NOR_BOOT_SIZE SZ_512K
43
44/*****************************************************************************
45 * 512KB NOR Flash on Boot Device
46 ****************************************************************************/
47
48/*
49 * TODO: Check write support on flash MX29LV400CBTC-70G
50 */
51
52static struct mtd_partition d2net_partitions[] = {
53 {
54 .name = "Full512kb",
55 .size = MTDPART_SIZ_FULL,
56 .offset = 0,
57 .mask_flags = MTD_WRITEABLE,
58 },
59};
60
61static struct physmap_flash_data d2net_nor_flash_data = {
62 .width = 1,
63 .parts = d2net_partitions,
64 .nr_parts = ARRAY_SIZE(d2net_partitions),
65};
66
67static struct resource d2net_nor_flash_resource = {
68 .flags = IORESOURCE_MEM,
69 .start = D2NET_NOR_BOOT_BASE,
70 .end = D2NET_NOR_BOOT_BASE
71 + D2NET_NOR_BOOT_SIZE - 1,
72};
73
74static struct platform_device d2net_nor_flash = {
75 .name = "physmap-flash",
76 .id = 0,
77 .dev = {
78 .platform_data = &d2net_nor_flash_data,
79 },
80 .num_resources = 1,
81 .resource = &d2net_nor_flash_resource,
82};
83
84/*****************************************************************************
85 * Ethernet
86 ****************************************************************************/
87
88static struct mv643xx_eth_platform_data d2net_eth_data = {
89 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
90};
91
92/*****************************************************************************
93 * I2C devices
94 ****************************************************************************/
95
96/*
97 * i2c addr | chip | description
98 * 0x32 | Ricoh 5C372b | RTC
99 * 0x3e | GMT G762 | PWM fan controller
100 * 0x50 | HT24LC08 | eeprom (1kB)
101 *
102 * TODO: Add G762 support to the g760a driver.
103 */
104static struct i2c_board_info __initdata d2net_i2c_devices[] = {
105 {
106 I2C_BOARD_INFO("rs5c372b", 0x32),
107 }, {
108 I2C_BOARD_INFO("24c08", 0x50),
109 },
110};
111
112/*****************************************************************************
113 * SATA
114 ****************************************************************************/
115
116static struct mv_sata_platform_data d2net_sata_data = {
117 .n_ports = 2,
118};
119
120#define D2NET_GPIO_SATA0_POWER 3
121#define D2NET_GPIO_SATA1_POWER 12
122
123static void __init d2net_sata_power_init(void)
124{
125 int err;
126
127 err = gpio_request(D2NET_GPIO_SATA0_POWER, "SATA0 power");
128 if (err == 0) {
129 err = gpio_direction_output(D2NET_GPIO_SATA0_POWER, 1);
130 if (err)
131 gpio_free(D2NET_GPIO_SATA0_POWER);
132 }
133 if (err)
134 pr_err("d2net: failed to configure SATA0 power GPIO\n");
135
136 err = gpio_request(D2NET_GPIO_SATA1_POWER, "SATA1 power");
137 if (err == 0) {
138 err = gpio_direction_output(D2NET_GPIO_SATA1_POWER, 1);
139 if (err)
140 gpio_free(D2NET_GPIO_SATA1_POWER);
141 }
142 if (err)
143 pr_err("d2net: failed to configure SATA1 power GPIO\n");
144}
145
146/*****************************************************************************
147 * GPIO LED's
148 ****************************************************************************/
149
150/*
151 * The blue front LED is wired to the CPLD and can blink in relation with the
152 * SATA activity. This feature is disabled to make this LED compatible with
153 * the leds-gpio driver: MPP14 and MPP15 are configured to act like output
154 * GPIO's and have to stay in an active state. This is needed to set the blue
155 * LED in a "fix on" state regardless of the SATA activity.
156 *
157 * The following array detail the different LED registers and the combination
158 * of their possible values:
159 *
160 * led_off | blink_ctrl | SATA active | LED state
161 * | | |
162 * 1 | x | x | off
163 * 0 | 0 | 0 | off
164 * 0 | 1 | 0 | blink (rate 300ms)
165 * 0 | x | 1 | on
166 *
167 * Notes: The blue and the red front LED's can't be on at the same time.
168 * Red LED have priority.
169 */
170
171#define D2NET_GPIO_RED_LED 6
172#define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16
173#define D2NET_GPIO_BLUE_LED_OFF 23
174#define D2NET_GPIO_SATA0_ACT 14
175#define D2NET_GPIO_SATA1_ACT 15
176
177static struct gpio_led d2net_leds[] = {
178 {
179 .name = "d2net:blue:power",
180 .gpio = D2NET_GPIO_BLUE_LED_OFF,
181 .active_low = 1,
182 },
183 {
184 .name = "d2net:red:fail",
185 .gpio = D2NET_GPIO_RED_LED,
186 },
187};
188
189static struct gpio_led_platform_data d2net_led_data = {
190 .num_leds = ARRAY_SIZE(d2net_leds),
191 .leds = d2net_leds,
192};
193
194static struct platform_device d2net_gpio_leds = {
195 .name = "leds-gpio",
196 .id = -1,
197 .dev = {
198 .platform_data = &d2net_led_data,
199 },
200};
201
202static void __init d2net_gpio_leds_init(void)
203{
204 /* Configure GPIO over MPP max number. */
205 orion_gpio_set_valid(D2NET_GPIO_BLUE_LED_OFF, 1);
206
207 if (gpio_request(D2NET_GPIO_SATA0_ACT, "LED SATA0 activity") != 0)
208 return;
209 if (gpio_direction_output(D2NET_GPIO_SATA0_ACT, 1) != 0)
210 goto err_free_1;
211 if (gpio_request(D2NET_GPIO_SATA1_ACT, "LED SATA1 activity") != 0)
212 goto err_free_1;
213 if (gpio_direction_output(D2NET_GPIO_SATA1_ACT, 1) != 0)
214 goto err_free_2;
215 platform_device_register(&d2net_gpio_leds);
216 return;
217
218err_free_2:
219 gpio_free(D2NET_GPIO_SATA1_ACT);
220err_free_1:
221 gpio_free(D2NET_GPIO_SATA0_ACT);
222 return;
223}
224
225/****************************************************************************
226 * GPIO keys
227 ****************************************************************************/
228
229#define D2NET_GPIO_PUSH_BUTTON 18
230#define D2NET_GPIO_POWER_SWITCH_ON 8
231#define D2NET_GPIO_POWER_SWITCH_OFF 9
232
233#define D2NET_SWITCH_POWER_ON 0x1
234#define D2NET_SWITCH_POWER_OFF 0x2
235
236static struct gpio_keys_button d2net_buttons[] = {
237 {
238 .type = EV_SW,
239 .code = D2NET_SWITCH_POWER_OFF,
240 .gpio = D2NET_GPIO_POWER_SWITCH_OFF,
241 .desc = "Power rocker switch (auto|off)",
242 .active_low = 0,
243 },
244 {
245 .type = EV_SW,
246 .code = D2NET_SWITCH_POWER_ON,
247 .gpio = D2NET_GPIO_POWER_SWITCH_ON,
248 .desc = "Power rocker switch (on|auto)",
249 .active_low = 0,
250 },
251 {
252 .type = EV_KEY,
253 .code = KEY_POWER,
254 .gpio = D2NET_GPIO_PUSH_BUTTON,
255 .desc = "Front Push Button",
256 .active_low = 0,
257 },
258};
259
260static struct gpio_keys_platform_data d2net_button_data = {
261 .buttons = d2net_buttons,
262 .nbuttons = ARRAY_SIZE(d2net_buttons),
263};
264
265static struct platform_device d2net_gpio_buttons = {
266 .name = "gpio-keys",
267 .id = -1,
268 .dev = {
269 .platform_data = &d2net_button_data,
270 },
271};
272
273/*****************************************************************************
274 * General Setup
275 ****************************************************************************/
276
277static struct orion5x_mpp_mode d2net_mpp_modes[] __initdata = {
278 { 0, MPP_GPIO }, /* Board ID (bit 0) */
279 { 1, MPP_GPIO }, /* Board ID (bit 1) */
280 { 2, MPP_GPIO }, /* Board ID (bit 2) */
281 { 3, MPP_GPIO }, /* SATA 0 power */
282 { 4, MPP_UNUSED },
283 { 5, MPP_GPIO }, /* Fan fail detection */
284 { 6, MPP_GPIO }, /* Red front LED */
285 { 7, MPP_UNUSED },
286 { 8, MPP_GPIO }, /* Rear power switch (on|auto) */
287 { 9, MPP_GPIO }, /* Rear power switch (auto|off) */
288 { 10, MPP_UNUSED },
289 { 11, MPP_UNUSED },
290 { 12, MPP_GPIO }, /* SATA 1 power */
291 { 13, MPP_UNUSED },
292 { 14, MPP_GPIO }, /* SATA 0 active */
293 { 15, MPP_GPIO }, /* SATA 1 active */
294 { 16, MPP_GPIO }, /* Blue front LED blink control */
295 { 17, MPP_UNUSED },
296 { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */
297 { 19, MPP_UNUSED },
298 { -1 }
299 /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */
300 /* 23: Blue front LED off */
301 /* 24: Inhibit board power off (0 = Disabled, 1 = Enabled) */
302};
303
304static void __init d2net_init(void)
305{
306 /*
307 * Setup basic Orion functions. Need to be called early.
308 */
309 orion5x_init();
310
311 orion5x_mpp_conf(d2net_mpp_modes);
312
313 /*
314 * Configure peripherals.
315 */
316 orion5x_ehci0_init();
317 orion5x_eth_init(&d2net_eth_data);
318 orion5x_i2c_init();
319 orion5x_uart0_init();
320
321 d2net_sata_power_init();
322 orion5x_sata_init(&d2net_sata_data);
323
324 orion5x_setup_dev_boot_win(D2NET_NOR_BOOT_BASE,
325 D2NET_NOR_BOOT_SIZE);
326 platform_device_register(&d2net_nor_flash);
327
328 platform_device_register(&d2net_gpio_buttons);
329
330 d2net_gpio_leds_init();
331
332 pr_notice("d2net: Flash write are not yet supported.\n");
333
334 i2c_register_board_info(0, d2net_i2c_devices,
335 ARRAY_SIZE(d2net_i2c_devices));
336}
337
338/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */
339
340#ifdef CONFIG_MACH_D2NET
341MACHINE_START(D2NET, "LaCie d2 Network")
342 .phys_io = ORION5X_REGS_PHYS_BASE,
343 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
344 .boot_params = 0x00000100,
345 .init_machine = d2net_init,
346 .map_io = orion5x_map_io,
347 .init_irq = orion5x_init_irq,
348 .timer = &orion5x_timer,
349 .fixup = tag_fixup_mem32,
350MACHINE_END
351#endif
352
353#ifdef CONFIG_MACH_BIGDISK
354MACHINE_START(BIGDISK, "LaCie Big Disk Network")
355 .phys_io = ORION5X_REGS_PHYS_BASE,
356 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
357 .boot_params = 0x00000100,
358 .init_machine = d2net_init,
359 .map_io = orion5x_map_io,
360 .init_irq = orion5x_init_irq,
361 .timer = &orion5x_timer,
362 .fixup = tag_fixup_mem32,
363MACHINE_END
364#endif
365
diff --git a/arch/arm/mach-orion5x/net2big-setup.c b/arch/arm/mach-orion5x/net2big-setup.c
new file mode 100644
index 000000000000..7bd6283476f9
--- /dev/null
+++ b/arch/arm/mach-orion5x/net2big-setup.c
@@ -0,0 +1,431 @@
1/*
2 * arch/arm/mach-orion5x/net2big-setup.c
3 *
4 * LaCie 2Big Network NAS setup
5 *
6 * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h>
18#include <linux/leds.h>
19#include <linux/gpio_keys.h>
20#include <linux/input.h>
21#include <linux/i2c.h>
22#include <linux/ata_platform.h>
23#include <linux/gpio.h>
24#include <linux/delay.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <mach/orion5x.h>
28#include "common.h"
29#include "mpp.h"
30
31/*****************************************************************************
32 * LaCie 2Big Network Info
33 ****************************************************************************/
34
35/*
36 * 512KB NOR flash Device bus boot chip select
37 */
38
39#define NET2BIG_NOR_BOOT_BASE 0xfff80000
40#define NET2BIG_NOR_BOOT_SIZE SZ_512K
41
42/*****************************************************************************
43 * 512KB NOR Flash on Boot Device
44 ****************************************************************************/
45
46/*
47 * TODO: Check write support on flash MX29LV400CBTC-70G
48 */
49
50static struct mtd_partition net2big_partitions[] = {
51 {
52 .name = "Full512kb",
53 .size = MTDPART_SIZ_FULL,
54 .offset = 0x00000000,
55 .mask_flags = MTD_WRITEABLE,
56 },
57};
58
59static struct physmap_flash_data net2big_nor_flash_data = {
60 .width = 1,
61 .parts = net2big_partitions,
62 .nr_parts = ARRAY_SIZE(net2big_partitions),
63};
64
65static struct resource net2big_nor_flash_resource = {
66 .flags = IORESOURCE_MEM,
67 .start = NET2BIG_NOR_BOOT_BASE,
68 .end = NET2BIG_NOR_BOOT_BASE
69 + NET2BIG_NOR_BOOT_SIZE - 1,
70};
71
72static struct platform_device net2big_nor_flash = {
73 .name = "physmap-flash",
74 .id = 0,
75 .dev = {
76 .platform_data = &net2big_nor_flash_data,
77 },
78 .num_resources = 1,
79 .resource = &net2big_nor_flash_resource,
80};
81
82/*****************************************************************************
83 * Ethernet
84 ****************************************************************************/
85
86static struct mv643xx_eth_platform_data net2big_eth_data = {
87 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
88};
89
90/*****************************************************************************
91 * I2C devices
92 ****************************************************************************/
93
94/*
95 * i2c addr | chip | description
96 * 0x32 | Ricoh 5C372b | RTC
97 * 0x50 | HT24LC08 | eeprom (1kB)
98 */
99static struct i2c_board_info __initdata net2big_i2c_devices[] = {
100 {
101 I2C_BOARD_INFO("rs5c372b", 0x32),
102 }, {
103 I2C_BOARD_INFO("24c08", 0x50),
104 },
105};
106
107/*****************************************************************************
108 * SATA
109 ****************************************************************************/
110
111static struct mv_sata_platform_data net2big_sata_data = {
112 .n_ports = 2,
113};
114
115#define NET2BIG_GPIO_SATA_POWER_REQ 19
116#define NET2BIG_GPIO_SATA0_POWER 23
117#define NET2BIG_GPIO_SATA1_POWER 25
118
119static void __init net2big_sata_power_init(void)
120{
121 int err;
122
123 /* Configure GPIOs over MPP max number. */
124 orion_gpio_set_valid(NET2BIG_GPIO_SATA0_POWER, 1);
125 orion_gpio_set_valid(NET2BIG_GPIO_SATA1_POWER, 1);
126
127 err = gpio_request(NET2BIG_GPIO_SATA0_POWER, "SATA0 power status");
128 if (err == 0) {
129 err = gpio_direction_input(NET2BIG_GPIO_SATA0_POWER);
130 if (err)
131 gpio_free(NET2BIG_GPIO_SATA0_POWER);
132 }
133 if (err) {
134 pr_err("net2big: failed to setup SATA0 power GPIO\n");
135 return;
136 }
137
138 err = gpio_request(NET2BIG_GPIO_SATA1_POWER, "SATA1 power status");
139 if (err == 0) {
140 err = gpio_direction_input(NET2BIG_GPIO_SATA1_POWER);
141 if (err)
142 gpio_free(NET2BIG_GPIO_SATA1_POWER);
143 }
144 if (err) {
145 pr_err("net2big: failed to setup SATA1 power GPIO\n");
146 goto err_free_1;
147 }
148
149 err = gpio_request(NET2BIG_GPIO_SATA_POWER_REQ, "SATA power request");
150 if (err == 0) {
151 err = gpio_direction_output(NET2BIG_GPIO_SATA_POWER_REQ, 0);
152 if (err)
153 gpio_free(NET2BIG_GPIO_SATA_POWER_REQ);
154 }
155 if (err) {
156 pr_err("net2big: failed to setup SATA power request GPIO\n");
157 goto err_free_2;
158 }
159
160 if (gpio_get_value(NET2BIG_GPIO_SATA0_POWER) &&
161 gpio_get_value(NET2BIG_GPIO_SATA1_POWER)) {
162 return;
163 }
164
165 /*
166 * SATA power up on both disk is done by pulling high the CPLD power
167 * request line. The 300ms delay is related to the CPLD clock and is
168 * needed to be sure that the CPLD has take into account the low line
169 * status.
170 */
171 msleep(300);
172 gpio_set_value(NET2BIG_GPIO_SATA_POWER_REQ, 1);
173 pr_info("net2big: power up SATA hard disks\n");
174
175 return;
176
177err_free_2:
178 gpio_free(NET2BIG_GPIO_SATA1_POWER);
179err_free_1:
180 gpio_free(NET2BIG_GPIO_SATA0_POWER);
181
182 return;
183}
184
185/*****************************************************************************
186 * GPIO LEDs
187 ****************************************************************************/
188
189/*
190 * The power front LEDs (blue and red) and SATA red LEDs are controlled via a
191 * single GPIO line and are compatible with the leds-gpio driver.
192 *
193 * The SATA blue LEDs have some hardware blink capabilities which are detailled
194 * in the following array:
195 *
196 * SATAx blue LED | SATAx activity | LED state
197 * | |
198 * 0 | 0 | blink (rate 300ms)
199 * 1 | 0 | off
200 * ? | 1 | on
201 *
202 * Notes: The blue and the red front LED's can't be on at the same time.
203 * Blue LED have priority.
204 */
205
206#define NET2BIG_GPIO_PWR_RED_LED 6
207#define NET2BIG_GPIO_PWR_BLUE_LED 16
208#define NET2BIG_GPIO_PWR_LED_BLINK_STOP 7
209
210#define NET2BIG_GPIO_SATA0_RED_LED 11
211#define NET2BIG_GPIO_SATA1_RED_LED 10
212
213#define NET2BIG_GPIO_SATA0_BLUE_LED 17
214#define NET2BIG_GPIO_SATA1_BLUE_LED 13
215
216static struct gpio_led net2big_leds[] = {
217 {
218 .name = "net2big:red:power",
219 .gpio = NET2BIG_GPIO_PWR_RED_LED,
220 },
221 {
222 .name = "net2big:blue:power",
223 .gpio = NET2BIG_GPIO_PWR_BLUE_LED,
224 },
225 {
226 .name = "net2big:red:sata0",
227 .gpio = NET2BIG_GPIO_SATA0_RED_LED,
228 },
229 {
230 .name = "net2big:red:sata1",
231 .gpio = NET2BIG_GPIO_SATA1_RED_LED,
232 },
233};
234
235static struct gpio_led_platform_data net2big_led_data = {
236 .num_leds = ARRAY_SIZE(net2big_leds),
237 .leds = net2big_leds,
238};
239
240static struct platform_device net2big_gpio_leds = {
241 .name = "leds-gpio",
242 .id = -1,
243 .dev = {
244 .platform_data = &net2big_led_data,
245 },
246};
247
248static void __init net2big_gpio_leds_init(void)
249{
250 int err;
251
252 /* Stop initial CPLD slow red/blue blinking on power LED. */
253 err = gpio_request(NET2BIG_GPIO_PWR_LED_BLINK_STOP,
254 "Power LED blink stop");
255 if (err == 0) {
256 err = gpio_direction_output(NET2BIG_GPIO_PWR_LED_BLINK_STOP, 1);
257 if (err)
258 gpio_free(NET2BIG_GPIO_PWR_LED_BLINK_STOP);
259 }
260 if (err)
261 pr_err("net2big: failed to setup power LED blink GPIO\n");
262
263 /*
264 * Configure SATA0 and SATA1 blue LEDs to blink in relation with the
265 * hard disk activity.
266 */
267 err = gpio_request(NET2BIG_GPIO_SATA0_BLUE_LED,
268 "SATA0 blue LED control");
269 if (err == 0) {
270 err = gpio_direction_output(NET2BIG_GPIO_SATA0_BLUE_LED, 1);
271 if (err)
272 gpio_free(NET2BIG_GPIO_SATA0_BLUE_LED);
273 }
274 if (err)
275 pr_err("net2big: failed to setup SATA0 blue LED GPIO\n");
276
277 err = gpio_request(NET2BIG_GPIO_SATA1_BLUE_LED,
278 "SATA1 blue LED control");
279 if (err == 0) {
280 err = gpio_direction_output(NET2BIG_GPIO_SATA1_BLUE_LED, 1);
281 if (err)
282 gpio_free(NET2BIG_GPIO_SATA1_BLUE_LED);
283 }
284 if (err)
285 pr_err("net2big: failed to setup SATA1 blue LED GPIO\n");
286
287 platform_device_register(&net2big_gpio_leds);
288}
289
290/****************************************************************************
291 * GPIO keys
292 ****************************************************************************/
293
294#define NET2BIG_GPIO_PUSH_BUTTON 18
295#define NET2BIG_GPIO_POWER_SWITCH_ON 8
296#define NET2BIG_GPIO_POWER_SWITCH_OFF 9
297
298#define NET2BIG_SWITCH_POWER_ON 0x1
299#define NET2BIG_SWITCH_POWER_OFF 0x2
300
301static struct gpio_keys_button net2big_buttons[] = {
302 {
303 .type = EV_SW,
304 .code = NET2BIG_SWITCH_POWER_OFF,
305 .gpio = NET2BIG_GPIO_POWER_SWITCH_OFF,
306 .desc = "Power rocker switch (auto|off)",
307 .active_low = 0,
308 },
309 {
310 .type = EV_SW,
311 .code = NET2BIG_SWITCH_POWER_ON,
312 .gpio = NET2BIG_GPIO_POWER_SWITCH_ON,
313 .desc = "Power rocker switch (on|auto)",
314 .active_low = 0,
315 },
316 {
317 .type = EV_KEY,
318 .code = KEY_POWER,
319 .gpio = NET2BIG_GPIO_PUSH_BUTTON,
320 .desc = "Front Push Button",
321 .active_low = 0,
322 },
323};
324
325static struct gpio_keys_platform_data net2big_button_data = {
326 .buttons = net2big_buttons,
327 .nbuttons = ARRAY_SIZE(net2big_buttons),
328};
329
330static struct platform_device net2big_gpio_buttons = {
331 .name = "gpio-keys",
332 .id = -1,
333 .dev = {
334 .platform_data = &net2big_button_data,
335 },
336};
337
338/*****************************************************************************
339 * General Setup
340 ****************************************************************************/
341
342static struct orion5x_mpp_mode net2big_mpp_modes[] __initdata = {
343 { 0, MPP_GPIO }, /* Raid mode (bit 0) */
344 { 1, MPP_GPIO }, /* USB port 2 fuse (0 = Fail, 1 = Ok) */
345 { 2, MPP_GPIO }, /* Raid mode (bit 1) */
346 { 3, MPP_GPIO }, /* Board ID (bit 0) */
347 { 4, MPP_GPIO }, /* Fan activity (0 = Off, 1 = On) */
348 { 5, MPP_GPIO }, /* Fan fail detection */
349 { 6, MPP_GPIO }, /* Red front LED (0 = Off, 1 = On) */
350 { 7, MPP_GPIO }, /* Disable initial blinking on front LED */
351 { 8, MPP_GPIO }, /* Rear power switch (on|auto) */
352 { 9, MPP_GPIO }, /* Rear power switch (auto|off) */
353 { 10, MPP_GPIO }, /* SATA 1 red LED (0 = Off, 1 = On) */
354 { 11, MPP_GPIO }, /* SATA 0 red LED (0 = Off, 1 = On) */
355 { 12, MPP_GPIO }, /* Board ID (bit 1) */
356 { 13, MPP_GPIO }, /* SATA 1 blue LED blink control */
357 { 14, MPP_SATA_LED },
358 { 15, MPP_SATA_LED },
359 { 16, MPP_GPIO }, /* Blue front LED control */
360 { 17, MPP_GPIO }, /* SATA 0 blue LED blink control */
361 { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */
362 { 19, MPP_GPIO }, /* SATA{0,1} power On/Off request */
363 { -1 }
364 /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */
365 /* 23: SATA 0 power status */
366 /* 24: Board power off */
367 /* 25: SATA 1 power status */
368};
369
370#define NET2BIG_GPIO_POWER_OFF 24
371
372static void net2big_power_off(void)
373{
374 gpio_set_value(NET2BIG_GPIO_POWER_OFF, 1);
375}
376
377static void __init net2big_init(void)
378{
379 /*
380 * Setup basic Orion functions. Need to be called early.
381 */
382 orion5x_init();
383
384 orion5x_mpp_conf(net2big_mpp_modes);
385
386 /*
387 * Configure peripherals.
388 */
389 orion5x_ehci0_init();
390 orion5x_ehci1_init();
391 orion5x_eth_init(&net2big_eth_data);
392 orion5x_i2c_init();
393 orion5x_uart0_init();
394 orion5x_xor_init();
395
396 net2big_sata_power_init();
397 orion5x_sata_init(&net2big_sata_data);
398
399 orion5x_setup_dev_boot_win(NET2BIG_NOR_BOOT_BASE,
400 NET2BIG_NOR_BOOT_SIZE);
401 platform_device_register(&net2big_nor_flash);
402
403 platform_device_register(&net2big_gpio_buttons);
404 net2big_gpio_leds_init();
405
406 i2c_register_board_info(0, net2big_i2c_devices,
407 ARRAY_SIZE(net2big_i2c_devices));
408
409 orion_gpio_set_valid(NET2BIG_GPIO_POWER_OFF, 1);
410
411 if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 &&
412 gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0)
413 pm_power_off = net2big_power_off;
414 else
415 pr_err("net2big: failed to configure power-off GPIO\n");
416
417 pr_notice("net2big: Flash writing is not yet supported.\n");
418}
419
420/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */
421MACHINE_START(NET2BIG, "LaCie 2Big Network")
422 .phys_io = ORION5X_REGS_PHYS_BASE,
423 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
424 .boot_params = 0x00000100,
425 .init_machine = net2big_init,
426 .map_io = orion5x_map_io,
427 .init_irq = orion5x_init_irq,
428 .timer = &orion5x_timer,
429 .fixup = tag_fixup_mem32,
430MACHINE_END
431
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa300.h b/arch/arm/mach-pxa/include/mach/mfp-pxa300.h
index ae8441192ef0..7139e0dc26d1 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa300.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa300.h
@@ -567,9 +567,9 @@
567#define GPIO37_ULPI_DATA_OUT_7 MFP_CFG(GPIO37, AF3) 567#define GPIO37_ULPI_DATA_OUT_7 MFP_CFG(GPIO37, AF3)
568#define GPIO33_ULPI_OTG_INTR MFP_CFG(GPIO33, AF1) 568#define GPIO33_ULPI_OTG_INTR MFP_CFG(GPIO33, AF1)
569 569
570#define ULPI_DIR MFP_CFG_DRV(ULPI_DIR, MFP_AF0, MFP_DS01X) 570#define ULPI_DIR MFP_CFG_DRV(ULPI_DIR, AF0, DS01X)
571#define ULPI_NXT MFP_CFG_DRV(ULPI_NXT, MFP_AF0, MFP_DS01X) 571#define ULPI_NXT MFP_CFG_DRV(ULPI_NXT, AF0, DS01X)
572#define ULPI_STP MFP_CFG_DRV(ULPI_STP, MFP_AF0, MFP_DS01X) 572#define ULPI_STP MFP_CFG_DRV(ULPI_STP, AF0, DS01X)
573#endif /* CONFIG_CPU_PXA310 */ 573#endif /* CONFIG_CPU_PXA310 */
574 574
575#endif /* __ASM_ARCH_MFP_PXA300_H */ 575#endif /* __ASM_ARCH_MFP_PXA300_H */
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 6f678d93bf4e..09b7b1a10cad 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -250,7 +250,7 @@ static DEFINE_PXA3_CKEN(pxa3xx_mmc2, MMC2, 19500000, 0);
250static struct clk_lookup pxa3xx_clkregs[] = { 250static struct clk_lookup pxa3xx_clkregs[] = {
251 INIT_CLKREG(&clk_pxa3xx_pout, NULL, "CLK_POUT"), 251 INIT_CLKREG(&clk_pxa3xx_pout, NULL, "CLK_POUT"),
252 /* Power I2C clock is always on */ 252 /* Power I2C clock is always on */
253 INIT_CLKREG(&clk_dummy, "pxa2xx-i2c.1", NULL), 253 INIT_CLKREG(&clk_dummy, "pxa3xx-pwri2c.1", NULL),
254 INIT_CLKREG(&clk_pxa3xx_lcd, "pxa2xx-fb", NULL), 254 INIT_CLKREG(&clk_pxa3xx_lcd, "pxa2xx-fb", NULL),
255 INIT_CLKREG(&clk_pxa3xx_camera, NULL, "CAMCLK"), 255 INIT_CLKREG(&clk_pxa3xx_camera, NULL, "CAMCLK"),
256 INIT_CLKREG(&clk_pxa3xx_ac97, NULL, "AC97CLK"), 256 INIT_CLKREG(&clk_pxa3xx_ac97, NULL, "AC97CLK"),
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index d4cfa2145386..dfc9b0bc6eb2 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -75,7 +75,7 @@ config MACH_REALVIEW_PBX
75 75
76config REALVIEW_HIGH_PHYS_OFFSET 76config REALVIEW_HIGH_PHYS_OFFSET
77 bool "High physical base address for the RealView platform" 77 bool "High physical base address for the RealView platform"
78 depends on !MACH_REALVIEW_PB1176 78 depends on MMU && !MACH_REALVIEW_PB1176
79 default y 79 default y
80 help 80 help
81 RealView boards other than PB1176 have the RAM available at 81 RealView boards other than PB1176 have the RAM available at
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index ab615e78b798..dc3519c50ab2 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -208,8 +208,7 @@ struct platform_device realview_i2c_device = {
208 208
209static struct i2c_board_info realview_i2c_board_info[] = { 209static struct i2c_board_info realview_i2c_board_info[] = {
210 { 210 {
211 I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1), 211 I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
212 .type = "ds1338",
213 }, 212 },
214}; 213};
215 214
diff --git a/arch/arm/mach-realview/include/mach/hardware.h b/arch/arm/mach-realview/include/mach/hardware.h
index b42c14f89acb..8a638d15797f 100644
--- a/arch/arm/mach-realview/include/mach/hardware.h
+++ b/arch/arm/mach-realview/include/mach/hardware.h
@@ -25,6 +25,7 @@
25#include <asm/sizes.h> 25#include <asm/sizes.h>
26 26
27/* macro to get at IO space when running virtually */ 27/* macro to get at IO space when running virtually */
28#ifdef CONFIG_MMU
28/* 29/*
29 * Statically mapped addresses: 30 * Statically mapped addresses:
30 * 31 *
@@ -33,6 +34,9 @@
33 * 1fxx xxxx -> fexx xxxx 34 * 1fxx xxxx -> fexx xxxx
34 */ 35 */
35#define IO_ADDRESS(x) (((x) & 0x03ffffff) + 0xfb000000) 36#define IO_ADDRESS(x) (((x) & 0x03ffffff) + 0xfb000000)
37#else
38#define IO_ADDRESS(x) (x)
39#endif
36#define __io_address(n) __io(IO_ADDRESS(n)) 40#define __io_address(n) __io(IO_ADDRESS(n))
37 41
38#endif 42#endif
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index ac0e83f1cc3a..a88458b4799d 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -20,6 +20,7 @@
20#include <mach/hardware.h> 20#include <mach/hardware.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/localtimer.h> 22#include <asm/localtimer.h>
23#include <asm/unified.h>
23 24
24#include <mach/board-eb.h> 25#include <mach/board-eb.h>
25#include <mach/board-pb11mp.h> 26#include <mach/board-pb11mp.h>
@@ -137,26 +138,19 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
137 138
138static void __init poke_milo(void) 139static void __init poke_milo(void)
139{ 140{
140 extern void secondary_startup(void);
141
142 /* nobody is to be released from the pen yet */ 141 /* nobody is to be released from the pen yet */
143 pen_release = -1; 142 pen_release = -1;
144 143
145 /* 144 /*
146 * write the address of secondary startup into the system-wide 145 * Write the address of secondary startup into the system-wide flags
147 * flags register, then clear the bottom two bits, which is what 146 * register. The BootMonitor waits for this register to become
148 * BootMonitor is waiting for 147 * non-zero.
149 */ 148 */
150#if 1
151#define REALVIEW_SYS_FLAGSS_OFFSET 0x30 149#define REALVIEW_SYS_FLAGSS_OFFSET 0x30
152 __raw_writel(virt_to_phys(realview_secondary_startup),
153 __io_address(REALVIEW_SYS_BASE) +
154 REALVIEW_SYS_FLAGSS_OFFSET);
155#define REALVIEW_SYS_FLAGSC_OFFSET 0x34 150#define REALVIEW_SYS_FLAGSC_OFFSET 0x34
156 __raw_writel(3, 151 __raw_writel(BSYM(virt_to_phys(realview_secondary_startup)),
157 __io_address(REALVIEW_SYS_BASE) + 152 __io_address(REALVIEW_SYS_BASE) +
158 REALVIEW_SYS_FLAGSC_OFFSET); 153 REALVIEW_SYS_FLAGSS_OFFSET);
159#endif
160 154
161 mb(); 155 mb();
162} 156}
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index 41bb65d5b91f..d8c023d4df30 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -12,6 +12,7 @@ config CPU_S3C2410
12 select S3C2410_GPIO 12 select S3C2410_GPIO
13 select CPU_LLSERIAL_S3C2410 13 select CPU_LLSERIAL_S3C2410
14 select S3C2410_PM if PM 14 select S3C2410_PM if PM
15 select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
15 help 16 help
16 Support for S3C2410 and S3C2410A family from the S3C24XX line 17 Support for S3C2410 and S3C2410A family from the S3C24XX line
17 of Samsung Mobile CPUs. 18 of Samsung Mobile CPUs.
@@ -45,6 +46,22 @@ config MACH_BAST_IDE
45 Internal node for machines with an BAST style IDE 46 Internal node for machines with an BAST style IDE
46 interface 47 interface
47 48
49# cpu frequency scaling support
50
51config S3C2410_CPUFREQ
52 bool
53 depends on CPU_FREQ_S3C24XX && CPU_S3C2410
54 select S3C2410_CPUFREQ_UTILS
55 help
56 CPU Frequency scaling support for S3C2410
57
58config S3C2410_PLLTABLE
59 bool
60 depends on S3C2410_CPUFREQ && CPU_FREQ_S3C24XX_PLL
61 default y
62 help
63 Select the PLL table for the S3C2410
64
48menu "S3C2410 Machines" 65menu "S3C2410 Machines"
49 66
50config ARCH_SMDK2410 67config ARCH_SMDK2410
@@ -79,6 +96,7 @@ config MACH_N30
79config ARCH_BAST 96config ARCH_BAST
80 bool "Simtec Electronics BAST (EB2410ITX)" 97 bool "Simtec Electronics BAST (EB2410ITX)"
81 select CPU_S3C2410 98 select CPU_S3C2410
99 select S3C2410_IOTIMING if S3C2410_CPUFREQ
82 select PM_SIMTEC if PM 100 select PM_SIMTEC if PM
83 select SIMTEC_NOR 101 select SIMTEC_NOR
84 select MACH_BAST_IDE 102 select MACH_BAST_IDE
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index fca02f82711c..2ab5ba4b266f 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -15,6 +15,8 @@ obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o
15obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o 15obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o
16obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o 16obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o
17obj-$(CONFIG_S3C2410_GPIO) += gpio.o 17obj-$(CONFIG_S3C2410_GPIO) += gpio.o
18obj-$(CONFIG_S3C2410_CPUFREQ) += cpu-freq.o
19obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o
18 20
19# Machine support 21# Machine support
20 22
diff --git a/arch/arm/mach-s3c2410/cpu-freq.c b/arch/arm/mach-s3c2410/cpu-freq.c
new file mode 100644
index 000000000000..9d1186877d08
--- /dev/null
+++ b/arch/arm/mach-s3c2410/cpu-freq.c
@@ -0,0 +1,159 @@
1/* linux/arch/arm/mach-s3c2410/cpu-freq.c
2 *
3 * Copyright (c) 2006,2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2410 CPU Frequency scaling
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/cpufreq.h>
19#include <linux/sysdev.h>
20#include <linux/clk.h>
21#include <linux/err.h>
22#include <linux/io.h>
23
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26
27#include <mach/regs-clock.h>
28
29#include <plat/cpu.h>
30#include <plat/clock.h>
31#include <plat/cpu-freq-core.h>
32
33/* Note, 2410A has an extra mode for 1:4:4 ratio, bit 2 of CLKDIV */
34
35static void s3c2410_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
36{
37 u32 clkdiv = 0;
38
39 if (cfg->divs.h_divisor == 2)
40 clkdiv |= S3C2410_CLKDIVN_HDIVN;
41
42 if (cfg->divs.p_divisor != cfg->divs.h_divisor)
43 clkdiv |= S3C2410_CLKDIVN_PDIVN;
44
45 __raw_writel(clkdiv, S3C2410_CLKDIVN);
46}
47
48static int s3c2410_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
49{
50 unsigned long hclk, fclk, pclk;
51 unsigned int hdiv, pdiv;
52 unsigned long hclk_max;
53
54 fclk = cfg->freq.fclk;
55 hclk_max = cfg->max.hclk;
56
57 cfg->freq.armclk = fclk;
58
59 s3c_freq_dbg("%s: fclk is %lu, max hclk %lu\n",
60 __func__, fclk, hclk_max);
61
62 hdiv = (fclk > cfg->max.hclk) ? 2 : 1;
63 hclk = fclk / hdiv;
64
65 if (hclk > cfg->max.hclk) {
66 s3c_freq_dbg("%s: hclk too big\n", __func__);
67 return -EINVAL;
68 }
69
70 pdiv = (hclk > cfg->max.pclk) ? 2 : 1;
71 pclk = hclk / pdiv;
72
73 if (pclk > cfg->max.pclk) {
74 s3c_freq_dbg("%s: pclk too big\n", __func__);
75 return -EINVAL;
76 }
77
78 pdiv *= hdiv;
79
80 /* record the result */
81 cfg->divs.p_divisor = pdiv;
82 cfg->divs.h_divisor = hdiv;
83
84 return 0 ;
85}
86
87static struct s3c_cpufreq_info s3c2410_cpufreq_info = {
88 .max = {
89 .fclk = 200000000,
90 .hclk = 100000000,
91 .pclk = 50000000,
92 },
93
94 /* transition latency is about 5ms worst-case, so
95 * set 10ms to be sure */
96 .latency = 10000000,
97
98 .locktime_m = 150,
99 .locktime_u = 150,
100 .locktime_bits = 12,
101
102 .need_pll = 1,
103
104 .name = "s3c2410",
105 .calc_iotiming = s3c2410_iotiming_calc,
106 .set_iotiming = s3c2410_iotiming_set,
107 .get_iotiming = s3c2410_iotiming_get,
108 .resume_clocks = s3c2410_setup_clocks,
109
110 .set_fvco = s3c2410_set_fvco,
111 .set_refresh = s3c2410_cpufreq_setrefresh,
112 .set_divs = s3c2410_cpufreq_setdivs,
113 .calc_divs = s3c2410_cpufreq_calcdivs,
114
115 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs),
116};
117
118static int s3c2410_cpufreq_add(struct sys_device *sysdev)
119{
120 return s3c_cpufreq_register(&s3c2410_cpufreq_info);
121}
122
123static struct sysdev_driver s3c2410_cpufreq_driver = {
124 .add = s3c2410_cpufreq_add,
125};
126
127static int __init s3c2410_cpufreq_init(void)
128{
129 return sysdev_driver_register(&s3c2410_sysclass,
130 &s3c2410_cpufreq_driver);
131}
132
133arch_initcall(s3c2410_cpufreq_init);
134
135static int s3c2410a_cpufreq_add(struct sys_device *sysdev)
136{
137 /* alter the maximum freq settings for S3C2410A. If a board knows
138 * it only has a maximum of 200, then it should register its own
139 * limits. */
140
141 s3c2410_cpufreq_info.max.fclk = 266000000;
142 s3c2410_cpufreq_info.max.hclk = 133000000;
143 s3c2410_cpufreq_info.max.pclk = 66500000;
144 s3c2410_cpufreq_info.name = "s3c2410a";
145
146 return s3c2410_cpufreq_add(sysdev);
147}
148
149static struct sysdev_driver s3c2410a_cpufreq_driver = {
150 .add = s3c2410a_cpufreq_add,
151};
152
153static int __init s3c2410a_cpufreq_init(void)
154{
155 return sysdev_driver_register(&s3c2410a_sysclass,
156 &s3c2410a_cpufreq_driver);
157}
158
159arch_initcall(s3c2410a_cpufreq_init);
diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
index dbf96e60d992..63b753f56c64 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c2410/dma.c
@@ -164,6 +164,17 @@ static int __init s3c2410_dma_drvinit(void)
164} 164}
165 165
166arch_initcall(s3c2410_dma_drvinit); 166arch_initcall(s3c2410_dma_drvinit);
167
168static struct sysdev_driver s3c2410a_dma_driver = {
169 .add = s3c2410_dma_add,
170};
171
172static int __init s3c2410a_dma_drvinit(void)
173{
174 return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_dma_driver);
175}
176
177arch_initcall(s3c2410a_dma_drvinit);
167#endif 178#endif
168 179
169#if defined(CONFIG_CPU_S3C2442) 180#if defined(CONFIG_CPU_S3C2442)
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-core.h b/arch/arm/mach-s3c2410/include/mach/gpio-core.h
index 8fe192081d3a..f8b879a7973c 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio-core.h
+++ b/arch/arm/mach-s3c2410/include/mach/gpio-core.h
@@ -28,7 +28,7 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
28 return NULL; 28 return NULL;
29 29
30 chip = &s3c24xx_gpios[pin/32]; 30 chip = &s3c24xx_gpios[pin/32];
31 return (S3C2410_GPIO_OFFSET(pin) > chip->chip.ngpio) ? chip : NULL; 31 return (S3C2410_GPIO_OFFSET(pin) < chip->chip.ngpio) ? chip : NULL;
32} 32}
33 33
34#endif /* __ASM_ARCH_GPIO_CORE_H */ 34#endif /* __ASM_ARCH_GPIO_CORE_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/irqs.h b/arch/arm/mach-s3c2410/include/mach/irqs.h
index 2a2384ffa7b1..6c12c6312ad8 100644
--- a/arch/arm/mach-s3c2410/include/mach/irqs.h
+++ b/arch/arm/mach-s3c2410/include/mach/irqs.h
@@ -164,6 +164,12 @@
164#define IRQ_S3CUART_TX3 IRQ_S3C2443_TX3 164#define IRQ_S3CUART_TX3 IRQ_S3C2443_TX3
165#define IRQ_S3CUART_ERR3 IRQ_S3C2443_ERR3 165#define IRQ_S3CUART_ERR3 IRQ_S3C2443_ERR3
166 166
167#ifdef CONFIG_CPU_S3C2440
168#define IRQ_S3C244x_AC97 IRQ_S3C2440_AC97
169#else
170#define IRQ_S3C244x_AC97 IRQ_S3C2443_AC97
171#endif
172
167/* Our FIQs are routable from IRQ_EINT0 to IRQ_ADCPARENT */ 173/* Our FIQs are routable from IRQ_EINT0 to IRQ_ADCPARENT */
168#define FIQ_START IRQ_EINT0 174#define FIQ_START IRQ_EINT0
169 175
diff --git a/arch/arm/mach-s3c2410/include/mach/map.h b/arch/arm/mach-s3c2410/include/mach/map.h
index e99b212cb1ca..b049e61460b6 100644
--- a/arch/arm/mach-s3c2410/include/mach/map.h
+++ b/arch/arm/mach-s3c2410/include/mach/map.h
@@ -67,6 +67,13 @@
67#define S3C2443_PA_HSMMC (0x4A800000) 67#define S3C2443_PA_HSMMC (0x4A800000)
68#define S3C2443_SZ_HSMMC (256) 68#define S3C2443_SZ_HSMMC (256)
69 69
70/* S3C2412 memory and IO controls */
71#define S3C2412_PA_SSMC (0x4F000000)
72#define S3C2412_VA_SSMC S3C_ADDR_CPU(0x00000000)
73
74#define S3C2412_PA_EBI (0x48800000)
75#define S3C2412_VA_EBI S3C_ADDR_CPU(0x00010000)
76
70/* physical addresses of all the chip-select areas */ 77/* physical addresses of all the chip-select areas */
71 78
72#define S3C2410_CS0 (0x00000000) 79#define S3C2410_CS0 (0x00000000)
@@ -103,5 +110,6 @@
103#define S3C_PA_UART S3C24XX_PA_UART 110#define S3C_PA_UART S3C24XX_PA_UART
104#define S3C_PA_USBHOST S3C2410_PA_USBHOST 111#define S3C_PA_USBHOST S3C2410_PA_USBHOST
105#define S3C_PA_HSMMC0 S3C2443_PA_HSMMC 112#define S3C_PA_HSMMC0 S3C2443_PA_HSMMC
113#define S3C_PA_NAND S3C24XX_PA_NAND
106 114
107#endif /* __ASM_ARCH_MAP_H */ 115#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
index b278d0c45ccf..f6e8eec879c8 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
@@ -328,13 +328,15 @@
328 328
329#define S3C2410_GPD8_VD16 (0x02 << 16) 329#define S3C2410_GPD8_VD16 (0x02 << 16)
330#define S3C2400_GPD8_TOUT3 (0x02 << 16) 330#define S3C2400_GPD8_TOUT3 (0x02 << 16)
331#define S3C2440_GPD8_SPIMISO1 (0x03 << 16)
331 332
332#define S3C2410_GPD9_VD17 (0x02 << 18) 333#define S3C2410_GPD9_VD17 (0x02 << 18)
333#define S3C2400_GPD9_TCLK0 (0x02 << 18) 334#define S3C2400_GPD9_TCLK0 (0x02 << 18)
334#define S3C2410_GPD9_MASK (0x03 << 18) 335#define S3C2440_GPD9_SPIMOSI1 (0x03 << 18)
335 336
336#define S3C2410_GPD10_VD18 (0x02 << 20) 337#define S3C2410_GPD10_VD18 (0x02 << 20)
337#define S3C2400_GPD10_nWAIT (0x02 << 20) 338#define S3C2400_GPD10_nWAIT (0x02 << 20)
339#define S3C2440_GPD10_SPICLK1 (0x03 << 20)
338 340
339#define S3C2410_GPD11_VD19 (0x02 << 22) 341#define S3C2410_GPD11_VD19 (0x02 << 22)
340 342
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-mem.h b/arch/arm/mach-s3c2410/include/mach/regs-mem.h
index 57759804e2fa..7f7c52947963 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-mem.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-mem.h
@@ -73,6 +73,16 @@
73#define S3C2410_BWSCON_WS7 (1<<30) 73#define S3C2410_BWSCON_WS7 (1<<30)
74#define S3C2410_BWSCON_ST7 (1<<31) 74#define S3C2410_BWSCON_ST7 (1<<31)
75 75
76/* accesor functions for getting BANK(n) configuration. (n != 0) */
77
78#define S3C2410_BWSCON_GET(_bwscon, _bank) (((_bwscon) >> ((_bank) * 4)) & 0xf)
79
80#define S3C2410_BWSCON_DW8 (0)
81#define S3C2410_BWSCON_DW16 (1)
82#define S3C2410_BWSCON_DW32 (2)
83#define S3C2410_BWSCON_WS (1 << 2)
84#define S3C2410_BWSCON_ST (1 << 3)
85
76/* memory set (rom, ram) */ 86/* memory set (rom, ram) */
77#define S3C2410_BANKCON0 S3C2410_MEMREG(0x0004) 87#define S3C2410_BANKCON0 S3C2410_MEMREG(0x0004)
78#define S3C2410_BANKCON1 S3C2410_MEMREG(0x0008) 88#define S3C2410_BANKCON1 S3C2410_MEMREG(0x0008)
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h b/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h
index a4bf27123170..fb6352515090 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h
@@ -14,9 +14,11 @@
14#ifndef __ASM_ARM_REGS_S3C2412_MEM 14#ifndef __ASM_ARM_REGS_S3C2412_MEM
15#define __ASM_ARM_REGS_S3C2412_MEM 15#define __ASM_ARM_REGS_S3C2412_MEM
16 16
17#ifndef S3C2412_MEMREG
18#define S3C2412_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x)) 17#define S3C2412_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x))
19#endif 18#define S3C2412_EBIREG(x) (S3C2412_VA_EBI + (x))
19
20#define S3C2412_SSMCREG(x) (S3C2412_VA_SSMC + (x))
21#define S3C2412_SSMC(x, o) (S3C2412_SSMCREG((x * 0x20) + (o)))
20 22
21#define S3C2412_BANKCFG S3C2412_MEMREG(0x00) 23#define S3C2412_BANKCFG S3C2412_MEMREG(0x00)
22#define S3C2412_BANKCON1 S3C2412_MEMREG(0x04) 24#define S3C2412_BANKCON1 S3C2412_MEMREG(0x04)
@@ -26,4 +28,21 @@
26#define S3C2412_REFRESH S3C2412_MEMREG(0x10) 28#define S3C2412_REFRESH S3C2412_MEMREG(0x10)
27#define S3C2412_TIMEOUT S3C2412_MEMREG(0x14) 29#define S3C2412_TIMEOUT S3C2412_MEMREG(0x14)
28 30
31/* EBI control registers */
32
33#define S3C2412_EBI_PR S3C2412_EBIREG(0x00)
34#define S3C2412_EBI_BANKCFG S3C2412_EBIREG(0x04)
35
36/* SSMC control registers */
37
38#define S3C2412_SSMC_BANK(x) S3C2412_SSMC(x, 0x00)
39#define S3C2412_SMIDCYR(x) S3C2412_SSMC(x, 0x00)
40#define S3C2412_SMBWSTRD(x) S3C2412_SSMC(x, 0x04)
41#define S3C2412_SMBWSTWRR(x) S3C2412_SSMC(x, 0x08)
42#define S3C2412_SMBWSTOENR(x) S3C2412_SSMC(x, 0x0C)
43#define S3C2412_SMBWSTWENR(x) S3C2412_SSMC(x, 0x10)
44#define S3C2412_SMBCR(x) S3C2412_SSMC(x, 0x14)
45#define S3C2412_SMBSR(x) S3C2412_SSMC(x, 0x18)
46#define S3C2412_SMBWSTBRDR(x) S3C2412_SSMC(x, 0x1C)
47
29#endif /* __ASM_ARM_REGS_S3C2412_MEM */ 48#endif /* __ASM_ARM_REGS_S3C2412_MEM */
diff --git a/arch/arm/mach-s3c2410/include/mach/spi.h b/arch/arm/mach-s3c2410/include/mach/spi.h
index 1d300fb112b1..193b39d654ed 100644
--- a/arch/arm/mach-s3c2410/include/mach/spi.h
+++ b/arch/arm/mach-s3c2410/include/mach/spi.h
@@ -30,4 +30,7 @@ extern void s3c24xx_spi_gpiocfg_bus0_gpe11_12_13(struct s3c2410_spi_info *spi,
30extern void s3c24xx_spi_gpiocfg_bus1_gpg5_6_7(struct s3c2410_spi_info *spi, 30extern void s3c24xx_spi_gpiocfg_bus1_gpg5_6_7(struct s3c2410_spi_info *spi,
31 int enable); 31 int enable);
32 32
33extern void s3c24xx_spi_gpiocfg_bus1_gpd8_9_10(struct s3c2410_spi_info *spi,
34 int enable);
35
33#endif /* __ASM_ARCH_SPI_H */ 36#endif /* __ASM_ARCH_SPI_H */
diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c
index 92150399563b..5e2f35332056 100644
--- a/arch/arm/mach-s3c2410/irq.c
+++ b/arch/arm/mach-s3c2410/irq.c
@@ -39,9 +39,22 @@ static struct sysdev_driver s3c2410_irq_driver = {
39 .resume = s3c24xx_irq_resume, 39 .resume = s3c24xx_irq_resume,
40}; 40};
41 41
42static int s3c2410_irq_init(void) 42static int __init s3c2410_irq_init(void)
43{ 43{
44 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_irq_driver); 44 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_irq_driver);
45} 45}
46 46
47arch_initcall(s3c2410_irq_init); 47arch_initcall(s3c2410_irq_init);
48
49static struct sysdev_driver s3c2410a_irq_driver = {
50 .add = s3c2410_irq_add,
51 .suspend = s3c24xx_irq_suspend,
52 .resume = s3c24xx_irq_resume,
53};
54
55static int __init s3c2410a_irq_init(void)
56{
57 return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_irq_driver);
58}
59
60arch_initcall(s3c2410a_irq_init);
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index ce3baba2cd7f..647c9adb018f 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -45,6 +45,7 @@
45#include <mach/regs-mem.h> 45#include <mach/regs-mem.h>
46#include <mach/regs-lcd.h> 46#include <mach/regs-lcd.h>
47 47
48#include <plat/hwmon.h>
48#include <plat/nand.h> 49#include <plat/nand.h>
49#include <plat/iic.h> 50#include <plat/iic.h>
50#include <mach/fb.h> 51#include <mach/fb.h>
@@ -59,6 +60,7 @@
59#include <plat/clock.h> 60#include <plat/clock.h>
60#include <plat/devs.h> 61#include <plat/devs.h>
61#include <plat/cpu.h> 62#include <plat/cpu.h>
63#include <plat/cpu-freq.h>
62 64
63#include "usb-simtec.h" 65#include "usb-simtec.h"
64#include "nor-simtec.h" 66#include "nor-simtec.h"
@@ -547,7 +549,35 @@ static struct i2c_board_info bast_i2c_devs[] __initdata = {
547 }, 549 },
548}; 550};
549 551
552static struct s3c_hwmon_pdata bast_hwmon_info = {
553 /* LCD contrast (0-6.6V) */
554 .in[0] = &(struct s3c_hwmon_chcfg) {
555 .name = "lcd-contrast",
556 .mult = 3300,
557 .div = 512,
558 },
559 /* LED current feedback */
560 .in[1] = &(struct s3c_hwmon_chcfg) {
561 .name = "led-feedback",
562 .mult = 3300,
563 .div = 1024,
564 },
565 /* LCD feedback (0-6.6V) */
566 .in[2] = &(struct s3c_hwmon_chcfg) {
567 .name = "lcd-feedback",
568 .mult = 3300,
569 .div = 512,
570 },
571 /* Vcore (1.8-2.0V), Vref 3.3V */
572 .in[3] = &(struct s3c_hwmon_chcfg) {
573 .name = "vcore",
574 .mult = 3300,
575 .div = 1024,
576 },
577};
578
550/* Standard BAST devices */ 579/* Standard BAST devices */
580// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0
551 581
552static struct platform_device *bast_devices[] __initdata = { 582static struct platform_device *bast_devices[] __initdata = {
553 &s3c_device_usb, 583 &s3c_device_usb,
@@ -556,6 +586,8 @@ static struct platform_device *bast_devices[] __initdata = {
556 &s3c_device_i2c0, 586 &s3c_device_i2c0,
557 &s3c_device_rtc, 587 &s3c_device_rtc,
558 &s3c_device_nand, 588 &s3c_device_nand,
589 &s3c_device_adc,
590 &s3c_device_hwmon,
559 &bast_device_dm9k, 591 &bast_device_dm9k,
560 &bast_device_asix, 592 &bast_device_asix,
561 &bast_device_axpp, 593 &bast_device_axpp,
@@ -570,6 +602,12 @@ static struct clk *bast_clocks[] __initdata = {
570 &s3c24xx_uclk, 602 &s3c24xx_uclk,
571}; 603};
572 604
605static struct s3c_cpufreq_board __initdata bast_cpufreq = {
606 .refresh = 7800, /* 7.8usec */
607 .auto_io = 1,
608 .need_io = 1,
609};
610
573static void __init bast_map_io(void) 611static void __init bast_map_io(void)
574{ 612{
575 /* initialise the clocks */ 613 /* initialise the clocks */
@@ -588,6 +626,7 @@ static void __init bast_map_io(void)
588 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); 626 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
589 627
590 s3c_device_nand.dev.platform_data = &bast_nand_info; 628 s3c_device_nand.dev.platform_data = &bast_nand_info;
629 s3c_device_hwmon.dev.platform_data = &bast_hwmon_info;
591 630
592 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 631 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
593 s3c24xx_init_clocks(0); 632 s3c24xx_init_clocks(0);
@@ -608,6 +647,8 @@ static void __init bast_init(void)
608 647
609 usb_simtec_init(); 648 usb_simtec_init();
610 nor_simtec_init(); 649 nor_simtec_init();
650
651 s3c_cpufreq_setboard(&bast_cpufreq);
611} 652}
612 653
613MACHINE_START(BAST, "Simtec-BAST") 654MACHINE_START(BAST, "Simtec-BAST")
diff --git a/arch/arm/mach-s3c2410/pll.c b/arch/arm/mach-s3c2410/pll.c
new file mode 100644
index 000000000000..f178c2fd9d85
--- /dev/null
+++ b/arch/arm/mach-s3c2410/pll.c
@@ -0,0 +1,95 @@
1/* arch/arm/mach-s3c2410/pll.c
2 *
3 * Copyright (c) 2006,2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 * Vincent Sanders <vince@arm.linux.org.uk>
7 *
8 * S3C2410 CPU PLL tables
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23*/
24
25#include <linux/types.h>
26#include <linux/kernel.h>
27#include <linux/module.h>
28#include <linux/sysdev.h>
29#include <linux/list.h>
30#include <linux/clk.h>
31#include <linux/err.h>
32
33#include <plat/cpu.h>
34#include <plat/cpu-freq-core.h>
35
36static struct cpufreq_frequency_table pll_vals_12MHz[] = {
37 { .frequency = 34000000, .index = PLLVAL(82, 2, 3), },
38 { .frequency = 45000000, .index = PLLVAL(82, 1, 3), },
39 { .frequency = 51000000, .index = PLLVAL(161, 3, 3), },
40 { .frequency = 48000000, .index = PLLVAL(120, 2, 3), },
41 { .frequency = 56000000, .index = PLLVAL(142, 2, 3), },
42 { .frequency = 68000000, .index = PLLVAL(82, 2, 2), },
43 { .frequency = 79000000, .index = PLLVAL(71, 1, 2), },
44 { .frequency = 85000000, .index = PLLVAL(105, 2, 2), },
45 { .frequency = 90000000, .index = PLLVAL(112, 2, 2), },
46 { .frequency = 101000000, .index = PLLVAL(127, 2, 2), },
47 { .frequency = 113000000, .index = PLLVAL(105, 1, 2), },
48 { .frequency = 118000000, .index = PLLVAL(150, 2, 2), },
49 { .frequency = 124000000, .index = PLLVAL(116, 1, 2), },
50 { .frequency = 135000000, .index = PLLVAL(82, 2, 1), },
51 { .frequency = 147000000, .index = PLLVAL(90, 2, 1), },
52 { .frequency = 152000000, .index = PLLVAL(68, 1, 1), },
53 { .frequency = 158000000, .index = PLLVAL(71, 1, 1), },
54 { .frequency = 170000000, .index = PLLVAL(77, 1, 1), },
55 { .frequency = 180000000, .index = PLLVAL(82, 1, 1), },
56 { .frequency = 186000000, .index = PLLVAL(85, 1, 1), },
57 { .frequency = 192000000, .index = PLLVAL(88, 1, 1), },
58 { .frequency = 203000000, .index = PLLVAL(161, 3, 1), },
59
60 /* 2410A extras */
61
62 { .frequency = 210000000, .index = PLLVAL(132, 2, 1), },
63 { .frequency = 226000000, .index = PLLVAL(105, 1, 1), },
64 { .frequency = 266000000, .index = PLLVAL(125, 1, 1), },
65 { .frequency = 268000000, .index = PLLVAL(126, 1, 1), },
66 { .frequency = 270000000, .index = PLLVAL(127, 1, 1), },
67};
68
69static int s3c2410_plls_add(struct sys_device *dev)
70{
71 return s3c_plltab_register(pll_vals_12MHz, ARRAY_SIZE(pll_vals_12MHz));
72}
73
74static struct sysdev_driver s3c2410_plls_drv = {
75 .add = s3c2410_plls_add,
76};
77
78static int __init s3c2410_pll_init(void)
79{
80 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_plls_drv);
81
82}
83
84arch_initcall(s3c2410_pll_init);
85
86static struct sysdev_driver s3c2410a_plls_drv = {
87 .add = s3c2410_plls_add,
88};
89
90static int __init s3c2410a_pll_init(void)
91{
92 return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_plls_drv);
93}
94
95arch_initcall(s3c2410a_pll_init);
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c
index 143e08a599d4..966119c8efee 100644
--- a/arch/arm/mach-s3c2410/pm.c
+++ b/arch/arm/mach-s3c2410/pm.c
@@ -119,6 +119,18 @@ static int __init s3c2410_pm_drvinit(void)
119} 119}
120 120
121arch_initcall(s3c2410_pm_drvinit); 121arch_initcall(s3c2410_pm_drvinit);
122
123static struct sysdev_driver s3c2410a_pm_driver = {
124 .add = s3c2410_pm_add,
125 .resume = s3c2410_pm_resume,
126};
127
128static int __init s3c2410a_pm_drvinit(void)
129{
130 return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_pm_driver);
131}
132
133arch_initcall(s3c2410a_pm_drvinit);
122#endif 134#endif
123 135
124#if defined(CONFIG_CPU_S3C2440) 136#if defined(CONFIG_CPU_S3C2440)
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index feb141b1f915..91ba42f688ac 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -105,17 +105,33 @@ void __init_or_cpufreq s3c2410_setup_clocks(void)
105 s3c24xx_setup_clocks(fclk, hclk, pclk); 105 s3c24xx_setup_clocks(fclk, hclk, pclk);
106} 106}
107 107
108/* fake ARMCLK for use with cpufreq, etc. */
109
110static struct clk s3c2410_armclk = {
111 .name = "armclk",
112 .parent = &clk_f,
113 .id = -1,
114};
115
108void __init s3c2410_init_clocks(int xtal) 116void __init s3c2410_init_clocks(int xtal)
109{ 117{
110 s3c24xx_register_baseclocks(xtal); 118 s3c24xx_register_baseclocks(xtal);
111 s3c2410_setup_clocks(); 119 s3c2410_setup_clocks();
112 s3c2410_baseclk_add(); 120 s3c2410_baseclk_add();
121 s3c24xx_register_clock(&s3c2410_armclk);
113} 122}
114 123
115struct sysdev_class s3c2410_sysclass = { 124struct sysdev_class s3c2410_sysclass = {
116 .name = "s3c2410-core", 125 .name = "s3c2410-core",
117}; 126};
118 127
128/* Note, we would have liked to name this s3c2410-core, but we cannot
129 * register two sysdev_class with the same name.
130 */
131struct sysdev_class s3c2410a_sysclass = {
132 .name = "s3c2410a-core",
133};
134
119static struct sys_device s3c2410_sysdev = { 135static struct sys_device s3c2410_sysdev = {
120 .cls = &s3c2410_sysclass, 136 .cls = &s3c2410_sysclass,
121}; 137};
@@ -133,9 +149,22 @@ static int __init s3c2410_core_init(void)
133 149
134core_initcall(s3c2410_core_init); 150core_initcall(s3c2410_core_init);
135 151
152static int __init s3c2410a_core_init(void)
153{
154 return sysdev_class_register(&s3c2410a_sysclass);
155}
156
157core_initcall(s3c2410a_core_init);
158
136int __init s3c2410_init(void) 159int __init s3c2410_init(void)
137{ 160{
138 printk("S3C2410: Initialising architecture\n"); 161 printk("S3C2410: Initialising architecture\n");
139 162
140 return sysdev_register(&s3c2410_sysdev); 163 return sysdev_register(&s3c2410_sysdev);
141} 164}
165
166int __init s3c2410a_init(void)
167{
168 s3c2410_sysdev.cls = &s3c2410a_sysclass;
169 return s3c2410_init();
170}
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig
index 63586ffd0ae7..35c1bde89cf2 100644
--- a/arch/arm/mach-s3c2412/Kconfig
+++ b/arch/arm/mach-s3c2412/Kconfig
@@ -32,6 +32,15 @@ config S3C2412_PM
32 help 32 help
33 Internal config node to apply S3C2412 power management 33 Internal config node to apply S3C2412 power management
34 34
35# Note, the S3C2412 IOtiming support is in plat-s3c24xx
36
37config S3C2412_CPUFREQ
38 bool
39 depends on CPU_FREQ_S3C24XX && CPU_S3C2412
40 select S3C2412_IOTIMING
41 default y
42 help
43 CPU Frequency scaling support for S3C2412 and S3C2413 SoC CPUs.
35 44
36menu "S3C2412 Machines" 45menu "S3C2412 Machines"
37 46
diff --git a/arch/arm/mach-s3c2412/Makefile b/arch/arm/mach-s3c2412/Makefile
index 20918d5dc6a9..530ec46cbaea 100644
--- a/arch/arm/mach-s3c2412/Makefile
+++ b/arch/arm/mach-s3c2412/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_CPU_S3C2412) += clock.o
15obj-$(CONFIG_CPU_S3C2412) += gpio.o 15obj-$(CONFIG_CPU_S3C2412) += gpio.o
16obj-$(CONFIG_S3C2412_DMA) += dma.o 16obj-$(CONFIG_S3C2412_DMA) += dma.o
17obj-$(CONFIG_S3C2412_PM) += pm.o sleep.o 17obj-$(CONFIG_S3C2412_PM) += pm.o sleep.o
18obj-$(CONFIG_S3C2412_CPUFREQ) += cpu-freq.o
18 19
19# Machine support 20# Machine support
20 21
diff --git a/arch/arm/mach-s3c2412/cpu-freq.c b/arch/arm/mach-s3c2412/cpu-freq.c
new file mode 100644
index 000000000000..eb3ea1721335
--- /dev/null
+++ b/arch/arm/mach-s3c2412/cpu-freq.c
@@ -0,0 +1,257 @@
1/* linux/arch/arm/mach-s3c2412/cpu-freq.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2412 CPU Frequency scalling
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/cpufreq.h>
19#include <linux/sysdev.h>
20#include <linux/delay.h>
21#include <linux/clk.h>
22#include <linux/err.h>
23#include <linux/io.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27
28#include <mach/regs-clock.h>
29#include <mach/regs-s3c2412-mem.h>
30
31#include <plat/cpu.h>
32#include <plat/clock.h>
33#include <plat/cpu-freq-core.h>
34
35/* our clock resources. */
36static struct clk *xtal;
37static struct clk *fclk;
38static struct clk *hclk;
39static struct clk *armclk;
40
41/* HDIV: 1, 2, 3, 4, 6, 8 */
42
43static int s3c2412_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
44{
45 unsigned int hdiv, pdiv, armdiv, dvs;
46 unsigned long hclk, fclk, armclk, armdiv_clk;
47 unsigned long hclk_max;
48
49 fclk = cfg->freq.fclk;
50 armclk = cfg->freq.armclk;
51 hclk_max = cfg->max.hclk;
52
53 /* We can't run hclk above armclk as at the best we have to
54 * have armclk and hclk in dvs mode. */
55
56 if (hclk_max > armclk)
57 hclk_max = armclk;
58
59 s3c_freq_dbg("%s: fclk=%lu, armclk=%lu, hclk_max=%lu\n",
60 __func__, fclk, armclk, hclk_max);
61 s3c_freq_dbg("%s: want f=%lu, arm=%lu, h=%lu, p=%lu\n",
62 __func__, cfg->freq.fclk, cfg->freq.armclk,
63 cfg->freq.hclk, cfg->freq.pclk);
64
65 armdiv = fclk / armclk;
66
67 if (armdiv < 1)
68 armdiv = 1;
69 if (armdiv > 2)
70 armdiv = 2;
71
72 cfg->divs.arm_divisor = armdiv;
73 armdiv_clk = fclk / armdiv;
74
75 hdiv = armdiv_clk / hclk_max;
76 if (hdiv < 1)
77 hdiv = 1;
78
79 cfg->freq.hclk = hclk = armdiv_clk / hdiv;
80
81 /* set dvs depending on whether we reached armclk or not. */
82 cfg->divs.dvs = dvs = armclk < armdiv_clk;
83
84 /* update the actual armclk we achieved. */
85 cfg->freq.armclk = dvs ? hclk : armdiv_clk;
86
87 s3c_freq_dbg("%s: armclk %lu, hclk %lu, armdiv %d, hdiv %d, dvs %d\n",
88 __func__, armclk, hclk, armdiv, hdiv, cfg->divs.dvs);
89
90 if (hdiv > 4)
91 goto invalid;
92
93 pdiv = (hclk > cfg->max.pclk) ? 2 : 1;
94
95 if ((hclk / pdiv) > cfg->max.pclk)
96 pdiv++;
97
98 cfg->freq.pclk = hclk / pdiv;
99
100 s3c_freq_dbg("%s: pdiv %d\n", __func__, pdiv);
101
102 if (pdiv > 2)
103 goto invalid;
104
105 pdiv *= hdiv;
106
107 /* store the result, and then return */
108
109 cfg->divs.h_divisor = hdiv * armdiv;
110 cfg->divs.p_divisor = pdiv * armdiv;
111
112 return 0;
113
114 invalid:
115 return -EINVAL;
116}
117
118static void s3c2412_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
119{
120 unsigned long clkdiv;
121 unsigned long olddiv;
122
123 olddiv = clkdiv = __raw_readl(S3C2410_CLKDIVN);
124
125 /* clear off current clock info */
126
127 clkdiv &= ~S3C2412_CLKDIVN_ARMDIVN;
128 clkdiv &= ~S3C2412_CLKDIVN_HDIVN_MASK;
129 clkdiv &= ~S3C2412_CLKDIVN_PDIVN;
130
131 if (cfg->divs.arm_divisor == 2)
132 clkdiv |= S3C2412_CLKDIVN_ARMDIVN;
133
134 clkdiv |= ((cfg->divs.h_divisor / cfg->divs.arm_divisor) - 1);
135
136 if (cfg->divs.p_divisor != cfg->divs.h_divisor)
137 clkdiv |= S3C2412_CLKDIVN_PDIVN;
138
139 s3c_freq_dbg("%s: div %08lx => %08lx\n", __func__, olddiv, clkdiv);
140 __raw_writel(clkdiv, S3C2410_CLKDIVN);
141
142 clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
143}
144
145static void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
146{
147 struct s3c_cpufreq_board *board = cfg->board;
148 unsigned long refresh;
149
150 s3c_freq_dbg("%s: refresh %u ns, hclk %lu\n", __func__,
151 board->refresh, cfg->freq.hclk);
152
153 /* Reduce both the refresh time (in ns) and the frequency (in MHz)
154 * by 10 each to ensure that we do not overflow 32 bit numbers. This
155 * should work for HCLK up to 133MHz and refresh period up to 30usec.
156 */
157
158 refresh = (board->refresh / 10);
159 refresh *= (cfg->freq.hclk / 100);
160 refresh /= (1 * 1000 * 1000); /* 10^6 */
161
162 s3c_freq_dbg("%s: setting refresh 0x%08lx\n", __func__, refresh);
163 __raw_writel(refresh, S3C2412_REFRESH);
164}
165
166/* set the default cpu frequency information, based on an 200MHz part
167 * as we have no other way of detecting the speed rating in software.
168 */
169
170static struct s3c_cpufreq_info s3c2412_cpufreq_info = {
171 .max = {
172 .fclk = 200000000,
173 .hclk = 100000000,
174 .pclk = 50000000,
175 },
176
177 .latency = 5000000, /* 5ms */
178
179 .locktime_m = 150,
180 .locktime_u = 150,
181 .locktime_bits = 16,
182
183 .name = "s3c2412",
184 .set_refresh = s3c2412_cpufreq_setrefresh,
185 .set_divs = s3c2412_cpufreq_setdivs,
186 .calc_divs = s3c2412_cpufreq_calcdivs,
187
188 .calc_iotiming = s3c2412_iotiming_calc,
189 .set_iotiming = s3c2412_iotiming_set,
190 .get_iotiming = s3c2412_iotiming_get,
191
192 .resume_clocks = s3c2412_setup_clocks,
193
194 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2412_iotiming_debugfs),
195};
196
197static int s3c2412_cpufreq_add(struct sys_device *sysdev)
198{
199 unsigned long fclk_rate;
200
201 hclk = clk_get(NULL, "hclk");
202 if (IS_ERR(hclk)) {
203 printk(KERN_ERR "%s: cannot find hclk clock\n", __func__);
204 return -ENOENT;
205 }
206
207 fclk = clk_get(NULL, "fclk");
208 if (IS_ERR(fclk)) {
209 printk(KERN_ERR "%s: cannot find fclk clock\n", __func__);
210 goto err_fclk;
211 }
212
213 fclk_rate = clk_get_rate(fclk);
214 if (fclk_rate > 200000000) {
215 printk(KERN_INFO
216 "%s: fclk %ld MHz, assuming 266MHz capable part\n",
217 __func__, fclk_rate / 1000000);
218 s3c2412_cpufreq_info.max.fclk = 266000000;
219 s3c2412_cpufreq_info.max.hclk = 133000000;
220 s3c2412_cpufreq_info.max.pclk = 66000000;
221 }
222
223 armclk = clk_get(NULL, "armclk");
224 if (IS_ERR(armclk)) {
225 printk(KERN_ERR "%s: cannot find arm clock\n", __func__);
226 goto err_armclk;
227 }
228
229 xtal = clk_get(NULL, "xtal");
230 if (IS_ERR(xtal)) {
231 printk(KERN_ERR "%s: cannot find xtal clock\n", __func__);
232 goto err_xtal;
233 }
234
235 return s3c_cpufreq_register(&s3c2412_cpufreq_info);
236
237err_xtal:
238 clk_put(armclk);
239err_armclk:
240 clk_put(fclk);
241err_fclk:
242 clk_put(hclk);
243
244 return -ENOENT;
245}
246
247static struct sysdev_driver s3c2412_cpufreq_driver = {
248 .add = s3c2412_cpufreq_add,
249};
250
251static int s3c2412_cpufreq_init(void)
252{
253 return sysdev_driver_register(&s3c2412_sysclass,
254 &s3c2412_cpufreq_driver);
255}
256
257arch_initcall(s3c2412_cpufreq_init);
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index 5b5aba69ec3f..bef39f77729d 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -69,6 +69,18 @@ static struct map_desc s3c2412_iodesc[] __initdata = {
69 IODESC_ENT(CLKPWR), 69 IODESC_ENT(CLKPWR),
70 IODESC_ENT(TIMER), 70 IODESC_ENT(TIMER),
71 IODESC_ENT(WATCHDOG), 71 IODESC_ENT(WATCHDOG),
72 {
73 .virtual = (unsigned long)S3C2412_VA_SSMC,
74 .pfn = __phys_to_pfn(S3C2412_PA_SSMC),
75 .length = SZ_1M,
76 .type = MT_DEVICE,
77 },
78 {
79 .virtual = (unsigned long)S3C2412_VA_EBI,
80 .pfn = __phys_to_pfn(S3C2412_PA_EBI),
81 .length = SZ_1M,
82 .type = MT_DEVICE,
83 },
72}; 84};
73 85
74/* uart registration process */ 86/* uart registration process */
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index 8cfeaec37306..8ae1b288f7fa 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -33,6 +33,7 @@ config MACH_ANUBIS
33 select PM_SIMTEC if PM 33 select PM_SIMTEC if PM
34 select HAVE_PATA_PLATFORM 34 select HAVE_PATA_PLATFORM
35 select S3C24XX_GPIO_EXTRA64 35 select S3C24XX_GPIO_EXTRA64
36 select S3C2440_XTAL_12000000
36 select S3C_DEV_USB_HOST 37 select S3C_DEV_USB_HOST
37 help 38 help
38 Say Y here if you are using the Simtec Electronics ANUBIS 39 Say Y here if you are using the Simtec Electronics ANUBIS
@@ -44,6 +45,8 @@ config MACH_OSIRIS
44 select S3C24XX_DCLK 45 select S3C24XX_DCLK
45 select PM_SIMTEC if PM 46 select PM_SIMTEC if PM
46 select S3C24XX_GPIO_EXTRA128 47 select S3C24XX_GPIO_EXTRA128
48 select S3C2440_XTAL_12000000
49 select S3C2410_IOTIMING if S3C2440_CPUFREQ
47 select S3C_DEV_USB_HOST 50 select S3C_DEV_USB_HOST
48 help 51 help
49 Say Y here if you are using the Simtec IM2440D20 module, also 52 Say Y here if you are using the Simtec IM2440D20 module, also
@@ -52,6 +55,7 @@ config MACH_OSIRIS
52config MACH_RX3715 55config MACH_RX3715
53 bool "HP iPAQ rx3715" 56 bool "HP iPAQ rx3715"
54 select CPU_S3C2440 57 select CPU_S3C2440
58 select S3C2440_XTAL_16934400
55 select PM_H1940 if PM 59 select PM_H1940 if PM
56 help 60 help
57 Say Y here if you are using the HP iPAQ rx3715. 61 Say Y here if you are using the HP iPAQ rx3715.
@@ -59,6 +63,7 @@ config MACH_RX3715
59config ARCH_S3C2440 63config ARCH_S3C2440
60 bool "SMDK2440" 64 bool "SMDK2440"
61 select CPU_S3C2440 65 select CPU_S3C2440
66 select S3C2440_XTAL_16934400
62 select MACH_SMDK 67 select MACH_SMDK
63 select S3C_DEV_USB_HOST 68 select S3C_DEV_USB_HOST
64 help 69 help
@@ -67,6 +72,7 @@ config ARCH_S3C2440
67config MACH_NEXCODER_2440 72config MACH_NEXCODER_2440
68 bool "NexVision NEXCODER 2440 Light Board" 73 bool "NexVision NEXCODER 2440 Light Board"
69 select CPU_S3C2440 74 select CPU_S3C2440
75 select S3C2440_XTAL_12000000
70 select S3C_DEV_USB_HOST 76 select S3C_DEV_USB_HOST
71 help 77 help
72 Say Y here if you are using the Nex Vision NEXCODER 2440 Light Board 78 Say Y here if you are using the Nex Vision NEXCODER 2440 Light Board
@@ -75,6 +81,7 @@ config SMDK2440_CPU2440
75 bool "SMDK2440 with S3C2440 CPU module" 81 bool "SMDK2440 with S3C2440 CPU module"
76 depends on ARCH_S3C2440 82 depends on ARCH_S3C2440
77 default y if ARCH_S3C2440 83 default y if ARCH_S3C2440
84 select S3C2440_XTAL_16934400
78 select CPU_S3C2440 85 select CPU_S3C2440
79 86
80config MACH_AT2440EVB 87config MACH_AT2440EVB
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index cba064b49a64..2105a41281a4 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -34,6 +34,7 @@
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36 36
37#include <plat/cpu-freq.h>
37#include <plat/regs-serial.h> 38#include <plat/regs-serial.h>
38#include <mach/regs-gpio.h> 39#include <mach/regs-gpio.h>
39#include <mach/regs-mem.h> 40#include <mach/regs-mem.h>
@@ -351,6 +352,12 @@ static struct clk *osiris_clocks[] __initdata = {
351 &s3c24xx_uclk, 352 &s3c24xx_uclk,
352}; 353};
353 354
355static struct s3c_cpufreq_board __initdata osiris_cpufreq = {
356 .refresh = 7800, /* refresh period is 7.8usec */
357 .auto_io = 1,
358 .need_io = 1,
359};
360
354static void __init osiris_map_io(void) 361static void __init osiris_map_io(void)
355{ 362{
356 unsigned long flags; 363 unsigned long flags;
@@ -402,6 +409,8 @@ static void __init osiris_init(void)
402 409
403 s3c_i2c0_set_platdata(NULL); 410 s3c_i2c0_set_platdata(NULL);
404 411
412 s3c_cpufreq_setboard(&osiris_cpufreq);
413
405 i2c_register_board_info(0, osiris_i2c_devs, 414 i2c_register_board_info(0, osiris_i2c_devs,
406 ARRAY_SIZE(osiris_i2c_devs)); 415 ARRAY_SIZE(osiris_i2c_devs));
407 416
diff --git a/arch/arm/mach-s3c24a0/include/mach/map.h b/arch/arm/mach-s3c24a0/include/mach/map.h
index a01132717e34..79e4d93ea2b6 100644
--- a/arch/arm/mach-s3c24a0/include/mach/map.h
+++ b/arch/arm/mach-s3c24a0/include/mach/map.h
@@ -81,5 +81,6 @@
81 81
82#define S3C_PA_UART S3C24A0_PA_UART 82#define S3C_PA_UART S3C24A0_PA_UART
83#define S3C_PA_IIC S3C24A0_PA_IIC 83#define S3C_PA_IIC S3C24A0_PA_IIC
84#define S3C_PA_NAND S3C24XX_PA_NAND
84 85
85#endif /* __ASM_ARCH_24A0_MAP_H */ 86#endif /* __ASM_ARCH_24A0_MAP_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/map.h b/arch/arm/mach-s3c6400/include/mach/map.h
index 5057d9948d35..fc8b223bad4f 100644
--- a/arch/arm/mach-s3c6400/include/mach/map.h
+++ b/arch/arm/mach-s3c6400/include/mach/map.h
@@ -38,18 +38,21 @@
38#define S3C_VA_UART2 S3C_VA_UARTx(2) 38#define S3C_VA_UART2 S3C_VA_UARTx(2)
39#define S3C_VA_UART3 S3C_VA_UARTx(3) 39#define S3C_VA_UART3 S3C_VA_UARTx(3)
40 40
41#define S3C64XX_PA_NAND (0x70200000)
41#define S3C64XX_PA_FB (0x77100000) 42#define S3C64XX_PA_FB (0x77100000)
42#define S3C64XX_PA_USB_HSOTG (0x7C000000) 43#define S3C64XX_PA_USB_HSOTG (0x7C000000)
43#define S3C64XX_PA_WATCHDOG (0x7E004000) 44#define S3C64XX_PA_WATCHDOG (0x7E004000)
44#define S3C64XX_PA_SYSCON (0x7E00F000) 45#define S3C64XX_PA_SYSCON (0x7E00F000)
46#define S3C64XX_PA_AC97 (0x7F001000)
45#define S3C64XX_PA_IIS0 (0x7F002000) 47#define S3C64XX_PA_IIS0 (0x7F002000)
46#define S3C64XX_PA_IIS1 (0x7F003000) 48#define S3C64XX_PA_IIS1 (0x7F003000)
47#define S3C64XX_PA_TIMER (0x7F006000) 49#define S3C64XX_PA_TIMER (0x7F006000)
48#define S3C64XX_PA_IIC0 (0x7F004000) 50#define S3C64XX_PA_IIC0 (0x7F004000)
51#define S3C64XX_PA_IISV4 (0x7F00D000)
49#define S3C64XX_PA_IIC1 (0x7F00F000) 52#define S3C64XX_PA_IIC1 (0x7F00F000)
50 53
51#define S3C64XX_PA_GPIO (0x7F008000) 54#define S3C64XX_PA_GPIO (0x7F008000)
52#define S3C64XX_VA_GPIO S3C_ADDR(0x00500000) 55#define S3C64XX_VA_GPIO S3C_ADDR_CPU(0x00000000)
53#define S3C64XX_SZ_GPIO SZ_4K 56#define S3C64XX_SZ_GPIO SZ_4K
54 57
55#define S3C64XX_PA_SDRAM (0x50000000) 58#define S3C64XX_PA_SDRAM (0x50000000)
@@ -57,7 +60,7 @@
57#define S3C64XX_PA_VIC1 (0x71300000) 60#define S3C64XX_PA_VIC1 (0x71300000)
58 61
59#define S3C64XX_PA_MODEM (0x74108000) 62#define S3C64XX_PA_MODEM (0x74108000)
60#define S3C64XX_VA_MODEM S3C_ADDR(0x00600000) 63#define S3C64XX_VA_MODEM S3C_ADDR_CPU(0x00100000)
61 64
62#define S3C64XX_PA_USBHOST (0x74300000) 65#define S3C64XX_PA_USBHOST (0x74300000)
63 66
@@ -72,6 +75,7 @@
72#define S3C_PA_HSMMC2 S3C64XX_PA_HSMMC2 75#define S3C_PA_HSMMC2 S3C64XX_PA_HSMMC2
73#define S3C_PA_IIC S3C64XX_PA_IIC0 76#define S3C_PA_IIC S3C64XX_PA_IIC0
74#define S3C_PA_IIC1 S3C64XX_PA_IIC1 77#define S3C_PA_IIC1 S3C64XX_PA_IIC1
78#define S3C_PA_NAND S3C64XX_PA_NAND
75#define S3C_PA_FB S3C64XX_PA_FB 79#define S3C_PA_FB S3C64XX_PA_FB
76#define S3C_PA_USBHOST S3C64XX_PA_USBHOST 80#define S3C_PA_USBHOST S3C64XX_PA_USBHOST
77#define S3C_PA_USB_HSOTG S3C64XX_PA_USB_HSOTG 81#define S3C_PA_USB_HSOTG S3C64XX_PA_USB_HSOTG
diff --git a/arch/arm/mach-s3c6400/s3c6400.c b/arch/arm/mach-s3c6400/s3c6400.c
index 1ece887d90bb..b42bdd0f2138 100644
--- a/arch/arm/mach-s3c6400/s3c6400.c
+++ b/arch/arm/mach-s3c6400/s3c6400.c
@@ -48,6 +48,8 @@ void __init s3c6400_map_io(void)
48 48
49 /* the i2c devices are directly compatible with s3c2440 */ 49 /* the i2c devices are directly compatible with s3c2440 */
50 s3c_i2c0_setname("s3c2440-i2c"); 50 s3c_i2c0_setname("s3c2440-i2c");
51
52 s3c_device_nand.name = "s3c6400-nand";
51} 53}
52 54
53void __init s3c6400_init_clocks(int xtal) 55void __init s3c6400_init_clocks(int xtal)
diff --git a/arch/arm/mach-s3c6410/Kconfig b/arch/arm/mach-s3c6410/Kconfig
index e63aac7f4e5a..f9d0f09f9761 100644
--- a/arch/arm/mach-s3c6410/Kconfig
+++ b/arch/arm/mach-s3c6410/Kconfig
@@ -97,3 +97,13 @@ config MACH_NCP
97 select S3C64XX_SETUP_I2C1 97 select S3C64XX_SETUP_I2C1
98 help 98 help
99 Machine support for the Samsung NCP 99 Machine support for the Samsung NCP
100
101config MACH_HMT
102 bool "Airgoo HMT"
103 select CPU_S3C6410
104 select S3C_DEV_FB
105 select S3C_DEV_USB_HOST
106 select S3C64XX_SETUP_FB_24BPP
107 select HAVE_PWM
108 help
109 Machine support for the Airgoo HMT
diff --git a/arch/arm/mach-s3c6410/Makefile b/arch/arm/mach-s3c6410/Makefile
index 6f9deac88612..3e48c3dbf973 100644
--- a/arch/arm/mach-s3c6410/Makefile
+++ b/arch/arm/mach-s3c6410/Makefile
@@ -23,5 +23,4 @@ obj-$(CONFIG_S3C6410_SETUP_SDHCI) += setup-sdhci.o
23obj-$(CONFIG_MACH_ANW6410) += mach-anw6410.o 23obj-$(CONFIG_MACH_ANW6410) += mach-anw6410.o
24obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o 24obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o
25obj-$(CONFIG_MACH_NCP) += mach-ncp.o 25obj-$(CONFIG_MACH_NCP) += mach-ncp.o
26 26obj-$(CONFIG_MACH_HMT) += mach-hmt.o
27
diff --git a/arch/arm/mach-s3c6410/cpu.c b/arch/arm/mach-s3c6410/cpu.c
index ade904de8895..9b67c663d9d8 100644
--- a/arch/arm/mach-s3c6410/cpu.c
+++ b/arch/arm/mach-s3c6410/cpu.c
@@ -62,6 +62,8 @@ void __init s3c6410_map_io(void)
62 /* the i2c devices are directly compatible with s3c2440 */ 62 /* the i2c devices are directly compatible with s3c2440 */
63 s3c_i2c0_setname("s3c2440-i2c"); 63 s3c_i2c0_setname("s3c2440-i2c");
64 s3c_i2c1_setname("s3c2440-i2c"); 64 s3c_i2c1_setname("s3c2440-i2c");
65
66 s3c_device_nand.name = "s3c6400-nand";
65} 67}
66 68
67void __init s3c6410_init_clocks(int xtal) 69void __init s3c6410_init_clocks(int xtal)
diff --git a/arch/arm/mach-s3c6410/mach-hmt.c b/arch/arm/mach-s3c6410/mach-hmt.c
new file mode 100644
index 000000000000..c5741056193f
--- /dev/null
+++ b/arch/arm/mach-s3c6410/mach-hmt.c
@@ -0,0 +1,276 @@
1/* mach-hmt.c - Platform code for Airgoo HMT
2 *
3 * Copyright 2009 Peter Korsgaard <jacmet@sunsite.dk>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9*/
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/serial_core.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/i2c.h>
17#include <linux/fb.h>
18#include <linux/gpio.h>
19#include <linux/delay.h>
20#include <linux/leds.h>
21#include <linux/pwm_backlight.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
29#include <mach/hardware.h>
30#include <mach/regs-fb.h>
31#include <mach/map.h>
32
33#include <asm/irq.h>
34#include <asm/mach-types.h>
35
36#include <plat/regs-serial.h>
37#include <plat/iic.h>
38#include <plat/fb.h>
39#include <plat/nand.h>
40
41#include <plat/s3c6410.h>
42#include <plat/clock.h>
43#include <plat/devs.h>
44#include <plat/cpu.h>
45
46#define UCON S3C2410_UCON_DEFAULT
47#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
48#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
49
50static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
51 [0] = {
52 .hwport = 0,
53 .flags = 0,
54 .ucon = UCON,
55 .ulcon = ULCON,
56 .ufcon = UFCON,
57 },
58 [1] = {
59 .hwport = 1,
60 .flags = 0,
61 .ucon = UCON,
62 .ulcon = ULCON,
63 .ufcon = UFCON,
64 },
65 [2] = {
66 .hwport = 2,
67 .flags = 0,
68 .ucon = UCON,
69 .ulcon = ULCON,
70 .ufcon = UFCON,
71 },
72};
73
74static int hmt_bl_init(struct device *dev)
75{
76 int ret;
77
78 ret = gpio_request(S3C64XX_GPB(4), "lcd backlight enable");
79 if (!ret)
80 ret = gpio_direction_output(S3C64XX_GPB(4), 0);
81
82 return ret;
83}
84
85static int hmt_bl_notify(int brightness)
86{
87 /*
88 * translate from CIELUV/CIELAB L*->brightness, E.G. from
89 * perceived luminance to light output. Assumes range 0..25600
90 */
91 if (brightness < 0x800) {
92 /* Y = Yn * L / 903.3 */
93 brightness = (100*256 * brightness + 231245/2) / 231245;
94 } else {
95 /* Y = Yn * ((L + 16) / 116 )^3 */
96 int t = (brightness*4 + 16*1024 + 58)/116;
97 brightness = 25 * ((t * t * t + 0x100000/2) / 0x100000);
98 }
99
100 gpio_set_value(S3C64XX_GPB(4), brightness);
101
102 return brightness;
103}
104
105static void hmt_bl_exit(struct device *dev)
106{
107 gpio_free(S3C64XX_GPB(4));
108}
109
110static struct platform_pwm_backlight_data hmt_backlight_data = {
111 .pwm_id = 1,
112 .max_brightness = 100 * 256,
113 .dft_brightness = 40 * 256,
114 .pwm_period_ns = 1000000000 / (100 * 256 * 20),
115 .init = hmt_bl_init,
116 .notify = hmt_bl_notify,
117 .exit = hmt_bl_exit,
118
119};
120
121static struct platform_device hmt_backlight_device = {
122 .name = "pwm-backlight",
123 .dev = {
124 .parent = &s3c_device_timer[1].dev,
125 .platform_data = &hmt_backlight_data,
126 },
127};
128
129static struct s3c_fb_pd_win hmt_fb_win0 = {
130 .win_mode = {
131 .pixclock = 41094,
132 .left_margin = 8,
133 .right_margin = 13,
134 .upper_margin = 7,
135 .lower_margin = 5,
136 .hsync_len = 3,
137 .vsync_len = 1,
138 .xres = 800,
139 .yres = 480,
140 },
141 .max_bpp = 32,
142 .default_bpp = 16,
143};
144
145/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
146static struct s3c_fb_platdata hmt_lcd_pdata __initdata = {
147 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
148 .win[0] = &hmt_fb_win0,
149 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
150 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
151};
152
153static struct mtd_partition hmt_nand_part[] = {
154 [0] = {
155 .name = "uboot",
156 .size = SZ_512K,
157 .offset = 0,
158 },
159 [1] = {
160 .name = "uboot-env1",
161 .size = SZ_256K,
162 .offset = SZ_512K,
163 },
164 [2] = {
165 .name = "uboot-env2",
166 .size = SZ_256K,
167 .offset = SZ_512K + SZ_256K,
168 },
169 [3] = {
170 .name = "kernel",
171 .size = SZ_2M,
172 .offset = SZ_1M,
173 },
174 [4] = {
175 .name = "rootfs",
176 .size = MTDPART_SIZ_FULL,
177 .offset = SZ_1M + SZ_2M,
178 },
179};
180
181static struct s3c2410_nand_set hmt_nand_sets[] = {
182 [0] = {
183 .name = "nand",
184 .nr_chips = 1,
185 .nr_partitions = ARRAY_SIZE(hmt_nand_part),
186 .partitions = hmt_nand_part,
187 },
188};
189
190static struct s3c2410_platform_nand hmt_nand_info = {
191 .tacls = 25,
192 .twrph0 = 55,
193 .twrph1 = 40,
194 .nr_sets = ARRAY_SIZE(hmt_nand_sets),
195 .sets = hmt_nand_sets,
196};
197
198static struct gpio_led hmt_leds[] = {
199 { /* left function keys */
200 .name = "left:blue",
201 .gpio = S3C64XX_GPO(12),
202 .default_trigger = "default-on",
203 },
204 { /* right function keys - red */
205 .name = "right:red",
206 .gpio = S3C64XX_GPO(13),
207 },
208 { /* right function keys - green */
209 .name = "right:green",
210 .gpio = S3C64XX_GPO(14),
211 },
212 { /* right function keys - blue */
213 .name = "right:blue",
214 .gpio = S3C64XX_GPO(15),
215 .default_trigger = "default-on",
216 },
217};
218
219static struct gpio_led_platform_data hmt_led_data = {
220 .num_leds = ARRAY_SIZE(hmt_leds),
221 .leds = hmt_leds,
222};
223
224static struct platform_device hmt_leds_device = {
225 .name = "leds-gpio",
226 .id = -1,
227 .dev.platform_data = &hmt_led_data,
228};
229
230static struct map_desc hmt_iodesc[] = {};
231
232static struct platform_device *hmt_devices[] __initdata = {
233 &s3c_device_i2c0,
234 &s3c_device_nand,
235 &s3c_device_fb,
236 &s3c_device_usb,
237 &s3c_device_timer[1],
238 &hmt_backlight_device,
239 &hmt_leds_device,
240};
241
242static void __init hmt_map_io(void)
243{
244 s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
245 s3c24xx_init_clocks(12000000);
246 s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
247}
248
249static void __init hmt_machine_init(void)
250{
251 s3c_i2c0_set_platdata(NULL);
252 s3c_fb_set_platdata(&hmt_lcd_pdata);
253 s3c_device_nand.dev.platform_data = &hmt_nand_info;
254
255 gpio_request(S3C64XX_GPC(7), "usb power");
256 gpio_direction_output(S3C64XX_GPC(7), 0);
257 gpio_request(S3C64XX_GPM(0), "usb power");
258 gpio_direction_output(S3C64XX_GPM(0), 1);
259 gpio_request(S3C64XX_GPK(7), "usb power");
260 gpio_direction_output(S3C64XX_GPK(7), 1);
261 gpio_request(S3C64XX_GPF(13), "usb power");
262 gpio_direction_output(S3C64XX_GPF(13), 1);
263
264 platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
265}
266
267MACHINE_START(HMT, "Airgoo-HMT")
268 /* Maintainer: Peter Korsgaard <jacmet@sunsite.dk> */
269 .phys_io = S3C_PA_UART & 0xfff00000,
270 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
271 .boot_params = S3C64XX_PA_SDRAM + 0x100,
272 .init_irq = s3c6410_init_irq,
273 .map_io = hmt_map_io,
274 .init_machine = hmt_machine_init,
275 .timer = &s3c24xx_timer,
276MACHINE_END
diff --git a/arch/arm/mach-s3c6410/mach-ncp.c b/arch/arm/mach-s3c6410/mach-ncp.c
index 6030636f8548..55e9bbfaf68b 100644
--- a/arch/arm/mach-s3c6410/mach-ncp.c
+++ b/arch/arm/mach-s3c6410/mach-ncp.c
@@ -79,7 +79,7 @@ static struct platform_device *ncp_devices[] __initdata = {
79 &s3c_device_i2c0, 79 &s3c_device_i2c0,
80}; 80};
81 81
82struct map_desc ncp_iodesc[] = {}; 82static struct map_desc ncp_iodesc[] __initdata = {};
83 83
84static void __init ncp_map_io(void) 84static void __init ncp_map_io(void)
85{ 85{
diff --git a/arch/arm/mach-s3c6410/mach-smdk6410.c b/arch/arm/mach-s3c6410/mach-smdk6410.c
index bc9a7dea567f..ea51dbe76e3e 100644
--- a/arch/arm/mach-s3c6410/mach-smdk6410.c
+++ b/arch/arm/mach-s3c6410/mach-smdk6410.c
@@ -65,16 +65,30 @@ static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
65 [0] = { 65 [0] = {
66 .hwport = 0, 66 .hwport = 0,
67 .flags = 0, 67 .flags = 0,
68 .ucon = 0x3c5, 68 .ucon = UCON,
69 .ulcon = 0x03, 69 .ulcon = ULCON,
70 .ufcon = 0x51, 70 .ufcon = UFCON,
71 }, 71 },
72 [1] = { 72 [1] = {
73 .hwport = 1, 73 .hwport = 1,
74 .flags = 0, 74 .flags = 0,
75 .ucon = 0x3c5, 75 .ucon = UCON,
76 .ulcon = 0x03, 76 .ulcon = ULCON,
77 .ufcon = 0x51, 77 .ufcon = UFCON,
78 },
79 [2] = {
80 .hwport = 2,
81 .flags = 0,
82 .ucon = UCON,
83 .ulcon = ULCON,
84 .ufcon = UFCON,
85 },
86 [3] = {
87 .hwport = 3,
88 .flags = 0,
89 .ucon = UCON,
90 .ulcon = ULCON,
91 .ufcon = UFCON,
78 }, 92 },
79}; 93};
80 94
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
new file mode 100644
index 000000000000..b1a4ba504416
--- /dev/null
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -0,0 +1,22 @@
1# arch/arm/mach-s5pc100/Kconfig
2#
3# Copyright 2009 Samsung Electronics Co.
4# Byungho Min <bhmin@samsung.com>
5#
6# Licensed under GPLv2
7
8# Configuration options for the S5PC100 CPU
9
10config CPU_S5PC100
11 bool
12 select CPU_S5PC100_INIT
13 select CPU_S5PC100_CLOCK
14 help
15 Enable S5PC100 CPU support
16
17config MACH_SMDKC100
18 bool "SMDKC100"
19 select CPU_S5PC100
20 select S5PC1XX_SETUP_I2C1
21 help
22 Machine support for the Samsung SMDKC100
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
new file mode 100644
index 000000000000..afc89b381d7a
--- /dev/null
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -0,0 +1,17 @@
1# arch/arm/mach-s5pc100/Makefile
2#
3# Copyright 2009 Samsung Electronics Co.
4#
5# Licensed under GPLv2
6
7obj-y :=
8obj-m :=
9obj-n :=
10obj- :=
11
12# Core support for S5PC100 system
13
14obj-$(CONFIG_CPU_S5PC100) += cpu.o
15
16# machine support
17obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o
diff --git a/arch/arm/mach-s5pc100/Makefile.boot b/arch/arm/mach-s5pc100/Makefile.boot
new file mode 100644
index 000000000000..ff90aa13bd67
--- /dev/null
+++ b/arch/arm/mach-s5pc100/Makefile.boot
@@ -0,0 +1,2 @@
1 zreladdr-y := 0x20008000
2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5pc100/cpu.c b/arch/arm/mach-s5pc100/cpu.c
new file mode 100644
index 000000000000..0e718890da32
--- /dev/null
+++ b/arch/arm/mach-s5pc100/cpu.c
@@ -0,0 +1,97 @@
1/* linux/arch/arm/mach-s5pc100/cpu.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Based on mach-s3c6410/cpu.c
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/list.h>
17#include <linux/timer.h>
18#include <linux/init.h>
19#include <linux/clk.h>
20#include <linux/io.h>
21#include <linux/sysdev.h>
22#include <linux/serial_core.h>
23#include <linux/platform_device.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
29#include <mach/hardware.h>
30#include <mach/map.h>
31#include <asm/irq.h>
32
33#include <plat/cpu-freq.h>
34#include <plat/regs-serial.h>
35
36#include <plat/cpu.h>
37#include <plat/devs.h>
38#include <plat/clock.h>
39#include <plat/sdhci.h>
40#include <plat/iic-core.h>
41#include <plat/s5pc100.h>
42
43/* Initial IO mappings */
44
45static struct map_desc s5pc100_iodesc[] __initdata = {
46};
47
48/* s5pc100_map_io
49 *
50 * register the standard cpu IO areas
51*/
52
53void __init s5pc100_map_io(void)
54{
55 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc));
56
57 /* initialise device information early */
58}
59
60void __init s5pc100_init_clocks(int xtal)
61{
62 printk(KERN_DEBUG "%s: initialising clocks\n", __func__);
63 s3c24xx_register_baseclocks(xtal);
64 s5pc1xx_register_clocks();
65 s5pc100_register_clocks();
66 s5pc100_setup_clocks();
67}
68
69void __init s5pc100_init_irq(void)
70{
71 u32 vic_valid[] = {~0, ~0, ~0};
72
73 /* VIC0, VIC1, and VIC2 are fully populated. */
74 s5pc1xx_init_irq(vic_valid, ARRAY_SIZE(vic_valid));
75}
76
77struct sysdev_class s5pc100_sysclass = {
78 .name = "s5pc100-core",
79};
80
81static struct sys_device s5pc100_sysdev = {
82 .cls = &s5pc100_sysclass,
83};
84
85static int __init s5pc100_core_init(void)
86{
87 return sysdev_class_register(&s5pc100_sysclass);
88}
89
90core_initcall(s5pc100_core_init);
91
92int __init s5pc100_init(void)
93{
94 printk(KERN_DEBUG "S5PC100: Initialising architecture\n");
95
96 return sysdev_register(&s5pc100_sysdev);
97}
diff --git a/arch/arm/mach-s5pc100/include/mach/debug-macro.S b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
new file mode 100644
index 000000000000..9d142ccf654b
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
@@ -0,0 +1,38 @@
1/* arch/arm/mach-s5pc100/include/mach/debug-macro.S
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 *
7 * Based on mach-s3c6400/include/mach/debug-macro.S
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/* pull in the relevant register and map files. */
15
16#include <mach/map.h>
17#include <plat/regs-serial.h>
18
19 /* note, for the boot process to work we have to keep the UART
20 * virtual address aligned to an 1MiB boundary for the L1
21 * mapping the head code makes. We keep the UART virtual address
22 * aligned and add in the offset when we load the value here.
23 */
24
25 .macro addruart, rx
26 mrc p15, 0, \rx, c1, c0
27 tst \rx, #1
28 ldreq \rx, = S3C_PA_UART
29 ldrne \rx, = (S3C_VA_UART + S3C_PA_UART & 0xfffff)
30 add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART)
31 .endm
32
33/* include the reset of the code which will do the work, we're only
34 * compiling for a single cpu processor type so the default of s3c2440
35 * will be fine with us.
36 */
37
38#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-s5pc100/include/mach/entry-macro.S b/arch/arm/mach-s5pc100/include/mach/entry-macro.S
new file mode 100644
index 000000000000..67131939e626
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/entry-macro.S
@@ -0,0 +1,50 @@
1/* arch/arm/mach-s5pc100/include/mach/entry-macro.S
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Based on mach-s3c6400/include/mach/entry-macro.S
7 *
8 * Low-level IRQ helper macros for the Samsung S5PC1XX series
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13*/
14
15#include <asm/hardware/vic.h>
16#include <mach/map.h>
17#include <plat/irqs.h>
18
19 .macro disable_fiq
20 .endm
21
22 .macro get_irqnr_preamble, base, tmp
23 ldr \base, =S3C_VA_VIC0
24 .endm
25
26 .macro arch_ret_to_user, tmp1, tmp2
27 .endm
28
29 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30
31 @ check the vic0
32 mov \irqnr, # S3C_IRQ_OFFSET + 31
33 ldr \irqstat, [ \base, # VIC_IRQ_STATUS ]
34 teq \irqstat, #0
35
36 @ otherwise try vic1
37 addeq \tmp, \base, #(S3C_VA_VIC1 - S3C_VA_VIC0)
38 addeq \irqnr, \irqnr, #32
39 ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
40 teqeq \irqstat, #0
41
42 @ otherwise try vic2
43 addeq \tmp, \base, #(S3C_VA_VIC2 - S3C_VA_VIC0)
44 addeq \irqnr, \irqnr, #32
45 ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
46 teqeq \irqstat, #0
47
48 clzne \irqstat, \irqstat
49 subne \irqnr, \irqnr, \irqstat
50 .endm
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio-core.h b/arch/arm/mach-s5pc100/include/mach/gpio-core.h
new file mode 100644
index 000000000000..ad28d8ec8a78
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/gpio-core.h
@@ -0,0 +1,21 @@
1/* arch/arm/mach-s5pc100/include/mach/gpio-core.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - GPIO core support
7 *
8 * Based on mach-s3c6400/include/mach/gpio-core.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_GPIO_CORE_H
16#define __ASM_ARCH_GPIO_CORE_H __FILE__
17
18/* currently we just include the platform support */
19#include <plat/gpio-core.h>
20
21#endif /* __ASM_ARCH_GPIO_CORE_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio.h b/arch/arm/mach-s5pc100/include/mach/gpio.h
new file mode 100644
index 000000000000..c74fc93d7d15
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/gpio.h
@@ -0,0 +1,146 @@
1/* arch/arm/mach-s5pc100/include/mach/gpio.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - GPIO lib support
7 *
8 * Base on mach-s3c6400/include/mach/gpio.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#define gpio_get_value __gpio_get_value
16#define gpio_set_value __gpio_set_value
17#define gpio_cansleep __gpio_cansleep
18#define gpio_to_irq __gpio_to_irq
19
20/* GPIO bank sizes */
21#define S5PC1XX_GPIO_A0_NR (8)
22#define S5PC1XX_GPIO_A1_NR (5)
23#define S5PC1XX_GPIO_B_NR (8)
24#define S5PC1XX_GPIO_C_NR (5)
25#define S5PC1XX_GPIO_D_NR (7)
26#define S5PC1XX_GPIO_E0_NR (8)
27#define S5PC1XX_GPIO_E1_NR (6)
28#define S5PC1XX_GPIO_F0_NR (8)
29#define S5PC1XX_GPIO_F1_NR (8)
30#define S5PC1XX_GPIO_F2_NR (8)
31#define S5PC1XX_GPIO_F3_NR (4)
32#define S5PC1XX_GPIO_G0_NR (8)
33#define S5PC1XX_GPIO_G1_NR (3)
34#define S5PC1XX_GPIO_G2_NR (7)
35#define S5PC1XX_GPIO_G3_NR (7)
36#define S5PC1XX_GPIO_H0_NR (8)
37#define S5PC1XX_GPIO_H1_NR (8)
38#define S5PC1XX_GPIO_H2_NR (8)
39#define S5PC1XX_GPIO_H3_NR (8)
40#define S5PC1XX_GPIO_I_NR (8)
41#define S5PC1XX_GPIO_J0_NR (8)
42#define S5PC1XX_GPIO_J1_NR (5)
43#define S5PC1XX_GPIO_J2_NR (8)
44#define S5PC1XX_GPIO_J3_NR (8)
45#define S5PC1XX_GPIO_J4_NR (4)
46#define S5PC1XX_GPIO_K0_NR (8)
47#define S5PC1XX_GPIO_K1_NR (6)
48#define S5PC1XX_GPIO_K2_NR (8)
49#define S5PC1XX_GPIO_K3_NR (8)
50#define S5PC1XX_GPIO_MP00_NR (8)
51#define S5PC1XX_GPIO_MP01_NR (8)
52#define S5PC1XX_GPIO_MP02_NR (8)
53#define S5PC1XX_GPIO_MP03_NR (8)
54#define S5PC1XX_GPIO_MP04_NR (5)
55
56/* GPIO bank numbes */
57
58/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
59 * space for debugging purposes so that any accidental
60 * change from one gpio bank to another can be caught.
61*/
62
63#define S5PC1XX_GPIO_NEXT(__gpio) \
64 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
65
66enum s3c_gpio_number {
67 S5PC1XX_GPIO_A0_START = 0,
68 S5PC1XX_GPIO_A1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_A0),
69 S5PC1XX_GPIO_B_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_A1),
70 S5PC1XX_GPIO_C_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_B),
71 S5PC1XX_GPIO_D_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_C),
72 S5PC1XX_GPIO_E0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_D),
73 S5PC1XX_GPIO_E1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_E0),
74 S5PC1XX_GPIO_F0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_E1),
75 S5PC1XX_GPIO_F1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_F0),
76 S5PC1XX_GPIO_F2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_F1),
77 S5PC1XX_GPIO_F3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_F2),
78 S5PC1XX_GPIO_G0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_F3),
79 S5PC1XX_GPIO_G1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_G0),
80 S5PC1XX_GPIO_G2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_G1),
81 S5PC1XX_GPIO_G3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_G2),
82 S5PC1XX_GPIO_H0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_G3),
83 S5PC1XX_GPIO_H1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_H0),
84 S5PC1XX_GPIO_H2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_H1),
85 S5PC1XX_GPIO_H3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_H2),
86 S5PC1XX_GPIO_I_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_H3),
87 S5PC1XX_GPIO_J0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_I),
88 S5PC1XX_GPIO_J1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J0),
89 S5PC1XX_GPIO_J2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J1),
90 S5PC1XX_GPIO_J3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J2),
91 S5PC1XX_GPIO_J4_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J3),
92 S5PC1XX_GPIO_K0_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_J4),
93 S5PC1XX_GPIO_K1_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_K0),
94 S5PC1XX_GPIO_K2_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_K1),
95 S5PC1XX_GPIO_K3_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_K2),
96 S5PC1XX_GPIO_MP00_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_K3),
97 S5PC1XX_GPIO_MP01_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_MP00),
98 S5PC1XX_GPIO_MP02_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_MP01),
99 S5PC1XX_GPIO_MP03_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_MP02),
100 S5PC1XX_GPIO_MP04_START = S5PC1XX_GPIO_NEXT(S5PC1XX_GPIO_MP03),
101};
102
103/* S5PC1XX GPIO number definitions. */
104#define S5PC1XX_GPA0(_nr) (S5PC1XX_GPIO_A0_START + (_nr))
105#define S5PC1XX_GPA1(_nr) (S5PC1XX_GPIO_A1_START + (_nr))
106#define S5PC1XX_GPB(_nr) (S5PC1XX_GPIO_B_START + (_nr))
107#define S5PC1XX_GPC(_nr) (S5PC1XX_GPIO_C_START + (_nr))
108#define S5PC1XX_GPD(_nr) (S5PC1XX_GPIO_D_START + (_nr))
109#define S5PC1XX_GPE0(_nr) (S5PC1XX_GPIO_E0_START + (_nr))
110#define S5PC1XX_GPE1(_nr) (S5PC1XX_GPIO_E1_START + (_nr))
111#define S5PC1XX_GPF0(_nr) (S5PC1XX_GPIO_F0_START + (_nr))
112#define S5PC1XX_GPF1(_nr) (S5PC1XX_GPIO_F1_START + (_nr))
113#define S5PC1XX_GPF2(_nr) (S5PC1XX_GPIO_F2_START + (_nr))
114#define S5PC1XX_GPF3(_nr) (S5PC1XX_GPIO_F3_START + (_nr))
115#define S5PC1XX_GPG0(_nr) (S5PC1XX_GPIO_G0_START + (_nr))
116#define S5PC1XX_GPG1(_nr) (S5PC1XX_GPIO_G1_START + (_nr))
117#define S5PC1XX_GPG2(_nr) (S5PC1XX_GPIO_G2_START + (_nr))
118#define S5PC1XX_GPG3(_nr) (S5PC1XX_GPIO_G3_START + (_nr))
119#define S5PC1XX_GPH0(_nr) (S5PC1XX_GPIO_H0_START + (_nr))
120#define S5PC1XX_GPH1(_nr) (S5PC1XX_GPIO_H1_START + (_nr))
121#define S5PC1XX_GPH2(_nr) (S5PC1XX_GPIO_H2_START + (_nr))
122#define S5PC1XX_GPH3(_nr) (S5PC1XX_GPIO_H3_START + (_nr))
123#define S5PC1XX_GPI(_nr) (S5PC1XX_GPIO_I_START + (_nr))
124#define S5PC1XX_GPJ0(_nr) (S5PC1XX_GPIO_J0_START + (_nr))
125#define S5PC1XX_GPJ1(_nr) (S5PC1XX_GPIO_J1_START + (_nr))
126#define S5PC1XX_GPJ2(_nr) (S5PC1XX_GPIO_J2_START + (_nr))
127#define S5PC1XX_GPJ3(_nr) (S5PC1XX_GPIO_J3_START + (_nr))
128#define S5PC1XX_GPJ4(_nr) (S5PC1XX_GPIO_J4_START + (_nr))
129#define S5PC1XX_GPK0(_nr) (S5PC1XX_GPIO_K0_START + (_nr))
130#define S5PC1XX_GPK1(_nr) (S5PC1XX_GPIO_K1_START + (_nr))
131#define S5PC1XX_GPK2(_nr) (S5PC1XX_GPIO_K2_START + (_nr))
132#define S5PC1XX_GPK3(_nr) (S5PC1XX_GPIO_K3_START + (_nr))
133#define S5PC1XX_MP00(_nr) (S5PC1XX_GPIO_MP00_START + (_nr))
134#define S5PC1XX_MP01(_nr) (S5PC1XX_GPIO_MP01_START + (_nr))
135#define S5PC1XX_MP02(_nr) (S5PC1XX_GPIO_MP02_START + (_nr))
136#define S5PC1XX_MP03(_nr) (S5PC1XX_GPIO_MP03_START + (_nr))
137#define S5PC1XX_MP04(_nr) (S5PC1XX_GPIO_MP04_START + (_nr))
138
139/* the end of the S5PC1XX specific gpios */
140#define S5PC1XX_GPIO_END (S5PC1XX_MP04(S5PC1XX_GPIO_MP04_NR) + 1)
141#define S3C_GPIO_END S5PC1XX_GPIO_END
142
143/* define the number of gpios we need to the one after the MP04() range */
144#define ARCH_NR_GPIOS (S5PC1XX_MP04(S5PC1XX_GPIO_MP04_NR) + 1)
145
146#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-s5pc100/include/mach/hardware.h b/arch/arm/mach-s5pc100/include/mach/hardware.h
new file mode 100644
index 000000000000..6b38618c2fd9
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/hardware.h
@@ -0,0 +1,14 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/hardware.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - Hardware support
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H __FILE__
11
12/* currently nothing here, placeholder */
13
14#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/irqs.h b/arch/arm/mach-s5pc100/include/mach/irqs.h
new file mode 100644
index 000000000000..622720dba289
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/irqs.h
@@ -0,0 +1,14 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/irqs.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - IRQ definitions
7 */
8
9#ifndef __ASM_ARCH_IRQS_H
10#define __ASM_ARCH_IRQS_H __FILE__
11
12#include <plat/irqs.h>
13
14#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
new file mode 100644
index 000000000000..9e9f39130b2c
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/map.h
@@ -0,0 +1,75 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/map.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Based on mach-s3c6400/include/mach/map.h
7 *
8 * S5PC1XX - Memory map definitions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_MAP_H
16#define __ASM_ARCH_MAP_H __FILE__
17
18#include <plat/map-base.h>
19
20
21/* Chip ID */
22#define S5PC100_PA_CHIPID (0xE0000000)
23#define S5PC1XX_PA_CHIPID S5PC100_PA_CHIPID
24#define S5PC1XX_VA_CHIPID S3C_VA_SYS
25
26/* System */
27#define S5PC100_PA_SYS (0xE0100000)
28#define S5PC100_PA_CLK (S5PC100_PA_SYS + 0x0)
29#define S5PC100_PA_PWR (S5PC100_PA_SYS + 0x8000)
30#define S5PC1XX_PA_CLK S5PC100_PA_CLK
31#define S5PC1XX_PA_PWR S5PC100_PA_PWR
32#define S5PC1XX_VA_CLK (S3C_VA_SYS + 0x10000)
33#define S5PC1XX_VA_PWR (S3C_VA_SYS + 0x20000)
34
35/* Interrupt */
36#define S5PC100_PA_VIC (0xE4000000)
37#define S5PC100_VA_VIC S3C_VA_IRQ
38#define S5PC100_PA_VIC_OFFSET 0x100000
39#define S5PC100_VA_VIC_OFFSET 0x10000
40#define S5PC1XX_PA_VIC(x) (S5PC100_PA_VIC + ((x) * S5PC100_PA_VIC_OFFSET))
41#define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET))
42
43/* Timer */
44#define S5PC100_PA_TIMER (0xEA000000)
45#define S5PC1XX_PA_TIMER S5PC100_PA_TIMER
46#define S5PC1XX_VA_TIMER S3C_VA_TIMER
47
48/* UART */
49#define S5PC100_PA_UART (0xEC000000)
50#define S5PC1XX_PA_UART S5PC100_PA_UART
51#define S5PC1XX_VA_UART S3C_VA_UART
52
53/* IIC */
54#define S5PC100_PA_IIC (0xEC100000)
55
56/* ETC */
57#define S5PC100_PA_SDRAM (0x20000000)
58
59/* compatibility defines. */
60#define S3C_PA_UART S5PC100_PA_UART
61#define S3C_PA_UART0 (S5PC100_PA_UART + 0x0)
62#define S3C_PA_UART1 (S5PC100_PA_UART + 0x400)
63#define S3C_PA_UART2 (S5PC100_PA_UART + 0x800)
64#define S3C_PA_UART3 (S5PC100_PA_UART + 0xC00)
65#define S3C_VA_UART0 (S3C_VA_UART + 0x0)
66#define S3C_VA_UART1 (S3C_VA_UART + 0x400)
67#define S3C_VA_UART2 (S3C_VA_UART + 0x800)
68#define S3C_VA_UART3 (S3C_VA_UART + 0xC00)
69#define S3C_UART_OFFSET 0x400
70#define S3C_VA_VIC0 (S3C_VA_IRQ + 0x0)
71#define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000)
72#define S3C_VA_VIC2 (S3C_VA_IRQ + 0x20000)
73#define S3C_PA_IIC S5PC100_PA_IIC
74
75#endif /* __ASM_ARCH_C100_MAP_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/memory.h b/arch/arm/mach-s5pc100/include/mach/memory.h
new file mode 100644
index 000000000000..4b60d18179f7
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/memory.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-s5pc100/include/mach/memory.h
2 *
3 * Copyright 2008 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Based on mach-s3c6400/include/mach/memory.h
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_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16#define PHYS_OFFSET UL(0x20000000)
17
18#endif
diff --git a/arch/arm/mach-s5pc100/include/mach/pwm-clock.h b/arch/arm/mach-s5pc100/include/mach/pwm-clock.h
new file mode 100644
index 000000000000..b34d2f7aae52
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/pwm-clock.h
@@ -0,0 +1,56 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/pwm-clock.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - pwm clock and timer support
7 *
8 * Based on mach-s3c6400/include/mach/pwm-clock.h
9 */
10
11/**
12 * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
13 * @tcfg: The timer TCFG1 register bits shifted down to 0.
14 *
15 * Return true if the given configuration from TCFG1 is a TCLK instead
16 * any of the TDIV clocks.
17 */
18static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
19{
20 return tcfg >= S3C64XX_TCFG1_MUX_TCLK;
21}
22
23/**
24 * tcfg_to_divisor() - convert tcfg1 setting to a divisor
25 * @tcfg1: The tcfg1 setting, shifted down.
26 *
27 * Get the divisor value for the given tcfg1 setting. We assume the
28 * caller has already checked to see if this is not a TCLK source.
29 */
30static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
31{
32 return 1 << tcfg1;
33}
34
35/**
36 * pwm_tdiv_has_div1() - does the tdiv setting have a /1
37 *
38 * Return true if we have a /1 in the tdiv setting.
39 */
40static inline unsigned int pwm_tdiv_has_div1(void)
41{
42 return 1;
43}
44
45/**
46 * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.
47 * @div: The divisor to calculate the bit information for.
48 *
49 * Turn a divisor into the necessary bit field for TCFG1.
50 */
51static inline unsigned long pwm_tdiv_div_bits(unsigned int div)
52{
53 return ilog2(div);
54}
55
56#define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-irq.h b/arch/arm/mach-s5pc100/include/mach/regs-irq.h
new file mode 100644
index 000000000000..751ac15438c8
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/regs-irq.h
@@ -0,0 +1,24 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/regs-irq.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC1XX - IRQ register definitions
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_ARCH_REGS_IRQ_H
14#define __ASM_ARCH_REGS_IRQ_H __FILE__
15
16#include <mach/map.h>
17#include <asm/hardware/vic.h>
18
19/* interrupt controller */
20#define S5PC1XX_VIC0REG(x) ((x) + S5PC1XX_VA_VIC(0))
21#define S5PC1XX_VIC1REG(x) ((x) + S5PC1XX_VA_VIC(1))
22#define S5PC1XX_VIC2REG(x) ((x) + S5PC1XX_VA_VIC(2))
23
24#endif /* __ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/system.h b/arch/arm/mach-s5pc100/include/mach/system.h
new file mode 100644
index 000000000000..e39014375470
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/system.h
@@ -0,0 +1,24 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/system.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC1XX - system implementation
7 *
8 * Based on mach-s3c6400/include/mach/system.h
9 */
10
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H __FILE__
13
14static void arch_idle(void)
15{
16 /* nothing here yet */
17}
18
19static void arch_reset(char mode, const char *cmd)
20{
21 /* nothing here yet */
22}
23
24#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/tick.h b/arch/arm/mach-s5pc100/include/mach/tick.h
new file mode 100644
index 000000000000..d3de0f3591ae
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/tick.h
@@ -0,0 +1,29 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/tick.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S3C64XX - Timer tick support definitions
7 *
8 * Based on mach-s3c6400/include/mach/tick.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_TICK_H
16#define __ASM_ARCH_TICK_H __FILE__
17
18/* note, the timer interrutps turn up in 2 places, the vic and then
19 * the timer block. We take the VIC as the base at the moment.
20 */
21static inline u32 s3c24xx_ostimer_pending(void)
22{
23 u32 pend = __raw_readl(S3C_VA_VIC0 + VIC_RAW_STATUS);
24 return pend & 1 << (IRQ_TIMER4 - S5PC1XX_IRQ_VIC0(0));
25}
26
27#define TICK_MAX (0xffffffff)
28
29#endif /* __ASM_ARCH_TICK_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/uncompress.h b/arch/arm/mach-s5pc100/include/mach/uncompress.h
new file mode 100644
index 000000000000..01ccf535e76c
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/uncompress.h
@@ -0,0 +1,28 @@
1/* arch/arm/mach-s5pc100/include/mach/uncompress.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - uncompress code
7 *
8 * Based on mach-s3c6400/include/mach/uncompress.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_UNCOMPRESS_H
16#define __ASM_ARCH_UNCOMPRESS_H
17
18#include <mach/map.h>
19#include <plat/uncompress.h>
20
21static void arch_detect_cpu(void)
22{
23 /* we do not need to do any cpu detection here at the moment. */
24 fifo_mask = S3C2440_UFSTAT_TXMASK;
25 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
26}
27
28#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
new file mode 100644
index 000000000000..214093cd7632
--- /dev/null
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -0,0 +1,103 @@
1/* linux/arch/arm/mach-s5pc100/mach-smdkc100.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Author: Byungho Min <bhmin@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10*/
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/init.h>
18#include <linux/serial_core.h>
19#include <linux/platform_device.h>
20#include <linux/io.h>
21#include <linux/gpio.h>
22#include <linux/i2c.h>
23#include <linux/fb.h>
24#include <linux/delay.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28
29#include <mach/map.h>
30
31#include <asm/irq.h>
32#include <asm/mach-types.h>
33
34#include <plat/regs-serial.h>
35
36#include <plat/clock.h>
37#include <plat/devs.h>
38#include <plat/cpu.h>
39#include <plat/s5pc100.h>
40
41#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
42#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
43#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
44
45static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
46 [0] = {
47 .hwport = 0,
48 .flags = 0,
49 .ucon = 0x3c5,
50 .ulcon = 0x03,
51 .ufcon = 0x51,
52 },
53 [1] = {
54 .hwport = 1,
55 .flags = 0,
56 .ucon = 0x3c5,
57 .ulcon = 0x03,
58 .ufcon = 0x51,
59 },
60 [2] = {
61 .hwport = 2,
62 .flags = 0,
63 .ucon = 0x3c5,
64 .ulcon = 0x03,
65 .ufcon = 0x51,
66 },
67 [3] = {
68 .hwport = 3,
69 .flags = 0,
70 .ucon = 0x3c5,
71 .ulcon = 0x03,
72 .ufcon = 0x51,
73 },
74};
75
76static struct map_desc smdkc100_iodesc[] = {};
77
78static struct platform_device *smdkc100_devices[] __initdata = {
79};
80
81static void __init smdkc100_map_io(void)
82{
83 s5pc1xx_init_io(smdkc100_iodesc, ARRAY_SIZE(smdkc100_iodesc));
84 s3c24xx_init_clocks(12000000);
85 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
86}
87
88static void __init smdkc100_machine_init(void)
89{
90 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
91}
92
93MACHINE_START(SMDKC100, "SMDKC100")
94 /* Maintainer: Byungho Min <bhmin@samsung.com> */
95 .phys_io = S5PC1XX_PA_UART & 0xfff00000,
96 .io_pg_offst = (((u32)S5PC1XX_VA_UART) >> 18) & 0xfffc,
97 .boot_params = S5PC100_PA_SDRAM + 0x100,
98
99 .init_irq = s5pc100_init_irq,
100 .map_io = smdkc100_map_io,
101 .init_machine = smdkc100_machine_init,
102 .timer = &s3c24xx_timer,
103MACHINE_END
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 89b3ccf35e1b..7936085dd758 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -455,8 +455,8 @@ void __init u300_init_irq(void)
455 for (i = 0; i < NR_IRQS; i++) 455 for (i = 0; i < NR_IRQS; i++)
456 set_bit(i, (unsigned long *) &mask[0]); 456 set_bit(i, (unsigned long *) &mask[0]);
457 u300_enable_intcon_clock(); 457 u300_enable_intcon_clock();
458 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], 0); 458 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]);
459 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], 0); 459 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);
460} 460}
461 461
462 462
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index afc0f87f3fa4..975eae41ee66 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -343,8 +343,7 @@ static struct platform_device versatile_i2c_device = {
343 343
344static struct i2c_board_info versatile_i2c_board_info[] = { 344static struct i2c_board_info versatile_i2c_board_info[] = {
345 { 345 {
346 I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1), 346 I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
347 .type = "ds1338",
348 }, 347 },
349}; 348};
350 349
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 83c025e72ceb..5fe595aeba69 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -758,7 +758,7 @@ config CACHE_FEROCEON_L2_WRITETHROUGH
758config CACHE_L2X0 758config CACHE_L2X0
759 bool "Enable the L2x0 outer cache controller" 759 bool "Enable the L2x0 outer cache controller"
760 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \ 760 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \
761 REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX 761 REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || ARCH_NOMADIK
762 default y 762 default y
763 select OUTER_CACHE 763 select OUTER_CACHE
764 help 764 help
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 03cd27d917b9..b270d6228fe2 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -159,7 +159,9 @@ union offset_union {
159 159
160#define __get8_unaligned_check(ins,val,addr,err) \ 160#define __get8_unaligned_check(ins,val,addr,err) \
161 __asm__( \ 161 __asm__( \
162 "1: "ins" %1, [%2], #1\n" \ 162 ARM( "1: "ins" %1, [%2], #1\n" ) \
163 THUMB( "1: "ins" %1, [%2]\n" ) \
164 THUMB( " add %2, %2, #1\n" ) \
163 "2:\n" \ 165 "2:\n" \
164 " .section .fixup,\"ax\"\n" \ 166 " .section .fixup,\"ax\"\n" \
165 " .align 2\n" \ 167 " .align 2\n" \
@@ -215,7 +217,9 @@ union offset_union {
215 do { \ 217 do { \
216 unsigned int err = 0, v = val, a = addr; \ 218 unsigned int err = 0, v = val, a = addr; \
217 __asm__( FIRST_BYTE_16 \ 219 __asm__( FIRST_BYTE_16 \
218 "1: "ins" %1, [%2], #1\n" \ 220 ARM( "1: "ins" %1, [%2], #1\n" ) \
221 THUMB( "1: "ins" %1, [%2]\n" ) \
222 THUMB( " add %2, %2, #1\n" ) \
219 " mov %1, %1, "NEXT_BYTE"\n" \ 223 " mov %1, %1, "NEXT_BYTE"\n" \
220 "2: "ins" %1, [%2]\n" \ 224 "2: "ins" %1, [%2]\n" \
221 "3:\n" \ 225 "3:\n" \
@@ -245,11 +249,17 @@ union offset_union {
245 do { \ 249 do { \
246 unsigned int err = 0, v = val, a = addr; \ 250 unsigned int err = 0, v = val, a = addr; \
247 __asm__( FIRST_BYTE_32 \ 251 __asm__( FIRST_BYTE_32 \
248 "1: "ins" %1, [%2], #1\n" \ 252 ARM( "1: "ins" %1, [%2], #1\n" ) \
253 THUMB( "1: "ins" %1, [%2]\n" ) \
254 THUMB( " add %2, %2, #1\n" ) \
249 " mov %1, %1, "NEXT_BYTE"\n" \ 255 " mov %1, %1, "NEXT_BYTE"\n" \
250 "2: "ins" %1, [%2], #1\n" \ 256 ARM( "2: "ins" %1, [%2], #1\n" ) \
257 THUMB( "2: "ins" %1, [%2]\n" ) \
258 THUMB( " add %2, %2, #1\n" ) \
251 " mov %1, %1, "NEXT_BYTE"\n" \ 259 " mov %1, %1, "NEXT_BYTE"\n" \
252 "3: "ins" %1, [%2], #1\n" \ 260 ARM( "3: "ins" %1, [%2], #1\n" ) \
261 THUMB( "3: "ins" %1, [%2]\n" ) \
262 THUMB( " add %2, %2, #1\n" ) \
253 " mov %1, %1, "NEXT_BYTE"\n" \ 263 " mov %1, %1, "NEXT_BYTE"\n" \
254 "4: "ins" %1, [%2]\n" \ 264 "4: "ins" %1, [%2]\n" \
255 "5:\n" \ 265 "5:\n" \
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index be93ff02a98d..bda0ec31a4e2 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -21,7 +21,7 @@
21 * 21 *
22 * Flush the whole D-cache. 22 * Flush the whole D-cache.
23 * 23 *
24 * Corrupted registers: r0-r5, r7, r9-r11 24 * Corrupted registers: r0-r7, r9-r11 (r6 only in Thumb mode)
25 * 25 *
26 * - mm - mm_struct describing address space 26 * - mm - mm_struct describing address space
27 */ 27 */
@@ -51,8 +51,12 @@ loop1:
51loop2: 51loop2:
52 mov r9, r4 @ create working copy of max way size 52 mov r9, r4 @ create working copy of max way size
53loop3: 53loop3:
54 orr r11, r10, r9, lsl r5 @ factor way and cache number into r11 54 ARM( orr r11, r10, r9, lsl r5 ) @ factor way and cache number into r11
55 orr r11, r11, r7, lsl r2 @ factor index number into r11 55 THUMB( lsl r6, r9, r5 )
56 THUMB( orr r11, r10, r6 ) @ factor way and cache number into r11
57 ARM( orr r11, r11, r7, lsl r2 ) @ factor index number into r11
58 THUMB( lsl r6, r7, r2 )
59 THUMB( orr r11, r11, r6 ) @ factor index number into r11
56 mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way 60 mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way
57 subs r9, r9, #1 @ decrement the way 61 subs r9, r9, #1 @ decrement the way
58 bge loop3 62 bge loop3
@@ -82,11 +86,13 @@ ENDPROC(v7_flush_dcache_all)
82 * 86 *
83 */ 87 */
84ENTRY(v7_flush_kern_cache_all) 88ENTRY(v7_flush_kern_cache_all)
85 stmfd sp!, {r4-r5, r7, r9-r11, lr} 89 ARM( stmfd sp!, {r4-r5, r7, r9-r11, lr} )
90 THUMB( stmfd sp!, {r4-r7, r9-r11, lr} )
86 bl v7_flush_dcache_all 91 bl v7_flush_dcache_all
87 mov r0, #0 92 mov r0, #0
88 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate 93 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate
89 ldmfd sp!, {r4-r5, r7, r9-r11, lr} 94 ARM( ldmfd sp!, {r4-r5, r7, r9-r11, lr} )
95 THUMB( ldmfd sp!, {r4-r7, r9-r11, lr} )
90 mov pc, lr 96 mov pc, lr
91ENDPROC(v7_flush_kern_cache_all) 97ENDPROC(v7_flush_kern_cache_all)
92 98
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 510c179b0ac8..b30925fcbcdc 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -36,7 +36,34 @@
36#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT) 36#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT)
37#define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT) 37#define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT)
38 38
39static u64 get_coherent_dma_mask(struct device *dev)
40{
41 u64 mask = ISA_DMA_THRESHOLD;
42
43 if (dev) {
44 mask = dev->coherent_dma_mask;
45
46 /*
47 * Sanity check the DMA mask - it must be non-zero, and
48 * must be able to be satisfied by a DMA allocation.
49 */
50 if (mask == 0) {
51 dev_warn(dev, "coherent DMA mask is unset\n");
52 return 0;
53 }
54
55 if ((~mask) & ISA_DMA_THRESHOLD) {
56 dev_warn(dev, "coherent DMA mask %#llx is smaller "
57 "than system GFP_DMA mask %#llx\n",
58 mask, (unsigned long long)ISA_DMA_THRESHOLD);
59 return 0;
60 }
61 }
39 62
63 return mask;
64}
65
66#ifdef CONFIG_MMU
40/* 67/*
41 * These are the page tables (2MB each) covering uncached, DMA consistent allocations 68 * These are the page tables (2MB each) covering uncached, DMA consistent allocations
42 */ 69 */
@@ -152,7 +179,8 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
152 struct page *page; 179 struct page *page;
153 struct arm_vm_region *c; 180 struct arm_vm_region *c;
154 unsigned long order; 181 unsigned long order;
155 u64 mask = ISA_DMA_THRESHOLD, limit; 182 u64 mask = get_coherent_dma_mask(dev);
183 u64 limit;
156 184
157 if (!consistent_pte[0]) { 185 if (!consistent_pte[0]) {
158 printk(KERN_ERR "%s: not initialised\n", __func__); 186 printk(KERN_ERR "%s: not initialised\n", __func__);
@@ -160,25 +188,8 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
160 return NULL; 188 return NULL;
161 } 189 }
162 190
163 if (dev) { 191 if (!mask)
164 mask = dev->coherent_dma_mask; 192 goto no_page;
165
166 /*
167 * Sanity check the DMA mask - it must be non-zero, and
168 * must be able to be satisfied by a DMA allocation.
169 */
170 if (mask == 0) {
171 dev_warn(dev, "coherent DMA mask is unset\n");
172 goto no_page;
173 }
174
175 if ((~mask) & ISA_DMA_THRESHOLD) {
176 dev_warn(dev, "coherent DMA mask %#llx is smaller "
177 "than system GFP_DMA mask %#llx\n",
178 mask, (unsigned long long)ISA_DMA_THRESHOLD);
179 goto no_page;
180 }
181 }
182 193
183 /* 194 /*
184 * Sanity check the allocation size. 195 * Sanity check the allocation size.
@@ -267,6 +278,31 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
267 *handle = ~0; 278 *handle = ~0;
268 return NULL; 279 return NULL;
269} 280}
281#else /* !CONFIG_MMU */
282static void *
283__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
284 pgprot_t prot)
285{
286 void *virt;
287 u64 mask = get_coherent_dma_mask(dev);
288
289 if (!mask)
290 goto error;
291
292 if (mask != 0xffffffff)
293 gfp |= GFP_DMA;
294 virt = kmalloc(size, gfp);
295 if (!virt)
296 goto error;
297
298 *handle = virt_to_dma(dev, virt);
299 return virt;
300
301error:
302 *handle = ~0;
303 return NULL;
304}
305#endif /* CONFIG_MMU */
270 306
271/* 307/*
272 * Allocate DMA-coherent memory space and return both the kernel remapped 308 * Allocate DMA-coherent memory space and return both the kernel remapped
@@ -311,9 +347,10 @@ EXPORT_SYMBOL(dma_alloc_writecombine);
311static int dma_mmap(struct device *dev, struct vm_area_struct *vma, 347static int dma_mmap(struct device *dev, struct vm_area_struct *vma,
312 void *cpu_addr, dma_addr_t dma_addr, size_t size) 348 void *cpu_addr, dma_addr_t dma_addr, size_t size)
313{ 349{
350 int ret = -ENXIO;
351#ifdef CONFIG_MMU
314 unsigned long flags, user_size, kern_size; 352 unsigned long flags, user_size, kern_size;
315 struct arm_vm_region *c; 353 struct arm_vm_region *c;
316 int ret = -ENXIO;
317 354
318 user_size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 355 user_size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
319 356
@@ -334,6 +371,7 @@ static int dma_mmap(struct device *dev, struct vm_area_struct *vma,
334 vma->vm_page_prot); 371 vma->vm_page_prot);
335 } 372 }
336 } 373 }
374#endif /* CONFIG_MMU */
337 375
338 return ret; 376 return ret;
339} 377}
@@ -358,6 +396,7 @@ EXPORT_SYMBOL(dma_mmap_writecombine);
358 * free a page as defined by the above mapping. 396 * free a page as defined by the above mapping.
359 * Must not be called with IRQs disabled. 397 * Must not be called with IRQs disabled.
360 */ 398 */
399#ifdef CONFIG_MMU
361void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle) 400void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle)
362{ 401{
363 struct arm_vm_region *c; 402 struct arm_vm_region *c;
@@ -444,6 +483,14 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr
444 __func__, cpu_addr); 483 __func__, cpu_addr);
445 dump_stack(); 484 dump_stack();
446} 485}
486#else /* !CONFIG_MMU */
487void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle)
488{
489 if (dma_release_from_coherent(dev, get_order(size), cpu_addr))
490 return;
491 kfree(cpu_addr);
492}
493#endif /* CONFIG_MMU */
447EXPORT_SYMBOL(dma_free_coherent); 494EXPORT_SYMBOL(dma_free_coherent);
448 495
449/* 496/*
@@ -451,10 +498,12 @@ EXPORT_SYMBOL(dma_free_coherent);
451 */ 498 */
452static int __init consistent_init(void) 499static int __init consistent_init(void)
453{ 500{
501 int ret = 0;
502#ifdef CONFIG_MMU
454 pgd_t *pgd; 503 pgd_t *pgd;
455 pmd_t *pmd; 504 pmd_t *pmd;
456 pte_t *pte; 505 pte_t *pte;
457 int ret = 0, i = 0; 506 int i = 0;
458 u32 base = CONSISTENT_BASE; 507 u32 base = CONSISTENT_BASE;
459 508
460 do { 509 do {
@@ -477,6 +526,7 @@ static int __init consistent_init(void)
477 consistent_pte[i++] = pte; 526 consistent_pte[i++] = pte;
478 base += (1 << PGDIR_SHIFT); 527 base += (1 << PGDIR_SHIFT);
479 } while (base < CONSISTENT_END); 528 } while (base < CONSISTENT_END);
529#endif /* !CONFIG_MMU */
480 530
481 return ret; 531 return ret;
482} 532}
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 5fa8dea5a371..cc8829d7e116 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -16,6 +16,7 @@
16#include <linux/kprobes.h> 16#include <linux/kprobes.h>
17#include <linux/uaccess.h> 17#include <linux/uaccess.h>
18#include <linux/page-flags.h> 18#include <linux/page-flags.h>
19#include <linux/sched.h>
19#include <linux/highmem.h> 20#include <linux/highmem.h>
20 21
21#include <asm/system.h> 22#include <asm/system.h>
@@ -24,6 +25,7 @@
24 25
25#include "fault.h" 26#include "fault.h"
26 27
28#ifdef CONFIG_MMU
27 29
28#ifdef CONFIG_KPROBES 30#ifdef CONFIG_KPROBES
29static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr) 31static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
@@ -98,6 +100,10 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
98 100
99 printk("\n"); 101 printk("\n");
100} 102}
103#else /* CONFIG_MMU */
104void show_pte(struct mm_struct *mm, unsigned long addr)
105{ }
106#endif /* CONFIG_MMU */
101 107
102/* 108/*
103 * Oops. The kernel tried to access some page that wasn't present. 109 * Oops. The kernel tried to access some page that wasn't present.
@@ -172,6 +178,7 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
172 __do_kernel_fault(mm, addr, fsr, regs); 178 __do_kernel_fault(mm, addr, fsr, regs);
173} 179}
174 180
181#ifdef CONFIG_MMU
175#define VM_FAULT_BADMAP 0x010000 182#define VM_FAULT_BADMAP 0x010000
176#define VM_FAULT_BADACCESS 0x020000 183#define VM_FAULT_BADACCESS 0x020000
177 184
@@ -323,6 +330,13 @@ no_context:
323 __do_kernel_fault(mm, addr, fsr, regs); 330 __do_kernel_fault(mm, addr, fsr, regs);
324 return 0; 331 return 0;
325} 332}
333#else /* CONFIG_MMU */
334static int
335do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
336{
337 return 0;
338}
339#endif /* CONFIG_MMU */
326 340
327/* 341/*
328 * First Level Translation Fault Handler 342 * First Level Translation Fault Handler
@@ -341,6 +355,7 @@ no_context:
341 * interrupt or a critical region, and should only copy the information 355 * interrupt or a critical region, and should only copy the information
342 * from the master page table, nothing more. 356 * from the master page table, nothing more.
343 */ 357 */
358#ifdef CONFIG_MMU
344static int __kprobes 359static int __kprobes
345do_translation_fault(unsigned long addr, unsigned int fsr, 360do_translation_fault(unsigned long addr, unsigned int fsr,
346 struct pt_regs *regs) 361 struct pt_regs *regs)
@@ -379,6 +394,14 @@ bad_area:
379 do_bad_area(addr, fsr, regs); 394 do_bad_area(addr, fsr, regs);
380 return 0; 395 return 0;
381} 396}
397#else /* CONFIG_MMU */
398static int
399do_translation_fault(unsigned long addr, unsigned int fsr,
400 struct pt_regs *regs)
401{
402 return 0;
403}
404#endif /* CONFIG_MMU */
382 405
383/* 406/*
384 * Some section permission faults need to be handled gracefully. 407 * Some section permission faults need to be handled gracefully.
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index ad7bacc693b2..900811cc9130 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -12,6 +12,7 @@
12#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
13#include <asm/sections.h> 13#include <asm/sections.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/setup.h>
15#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
16 17
17#include "mm.h" 18#include "mm.h"
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index a0b3f36f3178..7d63beaf9745 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -77,6 +77,7 @@
77 * Sanity check the PTE configuration for the code below - which makes 77 * Sanity check the PTE configuration for the code below - which makes
78 * certain assumptions about how these bits are layed out. 78 * certain assumptions about how these bits are layed out.
79 */ 79 */
80#ifdef CONFIG_MMU
80#if L_PTE_SHARED != PTE_EXT_SHARED 81#if L_PTE_SHARED != PTE_EXT_SHARED
81#error PTE shared bit mismatch 82#error PTE shared bit mismatch
82#endif 83#endif
@@ -84,6 +85,7 @@
84 L_PTE_FILE+L_PTE_PRESENT) > L_PTE_SHARED 85 L_PTE_FILE+L_PTE_PRESENT) > L_PTE_SHARED
85#error Invalid Linux PTE bit settings 86#error Invalid Linux PTE bit settings
86#endif 87#endif
88#endif /* CONFIG_MMU */
87 89
88/* 90/*
89 * The ARMv6 and ARMv7 set_pte_ext translation function. 91 * The ARMv6 and ARMv7 set_pte_ext translation function.
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 180a08d03a03..f3fa1c32fe92 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -127,7 +127,9 @@ ENDPROC(cpu_v7_switch_mm)
127 */ 127 */
128ENTRY(cpu_v7_set_pte_ext) 128ENTRY(cpu_v7_set_pte_ext)
129#ifdef CONFIG_MMU 129#ifdef CONFIG_MMU
130 str r1, [r0], #-2048 @ linux version 130 ARM( str r1, [r0], #-2048 ) @ linux version
131 THUMB( str r1, [r0] ) @ linux version
132 THUMB( sub r0, r0, #2048 )
131 133
132 bic r3, r1, #0x000003f0 134 bic r3, r1, #0x000003f0
133 bic r3, r3, #PTE_TYPE_MASK 135 bic r3, r3, #PTE_TYPE_MASK
@@ -232,7 +234,6 @@ __v7_setup:
232 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 234 mcr p15, 0, r4, c2, c0, 1 @ load TTB1
233 mov r10, #0x1f @ domains 0, 1 = manager 235 mov r10, #0x1f @ domains 0, 1 = manager
234 mcr p15, 0, r10, c3, c0, 0 @ load domain access register 236 mcr p15, 0, r10, c3, c0, 0 @ load domain access register
235#endif
236 /* 237 /*
237 * Memory region attributes with SCTLR.TRE=1 238 * Memory region attributes with SCTLR.TRE=1
238 * 239 *
@@ -265,6 +266,7 @@ __v7_setup:
265 ldr r6, =0x40e040e0 @ NMRR 266 ldr r6, =0x40e040e0 @ NMRR
266 mcr p15, 0, r5, c10, c2, 0 @ write PRRR 267 mcr p15, 0, r5, c10, c2, 0 @ write PRRR
267 mcr p15, 0, r6, c10, c2, 1 @ write NMRR 268 mcr p15, 0, r6, c10, c2, 1 @ write NMRR
269#endif
268 adr r5, v7_crval 270 adr r5, v7_crval
269 ldmia r5, {r5, r6} 271 ldmia r5, {r5, r6}
270#ifdef CONFIG_CPU_ENDIAN_BE8 272#ifdef CONFIG_CPU_ENDIAN_BE8
@@ -273,6 +275,7 @@ __v7_setup:
273 mrc p15, 0, r0, c1, c0, 0 @ read control register 275 mrc p15, 0, r0, c1, c0, 0 @ read control register
274 bic r0, r0, r5 @ clear bits them 276 bic r0, r0, r5 @ clear bits them
275 orr r0, r0, r6 @ set them 277 orr r0, r0, r6 @ set them
278 THUMB( orr r0, r0, #1 << 30 ) @ Thumb exceptions
276 mov pc, lr @ return to head.S:__ret 279 mov pc, lr @ return to head.S:__ret
277ENDPROC(__v7_setup) 280ENDPROC(__v7_setup)
278 281
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index 8986b7412235..ca5c7c226341 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -9,6 +9,7 @@ choice
9config ARCH_MX1 9config ARCH_MX1
10 bool "MX1-based" 10 bool "MX1-based"
11 select CPU_ARM920T 11 select CPU_ARM920T
12 select COMMON_CLKDEV
12 help 13 help
13 This enables support for systems based on the Freescale i.MX1 family 14 This enables support for systems based on the Freescale i.MX1 family
14 15
@@ -19,6 +20,13 @@ config ARCH_MX2
19 help 20 help
20 This enables support for systems based on the Freescale i.MX2 family 21 This enables support for systems based on the Freescale i.MX2 family
21 22
23config ARCH_MX25
24 bool "MX25-based"
25 select CPU_ARM926T
26 select COMMON_CLKDEV
27 help
28 This enables support for systems based on the Freescale i.MX25 family
29
22config ARCH_MX3 30config ARCH_MX3
23 bool "MX3-based" 31 bool "MX3-based"
24 select CPU_V6 32 select CPU_V6
@@ -26,11 +34,20 @@ config ARCH_MX3
26 help 34 help
27 This enables support for systems based on the Freescale i.MX3 family 35 This enables support for systems based on the Freescale i.MX3 family
28 36
37config ARCH_MXC91231
38 bool "MXC91231-based"
39 select CPU_V6
40 select COMMON_CLKDEV
41 help
42 This enables support for systems based on the Freescale MXC91231 family
43
29endchoice 44endchoice
30 45
31source "arch/arm/mach-mx1/Kconfig" 46source "arch/arm/mach-mx1/Kconfig"
32source "arch/arm/mach-mx2/Kconfig" 47source "arch/arm/mach-mx2/Kconfig"
33source "arch/arm/mach-mx3/Kconfig" 48source "arch/arm/mach-mx3/Kconfig"
49source "arch/arm/mach-mx25/Kconfig"
50source "arch/arm/mach-mxc91231/Kconfig"
34 51
35endmenu 52endmenu
36 53
diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
index 92e13566cd4f..9e8fbd57495c 100644
--- a/arch/arm/plat-mxc/clock.c
+++ b/arch/arm/plat-mxc/clock.c
@@ -39,6 +39,7 @@
39#include <linux/string.h> 39#include <linux/string.h>
40 40
41#include <mach/clock.h> 41#include <mach/clock.h>
42#include <mach/hardware.h>
42 43
43static LIST_HEAD(clocks); 44static LIST_HEAD(clocks);
44static DEFINE_MUTEX(clocks_mutex); 45static DEFINE_MUTEX(clocks_mutex);
@@ -47,76 +48,6 @@ static DEFINE_MUTEX(clocks_mutex);
47 * Standard clock functions defined in include/linux/clk.h 48 * Standard clock functions defined in include/linux/clk.h
48 *-------------------------------------------------------------------------*/ 49 *-------------------------------------------------------------------------*/
49 50
50/*
51 * All the code inside #ifndef CONFIG_COMMON_CLKDEV can be removed once all
52 * MXC architectures have switched to using clkdev.
53 */
54#ifndef CONFIG_COMMON_CLKDEV
55/*
56 * Retrieve a clock by name.
57 *
58 * Note that we first try to use device id on the bus
59 * and clock name. If this fails, we try to use "<name>.<id>". If this fails,
60 * we try to use clock name only.
61 * The reference count to the clock's module owner ref count is incremented.
62 */
63struct clk *clk_get(struct device *dev, const char *id)
64{
65 struct clk *p, *clk = ERR_PTR(-ENOENT);
66 int idno;
67 const char *str;
68
69 if (id == NULL)
70 return clk;
71
72 if (dev == NULL || dev->bus != &platform_bus_type)
73 idno = -1;
74 else
75 idno = to_platform_device(dev)->id;
76
77 mutex_lock(&clocks_mutex);
78
79 list_for_each_entry(p, &clocks, node) {
80 if (p->id == idno &&
81 strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
82 clk = p;
83 goto found;
84 }
85 }
86
87 str = strrchr(id, '.');
88 if (str) {
89 int cnt = str - id;
90 str++;
91 idno = simple_strtol(str, NULL, 10);
92 list_for_each_entry(p, &clocks, node) {
93 if (p->id == idno &&
94 strlen(p->name) == cnt &&
95 strncmp(id, p->name, cnt) == 0 &&
96 try_module_get(p->owner)) {
97 clk = p;
98 goto found;
99 }
100 }
101 }
102
103 list_for_each_entry(p, &clocks, node) {
104 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
105 clk = p;
106 goto found;
107 }
108 }
109
110 printk(KERN_WARNING "clk: Unable to get requested clock: %s\n", id);
111
112found:
113 mutex_unlock(&clocks_mutex);
114
115 return clk;
116}
117EXPORT_SYMBOL(clk_get);
118#endif
119
120static void __clk_disable(struct clk *clk) 51static void __clk_disable(struct clk *clk)
121{ 52{
122 if (clk == NULL || IS_ERR(clk)) 53 if (clk == NULL || IS_ERR(clk))
@@ -193,16 +124,6 @@ unsigned long clk_get_rate(struct clk *clk)
193} 124}
194EXPORT_SYMBOL(clk_get_rate); 125EXPORT_SYMBOL(clk_get_rate);
195 126
196#ifndef CONFIG_COMMON_CLKDEV
197/* Decrement the clock's module reference count */
198void clk_put(struct clk *clk)
199{
200 if (clk && !IS_ERR(clk))
201 module_put(clk->owner);
202}
203EXPORT_SYMBOL(clk_put);
204#endif
205
206/* Round the requested clock rate to the nearest supported 127/* Round the requested clock rate to the nearest supported
207 * rate that is less than or equal to the requested rate. 128 * rate that is less than or equal to the requested rate.
208 * This is dependent on the clock's current parent. 129 * This is dependent on the clock's current parent.
@@ -265,80 +186,6 @@ struct clk *clk_get_parent(struct clk *clk)
265} 186}
266EXPORT_SYMBOL(clk_get_parent); 187EXPORT_SYMBOL(clk_get_parent);
267 188
268#ifndef CONFIG_COMMON_CLKDEV
269/*
270 * Add a new clock to the clock tree.
271 */
272int clk_register(struct clk *clk)
273{
274 if (clk == NULL || IS_ERR(clk))
275 return -EINVAL;
276
277 mutex_lock(&clocks_mutex);
278 list_add(&clk->node, &clocks);
279 mutex_unlock(&clocks_mutex);
280
281 return 0;
282}
283EXPORT_SYMBOL(clk_register);
284
285/* Remove a clock from the clock tree */
286void clk_unregister(struct clk *clk)
287{
288 if (clk == NULL || IS_ERR(clk))
289 return;
290
291 mutex_lock(&clocks_mutex);
292 list_del(&clk->node);
293 mutex_unlock(&clocks_mutex);
294}
295EXPORT_SYMBOL(clk_unregister);
296
297#ifdef CONFIG_PROC_FS
298static int mxc_clock_read_proc(char *page, char **start, off_t off,
299 int count, int *eof, void *data)
300{
301 struct clk *clkp;
302 char *p = page;
303 int len;
304
305 list_for_each_entry(clkp, &clocks, node) {
306 p += sprintf(p, "%s-%d:\t\t%lu, %d", clkp->name, clkp->id,
307 clk_get_rate(clkp), clkp->usecount);
308 if (clkp->parent)
309 p += sprintf(p, ", %s-%d\n", clkp->parent->name,
310 clkp->parent->id);
311 else
312 p += sprintf(p, "\n");
313 }
314
315 len = (p - page) - off;
316 if (len < 0)
317 len = 0;
318
319 *eof = (len <= count) ? 1 : 0;
320 *start = page + off;
321
322 return len;
323}
324
325static int __init mxc_setup_proc_entry(void)
326{
327 struct proc_dir_entry *res;
328
329 res = create_proc_read_entry("cpu/clocks", 0, NULL,
330 mxc_clock_read_proc, NULL);
331 if (!res) {
332 printk(KERN_ERR "Failed to create proc/cpu/clocks\n");
333 return -ENOMEM;
334 }
335 return 0;
336}
337
338late_initcall(mxc_setup_proc_entry);
339#endif /* CONFIG_PROC_FS */
340#endif
341
342/* 189/*
343 * Get the resulting clock rate from a PLL register value and the input 190 * Get the resulting clock rate from a PLL register value and the input
344 * frequency. PLLs with this register layout can at least be found on 191 * frequency. PLLs with this register layout can at least be found on
@@ -363,12 +210,11 @@ unsigned long mxc_decode_pll(unsigned int reg_val, u32 freq)
363 210
364 mfn_abs = mfn; 211 mfn_abs = mfn;
365 212
366#if !defined CONFIG_ARCH_MX1 && !defined CONFIG_ARCH_MX21 213 /* On all i.MXs except i.MX1 and i.MX21 mfn is a 10bit
367 if (mfn >= 0x200) { 214 * 2's complements number
368 mfn |= 0xFFFFFE00; 215 */
369 mfn_abs = -mfn; 216 if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200)
370 } 217 mfn_abs = 0x400 - mfn;
371#endif
372 218
373 freq *= 2; 219 freq *= 2;
374 freq /= pd + 1; 220 freq /= pd + 1;
@@ -376,8 +222,10 @@ unsigned long mxc_decode_pll(unsigned int reg_val, u32 freq)
376 ll = (unsigned long long)freq * mfn_abs; 222 ll = (unsigned long long)freq * mfn_abs;
377 223
378 do_div(ll, mfd + 1); 224 do_div(ll, mfd + 1);
379 if (mfn < 0) 225
226 if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200)
380 ll = -ll; 227 ll = -ll;
228
381 ll = (freq * mfi) + ll; 229 ll = (freq * mfi) + ll;
382 230
383 return ll; 231 return ll;
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 7506d963be4b..cfc4a8b43e6a 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -29,6 +29,23 @@
29static struct mxc_gpio_port *mxc_gpio_ports; 29static struct mxc_gpio_port *mxc_gpio_ports;
30static int gpio_table_size; 30static int gpio_table_size;
31 31
32#define cpu_is_mx1_mx2() (cpu_is_mx1() || cpu_is_mx2())
33
34#define GPIO_DR (cpu_is_mx1_mx2() ? 0x1c : 0x00)
35#define GPIO_GDIR (cpu_is_mx1_mx2() ? 0x00 : 0x04)
36#define GPIO_PSR (cpu_is_mx1_mx2() ? 0x24 : 0x08)
37#define GPIO_ICR1 (cpu_is_mx1_mx2() ? 0x28 : 0x0C)
38#define GPIO_ICR2 (cpu_is_mx1_mx2() ? 0x2C : 0x10)
39#define GPIO_IMR (cpu_is_mx1_mx2() ? 0x30 : 0x14)
40#define GPIO_ISR (cpu_is_mx1_mx2() ? 0x34 : 0x18)
41#define GPIO_ISR (cpu_is_mx1_mx2() ? 0x34 : 0x18)
42
43#define GPIO_INT_LOW_LEV (cpu_is_mx1_mx2() ? 0x3 : 0x0)
44#define GPIO_INT_HIGH_LEV (cpu_is_mx1_mx2() ? 0x2 : 0x1)
45#define GPIO_INT_RISE_EDGE (cpu_is_mx1_mx2() ? 0x0 : 0x2)
46#define GPIO_INT_FALL_EDGE (cpu_is_mx1_mx2() ? 0x1 : 0x3)
47#define GPIO_INT_NONE 0x4
48
32/* Note: This driver assumes 32 GPIOs are handled in one register */ 49/* Note: This driver assumes 32 GPIOs are handled in one register */
33 50
34static void _clear_gpio_irqstatus(struct mxc_gpio_port *port, u32 index) 51static void _clear_gpio_irqstatus(struct mxc_gpio_port *port, u32 index)
@@ -162,7 +179,6 @@ static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat)
162 } 179 }
163} 180}
164 181
165#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX1)
166/* MX1 and MX3 has one interrupt *per* gpio port */ 182/* MX1 and MX3 has one interrupt *per* gpio port */
167static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc) 183static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc)
168{ 184{
@@ -174,9 +190,7 @@ static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc)
174 190
175 mxc_gpio_irq_handler(port, irq_stat); 191 mxc_gpio_irq_handler(port, irq_stat);
176} 192}
177#endif
178 193
179#ifdef CONFIG_ARCH_MX2
180/* MX2 has one interrupt *for all* gpio ports */ 194/* MX2 has one interrupt *for all* gpio ports */
181static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc) 195static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc)
182{ 196{
@@ -195,7 +209,6 @@ static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc)
195 mxc_gpio_irq_handler(&port[i], irq_stat); 209 mxc_gpio_irq_handler(&port[i], irq_stat);
196 } 210 }
197} 211}
198#endif
199 212
200static struct irq_chip gpio_irq_chip = { 213static struct irq_chip gpio_irq_chip = {
201 .ack = gpio_ack_irq, 214 .ack = gpio_ack_irq,
@@ -284,17 +297,18 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
284 /* its a serious configuration bug when it fails */ 297 /* its a serious configuration bug when it fails */
285 BUG_ON( gpiochip_add(&port[i].chip) < 0 ); 298 BUG_ON( gpiochip_add(&port[i].chip) < 0 );
286 299
287#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX1) 300 if (cpu_is_mx1() || cpu_is_mx3() || cpu_is_mx25()) {
288 /* setup one handler for each entry */ 301 /* setup one handler for each entry */
289 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler); 302 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler);
290 set_irq_data(port[i].irq, &port[i]); 303 set_irq_data(port[i].irq, &port[i]);
291#endif 304 }
305 }
306
307 if (cpu_is_mx2()) {
308 /* setup one handler for all GPIO interrupts */
309 set_irq_chained_handler(port[0].irq, mx2_gpio_irq_handler);
310 set_irq_data(port[0].irq, port);
292 } 311 }
293 312
294#ifdef CONFIG_ARCH_MX2
295 /* setup one handler for all GPIO interrupts */
296 set_irq_chained_handler(port[0].irq, mx2_gpio_irq_handler);
297 set_irq_data(port[0].irq, port);
298#endif
299 return 0; 313 return 0;
300} 314}
diff --git a/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h b/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h
index 8769e910e559..0376c133c9f4 100644
--- a/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h
+++ b/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h
@@ -12,11 +12,4 @@
12#ifndef __ASM_ARCH_MXC_BOARD_ARMADILLO5X0_H__ 12#ifndef __ASM_ARCH_MXC_BOARD_ARMADILLO5X0_H__
13#define __ASM_ARCH_MXC_BOARD_ARMADILLO5X0_H__ 13#define __ASM_ARCH_MXC_BOARD_ARMADILLO5X0_H__
14 14
15#include <mach/hardware.h>
16
17/* mandatory for CONFIG_DEBUG_LL */
18
19#define MXC_LL_UART_PADDR UART1_BASE_ADDR
20#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
21
22#endif 15#endif
diff --git a/arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx27.h b/arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx27.h
new file mode 100644
index 000000000000..a1fd5830af48
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx27.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2009 Eric Benard - eric@eukrea.com
3 *
4 * Based on board-pcm038.h which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#ifndef __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX27_H__
23#define __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX27_H__
24
25#ifndef __ASSEMBLY__
26/*
27 * This CPU module needs a baseboard to work. After basic initializing
28 * its own devices, it calls baseboard's init function.
29 * TODO: Add your own baseboard init function and call it from
30 * inside eukrea_cpuimx27_init().
31 *
32 * This example here is for the development board. Refer
33 * eukrea_mbimx27-baseboard.c
34 */
35
36extern void eukrea_mbimx27_baseboard_init(void);
37
38#endif
39
40#endif /* __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX27_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx21ads.h b/arch/arm/plat-mxc/include/mach/board-mx21ads.h
index 06701df74c42..0cf4fa29510c 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx21ads.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx21ads.h
@@ -15,12 +15,6 @@
15#define __ASM_ARCH_MXC_BOARD_MX21ADS_H__ 15#define __ASM_ARCH_MXC_BOARD_MX21ADS_H__
16 16
17/* 17/*
18 * MXC UART EVB board level configurations
19 */
20#define MXC_LL_UART_PADDR UART1_BASE_ADDR
21#define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR)
22
23/*
24 * Memory-mapped I/O on MX21ADS base board 18 * Memory-mapped I/O on MX21ADS base board
25 */ 19 */
26#define MX21ADS_MMIO_BASE_ADDR 0xF5000000 20#define MX21ADS_MMIO_BASE_ADDR 0xF5000000
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27ads.h b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
index d42f4e6116f8..7776d230327f 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx27ads.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
@@ -26,12 +26,6 @@
26 MXC_MAX_VIRTUAL_INTS) 26 MXC_MAX_VIRTUAL_INTS)
27 27
28/* 28/*
29 * MXC UART EVB board level configurations
30 */
31#define MXC_LL_UART_PADDR UART1_BASE_ADDR
32#define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR)
33
34/*
35 * @name Memory Size parameters 29 * @name Memory Size parameters
36 */ 30 */
37 31
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27lite.h b/arch/arm/plat-mxc/include/mach/board-mx27lite.h
index a870f8ea2443..ea87551d2736 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx27lite.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx27lite.h
@@ -11,9 +11,4 @@
11#ifndef __ASM_ARCH_MXC_BOARD_MX27LITE_H__ 11#ifndef __ASM_ARCH_MXC_BOARD_MX27LITE_H__
12#define __ASM_ARCH_MXC_BOARD_MX27LITE_H__ 12#define __ASM_ARCH_MXC_BOARD_MX27LITE_H__
13 13
14/* mandatory for CONFIG_DEBUG_LL */
15
16#define MXC_LL_UART_PADDR UART1_BASE_ADDR
17#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
18
19#endif /* __ASM_ARCH_MXC_BOARD_MX27LITE_H__ */ 14#endif /* __ASM_ARCH_MXC_BOARD_MX27LITE_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27pdk.h b/arch/arm/plat-mxc/include/mach/board-mx27pdk.h
index 552b55d714d8..fec1bcfa9164 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx27pdk.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx27pdk.h
@@ -11,9 +11,4 @@
11#ifndef __ASM_ARCH_MXC_BOARD_MX27PDK_H__ 11#ifndef __ASM_ARCH_MXC_BOARD_MX27PDK_H__
12#define __ASM_ARCH_MXC_BOARD_MX27PDK_H__ 12#define __ASM_ARCH_MXC_BOARD_MX27PDK_H__
13 13
14/* mandatory for CONFIG_DEBUG_LL */
15
16#define MXC_LL_UART_PADDR UART1_BASE_ADDR
17#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
18
19#endif /* __ASM_ARCH_MXC_BOARD_MX27PDK_H__ */ 14#endif /* __ASM_ARCH_MXC_BOARD_MX27PDK_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
index 06e6895f7f65..2cbfa35e82ff 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31ads.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
@@ -114,9 +114,4 @@
114 114
115#define MXC_MAX_EXP_IO_LINES 16 115#define MXC_MAX_EXP_IO_LINES 16
116 116
117/* mandatory for CONFIG_DEBUG_LL */
118
119#define MXC_LL_UART_PADDR UART1_BASE_ADDR
120#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
121
122#endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */ 117#endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31lilly.h b/arch/arm/plat-mxc/include/mach/board-mx31lilly.h
index 78cf31e22e4d..eb5a5024622e 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31lilly.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31lilly.h
@@ -22,11 +22,6 @@
22#ifndef __ASM_ARCH_MXC_BOARD_MX31LILLY_H__ 22#ifndef __ASM_ARCH_MXC_BOARD_MX31LILLY_H__
23#define __ASM_ARCH_MXC_BOARD_MX31LILLY_H__ 23#define __ASM_ARCH_MXC_BOARD_MX31LILLY_H__
24 24
25/* mandatory for CONFIG_LL_DEBUG */
26
27#define MXC_LL_UART_PADDR UART1_BASE_ADDR
28#define MXC_LL_UART_VADDR (AIPI_BASE_ADDR_VIRT + 0x0A000)
29
30#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
31 26
32enum mx31lilly_boards { 27enum mx31lilly_boards {
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31lite.h b/arch/arm/plat-mxc/include/mach/board-mx31lite.h
index 52fbdf2d6f26..8e64325d6905 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31lite.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31lite.h
@@ -11,8 +11,5 @@
11#ifndef __ASM_ARCH_MXC_BOARD_MX31LITE_H__ 11#ifndef __ASM_ARCH_MXC_BOARD_MX31LITE_H__
12#define __ASM_ARCH_MXC_BOARD_MX31LITE_H__ 12#define __ASM_ARCH_MXC_BOARD_MX31LITE_H__
13 13
14#define MXC_LL_UART_PADDR UART1_BASE_ADDR
15#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
16
17#endif /* __ASM_ARCH_MXC_BOARD_MX31LITE_H__ */ 14#endif /* __ASM_ARCH_MXC_BOARD_MX31LITE_H__ */
18 15
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
index 303fd2434a21..d5be6b5a6acf 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
@@ -19,11 +19,6 @@
19#ifndef __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__ 19#ifndef __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__
20#define __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__ 20#define __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__
21 21
22/* mandatory for CONFIG_DEBUG_LL */
23
24#define MXC_LL_UART_PADDR UART1_BASE_ADDR
25#define MXC_LL_UART_VADDR (AIPI_BASE_ADDR_VIRT + 0x0A000)
26
27#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
28 23
29enum mx31moboard_boards { 24enum mx31moboard_boards {
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31pdk.h b/arch/arm/plat-mxc/include/mach/board-mx31pdk.h
index 519bab3eb28b..2bbd6ed17f50 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31pdk.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31pdk.h
@@ -11,11 +11,6 @@
11#ifndef __ASM_ARCH_MXC_BOARD_MX31PDK_H__ 11#ifndef __ASM_ARCH_MXC_BOARD_MX31PDK_H__
12#define __ASM_ARCH_MXC_BOARD_MX31PDK_H__ 12#define __ASM_ARCH_MXC_BOARD_MX31PDK_H__
13 13
14/* mandatory for CONFIG_DEBUG_LL */
15
16#define MXC_LL_UART_PADDR UART1_BASE_ADDR
17#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
18
19/* Definitions for components on the Debug board */ 14/* Definitions for components on the Debug board */
20 15
21/* Base address of CPLD controller on the Debug board */ 16/* Base address of CPLD controller on the Debug board */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx35pdk.h b/arch/arm/plat-mxc/include/mach/board-mx35pdk.h
index 1111037d6d9d..383f1c04df06 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx35pdk.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx35pdk.h
@@ -19,9 +19,4 @@
19#ifndef __ASM_ARCH_MXC_BOARD_MX35PDK_H__ 19#ifndef __ASM_ARCH_MXC_BOARD_MX35PDK_H__
20#define __ASM_ARCH_MXC_BOARD_MX35PDK_H__ 20#define __ASM_ARCH_MXC_BOARD_MX35PDK_H__
21 21
22/* mandatory for CONFIG_DEBUG_LL */
23
24#define MXC_LL_UART_PADDR UART1_BASE_ADDR
25#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
26
27#endif /* __ASM_ARCH_MXC_BOARD_MX35PDK_H__ */ 22#endif /* __ASM_ARCH_MXC_BOARD_MX35PDK_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-pcm037.h b/arch/arm/plat-mxc/include/mach/board-pcm037.h
index f0a1fa1938a2..13411709b13a 100644
--- a/arch/arm/plat-mxc/include/mach/board-pcm037.h
+++ b/arch/arm/plat-mxc/include/mach/board-pcm037.h
@@ -19,9 +19,4 @@
19#ifndef __ASM_ARCH_MXC_BOARD_PCM037_H__ 19#ifndef __ASM_ARCH_MXC_BOARD_PCM037_H__
20#define __ASM_ARCH_MXC_BOARD_PCM037_H__ 20#define __ASM_ARCH_MXC_BOARD_PCM037_H__
21 21
22/* mandatory for CONFIG_DEBUG_LL */
23
24#define MXC_LL_UART_PADDR UART1_BASE_ADDR
25#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
26
27#endif /* __ASM_ARCH_MXC_BOARD_PCM037_H__ */ 22#endif /* __ASM_ARCH_MXC_BOARD_PCM037_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-pcm038.h b/arch/arm/plat-mxc/include/mach/board-pcm038.h
index 4fcd7499e092..410f9786ed22 100644
--- a/arch/arm/plat-mxc/include/mach/board-pcm038.h
+++ b/arch/arm/plat-mxc/include/mach/board-pcm038.h
@@ -19,11 +19,6 @@
19#ifndef __ASM_ARCH_MXC_BOARD_PCM038_H__ 19#ifndef __ASM_ARCH_MXC_BOARD_PCM038_H__
20#define __ASM_ARCH_MXC_BOARD_PCM038_H__ 20#define __ASM_ARCH_MXC_BOARD_PCM038_H__
21 21
22/* mandatory for CONFIG_DEBUG_LL */
23
24#define MXC_LL_UART_PADDR UART1_BASE_ADDR
25#define MXC_LL_UART_VADDR (AIPI_BASE_ADDR_VIRT + 0x0A000)
26
27#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
28/* 23/*
29 * This CPU module needs a baseboard to work. After basic initializing 24 * This CPU module needs a baseboard to work. After basic initializing
diff --git a/arch/arm/plat-mxc/include/mach/board-pcm043.h b/arch/arm/plat-mxc/include/mach/board-pcm043.h
index 15fbdf16abcd..1ac4e1682e5c 100644
--- a/arch/arm/plat-mxc/include/mach/board-pcm043.h
+++ b/arch/arm/plat-mxc/include/mach/board-pcm043.h
@@ -19,9 +19,4 @@
19#ifndef __ASM_ARCH_MXC_BOARD_PCM043_H__ 19#ifndef __ASM_ARCH_MXC_BOARD_PCM043_H__
20#define __ASM_ARCH_MXC_BOARD_PCM043_H__ 20#define __ASM_ARCH_MXC_BOARD_PCM043_H__
21 21
22/* mandatory for CONFIG_LL_DEBUG */
23
24#define MXC_LL_UART_PADDR UART1_BASE_ADDR
25#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
26
27#endif /* __ASM_ARCH_MXC_BOARD_PCM043_H__ */ 22#endif /* __ASM_ARCH_MXC_BOARD_PCM043_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-qong.h b/arch/arm/plat-mxc/include/mach/board-qong.h
index 04033ec637d2..6d88c7af4b23 100644
--- a/arch/arm/plat-mxc/include/mach/board-qong.h
+++ b/arch/arm/plat-mxc/include/mach/board-qong.h
@@ -11,11 +11,6 @@
11#ifndef __ASM_ARCH_MXC_BOARD_QONG_H__ 11#ifndef __ASM_ARCH_MXC_BOARD_QONG_H__
12#define __ASM_ARCH_MXC_BOARD_QONG_H__ 12#define __ASM_ARCH_MXC_BOARD_QONG_H__
13 13
14/* mandatory for CONFIG_DEBUG_LL */
15
16#define MXC_LL_UART_PADDR UART1_BASE_ADDR
17#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
18
19/* NOR FLASH */ 14/* NOR FLASH */
20#define QONG_NOR_SIZE (128*1024*1024) 15#define QONG_NOR_SIZE (128*1024*1024)
21 16
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 02c3cd004db3..286cb9b0a25b 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -16,18 +16,33 @@ struct clk;
16 16
17extern void mx1_map_io(void); 17extern void mx1_map_io(void);
18extern void mx21_map_io(void); 18extern void mx21_map_io(void);
19extern void mx25_map_io(void);
19extern void mx27_map_io(void); 20extern void mx27_map_io(void);
20extern void mx31_map_io(void); 21extern void mx31_map_io(void);
21extern void mx35_map_io(void); 22extern void mx35_map_io(void);
22extern void mxc_init_irq(void); 23extern void mxc91231_map_io(void);
23extern void mxc_timer_init(struct clk *timer_clk); 24extern void mxc_init_irq(void __iomem *);
25extern void mx1_init_irq(void);
26extern void mx21_init_irq(void);
27extern void mx25_init_irq(void);
28extern void mx27_init_irq(void);
29extern void mx31_init_irq(void);
30extern void mx35_init_irq(void);
31extern void mxc91231_init_irq(void);
32extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int);
24extern int mx1_clocks_init(unsigned long fref); 33extern int mx1_clocks_init(unsigned long fref);
25extern int mx21_clocks_init(unsigned long lref, unsigned long fref); 34extern int mx21_clocks_init(unsigned long lref, unsigned long fref);
35extern int mx25_clocks_init(unsigned long fref);
26extern int mx27_clocks_init(unsigned long fref); 36extern int mx27_clocks_init(unsigned long fref);
27extern int mx31_clocks_init(unsigned long fref); 37extern int mx31_clocks_init(unsigned long fref);
28extern int mx35_clocks_init(void); 38extern int mx35_clocks_init(void);
39extern int mxc91231_clocks_init(unsigned long fref);
29extern int mxc_register_gpios(void); 40extern int mxc_register_gpios(void);
30extern int mxc_register_device(struct platform_device *pdev, void *data); 41extern int mxc_register_device(struct platform_device *pdev, void *data);
31extern void mxc_set_cpu_type(unsigned int type); 42extern void mxc_set_cpu_type(unsigned int type);
43extern void mxc_arch_reset_init(void __iomem *);
44extern void mxc91231_power_off(void);
45extern void mxc91231_arch_reset(int, const char *);
46extern void mxc91231_prepare_idle(void);
32 47
33#endif 48#endif
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index bbc5f6753cfb..15b2b148a105 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -11,52 +11,52 @@
11 * 11 *
12 */ 12 */
13 13
14#include <mach/hardware.h> 14#ifdef CONFIG_ARCH_MX1
15 15#include <mach/mx1.h>
16#ifdef CONFIG_MACH_MX31ADS 16#define UART_PADDR UART1_BASE_ADDR
17#include <mach/board-mx31ads.h> 17#define UART_VADDR IO_ADDRESS(UART1_BASE_ADDR)
18#endif
19#ifdef CONFIG_MACH_PCM037
20#include <mach/board-pcm037.h>
21#endif
22#ifdef CONFIG_MACH_MX31LITE
23#include <mach/board-mx31lite.h>
24#endif
25#ifdef CONFIG_MACH_MX27ADS
26#include <mach/board-mx27ads.h>
27#endif
28#ifdef CONFIG_MACH_MX21ADS
29#include <mach/board-mx21ads.h>
30#endif 18#endif
31#ifdef CONFIG_MACH_PCM038 19
32#include <mach/board-pcm038.h> 20#ifdef CONFIG_ARCH_MX25
21#ifdef UART_PADDR
22#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
33#endif 23#endif
34#ifdef CONFIG_MACH_MX31_3DS 24#include <mach/mx25.h>
35#include <mach/board-mx31pdk.h> 25#define UART_PADDR UART1_BASE_ADDR
26#define UART_VADDR MX25_AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
36#endif 27#endif
37#ifdef CONFIG_MACH_QONG 28
38#include <mach/board-qong.h> 29#ifdef CONFIG_ARCH_MX2
30#ifdef UART_PADDR
31#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
39#endif 32#endif
40#ifdef CONFIG_MACH_PCM043 33#include <mach/mx2x.h>
41#include <mach/board-pcm043.h> 34#define UART_PADDR UART1_BASE_ADDR
35#define UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR)
42#endif 36#endif
43#ifdef CONFIG_MACH_MX27_3DS 37
44#include <mach/board-mx27pdk.h> 38#ifdef CONFIG_ARCH_MX3
39#ifdef UART_PADDR
40#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
45#endif 41#endif
46#ifdef CONFIG_MACH_ARMADILLO5X0 42#include <mach/mx3x.h>
47#include <mach/board-armadillo5x0.h> 43#define UART_PADDR UART1_BASE_ADDR
44#define UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
48#endif 45#endif
49#ifdef CONFIG_MACH_MX35_3DS 46
50#include <mach/board-mx35pdk.h> 47#ifdef CONFIG_ARCH_MXC91231
48#ifdef UART_PADDR
49#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
51#endif 50#endif
52#ifdef CONFIG_MACH_MX27LITE 51#include <mach/mxc91231.h>
53#include <mach/board-mx27lite.h> 52#define UART_PADDR MXC91231_UART2_BASE_ADDR
53#define UART_VADDR MXC91231_AIPS1_IO_ADDRESS(MXC91231_UART2_BASE_ADDR)
54#endif 54#endif
55 .macro addruart,rx 55 .macro addruart,rx
56 mrc p15, 0, \rx, c1, c0 56 mrc p15, 0, \rx, c1, c0
57 tst \rx, #1 @ MMU enabled? 57 tst \rx, #1 @ MMU enabled?
58 ldreq \rx, =MXC_LL_UART_PADDR @ physical 58 ldreq \rx, =UART_PADDR @ physical
59 ldrne \rx, =MXC_LL_UART_VADDR @ virtual 59 ldrne \rx, =UART_VADDR @ virtual
60 .endm 60 .endm
61 61
62 .macro senduart,rd,rx 62 .macro senduart,rd,rx
diff --git a/arch/arm/plat-mxc/include/mach/entry-macro.S b/arch/arm/plat-mxc/include/mach/entry-macro.S
index 5f01d60da845..7cf290efe768 100644
--- a/arch/arm/plat-mxc/include/mach/entry-macro.S
+++ b/arch/arm/plat-mxc/include/mach/entry-macro.S
@@ -18,7 +18,8 @@
18 .endm 18 .endm
19 19
20 .macro get_irqnr_preamble, base, tmp 20 .macro get_irqnr_preamble, base, tmp
21 ldr \base, =AVIC_IO_ADDRESS(AVIC_BASE_ADDR) 21 ldr \base, =avic_base
22 ldr \base, [\base]
22#ifdef CONFIG_MXC_IRQ_PRIOR 23#ifdef CONFIG_MXC_IRQ_PRIOR
23 ldr r4, [\base, #AVIC_NIMASK] 24 ldr r4, [\base, #AVIC_NIMASK]
24#endif 25#endif
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h
index 42e4ee37ca1f..78db75475f69 100644
--- a/arch/arm/plat-mxc/include/mach/hardware.h
+++ b/arch/arm/plat-mxc/include/mach/hardware.h
@@ -42,6 +42,14 @@
42# include <mach/mx1.h> 42# include <mach/mx1.h>
43#endif 43#endif
44 44
45#ifdef CONFIG_ARCH_MX25
46# include <mach/mx25.h>
47#endif
48
49#ifdef CONFIG_ARCH_MXC91231
50# include <mach/mxc91231.h>
51#endif
52
45#include <mach/mxc.h> 53#include <mach/mxc.h>
46 54
47#endif /* __ASM_ARCH_MXC_HARDWARE_H__ */ 55#endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/imxfb.h b/arch/arm/plat-mxc/include/mach/imxfb.h
index 9f0101157ec1..5263506b7ddf 100644
--- a/arch/arm/plat-mxc/include/mach/imxfb.h
+++ b/arch/arm/plat-mxc/include/mach/imxfb.h
@@ -2,6 +2,8 @@
2 * This structure describes the machine which we are running on. 2 * This structure describes the machine which we are running on.
3 */ 3 */
4 4
5#include <linux/fb.h>
6
5#define PCR_TFT (1 << 31) 7#define PCR_TFT (1 << 31)
6#define PCR_COLOR (1 << 30) 8#define PCR_COLOR (1 << 30)
7#define PCR_PBSIZ_1 (0 << 28) 9#define PCR_PBSIZ_1 (0 << 28)
@@ -13,7 +15,8 @@
13#define PCR_BPIX_4 (2 << 25) 15#define PCR_BPIX_4 (2 << 25)
14#define PCR_BPIX_8 (3 << 25) 16#define PCR_BPIX_8 (3 << 25)
15#define PCR_BPIX_12 (4 << 25) 17#define PCR_BPIX_12 (4 << 25)
16#define PCR_BPIX_16 (4 << 25) 18#define PCR_BPIX_16 (5 << 25)
19#define PCR_BPIX_18 (6 << 25)
17#define PCR_PIXPOL (1 << 24) 20#define PCR_PIXPOL (1 << 24)
18#define PCR_FLMPOL (1 << 23) 21#define PCR_FLMPOL (1 << 23)
19#define PCR_LPPOL (1 << 22) 22#define PCR_LPPOL (1 << 22)
@@ -46,29 +49,21 @@
46#define DMACR_HM(x) (((x) & 0xf) << 16) 49#define DMACR_HM(x) (((x) & 0xf) << 16)
47#define DMACR_TM(x) ((x) & 0xf) 50#define DMACR_TM(x) ((x) & 0xf)
48 51
49struct imx_fb_platform_data { 52struct imx_fb_videomode {
50 u_long pixclock; 53 struct fb_videomode mode;
51 54 u32 pcr;
52 u_short xres; 55 unsigned char bpp;
53 u_short yres; 56};
54
55 u_int nonstd;
56 u_char bpp;
57 u_char hsync_len;
58 u_char left_margin;
59 u_char right_margin;
60 57
61 u_char vsync_len; 58struct imx_fb_platform_data {
62 u_char upper_margin; 59 struct imx_fb_videomode *mode;
63 u_char lower_margin; 60 int num_modes;
64 u_char sync;
65 61
66 u_int cmap_greyscale:1, 62 u_int cmap_greyscale:1,
67 cmap_inverse:1, 63 cmap_inverse:1,
68 cmap_static:1, 64 cmap_static:1,
69 unused:29; 65 unused:29;
70 66
71 u_int pcr;
72 u_int pwmr; 67 u_int pwmr;
73 u_int lscr1; 68 u_int lscr1;
74 u_int dmacr; 69 u_int dmacr;
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx25.h b/arch/arm/plat-mxc/include/mach/iomux-mx25.h
new file mode 100644
index 000000000000..810c47f56e77
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx25.h
@@ -0,0 +1,517 @@
1/*
2 * arch/arm/plat-mxc/include/mach/iomux-mx25.h
3 *
4 * Copyright (C) 2009 by Lothar Wassmann <LW@KARO-electronics.de>
5 *
6 * based on arch/arm/mach-mx25/mx25_pins.h
7 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
8 * and
9 * arch/arm/plat-mxc/include/mach/iomux-mx35.h
10 * Copyright (C, NO_PAD_CTRL) 2009 by Jan Weitzel Phytec Messtechnik GmbH <armlinux@phytec.de>
11 *
12 * The code contained herein is licensed under the GNU General Public
13 * License. You may obtain a copy of the GNU General Public License
14 * Version 2 or later at the following locations:
15 *
16 * http://www.opensource.org/licenses/gpl-license.html
17 * http://www.gnu.org/copyleft/gpl.html
18 */
19#ifndef __IOMUX_MX25_H__
20#define __IOMUX_MX25_H__
21
22#include <mach/iomux-v3.h>
23
24#ifndef GPIO_PORTA
25#error Please include mach/iomux.h
26#endif
27
28/*
29 *
30 * @brief MX25 I/O Pin List
31 *
32 * @ingroup GPIO_MX25
33 */
34
35#ifndef __ASSEMBLY__
36
37/*
38 * IOMUX/PAD Bit field definitions
39 */
40
41#define MX25_PAD_A10__A10 IOMUX_PAD(0x000, 0x008, 0x00, 0, 0, NO_PAD_CTRL)
42#define MX25_PAD_A10__GPIO_4_0 IOMUX_PAD(0x000, 0x008, 0x05, 0, 0, NO_PAD_CTRL)
43
44#define MX25_PAD_A13__A13 IOMUX_PAD(0x22C, 0x00c, 0x00, 0, 0, NO_PAD_CTRL)
45#define MX25_PAD_A13__GPIO_4_1 IOMUX_PAD(0x22C, 0x00c, 0x05, 0, 0, NO_PAD_CTRL)
46
47#define MX25_PAD_A14__A14 IOMUX_PAD(0x230, 0x010, 0x10, 0, 0, NO_PAD_CTRL)
48#define MX25_PAD_A14__GPIO_2_0 IOMUX_PAD(0x230, 0x010, 0x15, 0, 0, NO_PAD_CTRL)
49
50#define MX25_PAD_A15__A15 IOMUX_PAD(0x234, 0x014, 0x10, 0, 0, NO_PAD_CTRL)
51#define MX25_PAD_A15__GPIO_2_1 IOMUX_PAD(0x234, 0x014, 0x15, 0, 0, NO_PAD_CTRL)
52
53#define MX25_PAD_A16__A16 IOMUX_PAD(0x000, 0x018, 0x10, 0, 0, NO_PAD_CTRL)
54#define MX25_PAD_A16__GPIO_2_2 IOMUX_PAD(0x000, 0x018, 0x15, 0, 0, NO_PAD_CTRL)
55
56#define MX25_PAD_A17__A17 IOMUX_PAD(0x238, 0x01c, 0x10, 0, 0, NO_PAD_CTRL)
57#define MX25_PAD_A17__GPIO_2_3 IOMUX_PAD(0x238, 0x01c, 0x15, 0, 0, NO_PAD_CTRL)
58
59#define MX25_PAD_A18__A18 IOMUX_PAD(0x23c, 0x020, 0x10, 0, 0, NO_PAD_CTRL)
60#define MX25_PAD_A18__GPIO_2_4 IOMUX_PAD(0x23c, 0x020, 0x15, 0, 0, NO_PAD_CTRL)
61#define MX25_PAD_A18__FEC_COL IOMUX_PAD(0x23c, 0x020, 0x17, 0x504, 0, NO_PAD_CTL)
62
63#define MX25_PAD_A19__A19 IOMUX_PAD(0x240, 0x024, 0x10, 0, 0, NO_PAD_CTRL)
64#define MX25_PAD_A19__FEC_RX_ER IOMUX_PAD(0x240, 0x024, 0x17, 0x518, 0, NO_PAD_CTL)
65#define MX25_PAD_A19__GPIO_2_5 IOMUX_PAD(0x240, 0x024, 0x15, 0, 0, NO_PAD_CTRL)
66
67#define MX25_PAD_A20__A20 IOMUX_PAD(0x244, 0x028, 0x10, 0, 0, NO_PAD_CTRL)
68#define MX25_PAD_A20__GPIO_2_6 IOMUX_PAD(0x244, 0x028, 0x15, 0, 0, NO_PAD_CTRL)
69#define MX25_PAD_A20__FEC_RDATA2 IOMUX_PAD(0x244, 0x028, 0x17, 0x50c, 0, NO_PAD_CTL)
70
71#define MX25_PAD_A21__A21 IOMUX_PAD(0x248, 0x02c, 0x10, 0, 0, NO_PAD_CTRL)
72#define MX25_PAD_A21__GPIO_2_7 IOMUX_PAD(0x248, 0x02c, 0x15, 0, 0, NO_PAD_CTRL)
73#define MX25_PAD_A21__FEC_RDATA3 IOMUX_PAD(0x248, 0x02c, 0x17, 0x510, 0, NO_PAD_CTL)
74
75#define MX25_PAD_A22__A22 IOMUX_PAD(0x000, 0x030, 0x10, 0, 0, NO_PAD_CTRL)
76#define MX25_PAD_A22__GPIO_2_8 IOMUX_PAD(0x000, 0x030, 0x15, 0, 0, NO_PAD_CTRL)
77
78#define MX25_PAD_A23__A23 IOMUX_PAD(0x24c, 0x034, 0x10, 0, 0, NO_PAD_CTRL)
79#define MX25_PAD_A23__GPIO_2_9 IOMUX_PAD(0x24c, 0x034, 0x15, 0, 0, NO_PAD_CTRL)
80
81#define MX25_PAD_A24__A24 IOMUX_PAD(0x250, 0x038, 0x10, 0, 0, NO_PAD_CTRL)
82#define MX25_PAD_A24__GPIO_2_10 IOMUX_PAD(0x250, 0x038, 0x15, 0, 0, NO_PAD_CTRL)
83#define MX25_PAD_A24__FEC_RX_CLK IOMUX_PAD(0x250, 0x038, 0x17, 0x514, 0, NO_PAD_CTL)
84
85#define MX25_PAD_A25__A25 IOMUX_PAD(0x254, 0x03c, 0x10, 0, 0, NO_PAD_CTRL)
86#define MX25_PAD_A25__GPIO_2_11 IOMUX_PAD(0x254, 0x03c, 0x15, 0, 0, NO_PAD_CTRL)
87#define MX25_PAD_A25__FEC_CRS IOMUX_PAD(0x254, 0x03c, 0x17, 0x508, 0, NO_PAD_CTL)
88
89#define MX25_PAD_EB0__EB0 IOMUX_PAD(0x258, 0x040, 0x10, 0, 0, NO_PAD_CTRL)
90#define MX25_PAD_EB0__AUD4_TXD IOMUX_PAD(0x258, 0x040, 0x14, 0x464, 0, NO_PAD_CTRL)
91#define MX25_PAD_EB0__GPIO_2_12 IOMUX_PAD(0x258, 0x040, 0x15, 0, 0, NO_PAD_CTRL)
92
93#define MX25_PAD_EB1__EB1 IOMUX_PAD(0x25c, 0x044, 0x10, 0, 0, NO_PAD_CTRL)
94#define MX25_PAD_EB1__AUD4_RXD IOMUX_PAD(0x25c, 0x044, 0x14, 0x460, 0, NO_PAD_CTRL)
95#define MX25_PAD_EB1__GPIO_2_13 IOMUX_PAD(0x25c, 0x044, 0x15, 0, 0, NO_PAD_CTRL)
96
97#define MX25_PAD_OE__OE IOMUX_PAD(0x260, 0x048, 0x10, 0, 0, NO_PAD_CTRL)
98#define MX25_PAD_OE__AUD4_TXC IOMUX_PAD(0x260, 0x048, 0x14, 0, 0, NO_PAD_CTRL)
99#define MX25_PAD_OE__GPIO_2_14 IOMUX_PAD(0x260, 0x048, 0x15, 0, 0, NO_PAD_CTRL)
100
101#define MX25_PAD_CS0__CS0 IOMUX_PAD(0x000, 0x04c, 0x00, 0, 0, NO_PAD_CTRL)
102#define MX25_PAD_CS0__GPIO_4_2 IOMUX_PAD(0x000, 0x04c, 0x05, 0, 0, NO_PAD_CTRL)
103
104#define MX25_PAD_CS1__CS1 IOMUX_PAD(0x000, 0x050, 0x00, 0, 0, NO_PAD_CTRL)
105#define MX25_PAD_CS1__GPIO_4_3 IOMUX_PAD(0x000, 0x050, 0x05, 0, 0, NO_PAD_CTRL)
106
107#define MX25_PAD_CS4__CS4 IOMUX_PAD(0x264, 0x054, 0x10, 0, 0, NO_PAD_CTRL)
108#define MX25_PAD_CS4__UART5_CTS IOMUX_PAD(0x264, 0x054, 0x13, 0, 0, NO_PAD_CTRL)
109#define MX25_PAD_CS4__GPIO_3_20 IOMUX_PAD(0x264, 0x054, 0x15, 0, 0, NO_PAD_CTRL)
110
111#define MX25_PAD_CS5__CS5 IOMUX_PAD(0x268, 0x058, 0x10, 0, 0, NO_PAD_CTRL)
112#define MX25_PAD_CS5__UART5_RTS IOMUX_PAD(0x268, 0x058, 0x13, 0x574, 0, NO_PAD_CTRL)
113#define MX25_PAD_CS5__GPIO_3_21 IOMUX_PAD(0x268, 0x058, 0x15, 0, 0, NO_PAD_CTRL)
114
115#define MX25_PAD_NF_CE0__NF_CE0 IOMUX_PAD(0x26c, 0x05c, 0x10, 0, 0, NO_PAD_CTL)
116#define MX25_PAD_NF_CE0__GPIO_3_22 IOMUX_PAD(0x26c, 0x05c, 0x15, 0, 0, NO_PAD_CTRL)
117
118#define MX25_PAD_ECB__ECB IOMUX_PAD(0x270, 0x060, 0x10, 0, 0, NO_PAD_CTRL)
119#define MX25_PAD_ECB__UART5_TXD_MUX IOMUX_PAD(0x270, 0x060, 0x13, 0, 0, NO_PAD_CTRL)
120#define MX25_PAD_ECB__GPIO_3_23 IOMUX_PAD(0x270, 0x060, 0x15, 0, 0, NO_PAD_CTRL)
121
122#define MX25_PAD_LBA__LBA IOMUX_PAD(0x274, 0x064, 0x10, 0, 0, NO_PAD_CTRL)
123#define MX25_PAD_LBA__UART5_RXD_MUX IOMUX_PAD(0x274, 0x064, 0x13, 0x578, 0, NO_PAD_CTRL)
124#define MX25_PAD_LBA__GPIO_3_24 IOMUX_PAD(0x274, 0x064, 0x15, 0, 0, NO_PAD_CTRL)
125
126#define MX25_PAD_BCLK__BCLK IOMUX_PAD(0x000, 0x068, 0x00, 0, 0, NO_PAD_CTRL)
127#define MX25_PAD_BCLK__GPIO_4_4 IOMUX_PAD(0x000, 0x068, 0x05, 0, 0, NO_PAD_CTRL)
128
129#define MX25_PAD_RW__RW IOMUX_PAD(0x278, 0x06c, 0x10, 0, 0, NO_PAD_CTRL)
130#define MX25_PAD_RW__AUD4_TXFS IOMUX_PAD(0x278, 0x06c, 0x14, 0x474, 0, NO_PAD_CTRL)
131#define MX25_PAD_RW__GPIO_3_25 IOMUX_PAD(0x278, 0x06c, 0x15, 0, 0, NO_PAD_CTRL)
132
133#define MX25_PAD_NFWE_B__NFWE_B IOMUX_PAD(0x000, 0x070, 0x10, 0, 0, NO_PAD_CTRL)
134#define MX25_PAD_NFWE_B__GPIO_3_26 IOMUX_PAD(0x000, 0x070, 0x15, 0, 0, NO_PAD_CTRL)
135
136#define MX25_PAD_NFRE_B__NFRE_B IOMUX_PAD(0x000, 0x074, 0x10, 0, 0, NO_PAD_CTRL)
137#define MX25_PAD_NFRE_B__GPIO_3_27 IOMUX_PAD(0x000, 0x074, 0x15, 0, 0, NO_PAD_CTRL)
138
139#define MX25_PAD_NFALE__NFALE IOMUX_PAD(0x000, 0x078, 0x10, 0, 0, NO_PAD_CTRL)
140#define MX25_PAD_NFALE__GPIO_3_28 IOMUX_PAD(0x000, 0x078, 0x15, 0, 0, NO_PAD_CTRL)
141
142#define MX25_PAD_NFCLE__NFCLE IOMUX_PAD(0x000, 0x07c, 0x10, 0, 0, NO_PAD_CTRL)
143#define MX25_PAD_NFCLE__GPIO_3_29 IOMUX_PAD(0x000, 0x07c, 0x15, 0, 0, NO_PAD_CTRL)
144
145#define MX25_PAD_NFWP_B__NFWP_B IOMUX_PAD(0x000, 0x080, 0x10, 0, 0, NO_PAD_CTRL)
146#define MX25_PAD_NFWP_B__GPIO_3_30 IOMUX_PAD(0x000, 0x080, 0x15, 0, 0, NO_PAD_CTRL)
147
148#define MX25_PAD_NFRB__NFRB IOMUX_PAD(0x27c, 0x084, 0x10, 0, 0, PAD_CTL_PKE)
149#define MX25_PAD_NFRB__GPIO_3_31 IOMUX_PAD(0x27c, 0x084, 0x15, 0, 0, NO_PAD_CTRL)
150
151#define MX25_PAD_D15__D15 IOMUX_PAD(0x280, 0x088, 0x00, 0, 0, NO_PAD_CTRL)
152#define MX25_PAD_D15__LD16 IOMUX_PAD(0x280, 0x088, 0x01, 0, 0, NO_PAD_CTRL)
153#define MX25_PAD_D15__GPIO_4_5 IOMUX_PAD(0x280, 0x088, 0x05, 0, 0, NO_PAD_CTRL)
154
155#define MX25_PAD_D14__D14 IOMUX_PAD(0x284, 0x08c, 0x00, 0, 0, NO_PAD_CTRL)
156#define MX25_PAD_D14__LD17 IOMUX_PAD(0x284, 0x08c, 0x01, 0, 0, NO_PAD_CTRL)
157#define MX25_PAD_D14__GPIO_4_6 IOMUX_PAD(0x284, 0x08c, 0x05, 0, 0, NO_PAD_CTRL)
158
159#define MX25_PAD_D13__D13 IOMUX_PAD(0x288, 0x090, 0x00, 0, 0, NO_PAD_CTRL)
160#define MX25_PAD_D13__LD18 IOMUX_PAD(0x288, 0x090, 0x01, 0, 0, NO_PAD_CTRL)
161#define MX25_PAD_D13__GPIO_4_7 IOMUX_PAD(0x288, 0x090, 0x05, 0, 0, NO_PAD_CTRL)
162
163#define MX25_PAD_D12__D12 IOMUX_PAD(0x28c, 0x094, 0x00, 0, 0, NO_PAD_CTRL)
164#define MX25_PAD_D12__GPIO_4_8 IOMUX_PAD(0x28c, 0x094, 0x05, 0, 0, NO_PAD_CTRL)
165
166#define MX25_PAD_D11__D11 IOMUX_PAD(0x290, 0x098, 0x00, 0, 0, NO_PAD_CTRL)
167#define MX25_PAD_D11__GPIO_4_9 IOMUX_PAD(0x290, 0x098, 0x05, 0, 0, NO_PAD_CTRL)
168
169#define MX25_PAD_D10__D10 IOMUX_PAD(0x294, 0x09c, 0x00, 0, 0, NO_PAD_CTRL)
170#define MX25_PAD_D10__GPIO_4_10 IOMUX_PAD(0x294, 0x09c, 0x05, 0, 0, NO_PAD_CTRL)
171#define MX25_PAD_D10__USBOTG_OC IOMUX_PAD(0x294, 0x09c, 0x06, 0x57c, 0, PAD_CTL_PUS_100K_UP)
172
173#define MX25_PAD_D9__D9 IOMUX_PAD(0x298, 0x0a0, 0x00, 0, 0, NO_PAD_CTRL)
174#define MX25_PAD_D9__GPIO_4_11 IOMUX_PAD(0x298, 0x0a0, 0x05, 0, 0, NO_PAD_CTRL)
175#define MX25_PAD_D9__USBH2_PWR IOMUX_PAD(0x298, 0x0a0, 0x06, 0, 0, PAD_CTL_PKE)
176
177#define MX25_PAD_D8__D8 IOMUX_PAD(0x29c, 0x0a4, 0x00, 0, 0, NO_PAD_CTRL)
178#define MX25_PAD_D8__GPIO_4_12 IOMUX_PAD(0x29c, 0x0a4, 0x05, 0, 0, NO_PAD_CTRL)
179#define MX25_PAD_D8__USBH2_OC IOMUX_PAD(0x29c, 0x0a4, 0x06, 0x580, 0, PAD_CTL_PUS_100K_UP)
180
181#define MX25_PAD_D7__D7 IOMUX_PAD(0x2a0, 0x0a8, 0x00, 0, 0, NO_PAD_CTRL)
182#define MX25_PAD_D7__GPIO_4_13 IOMUX_PAD(0x2a0, 0x0a8, 0x05, 0, 0, NO_PAD_CTRL)
183
184#define MX25_PAD_D6__D6 IOMUX_PAD(0x2a4, 0x0ac, 0x00, 0, 0, NO_PAD_CTRL)
185#define MX25_PAD_D6__GPIO_4_14 IOMUX_PAD(0x2a4, 0x0ac, 0x05, 0, 0, NO_PAD_CTRL)
186
187#define MX25_PAD_D5__D5 IOMUX_PAD(0x2a8, 0x0b0, 0x00, 0, 0, NO_PAD_CTRL)
188#define MX25_PAD_D5__GPIO_4_15 IOMUX_PAD(0x2a8, 0x0b0, 0x05, 0, 0, NO_PAD_CTRL)
189
190#define MX25_PAD_D4__D4 IOMUX_PAD(0x2ac, 0x0b4, 0x00, 0, 0, NO_PAD_CTRL)
191#define MX25_PAD_D4__GPIO_4_16 IOMUX_PAD(0x2ac, 0x0b4, 0x05, 0, 0, NO_PAD_CTRL)
192
193#define MX25_PAD_D3__D3 IOMUX_PAD(0x2b0, 0x0b8, 0x00, 0, 0, NO_PAD_CTRL)
194#define MX25_PAD_D3__GPIO_4_17 IOMUX_PAD(0x2b0, 0x0b8, 0x05, 0, 0, NO_PAD_CTRL)
195
196#define MX25_PAD_D2__D2 IOMUX_PAD(0x2b4, 0x0bc, 0x00, 0, 0, NO_PAD_CTRL)
197#define MX25_PAD_D2__GPIO_4_18 IOMUX_PAD(0x2b4, 0x0bc, 0x05, 0, 0, NO_PAD_CTRL)
198
199#define MX25_PAD_D1__D1 IOMUX_PAD(0x2b8, 0x0c0, 0x00, 0, 0, NO_PAD_CTRL)
200#define MX25_PAD_D1__GPIO_4_19 IOMUX_PAD(0x2b8, 0x0c0, 0x05, 0, 0, NO_PAD_CTRL)
201
202#define MX25_PAD_D0__D0 IOMUX_PAD(0x2bc, 0x0c4, 0x00, 0, 0, NO_PAD_CTRL)
203#define MX25_PAD_D0__GPIO_4_20 IOMUX_PAD(0x2bc, 0x0c4, 0x05, 0, 0, NO_PAD_CTRL)
204
205#define MX25_PAD_LD0__LD0 IOMUX_PAD(0x2c0, 0x0c8, 0x10, 0, 0, NO_PAD_CTRL)
206#define MX25_PAD_LD0__CSI_D0 IOMUX_PAD(0x2c0, 0x0c8, 0x12, 0x488, 0, NO_PAD_CTRL)
207#define MX25_PAD_LD0__GPIO_2_15 IOMUX_PAD(0x2c0, 0x0c8, 0x15, 0, 0, NO_PAD_CTRL)
208
209#define MX25_PAD_LD1__LD1 IOMUX_PAD(0x2c4, 0x0cc, 0x10, 0, 0, NO_PAD_CTRL)
210#define MX25_PAD_LD1__CSI_D1 IOMUX_PAD(0x2c4, 0x0cc, 0x12, 0x48c, 0, NO_PAD_CTRL)
211#define MX25_PAD_LD1__GPIO_2_16 IOMUX_PAD(0x2c4, 0x0cc, 0x15, 0, 0, NO_PAD_CTRL)
212
213#define MX25_PAD_LD2__LD2 IOMUX_PAD(0x2c8, 0x0d0, 0x10, 0, 0, NO_PAD_CTRL)
214#define MX25_PAD_LD2__GPIO_2_17 IOMUX_PAD(0x2c8, 0x0d0, 0x15, 0, 0, NO_PAD_CTRL)
215
216#define MX25_PAD_LD3__LD3 IOMUX_PAD(0x2cc, 0x0d4, 0x10, 0, 0, NO_PAD_CTRL)
217#define MX25_PAD_LD3__GPIO_2_18 IOMUX_PAD(0x2cc, 0x0d4, 0x15, 0, 0, NO_PAD_CTRL)
218
219#define MX25_PAD_LD4__LD4 IOMUX_PAD(0x2d0, 0x0d8, 0x10, 0, 0, NO_PAD_CTRL)
220#define MX25_PAD_LD4__GPIO_2_19 IOMUX_PAD(0x2d0, 0x0d8, 0x15, 0, 0, NO_PAD_CTRL)
221
222#define MX25_PAD_LD5__LD5 IOMUX_PAD(0x2d4, 0x0dc, 0x10, 0, 0, NO_PAD_CTRL)
223#define MX25_PAD_LD5__GPIO_1_19 IOMUX_PAD(0x2d4, 0x0dc, 0x15, 0, 0, NO_PAD_CTRL)
224
225#define MX25_PAD_LD6__LD6 IOMUX_PAD(0x2d8, 0x0e0, 0x10, 0, 0, NO_PAD_CTRL)
226#define MX25_PAD_LD6__GPIO_1_20 IOMUX_PAD(0x2d8, 0x0e0, 0x15, 0, 0, NO_PAD_CTRL)
227
228#define MX25_PAD_LD7__LD7 IOMUX_PAD(0x2dc, 0x0e4, 0x10, 0, 0, NO_PAD_CTRL)
229#define MX25_PAD_LD7__GPIO_1_21 IOMUX_PAD(0x2dc, 0x0e4, 0x15, 0, 0, NO_PAD_CTRL)
230
231#define MX25_PAD_LD8__LD8 IOMUX_PAD(0x2e0, 0x0e8, 0x10, 0, 0, NO_PAD_CTRL)
232#define MX25_PAD_LD8__FEC_TX_ERR IOMUX_PAD(0x2e0, 0x0e8, 0x15, 0, 0, NO_PAD_CTL)
233
234#define MX25_PAD_LD9__LD9 IOMUX_PAD(0x2e4, 0x0ec, 0x10, 0, 0, NO_PAD_CTRL)
235#define MX25_PAD_LD9__FEC_COL IOMUX_PAD(0x2e4, 0x0ec, 0x15, 0x504, 1, NO_PAD_CTL)
236
237#define MX25_PAD_LD10__LD10 IOMUX_PAD(0x2e8, 0x0f0, 0x10, 0, 0, NO_PAD_CTRL)
238#define MX25_PAD_LD10__FEC_RX_ER IOMUX_PAD(0x2e8, 0x0f0, 0x15, 0x518, 1, NO_PAD_CTL)
239
240#define MX25_PAD_LD11__LD11 IOMUX_PAD(0x2ec, 0x0f4, 0x10, 0, 0, NO_PAD_CTRL)
241#define MX25_PAD_LD11__FEC_RDATA2 IOMUX_PAD(0x2ec, 0x0f4, 0x15, 0x50c, 1, NO_PAD_CTL)
242
243#define MX25_PAD_LD12__LD12 IOMUX_PAD(0x2f0, 0x0f8, 0x10, 0, 0, NO_PAD_CTRL)
244#define MX25_PAD_LD12__FEC_RDATA3 IOMUX_PAD(0x2f0, 0x0f8, 0x15, 0x510, 1, NO_PAD_CTL)
245
246#define MX25_PAD_LD13__LD13 IOMUX_PAD(0x2f4, 0x0fc, 0x10, 0, 0, NO_PAD_CTRL)
247#define MX25_PAD_LD13__FEC_TDATA2 IOMUX_PAD(0x2f4, 0x0fc, 0x15, 0, 0, NO_PAD_CTL)
248
249#define MX25_PAD_LD14__LD14 IOMUX_PAD(0x2f8, 0x100, 0x10, 0, 0, NO_PAD_CTRL)
250#define MX25_PAD_LD14__FEC_TDATA3 IOMUX_PAD(0x2f8, 0x100, 0x15, 0, 0, NO_PAD_CTL)
251
252#define MX25_PAD_LD15__LD15 IOMUX_PAD(0x2fc, 0x104, 0x10, 0, 0, NO_PAD_CTRL)
253#define MX25_PAD_LD15__FEC_RX_CLK IOMUX_PAD(0x2fc, 0x104, 0x15, 0x514, 1, NO_PAD_CTL)
254
255#define MX25_PAD_HSYNC__HSYNC IOMUX_PAD(0x300, 0x108, 0x10, 0, 0, NO_PAD_CTRL)
256#define MX25_PAD_HSYNC__GPIO_1_22 IOMUX_PAD(0x300, 0x108, 0x15, 0, 0, NO_PAD_CTRL)
257
258#define MX25_PAD_VSYNC__VSYNC IOMUX_PAD(0x304, 0x10c, 0x10, 0, 0, NO_PAD_CTRL)
259#define MX25_PAD_VSYNC__GPIO_1_23 IOMUX_PAD(0x304, 0x10c, 0x15, 0, 0, NO_PAD_CTRL)
260
261#define MX25_PAD_LSCLK__LSCLK IOMUX_PAD(0x308, 0x110, 0x10, 0, 0, NO_PAD_CTRL)
262#define MX25_PAD_LSCLK__GPIO_1_24 IOMUX_PAD(0x308, 0x110, 0x15, 0, 0, NO_PAD_CTRL)
263
264#define MX25_PAD_OE_ACD__OE_ACD IOMUX_PAD(0x30c, 0x114, 0x10, 0, 0, NO_PAD_CTRL)
265#define MX25_PAD_OE_ACD__GPIO_1_25 IOMUX_PAD(0x30c, 0x114, 0x15, 0, 0, NO_PAD_CTRL)
266
267#define MX25_PAD_CONTRAST__CONTRAST IOMUX_PAD(0x310, 0x118, 0x10, 0, 0, NO_PAD_CTRL)
268#define MX25_PAD_CONTRAST__FEC_CRS IOMUX_PAD(0x310, 0x118, 0x15, 0x508, 1, NO_PAD_CTL)
269
270#define MX25_PAD_PWM__PWM IOMUX_PAD(0x314, 0x11c, 0x10, 0, 0, NO_PAD_CTRL)
271#define MX25_PAD_PWM__GPIO_1_26 IOMUX_PAD(0x314, 0x11c, 0x15, 0, 0, NO_PAD_CTRL)
272#define MX25_PAD_PWM__USBH2_OC IOMUX_PAD(0x314, 0x11c, 0x16, 0x580, 1, PAD_CTL_PUS_100K_UP)
273
274#define MX25_PAD_CSI_D2__CSI_D2 IOMUX_PAD(0x318, 0x120, 0x10, 0, 0, NO_PAD_CTRL)
275#define MX25_PAD_CSI_D2__UART5_RXD_MUX IOMUX_PAD(0x318, 0x120, 0x11, 0x578, 1, NO_PAD_CTRL)
276#define MX25_PAD_CSI_D2__GPIO_1_27 IOMUX_PAD(0x318, 0x120, 0x15, 0, 0, NO_PAD_CTRL)
277
278#define MX25_PAD_CSI_D3__CSI_D3 IOMUX_PAD(0x31c, 0x124, 0x10, 0, 0, NO_PAD_CTRL)
279#define MX25_PAD_CSI_D3__GPIO_1_28 IOMUX_PAD(0x31c, 0x124, 0x15, 0, 0, NO_PAD_CTRL)
280
281#define MX25_PAD_CSI_D4__CSI_D4 IOMUX_PAD(0x320, 0x128, 0x10, 0, 0, NO_PAD_CTRL)
282#define MX25_PAD_CSI_D4__UART5_RTS IOMUX_PAD(0x320, 0x128, 0x11, 0x574, 1, NO_PAD_CTRL)
283#define MX25_PAD_CSI_D4__GPIO_1_29 IOMUX_PAD(0x320, 0x128, 0x15, 0, 0, NO_PAD_CTRL)
284
285#define MX25_PAD_CSI_D5__CSI_D5 IOMUX_PAD(0x324, 0x12c, 0x10, 0, 0, NO_PAD_CTRL)
286#define MX25_PAD_CSI_D5__GPIO_1_30 IOMUX_PAD(0x324, 0x12c, 0x15, 0, 0, NO_PAD_CTRL)
287
288#define MX25_PAD_CSI_D6__CSI_D6 IOMUX_PAD(0x328, 0x130, 0x10, 0, 0, NO_PAD_CTRL)
289#define MX25_PAD_CSI_D6__GPIO_1_31 IOMUX_PAD(0x328, 0x130, 0x15, 0, 0, NO_PAD_CTRL)
290
291#define MX25_PAD_CSI_D7__CSI_D7 IOMUX_PAD(0x32c, 0x134, 0x10, 0, 0, NO_PAD_CTRL)
292#define MX25_PAD_CSI_D7__GPIO_1_6 IOMUX_PAD(0x32c, 0x134, 0x15, 0, 0, NO_PAD_CTRL)
293
294#define MX25_PAD_CSI_D8__CSI_D8 IOMUX_PAD(0x330, 0x138, 0x10, 0, 0, NO_PAD_CTRL)
295#define MX25_PAD_CSI_D8__GPIO_1_7 IOMUX_PAD(0x330, 0x138, 0x15, 0, 0, NO_PAD_CTRL)
296
297#define MX25_PAD_CSI_D9__CSI_D9 IOMUX_PAD(0x334, 0x13c, 0x10, 0, 0, NO_PAD_CTRL)
298#define MX25_PAD_CSI_D9__GPIO_4_21 IOMUX_PAD(0x334, 0x13c, 0x15, 0, 0, NO_PAD_CTRL)
299
300#define MX25_PAD_CSI_MCLK__CSI_MCLK IOMUX_PAD(0x338, 0x140, 0x10, 0, 0, NO_PAD_CTRL)
301#define MX25_PAD_CSI_MCLK__GPIO_1_8 IOMUX_PAD(0x338, 0x140, 0x15, 0, 0, NO_PAD_CTRL)
302
303#define MX25_PAD_CSI_VSYNC__CSI_VSYNC IOMUX_PAD(0x33c, 0x144, 0x10, 0, 0, NO_PAD_CTRL)
304#define MX25_PAD_CSI_VSYNC__GPIO_1_9 IOMUX_PAD(0x33c, 0x144, 0x15, 0, 0, NO_PAD_CTRL)
305
306#define MX25_PAD_CSI_HSYNC__CSI_HSYNC IOMUX_PAD(0x340, 0x148, 0x10, 0, 0, NO_PAD_CTRL)
307#define MX25_PAD_CSI_HSYNC__GPIO_1_10 IOMUX_PAD(0x340, 0x148, 0x15, 0, 0, NO_PAD_CTRL)
308
309#define MX25_PAD_CSI_PIXCLK__CSI_PIXCLK IOMUX_PAD(0x344, 0x14c, 0x10, 0, 0, NO_PAD_CTRL)
310#define MX25_PAD_CSI_PIXCLK__GPIO_1_11 IOMUX_PAD(0x344, 0x14c, 0x15, 0, 0, NO_PAD_CTRL)
311
312#define MX25_PAD_I2C1_CLK__I2C1_CLK IOMUX_PAD(0x348, 0x150, 0x10, 0, 0, NO_PAD_CTRL)
313#define MX25_PAD_I2C1_CLK__GPIO_1_12 IOMUX_PAD(0x348, 0x150, 0x15, 0, 0, NO_PAD_CTRL)
314
315#define MX25_PAD_I2C1_DAT__I2C1_DAT IOMUX_PAD(0x34c, 0x154, 0x10, 0, 0, NO_PAD_CTRL)
316#define MX25_PAD_I2C1_DAT__GPIO_1_13 IOMUX_PAD(0x34c, 0x154, 0x15, 0, 0, NO_PAD_CTRL)
317
318#define MX25_PAD_CSPI1_MOSI__CSPI1_MOSI IOMUX_PAD(0x350, 0x158, 0x10, 0, 0, NO_PAD_CTRL)
319#define MX25_PAD_CSPI1_MOSI__GPIO_1_14 IOMUX_PAD(0x350, 0x158, 0x15, 0, 0, NO_PAD_CTRL)
320
321#define MX25_PAD_CSPI1_MISO__CSPI1_MISO IOMUX_PAD(0x354, 0x15c, 0x10, 0, 0, NO_PAD_CTRL)
322#define MX25_PAD_CSPI1_MISO__GPIO_1_15 IOMUX_PAD(0x354, 0x15c, 0x15, 0, 0, NO_PAD_CTRL)
323
324#define MX25_PAD_CSPI1_SS0__CSPI1_SS0 IOMUX_PAD(0x358, 0x160, 0x10, 0, 0, NO_PAD_CTRL)
325#define MX25_PAD_CSPI1_SS0__GPIO_1_16 IOMUX_PAD(0x358, 0x160, 0x15, 0, 0, NO_PAD_CTRL)
326
327#define MX25_PAD_CSPI1_SS1__CSPI1_SS1 IOMUX_PAD(0x35c, 0x164, 0x10, 0, 0, NO_PAD_CTRL)
328#define MX25_PAD_CSPI1_SS1__GPIO_1_17 IOMUX_PAD(0x35c, 0x164, 0x15, 0, 0, NO_PAD_CTRL)
329
330#define MX25_PAD_CSPI1_SCLK__CSPI1_SCLK IOMUX_PAD(0x360, 0x168, 0x10, 0, 0, NO_PAD_CTRL)
331#define MX25_PAD_CSPI1_SCLK__GPIO_1_18 IOMUX_PAD(0x360, 0x168, 0x15, 0, 0, NO_PAD_CTRL)
332
333#define MX25_PAD_CSPI1_RDY__CSPI1_RDY IOMUX_PAD(0x364, 0x16c, 0x10, 0, 0, PAD_CTL_PKE)
334#define MX25_PAD_CSPI1_RDY__GPIO_2_22 IOMUX_PAD(0x364, 0x16c, 0x15, 0, 0, NO_PAD_CTRL)
335
336#define MX25_PAD_UART1_RXD__UART1_RXD IOMUX_PAD(0x368, 0x170, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN)
337#define MX25_PAD_UART1_RXD__GPIO_4_22 IOMUX_PAD(0x368, 0x170, 0x15, 0, 0, NO_PAD_CTRL)
338
339#define MX25_PAD_UART1_TXD__UART1_TXD IOMUX_PAD(0x36c, 0x174, 0x10, 0, 0, NO_PAD_CTRL)
340#define MX25_PAD_UART1_TXD__GPIO_4_23 IOMUX_PAD(0x36c, 0x174, 0x15, 0, 0, NO_PAD_CTRL)
341
342#define MX25_PAD_UART1_RTS__UART1_RTS IOMUX_PAD(0x370, 0x178, 0x10, 0, 0, PAD_CTL_PUS_100K_UP)
343#define MX25_PAD_UART1_RTS__CSI_D0 IOMUX_PAD(0x370, 0x178, 0x11, 0x488, 1, NO_PAD_CTRL)
344#define MX25_PAD_UART1_RTS__GPIO_4_24 IOMUX_PAD(0x370, 0x178, 0x15, 0, 0, NO_PAD_CTRL)
345
346#define MX25_PAD_UART1_CTS__UART1_CTS IOMUX_PAD(0x374, 0x17c, 0x10, 0, 0, PAD_CTL_PUS_100K_UP)
347#define MX25_PAD_UART1_CTS__CSI_D1 IOMUX_PAD(0x374, 0x17c, 0x11, 0x48c, 1, NO_PAD_CTRL)
348#define MX25_PAD_UART1_CTS__GPIO_4_25 IOMUX_PAD(0x374, 0x17c, 0x15, 0, 0, NO_PAD_CTRL)
349
350#define MX25_PAD_UART2_RXD__UART2_RXD IOMUX_PAD(0x378, 0x180, 0x10, 0, 0, NO_PAD_CTRL)
351#define MX25_PAD_UART2_RXD__GPIO_4_26 IOMUX_PAD(0x378, 0x180, 0x15, 0, 0, NO_PAD_CTRL)
352
353#define MX25_PAD_UART2_TXD__UART2_TXD IOMUX_PAD(0x37c, 0x184, 0x10, 0, 0, NO_PAD_CTRL)
354#define MX25_PAD_UART2_TXD__GPIO_4_27 IOMUX_PAD(0x37c, 0x184, 0x15, 0, 0, NO_PAD_CTRL)
355
356#define MX25_PAD_UART2_RTS__UART2_RTS IOMUX_PAD(0x380, 0x188, 0x10, 0, 0, NO_PAD_CTRL)
357#define MX25_PAD_UART2_RTS__FEC_COL IOMUX_PAD(0x380, 0x188, 0x12, 0x504, 2, NO_PAD_CTL)
358#define MX25_PAD_UART2_RTS__GPIO_4_28 IOMUX_PAD(0x380, 0x188, 0x15, 0, 0, NO_PAD_CTRL)
359
360#define MX25_PAD_UART2_CTS__FEC_RX_ER IOMUX_PAD(0x384, 0x18c, 0x12, 0x518, 2, NO_PAD_CTL)
361#define MX25_PAD_UART2_CTS__UART2_CTS IOMUX_PAD(0x384, 0x18c, 0x10, 0, 0, NO_PAD_CTRL)
362#define MX25_PAD_UART2_CTS__GPIO_4_29 IOMUX_PAD(0x384, 0x18c, 0x15, 0, 0, NO_PAD_CTRL)
363
364#define MX25_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x388, 0x190, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
365#define MX25_PAD_SD1_CMD__FEC_RDATA2 IOMUX_PAD(0x388, 0x190, 0x12, 0x50c, 2, NO_PAD_CTL)
366#define MX25_PAD_SD1_CMD__GPIO_2_23 IOMUX_PAD(0x388, 0x190, 0x15, 0, 0, NO_PAD_CTRL)
367
368#define MX25_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x38c, 0x194, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
369#define MX25_PAD_SD1_CLK__FEC_RDATA3 IOMUX_PAD(0x38c, 0x194, 0x12, 0x510, 2, NO_PAD_CTL)
370#define MX25_PAD_SD1_CLK__GPIO_2_24 IOMUX_PAD(0x38c, 0x194, 0x15, 0, 0, NO_PAD_CTRL)
371
372#define MX25_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x390, 0x198, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
373#define MX25_PAD_SD1_DATA0__GPIO_2_25 IOMUX_PAD(0x390, 0x198, 0x15, 0, 0, NO_PAD_CTRL)
374
375#define MX25_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x394, 0x19c, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
376#define MX25_PAD_SD1_DATA1__AUD7_RXD IOMUX_PAD(0x394, 0x19c, 0x13, 0x478, 0, NO_PAD_CTRL)
377#define MX25_PAD_SD1_DATA1__GPIO_2_26 IOMUX_PAD(0x394, 0x19c, 0x15, 0, 0, NO_PAD_CTRL)
378
379#define MX25_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x398, 0x1a0, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
380#define MX25_PAD_SD1_DATA2__FEC_RX_CLK IOMUX_PAD(0x398, 0x1a0, 0x15, 0x514, 2, NO_PAD_CTL)
381#define MX25_PAD_SD1_DATA2__GPIO_2_27 IOMUX_PAD(0x398, 0x1a0, 0x15, 0, 0, NO_PAD_CTRL)
382
383#define MX25_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x39c, 0x1a4, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
384#define MX25_PAD_SD1_DATA3__FEC_CRS IOMUX_PAD(0x39c, 0x1a4, 0x10, 0x508, 2, NO_PAD_CTL)
385#define MX25_PAD_SD1_DATA3__GPIO_2_28 IOMUX_PAD(0x39c, 0x1a4, 0x15, 0, 0, NO_PAD_CTRL)
386
387#define MX25_PAD_KPP_ROW0__KPP_ROW0 IOMUX_PAD(0x3a0, 0x1a8, 0x10, 0, 0, PAD_CTL_PKE)
388#define MX25_PAD_KPP_ROW0__GPIO_2_29 IOMUX_PAD(0x3a0, 0x1a8, 0x15, 0, 0, NO_PAD_CTRL)
389
390#define MX25_PAD_KPP_ROW1__KPP_ROW1 IOMUX_PAD(0x3a4, 0x1ac, 0x10, 0, 0, PAD_CTL_PKE)
391#define MX25_PAD_KPP_ROW1__GPIO_2_30 IOMUX_PAD(0x3a4, 0x1ac, 0x15, 0, 0, NO_PAD_CTRL)
392
393#define MX25_PAD_KPP_ROW2__KPP_ROW2 IOMUX_PAD(0x3a8, 0x1b0, 0x10, 0, 0, PAD_CTL_PKE)
394#define MX25_PAD_KPP_ROW2__CSI_D0 IOMUX_PAD(0x3a8, 0x1b0, 0x13, 0x488, 2, NO_PAD_CTRL)
395#define MX25_PAD_KPP_ROW2__GPIO_2_31 IOMUX_PAD(0x3a8, 0x1b0, 0x15, 0, 0, NO_PAD_CTRL)
396
397#define MX25_PAD_KPP_ROW3__KPP_ROW3 IOMUX_PAD(0x3ac, 0x1b4, 0x10, 0, 0, PAD_CTL_PKE)
398#define MX25_PAD_KPP_ROW3__CSI_LD1 IOMUX_PAD(0x3ac, 0x1b4, 0x13, 0x48c, 2, NO_PAD_CTRL)
399#define MX25_PAD_KPP_ROW3__GPIO_3_0 IOMUX_PAD(0x3ac, 0x1b4, 0x15, 0, 0, NO_PAD_CTRL)
400
401#define MX25_PAD_KPP_COL0__KPP_COL0 IOMUX_PAD(0x3b0, 0x1b8, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE)
402#define MX25_PAD_KPP_COL0__GPIO_3_1 IOMUX_PAD(0x3b0, 0x1b8, 0x15, 0, 0, NO_PAD_CTRL)
403
404#define MX25_PAD_KPP_COL1__KPP_COL1 IOMUX_PAD(0x3b4, 0x1bc, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE)
405#define MX25_PAD_KPP_COL1__GPIO_3_2 IOMUX_PAD(0x3b4, 0x1bc, 0x15, 0, 0, NO_PAD_CTRL)
406
407#define MX25_PAD_KPP_COL2__KPP_COL2 IOMUX_PAD(0x3b8, 0x1c0, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE)
408#define MX25_PAD_KPP_COL2__GPIO_3_3 IOMUX_PAD(0x3b8, 0x1c0, 0x15, 0, 0, NO_PAD_CTRL)
409
410#define MX25_PAD_KPP_COL3__KPP_COL3 IOMUX_PAD(0x3bc, 0x1c4, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE)
411#define MX25_PAD_KPP_COL3__GPIO_3_4 IOMUX_PAD(0x3bc, 0x1c4, 0x15, 0, 0, NO_PAD_CTRL)
412
413#define MX25_PAD_FEC_MDC__FEC_MDC IOMUX_PAD(0x3c0, 0x1c8, 0x10, 0, 0, NO_PAD_CTL)
414#define MX25_PAD_FEC_MDC__AUD4_TXD IOMUX_PAD(0x3c0, 0x1c8, 0x12, 0x464, 1, NO_PAD_CTRL)
415#define MX25_PAD_FEC_MDC__GPIO_3_5 IOMUX_PAD(0x3c0, 0x1c8, 0x15, 0, 0, NO_PAD_CTRL)
416
417#define MX25_PAD_FEC_MDIO__FEC_MDIO IOMUX_PAD(0x3c4, 0x1cc, 0x10, 0, 0, PAD_CTL_HYS | PAD_CTL_PUS_22K_UP)
418#define MX25_PAD_FEC_MDIO__AUD4_RXD IOMUX_PAD(0x3c4, 0x1cc, 0x12, 0x460, 1, NO_PAD_CTRL)
419#define MX25_PAD_FEC_MDIO__GPIO_3_6 IOMUX_PAD(0x3c4, 0x1cc, 0x15, 0, 0, NO_PAD_CTRL)
420
421#define MX25_PAD_FEC_TDATA0__FEC_TDATA0 IOMUX_PAD(0x3c8, 0x1d0, 0x10, 0, 0, NO_PAD_CTL)
422#define MX25_PAD_FEC_TDATA0__GPIO_3_7 IOMUX_PAD(0x3c8, 0x1d0, 0x15, 0, 0, NO_PAD_CTRL)
423
424#define MX25_PAD_FEC_TDATA1__FEC_TDATA1 IOMUX_PAD(0x3cc, 0x1d4, 0x10, 0, 0, NO_PAD_CTL)
425#define MX25_PAD_FEC_TDATA1__AUD4_TXFS IOMUX_PAD(0x3cc, 0x1d4, 0x12, 0x474, 1, NO_PAD_CTRL)
426#define MX25_PAD_FEC_TDATA1__GPIO_3_8 IOMUX_PAD(0x3cc, 0x1d4, 0x15, 0, 0, NO_PAD_CTRL)
427
428#define MX25_PAD_FEC_TX_EN__FEC_TX_EN IOMUX_PAD(0x3d0, 0x1d8, 0x10, 0, 0, NO_PAD_CTL)
429#define MX25_PAD_FEC_TX_EN__GPIO_3_9 IOMUX_PAD(0x3d0, 0x1d8, 0x15, 0, 0, NO_PAD_CTRL)
430
431#define MX25_PAD_FEC_RDATA0__FEC_RDATA0 IOMUX_PAD(0x3d4, 0x1dc, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL)
432#define MX25_PAD_FEC_RDATA0__GPIO_3_10 IOMUX_PAD(0x3d4, 0x1dc, 0x15, 0, 0, NO_PAD_CTRL)
433
434#define MX25_PAD_FEC_RDATA1__FEC_RDATA1 IOMUX_PAD(0x3d8, 0x1e0, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL)
435#define MX25_PAD_FEC_RDATA1__GPIO_3_11 IOMUX_PAD(0x3d8, 0x1e0, 0x15, 0, 0, NO_PAD_CTRL)
436
437#define MX25_PAD_FEC_RX_DV__FEC_RX_DV IOMUX_PAD(0x3dc, 0x1e4, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL)
438#define MX25_PAD_FEC_RX_DV__CAN2_RX IOMUX_PAD(0x3dc, 0x1e4, 0x14, 0x484, 0, PAD_CTL_PUS_22K_UP)
439#define MX25_PAD_FEC_RX_DV__GPIO_3_12 IOMUX_PAD(0x3dc, 0x1e4, 0x15, 0, 0, NO_PAD_CTRL)
440
441#define MX25_PAD_FEC_TX_CLK__FEC_TX_CLK IOMUX_PAD(0x3e0, 0x1e8, 0x10, 0, 0, PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN)
442#define MX25_PAD_FEC_TX_CLK__GPIO_3_13 IOMUX_PAD(0x3e0, 0x1e8, 0x15, 0, 0, NO_PAD_CTRL)
443
444#define MX25_PAD_RTCK__RTCK IOMUX_PAD(0x3e4, 0x1ec, 0x10, 0, 0, NO_PAD_CTRL)
445#define MX25_PAD_RTCK__OWIRE IOMUX_PAD(0x3e4, 0x1ec, 0x11, 0, 0, NO_PAD_CTRL)
446#define MX25_PAD_RTCK__GPIO_3_14 IOMUX_PAD(0x3e4, 0x1ec, 0x15, 0, 0, NO_PAD_CTRL)
447
448#define MX25_PAD_DE_B__DE_B IOMUX_PAD(0x3ec, 0x1f0, 0x10, 0, 0, NO_PAD_CTRL)
449#define MX25_PAD_DE_B__GPIO_2_20 IOMUX_PAD(0x3ec, 0x1f0, 0x15, 0, 0, NO_PAD_CTRL)
450
451#define MX25_PAD_TDO__TDO IOMUX_PAD(0x3e8, 0x000, 0x00, 0, 0, NO_PAD_CTRL)
452
453#define MX25_PAD_GPIO_A__GPIO_A IOMUX_PAD(0x3f0, 0x1f4, 0x10, 0, 0, NO_PAD_CTRL)
454#define MX25_PAD_GPIO_A__CAN1_TX IOMUX_PAD(0x3f0, 0x1f4, 0x16, 0, 0, PAD_CTL_PUS_22K_UP)
455#define MX25_PAD_GPIO_A__USBOTG_PWR IOMUX_PAD(0x3f0, 0x1f4, 0x12, 0, 0, PAD_CTL_PKE)
456
457#define MX25_PAD_GPIO_B__GPIO_B IOMUX_PAD(0x3f4, 0x1f8, 0x10, 0, 0, NO_PAD_CTRL)
458#define MX25_PAD_GPIO_B__CAN1_RX IOMUX_PAD(0x3f4, 0x1f8, 0x16, 0x480, 1, PAD_CTL_PUS_22K)
459#define MX25_PAD_GPIO_B__USBOTG_OC IOMUX_PAD(0x3f4, 0x1f8, 0x12, 0x57c, 1, PAD_CTL_PUS_100K_UP)
460
461#define MX25_PAD_GPIO_C__GPIO_C IOMUX_PAD(0x3f8, 0x1fc, 0x10, 0, 0, NO_PAD_CTRL)
462#define MX25_PAD_GPIO_C__CAN2_TX IOMUX_PAD(0x3f8, 0x1fc, 0x16, 0, 0, PAD_CTL_PUS_22K_UP)
463
464#define MX25_PAD_GPIO_D__GPIO_D IOMUX_PAD(0x3fc, 0x200, 0x10, 0, 0, NO_PAD_CTRL)
465#define MX25_PAD_GPIO_D__CAN2_RX IOMUX_PAD(0x3fc, 0x200, 0x16, 0x484, 1, PAD_CTL_PUS_22K_UP)
466
467#define MX25_PAD_GPIO_E__GPIO_E IOMUX_PAD(0x400, 0x204, 0x10, 0, 0, NO_PAD_CTRL)
468#define MX25_PAD_GPIO_E__AUD7_TXD IOMUX_PAD(0x400, 0x204, 0x14, 0, 0, NO_PAD_CTRL)
469
470#define MX25_PAD_GPIO_F__GPIO_F IOMUX_PAD(0x404, 0x208, 0x10, 0, 0, NO_PAD_CTRL)
471#define MX25_PAD_GPIO_F__AUD7_TXC IOMUX_PAD(0x404, 0x208, 0x14, 0, 0, NO_PAD_CTRL)
472
473#define MX25_PAD_EXT_ARMCLK__EXT_ARMCLK IOMUX_PAD(0x000, 0x20c, 0x10, 0, 0, NO_PAD_CTRL)
474#define MX25_PAD_EXT_ARMCLK__GPIO_3_15 IOMUX_PAD(0x000, 0x20c, 0x15, 0, 0, NO_PAD_CTRL)
475
476#define MX25_PAD_UPLL_BYPCLK__UPLL_BYPCLK IOMUX_PAD(0x000, 0x210, 0x10, 0, 0, NO_PAD_CTRL)
477#define MX25_PAD_UPLL_BYPCLK__GPIO_3_16 IOMUX_PAD(0x000, 0x210, 0x15, 0, 0, NO_PAD_CTRL)
478
479#define MX25_PAD_VSTBY_REQ__VSTBY_REQ IOMUX_PAD(0x408, 0x214, 0x10, 0, 0, NO_PAD_CTRL)
480#define MX25_PAD_VSTBY_REQ__AUD7_TXFS IOMUX_PAD(0x408, 0x214, 0x14, 0, 0, NO_PAD_CTRL)
481#define MX25_PAD_VSTBY_REQ__GPIO_3_17 IOMUX_PAD(0x408, 0x214, 0x15, 0, 0, NO_PAD_CTRL)
482#define MX25_PAD_VSTBY_ACK__VSTBY_ACK IOMUX_PAD(0x40c, 0x218, 0x10, 0, 0, NO_PAD_CTRL)
483#define MX25_PAD_VSTBY_ACK__GPIO_3_18 IOMUX_PAD(0x40c, 0x218, 0x15, 0, 0, NO_PAD_CTRL)
484
485#define MX25_PAD_POWER_FAIL__POWER_FAIL IOMUX_PAD(0x410, 0x21c, 0x10, 0, 0, NO_PAD_CTRL)
486#define MX25_PAD_POWER_FAIL__AUD7_RXD IOMUX_PAD(0x410, 0x21c, 0x14, 0x478, 1, NO_PAD_CTRL)
487#define MX25_PAD_POWER_FAIL__GPIO_3_19 IOMUX_PAD(0x410, 0x21c, 0x15, 0, 0, NO_PAD_CTRL)
488
489#define MX25_PAD_CLKO__CLKO IOMUX_PAD(0x414, 0x220, 0x10, 0, 0, NO_PAD_CTRL)
490#define MX25_PAD_CLKO__GPIO_2_21 IOMUX_PAD(0x414, 0x220, 0x15, 0, 0, NO_PAD_CTRL)
491
492#define MX25_PAD_BOOT_MODE0__BOOT_MODE0 IOMUX_PAD(0x000, 0x224, 0x00, 0, 0, NO_PAD_CTRL)
493#define MX25_PAD_BOOT_MODE0__GPIO_4_30 IOMUX_PAD(0x000, 0x224, 0x05, 0, 0, NO_PAD_CTRL)
494#define MX25_PAD_BOOT_MODE1__BOOT_MODE1 IOMUX_PAD(0x000, 0x228, 0x00, 0, 0, NO_PAD_CTRL)
495#define MX25_PAD_BOOT_MODE1__GPIO_4_31 IOMUX_PAD(0x000, 0x228, 0x05, 0, 0, NO_PAD_CTRL)
496
497#define MX25_PAD_CTL_GRP_DVS_MISC IOMUX_PAD(0x418, 0x000, 0, 0, 0, NO_PAD_CTRL)
498#define MX25_PAD_CTL_GRP_DSE_FEC IOMUX_PAD(0x41c, 0x000, 0, 0, 0, NO_PAD_CTRL)
499#define MX25_PAD_CTL_GRP_DVS_JTAG IOMUX_PAD(0x420, 0x000, 0, 0, 0, NO_PAD_CTRL)
500#define MX25_PAD_CTL_GRP_DSE_NFC IOMUX_PAD(0x424, 0x000, 0, 0, 0, NO_PAD_CTRL)
501#define MX25_PAD_CTL_GRP_DSE_CSI IOMUX_PAD(0x428, 0x000, 0, 0, 0, NO_PAD_CTRL)
502#define MX25_PAD_CTL_GRP_DSE_WEIM IOMUX_PAD(0x42c, 0x000, 0, 0, 0, NO_PAD_CTRL)
503#define MX25_PAD_CTL_GRP_DSE_DDR IOMUX_PAD(0x430, 0x000, 0, 0, 0, NO_PAD_CTRL)
504#define MX25_PAD_CTL_GRP_DVS_CRM IOMUX_PAD(0x434, 0x000, 0, 0, 0, NO_PAD_CTRL)
505#define MX25_PAD_CTL_GRP_DSE_KPP IOMUX_PAD(0x438, 0x000, 0, 0, 0, NO_PAD_CTRL)
506#define MX25_PAD_CTL_GRP_DSE_SDHC1 IOMUX_PAD(0x43c, 0x000, 0, 0, 0, NO_PAD_CTRL)
507#define MX25_PAD_CTL_GRP_DSE_LCD IOMUX_PAD(0x440, 0x000, 0, 0, 0, NO_PAD_CTRL)
508#define MX25_PAD_CTL_GRP_DSE_UART IOMUX_PAD(0x444, 0x000, 0, 0, 0, NO_PAD_CTRL)
509#define MX25_PAD_CTL_GRP_DVS_NFC IOMUX_PAD(0x448, 0x000, 0, 0, 0, NO_PAD_CTRL)
510#define MX25_PAD_CTL_GRP_DVS_CSI IOMUX_PAD(0x44c, 0x000, 0, 0, 0, NO_PAD_CTRL)
511#define MX25_PAD_CTL_GRP_DSE_CSPI1 IOMUX_PAD(0x450, 0x000, 0, 0, 0, NO_PAD_CTRL)
512#define MX25_PAD_CTL_GRP_DDRTYPE IOMUX_PAD(0x454, 0x000, 0, 0, 0, NO_PAD_CTRL)
513#define MX25_PAD_CTL_GRP_DVS_SDHC1 IOMUX_PAD(0x458, 0x000, 0, 0, 0, NO_PAD_CTRL)
514#define MX25_PAD_CTL_GRP_DVS_LCD IOMUX_PAD(0x45c, 0x000, 0, 0, 0, NO_PAD_CTRL)
515
516#endif // __ASSEMBLY__
517#endif // __IOMUX_MX25_H__
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx3.h b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
index 27f8d1b2bc6b..446f86763816 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
@@ -602,6 +602,8 @@ enum iomux_pins {
602#define MX31_PIN_I2C_DAT__SDA IOMUX_MODE(MX31_PIN_I2C_DAT, IOMUX_CONFIG_FUNC) 602#define MX31_PIN_I2C_DAT__SDA IOMUX_MODE(MX31_PIN_I2C_DAT, IOMUX_CONFIG_FUNC)
603#define MX31_PIN_DCD_DTE1__I2C2_SDA IOMUX_MODE(MX31_PIN_DCD_DTE1, IOMUX_CONFIG_ALT2) 603#define MX31_PIN_DCD_DTE1__I2C2_SDA IOMUX_MODE(MX31_PIN_DCD_DTE1, IOMUX_CONFIG_ALT2)
604#define MX31_PIN_RI_DTE1__I2C2_SCL IOMUX_MODE(MX31_PIN_RI_DTE1, IOMUX_CONFIG_ALT2) 604#define MX31_PIN_RI_DTE1__I2C2_SCL IOMUX_MODE(MX31_PIN_RI_DTE1, IOMUX_CONFIG_ALT2)
605#define MX31_PIN_CSPI2_SS2__I2C3_SDA IOMUX_MODE(MX31_PIN_CSPI2_SS2, IOMUX_CONFIG_ALT1)
606#define MX31_PIN_CSPI2_SCLK__I2C3_SCL IOMUX_MODE(MX31_PIN_CSPI2_SCLK, IOMUX_CONFIG_ALT1)
605#define MX31_PIN_CSI_D4__CSI_D4 IOMUX_MODE(MX31_PIN_CSI_D4, IOMUX_CONFIG_FUNC) 607#define MX31_PIN_CSI_D4__CSI_D4 IOMUX_MODE(MX31_PIN_CSI_D4, IOMUX_CONFIG_FUNC)
606#define MX31_PIN_CSI_D5__CSI_D5 IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_FUNC) 608#define MX31_PIN_CSI_D5__CSI_D5 IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_FUNC)
607#define MX31_PIN_CSI_D6__CSI_D6 IOMUX_MODE(MX31_PIN_CSI_D6, IOMUX_CONFIG_FUNC) 609#define MX31_PIN_CSI_D6__CSI_D6 IOMUX_MODE(MX31_PIN_CSI_D6, IOMUX_CONFIG_FUNC)
@@ -633,6 +635,19 @@ enum iomux_pins {
633#define MX31_PIN_USBOTG_DIR__USBOTG_DIR IOMUX_MODE(MX31_PIN_USBOTG_DIR, IOMUX_CONFIG_FUNC) 635#define MX31_PIN_USBOTG_DIR__USBOTG_DIR IOMUX_MODE(MX31_PIN_USBOTG_DIR, IOMUX_CONFIG_FUNC)
634#define MX31_PIN_USBOTG_NXT__USBOTG_NXT IOMUX_MODE(MX31_PIN_USBOTG_NXT, IOMUX_CONFIG_FUNC) 636#define MX31_PIN_USBOTG_NXT__USBOTG_NXT IOMUX_MODE(MX31_PIN_USBOTG_NXT, IOMUX_CONFIG_FUNC)
635#define MX31_PIN_USBOTG_STP__USBOTG_STP IOMUX_MODE(MX31_PIN_USBOTG_STP, IOMUX_CONFIG_FUNC) 637#define MX31_PIN_USBOTG_STP__USBOTG_STP IOMUX_MODE(MX31_PIN_USBOTG_STP, IOMUX_CONFIG_FUNC)
638#define MX31_PIN_CSPI1_MOSI__USBH1_RXDM IOMUX_MODE(MX31_PIN_CSPI1_MOSI, IOMUX_CONFIG_ALT1)
639#define MX31_PIN_CSPI1_MISO__USBH1_RXDP IOMUX_MODE(MX31_PIN_CSPI1_MISO, IOMUX_CONFIG_ALT1)
640#define MX31_PIN_CSPI1_SS0__USBH1_TXDM IOMUX_MODE(MX31_PIN_CSPI1_SS0, IOMUX_CONFIG_ALT1)
641#define MX31_PIN_CSPI1_SS1__USBH1_TXDP IOMUX_MODE(MX31_PIN_CSPI1_SS1, IOMUX_CONFIG_ALT1)
642#define MX31_PIN_CSPI1_SS2__USBH1_RCV IOMUX_MODE(MX31_PIN_CSPI1_SS2, IOMUX_CONFIG_ALT1)
643#define MX31_PIN_CSPI1_SCLK__USBH1_OEB IOMUX_MODE(MX31_PIN_CSPI1_SCLK, IOMUX_CONFIG_ALT1)
644#define MX31_PIN_CSPI1_SPI_RDY__USBH1_FS IOMUX_MODE(MX31_PIN_CSPI1_SPI_RDY, IOMUX_CONFIG_ALT1)
645#define MX31_PIN_USBH2_DATA0__USBH2_DATA0 IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC)
646#define MX31_PIN_USBH2_DATA1__USBH2_DATA1 IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC)
647#define MX31_PIN_USBH2_CLK__USBH2_CLK IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC)
648#define MX31_PIN_USBH2_DIR__USBH2_DIR IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC)
649#define MX31_PIN_USBH2_NXT__USBH2_NXT IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC)
650#define MX31_PIN_USBH2_STP__USBH2_STP IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC)
636#define MX31_PIN_USB_OC__GPIO1_30 IOMUX_MODE(MX31_PIN_USB_OC, IOMUX_CONFIG_GPIO) 651#define MX31_PIN_USB_OC__GPIO1_30 IOMUX_MODE(MX31_PIN_USB_OC, IOMUX_CONFIG_GPIO)
637#define MX31_PIN_I2C_DAT__I2C1_SDA IOMUX_MODE(MX31_PIN_I2C_DAT, IOMUX_CONFIG_FUNC) 652#define MX31_PIN_I2C_DAT__I2C1_SDA IOMUX_MODE(MX31_PIN_I2C_DAT, IOMUX_CONFIG_FUNC)
638#define MX31_PIN_I2C_CLK__I2C1_SCL IOMUX_MODE(MX31_PIN_I2C_CLK, IOMUX_CONFIG_FUNC) 653#define MX31_PIN_I2C_CLK__I2C1_SCL IOMUX_MODE(MX31_PIN_I2C_CLK, IOMUX_CONFIG_FUNC)
@@ -667,6 +682,18 @@ enum iomux_pins {
667#define MX31_PIN_GPIO3_0__GPIO3_0 IOMUX_MODE(MX31_PIN_GPIO3_0, IOMUX_CONFIG_GPIO) 682#define MX31_PIN_GPIO3_0__GPIO3_0 IOMUX_MODE(MX31_PIN_GPIO3_0, IOMUX_CONFIG_GPIO)
668#define MX31_PIN_GPIO3_1__GPIO3_1 IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO) 683#define MX31_PIN_GPIO3_1__GPIO3_1 IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO)
669#define MX31_PIN_TXD2__GPIO1_28 IOMUX_MODE(MX31_PIN_TXD2, IOMUX_CONFIG_GPIO) 684#define MX31_PIN_TXD2__GPIO1_28 IOMUX_MODE(MX31_PIN_TXD2, IOMUX_CONFIG_GPIO)
685#define MX31_PIN_GPIO1_0__GPIO1_0 IOMUX_MODE(MX31_PIN_GPIO1_0, IOMUX_CONFIG_GPIO)
686#define MX31_PIN_SVEN0__GPIO2_0 IOMUX_MODE(MX31_PIN_SVEN0, IOMUX_CONFIG_GPIO)
687#define MX31_PIN_STX0__GPIO2_1 IOMUX_MODE(MX31_PIN_STX0, IOMUX_CONFIG_GPIO)
688#define MX31_PIN_SRX0__GPIO2_2 IOMUX_MODE(MX31_PIN_SRX0, IOMUX_CONFIG_GPIO)
689#define MX31_PIN_SIMPD0__GPIO2_3 IOMUX_MODE(MX31_PIN_SIMPD0, IOMUX_CONFIG_GPIO)
690#define MX31_PIN_DTR_DCE1__GPIO2_8 IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO)
691#define MX31_PIN_DSR_DCE1__GPIO2_9 IOMUX_MODE(MX31_PIN_DSR_DCE1, IOMUX_CONFIG_GPIO)
692#define MX31_PIN_RI_DCE1__GPIO2_10 IOMUX_MODE(MX31_PIN_RI_DCE1, IOMUX_CONFIG_GPIO)
693#define MX31_PIN_DCD_DCE1__GPIO2_11 IOMUX_MODE(MX31_PIN_DCD_DCE1, IOMUX_CONFIG_GPIO)
694#define MX31_PIN_STXD5__GPIO1_21 IOMUX_MODE(MX31_PIN_STXD5, IOMUX_CONFIG_GPIO)
695#define MX31_PIN_SRXD5__GPIO1_22 IOMUX_MODE(MX31_PIN_SRXD5, IOMUX_CONFIG_GPIO)
696
670 697
671/*XXX: The SS0, SS1, SS2, SS3 lines of spi3 are multiplexed by cspi2_ss0, cspi2_ss1, cspi1_ss0 698/*XXX: The SS0, SS1, SS2, SS3 lines of spi3 are multiplexed by cspi2_ss0, cspi2_ss1, cspi1_ss0
672 * cspi1_ss1*/ 699 * cspi1_ss1*/
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mxc91231.h b/arch/arm/plat-mxc/include/mach/iomux-mxc91231.h
new file mode 100644
index 000000000000..9f13061192c8
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/iomux-mxc91231.h
@@ -0,0 +1,287 @@
1/*
2 * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
4 * Copyright (C) 2009 by Dmitriy Taychenachev <dimichxp@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_IOMUX_MXC91231_H__
22#define __MACH_IOMUX_MXC91231_H__
23
24/*
25 * various IOMUX output functions
26 */
27
28#define IOMUX_OCONFIG_GPIO (0 << 4) /* used as GPIO */
29#define IOMUX_OCONFIG_FUNC (1 << 4) /* used as function */
30#define IOMUX_OCONFIG_ALT1 (2 << 4) /* used as alternate function 1 */
31#define IOMUX_OCONFIG_ALT2 (3 << 4) /* used as alternate function 2 */
32#define IOMUX_OCONFIG_ALT3 (4 << 4) /* used as alternate function 3 */
33#define IOMUX_OCONFIG_ALT4 (5 << 4) /* used as alternate function 4 */
34#define IOMUX_OCONFIG_ALT5 (6 << 4) /* used as alternate function 5 */
35#define IOMUX_OCONFIG_ALT6 (7 << 4) /* used as alternate function 6 */
36#define IOMUX_ICONFIG_NONE 0 /* not configured for input */
37#define IOMUX_ICONFIG_GPIO 1 /* used as GPIO */
38#define IOMUX_ICONFIG_FUNC 2 /* used as function */
39#define IOMUX_ICONFIG_ALT1 4 /* used as alternate function 1 */
40#define IOMUX_ICONFIG_ALT2 8 /* used as alternate function 2 */
41
42#define IOMUX_CONFIG_GPIO (IOMUX_OCONFIG_GPIO | IOMUX_ICONFIG_GPIO)
43#define IOMUX_CONFIG_FUNC (IOMUX_OCONFIG_FUNC | IOMUX_ICONFIG_FUNC)
44#define IOMUX_CONFIG_ALT1 (IOMUX_OCONFIG_ALT1 | IOMUX_ICONFIG_ALT1)
45#define IOMUX_CONFIG_ALT2 (IOMUX_OCONFIG_ALT2 | IOMUX_ICONFIG_ALT2)
46
47/*
48 * setups a single pin:
49 * - reserves the pin so that it is not claimed by another driver
50 * - setups the iomux according to the configuration
51 * - if the pin is configured as a GPIO, we claim it throug kernel gpiolib
52 */
53int mxc_iomux_alloc_pin(const unsigned int pin_mode, const char *label);
54/*
55 * setups mutliple pins
56 * convenient way to call the above function with tables
57 */
58int mxc_iomux_setup_multiple_pins(unsigned int *pin_list, unsigned count,
59 const char *label);
60
61/*
62 * releases a single pin:
63 * - make it available for a future use by another driver
64 * - frees the GPIO if the pin was configured as GPIO
65 * - DOES NOT reconfigure the IOMUX in its reset state
66 */
67void mxc_iomux_release_pin(const unsigned int pin_mode);
68/*
69 * releases multiple pins
70 * convenvient way to call the above function with tables
71 */
72void mxc_iomux_release_multiple_pins(unsigned int *pin_list, int count);
73
74#define MUX_SIDE_AP (0)
75#define MUX_SIDE_SP (1)
76
77#define MUX_SIDE_SHIFT (26)
78#define MUX_SIDE_MASK (0x1 << MUX_SIDE_SHIFT)
79
80#define MUX_GPIO_PORT_SHIFT (23)
81#define MUX_GPIO_PORT_MASK (0x7 << MUX_GPIO_PORT_SHIFT)
82
83#define MUX_GPIO_PIN_SHIFT (20)
84#define MUX_GPIO_PIN_MASK (0x1f << MUX_GPIO_PIN_SHIFT)
85
86#define MUX_REG_SHIFT (15)
87#define MUX_REG_MASK (0x1f << MUX_REG_SHIFT)
88
89#define MUX_FIELD_SHIFT (13)
90#define MUX_FIELD_MASK (0x3 << MUX_FIELD_SHIFT)
91
92#define MUX_PADGRP_SHIFT (8)
93#define MUX_PADGRP_MASK (0x1f << MUX_PADGRP_SHIFT)
94
95#define MUX_PIN_MASK (0xffffff << 8)
96
97#define GPIO_PORT_MAX (3)
98
99#define IOMUX_PIN(side, gport, gpin, ctlreg, ctlfield, padgrp) \
100 (((side) << MUX_SIDE_SHIFT) | \
101 (gport << MUX_GPIO_PORT_SHIFT) | \
102 ((gpin) << MUX_GPIO_PIN_SHIFT) | \
103 ((ctlreg) << MUX_REG_SHIFT) | \
104 ((ctlfield) << MUX_FIELD_SHIFT) | \
105 ((padgrp) << MUX_PADGRP_SHIFT))
106
107#define MUX_MODE_OUT_SHIFT (4)
108#define MUX_MODE_IN_SHIFT (0)
109#define MUX_MODE_SHIFT (0)
110#define MUX_MODE_MASK (0xff << MUX_MODE_SHIFT)
111
112#define IOMUX_MODE(pin, mode) \
113 (pin | (mode << MUX_MODE_SHIFT))
114
115enum iomux_pins {
116 /* AP Side pins */
117 MXC91231_PIN_AP_CLE = IOMUX_PIN(0, 0, 0, 0, 0, 24),
118 MXC91231_PIN_AP_ALE = IOMUX_PIN(0, 0, 1, 0, 1, 24),
119 MXC91231_PIN_AP_CE_B = IOMUX_PIN(0, 0, 2, 0, 2, 24),
120 MXC91231_PIN_AP_RE_B = IOMUX_PIN(0, 0, 3, 0, 3, 24),
121 MXC91231_PIN_AP_WE_B = IOMUX_PIN(0, 0, 4, 1, 0, 24),
122 MXC91231_PIN_AP_WP_B = IOMUX_PIN(0, 0, 5, 1, 1, 24),
123 MXC91231_PIN_AP_BSY_B = IOMUX_PIN(0, 0, 6, 1, 2, 24),
124 MXC91231_PIN_AP_U1_TXD = IOMUX_PIN(0, 0, 7, 1, 3, 28),
125 MXC91231_PIN_AP_U1_RXD = IOMUX_PIN(0, 0, 8, 2, 0, 28),
126 MXC91231_PIN_AP_U1_RTS_B = IOMUX_PIN(0, 0, 9, 2, 1, 28),
127 MXC91231_PIN_AP_U1_CTS_B = IOMUX_PIN(0, 0, 10, 2, 2, 28),
128 MXC91231_PIN_AP_AD1_TXD = IOMUX_PIN(0, 0, 11, 2, 3, 9),
129 MXC91231_PIN_AP_AD1_RXD = IOMUX_PIN(0, 0, 12, 3, 0, 9),
130 MXC91231_PIN_AP_AD1_TXC = IOMUX_PIN(0, 0, 13, 3, 1, 9),
131 MXC91231_PIN_AP_AD1_TXFS = IOMUX_PIN(0, 0, 14, 3, 2, 9),
132 MXC91231_PIN_AP_AD2_TXD = IOMUX_PIN(0, 0, 15, 3, 3, 9),
133 MXC91231_PIN_AP_AD2_RXD = IOMUX_PIN(0, 0, 16, 4, 0, 9),
134 MXC91231_PIN_AP_AD2_TXC = IOMUX_PIN(0, 0, 17, 4, 1, 9),
135 MXC91231_PIN_AP_AD2_TXFS = IOMUX_PIN(0, 0, 18, 4, 2, 9),
136 MXC91231_PIN_AP_OWDAT = IOMUX_PIN(0, 0, 19, 4, 3, 28),
137 MXC91231_PIN_AP_IPU_LD17 = IOMUX_PIN(0, 0, 20, 5, 0, 28),
138 MXC91231_PIN_AP_IPU_D3_VSYNC = IOMUX_PIN(0, 0, 21, 5, 1, 28),
139 MXC91231_PIN_AP_IPU_D3_HSYNC = IOMUX_PIN(0, 0, 22, 5, 2, 28),
140 MXC91231_PIN_AP_IPU_D3_CLK = IOMUX_PIN(0, 0, 23, 5, 3, 28),
141 MXC91231_PIN_AP_IPU_D3_DRDY = IOMUX_PIN(0, 0, 24, 6, 0, 28),
142 MXC91231_PIN_AP_IPU_D3_CONTR = IOMUX_PIN(0, 0, 25, 6, 1, 28),
143 MXC91231_PIN_AP_IPU_D0_CS = IOMUX_PIN(0, 0, 26, 6, 2, 28),
144 MXC91231_PIN_AP_IPU_LD16 = IOMUX_PIN(0, 0, 27, 6, 3, 28),
145 MXC91231_PIN_AP_IPU_D2_CS = IOMUX_PIN(0, 0, 28, 7, 0, 28),
146 MXC91231_PIN_AP_IPU_PAR_RS = IOMUX_PIN(0, 0, 29, 7, 1, 28),
147 MXC91231_PIN_AP_IPU_D3_PS = IOMUX_PIN(0, 0, 30, 7, 2, 28),
148 MXC91231_PIN_AP_IPU_D3_CLS = IOMUX_PIN(0, 0, 31, 7, 3, 28),
149 MXC91231_PIN_AP_IPU_RD = IOMUX_PIN(0, 1, 0, 8, 0, 28),
150 MXC91231_PIN_AP_IPU_WR = IOMUX_PIN(0, 1, 1, 8, 1, 28),
151 MXC91231_PIN_AP_IPU_LD0 = IOMUX_PIN(0, 7, 0, 8, 2, 28),
152 MXC91231_PIN_AP_IPU_LD1 = IOMUX_PIN(0, 7, 0, 8, 3, 28),
153 MXC91231_PIN_AP_IPU_LD2 = IOMUX_PIN(0, 7, 0, 9, 0, 28),
154 MXC91231_PIN_AP_IPU_LD3 = IOMUX_PIN(0, 1, 2, 9, 1, 28),
155 MXC91231_PIN_AP_IPU_LD4 = IOMUX_PIN(0, 1, 3, 9, 2, 28),
156 MXC91231_PIN_AP_IPU_LD5 = IOMUX_PIN(0, 1, 4, 9, 3, 28),
157 MXC91231_PIN_AP_IPU_LD6 = IOMUX_PIN(0, 1, 5, 10, 0, 28),
158 MXC91231_PIN_AP_IPU_LD7 = IOMUX_PIN(0, 1, 6, 10, 1, 28),
159 MXC91231_PIN_AP_IPU_LD8 = IOMUX_PIN(0, 1, 7, 10, 2, 28),
160 MXC91231_PIN_AP_IPU_LD9 = IOMUX_PIN(0, 1, 8, 10, 3, 28),
161 MXC91231_PIN_AP_IPU_LD10 = IOMUX_PIN(0, 1, 9, 11, 0, 28),
162 MXC91231_PIN_AP_IPU_LD11 = IOMUX_PIN(0, 1, 10, 11, 1, 28),
163 MXC91231_PIN_AP_IPU_LD12 = IOMUX_PIN(0, 1, 11, 11, 2, 28),
164 MXC91231_PIN_AP_IPU_LD13 = IOMUX_PIN(0, 1, 12, 11, 3, 28),
165 MXC91231_PIN_AP_IPU_LD14 = IOMUX_PIN(0, 1, 13, 12, 0, 28),
166 MXC91231_PIN_AP_IPU_LD15 = IOMUX_PIN(0, 1, 14, 12, 1, 28),
167 MXC91231_PIN_AP_KPROW4 = IOMUX_PIN(0, 7, 0, 12, 2, 10),
168 MXC91231_PIN_AP_KPROW5 = IOMUX_PIN(0, 1, 16, 12, 3, 10),
169 MXC91231_PIN_AP_GPIO_AP_B17 = IOMUX_PIN(0, 1, 17, 13, 0, 10),
170 MXC91231_PIN_AP_GPIO_AP_B18 = IOMUX_PIN(0, 1, 18, 13, 1, 10),
171 MXC91231_PIN_AP_KPCOL3 = IOMUX_PIN(0, 1, 19, 13, 2, 11),
172 MXC91231_PIN_AP_KPCOL4 = IOMUX_PIN(0, 1, 20, 13, 3, 11),
173 MXC91231_PIN_AP_KPCOL5 = IOMUX_PIN(0, 1, 21, 14, 0, 11),
174 MXC91231_PIN_AP_GPIO_AP_B22 = IOMUX_PIN(0, 1, 22, 14, 1, 11),
175 MXC91231_PIN_AP_GPIO_AP_B23 = IOMUX_PIN(0, 1, 23, 14, 2, 11),
176 MXC91231_PIN_AP_CSI_D0 = IOMUX_PIN(0, 1, 24, 14, 3, 21),
177 MXC91231_PIN_AP_CSI_D1 = IOMUX_PIN(0, 1, 25, 15, 0, 21),
178 MXC91231_PIN_AP_CSI_D2 = IOMUX_PIN(0, 1, 26, 15, 1, 21),
179 MXC91231_PIN_AP_CSI_D3 = IOMUX_PIN(0, 1, 27, 15, 2, 21),
180 MXC91231_PIN_AP_CSI_D4 = IOMUX_PIN(0, 1, 28, 15, 3, 21),
181 MXC91231_PIN_AP_CSI_D5 = IOMUX_PIN(0, 1, 29, 16, 0, 21),
182 MXC91231_PIN_AP_CSI_D6 = IOMUX_PIN(0, 1, 30, 16, 1, 21),
183 MXC91231_PIN_AP_CSI_D7 = IOMUX_PIN(0, 1, 31, 16, 2, 21),
184 MXC91231_PIN_AP_CSI_D8 = IOMUX_PIN(0, 2, 0, 16, 3, 21),
185 MXC91231_PIN_AP_CSI_D9 = IOMUX_PIN(0, 2, 1, 17, 0, 21),
186 MXC91231_PIN_AP_CSI_MCLK = IOMUX_PIN(0, 2, 2, 17, 1, 21),
187 MXC91231_PIN_AP_CSI_VSYNC = IOMUX_PIN(0, 2, 3, 17, 2, 21),
188 MXC91231_PIN_AP_CSI_HSYNC = IOMUX_PIN(0, 2, 4, 17, 3, 21),
189 MXC91231_PIN_AP_CSI_PIXCLK = IOMUX_PIN(0, 2, 5, 18, 0, 21),
190 MXC91231_PIN_AP_I2CLK = IOMUX_PIN(0, 2, 6, 18, 1, 12),
191 MXC91231_PIN_AP_I2DAT = IOMUX_PIN(0, 2, 7, 18, 2, 12),
192 MXC91231_PIN_AP_GPIO_AP_C8 = IOMUX_PIN(0, 2, 8, 18, 3, 9),
193 MXC91231_PIN_AP_GPIO_AP_C9 = IOMUX_PIN(0, 2, 9, 19, 0, 9),
194 MXC91231_PIN_AP_GPIO_AP_C10 = IOMUX_PIN(0, 2, 10, 19, 1, 9),
195 MXC91231_PIN_AP_GPIO_AP_C11 = IOMUX_PIN(0, 2, 11, 19, 2, 9),
196 MXC91231_PIN_AP_GPIO_AP_C12 = IOMUX_PIN(0, 2, 12, 19, 3, 9),
197 MXC91231_PIN_AP_GPIO_AP_C13 = IOMUX_PIN(0, 2, 13, 20, 0, 28),
198 MXC91231_PIN_AP_GPIO_AP_C14 = IOMUX_PIN(0, 2, 14, 20, 1, 28),
199 MXC91231_PIN_AP_GPIO_AP_C15 = IOMUX_PIN(0, 2, 15, 20, 2, 9),
200 MXC91231_PIN_AP_GPIO_AP_C16 = IOMUX_PIN(0, 2, 16, 20, 3, 9),
201 MXC91231_PIN_AP_GPIO_AP_C17 = IOMUX_PIN(0, 2, 17, 21, 0, 9),
202 MXC91231_PIN_AP_ED_INT0 = IOMUX_PIN(0, 2, 18, 21, 1, 22),
203 MXC91231_PIN_AP_ED_INT1 = IOMUX_PIN(0, 2, 19, 21, 2, 22),
204 MXC91231_PIN_AP_ED_INT2 = IOMUX_PIN(0, 2, 20, 21, 3, 22),
205 MXC91231_PIN_AP_ED_INT3 = IOMUX_PIN(0, 2, 21, 22, 0, 22),
206 MXC91231_PIN_AP_ED_INT4 = IOMUX_PIN(0, 2, 22, 22, 1, 23),
207 MXC91231_PIN_AP_ED_INT5 = IOMUX_PIN(0, 2, 23, 22, 2, 23),
208 MXC91231_PIN_AP_ED_INT6 = IOMUX_PIN(0, 2, 24, 22, 3, 23),
209 MXC91231_PIN_AP_ED_INT7 = IOMUX_PIN(0, 2, 25, 23, 0, 23),
210 MXC91231_PIN_AP_U2_DSR_B = IOMUX_PIN(0, 2, 26, 23, 1, 28),
211 MXC91231_PIN_AP_U2_RI_B = IOMUX_PIN(0, 2, 27, 23, 2, 28),
212 MXC91231_PIN_AP_U2_CTS_B = IOMUX_PIN(0, 2, 28, 23, 3, 28),
213 MXC91231_PIN_AP_U2_DTR_B = IOMUX_PIN(0, 2, 29, 24, 0, 28),
214 MXC91231_PIN_AP_KPROW0 = IOMUX_PIN(0, 7, 0, 24, 1, 10),
215 MXC91231_PIN_AP_KPROW1 = IOMUX_PIN(0, 1, 15, 24, 2, 10),
216 MXC91231_PIN_AP_KPROW2 = IOMUX_PIN(0, 7, 0, 24, 3, 10),
217 MXC91231_PIN_AP_KPROW3 = IOMUX_PIN(0, 7, 0, 25, 0, 10),
218 MXC91231_PIN_AP_KPCOL0 = IOMUX_PIN(0, 7, 0, 25, 1, 11),
219 MXC91231_PIN_AP_KPCOL1 = IOMUX_PIN(0, 7, 0, 25, 2, 11),
220 MXC91231_PIN_AP_KPCOL2 = IOMUX_PIN(0, 7, 0, 25, 3, 11),
221
222 /* Shared pins */
223 MXC91231_PIN_SP_U3_TXD = IOMUX_PIN(1, 3, 0, 0, 0, 28),
224 MXC91231_PIN_SP_U3_RXD = IOMUX_PIN(1, 3, 1, 0, 1, 28),
225 MXC91231_PIN_SP_U3_RTS_B = IOMUX_PIN(1, 3, 2, 0, 2, 28),
226 MXC91231_PIN_SP_U3_CTS_B = IOMUX_PIN(1, 3, 3, 0, 3, 28),
227 MXC91231_PIN_SP_USB_TXOE_B = IOMUX_PIN(1, 3, 4, 1, 0, 28),
228 MXC91231_PIN_SP_USB_DAT_VP = IOMUX_PIN(1, 3, 5, 1, 1, 28),
229 MXC91231_PIN_SP_USB_SE0_VM = IOMUX_PIN(1, 3, 6, 1, 2, 28),
230 MXC91231_PIN_SP_USB_RXD = IOMUX_PIN(1, 3, 7, 1, 3, 28),
231 MXC91231_PIN_SP_UH2_TXOE_B = IOMUX_PIN(1, 3, 8, 2, 0, 28),
232 MXC91231_PIN_SP_UH2_SPEED = IOMUX_PIN(1, 3, 9, 2, 1, 28),
233 MXC91231_PIN_SP_UH2_SUSPEN = IOMUX_PIN(1, 3, 10, 2, 2, 28),
234 MXC91231_PIN_SP_UH2_TXDP = IOMUX_PIN(1, 3, 11, 2, 3, 28),
235 MXC91231_PIN_SP_UH2_RXDP = IOMUX_PIN(1, 3, 12, 3, 0, 28),
236 MXC91231_PIN_SP_UH2_RXDM = IOMUX_PIN(1, 3, 13, 3, 1, 28),
237 MXC91231_PIN_SP_UH2_OVR = IOMUX_PIN(1, 3, 14, 3, 2, 28),
238 MXC91231_PIN_SP_UH2_PWR = IOMUX_PIN(1, 3, 15, 3, 3, 28),
239 MXC91231_PIN_SP_SD1_DAT0 = IOMUX_PIN(1, 3, 16, 4, 0, 25),
240 MXC91231_PIN_SP_SD1_DAT1 = IOMUX_PIN(1, 3, 17, 4, 1, 25),
241 MXC91231_PIN_SP_SD1_DAT2 = IOMUX_PIN(1, 3, 18, 4, 2, 25),
242 MXC91231_PIN_SP_SD1_DAT3 = IOMUX_PIN(1, 3, 19, 4, 3, 25),
243 MXC91231_PIN_SP_SD1_CMD = IOMUX_PIN(1, 3, 20, 5, 0, 25),
244 MXC91231_PIN_SP_SD1_CLK = IOMUX_PIN(1, 3, 21, 5, 1, 25),
245 MXC91231_PIN_SP_SD2_DAT0 = IOMUX_PIN(1, 3, 22, 5, 2, 26),
246 MXC91231_PIN_SP_SD2_DAT1 = IOMUX_PIN(1, 3, 23, 5, 3, 26),
247 MXC91231_PIN_SP_SD2_DAT2 = IOMUX_PIN(1, 3, 24, 6, 0, 26),
248 MXC91231_PIN_SP_SD2_DAT3 = IOMUX_PIN(1, 3, 25, 6, 1, 26),
249 MXC91231_PIN_SP_GPIO_SP_A26 = IOMUX_PIN(1, 3, 26, 6, 2, 28),
250 MXC91231_PIN_SP_SPI1_CLK = IOMUX_PIN(1, 3, 27, 6, 3, 13),
251 MXC91231_PIN_SP_SPI1_MOSI = IOMUX_PIN(1, 3, 28, 7, 0, 13),
252 MXC91231_PIN_SP_SPI1_MISO = IOMUX_PIN(1, 3, 29, 7, 1, 13),
253 MXC91231_PIN_SP_SPI1_SS0 = IOMUX_PIN(1, 3, 30, 7, 2, 13),
254 MXC91231_PIN_SP_SPI1_SS1 = IOMUX_PIN(1, 3, 31, 7, 3, 13),
255 MXC91231_PIN_SP_SD2_CMD = IOMUX_PIN(1, 7, 0, 8, 0, 26),
256 MXC91231_PIN_SP_SD2_CLK = IOMUX_PIN(1, 7, 0, 8, 1, 26),
257 MXC91231_PIN_SP_SIM1_RST_B = IOMUX_PIN(1, 2, 30, 8, 2, 28),
258 MXC91231_PIN_SP_SIM1_SVEN = IOMUX_PIN(1, 7, 0, 8, 3, 28),
259 MXC91231_PIN_SP_SIM1_CLK = IOMUX_PIN(1, 7, 0, 9, 0, 28),
260 MXC91231_PIN_SP_SIM1_TRXD = IOMUX_PIN(1, 7, 0, 9, 1, 28),
261 MXC91231_PIN_SP_SIM1_PD = IOMUX_PIN(1, 2, 31, 9, 2, 28),
262 MXC91231_PIN_SP_UH2_TXDM = IOMUX_PIN(1, 7, 0, 9, 3, 28),
263 MXC91231_PIN_SP_UH2_RXD = IOMUX_PIN(1, 7, 0, 10, 0, 28),
264};
265
266#define PIN_AP_MAX (104)
267#define PIN_SP_MAX (41)
268
269#define PIN_MAX (PIN_AP_MAX + PIN_SP_MAX)
270
271/*
272 * Convenience values for use with mxc_iomux_mode()
273 *
274 * Format here is MXC91231_PIN_(pin name)__(function)
275 */
276
277#define MXC91231_PIN_SP_USB_DAT_VP__USB_DAT_VP \
278 IOMUX_MODE(MXC91231_PIN_SP_USB_DAT_VP, IOMUX_CONFIG_FUNC)
279#define MXC91231_PIN_SP_USB_SE0_VM__USB_SE0_VM \
280 IOMUX_MODE(MXC91231_PIN_SP_USB_SE0_VM, IOMUX_CONFIG_FUNC)
281#define MXC91231_PIN_SP_USB_DAT_VP__RXD2 \
282 IOMUX_MODE(MXC91231_PIN_SP_USB_DAT_VP, IOMUX_CONFIG_ALT1)
283#define MXC91231_PIN_SP_USB_SE0_VM__TXD2 \
284 IOMUX_MODE(MXC91231_PIN_SP_USB_SE0_VM, IOMUX_CONFIG_ALT1)
285
286
287#endif /* __MACH_IOMUX_MXC91231_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v3.h b/arch/arm/plat-mxc/include/mach/iomux-v3.h
index 7cd84547658f..a0fa40265468 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-v3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-v3.h
@@ -68,28 +68,24 @@ struct pad_desc {
68/* 68/*
69 * Use to set PAD control 69 * Use to set PAD control
70 */ 70 */
71#define PAD_CTL_DRIVE_VOLTAGE_3_3_V 0
72#define PAD_CTL_DRIVE_VOLTAGE_1_8_V 1
73 71
74#define PAD_CTL_NO_HYSTERESIS 0 72#define PAD_CTL_DVS (1 << 13)
75#define PAD_CTL_HYSTERESIS 1 73#define PAD_CTL_HYS (1 << 8)
76 74
77#define PAD_CTL_PULL_DISABLED 0x0 75#define PAD_CTL_PKE (1 << 7)
78#define PAD_CTL_PULL_KEEPER 0xa 76#define PAD_CTL_PUE (1 << 6)
79#define PAD_CTL_PULL_DOWN_100K 0xc 77#define PAD_CTL_PUS_100K_DOWN (0 << 4)
80#define PAD_CTL_PULL_UP_47K 0xd 78#define PAD_CTL_PUS_47K_UP (1 << 4)
81#define PAD_CTL_PULL_UP_100K 0xe 79#define PAD_CTL_PUS_100K_UP (2 << 4)
82#define PAD_CTL_PULL_UP_22K 0xf 80#define PAD_CTL_PUS_22K_UP (3 << 4)
83 81
84#define PAD_CTL_OUTPUT_CMOS 0 82#define PAD_CTL_ODE (1 << 3)
85#define PAD_CTL_OUTPUT_OPEN_DRAIN 1
86 83
87#define PAD_CTL_DRIVE_STRENGTH_NORM 0 84#define PAD_CTL_DSE_STANDARD (0 << 1)
88#define PAD_CTL_DRIVE_STRENGTH_HIGH 1 85#define PAD_CTL_DSE_HIGH (1 << 1)
89#define PAD_CTL_DRIVE_STRENGTH_MAX 2 86#define PAD_CTL_DSE_MAX (2 << 1)
90 87
91#define PAD_CTL_SLEW_RATE_SLOW 0 88#define PAD_CTL_SRE_FAST (1 << 0)
92#define PAD_CTL_SLEW_RATE_FAST 1
93 89
94/* 90/*
95 * setups a single pad: 91 * setups a single pad:
@@ -117,5 +113,10 @@ void mxc_iomux_v3_release_pad(struct pad_desc *pad);
117 */ 113 */
118void mxc_iomux_v3_release_multiple_pads(struct pad_desc *pad_list, int count); 114void mxc_iomux_v3_release_multiple_pads(struct pad_desc *pad_list, int count);
119 115
116/*
117 * Initialise the iomux controller
118 */
119void mxc_iomux_v3_init(void __iomem *iomux_v3_base);
120
120#endif /* __MACH_IOMUX_V3_H__*/ 121#endif /* __MACH_IOMUX_V3_H__*/
121 122
diff --git a/arch/arm/plat-mxc/include/mach/iomux.h b/arch/arm/plat-mxc/include/mach/iomux.h
index 171f8adc1109..6d49f8ae3259 100644
--- a/arch/arm/plat-mxc/include/mach/iomux.h
+++ b/arch/arm/plat-mxc/include/mach/iomux.h
@@ -49,6 +49,9 @@
49#ifdef CONFIG_ARCH_MX2 49#ifdef CONFIG_ARCH_MX2
50# define GPIO_PORT_MAX 5 50# define GPIO_PORT_MAX 5
51#endif 51#endif
52#ifdef CONFIG_ARCH_MX25
53# define GPIO_PORT_MAX 3
54#endif
52 55
53#ifndef GPIO_PORT_MAX 56#ifndef GPIO_PORT_MAX
54# error "GPIO config port count unknown!" 57# error "GPIO config port count unknown!"
@@ -107,6 +110,9 @@
107#include <mach/iomux-mx27.h> 110#include <mach/iomux-mx27.h>
108#endif 111#endif
109#endif 112#endif
113#ifdef CONFIG_ARCH_MX25
114#include <mach/iomux-mx25.h>
115#endif
110 116
111 117
112/* decode irq number to use with IMR(x), ISR(x) and friends */ 118/* decode irq number to use with IMR(x), ISR(x) and friends */
diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
index 518a36504b88..ead9d592168d 100644
--- a/arch/arm/plat-mxc/include/mach/irqs.h
+++ b/arch/arm/plat-mxc/include/mach/irqs.h
@@ -24,6 +24,10 @@
24#define MXC_GPIO_IRQS (32 * 6) 24#define MXC_GPIO_IRQS (32 * 6)
25#elif defined CONFIG_ARCH_MX3 25#elif defined CONFIG_ARCH_MX3
26#define MXC_GPIO_IRQS (32 * 3) 26#define MXC_GPIO_IRQS (32 * 3)
27#elif defined CONFIG_ARCH_MX25
28#define MXC_GPIO_IRQS (32 * 4)
29#elif defined CONFIG_ARCH_MXC91231
30#define MXC_GPIO_IRQS (32 * 4)
27#endif 31#endif
28 32
29/* 33/*
diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
index 6065e00176ed..d3afafdcc0e5 100644
--- a/arch/arm/plat-mxc/include/mach/memory.h
+++ b/arch/arm/plat-mxc/include/mach/memory.h
@@ -22,6 +22,10 @@
22#endif 22#endif
23#elif defined CONFIG_ARCH_MX3 23#elif defined CONFIG_ARCH_MX3
24#define PHYS_OFFSET UL(0x80000000) 24#define PHYS_OFFSET UL(0x80000000)
25#elif defined CONFIG_ARCH_MX25
26#define PHYS_OFFSET UL(0x80000000)
27#elif defined CONFIG_ARCH_MXC91231
28#define PHYS_OFFSET UL(0x90000000)
25#endif 29#endif
26 30
27#if defined(CONFIG_MX1_VIDEO) 31#if defined(CONFIG_MX1_VIDEO)
diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/plat-mxc/include/mach/mx1.h
index 1000bf330bcd..1b2890a5c452 100644
--- a/arch/arm/plat-mxc/include/mach/mx1.h
+++ b/arch/arm/plat-mxc/include/mach/mx1.h
@@ -12,10 +12,6 @@
12#ifndef __ASM_ARCH_MXC_MX1_H__ 12#ifndef __ASM_ARCH_MXC_MX1_H__
13#define __ASM_ARCH_MXC_MX1_H__ 13#define __ASM_ARCH_MXC_MX1_H__
14 14
15#ifndef __ASM_ARCH_MXC_HARDWARE_H__
16#error "Do not include directly."
17#endif
18
19#include <mach/vmalloc.h> 15#include <mach/vmalloc.h>
20 16
21/* 17/*
@@ -138,20 +134,6 @@
138#define GPIO_INT_PORTD 62 134#define GPIO_INT_PORTD 62
139#define WDT_INT 63 135#define WDT_INT 63
140 136
141/* gpio and gpio based interrupt handling */
142#define GPIO_DR 0x1C
143#define GPIO_GDIR 0x00
144#define GPIO_PSR 0x24
145#define GPIO_ICR1 0x28
146#define GPIO_ICR2 0x2C
147#define GPIO_IMR 0x30
148#define GPIO_ISR 0x34
149#define GPIO_INT_LOW_LEV 0x3
150#define GPIO_INT_HIGH_LEV 0x2
151#define GPIO_INT_RISE_EDGE 0x0
152#define GPIO_INT_FALL_EDGE 0x1
153#define GPIO_INT_NONE 0x4
154
155/* DMA */ 137/* DMA */
156#define DMA_REQ_UART3_T 2 138#define DMA_REQ_UART3_T 2
157#define DMA_REQ_UART3_R 3 139#define DMA_REQ_UART3_R 3
@@ -179,8 +161,4 @@
179#define DMA_REQ_UART1_T 30 161#define DMA_REQ_UART1_T 30
180#define DMA_REQ_UART1_R 31 162#define DMA_REQ_UART1_R 31
181 163
182/* mandatory for CONFIG_DEBUG_LL */
183#define MXC_LL_UART_PADDR UART1_BASE_ADDR
184#define MXC_LL_UART_VADDR IO_ADDRESS(UART1_BASE_ADDR)
185
186#endif /* __ASM_ARCH_MXC_MX1_H__ */ 164#endif /* __ASM_ARCH_MXC_MX1_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx21.h b/arch/arm/plat-mxc/include/mach/mx21.h
index 8b070a041a99..21112c695ec5 100644
--- a/arch/arm/plat-mxc/include/mach/mx21.h
+++ b/arch/arm/plat-mxc/include/mach/mx21.h
@@ -25,11 +25,6 @@
25#ifndef __ASM_ARCH_MXC_MX21_H__ 25#ifndef __ASM_ARCH_MXC_MX21_H__
26#define __ASM_ARCH_MXC_MX21_H__ 26#define __ASM_ARCH_MXC_MX21_H__
27 27
28#ifndef __ASM_ARCH_MXC_HARDWARE_H__
29#error "Do not include directly."
30#endif
31
32
33/* Memory regions and CS */ 28/* Memory regions and CS */
34#define SDRAM_BASE_ADDR 0xC0000000 29#define SDRAM_BASE_ADDR 0xC0000000
35#define CSD1_BASE_ADDR 0xC4000000 30#define CSD1_BASE_ADDR 0xC4000000
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h
new file mode 100644
index 000000000000..ec64bd9a8ab1
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mx25.h
@@ -0,0 +1,44 @@
1#ifndef __MACH_MX25_H__
2#define __MACH_MX25_H__
3
4#define MX25_AIPS1_BASE_ADDR 0x43F00000
5#define MX25_AIPS1_BASE_ADDR_VIRT 0xFC000000
6#define MX25_AIPS1_SIZE SZ_1M
7#define MX25_AIPS2_BASE_ADDR 0x53F00000
8#define MX25_AIPS2_BASE_ADDR_VIRT 0xFC200000
9#define MX25_AIPS2_SIZE SZ_1M
10#define MX25_AVIC_BASE_ADDR 0x68000000
11#define MX25_AVIC_BASE_ADDR_VIRT 0xFC400000
12#define MX25_AVIC_SIZE SZ_1M
13
14#define MX25_IOMUXC_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0xac000)
15
16#define MX25_CRM_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0x80000)
17#define MX25_GPT1_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0x90000)
18#define MX25_WDOG_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xdc000)
19
20#define MX25_GPIO1_BASE_ADDR_VIRT (MX25_AIPS2_BASE_ADDR_VIRT + 0xcc000)
21#define MX25_GPIO2_BASE_ADDR_VIRT (MX25_AIPS2_BASE_ADDR_VIRT + 0xd0000)
22#define MX25_GPIO3_BASE_ADDR_VIRT (MX25_AIPS2_BASE_ADDR_VIRT + 0xa4000)
23#define MX25_GPIO4_BASE_ADDR_VIRT (MX25_AIPS2_BASE_ADDR_VIRT + 0x9c000)
24
25#define MX25_AIPS1_IO_ADDRESS(x) \
26 (((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
27#define MX25_AIPS2_IO_ADDRESS(x) \
28 (((x) - MX25_AIPS2_BASE_ADDR) + MX25_AIPS2_BASE_ADDR_VIRT)
29#define MX25_AVIC_IO_ADDRESS(x) \
30 (((x) - MX25_AVIC_BASE_ADDR) + MX25_AVIC_BASE_ADDR_VIRT)
31
32#define __in_range(addr, name) ((addr) >= name##_BASE_ADDR && (addr) < name##_BASE_ADDR + name##_SIZE)
33
34#define MX25_IO_ADDRESS(x) \
35 (void __force __iomem *) \
36 (__in_range(x, MX25_AIPS1) ? MX25_AIPS1_IO_ADDRESS(x) : \
37 __in_range(x, MX25_AIPS2) ? MX25_AIPS2_IO_ADDRESS(x) : \
38 __in_range(x, MX25_AVIC) ? MX25_AVIC_IO_ADDRESS(x) : \
39 0xDEADBEEF)
40
41#define UART1_BASE_ADDR 0x43f90000
42#define UART2_BASE_ADDR 0x43f94000
43
44#endif /* __MACH_MX25_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
index 6e93f2c0b7bb..dc3ad9aa952a 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -24,10 +24,6 @@
24#ifndef __ASM_ARCH_MXC_MX27_H__ 24#ifndef __ASM_ARCH_MXC_MX27_H__
25#define __ASM_ARCH_MXC_MX27_H__ 25#define __ASM_ARCH_MXC_MX27_H__
26 26
27#ifndef __ASM_ARCH_MXC_HARDWARE_H__
28#error "Do not include directly."
29#endif
30
31/* IRAM */ 27/* IRAM */
32#define IRAM_BASE_ADDR 0xFFFF4C00 /* internal ram */ 28#define IRAM_BASE_ADDR 0xFFFF4C00 /* internal ram */
33 29
@@ -120,7 +116,4 @@ extern int mx27_revision(void);
120 116
121/* Mandatory defines used globally */ 117/* Mandatory defines used globally */
122 118
123/* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */
124#define ARCH_NR_GPIOS (192 + 16)
125
126#endif /* __ASM_ARCH_MXC_MX27_H__ */ 119#endif /* __ASM_ARCH_MXC_MX27_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx2x.h b/arch/arm/plat-mxc/include/mach/mx2x.h
index fc40d3ab8c5b..db5d921e0fe6 100644
--- a/arch/arm/plat-mxc/include/mach/mx2x.h
+++ b/arch/arm/plat-mxc/include/mach/mx2x.h
@@ -23,10 +23,6 @@
23#ifndef __ASM_ARCH_MXC_MX2x_H__ 23#ifndef __ASM_ARCH_MXC_MX2x_H__
24#define __ASM_ARCH_MXC_MX2x_H__ 24#define __ASM_ARCH_MXC_MX2x_H__
25 25
26#ifndef __ASM_ARCH_MXC_HARDWARE_H__
27#error "Do not include directly."
28#endif
29
30/* The following addresses are common between i.MX21 and i.MX27 */ 26/* The following addresses are common between i.MX21 and i.MX27 */
31 27
32/* Register offests */ 28/* Register offests */
@@ -154,20 +150,6 @@
154#define MXC_INT_GPIO 8 150#define MXC_INT_GPIO 8
155#define MXC_INT_CSPI3 6 151#define MXC_INT_CSPI3 6
156 152
157/* gpio and gpio based interrupt handling */
158#define GPIO_DR 0x1C
159#define GPIO_GDIR 0x00
160#define GPIO_PSR 0x24
161#define GPIO_ICR1 0x28
162#define GPIO_ICR2 0x2C
163#define GPIO_IMR 0x30
164#define GPIO_ISR 0x34
165#define GPIO_INT_LOW_LEV 0x3
166#define GPIO_INT_HIGH_LEV 0x2
167#define GPIO_INT_RISE_EDGE 0x0
168#define GPIO_INT_FALL_EDGE 0x1
169#define GPIO_INT_NONE 0x4
170
171/* fixed DMA request numbers */ 153/* fixed DMA request numbers */
172#define DMA_REQ_CSI_RX 31 154#define DMA_REQ_CSI_RX 31
173#define DMA_REQ_CSI_STAT 30 155#define DMA_REQ_CSI_STAT 30
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index 0b06941b6139..14ac0dcc82f4 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -4,7 +4,7 @@
4#define MX31_IRAM_BASE_ADDR 0x1FFC0000 /* internal ram */ 4#define MX31_IRAM_BASE_ADDR 0x1FFC0000 /* internal ram */
5#define MX31_IRAM_SIZE SZ_16K 5#define MX31_IRAM_SIZE SZ_16K
6 6
7#define OTG_BASE_ADDR (AIPS1_BASE_ADDR + 0x00088000) 7#define MX31_OTG_BASE_ADDR (AIPS1_BASE_ADDR + 0x00088000)
8#define ATA_BASE_ADDR (AIPS1_BASE_ADDR + 0x0008C000) 8#define ATA_BASE_ADDR (AIPS1_BASE_ADDR + 0x0008C000)
9#define UART4_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B0000) 9#define UART4_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B0000)
10#define UART5_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B4000) 10#define UART5_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B4000)
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h
index 6465fefb42e3..ab4cfec6c8ab 100644
--- a/arch/arm/plat-mxc/include/mach/mx35.h
+++ b/arch/arm/plat-mxc/include/mach/mx35.h
@@ -5,6 +5,7 @@
5#define MX35_IRAM_SIZE SZ_128K 5#define MX35_IRAM_SIZE SZ_128K
6 6
7#define MXC_FEC_BASE_ADDR 0x50038000 7#define MXC_FEC_BASE_ADDR 0x50038000
8#define MX35_OTG_BASE_ADDR 0x53ff4000
8#define MX35_NFC_BASE_ADDR 0xBB000000 9#define MX35_NFC_BASE_ADDR 0xBB000000
9 10
10/* 11/*
diff --git a/arch/arm/plat-mxc/include/mach/mx3x.h b/arch/arm/plat-mxc/include/mach/mx3x.h
index b559a4bb5769..009f4440276b 100644
--- a/arch/arm/plat-mxc/include/mach/mx3x.h
+++ b/arch/arm/plat-mxc/include/mach/mx3x.h
@@ -11,10 +11,6 @@
11#ifndef __ASM_ARCH_MXC_MX31_H__ 11#ifndef __ASM_ARCH_MXC_MX31_H__
12#define __ASM_ARCH_MXC_MX31_H__ 12#define __ASM_ARCH_MXC_MX31_H__
13 13
14#ifndef __ASM_ARCH_MXC_HARDWARE_H__
15#error "Do not include directly."
16#endif
17
18/* 14/*
19 * MX31 memory map: 15 * MX31 memory map:
20 * 16 *
@@ -263,25 +259,8 @@
263#define SYSTEM_REV_MIN CHIP_REV_1_0 259#define SYSTEM_REV_MIN CHIP_REV_1_0
264#define SYSTEM_REV_NUM 3 260#define SYSTEM_REV_NUM 3
265 261
266/* gpio and gpio based interrupt handling */
267#define GPIO_DR 0x00
268#define GPIO_GDIR 0x04
269#define GPIO_PSR 0x08
270#define GPIO_ICR1 0x0C
271#define GPIO_ICR2 0x10
272#define GPIO_IMR 0x14
273#define GPIO_ISR 0x18
274#define GPIO_INT_LOW_LEV 0x0
275#define GPIO_INT_HIGH_LEV 0x1
276#define GPIO_INT_RISE_EDGE 0x2
277#define GPIO_INT_FALL_EDGE 0x3
278#define GPIO_INT_NONE 0x4
279
280/* Mandatory defines used globally */ 262/* Mandatory defines used globally */
281 263
282/* this CPU supports up to 96 GPIOs */
283#define ARCH_NR_GPIOS 96
284
285#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS) 264#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
286 265
287extern unsigned int system_rev; 266extern unsigned int system_rev;
diff --git a/arch/arm/plat-mxc/include/mach/mxc.h b/arch/arm/plat-mxc/include/mach/mxc.h
index 5fa2a07f4eaf..51990536b845 100644
--- a/arch/arm/plat-mxc/include/mach/mxc.h
+++ b/arch/arm/plat-mxc/include/mach/mxc.h
@@ -26,9 +26,11 @@
26 26
27#define MXC_CPU_MX1 1 27#define MXC_CPU_MX1 1
28#define MXC_CPU_MX21 21 28#define MXC_CPU_MX21 21
29#define MXC_CPU_MX25 25
29#define MXC_CPU_MX27 27 30#define MXC_CPU_MX27 27
30#define MXC_CPU_MX31 31 31#define MXC_CPU_MX31 31
31#define MXC_CPU_MX35 35 32#define MXC_CPU_MX35 35
33#define MXC_CPU_MXC91231 91231
32 34
33#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
34extern unsigned int __mxc_cpu_type; 36extern unsigned int __mxc_cpu_type;
@@ -58,6 +60,18 @@ extern unsigned int __mxc_cpu_type;
58# define cpu_is_mx21() (0) 60# define cpu_is_mx21() (0)
59#endif 61#endif
60 62
63#ifdef CONFIG_ARCH_MX25
64# ifdef mxc_cpu_type
65# undef mxc_cpu_type
66# define mxc_cpu_type __mxc_cpu_type
67# else
68# define mxc_cpu_type MXC_CPU_MX25
69# endif
70# define cpu_is_mx25() (mxc_cpu_type == MXC_CPU_MX25)
71#else
72# define cpu_is_mx25() (0)
73#endif
74
61#ifdef CONFIG_MACH_MX27 75#ifdef CONFIG_MACH_MX27
62# ifdef mxc_cpu_type 76# ifdef mxc_cpu_type
63# undef mxc_cpu_type 77# undef mxc_cpu_type
@@ -94,13 +108,25 @@ extern unsigned int __mxc_cpu_type;
94# define cpu_is_mx35() (0) 108# define cpu_is_mx35() (0)
95#endif 109#endif
96 110
111#ifdef CONFIG_ARCH_MXC91231
112# ifdef mxc_cpu_type
113# undef mxc_cpu_type
114# define mxc_cpu_type __mxc_cpu_type
115# else
116# define mxc_cpu_type MXC_CPU_MXC91231
117# endif
118# define cpu_is_mxc91231() (mxc_cpu_type == MXC_CPU_MXC91231)
119#else
120# define cpu_is_mxc91231() (0)
121#endif
122
97#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2) 123#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2)
98#define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10) 124#define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10)
99#define CSCR_L(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10 + 0x4) 125#define CSCR_L(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10 + 0x4)
100#define CSCR_A(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10 + 0x8) 126#define CSCR_A(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10 + 0x8)
101#endif 127#endif
102 128
103#define cpu_is_mx3() (cpu_is_mx31() || cpu_is_mx35()) 129#define cpu_is_mx3() (cpu_is_mx31() || cpu_is_mx35() || cpu_is_mxc91231())
104#define cpu_is_mx2() (cpu_is_mx21() || cpu_is_mx27()) 130#define cpu_is_mx2() (cpu_is_mx21() || cpu_is_mx27())
105 131
106#endif /* __ASM_ARCH_MXC_H__ */ 132#endif /* __ASM_ARCH_MXC_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mxc91231.h b/arch/arm/plat-mxc/include/mach/mxc91231.h
new file mode 100644
index 000000000000..81484d1ef232
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mxc91231.h
@@ -0,0 +1,315 @@
1/*
2 * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
3 * - Platform specific register memory map
4 *
5 * Copyright 2005-2007 Motorola, Inc.
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __MACH_MXC91231_H__
22#define __MACH_MXC91231_H__
23
24/*
25 * L2CC
26 */
27#define MXC91231_L2CC_BASE_ADDR 0x30000000
28#define MXC91231_L2CC_BASE_ADDR_VIRT 0xF9000000
29#define MXC91231_L2CC_SIZE SZ_64K
30
31/*
32 * AIPS 1
33 */
34#define MXC91231_AIPS1_BASE_ADDR 0x43F00000
35#define MXC91231_AIPS1_BASE_ADDR_VIRT 0xFC000000
36#define MXC91231_AIPS1_SIZE SZ_1M
37
38#define MXC91231_AIPS1_CTRL_BASE_ADDR MXC91231_AIPS1_BASE_ADDR
39#define MXC91231_MAX_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x04000)
40#define MXC91231_EVTMON_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x08000)
41#define MXC91231_CLKCTL_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x0C000)
42#define MXC91231_ETB_SLOT4_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x10000)
43#define MXC91231_ETB_SLOT5_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x14000)
44#define MXC91231_ECT_CTIO_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x18000)
45#define MXC91231_I2C_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x80000)
46#define MXC91231_MU_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x88000)
47#define MXC91231_UART1_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x90000)
48#define MXC91231_UART2_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x94000)
49#define MXC91231_DSM_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x98000)
50#define MXC91231_OWIRE_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0x9C000)
51#define MXC91231_SSI1_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0xA0000)
52#define MXC91231_KPP_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0xA8000)
53#define MXC91231_IOMUX_AP_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0xAC000)
54#define MXC91231_CTI_AP_BASE_ADDR (MXC91231_AIPS1_BASE_ADDR + 0xB8000)
55
56/*
57 * AIPS 2
58 */
59#define MXC91231_AIPS2_BASE_ADDR 0x53F00000
60#define MXC91231_AIPS2_BASE_ADDR_VIRT 0xFC100000
61#define MXC91231_AIPS2_SIZE SZ_1M
62
63#define MXC91231_GEMK_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0x8C000)
64#define MXC91231_GPT1_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0x90000)
65#define MXC91231_EPIT1_AP_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0x94000)
66#define MXC91231_SCC_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xAC000)
67#define MXC91231_RNGA_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xB0000)
68#define MXC91231_IPU_CTRL_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xC0000)
69#define MXC91231_AUDMUX_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xC4000)
70#define MXC91231_EDIO_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xC8000)
71#define MXC91231_GPIO1_AP_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xCC000)
72#define MXC91231_GPIO2_AP_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xD0000)
73#define MXC91231_SDMA_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xD4000)
74#define MXC91231_RTC_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xD8000)
75#define MXC91231_WDOG1_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xDC000)
76#define MXC91231_PWM_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xE0000)
77#define MXC91231_GPIO3_AP_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xE4000)
78#define MXC91231_WDOG2_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xE8000)
79#define MXC91231_RTIC_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xEC000)
80#define MXC91231_LPMC_BASE_ADDR (MXC91231_AIPS2_BASE_ADDR + 0xF0000)
81
82/*
83 * SPBA global module 0
84 */
85#define MXC91231_SPBA0_BASE_ADDR 0x50000000
86#define MXC91231_SPBA0_BASE_ADDR_VIRT 0xFC200000
87#define MXC91231_SPBA0_SIZE SZ_1M
88
89#define MXC91231_MMC_SDHC1_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x04000)
90#define MXC91231_MMC_SDHC2_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x08000)
91#define MXC91231_UART3_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x0C000)
92#define MXC91231_CSPI2_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x10000)
93#define MXC91231_SSI2_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x14000)
94#define MXC91231_SIM_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x18000)
95#define MXC91231_IIM_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x1C000)
96#define MXC91231_CTI_SDMA_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x20000)
97#define MXC91231_USBOTG_CTRL_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x24000)
98#define MXC91231_USBOTG_DATA_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x28000)
99#define MXC91231_CSPI1_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x30000)
100#define MXC91231_SPBA_CTRL_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x3C000)
101#define MXC91231_IOMUX_COM_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x40000)
102#define MXC91231_CRM_COM_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x44000)
103#define MXC91231_CRM_AP_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x48000)
104#define MXC91231_PLL0_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x4C000)
105#define MXC91231_PLL1_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x50000)
106#define MXC91231_PLL2_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x54000)
107#define MXC91231_GPIO4_SH_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x58000)
108#define MXC91231_HAC_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x5C000)
109#define MXC91231_SAHARA_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x5C000)
110#define MXC91231_PLL3_BASE_ADDR (MXC91231_SPBA0_BASE_ADDR + 0x60000)
111
112/*
113 * SPBA global module 1
114 */
115#define MXC91231_SPBA1_BASE_ADDR 0x52000000
116#define MXC91231_SPBA1_BASE_ADDR_VIRT 0xFC300000
117#define MXC91231_SPBA1_SIZE SZ_1M
118
119#define MXC91231_MQSPI_BASE_ADDR (MXC91231_SPBA1_BASE_ADDR + 0x34000)
120#define MXC91231_EL1T_BASE_ADDR (MXC91231_SPBA1_BASE_ADDR + 0x38000)
121
122/*!
123 * Defines for SPBA modules
124 */
125#define MXC91231_SPBA_SDHC1 0x04
126#define MXC91231_SPBA_SDHC2 0x08
127#define MXC91231_SPBA_UART3 0x0C
128#define MXC91231_SPBA_CSPI2 0x10
129#define MXC91231_SPBA_SSI2 0x14
130#define MXC91231_SPBA_SIM 0x18
131#define MXC91231_SPBA_IIM 0x1C
132#define MXC91231_SPBA_CTI_SDMA 0x20
133#define MXC91231_SPBA_USBOTG_CTRL_REGS 0x24
134#define MXC91231_SPBA_USBOTG_DATA_REGS 0x28
135#define MXC91231_SPBA_CSPI1 0x30
136#define MXC91231_SPBA_MQSPI 0x34
137#define MXC91231_SPBA_EL1T 0x38
138#define MXC91231_SPBA_IOMUX 0x40
139#define MXC91231_SPBA_CRM_COM 0x44
140#define MXC91231_SPBA_CRM_AP 0x48
141#define MXC91231_SPBA_PLL0 0x4C
142#define MXC91231_SPBA_PLL1 0x50
143#define MXC91231_SPBA_PLL2 0x54
144#define MXC91231_SPBA_GPIO4 0x58
145#define MXC91231_SPBA_SAHARA 0x5C
146
147/*
148 * ROMP and AVIC
149 */
150#define MXC91231_ROMP_BASE_ADDR 0x60000000
151#define MXC91231_ROMP_BASE_ADDR_VIRT 0xFC400000
152#define MXC91231_ROMP_SIZE SZ_64K
153
154#define MXC91231_AVIC_BASE_ADDR 0x68000000
155#define MXC91231_AVIC_BASE_ADDR_VIRT 0xFC410000
156#define MXC91231_AVIC_SIZE SZ_64K
157
158/*
159 * NAND, SDRAM, WEIM, M3IF, EMI controllers
160 */
161#define MXC91231_X_MEMC_BASE_ADDR 0xB8000000
162#define MXC91231_X_MEMC_BASE_ADDR_VIRT 0xFC420000
163#define MXC91231_X_MEMC_SIZE SZ_64K
164
165#define MXC91231_NFC_BASE_ADDR (MXC91231_X_MEMC_BASE_ADDR + 0x0000)
166#define MXC91231_ESDCTL_BASE_ADDR (MXC91231_X_MEMC_BASE_ADDR + 0x1000)
167#define MXC91231_WEIM_BASE_ADDR (MXC91231_X_MEMC_BASE_ADDR + 0x2000)
168#define MXC91231_M3IF_BASE_ADDR (MXC91231_X_MEMC_BASE_ADDR + 0x3000)
169#define MXC91231_EMI_CTL_BASE_ADDR (MXC91231_X_MEMC_BASE_ADDR + 0x4000)
170
171/*
172 * Memory regions and CS
173 * CPLD is connected on CS4
174 * CS5 is TP1021 or it is not connected
175 * */
176#define MXC91231_FB_RAM_BASE_ADDR 0x78000000
177#define MXC91231_FB_RAM_SIZE SZ_256K
178#define MXC91231_CSD0_BASE_ADDR 0x80000000
179#define MXC91231_CSD1_BASE_ADDR 0x90000000
180#define MXC91231_CS0_BASE_ADDR 0xA0000000
181#define MXC91231_CS1_BASE_ADDR 0xA8000000
182#define MXC91231_CS2_BASE_ADDR 0xB0000000
183#define MXC91231_CS3_BASE_ADDR 0xB2000000
184#define MXC91231_CS4_BASE_ADDR 0xB4000000
185#define MXC91231_CS5_BASE_ADDR 0xB6000000
186
187/* Is given address belongs to the specified memory region? */
188#define ADDRESS_IN_REGION(addr, start, size) \
189 (((addr) >= (start)) && ((addr) < (start)+(size)))
190
191/* Is given address belongs to the specified named `module'? */
192#define MXC91231_IS_MODULE(addr, module) \
193 ADDRESS_IN_REGION(addr, MXC91231_ ## module ## _BASE_ADDR, \
194 MXC91231_ ## module ## _SIZE)
195/*
196 * This macro defines the physical to virtual address mapping for all the
197 * peripheral modules. It is used by passing in the physical address as x
198 * and returning the virtual address. If the physical address is not mapped,
199 * it returns 0xDEADBEEF
200 */
201
202#define MXC91231_IO_ADDRESS(x) \
203 (void __iomem *) \
204 (MXC91231_IS_MODULE(x, L2CC) ? MXC91231_L2CC_IO_ADDRESS(x) : \
205 MXC91231_IS_MODULE(x, AIPS1) ? MXC91231_AIPS1_IO_ADDRESS(x) : \
206 MXC91231_IS_MODULE(x, AIPS2) ? MXC91231_AIPS2_IO_ADDRESS(x) : \
207 MXC91231_IS_MODULE(x, SPBA0) ? MXC91231_SPBA0_IO_ADDRESS(x) : \
208 MXC91231_IS_MODULE(x, SPBA1) ? MXC91231_SPBA1_IO_ADDRESS(x) : \
209 MXC91231_IS_MODULE(x, ROMP) ? MXC91231_ROMP_IO_ADDRESS(x) : \
210 MXC91231_IS_MODULE(x, AVIC) ? MXC91231_AVIC_IO_ADDRESS(x) : \
211 MXC91231_IS_MODULE(x, X_MEMC) ? MXC91231_X_MEMC_IO_ADDRESS(x) : \
212 0xDEADBEEF)
213
214
215/*
216 * define the address mapping macros: in physical address order
217 */
218#define MXC91231_L2CC_IO_ADDRESS(x) \
219 (((x) - MXC91231_L2CC_BASE_ADDR) + MXC91231_L2CC_BASE_ADDR_VIRT)
220
221#define MXC91231_AIPS1_IO_ADDRESS(x) \
222 (((x) - MXC91231_AIPS1_BASE_ADDR) + MXC91231_AIPS1_BASE_ADDR_VIRT)
223
224#define MXC91231_SPBA0_IO_ADDRESS(x) \
225 (((x) - MXC91231_SPBA0_BASE_ADDR) + MXC91231_SPBA0_BASE_ADDR_VIRT)
226
227#define MXC91231_SPBA1_IO_ADDRESS(x) \
228 (((x) - MXC91231_SPBA1_BASE_ADDR) + MXC91231_SPBA1_BASE_ADDR_VIRT)
229
230#define MXC91231_AIPS2_IO_ADDRESS(x) \
231 (((x) - MXC91231_AIPS2_BASE_ADDR) + MXC91231_AIPS2_BASE_ADDR_VIRT)
232
233#define MXC91231_ROMP_IO_ADDRESS(x) \
234 (((x) - MXC91231_ROMP_BASE_ADDR) + MXC91231_ROMP_BASE_ADDR_VIRT)
235
236#define MXC91231_AVIC_IO_ADDRESS(x) \
237 (((x) - MXC91231_AVIC_BASE_ADDR) + MXC91231_AVIC_BASE_ADDR_VIRT)
238
239#define MXC91231_X_MEMC_IO_ADDRESS(x) \
240 (((x) - MXC91231_X_MEMC_BASE_ADDR) + MXC91231_X_MEMC_BASE_ADDR_VIRT)
241
242/*
243 * Interrupt numbers
244 */
245#define MXC91231_INT_GPIO3 0
246#define MXC91231_INT_EL1T_CI 1
247#define MXC91231_INT_EL1T_RFCI 2
248#define MXC91231_INT_EL1T_RFI 3
249#define MXC91231_INT_EL1T_MCU 4
250#define MXC91231_INT_EL1T_IPI 5
251#define MXC91231_INT_MU_GEN 6
252#define MXC91231_INT_GPIO4 7
253#define MXC91231_INT_MMC_SDHC2 8
254#define MXC91231_INT_MMC_SDHC1 9
255#define MXC91231_INT_I2C 10
256#define MXC91231_INT_SSI2 11
257#define MXC91231_INT_SSI1 12
258#define MXC91231_INT_CSPI2 13
259#define MXC91231_INT_CSPI1 14
260#define MXC91231_INT_RTIC 15
261#define MXC91231_INT_SAHARA 15
262#define MXC91231_INT_HAC 15
263#define MXC91231_INT_UART3_RX 16
264#define MXC91231_INT_UART3_TX 17
265#define MXC91231_INT_UART3_MINT 18
266#define MXC91231_INT_ECT 19
267#define MXC91231_INT_SIM_IPB 20
268#define MXC91231_INT_SIM_DATA 21
269#define MXC91231_INT_RNGA 22
270#define MXC91231_INT_DSM_AP 23
271#define MXC91231_INT_KPP 24
272#define MXC91231_INT_RTC 25
273#define MXC91231_INT_PWM 26
274#define MXC91231_INT_GEMK_AP 27
275#define MXC91231_INT_EPIT 28
276#define MXC91231_INT_GPT 29
277#define MXC91231_INT_UART2_RX 30
278#define MXC91231_INT_UART2_TX 31
279#define MXC91231_INT_UART2_MINT 32
280#define MXC91231_INT_NANDFC 33
281#define MXC91231_INT_SDMA 34
282#define MXC91231_INT_USB_WAKEUP 35
283#define MXC91231_INT_USB_SOF 36
284#define MXC91231_INT_PMU_EVTMON 37
285#define MXC91231_INT_USB_FUNC 38
286#define MXC91231_INT_USB_DMA 39
287#define MXC91231_INT_USB_CTRL 40
288#define MXC91231_INT_IPU_ERR 41
289#define MXC91231_INT_IPU_SYN 42
290#define MXC91231_INT_UART1_RX 43
291#define MXC91231_INT_UART1_TX 44
292#define MXC91231_INT_UART1_MINT 45
293#define MXC91231_INT_IIM 46
294#define MXC91231_INT_MU_RX_OR 47
295#define MXC91231_INT_MU_TX_OR 48
296#define MXC91231_INT_SCC_SCM 49
297#define MXC91231_INT_SCC_SMN 50
298#define MXC91231_INT_GPIO2 51
299#define MXC91231_INT_GPIO1 52
300#define MXC91231_INT_MQSPI1 53
301#define MXC91231_INT_MQSPI2 54
302#define MXC91231_INT_WDOG2 55
303#define MXC91231_INT_EXT_INT7 56
304#define MXC91231_INT_EXT_INT6 57
305#define MXC91231_INT_EXT_INT5 58
306#define MXC91231_INT_EXT_INT4 59
307#define MXC91231_INT_EXT_INT3 60
308#define MXC91231_INT_EXT_INT2 61
309#define MXC91231_INT_EXT_INT1 62
310#define MXC91231_INT_EXT_INT0 63
311
312#define MXC91231_MAX_INT_LINES 63
313#define MXC91231_MAX_EXT_LINES 8
314
315#endif /* __MACH_MXC91231_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h
index e56241af870e..ef00199568de 100644
--- a/arch/arm/plat-mxc/include/mach/system.h
+++ b/arch/arm/plat-mxc/include/mach/system.h
@@ -21,8 +21,18 @@
21#ifndef __ASM_ARCH_MXC_SYSTEM_H__ 21#ifndef __ASM_ARCH_MXC_SYSTEM_H__
22#define __ASM_ARCH_MXC_SYSTEM_H__ 22#define __ASM_ARCH_MXC_SYSTEM_H__
23 23
24#include <mach/hardware.h>
25#include <mach/common.h>
26
24static inline void arch_idle(void) 27static inline void arch_idle(void)
25{ 28{
29#ifdef CONFIG_ARCH_MXC91231
30 if (cpu_is_mxc91231()) {
31 /* Need this to set DSM low-power mode */
32 mxc91231_prepare_idle();
33 }
34#endif
35
26 cpu_do_idle(); 36 cpu_do_idle();
27} 37}
28 38
diff --git a/arch/arm/plat-mxc/include/mach/timex.h b/arch/arm/plat-mxc/include/mach/timex.h
index 07b4a73c9d2f..527a6c24788e 100644
--- a/arch/arm/plat-mxc/include/mach/timex.h
+++ b/arch/arm/plat-mxc/include/mach/timex.h
@@ -26,6 +26,10 @@
26#define CLOCK_TICK_RATE 13300000 26#define CLOCK_TICK_RATE 13300000
27#elif defined CONFIG_ARCH_MX3 27#elif defined CONFIG_ARCH_MX3
28#define CLOCK_TICK_RATE 16625000 28#define CLOCK_TICK_RATE 16625000
29#elif defined CONFIG_ARCH_MX25
30#define CLOCK_TICK_RATE 16000000
31#elif defined CONFIG_ARCH_MXC91231
32#define CLOCK_TICK_RATE 13000000
29#endif 33#endif
30 34
31#endif /* __ASM_ARCH_MXC_TIMEX_H__ */ 35#endif /* __ASM_ARCH_MXC_TIMEX_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
index de6fe0365982..082a3908256b 100644
--- a/arch/arm/plat-mxc/include/mach/uncompress.h
+++ b/arch/arm/plat-mxc/include/mach/uncompress.h
@@ -26,8 +26,11 @@
26#define __MXC_BOOT_UNCOMPRESS 26#define __MXC_BOOT_UNCOMPRESS
27 27
28#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <asm/mach-types.h>
29 30
30#define UART(x) (*(volatile unsigned long *)(serial_port + (x))) 31static unsigned long uart_base;
32
33#define UART(x) (*(volatile unsigned long *)(uart_base + (x)))
31 34
32#define USR2 0x98 35#define USR2 0x98
33#define USR2_TXFE (1<<14) 36#define USR2_TXFE (1<<14)
@@ -46,19 +49,10 @@
46 49
47static void putc(int ch) 50static void putc(int ch)
48{ 51{
49 static unsigned long serial_port = 0; 52 if (!uart_base)
50 53 return;
51 if (unlikely(serial_port == 0)) { 54 if (!(UART(UCR1) & UCR1_UARTEN))
52 do { 55 return;
53 serial_port = UART1_BASE_ADDR;
54 if (UART(UCR1) & UCR1_UARTEN)
55 break;
56 serial_port = UART2_BASE_ADDR;
57 if (UART(UCR1) & UCR1_UARTEN)
58 break;
59 return;
60 } while (0);
61 }
62 56
63 while (!(UART(USR2) & USR2_TXFE)) 57 while (!(UART(USR2) & USR2_TXFE))
64 barrier(); 58 barrier();
@@ -68,11 +62,49 @@ static void putc(int ch)
68 62
69#define flush() do { } while (0) 63#define flush() do { } while (0)
70 64
71/* 65#define MX1_UART1_BASE_ADDR 0x00206000
72 * nothing to do 66#define MX25_UART1_BASE_ADDR 0x43f90000
73 */ 67#define MX2X_UART1_BASE_ADDR 0x1000a000
74#define arch_decomp_setup() 68#define MX3X_UART1_BASE_ADDR 0x43F90000
69#define MX3X_UART2_BASE_ADDR 0x43F94000
70
71static __inline__ void __arch_decomp_setup(unsigned long arch_id)
72{
73 switch (arch_id) {
74 case MACH_TYPE_MX1ADS:
75 case MACH_TYPE_SCB9328:
76 uart_base = MX1_UART1_BASE_ADDR;
77 break;
78 case MACH_TYPE_MX25_3DS:
79 uart_base = MX25_UART1_BASE_ADDR;
80 break;
81 case MACH_TYPE_IMX27LITE:
82 case MACH_TYPE_MX27_3DS:
83 case MACH_TYPE_MX27ADS:
84 case MACH_TYPE_PCM038:
85 case MACH_TYPE_MX21ADS:
86 uart_base = MX2X_UART1_BASE_ADDR;
87 break;
88 case MACH_TYPE_MX31LITE:
89 case MACH_TYPE_ARMADILLO5X0:
90 case MACH_TYPE_MX31MOBOARD:
91 case MACH_TYPE_QONG:
92 case MACH_TYPE_MX31_3DS:
93 case MACH_TYPE_PCM037:
94 case MACH_TYPE_MX31ADS:
95 case MACH_TYPE_MX35_3DS:
96 case MACH_TYPE_PCM043:
97 uart_base = MX3X_UART1_BASE_ADDR;
98 break;
99 case MACH_TYPE_MAGX_ZN5:
100 uart_base = MX3X_UART2_BASE_ADDR;
101 break;
102 default:
103 break;
104 }
105}
75 106
107#define arch_decomp_setup() __arch_decomp_setup(arch_id)
76#define arch_decomp_wdog() 108#define arch_decomp_wdog()
77 109
78#endif /* __ASM_ARCH_MXC_UNCOMPRESS_H__ */ 110#endif /* __ASM_ARCH_MXC_UNCOMPRESS_H__ */
diff --git a/arch/arm/plat-mxc/iomux-v3.c b/arch/arm/plat-mxc/iomux-v3.c
index 77a078f9513f..851ca99bf1b1 100644
--- a/arch/arm/plat-mxc/iomux-v3.c
+++ b/arch/arm/plat-mxc/iomux-v3.c
@@ -29,7 +29,7 @@
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <mach/iomux-v3.h> 30#include <mach/iomux-v3.h>
31 31
32#define IOMUX_BASE IO_ADDRESS(IOMUXC_BASE_ADDR) 32static void __iomem *base;
33 33
34static unsigned long iomux_v3_pad_alloc_map[0x200 / BITS_PER_LONG]; 34static unsigned long iomux_v3_pad_alloc_map[0x200 / BITS_PER_LONG];
35 35
@@ -45,14 +45,14 @@ int mxc_iomux_v3_setup_pad(struct pad_desc *pad)
45 if (test_and_set_bit(pad_ofs >> 2, iomux_v3_pad_alloc_map)) 45 if (test_and_set_bit(pad_ofs >> 2, iomux_v3_pad_alloc_map))
46 return -EBUSY; 46 return -EBUSY;
47 if (pad->mux_ctrl_ofs) 47 if (pad->mux_ctrl_ofs)
48 __raw_writel(pad->mux_mode, IOMUX_BASE + pad->mux_ctrl_ofs); 48 __raw_writel(pad->mux_mode, base + pad->mux_ctrl_ofs);
49 49
50 if (pad->select_input_ofs) 50 if (pad->select_input_ofs)
51 __raw_writel(pad->select_input, 51 __raw_writel(pad->select_input,
52 IOMUX_BASE + pad->select_input_ofs); 52 base + pad->select_input_ofs);
53 53
54 if (!(pad->pad_ctrl & NO_PAD_CTRL)) 54 if (!(pad->pad_ctrl & NO_PAD_CTRL) && pad->pad_ctrl_ofs)
55 __raw_writel(pad->pad_ctrl, IOMUX_BASE + pad->pad_ctrl_ofs); 55 __raw_writel(pad->pad_ctrl, base + pad->pad_ctrl_ofs);
56 return 0; 56 return 0;
57} 57}
58EXPORT_SYMBOL(mxc_iomux_v3_setup_pad); 58EXPORT_SYMBOL(mxc_iomux_v3_setup_pad);
@@ -96,3 +96,8 @@ void mxc_iomux_v3_release_multiple_pads(struct pad_desc *pad_list, int count)
96 } 96 }
97} 97}
98EXPORT_SYMBOL(mxc_iomux_v3_release_multiple_pads); 98EXPORT_SYMBOL(mxc_iomux_v3_release_multiple_pads);
99
100void mxc_iomux_v3_init(void __iomem *iomux_v3_base)
101{
102 base = iomux_v3_base;
103}
diff --git a/arch/arm/plat-mxc/irq.c b/arch/arm/plat-mxc/irq.c
index 8aee76304f8f..778ddfe57d89 100644
--- a/arch/arm/plat-mxc/irq.c
+++ b/arch/arm/plat-mxc/irq.c
@@ -44,7 +44,7 @@
44#define AVIC_FIPNDH 0x60 /* fast int pending high */ 44#define AVIC_FIPNDH 0x60 /* fast int pending high */
45#define AVIC_FIPNDL 0x64 /* fast int pending low */ 45#define AVIC_FIPNDL 0x64 /* fast int pending low */
46 46
47static void __iomem *avic_base; 47void __iomem *avic_base;
48 48
49int imx_irq_set_priority(unsigned char irq, unsigned char prio) 49int imx_irq_set_priority(unsigned char irq, unsigned char prio)
50{ 50{
@@ -113,11 +113,11 @@ static struct irq_chip mxc_avic_chip = {
113 * interrupts. It registers the interrupt enable and disable functions 113 * interrupts. It registers the interrupt enable and disable functions
114 * to the kernel for each interrupt source. 114 * to the kernel for each interrupt source.
115 */ 115 */
116void __init mxc_init_irq(void) 116void __init mxc_init_irq(void __iomem *irqbase)
117{ 117{
118 int i; 118 int i;
119 119
120 avic_base = IO_ADDRESS(AVIC_BASE_ADDR); 120 avic_base = irqbase;
121 121
122 /* put the AVIC into the reset value with 122 /* put the AVIC into the reset value with
123 * all interrupts disabled 123 * all interrupts disabled
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index ae34198a79dd..5cdbd605ac05 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -32,6 +32,7 @@
32#define MX3_PWMPR 0x10 /* PWM Period Register */ 32#define MX3_PWMPR 0x10 /* PWM Period Register */
33#define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4) 33#define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4)
34#define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16) 34#define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16)
35#define MX3_PWMCR_CLKSRC_IPG (1 << 16)
35#define MX3_PWMCR_EN (1 << 0) 36#define MX3_PWMCR_EN (1 << 0)
36 37
37 38
@@ -55,9 +56,11 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
55 if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) 56 if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
56 return -EINVAL; 57 return -EINVAL;
57 58
58 if (cpu_is_mx27() || cpu_is_mx3()) { 59 if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) {
59 unsigned long long c; 60 unsigned long long c;
60 unsigned long period_cycles, duty_cycles, prescale; 61 unsigned long period_cycles, duty_cycles, prescale;
62 u32 cr;
63
61 c = clk_get_rate(pwm->clk); 64 c = clk_get_rate(pwm->clk);
62 c = c * period_ns; 65 c = c * period_ns;
63 do_div(c, 1000000000); 66 do_div(c, 1000000000);
@@ -72,9 +75,15 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
72 75
73 writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); 76 writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR);
74 writel(period_cycles, pwm->mmio_base + MX3_PWMPR); 77 writel(period_cycles, pwm->mmio_base + MX3_PWMPR);
75 writel(MX3_PWMCR_PRESCALER(prescale - 1) | 78
76 MX3_PWMCR_CLKSRC_IPG_HIGH | MX3_PWMCR_EN, 79 cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_EN;
77 pwm->mmio_base + MX3_PWMCR); 80
81 if (cpu_is_mx25())
82 cr |= MX3_PWMCR_CLKSRC_IPG;
83 else
84 cr |= MX3_PWMCR_CLKSRC_IPG_HIGH;
85
86 writel(cr, pwm->mmio_base + MX3_PWMCR);
78 } else if (cpu_is_mx1() || cpu_is_mx21()) { 87 } else if (cpu_is_mx1() || cpu_is_mx21()) {
79 /* The PWM subsystem allows for exact frequencies. However, 88 /* The PWM subsystem allows for exact frequencies. However,
80 * I cannot connect a scope on my device to the PWM line and 89 * I cannot connect a scope on my device to the PWM line and
@@ -118,6 +127,8 @@ EXPORT_SYMBOL(pwm_enable);
118 127
119void pwm_disable(struct pwm_device *pwm) 128void pwm_disable(struct pwm_device *pwm)
120{ 129{
130 writel(0, pwm->mmio_base + MX3_PWMCR);
131
121 if (pwm->clk_enabled) { 132 if (pwm->clk_enabled) {
122 clk_disable(pwm->clk); 133 clk_disable(pwm->clk);
123 pwm->clk_enabled = 0; 134 pwm->clk_enabled = 0;
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 79c37577c916..97f42799fa58 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -27,32 +27,38 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/common.h>
30#include <asm/proc-fns.h> 31#include <asm/proc-fns.h>
31#include <asm/system.h> 32#include <asm/system.h>
32 33
33#ifdef CONFIG_ARCH_MX1 34static void __iomem *wdog_base;
34#define WDOG_WCR_REG IO_ADDRESS(WDT_BASE_ADDR)
35#define WDOG_WCR_ENABLE (1 << 0)
36#else
37#define WDOG_WCR_REG IO_ADDRESS(WDOG_BASE_ADDR)
38#define WDOG_WCR_ENABLE (1 << 2)
39#endif
40 35
41/* 36/*
42 * Reset the system. It is called by machine_restart(). 37 * Reset the system. It is called by machine_restart().
43 */ 38 */
44void arch_reset(char mode, const char *cmd) 39void arch_reset(char mode, const char *cmd)
45{ 40{
46 if (!cpu_is_mx1()) { 41 unsigned int wcr_enable;
42
43#ifdef CONFIG_ARCH_MXC91231
44 if (cpu_is_mxc91231()) {
45 mxc91231_arch_reset(mode, cmd);
46 return;
47 }
48#endif
49 if (cpu_is_mx1()) {
50 wcr_enable = (1 << 0);
51 } else {
47 struct clk *clk; 52 struct clk *clk;
48 53
49 clk = clk_get_sys("imx-wdt.0", NULL); 54 clk = clk_get_sys("imx-wdt.0", NULL);
50 if (!IS_ERR(clk)) 55 if (!IS_ERR(clk))
51 clk_enable(clk); 56 clk_enable(clk);
57 wcr_enable = (1 << 2);
52 } 58 }
53 59
54 /* Assert SRS signal */ 60 /* Assert SRS signal */
55 __raw_writew(WDOG_WCR_ENABLE, WDOG_WCR_REG); 61 __raw_writew(wcr_enable, wdog_base);
56 62
57 /* wait for reset to assert... */ 63 /* wait for reset to assert... */
58 mdelay(500); 64 mdelay(500);
@@ -65,3 +71,8 @@ void arch_reset(char mode, const char *cmd)
65 /* we'll take a jump through zero as a poor second */ 71 /* we'll take a jump through zero as a poor second */
66 cpu_reset(0); 72 cpu_reset(0);
67} 73}
74
75void mxc_arch_reset_init(void __iomem *base)
76{
77 wdog_base = base;
78}
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 88fb3a57e029..844567ee35fe 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -47,7 +47,7 @@
47#define MX2_TSTAT_CAPT (1 << 1) 47#define MX2_TSTAT_CAPT (1 << 1)
48#define MX2_TSTAT_COMP (1 << 0) 48#define MX2_TSTAT_COMP (1 << 0)
49 49
50/* MX31, MX35 */ 50/* MX31, MX35, MX25, MXC91231 */
51#define MX3_TCTL_WAITEN (1 << 3) 51#define MX3_TCTL_WAITEN (1 << 3)
52#define MX3_TCTL_CLK_IPG (1 << 6) 52#define MX3_TCTL_CLK_IPG (1 << 6)
53#define MX3_TCTL_FRR (1 << 9) 53#define MX3_TCTL_FRR (1 << 9)
@@ -66,7 +66,7 @@ static inline void gpt_irq_disable(void)
66{ 66{
67 unsigned int tmp; 67 unsigned int tmp;
68 68
69 if (cpu_is_mx3()) 69 if (cpu_is_mx3() || cpu_is_mx25())
70 __raw_writel(0, timer_base + MX3_IR); 70 __raw_writel(0, timer_base + MX3_IR);
71 else { 71 else {
72 tmp = __raw_readl(timer_base + MXC_TCTL); 72 tmp = __raw_readl(timer_base + MXC_TCTL);
@@ -76,7 +76,7 @@ static inline void gpt_irq_disable(void)
76 76
77static inline void gpt_irq_enable(void) 77static inline void gpt_irq_enable(void)
78{ 78{
79 if (cpu_is_mx3()) 79 if (cpu_is_mx3() || cpu_is_mx25())
80 __raw_writel(1<<0, timer_base + MX3_IR); 80 __raw_writel(1<<0, timer_base + MX3_IR);
81 else { 81 else {
82 __raw_writel(__raw_readl(timer_base + MXC_TCTL) | MX1_2_TCTL_IRQEN, 82 __raw_writel(__raw_readl(timer_base + MXC_TCTL) | MX1_2_TCTL_IRQEN,
@@ -90,7 +90,7 @@ static void gpt_irq_acknowledge(void)
90 __raw_writel(0, timer_base + MX1_2_TSTAT); 90 __raw_writel(0, timer_base + MX1_2_TSTAT);
91 if (cpu_is_mx2()) 91 if (cpu_is_mx2())
92 __raw_writel(MX2_TSTAT_CAPT | MX2_TSTAT_COMP, timer_base + MX1_2_TSTAT); 92 __raw_writel(MX2_TSTAT_CAPT | MX2_TSTAT_COMP, timer_base + MX1_2_TSTAT);
93 if (cpu_is_mx3()) 93 if (cpu_is_mx3() || cpu_is_mx25())
94 __raw_writel(MX3_TSTAT_OF1, timer_base + MX3_TSTAT); 94 __raw_writel(MX3_TSTAT_OF1, timer_base + MX3_TSTAT);
95} 95}
96 96
@@ -117,7 +117,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
117{ 117{
118 unsigned int c = clk_get_rate(timer_clk); 118 unsigned int c = clk_get_rate(timer_clk);
119 119
120 if (cpu_is_mx3()) 120 if (cpu_is_mx3() || cpu_is_mx25())
121 clocksource_mxc.read = mx3_get_cycles; 121 clocksource_mxc.read = mx3_get_cycles;
122 122
123 clocksource_mxc.mult = clocksource_hz2mult(c, 123 clocksource_mxc.mult = clocksource_hz2mult(c,
@@ -180,7 +180,7 @@ static void mxc_set_mode(enum clock_event_mode mode,
180 180
181 if (mode != clockevent_mode) { 181 if (mode != clockevent_mode) {
182 /* Set event time into far-far future */ 182 /* Set event time into far-far future */
183 if (cpu_is_mx3()) 183 if (cpu_is_mx3() || cpu_is_mx25())
184 __raw_writel(__raw_readl(timer_base + MX3_TCN) - 3, 184 __raw_writel(__raw_readl(timer_base + MX3_TCN) - 3,
185 timer_base + MX3_TCMP); 185 timer_base + MX3_TCMP);
186 else 186 else
@@ -233,7 +233,7 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
233 struct clock_event_device *evt = &clockevent_mxc; 233 struct clock_event_device *evt = &clockevent_mxc;
234 uint32_t tstat; 234 uint32_t tstat;
235 235
236 if (cpu_is_mx3()) 236 if (cpu_is_mx3() || cpu_is_mx25())
237 tstat = __raw_readl(timer_base + MX3_TSTAT); 237 tstat = __raw_readl(timer_base + MX3_TSTAT);
238 else 238 else
239 tstat = __raw_readl(timer_base + MX1_2_TSTAT); 239 tstat = __raw_readl(timer_base + MX1_2_TSTAT);
@@ -264,7 +264,7 @@ static int __init mxc_clockevent_init(struct clk *timer_clk)
264{ 264{
265 unsigned int c = clk_get_rate(timer_clk); 265 unsigned int c = clk_get_rate(timer_clk);
266 266
267 if (cpu_is_mx3()) 267 if (cpu_is_mx3() || cpu_is_mx25())
268 clockevent_mxc.set_next_event = mx3_set_next_event; 268 clockevent_mxc.set_next_event = mx3_set_next_event;
269 269
270 clockevent_mxc.mult = div_sc(c, NSEC_PER_SEC, 270 clockevent_mxc.mult = div_sc(c, NSEC_PER_SEC,
@@ -281,30 +281,13 @@ static int __init mxc_clockevent_init(struct clk *timer_clk)
281 return 0; 281 return 0;
282} 282}
283 283
284void __init mxc_timer_init(struct clk *timer_clk) 284void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
285{ 285{
286 uint32_t tctl_val; 286 uint32_t tctl_val;
287 int irq;
288 287
289 clk_enable(timer_clk); 288 clk_enable(timer_clk);
290 289
291 if (cpu_is_mx1()) { 290 timer_base = base;
292#ifdef CONFIG_ARCH_MX1
293 timer_base = IO_ADDRESS(TIM1_BASE_ADDR);
294 irq = TIM1_INT;
295#endif
296 } else if (cpu_is_mx2()) {
297#ifdef CONFIG_ARCH_MX2
298 timer_base = IO_ADDRESS(GPT1_BASE_ADDR);
299 irq = MXC_INT_GPT1;
300#endif
301 } else if (cpu_is_mx3()) {
302#ifdef CONFIG_ARCH_MX3
303 timer_base = IO_ADDRESS(GPT1_BASE_ADDR);
304 irq = MXC_INT_GPT;
305#endif
306 } else
307 BUG();
308 291
309 /* 292 /*
310 * Initialise to a known state (all timers off, and timing reset) 293 * Initialise to a known state (all timers off, and timing reset)
@@ -313,7 +296,7 @@ void __init mxc_timer_init(struct clk *timer_clk)
313 __raw_writel(0, timer_base + MXC_TCTL); 296 __raw_writel(0, timer_base + MXC_TCTL);
314 __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */ 297 __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */
315 298
316 if (cpu_is_mx3()) 299 if (cpu_is_mx3() || cpu_is_mx25())
317 tctl_val = MX3_TCTL_CLK_IPG | MX3_TCTL_FRR | MX3_TCTL_WAITEN | MXC_TCTL_TEN; 300 tctl_val = MX3_TCTL_CLK_IPG | MX3_TCTL_FRR | MX3_TCTL_WAITEN | MXC_TCTL_TEN;
318 else 301 else
319 tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN; 302 tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN;
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index 843e8af64066..1868c0d8f9b5 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -78,10 +78,10 @@ static int omap_target(struct cpufreq_policy *policy,
78 78
79 /* Ensure desired rate is within allowed range. Some govenors 79 /* Ensure desired rate is within allowed range. Some govenors
80 * (ondemand) will just pass target_freq=0 to get the minimum. */ 80 * (ondemand) will just pass target_freq=0 to get the minimum. */
81 if (target_freq < policy->cpuinfo.min_freq) 81 if (target_freq < policy->min)
82 target_freq = policy->cpuinfo.min_freq; 82 target_freq = policy->min;
83 if (target_freq > policy->cpuinfo.max_freq) 83 if (target_freq > policy->max)
84 target_freq = policy->cpuinfo.max_freq; 84 target_freq = policy->max;
85 85
86 freqs.old = omap_getspeed(0); 86 freqs.old = omap_getspeed(0);
87 freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000; 87 freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 26b387c12423..00940dc6bb50 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -138,6 +138,32 @@
138#define OMAP24XX_GPIO_CLEARDATAOUT 0x0090 138#define OMAP24XX_GPIO_CLEARDATAOUT 0x0090
139#define OMAP24XX_GPIO_SETDATAOUT 0x0094 139#define OMAP24XX_GPIO_SETDATAOUT 0x0094
140 140
141#define OMAP4_GPIO_REVISION 0x0000
142#define OMAP4_GPIO_SYSCONFIG 0x0010
143#define OMAP4_GPIO_EOI 0x0020
144#define OMAP4_GPIO_IRQSTATUSRAW0 0x0024
145#define OMAP4_GPIO_IRQSTATUSRAW1 0x0028
146#define OMAP4_GPIO_IRQSTATUS0 0x002c
147#define OMAP4_GPIO_IRQSTATUS1 0x0030
148#define OMAP4_GPIO_IRQSTATUSSET0 0x0034
149#define OMAP4_GPIO_IRQSTATUSSET1 0x0038
150#define OMAP4_GPIO_IRQSTATUSCLR0 0x003c
151#define OMAP4_GPIO_IRQSTATUSCLR1 0x0040
152#define OMAP4_GPIO_IRQWAKEN0 0x0044
153#define OMAP4_GPIO_IRQWAKEN1 0x0048
154#define OMAP4_GPIO_SYSSTATUS 0x0104
155#define OMAP4_GPIO_CTRL 0x0130
156#define OMAP4_GPIO_OE 0x0134
157#define OMAP4_GPIO_DATAIN 0x0138
158#define OMAP4_GPIO_DATAOUT 0x013c
159#define OMAP4_GPIO_LEVELDETECT0 0x0140
160#define OMAP4_GPIO_LEVELDETECT1 0x0144
161#define OMAP4_GPIO_RISINGDETECT 0x0148
162#define OMAP4_GPIO_FALLINGDETECT 0x014c
163#define OMAP4_GPIO_DEBOUNCENABLE 0x0150
164#define OMAP4_GPIO_DEBOUNCINGTIME 0x0154
165#define OMAP4_GPIO_CLEARDATAOUT 0x0190
166#define OMAP4_GPIO_SETDATAOUT 0x0194
141/* 167/*
142 * omap34xx specific GPIO registers 168 * omap34xx specific GPIO registers
143 */ 169 */
@@ -386,12 +412,16 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
386 reg += OMAP850_GPIO_DIR_CONTROL; 412 reg += OMAP850_GPIO_DIR_CONTROL;
387 break; 413 break;
388#endif 414#endif
389#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 415#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
390 defined(CONFIG_ARCH_OMAP4)
391 case METHOD_GPIO_24XX: 416 case METHOD_GPIO_24XX:
392 reg += OMAP24XX_GPIO_OE; 417 reg += OMAP24XX_GPIO_OE;
393 break; 418 break;
394#endif 419#endif
420#if defined(CONFIG_ARCH_OMAP4)
421 case METHOD_GPIO_24XX:
422 reg += OMAP4_GPIO_OE;
423 break;
424#endif
395 default: 425 default:
396 WARN_ON(1); 426 WARN_ON(1);
397 return; 427 return;
@@ -459,8 +489,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
459 l &= ~(1 << gpio); 489 l &= ~(1 << gpio);
460 break; 490 break;
461#endif 491#endif
462#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 492#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
463 defined(CONFIG_ARCH_OMAP4)
464 case METHOD_GPIO_24XX: 493 case METHOD_GPIO_24XX:
465 if (enable) 494 if (enable)
466 reg += OMAP24XX_GPIO_SETDATAOUT; 495 reg += OMAP24XX_GPIO_SETDATAOUT;
@@ -469,6 +498,15 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
469 l = 1 << gpio; 498 l = 1 << gpio;
470 break; 499 break;
471#endif 500#endif
501#ifdef CONFIG_ARCH_OMAP4
502 case METHOD_GPIO_24XX:
503 if (enable)
504 reg += OMAP4_GPIO_SETDATAOUT;
505 else
506 reg += OMAP4_GPIO_CLEARDATAOUT;
507 l = 1 << gpio;
508 break;
509#endif
472 default: 510 default:
473 WARN_ON(1); 511 WARN_ON(1);
474 return; 512 return;
@@ -511,12 +549,16 @@ static int __omap_get_gpio_datain(int gpio)
511 reg += OMAP850_GPIO_DATA_INPUT; 549 reg += OMAP850_GPIO_DATA_INPUT;
512 break; 550 break;
513#endif 551#endif
514#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 552#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
515 defined(CONFIG_ARCH_OMAP4)
516 case METHOD_GPIO_24XX: 553 case METHOD_GPIO_24XX:
517 reg += OMAP24XX_GPIO_DATAIN; 554 reg += OMAP24XX_GPIO_DATAIN;
518 break; 555 break;
519#endif 556#endif
557#ifdef CONFIG_ARCH_OMAP4
558 case METHOD_GPIO_24XX:
559 reg += OMAP4_GPIO_DATAIN;
560 break;
561#endif
520 default: 562 default:
521 return -EINVAL; 563 return -EINVAL;
522 } 564 }
@@ -544,7 +586,11 @@ void omap_set_gpio_debounce(int gpio, int enable)
544 586
545 bank = get_gpio_bank(gpio); 587 bank = get_gpio_bank(gpio);
546 reg = bank->base; 588 reg = bank->base;
589#ifdef CONFIG_ARCH_OMAP4
590 reg += OMAP4_GPIO_DEBOUNCENABLE;
591#else
547 reg += OMAP24XX_GPIO_DEBOUNCE_EN; 592 reg += OMAP24XX_GPIO_DEBOUNCE_EN;
593#endif
548 594
549 spin_lock_irqsave(&bank->lock, flags); 595 spin_lock_irqsave(&bank->lock, flags);
550 val = __raw_readl(reg); 596 val = __raw_readl(reg);
@@ -581,7 +627,11 @@ void omap_set_gpio_debounce_time(int gpio, int enc_time)
581 reg = bank->base; 627 reg = bank->base;
582 628
583 enc_time &= 0xff; 629 enc_time &= 0xff;
630#ifdef CONFIG_ARCH_OMAP4
631 reg += OMAP4_GPIO_DEBOUNCINGTIME;
632#else
584 reg += OMAP24XX_GPIO_DEBOUNCE_VAL; 633 reg += OMAP24XX_GPIO_DEBOUNCE_VAL;
634#endif
585 __raw_writel(enc_time, reg); 635 __raw_writel(enc_time, reg);
586} 636}
587EXPORT_SYMBOL(omap_set_gpio_debounce_time); 637EXPORT_SYMBOL(omap_set_gpio_debounce_time);
@@ -593,23 +643,46 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
593{ 643{
594 void __iomem *base = bank->base; 644 void __iomem *base = bank->base;
595 u32 gpio_bit = 1 << gpio; 645 u32 gpio_bit = 1 << gpio;
646 u32 val;
596 647
597 MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT0, gpio_bit, 648 if (cpu_is_omap44xx()) {
598 trigger & IRQ_TYPE_LEVEL_LOW); 649 MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit,
599 MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT1, gpio_bit, 650 trigger & IRQ_TYPE_LEVEL_LOW);
600 trigger & IRQ_TYPE_LEVEL_HIGH); 651 MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT1, gpio_bit,
601 MOD_REG_BIT(OMAP24XX_GPIO_RISINGDETECT, gpio_bit, 652 trigger & IRQ_TYPE_LEVEL_HIGH);
602 trigger & IRQ_TYPE_EDGE_RISING); 653 MOD_REG_BIT(OMAP4_GPIO_RISINGDETECT, gpio_bit,
603 MOD_REG_BIT(OMAP24XX_GPIO_FALLINGDETECT, gpio_bit, 654 trigger & IRQ_TYPE_EDGE_RISING);
604 trigger & IRQ_TYPE_EDGE_FALLING); 655 MOD_REG_BIT(OMAP4_GPIO_FALLINGDETECT, gpio_bit,
605 656 trigger & IRQ_TYPE_EDGE_FALLING);
657 } else {
658 MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT0, gpio_bit,
659 trigger & IRQ_TYPE_LEVEL_LOW);
660 MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT1, gpio_bit,
661 trigger & IRQ_TYPE_LEVEL_HIGH);
662 MOD_REG_BIT(OMAP24XX_GPIO_RISINGDETECT, gpio_bit,
663 trigger & IRQ_TYPE_EDGE_RISING);
664 MOD_REG_BIT(OMAP24XX_GPIO_FALLINGDETECT, gpio_bit,
665 trigger & IRQ_TYPE_EDGE_FALLING);
666 }
606 if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { 667 if (likely(!(bank->non_wakeup_gpios & gpio_bit))) {
607 if (trigger != 0) 668 if (cpu_is_omap44xx()) {
608 __raw_writel(1 << gpio, bank->base 669 if (trigger != 0)
670 __raw_writel(1 << gpio, bank->base+
671 OMAP4_GPIO_IRQWAKEN0);
672 else {
673 val = __raw_readl(bank->base +
674 OMAP4_GPIO_IRQWAKEN0);
675 __raw_writel(val & (~(1 << gpio)), bank->base +
676 OMAP4_GPIO_IRQWAKEN0);
677 }
678 } else {
679 if (trigger != 0)
680 __raw_writel(1 << gpio, bank->base
609 + OMAP24XX_GPIO_SETWKUENA); 681 + OMAP24XX_GPIO_SETWKUENA);
610 else 682 else
611 __raw_writel(1 << gpio, bank->base 683 __raw_writel(1 << gpio, bank->base
612 + OMAP24XX_GPIO_CLEARWKUENA); 684 + OMAP24XX_GPIO_CLEARWKUENA);
685 }
613 } else { 686 } else {
614 if (trigger != 0) 687 if (trigger != 0)
615 bank->enabled_non_wakeup_gpios |= gpio_bit; 688 bank->enabled_non_wakeup_gpios |= gpio_bit;
@@ -617,9 +690,15 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
617 bank->enabled_non_wakeup_gpios &= ~gpio_bit; 690 bank->enabled_non_wakeup_gpios &= ~gpio_bit;
618 } 691 }
619 692
620 bank->level_mask = 693 if (cpu_is_omap44xx()) {
621 __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0) | 694 bank->level_mask =
622 __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1); 695 __raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT0) |
696 __raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT1);
697 } else {
698 bank->level_mask =
699 __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0) |
700 __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
701 }
623} 702}
624#endif 703#endif
625 704
@@ -783,12 +862,16 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
783 reg += OMAP850_GPIO_INT_STATUS; 862 reg += OMAP850_GPIO_INT_STATUS;
784 break; 863 break;
785#endif 864#endif
786#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 865#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
787 defined(CONFIG_ARCH_OMAP4)
788 case METHOD_GPIO_24XX: 866 case METHOD_GPIO_24XX:
789 reg += OMAP24XX_GPIO_IRQSTATUS1; 867 reg += OMAP24XX_GPIO_IRQSTATUS1;
790 break; 868 break;
791#endif 869#endif
870#if defined(CONFIG_ARCH_OMAP4)
871 case METHOD_GPIO_24XX:
872 reg += OMAP4_GPIO_IRQSTATUS0;
873 break;
874#endif
792 default: 875 default:
793 WARN_ON(1); 876 WARN_ON(1);
794 return; 877 return;
@@ -798,12 +881,16 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
798 /* Workaround for clearing DSP GPIO interrupts to allow retention */ 881 /* Workaround for clearing DSP GPIO interrupts to allow retention */
799#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 882#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
800 reg = bank->base + OMAP24XX_GPIO_IRQSTATUS2; 883 reg = bank->base + OMAP24XX_GPIO_IRQSTATUS2;
801 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 884#endif
885#if defined(CONFIG_ARCH_OMAP4)
886 reg = bank->base + OMAP4_GPIO_IRQSTATUS1;
887#endif
888 if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
802 __raw_writel(gpio_mask, reg); 889 __raw_writel(gpio_mask, reg);
803 890
804 /* Flush posted write for the irq status to avoid spurious interrupts */ 891 /* Flush posted write for the irq status to avoid spurious interrupts */
805 __raw_readl(reg); 892 __raw_readl(reg);
806#endif 893 }
807} 894}
808 895
809static inline void _clear_gpio_irqstatus(struct gpio_bank *bank, int gpio) 896static inline void _clear_gpio_irqstatus(struct gpio_bank *bank, int gpio)
@@ -853,13 +940,18 @@ static u32 _get_gpio_irqbank_mask(struct gpio_bank *bank)
853 inv = 1; 940 inv = 1;
854 break; 941 break;
855#endif 942#endif
856#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 943#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
857 defined(CONFIG_ARCH_OMAP4)
858 case METHOD_GPIO_24XX: 944 case METHOD_GPIO_24XX:
859 reg += OMAP24XX_GPIO_IRQENABLE1; 945 reg += OMAP24XX_GPIO_IRQENABLE1;
860 mask = 0xffffffff; 946 mask = 0xffffffff;
861 break; 947 break;
862#endif 948#endif
949#if defined(CONFIG_ARCH_OMAP4)
950 case METHOD_GPIO_24XX:
951 reg += OMAP4_GPIO_IRQSTATUSSET0;
952 mask = 0xffffffff;
953 break;
954#endif
863 default: 955 default:
864 WARN_ON(1); 956 WARN_ON(1);
865 return 0; 957 return 0;
@@ -927,8 +1019,7 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
927 l |= gpio_mask; 1019 l |= gpio_mask;
928 break; 1020 break;
929#endif 1021#endif
930#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1022#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
931 defined(CONFIG_ARCH_OMAP4)
932 case METHOD_GPIO_24XX: 1023 case METHOD_GPIO_24XX:
933 if (enable) 1024 if (enable)
934 reg += OMAP24XX_GPIO_SETIRQENABLE1; 1025 reg += OMAP24XX_GPIO_SETIRQENABLE1;
@@ -937,6 +1028,15 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
937 l = gpio_mask; 1028 l = gpio_mask;
938 break; 1029 break;
939#endif 1030#endif
1031#ifdef CONFIG_ARCH_OMAP4
1032 case METHOD_GPIO_24XX:
1033 if (enable)
1034 reg += OMAP4_GPIO_IRQSTATUSSET0;
1035 else
1036 reg += OMAP4_GPIO_IRQSTATUSCLR0;
1037 l = gpio_mask;
1038 break;
1039#endif
940 default: 1040 default:
941 WARN_ON(1); 1041 WARN_ON(1);
942 return; 1042 return;
@@ -1112,11 +1212,14 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1112 if (bank->method == METHOD_GPIO_850) 1212 if (bank->method == METHOD_GPIO_850)
1113 isr_reg = bank->base + OMAP850_GPIO_INT_STATUS; 1213 isr_reg = bank->base + OMAP850_GPIO_INT_STATUS;
1114#endif 1214#endif
1115#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1215#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1116 defined(CONFIG_ARCH_OMAP4)
1117 if (bank->method == METHOD_GPIO_24XX) 1216 if (bank->method == METHOD_GPIO_24XX)
1118 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1; 1217 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1;
1119#endif 1218#endif
1219#if defined(CONFIG_ARCH_OMAP4)
1220 if (bank->method == METHOD_GPIO_24XX)
1221 isr_reg = bank->base + OMAP4_GPIO_IRQSTATUS0;
1222#endif
1120 while(1) { 1223 while(1) {
1121 u32 isr_saved, level_mask = 0; 1224 u32 isr_saved, level_mask = 0;
1122 u32 enabled; 1225 u32 enabled;
@@ -1189,6 +1292,7 @@ static void gpio_mask_irq(unsigned int irq)
1189 struct gpio_bank *bank = get_irq_chip_data(irq); 1292 struct gpio_bank *bank = get_irq_chip_data(irq);
1190 1293
1191 _set_gpio_irqenable(bank, gpio, 0); 1294 _set_gpio_irqenable(bank, gpio, 0);
1295 _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE);
1192} 1296}
1193 1297
1194static void gpio_unmask_irq(unsigned int irq) 1298static void gpio_unmask_irq(unsigned int irq)
@@ -1196,6 +1300,11 @@ static void gpio_unmask_irq(unsigned int irq)
1196 unsigned int gpio = irq - IH_GPIO_BASE; 1300 unsigned int gpio = irq - IH_GPIO_BASE;
1197 struct gpio_bank *bank = get_irq_chip_data(irq); 1301 struct gpio_bank *bank = get_irq_chip_data(irq);
1198 unsigned int irq_mask = 1 << get_gpio_index(gpio); 1302 unsigned int irq_mask = 1 << get_gpio_index(gpio);
1303 struct irq_desc *desc = irq_to_desc(irq);
1304 u32 trigger = desc->status & IRQ_TYPE_SENSE_MASK;
1305
1306 if (trigger)
1307 _set_gpio_triggering(bank, get_gpio_index(gpio), trigger);
1199 1308
1200 /* For level-triggered GPIOs, the clearing must be done after 1309 /* For level-triggered GPIOs, the clearing must be done after
1201 * the HW source is cleared, thus after the handler has run */ 1310 * the HW source is cleared, thus after the handler has run */
@@ -1547,7 +1656,7 @@ static int __init _omap_gpio_init(void)
1547 1656
1548 gpio_bank_count = OMAP34XX_NR_GPIOS; 1657 gpio_bank_count = OMAP34XX_NR_GPIOS;
1549 gpio_bank = gpio_bank_44xx; 1658 gpio_bank = gpio_bank_44xx;
1550 rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); 1659 rev = __raw_readl(gpio_bank[0].base + OMAP4_GPIO_REVISION);
1551 printk(KERN_INFO "OMAP44xx GPIO hardware version %d.%d\n", 1660 printk(KERN_INFO "OMAP44xx GPIO hardware version %d.%d\n",
1552 (rev >> 4) & 0x0f, rev & 0x0f); 1661 (rev >> 4) & 0x0f, rev & 0x0f);
1553 } 1662 }
@@ -1581,7 +1690,16 @@ static int __init _omap_gpio_init(void)
1581 static const u32 non_wakeup_gpios[] = { 1690 static const u32 non_wakeup_gpios[] = {
1582 0xe203ffc0, 0x08700040 1691 0xe203ffc0, 0x08700040
1583 }; 1692 };
1584 1693 if (cpu_is_omap44xx()) {
1694 __raw_writel(0xffffffff, bank->base +
1695 OMAP4_GPIO_IRQSTATUSCLR0);
1696 __raw_writew(0x0015, bank->base +
1697 OMAP4_GPIO_SYSCONFIG);
1698 __raw_writel(0x00000000, bank->base +
1699 OMAP4_GPIO_DEBOUNCENABLE);
1700 /* Initialize interface clock ungated, module enabled */
1701 __raw_writel(0, bank->base + OMAP4_GPIO_CTRL);
1702 } else {
1585 __raw_writel(0x00000000, bank->base + OMAP24XX_GPIO_IRQENABLE1); 1703 __raw_writel(0x00000000, bank->base + OMAP24XX_GPIO_IRQENABLE1);
1586 __raw_writel(0xffffffff, bank->base + OMAP24XX_GPIO_IRQSTATUS1); 1704 __raw_writel(0xffffffff, bank->base + OMAP24XX_GPIO_IRQSTATUS1);
1587 __raw_writew(0x0015, bank->base + OMAP24XX_GPIO_SYSCONFIG); 1705 __raw_writew(0x0015, bank->base + OMAP24XX_GPIO_SYSCONFIG);
@@ -1589,12 +1707,12 @@ static int __init _omap_gpio_init(void)
1589 1707
1590 /* Initialize interface clock ungated, module enabled */ 1708 /* Initialize interface clock ungated, module enabled */
1591 __raw_writel(0, bank->base + OMAP24XX_GPIO_CTRL); 1709 __raw_writel(0, bank->base + OMAP24XX_GPIO_CTRL);
1710 }
1592 if (i < ARRAY_SIZE(non_wakeup_gpios)) 1711 if (i < ARRAY_SIZE(non_wakeup_gpios))
1593 bank->non_wakeup_gpios = non_wakeup_gpios[i]; 1712 bank->non_wakeup_gpios = non_wakeup_gpios[i];
1594 gpio_count = 32; 1713 gpio_count = 32;
1595 } 1714 }
1596#endif 1715#endif
1597
1598 /* REVISIT eventually switch from OMAP-specific gpio structs 1716 /* REVISIT eventually switch from OMAP-specific gpio structs
1599 * over to the generic ones 1717 * over to the generic ones
1600 */ 1718 */
@@ -1680,14 +1798,20 @@ static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
1680 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; 1798 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
1681 break; 1799 break;
1682#endif 1800#endif
1683#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1801#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1684 defined(CONFIG_ARCH_OMAP4)
1685 case METHOD_GPIO_24XX: 1802 case METHOD_GPIO_24XX:
1686 wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN; 1803 wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN;
1687 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; 1804 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
1688 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA; 1805 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA;
1689 break; 1806 break;
1690#endif 1807#endif
1808#ifdef CONFIG_ARCH_OMAP4
1809 case METHOD_GPIO_24XX:
1810 wake_status = bank->base + OMAP4_GPIO_IRQWAKEN0;
1811 wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0;
1812 wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0;
1813 break;
1814#endif
1691 default: 1815 default:
1692 continue; 1816 continue;
1693 } 1817 }
@@ -1722,13 +1846,18 @@ static int omap_gpio_resume(struct sys_device *dev)
1722 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; 1846 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
1723 break; 1847 break;
1724#endif 1848#endif
1725#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1849#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1726 defined(CONFIG_ARCH_OMAP4)
1727 case METHOD_GPIO_24XX: 1850 case METHOD_GPIO_24XX:
1728 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; 1851 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
1729 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA; 1852 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA;
1730 break; 1853 break;
1731#endif 1854#endif
1855#ifdef CONFIG_ARCH_OMAP4
1856 case METHOD_GPIO_24XX:
1857 wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0;
1858 wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0;
1859 break;
1860#endif
1732 default: 1861 default:
1733 continue; 1862 continue;
1734 } 1863 }
@@ -1772,21 +1901,29 @@ void omap2_gpio_prepare_for_retention(void)
1772 1901
1773 if (!(bank->enabled_non_wakeup_gpios)) 1902 if (!(bank->enabled_non_wakeup_gpios))
1774 continue; 1903 continue;
1775#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1904#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1776 defined(CONFIG_ARCH_OMAP4)
1777 bank->saved_datain = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN); 1905 bank->saved_datain = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN);
1778 l1 = __raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT); 1906 l1 = __raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT);
1779 l2 = __raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT); 1907 l2 = __raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT);
1780#endif 1908#endif
1909#ifdef CONFIG_ARCH_OMAP4
1910 bank->saved_datain = __raw_readl(bank->base +
1911 OMAP4_GPIO_DATAIN);
1912 l1 = __raw_readl(bank->base + OMAP4_GPIO_FALLINGDETECT);
1913 l2 = __raw_readl(bank->base + OMAP4_GPIO_RISINGDETECT);
1914#endif
1781 bank->saved_fallingdetect = l1; 1915 bank->saved_fallingdetect = l1;
1782 bank->saved_risingdetect = l2; 1916 bank->saved_risingdetect = l2;
1783 l1 &= ~bank->enabled_non_wakeup_gpios; 1917 l1 &= ~bank->enabled_non_wakeup_gpios;
1784 l2 &= ~bank->enabled_non_wakeup_gpios; 1918 l2 &= ~bank->enabled_non_wakeup_gpios;
1785#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1919#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1786 defined(CONFIG_ARCH_OMAP4)
1787 __raw_writel(l1, bank->base + OMAP24XX_GPIO_FALLINGDETECT); 1920 __raw_writel(l1, bank->base + OMAP24XX_GPIO_FALLINGDETECT);
1788 __raw_writel(l2, bank->base + OMAP24XX_GPIO_RISINGDETECT); 1921 __raw_writel(l2, bank->base + OMAP24XX_GPIO_RISINGDETECT);
1789#endif 1922#endif
1923#ifdef CONFIG_ARCH_OMAP4
1924 __raw_writel(l1, bank->base + OMAP4_GPIO_FALLINGDETECT);
1925 __raw_writel(l2, bank->base + OMAP4_GPIO_RISINGDETECT);
1926#endif
1790 c++; 1927 c++;
1791 } 1928 }
1792 if (!c) { 1929 if (!c) {
@@ -1808,27 +1945,29 @@ void omap2_gpio_resume_after_retention(void)
1808 1945
1809 if (!(bank->enabled_non_wakeup_gpios)) 1946 if (!(bank->enabled_non_wakeup_gpios))
1810 continue; 1947 continue;
1811#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1948#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1812 defined(CONFIG_ARCH_OMAP4)
1813 __raw_writel(bank->saved_fallingdetect, 1949 __raw_writel(bank->saved_fallingdetect,
1814 bank->base + OMAP24XX_GPIO_FALLINGDETECT); 1950 bank->base + OMAP24XX_GPIO_FALLINGDETECT);
1815 __raw_writel(bank->saved_risingdetect, 1951 __raw_writel(bank->saved_risingdetect,
1816 bank->base + OMAP24XX_GPIO_RISINGDETECT); 1952 bank->base + OMAP24XX_GPIO_RISINGDETECT);
1953 l = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN);
1954#endif
1955#ifdef CONFIG_ARCH_OMAP4
1956 __raw_writel(bank->saved_fallingdetect,
1957 bank->base + OMAP4_GPIO_FALLINGDETECT);
1958 __raw_writel(bank->saved_risingdetect,
1959 bank->base + OMAP4_GPIO_RISINGDETECT);
1960 l = __raw_readl(bank->base + OMAP4_GPIO_DATAIN);
1817#endif 1961#endif
1818 /* Check if any of the non-wakeup interrupt GPIOs have changed 1962 /* Check if any of the non-wakeup interrupt GPIOs have changed
1819 * state. If so, generate an IRQ by software. This is 1963 * state. If so, generate an IRQ by software. This is
1820 * horribly racy, but it's the best we can do to work around 1964 * horribly racy, but it's the best we can do to work around
1821 * this silicon bug. */ 1965 * this silicon bug. */
1822#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
1823 defined(CONFIG_ARCH_OMAP4)
1824 l = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN);
1825#endif
1826 l ^= bank->saved_datain; 1966 l ^= bank->saved_datain;
1827 l &= bank->non_wakeup_gpios; 1967 l &= bank->non_wakeup_gpios;
1828 if (l) { 1968 if (l) {
1829 u32 old0, old1; 1969 u32 old0, old1;
1830#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1970#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1831 defined(CONFIG_ARCH_OMAP4)
1832 old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0); 1971 old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0);
1833 old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1); 1972 old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
1834 __raw_writel(old0 | l, bank->base + OMAP24XX_GPIO_LEVELDETECT0); 1973 __raw_writel(old0 | l, bank->base + OMAP24XX_GPIO_LEVELDETECT0);
@@ -1836,6 +1975,20 @@ void omap2_gpio_resume_after_retention(void)
1836 __raw_writel(old0, bank->base + OMAP24XX_GPIO_LEVELDETECT0); 1975 __raw_writel(old0, bank->base + OMAP24XX_GPIO_LEVELDETECT0);
1837 __raw_writel(old1, bank->base + OMAP24XX_GPIO_LEVELDETECT1); 1976 __raw_writel(old1, bank->base + OMAP24XX_GPIO_LEVELDETECT1);
1838#endif 1977#endif
1978#ifdef CONFIG_ARCH_OMAP4
1979 old0 = __raw_readl(bank->base +
1980 OMAP4_GPIO_LEVELDETECT0);
1981 old1 = __raw_readl(bank->base +
1982 OMAP4_GPIO_LEVELDETECT1);
1983 __raw_writel(old0 | l, bank->base +
1984 OMAP4_GPIO_LEVELDETECT0);
1985 __raw_writel(old1 | l, bank->base +
1986 OMAP4_GPIO_LEVELDETECT1);
1987 __raw_writel(old0, bank->base +
1988 OMAP4_GPIO_LEVELDETECT0);
1989 __raw_writel(old1, bank->base +
1990 OMAP4_GPIO_LEVELDETECT1);
1991#endif
1839 } 1992 }
1840 } 1993 }
1841 1994
diff --git a/arch/arm/plat-omap/include/mach/dma.h b/arch/arm/plat-omap/include/mach/dma.h
index 7b939cc01962..72f680b7180d 100644
--- a/arch/arm/plat-omap/include/mach/dma.h
+++ b/arch/arm/plat-omap/include/mach/dma.h
@@ -122,6 +122,11 @@
122#define OMAP_DMA4_CCFN(n) (0x60 * (n) + 0xc0) 122#define OMAP_DMA4_CCFN(n) (0x60 * (n) + 0xc0)
123#define OMAP_DMA4_COLOR(n) (0x60 * (n) + 0xc4) 123#define OMAP_DMA4_COLOR(n) (0x60 * (n) + 0xc4)
124 124
125/* Additional registers available on OMAP4 */
126#define OMAP_DMA4_CDP(n) (0x60 * (n) + 0xd0)
127#define OMAP_DMA4_CNDP(n) (0x60 * (n) + 0xd4)
128#define OMAP_DMA4_CCDN(n) (0x60 * (n) + 0xd8)
129
125/* Dummy defines to keep multi-omap compiles happy */ 130/* Dummy defines to keep multi-omap compiles happy */
126#define OMAP1_DMA_REVISION 0 131#define OMAP1_DMA_REVISION 0
127#define OMAP1_DMA_IRQSTATUS_L0 0 132#define OMAP1_DMA_IRQSTATUS_L0 0
@@ -311,6 +316,89 @@
311#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */ 316#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
312#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */ 317#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
313 318
319/* DMA request lines for 44xx */
320#define OMAP44XX_DMA_DSS_DISPC_REQ 6 /* S_DMA_5 */
321#define OMAP44XX_DMA_SYS_REQ2 7 /* S_DMA_6 */
322#define OMAP44XX_DMA_ISS_REQ1 9 /* S_DMA_8 */
323#define OMAP44XX_DMA_ISS_REQ2 10 /* S_DMA_9 */
324#define OMAP44XX_DMA_ISS_REQ3 12 /* S_DMA_11 */
325#define OMAP44XX_DMA_ISS_REQ4 13 /* S_DMA_12 */
326#define OMAP44XX_DMA_DSS_RFBI_REQ 14 /* S_DMA_13 */
327#define OMAP44XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
328#define OMAP44XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
329#define OMAP44XX_DMA_MCBSP2_TX 17 /* S_DMA_16 */
330#define OMAP44XX_DMA_MCBSP2_RX 18 /* S_DMA_17 */
331#define OMAP44XX_DMA_MCBSP3_TX 19 /* S_DMA_18 */
332#define OMAP44XX_DMA_MCBSP3_RX 20 /* S_DMA_19 */
333#define OMAP44XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
334#define OMAP44XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
335#define OMAP44XX_DMA_I2C3_TX 25 /* S_DMA_24 */
336#define OMAP44XX_DMA_I2C3_RX 26 /* S_DMA_25 */
337#define OMAP44XX_DMA_I2C1_TX 27 /* S_DMA_26 */
338#define OMAP44XX_DMA_I2C1_RX 28 /* S_DMA_27 */
339#define OMAP44XX_DMA_I2C2_TX 29 /* S_DMA_28 */
340#define OMAP44XX_DMA_I2C2_RX 30 /* S_DMA_29 */
341#define OMAP44XX_DMA_MCBSP4_TX 31 /* S_DMA_30 */
342#define OMAP44XX_DMA_MCBSP4_RX 32 /* S_DMA_31 */
343#define OMAP44XX_DMA_MCBSP1_TX 33 /* S_DMA_32 */
344#define OMAP44XX_DMA_MCBSP1_RX 34 /* S_DMA_33 */
345#define OMAP44XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
346#define OMAP44XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
347#define OMAP44XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
348#define OMAP44XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
349#define OMAP44XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
350#define OMAP44XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
351#define OMAP44XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
352#define OMAP44XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
353#define OMAP44XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
354#define OMAP44XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
355#define OMAP44XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
356#define OMAP44XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
357#define OMAP44XX_DMA_MMC2_TX 47 /* S_DMA_46 */
358#define OMAP44XX_DMA_MMC2_RX 48 /* S_DMA_47 */
359#define OMAP44XX_DMA_UART1_TX 49 /* S_DMA_48 */
360#define OMAP44XX_DMA_UART1_RX 50 /* S_DMA_49 */
361#define OMAP44XX_DMA_UART2_TX 51 /* S_DMA_50 */
362#define OMAP44XX_DMA_UART2_RX 52 /* S_DMA_51 */
363#define OMAP44XX_DMA_UART3_TX 53 /* S_DMA_52 */
364#define OMAP44XX_DMA_UART3_RX 54 /* S_DMA_53 */
365#define OMAP44XX_DMA_UART4_TX 55 /* S_DMA_54 */
366#define OMAP44XX_DMA_UART4_RX 56 /* S_DMA_55 */
367#define OMAP44XX_DMA_MMC4_TX 57 /* S_DMA_56 */
368#define OMAP44XX_DMA_MMC4_RX 58 /* S_DMA_57 */
369#define OMAP44XX_DMA_MMC5_TX 59 /* S_DMA_58 */
370#define OMAP44XX_DMA_MMC5_RX 60 /* S_DMA_59 */
371#define OMAP44XX_DMA_MMC1_TX 61 /* S_DMA_60 */
372#define OMAP44XX_DMA_MMC1_RX 62 /* S_DMA_61 */
373#define OMAP44XX_DMA_SYS_REQ3 64 /* S_DMA_63 */
374#define OMAP44XX_DMA_MCPDM_UP 65 /* S_DMA_64 */
375#define OMAP44XX_DMA_MCPDM_DL 66 /* S_DMA_65 */
376#define OMAP44XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
377#define OMAP44XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
378#define OMAP44XX_DMA_DSS_DSI1_REQ0 72 /* S_DMA_71 */
379#define OMAP44XX_DMA_DSS_DSI1_REQ1 73 /* S_DMA_72 */
380#define OMAP44XX_DMA_DSS_DSI1_REQ2 74 /* S_DMA_73 */
381#define OMAP44XX_DMA_DSS_DSI1_REQ3 75 /* S_DMA_74 */
382#define OMAP44XX_DMA_DSS_HDMI_REQ 76 /* S_DMA_75 */
383#define OMAP44XX_DMA_MMC3_TX 77 /* S_DMA_76 */
384#define OMAP44XX_DMA_MMC3_RX 78 /* S_DMA_77 */
385#define OMAP44XX_DMA_USIM_TX 79 /* S_DMA_78 */
386#define OMAP44XX_DMA_USIM_RX 80 /* S_DMA_79 */
387#define OMAP44XX_DMA_DSS_DSI2_REQ0 81 /* S_DMA_80 */
388#define OMAP44XX_DMA_DSS_DSI2_REQ1 82 /* S_DMA_81 */
389#define OMAP44XX_DMA_DSS_DSI2_REQ2 83 /* S_DMA_82 */
390#define OMAP44XX_DMA_DSS_DSI2_REQ3 84 /* S_DMA_83 */
391#define OMAP44XX_DMA_ABE_REQ0 101 /* S_DMA_100 */
392#define OMAP44XX_DMA_ABE_REQ1 102 /* S_DMA_101 */
393#define OMAP44XX_DMA_ABE_REQ2 103 /* S_DMA_102 */
394#define OMAP44XX_DMA_ABE_REQ3 104 /* S_DMA_103 */
395#define OMAP44XX_DMA_ABE_REQ4 105 /* S_DMA_104 */
396#define OMAP44XX_DMA_ABE_REQ5 106 /* S_DMA_105 */
397#define OMAP44XX_DMA_ABE_REQ6 107 /* S_DMA_106 */
398#define OMAP44XX_DMA_ABE_REQ7 108 /* S_DMA_107 */
399#define OMAP44XX_DMA_I2C4_TX 124 /* S_DMA_123 */
400#define OMAP44XX_DMA_I2C4_RX 125 /* S_DMA_124 */
401
314/*----------------------------------------------------------------------------*/ 402/*----------------------------------------------------------------------------*/
315 403
316/* Hardware registers for LCD DMA */ 404/* Hardware registers for LCD DMA */
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index bb154ea76769..ec6f81e06d39 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -53,6 +53,11 @@
53#define OMAP34XX_MCBSP4_BASE 0x49026000 53#define OMAP34XX_MCBSP4_BASE 0x49026000
54#define OMAP34XX_MCBSP5_BASE 0x48096000 54#define OMAP34XX_MCBSP5_BASE 0x48096000
55 55
56#define OMAP44XX_MCBSP1_BASE 0x49022000
57#define OMAP44XX_MCBSP2_BASE 0x49024000
58#define OMAP44XX_MCBSP3_BASE 0x49026000
59#define OMAP44XX_MCBSP4_BASE 0x48074000
60
56#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) 61#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730)
57 62
58#define OMAP_MCBSP_REG_DRR2 0x00 63#define OMAP_MCBSP_REG_DRR2 0x00
@@ -98,7 +103,8 @@
98#define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX 103#define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX
99#define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX 104#define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX
100 105
101#elif defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 106#elif defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
107 defined(CONFIG_ARCH_OMAP4)
102 108
103#define OMAP_MCBSP_REG_DRR2 0x00 109#define OMAP_MCBSP_REG_DRR2 0x00
104#define OMAP_MCBSP_REG_DRR1 0x04 110#define OMAP_MCBSP_REG_DRR1 0x04
diff --git a/arch/arm/plat-omap/include/mach/serial.h b/arch/arm/plat-omap/include/mach/serial.h
index 13abd02d1527..def0529c75eb 100644
--- a/arch/arm/plat-omap/include/mach/serial.h
+++ b/arch/arm/plat-omap/include/mach/serial.h
@@ -59,6 +59,7 @@ extern void omap_uart_check_wakeup(void);
59extern void omap_uart_prepare_suspend(void); 59extern void omap_uart_prepare_suspend(void);
60extern void omap_uart_prepare_idle(int num); 60extern void omap_uart_prepare_idle(int num);
61extern void omap_uart_resume_idle(int num); 61extern void omap_uart_resume_idle(int num);
62extern void omap_uart_enable_irqs(int enable);
62#endif 63#endif
63 64
64#endif 65#endif
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index efa0e0111f38..e42fa7cfc795 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -191,7 +191,7 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
191 OMAP_MCBSP_WRITE(io_base, MCR2, config->mcr2); 191 OMAP_MCBSP_WRITE(io_base, MCR2, config->mcr2);
192 OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1); 192 OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1);
193 OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0); 193 OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0);
194 if (cpu_is_omap2430() || cpu_is_omap34xx()) { 194 if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
195 OMAP_MCBSP_WRITE(io_base, XCCR, config->xccr); 195 OMAP_MCBSP_WRITE(io_base, XCCR, config->xccr);
196 OMAP_MCBSP_WRITE(io_base, RCCR, config->rccr); 196 OMAP_MCBSP_WRITE(io_base, RCCR, config->rccr);
197 } 197 }
diff --git a/arch/arm/plat-pxa/gpio.c b/arch/arm/plat-pxa/gpio.c
index abc79d44acaa..98548c6903a0 100644
--- a/arch/arm/plat-pxa/gpio.c
+++ b/arch/arm/plat-pxa/gpio.c
@@ -16,7 +16,7 @@
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/sysdev.h> 18#include <linux/sysdev.h>
19#include <linux/bootmem.h> 19#include <linux/slab.h>
20 20
21#include <mach/gpio.h> 21#include <mach/gpio.h>
22 22
@@ -112,17 +112,12 @@ static int __init pxa_init_gpio_chip(int gpio_end)
112 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; 112 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
113 struct pxa_gpio_chip *chips; 113 struct pxa_gpio_chip *chips;
114 114
115 /* this is early, we have to use bootmem allocator, and we really 115 chips = kzalloc(nbanks * sizeof(struct pxa_gpio_chip), GFP_KERNEL);
116 * want this to be allocated dynamically for different 'gpio_end'
117 */
118 chips = alloc_bootmem_low(nbanks * sizeof(struct pxa_gpio_chip));
119 if (chips == NULL) { 116 if (chips == NULL) {
120 pr_err("%s: failed to allocate GPIO chips\n", __func__); 117 pr_err("%s: failed to allocate GPIO chips\n", __func__);
121 return -ENOMEM; 118 return -ENOMEM;
122 } 119 }
123 120
124 memset(chips, 0, nbanks * sizeof(struct pxa_gpio_chip));
125
126 for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) { 121 for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) {
127 struct gpio_chip *c = &chips[i].chip; 122 struct gpio_chip *c = &chips[i].chip;
128 123
diff --git a/arch/arm/plat-s3c/Kconfig b/arch/arm/plat-s3c/Kconfig
index 935c7558469b..8931c5f0e46b 100644
--- a/arch/arm/plat-s3c/Kconfig
+++ b/arch/arm/plat-s3c/Kconfig
@@ -198,4 +198,9 @@ config S3C_DEV_USB_HSOTG
198 help 198 help
199 Compile in platform device definition for USB high-speed OtG 199 Compile in platform device definition for USB high-speed OtG
200 200
201config S3C_DEV_NAND
202 bool
203 help
204 Compile in platform device definition for NAND controller
205
201endif 206endif
diff --git a/arch/arm/plat-s3c/Makefile b/arch/arm/plat-s3c/Makefile
index 0761766b1833..3c09109e9e84 100644
--- a/arch/arm/plat-s3c/Makefile
+++ b/arch/arm/plat-s3c/Makefile
@@ -28,13 +28,17 @@ obj-$(CONFIG_PM) += pm.o
28obj-$(CONFIG_PM) += pm-gpio.o 28obj-$(CONFIG_PM) += pm-gpio.o
29obj-$(CONFIG_S3C2410_PM_CHECK) += pm-check.o 29obj-$(CONFIG_S3C2410_PM_CHECK) += pm-check.o
30 30
31# PWM support
32
33obj-$(CONFIG_HAVE_PWM) += pwm.o
34
31# devices 35# devices
32 36
33obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o 37obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o
34obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o 38obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o
35obj-y += dev-i2c0.o 39obj-y += dev-i2c0.o
36obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o 40obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o
37obj-$(CONFIG_SND_S3C64XX_SOC_I2S) += dev-audio.o
38obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o 41obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o
39obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o 42obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o
40obj-$(CONFIG_S3C_DEV_USB_HSOTG) += dev-usb-hsotg.o 43obj-$(CONFIG_S3C_DEV_USB_HSOTG) += dev-usb-hsotg.o
44obj-$(CONFIG_S3C_DEV_NAND) += dev-nand.o
diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c
new file mode 100644
index 000000000000..4e5323732434
--- /dev/null
+++ b/arch/arm/plat-s3c/dev-nand.c
@@ -0,0 +1,30 @@
1/*
2 * S3C series device definition for nand device
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7*/
8
9#include <linux/kernel.h>
10#include <linux/platform_device.h>
11
12#include <mach/map.h>
13#include <plat/devs.h>
14
15static struct resource s3c_nand_resource[] = {
16 [0] = {
17 .start = S3C_PA_NAND,
18 .end = S3C_PA_NAND + SZ_1M,
19 .flags = IORESOURCE_MEM,
20 }
21};
22
23struct platform_device s3c_device_nand = {
24 .name = "s3c2410-nand",
25 .id = -1,
26 .num_resources = ARRAY_SIZE(s3c_nand_resource),
27 .resource = s3c_nand_resource,
28};
29
30EXPORT_SYMBOL(s3c_device_nand);
diff --git a/arch/arm/plat-s3c/include/plat/adc.h b/arch/arm/plat-s3c/include/plat/adc.h
index d847bd476b6c..5f3b1cd53b90 100644
--- a/arch/arm/plat-s3c/include/plat/adc.h
+++ b/arch/arm/plat-s3c/include/plat/adc.h
@@ -19,10 +19,14 @@ struct s3c_adc_client;
19extern int s3c_adc_start(struct s3c_adc_client *client, 19extern int s3c_adc_start(struct s3c_adc_client *client,
20 unsigned int channel, unsigned int nr_samples); 20 unsigned int channel, unsigned int nr_samples);
21 21
22extern int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch);
23
22extern struct s3c_adc_client * 24extern struct s3c_adc_client *
23 s3c_adc_register(struct platform_device *pdev, 25 s3c_adc_register(struct platform_device *pdev,
24 void (*select)(unsigned selected), 26 void (*select)(struct s3c_adc_client *client,
25 void (*conv)(unsigned d0, unsigned d1, 27 unsigned selected),
28 void (*conv)(struct s3c_adc_client *client,
29 unsigned d0, unsigned d1,
26 unsigned *samples_left), 30 unsigned *samples_left),
27 unsigned int is_ts); 31 unsigned int is_ts);
28 32
diff --git a/arch/arm/plat-s3c/include/plat/cpu-freq.h b/arch/arm/plat-s3c/include/plat/cpu-freq.h
index c86a13307e90..7b982b7f28cd 100644
--- a/arch/arm/plat-s3c/include/plat/cpu-freq.h
+++ b/arch/arm/plat-s3c/include/plat/cpu-freq.h
@@ -17,6 +17,21 @@ struct s3c_cpufreq_info;
17struct s3c_cpufreq_board; 17struct s3c_cpufreq_board;
18struct s3c_iotimings; 18struct s3c_iotimings;
19 19
20/**
21 * struct s3c_freq - frequency information (mainly for core drivers)
22 * @fclk: The FCLK frequency in Hz.
23 * @armclk: The ARMCLK frequency in Hz.
24 * @hclk_tns: HCLK cycle time in 10ths of nano-seconds.
25 * @hclk: The HCLK frequency in Hz.
26 * @pclk: The PCLK frequency in Hz.
27 *
28 * This contains the frequency information about the current configuration
29 * mainly for the core drivers to ensure we do not end up passing about
30 * a large number of parameters.
31 *
32 * The @hclk_tns field is a useful cache for the parts of the drivers that
33 * need to calculate IO timings and suchlike.
34 */
20struct s3c_freq { 35struct s3c_freq {
21 unsigned long fclk; 36 unsigned long fclk;
22 unsigned long armclk; 37 unsigned long armclk;
@@ -25,48 +40,84 @@ struct s3c_freq {
25 unsigned long pclk; 40 unsigned long pclk;
26}; 41};
27 42
28/* wrapper 'struct cpufreq_freqs' so that any drivers receiving the 43/**
44 * struct s3c_cpufreq_freqs - s3c cpufreq notification information.
45 * @freqs: The cpufreq setting information.
46 * @old: The old clock settings.
47 * @new: The new clock settings.
48 * @pll_changing: Set if the PLL is changing.
49 *
50 * Wrapper 'struct cpufreq_freqs' so that any drivers receiving the
29 * notification can use this information that is not provided by just 51 * notification can use this information that is not provided by just
30 * having the core frequency alone. 52 * having the core frequency alone.
53 *
54 * The pll_changing flag is used to indicate if the PLL itself is
55 * being set during this change. This is important as the clocks
56 * will temporarily be set to the XTAL clock during this time, so
57 * drivers may want to close down their output during this time.
58 *
59 * Note, this is not being used by any current drivers and therefore
60 * may be removed in the future.
31 */ 61 */
32
33struct s3c_cpufreq_freqs { 62struct s3c_cpufreq_freqs {
34 struct cpufreq_freqs freqs; 63 struct cpufreq_freqs freqs;
35 struct s3c_freq old; 64 struct s3c_freq old;
36 struct s3c_freq new; 65 struct s3c_freq new;
66
67 unsigned int pll_changing:1;
37}; 68};
38 69
39#define to_s3c_cpufreq(_cf) container_of(_cf, struct s3c_cpufreq_freqs, freqs) 70#define to_s3c_cpufreq(_cf) container_of(_cf, struct s3c_cpufreq_freqs, freqs)
40 71
72/**
73 * struct s3c_clkdivs - clock divisor information
74 * @p_divisor: Divisor from FCLK to PCLK.
75 * @h_divisor: Divisor from FCLK to HCLK.
76 * @arm_divisor: Divisor from FCLK to ARMCLK (not all CPUs).
77 * @dvs: Non-zero if using DVS mode for ARMCLK.
78 *
79 * Divisor settings for the core clocks.
80 */
41struct s3c_clkdivs { 81struct s3c_clkdivs {
42 int p_divisor; /* fclk / pclk */ 82 int p_divisor;
43 int h_divisor; /* fclk / hclk */ 83 int h_divisor;
44 int arm_divisor; /* not all cpus have this. */ 84 int arm_divisor;
45 unsigned char dvs; /* using dvs mode to arm. */ 85 unsigned char dvs;
46}; 86};
47 87
48#define PLLVAL(_m, _p, _s) (((_m) << 12) | ((_p) << 4) | (_s)) 88#define PLLVAL(_m, _p, _s) (((_m) << 12) | ((_p) << 4) | (_s))
49 89
90/**
91 * struct s3c_pllval - PLL value entry.
92 * @freq: The frequency for this entry in Hz.
93 * @pll_reg: The PLL register setting for this PLL value.
94 */
50struct s3c_pllval { 95struct s3c_pllval {
51 unsigned long freq; 96 unsigned long freq;
52 unsigned long pll_reg; 97 unsigned long pll_reg;
53}; 98};
54 99
55struct s3c_cpufreq_config { 100/**
56 struct s3c_freq freq; 101 * struct s3c_cpufreq_board - per-board cpu frequency informatin
57 struct s3c_pllval pll; 102 * @refresh: The SDRAM refresh period in nanoseconds.
58 struct s3c_clkdivs divs; 103 * @auto_io: Set if the IO timing settings should be generated from the
59 struct s3c_cpufreq_info *info; /* for core, not drivers */ 104 * initialisation time hardware registers.
60 struct s3c_cpufreq_board *board; 105 * @need_io: Set if the board has external IO on any of the chipselect
61}; 106 * lines that will require the hardware timing registers to be
62 107 * updated on a clock change.
63/* s3c_cpufreq_board 108 * @max: The maxium frequency limits for the system. Any field that
109 * is left at zero will use the CPU's settings.
110 *
111 * This contains the board specific settings that affect how the CPU
112 * drivers chose settings. These include the memory refresh and IO
113 * timing information.
64 * 114 *
65 * per-board configuraton information, such as memory refresh and 115 * Registration depends on the driver being used, the ARMCLK only
66 * how to initialise IO timings. 116 * implementation does not currently need this but the older style
117 * driver requires this to be available.
67 */ 118 */
68struct s3c_cpufreq_board { 119struct s3c_cpufreq_board {
69 unsigned int refresh; /* refresh period in ns */ 120 unsigned int refresh;
70 unsigned int auto_io:1; /* automatically init io timings. */ 121 unsigned int auto_io:1; /* automatically init io timings. */
71 unsigned int need_io:1; /* set if needs io timing support. */ 122 unsigned int need_io:1; /* set if needs io timing support. */
72 123
diff --git a/arch/arm/plat-s3c/include/plat/cpu.h b/arch/arm/plat-s3c/include/plat/cpu.h
index be541cbba070..fbc3d498e02e 100644
--- a/arch/arm/plat-s3c/include/plat/cpu.h
+++ b/arch/arm/plat-s3c/include/plat/cpu.h
@@ -65,6 +65,7 @@ extern struct sys_timer s3c24xx_timer;
65/* system device classes */ 65/* system device classes */
66 66
67extern struct sysdev_class s3c2410_sysclass; 67extern struct sysdev_class s3c2410_sysclass;
68extern struct sysdev_class s3c2410a_sysclass;
68extern struct sysdev_class s3c2412_sysclass; 69extern struct sysdev_class s3c2412_sysclass;
69extern struct sysdev_class s3c2440_sysclass; 70extern struct sysdev_class s3c2440_sysclass;
70extern struct sysdev_class s3c2442_sysclass; 71extern struct sysdev_class s3c2442_sysclass;
diff --git a/arch/arm/plat-s3c/include/plat/devs.h b/arch/arm/plat-s3c/include/plat/devs.h
index 2e170827e0b0..0f540ea1e999 100644
--- a/arch/arm/plat-s3c/include/plat/devs.h
+++ b/arch/arm/plat-s3c/include/plat/devs.h
@@ -46,6 +46,8 @@ extern struct platform_device s3c_device_hsmmc2;
46extern struct platform_device s3c_device_spi0; 46extern struct platform_device s3c_device_spi0;
47extern struct platform_device s3c_device_spi1; 47extern struct platform_device s3c_device_spi1;
48 48
49extern struct platform_device s3c_device_hwmon;
50
49extern struct platform_device s3c_device_nand; 51extern struct platform_device s3c_device_nand;
50 52
51extern struct platform_device s3c_device_usbgadget; 53extern struct platform_device s3c_device_usbgadget;
@@ -56,5 +58,6 @@ extern struct platform_device s3c_device_usb_hsotg;
56#ifdef CONFIG_CPU_S3C2440 58#ifdef CONFIG_CPU_S3C2440
57 59
58extern struct platform_device s3c_device_camif; 60extern struct platform_device s3c_device_camif;
61extern struct platform_device s3c_device_ac97;
59 62
60#endif 63#endif
diff --git a/arch/arm/plat-s3c/include/plat/hwmon.h b/arch/arm/plat-s3c/include/plat/hwmon.h
new file mode 100644
index 000000000000..1ba88ea0aa31
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/hwmon.h
@@ -0,0 +1,41 @@
1/* linux/arch/arm/plat-s3c/include/plat/hwmon.h
2 *
3 * Copyright 2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C - HWMon interface for ADC
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_ADC_HWMON_H
15#define __ASM_ARCH_ADC_HWMON_H __FILE__
16
17/**
18 * s3c_hwmon_chcfg - channel configuration
19 * @name: The name to give this channel.
20 * @mult: Multiply the ADC value read by this.
21 * @div: Divide the value from the ADC by this.
22 *
23 * The value read from the ADC is converted to a value that
24 * hwmon expects (mV) by result = (value_read * @mult) / @div.
25 */
26struct s3c_hwmon_chcfg {
27 const char *name;
28 unsigned int mult;
29 unsigned int div;
30};
31
32/**
33 * s3c_hwmon_pdata - HWMON platform data
34 * @in: One configuration for each possible channel used.
35 */
36struct s3c_hwmon_pdata {
37 struct s3c_hwmon_chcfg *in[8];
38};
39
40#endif /* __ASM_ARCH_ADC_HWMON_H */
41
diff --git a/arch/arm/plat-s3c/include/plat/map-base.h b/arch/arm/plat-s3c/include/plat/map-base.h
index b84289d32a54..250be311c85b 100644
--- a/arch/arm/plat-s3c/include/plat/map-base.h
+++ b/arch/arm/plat-s3c/include/plat/map-base.h
@@ -32,9 +32,15 @@
32 32
33#define S3C_VA_IRQ S3C_ADDR(0x00000000) /* irq controller(s) */ 33#define S3C_VA_IRQ S3C_ADDR(0x00000000) /* irq controller(s) */
34#define S3C_VA_SYS S3C_ADDR(0x00100000) /* system control */ 34#define S3C_VA_SYS S3C_ADDR(0x00100000) /* system control */
35#define S3C_VA_MEM S3C_ADDR(0x00200000) /* system control */ 35#define S3C_VA_MEM S3C_ADDR(0x00200000) /* memory control */
36#define S3C_VA_TIMER S3C_ADDR(0x00300000) /* timer block */ 36#define S3C_VA_TIMER S3C_ADDR(0x00300000) /* timer block */
37#define S3C_VA_WATCHDOG S3C_ADDR(0x00400000) /* watchdog */ 37#define S3C_VA_WATCHDOG S3C_ADDR(0x00400000) /* watchdog */
38#define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */ 38#define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */
39 39
40/* This is used for the CPU specific mappings that may be needed, so that
41 * they do not need to directly used S3C_ADDR() and thus make it easier to
42 * modify the space for mapping.
43 */
44#define S3C_ADDR_CPU(x) S3C_ADDR(0x00500000 + (x))
45
40#endif /* __ASM_PLAT_MAP_H */ 46#endif /* __ASM_PLAT_MAP_H */
diff --git a/arch/arm/plat-s3c24xx/pwm.c b/arch/arm/plat-s3c/pwm.c
index 0120b760315b..f3d37ac5595b 100644
--- a/arch/arm/plat-s3c24xx/pwm.c
+++ b/arch/arm/plat-s3c/pwm.c
@@ -1,10 +1,10 @@
1/* arch/arm/plat-s3c24xx/pwm.c 1/* arch/arm/plat-s3c/pwm.c
2 * 2 *
3 * Copyright (c) 2007 Ben Dooks 3 * Copyright (c) 2007 Ben Dooks
4 * Copyright (c) 2008 Simtec Electronics 4 * Copyright (c) 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org> 5 * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org>
6 * 6 *
7 * S3C24XX PWM device core 7 * S3C series PWM device core
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
20#include <linux/pwm.h> 20#include <linux/pwm.h>
21 21
22#include <mach/irqs.h> 22#include <mach/irqs.h>
23#include <mach/map.h>
23 24
24#include <plat/devs.h> 25#include <plat/devs.h>
25#include <plat/regs-timer.h> 26#include <plat/regs-timer.h>
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index 5b0bc914f58e..9c7aca489643 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -10,6 +10,7 @@ config PLAT_S3C24XX
10 default y 10 default y
11 select NO_IOPORT 11 select NO_IOPORT
12 select ARCH_REQUIRE_GPIOLIB 12 select ARCH_REQUIRE_GPIOLIB
13 select S3C_DEVICE_NAND
13 help 14 help
14 Base platform code for any Samsung S3C24XX device 15 Base platform code for any Samsung S3C24XX device
15 16
@@ -34,6 +35,40 @@ config CPU_S3C244X
34 help 35 help
35 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems. 36 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems.
36 37
38config S3C2440_CPUFREQ
39 bool "S3C2440/S3C2442 CPU Frequency scaling support"
40 depends on CPU_FREQ_S3C24XX && (CPU_S3C2440 || CPU_S3C2442)
41 select S3C2410_CPUFREQ_UTILS
42 default y
43 help
44 CPU Frequency scaling support for S3C2440 and S3C2442 SoC CPUs.
45
46config S3C2440_XTAL_12000000
47 bool
48 help
49 Indicate that the build needs to support 12MHz system
50 crystal.
51
52config S3C2440_XTAL_16934400
53 bool
54 help
55 Indicate that the build needs to support 16.9344MHz system
56 crystal.
57
58config S3C2440_PLL_12000000
59 bool
60 depends on S3C2440_CPUFREQ && S3C2440_XTAL_12000000
61 default y if CPU_FREQ_S3C24XX_PLL
62 help
63 PLL tables for S3C2440 or S3C2442 CPUs with 12MHz crystals.
64
65config S3C2440_PLL_16934400
66 bool
67 depends on S3C2440_CPUFREQ && S3C2440_XTAL_16934400
68 default y if CPU_FREQ_S3C24XX_PLL
69 help
70 PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals.
71
37config S3C24XX_PWM 72config S3C24XX_PWM
38 bool "PWM device support" 73 bool "PWM device support"
39 select HAVE_PWM 74 select HAVE_PWM
@@ -105,8 +140,39 @@ config S3C24XX_SPI_BUS1_GPG5_GPG6_GPG7
105 SPI GPIO configuration code for BUS 1 when connected to 140 SPI GPIO configuration code for BUS 1 when connected to
106 GPG5, GPG6 and GPG7. 141 GPG5, GPG6 and GPG7.
107 142
143config S3C24XX_SPI_BUS1_GPD8_GPD9_GPD10
144 bool
145 help
146 SPI GPIO configuration code for BUS 1 when connected to
147 GPD8, GPD9 and GPD10.
148
108# common code for s3c24xx based machines, such as the SMDKs. 149# common code for s3c24xx based machines, such as the SMDKs.
109 150
151# cpu frequency items common between s3c2410 and s3c2440/s3c2442
152
153config S3C2410_IOTIMING
154 bool
155 depends on CPU_FREQ_S3C24XX
156 help
157 Internal node to select io timing code that is common to the s3c2410
158 and s3c2440/s3c2442 cpu frequency support.
159
160config S3C2410_CPUFREQ_UTILS
161 bool
162 depends on CPU_FREQ_S3C24XX
163 help
164 Internal node to select timing code that is common to the s3c2410
165 and s3c2440/s3c244 cpu frequency support.
166
167# cpu frequency support common to s3c2412, s3c2413 and s3c2442
168
169config S3C2412_IOTIMING
170 bool
171 depends on CPU_FREQ_S3C24XX && (CPU_S3C2412 || CPU_S3C2443)
172 help
173 Intel node to select io timing code that is common to the s3c2412
174 and the s3c2443.
175
110config MACH_SMDK 176config MACH_SMDK
111 bool 177 bool
112 help 178 help
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index 579a165c2827..7780d2dd833a 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -20,19 +20,28 @@ obj-y += gpiolib.o
20obj-y += clock.o 20obj-y += clock.o
21obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o 21obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o
22 22
23obj-$(CONFIG_CPU_FREQ_S3C24XX) += cpu-freq.o
24obj-$(CONFIG_CPU_FREQ_S3C24XX_DEBUGFS) += cpu-freq-debugfs.o
25
23# Architecture dependant builds 26# Architecture dependant builds
24 27
25obj-$(CONFIG_CPU_S3C244X) += s3c244x.o 28obj-$(CONFIG_CPU_S3C244X) += s3c244x.o
26obj-$(CONFIG_CPU_S3C244X) += s3c244x-irq.o 29obj-$(CONFIG_CPU_S3C244X) += s3c244x-irq.o
27obj-$(CONFIG_CPU_S3C244X) += s3c244x-clock.o 30obj-$(CONFIG_CPU_S3C244X) += s3c244x-clock.o
31obj-$(CONFIG_S3C2440_CPUFREQ) += s3c2440-cpufreq.o
32obj-$(CONFIG_S3C2440_PLL_12000000) += s3c2440-pll-12000000.o
33obj-$(CONFIG_S3C2440_PLL_16934400) += s3c2440-pll-16934400.o
34
28obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o 35obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
29obj-$(CONFIG_PM) += pm.o 36obj-$(CONFIG_PM) += pm.o
30obj-$(CONFIG_PM) += irq-pm.o 37obj-$(CONFIG_PM) += irq-pm.o
31obj-$(CONFIG_PM) += sleep.o 38obj-$(CONFIG_PM) += sleep.o
32obj-$(CONFIG_S3C24XX_PWM) += pwm.o
33obj-$(CONFIG_S3C2410_CLOCK) += s3c2410-clock.o 39obj-$(CONFIG_S3C2410_CLOCK) += s3c2410-clock.o
34obj-$(CONFIG_S3C2410_DMA) += dma.o 40obj-$(CONFIG_S3C2410_DMA) += dma.o
35obj-$(CONFIG_S3C24XX_ADC) += adc.o 41obj-$(CONFIG_S3C24XX_ADC) += adc.o
42obj-$(CONFIG_S3C2410_IOTIMING) += s3c2410-iotiming.o
43obj-$(CONFIG_S3C2412_IOTIMING) += s3c2412-iotiming.o
44obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += s3c2410-cpufreq-utils.o
36 45
37# device specific setup and/or initialisation 46# device specific setup and/or initialisation
38obj-$(CONFIG_ARCH_S3C2410) += setup-i2c.o 47obj-$(CONFIG_ARCH_S3C2410) += setup-i2c.o
@@ -41,6 +50,7 @@ obj-$(CONFIG_ARCH_S3C2410) += setup-i2c.o
41 50
42obj-$(CONFIG_S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13) += spi-bus0-gpe11_12_13.o 51obj-$(CONFIG_S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13) += spi-bus0-gpe11_12_13.o
43obj-$(CONFIG_S3C24XX_SPI_BUS1_GPG5_GPG6_GPG7) += spi-bus1-gpg5_6_7.o 52obj-$(CONFIG_S3C24XX_SPI_BUS1_GPG5_GPG6_GPG7) += spi-bus1-gpg5_6_7.o
53obj-$(CONFIG_S3C24XX_SPI_BUS1_GPD8_GPD9_GPD10) += spi-bus1-gpd8_9_10.o
44 54
45# machine common support 55# machine common support
46 56
diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c
index ee1baf11ad9e..11117a7ba911 100644
--- a/arch/arm/plat-s3c24xx/adc.c
+++ b/arch/arm/plat-s3c24xx/adc.c
@@ -39,13 +39,16 @@
39struct s3c_adc_client { 39struct s3c_adc_client {
40 struct platform_device *pdev; 40 struct platform_device *pdev;
41 struct list_head pend; 41 struct list_head pend;
42 wait_queue_head_t *wait;
42 43
43 unsigned int nr_samples; 44 unsigned int nr_samples;
45 int result;
44 unsigned char is_ts; 46 unsigned char is_ts;
45 unsigned char channel; 47 unsigned char channel;
46 48
47 void (*select_cb)(unsigned selected); 49 void (*select_cb)(struct s3c_adc_client *c, unsigned selected);
48 void (*convert_cb)(unsigned val1, unsigned val2, 50 void (*convert_cb)(struct s3c_adc_client *c,
51 unsigned val1, unsigned val2,
49 unsigned *samples_left); 52 unsigned *samples_left);
50}; 53};
51 54
@@ -81,7 +84,7 @@ static inline void s3c_adc_select(struct adc_device *adc,
81{ 84{
82 unsigned con = readl(adc->regs + S3C2410_ADCCON); 85 unsigned con = readl(adc->regs + S3C2410_ADCCON);
83 86
84 client->select_cb(1); 87 client->select_cb(client, 1);
85 88
86 con &= ~S3C2410_ADCCON_MUXMASK; 89 con &= ~S3C2410_ADCCON_MUXMASK;
87 con &= ~S3C2410_ADCCON_STDBM; 90 con &= ~S3C2410_ADCCON_STDBM;
@@ -153,25 +156,61 @@ int s3c_adc_start(struct s3c_adc_client *client,
153} 156}
154EXPORT_SYMBOL_GPL(s3c_adc_start); 157EXPORT_SYMBOL_GPL(s3c_adc_start);
155 158
156static void s3c_adc_default_select(unsigned select) 159static void s3c_convert_done(struct s3c_adc_client *client,
160 unsigned v, unsigned u, unsigned *left)
161{
162 client->result = v;
163 wake_up(client->wait);
164}
165
166int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch)
167{
168 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
169 int ret;
170
171 client->convert_cb = s3c_convert_done;
172 client->wait = &wake;
173 client->result = -1;
174
175 ret = s3c_adc_start(client, ch, 1);
176 if (ret < 0)
177 goto err;
178
179 ret = wait_event_timeout(wake, client->result >= 0, HZ / 2);
180 if (client->result < 0) {
181 ret = -ETIMEDOUT;
182 goto err;
183 }
184
185 client->convert_cb = NULL;
186 return client->result;
187
188err:
189 return ret;
190}
191EXPORT_SYMBOL_GPL(s3c_adc_convert);
192
193static void s3c_adc_default_select(struct s3c_adc_client *client,
194 unsigned select)
157{ 195{
158} 196}
159 197
160struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev, 198struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,
161 void (*select)(unsigned int selected), 199 void (*select)(struct s3c_adc_client *client,
162 void (*conv)(unsigned d0, unsigned d1, 200 unsigned int selected),
201 void (*conv)(struct s3c_adc_client *client,
202 unsigned d0, unsigned d1,
163 unsigned *samples_left), 203 unsigned *samples_left),
164 unsigned int is_ts) 204 unsigned int is_ts)
165{ 205{
166 struct s3c_adc_client *client; 206 struct s3c_adc_client *client;
167 207
168 WARN_ON(!pdev); 208 WARN_ON(!pdev);
169 WARN_ON(!conv);
170 209
171 if (!select) 210 if (!select)
172 select = s3c_adc_default_select; 211 select = s3c_adc_default_select;
173 212
174 if (!conv || !pdev) 213 if (!pdev)
175 return ERR_PTR(-EINVAL); 214 return ERR_PTR(-EINVAL);
176 215
177 client = kzalloc(sizeof(struct s3c_adc_client), GFP_KERNEL); 216 client = kzalloc(sizeof(struct s3c_adc_client), GFP_KERNEL);
@@ -230,16 +269,19 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
230 adc_dbg(adc, "read %d: 0x%04x, 0x%04x\n", client->nr_samples, data0, data1); 269 adc_dbg(adc, "read %d: 0x%04x, 0x%04x\n", client->nr_samples, data0, data1);
231 270
232 client->nr_samples--; 271 client->nr_samples--;
233 (client->convert_cb)(data0 & 0x3ff, data1 & 0x3ff, &client->nr_samples); 272
273 if (client->convert_cb)
274 (client->convert_cb)(client, data0 & 0x3ff, data1 & 0x3ff,
275 &client->nr_samples);
234 276
235 if (client->nr_samples > 0) { 277 if (client->nr_samples > 0) {
236 /* fire another conversion for this */ 278 /* fire another conversion for this */
237 279
238 client->select_cb(1); 280 client->select_cb(client, 1);
239 s3c_adc_convert(adc); 281 s3c_adc_convert(adc);
240 } else { 282 } else {
241 local_irq_save(flags); 283 local_irq_save(flags);
242 (client->select_cb)(0); 284 (client->select_cb)(client, 0);
243 adc->cur = NULL; 285 adc->cur = NULL;
244 286
245 s3c_adc_try(adc); 287 s3c_adc_try(adc);
diff --git a/arch/arm/plat-s3c24xx/cpu-freq-debugfs.c b/arch/arm/plat-s3c24xx/cpu-freq-debugfs.c
new file mode 100644
index 000000000000..a9276667c2fb
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/cpu-freq-debugfs.c
@@ -0,0 +1,199 @@
1/* linux/arch/arm/plat-s3c24xx/cpu-freq-debugfs.c
2 *
3 * Copyright (c) 2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX CPU Frequency scaling - debugfs status support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/cpufreq.h>
19#include <linux/debugfs.h>
20#include <linux/seq_file.h>
21#include <linux/err.h>
22
23#include <plat/cpu-freq-core.h>
24
25static struct dentry *dbgfs_root;
26static struct dentry *dbgfs_file_io;
27static struct dentry *dbgfs_file_info;
28static struct dentry *dbgfs_file_board;
29
30#define print_ns(x) ((x) / 10), ((x) % 10)
31
32static void show_max(struct seq_file *seq, struct s3c_freq *f)
33{
34 seq_printf(seq, "MAX: F=%lu, H=%lu, P=%lu, A=%lu\n",
35 f->fclk, f->hclk, f->pclk, f->armclk);
36}
37
38static int board_show(struct seq_file *seq, void *p)
39{
40 struct s3c_cpufreq_config *cfg;
41 struct s3c_cpufreq_board *brd;
42
43 cfg = s3c_cpufreq_getconfig();
44 if (!cfg) {
45 seq_printf(seq, "no configuration registered\n");
46 return 0;
47 }
48
49 brd = cfg->board;
50 if (!brd) {
51 seq_printf(seq, "no board definition set?\n");
52 return 0;
53 }
54
55 seq_printf(seq, "SDRAM refresh %u ns\n", brd->refresh);
56 seq_printf(seq, "auto_io=%u\n", brd->auto_io);
57 seq_printf(seq, "need_io=%u\n", brd->need_io);
58
59 show_max(seq, &brd->max);
60
61
62 return 0;
63}
64
65static int fops_board_open(struct inode *inode, struct file *file)
66{
67 return single_open(file, board_show, NULL);
68}
69
70static const struct file_operations fops_board = {
71 .open = fops_board_open,
72 .read = seq_read,
73 .llseek = seq_lseek,
74 .release = single_release,
75 .owner = THIS_MODULE,
76};
77
78static int info_show(struct seq_file *seq, void *p)
79{
80 struct s3c_cpufreq_config *cfg;
81
82 cfg = s3c_cpufreq_getconfig();
83 if (!cfg) {
84 seq_printf(seq, "no configuration registered\n");
85 return 0;
86 }
87
88 seq_printf(seq, " FCLK %ld Hz\n", cfg->freq.fclk);
89 seq_printf(seq, " HCLK %ld Hz (%lu.%lu ns)\n",
90 cfg->freq.hclk, print_ns(cfg->freq.hclk_tns));
91 seq_printf(seq, " PCLK %ld Hz\n", cfg->freq.hclk);
92 seq_printf(seq, "ARMCLK %ld Hz\n", cfg->freq.armclk);
93 seq_printf(seq, "\n");
94
95 show_max(seq, &cfg->max);
96
97 seq_printf(seq, "Divisors: P=%d, H=%d, A=%d, dvs=%s\n",
98 cfg->divs.h_divisor, cfg->divs.p_divisor,
99 cfg->divs.arm_divisor, cfg->divs.dvs ? "on" : "off");
100 seq_printf(seq, "\n");
101
102 seq_printf(seq, "lock_pll=%u\n", cfg->lock_pll);
103
104 return 0;
105}
106
107static int fops_info_open(struct inode *inode, struct file *file)
108{
109 return single_open(file, info_show, NULL);
110}
111
112static const struct file_operations fops_info = {
113 .open = fops_info_open,
114 .read = seq_read,
115 .llseek = seq_lseek,
116 .release = single_release,
117 .owner = THIS_MODULE,
118};
119
120static int io_show(struct seq_file *seq, void *p)
121{
122 void (*show_bank)(struct seq_file *, struct s3c_cpufreq_config *, union s3c_iobank *);
123 struct s3c_cpufreq_config *cfg;
124 struct s3c_iotimings *iot;
125 union s3c_iobank *iob;
126 int bank;
127
128 cfg = s3c_cpufreq_getconfig();
129 if (!cfg) {
130 seq_printf(seq, "no configuration registered\n");
131 return 0;
132 }
133
134 show_bank = cfg->info->debug_io_show;
135 if (!show_bank) {
136 seq_printf(seq, "no code to show bank timing\n");
137 return 0;
138 }
139
140 iot = s3c_cpufreq_getiotimings();
141 if (!iot) {
142 seq_printf(seq, "no io timings registered\n");
143 return 0;
144 }
145
146 seq_printf(seq, "hclk period is %lu.%lu ns\n", print_ns(cfg->freq.hclk_tns));
147
148 for (bank = 0; bank < MAX_BANKS; bank++) {
149 iob = &iot->bank[bank];
150
151 seq_printf(seq, "bank %d: ", bank);
152
153 if (!iob->io_2410) {
154 seq_printf(seq, "nothing set\n");
155 continue;
156 }
157
158 show_bank(seq, cfg, iob);
159 }
160
161 return 0;
162}
163
164static int fops_io_open(struct inode *inode, struct file *file)
165{
166 return single_open(file, io_show, NULL);
167}
168
169static const struct file_operations fops_io = {
170 .open = fops_io_open,
171 .read = seq_read,
172 .llseek = seq_lseek,
173 .release = single_release,
174 .owner = THIS_MODULE,
175};
176
177
178static int __init s3c_freq_debugfs_init(void)
179{
180 dbgfs_root = debugfs_create_dir("s3c-cpufreq", NULL);
181 if (IS_ERR(dbgfs_root)) {
182 printk(KERN_ERR "%s: error creating debugfs root\n", __func__);
183 return PTR_ERR(dbgfs_root);
184 }
185
186 dbgfs_file_io = debugfs_create_file("io-timing", S_IRUGO, dbgfs_root,
187 NULL, &fops_io);
188
189 dbgfs_file_info = debugfs_create_file("info", S_IRUGO, dbgfs_root,
190 NULL, &fops_info);
191
192 dbgfs_file_board = debugfs_create_file("board", S_IRUGO, dbgfs_root,
193 NULL, &fops_board);
194
195 return 0;
196}
197
198late_initcall(s3c_freq_debugfs_init);
199
diff --git a/arch/arm/plat-s3c24xx/cpu-freq.c b/arch/arm/plat-s3c24xx/cpu-freq.c
new file mode 100644
index 000000000000..4f1b789a1173
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/cpu-freq.c
@@ -0,0 +1,716 @@
1/* linux/arch/arm/plat-s3c24xx/cpu-freq.c
2 *
3 * Copyright (c) 2006,2007,2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX CPU Frequency scaling
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/cpufreq.h>
19#include <linux/cpu.h>
20#include <linux/clk.h>
21#include <linux/err.h>
22#include <linux/io.h>
23#include <linux/sysdev.h>
24#include <linux/kobject.h>
25#include <linux/sysfs.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29
30#include <plat/cpu.h>
31#include <plat/clock.h>
32#include <plat/cpu-freq-core.h>
33
34#include <mach/regs-clock.h>
35
36/* note, cpufreq support deals in kHz, no Hz */
37
38static struct cpufreq_driver s3c24xx_driver;
39static struct s3c_cpufreq_config cpu_cur;
40static struct s3c_iotimings s3c24xx_iotiming;
41static struct cpufreq_frequency_table *pll_reg;
42static unsigned int last_target = ~0;
43static unsigned int ftab_size;
44static struct cpufreq_frequency_table *ftab;
45
46static struct clk *_clk_mpll;
47static struct clk *_clk_xtal;
48static struct clk *clk_fclk;
49static struct clk *clk_hclk;
50static struct clk *clk_pclk;
51static struct clk *clk_arm;
52
53#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS
54struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void)
55{
56 return &cpu_cur;
57}
58
59struct s3c_iotimings *s3c_cpufreq_getiotimings(void)
60{
61 return &s3c24xx_iotiming;
62}
63#endif /* CONFIG_CPU_FREQ_S3C24XX_DEBUGFS */
64
65static void s3c_cpufreq_getcur(struct s3c_cpufreq_config *cfg)
66{
67 unsigned long fclk, pclk, hclk, armclk;
68
69 cfg->freq.fclk = fclk = clk_get_rate(clk_fclk);
70 cfg->freq.hclk = hclk = clk_get_rate(clk_hclk);
71 cfg->freq.pclk = pclk = clk_get_rate(clk_pclk);
72 cfg->freq.armclk = armclk = clk_get_rate(clk_arm);
73
74 cfg->pll.index = __raw_readl(S3C2410_MPLLCON);
75 cfg->pll.frequency = fclk;
76
77 cfg->freq.hclk_tns = 1000000000 / (cfg->freq.hclk / 10);
78
79 cfg->divs.h_divisor = fclk / hclk;
80 cfg->divs.p_divisor = fclk / pclk;
81}
82
83static inline void s3c_cpufreq_calc(struct s3c_cpufreq_config *cfg)
84{
85 unsigned long pll = cfg->pll.frequency;
86
87 cfg->freq.fclk = pll;
88 cfg->freq.hclk = pll / cfg->divs.h_divisor;
89 cfg->freq.pclk = pll / cfg->divs.p_divisor;
90
91 /* convert hclk into 10ths of nanoseconds for io calcs */
92 cfg->freq.hclk_tns = 1000000000 / (cfg->freq.hclk / 10);
93}
94
95static inline int closer(unsigned int target, unsigned int n, unsigned int c)
96{
97 int diff_cur = abs(target - c);
98 int diff_new = abs(target - n);
99
100 return (diff_new < diff_cur);
101}
102
103static void s3c_cpufreq_show(const char *pfx,
104 struct s3c_cpufreq_config *cfg)
105{
106 s3c_freq_dbg("%s: Fvco=%u, F=%lu, A=%lu, H=%lu (%u), P=%lu (%u)\n",
107 pfx, cfg->pll.frequency, cfg->freq.fclk, cfg->freq.armclk,
108 cfg->freq.hclk, cfg->divs.h_divisor,
109 cfg->freq.pclk, cfg->divs.p_divisor);
110}
111
112/* functions to wrapper the driver info calls to do the cpu specific work */
113
114static void s3c_cpufreq_setio(struct s3c_cpufreq_config *cfg)
115{
116 if (cfg->info->set_iotiming)
117 (cfg->info->set_iotiming)(cfg, &s3c24xx_iotiming);
118}
119
120static int s3c_cpufreq_calcio(struct s3c_cpufreq_config *cfg)
121{
122 if (cfg->info->calc_iotiming)
123 return (cfg->info->calc_iotiming)(cfg, &s3c24xx_iotiming);
124
125 return 0;
126}
127
128static void s3c_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
129{
130 (cfg->info->set_refresh)(cfg);
131}
132
133static void s3c_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
134{
135 (cfg->info->set_divs)(cfg);
136}
137
138static int s3c_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
139{
140 return (cfg->info->calc_divs)(cfg);
141}
142
143static void s3c_cpufreq_setfvco(struct s3c_cpufreq_config *cfg)
144{
145 (cfg->info->set_fvco)(cfg);
146}
147
148static inline void s3c_cpufreq_resume_clocks(void)
149{
150 cpu_cur.info->resume_clocks();
151}
152
153static inline void s3c_cpufreq_updateclk(struct clk *clk,
154 unsigned int freq)
155{
156 clk_set_rate(clk, freq);
157}
158
159static int s3c_cpufreq_settarget(struct cpufreq_policy *policy,
160 unsigned int target_freq,
161 struct cpufreq_frequency_table *pll)
162{
163 struct s3c_cpufreq_freqs freqs;
164 struct s3c_cpufreq_config cpu_new;
165 unsigned long flags;
166
167 cpu_new = cpu_cur; /* copy new from current */
168
169 s3c_cpufreq_show("cur", &cpu_cur);
170
171 /* TODO - check for DMA currently outstanding */
172
173 cpu_new.pll = pll ? *pll : cpu_cur.pll;
174
175 if (pll)
176 freqs.pll_changing = 1;
177
178 /* update our frequencies */
179
180 cpu_new.freq.armclk = target_freq;
181 cpu_new.freq.fclk = cpu_new.pll.frequency;
182
183 if (s3c_cpufreq_calcdivs(&cpu_new) < 0) {
184 printk(KERN_ERR "no divisors for %d\n", target_freq);
185 goto err_notpossible;
186 }
187
188 s3c_freq_dbg("%s: got divs\n", __func__);
189
190 s3c_cpufreq_calc(&cpu_new);
191
192 s3c_freq_dbg("%s: calculated frequencies for new\n", __func__);
193
194 if (cpu_new.freq.hclk != cpu_cur.freq.hclk) {
195 if (s3c_cpufreq_calcio(&cpu_new) < 0) {
196 printk(KERN_ERR "%s: no IO timings\n", __func__);
197 goto err_notpossible;
198 }
199 }
200
201 s3c_cpufreq_show("new", &cpu_new);
202
203 /* setup our cpufreq parameters */
204
205 freqs.old = cpu_cur.freq;
206 freqs.new = cpu_new.freq;
207
208 freqs.freqs.cpu = 0;
209 freqs.freqs.old = cpu_cur.freq.armclk / 1000;
210 freqs.freqs.new = cpu_new.freq.armclk / 1000;
211
212 /* update f/h/p clock settings before we issue the change
213 * notification, so that drivers do not need to do anything
214 * special if they want to recalculate on CPUFREQ_PRECHANGE. */
215
216 s3c_cpufreq_updateclk(_clk_mpll, cpu_new.pll.frequency);
217 s3c_cpufreq_updateclk(clk_fclk, cpu_new.freq.fclk);
218 s3c_cpufreq_updateclk(clk_hclk, cpu_new.freq.hclk);
219 s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk);
220
221 /* start the frequency change */
222
223 if (policy)
224 cpufreq_notify_transition(&freqs.freqs, CPUFREQ_PRECHANGE);
225
226 /* If hclk is staying the same, then we do not need to
227 * re-write the IO or the refresh timings whilst we are changing
228 * speed. */
229
230 local_irq_save(flags);
231
232 /* is our memory clock slowing down? */
233 if (cpu_new.freq.hclk < cpu_cur.freq.hclk) {
234 s3c_cpufreq_setrefresh(&cpu_new);
235 s3c_cpufreq_setio(&cpu_new);
236 }
237
238 if (cpu_new.freq.fclk == cpu_cur.freq.fclk) {
239 /* not changing PLL, just set the divisors */
240
241 s3c_cpufreq_setdivs(&cpu_new);
242 } else {
243 if (cpu_new.freq.fclk < cpu_cur.freq.fclk) {
244 /* slow the cpu down, then set divisors */
245
246 s3c_cpufreq_setfvco(&cpu_new);
247 s3c_cpufreq_setdivs(&cpu_new);
248 } else {
249 /* set the divisors, then speed up */
250
251 s3c_cpufreq_setdivs(&cpu_new);
252 s3c_cpufreq_setfvco(&cpu_new);
253 }
254 }
255
256 /* did our memory clock speed up */
257 if (cpu_new.freq.hclk > cpu_cur.freq.hclk) {
258 s3c_cpufreq_setrefresh(&cpu_new);
259 s3c_cpufreq_setio(&cpu_new);
260 }
261
262 /* update our current settings */
263 cpu_cur = cpu_new;
264
265 local_irq_restore(flags);
266
267 /* notify everyone we've done this */
268 if (policy)
269 cpufreq_notify_transition(&freqs.freqs, CPUFREQ_POSTCHANGE);
270
271 s3c_freq_dbg("%s: finished\n", __func__);
272 return 0;
273
274 err_notpossible:
275 printk(KERN_ERR "no compatible settings for %d\n", target_freq);
276 return -EINVAL;
277}
278
279/* s3c_cpufreq_target
280 *
281 * called by the cpufreq core to adjust the frequency that the CPU
282 * is currently running at.
283 */
284
285static int s3c_cpufreq_target(struct cpufreq_policy *policy,
286 unsigned int target_freq,
287 unsigned int relation)
288{
289 struct cpufreq_frequency_table *pll;
290 unsigned int index;
291
292 /* avoid repeated calls which cause a needless amout of duplicated
293 * logging output (and CPU time as the calculation process is
294 * done) */
295 if (target_freq == last_target)
296 return 0;
297
298 last_target = target_freq;
299
300 s3c_freq_dbg("%s: policy %p, target %u, relation %u\n",
301 __func__, policy, target_freq, relation);
302
303 if (ftab) {
304 if (cpufreq_frequency_table_target(policy, ftab,
305 target_freq, relation,
306 &index)) {
307 s3c_freq_dbg("%s: table failed\n", __func__);
308 return -EINVAL;
309 }
310
311 s3c_freq_dbg("%s: adjust %d to entry %d (%u)\n", __func__,
312 target_freq, index, ftab[index].frequency);
313 target_freq = ftab[index].frequency;
314 }
315
316 target_freq *= 1000; /* convert target to Hz */
317
318 /* find the settings for our new frequency */
319
320 if (!pll_reg || cpu_cur.lock_pll) {
321 /* either we've not got any PLL values, or we've locked
322 * to the current one. */
323 pll = NULL;
324 } else {
325 struct cpufreq_policy tmp_policy;
326 int ret;
327
328 /* we keep the cpu pll table in Hz, to ensure we get an
329 * accurate value for the PLL output. */
330
331 tmp_policy.min = policy->min * 1000;
332 tmp_policy.max = policy->max * 1000;
333 tmp_policy.cpu = policy->cpu;
334
335 /* cpufreq_frequency_table_target uses a pointer to 'index'
336 * which is the number of the table entry, not the value of
337 * the table entry's index field. */
338
339 ret = cpufreq_frequency_table_target(&tmp_policy, pll_reg,
340 target_freq, relation,
341 &index);
342
343 if (ret < 0) {
344 printk(KERN_ERR "%s: no PLL available\n", __func__);
345 goto err_notpossible;
346 }
347
348 pll = pll_reg + index;
349
350 s3c_freq_dbg("%s: target %u => %u\n",
351 __func__, target_freq, pll->frequency);
352
353 target_freq = pll->frequency;
354 }
355
356 return s3c_cpufreq_settarget(policy, target_freq, pll);
357
358 err_notpossible:
359 printk(KERN_ERR "no compatible settings for %d\n", target_freq);
360 return -EINVAL;
361}
362
363static unsigned int s3c_cpufreq_get(unsigned int cpu)
364{
365 return clk_get_rate(clk_arm) / 1000;
366}
367
368struct clk *s3c_cpufreq_clk_get(struct device *dev, const char *name)
369{
370 struct clk *clk;
371
372 clk = clk_get(dev, name);
373 if (IS_ERR(clk))
374 printk(KERN_ERR "cpufreq: failed to get clock '%s'\n", name);
375
376 return clk;
377}
378
379static int s3c_cpufreq_init(struct cpufreq_policy *policy)
380{
381 printk(KERN_INFO "%s: initialising policy %p\n", __func__, policy);
382
383 if (policy->cpu != 0)
384 return -EINVAL;
385
386 policy->cur = s3c_cpufreq_get(0);
387 policy->min = policy->cpuinfo.min_freq = 0;
388 policy->max = policy->cpuinfo.max_freq = cpu_cur.info->max.fclk / 1000;
389 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
390
391 /* feed the latency information from the cpu driver */
392 policy->cpuinfo.transition_latency = cpu_cur.info->latency;
393
394 if (ftab)
395 cpufreq_frequency_table_cpuinfo(policy, ftab);
396
397 return 0;
398}
399
400static __init int s3c_cpufreq_initclks(void)
401{
402 _clk_mpll = s3c_cpufreq_clk_get(NULL, "mpll");
403 _clk_xtal = s3c_cpufreq_clk_get(NULL, "xtal");
404 clk_fclk = s3c_cpufreq_clk_get(NULL, "fclk");
405 clk_hclk = s3c_cpufreq_clk_get(NULL, "hclk");
406 clk_pclk = s3c_cpufreq_clk_get(NULL, "pclk");
407 clk_arm = s3c_cpufreq_clk_get(NULL, "armclk");
408
409 if (IS_ERR(clk_fclk) || IS_ERR(clk_hclk) || IS_ERR(clk_pclk) ||
410 IS_ERR(_clk_mpll) || IS_ERR(clk_arm) || IS_ERR(_clk_xtal)) {
411 printk(KERN_ERR "%s: could not get clock(s)\n", __func__);
412 return -ENOENT;
413 }
414
415 printk(KERN_INFO "%s: clocks f=%lu,h=%lu,p=%lu,a=%lu\n", __func__,
416 clk_get_rate(clk_fclk) / 1000,
417 clk_get_rate(clk_hclk) / 1000,
418 clk_get_rate(clk_pclk) / 1000,
419 clk_get_rate(clk_arm) / 1000);
420
421 return 0;
422}
423
424static int s3c_cpufreq_verify(struct cpufreq_policy *policy)
425{
426 if (policy->cpu != 0)
427 return -EINVAL;
428
429 return 0;
430}
431
432#ifdef CONFIG_PM
433static struct cpufreq_frequency_table suspend_pll;
434static unsigned int suspend_freq;
435
436static int s3c_cpufreq_suspend(struct cpufreq_policy *policy, pm_message_t pmsg)
437{
438 suspend_pll.frequency = clk_get_rate(_clk_mpll);
439 suspend_pll.index = __raw_readl(S3C2410_MPLLCON);
440 suspend_freq = s3c_cpufreq_get(0) * 1000;
441
442 return 0;
443}
444
445static int s3c_cpufreq_resume(struct cpufreq_policy *policy)
446{
447 int ret;
448
449 s3c_freq_dbg("%s: resuming with policy %p\n", __func__, policy);
450
451 last_target = ~0; /* invalidate last_target setting */
452
453 /* first, find out what speed we resumed at. */
454 s3c_cpufreq_resume_clocks();
455
456 /* whilst we will be called later on, we try and re-set the
457 * cpu frequencies as soon as possible so that we do not end
458 * up resuming devices and then immediatley having to re-set
459 * a number of settings once these devices have restarted.
460 *
461 * as a note, it is expected devices are not used until they
462 * have been un-suspended and at that time they should have
463 * used the updated clock settings.
464 */
465
466 ret = s3c_cpufreq_settarget(NULL, suspend_freq, &suspend_pll);
467 if (ret) {
468 printk(KERN_ERR "%s: failed to reset pll/freq\n", __func__);
469 return ret;
470 }
471
472 return 0;
473}
474#else
475#define s3c_cpufreq_resume NULL
476#define s3c_cpufreq_suspend NULL
477#endif
478
479static struct cpufreq_driver s3c24xx_driver = {
480 .flags = CPUFREQ_STICKY,
481 .verify = s3c_cpufreq_verify,
482 .target = s3c_cpufreq_target,
483 .get = s3c_cpufreq_get,
484 .init = s3c_cpufreq_init,
485 .suspend = s3c_cpufreq_suspend,
486 .resume = s3c_cpufreq_resume,
487 .name = "s3c24xx",
488};
489
490
491int __init s3c_cpufreq_register(struct s3c_cpufreq_info *info)
492{
493 if (!info || !info->name) {
494 printk(KERN_ERR "%s: failed to pass valid information\n",
495 __func__);
496 return -EINVAL;
497 }
498
499 printk(KERN_INFO "S3C24XX CPU Frequency driver, %s cpu support\n",
500 info->name);
501
502 /* check our driver info has valid data */
503
504 BUG_ON(info->set_refresh == NULL);
505 BUG_ON(info->set_divs == NULL);
506 BUG_ON(info->calc_divs == NULL);
507
508 /* info->set_fvco is optional, depending on whether there
509 * is a need to set the clock code. */
510
511 cpu_cur.info = info;
512
513 /* Note, driver registering should probably update locktime */
514
515 return 0;
516}
517
518int __init s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
519{
520 struct s3c_cpufreq_board *ours;
521
522 if (!board) {
523 printk(KERN_INFO "%s: no board data\n", __func__);
524 return -EINVAL;
525 }
526
527 /* Copy the board information so that each board can make this
528 * initdata. */
529
530 ours = kzalloc(sizeof(struct s3c_cpufreq_board), GFP_KERNEL);
531 if (ours == NULL) {
532 printk(KERN_ERR "%s: no memory\n", __func__);
533 return -ENOMEM;
534 }
535
536 *ours = *board;
537 cpu_cur.board = ours;
538
539 return 0;
540}
541
542int __init s3c_cpufreq_auto_io(void)
543{
544 int ret;
545
546 if (!cpu_cur.info->get_iotiming) {
547 printk(KERN_ERR "%s: get_iotiming undefined\n", __func__);
548 return -ENOENT;
549 }
550
551 printk(KERN_INFO "%s: working out IO settings\n", __func__);
552
553 ret = (cpu_cur.info->get_iotiming)(&cpu_cur, &s3c24xx_iotiming);
554 if (ret)
555 printk(KERN_ERR "%s: failed to get timings\n", __func__);
556
557 return ret;
558}
559
560/* if one or is zero, then return the other, otherwise return the min */
561#define do_min(_a, _b) ((_a) == 0 ? (_b) : (_b) == 0 ? (_a) : min(_a, _b))
562
563/**
564 * s3c_cpufreq_freq_min - find the minimum settings for the given freq.
565 * @dst: The destination structure
566 * @a: One argument.
567 * @b: The other argument.
568 *
569 * Create a minimum of each frequency entry in the 'struct s3c_freq',
570 * unless the entry is zero when it is ignored and the non-zero argument
571 * used.
572 */
573static void s3c_cpufreq_freq_min(struct s3c_freq *dst,
574 struct s3c_freq *a, struct s3c_freq *b)
575{
576 dst->fclk = do_min(a->fclk, b->fclk);
577 dst->hclk = do_min(a->hclk, b->hclk);
578 dst->pclk = do_min(a->pclk, b->pclk);
579 dst->armclk = do_min(a->armclk, b->armclk);
580}
581
582static inline u32 calc_locktime(u32 freq, u32 time_us)
583{
584 u32 result;
585
586 result = freq * time_us;
587 result = DIV_ROUND_UP(result, 1000 * 1000);
588
589 return result;
590}
591
592static void s3c_cpufreq_update_loctkime(void)
593{
594 unsigned int bits = cpu_cur.info->locktime_bits;
595 u32 rate = (u32)clk_get_rate(_clk_xtal);
596 u32 val;
597
598 if (bits == 0) {
599 WARN_ON(1);
600 return;
601 }
602
603 val = calc_locktime(rate, cpu_cur.info->locktime_u) << bits;
604 val |= calc_locktime(rate, cpu_cur.info->locktime_m);
605
606 printk(KERN_INFO "%s: new locktime is 0x%08x\n", __func__, val);
607 __raw_writel(val, S3C2410_LOCKTIME);
608}
609
610static int s3c_cpufreq_build_freq(void)
611{
612 int size, ret;
613
614 if (!cpu_cur.info->calc_freqtable)
615 return -EINVAL;
616
617 kfree(ftab);
618 ftab = NULL;
619
620 size = cpu_cur.info->calc_freqtable(&cpu_cur, NULL, 0);
621 size++;
622
623 ftab = kmalloc(sizeof(struct cpufreq_frequency_table) * size, GFP_KERNEL);
624 if (!ftab) {
625 printk(KERN_ERR "%s: no memory for tables\n", __func__);
626 return -ENOMEM;
627 }
628
629 ftab_size = size;
630
631 ret = cpu_cur.info->calc_freqtable(&cpu_cur, ftab, size);
632 s3c_cpufreq_addfreq(ftab, ret, size, CPUFREQ_TABLE_END);
633
634 return 0;
635}
636
637static int __init s3c_cpufreq_initcall(void)
638{
639 int ret = 0;
640
641 if (cpu_cur.info && cpu_cur.board) {
642 ret = s3c_cpufreq_initclks();
643 if (ret)
644 goto out;
645
646 /* get current settings */
647 s3c_cpufreq_getcur(&cpu_cur);
648 s3c_cpufreq_show("cur", &cpu_cur);
649
650 if (cpu_cur.board->auto_io) {
651 ret = s3c_cpufreq_auto_io();
652 if (ret) {
653 printk(KERN_ERR "%s: failed to get io timing\n",
654 __func__);
655 goto out;
656 }
657 }
658
659 if (cpu_cur.board->need_io && !cpu_cur.info->set_iotiming) {
660 printk(KERN_ERR "%s: no IO support registered\n",
661 __func__);
662 ret = -EINVAL;
663 goto out;
664 }
665
666 if (!cpu_cur.info->need_pll)
667 cpu_cur.lock_pll = 1;
668
669 s3c_cpufreq_update_loctkime();
670
671 s3c_cpufreq_freq_min(&cpu_cur.max, &cpu_cur.board->max,
672 &cpu_cur.info->max);
673
674 if (cpu_cur.info->calc_freqtable)
675 s3c_cpufreq_build_freq();
676
677 ret = cpufreq_register_driver(&s3c24xx_driver);
678 }
679
680 out:
681 return ret;
682}
683
684late_initcall(s3c_cpufreq_initcall);
685
686/**
687 * s3c_plltab_register - register CPU PLL table.
688 * @plls: The list of PLL entries.
689 * @plls_no: The size of the PLL entries @plls.
690 *
691 * Register the given set of PLLs with the system.
692 */
693int __init s3c_plltab_register(struct cpufreq_frequency_table *plls,
694 unsigned int plls_no)
695{
696 struct cpufreq_frequency_table *vals;
697 unsigned int size;
698
699 size = sizeof(struct cpufreq_frequency_table) * (plls_no + 1);
700
701 vals = kmalloc(size, GFP_KERNEL);
702 if (vals) {
703 memcpy(vals, plls, size);
704 pll_reg = vals;
705
706 /* write a terminating entry, we don't store it in the
707 * table that is stored in the kernel */
708 vals += plls_no;
709 vals->frequency = CPUFREQ_TABLE_END;
710
711 printk(KERN_INFO "cpufreq: %d PLL entries\n", plls_no);
712 } else
713 printk(KERN_ERR "cpufreq: no memory for PLL tables\n");
714
715 return vals ? 0 : -ENOMEM;
716}
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index 1932b7e0da15..5447e60f3936 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -81,7 +81,7 @@ static struct cpu_table cpu_ids[] __initdata = {
81 .map_io = s3c2410_map_io, 81 .map_io = s3c2410_map_io,
82 .init_clocks = s3c2410_init_clocks, 82 .init_clocks = s3c2410_init_clocks,
83 .init_uarts = s3c2410_init_uarts, 83 .init_uarts = s3c2410_init_uarts,
84 .init = s3c2410_init, 84 .init = s3c2410a_init,
85 .name = name_s3c2410a 85 .name = name_s3c2410a
86 }, 86 },
87 { 87 {
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index 4eb378c89a39..f52a92ce8dda 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -26,6 +26,8 @@
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27#include <mach/fb.h> 27#include <mach/fb.h>
28#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <mach/dma.h>
30#include <mach/irqs.h>
29#include <asm/irq.h> 31#include <asm/irq.h>
30 32
31#include <plat/regs-serial.h> 33#include <plat/regs-serial.h>
@@ -180,25 +182,6 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
180 } 182 }
181} 183}
182 184
183/* NAND Controller */
184
185static struct resource s3c_nand_resource[] = {
186 [0] = {
187 .start = S3C24XX_PA_NAND,
188 .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
189 .flags = IORESOURCE_MEM,
190 }
191};
192
193struct platform_device s3c_device_nand = {
194 .name = "s3c2410-nand",
195 .id = -1,
196 .num_resources = ARRAY_SIZE(s3c_nand_resource),
197 .resource = s3c_nand_resource,
198};
199
200EXPORT_SYMBOL(s3c_device_nand);
201
202/* USB Device (Gadget)*/ 185/* USB Device (Gadget)*/
203 186
204static struct resource s3c_usbgadget_resource[] = { 187static struct resource s3c_usbgadget_resource[] = {
@@ -348,7 +331,7 @@ struct platform_device s3c_device_adc = {
348/* HWMON */ 331/* HWMON */
349 332
350struct platform_device s3c_device_hwmon = { 333struct platform_device s3c_device_hwmon = {
351 .name = "s3c24xx-hwmon", 334 .name = "s3c-hwmon",
352 .id = -1, 335 .id = -1,
353 .dev.parent = &s3c_device_adc.dev, 336 .dev.parent = &s3c_device_adc.dev,
354}; 337};
@@ -473,4 +456,52 @@ struct platform_device s3c_device_camif = {
473 456
474EXPORT_SYMBOL(s3c_device_camif); 457EXPORT_SYMBOL(s3c_device_camif);
475 458
459/* AC97 */
460
461static struct resource s3c_ac97_resource[] = {
462 [0] = {
463 .start = S3C2440_PA_AC97,
464 .end = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
465 .flags = IORESOURCE_MEM,
466 },
467 [1] = {
468 .start = IRQ_S3C244x_AC97,
469 .end = IRQ_S3C244x_AC97,
470 .flags = IORESOURCE_IRQ,
471 },
472 [2] = {
473 .name = "PCM out",
474 .start = DMACH_PCM_OUT,
475 .end = DMACH_PCM_OUT,
476 .flags = IORESOURCE_DMA,
477 },
478 [3] = {
479 .name = "PCM in",
480 .start = DMACH_PCM_IN,
481 .end = DMACH_PCM_IN,
482 .flags = IORESOURCE_DMA,
483 },
484 [4] = {
485 .name = "Mic in",
486 .start = DMACH_MIC_IN,
487 .end = DMACH_MIC_IN,
488 .flags = IORESOURCE_DMA,
489 },
490};
491
492static u64 s3c_device_ac97_dmamask = 0xffffffffUL;
493
494struct platform_device s3c_device_ac97 = {
495 .name = "s3c-ac97",
496 .id = -1,
497 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
498 .resource = s3c_ac97_resource,
499 .dev = {
500 .dma_mask = &s3c_device_ac97_dmamask,
501 .coherent_dma_mask = 0xffffffffUL
502 }
503};
504
505EXPORT_SYMBOL(s3c_device_ac97);
506
476#endif // CONFIG_CPU_S32440 507#endif // CONFIG_CPU_S32440
diff --git a/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h b/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h
new file mode 100644
index 000000000000..efeb025affc7
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h
@@ -0,0 +1,282 @@
1/* arch/arm/plat-s3c/include/plat/cpu-freq.h
2 *
3 * Copyright (c) 2006,2007,2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C CPU frequency scaling support - core support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <plat/cpu-freq.h>
15
16struct seq_file;
17
18#define MAX_BANKS (8)
19#define S3C2412_MAX_IO (8)
20
21/**
22 * struct s3c2410_iobank_timing - IO bank timings for S3C2410 style timings
23 * @bankcon: The cached version of settings in this structure.
24 * @tacp:
25 * @tacs: Time from address valid to nCS asserted.
26 * @tcos: Time from nCS asserted to nOE or nWE asserted.
27 * @tacc: Time that nOE or nWE is asserted.
28 * @tcoh: Time nCS is held after nOE or nWE are released.
29 * @tcah: Time address is held for after
30 * @nwait_en: Whether nWAIT is enabled for this bank.
31 *
32 * This structure represents the IO timings for a S3C2410 style IO bank
33 * used by the CPU frequency support if it needs to change the settings
34 * of the IO.
35 */
36struct s3c2410_iobank_timing {
37 unsigned long bankcon;
38 unsigned int tacp;
39 unsigned int tacs;
40 unsigned int tcos;
41 unsigned int tacc;
42 unsigned int tcoh; /* nCS hold afrer nOE/nWE */
43 unsigned int tcah; /* Address hold after nCS */
44 unsigned char nwait_en; /* nWait enabled for bank. */
45};
46
47/**
48 * struct s3c2412_iobank_timing - io timings for PL092 (S3C2412) style IO
49 * @idcy: The idle cycle time between transactions.
50 * @wstrd: nCS release to end of read cycle.
51 * @wstwr: nCS release to end of write cycle.
52 * @wstoen: nCS assertion to nOE assertion time.
53 * @wstwen: nCS assertion to nWE assertion time.
54 * @wstbrd: Burst ready delay.
55 * @smbidcyr: Register cache for smbidcyr value.
56 * @smbwstrd: Register cache for smbwstrd value.
57 * @smbwstwr: Register cache for smbwstwr value.
58 * @smbwstoen: Register cache for smbwstoen value.
59 * @smbwstwen: Register cache for smbwstwen value.
60 * @smbwstbrd: Register cache for smbwstbrd value.
61 *
62 * Timing information for a IO bank on an S3C2412 or similar system which
63 * uses a PL093 block.
64 */
65struct s3c2412_iobank_timing {
66 unsigned int idcy;
67 unsigned int wstrd;
68 unsigned int wstwr;
69 unsigned int wstoen;
70 unsigned int wstwen;
71 unsigned int wstbrd;
72
73 /* register cache */
74 unsigned char smbidcyr;
75 unsigned char smbwstrd;
76 unsigned char smbwstwr;
77 unsigned char smbwstoen;
78 unsigned char smbwstwen;
79 unsigned char smbwstbrd;
80};
81
82union s3c_iobank {
83 struct s3c2410_iobank_timing *io_2410;
84 struct s3c2412_iobank_timing *io_2412;
85};
86
87/**
88 * struct s3c_iotimings - Chip IO timings holder
89 * @bank: The timings for each IO bank.
90 */
91struct s3c_iotimings {
92 union s3c_iobank bank[MAX_BANKS];
93};
94
95/**
96 * struct s3c_plltab - PLL table information.
97 * @vals: List of PLL values.
98 * @size: Size of the PLL table @vals.
99 */
100struct s3c_plltab {
101 struct s3c_pllval *vals;
102 int size;
103};
104
105/**
106 * struct s3c_cpufreq_config - current cpu frequency configuration
107 * @freq: The current settings for the core clocks.
108 * @max: Maxium settings, derived from core, board and user settings.
109 * @pll: The PLL table entry for the current PLL settings.
110 * @divs: The divisor settings for the core clocks.
111 * @info: The current core driver information.
112 * @board: The information for the board we are running on.
113 * @lock_pll: Set if the PLL settings cannot be changed.
114 *
115 * This is for the core drivers that need to know information about
116 * the current settings and values. It should not be needed by any
117 * device drivers.
118*/
119struct s3c_cpufreq_config {
120 struct s3c_freq freq;
121 struct s3c_freq max;
122 struct cpufreq_frequency_table pll;
123 struct s3c_clkdivs divs;
124 struct s3c_cpufreq_info *info; /* for core, not drivers */
125 struct s3c_cpufreq_board *board;
126
127 unsigned int lock_pll:1;
128};
129
130/**
131 * struct s3c_cpufreq_info - Information for the CPU frequency driver.
132 * @name: The name of this implementation.
133 * @max: The maximum frequencies for the system.
134 * @latency: Transition latency to give to cpufreq.
135 * @locktime_m: The lock-time in uS for the MPLL.
136 * @locktime_u: The lock-time in uS for the UPLL.
137 * @locttime_bits: The number of bits each LOCKTIME field.
138 * @need_pll: Set if this driver needs to change the PLL values to acheive
139 * any frequency changes. This is really only need by devices like the
140 * S3C2410 where there is no or limited divider between the PLL and the
141 * ARMCLK.
142 * @resume_clocks: Update the clocks on resume.
143 * @get_iotiming: Get the current IO timing data, mainly for use at start.
144 * @set_iotiming: Update the IO timings from the cached copies calculated
145 * from the @calc_iotiming entry when changing the frequency.
146 * @calc_iotiming: Calculate and update the cached copies of the IO timings
147 * from the newly calculated frequencies.
148 * @calc_freqtable: Calculate (fill in) the given frequency table from the
149 * current frequency configuration. If the table passed in is NULL,
150 * then the return is the number of elements to be filled for allocation
151 * of the table.
152 * @set_refresh: Set the memory refresh configuration.
153 * @set_fvco: Set the PLL frequencies.
154 * @set_divs: Update the clock divisors.
155 * @calc_divs: Calculate the clock divisors.
156 */
157struct s3c_cpufreq_info {
158 const char *name;
159 struct s3c_freq max;
160
161 unsigned int latency;
162
163 unsigned int locktime_m;
164 unsigned int locktime_u;
165 unsigned char locktime_bits;
166
167 unsigned int need_pll:1;
168
169 /* driver routines */
170
171 void (*resume_clocks)(void);
172
173 int (*get_iotiming)(struct s3c_cpufreq_config *cfg,
174 struct s3c_iotimings *timings);
175
176 void (*set_iotiming)(struct s3c_cpufreq_config *cfg,
177 struct s3c_iotimings *timings);
178
179 int (*calc_iotiming)(struct s3c_cpufreq_config *cfg,
180 struct s3c_iotimings *timings);
181
182 int (*calc_freqtable)(struct s3c_cpufreq_config *cfg,
183 struct cpufreq_frequency_table *t,
184 size_t table_size);
185
186 void (*debug_io_show)(struct seq_file *seq,
187 struct s3c_cpufreq_config *cfg,
188 union s3c_iobank *iob);
189
190 void (*set_refresh)(struct s3c_cpufreq_config *cfg);
191 void (*set_fvco)(struct s3c_cpufreq_config *cfg);
192 void (*set_divs)(struct s3c_cpufreq_config *cfg);
193 int (*calc_divs)(struct s3c_cpufreq_config *cfg);
194};
195
196extern int s3c_cpufreq_register(struct s3c_cpufreq_info *info);
197
198extern int s3c_plltab_register(struct cpufreq_frequency_table *plls, unsigned int plls_no);
199
200/* exports and utilities for debugfs */
201extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void);
202extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void);
203
204extern void s3c2410_iotiming_debugfs(struct seq_file *seq,
205 struct s3c_cpufreq_config *cfg,
206 union s3c_iobank *iob);
207
208extern void s3c2412_iotiming_debugfs(struct seq_file *seq,
209 struct s3c_cpufreq_config *cfg,
210 union s3c_iobank *iob);
211
212#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS
213#define s3c_cpufreq_debugfs_call(x) x
214#else
215#define s3c_cpufreq_debugfs_call(x) NULL
216#endif
217
218/* Useful utility functions. */
219
220extern struct clk *s3c_cpufreq_clk_get(struct device *, const char *);
221
222/* S3C2410 and compatible exported functions */
223
224extern void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);
225
226extern int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
227 struct s3c_iotimings *iot);
228
229extern int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
230 struct s3c_iotimings *timings);
231
232extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
233 struct s3c_iotimings *iot);
234
235extern void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg);
236
237/* S3C2412 compatible routines */
238
239extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
240 struct s3c_iotimings *timings);
241
242extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
243 struct s3c_iotimings *timings);
244
245extern int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
246 struct s3c_iotimings *iot);
247
248extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
249 struct s3c_iotimings *iot);
250
251#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUG
252#define s3c_freq_dbg(x...) printk(KERN_INFO x)
253#else
254#define s3c_freq_dbg(x...) do { if (0) printk(x); } while (0)
255#endif /* CONFIG_CPU_FREQ_S3C24XX_DEBUG */
256
257#ifdef CONFIG_CPU_FREQ_S3C24XX_IODEBUG
258#define s3c_freq_iodbg(x...) printk(KERN_INFO x)
259#else
260#define s3c_freq_iodbg(x...) do { if (0) printk(x); } while (0)
261#endif /* CONFIG_CPU_FREQ_S3C24XX_IODEBUG */
262
263static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table,
264 int index, size_t table_size,
265 unsigned int freq)
266{
267 if (index < 0)
268 return index;
269
270 if (table) {
271 if (index >= table_size)
272 return -ENOMEM;
273
274 s3c_freq_dbg("%s: { %d = %u kHz }\n",
275 __func__, index, freq);
276
277 table[index].index = index;
278 table[index].frequency = freq;
279 }
280
281 return index + 1;
282}
diff --git a/arch/arm/plat-s3c24xx/include/plat/fiq.h b/arch/arm/plat-s3c24xx/include/plat/fiq.h
new file mode 100644
index 000000000000..8521b8372c5f
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/fiq.h
@@ -0,0 +1,13 @@
1/* linux/include/asm-arm/plat-s3c24xx/fiq.h
2 *
3 * Copyright (c) 2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C24XX CPU FIQ support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13extern int s3c24xx_set_fiq(unsigned int irq, bool on);
diff --git a/arch/arm/plat-s3c24xx/include/plat/s3c2410.h b/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
index a9ac9e29759e..b6deeef8f663 100644
--- a/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
+++ b/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
@@ -14,6 +14,7 @@
14#ifdef CONFIG_CPU_S3C2410 14#ifdef CONFIG_CPU_S3C2410
15 15
16extern int s3c2410_init(void); 16extern int s3c2410_init(void);
17extern int s3c2410a_init(void);
17 18
18extern void s3c2410_map_io(void); 19extern void s3c2410_map_io(void);
19 20
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c
index 958737775ad2..d02f5f02045e 100644
--- a/arch/arm/plat-s3c24xx/irq.c
+++ b/arch/arm/plat-s3c24xx/irq.c
@@ -493,6 +493,38 @@ s3c_irq_demux_extint4t7(unsigned int irq,
493 } 493 }
494} 494}
495 495
496#ifdef CONFIG_FIQ
497/**
498 * s3c24xx_set_fiq - set the FIQ routing
499 * @irq: IRQ number to route to FIQ on processor.
500 * @on: Whether to route @irq to the FIQ, or to remove the FIQ routing.
501 *
502 * Change the state of the IRQ to FIQ routing depending on @irq and @on. If
503 * @on is true, the @irq is checked to see if it can be routed and the
504 * interrupt controller updated to route the IRQ. If @on is false, the FIQ
505 * routing is cleared, regardless of which @irq is specified.
506 */
507int s3c24xx_set_fiq(unsigned int irq, bool on)
508{
509 u32 intmod;
510 unsigned offs;
511
512 if (on) {
513 offs = irq - FIQ_START;
514 if (offs > 31)
515 return -EINVAL;
516
517 intmod = 1 << offs;
518 } else {
519 intmod = 0;
520 }
521
522 __raw_writel(intmod, S3C2410_INTMOD);
523 return 0;
524}
525#endif
526
527
496/* s3c24xx_init_irq 528/* s3c24xx_init_irq
497 * 529 *
498 * Initialise S3C2410 IRQ system 530 * Initialise S3C2410 IRQ system
@@ -505,6 +537,10 @@ void __init s3c24xx_init_irq(void)
505 int irqno; 537 int irqno;
506 int i; 538 int i;
507 539
540#ifdef CONFIG_FIQ
541 init_FIQ();
542#endif
543
508 irqdbf("s3c2410_init_irq: clearing interrupt status flags\n"); 544 irqdbf("s3c2410_init_irq: clearing interrupt status flags\n");
509 545
510 /* first, clear all interrupts pending... */ 546 /* first, clear all interrupts pending... */
diff --git a/arch/arm/plat-s3c24xx/s3c2410-cpufreq-utils.c b/arch/arm/plat-s3c24xx/s3c2410-cpufreq-utils.c
new file mode 100644
index 000000000000..43ea80190d87
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/s3c2410-cpufreq-utils.c
@@ -0,0 +1,64 @@
1/* linux/arch/arm/plat-s3c24xx/s3c2410-cpufreq-utils.c
2 *
3 * Copyright (c) 2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX CPU Frequency scaling - utils for S3C2410/S3C2440/S3C2442
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/cpufreq.h>
17#include <linux/io.h>
18
19#include <mach/map.h>
20#include <mach/regs-mem.h>
21#include <mach/regs-clock.h>
22
23#include <plat/cpu-freq-core.h>
24
25/**
26 * s3c2410_cpufreq_setrefresh - set SDRAM refresh value
27 * @cfg: The frequency configuration
28 *
29 * Set the SDRAM refresh value appropriately for the configured
30 * frequency.
31 */
32void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
33{
34 struct s3c_cpufreq_board *board = cfg->board;
35 unsigned long refresh;
36 unsigned long refval;
37
38 /* Reduce both the refresh time (in ns) and the frequency (in MHz)
39 * down to ensure that we do not overflow 32 bit numbers.
40 *
41 * This should work for HCLK up to 133MHz and refresh period up
42 * to 30usec.
43 */
44
45 refresh = (cfg->freq.hclk / 100) * (board->refresh / 10);
46 refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); /* apply scale */
47 refresh = (1 << 11) + 1 - refresh;
48
49 s3c_freq_dbg("%s: refresh value %lu\n", __func__, refresh);
50
51 refval = __raw_readl(S3C2410_REFRESH);
52 refval &= ~((1 << 12) - 1);
53 refval |= refresh;
54 __raw_writel(refval, S3C2410_REFRESH);
55}
56
57/**
58 * s3c2410_set_fvco - set the PLL value
59 * @cfg: The frequency configuration
60 */
61void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
62{
63 __raw_writel(cfg->pll.index, S3C2410_MPLLCON);
64}
diff --git a/arch/arm/plat-s3c24xx/s3c2410-iotiming.c b/arch/arm/plat-s3c24xx/s3c2410-iotiming.c
new file mode 100644
index 000000000000..d0a3a145cd4d
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/s3c2410-iotiming.c
@@ -0,0 +1,477 @@
1/* linux/arch/arm/plat-s3c24xx/s3c2410-iotiming.c
2 *
3 * Copyright (c) 2006,2008,2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX CPU Frequency scaling - IO timing for S3C2410/S3C2440/S3C2442
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/cpufreq.h>
18#include <linux/seq_file.h>
19#include <linux/io.h>
20
21#include <mach/map.h>
22#include <mach/regs-mem.h>
23#include <mach/regs-clock.h>
24
25#include <plat/cpu-freq-core.h>
26
27#define print_ns(x) ((x) / 10), ((x) % 10)
28
29/**
30 * s3c2410_print_timing - print bank timing data for debug purposes
31 * @pfx: The prefix to put on the output
32 * @timings: The timing inforamtion to print.
33*/
34static void s3c2410_print_timing(const char *pfx,
35 struct s3c_iotimings *timings)
36{
37 struct s3c2410_iobank_timing *bt;
38 int bank;
39
40 for (bank = 0; bank < MAX_BANKS; bank++) {
41 bt = timings->bank[bank].io_2410;
42 if (!bt)
43 continue;
44
45 printk(KERN_DEBUG "%s %d: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, "
46 "Tcoh=%d.%d, Tcah=%d.%d\n", pfx, bank,
47 print_ns(bt->tacs),
48 print_ns(bt->tcos),
49 print_ns(bt->tacc),
50 print_ns(bt->tcoh),
51 print_ns(bt->tcah));
52 }
53}
54
55/**
56 * bank_reg - convert bank number to pointer to the control register.
57 * @bank: The IO bank number.
58 */
59static inline void __iomem *bank_reg(unsigned int bank)
60{
61 return S3C2410_BANKCON0 + (bank << 2);
62}
63
64/**
65 * bank_is_io - test whether bank is used for IO
66 * @bankcon: The bank control register.
67 *
68 * This is a simplistic test to see if any BANKCON[x] is not an IO
69 * bank. It currently does not take into account whether BWSCON has
70 * an illegal width-setting in it, or if the pin connected to nCS[x]
71 * is actually being handled as a chip-select.
72 */
73static inline int bank_is_io(unsigned long bankcon)
74{
75 return !(bankcon & S3C2410_BANKCON_SDRAM);
76}
77
78/**
79 * to_div - convert cycle time to divisor
80 * @cyc: The cycle time, in 10ths of nanoseconds.
81 * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
82 *
83 * Convert the given cycle time into the divisor to use to obtain it from
84 * HCLK.
85*/
86static inline unsigned int to_div(unsigned int cyc, unsigned int hclk_tns)
87{
88 if (cyc == 0)
89 return 0;
90
91 return DIV_ROUND_UP(cyc, hclk_tns);
92}
93
94/**
95 * calc_0124 - calculate divisor control for divisors that do /0, /1. /2 and /4
96 * @cyc: The cycle time, in 10ths of nanoseconds.
97 * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
98 * @v: Pointer to register to alter.
99 * @shift: The shift to get to the control bits.
100 *
101 * Calculate the divisor, and turn it into the correct control bits to
102 * set in the result, @v.
103 */
104static unsigned int calc_0124(unsigned int cyc, unsigned long hclk_tns,
105 unsigned long *v, int shift)
106{
107 unsigned int div = to_div(cyc, hclk_tns);
108 unsigned long val;
109
110 s3c_freq_iodbg("%s: cyc=%d, hclk=%lu, shift=%d => div %d\n",
111 __func__, cyc, hclk_tns, shift, div);
112
113 switch (div) {
114 case 0:
115 val = 0;
116 break;
117 case 1:
118 val = 1;
119 break;
120 case 2:
121 val = 2;
122 break;
123 case 3:
124 case 4:
125 val = 3;
126 break;
127 default:
128 return -1;
129 }
130
131 *v |= val << shift;
132 return 0;
133}
134
135int calc_tacp(unsigned int cyc, unsigned long hclk, unsigned long *v)
136{
137 /* Currently no support for Tacp calculations. */
138 return 0;
139}
140
141/**
142 * calc_tacc - calculate divisor control for tacc.
143 * @cyc: The cycle time, in 10ths of nanoseconds.
144 * @nwait_en: IS nWAIT enabled for this bank.
145 * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
146 * @v: Pointer to register to alter.
147 *
148 * Calculate the divisor control for tACC, taking into account whether
149 * the bank has nWAIT enabled. The result is used to modify the value
150 * pointed to by @v.
151*/
152static int calc_tacc(unsigned int cyc, int nwait_en,
153 unsigned long hclk_tns, unsigned long *v)
154{
155 unsigned int div = to_div(cyc, hclk_tns);
156 unsigned long val;
157
158 s3c_freq_iodbg("%s: cyc=%u, nwait=%d, hclk=%lu => div=%u\n",
159 __func__, cyc, nwait_en, hclk_tns, div);
160
161 /* if nWait enabled on an bank, Tacc must be at-least 4 cycles. */
162 if (nwait_en && div < 4)
163 div = 4;
164
165 switch (div) {
166 case 0:
167 val = 0;
168 break;
169
170 case 1:
171 case 2:
172 case 3:
173 case 4:
174 val = div - 1;
175 break;
176
177 case 5:
178 case 6:
179 val = 4;
180 break;
181
182 case 7:
183 case 8:
184 val = 5;
185 break;
186
187 case 9:
188 case 10:
189 val = 6;
190 break;
191
192 case 11:
193 case 12:
194 case 13:
195 case 14:
196 val = 7;
197 break;
198
199 default:
200 return -1;
201 }
202
203 *v |= val << 8;
204 return 0;
205}
206
207/**
208 * s3c2410_calc_bank - calculate bank timing infromation
209 * @cfg: The configuration we need to calculate for.
210 * @bt: The bank timing information.
211 *
212 * Given the cycle timine for a bank @bt, calculate the new BANKCON
213 * setting for the @cfg timing. This updates the timing information
214 * ready for the cpu frequency change.
215 */
216static int s3c2410_calc_bank(struct s3c_cpufreq_config *cfg,
217 struct s3c2410_iobank_timing *bt)
218{
219 unsigned long hclk = cfg->freq.hclk_tns;
220 unsigned long res;
221 int ret;
222
223 res = bt->bankcon;
224 res &= (S3C2410_BANKCON_SDRAM | S3C2410_BANKCON_PMC16);
225
226 /* tacp: 2,3,4,5 */
227 /* tcah: 0,1,2,4 */
228 /* tcoh: 0,1,2,4 */
229 /* tacc: 1,2,3,4,6,7,10,14 (>4 for nwait) */
230 /* tcos: 0,1,2,4 */
231 /* tacs: 0,1,2,4 */
232
233 ret = calc_0124(bt->tacs, hclk, &res, S3C2410_BANKCON_Tacs_SHIFT);
234 ret |= calc_0124(bt->tcos, hclk, &res, S3C2410_BANKCON_Tcos_SHIFT);
235 ret |= calc_0124(bt->tcah, hclk, &res, S3C2410_BANKCON_Tcah_SHIFT);
236 ret |= calc_0124(bt->tcoh, hclk, &res, S3C2410_BANKCON_Tcoh_SHIFT);
237
238 if (ret)
239 return -EINVAL;
240
241 ret |= calc_tacp(bt->tacp, hclk, &res);
242 ret |= calc_tacc(bt->tacc, bt->nwait_en, hclk, &res);
243
244 if (ret)
245 return -EINVAL;
246
247 bt->bankcon = res;
248 return 0;
249}
250
251static unsigned int tacc_tab[] = {
252 [0] = 1,
253 [1] = 2,
254 [2] = 3,
255 [3] = 4,
256 [4] = 6,
257 [5] = 9,
258 [6] = 10,
259 [7] = 14,
260};
261
262/**
263 * get_tacc - turn tACC value into cycle time
264 * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
265 * @val: The bank timing register value, shifed down.
266 */
267static unsigned int get_tacc(unsigned long hclk_tns,
268 unsigned long val)
269{
270 val &= 7;
271 return hclk_tns * tacc_tab[val];
272}
273
274/**
275 * get_0124 - turn 0/1/2/4 divider into cycle time
276 * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
277 * @val: The bank timing register value, shifed down.
278 */
279static unsigned int get_0124(unsigned long hclk_tns,
280 unsigned long val)
281{
282 val &= 3;
283 return hclk_tns * ((val == 3) ? 4 : val);
284}
285
286/**
287 * s3c2410_iotiming_getbank - turn BANKCON into cycle time information
288 * @cfg: The frequency configuration
289 * @bt: The bank timing to fill in (uses cached BANKCON)
290 *
291 * Given the BANKCON setting in @bt and the current frequency settings
292 * in @cfg, update the cycle timing information.
293 */
294void s3c2410_iotiming_getbank(struct s3c_cpufreq_config *cfg,
295 struct s3c2410_iobank_timing *bt)
296{
297 unsigned long bankcon = bt->bankcon;
298 unsigned long hclk = cfg->freq.hclk_tns;
299
300 bt->tcah = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcah_SHIFT);
301 bt->tcoh = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcoh_SHIFT);
302 bt->tcos = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcos_SHIFT);
303 bt->tacs = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tacs_SHIFT);
304 bt->tacc = get_tacc(hclk, bankcon >> S3C2410_BANKCON_Tacc_SHIFT);
305}
306
307/**
308 * s3c2410_iotiming_debugfs - debugfs show io bank timing information
309 * @seq: The seq_file to write output to using seq_printf().
310 * @cfg: The current configuration.
311 * @iob: The IO bank information to decode.
312 */
313void s3c2410_iotiming_debugfs(struct seq_file *seq,
314 struct s3c_cpufreq_config *cfg,
315 union s3c_iobank *iob)
316{
317 struct s3c2410_iobank_timing *bt = iob->io_2410;
318 unsigned long bankcon = bt->bankcon;
319 unsigned long hclk = cfg->freq.hclk_tns;
320 unsigned int tacs;
321 unsigned int tcos;
322 unsigned int tacc;
323 unsigned int tcoh;
324 unsigned int tcah;
325
326 seq_printf(seq, "BANKCON=0x%08lx\n", bankcon);
327
328 tcah = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcah_SHIFT);
329 tcoh = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcoh_SHIFT);
330 tcos = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcos_SHIFT);
331 tacs = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tacs_SHIFT);
332 tacc = get_tacc(hclk, bankcon >> S3C2410_BANKCON_Tacc_SHIFT);
333
334 seq_printf(seq,
335 "\tRead: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n",
336 print_ns(bt->tacs),
337 print_ns(bt->tcos),
338 print_ns(bt->tacc),
339 print_ns(bt->tcoh),
340 print_ns(bt->tcah));
341
342 seq_printf(seq,
343 "\t Set: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n",
344 print_ns(tacs),
345 print_ns(tcos),
346 print_ns(tacc),
347 print_ns(tcoh),
348 print_ns(tcah));
349}
350
351/**
352 * s3c2410_iotiming_calc - Calculate bank timing for frequency change.
353 * @cfg: The frequency configuration
354 * @iot: The IO timing information to fill out.
355 *
356 * Calculate the new values for the banks in @iot based on the new
357 * frequency information in @cfg. This is then used by s3c2410_iotiming_set()
358 * to update the timing when necessary.
359 */
360int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
361 struct s3c_iotimings *iot)
362{
363 struct s3c2410_iobank_timing *bt;
364 unsigned long bankcon;
365 int bank;
366 int ret;
367
368 for (bank = 0; bank < MAX_BANKS; bank++) {
369 bankcon = __raw_readl(bank_reg(bank));
370 bt = iot->bank[bank].io_2410;
371
372 if (!bt)
373 continue;
374
375 bt->bankcon = bankcon;
376
377 ret = s3c2410_calc_bank(cfg, bt);
378 if (ret) {
379 printk(KERN_ERR "%s: cannot calculate bank %d io\n",
380 __func__, bank);
381 goto err;
382 }
383
384 s3c_freq_iodbg("%s: bank %d: con=%08lx\n",
385 __func__, bank, bt->bankcon);
386 }
387
388 return 0;
389 err:
390 return ret;
391}
392
393/**
394 * s3c2410_iotiming_set - set the IO timings from the given setup.
395 * @cfg: The frequency configuration
396 * @iot: The IO timing information to use.
397 *
398 * Set all the currently used IO bank timing information generated
399 * by s3c2410_iotiming_calc() once the core has validated that all
400 * the new values are within permitted bounds.
401 */
402void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
403 struct s3c_iotimings *iot)
404{
405 struct s3c2410_iobank_timing *bt;
406 int bank;
407
408 /* set the io timings from the specifier */
409
410 for (bank = 0; bank < MAX_BANKS; bank++) {
411 bt = iot->bank[bank].io_2410;
412 if (!bt)
413 continue;
414
415 __raw_writel(bt->bankcon, bank_reg(bank));
416 }
417}
418
419/**
420 * s3c2410_iotiming_get - Get the timing information from current registers.
421 * @cfg: The frequency configuration
422 * @timings: The IO timing information to fill out.
423 *
424 * Calculate the @timings timing information from the current frequency
425 * information in @cfg, and the new frequency configur
426 * through all the IO banks, reading the state and then updating @iot
427 * as necessary.
428 *
429 * This is used at the moment on initialisation to get the current
430 * configuration so that boards do not have to carry their own setup
431 * if the timings are correct on initialisation.
432 */
433
434int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
435 struct s3c_iotimings *timings)
436{
437 struct s3c2410_iobank_timing *bt;
438 unsigned long bankcon;
439 unsigned long bwscon;
440 int bank;
441
442 bwscon = __raw_readl(S3C2410_BWSCON);
443
444 /* look through all banks to see what is currently set. */
445
446 for (bank = 0; bank < MAX_BANKS; bank++) {
447 bankcon = __raw_readl(bank_reg(bank));
448
449 if (!bank_is_io(bankcon))
450 continue;
451
452 s3c_freq_iodbg("%s: bank %d: con %08lx\n",
453 __func__, bank, bankcon);
454
455 bt = kzalloc(sizeof(struct s3c2410_iobank_timing), GFP_KERNEL);
456 if (!bt) {
457 printk(KERN_ERR "%s: no memory for bank\n", __func__);
458 return -ENOMEM;
459 }
460
461 /* find out in nWait is enabled for bank. */
462
463 if (bank != 0) {
464 unsigned long tmp = S3C2410_BWSCON_GET(bwscon, bank);
465 if (tmp & S3C2410_BWSCON_WS)
466 bt->nwait_en = 1;
467 }
468
469 timings->bank[bank].io_2410 = bt;
470 bt->bankcon = bankcon;
471
472 s3c2410_iotiming_getbank(cfg, bt);
473 }
474
475 s3c2410_print_timing("get", timings);
476 return 0;
477}
diff --git a/arch/arm/plat-s3c24xx/s3c2412-iotiming.c b/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
new file mode 100644
index 000000000000..fd45e47facbc
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
@@ -0,0 +1,285 @@
1/* linux/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
2 *
3 * Copyright (c) 2006,2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2412/S3C2443 (PL093 based) IO timing support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/cpufreq.h>
19#include <linux/seq_file.h>
20#include <linux/sysdev.h>
21#include <linux/delay.h>
22#include <linux/clk.h>
23#include <linux/err.h>
24
25#include <linux/amba/pl093.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29
30#include <mach/regs-s3c2412-mem.h>
31
32#include <plat/cpu.h>
33#include <plat/cpu-freq-core.h>
34#include <plat/clock.h>
35
36#define print_ns(x) ((x) / 10), ((x) % 10)
37
38/**
39 * s3c2412_print_timing - print timing infromation via printk.
40 * @pfx: The prefix to print each line with.
41 * @iot: The IO timing information
42 */
43static void s3c2412_print_timing(const char *pfx, struct s3c_iotimings *iot)
44{
45 struct s3c2412_iobank_timing *bt;
46 unsigned int bank;
47
48 for (bank = 0; bank < MAX_BANKS; bank++) {
49 bt = iot->bank[bank].io_2412;
50 if (!bt)
51 continue;
52
53 printk(KERN_DEBUG "%s: %d: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
54 "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n", pfx, bank,
55 print_ns(bt->idcy),
56 print_ns(bt->wstrd),
57 print_ns(bt->wstwr),
58 print_ns(bt->wstoen),
59 print_ns(bt->wstwen),
60 print_ns(bt->wstbrd));
61 }
62}
63
64/**
65 * to_div - turn a cycle length into a divisor setting.
66 * @cyc_tns: The cycle time in 10ths of nanoseconds.
67 * @clk_tns: The clock period in 10ths of nanoseconds.
68 */
69static inline unsigned int to_div(unsigned int cyc_tns, unsigned int clk_tns)
70{
71 return cyc_tns ? DIV_ROUND_UP(cyc_tns, clk_tns) : 0;
72}
73
74/**
75 * calc_timing - calculate timing divisor value and check in range.
76 * @hwtm: The hardware timing in 10ths of nanoseconds.
77 * @clk_tns: The clock period in 10ths of nanoseconds.
78 * @err: Pointer to err variable to update in event of failure.
79 */
80static unsigned int calc_timing(unsigned int hwtm, unsigned int clk_tns,
81 unsigned int *err)
82{
83 unsigned int ret = to_div(hwtm, clk_tns);
84
85 if (ret > 0xf)
86 *err = -EINVAL;
87
88 return ret;
89}
90
91/**
92 * s3c2412_calc_bank - calculate the bank divisor settings.
93 * @cfg: The current frequency configuration.
94 * @bt: The bank timing.
95 */
96static int s3c2412_calc_bank(struct s3c_cpufreq_config *cfg,
97 struct s3c2412_iobank_timing *bt)
98{
99 unsigned int hclk = cfg->freq.hclk_tns;
100 int err = 0;
101
102 bt->smbidcyr = calc_timing(bt->idcy, hclk, &err);
103 bt->smbwstrd = calc_timing(bt->wstrd, hclk, &err);
104 bt->smbwstwr = calc_timing(bt->wstwr, hclk, &err);
105 bt->smbwstoen = calc_timing(bt->wstoen, hclk, &err);
106 bt->smbwstwen = calc_timing(bt->wstwen, hclk, &err);
107 bt->smbwstbrd = calc_timing(bt->wstbrd, hclk, &err);
108
109 return err;
110}
111
112/**
113 * s3c2412_iotiming_debugfs - debugfs show io bank timing information
114 * @seq: The seq_file to write output to using seq_printf().
115 * @cfg: The current configuration.
116 * @iob: The IO bank information to decode.
117*/
118void s3c2412_iotiming_debugfs(struct seq_file *seq,
119 struct s3c_cpufreq_config *cfg,
120 union s3c_iobank *iob)
121{
122 struct s3c2412_iobank_timing *bt = iob->io_2412;
123
124 seq_printf(seq,
125 "\tRead: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
126 "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n",
127 print_ns(bt->idcy),
128 print_ns(bt->wstrd),
129 print_ns(bt->wstwr),
130 print_ns(bt->wstoen),
131 print_ns(bt->wstwen),
132 print_ns(bt->wstbrd));
133}
134
135/**
136 * s3c2412_iotiming_calc - calculate all the bank divisor settings.
137 * @cfg: The current frequency configuration.
138 * @iot: The bank timing information.
139 *
140 * Calculate the timing information for all the banks that are
141 * configured as IO, using s3c2412_calc_bank().
142 */
143int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
144 struct s3c_iotimings *iot)
145{
146 struct s3c2412_iobank_timing *bt;
147 int bank;
148 int ret;
149
150 for (bank = 0; bank < MAX_BANKS; bank++) {
151 bt = iot->bank[bank].io_2412;
152 if (!bt)
153 continue;
154
155 ret = s3c2412_calc_bank(cfg, bt);
156 if (ret) {
157 printk(KERN_ERR "%s: cannot calculate bank %d io\n",
158 __func__, bank);
159 goto err;
160 }
161 }
162
163 return 0;
164 err:
165 return ret;
166}
167
168/**
169 * s3c2412_iotiming_set - set the timing information
170 * @cfg: The current frequency configuration.
171 * @iot: The bank timing information.
172 *
173 * Set the IO bank information from the details calculated earlier from
174 * calling s3c2412_iotiming_calc().
175 */
176void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
177 struct s3c_iotimings *iot)
178{
179 struct s3c2412_iobank_timing *bt;
180 void __iomem *regs;
181 int bank;
182
183 /* set the io timings from the specifier */
184
185 for (bank = 0; bank < MAX_BANKS; bank++) {
186 bt = iot->bank[bank].io_2412;
187 if (!bt)
188 continue;
189
190 regs = S3C2412_SSMC_BANK(bank);
191
192 __raw_writel(bt->smbidcyr, regs + SMBIDCYR);
193 __raw_writel(bt->smbwstrd, regs + SMBWSTRDR);
194 __raw_writel(bt->smbwstwr, regs + SMBWSTWRR);
195 __raw_writel(bt->smbwstoen, regs + SMBWSTOENR);
196 __raw_writel(bt->smbwstwen, regs + SMBWSTWENR);
197 __raw_writel(bt->smbwstbrd, regs + SMBWSTBRDR);
198 }
199}
200
201static inline unsigned int s3c2412_decode_timing(unsigned int clock, u32 reg)
202{
203 return (reg & 0xf) * clock;
204}
205
206static void s3c2412_iotiming_getbank(struct s3c_cpufreq_config *cfg,
207 struct s3c2412_iobank_timing *bt,
208 unsigned int bank)
209{
210 unsigned long clk = cfg->freq.hclk_tns; /* ssmc clock??? */
211 void __iomem *regs = S3C2412_SSMC_BANK(bank);
212
213 bt->idcy = s3c2412_decode_timing(clk, __raw_readl(regs + SMBIDCYR));
214 bt->wstrd = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTRDR));
215 bt->wstoen = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTOENR));
216 bt->wstwen = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTWENR));
217 bt->wstbrd = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTBRDR));
218}
219
220/**
221 * bank_is_io - return true if bank is (possibly) IO.
222 * @bank: The bank number.
223 * @bankcfg: The value of S3C2412_EBI_BANKCFG.
224 */
225static inline bool bank_is_io(unsigned int bank, u32 bankcfg)
226{
227 if (bank < 2)
228 return true;
229
230 return !(bankcfg & (1 << bank));
231}
232
233int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
234 struct s3c_iotimings *timings)
235{
236 struct s3c2412_iobank_timing *bt;
237 u32 bankcfg = __raw_readl(S3C2412_EBI_BANKCFG);
238 unsigned int bank;
239
240 /* look through all banks to see what is currently set. */
241
242 for (bank = 0; bank < MAX_BANKS; bank++) {
243 if (!bank_is_io(bank, bankcfg))
244 continue;
245
246 bt = kzalloc(sizeof(struct s3c2412_iobank_timing), GFP_KERNEL);
247 if (!bt) {
248 printk(KERN_ERR "%s: no memory for bank\n", __func__);
249 return -ENOMEM;
250 }
251
252 timings->bank[bank].io_2412 = bt;
253 s3c2412_iotiming_getbank(cfg, bt, bank);
254 }
255
256 s3c2412_print_timing("get", timings);
257 return 0;
258}
259
260/* this is in here as it is so small, it doesn't currently warrant a file
261 * to itself. We expect that any s3c24xx needing this is going to also
262 * need the iotiming support.
263 */
264void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
265{
266 struct s3c_cpufreq_board *board = cfg->board;
267 u32 refresh;
268
269 WARN_ON(board == NULL);
270
271 /* Reduce both the refresh time (in ns) and the frequency (in MHz)
272 * down to ensure that we do not overflow 32 bit numbers.
273 *
274 * This should work for HCLK up to 133MHz and refresh period up
275 * to 30usec.
276 */
277
278 refresh = (cfg->freq.hclk / 100) * (board->refresh / 10);
279 refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); /* apply scale */
280 refresh &= ((1 << 16) - 1);
281
282 s3c_freq_dbg("%s: refresh value %u\n", __func__, (unsigned int)refresh);
283
284 __raw_writel(refresh, S3C2412_REFRESH);
285}
diff --git a/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c b/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c
new file mode 100644
index 000000000000..ae2e6c604f27
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c
@@ -0,0 +1,311 @@
1/* linux/arch/arm/plat-s3c24xx/s3c2440-cpufreq.c
2 *
3 * Copyright (c) 2006,2008,2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 * Vincent Sanders <vince@simtec.co.uk>
7 *
8 * S3C2440/S3C2442 CPU Frequency scaling
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/cpufreq.h>
20#include <linux/sysdev.h>
21#include <linux/delay.h>
22#include <linux/clk.h>
23#include <linux/err.h>
24#include <linux/io.h>
25
26#include <mach/hardware.h>
27
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30
31#include <mach/regs-clock.h>
32
33#include <plat/cpu.h>
34#include <plat/cpu-freq-core.h>
35#include <plat/clock.h>
36
37static struct clk *xtal;
38static struct clk *fclk;
39static struct clk *hclk;
40static struct clk *armclk;
41
42/* HDIV: 1, 2, 3, 4, 6, 8 */
43
44static inline int within_khz(unsigned long a, unsigned long b)
45{
46 long diff = a - b;
47
48 return (diff >= -1000 && diff <= 1000);
49}
50
51/**
52 * s3c2440_cpufreq_calcdivs - calculate divider settings
53 * @cfg: The cpu frequency settings.
54 *
55 * Calcualte the divider values for the given frequency settings
56 * specified in @cfg. The values are stored in @cfg for later use
57 * by the relevant set routine if the request settings can be reached.
58 */
59int s3c2440_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
60{
61 unsigned int hdiv, pdiv;
62 unsigned long hclk, fclk, armclk;
63 unsigned long hclk_max;
64
65 fclk = cfg->freq.fclk;
66 armclk = cfg->freq.armclk;
67 hclk_max = cfg->max.hclk;
68
69 s3c_freq_dbg("%s: fclk is %lu, armclk %lu, max hclk %lu\n",
70 __func__, fclk, armclk, hclk_max);
71
72 if (armclk > fclk) {
73 printk(KERN_WARNING "%s: armclk > fclk\n", __func__);
74 armclk = fclk;
75 }
76
77 /* if we are in DVS, we need HCLK to be <= ARMCLK */
78 if (armclk < fclk && armclk < hclk_max)
79 hclk_max = armclk;
80
81 for (hdiv = 1; hdiv < 9; hdiv++) {
82 if (hdiv == 5 || hdiv == 7)
83 hdiv++;
84
85 hclk = (fclk / hdiv);
86 if (hclk <= hclk_max || within_khz(hclk, hclk_max))
87 break;
88 }
89
90 s3c_freq_dbg("%s: hclk %lu, div %d\n", __func__, hclk, hdiv);
91
92 if (hdiv > 8)
93 goto invalid;
94
95 pdiv = (hclk > cfg->max.pclk) ? 2 : 1;
96
97 if ((hclk / pdiv) > cfg->max.pclk)
98 pdiv++;
99
100 s3c_freq_dbg("%s: pdiv %d\n", __func__, pdiv);
101
102 if (pdiv > 2)
103 goto invalid;
104
105 pdiv *= hdiv;
106
107 /* calculate a valid armclk */
108
109 if (armclk < hclk)
110 armclk = hclk;
111
112 /* if we're running armclk lower than fclk, this really means
113 * that the system should go into dvs mode, which means that
114 * armclk is connected to hclk. */
115 if (armclk < fclk) {
116 cfg->divs.dvs = 1;
117 armclk = hclk;
118 } else
119 cfg->divs.dvs = 0;
120
121 cfg->freq.armclk = armclk;
122
123 /* store the result, and then return */
124
125 cfg->divs.h_divisor = hdiv;
126 cfg->divs.p_divisor = pdiv;
127
128 return 0;
129
130 invalid:
131 return -EINVAL;
132}
133
134#define CAMDIVN_HCLK_HALF (S3C2440_CAMDIVN_HCLK3_HALF | \
135 S3C2440_CAMDIVN_HCLK4_HALF)
136
137/**
138 * s3c2440_cpufreq_setdivs - set the cpu frequency divider settings
139 * @cfg: The cpu frequency settings.
140 *
141 * Set the divisors from the settings in @cfg, which where generated
142 * during the calculation phase by s3c2440_cpufreq_calcdivs().
143 */
144static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
145{
146 unsigned long clkdiv, camdiv;
147
148 s3c_freq_dbg("%s: divsiors: h=%d, p=%d\n", __func__,
149 cfg->divs.h_divisor, cfg->divs.p_divisor);
150
151 clkdiv = __raw_readl(S3C2410_CLKDIVN);
152 camdiv = __raw_readl(S3C2440_CAMDIVN);
153
154 clkdiv &= ~(S3C2440_CLKDIVN_HDIVN_MASK | S3C2440_CLKDIVN_PDIVN);
155 camdiv &= ~CAMDIVN_HCLK_HALF;
156
157 switch (cfg->divs.h_divisor) {
158 case 1:
159 clkdiv |= S3C2440_CLKDIVN_HDIVN_1;
160 break;
161
162 case 2:
163 clkdiv |= S3C2440_CLKDIVN_HDIVN_2;
164 break;
165
166 case 6:
167 camdiv |= S3C2440_CAMDIVN_HCLK3_HALF;
168 case 3:
169 clkdiv |= S3C2440_CLKDIVN_HDIVN_3_6;
170 break;
171
172 case 8:
173 camdiv |= S3C2440_CAMDIVN_HCLK4_HALF;
174 case 4:
175 clkdiv |= S3C2440_CLKDIVN_HDIVN_4_8;
176 break;
177
178 default:
179 BUG(); /* we don't expect to get here. */
180 }
181
182 if (cfg->divs.p_divisor != cfg->divs.h_divisor)
183 clkdiv |= S3C2440_CLKDIVN_PDIVN;
184
185 /* todo - set pclk. */
186
187 /* Write the divisors first with hclk intentionally halved so that
188 * when we write clkdiv we will under-frequency instead of over. We
189 * then make a short delay and remove the hclk halving if necessary.
190 */
191
192 __raw_writel(camdiv | CAMDIVN_HCLK_HALF, S3C2440_CAMDIVN);
193 __raw_writel(clkdiv, S3C2410_CLKDIVN);
194
195 ndelay(20);
196 __raw_writel(camdiv, S3C2440_CAMDIVN);
197
198 clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
199}
200
201static int run_freq_for(unsigned long max_hclk, unsigned long fclk,
202 int *divs,
203 struct cpufreq_frequency_table *table,
204 size_t table_size)
205{
206 unsigned long freq;
207 int index = 0;
208 int div;
209
210 for (div = *divs; div > 0; div = *divs++) {
211 freq = fclk / div;
212
213 if (freq > max_hclk && div != 1)
214 continue;
215
216 freq /= 1000; /* table is in kHz */
217 index = s3c_cpufreq_addfreq(table, index, table_size, freq);
218 if (index < 0)
219 break;
220 }
221
222 return index;
223}
224
225static int hclk_divs[] = { 1, 2, 3, 4, 6, 8, -1 };
226
227static int s3c2440_cpufreq_calctable(struct s3c_cpufreq_config *cfg,
228 struct cpufreq_frequency_table *table,
229 size_t table_size)
230{
231 int ret;
232
233 WARN_ON(cfg->info == NULL);
234 WARN_ON(cfg->board == NULL);
235
236 ret = run_freq_for(cfg->info->max.hclk,
237 cfg->info->max.fclk,
238 hclk_divs,
239 table, table_size);
240
241 s3c_freq_dbg("%s: returning %d\n", __func__, ret);
242
243 return ret;
244}
245
246struct s3c_cpufreq_info s3c2440_cpufreq_info = {
247 .max = {
248 .fclk = 400000000,
249 .hclk = 133333333,
250 .pclk = 66666666,
251 },
252
253 .locktime_m = 300,
254 .locktime_u = 300,
255 .locktime_bits = 16,
256
257 .name = "s3c244x",
258 .calc_iotiming = s3c2410_iotiming_calc,
259 .set_iotiming = s3c2410_iotiming_set,
260 .get_iotiming = s3c2410_iotiming_get,
261 .set_fvco = s3c2410_set_fvco,
262
263 .set_refresh = s3c2410_cpufreq_setrefresh,
264 .set_divs = s3c2440_cpufreq_setdivs,
265 .calc_divs = s3c2440_cpufreq_calcdivs,
266 .calc_freqtable = s3c2440_cpufreq_calctable,
267
268 .resume_clocks = s3c244x_setup_clocks,
269
270 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs),
271};
272
273static int s3c2440_cpufreq_add(struct sys_device *sysdev)
274{
275 xtal = s3c_cpufreq_clk_get(NULL, "xtal");
276 hclk = s3c_cpufreq_clk_get(NULL, "hclk");
277 fclk = s3c_cpufreq_clk_get(NULL, "fclk");
278 armclk = s3c_cpufreq_clk_get(NULL, "armclk");
279
280 if (IS_ERR(xtal) || IS_ERR(hclk) || IS_ERR(fclk) || IS_ERR(armclk)) {
281 printk(KERN_ERR "%s: failed to get clocks\n", __func__);
282 return -ENOENT;
283 }
284
285 return s3c_cpufreq_register(&s3c2440_cpufreq_info);
286}
287
288static struct sysdev_driver s3c2440_cpufreq_driver = {
289 .add = s3c2440_cpufreq_add,
290};
291
292static int s3c2440_cpufreq_init(void)
293{
294 return sysdev_driver_register(&s3c2440_sysclass,
295 &s3c2440_cpufreq_driver);
296}
297
298/* arch_initcall adds the clocks we need, so use subsys_initcall. */
299subsys_initcall(s3c2440_cpufreq_init);
300
301static struct sysdev_driver s3c2442_cpufreq_driver = {
302 .add = s3c2440_cpufreq_add,
303};
304
305static int s3c2442_cpufreq_init(void)
306{
307 return sysdev_driver_register(&s3c2442_sysclass,
308 &s3c2442_cpufreq_driver);
309}
310
311subsys_initcall(s3c2442_cpufreq_init);
diff --git a/arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c b/arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c
new file mode 100644
index 000000000000..ff9443b233aa
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c
@@ -0,0 +1,97 @@
1/* arch/arm/plat-s3c24xx/s3c2440-pll-12000000.c
2 *
3 * Copyright (c) 2006,2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 * Vincent Sanders <vince@arm.linux.org.uk>
7 *
8 * S3C2440/S3C2442 CPU PLL tables (12MHz Crystal)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/types.h>
16#include <linux/kernel.h>
17#include <linux/sysdev.h>
18#include <linux/clk.h>
19#include <linux/err.h>
20
21#include <plat/cpu.h>
22#include <plat/cpu-freq-core.h>
23
24static struct cpufreq_frequency_table s3c2440_plls_12[] __initdata = {
25 { .frequency = 75000000, .index = PLLVAL(0x75, 3, 3), }, /* FVco 600.000000 */
26 { .frequency = 80000000, .index = PLLVAL(0x98, 4, 3), }, /* FVco 640.000000 */
27 { .frequency = 90000000, .index = PLLVAL(0x70, 2, 3), }, /* FVco 720.000000 */
28 { .frequency = 100000000, .index = PLLVAL(0x5c, 1, 3), }, /* FVco 800.000000 */
29 { .frequency = 110000000, .index = PLLVAL(0x66, 1, 3), }, /* FVco 880.000000 */
30 { .frequency = 120000000, .index = PLLVAL(0x70, 1, 3), }, /* FVco 960.000000 */
31 { .frequency = 150000000, .index = PLLVAL(0x75, 3, 2), }, /* FVco 600.000000 */
32 { .frequency = 160000000, .index = PLLVAL(0x98, 4, 2), }, /* FVco 640.000000 */
33 { .frequency = 170000000, .index = PLLVAL(0x4d, 1, 2), }, /* FVco 680.000000 */
34 { .frequency = 180000000, .index = PLLVAL(0x70, 2, 2), }, /* FVco 720.000000 */
35 { .frequency = 190000000, .index = PLLVAL(0x57, 1, 2), }, /* FVco 760.000000 */
36 { .frequency = 200000000, .index = PLLVAL(0x5c, 1, 2), }, /* FVco 800.000000 */
37 { .frequency = 210000000, .index = PLLVAL(0x84, 2, 2), }, /* FVco 840.000000 */
38 { .frequency = 220000000, .index = PLLVAL(0x66, 1, 2), }, /* FVco 880.000000 */
39 { .frequency = 230000000, .index = PLLVAL(0x6b, 1, 2), }, /* FVco 920.000000 */
40 { .frequency = 240000000, .index = PLLVAL(0x70, 1, 2), }, /* FVco 960.000000 */
41 { .frequency = 300000000, .index = PLLVAL(0x75, 3, 1), }, /* FVco 600.000000 */
42 { .frequency = 310000000, .index = PLLVAL(0x93, 4, 1), }, /* FVco 620.000000 */
43 { .frequency = 320000000, .index = PLLVAL(0x98, 4, 1), }, /* FVco 640.000000 */
44 { .frequency = 330000000, .index = PLLVAL(0x66, 2, 1), }, /* FVco 660.000000 */
45 { .frequency = 340000000, .index = PLLVAL(0x4d, 1, 1), }, /* FVco 680.000000 */
46 { .frequency = 350000000, .index = PLLVAL(0xa7, 4, 1), }, /* FVco 700.000000 */
47 { .frequency = 360000000, .index = PLLVAL(0x70, 2, 1), }, /* FVco 720.000000 */
48 { .frequency = 370000000, .index = PLLVAL(0xb1, 4, 1), }, /* FVco 740.000000 */
49 { .frequency = 380000000, .index = PLLVAL(0x57, 1, 1), }, /* FVco 760.000000 */
50 { .frequency = 390000000, .index = PLLVAL(0x7a, 2, 1), }, /* FVco 780.000000 */
51 { .frequency = 400000000, .index = PLLVAL(0x5c, 1, 1), }, /* FVco 800.000000 */
52};
53
54static int s3c2440_plls12_add(struct sys_device *dev)
55{
56 struct clk *xtal_clk;
57 unsigned long xtal;
58
59 xtal_clk = clk_get(NULL, "xtal");
60 if (IS_ERR(xtal_clk))
61 return PTR_ERR(xtal_clk);
62
63 xtal = clk_get_rate(xtal_clk);
64 clk_put(xtal_clk);
65
66 if (xtal == 12000000) {
67 printk(KERN_INFO "Using PLL table for 12MHz crystal\n");
68 return s3c_plltab_register(s3c2440_plls_12,
69 ARRAY_SIZE(s3c2440_plls_12));
70 }
71
72 return 0;
73}
74
75static struct sysdev_driver s3c2440_plls12_drv = {
76 .add = s3c2440_plls12_add,
77};
78
79static int __init s3c2440_pll_12mhz(void)
80{
81 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_plls12_drv);
82
83}
84
85arch_initcall(s3c2440_pll_12mhz);
86
87static struct sysdev_driver s3c2442_plls12_drv = {
88 .add = s3c2440_plls12_add,
89};
90
91static int __init s3c2442_pll_12mhz(void)
92{
93 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_plls12_drv);
94
95}
96
97arch_initcall(s3c2442_pll_12mhz);
diff --git a/arch/arm/plat-s3c24xx/s3c2440-pll-16934400.c b/arch/arm/plat-s3c24xx/s3c2440-pll-16934400.c
new file mode 100644
index 000000000000..7679af13a94d
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/s3c2440-pll-16934400.c
@@ -0,0 +1,127 @@
1/* arch/arm/plat-s3c24xx/s3c2440-pll-16934400.c
2 *
3 * Copyright (c) 2006-2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 * Vincent Sanders <vince@arm.linux.org.uk>
7 *
8 * S3C2440/S3C2442 CPU PLL tables (16.93444MHz Crystal)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/types.h>
16#include <linux/kernel.h>
17#include <linux/sysdev.h>
18#include <linux/clk.h>
19#include <linux/err.h>
20
21#include <plat/cpu.h>
22#include <plat/cpu-freq-core.h>
23
24static struct cpufreq_frequency_table s3c2440_plls_169344[] __initdata = {
25 { .frequency = 78019200, .index = PLLVAL(121, 5, 3), }, /* FVco 624.153600 */
26 { .frequency = 84067200, .index = PLLVAL(131, 5, 3), }, /* FVco 672.537600 */
27 { .frequency = 90115200, .index = PLLVAL(141, 5, 3), }, /* FVco 720.921600 */
28 { .frequency = 96163200, .index = PLLVAL(151, 5, 3), }, /* FVco 769.305600 */
29 { .frequency = 102135600, .index = PLLVAL(185, 6, 3), }, /* FVco 817.084800 */
30 { .frequency = 108259200, .index = PLLVAL(171, 5, 3), }, /* FVco 866.073600 */
31 { .frequency = 114307200, .index = PLLVAL(127, 3, 3), }, /* FVco 914.457600 */
32 { .frequency = 120234240, .index = PLLVAL(134, 3, 3), }, /* FVco 961.873920 */
33 { .frequency = 126161280, .index = PLLVAL(141, 3, 3), }, /* FVco 1009.290240 */
34 { .frequency = 132088320, .index = PLLVAL(148, 3, 3), }, /* FVco 1056.706560 */
35 { .frequency = 138015360, .index = PLLVAL(155, 3, 3), }, /* FVco 1104.122880 */
36 { .frequency = 144789120, .index = PLLVAL(163, 3, 3), }, /* FVco 1158.312960 */
37 { .frequency = 150100363, .index = PLLVAL(187, 9, 2), }, /* FVco 600.401454 */
38 { .frequency = 156038400, .index = PLLVAL(121, 5, 2), }, /* FVco 624.153600 */
39 { .frequency = 162086400, .index = PLLVAL(126, 5, 2), }, /* FVco 648.345600 */
40 { .frequency = 168134400, .index = PLLVAL(131, 5, 2), }, /* FVco 672.537600 */
41 { .frequency = 174048000, .index = PLLVAL(177, 7, 2), }, /* FVco 696.192000 */
42 { .frequency = 180230400, .index = PLLVAL(141, 5, 2), }, /* FVco 720.921600 */
43 { .frequency = 186278400, .index = PLLVAL(124, 4, 2), }, /* FVco 745.113600 */
44 { .frequency = 192326400, .index = PLLVAL(151, 5, 2), }, /* FVco 769.305600 */
45 { .frequency = 198132480, .index = PLLVAL(109, 3, 2), }, /* FVco 792.529920 */
46 { .frequency = 204271200, .index = PLLVAL(185, 6, 2), }, /* FVco 817.084800 */
47 { .frequency = 210268800, .index = PLLVAL(141, 4, 2), }, /* FVco 841.075200 */
48 { .frequency = 216518400, .index = PLLVAL(171, 5, 2), }, /* FVco 866.073600 */
49 { .frequency = 222264000, .index = PLLVAL(97, 2, 2), }, /* FVco 889.056000 */
50 { .frequency = 228614400, .index = PLLVAL(127, 3, 2), }, /* FVco 914.457600 */
51 { .frequency = 234259200, .index = PLLVAL(158, 4, 2), }, /* FVco 937.036800 */
52 { .frequency = 240468480, .index = PLLVAL(134, 3, 2), }, /* FVco 961.873920 */
53 { .frequency = 246960000, .index = PLLVAL(167, 4, 2), }, /* FVco 987.840000 */
54 { .frequency = 252322560, .index = PLLVAL(141, 3, 2), }, /* FVco 1009.290240 */
55 { .frequency = 258249600, .index = PLLVAL(114, 2, 2), }, /* FVco 1032.998400 */
56 { .frequency = 264176640, .index = PLLVAL(148, 3, 2), }, /* FVco 1056.706560 */
57 { .frequency = 270950400, .index = PLLVAL(120, 2, 2), }, /* FVco 1083.801600 */
58 { .frequency = 276030720, .index = PLLVAL(155, 3, 2), }, /* FVco 1104.122880 */
59 { .frequency = 282240000, .index = PLLVAL(92, 1, 2), }, /* FVco 1128.960000 */
60 { .frequency = 289578240, .index = PLLVAL(163, 3, 2), }, /* FVco 1158.312960 */
61 { .frequency = 294235200, .index = PLLVAL(131, 2, 2), }, /* FVco 1176.940800 */
62 { .frequency = 300200727, .index = PLLVAL(187, 9, 1), }, /* FVco 600.401454 */
63 { .frequency = 306358690, .index = PLLVAL(191, 9, 1), }, /* FVco 612.717380 */
64 { .frequency = 312076800, .index = PLLVAL(121, 5, 1), }, /* FVco 624.153600 */
65 { .frequency = 318366720, .index = PLLVAL(86, 3, 1), }, /* FVco 636.733440 */
66 { .frequency = 324172800, .index = PLLVAL(126, 5, 1), }, /* FVco 648.345600 */
67 { .frequency = 330220800, .index = PLLVAL(109, 4, 1), }, /* FVco 660.441600 */
68 { .frequency = 336268800, .index = PLLVAL(131, 5, 1), }, /* FVco 672.537600 */
69 { .frequency = 342074880, .index = PLLVAL(93, 3, 1), }, /* FVco 684.149760 */
70 { .frequency = 348096000, .index = PLLVAL(177, 7, 1), }, /* FVco 696.192000 */
71 { .frequency = 355622400, .index = PLLVAL(118, 4, 1), }, /* FVco 711.244800 */
72 { .frequency = 360460800, .index = PLLVAL(141, 5, 1), }, /* FVco 720.921600 */
73 { .frequency = 366206400, .index = PLLVAL(165, 6, 1), }, /* FVco 732.412800 */
74 { .frequency = 372556800, .index = PLLVAL(124, 4, 1), }, /* FVco 745.113600 */
75 { .frequency = 378201600, .index = PLLVAL(126, 4, 1), }, /* FVco 756.403200 */
76 { .frequency = 384652800, .index = PLLVAL(151, 5, 1), }, /* FVco 769.305600 */
77 { .frequency = 391608000, .index = PLLVAL(177, 6, 1), }, /* FVco 783.216000 */
78 { .frequency = 396264960, .index = PLLVAL(109, 3, 1), }, /* FVco 792.529920 */
79 { .frequency = 402192000, .index = PLLVAL(87, 2, 1), }, /* FVco 804.384000 */
80};
81
82static int s3c2440_plls169344_add(struct sys_device *dev)
83{
84 struct clk *xtal_clk;
85 unsigned long xtal;
86
87 xtal_clk = clk_get(NULL, "xtal");
88 if (IS_ERR(xtal_clk))
89 return PTR_ERR(xtal_clk);
90
91 xtal = clk_get_rate(xtal_clk);
92 clk_put(xtal_clk);
93
94 if (xtal == 169344000) {
95 printk(KERN_INFO "Using PLL table for 16.9344MHz crystal\n");
96 return s3c_plltab_register(s3c2440_plls_169344,
97 ARRAY_SIZE(s3c2440_plls_169344));
98 }
99
100 return 0;
101}
102
103static struct sysdev_driver s3c2440_plls169344_drv = {
104 .add = s3c2440_plls169344_add,
105};
106
107static int __init s3c2440_pll_16934400(void)
108{
109 return sysdev_driver_register(&s3c2440_sysclass,
110 &s3c2440_plls169344_drv);
111
112}
113
114arch_initcall(s3c2440_pll_16934400);
115
116static struct sysdev_driver s3c2442_plls169344_drv = {
117 .add = s3c2440_plls169344_add,
118};
119
120static int __init s3c2442_pll_16934400(void)
121{
122 return sysdev_driver_register(&s3c2442_sysclass,
123 &s3c2442_plls169344_drv);
124
125}
126
127arch_initcall(s3c2442_pll_16934400);
diff --git a/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c b/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c
new file mode 100644
index 000000000000..89fcf5308cf6
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c
@@ -0,0 +1,38 @@
1/* linux/arch/arm/plat-s3c24xx/spi-bus0-gpd8_9_10.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX SPI - gpio configuration for bus 1 on gpd8,9,10
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License.
12*/
13
14#include <linux/kernel.h>
15#include <linux/gpio.h>
16
17#include <mach/spi.h>
18#include <mach/regs-gpio.h>
19
20void s3c24xx_spi_gpiocfg_bus1_gpd8_9_10(struct s3c2410_spi_info *spi,
21 int enable)
22{
23
24 printk(KERN_INFO "%s(%d)\n", __func__, enable);
25 if (enable) {
26 s3c2410_gpio_cfgpin(S3C2410_GPD(10), S3C2440_GPD10_SPICLK1);
27 s3c2410_gpio_cfgpin(S3C2410_GPD(9), S3C2440_GPD9_SPIMOSI1);
28 s3c2410_gpio_cfgpin(S3C2410_GPD(8), S3C2440_GPD8_SPIMISO1);
29 s3c2410_gpio_pullup(S3C2410_GPD(10), 0);
30 s3c2410_gpio_pullup(S3C2410_GPD(9), 0);
31 } else {
32 s3c2410_gpio_cfgpin(S3C2410_GPD(8), S3C2410_GPIO_INPUT);
33 s3c2410_gpio_cfgpin(S3C2410_GPD(9), S3C2410_GPIO_INPUT);
34 s3c2410_gpio_pullup(S3C2410_GPD(10), 1);
35 s3c2410_gpio_pullup(S3C2410_GPD(9), 1);
36 s3c2410_gpio_pullup(S3C2410_GPD(8), 1);
37 }
38}
diff --git a/arch/arm/plat-s3c64xx/Kconfig b/arch/arm/plat-s3c64xx/Kconfig
index 5ebd8b425a54..bcfa778614d8 100644
--- a/arch/arm/plat-s3c64xx/Kconfig
+++ b/arch/arm/plat-s3c64xx/Kconfig
@@ -19,6 +19,7 @@ config PLAT_S3C64XX
19 select S3C_GPIO_PULL_UPDOWN 19 select S3C_GPIO_PULL_UPDOWN
20 select S3C_GPIO_CFG_S3C24XX 20 select S3C_GPIO_CFG_S3C24XX
21 select S3C_GPIO_CFG_S3C64XX 21 select S3C_GPIO_CFG_S3C64XX
22 select S3C_DEV_NAND
22 select USB_ARCH_HAS_OHCI 23 select USB_ARCH_HAS_OHCI
23 help 24 help
24 Base platform code for any Samsung S3C64XX device 25 Base platform code for any Samsung S3C64XX device
diff --git a/arch/arm/plat-s3c64xx/Makefile b/arch/arm/plat-s3c64xx/Makefile
index 3c8882cd6268..b85b4359e935 100644
--- a/arch/arm/plat-s3c64xx/Makefile
+++ b/arch/arm/plat-s3c64xx/Makefile
@@ -40,4 +40,5 @@ obj-$(CONFIG_S3C64XX_DMA) += dma.o
40obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o 40obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o
41obj-$(CONFIG_S3C64XX_SETUP_I2C1) += setup-i2c1.o 41obj-$(CONFIG_S3C64XX_SETUP_I2C1) += setup-i2c1.o
42obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP) += setup-fb-24bpp.o 42obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP) += setup-fb-24bpp.o
43obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o \ No newline at end of file 43obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
44obj-$(CONFIG_SND_S3C24XX_SOC) += dev-audio.o
diff --git a/arch/arm/plat-s3c/dev-audio.c b/arch/arm/plat-s3c64xx/dev-audio.c
index 1322beb40dd7..1322beb40dd7 100644
--- a/arch/arm/plat-s3c/dev-audio.c
+++ b/arch/arm/plat-s3c64xx/dev-audio.c
diff --git a/arch/arm/plat-s3c64xx/s3c6400-clock.c b/arch/arm/plat-s3c64xx/s3c6400-clock.c
index 1debc1f9f987..febac1950d8e 100644
--- a/arch/arm/plat-s3c64xx/s3c6400-clock.c
+++ b/arch/arm/plat-s3c64xx/s3c6400-clock.c
@@ -153,7 +153,7 @@ static unsigned long s3c64xx_clk_arm_round_rate(struct clk *clk,
153 u32 div; 153 u32 div;
154 154
155 if (parent < rate) 155 if (parent < rate)
156 return rate; 156 return parent;
157 157
158 div = (parent / rate) - 1; 158 div = (parent / rate) - 1;
159 if (div > armclk_mask) 159 if (div > armclk_mask)
@@ -175,7 +175,7 @@ static int s3c64xx_clk_arm_set_rate(struct clk *clk, unsigned long rate)
175 div = clk_get_rate(clk->parent) / rate; 175 div = clk_get_rate(clk->parent) / rate;
176 176
177 val = __raw_readl(S3C_CLK_DIV0); 177 val = __raw_readl(S3C_CLK_DIV0);
178 val &= armclk_mask; 178 val &= ~armclk_mask;
179 val |= (div - 1); 179 val |= (div - 1);
180 __raw_writel(val, S3C_CLK_DIV0); 180 __raw_writel(val, S3C_CLK_DIV0);
181 181
diff --git a/arch/arm/plat-s5pc1xx/Kconfig b/arch/arm/plat-s5pc1xx/Kconfig
new file mode 100644
index 000000000000..a8a711c3c064
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/Kconfig
@@ -0,0 +1,50 @@
1# arch/arm/plat-s5pc1xx/Kconfig
2#
3# Copyright 2009 Samsung Electronics Co.
4# Byungho Min <bhmin@samsung.com>
5#
6# Licensed under GPLv2
7
8config PLAT_S5PC1XX
9 bool
10 depends on ARCH_S5PC1XX
11 default y
12 select PLAT_S3C
13 select ARM_VIC
14 select NO_IOPORT
15 select ARCH_REQUIRE_GPIOLIB
16 select S3C_GPIO_TRACK
17 select S3C_GPIO_PULL_UPDOWN
18 help
19 Base platform code for any Samsung S5PC1XX device
20
21if PLAT_S5PC1XX
22
23# Configuration options shared by all S3C64XX implementations
24
25config CPU_S5PC100_INIT
26 bool
27 help
28 Common initialisation code for the S5PC1XX
29
30config CPU_S5PC100_CLOCK
31 bool
32 help
33 Common clock support code for the S5PC1XX
34
35# platform specific device setup
36
37config S5PC100_SETUP_I2C0
38 bool
39 default y
40 help
41 Common setup code for i2c bus 0.
42
43 Note, currently since i2c0 is always compiled, this setup helper
44 is always compiled with it.
45
46config S5PC100_SETUP_I2C1
47 bool
48 help
49 Common setup code for i2c bus 1.
50endif
diff --git a/arch/arm/plat-s5pc1xx/Makefile b/arch/arm/plat-s5pc1xx/Makefile
new file mode 100644
index 000000000000..f1ecb2c37ee2
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/Makefile
@@ -0,0 +1,26 @@
1# arch/arm/plat-s5pc1xx/Makefile
2#
3# Copyright 2009 Samsung Electronics Co.
4#
5# Licensed under GPLv2
6
7obj-y :=
8obj-m :=
9obj-n := dummy.o
10obj- :=
11
12# Core files
13
14obj-y += dev-uart.o
15obj-y += cpu.o
16obj-y += irq.o
17
18# CPU support
19
20obj-$(CONFIG_CPU_S5PC100_INIT) += s5pc100-init.o
21obj-$(CONFIG_CPU_S5PC100_CLOCK) += s5pc100-clock.o
22
23# Device setup
24
25obj-$(CONFIG_S5PC100_SETUP_I2C0) += setup-i2c0.o
26obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o
diff --git a/arch/arm/plat-s5pc1xx/cpu.c b/arch/arm/plat-s5pc1xx/cpu.c
new file mode 100644
index 000000000000..715a7330794d
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/cpu.c
@@ -0,0 +1,112 @@
1/* linux/arch/arm/plat-s5pc1xx/cpu.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC1XX CPU Support
7 *
8 * Based on plat-s3c64xx/cpu.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/serial_core.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25
26#include <asm/mach/map.h>
27
28#include <plat/regs-serial.h>
29
30#include <plat/cpu.h>
31#include <plat/devs.h>
32#include <plat/clock.h>
33
34#include <plat/s5pc100.h>
35
36/* table of supported CPUs */
37
38static const char name_s5pc100[] = "S5PC100";
39
40static struct cpu_table cpu_ids[] __initdata = {
41 {
42 .idcode = 0x43100000,
43 .idmask = 0xfffff000,
44 .map_io = s5pc100_map_io,
45 .init_clocks = s5pc100_init_clocks,
46 .init_uarts = s5pc100_init_uarts,
47 .init = s5pc100_init,
48 .name = name_s5pc100,
49 },
50};
51/* minimal IO mapping */
52
53/* see notes on uart map in arch/arm/mach-s5pc100/include/mach/debug-macro.S */
54#define UART_OFFS (S3C_PA_UART & 0xffff)
55
56static struct map_desc s5pc1xx_iodesc[] __initdata = {
57 {
58 .virtual = (unsigned long)S5PC1XX_VA_CHIPID,
59 .pfn = __phys_to_pfn(S5PC1XX_PA_CHIPID),
60 .length = SZ_16,
61 .type = MT_DEVICE,
62 }, {
63 .virtual = (unsigned long)S5PC1XX_VA_CLK,
64 .pfn = __phys_to_pfn(S5PC1XX_PA_CLK),
65 .length = SZ_4K,
66 .type = MT_DEVICE,
67 }, {
68 .virtual = (unsigned long)S5PC1XX_VA_PWR,
69 .pfn = __phys_to_pfn(S5PC1XX_PA_PWR),
70 .length = SZ_4K,
71 .type = MT_DEVICE,
72 }, {
73 .virtual = (unsigned long)(S5PC1XX_VA_UART),
74 .pfn = __phys_to_pfn(S5PC1XX_PA_UART),
75 .length = SZ_4K,
76 .type = MT_DEVICE,
77 }, {
78 .virtual = (unsigned long)S5PC1XX_VA_VIC(0),
79 .pfn = __phys_to_pfn(S5PC1XX_PA_VIC(0)),
80 .length = SZ_4K,
81 .type = MT_DEVICE,
82 }, {
83 .virtual = (unsigned long)S5PC1XX_VA_VIC(1),
84 .pfn = __phys_to_pfn(S5PC1XX_PA_VIC(1)),
85 .length = SZ_4K,
86 .type = MT_DEVICE,
87 }, {
88 .virtual = (unsigned long)S5PC1XX_VA_VIC(2),
89 .pfn = __phys_to_pfn(S5PC1XX_PA_VIC(2)),
90 .length = SZ_4K,
91 .type = MT_DEVICE,
92 }, {
93 .virtual = (unsigned long)S5PC1XX_VA_TIMER,
94 .pfn = __phys_to_pfn(S5PC1XX_PA_TIMER),
95 .length = SZ_256,
96 .type = MT_DEVICE,
97 },
98};
99
100/* read cpu identification code */
101
102void __init s5pc1xx_init_io(struct map_desc *mach_desc, int size)
103{
104 unsigned long idcode;
105
106 /* initialise the io descriptors we need for initialisation */
107 iotable_init(s5pc1xx_iodesc, ARRAY_SIZE(s5pc1xx_iodesc));
108 iotable_init(mach_desc, size);
109
110 idcode = __raw_readl(S5PC1XX_VA_CHIPID);
111 s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
112}
diff --git a/arch/arm/plat-s5pc1xx/dev-uart.c b/arch/arm/plat-s5pc1xx/dev-uart.c
new file mode 100644
index 000000000000..f749bc5407b5
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/dev-uart.c
@@ -0,0 +1,174 @@
1/* linux/arch/arm/plat-s5pc1xx/dev-uart.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Based on plat-s3c64xx/dev-uart.c
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#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/list.h>
18#include <linux/platform_device.h>
19
20#include <asm/mach/arch.h>
21#include <asm/mach/irq.h>
22#include <mach/hardware.h>
23#include <mach/map.h>
24
25#include <plat/devs.h>
26
27/* Serial port registrations */
28
29/* 64xx uarts are closer together */
30
31static struct resource s5pc1xx_uart0_resource[] = {
32 [0] = {
33 .start = S3C_PA_UART0,
34 .end = S3C_PA_UART0 + 0x100,
35 .flags = IORESOURCE_MEM,
36 },
37 [1] = {
38 .start = IRQ_S3CUART_RX0,
39 .end = IRQ_S3CUART_RX0,
40 .flags = IORESOURCE_IRQ,
41 },
42 [2] = {
43 .start = IRQ_S3CUART_TX0,
44 .end = IRQ_S3CUART_TX0,
45 .flags = IORESOURCE_IRQ,
46
47 },
48 [3] = {
49 .start = IRQ_S3CUART_ERR0,
50 .end = IRQ_S3CUART_ERR0,
51 .flags = IORESOURCE_IRQ,
52 }
53};
54
55static struct resource s5pc1xx_uart1_resource[] = {
56 [0] = {
57 .start = S3C_PA_UART1,
58 .end = S3C_PA_UART1 + 0x100,
59 .flags = IORESOURCE_MEM,
60 },
61 [1] = {
62 .start = IRQ_S3CUART_RX1,
63 .end = IRQ_S3CUART_RX1,
64 .flags = IORESOURCE_IRQ,
65 },
66 [2] = {
67 .start = IRQ_S3CUART_TX1,
68 .end = IRQ_S3CUART_TX1,
69 .flags = IORESOURCE_IRQ,
70
71 },
72 [3] = {
73 .start = IRQ_S3CUART_ERR1,
74 .end = IRQ_S3CUART_ERR1,
75 .flags = IORESOURCE_IRQ,
76 },
77};
78
79static struct resource s5pc1xx_uart2_resource[] = {
80 [0] = {
81 .start = S3C_PA_UART2,
82 .end = S3C_PA_UART2 + 0x100,
83 .flags = IORESOURCE_MEM,
84 },
85 [1] = {
86 .start = IRQ_S3CUART_RX2,
87 .end = IRQ_S3CUART_RX2,
88 .flags = IORESOURCE_IRQ,
89 },
90 [2] = {
91 .start = IRQ_S3CUART_TX2,
92 .end = IRQ_S3CUART_TX2,
93 .flags = IORESOURCE_IRQ,
94
95 },
96 [3] = {
97 .start = IRQ_S3CUART_ERR2,
98 .end = IRQ_S3CUART_ERR2,
99 .flags = IORESOURCE_IRQ,
100 },
101};
102
103static struct resource s5pc1xx_uart3_resource[] = {
104 [0] = {
105 .start = S3C_PA_UART3,
106 .end = S3C_PA_UART3 + 0x100,
107 .flags = IORESOURCE_MEM,
108 },
109 [1] = {
110 .start = IRQ_S3CUART_RX3,
111 .end = IRQ_S3CUART_RX3,
112 .flags = IORESOURCE_IRQ,
113 },
114 [2] = {
115 .start = IRQ_S3CUART_TX3,
116 .end = IRQ_S3CUART_TX3,
117 .flags = IORESOURCE_IRQ,
118
119 },
120 [3] = {
121 .start = IRQ_S3CUART_ERR3,
122 .end = IRQ_S3CUART_ERR3,
123 .flags = IORESOURCE_IRQ,
124 },
125};
126
127
128struct s3c24xx_uart_resources s5pc1xx_uart_resources[] __initdata = {
129 [0] = {
130 .resources = s5pc1xx_uart0_resource,
131 .nr_resources = ARRAY_SIZE(s5pc1xx_uart0_resource),
132 },
133 [1] = {
134 .resources = s5pc1xx_uart1_resource,
135 .nr_resources = ARRAY_SIZE(s5pc1xx_uart1_resource),
136 },
137 [2] = {
138 .resources = s5pc1xx_uart2_resource,
139 .nr_resources = ARRAY_SIZE(s5pc1xx_uart2_resource),
140 },
141 [3] = {
142 .resources = s5pc1xx_uart3_resource,
143 .nr_resources = ARRAY_SIZE(s5pc1xx_uart3_resource),
144 },
145};
146
147/* uart devices */
148
149static struct platform_device s3c24xx_uart_device0 = {
150 .id = 0,
151};
152
153static struct platform_device s3c24xx_uart_device1 = {
154 .id = 1,
155};
156
157static struct platform_device s3c24xx_uart_device2 = {
158 .id = 2,
159};
160
161static struct platform_device s3c24xx_uart_device3 = {
162 .id = 3,
163};
164
165struct platform_device *s3c24xx_uart_src[4] = {
166 &s3c24xx_uart_device0,
167 &s3c24xx_uart_device1,
168 &s3c24xx_uart_device2,
169 &s3c24xx_uart_device3,
170};
171
172struct platform_device *s3c24xx_uart_devs[4] = {
173};
174
diff --git a/arch/arm/plat-s5pc1xx/include/plat/irqs.h b/arch/arm/plat-s5pc1xx/include/plat/irqs.h
new file mode 100644
index 000000000000..f07d8c3b25d6
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/include/plat/irqs.h
@@ -0,0 +1,182 @@
1/* linux/arch/arm/plat-s5pc1xx/include/plat/irqs.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC1XX - Common IRQ support
7 *
8 * Based on plat-s3c64xx/include/plat/irqs.h
9 */
10
11#ifndef __ASM_PLAT_S5PC1XX_IRQS_H
12#define __ASM_PLAT_S5PC1XX_IRQS_H __FILE__
13
14/* we keep the first set of CPU IRQs out of the range of
15 * the ISA space, so that the PC104 has them to itself
16 * and we don't end up having to do horrible things to the
17 * standard ISA drivers....
18 *
19 * note, since we're using the VICs, our start must be a
20 * mulitple of 32 to allow the common code to work
21 */
22
23#define S3C_IRQ_OFFSET (32)
24
25#define S3C_IRQ(x) ((x) + S3C_IRQ_OFFSET)
26
27#define S3C_VIC0_BASE S3C_IRQ(0)
28#define S3C_VIC1_BASE S3C_IRQ(32)
29#define S3C_VIC2_BASE S3C_IRQ(64)
30
31/* UART interrupts, each UART has 4 intterupts per channel so
32 * use the space between the ISA and S3C main interrupts. Note, these
33 * are not in the same order as the S3C24XX series! */
34
35#define IRQ_S3CUART_BASE0 (16)
36#define IRQ_S3CUART_BASE1 (20)
37#define IRQ_S3CUART_BASE2 (24)
38#define IRQ_S3CUART_BASE3 (28)
39
40#define UART_IRQ_RXD (0)
41#define UART_IRQ_ERR (1)
42#define UART_IRQ_TXD (2)
43#define UART_IRQ_MODEM (3)
44
45#define IRQ_S3CUART_RX0 (IRQ_S3CUART_BASE0 + UART_IRQ_RXD)
46#define IRQ_S3CUART_TX0 (IRQ_S3CUART_BASE0 + UART_IRQ_TXD)
47#define IRQ_S3CUART_ERR0 (IRQ_S3CUART_BASE0 + UART_IRQ_ERR)
48
49#define IRQ_S3CUART_RX1 (IRQ_S3CUART_BASE1 + UART_IRQ_RXD)
50#define IRQ_S3CUART_TX1 (IRQ_S3CUART_BASE1 + UART_IRQ_TXD)
51#define IRQ_S3CUART_ERR1 (IRQ_S3CUART_BASE1 + UART_IRQ_ERR)
52
53#define IRQ_S3CUART_RX2 (IRQ_S3CUART_BASE2 + UART_IRQ_RXD)
54#define IRQ_S3CUART_TX2 (IRQ_S3CUART_BASE2 + UART_IRQ_TXD)
55#define IRQ_S3CUART_ERR2 (IRQ_S3CUART_BASE2 + UART_IRQ_ERR)
56
57#define IRQ_S3CUART_RX3 (IRQ_S3CUART_BASE3 + UART_IRQ_RXD)
58#define IRQ_S3CUART_TX3 (IRQ_S3CUART_BASE3 + UART_IRQ_TXD)
59#define IRQ_S3CUART_ERR3 (IRQ_S3CUART_BASE3 + UART_IRQ_ERR)
60
61/* VIC based IRQs */
62
63#define S5PC1XX_IRQ_VIC0(x) (S3C_VIC0_BASE + (x))
64#define S5PC1XX_IRQ_VIC1(x) (S3C_VIC1_BASE + (x))
65#define S5PC1XX_IRQ_VIC2(x) (S3C_VIC2_BASE + (x))
66
67/*
68 * VIC0: system, DMA, timer
69 */
70#define IRQ_EINT0 S5PC1XX_IRQ_VIC0(0)
71#define IRQ_EINT1 S5PC1XX_IRQ_VIC0(1)
72#define IRQ_EINT2 S5PC1XX_IRQ_VIC0(2)
73#define IRQ_EINT3 S5PC1XX_IRQ_VIC0(3)
74#define IRQ_EINT4 S5PC1XX_IRQ_VIC0(4)
75#define IRQ_EINT5 S5PC1XX_IRQ_VIC0(5)
76#define IRQ_EINT6 S5PC1XX_IRQ_VIC0(6)
77#define IRQ_EINT7 S5PC1XX_IRQ_VIC0(7)
78#define IRQ_EINT8 S5PC1XX_IRQ_VIC0(8)
79#define IRQ_EINT9 S5PC1XX_IRQ_VIC0(9)
80#define IRQ_EINT10 S5PC1XX_IRQ_VIC0(10)
81#define IRQ_EINT11 S5PC1XX_IRQ_VIC0(11)
82#define IRQ_EINT12 S5PC1XX_IRQ_VIC0(12)
83#define IRQ_EINT13 S5PC1XX_IRQ_VIC0(13)
84#define IRQ_EINT14 S5PC1XX_IRQ_VIC0(14)
85#define IRQ_EINT15 S5PC1XX_IRQ_VIC0(15)
86#define IRQ_EINT16_31 S5PC1XX_IRQ_VIC0(16)
87#define IRQ_BATF S5PC1XX_IRQ_VIC0(17)
88#define IRQ_MDMA S5PC1XX_IRQ_VIC0(18)
89#define IRQ_PDMA0 S5PC1XX_IRQ_VIC0(19)
90#define IRQ_PDMA1 S5PC1XX_IRQ_VIC0(20)
91#define IRQ_TIMER0 S5PC1XX_IRQ_VIC0(21)
92#define IRQ_TIMER1 S5PC1XX_IRQ_VIC0(22)
93#define IRQ_TIMER2 S5PC1XX_IRQ_VIC0(23)
94#define IRQ_TIMER3 S5PC1XX_IRQ_VIC0(24)
95#define IRQ_TIMER4 S5PC1XX_IRQ_VIC0(25)
96#define IRQ_SYSTIMER S5PC1XX_IRQ_VIC0(26)
97#define IRQ_WDT S5PC1XX_IRQ_VIC0(27)
98#define IRQ_RTC_ALARM S5PC1XX_IRQ_VIC0(28)
99#define IRQ_RTC_TIC S5PC1XX_IRQ_VIC0(29)
100#define IRQ_GPIOINT S5PC1XX_IRQ_VIC0(30)
101
102/*
103 * VIC1: ARM, power, memory, connectivity
104 */
105#define IRQ_CORTEX0 S5PC1XX_IRQ_VIC1(0)
106#define IRQ_CORTEX1 S5PC1XX_IRQ_VIC1(1)
107#define IRQ_CORTEX2 S5PC1XX_IRQ_VIC1(2)
108#define IRQ_CORTEX3 S5PC1XX_IRQ_VIC1(3)
109#define IRQ_CORTEX4 S5PC1XX_IRQ_VIC1(4)
110#define IRQ_IEMAPC S5PC1XX_IRQ_VIC1(5)
111#define IRQ_IEMIEC S5PC1XX_IRQ_VIC1(6)
112#define IRQ_ONENAND S5PC1XX_IRQ_VIC1(7)
113#define IRQ_NFC S5PC1XX_IRQ_VIC1(8)
114#define IRQ_CFC S5PC1XX_IRQ_VIC1(9)
115#define IRQ_UART0 S5PC1XX_IRQ_VIC1(10)
116#define IRQ_UART1 S5PC1XX_IRQ_VIC1(11)
117#define IRQ_UART2 S5PC1XX_IRQ_VIC1(12)
118#define IRQ_UART3 S5PC1XX_IRQ_VIC1(13)
119#define IRQ_IIC S5PC1XX_IRQ_VIC1(14)
120#define IRQ_SPI0 S5PC1XX_IRQ_VIC1(15)
121#define IRQ_SPI1 S5PC1XX_IRQ_VIC1(16)
122#define IRQ_SPI2 S5PC1XX_IRQ_VIC1(17)
123#define IRQ_IRDA S5PC1XX_IRQ_VIC1(18)
124#define IRQ_CAN0 S5PC1XX_IRQ_VIC1(19)
125#define IRQ_CAN1 S5PC1XX_IRQ_VIC1(20)
126#define IRQ_HSIRX S5PC1XX_IRQ_VIC1(21)
127#define IRQ_HSITX S5PC1XX_IRQ_VIC1(22)
128#define IRQ_UHOST S5PC1XX_IRQ_VIC1(23)
129#define IRQ_OTG S5PC1XX_IRQ_VIC1(24)
130#define IRQ_MSM S5PC1XX_IRQ_VIC1(25)
131#define IRQ_HSMMC0 S5PC1XX_IRQ_VIC1(26)
132#define IRQ_HSMMC1 S5PC1XX_IRQ_VIC1(27)
133#define IRQ_HSMMC2 S5PC1XX_IRQ_VIC1(28)
134#define IRQ_MIPICSI S5PC1XX_IRQ_VIC1(29)
135#define IRQ_MIPIDSI S5PC1XX_IRQ_VIC1(30)
136
137/*
138 * VIC2: multimedia, audio, security
139 */
140#define IRQ_LCD0 S5PC1XX_IRQ_VIC2(0)
141#define IRQ_LCD1 S5PC1XX_IRQ_VIC2(1)
142#define IRQ_LCD2 S5PC1XX_IRQ_VIC2(2)
143#define IRQ_LCD3 S5PC1XX_IRQ_VIC2(3)
144#define IRQ_ROTATOR S5PC1XX_IRQ_VIC2(4)
145#define IRQ_FIMC0 S5PC1XX_IRQ_VIC2(5)
146#define IRQ_FIMC1 S5PC1XX_IRQ_VIC2(6)
147#define IRQ_FIMC2 S5PC1XX_IRQ_VIC2(7)
148#define IRQ_JPEG S5PC1XX_IRQ_VIC2(8)
149#define IRQ_2D S5PC1XX_IRQ_VIC2(9)
150#define IRQ_3D S5PC1XX_IRQ_VIC2(10)
151#define IRQ_MIXER S5PC1XX_IRQ_VIC2(11)
152#define IRQ_HDMI S5PC1XX_IRQ_VIC2(12)
153#define IRQ_IIC1 S5PC1XX_IRQ_VIC2(13)
154#define IRQ_MFC S5PC1XX_IRQ_VIC2(14)
155#define IRQ_TVENC S5PC1XX_IRQ_VIC2(15)
156#define IRQ_I2S0 S5PC1XX_IRQ_VIC2(16)
157#define IRQ_I2S1 S5PC1XX_IRQ_VIC2(17)
158#define IRQ_I2S2 S5PC1XX_IRQ_VIC2(18)
159#define IRQ_AC97 S5PC1XX_IRQ_VIC2(19)
160#define IRQ_PCM0 S5PC1XX_IRQ_VIC2(20)
161#define IRQ_PCM1 S5PC1XX_IRQ_VIC2(21)
162#define IRQ_SPDIF S5PC1XX_IRQ_VIC2(22)
163#define IRQ_ADC S5PC1XX_IRQ_VIC2(23)
164#define IRQ_PENDN S5PC1XX_IRQ_VIC2(24)
165#define IRQ_TC IRQ_PENDN
166#define IRQ_KEYPAD S5PC1XX_IRQ_VIC2(25)
167#define IRQ_CG S5PC1XX_IRQ_VIC2(26)
168#define IRQ_SEC S5PC1XX_IRQ_VIC2(27)
169#define IRQ_SECRX S5PC1XX_IRQ_VIC2(28)
170#define IRQ_SECTX S5PC1XX_IRQ_VIC2(29)
171#define IRQ_SDMIRQ S5PC1XX_IRQ_VIC2(30)
172#define IRQ_SDMFIQ S5PC1XX_IRQ_VIC2(31)
173
174#define S3C_IRQ_EINT_BASE (IRQ_SDMFIQ + 1)
175
176#define S3C_EINT(x) ((x) + S3C_IRQ_EINT_BASE)
177#define IRQ_EINT(x) S3C_EINT(x)
178
179#define NR_IRQS (IRQ_EINT(31)+1)
180
181#endif /* __ASM_PLAT_S5PC1XX_IRQS_H */
182
diff --git a/arch/arm/plat-s5pc1xx/include/plat/pll.h b/arch/arm/plat-s5pc1xx/include/plat/pll.h
new file mode 100644
index 000000000000..21afef1573e7
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/include/plat/pll.h
@@ -0,0 +1,38 @@
1/* arch/arm/plat-s5pc1xx/include/plat/pll.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC1XX PLL code
7 *
8 * Based on plat-s3c64xx/include/plat/pll.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#define S5P_PLL_MDIV_MASK ((1 << (25-16+1)) - 1)
16#define S5P_PLL_PDIV_MASK ((1 << (13-8+1)) - 1)
17#define S5P_PLL_SDIV_MASK ((1 << (2-0+1)) - 1)
18#define S5P_PLL_MDIV_SHIFT (16)
19#define S5P_PLL_PDIV_SHIFT (8)
20#define S5P_PLL_SDIV_SHIFT (0)
21
22#include <asm/div64.h>
23
24static inline unsigned long s5pc1xx_get_pll(unsigned long baseclk,
25 u32 pllcon)
26{
27 u32 mdiv, pdiv, sdiv;
28 u64 fvco = baseclk;
29
30 mdiv = (pllcon >> S5P_PLL_MDIV_SHIFT) & S5P_PLL_MDIV_MASK;
31 pdiv = (pllcon >> S5P_PLL_PDIV_SHIFT) & S5P_PLL_PDIV_MASK;
32 sdiv = (pllcon >> S5P_PLL_SDIV_SHIFT) & S5P_PLL_SDIV_MASK;
33
34 fvco *= mdiv;
35 do_div(fvco, (pdiv << sdiv));
36
37 return (unsigned long)fvco;
38}
diff --git a/arch/arm/plat-s5pc1xx/include/plat/regs-clock.h b/arch/arm/plat-s5pc1xx/include/plat/regs-clock.h
new file mode 100644
index 000000000000..75c8390cb827
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/include/plat/regs-clock.h
@@ -0,0 +1,421 @@
1/* arch/arm/plat-s5pc1xx/include/plat/regs-clock.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC1XX clock register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __PLAT_REGS_CLOCK_H
14#define __PLAT_REGS_CLOCK_H __FILE__
15
16#define S5PC1XX_CLKREG(x) (S5PC1XX_VA_CLK + (x))
17
18#define S5PC1XX_APLL_LOCK S5PC1XX_CLKREG(0x00)
19#define S5PC1XX_MPLL_LOCK S5PC1XX_CLKREG(0x04)
20#define S5PC1XX_EPLL_LOCK S5PC1XX_CLKREG(0x08)
21#define S5PC100_HPLL_LOCK S5PC1XX_CLKREG(0x0C)
22
23#define S5PC1XX_APLL_CON S5PC1XX_CLKREG(0x100)
24#define S5PC1XX_MPLL_CON S5PC1XX_CLKREG(0x104)
25#define S5PC1XX_EPLL_CON S5PC1XX_CLKREG(0x108)
26#define S5PC100_HPLL_CON S5PC1XX_CLKREG(0x10C)
27
28#define S5PC1XX_CLK_SRC0 S5PC1XX_CLKREG(0x200)
29#define S5PC1XX_CLK_SRC1 S5PC1XX_CLKREG(0x204)
30#define S5PC1XX_CLK_SRC2 S5PC1XX_CLKREG(0x208)
31#define S5PC1XX_CLK_SRC3 S5PC1XX_CLKREG(0x20C)
32
33#define S5PC1XX_CLK_DIV0 S5PC1XX_CLKREG(0x300)
34#define S5PC1XX_CLK_DIV1 S5PC1XX_CLKREG(0x304)
35#define S5PC1XX_CLK_DIV2 S5PC1XX_CLKREG(0x308)
36#define S5PC1XX_CLK_DIV3 S5PC1XX_CLKREG(0x30C)
37#define S5PC1XX_CLK_DIV4 S5PC1XX_CLKREG(0x310)
38
39#define S5PC100_CLK_OUT S5PC1XX_CLKREG(0x400)
40
41#define S5PC100_CLKGATE_D00 S5PC1XX_CLKREG(0x500)
42#define S5PC100_CLKGATE_D01 S5PC1XX_CLKREG(0x504)
43#define S5PC100_CLKGATE_D02 S5PC1XX_CLKREG(0x508)
44
45#define S5PC100_CLKGATE_D10 S5PC1XX_CLKREG(0x520)
46#define S5PC100_CLKGATE_D11 S5PC1XX_CLKREG(0x524)
47#define S5PC100_CLKGATE_D12 S5PC1XX_CLKREG(0x528)
48#define S5PC100_CLKGATE_D13 S5PC1XX_CLKREG(0x52C)
49#define S5PC100_CLKGATE_D14 S5PC1XX_CLKREG(0x530)
50#define S5PC100_CLKGATE_D15 S5PC1XX_CLKREG(0x534)
51
52#define S5PC100_CLKGATE_D20 S5PC1XX_CLKREG(0x540)
53
54#define S5PC100_SCLKGATE0 S5PC1XX_CLKREG(0x560)
55#define S5PC100_SCLKGATE1 S5PC1XX_CLKREG(0x564)
56
57#define S5PC100_OTHERS S5PC1XX_CLKREG(0x8200)
58
59#define S5PC1XX_EPLL_EN (1<<31)
60#define S5PC1XX_EPLL_MASK 0xffffffff
61#define S5PC1XX_EPLLVAL(_m, _p, _s) ((_m) << 16 | ((_p) << 8) | ((_s)))
62
63/* CLKSRC0 */
64#define S5PC1XX_CLKSRC0_APLL_MASK (0x1<<0)
65#define S5PC1XX_CLKSRC0_APLL_SHIFT (0)
66#define S5PC1XX_CLKSRC0_MPLL_MASK (0x1<<4)
67#define S5PC1XX_CLKSRC0_MPLL_SHIFT (4)
68#define S5PC1XX_CLKSRC0_EPLL_MASK (0x1<<8)
69#define S5PC1XX_CLKSRC0_EPLL_SHIFT (8)
70#define S5PC100_CLKSRC0_HPLL_MASK (0x1<<12)
71#define S5PC100_CLKSRC0_HPLL_SHIFT (12)
72#define S5PC100_CLKSRC0_AMMUX_MASK (0x1<<16)
73#define S5PC100_CLKSRC0_AMMUX_SHIFT (16)
74#define S5PC100_CLKSRC0_HREF_MASK (0x1<<20)
75#define S5PC100_CLKSRC0_HREF_SHIFT (20)
76#define S5PC1XX_CLKSRC0_ONENAND_MASK (0x1<<24)
77#define S5PC1XX_CLKSRC0_ONENAND_SHIFT (24)
78
79
80/* CLKSRC1 */
81#define S5PC100_CLKSRC1_UART_MASK (0x1<<0)
82#define S5PC100_CLKSRC1_UART_SHIFT (0)
83#define S5PC100_CLKSRC1_SPI0_MASK (0x3<<4)
84#define S5PC100_CLKSRC1_SPI0_SHIFT (4)
85#define S5PC100_CLKSRC1_SPI1_MASK (0x3<<8)
86#define S5PC100_CLKSRC1_SPI1_SHIFT (8)
87#define S5PC100_CLKSRC1_SPI2_MASK (0x3<<12)
88#define S5PC100_CLKSRC1_SPI2_SHIFT (12)
89#define S5PC100_CLKSRC1_IRDA_MASK (0x3<<16)
90#define S5PC100_CLKSRC1_IRDA_SHIFT (16)
91#define S5PC100_CLKSRC1_UHOST_MASK (0x3<<20)
92#define S5PC100_CLKSRC1_UHOST_SHIFT (20)
93#define S5PC100_CLKSRC1_CLK48M_MASK (0x1<<24)
94#define S5PC100_CLKSRC1_CLK48M_SHIFT (24)
95
96/* CLKSRC2 */
97#define S5PC100_CLKSRC2_MMC0_MASK (0x3<<0)
98#define S5PC100_CLKSRC2_MMC0_SHIFT (0)
99#define S5PC100_CLKSRC2_MMC1_MASK (0x3<<4)
100#define S5PC100_CLKSRC2_MMC1_SHIFT (4)
101#define S5PC100_CLKSRC2_MMC2_MASK (0x3<<8)
102#define S5PC100_CLKSRC2_MMC2_SHIFT (8)
103#define S5PC100_CLKSRC2_LCD_MASK (0x3<<12)
104#define S5PC100_CLKSRC2_LCD_SHIFT (12)
105#define S5PC100_CLKSRC2_FIMC0_MASK (0x3<<16)
106#define S5PC100_CLKSRC2_FIMC0_SHIFT (16)
107#define S5PC100_CLKSRC2_FIMC1_MASK (0x3<<20)
108#define S5PC100_CLKSRC2_FIMC1_SHIFT (20)
109#define S5PC100_CLKSRC2_FIMC2_MASK (0x3<<24)
110#define S5PC100_CLKSRC2_FIMC2_SHIFT (24)
111#define S5PC100_CLKSRC2_MIXER_MASK (0x3<<28)
112#define S5PC100_CLKSRC2_MIXER_SHIFT (28)
113
114/* CLKSRC3 */
115#define S5PC100_CLKSRC3_PWI_MASK (0x3<<0)
116#define S5PC100_CLKSRC3_PWI_SHIFT (0)
117#define S5PC100_CLKSRC3_HCLKD2_MASK (0x1<<4)
118#define S5PC100_CLKSRC3_HCLKD2_SHIFT (4)
119#define S5PC100_CLKSRC3_I2SD2_MASK (0x3<<8)
120#define S5PC100_CLKSRC3_I2SD2_SHIFT (8)
121#define S5PC100_CLKSRC3_AUDIO0_MASK (0x7<<12)
122#define S5PC100_CLKSRC3_AUDIO0_SHIFT (12)
123#define S5PC100_CLKSRC3_AUDIO1_MASK (0x7<<16)
124#define S5PC100_CLKSRC3_AUDIO1_SHIFT (16)
125#define S5PC100_CLKSRC3_AUDIO2_MASK (0x7<<20)
126#define S5PC100_CLKSRC3_AUDIO2_SHIFT (20)
127#define S5PC100_CLKSRC3_SPDIF_MASK (0x3<<24)
128#define S5PC100_CLKSRC3_SPDIF_SHIFT (24)
129
130
131/* CLKDIV0 */
132#define S5PC1XX_CLKDIV0_APLL_MASK (0x1<<0)
133#define S5PC1XX_CLKDIV0_APLL_SHIFT (0)
134#define S5PC100_CLKDIV0_ARM_MASK (0x7<<4)
135#define S5PC100_CLKDIV0_ARM_SHIFT (4)
136#define S5PC100_CLKDIV0_D0_MASK (0x7<<8)
137#define S5PC100_CLKDIV0_D0_SHIFT (8)
138#define S5PC100_CLKDIV0_PCLKD0_MASK (0x7<<12)
139#define S5PC100_CLKDIV0_PCLKD0_SHIFT (12)
140#define S5PC100_CLKDIV0_SECSS_MASK (0x7<<16)
141#define S5PC100_CLKDIV0_SECSS_SHIFT (16)
142
143/* CLKDIV1 */
144#define S5PC100_CLKDIV1_AM_MASK (0x7<<0)
145#define S5PC100_CLKDIV1_AM_SHIFT (0)
146#define S5PC100_CLKDIV1_MPLL_MASK (0x3<<4)
147#define S5PC100_CLKDIV1_MPLL_SHIFT (4)
148#define S5PC100_CLKDIV1_MPLL2_MASK (0x1<<8)
149#define S5PC100_CLKDIV1_MPLL2_SHIFT (8)
150#define S5PC100_CLKDIV1_D1_MASK (0x7<<12)
151#define S5PC100_CLKDIV1_D1_SHIFT (12)
152#define S5PC100_CLKDIV1_PCLKD1_MASK (0x7<<16)
153#define S5PC100_CLKDIV1_PCLKD1_SHIFT (16)
154#define S5PC100_CLKDIV1_ONENAND_MASK (0x3<<20)
155#define S5PC100_CLKDIV1_ONENAND_SHIFT (20)
156#define S5PC100_CLKDIV1_CAM_MASK (0x1F<<24)
157#define S5PC100_CLKDIV1_CAM_SHIFT (24)
158
159/* CLKDIV2 */
160#define S5PC100_CLKDIV2_UART_MASK (0x7<<0)
161#define S5PC100_CLKDIV2_UART_SHIFT (0)
162#define S5PC100_CLKDIV2_SPI0_MASK (0xf<<4)
163#define S5PC100_CLKDIV2_SPI0_SHIFT (4)
164#define S5PC100_CLKDIV2_SPI1_MASK (0xf<<8)
165#define S5PC100_CLKDIV2_SPI1_SHIFT (8)
166#define S5PC100_CLKDIV2_SPI2_MASK (0xf<<12)
167#define S5PC100_CLKDIV2_SPI2_SHIFT (12)
168#define S5PC100_CLKDIV2_IRDA_MASK (0xf<<16)
169#define S5PC100_CLKDIV2_IRDA_SHIFT (16)
170#define S5PC100_CLKDIV2_UHOST_MASK (0xf<<20)
171#define S5PC100_CLKDIV2_UHOST_SHIFT (20)
172
173/* CLKDIV3 */
174#define S5PC100_CLKDIV3_MMC0_MASK (0xf<<0)
175#define S5PC100_CLKDIV3_MMC0_SHIFT (0)
176#define S5PC100_CLKDIV3_MMC1_MASK (0xf<<4)
177#define S5PC100_CLKDIV3_MMC1_SHIFT (4)
178#define S5PC100_CLKDIV3_MMC2_MASK (0xf<<8)
179#define S5PC100_CLKDIV3_MMC2_SHIFT (8)
180#define S5PC100_CLKDIV3_LCD_MASK (0xf<<12)
181#define S5PC100_CLKDIV3_LCD_SHIFT (12)
182#define S5PC100_CLKDIV3_FIMC0_MASK (0xf<<16)
183#define S5PC100_CLKDIV3_FIMC0_SHIFT (16)
184#define S5PC100_CLKDIV3_FIMC1_MASK (0xf<<20)
185#define S5PC100_CLKDIV3_FIMC1_SHIFT (20)
186#define S5PC100_CLKDIV3_FIMC2_MASK (0xf<<24)
187#define S5PC100_CLKDIV3_FIMC2_SHIFT (24)
188#define S5PC100_CLKDIV3_HDMI_MASK (0xf<<28)
189#define S5PC100_CLKDIV3_HDMI_SHIFT (28)
190
191/* CLKDIV4 */
192#define S5PC100_CLKDIV4_PWI_MASK (0x7<<0)
193#define S5PC100_CLKDIV4_PWI_SHIFT (0)
194#define S5PC100_CLKDIV4_HCLKD2_MASK (0x7<<4)
195#define S5PC100_CLKDIV4_HCLKD2_SHIFT (4)
196#define S5PC100_CLKDIV4_I2SD2_MASK (0xf<<8)
197#define S5PC100_CLKDIV4_I2SD2_SHIFT (8)
198#define S5PC100_CLKDIV4_AUDIO0_MASK (0xf<<12)
199#define S5PC100_CLKDIV4_AUDIO0_SHIFT (12)
200#define S5PC100_CLKDIV4_AUDIO1_MASK (0xf<<16)
201#define S5PC100_CLKDIV4_AUDIO1_SHIFT (16)
202#define S5PC100_CLKDIV4_AUDIO2_MASK (0xf<<20)
203#define S5PC100_CLKDIV4_AUDIO2_SHIFT (20)
204
205
206/* HCLKD0/PCLKD0 Clock Gate 0 Registers */
207#define S5PC100_CLKGATE_D00_INTC (1<<0)
208#define S5PC100_CLKGATE_D00_TZIC (1<<1)
209#define S5PC100_CLKGATE_D00_CFCON (1<<2)
210#define S5PC100_CLKGATE_D00_MDMA (1<<3)
211#define S5PC100_CLKGATE_D00_G2D (1<<4)
212#define S5PC100_CLKGATE_D00_SECSS (1<<5)
213#define S5PC100_CLKGATE_D00_CSSYS (1<<6)
214
215/* HCLKD0/PCLKD0 Clock Gate 1 Registers */
216#define S5PC100_CLKGATE_D01_DMC (1<<0)
217#define S5PC100_CLKGATE_D01_SROMC (1<<1)
218#define S5PC100_CLKGATE_D01_ONENAND (1<<2)
219#define S5PC100_CLKGATE_D01_NFCON (1<<3)
220#define S5PC100_CLKGATE_D01_INTMEM (1<<4)
221#define S5PC100_CLKGATE_D01_EBI (1<<5)
222
223/* PCLKD0 Clock Gate 2 Registers */
224#define S5PC100_CLKGATE_D02_SECKEY (1<<1)
225#define S5PC100_CLKGATE_D02_SDM (1<<2)
226
227/* HCLKD1/PCLKD1 Clock Gate 0 Registers */
228#define S5PC100_CLKGATE_D10_PDMA0 (1<<0)
229#define S5PC100_CLKGATE_D10_PDMA1 (1<<1)
230#define S5PC100_CLKGATE_D10_USBHOST (1<<2)
231#define S5PC100_CLKGATE_D10_USBOTG (1<<3)
232#define S5PC100_CLKGATE_D10_MODEMIF (1<<4)
233#define S5PC100_CLKGATE_D10_HSMMC0 (1<<5)
234#define S5PC100_CLKGATE_D10_HSMMC1 (1<<6)
235#define S5PC100_CLKGATE_D10_HSMMC2 (1<<7)
236
237/* HCLKD1/PCLKD1 Clock Gate 1 Registers */
238#define S5PC100_CLKGATE_D11_LCD (1<<0)
239#define S5PC100_CLKGATE_D11_ROTATOR (1<<1)
240#define S5PC100_CLKGATE_D11_FIMC0 (1<<2)
241#define S5PC100_CLKGATE_D11_FIMC1 (1<<3)
242#define S5PC100_CLKGATE_D11_FIMC2 (1<<4)
243#define S5PC100_CLKGATE_D11_JPEG (1<<5)
244#define S5PC100_CLKGATE_D11_DSI (1<<6)
245#define S5PC100_CLKGATE_D11_CSI (1<<7)
246#define S5PC100_CLKGATE_D11_G3D (1<<8)
247
248/* HCLKD1/PCLKD1 Clock Gate 2 Registers */
249#define S5PC100_CLKGATE_D12_TV (1<<0)
250#define S5PC100_CLKGATE_D12_VP (1<<1)
251#define S5PC100_CLKGATE_D12_MIXER (1<<2)
252#define S5PC100_CLKGATE_D12_HDMI (1<<3)
253#define S5PC100_CLKGATE_D12_MFC (1<<4)
254
255/* HCLKD1/PCLKD1 Clock Gate 3 Registers */
256#define S5PC100_CLKGATE_D13_CHIPID (1<<0)
257#define S5PC100_CLKGATE_D13_GPIO (1<<1)
258#define S5PC100_CLKGATE_D13_APC (1<<2)
259#define S5PC100_CLKGATE_D13_IEC (1<<3)
260#define S5PC100_CLKGATE_D13_PWM (1<<6)
261#define S5PC100_CLKGATE_D13_SYSTIMER (1<<7)
262#define S5PC100_CLKGATE_D13_WDT (1<<8)
263#define S5PC100_CLKGATE_D13_RTC (1<<9)
264
265/* HCLKD1/PCLKD1 Clock Gate 4 Registers */
266#define S5PC100_CLKGATE_D14_UART0 (1<<0)
267#define S5PC100_CLKGATE_D14_UART1 (1<<1)
268#define S5PC100_CLKGATE_D14_UART2 (1<<2)
269#define S5PC100_CLKGATE_D14_UART3 (1<<3)
270#define S5PC100_CLKGATE_D14_IIC (1<<4)
271#define S5PC100_CLKGATE_D14_HDMI_IIC (1<<5)
272#define S5PC100_CLKGATE_D14_SPI0 (1<<6)
273#define S5PC100_CLKGATE_D14_SPI1 (1<<7)
274#define S5PC100_CLKGATE_D14_SPI2 (1<<8)
275#define S5PC100_CLKGATE_D14_IRDA (1<<9)
276#define S5PC100_CLKGATE_D14_CCAN0 (1<<10)
277#define S5PC100_CLKGATE_D14_CCAN1 (1<<11)
278#define S5PC100_CLKGATE_D14_HSITX (1<<12)
279#define S5PC100_CLKGATE_D14_HSIRX (1<<13)
280
281/* HCLKD1/PCLKD1 Clock Gate 5 Registers */
282#define S5PC100_CLKGATE_D15_IIS0 (1<<0)
283#define S5PC100_CLKGATE_D15_IIS1 (1<<1)
284#define S5PC100_CLKGATE_D15_IIS2 (1<<2)
285#define S5PC100_CLKGATE_D15_AC97 (1<<3)
286#define S5PC100_CLKGATE_D15_PCM0 (1<<4)
287#define S5PC100_CLKGATE_D15_PCM1 (1<<5)
288#define S5PC100_CLKGATE_D15_SPDIF (1<<6)
289#define S5PC100_CLKGATE_D15_TSADC (1<<7)
290#define S5PC100_CLKGATE_D15_KEYIF (1<<8)
291#define S5PC100_CLKGATE_D15_CG (1<<9)
292
293/* HCLKD2 Clock Gate 0 Registers */
294#define S5PC100_CLKGATE_D20_HCLKD2 (1<<0)
295#define S5PC100_CLKGATE_D20_I2SD2 (1<<1)
296
297/* Special Clock Gate 0 Registers */
298#define S5PC1XX_CLKGATE_SCLK0_HPM (1<<0)
299#define S5PC1XX_CLKGATE_SCLK0_PWI (1<<1)
300#define S5PC100_CLKGATE_SCLK0_ONENAND (1<<2)
301#define S5PC100_CLKGATE_SCLK0_UART (1<<3)
302#define S5PC100_CLKGATE_SCLK0_SPI0 (1<<4)
303#define S5PC100_CLKGATE_SCLK0_SPI1 (1<<5)
304#define S5PC100_CLKGATE_SCLK0_SPI2 (1<<6)
305#define S5PC100_CLKGATE_SCLK0_SPI0_48 (1<<7)
306#define S5PC100_CLKGATE_SCLK0_SPI1_48 (1<<8)
307#define S5PC100_CLKGATE_SCLK0_SPI2_48 (1<<9)
308#define S5PC100_CLKGATE_SCLK0_IRDA (1<<10)
309#define S5PC100_CLKGATE_SCLK0_USBHOST (1<<11)
310#define S5PC100_CLKGATE_SCLK0_MMC0 (1<<12)
311#define S5PC100_CLKGATE_SCLK0_MMC1 (1<<13)
312#define S5PC100_CLKGATE_SCLK0_MMC2 (1<<14)
313#define S5PC100_CLKGATE_SCLK0_MMC0_48 (1<<15)
314#define S5PC100_CLKGATE_SCLK0_MMC1_48 (1<<16)
315#define S5PC100_CLKGATE_SCLK0_MMC2_48 (1<<17)
316
317/* Special Clock Gate 1 Registers */
318#define S5PC100_CLKGATE_SCLK1_LCD (1<<0)
319#define S5PC100_CLKGATE_SCLK1_FIMC0 (1<<1)
320#define S5PC100_CLKGATE_SCLK1_FIMC1 (1<<2)
321#define S5PC100_CLKGATE_SCLK1_FIMC2 (1<<3)
322#define S5PC100_CLKGATE_SCLK1_TV54 (1<<4)
323#define S5PC100_CLKGATE_SCLK1_VDAC54 (1<<5)
324#define S5PC100_CLKGATE_SCLK1_MIXER (1<<6)
325#define S5PC100_CLKGATE_SCLK1_HDMI (1<<7)
326#define S5PC100_CLKGATE_SCLK1_AUDIO0 (1<<8)
327#define S5PC100_CLKGATE_SCLK1_AUDIO1 (1<<9)
328#define S5PC100_CLKGATE_SCLK1_AUDIO2 (1<<10)
329#define S5PC100_CLKGATE_SCLK1_SPDIF (1<<11)
330#define S5PC100_CLKGATE_SCLK1_CAM (1<<12)
331
332/* register for power management */
333#define S5PC100_PWR_CFG S5PC1XX_CLKREG(0x8000)
334#define S5PC100_EINT_WAKEUP_MASK S5PC1XX_CLKREG(0x8004)
335#define S5PC100_NORMAL_CFG S5PC1XX_CLKREG(0x8010)
336#define S5PC100_STOP_CFG S5PC1XX_CLKREG(0x8014)
337#define S5PC100_SLEEP_CFG S5PC1XX_CLKREG(0x8018)
338#define S5PC100_STOP_MEM_CFG S5PC1XX_CLKREG(0x801C)
339#define S5PC100_OSC_FREQ S5PC1XX_CLKREG(0x8100)
340#define S5PC100_OSC_STABLE S5PC1XX_CLKREG(0x8104)
341#define S5PC100_PWR_STABLE S5PC1XX_CLKREG(0x8108)
342#define S5PC100_MTC_STABLE S5PC1XX_CLKREG(0x8110)
343#define S5PC100_CLAMP_STABLE S5PC1XX_CLKREG(0x8114)
344#define S5PC100_OTHERS S5PC1XX_CLKREG(0x8200)
345#define S5PC100_RST_STAT S5PC1XX_CLKREG(0x8300)
346#define S5PC100_WAKEUP_STAT S5PC1XX_CLKREG(0x8304)
347#define S5PC100_BLK_PWR_STAT S5PC1XX_CLKREG(0x8308)
348#define S5PC100_INFORM0 S5PC1XX_CLKREG(0x8400)
349#define S5PC100_INFORM1 S5PC1XX_CLKREG(0x8404)
350#define S5PC100_INFORM2 S5PC1XX_CLKREG(0x8408)
351#define S5PC100_INFORM3 S5PC1XX_CLKREG(0x840C)
352#define S5PC100_INFORM4 S5PC1XX_CLKREG(0x8410)
353#define S5PC100_INFORM5 S5PC1XX_CLKREG(0x8414)
354#define S5PC100_INFORM6 S5PC1XX_CLKREG(0x8418)
355#define S5PC100_INFORM7 S5PC1XX_CLKREG(0x841C)
356#define S5PC100_DCGIDX_MAP0 S5PC1XX_CLKREG(0x8500)
357#define S5PC100_DCGIDX_MAP1 S5PC1XX_CLKREG(0x8504)
358#define S5PC100_DCGIDX_MAP2 S5PC1XX_CLKREG(0x8508)
359#define S5PC100_DCGPERF_MAP0 S5PC1XX_CLKREG(0x850C)
360#define S5PC100_DCGPERF_MAP1 S5PC1XX_CLKREG(0x8510)
361#define S5PC100_DVCIDX_MAP S5PC1XX_CLKREG(0x8514)
362#define S5PC100_FREQ_CPU S5PC1XX_CLKREG(0x8518)
363#define S5PC100_FREQ_DPM S5PC1XX_CLKREG(0x851C)
364#define S5PC100_DVSEMCLK_EN S5PC1XX_CLKREG(0x8520)
365#define S5PC100_APLL_CON_L8 S5PC1XX_CLKREG(0x8600)
366#define S5PC100_APLL_CON_L7 S5PC1XX_CLKREG(0x8604)
367#define S5PC100_APLL_CON_L6 S5PC1XX_CLKREG(0x8608)
368#define S5PC100_APLL_CON_L5 S5PC1XX_CLKREG(0x860C)
369#define S5PC100_APLL_CON_L4 S5PC1XX_CLKREG(0x8610)
370#define S5PC100_APLL_CON_L3 S5PC1XX_CLKREG(0x8614)
371#define S5PC100_APLL_CON_L2 S5PC1XX_CLKREG(0x8618)
372#define S5PC100_APLL_CON_L1 S5PC1XX_CLKREG(0x861C)
373#define S5PC100_IEM_CONTROL S5PC1XX_CLKREG(0x8620)
374#define S5PC100_CLKDIV_IEM_L8 S5PC1XX_CLKREG(0x8700)
375#define S5PC100_CLKDIV_IEM_L7 S5PC1XX_CLKREG(0x8704)
376#define S5PC100_CLKDIV_IEM_L6 S5PC1XX_CLKREG(0x8708)
377#define S5PC100_CLKDIV_IEM_L5 S5PC1XX_CLKREG(0x870C)
378#define S5PC100_CLKDIV_IEM_L4 S5PC1XX_CLKREG(0x8710)
379#define S5PC100_CLKDIV_IEM_L3 S5PC1XX_CLKREG(0x8714)
380#define S5PC100_CLKDIV_IEM_L2 S5PC1XX_CLKREG(0x8718)
381#define S5PC100_CLKDIV_IEM_L1 S5PC1XX_CLKREG(0x871C)
382#define S5PC100_IEM_HPMCLK_DIV S5PC1XX_CLKREG(0x8724)
383
384#define S5PC100_SWRESET S5PC1XX_CLKREG(0x100000)
385#define S5PC100_OND_SWRESET S5PC1XX_CLKREG(0x100008)
386#define S5PC100_GEN_CTRL S5PC1XX_CLKREG(0x100100)
387#define S5PC100_GEN_STATUS S5PC1XX_CLKREG(0x100104)
388#define S5PC100_MEM_SYS_CFG S5PC1XX_CLKREG(0x100200)
389#define S5PC100_CAM_MUX_SEL S5PC1XX_CLKREG(0x100300)
390#define S5PC100_MIXER_OUT_SEL S5PC1XX_CLKREG(0x100304)
391#define S5PC100_LPMP_MODE_SEL S5PC1XX_CLKREG(0x100308)
392#define S5PC100_MIPI_PHY_CON0 S5PC1XX_CLKREG(0x100400)
393#define S5PC100_MIPI_PHY_CON1 S5PC1XX_CLKREG(0x100414)
394#define S5PC100_HDMI_PHY_CON0 S5PC1XX_CLKREG(0x100420)
395
396#define S5PC100_CFG_WFI_CLEAN (~(3<<5))
397#define S5PC100_CFG_WFI_IDLE (1<<5)
398#define S5PC100_CFG_WFI_STOP (2<<5)
399#define S5PC100_CFG_WFI_SLEEP (3<<5)
400
401#define S5PC100_OTHER_SYS_INT 24
402#define S5PC100_OTHER_STA_TYPE 23
403#define STA_TYPE_EXPON 0
404#define STA_TYPE_SFR 1
405
406#define S5PC100_PWR_STA_EXP_SCALE 0
407#define S5PC100_PWR_STA_CNT 4
408
409#define S5PC100_PWR_STABLE_COUNT 85500
410
411#define S5PC100_SLEEP_CFG_OSC_EN 0
412
413/* OTHERS Resgister */
414#define S5PC100_OTHERS_USB_SIG_MASK (1 << 16)
415#define S5PC100_OTHERS_MIPI_DPHY_EN (1 << 28)
416
417/* MIPI D-PHY Control Register 0 */
418#define S5PC100_MIPI_PHY_CON0_M_RESETN (1 << 1)
419#define S5PC100_MIPI_PHY_CON0_S_RESETN (1 << 0)
420
421#endif /* _PLAT_REGS_CLOCK_H */
diff --git a/arch/arm/plat-s5pc1xx/include/plat/s5pc100.h b/arch/arm/plat-s5pc1xx/include/plat/s5pc100.h
new file mode 100644
index 000000000000..45e275131665
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/include/plat/s5pc100.h
@@ -0,0 +1,65 @@
1/* arch/arm/plat-s5pc1xx/include/plat/s5pc100.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Header file for s5pc100 cpu support
7 *
8 * Based on plat-s3c64xx/include/plat/s3c6400.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/* Common init code for S5PC100 related SoCs */
16extern int s5pc100_init(void);
17extern void s5pc100_map_io(void);
18extern void s5pc100_init_clocks(int xtal);
19extern int s5pc100_register_baseclocks(unsigned long xtal);
20extern void s5pc100_init_irq(void);
21extern void s5pc100_init_io(struct map_desc *mach_desc, int size);
22extern void s5pc100_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);
23extern void s5pc100_register_clocks(void);
24extern void s5pc100_setup_clocks(void);
25extern struct sysdev_class s5pc100_sysclass;
26
27#define s5pc100_init_uarts s5pc100_common_init_uarts
28
29/* Some day, belows will be moved to plat-s5pc/include/plat/cpu.h */
30extern void s5pc1xx_init_irq(u32 *vic_valid, int num);
31extern void s5pc1xx_init_io(struct map_desc *mach_desc, int size);
32
33/* Some day, belows will be moved to plat-s5pc/include/plat/clock.h */
34extern struct clk clk_hpll;
35extern struct clk clk_hd0;
36extern struct clk clk_pd0;
37extern struct clk clk_54m;
38extern struct clk clk_dout_mpll2;
39extern void s5pc1xx_register_clocks(void);
40extern int s5pc1xx_sclk0_ctrl(struct clk *clk, int enable);
41extern int s5pc1xx_sclk1_ctrl(struct clk *clk, int enable);
42
43/* Some day, belows will be moved to plat-s5pc/include/plat/devs.h */
44extern struct s3c24xx_uart_resources s5pc1xx_uart_resources[];
45extern struct platform_device s3c_device_g2d;
46extern struct platform_device s3c_device_g3d;
47extern struct platform_device s3c_device_vpp;
48extern struct platform_device s3c_device_tvenc;
49extern struct platform_device s3c_device_tvscaler;
50extern struct platform_device s3c_device_rotator;
51extern struct platform_device s3c_device_jpeg;
52extern struct platform_device s3c_device_onenand;
53extern struct platform_device s3c_device_usb_otghcd;
54extern struct platform_device s3c_device_keypad;
55extern struct platform_device s3c_device_ts;
56extern struct platform_device s3c_device_g3d;
57extern struct platform_device s3c_device_smc911x;
58extern struct platform_device s3c_device_fimc0;
59extern struct platform_device s3c_device_fimc1;
60extern struct platform_device s3c_device_mfc;
61extern struct platform_device s3c_device_ac97;
62extern struct platform_device s3c_device_fimc0;
63extern struct platform_device s3c_device_fimc1;
64extern struct platform_device s3c_device_fimc2;
65
diff --git a/arch/arm/plat-s5pc1xx/irq.c b/arch/arm/plat-s5pc1xx/irq.c
new file mode 100644
index 000000000000..80d6dd942cb8
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/irq.c
@@ -0,0 +1,259 @@
1/* arch/arm/plat-s5pc1xx/irq.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC1XX - Interrupt handling
7 *
8 * Based on plat-s3c64xx/irq.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/interrupt.h>
17#include <linux/irq.h>
18#include <linux/io.h>
19
20#include <asm/hardware/vic.h>
21
22#include <mach/map.h>
23#include <plat/regs-timer.h>
24#include <plat/cpu.h>
25
26/* Timer interrupt handling */
27
28static void s3c_irq_demux_timer(unsigned int base_irq, unsigned int sub_irq)
29{
30 generic_handle_irq(sub_irq);
31}
32
33static void s3c_irq_demux_timer0(unsigned int irq, struct irq_desc *desc)
34{
35 s3c_irq_demux_timer(irq, IRQ_TIMER0);
36}
37
38static void s3c_irq_demux_timer1(unsigned int irq, struct irq_desc *desc)
39{
40 s3c_irq_demux_timer(irq, IRQ_TIMER1);
41}
42
43static void s3c_irq_demux_timer2(unsigned int irq, struct irq_desc *desc)
44{
45 s3c_irq_demux_timer(irq, IRQ_TIMER2);
46}
47
48static void s3c_irq_demux_timer3(unsigned int irq, struct irq_desc *desc)
49{
50 s3c_irq_demux_timer(irq, IRQ_TIMER3);
51}
52
53static void s3c_irq_demux_timer4(unsigned int irq, struct irq_desc *desc)
54{
55 s3c_irq_demux_timer(irq, IRQ_TIMER4);
56}
57
58/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */
59
60static void s3c_irq_timer_mask(unsigned int irq)
61{
62 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
63
64 reg &= 0x1f; /* mask out pending interrupts */
65 reg &= ~(1 << (irq - IRQ_TIMER0));
66 __raw_writel(reg, S3C64XX_TINT_CSTAT);
67}
68
69static void s3c_irq_timer_unmask(unsigned int irq)
70{
71 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
72
73 reg &= 0x1f; /* mask out pending interrupts */
74 reg |= 1 << (irq - IRQ_TIMER0);
75 __raw_writel(reg, S3C64XX_TINT_CSTAT);
76}
77
78static void s3c_irq_timer_ack(unsigned int irq)
79{
80 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
81
82 reg &= 0x1f;
83 reg |= (1 << 5) << (irq - IRQ_TIMER0);
84 __raw_writel(reg, S3C64XX_TINT_CSTAT);
85}
86
87static struct irq_chip s3c_irq_timer = {
88 .name = "s3c-timer",
89 .mask = s3c_irq_timer_mask,
90 .unmask = s3c_irq_timer_unmask,
91 .ack = s3c_irq_timer_ack,
92};
93
94struct uart_irq {
95 void __iomem *regs;
96 unsigned int base_irq;
97 unsigned int parent_irq;
98};
99
100/* Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
101 * are consecutive when looking up the interrupt in the demux routines.
102 */
103static struct uart_irq uart_irqs[] = {
104 [0] = {
105 .regs = (void *)S3C_VA_UART0,
106 .base_irq = IRQ_S3CUART_BASE0,
107 .parent_irq = IRQ_UART0,
108 },
109 [1] = {
110 .regs = (void *)S3C_VA_UART1,
111 .base_irq = IRQ_S3CUART_BASE1,
112 .parent_irq = IRQ_UART1,
113 },
114 [2] = {
115 .regs = (void *)S3C_VA_UART2,
116 .base_irq = IRQ_S3CUART_BASE2,
117 .parent_irq = IRQ_UART2,
118 },
119 [3] = {
120 .regs = (void *)S3C_VA_UART3,
121 .base_irq = IRQ_S3CUART_BASE3,
122 .parent_irq = IRQ_UART3,
123 },
124};
125
126static inline void __iomem *s3c_irq_uart_base(unsigned int irq)
127{
128 struct uart_irq *uirq = get_irq_chip_data(irq);
129 return uirq->regs;
130}
131
132static inline unsigned int s3c_irq_uart_bit(unsigned int irq)
133{
134 return irq & 3;
135}
136
137/* UART interrupt registers, not worth adding to seperate include header */
138#define S3C64XX_UINTP 0x30
139#define S3C64XX_UINTSP 0x34
140#define S3C64XX_UINTM 0x38
141
142static void s3c_irq_uart_mask(unsigned int irq)
143{
144 void __iomem *regs = s3c_irq_uart_base(irq);
145 unsigned int bit = s3c_irq_uart_bit(irq);
146 u32 reg;
147
148 reg = __raw_readl(regs + S3C64XX_UINTM);
149 reg |= (1 << bit);
150 __raw_writel(reg, regs + S3C64XX_UINTM);
151}
152
153static void s3c_irq_uart_maskack(unsigned int irq)
154{
155 void __iomem *regs = s3c_irq_uart_base(irq);
156 unsigned int bit = s3c_irq_uart_bit(irq);
157 u32 reg;
158
159 reg = __raw_readl(regs + S3C64XX_UINTM);
160 reg |= (1 << bit);
161 __raw_writel(reg, regs + S3C64XX_UINTM);
162 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
163}
164
165static void s3c_irq_uart_unmask(unsigned int irq)
166{
167 void __iomem *regs = s3c_irq_uart_base(irq);
168 unsigned int bit = s3c_irq_uart_bit(irq);
169 u32 reg;
170
171 reg = __raw_readl(regs + S3C64XX_UINTM);
172 reg &= ~(1 << bit);
173 __raw_writel(reg, regs + S3C64XX_UINTM);
174}
175
176static void s3c_irq_uart_ack(unsigned int irq)
177{
178 void __iomem *regs = s3c_irq_uart_base(irq);
179 unsigned int bit = s3c_irq_uart_bit(irq);
180
181 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
182}
183
184static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
185{
186 struct uart_irq *uirq = &uart_irqs[irq - IRQ_UART0];
187 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP);
188 int base = uirq->base_irq;
189
190 if (pend & (1 << 0))
191 generic_handle_irq(base);
192 if (pend & (1 << 1))
193 generic_handle_irq(base + 1);
194 if (pend & (1 << 2))
195 generic_handle_irq(base + 2);
196 if (pend & (1 << 3))
197 generic_handle_irq(base + 3);
198}
199
200static struct irq_chip s3c_irq_uart = {
201 .name = "s3c-uart",
202 .mask = s3c_irq_uart_mask,
203 .unmask = s3c_irq_uart_unmask,
204 .mask_ack = s3c_irq_uart_maskack,
205 .ack = s3c_irq_uart_ack,
206};
207
208static void __init s5pc1xx_uart_irq(struct uart_irq *uirq)
209{
210 void __iomem *reg_base = uirq->regs;
211 unsigned int irq;
212 int offs;
213
214 /* mask all interrupts at the start. */
215 __raw_writel(0xf, reg_base + S3C64XX_UINTM);
216
217 for (offs = 0; offs < 3; offs++) {
218 irq = uirq->base_irq + offs;
219
220 set_irq_chip(irq, &s3c_irq_uart);
221 set_irq_chip_data(irq, uirq);
222 set_irq_handler(irq, handle_level_irq);
223 set_irq_flags(irq, IRQF_VALID);
224 }
225
226 set_irq_chained_handler(uirq->parent_irq, s3c_irq_demux_uart);
227}
228
229void __init s5pc1xx_init_irq(u32 *vic_valid, int num)
230{
231 int i;
232 int uart, irq;
233
234 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
235
236 /* initialise the pair of VICs */
237 for (i = 0; i < num; i++)
238 vic_init((void *)S5PC1XX_VA_VIC(i), S3C_IRQ(i * S3C_IRQ_OFFSET),
239 vic_valid[i], 0);
240
241 /* add the timer sub-irqs */
242
243 set_irq_chained_handler(IRQ_TIMER0, s3c_irq_demux_timer0);
244 set_irq_chained_handler(IRQ_TIMER1, s3c_irq_demux_timer1);
245 set_irq_chained_handler(IRQ_TIMER2, s3c_irq_demux_timer2);
246 set_irq_chained_handler(IRQ_TIMER3, s3c_irq_demux_timer3);
247 set_irq_chained_handler(IRQ_TIMER4, s3c_irq_demux_timer4);
248
249 for (irq = IRQ_TIMER0; irq <= IRQ_TIMER4; irq++) {
250 set_irq_chip(irq, &s3c_irq_timer);
251 set_irq_handler(irq, handle_level_irq);
252 set_irq_flags(irq, IRQF_VALID);
253 }
254
255 for (uart = 0; uart < ARRAY_SIZE(uart_irqs); uart++)
256 s5pc1xx_uart_irq(&uart_irqs[uart]);
257}
258
259
diff --git a/arch/arm/plat-s5pc1xx/s5pc100-clock.c b/arch/arm/plat-s5pc1xx/s5pc100-clock.c
new file mode 100644
index 000000000000..6b24035172fa
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/s5pc100-clock.c
@@ -0,0 +1,1139 @@
1/* linux/arch/arm/plat-s5pc1xx/s5pc100-clock.c
2 *
3 * Copyright 2009 Samsung Electronics, Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 based common clock support
7 *
8 * Based on plat-s3c64xx/s3c6400-clock.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/errno.h>
20#include <linux/err.h>
21#include <linux/clk.h>
22#include <linux/sysdev.h>
23#include <linux/io.h>
24
25#include <mach/hardware.h>
26#include <mach/map.h>
27
28#include <plat/cpu-freq.h>
29
30#include <plat/regs-clock.h>
31#include <plat/clock.h>
32#include <plat/cpu.h>
33#include <plat/pll.h>
34#include <plat/devs.h>
35#include <plat/s5pc100.h>
36
37/* fin_apll, fin_mpll and fin_epll are all the same clock, which we call
38 * ext_xtal_mux for want of an actual name from the manual.
39*/
40
41static struct clk clk_ext_xtal_mux = {
42 .name = "ext_xtal",
43 .id = -1,
44};
45
46#define clk_fin_apll clk_ext_xtal_mux
47#define clk_fin_mpll clk_ext_xtal_mux
48#define clk_fin_epll clk_ext_xtal_mux
49#define clk_fin_hpll clk_ext_xtal_mux
50
51#define clk_fout_mpll clk_mpll
52
53struct clk_sources {
54 unsigned int nr_sources;
55 struct clk **sources;
56};
57
58struct clksrc_clk {
59 struct clk clk;
60 unsigned int mask;
61 unsigned int shift;
62
63 struct clk_sources *sources;
64
65 unsigned int divider_shift;
66 void __iomem *reg_divider;
67 void __iomem *reg_source;
68};
69
70static int clk_default_setrate(struct clk *clk, unsigned long rate)
71{
72 clk->rate = rate;
73 return 1;
74}
75
76struct clk clk_27m = {
77 .name = "clk_27m",
78 .id = -1,
79 .rate = 27000000,
80};
81
82static int clk_48m_ctrl(struct clk *clk, int enable)
83{
84 unsigned long flags;
85 u32 val;
86
87 /* can't rely on clock lock, this register has other usages */
88 local_irq_save(flags);
89
90 val = __raw_readl(S5PC1XX_CLK_SRC1);
91 if (enable)
92 val |= S5PC100_CLKSRC1_CLK48M_MASK;
93 else
94 val &= ~S5PC100_CLKSRC1_CLK48M_MASK;
95
96 __raw_writel(val, S5PC1XX_CLK_SRC1);
97 local_irq_restore(flags);
98
99 return 0;
100}
101
102struct clk clk_48m = {
103 .name = "clk_48m",
104 .id = -1,
105 .rate = 48000000,
106 .enable = clk_48m_ctrl,
107};
108
109struct clk clk_54m = {
110 .name = "clk_54m",
111 .id = -1,
112 .rate = 54000000,
113};
114
115struct clk clk_hpll = {
116 .name = "hpll",
117 .id = -1,
118};
119
120struct clk clk_hd0 = {
121 .name = "hclkd0",
122 .id = -1,
123 .rate = 0,
124 .parent = NULL,
125 .ctrlbit = 0,
126 .set_rate = clk_default_setrate,
127};
128
129struct clk clk_pd0 = {
130 .name = "pclkd0",
131 .id = -1,
132 .rate = 0,
133 .parent = NULL,
134 .ctrlbit = 0,
135 .set_rate = clk_default_setrate,
136};
137
138static int s5pc1xx_clk_gate(void __iomem *reg,
139 struct clk *clk,
140 int enable)
141{
142 unsigned int ctrlbit = clk->ctrlbit;
143 u32 con;
144
145 con = __raw_readl(reg);
146
147 if (enable)
148 con |= ctrlbit;
149 else
150 con &= ~ctrlbit;
151
152 __raw_writel(con, reg);
153 return 0;
154}
155
156static int s5pc1xx_clk_d00_ctrl(struct clk *clk, int enable)
157{
158 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D00, clk, enable);
159}
160
161static int s5pc1xx_clk_d01_ctrl(struct clk *clk, int enable)
162{
163 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D01, clk, enable);
164}
165
166static int s5pc1xx_clk_d02_ctrl(struct clk *clk, int enable)
167{
168 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D02, clk, enable);
169}
170
171static int s5pc1xx_clk_d10_ctrl(struct clk *clk, int enable)
172{
173 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D10, clk, enable);
174}
175
176static int s5pc1xx_clk_d11_ctrl(struct clk *clk, int enable)
177{
178 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D11, clk, enable);
179}
180
181static int s5pc1xx_clk_d12_ctrl(struct clk *clk, int enable)
182{
183 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D12, clk, enable);
184}
185
186static int s5pc1xx_clk_d13_ctrl(struct clk *clk, int enable)
187{
188 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D13, clk, enable);
189}
190
191static int s5pc1xx_clk_d14_ctrl(struct clk *clk, int enable)
192{
193 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D14, clk, enable);
194}
195
196static int s5pc1xx_clk_d15_ctrl(struct clk *clk, int enable)
197{
198 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D15, clk, enable);
199}
200
201static int s5pc1xx_clk_d20_ctrl(struct clk *clk, int enable)
202{
203 return s5pc1xx_clk_gate(S5PC100_CLKGATE_D20, clk, enable);
204}
205
206int s5pc1xx_sclk0_ctrl(struct clk *clk, int enable)
207{
208 return s5pc1xx_clk_gate(S5PC100_SCLKGATE0, clk, enable);
209}
210
211int s5pc1xx_sclk1_ctrl(struct clk *clk, int enable)
212{
213 return s5pc1xx_clk_gate(S5PC100_SCLKGATE1, clk, enable);
214}
215
216static struct clk init_clocks_disable[] = {
217 {
218 .name = "dsi",
219 .id = -1,
220 .parent = &clk_p,
221 .enable = s5pc1xx_clk_d11_ctrl,
222 .ctrlbit = S5PC100_CLKGATE_D11_DSI,
223 }, {
224 .name = "csi",
225 .id = -1,
226 .parent = &clk_h,
227 .enable = s5pc1xx_clk_d11_ctrl,
228 .ctrlbit = S5PC100_CLKGATE_D11_CSI,
229 }, {
230 .name = "ccan0",
231 .id = 0,
232 .parent = &clk_p,
233 .enable = s5pc1xx_clk_d14_ctrl,
234 .ctrlbit = S5PC100_CLKGATE_D14_CCAN0,
235 }, {
236 .name = "ccan1",
237 .id = 1,
238 .parent = &clk_p,
239 .enable = s5pc1xx_clk_d14_ctrl,
240 .ctrlbit = S5PC100_CLKGATE_D14_CCAN1,
241 }, {
242 .name = "keypad",
243 .id = -1,
244 .parent = &clk_p,
245 .enable = s5pc1xx_clk_d15_ctrl,
246 .ctrlbit = S5PC100_CLKGATE_D15_KEYIF,
247 }, {
248 .name = "hclkd2",
249 .id = -1,
250 .parent = NULL,
251 .enable = s5pc1xx_clk_d20_ctrl,
252 .ctrlbit = S5PC100_CLKGATE_D20_HCLKD2,
253 }, {
254 .name = "iis-d2",
255 .id = -1,
256 .parent = NULL,
257 .enable = s5pc1xx_clk_d20_ctrl,
258 .ctrlbit = S5PC100_CLKGATE_D20_I2SD2,
259 }, {
260 .name = "otg",
261 .id = -1,
262 .parent = &clk_h,
263 .enable = s5pc1xx_clk_d10_ctrl,
264 .ctrlbit = S5PC100_CLKGATE_D10_USBOTG,
265 },
266};
267
268static struct clk init_clocks[] = {
269 /* System1 (D0_0) devices */
270 {
271 .name = "intc",
272 .id = -1,
273 .parent = &clk_hd0,
274 .enable = s5pc1xx_clk_d00_ctrl,
275 .ctrlbit = S5PC100_CLKGATE_D00_INTC,
276 }, {
277 .name = "tzic",
278 .id = -1,
279 .parent = &clk_hd0,
280 .enable = s5pc1xx_clk_d00_ctrl,
281 .ctrlbit = S5PC100_CLKGATE_D00_TZIC,
282 }, {
283 .name = "cf-ata",
284 .id = -1,
285 .parent = &clk_hd0,
286 .enable = s5pc1xx_clk_d00_ctrl,
287 .ctrlbit = S5PC100_CLKGATE_D00_CFCON,
288 }, {
289 .name = "mdma",
290 .id = -1,
291 .parent = &clk_hd0,
292 .enable = s5pc1xx_clk_d00_ctrl,
293 .ctrlbit = S5PC100_CLKGATE_D00_MDMA,
294 }, {
295 .name = "g2d",
296 .id = -1,
297 .parent = &clk_hd0,
298 .enable = s5pc1xx_clk_d00_ctrl,
299 .ctrlbit = S5PC100_CLKGATE_D00_G2D,
300 }, {
301 .name = "secss",
302 .id = -1,
303 .parent = &clk_hd0,
304 .enable = s5pc1xx_clk_d00_ctrl,
305 .ctrlbit = S5PC100_CLKGATE_D00_SECSS,
306 }, {
307 .name = "cssys",
308 .id = -1,
309 .parent = &clk_hd0,
310 .enable = s5pc1xx_clk_d00_ctrl,
311 .ctrlbit = S5PC100_CLKGATE_D00_CSSYS,
312 },
313
314 /* Memory (D0_1) devices */
315 {
316 .name = "dmc",
317 .id = -1,
318 .parent = &clk_hd0,
319 .enable = s5pc1xx_clk_d01_ctrl,
320 .ctrlbit = S5PC100_CLKGATE_D01_DMC,
321 }, {
322 .name = "sromc",
323 .id = -1,
324 .parent = &clk_hd0,
325 .enable = s5pc1xx_clk_d01_ctrl,
326 .ctrlbit = S5PC100_CLKGATE_D01_SROMC,
327 }, {
328 .name = "onenand",
329 .id = -1,
330 .parent = &clk_hd0,
331 .enable = s5pc1xx_clk_d01_ctrl,
332 .ctrlbit = S5PC100_CLKGATE_D01_ONENAND,
333 }, {
334 .name = "nand",
335 .id = -1,
336 .parent = &clk_hd0,
337 .enable = s5pc1xx_clk_d01_ctrl,
338 .ctrlbit = S5PC100_CLKGATE_D01_NFCON,
339 }, {
340 .name = "intmem",
341 .id = -1,
342 .parent = &clk_hd0,
343 .enable = s5pc1xx_clk_d01_ctrl,
344 .ctrlbit = S5PC100_CLKGATE_D01_INTMEM,
345 }, {
346 .name = "ebi",
347 .id = -1,
348 .parent = &clk_hd0,
349 .enable = s5pc1xx_clk_d01_ctrl,
350 .ctrlbit = S5PC100_CLKGATE_D01_EBI,
351 },
352
353 /* System2 (D0_2) devices */
354 {
355 .name = "seckey",
356 .id = -1,
357 .parent = &clk_pd0,
358 .enable = s5pc1xx_clk_d02_ctrl,
359 .ctrlbit = S5PC100_CLKGATE_D02_SECKEY,
360 }, {
361 .name = "sdm",
362 .id = -1,
363 .parent = &clk_hd0,
364 .enable = s5pc1xx_clk_d02_ctrl,
365 .ctrlbit = S5PC100_CLKGATE_D02_SDM,
366 },
367
368 /* File (D1_0) devices */
369 {
370 .name = "pdma0",
371 .id = -1,
372 .parent = &clk_h,
373 .enable = s5pc1xx_clk_d10_ctrl,
374 .ctrlbit = S5PC100_CLKGATE_D10_PDMA0,
375 }, {
376 .name = "pdma1",
377 .id = -1,
378 .parent = &clk_h,
379 .enable = s5pc1xx_clk_d10_ctrl,
380 .ctrlbit = S5PC100_CLKGATE_D10_PDMA1,
381 }, {
382 .name = "usb-host",
383 .id = -1,
384 .parent = &clk_h,
385 .enable = s5pc1xx_clk_d10_ctrl,
386 .ctrlbit = S5PC100_CLKGATE_D10_USBHOST,
387 }, {
388 .name = "modem",
389 .id = -1,
390 .parent = &clk_h,
391 .enable = s5pc1xx_clk_d10_ctrl,
392 .ctrlbit = S5PC100_CLKGATE_D10_MODEMIF,
393 }, {
394 .name = "hsmmc",
395 .id = 0,
396 .parent = &clk_h,
397 .enable = s5pc1xx_clk_d10_ctrl,
398 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC0,
399 }, {
400 .name = "hsmmc",
401 .id = 1,
402 .parent = &clk_h,
403 .enable = s5pc1xx_clk_d10_ctrl,
404 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC1,
405 }, {
406 .name = "hsmmc",
407 .id = 2,
408 .parent = &clk_h,
409 .enable = s5pc1xx_clk_d10_ctrl,
410 .ctrlbit = S5PC100_CLKGATE_D10_HSMMC2,
411 },
412
413 /* Multimedia1 (D1_1) devices */
414 {
415 .name = "lcd",
416 .id = -1,
417 .parent = &clk_h,
418 .enable = s5pc1xx_clk_d11_ctrl,
419 .ctrlbit = S5PC100_CLKGATE_D11_LCD,
420 }, {
421 .name = "rotator",
422 .id = -1,
423 .parent = &clk_h,
424 .enable = s5pc1xx_clk_d11_ctrl,
425 .ctrlbit = S5PC100_CLKGATE_D11_ROTATOR,
426 }, {
427 .name = "fimc",
428 .id = 0,
429 .parent = &clk_h,
430 .enable = s5pc1xx_clk_d11_ctrl,
431 .ctrlbit = S5PC100_CLKGATE_D11_FIMC0,
432 }, {
433 .name = "fimc",
434 .id = 1,
435 .parent = &clk_h,
436 .enable = s5pc1xx_clk_d11_ctrl,
437 .ctrlbit = S5PC100_CLKGATE_D11_FIMC1,
438 }, {
439 .name = "fimc",
440 .id = 2,
441 .parent = &clk_h,
442 .enable = s5pc1xx_clk_d11_ctrl,
443 .ctrlbit = S5PC100_CLKGATE_D11_FIMC2,
444 }, {
445 .name = "jpeg",
446 .id = -1,
447 .parent = &clk_h,
448 .enable = s5pc1xx_clk_d11_ctrl,
449 .ctrlbit = S5PC100_CLKGATE_D11_JPEG,
450 }, {
451 .name = "g3d",
452 .id = -1,
453 .parent = &clk_h,
454 .enable = s5pc1xx_clk_d11_ctrl,
455 .ctrlbit = S5PC100_CLKGATE_D11_G3D,
456 },
457
458 /* Multimedia2 (D1_2) devices */
459 {
460 .name = "tv",
461 .id = -1,
462 .parent = &clk_h,
463 .enable = s5pc1xx_clk_d12_ctrl,
464 .ctrlbit = S5PC100_CLKGATE_D12_TV,
465 }, {
466 .name = "vp",
467 .id = -1,
468 .parent = &clk_h,
469 .enable = s5pc1xx_clk_d12_ctrl,
470 .ctrlbit = S5PC100_CLKGATE_D12_VP,
471 }, {
472 .name = "mixer",
473 .id = -1,
474 .parent = &clk_h,
475 .enable = s5pc1xx_clk_d12_ctrl,
476 .ctrlbit = S5PC100_CLKGATE_D12_MIXER,
477 }, {
478 .name = "hdmi",
479 .id = -1,
480 .parent = &clk_h,
481 .enable = s5pc1xx_clk_d12_ctrl,
482 .ctrlbit = S5PC100_CLKGATE_D12_HDMI,
483 }, {
484 .name = "mfc",
485 .id = -1,
486 .parent = &clk_h,
487 .enable = s5pc1xx_clk_d12_ctrl,
488 .ctrlbit = S5PC100_CLKGATE_D12_MFC,
489 },
490
491 /* System (D1_3) devices */
492 {
493 .name = "chipid",
494 .id = -1,
495 .parent = &clk_p,
496 .enable = s5pc1xx_clk_d13_ctrl,
497 .ctrlbit = S5PC100_CLKGATE_D13_CHIPID,
498 }, {
499 .name = "gpio",
500 .id = -1,
501 .parent = &clk_p,
502 .enable = s5pc1xx_clk_d13_ctrl,
503 .ctrlbit = S5PC100_CLKGATE_D13_GPIO,
504 }, {
505 .name = "apc",
506 .id = -1,
507 .parent = &clk_p,
508 .enable = s5pc1xx_clk_d13_ctrl,
509 .ctrlbit = S5PC100_CLKGATE_D13_APC,
510 }, {
511 .name = "iec",
512 .id = -1,
513 .parent = &clk_p,
514 .enable = s5pc1xx_clk_d13_ctrl,
515 .ctrlbit = S5PC100_CLKGATE_D13_IEC,
516 }, {
517 .name = "timers",
518 .id = -1,
519 .parent = &clk_p,
520 .enable = s5pc1xx_clk_d13_ctrl,
521 .ctrlbit = S5PC100_CLKGATE_D13_PWM,
522 }, {
523 .name = "systimer",
524 .id = -1,
525 .parent = &clk_p,
526 .enable = s5pc1xx_clk_d13_ctrl,
527 .ctrlbit = S5PC100_CLKGATE_D13_SYSTIMER,
528 }, {
529 .name = "watchdog",
530 .id = -1,
531 .parent = &clk_p,
532 .enable = s5pc1xx_clk_d13_ctrl,
533 .ctrlbit = S5PC100_CLKGATE_D13_WDT,
534 }, {
535 .name = "rtc",
536 .id = -1,
537 .parent = &clk_p,
538 .enable = s5pc1xx_clk_d13_ctrl,
539 .ctrlbit = S5PC100_CLKGATE_D13_RTC,
540 },
541
542 /* Connectivity (D1_4) devices */
543 {
544 .name = "uart",
545 .id = 0,
546 .parent = &clk_p,
547 .enable = s5pc1xx_clk_d14_ctrl,
548 .ctrlbit = S5PC100_CLKGATE_D14_UART0,
549 }, {
550 .name = "uart",
551 .id = 1,
552 .parent = &clk_p,
553 .enable = s5pc1xx_clk_d14_ctrl,
554 .ctrlbit = S5PC100_CLKGATE_D14_UART1,
555 }, {
556 .name = "uart",
557 .id = 2,
558 .parent = &clk_p,
559 .enable = s5pc1xx_clk_d14_ctrl,
560 .ctrlbit = S5PC100_CLKGATE_D14_UART2,
561 }, {
562 .name = "uart",
563 .id = 3,
564 .parent = &clk_p,
565 .enable = s5pc1xx_clk_d14_ctrl,
566 .ctrlbit = S5PC100_CLKGATE_D14_UART3,
567 }, {
568 .name = "i2c",
569 .id = -1,
570 .parent = &clk_p,
571 .enable = s5pc1xx_clk_d14_ctrl,
572 .ctrlbit = S5PC100_CLKGATE_D14_IIC,
573 }, {
574 .name = "hdmi-i2c",
575 .id = -1,
576 .parent = &clk_p,
577 .enable = s5pc1xx_clk_d14_ctrl,
578 .ctrlbit = S5PC100_CLKGATE_D14_HDMI_IIC,
579 }, {
580 .name = "spi",
581 .id = 0,
582 .parent = &clk_p,
583 .enable = s5pc1xx_clk_d14_ctrl,
584 .ctrlbit = S5PC100_CLKGATE_D14_SPI0,
585 }, {
586 .name = "spi",
587 .id = 1,
588 .parent = &clk_p,
589 .enable = s5pc1xx_clk_d14_ctrl,
590 .ctrlbit = S5PC100_CLKGATE_D14_SPI1,
591 }, {
592 .name = "spi",
593 .id = 2,
594 .parent = &clk_p,
595 .enable = s5pc1xx_clk_d14_ctrl,
596 .ctrlbit = S5PC100_CLKGATE_D14_SPI2,
597 }, {
598 .name = "irda",
599 .id = -1,
600 .parent = &clk_p,
601 .enable = s5pc1xx_clk_d14_ctrl,
602 .ctrlbit = S5PC100_CLKGATE_D14_IRDA,
603 }, {
604 .name = "hsitx",
605 .id = -1,
606 .parent = &clk_p,
607 .enable = s5pc1xx_clk_d14_ctrl,
608 .ctrlbit = S5PC100_CLKGATE_D14_HSITX,
609 }, {
610 .name = "hsirx",
611 .id = -1,
612 .parent = &clk_p,
613 .enable = s5pc1xx_clk_d14_ctrl,
614 .ctrlbit = S5PC100_CLKGATE_D14_HSIRX,
615 },
616
617 /* Audio (D1_5) devices */
618 {
619 .name = "iis",
620 .id = 0,
621 .parent = &clk_p,
622 .enable = s5pc1xx_clk_d15_ctrl,
623 .ctrlbit = S5PC100_CLKGATE_D15_IIS0,
624 }, {
625 .name = "iis",
626 .id = 1,
627 .parent = &clk_p,
628 .enable = s5pc1xx_clk_d15_ctrl,
629 .ctrlbit = S5PC100_CLKGATE_D15_IIS1,
630 }, {
631 .name = "iis",
632 .id = 2,
633 .parent = &clk_p,
634 .enable = s5pc1xx_clk_d15_ctrl,
635 .ctrlbit = S5PC100_CLKGATE_D15_IIS2,
636 }, {
637 .name = "ac97",
638 .id = -1,
639 .parent = &clk_p,
640 .enable = s5pc1xx_clk_d15_ctrl,
641 .ctrlbit = S5PC100_CLKGATE_D15_AC97,
642 }, {
643 .name = "pcm",
644 .id = 0,
645 .parent = &clk_p,
646 .enable = s5pc1xx_clk_d15_ctrl,
647 .ctrlbit = S5PC100_CLKGATE_D15_PCM0,
648 }, {
649 .name = "pcm",
650 .id = 1,
651 .parent = &clk_p,
652 .enable = s5pc1xx_clk_d15_ctrl,
653 .ctrlbit = S5PC100_CLKGATE_D15_PCM1,
654 }, {
655 .name = "spdif",
656 .id = -1,
657 .parent = &clk_p,
658 .enable = s5pc1xx_clk_d15_ctrl,
659 .ctrlbit = S5PC100_CLKGATE_D15_SPDIF,
660 }, {
661 .name = "adc",
662 .id = -1,
663 .parent = &clk_p,
664 .enable = s5pc1xx_clk_d15_ctrl,
665 .ctrlbit = S5PC100_CLKGATE_D15_TSADC,
666 }, {
667 .name = "keyif",
668 .id = -1,
669 .parent = &clk_p,
670 .enable = s5pc1xx_clk_d15_ctrl,
671 .ctrlbit = S5PC100_CLKGATE_D15_KEYIF,
672 }, {
673 .name = "cg",
674 .id = -1,
675 .parent = &clk_p,
676 .enable = s5pc1xx_clk_d15_ctrl,
677 .ctrlbit = S5PC100_CLKGATE_D15_CG,
678 },
679
680 /* Audio (D2_0) devices: all disabled */
681
682 /* Special Clocks 1 */
683 {
684 .name = "sclk_hpm",
685 .id = -1,
686 .parent = NULL,
687 .enable = s5pc1xx_sclk0_ctrl,
688 .ctrlbit = S5PC1XX_CLKGATE_SCLK0_HPM,
689 }, {
690 .name = "sclk_onenand",
691 .id = -1,
692 .parent = NULL,
693 .enable = s5pc1xx_sclk0_ctrl,
694 .ctrlbit = S5PC100_CLKGATE_SCLK0_ONENAND,
695 }, {
696 .name = "sclk_spi_48",
697 .id = 0,
698 .parent = &clk_48m,
699 .enable = s5pc1xx_sclk0_ctrl,
700 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI0_48,
701 }, {
702 .name = "sclk_spi_48",
703 .id = 1,
704 .parent = &clk_48m,
705 .enable = s5pc1xx_sclk0_ctrl,
706 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI1_48,
707 }, {
708 .name = "sclk_spi_48",
709 .id = 2,
710 .parent = &clk_48m,
711 .enable = s5pc1xx_sclk0_ctrl,
712 .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI2_48,
713 }, {
714 .name = "sclk_mmc_48",
715 .id = 0,
716 .parent = &clk_48m,
717 .enable = s5pc1xx_sclk0_ctrl,
718 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC0_48,
719 }, {
720 .name = "sclk_mmc_48",
721 .id = 1,
722 .parent = &clk_48m,
723 .enable = s5pc1xx_sclk0_ctrl,
724 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC1_48,
725 }, {
726 .name = "sclk_mmc_48",
727 .id = 2,
728 .parent = &clk_48m,
729 .enable = s5pc1xx_sclk0_ctrl,
730 .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC2_48,
731 },
732
733 /* Special Clocks 2 */
734 {
735 .name = "sclk_tv_54",
736 .id = -1,
737 .parent = &clk_54m,
738 .enable = s5pc1xx_sclk1_ctrl,
739 .ctrlbit = S5PC100_CLKGATE_SCLK1_TV54,
740 }, {
741 .name = "sclk_vdac_54",
742 .id = -1,
743 .parent = &clk_54m,
744 .enable = s5pc1xx_sclk1_ctrl,
745 .ctrlbit = S5PC100_CLKGATE_SCLK1_VDAC54,
746 }, {
747 .name = "sclk_spdif",
748 .id = -1,
749 .parent = NULL,
750 .enable = s5pc1xx_sclk1_ctrl,
751 .ctrlbit = S5PC100_CLKGATE_SCLK1_SPDIF,
752 },
753};
754
755void __init s5pc1xx_register_clocks(void)
756{
757 struct clk *clkp;
758 int ret;
759 int ptr;
760
761 clkp = init_clocks;
762 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
763 ret = s3c24xx_register_clock(clkp);
764 if (ret < 0) {
765 printk(KERN_ERR "Failed to register clock %s (%d)\n",
766 clkp->name, ret);
767 }
768 }
769
770 clkp = init_clocks_disable;
771 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
772
773 ret = s3c24xx_register_clock(clkp);
774 if (ret < 0) {
775 printk(KERN_ERR "Failed to register clock %s (%d)\n",
776 clkp->name, ret);
777 }
778
779 (clkp->enable)(clkp, 0);
780 }
781
782 s3c_pwmclk_init();
783}
784static struct clk clk_fout_apll = {
785 .name = "fout_apll",
786 .id = -1,
787};
788
789static struct clk *clk_src_apll_list[] = {
790 [0] = &clk_fin_apll,
791 [1] = &clk_fout_apll,
792};
793
794static struct clk_sources clk_src_apll = {
795 .sources = clk_src_apll_list,
796 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
797};
798
799static struct clksrc_clk clk_mout_apll = {
800 .clk = {
801 .name = "mout_apll",
802 .id = -1,
803 },
804 .shift = S5PC1XX_CLKSRC0_APLL_SHIFT,
805 .mask = S5PC1XX_CLKSRC0_APLL_MASK,
806 .sources = &clk_src_apll,
807 .reg_source = S5PC1XX_CLK_SRC0,
808};
809
810static struct clk clk_fout_epll = {
811 .name = "fout_epll",
812 .id = -1,
813};
814
815static struct clk *clk_src_epll_list[] = {
816 [0] = &clk_fin_epll,
817 [1] = &clk_fout_epll,
818};
819
820static struct clk_sources clk_src_epll = {
821 .sources = clk_src_epll_list,
822 .nr_sources = ARRAY_SIZE(clk_src_epll_list),
823};
824
825static struct clksrc_clk clk_mout_epll = {
826 .clk = {
827 .name = "mout_epll",
828 .id = -1,
829 },
830 .shift = S5PC1XX_CLKSRC0_EPLL_SHIFT,
831 .mask = S5PC1XX_CLKSRC0_EPLL_MASK,
832 .sources = &clk_src_epll,
833 .reg_source = S5PC1XX_CLK_SRC0,
834};
835
836static struct clk *clk_src_mpll_list[] = {
837 [0] = &clk_fin_mpll,
838 [1] = &clk_fout_mpll,
839};
840
841static struct clk_sources clk_src_mpll = {
842 .sources = clk_src_mpll_list,
843 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
844};
845
846static struct clksrc_clk clk_mout_mpll = {
847 .clk = {
848 .name = "mout_mpll",
849 .id = -1,
850 },
851 .shift = S5PC1XX_CLKSRC0_MPLL_SHIFT,
852 .mask = S5PC1XX_CLKSRC0_MPLL_MASK,
853 .sources = &clk_src_mpll,
854 .reg_source = S5PC1XX_CLK_SRC0,
855};
856
857static unsigned long s5pc1xx_clk_doutmpll_get_rate(struct clk *clk)
858{
859 unsigned long rate = clk_get_rate(clk->parent);
860 unsigned long clkdiv;
861
862 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
863
864 clkdiv = __raw_readl(S5PC1XX_CLK_DIV1) & S5PC100_CLKDIV1_MPLL_MASK;
865 rate /= (clkdiv >> S5PC100_CLKDIV1_MPLL_SHIFT) + 1;
866
867 return rate;
868}
869
870static struct clk clk_dout_mpll = {
871 .name = "dout_mpll",
872 .id = -1,
873 .parent = &clk_mout_mpll.clk,
874 .get_rate = s5pc1xx_clk_doutmpll_get_rate,
875};
876
877static unsigned long s5pc1xx_clk_doutmpll2_get_rate(struct clk *clk)
878{
879 unsigned long rate = clk_get_rate(clk->parent);
880 unsigned long clkdiv;
881
882 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
883
884 clkdiv = __raw_readl(S5PC1XX_CLK_DIV1) & S5PC100_CLKDIV1_MPLL2_MASK;
885 rate /= (clkdiv >> S5PC100_CLKDIV1_MPLL2_SHIFT) + 1;
886
887 return rate;
888}
889
890struct clk clk_dout_mpll2 = {
891 .name = "dout_mpll2",
892 .id = -1,
893 .parent = &clk_mout_mpll.clk,
894 .get_rate = s5pc1xx_clk_doutmpll2_get_rate,
895};
896
897static struct clk *clkset_uart_list[] = {
898 &clk_mout_epll.clk,
899 &clk_dout_mpll,
900 NULL,
901 NULL
902};
903
904static struct clk_sources clkset_uart = {
905 .sources = clkset_uart_list,
906 .nr_sources = ARRAY_SIZE(clkset_uart_list),
907};
908
909static inline struct clksrc_clk *to_clksrc(struct clk *clk)
910{
911 return container_of(clk, struct clksrc_clk, clk);
912}
913
914static unsigned long s5pc1xx_getrate_clksrc(struct clk *clk)
915{
916 struct clksrc_clk *sclk = to_clksrc(clk);
917 unsigned long rate = clk_get_rate(clk->parent);
918 u32 clkdiv = __raw_readl(sclk->reg_divider);
919
920 clkdiv >>= sclk->divider_shift;
921 clkdiv &= 0xf;
922 clkdiv++;
923
924 rate /= clkdiv;
925 return rate;
926}
927
928static int s5pc1xx_setrate_clksrc(struct clk *clk, unsigned long rate)
929{
930 struct clksrc_clk *sclk = to_clksrc(clk);
931 void __iomem *reg = sclk->reg_divider;
932 unsigned int div;
933 u32 val;
934
935 rate = clk_round_rate(clk, rate);
936 div = clk_get_rate(clk->parent) / rate;
937 if (div > 16)
938 return -EINVAL;
939
940 val = __raw_readl(reg);
941 val &= ~(0xf << sclk->shift);
942 val |= (div - 1) << sclk->shift;
943 __raw_writel(val, reg);
944
945 return 0;
946}
947
948static int s5pc1xx_setparent_clksrc(struct clk *clk, struct clk *parent)
949{
950 struct clksrc_clk *sclk = to_clksrc(clk);
951 struct clk_sources *srcs = sclk->sources;
952 u32 clksrc = __raw_readl(sclk->reg_source);
953 int src_nr = -1;
954 int ptr;
955
956 for (ptr = 0; ptr < srcs->nr_sources; ptr++)
957 if (srcs->sources[ptr] == parent) {
958 src_nr = ptr;
959 break;
960 }
961
962 if (src_nr >= 0) {
963 clksrc &= ~sclk->mask;
964 clksrc |= src_nr << sclk->shift;
965
966 __raw_writel(clksrc, sclk->reg_source);
967 return 0;
968 }
969
970 return -EINVAL;
971}
972
973static unsigned long s5pc1xx_roundrate_clksrc(struct clk *clk,
974 unsigned long rate)
975{
976 unsigned long parent_rate = clk_get_rate(clk->parent);
977 int div;
978
979 if (rate > parent_rate)
980 rate = parent_rate;
981 else {
982 div = rate / parent_rate;
983
984 if (div == 0)
985 div = 1;
986 if (div > 16)
987 div = 16;
988
989 rate = parent_rate / div;
990 }
991
992 return rate;
993}
994
995static struct clksrc_clk clk_uart_uclk1 = {
996 .clk = {
997 .name = "uclk1",
998 .id = -1,
999 .ctrlbit = S5PC100_CLKGATE_SCLK0_UART,
1000 .enable = s5pc1xx_sclk0_ctrl,
1001 .set_parent = s5pc1xx_setparent_clksrc,
1002 .get_rate = s5pc1xx_getrate_clksrc,
1003 .set_rate = s5pc1xx_setrate_clksrc,
1004 .round_rate = s5pc1xx_roundrate_clksrc,
1005 },
1006 .shift = S5PC100_CLKSRC1_UART_SHIFT,
1007 .mask = S5PC100_CLKSRC1_UART_MASK,
1008 .sources = &clkset_uart,
1009 .divider_shift = S5PC100_CLKDIV2_UART_SHIFT,
1010 .reg_divider = S5PC1XX_CLK_DIV2,
1011 .reg_source = S5PC1XX_CLK_SRC1,
1012};
1013
1014/* Clock initialisation code */
1015
1016static struct clksrc_clk *init_parents[] = {
1017 &clk_mout_apll,
1018 &clk_mout_epll,
1019 &clk_mout_mpll,
1020 &clk_uart_uclk1,
1021};
1022
1023static void __init_or_cpufreq s5pc1xx_set_clksrc(struct clksrc_clk *clk)
1024{
1025 struct clk_sources *srcs = clk->sources;
1026 u32 clksrc = __raw_readl(clk->reg_source);
1027
1028 clksrc &= clk->mask;
1029 clksrc >>= clk->shift;
1030
1031 if (clksrc > srcs->nr_sources || !srcs->sources[clksrc]) {
1032 printk(KERN_ERR "%s: bad source %d\n",
1033 clk->clk.name, clksrc);
1034 return;
1035 }
1036
1037 clk->clk.parent = srcs->sources[clksrc];
1038
1039 printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n",
1040 clk->clk.name, clk->clk.parent->name, clksrc,
1041 clk_get_rate(&clk->clk));
1042}
1043
1044#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
1045
1046void __init_or_cpufreq s5pc100_setup_clocks(void)
1047{
1048 struct clk *xtal_clk;
1049 unsigned long xtal;
1050 unsigned long armclk;
1051 unsigned long hclkd0;
1052 unsigned long hclk;
1053 unsigned long pclkd0;
1054 unsigned long pclk;
1055 unsigned long apll;
1056 unsigned long mpll;
1057 unsigned long hpll;
1058 unsigned long epll;
1059 unsigned int ptr;
1060 u32 clkdiv0, clkdiv1;
1061
1062 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1063
1064 clkdiv0 = __raw_readl(S5PC1XX_CLK_DIV0);
1065 clkdiv1 = __raw_readl(S5PC1XX_CLK_DIV1);
1066
1067 printk(KERN_DEBUG "%s: clkdiv0 = %08x, clkdiv1 = %08x\n",
1068 __func__, clkdiv0, clkdiv1);
1069
1070 xtal_clk = clk_get(NULL, "xtal");
1071 BUG_ON(IS_ERR(xtal_clk));
1072
1073 xtal = clk_get_rate(xtal_clk);
1074 clk_put(xtal_clk);
1075
1076 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1077
1078 apll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC1XX_APLL_CON));
1079 mpll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC1XX_MPLL_CON));
1080 epll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC1XX_EPLL_CON));
1081 hpll = s5pc1xx_get_pll(xtal, __raw_readl(S5PC100_HPLL_CON));
1082
1083 printk(KERN_INFO "S5PC100: PLL settings, A=%ld, M=%ld, E=%ld, H=%ld\n",
1084 apll, mpll, epll, hpll);
1085
1086 armclk = apll / GET_DIV(clkdiv0, S5PC1XX_CLKDIV0_APLL);
1087 armclk = armclk / GET_DIV(clkdiv0, S5PC100_CLKDIV0_ARM);
1088 hclkd0 = armclk / GET_DIV(clkdiv0, S5PC100_CLKDIV0_D0);
1089 pclkd0 = hclkd0 / GET_DIV(clkdiv0, S5PC100_CLKDIV0_PCLKD0);
1090 hclk = mpll / GET_DIV(clkdiv1, S5PC100_CLKDIV1_D1);
1091 pclk = hclk / GET_DIV(clkdiv1, S5PC100_CLKDIV1_PCLKD1);
1092
1093 printk(KERN_INFO "S5PC100: ARMCLK=%ld, HCLKD0=%ld, PCLKD0=%ld, HCLK=%ld, PCLK=%ld\n",
1094 armclk, hclkd0, pclkd0, hclk, pclk);
1095
1096 clk_fout_apll.rate = apll;
1097 clk_fout_mpll.rate = mpll;
1098 clk_fout_epll.rate = epll;
1099 clk_fout_apll.rate = apll;
1100
1101 clk_h.rate = hclk;
1102 clk_p.rate = pclk;
1103
1104 for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++)
1105 s5pc1xx_set_clksrc(init_parents[ptr]);
1106}
1107
1108static struct clk *clks[] __initdata = {
1109 &clk_ext_xtal_mux,
1110 &clk_mout_epll.clk,
1111 &clk_fout_epll,
1112 &clk_mout_mpll.clk,
1113 &clk_dout_mpll,
1114 &clk_uart_uclk1.clk,
1115 &clk_ext,
1116 &clk_epll,
1117 &clk_27m,
1118 &clk_48m,
1119 &clk_54m,
1120};
1121
1122void __init s5pc100_register_clocks(void)
1123{
1124 struct clk *clkp;
1125 int ret;
1126 int ptr;
1127
1128 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
1129 clkp = clks[ptr];
1130 ret = s3c24xx_register_clock(clkp);
1131 if (ret < 0) {
1132 printk(KERN_ERR "Failed to register clock %s (%d)\n",
1133 clkp->name, ret);
1134 }
1135 }
1136
1137 clk_mpll.parent = &clk_mout_mpll.clk;
1138 clk_epll.parent = &clk_mout_epll.clk;
1139}
diff --git a/arch/arm/plat-s5pc1xx/s5pc100-init.c b/arch/arm/plat-s5pc1xx/s5pc100-init.c
new file mode 100644
index 000000000000..c58710884ceb
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/s5pc100-init.c
@@ -0,0 +1,27 @@
1/* linux/arch/arm/plat-s5pc1xx/s5pc100-init.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - CPU initialisation (common with other S5PC1XX chips)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/init.h>
16
17#include <plat/cpu.h>
18#include <plat/devs.h>
19#include <plat/s5pc100.h>
20
21/* uart registration process */
22
23void __init s5pc100_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
24{
25 /* The driver name is s3c6400-uart to reuse s3c6400_serial_drv */
26 s3c24xx_init_uartdevs("s3c6400-uart", s5pc1xx_uart_resources, cfg, no);
27}
diff --git a/arch/arm/plat-s5pc1xx/setup-i2c0.c b/arch/arm/plat-s5pc1xx/setup-i2c0.c
new file mode 100644
index 000000000000..3d00c025fffb
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/setup-i2c0.c
@@ -0,0 +1,25 @@
1/* linux/arch/arm/plat-s5pc1xx/setup-i2c0.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Base S5PC1XX I2C bus 0 gpio configuration
7 *
8 * Based on plat-s3c64xx/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17
18struct platform_device; /* don't need the contents */
19
20#include <plat/iic.h>
21
22void s3c_i2c0_cfg_gpio(struct platform_device *dev)
23{
24 /* Pin configuration would be needed */
25}
diff --git a/arch/arm/plat-s5pc1xx/setup-i2c1.c b/arch/arm/plat-s5pc1xx/setup-i2c1.c
new file mode 100644
index 000000000000..c8f3ca42f51d
--- /dev/null
+++ b/arch/arm/plat-s5pc1xx/setup-i2c1.c
@@ -0,0 +1,25 @@
1/* linux/arch/arm/plat-s3c64xx/setup-i2c1.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Base S5PC1XX I2C bus 1 gpio configuration
7 *
8 * Based on plat-s3c64xx/setup-i2c1.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17
18struct platform_device; /* don't need the contents */
19
20#include <plat/iic.h>
21
22void s3c_i2c1_cfg_gpio(struct platform_device *dev)
23{
24 /* Pin configuration would be needed */
25}
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index a2bed62aec21..4fa9903b83cf 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -42,6 +42,7 @@ ENTRY(vfp_null_entry)
42 mov pc, lr 42 mov pc, lr
43ENDPROC(vfp_null_entry) 43ENDPROC(vfp_null_entry)
44 44
45 .align 2
45.LCvfp: 46.LCvfp:
46 .word vfp_vector 47 .word vfp_vector
47 48
@@ -61,6 +62,7 @@ ENTRY(vfp_testing_entry)
61 mov pc, r9 @ we have handled the fault 62 mov pc, r9 @ we have handled the fault
62ENDPROC(vfp_testing_entry) 63ENDPROC(vfp_testing_entry)
63 64
65 .align 2
64VFP_arch_address: 66VFP_arch_address:
65 .word VFP_arch 67 .word VFP_arch
66 68
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index 1aeae38725dd..66dc2d03b7fc 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -209,40 +209,55 @@ ENDPROC(vfp_save_state)
209last_VFP_context_address: 209last_VFP_context_address:
210 .word last_VFP_context 210 .word last_VFP_context
211 211
212ENTRY(vfp_get_float) 212 .macro tbl_branch, base, tmp, shift
213 add pc, pc, r0, lsl #3 213#ifdef CONFIG_THUMB2_KERNEL
214 adr \tmp, 1f
215 add \tmp, \tmp, \base, lsl \shift
216 mov pc, \tmp
217#else
218 add pc, pc, \base, lsl \shift
214 mov r0, r0 219 mov r0, r0
220#endif
2211:
222 .endm
223
224ENTRY(vfp_get_float)
225 tbl_branch r0, r3, #3
215 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 226 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
216 mrc p10, 0, r0, c\dr, c0, 0 @ fmrs r0, s0 2271: mrc p10, 0, r0, c\dr, c0, 0 @ fmrs r0, s0
217 mov pc, lr 228 mov pc, lr
218 mrc p10, 0, r0, c\dr, c0, 4 @ fmrs r0, s1 229 .org 1b + 8
2301: mrc p10, 0, r0, c\dr, c0, 4 @ fmrs r0, s1
219 mov pc, lr 231 mov pc, lr
232 .org 1b + 8
220 .endr 233 .endr
221ENDPROC(vfp_get_float) 234ENDPROC(vfp_get_float)
222 235
223ENTRY(vfp_put_float) 236ENTRY(vfp_put_float)
224 add pc, pc, r1, lsl #3 237 tbl_branch r1, r3, #3
225 mov r0, r0
226 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 238 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
227 mcr p10, 0, r0, c\dr, c0, 0 @ fmsr r0, s0 2391: mcr p10, 0, r0, c\dr, c0, 0 @ fmsr r0, s0
228 mov pc, lr 240 mov pc, lr
229 mcr p10, 0, r0, c\dr, c0, 4 @ fmsr r0, s1 241 .org 1b + 8
2421: mcr p10, 0, r0, c\dr, c0, 4 @ fmsr r0, s1
230 mov pc, lr 243 mov pc, lr
244 .org 1b + 8
231 .endr 245 .endr
232ENDPROC(vfp_put_float) 246ENDPROC(vfp_put_float)
233 247
234ENTRY(vfp_get_double) 248ENTRY(vfp_get_double)
235 add pc, pc, r0, lsl #3 249 tbl_branch r0, r3, #3
236 mov r0, r0
237 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 250 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
238 fmrrd r0, r1, d\dr 2511: fmrrd r0, r1, d\dr
239 mov pc, lr 252 mov pc, lr
253 .org 1b + 8
240 .endr 254 .endr
241#ifdef CONFIG_VFPv3 255#ifdef CONFIG_VFPv3
242 @ d16 - d31 registers 256 @ d16 - d31 registers
243 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 257 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
244 mrrc p11, 3, r0, r1, c\dr @ fmrrd r0, r1, d\dr 2581: mrrc p11, 3, r0, r1, c\dr @ fmrrd r0, r1, d\dr
245 mov pc, lr 259 mov pc, lr
260 .org 1b + 8
246 .endr 261 .endr
247#endif 262#endif
248 263
@@ -253,17 +268,18 @@ ENTRY(vfp_get_double)
253ENDPROC(vfp_get_double) 268ENDPROC(vfp_get_double)
254 269
255ENTRY(vfp_put_double) 270ENTRY(vfp_put_double)
256 add pc, pc, r2, lsl #3 271 tbl_branch r2, r3, #3
257 mov r0, r0
258 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 272 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
259 fmdrr d\dr, r0, r1 2731: fmdrr d\dr, r0, r1
260 mov pc, lr 274 mov pc, lr
275 .org 1b + 8
261 .endr 276 .endr
262#ifdef CONFIG_VFPv3 277#ifdef CONFIG_VFPv3
263 @ d16 - d31 registers 278 @ d16 - d31 registers
264 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 279 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
265 mcrr p11, 3, r1, r2, c\dr @ fmdrr r1, r2, d\dr 2801: mcrr p11, 3, r1, r2, c\dr @ fmdrr r1, r2, d\dr
266 mov pc, lr 281 mov pc, lr
282 .org 1b + 8
267 .endr 283 .endr
268#endif 284#endif
269ENDPROC(vfp_put_double) 285ENDPROC(vfp_put_double)