aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-10-19 17:06:36 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-10-19 17:06:36 -0400
commit809b4e00baf006a990a73329ba381d536c6fa277 (patch)
treee949e0efd019d6f932537aba762792b07a84351c
parenta0a55682b83fd5f012afadcf415b030d7424ae68 (diff)
parent79a94c3538bda6869d7bb150b5e02dd3a72314dd (diff)
Merge branch 'devel-stable' into devel
-rw-r--r--CREDITS8
-rw-r--r--Documentation/arm/00-INDEX2
-rw-r--r--Documentation/arm/msm/gpiomux.txt176
-rw-r--r--Documentation/networking/e1000.txt373
-rw-r--r--Documentation/networking/e1000e.txt302
-rw-r--r--[-rwxr-xr-x]Documentation/networking/ixgbevf.txt40
-rw-r--r--Documentation/vm/page-types.c2
-rw-r--r--MAINTAINERS64
-rw-r--r--Makefile4
-rw-r--r--arch/alpha/kernel/signal.c2
-rw-r--r--arch/arm/Kconfig52
-rw-r--r--arch/arm/Kconfig.debug14
-rw-r--r--arch/arm/Makefile11
-rw-r--r--arch/arm/common/gic.c14
-rw-r--r--arch/arm/configs/at91sam9g20ek_defconfig1
-rw-r--r--arch/arm/configs/kirkwood_defconfig1
-rw-r--r--arch/arm/configs/mx27_defconfig15
-rw-r--r--arch/arm/configs/mx31pdk_defconfig44
-rw-r--r--arch/arm/configs/mx3_defconfig2
-rw-r--r--arch/arm/configs/mx51_defconfig9
-rw-r--r--arch/arm/configs/s5p64x0_defconfig (renamed from arch/arm/configs/s5p6440_defconfig)3
-rw-r--r--arch/arm/include/asm/elf.h4
-rw-r--r--arch/arm/include/asm/io.h1
-rw-r--r--arch/arm/include/asm/mmu_context.h29
-rw-r--r--arch/arm/include/asm/seccomp.h11
-rw-r--r--arch/arm/include/asm/thread_info.h2
-rw-r--r--arch/arm/kernel/entry-common.S15
-rw-r--r--arch/arm/kernel/kprobes-decode.c7
-rw-r--r--arch/arm/kernel/process.c21
-rw-r--r--arch/arm/mach-aaec2000/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-at91/Kconfig9
-rw-r--r--arch/arm/mach-at91/Makefile3
-rw-r--r--arch/arm/mach-at91/board-at572d940hf_ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c329
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c74
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c4
-rw-r--r--arch/arm/mach-at91/include/mach/at91x40.h6
-rw-r--r--arch/arm/mach-at91/include/mach/system.h11
-rw-r--r--arch/arm/mach-bcmring/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-clps711x/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-ebsa110/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-ep93xx/dma-m2p.c2
-rw-r--r--arch/arm/mach-footbridge/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-h720x/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-imx/Kconfig15
-rw-r--r--arch/arm/mach-imx/Makefile1
-rw-r--r--arch/arm/mach-imx/clock-imx1.c2
-rw-r--r--arch/arm/mach-imx/clock-imx21.c6
-rw-r--r--arch/arm/mach-imx/clock-imx27.c48
-rw-r--r--arch/arm/mach-imx/devices-imx1.h14
-rw-r--r--arch/arm/mach-imx/devices-imx21.h36
-rw-r--r--arch/arm/mach-imx/devices-imx27.h51
-rw-r--r--arch/arm/mach-imx/devices.c56
-rw-r--r--arch/arm/mach-imx/devices.h3
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx27-baseboard.c8
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c6
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c263
-rw-r--r--arch/arm/mach-imx/mach-imx27lite.c8
-rw-r--r--arch/arm/mach-imx/mach-mx1ads.c4
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c2
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c8
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c6
-rw-r--r--arch/arm/mach-imx/mach-mxt_td60.c13
-rw-r--r--arch/arm/mach-imx/mach-pca100.c15
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c8
-rw-r--r--arch/arm/mach-imx/mach-scb9328.c2
-rw-r--r--arch/arm/mach-imx/pcm970-baseboard.c4
-rw-r--r--arch/arm/mach-integrator/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-kirkwood/Kconfig12
-rw-r--r--arch/arm/mach-kirkwood/Makefile12
-rw-r--r--arch/arm/mach-kirkwood/d2net_v2-setup.c231
-rw-r--r--arch/arm/mach-kirkwood/dockstar-setup.c112
-rw-r--r--arch/arm/mach-kirkwood/include/mach/leds-netxbig.h55
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.c127
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.h18
-rw-r--r--arch/arm/mach-kirkwood/netspace_v2-setup.c122
-rw-r--r--arch/arm/mach-kirkwood/netxbig_v2-setup.c269
-rw-r--r--arch/arm/mach-kirkwood/openrd-setup.c101
-rw-r--r--arch/arm/mach-mmp/Kconfig7
-rw-r--r--arch/arm/mach-mmp/Makefile1
-rw-r--r--arch/arm/mach-mmp/aspenite.c90
-rw-r--r--arch/arm/mach-mmp/common.c10
-rw-r--r--arch/arm/mach-mmp/flint.c4
-rw-r--r--arch/arm/mach-mmp/include/mach/cputype.h49
-rw-r--r--arch/arm/mach-mmp/include/mach/irqs.h4
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-pxa168.h7
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa168.h20
-rw-r--r--arch/arm/mach-mmp/include/mach/regs-apmu.h12
-rw-r--r--arch/arm/mach-mmp/include/mach/teton_bga.h27
-rw-r--r--arch/arm/mach-mmp/jasper.c5
-rw-r--r--arch/arm/mach-mmp/pxa168.c16
-rw-r--r--arch/arm/mach-mmp/teton_bga.c91
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c4
-rw-r--r--arch/arm/mach-msm/Kconfig55
-rw-r--r--arch/arm/mach-msm/Makefile21
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c22
-rw-r--r--arch/arm/mach-msm/board-msm8x60.c100
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c46
-rw-r--r--arch/arm/mach-msm/clock-dummy.c54
-rw-r--r--arch/arm/mach-msm/devices-msm7x30.c5
-rw-r--r--arch/arm/mach-msm/devices-msm8x60-iommu.c883
-rw-r--r--arch/arm/mach-msm/devices-qsd8x50.c5
-rw-r--r--arch/arm/mach-msm/gpio.c409
-rw-r--r--arch/arm/mach-msm/gpio_hw.h278
-rw-r--r--arch/arm/mach-msm/gpiomux-7x30.c38
-rw-r--r--arch/arm/mach-msm/gpiomux-8x50.c28
-rw-r--r--arch/arm/mach-msm/gpiomux-8x60.c19
-rw-r--r--arch/arm/mach-msm/gpiomux-v1.c33
-rw-r--r--arch/arm/mach-msm/gpiomux-v1.h67
-rw-r--r--arch/arm/mach-msm/gpiomux-v2.c25
-rw-r--r--arch/arm/mach-msm/gpiomux-v2.h61
-rw-r--r--arch/arm/mach-msm/gpiomux.c96
-rw-r--r--arch/arm/mach-msm/gpiomux.h114
-rw-r--r--arch/arm/mach-msm/include/mach/board.h2
-rw-r--r--arch/arm/mach-msm/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-msm/include/mach/dma.h10
-rw-r--r--arch/arm/mach-msm/include/mach/entry-macro-qgic.S88
-rw-r--r--arch/arm/mach-msm/include/mach/entry-macro-vic.S37
-rw-r--r--arch/arm/mach-msm/include/mach/entry-macro.S43
-rw-r--r--arch/arm/mach-msm/include/mach/gpio.h123
-rw-r--r--arch/arm/mach-msm/include/mach/io.h1
-rw-r--r--arch/arm/mach-msm/include/mach/iommu.h103
-rw-r--r--arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h1871
-rw-r--r--arch/arm/mach-msm/include/mach/irqs-8x60.h253
-rw-r--r--arch/arm/mach-msm/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-msm/include/mach/memory.h2
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-8x60.h101
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap.h4
-rw-r--r--arch/arm/mach-msm/include/mach/smp.h39
-rw-r--r--arch/arm/mach-msm/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-msm/io.c15
-rw-r--r--arch/arm/mach-msm/iommu.c597
-rw-r--r--arch/arm/mach-msm/iommu_dev.c374
-rw-r--r--arch/arm/mach-msm/timer.c23
-rw-r--r--arch/arm/mach-mx25/Kconfig6
-rw-r--r--arch/arm/mach-mx25/clock.c34
-rw-r--r--arch/arm/mach-mx25/devices-imx25.h61
-rw-r--r--arch/arm/mach-mx25/devices.c58
-rw-r--r--arch/arm/mach-mx25/devices.h3
-rw-r--r--arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c44
-rw-r--r--arch/arm/mach-mx25/mach-cpuimx25.c19
-rw-r--r--arch/arm/mach-mx25/mach-mx25_3ds.c5
-rw-r--r--arch/arm/mach-mx3/Kconfig11
-rw-r--r--arch/arm/mach-mx3/Makefile1
-rw-r--r--arch/arm/mach-mx3/clock-imx31.c10
-rw-r--r--arch/arm/mach-mx3/clock-imx35.c28
-rw-r--r--arch/arm/mach-mx3/cpu.c47
-rw-r--r--arch/arm/mach-mx3/devices-imx31.h49
-rw-r--r--arch/arm/mach-mx3/devices-imx35.h48
-rw-r--r--arch/arm/mach-mx3/devices.c63
-rw-r--r--arch/arm/mach-mx3/devices.h4
-rw-r--r--arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c59
-rw-r--r--arch/arm/mach-mx3/mach-cpuimx35.c52
-rw-r--r--arch/arm/mach-mx3/mach-mx31ads.c9
-rw-r--r--arch/arm/mach-mx3/mach-mx35_3ds.c51
-rw-r--r--arch/arm/mach-mx3/mach-pcm037_eet.c3
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c15
-rw-r--r--arch/arm/mach-mx3/mm.c18
-rw-r--r--arch/arm/mach-mx5/Kconfig42
-rw-r--r--arch/arm/mach-mx5/Makefile3
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c23
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51sd.c333
-rw-r--r--arch/arm/mach-mx5/board-mx51_3ds.c42
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c72
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikamx.c121
-rw-r--r--arch/arm/mach-mx5/clock-mx51.c391
-rw-r--r--arch/arm/mach-mx5/cpu.c19
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h42
-rw-r--r--arch/arm/mach-mx5/devices.c114
-rw-r--r--arch/arm/mach-mx5/devices.h6
-rw-r--r--arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c30
-rw-r--r--arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c166
-rw-r--r--arch/arm/mach-netx/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-omap1/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-omap2/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-pnx4008/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-pxa/Kconfig27
-rw-r--r--arch/arm/mach-pxa/Makefile3
-rw-r--r--arch/arm/mach-pxa/balloon3.c105
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c4
-rw-r--r--arch/arm/mach-pxa/cm-x300.c77
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa3xx.c5
-rw-r--r--arch/arm/mach-pxa/devices.c30
-rw-r--r--arch/arm/mach-pxa/devices.h1
-rw-r--r--arch/arm/mach-pxa/em-x270.c2
-rw-r--r--arch/arm/mach-pxa/eseries.c7
-rw-r--r--arch/arm/mach-pxa/ezx.c10
-rw-r--r--arch/arm/mach-pxa/generic.c6
-rw-r--r--arch/arm/mach-pxa/generic.h2
-rw-r--r--arch/arm/mach-pxa/hx4700.c1
-rw-r--r--arch/arm/mach-pxa/include/mach/balloon3.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/eseries-irq.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/hx4700.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h42
-rw-r--r--arch/arm/mach-pxa/include/mach/littleton.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/lpd270.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/lubbock.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/magician.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/mainstone.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa930.h7
-rw-r--r--arch/arm/mach-pxa/include/mach/pcm027.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/poodle.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa3xx-u2d.h35
-rw-r--r--arch/arm/mach-pxa/include/mach/tosa.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/zeus.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/zylonite.h2
-rw-r--r--arch/arm/mach-pxa/littleton.c3
-rw-r--r--arch/arm/mach-pxa/lpd270.c1
-rw-r--r--arch/arm/mach-pxa/lubbock.c3
-rw-r--r--arch/arm/mach-pxa/magician.c1
-rw-r--r--arch/arm/mach-pxa/mainstone.c3
-rw-r--r--arch/arm/mach-pxa/mioa701.c2
-rw-r--r--arch/arm/mach-pxa/palmld.c2
-rw-r--r--arch/arm/mach-pxa/palmt5.c2
-rw-r--r--arch/arm/mach-pxa/palmtreo.c2
-rw-r--r--arch/arm/mach-pxa/palmtx.c2
-rw-r--r--arch/arm/mach-pxa/palmz72.c2
-rw-r--r--arch/arm/mach-pxa/pcm027.c1
-rw-r--r--arch/arm/mach-pxa/poodle.c1
-rw-r--r--arch/arm/mach-pxa/pxa3xx-ulpi.c400
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c19
-rw-r--r--arch/arm/mach-pxa/pxa930.c2
-rw-r--r--arch/arm/mach-pxa/stargate2.c3
-rw-r--r--arch/arm/mach-pxa/tavorevb.c2
-rw-r--r--arch/arm/mach-pxa/tavorevb3.c136
-rw-r--r--arch/arm/mach-pxa/tosa.c1
-rw-r--r--arch/arm/mach-pxa/z2.c2
-rw-r--r--arch/arm/mach-pxa/zeus.c1
-rw-r--r--arch/arm/mach-pxa/zylonite.c3
-rw-r--r--arch/arm/mach-rpc/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s5p6440/Kconfig33
-rw-r--r--arch/arm/mach-s5p6440/Makefile25
-rw-r--r--arch/arm/mach-s5p6440/clock.c846
-rw-r--r--arch/arm/mach-s5p6440/cpu.c116
-rw-r--r--arch/arm/mach-s5p6440/dev-audio.c127
-rw-r--r--arch/arm/mach-s5p6440/dev-spi.c176
-rw-r--r--arch/arm/mach-s5p6440/include/mach/debug-macro.S37
-rw-r--r--arch/arm/mach-s5p6440/include/mach/gpio.h80
-rw-r--r--arch/arm/mach-s5p6440/include/mach/io.h18
-rw-r--r--arch/arm/mach-s5p6440/include/mach/map.h86
-rw-r--r--arch/arm/mach-s5p6440/include/mach/regs-clock.h130
-rw-r--r--arch/arm/mach-s5p6440/include/mach/spi-clocks.h17
-rw-r--r--arch/arm/mach-s5p6440/include/mach/uncompress.h24
-rw-r--r--arch/arm/mach-s5p6440/init.c52
-rw-r--r--arch/arm/mach-s5p6442/cpu.c28
-rw-r--r--arch/arm/mach-s5p6442/include/mach/map.h6
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig57
-rw-r--r--arch/arm/mach-s5p64x0/Makefile30
-rw-r--r--arch/arm/mach-s5p64x0/Makefile.boot (renamed from arch/arm/mach-s5p6440/Makefile.boot)0
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c626
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c655
-rw-r--r--arch/arm/mach-s5p64x0/clock.c253
-rw-r--r--arch/arm/mach-s5p64x0/cpu.c209
-rw-r--r--arch/arm/mach-s5p64x0/dev-audio.c164
-rw-r--r--arch/arm/mach-s5p64x0/dev-spi.c232
-rw-r--r--arch/arm/mach-s5p64x0/dma.c (renamed from arch/arm/mach-s5p6440/dma.c)86
-rw-r--r--arch/arm/mach-s5p64x0/gpio.c (renamed from arch/arm/mach-s5p6440/gpio.c)104
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/debug-macro.S33
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/dma.h (renamed from arch/arm/mach-s5p6440/include/mach/dma.h)0
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/entry-macro.S (renamed from arch/arm/mach-s5p6440/include/mach/entry-macro.S)8
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/gpio.h139
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/hardware.h (renamed from arch/arm/mach-s5p6440/include/mach/hardware.h)8
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/i2c.h17
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/io.h25
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/irqs.h (renamed from arch/arm/mach-s5p6440/include/mach/irqs.h)48
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/map.h83
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/memory.h (renamed from arch/arm/mach-s5p6440/include/mach/memory.h)12
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/pwm-clock.h (renamed from arch/arm/mach-s5p6440/include/mach/pwm-clock.h)10
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-clock.h63
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-gpio.h (renamed from arch/arm/mach-s5p6440/include/mach/regs-gpio.h)28
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-irq.h (renamed from arch/arm/mach-s5p6440/include/mach/regs-irq.h)8
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h46
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/spi-clocks.h20
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/system.h (renamed from arch/arm/mach-s5p6440/include/mach/system.h)8
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/tick.h (renamed from arch/arm/mach-s5p6440/include/mach/tick.h)13
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/timex.h (renamed from arch/arm/mach-s5p6440/include/mach/timex.h)7
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/uncompress.h212
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/vmalloc.h (renamed from arch/arm/mach-s5p6440/include/mach/vmalloc.h)5
-rw-r--r--arch/arm/mach-s5p64x0/init.c73
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6440.c (renamed from arch/arm/mach-s5p6440/mach-smdk6440.c)87
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6450.c182
-rw-r--r--arch/arm/mach-s5p64x0/setup-i2c0.c (renamed from arch/arm/mach-s5p6440/setup-i2c0.c)24
-rw-r--r--arch/arm/mach-s5p64x0/setup-i2c1.c (renamed from arch/arm/mach-s5p6440/setup-i2c1.c)20
-rw-r--r--arch/arm/mach-s5pc100/cpu.c26
-rw-r--r--arch/arm/mach-s5pc100/include/mach/map.h11
-rw-r--r--arch/arm/mach-s5pv210/Kconfig9
-rw-r--r--arch/arm/mach-s5pv210/Makefile1
-rw-r--r--arch/arm/mach-s5pv210/clock.c5
-rw-r--r--arch/arm/mach-s5pv210/cpu.c23
-rw-r--r--arch/arm/mach-s5pv210/include/mach/map.h11
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c2
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c2
-rw-r--r--arch/arm/mach-s5pv310/cpu.c26
-rw-r--r--arch/arm/mach-s5pv310/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-s5pv310/include/mach/map.h7
-rw-r--r--arch/arm/mach-shark/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-tcc8k/Kconfig11
-rw-r--r--arch/arm/mach-tcc8k/Makefile9
-rw-r--r--arch/arm/mach-tcc8k/Makefile.boot3
-rw-r--r--arch/arm/mach-tcc8k/board-tcc8000-sdk.c64
-rw-r--r--arch/arm/mach-tcc8k/clock.c567
-rw-r--r--arch/arm/mach-tcc8k/common.h15
-rw-r--r--arch/arm/mach-tcc8k/devices.c239
-rw-r--r--arch/arm/mach-tcc8k/io.c62
-rw-r--r--arch/arm/mach-tcc8k/irq.c111
-rw-r--r--arch/arm/mach-tcc8k/time.c149
-rw-r--r--arch/arm/mach-versatile/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c4
-rw-r--r--arch/arm/mach-vexpress/v2m.c2
-rw-r--r--arch/arm/mm/ioremap.c8
-rw-r--r--arch/arm/mm/mmap.c22
-rw-r--r--arch/arm/mm/mmu.c4
-rw-r--r--arch/arm/mm/proc-v7.S10
-rw-r--r--arch/arm/oprofile/common.c7
-rw-r--r--arch/arm/plat-mxc/Kconfig16
-rw-r--r--arch/arm/plat-mxc/Makefile2
-rw-r--r--arch/arm/plat-mxc/audmux-v2.c8
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig10
-rw-r--r--arch/arm/plat-mxc/devices/Makefile9
-rw-r--r--arch/arm/plat-mxc/devices/platform-esdhc.c71
-rw-r--r--arch/arm/plat-mxc/devices/platform-fec.c58
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-dma.c129
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-i2c.c85
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-ssi.c107
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-uart.c137
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc_nand.c85
-rw-r--r--arch/arm/plat-mxc/devices/platform-spi_imx.c89
-rw-r--r--arch/arm/plat-mxc/ehci.c4
-rw-r--r--arch/arm/plat-mxc/epit.c242
-rw-r--r--arch/arm/plat-mxc/gpio.c2
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31ads.h33
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h1
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h112
-rw-r--r--arch/arm/plat-mxc/include/mach/esdhc.h16
-rw-r--r--arch/arm/plat-mxc/include/mach/eukrea-baseboards.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx51.h120
-rw-r--r--arch/arm/plat-mxc/include/mach/iram.h41
-rw-r--r--arch/arm/plat-mxc/include/mach/mx21.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx25.h17
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h11
-rw-r--r--arch/arm/plat-mxc/include/mach/mx35.h38
-rw-r--r--arch/arm/plat-mxc/include/mach/mx3x.h23
-rw-r--r--arch/arm/plat-mxc/include/mach/mx51.h657
-rw-r--r--arch/arm/plat-mxc/include/mach/system.h32
-rw-r--r--arch/arm/plat-mxc/include/mach/uncompress.h1
-rw-r--r--arch/arm/plat-mxc/iram_alloc.c73
-rw-r--r--arch/arm/plat-omap/Kconfig2
-rw-r--r--arch/arm/plat-omap/iommu.c1
-rw-r--r--arch/arm/plat-omap/mcbsp.c2
-rw-r--r--arch/arm/plat-pxa/include/plat/pxa27x_keypad.h (renamed from arch/arm/mach-pxa/include/mach/pxa27x_keypad.h)10
-rw-r--r--arch/arm/plat-s5p/Kconfig9
-rw-r--r--arch/arm/plat-s5p/Makefile1
-rw-r--r--arch/arm/plat-s5p/clock.c19
-rw-r--r--arch/arm/plat-s5p/cpu.c34
-rw-r--r--arch/arm/plat-s5p/dev-onenand.c (renamed from arch/arm/mach-s5pv210/dev-onenand.c)28
-rw-r--r--arch/arm/plat-s5p/dev-uart.c58
-rw-r--r--arch/arm/plat-s5p/include/plat/pll.h7
-rw-r--r--arch/arm/plat-s5p/include/plat/s5p-clock.h8
-rw-r--r--arch/arm/plat-s5p/include/plat/s5p6440.h7
-rw-r--r--arch/arm/plat-s5p/include/plat/s5p6450.h36
-rw-r--r--arch/arm/plat-samsung/adc.c1
-rw-r--r--arch/arm/plat-samsung/clock.c27
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h7
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h20
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c64xx-spi.h2
-rw-r--r--arch/arm/plat-tcc/Kconfig20
-rw-r--r--arch/arm/plat-tcc/Makefile3
-rw-r--r--arch/arm/plat-tcc/clock.c179
-rw-r--r--arch/arm/plat-tcc/include/mach/clkdev.h7
-rw-r--r--arch/arm/plat-tcc/include/mach/clock.h48
-rw-r--r--arch/arm/plat-tcc/include/mach/debug-macro.S33
-rw-r--r--arch/arm/plat-tcc/include/mach/entry-macro.S68
-rw-r--r--arch/arm/plat-tcc/include/mach/hardware.h43
-rw-r--r--arch/arm/plat-tcc/include/mach/io.h23
-rw-r--r--arch/arm/plat-tcc/include/mach/irqs.h83
-rw-r--r--arch/arm/plat-tcc/include/mach/memory.h18
-rw-r--r--arch/arm/plat-tcc/include/mach/system.h31
-rw-r--r--arch/arm/plat-tcc/include/mach/tcc8k-regs.h807
-rw-r--r--arch/arm/plat-tcc/include/mach/timex.h5
-rw-r--r--arch/arm/plat-tcc/include/mach/uncompress.h34
-rw-r--r--arch/arm/plat-tcc/include/mach/vmalloc.h10
-rw-r--r--arch/arm/plat-tcc/system.c25
-rw-r--r--arch/avr32/Kconfig1
-rw-r--r--arch/avr32/kernel/module.c3
-rw-r--r--arch/h8300/kernel/module.c3
-rw-r--r--arch/m68k/mac/macboing.c6
-rw-r--r--arch/mips/Kconfig21
-rw-r--r--arch/mips/alchemy/common/prom.c5
-rw-r--r--arch/mips/boot/compressed/Makefile2
-rw-r--r--arch/mips/cavium-octeon/Kconfig4
-rw-r--r--arch/mips/cavium-octeon/cpu.c2
-rw-r--r--arch/mips/cavium-octeon/executive/Makefile2
-rw-r--r--arch/mips/include/asm/atomic.h4
-rw-r--r--arch/mips/include/asm/cop2.h2
-rw-r--r--arch/mips/include/asm/gic.h1
-rw-r--r--arch/mips/include/asm/mach-tx49xx/kmalloc.h2
-rw-r--r--arch/mips/include/asm/mips-boards/maltaint.h3
-rw-r--r--arch/mips/include/asm/page.h14
-rw-r--r--arch/mips/include/asm/siginfo.h1
-rw-r--r--arch/mips/include/asm/thread_info.h3
-rw-r--r--arch/mips/include/asm/unistd.h21
-rw-r--r--arch/mips/kernel/irq-gic.c5
-rw-r--r--arch/mips/kernel/kgdb.c2
-rw-r--r--arch/mips/kernel/kspd.c2
-rw-r--r--arch/mips/kernel/linux32.c7
-rw-r--r--arch/mips/kernel/scall32-o32.S5
-rw-r--r--arch/mips/kernel/scall64-64.S7
-rw-r--r--arch/mips/kernel/scall64-n32.S5
-rw-r--r--arch/mips/kernel/scall64-o32.S5
-rw-r--r--arch/mips/mm/dma-default.c28
-rw-r--r--arch/mips/mm/sc-rm7k.c2
-rw-r--r--arch/mips/mti-malta/malta-int.c3
-rw-r--r--arch/mips/pci/pci-rc32434.c2
-rw-r--r--arch/mips/pnx8550/common/reset.c20
-rw-r--r--arch/mips/pnx8550/common/setup.c3
-rw-r--r--arch/mn10300/kernel/module.c3
-rw-r--r--arch/mn10300/mm/cache.c20
-rw-r--r--arch/parisc/kernel/module.c3
-rw-r--r--arch/powerpc/kernel/module.c6
-rw-r--r--arch/powerpc/platforms/512x/clock.c2
-rw-r--r--arch/powerpc/platforms/52xx/efika.c9
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c8
-rw-r--r--arch/s390/kernel/module.c3
-rw-r--r--arch/sh/kernel/module.c2
-rw-r--r--arch/um/drivers/net_kern.c17
-rw-r--r--arch/x86/ia32/ia32_aout.c22
-rw-r--r--arch/x86/kernel/acpi/cstate.c2
-rw-r--r--arch/x86/kernel/apic/io_apic.c11
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/cpu/cpu.h1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c18
-rw-r--r--arch/x86/kernel/cpu/intel.c1
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c9
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c3
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c6
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/kernel/module.c3
-rw-r--r--arch/x86/kvm/svm.c2
-rw-r--r--arch/x86/mm/srat_64.c8
-rw-r--r--arch/x86/oprofile/nmi_int.c1
-rw-r--r--arch/x86/xen/time.c5
-rw-r--r--block/elevator.c12
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/acpi/acpi_pad.c34
-rw-r--r--drivers/acpi/acpica/aclocal.h1
-rw-r--r--drivers/acpi/acpica/exutils.c2
-rw-r--r--drivers/acpi/acpica/rsutils.c2
-rw-r--r--drivers/acpi/apei/Kconfig2
-rw-r--r--drivers/acpi/apei/apei-base.c21
-rw-r--r--drivers/acpi/apei/einj.c4
-rw-r--r--drivers/acpi/apei/erst-dbg.c18
-rw-r--r--drivers/acpi/apei/erst.c29
-rw-r--r--drivers/acpi/apei/ghes.c2
-rw-r--r--drivers/acpi/apei/hest.c11
-rw-r--r--drivers/acpi/atomicio.c2
-rw-r--r--drivers/acpi/battery.c1
-rw-r--r--drivers/acpi/blacklist.c35
-rw-r--r--drivers/acpi/bus.c18
-rw-r--r--drivers/acpi/fan.c2
-rw-r--r--drivers/acpi/processor_core.c7
-rw-r--r--drivers/acpi/processor_driver.c2
-rw-r--r--drivers/acpi/processor_perflib.c4
-rw-r--r--drivers/acpi/sleep.c22
-rw-r--r--drivers/acpi/sysfs.c20
-rw-r--r--drivers/acpi/video_detect.c4
-rw-r--r--drivers/atm/iphase.c6
-rw-r--r--drivers/atm/iphase.h2
-rw-r--r--drivers/atm/solos-pci.c8
-rw-r--r--drivers/block/virtio_blk.c6
-rw-r--r--drivers/cpuidle/governors/menu.c2
-rw-r--r--drivers/dma/ioat/dma_v2.c2
-rw-r--r--drivers/dma/shdma.c3
-rw-r--r--drivers/edac/i7core_edac.c1
-rw-r--r--drivers/gpu/drm/drm_gem.c39
-rw-r--r--drivers/gpu/drm/drm_info.c2
-rw-r--r--drivers/gpu/drm/drm_vm.c28
-rw-r--r--drivers/gpu/drm/i810/i810_dma.c2
-rw-r--r--drivers/gpu/drm/i830/i830_dma.c2
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c9
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c52
-rw-r--r--drivers/gpu/drm/i915/i915_gem_evict.c45
-rw-r--r--drivers/gpu/drm/i915/intel_display.c62
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c19
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h1
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c6
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c5
-rw-r--r--drivers/gpu/drm/radeon/r100.c3
-rw-r--r--drivers/gpu/drm/radeon/r600.c7
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c27
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c26
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.h5
-rw-r--r--drivers/gpu/drm/radeon/rs600.c1
-rw-r--r--drivers/gpu/drm/radeon/rs690.c1
-rw-r--r--drivers/gpu/drm/radeon/rv770.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c83
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c145
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.h8
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fb.c5
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c17
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c27
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c4
-rw-r--r--drivers/hwmon/f71882fg.c32
-rw-r--r--drivers/i2c/busses/i2c-cpm.c5
-rw-r--r--drivers/i2c/busses/i2c-davinci.c6
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c3
-rw-r--r--drivers/i2c/busses/i2c-mpc.c1
-rw-r--r--drivers/i2c/busses/i2c-octeon.c2
-rw-r--r--drivers/i2c/busses/i2c-pca-isa.c12
-rw-r--r--drivers/i2c/busses/i2c-pca-platform.c11
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c4
-rw-r--r--drivers/i2c/i2c-core.c54
-rw-r--r--[-rwxr-xr-x]drivers/idle/intel_idle.c30
-rw-r--r--drivers/input/joydev.c3
-rw-r--r--drivers/input/keyboard/Kconfig2
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c12
-rw-r--r--drivers/input/misc/uinput.c7
-rw-r--r--drivers/input/tablet/wacom_sys.c23
-rw-r--r--drivers/input/tablet/wacom_wac.c4
-rw-r--r--drivers/isdn/sc/interrupt.c18
-rw-r--r--drivers/leds/Kconfig11
-rw-r--r--drivers/leds/Makefile1
-rw-r--r--drivers/leds/leds-netxbig.c449
-rw-r--r--drivers/leds/leds-ns2.c9
-rw-r--r--drivers/md/bitmap.c9
-rw-r--r--drivers/md/raid1.c4
-rw-r--r--drivers/media/IR/ir-keytable.c9
-rw-r--r--drivers/media/IR/ir-lirc-codec.c2
-rw-r--r--drivers/media/IR/ir-raw-event.c4
-rw-r--r--drivers/media/IR/ir-sysfs.c17
-rw-r--r--drivers/media/IR/keymaps/rc-rc6-mce.c3
-rw-r--r--drivers/media/IR/mceusb.c4
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c3
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c56
-rw-r--r--drivers/media/dvb/dvb-usb/opera1.c4
-rw-r--r--drivers/media/dvb/frontends/dib7000p.c8
-rw-r--r--drivers/media/dvb/frontends/dib7000p.h5
-rw-r--r--drivers/media/dvb/siano/smscoreapi.c31
-rw-r--r--drivers/media/radio/si470x/radio-si470x-i2c.c2
-rw-r--r--drivers/media/video/cx231xx/Makefile1
-rw-r--r--drivers/media/video/cx231xx/cx231xx-cards.c17
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c2
-rw-r--r--drivers/media/video/cx88/Kconfig2
-rw-r--r--drivers/media/video/gspca/gspca.c1
-rw-r--r--drivers/media/video/gspca/sn9c20x.c3
-rw-r--r--drivers/media/video/ivtv/ivtvfb.c2
-rw-r--r--drivers/media/video/mem2mem_testdev.c3
-rw-r--r--drivers/media/video/mt9m111.c8
-rw-r--r--drivers/media/video/mt9v022.c3
-rw-r--r--drivers/media/video/mx2_camera.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ctrl.c6
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c94
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c10
-rw-r--r--drivers/media/video/saa7164/saa7164-buffer.c5
-rw-r--r--drivers/media/video/uvc/uvc_driver.c24
-rw-r--r--drivers/media/video/uvc/uvcvideo.h1
-rw-r--r--drivers/media/video/videobuf-dma-contig.c6
-rw-r--r--drivers/media/video/videobuf-dma-sg.c11
-rw-r--r--drivers/mfd/max8925-core.c13
-rw-r--r--drivers/mfd/wm831x-irq.c9
-rw-r--r--drivers/misc/bh1780gli.c1
-rw-r--r--drivers/mtd/nand/omap2.c2
-rw-r--r--drivers/net/Kconfig9
-rw-r--r--drivers/net/b44.c4
-rw-r--r--drivers/net/bonding/bond_main.c9
-rw-r--r--drivers/net/ehea/ehea_main.c9
-rw-r--r--drivers/net/ehea/ehea_qmr.h1
-rw-r--r--drivers/net/fec.c44
-rw-r--r--drivers/net/r8169.c65
-rw-r--r--drivers/net/skge.c18
-rw-r--r--drivers/net/tg3.c6
-rw-r--r--drivers/net/tg3.h2
-rw-r--r--drivers/net/wimax/i2400m/rx.c26
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c2
-rw-r--r--drivers/pci/quirks.c20
-rw-r--r--drivers/platform/x86/intel_ips.c122
-rw-r--r--drivers/regulator/ad5398.c1
-rw-r--r--drivers/regulator/core.c6
-rw-r--r--drivers/regulator/isl6271a-regulator.c2
-rw-r--r--drivers/regulator/max8649.c2
-rw-r--r--drivers/rtc/rtc-ds3232.c2
-rw-r--r--drivers/serial/Kconfig7
-rw-r--r--drivers/serial/mfd.c1
-rw-r--r--drivers/serial/mrst_max3110.c1
-rw-r--r--drivers/serial/samsung.c2
-rw-r--r--drivers/spi/Kconfig16
-rw-r--r--drivers/spi/spi.c5
-rw-r--r--drivers/spi/spi_gpio.c2
-rw-r--r--drivers/spi/spi_imx.c402
-rw-r--r--drivers/spi/spi_mpc8xxx.c10
-rw-r--r--drivers/staging/tm6000/Kconfig2
-rw-r--r--drivers/staging/tm6000/tm6000-input.c61
-rw-r--r--drivers/usb/host/ohci-pxa27x.c7
-rw-r--r--drivers/video/pxa168fb.c47
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c9
-rw-r--r--fs/binfmt_aout.c4
-rw-r--r--fs/ceph/caps.c31
-rw-r--r--fs/ceph/export.c21
-rw-r--r--fs/ceph/file.c2
-rw-r--r--fs/ceph/osd_client.c2
-rw-r--r--fs/cifs/cifssmb.c49
-rw-r--r--fs/cifs/inode.c2
-rw-r--r--fs/exec.c38
-rw-r--r--fs/exofs/inode.c8
-rw-r--r--fs/fs-writeback.c19
-rw-r--r--fs/fuse/dev.c2
-rw-r--r--fs/nfsd/nfsfh.h2
-rw-r--r--fs/notify/Kconfig2
-rw-r--r--fs/ocfs2/symlink.c2
-rw-r--r--fs/proc/base.c4
-rw-r--r--fs/reiserfs/ioctl.c7
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c19
-rw-r--r--fs/xfs/xfs_log_cil.c12
-rw-r--r--fs/xfs/xfs_log_priv.h37
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/drm/drmP.h29
-rw-r--r--include/drm/drm_pciids.h2
-rw-r--r--include/drm/ttm/ttm_bo_api.h4
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/coredump.h34
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--include/linux/dmaengine.h2
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/module.h5
-rw-r--r--include/linux/rcupdate.h2
-rw-r--r--include/linux/wait.h1
-rw-r--r--include/media/videobuf-dma-sg.h1
-rw-r--r--include/net/bluetooth/bluetooth.h18
-rw-r--r--ipc/sem.c2
-rw-r--r--kernel/kfifo.c2
-rw-r--r--kernel/module.c4
-rw-r--r--kernel/perf_event.c4
-rw-r--r--kernel/signal.c8
-rw-r--r--kernel/smp.c17
-rw-r--r--kernel/sysctl.c2
-rw-r--r--kernel/trace/ring_buffer.c2
-rw-r--r--lib/bug.c6
-rw-r--r--lib/list_sort.c2
-rw-r--r--mm/ksm.c6
-rw-r--r--mm/memcontrol.c10
-rw-r--r--mm/memory-failure.c12
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/rmap.c8
-rw-r--r--net/8021q/vlan_core.c14
-rw-r--r--net/atm/mpc.c2
-rw-r--r--net/bluetooth/l2cap.c62
-rw-r--r--net/bluetooth/rfcomm/sock.c4
-rw-r--r--net/caif/caif_socket.c21
-rw-r--r--net/core/ethtool.c8
-rw-r--r--net/core/stream.c8
-rw-r--r--net/ipv4/Kconfig3
-rw-r--r--net/ipv4/igmp.c14
-rw-r--r--net/ipv4/tcp_timer.c24
-rw-r--r--net/ipv6/route.c28
-rw-r--r--net/mac80211/agg-tx.c2
-rw-r--r--net/mac80211/rx.c4
-rw-r--r--net/mac80211/status.c4
-rw-r--r--net/phonet/pep.c3
-rw-r--r--net/sched/cls_u32.c2
-rw-r--r--net/sctp/auth.c8
-rw-r--r--net/sctp/socket.c13
-rw-r--r--samples/kfifo/dma-example.c17
-rw-r--r--scripts/kconfig/conf.c2
-rw-r--r--scripts/kconfig/expr.h1
-rw-r--r--scripts/kconfig/menu.c7
-rw-r--r--scripts/kconfig/symbol.c2
-rw-r--r--sound/core/control.c5
-rw-r--r--sound/i2c/other/ak4xxx-adda.c2
-rw-r--r--sound/oss/soundcard.c4
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--tools/perf/Makefile2
-rw-r--r--tools/perf/perf.h12
-rw-r--r--tools/perf/util/trace-event-scripting.c4
-rw-r--r--tools/perf/util/ui/browsers/hists.c2
685 files changed, 21747 insertions, 5907 deletions
diff --git a/CREDITS b/CREDITS
index 72b487869788..41d8e63d5165 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3554,12 +3554,12 @@ E: cvance@nai.com
3554D: portions of the Linux Security Module (LSM) framework and security modules 3554D: portions of the Linux Security Module (LSM) framework and security modules
3555 3555
3556N: Petr Vandrovec 3556N: Petr Vandrovec
3557E: vandrove@vc.cvut.cz 3557E: petr@vandrovec.name
3558D: Small contributions to ncpfs 3558D: Small contributions to ncpfs
3559D: Matrox framebuffer driver 3559D: Matrox framebuffer driver
3560S: Chudenicka 8 3560S: 21513 Conradia Ct
3561S: 10200 Prague 10, Hostivar 3561S: Cupertino, CA 95014
3562S: Czech Republic 3562S: USA
3563 3563
3564N: Thibaut Varene 3564N: Thibaut Varene
3565E: T-Bone@parisc-linux.org 3565E: T-Bone@parisc-linux.org
diff --git a/Documentation/arm/00-INDEX b/Documentation/arm/00-INDEX
index 7f5fc3ba9c91..ecf7d04bca26 100644
--- a/Documentation/arm/00-INDEX
+++ b/Documentation/arm/00-INDEX
@@ -6,6 +6,8 @@ Interrupts
6 - ARM Interrupt subsystem documentation 6 - ARM Interrupt subsystem documentation
7IXP2000 7IXP2000
8 - Release Notes for Linux on Intel's IXP2000 Network Processor 8 - Release Notes for Linux on Intel's IXP2000 Network Processor
9msm
10 - MSM specific documentation
9Netwinder 11Netwinder
10 - Netwinder specific documentation 12 - Netwinder specific documentation
11Porting 13Porting
diff --git a/Documentation/arm/msm/gpiomux.txt b/Documentation/arm/msm/gpiomux.txt
new file mode 100644
index 000000000000..67a81620adf6
--- /dev/null
+++ b/Documentation/arm/msm/gpiomux.txt
@@ -0,0 +1,176 @@
1This document provides an overview of the msm_gpiomux interface, which
2is used to provide gpio pin multiplexing and configuration on mach-msm
3targets.
4
5History
6=======
7
8The first-generation API for gpio configuration & multiplexing on msm
9is the function gpio_tlmm_config(). This function has a few notable
10shortcomings, which led to its deprecation and replacement by gpiomux:
11
12The 'disable' parameter: Setting the second parameter to
13gpio_tlmm_config to GPIO_CFG_DISABLE tells the peripheral
14processor in charge of the subsystem to perform a look-up into a
15low-power table and apply the low-power/sleep setting for the pin.
16As the msm family evolved this became problematic. Not all pins
17have sleep settings, not all peripheral processors will accept requests
18to apply said sleep settings, and not all msm targets have their gpio
19subsystems managed by a peripheral processor. In order to get consistent
20behavior on all targets, drivers are forced to ignore this parameter,
21rendering it useless.
22
23The 'direction' flag: for all mux-settings other than raw-gpio (0),
24the output-enable bit of a gpio is hard-wired to a known
25input (usually VDD or ground). For those settings, the direction flag
26is meaningless at best, and deceptive at worst. In addition, using the
27direction flag to change output-enable (OE) directly can cause trouble in
28gpiolib, which has no visibility into gpio direction changes made
29in this way. Direction control in gpio mode should be made through gpiolib.
30
31Key Features of gpiomux
32=======================
33
34- A consistent interface across all generations of msm. Drivers can expect
35the same results on every target.
36- gpiomux plays nicely with gpiolib. Functions that should belong to gpiolib
37are left to gpiolib and not duplicated here. gpiomux is written with the
38intent that gpio_chips will call gpiomux reference-counting methods
39from their request() and free() hooks, providing full integration.
40- Tabular configuration. Instead of having to call gpio_tlmm_config
41hundreds of times, gpio configuration is placed in a single table.
42- Per-gpio sleep. Each gpio is individually reference counted, allowing only
43those lines which are in use to be put in high-power states.
44- 0 means 'do nothing': all flags are designed so that the default memset-zero
45equates to a sensible default of 'no configuration', preventing users
46from having to provide hundreds of 'no-op' configs for unused or
47unwanted lines.
48
49Usage
50=====
51
52To use gpiomux, provide configuration information for relevant gpio lines
53in the msm_gpiomux_configs table. Since a 0 equates to "unconfigured",
54only those lines to be managed by gpiomux need to be specified. Here
55is a completely fictional example:
56
57struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
58 [12] = {
59 .active = GPIOMUX_VALID | GPIOMUX_DRV_8MA | GPIOMUX_FUNC_1,
60 .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
61 },
62 [34] = {
63 .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
64 },
65};
66
67To indicate that a gpio is in use, call msm_gpiomux_get() to increase
68its reference count. To decrease the reference count, call msm_gpiomux_put().
69
70The effect of this configuration is as follows:
71
72When the system boots, gpios 12 and 34 will be initialized with their
73'suspended' configurations. All other gpios, which were left unconfigured,
74will not be touched.
75
76When msm_gpiomux_get() is called on gpio 12 to raise its reference count
77above 0, its active configuration will be applied. Since no other gpio
78line has a valid active configuration, msm_gpiomux_get() will have no
79effect on any other line.
80
81When msm_gpiomux_put() is called on gpio 12 or 34 to drop their reference
82count to 0, their suspended configurations will be applied.
83Since no other gpio line has a valid suspended configuration, no other
84gpio line will be effected by msm_gpiomux_put(). Since gpio 34 has no valid
85active configuration, this is effectively a no-op for gpio 34 as well,
86with one small caveat, see the section "About Output-Enable Settings".
87
88All of the GPIOMUX_VALID flags may seem like unnecessary overhead, but
89they address some important issues. As unused entries (all those
90except 12 and 34) are zero-filled, gpiomux needs a way to distinguish
91the used fields from the unused. In addition, the all-zero pattern
92is a valid configuration! Therefore, gpiomux defines an additional bit
93which is used to indicate when a field is used. This has the pleasant
94side-effect of allowing calls to msm_gpiomux_write to use '0' to indicate
95that a value should not be changed:
96
97 msm_gpiomux_write(0, GPIOMUX_VALID, 0);
98
99replaces the active configuration of gpio 0 with an all-zero configuration,
100but leaves the suspended configuration as it was.
101
102Static Configurations
103=====================
104
105To install a static configuration, which is applied at boot and does
106not change after that, install a configuration with a suspended component
107but no active component, as in the previous example:
108
109 [34] = {
110 .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
111 },
112
113The suspended setting is applied during boot, and the lack of any valid
114active setting prevents any other setting from being applied at runtime.
115If other subsystems attempting to access the line is a concern, one could
116*really* anchor the configuration down by calling msm_gpiomux_get on the
117line at initialization to move the line into active mode. With the line
118held, it will never be re-suspended, and with no valid active configuration,
119no new configurations will be applied.
120
121But then, if having other subsystems grabbing for the line is truly a concern,
122it should be reserved with gpio_request instead, which carries an implicit
123msm_gpiomux_get.
124
125gpiomux and gpiolib
126===================
127
128It is expected that msm gpio_chips will call msm_gpiomux_get() and
129msm_gpiomux_put() from their request and free hooks, like this fictional
130example:
131
132static int request(struct gpio_chip *chip, unsigned offset)
133{
134 return msm_gpiomux_get(chip->base + offset);
135}
136
137static void free(struct gpio_chip *chip, unsigned offset)
138{
139 msm_gpiomux_put(chip->base + offset);
140}
141
142 ...somewhere in a gpio_chip declaration...
143 .request = request,
144 .free = free,
145
146This provides important functionality:
147- It guarantees that a gpio line will have its 'active' config applied
148 when the line is requested, and will not be suspended while the line
149 remains requested; and
150- It guarantees that gpio-direction settings from gpiolib behave sensibly.
151 See "About Output-Enable Settings."
152
153This mechanism allows for "auto-request" of gpiomux lines via gpiolib
154when it is suitable. Drivers wishing more exact control are, of course,
155free to also use msm_gpiomux_set and msm_gpiomux_get.
156
157About Output-Enable Settings
158============================
159
160Some msm targets do not have the ability to query the current gpio
161configuration setting. This means that changes made to the output-enable
162(OE) bit by gpiolib cannot be consistently detected and preserved by gpiomux.
163Therefore, when gpiomux applies a configuration setting, any direction
164settings which may have been applied by gpiolib are lost and the default
165input settings are re-applied.
166
167For this reason, drivers should not assume that gpio direction settings
168continue to hold if they free and then re-request a gpio. This seems like
169common sense - after all, anybody could have obtained the line in the
170meantime - but it needs saying.
171
172This also means that calls to msm_gpiomux_write will reset the OE bit,
173which means that if the gpio line is held by a client of gpiolib and
174msm_gpiomux_write is called, the direction setting has been lost and
175gpiolib's internal state has been broken.
176Release gpio lines before reconfiguring them.
diff --git a/Documentation/networking/e1000.txt b/Documentation/networking/e1000.txt
index 2df71861e578..d9271e74e488 100644
--- a/Documentation/networking/e1000.txt
+++ b/Documentation/networking/e1000.txt
@@ -1,82 +1,35 @@
1Linux* Base Driver for the Intel(R) PRO/1000 Family of Adapters 1Linux* Base Driver for the Intel(R) PRO/1000 Family of Adapters
2=============================================================== 2===============================================================
3 3
4September 26, 2006 4Intel Gigabit Linux driver.
5 5Copyright(c) 1999 - 2010 Intel Corporation.
6 6
7Contents 7Contents
8======== 8========
9 9
10- In This Release
11- Identifying Your Adapter 10- Identifying Your Adapter
12- Building and Installation
13- Command Line Parameters 11- Command Line Parameters
14- Speed and Duplex Configuration 12- Speed and Duplex Configuration
15- Additional Configurations 13- Additional Configurations
16- Known Issues
17- Support 14- Support
18 15
19
20In This Release
21===============
22
23This file describes the Linux* Base Driver for the Intel(R) PRO/1000 Family
24of Adapters. This driver includes support for Itanium(R)2-based systems.
25
26For questions related to hardware requirements, refer to the documentation
27supplied with your Intel PRO/1000 adapter. All hardware requirements listed
28apply to use with Linux.
29
30The following features are now available in supported kernels:
31 - Native VLANs
32 - Channel Bonding (teaming)
33 - SNMP
34
35Channel Bonding documentation can be found in the Linux kernel source:
36/Documentation/networking/bonding.txt
37
38The driver information previously displayed in the /proc filesystem is not
39supported in this release. Alternatively, you can use ethtool (version 1.6
40or later), lspci, and ifconfig to obtain the same information.
41
42Instructions on updating ethtool can be found in the section "Additional
43Configurations" later in this document.
44
45NOTE: The Intel(R) 82562v 10/100 Network Connection only provides 10/100
46support.
47
48
49Identifying Your Adapter 16Identifying Your Adapter
50======================== 17========================
51 18
52For more information on how to identify your adapter, go to the Adapter & 19For more information on how to identify your adapter, go to the Adapter &
53Driver ID Guide at: 20Driver ID Guide at:
54 21
55 http://support.intel.com/support/network/adapter/pro100/21397.htm 22 http://support.intel.com/support/go/network/adapter/idguide.htm
56 23
57For the latest Intel network drivers for Linux, refer to the following 24For the latest Intel network drivers for Linux, refer to the following
58website. In the search field, enter your adapter name or type, or use the 25website. In the search field, enter your adapter name or type, or use the
59networking link on the left to search for your adapter: 26networking link on the left to search for your adapter:
60 27
61 http://downloadfinder.intel.com/scripts-df/support_intel.asp 28 http://support.intel.com/support/go/network/adapter/home.htm
62
63 29
64Command Line Parameters 30Command Line Parameters
65======================= 31=======================
66 32
67If the driver is built as a module, the following optional parameters
68are used by entering them on the command line with the modprobe command
69using this syntax:
70
71 modprobe e1000 [<option>=<VAL1>,<VAL2>,...]
72
73For example, with two PRO/1000 PCI adapters, entering:
74
75 modprobe e1000 TxDescriptors=80,128
76
77loads the e1000 driver with 80 TX descriptors for the first adapter and
78128 TX descriptors for the second adapter.
79
80The default value for each parameter is generally the recommended setting, 33The default value for each parameter is generally the recommended setting,
81unless otherwise noted. 34unless otherwise noted.
82 35
@@ -89,10 +42,6 @@ NOTES: For more information about the AutoNeg, Duplex, and Speed
89 parameters, see the application note at: 42 parameters, see the application note at:
90 http://www.intel.com/design/network/applnots/ap450.htm 43 http://www.intel.com/design/network/applnots/ap450.htm
91 44
92 A descriptor describes a data buffer and attributes related to
93 the data buffer. This information is accessed by the hardware.
94
95
96AutoNeg 45AutoNeg
97------- 46-------
98(Supported only on adapters with copper connections) 47(Supported only on adapters with copper connections)
@@ -106,7 +55,6 @@ Duplex parameters must not be specified.
106NOTE: Refer to the Speed and Duplex section of this readme for more 55NOTE: Refer to the Speed and Duplex section of this readme for more
107 information on the AutoNeg parameter. 56 information on the AutoNeg parameter.
108 57
109
110Duplex 58Duplex
111------ 59------
112(Supported only on adapters with copper connections) 60(Supported only on adapters with copper connections)
@@ -119,7 +67,6 @@ set to auto-negotiate, the board auto-detects the correct duplex. If the
119link partner is forced (either full or half), Duplex defaults to half- 67link partner is forced (either full or half), Duplex defaults to half-
120duplex. 68duplex.
121 69
122
123FlowControl 70FlowControl
124----------- 71-----------
125Valid Range: 0-3 (0=none, 1=Rx only, 2=Tx only, 3=Rx&Tx) 72Valid Range: 0-3 (0=none, 1=Rx only, 2=Tx only, 3=Rx&Tx)
@@ -128,16 +75,16 @@ Default Value: Reads flow control settings from the EEPROM
128This parameter controls the automatic generation(Tx) and response(Rx) 75This parameter controls the automatic generation(Tx) and response(Rx)
129to Ethernet PAUSE frames. 76to Ethernet PAUSE frames.
130 77
131
132InterruptThrottleRate 78InterruptThrottleRate
133--------------------- 79---------------------
134(not supported on Intel(R) 82542, 82543 or 82544-based adapters) 80(not supported on Intel(R) 82542, 82543 or 82544-based adapters)
135Valid Range: 0,1,3,100-100000 (0=off, 1=dynamic, 3=dynamic conservative) 81Valid Range: 0,1,3,4,100-100000 (0=off, 1=dynamic, 3=dynamic conservative,
82 4=simplified balancing)
136Default Value: 3 83Default Value: 3
137 84
138The driver can limit the amount of interrupts per second that the adapter 85The driver can limit the amount of interrupts per second that the adapter
139will generate for incoming packets. It does this by writing a value to the 86will generate for incoming packets. It does this by writing a value to the
140adapter that is based on the maximum amount of interrupts that the adapter 87adapter that is based on the maximum amount of interrupts that the adapter
141will generate per second. 88will generate per second.
142 89
143Setting InterruptThrottleRate to a value greater or equal to 100 90Setting InterruptThrottleRate to a value greater or equal to 100
@@ -146,37 +93,43 @@ per second, even if more packets have come in. This reduces interrupt
146load on the system and can lower CPU utilization under heavy load, 93load on the system and can lower CPU utilization under heavy load,
147but will increase latency as packets are not processed as quickly. 94but will increase latency as packets are not processed as quickly.
148 95
149The default behaviour of the driver previously assumed a static 96The default behaviour of the driver previously assumed a static
150InterruptThrottleRate value of 8000, providing a good fallback value for 97InterruptThrottleRate value of 8000, providing a good fallback value for
151all traffic types,but lacking in small packet performance and latency. 98all traffic types,but lacking in small packet performance and latency.
152The hardware can handle many more small packets per second however, and 99The hardware can handle many more small packets per second however, and
153for this reason an adaptive interrupt moderation algorithm was implemented. 100for this reason an adaptive interrupt moderation algorithm was implemented.
154 101
155Since 7.3.x, the driver has two adaptive modes (setting 1 or 3) in which 102Since 7.3.x, the driver has two adaptive modes (setting 1 or 3) in which
156it dynamically adjusts the InterruptThrottleRate value based on the traffic 103it dynamically adjusts the InterruptThrottleRate value based on the traffic
157that it receives. After determining the type of incoming traffic in the last 104that it receives. After determining the type of incoming traffic in the last
158timeframe, it will adjust the InterruptThrottleRate to an appropriate value 105timeframe, it will adjust the InterruptThrottleRate to an appropriate value
159for that traffic. 106for that traffic.
160 107
161The algorithm classifies the incoming traffic every interval into 108The algorithm classifies the incoming traffic every interval into
162classes. Once the class is determined, the InterruptThrottleRate value is 109classes. Once the class is determined, the InterruptThrottleRate value is
163adjusted to suit that traffic type the best. There are three classes defined: 110adjusted to suit that traffic type the best. There are three classes defined:
164"Bulk traffic", for large amounts of packets of normal size; "Low latency", 111"Bulk traffic", for large amounts of packets of normal size; "Low latency",
165for small amounts of traffic and/or a significant percentage of small 112for small amounts of traffic and/or a significant percentage of small
166packets; and "Lowest latency", for almost completely small packets or 113packets; and "Lowest latency", for almost completely small packets or
167minimal traffic. 114minimal traffic.
168 115
169In dynamic conservative mode, the InterruptThrottleRate value is set to 4000 116In dynamic conservative mode, the InterruptThrottleRate value is set to 4000
170for traffic that falls in class "Bulk traffic". If traffic falls in the "Low 117for traffic that falls in class "Bulk traffic". If traffic falls in the "Low
171latency" or "Lowest latency" class, the InterruptThrottleRate is increased 118latency" or "Lowest latency" class, the InterruptThrottleRate is increased
172stepwise to 20000. This default mode is suitable for most applications. 119stepwise to 20000. This default mode is suitable for most applications.
173 120
174For situations where low latency is vital such as cluster or 121For situations where low latency is vital such as cluster or
175grid computing, the algorithm can reduce latency even more when 122grid computing, the algorithm can reduce latency even more when
176InterruptThrottleRate is set to mode 1. In this mode, which operates 123InterruptThrottleRate is set to mode 1. In this mode, which operates
177the same as mode 3, the InterruptThrottleRate will be increased stepwise to 124the same as mode 3, the InterruptThrottleRate will be increased stepwise to
17870000 for traffic in class "Lowest latency". 12570000 for traffic in class "Lowest latency".
179 126
127In simplified mode the interrupt rate is based on the ratio of Tx and
128Rx traffic. If the bytes per second rate is approximately equal, the
129interrupt rate will drop as low as 2000 interrupts per second. If the
130traffic is mostly transmit or mostly receive, the interrupt rate could
131be as high as 8000.
132
180Setting InterruptThrottleRate to 0 turns off any interrupt moderation 133Setting InterruptThrottleRate to 0 turns off any interrupt moderation
181and may improve small packet latency, but is generally not suitable 134and may improve small packet latency, but is generally not suitable
182for bulk throughput traffic. 135for bulk throughput traffic.
@@ -212,8 +165,6 @@ NOTE: When e1000 is loaded with default settings and multiple adapters
212 be platform-specific. If CPU utilization is not a concern, use 165 be platform-specific. If CPU utilization is not a concern, use
213 RX_POLLING (NAPI) and default driver settings. 166 RX_POLLING (NAPI) and default driver settings.
214 167
215
216
217RxDescriptors 168RxDescriptors
218------------- 169-------------
219Valid Range: 80-256 for 82542 and 82543-based adapters 170Valid Range: 80-256 for 82542 and 82543-based adapters
@@ -225,15 +176,14 @@ by the driver. Increasing this value allows the driver to buffer more
225incoming packets, at the expense of increased system memory utilization. 176incoming packets, at the expense of increased system memory utilization.
226 177
227Each descriptor is 16 bytes. A receive buffer is also allocated for each 178Each descriptor is 16 bytes. A receive buffer is also allocated for each
228descriptor and can be either 2048, 4096, 8192, or 16384 bytes, depending 179descriptor and can be either 2048, 4096, 8192, or 16384 bytes, depending
229on the MTU setting. The maximum MTU size is 16110. 180on the MTU setting. The maximum MTU size is 16110.
230 181
231NOTE: MTU designates the frame size. It only needs to be set for Jumbo 182NOTE: MTU designates the frame size. It only needs to be set for Jumbo
232 Frames. Depending on the available system resources, the request 183 Frames. Depending on the available system resources, the request
233 for a higher number of receive descriptors may be denied. In this 184 for a higher number of receive descriptors may be denied. In this
234 case, use a lower number. 185 case, use a lower number.
235 186
236
237RxIntDelay 187RxIntDelay
238---------- 188----------
239Valid Range: 0-65535 (0=off) 189Valid Range: 0-65535 (0=off)
@@ -254,7 +204,6 @@ CAUTION: When setting RxIntDelay to a value other than 0, adapters may
254 restoring the network connection. To eliminate the potential 204 restoring the network connection. To eliminate the potential
255 for the hang ensure that RxIntDelay is set to 0. 205 for the hang ensure that RxIntDelay is set to 0.
256 206
257
258RxAbsIntDelay 207RxAbsIntDelay
259------------- 208-------------
260(This parameter is supported only on 82540, 82545 and later adapters.) 209(This parameter is supported only on 82540, 82545 and later adapters.)
@@ -268,7 +217,6 @@ packet is received within the set amount of time. Proper tuning,
268along with RxIntDelay, may improve traffic throughput in specific network 217along with RxIntDelay, may improve traffic throughput in specific network
269conditions. 218conditions.
270 219
271
272Speed 220Speed
273----- 221-----
274(This parameter is supported only on adapters with copper connections.) 222(This parameter is supported only on adapters with copper connections.)
@@ -280,7 +228,6 @@ Speed forces the line speed to the specified value in megabits per second
280partner is set to auto-negotiate, the board will auto-detect the correct 228partner is set to auto-negotiate, the board will auto-detect the correct
281speed. Duplex should also be set when Speed is set to either 10 or 100. 229speed. Duplex should also be set when Speed is set to either 10 or 100.
282 230
283
284TxDescriptors 231TxDescriptors
285------------- 232-------------
286Valid Range: 80-256 for 82542 and 82543-based adapters 233Valid Range: 80-256 for 82542 and 82543-based adapters
@@ -295,6 +242,36 @@ NOTE: Depending on the available system resources, the request for a
295 higher number of transmit descriptors may be denied. In this case, 242 higher number of transmit descriptors may be denied. In this case,
296 use a lower number. 243 use a lower number.
297 244
245TxDescriptorStep
246----------------
247Valid Range: 1 (use every Tx Descriptor)
248 4 (use every 4th Tx Descriptor)
249
250Default Value: 1 (use every Tx Descriptor)
251
252On certain non-Intel architectures, it has been observed that intense TX
253traffic bursts of short packets may result in an improper descriptor
254writeback. If this occurs, the driver will report a "TX Timeout" and reset
255the adapter, after which the transmit flow will restart, though data may
256have stalled for as much as 10 seconds before it resumes.
257
258The improper writeback does not occur on the first descriptor in a system
259memory cache-line, which is typically 32 bytes, or 4 descriptors long.
260
261Setting TxDescriptorStep to a value of 4 will ensure that all TX descriptors
262are aligned to the start of a system memory cache line, and so this problem
263will not occur.
264
265NOTES: Setting TxDescriptorStep to 4 effectively reduces the number of
266 TxDescriptors available for transmits to 1/4 of the normal allocation.
267 This has a possible negative performance impact, which may be
268 compensated for by allocating more descriptors using the TxDescriptors
269 module parameter.
270
271 There are other conditions which may result in "TX Timeout", which will
272 not be resolved by the use of the TxDescriptorStep parameter. As the
273 issue addressed by this parameter has never been observed on Intel
274 Architecture platforms, it should not be used on Intel platforms.
298 275
299TxIntDelay 276TxIntDelay
300---------- 277----------
@@ -307,7 +284,6 @@ efficiency if properly tuned for specific network traffic. If the
307system is reporting dropped transmits, this value may be set too high 284system is reporting dropped transmits, this value may be set too high
308causing the driver to run out of available transmit descriptors. 285causing the driver to run out of available transmit descriptors.
309 286
310
311TxAbsIntDelay 287TxAbsIntDelay
312------------- 288-------------
313(This parameter is supported only on 82540, 82545 and later adapters.) 289(This parameter is supported only on 82540, 82545 and later adapters.)
@@ -330,6 +306,35 @@ Default Value: 1
330A value of '1' indicates that the driver should enable IP checksum 306A value of '1' indicates that the driver should enable IP checksum
331offload for received packets (both UDP and TCP) to the adapter hardware. 307offload for received packets (both UDP and TCP) to the adapter hardware.
332 308
309Copybreak
310---------
311Valid Range: 0-xxxxxxx (0=off)
312Default Value: 256
313Usage: insmod e1000.ko copybreak=128
314
315Driver copies all packets below or equaling this size to a fresh Rx
316buffer before handing it up the stack.
317
318This parameter is different than other parameters, in that it is a
319single (not 1,1,1 etc.) parameter applied to all driver instances and
320it is also available during runtime at
321/sys/module/e1000/parameters/copybreak
322
323SmartPowerDownEnable
324--------------------
325Valid Range: 0-1
326Default Value: 0 (disabled)
327
328Allows PHY to turn off in lower power states. The user can turn off
329this parameter in supported chipsets.
330
331KumeranLockLoss
332---------------
333Valid Range: 0-1
334Default Value: 1 (enabled)
335
336This workaround skips resetting the PHY at shutdown for the initial
337silicon releases of ICH8 systems.
333 338
334Speed and Duplex Configuration 339Speed and Duplex Configuration
335============================== 340==============================
@@ -385,40 +390,9 @@ If the link partner is forced to a specific speed and duplex, then this
385parameter should not be used. Instead, use the Speed and Duplex parameters 390parameter should not be used. Instead, use the Speed and Duplex parameters
386previously mentioned to force the adapter to the same speed and duplex. 391previously mentioned to force the adapter to the same speed and duplex.
387 392
388
389Additional Configurations 393Additional Configurations
390========================= 394=========================
391 395
392 Configuring the Driver on Different Distributions
393 -------------------------------------------------
394 Configuring a network driver to load properly when the system is started
395 is distribution dependent. Typically, the configuration process involves
396 adding an alias line to /etc/modules.conf or /etc/modprobe.conf as well
397 as editing other system startup scripts and/or configuration files. Many
398 popular Linux distributions ship with tools to make these changes for you.
399 To learn the proper way to configure a network device for your system,
400 refer to your distribution documentation. If during this process you are
401 asked for the driver or module name, the name for the Linux Base Driver
402 for the Intel(R) PRO/1000 Family of Adapters is e1000.
403
404 As an example, if you install the e1000 driver for two PRO/1000 adapters
405 (eth0 and eth1) and set the speed and duplex to 10full and 100half, add
406 the following to modules.conf or or modprobe.conf:
407
408 alias eth0 e1000
409 alias eth1 e1000
410 options e1000 Speed=10,100 Duplex=2,1
411
412 Viewing Link Messages
413 ---------------------
414 Link messages will not be displayed to the console if the distribution is
415 restricting system messages. In order to see network driver link messages
416 on your console, set dmesg to eight by entering the following:
417
418 dmesg -n 8
419
420 NOTE: This setting is not saved across reboots.
421
422 Jumbo Frames 396 Jumbo Frames
423 ------------ 397 ------------
424 Jumbo Frames support is enabled by changing the MTU to a value larger than 398 Jumbo Frames support is enabled by changing the MTU to a value larger than
@@ -437,9 +411,11 @@ Additional Configurations
437 setting in a different location. 411 setting in a different location.
438 412
439 Notes: 413 Notes:
440 414 Degradation in throughput performance may be observed in some Jumbo frames
441 - To enable Jumbo Frames, increase the MTU size on the interface beyond 415 environments. If this is observed, increasing the application's socket buffer
442 1500. 416 size and/or increasing the /proc/sys/net/ipv4/tcp_*mem entry values may help.
417 See the specific application manual and /usr/src/linux*/Documentation/
418 networking/ip-sysctl.txt for more details.
443 419
444 - The maximum MTU setting for Jumbo Frames is 16110. This value coincides 420 - The maximum MTU setting for Jumbo Frames is 16110. This value coincides
445 with the maximum Jumbo Frames size of 16128. 421 with the maximum Jumbo Frames size of 16128.
@@ -447,40 +423,11 @@ Additional Configurations
447 - Using Jumbo Frames at 10 or 100 Mbps may result in poor performance or 423 - Using Jumbo Frames at 10 or 100 Mbps may result in poor performance or
448 loss of link. 424 loss of link.
449 425
450 - Some Intel gigabit adapters that support Jumbo Frames have a frame size
451 limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes.
452 The adapters with this limitation are based on the Intel(R) 82571EB,
453 82572EI, 82573L and 80003ES2LAN controller. These correspond to the
454 following product names:
455 Intel(R) PRO/1000 PT Server Adapter
456 Intel(R) PRO/1000 PT Desktop Adapter
457 Intel(R) PRO/1000 PT Network Connection
458 Intel(R) PRO/1000 PT Dual Port Server Adapter
459 Intel(R) PRO/1000 PT Dual Port Network Connection
460 Intel(R) PRO/1000 PF Server Adapter
461 Intel(R) PRO/1000 PF Network Connection
462 Intel(R) PRO/1000 PF Dual Port Server Adapter
463 Intel(R) PRO/1000 PB Server Connection
464 Intel(R) PRO/1000 PL Network Connection
465 Intel(R) PRO/1000 EB Network Connection with I/O Acceleration
466 Intel(R) PRO/1000 EB Backplane Connection with I/O Acceleration
467 Intel(R) PRO/1000 PT Quad Port Server Adapter
468
469 - Adapters based on the Intel(R) 82542 and 82573V/E controller do not 426 - Adapters based on the Intel(R) 82542 and 82573V/E controller do not
470 support Jumbo Frames. These correspond to the following product names: 427 support Jumbo Frames. These correspond to the following product names:
471 Intel(R) PRO/1000 Gigabit Server Adapter 428 Intel(R) PRO/1000 Gigabit Server Adapter
472 Intel(R) PRO/1000 PM Network Connection 429 Intel(R) PRO/1000 PM Network Connection
473 430
474 - The following adapters do not support Jumbo Frames:
475 Intel(R) 82562V 10/100 Network Connection
476 Intel(R) 82566DM Gigabit Network Connection
477 Intel(R) 82566DC Gigabit Network Connection
478 Intel(R) 82566MM Gigabit Network Connection
479 Intel(R) 82566MC Gigabit Network Connection
480 Intel(R) 82562GT 10/100 Network Connection
481 Intel(R) 82562G 10/100 Network Connection
482
483
484 Ethtool 431 Ethtool
485 ------- 432 -------
486 The driver utilizes the ethtool interface for driver configuration and 433 The driver utilizes the ethtool interface for driver configuration and
@@ -490,142 +437,14 @@ Additional Configurations
490 The latest release of ethtool can be found from 437 The latest release of ethtool can be found from
491 http://sourceforge.net/projects/gkernel. 438 http://sourceforge.net/projects/gkernel.
492 439
493 NOTE: Ethtool 1.6 only supports a limited set of ethtool options. Support
494 for a more complete ethtool feature set can be enabled by upgrading
495 ethtool to ethtool-1.8.1.
496
497 Enabling Wake on LAN* (WoL) 440 Enabling Wake on LAN* (WoL)
498 --------------------------- 441 ---------------------------
499 WoL is configured through the Ethtool* utility. Ethtool is included with 442 WoL is configured through the Ethtool* utility.
500 all versions of Red Hat after Red Hat 7.2. For other Linux distributions,
501 download and install Ethtool from the following website:
502 http://sourceforge.net/projects/gkernel.
503
504 For instructions on enabling WoL with Ethtool, refer to the website listed
505 above.
506 443
507 WoL will be enabled on the system during the next shut down or reboot. 444 WoL will be enabled on the system during the next shut down or reboot.
508 For this driver version, in order to enable WoL, the e1000 driver must be 445 For this driver version, in order to enable WoL, the e1000 driver must be
509 loaded when shutting down or rebooting the system. 446 loaded when shutting down or rebooting the system.
510 447
511 Wake On LAN is only supported on port A for the following devices:
512 Intel(R) PRO/1000 PT Dual Port Network Connection
513 Intel(R) PRO/1000 PT Dual Port Server Connection
514 Intel(R) PRO/1000 PT Dual Port Server Adapter
515 Intel(R) PRO/1000 PF Dual Port Server Adapter
516 Intel(R) PRO/1000 PT Quad Port Server Adapter
517
518 NAPI
519 ----
520 NAPI (Rx polling mode) is enabled in the e1000 driver.
521
522 See www.cyberus.ca/~hadi/usenix-paper.tgz for more information on NAPI.
523
524
525Known Issues
526============
527
528Dropped Receive Packets on Half-duplex 10/100 Networks
529------------------------------------------------------
530If you have an Intel PCI Express adapter running at 10mbps or 100mbps, half-
531duplex, you may observe occasional dropped receive packets. There are no
532workarounds for this problem in this network configuration. The network must
533be updated to operate in full-duplex, and/or 1000mbps only.
534
535Jumbo Frames System Requirement
536-------------------------------
537Memory allocation failures have been observed on Linux systems with 64 MB
538of RAM or less that are running Jumbo Frames. If you are using Jumbo
539Frames, your system may require more than the advertised minimum
540requirement of 64 MB of system memory.
541
542Performance Degradation with Jumbo Frames
543-----------------------------------------
544Degradation in throughput performance may be observed in some Jumbo frames
545environments. If this is observed, increasing the application's socket
546buffer size and/or increasing the /proc/sys/net/ipv4/tcp_*mem entry values
547may help. See the specific application manual and
548/usr/src/linux*/Documentation/
549networking/ip-sysctl.txt for more details.
550
551Jumbo Frames on Foundry BigIron 8000 switch
552-------------------------------------------
553There is a known issue using Jumbo frames when connected to a Foundry
554BigIron 8000 switch. This is a 3rd party limitation. If you experience
555loss of packets, lower the MTU size.
556
557Allocating Rx Buffers when Using Jumbo Frames
558---------------------------------------------
559Allocating Rx buffers when using Jumbo Frames on 2.6.x kernels may fail if
560the available memory is heavily fragmented. This issue may be seen with PCI-X
561adapters or with packet split disabled. This can be reduced or eliminated
562by changing the amount of available memory for receive buffer allocation, by
563increasing /proc/sys/vm/min_free_kbytes.
564
565Multiple Interfaces on Same Ethernet Broadcast Network
566------------------------------------------------------
567Due to the default ARP behavior on Linux, it is not possible to have
568one system on two IP networks in the same Ethernet broadcast domain
569(non-partitioned switch) behave as expected. All Ethernet interfaces
570will respond to IP traffic for any IP address assigned to the system.
571This results in unbalanced receive traffic.
572
573If you have multiple interfaces in a server, either turn on ARP
574filtering by entering:
575
576 echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter
577(this only works if your kernel's version is higher than 2.4.5),
578
579NOTE: This setting is not saved across reboots. The configuration
580change can be made permanent by adding the line:
581 net.ipv4.conf.all.arp_filter = 1
582to the file /etc/sysctl.conf
583
584 or,
585
586install the interfaces in separate broadcast domains (either in
587different switches or in a switch partitioned to VLANs).
588
58982541/82547 can't link or are slow to link with some link partners
590-----------------------------------------------------------------
591There is a known compatibility issue with 82541/82547 and some
592low-end switches where the link will not be established, or will
593be slow to establish. In particular, these switches are known to
594be incompatible with 82541/82547:
595
596 Planex FXG-08TE
597 I-O Data ETG-SH8
598
599To workaround this issue, the driver can be compiled with an override
600of the PHY's master/slave setting. Forcing master or forcing slave
601mode will improve time-to-link.
602
603 # make CFLAGS_EXTRA=-DE1000_MASTER_SLAVE=<n>
604
605Where <n> is:
606
607 0 = Hardware default
608 1 = Master mode
609 2 = Slave mode
610 3 = Auto master/slave
611
612Disable rx flow control with ethtool
613------------------------------------
614In order to disable receive flow control using ethtool, you must turn
615off auto-negotiation on the same command line.
616
617For example:
618
619 ethtool -A eth? autoneg off rx off
620
621Unplugging network cable while ethtool -p is running
622----------------------------------------------------
623In kernel versions 2.5.50 and later (including 2.6 kernel), unplugging
624the network cable while ethtool -p is running will cause the system to
625become unresponsive to keyboard commands, except for control-alt-delete.
626Restarting the system appears to be the only remedy.
627
628
629Support 448Support
630======= 449=======
631 450
diff --git a/Documentation/networking/e1000e.txt b/Documentation/networking/e1000e.txt
new file mode 100644
index 000000000000..6aa048badf32
--- /dev/null
+++ b/Documentation/networking/e1000e.txt
@@ -0,0 +1,302 @@
1Linux* Driver for Intel(R) Network Connection
2===============================================================
3
4Intel Gigabit Linux driver.
5Copyright(c) 1999 - 2010 Intel Corporation.
6
7Contents
8========
9
10- Identifying Your Adapter
11- Command Line Parameters
12- Additional Configurations
13- Support
14
15Identifying Your Adapter
16========================
17
18The e1000e driver supports all PCI Express Intel(R) Gigabit Network
19Connections, except those that are 82575, 82576 and 82580-based*.
20
21* NOTE: The Intel(R) PRO/1000 P Dual Port Server Adapter is supported by
22 the e1000 driver, not the e1000e driver due to the 82546 part being used
23 behind a PCI Express bridge.
24
25For more information on how to identify your adapter, go to the Adapter &
26Driver ID Guide at:
27
28 http://support.intel.com/support/go/network/adapter/idguide.htm
29
30For the latest Intel network drivers for Linux, refer to the following
31website. In the search field, enter your adapter name or type, or use the
32networking link on the left to search for your adapter:
33
34 http://support.intel.com/support/go/network/adapter/home.htm
35
36Command Line Parameters
37=======================
38
39The default value for each parameter is generally the recommended setting,
40unless otherwise noted.
41
42NOTES: For more information about the InterruptThrottleRate,
43 RxIntDelay, TxIntDelay, RxAbsIntDelay, and TxAbsIntDelay
44 parameters, see the application note at:
45 http://www.intel.com/design/network/applnots/ap450.htm
46
47InterruptThrottleRate
48---------------------
49Valid Range: 0,1,3,4,100-100000 (0=off, 1=dynamic, 3=dynamic conservative,
50 4=simplified balancing)
51Default Value: 3
52
53The driver can limit the amount of interrupts per second that the adapter
54will generate for incoming packets. It does this by writing a value to the
55adapter that is based on the maximum amount of interrupts that the adapter
56will generate per second.
57
58Setting InterruptThrottleRate to a value greater or equal to 100
59will program the adapter to send out a maximum of that many interrupts
60per second, even if more packets have come in. This reduces interrupt
61load on the system and can lower CPU utilization under heavy load,
62but will increase latency as packets are not processed as quickly.
63
64The driver has two adaptive modes (setting 1 or 3) in which
65it dynamically adjusts the InterruptThrottleRate value based on the traffic
66that it receives. After determining the type of incoming traffic in the last
67timeframe, it will adjust the InterruptThrottleRate to an appropriate value
68for that traffic.
69
70The algorithm classifies the incoming traffic every interval into
71classes. Once the class is determined, the InterruptThrottleRate value is
72adjusted to suit that traffic type the best. There are three classes defined:
73"Bulk traffic", for large amounts of packets of normal size; "Low latency",
74for small amounts of traffic and/or a significant percentage of small
75packets; and "Lowest latency", for almost completely small packets or
76minimal traffic.
77
78In dynamic conservative mode, the InterruptThrottleRate value is set to 4000
79for traffic that falls in class "Bulk traffic". If traffic falls in the "Low
80latency" or "Lowest latency" class, the InterruptThrottleRate is increased
81stepwise to 20000. This default mode is suitable for most applications.
82
83For situations where low latency is vital such as cluster or
84grid computing, the algorithm can reduce latency even more when
85InterruptThrottleRate is set to mode 1. In this mode, which operates
86the same as mode 3, the InterruptThrottleRate will be increased stepwise to
8770000 for traffic in class "Lowest latency".
88
89In simplified mode the interrupt rate is based on the ratio of Tx and
90Rx traffic. If the bytes per second rate is approximately equal the
91interrupt rate will drop as low as 2000 interrupts per second. If the
92traffic is mostly transmit or mostly receive, the interrupt rate could
93be as high as 8000.
94
95Setting InterruptThrottleRate to 0 turns off any interrupt moderation
96and may improve small packet latency, but is generally not suitable
97for bulk throughput traffic.
98
99NOTE: InterruptThrottleRate takes precedence over the TxAbsIntDelay and
100 RxAbsIntDelay parameters. In other words, minimizing the receive
101 and/or transmit absolute delays does not force the controller to
102 generate more interrupts than what the Interrupt Throttle Rate
103 allows.
104
105NOTE: When e1000e is loaded with default settings and multiple adapters
106 are in use simultaneously, the CPU utilization may increase non-
107 linearly. In order to limit the CPU utilization without impacting
108 the overall throughput, we recommend that you load the driver as
109 follows:
110
111 modprobe e1000e InterruptThrottleRate=3000,3000,3000
112
113 This sets the InterruptThrottleRate to 3000 interrupts/sec for
114 the first, second, and third instances of the driver. The range
115 of 2000 to 3000 interrupts per second works on a majority of
116 systems and is a good starting point, but the optimal value will
117 be platform-specific. If CPU utilization is not a concern, use
118 RX_POLLING (NAPI) and default driver settings.
119
120RxIntDelay
121----------
122Valid Range: 0-65535 (0=off)
123Default Value: 0
124
125This value delays the generation of receive interrupts in units of 1.024
126microseconds. Receive interrupt reduction can improve CPU efficiency if
127properly tuned for specific network traffic. Increasing this value adds
128extra latency to frame reception and can end up decreasing the throughput
129of TCP traffic. If the system is reporting dropped receives, this value
130may be set too high, causing the driver to run out of available receive
131descriptors.
132
133CAUTION: When setting RxIntDelay to a value other than 0, adapters may
134 hang (stop transmitting) under certain network conditions. If
135 this occurs a NETDEV WATCHDOG message is logged in the system
136 event log. In addition, the controller is automatically reset,
137 restoring the network connection. To eliminate the potential
138 for the hang ensure that RxIntDelay is set to 0.
139
140RxAbsIntDelay
141-------------
142Valid Range: 0-65535 (0=off)
143Default Value: 8
144
145This value, in units of 1.024 microseconds, limits the delay in which a
146receive interrupt is generated. Useful only if RxIntDelay is non-zero,
147this value ensures that an interrupt is generated after the initial
148packet is received within the set amount of time. Proper tuning,
149along with RxIntDelay, may improve traffic throughput in specific network
150conditions.
151
152TxIntDelay
153----------
154Valid Range: 0-65535 (0=off)
155Default Value: 8
156
157This value delays the generation of transmit interrupts in units of
1581.024 microseconds. Transmit interrupt reduction can improve CPU
159efficiency if properly tuned for specific network traffic. If the
160system is reporting dropped transmits, this value may be set too high
161causing the driver to run out of available transmit descriptors.
162
163TxAbsIntDelay
164-------------
165Valid Range: 0-65535 (0=off)
166Default Value: 32
167
168This value, in units of 1.024 microseconds, limits the delay in which a
169transmit interrupt is generated. Useful only if TxIntDelay is non-zero,
170this value ensures that an interrupt is generated after the initial
171packet is sent on the wire within the set amount of time. Proper tuning,
172along with TxIntDelay, may improve traffic throughput in specific
173network conditions.
174
175Copybreak
176---------
177Valid Range: 0-xxxxxxx (0=off)
178Default Value: 256
179
180Driver copies all packets below or equaling this size to a fresh Rx
181buffer before handing it up the stack.
182
183This parameter is different than other parameters, in that it is a
184single (not 1,1,1 etc.) parameter applied to all driver instances and
185it is also available during runtime at
186/sys/module/e1000e/parameters/copybreak
187
188SmartPowerDownEnable
189--------------------
190Valid Range: 0-1
191Default Value: 0 (disabled)
192
193Allows PHY to turn off in lower power states. The user can set this parameter
194in supported chipsets.
195
196KumeranLockLoss
197---------------
198Valid Range: 0-1
199Default Value: 1 (enabled)
200
201This workaround skips resetting the PHY at shutdown for the initial
202silicon releases of ICH8 systems.
203
204IntMode
205-------
206Valid Range: 0-2 (0=legacy, 1=MSI, 2=MSI-X)
207Default Value: 2
208
209Allows changing the interrupt mode at module load time, without requiring a
210recompile. If the driver load fails to enable a specific interrupt mode, the
211driver will try other interrupt modes, from least to most compatible. The
212interrupt order is MSI-X, MSI, Legacy. If specifying MSI (IntMode=1)
213interrupts, only MSI and Legacy will be attempted.
214
215CrcStripping
216------------
217Valid Range: 0-1
218Default Value: 1 (enabled)
219
220Strip the CRC from received packets before sending up the network stack. If
221you have a machine with a BMC enabled but cannot receive IPMI traffic after
222loading or enabling the driver, try disabling this feature.
223
224WriteProtectNVM
225---------------
226Valid Range: 0-1
227Default Value: 1 (enabled)
228
229Set the hardware to ignore all write/erase cycles to the GbE region in the
230ICHx NVM (non-volatile memory). This feature can be disabled by the
231WriteProtectNVM module parameter (enabled by default) only after a hardware
232reset, but the machine must be power cycled before trying to enable writes.
233
234Note: the kernel boot option iomem=relaxed may need to be set if the kernel
235config option CONFIG_STRICT_DEVMEM=y, if the root user wants to write the
236NVM from user space via ethtool.
237
238Additional Configurations
239=========================
240
241 Jumbo Frames
242 ------------
243 Jumbo Frames support is enabled by changing the MTU to a value larger than
244 the default of 1500. Use the ifconfig command to increase the MTU size.
245 For example:
246
247 ifconfig eth<x> mtu 9000 up
248
249 This setting is not saved across reboots.
250
251 Notes:
252
253 - The maximum MTU setting for Jumbo Frames is 9216. This value coincides
254 with the maximum Jumbo Frames size of 9234 bytes.
255
256 - Using Jumbo Frames at 10 or 100 Mbps is not supported and may result in
257 poor performance or loss of link.
258
259 - Some adapters limit Jumbo Frames sized packets to a maximum of
260 4096 bytes and some adapters do not support Jumbo Frames.
261
262
263 Ethtool
264 -------
265 The driver utilizes the ethtool interface for driver configuration and
266 diagnostics, as well as displaying statistical information. We
267 strongly recommend downloading the latest version of Ethtool at:
268
269 http://sourceforge.net/projects/gkernel.
270
271 Speed and Duplex
272 ----------------
273 Speed and Duplex are configured through the Ethtool* utility. For
274 instructions, refer to the Ethtool man page.
275
276 Enabling Wake on LAN* (WoL)
277 ---------------------------
278 WoL is configured through the Ethtool* utility. For instructions on
279 enabling WoL with Ethtool, refer to the Ethtool man page.
280
281 WoL will be enabled on the system during the next shut down or reboot.
282 For this driver version, in order to enable WoL, the e1000e driver must be
283 loaded when shutting down or rebooting the system.
284
285 In most cases Wake On LAN is only supported on port A for multiple port
286 adapters. To verify if a port supports Wake on LAN run ethtool eth<X>.
287
288
289Support
290=======
291
292For general information, go to the Intel support website at:
293
294 www.intel.com/support/
295
296or the Intel Wired Networking project hosted by Sourceforge at:
297
298 http://sourceforge.net/projects/e1000
299
300If an issue is identified with the released source code on the supported
301kernel with a supported adapter, email the specific information related
302to the issue to e1000-devel@lists.sf.net
diff --git a/Documentation/networking/ixgbevf.txt b/Documentation/networking/ixgbevf.txt
index 19015de6725f..21dd5d15b6b4 100755..100644
--- a/Documentation/networking/ixgbevf.txt
+++ b/Documentation/networking/ixgbevf.txt
@@ -1,19 +1,16 @@
1Linux* Base Driver for Intel(R) Network Connection 1Linux* Base Driver for Intel(R) Network Connection
2================================================== 2==================================================
3 3
4November 24, 2009 4Intel Gigabit Linux driver.
5Copyright(c) 1999 - 2010 Intel Corporation.
5 6
6Contents 7Contents
7======== 8========
8 9
9- In This Release
10- Identifying Your Adapter 10- Identifying Your Adapter
11- Known Issues/Troubleshooting 11- Known Issues/Troubleshooting
12- Support 12- Support
13 13
14In This Release
15===============
16
17This file describes the ixgbevf Linux* Base Driver for Intel Network 14This file describes the ixgbevf Linux* Base Driver for Intel Network
18Connection. 15Connection.
19 16
@@ -33,7 +30,7 @@ Identifying Your Adapter
33For more information on how to identify your adapter, go to the Adapter & 30For more information on how to identify your adapter, go to the Adapter &
34Driver ID Guide at: 31Driver ID Guide at:
35 32
36 http://support.intel.com/support/network/sb/CS-008441.htm 33 http://support.intel.com/support/go/network/adapter/idguide.htm
37 34
38Known Issues/Troubleshooting 35Known Issues/Troubleshooting
39============================ 36============================
@@ -57,34 +54,3 @@ or the Intel Wired Networking project hosted by Sourceforge at:
57If an issue is identified with the released source code on the supported 54If an issue is identified with the released source code on the supported
58kernel with a supported adapter, email the specific information related 55kernel with a supported adapter, email the specific information related
59to the issue to e1000-devel@lists.sf.net 56to the issue to e1000-devel@lists.sf.net
60
61License
62=======
63
64Intel 10 Gigabit Linux driver.
65Copyright(c) 1999 - 2009 Intel Corporation.
66
67This program is free software; you can redistribute it and/or modify it
68under the terms and conditions of the GNU General Public License,
69version 2, as published by the Free Software Foundation.
70
71This program is distributed in the hope it will be useful, but WITHOUT
72ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
73FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
74more details.
75
76You should have received a copy of the GNU General Public License along with
77this program; if not, write to the Free Software Foundation, Inc.,
7851 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
79
80The full GNU General Public License is included in this distribution in
81the file called "COPYING".
82
83Trademarks
84==========
85
86Intel, Itanium, and Pentium are trademarks or registered trademarks of
87Intel Corporation or its subsidiaries in the United States and other
88countries.
89
90* Other names and brands may be claimed as the property of others.
diff --git a/Documentation/vm/page-types.c b/Documentation/vm/page-types.c
index ccd951fa94ee..cc96ee2666f2 100644
--- a/Documentation/vm/page-types.c
+++ b/Documentation/vm/page-types.c
@@ -478,7 +478,7 @@ static void prepare_hwpoison_fd(void)
478 } 478 }
479 479
480 if (opt_unpoison && !hwpoison_forget_fd) { 480 if (opt_unpoison && !hwpoison_forget_fd) {
481 sprintf(buf, "%s/renew-pfn", hwpoison_debug_fs); 481 sprintf(buf, "%s/unpoison-pfn", hwpoison_debug_fs);
482 hwpoison_forget_fd = checked_open(buf, O_WRONLY); 482 hwpoison_forget_fd = checked_open(buf, O_WRONLY);
483 } 483 }
484} 484}
diff --git a/MAINTAINERS b/MAINTAINERS
index 668682d1f5fa..8395f2eeb782 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -962,6 +962,23 @@ W: http://www.fluff.org/ben/linux/
962S: Maintained 962S: Maintained
963F: arch/arm/mach-s3c6410/ 963F: arch/arm/mach-s3c6410/
964 964
965ARM/S5P ARM ARCHITECTURES
966M: Kukjin Kim <kgene.kim@samsung.com>
967L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
968L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
969S: Maintained
970F: arch/arm/mach-s5p*/
971
972ARM/SAMSUNG S5P SERIES FIMC SUPPORT
973M: Kyungmin Park <kyungmin.park@samsung.com>
974M: Sylwester Nawrocki <s.nawrocki@samsung.com>
975L: linux-arm-kernel@lists.infradead.org
976L: linux-media@vger.kernel.org
977S: Maintained
978F: arch/arm/plat-s5p/dev-fimc*
979F: arch/arm/plat-samsung/include/plat/*fimc*
980F: drivers/media/video/s5p-fimc/
981
965ARM/SHMOBILE ARM ARCHITECTURE 982ARM/SHMOBILE ARM ARCHITECTURE
966M: Paul Mundt <lethal@linux-sh.org> 983M: Paul Mundt <lethal@linux-sh.org>
967M: Magnus Damm <magnus.damm@gmail.com> 984M: Magnus Damm <magnus.damm@gmail.com>
@@ -973,11 +990,23 @@ S: Supported
973F: arch/arm/mach-shmobile/ 990F: arch/arm/mach-shmobile/
974F: drivers/sh/ 991F: drivers/sh/
975 992
993ARM/TELECHIPS ARM ARCHITECTURE
994M: "Hans J. Koch" <hjk@linutronix.de>
995L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
996S: Maintained
997F: arch/arm/plat-tcc/
998F: arch/arm/mach-tcc8k/
999
976ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT 1000ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
977M: Lennert Buytenhek <kernel@wantstofly.org> 1001M: Lennert Buytenhek <kernel@wantstofly.org>
978L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1002L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
979S: Maintained 1003S: Maintained
980 1004
1005ARM/TETON BGA MACHINE SUPPORT
1006M: Mark F. Brown <mark.brown314@gmail.com>
1007L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1008S: Maintained
1009
981ARM/THECUS N2100 MACHINE SUPPORT 1010ARM/THECUS N2100 MACHINE SUPPORT
982M: Lennert Buytenhek <kernel@wantstofly.org> 1011M: Lennert Buytenhek <kernel@wantstofly.org>
983L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1012L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -2528,7 +2557,7 @@ S: Supported
2528F: drivers/scsi/gdt* 2557F: drivers/scsi/gdt*
2529 2558
2530GENERIC GPIO I2C DRIVER 2559GENERIC GPIO I2C DRIVER
2531M: Haavard Skinnemoen <hskinnemoen@atmel.com> 2560M: Haavard Skinnemoen <hskinnemoen@gmail.com>
2532S: Supported 2561S: Supported
2533F: drivers/i2c/busses/i2c-gpio.c 2562F: drivers/i2c/busses/i2c-gpio.c
2534F: include/linux/i2c-gpio.h 2563F: include/linux/i2c-gpio.h
@@ -3056,16 +3085,27 @@ L: netdev@vger.kernel.org
3056S: Maintained 3085S: Maintained
3057F: drivers/net/ixp2000/ 3086F: drivers/net/ixp2000/
3058 3087
3059INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/igbvf/ixgb/ixgbe) 3088INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/igbvf/ixgb/ixgbe/ixgbevf)
3060M: Jeff Kirsher <jeffrey.t.kirsher@intel.com> 3089M: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
3061M: Jesse Brandeburg <jesse.brandeburg@intel.com> 3090M: Jesse Brandeburg <jesse.brandeburg@intel.com>
3062M: Bruce Allan <bruce.w.allan@intel.com> 3091M: Bruce Allan <bruce.w.allan@intel.com>
3063M: Alex Duyck <alexander.h.duyck@intel.com> 3092M: Carolyn Wyborny <carolyn.wyborny@intel.com>
3093M: Don Skidmore <donald.c.skidmore@intel.com>
3094M: Greg Rose <gregory.v.rose@intel.com>
3064M: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com> 3095M: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
3096M: Alex Duyck <alexander.h.duyck@intel.com>
3065M: John Ronciak <john.ronciak@intel.com> 3097M: John Ronciak <john.ronciak@intel.com>
3066L: e1000-devel@lists.sourceforge.net 3098L: e1000-devel@lists.sourceforge.net
3067W: http://e1000.sourceforge.net/ 3099W: http://e1000.sourceforge.net/
3068S: Supported 3100S: Supported
3101F: Documentation/networking/e100.txt
3102F: Documentation/networking/e1000.txt
3103F: Documentation/networking/e1000e.txt
3104F: Documentation/networking/igb.txt
3105F: Documentation/networking/igbvf.txt
3106F: Documentation/networking/ixgb.txt
3107F: Documentation/networking/ixgbe.txt
3108F: Documentation/networking/ixgbevf.txt
3069F: drivers/net/e100.c 3109F: drivers/net/e100.c
3070F: drivers/net/e1000/ 3110F: drivers/net/e1000/
3071F: drivers/net/e1000e/ 3111F: drivers/net/e1000e/
@@ -3073,6 +3113,7 @@ F: drivers/net/igb/
3073F: drivers/net/igbvf/ 3113F: drivers/net/igbvf/
3074F: drivers/net/ixgb/ 3114F: drivers/net/ixgb/
3075F: drivers/net/ixgbe/ 3115F: drivers/net/ixgbe/
3116F: drivers/net/ixgbevf/
3076 3117
3077INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT 3118INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT
3078L: linux-wireless@vger.kernel.org 3119L: linux-wireless@vger.kernel.org
@@ -3781,9 +3822,8 @@ W: http://www.syskonnect.com
3781S: Supported 3822S: Supported
3782 3823
3783MATROX FRAMEBUFFER DRIVER 3824MATROX FRAMEBUFFER DRIVER
3784M: Petr Vandrovec <vandrove@vc.cvut.cz>
3785L: linux-fbdev@vger.kernel.org 3825L: linux-fbdev@vger.kernel.org
3786S: Maintained 3826S: Orphan
3787F: drivers/video/matrox/matroxfb_* 3827F: drivers/video/matrox/matroxfb_*
3788F: include/linux/matroxfb.h 3828F: include/linux/matroxfb.h
3789 3829
@@ -3970,8 +4010,8 @@ S: Maintained
3970F: drivers/net/natsemi.c 4010F: drivers/net/natsemi.c
3971 4011
3972NCP FILESYSTEM 4012NCP FILESYSTEM
3973M: Petr Vandrovec <vandrove@vc.cvut.cz> 4013M: Petr Vandrovec <petr@vandrovec.name>
3974S: Maintained 4014S: Odd Fixes
3975F: fs/ncpfs/ 4015F: fs/ncpfs/
3976 4016
3977NCR DUAL 700 SCSI DRIVER (MICROCHANNEL) 4017NCR DUAL 700 SCSI DRIVER (MICROCHANNEL)
@@ -5002,6 +5042,12 @@ F: drivers/media/common/saa7146*
5002F: drivers/media/video/*7146* 5042F: drivers/media/video/*7146*
5003F: include/media/*7146* 5043F: include/media/*7146*
5004 5044
5045SAMSUNG AUDIO (ASoC) DRIVERS
5046M: Jassi Brar <jassi.brar@samsung.com>
5047L: alsa-devel@alsa-project.org (moderated for non-subscribers)
5048S: Supported
5049F: sound/soc/s3c24xx
5050
5005TLG2300 VIDEO4LINUX-2 DRIVER 5051TLG2300 VIDEO4LINUX-2 DRIVER
5006M: Huang Shijie <shijie8@gmail.com> 5052M: Huang Shijie <shijie8@gmail.com>
5007M: Kang Yong <kangyong@telegent.com> 5053M: Kang Yong <kangyong@telegent.com>
@@ -6444,8 +6490,10 @@ F: include/linux/wm97xx.h
6444WOLFSON MICROELECTRONICS DRIVERS 6490WOLFSON MICROELECTRONICS DRIVERS
6445M: Mark Brown <broonie@opensource.wolfsonmicro.com> 6491M: Mark Brown <broonie@opensource.wolfsonmicro.com>
6446M: Ian Lartey <ian@opensource.wolfsonmicro.com> 6492M: Ian Lartey <ian@opensource.wolfsonmicro.com>
6493M: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
6494T: git git://opensource.wolfsonmicro.com/linux-2.6-asoc
6447T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus 6495T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus
6448W: http://opensource.wolfsonmicro.com/node/8 6496W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices
6449S: Supported 6497S: Supported
6450F: Documentation/hwmon/wm83?? 6498F: Documentation/hwmon/wm83??
6451F: drivers/leds/leds-wm83*.c 6499F: drivers/leds/leds-wm83*.c
diff --git a/Makefile b/Makefile
index cf7fcb3bf245..97eb76f1f0df 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 36 3SUBLEVEL = 36
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc8
5NAME = Sheep on Meth 5NAME = Flesh-Eating Bats with Fangs
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
index d290845aef59..6f7feb5db271 100644
--- a/arch/alpha/kernel/signal.c
+++ b/arch/alpha/kernel/signal.c
@@ -48,7 +48,7 @@ SYSCALL_DEFINE2(osf_sigprocmask, int, how, unsigned long, newmask)
48 sigset_t mask; 48 sigset_t mask;
49 unsigned long res; 49 unsigned long res;
50 50
51 siginitset(&mask, newmask & ~_BLOCKABLE); 51 siginitset(&mask, newmask & _BLOCKABLE);
52 res = sigprocmask(how, &mask, &oldmask); 52 res = sigprocmask(how, &mask, &oldmask);
53 if (!res) { 53 if (!res) {
54 force_successful_syscall_return(); 54 force_successful_syscall_return();
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b404e5eec0c1..19792a9192b7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -516,6 +516,7 @@ config ARCH_MMP
516 select GENERIC_CLOCKEVENTS 516 select GENERIC_CLOCKEVENTS
517 select TICK_ONESHOT 517 select TICK_ONESHOT
518 select PLAT_PXA 518 select PLAT_PXA
519 select SPARSE_IRQ
519 help 520 help
520 Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line. 521 Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line.
521 522
@@ -593,6 +594,7 @@ config ARCH_PXA
593 select GENERIC_CLOCKEVENTS 594 select GENERIC_CLOCKEVENTS
594 select TICK_ONESHOT 595 select TICK_ONESHOT
595 select PLAT_PXA 596 select PLAT_PXA
597 select SPARSE_IRQ
596 help 598 help
597 Support for Intel/Marvell's PXA2xx/PXA3xx processor line. 599 Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
598 600
@@ -684,8 +686,8 @@ config ARCH_S3C64XX
684 help 686 help
685 Samsung S3C64XX series based systems 687 Samsung S3C64XX series based systems
686 688
687config ARCH_S5P6440 689config ARCH_S5P64X0
688 bool "Samsung S5P6440" 690 bool "Samsung S5P6440 S5P6450"
689 select CPU_V6 691 select CPU_V6
690 select GENERIC_GPIO 692 select GENERIC_GPIO
691 select HAVE_CLK 693 select HAVE_CLK
@@ -694,7 +696,8 @@ config ARCH_S5P6440
694 select HAVE_S3C2410_I2C 696 select HAVE_S3C2410_I2C
695 select HAVE_S3C_RTC 697 select HAVE_S3C_RTC
696 help 698 help
697 Samsung S5P6440 CPU based systems 699 Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440,
700 SMDK6450.
698 701
699config ARCH_S5P6442 702config ARCH_S5P6442
700 bool "Samsung S5P6442" 703 bool "Samsung S5P6442"
@@ -753,6 +756,15 @@ config ARCH_SHARK
753 Support for the StrongARM based Digital DNARD machine, also known 756 Support for the StrongARM based Digital DNARD machine, also known
754 as "Shark" (<http://www.shark-linux.de/shark.html>). 757 as "Shark" (<http://www.shark-linux.de/shark.html>).
755 758
759config ARCH_TCC_926
760 bool "Telechips TCC ARM926-based systems"
761 select CPU_ARM926T
762 select HAVE_CLK
763 select COMMON_CLKDEV
764 select GENERIC_CLOCKEVENTS
765 help
766 Support for Telechips TCC ARM926-based systems.
767
756config ARCH_LH7A40X 768config ARCH_LH7A40X
757 bool "Sharp LH7A40X" 769 bool "Sharp LH7A40X"
758 select CPU_ARM922T 770 select CPU_ARM922T
@@ -921,6 +933,8 @@ source "arch/arm/plat-s5p/Kconfig"
921 933
922source "arch/arm/plat-spear/Kconfig" 934source "arch/arm/plat-spear/Kconfig"
923 935
936source "arch/arm/plat-tcc/Kconfig"
937
924if ARCH_S3C2410 938if ARCH_S3C2410
925source "arch/arm/mach-s3c2400/Kconfig" 939source "arch/arm/mach-s3c2400/Kconfig"
926source "arch/arm/mach-s3c2410/Kconfig" 940source "arch/arm/mach-s3c2410/Kconfig"
@@ -934,7 +948,7 @@ if ARCH_S3C64XX
934source "arch/arm/mach-s3c64xx/Kconfig" 948source "arch/arm/mach-s3c64xx/Kconfig"
935endif 949endif
936 950
937source "arch/arm/mach-s5p6440/Kconfig" 951source "arch/arm/mach-s5p64x0/Kconfig"
938 952
939source "arch/arm/mach-s5p6442/Kconfig" 953source "arch/arm/mach-s5p6442/Kconfig"
940 954
@@ -1107,6 +1121,20 @@ config ARM_ERRATA_720789
1107 invalidated are not, resulting in an incoherency in the system page 1121 invalidated are not, resulting in an incoherency in the system page
1108 tables. The workaround changes the TLB flushing routines to invalidate 1122 tables. The workaround changes the TLB flushing routines to invalidate
1109 entries regardless of the ASID. 1123 entries regardless of the ASID.
1124
1125config ARM_ERRATA_743622
1126 bool "ARM errata: Faulty hazard checking in the Store Buffer may lead to data corruption"
1127 depends on CPU_V7
1128 help
1129 This option enables the workaround for the 743622 Cortex-A9
1130 (r2p0..r2p2) erratum. Under very rare conditions, a faulty
1131 optimisation in the Cortex-A9 Store Buffer may lead to data
1132 corruption. This workaround sets a specific bit in the diagnostic
1133 register of the Cortex-A9 which disables the Store Buffer
1134 optimisation, preventing the defect from occurring. This has no
1135 visible impact on the overall performance or power consumption of the
1136 processor.
1137
1110endmenu 1138endmenu
1111 1139
1112source "arch/arm/common/Kconfig" 1140source "arch/arm/common/Kconfig"
@@ -1273,7 +1301,7 @@ source kernel/Kconfig.preempt
1273 1301
1274config HZ 1302config HZ
1275 int 1303 int
1276 default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P6440 || \ 1304 default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P64X0 || \
1277 ARCH_S5P6442 || ARCH_S5PV210 || ARCH_S5PV310 1305 ARCH_S5P6442 || ARCH_S5PV210 || ARCH_S5PV310
1278 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER 1306 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER
1279 default AT91_TIMER_HZ if ARCH_AT91 1307 default AT91_TIMER_HZ if ARCH_AT91
@@ -1479,6 +1507,20 @@ config UACCESS_WITH_MEMCPY
1479 However, if the CPU data cache is using a write-allocate mode, 1507 However, if the CPU data cache is using a write-allocate mode,
1480 this option is unlikely to provide any performance gain. 1508 this option is unlikely to provide any performance gain.
1481 1509
1510config SECCOMP
1511 bool
1512 prompt "Enable seccomp to safely compute untrusted bytecode"
1513 ---help---
1514 This kernel feature is useful for number crunching applications
1515 that may need to compute untrusted bytecode during their
1516 execution. By using pipes or other transports made available to
1517 the process as file descriptors supporting the read/write
1518 syscalls, it's possible to isolate those applications in
1519 their own address space using seccomp. Once seccomp is
1520 enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
1521 and the task is only allowed to execute a few safe syscalls
1522 defined by each seccomp mode.
1523
1482config CC_STACKPROTECTOR 1524config CC_STACKPROTECTOR
1483 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)" 1525 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
1484 help 1526 help
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 4dbce538fec4..2fd0b99afc4b 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -2,6 +2,20 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config STRICT_DEVMEM
6 bool "Filter access to /dev/mem"
7 depends on MMU
8 ---help---
9 If this option is disabled, you allow userspace (root) access to all
10 of memory, including kernel and userspace memory. Accidental
11 access to this is obviously disastrous, but specific access can
12 be used by people debugging the kernel.
13
14 If this option is switched on, the /dev/mem file only allows
15 userspace access to memory mapped peripherals.
16
17 If in doubt, say Y.
18
5# RMK wants arm kernels compiled with frame pointers or stack unwinding. 19# RMK wants arm kernels compiled with frame pointers or stack unwinding.
6# If you know what you are doing and are willing to live without stack 20# If you know what you are doing and are willing to live without stack
7# traces, you can get a slightly smaller kernel by setting this option to 21# traces, you can get a slightly smaller kernel by setting this option to
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 59c1ce858fc8..b87aed028eef 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -173,7 +173,7 @@ machine-$(CONFIG_ARCH_RPC) := rpc
173machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2416 s3c2440 s3c2443 173machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2416 s3c2440 s3c2443
174machine-$(CONFIG_ARCH_S3C24A0) := s3c24a0 174machine-$(CONFIG_ARCH_S3C24A0) := s3c24a0
175machine-$(CONFIG_ARCH_S3C64XX) := s3c64xx 175machine-$(CONFIG_ARCH_S3C64XX) := s3c64xx
176machine-$(CONFIG_ARCH_S5P6440) := s5p6440 176machine-$(CONFIG_ARCH_S5P64X0) := s5p64x0
177machine-$(CONFIG_ARCH_S5P6442) := s5p6442 177machine-$(CONFIG_ARCH_S5P6442) := s5p6442
178machine-$(CONFIG_ARCH_S5PC100) := s5pc100 178machine-$(CONFIG_ARCH_S5PC100) := s5pc100
179machine-$(CONFIG_ARCH_S5PV210) := s5pv210 179machine-$(CONFIG_ARCH_S5PV210) := s5pv210
@@ -183,6 +183,7 @@ machine-$(CONFIG_ARCH_SHARK) := shark
183machine-$(CONFIG_ARCH_SHMOBILE) := shmobile 183machine-$(CONFIG_ARCH_SHMOBILE) := shmobile
184machine-$(CONFIG_ARCH_STMP378X) := stmp378x 184machine-$(CONFIG_ARCH_STMP378X) := stmp378x
185machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx 185machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx
186machine-$(CONFIG_ARCH_TCC8K) := tcc8k
186machine-$(CONFIG_ARCH_TEGRA) := tegra 187machine-$(CONFIG_ARCH_TEGRA) := tegra
187machine-$(CONFIG_ARCH_U300) := u300 188machine-$(CONFIG_ARCH_U300) := u300
188machine-$(CONFIG_ARCH_U8500) := ux500 189machine-$(CONFIG_ARCH_U8500) := ux500
@@ -202,6 +203,7 @@ plat-$(CONFIG_ARCH_MXC) := mxc
202plat-$(CONFIG_ARCH_OMAP) := omap 203plat-$(CONFIG_ARCH_OMAP) := omap
203plat-$(CONFIG_ARCH_S3C64XX) := samsung 204plat-$(CONFIG_ARCH_S3C64XX) := samsung
204plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx 205plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx
206plat-$(CONFIG_ARCH_TCC_926) := tcc
205plat-$(CONFIG_PLAT_IOP) := iop 207plat-$(CONFIG_PLAT_IOP) := iop
206plat-$(CONFIG_PLAT_NOMADIK) := nomadik 208plat-$(CONFIG_PLAT_NOMADIK) := nomadik
207plat-$(CONFIG_PLAT_ORION) := orion 209plat-$(CONFIG_PLAT_ORION) := orion
@@ -245,13 +247,14 @@ ifeq ($(FASTFPE),$(wildcard $(FASTFPE)))
245FASTFPE_OBJ :=$(FASTFPE)/ 247FASTFPE_OBJ :=$(FASTFPE)/
246endif 248endif
247 249
248# If we have a machine-specific directory, then include it in the build.
249core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
250core-y += $(machdirs) $(platdirs)
251core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ 250core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/
252core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) 251core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
253core-$(CONFIG_VFP) += arch/arm/vfp/ 252core-$(CONFIG_VFP) += arch/arm/vfp/
254 253
254# If we have a machine-specific directory, then include it in the build.
255core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
256core-y += $(machdirs) $(platdirs)
257
255drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ 258drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
256 259
257libs-y := arch/arm/lib/ $(libs-y) 260libs-y := arch/arm/lib/ $(libs-y)
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 7dfa9a85bc0c..ada6359160eb 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -67,25 +67,11 @@ static inline unsigned int gic_irq(unsigned int irq)
67 67
68/* 68/*
69 * Routines to acknowledge, disable and enable interrupts 69 * Routines to acknowledge, disable and enable interrupts
70 *
71 * Linux assumes that when we're done with an interrupt we need to
72 * unmask it, in the same way we need to unmask an interrupt when
73 * we first enable it.
74 *
75 * The GIC has a separate notion of "end of interrupt" to re-enable
76 * an interrupt after handling, in order to support hardware
77 * prioritisation.
78 *
79 * We can make the GIC behave in the way that Linux expects by making
80 * our "acknowledge" routine disable the interrupt, then mark it as
81 * complete.
82 */ 70 */
83static void gic_ack_irq(unsigned int irq) 71static void gic_ack_irq(unsigned int irq)
84{ 72{
85 u32 mask = 1 << (irq % 32);
86 73
87 spin_lock(&irq_controller_lock); 74 spin_lock(&irq_controller_lock);
88 writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_CLEAR + (gic_irq(irq) / 32) * 4);
89 writel(gic_irq(irq), gic_cpu_base(irq) + GIC_CPU_EOI); 75 writel(gic_irq(irq), gic_cpu_base(irq) + GIC_CPU_EOI);
90 spin_unlock(&irq_controller_lock); 76 spin_unlock(&irq_controller_lock);
91} 77}
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index f1bac70d6ce9..9e90e6d79297 100644
--- a/arch/arm/configs/at91sam9g20ek_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -13,6 +13,7 @@ CONFIG_MODULE_UNLOAD=y
13CONFIG_ARCH_AT91=y 13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9G20=y 14CONFIG_ARCH_AT91SAM9G20=y
15CONFIG_MACH_AT91SAM9G20EK=y 15CONFIG_MACH_AT91SAM9G20EK=y
16CONFIG_MACH_AT91SAM9G20EK_2MMC=y
16CONFIG_AT91_PROGRAMMABLE_CLOCKS=y 17CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
17# CONFIG_ARM_THUMB is not set 18# CONFIG_ARM_THUMB is not set
18CONFIG_AEABI=y 19CONFIG_AEABI=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index ccc9c9959b82..2f7042813765 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -15,6 +15,7 @@ CONFIG_MACH_MV88F6281GTW_GE=y
15CONFIG_MACH_SHEEVAPLUG=y 15CONFIG_MACH_SHEEVAPLUG=y
16CONFIG_MACH_ESATA_SHEEVAPLUG=y 16CONFIG_MACH_ESATA_SHEEVAPLUG=y
17CONFIG_MACH_GURUPLUG=y 17CONFIG_MACH_GURUPLUG=y
18CONFIG_MACH_DOCKSTAR=y
18CONFIG_MACH_TS219=y 19CONFIG_MACH_TS219=y
19CONFIG_MACH_TS41X=y 20CONFIG_MACH_TS41X=y
20CONFIG_MACH_OPENRD_BASE=y 21CONFIG_MACH_OPENRD_BASE=y
diff --git a/arch/arm/configs/mx27_defconfig b/arch/arm/configs/mx27_defconfig
index b2038b0e266f..813cfb366c18 100644
--- a/arch/arm/configs/mx27_defconfig
+++ b/arch/arm/configs/mx27_defconfig
@@ -21,8 +21,14 @@ CONFIG_ARCH_MX2=y
21CONFIG_MACH_MX27=y 21CONFIG_MACH_MX27=y
22CONFIG_MACH_MX27ADS=y 22CONFIG_MACH_MX27ADS=y
23CONFIG_MACH_PCM038=y 23CONFIG_MACH_PCM038=y
24CONFIG_MACH_CPUIMX27=y
25CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2=y
26CONFIG_MACH_EUKREA_CPUIMX27_USEUART4=y
24CONFIG_MACH_MX27_3DS=y 27CONFIG_MACH_MX27_3DS=y
28CONFIG_MACH_IMX27_VISSTRIM_M10=y
25CONFIG_MACH_IMX27LITE=y 29CONFIG_MACH_IMX27LITE=y
30CONFIG_MACH_PCA100=y
31CONFIG_MACH_MXT_TD60=y
26CONFIG_MXC_IRQ_PRIOR=y 32CONFIG_MXC_IRQ_PRIOR=y
27CONFIG_MXC_PWM=y 33CONFIG_MXC_PWM=y
28CONFIG_NO_HZ=y 34CONFIG_NO_HZ=y
@@ -76,7 +82,9 @@ CONFIG_INPUT_EVDEV=y
76# CONFIG_INPUT_KEYBOARD is not set 82# CONFIG_INPUT_KEYBOARD is not set
77# CONFIG_INPUT_MOUSE is not set 83# CONFIG_INPUT_MOUSE is not set
78CONFIG_INPUT_TOUCHSCREEN=y 84CONFIG_INPUT_TOUCHSCREEN=y
85CONFIG_TOUCHSCREEN_ADS7846=m
79# CONFIG_SERIO is not set 86# CONFIG_SERIO is not set
87CONFIG_SERIAL_8250=m
80CONFIG_SERIAL_IMX=y 88CONFIG_SERIAL_IMX=y
81CONFIG_SERIAL_IMX_CONSOLE=y 89CONFIG_SERIAL_IMX_CONSOLE=y
82# CONFIG_LEGACY_PTYS is not set 90# CONFIG_LEGACY_PTYS is not set
@@ -85,19 +93,20 @@ CONFIG_I2C=y
85CONFIG_I2C_CHARDEV=y 93CONFIG_I2C_CHARDEV=y
86CONFIG_I2C_IMX=y 94CONFIG_I2C_IMX=y
87CONFIG_SPI=y 95CONFIG_SPI=y
88CONFIG_SPI_BITBANG=y 96CONFIG_SPI_IMX=y
89CONFIG_W1=y 97CONFIG_W1=y
90CONFIG_W1_MASTER_MXC=y 98CONFIG_W1_MASTER_MXC=y
91CONFIG_W1_SLAVE_THERM=y 99CONFIG_W1_SLAVE_THERM=y
92# CONFIG_HWMON is not set 100# CONFIG_HWMON is not set
93CONFIG_FB=y 101CONFIG_FB=y
94CONFIG_FB_IMX=y 102CONFIG_FB_IMX=y
95# CONFIG_VGA_CONSOLE is not set
96CONFIG_FRAMEBUFFER_CONSOLE=y 103CONFIG_FRAMEBUFFER_CONSOLE=y
97CONFIG_FONTS=y 104CONFIG_FONTS=y
98CONFIG_FONT_8x8=y 105CONFIG_FONT_8x8=y
99# CONFIG_HID_SUPPORT is not set 106# CONFIG_HID_SUPPORT is not set
100# CONFIG_USB_SUPPORT is not set 107CONFIG_USB=m
108# CONFIG_USB_DEVICE_CLASS is not set
109CONFIG_USB_ULPI=y
101CONFIG_MMC=y 110CONFIG_MMC=y
102CONFIG_MMC_MXC=y 111CONFIG_MMC_MXC=y
103CONFIG_RTC_CLASS=y 112CONFIG_RTC_CLASS=y
diff --git a/arch/arm/configs/mx31pdk_defconfig b/arch/arm/configs/mx31pdk_defconfig
deleted file mode 100644
index 2d29329749e4..000000000000
--- a/arch/arm/configs/mx31pdk_defconfig
+++ /dev/null
@@ -1,44 +0,0 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
4# CONFIG_COMPAT_BRK is not set
5# CONFIG_IOSCHED_DEADLINE is not set
6# CONFIG_IOSCHED_CFQ is not set
7CONFIG_ARCH_MXC=y
8# CONFIG_MACH_MX31ADS is not set
9CONFIG_MACH_MX31_3DS=y
10CONFIG_AEABI=y
11CONFIG_NET=y
12CONFIG_PACKET=y
13CONFIG_UNIX=y
14CONFIG_NET_KEY=y
15CONFIG_INET=y
16CONFIG_IP_PNP=y
17CONFIG_IP_PNP_DHCP=y
18# CONFIG_INET_LRO is not set
19CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
20# CONFIG_PREVENT_FIRMWARE_BUILD is not set
21# CONFIG_FIRMWARE_IN_KERNEL is not set
22# CONFIG_BLK_DEV is not set
23# CONFIG_MISC_DEVICES is not set
24CONFIG_NETDEVICES=y
25CONFIG_NET_ETHERNET=y
26# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
27# CONFIG_INPUT_KEYBOARD is not set
28# CONFIG_INPUT_MOUSE is not set
29# CONFIG_SERIO is not set
30# CONFIG_DEVKMEM is not set
31CONFIG_SERIAL_IMX=y
32CONFIG_SERIAL_IMX_CONSOLE=y
33# CONFIG_LEGACY_PTYS is not set
34# CONFIG_HW_RANDOM is not set
35# CONFIG_HWMON is not set
36# CONFIG_VGA_CONSOLE is not set
37# CONFIG_HID_SUPPORT is not set
38# CONFIG_USB_SUPPORT is not set
39# CONFIG_DNOTIFY is not set
40# CONFIG_ENABLE_WARN_DEPRECATED is not set
41# CONFIG_ENABLE_MUST_CHECK is not set
42# CONFIG_RCU_CPU_STALL_DETECTOR is not set
43# CONFIG_CRYPTO_ANSI_CPRNG is not set
44# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/mx3_defconfig b/arch/arm/configs/mx3_defconfig
index 161f907b611f..f0c339fd5d21 100644
--- a/arch/arm/configs/mx3_defconfig
+++ b/arch/arm/configs/mx3_defconfig
@@ -24,6 +24,7 @@ CONFIG_MACH_PCM043=y
24CONFIG_MACH_ARMADILLO5X0=y 24CONFIG_MACH_ARMADILLO5X0=y
25CONFIG_MACH_MX35_3DS=y 25CONFIG_MACH_MX35_3DS=y
26CONFIG_MACH_KZM_ARM11_01=y 26CONFIG_MACH_KZM_ARM11_01=y
27CONFIG_MACH_EUKREA_CPUIMX35=y
27CONFIG_MXC_IRQ_PRIOR=y 28CONFIG_MXC_IRQ_PRIOR=y
28CONFIG_MXC_PWM=y 29CONFIG_MXC_PWM=y
29CONFIG_NO_HZ=y 30CONFIG_NO_HZ=y
@@ -108,7 +109,6 @@ CONFIG_MMC=y
108CONFIG_MMC_MXC=y 109CONFIG_MMC_MXC=y
109CONFIG_DMADEVICES=y 110CONFIG_DMADEVICES=y
110# CONFIG_DNOTIFY is not set 111# CONFIG_DNOTIFY is not set
111CONFIG_INOTIFY=y
112CONFIG_TMPFS=y 112CONFIG_TMPFS=y
113CONFIG_JFFS2_FS=y 113CONFIG_JFFS2_FS=y
114CONFIG_UBIFS_FS=y 114CONFIG_UBIFS_FS=y
diff --git a/arch/arm/configs/mx51_defconfig b/arch/arm/configs/mx51_defconfig
index a665ecbbe2bc..163cfee7644c 100644
--- a/arch/arm/configs/mx51_defconfig
+++ b/arch/arm/configs/mx51_defconfig
@@ -15,6 +15,8 @@ CONFIG_MODULE_SRCVERSION_ALL=y
15CONFIG_ARCH_MXC=y 15CONFIG_ARCH_MXC=y
16CONFIG_ARCH_MX5=y 16CONFIG_ARCH_MX5=y
17CONFIG_MACH_MX51_BABBAGE=y 17CONFIG_MACH_MX51_BABBAGE=y
18CONFIG_MACH_MX51_3DS=y
19CONFIG_MACH_EUKREA_CPUIMX51=y
18CONFIG_NO_HZ=y 20CONFIG_NO_HZ=y
19CONFIG_HIGH_RES_TIMERS=y 21CONFIG_HIGH_RES_TIMERS=y
20CONFIG_PREEMPT_VOLUNTARY=y 22CONFIG_PREEMPT_VOLUNTARY=y
@@ -69,7 +71,6 @@ CONFIG_REALTEK_PHY=y
69CONFIG_NATIONAL_PHY=y 71CONFIG_NATIONAL_PHY=y
70CONFIG_STE10XP=y 72CONFIG_STE10XP=y
71CONFIG_LSI_ET1011C_PHY=y 73CONFIG_LSI_ET1011C_PHY=y
72CONFIG_FIXED_PHY=y
73CONFIG_MDIO_BITBANG=y 74CONFIG_MDIO_BITBANG=y
74CONFIG_MDIO_GPIO=y 75CONFIG_MDIO_GPIO=y
75CONFIG_NET_ETHERNET=y 76CONFIG_NET_ETHERNET=y
@@ -100,7 +101,6 @@ CONFIG_I2C_ALGOPCF=m
100CONFIG_I2C_ALGOPCA=m 101CONFIG_I2C_ALGOPCA=m
101CONFIG_GPIO_SYSFS=y 102CONFIG_GPIO_SYSFS=y
102# CONFIG_HWMON is not set 103# CONFIG_HWMON is not set
103# CONFIG_VGA_CONSOLE is not set
104# CONFIG_HID_SUPPORT is not set 104# CONFIG_HID_SUPPORT is not set
105CONFIG_USB=y 105CONFIG_USB=y
106CONFIG_USB_EHCI_HCD=y 106CONFIG_USB_EHCI_HCD=y
@@ -117,13 +117,11 @@ CONFIG_EXT2_FS_XATTR=y
117CONFIG_EXT2_FS_POSIX_ACL=y 117CONFIG_EXT2_FS_POSIX_ACL=y
118CONFIG_EXT2_FS_SECURITY=y 118CONFIG_EXT2_FS_SECURITY=y
119CONFIG_EXT3_FS=y 119CONFIG_EXT3_FS=y
120CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
121CONFIG_EXT3_FS_POSIX_ACL=y 120CONFIG_EXT3_FS_POSIX_ACL=y
122CONFIG_EXT3_FS_SECURITY=y 121CONFIG_EXT3_FS_SECURITY=y
123CONFIG_EXT4_FS=y 122CONFIG_EXT4_FS=y
124CONFIG_EXT4_FS_POSIX_ACL=y 123CONFIG_EXT4_FS_POSIX_ACL=y
125CONFIG_EXT4_FS_SECURITY=y 124CONFIG_EXT4_FS_SECURITY=y
126CONFIG_INOTIFY=y
127CONFIG_QUOTA=y 125CONFIG_QUOTA=y
128CONFIG_QUOTA_NETLINK_INTERFACE=y 126CONFIG_QUOTA_NETLINK_INTERFACE=y
129# CONFIG_PRINT_QUOTA_WARNING is not set 127# CONFIG_PRINT_QUOTA_WARNING is not set
@@ -136,6 +134,7 @@ CONFIG_ZISOFS=y
136CONFIG_UDF_FS=m 134CONFIG_UDF_FS=m
137CONFIG_MSDOS_FS=m 135CONFIG_MSDOS_FS=m
138CONFIG_VFAT_FS=y 136CONFIG_VFAT_FS=y
137CONFIG_TMPFS=y
139CONFIG_CONFIGFS_FS=m 138CONFIG_CONFIGFS_FS=m
140CONFIG_NFS_FS=y 139CONFIG_NFS_FS=y
141CONFIG_NFS_V3=y 140CONFIG_NFS_V3=y
@@ -151,7 +150,6 @@ CONFIG_NLS_UTF8=y
151CONFIG_MAGIC_SYSRQ=y 150CONFIG_MAGIC_SYSRQ=y
152CONFIG_DEBUG_FS=y 151CONFIG_DEBUG_FS=y
153CONFIG_DEBUG_KERNEL=y 152CONFIG_DEBUG_KERNEL=y
154# CONFIG_DETECT_SOFTLOCKUP is not set
155# CONFIG_SCHED_DEBUG is not set 153# CONFIG_SCHED_DEBUG is not set
156# CONFIG_DEBUG_BUGVERBOSE is not set 154# CONFIG_DEBUG_BUGVERBOSE is not set
157# CONFIG_RCU_CPU_STALL_DETECTOR is not set 155# CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -159,7 +157,6 @@ CONFIG_DEBUG_KERNEL=y
159# CONFIG_ARM_UNWIND is not set 157# CONFIG_ARM_UNWIND is not set
160CONFIG_DEBUG_LL=y 158CONFIG_DEBUG_LL=y
161CONFIG_EARLY_PRINTK=y 159CONFIG_EARLY_PRINTK=y
162CONFIG_KEYS=y
163CONFIG_SECURITYFS=y 160CONFIG_SECURITYFS=y
164CONFIG_CRYPTO_DEFLATE=y 161CONFIG_CRYPTO_DEFLATE=y
165CONFIG_CRYPTO_LZO=y 162CONFIG_CRYPTO_LZO=y
diff --git a/arch/arm/configs/s5p6440_defconfig b/arch/arm/configs/s5p64x0_defconfig
index 0b0266c6d326..2993ecd35145 100644
--- a/arch/arm/configs/s5p6440_defconfig
+++ b/arch/arm/configs/s5p64x0_defconfig
@@ -5,10 +5,11 @@ CONFIG_KALLSYMS_ALL=y
5CONFIG_MODULES=y 5CONFIG_MODULES=y
6CONFIG_MODULE_UNLOAD=y 6CONFIG_MODULE_UNLOAD=y
7# CONFIG_BLK_DEV_BSG is not set 7# CONFIG_BLK_DEV_BSG is not set
8CONFIG_ARCH_S5P6440=y 8CONFIG_ARCH_S5P64X0=y
9CONFIG_S3C_BOOT_ERROR_RESET=y 9CONFIG_S3C_BOOT_ERROR_RESET=y
10CONFIG_S3C_LOWLEVEL_UART_PORT=1 10CONFIG_S3C_LOWLEVEL_UART_PORT=1
11CONFIG_MACH_SMDK6440=y 11CONFIG_MACH_SMDK6440=y
12CONFIG_MACH_SMDK6450=y
12CONFIG_CPU_32v6K=y 13CONFIG_CPU_32v6K=y
13CONFIG_AEABI=y 14CONFIG_AEABI=y
14CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc" 15CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc"
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index 5747a8baa413..8bb66bca2e3e 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -127,4 +127,8 @@ struct mm_struct;
127extern unsigned long arch_randomize_brk(struct mm_struct *mm); 127extern unsigned long arch_randomize_brk(struct mm_struct *mm);
128#define arch_randomize_brk arch_randomize_brk 128#define arch_randomize_brk arch_randomize_brk
129 129
130extern int vectors_user_mapping(void);
131#define arch_setup_additional_pages(bprm, uses_interp) vectors_user_mapping()
132#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
133
130#endif 134#endif
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 1261b1f928d9..815efa2d4e07 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -294,6 +294,7 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
294#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 294#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
295extern int valid_phys_addr_range(unsigned long addr, size_t size); 295extern int valid_phys_addr_range(unsigned long addr, size_t size);
296extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 296extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
297extern int devmem_is_allowed(unsigned long pfn);
297#endif 298#endif
298 299
299/* 300/*
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index a0b3cac0547c..71605d9f8e42 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -18,7 +18,6 @@
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/cachetype.h> 19#include <asm/cachetype.h>
20#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
21#include <asm-generic/mm_hooks.h>
22 21
23void __check_kvm_seq(struct mm_struct *mm); 22void __check_kvm_seq(struct mm_struct *mm);
24 23
@@ -134,4 +133,32 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
134#define deactivate_mm(tsk,mm) do { } while (0) 133#define deactivate_mm(tsk,mm) do { } while (0)
135#define activate_mm(prev,next) switch_mm(prev, next, NULL) 134#define activate_mm(prev,next) switch_mm(prev, next, NULL)
136 135
136/*
137 * We are inserting a "fake" vma for the user-accessible vector page so
138 * gdb and friends can get to it through ptrace and /proc/<pid>/mem.
139 * But we also want to remove it before the generic code gets to see it
140 * during process exit or the unmapping of it would cause total havoc.
141 * (the macro is used as remove_vma() is static to mm/mmap.c)
142 */
143#define arch_exit_mmap(mm) \
144do { \
145 struct vm_area_struct *high_vma = find_vma(mm, 0xffff0000); \
146 if (high_vma) { \
147 BUG_ON(high_vma->vm_next); /* it should be last */ \
148 if (high_vma->vm_prev) \
149 high_vma->vm_prev->vm_next = NULL; \
150 else \
151 mm->mmap = NULL; \
152 rb_erase(&high_vma->vm_rb, &mm->mm_rb); \
153 mm->mmap_cache = NULL; \
154 mm->map_count--; \
155 remove_vma(high_vma); \
156 } \
157} while (0)
158
159static inline void arch_dup_mmap(struct mm_struct *oldmm,
160 struct mm_struct *mm)
161{
162}
163
137#endif 164#endif
diff --git a/arch/arm/include/asm/seccomp.h b/arch/arm/include/asm/seccomp.h
new file mode 100644
index 000000000000..52b156b341f5
--- /dev/null
+++ b/arch/arm/include/asm/seccomp.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_ARM_SECCOMP_H
2#define _ASM_ARM_SECCOMP_H
3
4#include <linux/unistd.h>
5
6#define __NR_seccomp_read __NR_read
7#define __NR_seccomp_write __NR_write
8#define __NR_seccomp_exit __NR_exit
9#define __NR_seccomp_sigreturn __NR_rt_sigreturn
10
11#endif /* _ASM_ARM_SECCOMP_H */
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index 763e29fa8530..7b5cc8dae06e 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -144,6 +144,7 @@ extern void vfp_flush_hwstate(struct thread_info *);
144#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 144#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
145#define TIF_FREEZE 19 145#define TIF_FREEZE 19
146#define TIF_RESTORE_SIGMASK 20 146#define TIF_RESTORE_SIGMASK 20
147#define TIF_SECCOMP 21
147 148
148#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 149#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
149#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 150#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
@@ -153,6 +154,7 @@ extern void vfp_flush_hwstate(struct thread_info *);
153#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) 154#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
154#define _TIF_FREEZE (1 << TIF_FREEZE) 155#define _TIF_FREEZE (1 << TIF_FREEZE)
155#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 156#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
157#define _TIF_SECCOMP (1 << TIF_SECCOMP)
156 158
157/* 159/*
158 * Change these and you break ASM code in entry-common.S 160 * Change these and you break ASM code in entry-common.S
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 2d23ad985180..8bfa98757cd2 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -334,7 +334,6 @@ ENTRY(vector_swi)
334 334
335 get_thread_info tsk 335 get_thread_info tsk
336 adr tbl, sys_call_table @ load syscall table pointer 336 adr tbl, sys_call_table @ load syscall table pointer
337 ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing
338 337
339#if defined(CONFIG_OABI_COMPAT) 338#if defined(CONFIG_OABI_COMPAT)
340 /* 339 /*
@@ -351,8 +350,20 @@ ENTRY(vector_swi)
351 eor scno, scno, #__NR_SYSCALL_BASE @ check OS number 350 eor scno, scno, #__NR_SYSCALL_BASE @ check OS number
352#endif 351#endif
353 352
353 ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing
354 stmdb sp!, {r4, r5} @ push fifth and sixth args 354 stmdb sp!, {r4, r5} @ push fifth and sixth args
355 tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls? 355
356#ifdef CONFIG_SECCOMP
357 tst r10, #_TIF_SECCOMP
358 beq 1f
359 mov r0, scno
360 bl __secure_computing
361 add r0, sp, #S_R0 + S_OFF @ pointer to regs
362 ldmia r0, {r0 - r3} @ have to reload r0 - r3
3631:
364#endif
365
366 tst r10, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
356 bne __sys_trace 367 bne __sys_trace
357 368
358 cmp scno, #NR_syscalls @ check upper syscall limit 369 cmp scno, #NR_syscalls @ check upper syscall limit
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index 8bccbfa693ff..2c1f0050c9c4 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1162,11 +1162,12 @@ space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1162{ 1162{
1163 /* 1163 /*
1164 * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx 1164 * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx
1165 * Undef : cccc 0011 0x00 xxxx xxxx xxxx xxxx xxxx 1165 * Undef : cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx
1166 * ALU op with S bit and Rd == 15 : 1166 * ALU op with S bit and Rd == 15 :
1167 * cccc 001x xxx1 xxxx 1111 xxxx xxxx xxxx 1167 * cccc 001x xxx1 xxxx 1111 xxxx xxxx xxxx
1168 */ 1168 */
1169 if ((insn & 0x0f900000) == 0x03200000 || /* MSR & Undef */ 1169 if ((insn & 0x0fb00000) == 0x03200000 || /* MSR */
1170 (insn & 0x0ff00000) == 0x03400000 || /* Undef */
1170 (insn & 0x0e10f000) == 0x0210f000) /* ALU s-bit, R15 */ 1171 (insn & 0x0e10f000) == 0x0210f000) /* ALU s-bit, R15 */
1171 return INSN_REJECTED; 1172 return INSN_REJECTED;
1172 1173
@@ -1177,7 +1178,7 @@ space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1177 * *S (bit 20) updates condition codes 1178 * *S (bit 20) updates condition codes
1178 * ADC/SBC/RSC reads the C flag 1179 * ADC/SBC/RSC reads the C flag
1179 */ 1180 */
1180 insn &= 0xfff00fff; /* Rn = r0, Rd = r0 */ 1181 insn &= 0xffff0fff; /* Rd = r0 */
1181 asi->insn[0] = insn; 1182 asi->insn[0] = insn;
1182 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ 1183 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */
1183 emulate_alu_imm_rwflags : emulate_alu_imm_rflags; 1184 emulate_alu_imm_rwflags : emulate_alu_imm_rflags;
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 3af34bf4f4df..e76fcaadce03 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -482,3 +482,24 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
482 unsigned long range_end = mm->brk + 0x02000000; 482 unsigned long range_end = mm->brk + 0x02000000;
483 return randomize_range(mm->brk, range_end, 0) ? : mm->brk; 483 return randomize_range(mm->brk, range_end, 0) ? : mm->brk;
484} 484}
485
486/*
487 * The vectors page is always readable from user space for the
488 * atomic helpers and the signal restart code. Let's declare a mapping
489 * for it so it is visible through ptrace and /proc/<pid>/mem.
490 */
491
492int vectors_user_mapping(void)
493{
494 struct mm_struct *mm = current->mm;
495 return install_special_mapping(mm, 0xffff0000, PAGE_SIZE,
496 VM_READ | VM_EXEC |
497 VM_MAYREAD | VM_MAYEXEC |
498 VM_ALWAYSDUMP | VM_RESERVED,
499 NULL);
500}
501
502const char *arch_vma_name(struct vm_area_struct *vma)
503{
504 return (vma->vm_start == 0xffff0000) ? "[vectors]" : NULL;
505}
diff --git a/arch/arm/mach-aaec2000/include/mach/vmalloc.h b/arch/arm/mach-aaec2000/include/mach/vmalloc.h
index 551f68f666bf..cff4e0a996ce 100644
--- a/arch/arm/mach-aaec2000/include/mach/vmalloc.h
+++ b/arch/arm/mach-aaec2000/include/mach/vmalloc.h
@@ -11,6 +11,6 @@
11#ifndef __ASM_ARCH_VMALLOC_H 11#ifndef __ASM_ARCH_VMALLOC_H
12#define __ASM_ARCH_VMALLOC_H 12#define __ASM_ARCH_VMALLOC_H
13 13
14#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 14#define VMALLOC_END 0xd0000000
15 15
16#endif /* __ASM_ARCH_VMALLOC_H */ 16#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index ca33862b4bf4..851e8139ef9d 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -33,6 +33,7 @@ config ARCH_AT91SAM9260
33 select HAVE_AT91_USART3 33 select HAVE_AT91_USART3
34 select HAVE_AT91_USART4 34 select HAVE_AT91_USART4
35 select HAVE_AT91_USART5 35 select HAVE_AT91_USART5
36 select HAVE_NET_MACB
36 37
37config ARCH_AT91SAM9261 38config ARCH_AT91SAM9261
38 bool "AT91SAM9261" 39 bool "AT91SAM9261"
@@ -51,6 +52,7 @@ config ARCH_AT91SAM9263
51 select CPU_ARM926T 52 select CPU_ARM926T
52 select GENERIC_CLOCKEVENTS 53 select GENERIC_CLOCKEVENTS
53 select HAVE_FB_ATMEL 54 select HAVE_FB_ATMEL
55 select HAVE_NET_MACB
54 56
55config ARCH_AT91SAM9RL 57config ARCH_AT91SAM9RL
56 bool "AT91SAM9RL" 58 bool "AT91SAM9RL"
@@ -66,6 +68,7 @@ config ARCH_AT91SAM9G20
66 select HAVE_AT91_USART3 68 select HAVE_AT91_USART3
67 select HAVE_AT91_USART4 69 select HAVE_AT91_USART4
68 select HAVE_AT91_USART5 70 select HAVE_AT91_USART5
71 select HAVE_NET_MACB
69 72
70config ARCH_AT91SAM9G45 73config ARCH_AT91SAM9G45
71 bool "AT91SAM9G45" 74 bool "AT91SAM9G45"
@@ -73,6 +76,7 @@ config ARCH_AT91SAM9G45
73 select GENERIC_CLOCKEVENTS 76 select GENERIC_CLOCKEVENTS
74 select HAVE_AT91_USART3 77 select HAVE_AT91_USART3
75 select HAVE_FB_ATMEL 78 select HAVE_FB_ATMEL
79 select HAVE_NET_MACB
76 80
77config ARCH_AT91CAP9 81config ARCH_AT91CAP9
78 bool "AT91CAP9" 82 bool "AT91CAP9"
@@ -344,6 +348,7 @@ config MACH_AT91SAM9G20EK
344 that embeds only one SD/MMC slot. 348 that embeds only one SD/MMC slot.
345 349
346config MACH_AT91SAM9G20EK_2MMC 350config MACH_AT91SAM9G20EK_2MMC
351 depends on MACH_AT91SAM9G20EK
347 bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots" 352 bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots"
348 select HAVE_NAND_ATMEL_BUSWIDTH_16 353 select HAVE_NAND_ATMEL_BUSWIDTH_16
349 help 354 help
@@ -389,8 +394,8 @@ if ARCH_AT91SAM9G45
389 394
390comment "AT91SAM9G45 Board Type" 395comment "AT91SAM9G45 Board Type"
391 396
392config MACH_AT91SAM9G45EKES 397config MACH_AT91SAM9M10G45EK
393 bool "Atmel AT91SAM9G45-EKES Evaluation Kit" 398 bool "Atmel AT91SAM9M10G45-EK Evaluation Kits"
394 select HAVE_NAND_ATMEL_BUSWIDTH_16 399 select HAVE_NAND_ATMEL_BUSWIDTH_16
395 help 400 help
396 Select this if you are using Atmel's AT91SAM9G45-EKES Evaluation Kit. 401 Select this if you are using Atmel's AT91SAM9G45-EKES Evaluation Kit.
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 7cbe06d7cee9..412b3a471a4b 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -62,7 +62,6 @@ obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
62 62
63# AT91SAM9G20 board-specific support 63# AT91SAM9G20 board-specific support
64obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o 64obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
65obj-$(CONFIG_MACH_AT91SAM9G20EK_2MMC) += board-sam9g20ek-2slot-mmc.o
66obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o 65obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o
67obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o 66obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
68obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o 67obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
@@ -71,7 +70,7 @@ obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
71obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o 70obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
72 71
73# AT91SAM9G45 board-specific support 72# AT91SAM9G45 board-specific support
74obj-$(CONFIG_MACH_AT91SAM9G45EKES) += board-sam9m10g45ek.o 73obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o
75 74
76# AT91CAP9 board-specific support 75# AT91CAP9 board-specific support
77obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o 76obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
diff --git a/arch/arm/mach-at91/board-at572d940hf_ek.c b/arch/arm/mach-at91/board-at572d940hf_ek.c
index 5daff277f53e..46651623f208 100644
--- a/arch/arm/mach-at91/board-at572d940hf_ek.c
+++ b/arch/arm/mach-at91/board-at572d940hf_ek.c
@@ -216,7 +216,7 @@ static struct atmel_nand_data __initdata eb_nand_data = {
216/* .rdy_pin = AT91_PIN_PC16, */ 216/* .rdy_pin = AT91_PIN_PC16, */
217 .enable_pin = AT91_PIN_PA15, 217 .enable_pin = AT91_PIN_PA15,
218 .partition_info = nand_partitions, 218 .partition_info = nand_partitions,
219#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 219#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
220 .bus_width_16 = 1, 220 .bus_width_16 = 1,
221#else 221#else
222 .bus_width_16 = 0, 222 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
deleted file mode 100644
index c49f5c003ee1..000000000000
--- a/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
+++ /dev/null
@@ -1,329 +0,0 @@
1/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2008 Atmel
4 * Copyright (C) 2009 Rob Emanuele
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/module.h>
25#include <linux/platform_device.h>
26#include <linux/spi/spi.h>
27#include <linux/spi/at73c213.h>
28#include <linux/clk.h>
29#include <linux/regulator/machine.h>
30#include <linux/regulator/fixed.h>
31#include <linux/regulator/consumer.h>
32
33#include <mach/hardware.h>
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <mach/board.h>
43#include <mach/gpio.h>
44#include <mach/at91sam9_smc.h>
45
46#include "sam9_smc.h"
47#include "generic.h"
48
49
50static void __init ek_map_io(void)
51{
52 /* Initialize processor: 18.432 MHz crystal */
53 at91sam9260_initialize(18432000);
54
55 /* DGBU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0);
57
58 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
59 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
60 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
61 | ATMEL_UART_RI);
62
63 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
64 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
65
66 /* set serial console to ttyS0 (ie, DBGU) */
67 at91_set_serial_console(0);
68}
69
70static void __init ek_init_irq(void)
71{
72 at91sam9260_init_interrupts(NULL);
73}
74
75
76/*
77 * USB Host port
78 */
79static struct at91_usbh_data __initdata ek_usbh_data = {
80 .ports = 2,
81};
82
83/*
84 * USB Device port
85 */
86static struct at91_udc_data __initdata ek_udc_data = {
87 .vbus_pin = AT91_PIN_PC5,
88 .pullup_pin = 0, /* pull-up driven by UDC */
89};
90
91
92/*
93 * SPI devices.
94 */
95static struct spi_board_info ek_spi_devices[] = {
96#if !(defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_AT91))
97 { /* DataFlash chip */
98 .modalias = "mtd_dataflash",
99 .chip_select = 1,
100 .max_speed_hz = 15 * 1000 * 1000,
101 .bus_num = 0,
102 },
103#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
104 { /* DataFlash card */
105 .modalias = "mtd_dataflash",
106 .chip_select = 0,
107 .max_speed_hz = 15 * 1000 * 1000,
108 .bus_num = 0,
109 },
110#endif
111#endif
112};
113
114
115/*
116 * MACB Ethernet device
117 */
118static struct at91_eth_data __initdata ek_macb_data = {
119 .phy_irq_pin = AT91_PIN_PB0,
120 .is_rmii = 1,
121};
122
123
124/*
125 * NAND flash
126 */
127static struct mtd_partition __initdata ek_nand_partition[] = {
128 {
129 .name = "Bootstrap",
130 .offset = 0,
131 .size = 4 * SZ_1M,
132 },
133 {
134 .name = "Partition 1",
135 .offset = MTDPART_OFS_NXTBLK,
136 .size = 60 * SZ_1M,
137 },
138 {
139 .name = "Partition 2",
140 .offset = MTDPART_OFS_NXTBLK,
141 .size = MTDPART_SIZ_FULL,
142 },
143};
144
145static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
146{
147 *num_partitions = ARRAY_SIZE(ek_nand_partition);
148 return ek_nand_partition;
149}
150
151/* det_pin is not connected */
152static struct atmel_nand_data __initdata ek_nand_data = {
153 .ale = 21,
154 .cle = 22,
155 .rdy_pin = AT91_PIN_PC13,
156 .enable_pin = AT91_PIN_PC14,
157 .partition_info = nand_partitions,
158#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
159 .bus_width_16 = 1,
160#else
161 .bus_width_16 = 0,
162#endif
163};
164
165static struct sam9_smc_config __initdata ek_nand_smc_config = {
166 .ncs_read_setup = 0,
167 .nrd_setup = 2,
168 .ncs_write_setup = 0,
169 .nwe_setup = 2,
170
171 .ncs_read_pulse = 4,
172 .nrd_pulse = 4,
173 .ncs_write_pulse = 4,
174 .nwe_pulse = 4,
175
176 .read_cycle = 7,
177 .write_cycle = 7,
178
179 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
180 .tdf_cycles = 3,
181};
182
183static void __init ek_add_device_nand(void)
184{
185 /* setup bus-width (8 or 16) */
186 if (ek_nand_data.bus_width_16)
187 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
188 else
189 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
190
191 /* configure chip-select 3 (NAND) */
192 sam9_smc_configure(3, &ek_nand_smc_config);
193
194 at91_add_device_nand(&ek_nand_data);
195}
196
197
198/*
199 * MCI (SD/MMC)
200 * wp_pin is not connected
201 */
202#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
203static struct mci_platform_data __initdata ek_mmc_data = {
204 .slot[0] = {
205 .bus_width = 4,
206 .detect_pin = AT91_PIN_PC2,
207 .wp_pin = -ENODEV,
208 },
209 .slot[1] = {
210 .bus_width = 4,
211 .detect_pin = AT91_PIN_PC9,
212 .wp_pin = -ENODEV,
213 },
214
215};
216#else
217static struct at91_mmc_data __initdata ek_mmc_data = {
218 .slot_b = 1, /* Only one slot so use slot B */
219 .wire4 = 1,
220 .det_pin = AT91_PIN_PC9,
221};
222#endif
223
224/*
225 * LEDs
226 */
227static struct gpio_led ek_leds[] = {
228 { /* "bottom" led, green, userled1 to be defined */
229 .name = "ds5",
230 .gpio = AT91_PIN_PB8,
231 .active_low = 1,
232 .default_trigger = "none",
233 },
234 { /* "power" led, yellow */
235 .name = "ds1",
236 .gpio = AT91_PIN_PB9,
237 .default_trigger = "heartbeat",
238 }
239};
240
241#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
242static struct regulator_consumer_supply ek_audio_consumer_supplies[] = {
243 REGULATOR_SUPPLY("AVDD", "0-001b"),
244 REGULATOR_SUPPLY("HPVDD", "0-001b"),
245 REGULATOR_SUPPLY("DBVDD", "0-001b"),
246 REGULATOR_SUPPLY("DCVDD", "0-001b"),
247};
248
249static struct regulator_init_data ek_avdd_reg_init_data = {
250 .constraints = {
251 .name = "3V3",
252 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
253 },
254 .consumer_supplies = ek_audio_consumer_supplies,
255 .num_consumer_supplies = ARRAY_SIZE(ek_audio_consumer_supplies),
256};
257
258static struct fixed_voltage_config ek_vdd_pdata = {
259 .supply_name = "board-3V3",
260 .microvolts = 3300000,
261 .gpio = -EINVAL,
262 .enabled_at_boot = 0,
263 .init_data = &ek_avdd_reg_init_data,
264};
265static struct platform_device ek_voltage_regulator = {
266 .name = "reg-fixed-voltage",
267 .id = -1,
268 .num_resources = 0,
269 .dev = {
270 .platform_data = &ek_vdd_pdata,
271 },
272};
273static void __init ek_add_regulators(void)
274{
275 platform_device_register(&ek_voltage_regulator);
276}
277#else
278static void __init ek_add_regulators(void) {}
279#endif
280
281static struct i2c_board_info __initdata ek_i2c_devices[] = {
282 {
283 I2C_BOARD_INFO("24c512", 0x50),
284 },
285};
286
287
288static void __init ek_board_init(void)
289{
290 /* Serial */
291 at91_add_device_serial();
292 /* USB Host */
293 at91_add_device_usbh(&ek_usbh_data);
294 /* USB Device */
295 at91_add_device_udc(&ek_udc_data);
296 /* SPI */
297 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
298 /* NAND */
299 ek_add_device_nand();
300 /* Ethernet */
301 at91_add_device_eth(&ek_macb_data);
302 /* Regulators */
303 ek_add_regulators();
304 /* MMC */
305#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
306 at91_add_device_mci(0, &ek_mmc_data);
307#else
308 at91_add_device_mmc(0, &ek_mmc_data);
309#endif
310 /* I2C */
311 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
312 /* LEDs */
313 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
314 /* PCK0 provides MCLK to the WM8731 */
315 at91_set_B_periph(AT91_PIN_PC1, 0);
316 /* SSC (for WM8731) */
317 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
318}
319
320MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod")
321 /* Maintainer: Rob Emanuele */
322 .phys_io = AT91_BASE_SYS,
323 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
324 .boot_params = AT91_SDRAM_BASE + 0x100,
325 .timer = &at91sam926x_timer,
326 .map_io = ek_map_io,
327 .init_irq = ek_init_irq,
328 .init_machine = ek_board_init,
329MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 6ea9808b8868..b463e340c4a0 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -47,6 +47,18 @@
47#include "sam9_smc.h" 47#include "sam9_smc.h"
48#include "generic.h" 48#include "generic.h"
49 49
50/*
51 * board revision encoding
52 * bit 0:
53 * 0 => 1 sd/mmc slot
54 * 1 => 2 sd/mmc slots connectors (board from revision C)
55 */
56#define HAVE_2MMC (1 << 0)
57static int inline ek_have_2mmc(void)
58{
59 return machine_is_at91sam9g20ek_2mmc() || (system_rev & HAVE_2MMC);
60}
61
50 62
51static void __init ek_map_io(void) 63static void __init ek_map_io(void)
52{ 64{
@@ -94,7 +106,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
94 * SPI devices. 106 * SPI devices.
95 */ 107 */
96static struct spi_board_info ek_spi_devices[] = { 108static struct spi_board_info ek_spi_devices[] = {
97#if !defined(CONFIG_MMC_AT91) 109#if !(defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_AT91))
98 { /* DataFlash chip */ 110 { /* DataFlash chip */
99 .modalias = "mtd_dataflash", 111 .modalias = "mtd_dataflash",
100 .chip_select = 1, 112 .chip_select = 1,
@@ -121,6 +133,13 @@ static struct at91_eth_data __initdata ek_macb_data = {
121 .is_rmii = 1, 133 .is_rmii = 1,
122}; 134};
123 135
136static void __init ek_add_device_macb(void)
137{
138 if (ek_have_2mmc())
139 ek_macb_data.phy_irq_pin = AT91_PIN_PB0;
140
141 at91_add_device_eth(&ek_macb_data);
142}
124 143
125/* 144/*
126 * NAND flash 145 * NAND flash
@@ -198,13 +217,36 @@ static void __init ek_add_device_nand(void)
198 217
199/* 218/*
200 * MCI (SD/MMC) 219 * MCI (SD/MMC)
201 * det_pin, wp_pin and vcc_pin are not connected 220 * wp_pin and vcc_pin are not connected
202 */ 221 */
222#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
223static struct mci_platform_data __initdata ek_mmc_data = {
224 .slot[1] = {
225 .bus_width = 4,
226 .detect_pin = AT91_PIN_PC9,
227 },
228
229};
230#else
203static struct at91_mmc_data __initdata ek_mmc_data = { 231static struct at91_mmc_data __initdata ek_mmc_data = {
204 .slot_b = 1, 232 .slot_b = 1, /* Only one slot so use slot B */
205 .wire4 = 1, 233 .wire4 = 1,
234 .det_pin = AT91_PIN_PC9,
206}; 235};
236#endif
207 237
238static void __init ek_add_device_mmc(void)
239{
240#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
241 if (ek_have_2mmc()) {
242 ek_mmc_data.slot[0].bus_width = 4;
243 ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2;
244 }
245 at91_add_device_mci(0, &ek_mmc_data);
246#else
247 at91_add_device_mmc(0, &ek_mmc_data);
248#endif
249}
208 250
209/* 251/*
210 * LEDs 252 * LEDs
@@ -223,6 +265,15 @@ static struct gpio_led ek_leds[] = {
223 } 265 }
224}; 266};
225 267
268static void __init ek_add_device_gpio_leds(void)
269{
270 if (ek_have_2mmc()) {
271 ek_leds[0].gpio = AT91_PIN_PB8;
272 ek_leds[1].gpio = AT91_PIN_PB9;
273 }
274
275 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
276}
226 277
227/* 278/*
228 * GPIO Buttons 279 * GPIO Buttons
@@ -336,15 +387,15 @@ static void __init ek_board_init(void)
336 /* NAND */ 387 /* NAND */
337 ek_add_device_nand(); 388 ek_add_device_nand();
338 /* Ethernet */ 389 /* Ethernet */
339 at91_add_device_eth(&ek_macb_data); 390 ek_add_device_macb();
340 /* Regulators */ 391 /* Regulators */
341 ek_add_regulators(); 392 ek_add_regulators();
342 /* MMC */ 393 /* MMC */
343 at91_add_device_mmc(0, &ek_mmc_data); 394 ek_add_device_mmc();
344 /* I2C */ 395 /* I2C */
345 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); 396 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
346 /* LEDs */ 397 /* LEDs */
347 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 398 ek_add_device_gpio_leds();
348 /* Push Buttons */ 399 /* Push Buttons */
349 ek_add_device_buttons(); 400 ek_add_device_buttons();
350 /* PCK0 provides MCLK to the WM8731 */ 401 /* PCK0 provides MCLK to the WM8731 */
@@ -363,3 +414,14 @@ MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
363 .init_irq = ek_init_irq, 414 .init_irq = ek_init_irq,
364 .init_machine = ek_board_init, 415 .init_machine = ek_board_init,
365MACHINE_END 416MACHINE_END
417
418MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod")
419 /* Maintainer: Atmel */
420 .phys_io = AT91_BASE_SYS,
421 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
422 .boot_params = AT91_SDRAM_BASE + 0x100,
423 .timer = &at91sam926x_timer,
424 .map_io = ek_map_io,
425 .init_irq = ek_init_irq,
426 .init_machine = ek_board_init,
427MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index ee800595594d..ae0e0843e5f5 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -135,7 +135,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
135 .rdy_pin = AT91_PIN_PC8, 135 .rdy_pin = AT91_PIN_PC8,
136 .enable_pin = AT91_PIN_PC14, 136 .enable_pin = AT91_PIN_PC14,
137 .partition_info = nand_partitions, 137 .partition_info = nand_partitions,
138#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 138#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
139 .bus_width_16 = 1, 139 .bus_width_16 = 1,
140#else 140#else
141 .bus_width_16 = 0, 141 .bus_width_16 = 0,
@@ -399,7 +399,7 @@ static void __init ek_board_init(void)
399 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); 399 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led));
400} 400}
401 401
402MACHINE_START(AT91SAM9G45EKES, "Atmel AT91SAM9G45-EKES") 402MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK")
403 /* Maintainer: Atmel */ 403 /* Maintainer: Atmel */
404 .phys_io = AT91_BASE_SYS, 404 .phys_io = AT91_BASE_SYS,
405 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, 405 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
diff --git a/arch/arm/mach-at91/include/mach/at91x40.h b/arch/arm/mach-at91/include/mach/at91x40.h
index d34cdb8abdca..063ac44a0204 100644
--- a/arch/arm/mach-at91/include/mach/at91x40.h
+++ b/arch/arm/mach-at91/include/mach/at91x40.h
@@ -52,4 +52,10 @@
52#define AT91_DBGU_CIDR (AT91_SF + 0) /* CIDR in PS segment */ 52#define AT91_DBGU_CIDR (AT91_SF + 0) /* CIDR in PS segment */
53#define AT91_DBGU_EXID (AT91_SF + 4) /* EXID in PS segment */ 53#define AT91_DBGU_EXID (AT91_SF + 4) /* EXID in PS segment */
54 54
55/*
56 * Support defines for the simple Power Controller module.
57 */
58#define AT91_PS_CR (AT91_PS + 0) /* PS Control register */
59#define AT91_PS_CR_CPU (1 << 0) /* CPU clock disable bit */
60
55#endif /* AT91X40_H */ 61#endif /* AT91X40_H */
diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
index c80e090b3670..36af14bc13bb 100644
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -28,17 +28,20 @@
28 28
29static inline void arch_idle(void) 29static inline void arch_idle(void)
30{ 30{
31#ifndef CONFIG_DEBUG_KERNEL
32 /* 31 /*
33 * Disable the processor clock. The processor will be automatically 32 * Disable the processor clock. The processor will be automatically
34 * re-enabled by an interrupt or by a reset. 33 * re-enabled by an interrupt or by a reset.
35 */ 34 */
36 at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK); 35#ifdef AT91_PS
36 at91_sys_write(AT91_PS_CR, AT91_PS_CR_CPU);
37#else 37#else
38 at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
39#endif
40#ifndef CONFIG_CPU_ARM920T
38 /* 41 /*
39 * Set the processor (CP15) into 'Wait for Interrupt' mode. 42 * Set the processor (CP15) into 'Wait for Interrupt' mode.
40 * Unlike disabling the processor clock via the PMC (above) 43 * Post-RM9200 processors need this in conjunction with the above
41 * this allows the processor to be woken via JTAG. 44 * to save power when idle.
42 */ 45 */
43 cpu_do_idle(); 46 cpu_do_idle();
44#endif 47#endif
diff --git a/arch/arm/mach-bcmring/include/mach/vmalloc.h b/arch/arm/mach-bcmring/include/mach/vmalloc.h
index 35e2ead8395c..3db3a09fd398 100644
--- a/arch/arm/mach-bcmring/include/mach/vmalloc.h
+++ b/arch/arm/mach-bcmring/include/mach/vmalloc.h
@@ -22,4 +22,4 @@
22 * 0xe0000000 to 0xefffffff. This gives us 256 MB of vm space and handles 22 * 0xe0000000 to 0xefffffff. This gives us 256 MB of vm space and handles
23 * larger physical memory designs better. 23 * larger physical memory designs better.
24 */ 24 */
25#define VMALLOC_END (PAGE_OFFSET + 0x30000000) 25#define VMALLOC_END 0xf0000000
diff --git a/arch/arm/mach-clps711x/include/mach/vmalloc.h b/arch/arm/mach-clps711x/include/mach/vmalloc.h
index ea6cc7beff28..30b3a287ed88 100644
--- a/arch/arm/mach-clps711x/include/mach/vmalloc.h
+++ b/arch/arm/mach-clps711x/include/mach/vmalloc.h
@@ -17,4 +17,4 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 20#define VMALLOC_END 0xd0000000
diff --git a/arch/arm/mach-ebsa110/include/mach/vmalloc.h b/arch/arm/mach-ebsa110/include/mach/vmalloc.h
index 9b44c19e95ec..60bde56fba4c 100644
--- a/arch/arm/mach-ebsa110/include/mach/vmalloc.h
+++ b/arch/arm/mach-ebsa110/include/mach/vmalloc.h
@@ -7,4 +7,4 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#define VMALLOC_END (PAGE_OFFSET + 0x1f000000) 10#define VMALLOC_END 0xdf000000
diff --git a/arch/arm/mach-ep93xx/dma-m2p.c b/arch/arm/mach-ep93xx/dma-m2p.c
index 8904ca4e2e24..a696d354b1f8 100644
--- a/arch/arm/mach-ep93xx/dma-m2p.c
+++ b/arch/arm/mach-ep93xx/dma-m2p.c
@@ -276,7 +276,7 @@ static void channel_disable(struct m2p_channel *ch)
276 v &= ~(M2P_CONTROL_STALL_IRQ_EN | M2P_CONTROL_NFB_IRQ_EN); 276 v &= ~(M2P_CONTROL_STALL_IRQ_EN | M2P_CONTROL_NFB_IRQ_EN);
277 m2p_set_control(ch, v); 277 m2p_set_control(ch, v);
278 278
279 while (m2p_channel_state(ch) == STATE_ON) 279 while (m2p_channel_state(ch) >= STATE_ON)
280 cpu_relax(); 280 cpu_relax();
281 281
282 m2p_set_control(ch, 0x0); 282 m2p_set_control(ch, 0x0);
diff --git a/arch/arm/mach-footbridge/include/mach/vmalloc.h b/arch/arm/mach-footbridge/include/mach/vmalloc.h
index d0958d860a3c..0ffbb7c85e59 100644
--- a/arch/arm/mach-footbridge/include/mach/vmalloc.h
+++ b/arch/arm/mach-footbridge/include/mach/vmalloc.h
@@ -7,4 +7,4 @@
7 */ 7 */
8 8
9 9
10#define VMALLOC_END (PAGE_OFFSET + 0x30000000) 10#define VMALLOC_END 0xf0000000
diff --git a/arch/arm/mach-h720x/include/mach/vmalloc.h b/arch/arm/mach-h720x/include/mach/vmalloc.h
index ff1460d6841b..a45915b88756 100644
--- a/arch/arm/mach-h720x/include/mach/vmalloc.h
+++ b/arch/arm/mach-h720x/include/mach/vmalloc.h
@@ -5,6 +5,6 @@
5#ifndef __ARCH_ARM_VMALLOC_H 5#ifndef __ARCH_ARM_VMALLOC_H
6#define __ARCH_ARM_VMALLOC_H 6#define __ARCH_ARM_VMALLOC_H
7 7
8#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 8#define VMALLOC_END 0xd0000000
9 9
10#endif 10#endif
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index c5c0369bb481..197f9e241cff 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -122,6 +122,7 @@ config MACH_CPUIMX27
122 select IMX_HAVE_PLATFORM_IMX_I2C 122 select IMX_HAVE_PLATFORM_IMX_I2C
123 select IMX_HAVE_PLATFORM_IMX_UART 123 select IMX_HAVE_PLATFORM_IMX_UART
124 select IMX_HAVE_PLATFORM_MXC_NAND 124 select IMX_HAVE_PLATFORM_MXC_NAND
125 select MXC_ULPI if USB_ULPI
125 help 126 help
126 Include support for Eukrea CPUIMX27 platform. This includes 127 Include support for Eukrea CPUIMX27 platform. This includes
127 specific configurations for the module and its peripherals. 128 specific configurations for the module and its peripherals.
@@ -146,8 +147,8 @@ choice
146 default MACH_EUKREA_MBIMX27_BASEBOARD 147 default MACH_EUKREA_MBIMX27_BASEBOARD
147 148
148config MACH_EUKREA_MBIMX27_BASEBOARD 149config MACH_EUKREA_MBIMX27_BASEBOARD
149 prompt "Eukrea MBIMX27 development board" 150 bool "Eukrea MBIMX27 development board"
150 bool 151 select IMX_HAVE_PLATFORM_IMX_SSI
151 select IMX_HAVE_PLATFORM_IMX_UART 152 select IMX_HAVE_PLATFORM_IMX_UART
152 select IMX_HAVE_PLATFORM_SPI_IMX 153 select IMX_HAVE_PLATFORM_SPI_IMX
153 help 154 help
@@ -163,6 +164,15 @@ config MACH_MX27_3DS
163 Include support for MX27PDK platform. This includes specific 164 Include support for MX27PDK platform. This includes specific
164 configurations for the board and its peripherals. 165 configurations for the board and its peripherals.
165 166
167config MACH_IMX27_VISSTRIM_M10
168 bool "Vista Silicon i.MX27 Visstrim_m10"
169 select IMX_HAVE_PLATFORM_IMX_I2C
170 select IMX_HAVE_PLATFORM_IMX_UART
171 help
172 Include support for Visstrim_m10 platform and its different variants.
173 This includes specific configurations for the board and its
174 peripherals.
175
166config MACH_IMX27LITE 176config MACH_IMX27LITE
167 bool "LogicPD MX27 LITEKIT platform" 177 bool "LogicPD MX27 LITEKIT platform"
168 select IMX_HAVE_PLATFORM_IMX_UART 178 select IMX_HAVE_PLATFORM_IMX_UART
@@ -173,6 +183,7 @@ config MACH_IMX27LITE
173config MACH_PCA100 183config MACH_PCA100
174 bool "Phytec phyCARD-s (pca100)" 184 bool "Phytec phyCARD-s (pca100)"
175 select IMX_HAVE_PLATFORM_IMX_I2C 185 select IMX_HAVE_PLATFORM_IMX_I2C
186 select IMX_HAVE_PLATFORM_IMX_SSI
176 select IMX_HAVE_PLATFORM_IMX_UART 187 select IMX_HAVE_PLATFORM_IMX_UART
177 select IMX_HAVE_PLATFORM_MXC_NAND 188 select IMX_HAVE_PLATFORM_MXC_NAND
178 select IMX_HAVE_PLATFORM_SPI_IMX 189 select IMX_HAVE_PLATFORM_SPI_IMX
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 46a9fdfbbd15..5582692bb176 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_MACH_PCM038) += mach-pcm038.o
27obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o 27obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o
28obj-$(CONFIG_MACH_MX27_3DS) += mach-mx27_3ds.o 28obj-$(CONFIG_MACH_MX27_3DS) += mach-mx27_3ds.o
29obj-$(CONFIG_MACH_IMX27LITE) += mach-imx27lite.o 29obj-$(CONFIG_MACH_IMX27LITE) += mach-imx27lite.o
30obj-$(CONFIG_MACH_IMX27_VISSTRIM_M10) += mach-imx27_visstrim_m10.o
30obj-$(CONFIG_MACH_CPUIMX27) += mach-cpuimx27.o 31obj-$(CONFIG_MACH_CPUIMX27) += mach-cpuimx27.o
31obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o 32obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o
32obj-$(CONFIG_MACH_PCA100) += mach-pca100.o 33obj-$(CONFIG_MACH_PCA100) += mach-pca100.o
diff --git a/arch/arm/mach-imx/clock-imx1.c b/arch/arm/mach-imx/clock-imx1.c
index c05096c38301..daca30b2d5b1 100644
--- a/arch/arm/mach-imx/clock-imx1.c
+++ b/arch/arm/mach-imx/clock-imx1.c
@@ -592,7 +592,7 @@ static struct clk_lookup lookups[] __initdata = {
592 _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk) 592 _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk)
593 _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk) 593 _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk)
594 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 594 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
595 _REGISTER_CLOCK("spi_imx.0", NULL, spi_clk) 595 _REGISTER_CLOCK("imx1-cspi.0", NULL, spi_clk)
596 _REGISTER_CLOCK("imx-mmc.0", NULL, sdhc_clk) 596 _REGISTER_CLOCK("imx-mmc.0", NULL, sdhc_clk)
597 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 597 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
598 _REGISTER_CLOCK(NULL, "mshc", mshc_clk) 598 _REGISTER_CLOCK(NULL, "mshc", mshc_clk)
diff --git a/arch/arm/mach-imx/clock-imx21.c b/arch/arm/mach-imx/clock-imx21.c
index bb419ef4d133..cf15ea516a72 100644
--- a/arch/arm/mach-imx/clock-imx21.c
+++ b/arch/arm/mach-imx/clock-imx21.c
@@ -1172,9 +1172,9 @@ static struct clk_lookup lookups[] = {
1172 _REGISTER_CLOCK(NULL, "pwm", pwm_clk[0]) 1172 _REGISTER_CLOCK(NULL, "pwm", pwm_clk[0])
1173 _REGISTER_CLOCK(NULL, "sdhc1", sdhc_clk[0]) 1173 _REGISTER_CLOCK(NULL, "sdhc1", sdhc_clk[0])
1174 _REGISTER_CLOCK(NULL, "sdhc2", sdhc_clk[1]) 1174 _REGISTER_CLOCK(NULL, "sdhc2", sdhc_clk[1])
1175 _REGISTER_CLOCK(NULL, "cspi1", cspi_clk[0]) 1175 _REGISTER_CLOCK("imx21-cspi.0", NULL, cspi_clk[0])
1176 _REGISTER_CLOCK(NULL, "cspi2", cspi_clk[1]) 1176 _REGISTER_CLOCK("imx21-cspi.1", NULL, cspi_clk[1])
1177 _REGISTER_CLOCK(NULL, "cspi3", cspi_clk[2]) 1177 _REGISTER_CLOCK("imx21-cspi.2", NULL, cspi_clk[2])
1178 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk[0]) 1178 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk[0])
1179 _REGISTER_CLOCK(NULL, "csi", csi_clk[0]) 1179 _REGISTER_CLOCK(NULL, "csi", csi_clk[0])
1180 _REGISTER_CLOCK("imx21-hcd.0", NULL, usb_clk[0]) 1180 _REGISTER_CLOCK("imx21-hcd.0", NULL, usb_clk[0])
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c
index 5a1aa15c8a16..98a25bada783 100644
--- a/arch/arm/mach-imx/clock-imx27.c
+++ b/arch/arm/mach-imx/clock-imx27.c
@@ -594,27 +594,27 @@ DEFINE_CLOCK(uart2_clk1, 0, PCCR1, 30, NULL, NULL, &ipg_clk);
594DEFINE_CLOCK(uart1_clk1, 0, PCCR1, 31, NULL, NULL, &ipg_clk); 594DEFINE_CLOCK(uart1_clk1, 0, PCCR1, 31, NULL, NULL, &ipg_clk);
595 595
596/* Clocks we cannot directly gate, but drivers need their rates */ 596/* Clocks we cannot directly gate, but drivers need their rates */
597DEFINE_CLOCK(cspi1_clk, 0, 0, 0, NULL, &cspi1_clk1, &per2_clk); 597DEFINE_CLOCK(cspi1_clk, 0, NULL, 0, NULL, &cspi1_clk1, &per2_clk);
598DEFINE_CLOCK(cspi2_clk, 1, 0, 0, NULL, &cspi2_clk1, &per2_clk); 598DEFINE_CLOCK(cspi2_clk, 1, NULL, 0, NULL, &cspi2_clk1, &per2_clk);
599DEFINE_CLOCK(cspi3_clk, 2, 0, 0, NULL, &cspi13_clk1, &per2_clk); 599DEFINE_CLOCK(cspi3_clk, 2, NULL, 0, NULL, &cspi13_clk1, &per2_clk);
600DEFINE_CLOCK(sdhc1_clk, 0, 0, 0, NULL, &sdhc1_clk1, &per2_clk); 600DEFINE_CLOCK(sdhc1_clk, 0, NULL, 0, NULL, &sdhc1_clk1, &per2_clk);
601DEFINE_CLOCK(sdhc2_clk, 1, 0, 0, NULL, &sdhc2_clk1, &per2_clk); 601DEFINE_CLOCK(sdhc2_clk, 1, NULL, 0, NULL, &sdhc2_clk1, &per2_clk);
602DEFINE_CLOCK(sdhc3_clk, 2, 0, 0, NULL, &sdhc3_clk1, &per2_clk); 602DEFINE_CLOCK(sdhc3_clk, 2, NULL, 0, NULL, &sdhc3_clk1, &per2_clk);
603DEFINE_CLOCK(pwm_clk, 0, 0, 0, NULL, &pwm_clk1, &per1_clk); 603DEFINE_CLOCK(pwm_clk, 0, NULL, 0, NULL, &pwm_clk1, &per1_clk);
604DEFINE_CLOCK(gpt1_clk, 0, 0, 0, NULL, &gpt1_clk1, &per1_clk); 604DEFINE_CLOCK(gpt1_clk, 0, NULL, 0, NULL, &gpt1_clk1, &per1_clk);
605DEFINE_CLOCK(gpt2_clk, 1, 0, 0, NULL, &gpt2_clk1, &per1_clk); 605DEFINE_CLOCK(gpt2_clk, 1, NULL, 0, NULL, &gpt2_clk1, &per1_clk);
606DEFINE_CLOCK(gpt3_clk, 2, 0, 0, NULL, &gpt3_clk1, &per1_clk); 606DEFINE_CLOCK(gpt3_clk, 2, NULL, 0, NULL, &gpt3_clk1, &per1_clk);
607DEFINE_CLOCK(gpt4_clk, 3, 0, 0, NULL, &gpt4_clk1, &per1_clk); 607DEFINE_CLOCK(gpt4_clk, 3, NULL, 0, NULL, &gpt4_clk1, &per1_clk);
608DEFINE_CLOCK(gpt5_clk, 4, 0, 0, NULL, &gpt5_clk1, &per1_clk); 608DEFINE_CLOCK(gpt5_clk, 4, NULL, 0, NULL, &gpt5_clk1, &per1_clk);
609DEFINE_CLOCK(gpt6_clk, 5, 0, 0, NULL, &gpt6_clk1, &per1_clk); 609DEFINE_CLOCK(gpt6_clk, 5, NULL, 0, NULL, &gpt6_clk1, &per1_clk);
610DEFINE_CLOCK(uart1_clk, 0, 0, 0, NULL, &uart1_clk1, &per1_clk); 610DEFINE_CLOCK(uart1_clk, 0, NULL, 0, NULL, &uart1_clk1, &per1_clk);
611DEFINE_CLOCK(uart2_clk, 1, 0, 0, NULL, &uart2_clk1, &per1_clk); 611DEFINE_CLOCK(uart2_clk, 1, NULL, 0, NULL, &uart2_clk1, &per1_clk);
612DEFINE_CLOCK(uart3_clk, 2, 0, 0, NULL, &uart3_clk1, &per1_clk); 612DEFINE_CLOCK(uart3_clk, 2, NULL, 0, NULL, &uart3_clk1, &per1_clk);
613DEFINE_CLOCK(uart4_clk, 3, 0, 0, NULL, &uart4_clk1, &per1_clk); 613DEFINE_CLOCK(uart4_clk, 3, NULL, 0, NULL, &uart4_clk1, &per1_clk);
614DEFINE_CLOCK(uart5_clk, 4, 0, 0, NULL, &uart5_clk1, &per1_clk); 614DEFINE_CLOCK(uart5_clk, 4, NULL, 0, NULL, &uart5_clk1, &per1_clk);
615DEFINE_CLOCK(uart6_clk, 5, 0, 0, NULL, &uart6_clk1, &per1_clk); 615DEFINE_CLOCK(uart6_clk, 5, NULL, 0, NULL, &uart6_clk1, &per1_clk);
616DEFINE_CLOCK1(lcdc_clk, 0, 0, 0, parent, &lcdc_clk1, &per3_clk); 616DEFINE_CLOCK1(lcdc_clk, 0, NULL, 0, parent, &lcdc_clk1, &per3_clk);
617DEFINE_CLOCK1(csi_clk, 0, 0, 0, parent, &csi_clk1, &per4_clk); 617DEFINE_CLOCK1(csi_clk, 0, NULL, 0, parent, &csi_clk1, &per4_clk);
618 618
619#define _REGISTER_CLOCK(d, n, c) \ 619#define _REGISTER_CLOCK(d, n, c) \
620 { \ 620 { \
@@ -640,9 +640,9 @@ static struct clk_lookup lookups[] = {
640 _REGISTER_CLOCK("mxc-mmc.0", NULL, sdhc1_clk) 640 _REGISTER_CLOCK("mxc-mmc.0", NULL, sdhc1_clk)
641 _REGISTER_CLOCK("mxc-mmc.1", NULL, sdhc2_clk) 641 _REGISTER_CLOCK("mxc-mmc.1", NULL, sdhc2_clk)
642 _REGISTER_CLOCK("mxc-mmc.2", NULL, sdhc3_clk) 642 _REGISTER_CLOCK("mxc-mmc.2", NULL, sdhc3_clk)
643 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk) 643 _REGISTER_CLOCK("imx27-cspi.0", NULL, cspi1_clk)
644 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk) 644 _REGISTER_CLOCK("imx27-cspi.1", NULL, cspi2_clk)
645 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk) 645 _REGISTER_CLOCK("imx27-cspi.2", NULL, cspi3_clk)
646 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 646 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
647 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk) 647 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
648 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk) 648 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk)
diff --git a/arch/arm/mach-imx/devices-imx1.h b/arch/arm/mach-imx/devices-imx1.h
index a8d94f078196..81979486218e 100644
--- a/arch/arm/mach-imx/devices-imx1.h
+++ b/arch/arm/mach-imx/devices-imx1.h
@@ -9,10 +9,12 @@
9#include <mach/mx1.h> 9#include <mach/mx1.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12#define imx1_add_i2c_imx(pdata) \ 12extern const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst;
13 imx_add_imx_i2c(0, MX1_I2C_BASE_ADDR, SZ_4K, MX1_INT_I2C, pdata) 13#define imx1_add_imx_i2c(pdata) \
14 imx_add_imx_i2c(&imx1_imx_i2c_data, pdata)
14 15
15#define imx1_add_imx_uart0(pdata) \ 16extern const struct imx_imx_uart_3irq_data imx1_imx_uart_data[] __initconst;
16 imx_add_imx_uart_3irq(0, MX1_UART1_BASE_ADDR, 0xd0, MX1_INT_UART1RX, MX1_INT_UART1TX, MX1_INT_UART1RTS, pdata) 17#define imx1_add_imx_uart(id, pdata) \
17#define imx1_add_imx_uart1(pdata) \ 18 imx_add_imx_uart_3irq(&imx1_imx_uart_data[id], pdata)
18 imx_add_imx_uart_3irq(0, MX1_UART2_BASE_ADDR, 0xd0, MX1_INT_UART2RX, MX1_INT_UART2TX, MX1_INT_UART2RTS, pdata) 19#define imx1_add_imx_uart0(pdata) imx1_add_imx_uart(0, pdata)
20#define imx1_add_imx_uart1(pdata) imx1_add_imx_uart(1, pdata)
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h
index 42788e99d127..d189039749b0 100644
--- a/arch/arm/mach-imx/devices-imx21.h
+++ b/arch/arm/mach-imx/devices-imx21.h
@@ -9,22 +9,28 @@
9#include <mach/mx21.h> 9#include <mach/mx21.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12#define imx21_add_i2c_imx(pdata) \ 12extern const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst;
13 imx_add_imx_i2c(0, MX2x_I2C_BASE_ADDR, SZ_4K, MX2x_INT_I2C, pdata) 13#define imx21_add_imx_i2c(pdata) \
14 imx_add_imx_i2c(&imx21_imx_i2c_data, pdata)
14 15
15#define imx21_add_imx_uart0(pdata) \ 16extern const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst;
16 imx_add_imx_uart_1irq(0, MX21_UART1_BASE_ADDR, SZ_4K, MX21_INT_UART1, pdata) 17#define imx21_add_imx_ssi(id, pdata) \
17#define imx21_add_imx_uart1(pdata) \ 18 imx_add_imx_ssi(&imx21_imx_ssi_data[id], pdata)
18 imx_add_imx_uart_1irq(1, MX21_UART2_BASE_ADDR, SZ_4K, MX21_INT_UART2, pdata)
19#define imx21_add_imx_uart2(pdata) \
20 imx_add_imx_uart_1irq(2, MX21_UART3_BASE_ADDR, SZ_4K, MX21_INT_UART3, pdata)
21#define imx21_add_imx_uart3(pdata) \
22 imx_add_imx_uart_1irq(3, MX21_UART4_BASE_ADDR, SZ_4K, MX21_INT_UART4, pdata)
23 19
20extern const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst;
21#define imx21_add_imx_uart(id, pdata) \
22 imx_add_imx_uart_1irq(&imx21_imx_uart_data[id], pdata)
23#define imx21_add_imx_uart0(pdata) imx21_add_imx_uart(0, pdata)
24#define imx21_add_imx_uart1(pdata) imx21_add_imx_uart(1, pdata)
25#define imx21_add_imx_uart2(pdata) imx21_add_imx_uart(2, pdata)
26#define imx21_add_imx_uart3(pdata) imx21_add_imx_uart(3, pdata)
27
28extern const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst;
24#define imx21_add_mxc_nand(pdata) \ 29#define imx21_add_mxc_nand(pdata) \
25 imx_add_mxc_nand_v1(MX21_NFC_BASE_ADDR, MX21_INT_NANDFC, pdata) 30 imx_add_mxc_nand(&imx21_mxc_nand_data, pdata)
26 31
27#define imx21_add_spi_imx0(pdata) \ 32extern const struct imx_spi_imx_data imx21_cspi_data[] __initconst;
28 imx_add_spi_imx(0, MX21_CSPI1_BASE_ADDR, SZ_4K, MX21_INT_CSPI1, pdata) 33#define imx21_add_cspi(id, pdata) \
29#define imx21_add_spi_imx1(pdata) \ 34 imx_add_spi_imx(&imx21_cspi_data[id], pdata)
30 imx_add_spi_imx(1, MX21_CSPI2_BASE_ADDR, SZ_4K, MX21_INT_CSPI2, pdata) 35#define imx21_add_spi_imx0(pdata) imx21_add_cspi(0, pdata)
36#define imx21_add_spi_imx1(pdata) imx21_add_cspi(1, pdata)
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
index 65e7bb7ec2e8..7011690364f2 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -9,30 +9,35 @@
9#include <mach/mx27.h> 9#include <mach/mx27.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12#define imx27_add_i2c_imx0(pdata) \ 12extern const struct imx_fec_data imx27_fec_data __initconst;
13 imx_add_imx_i2c(0, MX27_I2C1_BASE_ADDR, SZ_4K, MX27_INT_I2C1, pdata) 13#define imx27_add_fec(pdata) \
14#define imx27_add_i2c_imx1(pdata) \ 14 imx_add_fec(&imx27_fec_data, pdata)
15 imx_add_imx_i2c(1, MX27_I2C2_BASE_ADDR, SZ_4K, MX27_INT_I2C2, pdata)
16 15
17#define imx27_add_imx_uart0(pdata) \ 16extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst;
18 imx_add_imx_uart_1irq(0, MX27_UART1_BASE_ADDR, SZ_4K, MX27_INT_UART1, pdata) 17#define imx27_add_imx_i2c(id, pdata) \
19#define imx27_add_imx_uart1(pdata) \ 18 imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata)
20 imx_add_imx_uart_1irq(1, MX27_UART2_BASE_ADDR, SZ_4K, MX27_INT_UART2, pdata)
21#define imx27_add_imx_uart2(pdata) \
22 imx_add_imx_uart_1irq(2, MX27_UART3_BASE_ADDR, SZ_4K, MX27_INT_UART3, pdata)
23#define imx27_add_imx_uart3(pdata) \
24 imx_add_imx_uart_1irq(3, MX27_UART4_BASE_ADDR, SZ_4K, MX27_INT_UART4, pdata)
25#define imx27_add_imx_uart4(pdata) \
26 imx_add_imx_uart_1irq(4, MX27_UART5_BASE_ADDR, SZ_4K, MX27_INT_UART5, pdata)
27#define imx27_add_imx_uart5(pdata) \
28 imx_add_imx_uart_1irq(5, MX27_UART6_BASE_ADDR, SZ_4K, MX27_INT_UART6, pdata)
29 19
20extern const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst;
21#define imx27_add_imx_ssi(id, pdata) \
22 imx_add_imx_ssi(&imx27_imx_ssi_data[id], pdata)
23
24extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst;
25#define imx27_add_imx_uart(id, pdata) \
26 imx_add_imx_uart_1irq(&imx27_imx_uart_data[id], pdata)
27#define imx27_add_imx_uart0(pdata) imx27_add_imx_uart(0, pdata)
28#define imx27_add_imx_uart1(pdata) imx27_add_imx_uart(1, pdata)
29#define imx27_add_imx_uart2(pdata) imx27_add_imx_uart(2, pdata)
30#define imx27_add_imx_uart3(pdata) imx27_add_imx_uart(3, pdata)
31#define imx27_add_imx_uart4(pdata) imx27_add_imx_uart(4, pdata)
32#define imx27_add_imx_uart5(pdata) imx27_add_imx_uart(5, pdata)
33
34extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst;
30#define imx27_add_mxc_nand(pdata) \ 35#define imx27_add_mxc_nand(pdata) \
31 imx_add_mxc_nand_v1(MX27_NFC_BASE_ADDR, MX27_INT_NANDFC, pdata) 36 imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
32 37
33#define imx27_add_spi_imx0(pdata) \ 38extern const struct imx_spi_imx_data imx27_cspi_data[] __initconst;
34 imx_add_spi_imx(0, MX27_CSPI1_BASE_ADDR, SZ_4K, MX27_INT_CSPI1, pdata) 39#define imx27_add_cspi(id, pdata) \
35#define imx27_add_spi_imx1(pdata) \ 40 imx_add_spi_imx(&imx27_cspi_data[id], pdata)
36 imx_add_spi_imx(1, MX27_CSPI2_BASE_ADDR, SZ_4K, MX27_INT_CSPI2, pdata) 41#define imx27_add_spi_imx0(pdata) imx27_add_cspi(0, pdata)
37#define imx27_add_spi_imx2(pdata) \ 42#define imx27_add_spi_imx1(pdata) imx27_add_cspi(1, pdata)
38 imx_add_spi_imx(2, MX27_CSPI3_BASE_ADDR, SZ_4K, MX27_INT_CSPI3, pdata) 43#define imx27_add_spi_imx2(pdata) imx27_add_cspi(2, pdata)
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
index 9c271a752b84..fba5047de8b1 100644
--- a/arch/arm/mach-imx/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -314,27 +314,6 @@ struct platform_device mxc_fb_device = {
314 }, 314 },
315}; 315};
316 316
317#ifdef CONFIG_MACH_MX27
318static struct resource mxc_fec_resources[] = {
319 {
320 .start = MX27_FEC_BASE_ADDR,
321 .end = MX27_FEC_BASE_ADDR + SZ_4K - 1,
322 .flags = IORESOURCE_MEM,
323 }, {
324 .start = MX27_INT_FEC,
325 .end = MX27_INT_FEC,
326 .flags = IORESOURCE_IRQ,
327 },
328};
329
330struct platform_device mxc_fec_device = {
331 .name = "fec",
332 .id = 0,
333 .num_resources = ARRAY_SIZE(mxc_fec_resources),
334 .resource = mxc_fec_resources,
335};
336#endif
337
338static struct resource mxc_pwm_resources[] = { 317static struct resource mxc_pwm_resources[] = {
339 { 318 {
340 .start = MX2x_PWM_BASE_ADDR, 319 .start = MX2x_PWM_BASE_ADDR,
@@ -480,41 +459,6 @@ struct platform_device mxc_usbh2 = {
480}; 459};
481#endif 460#endif
482 461
483#define DEFINE_IMX_SSI_DMARES(_name, ssin, suffix) \
484 { \
485 .name = _name, \
486 .start = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \
487 .end = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \
488 .flags = IORESOURCE_DMA, \
489 }
490
491#define DEFINE_IMX_SSI_DEVICE(n, ssin, baseaddr, irq) \
492 static struct resource imx_ssi_resources ## n[] = { \
493 { \
494 .start = MX2x_SSI ## ssin ## _BASE_ADDR, \
495 .end = MX2x_SSI ## ssin ## _BASE_ADDR + 0x6f, \
496 .flags = IORESOURCE_MEM, \
497 }, { \
498 .start = MX2x_INT_SSI1, \
499 .end = MX2x_INT_SSI1, \
500 .flags = IORESOURCE_IRQ, \
501 }, \
502 DEFINE_IMX_SSI_DMARES("tx0", ssin, TX0), \
503 DEFINE_IMX_SSI_DMARES("rx0", ssin, RX0), \
504 DEFINE_IMX_SSI_DMARES("tx1", ssin, TX1), \
505 DEFINE_IMX_SSI_DMARES("rx1", ssin, RX1), \
506 }; \
507 \
508 struct platform_device imx_ssi_device ## n = { \
509 .name = "imx-ssi", \
510 .id = n, \
511 .num_resources = ARRAY_SIZE(imx_ssi_resources ## n), \
512 .resource = imx_ssi_resources ## n, \
513 }
514
515DEFINE_IMX_SSI_DEVICE(0, 1, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
516DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
517
518/* GPIO port description */ 462/* GPIO port description */
519#define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \ 463#define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \
520 { \ 464 { \
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h
index efd4527506a5..807f02a031c9 100644
--- a/arch/arm/mach-imx/devices.h
+++ b/arch/arm/mach-imx/devices.h
@@ -16,7 +16,6 @@ extern struct platform_device mxc_gpt5;
16extern struct platform_device mxc_wdt; 16extern struct platform_device mxc_wdt;
17extern struct platform_device mxc_w1_master_device; 17extern struct platform_device mxc_w1_master_device;
18extern struct platform_device mxc_fb_device; 18extern struct platform_device mxc_fb_device;
19extern struct platform_device mxc_fec_device;
20extern struct platform_device mxc_pwm_device; 19extern struct platform_device mxc_pwm_device;
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;
@@ -26,7 +25,5 @@ extern struct platform_device mxc_otg_host;
26extern struct platform_device mxc_usbh1; 25extern struct platform_device mxc_usbh1;
27extern struct platform_device mxc_usbh2; 26extern struct platform_device mxc_usbh2;
28extern struct platform_device mx21_usbhc_device; 27extern struct platform_device mx21_usbhc_device;
29extern struct platform_device imx_ssi_device0;
30extern struct platform_device imx_ssi_device1;
31extern struct platform_device imx_kpp_device; 28extern struct platform_device imx_kpp_device;
32#endif 29#endif
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
index 4edc5f439201..026263c665ca 100644
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
@@ -36,13 +36,12 @@
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <mach/mmc.h> 37#include <mach/mmc.h>
38#include <mach/spi.h> 38#include <mach/spi.h>
39#include <mach/ssi.h>
40#include <mach/audmux.h> 39#include <mach/audmux.h>
41 40
42#include "devices-imx27.h" 41#include "devices-imx27.h"
43#include "devices.h" 42#include "devices.h"
44 43
45static int eukrea_mbimx27_pins[] = { 44static const int eukrea_mbimx27_pins[] __initconst = {
46 /* UART2 */ 45 /* UART2 */
47 PE3_PF_UART2_CTS, 46 PE3_PF_UART2_CTS,
48 PE4_PF_UART2_RTS, 47 PE4_PF_UART2_RTS,
@@ -311,7 +310,8 @@ static struct imxmmc_platform_data sdhc_pdata = {
311 .dat3_card_detect = 1, 310 .dat3_card_detect = 1,
312}; 311};
313 312
314struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata = { 313static const
314struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata __initconst = {
315 .flags = IMX_SSI_DMA | IMX_SSI_USE_I2S_SLAVE, 315 .flags = IMX_SSI_DMA | IMX_SSI_USE_I2S_SLAVE,
316}; 316};
317 317
@@ -357,7 +357,7 @@ void __init eukrea_mbimx27_baseboard_init(void)
357 i2c_register_board_info(0, eukrea_mbimx27_i2c_devices, 357 i2c_register_board_info(0, eukrea_mbimx27_i2c_devices,
358 ARRAY_SIZE(eukrea_mbimx27_i2c_devices)); 358 ARRAY_SIZE(eukrea_mbimx27_i2c_devices));
359 359
360 mxc_register_device(&imx_ssi_device0, &eukrea_mbimx27_ssi_pdata); 360 imx27_add_imx_ssi(0, &eukrea_mbimx27_ssi_pdata);
361 361
362#if defined(CONFIG_TOUCHSCREEN_ADS7846) \ 362#if defined(CONFIG_TOUCHSCREEN_ADS7846) \
363 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 363 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 339150ab0ea5..a1681fc9d9b0 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -46,7 +46,7 @@
46#include "devices-imx27.h" 46#include "devices-imx27.h"
47#include "devices.h" 47#include "devices.h"
48 48
49static int eukrea_cpuimx27_pins[] = { 49static const int eukrea_cpuimx27_pins[] __initconst = {
50 /* UART1 */ 50 /* UART1 */
51 PE12_PF_UART1_TXD, 51 PE12_PF_UART1_TXD,
52 PE13_PF_UART1_RXD, 52 PE13_PF_UART1_RXD,
@@ -157,7 +157,6 @@ cpuimx27_nand_board_info __initconst = {
157 157
158static struct platform_device *platform_devices[] __initdata = { 158static struct platform_device *platform_devices[] __initdata = {
159 &eukrea_cpuimx27_nor_mtd_device, 159 &eukrea_cpuimx27_nor_mtd_device,
160 &mxc_fec_device,
161 &mxc_wdt, 160 &mxc_wdt,
162 &mxc_w1_master_device, 161 &mxc_w1_master_device,
163}; 162};
@@ -259,8 +258,9 @@ static void __init eukrea_cpuimx27_init(void)
259 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices, 258 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
260 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices)); 259 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
261 260
262 imx27_add_i2c_imx1(&cpuimx27_i2c1_data); 261 imx27_add_imx_i2c(0, &cpuimx27_i2c1_data);
263 262
263 imx27_add_fec(NULL);
264 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 264 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
265 265
266#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2) 266#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
new file mode 100644
index 000000000000..a0d78faa08e8
--- /dev/null
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -0,0 +1,263 @@
1/*
2 * mach-imx27_visstrim_m10.c
3 *
4 * Copyright 2010 Javier Martin <javier.martin@vista-silicon.com>
5 *
6 * Based on mach-pcm038.c, mach-pca100.c, mach-mx27ads.c and others.
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., 51 Franklin Street, Fifth Floor, Boston,
21 * MA 02110-1301, USA.
22 */
23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
26#include <linux/platform_device.h>
27#include <linux/mtd/physmap.h>
28#include <linux/i2c.h>
29#include <linux/i2c/pca953x.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
32#include <linux/gpio.h>
33#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/time.h>
36#include <mach/common.h>
37#include <mach/mmc.h>
38#include <mach/iomux.h>
39#include <mach/mxc_ehci.h>
40
41#include "devices-imx27.h"
42#include "devices.h"
43
44#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
45#define SDHC1_IRQ IRQ_GPIOB(25)
46
47static const int visstrim_m10_pins[] __initconst = {
48 /* UART1 (console) */
49 PE12_PF_UART1_TXD,
50 PE13_PF_UART1_RXD,
51 PE14_PF_UART1_CTS,
52 PE15_PF_UART1_RTS,
53 /* FEC */
54 PD0_AIN_FEC_TXD0,
55 PD1_AIN_FEC_TXD1,
56 PD2_AIN_FEC_TXD2,
57 PD3_AIN_FEC_TXD3,
58 PD4_AOUT_FEC_RX_ER,
59 PD5_AOUT_FEC_RXD1,
60 PD6_AOUT_FEC_RXD2,
61 PD7_AOUT_FEC_RXD3,
62 PD8_AF_FEC_MDIO,
63 PD9_AIN_FEC_MDC,
64 PD10_AOUT_FEC_CRS,
65 PD11_AOUT_FEC_TX_CLK,
66 PD12_AOUT_FEC_RXD0,
67 PD13_AOUT_FEC_RX_DV,
68 PD14_AOUT_FEC_RX_CLK,
69 PD15_AOUT_FEC_COL,
70 PD16_AIN_FEC_TX_ER,
71 PF23_AIN_FEC_TX_EN,
72 /* SDHC1 */
73 PE18_PF_SD1_D0,
74 PE19_PF_SD1_D1,
75 PE20_PF_SD1_D2,
76 PE21_PF_SD1_D3,
77 PE22_PF_SD1_CMD,
78 PE23_PF_SD1_CLK,
79 /* Both I2Cs */
80 PD17_PF_I2C_DATA,
81 PD18_PF_I2C_CLK,
82 PC5_PF_I2C2_SDA,
83 PC6_PF_I2C2_SCL,
84 /* USB OTG */
85 OTG_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT,
86 PC9_PF_USBOTG_DATA0,
87 PC11_PF_USBOTG_DATA1,
88 PC10_PF_USBOTG_DATA2,
89 PC13_PF_USBOTG_DATA3,
90 PC12_PF_USBOTG_DATA4,
91 PC7_PF_USBOTG_DATA5,
92 PC8_PF_USBOTG_DATA6,
93 PE25_PF_USBOTG_DATA7,
94 PE24_PF_USBOTG_CLK,
95 PE2_PF_USBOTG_DIR,
96 PE0_PF_USBOTG_NXT,
97 PE1_PF_USBOTG_STP,
98 PB23_PF_USB_PWR,
99 PB24_PF_USB_OC,
100};
101
102/* GPIOs used as events for applications */
103static struct gpio_keys_button visstrim_gpio_keys[] = {
104 {
105 .type = EV_KEY,
106 .code = KEY_RESTART,
107 .gpio = (GPIO_PORTC + 15),
108 .desc = "Default config",
109 .active_low = 0,
110 .wakeup = 1,
111 },
112 {
113 .type = EV_KEY,
114 .code = KEY_RECORD,
115 .gpio = (GPIO_PORTF + 14),
116 .desc = "Record",
117 .active_low = 0,
118 .wakeup = 1,
119 },
120 {
121 .type = EV_KEY,
122 .code = KEY_STOP,
123 .gpio = (GPIO_PORTF + 13),
124 .desc = "Stop",
125 .active_low = 0,
126 .wakeup = 1,
127 }
128};
129
130static struct gpio_keys_platform_data visstrim_gpio_keys_platform_data = {
131 .buttons = visstrim_gpio_keys,
132 .nbuttons = ARRAY_SIZE(visstrim_gpio_keys),
133};
134
135static struct platform_device visstrim_gpio_keys_device = {
136 .name = "gpio-keys",
137 .id = -1,
138 .dev = {
139 .platform_data = &visstrim_gpio_keys_platform_data,
140 },
141};
142
143/* Visstrim_SM10 has a microSD slot connected to sdhc1 */
144static int visstrim_m10_sdhc1_init(struct device *dev,
145 irq_handler_t detect_irq, void *data)
146{
147 int ret;
148
149 ret = request_irq(SDHC1_IRQ, detect_irq, IRQF_TRIGGER_FALLING,
150 "mmc-detect", data);
151 return ret;
152}
153
154static void visstrim_m10_sdhc1_exit(struct device *dev, void *data)
155{
156 free_irq(SDHC1_IRQ, data);
157}
158
159static struct imxmmc_platform_data visstrim_m10_sdhc_pdata = {
160 .init = visstrim_m10_sdhc1_init,
161 .exit = visstrim_m10_sdhc1_exit,
162};
163
164/* Visstrim_SM10 NOR flash */
165static struct physmap_flash_data visstrim_m10_flash_data = {
166 .width = 2,
167};
168
169static struct resource visstrim_m10_flash_resource = {
170 .start = 0xc0000000,
171 .end = 0xc0000000 + SZ_64M - 1,
172 .flags = IORESOURCE_MEM,
173};
174
175static struct platform_device visstrim_m10_nor_mtd_device = {
176 .name = "physmap-flash",
177 .id = 0,
178 .dev = {
179 .platform_data = &visstrim_m10_flash_data,
180 },
181 .num_resources = 1,
182 .resource = &visstrim_m10_flash_resource,
183};
184
185static struct platform_device *platform_devices[] __initdata = {
186 &visstrim_gpio_keys_device,
187 &visstrim_m10_nor_mtd_device,
188};
189
190/* Visstrim_M10 uses UART0 as console */
191static const struct imxuart_platform_data uart_pdata __initconst = {
192 .flags = IMXUART_HAVE_RTSCTS,
193};
194
195/* I2C */
196static const struct imxi2c_platform_data visstrim_m10_i2c_data __initconst = {
197 .bitrate = 100000,
198};
199
200static struct pca953x_platform_data visstrim_m10_pca9555_pdata = {
201 .gpio_base = 240, /* After MX27 internal GPIOs */
202 .invert = 0,
203};
204
205static struct i2c_board_info visstrim_m10_i2c_devices[] = {
206 {
207 I2C_BOARD_INFO("pca9555", 0x20),
208 .platform_data = &visstrim_m10_pca9555_pdata,
209 },
210};
211
212/* USB OTG */
213static int otg_phy_init(struct platform_device *pdev)
214{
215 gpio_set_value(OTG_PHY_CS_GPIO, 0);
216 return 0;
217}
218
219static struct mxc_usbh_platform_data visstrim_m10_usbotg_pdata = {
220 .init = otg_phy_init,
221 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
222 .flags = MXC_EHCI_POWER_PINS_ENABLED,
223};
224
225static void __init visstrim_m10_board_init(void)
226{
227 int ret;
228
229 ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins,
230 ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10");
231 if (ret)
232 pr_err("Failed to setup pins (%d)\n", ret);
233
234 imx27_add_imx_uart0(&uart_pdata);
235
236 i2c_register_board_info(0, visstrim_m10_i2c_devices,
237 ARRAY_SIZE(visstrim_m10_i2c_devices));
238 imx27_add_imx_i2c(0, &visstrim_m10_i2c_data);
239 imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
240 mxc_register_device(&mxc_sdhc_device0, &visstrim_m10_sdhc_pdata);
241 mxc_register_device(&mxc_otg_host, &visstrim_m10_usbotg_pdata);
242 imx27_add_fec(NULL);
243 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
244}
245
246static void __init visstrim_m10_timer_init(void)
247{
248 mx27_clocks_init((unsigned long)25000000);
249}
250
251static struct sys_timer visstrim_m10_timer = {
252 .init = visstrim_m10_timer_init,
253};
254
255MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10")
256 .phys_io = MX27_AIPI_BASE_ADDR,
257 .io_pg_offst = ((MX27_AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
258 .boot_params = MX27_PHYS_OFFSET + 0x100,
259 .map_io = mx27_map_io,
260 .init_irq = mx27_init_irq,
261 .init_machine = visstrim_m10_board_init,
262 .timer = &visstrim_m10_timer,
263MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx27lite.c b/arch/arm/mach-imx/mach-imx27lite.c
index 22a2b5d91213..60d4d0ac4939 100644
--- a/arch/arm/mach-imx/mach-imx27lite.c
+++ b/arch/arm/mach-imx/mach-imx27lite.c
@@ -27,7 +27,7 @@
27#include "devices-imx27.h" 27#include "devices-imx27.h"
28#include "devices.h" 28#include "devices.h"
29 29
30static unsigned int mx27lite_pins[] = { 30static const int mx27lite_pins[] __initconst = {
31 /* UART1 */ 31 /* UART1 */
32 PE12_PF_UART1_TXD, 32 PE12_PF_UART1_TXD,
33 PE13_PF_UART1_RXD, 33 PE13_PF_UART1_RXD,
@@ -58,16 +58,12 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
58 .flags = IMXUART_HAVE_RTSCTS, 58 .flags = IMXUART_HAVE_RTSCTS,
59}; 59};
60 60
61static struct platform_device *platform_devices[] __initdata = {
62 &mxc_fec_device,
63};
64
65static void __init mx27lite_init(void) 61static void __init mx27lite_init(void)
66{ 62{
67 mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins), 63 mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
68 "imx27lite"); 64 "imx27lite");
69 imx27_add_imx_uart0(&uart_pdata); 65 imx27_add_imx_uart0(&uart_pdata);
70 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 66 imx27_add_fec(NULL);
71} 67}
72 68
73static void __init mx27lite_timer_init(void) 69static void __init mx27lite_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx1ads.c b/arch/arm/mach-imx/mach-mx1ads.c
index 77a760cfadc0..85e2877572b5 100644
--- a/arch/arm/mach-imx/mach-mx1ads.c
+++ b/arch/arm/mach-imx/mach-mx1ads.c
@@ -32,7 +32,7 @@
32#include "devices-imx1.h" 32#include "devices-imx1.h"
33#include "devices.h" 33#include "devices.h"
34 34
35static int mx1ads_pins[] = { 35static const int mx1ads_pins[] __initconst = {
36 /* UART1 */ 36 /* UART1 */
37 PC9_PF_UART1_CTS, 37 PC9_PF_UART1_CTS,
38 PC10_PF_UART1_RTS, 38 PC10_PF_UART1_RTS,
@@ -131,7 +131,7 @@ static void __init mx1ads_init(void)
131 i2c_register_board_info(0, mx1ads_i2c_devices, 131 i2c_register_board_info(0, mx1ads_i2c_devices,
132 ARRAY_SIZE(mx1ads_i2c_devices)); 132 ARRAY_SIZE(mx1ads_i2c_devices));
133 133
134 imx1_add_i2c_imx(&mx1ads_i2c_data); 134 imx1_add_imx_i2c(&mx1ads_i2c_data);
135} 135}
136 136
137static void __init mx1ads_timer_init(void) 137static void __init mx1ads_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index 96d7f8189f32..7f021e6f6acd 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -67,7 +67,7 @@
67#define MX21ADS_IO_LED4_ON 0x4000 67#define MX21ADS_IO_LED4_ON 0x4000
68#define MX21ADS_IO_LED3_ON 0x8000 68#define MX21ADS_IO_LED3_ON 0x8000
69 69
70static unsigned int mx21ads_pins[] = { 70static const int mx21ads_pins[] __initconst = {
71 71
72 /* CS8900A */ 72 /* CS8900A */
73 (GPIO_PORTE | GPIO_GPIO | GPIO_IN | 11), 73 (GPIO_PORTE | GPIO_GPIO | GPIO_IN | 11),
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index e66ffaa1c26c..a69dba252658 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -33,7 +33,7 @@
33#include "devices-imx27.h" 33#include "devices-imx27.h"
34#include "devices.h" 34#include "devices.h"
35 35
36static unsigned int mx27pdk_pins[] = { 36static const int mx27pdk_pins[] __initconst = {
37 /* UART1 */ 37 /* UART1 */
38 PE12_PF_UART1_TXD, 38 PE12_PF_UART1_TXD,
39 PE13_PF_UART1_RXD, 39 PE13_PF_UART1_RXD,
@@ -64,10 +64,6 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
64 .flags = IMXUART_HAVE_RTSCTS, 64 .flags = IMXUART_HAVE_RTSCTS,
65}; 65};
66 66
67static struct platform_device *platform_devices[] __initdata = {
68 &mxc_fec_device,
69};
70
71/* 67/*
72 * Matrix keyboard 68 * Matrix keyboard
73 */ 69 */
@@ -94,7 +90,7 @@ static void __init mx27pdk_init(void)
94 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), 90 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
95 "mx27pdk"); 91 "mx27pdk");
96 imx27_add_imx_uart0(&uart_pdata); 92 imx27_add_imx_uart0(&uart_pdata);
97 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 93 imx27_add_fec(NULL);
98 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data); 94 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
99} 95}
100 96
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 9c77da98a10e..ffb39a42f240 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -66,7 +66,7 @@
66/* to determine the correct external crystal reference */ 66/* to determine the correct external crystal reference */
67#define CKIH_27MHZ_BIT_SET (1 << 3) 67#define CKIH_27MHZ_BIT_SET (1 << 3)
68 68
69static unsigned int mx27ads_pins[] = { 69static const int mx27ads_pins[] __initconst = {
70 /* UART0 */ 70 /* UART0 */
71 PE12_PF_UART1_TXD, 71 PE12_PF_UART1_TXD,
72 PE13_PF_UART1_RXD, 72 PE13_PF_UART1_RXD,
@@ -284,7 +284,6 @@ static struct imxmmc_platform_data sdhc2_pdata = {
284 284
285static struct platform_device *platform_devices[] __initdata = { 285static struct platform_device *platform_devices[] __initdata = {
286 &mx27ads_nor_mtd_device, 286 &mx27ads_nor_mtd_device,
287 &mxc_fec_device,
288 &mxc_w1_master_device, 287 &mxc_w1_master_device,
289}; 288};
290 289
@@ -308,11 +307,12 @@ static void __init mx27ads_board_init(void)
308 /* only the i2c master 1 is used on this CPU card */ 307 /* only the i2c master 1 is used on this CPU card */
309 i2c_register_board_info(1, mx27ads_i2c_devices, 308 i2c_register_board_info(1, mx27ads_i2c_devices,
310 ARRAY_SIZE(mx27ads_i2c_devices)); 309 ARRAY_SIZE(mx27ads_i2c_devices));
311 imx27_add_i2c_imx1(&mx27ads_i2c1_data); 310 imx27_add_imx_i2c(1, &mx27ads_i2c1_data);
312 mxc_register_device(&mxc_fb_device, &mx27ads_fb_data); 311 mxc_register_device(&mxc_fb_device, &mx27ads_fb_data);
313 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 312 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
314 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata); 313 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata);
315 314
315 imx27_add_fec(NULL);
316 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 316 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
317} 317}
318 318
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
index a3a1e452d4c5..f4c397dec794 100644
--- a/arch/arm/mach-imx/mach-mxt_td60.c
+++ b/arch/arm/mach-imx/mach-mxt_td60.c
@@ -37,7 +37,7 @@
37#include "devices-imx27.h" 37#include "devices-imx27.h"
38#include "devices.h" 38#include "devices.h"
39 39
40static unsigned int mxt_td60_pins[] __initdata = { 40static const int mxt_td60_pins[] __initconst = {
41 /* UART0 */ 41 /* UART0 */
42 PE12_PF_UART1_TXD, 42 PE12_PF_UART1_TXD,
43 PE13_PF_UART1_RXD, 43 PE13_PF_UART1_RXD,
@@ -231,10 +231,6 @@ static struct imxmmc_platform_data sdhc1_pdata = {
231 .exit = mxt_td60_sdhc1_exit, 231 .exit = mxt_td60_sdhc1_exit,
232}; 232};
233 233
234static struct platform_device *platform_devices[] __initdata = {
235 &mxc_fec_device,
236};
237
238static const struct imxuart_platform_data uart_pdata __initconst = { 234static const struct imxuart_platform_data uart_pdata __initconst = {
239 .flags = IMXUART_HAVE_RTSCTS, 235 .flags = IMXUART_HAVE_RTSCTS,
240}; 236};
@@ -255,12 +251,11 @@ static void __init mxt_td60_board_init(void)
255 i2c_register_board_info(1, mxt_td60_i2c2_devices, 251 i2c_register_board_info(1, mxt_td60_i2c2_devices,
256 ARRAY_SIZE(mxt_td60_i2c2_devices)); 252 ARRAY_SIZE(mxt_td60_i2c2_devices));
257 253
258 imx27_add_i2c_imx0(&mxt_td60_i2c0_data); 254 imx27_add_imx_i2c(0, &mxt_td60_i2c0_data);
259 imx27_add_i2c_imx1(&mxt_td60_i2c1_data); 255 imx27_add_imx_i2c(1, &mxt_td60_i2c1_data);
260 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data); 256 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data);
261 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 257 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
262 258 imx27_add_fec(NULL);
263 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
264} 259}
265 260
266static void __init mxt_td60_timer_init(void) 261static void __init mxt_td60_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index 23c9e1f37b9c..223c31c48db6 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -38,7 +38,6 @@
38#include <mach/iomux-mx27.h> 38#include <mach/iomux-mx27.h>
39#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40#include <mach/audmux.h> 40#include <mach/audmux.h>
41#include <mach/ssi.h>
42#include <mach/mxc_nand.h> 41#include <mach/mxc_nand.h>
43#include <mach/irqs.h> 42#include <mach/irqs.h>
44#include <mach/mmc.h> 43#include <mach/mmc.h>
@@ -55,7 +54,7 @@
55#define SPI1_SS1 (GPIO_PORTD + 27) 54#define SPI1_SS1 (GPIO_PORTD + 27)
56#define SD2_CD (GPIO_PORTC + 29) 55#define SD2_CD (GPIO_PORTC + 29)
57 56
58static int pca100_pins[] = { 57static const int pca100_pins[] __initconst = {
59 /* UART1 */ 58 /* UART1 */
60 PE12_PF_UART1_TXD, 59 PE12_PF_UART1_TXD,
61 PE13_PF_UART1_RXD, 60 PE13_PF_UART1_RXD,
@@ -174,7 +173,6 @@ pca100_nand_board_info __initconst = {
174 173
175static struct platform_device *platform_devices[] __initdata = { 174static struct platform_device *platform_devices[] __initdata = {
176 &mxc_w1_master_device, 175 &mxc_w1_master_device,
177 &mxc_fec_device,
178 &mxc_wdt, 176 &mxc_wdt,
179}; 177};
180 178
@@ -193,11 +191,9 @@ static struct i2c_board_info pca100_i2c_devices[] = {
193 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ 191 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
194 .platform_data = &board_eeprom, 192 .platform_data = &board_eeprom,
195 }, { 193 }, {
196 I2C_BOARD_INFO("rtc-pcf8563", 0x51), 194 I2C_BOARD_INFO("pcf8563", 0x51),
197 .type = "pcf8563"
198 }, { 195 }, {
199 I2C_BOARD_INFO("lm75", 0x4a), 196 I2C_BOARD_INFO("lm75", 0x4a),
200 .type = "lm75"
201 } 197 }
202}; 198};
203 199
@@ -252,7 +248,7 @@ static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
252 msleep(2); 248 msleep(2);
253} 249}
254 250
255static struct imx_ssi_platform_data pca100_ssi_pdata = { 251static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = {
256 .ac97_reset = pca100_ac97_cold_reset, 252 .ac97_reset = pca100_ac97_cold_reset,
257 .ac97_warm_reset = pca100_ac97_warm_reset, 253 .ac97_warm_reset = pca100_ac97_warm_reset,
258 .flags = IMX_SSI_USE_AC97, 254 .flags = IMX_SSI_USE_AC97,
@@ -389,7 +385,7 @@ static void __init pca100_init(void)
389 if (ret) 385 if (ret)
390 printk(KERN_ERR "pca100: Failed to setup pins (%d)\n", ret); 386 printk(KERN_ERR "pca100: Failed to setup pins (%d)\n", ret);
391 387
392 mxc_register_device(&imx_ssi_device0, &pca100_ssi_pdata); 388 imx27_add_imx_ssi(0, &pca100_ssi_pdata);
393 389
394 imx27_add_imx_uart0(&uart_pdata); 390 imx27_add_imx_uart0(&uart_pdata);
395 391
@@ -401,7 +397,7 @@ static void __init pca100_init(void)
401 i2c_register_board_info(1, pca100_i2c_devices, 397 i2c_register_board_info(1, pca100_i2c_devices,
402 ARRAY_SIZE(pca100_i2c_devices)); 398 ARRAY_SIZE(pca100_i2c_devices));
403 399
404 imx27_add_i2c_imx1(&pca100_i2c1_data); 400 imx27_add_imx_i2c(1, &pca100_i2c1_data);
405 401
406#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) 402#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
407 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_IN); 403 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_IN);
@@ -436,6 +432,7 @@ static void __init pca100_init(void)
436 432
437 mxc_register_device(&mxc_fb_device, &pca100_fb_data); 433 mxc_register_device(&mxc_fb_device, &pca100_fb_data);
438 434
435 imx27_add_fec(NULL);
439 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 436 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
440} 437}
441 438
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 9212e8f37001..b9888a8defc1 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -43,7 +43,7 @@
43#include "devices-imx27.h" 43#include "devices-imx27.h"
44#include "devices.h" 44#include "devices.h"
45 45
46static int pcm038_pins[] = { 46static const int pcm038_pins[] __initconst = {
47 /* UART1 */ 47 /* UART1 */
48 PE12_PF_UART1_TXD, 48 PE12_PF_UART1_TXD,
49 PE13_PF_UART1_RXD, 49 PE13_PF_UART1_RXD,
@@ -173,7 +173,6 @@ pcm038_nand_board_info __initconst = {
173static struct platform_device *platform_devices[] __initdata = { 173static struct platform_device *platform_devices[] __initdata = {
174 &pcm038_nor_mtd_device, 174 &pcm038_nor_mtd_device,
175 &mxc_w1_master_device, 175 &mxc_w1_master_device,
176 &mxc_fec_device,
177 &pcm038_sram_mtd_device, 176 &pcm038_sram_mtd_device,
178 &mxc_wdt, 177 &mxc_wdt,
179}; 178};
@@ -257,7 +256,7 @@ static struct regulator_init_data cam_data = {
257 .consumer_supplies = cam_consumers, 256 .consumer_supplies = cam_consumers,
258}; 257};
259 258
260struct mc13783_regulator_init_data pcm038_regulators[] = { 259static struct mc13783_regulator_init_data pcm038_regulators[] = {
261 { 260 {
262 .id = MC13783_REGU_VCAM, 261 .id = MC13783_REGU_VCAM,
263 .init_data = &cam_data, 262 .init_data = &cam_data,
@@ -309,7 +308,7 @@ static void __init pcm038_init(void)
309 i2c_register_board_info(1, pcm038_i2c_devices, 308 i2c_register_board_info(1, pcm038_i2c_devices,
310 ARRAY_SIZE(pcm038_i2c_devices)); 309 ARRAY_SIZE(pcm038_i2c_devices));
311 310
312 imx27_add_i2c_imx1(&pcm038_i2c1_data); 311 imx27_add_imx_i2c(1, &pcm038_i2c1_data);
313 312
314 /* PE18 for user-LED D40 */ 313 /* PE18 for user-LED D40 */
315 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT); 314 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT);
@@ -325,6 +324,7 @@ static void __init pcm038_init(void)
325 324
326 mxc_register_device(&mxc_usbh2, &usbh2_pdata); 325 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
327 326
327 imx27_add_fec(NULL);
328 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 328 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
329 329
330#ifdef CONFIG_MACH_PCM970_BASEBOARD 330#ifdef CONFIG_MACH_PCM970_BASEBOARD
diff --git a/arch/arm/mach-imx/mach-scb9328.c b/arch/arm/mach-imx/mach-scb9328.c
index 88bf0d1e26e6..fb2e5f3d37f6 100644
--- a/arch/arm/mach-imx/mach-scb9328.c
+++ b/arch/arm/mach-imx/mach-scb9328.c
@@ -95,7 +95,7 @@ static struct platform_device dm9000x_device = {
95 } 95 }
96}; 96};
97 97
98static int mxc_uart1_pins[] = { 98static const int mxc_uart1_pins[] = {
99 PC9_PF_UART1_CTS, 99 PC9_PF_UART1_CTS,
100 PC10_PF_UART1_RTS, 100 PC10_PF_UART1_RTS,
101 PC11_PF_UART1_TXD, 101 PC11_PF_UART1_TXD,
diff --git a/arch/arm/mach-imx/pcm970-baseboard.c b/arch/arm/mach-imx/pcm970-baseboard.c
index f490a406d57e..9110d9cca7a2 100644
--- a/arch/arm/mach-imx/pcm970-baseboard.c
+++ b/arch/arm/mach-imx/pcm970-baseboard.c
@@ -31,7 +31,7 @@
31 31
32#include "devices.h" 32#include "devices.h"
33 33
34static int pcm970_pins[] = { 34static const int pcm970_pins[] __initconst = {
35 /* SDHC */ 35 /* SDHC */
36 PB4_PF_SD2_D0, 36 PB4_PF_SD2_D0,
37 PB5_PF_SD2_D1, 37 PB5_PF_SD2_D1,
@@ -200,7 +200,7 @@ static struct resource pcm970_sja1000_resources[] = {
200 }, 200 },
201}; 201};
202 202
203struct sja1000_platform_data pcm970_sja1000_platform_data = { 203static struct sja1000_platform_data pcm970_sja1000_platform_data = {
204 .osc_freq = 16000000, 204 .osc_freq = 16000000,
205 .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL, 205 .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
206 .cdr = CDR_CBP, 206 .cdr = CDR_CBP,
diff --git a/arch/arm/mach-integrator/include/mach/vmalloc.h b/arch/arm/mach-integrator/include/mach/vmalloc.h
index e87ab0b37bdd..e056e7cf5645 100644
--- a/arch/arm/mach-integrator/include/mach/vmalloc.h
+++ b/arch/arm/mach-integrator/include/mach/vmalloc.h
@@ -17,4 +17,4 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 20#define VMALLOC_END 0xd0000000
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index cc25501b57fa..34106335c728 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -58,6 +58,12 @@ config MACH_TS41X
58 QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS 58 QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS
59 devices. 59 devices.
60 60
61config MACH_DOCKSTAR
62 bool "Seagate FreeAgent DockStar"
63 help
64 Say 'Y' here if you want your kernel to support the
65 Seagate FreeAgent DockStar.
66
61config MACH_OPENRD 67config MACH_OPENRD
62 bool 68 bool
63 69
@@ -100,6 +106,12 @@ config MACH_NETSPACE_MAX_V2
100 Say 'Y' here if you want your kernel to support the 106 Say 'Y' here if you want your kernel to support the
101 LaCie Network Space Max v2 NAS. 107 LaCie Network Space Max v2 NAS.
102 108
109config MACH_D2NET_V2
110 bool "LaCie d2 Network v2 NAS Board"
111 help
112 Say 'Y' here if you want your kernel to support the
113 LaCie d2 Network v2 NAS.
114
103config MACH_NET2BIG_V2 115config MACH_NET2BIG_V2
104 bool "LaCie 2Big Network v2 NAS Board" 116 bool "LaCie 2Big Network v2 NAS Board"
105 help 117 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 295d7baa6ae1..5dcaa81a2ec3 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -7,14 +7,16 @@ obj-$(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_ESATA_SHEEVAPLUG) += sheevaplug-setup.o 8obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o
9obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o 9obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o
10obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
10obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o 11obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
11obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o 12obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
12obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o 13obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o
13obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o 14obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
14obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o 15obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
15obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o 16obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o lacie_v2-common.o
16obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o 17obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
17obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o 18obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
19obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
18obj-$(CONFIG_MACH_T5325) += t5325-setup.o 20obj-$(CONFIG_MACH_T5325) += t5325-setup.o
19 21
20obj-$(CONFIG_CPU_IDLE) += cpuidle.o 22obj-$(CONFIG_CPU_IDLE) += cpuidle.o
diff --git a/arch/arm/mach-kirkwood/d2net_v2-setup.c b/arch/arm/mach-kirkwood/d2net_v2-setup.c
new file mode 100644
index 000000000000..cd62d0f82a73
--- /dev/null
+++ b/arch/arm/mach-kirkwood/d2net_v2-setup.c
@@ -0,0 +1,231 @@
1/*
2 * arch/arm/mach-kirkwood/d2net_v2-setup.c
3 *
4 * LaCie d2 Network Space v2 Board Setup
5 *
6 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.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 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/kernel.h>
24#include <linux/init.h>
25#include <linux/platform_device.h>
26#include <linux/ata_platform.h>
27#include <linux/mv643xx_eth.h>
28#include <linux/input.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/leds.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <mach/kirkwood.h>
35#include <mach/leds-ns2.h>
36#include "common.h"
37#include "mpp.h"
38#include "lacie_v2-common.h"
39
40/*****************************************************************************
41 * Ethernet
42 ****************************************************************************/
43
44static struct mv643xx_eth_platform_data d2net_v2_ge00_data = {
45 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
46};
47
48/*****************************************************************************
49 * SATA
50 ****************************************************************************/
51
52static struct mv_sata_platform_data d2net_v2_sata_data = {
53 .n_ports = 2,
54};
55
56/*****************************************************************************
57 * GPIO keys
58 ****************************************************************************/
59
60#define D2NET_V2_GPIO_PUSH_BUTTON 34
61#define D2NET_V2_GPIO_POWER_SWITCH_ON 13
62#define D2NET_V2_GPIO_POWER_SWITCH_OFF 15
63
64#define D2NET_V2_SWITCH_POWER_ON 0x1
65#define D2NET_V2_SWITCH_POWER_OFF 0x2
66
67static struct gpio_keys_button d2net_v2_buttons[] = {
68 [0] = {
69 .type = EV_SW,
70 .code = D2NET_V2_SWITCH_POWER_ON,
71 .gpio = D2NET_V2_GPIO_POWER_SWITCH_ON,
72 .desc = "Back power switch (on|auto)",
73 .active_low = 0,
74 },
75 [1] = {
76 .type = EV_SW,
77 .code = D2NET_V2_SWITCH_POWER_OFF,
78 .gpio = D2NET_V2_GPIO_POWER_SWITCH_OFF,
79 .desc = "Back power switch (auto|off)",
80 .active_low = 0,
81 },
82 [2] = {
83 .code = KEY_POWER,
84 .gpio = D2NET_V2_GPIO_PUSH_BUTTON,
85 .desc = "Front Push Button",
86 .active_low = 1,
87 },
88};
89
90static struct gpio_keys_platform_data d2net_v2_button_data = {
91 .buttons = d2net_v2_buttons,
92 .nbuttons = ARRAY_SIZE(d2net_v2_buttons),
93};
94
95static struct platform_device d2net_v2_gpio_buttons = {
96 .name = "gpio-keys",
97 .id = -1,
98 .dev = {
99 .platform_data = &d2net_v2_button_data,
100 },
101};
102
103/*****************************************************************************
104 * GPIO LEDs
105 ****************************************************************************/
106
107#define D2NET_V2_GPIO_RED_LED 12
108
109static struct gpio_led d2net_v2_gpio_led_pins[] = {
110 {
111 .name = "d2net_v2:red:fail",
112 .gpio = D2NET_V2_GPIO_RED_LED,
113 },
114};
115
116static struct gpio_led_platform_data d2net_v2_gpio_leds_data = {
117 .num_leds = ARRAY_SIZE(d2net_v2_gpio_led_pins),
118 .leds = d2net_v2_gpio_led_pins,
119};
120
121static struct platform_device d2net_v2_gpio_leds = {
122 .name = "leds-gpio",
123 .id = -1,
124 .dev = {
125 .platform_data = &d2net_v2_gpio_leds_data,
126 },
127};
128
129/*****************************************************************************
130 * Dual-GPIO CPLD LEDs
131 ****************************************************************************/
132
133#define D2NET_V2_GPIO_BLUE_LED_SLOW 29
134#define D2NET_V2_GPIO_BLUE_LED_CMD 30
135
136static struct ns2_led d2net_v2_led_pins[] = {
137 {
138 .name = "d2net_v2:blue:sata",
139 .cmd = D2NET_V2_GPIO_BLUE_LED_CMD,
140 .slow = D2NET_V2_GPIO_BLUE_LED_SLOW,
141 },
142};
143
144static struct ns2_led_platform_data d2net_v2_leds_data = {
145 .num_leds = ARRAY_SIZE(d2net_v2_led_pins),
146 .leds = d2net_v2_led_pins,
147};
148
149static struct platform_device d2net_v2_leds = {
150 .name = "leds-ns2",
151 .id = -1,
152 .dev = {
153 .platform_data = &d2net_v2_leds_data,
154 },
155};
156
157/*****************************************************************************
158 * General Setup
159 ****************************************************************************/
160
161static unsigned int d2net_v2_mpp_config[] __initdata = {
162 MPP0_SPI_SCn,
163 MPP1_SPI_MOSI,
164 MPP2_SPI_SCK,
165 MPP3_SPI_MISO,
166 MPP6_SYSRST_OUTn,
167 MPP7_GPO, /* Request power-off */
168 MPP8_TW0_SDA,
169 MPP9_TW0_SCK,
170 MPP10_UART0_TXD,
171 MPP11_UART0_RXD,
172 MPP12_GPO, /* Red led */
173 MPP13_GPIO, /* Rear power switch (on|auto) */
174 MPP14_GPIO, /* USB fuse */
175 MPP15_GPIO, /* Rear power switch (auto|off) */
176 MPP16_GPIO, /* SATA 0 power */
177 MPP21_SATA0_ACTn,
178 MPP24_GPIO, /* USB mode select */
179 MPP26_GPIO, /* USB device vbus */
180 MPP28_GPIO, /* USB enable host vbus */
181 MPP29_GPIO, /* Blue led (slow register) */
182 MPP30_GPIO, /* Blue led (command register) */
183 MPP34_GPIO, /* Power button (1 = Released, 0 = Pushed) */
184 MPP35_GPIO, /* Inhibit power-off */
185 0
186};
187
188#define D2NET_V2_GPIO_POWER_OFF 7
189
190static void d2net_v2_power_off(void)
191{
192 gpio_set_value(D2NET_V2_GPIO_POWER_OFF, 1);
193}
194
195static void __init d2net_v2_init(void)
196{
197 /*
198 * Basic setup. Needs to be called early.
199 */
200 kirkwood_init();
201 kirkwood_mpp_conf(d2net_v2_mpp_config);
202
203 lacie_v2_hdd_power_init(1);
204
205 kirkwood_ehci_init();
206 kirkwood_ge00_init(&d2net_v2_ge00_data);
207 kirkwood_sata_init(&d2net_v2_sata_data);
208 kirkwood_uart0_init();
209 lacie_v2_register_flash();
210 lacie_v2_register_i2c_devices();
211
212 platform_device_register(&d2net_v2_leds);
213 platform_device_register(&d2net_v2_gpio_leds);
214 platform_device_register(&d2net_v2_gpio_buttons);
215
216 if (gpio_request(D2NET_V2_GPIO_POWER_OFF, "power-off") == 0 &&
217 gpio_direction_output(D2NET_V2_GPIO_POWER_OFF, 0) == 0)
218 pm_power_off = d2net_v2_power_off;
219 else
220 pr_err("d2net_v2: failed to configure power-off GPIO\n");
221}
222
223MACHINE_START(D2NET_V2, "LaCie d2 Network v2")
224 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
225 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
226 .boot_params = 0x00000100,
227 .init_machine = d2net_v2_init,
228 .map_io = kirkwood_map_io,
229 .init_irq = kirkwood_init_irq,
230 .timer = &lacie_v2_timer,
231MACHINE_END
diff --git a/arch/arm/mach-kirkwood/dockstar-setup.c b/arch/arm/mach-kirkwood/dockstar-setup.c
new file mode 100644
index 000000000000..a90475d5059c
--- /dev/null
+++ b/arch/arm/mach-kirkwood/dockstar-setup.c
@@ -0,0 +1,112 @@
1/*
2 * arch/arm/mach-kirkwood/dockstar-setup.c
3 *
4 * Seagate FreeAgent DockStar 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/ata_platform.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/gpio.h>
18#include <linux/leds.h>
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <mach/kirkwood.h>
22#include <plat/mvsdio.h>
23#include "common.h"
24#include "mpp.h"
25
26static struct mtd_partition dockstar_nand_parts[] = {
27 {
28 .name = "u-boot",
29 .offset = 0,
30 .size = SZ_1M
31 }, {
32 .name = "uImage",
33 .offset = MTDPART_OFS_NXTBLK,
34 .size = SZ_4M
35 }, {
36 .name = "root",
37 .offset = MTDPART_OFS_NXTBLK,
38 .size = MTDPART_SIZ_FULL
39 },
40};
41
42static struct mv643xx_eth_platform_data dockstar_ge00_data = {
43 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
44};
45
46static struct gpio_led dockstar_led_pins[] = {
47 {
48 .name = "dockstar:green:health",
49 .default_trigger = "default-on",
50 .gpio = 46,
51 .active_low = 1,
52 },
53 {
54 .name = "dockstar:orange:misc",
55 .default_trigger = "none",
56 .gpio = 47,
57 .active_low = 1,
58 },
59};
60
61static struct gpio_led_platform_data dockstar_led_data = {
62 .leds = dockstar_led_pins,
63 .num_leds = ARRAY_SIZE(dockstar_led_pins),
64};
65
66static struct platform_device dockstar_leds = {
67 .name = "leds-gpio",
68 .id = -1,
69 .dev = {
70 .platform_data = &dockstar_led_data,
71 }
72};
73
74static unsigned int dockstar_mpp_config[] __initdata = {
75 MPP29_GPIO, /* USB Power Enable */
76 MPP46_GPIO, /* LED green */
77 MPP47_GPIO, /* LED orange */
78 0
79};
80
81static void __init dockstar_init(void)
82{
83 /*
84 * Basic setup. Needs to be called early.
85 */
86 kirkwood_init();
87
88 /* setup gpio pin select */
89 kirkwood_mpp_conf(dockstar_mpp_config);
90
91 kirkwood_uart0_init();
92 kirkwood_nand_init(ARRAY_AND_SIZE(dockstar_nand_parts), 25);
93
94 if (gpio_request(29, "USB Power Enable") != 0 ||
95 gpio_direction_output(29, 1) != 0)
96 printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
97 kirkwood_ehci_init();
98
99 kirkwood_ge00_init(&dockstar_ge00_data);
100
101 platform_device_register(&dockstar_leds);
102}
103
104MACHINE_START(DOCKSTAR, "Seagate FreeAgent DockStar")
105 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
106 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
107 .boot_params = 0x00000100,
108 .init_machine = dockstar_init,
109 .map_io = kirkwood_map_io,
110 .init_irq = kirkwood_init_irq,
111 .timer = &kirkwood_timer,
112MACHINE_END
diff --git a/arch/arm/mach-kirkwood/include/mach/leds-netxbig.h b/arch/arm/mach-kirkwood/include/mach/leds-netxbig.h
new file mode 100644
index 000000000000..24b536ebdf13
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/leds-netxbig.h
@@ -0,0 +1,55 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/leds-netxbig.h
3 *
4 * Platform data structure for netxbig LED driver
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __MACH_LEDS_NETXBIG_H
12#define __MACH_LEDS_NETXBIG_H
13
14struct netxbig_gpio_ext {
15 unsigned *addr;
16 int num_addr;
17 unsigned *data;
18 int num_data;
19 unsigned enable;
20};
21
22enum netxbig_led_mode {
23 NETXBIG_LED_OFF,
24 NETXBIG_LED_ON,
25 NETXBIG_LED_SATA,
26 NETXBIG_LED_TIMER1,
27 NETXBIG_LED_TIMER2,
28 NETXBIG_LED_MODE_NUM,
29};
30
31#define NETXBIG_LED_INVALID_MODE NETXBIG_LED_MODE_NUM
32
33struct netxbig_led_timer {
34 unsigned long delay_on;
35 unsigned long delay_off;
36 enum netxbig_led_mode mode;
37};
38
39struct netxbig_led {
40 const char *name;
41 const char *default_trigger;
42 int mode_addr;
43 int *mode_val;
44 int bright_addr;
45};
46
47struct netxbig_led_platform_data {
48 struct netxbig_gpio_ext *gpio_ext;
49 struct netxbig_led_timer *timer;
50 int num_timer;
51 struct netxbig_led *leds;
52 int num_leds;
53};
54
55#endif /* __MACH_LEDS_NETXBIG_H */
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.c b/arch/arm/mach-kirkwood/lacie_v2-common.c
new file mode 100644
index 000000000000..d3ea1b6c8a02
--- /dev/null
+++ b/arch/arm/mach-kirkwood/lacie_v2-common.c
@@ -0,0 +1,127 @@
1/*
2 * arch/arm/mach-kirkwood/lacie_v2-common.c
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 <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/mtd/physmap.h>
12#include <linux/spi/flash.h>
13#include <linux/spi/spi.h>
14#include <linux/i2c.h>
15#include <linux/i2c/at24.h>
16#include <linux/gpio.h>
17#include <asm/mach/time.h>
18#include <mach/kirkwood.h>
19#include <mach/irqs.h>
20#include <plat/time.h>
21#include "common.h"
22
23/*****************************************************************************
24 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
25 ****************************************************************************/
26
27static struct mtd_partition lacie_v2_flash_parts[] = {
28 {
29 .name = "u-boot",
30 .size = MTDPART_SIZ_FULL,
31 .offset = 0,
32 .mask_flags = MTD_WRITEABLE, /* force read-only */
33 },
34};
35
36static const struct flash_platform_data lacie_v2_flash = {
37 .type = "mx25l4005a",
38 .name = "spi_flash",
39 .parts = lacie_v2_flash_parts,
40 .nr_parts = ARRAY_SIZE(lacie_v2_flash_parts),
41};
42
43static struct spi_board_info __initdata lacie_v2_spi_slave_info[] = {
44 {
45 .modalias = "m25p80",
46 .platform_data = &lacie_v2_flash,
47 .irq = -1,
48 .max_speed_hz = 20000000,
49 .bus_num = 0,
50 .chip_select = 0,
51 },
52};
53
54void __init lacie_v2_register_flash(void)
55{
56 spi_register_board_info(lacie_v2_spi_slave_info,
57 ARRAY_SIZE(lacie_v2_spi_slave_info));
58 kirkwood_spi_init();
59}
60
61/*****************************************************************************
62 * I2C devices
63 ****************************************************************************/
64
65static struct at24_platform_data at24c04 = {
66 .byte_len = SZ_4K / 8,
67 .page_size = 16,
68};
69
70/*
71 * i2c addr | chip | description
72 * 0x50 | HT24LC04 | eeprom (512B)
73 */
74
75static struct i2c_board_info __initdata lacie_v2_i2c_info[] = {
76 {
77 I2C_BOARD_INFO("24c04", 0x50),
78 .platform_data = &at24c04,
79 }
80};
81
82void __init lacie_v2_register_i2c_devices(void)
83{
84 kirkwood_i2c_init();
85 i2c_register_board_info(0, lacie_v2_i2c_info,
86 ARRAY_SIZE(lacie_v2_i2c_info));
87}
88
89/*****************************************************************************
90 * Hard Disk power
91 ****************************************************************************/
92
93static int __initdata lacie_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 };
94
95void __init lacie_v2_hdd_power_init(int hdd_num)
96{
97 int i;
98 int err;
99
100 /* Power up all hard disks. */
101 for (i = 0; i < hdd_num; i++) {
102 err = gpio_request(lacie_v2_gpio_hdd_power[i], NULL);
103 if (err == 0) {
104 err = gpio_direction_output(
105 lacie_v2_gpio_hdd_power[i], 1);
106 /* Free the HDD power GPIOs. This allow user-space to
107 * configure them via the gpiolib sysfs interface. */
108 gpio_free(lacie_v2_gpio_hdd_power[i]);
109 }
110 if (err)
111 pr_err("Failed to power up HDD%d\n", i + 1);
112 }
113}
114
115/*****************************************************************************
116 * Timer
117 ****************************************************************************/
118
119static void lacie_v2_timer_init(void)
120{
121 kirkwood_tclk = 166666667;
122 orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
123}
124
125struct sys_timer lacie_v2_timer = {
126 .init = lacie_v2_timer_init,
127};
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.h b/arch/arm/mach-kirkwood/lacie_v2-common.h
new file mode 100644
index 000000000000..af521315b87b
--- /dev/null
+++ b/arch/arm/mach-kirkwood/lacie_v2-common.h
@@ -0,0 +1,18 @@
1/*
2 * arch/arm/mach-kirkwood/lacie_v2-common.h
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#ifndef __ARCH_KIRKWOOD_LACIE_V2_COMMON_H
10#define __ARCH_KIRKWOOD_LACIE_V2_COMMON_H
11
12void lacie_v2_register_flash(void);
13void lacie_v2_register_i2c_devices(void);
14void lacie_v2_hdd_power_init(int hdd_num);
15
16extern struct sys_timer lacie_v2_timer;
17
18#endif
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c
index d26bf324738b..fed264d28f4a 100644
--- a/arch/arm/mach-kirkwood/netspace_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c
@@ -24,56 +24,19 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/mtd/physmap.h>
28#include <linux/spi/flash.h>
29#include <linux/spi/spi.h>
30#include <linux/ata_platform.h> 27#include <linux/ata_platform.h>
31#include <linux/mv643xx_eth.h> 28#include <linux/mv643xx_eth.h>
32#include <linux/i2c.h>
33#include <linux/i2c/at24.h>
34#include <linux/input.h> 29#include <linux/input.h>
35#include <linux/gpio.h> 30#include <linux/gpio.h>
36#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
37#include <linux/leds.h> 32#include <linux/leds.h>
38#include <asm/mach-types.h> 33#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
40#include <asm/mach/time.h>
41#include <mach/kirkwood.h> 35#include <mach/kirkwood.h>
42#include <mach/leds-ns2.h> 36#include <mach/leds-ns2.h>
43#include <plat/time.h>
44#include "common.h" 37#include "common.h"
45#include "mpp.h" 38#include "mpp.h"
46 39#include "lacie_v2-common.h"
47/*****************************************************************************
48 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
49 ****************************************************************************/
50
51static struct mtd_partition netspace_v2_flash_parts[] = {
52 {
53 .name = "u-boot",
54 .size = MTDPART_SIZ_FULL,
55 .offset = 0,
56 .mask_flags = MTD_WRITEABLE, /* force read-only */
57 },
58};
59
60static const struct flash_platform_data netspace_v2_flash = {
61 .type = "mx25l4005a",
62 .name = "spi_flash",
63 .parts = netspace_v2_flash_parts,
64 .nr_parts = ARRAY_SIZE(netspace_v2_flash_parts),
65};
66
67static struct spi_board_info __initdata netspace_v2_spi_slave_info[] = {
68 {
69 .modalias = "m25p80",
70 .platform_data = &netspace_v2_flash,
71 .irq = -1,
72 .max_speed_hz = 20000000,
73 .bus_num = 0,
74 .chip_select = 0,
75 },
76};
77 40
78/***************************************************************************** 41/*****************************************************************************
79 * Ethernet 42 * Ethernet
@@ -84,27 +47,6 @@ static struct mv643xx_eth_platform_data netspace_v2_ge00_data = {
84}; 47};
85 48
86/***************************************************************************** 49/*****************************************************************************
87 * I2C devices
88 ****************************************************************************/
89
90static struct at24_platform_data at24c04 = {
91 .byte_len = SZ_4K / 8,
92 .page_size = 16,
93};
94
95/*
96 * i2c addr | chip | description
97 * 0x50 | HT24LC04 | eeprom (512B)
98 */
99
100static struct i2c_board_info __initdata netspace_v2_i2c_info[] = {
101 {
102 I2C_BOARD_INFO("24c04", 0x50),
103 .platform_data = &at24c04,
104 }
105};
106
107/*****************************************************************************
108 * SATA 50 * SATA
109 ****************************************************************************/ 51 ****************************************************************************/
110 52
@@ -112,35 +54,6 @@ static struct mv_sata_platform_data netspace_v2_sata_data = {
112 .n_ports = 2, 54 .n_ports = 2,
113}; 55};
114 56
115#define NETSPACE_V2_GPIO_SATA0_POWER 16
116#define NETSPACE_V2_GPIO_SATA1_POWER 17
117
118static void __init netspace_v2_sata_power_init(void)
119{
120 int err;
121
122 err = gpio_request(NETSPACE_V2_GPIO_SATA0_POWER, "SATA0 power");
123 if (err == 0) {
124 err = gpio_direction_output(NETSPACE_V2_GPIO_SATA0_POWER, 1);
125 if (err)
126 gpio_free(NETSPACE_V2_GPIO_SATA0_POWER);
127 }
128 if (err)
129 pr_err("netspace_v2: failed to setup SATA0 power\n");
130
131 if (machine_is_netspace_max_v2()) {
132 err = gpio_request(NETSPACE_V2_GPIO_SATA1_POWER, "SATA1 power");
133 if (err == 0) {
134 err = gpio_direction_output(
135 NETSPACE_V2_GPIO_SATA1_POWER, 1);
136 if (err)
137 gpio_free(NETSPACE_V2_GPIO_SATA1_POWER);
138 }
139 if (err)
140 pr_err("netspace_v2: failed to setup SATA1 power\n");
141 }
142}
143
144/***************************************************************************** 57/*****************************************************************************
145 * GPIO keys 58 * GPIO keys
146 ****************************************************************************/ 59 ****************************************************************************/
@@ -224,20 +137,6 @@ static struct platform_device netspace_v2_leds = {
224}; 137};
225 138
226/***************************************************************************** 139/*****************************************************************************
227 * Timer
228 ****************************************************************************/
229
230static void netspace_v2_timer_init(void)
231{
232 kirkwood_tclk = 166666667;
233 orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
234}
235
236struct sys_timer netspace_v2_timer = {
237 .init = netspace_v2_timer_init,
238};
239
240/*****************************************************************************
241 * General Setup 140 * General Setup
242 ****************************************************************************/ 141 ****************************************************************************/
243 142
@@ -291,18 +190,17 @@ static void __init netspace_v2_init(void)
291 kirkwood_init(); 190 kirkwood_init();
292 kirkwood_mpp_conf(netspace_v2_mpp_config); 191 kirkwood_mpp_conf(netspace_v2_mpp_config);
293 192
294 netspace_v2_sata_power_init(); 193 if (machine_is_netspace_max_v2())
194 lacie_v2_hdd_power_init(2);
195 else
196 lacie_v2_hdd_power_init(1);
295 197
296 kirkwood_ehci_init(); 198 kirkwood_ehci_init();
297 kirkwood_ge00_init(&netspace_v2_ge00_data); 199 kirkwood_ge00_init(&netspace_v2_ge00_data);
298 kirkwood_sata_init(&netspace_v2_sata_data); 200 kirkwood_sata_init(&netspace_v2_sata_data);
299 kirkwood_uart0_init(); 201 kirkwood_uart0_init();
300 spi_register_board_info(netspace_v2_spi_slave_info, 202 lacie_v2_register_flash();
301 ARRAY_SIZE(netspace_v2_spi_slave_info)); 203 lacie_v2_register_i2c_devices();
302 kirkwood_spi_init();
303 kirkwood_i2c_init();
304 i2c_register_board_info(0, netspace_v2_i2c_info,
305 ARRAY_SIZE(netspace_v2_i2c_info));
306 204
307 platform_device_register(&netspace_v2_leds); 205 platform_device_register(&netspace_v2_leds);
308 platform_device_register(&netspace_v2_gpio_leds); 206 platform_device_register(&netspace_v2_gpio_leds);
@@ -323,7 +221,7 @@ MACHINE_START(NETSPACE_V2, "LaCie Network Space v2")
323 .init_machine = netspace_v2_init, 221 .init_machine = netspace_v2_init,
324 .map_io = kirkwood_map_io, 222 .map_io = kirkwood_map_io,
325 .init_irq = kirkwood_init_irq, 223 .init_irq = kirkwood_init_irq,
326 .timer = &netspace_v2_timer, 224 .timer = &lacie_v2_timer,
327MACHINE_END 225MACHINE_END
328#endif 226#endif
329 227
@@ -335,7 +233,7 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2")
335 .init_machine = netspace_v2_init, 233 .init_machine = netspace_v2_init,
336 .map_io = kirkwood_map_io, 234 .map_io = kirkwood_map_io,
337 .init_irq = kirkwood_init_irq, 235 .init_irq = kirkwood_init_irq,
338 .timer = &netspace_v2_timer, 236 .timer = &lacie_v2_timer,
339MACHINE_END 237MACHINE_END
340#endif 238#endif
341 239
@@ -347,6 +245,6 @@ MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2")
347 .init_machine = netspace_v2_init, 245 .init_machine = netspace_v2_init,
348 .map_io = kirkwood_map_io, 246 .map_io = kirkwood_map_io,
349 .init_irq = kirkwood_init_irq, 247 .init_irq = kirkwood_init_irq,
350 .timer = &netspace_v2_timer, 248 .timer = &lacie_v2_timer,
351MACHINE_END 249MACHINE_END
352#endif 250#endif
diff --git a/arch/arm/mach-kirkwood/netxbig_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
index 2bd14c5079de..d970e1eee37d 100644
--- a/arch/arm/mach-kirkwood/netxbig_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
@@ -23,55 +23,19 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/mtd/physmap.h>
27#include <linux/spi/flash.h>
28#include <linux/spi/spi.h>
29#include <linux/ata_platform.h> 26#include <linux/ata_platform.h>
30#include <linux/mv643xx_eth.h> 27#include <linux/mv643xx_eth.h>
31#include <linux/i2c.h>
32#include <linux/i2c/at24.h>
33#include <linux/input.h> 28#include <linux/input.h>
34#include <linux/gpio.h> 29#include <linux/gpio.h>
35#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
36#include <linux/leds.h> 31#include <linux/leds.h>
37#include <asm/mach-types.h> 32#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
39#include <asm/mach/time.h>
40#include <mach/kirkwood.h> 34#include <mach/kirkwood.h>
41#include <plat/time.h> 35#include <mach/leds-netxbig.h>
42#include "common.h" 36#include "common.h"
43#include "mpp.h" 37#include "mpp.h"
44 38#include "lacie_v2-common.h"
45/*****************************************************************************
46 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
47 ****************************************************************************/
48
49static struct mtd_partition netxbig_v2_flash_parts[] = {
50 {
51 .name = "u-boot",
52 .size = MTDPART_SIZ_FULL,
53 .offset = 0,
54 .mask_flags = MTD_WRITEABLE, /* force read-only */
55 },
56};
57
58static const struct flash_platform_data netxbig_v2_flash = {
59 .type = "mx25l4005a",
60 .name = "spi_flash",
61 .parts = netxbig_v2_flash_parts,
62 .nr_parts = ARRAY_SIZE(netxbig_v2_flash_parts),
63};
64
65static struct spi_board_info __initdata netxbig_v2_spi_slave_info[] = {
66 {
67 .modalias = "m25p80",
68 .platform_data = &netxbig_v2_flash,
69 .irq = -1,
70 .max_speed_hz = 20000000,
71 .bus_num = 0,
72 .chip_select = 0,
73 },
74};
75 39
76/***************************************************************************** 40/*****************************************************************************
77 * Ethernet 41 * Ethernet
@@ -86,27 +50,6 @@ static struct mv643xx_eth_platform_data netxbig_v2_ge01_data = {
86}; 50};
87 51
88/***************************************************************************** 52/*****************************************************************************
89 * I2C devices
90 ****************************************************************************/
91
92static struct at24_platform_data at24c04 = {
93 .byte_len = SZ_4K / 8,
94 .page_size = 16,
95};
96
97/*
98 * i2c addr | chip | description
99 * 0x50 | HT24LC04 | eeprom (512B)
100 */
101
102static struct i2c_board_info __initdata netxbig_v2_i2c_info[] = {
103 {
104 I2C_BOARD_INFO("24c04", 0x50),
105 .platform_data = &at24c04,
106 }
107};
108
109/*****************************************************************************
110 * SATA 53 * SATA
111 ****************************************************************************/ 54 ****************************************************************************/
112 55
@@ -114,34 +57,6 @@ static struct mv_sata_platform_data netxbig_v2_sata_data = {
114 .n_ports = 2, 57 .n_ports = 2,
115}; 58};
116 59
117static int __initdata netxbig_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 };
118
119static void __init netxbig_v2_sata_power_init(void)
120{
121 int i;
122 int err;
123 int hdd_nb;
124
125 if (machine_is_net2big_v2())
126 hdd_nb = 2;
127 else
128 hdd_nb = 5;
129
130 /* Power up all hard disks. */
131 for (i = 0; i < hdd_nb; i++) {
132 err = gpio_request(netxbig_v2_gpio_hdd_power[i], NULL);
133 if (err == 0) {
134 err = gpio_direction_output(
135 netxbig_v2_gpio_hdd_power[i], 1);
136 /* Free the HDD power GPIOs. This allow user-space to
137 * configure them via the gpiolib sysfs interface. */
138 gpio_free(netxbig_v2_gpio_hdd_power[i]);
139 }
140 if (err)
141 pr_err("netxbig_v2: failed to power up HDD%d\n", i + 1);
142 }
143}
144
145/***************************************************************************** 60/*****************************************************************************
146 * GPIO keys 61 * GPIO keys
147 ****************************************************************************/ 62 ****************************************************************************/
@@ -190,7 +105,7 @@ static struct platform_device netxbig_v2_gpio_buttons = {
190}; 105};
191 106
192/***************************************************************************** 107/*****************************************************************************
193 * GPIO LEDs 108 * GPIO extension LEDs
194 ****************************************************************************/ 109 ****************************************************************************/
195 110
196/* 111/*
@@ -200,19 +115,32 @@ static struct platform_device netxbig_v2_gpio_buttons = {
200 * - address register : bit [0-2] -> GPIO [47-49] 115 * - address register : bit [0-2] -> GPIO [47-49]
201 * - data register : bit [0-2] -> GPIO [44-46] 116 * - data register : bit [0-2] -> GPIO [44-46]
202 * - enable register : GPIO 29 117 * - enable register : GPIO 29
203 * 118 */
119
120static int netxbig_v2_gpio_ext_addr[] = { 47, 48, 49 };
121static int netxbig_v2_gpio_ext_data[] = { 44, 45, 46 };
122
123static struct netxbig_gpio_ext netxbig_v2_gpio_ext = {
124 .addr = netxbig_v2_gpio_ext_addr,
125 .num_addr = ARRAY_SIZE(netxbig_v2_gpio_ext_addr),
126 .data = netxbig_v2_gpio_ext_data,
127 .num_data = ARRAY_SIZE(netxbig_v2_gpio_ext_data),
128 .enable = 29,
129};
130
131/*
204 * Address register selection: 132 * Address register selection:
205 * 133 *
206 * addr | register 134 * addr | register
207 * ---------------------------- 135 * ----------------------------
208 * 0 | front LED 136 * 0 | front LED
209 * 1 | front LED brightness 137 * 1 | front LED brightness
210 * 2 | HDD LED brightness 138 * 2 | SATA LED brightness
211 * 3 | HDD1 LED 139 * 3 | SATA0 LED
212 * 4 | HDD2 LED 140 * 4 | SATA1 LED
213 * 5 | HDD3 LED 141 * 5 | SATA2 LED
214 * 6 | HDD4 LED 142 * 6 | SATA3 LED
215 * 7 | HDD5 LED 143 * 7 | SATA4 LED
216 * 144 *
217 * Data register configuration: 145 * Data register configuration:
218 * 146 *
@@ -233,30 +161,107 @@ static struct platform_device netxbig_v2_gpio_buttons = {
233 * 6 | blink blue on=1 sec and red on=1 sec 161 * 6 | blink blue on=1 sec and red on=1 sec
234 * 7 | blink blue on=0.5 sec and blue off=2.5 sec 162 * 7 | blink blue on=0.5 sec and blue off=2.5 sec
235 * 163 *
236 * data | HDD LED mode 164 * data | SATA LED mode
237 * ------------------------------------------------- 165 * -------------------------------------------------
238 * 0 | fix blue on 166 * 0 | fix off
239 * 1 | SATA activity blink 167 * 1 | SATA activity blink
240 * 2 | fix red on 168 * 2 | fix red on
241 * 3 | blink blue on=1 sec and blue off=1 sec 169 * 3 | blink blue on=1 sec and blue off=1 sec
242 * 4 | blink red on=1 sec and red off=1 sec 170 * 4 | blink red on=1 sec and red off=1 sec
243 * 5 | blink blue on=2.5 sec and red on=0.5 sec 171 * 5 | blink blue on=2.5 sec and red on=0.5 sec
244 * 6 | blink blue on=1 sec and red on=1 sec 172 * 6 | blink blue on=1 sec and red on=1 sec
245 * 7 | blink blue on=0.5 sec and blue off=2.5 sec 173 * 7 | fix blue on
246 */ 174 */
247 175
248/***************************************************************************** 176static int netxbig_v2_red_mled[NETXBIG_LED_MODE_NUM] = {
249 * Timer 177 [NETXBIG_LED_OFF] = 0,
250 ****************************************************************************/ 178 [NETXBIG_LED_ON] = 2,
179 [NETXBIG_LED_SATA] = NETXBIG_LED_INVALID_MODE,
180 [NETXBIG_LED_TIMER1] = 4,
181 [NETXBIG_LED_TIMER2] = NETXBIG_LED_INVALID_MODE,
182};
251 183
252static void netxbig_v2_timer_init(void) 184static int netxbig_v2_blue_pwr_mled[NETXBIG_LED_MODE_NUM] = {
253{ 185 [NETXBIG_LED_OFF] = 0,
254 kirkwood_tclk = 166666667; 186 [NETXBIG_LED_ON] = 1,
255 orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); 187 [NETXBIG_LED_SATA] = NETXBIG_LED_INVALID_MODE,
256} 188 [NETXBIG_LED_TIMER1] = 3,
189 [NETXBIG_LED_TIMER2] = 7,
190};
191
192static int netxbig_v2_blue_sata_mled[NETXBIG_LED_MODE_NUM] = {
193 [NETXBIG_LED_OFF] = 0,
194 [NETXBIG_LED_ON] = 7,
195 [NETXBIG_LED_SATA] = 1,
196 [NETXBIG_LED_TIMER1] = 3,
197 [NETXBIG_LED_TIMER2] = NETXBIG_LED_INVALID_MODE,
198};
199
200static struct netxbig_led_timer netxbig_v2_led_timer[] = {
201 [0] = {
202 .delay_on = 500,
203 .delay_off = 500,
204 .mode = NETXBIG_LED_TIMER1,
205 },
206 [1] = {
207 .delay_on = 500,
208 .delay_off = 1000,
209 .mode = NETXBIG_LED_TIMER2,
210 },
211};
212
213#define NETXBIG_LED(_name, maddr, mval, baddr) \
214 { .name = _name, \
215 .mode_addr = maddr, \
216 .mode_val = mval, \
217 .bright_addr = baddr }
218
219static struct netxbig_led net2big_v2_leds_ctrl[] = {
220 NETXBIG_LED("net2big-v2:blue:power", 0, netxbig_v2_blue_pwr_mled, 1),
221 NETXBIG_LED("net2big-v2:red:power", 0, netxbig_v2_red_mled, 1),
222 NETXBIG_LED("net2big-v2:blue:sata0", 3, netxbig_v2_blue_sata_mled, 2),
223 NETXBIG_LED("net2big-v2:red:sata0", 3, netxbig_v2_red_mled, 2),
224 NETXBIG_LED("net2big-v2:blue:sata1", 4, netxbig_v2_blue_sata_mled, 2),
225 NETXBIG_LED("net2big-v2:red:sata1", 4, netxbig_v2_red_mled, 2),
226};
227
228static struct netxbig_led_platform_data net2big_v2_leds_data = {
229 .gpio_ext = &netxbig_v2_gpio_ext,
230 .timer = netxbig_v2_led_timer,
231 .num_timer = ARRAY_SIZE(netxbig_v2_led_timer),
232 .leds = net2big_v2_leds_ctrl,
233 .num_leds = ARRAY_SIZE(net2big_v2_leds_ctrl),
234};
235
236static struct netxbig_led net5big_v2_leds_ctrl[] = {
237 NETXBIG_LED("net5big-v2:blue:power", 0, netxbig_v2_blue_pwr_mled, 1),
238 NETXBIG_LED("net5big-v2:red:power", 0, netxbig_v2_red_mled, 1),
239 NETXBIG_LED("net5big-v2:blue:sata0", 3, netxbig_v2_blue_sata_mled, 2),
240 NETXBIG_LED("net5big-v2:red:sata0", 3, netxbig_v2_red_mled, 2),
241 NETXBIG_LED("net5big-v2:blue:sata1", 4, netxbig_v2_blue_sata_mled, 2),
242 NETXBIG_LED("net5big-v2:red:sata1", 4, netxbig_v2_red_mled, 2),
243 NETXBIG_LED("net5big-v2:blue:sata2", 5, netxbig_v2_blue_sata_mled, 2),
244 NETXBIG_LED("net5big-v2:red:sata2", 5, netxbig_v2_red_mled, 2),
245 NETXBIG_LED("net5big-v2:blue:sata3", 6, netxbig_v2_blue_sata_mled, 2),
246 NETXBIG_LED("net5big-v2:red:sata3", 6, netxbig_v2_red_mled, 2),
247 NETXBIG_LED("net5big-v2:blue:sata4", 7, netxbig_v2_blue_sata_mled, 2),
248 NETXBIG_LED("net5big-v2:red:sata5", 7, netxbig_v2_red_mled, 2),
249};
257 250
258struct sys_timer netxbig_v2_timer = { 251static struct netxbig_led_platform_data net5big_v2_leds_data = {
259 .init = netxbig_v2_timer_init, 252 .gpio_ext = &netxbig_v2_gpio_ext,
253 .timer = netxbig_v2_led_timer,
254 .num_timer = ARRAY_SIZE(netxbig_v2_led_timer),
255 .leds = net5big_v2_leds_ctrl,
256 .num_leds = ARRAY_SIZE(net5big_v2_leds_ctrl),
257};
258
259static struct platform_device netxbig_v2_leds = {
260 .name = "leds-netxbig",
261 .id = -1,
262 .dev = {
263 .platform_data = &net2big_v2_leds_data,
264 },
260}; 265};
261 266
262/***************************************************************************** 267/*****************************************************************************
@@ -284,18 +289,18 @@ static unsigned int net2big_v2_mpp_config[] __initdata = {
284 MPP24_GPIO, /* USB mode select */ 289 MPP24_GPIO, /* USB mode select */
285 MPP26_GPIO, /* USB device vbus */ 290 MPP26_GPIO, /* USB device vbus */
286 MPP28_GPIO, /* USB enable host vbus */ 291 MPP28_GPIO, /* USB enable host vbus */
287 MPP29_GPIO, /* CPLD extension ALE */ 292 MPP29_GPIO, /* GPIO extension ALE */
288 MPP34_GPIO, /* Rear Push button */ 293 MPP34_GPIO, /* Rear Push button */
289 MPP35_GPIO, /* Inhibit switch power-off */ 294 MPP35_GPIO, /* Inhibit switch power-off */
290 MPP36_GPIO, /* SATA HDD1 presence */ 295 MPP36_GPIO, /* SATA HDD1 presence */
291 MPP37_GPIO, /* SATA HDD2 presence */ 296 MPP37_GPIO, /* SATA HDD2 presence */
292 MPP40_GPIO, /* eSATA presence */ 297 MPP40_GPIO, /* eSATA presence */
293 MPP44_GPIO, /* CPLD extension (data 0) */ 298 MPP44_GPIO, /* GPIO extension (data 0) */
294 MPP45_GPIO, /* CPLD extension (data 1) */ 299 MPP45_GPIO, /* GPIO extension (data 1) */
295 MPP46_GPIO, /* CPLD extension (data 2) */ 300 MPP46_GPIO, /* GPIO extension (data 2) */
296 MPP47_GPIO, /* CPLD extension (addr 0) */ 301 MPP47_GPIO, /* GPIO extension (addr 0) */
297 MPP48_GPIO, /* CPLD extension (addr 1) */ 302 MPP48_GPIO, /* GPIO extension (addr 1) */
298 MPP49_GPIO, /* CPLD extension (addr 2) */ 303 MPP49_GPIO, /* GPIO extension (addr 2) */
299 0 304 0
300}; 305};
301 306
@@ -324,7 +329,7 @@ static unsigned int net5big_v2_mpp_config[] __initdata = {
324 MPP26_GE1_RXD2, 329 MPP26_GE1_RXD2,
325 MPP27_GE1_RXD3, 330 MPP27_GE1_RXD3,
326 MPP28_GPIO, /* USB enable host vbus */ 331 MPP28_GPIO, /* USB enable host vbus */
327 MPP29_GPIO, /* CPLD extension ALE */ 332 MPP29_GPIO, /* GPIO extension ALE */
328 MPP30_GE1_RXCTL, 333 MPP30_GE1_RXCTL,
329 MPP31_GE1_RXCLK, 334 MPP31_GE1_RXCLK,
330 MPP32_GE1_TCLKOUT, 335 MPP32_GE1_TCLKOUT,
@@ -339,12 +344,12 @@ static unsigned int net5big_v2_mpp_config[] __initdata = {
339 MPP41_GPIO, /* SATA HDD3 power */ 344 MPP41_GPIO, /* SATA HDD3 power */
340 MPP42_GPIO, /* SATA HDD4 power */ 345 MPP42_GPIO, /* SATA HDD4 power */
341 MPP43_GPIO, /* SATA HDD5 power */ 346 MPP43_GPIO, /* SATA HDD5 power */
342 MPP44_GPIO, /* CPLD extension (data 0) */ 347 MPP44_GPIO, /* GPIO extension (data 0) */
343 MPP45_GPIO, /* CPLD extension (data 1) */ 348 MPP45_GPIO, /* GPIO extension (data 1) */
344 MPP46_GPIO, /* CPLD extension (data 2) */ 349 MPP46_GPIO, /* GPIO extension (data 2) */
345 MPP47_GPIO, /* CPLD extension (addr 0) */ 350 MPP47_GPIO, /* GPIO extension (addr 0) */
346 MPP48_GPIO, /* CPLD extension (addr 1) */ 351 MPP48_GPIO, /* GPIO extension (addr 1) */
347 MPP49_GPIO, /* CPLD extension (addr 2) */ 352 MPP49_GPIO, /* GPIO extension (addr 2) */
348 0 353 0
349}; 354};
350 355
@@ -366,7 +371,10 @@ static void __init netxbig_v2_init(void)
366 else 371 else
367 kirkwood_mpp_conf(net5big_v2_mpp_config); 372 kirkwood_mpp_conf(net5big_v2_mpp_config);
368 373
369 netxbig_v2_sata_power_init(); 374 if (machine_is_net2big_v2())
375 lacie_v2_hdd_power_init(2);
376 else
377 lacie_v2_hdd_power_init(5);
370 378
371 kirkwood_ehci_init(); 379 kirkwood_ehci_init();
372 kirkwood_ge00_init(&netxbig_v2_ge00_data); 380 kirkwood_ge00_init(&netxbig_v2_ge00_data);
@@ -374,13 +382,12 @@ static void __init netxbig_v2_init(void)
374 kirkwood_ge01_init(&netxbig_v2_ge01_data); 382 kirkwood_ge01_init(&netxbig_v2_ge01_data);
375 kirkwood_sata_init(&netxbig_v2_sata_data); 383 kirkwood_sata_init(&netxbig_v2_sata_data);
376 kirkwood_uart0_init(); 384 kirkwood_uart0_init();
377 spi_register_board_info(netxbig_v2_spi_slave_info, 385 lacie_v2_register_flash();
378 ARRAY_SIZE(netxbig_v2_spi_slave_info)); 386 lacie_v2_register_i2c_devices();
379 kirkwood_spi_init();
380 kirkwood_i2c_init();
381 i2c_register_board_info(0, netxbig_v2_i2c_info,
382 ARRAY_SIZE(netxbig_v2_i2c_info));
383 387
388 if (machine_is_net5big_v2())
389 netxbig_v2_leds.dev.platform_data = &net5big_v2_leds_data;
390 platform_device_register(&netxbig_v2_leds);
384 platform_device_register(&netxbig_v2_gpio_buttons); 391 platform_device_register(&netxbig_v2_gpio_buttons);
385 392
386 if (gpio_request(NETXBIG_V2_GPIO_POWER_OFF, "power-off") == 0 && 393 if (gpio_request(NETXBIG_V2_GPIO_POWER_OFF, "power-off") == 0 &&
@@ -398,7 +405,7 @@ MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2")
398 .init_machine = netxbig_v2_init, 405 .init_machine = netxbig_v2_init,
399 .map_io = kirkwood_map_io, 406 .map_io = kirkwood_map_io,
400 .init_irq = kirkwood_init_irq, 407 .init_irq = kirkwood_init_irq,
401 .timer = &netxbig_v2_timer, 408 .timer = &lacie_v2_timer,
402MACHINE_END 409MACHINE_END
403#endif 410#endif
404 411
@@ -410,6 +417,6 @@ MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2")
410 .init_machine = netxbig_v2_init, 417 .init_machine = netxbig_v2_init,
411 .map_io = kirkwood_map_io, 418 .map_io = kirkwood_map_io,
412 .init_irq = kirkwood_init_irq, 419 .init_irq = kirkwood_init_irq,
413 .timer = &netxbig_v2_timer, 420 .timer = &lacie_v2_timer,
414MACHINE_END 421MACHINE_END
415#endif 422#endif
diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
index fd06be618815..38017c8ac43f 100644
--- a/arch/arm/mach-kirkwood/openrd-setup.c
+++ b/arch/arm/mach-kirkwood/openrd-setup.c
@@ -16,6 +16,7 @@
16#include <linux/ata_platform.h> 16#include <linux/ata_platform.h>
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/i2c.h> 18#include <linux/i2c.h>
19#include <linux/gpio.h>
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
21#include <mach/kirkwood.h> 22#include <mach/kirkwood.h>
@@ -57,7 +58,22 @@ static struct mvsdio_platform_data openrd_mvsdio_data = {
57}; 58};
58 59
59static unsigned int openrd_mpp_config[] __initdata = { 60static unsigned int openrd_mpp_config[] __initdata = {
61 MPP12_SD_CLK,
62 MPP13_SD_CMD,
63 MPP14_SD_D0,
64 MPP15_SD_D1,
65 MPP16_SD_D2,
66 MPP17_SD_D3,
67 MPP28_GPIO,
60 MPP29_GPIO, 68 MPP29_GPIO,
69 MPP34_GPIO,
70 0
71};
72
73/* Configure MPP for UART1 */
74static unsigned int openrd_uart1_mpp_config[] __initdata = {
75 MPP13_UART1_TXD,
76 MPP14_UART1_RXD,
61 0 77 0
62}; 78};
63 79
@@ -67,6 +83,68 @@ static struct i2c_board_info i2c_board_info[] __initdata = {
67 }, 83 },
68}; 84};
69 85
86static int __initdata uart1;
87
88static int __init sd_uart_selection(char *str)
89{
90 uart1 = -EINVAL;
91
92 /* Default is SD. Change if required, for UART */
93 if (!str)
94 return 0;
95
96 if (!strncmp(str, "232", 3)) {
97 uart1 = 232;
98 } else if (!strncmp(str, "485", 3)) {
99 /* OpenRD-Base doesn't have RS485. Treat is as an
100 * unknown argument & just have default setting -
101 * which is SD */
102 if (machine_is_openrd_base()) {
103 uart1 = -ENODEV;
104 return 1;
105 }
106
107 uart1 = 485;
108 }
109 return 1;
110}
111/* Parse boot_command_line string kw_openrd_init_uart1=232/485 */
112__setup("kw_openrd_init_uart1=", sd_uart_selection);
113
114static int __init uart1_mpp_config(void)
115{
116 kirkwood_mpp_conf(openrd_uart1_mpp_config);
117
118 if (gpio_request(34, "SD_UART1_SEL")) {
119 printk(KERN_ERR "GPIO request failed for SD/UART1 selection"
120 ", gpio: 34\n");
121 return -EIO;
122 }
123
124 if (gpio_request(28, "RS232_RS485_SEL")) {
125 printk(KERN_ERR "GPIO request failed for RS232/RS485 selection"
126 ", gpio# 28\n");
127 gpio_free(34);
128 return -EIO;
129 }
130
131 /* Select UART1
132 * Pin # 34: 0 => UART1, 1 => SD */
133 gpio_direction_output(34, 0);
134
135 /* Select RS232 OR RS485
136 * Pin # 28: 0 => RS232, 1 => RS485 */
137 if (uart1 == 232)
138 gpio_direction_output(28, 0);
139 else
140 gpio_direction_output(28, 1);
141
142 gpio_free(34);
143 gpio_free(28);
144
145 return 0;
146}
147
70static void __init openrd_init(void) 148static void __init openrd_init(void)
71{ 149{
72 /* 150 /*
@@ -90,7 +168,6 @@ static void __init openrd_init(void)
90 kirkwood_ge01_init(&openrd_ge01_data); 168 kirkwood_ge01_init(&openrd_ge01_data);
91 169
92 kirkwood_sata_init(&openrd_sata_data); 170 kirkwood_sata_init(&openrd_sata_data);
93 kirkwood_sdio_init(&openrd_mvsdio_data);
94 171
95 kirkwood_i2c_init(); 172 kirkwood_i2c_init();
96 173
@@ -99,6 +176,28 @@ static void __init openrd_init(void)
99 ARRAY_SIZE(i2c_board_info)); 176 ARRAY_SIZE(i2c_board_info));
100 kirkwood_audio_init(); 177 kirkwood_audio_init();
101 } 178 }
179
180 if (uart1 <= 0) {
181 if (uart1 < 0)
182 printk(KERN_ERR "Invalid kernel parameter to select "
183 "UART1. Defaulting to SD. ERROR CODE: %d\n",
184 uart1);
185
186 /* Select SD
187 * Pin # 34: 0 => UART1, 1 => SD */
188 if (gpio_request(34, "SD_UART1_SEL")) {
189 printk(KERN_ERR "GPIO request failed for SD/UART1 "
190 "selection, gpio: 34\n");
191 } else {
192
193 gpio_direction_output(34, 1);
194 gpio_free(34);
195 kirkwood_sdio_init(&openrd_mvsdio_data);
196 }
197 } else {
198 if (!uart1_mpp_config())
199 kirkwood_uart1_init();
200 }
102} 201}
103 202
104static int __init openrd_pci_init(void) 203static int __init openrd_pci_init(void)
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 6ab843eaa35b..0711d3b620ad 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -57,6 +57,13 @@ config MACH_MARVELL_JASPER
57 PXA910-based development board. Since MMP2 is compatible to 57 PXA910-based development board. Since MMP2 is compatible to
58 ARMv6 architecture. 58 ARMv6 architecture.
59 59
60config MACH_TETON_BGA
61 bool "Marvell's PXA168 Teton BGA Development Board"
62 select CPU_PXA168
63 help
64 Say 'Y' here if you want to support the Marvell PXA168-based
65 Teton BGA Development Board.
66
60endmenu 67endmenu
61 68
62config CPU_PXA168 69config CPU_PXA168
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index 8b66d06739c4..751cdbf733c8 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_MACH_TAVOREVB) += tavorevb.o
17obj-$(CONFIG_MACH_TTC_DKB) += ttc_dkb.o 17obj-$(CONFIG_MACH_TTC_DKB) += ttc_dkb.o
18obj-$(CONFIG_MACH_FLINT) += flint.o 18obj-$(CONFIG_MACH_FLINT) += flint.o
19obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o 19obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
20obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 0629394a5fb9..4681bedbe788 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -16,6 +16,7 @@
16#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h> 17#include <linux/mtd/partitions.h>
18#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
19#include <linux/interrupt.h>
19 20
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
@@ -23,6 +24,9 @@
23#include <mach/mfp-pxa168.h> 24#include <mach/mfp-pxa168.h>
24#include <mach/pxa168.h> 25#include <mach/pxa168.h>
25#include <mach/gpio.h> 26#include <mach/gpio.h>
27#include <video/pxa168fb.h>
28#include <linux/input.h>
29#include <plat/pxa27x_keypad.h>
26 30
27#include "common.h" 31#include "common.h"
28 32
@@ -66,6 +70,43 @@ static unsigned long common_pin_config[] __initdata = {
66 GPIO115_I2S_BCLK, 70 GPIO115_I2S_BCLK,
67 GPIO116_I2S_RXD, 71 GPIO116_I2S_RXD,
68 GPIO117_I2S_TXD, 72 GPIO117_I2S_TXD,
73
74 /* LCD */
75 GPIO56_LCD_FCLK_RD,
76 GPIO57_LCD_LCLK_A0,
77 GPIO58_LCD_PCLK_WR,
78 GPIO59_LCD_DENA_BIAS,
79 GPIO60_LCD_DD0,
80 GPIO61_LCD_DD1,
81 GPIO62_LCD_DD2,
82 GPIO63_LCD_DD3,
83 GPIO64_LCD_DD4,
84 GPIO65_LCD_DD5,
85 GPIO66_LCD_DD6,
86 GPIO67_LCD_DD7,
87 GPIO68_LCD_DD8,
88 GPIO69_LCD_DD9,
89 GPIO70_LCD_DD10,
90 GPIO71_LCD_DD11,
91 GPIO72_LCD_DD12,
92 GPIO73_LCD_DD13,
93 GPIO74_LCD_DD14,
94 GPIO75_LCD_DD15,
95 GPIO76_LCD_DD16,
96 GPIO77_LCD_DD17,
97 GPIO78_LCD_DD18,
98 GPIO79_LCD_DD19,
99 GPIO80_LCD_DD20,
100 GPIO81_LCD_DD21,
101 GPIO82_LCD_DD22,
102 GPIO83_LCD_DD23,
103
104 /* Keypad */
105 GPIO109_KP_MKIN1,
106 GPIO110_KP_MKIN0,
107 GPIO111_KP_MKOUT7,
108 GPIO112_KP_MKOUT6,
109 GPIO121_KP_MKIN4,
69}; 110};
70 111
71static struct smc91x_platdata smc91x_info = { 112static struct smc91x_platdata smc91x_info = {
@@ -134,6 +175,51 @@ static struct i2c_board_info aspenite_i2c_info[] __initdata = {
134 { I2C_BOARD_INFO("wm8753", 0x1b), }, 175 { I2C_BOARD_INFO("wm8753", 0x1b), },
135}; 176};
136 177
178static struct fb_videomode video_modes[] = {
179 [0] = {
180 .pixclock = 30120,
181 .refresh = 60,
182 .xres = 800,
183 .yres = 480,
184 .hsync_len = 1,
185 .left_margin = 215,
186 .right_margin = 40,
187 .vsync_len = 1,
188 .upper_margin = 34,
189 .lower_margin = 10,
190 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
191 },
192};
193
194struct pxa168fb_mach_info aspenite_lcd_info = {
195 .id = "Graphic Frame",
196 .modes = video_modes,
197 .num_modes = ARRAY_SIZE(video_modes),
198 .pix_fmt = PIX_FMT_RGB565,
199 .io_pin_allocation_mode = PIN_MODE_DUMB_24,
200 .dumb_mode = DUMB_MODE_RGB888,
201 .active = 1,
202 .panel_rbswap = 0,
203 .invert_pixclock = 0,
204};
205
206static unsigned int aspenite_matrix_key_map[] = {
207 KEY(0, 6, KEY_UP), /* SW 4 */
208 KEY(0, 7, KEY_DOWN), /* SW 5 */
209 KEY(1, 6, KEY_LEFT), /* SW 6 */
210 KEY(1, 7, KEY_RIGHT), /* SW 7 */
211 KEY(4, 6, KEY_ENTER), /* SW 8 */
212 KEY(4, 7, KEY_ESC), /* SW 9 */
213};
214
215static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
216 .matrix_key_rows = 5,
217 .matrix_key_cols = 8,
218 .matrix_key_map = aspenite_matrix_key_map,
219 .matrix_key_map_size = ARRAY_SIZE(aspenite_matrix_key_map),
220 .debounce_interval = 30,
221};
222
137static void __init common_init(void) 223static void __init common_init(void)
138{ 224{
139 mfp_config(ARRAY_AND_SIZE(common_pin_config)); 225 mfp_config(ARRAY_AND_SIZE(common_pin_config));
@@ -143,6 +229,8 @@ static void __init common_init(void)
143 pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info)); 229 pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
144 pxa168_add_ssp(1); 230 pxa168_add_ssp(1);
145 pxa168_add_nand(&aspenite_nand_info); 231 pxa168_add_nand(&aspenite_nand_info);
232 pxa168_add_fb(&aspenite_lcd_info);
233 pxa168_add_keypad(&aspenite_keypad_info);
146 234
147 /* off-chip devices */ 235 /* off-chip devices */
148 platform_device_register(&smc91x_device); 236 platform_device_register(&smc91x_device);
@@ -152,6 +240,7 @@ MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
152 .phys_io = APB_PHYS_BASE, 240 .phys_io = APB_PHYS_BASE,
153 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc, 241 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc,
154 .map_io = mmp_map_io, 242 .map_io = mmp_map_io,
243 .nr_irqs = IRQ_BOARD_START,
155 .init_irq = pxa168_init_irq, 244 .init_irq = pxa168_init_irq,
156 .timer = &pxa168_timer, 245 .timer = &pxa168_timer,
157 .init_machine = common_init, 246 .init_machine = common_init,
@@ -161,6 +250,7 @@ MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform")
161 .phys_io = APB_PHYS_BASE, 250 .phys_io = APB_PHYS_BASE,
162 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc, 251 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc,
163 .map_io = mmp_map_io, 252 .map_io = mmp_map_io,
253 .nr_irqs = IRQ_BOARD_START,
164 .init_irq = pxa168_init_irq, 254 .init_irq = pxa168_init_irq,
165 .timer = &pxa168_timer, 255 .timer = &pxa168_timer,
166 .init_machine = common_init, 256 .init_machine = common_init,
diff --git a/arch/arm/mach-mmp/common.c b/arch/arm/mach-mmp/common.c
index 3b29fa7e9b08..0ec0ca80bb3e 100644
--- a/arch/arm/mach-mmp/common.c
+++ b/arch/arm/mach-mmp/common.c
@@ -10,13 +10,20 @@
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h>
13 14
14#include <asm/page.h> 15#include <asm/page.h>
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
16#include <mach/addr-map.h> 17#include <mach/addr-map.h>
18#include <mach/cputype.h>
17 19
18#include "common.h" 20#include "common.h"
19 21
22#define MMP_CHIPID (AXI_VIRT_BASE + 0x82c00)
23
24unsigned int mmp_chip_id;
25EXPORT_SYMBOL(mmp_chip_id);
26
20static struct map_desc standard_io_desc[] __initdata = { 27static struct map_desc standard_io_desc[] __initdata = {
21 { 28 {
22 .pfn = __phys_to_pfn(APB_PHYS_BASE), 29 .pfn = __phys_to_pfn(APB_PHYS_BASE),
@@ -34,4 +41,7 @@ static struct map_desc standard_io_desc[] __initdata = {
34void __init mmp_map_io(void) 41void __init mmp_map_io(void)
35{ 42{
36 iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); 43 iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));
44
45 /* this is early, initialize mmp_chip_id here */
46 mmp_chip_id = __raw_readl(MMP_CHIPID);
37} 47}
diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c
index e4312d238eae..c558425c3613 100644
--- a/arch/arm/mach-mmp/flint.c
+++ b/arch/arm/mach-mmp/flint.c
@@ -16,6 +16,7 @@
16#include <linux/smc91x.h> 16#include <linux/smc91x.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/interrupt.h>
19 20
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
@@ -25,6 +26,8 @@
25 26
26#include "common.h" 27#include "common.h"
27 28
29#define FLINT_NR_IRQS (IRQ_BOARD_START + 48)
30
28static unsigned long flint_pin_config[] __initdata = { 31static unsigned long flint_pin_config[] __initdata = {
29 /* UART1 */ 32 /* UART1 */
30 GPIO45_UART1_RXD, 33 GPIO45_UART1_RXD,
@@ -116,6 +119,7 @@ MACHINE_START(FLINT, "Flint Development Platform")
116 .phys_io = APB_PHYS_BASE, 119 .phys_io = APB_PHYS_BASE,
117 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc, 120 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc,
118 .map_io = mmp_map_io, 121 .map_io = mmp_map_io,
122 .nr_irqs = FLINT_NR_IRQS,
119 .init_irq = mmp2_init_irq, 123 .init_irq = mmp2_init_irq,
120 .timer = &mmp2_timer, 124 .timer = &mmp2_timer,
121 .init_machine = flint_init, 125 .init_machine = flint_init,
diff --git a/arch/arm/mach-mmp/include/mach/cputype.h b/arch/arm/mach-mmp/include/mach/cputype.h
index 83b18721d933..f43a68b213f1 100644
--- a/arch/arm/mach-mmp/include/mach/cputype.h
+++ b/arch/arm/mach-mmp/include/mach/cputype.h
@@ -4,36 +4,51 @@
4#include <asm/cputype.h> 4#include <asm/cputype.h>
5 5
6/* 6/*
7 * CPU Stepping OLD_ID CPU_ID CHIP_ID 7 * CPU Stepping CPU_ID CHIP_ID
8 * 8 *
9 * PXA168 A0 0x41159263 0x56158400 0x00A0A333 9 * PXA168 S0 0x56158400 0x0000C910
10 * PXA910 Y0 0x41159262 0x56158000 0x00F0C910 10 * PXA168 A0 0x56158400 0x00A0A168
11 * MMP2 Z0 0x560f5811 11 * PXA910 Y1 0x56158400 0x00F2C920
12 * PXA910 A0 0x56158400 0x00F2C910
13 * PXA910 A1 0x56158400 0x00A0C910
14 * PXA920 Y0 0x56158400 0x00F2C920
15 * PXA920 A0 0x56158400 0x00A0C920
16 * PXA920 A1 0x56158400 0x00A1C920
17 * MMP2 Z0 0x560f5811 0x00F00410
18 * MMP2 Z1 0x560f5811 0x00E00410
19 * MMP2 A0 0x560f5811 0x00A0A610
12 */ 20 */
13 21
22extern unsigned int mmp_chip_id;
23
14#ifdef CONFIG_CPU_PXA168 24#ifdef CONFIG_CPU_PXA168
15# define __cpu_is_pxa168(id) \ 25static inline int cpu_is_pxa168(void)
16 ({ unsigned int _id = ((id) >> 8) & 0xff; _id == 0x84; }) 26{
27 return (((read_cpuid_id() >> 8) & 0xff) == 0x84) &&
28 ((mmp_chip_id & 0xfff) == 0x168);
29}
17#else 30#else
18# define __cpu_is_pxa168(id) (0) 31#define cpu_is_pxa168() (0)
19#endif 32#endif
20 33
34/* cpu_is_pxa910() is shared on both pxa910 and pxa920 */
21#ifdef CONFIG_CPU_PXA910 35#ifdef CONFIG_CPU_PXA910
22# define __cpu_is_pxa910(id) \ 36static inline int cpu_is_pxa910(void)
23 ({ unsigned int _id = ((id) >> 8) & 0xff; _id == 0x80; }) 37{
38 return (((read_cpuid_id() >> 8) & 0xff) == 0x84) &&
39 (((mmp_chip_id & 0xfff) == 0x910) ||
40 ((mmp_chip_id & 0xfff) == 0x920));
41}
24#else 42#else
25# define __cpu_is_pxa910(id) (0) 43#define cpu_is_pxa910() (0)
26#endif 44#endif
27 45
28#ifdef CONFIG_CPU_MMP2 46#ifdef CONFIG_CPU_MMP2
29# define __cpu_is_mmp2(id) \ 47static inline int cpu_is_mmp2(void)
30 ({ unsigned int _id = ((id) >> 8) & 0xff; _id == 0x58; }) 48{
49 return (((cpu_readid_id() >> 8) & 0xff) == 0x58);
31#else 50#else
32# define __cpu_is_mmp2(id) (0) 51#define cpu_is_mmp2() (0)
33#endif 52#endif
34 53
35#define cpu_is_pxa168() ({ __cpu_is_pxa168(read_cpuid_id()); })
36#define cpu_is_pxa910() ({ __cpu_is_pxa910(read_cpuid_id()); })
37#define cpu_is_mmp2() ({ __cpu_is_mmp2(read_cpuid_id()); })
38
39#endif /* __ASM_MACH_CPUTYPE_H */ 54#endif /* __ASM_MACH_CPUTYPE_H */
diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h
index b379cdec4d38..a09d328e2ddd 100644
--- a/arch/arm/mach-mmp/include/mach/irqs.h
+++ b/arch/arm/mach-mmp/include/mach/irqs.h
@@ -222,10 +222,8 @@
222#define IRQ_GPIO_NUM 192 222#define IRQ_GPIO_NUM 192
223#define IRQ_GPIO(x) (IRQ_GPIO_START + (x)) 223#define IRQ_GPIO(x) (IRQ_GPIO_START + (x))
224 224
225/* Board IRQ - 64 by default, increase if not enough */
226#define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM) 225#define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM)
227#define IRQ_BOARD_END (IRQ_BOARD_START + 64)
228 226
229#define NR_IRQS (IRQ_BOARD_END) 227#define NR_IRQS (IRQ_BOARD_START)
230 228
231#endif /* __ASM_MACH_IRQS_H */ 229#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
index ded43c455ec3..4621067c7720 100644
--- a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
@@ -289,4 +289,11 @@
289#define GPIO86_PWM1_OUT MFP_CFG(GPIO86, AF2) 289#define GPIO86_PWM1_OUT MFP_CFG(GPIO86, AF2)
290#define GPIO86_PWM2_OUT MFP_CFG(GPIO86, AF3) 290#define GPIO86_PWM2_OUT MFP_CFG(GPIO86, AF3)
291 291
292/* Keypad */
293#define GPIO109_KP_MKIN1 MFP_CFG(GPIO109, AF7)
294#define GPIO110_KP_MKIN0 MFP_CFG(GPIO110, AF7)
295#define GPIO111_KP_MKOUT7 MFP_CFG(GPIO111, AF7)
296#define GPIO112_KP_MKOUT6 MFP_CFG(GPIO112, AF7)
297#define GPIO121_KP_MKIN4 MFP_CFG(GPIO121, AF7)
298
292#endif /* __ASM_MACH_MFP_PXA168_H */ 299#endif /* __ASM_MACH_MFP_PXA168_H */
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index 27e1bc758623..1801e4206232 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -5,11 +5,15 @@ struct sys_timer;
5 5
6extern struct sys_timer pxa168_timer; 6extern struct sys_timer pxa168_timer;
7extern void __init pxa168_init_irq(void); 7extern void __init pxa168_init_irq(void);
8extern void pxa168_clear_keypad_wakeup(void);
8 9
9#include <linux/i2c.h> 10#include <linux/i2c.h>
10#include <mach/devices.h> 11#include <mach/devices.h>
11#include <plat/i2c.h> 12#include <plat/i2c.h>
12#include <plat/pxa3xx_nand.h> 13#include <plat/pxa3xx_nand.h>
14#include <video/pxa168fb.h>
15#include <plat/pxa27x_keypad.h>
16#include <mach/cputype.h>
13 17
14extern struct pxa_device_desc pxa168_device_uart1; 18extern struct pxa_device_desc pxa168_device_uart1;
15extern struct pxa_device_desc pxa168_device_uart2; 19extern struct pxa_device_desc pxa168_device_uart2;
@@ -25,6 +29,8 @@ extern struct pxa_device_desc pxa168_device_ssp3;
25extern struct pxa_device_desc pxa168_device_ssp4; 29extern struct pxa_device_desc pxa168_device_ssp4;
26extern struct pxa_device_desc pxa168_device_ssp5; 30extern struct pxa_device_desc pxa168_device_ssp5;
27extern struct pxa_device_desc pxa168_device_nand; 31extern struct pxa_device_desc pxa168_device_nand;
32extern struct pxa_device_desc pxa168_device_fb;
33extern struct pxa_device_desc pxa168_device_keypad;
28 34
29static inline int pxa168_add_uart(int id) 35static inline int pxa168_add_uart(int id)
30{ 36{
@@ -97,4 +103,18 @@ static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
97{ 103{
98 return pxa_register_device(&pxa168_device_nand, info, sizeof(*info)); 104 return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
99} 105}
106
107static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
108{
109 return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
110}
111
112static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
113{
114 if (cpu_is_pxa168())
115 data->clear_wakeup_event = pxa168_clear_keypad_wakeup;
116
117 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
118}
119
100#endif /* __ASM_MACH_PXA168_H */ 120#endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/include/mach/regs-apmu.h b/arch/arm/mach-mmp/include/mach/regs-apmu.h
index 919030514120..ac4702357a6e 100644
--- a/arch/arm/mach-mmp/include/mach/regs-apmu.h
+++ b/arch/arm/mach-mmp/include/mach/regs-apmu.h
@@ -33,4 +33,16 @@
33#define APMU_FNRST_DIS (1 << 1) 33#define APMU_FNRST_DIS (1 << 1)
34#define APMU_AXIRST_DIS (1 << 0) 34#define APMU_AXIRST_DIS (1 << 0)
35 35
36/* Wake Clear Register */
37#define APMU_WAKE_CLR APMU_REG(0x07c)
38
39#define APMU_PXA168_KP_WAKE_CLR (1 << 7)
40#define APMU_PXA168_CFI_WAKE_CLR (1 << 6)
41#define APMU_PXA168_XD_WAKE_CLR (1 << 5)
42#define APMU_PXA168_MSP_WAKE_CLR (1 << 4)
43#define APMU_PXA168_SD4_WAKE_CLR (1 << 3)
44#define APMU_PXA168_SD3_WAKE_CLR (1 << 2)
45#define APMU_PXA168_SD2_WAKE_CLR (1 << 1)
46#define APMU_PXA168_SD1_WAKE_CLR (1 << 0)
47
36#endif /* __ASM_MACH_REGS_APMU_H */ 48#endif /* __ASM_MACH_REGS_APMU_H */
diff --git a/arch/arm/mach-mmp/include/mach/teton_bga.h b/arch/arm/mach-mmp/include/mach/teton_bga.h
new file mode 100644
index 000000000000..61a539b2cc98
--- /dev/null
+++ b/arch/arm/mach-mmp/include/mach/teton_bga.h
@@ -0,0 +1,27 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/teton_bga.h
3 *
4 * Support for the Marvell PXA168 Teton BGA Development Platform.
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 * publishhed by the Free Software Foundation.
9 */
10#ifndef __ASM_MACH_TETON_BGA_H
11#define __ASM_MACH_TETON_BGA_H
12
13/* GPIOs */
14#define MMC_PWENA_GPIO 27
15#define USBHPENB_GPIO 55
16#define RTC_INT_GPIO 78
17#define LCD_VBLK_EN_GPIO 79
18#define LCD_DVDD_EN_GPIO 80
19#define RST_WIFI_GPIO 81
20#define CF_PWEN_GPIO 82
21#define USB_OC_GPIO 83
22#define PWM_GPIO 84
23#define USBHPENA_GPIO 85
24#define TS_INT_GPIO 86
25#define CIR_GPIO 108
26
27#endif /* __ASM_MACH_TETON_BGA_H */
diff --git a/arch/arm/mach-mmp/jasper.c b/arch/arm/mach-mmp/jasper.c
index 80c3e7ab1e17..940ee03e3682 100644
--- a/arch/arm/mach-mmp/jasper.c
+++ b/arch/arm/mach-mmp/jasper.c
@@ -18,16 +18,18 @@
18#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
19#include <linux/regulator/max8649.h> 19#include <linux/regulator/max8649.h>
20#include <linux/mfd/max8925.h> 20#include <linux/mfd/max8925.h>
21#include <linux/interrupt.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <mach/addr-map.h> 25#include <mach/addr-map.h>
25#include <mach/mfp-mmp2.h> 26#include <mach/mfp-mmp2.h>
26#include <mach/mmp2.h> 27#include <mach/mmp2.h>
27#include <mach/irqs.h>
28 28
29#include "common.h" 29#include "common.h"
30 30
31#define JASPER_NR_IRQS (IRQ_BOARD_START + 48)
32
31static unsigned long jasper_pin_config[] __initdata = { 33static unsigned long jasper_pin_config[] __initdata = {
32 /* UART1 */ 34 /* UART1 */
33 GPIO29_UART1_RXD, 35 GPIO29_UART1_RXD,
@@ -137,6 +139,7 @@ MACHINE_START(MARVELL_JASPER, "Jasper Development Platform")
137 .phys_io = APB_PHYS_BASE, 139 .phys_io = APB_PHYS_BASE,
138 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc, 140 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc,
139 .map_io = mmp_map_io, 141 .map_io = mmp_map_io,
142 .nr_irqs = JASPER_NR_IRQS,
140 .init_irq = mmp2_init_irq, 143 .init_irq = mmp2_init_irq,
141 .timer = &mmp2_timer, 144 .timer = &mmp2_timer,
142 .init_machine = jasper_init, 145 .init_machine = jasper_init,
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 652ae660634c..72b4e7631583 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -77,8 +77,10 @@ static APBC_CLK(ssp2, PXA168_SSP2, 4, 0);
77static APBC_CLK(ssp3, PXA168_SSP3, 4, 0); 77static APBC_CLK(ssp3, PXA168_SSP3, 4, 0);
78static APBC_CLK(ssp4, PXA168_SSP4, 4, 0); 78static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
79static APBC_CLK(ssp5, PXA168_SSP5, 4, 0); 79static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
80static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
80 81
81static APMU_CLK(nand, NAND, 0x01db, 208000000); 82static APMU_CLK(nand, NAND, 0x01db, 208000000);
83static APMU_CLK(lcd, LCD, 0x7f, 312000000);
82 84
83/* device and clock bindings */ 85/* device and clock bindings */
84static struct clk_lookup pxa168_clkregs[] = { 86static struct clk_lookup pxa168_clkregs[] = {
@@ -96,6 +98,8 @@ static struct clk_lookup pxa168_clkregs[] = {
96 INIT_CLKREG(&clk_ssp4, "pxa168-ssp.3", NULL), 98 INIT_CLKREG(&clk_ssp4, "pxa168-ssp.3", NULL),
97 INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL), 99 INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
98 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 100 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
101 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
102 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
99}; 103};
100 104
101static int __init pxa168_init(void) 105static int __init pxa168_init(void)
@@ -132,6 +136,16 @@ struct sys_timer pxa168_timer = {
132 .init = pxa168_timer_init, 136 .init = pxa168_timer_init,
133}; 137};
134 138
139void pxa168_clear_keypad_wakeup(void)
140{
141 uint32_t val;
142 uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
143
144 /* wake event clear is needed in order to clear keypad interrupt */
145 val = __raw_readl(APMU_WAKE_CLR);
146 __raw_writel(val | mask, APMU_WAKE_CLR);
147}
148
135/* on-chip devices */ 149/* on-chip devices */
136PXA168_DEVICE(uart1, "pxa2xx-uart", 0, UART1, 0xd4017000, 0x30, 21, 22); 150PXA168_DEVICE(uart1, "pxa2xx-uart", 0, UART1, 0xd4017000, 0x30, 21, 22);
137PXA168_DEVICE(uart2, "pxa2xx-uart", 1, UART2, 0xd4018000, 0x30, 23, 24); 151PXA168_DEVICE(uart2, "pxa2xx-uart", 1, UART2, 0xd4018000, 0x30, 23, 24);
@@ -147,3 +161,5 @@ PXA168_DEVICE(ssp2, "pxa168-ssp", 1, SSP2, 0xd401c000, 0x40, 54, 55);
147PXA168_DEVICE(ssp3, "pxa168-ssp", 2, SSP3, 0xd401f000, 0x40, 56, 57); 161PXA168_DEVICE(ssp3, "pxa168-ssp", 2, SSP3, 0xd401f000, 0x40, 56, 57);
148PXA168_DEVICE(ssp4, "pxa168-ssp", 3, SSP4, 0xd4020000, 0x40, 58, 59); 162PXA168_DEVICE(ssp4, "pxa168-ssp", 3, SSP4, 0xd4020000, 0x40, 58, 59);
149PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61); 163PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61);
164PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
165PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c);
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
new file mode 100644
index 000000000000..a4a375c58e0c
--- /dev/null
+++ b/arch/arm/mach-mmp/teton_bga.c
@@ -0,0 +1,91 @@
1/*
2 * linux/arch/arm/mach-mmp/teton_bga.c
3 *
4 * Support for the Marvell PXA168 Teton BGA Development Platform.
5 *
6 * Author: Mark F. Brown <mark.brown314@gmail.com>
7 *
8 * This code is based on aspenite.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 * publishhed by the Free Software Foundation.
13 */
14
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/platform_device.h>
18#include <linux/gpio.h>
19#include <linux/input.h>
20#include <plat/pxa27x_keypad.h>
21#include <linux/i2c.h>
22
23#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25#include <mach/addr-map.h>
26#include <mach/mfp-pxa168.h>
27#include <mach/pxa168.h>
28#include <mach/teton_bga.h>
29
30#include "common.h"
31
32static unsigned long teton_bga_pin_config[] __initdata = {
33 /* UART1 */
34 GPIO107_UART1_TXD,
35 GPIO108_UART1_RXD,
36
37 /* Keypad */
38 GPIO109_KP_MKIN1,
39 GPIO110_KP_MKIN0,
40 GPIO111_KP_MKOUT7,
41 GPIO112_KP_MKOUT6,
42
43 /* I2C Bus */
44 GPIO105_CI2C_SDA,
45 GPIO106_CI2C_SCL,
46
47 /* RTC */
48 GPIO78_GPIO,
49};
50
51static unsigned int teton_bga_matrix_key_map[] = {
52 KEY(0, 6, KEY_ESC),
53 KEY(0, 7, KEY_ENTER),
54 KEY(1, 6, KEY_LEFT),
55 KEY(1, 7, KEY_RIGHT),
56};
57
58static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
59 .matrix_key_rows = 2,
60 .matrix_key_cols = 8,
61 .matrix_key_map = teton_bga_matrix_key_map,
62 .matrix_key_map_size = ARRAY_SIZE(teton_bga_matrix_key_map),
63 .debounce_interval = 30,
64};
65
66static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
67 {
68 I2C_BOARD_INFO("ds1337", 0x68),
69 .irq = gpio_to_irq(RTC_INT_GPIO)
70 },
71};
72
73static void __init teton_bga_init(void)
74{
75 mfp_config(ARRAY_AND_SIZE(teton_bga_pin_config));
76
77 /* on-chip devices */
78 pxa168_add_uart(1);
79 pxa168_add_keypad(&teton_bga_keypad_info);
80 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
81}
82
83MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform")
84 .phys_io = APB_PHYS_BASE,
85 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc,
86 .map_io = mmp_map_io,
87 .nr_irqs = IRQ_BOARD_START,
88 .init_irq = pxa168_init_irq,
89 .timer = &pxa168_timer,
90 .init_machine = teton_bga_init,
91MACHINE_END
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index ee65e05f0cf1..54571139dc4b 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -14,6 +14,7 @@
14#include <linux/mtd/mtd.h> 14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h> 15#include <linux/mtd/partitions.h>
16#include <linux/mtd/onenand.h> 16#include <linux/mtd/onenand.h>
17#include <linux/interrupt.h>
17 18
18#include <asm/mach-types.h> 19#include <asm/mach-types.h>
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -24,6 +25,8 @@
24 25
25#include "common.h" 26#include "common.h"
26 27
28#define TTCDKB_NR_IRQS (IRQ_BOARD_START + 24)
29
27static unsigned long ttc_dkb_pin_config[] __initdata = { 30static unsigned long ttc_dkb_pin_config[] __initdata = {
28 /* UART2 */ 31 /* UART2 */
29 GPIO47_UART2_RXD, 32 GPIO47_UART2_RXD,
@@ -125,6 +128,7 @@ MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
125 .phys_io = APB_PHYS_BASE, 128 .phys_io = APB_PHYS_BASE,
126 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc, 129 .io_pg_offst = (APB_VIRT_BASE >> 18) & 0xfffc,
127 .map_io = mmp_map_io, 130 .map_io = mmp_map_io,
131 .nr_irqs = TTCDKB_NR_IRQS,
128 .init_irq = pxa910_init_irq, 132 .init_irq = pxa910_init_irq,
129 .timer = &pxa910_timer, 133 .timer = &pxa910_timer,
130 .init_machine = ttc_dkb_init, 134 .init_machine = ttc_dkb_init,
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 47264a76eeb3..3115a29dec4e 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -10,6 +10,8 @@ config ARCH_MSM7X00A
10 select MSM_SMD 10 select MSM_SMD
11 select MSM_SMD_PKG3 11 select MSM_SMD_PKG3
12 select CPU_V6 12 select CPU_V6
13 select MSM_PROC_COMM
14 select HAS_MSM_DEBUG_UART_PHYS
13 15
14config ARCH_MSM7X30 16config ARCH_MSM7X30
15 bool "MSM7x30" 17 bool "MSM7x30"
@@ -18,6 +20,9 @@ config ARCH_MSM7X30
18 select MSM_VIC 20 select MSM_VIC
19 select CPU_V7 21 select CPU_V7
20 select MSM_REMOTE_SPINLOCK_DEKKERS 22 select MSM_REMOTE_SPINLOCK_DEKKERS
23 select MSM_GPIOMUX
24 select MSM_PROC_COMM
25 select HAS_MSM_DEBUG_UART_PHYS
21 26
22config ARCH_QSD8X50 27config ARCH_QSD8X50
23 bool "QSD8X50" 28 bool "QSD8X50"
@@ -26,6 +31,19 @@ config ARCH_QSD8X50
26 select MSM_VIC 31 select MSM_VIC
27 select CPU_V7 32 select CPU_V7
28 select MSM_REMOTE_SPINLOCK_LDREX 33 select MSM_REMOTE_SPINLOCK_LDREX
34 select MSM_GPIOMUX
35 select MSM_PROC_COMM
36 select HAS_MSM_DEBUG_UART_PHYS
37
38config ARCH_MSM8X60
39 bool "MSM8X60"
40 select ARM_GIC
41 select CPU_V7
42 select MSM_V2_TLMM
43 select MSM_GPIOMUX
44 select MACH_MSM8X60_SURF if (!MACH_MSM8X60_RUMI3 && !MACH_MSM8X60_SIM \
45 && !MACH_MSM8X60_FFA)
46
29endchoice 47endchoice
30 48
31config MSM_SOC_REV_A 49config MSM_SOC_REV_A
@@ -36,6 +54,9 @@ config ARCH_MSM_ARM11
36config ARCH_MSM_SCORPION 54config ARCH_MSM_SCORPION
37 bool 55 bool
38 56
57config HAS_MSM_DEBUG_UART_PHYS
58 bool
59
39config MSM_VIC 60config MSM_VIC
40 bool 61 bool
41 62
@@ -74,6 +95,30 @@ config MACH_QSD8X50A_ST1_5
74 help 95 help
75 Support for the Qualcomm ST1.5. 96 Support for the Qualcomm ST1.5.
76 97
98config MACH_MSM8X60_RUMI3
99 depends on ARCH_MSM8X60
100 bool "MSM8x60 RUMI3"
101 help
102 Support for the Qualcomm MSM8x60 RUMI3 emulator.
103
104config MACH_MSM8X60_SURF
105 depends on ARCH_MSM8X60
106 bool "MSM8x60 SURF"
107 help
108 Support for the Qualcomm MSM8x60 SURF eval board.
109
110config MACH_MSM8X60_SIM
111 depends on ARCH_MSM8X60
112 bool "MSM8x60 Simulator"
113 help
114 Support for the Qualcomm MSM8x60 simulator.
115
116config MACH_MSM8X60_FFA
117 depends on ARCH_MSM8X60
118 bool "MSM8x60 FFA"
119 help
120 Support for the Qualcomm MSM8x60 FFA eval board.
121
77endmenu 122endmenu
78 123
79config MSM_DEBUG_UART 124config MSM_DEBUG_UART
@@ -82,6 +127,7 @@ config MSM_DEBUG_UART
82 default 2 if MSM_DEBUG_UART2 127 default 2 if MSM_DEBUG_UART2
83 default 3 if MSM_DEBUG_UART3 128 default 3 if MSM_DEBUG_UART3
84 129
130if HAS_MSM_DEBUG_UART_PHYS
85choice 131choice
86 prompt "Debug UART" 132 prompt "Debug UART"
87 133
@@ -99,11 +145,20 @@ choice
99 config MSM_DEBUG_UART3 145 config MSM_DEBUG_UART3
100 bool "UART3" 146 bool "UART3"
101endchoice 147endchoice
148endif
102 149
103config MSM_SMD_PKG3 150config MSM_SMD_PKG3
104 bool 151 bool
105 152
153config MSM_PROC_COMM
154 bool
155
106config MSM_SMD 156config MSM_SMD
107 bool 157 bool
108 158
159config MSM_GPIOMUX
160 bool
161
162config MSM_V2_TLMM
163 bool
109endif 164endif
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 704610648a25..b5a7b07a44f5 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -1,16 +1,20 @@
1obj-y += proc_comm.o 1obj-y += io.o idle.o timer.o
2obj-y += io.o idle.o timer.o dma.o 2ifndef CONFIG_ARCH_MSM8X60
3obj-y += vreg.o
4obj-y += acpuclock-arm11.o 3obj-y += acpuclock-arm11.o
5obj-y += clock.o clock-pcom.o 4obj-y += dma.o
6obj-y += gpio.o 5endif
7 6
8ifdef CONFIG_MSM_VIC 7ifdef CONFIG_MSM_VIC
9obj-y += irq-vic.o 8obj-y += irq-vic.o
10else 9else
10ifndef CONFIG_ARCH_MSM8X60
11obj-y += irq.o 11obj-y += irq.o
12endif 12endif
13endif
13 14
15obj-$(CONFIG_ARCH_MSM8X60) += clock-dummy.o iommu.o iommu_dev.o devices-msm8x60-iommu.o
16obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
17obj-$(CONFIG_MSM_PROC_COMM) += clock.o
14obj-$(CONFIG_ARCH_QSD8X50) += sirc.o 18obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
15obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 19obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
16obj-$(CONFIG_MSM_SMD) += last_radio_log.o 20obj-$(CONFIG_MSM_SMD) += last_radio_log.o
@@ -19,4 +23,11 @@ obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o d
19obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o 23obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
20obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o 24obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
21obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o 25obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
26obj-$(CONFIG_ARCH_MSM8X60) += board-msm8x60.o
22 27
28obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-7x30.o gpiomux-v1.o gpiomux.o
29obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
30obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
31ifndef CONFIG_MSM_V2_TLMM
32obj-y += gpio.o
33endif
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index e32981928c77..76d5a22a6984 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -39,27 +39,11 @@
39 39
40extern struct sys_timer msm_timer; 40extern struct sys_timer msm_timer;
41 41
42#ifdef CONFIG_SERIAL_MSM_CONSOLE
43static struct msm_gpio uart2_config_data[] = {
44 { GPIO_CFG(49, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_RFR"},
45 { GPIO_CFG(50, 2, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_CTS"},
46 { GPIO_CFG(51, 2, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_Rx"},
47 { GPIO_CFG(52, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_Tx"},
48};
49
50static void msm7x30_init_uart2(void)
51{
52 msm_gpios_request_enable(uart2_config_data,
53 ARRAY_SIZE(uart2_config_data));
54
55}
56#endif
57
58static struct platform_device *devices[] __initdata = { 42static struct platform_device *devices[] __initdata = {
59#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER) 43#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
60 &msm_device_uart2, 44 &msm_device_uart2,
61#endif 45#endif
62 46 &msm_device_smd,
63}; 47};
64 48
65static void __init msm7x30_init_irq(void) 49static void __init msm7x30_init_irq(void)
@@ -70,10 +54,6 @@ static void __init msm7x30_init_irq(void)
70static void __init msm7x30_init(void) 54static void __init msm7x30_init(void)
71{ 55{
72 platform_add_devices(devices, ARRAY_SIZE(devices)); 56 platform_add_devices(devices, ARRAY_SIZE(devices));
73#ifdef CONFIG_SERIAL_MSM_CONSOLE
74 msm7x30_init_uart2();
75#endif
76
77} 57}
78 58
79static void __init msm7x30_map_io(void) 59static void __init msm7x30_map_io(void)
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
new file mode 100644
index 000000000000..7486a681cc71
--- /dev/null
+++ b/arch/arm/mach-msm/board-msm8x60.c
@@ -0,0 +1,100 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 *
17 */
18
19#include <linux/kernel.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/irq.h>
23
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/hardware/gic.h>
27
28#include <mach/board.h>
29#include <mach/msm_iomap.h>
30
31void __iomem *gic_cpu_base_addr;
32
33unsigned long clk_get_max_axi_khz(void)
34{
35 return 0;
36}
37
38static void __init msm8x60_map_io(void)
39{
40 msm_map_msm8x60_io();
41}
42
43static void __init msm8x60_init_irq(void)
44{
45 unsigned int i;
46
47 gic_dist_init(0, MSM_QGIC_DIST_BASE, GIC_PPI_START);
48 gic_cpu_base_addr = (void *)MSM_QGIC_CPU_BASE;
49 gic_cpu_init(0, MSM_QGIC_CPU_BASE);
50
51 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
52 writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
53
54 /* RUMI does not adhere to GIC spec by enabling STIs by default.
55 * Enable/clear is supposed to be RO for STIs, but is RW on RUMI.
56 */
57 if (!machine_is_msm8x60_sim())
58 writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
59
60 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
61 * as they are configured as level, which does not play nice with
62 * handle_percpu_irq.
63 */
64 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
65 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
66 set_irq_handler(i, handle_percpu_irq);
67 }
68}
69
70static void __init msm8x60_init(void)
71{
72}
73
74MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
75 .map_io = msm8x60_map_io,
76 .init_irq = msm8x60_init_irq,
77 .init_machine = msm8x60_init,
78 .timer = &msm_timer,
79MACHINE_END
80
81MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
82 .map_io = msm8x60_map_io,
83 .init_irq = msm8x60_init_irq,
84 .init_machine = msm8x60_init,
85 .timer = &msm_timer,
86MACHINE_END
87
88MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
89 .map_io = msm8x60_map_io,
90 .init_irq = msm8x60_init_irq,
91 .init_machine = msm8x60_init,
92 .timer = &msm_timer,
93MACHINE_END
94
95MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
96 .map_io = msm8x60_map_io,
97 .init_irq = msm8x60_init_irq,
98 .init_machine = msm8x60_init,
99 .timer = &msm_timer,
100MACHINE_END
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index e3cc80792d6c..d5d5e441a52d 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -35,20 +35,49 @@
35 35
36extern struct sys_timer msm_timer; 36extern struct sys_timer msm_timer;
37 37
38static struct msm_gpio uart3_config_data[] = { 38static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300;
39 { GPIO_CFG(86, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_Rx"}, 39static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156;
40 { GPIO_CFG(87, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_Tx"}, 40
41/* Leave smc91x resources empty here, as we'll fill them in
42 * at run-time: they vary from board to board, and the true
43 * configuration won't be known until boot.
44 */
45static struct resource smc91x_resources[] __initdata = {
46 [0] = {
47 .flags = IORESOURCE_MEM,
48 },
49 [1] = {
50 .flags = IORESOURCE_IRQ,
51 },
41}; 52};
42 53
43static struct platform_device *devices[] __initdata = { 54static struct platform_device smc91x_device __initdata = {
44 &msm_device_uart3, 55 .name = "smc91x",
56 .id = 0,
57 .num_resources = ARRAY_SIZE(smc91x_resources),
58 .resource = smc91x_resources,
45}; 59};
46 60
47static void msm8x50_init_uart3(void) 61static int __init msm_init_smc91x(void)
48{ 62{
49 msm_gpios_request_enable(uart3_config_data, 63 if (machine_is_qsd8x50_surf()) {
50 ARRAY_SIZE(uart3_config_data)); 64 smc91x_resources[0].start = qsd8x50_surf_smc91x_base;
65 smc91x_resources[0].end = qsd8x50_surf_smc91x_base + 0xff;
66 smc91x_resources[1].start =
67 gpio_to_irq(qsd8x50_surf_smc91x_gpio);
68 smc91x_resources[1].end =
69 gpio_to_irq(qsd8x50_surf_smc91x_gpio);
70 platform_device_register(&smc91x_device);
71 }
72
73 return 0;
51} 74}
75module_init(msm_init_smc91x);
76
77static struct platform_device *devices[] __initdata = {
78 &msm_device_uart3,
79 &msm_device_smd,
80};
52 81
53static void __init qsd8x50_map_io(void) 82static void __init qsd8x50_map_io(void)
54{ 83{
@@ -64,7 +93,6 @@ static void __init qsd8x50_init_irq(void)
64 93
65static void __init qsd8x50_init(void) 94static void __init qsd8x50_init(void)
66{ 95{
67 msm8x50_init_uart3();
68 platform_add_devices(devices, ARRAY_SIZE(devices)); 96 platform_add_devices(devices, ARRAY_SIZE(devices));
69} 97}
70 98
diff --git a/arch/arm/mach-msm/clock-dummy.c b/arch/arm/mach-msm/clock-dummy.c
new file mode 100644
index 000000000000..1250d22082ee
--- /dev/null
+++ b/arch/arm/mach-msm/clock-dummy.c
@@ -0,0 +1,54 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 *
17 */
18#include <linux/clk.h>
19#include <linux/err.h>
20#include <linux/module.h>
21
22struct clk *clk_get(struct device *dev, const char *id)
23{
24 return ERR_PTR(-ENOENT);
25}
26EXPORT_SYMBOL(clk_get);
27
28int clk_enable(struct clk *clk)
29{
30 return -ENOENT;
31}
32EXPORT_SYMBOL(clk_enable);
33
34void clk_disable(struct clk *clk)
35{
36}
37EXPORT_SYMBOL(clk_disable);
38
39unsigned long clk_get_rate(struct clk *clk)
40{
41 return 0;
42}
43EXPORT_SYMBOL(clk_get_rate);
44
45int clk_set_rate(struct clk *clk, unsigned long rate)
46{
47 return -ENOENT;
48}
49EXPORT_SYMBOL(clk_set_rate);
50
51void clk_put(struct clk *clk)
52{
53}
54EXPORT_SYMBOL(clk_put);
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index b449e8ad2904..7fcf2e3b7698 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -51,6 +51,11 @@ struct platform_device msm_device_uart2 = {
51 .resource = resources_uart2, 51 .resource = resources_uart2,
52}; 52};
53 53
54struct platform_device msm_device_smd = {
55 .name = "msm_smd",
56 .id = -1,
57};
58
54struct clk msm_clocks_7x30[] = { 59struct clk msm_clocks_7x30[] = {
55 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 60 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
56 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), 61 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
diff --git a/arch/arm/mach-msm/devices-msm8x60-iommu.c b/arch/arm/mach-msm/devices-msm8x60-iommu.c
new file mode 100644
index 000000000000..89b9d4437e92
--- /dev/null
+++ b/arch/arm/mach-msm/devices-msm8x60-iommu.c
@@ -0,0 +1,883 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#include <linux/kernel.h>
19#include <linux/platform_device.h>
20#include <linux/bootmem.h>
21
22#include <mach/msm_iomap-8x60.h>
23#include <mach/irqs-8x60.h>
24#include <mach/iommu.h>
25
26static struct resource msm_iommu_jpegd_resources[] = {
27 {
28 .start = MSM_IOMMU_JPEGD_PHYS,
29 .end = MSM_IOMMU_JPEGD_PHYS + MSM_IOMMU_JPEGD_SIZE - 1,
30 .name = "physbase",
31 .flags = IORESOURCE_MEM,
32 },
33 {
34 .name = "nonsecure_irq",
35 .start = SMMU_JPEGD_CB_SC_NON_SECURE_IRQ,
36 .end = SMMU_JPEGD_CB_SC_NON_SECURE_IRQ,
37 .flags = IORESOURCE_IRQ,
38 },
39 {
40 .name = "secure_irq",
41 .start = SMMU_JPEGD_CB_SC_SECURE_IRQ,
42 .end = SMMU_JPEGD_CB_SC_SECURE_IRQ,
43 .flags = IORESOURCE_IRQ,
44 },
45};
46
47static struct resource msm_iommu_vpe_resources[] = {
48 {
49 .start = MSM_IOMMU_VPE_PHYS,
50 .end = MSM_IOMMU_VPE_PHYS + MSM_IOMMU_VPE_SIZE - 1,
51 .name = "physbase",
52 .flags = IORESOURCE_MEM,
53 },
54 {
55 .name = "nonsecure_irq",
56 .start = SMMU_VPE_CB_SC_NON_SECURE_IRQ,
57 .end = SMMU_VPE_CB_SC_NON_SECURE_IRQ,
58 .flags = IORESOURCE_IRQ,
59 },
60 {
61 .name = "secure_irq",
62 .start = SMMU_VPE_CB_SC_SECURE_IRQ,
63 .end = SMMU_VPE_CB_SC_SECURE_IRQ,
64 .flags = IORESOURCE_IRQ,
65 },
66};
67
68static struct resource msm_iommu_mdp0_resources[] = {
69 {
70 .start = MSM_IOMMU_MDP0_PHYS,
71 .end = MSM_IOMMU_MDP0_PHYS + MSM_IOMMU_MDP0_SIZE - 1,
72 .name = "physbase",
73 .flags = IORESOURCE_MEM,
74 },
75 {
76 .name = "nonsecure_irq",
77 .start = SMMU_MDP0_CB_SC_NON_SECURE_IRQ,
78 .end = SMMU_MDP0_CB_SC_NON_SECURE_IRQ,
79 .flags = IORESOURCE_IRQ,
80 },
81 {
82 .name = "secure_irq",
83 .start = SMMU_MDP0_CB_SC_SECURE_IRQ,
84 .end = SMMU_MDP0_CB_SC_SECURE_IRQ,
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89static struct resource msm_iommu_mdp1_resources[] = {
90 {
91 .start = MSM_IOMMU_MDP1_PHYS,
92 .end = MSM_IOMMU_MDP1_PHYS + MSM_IOMMU_MDP1_SIZE - 1,
93 .name = "physbase",
94 .flags = IORESOURCE_MEM,
95 },
96 {
97 .name = "nonsecure_irq",
98 .start = SMMU_MDP1_CB_SC_NON_SECURE_IRQ,
99 .end = SMMU_MDP1_CB_SC_NON_SECURE_IRQ,
100 .flags = IORESOURCE_IRQ,
101 },
102 {
103 .name = "secure_irq",
104 .start = SMMU_MDP1_CB_SC_SECURE_IRQ,
105 .end = SMMU_MDP1_CB_SC_SECURE_IRQ,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110static struct resource msm_iommu_rot_resources[] = {
111 {
112 .start = MSM_IOMMU_ROT_PHYS,
113 .end = MSM_IOMMU_ROT_PHYS + MSM_IOMMU_ROT_SIZE - 1,
114 .name = "physbase",
115 .flags = IORESOURCE_MEM,
116 },
117 {
118 .name = "nonsecure_irq",
119 .start = SMMU_ROT_CB_SC_NON_SECURE_IRQ,
120 .end = SMMU_ROT_CB_SC_NON_SECURE_IRQ,
121 .flags = IORESOURCE_IRQ,
122 },
123 {
124 .name = "secure_irq",
125 .start = SMMU_ROT_CB_SC_SECURE_IRQ,
126 .end = SMMU_ROT_CB_SC_SECURE_IRQ,
127 .flags = IORESOURCE_IRQ,
128 },
129};
130
131static struct resource msm_iommu_ijpeg_resources[] = {
132 {
133 .start = MSM_IOMMU_IJPEG_PHYS,
134 .end = MSM_IOMMU_IJPEG_PHYS + MSM_IOMMU_IJPEG_SIZE - 1,
135 .name = "physbase",
136 .flags = IORESOURCE_MEM,
137 },
138 {
139 .name = "nonsecure_irq",
140 .start = SMMU_IJPEG_CB_SC_NON_SECURE_IRQ,
141 .end = SMMU_IJPEG_CB_SC_NON_SECURE_IRQ,
142 .flags = IORESOURCE_IRQ,
143 },
144 {
145 .name = "secure_irq",
146 .start = SMMU_IJPEG_CB_SC_SECURE_IRQ,
147 .end = SMMU_IJPEG_CB_SC_SECURE_IRQ,
148 .flags = IORESOURCE_IRQ,
149 },
150};
151
152static struct resource msm_iommu_vfe_resources[] = {
153 {
154 .start = MSM_IOMMU_VFE_PHYS,
155 .end = MSM_IOMMU_VFE_PHYS + MSM_IOMMU_VFE_SIZE - 1,
156 .name = "physbase",
157 .flags = IORESOURCE_MEM,
158 },
159 {
160 .name = "nonsecure_irq",
161 .start = SMMU_VFE_CB_SC_NON_SECURE_IRQ,
162 .end = SMMU_VFE_CB_SC_NON_SECURE_IRQ,
163 .flags = IORESOURCE_IRQ,
164 },
165 {
166 .name = "secure_irq",
167 .start = SMMU_VFE_CB_SC_SECURE_IRQ,
168 .end = SMMU_VFE_CB_SC_SECURE_IRQ,
169 .flags = IORESOURCE_IRQ,
170 },
171};
172
173static struct resource msm_iommu_vcodec_a_resources[] = {
174 {
175 .start = MSM_IOMMU_VCODEC_A_PHYS,
176 .end = MSM_IOMMU_VCODEC_A_PHYS + MSM_IOMMU_VCODEC_A_SIZE - 1,
177 .name = "physbase",
178 .flags = IORESOURCE_MEM,
179 },
180 {
181 .name = "nonsecure_irq",
182 .start = SMMU_VCODEC_A_CB_SC_NON_SECURE_IRQ,
183 .end = SMMU_VCODEC_A_CB_SC_NON_SECURE_IRQ,
184 .flags = IORESOURCE_IRQ,
185 },
186 {
187 .name = "secure_irq",
188 .start = SMMU_VCODEC_A_CB_SC_SECURE_IRQ,
189 .end = SMMU_VCODEC_A_CB_SC_SECURE_IRQ,
190 .flags = IORESOURCE_IRQ,
191 },
192};
193
194static struct resource msm_iommu_vcodec_b_resources[] = {
195 {
196 .start = MSM_IOMMU_VCODEC_B_PHYS,
197 .end = MSM_IOMMU_VCODEC_B_PHYS + MSM_IOMMU_VCODEC_B_SIZE - 1,
198 .name = "physbase",
199 .flags = IORESOURCE_MEM,
200 },
201 {
202 .name = "nonsecure_irq",
203 .start = SMMU_VCODEC_B_CB_SC_NON_SECURE_IRQ,
204 .end = SMMU_VCODEC_B_CB_SC_NON_SECURE_IRQ,
205 .flags = IORESOURCE_IRQ,
206 },
207 {
208 .name = "secure_irq",
209 .start = SMMU_VCODEC_B_CB_SC_SECURE_IRQ,
210 .end = SMMU_VCODEC_B_CB_SC_SECURE_IRQ,
211 .flags = IORESOURCE_IRQ,
212 },
213};
214
215static struct resource msm_iommu_gfx3d_resources[] = {
216 {
217 .start = MSM_IOMMU_GFX3D_PHYS,
218 .end = MSM_IOMMU_GFX3D_PHYS + MSM_IOMMU_GFX3D_SIZE - 1,
219 .name = "physbase",
220 .flags = IORESOURCE_MEM,
221 },
222 {
223 .name = "nonsecure_irq",
224 .start = SMMU_GFX3D_CB_SC_NON_SECURE_IRQ,
225 .end = SMMU_GFX3D_CB_SC_NON_SECURE_IRQ,
226 .flags = IORESOURCE_IRQ,
227 },
228 {
229 .name = "secure_irq",
230 .start = SMMU_GFX3D_CB_SC_SECURE_IRQ,
231 .end = SMMU_GFX3D_CB_SC_SECURE_IRQ,
232 .flags = IORESOURCE_IRQ,
233 },
234};
235
236static struct resource msm_iommu_gfx2d0_resources[] = {
237 {
238 .start = MSM_IOMMU_GFX2D0_PHYS,
239 .end = MSM_IOMMU_GFX2D0_PHYS + MSM_IOMMU_GFX2D0_SIZE - 1,
240 .name = "physbase",
241 .flags = IORESOURCE_MEM,
242 },
243 {
244 .name = "nonsecure_irq",
245 .start = SMMU_GFX2D0_CB_SC_NON_SECURE_IRQ,
246 .end = SMMU_GFX2D0_CB_SC_NON_SECURE_IRQ,
247 .flags = IORESOURCE_IRQ,
248 },
249 {
250 .name = "secure_irq",
251 .start = SMMU_GFX2D0_CB_SC_SECURE_IRQ,
252 .end = SMMU_GFX2D0_CB_SC_SECURE_IRQ,
253 .flags = IORESOURCE_IRQ,
254 },
255};
256
257static struct platform_device msm_root_iommu_dev = {
258 .name = "msm_iommu",
259 .id = -1,
260};
261
262static struct msm_iommu_dev jpegd_smmu = {
263 .name = "jpegd",
264 .clk_rate = -1
265};
266
267static struct msm_iommu_dev vpe_smmu = {
268 .name = "vpe"
269};
270
271static struct msm_iommu_dev mdp0_smmu = {
272 .name = "mdp0"
273};
274
275static struct msm_iommu_dev mdp1_smmu = {
276 .name = "mdp1"
277};
278
279static struct msm_iommu_dev rot_smmu = {
280 .name = "rot"
281};
282
283static struct msm_iommu_dev ijpeg_smmu = {
284 .name = "ijpeg"
285};
286
287static struct msm_iommu_dev vfe_smmu = {
288 .name = "vfe",
289 .clk_rate = -1
290};
291
292static struct msm_iommu_dev vcodec_a_smmu = {
293 .name = "vcodec_a"
294};
295
296static struct msm_iommu_dev vcodec_b_smmu = {
297 .name = "vcodec_b"
298};
299
300static struct msm_iommu_dev gfx3d_smmu = {
301 .name = "gfx3d",
302 .clk_rate = 27000000
303};
304
305static struct msm_iommu_dev gfx2d0_smmu = {
306 .name = "gfx2d0",
307 .clk_rate = 27000000
308};
309
310static struct platform_device msm_device_smmu_jpegd = {
311 .name = "msm_iommu",
312 .id = 0,
313 .dev = {
314 .parent = &msm_root_iommu_dev.dev,
315 },
316 .num_resources = ARRAY_SIZE(msm_iommu_jpegd_resources),
317 .resource = msm_iommu_jpegd_resources,
318};
319
320static struct platform_device msm_device_smmu_vpe = {
321 .name = "msm_iommu",
322 .id = 1,
323 .dev = {
324 .parent = &msm_root_iommu_dev.dev,
325 },
326 .num_resources = ARRAY_SIZE(msm_iommu_vpe_resources),
327 .resource = msm_iommu_vpe_resources,
328};
329
330static struct platform_device msm_device_smmu_mdp0 = {
331 .name = "msm_iommu",
332 .id = 2,
333 .dev = {
334 .parent = &msm_root_iommu_dev.dev,
335 },
336 .num_resources = ARRAY_SIZE(msm_iommu_mdp0_resources),
337 .resource = msm_iommu_mdp0_resources,
338};
339
340static struct platform_device msm_device_smmu_mdp1 = {
341 .name = "msm_iommu",
342 .id = 3,
343 .dev = {
344 .parent = &msm_root_iommu_dev.dev,
345 },
346 .num_resources = ARRAY_SIZE(msm_iommu_mdp1_resources),
347 .resource = msm_iommu_mdp1_resources,
348};
349
350static struct platform_device msm_device_smmu_rot = {
351 .name = "msm_iommu",
352 .id = 4,
353 .dev = {
354 .parent = &msm_root_iommu_dev.dev,
355 },
356 .num_resources = ARRAY_SIZE(msm_iommu_rot_resources),
357 .resource = msm_iommu_rot_resources,
358};
359
360static struct platform_device msm_device_smmu_ijpeg = {
361 .name = "msm_iommu",
362 .id = 5,
363 .dev = {
364 .parent = &msm_root_iommu_dev.dev,
365 },
366 .num_resources = ARRAY_SIZE(msm_iommu_ijpeg_resources),
367 .resource = msm_iommu_ijpeg_resources,
368};
369
370static struct platform_device msm_device_smmu_vfe = {
371 .name = "msm_iommu",
372 .id = 6,
373 .dev = {
374 .parent = &msm_root_iommu_dev.dev,
375 },
376 .num_resources = ARRAY_SIZE(msm_iommu_vfe_resources),
377 .resource = msm_iommu_vfe_resources,
378};
379
380static struct platform_device msm_device_smmu_vcodec_a = {
381 .name = "msm_iommu",
382 .id = 7,
383 .dev = {
384 .parent = &msm_root_iommu_dev.dev,
385 },
386 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_a_resources),
387 .resource = msm_iommu_vcodec_a_resources,
388};
389
390static struct platform_device msm_device_smmu_vcodec_b = {
391 .name = "msm_iommu",
392 .id = 8,
393 .dev = {
394 .parent = &msm_root_iommu_dev.dev,
395 },
396 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_b_resources),
397 .resource = msm_iommu_vcodec_b_resources,
398};
399
400static struct platform_device msm_device_smmu_gfx3d = {
401 .name = "msm_iommu",
402 .id = 9,
403 .dev = {
404 .parent = &msm_root_iommu_dev.dev,
405 },
406 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d_resources),
407 .resource = msm_iommu_gfx3d_resources,
408};
409
410static struct platform_device msm_device_smmu_gfx2d0 = {
411 .name = "msm_iommu",
412 .id = 10,
413 .dev = {
414 .parent = &msm_root_iommu_dev.dev,
415 },
416 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d0_resources),
417 .resource = msm_iommu_gfx2d0_resources,
418};
419
420static struct msm_iommu_ctx_dev jpegd_src_ctx = {
421 .name = "jpegd_src",
422 .num = 0,
423 .mids = {0, -1}
424};
425
426static struct msm_iommu_ctx_dev jpegd_dst_ctx = {
427 .name = "jpegd_dst",
428 .num = 1,
429 .mids = {1, -1}
430};
431
432static struct msm_iommu_ctx_dev vpe_src_ctx = {
433 .name = "vpe_src",
434 .num = 0,
435 .mids = {0, -1}
436};
437
438static struct msm_iommu_ctx_dev vpe_dst_ctx = {
439 .name = "vpe_dst",
440 .num = 1,
441 .mids = {1, -1}
442};
443
444static struct msm_iommu_ctx_dev mdp_vg1_ctx = {
445 .name = "mdp_vg1",
446 .num = 0,
447 .mids = {0, 2, -1}
448};
449
450static struct msm_iommu_ctx_dev mdp_rgb1_ctx = {
451 .name = "mdp_rgb1",
452 .num = 1,
453 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
454};
455
456static struct msm_iommu_ctx_dev mdp_vg2_ctx = {
457 .name = "mdp_vg2",
458 .num = 0,
459 .mids = {0, 2, -1}
460};
461
462static struct msm_iommu_ctx_dev mdp_rgb2_ctx = {
463 .name = "mdp_rgb2",
464 .num = 1,
465 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
466};
467
468static struct msm_iommu_ctx_dev rot_src_ctx = {
469 .name = "rot_src",
470 .num = 0,
471 .mids = {0, -1}
472};
473
474static struct msm_iommu_ctx_dev rot_dst_ctx = {
475 .name = "rot_dst",
476 .num = 1,
477 .mids = {1, -1}
478};
479
480static struct msm_iommu_ctx_dev ijpeg_src_ctx = {
481 .name = "ijpeg_src",
482 .num = 0,
483 .mids = {0, -1}
484};
485
486static struct msm_iommu_ctx_dev ijpeg_dst_ctx = {
487 .name = "ijpeg_dst",
488 .num = 1,
489 .mids = {1, -1}
490};
491
492static struct msm_iommu_ctx_dev vfe_imgwr_ctx = {
493 .name = "vfe_imgwr",
494 .num = 0,
495 .mids = {2, 3, 4, 5, 6, 7, 8, -1}
496};
497
498static struct msm_iommu_ctx_dev vfe_misc_ctx = {
499 .name = "vfe_misc",
500 .num = 1,
501 .mids = {0, 1, 9, -1}
502};
503
504static struct msm_iommu_ctx_dev vcodec_a_stream_ctx = {
505 .name = "vcodec_a_stream",
506 .num = 0,
507 .mids = {2, 5, -1}
508};
509
510static struct msm_iommu_ctx_dev vcodec_a_mm1_ctx = {
511 .name = "vcodec_a_mm1",
512 .num = 1,
513 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
514};
515
516static struct msm_iommu_ctx_dev vcodec_b_mm2_ctx = {
517 .name = "vcodec_b_mm2",
518 .num = 0,
519 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
520};
521
522static struct msm_iommu_ctx_dev gfx3d_rbpa_ctx = {
523 .name = "gfx3d_rbpa",
524 .num = 0,
525 .mids = {-1}
526};
527
528static struct msm_iommu_ctx_dev gfx3d_cpvgttc_ctx = {
529 .name = "gfx3d_cpvgttc",
530 .num = 1,
531 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
532};
533
534static struct msm_iommu_ctx_dev gfx3d_smmu_ctx = {
535 .name = "gfx3d_smmu",
536 .num = 2,
537 .mids = {8, 9, 10, 11, 12, -1}
538};
539
540static struct msm_iommu_ctx_dev gfx2d0_pixv1_ctx = {
541 .name = "gfx2d0_pixv1_smmu",
542 .num = 0,
543 .mids = {0, 3, 4, -1}
544};
545
546static struct msm_iommu_ctx_dev gfx2d0_texv3_ctx = {
547 .name = "gfx2d0_texv3_smmu",
548 .num = 1,
549 .mids = {1, 6, 7, -1}
550};
551
552static struct platform_device msm_device_jpegd_src_ctx = {
553 .name = "msm_iommu_ctx",
554 .id = 0,
555 .dev = {
556 .parent = &msm_device_smmu_jpegd.dev,
557 },
558};
559
560static struct platform_device msm_device_jpegd_dst_ctx = {
561 .name = "msm_iommu_ctx",
562 .id = 1,
563 .dev = {
564 .parent = &msm_device_smmu_jpegd.dev,
565 },
566};
567
568static struct platform_device msm_device_vpe_src_ctx = {
569 .name = "msm_iommu_ctx",
570 .id = 2,
571 .dev = {
572 .parent = &msm_device_smmu_vpe.dev,
573 },
574};
575
576static struct platform_device msm_device_vpe_dst_ctx = {
577 .name = "msm_iommu_ctx",
578 .id = 3,
579 .dev = {
580 .parent = &msm_device_smmu_vpe.dev,
581 },
582};
583
584static struct platform_device msm_device_mdp_vg1_ctx = {
585 .name = "msm_iommu_ctx",
586 .id = 4,
587 .dev = {
588 .parent = &msm_device_smmu_mdp0.dev,
589 },
590};
591
592static struct platform_device msm_device_mdp_rgb1_ctx = {
593 .name = "msm_iommu_ctx",
594 .id = 5,
595 .dev = {
596 .parent = &msm_device_smmu_mdp0.dev,
597 },
598};
599
600static struct platform_device msm_device_mdp_vg2_ctx = {
601 .name = "msm_iommu_ctx",
602 .id = 6,
603 .dev = {
604 .parent = &msm_device_smmu_mdp1.dev,
605 },
606};
607
608static struct platform_device msm_device_mdp_rgb2_ctx = {
609 .name = "msm_iommu_ctx",
610 .id = 7,
611 .dev = {
612 .parent = &msm_device_smmu_mdp1.dev,
613 },
614};
615
616static struct platform_device msm_device_rot_src_ctx = {
617 .name = "msm_iommu_ctx",
618 .id = 8,
619 .dev = {
620 .parent = &msm_device_smmu_rot.dev,
621 },
622};
623
624static struct platform_device msm_device_rot_dst_ctx = {
625 .name = "msm_iommu_ctx",
626 .id = 9,
627 .dev = {
628 .parent = &msm_device_smmu_rot.dev,
629 },
630};
631
632static struct platform_device msm_device_ijpeg_src_ctx = {
633 .name = "msm_iommu_ctx",
634 .id = 10,
635 .dev = {
636 .parent = &msm_device_smmu_ijpeg.dev,
637 },
638};
639
640static struct platform_device msm_device_ijpeg_dst_ctx = {
641 .name = "msm_iommu_ctx",
642 .id = 11,
643 .dev = {
644 .parent = &msm_device_smmu_ijpeg.dev,
645 },
646};
647
648static struct platform_device msm_device_vfe_imgwr_ctx = {
649 .name = "msm_iommu_ctx",
650 .id = 12,
651 .dev = {
652 .parent = &msm_device_smmu_vfe.dev,
653 },
654};
655
656static struct platform_device msm_device_vfe_misc_ctx = {
657 .name = "msm_iommu_ctx",
658 .id = 13,
659 .dev = {
660 .parent = &msm_device_smmu_vfe.dev,
661 },
662};
663
664static struct platform_device msm_device_vcodec_a_stream_ctx = {
665 .name = "msm_iommu_ctx",
666 .id = 14,
667 .dev = {
668 .parent = &msm_device_smmu_vcodec_a.dev,
669 },
670};
671
672static struct platform_device msm_device_vcodec_a_mm1_ctx = {
673 .name = "msm_iommu_ctx",
674 .id = 15,
675 .dev = {
676 .parent = &msm_device_smmu_vcodec_a.dev,
677 },
678};
679
680static struct platform_device msm_device_vcodec_b_mm2_ctx = {
681 .name = "msm_iommu_ctx",
682 .id = 16,
683 .dev = {
684 .parent = &msm_device_smmu_vcodec_b.dev,
685 },
686};
687
688static struct platform_device msm_device_gfx3d_rbpa_ctx = {
689 .name = "msm_iommu_ctx",
690 .id = 17,
691 .dev = {
692 .parent = &msm_device_smmu_gfx3d.dev,
693 },
694};
695
696static struct platform_device msm_device_gfx3d_cpvgttc_ctx = {
697 .name = "msm_iommu_ctx",
698 .id = 18,
699 .dev = {
700 .parent = &msm_device_smmu_gfx3d.dev,
701 },
702};
703
704static struct platform_device msm_device_gfx3d_smmu_ctx = {
705 .name = "msm_iommu_ctx",
706 .id = 19,
707 .dev = {
708 .parent = &msm_device_smmu_gfx3d.dev,
709 },
710};
711
712static struct platform_device msm_device_gfx2d0_pixv1_ctx = {
713 .name = "msm_iommu_ctx",
714 .id = 20,
715 .dev = {
716 .parent = &msm_device_smmu_gfx2d0.dev,
717 },
718};
719
720static struct platform_device msm_device_gfx2d0_texv3_ctx = {
721 .name = "msm_iommu_ctx",
722 .id = 21,
723 .dev = {
724 .parent = &msm_device_smmu_gfx2d0.dev,
725 },
726};
727
728static struct platform_device *msm_iommu_devs[] = {
729 &msm_device_smmu_jpegd,
730 &msm_device_smmu_vpe,
731 &msm_device_smmu_mdp0,
732 &msm_device_smmu_mdp1,
733 &msm_device_smmu_rot,
734 &msm_device_smmu_ijpeg,
735 &msm_device_smmu_vfe,
736 &msm_device_smmu_vcodec_a,
737 &msm_device_smmu_vcodec_b,
738 &msm_device_smmu_gfx3d,
739 &msm_device_smmu_gfx2d0,
740};
741
742static struct msm_iommu_dev *msm_iommu_data[] = {
743 &jpegd_smmu,
744 &vpe_smmu,
745 &mdp0_smmu,
746 &mdp1_smmu,
747 &rot_smmu,
748 &ijpeg_smmu,
749 &vfe_smmu,
750 &vcodec_a_smmu,
751 &vcodec_b_smmu,
752 &gfx3d_smmu,
753 &gfx2d0_smmu,
754};
755
756static struct platform_device *msm_iommu_ctx_devs[] = {
757 &msm_device_jpegd_src_ctx,
758 &msm_device_jpegd_dst_ctx,
759 &msm_device_vpe_src_ctx,
760 &msm_device_vpe_dst_ctx,
761 &msm_device_mdp_vg1_ctx,
762 &msm_device_mdp_rgb1_ctx,
763 &msm_device_mdp_vg2_ctx,
764 &msm_device_mdp_rgb2_ctx,
765 &msm_device_rot_src_ctx,
766 &msm_device_rot_dst_ctx,
767 &msm_device_ijpeg_src_ctx,
768 &msm_device_ijpeg_dst_ctx,
769 &msm_device_vfe_imgwr_ctx,
770 &msm_device_vfe_misc_ctx,
771 &msm_device_vcodec_a_stream_ctx,
772 &msm_device_vcodec_a_mm1_ctx,
773 &msm_device_vcodec_b_mm2_ctx,
774 &msm_device_gfx3d_rbpa_ctx,
775 &msm_device_gfx3d_cpvgttc_ctx,
776 &msm_device_gfx3d_smmu_ctx,
777 &msm_device_gfx2d0_pixv1_ctx,
778 &msm_device_gfx2d0_texv3_ctx,
779};
780
781static struct msm_iommu_ctx_dev *msm_iommu_ctx_data[] = {
782 &jpegd_src_ctx,
783 &jpegd_dst_ctx,
784 &vpe_src_ctx,
785 &vpe_dst_ctx,
786 &mdp_vg1_ctx,
787 &mdp_rgb1_ctx,
788 &mdp_vg2_ctx,
789 &mdp_rgb2_ctx,
790 &rot_src_ctx,
791 &rot_dst_ctx,
792 &ijpeg_src_ctx,
793 &ijpeg_dst_ctx,
794 &vfe_imgwr_ctx,
795 &vfe_misc_ctx,
796 &vcodec_a_stream_ctx,
797 &vcodec_a_mm1_ctx,
798 &vcodec_b_mm2_ctx,
799 &gfx3d_rbpa_ctx,
800 &gfx3d_cpvgttc_ctx,
801 &gfx3d_smmu_ctx,
802 &gfx2d0_pixv1_ctx,
803 &gfx2d0_texv3_ctx,
804};
805
806static int msm8x60_iommu_init(void)
807{
808 int ret, i;
809
810 ret = platform_device_register(&msm_root_iommu_dev);
811 if (ret != 0) {
812 pr_err("Failed to register root IOMMU device!\n");
813 goto failure;
814 }
815
816 for (i = 0; i < ARRAY_SIZE(msm_iommu_devs); i++) {
817 ret = platform_device_add_data(msm_iommu_devs[i],
818 msm_iommu_data[i],
819 sizeof(struct msm_iommu_dev));
820 if (ret != 0) {
821 pr_err("platform_device_add_data failed, "
822 "i = %d\n", i);
823 goto failure_unwind;
824 }
825
826 ret = platform_device_register(msm_iommu_devs[i]);
827
828 if (ret != 0) {
829 pr_err("platform_device_register smmu failed, "
830 "i = %d\n", i);
831 goto failure_unwind;
832 }
833 }
834
835 for (i = 0; i < ARRAY_SIZE(msm_iommu_ctx_devs); i++) {
836 ret = platform_device_add_data(msm_iommu_ctx_devs[i],
837 msm_iommu_ctx_data[i],
838 sizeof(*msm_iommu_ctx_devs[i]));
839 if (ret != 0) {
840 pr_err("platform_device_add_data smmu failed, "
841 "i = %d\n", i);
842 goto failure_unwind2;
843 }
844
845 ret = platform_device_register(msm_iommu_ctx_devs[i]);
846 if (ret != 0) {
847 pr_err("platform_device_register ctx failed, "
848 "i = %d\n", i);
849 goto failure_unwind2;
850 }
851 }
852 return 0;
853
854failure_unwind2:
855 while (--i >= 0)
856 platform_device_unregister(msm_iommu_ctx_devs[i]);
857failure_unwind:
858 while (--i >= 0)
859 platform_device_unregister(msm_iommu_devs[i]);
860
861 platform_device_unregister(&msm_root_iommu_dev);
862failure:
863 return ret;
864}
865
866static void msm8x60_iommu_exit(void)
867{
868 int i;
869
870 for (i = 0; i < ARRAY_SIZE(msm_iommu_ctx_devs); i++)
871 platform_device_unregister(msm_iommu_ctx_devs[i]);
872
873 for (i = 0; i < ARRAY_SIZE(msm_iommu_devs); ++i)
874 platform_device_unregister(msm_iommu_devs[i]);
875
876 platform_device_unregister(&msm_root_iommu_dev);
877}
878
879subsys_initcall(msm8x60_iommu_init);
880module_exit(msm8x60_iommu_exit);
881
882MODULE_LICENSE("GPL v2");
883MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 4d4a50785e34..6fe67c5d1ae0 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -48,6 +48,11 @@ struct platform_device msm_device_uart3 = {
48 .resource = resources_uart3, 48 .resource = resources_uart3,
49}; 49};
50 50
51struct platform_device msm_device_smd = {
52 .name = "msm_smd",
53 .id = -1,
54};
55
51struct clk msm_clocks_8x50[] = { 56struct clk msm_clocks_8x50[] = {
52 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 57 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
53 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), 58 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN),
diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c
index bc32c845c7b0..33051b509e88 100644
--- a/arch/arm/mach-msm/gpio.c
+++ b/arch/arm/mach-msm/gpio.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-msm/gpio.c 1/* linux/arch/arm/mach-msm/gpio.c
2 * 2 *
3 * Copyright (C) 2007 Google, Inc. 3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2009, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -14,72 +14,363 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/bitops.h>
18#include <linux/gpio.h>
19#include <linux/interrupt.h>
20#include <linux/io.h>
21#include <linux/irq.h>
17#include <linux/module.h> 22#include <linux/module.h>
18#include <mach/gpio.h> 23#include "gpio_hw.h"
19#include "proc_comm.h" 24#include "gpiomux.h"
20 25
21int gpio_tlmm_config(unsigned config, unsigned disable) 26#define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
22{ 27
23 return msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, &disable); 28#define MSM_GPIO_BANK(bank, first, last) \
24} 29 { \
25EXPORT_SYMBOL(gpio_tlmm_config); 30 .regs = { \
26 31 .out = MSM_GPIO_OUT_##bank, \
27int msm_gpios_enable(const struct msm_gpio *table, int size) 32 .in = MSM_GPIO_IN_##bank, \
28{ 33 .int_status = MSM_GPIO_INT_STATUS_##bank, \
29 int rc; 34 .int_clear = MSM_GPIO_INT_CLEAR_##bank, \
30 int i; 35 .int_en = MSM_GPIO_INT_EN_##bank, \
31 const struct msm_gpio *g; 36 .int_edge = MSM_GPIO_INT_EDGE_##bank, \
32 for (i = 0; i < size; i++) { 37 .int_pos = MSM_GPIO_INT_POS_##bank, \
33 g = table + i; 38 .oe = MSM_GPIO_OE_##bank, \
34 rc = gpio_tlmm_config(g->gpio_cfg, GPIO_ENABLE); 39 }, \
35 if (rc) { 40 .chip = { \
36 pr_err("gpio_tlmm_config(0x%08x, GPIO_ENABLE)" 41 .base = (first), \
37 " <%s> failed: %d\n", 42 .ngpio = (last) - (first) + 1, \
38 g->gpio_cfg, g->label ?: "?", rc); 43 .get = msm_gpio_get, \
39 pr_err("pin %d func %d dir %d pull %d drvstr %d\n", 44 .set = msm_gpio_set, \
40 GPIO_PIN(g->gpio_cfg), GPIO_FUNC(g->gpio_cfg), 45 .direction_input = msm_gpio_direction_input, \
41 GPIO_DIR(g->gpio_cfg), GPIO_PULL(g->gpio_cfg), 46 .direction_output = msm_gpio_direction_output, \
42 GPIO_DRVSTR(g->gpio_cfg)); 47 .to_irq = msm_gpio_to_irq, \
43 goto err; 48 .request = msm_gpio_request, \
44 } 49 .free = msm_gpio_free, \
50 } \
45 } 51 }
52
53#define MSM_GPIO_BROKEN_INT_CLEAR 1
54
55struct msm_gpio_regs {
56 void __iomem *out;
57 void __iomem *in;
58 void __iomem *int_status;
59 void __iomem *int_clear;
60 void __iomem *int_en;
61 void __iomem *int_edge;
62 void __iomem *int_pos;
63 void __iomem *oe;
64};
65
66struct msm_gpio_chip {
67 spinlock_t lock;
68 struct gpio_chip chip;
69 struct msm_gpio_regs regs;
70#if MSM_GPIO_BROKEN_INT_CLEAR
71 unsigned int_status_copy;
72#endif
73 unsigned int both_edge_detect;
74 unsigned int int_enable[2]; /* 0: awake, 1: sleep */
75};
76
77static int msm_gpio_write(struct msm_gpio_chip *msm_chip,
78 unsigned offset, unsigned on)
79{
80 unsigned mask = BIT(offset);
81 unsigned val;
82
83 val = readl(msm_chip->regs.out);
84 if (on)
85 writel(val | mask, msm_chip->regs.out);
86 else
87 writel(val & ~mask, msm_chip->regs.out);
46 return 0; 88 return 0;
47err: 89}
48 msm_gpios_disable(table, i); 90
49 return rc; 91static void msm_gpio_update_both_edge_detect(struct msm_gpio_chip *msm_chip)
50} 92{
51EXPORT_SYMBOL(msm_gpios_enable); 93 int loop_limit = 100;
52 94 unsigned pol, val, val2, intstat;
53void msm_gpios_disable(const struct msm_gpio *table, int size) 95 do {
54{ 96 val = readl(msm_chip->regs.in);
55 int rc; 97 pol = readl(msm_chip->regs.int_pos);
56 int i; 98 pol = (pol & ~msm_chip->both_edge_detect) |
57 const struct msm_gpio *g; 99 (~val & msm_chip->both_edge_detect);
58 for (i = size-1; i >= 0; i--) { 100 writel(pol, msm_chip->regs.int_pos);
59 g = table + i; 101 intstat = readl(msm_chip->regs.int_status);
60 rc = gpio_tlmm_config(g->gpio_cfg, GPIO_DISABLE); 102 val2 = readl(msm_chip->regs.in);
61 if (rc) { 103 if (((val ^ val2) & msm_chip->both_edge_detect & ~intstat) == 0)
62 pr_err("gpio_tlmm_config(0x%08x, GPIO_DISABLE)" 104 return;
63 " <%s> failed: %d\n", 105 } while (loop_limit-- > 0);
64 g->gpio_cfg, g->label ?: "?", rc); 106 printk(KERN_ERR "msm_gpio_update_both_edge_detect, "
65 pr_err("pin %d func %d dir %d pull %d drvstr %d\n", 107 "failed to reach stable state %x != %x\n", val, val2);
66 GPIO_PIN(g->gpio_cfg), GPIO_FUNC(g->gpio_cfg), 108}
67 GPIO_DIR(g->gpio_cfg), GPIO_PULL(g->gpio_cfg), 109
68 GPIO_DRVSTR(g->gpio_cfg)); 110static int msm_gpio_clear_detect_status(struct msm_gpio_chip *msm_chip,
69 } 111 unsigned offset)
112{
113 unsigned bit = BIT(offset);
114
115#if MSM_GPIO_BROKEN_INT_CLEAR
116 /* Save interrupts that already triggered before we loose them. */
117 /* Any interrupt that triggers between the read of int_status */
118 /* and the write to int_clear will still be lost though. */
119 msm_chip->int_status_copy |= readl(msm_chip->regs.int_status);
120 msm_chip->int_status_copy &= ~bit;
121#endif
122 writel(bit, msm_chip->regs.int_clear);
123 msm_gpio_update_both_edge_detect(msm_chip);
124 return 0;
125}
126
127static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
128{
129 struct msm_gpio_chip *msm_chip;
130 unsigned long irq_flags;
131
132 msm_chip = container_of(chip, struct msm_gpio_chip, chip);
133 spin_lock_irqsave(&msm_chip->lock, irq_flags);
134 writel(readl(msm_chip->regs.oe) & ~BIT(offset), msm_chip->regs.oe);
135 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
136 return 0;
137}
138
139static int
140msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value)
141{
142 struct msm_gpio_chip *msm_chip;
143 unsigned long irq_flags;
144
145 msm_chip = container_of(chip, struct msm_gpio_chip, chip);
146 spin_lock_irqsave(&msm_chip->lock, irq_flags);
147 msm_gpio_write(msm_chip, offset, value);
148 writel(readl(msm_chip->regs.oe) | BIT(offset), msm_chip->regs.oe);
149 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
150 return 0;
151}
152
153static int msm_gpio_get(struct gpio_chip *chip, unsigned offset)
154{
155 struct msm_gpio_chip *msm_chip;
156
157 msm_chip = container_of(chip, struct msm_gpio_chip, chip);
158 return (readl(msm_chip->regs.in) & (1U << offset)) ? 1 : 0;
159}
160
161static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
162{
163 struct msm_gpio_chip *msm_chip;
164 unsigned long irq_flags;
165
166 msm_chip = container_of(chip, struct msm_gpio_chip, chip);
167 spin_lock_irqsave(&msm_chip->lock, irq_flags);
168 msm_gpio_write(msm_chip, offset, value);
169 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
170}
171
172static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
173{
174 return MSM_GPIO_TO_INT(chip->base + offset);
175}
176
177#ifdef CONFIG_MSM_GPIOMUX
178static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
179{
180 return msm_gpiomux_get(chip->base + offset);
181}
182
183static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
184{
185 msm_gpiomux_put(chip->base + offset);
186}
187#else
188#define msm_gpio_request NULL
189#define msm_gpio_free NULL
190#endif
191
192struct msm_gpio_chip msm_gpio_chips[] = {
193#if defined(CONFIG_ARCH_MSM7X00A)
194 MSM_GPIO_BANK(0, 0, 15),
195 MSM_GPIO_BANK(1, 16, 42),
196 MSM_GPIO_BANK(2, 43, 67),
197 MSM_GPIO_BANK(3, 68, 94),
198 MSM_GPIO_BANK(4, 95, 106),
199 MSM_GPIO_BANK(5, 107, 121),
200#elif defined(CONFIG_ARCH_MSM7X25) || defined(CONFIG_ARCH_MSM7X27)
201 MSM_GPIO_BANK(0, 0, 15),
202 MSM_GPIO_BANK(1, 16, 42),
203 MSM_GPIO_BANK(2, 43, 67),
204 MSM_GPIO_BANK(3, 68, 94),
205 MSM_GPIO_BANK(4, 95, 106),
206 MSM_GPIO_BANK(5, 107, 132),
207#elif defined(CONFIG_ARCH_MSM7X30)
208 MSM_GPIO_BANK(0, 0, 15),
209 MSM_GPIO_BANK(1, 16, 43),
210 MSM_GPIO_BANK(2, 44, 67),
211 MSM_GPIO_BANK(3, 68, 94),
212 MSM_GPIO_BANK(4, 95, 106),
213 MSM_GPIO_BANK(5, 107, 133),
214 MSM_GPIO_BANK(6, 134, 150),
215 MSM_GPIO_BANK(7, 151, 181),
216#elif defined(CONFIG_ARCH_QSD8X50)
217 MSM_GPIO_BANK(0, 0, 15),
218 MSM_GPIO_BANK(1, 16, 42),
219 MSM_GPIO_BANK(2, 43, 67),
220 MSM_GPIO_BANK(3, 68, 94),
221 MSM_GPIO_BANK(4, 95, 103),
222 MSM_GPIO_BANK(5, 104, 121),
223 MSM_GPIO_BANK(6, 122, 152),
224 MSM_GPIO_BANK(7, 153, 164),
225#endif
226};
227
228static void msm_gpio_irq_ack(unsigned int irq)
229{
230 unsigned long irq_flags;
231 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
232 spin_lock_irqsave(&msm_chip->lock, irq_flags);
233 msm_gpio_clear_detect_status(msm_chip,
234 irq - gpio_to_irq(msm_chip->chip.base));
235 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
236}
237
238static void msm_gpio_irq_mask(unsigned int irq)
239{
240 unsigned long irq_flags;
241 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
242 unsigned offset = irq - gpio_to_irq(msm_chip->chip.base);
243
244 spin_lock_irqsave(&msm_chip->lock, irq_flags);
245 /* level triggered interrupts are also latched */
246 if (!(readl(msm_chip->regs.int_edge) & BIT(offset)))
247 msm_gpio_clear_detect_status(msm_chip, offset);
248 msm_chip->int_enable[0] &= ~BIT(offset);
249 writel(msm_chip->int_enable[0], msm_chip->regs.int_en);
250 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
251}
252
253static void msm_gpio_irq_unmask(unsigned int irq)
254{
255 unsigned long irq_flags;
256 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
257 unsigned offset = irq - gpio_to_irq(msm_chip->chip.base);
258
259 spin_lock_irqsave(&msm_chip->lock, irq_flags);
260 /* level triggered interrupts are also latched */
261 if (!(readl(msm_chip->regs.int_edge) & BIT(offset)))
262 msm_gpio_clear_detect_status(msm_chip, offset);
263 msm_chip->int_enable[0] |= BIT(offset);
264 writel(msm_chip->int_enable[0], msm_chip->regs.int_en);
265 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
266}
267
268static int msm_gpio_irq_set_wake(unsigned int irq, unsigned int on)
269{
270 unsigned long irq_flags;
271 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
272 unsigned offset = irq - gpio_to_irq(msm_chip->chip.base);
273
274 spin_lock_irqsave(&msm_chip->lock, irq_flags);
275
276 if (on)
277 msm_chip->int_enable[1] |= BIT(offset);
278 else
279 msm_chip->int_enable[1] &= ~BIT(offset);
280
281 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
282 return 0;
283}
284
285static int msm_gpio_irq_set_type(unsigned int irq, unsigned int flow_type)
286{
287 unsigned long irq_flags;
288 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
289 unsigned offset = irq - gpio_to_irq(msm_chip->chip.base);
290 unsigned val, mask = BIT(offset);
291
292 spin_lock_irqsave(&msm_chip->lock, irq_flags);
293 val = readl(msm_chip->regs.int_edge);
294 if (flow_type & IRQ_TYPE_EDGE_BOTH) {
295 writel(val | mask, msm_chip->regs.int_edge);
296 irq_desc[irq].handle_irq = handle_edge_irq;
297 } else {
298 writel(val & ~mask, msm_chip->regs.int_edge);
299 irq_desc[irq].handle_irq = handle_level_irq;
300 }
301 if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
302 msm_chip->both_edge_detect |= mask;
303 msm_gpio_update_both_edge_detect(msm_chip);
304 } else {
305 msm_chip->both_edge_detect &= ~mask;
306 val = readl(msm_chip->regs.int_pos);
307 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_HIGH))
308 writel(val | mask, msm_chip->regs.int_pos);
309 else
310 writel(val & ~mask, msm_chip->regs.int_pos);
70 } 311 }
312 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
313 return 0;
71} 314}
72EXPORT_SYMBOL(msm_gpios_disable);
73 315
74int msm_gpios_request_enable(const struct msm_gpio *table, int size) 316static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
75{ 317{
76 int rc = msm_gpios_enable(table, size); 318 int i, j, mask;
77 return rc; 319 unsigned val;
320
321 for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
322 struct msm_gpio_chip *msm_chip = &msm_gpio_chips[i];
323 val = readl(msm_chip->regs.int_status);
324 val &= msm_chip->int_enable[0];
325 while (val) {
326 mask = val & -val;
327 j = fls(mask) - 1;
328 /* printk("%s %08x %08x bit %d gpio %d irq %d\n",
329 __func__, v, m, j, msm_chip->chip.start + j,
330 FIRST_GPIO_IRQ + msm_chip->chip.start + j); */
331 val &= ~mask;
332 generic_handle_irq(FIRST_GPIO_IRQ +
333 msm_chip->chip.base + j);
334 }
335 }
336 desc->chip->ack(irq);
78} 337}
79EXPORT_SYMBOL(msm_gpios_request_enable);
80 338
81void msm_gpios_disable_free(const struct msm_gpio *table, int size) 339static struct irq_chip msm_gpio_irq_chip = {
340 .name = "msmgpio",
341 .ack = msm_gpio_irq_ack,
342 .mask = msm_gpio_irq_mask,
343 .unmask = msm_gpio_irq_unmask,
344 .set_wake = msm_gpio_irq_set_wake,
345 .set_type = msm_gpio_irq_set_type,
346};
347
348static int __init msm_init_gpio(void)
82{ 349{
83 msm_gpios_disable(table, size); 350 int i, j = 0;
351
352 for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) {
353 if (i - FIRST_GPIO_IRQ >=
354 msm_gpio_chips[j].chip.base +
355 msm_gpio_chips[j].chip.ngpio)
356 j++;
357 set_irq_chip_data(i, &msm_gpio_chips[j]);
358 set_irq_chip(i, &msm_gpio_irq_chip);
359 set_irq_handler(i, handle_edge_irq);
360 set_irq_flags(i, IRQF_VALID);
361 }
362
363 for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
364 spin_lock_init(&msm_gpio_chips[i].lock);
365 writel(0, msm_gpio_chips[i].regs.int_en);
366 gpiochip_add(&msm_gpio_chips[i].chip);
367 }
368
369 set_irq_chained_handler(INT_GPIO_GROUP1, msm_gpio_irq_handler);
370 set_irq_chained_handler(INT_GPIO_GROUP2, msm_gpio_irq_handler);
371 set_irq_wake(INT_GPIO_GROUP1, 1);
372 set_irq_wake(INT_GPIO_GROUP2, 2);
373 return 0;
84} 374}
85EXPORT_SYMBOL(msm_gpios_disable_free); 375
376postcore_initcall(msm_init_gpio);
diff --git a/arch/arm/mach-msm/gpio_hw.h b/arch/arm/mach-msm/gpio_hw.h
new file mode 100644
index 000000000000..6b5066038baa
--- /dev/null
+++ b/arch/arm/mach-msm/gpio_hw.h
@@ -0,0 +1,278 @@
1/* arch/arm/mach-msm/gpio_hw.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __ARCH_ARM_MACH_MSM_GPIO_HW_H
19#define __ARCH_ARM_MACH_MSM_GPIO_HW_H
20
21#include <mach/msm_iomap.h>
22
23/* see 80-VA736-2 Rev C pp 695-751
24**
25** These are actually the *shadow* gpio registers, since the
26** real ones (which allow full access) are only available to the
27** ARM9 side of the world.
28**
29** Since the _BASE need to be page-aligned when we're mapping them
30** to virtual addresses, adjust for the additional offset in these
31** macros.
32*/
33
34#if defined(CONFIG_ARCH_MSM7X30)
35#define MSM_GPIO1_REG(off) (MSM_GPIO1_BASE + (off))
36#define MSM_GPIO2_REG(off) (MSM_GPIO2_BASE + 0x400 + (off))
37#else
38#define MSM_GPIO1_REG(off) (MSM_GPIO1_BASE + 0x800 + (off))
39#define MSM_GPIO2_REG(off) (MSM_GPIO2_BASE + 0xC00 + (off))
40#endif
41
42#if defined(CONFIG_ARCH_MSM7X00A) || defined(CONFIG_ARCH_MSM7X25) ||\
43 defined(CONFIG_ARCH_MSM7X27)
44
45/* output value */
46#define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */
47#define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 42-16 */
48#define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-43 */
49#define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */
50#define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 106-95 */
51#define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x50) /* gpio 107-121 */
52
53/* same pin map as above, output enable */
54#define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x10)
55#define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08)
56#define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x14)
57#define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x18)
58#define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x1C)
59#define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x54)
60
61/* same pin map as above, input read */
62#define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x34)
63#define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20)
64#define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x38)
65#define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x3C)
66#define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x40)
67#define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x44)
68
69/* same pin map as above, 1=edge 0=level interrup */
70#define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x60)
71#define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50)
72#define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x64)
73#define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x68)
74#define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x6C)
75#define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0xC0)
76
77/* same pin map as above, 1=positive 0=negative */
78#define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x70)
79#define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58)
80#define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x74)
81#define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x78)
82#define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x7C)
83#define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xBC)
84
85/* same pin map as above, interrupt enable */
86#define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0x80)
87#define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60)
88#define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0x84)
89#define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0x88)
90#define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0x8C)
91#define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xB8)
92
93/* same pin map as above, write 1 to clear interrupt */
94#define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0x90)
95#define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68)
96#define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0x94)
97#define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0x98)
98#define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0x9C)
99#define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xB4)
100
101/* same pin map as above, 1=interrupt pending */
102#define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xA0)
103#define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70)
104#define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xA4)
105#define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xA8)
106#define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xAC)
107#define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0xB0)
108
109#endif
110
111#if defined(CONFIG_ARCH_QSD8X50)
112/* output value */
113#define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */
114#define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 42-16 */
115#define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-43 */
116#define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */
117#define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 103-95 */
118#define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x10) /* gpio 121-104 */
119#define MSM_GPIO_OUT_6 MSM_GPIO1_REG(0x14) /* gpio 152-122 */
120#define MSM_GPIO_OUT_7 MSM_GPIO1_REG(0x18) /* gpio 164-153 */
121
122/* same pin map as above, output enable */
123#define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x20)
124#define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08)
125#define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x24)
126#define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x28)
127#define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x2C)
128#define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x30)
129#define MSM_GPIO_OE_6 MSM_GPIO1_REG(0x34)
130#define MSM_GPIO_OE_7 MSM_GPIO1_REG(0x38)
131
132/* same pin map as above, input read */
133#define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x50)
134#define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20)
135#define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x54)
136#define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x58)
137#define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x5C)
138#define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x60)
139#define MSM_GPIO_IN_6 MSM_GPIO1_REG(0x64)
140#define MSM_GPIO_IN_7 MSM_GPIO1_REG(0x68)
141
142/* same pin map as above, 1=edge 0=level interrup */
143#define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x70)
144#define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50)
145#define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x74)
146#define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x78)
147#define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x7C)
148#define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0x80)
149#define MSM_GPIO_INT_EDGE_6 MSM_GPIO1_REG(0x84)
150#define MSM_GPIO_INT_EDGE_7 MSM_GPIO1_REG(0x88)
151
152/* same pin map as above, 1=positive 0=negative */
153#define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x90)
154#define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58)
155#define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x94)
156#define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x98)
157#define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x9C)
158#define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xA0)
159#define MSM_GPIO_INT_POS_6 MSM_GPIO1_REG(0xA4)
160#define MSM_GPIO_INT_POS_7 MSM_GPIO1_REG(0xA8)
161
162/* same pin map as above, interrupt enable */
163#define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0xB0)
164#define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60)
165#define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0xB4)
166#define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0xB8)
167#define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0xBC)
168#define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xC0)
169#define MSM_GPIO_INT_EN_6 MSM_GPIO1_REG(0xC4)
170#define MSM_GPIO_INT_EN_7 MSM_GPIO1_REG(0xC8)
171
172/* same pin map as above, write 1 to clear interrupt */
173#define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0xD0)
174#define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68)
175#define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0xD4)
176#define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0xD8)
177#define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0xDC)
178#define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xE0)
179#define MSM_GPIO_INT_CLEAR_6 MSM_GPIO1_REG(0xE4)
180#define MSM_GPIO_INT_CLEAR_7 MSM_GPIO1_REG(0xE8)
181
182/* same pin map as above, 1=interrupt pending */
183#define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xF0)
184#define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70)
185#define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xF4)
186#define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xF8)
187#define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xFC)
188#define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0x100)
189#define MSM_GPIO_INT_STATUS_6 MSM_GPIO1_REG(0x104)
190#define MSM_GPIO_INT_STATUS_7 MSM_GPIO1_REG(0x108)
191
192#endif
193
194#if defined(CONFIG_ARCH_MSM7X30)
195
196/* output value */
197#define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */
198#define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 43-16 */
199#define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-44 */
200#define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */
201#define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 106-95 */
202#define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x50) /* gpio 133-107 */
203#define MSM_GPIO_OUT_6 MSM_GPIO1_REG(0xC4) /* gpio 150-134 */
204#define MSM_GPIO_OUT_7 MSM_GPIO1_REG(0x214) /* gpio 181-151 */
205
206/* same pin map as above, output enable */
207#define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x10)
208#define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08)
209#define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x14)
210#define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x18)
211#define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x1C)
212#define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x54)
213#define MSM_GPIO_OE_6 MSM_GPIO1_REG(0xC8)
214#define MSM_GPIO_OE_7 MSM_GPIO1_REG(0x218)
215
216/* same pin map as above, input read */
217#define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x34)
218#define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20)
219#define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x38)
220#define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x3C)
221#define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x40)
222#define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x44)
223#define MSM_GPIO_IN_6 MSM_GPIO1_REG(0xCC)
224#define MSM_GPIO_IN_7 MSM_GPIO1_REG(0x21C)
225
226/* same pin map as above, 1=edge 0=level interrup */
227#define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x60)
228#define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50)
229#define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x64)
230#define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x68)
231#define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x6C)
232#define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0xC0)
233#define MSM_GPIO_INT_EDGE_6 MSM_GPIO1_REG(0xD0)
234#define MSM_GPIO_INT_EDGE_7 MSM_GPIO1_REG(0x240)
235
236/* same pin map as above, 1=positive 0=negative */
237#define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x70)
238#define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58)
239#define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x74)
240#define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x78)
241#define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x7C)
242#define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xBC)
243#define MSM_GPIO_INT_POS_6 MSM_GPIO1_REG(0xD4)
244#define MSM_GPIO_INT_POS_7 MSM_GPIO1_REG(0x228)
245
246/* same pin map as above, interrupt enable */
247#define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0x80)
248#define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60)
249#define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0x84)
250#define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0x88)
251#define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0x8C)
252#define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xB8)
253#define MSM_GPIO_INT_EN_6 MSM_GPIO1_REG(0xD8)
254#define MSM_GPIO_INT_EN_7 MSM_GPIO1_REG(0x22C)
255
256/* same pin map as above, write 1 to clear interrupt */
257#define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0x90)
258#define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68)
259#define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0x94)
260#define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0x98)
261#define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0x9C)
262#define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xB4)
263#define MSM_GPIO_INT_CLEAR_6 MSM_GPIO1_REG(0xDC)
264#define MSM_GPIO_INT_CLEAR_7 MSM_GPIO1_REG(0x230)
265
266/* same pin map as above, 1=interrupt pending */
267#define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xA0)
268#define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70)
269#define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xA4)
270#define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xA8)
271#define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xAC)
272#define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0xB0)
273#define MSM_GPIO_INT_STATUS_6 MSM_GPIO1_REG(0xE0)
274#define MSM_GPIO_INT_STATUS_7 MSM_GPIO1_REG(0x234)
275
276#endif
277
278#endif
diff --git a/arch/arm/mach-msm/gpiomux-7x30.c b/arch/arm/mach-msm/gpiomux-7x30.c
new file mode 100644
index 000000000000..6ce41c5241a5
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux-7x30.c
@@ -0,0 +1,38 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#include "gpiomux.h"
18
19struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
20#ifdef CONFIG_SERIAL_MSM_CONSOLE
21 [49] = { /* UART2 RFR */
22 .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
23 GPIOMUX_FUNC_2 | GPIOMUX_VALID,
24 },
25 [50] = { /* UART2 CTS */
26 .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
27 GPIOMUX_FUNC_2 | GPIOMUX_VALID,
28 },
29 [51] = { /* UART2 RX */
30 .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
31 GPIOMUX_FUNC_2 | GPIOMUX_VALID,
32 },
33 [52] = { /* UART2 TX */
34 .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
35 GPIOMUX_FUNC_2 | GPIOMUX_VALID,
36 },
37#endif
38};
diff --git a/arch/arm/mach-msm/gpiomux-8x50.c b/arch/arm/mach-msm/gpiomux-8x50.c
new file mode 100644
index 000000000000..4406e0f4ae95
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux-8x50.c
@@ -0,0 +1,28 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#include "gpiomux.h"
18
19struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
20 [86] = { /* UART3 RX */
21 .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
22 GPIOMUX_FUNC_1 | GPIOMUX_VALID,
23 },
24 [87] = { /* UART3 TX */
25 .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
26 GPIOMUX_FUNC_1 | GPIOMUX_VALID,
27 },
28};
diff --git a/arch/arm/mach-msm/gpiomux-8x60.c b/arch/arm/mach-msm/gpiomux-8x60.c
new file mode 100644
index 000000000000..7b380b31bd0e
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux-8x60.c
@@ -0,0 +1,19 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#include "gpiomux.h"
18
19struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {};
diff --git a/arch/arm/mach-msm/gpiomux-v1.c b/arch/arm/mach-msm/gpiomux-v1.c
new file mode 100644
index 000000000000..27de2abd7144
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux-v1.c
@@ -0,0 +1,33 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#include <linux/kernel.h>
18#include "gpiomux.h"
19#include "proc_comm.h"
20
21void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)
22{
23 unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) |
24 ((gpio & 0x3ff) << 4);
25 unsigned tlmm_disable = 0;
26 int rc;
27
28 rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX,
29 &tlmm_config, &tlmm_disable);
30 if (rc)
31 pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n",
32 __func__, rc, tlmm_config, tlmm_disable);
33}
diff --git a/arch/arm/mach-msm/gpiomux-v1.h b/arch/arm/mach-msm/gpiomux-v1.h
new file mode 100644
index 000000000000..71d86feba450
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux-v1.h
@@ -0,0 +1,67 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_V1_H
18#define __ARCH_ARM_MACH_MSM_GPIOMUX_V1_H
19
20#if defined(CONFIG_ARCH_MSM7X30)
21#define GPIOMUX_NGPIOS 182
22#elif defined(CONFIG_ARCH_QSD8X50)
23#define GPIOMUX_NGPIOS 165
24#else
25#define GPIOMUX_NGPIOS 133
26#endif
27
28typedef u32 gpiomux_config_t;
29
30enum {
31 GPIOMUX_DRV_2MA = 0UL << 17,
32 GPIOMUX_DRV_4MA = 1UL << 17,
33 GPIOMUX_DRV_6MA = 2UL << 17,
34 GPIOMUX_DRV_8MA = 3UL << 17,
35 GPIOMUX_DRV_10MA = 4UL << 17,
36 GPIOMUX_DRV_12MA = 5UL << 17,
37 GPIOMUX_DRV_14MA = 6UL << 17,
38 GPIOMUX_DRV_16MA = 7UL << 17,
39};
40
41enum {
42 GPIOMUX_FUNC_GPIO = 0UL,
43 GPIOMUX_FUNC_1 = 1UL,
44 GPIOMUX_FUNC_2 = 2UL,
45 GPIOMUX_FUNC_3 = 3UL,
46 GPIOMUX_FUNC_4 = 4UL,
47 GPIOMUX_FUNC_5 = 5UL,
48 GPIOMUX_FUNC_6 = 6UL,
49 GPIOMUX_FUNC_7 = 7UL,
50 GPIOMUX_FUNC_8 = 8UL,
51 GPIOMUX_FUNC_9 = 9UL,
52 GPIOMUX_FUNC_A = 10UL,
53 GPIOMUX_FUNC_B = 11UL,
54 GPIOMUX_FUNC_C = 12UL,
55 GPIOMUX_FUNC_D = 13UL,
56 GPIOMUX_FUNC_E = 14UL,
57 GPIOMUX_FUNC_F = 15UL,
58};
59
60enum {
61 GPIOMUX_PULL_NONE = 0UL << 15,
62 GPIOMUX_PULL_DOWN = 1UL << 15,
63 GPIOMUX_PULL_KEEPER = 2UL << 15,
64 GPIOMUX_PULL_UP = 3UL << 15,
65};
66
67#endif
diff --git a/arch/arm/mach-msm/gpiomux-v2.c b/arch/arm/mach-msm/gpiomux-v2.c
new file mode 100644
index 000000000000..273396d2b127
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux-v2.c
@@ -0,0 +1,25 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#include <linux/io.h>
18#include <mach/msm_iomap.h>
19#include "gpiomux.h"
20
21void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)
22{
23 writel(val & ~GPIOMUX_CTL_MASK,
24 MSM_TLMM_BASE + 0x1000 + (0x10 * gpio));
25}
diff --git a/arch/arm/mach-msm/gpiomux-v2.h b/arch/arm/mach-msm/gpiomux-v2.h
new file mode 100644
index 000000000000..3bf10e7f0381
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux-v2.h
@@ -0,0 +1,61 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_V2_H
18#define __ARCH_ARM_MACH_MSM_GPIOMUX_V2_H
19
20#define GPIOMUX_NGPIOS 173
21
22typedef u16 gpiomux_config_t;
23
24enum {
25 GPIOMUX_DRV_2MA = 0UL << 6,
26 GPIOMUX_DRV_4MA = 1UL << 6,
27 GPIOMUX_DRV_6MA = 2UL << 6,
28 GPIOMUX_DRV_8MA = 3UL << 6,
29 GPIOMUX_DRV_10MA = 4UL << 6,
30 GPIOMUX_DRV_12MA = 5UL << 6,
31 GPIOMUX_DRV_14MA = 6UL << 6,
32 GPIOMUX_DRV_16MA = 7UL << 6,
33};
34
35enum {
36 GPIOMUX_FUNC_GPIO = 0UL << 2,
37 GPIOMUX_FUNC_1 = 1UL << 2,
38 GPIOMUX_FUNC_2 = 2UL << 2,
39 GPIOMUX_FUNC_3 = 3UL << 2,
40 GPIOMUX_FUNC_4 = 4UL << 2,
41 GPIOMUX_FUNC_5 = 5UL << 2,
42 GPIOMUX_FUNC_6 = 6UL << 2,
43 GPIOMUX_FUNC_7 = 7UL << 2,
44 GPIOMUX_FUNC_8 = 8UL << 2,
45 GPIOMUX_FUNC_9 = 9UL << 2,
46 GPIOMUX_FUNC_A = 10UL << 2,
47 GPIOMUX_FUNC_B = 11UL << 2,
48 GPIOMUX_FUNC_C = 12UL << 2,
49 GPIOMUX_FUNC_D = 13UL << 2,
50 GPIOMUX_FUNC_E = 14UL << 2,
51 GPIOMUX_FUNC_F = 15UL << 2,
52};
53
54enum {
55 GPIOMUX_PULL_NONE = 0UL,
56 GPIOMUX_PULL_DOWN = 1UL,
57 GPIOMUX_PULL_KEEPER = 2UL,
58 GPIOMUX_PULL_UP = 3UL,
59};
60
61#endif
diff --git a/arch/arm/mach-msm/gpiomux.c b/arch/arm/mach-msm/gpiomux.c
new file mode 100644
index 000000000000..53af21abd155
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux.c
@@ -0,0 +1,96 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#include <linux/module.h>
18#include <linux/spinlock.h>
19#include "gpiomux.h"
20
21static DEFINE_SPINLOCK(gpiomux_lock);
22
23int msm_gpiomux_write(unsigned gpio,
24 gpiomux_config_t active,
25 gpiomux_config_t suspended)
26{
27 struct msm_gpiomux_config *cfg = msm_gpiomux_configs + gpio;
28 unsigned long irq_flags;
29 gpiomux_config_t setting;
30
31 if (gpio >= GPIOMUX_NGPIOS)
32 return -EINVAL;
33
34 spin_lock_irqsave(&gpiomux_lock, irq_flags);
35
36 if (active & GPIOMUX_VALID)
37 cfg->active = active;
38
39 if (suspended & GPIOMUX_VALID)
40 cfg->suspended = suspended;
41
42 setting = cfg->ref ? active : suspended;
43 if (setting & GPIOMUX_VALID)
44 __msm_gpiomux_write(gpio, setting);
45
46 spin_unlock_irqrestore(&gpiomux_lock, irq_flags);
47 return 0;
48}
49EXPORT_SYMBOL(msm_gpiomux_write);
50
51int msm_gpiomux_get(unsigned gpio)
52{
53 struct msm_gpiomux_config *cfg = msm_gpiomux_configs + gpio;
54 unsigned long irq_flags;
55
56 if (gpio >= GPIOMUX_NGPIOS)
57 return -EINVAL;
58
59 spin_lock_irqsave(&gpiomux_lock, irq_flags);
60 if (cfg->ref++ == 0 && cfg->active & GPIOMUX_VALID)
61 __msm_gpiomux_write(gpio, cfg->active);
62 spin_unlock_irqrestore(&gpiomux_lock, irq_flags);
63 return 0;
64}
65EXPORT_SYMBOL(msm_gpiomux_get);
66
67int msm_gpiomux_put(unsigned gpio)
68{
69 struct msm_gpiomux_config *cfg = msm_gpiomux_configs + gpio;
70 unsigned long irq_flags;
71
72 if (gpio >= GPIOMUX_NGPIOS)
73 return -EINVAL;
74
75 spin_lock_irqsave(&gpiomux_lock, irq_flags);
76 BUG_ON(cfg->ref == 0);
77 if (--cfg->ref == 0 && cfg->suspended & GPIOMUX_VALID)
78 __msm_gpiomux_write(gpio, cfg->suspended);
79 spin_unlock_irqrestore(&gpiomux_lock, irq_flags);
80 return 0;
81}
82EXPORT_SYMBOL(msm_gpiomux_put);
83
84static int __init gpiomux_init(void)
85{
86 unsigned n;
87
88 for (n = 0; n < GPIOMUX_NGPIOS; ++n) {
89 msm_gpiomux_configs[n].ref = 0;
90 if (!(msm_gpiomux_configs[n].suspended & GPIOMUX_VALID))
91 continue;
92 __msm_gpiomux_write(n, msm_gpiomux_configs[n].suspended);
93 }
94 return 0;
95}
96postcore_initcall(gpiomux_init);
diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h
new file mode 100644
index 000000000000..b178d9cb742f
--- /dev/null
+++ b/arch/arm/mach-msm/gpiomux.h
@@ -0,0 +1,114 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_H
18#define __ARCH_ARM_MACH_MSM_GPIOMUX_H
19
20#include <linux/bitops.h>
21#include <linux/errno.h>
22
23#if defined(CONFIG_MSM_V2_TLMM)
24#include "gpiomux-v2.h"
25#else
26#include "gpiomux-v1.h"
27#endif
28
29/**
30 * struct msm_gpiomux_config: gpiomux settings for one gpio line.
31 *
32 * A complete gpiomux config is the bitwise-or of a drive-strength,
33 * function, and pull. For functions other than GPIO, the OE
34 * is hard-wired according to the function. For GPIO mode,
35 * OE is controlled by gpiolib.
36 *
37 * Available settings differ by target; see the gpiomux header
38 * specific to your target arch for available configurations.
39 *
40 * @active: The configuration to be installed when the line is
41 * active, or its reference count is > 0.
42 * @suspended: The configuration to be installed when the line
43 * is suspended, or its reference count is 0.
44 * @ref: The reference count of the line. For internal use of
45 * the gpiomux framework only.
46 */
47struct msm_gpiomux_config {
48 gpiomux_config_t active;
49 gpiomux_config_t suspended;
50 unsigned ref;
51};
52
53/**
54 * @GPIOMUX_VALID: If set, the config field contains 'good data'.
55 * The absence of this bit will prevent the gpiomux
56 * system from applying the configuration under all
57 * circumstances.
58 */
59enum {
60 GPIOMUX_VALID = BIT(sizeof(gpiomux_config_t) * BITS_PER_BYTE - 1),
61 GPIOMUX_CTL_MASK = GPIOMUX_VALID,
62};
63
64#ifdef CONFIG_MSM_GPIOMUX
65
66/* Each architecture must provide its own instance of this table.
67 * To avoid having gpiomux manage any given gpio, one or both of
68 * the entries can avoid setting GPIOMUX_VALID - the absence
69 * of that flag will prevent the configuration from being applied
70 * during state transitions.
71 */
72extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
73
74/* Increment a gpio's reference count, possibly activating the line. */
75int __must_check msm_gpiomux_get(unsigned gpio);
76
77/* Decrement a gpio's reference count, possibly suspending the line. */
78int msm_gpiomux_put(unsigned gpio);
79
80/* Install a new configuration to the gpio line. To avoid overwriting
81 * a configuration, leave the VALID bit out.
82 */
83int msm_gpiomux_write(unsigned gpio,
84 gpiomux_config_t active,
85 gpiomux_config_t suspended);
86
87/* Architecture-internal function for use by the framework only.
88 * This function can assume the following:
89 * - the gpio value has passed a bounds-check
90 * - the gpiomux spinlock has been obtained
91 *
92 * This function is not for public consumption. External users
93 * should use msm_gpiomux_write.
94 */
95void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val);
96#else
97static inline int __must_check msm_gpiomux_get(unsigned gpio)
98{
99 return -ENOSYS;
100}
101
102static inline int msm_gpiomux_put(unsigned gpio)
103{
104 return -ENOSYS;
105}
106
107static inline int msm_gpiomux_write(unsigned gpio,
108 gpiomux_config_t active,
109 gpiomux_config_t suspended)
110{
111 return -ENOSYS;
112}
113#endif
114#endif
diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h
index 5a79bcf50413..6abf4a6eadc1 100644
--- a/arch/arm/mach-msm/include/mach/board.h
+++ b/arch/arm/mach-msm/include/mach/board.h
@@ -33,6 +33,8 @@ struct msm_acpu_clock_platform_data
33 33
34struct clk; 34struct clk;
35 35
36extern struct sys_timer msm_timer;
37
36/* common init routines for use by arch/arm/mach-msm/board-*.c */ 38/* common init routines for use by arch/arm/mach-msm/board-*.c */
37 39
38void __init msm_add_devices(void); 40void __init msm_add_devices(void);
diff --git a/arch/arm/mach-msm/include/mach/debug-macro.S b/arch/arm/mach-msm/include/mach/debug-macro.S
index 528750f307e9..238c4f132cdb 100644
--- a/arch/arm/mach-msm/include/mach/debug-macro.S
+++ b/arch/arm/mach-msm/include/mach/debug-macro.S
@@ -19,7 +19,7 @@
19#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <mach/msm_iomap.h> 20#include <mach/msm_iomap.h>
21 21
22#ifdef CONFIG_MSM_DEBUG_UART 22#ifdef CONFIG_HAS_MSM_DEBUG_UART_PHYS
23 .macro addruart, rx, tmp 23 .macro addruart, rx, tmp
24 @ see if the MMU is enabled and select appropriate base address 24 @ see if the MMU is enabled and select appropriate base address
25 mrc p15, 0, \rx, c1, c0 25 mrc p15, 0, \rx, c1, c0
diff --git a/arch/arm/mach-msm/include/mach/dma.h b/arch/arm/mach-msm/include/mach/dma.h
index 00f9bbfadbe6..05583f569524 100644
--- a/arch/arm/mach-msm/include/mach/dma.h
+++ b/arch/arm/mach-msm/include/mach/dma.h
@@ -32,10 +32,18 @@ struct msm_dmov_cmd {
32 void *data; 32 void *data;
33}; 33};
34 34
35#ifndef CONFIG_ARCH_MSM8X60
35void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd); 36void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd);
36void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful); 37void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful);
37int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr); 38int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr);
38 39#else
40static inline
41void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd) { }
42static inline
43void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful) { }
44static inline
45int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr) { return -EIO; }
46#endif
39 47
40 48
41#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2)) 49#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
diff --git a/arch/arm/mach-msm/include/mach/entry-macro-qgic.S b/arch/arm/mach-msm/include/mach/entry-macro-qgic.S
new file mode 100644
index 000000000000..4dc99aa65d07
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/entry-macro-qgic.S
@@ -0,0 +1,88 @@
1/*
2 * Low-level IRQ helper macros
3 *
4 * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
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 <mach/hardware.h>
12#include <asm/hardware/gic.h>
13
14 .macro disable_fiq
15 .endm
16
17 .macro get_irqnr_preamble, base, tmp
18 ldr \base, =gic_cpu_base_addr
19 ldr \base, [\base]
20 .endm
21
22 .macro arch_ret_to_user, tmp1, tmp2
23 .endm
24
25 /*
26 * The interrupt numbering scheme is defined in the
27 * interrupt controller spec. To wit:
28 *
29 * Migrated the code from ARM MP port to be more consistant
30 * with interrupt processing , the following still holds true
31 * however, all interrupts are treated the same regardless of
32 * if they are local IPI or PPI
33 *
34 * Interrupts 0-15 are IPI
35 * 16-31 are PPI
36 * (16-18 are the timers)
37 * 32-1020 are global
38 * 1021-1022 are reserved
39 * 1023 is "spurious" (no interrupt)
40 *
41 * A simple read from the controller will tell us the number of the
42 * highest priority enabled interrupt. We then just need to check
43 * whether it is in the valid range for an IRQ (0-1020 inclusive).
44 *
45 * Base ARM code assumes that the local (private) peripheral interrupts
46 * are not valid, we treat them differently, in that the privates are
47 * handled like normal shared interrupts with the exception that only
48 * one processor can register the interrupt and the handler must be
49 * the same for all processors.
50 */
51
52 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
53
54 ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 =srcCPU,
55 9-0 =int # */
56
57 bic \irqnr, \irqstat, #0x1c00 @mask src
58 cmp \irqnr, #15
59 ldr \tmp, =1021
60 cmpcc \irqnr, \irqnr
61 cmpne \irqnr, \tmp
62 cmpcs \irqnr, \irqnr
63
64 .endm
65
66 /* We assume that irqstat (the raw value of the IRQ acknowledge
67 * register) is preserved from the macro above.
68 * If there is an IPI, we immediately signal end of interrupt on the
69 * controller, since this requires the original irqstat value which
70 * we won't easily be able to recreate later.
71 */
72 .macro test_for_ipi, irqnr, irqstat, base, tmp
73 bic \irqnr, \irqstat, #0x1c00
74 cmp \irqnr, #16
75 strcc \irqstat, [\base, #GIC_CPU_EOI]
76 cmpcs \irqnr, \irqnr
77 .endm
78
79 /* As above, this assumes that irqstat and base are preserved.. */
80
81 .macro test_for_ltirq, irqnr, irqstat, base, tmp
82 bic \irqnr, \irqstat, #0x1c00
83 mov \tmp, #0
84 cmp \irqnr, #16
85 moveq \tmp, #1
86 streq \irqstat, [\base, #GIC_CPU_EOI]
87 cmp \tmp, #0
88 .endm
diff --git a/arch/arm/mach-msm/include/mach/entry-macro-vic.S b/arch/arm/mach-msm/include/mach/entry-macro-vic.S
new file mode 100644
index 000000000000..70563ed11b36
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/entry-macro-vic.S
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Author: Brian Swetland <swetland@google.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <mach/msm_iomap.h>
17
18 .macro disable_fiq
19 .endm
20
21 .macro get_irqnr_preamble, base, tmp
22 @ enable imprecise aborts
23 cpsie a
24 mov \base, #MSM_VIC_BASE
25 .endm
26
27 .macro arch_ret_to_user, tmp1, tmp2
28 .endm
29
30 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
31 @ 0xD0 has irq# or old irq# if the irq has been handled
32 @ 0xD4 has irq# or -1 if none pending *but* if you just
33 @ read 0xD4 you never get the first irq for some reason
34 ldr \irqnr, [\base, #0xD0]
35 ldr \irqnr, [\base, #0xD4]
36 cmp \irqnr, #0xffffffff
37 .endm
diff --git a/arch/arm/mach-msm/include/mach/entry-macro.S b/arch/arm/mach-msm/include/mach/entry-macro.S
index d2259486bcb1..b16f082eeb6f 100644
--- a/arch/arm/mach-msm/include/mach/entry-macro.S
+++ b/arch/arm/mach-msm/include/mach/entry-macro.S
@@ -1,38 +1,23 @@
1/* arch/arm/mach-msm7200/include/mach/entry-macro.S 1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 * 2 *
3 * Copyright (C) 2007 Google, Inc. 3 * This program is free software; you can redistribute it and/or modify
4 * Author: Brian Swetland <swetland@google.com> 4 * it under the terms of the GNU General Public License version 2 and
5 * 5 * only version 2 as published by the Free Software Foundation.
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 * 6 *
10 * This program is distributed in the hope that it will be useful, 7 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 10 * GNU General Public License for more details.
14 * 11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 *
15 */ 17 */
16 18
17#include <mach/msm_iomap.h> 19#if defined(CONFIG_ARM_GIC)
18 20#include <mach/entry-macro-qgic.S>
19 .macro disable_fiq 21#else
20 .endm 22#include <mach/entry-macro-vic.S>
21 23#endif
22 .macro get_irqnr_preamble, base, tmp
23 @ enable imprecise aborts
24 cpsie a
25 mov \base, #MSM_VIC_BASE
26 .endm
27
28 .macro arch_ret_to_user, tmp1, tmp2
29 .endm
30
31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
32 @ 0xD0 has irq# or old irq# if the irq has been handled
33 @ 0xD4 has irq# or -1 if none pending *but* if you just
34 @ read 0xD4 you never get the first irq for some reason
35 ldr \irqnr, [\base, #0xD0]
36 ldr \irqnr, [\base, #0xD4]
37 cmp \irqnr, #0xffffffff
38 .endm
diff --git a/arch/arm/mach-msm/include/mach/gpio.h b/arch/arm/mach-msm/include/mach/gpio.h
index 83e47c0d5c2e..36ad50d3bfaa 100644
--- a/arch/arm/mach-msm/include/mach/gpio.h
+++ b/arch/arm/mach-msm/include/mach/gpio.h
@@ -23,127 +23,4 @@
23#define gpio_cansleep __gpio_cansleep 23#define gpio_cansleep __gpio_cansleep
24#define gpio_to_irq __gpio_to_irq 24#define gpio_to_irq __gpio_to_irq
25 25
26/**
27 * struct msm_gpio - GPIO pin description
28 * @gpio_cfg - configuration bitmap, as per gpio_tlmm_config()
29 * @label - textual label
30 *
31 * Usually, GPIO's are operated by sets.
32 * This struct accumulate all GPIO information in single source
33 * and facilitete group operations provided by msm_gpios_xxx()
34 */
35struct msm_gpio {
36 u32 gpio_cfg;
37 const char *label;
38};
39
40/**
41 * msm_gpios_request_enable() - request and enable set of GPIOs
42 *
43 * Request and configure set of GPIO's
44 * In case of error, all operations rolled back.
45 * Return error code.
46 *
47 * @table: GPIO table
48 * @size: number of entries in @table
49 */
50int msm_gpios_request_enable(const struct msm_gpio *table, int size);
51
52/**
53 * msm_gpios_disable_free() - disable and free set of GPIOs
54 *
55 * @table: GPIO table
56 * @size: number of entries in @table
57 */
58void msm_gpios_disable_free(const struct msm_gpio *table, int size);
59
60/**
61 * msm_gpios_request() - request set of GPIOs
62 * In case of error, all operations rolled back.
63 * Return error code.
64 *
65 * @table: GPIO table
66 * @size: number of entries in @table
67 */
68int msm_gpios_request(const struct msm_gpio *table, int size);
69
70/**
71 * msm_gpios_free() - free set of GPIOs
72 *
73 * @table: GPIO table
74 * @size: number of entries in @table
75 */
76void msm_gpios_free(const struct msm_gpio *table, int size);
77
78/**
79 * msm_gpios_enable() - enable set of GPIOs
80 * In case of error, all operations rolled back.
81 * Return error code.
82 *
83 * @table: GPIO table
84 * @size: number of entries in @table
85 */
86int msm_gpios_enable(const struct msm_gpio *table, int size);
87
88/**
89 * msm_gpios_disable() - disable set of GPIOs
90 *
91 * @table: GPIO table
92 * @size: number of entries in @table
93 */
94void msm_gpios_disable(const struct msm_gpio *table, int size);
95
96/* GPIO TLMM (Top Level Multiplexing) Definitions */
97
98/* GPIO TLMM: Function -- GPIO specific */
99
100/* GPIO TLMM: Direction */
101enum {
102 GPIO_INPUT,
103 GPIO_OUTPUT,
104};
105
106/* GPIO TLMM: Pullup/Pulldown */
107enum {
108 GPIO_NO_PULL,
109 GPIO_PULL_DOWN,
110 GPIO_KEEPER,
111 GPIO_PULL_UP,
112};
113
114/* GPIO TLMM: Drive Strength */
115enum {
116 GPIO_2MA,
117 GPIO_4MA,
118 GPIO_6MA,
119 GPIO_8MA,
120 GPIO_10MA,
121 GPIO_12MA,
122 GPIO_14MA,
123 GPIO_16MA,
124};
125
126enum {
127 GPIO_ENABLE,
128 GPIO_DISABLE,
129};
130
131#define GPIO_CFG(gpio, func, dir, pull, drvstr) \
132 ((((gpio) & 0x3FF) << 4) | \
133 ((func) & 0xf) | \
134 (((dir) & 0x1) << 14) | \
135 (((pull) & 0x3) << 15) | \
136 (((drvstr) & 0xF) << 17))
137
138/**
139 * extract GPIO pin from bit-field used for gpio_tlmm_config
140 */
141#define GPIO_PIN(gpio_cfg) (((gpio_cfg) >> 4) & 0x3ff)
142#define GPIO_FUNC(gpio_cfg) (((gpio_cfg) >> 0) & 0xf)
143#define GPIO_DIR(gpio_cfg) (((gpio_cfg) >> 14) & 0x1)
144#define GPIO_PULL(gpio_cfg) (((gpio_cfg) >> 15) & 0x3)
145#define GPIO_DRVSTR(gpio_cfg) (((gpio_cfg) >> 17) & 0xf)
146
147int gpio_tlmm_config(unsigned config, unsigned disable);
148
149#endif /* __ASM_ARCH_MSM_GPIO_H */ 26#endif /* __ASM_ARCH_MSM_GPIO_H */
diff --git a/arch/arm/mach-msm/include/mach/io.h b/arch/arm/mach-msm/include/mach/io.h
index c35b29f9ac0f..7386e732baad 100644
--- a/arch/arm/mach-msm/include/mach/io.h
+++ b/arch/arm/mach-msm/include/mach/io.h
@@ -28,6 +28,7 @@ void __iomem *__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int m
28 28
29void msm_map_qsd8x50_io(void); 29void msm_map_qsd8x50_io(void);
30void msm_map_msm7x30_io(void); 30void msm_map_msm7x30_io(void);
31void msm_map_msm8x60_io(void);
31 32
32extern unsigned int msm_shared_ram_phys; 33extern unsigned int msm_shared_ram_phys;
33 34
diff --git a/arch/arm/mach-msm/include/mach/iommu.h b/arch/arm/mach-msm/include/mach/iommu.h
new file mode 100644
index 000000000000..218ef5732a24
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/iommu.h
@@ -0,0 +1,103 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#ifndef MSM_IOMMU_H
19#define MSM_IOMMU_H
20
21#include <linux/interrupt.h>
22
23/* Maximum number of Machine IDs that we are allowing to be mapped to the same
24 * context bank. The number of MIDs mapped to the same CB does not affect
25 * performance, but there is a practical limit on how many distinct MIDs may
26 * be present. These mappings are typically determined at design time and are
27 * not expected to change at run time.
28 */
29#define MAX_NUM_MIDS 16
30
31/**
32 * struct msm_iommu_dev - a single IOMMU hardware instance
33 * name Human-readable name given to this IOMMU HW instance
34 * clk_rate Rate to set for this IOMMU's clock, if applicable to this
35 * particular IOMMU. 0 means don't set a rate.
36 * -1 means it is an AXI clock with no valid rate
37 *
38 */
39struct msm_iommu_dev {
40 const char *name;
41 int clk_rate;
42};
43
44/**
45 * struct msm_iommu_ctx_dev - an IOMMU context bank instance
46 * name Human-readable name given to this context bank
47 * num Index of this context bank within the hardware
48 * mids List of Machine IDs that are to be mapped into this context
49 * bank, terminated by -1. The MID is a set of signals on the
50 * AXI bus that identifies the function associated with a specific
51 * memory request. (See ARM spec).
52 */
53struct msm_iommu_ctx_dev {
54 const char *name;
55 int num;
56 int mids[MAX_NUM_MIDS];
57};
58
59
60/**
61 * struct msm_iommu_drvdata - A single IOMMU hardware instance
62 * @base: IOMMU config port base address (VA)
63 * @irq: Interrupt number
64 *
65 * A msm_iommu_drvdata holds the global driver data about a single piece
66 * of an IOMMU hardware instance.
67 */
68struct msm_iommu_drvdata {
69 void __iomem *base;
70 int irq;
71};
72
73/**
74 * struct msm_iommu_ctx_drvdata - an IOMMU context bank instance
75 * @num: Hardware context number of this context
76 * @pdev: Platform device associated wit this HW instance
77 * @attached_elm: List element for domains to track which devices are
78 * attached to them
79 *
80 * A msm_iommu_ctx_drvdata holds the driver data for a single context bank
81 * within each IOMMU hardware instance
82 */
83struct msm_iommu_ctx_drvdata {
84 int num;
85 struct platform_device *pdev;
86 struct list_head attached_elm;
87};
88
89/*
90 * Look up an IOMMU context device by its context name. NULL if none found.
91 * Useful for testing and drivers that do not yet fully have IOMMU stuff in
92 * their platform devices.
93 */
94struct device *msm_iommu_get_ctx(const char *ctx_name);
95
96/*
97 * Interrupt handler for the IOMMU context fault interrupt. Hooking the
98 * interrupt is not supported in the API yet, but this will print an error
99 * message and dump useful IOMMU registers.
100 */
101irqreturn_t msm_iommu_fault_handler(int irq, void *dev_id);
102
103#endif
diff --git a/arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h b/arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h
new file mode 100644
index 000000000000..f9386d3a2f77
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h
@@ -0,0 +1,1871 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#ifndef __ARCH_ARM_MACH_MSM_IOMMU_HW_8XXX_H
19#define __ARCH_ARM_MACH_MSM_IOMMU_HW_8XXX_H
20
21#define CTX_SHIFT 12
22
23#define GET_GLOBAL_REG(reg, base) (readl((base) + (reg)))
24#define GET_CTX_REG(reg, base, ctx) \
25 (readl((base) + (reg) + ((ctx) << CTX_SHIFT)))
26
27#define SET_GLOBAL_REG(reg, base, val) writel((val), ((base) + (reg)))
28
29#define SET_CTX_REG(reg, base, ctx, val) \
30 writel((val), ((base) + (reg) + ((ctx) << CTX_SHIFT)))
31
32/* Wrappers for numbered registers */
33#define SET_GLOBAL_REG_N(b, n, r, v) SET_GLOBAL_REG(b, ((r) + (n << 2)), (v))
34#define GET_GLOBAL_REG_N(b, n, r) GET_GLOBAL_REG(b, ((r) + (n << 2)))
35
36/* Field wrappers */
37#define GET_GLOBAL_FIELD(b, r, F) GET_FIELD(((b) + (r)), F##_MASK, F##_SHIFT)
38#define GET_CONTEXT_FIELD(b, c, r, F) \
39 GET_FIELD(((b) + (r) + ((c) << CTX_SHIFT)), F##_MASK, F##_SHIFT)
40
41#define SET_GLOBAL_FIELD(b, r, F, v) \
42 SET_FIELD(((b) + (r)), F##_MASK, F##_SHIFT, (v))
43#define SET_CONTEXT_FIELD(b, c, r, F, v) \
44 SET_FIELD(((b) + (r) + ((c) << CTX_SHIFT)), F##_MASK, F##_SHIFT, (v))
45
46#define GET_FIELD(addr, mask, shift) ((readl(addr) >> (shift)) & (mask))
47
48#define SET_FIELD(addr, mask, shift, v) \
49do { \
50 int t = readl(addr); \
51 writel((t & ~((mask) << (shift))) + (((v) & (mask)) << (shift)), addr);\
52} while (0)
53
54
55#define NUM_FL_PTE 4096
56#define NUM_SL_PTE 256
57
58/* First-level page table bits */
59#define FL_BASE_MASK 0xFFFFFC00
60#define FL_TYPE_TABLE (1 << 0)
61#define FL_TYPE_SECT (2 << 0)
62#define FL_SUPERSECTION (1 << 18)
63#define FL_AP_WRITE (1 << 10)
64#define FL_AP_READ (1 << 11)
65#define FL_SHARED (1 << 16)
66#define FL_OFFSET(va) (((va) & 0xFFF00000) >> 20)
67
68/* Second-level page table bits */
69#define SL_BASE_MASK_LARGE 0xFFFF0000
70#define SL_BASE_MASK_SMALL 0xFFFFF000
71#define SL_TYPE_LARGE (1 << 0)
72#define SL_TYPE_SMALL (2 << 0)
73#define SL_AP0 (1 << 4)
74#define SL_AP1 (2 << 4)
75#define SL_SHARED (1 << 10)
76#define SL_OFFSET(va) (((va) & 0xFF000) >> 12)
77
78/* Global register setters / getters */
79#define SET_M2VCBR_N(b, N, v) SET_GLOBAL_REG_N(M2VCBR_N, N, (b), (v))
80#define SET_CBACR_N(b, N, v) SET_GLOBAL_REG_N(CBACR_N, N, (b), (v))
81#define SET_TLBRSW(b, v) SET_GLOBAL_REG(TLBRSW, (b), (v))
82#define SET_TLBTR0(b, v) SET_GLOBAL_REG(TLBTR0, (b), (v))
83#define SET_TLBTR1(b, v) SET_GLOBAL_REG(TLBTR1, (b), (v))
84#define SET_TLBTR2(b, v) SET_GLOBAL_REG(TLBTR2, (b), (v))
85#define SET_TESTBUSCR(b, v) SET_GLOBAL_REG(TESTBUSCR, (b), (v))
86#define SET_GLOBAL_TLBIALL(b, v) SET_GLOBAL_REG(GLOBAL_TLBIALL, (b), (v))
87#define SET_TLBIVMID(b, v) SET_GLOBAL_REG(TLBIVMID, (b), (v))
88#define SET_CR(b, v) SET_GLOBAL_REG(CR, (b), (v))
89#define SET_EAR(b, v) SET_GLOBAL_REG(EAR, (b), (v))
90#define SET_ESR(b, v) SET_GLOBAL_REG(ESR, (b), (v))
91#define SET_ESRRESTORE(b, v) SET_GLOBAL_REG(ESRRESTORE, (b), (v))
92#define SET_ESYNR0(b, v) SET_GLOBAL_REG(ESYNR0, (b), (v))
93#define SET_ESYNR1(b, v) SET_GLOBAL_REG(ESYNR1, (b), (v))
94#define SET_RPU_ACR(b, v) SET_GLOBAL_REG(RPU_ACR, (b), (v))
95
96#define GET_M2VCBR_N(b, N) GET_GLOBAL_REG_N(M2VCBR_N, N, (b))
97#define GET_CBACR_N(b, N) GET_GLOBAL_REG_N(CBACR_N, N, (b))
98#define GET_TLBTR0(b) GET_GLOBAL_REG(TLBTR0, (b))
99#define GET_TLBTR1(b) GET_GLOBAL_REG(TLBTR1, (b))
100#define GET_TLBTR2(b) GET_GLOBAL_REG(TLBTR2, (b))
101#define GET_TESTBUSCR(b) GET_GLOBAL_REG(TESTBUSCR, (b))
102#define GET_GLOBAL_TLBIALL(b) GET_GLOBAL_REG(GLOBAL_TLBIALL, (b))
103#define GET_TLBIVMID(b) GET_GLOBAL_REG(TLBIVMID, (b))
104#define GET_CR(b) GET_GLOBAL_REG(CR, (b))
105#define GET_EAR(b) GET_GLOBAL_REG(EAR, (b))
106#define GET_ESR(b) GET_GLOBAL_REG(ESR, (b))
107#define GET_ESRRESTORE(b) GET_GLOBAL_REG(ESRRESTORE, (b))
108#define GET_ESYNR0(b) GET_GLOBAL_REG(ESYNR0, (b))
109#define GET_ESYNR1(b) GET_GLOBAL_REG(ESYNR1, (b))
110#define GET_REV(b) GET_GLOBAL_REG(REV, (b))
111#define GET_IDR(b) GET_GLOBAL_REG(IDR, (b))
112#define GET_RPU_ACR(b) GET_GLOBAL_REG(RPU_ACR, (b))
113
114
115/* Context register setters/getters */
116#define SET_SCTLR(b, c, v) SET_CTX_REG(SCTLR, (b), (c), (v))
117#define SET_ACTLR(b, c, v) SET_CTX_REG(ACTLR, (b), (c), (v))
118#define SET_CONTEXTIDR(b, c, v) SET_CTX_REG(CONTEXTIDR, (b), (c), (v))
119#define SET_TTBR0(b, c, v) SET_CTX_REG(TTBR0, (b), (c), (v))
120#define SET_TTBR1(b, c, v) SET_CTX_REG(TTBR1, (b), (c), (v))
121#define SET_TTBCR(b, c, v) SET_CTX_REG(TTBCR, (b), (c), (v))
122#define SET_PAR(b, c, v) SET_CTX_REG(PAR, (b), (c), (v))
123#define SET_FSR(b, c, v) SET_CTX_REG(FSR, (b), (c), (v))
124#define SET_FSRRESTORE(b, c, v) SET_CTX_REG(FSRRESTORE, (b), (c), (v))
125#define SET_FAR(b, c, v) SET_CTX_REG(FAR, (b), (c), (v))
126#define SET_FSYNR0(b, c, v) SET_CTX_REG(FSYNR0, (b), (c), (v))
127#define SET_FSYNR1(b, c, v) SET_CTX_REG(FSYNR1, (b), (c), (v))
128#define SET_PRRR(b, c, v) SET_CTX_REG(PRRR, (b), (c), (v))
129#define SET_NMRR(b, c, v) SET_CTX_REG(NMRR, (b), (c), (v))
130#define SET_TLBLKCR(b, c, v) SET_CTX_REG(TLBLCKR, (b), (c), (v))
131#define SET_V2PSR(b, c, v) SET_CTX_REG(V2PSR, (b), (c), (v))
132#define SET_TLBFLPTER(b, c, v) SET_CTX_REG(TLBFLPTER, (b), (c), (v))
133#define SET_TLBSLPTER(b, c, v) SET_CTX_REG(TLBSLPTER, (b), (c), (v))
134#define SET_BFBCR(b, c, v) SET_CTX_REG(BFBCR, (b), (c), (v))
135#define SET_CTX_TLBIALL(b, c, v) SET_CTX_REG(CTX_TLBIALL, (b), (c), (v))
136#define SET_TLBIASID(b, c, v) SET_CTX_REG(TLBIASID, (b), (c), (v))
137#define SET_TLBIVA(b, c, v) SET_CTX_REG(TLBIVA, (b), (c), (v))
138#define SET_TLBIVAA(b, c, v) SET_CTX_REG(TLBIVAA, (b), (c), (v))
139#define SET_V2PPR(b, c, v) SET_CTX_REG(V2PPR, (b), (c), (v))
140#define SET_V2PPW(b, c, v) SET_CTX_REG(V2PPW, (b), (c), (v))
141#define SET_V2PUR(b, c, v) SET_CTX_REG(V2PUR, (b), (c), (v))
142#define SET_V2PUW(b, c, v) SET_CTX_REG(V2PUW, (b), (c), (v))
143#define SET_RESUME(b, c, v) SET_CTX_REG(RESUME, (b), (c), (v))
144
145#define GET_SCTLR(b, c) GET_CTX_REG(SCTLR, (b), (c))
146#define GET_ACTLR(b, c) GET_CTX_REG(ACTLR, (b), (c))
147#define GET_CONTEXTIDR(b, c) GET_CTX_REG(CONTEXTIDR, (b), (c))
148#define GET_TTBR0(b, c) GET_CTX_REG(TTBR0, (b), (c))
149#define GET_TTBR1(b, c) GET_CTX_REG(TTBR1, (b), (c))
150#define GET_TTBCR(b, c) GET_CTX_REG(TTBCR, (b), (c))
151#define GET_PAR(b, c) GET_CTX_REG(PAR, (b), (c))
152#define GET_FSR(b, c) GET_CTX_REG(FSR, (b), (c))
153#define GET_FSRRESTORE(b, c) GET_CTX_REG(FSRRESTORE, (b), (c))
154#define GET_FAR(b, c) GET_CTX_REG(FAR, (b), (c))
155#define GET_FSYNR0(b, c) GET_CTX_REG(FSYNR0, (b), (c))
156#define GET_FSYNR1(b, c) GET_CTX_REG(FSYNR1, (b), (c))
157#define GET_PRRR(b, c) GET_CTX_REG(PRRR, (b), (c))
158#define GET_NMRR(b, c) GET_CTX_REG(NMRR, (b), (c))
159#define GET_TLBLCKR(b, c) GET_CTX_REG(TLBLCKR, (b), (c))
160#define GET_V2PSR(b, c) GET_CTX_REG(V2PSR, (b), (c))
161#define GET_TLBFLPTER(b, c) GET_CTX_REG(TLBFLPTER, (b), (c))
162#define GET_TLBSLPTER(b, c) GET_CTX_REG(TLBSLPTER, (b), (c))
163#define GET_BFBCR(b, c) GET_CTX_REG(BFBCR, (b), (c))
164#define GET_CTX_TLBIALL(b, c) GET_CTX_REG(CTX_TLBIALL, (b), (c))
165#define GET_TLBIASID(b, c) GET_CTX_REG(TLBIASID, (b), (c))
166#define GET_TLBIVA(b, c) GET_CTX_REG(TLBIVA, (b), (c))
167#define GET_TLBIVAA(b, c) GET_CTX_REG(TLBIVAA, (b), (c))
168#define GET_V2PPR(b, c) GET_CTX_REG(V2PPR, (b), (c))
169#define GET_V2PPW(b, c) GET_CTX_REG(V2PPW, (b), (c))
170#define GET_V2PUR(b, c) GET_CTX_REG(V2PUR, (b), (c))
171#define GET_V2PUW(b, c) GET_CTX_REG(V2PUW, (b), (c))
172#define GET_RESUME(b, c) GET_CTX_REG(RESUME, (b), (c))
173
174
175/* Global field setters / getters */
176/* Global Field Setters: */
177/* CBACR_N */
178#define SET_RWVMID(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), RWVMID, v)
179#define SET_RWE(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), RWE, v)
180#define SET_RWGE(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), RWGE, v)
181#define SET_CBVMID(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), CBVMID, v)
182#define SET_IRPTNDX(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), IRPTNDX, v)
183
184
185/* M2VCBR_N */
186#define SET_VMID(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), VMID, v)
187#define SET_CBNDX(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), CBNDX, v)
188#define SET_BYPASSD(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BYPASSD, v)
189#define SET_BPRCOSH(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPRCOSH, v)
190#define SET_BPRCISH(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPRCISH, v)
191#define SET_BPRCNSH(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPRCNSH, v)
192#define SET_BPSHCFG(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPSHCFG, v)
193#define SET_NSCFG(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), NSCFG, v)
194#define SET_BPMTCFG(b, n, v) SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPMTCFG, v)
195#define SET_BPMEMTYPE(b, n, v) \
196 SET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPMEMTYPE, v)
197
198
199/* CR */
200#define SET_RPUE(b, v) SET_GLOBAL_FIELD(b, CR, RPUE, v)
201#define SET_RPUERE(b, v) SET_GLOBAL_FIELD(b, CR, RPUERE, v)
202#define SET_RPUEIE(b, v) SET_GLOBAL_FIELD(b, CR, RPUEIE, v)
203#define SET_DCDEE(b, v) SET_GLOBAL_FIELD(b, CR, DCDEE, v)
204#define SET_CLIENTPD(b, v) SET_GLOBAL_FIELD(b, CR, CLIENTPD, v)
205#define SET_STALLD(b, v) SET_GLOBAL_FIELD(b, CR, STALLD, v)
206#define SET_TLBLKCRWE(b, v) SET_GLOBAL_FIELD(b, CR, TLBLKCRWE, v)
207#define SET_CR_TLBIALLCFG(b, v) SET_GLOBAL_FIELD(b, CR, CR_TLBIALLCFG, v)
208#define SET_TLBIVMIDCFG(b, v) SET_GLOBAL_FIELD(b, CR, TLBIVMIDCFG, v)
209#define SET_CR_HUME(b, v) SET_GLOBAL_FIELD(b, CR, CR_HUME, v)
210
211
212/* ESR */
213#define SET_CFG(b, v) SET_GLOBAL_FIELD(b, ESR, CFG, v)
214#define SET_BYPASS(b, v) SET_GLOBAL_FIELD(b, ESR, BYPASS, v)
215#define SET_ESR_MULTI(b, v) SET_GLOBAL_FIELD(b, ESR, ESR_MULTI, v)
216
217
218/* ESYNR0 */
219#define SET_ESYNR0_AMID(b, v) SET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_AMID, v)
220#define SET_ESYNR0_APID(b, v) SET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_APID, v)
221#define SET_ESYNR0_ABID(b, v) SET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_ABID, v)
222#define SET_ESYNR0_AVMID(b, v) SET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_AVMID, v)
223#define SET_ESYNR0_ATID(b, v) SET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_ATID, v)
224
225
226/* ESYNR1 */
227#define SET_ESYNR1_AMEMTYPE(b, v) \
228 SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AMEMTYPE, v)
229#define SET_ESYNR1_ASHARED(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ASHARED, v)
230#define SET_ESYNR1_AINNERSHARED(b, v) \
231 SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AINNERSHARED, v)
232#define SET_ESYNR1_APRIV(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_APRIV, v)
233#define SET_ESYNR1_APROTNS(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_APROTNS, v)
234#define SET_ESYNR1_AINST(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AINST, v)
235#define SET_ESYNR1_AWRITE(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AWRITE, v)
236#define SET_ESYNR1_ABURST(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ABURST, v)
237#define SET_ESYNR1_ALEN(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ALEN, v)
238#define SET_ESYNR1_ASIZE(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ASIZE, v)
239#define SET_ESYNR1_ALOCK(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ALOCK, v)
240#define SET_ESYNR1_AOOO(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AOOO, v)
241#define SET_ESYNR1_AFULL(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AFULL, v)
242#define SET_ESYNR1_AC(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AC, v)
243#define SET_ESYNR1_DCD(b, v) SET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_DCD, v)
244
245
246/* TESTBUSCR */
247#define SET_TBE(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, TBE, v)
248#define SET_SPDMBE(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, SPDMBE, v)
249#define SET_WGSEL(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, WGSEL, v)
250#define SET_TBLSEL(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, TBLSEL, v)
251#define SET_TBHSEL(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, TBHSEL, v)
252#define SET_SPDM0SEL(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, SPDM0SEL, v)
253#define SET_SPDM1SEL(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, SPDM1SEL, v)
254#define SET_SPDM2SEL(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, SPDM2SEL, v)
255#define SET_SPDM3SEL(b, v) SET_GLOBAL_FIELD(b, TESTBUSCR, SPDM3SEL, v)
256
257
258/* TLBIVMID */
259#define SET_TLBIVMID_VMID(b, v) SET_GLOBAL_FIELD(b, TLBIVMID, TLBIVMID_VMID, v)
260
261
262/* TLBRSW */
263#define SET_TLBRSW_INDEX(b, v) SET_GLOBAL_FIELD(b, TLBRSW, TLBRSW_INDEX, v)
264#define SET_TLBBFBS(b, v) SET_GLOBAL_FIELD(b, TLBRSW, TLBBFBS, v)
265
266
267/* TLBTR0 */
268#define SET_PR(b, v) SET_GLOBAL_FIELD(b, TLBTR0, PR, v)
269#define SET_PW(b, v) SET_GLOBAL_FIELD(b, TLBTR0, PW, v)
270#define SET_UR(b, v) SET_GLOBAL_FIELD(b, TLBTR0, UR, v)
271#define SET_UW(b, v) SET_GLOBAL_FIELD(b, TLBTR0, UW, v)
272#define SET_XN(b, v) SET_GLOBAL_FIELD(b, TLBTR0, XN, v)
273#define SET_NSDESC(b, v) SET_GLOBAL_FIELD(b, TLBTR0, NSDESC, v)
274#define SET_ISH(b, v) SET_GLOBAL_FIELD(b, TLBTR0, ISH, v)
275#define SET_SH(b, v) SET_GLOBAL_FIELD(b, TLBTR0, SH, v)
276#define SET_MT(b, v) SET_GLOBAL_FIELD(b, TLBTR0, MT, v)
277#define SET_DPSIZR(b, v) SET_GLOBAL_FIELD(b, TLBTR0, DPSIZR, v)
278#define SET_DPSIZC(b, v) SET_GLOBAL_FIELD(b, TLBTR0, DPSIZC, v)
279
280
281/* TLBTR1 */
282#define SET_TLBTR1_VMID(b, v) SET_GLOBAL_FIELD(b, TLBTR1, TLBTR1_VMID, v)
283#define SET_TLBTR1_PA(b, v) SET_GLOBAL_FIELD(b, TLBTR1, TLBTR1_PA, v)
284
285
286/* TLBTR2 */
287#define SET_TLBTR2_ASID(b, v) SET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_ASID, v)
288#define SET_TLBTR2_V(b, v) SET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_V, v)
289#define SET_TLBTR2_NSTID(b, v) SET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_NSTID, v)
290#define SET_TLBTR2_NV(b, v) SET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_NV, v)
291#define SET_TLBTR2_VA(b, v) SET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_VA, v)
292
293
294/* Global Field Getters */
295/* CBACR_N */
296#define GET_RWVMID(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), RWVMID)
297#define GET_RWE(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), RWE)
298#define GET_RWGE(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), RWGE)
299#define GET_CBVMID(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), CBVMID)
300#define GET_IRPTNDX(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(CBACR_N), IRPTNDX)
301
302
303/* M2VCBR_N */
304#define GET_VMID(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), VMID)
305#define GET_CBNDX(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), CBNDX)
306#define GET_BYPASSD(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BYPASSD)
307#define GET_BPRCOSH(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPRCOSH)
308#define GET_BPRCISH(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPRCISH)
309#define GET_BPRCNSH(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPRCNSH)
310#define GET_BPSHCFG(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPSHCFG)
311#define GET_NSCFG(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), NSCFG)
312#define GET_BPMTCFG(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPMTCFG)
313#define GET_BPMEMTYPE(b, n) GET_GLOBAL_FIELD(b, (n<<2)|(M2VCBR_N), BPMEMTYPE)
314
315
316/* CR */
317#define GET_RPUE(b) GET_GLOBAL_FIELD(b, CR, RPUE)
318#define GET_RPUERE(b) GET_GLOBAL_FIELD(b, CR, RPUERE)
319#define GET_RPUEIE(b) GET_GLOBAL_FIELD(b, CR, RPUEIE)
320#define GET_DCDEE(b) GET_GLOBAL_FIELD(b, CR, DCDEE)
321#define GET_CLIENTPD(b) GET_GLOBAL_FIELD(b, CR, CLIENTPD)
322#define GET_STALLD(b) GET_GLOBAL_FIELD(b, CR, STALLD)
323#define GET_TLBLKCRWE(b) GET_GLOBAL_FIELD(b, CR, TLBLKCRWE)
324#define GET_CR_TLBIALLCFG(b) GET_GLOBAL_FIELD(b, CR, CR_TLBIALLCFG)
325#define GET_TLBIVMIDCFG(b) GET_GLOBAL_FIELD(b, CR, TLBIVMIDCFG)
326#define GET_CR_HUME(b) GET_GLOBAL_FIELD(b, CR, CR_HUME)
327
328
329/* ESR */
330#define GET_CFG(b) GET_GLOBAL_FIELD(b, ESR, CFG)
331#define GET_BYPASS(b) GET_GLOBAL_FIELD(b, ESR, BYPASS)
332#define GET_ESR_MULTI(b) GET_GLOBAL_FIELD(b, ESR, ESR_MULTI)
333
334
335/* ESYNR0 */
336#define GET_ESYNR0_AMID(b) GET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_AMID)
337#define GET_ESYNR0_APID(b) GET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_APID)
338#define GET_ESYNR0_ABID(b) GET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_ABID)
339#define GET_ESYNR0_AVMID(b) GET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_AVMID)
340#define GET_ESYNR0_ATID(b) GET_GLOBAL_FIELD(b, ESYNR0, ESYNR0_ATID)
341
342
343/* ESYNR1 */
344#define GET_ESYNR1_AMEMTYPE(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AMEMTYPE)
345#define GET_ESYNR1_ASHARED(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ASHARED)
346#define GET_ESYNR1_AINNERSHARED(b) \
347 GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AINNERSHARED)
348#define GET_ESYNR1_APRIV(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_APRIV)
349#define GET_ESYNR1_APROTNS(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_APROTNS)
350#define GET_ESYNR1_AINST(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AINST)
351#define GET_ESYNR1_AWRITE(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AWRITE)
352#define GET_ESYNR1_ABURST(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ABURST)
353#define GET_ESYNR1_ALEN(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ALEN)
354#define GET_ESYNR1_ASIZE(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ASIZE)
355#define GET_ESYNR1_ALOCK(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_ALOCK)
356#define GET_ESYNR1_AOOO(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AOOO)
357#define GET_ESYNR1_AFULL(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AFULL)
358#define GET_ESYNR1_AC(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_AC)
359#define GET_ESYNR1_DCD(b) GET_GLOBAL_FIELD(b, ESYNR1, ESYNR1_DCD)
360
361
362/* IDR */
363#define GET_NM2VCBMT(b) GET_GLOBAL_FIELD(b, IDR, NM2VCBMT)
364#define GET_HTW(b) GET_GLOBAL_FIELD(b, IDR, HTW)
365#define GET_HUM(b) GET_GLOBAL_FIELD(b, IDR, HUM)
366#define GET_TLBSIZE(b) GET_GLOBAL_FIELD(b, IDR, TLBSIZE)
367#define GET_NCB(b) GET_GLOBAL_FIELD(b, IDR, NCB)
368#define GET_NIRPT(b) GET_GLOBAL_FIELD(b, IDR, NIRPT)
369
370
371/* REV */
372#define GET_MAJOR(b) GET_GLOBAL_FIELD(b, REV, MAJOR)
373#define GET_MINOR(b) GET_GLOBAL_FIELD(b, REV, MINOR)
374
375
376/* TESTBUSCR */
377#define GET_TBE(b) GET_GLOBAL_FIELD(b, TESTBUSCR, TBE)
378#define GET_SPDMBE(b) GET_GLOBAL_FIELD(b, TESTBUSCR, SPDMBE)
379#define GET_WGSEL(b) GET_GLOBAL_FIELD(b, TESTBUSCR, WGSEL)
380#define GET_TBLSEL(b) GET_GLOBAL_FIELD(b, TESTBUSCR, TBLSEL)
381#define GET_TBHSEL(b) GET_GLOBAL_FIELD(b, TESTBUSCR, TBHSEL)
382#define GET_SPDM0SEL(b) GET_GLOBAL_FIELD(b, TESTBUSCR, SPDM0SEL)
383#define GET_SPDM1SEL(b) GET_GLOBAL_FIELD(b, TESTBUSCR, SPDM1SEL)
384#define GET_SPDM2SEL(b) GET_GLOBAL_FIELD(b, TESTBUSCR, SPDM2SEL)
385#define GET_SPDM3SEL(b) GET_GLOBAL_FIELD(b, TESTBUSCR, SPDM3SEL)
386
387
388/* TLBIVMID */
389#define GET_TLBIVMID_VMID(b) GET_GLOBAL_FIELD(b, TLBIVMID, TLBIVMID_VMID)
390
391
392/* TLBTR0 */
393#define GET_PR(b) GET_GLOBAL_FIELD(b, TLBTR0, PR)
394#define GET_PW(b) GET_GLOBAL_FIELD(b, TLBTR0, PW)
395#define GET_UR(b) GET_GLOBAL_FIELD(b, TLBTR0, UR)
396#define GET_UW(b) GET_GLOBAL_FIELD(b, TLBTR0, UW)
397#define GET_XN(b) GET_GLOBAL_FIELD(b, TLBTR0, XN)
398#define GET_NSDESC(b) GET_GLOBAL_FIELD(b, TLBTR0, NSDESC)
399#define GET_ISH(b) GET_GLOBAL_FIELD(b, TLBTR0, ISH)
400#define GET_SH(b) GET_GLOBAL_FIELD(b, TLBTR0, SH)
401#define GET_MT(b) GET_GLOBAL_FIELD(b, TLBTR0, MT)
402#define GET_DPSIZR(b) GET_GLOBAL_FIELD(b, TLBTR0, DPSIZR)
403#define GET_DPSIZC(b) GET_GLOBAL_FIELD(b, TLBTR0, DPSIZC)
404
405
406/* TLBTR1 */
407#define GET_TLBTR1_VMID(b) GET_GLOBAL_FIELD(b, TLBTR1, TLBTR1_VMID)
408#define GET_TLBTR1_PA(b) GET_GLOBAL_FIELD(b, TLBTR1, TLBTR1_PA)
409
410
411/* TLBTR2 */
412#define GET_TLBTR2_ASID(b) GET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_ASID)
413#define GET_TLBTR2_V(b) GET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_V)
414#define GET_TLBTR2_NSTID(b) GET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_NSTID)
415#define GET_TLBTR2_NV(b) GET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_NV)
416#define GET_TLBTR2_VA(b) GET_GLOBAL_FIELD(b, TLBTR2, TLBTR2_VA)
417
418
419/* Context Register setters / getters */
420/* Context Register setters */
421/* ACTLR */
422#define SET_CFERE(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, CFERE, v)
423#define SET_CFEIE(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, CFEIE, v)
424#define SET_PTSHCFG(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, PTSHCFG, v)
425#define SET_RCOSH(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, RCOSH, v)
426#define SET_RCISH(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, RCISH, v)
427#define SET_RCNSH(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, RCNSH, v)
428#define SET_PRIVCFG(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, PRIVCFG, v)
429#define SET_DNA(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, DNA, v)
430#define SET_DNLV2PA(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, DNLV2PA, v)
431#define SET_TLBMCFG(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, TLBMCFG, v)
432#define SET_CFCFG(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, CFCFG, v)
433#define SET_TIPCF(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, TIPCF, v)
434#define SET_V2PCFG(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, V2PCFG, v)
435#define SET_HUME(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, HUME, v)
436#define SET_PTMTCFG(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, PTMTCFG, v)
437#define SET_PTMEMTYPE(b, c, v) SET_CONTEXT_FIELD(b, c, ACTLR, PTMEMTYPE, v)
438
439
440/* BFBCR */
441#define SET_BFBDFE(b, c, v) SET_CONTEXT_FIELD(b, c, BFBCR, BFBDFE, v)
442#define SET_BFBSFE(b, c, v) SET_CONTEXT_FIELD(b, c, BFBCR, BFBSFE, v)
443#define SET_SFVS(b, c, v) SET_CONTEXT_FIELD(b, c, BFBCR, SFVS, v)
444#define SET_FLVIC(b, c, v) SET_CONTEXT_FIELD(b, c, BFBCR, FLVIC, v)
445#define SET_SLVIC(b, c, v) SET_CONTEXT_FIELD(b, c, BFBCR, SLVIC, v)
446
447
448/* CONTEXTIDR */
449#define SET_CONTEXTIDR_ASID(b, c, v) \
450 SET_CONTEXT_FIELD(b, c, CONTEXTIDR, CONTEXTIDR_ASID, v)
451#define SET_CONTEXTIDR_PROCID(b, c, v) \
452 SET_CONTEXT_FIELD(b, c, CONTEXTIDR, PROCID, v)
453
454
455/* FSR */
456#define SET_TF(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, TF, v)
457#define SET_AFF(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, AFF, v)
458#define SET_APF(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, APF, v)
459#define SET_TLBMF(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, TLBMF, v)
460#define SET_HTWDEEF(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, HTWDEEF, v)
461#define SET_HTWSEEF(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, HTWSEEF, v)
462#define SET_MHF(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, MHF, v)
463#define SET_SL(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, SL, v)
464#define SET_SS(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, SS, v)
465#define SET_MULTI(b, c, v) SET_CONTEXT_FIELD(b, c, FSR, MULTI, v)
466
467
468/* FSYNR0 */
469#define SET_AMID(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR0, AMID, v)
470#define SET_APID(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR0, APID, v)
471#define SET_ABID(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR0, ABID, v)
472#define SET_ATID(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR0, ATID, v)
473
474
475/* FSYNR1 */
476#define SET_AMEMTYPE(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, AMEMTYPE, v)
477#define SET_ASHARED(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, ASHARED, v)
478#define SET_AINNERSHARED(b, c, v) \
479 SET_CONTEXT_FIELD(b, c, FSYNR1, AINNERSHARED, v)
480#define SET_APRIV(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, APRIV, v)
481#define SET_APROTNS(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, APROTNS, v)
482#define SET_AINST(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, AINST, v)
483#define SET_AWRITE(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, AWRITE, v)
484#define SET_ABURST(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, ABURST, v)
485#define SET_ALEN(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, ALEN, v)
486#define SET_FSYNR1_ASIZE(b, c, v) \
487 SET_CONTEXT_FIELD(b, c, FSYNR1, FSYNR1_ASIZE, v)
488#define SET_ALOCK(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, ALOCK, v)
489#define SET_AFULL(b, c, v) SET_CONTEXT_FIELD(b, c, FSYNR1, AFULL, v)
490
491
492/* NMRR */
493#define SET_ICPC0(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, ICPC0, v)
494#define SET_ICPC1(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, ICPC1, v)
495#define SET_ICPC2(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, ICPC2, v)
496#define SET_ICPC3(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, ICPC3, v)
497#define SET_ICPC4(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, ICPC4, v)
498#define SET_ICPC5(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, ICPC5, v)
499#define SET_ICPC6(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, ICPC6, v)
500#define SET_ICPC7(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, ICPC7, v)
501#define SET_OCPC0(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, OCPC0, v)
502#define SET_OCPC1(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, OCPC1, v)
503#define SET_OCPC2(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, OCPC2, v)
504#define SET_OCPC3(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, OCPC3, v)
505#define SET_OCPC4(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, OCPC4, v)
506#define SET_OCPC5(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, OCPC5, v)
507#define SET_OCPC6(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, OCPC6, v)
508#define SET_OCPC7(b, c, v) SET_CONTEXT_FIELD(b, c, NMRR, OCPC7, v)
509
510
511/* PAR */
512#define SET_FAULT(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, FAULT, v)
513
514#define SET_FAULT_TF(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, FAULT_TF, v)
515#define SET_FAULT_AFF(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, FAULT_AFF, v)
516#define SET_FAULT_APF(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, FAULT_APF, v)
517#define SET_FAULT_TLBMF(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, FAULT_TLBMF, v)
518#define SET_FAULT_HTWDEEF(b, c, v) \
519 SET_CONTEXT_FIELD(b, c, PAR, FAULT_HTWDEEF, v)
520#define SET_FAULT_HTWSEEF(b, c, v) \
521 SET_CONTEXT_FIELD(b, c, PAR, FAULT_HTWSEEF, v)
522#define SET_FAULT_MHF(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, FAULT_MHF, v)
523#define SET_FAULT_SL(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, FAULT_SL, v)
524#define SET_FAULT_SS(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, FAULT_SS, v)
525
526#define SET_NOFAULT_SS(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, NOFAULT_SS, v)
527#define SET_NOFAULT_MT(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, NOFAULT_MT, v)
528#define SET_NOFAULT_SH(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, NOFAULT_SH, v)
529#define SET_NOFAULT_NS(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, NOFAULT_NS, v)
530#define SET_NOFAULT_NOS(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, NOFAULT_NOS, v)
531#define SET_NPFAULT_PA(b, c, v) SET_CONTEXT_FIELD(b, c, PAR, NPFAULT_PA, v)
532
533
534/* PRRR */
535#define SET_MTC0(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, MTC0, v)
536#define SET_MTC1(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, MTC1, v)
537#define SET_MTC2(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, MTC2, v)
538#define SET_MTC3(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, MTC3, v)
539#define SET_MTC4(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, MTC4, v)
540#define SET_MTC5(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, MTC5, v)
541#define SET_MTC6(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, MTC6, v)
542#define SET_MTC7(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, MTC7, v)
543#define SET_SHDSH0(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, SHDSH0, v)
544#define SET_SHDSH1(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, SHDSH1, v)
545#define SET_SHNMSH0(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, SHNMSH0, v)
546#define SET_SHNMSH1(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, SHNMSH1, v)
547#define SET_NOS0(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, NOS0, v)
548#define SET_NOS1(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, NOS1, v)
549#define SET_NOS2(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, NOS2, v)
550#define SET_NOS3(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, NOS3, v)
551#define SET_NOS4(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, NOS4, v)
552#define SET_NOS5(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, NOS5, v)
553#define SET_NOS6(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, NOS6, v)
554#define SET_NOS7(b, c, v) SET_CONTEXT_FIELD(b, c, PRRR, NOS7, v)
555
556
557/* RESUME */
558#define SET_TNR(b, c, v) SET_CONTEXT_FIELD(b, c, RESUME, TNR, v)
559
560
561/* SCTLR */
562#define SET_M(b, c, v) SET_CONTEXT_FIELD(b, c, SCTLR, M, v)
563#define SET_TRE(b, c, v) SET_CONTEXT_FIELD(b, c, SCTLR, TRE, v)
564#define SET_AFE(b, c, v) SET_CONTEXT_FIELD(b, c, SCTLR, AFE, v)
565#define SET_HAF(b, c, v) SET_CONTEXT_FIELD(b, c, SCTLR, HAF, v)
566#define SET_BE(b, c, v) SET_CONTEXT_FIELD(b, c, SCTLR, BE, v)
567#define SET_AFFD(b, c, v) SET_CONTEXT_FIELD(b, c, SCTLR, AFFD, v)
568
569
570/* TLBLKCR */
571#define SET_LKE(b, c, v) SET_CONTEXT_FIELD(b, c, TLBLKCR, LKE, v)
572#define SET_TLBLKCR_TLBIALLCFG(b, c, v) \
573 SET_CONTEXT_FIELD(b, c, TLBLKCR, TLBLCKR_TLBIALLCFG, v)
574#define SET_TLBIASIDCFG(b, c, v) \
575 SET_CONTEXT_FIELD(b, c, TLBLKCR, TLBIASIDCFG, v)
576#define SET_TLBIVAACFG(b, c, v) SET_CONTEXT_FIELD(b, c, TLBLKCR, TLBIVAACFG, v)
577#define SET_FLOOR(b, c, v) SET_CONTEXT_FIELD(b, c, TLBLKCR, FLOOR, v)
578#define SET_VICTIM(b, c, v) SET_CONTEXT_FIELD(b, c, TLBLKCR, VICTIM, v)
579
580
581/* TTBCR */
582#define SET_N(b, c, v) SET_CONTEXT_FIELD(b, c, TTBCR, N, v)
583#define SET_PD0(b, c, v) SET_CONTEXT_FIELD(b, c, TTBCR, PD0, v)
584#define SET_PD1(b, c, v) SET_CONTEXT_FIELD(b, c, TTBCR, PD1, v)
585
586
587/* TTBR0 */
588#define SET_TTBR0_IRGNH(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_IRGNH, v)
589#define SET_TTBR0_SH(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_SH, v)
590#define SET_TTBR0_ORGN(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_ORGN, v)
591#define SET_TTBR0_NOS(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_NOS, v)
592#define SET_TTBR0_IRGNL(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_IRGNL, v)
593#define SET_TTBR0_PA(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_PA, v)
594
595
596/* TTBR1 */
597#define SET_TTBR1_IRGNH(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_IRGNH, v)
598#define SET_TTBR1_SH(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_SH, v)
599#define SET_TTBR1_ORGN(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_ORGN, v)
600#define SET_TTBR1_NOS(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_NOS, v)
601#define SET_TTBR1_IRGNL(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_IRGNL, v)
602#define SET_TTBR1_PA(b, c, v) SET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_PA, v)
603
604
605/* V2PSR */
606#define SET_HIT(b, c, v) SET_CONTEXT_FIELD(b, c, V2PSR, HIT, v)
607#define SET_INDEX(b, c, v) SET_CONTEXT_FIELD(b, c, V2PSR, INDEX, v)
608
609
610/* V2Pxx UW UR PW PR */
611#define SET_V2PUW_INDEX(b, c, v) SET_CONTEXT_FIELD(b, c, V2PUW, V2Pxx_INDEX, v)
612#define SET_V2PUW_VA(b, c, v) SET_CONTEXT_FIELD(b, c, V2PUW, V2Pxx_VA, v)
613
614#define SET_V2PUR_INDEX(b, c, v) SET_CONTEXT_FIELD(b, c, V2PUR, V2Pxx_INDEX, v)
615#define SET_V2PUR_VA(b, c, v) SET_CONTEXT_FIELD(b, c, V2PUR, V2Pxx_VA, v)
616
617#define SET_V2PPW_INDEX(b, c, v) SET_CONTEXT_FIELD(b, c, V2PPW, V2Pxx_INDEX, v)
618#define SET_V2PPW_VA(b, c, v) SET_CONTEXT_FIELD(b, c, V2PPW, V2Pxx_VA, v)
619
620#define SET_V2PPR_INDEX(b, c, v) SET_CONTEXT_FIELD(b, c, V2PPR, V2Pxx_INDEX, v)
621#define SET_V2PPR_VA(b, c, v) SET_CONTEXT_FIELD(b, c, V2PPR, V2Pxx_VA, v)
622
623
624/* Context Register getters */
625/* ACTLR */
626#define GET_CFERE(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, CFERE)
627#define GET_CFEIE(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, CFEIE)
628#define GET_PTSHCFG(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, PTSHCFG)
629#define GET_RCOSH(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, RCOSH)
630#define GET_RCISH(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, RCISH)
631#define GET_RCNSH(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, RCNSH)
632#define GET_PRIVCFG(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, PRIVCFG)
633#define GET_DNA(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, DNA)
634#define GET_DNLV2PA(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, DNLV2PA)
635#define GET_TLBMCFG(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, TLBMCFG)
636#define GET_CFCFG(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, CFCFG)
637#define GET_TIPCF(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, TIPCF)
638#define GET_V2PCFG(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, V2PCFG)
639#define GET_HUME(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, HUME)
640#define GET_PTMTCFG(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, PTMTCFG)
641#define GET_PTMEMTYPE(b, c) GET_CONTEXT_FIELD(b, c, ACTLR, PTMEMTYPE)
642
643/* BFBCR */
644#define GET_BFBDFE(b, c) GET_CONTEXT_FIELD(b, c, BFBCR, BFBDFE)
645#define GET_BFBSFE(b, c) GET_CONTEXT_FIELD(b, c, BFBCR, BFBSFE)
646#define GET_SFVS(b, c) GET_CONTEXT_FIELD(b, c, BFBCR, SFVS)
647#define GET_FLVIC(b, c) GET_CONTEXT_FIELD(b, c, BFBCR, FLVIC)
648#define GET_SLVIC(b, c) GET_CONTEXT_FIELD(b, c, BFBCR, SLVIC)
649
650
651/* CONTEXTIDR */
652#define GET_CONTEXTIDR_ASID(b, c) \
653 GET_CONTEXT_FIELD(b, c, CONTEXTIDR, CONTEXTIDR_ASID)
654#define GET_CONTEXTIDR_PROCID(b, c) GET_CONTEXT_FIELD(b, c, CONTEXTIDR, PROCID)
655
656
657/* FSR */
658#define GET_TF(b, c) GET_CONTEXT_FIELD(b, c, FSR, TF)
659#define GET_AFF(b, c) GET_CONTEXT_FIELD(b, c, FSR, AFF)
660#define GET_APF(b, c) GET_CONTEXT_FIELD(b, c, FSR, APF)
661#define GET_TLBMF(b, c) GET_CONTEXT_FIELD(b, c, FSR, TLBMF)
662#define GET_HTWDEEF(b, c) GET_CONTEXT_FIELD(b, c, FSR, HTWDEEF)
663#define GET_HTWSEEF(b, c) GET_CONTEXT_FIELD(b, c, FSR, HTWSEEF)
664#define GET_MHF(b, c) GET_CONTEXT_FIELD(b, c, FSR, MHF)
665#define GET_SL(b, c) GET_CONTEXT_FIELD(b, c, FSR, SL)
666#define GET_SS(b, c) GET_CONTEXT_FIELD(b, c, FSR, SS)
667#define GET_MULTI(b, c) GET_CONTEXT_FIELD(b, c, FSR, MULTI)
668
669
670/* FSYNR0 */
671#define GET_AMID(b, c) GET_CONTEXT_FIELD(b, c, FSYNR0, AMID)
672#define GET_APID(b, c) GET_CONTEXT_FIELD(b, c, FSYNR0, APID)
673#define GET_ABID(b, c) GET_CONTEXT_FIELD(b, c, FSYNR0, ABID)
674#define GET_ATID(b, c) GET_CONTEXT_FIELD(b, c, FSYNR0, ATID)
675
676
677/* FSYNR1 */
678#define GET_AMEMTYPE(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, AMEMTYPE)
679#define GET_ASHARED(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, ASHARED)
680#define GET_AINNERSHARED(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, AINNERSHARED)
681#define GET_APRIV(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, APRIV)
682#define GET_APROTNS(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, APROTNS)
683#define GET_AINST(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, AINST)
684#define GET_AWRITE(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, AWRITE)
685#define GET_ABURST(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, ABURST)
686#define GET_ALEN(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, ALEN)
687#define GET_FSYNR1_ASIZE(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, FSYNR1_ASIZE)
688#define GET_ALOCK(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, ALOCK)
689#define GET_AFULL(b, c) GET_CONTEXT_FIELD(b, c, FSYNR1, AFULL)
690
691
692/* NMRR */
693#define GET_ICPC0(b, c) GET_CONTEXT_FIELD(b, c, NMRR, ICPC0)
694#define GET_ICPC1(b, c) GET_CONTEXT_FIELD(b, c, NMRR, ICPC1)
695#define GET_ICPC2(b, c) GET_CONTEXT_FIELD(b, c, NMRR, ICPC2)
696#define GET_ICPC3(b, c) GET_CONTEXT_FIELD(b, c, NMRR, ICPC3)
697#define GET_ICPC4(b, c) GET_CONTEXT_FIELD(b, c, NMRR, ICPC4)
698#define GET_ICPC5(b, c) GET_CONTEXT_FIELD(b, c, NMRR, ICPC5)
699#define GET_ICPC6(b, c) GET_CONTEXT_FIELD(b, c, NMRR, ICPC6)
700#define GET_ICPC7(b, c) GET_CONTEXT_FIELD(b, c, NMRR, ICPC7)
701#define GET_OCPC0(b, c) GET_CONTEXT_FIELD(b, c, NMRR, OCPC0)
702#define GET_OCPC1(b, c) GET_CONTEXT_FIELD(b, c, NMRR, OCPC1)
703#define GET_OCPC2(b, c) GET_CONTEXT_FIELD(b, c, NMRR, OCPC2)
704#define GET_OCPC3(b, c) GET_CONTEXT_FIELD(b, c, NMRR, OCPC3)
705#define GET_OCPC4(b, c) GET_CONTEXT_FIELD(b, c, NMRR, OCPC4)
706#define GET_OCPC5(b, c) GET_CONTEXT_FIELD(b, c, NMRR, OCPC5)
707#define GET_OCPC6(b, c) GET_CONTEXT_FIELD(b, c, NMRR, OCPC6)
708#define GET_OCPC7(b, c) GET_CONTEXT_FIELD(b, c, NMRR, OCPC7)
709
710
711/* PAR */
712#define GET_FAULT(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT)
713
714#define GET_FAULT_TF(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_TF)
715#define GET_FAULT_AFF(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_AFF)
716#define GET_FAULT_APF(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_APF)
717#define GET_FAULT_TLBMF(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_TLBMF)
718#define GET_FAULT_HTWDEEF(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_HTWDEEF)
719#define GET_FAULT_HTWSEEF(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_HTWSEEF)
720#define GET_FAULT_MHF(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_MHF)
721#define GET_FAULT_SL(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_SL)
722#define GET_FAULT_SS(b, c) GET_CONTEXT_FIELD(b, c, PAR, FAULT_SS)
723
724#define GET_NOFAULT_SS(b, c) GET_CONTEXT_FIELD(b, c, PAR, PAR_NOFAULT_SS)
725#define GET_NOFAULT_MT(b, c) GET_CONTEXT_FIELD(b, c, PAR, PAR_NOFAULT_MT)
726#define GET_NOFAULT_SH(b, c) GET_CONTEXT_FIELD(b, c, PAR, PAR_NOFAULT_SH)
727#define GET_NOFAULT_NS(b, c) GET_CONTEXT_FIELD(b, c, PAR, PAR_NOFAULT_NS)
728#define GET_NOFAULT_NOS(b, c) GET_CONTEXT_FIELD(b, c, PAR, PAR_NOFAULT_NOS)
729#define GET_NPFAULT_PA(b, c) GET_CONTEXT_FIELD(b, c, PAR, PAR_NPFAULT_PA)
730
731
732/* PRRR */
733#define GET_MTC0(b, c) GET_CONTEXT_FIELD(b, c, PRRR, MTC0)
734#define GET_MTC1(b, c) GET_CONTEXT_FIELD(b, c, PRRR, MTC1)
735#define GET_MTC2(b, c) GET_CONTEXT_FIELD(b, c, PRRR, MTC2)
736#define GET_MTC3(b, c) GET_CONTEXT_FIELD(b, c, PRRR, MTC3)
737#define GET_MTC4(b, c) GET_CONTEXT_FIELD(b, c, PRRR, MTC4)
738#define GET_MTC5(b, c) GET_CONTEXT_FIELD(b, c, PRRR, MTC5)
739#define GET_MTC6(b, c) GET_CONTEXT_FIELD(b, c, PRRR, MTC6)
740#define GET_MTC7(b, c) GET_CONTEXT_FIELD(b, c, PRRR, MTC7)
741#define GET_SHDSH0(b, c) GET_CONTEXT_FIELD(b, c, PRRR, SHDSH0)
742#define GET_SHDSH1(b, c) GET_CONTEXT_FIELD(b, c, PRRR, SHDSH1)
743#define GET_SHNMSH0(b, c) GET_CONTEXT_FIELD(b, c, PRRR, SHNMSH0)
744#define GET_SHNMSH1(b, c) GET_CONTEXT_FIELD(b, c, PRRR, SHNMSH1)
745#define GET_NOS0(b, c) GET_CONTEXT_FIELD(b, c, PRRR, NOS0)
746#define GET_NOS1(b, c) GET_CONTEXT_FIELD(b, c, PRRR, NOS1)
747#define GET_NOS2(b, c) GET_CONTEXT_FIELD(b, c, PRRR, NOS2)
748#define GET_NOS3(b, c) GET_CONTEXT_FIELD(b, c, PRRR, NOS3)
749#define GET_NOS4(b, c) GET_CONTEXT_FIELD(b, c, PRRR, NOS4)
750#define GET_NOS5(b, c) GET_CONTEXT_FIELD(b, c, PRRR, NOS5)
751#define GET_NOS6(b, c) GET_CONTEXT_FIELD(b, c, PRRR, NOS6)
752#define GET_NOS7(b, c) GET_CONTEXT_FIELD(b, c, PRRR, NOS7)
753
754
755/* RESUME */
756#define GET_TNR(b, c) GET_CONTEXT_FIELD(b, c, RESUME, TNR)
757
758
759/* SCTLR */
760#define GET_M(b, c) GET_CONTEXT_FIELD(b, c, SCTLR, M)
761#define GET_TRE(b, c) GET_CONTEXT_FIELD(b, c, SCTLR, TRE)
762#define GET_AFE(b, c) GET_CONTEXT_FIELD(b, c, SCTLR, AFE)
763#define GET_HAF(b, c) GET_CONTEXT_FIELD(b, c, SCTLR, HAF)
764#define GET_BE(b, c) GET_CONTEXT_FIELD(b, c, SCTLR, BE)
765#define GET_AFFD(b, c) GET_CONTEXT_FIELD(b, c, SCTLR, AFFD)
766
767
768/* TLBLKCR */
769#define GET_LKE(b, c) GET_CONTEXT_FIELD(b, c, TLBLKCR, LKE)
770#define GET_TLBLCKR_TLBIALLCFG(b, c) \
771 GET_CONTEXT_FIELD(b, c, TLBLKCR, TLBLCKR_TLBIALLCFG)
772#define GET_TLBIASIDCFG(b, c) GET_CONTEXT_FIELD(b, c, TLBLKCR, TLBIASIDCFG)
773#define GET_TLBIVAACFG(b, c) GET_CONTEXT_FIELD(b, c, TLBLKCR, TLBIVAACFG)
774#define GET_FLOOR(b, c) GET_CONTEXT_FIELD(b, c, TLBLKCR, FLOOR)
775#define GET_VICTIM(b, c) GET_CONTEXT_FIELD(b, c, TLBLKCR, VICTIM)
776
777
778/* TTBCR */
779#define GET_N(b, c) GET_CONTEXT_FIELD(b, c, TTBCR, N)
780#define GET_PD0(b, c) GET_CONTEXT_FIELD(b, c, TTBCR, PD0)
781#define GET_PD1(b, c) GET_CONTEXT_FIELD(b, c, TTBCR, PD1)
782
783
784/* TTBR0 */
785#define GET_TTBR0_IRGNH(b, c) GET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_IRGNH)
786#define GET_TTBR0_SH(b, c) GET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_SH)
787#define GET_TTBR0_ORGN(b, c) GET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_ORGN)
788#define GET_TTBR0_NOS(b, c) GET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_NOS)
789#define GET_TTBR0_IRGNL(b, c) GET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_IRGNL)
790#define GET_TTBR0_PA(b, c) GET_CONTEXT_FIELD(b, c, TTBR0, TTBR0_PA)
791
792
793/* TTBR1 */
794#define GET_TTBR1_IRGNH(b, c) GET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_IRGNH)
795#define GET_TTBR1_SH(b, c) GET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_SH)
796#define GET_TTBR1_ORGN(b, c) GET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_ORGN)
797#define GET_TTBR1_NOS(b, c) GET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_NOS)
798#define GET_TTBR1_IRGNL(b, c) GET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_IRGNL)
799#define GET_TTBR1_PA(b, c) GET_CONTEXT_FIELD(b, c, TTBR1, TTBR1_PA)
800
801
802/* V2PSR */
803#define GET_HIT(b, c) GET_CONTEXT_FIELD(b, c, V2PSR, HIT)
804#define GET_INDEX(b, c) GET_CONTEXT_FIELD(b, c, V2PSR, INDEX)
805
806
807/* V2Pxx UW UR PW PR */
808#define GET_V2PUW_INDEX(b, c) GET_CONTEXT_FIELD(b, c, V2PUW, V2Pxx_INDEX)
809#define GET_V2PUW_VA(b, c) GET_CONTEXT_FIELD(b, c, V2PUW, V2Pxx_VA)
810
811#define GET_V2PUR_INDEX(b, c) GET_CONTEXT_FIELD(b, c, V2PUR, V2Pxx_INDEX)
812#define GET_V2PUR_VA(b, c) GET_CONTEXT_FIELD(b, c, V2PUR, V2Pxx_VA)
813
814#define GET_V2PPW_INDEX(b, c) GET_CONTEXT_FIELD(b, c, V2PPW, V2Pxx_INDEX)
815#define GET_V2PPW_VA(b, c) GET_CONTEXT_FIELD(b, c, V2PPW, V2Pxx_VA)
816
817#define GET_V2PPR_INDEX(b, c) GET_CONTEXT_FIELD(b, c, V2PPR, V2Pxx_INDEX)
818#define GET_V2PPR_VA(b, c) GET_CONTEXT_FIELD(b, c, V2PPR, V2Pxx_VA)
819
820
821/* Global Registers */
822#define M2VCBR_N (0xFF000)
823#define CBACR_N (0xFF800)
824#define TLBRSW (0xFFE00)
825#define TLBTR0 (0xFFE80)
826#define TLBTR1 (0xFFE84)
827#define TLBTR2 (0xFFE88)
828#define TESTBUSCR (0xFFE8C)
829#define GLOBAL_TLBIALL (0xFFF00)
830#define TLBIVMID (0xFFF04)
831#define CR (0xFFF80)
832#define EAR (0xFFF84)
833#define ESR (0xFFF88)
834#define ESRRESTORE (0xFFF8C)
835#define ESYNR0 (0xFFF90)
836#define ESYNR1 (0xFFF94)
837#define REV (0xFFFF4)
838#define IDR (0xFFFF8)
839#define RPU_ACR (0xFFFFC)
840
841
842/* Context Bank Registers */
843#define SCTLR (0x000)
844#define ACTLR (0x004)
845#define CONTEXTIDR (0x008)
846#define TTBR0 (0x010)
847#define TTBR1 (0x014)
848#define TTBCR (0x018)
849#define PAR (0x01C)
850#define FSR (0x020)
851#define FSRRESTORE (0x024)
852#define FAR (0x028)
853#define FSYNR0 (0x02C)
854#define FSYNR1 (0x030)
855#define PRRR (0x034)
856#define NMRR (0x038)
857#define TLBLCKR (0x03C)
858#define V2PSR (0x040)
859#define TLBFLPTER (0x044)
860#define TLBSLPTER (0x048)
861#define BFBCR (0x04C)
862#define CTX_TLBIALL (0x800)
863#define TLBIASID (0x804)
864#define TLBIVA (0x808)
865#define TLBIVAA (0x80C)
866#define V2PPR (0x810)
867#define V2PPW (0x814)
868#define V2PUR (0x818)
869#define V2PUW (0x81C)
870#define RESUME (0x820)
871
872
873/* Global Register Fields */
874/* CBACRn */
875#define RWVMID (RWVMID_MASK << RWVMID_SHIFT)
876#define RWE (RWE_MASK << RWE_SHIFT)
877#define RWGE (RWGE_MASK << RWGE_SHIFT)
878#define CBVMID (CBVMID_MASK << CBVMID_SHIFT)
879#define IRPTNDX (IRPTNDX_MASK << IRPTNDX_SHIFT)
880
881
882/* CR */
883#define RPUE (RPUE_MASK << RPUE_SHIFT)
884#define RPUERE (RPUERE_MASK << RPUERE_SHIFT)
885#define RPUEIE (RPUEIE_MASK << RPUEIE_SHIFT)
886#define DCDEE (DCDEE_MASK << DCDEE_SHIFT)
887#define CLIENTPD (CLIENTPD_MASK << CLIENTPD_SHIFT)
888#define STALLD (STALLD_MASK << STALLD_SHIFT)
889#define TLBLKCRWE (TLBLKCRWE_MASK << TLBLKCRWE_SHIFT)
890#define CR_TLBIALLCFG (CR_TLBIALLCFG_MASK << CR_TLBIALLCFG_SHIFT)
891#define TLBIVMIDCFG (TLBIVMIDCFG_MASK << TLBIVMIDCFG_SHIFT)
892#define CR_HUME (CR_HUME_MASK << CR_HUME_SHIFT)
893
894
895/* ESR */
896#define CFG (CFG_MASK << CFG_SHIFT)
897#define BYPASS (BYPASS_MASK << BYPASS_SHIFT)
898#define ESR_MULTI (ESR_MULTI_MASK << ESR_MULTI_SHIFT)
899
900
901/* ESYNR0 */
902#define ESYNR0_AMID (ESYNR0_AMID_MASK << ESYNR0_AMID_SHIFT)
903#define ESYNR0_APID (ESYNR0_APID_MASK << ESYNR0_APID_SHIFT)
904#define ESYNR0_ABID (ESYNR0_ABID_MASK << ESYNR0_ABID_SHIFT)
905#define ESYNR0_AVMID (ESYNR0_AVMID_MASK << ESYNR0_AVMID_SHIFT)
906#define ESYNR0_ATID (ESYNR0_ATID_MASK << ESYNR0_ATID_SHIFT)
907
908
909/* ESYNR1 */
910#define ESYNR1_AMEMTYPE (ESYNR1_AMEMTYPE_MASK << ESYNR1_AMEMTYPE_SHIFT)
911#define ESYNR1_ASHARED (ESYNR1_ASHARED_MASK << ESYNR1_ASHARED_SHIFT)
912#define ESYNR1_AINNERSHARED (ESYNR1_AINNERSHARED_MASK<< \
913 ESYNR1_AINNERSHARED_SHIFT)
914#define ESYNR1_APRIV (ESYNR1_APRIV_MASK << ESYNR1_APRIV_SHIFT)
915#define ESYNR1_APROTNS (ESYNR1_APROTNS_MASK << ESYNR1_APROTNS_SHIFT)
916#define ESYNR1_AINST (ESYNR1_AINST_MASK << ESYNR1_AINST_SHIFT)
917#define ESYNR1_AWRITE (ESYNR1_AWRITE_MASK << ESYNR1_AWRITE_SHIFT)
918#define ESYNR1_ABURST (ESYNR1_ABURST_MASK << ESYNR1_ABURST_SHIFT)
919#define ESYNR1_ALEN (ESYNR1_ALEN_MASK << ESYNR1_ALEN_SHIFT)
920#define ESYNR1_ASIZE (ESYNR1_ASIZE_MASK << ESYNR1_ASIZE_SHIFT)
921#define ESYNR1_ALOCK (ESYNR1_ALOCK_MASK << ESYNR1_ALOCK_SHIFT)
922#define ESYNR1_AOOO (ESYNR1_AOOO_MASK << ESYNR1_AOOO_SHIFT)
923#define ESYNR1_AFULL (ESYNR1_AFULL_MASK << ESYNR1_AFULL_SHIFT)
924#define ESYNR1_AC (ESYNR1_AC_MASK << ESYNR1_AC_SHIFT)
925#define ESYNR1_DCD (ESYNR1_DCD_MASK << ESYNR1_DCD_SHIFT)
926
927
928/* IDR */
929#define NM2VCBMT (NM2VCBMT_MASK << NM2VCBMT_SHIFT)
930#define HTW (HTW_MASK << HTW_SHIFT)
931#define HUM (HUM_MASK << HUM_SHIFT)
932#define TLBSIZE (TLBSIZE_MASK << TLBSIZE_SHIFT)
933#define NCB (NCB_MASK << NCB_SHIFT)
934#define NIRPT (NIRPT_MASK << NIRPT_SHIFT)
935
936
937/* M2VCBRn */
938#define VMID (VMID_MASK << VMID_SHIFT)
939#define CBNDX (CBNDX_MASK << CBNDX_SHIFT)
940#define BYPASSD (BYPASSD_MASK << BYPASSD_SHIFT)
941#define BPRCOSH (BPRCOSH_MASK << BPRCOSH_SHIFT)
942#define BPRCISH (BPRCISH_MASK << BPRCISH_SHIFT)
943#define BPRCNSH (BPRCNSH_MASK << BPRCNSH_SHIFT)
944#define BPSHCFG (BPSHCFG_MASK << BPSHCFG_SHIFT)
945#define NSCFG (NSCFG_MASK << NSCFG_SHIFT)
946#define BPMTCFG (BPMTCFG_MASK << BPMTCFG_SHIFT)
947#define BPMEMTYPE (BPMEMTYPE_MASK << BPMEMTYPE_SHIFT)
948
949
950/* REV */
951#define IDR_MINOR (MINOR_MASK << MINOR_SHIFT)
952#define IDR_MAJOR (MAJOR_MASK << MAJOR_SHIFT)
953
954
955/* TESTBUSCR */
956#define TBE (TBE_MASK << TBE_SHIFT)
957#define SPDMBE (SPDMBE_MASK << SPDMBE_SHIFT)
958#define WGSEL (WGSEL_MASK << WGSEL_SHIFT)
959#define TBLSEL (TBLSEL_MASK << TBLSEL_SHIFT)
960#define TBHSEL (TBHSEL_MASK << TBHSEL_SHIFT)
961#define SPDM0SEL (SPDM0SEL_MASK << SPDM0SEL_SHIFT)
962#define SPDM1SEL (SPDM1SEL_MASK << SPDM1SEL_SHIFT)
963#define SPDM2SEL (SPDM2SEL_MASK << SPDM2SEL_SHIFT)
964#define SPDM3SEL (SPDM3SEL_MASK << SPDM3SEL_SHIFT)
965
966
967/* TLBIVMID */
968#define TLBIVMID_VMID (TLBIVMID_VMID_MASK << TLBIVMID_VMID_SHIFT)
969
970
971/* TLBRSW */
972#define TLBRSW_INDEX (TLBRSW_INDEX_MASK << TLBRSW_INDEX_SHIFT)
973#define TLBBFBS (TLBBFBS_MASK << TLBBFBS_SHIFT)
974
975
976/* TLBTR0 */
977#define PR (PR_MASK << PR_SHIFT)
978#define PW (PW_MASK << PW_SHIFT)
979#define UR (UR_MASK << UR_SHIFT)
980#define UW (UW_MASK << UW_SHIFT)
981#define XN (XN_MASK << XN_SHIFT)
982#define NSDESC (NSDESC_MASK << NSDESC_SHIFT)
983#define ISH (ISH_MASK << ISH_SHIFT)
984#define SH (SH_MASK << SH_SHIFT)
985#define MT (MT_MASK << MT_SHIFT)
986#define DPSIZR (DPSIZR_MASK << DPSIZR_SHIFT)
987#define DPSIZC (DPSIZC_MASK << DPSIZC_SHIFT)
988
989
990/* TLBTR1 */
991#define TLBTR1_VMID (TLBTR1_VMID_MASK << TLBTR1_VMID_SHIFT)
992#define TLBTR1_PA (TLBTR1_PA_MASK << TLBTR1_PA_SHIFT)
993
994
995/* TLBTR2 */
996#define TLBTR2_ASID (TLBTR2_ASID_MASK << TLBTR2_ASID_SHIFT)
997#define TLBTR2_V (TLBTR2_V_MASK << TLBTR2_V_SHIFT)
998#define TLBTR2_NSTID (TLBTR2_NSTID_MASK << TLBTR2_NSTID_SHIFT)
999#define TLBTR2_NV (TLBTR2_NV_MASK << TLBTR2_NV_SHIFT)
1000#define TLBTR2_VA (TLBTR2_VA_MASK << TLBTR2_VA_SHIFT)
1001
1002
1003/* Context Register Fields */
1004/* ACTLR */
1005#define CFERE (CFERE_MASK << CFERE_SHIFT)
1006#define CFEIE (CFEIE_MASK << CFEIE_SHIFT)
1007#define PTSHCFG (PTSHCFG_MASK << PTSHCFG_SHIFT)
1008#define RCOSH (RCOSH_MASK << RCOSH_SHIFT)
1009#define RCISH (RCISH_MASK << RCISH_SHIFT)
1010#define RCNSH (RCNSH_MASK << RCNSH_SHIFT)
1011#define PRIVCFG (PRIVCFG_MASK << PRIVCFG_SHIFT)
1012#define DNA (DNA_MASK << DNA_SHIFT)
1013#define DNLV2PA (DNLV2PA_MASK << DNLV2PA_SHIFT)
1014#define TLBMCFG (TLBMCFG_MASK << TLBMCFG_SHIFT)
1015#define CFCFG (CFCFG_MASK << CFCFG_SHIFT)
1016#define TIPCF (TIPCF_MASK << TIPCF_SHIFT)
1017#define V2PCFG (V2PCFG_MASK << V2PCFG_SHIFT)
1018#define HUME (HUME_MASK << HUME_SHIFT)
1019#define PTMTCFG (PTMTCFG_MASK << PTMTCFG_SHIFT)
1020#define PTMEMTYPE (PTMEMTYPE_MASK << PTMEMTYPE_SHIFT)
1021
1022
1023/* BFBCR */
1024#define BFBDFE (BFBDFE_MASK << BFBDFE_SHIFT)
1025#define BFBSFE (BFBSFE_MASK << BFBSFE_SHIFT)
1026#define SFVS (SFVS_MASK << SFVS_SHIFT)
1027#define FLVIC (FLVIC_MASK << FLVIC_SHIFT)
1028#define SLVIC (SLVIC_MASK << SLVIC_SHIFT)
1029
1030
1031/* CONTEXTIDR */
1032#define CONTEXTIDR_ASID (CONTEXTIDR_ASID_MASK << CONTEXTIDR_ASID_SHIFT)
1033#define PROCID (PROCID_MASK << PROCID_SHIFT)
1034
1035
1036/* FSR */
1037#define TF (TF_MASK << TF_SHIFT)
1038#define AFF (AFF_MASK << AFF_SHIFT)
1039#define APF (APF_MASK << APF_SHIFT)
1040#define TLBMF (TLBMF_MASK << TLBMF_SHIFT)
1041#define HTWDEEF (HTWDEEF_MASK << HTWDEEF_SHIFT)
1042#define HTWSEEF (HTWSEEF_MASK << HTWSEEF_SHIFT)
1043#define MHF (MHF_MASK << MHF_SHIFT)
1044#define SL (SL_MASK << SL_SHIFT)
1045#define SS (SS_MASK << SS_SHIFT)
1046#define MULTI (MULTI_MASK << MULTI_SHIFT)
1047
1048
1049/* FSYNR0 */
1050#define AMID (AMID_MASK << AMID_SHIFT)
1051#define APID (APID_MASK << APID_SHIFT)
1052#define ABID (ABID_MASK << ABID_SHIFT)
1053#define ATID (ATID_MASK << ATID_SHIFT)
1054
1055
1056/* FSYNR1 */
1057#define AMEMTYPE (AMEMTYPE_MASK << AMEMTYPE_SHIFT)
1058#define ASHARED (ASHARED_MASK << ASHARED_SHIFT)
1059#define AINNERSHARED (AINNERSHARED_MASK << AINNERSHARED_SHIFT)
1060#define APRIV (APRIV_MASK << APRIV_SHIFT)
1061#define APROTNS (APROTNS_MASK << APROTNS_SHIFT)
1062#define AINST (AINST_MASK << AINST_SHIFT)
1063#define AWRITE (AWRITE_MASK << AWRITE_SHIFT)
1064#define ABURST (ABURST_MASK << ABURST_SHIFT)
1065#define ALEN (ALEN_MASK << ALEN_SHIFT)
1066#define FSYNR1_ASIZE (FSYNR1_ASIZE_MASK << FSYNR1_ASIZE_SHIFT)
1067#define ALOCK (ALOCK_MASK << ALOCK_SHIFT)
1068#define AFULL (AFULL_MASK << AFULL_SHIFT)
1069
1070
1071/* NMRR */
1072#define ICPC0 (ICPC0_MASK << ICPC0_SHIFT)
1073#define ICPC1 (ICPC1_MASK << ICPC1_SHIFT)
1074#define ICPC2 (ICPC2_MASK << ICPC2_SHIFT)
1075#define ICPC3 (ICPC3_MASK << ICPC3_SHIFT)
1076#define ICPC4 (ICPC4_MASK << ICPC4_SHIFT)
1077#define ICPC5 (ICPC5_MASK << ICPC5_SHIFT)
1078#define ICPC6 (ICPC6_MASK << ICPC6_SHIFT)
1079#define ICPC7 (ICPC7_MASK << ICPC7_SHIFT)
1080#define OCPC0 (OCPC0_MASK << OCPC0_SHIFT)
1081#define OCPC1 (OCPC1_MASK << OCPC1_SHIFT)
1082#define OCPC2 (OCPC2_MASK << OCPC2_SHIFT)
1083#define OCPC3 (OCPC3_MASK << OCPC3_SHIFT)
1084#define OCPC4 (OCPC4_MASK << OCPC4_SHIFT)
1085#define OCPC5 (OCPC5_MASK << OCPC5_SHIFT)
1086#define OCPC6 (OCPC6_MASK << OCPC6_SHIFT)
1087#define OCPC7 (OCPC7_MASK << OCPC7_SHIFT)
1088
1089
1090/* PAR */
1091#define FAULT (FAULT_MASK << FAULT_SHIFT)
1092/* If a fault is present, these are the
1093same as the fault fields in the FAR */
1094#define FAULT_TF (FAULT_TF_MASK << FAULT_TF_SHIFT)
1095#define FAULT_AFF (FAULT_AFF_MASK << FAULT_AFF_SHIFT)
1096#define FAULT_APF (FAULT_APF_MASK << FAULT_APF_SHIFT)
1097#define FAULT_TLBMF (FAULT_TLBMF_MASK << FAULT_TLBMF_SHIFT)
1098#define FAULT_HTWDEEF (FAULT_HTWDEEF_MASK << FAULT_HTWDEEF_SHIFT)
1099#define FAULT_HTWSEEF (FAULT_HTWSEEF_MASK << FAULT_HTWSEEF_SHIFT)
1100#define FAULT_MHF (FAULT_MHF_MASK << FAULT_MHF_SHIFT)
1101#define FAULT_SL (FAULT_SL_MASK << FAULT_SL_SHIFT)
1102#define FAULT_SS (FAULT_SS_MASK << FAULT_SS_SHIFT)
1103
1104/* If NO fault is present, the following fields are in effect */
1105/* (FAULT remains as before) */
1106#define PAR_NOFAULT_SS (PAR_NOFAULT_SS_MASK << PAR_NOFAULT_SS_SHIFT)
1107#define PAR_NOFAULT_MT (PAR_NOFAULT_MT_MASK << PAR_NOFAULT_MT_SHIFT)
1108#define PAR_NOFAULT_SH (PAR_NOFAULT_SH_MASK << PAR_NOFAULT_SH_SHIFT)
1109#define PAR_NOFAULT_NS (PAR_NOFAULT_NS_MASK << PAR_NOFAULT_NS_SHIFT)
1110#define PAR_NOFAULT_NOS (PAR_NOFAULT_NOS_MASK << PAR_NOFAULT_NOS_SHIFT)
1111#define PAR_NPFAULT_PA (PAR_NPFAULT_PA_MASK << PAR_NPFAULT_PA_SHIFT)
1112
1113
1114/* PRRR */
1115#define MTC0 (MTC0_MASK << MTC0_SHIFT)
1116#define MTC1 (MTC1_MASK << MTC1_SHIFT)
1117#define MTC2 (MTC2_MASK << MTC2_SHIFT)
1118#define MTC3 (MTC3_MASK << MTC3_SHIFT)
1119#define MTC4 (MTC4_MASK << MTC4_SHIFT)
1120#define MTC5 (MTC5_MASK << MTC5_SHIFT)
1121#define MTC6 (MTC6_MASK << MTC6_SHIFT)
1122#define MTC7 (MTC7_MASK << MTC7_SHIFT)
1123#define SHDSH0 (SHDSH0_MASK << SHDSH0_SHIFT)
1124#define SHDSH1 (SHDSH1_MASK << SHDSH1_SHIFT)
1125#define SHNMSH0 (SHNMSH0_MASK << SHNMSH0_SHIFT)
1126#define SHNMSH1 (SHNMSH1_MASK << SHNMSH1_SHIFT)
1127#define NOS0 (NOS0_MASK << NOS0_SHIFT)
1128#define NOS1 (NOS1_MASK << NOS1_SHIFT)
1129#define NOS2 (NOS2_MASK << NOS2_SHIFT)
1130#define NOS3 (NOS3_MASK << NOS3_SHIFT)
1131#define NOS4 (NOS4_MASK << NOS4_SHIFT)
1132#define NOS5 (NOS5_MASK << NOS5_SHIFT)
1133#define NOS6 (NOS6_MASK << NOS6_SHIFT)
1134#define NOS7 (NOS7_MASK << NOS7_SHIFT)
1135
1136
1137/* RESUME */
1138#define TNR (TNR_MASK << TNR_SHIFT)
1139
1140
1141/* SCTLR */
1142#define M (M_MASK << M_SHIFT)
1143#define TRE (TRE_MASK << TRE_SHIFT)
1144#define AFE (AFE_MASK << AFE_SHIFT)
1145#define HAF (HAF_MASK << HAF_SHIFT)
1146#define BE (BE_MASK << BE_SHIFT)
1147#define AFFD (AFFD_MASK << AFFD_SHIFT)
1148
1149
1150/* TLBIASID */
1151#define TLBIASID_ASID (TLBIASID_ASID_MASK << TLBIASID_ASID_SHIFT)
1152
1153
1154/* TLBIVA */
1155#define TLBIVA_ASID (TLBIVA_ASID_MASK << TLBIVA_ASID_SHIFT)
1156#define TLBIVA_VA (TLBIVA_VA_MASK << TLBIVA_VA_SHIFT)
1157
1158
1159/* TLBIVAA */
1160#define TLBIVAA_VA (TLBIVAA_VA_MASK << TLBIVAA_VA_SHIFT)
1161
1162
1163/* TLBLCKR */
1164#define LKE (LKE_MASK << LKE_SHIFT)
1165#define TLBLCKR_TLBIALLCFG (TLBLCKR_TLBIALLCFG_MASK<<TLBLCKR_TLBIALLCFG_SHIFT)
1166#define TLBIASIDCFG (TLBIASIDCFG_MASK << TLBIASIDCFG_SHIFT)
1167#define TLBIVAACFG (TLBIVAACFG_MASK << TLBIVAACFG_SHIFT)
1168#define FLOOR (FLOOR_MASK << FLOOR_SHIFT)
1169#define VICTIM (VICTIM_MASK << VICTIM_SHIFT)
1170
1171
1172/* TTBCR */
1173#define N (N_MASK << N_SHIFT)
1174#define PD0 (PD0_MASK << PD0_SHIFT)
1175#define PD1 (PD1_MASK << PD1_SHIFT)
1176
1177
1178/* TTBR0 */
1179#define TTBR0_IRGNH (TTBR0_IRGNH_MASK << TTBR0_IRGNH_SHIFT)
1180#define TTBR0_SH (TTBR0_SH_MASK << TTBR0_SH_SHIFT)
1181#define TTBR0_ORGN (TTBR0_ORGN_MASK << TTBR0_ORGN_SHIFT)
1182#define TTBR0_NOS (TTBR0_NOS_MASK << TTBR0_NOS_SHIFT)
1183#define TTBR0_IRGNL (TTBR0_IRGNL_MASK << TTBR0_IRGNL_SHIFT)
1184#define TTBR0_PA (TTBR0_PA_MASK << TTBR0_PA_SHIFT)
1185
1186
1187/* TTBR1 */
1188#define TTBR1_IRGNH (TTBR1_IRGNH_MASK << TTBR1_IRGNH_SHIFT)
1189#define TTBR1_SH (TTBR1_SH_MASK << TTBR1_SH_SHIFT)
1190#define TTBR1_ORGN (TTBR1_ORGN_MASK << TTBR1_ORGN_SHIFT)
1191#define TTBR1_NOS (TTBR1_NOS_MASK << TTBR1_NOS_SHIFT)
1192#define TTBR1_IRGNL (TTBR1_IRGNL_MASK << TTBR1_IRGNL_SHIFT)
1193#define TTBR1_PA (TTBR1_PA_MASK << TTBR1_PA_SHIFT)
1194
1195
1196/* V2PSR */
1197#define HIT (HIT_MASK << HIT_SHIFT)
1198#define INDEX (INDEX_MASK << INDEX_SHIFT)
1199
1200
1201/* V2Pxx */
1202#define V2Pxx_INDEX (V2Pxx_INDEX_MASK << V2Pxx_INDEX_SHIFT)
1203#define V2Pxx_VA (V2Pxx_VA_MASK << V2Pxx_VA_SHIFT)
1204
1205
1206/* Global Register Masks */
1207/* CBACRn */
1208#define RWVMID_MASK 0x1F
1209#define RWE_MASK 0x01
1210#define RWGE_MASK 0x01
1211#define CBVMID_MASK 0x1F
1212#define IRPTNDX_MASK 0xFF
1213
1214
1215/* CR */
1216#define RPUE_MASK 0x01
1217#define RPUERE_MASK 0x01
1218#define RPUEIE_MASK 0x01
1219#define DCDEE_MASK 0x01
1220#define CLIENTPD_MASK 0x01
1221#define STALLD_MASK 0x01
1222#define TLBLKCRWE_MASK 0x01
1223#define CR_TLBIALLCFG_MASK 0x01
1224#define TLBIVMIDCFG_MASK 0x01
1225#define CR_HUME_MASK 0x01
1226
1227
1228/* ESR */
1229#define CFG_MASK 0x01
1230#define BYPASS_MASK 0x01
1231#define ESR_MULTI_MASK 0x01
1232
1233
1234/* ESYNR0 */
1235#define ESYNR0_AMID_MASK 0xFF
1236#define ESYNR0_APID_MASK 0x1F
1237#define ESYNR0_ABID_MASK 0x07
1238#define ESYNR0_AVMID_MASK 0x1F
1239#define ESYNR0_ATID_MASK 0xFF
1240
1241
1242/* ESYNR1 */
1243#define ESYNR1_AMEMTYPE_MASK 0x07
1244#define ESYNR1_ASHARED_MASK 0x01
1245#define ESYNR1_AINNERSHARED_MASK 0x01
1246#define ESYNR1_APRIV_MASK 0x01
1247#define ESYNR1_APROTNS_MASK 0x01
1248#define ESYNR1_AINST_MASK 0x01
1249#define ESYNR1_AWRITE_MASK 0x01
1250#define ESYNR1_ABURST_MASK 0x01
1251#define ESYNR1_ALEN_MASK 0x0F
1252#define ESYNR1_ASIZE_MASK 0x01
1253#define ESYNR1_ALOCK_MASK 0x03
1254#define ESYNR1_AOOO_MASK 0x01
1255#define ESYNR1_AFULL_MASK 0x01
1256#define ESYNR1_AC_MASK 0x01
1257#define ESYNR1_DCD_MASK 0x01
1258
1259
1260/* IDR */
1261#define NM2VCBMT_MASK 0x1FF
1262#define HTW_MASK 0x01
1263#define HUM_MASK 0x01
1264#define TLBSIZE_MASK 0x0F
1265#define NCB_MASK 0xFF
1266#define NIRPT_MASK 0xFF
1267
1268
1269/* M2VCBRn */
1270#define VMID_MASK 0x1F
1271#define CBNDX_MASK 0xFF
1272#define BYPASSD_MASK 0x01
1273#define BPRCOSH_MASK 0x01
1274#define BPRCISH_MASK 0x01
1275#define BPRCNSH_MASK 0x01
1276#define BPSHCFG_MASK 0x03
1277#define NSCFG_MASK 0x03
1278#define BPMTCFG_MASK 0x01
1279#define BPMEMTYPE_MASK 0x07
1280
1281
1282/* REV */
1283#define MINOR_MASK 0x0F
1284#define MAJOR_MASK 0x0F
1285
1286
1287/* TESTBUSCR */
1288#define TBE_MASK 0x01
1289#define SPDMBE_MASK 0x01
1290#define WGSEL_MASK 0x03
1291#define TBLSEL_MASK 0x03
1292#define TBHSEL_MASK 0x03
1293#define SPDM0SEL_MASK 0x0F
1294#define SPDM1SEL_MASK 0x0F
1295#define SPDM2SEL_MASK 0x0F
1296#define SPDM3SEL_MASK 0x0F
1297
1298
1299/* TLBIMID */
1300#define TLBIVMID_VMID_MASK 0x1F
1301
1302
1303/* TLBRSW */
1304#define TLBRSW_INDEX_MASK 0xFF
1305#define TLBBFBS_MASK 0x03
1306
1307
1308/* TLBTR0 */
1309#define PR_MASK 0x01
1310#define PW_MASK 0x01
1311#define UR_MASK 0x01
1312#define UW_MASK 0x01
1313#define XN_MASK 0x01
1314#define NSDESC_MASK 0x01
1315#define ISH_MASK 0x01
1316#define SH_MASK 0x01
1317#define MT_MASK 0x07
1318#define DPSIZR_MASK 0x07
1319#define DPSIZC_MASK 0x07
1320
1321
1322/* TLBTR1 */
1323#define TLBTR1_VMID_MASK 0x1F
1324#define TLBTR1_PA_MASK 0x000FFFFF
1325
1326
1327/* TLBTR2 */
1328#define TLBTR2_ASID_MASK 0xFF
1329#define TLBTR2_V_MASK 0x01
1330#define TLBTR2_NSTID_MASK 0x01
1331#define TLBTR2_NV_MASK 0x01
1332#define TLBTR2_VA_MASK 0x000FFFFF
1333
1334
1335/* Global Register Shifts */
1336/* CBACRn */
1337#define RWVMID_SHIFT 0
1338#define RWE_SHIFT 8
1339#define RWGE_SHIFT 9
1340#define CBVMID_SHIFT 16
1341#define IRPTNDX_SHIFT 24
1342
1343
1344/* CR */
1345#define RPUE_SHIFT 0
1346#define RPUERE_SHIFT 1
1347#define RPUEIE_SHIFT 2
1348#define DCDEE_SHIFT 3
1349#define CLIENTPD_SHIFT 4
1350#define STALLD_SHIFT 5
1351#define TLBLKCRWE_SHIFT 6
1352#define CR_TLBIALLCFG_SHIFT 7
1353#define TLBIVMIDCFG_SHIFT 8
1354#define CR_HUME_SHIFT 9
1355
1356
1357/* ESR */
1358#define CFG_SHIFT 0
1359#define BYPASS_SHIFT 1
1360#define ESR_MULTI_SHIFT 31
1361
1362
1363/* ESYNR0 */
1364#define ESYNR0_AMID_SHIFT 0
1365#define ESYNR0_APID_SHIFT 8
1366#define ESYNR0_ABID_SHIFT 13
1367#define ESYNR0_AVMID_SHIFT 16
1368#define ESYNR0_ATID_SHIFT 24
1369
1370
1371/* ESYNR1 */
1372#define ESYNR1_AMEMTYPE_SHIFT 0
1373#define ESYNR1_ASHARED_SHIFT 3
1374#define ESYNR1_AINNERSHARED_SHIFT 4
1375#define ESYNR1_APRIV_SHIFT 5
1376#define ESYNR1_APROTNS_SHIFT 6
1377#define ESYNR1_AINST_SHIFT 7
1378#define ESYNR1_AWRITE_SHIFT 8
1379#define ESYNR1_ABURST_SHIFT 10
1380#define ESYNR1_ALEN_SHIFT 12
1381#define ESYNR1_ASIZE_SHIFT 16
1382#define ESYNR1_ALOCK_SHIFT 20
1383#define ESYNR1_AOOO_SHIFT 22
1384#define ESYNR1_AFULL_SHIFT 24
1385#define ESYNR1_AC_SHIFT 30
1386#define ESYNR1_DCD_SHIFT 31
1387
1388
1389/* IDR */
1390#define NM2VCBMT_SHIFT 0
1391#define HTW_SHIFT 9
1392#define HUM_SHIFT 10
1393#define TLBSIZE_SHIFT 12
1394#define NCB_SHIFT 16
1395#define NIRPT_SHIFT 24
1396
1397
1398/* M2VCBRn */
1399#define VMID_SHIFT 0
1400#define CBNDX_SHIFT 8
1401#define BYPASSD_SHIFT 16
1402#define BPRCOSH_SHIFT 17
1403#define BPRCISH_SHIFT 18
1404#define BPRCNSH_SHIFT 19
1405#define BPSHCFG_SHIFT 20
1406#define NSCFG_SHIFT 22
1407#define BPMTCFG_SHIFT 24
1408#define BPMEMTYPE_SHIFT 25
1409
1410
1411/* REV */
1412#define MINOR_SHIFT 0
1413#define MAJOR_SHIFT 4
1414
1415
1416/* TESTBUSCR */
1417#define TBE_SHIFT 0
1418#define SPDMBE_SHIFT 1
1419#define WGSEL_SHIFT 8
1420#define TBLSEL_SHIFT 12
1421#define TBHSEL_SHIFT 14
1422#define SPDM0SEL_SHIFT 16
1423#define SPDM1SEL_SHIFT 20
1424#define SPDM2SEL_SHIFT 24
1425#define SPDM3SEL_SHIFT 28
1426
1427
1428/* TLBIMID */
1429#define TLBIVMID_VMID_SHIFT 0
1430
1431
1432/* TLBRSW */
1433#define TLBRSW_INDEX_SHIFT 0
1434#define TLBBFBS_SHIFT 8
1435
1436
1437/* TLBTR0 */
1438#define PR_SHIFT 0
1439#define PW_SHIFT 1
1440#define UR_SHIFT 2
1441#define UW_SHIFT 3
1442#define XN_SHIFT 4
1443#define NSDESC_SHIFT 6
1444#define ISH_SHIFT 7
1445#define SH_SHIFT 8
1446#define MT_SHIFT 9
1447#define DPSIZR_SHIFT 16
1448#define DPSIZC_SHIFT 20
1449
1450
1451/* TLBTR1 */
1452#define TLBTR1_VMID_SHIFT 0
1453#define TLBTR1_PA_SHIFT 12
1454
1455
1456/* TLBTR2 */
1457#define TLBTR2_ASID_SHIFT 0
1458#define TLBTR2_V_SHIFT 8
1459#define TLBTR2_NSTID_SHIFT 9
1460#define TLBTR2_NV_SHIFT 10
1461#define TLBTR2_VA_SHIFT 12
1462
1463
1464/* Context Register Masks */
1465/* ACTLR */
1466#define CFERE_MASK 0x01
1467#define CFEIE_MASK 0x01
1468#define PTSHCFG_MASK 0x03
1469#define RCOSH_MASK 0x01
1470#define RCISH_MASK 0x01
1471#define RCNSH_MASK 0x01
1472#define PRIVCFG_MASK 0x03
1473#define DNA_MASK 0x01
1474#define DNLV2PA_MASK 0x01
1475#define TLBMCFG_MASK 0x03
1476#define CFCFG_MASK 0x01
1477#define TIPCF_MASK 0x01
1478#define V2PCFG_MASK 0x03
1479#define HUME_MASK 0x01
1480#define PTMTCFG_MASK 0x01
1481#define PTMEMTYPE_MASK 0x07
1482
1483
1484/* BFBCR */
1485#define BFBDFE_MASK 0x01
1486#define BFBSFE_MASK 0x01
1487#define SFVS_MASK 0x01
1488#define FLVIC_MASK 0x0F
1489#define SLVIC_MASK 0x0F
1490
1491
1492/* CONTEXTIDR */
1493#define CONTEXTIDR_ASID_MASK 0xFF
1494#define PROCID_MASK 0x00FFFFFF
1495
1496
1497/* FSR */
1498#define TF_MASK 0x01
1499#define AFF_MASK 0x01
1500#define APF_MASK 0x01
1501#define TLBMF_MASK 0x01
1502#define HTWDEEF_MASK 0x01
1503#define HTWSEEF_MASK 0x01
1504#define MHF_MASK 0x01
1505#define SL_MASK 0x01
1506#define SS_MASK 0x01
1507#define MULTI_MASK 0x01
1508
1509
1510/* FSYNR0 */
1511#define AMID_MASK 0xFF
1512#define APID_MASK 0x1F
1513#define ABID_MASK 0x07
1514#define ATID_MASK 0xFF
1515
1516
1517/* FSYNR1 */
1518#define AMEMTYPE_MASK 0x07
1519#define ASHARED_MASK 0x01
1520#define AINNERSHARED_MASK 0x01
1521#define APRIV_MASK 0x01
1522#define APROTNS_MASK 0x01
1523#define AINST_MASK 0x01
1524#define AWRITE_MASK 0x01
1525#define ABURST_MASK 0x01
1526#define ALEN_MASK 0x0F
1527#define FSYNR1_ASIZE_MASK 0x07
1528#define ALOCK_MASK 0x03
1529#define AFULL_MASK 0x01
1530
1531
1532/* NMRR */
1533#define ICPC0_MASK 0x03
1534#define ICPC1_MASK 0x03
1535#define ICPC2_MASK 0x03
1536#define ICPC3_MASK 0x03
1537#define ICPC4_MASK 0x03
1538#define ICPC5_MASK 0x03
1539#define ICPC6_MASK 0x03
1540#define ICPC7_MASK 0x03
1541#define OCPC0_MASK 0x03
1542#define OCPC1_MASK 0x03
1543#define OCPC2_MASK 0x03
1544#define OCPC3_MASK 0x03
1545#define OCPC4_MASK 0x03
1546#define OCPC5_MASK 0x03
1547#define OCPC6_MASK 0x03
1548#define OCPC7_MASK 0x03
1549
1550
1551/* PAR */
1552#define FAULT_MASK 0x01
1553/* If a fault is present, these are the
1554same as the fault fields in the FAR */
1555#define FAULT_TF_MASK 0x01
1556#define FAULT_AFF_MASK 0x01
1557#define FAULT_APF_MASK 0x01
1558#define FAULT_TLBMF_MASK 0x01
1559#define FAULT_HTWDEEF_MASK 0x01
1560#define FAULT_HTWSEEF_MASK 0x01
1561#define FAULT_MHF_MASK 0x01
1562#define FAULT_SL_MASK 0x01
1563#define FAULT_SS_MASK 0x01
1564
1565/* If NO fault is present, the following
1566 * fields are in effect
1567 * (FAULT remains as before) */
1568#define PAR_NOFAULT_SS_MASK 0x01
1569#define PAR_NOFAULT_MT_MASK 0x07
1570#define PAR_NOFAULT_SH_MASK 0x01
1571#define PAR_NOFAULT_NS_MASK 0x01
1572#define PAR_NOFAULT_NOS_MASK 0x01
1573#define PAR_NPFAULT_PA_MASK 0x000FFFFF
1574
1575
1576/* PRRR */
1577#define MTC0_MASK 0x03
1578#define MTC1_MASK 0x03
1579#define MTC2_MASK 0x03
1580#define MTC3_MASK 0x03
1581#define MTC4_MASK 0x03
1582#define MTC5_MASK 0x03
1583#define MTC6_MASK 0x03
1584#define MTC7_MASK 0x03
1585#define SHDSH0_MASK 0x01
1586#define SHDSH1_MASK 0x01
1587#define SHNMSH0_MASK 0x01
1588#define SHNMSH1_MASK 0x01
1589#define NOS0_MASK 0x01
1590#define NOS1_MASK 0x01
1591#define NOS2_MASK 0x01
1592#define NOS3_MASK 0x01
1593#define NOS4_MASK 0x01
1594#define NOS5_MASK 0x01
1595#define NOS6_MASK 0x01
1596#define NOS7_MASK 0x01
1597
1598
1599/* RESUME */
1600#define TNR_MASK 0x01
1601
1602
1603/* SCTLR */
1604#define M_MASK 0x01
1605#define TRE_MASK 0x01
1606#define AFE_MASK 0x01
1607#define HAF_MASK 0x01
1608#define BE_MASK 0x01
1609#define AFFD_MASK 0x01
1610
1611
1612/* TLBIASID */
1613#define TLBIASID_ASID_MASK 0xFF
1614
1615
1616/* TLBIVA */
1617#define TLBIVA_ASID_MASK 0xFF
1618#define TLBIVA_VA_MASK 0x000FFFFF
1619
1620
1621/* TLBIVAA */
1622#define TLBIVAA_VA_MASK 0x000FFFFF
1623
1624
1625/* TLBLCKR */
1626#define LKE_MASK 0x01
1627#define TLBLCKR_TLBIALLCFG_MASK 0x01
1628#define TLBIASIDCFG_MASK 0x01
1629#define TLBIVAACFG_MASK 0x01
1630#define FLOOR_MASK 0xFF
1631#define VICTIM_MASK 0xFF
1632
1633
1634/* TTBCR */
1635#define N_MASK 0x07
1636#define PD0_MASK 0x01
1637#define PD1_MASK 0x01
1638
1639
1640/* TTBR0 */
1641#define TTBR0_IRGNH_MASK 0x01
1642#define TTBR0_SH_MASK 0x01
1643#define TTBR0_ORGN_MASK 0x03
1644#define TTBR0_NOS_MASK 0x01
1645#define TTBR0_IRGNL_MASK 0x01
1646#define TTBR0_PA_MASK 0x0003FFFF
1647
1648
1649/* TTBR1 */
1650#define TTBR1_IRGNH_MASK 0x01
1651#define TTBR1_SH_MASK 0x01
1652#define TTBR1_ORGN_MASK 0x03
1653#define TTBR1_NOS_MASK 0x01
1654#define TTBR1_IRGNL_MASK 0x01
1655#define TTBR1_PA_MASK 0x0003FFFF
1656
1657
1658/* V2PSR */
1659#define HIT_MASK 0x01
1660#define INDEX_MASK 0xFF
1661
1662
1663/* V2Pxx */
1664#define V2Pxx_INDEX_MASK 0xFF
1665#define V2Pxx_VA_MASK 0x000FFFFF
1666
1667
1668/* Context Register Shifts */
1669/* ACTLR */
1670#define CFERE_SHIFT 0
1671#define CFEIE_SHIFT 1
1672#define PTSHCFG_SHIFT 2
1673#define RCOSH_SHIFT 4
1674#define RCISH_SHIFT 5
1675#define RCNSH_SHIFT 6
1676#define PRIVCFG_SHIFT 8
1677#define DNA_SHIFT 10
1678#define DNLV2PA_SHIFT 11
1679#define TLBMCFG_SHIFT 12
1680#define CFCFG_SHIFT 14
1681#define TIPCF_SHIFT 15
1682#define V2PCFG_SHIFT 16
1683#define HUME_SHIFT 18
1684#define PTMTCFG_SHIFT 20
1685#define PTMEMTYPE_SHIFT 21
1686
1687
1688/* BFBCR */
1689#define BFBDFE_SHIFT 0
1690#define BFBSFE_SHIFT 1
1691#define SFVS_SHIFT 2
1692#define FLVIC_SHIFT 4
1693#define SLVIC_SHIFT 8
1694
1695
1696/* CONTEXTIDR */
1697#define CONTEXTIDR_ASID_SHIFT 0
1698#define PROCID_SHIFT 8
1699
1700
1701/* FSR */
1702#define TF_SHIFT 1
1703#define AFF_SHIFT 2
1704#define APF_SHIFT 3
1705#define TLBMF_SHIFT 4
1706#define HTWDEEF_SHIFT 5
1707#define HTWSEEF_SHIFT 6
1708#define MHF_SHIFT 7
1709#define SL_SHIFT 16
1710#define SS_SHIFT 30
1711#define MULTI_SHIFT 31
1712
1713
1714/* FSYNR0 */
1715#define AMID_SHIFT 0
1716#define APID_SHIFT 8
1717#define ABID_SHIFT 13
1718#define ATID_SHIFT 24
1719
1720
1721/* FSYNR1 */
1722#define AMEMTYPE_SHIFT 0
1723#define ASHARED_SHIFT 3
1724#define AINNERSHARED_SHIFT 4
1725#define APRIV_SHIFT 5
1726#define APROTNS_SHIFT 6
1727#define AINST_SHIFT 7
1728#define AWRITE_SHIFT 8
1729#define ABURST_SHIFT 10
1730#define ALEN_SHIFT 12
1731#define FSYNR1_ASIZE_SHIFT 16
1732#define ALOCK_SHIFT 20
1733#define AFULL_SHIFT 24
1734
1735
1736/* NMRR */
1737#define ICPC0_SHIFT 0
1738#define ICPC1_SHIFT 2
1739#define ICPC2_SHIFT 4
1740#define ICPC3_SHIFT 6
1741#define ICPC4_SHIFT 8
1742#define ICPC5_SHIFT 10
1743#define ICPC6_SHIFT 12
1744#define ICPC7_SHIFT 14
1745#define OCPC0_SHIFT 16
1746#define OCPC1_SHIFT 18
1747#define OCPC2_SHIFT 20
1748#define OCPC3_SHIFT 22
1749#define OCPC4_SHIFT 24
1750#define OCPC5_SHIFT 26
1751#define OCPC6_SHIFT 28
1752#define OCPC7_SHIFT 30
1753
1754
1755/* PAR */
1756#define FAULT_SHIFT 0
1757/* If a fault is present, these are the
1758same as the fault fields in the FAR */
1759#define FAULT_TF_SHIFT 1
1760#define FAULT_AFF_SHIFT 2
1761#define FAULT_APF_SHIFT 3
1762#define FAULT_TLBMF_SHIFT 4
1763#define FAULT_HTWDEEF_SHIFT 5
1764#define FAULT_HTWSEEF_SHIFT 6
1765#define FAULT_MHF_SHIFT 7
1766#define FAULT_SL_SHIFT 16
1767#define FAULT_SS_SHIFT 30
1768
1769/* If NO fault is present, the following
1770 * fields are in effect
1771 * (FAULT remains as before) */
1772#define PAR_NOFAULT_SS_SHIFT 1
1773#define PAR_NOFAULT_MT_SHIFT 4
1774#define PAR_NOFAULT_SH_SHIFT 7
1775#define PAR_NOFAULT_NS_SHIFT 9
1776#define PAR_NOFAULT_NOS_SHIFT 10
1777#define PAR_NPFAULT_PA_SHIFT 12
1778
1779
1780/* PRRR */
1781#define MTC0_SHIFT 0
1782#define MTC1_SHIFT 2
1783#define MTC2_SHIFT 4
1784#define MTC3_SHIFT 6
1785#define MTC4_SHIFT 8
1786#define MTC5_SHIFT 10
1787#define MTC6_SHIFT 12
1788#define MTC7_SHIFT 14
1789#define SHDSH0_SHIFT 16
1790#define SHDSH1_SHIFT 17
1791#define SHNMSH0_SHIFT 18
1792#define SHNMSH1_SHIFT 19
1793#define NOS0_SHIFT 24
1794#define NOS1_SHIFT 25
1795#define NOS2_SHIFT 26
1796#define NOS3_SHIFT 27
1797#define NOS4_SHIFT 28
1798#define NOS5_SHIFT 29
1799#define NOS6_SHIFT 30
1800#define NOS7_SHIFT 31
1801
1802
1803/* RESUME */
1804#define TNR_SHIFT 0
1805
1806
1807/* SCTLR */
1808#define M_SHIFT 0
1809#define TRE_SHIFT 1
1810#define AFE_SHIFT 2
1811#define HAF_SHIFT 3
1812#define BE_SHIFT 4
1813#define AFFD_SHIFT 5
1814
1815
1816/* TLBIASID */
1817#define TLBIASID_ASID_SHIFT 0
1818
1819
1820/* TLBIVA */
1821#define TLBIVA_ASID_SHIFT 0
1822#define TLBIVA_VA_SHIFT 12
1823
1824
1825/* TLBIVAA */
1826#define TLBIVAA_VA_SHIFT 12
1827
1828
1829/* TLBLCKR */
1830#define LKE_SHIFT 0
1831#define TLBLCKR_TLBIALLCFG_SHIFT 1
1832#define TLBIASIDCFG_SHIFT 2
1833#define TLBIVAACFG_SHIFT 3
1834#define FLOOR_SHIFT 8
1835#define VICTIM_SHIFT 8
1836
1837
1838/* TTBCR */
1839#define N_SHIFT 3
1840#define PD0_SHIFT 4
1841#define PD1_SHIFT 5
1842
1843
1844/* TTBR0 */
1845#define TTBR0_IRGNH_SHIFT 0
1846#define TTBR0_SH_SHIFT 1
1847#define TTBR0_ORGN_SHIFT 3
1848#define TTBR0_NOS_SHIFT 5
1849#define TTBR0_IRGNL_SHIFT 6
1850#define TTBR0_PA_SHIFT 14
1851
1852
1853/* TTBR1 */
1854#define TTBR1_IRGNH_SHIFT 0
1855#define TTBR1_SH_SHIFT 1
1856#define TTBR1_ORGN_SHIFT 3
1857#define TTBR1_NOS_SHIFT 5
1858#define TTBR1_IRGNL_SHIFT 6
1859#define TTBR1_PA_SHIFT 14
1860
1861
1862/* V2PSR */
1863#define HIT_SHIFT 0
1864#define INDEX_SHIFT 8
1865
1866
1867/* V2Pxx */
1868#define V2Pxx_INDEX_SHIFT 0
1869#define V2Pxx_VA_SHIFT 12
1870
1871#endif
diff --git a/arch/arm/mach-msm/include/mach/irqs-8x60.h b/arch/arm/mach-msm/include/mach/irqs-8x60.h
new file mode 100644
index 000000000000..36074cfc9ad2
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/irqs-8x60.h
@@ -0,0 +1,253 @@
1/* Copyright (c) 2010 Code Aurora Forum. All rights reserved.
2 *
3 * This software is licensed under the terms of the GNU General Public
4 * License version 2, as published by the Free Software Foundation, and
5 * may be copied, distributed, and modified under those terms.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#ifndef __ASM_ARCH_MSM_IRQS_8X60_H
15#define __ASM_ARCH_MSM_IRQS_8X60_H
16
17/* MSM ACPU Interrupt Numbers */
18
19/* 0-15: STI/SGI (software triggered/generated interrupts)
20 * 16-31: PPI (private peripheral interrupts)
21 * 32+: SPI (shared peripheral interrupts)
22 */
23
24#define GIC_PPI_START 16
25#define GIC_SPI_START 32
26
27#define INT_DEBUG_TIMER_EXP (GIC_PPI_START + 0)
28#define INT_GP_TIMER_EXP (GIC_PPI_START + 1)
29#define INT_GP_TIMER2_EXP (GIC_PPI_START + 2)
30#define WDT0_ACCSCSSNBARK_INT (GIC_PPI_START + 3)
31#define WDT1_ACCSCSSNBARK_INT (GIC_PPI_START + 4)
32#define AVS_SVICINT (GIC_PPI_START + 5)
33#define AVS_SVICINTSWDONE (GIC_PPI_START + 6)
34#define CPU_DBGCPUXCOMMRXFULL (GIC_PPI_START + 7)
35#define CPU_DBGCPUXCOMMTXEMPTY (GIC_PPI_START + 8)
36#define CPU_SICCPUXPERFMONIRPTREQ (GIC_PPI_START + 9)
37#define SC_AVSCPUXDOWN (GIC_PPI_START + 10)
38#define SC_AVSCPUXUP (GIC_PPI_START + 11)
39#define SC_SICCPUXACGIRPTREQ (GIC_PPI_START + 12)
40/* PPI 13 to 15 are unused */
41
42
43#define SC_SICMPUIRPTREQ (GIC_SPI_START + 0)
44#define SC_SICL2IRPTREQ (GIC_SPI_START + 1)
45#define SC_SICL2ACGIRPTREQ (GIC_SPI_START + 2)
46#define NC (GIC_SPI_START + 3)
47#define TLMM_SCSS_DIR_CONN_IRQ_0 (GIC_SPI_START + 4)
48#define TLMM_SCSS_DIR_CONN_IRQ_1 (GIC_SPI_START + 5)
49#define TLMM_SCSS_DIR_CONN_IRQ_2 (GIC_SPI_START + 6)
50#define TLMM_SCSS_DIR_CONN_IRQ_3 (GIC_SPI_START + 7)
51#define TLMM_SCSS_DIR_CONN_IRQ_4 (GIC_SPI_START + 8)
52#define TLMM_SCSS_DIR_CONN_IRQ_5 (GIC_SPI_START + 9)
53#define TLMM_SCSS_DIR_CONN_IRQ_6 (GIC_SPI_START + 10)
54#define TLMM_SCSS_DIR_CONN_IRQ_7 (GIC_SPI_START + 11)
55#define TLMM_SCSS_DIR_CONN_IRQ_8 (GIC_SPI_START + 12)
56#define TLMM_SCSS_DIR_CONN_IRQ_9 (GIC_SPI_START + 13)
57#define PM8058_SEC_IRQ_N (GIC_SPI_START + 14)
58#define PM8901_SEC_IRQ_N (GIC_SPI_START + 15)
59#define TLMM_SCSS_SUMMARY_IRQ (GIC_SPI_START + 16)
60#define SPDM_RT_1_IRQ (GIC_SPI_START + 17)
61#define SPDM_DIAG_IRQ (GIC_SPI_START + 18)
62#define RPM_SCSS_CPU0_GP_HIGH_IRQ (GIC_SPI_START + 19)
63#define RPM_SCSS_CPU0_GP_MEDIUM_IRQ (GIC_SPI_START + 20)
64#define RPM_SCSS_CPU0_GP_LOW_IRQ (GIC_SPI_START + 21)
65#define RPM_SCSS_CPU0_WAKE_UP_IRQ (GIC_SPI_START + 22)
66#define RPM_SCSS_CPU1_GP_HIGH_IRQ (GIC_SPI_START + 23)
67#define RPM_SCSS_CPU1_GP_MEDIUM_IRQ (GIC_SPI_START + 24)
68#define RPM_SCSS_CPU1_GP_LOW_IRQ (GIC_SPI_START + 25)
69#define RPM_SCSS_CPU1_WAKE_UP_IRQ (GIC_SPI_START + 26)
70#define SSBI2_2_SC_CPU0_SECURE_INT (GIC_SPI_START + 27)
71#define SSBI2_2_SC_CPU0_NON_SECURE_INT (GIC_SPI_START + 28)
72#define SSBI2_1_SC_CPU0_SECURE_INT (GIC_SPI_START + 29)
73#define SSBI2_1_SC_CPU0_NON_SECURE_INT (GIC_SPI_START + 30)
74#define MSMC_SC_SEC_CE_IRQ (GIC_SPI_START + 31)
75#define MSMC_SC_PRI_CE_IRQ (GIC_SPI_START + 32)
76#define MARM_FIQ (GIC_SPI_START + 33)
77#define MARM_IRQ (GIC_SPI_START + 34)
78#define MARM_L2CC_IRQ (GIC_SPI_START + 35)
79#define MARM_WDOG_EXPIRED (GIC_SPI_START + 36)
80#define MARM_SCSS_GP_IRQ_0 (GIC_SPI_START + 37)
81#define MARM_SCSS_GP_IRQ_1 (GIC_SPI_START + 38)
82#define MARM_SCSS_GP_IRQ_2 (GIC_SPI_START + 39)
83#define MARM_SCSS_GP_IRQ_3 (GIC_SPI_START + 40)
84#define MARM_SCSS_GP_IRQ_4 (GIC_SPI_START + 41)
85#define MARM_SCSS_GP_IRQ_5 (GIC_SPI_START + 42)
86#define MARM_SCSS_GP_IRQ_6 (GIC_SPI_START + 43)
87#define MARM_SCSS_GP_IRQ_7 (GIC_SPI_START + 44)
88#define MARM_SCSS_GP_IRQ_8 (GIC_SPI_START + 45)
89#define MARM_SCSS_GP_IRQ_9 (GIC_SPI_START + 46)
90#define VPE_IRQ (GIC_SPI_START + 47)
91#define VFE_IRQ (GIC_SPI_START + 48)
92#define VCODEC_IRQ (GIC_SPI_START + 49)
93#define TV_ENC_IRQ (GIC_SPI_START + 50)
94#define SMMU_VPE_CB_SC_SECURE_IRQ (GIC_SPI_START + 51)
95#define SMMU_VPE_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 52)
96#define SMMU_VFE_CB_SC_SECURE_IRQ (GIC_SPI_START + 53)
97#define SMMU_VFE_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 54)
98#define SMMU_VCODEC_B_CB_SC_SECURE_IRQ (GIC_SPI_START + 55)
99#define SMMU_VCODEC_B_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 56)
100#define SMMU_VCODEC_A_CB_SC_SECURE_IRQ (GIC_SPI_START + 57)
101#define SMMU_VCODEC_A_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 58)
102#define SMMU_ROT_CB_SC_SECURE_IRQ (GIC_SPI_START + 59)
103#define SMMU_ROT_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 60)
104#define SMMU_MDP1_CB_SC_SECURE_IRQ (GIC_SPI_START + 61)
105#define SMMU_MDP1_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 62)
106#define SMMU_MDP0_CB_SC_SECURE_IRQ (GIC_SPI_START + 63)
107#define SMMU_MDP0_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 64)
108#define SMMU_JPEGD_CB_SC_SECURE_IRQ (GIC_SPI_START + 65)
109#define SMMU_JPEGD_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 66)
110#define SMMU_IJPEG_CB_SC_SECURE_IRQ (GIC_SPI_START + 67)
111#define SMMU_IJPEG_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 68)
112#define SMMU_GFX3D_CB_SC_SECURE_IRQ (GIC_SPI_START + 69)
113#define SMMU_GFX3D_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 70)
114#define SMMU_GFX2D0_CB_SC_SECURE_IRQ (GIC_SPI_START + 71)
115#define SMMU_GFX2D0_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 72)
116#define ROT_IRQ (GIC_SPI_START + 73)
117#define MMSS_FABRIC_IRQ (GIC_SPI_START + 74)
118#define MDP_IRQ (GIC_SPI_START + 75)
119#define JPEGD_IRQ (GIC_SPI_START + 76)
120#define JPEG_IRQ (GIC_SPI_START + 77)
121#define MMSS_IMEM_IRQ (GIC_SPI_START + 78)
122#define HDMI_IRQ (GIC_SPI_START + 79)
123#define GFX3D_IRQ (GIC_SPI_START + 80)
124#define GFX2D0_IRQ (GIC_SPI_START + 81)
125#define DSI_IRQ (GIC_SPI_START + 82)
126#define CSI_1_IRQ (GIC_SPI_START + 83)
127#define CSI_0_IRQ (GIC_SPI_START + 84)
128#define LPASS_SCSS_AUDIO_IF_OUT0_IRQ (GIC_SPI_START + 85)
129#define LPASS_SCSS_MIDI_IRQ (GIC_SPI_START + 86)
130#define LPASS_Q6SS_WDOG_EXPIRED (GIC_SPI_START + 87)
131#define LPASS_SCSS_GP_LOW_IRQ (GIC_SPI_START + 88)
132#define LPASS_SCSS_GP_MEDIUM_IRQ (GIC_SPI_START + 89)
133#define LPASS_SCSS_GP_HIGH_IRQ (GIC_SPI_START + 90)
134#define TOP_IMEM_IRQ (GIC_SPI_START + 91)
135#define FABRIC_SYS_IRQ (GIC_SPI_START + 92)
136#define FABRIC_APPS_IRQ (GIC_SPI_START + 93)
137#define USB1_HS_BAM_IRQ (GIC_SPI_START + 94)
138#define SDC4_BAM_IRQ (GIC_SPI_START + 95)
139#define SDC3_BAM_IRQ (GIC_SPI_START + 96)
140#define SDC2_BAM_IRQ (GIC_SPI_START + 97)
141#define SDC1_BAM_IRQ (GIC_SPI_START + 98)
142#define FABRIC_SPS_IRQ (GIC_SPI_START + 99)
143#define USB1_HS_IRQ (GIC_SPI_START + 100)
144#define SDC4_IRQ_0 (GIC_SPI_START + 101)
145#define SDC3_IRQ_0 (GIC_SPI_START + 102)
146#define SDC2_IRQ_0 (GIC_SPI_START + 103)
147#define SDC1_IRQ_0 (GIC_SPI_START + 104)
148#define SPS_BAM_DMA_IRQ (GIC_SPI_START + 105)
149#define SPS_SEC_VIOL_IRQ (GIC_SPI_START + 106)
150#define SPS_MTI_0 (GIC_SPI_START + 107)
151#define SPS_MTI_1 (GIC_SPI_START + 108)
152#define SPS_MTI_2 (GIC_SPI_START + 109)
153#define SPS_MTI_3 (GIC_SPI_START + 110)
154#define SPS_MTI_4 (GIC_SPI_START + 111)
155#define SPS_MTI_5 (GIC_SPI_START + 112)
156#define SPS_MTI_6 (GIC_SPI_START + 113)
157#define SPS_MTI_7 (GIC_SPI_START + 114)
158#define SPS_MTI_8 (GIC_SPI_START + 115)
159#define SPS_MTI_9 (GIC_SPI_START + 116)
160#define SPS_MTI_10 (GIC_SPI_START + 117)
161#define SPS_MTI_11 (GIC_SPI_START + 118)
162#define SPS_MTI_12 (GIC_SPI_START + 119)
163#define SPS_MTI_13 (GIC_SPI_START + 120)
164#define SPS_MTI_14 (GIC_SPI_START + 121)
165#define SPS_MTI_15 (GIC_SPI_START + 122)
166#define SPS_MTI_16 (GIC_SPI_START + 123)
167#define SPS_MTI_17 (GIC_SPI_START + 124)
168#define SPS_MTI_18 (GIC_SPI_START + 125)
169#define SPS_MTI_19 (GIC_SPI_START + 126)
170#define SPS_MTI_20 (GIC_SPI_START + 127)
171#define SPS_MTI_21 (GIC_SPI_START + 128)
172#define SPS_MTI_22 (GIC_SPI_START + 129)
173#define SPS_MTI_23 (GIC_SPI_START + 130)
174#define SPS_MTI_24 (GIC_SPI_START + 131)
175#define SPS_MTI_25 (GIC_SPI_START + 132)
176#define SPS_MTI_26 (GIC_SPI_START + 133)
177#define SPS_MTI_27 (GIC_SPI_START + 134)
178#define SPS_MTI_28 (GIC_SPI_START + 135)
179#define SPS_MTI_29 (GIC_SPI_START + 136)
180#define SPS_MTI_30 (GIC_SPI_START + 137)
181#define SPS_MTI_31 (GIC_SPI_START + 138)
182#define UXMC_EBI2_WR_ER_DONE_IRQ (GIC_SPI_START + 139)
183#define UXMC_EBI2_OP_DONE_IRQ (GIC_SPI_START + 140)
184#define USB2_IRQ (GIC_SPI_START + 141)
185#define USB1_IRQ (GIC_SPI_START + 142)
186#define TSSC_SSBI_IRQ (GIC_SPI_START + 143)
187#define TSSC_SAMPLE_IRQ (GIC_SPI_START + 144)
188#define TSSC_PENUP_IRQ (GIC_SPI_START + 145)
189#define INT_UART1DM_IRQ (GIC_SPI_START + 146)
190#define GSBI1_QUP_IRQ (GIC_SPI_START + 147)
191#define INT_UART2DM_IRQ (GIC_SPI_START + 148)
192#define GSBI2_QUP_IRQ (GIC_SPI_START + 149)
193#define INT_UART3DM_IRQ (GIC_SPI_START + 150)
194#define GSBI3_QUP_IRQ (GIC_SPI_START + 151)
195#define INT_UART4DM_IRQ (GIC_SPI_START + 152)
196#define GSBI4_QUP_IRQ (GIC_SPI_START + 153)
197#define INT_UART5DM_IRQ (GIC_SPI_START + 154)
198#define GSBI5_QUP_IRQ (GIC_SPI_START + 155)
199#define INT_UART6DM_IRQ (GIC_SPI_START + 156)
200#define GSBI6_QUP_IRQ (GIC_SPI_START + 157)
201#define INT_UART7DM_IRQ (GIC_SPI_START + 158)
202#define GSBI7_QUP_IRQ (GIC_SPI_START + 159)
203#define INT_UART8DM_IRQ (GIC_SPI_START + 160)
204#define GSBI8_QUP_IRQ (GIC_SPI_START + 161)
205#define TSIF_TSPP_IRQ (GIC_SPI_START + 162)
206#define TSIF_BAM_IRQ (GIC_SPI_START + 163)
207#define TSIF2_IRQ (GIC_SPI_START + 164)
208#define TSIF1_IRQ (GIC_SPI_START + 165)
209#define INT_ADM1_MASTER (GIC_SPI_START + 166)
210#define INT_ADM1_AARM (GIC_SPI_START + 167)
211#define INT_ADM1_SD2 (GIC_SPI_START + 168)
212#define INT_ADM1_SD3 (GIC_SPI_START + 169)
213#define INT_ADM0_MASTER (GIC_SPI_START + 170)
214#define INT_ADM0_AARM (GIC_SPI_START + 171)
215#define INT_ADM0_SD2 (GIC_SPI_START + 172)
216#define INT_ADM0_SD3 (GIC_SPI_START + 173)
217#define CC_SCSS_WDT1CPU1BITEEXPIRED (GIC_SPI_START + 174)
218#define CC_SCSS_WDT1CPU0BITEEXPIRED (GIC_SPI_START + 175)
219#define CC_SCSS_WDT0CPU1BITEEXPIRED (GIC_SPI_START + 176)
220#define CC_SCSS_WDT0CPU0BITEEXPIRED (GIC_SPI_START + 177)
221#define TSENS_UPPER_LOWER_INT (GIC_SPI_START + 178)
222#define SSBI2_2_SC_CPU1_SECURE_INT (GIC_SPI_START + 179)
223#define SSBI2_2_SC_CPU1_NON_SECURE_INT (GIC_SPI_START + 180)
224#define SSBI2_1_SC_CPU1_SECURE_INT (GIC_SPI_START + 181)
225#define SSBI2_1_SC_CPU1_NON_SECURE_INT (GIC_SPI_START + 182)
226#define XPU_SUMMARY_IRQ (GIC_SPI_START + 183)
227#define BUS_EXCEPTION_SUMMARY_IRQ (GIC_SPI_START + 184)
228#define HSDDRX_SMICH0_IRQ (GIC_SPI_START + 185)
229#define HSDDRX_EBI1_IRQ (GIC_SPI_START + 186)
230#define SDC5_BAM_IRQ (GIC_SPI_START + 187)
231#define SDC5_IRQ_0 (GIC_SPI_START + 188)
232#define INT_UART9DM_IRQ (GIC_SPI_START + 189)
233#define GSBI9_QUP_IRQ (GIC_SPI_START + 190)
234#define INT_UART10DM_IRQ (GIC_SPI_START + 191)
235#define GSBI10_QUP_IRQ (GIC_SPI_START + 192)
236#define INT_UART11DM_IRQ (GIC_SPI_START + 193)
237#define GSBI11_QUP_IRQ (GIC_SPI_START + 194)
238#define INT_UART12DM_IRQ (GIC_SPI_START + 195)
239#define GSBI12_QUP_IRQ (GIC_SPI_START + 196)
240/*SPI 197 to 216 arent used in 8x60*/
241#define SMPSS_SPARE_1 (GIC_SPI_START + 217)
242#define SMPSS_SPARE_2 (GIC_SPI_START + 218)
243#define SMPSS_SPARE_3 (GIC_SPI_START + 219)
244#define SMPSS_SPARE_4 (GIC_SPI_START + 220)
245#define SMPSS_SPARE_5 (GIC_SPI_START + 221)
246#define SMPSS_SPARE_6 (GIC_SPI_START + 222)
247#define SMPSS_SPARE_7 (GIC_SPI_START + 223)
248
249#define NR_GPIO_IRQS 173
250#define NR_MSM_IRQS 256
251#define NR_BOARD_IRQS 0
252
253#endif
diff --git a/arch/arm/mach-msm/include/mach/irqs.h b/arch/arm/mach-msm/include/mach/irqs.h
index 164d355c96ea..8679a4564744 100644
--- a/arch/arm/mach-msm/include/mach/irqs.h
+++ b/arch/arm/mach-msm/include/mach/irqs.h
@@ -24,6 +24,8 @@
24#elif defined(CONFIG_ARCH_QSD8X50) 24#elif defined(CONFIG_ARCH_QSD8X50)
25#include "irqs-8x50.h" 25#include "irqs-8x50.h"
26#include "sirc.h" 26#include "sirc.h"
27#elif defined(CONFIG_ARCH_MSM8X60)
28#include "irqs-8x60.h"
27#elif defined(CONFIG_ARCH_MSM_ARM11) 29#elif defined(CONFIG_ARCH_MSM_ARM11)
28#include "irqs-7x00.h" 30#include "irqs-7x00.h"
29#else 31#else
diff --git a/arch/arm/mach-msm/include/mach/memory.h b/arch/arm/mach-msm/include/mach/memory.h
index 50c7847e6002..070e17d237f1 100644
--- a/arch/arm/mach-msm/include/mach/memory.h
+++ b/arch/arm/mach-msm/include/mach/memory.h
@@ -23,6 +23,8 @@
23#define PHYS_OFFSET UL(0x20000000) 23#define PHYS_OFFSET UL(0x20000000)
24#elif defined(CONFIG_ARCH_MSM7X30) 24#elif defined(CONFIG_ARCH_MSM7X30)
25#define PHYS_OFFSET UL(0x00200000) 25#define PHYS_OFFSET UL(0x00200000)
26#elif defined(CONFIG_ARCH_MSM8X60)
27#define PHYS_OFFSET UL(0x40200000)
26#else 28#else
27#define PHYS_OFFSET UL(0x10000000) 29#define PHYS_OFFSET UL(0x10000000)
28#endif 30#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
new file mode 100644
index 000000000000..45bab50e3ee6
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 *
16 * The MSM peripherals are spread all over across 768MB of physical
17 * space, which makes just having a simple IO_ADDRESS macro to slide
18 * them into the right virtual location rough. Instead, we will
19 * provide a master phys->virt mapping for peripherals here.
20 *
21 */
22
23#ifndef __ASM_ARCH_MSM_IOMAP_8X60_H
24#define __ASM_ARCH_MSM_IOMAP_8X60_H
25
26/* Physical base address and size of peripherals.
27 * Ordered by the virtual base addresses they will be mapped at.
28 *
29 * MSM_VIC_BASE must be an value that can be loaded via a "mov"
30 * instruction, otherwise entry-macro.S will not compile.
31 *
32 * If you add or remove entries here, you'll want to edit the
33 * msm_io_desc array in arch/arm/mach-msm/io.c to reflect your
34 * changes.
35 *
36 */
37
38#define MSM_QGIC_DIST_BASE IOMEM(0xF0000000)
39#define MSM_QGIC_DIST_PHYS 0x02080000
40#define MSM_QGIC_DIST_SIZE SZ_4K
41
42#define MSM_QGIC_CPU_BASE IOMEM(0xF0001000)
43#define MSM_QGIC_CPU_PHYS 0x02081000
44#define MSM_QGIC_CPU_SIZE SZ_4K
45
46#define MSM_ACC_BASE IOMEM(0xF0002000)
47#define MSM_ACC_PHYS 0x02001000
48#define MSM_ACC_SIZE SZ_4K
49
50#define MSM_GCC_BASE IOMEM(0xF0003000)
51#define MSM_GCC_PHYS 0x02082000
52#define MSM_GCC_SIZE SZ_4K
53
54#define MSM_TLMM_BASE IOMEM(0xF0004000)
55#define MSM_TLMM_PHYS 0x00800000
56#define MSM_TLMM_SIZE SZ_16K
57
58#define MSM_SHARED_RAM_BASE IOMEM(0xF0100000)
59#define MSM_SHARED_RAM_SIZE SZ_1M
60
61#define MSM_TMR_BASE IOMEM(0xF0200000)
62#define MSM_TMR_PHYS 0x02000000
63#define MSM_TMR_SIZE (SZ_1M)
64
65#define MSM_GPT_BASE (MSM_TMR_BASE + 0x4)
66#define MSM_DGT_BASE (MSM_TMR_BASE + 0x24)
67
68#define MSM_IOMMU_JPEGD_PHYS 0x07300000
69#define MSM_IOMMU_JPEGD_SIZE SZ_1M
70
71#define MSM_IOMMU_VPE_PHYS 0x07400000
72#define MSM_IOMMU_VPE_SIZE SZ_1M
73
74#define MSM_IOMMU_MDP0_PHYS 0x07500000
75#define MSM_IOMMU_MDP0_SIZE SZ_1M
76
77#define MSM_IOMMU_MDP1_PHYS 0x07600000
78#define MSM_IOMMU_MDP1_SIZE SZ_1M
79
80#define MSM_IOMMU_ROT_PHYS 0x07700000
81#define MSM_IOMMU_ROT_SIZE SZ_1M
82
83#define MSM_IOMMU_IJPEG_PHYS 0x07800000
84#define MSM_IOMMU_IJPEG_SIZE SZ_1M
85
86#define MSM_IOMMU_VFE_PHYS 0x07900000
87#define MSM_IOMMU_VFE_SIZE SZ_1M
88
89#define MSM_IOMMU_VCODEC_A_PHYS 0x07A00000
90#define MSM_IOMMU_VCODEC_A_SIZE SZ_1M
91
92#define MSM_IOMMU_VCODEC_B_PHYS 0x07B00000
93#define MSM_IOMMU_VCODEC_B_SIZE SZ_1M
94
95#define MSM_IOMMU_GFX3D_PHYS 0x07C00000
96#define MSM_IOMMU_GFX3D_SIZE SZ_1M
97
98#define MSM_IOMMU_GFX2D0_PHYS 0x07D00000
99#define MSM_IOMMU_GFX2D0_SIZE SZ_1M
100
101#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h
index e6b1821cc4ea..8e24dd812139 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap.h
@@ -47,8 +47,12 @@
47#include "msm_iomap-7x30.h" 47#include "msm_iomap-7x30.h"
48#elif defined(CONFIG_ARCH_QSD8X50) 48#elif defined(CONFIG_ARCH_QSD8X50)
49#include "msm_iomap-8x50.h" 49#include "msm_iomap-8x50.h"
50#elif defined(CONFIG_ARCH_MSM8X60)
51#include "msm_iomap-8x60.h"
50#else 52#else
51#include "msm_iomap-7x00.h" 53#include "msm_iomap-7x00.h"
52#endif 54#endif
53 55
56
57
54#endif 58#endif
diff --git a/arch/arm/mach-msm/include/mach/smp.h b/arch/arm/mach-msm/include/mach/smp.h
new file mode 100644
index 000000000000..3ff7bf5e679e
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/smp.h
@@ -0,0 +1,39 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * * Neither the name of Code Aurora nor
11 * the names of its contributors may be used to endorse or promote
12 * products derived from this software without specific prior written
13 * permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29#ifndef __ASM_ARCH_MSM_SMP_H
30#define __ASM_ARCH_MSM_SMP_H
31
32#include <asm/hardware/gic.h>
33
34static inline void smp_cross_call(const struct cpumask *mask)
35{
36 gic_raise_softirq(mask, 1);
37}
38
39#endif
diff --git a/arch/arm/mach-msm/include/mach/vmalloc.h b/arch/arm/mach-msm/include/mach/vmalloc.h
index 05f81fd8623c..31a32ad062dc 100644
--- a/arch/arm/mach-msm/include/mach/vmalloc.h
+++ b/arch/arm/mach-msm/include/mach/vmalloc.h
@@ -16,7 +16,7 @@
16#ifndef __ASM_ARCH_MSM_VMALLOC_H 16#ifndef __ASM_ARCH_MSM_VMALLOC_H
17#define __ASM_ARCH_MSM_VMALLOC_H 17#define __ASM_ARCH_MSM_VMALLOC_H
18 18
19#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 19#define VMALLOC_END 0xd0000000
20 20
21#endif 21#endif
22 22
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index 1c05060b5f3b..d36b61074146 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -100,6 +100,21 @@ void __init msm_map_qsd8x50_io(void)
100} 100}
101#endif /* CONFIG_ARCH_QSD8X50 */ 101#endif /* CONFIG_ARCH_QSD8X50 */
102 102
103#ifdef CONFIG_ARCH_MSM8X60
104static struct map_desc msm8x60_io_desc[] __initdata = {
105 MSM_DEVICE(QGIC_DIST),
106 MSM_DEVICE(QGIC_CPU),
107 MSM_DEVICE(TMR),
108 MSM_DEVICE(ACC),
109 MSM_DEVICE(GCC),
110};
111
112void __init msm_map_msm8x60_io(void)
113{
114 iotable_init(msm8x60_io_desc, ARRAY_SIZE(msm8x60_io_desc));
115}
116#endif /* CONFIG_ARCH_MSM8X60 */
117
103#ifdef CONFIG_ARCH_MSM7X30 118#ifdef CONFIG_ARCH_MSM7X30
104static struct map_desc msm7x30_io_desc[] __initdata = { 119static struct map_desc msm7x30_io_desc[] __initdata = {
105 MSM_DEVICE(VIC), 120 MSM_DEVICE(VIC),
diff --git a/arch/arm/mach-msm/iommu.c b/arch/arm/mach-msm/iommu.c
new file mode 100644
index 000000000000..f71747db3bee
--- /dev/null
+++ b/arch/arm/mach-msm/iommu.c
@@ -0,0 +1,597 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19#include <linux/kernel.h>
20#include <linux/module.h>
21#include <linux/platform_device.h>
22#include <linux/errno.h>
23#include <linux/io.h>
24#include <linux/interrupt.h>
25#include <linux/list.h>
26#include <linux/spinlock.h>
27#include <linux/slab.h>
28#include <linux/iommu.h>
29
30#include <asm/cacheflush.h>
31#include <asm/sizes.h>
32
33#include <mach/iommu_hw-8xxx.h>
34#include <mach/iommu.h>
35
36DEFINE_SPINLOCK(msm_iommu_lock);
37
38struct msm_priv {
39 unsigned long *pgtable;
40 struct list_head list_attached;
41};
42
43static void __flush_iotlb(struct iommu_domain *domain)
44{
45 struct msm_priv *priv = domain->priv;
46 struct msm_iommu_drvdata *iommu_drvdata;
47 struct msm_iommu_ctx_drvdata *ctx_drvdata;
48
49#ifndef CONFIG_IOMMU_PGTABLES_L2
50 unsigned long *fl_table = priv->pgtable;
51 int i;
52
53 dmac_flush_range(fl_table, fl_table + SZ_16K);
54
55 for (i = 0; i < NUM_FL_PTE; i++)
56 if ((fl_table[i] & 0x03) == FL_TYPE_TABLE) {
57 void *sl_table = __va(fl_table[i] & FL_BASE_MASK);
58 dmac_flush_range(sl_table, sl_table + SZ_4K);
59 }
60#endif
61
62 list_for_each_entry(ctx_drvdata, &priv->list_attached, attached_elm) {
63 if (!ctx_drvdata->pdev || !ctx_drvdata->pdev->dev.parent)
64 BUG();
65
66 iommu_drvdata = dev_get_drvdata(ctx_drvdata->pdev->dev.parent);
67 SET_CTX_TLBIALL(iommu_drvdata->base, ctx_drvdata->num, 0);
68 }
69}
70
71static void __reset_context(void __iomem *base, int ctx)
72{
73 SET_BPRCOSH(base, ctx, 0);
74 SET_BPRCISH(base, ctx, 0);
75 SET_BPRCNSH(base, ctx, 0);
76 SET_BPSHCFG(base, ctx, 0);
77 SET_BPMTCFG(base, ctx, 0);
78 SET_ACTLR(base, ctx, 0);
79 SET_SCTLR(base, ctx, 0);
80 SET_FSRRESTORE(base, ctx, 0);
81 SET_TTBR0(base, ctx, 0);
82 SET_TTBR1(base, ctx, 0);
83 SET_TTBCR(base, ctx, 0);
84 SET_BFBCR(base, ctx, 0);
85 SET_PAR(base, ctx, 0);
86 SET_FAR(base, ctx, 0);
87 SET_CTX_TLBIALL(base, ctx, 0);
88 SET_TLBFLPTER(base, ctx, 0);
89 SET_TLBSLPTER(base, ctx, 0);
90 SET_TLBLKCR(base, ctx, 0);
91 SET_PRRR(base, ctx, 0);
92 SET_NMRR(base, ctx, 0);
93 SET_CONTEXTIDR(base, ctx, 0);
94}
95
96static void __program_context(void __iomem *base, int ctx, phys_addr_t pgtable)
97{
98 __reset_context(base, ctx);
99
100 /* Set up HTW mode */
101 /* TLB miss configuration: perform HTW on miss */
102 SET_TLBMCFG(base, ctx, 0x3);
103
104 /* V2P configuration: HTW for access */
105 SET_V2PCFG(base, ctx, 0x3);
106
107 SET_TTBCR(base, ctx, 0);
108 SET_TTBR0_PA(base, ctx, (pgtable >> 14));
109
110 /* Invalidate the TLB for this context */
111 SET_CTX_TLBIALL(base, ctx, 0);
112
113 /* Set interrupt number to "secure" interrupt */
114 SET_IRPTNDX(base, ctx, 0);
115
116 /* Enable context fault interrupt */
117 SET_CFEIE(base, ctx, 1);
118
119 /* Stall access on a context fault and let the handler deal with it */
120 SET_CFCFG(base, ctx, 1);
121
122 /* Redirect all cacheable requests to L2 slave port. */
123 SET_RCISH(base, ctx, 1);
124 SET_RCOSH(base, ctx, 1);
125 SET_RCNSH(base, ctx, 1);
126
127 /* Turn on TEX Remap */
128 SET_TRE(base, ctx, 1);
129
130 /* Do not configure PRRR / NMRR on the IOMMU for now. We will assume
131 * TEX class 0 for everything until attributes are properly worked out
132 */
133 SET_PRRR(base, ctx, 0);
134 SET_NMRR(base, ctx, 0);
135
136 /* Turn on BFB prefetch */
137 SET_BFBDFE(base, ctx, 1);
138
139#ifdef CONFIG_IOMMU_PGTABLES_L2
140 /* Configure page tables as inner-cacheable and shareable to reduce
141 * the TLB miss penalty.
142 */
143 SET_TTBR0_SH(base, ctx, 1);
144 SET_TTBR1_SH(base, ctx, 1);
145
146 SET_TTBR0_NOS(base, ctx, 1);
147 SET_TTBR1_NOS(base, ctx, 1);
148
149 SET_TTBR0_IRGNH(base, ctx, 0); /* WB, WA */
150 SET_TTBR0_IRGNL(base, ctx, 1);
151
152 SET_TTBR1_IRGNH(base, ctx, 0); /* WB, WA */
153 SET_TTBR1_IRGNL(base, ctx, 1);
154
155 SET_TTBR0_ORGN(base, ctx, 1); /* WB, WA */
156 SET_TTBR1_ORGN(base, ctx, 1); /* WB, WA */
157#endif
158
159 /* Enable the MMU */
160 SET_M(base, ctx, 1);
161}
162
163static int msm_iommu_domain_init(struct iommu_domain *domain)
164{
165 struct msm_priv *priv = kzalloc(sizeof(*priv), GFP_KERNEL);
166
167 if (!priv)
168 goto fail_nomem;
169
170 INIT_LIST_HEAD(&priv->list_attached);
171 priv->pgtable = (unsigned long *)__get_free_pages(GFP_KERNEL,
172 get_order(SZ_16K));
173
174 if (!priv->pgtable)
175 goto fail_nomem;
176
177 memset(priv->pgtable, 0, SZ_16K);
178 domain->priv = priv;
179 return 0;
180
181fail_nomem:
182 kfree(priv);
183 return -ENOMEM;
184}
185
186static void msm_iommu_domain_destroy(struct iommu_domain *domain)
187{
188 struct msm_priv *priv;
189 unsigned long flags;
190 unsigned long *fl_table;
191 int i;
192
193 spin_lock_irqsave(&msm_iommu_lock, flags);
194 priv = domain->priv;
195 domain->priv = NULL;
196
197 if (priv) {
198 fl_table = priv->pgtable;
199
200 for (i = 0; i < NUM_FL_PTE; i++)
201 if ((fl_table[i] & 0x03) == FL_TYPE_TABLE)
202 free_page((unsigned long) __va(((fl_table[i]) &
203 FL_BASE_MASK)));
204
205 free_pages((unsigned long)priv->pgtable, get_order(SZ_16K));
206 priv->pgtable = NULL;
207 }
208
209 kfree(priv);
210 spin_unlock_irqrestore(&msm_iommu_lock, flags);
211}
212
213static int msm_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
214{
215 struct msm_priv *priv;
216 struct msm_iommu_ctx_dev *ctx_dev;
217 struct msm_iommu_drvdata *iommu_drvdata;
218 struct msm_iommu_ctx_drvdata *ctx_drvdata;
219 struct msm_iommu_ctx_drvdata *tmp_drvdata;
220 int ret = 0;
221 unsigned long flags;
222
223 spin_lock_irqsave(&msm_iommu_lock, flags);
224
225 priv = domain->priv;
226
227 if (!priv || !dev) {
228 ret = -EINVAL;
229 goto fail;
230 }
231
232 iommu_drvdata = dev_get_drvdata(dev->parent);
233 ctx_drvdata = dev_get_drvdata(dev);
234 ctx_dev = dev->platform_data;
235
236 if (!iommu_drvdata || !ctx_drvdata || !ctx_dev) {
237 ret = -EINVAL;
238 goto fail;
239 }
240
241 list_for_each_entry(tmp_drvdata, &priv->list_attached, attached_elm)
242 if (tmp_drvdata == ctx_drvdata) {
243 ret = -EBUSY;
244 goto fail;
245 }
246
247 __program_context(iommu_drvdata->base, ctx_dev->num,
248 __pa(priv->pgtable));
249
250 list_add(&(ctx_drvdata->attached_elm), &priv->list_attached);
251 __flush_iotlb(domain);
252
253fail:
254 spin_unlock_irqrestore(&msm_iommu_lock, flags);
255 return ret;
256}
257
258static void msm_iommu_detach_dev(struct iommu_domain *domain,
259 struct device *dev)
260{
261 struct msm_priv *priv;
262 struct msm_iommu_ctx_dev *ctx_dev;
263 struct msm_iommu_drvdata *iommu_drvdata;
264 struct msm_iommu_ctx_drvdata *ctx_drvdata;
265 unsigned long flags;
266
267 spin_lock_irqsave(&msm_iommu_lock, flags);
268 priv = domain->priv;
269
270 if (!priv || !dev)
271 goto fail;
272
273 iommu_drvdata = dev_get_drvdata(dev->parent);
274 ctx_drvdata = dev_get_drvdata(dev);
275 ctx_dev = dev->platform_data;
276
277 if (!iommu_drvdata || !ctx_drvdata || !ctx_dev)
278 goto fail;
279
280 __flush_iotlb(domain);
281 __reset_context(iommu_drvdata->base, ctx_dev->num);
282 list_del_init(&ctx_drvdata->attached_elm);
283
284fail:
285 spin_unlock_irqrestore(&msm_iommu_lock, flags);
286}
287
288static int msm_iommu_map(struct iommu_domain *domain, unsigned long va,
289 phys_addr_t pa, int order, int prot)
290{
291 struct msm_priv *priv;
292 unsigned long flags;
293 unsigned long *fl_table;
294 unsigned long *fl_pte;
295 unsigned long fl_offset;
296 unsigned long *sl_table;
297 unsigned long *sl_pte;
298 unsigned long sl_offset;
299 size_t len = 0x1000UL << order;
300 int ret = 0;
301
302 spin_lock_irqsave(&msm_iommu_lock, flags);
303 priv = domain->priv;
304
305 if (!priv) {
306 ret = -EINVAL;
307 goto fail;
308 }
309
310 fl_table = priv->pgtable;
311
312 if (len != SZ_16M && len != SZ_1M &&
313 len != SZ_64K && len != SZ_4K) {
314 pr_debug("Bad size: %d\n", len);
315 ret = -EINVAL;
316 goto fail;
317 }
318
319 if (!fl_table) {
320 pr_debug("Null page table\n");
321 ret = -EINVAL;
322 goto fail;
323 }
324
325 fl_offset = FL_OFFSET(va); /* Upper 12 bits */
326 fl_pte = fl_table + fl_offset; /* int pointers, 4 bytes */
327
328 if (len == SZ_16M) {
329 int i = 0;
330 for (i = 0; i < 16; i++)
331 *(fl_pte+i) = (pa & 0xFF000000) | FL_SUPERSECTION |
332 FL_AP_READ | FL_AP_WRITE | FL_TYPE_SECT |
333 FL_SHARED;
334 }
335
336 if (len == SZ_1M)
337 *fl_pte = (pa & 0xFFF00000) | FL_AP_READ | FL_AP_WRITE |
338 FL_TYPE_SECT | FL_SHARED;
339
340 /* Need a 2nd level table */
341 if ((len == SZ_4K || len == SZ_64K) && (*fl_pte) == 0) {
342 unsigned long *sl;
343 sl = (unsigned long *) __get_free_pages(GFP_KERNEL,
344 get_order(SZ_4K));
345
346 if (!sl) {
347 pr_debug("Could not allocate second level table\n");
348 ret = -ENOMEM;
349 goto fail;
350 }
351
352 memset(sl, 0, SZ_4K);
353 *fl_pte = ((((int)__pa(sl)) & FL_BASE_MASK) | FL_TYPE_TABLE);
354 }
355
356 sl_table = (unsigned long *) __va(((*fl_pte) & FL_BASE_MASK));
357 sl_offset = SL_OFFSET(va);
358 sl_pte = sl_table + sl_offset;
359
360
361 if (len == SZ_4K)
362 *sl_pte = (pa & SL_BASE_MASK_SMALL) | SL_AP0 | SL_AP1 |
363 SL_SHARED | SL_TYPE_SMALL;
364
365 if (len == SZ_64K) {
366 int i;
367
368 for (i = 0; i < 16; i++)
369 *(sl_pte+i) = (pa & SL_BASE_MASK_LARGE) | SL_AP0 |
370 SL_AP1 | SL_SHARED | SL_TYPE_LARGE;
371 }
372
373 __flush_iotlb(domain);
374fail:
375 spin_unlock_irqrestore(&msm_iommu_lock, flags);
376 return ret;
377}
378
379static int msm_iommu_unmap(struct iommu_domain *domain, unsigned long va,
380 int order)
381{
382 struct msm_priv *priv;
383 unsigned long flags;
384 unsigned long *fl_table;
385 unsigned long *fl_pte;
386 unsigned long fl_offset;
387 unsigned long *sl_table;
388 unsigned long *sl_pte;
389 unsigned long sl_offset;
390 size_t len = 0x1000UL << order;
391 int i, ret = 0;
392
393 spin_lock_irqsave(&msm_iommu_lock, flags);
394
395 priv = domain->priv;
396
397 if (!priv) {
398 ret = -ENODEV;
399 goto fail;
400 }
401
402 fl_table = priv->pgtable;
403
404 if (len != SZ_16M && len != SZ_1M &&
405 len != SZ_64K && len != SZ_4K) {
406 pr_debug("Bad length: %d\n", len);
407 ret = -EINVAL;
408 goto fail;
409 }
410
411 if (!fl_table) {
412 pr_debug("Null page table\n");
413 ret = -EINVAL;
414 goto fail;
415 }
416
417 fl_offset = FL_OFFSET(va); /* Upper 12 bits */
418 fl_pte = fl_table + fl_offset; /* int pointers, 4 bytes */
419
420 if (*fl_pte == 0) {
421 pr_debug("First level PTE is 0\n");
422 ret = -ENODEV;
423 goto fail;
424 }
425
426 /* Unmap supersection */
427 if (len == SZ_16M)
428 for (i = 0; i < 16; i++)
429 *(fl_pte+i) = 0;
430
431 if (len == SZ_1M)
432 *fl_pte = 0;
433
434 sl_table = (unsigned long *) __va(((*fl_pte) & FL_BASE_MASK));
435 sl_offset = SL_OFFSET(va);
436 sl_pte = sl_table + sl_offset;
437
438 if (len == SZ_64K) {
439 for (i = 0; i < 16; i++)
440 *(sl_pte+i) = 0;
441 }
442
443 if (len == SZ_4K)
444 *sl_pte = 0;
445
446 if (len == SZ_4K || len == SZ_64K) {
447 int used = 0;
448
449 for (i = 0; i < NUM_SL_PTE; i++)
450 if (sl_table[i])
451 used = 1;
452 if (!used) {
453 free_page((unsigned long)sl_table);
454 *fl_pte = 0;
455 }
456 }
457
458 __flush_iotlb(domain);
459fail:
460 spin_unlock_irqrestore(&msm_iommu_lock, flags);
461 return ret;
462}
463
464static phys_addr_t msm_iommu_iova_to_phys(struct iommu_domain *domain,
465 unsigned long va)
466{
467 struct msm_priv *priv;
468 struct msm_iommu_drvdata *iommu_drvdata;
469 struct msm_iommu_ctx_drvdata *ctx_drvdata;
470 unsigned int par;
471 unsigned long flags;
472 void __iomem *base;
473 phys_addr_t ret = 0;
474 int ctx;
475
476 spin_lock_irqsave(&msm_iommu_lock, flags);
477
478 priv = domain->priv;
479 if (list_empty(&priv->list_attached))
480 goto fail;
481
482 ctx_drvdata = list_entry(priv->list_attached.next,
483 struct msm_iommu_ctx_drvdata, attached_elm);
484 iommu_drvdata = dev_get_drvdata(ctx_drvdata->pdev->dev.parent);
485
486 base = iommu_drvdata->base;
487 ctx = ctx_drvdata->num;
488
489 /* Invalidate context TLB */
490 SET_CTX_TLBIALL(base, ctx, 0);
491 SET_V2PPR_VA(base, ctx, va >> V2Pxx_VA_SHIFT);
492
493 if (GET_FAULT(base, ctx))
494 goto fail;
495
496 par = GET_PAR(base, ctx);
497
498 /* We are dealing with a supersection */
499 if (GET_NOFAULT_SS(base, ctx))
500 ret = (par & 0xFF000000) | (va & 0x00FFFFFF);
501 else /* Upper 20 bits from PAR, lower 12 from VA */
502 ret = (par & 0xFFFFF000) | (va & 0x00000FFF);
503
504fail:
505 spin_unlock_irqrestore(&msm_iommu_lock, flags);
506 return ret;
507}
508
509static int msm_iommu_domain_has_cap(struct iommu_domain *domain,
510 unsigned long cap)
511{
512 return 0;
513}
514
515static void print_ctx_regs(void __iomem *base, int ctx)
516{
517 unsigned int fsr = GET_FSR(base, ctx);
518 pr_err("FAR = %08x PAR = %08x\n",
519 GET_FAR(base, ctx), GET_PAR(base, ctx));
520 pr_err("FSR = %08x [%s%s%s%s%s%s%s%s%s%s]\n", fsr,
521 (fsr & 0x02) ? "TF " : "",
522 (fsr & 0x04) ? "AFF " : "",
523 (fsr & 0x08) ? "APF " : "",
524 (fsr & 0x10) ? "TLBMF " : "",
525 (fsr & 0x20) ? "HTWDEEF " : "",
526 (fsr & 0x40) ? "HTWSEEF " : "",
527 (fsr & 0x80) ? "MHF " : "",
528 (fsr & 0x10000) ? "SL " : "",
529 (fsr & 0x40000000) ? "SS " : "",
530 (fsr & 0x80000000) ? "MULTI " : "");
531
532 pr_err("FSYNR0 = %08x FSYNR1 = %08x\n",
533 GET_FSYNR0(base, ctx), GET_FSYNR1(base, ctx));
534 pr_err("TTBR0 = %08x TTBR1 = %08x\n",
535 GET_TTBR0(base, ctx), GET_TTBR1(base, ctx));
536 pr_err("SCTLR = %08x ACTLR = %08x\n",
537 GET_SCTLR(base, ctx), GET_ACTLR(base, ctx));
538 pr_err("PRRR = %08x NMRR = %08x\n",
539 GET_PRRR(base, ctx), GET_NMRR(base, ctx));
540}
541
542irqreturn_t msm_iommu_fault_handler(int irq, void *dev_id)
543{
544 struct msm_iommu_drvdata *drvdata = dev_id;
545 void __iomem *base;
546 unsigned int fsr = 0;
547 int ncb = 0, i = 0;
548
549 spin_lock(&msm_iommu_lock);
550
551 if (!drvdata) {
552 pr_err("Invalid device ID in context interrupt handler\n");
553 goto fail;
554 }
555
556 base = drvdata->base;
557
558 pr_err("===== WOAH! =====\n");
559 pr_err("Unexpected IOMMU page fault!\n");
560 pr_err("base = %08x\n", (unsigned int) base);
561
562 ncb = GET_NCB(base)+1;
563 for (i = 0; i < ncb; i++) {
564 fsr = GET_FSR(base, i);
565 if (fsr) {
566 pr_err("Fault occurred in context %d.\n", i);
567 pr_err("Interesting registers:\n");
568 print_ctx_regs(base, i);
569 SET_FSR(base, i, 0x4000000F);
570 }
571 }
572fail:
573 spin_unlock(&msm_iommu_lock);
574 return 0;
575}
576
577static struct iommu_ops msm_iommu_ops = {
578 .domain_init = msm_iommu_domain_init,
579 .domain_destroy = msm_iommu_domain_destroy,
580 .attach_dev = msm_iommu_attach_dev,
581 .detach_dev = msm_iommu_detach_dev,
582 .map = msm_iommu_map,
583 .unmap = msm_iommu_unmap,
584 .iova_to_phys = msm_iommu_iova_to_phys,
585 .domain_has_cap = msm_iommu_domain_has_cap
586};
587
588static int msm_iommu_init(void)
589{
590 register_iommu(&msm_iommu_ops);
591 return 0;
592}
593
594subsys_initcall(msm_iommu_init);
595
596MODULE_LICENSE("GPL v2");
597MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");
diff --git a/arch/arm/mach-msm/iommu_dev.c b/arch/arm/mach-msm/iommu_dev.c
new file mode 100644
index 000000000000..c33ae786c41f
--- /dev/null
+++ b/arch/arm/mach-msm/iommu_dev.c
@@ -0,0 +1,374 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/platform_device.h>
23#include <linux/io.h>
24#include <linux/clk.h>
25#include <linux/iommu.h>
26#include <linux/interrupt.h>
27#include <linux/err.h>
28#include <linux/slab.h>
29
30#include <mach/iommu_hw-8xxx.h>
31#include <mach/iommu.h>
32
33struct iommu_ctx_iter_data {
34 /* input */
35 const char *name;
36
37 /* output */
38 struct device *dev;
39};
40
41static struct platform_device *msm_iommu_root_dev;
42
43static int each_iommu_ctx(struct device *dev, void *data)
44{
45 struct iommu_ctx_iter_data *res = data;
46 struct msm_iommu_ctx_dev *c = dev->platform_data;
47
48 if (!res || !c || !c->name || !res->name)
49 return -EINVAL;
50
51 if (!strcmp(res->name, c->name)) {
52 res->dev = dev;
53 return 1;
54 }
55 return 0;
56}
57
58static int each_iommu(struct device *dev, void *data)
59{
60 return device_for_each_child(dev, data, each_iommu_ctx);
61}
62
63struct device *msm_iommu_get_ctx(const char *ctx_name)
64{
65 struct iommu_ctx_iter_data r;
66 int found;
67
68 if (!msm_iommu_root_dev) {
69 pr_err("No root IOMMU device.\n");
70 goto fail;
71 }
72
73 r.name = ctx_name;
74 found = device_for_each_child(&msm_iommu_root_dev->dev, &r, each_iommu);
75
76 if (!found) {
77 pr_err("Could not find context <%s>\n", ctx_name);
78 goto fail;
79 }
80
81 return r.dev;
82fail:
83 return NULL;
84}
85EXPORT_SYMBOL(msm_iommu_get_ctx);
86
87static void msm_iommu_reset(void __iomem *base)
88{
89 int ctx, ncb;
90
91 SET_RPUE(base, 0);
92 SET_RPUEIE(base, 0);
93 SET_ESRRESTORE(base, 0);
94 SET_TBE(base, 0);
95 SET_CR(base, 0);
96 SET_SPDMBE(base, 0);
97 SET_TESTBUSCR(base, 0);
98 SET_TLBRSW(base, 0);
99 SET_GLOBAL_TLBIALL(base, 0);
100 SET_RPU_ACR(base, 0);
101 SET_TLBLKCRWE(base, 1);
102 ncb = GET_NCB(base)+1;
103
104 for (ctx = 0; ctx < ncb; ctx++) {
105 SET_BPRCOSH(base, ctx, 0);
106 SET_BPRCISH(base, ctx, 0);
107 SET_BPRCNSH(base, ctx, 0);
108 SET_BPSHCFG(base, ctx, 0);
109 SET_BPMTCFG(base, ctx, 0);
110 SET_ACTLR(base, ctx, 0);
111 SET_SCTLR(base, ctx, 0);
112 SET_FSRRESTORE(base, ctx, 0);
113 SET_TTBR0(base, ctx, 0);
114 SET_TTBR1(base, ctx, 0);
115 SET_TTBCR(base, ctx, 0);
116 SET_BFBCR(base, ctx, 0);
117 SET_PAR(base, ctx, 0);
118 SET_FAR(base, ctx, 0);
119 SET_CTX_TLBIALL(base, ctx, 0);
120 SET_TLBFLPTER(base, ctx, 0);
121 SET_TLBSLPTER(base, ctx, 0);
122 SET_TLBLKCR(base, ctx, 0);
123 SET_PRRR(base, ctx, 0);
124 SET_NMRR(base, ctx, 0);
125 SET_CONTEXTIDR(base, ctx, 0);
126 }
127}
128
129static int msm_iommu_probe(struct platform_device *pdev)
130{
131 struct resource *r;
132 struct clk *iommu_clk;
133 struct msm_iommu_drvdata *drvdata;
134 struct msm_iommu_dev *iommu_dev = pdev->dev.platform_data;
135 void __iomem *regs_base;
136 resource_size_t len;
137 int ret = 0, ncb, nm2v, irq;
138
139 if (pdev->id != -1) {
140 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
141
142 if (!drvdata) {
143 ret = -ENOMEM;
144 goto fail;
145 }
146
147 if (!iommu_dev) {
148 ret = -ENODEV;
149 goto fail;
150 }
151
152 if (iommu_dev->clk_rate != 0) {
153 iommu_clk = clk_get(&pdev->dev, "iommu_clk");
154
155 if (IS_ERR(iommu_clk)) {
156 ret = -ENODEV;
157 goto fail;
158 }
159
160 if (iommu_dev->clk_rate > 0) {
161 ret = clk_set_rate(iommu_clk,
162 iommu_dev->clk_rate);
163 if (ret) {
164 clk_put(iommu_clk);
165 goto fail;
166 }
167 }
168
169 ret = clk_enable(iommu_clk);
170 if (ret) {
171 clk_put(iommu_clk);
172 goto fail;
173 }
174 clk_put(iommu_clk);
175 }
176
177 r = platform_get_resource_byname(pdev, IORESOURCE_MEM,
178 "physbase");
179 if (!r) {
180 ret = -ENODEV;
181 goto fail;
182 }
183
184 len = r->end - r->start + 1;
185
186 r = request_mem_region(r->start, len, r->name);
187 if (!r) {
188 pr_err("Could not request memory region: "
189 "start=%p, len=%d\n", (void *) r->start, len);
190 ret = -EBUSY;
191 goto fail;
192 }
193
194 regs_base = ioremap(r->start, len);
195
196 if (!regs_base) {
197 pr_err("Could not ioremap: start=%p, len=%d\n",
198 (void *) r->start, len);
199 ret = -EBUSY;
200 goto fail;
201 }
202
203 irq = platform_get_irq_byname(pdev, "secure_irq");
204 if (irq < 0) {
205 ret = -ENODEV;
206 goto fail;
207 }
208
209 mb();
210
211 if (GET_IDR(regs_base) == 0) {
212 pr_err("Invalid IDR value detected\n");
213 ret = -ENODEV;
214 goto fail;
215 }
216
217 ret = request_irq(irq, msm_iommu_fault_handler, 0,
218 "msm_iommu_secure_irpt_handler", drvdata);
219 if (ret) {
220 pr_err("Request IRQ %d failed with ret=%d\n", irq, ret);
221 goto fail;
222 }
223
224 msm_iommu_reset(regs_base);
225 drvdata->base = regs_base;
226 drvdata->irq = irq;
227
228 nm2v = GET_NM2VCBMT((unsigned long) regs_base);
229 ncb = GET_NCB((unsigned long) regs_base);
230
231 pr_info("device %s mapped at %p, irq %d with %d ctx banks\n",
232 iommu_dev->name, regs_base, irq, ncb+1);
233
234 platform_set_drvdata(pdev, drvdata);
235 } else
236 msm_iommu_root_dev = pdev;
237
238 return 0;
239
240fail:
241 kfree(drvdata);
242 return ret;
243}
244
245static int msm_iommu_remove(struct platform_device *pdev)
246{
247 struct msm_iommu_drvdata *drv = NULL;
248
249 drv = platform_get_drvdata(pdev);
250 if (drv) {
251 memset(drv, 0, sizeof(struct msm_iommu_drvdata));
252 kfree(drv);
253 platform_set_drvdata(pdev, NULL);
254 }
255 return 0;
256}
257
258static int msm_iommu_ctx_probe(struct platform_device *pdev)
259{
260 struct msm_iommu_ctx_dev *c = pdev->dev.platform_data;
261 struct msm_iommu_drvdata *drvdata;
262 struct msm_iommu_ctx_drvdata *ctx_drvdata = NULL;
263 int i, ret = 0;
264 if (!c || !pdev->dev.parent) {
265 ret = -EINVAL;
266 goto fail;
267 }
268
269 drvdata = dev_get_drvdata(pdev->dev.parent);
270
271 if (!drvdata) {
272 ret = -ENODEV;
273 goto fail;
274 }
275
276 ctx_drvdata = kzalloc(sizeof(*ctx_drvdata), GFP_KERNEL);
277 if (!ctx_drvdata) {
278 ret = -ENOMEM;
279 goto fail;
280 }
281 ctx_drvdata->num = c->num;
282 ctx_drvdata->pdev = pdev;
283
284 INIT_LIST_HEAD(&ctx_drvdata->attached_elm);
285 platform_set_drvdata(pdev, ctx_drvdata);
286
287 /* Program the M2V tables for this context */
288 for (i = 0; i < MAX_NUM_MIDS; i++) {
289 int mid = c->mids[i];
290 if (mid == -1)
291 break;
292
293 SET_M2VCBR_N(drvdata->base, mid, 0);
294 SET_CBACR_N(drvdata->base, c->num, 0);
295
296 /* Set VMID = MID */
297 SET_VMID(drvdata->base, mid, mid);
298
299 /* Set the context number for that MID to this context */
300 SET_CBNDX(drvdata->base, mid, c->num);
301
302 /* Set MID associated with this context bank */
303 SET_CBVMID(drvdata->base, c->num, mid);
304
305 /* Set security bit override to be Non-secure */
306 SET_NSCFG(drvdata->base, mid, 3);
307 }
308
309 pr_info("context device %s with bank index %d\n", c->name, c->num);
310
311 return 0;
312fail:
313 kfree(ctx_drvdata);
314 return ret;
315}
316
317static int msm_iommu_ctx_remove(struct platform_device *pdev)
318{
319 struct msm_iommu_ctx_drvdata *drv = NULL;
320 drv = platform_get_drvdata(pdev);
321 if (drv) {
322 memset(drv, 0, sizeof(struct msm_iommu_ctx_drvdata));
323 kfree(drv);
324 platform_set_drvdata(pdev, NULL);
325 }
326 return 0;
327}
328
329static struct platform_driver msm_iommu_driver = {
330 .driver = {
331 .name = "msm_iommu",
332 },
333 .probe = msm_iommu_probe,
334 .remove = msm_iommu_remove,
335};
336
337static struct platform_driver msm_iommu_ctx_driver = {
338 .driver = {
339 .name = "msm_iommu_ctx",
340 },
341 .probe = msm_iommu_ctx_probe,
342 .remove = msm_iommu_ctx_remove,
343};
344
345static int msm_iommu_driver_init(void)
346{
347 int ret;
348 ret = platform_driver_register(&msm_iommu_driver);
349 if (ret != 0) {
350 pr_err("Failed to register IOMMU driver\n");
351 goto error;
352 }
353
354 ret = platform_driver_register(&msm_iommu_ctx_driver);
355 if (ret != 0) {
356 pr_err("Failed to register IOMMU context driver\n");
357 goto error;
358 }
359
360error:
361 return ret;
362}
363
364static void msm_iommu_driver_exit(void)
365{
366 platform_driver_unregister(&msm_iommu_ctx_driver);
367 platform_driver_unregister(&msm_iommu_driver);
368}
369
370subsys_initcall(msm_iommu_driver_init);
371module_exit(msm_iommu_driver_exit);
372
373MODULE_LICENSE("GPL v2");
374MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index dec5ca622d7d..7689848ec680 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -28,7 +28,6 @@
28#ifndef MSM_DGT_BASE 28#ifndef MSM_DGT_BASE
29#define MSM_DGT_BASE (MSM_GPT_BASE + 0x10) 29#define MSM_DGT_BASE (MSM_GPT_BASE + 0x10)
30#endif 30#endif
31#define MSM_DGT_SHIFT (5)
32 31
33#define TIMER_MATCH_VAL 0x0000 32#define TIMER_MATCH_VAL 0x0000
34#define TIMER_COUNT_VAL 0x0004 33#define TIMER_COUNT_VAL 0x0004
@@ -36,12 +35,28 @@
36#define TIMER_ENABLE_CLR_ON_MATCH_EN 2 35#define TIMER_ENABLE_CLR_ON_MATCH_EN 2
37#define TIMER_ENABLE_EN 1 36#define TIMER_ENABLE_EN 1
38#define TIMER_CLEAR 0x000C 37#define TIMER_CLEAR 0x000C
39 38#define DGT_CLK_CTL 0x0034
39enum {
40 DGT_CLK_CTL_DIV_1 = 0,
41 DGT_CLK_CTL_DIV_2 = 1,
42 DGT_CLK_CTL_DIV_3 = 2,
43 DGT_CLK_CTL_DIV_4 = 3,
44};
40#define CSR_PROTECTION 0x0020 45#define CSR_PROTECTION 0x0020
41#define CSR_PROTECTION_EN 1 46#define CSR_PROTECTION_EN 1
42 47
43#define GPT_HZ 32768 48#define GPT_HZ 32768
49
50#if defined(CONFIG_ARCH_QSD8X50)
51#define DGT_HZ (19200000 / 4) /* 19.2 MHz / 4 by default */
52#define MSM_DGT_SHIFT (0)
53#elif defined(CONFIG_ARCH_MSM7X30) || defined(CONFIG_ARCH_MSM8X60)
54#define DGT_HZ (24576000 / 4) /* 24.576 MHz (LPXO) / 4 by default */
55#define MSM_DGT_SHIFT (0)
56#else
44#define DGT_HZ 19200000 /* 19.2 MHz or 600 KHz after shift */ 57#define DGT_HZ 19200000 /* 19.2 MHz or 600 KHz after shift */
58#define MSM_DGT_SHIFT (5)
59#endif
45 60
46struct msm_clock { 61struct msm_clock {
47 struct clock_event_device clockevent; 62 struct clock_event_device clockevent;
@@ -170,6 +185,10 @@ static void __init msm_timer_init(void)
170 int i; 185 int i;
171 int res; 186 int res;
172 187
188#ifdef CONFIG_ARCH_MSM8X60
189 writel(DGT_CLK_CTL_DIV_4, MSM_TMR_BASE + DGT_CLK_CTL);
190#endif
191
173 for (i = 0; i < ARRAY_SIZE(msm_clocks); i++) { 192 for (i = 0; i < ARRAY_SIZE(msm_clocks); i++) {
174 struct msm_clock *clock = &msm_clocks[i]; 193 struct msm_clock *clock = &msm_clocks[i];
175 struct clock_event_device *ce = &clock->clockevent; 194 struct clock_event_device *ce = &clock->clockevent;
diff --git a/arch/arm/mach-mx25/Kconfig b/arch/arm/mach-mx25/Kconfig
index c71a7bc19284..aa57e35ce3cd 100644
--- a/arch/arm/mach-mx25/Kconfig
+++ b/arch/arm/mach-mx25/Kconfig
@@ -12,6 +12,8 @@ config MACH_EUKREA_CPUIMX25
12 select IMX_HAVE_PLATFORM_IMX_I2C 12 select IMX_HAVE_PLATFORM_IMX_I2C
13 select IMX_HAVE_PLATFORM_IMX_UART 13 select IMX_HAVE_PLATFORM_IMX_UART
14 select IMX_HAVE_PLATFORM_MXC_NAND 14 select IMX_HAVE_PLATFORM_MXC_NAND
15 select IMX_HAVE_PLATFORM_FLEXCAN
16 select IMX_HAVE_PLATFORM_ESDHC
15 select MXC_ULPI if USB_ULPI 17 select MXC_ULPI if USB_ULPI
16 18
17choice 19choice
@@ -20,8 +22,8 @@ choice
20 default MACH_EUKREA_MBIMXSD25_BASEBOARD 22 default MACH_EUKREA_MBIMXSD25_BASEBOARD
21 23
22config MACH_EUKREA_MBIMXSD25_BASEBOARD 24config MACH_EUKREA_MBIMXSD25_BASEBOARD
23 prompt "Eukrea MBIMXSD development board" 25 bool "Eukrea MBIMXSD development board"
24 bool 26 select IMX_HAVE_PLATFORM_IMX_SSI
25 help 27 help
26 This adds board specific devices that can be found on Eukrea's 28 This adds board specific devices that can be found on Eukrea's
27 MBIMXSD evaluation board. 29 MBIMXSD evaluation board.
diff --git a/arch/arm/mach-mx25/clock.c b/arch/arm/mach-mx25/clock.c
index 40c7cc41cee3..9e4a5578c2fb 100644
--- a/arch/arm/mach-mx25/clock.c
+++ b/arch/arm/mach-mx25/clock.c
@@ -72,7 +72,7 @@ unsigned long get_rate_arm(struct clk *clk)
72 unsigned long rate = get_rate_mpll(); 72 unsigned long rate = get_rate_mpll();
73 73
74 if (cctl & (1 << 14)) 74 if (cctl & (1 << 14))
75 rate = (rate * 3) >> 1; 75 rate = (rate * 3) >> 2;
76 76
77 return rate / ((cctl >> 30) + 1); 77 return rate / ((cctl >> 30) + 1);
78} 78}
@@ -99,7 +99,7 @@ static unsigned long get_rate_per(int per)
99 if (readl(CRM_BASE + 0x64) & (1 << per)) 99 if (readl(CRM_BASE + 0x64) & (1 << per))
100 fref = get_rate_upll(); 100 fref = get_rate_upll();
101 else 101 else
102 fref = get_rate_ipg(NULL); 102 fref = get_rate_ahb(NULL);
103 103
104 return fref / (val + 1); 104 return fref / (val + 1);
105} 105}
@@ -139,6 +139,16 @@ static unsigned long get_rate_lcdc(struct clk *clk)
139 return get_rate_per(7); 139 return get_rate_per(7);
140} 140}
141 141
142static unsigned long get_rate_esdhc1(struct clk *clk)
143{
144 return get_rate_per(3);
145}
146
147static unsigned long get_rate_esdhc2(struct clk *clk)
148{
149 return get_rate_per(4);
150}
151
142static unsigned long get_rate_csi(struct clk *clk) 152static unsigned long get_rate_csi(struct clk *clk)
143{ 153{
144 return get_rate_per(0); 154 return get_rate_per(0);
@@ -213,6 +223,12 @@ DEFINE_CLOCK(ssi2_per_clk, 0, CCM_CGCR0, 14, get_rate_ipg, NULL, NULL);
213DEFINE_CLOCK(cspi1_clk, 0, CCM_CGCR1, 5, get_rate_ipg, NULL, NULL); 223DEFINE_CLOCK(cspi1_clk, 0, CCM_CGCR1, 5, get_rate_ipg, NULL, NULL);
214DEFINE_CLOCK(cspi2_clk, 0, CCM_CGCR1, 6, get_rate_ipg, NULL, NULL); 224DEFINE_CLOCK(cspi2_clk, 0, CCM_CGCR1, 6, get_rate_ipg, NULL, NULL);
215DEFINE_CLOCK(cspi3_clk, 0, CCM_CGCR1, 7, get_rate_ipg, NULL, NULL); 225DEFINE_CLOCK(cspi3_clk, 0, CCM_CGCR1, 7, get_rate_ipg, NULL, NULL);
226DEFINE_CLOCK(esdhc1_ahb_clk, 0, CCM_CGCR0, 21, get_rate_esdhc1, NULL, NULL);
227DEFINE_CLOCK(esdhc1_per_clk, 0, CCM_CGCR0, 3, get_rate_esdhc1, NULL,
228 &esdhc1_ahb_clk);
229DEFINE_CLOCK(esdhc2_ahb_clk, 0, CCM_CGCR0, 22, get_rate_esdhc2, NULL, NULL);
230DEFINE_CLOCK(esdhc2_per_clk, 0, CCM_CGCR0, 4, get_rate_esdhc2, NULL,
231 &esdhc2_ahb_clk);
216DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL, NULL, NULL); 232DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL, NULL, NULL);
217DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL, NULL, NULL); 233DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL, NULL, NULL);
218DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0, 7, NULL, NULL, &lcdc_ahb_clk); 234DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0, 7, NULL, NULL, &lcdc_ahb_clk);
@@ -238,10 +254,14 @@ DEFINE_CLOCK(lcdc_clk, 0, CCM_CGCR1, 29, get_rate_lcdc, NULL, &lcdc_per_clk);
238DEFINE_CLOCK(wdt_clk, 0, CCM_CGCR2, 19, get_rate_ipg, NULL, NULL); 254DEFINE_CLOCK(wdt_clk, 0, CCM_CGCR2, 19, get_rate_ipg, NULL, NULL);
239DEFINE_CLOCK(ssi1_clk, 0, CCM_CGCR2, 11, get_rate_ssi1, NULL, &ssi1_per_clk); 255DEFINE_CLOCK(ssi1_clk, 0, CCM_CGCR2, 11, get_rate_ssi1, NULL, &ssi1_per_clk);
240DEFINE_CLOCK(ssi2_clk, 1, CCM_CGCR2, 12, get_rate_ssi2, NULL, &ssi2_per_clk); 256DEFINE_CLOCK(ssi2_clk, 1, CCM_CGCR2, 12, get_rate_ssi2, NULL, &ssi2_per_clk);
257DEFINE_CLOCK(esdhc1_clk, 0, CCM_CGCR1, 13, get_rate_esdhc1, NULL,
258 &esdhc1_per_clk);
259DEFINE_CLOCK(esdhc2_clk, 1, CCM_CGCR1, 14, get_rate_esdhc2, NULL,
260 &esdhc2_per_clk);
241DEFINE_CLOCK(audmux_clk, 0, CCM_CGCR1, 0, NULL, NULL, NULL); 261DEFINE_CLOCK(audmux_clk, 0, CCM_CGCR1, 0, NULL, NULL, NULL);
242DEFINE_CLOCK(csi_clk, 0, CCM_CGCR1, 4, get_rate_csi, NULL, &csi_per_clk); 262DEFINE_CLOCK(csi_clk, 0, CCM_CGCR1, 4, get_rate_csi, NULL, &csi_per_clk);
243DEFINE_CLOCK(can1_clk, 0, CCM_CGCR1, 2, get_rate_ipg, NULL, NULL); 263DEFINE_CLOCK(can1_clk, 0, CCM_CGCR1, 2, get_rate_ipg, NULL, NULL);
244DEFINE_CLOCK(can2_clk, 0, CCM_CGCR1, 3, get_rate_ipg, NULL, NULL); 264DEFINE_CLOCK(can2_clk, 1, CCM_CGCR1, 3, get_rate_ipg, NULL, NULL);
245 265
246#define _REGISTER_CLOCK(d, n, c) \ 266#define _REGISTER_CLOCK(d, n, c) \
247 { \ 267 { \
@@ -261,9 +281,9 @@ static struct clk_lookup lookups[] = {
261 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk) 281 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
262 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk) 282 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk)
263 _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk) 283 _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk)
264 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk) 284 _REGISTER_CLOCK("imx25-cspi.0", NULL, cspi1_clk)
265 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk) 285 _REGISTER_CLOCK("imx25-cspi.1", NULL, cspi2_clk)
266 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk) 286 _REGISTER_CLOCK("imx25-cspi.2", NULL, cspi3_clk)
267 _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk) 287 _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk)
268 _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk) 288 _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk)
269 _REGISTER_CLOCK("mxc_pwm.2", NULL, pwm3_clk) 289 _REGISTER_CLOCK("mxc_pwm.2", NULL, pwm3_clk)
@@ -279,6 +299,8 @@ static struct clk_lookup lookups[] = {
279 _REGISTER_CLOCK("imx-wdt.0", NULL, wdt_clk) 299 _REGISTER_CLOCK("imx-wdt.0", NULL, wdt_clk)
280 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 300 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
281 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 301 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
302 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
303 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
282 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk) 304 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
283 _REGISTER_CLOCK(NULL, "audmux", audmux_clk) 305 _REGISTER_CLOCK(NULL, "audmux", audmux_clk)
284 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk) 306 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h
index d86a7c3ca8b0..93afa10b13cf 100644
--- a/arch/arm/mach-mx25/devices-imx25.h
+++ b/arch/arm/mach-mx25/devices-imx25.h
@@ -9,35 +9,46 @@
9#include <mach/mx25.h> 9#include <mach/mx25.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12extern const struct imx_fec_data imx25_fec_data __initconst;
13#define imx25_add_fec(pdata) \
14 imx_add_fec(&imx25_fec_data, pdata)
15
12#define imx25_add_flexcan0(pdata) \ 16#define imx25_add_flexcan0(pdata) \
13 imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata) 17 imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata)
14#define imx25_add_flexcan1(pdata) \ 18#define imx25_add_flexcan1(pdata) \
15 imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata) 19 imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata)
16 20
17#define imx25_add_imx_i2c0(pdata) \ 21extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst;
18 imx_add_imx_i2c(0, MX25_I2C1_BASE_ADDR, SZ_16K, MX25_INT_I2C1, pdata) 22#define imx25_add_imx_i2c(id, pdata) \
19#define imx25_add_imx_i2c1(pdata) \ 23 imx_add_imx_i2c(&imx25_imx_i2c_data[id], pdata)
20 imx_add_imx_i2c(1, MX25_I2C2_BASE_ADDR, SZ_16K, MX25_INT_I2C2, pdata) 24#define imx25_add_imx_i2c0(pdata) imx25_add_imx_i2c(0, pdata)
21#define imx25_add_imx_i2c2(pdata) \ 25#define imx25_add_imx_i2c1(pdata) imx25_add_imx_i2c(1, pdata)
22 imx_add_imx_i2c(2, MX25_I2C3_BASE_ADDR, SZ_16K, MX25_INT_I2C3, pdata) 26#define imx25_add_imx_i2c2(pdata) imx25_add_imx_i2c(2, pdata)
23 27
24#define imx25_add_imx_uart0(pdata) \ 28extern const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst;
25 imx_add_imx_uart_1irq(0, MX25_UART1_BASE_ADDR, SZ_16K, MX25_INT_UART1, pdata) 29#define imx25_add_imx_ssi(id, pdata) \
26#define imx25_add_imx_uart1(pdata) \ 30 imx_add_imx_ssi(&imx25_imx_ssi_data[id], pdata)
27 imx_add_imx_uart_1irq(1, MX25_UART2_BASE_ADDR, SZ_16K, MX25_INT_UART2, pdata) 31
28#define imx25_add_imx_uart2(pdata) \ 32extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
29 imx_add_imx_uart_1irq(2, MX25_UART3_BASE_ADDR, SZ_16K, MX25_INT_UART3, pdata) 33#define imx25_add_imx_uart(id, pdata) \
30#define imx25_add_imx_uart3(pdata) \ 34 imx_add_imx_uart_1irq(&imx25_imx_uart_data[id], pdata)
31 imx_add_imx_uart_1irq(3, MX25_UART4_BASE_ADDR, SZ_16K, MX25_INT_UART4, pdata) 35#define imx25_add_imx_uart0(pdata) imx25_add_imx_uart(0, pdata)
32#define imx25_add_imx_uart4(pdata) \ 36#define imx25_add_imx_uart1(pdata) imx25_add_imx_uart(1, pdata)
33 imx_add_imx_uart_1irq(4, MX25_UART5_BASE_ADDR, SZ_16K, MX25_INT_UART5, pdata) 37#define imx25_add_imx_uart2(pdata) imx25_add_imx_uart(2, pdata)
38#define imx25_add_imx_uart3(pdata) imx25_add_imx_uart(3, pdata)
39#define imx25_add_imx_uart4(pdata) imx25_add_imx_uart(4, pdata)
34 40
41extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst;
35#define imx25_add_mxc_nand(pdata) \ 42#define imx25_add_mxc_nand(pdata) \
36 imx_add_mxc_nand_v21(MX25_NFC_BASE_ADDR, MX25_INT_NANDFC, pdata) 43 imx_add_mxc_nand(&imx25_mxc_nand_data, pdata)
37 44
38#define imx25_add_spi_imx0(pdata) \ 45extern const struct imx_spi_imx_data imx25_spi_imx_data[] __initconst;
39 imx_add_spi_imx(0, MX25_CSPI1_BASE_ADDR, SZ_16K, MX25_INT_CSPI1, pdata) 46#define imx25_add_spi_imx(id, pdata) \
40#define imx25_add_spi_imx1(pdata) \ 47 imx_add_spi_imx(&imx25_spi_imx_data[id], pdata)
41 imx_add_spi_imx(1, MX25_CSPI2_BASE_ADDR, SZ_16K, MX25_INT_CSPI2, pdata) 48#define imx25_add_spi_imx0(pdata) imx25_add_spi_imx(0, pdata)
42#define imx25_add_spi_imx2(pdata) \ 49#define imx25_add_spi_imx1(pdata) imx25_add_spi_imx(1, pdata)
43 imx_add_spi_imx(2, MX25_CSPI3_BASE_ADDR, SZ_16K, MX25_INT_CSPI3, pdata) 50#define imx25_add_spi_imx2(pdata) imx25_add_spi_imx(2, pdata)
51
52extern const struct imx_esdhc_imx_data imx25_esdhc_data[] __initconst;
53#define imx25_add_esdhc(id, pdata) \
54 imx_add_esdhc(&imx25_esdhc_data[id], pdata)
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c
index 3468eb15b236..1d0eb3e85941 100644
--- a/arch/arm/mach-mx25/devices.c
+++ b/arch/arm/mach-mx25/devices.c
@@ -208,26 +208,6 @@ int __init imx25_register_gpios(void)
208 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); 208 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
209} 209}
210 210
211static struct resource mx25_fec_resources[] = {
212 {
213 .start = MX25_FEC_BASE_ADDR,
214 .end = MX25_FEC_BASE_ADDR + 0xfff,
215 .flags = IORESOURCE_MEM,
216 },
217 {
218 .start = MX25_INT_FEC,
219 .end = MX25_INT_FEC,
220 .flags = IORESOURCE_IRQ,
221 },
222};
223
224struct platform_device mx25_fec_device = {
225 .name = "fec",
226 .id = 0,
227 .num_resources = ARRAY_SIZE(mx25_fec_resources),
228 .resource = mx25_fec_resources,
229};
230
231static struct resource mx25_rtc_resources[] = { 211static struct resource mx25_rtc_resources[] = {
232 { 212 {
233 .start = MX25_DRYICE_BASE_ADDR, 213 .start = MX25_DRYICE_BASE_ADDR,
@@ -305,44 +285,6 @@ struct platform_device mx25_kpp_device = {
305 .resource = mx25_kpp_resources, 285 .resource = mx25_kpp_resources,
306}; 286};
307 287
308static struct resource imx_ssi_resources0[] = {
309 {
310 .start = MX25_SSI1_BASE_ADDR,
311 .end = MX25_SSI1_BASE_ADDR + 0x3fff,
312 .flags = IORESOURCE_MEM,
313 }, {
314 .start = MX25_INT_SSI1,
315 .end = MX25_INT_SSI1,
316 .flags = IORESOURCE_IRQ,
317 },
318};
319
320static struct resource imx_ssi_resources1[] = {
321 {
322 .start = MX25_SSI2_BASE_ADDR,
323 .end = MX25_SSI2_BASE_ADDR + 0x3fff,
324 .flags = IORESOURCE_MEM
325 }, {
326 .start = MX25_INT_SSI2,
327 .end = MX25_INT_SSI2,
328 .flags = IORESOURCE_IRQ,
329 },
330};
331
332struct platform_device imx_ssi_device0 = {
333 .name = "imx-ssi",
334 .id = 0,
335 .num_resources = ARRAY_SIZE(imx_ssi_resources0),
336 .resource = imx_ssi_resources0,
337};
338
339struct platform_device imx_ssi_device1 = {
340 .name = "imx-ssi",
341 .id = 1,
342 .num_resources = ARRAY_SIZE(imx_ssi_resources1),
343 .resource = imx_ssi_resources1,
344};
345
346static struct resource mx25_csi_resources[] = { 288static struct resource mx25_csi_resources[] = {
347 { 289 {
348 .start = MX25_CSI_BASE_ADDR, 290 .start = MX25_CSI_BASE_ADDR,
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h
index 4aceb68e35a7..7b70a43c3a4b 100644
--- a/arch/arm/mach-mx25/devices.h
+++ b/arch/arm/mach-mx25/devices.h
@@ -6,11 +6,8 @@ extern struct platform_device mxc_pwm_device1;
6extern struct platform_device mxc_pwm_device2; 6extern struct platform_device mxc_pwm_device2;
7extern struct platform_device mxc_pwm_device3; 7extern struct platform_device mxc_pwm_device3;
8extern struct platform_device mxc_keypad_device; 8extern struct platform_device mxc_keypad_device;
9extern struct platform_device mx25_fec_device;
10extern struct platform_device mx25_rtc_device; 9extern struct platform_device mx25_rtc_device;
11extern struct platform_device mx25_fb_device; 10extern struct platform_device mx25_fb_device;
12extern struct platform_device mxc_wdt; 11extern struct platform_device mxc_wdt;
13extern struct platform_device mx25_kpp_device; 12extern struct platform_device mx25_kpp_device;
14extern struct platform_device imx_ssi_device0;
15extern struct platform_device imx_ssi_device1;
16extern struct platform_device mx25_csi_device; 13extern struct platform_device mx25_csi_device;
diff --git a/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
index 4aaadc753d3e..e765ac5d9a08 100644
--- a/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
+++ b/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
@@ -34,7 +34,6 @@
34#include <mach/mx25.h> 34#include <mach/mx25.h>
35#include <mach/imx-uart.h> 35#include <mach/imx-uart.h>
36#include <mach/imxfb.h> 36#include <mach/imxfb.h>
37#include <mach/ssi.h>
38#include <mach/audmux.h> 37#include <mach/audmux.h>
39 38
40#include "devices-imx25.h" 39#include "devices-imx25.h"
@@ -90,6 +89,9 @@ static struct pad_desc eukrea_mbimxsd_pads[] = {
90 MX25_PAD_KPP_COL2__AUD5_TXC, 89 MX25_PAD_KPP_COL2__AUD5_TXC,
91 MX25_PAD_KPP_COL1__AUD5_RXD, 90 MX25_PAD_KPP_COL1__AUD5_RXD,
92 MX25_PAD_KPP_COL0__AUD5_TXD, 91 MX25_PAD_KPP_COL0__AUD5_TXD,
92 /* CAN */
93 MX25_PAD_GPIO_D__CAN2_RX,
94 MX25_PAD_GPIO_C__CAN2_TX,
93}; 95};
94 96
95#define GPIO_LED1 83 97#define GPIO_LED1 83
@@ -114,6 +116,38 @@ static struct imx_fb_videomode eukrea_mximxsd_modes[] = {
114 }, 116 },
115 .bpp = 16, 117 .bpp = 16,
116 .pcr = 0xCAD08B80, 118 .pcr = 0xCAD08B80,
119 }, {
120 .mode = {
121 .name = "DVI-VGA",
122 .refresh = 60,
123 .xres = 640,
124 .yres = 480,
125 .pixclock = 32000,
126 .hsync_len = 7,
127 .left_margin = 100,
128 .right_margin = 100,
129 .vsync_len = 7,
130 .upper_margin = 7,
131 .lower_margin = 100,
132 },
133 .pcr = 0xFA208B80,
134 .bpp = 16,
135 }, {
136 .mode = {
137 .name = "DVI-SVGA",
138 .refresh = 60,
139 .xres = 800,
140 .yres = 600,
141 .pixclock = 25000,
142 .hsync_len = 7,
143 .left_margin = 75,
144 .right_margin = 75,
145 .vsync_len = 7,
146 .upper_margin = 7,
147 .lower_margin = 75,
148 },
149 .pcr = 0xFA208B80,
150 .bpp = 16,
117 }, 151 },
118}; 152};
119 153
@@ -205,7 +239,8 @@ static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
205 }, 239 },
206}; 240};
207 241
208struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = { 242static const
243struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
209 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE, 244 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
210}; 245};
211 246
@@ -239,7 +274,10 @@ void __init eukrea_mbimxsd25_baseboard_init(void)
239 274
240 imx25_add_imx_uart1(&uart_pdata); 275 imx25_add_imx_uart1(&uart_pdata);
241 mxc_register_device(&mx25_fb_device, &eukrea_mximxsd_fb_pdata); 276 mxc_register_device(&mx25_fb_device, &eukrea_mximxsd_fb_pdata);
242 mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata); 277 imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
278
279 imx25_add_flexcan1(NULL);
280 imx25_add_esdhc(0, NULL);
243 281
244 gpio_request(GPIO_LED1, "LED1"); 282 gpio_request(GPIO_LED1, "LED1");
245 gpio_direction_output(GPIO_LED1, 1); 283 gpio_direction_output(GPIO_LED1, 1);
diff --git a/arch/arm/mach-mx25/mach-cpuimx25.c b/arch/arm/mach-mx25/mach-cpuimx25.c
index e064bb3d6919..3b28a75007ad 100644
--- a/arch/arm/mach-mx25/mach-cpuimx25.c
+++ b/arch/arm/mach-mx25/mach-cpuimx25.c
@@ -23,7 +23,6 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/fec.h>
27#include <linux/platform_device.h> 26#include <linux/platform_device.h>
28#include <linux/usb/otg.h> 27#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h> 28#include <linux/usb/ulpi.h>
@@ -41,7 +40,6 @@
41#include <mach/mxc_nand.h> 40#include <mach/mxc_nand.h>
42#include <mach/imxfb.h> 41#include <mach/imxfb.h>
43#include <mach/mxc_ehci.h> 42#include <mach/mxc_ehci.h>
44#include <mach/ulpi.h>
45#include <mach/iomux-mx25.h> 43#include <mach/iomux-mx25.h>
46 44
47#include "devices-imx25.h" 45#include "devices-imx25.h"
@@ -67,7 +65,7 @@ static struct pad_desc eukrea_cpuimx25_pads[] = {
67 MX25_PAD_I2C1_DAT__I2C1_DAT, 65 MX25_PAD_I2C1_DAT__I2C1_DAT,
68}; 66};
69 67
70static struct fec_platform_data mx25_fec_pdata = { 68static const struct fec_platform_data mx25_fec_pdata __initconst = {
71 .phy = PHY_INTERFACE_MODE_RMII, 69 .phy = PHY_INTERFACE_MODE_RMII,
72}; 70};
73 71
@@ -129,24 +127,19 @@ static void __init eukrea_cpuimx25_init(void)
129 imx25_add_imx_uart0(&uart_pdata); 127 imx25_add_imx_uart0(&uart_pdata);
130 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); 128 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
131 mxc_register_device(&mx25_rtc_device, NULL); 129 mxc_register_device(&mx25_rtc_device, NULL);
132 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata); 130 imx25_add_fec(&mx25_fec_pdata);
133 131
134 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, 132 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
135 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); 133 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
136 imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data); 134 imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
137 135
138#if defined(CONFIG_USB_ULPI) 136 if (otg_mode_host)
139 if (otg_mode_host) {
140 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
141 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
142
143 mxc_register_device(&mxc_otg, &otg_pdata); 137 mxc_register_device(&mxc_otg, &otg_pdata);
144 } 138 else
145 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
146#endif
147 if (!otg_mode_host)
148 mxc_register_device(&otg_udc_device, &otg_device_pdata); 139 mxc_register_device(&otg_udc_device, &otg_device_pdata);
149 140
141 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
142
150#ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD 143#ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
151 eukrea_mbimxsd25_baseboard_init(); 144 eukrea_mbimxsd25_baseboard_init();
152#endif 145#endif
diff --git a/arch/arm/mach-mx25/mach-mx25_3ds.c b/arch/arm/mach-mx25/mach-mx25_3ds.c
index 62bc21f11a71..bd1805698631 100644
--- a/arch/arm/mach-mx25/mach-mx25_3ds.c
+++ b/arch/arm/mach-mx25/mach-mx25_3ds.c
@@ -28,7 +28,6 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/gpio.h> 30#include <linux/gpio.h>
31#include <linux/fec.h>
32#include <linux/platform_device.h> 31#include <linux/platform_device.h>
33#include <linux/input/matrix_keypad.h> 32#include <linux/input/matrix_keypad.h>
34 33
@@ -99,7 +98,7 @@ static struct pad_desc mx25pdk_pads[] = {
99 MX25_PAD_KPP_COL3__KPP_COL3, 98 MX25_PAD_KPP_COL3__KPP_COL3,
100}; 99};
101 100
102static struct fec_platform_data mx25_fec_pdata = { 101static const struct fec_platform_data mx25_fec_pdata __initconst = {
103 .phy = PHY_INTERFACE_MODE_RMII, 102 .phy = PHY_INTERFACE_MODE_RMII,
104}; 103};
105 104
@@ -192,7 +191,7 @@ static void __init mx25pdk_init(void)
192 mxc_register_device(&mxc_wdt, NULL); 191 mxc_register_device(&mxc_wdt, NULL);
193 192
194 mx25pdk_fec_reset(); 193 mx25pdk_fec_reset();
195 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata); 194 imx25_add_fec(&mx25_fec_pdata);
196 mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data); 195 mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data);
197} 196}
198 197
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 85beece802aa..096fd33f8ab9 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -9,6 +9,7 @@ config ARCH_MX35
9 bool 9 bool
10 select ARCH_MXC_IOMUX_V3 10 select ARCH_MXC_IOMUX_V3
11 select ARCH_MXC_AUDMUX_V2 11 select ARCH_MXC_AUDMUX_V2
12 select HAVE_EPIT
12 13
13comment "MX3 platforms:" 14comment "MX3 platforms:"
14 15
@@ -16,6 +17,7 @@ config MACH_MX31ADS
16 bool "Support MX31ADS platforms" 17 bool "Support MX31ADS platforms"
17 select ARCH_MX31 18 select ARCH_MX31
18 select IMX_HAVE_PLATFORM_IMX_I2C 19 select IMX_HAVE_PLATFORM_IMX_I2C
20 select IMX_HAVE_PLATFORM_IMX_SSI
19 select IMX_HAVE_PLATFORM_IMX_UART 21 select IMX_HAVE_PLATFORM_IMX_UART
20 default y 22 default y
21 help 23 help
@@ -117,9 +119,11 @@ config MACH_PCM043
117 bool "Support Phytec pcm043 (i.MX35) platforms" 119 bool "Support Phytec pcm043 (i.MX35) platforms"
118 select ARCH_MX35 120 select ARCH_MX35
119 select IMX_HAVE_PLATFORM_IMX_I2C 121 select IMX_HAVE_PLATFORM_IMX_I2C
122 select IMX_HAVE_PLATFORM_IMX_SSI
120 select IMX_HAVE_PLATFORM_IMX_UART 123 select IMX_HAVE_PLATFORM_IMX_UART
121 select IMX_HAVE_PLATFORM_MXC_NAND 124 select IMX_HAVE_PLATFORM_MXC_NAND
122 select IMX_HAVE_PLATFORM_FLEXCAN 125 select IMX_HAVE_PLATFORM_FLEXCAN
126 select IMX_HAVE_PLATFORM_ESDHC
123 select MXC_ULPI if USB_ULPI 127 select MXC_ULPI if USB_ULPI
124 help 128 help
125 Include support for Phytec pcm043 platform. This includes 129 Include support for Phytec pcm043 platform. This includes
@@ -140,6 +144,7 @@ config MACH_MX35_3DS
140 bool "Support MX35PDK platform" 144 bool "Support MX35PDK platform"
141 select ARCH_MX35 145 select ARCH_MX35
142 select IMX_HAVE_PLATFORM_IMX_UART 146 select IMX_HAVE_PLATFORM_IMX_UART
147 select IMX_HAVE_PLATFORM_MXC_NAND
143 default n 148 default n
144 help 149 help
145 Include support for MX35PDK platform. This includes specific 150 Include support for MX35PDK platform. This includes specific
@@ -159,6 +164,8 @@ config MACH_EUKREA_CPUIMX35
159 select IMX_HAVE_PLATFORM_IMX_UART 164 select IMX_HAVE_PLATFORM_IMX_UART
160 select IMX_HAVE_PLATFORM_IMX_I2C 165 select IMX_HAVE_PLATFORM_IMX_I2C
161 select IMX_HAVE_PLATFORM_MXC_NAND 166 select IMX_HAVE_PLATFORM_MXC_NAND
167 select IMX_HAVE_PLATFORM_FLEXCAN
168 select IMX_HAVE_PLATFORM_ESDHC
162 select MXC_ULPI if USB_ULPI 169 select MXC_ULPI if USB_ULPI
163 help 170 help
164 Include support for Eukrea CPUIMX35 platform. This includes 171 Include support for Eukrea CPUIMX35 platform. This includes
@@ -170,8 +177,8 @@ choice
170 default MACH_EUKREA_MBIMXSD35_BASEBOARD 177 default MACH_EUKREA_MBIMXSD35_BASEBOARD
171 178
172config MACH_EUKREA_MBIMXSD35_BASEBOARD 179config MACH_EUKREA_MBIMXSD35_BASEBOARD
173 prompt "Eukrea MBIMXSD development board" 180 bool "Eukrea MBIMXSD development board"
174 bool 181 select IMX_HAVE_PLATFORM_IMX_SSI
175 help 182 help
176 This adds board specific devices that can be found on Eukrea's 183 This adds board specific devices that can be found on Eukrea's
177 MBIMXSD evaluation board. 184 MBIMXSD evaluation board.
diff --git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index 2bd7beceb991..8a182d0a3fcf 100644
--- a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -7,7 +7,6 @@
7obj-y := mm.o devices.o cpu.o 7obj-y := mm.o devices.o cpu.o
8CFLAGS_mm.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS 8CFLAGS_mm.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
9CFLAGS_devices.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS 9CFLAGS_devices.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
10CFLAGS_cpu.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
11obj-$(CONFIG_ARCH_MX31) += clock-imx31.o iomux-imx31.o 10obj-$(CONFIG_ARCH_MX31) += clock-imx31.o iomux-imx31.o
12obj-$(CONFIG_ARCH_MX35) += clock-imx35.o 11obj-$(CONFIG_ARCH_MX35) += clock-imx35.o
13obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o 12obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o
diff --git a/arch/arm/mach-mx3/clock-imx31.c b/arch/arm/mach-mx3/clock-imx31.c
index 9a9eb6de6127..109e98f323e0 100644
--- a/arch/arm/mach-mx3/clock-imx31.c
+++ b/arch/arm/mach-mx3/clock-imx31.c
@@ -477,7 +477,7 @@ DEFINE_CLOCK(epit1_clk, 0, MXC_CCM_CGR0, 6, NULL, NULL, &perclk_clk);
477DEFINE_CLOCK(epit2_clk, 1, MXC_CCM_CGR0, 8, NULL, NULL, &perclk_clk); 477DEFINE_CLOCK(epit2_clk, 1, MXC_CCM_CGR0, 8, NULL, NULL, &perclk_clk);
478DEFINE_CLOCK(iim_clk, 0, MXC_CCM_CGR0, 10, NULL, NULL, &ipg_clk); 478DEFINE_CLOCK(iim_clk, 0, MXC_CCM_CGR0, 10, NULL, NULL, &ipg_clk);
479DEFINE_CLOCK(ata_clk, 0, MXC_CCM_CGR0, 12, NULL, NULL, &ipg_clk); 479DEFINE_CLOCK(ata_clk, 0, MXC_CCM_CGR0, 12, NULL, NULL, &ipg_clk);
480DEFINE_CLOCK(sdma_clk1, 0, MXC_CCM_CGR0, 14, NULL, &sdma_clk1, &ahb_clk); 480DEFINE_CLOCK(sdma_clk1, 0, MXC_CCM_CGR0, 14, NULL, NULL, &ahb_clk);
481DEFINE_CLOCK(cspi3_clk, 2, MXC_CCM_CGR0, 16, NULL, NULL, &ipg_clk); 481DEFINE_CLOCK(cspi3_clk, 2, MXC_CCM_CGR0, 16, NULL, NULL, &ipg_clk);
482DEFINE_CLOCK(rng_clk, 0, MXC_CCM_CGR0, 18, NULL, NULL, &ipg_clk); 482DEFINE_CLOCK(rng_clk, 0, MXC_CCM_CGR0, 18, NULL, NULL, &ipg_clk);
483DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CGR0, 20, NULL, NULL, &perclk_clk); 483DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CGR0, 20, NULL, NULL, &perclk_clk);
@@ -525,9 +525,9 @@ DEFINE_CLOCK(ipg_clk, 0, NULL, 0, ipg_get_rate, NULL, &ahb_clk);
525 525
526static struct clk_lookup lookups[] = { 526static struct clk_lookup lookups[] = {
527 _REGISTER_CLOCK(NULL, "emi", emi_clk) 527 _REGISTER_CLOCK(NULL, "emi", emi_clk)
528 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk) 528 _REGISTER_CLOCK("imx31-cspi.0", NULL, cspi1_clk)
529 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk) 529 _REGISTER_CLOCK("imx31-cspi.1", NULL, cspi2_clk)
530 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk) 530 _REGISTER_CLOCK("imx31-cspi.2", NULL, cspi3_clk)
531 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 531 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
532 _REGISTER_CLOCK(NULL, "pwm", pwm_clk) 532 _REGISTER_CLOCK(NULL, "pwm", pwm_clk)
533 _REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk) 533 _REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
@@ -564,7 +564,7 @@ static struct clk_lookup lookups[] = {
564 _REGISTER_CLOCK(NULL, "ata", ata_clk) 564 _REGISTER_CLOCK(NULL, "ata", ata_clk)
565 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 565 _REGISTER_CLOCK(NULL, "rtic", rtic_clk)
566 _REGISTER_CLOCK(NULL, "rng", rng_clk) 566 _REGISTER_CLOCK(NULL, "rng", rng_clk)
567 _REGISTER_CLOCK(NULL, "sdma_ahb", sdma_clk1) 567 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1)
568 _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2) 568 _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2)
569 _REGISTER_CLOCK(NULL, "mstick", mstick1_clk) 569 _REGISTER_CLOCK(NULL, "mstick", mstick1_clk)
570 _REGISTER_CLOCK(NULL, "mstick", mstick2_clk) 570 _REGISTER_CLOCK(NULL, "mstick", mstick2_clk)
diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index 7a62e744a8b0..61e4a318980a 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -364,8 +364,8 @@ DEFINE_CLOCK(cspi2_clk, 1, CCM_CGR0, 12, get_rate_ipg, NULL);
364DEFINE_CLOCK(ect_clk, 0, CCM_CGR0, 14, get_rate_ipg, NULL); 364DEFINE_CLOCK(ect_clk, 0, CCM_CGR0, 14, get_rate_ipg, NULL);
365DEFINE_CLOCK(edio_clk, 0, CCM_CGR0, 16, NULL, NULL); 365DEFINE_CLOCK(edio_clk, 0, CCM_CGR0, 16, NULL, NULL);
366DEFINE_CLOCK(emi_clk, 0, CCM_CGR0, 18, get_rate_ipg, NULL); 366DEFINE_CLOCK(emi_clk, 0, CCM_CGR0, 18, get_rate_ipg, NULL);
367DEFINE_CLOCK(epit1_clk, 0, CCM_CGR0, 20, get_rate_ipg_per, NULL); 367DEFINE_CLOCK(epit1_clk, 0, CCM_CGR0, 20, get_rate_ipg, NULL);
368DEFINE_CLOCK(epit2_clk, 1, CCM_CGR0, 22, get_rate_ipg_per, NULL); 368DEFINE_CLOCK(epit2_clk, 1, CCM_CGR0, 22, get_rate_ipg, NULL);
369DEFINE_CLOCK(esai_clk, 0, CCM_CGR0, 24, NULL, NULL); 369DEFINE_CLOCK(esai_clk, 0, CCM_CGR0, 24, NULL, NULL);
370DEFINE_CLOCK(esdhc1_clk, 0, CCM_CGR0, 26, get_rate_sdhc, NULL); 370DEFINE_CLOCK(esdhc1_clk, 0, CCM_CGR0, 26, get_rate_sdhc, NULL);
371DEFINE_CLOCK(esdhc2_clk, 1, CCM_CGR0, 28, get_rate_sdhc, NULL); 371DEFINE_CLOCK(esdhc2_clk, 1, CCM_CGR0, 28, get_rate_sdhc, NULL);
@@ -451,17 +451,17 @@ static struct clk_lookup lookups[] = {
451 _REGISTER_CLOCK(NULL, "ata", ata_clk) 451 _REGISTER_CLOCK(NULL, "ata", ata_clk)
452 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk) 452 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
453 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk) 453 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
454 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk) 454 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi1_clk)
455 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk) 455 _REGISTER_CLOCK("imx35-cspi.1", NULL, cspi2_clk)
456 _REGISTER_CLOCK(NULL, "ect", ect_clk) 456 _REGISTER_CLOCK(NULL, "ect", ect_clk)
457 _REGISTER_CLOCK(NULL, "edio", edio_clk) 457 _REGISTER_CLOCK(NULL, "edio", edio_clk)
458 _REGISTER_CLOCK(NULL, "emi", emi_clk) 458 _REGISTER_CLOCK(NULL, "emi", emi_clk)
459 _REGISTER_CLOCK(NULL, "epit", epit1_clk) 459 _REGISTER_CLOCK("imx-epit.0", NULL, epit1_clk)
460 _REGISTER_CLOCK(NULL, "epit", epit2_clk) 460 _REGISTER_CLOCK("imx-epit.1", NULL, epit2_clk)
461 _REGISTER_CLOCK(NULL, "esai", esai_clk) 461 _REGISTER_CLOCK(NULL, "esai", esai_clk)
462 _REGISTER_CLOCK(NULL, "sdhc", esdhc1_clk) 462 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
463 _REGISTER_CLOCK(NULL, "sdhc", esdhc2_clk) 463 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
464 _REGISTER_CLOCK(NULL, "sdhc", esdhc3_clk) 464 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk)
465 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 465 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
466 _REGISTER_CLOCK(NULL, "gpio", gpio1_clk) 466 _REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
467 _REGISTER_CLOCK(NULL, "gpio", gpio2_clk) 467 _REGISTER_CLOCK(NULL, "gpio", gpio2_clk)
@@ -482,7 +482,7 @@ static struct clk_lookup lookups[] = {
482 _REGISTER_CLOCK(NULL, "rtc", rtc_clk) 482 _REGISTER_CLOCK(NULL, "rtc", rtc_clk)
483 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 483 _REGISTER_CLOCK(NULL, "rtic", rtic_clk)
484 _REGISTER_CLOCK(NULL, "scc", scc_clk) 484 _REGISTER_CLOCK(NULL, "scc", scc_clk)
485 _REGISTER_CLOCK(NULL, "sdma", sdma_clk) 485 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
486 _REGISTER_CLOCK(NULL, "spba", spba_clk) 486 _REGISTER_CLOCK(NULL, "spba", spba_clk)
487 _REGISTER_CLOCK(NULL, "spdif", spdif_clk) 487 _REGISTER_CLOCK(NULL, "spdif", spdif_clk)
488 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 488 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
@@ -535,8 +535,16 @@ int __init mx35_clocks_init()
535 __raw_writel(cgr2, CCM_BASE + CCM_CGR2); 535 __raw_writel(cgr2, CCM_BASE + CCM_CGR2);
536 __raw_writel(cgr3, CCM_BASE + CCM_CGR3); 536 __raw_writel(cgr3, CCM_BASE + CCM_CGR3);
537 537
538 clk_enable(&iim_clk);
539 mx35_read_cpu_rev();
540
541#ifdef CONFIG_MXC_USE_EPIT
542 epit_timer_init(&epit1_clk,
543 MX35_IO_ADDRESS(MX35_EPIT1_BASE_ADDR), MX35_INT_EPIT1);
544#else
538 mxc_timer_init(&gpt_clk, 545 mxc_timer_init(&gpt_clk,
539 MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), MX35_INT_GPT); 546 MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), MX35_INT_GPT);
547#endif
540 548
541 return 0; 549 return 0;
542} 550}
diff --git a/arch/arm/mach-mx3/cpu.c b/arch/arm/mach-mx3/cpu.c
index 861afe0fe3ad..d00a75457812 100644
--- a/arch/arm/mach-mx3/cpu.c
+++ b/arch/arm/mach-mx3/cpu.c
@@ -25,15 +25,15 @@ struct mx3_cpu_type {
25}; 25};
26 26
27static struct mx3_cpu_type mx31_cpu_type[] __initdata = { 27static struct mx3_cpu_type mx31_cpu_type[] __initdata = {
28 { .srev = 0x00, .name = "i.MX31(L)", .v = "1.0", .rev = CHIP_REV_1_0 }, 28 { .srev = 0x00, .name = "i.MX31(L)", .v = "1.0", .rev = MX3x_CHIP_REV_1_0 },
29 { .srev = 0x10, .name = "i.MX31", .v = "1.1", .rev = CHIP_REV_1_1 }, 29 { .srev = 0x10, .name = "i.MX31", .v = "1.1", .rev = MX3x_CHIP_REV_1_1 },
30 { .srev = 0x11, .name = "i.MX31L", .v = "1.1", .rev = CHIP_REV_1_1 }, 30 { .srev = 0x11, .name = "i.MX31L", .v = "1.1", .rev = MX3x_CHIP_REV_1_1 },
31 { .srev = 0x12, .name = "i.MX31", .v = "1.15", .rev = CHIP_REV_1_1 }, 31 { .srev = 0x12, .name = "i.MX31", .v = "1.15", .rev = MX3x_CHIP_REV_1_1 },
32 { .srev = 0x13, .name = "i.MX31L", .v = "1.15", .rev = CHIP_REV_1_1 }, 32 { .srev = 0x13, .name = "i.MX31L", .v = "1.15", .rev = MX3x_CHIP_REV_1_1 },
33 { .srev = 0x14, .name = "i.MX31", .v = "1.2", .rev = CHIP_REV_1_2 }, 33 { .srev = 0x14, .name = "i.MX31", .v = "1.2", .rev = MX3x_CHIP_REV_1_2 },
34 { .srev = 0x15, .name = "i.MX31L", .v = "1.2", .rev = CHIP_REV_1_2 }, 34 { .srev = 0x15, .name = "i.MX31L", .v = "1.2", .rev = MX3x_CHIP_REV_1_2 },
35 { .srev = 0x28, .name = "i.MX31", .v = "2.0", .rev = CHIP_REV_2_0 }, 35 { .srev = 0x28, .name = "i.MX31", .v = "2.0", .rev = MX3x_CHIP_REV_2_0 },
36 { .srev = 0x29, .name = "i.MX31L", .v = "2.0", .rev = CHIP_REV_2_0 }, 36 { .srev = 0x29, .name = "i.MX31L", .v = "2.0", .rev = MX3x_CHIP_REV_2_0 },
37}; 37};
38 38
39void __init mx31_read_cpu_rev(void) 39void __init mx31_read_cpu_rev(void)
@@ -41,7 +41,7 @@ void __init mx31_read_cpu_rev(void)
41 u32 i, srev; 41 u32 i, srev;
42 42
43 /* read SREV register from IIM module */ 43 /* read SREV register from IIM module */
44 srev = __raw_readl(IO_ADDRESS(IIM_BASE_ADDR + MXC_IIMSREV)); 44 srev = __raw_readl(MX31_IO_ADDRESS(MX31_IIM_BASE_ADDR + MXC_IIMSREV));
45 45
46 for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++) 46 for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++)
47 if (srev == mx31_cpu_type[i].srev) { 47 if (srev == mx31_cpu_type[i].srev) {
@@ -55,3 +55,30 @@ void __init mx31_read_cpu_rev(void)
55 55
56 printk(KERN_WARNING "Unknown CPU identifier. srev = %02x\n", srev); 56 printk(KERN_WARNING "Unknown CPU identifier. srev = %02x\n", srev);
57} 57}
58
59unsigned int mx35_cpu_rev;
60EXPORT_SYMBOL(mx35_cpu_rev);
61
62void __init mx35_read_cpu_rev(void)
63{
64 u32 rev;
65 char *srev = "unknown";
66
67 rev = __raw_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
68 switch (rev) {
69 case 0x00:
70 mx35_cpu_rev = MX3x_CHIP_REV_1_0;
71 srev = "1.0";
72 break;
73 case 0x10:
74 mx35_cpu_rev = MX3x_CHIP_REV_2_0;
75 srev = "2.0";
76 break;
77 case 0x11:
78 mx35_cpu_rev = MX3x_CHIP_REV_2_1;
79 srev = "2.1";
80 break;
81 }
82
83 printk(KERN_INFO "CPU identified as i.MX35, silicon rev %s\n", srev);
84}
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h
index 3b1a44a20585..de9598590eba 100644
--- a/arch/arm/mach-mx3/devices-imx31.h
+++ b/arch/arm/mach-mx3/devices-imx31.h
@@ -9,30 +9,33 @@
9#include <mach/mx31.h> 9#include <mach/mx31.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12#define imx31_add_imx_i2c0(pdata) \ 12extern const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst;
13 imx_add_imx_i2c(0, MX31_I2C1_BASE_ADDR, SZ_4K, MX31_INT_I2C1, pdata) 13#define imx31_add_imx_i2c(id, pdata) \
14#define imx31_add_imx_i2c1(pdata) \ 14 imx_add_imx_i2c(&imx31_imx_i2c_data[id], pdata)
15 imx_add_imx_i2c(1, MX31_I2C2_BASE_ADDR, SZ_4K, MX31_INT_I2C2, pdata) 15#define imx31_add_imx_i2c0(pdata) imx31_add_imx_i2c(0, pdata)
16#define imx31_add_imx_i2c2(pdata) \ 16#define imx31_add_imx_i2c1(pdata) imx31_add_imx_i2c(1, pdata)
17 imx_add_imx_i2c(2, MX31_I2C3_BASE_ADDR, SZ_4K, MX31_INT_I2C3, pdata) 17#define imx31_add_imx_i2c2(pdata) imx31_add_imx_i2c(2, pdata)
18 18
19#define imx31_add_imx_uart0(pdata) \ 19extern const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst;
20 imx_add_imx_uart_1irq(0, MX31_UART1_BASE_ADDR, SZ_16K, MX31_INT_UART1, pdata) 20#define imx31_add_imx_ssi(id, pdata) \
21#define imx31_add_imx_uart1(pdata) \ 21 imx_add_imx_ssi(&imx31_imx_ssi_data[id], pdata)
22 imx_add_imx_uart_1irq(1, MX31_UART2_BASE_ADDR, SZ_16K, MX31_INT_UART2, pdata)
23#define imx31_add_imx_uart2(pdata) \
24 imx_add_imx_uart_1irq(2, MX31_UART3_BASE_ADDR, SZ_16K, MX31_INT_UART3, pdata)
25#define imx31_add_imx_uart3(pdata) \
26 imx_add_imx_uart_1irq(3, MX31_UART4_BASE_ADDR, SZ_16K, MX31_INT_UART4, pdata)
27#define imx31_add_imx_uart4(pdata) \
28 imx_add_imx_uart_1irq(4, MX31_UART5_BASE_ADDR, SZ_16K, MX31_INT_UART5, pdata)
29 22
23extern const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst;
24#define imx31_add_imx_uart(id, pdata) \
25 imx_add_imx_uart_1irq(&imx31_imx_uart_data[id], pdata)
26#define imx31_add_imx_uart0(pdata) imx31_add_imx_uart(0, pdata)
27#define imx31_add_imx_uart1(pdata) imx31_add_imx_uart(1, pdata)
28#define imx31_add_imx_uart2(pdata) imx31_add_imx_uart(2, pdata)
29#define imx31_add_imx_uart3(pdata) imx31_add_imx_uart(3, pdata)
30#define imx31_add_imx_uart4(pdata) imx31_add_imx_uart(4, pdata)
31
32extern const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst;
30#define imx31_add_mxc_nand(pdata) \ 33#define imx31_add_mxc_nand(pdata) \
31 imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata) 34 imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
32 35
33#define imx31_add_spi_imx0(pdata) \ 36extern const struct imx_spi_imx_data imx31_cspi_data[] __initconst;
34 imx_add_spi_imx(0, MX31_CSPI1_BASE_ADDR, SZ_4K, MX31_INT_CSPI1, pdata) 37#define imx31_add_cspi(id, pdata) \
35#define imx31_add_spi_imx1(pdata) \ 38 imx_add_spi_imx(&imx31_cspi_data[id], pdata)
36 imx_add_spi_imx(1, MX31_CSPI2_BASE_ADDR, SZ_4K, MX31_INT_CSPI2, pdata) 39#define imx31_add_spi_imx0(pdata) imx31_add_cspi(0, pdata)
37#define imx31_add_spi_imx2(pdata) \ 40#define imx31_add_spi_imx1(pdata) imx31_add_cspi(1, pdata)
38 imx_add_spi_imx(2, MX31_CSPI3_BASE_ADDR, SZ_4K, MX31_INT_CSPI3, pdata) 41#define imx31_add_spi_imx2(pdata) imx31_add_cspi(2, pdata)
diff --git a/arch/arm/mach-mx3/devices-imx35.h b/arch/arm/mach-mx3/devices-imx35.h
index f6a431a4c3d2..5eb917b638d0 100644
--- a/arch/arm/mach-mx3/devices-imx35.h
+++ b/arch/arm/mach-mx3/devices-imx35.h
@@ -9,29 +9,43 @@
9#include <mach/mx35.h> 9#include <mach/mx35.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12extern const struct imx_fec_data imx35_fec_data __initconst;
13#define imx35_add_fec(pdata) \
14 imx_add_fec(&imx35_fec_data, pdata)
15
12#define imx35_add_flexcan0(pdata) \ 16#define imx35_add_flexcan0(pdata) \
13 imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata) 17 imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata)
14#define imx35_add_flexcan1(pdata) \ 18#define imx35_add_flexcan1(pdata) \
15 imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata) 19 imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata)
16 20
17#define imx35_add_imx_i2c0(pdata) \ 21extern const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst;
18 imx_add_imx_i2c(0, MX35_I2C1_BASE_ADDR, SZ_4K, MX35_INT_I2C1, pdata) 22#define imx35_add_imx_i2c(id, pdata) \
19#define imx35_add_imx_i2c1(pdata) \ 23 imx_add_imx_i2c(&imx35_imx_i2c_data[id], pdata)
20 imx_add_imx_i2c(1, MX35_I2C2_BASE_ADDR, SZ_4K, MX35_INT_I2C2, pdata) 24#define imx35_add_imx_i2c0(pdata) imx35_add_imx_i2c(0, pdata)
21#define imx35_add_imx_i2c2(pdata) \ 25#define imx35_add_imx_i2c1(pdata) imx35_add_imx_i2c(1, pdata)
22 imx_add_imx_i2c(2, MX35_I2C3_BASE_ADDR, SZ_4K, MX35_INT_I2C3, pdata) 26#define imx35_add_imx_i2c2(pdata) imx35_add_imx_i2c(2, pdata)
27
28extern const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst;
29#define imx35_add_imx_ssi(id, pdata) \
30 imx_add_imx_ssi(&imx35_imx_ssi_data[id], pdata)
23 31
24#define imx35_add_imx_uart0(pdata) \ 32extern const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst;
25 imx_add_imx_uart_1irq(0, MX35_UART1_BASE_ADDR, SZ_16K, MX35_INT_UART1, pdata) 33#define imx35_add_imx_uart(id, pdata) \
26#define imx35_add_imx_uart1(pdata) \ 34 imx_add_imx_uart_1irq(&imx35_imx_uart_data[id], pdata)
27 imx_add_imx_uart_1irq(1, MX35_UART2_BASE_ADDR, SZ_16K, MX35_INT_UART2, pdata) 35#define imx35_add_imx_uart0(pdata) imx35_add_imx_uart(0, pdata)
28#define imx35_add_imx_uart2(pdata) \ 36#define imx35_add_imx_uart1(pdata) imx35_add_imx_uart(1, pdata)
29 imx_add_imx_uart_1irq(2, MX35_UART3_BASE_ADDR, SZ_16K, MX35_INT_UART3, pdata) 37#define imx35_add_imx_uart2(pdata) imx35_add_imx_uart(2, pdata)
30 38
39extern const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst;
31#define imx35_add_mxc_nand(pdata) \ 40#define imx35_add_mxc_nand(pdata) \
32 imx_add_mxc_nand_v21(MX35_NFC_BASE_ADDR, MX35_INT_NANDFC, pdata) 41 imx_add_mxc_nand(&imx35_mxc_nand_data, pdata)
42
43extern const struct imx_spi_imx_data imx35_cspi_data[] __initconst;
44#define imx35_add_cspi(id, pdata) \
45 imx_add_spi_imx(&imx35_cspi_data[id], pdata)
46#define imx35_add_spi_imx0(pdata) imx35_add_cspi(0, pdata)
47#define imx35_add_spi_imx1(pdata) imx35_add_cspi(1, pdata)
33 48
34#define imx35_add_spi_imx0(pdata) \ 49extern const struct imx_esdhc_imx_data imx35_esdhc_data[] __initconst;
35 imx_add_spi_imx(0, MX35_CSPI1_BASE_ADDR, SZ_4K, MX35_INT_CSPI1, pdata) 50#define imx35_add_esdhc(id, pdata) \
36#define imx35_add_spi_imx1(pdata) \ 51 imx_add_esdhc(&imx35_esdhc_data[id], pdata)
37 imx_add_spi_imx(1, MX35_CSPI2_BASE_ADDR, SZ_4K, MX35_INT_CSPI2, pdata)
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index a4fd1a26fc91..f4dff11aaee7 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -281,65 +281,6 @@ struct platform_device mxc_usbh2 = {
281 .num_resources = ARRAY_SIZE(mxc_usbh2_resources), 281 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
282}; 282};
283 283
284#if defined(CONFIG_ARCH_MX35)
285static struct resource mxc_fec_resources[] = {
286 {
287 .start = MXC_FEC_BASE_ADDR,
288 .end = MXC_FEC_BASE_ADDR + 0xfff,
289 .flags = IORESOURCE_MEM,
290 }, {
291 .start = MXC_INT_FEC,
292 .end = MXC_INT_FEC,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297struct platform_device mxc_fec_device = {
298 .name = "fec",
299 .id = 0,
300 .num_resources = ARRAY_SIZE(mxc_fec_resources),
301 .resource = mxc_fec_resources,
302};
303#endif
304
305static struct resource imx_ssi_resources0[] = {
306 {
307 .start = SSI1_BASE_ADDR,
308 .end = SSI1_BASE_ADDR + 0xfff,
309 .flags = IORESOURCE_MEM,
310 }, {
311 .start = MX31_INT_SSI1,
312 .end = MX31_INT_SSI1,
313 .flags = IORESOURCE_IRQ,
314 },
315};
316
317static struct resource imx_ssi_resources1[] = {
318 {
319 .start = SSI2_BASE_ADDR,
320 .end = SSI2_BASE_ADDR + 0xfff,
321 .flags = IORESOURCE_MEM
322 }, {
323 .start = MX31_INT_SSI2,
324 .end = MX31_INT_SSI2,
325 .flags = IORESOURCE_IRQ,
326 },
327};
328
329struct platform_device imx_ssi_device0 = {
330 .name = "imx-ssi",
331 .id = 0,
332 .num_resources = ARRAY_SIZE(imx_ssi_resources0),
333 .resource = imx_ssi_resources0,
334};
335
336struct platform_device imx_ssi_device1 = {
337 .name = "imx-ssi",
338 .id = 1,
339 .num_resources = ARRAY_SIZE(imx_ssi_resources1),
340 .resource = imx_ssi_resources1,
341};
342
343static struct resource imx_wdt_resources[] = { 284static struct resource imx_wdt_resources[] = {
344 { 285 {
345 .flags = IORESOURCE_MEM, 286 .flags = IORESOURCE_MEM,
@@ -410,10 +351,6 @@ static int __init mx3_devices_init(void)
410 mxc_usbh1_resources[0].end = MX35_OTG_BASE_ADDR + 0x5ff; 351 mxc_usbh1_resources[0].end = MX35_OTG_BASE_ADDR + 0x5ff;
411 mxc_usbh1_resources[1].start = MXC_INT_USBHS; 352 mxc_usbh1_resources[1].start = MXC_INT_USBHS;
412 mxc_usbh1_resources[1].end = MXC_INT_USBHS; 353 mxc_usbh1_resources[1].end = MXC_INT_USBHS;
413 imx_ssi_resources0[1].start = MX35_INT_SSI1;
414 imx_ssi_resources0[1].end = MX35_INT_SSI1;
415 imx_ssi_resources1[1].start = MX35_INT_SSI2;
416 imx_ssi_resources1[1].end = MX35_INT_SSI2;
417 imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR; 354 imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
418 imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff; 355 imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
419 } 356 }
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index e5535234839f..585f814473d5 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -2,7 +2,6 @@ extern struct platform_device mxc_w1_master_device;
2extern struct platform_device mx3_ipu; 2extern struct platform_device mx3_ipu;
3extern struct platform_device mx3_fb; 3extern struct platform_device mx3_fb;
4extern struct platform_device mx3_camera; 4extern struct platform_device mx3_camera;
5extern struct platform_device mxc_fec_device;
6extern struct platform_device mxcsdhc_device0; 5extern struct platform_device mxcsdhc_device0;
7extern struct platform_device mxcsdhc_device1; 6extern struct platform_device mxcsdhc_device1;
8extern struct platform_device mxc_otg_udc_device; 7extern struct platform_device mxc_otg_udc_device;
@@ -10,9 +9,6 @@ extern struct platform_device mxc_otg_host;
10extern struct platform_device mxc_usbh1; 9extern struct platform_device mxc_usbh1;
11extern struct platform_device mxc_usbh2; 10extern struct platform_device mxc_usbh2;
12extern struct platform_device mxc_rnga_device; 11extern struct platform_device mxc_rnga_device;
13extern struct platform_device imx_ssi_device0;
14extern struct platform_device imx_ssi_device1;
15extern struct platform_device imx_ssi_device1;
16extern struct platform_device imx_wdt_device0; 12extern struct platform_device imx_wdt_device0;
17extern struct platform_device imx_rtc_device0; 13extern struct platform_device imx_rtc_device0;
18extern struct platform_device imx_kpp_device; 14extern struct platform_device imx_kpp_device;
diff --git a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
index f8f15e3ac7a0..1abc10d52922 100644
--- a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
+++ b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
@@ -43,14 +43,13 @@
43#include <mach/ipu.h> 43#include <mach/ipu.h>
44#include <mach/mx3fb.h> 44#include <mach/mx3fb.h>
45#include <mach/audmux.h> 45#include <mach/audmux.h>
46#include <mach/ssi.h>
47 46
48#include "devices-imx35.h" 47#include "devices-imx35.h"
49#include "devices.h" 48#include "devices.h"
50 49
51static const struct fb_videomode fb_modedb[] = { 50static const struct fb_videomode fb_modedb[] = {
52 { 51 {
53 .name = "CMO_QVGA", 52 .name = "CMO-QVGA",
54 .refresh = 60, 53 .refresh = 60,
55 .xres = 320, 54 .xres = 320,
56 .yres = 240, 55 .yres = 240,
@@ -65,6 +64,40 @@ static const struct fb_videomode fb_modedb[] = {
65 .vmode = FB_VMODE_NONINTERLACED, 64 .vmode = FB_VMODE_NONINTERLACED,
66 .flag = 0, 65 .flag = 0,
67 }, 66 },
67 {
68 .name = "DVI-VGA",
69 .refresh = 60,
70 .xres = 640,
71 .yres = 480,
72 .pixclock = 32000,
73 .left_margin = 100,
74 .right_margin = 100,
75 .upper_margin = 7,
76 .lower_margin = 100,
77 .hsync_len = 7,
78 .vsync_len = 7,
79 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT |
80 FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
81 .vmode = FB_VMODE_NONINTERLACED,
82 .flag = 0,
83 },
84 {
85 .name = "DVI-SVGA",
86 .refresh = 60,
87 .xres = 800,
88 .yres = 600,
89 .pixclock = 25000,
90 .left_margin = 75,
91 .right_margin = 75,
92 .upper_margin = 7,
93 .lower_margin = 75,
94 .hsync_len = 7,
95 .vsync_len = 7,
96 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT |
97 FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
98 .vmode = FB_VMODE_NONINTERLACED,
99 .flag = 0,
100 },
68}; 101};
69 102
70static struct ipu_platform_data mx3_ipu_data = { 103static struct ipu_platform_data mx3_ipu_data = {
@@ -73,7 +106,7 @@ static struct ipu_platform_data mx3_ipu_data = {
73 106
74static struct mx3fb_platform_data mx3fb_pdata = { 107static struct mx3fb_platform_data mx3fb_pdata = {
75 .dma_dev = &mx3_ipu.dev, 108 .dma_dev = &mx3_ipu.dev,
76 .name = "CMO_QVGA", 109 .name = "CMO-QVGA",
77 .mode = fb_modedb, 110 .mode = fb_modedb,
78 .num_modes = ARRAY_SIZE(fb_modedb), 111 .num_modes = ARRAY_SIZE(fb_modedb),
79}; 112};
@@ -120,6 +153,16 @@ static struct pad_desc eukrea_mbimxsd_pads[] = {
120 MX35_PAD_STXD4__AUDMUX_AUD4_TXD, 153 MX35_PAD_STXD4__AUDMUX_AUD4_TXD,
121 MX35_PAD_SRXD4__AUDMUX_AUD4_RXD, 154 MX35_PAD_SRXD4__AUDMUX_AUD4_RXD,
122 MX35_PAD_SCK4__AUDMUX_AUD4_TXC, 155 MX35_PAD_SCK4__AUDMUX_AUD4_TXC,
156 /* CAN2 */
157 MX35_PAD_TX5_RX0__CAN2_TXCAN,
158 MX35_PAD_TX4_RX1__CAN2_RXCAN,
159 /* SDCARD */
160 MX35_PAD_SD1_CMD__ESDHC1_CMD,
161 MX35_PAD_SD1_CLK__ESDHC1_CLK,
162 MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
163 MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
164 MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
165 MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
123}; 166};
124 167
125#define GPIO_LED1 (2 * 32 + 29) 168#define GPIO_LED1 (2 * 32 + 29)
@@ -206,7 +249,8 @@ static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
206 }, 249 },
207}; 250};
208 251
209struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = { 252static const
253struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
210 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE, 254 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
211}; 255};
212 256
@@ -242,7 +286,10 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
242 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 286 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
243 mxc_register_device(&mx3_fb, &mx3fb_pdata); 287 mxc_register_device(&mx3_fb, &mx3fb_pdata);
244 288
245 mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata); 289 imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
290
291 imx35_add_flexcan1(NULL);
292 imx35_add_esdhc(0, NULL);
246 293
247 gpio_request(GPIO_LED1, "LED1"); 294 gpio_request(GPIO_LED1, "LED1");
248 gpio_direction_output(GPIO_LED1, 1); 295 gpio_direction_output(GPIO_LED1, 1);
@@ -254,7 +301,7 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
254 301
255 gpio_request(GPIO_LCDPWR, "LCDPWR"); 302 gpio_request(GPIO_LCDPWR, "LCDPWR");
256 gpio_direction_output(GPIO_LCDPWR, 1); 303 gpio_direction_output(GPIO_LCDPWR, 1);
257 gpio_free(GPIO_SWITCH1); 304 gpio_free(GPIO_LCDPWR);
258 305
259 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 306 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
260 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); 307 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
diff --git a/arch/arm/mach-mx3/mach-cpuimx35.c b/arch/arm/mach-mx3/mach-cpuimx35.c
index 2a4f8b781ba4..bf2d6e2ec0d6 100644
--- a/arch/arm/mach-mx3/mach-cpuimx35.c
+++ b/arch/arm/mach-mx3/mach-cpuimx35.c
@@ -31,6 +31,7 @@
31#include <linux/usb/otg.h> 31#include <linux/usb/otg.h>
32#include <linux/usb/ulpi.h> 32#include <linux/usb/ulpi.h>
33#include <linux/fsl_devices.h> 33#include <linux/fsl_devices.h>
34#include <linux/i2c-gpio.h>
34 35
35#include <asm/mach-types.h> 36#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
@@ -43,7 +44,6 @@
43#include <mach/iomux-mx35.h> 44#include <mach/iomux-mx35.h>
44#include <mach/mxc_nand.h> 45#include <mach/mxc_nand.h>
45#include <mach/mxc_ehci.h> 46#include <mach/mxc_ehci.h>
46#include <mach/ulpi.h>
47 47
48#include "devices-imx35.h" 48#include "devices-imx35.h"
49#include "devices.h" 49#include "devices.h"
@@ -53,39 +53,16 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
53}; 53};
54 54
55static const struct imxi2c_platform_data 55static const struct imxi2c_platform_data
56eukrea_cpuimx35_i2c0_data __initconst = { 56 eukrea_cpuimx35_i2c0_data __initconst = {
57 .bitrate = 50000, 57 .bitrate = 100000,
58}; 58};
59 59
60#define TSC2007_IRQGPIO (2 * 32 + 2)
61static int ts_get_pendown_state(void)
62{
63 int val = 0;
64 gpio_free(TSC2007_IRQGPIO);
65 gpio_request(TSC2007_IRQGPIO, NULL);
66 gpio_direction_input(TSC2007_IRQGPIO);
67
68 val = gpio_get_value(TSC2007_IRQGPIO);
69
70 gpio_free(TSC2007_IRQGPIO);
71 gpio_request(TSC2007_IRQGPIO, NULL);
72
73 return val ? 0 : 1;
74}
75
76static int ts_init(void)
77{
78 gpio_request(TSC2007_IRQGPIO, NULL);
79 return 0;
80}
81
82static struct tsc2007_platform_data tsc2007_info = { 60static struct tsc2007_platform_data tsc2007_info = {
83 .model = 2007, 61 .model = 2007,
84 .x_plate_ohms = 180, 62 .x_plate_ohms = 180,
85 .get_pendown_state = ts_get_pendown_state,
86 .init_platform_hw = ts_init,
87}; 63};
88 64
65#define TSC2007_IRQGPIO (2 * 32 + 2)
89static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = { 66static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
90 { 67 {
91 I2C_BOARD_INFO("pcf8563", 0x51), 68 I2C_BOARD_INFO("pcf8563", 0x51),
@@ -98,7 +75,6 @@ static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
98}; 75};
99 76
100static struct platform_device *devices[] __initdata = { 77static struct platform_device *devices[] __initdata = {
101 &mxc_fec_device,
102 &imx_wdt_device0, 78 &imx_wdt_device0,
103}; 79};
104 80
@@ -135,18 +111,18 @@ static struct pad_desc eukrea_cpuimx35_pads[] = {
135}; 111};
136 112
137static const struct mxc_nand_platform_data 113static const struct mxc_nand_platform_data
138eukrea_cpuimx35_nand_board_info __initconst = { 114 eukrea_cpuimx35_nand_board_info __initconst = {
139 .width = 1, 115 .width = 1,
140 .hw_ecc = 1, 116 .hw_ecc = 1,
141 .flash_bbt = 1, 117 .flash_bbt = 1,
142}; 118};
143 119
144static struct mxc_usbh_platform_data otg_pdata = { 120static struct mxc_usbh_platform_data __maybe_unused otg_pdata = {
145 .portsc = MXC_EHCI_MODE_UTMI, 121 .portsc = MXC_EHCI_MODE_UTMI,
146 .flags = MXC_EHCI_INTERFACE_DIFF_UNI, 122 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
147}; 123};
148 124
149static struct mxc_usbh_platform_data usbh1_pdata = { 125static struct mxc_usbh_platform_data __maybe_unused usbh1_pdata = {
150 .portsc = MXC_EHCI_MODE_SERIAL, 126 .portsc = MXC_EHCI_MODE_SERIAL,
151 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY | 127 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
152 MXC_EHCI_IPPUE_DOWN, 128 MXC_EHCI_IPPUE_DOWN,
@@ -180,6 +156,7 @@ static void __init mxc_board_init(void)
180 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads, 156 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
181 ARRAY_SIZE(eukrea_cpuimx35_pads)); 157 ARRAY_SIZE(eukrea_cpuimx35_pads));
182 158
159 imx35_add_fec(NULL);
183 platform_add_devices(devices, ARRAY_SIZE(devices)); 160 platform_add_devices(devices, ARRAY_SIZE(devices));
184 161
185 imx35_add_imx_uart0(&uart_pdata); 162 imx35_add_imx_uart0(&uart_pdata);
@@ -189,18 +166,13 @@ static void __init mxc_board_init(void)
189 ARRAY_SIZE(eukrea_cpuimx35_i2c_devices)); 166 ARRAY_SIZE(eukrea_cpuimx35_i2c_devices));
190 imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data); 167 imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
191 168
192#if defined(CONFIG_USB_ULPI) 169 if (otg_mode_host)
193 if (otg_mode_host) {
194 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
195 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
196
197 mxc_register_device(&mxc_otg_host, &otg_pdata); 170 mxc_register_device(&mxc_otg_host, &otg_pdata);
198 } 171 else
199 mxc_register_device(&mxc_usbh1, &usbh1_pdata);
200#endif
201 if (!otg_mode_host)
202 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata); 172 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
203 173
174 mxc_register_device(&mxc_usbh1, &usbh1_pdata);
175
204#ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD 176#ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD
205 eukrea_mbimxsd35_baseboard_init(); 177 eukrea_mbimxsd35_baseboard_init();
206#endif 178#endif
diff --git a/arch/arm/mach-mx3/mach-mx31ads.c b/arch/arm/mach-mx3/mach-mx31ads.c
index 94b3e7c42404..5f670ba7f0c2 100644
--- a/arch/arm/mach-mx3/mach-mx31ads.c
+++ b/arch/arm/mach-mx3/mach-mx31ads.c
@@ -22,13 +22,13 @@
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24 24
25#include <mach/hardware.h>
26#include <asm/mach-types.h> 25#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
28#include <asm/mach/time.h> 27#include <asm/mach/time.h>
29#include <asm/memory.h> 28#include <asm/memory.h>
30#include <asm/mach/map.h> 29#include <asm/mach/map.h>
31#include <mach/common.h> 30#include <mach/common.h>
31#include <mach/board-mx31ads.h>
32#include <mach/iomux-mx3.h> 32#include <mach/iomux-mx3.h>
33 33
34#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 34#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
@@ -40,10 +40,6 @@
40#include "devices-imx31.h" 40#include "devices-imx31.h"
41#include "devices.h" 41#include "devices.h"
42 42
43/* Base address of PBC controller */
44#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
45/* Offsets for the PBC Controller register */
46
47/* PBC Board interrupt status register */ 43/* PBC Board interrupt status register */
48#define PBC_INTSTATUS 0x000016 44#define PBC_INTSTATUS 0x000016
49 45
@@ -67,7 +63,6 @@
67#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) 63#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
68#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) 64#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)
69 65
70#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
71#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) 66#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
72 67
73#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) 68#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
@@ -517,7 +512,7 @@ static unsigned int ssi_pins[] = {
517 512
518static void mxc_init_audio(void) 513static void mxc_init_audio(void)
519{ 514{
520 mxc_register_device(&imx_ssi_device0, NULL); 515 imx31_add_imx_ssi(0, NULL);
521 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); 516 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi");
522} 517}
523 518
diff --git a/arch/arm/mach-mx3/mach-mx35_3ds.c b/arch/arm/mach-mx3/mach-mx35_3ds.c
index 1c30d7212f17..91bb06552af1 100644
--- a/arch/arm/mach-mx3/mach-mx35_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx35_3ds.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2009 Marc Kleine-Budde, Pengutronix
3 * 4 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com> 5 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 * 6 *
@@ -27,6 +28,8 @@
27#include <linux/gpio.h> 28#include <linux/gpio.h>
28#include <linux/fsl_devices.h> 29#include <linux/fsl_devices.h>
29 30
31#include <linux/mtd/physmap.h>
32
30#include <asm/mach-types.h> 33#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
32#include <asm/mach/time.h> 35#include <asm/mach/time.h>
@@ -35,6 +38,7 @@
35#include <mach/hardware.h> 38#include <mach/hardware.h>
36#include <mach/common.h> 39#include <mach/common.h>
37#include <mach/iomux-mx35.h> 40#include <mach/iomux-mx35.h>
41#include <mach/mxc_ehci.h>
38 42
39#include "devices-imx35.h" 43#include "devices-imx35.h"
40#include "devices.h" 44#include "devices.h"
@@ -43,8 +47,34 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
43 .flags = IMXUART_HAVE_RTSCTS, 47 .flags = IMXUART_HAVE_RTSCTS,
44}; 48};
45 49
50static struct physmap_flash_data mx35pdk_flash_data = {
51 .width = 2,
52};
53
54static struct resource mx35pdk_flash_resource = {
55 .start = MX35_CS0_BASE_ADDR,
56 .end = MX35_CS0_BASE_ADDR + SZ_64M - 1,
57 .flags = IORESOURCE_MEM,
58};
59
60static struct platform_device mx35pdk_flash = {
61 .name = "physmap-flash",
62 .id = 0,
63 .dev = {
64 .platform_data = &mx35pdk_flash_data,
65 },
66 .resource = &mx35pdk_flash_resource,
67 .num_resources = 1,
68};
69
70static const struct mxc_nand_platform_data mx35pdk_nand_board_info __initconst = {
71 .width = 1,
72 .hw_ecc = 1,
73 .flash_bbt = 1,
74};
75
46static struct platform_device *devices[] __initdata = { 76static struct platform_device *devices[] __initdata = {
47 &mxc_fec_device, 77 &mx35pdk_flash,
48}; 78};
49 79
50static struct pad_desc mx35pdk_pads[] = { 80static struct pad_desc mx35pdk_pads[] = {
@@ -75,14 +105,24 @@ static struct pad_desc mx35pdk_pads[] = {
75 /* USBOTG */ 105 /* USBOTG */
76 MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR, 106 MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR,
77 MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC, 107 MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC,
108 /* USBH1 */
109 MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR,
110 MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC,
78}; 111};
79 112
80/* OTG config */ 113/* OTG config */
81static struct fsl_usb2_platform_data usb_pdata = { 114static struct fsl_usb2_platform_data usb_otg_pdata = {
82 .operating_mode = FSL_USB2_DR_DEVICE, 115 .operating_mode = FSL_USB2_DR_DEVICE,
83 .phy_mode = FSL_USB2_PHY_UTMI_WIDE, 116 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
84}; 117};
85 118
119/* USB HOST config */
120static struct mxc_usbh_platform_data usb_host_pdata = {
121 .portsc = MXC_EHCI_MODE_SERIAL,
122 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI |
123 MXC_EHCI_INTERNAL_PHY,
124};
125
86/* 126/*
87 * Board specific initialization. 127 * Board specific initialization.
88 */ 128 */
@@ -90,11 +130,16 @@ static void __init mxc_board_init(void)
90{ 130{
91 mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads)); 131 mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
92 132
133 imx35_add_fec(NULL);
93 platform_add_devices(devices, ARRAY_SIZE(devices)); 134 platform_add_devices(devices, ARRAY_SIZE(devices));
94 135
95 imx35_add_imx_uart0(&uart_pdata); 136 imx35_add_imx_uart0(&uart_pdata);
96 137
97 mxc_register_device(&mxc_otg_udc_device, &usb_pdata); 138 mxc_register_device(&mxc_otg_udc_device, &usb_otg_pdata);
139
140 mxc_register_device(&mxc_usbh1, &usb_host_pdata);
141
142 imx35_add_mxc_nand(&mx35pdk_nand_board_info);
98} 143}
99 144
100static void __init mx35pdk_timer_init(void) 145static void __init mx35pdk_timer_init(void)
diff --git a/arch/arm/mach-mx3/mach-pcm037_eet.c b/arch/arm/mach-mx3/mach-pcm037_eet.c
index c8b98218efee..99e0894e07db 100644
--- a/arch/arm/mach-mx3/mach-pcm037_eet.c
+++ b/arch/arm/mach-mx3/mach-pcm037_eet.c
@@ -19,6 +19,7 @@
19 19
20#include "pcm037.h" 20#include "pcm037.h"
21#include "devices.h" 21#include "devices.h"
22#include "devices-imx31.h"
22 23
23static unsigned int pcm037_eet_pins[] = { 24static unsigned int pcm037_eet_pins[] = {
24 /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */ 25 /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
@@ -181,7 +182,7 @@ static int eet_init_devices(void)
181 /* SPI */ 182 /* SPI */
182 spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev)); 183 spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev));
183#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) 184#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
184 imx35_add_spi_imx0(&pcm037_spi1_pdata); 185 imx31_add_spi_imx0(&pcm037_spi1_pdata);
185#endif 186#endif
186 187
187 platform_device_register(&pcm037_gpio_keys_device); 188 platform_device_register(&pcm037_gpio_keys_device);
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index 28886f0e62f9..a9397a4151e3 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -42,7 +42,6 @@
42#include <mach/mxc_ehci.h> 42#include <mach/mxc_ehci.h>
43#include <mach/ulpi.h> 43#include <mach/ulpi.h>
44#include <mach/audmux.h> 44#include <mach/audmux.h>
45#include <mach/ssi.h>
46 45
47#include "devices-imx35.h" 46#include "devices-imx35.h"
48#include "devices.h" 47#include "devices.h"
@@ -141,7 +140,6 @@ static struct i2c_board_info pcm043_i2c_devices[] = {
141 140
142static struct platform_device *devices[] __initdata = { 141static struct platform_device *devices[] __initdata = {
143 &pcm043_flash, 142 &pcm043_flash,
144 &mxc_fec_device,
145 &imx_wdt_device0, 143 &imx_wdt_device0,
146}; 144};
147 145
@@ -217,6 +215,13 @@ static struct pad_desc pcm043_pads[] = {
217 /* CAN2 */ 215 /* CAN2 */
218 MX35_PAD_TX5_RX0__CAN2_TXCAN, 216 MX35_PAD_TX5_RX0__CAN2_TXCAN,
219 MX35_PAD_TX4_RX1__CAN2_RXCAN, 217 MX35_PAD_TX4_RX1__CAN2_RXCAN,
218 /* esdhc */
219 MX35_PAD_SD1_CMD__ESDHC1_CMD,
220 MX35_PAD_SD1_CLK__ESDHC1_CLK,
221 MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
222 MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
223 MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
224 MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
220}; 225};
221 226
222#define AC97_GPIO_TXFS (1 * 32 + 31) 227#define AC97_GPIO_TXFS (1 * 32 + 31)
@@ -293,7 +298,7 @@ err1:
293 mdelay(1); 298 mdelay(1);
294} 299}
295 300
296static struct imx_ssi_platform_data pcm043_ssi_pdata = { 301static const struct imx_ssi_platform_data pcm043_ssi_pdata __initconst = {
297 .ac97_reset = pcm043_ac97_cold_reset, 302 .ac97_reset = pcm043_ac97_cold_reset,
298 .ac97_warm_reset = pcm043_ac97_warm_reset, 303 .ac97_warm_reset = pcm043_ac97_warm_reset,
299 .flags = IMX_SSI_USE_AC97, 304 .flags = IMX_SSI_USE_AC97,
@@ -357,11 +362,12 @@ static void __init mxc_board_init(void)
357 MXC_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */ 362 MXC_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */
358 MXC_AUDMUX_V2_PDCR_RXDSEL(3)); 363 MXC_AUDMUX_V2_PDCR_RXDSEL(3));
359 364
365 imx35_add_fec(NULL);
360 platform_add_devices(devices, ARRAY_SIZE(devices)); 366 platform_add_devices(devices, ARRAY_SIZE(devices));
361 367
362 imx35_add_imx_uart0(&uart_pdata); 368 imx35_add_imx_uart0(&uart_pdata);
363 imx35_add_mxc_nand(&pcm037_nand_board_info); 369 imx35_add_mxc_nand(&pcm037_nand_board_info);
364 mxc_register_device(&imx_ssi_device0, &pcm043_ssi_pdata); 370 imx35_add_imx_ssi(0, &pcm043_ssi_pdata);
365 371
366 imx35_add_imx_uart1(&uart_pdata); 372 imx35_add_imx_uart1(&uart_pdata);
367 373
@@ -389,6 +395,7 @@ static void __init mxc_board_init(void)
389 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata); 395 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
390 396
391 imx35_add_flexcan1(NULL); 397 imx35_add_flexcan1(NULL);
398 imx35_add_esdhc(0, NULL);
392} 399}
393 400
394static void __init pcm043_timer_init(void) 401static void __init pcm043_timer_init(void)
diff --git a/arch/arm/mach-mx3/mm.c b/arch/arm/mach-mx3/mm.c
index 20e48c0195c4..b4ffc531a82c 100644
--- a/arch/arm/mach-mx3/mm.c
+++ b/arch/arm/mach-mx3/mm.c
@@ -110,6 +110,24 @@ void __init mx35_init_irq(void)
110static int mxc_init_l2x0(void) 110static int mxc_init_l2x0(void)
111{ 111{
112 void __iomem *l2x0_base; 112 void __iomem *l2x0_base;
113 void __iomem *clkctl_base;
114/*
115 * First of all, we must repair broken chip settings. There are some
116 * i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These
117 * misconfigured CPUs will run amok immediately when the L2 cache gets enabled.
118 * Workaraound is to setup the correct register setting prior enabling the
119 * L2 cache. This should not hurt already working CPUs, as they are using the
120 * same value
121 */
122#define L2_MEM_VAL 0x10
123
124 clkctl_base = ioremap(MX35_CLKCTL_BASE_ADDR, 4096);
125 if (clkctl_base != NULL) {
126 writel(0x00000515, clkctl_base + L2_MEM_VAL);
127 iounmap(clkctl_base);
128 } else {
129 pr_err("L2 cache: Cannot fix timing. Trying to continue without\n");
130 }
113 131
114 l2x0_base = ioremap(L2CC_BASE_ADDR, 4096); 132 l2x0_base = ioremap(L2CC_BASE_ADDR, 4096);
115 if (IS_ERR(l2x0_base)) { 133 if (IS_ERR(l2x0_base)) {
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index 0848db5dd364..a2df9ac37996 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -5,11 +5,14 @@ config ARCH_MX51
5 default y 5 default y
6 select MXC_TZIC 6 select MXC_TZIC
7 select ARCH_MXC_IOMUX_V3 7 select ARCH_MXC_IOMUX_V3
8 select ARCH_MXC_AUDMUX_V2
8 9
9comment "MX5 platforms:" 10comment "MX5 platforms:"
10 11
11config MACH_MX51_BABBAGE 12config MACH_MX51_BABBAGE
12 bool "Support MX51 BABBAGE platforms" 13 bool "Support MX51 BABBAGE platforms"
14 select IMX_HAVE_PLATFORM_IMX_I2C
15 select IMX_HAVE_PLATFORM_IMX_UART
13 help 16 help
14 Include support for MX51 Babbage platform, also known as MX51EVK in 17 Include support for MX51 Babbage platform, also known as MX51EVK in
15 u-boot. This includes specific configurations for the board and its 18 u-boot. This includes specific configurations for the board and its
@@ -17,6 +20,8 @@ config MACH_MX51_BABBAGE
17 20
18config MACH_MX51_3DS 21config MACH_MX51_3DS
19 bool "Support MX51PDK (3DS)" 22 bool "Support MX51PDK (3DS)"
23 select IMX_HAVE_PLATFORM_IMX_UART
24 select IMX_HAVE_PLATFORM_SPI_IMX
20 select MXC_DEBUG_BOARD 25 select MXC_DEBUG_BOARD
21 help 26 help
22 Include support for MX51PDK (3DS) platform. This includes specific 27 Include support for MX51PDK (3DS) platform. This includes specific
@@ -24,6 +29,10 @@ config MACH_MX51_3DS
24 29
25config MACH_EUKREA_CPUIMX51 30config MACH_EUKREA_CPUIMX51
26 bool "Support Eukrea CPUIMX51 module" 31 bool "Support Eukrea CPUIMX51 module"
32 select IMX_HAVE_PLATFORM_IMX_I2C
33 select IMX_HAVE_PLATFORM_IMX_UART
34 select IMX_HAVE_PLATFORM_MXC_NAND
35 select IMX_HAVE_PLATFORM_SPI_IMX
27 help 36 help
28 Include support for Eukrea CPUIMX51 platform. This includes 37 Include support for Eukrea CPUIMX51 platform. This includes
29 specific configurations for the module and its peripherals. 38 specific configurations for the module and its peripherals.
@@ -36,10 +45,43 @@ choice
36config MACH_EUKREA_MBIMX51_BASEBOARD 45config MACH_EUKREA_MBIMX51_BASEBOARD
37 prompt "Eukrea MBIMX51 development board" 46 prompt "Eukrea MBIMX51 development board"
38 bool 47 bool
48 select IMX_HAVE_PLATFORM_ESDHC
39 help 49 help
40 This adds board specific devices that can be found on Eukrea's 50 This adds board specific devices that can be found on Eukrea's
41 MBIMX51 evaluation board. 51 MBIMX51 evaluation board.
42 52
43endchoice 53endchoice
44 54
55config MACH_EUKREA_CPUIMX51SD
56 bool "Support Eukrea CPUIMX51SD module"
57 select IMX_HAVE_PLATFORM_IMX_I2C
58 select IMX_HAVE_PLATFORM_SPI_IMX
59 select IMX_HAVE_PLATFORM_IMX_UART
60 select IMX_HAVE_PLATFORM_MXC_NAND
61 help
62 Include support for Eukrea CPUIMX51SD platform. This includes
63 specific configurations for the module and its peripherals.
64
65choice
66 prompt "Baseboard"
67 depends on MACH_EUKREA_CPUIMX51SD
68 default MACH_EUKREA_MBIMXSD51_BASEBOARD
69
70config MACH_EUKREA_MBIMXSD51_BASEBOARD
71 prompt "Eukrea MBIMXSD development board"
72 bool
73 select IMX_HAVE_PLATFORM_ESDHC
74 help
75 This adds board specific devices that can be found on Eukrea's
76 MBIMXSD evaluation board.
77
78endchoice
79
80config MACH_MX51_EFIKAMX
81 bool "Support MX51 Genesi Efika MX nettop"
82 select IMX_HAVE_PLATFORM_IMX_UART
83 help
84 Include support for Genesi Efika MX nettop. This includes specific
85 configurations for the board and its peripherals.
86
45endif 87endif
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index 86c66e7f52f3..1769c161a60d 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
9obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o 9obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o
10obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o 10obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o
11obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o 11obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o
12obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o
13obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd-baseboard.o
14obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index 623607a20f57..378f5327ae77 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -28,9 +28,7 @@
28#include <mach/eukrea-baseboards.h> 28#include <mach/eukrea-baseboards.h>
29#include <mach/common.h> 29#include <mach/common.h>
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/imx-uart.h>
32#include <mach/iomux-mx51.h> 31#include <mach/iomux-mx51.h>
33#include <mach/i2c.h>
34#include <mach/mxc_ehci.h> 32#include <mach/mxc_ehci.h>
35 33
36#include <asm/irq.h> 34#include <asm/irq.h>
@@ -39,6 +37,7 @@
39#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
40#include <asm/mach/time.h> 38#include <asm/mach/time.h>
41 39
40#include "devices-imx51.h"
42#include "devices.h" 41#include "devices.h"
43 42
44#define CPUIMX51_USBH1_STP (0*32 + 27) 43#define CPUIMX51_USBH1_STP (0*32 + 27)
@@ -109,7 +108,6 @@ static struct platform_device serial_device = {
109#endif 108#endif
110 109
111static struct platform_device *devices[] __initdata = { 110static struct platform_device *devices[] __initdata = {
112 &mxc_fec_device,
113#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 111#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
114 &serial_device, 112 &serial_device,
115#endif 113#endif
@@ -148,11 +146,19 @@ static struct pad_desc eukrea_cpuimx51_pads[] = {
148 MX51_PAD_USBH1_STP__USBH1_STP, 146 MX51_PAD_USBH1_STP__USBH1_STP,
149}; 147};
150 148
151static struct imxuart_platform_data uart_pdata = { 149static const struct mxc_nand_platform_data
150 eukrea_cpuimx51_nand_board_info __initconst = {
151 .width = 1,
152 .hw_ecc = 1,
153 .flash_bbt = 1,
154};
155
156static const struct imxuart_platform_data uart_pdata __initconst = {
152 .flags = IMXUART_HAVE_RTSCTS, 157 .flags = IMXUART_HAVE_RTSCTS,
153}; 158};
154 159
155static struct imxi2c_platform_data eukrea_cpuimx51_i2c_data = { 160static const
161struct imxi2c_platform_data eukrea_cpuimx51_i2c_data __initconst = {
156 .bitrate = 100000, 162 .bitrate = 100000,
157}; 163};
158 164
@@ -239,7 +245,9 @@ static void __init eukrea_cpuimx51_init(void)
239 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads, 245 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
240 ARRAY_SIZE(eukrea_cpuimx51_pads)); 246 ARRAY_SIZE(eukrea_cpuimx51_pads));
241 247
242 mxc_register_device(&mxc_uart_device0, &uart_pdata); 248 imx51_add_imx_uart(0, &uart_pdata);
249 imx51_add_mxc_nand(&eukrea_cpuimx51_nand_board_info);
250
243 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq"); 251 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
244 gpio_direction_input(CPUIMX51_QUARTA_GPIO); 252 gpio_direction_input(CPUIMX51_QUARTA_GPIO);
245 gpio_free(CPUIMX51_QUARTA_GPIO); 253 gpio_free(CPUIMX51_QUARTA_GPIO);
@@ -253,9 +261,10 @@ static void __init eukrea_cpuimx51_init(void)
253 gpio_direction_input(CPUIMX51_QUARTD_GPIO); 261 gpio_direction_input(CPUIMX51_QUARTD_GPIO);
254 gpio_free(CPUIMX51_QUARTD_GPIO); 262 gpio_free(CPUIMX51_QUARTD_GPIO);
255 263
264 imx51_add_fec(NULL);
256 platform_add_devices(devices, ARRAY_SIZE(devices)); 265 platform_add_devices(devices, ARRAY_SIZE(devices));
257 266
258 mxc_register_device(&mxc_i2c_device1, &eukrea_cpuimx51_i2c_data); 267 imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data);
259 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices, 268 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices,
260 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices)); 269 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
261 270
diff --git a/arch/arm/mach-mx5/board-cpuimx51sd.c b/arch/arm/mach-mx5/board-cpuimx51sd.c
new file mode 100644
index 000000000000..bd5eb61a7eba
--- /dev/null
+++ b/arch/arm/mach-mx5/board-cpuimx51sd.c
@@ -0,0 +1,333 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * based on board-mx51_babbage.c which is
6 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
7 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
8 *
9 * The code contained herein is licensed under the GNU General Public
10 * License. You may obtain a copy of the GNU General Public License
11 * Version 2 or later at the following locations:
12 *
13 * http://www.opensource.org/licenses/gpl-license.html
14 * http://www.gnu.org/copyleft/gpl.html
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/i2c.h>
20#include <linux/i2c/tsc2007.h>
21#include <linux/gpio.h>
22#include <linux/delay.h>
23#include <linux/io.h>
24#include <linux/interrupt.h>
25#include <linux/irq.h>
26#include <linux/fsl_devices.h>
27#include <linux/i2c-gpio.h>
28#include <linux/spi/spi.h>
29#include <linux/can/platform/mcp251x.h>
30
31#include <mach/eukrea-baseboards.h>
32#include <mach/common.h>
33#include <mach/hardware.h>
34#include <mach/iomux-mx51.h>
35#include <mach/mxc_ehci.h>
36
37#include <asm/irq.h>
38#include <asm/setup.h>
39#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
41#include <asm/mach/time.h>
42
43#include "devices-imx51.h"
44#include "devices.h"
45
46#define USBH1_RST (1*32 + 28)
47#define ETH_RST (1*32 + 31)
48#define TSC2007_IRQGPIO (2*32 + 12)
49#define CAN_IRQGPIO (0*32 + 1)
50#define CAN_RST (3*32 + 15)
51#define CAN_NCS (3*32 + 24)
52#define CAN_RXOBF (0*32 + 4)
53#define CAN_RX1BF (0*32 + 6)
54#define CAN_TXORTS (0*32 + 7)
55#define CAN_TX1RTS (0*32 + 8)
56#define CAN_TX2RTS (0*32 + 9)
57#define I2C_SCL (3*32 + 16)
58#define I2C_SDA (3*32 + 17)
59
60/* USB_CTRL_1 */
61#define MX51_USB_CTRL_1_OFFSET 0x10
62#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
63
64#define MX51_USB_PLLDIV_12_MHZ 0x00
65#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
66#define MX51_USB_PLL_DIV_24_MHZ 0x02
67
68#define CPUIMX51SD_GPIO_3_12 IOMUX_PAD(0x57C, 0x194, 3, 0x0, 0, \
69 MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP)
70
71static struct pad_desc eukrea_cpuimx51sd_pads[] = {
72 /* UART1 */
73 MX51_PAD_UART1_RXD__UART1_RXD,
74 MX51_PAD_UART1_TXD__UART1_TXD,
75 MX51_PAD_UART1_RTS__UART1_RTS,
76 MX51_PAD_UART1_CTS__UART1_CTS,
77
78 /* USB HOST1 */
79 MX51_PAD_USBH1_CLK__USBH1_CLK,
80 MX51_PAD_USBH1_DIR__USBH1_DIR,
81 MX51_PAD_USBH1_NXT__USBH1_NXT,
82 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
83 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
84 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
85 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
86 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
87 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
88 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
89 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
90 MX51_PAD_USBH1_STP__USBH1_STP,
91 MX51_PAD_EIM_CS3__GPIO_2_28, /* PHY nRESET */
92
93 /* FEC */
94 MX51_PAD_EIM_DTACK__GPIO_2_31, /* PHY nRESET */
95
96 /* HSI2C */
97 MX51_PAD_I2C1_CLK__GPIO_4_16,
98 MX51_PAD_I2C1_DAT__GPIO_4_17,
99
100 /* CAN */
101 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
102 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
103 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
104 MX51_PAD_CSPI1_SS0__GPIO_4_24, /* nCS */
105 MX51_PAD_CSI2_PIXCLK__GPIO_4_15, /* nReset */
106 MX51_PAD_GPIO_1_1__GPIO_1_1, /* IRQ */
107 MX51_PAD_GPIO_1_4__GPIO_1_4, /* Control signals */
108 MX51_PAD_GPIO_1_6__GPIO_1_6,
109 MX51_PAD_GPIO_1_7__GPIO_1_7,
110 MX51_PAD_GPIO_1_8__GPIO_1_8,
111 MX51_PAD_GPIO_1_9__GPIO_1_9,
112
113 /* Touchscreen */
114 CPUIMX51SD_GPIO_3_12, /* IRQ */
115};
116
117static const struct imxuart_platform_data uart_pdata __initconst = {
118 .flags = IMXUART_HAVE_RTSCTS,
119};
120
121static int ts_get_pendown_state(void)
122{
123 return gpio_get_value(TSC2007_IRQGPIO) ? 0 : 1;
124}
125
126static struct tsc2007_platform_data tsc2007_info = {
127 .model = 2007,
128 .x_plate_ohms = 180,
129 .get_pendown_state = ts_get_pendown_state,
130};
131
132static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
133 {
134 I2C_BOARD_INFO("pcf8563", 0x51),
135 }, {
136 I2C_BOARD_INFO("tsc2007", 0x49),
137 .type = "tsc2007",
138 .platform_data = &tsc2007_info,
139 .irq = gpio_to_irq(TSC2007_IRQGPIO),
140 },
141};
142
143static const struct mxc_nand_platform_data
144 eukrea_cpuimx51sd_nand_board_info __initconst = {
145 .width = 1,
146 .hw_ecc = 1,
147 .flash_bbt = 1,
148};
149
150/* This function is board specific as the bit mask for the plldiv will also
151be different for other Freescale SoCs, thus a common bitmask is not
152possible and cannot get place in /plat-mxc/ehci.c.*/
153static int initialize_otg_port(struct platform_device *pdev)
154{
155 u32 v;
156 void __iomem *usb_base;
157 void __iomem *usbother_base;
158
159 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
160 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
161
162 /* Set the PHY clock to 19.2MHz */
163 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
164 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
165 v |= MX51_USB_PLL_DIV_19_2_MHZ;
166 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
167 iounmap(usb_base);
168 return 0;
169}
170
171static int initialize_usbh1_port(struct platform_device *pdev)
172{
173 u32 v;
174 void __iomem *usb_base;
175 void __iomem *usbother_base;
176
177 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
178 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
179
180 /* The clock for the USBH1 ULPI port will come from the PHY. */
181 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
182 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN,
183 usbother_base + MX51_USB_CTRL_1_OFFSET);
184 iounmap(usb_base);
185 return 0;
186}
187
188static struct mxc_usbh_platform_data dr_utmi_config = {
189 .init = initialize_otg_port,
190 .portsc = MXC_EHCI_UTMI_16BIT,
191 .flags = MXC_EHCI_INTERNAL_PHY,
192};
193
194static struct fsl_usb2_platform_data usb_pdata = {
195 .operating_mode = FSL_USB2_DR_DEVICE,
196 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
197};
198
199static struct mxc_usbh_platform_data usbh1_config = {
200 .init = initialize_usbh1_port,
201 .portsc = MXC_EHCI_MODE_ULPI,
202 .flags = (MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_ITC_NO_THRESHOLD),
203};
204
205static int otg_mode_host;
206
207static int __init eukrea_cpuimx51sd_otg_mode(char *options)
208{
209 if (!strcmp(options, "host"))
210 otg_mode_host = 1;
211 else if (!strcmp(options, "device"))
212 otg_mode_host = 0;
213 else
214 pr_info("otg_mode neither \"host\" nor \"device\". "
215 "Defaulting to device\n");
216 return 0;
217}
218__setup("otg_mode=", eukrea_cpuimx51sd_otg_mode);
219
220static struct i2c_gpio_platform_data pdata = {
221 .sda_pin = I2C_SDA,
222 .sda_is_open_drain = 0,
223 .scl_pin = I2C_SCL,
224 .scl_is_open_drain = 0,
225 .udelay = 2,
226};
227
228static struct platform_device hsi2c_gpio_device = {
229 .name = "i2c-gpio",
230 .id = 0,
231 .dev.platform_data = &pdata,
232};
233
234static struct mcp251x_platform_data mcp251x_info = {
235 .oscillator_frequency = 24E6,
236};
237
238static struct spi_board_info cpuimx51sd_spi_device[] = {
239 {
240 .modalias = "mcp2515",
241 .max_speed_hz = 6500000,
242 .bus_num = 0,
243 .mode = SPI_MODE_0,
244 .chip_select = 0,
245 .platform_data = &mcp251x_info,
246 .irq = gpio_to_irq(0 * 32 + 1)
247 },
248};
249
250static int cpuimx51sd_spi1_cs[] = {
251 CAN_NCS,
252};
253
254static const struct spi_imx_master cpuimx51sd_ecspi1_pdata __initconst = {
255 .chipselect = cpuimx51sd_spi1_cs,
256 .num_chipselect = ARRAY_SIZE(cpuimx51sd_spi1_cs),
257};
258
259static struct platform_device *platform_devices[] __initdata = {
260 &hsi2c_gpio_device,
261};
262
263static void __init eukrea_cpuimx51sd_init(void)
264{
265 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads,
266 ARRAY_SIZE(eukrea_cpuimx51sd_pads));
267
268 imx51_add_imx_uart(0, &uart_pdata);
269 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info);
270
271 gpio_request(ETH_RST, "eth_rst");
272 gpio_set_value(ETH_RST, 1);
273 imx51_add_fec(NULL);
274
275 gpio_request(CAN_IRQGPIO, "can_irq");
276 gpio_direction_input(CAN_IRQGPIO);
277 gpio_free(CAN_IRQGPIO);
278 gpio_request(CAN_NCS, "can_ncs");
279 gpio_direction_output(CAN_NCS, 1);
280 gpio_free(CAN_NCS);
281 gpio_request(CAN_RST, "can_rst");
282 gpio_direction_output(CAN_RST, 0);
283 msleep(20);
284 gpio_set_value(CAN_RST, 1);
285 imx51_add_ecspi(0, &cpuimx51sd_ecspi1_pdata);
286 spi_register_board_info(cpuimx51sd_spi_device,
287 ARRAY_SIZE(cpuimx51sd_spi_device));
288
289 gpio_request(TSC2007_IRQGPIO, "tsc2007_irq");
290 gpio_direction_input(TSC2007_IRQGPIO);
291 gpio_free(TSC2007_IRQGPIO);
292
293 i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices,
294 ARRAY_SIZE(eukrea_cpuimx51sd_i2c_devices));
295 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
296
297 if (otg_mode_host)
298 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
299 else {
300 initialize_otg_port(NULL);
301 mxc_register_device(&mxc_usbdr_udc_device, &usb_pdata);
302 }
303
304 gpio_request(USBH1_RST, "usb_rst");
305 gpio_direction_output(USBH1_RST, 0);
306 msleep(20);
307 gpio_set_value(USBH1_RST, 1);
308 mxc_register_device(&mxc_usbh1_device, &usbh1_config);
309
310#ifdef CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD
311 eukrea_mbimxsd51_baseboard_init();
312#endif
313}
314
315static void __init eukrea_cpuimx51sd_timer_init(void)
316{
317 mx51_clocks_init(32768, 24000000, 22579200, 0);
318}
319
320static struct sys_timer mxc_timer = {
321 .init = eukrea_cpuimx51sd_timer_init,
322};
323
324MACHINE_START(EUKREA_CPUIMX51SD, "Eukrea CPUIMX51SD")
325 /* Maintainer: Eric Bénard <eric@eukrea.com> */
326 .phys_io = MX51_AIPS1_BASE_ADDR,
327 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
328 .boot_params = PHYS_OFFSET + 0x100,
329 .map_io = mx51_map_io,
330 .init_irq = mx51_init_irq,
331 .init_machine = eukrea_cpuimx51sd_init,
332 .timer = &mxc_timer,
333MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c
index f95c2fd94667..ed08a2352a1a 100644
--- a/arch/arm/mach-mx5/board-mx51_3ds.c
+++ b/arch/arm/mach-mx5/board-mx51_3ds.c
@@ -13,6 +13,7 @@
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/input/matrix_keypad.h> 15#include <linux/input/matrix_keypad.h>
16#include <linux/spi/spi.h>
16 17
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
@@ -21,12 +22,13 @@
21#include <mach/hardware.h> 22#include <mach/hardware.h>
22#include <mach/common.h> 23#include <mach/common.h>
23#include <mach/iomux-mx51.h> 24#include <mach/iomux-mx51.h>
24#include <mach/imx-uart.h>
25#include <mach/3ds_debugboard.h> 25#include <mach/3ds_debugboard.h>
26 26
27#include "devices-imx51.h"
27#include "devices.h" 28#include "devices.h"
28 29
29#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 6) 30#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 6)
31#define MX51_3DS_ECSPI2_CS (GPIO_PORTC + 28)
30 32
31static struct pad_desc mx51_3ds_pads[] = { 33static struct pad_desc mx51_3ds_pads[] = {
32 /* UART1 */ 34 /* UART1 */
@@ -61,19 +63,25 @@ static struct pad_desc mx51_3ds_pads[] = {
61 MX51_PAD_KEY_COL3__KEY_COL3, 63 MX51_PAD_KEY_COL3__KEY_COL3,
62 MX51_PAD_KEY_COL4__KEY_COL4, 64 MX51_PAD_KEY_COL4__KEY_COL4,
63 MX51_PAD_KEY_COL5__KEY_COL5, 65 MX51_PAD_KEY_COL5__KEY_COL5,
66
67 /* eCSPI2 */
68 MX51_PAD_NANDF_RB2__ECSPI2_SCLK,
69 MX51_PAD_NANDF_RB3__ECSPI2_MISO,
70 MX51_PAD_NANDF_D15__ECSPI2_MOSI,
71 MX51_PAD_NANDF_D12__GPIO_3_28,
64}; 72};
65 73
66/* Serial ports */ 74/* Serial ports */
67#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 75#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
68static struct imxuart_platform_data uart_pdata = { 76static const struct imxuart_platform_data uart_pdata __initconst = {
69 .flags = IMXUART_HAVE_RTSCTS, 77 .flags = IMXUART_HAVE_RTSCTS,
70}; 78};
71 79
72static inline void mxc_init_imx_uart(void) 80static inline void mxc_init_imx_uart(void)
73{ 81{
74 mxc_register_device(&mxc_uart_device0, &uart_pdata); 82 imx51_add_imx_uart(0, &uart_pdata);
75 mxc_register_device(&mxc_uart_device1, &uart_pdata); 83 imx51_add_imx_uart(1, &uart_pdata);
76 mxc_register_device(&mxc_uart_device2, &uart_pdata); 84 imx51_add_imx_uart(2, &uart_pdata);
77} 85}
78#else /* !SERIAL_IMX */ 86#else /* !SERIAL_IMX */
79static inline void mxc_init_imx_uart(void) 87static inline void mxc_init_imx_uart(void)
@@ -127,6 +135,26 @@ static inline void mxc_init_keypad(void)
127} 135}
128#endif 136#endif
129 137
138static int mx51_3ds_spi2_cs[] = {
139 MXC_SPI_CS(0),
140 MX51_3DS_ECSPI2_CS,
141};
142
143static const struct spi_imx_master mx51_3ds_ecspi2_pdata __initconst = {
144 .chipselect = mx51_3ds_spi2_cs,
145 .num_chipselect = ARRAY_SIZE(mx51_3ds_spi2_cs),
146};
147
148static struct spi_board_info mx51_3ds_spi_nor_device[] = {
149 {
150 .modalias = "m25p80",
151 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
152 .bus_num = 1,
153 .chip_select = 1,
154 .mode = SPI_MODE_0,
155 .platform_data = NULL,},
156};
157
130/* 158/*
131 * Board specific initialization. 159 * Board specific initialization.
132 */ 160 */
@@ -136,6 +164,10 @@ static void __init mxc_board_init(void)
136 ARRAY_SIZE(mx51_3ds_pads)); 164 ARRAY_SIZE(mx51_3ds_pads));
137 mxc_init_imx_uart(); 165 mxc_init_imx_uart();
138 166
167 imx51_add_ecspi(1, &mx51_3ds_ecspi2_pdata);
168 spi_register_board_info(mx51_3ds_spi_nor_device,
169 ARRAY_SIZE(mx51_3ds_spi_nor_device));
170
139 if (mxc_expio_init(MX51_CS5_BASE_ADDR, EXPIO_PARENT_INT)) 171 if (mxc_expio_init(MX51_CS5_BASE_ADDR, EXPIO_PARENT_INT))
140 printk(KERN_WARNING "Init of the debugboard failed, all " 172 printk(KERN_WARNING "Init of the debugboard failed, all "
141 "devices on the board are unusable.\n"); 173 "devices on the board are unusable.\n");
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 6e384d92e625..23ee4a447406 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -17,12 +17,11 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/fsl_devices.h> 19#include <linux/fsl_devices.h>
20#include <linux/fec.h>
20 21
21#include <mach/common.h> 22#include <mach/common.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <mach/imx-uart.h>
24#include <mach/iomux-mx51.h> 24#include <mach/iomux-mx51.h>
25#include <mach/i2c.h>
26#include <mach/mxc_ehci.h> 25#include <mach/mxc_ehci.h>
27 26
28#include <asm/irq.h> 27#include <asm/irq.h>
@@ -31,11 +30,13 @@
31#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
32#include <asm/mach/time.h> 31#include <asm/mach/time.h>
33 32
33#include "devices-imx51.h"
34#include "devices.h" 34#include "devices.h"
35 35
36#define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */ 36#define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */
37#define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */ 37#define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */
38#define BABBAGE_PHY_RESET (1*32 +5) /* GPIO_2_5 */ 38#define BABBAGE_PHY_RESET (1*32 + 5) /* GPIO_2_5 */
39#define BABBAGE_FEC_PHY_RESET (1*32 + 14) /* GPIO_2_14 */
39 40
40/* USB_CTRL_1 */ 41/* USB_CTRL_1 */
41#define MX51_USB_CTRL_1_OFFSET 0x10 42#define MX51_USB_CTRL_1_OFFSET 0x10
@@ -45,10 +46,6 @@
45#define MX51_USB_PLL_DIV_19_2_MHZ 0x01 46#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
46#define MX51_USB_PLL_DIV_24_MHZ 0x02 47#define MX51_USB_PLL_DIV_24_MHZ 0x02
47 48
48static struct platform_device *devices[] __initdata = {
49 &mxc_fec_device,
50};
51
52static struct pad_desc mx51babbage_pads[] = { 49static struct pad_desc mx51babbage_pads[] = {
53 /* UART1 */ 50 /* UART1 */
54 MX51_PAD_UART1_RXD__UART1_RXD, 51 MX51_PAD_UART1_RXD__UART1_RXD,
@@ -93,19 +90,41 @@ static struct pad_desc mx51babbage_pads[] = {
93 90
94 /* USB HUB reset line*/ 91 /* USB HUB reset line*/
95 MX51_PAD_GPIO_1_7__GPIO_1_7, 92 MX51_PAD_GPIO_1_7__GPIO_1_7,
93
94 /* FEC */
95 MX51_PAD_EIM_EB2__FEC_MDIO,
96 MX51_PAD_EIM_EB3__FEC_RDAT1,
97 MX51_PAD_EIM_CS2__FEC_RDAT2,
98 MX51_PAD_EIM_CS3__FEC_RDAT3,
99 MX51_PAD_EIM_CS4__FEC_RX_ER,
100 MX51_PAD_EIM_CS5__FEC_CRS,
101 MX51_PAD_NANDF_RB2__FEC_COL,
102 MX51_PAD_NANDF_RB3__FEC_RXCLK,
103 MX51_PAD_NANDF_RB6__FEC_RDAT0,
104 MX51_PAD_NANDF_RB7__FEC_TDAT0,
105 MX51_PAD_NANDF_CS2__FEC_TX_ER,
106 MX51_PAD_NANDF_CS3__FEC_MDC,
107 MX51_PAD_NANDF_CS4__FEC_TDAT1,
108 MX51_PAD_NANDF_CS5__FEC_TDAT2,
109 MX51_PAD_NANDF_CS6__FEC_TDAT3,
110 MX51_PAD_NANDF_CS7__FEC_TX_EN,
111 MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK,
112
113 /* FEC PHY reset line */
114 MX51_PAD_EIM_A20__GPIO_2_14,
96}; 115};
97 116
98/* Serial ports */ 117/* Serial ports */
99#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 118#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
100static struct imxuart_platform_data uart_pdata = { 119static const struct imxuart_platform_data uart_pdata __initconst = {
101 .flags = IMXUART_HAVE_RTSCTS, 120 .flags = IMXUART_HAVE_RTSCTS,
102}; 121};
103 122
104static inline void mxc_init_imx_uart(void) 123static inline void mxc_init_imx_uart(void)
105{ 124{
106 mxc_register_device(&mxc_uart_device0, &uart_pdata); 125 imx51_add_imx_uart(0, &uart_pdata);
107 mxc_register_device(&mxc_uart_device1, &uart_pdata); 126 imx51_add_imx_uart(1, &uart_pdata);
108 mxc_register_device(&mxc_uart_device2, &uart_pdata); 127 imx51_add_imx_uart(2, &uart_pdata);
109} 128}
110#else /* !SERIAL_IMX */ 129#else /* !SERIAL_IMX */
111static inline void mxc_init_imx_uart(void) 130static inline void mxc_init_imx_uart(void)
@@ -113,7 +132,7 @@ static inline void mxc_init_imx_uart(void)
113} 132}
114#endif /* SERIAL_IMX */ 133#endif /* SERIAL_IMX */
115 134
116static struct imxi2c_platform_data babbage_i2c_data = { 135static const struct imxi2c_platform_data babbage_i2c_data __initconst = {
117 .bitrate = 100000, 136 .bitrate = 100000,
118}; 137};
119 138
@@ -171,6 +190,22 @@ static inline void babbage_usbhub_reset(void)
171 gpio_set_value(BABBAGE_USB_HUB_RESET, 1); 190 gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
172} 191}
173 192
193static inline void babbage_fec_reset(void)
194{
195 int ret;
196
197 /* reset FEC PHY */
198 ret = gpio_request(BABBAGE_FEC_PHY_RESET, "fec-phy-reset");
199 if (ret) {
200 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
201 return;
202 }
203 gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0);
204 gpio_set_value(BABBAGE_FEC_PHY_RESET, 0);
205 msleep(1);
206 gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
207}
208
174/* This function is board specific as the bit mask for the plldiv will also 209/* This function is board specific as the bit mask for the plldiv will also
175be different for other Freescale SoCs, thus a common bitmask is not 210be different for other Freescale SoCs, thus a common bitmask is not
176possible and cannot get place in /plat-mxc/ehci.c.*/ 211possible and cannot get place in /plat-mxc/ehci.c.*/
@@ -178,7 +213,7 @@ static int initialize_otg_port(struct platform_device *pdev)
178{ 213{
179 u32 v; 214 u32 v;
180 void __iomem *usb_base; 215 void __iomem *usb_base;
181 u32 usbother_base; 216 void __iomem *usbother_base;
182 217
183 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); 218 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
184 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET; 219 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
@@ -196,7 +231,7 @@ static int initialize_usbh1_port(struct platform_device *pdev)
196{ 231{
197 u32 v; 232 u32 v;
198 void __iomem *usb_base; 233 void __iomem *usb_base;
199 u32 usbother_base; 234 void __iomem *usbother_base;
200 235
201 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); 236 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
202 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET; 237 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
@@ -250,10 +285,11 @@ static void __init mxc_board_init(void)
250 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads, 285 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads,
251 ARRAY_SIZE(mx51babbage_pads)); 286 ARRAY_SIZE(mx51babbage_pads));
252 mxc_init_imx_uart(); 287 mxc_init_imx_uart();
253 platform_add_devices(devices, ARRAY_SIZE(devices)); 288 babbage_fec_reset();
289 imx51_add_fec(NULL);
254 290
255 mxc_register_device(&mxc_i2c_device0, &babbage_i2c_data); 291 imx51_add_imx_i2c(0, &babbage_i2c_data);
256 mxc_register_device(&mxc_i2c_device1, &babbage_i2c_data); 292 imx51_add_imx_i2c(1, &babbage_i2c_data);
257 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); 293 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data);
258 294
259 if (otg_mode_host) 295 if (otg_mode_host)
@@ -283,7 +319,7 @@ MACHINE_START(MX51_BABBAGE, "Freescale MX51 Babbage Board")
283 /* Maintainer: Amit Kucheria <amit.kucheria@canonical.com> */ 319 /* Maintainer: Amit Kucheria <amit.kucheria@canonical.com> */
284 .phys_io = MX51_AIPS1_BASE_ADDR, 320 .phys_io = MX51_AIPS1_BASE_ADDR,
285 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 321 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
286 .boot_params = PHYS_OFFSET + 0x100, 322 .boot_params = MX51_PHYS_OFFSET + 0x100,
287 .map_io = mx51_map_io, 323 .map_io = mx51_map_io,
288 .init_irq = mx51_init_irq, 324 .init_irq = mx51_init_irq,
289 .init_machine = mxc_board_init, 325 .init_machine = mxc_board_init,
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
new file mode 100644
index 000000000000..b00502acdc15
--- /dev/null
+++ b/arch/arm/mach-mx5/board-mx51_efikamx.c
@@ -0,0 +1,121 @@
1/*
2 * Copyright (C) 2010 Linaro Limited
3 *
4 * based on code from the following
5 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 * Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
7 * Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
8 *
9 * The code contained herein is licensed under the GNU General Public
10 * License. You may obtain a copy of the GNU General Public License
11 * Version 2 or later at the following locations:
12 *
13 * http://www.opensource.org/licenses/gpl-license.html
14 * http://www.gnu.org/copyleft/gpl.html
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/i2c.h>
20#include <linux/gpio.h>
21#include <linux/delay.h>
22#include <linux/io.h>
23#include <linux/fsl_devices.h>
24
25#include <mach/common.h>
26#include <mach/hardware.h>
27#include <mach/iomux-mx51.h>
28#include <mach/i2c.h>
29#include <mach/mxc_ehci.h>
30
31#include <asm/irq.h>
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/time.h>
36
37#include "devices-imx51.h"
38#include "devices.h"
39
40#define MX51_USB_PLL_DIV_24_MHZ 0x01
41
42static struct pad_desc mx51efikamx_pads[] = {
43 /* UART1 */
44 MX51_PAD_UART1_RXD__UART1_RXD,
45 MX51_PAD_UART1_TXD__UART1_TXD,
46 MX51_PAD_UART1_RTS__UART1_RTS,
47 MX51_PAD_UART1_CTS__UART1_CTS,
48};
49
50/* Serial ports */
51#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
52static const struct imxuart_platform_data uart_pdata = {
53 .flags = IMXUART_HAVE_RTSCTS,
54};
55
56static inline void mxc_init_imx_uart(void)
57{
58 imx51_add_imx_uart(0, &uart_pdata);
59 imx51_add_imx_uart(1, &uart_pdata);
60 imx51_add_imx_uart(2, &uart_pdata);
61}
62#else /* !SERIAL_IMX */
63static inline void mxc_init_imx_uart(void)
64{
65}
66#endif /* SERIAL_IMX */
67
68/* This function is board specific as the bit mask for the plldiv will also
69 * be different for other Freescale SoCs, thus a common bitmask is not
70 * possible and cannot get place in /plat-mxc/ehci.c.
71 */
72static int initialize_otg_port(struct platform_device *pdev)
73{
74 u32 v;
75 void __iomem *usb_base;
76 void __iomem *usbother_base;
77 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
78 usbother_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
79
80 /* Set the PHY clock to 19.2MHz */
81 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
82 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
83 v |= MX51_USB_PLL_DIV_24_MHZ;
84 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
85 iounmap(usb_base);
86 return 0;
87}
88
89static struct mxc_usbh_platform_data dr_utmi_config = {
90 .init = initialize_otg_port,
91 .portsc = MXC_EHCI_UTMI_16BIT,
92 .flags = MXC_EHCI_INTERNAL_PHY,
93};
94
95static void __init mxc_board_init(void)
96{
97 mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
98 ARRAY_SIZE(mx51efikamx_pads));
99 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
100 mxc_init_imx_uart();
101}
102
103static void __init mx51_efikamx_timer_init(void)
104{
105 mx51_clocks_init(32768, 24000000, 22579200, 24576000);
106}
107
108static struct sys_timer mxc_timer = {
109 .init = mx51_efikamx_timer_init,
110};
111
112MACHINE_START(MX51_EFIKAMX, "Genesi EfikaMX nettop")
113 /* Maintainer: Amit Kucheria <amit.kucheria@linaro.org> */
114 .phys_io = MX51_AIPS1_BASE_ADDR,
115 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
116 .boot_params = MX51_PHYS_OFFSET + 0x100,
117 .map_io = mx51_map_io,
118 .init_irq = mx51_init_irq,
119 .init_machine = mxc_board_init,
120 .timer = &mxc_timer,
121MACHINE_END
diff --git a/arch/arm/mach-mx5/clock-mx51.c b/arch/arm/mach-mx5/clock-mx51.c
index 57c10a9926cc..f2aae92cf0e2 100644
--- a/arch/arm/mach-mx5/clock-mx51.c
+++ b/arch/arm/mach-mx5/clock-mx51.c
@@ -41,34 +41,66 @@ static struct clk usboh3_clk;
41 41
42#define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */ 42#define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */
43 43
44static int _clk_ccgr_enable(struct clk *clk) 44/* calculate best pre and post dividers to get the required divider */
45static void __calc_pre_post_dividers(u32 div, u32 *pre, u32 *post,
46 u32 max_pre, u32 max_post)
45{ 47{
46 u32 reg; 48 if (div >= max_pre * max_post) {
49 *pre = max_pre;
50 *post = max_post;
51 } else if (div >= max_pre) {
52 u32 min_pre, temp_pre, old_err, err;
53 min_pre = DIV_ROUND_UP(div, max_post);
54 old_err = max_pre;
55 for (temp_pre = max_pre; temp_pre >= min_pre; temp_pre--) {
56 err = div % temp_pre;
57 if (err == 0) {
58 *pre = temp_pre;
59 break;
60 }
61 err = temp_pre - err;
62 if (err < old_err) {
63 old_err = err;
64 *pre = temp_pre;
65 }
66 }
67 *post = DIV_ROUND_UP(div, *pre);
68 } else {
69 *pre = div;
70 *post = 1;
71 }
72}
73
74static void _clk_ccgr_setclk(struct clk *clk, unsigned mode)
75{
76 u32 reg = __raw_readl(clk->enable_reg);
77
78 reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
79 reg |= mode << clk->enable_shift;
47 80
48 reg = __raw_readl(clk->enable_reg);
49 reg |= MXC_CCM_CCGRx_MOD_ON << clk->enable_shift;
50 __raw_writel(reg, clk->enable_reg); 81 __raw_writel(reg, clk->enable_reg);
82}
51 83
84static int _clk_ccgr_enable(struct clk *clk)
85{
86 _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_ON);
52 return 0; 87 return 0;
53} 88}
54 89
55static void _clk_ccgr_disable(struct clk *clk) 90static void _clk_ccgr_disable(struct clk *clk)
56{ 91{
57 u32 reg; 92 _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_OFF);
58 reg = __raw_readl(clk->enable_reg); 93}
59 reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
60 __raw_writel(reg, clk->enable_reg);
61 94
95static int _clk_ccgr_enable_inrun(struct clk *clk)
96{
97 _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_IDLE);
98 return 0;
62} 99}
63 100
64static void _clk_ccgr_disable_inwait(struct clk *clk) 101static void _clk_ccgr_disable_inwait(struct clk *clk)
65{ 102{
66 u32 reg; 103 _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_IDLE);
67
68 reg = __raw_readl(clk->enable_reg);
69 reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
70 reg |= MXC_CCM_CCGRx_MOD_IDLE << clk->enable_shift;
71 __raw_writel(reg, clk->enable_reg);
72} 104}
73 105
74/* 106/*
@@ -542,60 +574,60 @@ static int _clk_ipg_per_set_parent(struct clk *clk, struct clk *parent)
542 return 0; 574 return 0;
543} 575}
544 576
545static unsigned long clk_uart_get_rate(struct clk *clk) 577#define clk_nfc_set_parent NULL
546{
547 u32 reg, prediv, podf;
548 unsigned long parent_rate;
549 578
550 parent_rate = clk_get_rate(clk->parent); 579static unsigned long clk_nfc_get_rate(struct clk *clk)
551 580{
552 reg = __raw_readl(MXC_CCM_CSCDR1); 581 unsigned long rate;
553 prediv = ((reg & MXC_CCM_CSCDR1_UART_CLK_PRED_MASK) >> 582 u32 reg, div;
554 MXC_CCM_CSCDR1_UART_CLK_PRED_OFFSET) + 1;
555 podf = ((reg & MXC_CCM_CSCDR1_UART_CLK_PODF_MASK) >>
556 MXC_CCM_CSCDR1_UART_CLK_PODF_OFFSET) + 1;
557 583
558 return parent_rate / (prediv * podf); 584 reg = __raw_readl(MXC_CCM_CBCDR);
585 div = ((reg & MXC_CCM_CBCDR_NFC_PODF_MASK) >>
586 MXC_CCM_CBCDR_NFC_PODF_OFFSET) + 1;
587 rate = clk_get_rate(clk->parent) / div;
588 WARN_ON(rate == 0);
589 return rate;
559} 590}
560 591
561static int _clk_uart_set_parent(struct clk *clk, struct clk *parent) 592static unsigned long clk_nfc_round_rate(struct clk *clk,
593 unsigned long rate)
562{ 594{
563 u32 reg, mux; 595 u32 div;
596 unsigned long parent_rate = clk_get_rate(clk->parent);
564 597
565 mux = _get_mux(parent, &pll1_sw_clk, &pll2_sw_clk, &pll3_sw_clk, 598 if (!rate)
566 &lp_apm_clk); 599 return -EINVAL;
567 reg = __raw_readl(MXC_CCM_CSCMR1) & ~MXC_CCM_CSCMR1_UART_CLK_SEL_MASK;
568 reg |= mux << MXC_CCM_CSCMR1_UART_CLK_SEL_OFFSET;
569 __raw_writel(reg, MXC_CCM_CSCMR1);
570 600
571 return 0; 601 div = parent_rate / rate;
572}
573 602
574static unsigned long clk_usboh3_get_rate(struct clk *clk) 603 if (parent_rate % rate)
575{ 604 div++;
576 u32 reg, prediv, podf;
577 unsigned long parent_rate;
578 605
579 parent_rate = clk_get_rate(clk->parent); 606 if (div > 8)
607 return -EINVAL;
580 608
581 reg = __raw_readl(MXC_CCM_CSCDR1); 609 return parent_rate / div;
582 prediv = ((reg & MXC_CCM_CSCDR1_USBOH3_CLK_PRED_MASK) >>
583 MXC_CCM_CSCDR1_USBOH3_CLK_PRED_OFFSET) + 1;
584 podf = ((reg & MXC_CCM_CSCDR1_USBOH3_CLK_PODF_MASK) >>
585 MXC_CCM_CSCDR1_USBOH3_CLK_PODF_OFFSET) + 1;
586 610
587 return parent_rate / (prediv * podf);
588} 611}
589 612
590static int _clk_usboh3_set_parent(struct clk *clk, struct clk *parent) 613static int clk_nfc_set_rate(struct clk *clk, unsigned long rate)
591{ 614{
592 u32 reg, mux; 615 u32 reg, div;
616
617 div = clk_get_rate(clk->parent) / rate;
618 if (div == 0)
619 div++;
620 if (((clk_get_rate(clk->parent) / div) != rate) || (div > 8))
621 return -EINVAL;
622
623 reg = __raw_readl(MXC_CCM_CBCDR);
624 reg &= ~MXC_CCM_CBCDR_NFC_PODF_MASK;
625 reg |= (div - 1) << MXC_CCM_CBCDR_NFC_PODF_OFFSET;
626 __raw_writel(reg, MXC_CCM_CBCDR);
593 627
594 mux = _get_mux(parent, &pll1_sw_clk, &pll2_sw_clk, &pll3_sw_clk, 628 while (__raw_readl(MXC_CCM_CDHIPR) &
595 &lp_apm_clk); 629 MXC_CCM_CDHIPR_NFC_IPG_INT_MEM_PODF_BUSY){
596 reg = __raw_readl(MXC_CCM_CSCMR1) & ~MXC_CCM_CSCMR1_USBOH3_CLK_SEL_MASK; 630 }
597 reg |= mux << MXC_CCM_CSCMR1_USBOH3_CLK_SEL_OFFSET;
598 __raw_writel(reg, MXC_CCM_CSCMR1);
599 631
600 return 0; 632 return 0;
601} 633}
@@ -620,6 +652,17 @@ static unsigned long get_ckih2_reference_clock_rate(struct clk *clk)
620 return ckih2_reference; 652 return ckih2_reference;
621} 653}
622 654
655static unsigned long clk_emi_slow_get_rate(struct clk *clk)
656{
657 u32 reg, div;
658
659 reg = __raw_readl(MXC_CCM_CBCDR);
660 div = ((reg & MXC_CCM_CBCDR_EMI_PODF_MASK) >>
661 MXC_CCM_CBCDR_EMI_PODF_OFFSET) + 1;
662
663 return clk_get_rate(clk->parent) / div;
664}
665
623/* External high frequency clock */ 666/* External high frequency clock */
624static struct clk ckih_clk = { 667static struct clk ckih_clk = {
625 .get_rate = get_high_reference_clock_rate, 668 .get_rate = get_high_reference_clock_rate,
@@ -715,18 +758,6 @@ static struct clk ipg_perclk = {
715 .set_parent = _clk_ipg_per_set_parent, 758 .set_parent = _clk_ipg_per_set_parent,
716}; 759};
717 760
718static struct clk uart_root_clk = {
719 .parent = &pll2_sw_clk,
720 .get_rate = clk_uart_get_rate,
721 .set_parent = _clk_uart_set_parent,
722};
723
724static struct clk usboh3_clk = {
725 .parent = &pll2_sw_clk,
726 .get_rate = clk_usboh3_get_rate,
727 .set_parent = _clk_usboh3_set_parent,
728};
729
730static struct clk ahb_max_clk = { 761static struct clk ahb_max_clk = {
731 .parent = &ahb_clk, 762 .parent = &ahb_clk,
732 .enable_reg = MXC_CCM_CCGR0, 763 .enable_reg = MXC_CCM_CCGR0,
@@ -762,45 +793,183 @@ static struct clk kpp_clk = {
762 .id = 0, 793 .id = 0,
763}; 794};
764 795
765#define DEFINE_CLOCK(name, i, er, es, gr, sr, p, s) \ 796static struct clk emi_slow_clk = {
797 .parent = &pll2_sw_clk,
798 .enable_reg = MXC_CCM_CCGR5,
799 .enable_shift = MXC_CCM_CCGRx_CG8_OFFSET,
800 .enable = _clk_ccgr_enable,
801 .disable = _clk_ccgr_disable_inwait,
802 .get_rate = clk_emi_slow_get_rate,
803};
804
805#define DEFINE_CLOCK_CCGR(name, i, er, es, pfx, p, s) \
766 static struct clk name = { \ 806 static struct clk name = { \
767 .id = i, \ 807 .id = i, \
768 .enable_reg = er, \ 808 .enable_reg = er, \
769 .enable_shift = es, \ 809 .enable_shift = es, \
770 .get_rate = gr, \ 810 .get_rate = pfx##_get_rate, \
771 .set_rate = sr, \ 811 .set_rate = pfx##_set_rate, \
812 .round_rate = pfx##_round_rate, \
813 .set_parent = pfx##_set_parent, \
772 .enable = _clk_ccgr_enable, \ 814 .enable = _clk_ccgr_enable, \
773 .disable = _clk_ccgr_disable, \ 815 .disable = _clk_ccgr_disable, \
774 .parent = p, \ 816 .parent = p, \
775 .secondary = s, \ 817 .secondary = s, \
776 } 818 }
777 819
778/* DEFINE_CLOCK(name, id, enable_reg, enable_shift, 820#define DEFINE_CLOCK_MAX(name, i, er, es, pfx, p, s) \
779 get_rate, set_rate, parent, secondary); */ 821 static struct clk name = { \
822 .id = i, \
823 .enable_reg = er, \
824 .enable_shift = es, \
825 .get_rate = pfx##_get_rate, \
826 .set_rate = pfx##_set_rate, \
827 .set_parent = pfx##_set_parent, \
828 .enable = _clk_max_enable, \
829 .disable = _clk_max_disable, \
830 .parent = p, \
831 .secondary = s, \
832 }
833
834#define CLK_GET_RATE(name, nr, bitsname) \
835static unsigned long clk_##name##_get_rate(struct clk *clk) \
836{ \
837 u32 reg, pred, podf; \
838 \
839 reg = __raw_readl(MXC_CCM_CSCDR##nr); \
840 pred = (reg & MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_MASK) \
841 >> MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_OFFSET; \
842 podf = (reg & MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_MASK) \
843 >> MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_OFFSET; \
844 \
845 return DIV_ROUND_CLOSEST(clk_get_rate(clk->parent), \
846 (pred + 1) * (podf + 1)); \
847}
848
849#define CLK_SET_PARENT(name, nr, bitsname) \
850static int clk_##name##_set_parent(struct clk *clk, struct clk *parent) \
851{ \
852 u32 reg, mux; \
853 \
854 mux = _get_mux(parent, &pll1_sw_clk, &pll2_sw_clk, \
855 &pll3_sw_clk, &lp_apm_clk); \
856 reg = __raw_readl(MXC_CCM_CSCMR##nr) & \
857 ~MXC_CCM_CSCMR##nr##_##bitsname##_CLK_SEL_MASK; \
858 reg |= mux << MXC_CCM_CSCMR##nr##_##bitsname##_CLK_SEL_OFFSET; \
859 __raw_writel(reg, MXC_CCM_CSCMR##nr); \
860 \
861 return 0; \
862}
863
864#define CLK_SET_RATE(name, nr, bitsname) \
865static int clk_##name##_set_rate(struct clk *clk, unsigned long rate) \
866{ \
867 u32 reg, div, parent_rate; \
868 u32 pre = 0, post = 0; \
869 \
870 parent_rate = clk_get_rate(clk->parent); \
871 div = parent_rate / rate; \
872 \
873 if ((parent_rate / div) != rate) \
874 return -EINVAL; \
875 \
876 __calc_pre_post_dividers(div, &pre, &post, \
877 (MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_MASK >> \
878 MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_OFFSET) + 1, \
879 (MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_MASK >> \
880 MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_OFFSET) + 1);\
881 \
882 /* Set sdhc1 clock divider */ \
883 reg = __raw_readl(MXC_CCM_CSCDR##nr) & \
884 ~(MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_MASK \
885 | MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_MASK); \
886 reg |= (post - 1) << \
887 MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_OFFSET; \
888 reg |= (pre - 1) << \
889 MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_OFFSET; \
890 __raw_writel(reg, MXC_CCM_CSCDR##nr); \
891 \
892 return 0; \
893}
894
895/* UART */
896CLK_GET_RATE(uart, 1, UART)
897CLK_SET_PARENT(uart, 1, UART)
898
899static struct clk uart_root_clk = {
900 .parent = &pll2_sw_clk,
901 .get_rate = clk_uart_get_rate,
902 .set_parent = clk_uart_set_parent,
903};
904
905/* USBOH3 */
906CLK_GET_RATE(usboh3, 1, USBOH3)
907CLK_SET_PARENT(usboh3, 1, USBOH3)
908
909static struct clk usboh3_clk = {
910 .parent = &pll2_sw_clk,
911 .get_rate = clk_usboh3_get_rate,
912 .set_parent = clk_usboh3_set_parent,
913};
914
915/* eCSPI */
916CLK_GET_RATE(ecspi, 2, CSPI)
917CLK_SET_PARENT(ecspi, 1, CSPI)
918
919static struct clk ecspi_main_clk = {
920 .parent = &pll3_sw_clk,
921 .get_rate = clk_ecspi_get_rate,
922 .set_parent = clk_ecspi_set_parent,
923};
924
925/* eSDHC */
926CLK_GET_RATE(esdhc1, 1, ESDHC1_MSHC1)
927CLK_SET_PARENT(esdhc1, 1, ESDHC1_MSHC1)
928CLK_SET_RATE(esdhc1, 1, ESDHC1_MSHC1)
929
930CLK_GET_RATE(esdhc2, 1, ESDHC2_MSHC2)
931CLK_SET_PARENT(esdhc2, 1, ESDHC2_MSHC2)
932CLK_SET_RATE(esdhc2, 1, ESDHC2_MSHC2)
933
934#define DEFINE_CLOCK_FULL(name, i, er, es, gr, sr, e, d, p, s) \
935 static struct clk name = { \
936 .id = i, \
937 .enable_reg = er, \
938 .enable_shift = es, \
939 .get_rate = gr, \
940 .set_rate = sr, \
941 .enable = e, \
942 .disable = d, \
943 .parent = p, \
944 .secondary = s, \
945 }
946
947#define DEFINE_CLOCK(name, i, er, es, gr, sr, p, s) \
948 DEFINE_CLOCK_FULL(name, i, er, es, gr, sr, _clk_ccgr_enable, _clk_ccgr_disable, p, s)
780 949
781/* Shared peripheral bus arbiter */ 950/* Shared peripheral bus arbiter */
782DEFINE_CLOCK(spba_clk, 0, MXC_CCM_CCGR5, MXC_CCM_CCGRx_CG0_OFFSET, 951DEFINE_CLOCK(spba_clk, 0, MXC_CCM_CCGR5, MXC_CCM_CCGRx_CG0_OFFSET,
783 NULL, NULL, &ipg_clk, NULL); 952 NULL, NULL, &ipg_clk, NULL);
784 953
785/* UART */ 954/* UART */
786DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG4_OFFSET,
787 NULL, NULL, &uart_root_clk, NULL);
788DEFINE_CLOCK(uart2_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG6_OFFSET,
789 NULL, NULL, &uart_root_clk, NULL);
790DEFINE_CLOCK(uart3_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG8_OFFSET,
791 NULL, NULL, &uart_root_clk, NULL);
792DEFINE_CLOCK(uart1_ipg_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG3_OFFSET, 955DEFINE_CLOCK(uart1_ipg_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG3_OFFSET,
793 NULL, NULL, &ipg_clk, &aips_tz1_clk); 956 NULL, NULL, &ipg_clk, &aips_tz1_clk);
794DEFINE_CLOCK(uart2_ipg_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG5_OFFSET, 957DEFINE_CLOCK(uart2_ipg_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG5_OFFSET,
795 NULL, NULL, &ipg_clk, &aips_tz1_clk); 958 NULL, NULL, &ipg_clk, &aips_tz1_clk);
796DEFINE_CLOCK(uart3_ipg_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG7_OFFSET, 959DEFINE_CLOCK(uart3_ipg_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG7_OFFSET,
797 NULL, NULL, &ipg_clk, &spba_clk); 960 NULL, NULL, &ipg_clk, &spba_clk);
961DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG4_OFFSET,
962 NULL, NULL, &uart_root_clk, &uart1_ipg_clk);
963DEFINE_CLOCK(uart2_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG6_OFFSET,
964 NULL, NULL, &uart_root_clk, &uart2_ipg_clk);
965DEFINE_CLOCK(uart3_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG8_OFFSET,
966 NULL, NULL, &uart_root_clk, &uart3_ipg_clk);
798 967
799/* GPT */ 968/* GPT */
800DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET,
801 NULL, NULL, &ipg_clk, NULL);
802DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET, 969DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET,
803 NULL, NULL, &ipg_clk, NULL); 970 NULL, NULL, &ipg_clk, NULL);
971DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET,
972 NULL, NULL, &ipg_clk, &gpt_ipg_clk);
804 973
805/* I2C */ 974/* I2C */
806DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET, 975DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET,
@@ -814,6 +983,52 @@ DEFINE_CLOCK(hsi2c_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG11_OFFSET,
814DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET, 983DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET,
815 NULL, NULL, &ipg_clk, NULL); 984 NULL, NULL, &ipg_clk, NULL);
816 985
986/* NFC */
987DEFINE_CLOCK_CCGR(nfc_clk, 0, MXC_CCM_CCGR5, MXC_CCM_CCGRx_CG10_OFFSET,
988 clk_nfc, &emi_slow_clk, NULL);
989
990/* SSI */
991DEFINE_CLOCK(ssi1_ipg_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG8_OFFSET,
992 NULL, NULL, &ipg_clk, NULL);
993DEFINE_CLOCK(ssi1_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG9_OFFSET,
994 NULL, NULL, &pll3_sw_clk, &ssi1_ipg_clk);
995DEFINE_CLOCK(ssi2_ipg_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG10_OFFSET,
996 NULL, NULL, &ipg_clk, NULL);
997DEFINE_CLOCK(ssi2_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG11_OFFSET,
998 NULL, NULL, &pll3_sw_clk, &ssi2_ipg_clk);
999
1000/* eCSPI */
1001DEFINE_CLOCK_FULL(ecspi1_ipg_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG9_OFFSET,
1002 NULL, NULL, _clk_ccgr_enable_inrun, _clk_ccgr_disable,
1003 &ipg_clk, &spba_clk);
1004DEFINE_CLOCK(ecspi1_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG10_OFFSET,
1005 NULL, NULL, &ecspi_main_clk, &ecspi1_ipg_clk);
1006DEFINE_CLOCK_FULL(ecspi2_ipg_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG11_OFFSET,
1007 NULL, NULL, _clk_ccgr_enable_inrun, _clk_ccgr_disable,
1008 &ipg_clk, &aips_tz2_clk);
1009DEFINE_CLOCK(ecspi2_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG12_OFFSET,
1010 NULL, NULL, &ecspi_main_clk, &ecspi2_ipg_clk);
1011
1012/* CSPI */
1013DEFINE_CLOCK(cspi_ipg_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG9_OFFSET,
1014 NULL, NULL, &ipg_clk, &aips_tz2_clk);
1015DEFINE_CLOCK(cspi_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG13_OFFSET,
1016 NULL, NULL, &ipg_clk, &cspi_ipg_clk);
1017
1018/* SDMA */
1019DEFINE_CLOCK(sdma_clk, 1, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG15_OFFSET,
1020 NULL, NULL, &ahb_clk, NULL);
1021
1022/* eSDHC */
1023DEFINE_CLOCK_FULL(esdhc1_ipg_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG0_OFFSET,
1024 NULL, NULL, _clk_max_enable, _clk_max_disable, &ipg_clk, NULL);
1025DEFINE_CLOCK_MAX(esdhc1_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG1_OFFSET,
1026 clk_esdhc1, &pll2_sw_clk, &esdhc1_ipg_clk);
1027DEFINE_CLOCK_FULL(esdhc2_ipg_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG2_OFFSET,
1028 NULL, NULL, _clk_max_enable, _clk_max_disable, &ipg_clk, NULL);
1029DEFINE_CLOCK_MAX(esdhc2_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG3_OFFSET,
1030 clk_esdhc2, &pll2_sw_clk, &esdhc2_ipg_clk);
1031
817#define _REGISTER_CLOCK(d, n, c) \ 1032#define _REGISTER_CLOCK(d, n, c) \
818 { \ 1033 { \
819 .dev_id = d, \ 1034 .dev_id = d, \
@@ -837,6 +1052,18 @@ static struct clk_lookup lookups[] = {
837 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk) 1052 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk)
838 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk) 1053 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk)
839 _REGISTER_CLOCK("imx-keypad.0", NULL, kpp_clk) 1054 _REGISTER_CLOCK("imx-keypad.0", NULL, kpp_clk)
1055 _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk)
1056 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
1057 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
1058 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
1059 _REGISTER_CLOCK(NULL, "ckih", ckih_clk)
1060 _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk)
1061 _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk)
1062 _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk)
1063 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk)
1064 _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk)
1065 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
1066 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
840}; 1067};
841 1068
842static void clk_tree_init(void) 1069static void clk_tree_init(void)
@@ -880,6 +1107,14 @@ int __init mx51_clocks_init(unsigned long ckil, unsigned long osc,
880 /* set the usboh3_clk parent to pll2_sw_clk */ 1107 /* set the usboh3_clk parent to pll2_sw_clk */
881 clk_set_parent(&usboh3_clk, &pll2_sw_clk); 1108 clk_set_parent(&usboh3_clk, &pll2_sw_clk);
882 1109
1110 /* Set SDHC parents to be PLL2 */
1111 clk_set_parent(&esdhc1_clk, &pll2_sw_clk);
1112 clk_set_parent(&esdhc2_clk, &pll2_sw_clk);
1113
1114 /* set SDHC root clock as 166.25MHZ*/
1115 clk_set_rate(&esdhc1_clk, 166250000);
1116 clk_set_rate(&esdhc2_clk, 166250000);
1117
883 /* System timer */ 1118 /* System timer */
884 mxc_timer_init(&gpt_clk, MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), 1119 mxc_timer_init(&gpt_clk, MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR),
885 MX51_MXC_INT_GPT); 1120 MX51_MXC_INT_GPT);
diff --git a/arch/arm/mach-mx5/cpu.c b/arch/arm/mach-mx5/cpu.c
index 2d37785e3857..eaacb6e9b5d0 100644
--- a/arch/arm/mach-mx5/cpu.c
+++ b/arch/arm/mach-mx5/cpu.c
@@ -70,6 +70,25 @@ int mx51_revision(void)
70} 70}
71EXPORT_SYMBOL(mx51_revision); 71EXPORT_SYMBOL(mx51_revision);
72 72
73#ifdef CONFIG_NEON
74
75/*
76 * All versions of the silicon before Rev. 3 have broken NEON implementations.
77 * Dependent on link order - so the assumption is that vfp_init is called
78 * before us.
79 */
80static int __init mx51_neon_fixup(void)
81{
82 if (mx51_revision() < MX51_CHIP_REV_3_0 && (elf_hwcap & HWCAP_NEON)) {
83 elf_hwcap &= ~HWCAP_NEON;
84 pr_info("Turning off NEON support, detected broken NEON implementation\n");
85 }
86 return 0;
87}
88
89late_initcall(mx51_neon_fixup);
90#endif
91
73static int __init post_cpu_init(void) 92static int __init post_cpu_init(void)
74{ 93{
75 unsigned int reg; 94 unsigned int reg;
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
new file mode 100644
index 000000000000..5cc910e60538
--- /dev/null
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/mx51.h>
10#include <mach/devices-common.h>
11
12extern const struct imx_fec_data imx51_fec_data __initconst;
13#define imx51_add_fec(pdata) \
14 imx_add_fec(&imx51_fec_data, pdata)
15
16extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
17#define imx51_add_imx_i2c(id, pdata) \
18 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
19
20extern const struct imx_imx_ssi_data imx51_imx_ssi_data[] __initconst;
21#define imx51_add_imx_ssi(id, pdata) \
22 imx_add_imx_ssi(&imx51_imx_ssi_data[id], pdata)
23
24extern const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst;
25#define imx51_add_imx_uart(id, pdata) \
26 imx_add_imx_uart_1irq(&imx51_imx_uart_data[id], pdata)
27
28extern const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst;
29#define imx51_add_mxc_nand(pdata) \
30 imx_add_mxc_nand(&imx51_mxc_nand_data, pdata)
31
32extern const struct imx_spi_imx_data imx51_cspi_data __initconst;
33#define imx51_add_cspi(pdata) \
34 imx_add_spi_imx(&imx51_cspi_data, pdata)
35
36extern const struct imx_spi_imx_data imx51_ecspi_data[] __initconst;
37#define imx51_add_ecspi(id, pdata) \
38 imx_add_spi_imx(&imx51_ecspi_data[id], pdata)
39
40extern const struct imx_esdhc_imx_data imx51_esdhc_data[] __initconst;
41#define imx51_add_esdhc(id, pdata) \
42 imx_add_esdhc(&imx51_esdhc_data[id], pdata)
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 1920ff4963b2..4c7be87a7c9d 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -17,120 +17,6 @@
17#include <mach/imx-uart.h> 17#include <mach/imx-uart.h>
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19 19
20static struct resource uart0[] = {
21 {
22 .start = MX51_UART1_BASE_ADDR,
23 .end = MX51_UART1_BASE_ADDR + 0xfff,
24 .flags = IORESOURCE_MEM,
25 }, {
26 .start = MX51_MXC_INT_UART1,
27 .end = MX51_MXC_INT_UART1,
28 .flags = IORESOURCE_IRQ,
29 },
30};
31
32struct platform_device mxc_uart_device0 = {
33 .name = "imx-uart",
34 .id = 0,
35 .resource = uart0,
36 .num_resources = ARRAY_SIZE(uart0),
37};
38
39static struct resource uart1[] = {
40 {
41 .start = MX51_UART2_BASE_ADDR,
42 .end = MX51_UART2_BASE_ADDR + 0xfff,
43 .flags = IORESOURCE_MEM,
44 }, {
45 .start = MX51_MXC_INT_UART2,
46 .end = MX51_MXC_INT_UART2,
47 .flags = IORESOURCE_IRQ,
48 },
49};
50
51struct platform_device mxc_uart_device1 = {
52 .name = "imx-uart",
53 .id = 1,
54 .resource = uart1,
55 .num_resources = ARRAY_SIZE(uart1),
56};
57
58static struct resource uart2[] = {
59 {
60 .start = MX51_UART3_BASE_ADDR,
61 .end = MX51_UART3_BASE_ADDR + 0xfff,
62 .flags = IORESOURCE_MEM,
63 }, {
64 .start = MX51_MXC_INT_UART3,
65 .end = MX51_MXC_INT_UART3,
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70struct platform_device mxc_uart_device2 = {
71 .name = "imx-uart",
72 .id = 2,
73 .resource = uart2,
74 .num_resources = ARRAY_SIZE(uart2),
75};
76
77static struct resource mxc_fec_resources[] = {
78 {
79 .start = MX51_MXC_FEC_BASE_ADDR,
80 .end = MX51_MXC_FEC_BASE_ADDR + 0xfff,
81 .flags = IORESOURCE_MEM,
82 }, {
83 .start = MX51_MXC_INT_FEC,
84 .end = MX51_MXC_INT_FEC,
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89struct platform_device mxc_fec_device = {
90 .name = "fec",
91 .id = 0,
92 .num_resources = ARRAY_SIZE(mxc_fec_resources),
93 .resource = mxc_fec_resources,
94};
95
96static struct resource mxc_i2c0_resources[] = {
97 {
98 .start = MX51_I2C1_BASE_ADDR,
99 .end = MX51_I2C1_BASE_ADDR + SZ_4K - 1,
100 .flags = IORESOURCE_MEM,
101 }, {
102 .start = MX51_MXC_INT_I2C1,
103 .end = MX51_MXC_INT_I2C1,
104 .flags = IORESOURCE_IRQ,
105 },
106};
107
108struct platform_device mxc_i2c_device0 = {
109 .name = "imx-i2c",
110 .id = 0,
111 .num_resources = ARRAY_SIZE(mxc_i2c0_resources),
112 .resource = mxc_i2c0_resources,
113};
114
115static struct resource mxc_i2c1_resources[] = {
116 {
117 .start = MX51_I2C2_BASE_ADDR,
118 .end = MX51_I2C2_BASE_ADDR + SZ_4K - 1,
119 .flags = IORESOURCE_MEM,
120 }, {
121 .start = MX51_MXC_INT_I2C2,
122 .end = MX51_MXC_INT_I2C2,
123 .flags = IORESOURCE_IRQ,
124 },
125};
126
127struct platform_device mxc_i2c_device1 = {
128 .name = "imx-i2c",
129 .id = 1,
130 .num_resources = ARRAY_SIZE(mxc_i2c1_resources),
131 .resource = mxc_i2c1_resources,
132};
133
134static struct resource mxc_hsi2c_resources[] = { 20static struct resource mxc_hsi2c_resources[] = {
135 { 21 {
136 .start = MX51_HSI2C_DMA_BASE_ADDR, 22 .start = MX51_HSI2C_DMA_BASE_ADDR,
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index e509cfaad1d4..af1d07c0bbc1 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -1,12 +1,6 @@
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_fec_device;
5extern struct platform_device mxc_usbdr_host_device; 1extern struct platform_device mxc_usbdr_host_device;
6extern struct platform_device mxc_usbh1_device; 2extern struct platform_device mxc_usbh1_device;
7extern struct platform_device mxc_usbdr_udc_device; 3extern struct platform_device mxc_usbdr_udc_device;
8extern struct platform_device mxc_wdt; 4extern struct platform_device mxc_wdt;
9extern struct platform_device mxc_i2c_device0;
10extern struct platform_device mxc_i2c_device1;
11extern struct platform_device mxc_hsi2c_device; 5extern struct platform_device mxc_hsi2c_device;
12extern struct platform_device mxc_keypad_device; 6extern struct platform_device mxc_keypad_device;
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
index ffa93d1d6ef8..a2e6e8c39d25 100644
--- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
+++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
@@ -30,6 +30,7 @@
30 30
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32 32
33#include "devices-imx51.h"
33#include "devices.h" 34#include "devices.h"
34 35
35#define MBIMX51_TSC2007_GPIO (2*32 + 30) 36#define MBIMX51_TSC2007_GPIO (2*32 + 30)
@@ -112,9 +113,25 @@ static struct pad_desc mbimx51_pads[] = {
112 MX51_PAD_KEY_COL1__KEY_COL1, 113 MX51_PAD_KEY_COL1__KEY_COL1,
113 MX51_PAD_KEY_COL2__KEY_COL2, 114 MX51_PAD_KEY_COL2__KEY_COL2,
114 MX51_PAD_KEY_COL3__KEY_COL3, 115 MX51_PAD_KEY_COL3__KEY_COL3,
116
117 /* SD 1 */
118 MX51_PAD_SD1_CMD__SD1_CMD,
119 MX51_PAD_SD1_CLK__SD1_CLK,
120 MX51_PAD_SD1_DATA0__SD1_DATA0,
121 MX51_PAD_SD1_DATA1__SD1_DATA1,
122 MX51_PAD_SD1_DATA2__SD1_DATA2,
123 MX51_PAD_SD1_DATA3__SD1_DATA3,
124
125 /* SD 2 */
126 MX51_PAD_SD2_CMD__SD2_CMD,
127 MX51_PAD_SD2_CLK__SD2_CLK,
128 MX51_PAD_SD2_DATA0__SD2_DATA0,
129 MX51_PAD_SD2_DATA1__SD2_DATA1,
130 MX51_PAD_SD2_DATA2__SD2_DATA2,
131 MX51_PAD_SD2_DATA3__SD2_DATA3,
115}; 132};
116 133
117static struct imxuart_platform_data uart_pdata = { 134static const struct imxuart_platform_data uart_pdata __initconst = {
118 .flags = IMXUART_HAVE_RTSCTS, 135 .flags = IMXUART_HAVE_RTSCTS,
119}; 136};
120 137
@@ -158,9 +175,11 @@ struct tsc2007_platform_data tsc2007_data = {
158 175
159static struct i2c_board_info mbimx51_i2c_devices[] = { 176static struct i2c_board_info mbimx51_i2c_devices[] = {
160 { 177 {
161 I2C_BOARD_INFO("tsc2007", 0x48), 178 I2C_BOARD_INFO("tsc2007", 0x49),
162 .irq = MBIMX51_TSC2007_IRQ, 179 .irq = MBIMX51_TSC2007_IRQ,
163 .platform_data = &tsc2007_data, 180 .platform_data = &tsc2007_data,
181 }, {
182 I2C_BOARD_INFO("tlv320aic23", 0x1a),
164 }, 183 },
165}; 184};
166 185
@@ -172,8 +191,8 @@ void __init eukrea_mbimx51_baseboard_init(void)
172 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads, 191 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads,
173 ARRAY_SIZE(mbimx51_pads)); 192 ARRAY_SIZE(mbimx51_pads));
174 193
175 mxc_register_device(&mxc_uart_device1, NULL); 194 imx51_add_imx_uart(1, NULL);
176 mxc_register_device(&mxc_uart_device2, &uart_pdata); 195 imx51_add_imx_uart(2, &uart_pdata);
177 196
178 gpio_request(MBIMX51_LED0, "LED0"); 197 gpio_request(MBIMX51_LED0, "LED0");
179 gpio_direction_output(MBIMX51_LED0, 1); 198 gpio_direction_output(MBIMX51_LED0, 1);
@@ -197,4 +216,7 @@ void __init eukrea_mbimx51_baseboard_init(void)
197 set_irq_type(MBIMX51_TSC2007_IRQ, IRQF_TRIGGER_FALLING); 216 set_irq_type(MBIMX51_TSC2007_IRQ, IRQF_TRIGGER_FALLING);
198 i2c_register_board_info(1, mbimx51_i2c_devices, 217 i2c_register_board_info(1, mbimx51_i2c_devices,
199 ARRAY_SIZE(mbimx51_i2c_devices)); 218 ARRAY_SIZE(mbimx51_i2c_devices));
219
220 imx51_add_esdhc(0, NULL);
221 imx51_add_esdhc(1, NULL);
200} 222}
diff --git a/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c
new file mode 100644
index 000000000000..2b48f5190830
--- /dev/null
+++ b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c
@@ -0,0 +1,166 @@
1/*
2 * Copyright (C) 2010 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/types.h>
23#include <linux/init.h>
24
25#include <linux/gpio.h>
26#include <linux/interrupt.h>
27#include <linux/irq.h>
28#include <linux/leds.h>
29#include <linux/platform_device.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
32#include <linux/i2c.h>
33
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/mach/map.h>
38
39#include <mach/hardware.h>
40#include <mach/common.h>
41#include <mach/imx-uart.h>
42#include <mach/iomux-mx51.h>
43#include <mach/audmux.h>
44
45#include "devices-imx51.h"
46#include "devices.h"
47
48#define MBIMXSD_GPIO_3_31 IOMUX_PAD(0x554, 0x16C, 3, 0x0, 0, \
49 MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP)
50
51static struct pad_desc eukrea_mbimxsd_pads[] = {
52 /* LED */
53 MX51_PAD_NANDF_D10__GPIO_3_30,
54 /* SWITCH */
55 MBIMXSD_GPIO_3_31,
56 /* UART2 */
57 MX51_PAD_UART2_RXD__UART2_RXD,
58 MX51_PAD_UART2_TXD__UART2_TXD,
59 /* UART 3 */
60 MX51_PAD_UART3_RXD__UART3_RXD,
61 MX51_PAD_UART3_TXD__UART3_TXD,
62 MX51_PAD_KEY_COL4__UART3_RTS,
63 MX51_PAD_KEY_COL5__UART3_CTS,
64 /* SD */
65 MX51_PAD_SD1_CMD__SD1_CMD,
66 MX51_PAD_SD1_CLK__SD1_CLK,
67 MX51_PAD_SD1_DATA0__SD1_DATA0,
68 MX51_PAD_SD1_DATA1__SD1_DATA1,
69 MX51_PAD_SD1_DATA2__SD1_DATA2,
70 MX51_PAD_SD1_DATA3__SD1_DATA3,
71};
72
73#define GPIO_LED1 (2 * 32 + 30)
74#define GPIO_SWITCH1 (2 * 32 + 31)
75
76static struct gpio_led eukrea_mbimxsd_leds[] = {
77 {
78 .name = "led1",
79 .default_trigger = "heartbeat",
80 .active_low = 1,
81 .gpio = GPIO_LED1,
82 },
83};
84
85static struct gpio_led_platform_data eukrea_mbimxsd_led_info = {
86 .leds = eukrea_mbimxsd_leds,
87 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),
88};
89
90static struct platform_device eukrea_mbimxsd_leds_gpio = {
91 .name = "leds-gpio",
92 .id = -1,
93 .dev = {
94 .platform_data = &eukrea_mbimxsd_led_info,
95 },
96};
97
98static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
99 {
100 .gpio = GPIO_SWITCH1,
101 .code = BTN_0,
102 .desc = "BP1",
103 .active_low = 1,
104 .wakeup = 1,
105 },
106};
107
108static struct gpio_keys_platform_data eukrea_mbimxsd_button_data = {
109 .buttons = eukrea_mbimxsd_gpio_buttons,
110 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
111};
112
113static struct platform_device eukrea_mbimxsd_button_device = {
114 .name = "gpio-keys",
115 .id = -1,
116 .num_resources = 0,
117 .dev = {
118 .platform_data = &eukrea_mbimxsd_button_data,
119 }
120};
121
122static struct platform_device *platform_devices[] __initdata = {
123 &eukrea_mbimxsd_leds_gpio,
124 &eukrea_mbimxsd_button_device,
125};
126
127static const struct imxuart_platform_data uart_pdata __initconst = {
128 .flags = IMXUART_HAVE_RTSCTS,
129};
130
131static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
132 {
133 I2C_BOARD_INFO("tlv320aic23", 0x1a),
134 },
135};
136
137/*
138 * system init for baseboard usage. Will be called by cpuimx51sd init.
139 *
140 * Add platform devices present on this baseboard and init
141 * them from CPU side as far as required to use them later on
142 */
143void __init eukrea_mbimxsd51_baseboard_init(void)
144{
145 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
146 ARRAY_SIZE(eukrea_mbimxsd_pads)))
147 printk(KERN_ERR "error setting mbimxsd pads !\n");
148
149 imx51_add_imx_uart(1, NULL);
150 imx51_add_imx_uart(2, &uart_pdata);
151
152 imx51_add_esdhc(0, NULL);
153
154 gpio_request(GPIO_LED1, "LED1");
155 gpio_direction_output(GPIO_LED1, 1);
156 gpio_free(GPIO_LED1);
157
158 gpio_request(GPIO_SWITCH1, "SWITCH1");
159 gpio_direction_input(GPIO_SWITCH1);
160 gpio_free(GPIO_SWITCH1);
161
162 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
163 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
164
165 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
166}
diff --git a/arch/arm/mach-netx/include/mach/vmalloc.h b/arch/arm/mach-netx/include/mach/vmalloc.h
index 25d5cc676e0f..7cca3574308f 100644
--- a/arch/arm/mach-netx/include/mach/vmalloc.h
+++ b/arch/arm/mach-netx/include/mach/vmalloc.h
@@ -16,4 +16,4 @@
16 * along with this program; if not, write to the Free Software 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 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 19#define VMALLOC_END 0xd0000000
diff --git a/arch/arm/mach-omap1/include/mach/vmalloc.h b/arch/arm/mach-omap1/include/mach/vmalloc.h
index 1b2af14df151..b001f67d695b 100644
--- a/arch/arm/mach-omap1/include/mach/vmalloc.h
+++ b/arch/arm/mach-omap1/include/mach/vmalloc.h
@@ -17,4 +17,4 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x18000000) 20#define VMALLOC_END 0xd8000000
diff --git a/arch/arm/mach-omap2/include/mach/vmalloc.h b/arch/arm/mach-omap2/include/mach/vmalloc.h
index 9ce9b6e8ad23..4da31e997efe 100644
--- a/arch/arm/mach-omap2/include/mach/vmalloc.h
+++ b/arch/arm/mach-omap2/include/mach/vmalloc.h
@@ -17,4 +17,4 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x38000000) 20#define VMALLOC_END 0xf8000000
diff --git a/arch/arm/mach-pnx4008/include/mach/vmalloc.h b/arch/arm/mach-pnx4008/include/mach/vmalloc.h
index 2ad398378aed..31b65ee07b0b 100644
--- a/arch/arm/mach-pnx4008/include/mach/vmalloc.h
+++ b/arch/arm/mach-pnx4008/include/mach/vmalloc.h
@@ -17,4 +17,4 @@
17 * The vmalloc() routines leaves a hole of 4kB between each vmalloced 17 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
18 * area for the same reason. ;) 18 * area for the same reason. ;)
19 */ 19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 20#define VMALLOC_END 0xd0000000
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 7aefb9074852..dd235ecc9d6c 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -8,19 +8,16 @@ config ARCH_LUBBOCK
8 bool "Intel DBPXA250 Development Platform (aka Lubbock)" 8 bool "Intel DBPXA250 Development Platform (aka Lubbock)"
9 select PXA25x 9 select PXA25x
10 select SA1111 10 select SA1111
11 select PXA_HAVE_BOARD_IRQS
12 11
13config MACH_MAINSTONE 12config MACH_MAINSTONE
14 bool "Intel HCDDBBVA0 Development Platform (aka Mainstone)" 13 bool "Intel HCDDBBVA0 Development Platform (aka Mainstone)"
15 select PXA27x 14 select PXA27x
16 select HAVE_PWM 15 select HAVE_PWM
17 select PXA_HAVE_BOARD_IRQS
18 16
19config MACH_ZYLONITE 17config MACH_ZYLONITE
20 bool 18 bool
21 select PXA3xx 19 select PXA3xx
22 select HAVE_PWM 20 select HAVE_PWM
23 select PXA_HAVE_BOARD_IRQS
24 21
25config MACH_ZYLONITE300 22config MACH_ZYLONITE300
26 bool "PXA3xx Development Platform (aka Zylonite) PXA300/310" 23 bool "PXA3xx Development Platform (aka Zylonite) PXA300/310"
@@ -44,6 +41,10 @@ config MACH_TAVOREVB
44 select PXA3xx 41 select PXA3xx
45 select CPU_PXA930 42 select CPU_PXA930
46 43
44config MACH_TAVOREVB3
45 bool "PXA95x Development Platform (aka TavorEVB III)"
46 select CPU_PXA950
47
47config MACH_SAAR 48config MACH_SAAR
48 bool "PXA930 Handheld Platform (aka SAAR)" 49 bool "PXA930 Handheld Platform (aka SAAR)"
49 select PXA3xx 50 select PXA3xx
@@ -61,7 +62,6 @@ config ARCH_VIPER
61 select ISA 62 select ISA
62 select I2C_GPIO 63 select I2C_GPIO
63 select HAVE_PWM 64 select HAVE_PWM
64 select PXA_HAVE_BOARD_IRQS
65 select PXA_HAVE_ISA_IRQS 65 select PXA_HAVE_ISA_IRQS
66 select ARCOM_PCMCIA 66 select ARCOM_PCMCIA
67 67
@@ -69,7 +69,6 @@ config MACH_ARCOM_ZEUS
69 bool "Arcom/Eurotech ZEUS SBC" 69 bool "Arcom/Eurotech ZEUS SBC"
70 select PXA27x 70 select PXA27x
71 select ISA 71 select ISA
72 select PXA_HAVE_BOARD_IRQS
73 select PXA_HAVE_ISA_IRQS 72 select PXA_HAVE_ISA_IRQS
74 select ARCOM_PCMCIA 73 select ARCOM_PCMCIA
75 74
@@ -77,7 +76,6 @@ config MACH_BALLOON3
77 bool "Balloon 3 board" 76 bool "Balloon 3 board"
78 select PXA27x 77 select PXA27x
79 select IWMMXT 78 select IWMMXT
80 select PXA_HAVE_BOARD_IRQS
81 79
82config MACH_CSB726 80config MACH_CSB726
83 bool "Enable Cogent CSB726 System On a Module" 81 bool "Enable Cogent CSB726 System On a Module"
@@ -140,13 +138,11 @@ config MACH_INTELMOTE2
140 bool "Intel Mote 2 Platform" 138 bool "Intel Mote 2 Platform"
141 select PXA27x 139 select PXA27x
142 select IWMMXT 140 select IWMMXT
143 select PXA_HAVE_BOARD_IRQS
144 141
145config MACH_STARGATE2 142config MACH_STARGATE2
146 bool "Intel Stargate 2 Platform" 143 bool "Intel Stargate 2 Platform"
147 select PXA27x 144 select PXA27x
148 select IWMMXT 145 select IWMMXT
149 select PXA_HAVE_BOARD_IRQS
150 146
151config MACH_XCEP 147config MACH_XCEP
152 bool "Iskratel Electronics XCEP" 148 bool "Iskratel Electronics XCEP"
@@ -206,13 +202,11 @@ config MACH_LOGICPD_PXA270
206 bool "LogicPD PXA270 Card Engine Development Platform" 202 bool "LogicPD PXA270 Card Engine Development Platform"
207 select PXA27x 203 select PXA27x
208 select HAVE_PWM 204 select HAVE_PWM
209 select PXA_HAVE_BOARD_IRQS
210 205
211config MACH_PCM027 206config MACH_PCM027
212 bool "Phytec phyCORE-PXA270 CPU module (PCM-027)" 207 bool "Phytec phyCORE-PXA270 CPU module (PCM-027)"
213 select PXA27x 208 select PXA27x
214 select IWMMXT 209 select IWMMXT
215 select PXA_HAVE_BOARD_IRQS
216 210
217config MACH_PCM990_BASEBOARD 211config MACH_PCM990_BASEBOARD
218 bool "PHYTEC PCM-990 development board" 212 bool "PHYTEC PCM-990 development board"
@@ -247,7 +241,6 @@ config MACH_COLIBRI_PXA270_INCOME
247 depends on MACH_COLIBRI 241 depends on MACH_COLIBRI
248 select PXA27x 242 select PXA27x
249 select HAVE_PWM 243 select HAVE_PWM
250 select PXA_HAVE_BOARD_IRQS
251 244
252config MACH_COLIBRI300 245config MACH_COLIBRI300
253 bool "Toradex Colibri PXA300/310" 246 bool "Toradex Colibri PXA300/310"
@@ -274,7 +267,6 @@ config MACH_H4700
274 select PXA27x 267 select PXA27x
275 select IWMMXT 268 select IWMMXT
276 select HAVE_PWM 269 select HAVE_PWM
277 select PXA_HAVE_BOARD_IRQS
278 270
279config MACH_H5000 271config MACH_H5000
280 bool "HP iPAQ h5000" 272 bool "HP iPAQ h5000"
@@ -289,7 +281,6 @@ config MACH_MAGICIAN
289 select PXA27x 281 select PXA27x
290 select IWMMXT 282 select IWMMXT
291 select HAVE_PWM 283 select HAVE_PWM
292 select PXA_HAVE_BOARD_IRQS
293 284
294config MACH_MIOA701 285config MACH_MIOA701
295 bool "Mitac Mio A701 Support" 286 bool "Mitac Mio A701 Support"
@@ -307,7 +298,6 @@ config PXA_EZX
307 select PXA27x 298 select PXA27x
308 select IWMMXT 299 select IWMMXT
309 select HAVE_PWM 300 select HAVE_PWM
310 select PXA_HAVE_BOARD_IRQS
311 301
312config MACH_EZX_A780 302config MACH_EZX_A780
313 bool "Motorola EZX A780" 303 bool "Motorola EZX A780"
@@ -478,7 +468,6 @@ config MACH_POODLE
478 depends on PXA_SHARPSL 468 depends on PXA_SHARPSL
479 select PXA25x 469 select PXA25x
480 select SHARP_LOCOMO 470 select SHARP_LOCOMO
481 select PXA_HAVE_BOARD_IRQS
482 471
483config MACH_CORGI 472config MACH_CORGI
484 bool "Enable Sharp SL-C700 (Corgi) Support" 473 bool "Enable Sharp SL-C700 (Corgi) Support"
@@ -523,7 +512,6 @@ config MACH_TOSA
523 bool "Enable Sharp SL-6000x (Tosa) Support" 512 bool "Enable Sharp SL-6000x (Tosa) Support"
524 depends on PXA_SHARPSL 513 depends on PXA_SHARPSL
525 select PXA25x 514 select PXA25x
526 select PXA_HAVE_BOARD_IRQS
527 515
528config TOSA_BT 516config TOSA_BT
529 tristate "Control the state of built-in bluetooth chip on Sharp SL-6000" 517 tristate "Control the state of built-in bluetooth chip on Sharp SL-6000"
@@ -552,7 +540,6 @@ config MACH_ICONTROL
552config ARCH_PXA_ESERIES 540config ARCH_PXA_ESERIES
553 bool "PXA based Toshiba e-series PDAs" 541 bool "PXA based Toshiba e-series PDAs"
554 select PXA25x 542 select PXA25x
555 select PXA_HAVE_BOARD_IRQS
556 543
557config MACH_E330 544config MACH_E330
558 bool "Toshiba e330" 545 bool "Toshiba e330"
@@ -606,7 +593,6 @@ config MACH_ZIPIT2
606 bool "Zipit Z2 Handheld" 593 bool "Zipit Z2 Handheld"
607 select PXA27x 594 select PXA27x
608 select HAVE_PWM 595 select HAVE_PWM
609 select PXA_HAVE_BOARD_IRQS
610 596
611endmenu 597endmenu
612 598
@@ -643,6 +629,7 @@ config CPU_PXA300
643config CPU_PXA310 629config CPU_PXA310
644 bool 630 bool
645 select CPU_PXA300 631 select CPU_PXA300
632 select PXA310_ULPI if USB_ULPI
646 help 633 help
647 PXA310 (codename Monahans-LV) 634 PXA310 (codename Monahans-LV)
648 635
@@ -692,10 +679,10 @@ config SHARPSL_PM_MAX1111
692 select HWMON 679 select HWMON
693 select SENSORS_MAX1111 680 select SENSORS_MAX1111
694 681
695config PXA_HAVE_BOARD_IRQS 682config PXA_HAVE_ISA_IRQS
696 bool 683 bool
697 684
698config PXA_HAVE_ISA_IRQS 685config PXA310_ULPI
699 bool 686 bool
700 687
701endif 688endif
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 85c7fb324dbb..e2f89c2c6f49 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -18,7 +18,7 @@ endif
18# SoC-specific code 18# SoC-specific code
19obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa2xx.o pxa25x.o 19obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa2xx.o pxa25x.o
20obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa2xx.o pxa27x.o 20obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa2xx.o pxa27x.o
21obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o 21obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o pxa3xx-ulpi.o
22obj-$(CONFIG_CPU_PXA300) += pxa300.o 22obj-$(CONFIG_CPU_PXA300) += pxa300.o
23obj-$(CONFIG_CPU_PXA320) += pxa320.o 23obj-$(CONFIG_CPU_PXA320) += pxa320.o
24obj-$(CONFIG_CPU_PXA930) += pxa930.o 24obj-$(CONFIG_CPU_PXA930) += pxa930.o
@@ -32,6 +32,7 @@ obj-$(CONFIG_MACH_ZYLONITE300) += zylonite.o zylonite_pxa300.o
32obj-$(CONFIG_MACH_ZYLONITE320) += zylonite.o zylonite_pxa320.o 32obj-$(CONFIG_MACH_ZYLONITE320) += zylonite.o zylonite_pxa320.o
33obj-$(CONFIG_MACH_LITTLETON) += littleton.o 33obj-$(CONFIG_MACH_LITTLETON) += littleton.o
34obj-$(CONFIG_MACH_TAVOREVB) += tavorevb.o 34obj-$(CONFIG_MACH_TAVOREVB) += tavorevb.o
35obj-$(CONFIG_MACH_TAVOREVB3) += tavorevb3.o
35obj-$(CONFIG_MACH_SAAR) += saar.o 36obj-$(CONFIG_MACH_SAAR) += saar.o
36 37
37# 3rd Party Dev Platforms 38# 3rd Party Dev Platforms
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 9041340fee1d..79d0f6cf53d7 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -68,42 +68,6 @@ static unsigned long balloon3_pin_config[] __initdata = {
68 68
69 /* Reset, configured as GPIO wakeup source */ 69 /* Reset, configured as GPIO wakeup source */
70 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, 70 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
71
72 /* LEDs */
73 GPIO9_GPIO, /* NAND activity LED */
74 GPIO10_GPIO, /* Heartbeat LED */
75
76 /* AC97 */
77 GPIO28_AC97_BITCLK,
78 GPIO29_AC97_SDATA_IN_0,
79 GPIO30_AC97_SDATA_OUT,
80 GPIO31_AC97_SYNC,
81 GPIO113_AC97_nRESET,
82 GPIO95_GPIO,
83
84 /* MMC */
85 GPIO32_MMC_CLK,
86 GPIO92_MMC_DAT_0,
87 GPIO109_MMC_DAT_1,
88 GPIO110_MMC_DAT_2,
89 GPIO111_MMC_DAT_3,
90 GPIO112_MMC_CMD,
91
92 /* USB Host */
93 GPIO88_USBH1_PWR,
94 GPIO89_USBH1_PEN,
95
96 /* PC Card */
97 GPIO48_nPOE,
98 GPIO49_nPWE,
99 GPIO50_nPIOR,
100 GPIO51_nPIOW,
101 GPIO85_nPCE_1,
102 GPIO54_nPCE_2,
103 GPIO79_PSKTSEL,
104 GPIO55_nPREG,
105 GPIO56_nPWAIT,
106 GPIO57_nIOIS16,
107}; 71};
108 72
109/****************************************************************************** 73/******************************************************************************
@@ -132,6 +96,34 @@ int __init parse_balloon3_features(char *arg)
132early_param("balloon3_features", parse_balloon3_features); 96early_param("balloon3_features", parse_balloon3_features);
133 97
134/****************************************************************************** 98/******************************************************************************
99 * Compact Flash slot
100 ******************************************************************************/
101#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
102static unsigned long balloon3_cf_pin_config[] __initdata = {
103 GPIO48_nPOE,
104 GPIO49_nPWE,
105 GPIO50_nPIOR,
106 GPIO51_nPIOW,
107 GPIO85_nPCE_1,
108 GPIO54_nPCE_2,
109 GPIO79_PSKTSEL,
110 GPIO55_nPREG,
111 GPIO56_nPWAIT,
112 GPIO57_nIOIS16,
113};
114
115static void __init balloon3_cf_init(void)
116{
117 if (!balloon3_has(BALLOON3_FEATURE_CF))
118 return;
119
120 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_cf_pin_config));
121}
122#else
123static inline void balloon3_cf_init(void) {}
124#endif
125
126/******************************************************************************
135 * NOR Flash 127 * NOR Flash
136 ******************************************************************************/ 128 ******************************************************************************/
137#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) 129#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
@@ -179,6 +171,15 @@ static inline void balloon3_nor_init(void) {}
179 ******************************************************************************/ 171 ******************************************************************************/
180#if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ 172#if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
181 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) 173 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
174static unsigned long balloon3_ac97_pin_config[] __initdata = {
175 GPIO28_AC97_BITCLK,
176 GPIO29_AC97_SDATA_IN_0,
177 GPIO30_AC97_SDATA_OUT,
178 GPIO31_AC97_SYNC,
179 GPIO113_AC97_nRESET,
180 GPIO95_GPIO,
181};
182
182static struct ucb1400_pdata vpac270_ucb1400_pdata = { 183static struct ucb1400_pdata vpac270_ucb1400_pdata = {
183 .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ), 184 .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ),
184}; 185};
@@ -197,6 +198,7 @@ static void __init balloon3_ts_init(void)
197 if (!balloon3_has(BALLOON3_FEATURE_AUDIO)) 198 if (!balloon3_has(BALLOON3_FEATURE_AUDIO))
198 return; 199 return;
199 200
201 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config));
200 pxa_set_ac97_info(NULL); 202 pxa_set_ac97_info(NULL);
201 platform_device_register(&balloon3_ucb1400_device); 203 platform_device_register(&balloon3_ucb1400_device);
202} 204}
@@ -208,6 +210,11 @@ static inline void balloon3_ts_init(void) {}
208 * Framebuffer 210 * Framebuffer
209 ******************************************************************************/ 211 ******************************************************************************/
210#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) 212#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
213static unsigned long balloon3_lcd_pin_config[] __initdata = {
214 GPIOxx_LCD_TFT_16BPP,
215 GPIO99_GPIO,
216};
217
211static struct pxafb_mode_info balloon3_lcd_modes[] = { 218static struct pxafb_mode_info balloon3_lcd_modes[] = {
212 { 219 {
213 .pixclock = 38000, 220 .pixclock = 38000,
@@ -242,6 +249,8 @@ static void __init balloon3_lcd_init(void)
242 if (!balloon3_has(BALLOON3_FEATURE_TOPPOLY)) 249 if (!balloon3_has(BALLOON3_FEATURE_TOPPOLY))
243 return; 250 return;
244 251
252 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_lcd_pin_config));
253
245 ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON"); 254 ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON");
246 if (ret) { 255 if (ret) {
247 pr_err("Requesting BKL-ON GPIO failed!\n"); 256 pr_err("Requesting BKL-ON GPIO failed!\n");
@@ -271,6 +280,15 @@ static inline void balloon3_lcd_init(void) {}
271 * SD/MMC card controller 280 * SD/MMC card controller
272 ******************************************************************************/ 281 ******************************************************************************/
273#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) 282#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
283static unsigned long balloon3_mmc_pin_config[] __initdata = {
284 GPIO32_MMC_CLK,
285 GPIO92_MMC_DAT_0,
286 GPIO109_MMC_DAT_1,
287 GPIO110_MMC_DAT_2,
288 GPIO111_MMC_DAT_3,
289 GPIO112_MMC_CMD,
290};
291
274static struct pxamci_platform_data balloon3_mci_platform_data = { 292static struct pxamci_platform_data balloon3_mci_platform_data = {
275 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 293 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
276 .gpio_card_detect = -1, 294 .gpio_card_detect = -1,
@@ -281,6 +299,7 @@ static struct pxamci_platform_data balloon3_mci_platform_data = {
281 299
282static void __init balloon3_mmc_init(void) 300static void __init balloon3_mmc_init(void)
283{ 301{
302 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_mmc_pin_config));
284 pxa_set_mci_info(&balloon3_mci_platform_data); 303 pxa_set_mci_info(&balloon3_mci_platform_data);
285} 304}
286#else 305#else
@@ -339,6 +358,11 @@ static inline void balloon3_irda_init(void) {}
339 * USB Host 358 * USB Host
340 ******************************************************************************/ 359 ******************************************************************************/
341#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 360#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
361static unsigned long balloon3_uhc_pin_config[] __initdata = {
362 GPIO88_USBH1_PWR,
363 GPIO89_USBH1_PEN,
364};
365
342static struct pxaohci_platform_data balloon3_ohci_info = { 366static struct pxaohci_platform_data balloon3_ohci_info = {
343 .port_mode = PMM_PERPORT_MODE, 367 .port_mode = PMM_PERPORT_MODE,
344 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW, 368 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
@@ -348,6 +372,7 @@ static void __init balloon3_uhc_init(void)
348{ 372{
349 if (!balloon3_has(BALLOON3_FEATURE_OHCI)) 373 if (!balloon3_has(BALLOON3_FEATURE_OHCI))
350 return; 374 return;
375 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_uhc_pin_config));
351 pxa_set_ohci_info(&balloon3_ohci_info); 376 pxa_set_ohci_info(&balloon3_ohci_info);
352} 377}
353#else 378#else
@@ -358,6 +383,11 @@ static inline void balloon3_uhc_init(void) {}
358 * LEDs 383 * LEDs
359 ******************************************************************************/ 384 ******************************************************************************/
360#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 385#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
386static unsigned long balloon3_led_pin_config[] __initdata = {
387 GPIO9_GPIO, /* NAND activity LED */
388 GPIO10_GPIO, /* Heartbeat LED */
389};
390
361struct gpio_led balloon3_gpio_leds[] = { 391struct gpio_led balloon3_gpio_leds[] = {
362 { 392 {
363 .name = "balloon3:green:idle", 393 .name = "balloon3:green:idle",
@@ -436,6 +466,7 @@ static struct platform_device balloon3_pcf_leds = {
436 466
437static void __init balloon3_leds_init(void) 467static void __init balloon3_leds_init(void)
438{ 468{
469 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_led_pin_config));
439 platform_device_register(&balloon3_leds); 470 platform_device_register(&balloon3_leds);
440 platform_device_register(&balloon3_pcf_leds); 471 platform_device_register(&balloon3_pcf_leds);
441} 472}
@@ -757,6 +788,7 @@ static void __init balloon3_init(void)
757 balloon3_ts_init(); 788 balloon3_ts_init();
758 balloon3_udc_init(); 789 balloon3_udc_init();
759 balloon3_uhc_init(); 790 balloon3_uhc_init();
791 balloon3_cf_init();
760} 792}
761 793
762static struct map_desc balloon3_io_desc[] __initdata = { 794static struct map_desc balloon3_io_desc[] __initdata = {
@@ -779,6 +811,7 @@ MACHINE_START(BALLOON3, "Balloon3")
779 .phys_io = 0x40000000, 811 .phys_io = 0x40000000,
780 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 812 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
781 .map_io = balloon3_map_io, 813 .map_io = balloon3_map_io,
814 .nr_irqs = BALLOON3_NR_IRQS,
782 .init_irq = balloon3_init_irq, 815 .init_irq = balloon3_init_irq,
783 .timer = &pxa_timer, 816 .timer = &pxa_timer,
784 .init_machine = balloon3_init, 817 .init_machine = balloon3_init,
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index bff6e78f033d..ad40e7b141e0 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -33,6 +33,9 @@
33extern void cmx255_init(void); 33extern void cmx255_init(void);
34extern void cmx270_init(void); 34extern void cmx270_init(void);
35 35
36/* reserve IRQs for IT8152 */
37#define CMX2XX_NR_IRQS (IRQ_BOARD_START + 40)
38
36/* virtual addresses for statically mapped regions */ 39/* virtual addresses for statically mapped regions */
37#define CMX2XX_VIRT_BASE (0xe8000000) 40#define CMX2XX_VIRT_BASE (0xe8000000)
38#define CMX2XX_IT8152_VIRT (CMX2XX_VIRT_BASE) 41#define CMX2XX_IT8152_VIRT (CMX2XX_VIRT_BASE)
@@ -514,6 +517,7 @@ MACHINE_START(ARMCORE, "Compulab CM-X2XX")
514 .phys_io = 0x40000000, 517 .phys_io = 0x40000000,
515 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 518 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
516 .map_io = cmx2xx_map_io, 519 .map_io = cmx2xx_map_io,
520 .nr_irqs = CMX2XX_NR_IRQS,
517 .init_irq = cmx2xx_init_irq, 521 .init_irq = cmx2xx_init_irq,
518 .timer = &pxa_timer, 522 .timer = &pxa_timer,
519 .init_machine = cmx2xx_init, 523 .init_machine = cmx2xx_init,
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index c70e6c2f4e7c..8e0b5622b277 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/clk.h>
22 23
23#include <linux/gpio.h> 24#include <linux/gpio.h>
24#include <linux/dm9000.h> 25#include <linux/dm9000.h>
@@ -50,6 +51,7 @@
50#include <plat/i2c.h> 51#include <plat/i2c.h>
51#include <plat/pxa3xx_nand.h> 52#include <plat/pxa3xx_nand.h>
52#include <mach/audio.h> 53#include <mach/audio.h>
54#include <mach/pxa3xx-u2d.h>
53 55
54#include <asm/mach/map.h> 56#include <asm/mach/map.h>
55 57
@@ -68,6 +70,8 @@
68#define GPIO97_RTC_RD (97) 70#define GPIO97_RTC_RD (97)
69#define GPIO98_RTC_IO (98) 71#define GPIO98_RTC_IO (98)
70 72
73#define GPIO_ULPI_PHY_RST (127)
74
71static mfp_cfg_t cm_x3xx_mfp_cfg[] __initdata = { 75static mfp_cfg_t cm_x3xx_mfp_cfg[] __initdata = {
72 /* LCD */ 76 /* LCD */
73 GPIO54_LCD_LDD_0, 77 GPIO54_LCD_LDD_0,
@@ -472,6 +476,78 @@ static void __init cm_x300_init_mmc(void)
472static inline void cm_x300_init_mmc(void) {} 476static inline void cm_x300_init_mmc(void) {}
473#endif 477#endif
474 478
479#if defined(CONFIG_PXA310_ULPI)
480static struct clk *pout_clk;
481
482static int cm_x300_ulpi_phy_reset(void)
483{
484 int err;
485
486 /* reset the PHY */
487 err = gpio_request(GPIO_ULPI_PHY_RST, "ulpi reset");
488 if (err) {
489 pr_err("%s: failed to request ULPI reset GPIO: %d\n",
490 __func__, err);
491 return err;
492 }
493
494 gpio_direction_output(GPIO_ULPI_PHY_RST, 0);
495 msleep(10);
496 gpio_set_value(GPIO_ULPI_PHY_RST, 1);
497 msleep(10);
498
499 gpio_free(GPIO_ULPI_PHY_RST);
500
501 return 0;
502}
503
504static inline int cm_x300_u2d_init(struct device *dev)
505{
506 int err = 0;
507
508 if (cpu_is_pxa310()) {
509 /* CLK_POUT is connected to the ULPI PHY */
510 pout_clk = clk_get(NULL, "CLK_POUT");
511 if (IS_ERR(pout_clk)) {
512 err = PTR_ERR(pout_clk);
513 pr_err("%s: failed to get CLK_POUT: %d\n",
514 __func__, err);
515 return err;
516 }
517 clk_enable(pout_clk);
518
519 err = cm_x300_ulpi_phy_reset();
520 if (err) {
521 clk_disable(pout_clk);
522 clk_put(pout_clk);
523 }
524 }
525
526 return err;
527}
528
529static void cm_x300_u2d_exit(struct device *dev)
530{
531 if (cpu_is_pxa310()) {
532 clk_disable(pout_clk);
533 clk_put(pout_clk);
534 }
535}
536
537static struct pxa3xx_u2d_platform_data cm_x300_u2d_platform_data = {
538 .ulpi_mode = ULPI_SER_6PIN,
539 .init = cm_x300_u2d_init,
540 .exit = cm_x300_u2d_exit,
541};
542
543static void cm_x300_init_u2d(void)
544{
545 pxa3xx_set_u2d_info(&cm_x300_u2d_platform_data);
546}
547#else
548static inline void cm_x300_init_u2d(void) {}
549#endif
550
475#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 551#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
476static int cm_x300_ohci_init(struct device *dev) 552static int cm_x300_ohci_init(struct device *dev)
477{ 553{
@@ -754,6 +830,7 @@ static void __init cm_x300_init(void)
754 cm_x300_init_da9030(); 830 cm_x300_init_da9030();
755 cm_x300_init_dm9000(); 831 cm_x300_init_dm9000();
756 cm_x300_init_lcd(); 832 cm_x300_init_lcd();
833 cm_x300_init_u2d();
757 cm_x300_init_ohci(); 834 cm_x300_init_ohci();
758 cm_x300_init_mmc(); 835 cm_x300_init_mmc();
759 cm_x300_init_nand(); 836 cm_x300_init_nand();
diff --git a/arch/arm/mach-pxa/cpufreq-pxa3xx.c b/arch/arm/mach-pxa/cpufreq-pxa3xx.c
index 0a0d0fe99220..88fbec05ec50 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa3xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa3xx.c
@@ -159,7 +159,7 @@ static int pxa3xx_cpufreq_verify(struct cpufreq_policy *policy)
159 159
160static unsigned int pxa3xx_cpufreq_get(unsigned int cpu) 160static unsigned int pxa3xx_cpufreq_get(unsigned int cpu)
161{ 161{
162 return get_clk_frequency_khz(0); 162 return pxa3xx_get_clk_frequency_khz(0);
163} 163}
164 164
165static int pxa3xx_cpufreq_set(struct cpufreq_policy *policy, 165static int pxa3xx_cpufreq_set(struct cpufreq_policy *policy,
@@ -212,7 +212,8 @@ static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy)
212 policy->cpuinfo.min_freq = 104000; 212 policy->cpuinfo.min_freq = 104000;
213 policy->cpuinfo.max_freq = (cpu_is_pxa320()) ? 806000 : 624000; 213 policy->cpuinfo.max_freq = (cpu_is_pxa320()) ? 806000 : 624000;
214 policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */ 214 policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */
215 policy->cur = policy->min = policy->max = get_clk_frequency_khz(0); 215 policy->max = pxa3xx_get_clk_frequency_khz(0);
216 policy->cur = policy->min = policy->max;
216 217
217 if (cpu_is_pxa300() || cpu_is_pxa310()) 218 if (cpu_is_pxa300() || cpu_is_pxa310())
218 ret = setup_freqs_table(policy, ARRAY_AND_SIZE(pxa300_freqs)); 219 ret = setup_freqs_table(policy, ARRAY_AND_SIZE(pxa300_freqs));
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 65447dc736c2..08b410343870 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -6,11 +6,12 @@
6 6
7#include <asm/pmu.h> 7#include <asm/pmu.h>
8#include <mach/udc.h> 8#include <mach/udc.h>
9#include <mach/pxa3xx-u2d.h>
9#include <mach/pxafb.h> 10#include <mach/pxafb.h>
10#include <mach/mmc.h> 11#include <mach/mmc.h>
11#include <mach/irda.h> 12#include <mach/irda.h>
12#include <mach/ohci.h> 13#include <mach/ohci.h>
13#include <mach/pxa27x_keypad.h> 14#include <plat/pxa27x_keypad.h>
14#include <mach/pxa2xx_spi.h> 15#include <mach/pxa2xx_spi.h>
15#include <mach/camera.h> 16#include <mach/camera.h>
16#include <mach/audio.h> 17#include <mach/audio.h>
@@ -134,6 +135,33 @@ struct platform_device pxa27x_device_udc = {
134 } 135 }
135}; 136};
136 137
138#ifdef CONFIG_PXA3xx
139static struct resource pxa3xx_u2d_resources[] = {
140 [0] = {
141 .start = 0x54100000,
142 .end = 0x54100fff,
143 .flags = IORESOURCE_MEM,
144 },
145 [1] = {
146 .start = IRQ_USB2,
147 .end = IRQ_USB2,
148 .flags = IORESOURCE_IRQ,
149 },
150};
151
152struct platform_device pxa3xx_device_u2d = {
153 .name = "pxa3xx-u2d",
154 .id = -1,
155 .resource = pxa3xx_u2d_resources,
156 .num_resources = ARRAY_SIZE(pxa3xx_u2d_resources),
157};
158
159void __init pxa3xx_set_u2d_info(struct pxa3xx_u2d_platform_data *info)
160{
161 pxa_register_device(&pxa3xx_device_u2d, info);
162}
163#endif /* CONFIG_PXA3xx */
164
137static struct resource pxafb_resources[] = { 165static struct resource pxafb_resources[] = {
138 [0] = { 166 [0] = {
139 .start = 0x44000000, 167 .start = 0x44000000,
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 50353ea49ba4..715e8bd02e24 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -4,6 +4,7 @@ extern struct platform_device pxa3xx_device_mci2;
4extern struct platform_device pxa3xx_device_mci3; 4extern struct platform_device pxa3xx_device_mci3;
5extern struct platform_device pxa25x_device_udc; 5extern struct platform_device pxa25x_device_udc;
6extern struct platform_device pxa27x_device_udc; 6extern struct platform_device pxa27x_device_udc;
7extern struct platform_device pxa3xx_device_u2d;
7extern struct platform_device pxa_device_fb; 8extern struct platform_device pxa_device_fb;
8extern struct platform_device pxa_device_ffuart; 9extern struct platform_device pxa_device_ffuart;
9extern struct platform_device pxa_device_btuart; 10extern struct platform_device pxa_device_btuart;
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 0517c17978f3..51286a738a3b 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -43,7 +43,7 @@
43#include <mach/pxafb.h> 43#include <mach/pxafb.h>
44#include <mach/ohci.h> 44#include <mach/ohci.h>
45#include <mach/mmc.h> 45#include <mach/mmc.h>
46#include <mach/pxa27x_keypad.h> 46#include <plat/pxa27x_keypad.h>
47#include <plat/i2c.h> 47#include <plat/i2c.h>
48#include <mach/camera.h> 48#include <mach/camera.h>
49#include <mach/pxa2xx_spi.h> 49#include <mach/pxa2xx_spi.h>
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index 349212a1cbd3..4971ce119501 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -29,6 +29,7 @@
29 29
30#include <mach/pxa25x.h> 30#include <mach/pxa25x.h>
31#include <mach/eseries-gpio.h> 31#include <mach/eseries-gpio.h>
32#include <mach/eseries-irq.h>
32#include <mach/audio.h> 33#include <mach/audio.h>
33#include <mach/pxafb.h> 34#include <mach/pxafb.h>
34#include <mach/udc.h> 35#include <mach/udc.h>
@@ -183,6 +184,7 @@ MACHINE_START(E330, "Toshiba e330")
183 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 184 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
184 .boot_params = 0xa0000100, 185 .boot_params = 0xa0000100,
185 .map_io = pxa_map_io, 186 .map_io = pxa_map_io,
187 .nr_irqs = ESERIES_NR_IRQS,
186 .init_irq = pxa25x_init_irq, 188 .init_irq = pxa25x_init_irq,
187 .fixup = eseries_fixup, 189 .fixup = eseries_fixup,
188 .init_machine = e330_init, 190 .init_machine = e330_init,
@@ -233,6 +235,7 @@ MACHINE_START(E350, "Toshiba e350")
233 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 235 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
234 .boot_params = 0xa0000100, 236 .boot_params = 0xa0000100,
235 .map_io = pxa_map_io, 237 .map_io = pxa_map_io,
238 .nr_irqs = ESERIES_NR_IRQS,
236 .init_irq = pxa25x_init_irq, 239 .init_irq = pxa25x_init_irq,
237 .fixup = eseries_fixup, 240 .fixup = eseries_fixup,
238 .init_machine = e350_init, 241 .init_machine = e350_init,
@@ -356,6 +359,7 @@ MACHINE_START(E400, "Toshiba e400")
356 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 359 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
357 .boot_params = 0xa0000100, 360 .boot_params = 0xa0000100,
358 .map_io = pxa_map_io, 361 .map_io = pxa_map_io,
362 .nr_irqs = ESERIES_NR_IRQS,
359 .init_irq = pxa25x_init_irq, 363 .init_irq = pxa25x_init_irq,
360 .fixup = eseries_fixup, 364 .fixup = eseries_fixup,
361 .init_machine = e400_init, 365 .init_machine = e400_init,
@@ -545,6 +549,7 @@ MACHINE_START(E740, "Toshiba e740")
545 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 549 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
546 .boot_params = 0xa0000100, 550 .boot_params = 0xa0000100,
547 .map_io = pxa_map_io, 551 .map_io = pxa_map_io,
552 .nr_irqs = ESERIES_NR_IRQS,
548 .init_irq = pxa25x_init_irq, 553 .init_irq = pxa25x_init_irq,
549 .fixup = eseries_fixup, 554 .fixup = eseries_fixup,
550 .init_machine = e740_init, 555 .init_machine = e740_init,
@@ -737,6 +742,7 @@ MACHINE_START(E750, "Toshiba e750")
737 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 742 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
738 .boot_params = 0xa0000100, 743 .boot_params = 0xa0000100,
739 .map_io = pxa_map_io, 744 .map_io = pxa_map_io,
745 .nr_irqs = ESERIES_NR_IRQS,
740 .init_irq = pxa25x_init_irq, 746 .init_irq = pxa25x_init_irq,
741 .fixup = eseries_fixup, 747 .fixup = eseries_fixup,
742 .init_machine = e750_init, 748 .init_machine = e750_init,
@@ -933,6 +939,7 @@ MACHINE_START(E800, "Toshiba e800")
933 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 939 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
934 .boot_params = 0xa0000100, 940 .boot_params = 0xa0000100,
935 .map_io = pxa_map_io, 941 .map_io = pxa_map_io,
942 .nr_irqs = ESERIES_NR_IRQS,
936 .init_irq = pxa25x_init_irq, 943 .init_irq = pxa25x_init_irq,
937 .fixup = eseries_fixup, 944 .fixup = eseries_fixup,
938 .init_machine = e800_init, 945 .init_machine = e800_init,
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index 626c82b13970..f997e8455557 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -32,12 +32,14 @@
32#include <mach/ohci.h> 32#include <mach/ohci.h>
33#include <plat/i2c.h> 33#include <plat/i2c.h>
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/pxa27x_keypad.h> 35#include <plat/pxa27x_keypad.h>
36#include <mach/camera.h> 36#include <mach/camera.h>
37 37
38#include "devices.h" 38#include "devices.h"
39#include "generic.h" 39#include "generic.h"
40 40
41#define EZX_NR_IRQS (IRQ_BOARD_START + 24)
42
41#define GPIO12_A780_FLIP_LID 12 43#define GPIO12_A780_FLIP_LID 12
42#define GPIO15_A1200_FLIP_LID 15 44#define GPIO15_A1200_FLIP_LID 15
43#define GPIO15_A910_FLIP_LID 15 45#define GPIO15_A910_FLIP_LID 15
@@ -800,6 +802,7 @@ MACHINE_START(EZX_A780, "Motorola EZX A780")
800 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 802 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
801 .boot_params = 0xa0000100, 803 .boot_params = 0xa0000100,
802 .map_io = pxa_map_io, 804 .map_io = pxa_map_io,
805 .nr_irqs = EZX_NR_IRQS,
803 .init_irq = pxa27x_init_irq, 806 .init_irq = pxa27x_init_irq,
804 .timer = &pxa_timer, 807 .timer = &pxa_timer,
805 .init_machine = a780_init, 808 .init_machine = a780_init,
@@ -866,6 +869,7 @@ MACHINE_START(EZX_E680, "Motorola EZX E680")
866 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 869 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
867 .boot_params = 0xa0000100, 870 .boot_params = 0xa0000100,
868 .map_io = pxa_map_io, 871 .map_io = pxa_map_io,
872 .nr_irqs = EZX_NR_IRQS,
869 .init_irq = pxa27x_init_irq, 873 .init_irq = pxa27x_init_irq,
870 .timer = &pxa_timer, 874 .timer = &pxa_timer,
871 .init_machine = e680_init, 875 .init_machine = e680_init,
@@ -932,6 +936,7 @@ MACHINE_START(EZX_A1200, "Motorola EZX A1200")
932 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 936 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
933 .boot_params = 0xa0000100, 937 .boot_params = 0xa0000100,
934 .map_io = pxa_map_io, 938 .map_io = pxa_map_io,
939 .nr_irqs = EZX_NR_IRQS,
935 .init_irq = pxa27x_init_irq, 940 .init_irq = pxa27x_init_irq,
936 .timer = &pxa_timer, 941 .timer = &pxa_timer,
937 .init_machine = a1200_init, 942 .init_machine = a1200_init,
@@ -1124,6 +1129,7 @@ MACHINE_START(EZX_A910, "Motorola EZX A910")
1124 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 1129 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1125 .boot_params = 0xa0000100, 1130 .boot_params = 0xa0000100,
1126 .map_io = pxa_map_io, 1131 .map_io = pxa_map_io,
1132 .nr_irqs = EZX_NR_IRQS,
1127 .init_irq = pxa27x_init_irq, 1133 .init_irq = pxa27x_init_irq,
1128 .timer = &pxa_timer, 1134 .timer = &pxa_timer,
1129 .init_machine = a910_init, 1135 .init_machine = a910_init,
@@ -1190,6 +1196,7 @@ MACHINE_START(EZX_E6, "Motorola EZX E6")
1190 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 1196 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1191 .boot_params = 0xa0000100, 1197 .boot_params = 0xa0000100,
1192 .map_io = pxa_map_io, 1198 .map_io = pxa_map_io,
1199 .nr_irqs = EZX_NR_IRQS,
1193 .init_irq = pxa27x_init_irq, 1200 .init_irq = pxa27x_init_irq,
1194 .timer = &pxa_timer, 1201 .timer = &pxa_timer,
1195 .init_machine = e6_init, 1202 .init_machine = e6_init,
@@ -1230,6 +1237,7 @@ MACHINE_START(EZX_E2, "Motorola EZX E2")
1230 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 1237 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1231 .boot_params = 0xa0000100, 1238 .boot_params = 0xa0000100,
1232 .map_io = pxa_map_io, 1239 .map_io = pxa_map_io,
1240 .nr_irqs = EZX_NR_IRQS,
1233 .init_irq = pxa27x_init_irq, 1241 .init_irq = pxa27x_init_irq,
1234 .timer = &pxa_timer, 1242 .timer = &pxa_timer,
1235 .init_machine = e2_init, 1243 .init_machine = e2_init,
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index baabb3ce088e..6451e9c3a93f 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -66,8 +66,7 @@ unsigned int get_clk_frequency_khz(int info)
66 return pxa25x_get_clk_frequency_khz(info); 66 return pxa25x_get_clk_frequency_khz(info);
67 else if (cpu_is_pxa27x()) 67 else if (cpu_is_pxa27x())
68 return pxa27x_get_clk_frequency_khz(info); 68 return pxa27x_get_clk_frequency_khz(info);
69 else 69 return 0;
70 return pxa3xx_get_clk_frequency_khz(info);
71} 70}
72EXPORT_SYMBOL(get_clk_frequency_khz); 71EXPORT_SYMBOL(get_clk_frequency_khz);
73 72
@@ -80,8 +79,7 @@ unsigned int get_memclk_frequency_10khz(void)
80 return pxa25x_get_memclk_frequency_10khz(); 79 return pxa25x_get_memclk_frequency_10khz();
81 else if (cpu_is_pxa27x()) 80 else if (cpu_is_pxa27x())
82 return pxa27x_get_memclk_frequency_10khz(); 81 return pxa27x_get_memclk_frequency_10khz();
83 else 82 return 0;
84 return pxa3xx_get_memclk_frequency_10khz();
85} 83}
86EXPORT_SYMBOL(get_memclk_frequency_10khz); 84EXPORT_SYMBOL(get_memclk_frequency_10khz);
87 85
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index c6305c5b8a72..4b1ad2769ed7 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -54,11 +54,9 @@ static inline void pxa2xx_clear_reset_status(unsigned int mask) {}
54 54
55#ifdef CONFIG_PXA3xx 55#ifdef CONFIG_PXA3xx
56extern unsigned pxa3xx_get_clk_frequency_khz(int); 56extern unsigned pxa3xx_get_clk_frequency_khz(int);
57extern unsigned pxa3xx_get_memclk_frequency_10khz(void);
58extern void pxa3xx_clear_reset_status(unsigned int); 57extern void pxa3xx_clear_reset_status(unsigned int);
59#else 58#else
60#define pxa3xx_get_clk_frequency_khz(x) (0) 59#define pxa3xx_get_clk_frequency_khz(x) (0)
61#define pxa3xx_get_memclk_frequency_10khz() (0)
62static inline void pxa3xx_clear_reset_status(unsigned int mask) {} 60static inline void pxa3xx_clear_reset_status(unsigned int mask) {}
63#endif 61#endif
64 62
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 848c861dd23f..10104f16e6e4 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -874,6 +874,7 @@ MACHINE_START(H4700, "HP iPAQ HX4700")
874 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 874 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
875 .boot_params = 0xa0000100, 875 .boot_params = 0xa0000100,
876 .map_io = pxa_map_io, 876 .map_io = pxa_map_io,
877 .nr_irqs = HX4700_NR_IRQS,
877 .init_irq = pxa27x_init_irq, 878 .init_irq = pxa27x_init_irq,
878 .init_machine = hx4700_init, 879 .init_machine = hx4700_init,
879 .timer = &pxa_timer, 880 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
index eec92e6fd7cf..561562b4360b 100644
--- a/arch/arm/mach-pxa/include/mach/balloon3.h
+++ b/arch/arm/mach-pxa/include/mach/balloon3.h
@@ -174,6 +174,8 @@ enum balloon3_features {
174#define BALLOON3_CODEC_IRQ IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ) 174#define BALLOON3_CODEC_IRQ IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ)
175#define BALLOON3_S0_CD_IRQ IRQ_GPIO(BALLOON3_GPIO_S0_CD) 175#define BALLOON3_S0_CD_IRQ IRQ_GPIO(BALLOON3_GPIO_S0_CD)
176 176
177#define BALLOON3_NR_IRQS (IRQ_BOARD_START + 4)
178
177extern int balloon3_has(enum balloon3_features feature); 179extern int balloon3_has(enum balloon3_features feature);
178 180
179#endif 181#endif
diff --git a/arch/arm/mach-pxa/include/mach/eseries-irq.h b/arch/arm/mach-pxa/include/mach/eseries-irq.h
index f2a93d5e31d3..de292b269c63 100644
--- a/arch/arm/mach-pxa/include/mach/eseries-irq.h
+++ b/arch/arm/mach-pxa/include/mach/eseries-irq.h
@@ -25,3 +25,4 @@
25#define TMIO_SD_IRQ IRQ_TMIO(1) 25#define TMIO_SD_IRQ IRQ_TMIO(1)
26#define TMIO_USB_IRQ IRQ_TMIO(2) 26#define TMIO_USB_IRQ IRQ_TMIO(2)
27 27
28#define ESERIES_NR_IRQS (IRQ_BOARD_START + 16)
diff --git a/arch/arm/mach-pxa/include/mach/hx4700.h b/arch/arm/mach-pxa/include/mach/hx4700.h
index 9eaeed1f87f1..37408449ec25 100644
--- a/arch/arm/mach-pxa/include/mach/hx4700.h
+++ b/arch/arm/mach-pxa/include/mach/hx4700.h
@@ -17,6 +17,7 @@
17 17
18#define HX4700_ASIC3_GPIO_BASE NR_BUILTIN_GPIO 18#define HX4700_ASIC3_GPIO_BASE NR_BUILTIN_GPIO
19#define HX4700_EGPIO_BASE (HX4700_ASIC3_GPIO_BASE + ASIC3_NUM_GPIOS) 19#define HX4700_EGPIO_BASE (HX4700_ASIC3_GPIO_BASE + ASIC3_NUM_GPIOS)
20#define HX4700_NR_IRQS (IRQ_BOARD_START + 70)
20 21
21/* 22/*
22 * PXA GPIOs 23 * PXA GPIOs
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index ffc8314520f2..d372caa75dc7 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -117,48 +117,12 @@
117/* 117/*
118 * The following interrupts are for board specific purposes. Since 118 * The following interrupts are for board specific purposes. Since
119 * the kernel can only run on one machine at a time, we can re-use 119 * the kernel can only run on one machine at a time, we can re-use
120 * these. There will be 16 IRQs by default. If it is not enough, 120 * these.
121 * IRQ_BOARD_END is allowed be customized for each board, but keep 121 * By default, no board IRQ is reserved. It should be finished in
122 * the numbers within sensible limits and in descending order, so 122 * custom board since sparse IRQ is already enabled.
123 * when multiple config options are selected, the maximum will be
124 * used.
125 */ 123 */
126#define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM) 124#define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM)
127 125
128#if defined(CONFIG_MACH_H4700)
129#define IRQ_BOARD_END (IRQ_BOARD_START + 70)
130#elif defined(CONFIG_MACH_ZYLONITE)
131#define IRQ_BOARD_END (IRQ_BOARD_START + 32)
132#elif defined(CONFIG_PXA_EZX)
133#define IRQ_BOARD_END (IRQ_BOARD_START + 23)
134#else
135#define IRQ_BOARD_END (IRQ_BOARD_START + 16)
136#endif
137
138/*
139 * Figure out the MAX IRQ number.
140 *
141 * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1.
142 * If we have an LoCoMo, the max IRQ is IRQ_LOCOMO_SPI_TEND+1
143 * Otherwise, we have the standard IRQs only.
144 */
145#ifdef CONFIG_SA1111
146#define NR_IRQS (IRQ_BOARD_END + 55)
147#elif defined(CONFIG_PXA_HAVE_BOARD_IRQS)
148#define NR_IRQS (IRQ_BOARD_END)
149#else
150#define NR_IRQS (IRQ_BOARD_START) 126#define NR_IRQS (IRQ_BOARD_START)
151#endif
152
153/* add IT8152 IRQs beyond BOARD_END */
154#ifdef CONFIG_PCI_HOST_ITE8152
155#define IT8152_LAST_IRQ (IRQ_BOARD_END + 40)
156
157#if NR_IRQS < (IT8152_LAST_IRQ+1)
158#undef NR_IRQS
159#define NR_IRQS (IT8152_LAST_IRQ+1)
160#endif
161
162#endif /* CONFIG_PCI_HOST_ITE8152 */
163 127
164#endif /* __ASM_MACH_IRQS_H */ 128#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-pxa/include/mach/littleton.h b/arch/arm/mach-pxa/include/mach/littleton.h
index 6c9b21c51322..2a5726c15e0e 100644
--- a/arch/arm/mach-pxa/include/mach/littleton.h
+++ b/arch/arm/mach-pxa/include/mach/littleton.h
@@ -10,4 +10,6 @@
10#define EXT0_GPIO_BASE (NR_BUILTIN_GPIO) 10#define EXT0_GPIO_BASE (NR_BUILTIN_GPIO)
11#define EXT0_GPIO(x) (EXT0_GPIO_BASE + (x)) 11#define EXT0_GPIO(x) (EXT0_GPIO_BASE + (x))
12 12
13#define LITTLETON_NR_IRQS (IRQ_BOARD_START + 8)
14
13#endif /* __ASM_ARCH_LITTLETON_H */ 15#endif /* __ASM_ARCH_LITTLETON_H */
diff --git a/arch/arm/mach-pxa/include/mach/lpd270.h b/arch/arm/mach-pxa/include/mach/lpd270.h
index 0e6440c81683..cd070092b6eb 100644
--- a/arch/arm/mach-pxa/include/mach/lpd270.h
+++ b/arch/arm/mach-pxa/include/mach/lpd270.h
@@ -38,5 +38,6 @@
38#define LPD270_USBC_IRQ LPD270_IRQ(2) 38#define LPD270_USBC_IRQ LPD270_IRQ(2)
39#define LPD270_ETHERNET_IRQ LPD270_IRQ(3) 39#define LPD270_ETHERNET_IRQ LPD270_IRQ(3)
40#define LPD270_AC97_IRQ LPD270_IRQ(4) 40#define LPD270_AC97_IRQ LPD270_IRQ(4)
41#define LPD270_NR_IRQS (IRQ_BOARD_START + 5)
41 42
42#endif 43#endif
diff --git a/arch/arm/mach-pxa/include/mach/lubbock.h b/arch/arm/mach-pxa/include/mach/lubbock.h
index a0d4247f08fc..2a086e8373eb 100644
--- a/arch/arm/mach-pxa/include/mach/lubbock.h
+++ b/arch/arm/mach-pxa/include/mach/lubbock.h
@@ -45,6 +45,9 @@
45#define LUBBOCK_USB_DISC_IRQ LUBBOCK_IRQ(6) /* usb disconnect */ 45#define LUBBOCK_USB_DISC_IRQ LUBBOCK_IRQ(6) /* usb disconnect */
46#define LUBBOCK_LAST_IRQ LUBBOCK_IRQ(6) 46#define LUBBOCK_LAST_IRQ LUBBOCK_IRQ(6)
47 47
48#define LUBBOCK_SA1111_IRQ_BASE (IRQ_BOARD_START + 16)
49#define LUBBOCK_NR_IRQS (IRQ_BOARD_START + 16 + 55)
50
48#ifndef __ASSEMBLY__ 51#ifndef __ASSEMBLY__
49extern void lubbock_set_misc_wr(unsigned int mask, unsigned int set); 52extern void lubbock_set_misc_wr(unsigned int mask, unsigned int set);
50#endif 53#endif
diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index 20ef37d4a9a7..0a2efcf7947c 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -71,6 +71,8 @@
71#define IRQ_MAGICIAN_BT (IRQ_BOARD_START + 2) 71#define IRQ_MAGICIAN_BT (IRQ_BOARD_START + 2)
72#define IRQ_MAGICIAN_VBUS (IRQ_BOARD_START + 3) 72#define IRQ_MAGICIAN_VBUS (IRQ_BOARD_START + 3)
73 73
74#define MAGICIAN_NR_IRQS (IRQ_BOARD_START + 8)
75
74/* 76/*
75 * CPLD EGPIOs 77 * CPLD EGPIOs
76 */ 78 */
diff --git a/arch/arm/mach-pxa/include/mach/mainstone.h b/arch/arm/mach-pxa/include/mach/mainstone.h
index 86e623abd64d..4c2d11cd824d 100644
--- a/arch/arm/mach-pxa/include/mach/mainstone.h
+++ b/arch/arm/mach-pxa/include/mach/mainstone.h
@@ -134,4 +134,6 @@
134#define MAINSTONE_S1_STSCHG_IRQ MAINSTONE_IRQ(14) 134#define MAINSTONE_S1_STSCHG_IRQ MAINSTONE_IRQ(14)
135#define MAINSTONE_S1_IRQ MAINSTONE_IRQ(15) 135#define MAINSTONE_S1_IRQ MAINSTONE_IRQ(15)
136 136
137#define MAINSTONE_NR_IRQS (IRQ_BOARD_START + 16)
138
137#endif 139#endif
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
index 0d119d3b9221..04f7c97044f3 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
@@ -69,6 +69,7 @@
69#define nBE0_GPIO_60 MFP_CFG(nBE0, AF0) 69#define nBE0_GPIO_60 MFP_CFG(nBE0, AF0)
70#define nBE1_GPIO_61 MFP_CFG(nBE1, AF0) 70#define nBE1_GPIO_61 MFP_CFG(nBE1, AF0)
71#define RDY_GPIO_62 MFP_CFG(RDY, AF0) 71#define RDY_GPIO_62 MFP_CFG(RDY, AF0)
72#define PMIC_INT_GPIO83 MFP_CFG_LPM(PMIC_INT, AF0, PULL_HIGH)
72 73
73/* Chip Select */ 74/* Chip Select */
74#define DF_nCS0_nCS2 MFP_CFG_LPM(DF_nCS0, AF3, PULL_HIGH) 75#define DF_nCS0_nCS2 MFP_CFG_LPM(DF_nCS0, AF3, PULL_HIGH)
@@ -92,6 +93,9 @@
92#define GPIO63_CI2C_SCL MFP_CFG_LPM(GPIO63, AF4, PULL_HIGH) 93#define GPIO63_CI2C_SCL MFP_CFG_LPM(GPIO63, AF4, PULL_HIGH)
93#define GPIO64_CI2C_SDA MFP_CFG_LPM(GPIO64, AF4, PULL_HIGH) 94#define GPIO64_CI2C_SDA MFP_CFG_LPM(GPIO64, AF4, PULL_HIGH)
94 95
96#define GPIO73_CI2C_SCL MFP_CFG_LPM(GPIO73, AF1, PULL_HIGH)
97#define GPIO74_CI2C_SDA MFP_CFG_LPM(GPIO74, AF1, PULL_HIGH)
98
95#define GPIO77_CI2C_SCL MFP_CFG_LPM(GPIO77, AF2, PULL_HIGH) 99#define GPIO77_CI2C_SCL MFP_CFG_LPM(GPIO77, AF2, PULL_HIGH)
96#define GPIO78_CI2C_SDA MFP_CFG_LPM(GPIO78, AF2, PULL_HIGH) 100#define GPIO78_CI2C_SDA MFP_CFG_LPM(GPIO78, AF2, PULL_HIGH)
97 101
@@ -345,6 +349,9 @@
345#define GPIO69_UART1_CTS MFP_CFG(GPIO69, AF2) 349#define GPIO69_UART1_CTS MFP_CFG(GPIO69, AF2)
346#define GPIO70_UART1_RTS MFP_CFG(GPIO70, AF2) 350#define GPIO70_UART1_RTS MFP_CFG(GPIO70, AF2)
347 351
352#define GPIO53_UART1_TXD MFP_CFG(GPIO53, AF2)
353#define GPIO54_UART1_RXD MFP_CFG(GPIO54, AF2)
354
348/* UART2 - BTUART */ 355/* UART2 - BTUART */
349#define GPIO91_UART2_RXD MFP_CFG(GPIO91, AF1) 356#define GPIO91_UART2_RXD MFP_CFG(GPIO91, AF1)
350#define GPIO92_UART2_TXD MFP_CFG(GPIO92, AF1) 357#define GPIO92_UART2_TXD MFP_CFG(GPIO92, AF1)
diff --git a/arch/arm/mach-pxa/include/mach/pcm027.h b/arch/arm/mach-pxa/include/mach/pcm027.h
index 04083263167e..4bac588478a8 100644
--- a/arch/arm/mach-pxa/include/mach/pcm027.h
+++ b/arch/arm/mach-pxa/include/mach/pcm027.h
@@ -30,6 +30,8 @@
30#define PCM027_MMCDET_IRQ PCM027_IRQ(2) 30#define PCM027_MMCDET_IRQ PCM027_IRQ(2)
31#define PCM027_PM_5V_IRQ PCM027_IRQ(3) 31#define PCM027_PM_5V_IRQ PCM027_IRQ(3)
32 32
33#define PCM027_NR_IRQS (IRQ_BOARD_START + 32)
34
33/* I2C RTC */ 35/* I2C RTC */
34#define PCM027_RTC_IRQ_GPIO 0 36#define PCM027_RTC_IRQ_GPIO 0
35#define PCM027_RTC_IRQ IRQ_GPIO(PCM027_RTC_IRQ_GPIO) 37#define PCM027_RTC_IRQ IRQ_GPIO(PCM027_RTC_IRQ_GPIO)
diff --git a/arch/arm/mach-pxa/include/mach/poodle.h b/arch/arm/mach-pxa/include/mach/poodle.h
index 0b3e6d051c64..83d1cfd00fc9 100644
--- a/arch/arm/mach-pxa/include/mach/poodle.h
+++ b/arch/arm/mach-pxa/include/mach/poodle.h
@@ -85,6 +85,8 @@
85#define POODLE_LOCOMO_GPIO_232VCC_ON LOCOMO_GPIO(12) 85#define POODLE_LOCOMO_GPIO_232VCC_ON LOCOMO_GPIO(12)
86#define POODLE_LOCOMO_GPIO_JK_B LOCOMO_GPIO(13) 86#define POODLE_LOCOMO_GPIO_JK_B LOCOMO_GPIO(13)
87 87
88#define POODLE_NR_IRQS (IRQ_BOARD_START + 4) /* 4 for LoCoMo */
89
88extern struct platform_device poodle_locomo_device; 90extern struct platform_device poodle_locomo_device;
89 91
90#endif /* __ASM_ARCH_POODLE_H */ 92#endif /* __ASM_ARCH_POODLE_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx-u2d.h b/arch/arm/mach-pxa/include/mach/pxa3xx-u2d.h
new file mode 100644
index 000000000000..9d82cb65ea56
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx-u2d.h
@@ -0,0 +1,35 @@
1/*
2 * PXA3xx U2D header
3 *
4 * Copyright (C) 2010 CompuLab Ltd.
5 *
6 * Igor Grinberg <grinberg@compulab.co.il>
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 __PXA310_U2D__
13#define __PXA310_U2D__
14
15#include <linux/usb/ulpi.h>
16
17struct pxa3xx_u2d_platform_data {
18
19#define ULPI_SER_6PIN (1 << 0)
20#define ULPI_SER_3PIN (1 << 1)
21 unsigned int ulpi_mode;
22
23 int (*init)(struct device *);
24 void (*exit)(struct device *);
25};
26
27
28/* Start PXA3xx U2D host */
29int pxa3xx_u2d_start_hc(struct usb_bus *host);
30/* Stop PXA3xx U2D host */
31void pxa3xx_u2d_stop_hc(struct usb_bus *host);
32
33extern void pxa3xx_set_u2d_info(struct pxa3xx_u2d_platform_data *info);
34
35#endif /* __PXA310_U2D__ */
diff --git a/arch/arm/mach-pxa/include/mach/tosa.h b/arch/arm/mach-pxa/include/mach/tosa.h
index 1bbd1f2e4beb..1272c4b56ceb 100644
--- a/arch/arm/mach-pxa/include/mach/tosa.h
+++ b/arch/arm/mach-pxa/include/mach/tosa.h
@@ -20,6 +20,7 @@
20/* Jacket Scoop */ 20/* Jacket Scoop */
21#define TOSA_SCOOP_PHYS (PXA_CS5_PHYS + 0x00800000) 21#define TOSA_SCOOP_PHYS (PXA_CS5_PHYS + 0x00800000)
22 22
23#define TOSA_NR_IRQS (IRQ_BOARD_START + TC6393XB_NR_IRQS)
23/* 24/*
24 * SCOOP2 internal GPIOs 25 * SCOOP2 internal GPIOs
25 */ 26 */
diff --git a/arch/arm/mach-pxa/include/mach/zeus.h b/arch/arm/mach-pxa/include/mach/zeus.h
index 6e119976003e..faa408ab7ad7 100644
--- a/arch/arm/mach-pxa/include/mach/zeus.h
+++ b/arch/arm/mach-pxa/include/mach/zeus.h
@@ -15,6 +15,8 @@
15#ifndef _MACH_ZEUS_H 15#ifndef _MACH_ZEUS_H
16#define _MACH_ZEUS_H 16#define _MACH_ZEUS_H
17 17
18#define ZEUS_NR_IRQS (IRQ_BOARD_START + 48)
19
18/* Physical addresses */ 20/* Physical addresses */
19#define ZEUS_FLASH_PHYS PXA_CS0_PHYS 21#define ZEUS_FLASH_PHYS PXA_CS0_PHYS
20#define ZEUS_ETH0_PHYS PXA_CS1_PHYS 22#define ZEUS_ETH0_PHYS PXA_CS1_PHYS
diff --git a/arch/arm/mach-pxa/include/mach/zylonite.h b/arch/arm/mach-pxa/include/mach/zylonite.h
index 9edf645368d6..ea24998b923c 100644
--- a/arch/arm/mach-pxa/include/mach/zylonite.h
+++ b/arch/arm/mach-pxa/include/mach/zylonite.h
@@ -5,6 +5,8 @@
5 5
6#define EXT_GPIO(x) (128 + (x)) 6#define EXT_GPIO(x) (128 + (x))
7 7
8#define ZYLONITE_NR_IRQS (IRQ_BOARD_START + 32)
9
8/* the following variables are processor specific and initialized 10/* the following variables are processor specific and initialized
9 * by the corresponding zylonite_pxa3xx_init() 11 * by the corresponding zylonite_pxa3xx_init()
10 */ 12 */
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index 9b9046185b00..eb5850624c1d 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -43,7 +43,7 @@
43#include <mach/pxafb.h> 43#include <mach/pxafb.h>
44#include <mach/mmc.h> 44#include <mach/mmc.h>
45#include <mach/pxa2xx_spi.h> 45#include <mach/pxa2xx_spi.h>
46#include <mach/pxa27x_keypad.h> 46#include <plat/pxa27x_keypad.h>
47#include <mach/littleton.h> 47#include <mach/littleton.h>
48#include <plat/i2c.h> 48#include <plat/i2c.h>
49#include <plat/pxa3xx_nand.h> 49#include <plat/pxa3xx_nand.h>
@@ -441,6 +441,7 @@ MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleto
441 .boot_params = 0xa0000100, 441 .boot_params = 0xa0000100,
442 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 442 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
443 .map_io = pxa_map_io, 443 .map_io = pxa_map_io,
444 .nr_irqs = LITTLETON_NR_IRQS,
444 .init_irq = pxa3xx_init_irq, 445 .init_irq = pxa3xx_init_irq,
445 .timer = &pxa_timer, 446 .timer = &pxa_timer,
446 .init_machine = littleton_init, 447 .init_machine = littleton_init,
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index d279507fc748..fc9502ef4024 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -509,6 +509,7 @@ MACHINE_START(LOGICPD_PXA270, "LogicPD PXA270 Card Engine")
509 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 509 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
510 .boot_params = 0xa0000100, 510 .boot_params = 0xa0000100,
511 .map_io = lpd270_map_io, 511 .map_io = lpd270_map_io,
512 .nr_irqs = LPD270_NR_IRQS,
512 .init_irq = lpd270_init_irq, 513 .init_irq = lpd270_init_irq,
513 .timer = &pxa_timer, 514 .timer = &pxa_timer,
514 .init_machine = lpd270_init, 515 .init_machine = lpd270_init,
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 330c3282856e..1956c23093d1 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -229,7 +229,7 @@ static struct resource sa1111_resources[] = {
229}; 229};
230 230
231static struct sa1111_platform_data sa1111_info = { 231static struct sa1111_platform_data sa1111_info = {
232 .irq_base = IRQ_BOARD_END, 232 .irq_base = LUBBOCK_SA1111_IRQ_BASE,
233}; 233};
234 234
235static struct platform_device sa1111_device = { 235static struct platform_device sa1111_device = {
@@ -560,6 +560,7 @@ MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
560 .phys_io = 0x40000000, 560 .phys_io = 0x40000000,
561 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 561 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
562 .map_io = lubbock_map_io, 562 .map_io = lubbock_map_io,
563 .nr_irqs = LUBBOCK_NR_IRQS,
563 .init_irq = lubbock_init_irq, 564 .init_irq = lubbock_init_irq,
564 .timer = &pxa_timer, 565 .timer = &pxa_timer,
565 .init_machine = lubbock_init, 566 .init_machine = lubbock_init,
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index e81dd0c8e40d..42a0c2b41281 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -768,6 +768,7 @@ MACHINE_START(MAGICIAN, "HTC Magician")
768 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 768 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
769 .boot_params = 0xa0000100, 769 .boot_params = 0xa0000100,
770 .map_io = pxa_map_io, 770 .map_io = pxa_map_io,
771 .nr_irqs = MAGICIAN_NR_IRQS,
771 .init_irq = pxa27x_init_irq, 772 .init_irq = pxa27x_init_irq,
772 .init_machine = magician_init, 773 .init_machine = magician_init,
773 .timer = &pxa_timer, 774 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 5543c64da9ef..8b710024601c 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -50,7 +50,7 @@
50#include <mach/mmc.h> 50#include <mach/mmc.h>
51#include <mach/irda.h> 51#include <mach/irda.h>
52#include <mach/ohci.h> 52#include <mach/ohci.h>
53#include <mach/pxa27x_keypad.h> 53#include <plat/pxa27x_keypad.h>
54 54
55#include "generic.h" 55#include "generic.h"
56#include "devices.h" 56#include "devices.h"
@@ -628,6 +628,7 @@ MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
628 .boot_params = 0xa0000100, /* BLOB boot parameter setting */ 628 .boot_params = 0xa0000100, /* BLOB boot parameter setting */
629 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 629 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
630 .map_io = mainstone_map_io, 630 .map_io = mainstone_map_io,
631 .nr_irqs = MAINSTONE_NR_IRQS,
631 .init_irq = mainstone_init_irq, 632 .init_irq = mainstone_init_irq,
632 .timer = &pxa_timer, 633 .timer = &pxa_timer,
633 .init_machine = mainstone_init, 634 .init_machine = mainstone_init,
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index dc66942ef9ab..ffb3f5a8a086 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -45,7 +45,7 @@
45 45
46#include <mach/pxa27x.h> 46#include <mach/pxa27x.h>
47#include <mach/regs-rtc.h> 47#include <mach/regs-rtc.h>
48#include <mach/pxa27x_keypad.h> 48#include <plat/pxa27x_keypad.h>
49#include <mach/pxafb.h> 49#include <mach/pxafb.h>
50#include <mach/mmc.h> 50#include <mach/mmc.h>
51#include <mach/udc.h> 51#include <mach/udc.h>
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 91038eeafe44..3ff0c4a1ca4c 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -39,7 +39,7 @@
39#include <mach/mmc.h> 39#include <mach/mmc.h>
40#include <mach/pxafb.h> 40#include <mach/pxafb.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <mach/pxa27x_keypad.h> 42#include <plat/pxa27x_keypad.h>
43#include <mach/palmasoc.h> 43#include <mach/palmasoc.h>
44#include <mach/palm27x.h> 44#include <mach/palm27x.h>
45 45
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 1c281995f658..5b9f766d1468 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -39,7 +39,7 @@
39#include <mach/mmc.h> 39#include <mach/mmc.h>
40#include <mach/pxafb.h> 40#include <mach/pxafb.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <mach/pxa27x_keypad.h> 42#include <plat/pxa27x_keypad.h>
43#include <mach/udc.h> 43#include <mach/udc.h>
44#include <mach/palmasoc.h> 44#include <mach/palmasoc.h>
45#include <mach/palm27x.h> 45#include <mach/palm27x.h>
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index 52defd5e42e5..f685a600a181 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -39,7 +39,7 @@
39#include <mach/mmc.h> 39#include <mach/mmc.h>
40#include <mach/pxafb.h> 40#include <mach/pxafb.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <mach/pxa27x_keypad.h> 42#include <plat/pxa27x_keypad.h>
43#include <mach/udc.h> 43#include <mach/udc.h>
44#include <mach/ohci.h> 44#include <mach/ohci.h>
45#include <mach/pxa2xx-regs.h> 45#include <mach/pxa2xx-regs.h>
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 144dc2b6911f..89a37922b9d3 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -43,7 +43,7 @@
43#include <mach/mmc.h> 43#include <mach/mmc.h>
44#include <mach/pxafb.h> 44#include <mach/pxafb.h>
45#include <mach/irda.h> 45#include <mach/irda.h>
46#include <mach/pxa27x_keypad.h> 46#include <plat/pxa27x_keypad.h>
47#include <mach/udc.h> 47#include <mach/udc.h>
48#include <mach/palmasoc.h> 48#include <mach/palmasoc.h>
49#include <mach/palm27x.h> 49#include <mach/palm27x.h>
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 87e4b1044e0b..38f4425bfc95 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -41,7 +41,7 @@
41#include <mach/mmc.h> 41#include <mach/mmc.h>
42#include <mach/pxafb.h> 42#include <mach/pxafb.h>
43#include <mach/irda.h> 43#include <mach/irda.h>
44#include <mach/pxa27x_keypad.h> 44#include <plat/pxa27x_keypad.h>
45#include <mach/udc.h> 45#include <mach/udc.h>
46#include <mach/palmasoc.h> 46#include <mach/palmasoc.h>
47#include <mach/palm27x.h> 47#include <mach/palm27x.h>
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c
index 2190af066470..90b08ba8ad1a 100644
--- a/arch/arm/mach-pxa/pcm027.c
+++ b/arch/arm/mach-pxa/pcm027.c
@@ -262,6 +262,7 @@ MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270")
262 .phys_io = 0x40000000, 262 .phys_io = 0x40000000,
263 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 263 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
264 .map_io = pcm027_map_io, 264 .map_io = pcm027_map_io,
265 .nr_irqs = PCM027_NR_IRQS,
265 .init_irq = pxa27x_init_irq, 266 .init_irq = pxa27x_init_irq,
266 .timer = &pxa_timer, 267 .timer = &pxa_timer,
267 .init_machine = pcm027_init, 268 .init_machine = pcm027_init,
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 55e8fcde0141..c04e025cd790 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -469,6 +469,7 @@ MACHINE_START(POODLE, "SHARP Poodle")
469 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 469 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
470 .fixup = fixup_poodle, 470 .fixup = fixup_poodle,
471 .map_io = pxa_map_io, 471 .map_io = pxa_map_io,
472 .nr_irqs = POODLE_NR_IRQS, /* 4 for LoCoMo */
472 .init_irq = pxa25x_init_irq, 473 .init_irq = pxa25x_init_irq,
473 .timer = &pxa_timer, 474 .timer = &pxa_timer,
474 .init_machine = poodle_init, 475 .init_machine = poodle_init,
diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
new file mode 100644
index 000000000000..ce7168b233e2
--- /dev/null
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -0,0 +1,400 @@
1/*
2 * linux/arch/arm/mach-pxa/pxa3xx-ulpi.c
3 *
4 * code specific to pxa3xx aka Monahans
5 *
6 * Copyright (C) 2010 CompuLab Ltd.
7 *
8 * 2010-13-07: Igor Grinberg <grinberg@compulab.co.il>
9 * initial version: pxa310 USB Host mode support
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/slab.h>
19#include <linux/device.h>
20#include <linux/platform_device.h>
21#include <linux/err.h>
22#include <linux/io.h>
23#include <linux/delay.h>
24#include <linux/clk.h>
25#include <linux/usb.h>
26#include <linux/usb/otg.h>
27
28#include <mach/hardware.h>
29#include <mach/regs-u2d.h>
30#include <mach/pxa3xx-u2d.h>
31
32struct pxa3xx_u2d_ulpi {
33 struct clk *clk;
34 void __iomem *mmio_base;
35
36 struct otg_transceiver *otg;
37 unsigned int ulpi_mode;
38};
39
40static struct pxa3xx_u2d_ulpi *u2d;
41
42static inline u32 u2d_readl(u32 reg)
43{
44 return __raw_readl(u2d->mmio_base + reg);
45}
46
47static inline void u2d_writel(u32 reg, u32 val)
48{
49 __raw_writel(val, u2d->mmio_base + reg);
50}
51
52#if defined(CONFIG_PXA310_ULPI)
53enum u2d_ulpi_phy_mode {
54 SYNCH = 0,
55 CARKIT = (1 << 0),
56 SER_3PIN = (1 << 1),
57 SER_6PIN = (1 << 2),
58 LOWPOWER = (1 << 3),
59};
60
61static inline enum u2d_ulpi_phy_mode pxa310_ulpi_get_phymode(void)
62{
63 return (u2d_readl(U2DOTGUSR) >> 28) & 0xF;
64}
65
66static int pxa310_ulpi_poll(void)
67{
68 int timeout = 50000;
69
70 while (timeout--) {
71 if (!(u2d_readl(U2DOTGUCR) & U2DOTGUCR_RUN))
72 return 0;
73
74 cpu_relax();
75 }
76
77 pr_warning("%s: ULPI access timed out!\n", __func__);
78
79 return -ETIMEDOUT;
80}
81
82static int pxa310_ulpi_read(struct otg_transceiver *otg, u32 reg)
83{
84 int err;
85
86 if (pxa310_ulpi_get_phymode() != SYNCH) {
87 pr_warning("%s: PHY is not in SYNCH mode!\n", __func__);
88 return -EBUSY;
89 }
90
91 u2d_writel(U2DOTGUCR, U2DOTGUCR_RUN | U2DOTGUCR_RNW | (reg << 16));
92 msleep(5);
93
94 err = pxa310_ulpi_poll();
95 if (err)
96 return err;
97
98 return u2d_readl(U2DOTGUCR) & U2DOTGUCR_RDATA;
99}
100
101static int pxa310_ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg)
102{
103 if (pxa310_ulpi_get_phymode() != SYNCH) {
104 pr_warning("%s: PHY is not in SYNCH mode!\n", __func__);
105 return -EBUSY;
106 }
107
108 u2d_writel(U2DOTGUCR, U2DOTGUCR_RUN | (reg << 16) | (val << 8));
109 msleep(5);
110
111 return pxa310_ulpi_poll();
112}
113
114struct otg_io_access_ops pxa310_ulpi_access_ops = {
115 .read = pxa310_ulpi_read,
116 .write = pxa310_ulpi_write,
117};
118
119static void pxa310_otg_transceiver_rtsm(void)
120{
121 u32 u2dotgcr;
122
123 /* put PHY to sync mode */
124 u2dotgcr = u2d_readl(U2DOTGCR);
125 u2dotgcr |= U2DOTGCR_RTSM | U2DOTGCR_UTMID;
126 u2d_writel(U2DOTGCR, u2dotgcr);
127 msleep(10);
128
129 /* setup OTG sync mode */
130 u2dotgcr = u2d_readl(U2DOTGCR);
131 u2dotgcr |= U2DOTGCR_ULAF;
132 u2dotgcr &= ~(U2DOTGCR_SMAF | U2DOTGCR_CKAF);
133 u2d_writel(U2DOTGCR, u2dotgcr);
134}
135
136static int pxa310_start_otg_host_transcvr(struct usb_bus *host)
137{
138 int err;
139
140 pxa310_otg_transceiver_rtsm();
141
142 err = otg_init(u2d->otg);
143 if (err) {
144 pr_err("OTG transceiver init failed");
145 return err;
146 }
147
148 err = otg_set_vbus(u2d->otg, 1);
149 if (err) {
150 pr_err("OTG transceiver VBUS set failed");
151 return err;
152 }
153
154 err = otg_set_host(u2d->otg, host);
155 if (err)
156 pr_err("OTG transceiver Host mode set failed");
157
158 return err;
159}
160
161static int pxa310_start_otg_hc(struct usb_bus *host)
162{
163 u32 u2dotgcr;
164 int err;
165
166 /* disable USB device controller */
167 u2d_writel(U2DCR, u2d_readl(U2DCR) & ~U2DCR_UDE);
168 u2d_writel(U2DOTGCR, u2d_readl(U2DOTGCR) | U2DOTGCR_UTMID);
169 u2d_writel(U2DOTGICR, u2d_readl(U2DOTGICR) & ~0x37F7F);
170
171 err = pxa310_start_otg_host_transcvr(host);
172 if (err)
173 return err;
174
175 /* set xceiver mode */
176 if (u2d->ulpi_mode & ULPI_IC_6PIN_SERIAL)
177 u2d_writel(U2DP3CR, u2d_readl(U2DP3CR) & ~U2DP3CR_P2SS);
178 else if (u2d->ulpi_mode & ULPI_IC_3PIN_SERIAL)
179 u2d_writel(U2DP3CR, u2d_readl(U2DP3CR) | U2DP3CR_P2SS);
180
181 /* start OTG host controller */
182 u2dotgcr = u2d_readl(U2DOTGCR) | U2DOTGCR_SMAF;
183 u2d_writel(U2DOTGCR, u2dotgcr & ~(U2DOTGCR_ULAF | U2DOTGCR_CKAF));
184
185 return 0;
186}
187
188static void pxa310_stop_otg_hc(void)
189{
190 pxa310_otg_transceiver_rtsm();
191
192 otg_set_host(u2d->otg, NULL);
193 otg_set_vbus(u2d->otg, 0);
194 otg_shutdown(u2d->otg);
195}
196
197static void pxa310_u2d_setup_otg_hc(void)
198{
199 u32 u2dotgcr;
200
201 u2dotgcr = u2d_readl(U2DOTGCR);
202 u2dotgcr |= U2DOTGCR_ULAF | U2DOTGCR_UTMID;
203 u2dotgcr &= ~(U2DOTGCR_SMAF | U2DOTGCR_CKAF);
204 u2d_writel(U2DOTGCR, u2dotgcr);
205 msleep(5);
206 u2d_writel(U2DOTGCR, u2dotgcr | U2DOTGCR_ULE);
207 msleep(5);
208 u2d_writel(U2DOTGICR, u2d_readl(U2DOTGICR) & ~0x37F7F);
209}
210
211static int pxa310_otg_init(struct pxa3xx_u2d_platform_data *pdata)
212{
213 unsigned int ulpi_mode = ULPI_OTG_DRVVBUS;
214
215 if (pdata) {
216 if (pdata->ulpi_mode & ULPI_SER_6PIN)
217 ulpi_mode |= ULPI_IC_6PIN_SERIAL;
218 else if (pdata->ulpi_mode & ULPI_SER_3PIN)
219 ulpi_mode |= ULPI_IC_3PIN_SERIAL;
220 }
221
222 u2d->ulpi_mode = ulpi_mode;
223
224 u2d->otg = otg_ulpi_create(&pxa310_ulpi_access_ops, ulpi_mode);
225 if (!u2d->otg)
226 return -ENOMEM;
227
228 u2d->otg->io_priv = u2d->mmio_base;
229
230 return 0;
231}
232
233static void pxa310_otg_exit(void)
234{
235 kfree(u2d->otg);
236}
237#else
238static inline void pxa310_u2d_setup_otg_hc(void) {}
239static inline int pxa310_start_otg_hc(struct usb_bus *host)
240{
241 return 0;
242}
243static inline void pxa310_stop_otg_hc(void) {}
244static inline int pxa310_otg_init(struct pxa3xx_u2d_platform_data *pdata)
245{
246 return 0;
247}
248static inline void pxa310_otg_exit(void) {}
249#endif /* CONFIG_PXA310_ULPI */
250
251int pxa3xx_u2d_start_hc(struct usb_bus *host)
252{
253 int err = 0;
254
255 /* In case the PXA3xx ULPI isn't used, do nothing. */
256 if (!u2d)
257 return 0;
258
259 clk_enable(u2d->clk);
260
261 if (cpu_is_pxa310()) {
262 pxa310_u2d_setup_otg_hc();
263 err = pxa310_start_otg_hc(host);
264 }
265
266 return err;
267}
268
269void pxa3xx_u2d_stop_hc(struct usb_bus *host)
270{
271 /* In case the PXA3xx ULPI isn't used, do nothing. */
272 if (!u2d)
273 return;
274
275 if (cpu_is_pxa310())
276 pxa310_stop_otg_hc();
277
278 clk_disable(u2d->clk);
279}
280
281static int pxa3xx_u2d_probe(struct platform_device *pdev)
282{
283 struct pxa3xx_u2d_platform_data *pdata = pdev->dev.platform_data;
284 struct resource *r;
285 int err;
286
287 u2d = kzalloc(sizeof(struct pxa3xx_u2d_ulpi), GFP_KERNEL);
288 if (!u2d) {
289 dev_err(&pdev->dev, "failed to allocate memory\n");
290 return -ENOMEM;
291 }
292
293 u2d->clk = clk_get(&pdev->dev, NULL);
294 if (IS_ERR(u2d->clk)) {
295 dev_err(&pdev->dev, "failed to get u2d clock\n");
296 err = PTR_ERR(u2d->clk);
297 goto err_free_mem;
298 }
299
300 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
301 if (!r) {
302 dev_err(&pdev->dev, "no IO memory resource defined\n");
303 err = -ENODEV;
304 goto err_put_clk;
305 }
306
307 r = request_mem_region(r->start, resource_size(r), pdev->name);
308 if (!r) {
309 dev_err(&pdev->dev, "failed to request memory resource\n");
310 err = -EBUSY;
311 goto err_put_clk;
312 }
313
314 u2d->mmio_base = ioremap(r->start, resource_size(r));
315 if (!u2d->mmio_base) {
316 dev_err(&pdev->dev, "ioremap() failed\n");
317 err = -ENODEV;
318 goto err_free_res;
319 }
320
321 if (pdata->init) {
322 err = pdata->init(&pdev->dev);
323 if (err)
324 goto err_free_io;
325 }
326
327 /* Only PXA310 U2D has OTG functionality */
328 if (cpu_is_pxa310()) {
329 err = pxa310_otg_init(pdata);
330 if (err)
331 goto err_free_plat;
332 }
333
334 platform_set_drvdata(pdev, &u2d);
335
336 return 0;
337
338err_free_plat:
339 if (pdata->exit)
340 pdata->exit(&pdev->dev);
341err_free_io:
342 iounmap(u2d->mmio_base);
343err_free_res:
344 release_mem_region(r->start, resource_size(r));
345err_put_clk:
346 clk_put(u2d->clk);
347err_free_mem:
348 kfree(u2d);
349 return err;
350}
351
352static int pxa3xx_u2d_remove(struct platform_device *pdev)
353{
354 struct pxa3xx_u2d_platform_data *pdata = pdev->dev.platform_data;
355 struct resource *r;
356
357 if (cpu_is_pxa310()) {
358 pxa310_stop_otg_hc();
359 pxa310_otg_exit();
360 }
361
362 if (pdata->exit)
363 pdata->exit(&pdev->dev);
364
365 platform_set_drvdata(pdev, NULL);
366 iounmap(u2d->mmio_base);
367 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
368 release_mem_region(r->start, resource_size(r));
369
370 clk_put(u2d->clk);
371
372 kfree(u2d);
373
374 return 0;
375}
376
377static struct platform_driver pxa3xx_u2d_ulpi_driver = {
378 .driver = {
379 .name = "pxa3xx-u2d",
380 .owner = THIS_MODULE,
381 },
382 .probe = pxa3xx_u2d_probe,
383 .remove = pxa3xx_u2d_remove,
384};
385
386static int pxa3xx_u2d_ulpi_init(void)
387{
388 return platform_driver_register(&pxa3xx_u2d_ulpi_driver);
389}
390module_init(pxa3xx_u2d_ulpi_init);
391
392static void __exit pxa3xx_u2d_ulpi_exit(void)
393{
394 platform_driver_unregister(&pxa3xx_u2d_ulpi_driver);
395}
396module_exit(pxa3xx_u2d_ulpi_exit);
397
398MODULE_DESCRIPTION("PXA3xx U2D ULPI driver");
399MODULE_AUTHOR("Igor Grinberg");
400MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index fa0014847c71..c85c3a7abd31 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -98,23 +98,6 @@ unsigned int pxa3xx_get_clk_frequency_khz(int info)
98 return CLK / 1000; 98 return CLK / 1000;
99} 99}
100 100
101/*
102 * Return the current static memory controller clock frequency
103 * in units of 10kHz
104 */
105unsigned int pxa3xx_get_memclk_frequency_10khz(void)
106{
107 unsigned long acsr;
108 unsigned int smcfs, clk = 0;
109
110 acsr = ACSR;
111
112 smcfs = (acsr >> 23) & 0x7;
113 clk = (acsr & ACCR_D0CS) ? RO_CLK : smcfs_mult[smcfs] * BASE_CLK;
114
115 return (clk / 10000);
116}
117
118void pxa3xx_clear_reset_status(unsigned int mask) 101void pxa3xx_clear_reset_status(unsigned int mask)
119{ 102{
120 /* RESET_STATUS_* has a 1:1 mapping with ARSR */ 103 /* RESET_STATUS_* has a 1:1 mapping with ARSR */
@@ -265,7 +248,7 @@ static struct clk_lookup pxa3xx_clkregs[] = {
265 INIT_CLKREG(&clk_pxa3xx_i2c, "pxa2xx-i2c.0", NULL), 248 INIT_CLKREG(&clk_pxa3xx_i2c, "pxa2xx-i2c.0", NULL),
266 INIT_CLKREG(&clk_pxa3xx_udc, "pxa27x-udc", NULL), 249 INIT_CLKREG(&clk_pxa3xx_udc, "pxa27x-udc", NULL),
267 INIT_CLKREG(&clk_pxa3xx_usbh, "pxa27x-ohci", NULL), 250 INIT_CLKREG(&clk_pxa3xx_usbh, "pxa27x-ohci", NULL),
268 INIT_CLKREG(&clk_pxa3xx_u2d, NULL, "U2DCLK"), 251 INIT_CLKREG(&clk_pxa3xx_u2d, "pxa3xx-u2d", NULL),
269 INIT_CLKREG(&clk_pxa3xx_keypad, "pxa27x-keypad", NULL), 252 INIT_CLKREG(&clk_pxa3xx_keypad, "pxa27x-keypad", NULL),
270 INIT_CLKREG(&clk_pxa3xx_ssp1, "pxa27x-ssp.0", NULL), 253 INIT_CLKREG(&clk_pxa3xx_ssp1, "pxa27x-ssp.0", NULL),
271 INIT_CLKREG(&clk_pxa3xx_ssp2, "pxa27x-ssp.1", NULL), 254 INIT_CLKREG(&clk_pxa3xx_ssp2, "pxa27x-ssp.1", NULL),
diff --git a/arch/arm/mach-pxa/pxa930.c b/arch/arm/mach-pxa/pxa930.c
index 064292008288..7d29dd3af79d 100644
--- a/arch/arm/mach-pxa/pxa930.c
+++ b/arch/arm/mach-pxa/pxa930.c
@@ -192,7 +192,7 @@ static struct mfp_addr_map pxa935_mfp_addr_map[] __initdata = {
192 192
193static int __init pxa930_init(void) 193static int __init pxa930_init(void)
194{ 194{
195 if (cpu_is_pxa930() || cpu_is_pxa935()) { 195 if (cpu_is_pxa930() || cpu_is_pxa935() || cpu_is_pxa950()) {
196 mfp_init_base(io_p2v(MFPR_BASE)); 196 mfp_init_base(io_p2v(MFPR_BASE));
197 mfp_init_addr(pxa930_mfp_addr_map); 197 mfp_init_addr(pxa930_mfp_addr_map);
198 } 198 }
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index a654d1e6b38a..62de07341cc6 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -56,6 +56,8 @@
56#include "devices.h" 56#include "devices.h"
57#include "generic.h" 57#include "generic.h"
58 58
59#define STARGATE_NR_IRQS (IRQ_BOARD_START + 8)
60
59/* Bluetooth */ 61/* Bluetooth */
60#define SG2_BT_RESET 81 62#define SG2_BT_RESET 81
61 63
@@ -1011,6 +1013,7 @@ MACHINE_START(STARGATE2, "Stargate 2")
1011 .phys_io = 0x40000000, 1013 .phys_io = 0x40000000,
1012 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 1014 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1013 .map_io = pxa_map_io, 1015 .map_io = pxa_map_io,
1016 .nr_irqs = STARGATE_NR_IRQS,
1014 .init_irq = pxa27x_init_irq, 1017 .init_irq = pxa27x_init_irq,
1015 .timer = &pxa_timer, 1018 .timer = &pxa_timer,
1016 .init_machine = stargate2_init, 1019 .init_machine = stargate2_init,
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index f02dcb5b4e97..0f440c9d7cbd 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -25,7 +25,7 @@
25 25
26#include <mach/pxa930.h> 26#include <mach/pxa930.h>
27#include <mach/pxafb.h> 27#include <mach/pxafb.h>
28#include <mach/pxa27x_keypad.h> 28#include <plat/pxa27x_keypad.h>
29 29
30#include "devices.h" 30#include "devices.h"
31#include "generic.h" 31#include "generic.h"
diff --git a/arch/arm/mach-pxa/tavorevb3.c b/arch/arm/mach-pxa/tavorevb3.c
new file mode 100644
index 000000000000..5eeba64515e4
--- /dev/null
+++ b/arch/arm/mach-pxa/tavorevb3.c
@@ -0,0 +1,136 @@
1/*
2 * linux/arch/arm/mach-pxa/tavorevb3.c
3 *
4 * Support for the Marvell EVB3 Development Platform.
5 *
6 * Copyright: (C) Copyright 2008-2010 Marvell International Ltd.
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 * publishhed by the Free Software Foundation.
11 */
12
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/interrupt.h>
17#include <linux/i2c.h>
18#include <linux/gpio.h>
19#include <linux/mfd/88pm860x.h>
20
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23
24#include <mach/pxa930.h>
25
26#include <plat/i2c.h>
27
28#include "devices.h"
29#include "generic.h"
30
31#define TAVOREVB3_NR_IRQS (IRQ_BOARD_START + 24)
32
33static mfp_cfg_t evb3_mfp_cfg[] __initdata = {
34 /* UART */
35 GPIO53_UART1_TXD,
36 GPIO54_UART1_RXD,
37
38 /* PMIC */
39 PMIC_INT_GPIO83,
40};
41
42#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
43static struct pm860x_touch_pdata evb3_touch = {
44 .gpadc_prebias = 1,
45 .slot_cycle = 1,
46 .tsi_prebias = 6,
47 .pen_prebias = 16,
48 .pen_prechg = 2,
49 .res_x = 300,
50};
51
52static struct pm860x_backlight_pdata evb3_backlight[] = {
53 {
54 .id = PM8606_ID_BACKLIGHT,
55 .iset = PM8606_WLED_CURRENT(24),
56 .flags = PM8606_BACKLIGHT1,
57 },
58 {},
59};
60
61static struct pm860x_led_pdata evb3_led[] = {
62 {
63 .id = PM8606_ID_LED,
64 .iset = PM8606_LED_CURRENT(12),
65 .flags = PM8606_LED1_RED,
66 }, {
67 .id = PM8606_ID_LED,
68 .iset = PM8606_LED_CURRENT(12),
69 .flags = PM8606_LED1_GREEN,
70 }, {
71 .id = PM8606_ID_LED,
72 .iset = PM8606_LED_CURRENT(12),
73 .flags = PM8606_LED1_BLUE,
74 }, {
75 .id = PM8606_ID_LED,
76 .iset = PM8606_LED_CURRENT(12),
77 .flags = PM8606_LED2_RED,
78 }, {
79 .id = PM8606_ID_LED,
80 .iset = PM8606_LED_CURRENT(12),
81 .flags = PM8606_LED2_GREEN,
82 }, {
83 .id = PM8606_ID_LED,
84 .iset = PM8606_LED_CURRENT(12),
85 .flags = PM8606_LED2_BLUE,
86 },
87};
88
89static struct pm860x_platform_data evb3_pm8607_info = {
90 .touch = &evb3_touch,
91 .backlight = &evb3_backlight[0],
92 .led = &evb3_led[0],
93 .companion_addr = 0x10,
94 .irq_mode = 0,
95 .irq_base = IRQ_BOARD_START,
96
97 .i2c_port = GI2C_PORT,
98};
99
100static struct i2c_board_info evb3_i2c_info[] = {
101 {
102 .type = "88PM860x",
103 .addr = 0x34,
104 .platform_data = &evb3_pm8607_info,
105 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
106 },
107};
108
109static void __init evb3_init_i2c(void)
110{
111 pxa_set_i2c_info(NULL);
112 i2c_register_board_info(0, ARRAY_AND_SIZE(evb3_i2c_info));
113}
114#else
115static inline void evb3_init_i2c(void) {}
116#endif
117
118static void __init evb3_init(void)
119{
120 /* initialize MFP configurations */
121 pxa3xx_mfp_config(ARRAY_AND_SIZE(evb3_mfp_cfg));
122
123 pxa_set_ffuart_info(NULL);
124
125 evb3_init_i2c();
126}
127
128MACHINE_START(TAVOREVB3, "PXA950 Evaluation Board (aka TavorEVB3)")
129 .phys_io = 0x40000000,
130 .boot_params = 0xa0000100,
131 .map_io = pxa_map_io,
132 .nr_irqs = TAVOREVB3_NR_IRQS,
133 .init_irq = pxa3xx_init_irq,
134 .timer = &pxa_timer,
135 .init_machine = evb3_init,
136MACHINE_END
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 83cc3a18c2e9..3a06e98b4920 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -956,6 +956,7 @@ MACHINE_START(TOSA, "SHARP Tosa")
956 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 956 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
957 .fixup = fixup_tosa, 957 .fixup = fixup_tosa,
958 .map_io = pxa_map_io, 958 .map_io = pxa_map_io,
959 .nr_irqs = TOSA_NR_IRQS,
959 .init_irq = pxa25x_init_irq, 960 .init_irq = pxa25x_init_irq,
960 .init_machine = tosa_init, 961 .init_machine = tosa_init,
961 .timer = &pxa_timer, 962 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index f0d02288b4ca..8c44bc4381ba 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -37,7 +37,7 @@
37#include <mach/z2.h> 37#include <mach/z2.h>
38#include <mach/pxafb.h> 38#include <mach/pxafb.h>
39#include <mach/mmc.h> 39#include <mach/mmc.h>
40#include <mach/pxa27x_keypad.h> 40#include <plat/pxa27x_keypad.h>
41#include <mach/pxa2xx_spi.h> 41#include <mach/pxa2xx_spi.h>
42 42
43#include <plat/i2c.h> 43#include <plat/i2c.h>
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index 03b9cb910e08..9da2b624ba20 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -904,6 +904,7 @@ MACHINE_START(ARCOM_ZEUS, "Arcom/Eurotech ZEUS")
904 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc), 904 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc),
905 .boot_params = 0xa0000100, 905 .boot_params = 0xa0000100,
906 .map_io = zeus_map_io, 906 .map_io = zeus_map_io,
907 .nr_irqs = ZEUS_NR_IRQS,
907 .init_irq = zeus_init_irq, 908 .init_irq = zeus_init_irq,
908 .timer = &pxa_timer, 909 .timer = &pxa_timer,
909 .init_machine = zeus_init, 910 .init_machine = zeus_init,
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index c479cbecf784..69df3edcdd98 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -30,7 +30,7 @@
30#include <mach/zylonite.h> 30#include <mach/zylonite.h>
31#include <mach/mmc.h> 31#include <mach/mmc.h>
32#include <mach/ohci.h> 32#include <mach/ohci.h>
33#include <mach/pxa27x_keypad.h> 33#include <plat/pxa27x_keypad.h>
34#include <plat/pxa3xx_nand.h> 34#include <plat/pxa3xx_nand.h>
35 35
36#include "devices.h" 36#include "devices.h"
@@ -415,6 +415,7 @@ MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
415 .boot_params = 0xa0000100, 415 .boot_params = 0xa0000100,
416 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 416 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
417 .map_io = pxa_map_io, 417 .map_io = pxa_map_io,
418 .nr_irqs = ZYLONITE_NR_IRQS,
418 .init_irq = pxa3xx_init_irq, 419 .init_irq = pxa3xx_init_irq,
419 .timer = &pxa_timer, 420 .timer = &pxa_timer,
420 .init_machine = zylonite_init, 421 .init_machine = zylonite_init,
diff --git a/arch/arm/mach-rpc/include/mach/vmalloc.h b/arch/arm/mach-rpc/include/mach/vmalloc.h
index 9a96fd69e705..3bcd86fadb81 100644
--- a/arch/arm/mach-rpc/include/mach/vmalloc.h
+++ b/arch/arm/mach-rpc/include/mach/vmalloc.h
@@ -7,4 +7,4 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#define VMALLOC_END (PAGE_OFFSET + 0x1c000000) 10#define VMALLOC_END 0xdc000000
diff --git a/arch/arm/mach-s5p6440/Kconfig b/arch/arm/mach-s5p6440/Kconfig
deleted file mode 100644
index 6a4af7f57584..000000000000
--- a/arch/arm/mach-s5p6440/Kconfig
+++ /dev/null
@@ -1,33 +0,0 @@
1# arch/arm/mach-s5p6440/Kconfig
2#
3# Copyright (c) 2009 Samsung Electronics Co., Ltd.
4# http://www.samsung.com/
5#
6# Licensed under GPLv2
7
8if ARCH_S5P6440
9
10config CPU_S5P6440
11 bool
12 select S3C_PL330_DMA
13 help
14 Enable S5P6440 CPU support
15
16config S5P6440_SETUP_I2C1
17 bool
18 help
19 Common setup code for i2c bus 1.
20
21config MACH_SMDK6440
22 bool "SMDK6440"
23 select CPU_S5P6440
24 select S3C_DEV_I2C1
25 select S3C_DEV_RTC
26 select S3C_DEV_WDT
27 select SAMSUNG_DEV_ADC
28 select SAMSUNG_DEV_TS
29 select S5P6440_SETUP_I2C1
30 help
31 Machine support for the Samsung SMDK6440
32
33endif
diff --git a/arch/arm/mach-s5p6440/Makefile b/arch/arm/mach-s5p6440/Makefile
deleted file mode 100644
index c3fe4d3662a9..000000000000
--- a/arch/arm/mach-s5p6440/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
1# arch/arm/mach-s5p6440/Makefile
2#
3# Copyright (c) 2009 Samsung Electronics Co., Ltd.
4# http://www.samsung.com/
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n :=
11obj- :=
12
13# Core support for S5P6440 system
14
15obj-$(CONFIG_CPU_S5P6440) += cpu.o init.o clock.o gpio.o dma.o
16obj-$(CONFIG_CPU_S5P6440) += setup-i2c0.o
17
18# machine support
19
20obj-$(CONFIG_MACH_SMDK6440) += mach-smdk6440.o
21
22# device support
23obj-y += dev-audio.o
24obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
25obj-$(CONFIG_S5P6440_SETUP_I2C1) += setup-i2c1.o
diff --git a/arch/arm/mach-s5p6440/clock.c b/arch/arm/mach-s5p6440/clock.c
deleted file mode 100644
index ca6e48dce777..000000000000
--- a/arch/arm/mach-s5p6440/clock.c
+++ /dev/null
@@ -1,846 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/clock.c
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P6440 - Clock 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
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/sysdev.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25
26#include <plat/cpu-freq.h>
27#include <mach/regs-clock.h>
28#include <plat/clock.h>
29#include <plat/cpu.h>
30#include <plat/clock-clksrc.h>
31#include <plat/s5p-clock.h>
32#include <plat/pll.h>
33#include <plat/s5p6440.h>
34
35/* APLL Mux output clock */
36static struct clksrc_clk clk_mout_apll = {
37 .clk = {
38 .name = "mout_apll",
39 .id = -1,
40 },
41 .sources = &clk_src_apll,
42 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
43};
44
45static int s5p6440_epll_enable(struct clk *clk, int enable)
46{
47 unsigned int ctrlbit = clk->ctrlbit;
48 unsigned int epll_con = __raw_readl(S5P_EPLL_CON) & ~ctrlbit;
49
50 if (enable)
51 __raw_writel(epll_con | ctrlbit, S5P_EPLL_CON);
52 else
53 __raw_writel(epll_con, S5P_EPLL_CON);
54
55 return 0;
56}
57
58static unsigned long s5p6440_epll_get_rate(struct clk *clk)
59{
60 return clk->rate;
61}
62
63static u32 epll_div[][5] = {
64 { 36000000, 0, 48, 1, 4 },
65 { 48000000, 0, 32, 1, 3 },
66 { 60000000, 0, 40, 1, 3 },
67 { 72000000, 0, 48, 1, 3 },
68 { 84000000, 0, 28, 1, 2 },
69 { 96000000, 0, 32, 1, 2 },
70 { 32768000, 45264, 43, 1, 4 },
71 { 45158000, 6903, 30, 1, 3 },
72 { 49152000, 50332, 32, 1, 3 },
73 { 67738000, 10398, 45, 1, 3 },
74 { 73728000, 9961, 49, 1, 3 }
75};
76
77static int s5p6440_epll_set_rate(struct clk *clk, unsigned long rate)
78{
79 unsigned int epll_con, epll_con_k;
80 unsigned int i;
81
82 if (clk->rate == rate) /* Return if nothing changed */
83 return 0;
84
85 epll_con = __raw_readl(S5P_EPLL_CON);
86 epll_con_k = __raw_readl(S5P_EPLL_CON_K);
87
88 epll_con_k &= ~(PLL90XX_KDIV_MASK);
89 epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
90
91 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
92 if (epll_div[i][0] == rate) {
93 epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
94 epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
95 (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
96 (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
97 break;
98 }
99 }
100
101 if (i == ARRAY_SIZE(epll_div)) {
102 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
103 return -EINVAL;
104 }
105
106 __raw_writel(epll_con, S5P_EPLL_CON);
107 __raw_writel(epll_con_k, S5P_EPLL_CON_K);
108
109 clk->rate = rate;
110
111 return 0;
112}
113
114static struct clk_ops s5p6440_epll_ops = {
115 .get_rate = s5p6440_epll_get_rate,
116 .set_rate = s5p6440_epll_set_rate,
117};
118
119static struct clksrc_clk clk_mout_epll = {
120 .clk = {
121 .name = "mout_epll",
122 .id = -1,
123 },
124 .sources = &clk_src_epll,
125 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 2, .size = 1 },
126};
127
128static struct clksrc_clk clk_mout_mpll = {
129 .clk = {
130 .name = "mout_mpll",
131 .id = -1,
132 },
133 .sources = &clk_src_mpll,
134 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 1, .size = 1 },
135};
136
137enum perf_level {
138 L0 = 532*1000,
139 L1 = 266*1000,
140 L2 = 133*1000,
141};
142
143static const u32 clock_table[][3] = {
144 /*{ARM_CLK, DIVarm, DIVhclk}*/
145 {L0 * 1000, (0 << ARM_DIV_RATIO_SHIFT), (3 << S5P_CLKDIV0_HCLK_SHIFT)},
146 {L1 * 1000, (1 << ARM_DIV_RATIO_SHIFT), (1 << S5P_CLKDIV0_HCLK_SHIFT)},
147 {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P_CLKDIV0_HCLK_SHIFT)},
148};
149
150static unsigned long s5p6440_armclk_get_rate(struct clk *clk)
151{
152 unsigned long rate = clk_get_rate(clk->parent);
153 u32 clkdiv;
154
155 /* divisor mask starts at bit0, so no need to shift */
156 clkdiv = __raw_readl(ARM_CLK_DIV) & ARM_DIV_MASK;
157
158 return rate / (clkdiv + 1);
159}
160
161static unsigned long s5p6440_armclk_round_rate(struct clk *clk,
162 unsigned long rate)
163{
164 u32 iter;
165
166 for (iter = 1 ; iter < ARRAY_SIZE(clock_table) ; iter++) {
167 if (rate > clock_table[iter][0])
168 return clock_table[iter-1][0];
169 }
170
171 return clock_table[ARRAY_SIZE(clock_table) - 1][0];
172}
173
174static int s5p6440_armclk_set_rate(struct clk *clk, unsigned long rate)
175{
176 u32 round_tmp;
177 u32 iter;
178 u32 clk_div0_tmp;
179 u32 cur_rate = clk->ops->get_rate(clk);
180 unsigned long flags;
181
182 round_tmp = clk->ops->round_rate(clk, rate);
183 if (round_tmp == cur_rate)
184 return 0;
185
186
187 for (iter = 0 ; iter < ARRAY_SIZE(clock_table) ; iter++) {
188 if (round_tmp == clock_table[iter][0])
189 break;
190 }
191
192 if (iter >= ARRAY_SIZE(clock_table))
193 iter = ARRAY_SIZE(clock_table) - 1;
194
195 local_irq_save(flags);
196 if (cur_rate > round_tmp) {
197 /* Frequency Down */
198 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK);
199 clk_div0_tmp |= clock_table[iter][1];
200 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
201
202 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) &
203 ~(S5P_CLKDIV0_HCLK_MASK);
204 clk_div0_tmp |= clock_table[iter][2];
205 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
206
207
208 } else {
209 /* Frequency Up */
210 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) &
211 ~(S5P_CLKDIV0_HCLK_MASK);
212 clk_div0_tmp |= clock_table[iter][2];
213 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
214
215 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK);
216 clk_div0_tmp |= clock_table[iter][1];
217 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
218 }
219 local_irq_restore(flags);
220
221 clk->rate = clock_table[iter][0];
222
223 return 0;
224}
225
226static struct clk_ops s5p6440_clkarm_ops = {
227 .get_rate = s5p6440_armclk_get_rate,
228 .set_rate = s5p6440_armclk_set_rate,
229 .round_rate = s5p6440_armclk_round_rate,
230};
231
232static struct clksrc_clk clk_armclk = {
233 .clk = {
234 .name = "armclk",
235 .id = 1,
236 .parent = &clk_mout_apll.clk,
237 .ops = &s5p6440_clkarm_ops,
238 },
239 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 4 },
240};
241
242static struct clksrc_clk clk_dout_mpll = {
243 .clk = {
244 .name = "dout_mpll",
245 .id = -1,
246 .parent = &clk_mout_mpll.clk,
247 },
248 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 1 },
249};
250
251static struct clksrc_clk clk_hclk = {
252 .clk = {
253 .name = "clk_hclk",
254 .id = -1,
255 .parent = &clk_armclk.clk,
256 },
257 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 4 },
258};
259
260static struct clksrc_clk clk_pclk = {
261 .clk = {
262 .name = "clk_pclk",
263 .id = -1,
264 .parent = &clk_hclk.clk,
265 },
266 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 4 },
267};
268
269static struct clk *clkset_hclklow_list[] = {
270 &clk_mout_apll.clk,
271 &clk_mout_mpll.clk,
272};
273
274static struct clksrc_sources clkset_hclklow = {
275 .sources = clkset_hclklow_list,
276 .nr_sources = ARRAY_SIZE(clkset_hclklow_list),
277};
278
279static struct clksrc_clk clk_hclk_low = {
280 .clk = {
281 .name = "hclk_low",
282 .id = -1,
283 },
284 .sources = &clkset_hclklow,
285 .reg_src = { .reg = S5P_SYS_OTHERS, .shift = 6, .size = 1 },
286 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
287};
288
289static struct clksrc_clk clk_pclk_low = {
290 .clk = {
291 .name = "pclk_low",
292 .id = -1,
293 .parent = &clk_hclk_low.clk,
294 },
295 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 },
296};
297
298int s5p6440_clk48m_ctrl(struct clk *clk, int enable)
299{
300 unsigned long flags;
301 u32 val;
302
303 /* can't rely on clock lock, this register has other usages */
304 local_irq_save(flags);
305
306 val = __raw_readl(S5P_OTHERS);
307 if (enable)
308 val |= S5P_OTHERS_USB_SIG_MASK;
309 else
310 val &= ~S5P_OTHERS_USB_SIG_MASK;
311
312 __raw_writel(val, S5P_OTHERS);
313
314 local_irq_restore(flags);
315
316 return 0;
317}
318
319static int s5p6440_pclk_ctrl(struct clk *clk, int enable)
320{
321 return s5p_gatectrl(S5P_CLK_GATE_PCLK, clk, enable);
322}
323
324static int s5p6440_hclk0_ctrl(struct clk *clk, int enable)
325{
326 return s5p_gatectrl(S5P_CLK_GATE_HCLK0, clk, enable);
327}
328
329static int s5p6440_hclk1_ctrl(struct clk *clk, int enable)
330{
331 return s5p_gatectrl(S5P_CLK_GATE_HCLK1, clk, enable);
332}
333
334static int s5p6440_sclk_ctrl(struct clk *clk, int enable)
335{
336 return s5p_gatectrl(S5P_CLK_GATE_SCLK0, clk, enable);
337}
338
339static int s5p6440_sclk1_ctrl(struct clk *clk, int enable)
340{
341 return s5p_gatectrl(S5P_CLK_GATE_SCLK1, clk, enable);
342}
343
344static int s5p6440_mem_ctrl(struct clk *clk, int enable)
345{
346 return s5p_gatectrl(S5P_CLK_GATE_MEM0, clk, enable);
347}
348
349/*
350 * The following clocks will be disabled during clock initialization. It is
351 * recommended to keep the following clocks disabled until the driver requests
352 * for enabling the clock.
353 */
354static struct clk init_clocks_disable[] = {
355 {
356 .name = "nand",
357 .id = -1,
358 .parent = &clk_hclk.clk,
359 .enable = s5p6440_mem_ctrl,
360 .ctrlbit = S5P_CLKCON_MEM0_HCLK_NFCON,
361 }, {
362 .name = "adc",
363 .id = -1,
364 .parent = &clk_pclk_low.clk,
365 .enable = s5p6440_pclk_ctrl,
366 .ctrlbit = S5P_CLKCON_PCLK_TSADC,
367 }, {
368 .name = "i2c",
369 .id = -1,
370 .parent = &clk_pclk_low.clk,
371 .enable = s5p6440_pclk_ctrl,
372 .ctrlbit = S5P_CLKCON_PCLK_IIC0,
373 }, {
374 .name = "i2s_v40",
375 .id = 0,
376 .parent = &clk_pclk_low.clk,
377 .enable = s5p6440_pclk_ctrl,
378 .ctrlbit = S5P_CLKCON_PCLK_IIS2,
379 }, {
380 .name = "spi",
381 .id = 0,
382 .parent = &clk_pclk_low.clk,
383 .enable = s5p6440_pclk_ctrl,
384 .ctrlbit = S5P_CLKCON_PCLK_SPI0,
385 }, {
386 .name = "spi",
387 .id = 1,
388 .parent = &clk_pclk_low.clk,
389 .enable = s5p6440_pclk_ctrl,
390 .ctrlbit = S5P_CLKCON_PCLK_SPI1,
391 }, {
392 .name = "sclk_spi_48",
393 .id = 0,
394 .parent = &clk_48m,
395 .enable = s5p6440_sclk_ctrl,
396 .ctrlbit = S5P_CLKCON_SCLK0_SPI0_48,
397 }, {
398 .name = "sclk_spi_48",
399 .id = 1,
400 .parent = &clk_48m,
401 .enable = s5p6440_sclk_ctrl,
402 .ctrlbit = S5P_CLKCON_SCLK0_SPI1_48,
403 }, {
404 .name = "mmc_48m",
405 .id = 0,
406 .parent = &clk_48m,
407 .enable = s5p6440_sclk_ctrl,
408 .ctrlbit = S5P_CLKCON_SCLK0_MMC0_48,
409 }, {
410 .name = "mmc_48m",
411 .id = 1,
412 .parent = &clk_48m,
413 .enable = s5p6440_sclk_ctrl,
414 .ctrlbit = S5P_CLKCON_SCLK0_MMC1_48,
415 }, {
416 .name = "mmc_48m",
417 .id = 2,
418 .parent = &clk_48m,
419 .enable = s5p6440_sclk_ctrl,
420 .ctrlbit = S5P_CLKCON_SCLK0_MMC2_48,
421 }, {
422 .name = "otg",
423 .id = -1,
424 .parent = &clk_hclk_low.clk,
425 .enable = s5p6440_hclk0_ctrl,
426 .ctrlbit = S5P_CLKCON_HCLK0_USB
427 }, {
428 .name = "post",
429 .id = -1,
430 .parent = &clk_hclk_low.clk,
431 .enable = s5p6440_hclk0_ctrl,
432 .ctrlbit = S5P_CLKCON_HCLK0_POST0
433 }, {
434 .name = "lcd",
435 .id = -1,
436 .parent = &clk_hclk_low.clk,
437 .enable = s5p6440_hclk1_ctrl,
438 .ctrlbit = S5P_CLKCON_HCLK1_DISPCON,
439 }, {
440 .name = "hsmmc",
441 .id = 0,
442 .parent = &clk_hclk_low.clk,
443 .enable = s5p6440_hclk0_ctrl,
444 .ctrlbit = S5P_CLKCON_HCLK0_HSMMC0,
445 }, {
446 .name = "hsmmc",
447 .id = 1,
448 .parent = &clk_hclk_low.clk,
449 .enable = s5p6440_hclk0_ctrl,
450 .ctrlbit = S5P_CLKCON_HCLK0_HSMMC1,
451 }, {
452 .name = "hsmmc",
453 .id = 2,
454 .parent = &clk_hclk_low.clk,
455 .enable = s5p6440_hclk0_ctrl,
456 .ctrlbit = S5P_CLKCON_HCLK0_HSMMC2,
457 }, {
458 .name = "rtc",
459 .id = -1,
460 .parent = &clk_pclk_low.clk,
461 .enable = s5p6440_pclk_ctrl,
462 .ctrlbit = S5P_CLKCON_PCLK_RTC,
463 }, {
464 .name = "watchdog",
465 .id = -1,
466 .parent = &clk_pclk_low.clk,
467 .enable = s5p6440_pclk_ctrl,
468 .ctrlbit = S5P_CLKCON_PCLK_WDT,
469 }, {
470 .name = "timers",
471 .id = -1,
472 .parent = &clk_pclk_low.clk,
473 .enable = s5p6440_pclk_ctrl,
474 .ctrlbit = S5P_CLKCON_PCLK_PWM,
475 }, {
476 .name = "hclk_fimgvg",
477 .id = -1,
478 .parent = &clk_hclk.clk,
479 .enable = s5p6440_hclk1_ctrl,
480 .ctrlbit = (1 << 2),
481 }, {
482 .name = "tsi",
483 .id = -1,
484 .parent = &clk_hclk_low.clk,
485 .enable = s5p6440_hclk1_ctrl,
486 .ctrlbit = (1 << 0),
487 }, {
488 .name = "pclk_fimgvg",
489 .id = -1,
490 .parent = &clk_pclk.clk,
491 .enable = s5p6440_pclk_ctrl,
492 .ctrlbit = (1 << 31),
493 }, {
494 .name = "dmc0",
495 .id = -1,
496 .parent = &clk_pclk.clk,
497 .enable = s5p6440_pclk_ctrl,
498 .ctrlbit = (1 << 30),
499 }, {
500 .name = "etm",
501 .id = -1,
502 .parent = &clk_pclk.clk,
503 .enable = s5p6440_pclk_ctrl,
504 .ctrlbit = (1 << 29),
505 }, {
506 .name = "dsim",
507 .id = -1,
508 .parent = &clk_pclk_low.clk,
509 .enable = s5p6440_pclk_ctrl,
510 .ctrlbit = (1 << 28),
511 }, {
512 .name = "gps",
513 .id = -1,
514 .parent = &clk_pclk_low.clk,
515 .enable = s5p6440_pclk_ctrl,
516 .ctrlbit = (1 << 25),
517 }, {
518 .name = "pcm",
519 .id = -1,
520 .parent = &clk_pclk_low.clk,
521 .enable = s5p6440_pclk_ctrl,
522 .ctrlbit = (1 << 8),
523 }, {
524 .name = "irom",
525 .id = -1,
526 .parent = &clk_hclk.clk,
527 .enable = s5p6440_hclk0_ctrl,
528 .ctrlbit = (1 << 25),
529 }, {
530 .name = "dma",
531 .id = -1,
532 .parent = &clk_hclk_low.clk,
533 .enable = s5p6440_hclk0_ctrl,
534 .ctrlbit = (1 << 12),
535 }, {
536 .name = "2d",
537 .id = -1,
538 .parent = &clk_hclk.clk,
539 .enable = s5p6440_hclk0_ctrl,
540 .ctrlbit = (1 << 8),
541 },
542};
543
544/*
545 * The following clocks will be enabled during clock initialization.
546 */
547static struct clk init_clocks[] = {
548 {
549 .name = "gpio",
550 .id = -1,
551 .parent = &clk_pclk_low.clk,
552 .enable = s5p6440_pclk_ctrl,
553 .ctrlbit = S5P_CLKCON_PCLK_GPIO,
554 }, {
555 .name = "uart",
556 .id = 0,
557 .parent = &clk_pclk_low.clk,
558 .enable = s5p6440_pclk_ctrl,
559 .ctrlbit = S5P_CLKCON_PCLK_UART0,
560 }, {
561 .name = "uart",
562 .id = 1,
563 .parent = &clk_pclk_low.clk,
564 .enable = s5p6440_pclk_ctrl,
565 .ctrlbit = S5P_CLKCON_PCLK_UART1,
566 }, {
567 .name = "uart",
568 .id = 2,
569 .parent = &clk_pclk_low.clk,
570 .enable = s5p6440_pclk_ctrl,
571 .ctrlbit = S5P_CLKCON_PCLK_UART2,
572 }, {
573 .name = "uart",
574 .id = 3,
575 .parent = &clk_pclk_low.clk,
576 .enable = s5p6440_pclk_ctrl,
577 .ctrlbit = S5P_CLKCON_PCLK_UART3,
578 }, {
579 .name = "mem",
580 .id = -1,
581 .parent = &clk_hclk.clk,
582 .enable = s5p6440_hclk0_ctrl,
583 .ctrlbit = (1 << 21),
584 }, {
585 .name = "intc",
586 .id = -1,
587 .parent = &clk_hclk.clk,
588 .enable = s5p6440_hclk0_ctrl,
589 .ctrlbit = (1 << 1),
590 },
591};
592
593static struct clk clk_iis_cd_v40 = {
594 .name = "iis_cdclk_v40",
595 .id = -1,
596};
597
598static struct clk clk_pcm_cd = {
599 .name = "pcm_cdclk",
600 .id = -1,
601};
602
603static struct clk *clkset_group1_list[] = {
604 &clk_mout_epll.clk,
605 &clk_dout_mpll.clk,
606 &clk_fin_epll,
607};
608
609static struct clksrc_sources clkset_group1 = {
610 .sources = clkset_group1_list,
611 .nr_sources = ARRAY_SIZE(clkset_group1_list),
612};
613
614static struct clk *clkset_uart_list[] = {
615 &clk_mout_epll.clk,
616 &clk_dout_mpll.clk,
617};
618
619static struct clksrc_sources clkset_uart = {
620 .sources = clkset_uart_list,
621 .nr_sources = ARRAY_SIZE(clkset_uart_list),
622};
623
624static struct clk *clkset_audio_list[] = {
625 &clk_mout_epll.clk,
626 &clk_dout_mpll.clk,
627 &clk_fin_epll,
628 &clk_iis_cd_v40,
629 &clk_pcm_cd,
630};
631
632static struct clksrc_sources clkset_audio = {
633 .sources = clkset_audio_list,
634 .nr_sources = ARRAY_SIZE(clkset_audio_list),
635};
636
637static struct clksrc_clk clksrcs[] = {
638 {
639 .clk = {
640 .name = "mmc_bus",
641 .id = 0,
642 .ctrlbit = S5P_CLKCON_SCLK0_MMC0,
643 .enable = s5p6440_sclk_ctrl,
644 },
645 .sources = &clkset_group1,
646 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 18, .size = 2 },
647 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4 },
648 }, {
649 .clk = {
650 .name = "mmc_bus",
651 .id = 1,
652 .ctrlbit = S5P_CLKCON_SCLK0_MMC1,
653 .enable = s5p6440_sclk_ctrl,
654 },
655 .sources = &clkset_group1,
656 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 2 },
657 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 4 },
658 }, {
659 .clk = {
660 .name = "mmc_bus",
661 .id = 2,
662 .ctrlbit = S5P_CLKCON_SCLK0_MMC2,
663 .enable = s5p6440_sclk_ctrl,
664 },
665 .sources = &clkset_group1,
666 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 22, .size = 2 },
667 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 4 },
668 }, {
669 .clk = {
670 .name = "uclk1",
671 .id = -1,
672 .ctrlbit = S5P_CLKCON_SCLK0_UART,
673 .enable = s5p6440_sclk_ctrl,
674 },
675 .sources = &clkset_uart,
676 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 13, .size = 1 },
677 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 16, .size = 4 },
678 }, {
679 .clk = {
680 .name = "spi_epll",
681 .id = 0,
682 .ctrlbit = S5P_CLKCON_SCLK0_SPI0,
683 .enable = s5p6440_sclk_ctrl,
684 },
685 .sources = &clkset_group1,
686 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 14, .size = 2 },
687 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 },
688 }, {
689 .clk = {
690 .name = "spi_epll",
691 .id = 1,
692 .ctrlbit = S5P_CLKCON_SCLK0_SPI1,
693 .enable = s5p6440_sclk_ctrl,
694 },
695 .sources = &clkset_group1,
696 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 2 },
697 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 },
698 }, {
699 .clk = {
700 .name = "sclk_post",
701 .id = -1,
702 .ctrlbit = (1 << 10),
703 .enable = s5p6440_sclk_ctrl,
704 },
705 .sources = &clkset_group1,
706 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 26, .size = 2 },
707 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 },
708 }, {
709 .clk = {
710 .name = "sclk_dispcon",
711 .id = -1,
712 .ctrlbit = (1 << 1),
713 .enable = s5p6440_sclk1_ctrl,
714 },
715 .sources = &clkset_group1,
716 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 2 },
717 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 0, .size = 4 },
718 }, {
719 .clk = {
720 .name = "sclk_fimgvg",
721 .id = -1,
722 .ctrlbit = (1 << 2),
723 .enable = s5p6440_sclk1_ctrl,
724 },
725 .sources = &clkset_group1,
726 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 2 },
727 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 4, .size = 4 },
728 }, {
729 .clk = {
730 .name = "sclk_audio2",
731 .id = -1,
732 .ctrlbit = (1 << 11),
733 .enable = s5p6440_sclk_ctrl,
734 },
735 .sources = &clkset_audio,
736 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 3 },
737 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 24, .size = 4 },
738 },
739};
740
741/* Clock initialisation code */
742static struct clksrc_clk *sysclks[] = {
743 &clk_mout_apll,
744 &clk_mout_epll,
745 &clk_mout_mpll,
746 &clk_dout_mpll,
747 &clk_armclk,
748 &clk_hclk,
749 &clk_pclk,
750 &clk_hclk_low,
751 &clk_pclk_low,
752};
753
754void __init_or_cpufreq s5p6440_setup_clocks(void)
755{
756 struct clk *xtal_clk;
757 unsigned long xtal;
758 unsigned long fclk;
759 unsigned long hclk;
760 unsigned long hclk_low;
761 unsigned long pclk;
762 unsigned long pclk_low;
763 unsigned long epll;
764 unsigned long apll;
765 unsigned long mpll;
766 unsigned int ptr;
767
768 /* Set S5P6440 functions for clk_fout_epll */
769 clk_fout_epll.enable = s5p6440_epll_enable;
770 clk_fout_epll.ops = &s5p6440_epll_ops;
771
772 clk_48m.enable = s5p6440_clk48m_ctrl;
773
774 xtal_clk = clk_get(NULL, "ext_xtal");
775 BUG_ON(IS_ERR(xtal_clk));
776
777 xtal = clk_get_rate(xtal_clk);
778 clk_put(xtal_clk);
779
780 epll = s5p_get_pll90xx(xtal, __raw_readl(S5P_EPLL_CON),
781 __raw_readl(S5P_EPLL_CON_K));
782 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502);
783 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4502);
784
785 clk_fout_mpll.rate = mpll;
786 clk_fout_epll.rate = epll;
787 clk_fout_apll.rate = apll;
788
789 printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
790 " E=%ld.%ldMHz\n",
791 print_mhz(apll), print_mhz(mpll), print_mhz(epll));
792
793 fclk = clk_get_rate(&clk_armclk.clk);
794 hclk = clk_get_rate(&clk_hclk.clk);
795 pclk = clk_get_rate(&clk_pclk.clk);
796 hclk_low = clk_get_rate(&clk_hclk_low.clk);
797 pclk_low = clk_get_rate(&clk_pclk_low.clk);
798
799 printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
800 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
801 print_mhz(hclk), print_mhz(hclk_low),
802 print_mhz(pclk), print_mhz(pclk_low));
803
804 clk_f.rate = fclk;
805 clk_h.rate = hclk;
806 clk_p.rate = pclk;
807
808 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
809 s3c_set_clksrc(&clksrcs[ptr], true);
810}
811
812static struct clk *clks[] __initdata = {
813 &clk_ext,
814 &clk_iis_cd_v40,
815 &clk_pcm_cd,
816};
817
818void __init s5p6440_register_clocks(void)
819{
820 struct clk *clkp;
821 int ret;
822 int ptr;
823
824 ret = s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
825 if (ret > 0)
826 printk(KERN_ERR "Failed to register %u clocks\n", ret);
827
828 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
829 s3c_register_clksrc(sysclks[ptr], 1);
830
831 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
832 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
833
834 clkp = init_clocks_disable;
835 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
836
837 ret = s3c24xx_register_clock(clkp);
838 if (ret < 0) {
839 printk(KERN_ERR "Failed to register clock %s (%d)\n",
840 clkp->name, ret);
841 }
842 (clkp->enable)(clkp, 0);
843 }
844
845 s3c_pwmclk_init();
846}
diff --git a/arch/arm/mach-s5p6440/cpu.c b/arch/arm/mach-s5p6440/cpu.c
deleted file mode 100644
index 526f33adb31d..000000000000
--- a/arch/arm/mach-s5p6440/cpu.c
+++ /dev/null
@@ -1,116 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/cpu.c
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.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#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/init.h>
17#include <linux/clk.h>
18#include <linux/io.h>
19#include <linux/sysdev.h>
20#include <linux/serial_core.h>
21#include <linux/platform_device.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
26
27#include <asm/proc-fns.h>
28
29#include <mach/hardware.h>
30#include <mach/map.h>
31#include <asm/irq.h>
32
33#include <plat/regs-serial.h>
34#include <mach/regs-clock.h>
35
36#include <plat/cpu.h>
37#include <plat/devs.h>
38#include <plat/clock.h>
39#include <plat/s5p6440.h>
40#include <plat/adc-core.h>
41
42static void s5p6440_idle(void)
43{
44 unsigned long val;
45
46 if (!need_resched()) {
47 val = __raw_readl(S5P_PWR_CFG);
48 val &= ~(0x3<<5);
49 val |= (0x1<<5);
50 __raw_writel(val, S5P_PWR_CFG);
51
52 cpu_do_idle();
53 }
54 local_irq_enable();
55}
56
57/* s5p6440_map_io
58 *
59 * register the standard cpu IO areas
60*/
61
62void __init s5p6440_map_io(void)
63{
64 /* initialize any device information early */
65 s3c_adc_setname("s3c64xx-adc");
66}
67
68void __init s5p6440_init_clocks(int xtal)
69{
70 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
71
72 s3c24xx_register_baseclocks(xtal);
73 s5p_register_clocks(xtal);
74 s5p6440_register_clocks();
75 s5p6440_setup_clocks();
76}
77
78void __init s5p6440_init_irq(void)
79{
80 /* S5P6440 supports only 2 VIC */
81 u32 vic[2];
82
83 /*
84 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
85 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
86 */
87 vic[0] = 0xff800ae7;
88 vic[1] = 0xffbf23e5;
89
90 s5p_init_irq(vic, ARRAY_SIZE(vic));
91}
92
93struct sysdev_class s5p6440_sysclass = {
94 .name = "s5p6440-core",
95};
96
97static struct sys_device s5p6440_sysdev = {
98 .cls = &s5p6440_sysclass,
99};
100
101static int __init s5p6440_core_init(void)
102{
103 return sysdev_class_register(&s5p6440_sysclass);
104}
105
106core_initcall(s5p6440_core_init);
107
108int __init s5p6440_init(void)
109{
110 printk(KERN_INFO "S5P6440: Initializing architecture\n");
111
112 /* set idle function */
113 pm_idle = s5p6440_idle;
114
115 return sysdev_register(&s5p6440_sysdev);
116}
diff --git a/arch/arm/mach-s5p6440/dev-audio.c b/arch/arm/mach-s5p6440/dev-audio.c
deleted file mode 100644
index 3ca0d2b8275d..000000000000
--- a/arch/arm/mach-s5p6440/dev-audio.c
+++ /dev/null
@@ -1,127 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/dev-audio.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14
15#include <plat/gpio-cfg.h>
16#include <plat/audio.h>
17
18#include <mach/map.h>
19#include <mach/dma.h>
20#include <mach/irqs.h>
21
22static int s5p6440_cfg_i2s(struct platform_device *pdev)
23{
24 /* configure GPIO for i2s port */
25 switch (pdev->id) {
26 case -1:
27 s3c_gpio_cfgpin(S5P6440_GPR(4), S3C_GPIO_SFN(5));
28 s3c_gpio_cfgpin(S5P6440_GPR(5), S3C_GPIO_SFN(5));
29 s3c_gpio_cfgpin(S5P6440_GPR(6), S3C_GPIO_SFN(5));
30 s3c_gpio_cfgpin(S5P6440_GPR(7), S3C_GPIO_SFN(5));
31 s3c_gpio_cfgpin(S5P6440_GPR(8), S3C_GPIO_SFN(5));
32 s3c_gpio_cfgpin(S5P6440_GPR(13), S3C_GPIO_SFN(5));
33 s3c_gpio_cfgpin(S5P6440_GPR(14), S3C_GPIO_SFN(5));
34 break;
35
36 default:
37 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
38 return -EINVAL;
39 }
40
41 return 0;
42}
43
44static struct s3c_audio_pdata s3c_i2s_pdata = {
45 .cfg_gpio = s5p6440_cfg_i2s,
46};
47
48static struct resource s5p6440_iis0_resource[] = {
49 [0] = {
50 .start = S5P6440_PA_I2S,
51 .end = S5P6440_PA_I2S + 0x100 - 1,
52 .flags = IORESOURCE_MEM,
53 },
54 [1] = {
55 .start = DMACH_I2S0_TX,
56 .end = DMACH_I2S0_TX,
57 .flags = IORESOURCE_DMA,
58 },
59 [2] = {
60 .start = DMACH_I2S0_RX,
61 .end = DMACH_I2S0_RX,
62 .flags = IORESOURCE_DMA,
63 },
64};
65
66struct platform_device s5p6440_device_iis = {
67 .name = "s3c64xx-iis-v4",
68 .id = -1,
69 .num_resources = ARRAY_SIZE(s5p6440_iis0_resource),
70 .resource = s5p6440_iis0_resource,
71 .dev = {
72 .platform_data = &s3c_i2s_pdata,
73 },
74};
75
76/* PCM Controller platform_devices */
77
78static int s5p6440_pcm_cfg_gpio(struct platform_device *pdev)
79{
80 switch (pdev->id) {
81 case 0:
82 s3c_gpio_cfgpin(S5P6440_GPR(7), S3C_GPIO_SFN(2));
83 s3c_gpio_cfgpin(S5P6440_GPR(13), S3C_GPIO_SFN(2));
84 s3c_gpio_cfgpin(S5P6440_GPR(14), S3C_GPIO_SFN(2));
85 s3c_gpio_cfgpin(S5P6440_GPR(8), S3C_GPIO_SFN(2));
86 s3c_gpio_cfgpin(S5P6440_GPR(6), S3C_GPIO_SFN(2));
87 break;
88
89 default:
90 printk(KERN_DEBUG "Invalid PCM Controller number!");
91 return -EINVAL;
92 }
93
94 return 0;
95}
96
97static struct s3c_audio_pdata s3c_pcm_pdata = {
98 .cfg_gpio = s5p6440_pcm_cfg_gpio,
99};
100
101static struct resource s5p6440_pcm0_resource[] = {
102 [0] = {
103 .start = S5P6440_PA_PCM,
104 .end = S5P6440_PA_PCM + 0x100 - 1,
105 .flags = IORESOURCE_MEM,
106 },
107 [1] = {
108 .start = DMACH_PCM0_TX,
109 .end = DMACH_PCM0_TX,
110 .flags = IORESOURCE_DMA,
111 },
112 [2] = {
113 .start = DMACH_PCM0_RX,
114 .end = DMACH_PCM0_RX,
115 .flags = IORESOURCE_DMA,
116 },
117};
118
119struct platform_device s5p6440_device_pcm = {
120 .name = "samsung-pcm",
121 .id = 0,
122 .num_resources = ARRAY_SIZE(s5p6440_pcm0_resource),
123 .resource = s5p6440_pcm0_resource,
124 .dev = {
125 .platform_data = &s3c_pcm_pdata,
126 },
127};
diff --git a/arch/arm/mach-s5p6440/dev-spi.c b/arch/arm/mach-s5p6440/dev-spi.c
deleted file mode 100644
index 510af44d180c..000000000000
--- a/arch/arm/mach-s5p6440/dev-spi.c
+++ /dev/null
@@ -1,176 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/dev-spi.c
2 *
3 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14
15#include <mach/dma.h>
16#include <mach/map.h>
17#include <mach/irqs.h>
18#include <mach/spi-clocks.h>
19
20#include <plat/s3c64xx-spi.h>
21#include <plat/gpio-cfg.h>
22
23static char *spi_src_clks[] = {
24 [S5P6440_SPI_SRCCLK_PCLK] = "pclk",
25 [S5P6440_SPI_SRCCLK_SCLK] = "spi_epll",
26};
27
28/* SPI Controller platform_devices */
29
30/* Since we emulate multi-cs capability, we do not touch the CS.
31 * The emulated CS is toggled by board specific mechanism, as it can
32 * be either some immediate GPIO or some signal out of some other
33 * chip in between ... or some yet another way.
34 * We simply do not assume anything about CS.
35 */
36static int s5p6440_spi_cfg_gpio(struct platform_device *pdev)
37{
38 switch (pdev->id) {
39 case 0:
40 s3c_gpio_cfgpin(S5P6440_GPC(0), S3C_GPIO_SFN(2));
41 s3c_gpio_cfgpin(S5P6440_GPC(1), S3C_GPIO_SFN(2));
42 s3c_gpio_cfgpin(S5P6440_GPC(2), S3C_GPIO_SFN(2));
43 s3c_gpio_setpull(S5P6440_GPC(0), S3C_GPIO_PULL_UP);
44 s3c_gpio_setpull(S5P6440_GPC(1), S3C_GPIO_PULL_UP);
45 s3c_gpio_setpull(S5P6440_GPC(2), S3C_GPIO_PULL_UP);
46 break;
47
48 case 1:
49 s3c_gpio_cfgpin(S5P6440_GPC(4), S3C_GPIO_SFN(2));
50 s3c_gpio_cfgpin(S5P6440_GPC(5), S3C_GPIO_SFN(2));
51 s3c_gpio_cfgpin(S5P6440_GPC(6), S3C_GPIO_SFN(2));
52 s3c_gpio_setpull(S5P6440_GPC(4), S3C_GPIO_PULL_UP);
53 s3c_gpio_setpull(S5P6440_GPC(5), S3C_GPIO_PULL_UP);
54 s3c_gpio_setpull(S5P6440_GPC(6), S3C_GPIO_PULL_UP);
55 break;
56
57 default:
58 dev_err(&pdev->dev, "Invalid SPI Controller number!");
59 return -EINVAL;
60 }
61
62 return 0;
63}
64
65static struct resource s5p6440_spi0_resource[] = {
66 [0] = {
67 .start = S5P6440_PA_SPI0,
68 .end = S5P6440_PA_SPI0 + 0x100 - 1,
69 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
72 .start = DMACH_SPI0_TX,
73 .end = DMACH_SPI0_TX,
74 .flags = IORESOURCE_DMA,
75 },
76 [2] = {
77 .start = DMACH_SPI0_RX,
78 .end = DMACH_SPI0_RX,
79 .flags = IORESOURCE_DMA,
80 },
81 [3] = {
82 .start = IRQ_SPI0,
83 .end = IRQ_SPI0,
84 .flags = IORESOURCE_IRQ,
85 },
86};
87
88static struct s3c64xx_spi_info s5p6440_spi0_pdata = {
89 .cfg_gpio = s5p6440_spi_cfg_gpio,
90 .fifo_lvl_mask = 0x1ff,
91 .rx_lvl_offset = 15,
92};
93
94static u64 spi_dmamask = DMA_BIT_MASK(32);
95
96struct platform_device s5p6440_device_spi0 = {
97 .name = "s3c64xx-spi",
98 .id = 0,
99 .num_resources = ARRAY_SIZE(s5p6440_spi0_resource),
100 .resource = s5p6440_spi0_resource,
101 .dev = {
102 .dma_mask = &spi_dmamask,
103 .coherent_dma_mask = DMA_BIT_MASK(32),
104 .platform_data = &s5p6440_spi0_pdata,
105 },
106};
107
108static struct resource s5p6440_spi1_resource[] = {
109 [0] = {
110 .start = S5P6440_PA_SPI1,
111 .end = S5P6440_PA_SPI1 + 0x100 - 1,
112 .flags = IORESOURCE_MEM,
113 },
114 [1] = {
115 .start = DMACH_SPI1_TX,
116 .end = DMACH_SPI1_TX,
117 .flags = IORESOURCE_DMA,
118 },
119 [2] = {
120 .start = DMACH_SPI1_RX,
121 .end = DMACH_SPI1_RX,
122 .flags = IORESOURCE_DMA,
123 },
124 [3] = {
125 .start = IRQ_SPI1,
126 .end = IRQ_SPI1,
127 .flags = IORESOURCE_IRQ,
128 },
129};
130
131static struct s3c64xx_spi_info s5p6440_spi1_pdata = {
132 .cfg_gpio = s5p6440_spi_cfg_gpio,
133 .fifo_lvl_mask = 0x7f,
134 .rx_lvl_offset = 15,
135};
136
137struct platform_device s5p6440_device_spi1 = {
138 .name = "s3c64xx-spi",
139 .id = 1,
140 .num_resources = ARRAY_SIZE(s5p6440_spi1_resource),
141 .resource = s5p6440_spi1_resource,
142 .dev = {
143 .dma_mask = &spi_dmamask,
144 .coherent_dma_mask = DMA_BIT_MASK(32),
145 .platform_data = &s5p6440_spi1_pdata,
146 },
147};
148
149void __init s5p6440_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
150{
151 struct s3c64xx_spi_info *pd;
152
153 /* Reject invalid configuration */
154 if (!num_cs || src_clk_nr < 0
155 || src_clk_nr > S5P6440_SPI_SRCCLK_SCLK) {
156 printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
157 return;
158 }
159
160 switch (cntrlr) {
161 case 0:
162 pd = &s5p6440_spi0_pdata;
163 break;
164 case 1:
165 pd = &s5p6440_spi1_pdata;
166 break;
167 default:
168 printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
169 __func__, cntrlr);
170 return;
171 }
172
173 pd->num_cs = num_cs;
174 pd->src_clk_nr = src_clk_nr;
175 pd->src_clk_name = spi_src_clks[src_clk_nr];
176}
diff --git a/arch/arm/mach-s5p6440/include/mach/debug-macro.S b/arch/arm/mach-s5p6440/include/mach/debug-macro.S
deleted file mode 100644
index 1347d7f99079..000000000000
--- a/arch/arm/mach-s5p6440/include/mach/debug-macro.S
+++ /dev/null
@@ -1,37 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/debug-macro.S
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.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/* pull in the relevant register and map files. */
12
13#include <mach/map.h>
14#include <plat/regs-serial.h>
15
16 /* note, for the boot process to work we have to keep the UART
17 * virtual address aligned to an 1MiB boundary for the L1
18 * mapping the head code makes. We keep the UART virtual address
19 * aligned and add in the offset when we load the value here.
20 */
21
22 .macro addruart, rx, rtmp
23 mrc p15, 0, \rx, c1, c0
24 tst \rx, #1
25 ldreq \rx, = S3C_PA_UART
26 ldrne \rx, = S3C_VA_UART
27#if CONFIG_DEBUG_S3C_UART != 0
28 add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART)
29#endif
30 .endm
31
32/* include the reset of the code which will do the work, we're only
33 * compiling for a single cpu processor type so the default of s3c2440
34 * will be fine with us.
35 */
36
37#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-s5p6440/include/mach/gpio.h b/arch/arm/mach-s5p6440/include/mach/gpio.h
deleted file mode 100644
index 21783834f2a2..000000000000
--- a/arch/arm/mach-s5p6440/include/mach/gpio.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/gpio.h
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P6440 - GPIO lib 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
13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__
15
16#define gpio_get_value __gpio_get_value
17#define gpio_set_value __gpio_set_value
18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq
20
21/* GPIO bank sizes */
22#define S5P6440_GPIO_A_NR (6)
23#define S5P6440_GPIO_B_NR (7)
24#define S5P6440_GPIO_C_NR (8)
25#define S5P6440_GPIO_F_NR (2)
26#define S5P6440_GPIO_G_NR (7)
27#define S5P6440_GPIO_H_NR (10)
28#define S5P6440_GPIO_I_NR (16)
29#define S5P6440_GPIO_J_NR (12)
30#define S5P6440_GPIO_N_NR (16)
31#define S5P6440_GPIO_P_NR (8)
32#define S5P6440_GPIO_R_NR (15)
33
34/* GPIO bank numbers */
35
36/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
37 * space for debugging purposes so that any accidental
38 * change from one gpio bank to another can be caught.
39*/
40#define S5P6440_GPIO_NEXT(__gpio) \
41 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
42
43enum s5p_gpio_number {
44 S5P6440_GPIO_A_START = 0,
45 S5P6440_GPIO_B_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_A),
46 S5P6440_GPIO_C_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_B),
47 S5P6440_GPIO_F_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_C),
48 S5P6440_GPIO_G_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_F),
49 S5P6440_GPIO_H_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_G),
50 S5P6440_GPIO_I_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_H),
51 S5P6440_GPIO_J_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_I),
52 S5P6440_GPIO_N_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_J),
53 S5P6440_GPIO_P_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_N),
54 S5P6440_GPIO_R_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_P),
55};
56
57/* S5P6440 GPIO number definitions. */
58#define S5P6440_GPA(_nr) (S5P6440_GPIO_A_START + (_nr))
59#define S5P6440_GPB(_nr) (S5P6440_GPIO_B_START + (_nr))
60#define S5P6440_GPC(_nr) (S5P6440_GPIO_C_START + (_nr))
61#define S5P6440_GPF(_nr) (S5P6440_GPIO_F_START + (_nr))
62#define S5P6440_GPG(_nr) (S5P6440_GPIO_G_START + (_nr))
63#define S5P6440_GPH(_nr) (S5P6440_GPIO_H_START + (_nr))
64#define S5P6440_GPI(_nr) (S5P6440_GPIO_I_START + (_nr))
65#define S5P6440_GPJ(_nr) (S5P6440_GPIO_J_START + (_nr))
66#define S5P6440_GPN(_nr) (S5P6440_GPIO_N_START + (_nr))
67#define S5P6440_GPP(_nr) (S5P6440_GPIO_P_START + (_nr))
68#define S5P6440_GPR(_nr) (S5P6440_GPIO_R_START + (_nr))
69
70/* the end of the S5P6440 specific gpios */
71#define S5P6440_GPIO_END (S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
72#define S3C_GPIO_END S5P6440_GPIO_END
73
74/* define the number of gpios we need to the one after the GPR() range */
75#define ARCH_NR_GPIOS (S5P6440_GPR(S5P6440_GPIO_R_NR) + \
76 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
77
78#include <asm-generic/gpio.h>
79
80#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/io.h b/arch/arm/mach-s5p6440/include/mach/io.h
deleted file mode 100644
index fa2d69cb1ad7..000000000000
--- a/arch/arm/mach-s5p6440/include/mach/io.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* arch/arm/mach-s5p6440/include/mach/io.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben-linux@fluff.org>
5 *
6 * Default IO routines for S3C64XX based
7 */
8
9#ifndef __ASM_ARM_ARCH_IO_H
10#define __ASM_ARM_ARCH_IO_H
11
12/* No current ISA/PCI bus support. */
13#define __io(a) __typesafe_io(a)
14#define __mem_pci(a) (a)
15
16#define IO_SPACE_LIMIT (0xFFFFFFFF)
17
18#endif
diff --git a/arch/arm/mach-s5p6440/include/mach/map.h b/arch/arm/mach-s5p6440/include/mach/map.h
deleted file mode 100644
index 6cc5cbc88ffb..000000000000
--- a/arch/arm/mach-s5p6440/include/mach/map.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/map.h
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P6440 - Memory map 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_MAP_H
14#define __ASM_ARCH_MAP_H __FILE__
15
16#include <plat/map-base.h>
17#include <plat/map-s5p.h>
18
19#define S5P6440_PA_CHIPID (0xE0000000)
20#define S5P_PA_CHIPID S5P6440_PA_CHIPID
21
22#define S5P6440_PA_SYSCON (0xE0100000)
23#define S5P6440_PA_CLK (S5P6440_PA_SYSCON + 0x0)
24#define S5P_PA_SYSCON S5P6440_PA_SYSCON
25
26#define S5P6440_PA_GPIO (0xE0308000)
27#define S5P_PA_GPIO S5P6440_PA_GPIO
28
29#define S5P6440_PA_VIC0 (0xE4000000)
30#define S5P_PA_VIC0 S5P6440_PA_VIC0
31
32#define S5P6440_PA_PDMA 0xE9000000
33
34#define S5P6440_PA_VIC1 (0xE4100000)
35#define S5P_PA_VIC1 S5P6440_PA_VIC1
36
37#define S5P6440_PA_TIMER (0xEA000000)
38#define S5P_PA_TIMER S5P6440_PA_TIMER
39
40#define S5P6440_PA_RTC (0xEA100000)
41
42#define S5P6440_PA_WDT (0xEA200000)
43#define S5P_PA_WDT S5P6440_PA_WDT
44
45#define S5P6440_PA_UART (0xEC000000)
46
47#define S5P_PA_UART0 (S5P6440_PA_UART + 0x0)
48#define S5P_PA_UART1 (S5P6440_PA_UART + 0x400)
49#define S5P_PA_UART2 (S5P6440_PA_UART + 0x800)
50#define S5P_PA_UART3 (S5P6440_PA_UART + 0xC00)
51
52#define S5P_SZ_UART SZ_256
53
54#define S5P6440_PA_IIC0 (0xEC104000)
55#define S5P6440_PA_IIC1 (0xEC20F000)
56
57#define S5P6440_PA_SPI0 0xEC400000
58#define S5P6440_PA_SPI1 0xEC500000
59
60#define S5P6440_PA_HSOTG (0xED100000)
61
62#define S5P6440_PA_HSMMC0 (0xED800000)
63#define S5P6440_PA_HSMMC1 (0xED900000)
64#define S5P6440_PA_HSMMC2 (0xEDA00000)
65
66#define S5P6440_PA_SDRAM (0x20000000)
67#define S5P_PA_SDRAM S5P6440_PA_SDRAM
68
69/* I2S */
70#define S5P6440_PA_I2S 0xF2000000
71
72/* PCM */
73#define S5P6440_PA_PCM 0xF2100000
74
75#define S5P6440_PA_ADC (0xF3000000)
76
77/* compatibiltiy defines. */
78#define S3C_PA_UART S5P6440_PA_UART
79#define S3C_PA_IIC S5P6440_PA_IIC0
80#define S3C_PA_RTC S5P6440_PA_RTC
81#define S3C_PA_IIC1 S5P6440_PA_IIC1
82#define S3C_PA_WDT S5P6440_PA_WDT
83
84#define SAMSUNG_PA_ADC S5P6440_PA_ADC
85
86#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/regs-clock.h b/arch/arm/mach-s5p6440/include/mach/regs-clock.h
deleted file mode 100644
index c783ecc9f193..000000000000
--- a/arch/arm/mach-s5p6440/include/mach/regs-clock.h
+++ /dev/null
@@ -1,130 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P6440 - 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 __ASM_ARCH_REGS_CLOCK_H
14#define __ASM_ARCH_REGS_CLOCK_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_CLKREG(x) (S3C_VA_SYS + (x))
19
20#define S5P_APLL_LOCK S5P_CLKREG(0x00)
21#define S5P_MPLL_LOCK S5P_CLKREG(0x04)
22#define S5P_EPLL_LOCK S5P_CLKREG(0x08)
23#define S5P_APLL_CON S5P_CLKREG(0x0C)
24#define S5P_MPLL_CON S5P_CLKREG(0x10)
25#define S5P_EPLL_CON S5P_CLKREG(0x14)
26#define S5P_EPLL_CON_K S5P_CLKREG(0x18)
27#define S5P_CLK_SRC0 S5P_CLKREG(0x1C)
28#define S5P_CLK_DIV0 S5P_CLKREG(0x20)
29#define S5P_CLK_DIV1 S5P_CLKREG(0x24)
30#define S5P_CLK_DIV2 S5P_CLKREG(0x28)
31#define S5P_CLK_OUT S5P_CLKREG(0x2C)
32#define S5P_CLK_GATE_HCLK0 S5P_CLKREG(0x30)
33#define S5P_CLK_GATE_PCLK S5P_CLKREG(0x34)
34#define S5P_CLK_GATE_SCLK0 S5P_CLKREG(0x38)
35#define S5P_CLK_GATE_MEM0 S5P_CLKREG(0x3C)
36#define S5P_CLK_DIV3 S5P_CLKREG(0x40)
37#define S5P_CLK_GATE_HCLK1 S5P_CLKREG(0x44)
38#define S5P_CLK_GATE_SCLK1 S5P_CLKREG(0x48)
39#define S5P_AHB_CON0 S5P_CLKREG(0x100)
40#define S5P_CLK_SRC1 S5P_CLKREG(0x10C)
41#define S5P_SWRESET S5P_CLKREG(0x114)
42#define S5P_SYS_ID S5P_CLKREG(0x118)
43#define S5P_SYS_OTHERS S5P_CLKREG(0x11C)
44#define S5P_MEM_CFG_STAT S5P_CLKREG(0x12C)
45#define S5P_PWR_CFG S5P_CLKREG(0x804)
46#define S5P_EINT_WAKEUP_MASK S5P_CLKREG(0x808)
47#define S5P_NORMAL_CFG S5P_CLKREG(0x810)
48#define S5P_STOP_CFG S5P_CLKREG(0x814)
49#define S5P_SLEEP_CFG S5P_CLKREG(0x818)
50#define S5P_OSC_FREQ S5P_CLKREG(0x820)
51#define S5P_OSC_STABLE S5P_CLKREG(0x824)
52#define S5P_PWR_STABLE S5P_CLKREG(0x828)
53#define S5P_MTC_STABLE S5P_CLKREG(0x830)
54#define S5P_OTHERS S5P_CLKREG(0x900)
55#define S5P_RST_STAT S5P_CLKREG(0x904)
56#define S5P_WAKEUP_STAT S5P_CLKREG(0x908)
57#define S5P_SLPEN S5P_CLKREG(0x930)
58#define S5P_INFORM0 S5P_CLKREG(0xA00)
59#define S5P_INFORM1 S5P_CLKREG(0xA04)
60#define S5P_INFORM2 S5P_CLKREG(0xA08)
61#define S5P_INFORM3 S5P_CLKREG(0xA0C)
62
63/* CLKDIV0 */
64#define S5P_CLKDIV0_PCLK_MASK (0xf << 12)
65#define S5P_CLKDIV0_PCLK_SHIFT (12)
66#define S5P_CLKDIV0_HCLK_MASK (0xf << 8)
67#define S5P_CLKDIV0_HCLK_SHIFT (8)
68#define S5P_CLKDIV0_MPLL_MASK (0x1 << 4)
69#define S5P_CLKDIV0_ARM_MASK (0xf << 0)
70#define S5P_CLKDIV0_ARM_SHIFT (0)
71
72/* CLKDIV3 */
73#define S5P_CLKDIV3_PCLK_LOW_MASK (0xf << 12)
74#define S5P_CLKDIV3_PCLK_LOW_SHIFT (12)
75#define S5P_CLKDIV3_HCLK_LOW_MASK (0xf << 8)
76#define S5P_CLKDIV3_HCLK_LOW_SHIFT (8)
77
78/* HCLK0 GATE Registers */
79#define S5P_CLKCON_HCLK0_USB (1<<20)
80#define S5P_CLKCON_HCLK0_HSMMC2 (1<<19)
81#define S5P_CLKCON_HCLK0_HSMMC1 (1<<18)
82#define S5P_CLKCON_HCLK0_HSMMC0 (1<<17)
83#define S5P_CLKCON_HCLK0_POST0 (1<<5)
84
85/* HCLK1 GATE Registers */
86#define S5P_CLKCON_HCLK1_DISPCON (1<<1)
87
88/* PCLK GATE Registers */
89#define S5P_CLKCON_PCLK_IIS2 (1<<26)
90#define S5P_CLKCON_PCLK_SPI1 (1<<22)
91#define S5P_CLKCON_PCLK_SPI0 (1<<21)
92#define S5P_CLKCON_PCLK_GPIO (1<<18)
93#define S5P_CLKCON_PCLK_IIC0 (1<<17)
94#define S5P_CLKCON_PCLK_TSADC (1<<12)
95#define S5P_CLKCON_PCLK_PWM (1<<7)
96#define S5P_CLKCON_PCLK_RTC (1<<6)
97#define S5P_CLKCON_PCLK_WDT (1<<5)
98#define S5P_CLKCON_PCLK_UART3 (1<<4)
99#define S5P_CLKCON_PCLK_UART2 (1<<3)
100#define S5P_CLKCON_PCLK_UART1 (1<<2)
101#define S5P_CLKCON_PCLK_UART0 (1<<1)
102
103/* SCLK0 GATE Registers */
104#define S5P_CLKCON_SCLK0_MMC2_48 (1<<29)
105#define S5P_CLKCON_SCLK0_MMC1_48 (1<<28)
106#define S5P_CLKCON_SCLK0_MMC0_48 (1<<27)
107#define S5P_CLKCON_SCLK0_MMC2 (1<<26)
108#define S5P_CLKCON_SCLK0_MMC1 (1<<25)
109#define S5P_CLKCON_SCLK0_MMC0 (1<<24)
110#define S5P_CLKCON_SCLK0_SPI1_48 (1<<23)
111#define S5P_CLKCON_SCLK0_SPI0_48 (1<<22)
112#define S5P_CLKCON_SCLK0_SPI1 (1<<21)
113#define S5P_CLKCON_SCLK0_SPI0 (1<<20)
114#define S5P_CLKCON_SCLK0_UART (1<<5)
115
116/* SCLK1 GATE Registers */
117
118/* MEM0 GATE Registers */
119#define S5P_CLKCON_MEM0_HCLK_NFCON (1<<2)
120
121/*OTHERS Resgister */
122#define S5P_OTHERS_USB_SIG_MASK (1<<16)
123#define S5P_OTHERS_HCLK_LOW_SEL_MPLL (1<<6)
124
125/* Compatibility defines */
126#define ARM_CLK_DIV S5P_CLK_DIV0
127#define ARM_DIV_RATIO_SHIFT 0
128#define ARM_DIV_MASK (0xf << ARM_DIV_RATIO_SHIFT)
129
130#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/spi-clocks.h b/arch/arm/mach-s5p6440/include/mach/spi-clocks.h
deleted file mode 100644
index 5fbca50d1cfb..000000000000
--- a/arch/arm/mach-s5p6440/include/mach/spi-clocks.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/spi-clocks.h
2 *
3 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __S5P6440_PLAT_SPI_CLKS_H
12#define __S5P6440_PLAT_SPI_CLKS_H __FILE__
13
14#define S5P6440_SPI_SRCCLK_PCLK 0
15#define S5P6440_SPI_SRCCLK_SCLK 1
16
17#endif /* __S5P6440_PLAT_SPI_CLKS_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/uncompress.h b/arch/arm/mach-s5p6440/include/mach/uncompress.h
deleted file mode 100644
index 7c1f600d65c0..000000000000
--- a/arch/arm/mach-s5p6440/include/mach/uncompress.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/uncompress.h
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P6440 - uncompress code
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_UNCOMPRESS_H
14#define __ASM_ARCH_UNCOMPRESS_H
15
16#include <mach/map.h>
17#include <plat/uncompress.h>
18
19static void arch_detect_cpu(void)
20{
21 /* we do not need to do any cpu detection here at the moment. */
22}
23
24#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s5p6440/init.c b/arch/arm/mach-s5p6440/init.c
deleted file mode 100644
index a1f3727e4021..000000000000
--- a/arch/arm/mach-s5p6440/init.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/* linux/arch/arm/mach-s5p6440/init.c
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P6440 - Init 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
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/init.h>
16#include <linux/serial_core.h>
17
18#include <plat/cpu.h>
19#include <plat/devs.h>
20#include <plat/s5p6440.h>
21#include <plat/regs-serial.h>
22
23static struct s3c24xx_uart_clksrc s5p6440_serial_clocks[] = {
24 [0] = {
25 .name = "pclk_low",
26 .divisor = 1,
27 .min_baud = 0,
28 .max_baud = 0,
29 },
30 [1] = {
31 .name = "uclk1",
32 .divisor = 1,
33 .min_baud = 0,
34 .max_baud = 0,
35 },
36};
37
38/* uart registration process */
39void __init s5p6440_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
40{
41 struct s3c2410_uartcfg *tcfg = cfg;
42 u32 ucnt;
43
44 for (ucnt = 0; ucnt < no; ucnt++, tcfg++) {
45 if (!tcfg->clocks) {
46 tcfg->clocks = s5p6440_serial_clocks;
47 tcfg->clocks_size = ARRAY_SIZE(s5p6440_serial_clocks);
48 }
49 }
50
51 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
52}
diff --git a/arch/arm/mach-s5p6442/cpu.c b/arch/arm/mach-s5p6442/cpu.c
index a48fb553fd01..842af86bda6d 100644
--- a/arch/arm/mach-s5p6442/cpu.c
+++ b/arch/arm/mach-s5p6442/cpu.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-s5p6442/cpu.c 1/* linux/arch/arm/mach-s5p6442/cpu.c
2 * 2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
@@ -19,6 +19,7 @@
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/sched.h>
22 23
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
@@ -47,10 +48,30 @@ static struct map_desc s5p6442_iodesc[] __initdata = {
47 .length = SZ_16K, 48 .length = SZ_16K,
48 .type = MT_DEVICE, 49 .type = MT_DEVICE,
49 }, { 50 }, {
51 .virtual = (unsigned long)S5P_VA_GPIO,
52 .pfn = __phys_to_pfn(S5P6442_PA_GPIO),
53 .length = SZ_4K,
54 .type = MT_DEVICE,
55 }, {
56 .virtual = (unsigned long)VA_VIC0,
57 .pfn = __phys_to_pfn(S5P6442_PA_VIC0),
58 .length = SZ_16K,
59 .type = MT_DEVICE,
60 }, {
61 .virtual = (unsigned long)VA_VIC1,
62 .pfn = __phys_to_pfn(S5P6442_PA_VIC1),
63 .length = SZ_16K,
64 .type = MT_DEVICE,
65 }, {
50 .virtual = (unsigned long)VA_VIC2, 66 .virtual = (unsigned long)VA_VIC2,
51 .pfn = __phys_to_pfn(S5P6442_PA_VIC2), 67 .pfn = __phys_to_pfn(S5P6442_PA_VIC2),
52 .length = SZ_16K, 68 .length = SZ_16K,
53 .type = MT_DEVICE, 69 .type = MT_DEVICE,
70 }, {
71 .virtual = (unsigned long)S3C_VA_UART,
72 .pfn = __phys_to_pfn(S3C_PA_UART),
73 .length = SZ_512K,
74 .type = MT_DEVICE,
54 } 75 }
55}; 76};
56 77
@@ -62,10 +83,11 @@ static void s5p6442_idle(void)
62 local_irq_enable(); 83 local_irq_enable();
63} 84}
64 85
65/* s5p6442_map_io 86/*
87 * s5p6442_map_io
66 * 88 *
67 * register the standard cpu IO areas 89 * register the standard cpu IO areas
68*/ 90 */
69 91
70void __init s5p6442_map_io(void) 92void __init s5p6442_map_io(void)
71{ 93{
diff --git a/arch/arm/mach-s5p6442/include/mach/map.h b/arch/arm/mach-s5p6442/include/mach/map.h
index 281d256faafb..31fb2e68d527 100644
--- a/arch/arm/mach-s5p6442/include/mach/map.h
+++ b/arch/arm/mach-s5p6442/include/mach/map.h
@@ -23,16 +23,10 @@
23#define S5P_PA_SYSCON S5P6442_PA_SYSCON 23#define S5P_PA_SYSCON S5P6442_PA_SYSCON
24 24
25#define S5P6442_PA_GPIO (0xE0200000) 25#define S5P6442_PA_GPIO (0xE0200000)
26#define S5P_PA_GPIO S5P6442_PA_GPIO
27 26
28#define S5P6442_PA_VIC0 (0xE4000000) 27#define S5P6442_PA_VIC0 (0xE4000000)
29#define S5P_PA_VIC0 S5P6442_PA_VIC0
30
31#define S5P6442_PA_VIC1 (0xE4100000) 28#define S5P6442_PA_VIC1 (0xE4100000)
32#define S5P_PA_VIC1 S5P6442_PA_VIC1
33
34#define S5P6442_PA_VIC2 (0xE4200000) 29#define S5P6442_PA_VIC2 (0xE4200000)
35#define S5P_PA_VIC2 S5P6442_PA_VIC2
36 30
37#define S5P6442_PA_MDMA 0xE8000000 31#define S5P6442_PA_MDMA 0xE8000000
38#define S5P6442_PA_PDMA 0xE9000000 32#define S5P6442_PA_PDMA 0xE9000000
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
new file mode 100644
index 000000000000..fbcae9352022
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -0,0 +1,57 @@
1# arch/arm/mach-s5p64x0/Kconfig
2#
3# Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4# http://www.samsung.com/
5#
6# Licensed under GPLv2
7
8if ARCH_S5P64X0
9
10config CPU_S5P6440
11 bool
12 select PLAT_S5P
13 select S3C_PL330_DMA
14 help
15 Enable S5P6440 CPU support
16
17config CPU_S5P6450
18 bool
19 select PLAT_S5P
20 select S3C_PL330_DMA
21 help
22 Enable S5P6450 CPU support
23
24config S5P64X0_SETUP_I2C1
25 bool
26 help
27 Common setup code for i2c bus 1.
28
29# machine support
30
31config MACH_SMDK6440
32 bool "SMDK6440"
33 select CPU_S5P6440
34 select S3C_DEV_I2C1
35 select S3C_DEV_RTC
36 select S3C_DEV_WDT
37 select S3C64XX_DEV_SPI
38 select SAMSUNG_DEV_ADC
39 select SAMSUNG_DEV_TS
40 select S5P64X0_SETUP_I2C1
41 help
42 Machine support for the Samsung SMDK6440
43
44config MACH_SMDK6450
45 bool "SMDK6450"
46 select CPU_S5P6450
47 select S3C_DEV_I2C1
48 select S3C_DEV_RTC
49 select S3C_DEV_WDT
50 select S3C64XX_DEV_SPI
51 select SAMSUNG_DEV_ADC
52 select SAMSUNG_DEV_TS
53 select S5P64X0_SETUP_I2C1
54 help
55 Machine support for the Samsung SMDK6450
56
57endif
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
new file mode 100644
index 000000000000..2655829e6bf8
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -0,0 +1,30 @@
1# arch/arm/mach-s5p64x0/Makefile
2#
3# Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4# http://www.samsung.com
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n :=
11obj- :=
12
13# Core support for S5P64X0 system
14
15obj-$(CONFIG_ARCH_S5P64X0) += cpu.o init.o clock.o dma.o
16obj-$(CONFIG_ARCH_S5P64X0) += setup-i2c0.o
17obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o gpio.o
18obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o
19
20# machine support
21
22obj-$(CONFIG_MACH_SMDK6440) += mach-smdk6440.o
23obj-$(CONFIG_MACH_SMDK6450) += mach-smdk6450.o
24
25# device support
26
27obj-y += dev-audio.o
28obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
29
30obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
diff --git a/arch/arm/mach-s5p6440/Makefile.boot b/arch/arm/mach-s5p64x0/Makefile.boot
index ff90aa13bd67..ff90aa13bd67 100644
--- a/arch/arm/mach-s5p6440/Makefile.boot
+++ b/arch/arm/mach-s5p64x0/Makefile.boot
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
new file mode 100644
index 000000000000..f93dcd8b4d6a
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
@@ -0,0 +1,626 @@
1/* linux/arch/arm/mach-s5p64x0/clock-s5p6440.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P6440 - Clock 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
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/sysdev.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26#include <mach/s5p64x0-clock.h>
27
28#include <plat/cpu-freq.h>
29#include <plat/clock.h>
30#include <plat/cpu.h>
31#include <plat/pll.h>
32#include <plat/s5p-clock.h>
33#include <plat/clock-clksrc.h>
34#include <plat/s5p6440.h>
35
36static u32 epll_div[][5] = {
37 { 36000000, 0, 48, 1, 4 },
38 { 48000000, 0, 32, 1, 3 },
39 { 60000000, 0, 40, 1, 3 },
40 { 72000000, 0, 48, 1, 3 },
41 { 84000000, 0, 28, 1, 2 },
42 { 96000000, 0, 32, 1, 2 },
43 { 32768000, 45264, 43, 1, 4 },
44 { 45158000, 6903, 30, 1, 3 },
45 { 49152000, 50332, 32, 1, 3 },
46 { 67738000, 10398, 45, 1, 3 },
47 { 73728000, 9961, 49, 1, 3 }
48};
49
50static int s5p6440_epll_set_rate(struct clk *clk, unsigned long rate)
51{
52 unsigned int epll_con, epll_con_k;
53 unsigned int i;
54
55 if (clk->rate == rate) /* Return if nothing changed */
56 return 0;
57
58 epll_con = __raw_readl(S5P64X0_EPLL_CON);
59 epll_con_k = __raw_readl(S5P64X0_EPLL_CON_K);
60
61 epll_con_k &= ~(PLL90XX_KDIV_MASK);
62 epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
63
64 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
65 if (epll_div[i][0] == rate) {
66 epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
67 epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
68 (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
69 (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
70 break;
71 }
72 }
73
74 if (i == ARRAY_SIZE(epll_div)) {
75 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
76 return -EINVAL;
77 }
78
79 __raw_writel(epll_con, S5P64X0_EPLL_CON);
80 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
81
82 clk->rate = rate;
83
84 return 0;
85}
86
87static struct clk_ops s5p6440_epll_ops = {
88 .get_rate = s5p64x0_epll_get_rate,
89 .set_rate = s5p6440_epll_set_rate,
90};
91
92static struct clksrc_clk clk_hclk = {
93 .clk = {
94 .name = "clk_hclk",
95 .id = -1,
96 .parent = &clk_armclk.clk,
97 },
98 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
99};
100
101static struct clksrc_clk clk_pclk = {
102 .clk = {
103 .name = "clk_pclk",
104 .id = -1,
105 .parent = &clk_hclk.clk,
106 },
107 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
108};
109static struct clksrc_clk clk_hclk_low = {
110 .clk = {
111 .name = "clk_hclk_low",
112 .id = -1,
113 },
114 .sources = &clkset_hclk_low,
115 .reg_src = { .reg = S5P64X0_SYS_OTHERS, .shift = 6, .size = 1 },
116 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 8, .size = 4 },
117};
118
119static struct clksrc_clk clk_pclk_low = {
120 .clk = {
121 .name = "clk_pclk_low",
122 .id = -1,
123 .parent = &clk_hclk_low.clk,
124 },
125 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
126};
127
128/*
129 * The following clocks will be disabled during clock initialization. It is
130 * recommended to keep the following clocks disabled until the driver requests
131 * for enabling the clock.
132 */
133static struct clk init_clocks_disable[] = {
134 {
135 .name = "nand",
136 .id = -1,
137 .parent = &clk_hclk.clk,
138 .enable = s5p64x0_mem_ctrl,
139 .ctrlbit = (1 << 2),
140 }, {
141 .name = "post",
142 .id = -1,
143 .parent = &clk_hclk_low.clk,
144 .enable = s5p64x0_hclk0_ctrl,
145 .ctrlbit = (1 << 5)
146 }, {
147 .name = "2d",
148 .id = -1,
149 .parent = &clk_hclk.clk,
150 .enable = s5p64x0_hclk0_ctrl,
151 .ctrlbit = (1 << 8),
152 }, {
153 .name = "hsmmc",
154 .id = 0,
155 .parent = &clk_hclk_low.clk,
156 .enable = s5p64x0_hclk0_ctrl,
157 .ctrlbit = (1 << 17),
158 }, {
159 .name = "hsmmc",
160 .id = 1,
161 .parent = &clk_hclk_low.clk,
162 .enable = s5p64x0_hclk0_ctrl,
163 .ctrlbit = (1 << 18),
164 }, {
165 .name = "hsmmc",
166 .id = 2,
167 .parent = &clk_hclk_low.clk,
168 .enable = s5p64x0_hclk0_ctrl,
169 .ctrlbit = (1 << 19),
170 }, {
171 .name = "otg",
172 .id = -1,
173 .parent = &clk_hclk_low.clk,
174 .enable = s5p64x0_hclk0_ctrl,
175 .ctrlbit = (1 << 20)
176 }, {
177 .name = "irom",
178 .id = -1,
179 .parent = &clk_hclk.clk,
180 .enable = s5p64x0_hclk0_ctrl,
181 .ctrlbit = (1 << 25),
182 }, {
183 .name = "lcd",
184 .id = -1,
185 .parent = &clk_hclk_low.clk,
186 .enable = s5p64x0_hclk1_ctrl,
187 .ctrlbit = (1 << 1),
188 }, {
189 .name = "hclk_fimgvg",
190 .id = -1,
191 .parent = &clk_hclk.clk,
192 .enable = s5p64x0_hclk1_ctrl,
193 .ctrlbit = (1 << 2),
194 }, {
195 .name = "tsi",
196 .id = -1,
197 .parent = &clk_hclk_low.clk,
198 .enable = s5p64x0_hclk1_ctrl,
199 .ctrlbit = (1 << 0),
200 }, {
201 .name = "watchdog",
202 .id = -1,
203 .parent = &clk_pclk_low.clk,
204 .enable = s5p64x0_pclk_ctrl,
205 .ctrlbit = (1 << 5),
206 }, {
207 .name = "rtc",
208 .id = -1,
209 .parent = &clk_pclk_low.clk,
210 .enable = s5p64x0_pclk_ctrl,
211 .ctrlbit = (1 << 6),
212 }, {
213 .name = "timers",
214 .id = -1,
215 .parent = &clk_pclk_low.clk,
216 .enable = s5p64x0_pclk_ctrl,
217 .ctrlbit = (1 << 7),
218 }, {
219 .name = "pcm",
220 .id = -1,
221 .parent = &clk_pclk_low.clk,
222 .enable = s5p64x0_pclk_ctrl,
223 .ctrlbit = (1 << 8),
224 }, {
225 .name = "adc",
226 .id = -1,
227 .parent = &clk_pclk_low.clk,
228 .enable = s5p64x0_pclk_ctrl,
229 .ctrlbit = (1 << 12),
230 }, {
231 .name = "i2c",
232 .id = -1,
233 .parent = &clk_pclk_low.clk,
234 .enable = s5p64x0_pclk_ctrl,
235 .ctrlbit = (1 << 17),
236 }, {
237 .name = "spi",
238 .id = 0,
239 .parent = &clk_pclk_low.clk,
240 .enable = s5p64x0_pclk_ctrl,
241 .ctrlbit = (1 << 21),
242 }, {
243 .name = "spi",
244 .id = 1,
245 .parent = &clk_pclk_low.clk,
246 .enable = s5p64x0_pclk_ctrl,
247 .ctrlbit = (1 << 22),
248 }, {
249 .name = "gps",
250 .id = -1,
251 .parent = &clk_pclk_low.clk,
252 .enable = s5p64x0_pclk_ctrl,
253 .ctrlbit = (1 << 25),
254 }, {
255 .name = "i2s_v40",
256 .id = 0,
257 .parent = &clk_pclk_low.clk,
258 .enable = s5p64x0_pclk_ctrl,
259 .ctrlbit = (1 << 26),
260 }, {
261 .name = "dsim",
262 .id = -1,
263 .parent = &clk_pclk_low.clk,
264 .enable = s5p64x0_pclk_ctrl,
265 .ctrlbit = (1 << 28),
266 }, {
267 .name = "etm",
268 .id = -1,
269 .parent = &clk_pclk.clk,
270 .enable = s5p64x0_pclk_ctrl,
271 .ctrlbit = (1 << 29),
272 }, {
273 .name = "dmc0",
274 .id = -1,
275 .parent = &clk_pclk.clk,
276 .enable = s5p64x0_pclk_ctrl,
277 .ctrlbit = (1 << 30),
278 }, {
279 .name = "pclk_fimgvg",
280 .id = -1,
281 .parent = &clk_pclk.clk,
282 .enable = s5p64x0_pclk_ctrl,
283 .ctrlbit = (1 << 31),
284 }, {
285 .name = "sclk_spi_48",
286 .id = 0,
287 .parent = &clk_48m,
288 .enable = s5p64x0_sclk_ctrl,
289 .ctrlbit = (1 << 22),
290 }, {
291 .name = "sclk_spi_48",
292 .id = 1,
293 .parent = &clk_48m,
294 .enable = s5p64x0_sclk_ctrl,
295 .ctrlbit = (1 << 23),
296 }, {
297 .name = "mmc_48m",
298 .id = 0,
299 .parent = &clk_48m,
300 .enable = s5p64x0_sclk_ctrl,
301 .ctrlbit = (1 << 27),
302 }, {
303 .name = "mmc_48m",
304 .id = 1,
305 .parent = &clk_48m,
306 .enable = s5p64x0_sclk_ctrl,
307 .ctrlbit = (1 << 28),
308 }, {
309 .name = "mmc_48m",
310 .id = 2,
311 .parent = &clk_48m,
312 .enable = s5p64x0_sclk_ctrl,
313 .ctrlbit = (1 << 29),
314 },
315};
316
317/*
318 * The following clocks will be enabled during clock initialization.
319 */
320static struct clk init_clocks[] = {
321 {
322 .name = "intc",
323 .id = -1,
324 .parent = &clk_hclk.clk,
325 .enable = s5p64x0_hclk0_ctrl,
326 .ctrlbit = (1 << 1),
327 }, {
328 .name = "mem",
329 .id = -1,
330 .parent = &clk_hclk.clk,
331 .enable = s5p64x0_hclk0_ctrl,
332 .ctrlbit = (1 << 21),
333 }, {
334 .name = "dma",
335 .id = -1,
336 .parent = &clk_hclk_low.clk,
337 .enable = s5p64x0_hclk0_ctrl,
338 .ctrlbit = (1 << 12),
339 }, {
340 .name = "uart",
341 .id = 0,
342 .parent = &clk_pclk_low.clk,
343 .enable = s5p64x0_pclk_ctrl,
344 .ctrlbit = (1 << 1),
345 }, {
346 .name = "uart",
347 .id = 1,
348 .parent = &clk_pclk_low.clk,
349 .enable = s5p64x0_pclk_ctrl,
350 .ctrlbit = (1 << 2),
351 }, {
352 .name = "uart",
353 .id = 2,
354 .parent = &clk_pclk_low.clk,
355 .enable = s5p64x0_pclk_ctrl,
356 .ctrlbit = (1 << 3),
357 }, {
358 .name = "uart",
359 .id = 3,
360 .parent = &clk_pclk_low.clk,
361 .enable = s5p64x0_pclk_ctrl,
362 .ctrlbit = (1 << 4),
363 }, {
364 .name = "gpio",
365 .id = -1,
366 .parent = &clk_pclk_low.clk,
367 .enable = s5p64x0_pclk_ctrl,
368 .ctrlbit = (1 << 18),
369 },
370};
371
372static struct clk clk_iis_cd_v40 = {
373 .name = "iis_cdclk_v40",
374 .id = -1,
375};
376
377static struct clk clk_pcm_cd = {
378 .name = "pcm_cdclk",
379 .id = -1,
380};
381
382static struct clk *clkset_group1_list[] = {
383 &clk_mout_epll.clk,
384 &clk_dout_mpll.clk,
385 &clk_fin_epll,
386};
387
388static struct clksrc_sources clkset_group1 = {
389 .sources = clkset_group1_list,
390 .nr_sources = ARRAY_SIZE(clkset_group1_list),
391};
392
393static struct clk *clkset_uart_list[] = {
394 &clk_mout_epll.clk,
395 &clk_dout_mpll.clk,
396};
397
398static struct clksrc_sources clkset_uart = {
399 .sources = clkset_uart_list,
400 .nr_sources = ARRAY_SIZE(clkset_uart_list),
401};
402
403static struct clk *clkset_audio_list[] = {
404 &clk_mout_epll.clk,
405 &clk_dout_mpll.clk,
406 &clk_fin_epll,
407 &clk_iis_cd_v40,
408 &clk_pcm_cd,
409};
410
411static struct clksrc_sources clkset_audio = {
412 .sources = clkset_audio_list,
413 .nr_sources = ARRAY_SIZE(clkset_audio_list),
414};
415
416static struct clksrc_clk clksrcs[] = {
417 {
418 .clk = {
419 .name = "mmc_bus",
420 .id = 0,
421 .ctrlbit = (1 << 24),
422 .enable = s5p64x0_sclk_ctrl,
423 },
424 .sources = &clkset_group1,
425 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 18, .size = 2 },
426 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
427 }, {
428 .clk = {
429 .name = "mmc_bus",
430 .id = 1,
431 .ctrlbit = (1 << 25),
432 .enable = s5p64x0_sclk_ctrl,
433 },
434 .sources = &clkset_group1,
435 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 20, .size = 2 },
436 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
437 }, {
438 .clk = {
439 .name = "mmc_bus",
440 .id = 2,
441 .ctrlbit = (1 << 26),
442 .enable = s5p64x0_sclk_ctrl,
443 },
444 .sources = &clkset_group1,
445 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 22, .size = 2 },
446 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
447 }, {
448 .clk = {
449 .name = "uclk1",
450 .id = -1,
451 .ctrlbit = (1 << 5),
452 .enable = s5p64x0_sclk_ctrl,
453 },
454 .sources = &clkset_uart,
455 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 13, .size = 1 },
456 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
457 }, {
458 .clk = {
459 .name = "sclk_spi",
460 .id = 0,
461 .ctrlbit = (1 << 20),
462 .enable = s5p64x0_sclk_ctrl,
463 },
464 .sources = &clkset_group1,
465 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
466 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
467 }, {
468 .clk = {
469 .name = "sclk_spi",
470 .id = 1,
471 .ctrlbit = (1 << 21),
472 .enable = s5p64x0_sclk_ctrl,
473 },
474 .sources = &clkset_group1,
475 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
476 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
477 }, {
478 .clk = {
479 .name = "sclk_post",
480 .id = -1,
481 .ctrlbit = (1 << 10),
482 .enable = s5p64x0_sclk_ctrl,
483 },
484 .sources = &clkset_group1,
485 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 26, .size = 2 },
486 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 12, .size = 4 },
487 }, {
488 .clk = {
489 .name = "sclk_dispcon",
490 .id = -1,
491 .ctrlbit = (1 << 1),
492 .enable = s5p64x0_sclk1_ctrl,
493 },
494 .sources = &clkset_group1,
495 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 4, .size = 2 },
496 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 0, .size = 4 },
497 }, {
498 .clk = {
499 .name = "sclk_fimgvg",
500 .id = -1,
501 .ctrlbit = (1 << 2),
502 .enable = s5p64x0_sclk1_ctrl,
503 },
504 .sources = &clkset_group1,
505 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
506 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
507 }, {
508 .clk = {
509 .name = "sclk_audio2",
510 .id = -1,
511 .ctrlbit = (1 << 11),
512 .enable = s5p64x0_sclk_ctrl,
513 },
514 .sources = &clkset_audio,
515 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 0, .size = 3 },
516 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 24, .size = 4 },
517 },
518};
519
520/* Clock initialization code */
521static struct clksrc_clk *sysclks[] = {
522 &clk_mout_apll,
523 &clk_mout_epll,
524 &clk_mout_mpll,
525 &clk_dout_mpll,
526 &clk_armclk,
527 &clk_hclk,
528 &clk_pclk,
529 &clk_hclk_low,
530 &clk_pclk_low,
531};
532
533void __init_or_cpufreq s5p6440_setup_clocks(void)
534{
535 struct clk *xtal_clk;
536
537 unsigned long xtal;
538 unsigned long fclk;
539 unsigned long hclk;
540 unsigned long hclk_low;
541 unsigned long pclk;
542 unsigned long pclk_low;
543
544 unsigned long apll;
545 unsigned long mpll;
546 unsigned long epll;
547 unsigned int ptr;
548
549 /* Set S5P6440 functions for clk_fout_epll */
550
551 clk_fout_epll.enable = s5p64x0_epll_enable;
552 clk_fout_epll.ops = &s5p6440_epll_ops;
553
554 clk_48m.enable = s5p64x0_clk48m_ctrl;
555
556 xtal_clk = clk_get(NULL, "ext_xtal");
557 BUG_ON(IS_ERR(xtal_clk));
558
559 xtal = clk_get_rate(xtal_clk);
560 clk_put(xtal_clk);
561
562 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_APLL_CON), pll_4502);
563 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_MPLL_CON), pll_4502);
564 epll = s5p_get_pll90xx(xtal, __raw_readl(S5P64X0_EPLL_CON),
565 __raw_readl(S5P64X0_EPLL_CON_K));
566
567 clk_fout_apll.rate = apll;
568 clk_fout_mpll.rate = mpll;
569 clk_fout_epll.rate = epll;
570
571 printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
572 " E=%ld.%ldMHz\n",
573 print_mhz(apll), print_mhz(mpll), print_mhz(epll));
574
575 fclk = clk_get_rate(&clk_armclk.clk);
576 hclk = clk_get_rate(&clk_hclk.clk);
577 pclk = clk_get_rate(&clk_pclk.clk);
578 hclk_low = clk_get_rate(&clk_hclk_low.clk);
579 pclk_low = clk_get_rate(&clk_pclk_low.clk);
580
581 printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
582 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
583 print_mhz(hclk), print_mhz(hclk_low),
584 print_mhz(pclk), print_mhz(pclk_low));
585
586 clk_f.rate = fclk;
587 clk_h.rate = hclk;
588 clk_p.rate = pclk;
589
590 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
591 s3c_set_clksrc(&clksrcs[ptr], true);
592}
593
594static struct clk *clks[] __initdata = {
595 &clk_ext,
596 &clk_iis_cd_v40,
597 &clk_pcm_cd,
598};
599
600void __init s5p6440_register_clocks(void)
601{
602 struct clk *clkp;
603 int ret;
604 int ptr;
605
606 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
607
608 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
609 s3c_register_clksrc(sysclks[ptr], 1);
610
611 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
612 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
613
614 clkp = init_clocks_disable;
615 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
616
617 ret = s3c24xx_register_clock(clkp);
618 if (ret < 0) {
619 printk(KERN_ERR "Failed to register clock %s (%d)\n",
620 clkp->name, ret);
621 }
622 (clkp->enable)(clkp, 0);
623 }
624
625 s3c_pwmclk_init();
626}
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
new file mode 100644
index 000000000000..f9afb05b217c
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
@@ -0,0 +1,655 @@
1/* linux/arch/arm/mach-s5p64x0/clock-s5p6450.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P6450 - Clock 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
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/sysdev.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26#include <mach/s5p64x0-clock.h>
27
28#include <plat/cpu-freq.h>
29#include <plat/clock.h>
30#include <plat/cpu.h>
31#include <plat/pll.h>
32#include <plat/s5p-clock.h>
33#include <plat/clock-clksrc.h>
34#include <plat/s5p6450.h>
35
36static struct clksrc_clk clk_mout_dpll = {
37 .clk = {
38 .name = "mout_dpll",
39 .id = -1,
40 },
41 .sources = &clk_src_dpll,
42 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 5, .size = 1 },
43};
44
45static u32 epll_div[][5] = {
46 { 133000000, 27307, 55, 2, 2 },
47 { 100000000, 43691, 41, 2, 2 },
48 { 480000000, 0, 80, 2, 0 },
49};
50
51static int s5p6450_epll_set_rate(struct clk *clk, unsigned long rate)
52{
53 unsigned int epll_con, epll_con_k;
54 unsigned int i;
55
56 if (clk->rate == rate) /* Return if nothing changed */
57 return 0;
58
59 epll_con = __raw_readl(S5P64X0_EPLL_CON);
60 epll_con_k = __raw_readl(S5P64X0_EPLL_CON_K);
61
62 epll_con_k &= ~(PLL90XX_KDIV_MASK);
63 epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
64
65 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
66 if (epll_div[i][0] == rate) {
67 epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
68 epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
69 (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
70 (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
71 break;
72 }
73 }
74
75 if (i == ARRAY_SIZE(epll_div)) {
76 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
77 return -EINVAL;
78 }
79
80 __raw_writel(epll_con, S5P64X0_EPLL_CON);
81 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
82
83 clk->rate = rate;
84
85 return 0;
86}
87
88static struct clk_ops s5p6450_epll_ops = {
89 .get_rate = s5p64x0_epll_get_rate,
90 .set_rate = s5p6450_epll_set_rate,
91};
92
93static struct clksrc_clk clk_dout_epll = {
94 .clk = {
95 .name = "dout_epll",
96 .id = -1,
97 .parent = &clk_mout_epll.clk,
98 },
99 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 24, .size = 4 },
100};
101
102static struct clksrc_clk clk_mout_hclk_sel = {
103 .clk = {
104 .name = "mout_hclk_sel",
105 .id = -1,
106 },
107 .sources = &clkset_hclk_low,
108 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 15, .size = 1 },
109};
110
111static struct clk *clkset_hclk_list[] = {
112 &clk_mout_hclk_sel.clk,
113 &clk_armclk.clk,
114};
115
116static struct clksrc_sources clkset_hclk = {
117 .sources = clkset_hclk_list,
118 .nr_sources = ARRAY_SIZE(clkset_hclk_list),
119};
120
121static struct clksrc_clk clk_hclk = {
122 .clk = {
123 .name = "clk_hclk",
124 .id = -1,
125 },
126 .sources = &clkset_hclk,
127 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 14, .size = 1 },
128 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
129};
130
131static struct clksrc_clk clk_pclk = {
132 .clk = {
133 .name = "clk_pclk",
134 .id = -1,
135 .parent = &clk_hclk.clk,
136 },
137 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
138};
139static struct clksrc_clk clk_dout_pwm_ratio0 = {
140 .clk = {
141 .name = "clk_dout_pwm_ratio0",
142 .id = -1,
143 .parent = &clk_mout_hclk_sel.clk,
144 },
145 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 16, .size = 4 },
146};
147
148static struct clksrc_clk clk_pclk_to_wdt_pwm = {
149 .clk = {
150 .name = "clk_pclk_to_wdt_pwm",
151 .id = -1,
152 .parent = &clk_dout_pwm_ratio0.clk,
153 },
154 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 20, .size = 4 },
155};
156
157static struct clksrc_clk clk_hclk_low = {
158 .clk = {
159 .name = "clk_hclk_low",
160 .id = -1,
161 },
162 .sources = &clkset_hclk_low,
163 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 6, .size = 1 },
164 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 8, .size = 4 },
165};
166
167static struct clksrc_clk clk_pclk_low = {
168 .clk = {
169 .name = "clk_pclk_low",
170 .id = -1,
171 .parent = &clk_hclk_low.clk,
172 },
173 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
174};
175
176/*
177 * The following clocks will be disabled during clock initialization. It is
178 * recommended to keep the following clocks disabled until the driver requests
179 * for enabling the clock.
180 */
181static struct clk init_clocks_disable[] = {
182 {
183 .name = "usbhost",
184 .id = -1,
185 .parent = &clk_hclk_low.clk,
186 .enable = s5p64x0_hclk0_ctrl,
187 .ctrlbit = (1 << 3),
188 }, {
189 .name = "hsmmc",
190 .id = 0,
191 .parent = &clk_hclk_low.clk,
192 .enable = s5p64x0_hclk0_ctrl,
193 .ctrlbit = (1 << 17),
194 }, {
195 .name = "hsmmc",
196 .id = 1,
197 .parent = &clk_hclk_low.clk,
198 .enable = s5p64x0_hclk0_ctrl,
199 .ctrlbit = (1 << 18),
200 }, {
201 .name = "hsmmc",
202 .id = 2,
203 .parent = &clk_hclk_low.clk,
204 .enable = s5p64x0_hclk0_ctrl,
205 .ctrlbit = (1 << 19),
206 }, {
207 .name = "usbotg",
208 .id = -1,
209 .parent = &clk_hclk_low.clk,
210 .enable = s5p64x0_hclk0_ctrl,
211 .ctrlbit = (1 << 20),
212 }, {
213 .name = "lcd",
214 .id = -1,
215 .parent = &clk_h,
216 .enable = s5p64x0_hclk1_ctrl,
217 .ctrlbit = (1 << 1),
218 }, {
219 .name = "watchdog",
220 .id = -1,
221 .parent = &clk_pclk_low.clk,
222 .enable = s5p64x0_pclk_ctrl,
223 .ctrlbit = (1 << 5),
224 }, {
225 .name = "adc",
226 .id = -1,
227 .parent = &clk_pclk_low.clk,
228 .enable = s5p64x0_pclk_ctrl,
229 .ctrlbit = (1 << 12),
230 }, {
231 .name = "i2c",
232 .id = 0,
233 .parent = &clk_pclk_low.clk,
234 .enable = s5p64x0_pclk_ctrl,
235 .ctrlbit = (1 << 17),
236 }, {
237 .name = "spi",
238 .id = 0,
239 .parent = &clk_pclk_low.clk,
240 .enable = s5p64x0_pclk_ctrl,
241 .ctrlbit = (1 << 21),
242 }, {
243 .name = "spi",
244 .id = 1,
245 .parent = &clk_pclk_low.clk,
246 .enable = s5p64x0_pclk_ctrl,
247 .ctrlbit = (1 << 22),
248 }, {
249 .name = "iis",
250 .id = -1,
251 .parent = &clk_pclk_low.clk,
252 .enable = s5p64x0_pclk_ctrl,
253 .ctrlbit = (1 << 26),
254 }, {
255 .name = "i2c",
256 .id = 1,
257 .parent = &clk_pclk_low.clk,
258 .enable = s5p64x0_pclk_ctrl,
259 .ctrlbit = (1 << 27),
260 }, {
261 .name = "dmc0",
262 .id = -1,
263 .parent = &clk_pclk.clk,
264 .enable = s5p64x0_pclk_ctrl,
265 .ctrlbit = (1 << 30),
266 }
267};
268
269/*
270 * The following clocks will be enabled during clock initialization.
271 */
272static struct clk init_clocks[] = {
273 {
274 .name = "intc",
275 .id = -1,
276 .parent = &clk_hclk.clk,
277 .enable = s5p64x0_hclk0_ctrl,
278 .ctrlbit = (1 << 1),
279 }, {
280 .name = "mem",
281 .id = -1,
282 .parent = &clk_hclk.clk,
283 .enable = s5p64x0_hclk0_ctrl,
284 .ctrlbit = (1 << 21),
285 }, {
286 .name = "dma",
287 .id = -1,
288 .parent = &clk_hclk_low.clk,
289 .enable = s5p64x0_hclk0_ctrl,
290 .ctrlbit = (1 << 12),
291 }, {
292 .name = "uart",
293 .id = 0,
294 .parent = &clk_pclk_low.clk,
295 .enable = s5p64x0_pclk_ctrl,
296 .ctrlbit = (1 << 1),
297 }, {
298 .name = "uart",
299 .id = 1,
300 .parent = &clk_pclk_low.clk,
301 .enable = s5p64x0_pclk_ctrl,
302 .ctrlbit = (1 << 2),
303 }, {
304 .name = "uart",
305 .id = 2,
306 .parent = &clk_pclk_low.clk,
307 .enable = s5p64x0_pclk_ctrl,
308 .ctrlbit = (1 << 3),
309 }, {
310 .name = "uart",
311 .id = 3,
312 .parent = &clk_pclk_low.clk,
313 .enable = s5p64x0_pclk_ctrl,
314 .ctrlbit = (1 << 4),
315 }, {
316 .name = "timers",
317 .id = -1,
318 .parent = &clk_pclk_to_wdt_pwm.clk,
319 .enable = s5p64x0_pclk_ctrl,
320 .ctrlbit = (1 << 7),
321 }, {
322 .name = "gpio",
323 .id = -1,
324 .parent = &clk_pclk_low.clk,
325 .enable = s5p64x0_pclk_ctrl,
326 .ctrlbit = (1 << 18),
327 },
328};
329
330static struct clk *clkset_uart_list[] = {
331 &clk_dout_epll.clk,
332 &clk_dout_mpll.clk,
333};
334
335static struct clksrc_sources clkset_uart = {
336 .sources = clkset_uart_list,
337 .nr_sources = ARRAY_SIZE(clkset_uart_list),
338};
339
340static struct clk *clkset_mali_list[] = {
341 &clk_mout_epll.clk,
342 &clk_mout_apll.clk,
343 &clk_mout_mpll.clk,
344};
345
346static struct clksrc_sources clkset_mali = {
347 .sources = clkset_mali_list,
348 .nr_sources = ARRAY_SIZE(clkset_mali_list),
349};
350
351static struct clk *clkset_group2_list[] = {
352 &clk_dout_epll.clk,
353 &clk_dout_mpll.clk,
354 &clk_ext_xtal_mux,
355};
356
357static struct clksrc_sources clkset_group2 = {
358 .sources = clkset_group2_list,
359 .nr_sources = ARRAY_SIZE(clkset_group2_list),
360};
361
362static struct clk *clkset_dispcon_list[] = {
363 &clk_dout_epll.clk,
364 &clk_dout_mpll.clk,
365 &clk_ext_xtal_mux,
366 &clk_mout_dpll.clk,
367};
368
369static struct clksrc_sources clkset_dispcon = {
370 .sources = clkset_dispcon_list,
371 .nr_sources = ARRAY_SIZE(clkset_dispcon_list),
372};
373
374static struct clk *clkset_hsmmc44_list[] = {
375 &clk_dout_epll.clk,
376 &clk_dout_mpll.clk,
377 &clk_ext_xtal_mux,
378 &s5p_clk_27m,
379 &clk_48m,
380};
381
382static struct clksrc_sources clkset_hsmmc44 = {
383 .sources = clkset_hsmmc44_list,
384 .nr_sources = ARRAY_SIZE(clkset_hsmmc44_list),
385};
386
387static struct clk *clkset_sclk_audio0_list[] = {
388 [0] = &clk_dout_epll.clk,
389 [1] = &clk_dout_mpll.clk,
390 [2] = &clk_ext_xtal_mux,
391 [3] = NULL,
392 [4] = NULL,
393};
394
395static struct clksrc_sources clkset_sclk_audio0 = {
396 .sources = clkset_sclk_audio0_list,
397 .nr_sources = ARRAY_SIZE(clkset_sclk_audio0_list),
398};
399
400static struct clksrc_clk clk_sclk_audio0 = {
401 .clk = {
402 .name = "audio-bus",
403 .id = -1,
404 .enable = s5p64x0_sclk_ctrl,
405 .ctrlbit = (1 << 8),
406 .parent = &clk_dout_epll.clk,
407 },
408 .sources = &clkset_sclk_audio0,
409 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 10, .size = 3 },
410 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 8, .size = 4 },
411};
412
413static struct clksrc_clk clksrcs[] = {
414 {
415 .clk = {
416 .name = "sclk_mmc",
417 .id = 0,
418 .ctrlbit = (1 << 24),
419 .enable = s5p64x0_sclk_ctrl,
420 },
421 .sources = &clkset_group2,
422 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 18, .size = 2 },
423 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
424 }, {
425 .clk = {
426 .name = "sclk_mmc",
427 .id = 1,
428 .ctrlbit = (1 << 25),
429 .enable = s5p64x0_sclk_ctrl,
430 },
431 .sources = &clkset_group2,
432 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 20, .size = 2 },
433 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
434 }, {
435 .clk = {
436 .name = "sclk_mmc",
437 .id = 2,
438 .ctrlbit = (1 << 26),
439 .enable = s5p64x0_sclk_ctrl,
440 },
441 .sources = &clkset_group2,
442 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 22, .size = 2 },
443 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
444 }, {
445 .clk = {
446 .name = "uclk1",
447 .id = -1,
448 .ctrlbit = (1 << 5),
449 .enable = s5p64x0_sclk_ctrl,
450 },
451 .sources = &clkset_uart,
452 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 13, .size = 1 },
453 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
454 }, {
455 .clk = {
456 .name = "sclk_spi",
457 .id = 0,
458 .ctrlbit = (1 << 20),
459 .enable = s5p64x0_sclk_ctrl,
460 },
461 .sources = &clkset_group2,
462 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
463 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
464 }, {
465 .clk = {
466 .name = "sclk_spi",
467 .id = 1,
468 .ctrlbit = (1 << 21),
469 .enable = s5p64x0_sclk_ctrl,
470 },
471 .sources = &clkset_group2,
472 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
473 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
474 }, {
475 .clk = {
476 .name = "sclk_fimc",
477 .id = -1,
478 .ctrlbit = (1 << 10),
479 .enable = s5p64x0_sclk_ctrl,
480 },
481 .sources = &clkset_group2,
482 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 26, .size = 2 },
483 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 12, .size = 4 },
484 }, {
485 .clk = {
486 .name = "aclk_mali",
487 .id = -1,
488 .ctrlbit = (1 << 2),
489 .enable = s5p64x0_sclk1_ctrl,
490 },
491 .sources = &clkset_mali,
492 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
493 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
494 }, {
495 .clk = {
496 .name = "sclk_2d",
497 .id = -1,
498 .ctrlbit = (1 << 12),
499 .enable = s5p64x0_sclk_ctrl,
500 },
501 .sources = &clkset_mali,
502 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 30, .size = 2 },
503 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 20, .size = 4 },
504 }, {
505 .clk = {
506 .name = "sclk_usi",
507 .id = -1,
508 .ctrlbit = (1 << 7),
509 .enable = s5p64x0_sclk_ctrl,
510 },
511 .sources = &clkset_group2,
512 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 10, .size = 2 },
513 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 16, .size = 4 },
514 }, {
515 .clk = {
516 .name = "sclk_camif",
517 .id = -1,
518 .ctrlbit = (1 << 6),
519 .enable = s5p64x0_sclk_ctrl,
520 },
521 .sources = &clkset_group2,
522 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 28, .size = 2 },
523 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 20, .size = 4 },
524 }, {
525 .clk = {
526 .name = "sclk_dispcon",
527 .id = -1,
528 .ctrlbit = (1 << 1),
529 .enable = s5p64x0_sclk1_ctrl,
530 },
531 .sources = &clkset_dispcon,
532 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 4, .size = 2 },
533 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 0, .size = 4 },
534 }, {
535 .clk = {
536 .name = "sclk_hsmmc44",
537 .id = -1,
538 .ctrlbit = (1 << 30),
539 .enable = s5p64x0_sclk_ctrl,
540 },
541 .sources = &clkset_hsmmc44,
542 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 6, .size = 3 },
543 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 28, .size = 4 },
544 },
545};
546
547/* Clock initialization code */
548static struct clksrc_clk *sysclks[] = {
549 &clk_mout_apll,
550 &clk_mout_epll,
551 &clk_dout_epll,
552 &clk_mout_mpll,
553 &clk_dout_mpll,
554 &clk_armclk,
555 &clk_mout_hclk_sel,
556 &clk_dout_pwm_ratio0,
557 &clk_pclk_to_wdt_pwm,
558 &clk_hclk,
559 &clk_pclk,
560 &clk_hclk_low,
561 &clk_pclk_low,
562 &clk_sclk_audio0,
563};
564
565void __init_or_cpufreq s5p6450_setup_clocks(void)
566{
567 struct clk *xtal_clk;
568
569 unsigned long xtal;
570 unsigned long fclk;
571 unsigned long hclk;
572 unsigned long hclk_low;
573 unsigned long pclk;
574 unsigned long pclk_low;
575
576 unsigned long apll;
577 unsigned long mpll;
578 unsigned long epll;
579 unsigned long dpll;
580 unsigned int ptr;
581
582 /* Set S5P6450 functions for clk_fout_epll */
583
584 clk_fout_epll.enable = s5p64x0_epll_enable;
585 clk_fout_epll.ops = &s5p6450_epll_ops;
586
587 clk_48m.enable = s5p64x0_clk48m_ctrl;
588
589 xtal_clk = clk_get(NULL, "ext_xtal");
590 BUG_ON(IS_ERR(xtal_clk));
591
592 xtal = clk_get_rate(xtal_clk);
593 clk_put(xtal_clk);
594
595 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_APLL_CON), pll_4502);
596 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_MPLL_CON), pll_4502);
597 epll = s5p_get_pll90xx(xtal, __raw_readl(S5P64X0_EPLL_CON),
598 __raw_readl(S5P64X0_EPLL_CON_K));
599 dpll = s5p_get_pll46xx(xtal, __raw_readl(S5P6450_DPLL_CON),
600 __raw_readl(S5P6450_DPLL_CON_K), pll_4650c);
601
602 clk_fout_apll.rate = apll;
603 clk_fout_mpll.rate = mpll;
604 clk_fout_epll.rate = epll;
605 clk_fout_dpll.rate = dpll;
606
607 printk(KERN_INFO "S5P6450: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
608 " E=%ld.%ldMHz, D=%ld.%ldMHz\n",
609 print_mhz(apll), print_mhz(mpll), print_mhz(epll),
610 print_mhz(dpll));
611
612 fclk = clk_get_rate(&clk_armclk.clk);
613 hclk = clk_get_rate(&clk_hclk.clk);
614 pclk = clk_get_rate(&clk_pclk.clk);
615 hclk_low = clk_get_rate(&clk_hclk_low.clk);
616 pclk_low = clk_get_rate(&clk_pclk_low.clk);
617
618 printk(KERN_INFO "S5P6450: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
619 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
620 print_mhz(hclk), print_mhz(hclk_low),
621 print_mhz(pclk), print_mhz(pclk_low));
622
623 clk_f.rate = fclk;
624 clk_h.rate = hclk;
625 clk_p.rate = pclk;
626
627 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
628 s3c_set_clksrc(&clksrcs[ptr], true);
629}
630
631void __init s5p6450_register_clocks(void)
632{
633 struct clk *clkp;
634 int ret;
635 int ptr;
636
637 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
638 s3c_register_clksrc(sysclks[ptr], 1);
639
640 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
641 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
642
643 clkp = init_clocks_disable;
644 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
645
646 ret = s3c24xx_register_clock(clkp);
647 if (ret < 0) {
648 printk(KERN_ERR "Failed to register clock %s (%d)\n",
649 clkp->name, ret);
650 }
651 (clkp->enable)(clkp, 0);
652 }
653
654 s3c_pwmclk_init();
655}
diff --git a/arch/arm/mach-s5p64x0/clock.c b/arch/arm/mach-s5p64x0/clock.c
new file mode 100644
index 000000000000..523ba8039ac2
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/clock.c
@@ -0,0 +1,253 @@
1/* linux/arch/arm/mach-s5p64x0/clock.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Clock 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
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/sysdev.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26
27#include <plat/cpu-freq.h>
28#include <plat/clock.h>
29#include <plat/cpu.h>
30#include <plat/pll.h>
31#include <plat/s5p-clock.h>
32#include <plat/clock-clksrc.h>
33#include <plat/s5p6440.h>
34#include <plat/s5p6450.h>
35
36struct clksrc_clk clk_mout_apll = {
37 .clk = {
38 .name = "mout_apll",
39 .id = -1,
40 },
41 .sources = &clk_src_apll,
42 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 0, .size = 1 },
43};
44
45struct clksrc_clk clk_mout_mpll = {
46 .clk = {
47 .name = "mout_mpll",
48 .id = -1,
49 },
50 .sources = &clk_src_mpll,
51 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 1, .size = 1 },
52};
53
54struct clksrc_clk clk_mout_epll = {
55 .clk = {
56 .name = "mout_epll",
57 .id = -1,
58 },
59 .sources = &clk_src_epll,
60 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 2, .size = 1 },
61};
62
63enum perf_level {
64 L0 = 532*1000,
65 L1 = 266*1000,
66 L2 = 133*1000,
67};
68
69static const u32 clock_table[][3] = {
70 /*{ARM_CLK, DIVarm, DIVhclk}*/
71 {L0 * 1000, (0 << ARM_DIV_RATIO_SHIFT), (3 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
72 {L1 * 1000, (1 << ARM_DIV_RATIO_SHIFT), (1 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
73 {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
74};
75
76int s5p64x0_epll_enable(struct clk *clk, int enable)
77{
78 unsigned int ctrlbit = clk->ctrlbit;
79 unsigned int epll_con = __raw_readl(S5P64X0_EPLL_CON) & ~ctrlbit;
80
81 if (enable)
82 __raw_writel(epll_con | ctrlbit, S5P64X0_EPLL_CON);
83 else
84 __raw_writel(epll_con, S5P64X0_EPLL_CON);
85
86 return 0;
87}
88
89unsigned long s5p64x0_epll_get_rate(struct clk *clk)
90{
91 return clk->rate;
92}
93
94unsigned long s5p64x0_armclk_get_rate(struct clk *clk)
95{
96 unsigned long rate = clk_get_rate(clk->parent);
97 u32 clkdiv;
98
99 /* divisor mask starts at bit0, so no need to shift */
100 clkdiv = __raw_readl(ARM_CLK_DIV) & ARM_DIV_MASK;
101
102 return rate / (clkdiv + 1);
103}
104
105unsigned long s5p64x0_armclk_round_rate(struct clk *clk, unsigned long rate)
106{
107 u32 iter;
108
109 for (iter = 1 ; iter < ARRAY_SIZE(clock_table) ; iter++) {
110 if (rate > clock_table[iter][0])
111 return clock_table[iter-1][0];
112 }
113
114 return clock_table[ARRAY_SIZE(clock_table) - 1][0];
115}
116
117int s5p64x0_armclk_set_rate(struct clk *clk, unsigned long rate)
118{
119 u32 round_tmp;
120 u32 iter;
121 u32 clk_div0_tmp;
122 u32 cur_rate = clk->ops->get_rate(clk);
123 unsigned long flags;
124
125 round_tmp = clk->ops->round_rate(clk, rate);
126 if (round_tmp == cur_rate)
127 return 0;
128
129
130 for (iter = 0 ; iter < ARRAY_SIZE(clock_table) ; iter++) {
131 if (round_tmp == clock_table[iter][0])
132 break;
133 }
134
135 if (iter >= ARRAY_SIZE(clock_table))
136 iter = ARRAY_SIZE(clock_table) - 1;
137
138 local_irq_save(flags);
139 if (cur_rate > round_tmp) {
140 /* Frequency Down */
141 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK);
142 clk_div0_tmp |= clock_table[iter][1];
143 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
144
145 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) &
146 ~(S5P64X0_CLKDIV0_HCLK_MASK);
147 clk_div0_tmp |= clock_table[iter][2];
148 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
149
150
151 } else {
152 /* Frequency Up */
153 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) &
154 ~(S5P64X0_CLKDIV0_HCLK_MASK);
155 clk_div0_tmp |= clock_table[iter][2];
156 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
157
158 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK);
159 clk_div0_tmp |= clock_table[iter][1];
160 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
161 }
162 local_irq_restore(flags);
163
164 clk->rate = clock_table[iter][0];
165
166 return 0;
167}
168
169struct clk_ops s5p64x0_clkarm_ops = {
170 .get_rate = s5p64x0_armclk_get_rate,
171 .set_rate = s5p64x0_armclk_set_rate,
172 .round_rate = s5p64x0_armclk_round_rate,
173};
174
175struct clksrc_clk clk_armclk = {
176 .clk = {
177 .name = "armclk",
178 .id = 1,
179 .parent = &clk_mout_apll.clk,
180 .ops = &s5p64x0_clkarm_ops,
181 },
182 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 0, .size = 4 },
183};
184
185struct clksrc_clk clk_dout_mpll = {
186 .clk = {
187 .name = "dout_mpll",
188 .id = -1,
189 .parent = &clk_mout_mpll.clk,
190 },
191 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 4, .size = 1 },
192};
193
194struct clk *clkset_hclk_low_list[] = {
195 &clk_mout_apll.clk,
196 &clk_mout_mpll.clk,
197};
198
199struct clksrc_sources clkset_hclk_low = {
200 .sources = clkset_hclk_low_list,
201 .nr_sources = ARRAY_SIZE(clkset_hclk_low_list),
202};
203
204int s5p64x0_pclk_ctrl(struct clk *clk, int enable)
205{
206 return s5p_gatectrl(S5P64X0_CLK_GATE_PCLK, clk, enable);
207}
208
209int s5p64x0_hclk0_ctrl(struct clk *clk, int enable)
210{
211 return s5p_gatectrl(S5P64X0_CLK_GATE_HCLK0, clk, enable);
212}
213
214int s5p64x0_hclk1_ctrl(struct clk *clk, int enable)
215{
216 return s5p_gatectrl(S5P64X0_CLK_GATE_HCLK1, clk, enable);
217}
218
219int s5p64x0_sclk_ctrl(struct clk *clk, int enable)
220{
221 return s5p_gatectrl(S5P64X0_CLK_GATE_SCLK0, clk, enable);
222}
223
224int s5p64x0_sclk1_ctrl(struct clk *clk, int enable)
225{
226 return s5p_gatectrl(S5P64X0_CLK_GATE_SCLK1, clk, enable);
227}
228
229int s5p64x0_mem_ctrl(struct clk *clk, int enable)
230{
231 return s5p_gatectrl(S5P64X0_CLK_GATE_MEM0, clk, enable);
232}
233
234int s5p64x0_clk48m_ctrl(struct clk *clk, int enable)
235{
236 unsigned long flags;
237 u32 val;
238
239 /* can't rely on clock lock, this register has other usages */
240 local_irq_save(flags);
241
242 val = __raw_readl(S5P64X0_OTHERS);
243 if (enable)
244 val |= S5P64X0_OTHERS_USB_SIG_MASK;
245 else
246 val &= ~S5P64X0_OTHERS_USB_SIG_MASK;
247
248 __raw_writel(val, S5P64X0_OTHERS);
249
250 local_irq_restore(flags);
251
252 return 0;
253}
diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c
new file mode 100644
index 000000000000..b8d02eb4cf30
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/cpu.c
@@ -0,0 +1,209 @@
1/* linux/arch/arm/mach-s5p64x0/cpu.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.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#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/init.h>
17#include <linux/clk.h>
18#include <linux/io.h>
19#include <linux/sysdev.h>
20#include <linux/serial_core.h>
21#include <linux/platform_device.h>
22#include <linux/sched.h>
23
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/mach/irq.h>
27#include <asm/proc-fns.h>
28#include <asm/irq.h>
29
30#include <mach/hardware.h>
31#include <mach/map.h>
32#include <mach/regs-clock.h>
33
34#include <plat/regs-serial.h>
35#include <plat/cpu.h>
36#include <plat/devs.h>
37#include <plat/clock.h>
38#include <plat/s5p6440.h>
39#include <plat/s5p6450.h>
40#include <plat/adc-core.h>
41
42/* Initial IO mappings */
43
44static struct map_desc s5p64x0_iodesc[] __initdata = {
45 {
46 .virtual = (unsigned long)S5P_VA_GPIO,
47 .pfn = __phys_to_pfn(S5P64X0_PA_GPIO),
48 .length = SZ_4K,
49 .type = MT_DEVICE,
50 }, {
51 .virtual = (unsigned long)VA_VIC0,
52 .pfn = __phys_to_pfn(S5P64X0_PA_VIC0),
53 .length = SZ_16K,
54 .type = MT_DEVICE,
55 }, {
56 .virtual = (unsigned long)VA_VIC1,
57 .pfn = __phys_to_pfn(S5P64X0_PA_VIC1),
58 .length = SZ_16K,
59 .type = MT_DEVICE,
60 },
61};
62
63static struct map_desc s5p6440_iodesc[] __initdata = {
64 {
65 .virtual = (unsigned long)S3C_VA_UART,
66 .pfn = __phys_to_pfn(S5P6440_PA_UART(0)),
67 .length = SZ_4K,
68 .type = MT_DEVICE,
69 },
70};
71
72static struct map_desc s5p6450_iodesc[] __initdata = {
73 {
74 .virtual = (unsigned long)S3C_VA_UART,
75 .pfn = __phys_to_pfn(S5P6450_PA_UART(0)),
76 .length = SZ_512K,
77 .type = MT_DEVICE,
78 }, {
79 .virtual = (unsigned long)S3C_VA_UART + SZ_512K,
80 .pfn = __phys_to_pfn(S5P6450_PA_UART(5)),
81 .length = SZ_4K,
82 .type = MT_DEVICE,
83 },
84};
85
86static void s5p64x0_idle(void)
87{
88 unsigned long val;
89
90 if (!need_resched()) {
91 val = __raw_readl(S5P64X0_PWR_CFG);
92 val &= ~(0x3 << 5);
93 val |= (0x1 << 5);
94 __raw_writel(val, S5P64X0_PWR_CFG);
95
96 cpu_do_idle();
97 }
98 local_irq_enable();
99}
100
101/*
102 * s5p64x0_map_io
103 *
104 * register the standard CPU IO areas
105 */
106
107void __init s5p6440_map_io(void)
108{
109 /* initialize any device information early */
110 s3c_adc_setname("s3c64xx-adc");
111
112 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
113 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
114}
115
116void __init s5p6450_map_io(void)
117{
118 /* initialize any device information early */
119 s3c_adc_setname("s3c64xx-adc");
120
121 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
122 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6440_iodesc));
123}
124
125/*
126 * s5p64x0_init_clocks
127 *
128 * register and setup the CPU clocks
129 */
130
131void __init s5p6440_init_clocks(int xtal)
132{
133 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
134
135 s3c24xx_register_baseclocks(xtal);
136 s5p_register_clocks(xtal);
137 s5p6440_register_clocks();
138 s5p6440_setup_clocks();
139}
140
141void __init s5p6450_init_clocks(int xtal)
142{
143 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
144
145 s3c24xx_register_baseclocks(xtal);
146 s5p_register_clocks(xtal);
147 s5p6450_register_clocks();
148 s5p6450_setup_clocks();
149}
150
151/*
152 * s5p64x0_init_irq
153 *
154 * register the CPU interrupts
155 */
156
157void __init s5p6440_init_irq(void)
158{
159 /* S5P6440 supports 2 VIC */
160 u32 vic[2];
161
162 /*
163 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
164 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
165 */
166 vic[0] = 0xff800ae7;
167 vic[1] = 0xffbf23e5;
168
169 s5p_init_irq(vic, ARRAY_SIZE(vic));
170}
171
172void __init s5p6450_init_irq(void)
173{
174 /* S5P6450 supports only 2 VIC */
175 u32 vic[2];
176
177 /*
178 * VIC0 is missing IRQ_VIC0[(13-15), (21-22)]
179 * VIC1 is missing IRQ VIC1[12, 14, 23]
180 */
181 vic[0] = 0xff9f1fff;
182 vic[1] = 0xff7fafff;
183
184 s5p_init_irq(vic, ARRAY_SIZE(vic));
185}
186
187struct sysdev_class s5p64x0_sysclass = {
188 .name = "s5p64x0-core",
189};
190
191static struct sys_device s5p64x0_sysdev = {
192 .cls = &s5p64x0_sysclass,
193};
194
195static int __init s5p64x0_core_init(void)
196{
197 return sysdev_class_register(&s5p64x0_sysclass);
198}
199core_initcall(s5p64x0_core_init);
200
201int __init s5p64x0_init(void)
202{
203 printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n");
204
205 /* set idle function */
206 pm_idle = s5p64x0_idle;
207
208 return sysdev_register(&s5p64x0_sysdev);
209}
diff --git a/arch/arm/mach-s5p64x0/dev-audio.c b/arch/arm/mach-s5p64x0/dev-audio.c
new file mode 100644
index 000000000000..fa097bd68ca4
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/dev-audio.c
@@ -0,0 +1,164 @@
1/* linux/arch/arm/mach-s5p64x0/dev-audio.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14
15#include <plat/gpio-cfg.h>
16#include <plat/audio.h>
17
18#include <mach/map.h>
19#include <mach/dma.h>
20#include <mach/irqs.h>
21
22static int s5p6440_cfg_i2s(struct platform_device *pdev)
23{
24 /* configure GPIO for i2s port */
25 switch (pdev->id) {
26 case -1:
27 s3c_gpio_cfgpin(S5P6440_GPR(4), S3C_GPIO_SFN(5));
28 s3c_gpio_cfgpin(S5P6440_GPR(5), S3C_GPIO_SFN(5));
29 s3c_gpio_cfgpin(S5P6440_GPR(6), S3C_GPIO_SFN(5));
30 s3c_gpio_cfgpin(S5P6440_GPR(7), S3C_GPIO_SFN(5));
31 s3c_gpio_cfgpin(S5P6440_GPR(8), S3C_GPIO_SFN(5));
32 s3c_gpio_cfgpin(S5P6440_GPR(13), S3C_GPIO_SFN(5));
33 s3c_gpio_cfgpin(S5P6440_GPR(14), S3C_GPIO_SFN(5));
34 break;
35
36 default:
37 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
38 return -EINVAL;
39 }
40
41 return 0;
42}
43
44static int s5p6450_cfg_i2s(struct platform_device *pdev)
45{
46 /* configure GPIO for i2s port */
47 switch (pdev->id) {
48 case -1:
49 s3c_gpio_cfgpin(S5P6450_GPB(4), S3C_GPIO_SFN(5));
50 s3c_gpio_cfgpin(S5P6450_GPR(4), S3C_GPIO_SFN(5));
51 s3c_gpio_cfgpin(S5P6450_GPR(5), S3C_GPIO_SFN(5));
52 s3c_gpio_cfgpin(S5P6450_GPR(6), S3C_GPIO_SFN(5));
53 s3c_gpio_cfgpin(S5P6450_GPR(7), S3C_GPIO_SFN(5));
54 s3c_gpio_cfgpin(S5P6450_GPR(8), S3C_GPIO_SFN(5));
55 s3c_gpio_cfgpin(S5P6450_GPR(13), S3C_GPIO_SFN(5));
56 s3c_gpio_cfgpin(S5P6450_GPR(14), S3C_GPIO_SFN(5));
57 break;
58
59 default:
60 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
61 return -EINVAL;
62 }
63
64 return 0;
65}
66
67static struct s3c_audio_pdata s5p6440_i2s_pdata = {
68 .cfg_gpio = s5p6440_cfg_i2s,
69};
70
71static struct s3c_audio_pdata s5p6450_i2s_pdata = {
72 .cfg_gpio = s5p6450_cfg_i2s,
73};
74
75static struct resource s5p64x0_iis0_resource[] = {
76 [0] = {
77 .start = S5P64X0_PA_I2S,
78 .end = S5P64X0_PA_I2S + 0x100 - 1,
79 .flags = IORESOURCE_MEM,
80 },
81 [1] = {
82 .start = DMACH_I2S0_TX,
83 .end = DMACH_I2S0_TX,
84 .flags = IORESOURCE_DMA,
85 },
86 [2] = {
87 .start = DMACH_I2S0_RX,
88 .end = DMACH_I2S0_RX,
89 .flags = IORESOURCE_DMA,
90 },
91};
92
93struct platform_device s5p6440_device_iis = {
94 .name = "s3c64xx-iis-v4",
95 .id = -1,
96 .num_resources = ARRAY_SIZE(s5p64x0_iis0_resource),
97 .resource = s5p64x0_iis0_resource,
98 .dev = {
99 .platform_data = &s5p6440_i2s_pdata,
100 },
101};
102
103struct platform_device s5p6450_device_iis0 = {
104 .name = "s3c64xx-iis-v4",
105 .id = -1,
106 .num_resources = ARRAY_SIZE(s5p64x0_iis0_resource),
107 .resource = s5p64x0_iis0_resource,
108 .dev = {
109 .platform_data = &s5p6450_i2s_pdata,
110 },
111};
112
113/* PCM Controller platform_devices */
114
115static int s5p6440_pcm_cfg_gpio(struct platform_device *pdev)
116{
117 switch (pdev->id) {
118 case 0:
119 s3c_gpio_cfgpin(S5P6440_GPR(7), S3C_GPIO_SFN(2));
120 s3c_gpio_cfgpin(S5P6440_GPR(13), S3C_GPIO_SFN(2));
121 s3c_gpio_cfgpin(S5P6440_GPR(14), S3C_GPIO_SFN(2));
122 s3c_gpio_cfgpin(S5P6440_GPR(8), S3C_GPIO_SFN(2));
123 s3c_gpio_cfgpin(S5P6440_GPR(6), S3C_GPIO_SFN(2));
124 break;
125
126 default:
127 printk(KERN_DEBUG "Invalid PCM Controller number!");
128 return -EINVAL;
129 }
130
131 return 0;
132}
133
134static struct s3c_audio_pdata s5p6440_pcm_pdata = {
135 .cfg_gpio = s5p6440_pcm_cfg_gpio,
136};
137
138static struct resource s5p6440_pcm0_resource[] = {
139 [0] = {
140 .start = S5P64X0_PA_PCM,
141 .end = S5P64X0_PA_PCM + 0x100 - 1,
142 .flags = IORESOURCE_MEM,
143 },
144 [1] = {
145 .start = DMACH_PCM0_TX,
146 .end = DMACH_PCM0_TX,
147 .flags = IORESOURCE_DMA,
148 },
149 [2] = {
150 .start = DMACH_PCM0_RX,
151 .end = DMACH_PCM0_RX,
152 .flags = IORESOURCE_DMA,
153 },
154};
155
156struct platform_device s5p6440_device_pcm = {
157 .name = "samsung-pcm",
158 .id = 0,
159 .num_resources = ARRAY_SIZE(s5p6440_pcm0_resource),
160 .resource = s5p6440_pcm0_resource,
161 .dev = {
162 .platform_data = &s5p6440_pcm_pdata,
163 },
164};
diff --git a/arch/arm/mach-s5p64x0/dev-spi.c b/arch/arm/mach-s5p64x0/dev-spi.c
new file mode 100644
index 000000000000..5b69ec4c8af3
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/dev-spi.c
@@ -0,0 +1,232 @@
1/* linux/arch/arm/mach-s5p64x0/dev-spi.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
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/platform_device.h>
15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
17
18#include <mach/dma.h>
19#include <mach/map.h>
20#include <mach/irqs.h>
21#include <mach/regs-clock.h>
22#include <mach/spi-clocks.h>
23
24#include <plat/s3c64xx-spi.h>
25#include <plat/gpio-cfg.h>
26
27static char *s5p64x0_spi_src_clks[] = {
28 [S5P64X0_SPI_SRCCLK_PCLK] = "pclk",
29 [S5P64X0_SPI_SRCCLK_SCLK] = "sclk_spi",
30};
31
32/* SPI Controller platform_devices */
33
34/* Since we emulate multi-cs capability, we do not touch the CS.
35 * The emulated CS is toggled by board specific mechanism, as it can
36 * be either some immediate GPIO or some signal out of some other
37 * chip in between ... or some yet another way.
38 * We simply do not assume anything about CS.
39 */
40static int s5p6440_spi_cfg_gpio(struct platform_device *pdev)
41{
42 switch (pdev->id) {
43 case 0:
44 s3c_gpio_cfgpin(S5P6440_GPC(0), S3C_GPIO_SFN(2));
45 s3c_gpio_cfgpin(S5P6440_GPC(1), S3C_GPIO_SFN(2));
46 s3c_gpio_cfgpin(S5P6440_GPC(2), S3C_GPIO_SFN(2));
47 s3c_gpio_setpull(S5P6440_GPC(0), S3C_GPIO_PULL_UP);
48 s3c_gpio_setpull(S5P6440_GPC(1), S3C_GPIO_PULL_UP);
49 s3c_gpio_setpull(S5P6440_GPC(2), S3C_GPIO_PULL_UP);
50 break;
51
52 case 1:
53 s3c_gpio_cfgpin(S5P6440_GPC(4), S3C_GPIO_SFN(2));
54 s3c_gpio_cfgpin(S5P6440_GPC(5), S3C_GPIO_SFN(2));
55 s3c_gpio_cfgpin(S5P6440_GPC(6), S3C_GPIO_SFN(2));
56 s3c_gpio_setpull(S5P6440_GPC(4), S3C_GPIO_PULL_UP);
57 s3c_gpio_setpull(S5P6440_GPC(5), S3C_GPIO_PULL_UP);
58 s3c_gpio_setpull(S5P6440_GPC(6), S3C_GPIO_PULL_UP);
59 break;
60
61 default:
62 dev_err(&pdev->dev, "Invalid SPI Controller number!");
63 return -EINVAL;
64 }
65
66 return 0;
67}
68
69static int s5p6450_spi_cfg_gpio(struct platform_device *pdev)
70{
71 switch (pdev->id) {
72 case 0:
73 s3c_gpio_cfgpin(S5P6450_GPC(0), S3C_GPIO_SFN(2));
74 s3c_gpio_cfgpin(S5P6450_GPC(1), S3C_GPIO_SFN(2));
75 s3c_gpio_cfgpin(S5P6450_GPC(2), S3C_GPIO_SFN(2));
76 s3c_gpio_setpull(S5P6450_GPC(0), S3C_GPIO_PULL_UP);
77 s3c_gpio_setpull(S5P6450_GPC(1), S3C_GPIO_PULL_UP);
78 s3c_gpio_setpull(S5P6450_GPC(2), S3C_GPIO_PULL_UP);
79 break;
80
81 case 1:
82 s3c_gpio_cfgpin(S5P6450_GPC(4), S3C_GPIO_SFN(2));
83 s3c_gpio_cfgpin(S5P6450_GPC(5), S3C_GPIO_SFN(2));
84 s3c_gpio_cfgpin(S5P6450_GPC(6), S3C_GPIO_SFN(2));
85 s3c_gpio_setpull(S5P6450_GPC(4), S3C_GPIO_PULL_UP);
86 s3c_gpio_setpull(S5P6450_GPC(5), S3C_GPIO_PULL_UP);
87 s3c_gpio_setpull(S5P6450_GPC(6), S3C_GPIO_PULL_UP);
88 break;
89
90 default:
91 dev_err(&pdev->dev, "Invalid SPI Controller number!");
92 return -EINVAL;
93 }
94
95 return 0;
96}
97
98static struct resource s5p64x0_spi0_resource[] = {
99 [0] = {
100 .start = S5P64X0_PA_SPI0,
101 .end = S5P64X0_PA_SPI0 + 0x100 - 1,
102 .flags = IORESOURCE_MEM,
103 },
104 [1] = {
105 .start = DMACH_SPI0_TX,
106 .end = DMACH_SPI0_TX,
107 .flags = IORESOURCE_DMA,
108 },
109 [2] = {
110 .start = DMACH_SPI0_RX,
111 .end = DMACH_SPI0_RX,
112 .flags = IORESOURCE_DMA,
113 },
114 [3] = {
115 .start = IRQ_SPI0,
116 .end = IRQ_SPI0,
117 .flags = IORESOURCE_IRQ,
118 },
119};
120
121static struct s3c64xx_spi_info s5p6440_spi0_pdata = {
122 .cfg_gpio = s5p6440_spi_cfg_gpio,
123 .fifo_lvl_mask = 0x1ff,
124 .rx_lvl_offset = 15,
125};
126
127static struct s3c64xx_spi_info s5p6450_spi0_pdata = {
128 .cfg_gpio = s5p6450_spi_cfg_gpio,
129 .fifo_lvl_mask = 0x1ff,
130 .rx_lvl_offset = 15,
131};
132
133static u64 spi_dmamask = DMA_BIT_MASK(32);
134
135struct platform_device s5p64x0_device_spi0 = {
136 .name = "s3c64xx-spi",
137 .id = 0,
138 .num_resources = ARRAY_SIZE(s5p64x0_spi0_resource),
139 .resource = s5p64x0_spi0_resource,
140 .dev = {
141 .dma_mask = &spi_dmamask,
142 .coherent_dma_mask = DMA_BIT_MASK(32),
143 },
144};
145
146static struct resource s5p64x0_spi1_resource[] = {
147 [0] = {
148 .start = S5P64X0_PA_SPI1,
149 .end = S5P64X0_PA_SPI1 + 0x100 - 1,
150 .flags = IORESOURCE_MEM,
151 },
152 [1] = {
153 .start = DMACH_SPI1_TX,
154 .end = DMACH_SPI1_TX,
155 .flags = IORESOURCE_DMA,
156 },
157 [2] = {
158 .start = DMACH_SPI1_RX,
159 .end = DMACH_SPI1_RX,
160 .flags = IORESOURCE_DMA,
161 },
162 [3] = {
163 .start = IRQ_SPI1,
164 .end = IRQ_SPI1,
165 .flags = IORESOURCE_IRQ,
166 },
167};
168
169static struct s3c64xx_spi_info s5p6440_spi1_pdata = {
170 .cfg_gpio = s5p6440_spi_cfg_gpio,
171 .fifo_lvl_mask = 0x7f,
172 .rx_lvl_offset = 15,
173};
174
175static struct s3c64xx_spi_info s5p6450_spi1_pdata = {
176 .cfg_gpio = s5p6450_spi_cfg_gpio,
177 .fifo_lvl_mask = 0x7f,
178 .rx_lvl_offset = 15,
179};
180
181struct platform_device s5p64x0_device_spi1 = {
182 .name = "s3c64xx-spi",
183 .id = 1,
184 .num_resources = ARRAY_SIZE(s5p64x0_spi1_resource),
185 .resource = s5p64x0_spi1_resource,
186 .dev = {
187 .dma_mask = &spi_dmamask,
188 .coherent_dma_mask = DMA_BIT_MASK(32),
189 },
190};
191
192void __init s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
193{
194 unsigned int id;
195 struct s3c64xx_spi_info *pd;
196
197 id = __raw_readl(S5P64X0_SYS_ID) & 0xFF000;
198
199 /* Reject invalid configuration */
200 if (!num_cs || src_clk_nr < 0
201 || src_clk_nr > S5P64X0_SPI_SRCCLK_SCLK) {
202 printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
203 return;
204 }
205
206 switch (cntrlr) {
207 case 0:
208 if (id == 0x50000)
209 pd = &s5p6450_spi0_pdata;
210 else
211 pd = &s5p6440_spi0_pdata;
212
213 s5p64x0_device_spi0.dev.platform_data = pd;
214 break;
215 case 1:
216 if (id == 0x50000)
217 pd = &s5p6450_spi1_pdata;
218 else
219 pd = &s5p6440_spi1_pdata;
220
221 s5p64x0_device_spi1.dev.platform_data = pd;
222 break;
223 default:
224 printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
225 __func__, cntrlr);
226 return;
227 }
228
229 pd->num_cs = num_cs;
230 pd->src_clk_nr = src_clk_nr;
231 pd->src_clk_name = s5p64x0_spi_src_clks[src_clk_nr];
232}
diff --git a/arch/arm/mach-s5p6440/dma.c b/arch/arm/mach-s5p64x0/dma.c
index 07606ad57519..29a8c2410049 100644
--- a/arch/arm/mach-s5p6440/dma.c
+++ b/arch/arm/mach-s5p64x0/dma.c
@@ -1,4 +1,8 @@
1/* 1/* linux/arch/arm/mach-s5p64x0/dma.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
2 * Copyright (C) 2010 Samsung Electronics Co. Ltd. 6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
3 * Jaswinder Singh <jassi.brar@samsung.com> 7 * Jaswinder Singh <jassi.brar@samsung.com>
4 * 8 *
@@ -15,26 +19,25 @@
15 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */ 22*/
19 23
20#include <linux/platform_device.h> 24#include <linux/platform_device.h>
21#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
22 26
23#include <plat/devs.h>
24#include <plat/irqs.h>
25
26#include <mach/map.h> 27#include <mach/map.h>
27#include <mach/irqs.h> 28#include <mach/irqs.h>
29#include <mach/regs-clock.h>
28 30
31#include <plat/devs.h>
29#include <plat/s3c-pl330-pdata.h> 32#include <plat/s3c-pl330-pdata.h>
30 33
31static u64 dma_dmamask = DMA_BIT_MASK(32); 34static u64 dma_dmamask = DMA_BIT_MASK(32);
32 35
33static struct resource s5p6440_pdma_resource[] = { 36static struct resource s5p64x0_pdma_resource[] = {
34 [0] = { 37 [0] = {
35 .start = S5P6440_PA_PDMA, 38 .start = S5P64X0_PA_PDMA,
36 .end = S5P6440_PA_PDMA + SZ_4K, 39 .end = S5P64X0_PA_PDMA + SZ_4K,
37 .flags = IORESOURCE_MEM, 40 .flags = IORESOURCE_MEM,
38 }, 41 },
39 [1] = { 42 [1] = {
40 .start = IRQ_DMA0, 43 .start = IRQ_DMA0,
@@ -80,26 +83,67 @@ static struct s3c_pl330_platdata s5p6440_pdma_pdata = {
80 }, 83 },
81}; 84};
82 85
83static struct platform_device s5p6440_device_pdma = { 86static struct s3c_pl330_platdata s5p6450_pdma_pdata = {
87 .peri = {
88 [0] = DMACH_UART0_RX,
89 [1] = DMACH_UART0_TX,
90 [2] = DMACH_UART1_RX,
91 [3] = DMACH_UART1_TX,
92 [4] = DMACH_UART2_RX,
93 [5] = DMACH_UART2_TX,
94 [6] = DMACH_UART3_RX,
95 [7] = DMACH_UART3_TX,
96 [8] = DMACH_UART4_RX,
97 [9] = DMACH_UART4_TX,
98 [10] = DMACH_PCM0_TX,
99 [11] = DMACH_PCM0_RX,
100 [12] = DMACH_I2S0_TX,
101 [13] = DMACH_I2S0_RX,
102 [14] = DMACH_SPI0_TX,
103 [15] = DMACH_SPI0_RX,
104 [16] = DMACH_PCM1_TX,
105 [17] = DMACH_PCM1_RX,
106 [18] = DMACH_PCM2_TX,
107 [19] = DMACH_PCM2_RX,
108 [20] = DMACH_SPI1_TX,
109 [21] = DMACH_SPI1_RX,
110 [22] = DMACH_USI_TX,
111 [23] = DMACH_USI_RX,
112 [24] = DMACH_MAX,
113 [25] = DMACH_I2S1_TX,
114 [26] = DMACH_I2S1_RX,
115 [27] = DMACH_I2S2_TX,
116 [28] = DMACH_I2S2_RX,
117 [29] = DMACH_PWM,
118 [30] = DMACH_UART5_RX,
119 [31] = DMACH_UART5_TX,
120 },
121};
122
123static struct platform_device s5p64x0_device_pdma = {
84 .name = "s3c-pl330", 124 .name = "s3c-pl330",
85 .id = 1, 125 .id = 0,
86 .num_resources = ARRAY_SIZE(s5p6440_pdma_resource), 126 .num_resources = ARRAY_SIZE(s5p64x0_pdma_resource),
87 .resource = s5p6440_pdma_resource, 127 .resource = s5p64x0_pdma_resource,
88 .dev = { 128 .dev = {
89 .dma_mask = &dma_dmamask, 129 .dma_mask = &dma_dmamask,
90 .coherent_dma_mask = DMA_BIT_MASK(32), 130 .coherent_dma_mask = DMA_BIT_MASK(32),
91 .platform_data = &s5p6440_pdma_pdata,
92 }, 131 },
93}; 132};
94 133
95static struct platform_device *s5p6440_dmacs[] __initdata = { 134static int __init s5p64x0_dma_init(void)
96 &s5p6440_device_pdma,
97};
98
99static int __init s5p6440_dma_init(void)
100{ 135{
101 platform_add_devices(s5p6440_dmacs, ARRAY_SIZE(s5p6440_dmacs)); 136 unsigned int id;
137
138 id = __raw_readl(S5P64X0_SYS_ID) & 0xFF000;
139
140 if (id == 0x50000)
141 s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata;
142 else
143 s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata;
144
145 platform_device_register(&s5p64x0_device_pdma);
102 146
103 return 0; 147 return 0;
104} 148}
105arch_initcall(s5p6440_dma_init); 149arch_initcall(s5p64x0_dma_init);
diff --git a/arch/arm/mach-s5p6440/gpio.c b/arch/arm/mach-s5p64x0/gpio.c
index 8bf6e0ce51c9..39159dd5a29a 100644
--- a/arch/arm/mach-s5p6440/gpio.c
+++ b/arch/arm/mach-s5p64x0/gpio.c
@@ -1,14 +1,14 @@
1/* arch/arm/mach-s5p6440/gpio.c 1/* linux/arch/arm/mach-s5p64x0/gpio.c
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * S5P6440 - GPIOlib support 6 * S5P64X0 - GPIOlib support
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11*/
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
@@ -22,26 +22,29 @@
22#include <plat/gpio-cfg.h> 22#include <plat/gpio-cfg.h>
23#include <plat/gpio-cfg-helpers.h> 23#include <plat/gpio-cfg-helpers.h>
24 24
25/* GPIO bank summary: 25/* To be implemented S5P6450 GPIO */
26* 26
27* Bank GPIOs Style SlpCon ExtInt Group 27/*
28* A 6 4Bit Yes 1 28 * S5P6440 GPIO bank summary:
29* B 7 4Bit Yes 1 29 *
30* C 8 4Bit Yes 2 30 * Bank GPIOs Style SlpCon ExtInt Group
31* F 2 2Bit Yes 4 [1] 31 * A 6 4Bit Yes 1
32* G 7 4Bit Yes 5 32 * B 7 4Bit Yes 1
33* H 10 4Bit[2] Yes 6 33 * C 8 4Bit Yes 2
34* I 16 2Bit Yes None 34 * F 2 2Bit Yes 4 [1]
35* J 12 2Bit Yes None 35 * G 7 4Bit Yes 5
36* N 16 2Bit No IRQ_EINT 36 * H 10 4Bit[2] Yes 6
37* P 8 2Bit Yes 8 37 * I 16 2Bit Yes None
38* R 15 4Bit[2] Yes 8 38 * J 12 2Bit Yes None
39* 39 * N 16 2Bit No IRQ_EINT
40* [1] BANKF pins 14,15 do not form part of the external interrupt sources 40 * P 8 2Bit Yes 8
41* [2] BANK has two control registers, GPxCON0 and GPxCON1 41 * R 15 4Bit[2] Yes 8
42*/ 42 *
43 * [1] BANKF pins 14,15 do not form part of the external interrupt sources
44 * [2] BANK has two control registers, GPxCON0 and GPxCON1
45 */
43 46
44static int s5p6440_gpiolib_rbank_4bit2_input(struct gpio_chip *chip, 47static int s5p64x0_gpiolib_rbank_4bit2_input(struct gpio_chip *chip,
45 unsigned int offset) 48 unsigned int offset)
46{ 49{
47 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); 50 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
@@ -77,7 +80,7 @@ static int s5p6440_gpiolib_rbank_4bit2_input(struct gpio_chip *chip,
77 return 0; 80 return 0;
78} 81}
79 82
80static int s5p6440_gpiolib_rbank_4bit2_output(struct gpio_chip *chip, 83static int s5p64x0_gpiolib_rbank_4bit2_output(struct gpio_chip *chip,
81 unsigned int offset, int value) 84 unsigned int offset, int value)
82{ 85{
83 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); 86 struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip);
@@ -124,12 +127,11 @@ static int s5p6440_gpiolib_rbank_4bit2_output(struct gpio_chip *chip,
124 return 0; 127 return 0;
125} 128}
126 129
127int s5p6440_gpio_setcfg_4bit_rbank(struct s3c_gpio_chip *chip, 130int s5p64x0_gpio_setcfg_4bit_rbank(struct s3c_gpio_chip *chip,
128 unsigned int off, unsigned int cfg) 131 unsigned int off, unsigned int cfg)
129{ 132{
130 void __iomem *reg = chip->base; 133 void __iomem *reg = chip->base;
131 unsigned int shift; 134 unsigned int shift;
132 unsigned long flags;
133 u32 con; 135 u32 con;
134 136
135 switch (off) { 137 switch (off) {
@@ -155,26 +157,22 @@ int s5p6440_gpio_setcfg_4bit_rbank(struct s3c_gpio_chip *chip,
155 cfg <<= shift; 157 cfg <<= shift;
156 } 158 }
157 159
158 s3c_gpio_lock(chip, flags);
159
160 con = __raw_readl(reg); 160 con = __raw_readl(reg);
161 con &= ~(0xf << shift); 161 con &= ~(0xf << shift);
162 con |= cfg; 162 con |= cfg;
163 __raw_writel(con, reg); 163 __raw_writel(con, reg);
164 164
165 s3c_gpio_unlock(chip, flags);
166
167 return 0; 165 return 0;
168} 166}
169 167
170static struct s3c_gpio_cfg s5p6440_gpio_cfgs[] = { 168static struct s3c_gpio_cfg s5p64x0_gpio_cfgs[] = {
171 { 169 {
172 .cfg_eint = 0, 170 .cfg_eint = 0,
173 }, { 171 }, {
174 .cfg_eint = 7, 172 .cfg_eint = 7,
175 }, { 173 }, {
176 .cfg_eint = 3, 174 .cfg_eint = 3,
177 .set_config = s5p6440_gpio_setcfg_4bit_rbank, 175 .set_config = s5p64x0_gpio_setcfg_4bit_rbank,
178 }, { 176 }, {
179 .cfg_eint = 0, 177 .cfg_eint = 0,
180 .set_config = s3c_gpio_setcfg_s3c24xx, 178 .set_config = s3c_gpio_setcfg_s3c24xx,
@@ -193,7 +191,7 @@ static struct s3c_gpio_cfg s5p6440_gpio_cfgs[] = {
193static struct s3c_gpio_chip s5p6440_gpio_4bit[] = { 191static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
194 { 192 {
195 .base = S5P6440_GPA_BASE, 193 .base = S5P6440_GPA_BASE,
196 .config = &s5p6440_gpio_cfgs[1], 194 .config = &s5p64x0_gpio_cfgs[1],
197 .chip = { 195 .chip = {
198 .base = S5P6440_GPA(0), 196 .base = S5P6440_GPA(0),
199 .ngpio = S5P6440_GPIO_A_NR, 197 .ngpio = S5P6440_GPIO_A_NR,
@@ -201,7 +199,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
201 }, 199 },
202 }, { 200 }, {
203 .base = S5P6440_GPB_BASE, 201 .base = S5P6440_GPB_BASE,
204 .config = &s5p6440_gpio_cfgs[1], 202 .config = &s5p64x0_gpio_cfgs[1],
205 .chip = { 203 .chip = {
206 .base = S5P6440_GPB(0), 204 .base = S5P6440_GPB(0),
207 .ngpio = S5P6440_GPIO_B_NR, 205 .ngpio = S5P6440_GPIO_B_NR,
@@ -209,7 +207,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
209 }, 207 },
210 }, { 208 }, {
211 .base = S5P6440_GPC_BASE, 209 .base = S5P6440_GPC_BASE,
212 .config = &s5p6440_gpio_cfgs[1], 210 .config = &s5p64x0_gpio_cfgs[1],
213 .chip = { 211 .chip = {
214 .base = S5P6440_GPC(0), 212 .base = S5P6440_GPC(0),
215 .ngpio = S5P6440_GPIO_C_NR, 213 .ngpio = S5P6440_GPIO_C_NR,
@@ -217,7 +215,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
217 }, 215 },
218 }, { 216 }, {
219 .base = S5P6440_GPG_BASE, 217 .base = S5P6440_GPG_BASE,
220 .config = &s5p6440_gpio_cfgs[1], 218 .config = &s5p64x0_gpio_cfgs[1],
221 .chip = { 219 .chip = {
222 .base = S5P6440_GPG(0), 220 .base = S5P6440_GPG(0),
223 .ngpio = S5P6440_GPIO_G_NR, 221 .ngpio = S5P6440_GPIO_G_NR,
@@ -229,7 +227,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
229static struct s3c_gpio_chip s5p6440_gpio_4bit2[] = { 227static struct s3c_gpio_chip s5p6440_gpio_4bit2[] = {
230 { 228 {
231 .base = S5P6440_GPH_BASE + 0x4, 229 .base = S5P6440_GPH_BASE + 0x4,
232 .config = &s5p6440_gpio_cfgs[1], 230 .config = &s5p64x0_gpio_cfgs[1],
233 .chip = { 231 .chip = {
234 .base = S5P6440_GPH(0), 232 .base = S5P6440_GPH(0),
235 .ngpio = S5P6440_GPIO_H_NR, 233 .ngpio = S5P6440_GPIO_H_NR,
@@ -238,10 +236,10 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit2[] = {
238 }, 236 },
239}; 237};
240 238
241static struct s3c_gpio_chip gpio_rbank_4bit2[] = { 239static struct s3c_gpio_chip s5p6440_gpio_rbank_4bit2[] = {
242 { 240 {
243 .base = S5P6440_GPR_BASE + 0x4, 241 .base = S5P6440_GPR_BASE + 0x4,
244 .config = &s5p6440_gpio_cfgs[2], 242 .config = &s5p64x0_gpio_cfgs[2],
245 .chip = { 243 .chip = {
246 .base = S5P6440_GPR(0), 244 .base = S5P6440_GPR(0),
247 .ngpio = S5P6440_GPIO_R_NR, 245 .ngpio = S5P6440_GPIO_R_NR,
@@ -253,7 +251,7 @@ static struct s3c_gpio_chip gpio_rbank_4bit2[] = {
253static struct s3c_gpio_chip s5p6440_gpio_2bit[] = { 251static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
254 { 252 {
255 .base = S5P6440_GPF_BASE, 253 .base = S5P6440_GPF_BASE,
256 .config = &s5p6440_gpio_cfgs[5], 254 .config = &s5p64x0_gpio_cfgs[5],
257 .chip = { 255 .chip = {
258 .base = S5P6440_GPF(0), 256 .base = S5P6440_GPF(0),
259 .ngpio = S5P6440_GPIO_F_NR, 257 .ngpio = S5P6440_GPIO_F_NR,
@@ -261,7 +259,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
261 }, 259 },
262 }, { 260 }, {
263 .base = S5P6440_GPI_BASE, 261 .base = S5P6440_GPI_BASE,
264 .config = &s5p6440_gpio_cfgs[3], 262 .config = &s5p64x0_gpio_cfgs[3],
265 .chip = { 263 .chip = {
266 .base = S5P6440_GPI(0), 264 .base = S5P6440_GPI(0),
267 .ngpio = S5P6440_GPIO_I_NR, 265 .ngpio = S5P6440_GPIO_I_NR,
@@ -269,7 +267,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
269 }, 267 },
270 }, { 268 }, {
271 .base = S5P6440_GPJ_BASE, 269 .base = S5P6440_GPJ_BASE,
272 .config = &s5p6440_gpio_cfgs[3], 270 .config = &s5p64x0_gpio_cfgs[3],
273 .chip = { 271 .chip = {
274 .base = S5P6440_GPJ(0), 272 .base = S5P6440_GPJ(0),
275 .ngpio = S5P6440_GPIO_J_NR, 273 .ngpio = S5P6440_GPIO_J_NR,
@@ -277,7 +275,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
277 }, 275 },
278 }, { 276 }, {
279 .base = S5P6440_GPN_BASE, 277 .base = S5P6440_GPN_BASE,
280 .config = &s5p6440_gpio_cfgs[4], 278 .config = &s5p64x0_gpio_cfgs[4],
281 .chip = { 279 .chip = {
282 .base = S5P6440_GPN(0), 280 .base = S5P6440_GPN(0),
283 .ngpio = S5P6440_GPIO_N_NR, 281 .ngpio = S5P6440_GPIO_N_NR,
@@ -285,7 +283,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
285 }, 283 },
286 }, { 284 }, {
287 .base = S5P6440_GPP_BASE, 285 .base = S5P6440_GPP_BASE,
288 .config = &s5p6440_gpio_cfgs[5], 286 .config = &s5p64x0_gpio_cfgs[5],
289 .chip = { 287 .chip = {
290 .base = S5P6440_GPP(0), 288 .base = S5P6440_GPP(0),
291 .ngpio = S5P6440_GPIO_P_NR, 289 .ngpio = S5P6440_GPIO_P_NR,
@@ -294,7 +292,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
294 }, 292 },
295}; 293};
296 294
297void __init s5p6440_gpiolib_set_cfg(struct s3c_gpio_cfg *chipcfg, int nr_chips) 295void __init s5p64x0_gpiolib_set_cfg(struct s3c_gpio_cfg *chipcfg, int nr_chips)
298{ 296{
299 for (; nr_chips > 0; nr_chips--, chipcfg++) { 297 for (; nr_chips > 0; nr_chips--, chipcfg++) {
300 if (!chipcfg->set_config) 298 if (!chipcfg->set_config)
@@ -308,13 +306,13 @@ void __init s5p6440_gpiolib_set_cfg(struct s3c_gpio_cfg *chipcfg, int nr_chips)
308 } 306 }
309} 307}
310 308
311static void __init s5p6440_gpio_add_rbank_4bit2(struct s3c_gpio_chip *chip, 309static void __init s5p64x0_gpio_add_rbank_4bit2(struct s3c_gpio_chip *chip,
312 int nr_chips) 310 int nr_chips)
313{ 311{
314 for (; nr_chips > 0; nr_chips--, chip++) { 312 for (; nr_chips > 0; nr_chips--, chip++) {
315 chip->chip.direction_input = s5p6440_gpiolib_rbank_4bit2_input; 313 chip->chip.direction_input = s5p64x0_gpiolib_rbank_4bit2_input;
316 chip->chip.direction_output = 314 chip->chip.direction_output =
317 s5p6440_gpiolib_rbank_4bit2_output; 315 s5p64x0_gpiolib_rbank_4bit2_output;
318 s3c_gpiolib_add(chip); 316 s3c_gpiolib_add(chip);
319 } 317 }
320} 318}
@@ -324,8 +322,8 @@ static int __init s5p6440_gpiolib_init(void)
324 struct s3c_gpio_chip *chips = s5p6440_gpio_2bit; 322 struct s3c_gpio_chip *chips = s5p6440_gpio_2bit;
325 int nr_chips = ARRAY_SIZE(s5p6440_gpio_2bit); 323 int nr_chips = ARRAY_SIZE(s5p6440_gpio_2bit);
326 324
327 s5p6440_gpiolib_set_cfg(s5p6440_gpio_cfgs, 325 s5p64x0_gpiolib_set_cfg(s5p64x0_gpio_cfgs,
328 ARRAY_SIZE(s5p6440_gpio_cfgs)); 326 ARRAY_SIZE(s5p64x0_gpio_cfgs));
329 327
330 for (; nr_chips > 0; nr_chips--, chips++) 328 for (; nr_chips > 0; nr_chips--, chips++)
331 s3c_gpiolib_add(chips); 329 s3c_gpiolib_add(chips);
@@ -336,8 +334,8 @@ static int __init s5p6440_gpiolib_init(void)
336 samsung_gpiolib_add_4bit2_chips(s5p6440_gpio_4bit2, 334 samsung_gpiolib_add_4bit2_chips(s5p6440_gpio_4bit2,
337 ARRAY_SIZE(s5p6440_gpio_4bit2)); 335 ARRAY_SIZE(s5p6440_gpio_4bit2));
338 336
339 s5p6440_gpio_add_rbank_4bit2(gpio_rbank_4bit2, 337 s5p64x0_gpio_add_rbank_4bit2(s5p6440_gpio_rbank_4bit2,
340 ARRAY_SIZE(gpio_rbank_4bit2)); 338 ARRAY_SIZE(s5p6440_gpio_rbank_4bit2));
341 339
342 return 0; 340 return 0;
343} 341}
diff --git a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
new file mode 100644
index 000000000000..79b04e6a6f8e
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
@@ -0,0 +1,33 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.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/* pull in the relevant register and map files. */
12
13#include <plat/map-base.h>
14#include <plat/map-s5p.h>
15
16#include <plat/regs-serial.h>
17
18 .macro addruart, rp, rv
19 mov \rp, #0xE0000000
20 orr \rp, \rp, #0x00100000
21 ldr \rp, [\rp, #0x118 ]
22 and \rp, \rp, #0xff000
23 teq \rp, #0x50000 @@ S5P6450
24 ldreq \rp, =0xEC800000
25 movne \rp, #0xEC000000 @@ S5P6440
26 ldrne \rv, = S3C_VA_UART
27#if CONFIG_DEBUG_S3C_UART != 0
28 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
29 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
30#endif
31 .endm
32
33#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-s5p6440/include/mach/dma.h b/arch/arm/mach-s5p64x0/include/mach/dma.h
index 81209eb1409b..81209eb1409b 100644
--- a/arch/arm/mach-s5p6440/include/mach/dma.h
+++ b/arch/arm/mach-s5p64x0/include/mach/dma.h
diff --git a/arch/arm/mach-s5p6440/include/mach/entry-macro.S b/arch/arm/mach-s5p64x0/include/mach/entry-macro.S
index e65f1b967262..10b62b4f8211 100644
--- a/arch/arm/mach-s5p6440/include/mach/entry-macro.S
+++ b/arch/arm/mach-s5p64x0/include/mach/entry-macro.S
@@ -1,9 +1,9 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/entry-macro.S 1/* linux/arch/arm/mach-s5p64x0/include/mach/entry-macro.S
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * Low-level IRQ helper macros for the Samsung S5P6440 6 * Low-level IRQ helper macros for the Samsung S5P64X0
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s5p64x0/include/mach/gpio.h b/arch/arm/mach-s5p64x0/include/mach/gpio.h
new file mode 100644
index 000000000000..5486c8f01f1d
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/gpio.h
@@ -0,0 +1,139 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/gpio.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - GPIO lib 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
13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__
15
16#define gpio_get_value __gpio_get_value
17#define gpio_set_value __gpio_set_value
18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq
20
21/* GPIO bank sizes */
22
23#define S5P6440_GPIO_A_NR (6)
24#define S5P6440_GPIO_B_NR (7)
25#define S5P6440_GPIO_C_NR (8)
26#define S5P6440_GPIO_F_NR (2)
27#define S5P6440_GPIO_G_NR (7)
28#define S5P6440_GPIO_H_NR (10)
29#define S5P6440_GPIO_I_NR (16)
30#define S5P6440_GPIO_J_NR (12)
31#define S5P6440_GPIO_N_NR (16)
32#define S5P6440_GPIO_P_NR (8)
33#define S5P6440_GPIO_R_NR (15)
34
35#define S5P6450_GPIO_A_NR (6)
36#define S5P6450_GPIO_B_NR (7)
37#define S5P6450_GPIO_C_NR (8)
38#define S5P6450_GPIO_D_NR (8)
39#define S5P6450_GPIO_F_NR (2)
40#define S5P6450_GPIO_G_NR (14)
41#define S5P6450_GPIO_H_NR (10)
42#define S5P6450_GPIO_I_NR (16)
43#define S5P6450_GPIO_J_NR (12)
44#define S5P6450_GPIO_K_NR (5)
45#define S5P6450_GPIO_N_NR (16)
46#define S5P6450_GPIO_P_NR (11)
47#define S5P6450_GPIO_Q_NR (14)
48#define S5P6450_GPIO_R_NR (15)
49#define S5P6450_GPIO_S_NR (8)
50
51/* GPIO bank numbers */
52
53/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
54 * space for debugging purposes so that any accidental
55 * change from one gpio bank to another can be caught.
56*/
57
58#define S5P64X0_GPIO_NEXT(__gpio) \
59 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
60
61enum s5p6440_gpio_number {
62 S5P6440_GPIO_A_START = 0,
63 S5P6440_GPIO_B_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_A),
64 S5P6440_GPIO_C_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_B),
65 S5P6440_GPIO_F_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_C),
66 S5P6440_GPIO_G_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_F),
67 S5P6440_GPIO_H_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_G),
68 S5P6440_GPIO_I_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_H),
69 S5P6440_GPIO_J_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_I),
70 S5P6440_GPIO_N_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_J),
71 S5P6440_GPIO_P_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_N),
72 S5P6440_GPIO_R_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_P),
73};
74
75enum s5p6450_gpio_number {
76 S5P6450_GPIO_A_START = 0,
77 S5P6450_GPIO_B_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_A),
78 S5P6450_GPIO_C_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_B),
79 S5P6450_GPIO_D_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_C),
80 S5P6450_GPIO_F_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_D),
81 S5P6450_GPIO_G_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_F),
82 S5P6450_GPIO_H_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_G),
83 S5P6450_GPIO_I_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_H),
84 S5P6450_GPIO_J_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_I),
85 S5P6450_GPIO_K_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_J),
86 S5P6450_GPIO_N_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_K),
87 S5P6450_GPIO_P_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_N),
88 S5P6450_GPIO_Q_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_P),
89 S5P6450_GPIO_R_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_Q),
90 S5P6450_GPIO_S_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_R),
91};
92
93/* GPIO number definitions */
94
95#define S5P6440_GPA(_nr) (S5P6440_GPIO_A_START + (_nr))
96#define S5P6440_GPB(_nr) (S5P6440_GPIO_B_START + (_nr))
97#define S5P6440_GPC(_nr) (S5P6440_GPIO_C_START + (_nr))
98#define S5P6440_GPF(_nr) (S5P6440_GPIO_F_START + (_nr))
99#define S5P6440_GPG(_nr) (S5P6440_GPIO_G_START + (_nr))
100#define S5P6440_GPH(_nr) (S5P6440_GPIO_H_START + (_nr))
101#define S5P6440_GPI(_nr) (S5P6440_GPIO_I_START + (_nr))
102#define S5P6440_GPJ(_nr) (S5P6440_GPIO_J_START + (_nr))
103#define S5P6440_GPN(_nr) (S5P6440_GPIO_N_START + (_nr))
104#define S5P6440_GPP(_nr) (S5P6440_GPIO_P_START + (_nr))
105#define S5P6440_GPR(_nr) (S5P6440_GPIO_R_START + (_nr))
106
107#define S5P6450_GPA(_nr) (S5P6450_GPIO_A_START + (_nr))
108#define S5P6450_GPB(_nr) (S5P6450_GPIO_B_START + (_nr))
109#define S5P6450_GPC(_nr) (S5P6450_GPIO_C_START + (_nr))
110#define S5P6450_GPD(_nr) (S5P6450_GPIO_D_START + (_nr))
111#define S5P6450_GPF(_nr) (S5P6450_GPIO_F_START + (_nr))
112#define S5P6450_GPG(_nr) (S5P6450_GPIO_G_START + (_nr))
113#define S5P6450_GPH(_nr) (S5P6450_GPIO_H_START + (_nr))
114#define S5P6450_GPI(_nr) (S5P6450_GPIO_I_START + (_nr))
115#define S5P6450_GPJ(_nr) (S5P6450_GPIO_J_START + (_nr))
116#define S5P6450_GPK(_nr) (S5P6450_GPIO_K_START + (_nr))
117#define S5P6450_GPN(_nr) (S5P6450_GPIO_N_START + (_nr))
118#define S5P6450_GPP(_nr) (S5P6450_GPIO_P_START + (_nr))
119#define S5P6450_GPQ(_nr) (S5P6450_GPIO_Q_START + (_nr))
120#define S5P6450_GPR(_nr) (S5P6450_GPIO_R_START + (_nr))
121#define S5P6450_GPS(_nr) (S5P6450_GPIO_S_START + (_nr))
122
123/* the end of the S5P64X0 specific gpios */
124
125#define S5P6440_GPIO_END (S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
126#define S5P6450_GPIO_END (S5P6450_GPS(S5P6450_GPIO_S_NR) + 1)
127
128#define S5P64X0_GPIO_END (S5P6440_GPIO_END > S5P6450_GPIO_END ? \
129 S5P6440_GPIO_END : S5P6450_GPIO_END)
130
131#define S3C_GPIO_END S5P64X0_GPIO_END
132
133/* define the number of gpios we need to the one after the last GPIO range */
134
135#define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA)
136
137#include <asm-generic/gpio.h>
138
139#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/hardware.h b/arch/arm/mach-s5p64x0/include/mach/hardware.h
index be8b26e875db..d3e87996dd9a 100644
--- a/arch/arm/mach-s5p6440/include/mach/hardware.h
+++ b/arch/arm/mach-s5p64x0/include/mach/hardware.h
@@ -1,9 +1,9 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/hardware.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/hardware.h
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * S5P6440 - Hardware support 6 * S5P64X0 - Hardware support
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s5p64x0/include/mach/i2c.h b/arch/arm/mach-s5p64x0/include/mach/i2c.h
new file mode 100644
index 000000000000..887d25209e8e
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/i2c.h
@@ -0,0 +1,17 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/i2c.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 I2C configuration
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 void s5p6440_i2c0_cfg_gpio(struct platform_device *dev);
14extern void s5p6440_i2c1_cfg_gpio(struct platform_device *dev);
15
16extern void s5p6450_i2c0_cfg_gpio(struct platform_device *dev);
17extern void s5p6450_i2c1_cfg_gpio(struct platform_device *dev);
diff --git a/arch/arm/mach-s5p64x0/include/mach/io.h b/arch/arm/mach-s5p64x0/include/mach/io.h
new file mode 100644
index 000000000000..a3e095c02fb5
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/io.h
@@ -0,0 +1,25 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/io.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright 2008 Simtec Electronics
7 * Ben Dooks <ben-linux@fluff.org>
8 *
9 * Default IO routines for S5P64X0 based
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#ifndef __ASM_ARM_ARCH_IO_H
17#define __ASM_ARM_ARCH_IO_H
18
19/* No current ISA/PCI bus support. */
20#define __io(a) __typesafe_io(a)
21#define __mem_pci(a) (a)
22
23#define IO_SPACE_LIMIT (0xFFFFFFFF)
24
25#endif
diff --git a/arch/arm/mach-s5p6440/include/mach/irqs.h b/arch/arm/mach-s5p64x0/include/mach/irqs.h
index 16a761270de1..513abffc7604 100644
--- a/arch/arm/mach-s5p6440/include/mach/irqs.h
+++ b/arch/arm/mach-s5p64x0/include/mach/irqs.h
@@ -1,17 +1,17 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/irqs.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/irqs.h
2 * 2 *
3 * Copyright 2009 Samsung Electronics Co., Ltd. 3 * Copyright 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * S5P6440 - IRQ definitions 6 * S5P64X0 - IRQ definitions
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13#ifndef __ASM_ARCH_S5P_IRQS_H 13#ifndef __ASM_ARCH_IRQS_H
14#define __ASM_ARCH_S5P_IRQS_H __FILE__ 14#define __ASM_ARCH_IRQS_H __FILE__
15 15
16#include <plat/irqs.h> 16#include <plat/irqs.h>
17 17
@@ -20,10 +20,12 @@
20#define IRQ_EINT0_3 S5P_IRQ_VIC0(0) 20#define IRQ_EINT0_3 S5P_IRQ_VIC0(0)
21#define IRQ_EINT4_11 S5P_IRQ_VIC0(1) 21#define IRQ_EINT4_11 S5P_IRQ_VIC0(1)
22#define IRQ_RTC_TIC S5P_IRQ_VIC0(2) 22#define IRQ_RTC_TIC S5P_IRQ_VIC0(2)
23#define IRQ_IIS1 S5P_IRQ_VIC0(3) /* for only S5P6450 */
24#define IRQ_IIS2 S5P_IRQ_VIC0(4) /* for only S5P6450 */
23#define IRQ_IIC1 S5P_IRQ_VIC0(5) 25#define IRQ_IIC1 S5P_IRQ_VIC0(5)
24#define IRQ_I2SV40 S5P_IRQ_VIC0(6) 26#define IRQ_I2SV40 S5P_IRQ_VIC0(6)
25#define IRQ_GPS S5P_IRQ_VIC0(7) 27#define IRQ_GPS S5P_IRQ_VIC0(7) /* for only S5P6450 */
26#define IRQ_POST0 S5P_IRQ_VIC0(9) 28
27#define IRQ_2D S5P_IRQ_VIC0(11) 29#define IRQ_2D S5P_IRQ_VIC0(11)
28#define IRQ_TIMER0_VIC S5P_IRQ_VIC0(23) 30#define IRQ_TIMER0_VIC S5P_IRQ_VIC0(23)
29#define IRQ_TIMER1_VIC S5P_IRQ_VIC0(24) 31#define IRQ_TIMER1_VIC S5P_IRQ_VIC0(24)
@@ -39,22 +41,26 @@
39 41
40#define IRQ_EINT12_15 S5P_IRQ_VIC1(0) 42#define IRQ_EINT12_15 S5P_IRQ_VIC1(0)
41#define IRQ_PCM0 S5P_IRQ_VIC1(2) 43#define IRQ_PCM0 S5P_IRQ_VIC1(2)
44#define IRQ_PCM1 S5P_IRQ_VIC1(3) /* for only S5P6450 */
45#define IRQ_PCM2 S5P_IRQ_VIC1(4) /* for only S5P6450 */
42#define IRQ_UART0 S5P_IRQ_VIC1(5) 46#define IRQ_UART0 S5P_IRQ_VIC1(5)
43#define IRQ_UART1 S5P_IRQ_VIC1(6) 47#define IRQ_UART1 S5P_IRQ_VIC1(6)
44#define IRQ_UART2 S5P_IRQ_VIC1(7) 48#define IRQ_UART2 S5P_IRQ_VIC1(7)
45#define IRQ_UART3 S5P_IRQ_VIC1(8) 49#define IRQ_UART3 S5P_IRQ_VIC1(8)
46#define IRQ_DMA0 S5P_IRQ_VIC1(9) 50#define IRQ_DMA0 S5P_IRQ_VIC1(9)
51#define IRQ_UART4 S5P_IRQ_VIC1(10) /* S5P6450 */
52#define IRQ_UART5 S5P_IRQ_VIC1(11) /* S5P6450 */
47#define IRQ_NFC S5P_IRQ_VIC1(13) 53#define IRQ_NFC S5P_IRQ_VIC1(13)
54#define IRQ_USI S5P_IRQ_VIC1(15) /* S5P6450 */
48#define IRQ_SPI0 S5P_IRQ_VIC1(16) 55#define IRQ_SPI0 S5P_IRQ_VIC1(16)
49#define IRQ_SPI1 S5P_IRQ_VIC1(17) 56#define IRQ_SPI1 S5P_IRQ_VIC1(17)
57#define IRQ_HSMMC2 S5P_IRQ_VIC1(17) /* Shared */
50#define IRQ_IIC S5P_IRQ_VIC1(18) 58#define IRQ_IIC S5P_IRQ_VIC1(18)
51#define IRQ_DISPCON3 S5P_IRQ_VIC1(19) 59#define IRQ_DISPCON3 S5P_IRQ_VIC1(19)
52#define IRQ_FIMGVG S5P_IRQ_VIC1(20)
53#define IRQ_EINT_GROUPS S5P_IRQ_VIC1(21) 60#define IRQ_EINT_GROUPS S5P_IRQ_VIC1(21)
54#define IRQ_PMU S5P_IRQ_VIC1(23) 61#define IRQ_PMU S5P_IRQ_VIC1(23) /* S5P6440 */
55#define IRQ_HSMMC0 S5P_IRQ_VIC1(24) 62#define IRQ_HSMMC0 S5P_IRQ_VIC1(24)
56#define IRQ_HSMMC1 S5P_IRQ_VIC1(25) 63#define IRQ_HSMMC1 S5P_IRQ_VIC1(25)
57#define IRQ_HSMMC2 IRQ_SPI1 /* shared with SPI1 */
58#define IRQ_OTG S5P_IRQ_VIC1(26) 64#define IRQ_OTG S5P_IRQ_VIC1(26)
59#define IRQ_DSI S5P_IRQ_VIC1(27) 65#define IRQ_DSI S5P_IRQ_VIC1(27)
60#define IRQ_RTC_ALARM S5P_IRQ_VIC1(28) 66#define IRQ_RTC_ALARM S5P_IRQ_VIC1(28)
@@ -63,6 +69,24 @@
63#define IRQ_TC IRQ_PENDN 69#define IRQ_TC IRQ_PENDN
64#define IRQ_ADC S5P_IRQ_VIC1(31) 70#define IRQ_ADC S5P_IRQ_VIC1(31)
65 71
72/* UART interrupts, S5P6450 has 5 UARTs */
73#define IRQ_S5P_UART_BASE4 (96)
74#define IRQ_S5P_UART_BASE5 (100)
75
76#define IRQ_S5P_UART_RX4 (IRQ_S5P_UART_BASE4 + UART_IRQ_RXD)
77#define IRQ_S5P_UART_TX4 (IRQ_S5P_UART_BASE4 + UART_IRQ_TXD)
78#define IRQ_S5P_UART_ERR4 (IRQ_S5P_UART_BASE4 + UART_IRQ_ERR)
79
80#define IRQ_S5P_UART_RX5 (IRQ_S5P_UART_BASE5 + UART_IRQ_RXD)
81#define IRQ_S5P_UART_TX5 (IRQ_S5P_UART_BASE5 + UART_IRQ_TXD)
82#define IRQ_S5P_UART_ERR5 (IRQ_S5P_UART_BASE5 + UART_IRQ_ERR)
83
84/* S3C compatibilty defines */
85#define IRQ_S3CUART_RX4 IRQ_S5P_UART_RX4
86#define IRQ_S3CUART_RX5 IRQ_S5P_UART_RX5
87
88/* S5P6450 EINT feature will be added */
89
66/* 90/*
67 * Since the IRQ_EINT(x) are a linear mapping on s5p6440 we just defined 91 * Since the IRQ_EINT(x) are a linear mapping on s5p6440 we just defined
68 * them as an IRQ_EINT(x) macro from S5P_IRQ_EINT_BASE which we place 92 * them as an IRQ_EINT(x) macro from S5P_IRQ_EINT_BASE which we place
@@ -115,4 +139,4 @@
115 139
116#define NR_IRQS (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR + 1) 140#define NR_IRQS (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR + 1)
117 141
118#endif /* __ASM_ARCH_S5P_IRQS_H */ 142#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
new file mode 100644
index 000000000000..31e534156e06
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/map.h
@@ -0,0 +1,83 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/map.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Memory map 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_MAP_H
14#define __ASM_ARCH_MAP_H __FILE__
15
16#include <plat/map-base.h>
17#include <plat/map-s5p.h>
18
19#define S5P64X0_PA_SDRAM (0x20000000)
20
21#define S5P64X0_PA_CHIPID (0xE0000000)
22#define S5P_PA_CHIPID S5P64X0_PA_CHIPID
23
24#define S5P64X0_PA_SYSCON (0xE0100000)
25#define S5P_PA_SYSCON S5P64X0_PA_SYSCON
26
27#define S5P64X0_PA_GPIO (0xE0308000)
28
29#define S5P64X0_PA_VIC0 (0xE4000000)
30#define S5P64X0_PA_VIC1 (0xE4100000)
31
32#define S5P64X0_PA_PDMA (0xE9000000)
33
34#define S5P64X0_PA_TIMER (0xEA000000)
35#define S5P_PA_TIMER S5P64X0_PA_TIMER
36
37#define S5P64X0_PA_RTC (0xEA100000)
38
39#define S5P64X0_PA_WDT (0xEA200000)
40
41#define S5P6440_PA_UART(x) (0xEC000000 + ((x) * S3C_UART_OFFSET))
42#define S5P6450_PA_UART(x) ((x < 5) ? (0xEC800000 + ((x) * S3C_UART_OFFSET)) : (0xEC000000))
43
44#define S5P_PA_UART0 S5P6450_PA_UART(0)
45#define S5P_PA_UART1 S5P6450_PA_UART(1)
46#define S5P_PA_UART2 S5P6450_PA_UART(2)
47#define S5P_PA_UART3 S5P6450_PA_UART(3)
48#define S5P_PA_UART4 S5P6450_PA_UART(4)
49#define S5P_PA_UART5 S5P6450_PA_UART(5)
50
51#define S5P_SZ_UART SZ_256
52
53#define S5P6440_PA_IIC0 (0xEC104000)
54#define S5P6440_PA_IIC1 (0xEC20F000)
55#define S5P6450_PA_IIC0 (0xEC100000)
56#define S5P6450_PA_IIC1 (0xEC200000)
57
58#define S5P64X0_PA_SPI0 (0xEC400000)
59#define S5P64X0_PA_SPI1 (0xEC500000)
60
61#define S5P64X0_PA_HSOTG (0xED100000)
62
63#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
64
65#define S5P64X0_PA_I2S (0xF2000000)
66
67#define S5P64X0_PA_PCM (0xF2100000)
68
69#define S5P64X0_PA_ADC (0xF3000000)
70
71/* compatibiltiy defines. */
72
73#define S3C_PA_HSMMC0 S5P64X0_PA_HSMMC(0)
74#define S3C_PA_HSMMC1 S5P64X0_PA_HSMMC(1)
75#define S3C_PA_HSMMC2 S5P64X0_PA_HSMMC(2)
76#define S3C_PA_IIC S5P6440_PA_IIC0
77#define S3C_PA_IIC1 S5P6440_PA_IIC1
78#define S3C_PA_RTC S5P64X0_PA_RTC
79#define S3C_PA_WDT S5P64X0_PA_WDT
80
81#define SAMSUNG_PA_ADC S5P64X0_PA_ADC
82
83#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/memory.h b/arch/arm/mach-s5p64x0/include/mach/memory.h
index d62910c71b56..1b036b0a24ce 100644
--- a/arch/arm/mach-s5p6440/include/mach/memory.h
+++ b/arch/arm/mach-s5p64x0/include/mach/memory.h
@@ -1,9 +1,9 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/memory.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/memory.h
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * S5P6440 - Memory definitions 6 * S5P64X0 - Memory definitions
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
@@ -11,9 +11,9 @@
11*/ 11*/
12 12
13#ifndef __ASM_ARCH_MEMORY_H 13#ifndef __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H 14#define __ASM_ARCH_MEMORY_H __FILE__
15 15
16#define PHYS_OFFSET UL(0x20000000) 16#define PHYS_OFFSET UL(0x20000000)
17#define CONSISTENT_DMA_SIZE SZ_8M 17#define CONSISTENT_DMA_SIZE SZ_8M
18 18
19#endif /* __ASM_ARCH_MEMORY_H */ 19#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/pwm-clock.h b/arch/arm/mach-s5p64x0/include/mach/pwm-clock.h
index 6a2a02fdf12a..19fff8b701c0 100644
--- a/arch/arm/mach-s5p6440/include/mach/pwm-clock.h
+++ b/arch/arm/mach-s5p64x0/include/mach/pwm-clock.h
@@ -1,16 +1,14 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/pwm-clock.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/pwm-clock.h
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * Copyright 2008 Openmoko, Inc. 6 * Copyright 2008 Openmoko, Inc.
7 * Copyright 2008 Simtec Electronics 7 * Copyright 2008 Simtec Electronics
8 * Ben Dooks <ben@simtec.co.uk> 8 * Ben Dooks <ben@simtec.co.uk>
9 * http://armlinux.simtec.co.uk/ 9 * http://armlinux.simtec.co.uk/
10 * 10 *
11 * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h 11 * S5P64X0 - pwm clock and timer support
12 *
13 * S5P6440 - pwm clock and timer support
14 * 12 *
15 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as 14 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h b/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
new file mode 100644
index 000000000000..58e1bc813804
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
@@ -0,0 +1,63 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - 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 __ASM_ARCH_REGS_CLOCK_H
14#define __ASM_ARCH_REGS_CLOCK_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_CLKREG(x) (S3C_VA_SYS + (x))
19
20#define S5P64X0_APLL_CON S5P_CLKREG(0x0C)
21#define S5P64X0_MPLL_CON S5P_CLKREG(0x10)
22#define S5P64X0_EPLL_CON S5P_CLKREG(0x14)
23#define S5P64X0_EPLL_CON_K S5P_CLKREG(0x18)
24
25#define S5P64X0_CLK_SRC0 S5P_CLKREG(0x1C)
26
27#define S5P64X0_CLK_DIV0 S5P_CLKREG(0x20)
28#define S5P64X0_CLK_DIV1 S5P_CLKREG(0x24)
29#define S5P64X0_CLK_DIV2 S5P_CLKREG(0x28)
30
31#define S5P64X0_CLK_GATE_HCLK0 S5P_CLKREG(0x30)
32#define S5P64X0_CLK_GATE_PCLK S5P_CLKREG(0x34)
33#define S5P64X0_CLK_GATE_SCLK0 S5P_CLKREG(0x38)
34#define S5P64X0_CLK_GATE_MEM0 S5P_CLKREG(0x3C)
35
36#define S5P64X0_CLK_DIV3 S5P_CLKREG(0x40)
37
38#define S5P64X0_CLK_GATE_HCLK1 S5P_CLKREG(0x44)
39#define S5P64X0_CLK_GATE_SCLK1 S5P_CLKREG(0x48)
40
41#define S5P6450_DPLL_CON S5P_CLKREG(0x50)
42#define S5P6450_DPLL_CON_K S5P_CLKREG(0x54)
43
44#define S5P64X0_CLK_SRC1 S5P_CLKREG(0x10C)
45
46#define S5P64X0_SYS_ID S5P_CLKREG(0x118)
47#define S5P64X0_SYS_OTHERS S5P_CLKREG(0x11C)
48
49#define S5P64X0_PWR_CFG S5P_CLKREG(0x804)
50#define S5P64X0_OTHERS S5P_CLKREG(0x900)
51
52#define S5P64X0_CLKDIV0_HCLK_SHIFT (8)
53#define S5P64X0_CLKDIV0_HCLK_MASK (0xF << S5P64X0_CLKDIV0_HCLK_SHIFT)
54
55#define S5P64X0_OTHERS_USB_SIG_MASK (1 << 16)
56
57/* Compatibility defines */
58
59#define ARM_CLK_DIV S5P64X0_CLK_DIV0
60#define ARM_DIV_RATIO_SHIFT 0
61#define ARM_DIV_MASK (0xF << ARM_DIV_RATIO_SHIFT)
62
63#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/regs-gpio.h b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
index 82ff753913da..85f448e20a8b 100644
--- a/arch/arm/mach-s5p6440/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
@@ -1,21 +1,24 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/regs-gpio.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * S5P6440 - GPIO register definitions 6 * S5P64X0 - GPIO register definitions
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11*/
12 12
13#ifndef __ASM_ARCH_REGS_GPIO_H 13#ifndef __ASM_ARCH_REGS_GPIO_H
14#define __ASM_ARCH_REGS_GPIO_H __FILE__ 14#define __ASM_ARCH_REGS_GPIO_H __FILE__
15 15
16#include <mach/map.h> 16#include <mach/map.h>
17 17
18/* Will be implemented S5P6442 GPIOlib */
19
18/* Base addresses for each of the banks */ 20/* Base addresses for each of the banks */
21
19#define S5P6440_GPA_BASE (S5P_VA_GPIO + 0x0000) 22#define S5P6440_GPA_BASE (S5P_VA_GPIO + 0x0000)
20#define S5P6440_GPB_BASE (S5P_VA_GPIO + 0x0020) 23#define S5P6440_GPB_BASE (S5P_VA_GPIO + 0x0020)
21#define S5P6440_GPC_BASE (S5P_VA_GPIO + 0x0040) 24#define S5P6440_GPC_BASE (S5P_VA_GPIO + 0x0040)
@@ -27,6 +30,7 @@
27#define S5P6440_GPN_BASE (S5P_VA_GPIO + 0x0830) 30#define S5P6440_GPN_BASE (S5P_VA_GPIO + 0x0830)
28#define S5P6440_GPP_BASE (S5P_VA_GPIO + 0x0160) 31#define S5P6440_GPP_BASE (S5P_VA_GPIO + 0x0160)
29#define S5P6440_GPR_BASE (S5P_VA_GPIO + 0x0290) 32#define S5P6440_GPR_BASE (S5P_VA_GPIO + 0x0290)
33
30#define S5P6440_EINT0CON0 (S5P_VA_GPIO + 0x900) 34#define S5P6440_EINT0CON0 (S5P_VA_GPIO + 0x900)
31#define S5P6440_EINT0FLTCON0 (S5P_VA_GPIO + 0x910) 35#define S5P6440_EINT0FLTCON0 (S5P_VA_GPIO + 0x910)
32#define S5P6440_EINT0FLTCON1 (S5P_VA_GPIO + 0x914) 36#define S5P6440_EINT0FLTCON1 (S5P_VA_GPIO + 0x914)
@@ -34,19 +38,23 @@
34#define S5P6440_EINT0PEND (S5P_VA_GPIO + 0x924) 38#define S5P6440_EINT0PEND (S5P_VA_GPIO + 0x924)
35 39
36/* for LCD */ 40/* for LCD */
41
37#define S5P6440_SPCON_LCD_SEL_RGB (1 << 0) 42#define S5P6440_SPCON_LCD_SEL_RGB (1 << 0)
38#define S5P6440_SPCON_LCD_SEL_MASK (3 << 0) 43#define S5P6440_SPCON_LCD_SEL_MASK (3 << 0)
39 44
40/* These set of macros are not really useful for the 45/*
41 * GPF/GPI/GPJ/GPN/GPP, 46 * These set of macros are not really useful for the
42 * useful for others set of GPIO's (4 bit) 47 * GPF/GPI/GPJ/GPN/GPP, useful for others set of GPIO's (4 bit)
43 */ 48 */
49
44#define S5P6440_GPIO_CONMASK(__gpio) (0xf << ((__gpio) * 4)) 50#define S5P6440_GPIO_CONMASK(__gpio) (0xf << ((__gpio) * 4))
45#define S5P6440_GPIO_INPUT(__gpio) (0x0 << ((__gpio) * 4)) 51#define S5P6440_GPIO_INPUT(__gpio) (0x0 << ((__gpio) * 4))
46#define S5P6440_GPIO_OUTPUT(__gpio) (0x1 << ((__gpio) * 4)) 52#define S5P6440_GPIO_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
47 53
48/* Use these macros for GPF/GPI/GPJ/GPN/GPP set of GPIO (2 bit) 54/*
49 * */ 55 * Use these macros for GPF/GPI/GPJ/GPN/GPP set of GPIO (2 bit)
56 */
57
50#define S5P6440_GPIO2_CONMASK(__gpio) (0x3 << ((__gpio) * 2)) 58#define S5P6440_GPIO2_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
51#define S5P6440_GPIO2_INPUT(__gpio) (0x0 << ((__gpio) * 2)) 59#define S5P6440_GPIO2_INPUT(__gpio) (0x0 << ((__gpio) * 2))
52#define S5P6440_GPIO2_OUTPUT(__gpio) (0x1 << ((__gpio) * 2)) 60#define S5P6440_GPIO2_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
diff --git a/arch/arm/mach-s5p6440/include/mach/regs-irq.h b/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
index a961f4beeb0c..4aaebdace55f 100644
--- a/arch/arm/mach-s5p6440/include/mach/regs-irq.h
+++ b/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
@@ -1,9 +1,9 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/regs-irq.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * S5P6440 - IRQ register definitions 6 * S5P64X0 - IRQ register definitions
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h b/arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h
new file mode 100644
index 000000000000..ff85b4b6e8d9
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h
@@ -0,0 +1,46 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Header file for s5p64x0 clock 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
13#ifndef __ASM_ARCH_CLOCK_H
14#define __ASM_ARCH_CLOCK_H __FILE__
15
16#include <linux/clk.h>
17
18extern struct clksrc_clk clk_mout_apll;
19extern struct clksrc_clk clk_mout_mpll;
20extern struct clksrc_clk clk_mout_epll;
21
22extern int s5p64x0_epll_enable(struct clk *clk, int enable);
23extern unsigned long s5p64x0_epll_get_rate(struct clk *clk);
24
25extern unsigned long s5p64x0_armclk_get_rate(struct clk *clk);
26extern unsigned long s5p64x0_armclk_round_rate(struct clk *clk, unsigned long rate);
27extern int s5p64x0_armclk_set_rate(struct clk *clk, unsigned long rate);
28
29extern struct clk_ops s5p64x0_clkarm_ops;
30
31extern struct clksrc_clk clk_armclk;
32extern struct clksrc_clk clk_dout_mpll;
33
34extern struct clk *clkset_hclk_low_list[];
35extern struct clksrc_sources clkset_hclk_low;
36
37extern int s5p64x0_pclk_ctrl(struct clk *clk, int enable);
38extern int s5p64x0_hclk0_ctrl(struct clk *clk, int enable);
39extern int s5p64x0_hclk1_ctrl(struct clk *clk, int enable);
40extern int s5p64x0_sclk_ctrl(struct clk *clk, int enable);
41extern int s5p64x0_sclk1_ctrl(struct clk *clk, int enable);
42extern int s5p64x0_mem_ctrl(struct clk *clk, int enable);
43
44extern int s5p64x0_clk48m_ctrl(struct clk *clk, int enable);
45
46#endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/spi-clocks.h b/arch/arm/mach-s5p64x0/include/mach/spi-clocks.h
new file mode 100644
index 000000000000..170a20a9643a
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/spi-clocks.h
@@ -0,0 +1,20 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/spi-clocks.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
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_SPI_CLKS_H
15#define __ASM_ARCH_SPI_CLKS_H __FILE__
16
17#define S5P64X0_SPI_SRCCLK_PCLK 0
18#define S5P64X0_SPI_SRCCLK_SCLK 1
19
20#endif /* __ASM_ARCH_SPI_CLKS_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/system.h b/arch/arm/mach-s5p64x0/include/mach/system.h
index a359ee3fa510..60f57532c970 100644
--- a/arch/arm/mach-s5p6440/include/mach/system.h
+++ b/arch/arm/mach-s5p64x0/include/mach/system.h
@@ -1,9 +1,9 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/system.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/system.h
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * S5P6440 - system support header 6 * S5P64X0 - system support header
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s5p6440/include/mach/tick.h b/arch/arm/mach-s5p64x0/include/mach/tick.h
index 2f25c7f07970..00aa7f1d8e51 100644
--- a/arch/arm/mach-s5p6440/include/mach/tick.h
+++ b/arch/arm/mach-s5p64x0/include/mach/tick.h
@@ -1,9 +1,14 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/tick.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/tick.h
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * S5P6440 - Timer tick support definitions 6 * Copyright 2008 Openmoko, Inc.
7 * Copyright 2008 Simtec Electronics
8 * http://armlinux.simtec.co.uk/
9 * Ben Dooks <ben@simtec.co.uk>
10 *
11 * S5P64X0 - Timer tick support definitions
7 * 12 *
8 * This program is free software; you can redistribute it and/or modify 13 * 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 14 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s5p6440/include/mach/timex.h b/arch/arm/mach-s5p64x0/include/mach/timex.h
index fb2e8cd40829..4b91faa195a8 100644
--- a/arch/arm/mach-s5p6440/include/mach/timex.h
+++ b/arch/arm/mach-s5p64x0/include/mach/timex.h
@@ -1,9 +1,12 @@
1/* arch/arm/mach-s3c64xx/include/mach/timex.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/timex.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
2 * 5 *
3 * Copyright (c) 2003-2005 Simtec Electronics 6 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 7 * Ben Dooks <ben@simtec.co.uk>
5 * 8 *
6 * S3C6400 - time parameters 9 * S5P64X0 - time parameters
7 * 10 *
8 * This program is free software; you can redistribute it and/or modify 11 * 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 12 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/mach-s5p64x0/include/mach/uncompress.h b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
new file mode 100644
index 000000000000..c65b229aab23
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
@@ -0,0 +1,212 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/uncompress.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - uncompress code
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_UNCOMPRESS_H
14#define __ASM_ARCH_UNCOMPRESS_H
15
16#include <mach/map.h>
17
18/*
19 * cannot use commonly <plat/uncompress.h>
20 * because uart base of S5P6440 and S5P6450 is different
21 */
22
23typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
24
25/* uart setup */
26
27static unsigned int fifo_mask;
28static unsigned int fifo_max;
29
30/* forward declerations */
31
32static void arch_detect_cpu(void);
33
34/* defines for UART registers */
35
36#include <plat/regs-serial.h>
37#include <plat/regs-watchdog.h>
38
39/* working in physical space... */
40#undef S3C2410_WDOGREG
41#define S3C2410_WDOGREG(x) ((S3C24XX_PA_WATCHDOG + (x)))
42
43/* how many bytes we allow into the FIFO at a time in FIFO mode */
44#define FIFO_MAX (14)
45
46static unsigned long uart_base;
47
48static __inline__ void get_uart_base(void)
49{
50 unsigned int chipid;
51
52 chipid = *(const volatile unsigned int __force *) 0xE0100118;
53
54 uart_base = S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT;
55
56 if ((chipid & 0xff000) == 0x50000)
57 uart_base += 0xEC800000;
58 else
59 uart_base += 0xEC000000;
60}
61
62static __inline__ void uart_wr(unsigned int reg, unsigned int val)
63{
64 volatile unsigned int *ptr;
65
66 get_uart_base();
67 ptr = (volatile unsigned int *)(reg + uart_base);
68 *ptr = val;
69}
70
71static __inline__ unsigned int uart_rd(unsigned int reg)
72{
73 volatile unsigned int *ptr;
74
75 get_uart_base();
76 ptr = (volatile unsigned int *)(reg + uart_base);
77 return *ptr;
78}
79
80/*
81 * we can deal with the case the UARTs are being run
82 * in FIFO mode, so that we don't hold up our execution
83 * waiting for tx to happen...
84 */
85
86static void putc(int ch)
87{
88 if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) {
89 int level;
90
91 while (1) {
92 level = uart_rd(S3C2410_UFSTAT);
93 level &= fifo_mask;
94
95 if (level < fifo_max)
96 break;
97 }
98
99 } else {
100 /* not using fifos */
101
102 while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE)
103 barrier();
104 }
105
106 /* write byte to transmission register */
107 uart_wr(S3C2410_UTXH, ch);
108}
109
110static inline void flush(void)
111{
112}
113
114#define __raw_writel(d, ad) \
115 do { \
116 *((volatile unsigned int __force *)(ad)) = (d); \
117 } while (0)
118
119/*
120 * CONFIG_S3C_BOOT_WATCHDOG
121 *
122 * Simple boot-time watchdog setup, to reboot the system if there is
123 * any problem with the boot process
124 */
125
126#ifdef CONFIG_S3C_BOOT_WATCHDOG
127
128#define WDOG_COUNT (0xff00)
129
130static inline void arch_decomp_wdog(void)
131{
132 __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
133}
134
135static void arch_decomp_wdog_start(void)
136{
137 __raw_writel(WDOG_COUNT, S3C2410_WTDAT);
138 __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
139 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x80), S3C2410_WTCON);
140}
141
142#else
143#define arch_decomp_wdog_start()
144#define arch_decomp_wdog()
145#endif
146
147#ifdef CONFIG_S3C_BOOT_ERROR_RESET
148
149static void arch_decomp_error(const char *x)
150{
151 putstr("\n\n");
152 putstr(x);
153 putstr("\n\n -- System resetting\n");
154
155 __raw_writel(0x4000, S3C2410_WTDAT);
156 __raw_writel(0x4000, S3C2410_WTCNT);
157 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON);
158
159 while(1);
160}
161
162#define arch_error arch_decomp_error
163#endif
164
165#ifdef CONFIG_S3C_BOOT_UART_FORCE_FIFO
166static inline void arch_enable_uart_fifo(void)
167{
168 u32 fifocon = uart_rd(S3C2410_UFCON);
169
170 if (!(fifocon & S3C2410_UFCON_FIFOMODE)) {
171 fifocon |= S3C2410_UFCON_RESETBOTH;
172 uart_wr(S3C2410_UFCON, fifocon);
173
174 /* wait for fifo reset to complete */
175 while (1) {
176 fifocon = uart_rd(S3C2410_UFCON);
177 if (!(fifocon & S3C2410_UFCON_RESETBOTH))
178 break;
179 }
180 }
181}
182#else
183#define arch_enable_uart_fifo() do { } while(0)
184#endif
185
186static void arch_decomp_setup(void)
187{
188 /*
189 * we may need to setup the uart(s) here if we are not running
190 * on an BAST... the BAST will have left the uarts configured
191 * after calling linux.
192 */
193
194 arch_detect_cpu();
195 arch_decomp_wdog_start();
196
197 /*
198 * Enable the UART FIFOs if they where not enabled and our
199 * configuration says we should turn them on.
200 */
201
202 arch_enable_uart_fifo();
203}
204
205
206
207static void arch_detect_cpu(void)
208{
209 /* we do not need to do any cpu detection here at the moment. */
210}
211
212#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s5p6440/include/mach/vmalloc.h b/arch/arm/mach-s5p64x0/include/mach/vmalloc.h
index e3f0eebf5205..97a9df38f1cf 100644
--- a/arch/arm/mach-s5p6440/include/mach/vmalloc.h
+++ b/arch/arm/mach-s5p64x0/include/mach/vmalloc.h
@@ -1,4 +1,7 @@
1/* arch/arm/mach-s5p6440/include/mach/vmalloc.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/vmalloc.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
2 * 5 *
3 * Copyright 2010 Ben Dooks <ben-linux@fluff.org> 6 * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
4 * 7 *
diff --git a/arch/arm/mach-s5p64x0/init.c b/arch/arm/mach-s5p64x0/init.c
new file mode 100644
index 000000000000..79833caf8165
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/init.c
@@ -0,0 +1,73 @@
1/* linux/arch/arm/mach-s5p64x0/init.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Init 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
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/init.h>
16#include <linux/serial_core.h>
17
18#include <mach/map.h>
19
20#include <plat/cpu.h>
21#include <plat/devs.h>
22#include <plat/s5p6440.h>
23#include <plat/s5p6450.h>
24#include <plat/regs-serial.h>
25
26static struct s3c24xx_uart_clksrc s5p64x0_serial_clocks[] = {
27 [0] = {
28 .name = "pclk_low",
29 .divisor = 1,
30 .min_baud = 0,
31 .max_baud = 0,
32 },
33 [1] = {
34 .name = "uclk1",
35 .divisor = 1,
36 .min_baud = 0,
37 .max_baud = 0,
38 },
39};
40
41/* uart registration process */
42
43void __init s5p64x0_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
44{
45 struct s3c2410_uartcfg *tcfg = cfg;
46 u32 ucnt;
47
48 for (ucnt = 0; ucnt < no; ucnt++, tcfg++) {
49 if (!tcfg->clocks) {
50 tcfg->clocks = s5p64x0_serial_clocks;
51 tcfg->clocks_size = ARRAY_SIZE(s5p64x0_serial_clocks);
52 }
53 }
54}
55
56void __init s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no)
57{
58 int uart;
59
60 for (uart = 0; uart < no; uart++) {
61 s5p_uart_resources[uart].resources->start = S5P6440_PA_UART(uart);
62 s5p_uart_resources[uart].resources->end = S5P6440_PA_UART(uart) + S5P_SZ_UART;
63 }
64
65 s5p64x0_common_init_uarts(cfg, no);
66 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
67}
68
69void __init s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no)
70{
71 s5p64x0_common_init_uarts(cfg, no);
72 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
73}
diff --git a/arch/arm/mach-s5p6440/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 9202aaac3b56..28de0a57208c 100644
--- a/arch/arm/mach-s5p6440/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-s5p6440/mach-smdk6440.c 1/* linux/arch/arm/mach-s5p64x0/mach-smdk6440.c
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
@@ -21,21 +21,22 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/gpio.h>
24 25
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/irq.h>
29#include <asm/mach-types.h>
27 30
28#include <mach/hardware.h> 31#include <mach/hardware.h>
29#include <mach/map.h> 32#include <mach/map.h>
30 33#include <mach/regs-clock.h>
31#include <asm/irq.h> 34#include <mach/i2c.h>
32#include <asm/mach-types.h>
33 35
34#include <plat/regs-serial.h> 36#include <plat/regs-serial.h>
35 37#include <plat/gpio-cfg.h>
36#include <plat/s5p6440.h> 38#include <plat/s5p6440.h>
37#include <plat/clock.h> 39#include <plat/clock.h>
38#include <mach/regs-clock.h>
39#include <plat/devs.h> 40#include <plat/devs.h>
40#include <plat/cpu.h> 41#include <plat/cpu.h>
41#include <plat/iic.h> 42#include <plat/iic.h>
@@ -58,43 +59,60 @@
58 59
59static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = { 60static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
60 [0] = { 61 [0] = {
61 .hwport = 0, 62 .hwport = 0,
62 .flags = 0, 63 .flags = 0,
63 .ucon = SMDK6440_UCON_DEFAULT, 64 .ucon = SMDK6440_UCON_DEFAULT,
64 .ulcon = SMDK6440_ULCON_DEFAULT, 65 .ulcon = SMDK6440_ULCON_DEFAULT,
65 .ufcon = SMDK6440_UFCON_DEFAULT, 66 .ufcon = SMDK6440_UFCON_DEFAULT,
66 }, 67 },
67 [1] = { 68 [1] = {
68 .hwport = 1, 69 .hwport = 1,
69 .flags = 0, 70 .flags = 0,
70 .ucon = SMDK6440_UCON_DEFAULT, 71 .ucon = SMDK6440_UCON_DEFAULT,
71 .ulcon = SMDK6440_ULCON_DEFAULT, 72 .ulcon = SMDK6440_ULCON_DEFAULT,
72 .ufcon = SMDK6440_UFCON_DEFAULT, 73 .ufcon = SMDK6440_UFCON_DEFAULT,
73 }, 74 },
74 [2] = { 75 [2] = {
75 .hwport = 2, 76 .hwport = 2,
76 .flags = 0, 77 .flags = 0,
77 .ucon = SMDK6440_UCON_DEFAULT, 78 .ucon = SMDK6440_UCON_DEFAULT,
78 .ulcon = SMDK6440_ULCON_DEFAULT, 79 .ulcon = SMDK6440_ULCON_DEFAULT,
79 .ufcon = SMDK6440_UFCON_DEFAULT, 80 .ufcon = SMDK6440_UFCON_DEFAULT,
80 }, 81 },
81 [3] = { 82 [3] = {
82 .hwport = 3, 83 .hwport = 3,
83 .flags = 0, 84 .flags = 0,
84 .ucon = SMDK6440_UCON_DEFAULT, 85 .ucon = SMDK6440_UCON_DEFAULT,
85 .ulcon = SMDK6440_ULCON_DEFAULT, 86 .ulcon = SMDK6440_ULCON_DEFAULT,
86 .ufcon = SMDK6440_UFCON_DEFAULT, 87 .ufcon = SMDK6440_UFCON_DEFAULT,
87 }, 88 },
88}; 89};
89 90
90static struct platform_device *smdk6440_devices[] __initdata = { 91static struct platform_device *smdk6440_devices[] __initdata = {
91 &s5p6440_device_iis,
92 &s3c_device_adc, 92 &s3c_device_adc,
93 &s3c_device_rtc, 93 &s3c_device_rtc,
94 &s3c_device_i2c0, 94 &s3c_device_i2c0,
95 &s3c_device_i2c1, 95 &s3c_device_i2c1,
96 &s3c_device_ts, 96 &s3c_device_ts,
97 &s3c_device_wdt, 97 &s3c_device_wdt,
98 &s5p6440_device_iis,
99};
100
101static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
102 .flags = 0,
103 .slave_addr = 0x10,
104 .frequency = 100*1000,
105 .sda_delay = 100,
106 .cfg_gpio = s5p6440_i2c0_cfg_gpio,
107};
108
109static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = {
110 .flags = 0,
111 .bus_num = 1,
112 .slave_addr = 0x10,
113 .frequency = 100*1000,
114 .sda_delay = 100,
115 .cfg_gpio = s5p6440_i2c1_cfg_gpio,
98}; 116};
99 117
100static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = { 118static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
@@ -113,7 +131,7 @@ static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
113 131
114static void __init smdk6440_map_io(void) 132static void __init smdk6440_map_io(void)
115{ 133{
116 s5p_init_io(NULL, 0, S5P_SYS_ID); 134 s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
117 s3c24xx_init_clocks(12000000); 135 s3c24xx_init_clocks(12000000);
118 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); 136 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
119} 137}
@@ -122,9 +140,8 @@ static void __init smdk6440_machine_init(void)
122{ 140{
123 s3c24xx_ts_set_platdata(&s3c_ts_platform); 141 s3c24xx_ts_set_platdata(&s3c_ts_platform);
124 142
125 /* I2C */ 143 s3c_i2c0_set_platdata(&s5p6440_i2c0_data);
126 s3c_i2c0_set_platdata(NULL); 144 s3c_i2c1_set_platdata(&s5p6440_i2c1_data);
127 s3c_i2c1_set_platdata(NULL);
128 i2c_register_board_info(0, smdk6440_i2c_devs0, 145 i2c_register_board_info(0, smdk6440_i2c_devs0,
129 ARRAY_SIZE(smdk6440_i2c_devs0)); 146 ARRAY_SIZE(smdk6440_i2c_devs0));
130 i2c_register_board_info(1, smdk6440_i2c_devs1, 147 i2c_register_board_info(1, smdk6440_i2c_devs1,
@@ -135,9 +152,9 @@ static void __init smdk6440_machine_init(void)
135 152
136MACHINE_START(SMDK6440, "SMDK6440") 153MACHINE_START(SMDK6440, "SMDK6440")
137 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ 154 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
138 .phys_io = S3C_PA_UART & 0xfff00000, 155 .phys_io = S5P6440_PA_UART(0) & 0xfff00000,
139 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, 156 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
140 .boot_params = S5P_PA_SDRAM + 0x100, 157 .boot_params = S5P64X0_PA_SDRAM + 0x100,
141 158
142 .init_irq = s5p6440_init_irq, 159 .init_irq = s5p6440_init_irq,
143 .map_io = smdk6440_map_io, 160 .map_io = smdk6440_map_io,
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
new file mode 100644
index 000000000000..8e982171418b
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -0,0 +1,182 @@
1/* linux/arch/arm/mach-s5p64x0/mach-smdk6450.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.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#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/i2c.h>
19#include <linux/serial_core.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/module.h>
23#include <linux/clk.h>
24#include <linux/gpio.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28#include <asm/irq.h>
29#include <asm/mach-types.h>
30
31#include <mach/hardware.h>
32#include <mach/map.h>
33#include <mach/regs-clock.h>
34#include <mach/i2c.h>
35
36#include <plat/regs-serial.h>
37#include <plat/gpio-cfg.h>
38#include <plat/s5p6450.h>
39#include <plat/clock.h>
40#include <plat/devs.h>
41#include <plat/cpu.h>
42#include <plat/iic.h>
43#include <plat/pll.h>
44#include <plat/adc.h>
45#include <plat/ts.h>
46
47#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
48 S3C2410_UCON_RXILEVEL | \
49 S3C2410_UCON_TXIRQMODE | \
50 S3C2410_UCON_RXIRQMODE | \
51 S3C2410_UCON_RXFIFO_TOI | \
52 S3C2443_UCON_RXERR_IRQEN)
53
54#define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
55
56#define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
57 S3C2440_UFCON_TXTRIG16 | \
58 S3C2410_UFCON_RXTRIG8)
59
60static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
61 [0] = {
62 .hwport = 0,
63 .flags = 0,
64 .ucon = SMDK6450_UCON_DEFAULT,
65 .ulcon = SMDK6450_ULCON_DEFAULT,
66 .ufcon = SMDK6450_UFCON_DEFAULT,
67 },
68 [1] = {
69 .hwport = 1,
70 .flags = 0,
71 .ucon = SMDK6450_UCON_DEFAULT,
72 .ulcon = SMDK6450_ULCON_DEFAULT,
73 .ufcon = SMDK6450_UFCON_DEFAULT,
74 },
75 [2] = {
76 .hwport = 2,
77 .flags = 0,
78 .ucon = SMDK6450_UCON_DEFAULT,
79 .ulcon = SMDK6450_ULCON_DEFAULT,
80 .ufcon = SMDK6450_UFCON_DEFAULT,
81 },
82 [3] = {
83 .hwport = 3,
84 .flags = 0,
85 .ucon = SMDK6450_UCON_DEFAULT,
86 .ulcon = SMDK6450_ULCON_DEFAULT,
87 .ufcon = SMDK6450_UFCON_DEFAULT,
88 },
89#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
90 [4] = {
91 .hwport = 4,
92 .flags = 0,
93 .ucon = SMDK6450_UCON_DEFAULT,
94 .ulcon = SMDK6450_ULCON_DEFAULT,
95 .ufcon = SMDK6450_UFCON_DEFAULT,
96 },
97#endif
98#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
99 [5] = {
100 .hwport = 5,
101 .flags = 0,
102 .ucon = SMDK6450_UCON_DEFAULT,
103 .ulcon = SMDK6450_ULCON_DEFAULT,
104 .ufcon = SMDK6450_UFCON_DEFAULT,
105 },
106#endif
107};
108
109static struct platform_device *smdk6450_devices[] __initdata = {
110 &s3c_device_adc,
111 &s3c_device_rtc,
112 &s3c_device_i2c0,
113 &s3c_device_i2c1,
114 &s3c_device_ts,
115 &s3c_device_wdt,
116 &s5p6450_device_iis0,
117 /* s5p6450_device_spi0 will be added */
118};
119
120static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
121 .flags = 0,
122 .slave_addr = 0x10,
123 .frequency = 100*1000,
124 .sda_delay = 100,
125 .cfg_gpio = s5p6450_i2c0_cfg_gpio,
126};
127
128static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
129 .flags = 0,
130 .bus_num = 1,
131 .slave_addr = 0x10,
132 .frequency = 100*1000,
133 .sda_delay = 100,
134 .cfg_gpio = s5p6450_i2c1_cfg_gpio,
135};
136
137static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
138 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
139};
140
141static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
142 { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
143};
144
145static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
146 .delay = 10000,
147 .presc = 49,
148 .oversampling_shift = 2,
149};
150
151static void __init smdk6450_map_io(void)
152{
153 s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
154 s3c24xx_init_clocks(19200000);
155 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
156}
157
158static void __init smdk6450_machine_init(void)
159{
160 s3c24xx_ts_set_platdata(&s3c_ts_platform);
161
162 s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
163 s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
164 i2c_register_board_info(0, smdk6450_i2c_devs0,
165 ARRAY_SIZE(smdk6450_i2c_devs0));
166 i2c_register_board_info(1, smdk6450_i2c_devs1,
167 ARRAY_SIZE(smdk6450_i2c_devs1));
168
169 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
170}
171
172MACHINE_START(SMDK6450, "SMDK6450")
173 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
174 .phys_io = S5P6450_PA_UART(0) & 0xfff00000,
175 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
176 .boot_params = S5P64X0_PA_SDRAM + 0x100,
177
178 .init_irq = s5p6450_init_irq,
179 .map_io = smdk6450_map_io,
180 .init_machine = smdk6450_machine_init,
181 .timer = &s3c24xx_timer,
182MACHINE_END
diff --git a/arch/arm/mach-s5p6440/setup-i2c0.c b/arch/arm/mach-s5p64x0/setup-i2c0.c
index 2c99d14f7ac7..dc4cc65a5019 100644
--- a/arch/arm/mach-s5p6440/setup-i2c0.c
+++ b/arch/arm/mach-s5p64x0/setup-i2c0.c
@@ -1,11 +1,11 @@
1/* linux/arch/arm/mach-s5p6440/setup-i2c0.c 1/* linux/arch/arm/mach-s5p64x0/setup-i2c0.c
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * I2C0 GPIO configuration. 6 * I2C0 GPIO configuration.
7 * 7 *
8 * Based on plat-s3c64xx/setup-i2c0.c 8 * Based on plat-s3c64x0/setup-i2c0.c
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 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 11 * it under the terms of the GNU General Public License version 2 as
@@ -14,17 +14,29 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/gpio.h>
17 18
18struct platform_device; /* don't need the contents */ 19struct platform_device; /* don't need the contents */
19 20
20#include <linux/gpio.h>
21#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
22#include <plat/iic.h> 22#include <plat/iic.h>
23 23
24void s3c_i2c0_cfg_gpio(struct platform_device *dev) 24#include <mach/i2c.h>
25
26void s5p6440_i2c0_cfg_gpio(struct platform_device *dev)
25{ 27{
26 s3c_gpio_cfgpin(S5P6440_GPB(5), S3C_GPIO_SFN(2)); 28 s3c_gpio_cfgpin(S5P6440_GPB(5), S3C_GPIO_SFN(2));
27 s3c_gpio_setpull(S5P6440_GPB(5), S3C_GPIO_PULL_UP); 29 s3c_gpio_setpull(S5P6440_GPB(5), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5P6440_GPB(6), S3C_GPIO_SFN(2)); 30 s3c_gpio_cfgpin(S5P6440_GPB(6), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5P6440_GPB(6), S3C_GPIO_PULL_UP); 31 s3c_gpio_setpull(S5P6440_GPB(6), S3C_GPIO_PULL_UP);
30} 32}
33
34void s5p6450_i2c0_cfg_gpio(struct platform_device *dev)
35{
36 s3c_gpio_cfgpin(S5P6450_GPB(5), S3C_GPIO_SFN(2));
37 s3c_gpio_setpull(S5P6450_GPB(5), S3C_GPIO_PULL_UP);
38 s3c_gpio_cfgpin(S5P6450_GPB(6), S3C_GPIO_SFN(2));
39 s3c_gpio_setpull(S5P6450_GPB(6), S3C_GPIO_PULL_UP);
40}
41
42void s3c_i2c0_cfg_gpio(struct platform_device *dev) { }
diff --git a/arch/arm/mach-s5p6440/setup-i2c1.c b/arch/arm/mach-s5p64x0/setup-i2c1.c
index 9a1537f786e0..2edd7912f8e4 100644
--- a/arch/arm/mach-s5p6440/setup-i2c1.c
+++ b/arch/arm/mach-s5p64x0/setup-i2c1.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-s5p6440/setup-i2c1.c 1/* linux/arch/arm/mach-s5p64xx/setup-i2c1.c
2 * 2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * I2C1 GPIO configuration. 6 * I2C1 GPIO configuration.
7 * 7 *
@@ -21,10 +21,22 @@ struct platform_device; /* don't need the contents */
21#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
22#include <plat/iic.h> 22#include <plat/iic.h>
23 23
24void s3c_i2c1_cfg_gpio(struct platform_device *dev) 24#include <mach/i2c.h>
25
26void s5p6440_i2c1_cfg_gpio(struct platform_device *dev)
25{ 27{
26 s3c_gpio_cfgpin(S5P6440_GPR(9), S3C_GPIO_SFN(6)); 28 s3c_gpio_cfgpin(S5P6440_GPR(9), S3C_GPIO_SFN(6));
27 s3c_gpio_setpull(S5P6440_GPR(9), S3C_GPIO_PULL_UP); 29 s3c_gpio_setpull(S5P6440_GPR(9), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5P6440_GPR(10), S3C_GPIO_SFN(6)); 30 s3c_gpio_cfgpin(S5P6440_GPR(10), S3C_GPIO_SFN(6));
29 s3c_gpio_setpull(S5P6440_GPR(10), S3C_GPIO_PULL_UP); 31 s3c_gpio_setpull(S5P6440_GPR(10), S3C_GPIO_PULL_UP);
30} 32}
33
34void s5p6450_i2c1_cfg_gpio(struct platform_device *dev)
35{
36 s3c_gpio_cfgpin(S5P6450_GPR(9), S3C_GPIO_SFN(6));
37 s3c_gpio_setpull(S5P6450_GPR(9), S3C_GPIO_PULL_UP);
38 s3c_gpio_cfgpin(S5P6450_GPR(10), S3C_GPIO_SFN(6));
39 s3c_gpio_setpull(S5P6450_GPR(10), S3C_GPIO_PULL_UP);
40}
41
42void s3c_i2c1_cfg_gpio(struct platform_device *dev) { }
diff --git a/arch/arm/mach-s5pc100/cpu.c b/arch/arm/mach-s5pc100/cpu.c
index 251c92ac5b22..fd2708e7d8a9 100644
--- a/arch/arm/mach-s5pc100/cpu.c
+++ b/arch/arm/mach-s5pc100/cpu.c
@@ -1,5 +1,8 @@
1/* linux/arch/arm/mach-s5pc100/cpu.c 1/* linux/arch/arm/mach-s5pc100/cpu.c
2 * 2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
3 * Copyright 2009 Samsung Electronics Co. 6 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com> 7 * Byungho Min <bhmin@samsung.com>
5 * 8 *
@@ -21,6 +24,7 @@
21#include <linux/sysdev.h> 24#include <linux/sysdev.h>
22#include <linux/serial_core.h> 25#include <linux/serial_core.h>
23#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/sched.h>
24 28
25#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 30#include <asm/mach/map.h>
@@ -56,11 +60,31 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
56 .length = SZ_16K, 60 .length = SZ_16K,
57 .type = MT_DEVICE, 61 .type = MT_DEVICE,
58 }, { 62 }, {
63 .virtual = (unsigned long)S5P_VA_GPIO,
64 .pfn = __phys_to_pfn(S5PC100_PA_GPIO),
65 .length = SZ_4K,
66 .type = MT_DEVICE,
67 }, {
68 .virtual = (unsigned long)VA_VIC0,
69 .pfn = __phys_to_pfn(S5PC100_PA_VIC0),
70 .length = SZ_16K,
71 .type = MT_DEVICE,
72 }, {
73 .virtual = (unsigned long)VA_VIC1,
74 .pfn = __phys_to_pfn(S5PC100_PA_VIC1),
75 .length = SZ_16K,
76 .type = MT_DEVICE,
77 }, {
59 .virtual = (unsigned long)VA_VIC2, 78 .virtual = (unsigned long)VA_VIC2,
60 .pfn = __phys_to_pfn(S5P_PA_VIC2), 79 .pfn = __phys_to_pfn(S5PC100_PA_VIC2),
61 .length = SZ_16K, 80 .length = SZ_16K,
62 .type = MT_DEVICE, 81 .type = MT_DEVICE,
63 }, { 82 }, {
83 .virtual = (unsigned long)S3C_VA_UART,
84 .pfn = __phys_to_pfn(S3C_PA_UART),
85 .length = SZ_512K,
86 .type = MT_DEVICE,
87 }, {
64 .virtual = (unsigned long)S5PC100_VA_OTHERS, 88 .virtual = (unsigned long)S5PC100_VA_OTHERS,
65 .pfn = __phys_to_pfn(S5PC100_PA_OTHERS), 89 .pfn = __phys_to_pfn(S5PC100_PA_OTHERS),
66 .length = SZ_4K, 90 .length = SZ_4K,
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
index 01b9134feff0..8751ef4a6804 100644
--- a/arch/arm/mach-s5pc100/include/mach/map.h
+++ b/arch/arm/mach-s5pc100/include/mach/map.h
@@ -44,19 +44,16 @@
44#define S5PC100_PA_OTHERS (0xE0200000) 44#define S5PC100_PA_OTHERS (0xE0200000)
45#define S5PC100_VA_OTHERS (S3C_VA_SYS + 0x10000) 45#define S5PC100_VA_OTHERS (S3C_VA_SYS + 0x10000)
46 46
47#define S5P_PA_GPIO (0xE0300000) 47#define S5PC100_PA_GPIO (0xE0300000)
48#define S5PC1XX_VA_GPIO S3C_ADDR(0x00500000) 48#define S5PC1XX_VA_GPIO S3C_ADDR(0x00500000)
49 49
50/* Interrupt */ 50/* Interrupt */
51#define S5PC100_PA_VIC (0xE4000000) 51#define S5PC100_PA_VIC0 (0xE4000000)
52#define S5PC100_PA_VIC1 (0xE4100000)
53#define S5PC100_PA_VIC2 (0xE4200000)
52#define S5PC100_VA_VIC S3C_VA_IRQ 54#define S5PC100_VA_VIC S3C_VA_IRQ
53#define S5PC100_PA_VIC_OFFSET 0x100000
54#define S5PC100_VA_VIC_OFFSET 0x10000 55#define S5PC100_VA_VIC_OFFSET 0x10000
55#define S5PC1XX_PA_VIC(x) (S5PC100_PA_VIC + ((x) * S5PC100_PA_VIC_OFFSET))
56#define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET)) 56#define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET))
57#define S5P_PA_VIC0 S5PC1XX_PA_VIC(0)
58#define S5P_PA_VIC1 S5PC1XX_PA_VIC(1)
59#define S5P_PA_VIC2 S5PC1XX_PA_VIC(2)
60 57
61 58
62#define S5PC100_PA_ONENAND (0xE7100000) 59#define S5PC100_PA_ONENAND (0xE7100000)
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index d3a38955c741..5315fec3db86 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -53,11 +53,6 @@ config S5PV210_SETUP_SDHCI_GPIO
53 help 53 help
54 Common setup code for SDHCI gpio. 54 Common setup code for SDHCI gpio.
55 55
56config S5PC110_DEV_ONENAND
57 bool
58 help
59 Compile in platform device definition for OneNAND1 controller
60
61menu "S5PC110 Machines" 56menu "S5PC110 Machines"
62 57
63config MACH_AQUILA 58config MACH_AQUILA
@@ -71,7 +66,7 @@ config MACH_AQUILA
71 select S3C_DEV_HSMMC 66 select S3C_DEV_HSMMC
72 select S3C_DEV_HSMMC1 67 select S3C_DEV_HSMMC1
73 select S3C_DEV_HSMMC2 68 select S3C_DEV_HSMMC2
74 select S5PC110_DEV_ONENAND 69 select S5P_DEV_ONENAND
75 select S5PV210_SETUP_FB_24BPP 70 select S5PV210_SETUP_FB_24BPP
76 select S5PV210_SETUP_SDHCI 71 select S5PV210_SETUP_SDHCI
77 help 72 help
@@ -88,7 +83,7 @@ config MACH_GONI
88 select S3C_DEV_HSMMC 83 select S3C_DEV_HSMMC
89 select S3C_DEV_HSMMC1 84 select S3C_DEV_HSMMC1
90 select S3C_DEV_HSMMC2 85 select S3C_DEV_HSMMC2
91 select S5PC110_DEV_ONENAND 86 select S5P_DEV_ONENAND
92 select S5PV210_SETUP_FB_24BPP 87 select S5PV210_SETUP_FB_24BPP
93 select S5PV210_SETUP_SDHCI 88 select S5PV210_SETUP_SDHCI
94 help 89 help
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 05048c5aa4c6..704548912408 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -26,7 +26,6 @@ obj-$(CONFIG_MACH_GONI) += mach-goni.o
26 26
27obj-y += dev-audio.o 27obj-y += dev-audio.o
28obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o 28obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
29obj-$(CONFIG_S5PC110_DEV_ONENAND) += dev-onenand.o
30 29
31obj-$(CONFIG_S5PV210_SETUP_FB_24BPP) += setup-fb-24bpp.o 30obj-$(CONFIG_S5PV210_SETUP_FB_24BPP) += setup-fb-24bpp.o
32obj-$(CONFIG_S5PV210_SETUP_I2C1) += setup-i2c1.o 31obj-$(CONFIG_S5PV210_SETUP_I2C1) += setup-i2c1.o
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index cfecd70657cb..d562670e1b0b 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -173,11 +173,6 @@ static int s5pv210_clk_ip3_ctrl(struct clk *clk, int enable)
173 return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable); 173 return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable);
174} 174}
175 175
176static int s5pv210_clk_ip4_ctrl(struct clk *clk, int enable)
177{
178 return s5p_gatectrl(S5P_CLKGATE_IP4, clk, enable);
179}
180
181static int s5pv210_clk_mask0_ctrl(struct clk *clk, int enable) 176static int s5pv210_clk_mask0_ctrl(struct clk *clk, int enable)
182{ 177{
183 return s5p_gatectrl(S5P_CLK_SRC_MASK0, clk, enable); 178 return s5p_gatectrl(S5P_CLK_SRC_MASK0, clk, enable);
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c
index 77f456c91ad3..2f16bfc0a116 100644
--- a/arch/arm/mach-s5pv210/cpu.c
+++ b/arch/arm/mach-s5pv210/cpu.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-s5pv210/cpu.c 1/* linux/arch/arm/mach-s5pv210/cpu.c
2 * 2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
@@ -19,6 +19,7 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/sysdev.h> 20#include <linux/sysdev.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/sched.h>
22 23
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
@@ -50,6 +51,21 @@ static struct map_desc s5pv210_iodesc[] __initdata = {
50 .length = SZ_4K, 51 .length = SZ_4K,
51 .type = MT_DEVICE, 52 .type = MT_DEVICE,
52 }, { 53 }, {
54 .virtual = (unsigned long)S5P_VA_GPIO,
55 .pfn = __phys_to_pfn(S5PV210_PA_GPIO),
56 .length = SZ_4K,
57 .type = MT_DEVICE,
58 }, {
59 .virtual = (unsigned long)VA_VIC0,
60 .pfn = __phys_to_pfn(S5PV210_PA_VIC0),
61 .length = SZ_16K,
62 .type = MT_DEVICE,
63 }, {
64 .virtual = (unsigned long)VA_VIC1,
65 .pfn = __phys_to_pfn(S5PV210_PA_VIC1),
66 .length = SZ_16K,
67 .type = MT_DEVICE,
68 }, {
53 .virtual = (unsigned long)VA_VIC2, 69 .virtual = (unsigned long)VA_VIC2,
54 .pfn = __phys_to_pfn(S5PV210_PA_VIC2), 70 .pfn = __phys_to_pfn(S5PV210_PA_VIC2),
55 .length = SZ_16K, 71 .length = SZ_16K,
@@ -60,6 +76,11 @@ static struct map_desc s5pv210_iodesc[] __initdata = {
60 .length = SZ_16K, 76 .length = SZ_16K,
61 .type = MT_DEVICE, 77 .type = MT_DEVICE,
62 }, { 78 }, {
79 .virtual = (unsigned long)S3C_VA_UART,
80 .pfn = __phys_to_pfn(S3C_PA_UART),
81 .length = SZ_512K,
82 .type = MT_DEVICE,
83 }, {
63 .virtual = (unsigned long)S5P_VA_SROMC, 84 .virtual = (unsigned long)S5P_VA_SROMC,
64 .pfn = __phys_to_pfn(S5PV210_PA_SROMC), 85 .pfn = __phys_to_pfn(S5PV210_PA_SROMC),
65 .length = SZ_4K, 86 .length = SZ_4K,
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h
index dd4fb6bf14b5..bd9afd52466a 100644
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ b/arch/arm/mach-s5pv210/include/mach/map.h
@@ -17,7 +17,10 @@
17#include <plat/map-s5p.h> 17#include <plat/map-s5p.h>
18 18
19#define S5PC110_PA_ONENAND (0xB0000000) 19#define S5PC110_PA_ONENAND (0xB0000000)
20#define S5P_PA_ONENAND S5PC110_PA_ONENAND
21
20#define S5PC110_PA_ONENAND_DMA (0xB0600000) 22#define S5PC110_PA_ONENAND_DMA (0xB0600000)
23#define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA
21 24
22#define S5PV210_PA_CHIPID (0xE0000000) 25#define S5PV210_PA_CHIPID (0xE0000000)
23#define S5P_PA_CHIPID S5PV210_PA_CHIPID 26#define S5P_PA_CHIPID S5PV210_PA_CHIPID
@@ -26,7 +29,6 @@
26#define S5P_PA_SYSCON S5PV210_PA_SYSCON 29#define S5P_PA_SYSCON S5PV210_PA_SYSCON
27 30
28#define S5PV210_PA_GPIO (0xE0200000) 31#define S5PV210_PA_GPIO (0xE0200000)
29#define S5P_PA_GPIO S5PV210_PA_GPIO
30 32
31/* SPI */ 33/* SPI */
32#define S5PV210_PA_SPI0 0xE1300000 34#define S5PV210_PA_SPI0 0xE1300000
@@ -72,16 +74,9 @@
72#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000)) 74#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000))
73 75
74#define S5PV210_PA_VIC0 (0xF2000000) 76#define S5PV210_PA_VIC0 (0xF2000000)
75#define S5P_PA_VIC0 S5PV210_PA_VIC0
76
77#define S5PV210_PA_VIC1 (0xF2100000) 77#define S5PV210_PA_VIC1 (0xF2100000)
78#define S5P_PA_VIC1 S5PV210_PA_VIC1
79
80#define S5PV210_PA_VIC2 (0xF2200000) 78#define S5PV210_PA_VIC2 (0xF2200000)
81#define S5P_PA_VIC2 S5PV210_PA_VIC2
82
83#define S5PV210_PA_VIC3 (0xF2300000) 79#define S5PV210_PA_VIC3 (0xF2300000)
84#define S5P_PA_VIC3 S5PV210_PA_VIC3
85 80
86#define S5PV210_PA_SDRAM (0x20000000) 81#define S5PV210_PA_SDRAM (0x20000000)
87#define S5P_PA_SDRAM S5PV210_PA_SDRAM 82#define S5P_PA_SDRAM S5PV210_PA_SDRAM
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index 0dda8012d6b2..bf772de6b0c3 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -477,7 +477,7 @@ static struct platform_device *aquila_devices[] __initdata = {
477 &aquila_i2c_gpio_pmic, 477 &aquila_i2c_gpio_pmic,
478 &aquila_device_gpiokeys, 478 &aquila_device_gpiokeys,
479 &s3c_device_fb, 479 &s3c_device_fb,
480 &s5pc110_device_onenand, 480 &s5p_device_onenand,
481 &s3c_device_hsmmc0, 481 &s3c_device_hsmmc0,
482 &s3c_device_hsmmc1, 482 &s3c_device_hsmmc1,
483 &s3c_device_hsmmc2, 483 &s3c_device_hsmmc2,
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 53754d7d364e..fdc5cca4eb41 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -456,7 +456,7 @@ static void goni_setup_sdhci(void)
456 456
457static struct platform_device *goni_devices[] __initdata = { 457static struct platform_device *goni_devices[] __initdata = {
458 &s3c_device_fb, 458 &s3c_device_fb,
459 &s5pc110_device_onenand, 459 &s5p_device_onenand,
460 &goni_i2c_gpio_pmic, 460 &goni_i2c_gpio_pmic,
461 &goni_device_gpiokeys, 461 &goni_device_gpiokeys,
462 &s5p_device_fimc0, 462 &s5p_device_fimc0,
diff --git a/arch/arm/mach-s5pv310/cpu.c b/arch/arm/mach-s5pv310/cpu.c
index e5b261a99ab2..4add39853ff9 100644
--- a/arch/arm/mach-s5pv310/cpu.c
+++ b/arch/arm/mach-s5pv310/cpu.c
@@ -31,9 +31,14 @@ extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq);
31/* Initial IO mappings */ 31/* Initial IO mappings */
32static struct map_desc s5pv310_iodesc[] __initdata = { 32static struct map_desc s5pv310_iodesc[] __initdata = {
33 { 33 {
34 .virtual = (unsigned long)S5P_VA_COREPERI_BASE, 34 .virtual = (unsigned long)S5P_VA_SYSRAM,
35 .pfn = __phys_to_pfn(S5PV310_PA_COREPERI), 35 .pfn = __phys_to_pfn(S5PV310_PA_SYSRAM),
36 .length = SZ_8K, 36 .length = SZ_4K,
37 .type = MT_DEVICE,
38 }, {
39 .virtual = (unsigned long)S5P_VA_CMU,
40 .pfn = __phys_to_pfn(S5PV310_PA_CMU),
41 .length = SZ_128K,
37 .type = MT_DEVICE, 42 .type = MT_DEVICE,
38 }, { 43 }, {
39 .virtual = (unsigned long)S5P_VA_COMBINER_BASE, 44 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
@@ -41,19 +46,24 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
41 .length = SZ_4K, 46 .length = SZ_4K,
42 .type = MT_DEVICE, 47 .type = MT_DEVICE,
43 }, { 48 }, {
49 .virtual = (unsigned long)S5P_VA_COREPERI_BASE,
50 .pfn = __phys_to_pfn(S5PV310_PA_COREPERI),
51 .length = SZ_8K,
52 .type = MT_DEVICE,
53 }, {
44 .virtual = (unsigned long)S5P_VA_L2CC, 54 .virtual = (unsigned long)S5P_VA_L2CC,
45 .pfn = __phys_to_pfn(S5PV310_PA_L2CC), 55 .pfn = __phys_to_pfn(S5PV310_PA_L2CC),
46 .length = SZ_4K, 56 .length = SZ_4K,
47 .type = MT_DEVICE, 57 .type = MT_DEVICE,
48 }, { 58 }, {
49 .virtual = (unsigned long)S5P_VA_SYSRAM, 59 .virtual = (unsigned long)S5P_VA_GPIO,
50 .pfn = __phys_to_pfn(S5PV310_PA_SYSRAM), 60 .pfn = __phys_to_pfn(S5PV310_PA_GPIO1),
51 .length = SZ_4K, 61 .length = SZ_4K,
52 .type = MT_DEVICE, 62 .type = MT_DEVICE,
53 }, { 63 }, {
54 .virtual = (unsigned long)S5P_VA_CMU, 64 .virtual = (unsigned long)S3C_VA_UART,
55 .pfn = __phys_to_pfn(S5PV310_PA_CMU), 65 .pfn = __phys_to_pfn(S3C_PA_UART),
56 .length = SZ_128K, 66 .length = SZ_512K,
57 .type = MT_DEVICE, 67 .type = MT_DEVICE,
58 }, 68 },
59}; 69};
diff --git a/arch/arm/mach-s5pv310/include/mach/irqs.h b/arch/arm/mach-s5pv310/include/mach/irqs.h
index 4cdedda6e652..471fc3bb199a 100644
--- a/arch/arm/mach-s5pv310/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv310/include/mach/irqs.h
@@ -68,6 +68,8 @@
68 68
69#define IRQ_IIC COMBINER_IRQ(27, 0) 69#define IRQ_IIC COMBINER_IRQ(27, 0)
70 70
71#define IRQ_ONENAND_AUDI COMBINER_IRQ(34, 0)
72
71/* Set the default NR_IRQS */ 73/* Set the default NR_IRQS */
72 74
73#define NR_IRQS COMBINER_IRQ(MAX_COMBINER_NR, 0) 75#define NR_IRQS COMBINER_IRQ(MAX_COMBINER_NR, 0)
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h b/arch/arm/mach-s5pv310/include/mach/map.h
index 213e1101a3b3..aff6d23624bb 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -25,6 +25,12 @@
25 25
26#define S5PV310_PA_SYSRAM (0x02025000) 26#define S5PV310_PA_SYSRAM (0x02025000)
27 27
28#define S5PC210_PA_ONENAND (0x0C000000)
29#define S5P_PA_ONENAND S5PC210_PA_ONENAND
30
31#define S5PC210_PA_ONENAND_DMA (0x0C600000)
32#define S5P_PA_ONENAND_DMA S5PC210_PA_ONENAND_DMA
33
28#define S5PV310_PA_CHIPID (0x10000000) 34#define S5PV310_PA_CHIPID (0x10000000)
29#define S5P_PA_CHIPID S5PV310_PA_CHIPID 35#define S5P_PA_CHIPID S5PV310_PA_CHIPID
30 36
@@ -46,7 +52,6 @@
46#define S5PV310_PA_GPIO1 (0x11400000) 52#define S5PV310_PA_GPIO1 (0x11400000)
47#define S5PV310_PA_GPIO2 (0x11000000) 53#define S5PV310_PA_GPIO2 (0x11000000)
48#define S5PV310_PA_GPIO3 (0x03860000) 54#define S5PV310_PA_GPIO3 (0x03860000)
49#define S5P_PA_GPIO S5PV310_PA_GPIO1
50 55
51#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) 56#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000))
52 57
diff --git a/arch/arm/mach-shark/include/mach/vmalloc.h b/arch/arm/mach-shark/include/mach/vmalloc.h
index f6c6837c5451..8e845b6a7cb5 100644
--- a/arch/arm/mach-shark/include/mach/vmalloc.h
+++ b/arch/arm/mach-shark/include/mach/vmalloc.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * arch/arm/mach-shark/include/mach/vmalloc.h 2 * arch/arm/mach-shark/include/mach/vmalloc.h
3 */ 3 */
4#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 4#define VMALLOC_END 0xd0000000
diff --git a/arch/arm/mach-tcc8k/Kconfig b/arch/arm/mach-tcc8k/Kconfig
new file mode 100644
index 000000000000..ad86415d1577
--- /dev/null
+++ b/arch/arm/mach-tcc8k/Kconfig
@@ -0,0 +1,11 @@
1if ARCH_TCC8K
2
3comment "TCC8000 systems:"
4
5config MACH_TCC8000_SDK
6 bool "Telechips TCC8000-SDK development kit"
7 default y
8 help
9 Support for the Telechips TCC8000-SDK board.
10
11endif
diff --git a/arch/arm/mach-tcc8k/Makefile b/arch/arm/mach-tcc8k/Makefile
new file mode 100644
index 000000000000..9bacf31e49ba
--- /dev/null
+++ b/arch/arm/mach-tcc8k/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for TCC8K boards and common files.
3#
4
5# Common support
6obj-y += clock.o irq.o time.o io.o devices.o
7
8# Board specific support
9obj-$(CONFIG_MACH_TCC8000_SDK) += board-tcc8000-sdk.o
diff --git a/arch/arm/mach-tcc8k/Makefile.boot b/arch/arm/mach-tcc8k/Makefile.boot
new file mode 100644
index 000000000000..f135c9deae10
--- /dev/null
+++ b/arch/arm/mach-tcc8k/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x20008000
2params_phys-y := 0x20000100
3initrd_phys-y := 0x20800000
diff --git a/arch/arm/mach-tcc8k/board-tcc8000-sdk.c b/arch/arm/mach-tcc8k/board-tcc8000-sdk.c
new file mode 100644
index 000000000000..4e42555b2009
--- /dev/null
+++ b/arch/arm/mach-tcc8k/board-tcc8000-sdk.c
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2009 Hans J. Koch <hjk@linutronix.de>
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/init.h>
10#include <linux/kernel.h>
11#include <linux/platform_device.h>
12
13#include <asm/mach-types.h>
14
15#include <asm/mach/arch.h>
16#include <asm/mach/map.h>
17#include <asm/mach/time.h>
18
19#include <mach/clock.h>
20
21#include "common.h"
22
23#define XI_FREQUENCY 12000000
24#define XTI_FREQUENCY 32768
25
26#ifdef CONFIG_MTD_NAND_TCC
27/* NAND */
28static struct tcc_nand_platform_data tcc8k_sdk_nand_data = {
29 .width = 1,
30 .hw_ecc = 0,
31};
32#endif
33
34static void __init tcc8k_init(void)
35{
36#ifdef CONFIG_MTD_NAND_TCC
37 tcc_nand_device.dev.platform_data = &tcc8k_sdk_nand_data;
38 platform_device_register(&tcc_nand_device);
39#endif
40}
41
42static void __init tcc8k_init_timer(void)
43{
44 tcc_clocks_init(XI_FREQUENCY, XTI_FREQUENCY);
45}
46
47static struct sys_timer tcc8k_timer = {
48 .init = tcc8k_init_timer,
49};
50
51static void __init tcc8k_map_io(void)
52{
53 tcc8k_map_common_io();
54}
55
56MACHINE_START(TCC8000_SDK, "Telechips TCC8000-SDK Demo Board")
57 .phys_io = 0x90000000,
58 .io_pg_offst = ((0xf1000000) >> 18) & 0xfffc,
59 .boot_params = PHYS_OFFSET + 0x00000100,
60 .map_io = tcc8k_map_io,
61 .init_irq = tcc8k_init_irq,
62 .init_machine = tcc8k_init,
63 .timer = &tcc8k_timer,
64MACHINE_END
diff --git a/arch/arm/mach-tcc8k/clock.c b/arch/arm/mach-tcc8k/clock.c
new file mode 100644
index 000000000000..ba32a15127ab
--- /dev/null
+++ b/arch/arm/mach-tcc8k/clock.c
@@ -0,0 +1,567 @@
1/*
2 * Lowlevel clock handling for Telechips TCC8xxx SoCs
3 *
4 * Copyright (C) 2010 by Hans J. Koch <hjk@linutronix.de>
5 *
6 * Licensed under the terms of the GPL v2
7 */
8
9#include <linux/clk.h>
10#include <linux/delay.h>
11#include <linux/err.h>
12#include <linux/io.h>
13#include <linux/module.h>
14#include <linux/spinlock.h>
15
16#include <asm/clkdev.h>
17
18#include <mach/clock.h>
19#include <mach/irqs.h>
20#include <mach/tcc8k-regs.h>
21
22#include "common.h"
23
24#define BCLKCTR0 (CKC_BASE + BCLKCTR0_OFFS)
25#define BCLKCTR1 (CKC_BASE + BCLKCTR1_OFFS)
26
27#define ACLKREF (CKC_BASE + ACLKREF_OFFS)
28#define ACLKUART0 (CKC_BASE + ACLKUART0_OFFS)
29#define ACLKUART1 (CKC_BASE + ACLKUART1_OFFS)
30#define ACLKUART2 (CKC_BASE + ACLKUART2_OFFS)
31#define ACLKUART3 (CKC_BASE + ACLKUART3_OFFS)
32#define ACLKUART4 (CKC_BASE + ACLKUART4_OFFS)
33#define ACLKI2C (CKC_BASE + ACLKI2C_OFFS)
34#define ACLKADC (CKC_BASE + ACLKADC_OFFS)
35#define ACLKUSBH (CKC_BASE + ACLKUSBH_OFFS)
36#define ACLKLCD (CKC_BASE + ACLKLCD_OFFS)
37#define ACLKSDH0 (CKC_BASE + ACLKSDH0_OFFS)
38#define ACLKSDH1 (CKC_BASE + ACLKSDH1_OFFS)
39#define ACLKSPI0 (CKC_BASE + ACLKSPI0_OFFS)
40#define ACLKSPI1 (CKC_BASE + ACLKSPI1_OFFS)
41#define ACLKSPDIF (CKC_BASE + ACLKSPDIF_OFFS)
42#define ACLKC3DEC (CKC_BASE + ACLKC3DEC_OFFS)
43#define ACLKCAN0 (CKC_BASE + ACLKCAN0_OFFS)
44#define ACLKCAN1 (CKC_BASE + ACLKCAN1_OFFS)
45#define ACLKGSB0 (CKC_BASE + ACLKGSB0_OFFS)
46#define ACLKGSB1 (CKC_BASE + ACLKGSB1_OFFS)
47#define ACLKGSB2 (CKC_BASE + ACLKGSB2_OFFS)
48#define ACLKGSB3 (CKC_BASE + ACLKGSB3_OFFS)
49#define ACLKUSBH (CKC_BASE + ACLKUSBH_OFFS)
50#define ACLKTCT (CKC_BASE + ACLKTCT_OFFS)
51#define ACLKTCX (CKC_BASE + ACLKTCX_OFFS)
52#define ACLKTCZ (CKC_BASE + ACLKTCZ_OFFS)
53
54/* Crystal frequencies */
55static unsigned long xi_rate, xti_rate;
56
57static void __iomem *pll_cfg_addr(int pll)
58{
59 switch (pll) {
60 case 0: return (CKC_BASE + PLL0CFG_OFFS);
61 case 1: return (CKC_BASE + PLL1CFG_OFFS);
62 case 2: return (CKC_BASE + PLL2CFG_OFFS);
63 default:
64 BUG();
65 }
66}
67
68static int pll_enable(int pll, int enable)
69{
70 u32 reg;
71 void __iomem *addr = pll_cfg_addr(pll);
72
73 reg = __raw_readl(addr);
74 if (enable)
75 reg &= ~PLLxCFG_PD;
76 else
77 reg |= PLLxCFG_PD;
78
79 __raw_writel(reg, addr);
80 return 0;
81}
82
83static int xi_enable(int enable)
84{
85 u32 reg;
86
87 reg = __raw_readl(CKC_BASE + CLKCTRL_OFFS);
88 if (enable)
89 reg |= CLKCTRL_XE;
90 else
91 reg &= ~CLKCTRL_XE;
92
93 __raw_writel(reg, CKC_BASE + CLKCTRL_OFFS);
94 return 0;
95}
96
97static int root_clk_enable(enum root_clks src)
98{
99 switch (src) {
100 case CLK_SRC_PLL0: return pll_enable(0, 1);
101 case CLK_SRC_PLL1: return pll_enable(1, 1);
102 case CLK_SRC_PLL2: return pll_enable(2, 1);
103 case CLK_SRC_XI: return xi_enable(1);
104 default:
105 BUG();
106 }
107 return 0;
108}
109
110static int root_clk_disable(enum root_clks root_src)
111{
112 switch (root_src) {
113 case CLK_SRC_PLL0: return pll_enable(0, 0);
114 case CLK_SRC_PLL1: return pll_enable(1, 0);
115 case CLK_SRC_PLL2: return pll_enable(2, 0);
116 case CLK_SRC_XI: return xi_enable(0);
117 default:
118 BUG();
119 }
120 return 0;
121}
122
123static int enable_clk(struct clk *clk)
124{
125 u32 reg;
126
127 if (clk->root_id != CLK_SRC_NOROOT)
128 return root_clk_enable(clk->root_id);
129
130 if (clk->aclkreg) {
131 reg = __raw_readl(clk->aclkreg);
132 reg |= ACLK_EN;
133 __raw_writel(reg, clk->aclkreg);
134 }
135 if (clk->bclkctr) {
136 reg = __raw_readl(clk->bclkctr);
137 reg |= 1 << clk->bclk_shift;
138 __raw_writel(reg, clk->bclkctr);
139 }
140 return 0;
141}
142
143static void disable_clk(struct clk *clk)
144{
145 u32 reg;
146
147 if (clk->root_id != CLK_SRC_NOROOT) {
148 root_clk_disable(clk->root_id);
149 return;
150 }
151
152 if (clk->bclkctr) {
153 reg = __raw_readl(clk->bclkctr);
154 reg &= ~(1 << clk->bclk_shift);
155 __raw_writel(reg, clk->bclkctr);
156 }
157 if (clk->aclkreg) {
158 reg = __raw_readl(clk->aclkreg);
159 reg &= ~ACLK_EN;
160 __raw_writel(reg, clk->aclkreg);
161 }
162}
163
164static unsigned long get_rate_pll(int pll)
165{
166 u32 reg;
167 unsigned long s, m, p;
168 void __iomem *addr = pll_cfg_addr(pll);
169
170 reg = __raw_readl(addr);
171 s = (reg >> 16) & 0x07;
172 m = (reg >> 8) & 0xff;
173 p = reg & 0x3f;
174
175 return (m * xi_rate) / (p * (1 << s));
176}
177
178static unsigned long get_rate_pll_div(int pll)
179{
180 u32 reg;
181 unsigned long div = 0;
182 void __iomem *addr;
183
184 switch (pll) {
185 case 0:
186 addr = CKC_BASE + CLKDIVC0_OFFS;
187 reg = __raw_readl(addr);
188 if (reg & CLKDIVC0_P0E)
189 div = (reg >> 24) & 0x3f;
190 break;
191 case 1:
192 addr = CKC_BASE + CLKDIVC0_OFFS;
193 reg = __raw_readl(addr);
194 if (reg & CLKDIVC0_P1E)
195 div = (reg >> 16) & 0x3f;
196 break;
197 case 2:
198 addr = CKC_BASE + CLKDIVC1_OFFS;
199 reg = __raw_readl(addr);
200 if (reg & CLKDIVC1_P2E)
201 div = __raw_readl(addr) & 0x3f;
202 break;
203 }
204 return get_rate_pll(pll) / (div + 1);
205}
206
207static unsigned long get_rate_xi_div(void)
208{
209 unsigned long div = 0;
210 u32 reg = __raw_readl(CKC_BASE + CLKDIVC0_OFFS);
211
212 if (reg & CLKDIVC0_XE)
213 div = (reg >> 8) & 0x3f;
214
215 return xi_rate / (div + 1);
216}
217
218static unsigned long get_rate_xti_div(void)
219{
220 unsigned long div = 0;
221 u32 reg = __raw_readl(CKC_BASE + CLKDIVC0_OFFS);
222
223 if (reg & CLKDIVC0_XTE)
224 div = reg & 0x3f;
225
226 return xti_rate / (div + 1);
227}
228
229static unsigned long root_clk_get_rate(enum root_clks src)
230{
231 switch (src) {
232 case CLK_SRC_PLL0: return get_rate_pll(0);
233 case CLK_SRC_PLL1: return get_rate_pll(1);
234 case CLK_SRC_PLL2: return get_rate_pll(2);
235 case CLK_SRC_PLL0DIV: return get_rate_pll_div(0);
236 case CLK_SRC_PLL1DIV: return get_rate_pll_div(1);
237 case CLK_SRC_PLL2DIV: return get_rate_pll_div(2);
238 case CLK_SRC_XI: return xi_rate;
239 case CLK_SRC_XTI: return xti_rate;
240 case CLK_SRC_XIDIV: return get_rate_xi_div();
241 case CLK_SRC_XTIDIV: return get_rate_xti_div();
242 default: return 0;
243 }
244}
245
246static unsigned long aclk_get_rate(struct clk *clk)
247{
248 u32 reg;
249 unsigned long div;
250 unsigned int src;
251
252 reg = __raw_readl(clk->aclkreg);
253 div = reg & 0x0fff;
254 src = (reg >> ACLK_SEL_SHIFT) & CLK_SRC_MASK;
255 return root_clk_get_rate(src) / (div + 1);
256}
257
258static unsigned long aclk_best_div(struct clk *clk, unsigned long rate)
259{
260 unsigned long div, src, freq, r1, r2;
261
262 src = __raw_readl(clk->aclkreg) >> ACLK_SEL_SHIFT;
263 src &= CLK_SRC_MASK;
264 freq = root_clk_get_rate(src);
265 div = freq / rate + 1;
266 r1 = freq / div;
267 r2 = freq / (div + 1);
268 if (r2 >= rate)
269 return div + 1;
270 if ((rate - r2) < (r1 - rate))
271 return div + 1;
272
273 return div;
274}
275
276static unsigned long aclk_round_rate(struct clk *clk, unsigned long rate)
277{
278 unsigned int src;
279
280 src = __raw_readl(clk->aclkreg) >> ACLK_SEL_SHIFT;
281 src &= CLK_SRC_MASK;
282
283 return root_clk_get_rate(src) / aclk_best_div(clk, rate);
284}
285
286static int aclk_set_rate(struct clk *clk, unsigned long rate)
287{
288 u32 reg;
289
290 reg = __raw_readl(clk->aclkreg) & ~ACLK_DIV_MASK;
291 reg |= aclk_best_div(clk, rate);
292 return 0;
293}
294
295static unsigned long get_rate_sys(struct clk *clk)
296{
297 unsigned int src;
298
299 src = __raw_readl(CKC_BASE + CLKCTRL_OFFS) & CLK_SRC_MASK;
300 return root_clk_get_rate(src);
301}
302
303static unsigned long get_rate_bus(struct clk *clk)
304{
305 unsigned int div;
306
307 div = (__raw_readl(CKC_BASE + CLKCTRL_OFFS) >> 4) & 0xff;
308 return get_rate_sys(clk) / (div + 1);
309}
310
311static unsigned long get_rate_cpu(struct clk *clk)
312{
313 unsigned int reg, div, fsys, fbus;
314
315 fbus = get_rate_bus(clk);
316 reg = __raw_readl(CKC_BASE + CLKCTRL_OFFS);
317 if (reg & (1 << 29))
318 return fbus;
319 fsys = get_rate_sys(clk);
320 div = (reg >> 16) & 0x0f;
321 return fbus + ((fsys - fbus) * (div + 1)) / 16;
322}
323
324static unsigned long get_rate_root(struct clk *clk)
325{
326 return root_clk_get_rate(clk->root_id);
327}
328
329static int aclk_set_parent(struct clk *clock, struct clk *parent)
330{
331 u32 reg;
332
333 if (clock->parent == parent)
334 return 0;
335
336 clock->parent = parent;
337
338 if (!parent)
339 return 0;
340
341 if (parent->root_id == CLK_SRC_NOROOT)
342 return 0;
343 reg = __raw_readl(clock->aclkreg);
344 reg &= ~ACLK_SEL_MASK;
345 reg |= (parent->root_id << ACLK_SEL_SHIFT) & ACLK_SEL_MASK;
346 __raw_writel(reg, clock->aclkreg);
347
348 return 0;
349}
350
351#define DEFINE_ROOT_CLOCK(name, ri, p) \
352 static struct clk name = { \
353 .root_id = ri, \
354 .get_rate = get_rate_root, \
355 .enable = enable_clk, \
356 .disable = disable_clk, \
357 .parent = p, \
358 };
359
360#define DEFINE_SPECIAL_CLOCK(name, gr, p) \
361 static struct clk name = { \
362 .root_id = CLK_SRC_NOROOT, \
363 .get_rate = gr, \
364 .parent = p, \
365 };
366
367#define DEFINE_ACLOCK(name, bc, bs, ar) \
368 static struct clk name = { \
369 .root_id = CLK_SRC_NOROOT, \
370 .bclkctr = bc, \
371 .bclk_shift = bs, \
372 .aclkreg = ar, \
373 .get_rate = aclk_get_rate, \
374 .set_rate = aclk_set_rate, \
375 .round_rate = aclk_round_rate, \
376 .enable = enable_clk, \
377 .disable = disable_clk, \
378 .set_parent = aclk_set_parent, \
379 };
380
381#define DEFINE_BCLOCK(name, bc, bs, gr, p) \
382 static struct clk name = { \
383 .root_id = CLK_SRC_NOROOT, \
384 .bclkctr = bc, \
385 .bclk_shift = bs, \
386 .get_rate = gr, \
387 .enable = enable_clk, \
388 .disable = disable_clk, \
389 .parent = p, \
390 };
391
392DEFINE_ROOT_CLOCK(xi, CLK_SRC_XI, NULL)
393DEFINE_ROOT_CLOCK(xti, CLK_SRC_XTI, NULL)
394DEFINE_ROOT_CLOCK(xidiv, CLK_SRC_XIDIV, &xi)
395DEFINE_ROOT_CLOCK(xtidiv, CLK_SRC_XTIDIV, &xti)
396DEFINE_ROOT_CLOCK(pll0, CLK_SRC_PLL0, &xi)
397DEFINE_ROOT_CLOCK(pll1, CLK_SRC_PLL1, &xi)
398DEFINE_ROOT_CLOCK(pll2, CLK_SRC_PLL2, &xi)
399DEFINE_ROOT_CLOCK(pll0div, CLK_SRC_PLL0DIV, &pll0)
400DEFINE_ROOT_CLOCK(pll1div, CLK_SRC_PLL1DIV, &pll1)
401DEFINE_ROOT_CLOCK(pll2div, CLK_SRC_PLL2DIV, &pll2)
402
403/* The following 3 clocks are special and are initialized explicitly later */
404DEFINE_SPECIAL_CLOCK(sys, get_rate_sys, NULL)
405DEFINE_SPECIAL_CLOCK(bus, get_rate_bus, &sys)
406DEFINE_SPECIAL_CLOCK(cpu, get_rate_cpu, &sys)
407
408DEFINE_ACLOCK(tct, NULL, 0, ACLKTCT)
409DEFINE_ACLOCK(tcx, NULL, 0, ACLKTCX)
410DEFINE_ACLOCK(tcz, NULL, 0, ACLKTCZ)
411DEFINE_ACLOCK(ref, NULL, 0, ACLKREF)
412DEFINE_ACLOCK(uart0, BCLKCTR0, 5, ACLKUART0)
413DEFINE_ACLOCK(uart1, BCLKCTR0, 23, ACLKUART1)
414DEFINE_ACLOCK(uart2, BCLKCTR0, 6, ACLKUART2)
415DEFINE_ACLOCK(uart3, BCLKCTR0, 8, ACLKUART3)
416DEFINE_ACLOCK(uart4, BCLKCTR1, 6, ACLKUART4)
417DEFINE_ACLOCK(i2c, BCLKCTR0, 7, ACLKI2C)
418DEFINE_ACLOCK(adc, BCLKCTR0, 10, ACLKADC)
419DEFINE_ACLOCK(usbh0, BCLKCTR0, 11, ACLKUSBH)
420DEFINE_ACLOCK(lcd, BCLKCTR0, 13, ACLKLCD)
421DEFINE_ACLOCK(sd0, BCLKCTR0, 17, ACLKSDH0)
422DEFINE_ACLOCK(sd1, BCLKCTR1, 5, ACLKSDH1)
423DEFINE_ACLOCK(spi0, BCLKCTR0, 24, ACLKSPI0)
424DEFINE_ACLOCK(spi1, BCLKCTR0, 30, ACLKSPI1)
425DEFINE_ACLOCK(spdif, BCLKCTR1, 2, ACLKSPDIF)
426DEFINE_ACLOCK(c3dec, BCLKCTR1, 9, ACLKC3DEC)
427DEFINE_ACLOCK(can0, BCLKCTR1, 10, ACLKCAN0)
428DEFINE_ACLOCK(can1, BCLKCTR1, 11, ACLKCAN1)
429DEFINE_ACLOCK(gsb0, BCLKCTR1, 13, ACLKGSB0)
430DEFINE_ACLOCK(gsb1, BCLKCTR1, 14, ACLKGSB1)
431DEFINE_ACLOCK(gsb2, BCLKCTR1, 15, ACLKGSB2)
432DEFINE_ACLOCK(gsb3, BCLKCTR1, 16, ACLKGSB3)
433DEFINE_ACLOCK(usbh1, BCLKCTR1, 20, ACLKUSBH)
434
435DEFINE_BCLOCK(dai0, BCLKCTR0, 0, NULL, NULL)
436DEFINE_BCLOCK(pic, BCLKCTR0, 1, NULL, NULL)
437DEFINE_BCLOCK(tc, BCLKCTR0, 2, NULL, NULL)
438DEFINE_BCLOCK(gpio, BCLKCTR0, 3, NULL, NULL)
439DEFINE_BCLOCK(usbd, BCLKCTR0, 4, NULL, NULL)
440DEFINE_BCLOCK(ecc, BCLKCTR0, 9, NULL, NULL)
441DEFINE_BCLOCK(gdma0, BCLKCTR0, 12, NULL, NULL)
442DEFINE_BCLOCK(rtc, BCLKCTR0, 15, NULL, NULL)
443DEFINE_BCLOCK(nfc, BCLKCTR0, 16, NULL, NULL)
444DEFINE_BCLOCK(g2d, BCLKCTR0, 18, NULL, NULL)
445DEFINE_BCLOCK(gdma1, BCLKCTR0, 22, NULL, NULL)
446DEFINE_BCLOCK(mscl, BCLKCTR0, 25, NULL, NULL)
447DEFINE_BCLOCK(bdma, BCLKCTR1, 0, NULL, NULL)
448DEFINE_BCLOCK(adma0, BCLKCTR1, 1, NULL, NULL)
449DEFINE_BCLOCK(scfg, BCLKCTR1, 3, NULL, NULL)
450DEFINE_BCLOCK(cid, BCLKCTR1, 4, NULL, NULL)
451DEFINE_BCLOCK(dai1, BCLKCTR1, 7, NULL, NULL)
452DEFINE_BCLOCK(adma1, BCLKCTR1, 8, NULL, NULL)
453DEFINE_BCLOCK(gps, BCLKCTR1, 12, NULL, NULL)
454DEFINE_BCLOCK(gdma2, BCLKCTR1, 17, NULL, NULL)
455DEFINE_BCLOCK(gdma3, BCLKCTR1, 18, NULL, NULL)
456DEFINE_BCLOCK(ddrc, BCLKCTR1, 19, NULL, NULL)
457
458#define _REGISTER_CLOCK(d, n, c) \
459 { \
460 .dev_id = d, \
461 .con_id = n, \
462 .clk = &c, \
463 },
464
465static struct clk_lookup lookups[] = {
466 _REGISTER_CLOCK(NULL, "bus", bus)
467 _REGISTER_CLOCK(NULL, "cpu", cpu)
468 _REGISTER_CLOCK(NULL, "tct", tct)
469 _REGISTER_CLOCK(NULL, "tcx", tcx)
470 _REGISTER_CLOCK(NULL, "tcz", tcz)
471 _REGISTER_CLOCK(NULL, "ref", ref)
472 _REGISTER_CLOCK(NULL, "dai0", dai0)
473 _REGISTER_CLOCK(NULL, "pic", pic)
474 _REGISTER_CLOCK(NULL, "tc", tc)
475 _REGISTER_CLOCK(NULL, "gpio", gpio)
476 _REGISTER_CLOCK(NULL, "usbd", usbd)
477 _REGISTER_CLOCK("tcc-uart.0", NULL, uart0)
478 _REGISTER_CLOCK("tcc-uart.2", NULL, uart2)
479 _REGISTER_CLOCK("tcc-i2c", NULL, i2c)
480 _REGISTER_CLOCK("tcc-uart.3", NULL, uart3)
481 _REGISTER_CLOCK(NULL, "ecc", ecc)
482 _REGISTER_CLOCK(NULL, "adc", adc)
483 _REGISTER_CLOCK("tcc-usbh.0", "usb", usbh0)
484 _REGISTER_CLOCK(NULL, "gdma0", gdma0)
485 _REGISTER_CLOCK(NULL, "lcd", lcd)
486 _REGISTER_CLOCK(NULL, "rtc", rtc)
487 _REGISTER_CLOCK(NULL, "nfc", nfc)
488 _REGISTER_CLOCK("tcc-mmc.0", NULL, sd0)
489 _REGISTER_CLOCK(NULL, "g2d", g2d)
490 _REGISTER_CLOCK(NULL, "gdma1", gdma1)
491 _REGISTER_CLOCK("tcc-uart.1", NULL, uart1)
492 _REGISTER_CLOCK("tcc-spi.0", NULL, spi0)
493 _REGISTER_CLOCK(NULL, "mscl", mscl)
494 _REGISTER_CLOCK("tcc-spi.1", NULL, spi1)
495 _REGISTER_CLOCK(NULL, "bdma", bdma)
496 _REGISTER_CLOCK(NULL, "adma0", adma0)
497 _REGISTER_CLOCK(NULL, "spdif", spdif)
498 _REGISTER_CLOCK(NULL, "scfg", scfg)
499 _REGISTER_CLOCK(NULL, "cid", cid)
500 _REGISTER_CLOCK("tcc-mmc.1", NULL, sd1)
501 _REGISTER_CLOCK("tcc-uart.4", NULL, uart4)
502 _REGISTER_CLOCK(NULL, "dai1", dai1)
503 _REGISTER_CLOCK(NULL, "adma1", adma1)
504 _REGISTER_CLOCK(NULL, "c3dec", c3dec)
505 _REGISTER_CLOCK("tcc-can.0", NULL, can0)
506 _REGISTER_CLOCK("tcc-can.1", NULL, can1)
507 _REGISTER_CLOCK(NULL, "gps", gps)
508 _REGISTER_CLOCK("tcc-gsb.0", NULL, gsb0)
509 _REGISTER_CLOCK("tcc-gsb.1", NULL, gsb1)
510 _REGISTER_CLOCK("tcc-gsb.2", NULL, gsb2)
511 _REGISTER_CLOCK("tcc-gsb.3", NULL, gsb3)
512 _REGISTER_CLOCK(NULL, "gdma2", gdma2)
513 _REGISTER_CLOCK(NULL, "gdma3", gdma3)
514 _REGISTER_CLOCK(NULL, "ddrc", ddrc)
515 _REGISTER_CLOCK("tcc-usbh.1", "usb", usbh1)
516};
517
518static struct clk *root_clk_by_index(enum root_clks src)
519{
520 switch (src) {
521 case CLK_SRC_PLL0: return &pll0;
522 case CLK_SRC_PLL1: return &pll1;
523 case CLK_SRC_PLL2: return &pll2;
524 case CLK_SRC_PLL0DIV: return &pll0div;
525 case CLK_SRC_PLL1DIV: return &pll1div;
526 case CLK_SRC_PLL2DIV: return &pll2div;
527 case CLK_SRC_XI: return &xi;
528 case CLK_SRC_XTI: return &xti;
529 case CLK_SRC_XIDIV: return &xidiv;
530 case CLK_SRC_XTIDIV: return &xtidiv;
531 default: return NULL;
532 }
533}
534
535static void find_aclk_parent(struct clk *clk)
536{
537 unsigned int src;
538 struct clk *clock;
539
540 if (!clk->aclkreg)
541 return;
542
543 src = __raw_readl(clk->aclkreg) >> ACLK_SEL_SHIFT;
544 src &= CLK_SRC_MASK;
545
546 clock = root_clk_by_index(src);
547 if (!clock)
548 return;
549
550 clk->parent = clock;
551 clk->set_parent = aclk_set_parent;
552}
553
554void __init tcc_clocks_init(unsigned long xi_freq, unsigned long xti_freq)
555{
556 int i;
557
558 xi_rate = xi_freq;
559 xti_rate = xti_freq;
560
561 /* fixup parents and add the clock */
562 for (i = 0; i < ARRAY_SIZE(lookups); i++) {
563 find_aclk_parent(lookups[i].clk);
564 clkdev_add(&lookups[i]);
565 }
566 tcc8k_timer_init(&tcz, (void __iomem *)TIMER_BASE, INT_TC32);
567}
diff --git a/arch/arm/mach-tcc8k/common.h b/arch/arm/mach-tcc8k/common.h
new file mode 100644
index 000000000000..705690add395
--- /dev/null
+++ b/arch/arm/mach-tcc8k/common.h
@@ -0,0 +1,15 @@
1#ifndef MACH_TCC8K_COMMON_H
2#define MACH_TCC8K_COMMON_H
3
4#include <linux/platform_device.h>
5
6extern struct platform_device tcc_nand_device;
7
8struct clk;
9
10extern void tcc_clocks_init(unsigned long xi_freq, unsigned long xti_freq);
11extern void tcc8k_timer_init(struct clk *clock, void __iomem *base, int irq);
12extern void tcc8k_init_irq(void);
13extern void tcc8k_map_common_io(void);
14
15#endif
diff --git a/arch/arm/mach-tcc8k/devices.c b/arch/arm/mach-tcc8k/devices.c
new file mode 100644
index 000000000000..6722ad7c2836
--- /dev/null
+++ b/arch/arm/mach-tcc8k/devices.c
@@ -0,0 +1,239 @@
1/*
2 * linux/arch/arm/mach-tcc8k/devices.c
3 *
4 * Copyright (C) Telechips, Inc.
5 * Copyright (C) 2009 Hans J. Koch <hjk@linutronix.de>
6 *
7 * Licensed under the terms of GPL v2.
8 *
9 */
10
11#include <linux/dma-mapping.h>
12#include <linux/init.h>
13#include <linux/io.h>
14#include <linux/kernel.h>
15#include <linux/module.h>
16
17#include <asm/mach/map.h>
18
19#include <mach/tcc8k-regs.h>
20#include <mach/irqs.h>
21
22#include "common.h"
23
24static u64 tcc8k_dmamask = DMA_BIT_MASK(32);
25
26#ifdef CONFIG_MTD_NAND_TCC
27/* NAND controller */
28static struct resource tcc_nand_resources[] = {
29 {
30 .start = (resource_size_t)NFC_BASE,
31 .end = (resource_size_t)NFC_BASE + 0x7f,
32 .flags = IORESOURCE_MEM,
33 }, {
34 .start = INT_NFC,
35 .end = INT_NFC,
36 .flags = IORESOURCE_IRQ,
37 },
38};
39
40struct platform_device tcc_nand_device = {
41 .name = "tcc_nand",
42 .id = 0,
43 .num_resources = ARRAY_SIZE(tcc_nand_resources),
44 .resource = tcc_nand_resources,
45};
46#endif
47
48#ifdef CONFIG_MMC_TCC8K
49/* MMC controller */
50static struct resource tcc8k_mmc0_resource[] = {
51 {
52 .start = INT_SD0,
53 .end = INT_SD0,
54 .flags = IORESOURCE_IRQ,
55 },
56};
57
58static struct resource tcc8k_mmc1_resource[] = {
59 {
60 .start = INT_SD1,
61 .end = INT_SD1,
62 .flags = IORESOURCE_IRQ,
63 },
64};
65
66struct platform_device tcc8k_mmc0_device = {
67 .name = "tcc-mmc",
68 .id = 0,
69 .num_resources = ARRAY_SIZE(tcc8k_mmc0_resource),
70 .resource = tcc8k_mmc0_resource,
71 .dev = {
72 .dma_mask = &tcc8k_dmamask,
73 .coherent_dma_mask = DMA_BIT_MASK(32),
74 }
75};
76
77struct platform_device tcc8k_mmc1_device = {
78 .name = "tcc-mmc",
79 .id = 1,
80 .num_resources = ARRAY_SIZE(tcc8k_mmc1_resource),
81 .resource = tcc8k_mmc1_resource,
82 .dev = {
83 .dma_mask = &tcc8k_dmamask,
84 .coherent_dma_mask = DMA_BIT_MASK(32),
85 }
86};
87
88static inline void tcc8k_init_mmc(void)
89{
90 u32 reg = __raw_readl(GPIOPS_BASE + GPIOPS_FS1_OFFS);
91
92 reg |= GPIOPS_FS1_SDH0_BITS | GPIOPS_FS1_SDH1_BITS;
93 __raw_writel(reg, GPIOPS_BASE + GPIOPS_FS1_OFFS);
94
95 platform_device_register(&tcc8k_mmc0_device);
96 platform_device_register(&tcc8k_mmc1_device);
97}
98#else
99static inline void tcc8k_init_mmc(void) { }
100#endif
101
102#ifdef CONFIG_USB_OHCI_HCD
103static int tcc8k_ohci_init(struct device *dev)
104{
105 u32 reg;
106
107 /* Use GPIO PK19 as VBUS control output */
108 reg = __raw_readl(GPIOPK_BASE + GPIOPK_FS0_OFFS);
109 reg &= ~(1 << 19);
110 __raw_writel(reg, GPIOPK_BASE + GPIOPK_FS0_OFFS);
111 reg = __raw_readl(GPIOPK_BASE + GPIOPK_FS1_OFFS);
112 reg &= ~(1 << 19);
113 __raw_writel(reg, GPIOPK_BASE + GPIOPK_FS1_OFFS);
114
115 reg = __raw_readl(GPIOPK_BASE + GPIOPK_DOE_OFFS);
116 reg |= (1 << 19);
117 __raw_writel(reg, GPIOPK_BASE + GPIOPK_DOE_OFFS);
118 /* Turn on VBUS */
119 reg = __raw_readl(GPIOPK_BASE + GPIOPK_DAT_OFFS);
120 reg |= (1 << 19);
121 __raw_writel(reg, GPIOPK_BASE + GPIOPK_DAT_OFFS);
122
123 return 0;
124}
125
126static struct resource tcc8k_ohci0_resources[] = {
127 [0] = {
128 .start = (resource_size_t)USBH0_BASE,
129 .end = (resource_size_t)USBH0_BASE + 0x5c,
130 .flags = IORESOURCE_MEM,
131 },
132 [1] = {
133 .start = INT_USBH0,
134 .end = INT_USBH0,
135 .flags = IORESOURCE_IRQ,
136 }
137};
138
139static struct resource tcc8k_ohci1_resources[] = {
140 [0] = {
141 .start = (resource_size_t)USBH1_BASE,
142 .end = (resource_size_t)USBH1_BASE + 0x5c,
143 .flags = IORESOURCE_MEM,
144 },
145 [1] = {
146 .start = INT_USBH1,
147 .end = INT_USBH1,
148 .flags = IORESOURCE_IRQ,
149 }
150};
151
152static struct tccohci_platform_data tcc8k_ohci0_platform_data = {
153 .controller = 0,
154 .port_mode = PMM_PERPORT_MODE,
155 .init = tcc8k_ohci_init,
156};
157
158static struct tccohci_platform_data tcc8k_ohci1_platform_data = {
159 .controller = 1,
160 .port_mode = PMM_PERPORT_MODE,
161 .init = tcc8k_ohci_init,
162};
163
164static struct platform_device ohci0_device = {
165 .name = "tcc-ohci",
166 .id = 0,
167 .dev = {
168 .dma_mask = &tcc8k_dmamask,
169 .coherent_dma_mask = DMA_BIT_MASK(32),
170 .platform_data = &tcc8k_ohci0_platform_data,
171 },
172 .num_resources = ARRAY_SIZE(tcc8k_ohci0_resources),
173 .resource = tcc8k_ohci0_resources,
174};
175
176static struct platform_device ohci1_device = {
177 .name = "tcc-ohci",
178 .id = 1,
179 .dev = {
180 .dma_mask = &tcc8k_dmamask,
181 .coherent_dma_mask = DMA_BIT_MASK(32),
182 .platform_data = &tcc8k_ohci1_platform_data,
183 },
184 .num_resources = ARRAY_SIZE(tcc8k_ohci1_resources),
185 .resource = tcc8k_ohci1_resources,
186};
187
188static void __init tcc8k_init_usbhost(void)
189{
190 platform_device_register(&ohci0_device);
191 platform_device_register(&ohci1_device);
192}
193#else
194static void __init tcc8k_init_usbhost(void) { }
195#endif
196
197/* USB device controller*/
198#ifdef CONFIG_USB_GADGET_TCC8K
199static struct resource udc_resources[] = {
200 [0] = {
201 .start = INT_USBD,
202 .end = INT_USBD,
203 .flags = IORESOURCE_IRQ,
204 },
205 [1] = {
206 .start = INT_UDMA,
207 .end = INT_UDMA,
208 .flags = IORESOURCE_IRQ,
209 },
210};
211
212static struct platform_device tcc8k_udc_device = {
213 .name = "tcc-udc",
214 .id = 0,
215 .resource = udc_resources,
216 .num_resources = ARRAY_SIZE(udc_resources),
217 .dev = {
218 .dma_mask = &tcc8k_dmamask,
219 .coherent_dma_mask = DMA_BIT_MASK(32),
220 },
221};
222
223static void __init tcc8k_init_usb_gadget(void)
224{
225 platform_device_register(&tcc8k_udc_device);
226}
227#else
228static void __init tcc8k_init_usb_gadget(void) { }
229#endif /* CONFIG_USB_GADGET_TCC83X */
230
231static int __init tcc8k_init_devices(void)
232{
233 tcc8k_init_mmc();
234 tcc8k_init_usbhost();
235 tcc8k_init_usb_gadget();
236 return 0;
237}
238
239arch_initcall(tcc8k_init_devices);
diff --git a/arch/arm/mach-tcc8k/io.c b/arch/arm/mach-tcc8k/io.c
new file mode 100644
index 000000000000..9b39d7fa658f
--- /dev/null
+++ b/arch/arm/mach-tcc8k/io.c
@@ -0,0 +1,62 @@
1/*
2 * linux/arch/arm/mach-tcc8k/io.c
3 *
4 * (C) 2009 Hans J. Koch <hjk@linutronix.de>
5 *
6 * derived from TCC83xx io.c
7 * Copyright (C) Telechips, 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 version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/init.h>
15#include <linux/io.h>
16#include <linux/kernel.h>
17
18#include <asm/mach/map.h>
19
20#include <mach/tcc8k-regs.h>
21
22/*
23 * The machine specific code may provide the extra mapping besides the
24 * default mapping provided here.
25 */
26static struct map_desc tcc8k_io_desc[] __initdata = {
27 {
28 .virtual = (unsigned long)CS1_BASE_VIRT,
29 .pfn = __phys_to_pfn(CS1_BASE),
30 .length = CS1_SIZE,
31 .type = MT_DEVICE,
32 }, {
33 .virtual = (unsigned long)AHB_PERI_BASE_VIRT,
34 .pfn = __phys_to_pfn(AHB_PERI_BASE),
35 .length = AHB_PERI_SIZE,
36 .type = MT_DEVICE,
37 }, {
38 .virtual = (unsigned long)APB0_PERI_BASE_VIRT,
39 .pfn = __phys_to_pfn(APB0_PERI_BASE),
40 .length = APB0_PERI_SIZE,
41 .type = MT_DEVICE,
42 }, {
43 .virtual = (unsigned long)APB1_PERI_BASE_VIRT,
44 .pfn = __phys_to_pfn(APB1_PERI_BASE),
45 .length = APB1_PERI_SIZE,
46 .type = MT_DEVICE,
47 }, {
48 .virtual = (unsigned long)EXT_MEM_CTRL_BASE_VIRT,
49 .pfn = __phys_to_pfn(EXT_MEM_CTRL_BASE),
50 .length = EXT_MEM_CTRL_SIZE,
51 .type = MT_DEVICE,
52 },
53};
54
55/*
56 * Maps common IO regions for tcc8k.
57 *
58 */
59void __init tcc8k_map_common_io(void)
60{
61 iotable_init(tcc8k_io_desc, ARRAY_SIZE(tcc8k_io_desc));
62}
diff --git a/arch/arm/mach-tcc8k/irq.c b/arch/arm/mach-tcc8k/irq.c
new file mode 100644
index 000000000000..34575c4963f0
--- /dev/null
+++ b/arch/arm/mach-tcc8k/irq.c
@@ -0,0 +1,111 @@
1/*
2 * Copyright (C) Telechips, Inc.
3 * Copyright (C) 2009-2010 Hans J. Koch <hjk@linutronix.de>
4 *
5 * Licensed under the terms of the GNU GPL version 2.
6 */
7
8#include <linux/init.h>
9#include <linux/interrupt.h>
10#include <linux/io.h>
11
12#include <asm/irq.h>
13#include <asm/mach/irq.h>
14
15#include <mach/tcc8k-regs.h>
16#include <mach/irqs.h>
17
18#include "common.h"
19
20/* Disable IRQ */
21static void tcc8000_mask_ack_irq0(unsigned int irq)
22{
23 PIC0_IEN &= ~(1 << irq);
24 PIC0_CREQ |= (1 << irq);
25}
26
27static void tcc8000_mask_ack_irq1(unsigned int irq)
28{
29 PIC1_IEN &= ~(1 << (irq - 32));
30 PIC1_CREQ |= (1 << (irq - 32));
31}
32
33static void tcc8000_mask_irq0(unsigned int irq)
34{
35 PIC0_IEN &= ~(1 << irq);
36}
37
38static void tcc8000_mask_irq1(unsigned int irq)
39{
40 PIC1_IEN &= ~(1 << (irq - 32));
41}
42
43static void tcc8000_ack_irq0(unsigned int irq)
44{
45 PIC0_CREQ |= (1 << irq);
46}
47
48static void tcc8000_ack_irq1(unsigned int irq)
49{
50 PIC1_CREQ |= (1 << (irq - 32));
51}
52
53/* Enable IRQ */
54static void tcc8000_unmask_irq0(unsigned int irq)
55{
56 PIC0_IEN |= (1 << irq);
57 PIC0_INTOEN |= (1 << irq);
58}
59
60static void tcc8000_unmask_irq1(unsigned int irq)
61{
62 PIC1_IEN |= (1 << (irq - 32));
63 PIC1_INTOEN |= (1 << (irq - 32));
64}
65
66static struct irq_chip tcc8000_irq_chip0 = {
67 .name = "tcc_irq0",
68 .mask = tcc8000_mask_irq0,
69 .ack = tcc8000_ack_irq0,
70 .mask_ack = tcc8000_mask_ack_irq0,
71 .unmask = tcc8000_unmask_irq0,
72};
73
74static struct irq_chip tcc8000_irq_chip1 = {
75 .name = "tcc_irq1",
76 .mask = tcc8000_mask_irq1,
77 .ack = tcc8000_ack_irq1,
78 .mask_ack = tcc8000_mask_ack_irq1,
79 .unmask = tcc8000_unmask_irq1,
80};
81
82void __init tcc8k_init_irq(void)
83{
84 int irqno;
85
86 /* Mask and clear all interrupts */
87 PIC0_IEN = 0x00000000;
88 PIC0_CREQ = 0xffffffff;
89 PIC1_IEN = 0x00000000;
90 PIC1_CREQ = 0xffffffff;
91
92 PIC0_MEN0 = 0x00000003;
93 PIC1_MEN1 = 0x00000003;
94 PIC1_MEN = 0x00000003;
95
96 /* let all IRQs be level triggered */
97 PIC0_TMODE = 0xffffffff;
98 PIC1_TMODE = 0xffffffff;
99 /* all IRQs are IRQs (not FIQs) */
100 PIC0_IRQSEL = 0xffffffff;
101 PIC1_IRQSEL = 0xffffffff;
102
103 for (irqno = 0; irqno < NR_IRQS; irqno++) {
104 if (irqno < 32)
105 set_irq_chip(irqno, &tcc8000_irq_chip0);
106 else
107 set_irq_chip(irqno, &tcc8000_irq_chip1);
108 set_irq_handler(irqno, handle_level_irq);
109 set_irq_flags(irqno, IRQF_VALID);
110 }
111}
diff --git a/arch/arm/mach-tcc8k/time.c b/arch/arm/mach-tcc8k/time.c
new file mode 100644
index 000000000000..78d06008841d
--- /dev/null
+++ b/arch/arm/mach-tcc8k/time.c
@@ -0,0 +1,149 @@
1/*
2 * TCC8000 system timer setup
3 *
4 * (C) 2009 Hans J. Koch <hjk@linutronix.de>
5 *
6 * Licensed under the terms of the GPL version 2.
7 *
8 */
9
10#include <linux/clk.h>
11#include <linux/clockchips.h>
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/io.h>
15#include <linux/irq.h>
16#include <linux/kernel.h>
17#include <linux/spinlock.h>
18
19#include <asm/mach/time.h>
20
21#include <mach/tcc8k-regs.h>
22#include <mach/irqs.h>
23
24#include "common.h"
25
26static void __iomem *timer_base;
27
28static cycle_t tcc_get_cycles(struct clocksource *cs)
29{
30 return __raw_readl(timer_base + TC32MCNT_OFFS);
31}
32
33static struct clocksource clocksource_tcc = {
34 .name = "tcc_tc32",
35 .rating = 200,
36 .read = tcc_get_cycles,
37 .mask = CLOCKSOURCE_MASK(32),
38 .shift = 28,
39 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
40};
41
42static int tcc_set_next_event(unsigned long evt,
43 struct clock_event_device *unused)
44{
45 unsigned long reg = __raw_readl(timer_base + TC32MCNT_OFFS);
46
47 __raw_writel(reg + evt, timer_base + TC32CMP0_OFFS);
48 return 0;
49}
50
51static void tcc_set_mode(enum clock_event_mode mode,
52 struct clock_event_device *evt)
53{
54 unsigned long tc32irq;
55
56 switch (mode) {
57 case CLOCK_EVT_MODE_ONESHOT:
58 tc32irq = __raw_readl(timer_base + TC32IRQ_OFFS);
59 tc32irq |= TC32IRQ_IRQEN0;
60 __raw_writel(tc32irq, timer_base + TC32IRQ_OFFS);
61 break;
62 case CLOCK_EVT_MODE_SHUTDOWN:
63 case CLOCK_EVT_MODE_UNUSED:
64 tc32irq = __raw_readl(timer_base + TC32IRQ_OFFS);
65 tc32irq &= ~TC32IRQ_IRQEN0;
66 __raw_writel(tc32irq, timer_base + TC32IRQ_OFFS);
67 break;
68 case CLOCK_EVT_MODE_PERIODIC:
69 case CLOCK_EVT_MODE_RESUME:
70 break;
71 }
72}
73
74static irqreturn_t tcc8k_timer_interrupt(int irq, void *dev_id)
75{
76 struct clock_event_device *evt = dev_id;
77
78 /* Acknowledge TC32 interrupt by reading TC32IRQ */
79 __raw_readl(timer_base + TC32IRQ_OFFS);
80
81 evt->event_handler(evt);
82
83 return IRQ_HANDLED;
84}
85
86static struct clock_event_device clockevent_tcc = {
87 .name = "tcc_timer1",
88 .features = CLOCK_EVT_FEAT_ONESHOT,
89 .shift = 32,
90 .set_mode = tcc_set_mode,
91 .set_next_event = tcc_set_next_event,
92 .rating = 200,
93};
94
95static struct irqaction tcc8k_timer_irq = {
96 .name = "TC32_timer",
97 .flags = IRQF_DISABLED | IRQF_TIMER,
98 .handler = tcc8k_timer_interrupt,
99 .dev_id = &clockevent_tcc,
100};
101
102static int __init tcc_clockevent_init(struct clk *clock)
103{
104 unsigned int c = clk_get_rate(clock);
105
106 clocksource_tcc.mult = clocksource_hz2mult(c,
107 clocksource_tcc.shift);
108 clocksource_register(&clocksource_tcc);
109
110 clockevent_tcc.mult = div_sc(c, NSEC_PER_SEC,
111 clockevent_tcc.shift);
112 clockevent_tcc.max_delta_ns =
113 clockevent_delta2ns(0xfffffffe, &clockevent_tcc);
114 clockevent_tcc.min_delta_ns =
115 clockevent_delta2ns(0xff, &clockevent_tcc);
116
117 clockevent_tcc.cpumask = cpumask_of(0);
118
119 clockevents_register_device(&clockevent_tcc);
120
121 return 0;
122}
123
124void __init tcc8k_timer_init(struct clk *clock, void __iomem *base, int irq)
125{
126 u32 reg;
127
128 timer_base = base;
129 tcc8k_timer_irq.irq = irq;
130
131 /* Enable clocks */
132 clk_enable(clock);
133
134 /* Initialize 32-bit timer */
135 reg = __raw_readl(timer_base + TC32EN_OFFS);
136 reg &= ~TC32EN_ENABLE; /* Disable timer */
137 __raw_writel(reg, timer_base + TC32EN_OFFS);
138 /* Free running timer, counting from 0 to 0xffffffff */
139 __raw_writel(0, timer_base + TC32EN_OFFS);
140 __raw_writel(0, timer_base + TC32LDV_OFFS);
141 reg = __raw_readl(timer_base + TC32IRQ_OFFS);
142 reg |= TC32IRQ_IRQEN0; /* irq at match with CMP0 */
143 __raw_writel(reg, timer_base + TC32IRQ_OFFS);
144
145 __raw_writel(TC32EN_ENABLE, timer_base + TC32EN_OFFS);
146
147 tcc_clockevent_init(clock);
148 setup_irq(irq, &tcc8k_timer_irq);
149}
diff --git a/arch/arm/mach-versatile/include/mach/vmalloc.h b/arch/arm/mach-versatile/include/mach/vmalloc.h
index 427e3612db5d..ebd8a2543d3b 100644
--- a/arch/arm/mach-versatile/include/mach/vmalloc.h
+++ b/arch/arm/mach-versatile/include/mach/vmalloc.h
@@ -18,4 +18,4 @@
18 * along with this program; if not, write to the Free Software 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 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21#define VMALLOC_END (PAGE_OFFSET + 0x18000000) 21#define VMALLOC_END 0xd8000000
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index efb127022d42..71fb17349520 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -68,7 +68,7 @@ static void __init ct_ca9x4_init_irq(void)
68} 68}
69 69
70#if 0 70#if 0
71static void ct_ca9x4_timer_init(void) 71static void __init ct_ca9x4_timer_init(void)
72{ 72{
73 writel(0, MMIO_P2V(CT_CA9X4_TIMER0) + TIMER_CTRL); 73 writel(0, MMIO_P2V(CT_CA9X4_TIMER0) + TIMER_CTRL);
74 writel(0, MMIO_P2V(CT_CA9X4_TIMER1) + TIMER_CTRL); 74 writel(0, MMIO_P2V(CT_CA9X4_TIMER1) + TIMER_CTRL);
@@ -222,7 +222,7 @@ static struct platform_device pmu_device = {
222 .resource = pmu_resources, 222 .resource = pmu_resources,
223}; 223};
224 224
225static void ct_ca9x4_init(void) 225static void __init ct_ca9x4_init(void)
226{ 226{
227 int i; 227 int i;
228 228
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 817f0ad38a0b..7eaa232180a5 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -48,7 +48,7 @@ void __init v2m_map_io(struct map_desc *tile, size_t num)
48} 48}
49 49
50 50
51static void v2m_timer_init(void) 51static void __init v2m_timer_init(void)
52{ 52{
53 writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); 53 writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL);
54 writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL); 54 writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL);
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab506272b2d3..17e7b0b57e49 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -204,8 +204,12 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
204 /* 204 /*
205 * Don't allow RAM to be mapped - this causes problems with ARMv6+ 205 * Don't allow RAM to be mapped - this causes problems with ARMv6+
206 */ 206 */
207 if (WARN_ON(pfn_valid(pfn))) 207 if (pfn_valid(pfn)) {
208 return NULL; 208 printk(KERN_WARNING "BUG: Your driver calls ioremap() on system memory. This leads\n"
209 KERN_WARNING "to architecturally unpredictable behaviour on ARMv6+, and ioremap()\n"
210 KERN_WARNING "will fail in the next kernel release. Please fix your driver.\n");
211 WARN_ON(1);
212 }
209 213
210 type = get_mem_type(mtype); 214 type = get_mem_type(mtype);
211 if (!type) 215 if (!type)
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 4f5b39687df5..b0a98305055c 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -144,3 +144,25 @@ int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
144{ 144{
145 return !(pfn + (size >> PAGE_SHIFT) > 0x00100000); 145 return !(pfn + (size >> PAGE_SHIFT) > 0x00100000);
146} 146}
147
148#ifdef CONFIG_STRICT_DEVMEM
149
150#include <linux/ioport.h>
151
152/*
153 * devmem_is_allowed() checks to see if /dev/mem access to a certain
154 * address is valid. The argument is a physical page number.
155 * We mimic x86 here by disallowing access to system RAM as well as
156 * device-exclusive MMIO regions. This effectively disable read()/write()
157 * on /dev/mem.
158 */
159int devmem_is_allowed(unsigned long pfn)
160{
161 if (iomem_is_exclusive(pfn << PAGE_SHIFT))
162 return 0;
163 if (!page_is_ram(pfn))
164 return 1;
165 return 0;
166}
167
168#endif
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e2335811c02e..c32f731d56d3 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -248,7 +248,7 @@ static struct mem_type mem_types[] = {
248 }, 248 },
249 [MT_MEMORY] = { 249 [MT_MEMORY] = {
250 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 250 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
251 L_PTE_USER | L_PTE_EXEC, 251 L_PTE_WRITE | L_PTE_EXEC,
252 .prot_l1 = PMD_TYPE_TABLE, 252 .prot_l1 = PMD_TYPE_TABLE,
253 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, 253 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
254 .domain = DOMAIN_KERNEL, 254 .domain = DOMAIN_KERNEL,
@@ -259,7 +259,7 @@ static struct mem_type mem_types[] = {
259 }, 259 },
260 [MT_MEMORY_NONCACHED] = { 260 [MT_MEMORY_NONCACHED] = {
261 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 261 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
262 L_PTE_USER | L_PTE_EXEC | L_PTE_MT_BUFFERABLE, 262 L_PTE_WRITE | L_PTE_EXEC | L_PTE_MT_BUFFERABLE,
263 .prot_l1 = PMD_TYPE_TABLE, 263 .prot_l1 = PMD_TYPE_TABLE,
264 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, 264 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
265 .domain = DOMAIN_KERNEL, 265 .domain = DOMAIN_KERNEL,
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 055e9d50d015..53cbe2225153 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -253,6 +253,14 @@ __v7_setup:
253 orreq r10, r10, #1 << 22 @ set bit #22 253 orreq r10, r10, #1 << 22 @ set bit #22
254 mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register 254 mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register
255#endif 255#endif
256#ifdef CONFIG_ARM_ERRATA_743622
257 teq r6, #0x20 @ present in r2p0
258 teqne r6, #0x21 @ present in r2p1
259 teqne r6, #0x22 @ present in r2p2
260 mrceq p15, 0, r10, c15, c0, 1 @ read diagnostic register
261 orreq r10, r10, #1 << 6 @ set bit #6
262 mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register
263#endif
256 264
2573: mov r10, #0 2653: mov r10, #0
258#ifdef HARVARD_CACHE 266#ifdef HARVARD_CACHE
@@ -376,7 +384,7 @@ __v7_ca9mp_proc_info:
376 b __v7_ca9mp_setup 384 b __v7_ca9mp_setup
377 .long cpu_arch_name 385 .long cpu_arch_name
378 .long cpu_elf_name 386 .long cpu_elf_name
379 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP 387 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS
380 .long cpu_v7_name 388 .long cpu_v7_name
381 .long v7_processor_functions 389 .long v7_processor_functions
382 .long v7wbi_tlb_fns 390 .long v7wbi_tlb_fns
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 0691176899ff..72e09eb642dd 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -102,6 +102,7 @@ static int op_create_counter(int cpu, int event)
102 if (IS_ERR(pevent)) { 102 if (IS_ERR(pevent)) {
103 ret = PTR_ERR(pevent); 103 ret = PTR_ERR(pevent);
104 } else if (pevent->state != PERF_EVENT_STATE_ACTIVE) { 104 } else if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
105 perf_event_release_kernel(pevent);
105 pr_warning("oprofile: failed to enable event %d " 106 pr_warning("oprofile: failed to enable event %d "
106 "on CPU %d\n", event, cpu); 107 "on CPU %d\n", event, cpu);
107 ret = -EBUSY; 108 ret = -EBUSY;
@@ -365,6 +366,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
365 ret = init_driverfs(); 366 ret = init_driverfs();
366 if (ret) { 367 if (ret) {
367 kfree(counter_config); 368 kfree(counter_config);
369 counter_config = NULL;
368 return ret; 370 return ret;
369 } 371 }
370 372
@@ -402,7 +404,6 @@ void oprofile_arch_exit(void)
402 struct perf_event *event; 404 struct perf_event *event;
403 405
404 if (*perf_events) { 406 if (*perf_events) {
405 exit_driverfs();
406 for_each_possible_cpu(cpu) { 407 for_each_possible_cpu(cpu) {
407 for (id = 0; id < perf_num_counters; ++id) { 408 for (id = 0; id < perf_num_counters; ++id) {
408 event = perf_events[cpu][id]; 409 event = perf_events[cpu][id];
@@ -413,8 +414,10 @@ void oprofile_arch_exit(void)
413 } 414 }
414 } 415 }
415 416
416 if (counter_config) 417 if (counter_config) {
417 kfree(counter_config); 418 kfree(counter_config);
419 exit_driverfs();
420 }
418} 421}
419#else 422#else
420int __init oprofile_arch_init(struct oprofile_operations *ops) 423int __init oprofile_arch_init(struct oprofile_operations *ops)
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index 6785db4179b8..64e3a64520e0 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -92,6 +92,18 @@ config MXC_DEBUG_BOARD
92 data/address de-multiplexing and decode, signal level shift, 92 data/address de-multiplexing and decode, signal level shift,
93 interrupt control and various board functions. 93 interrupt control and various board functions.
94 94
95config HAVE_EPIT
96 bool
97
98config MXC_USE_EPIT
99 bool "Use EPIT instead of GPT"
100 depends on HAVE_EPIT
101 help
102 Use EPIT as the system timer on systems that have it. Normally you
103 don't have a reason to do so as the EPIT has the same features and
104 uses the same clocks as the GPT. Anyway, on some systems the GPT
105 may be in use for other purposes.
106
95config MXC_ULPI 107config MXC_ULPI
96 bool 108 bool
97 109
@@ -110,4 +122,8 @@ config ARCH_MXC_AUDMUX_V1
110config ARCH_MXC_AUDMUX_V2 122config ARCH_MXC_AUDMUX_V2
111 bool 123 bool
112 124
125config IRAM_ALLOC
126 bool
127 select GENERIC_ALLOCATOR
128
113endif 129endif
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 78d405ed8616..06875b4dd70f 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -10,9 +10,11 @@ obj-$(CONFIG_MXC_TZIC) += tzic.o
10 10
11obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o 11obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
12obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o 12obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
13obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o
13obj-$(CONFIG_MXC_PWM) += pwm.o 14obj-$(CONFIG_MXC_PWM) += pwm.o
14obj-$(CONFIG_USB_EHCI_MXC) += ehci.o 15obj-$(CONFIG_USB_EHCI_MXC) += ehci.o
15obj-$(CONFIG_MXC_ULPI) += ulpi.o 16obj-$(CONFIG_MXC_ULPI) += ulpi.o
17obj-$(CONFIG_MXC_USE_EPIT) += epit.o
16obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o 18obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o
17obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o 19obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o
18obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o 20obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index f9e7cdbd0005..62920490c0d6 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -186,7 +186,13 @@ EXPORT_SYMBOL_GPL(mxc_audmux_v2_configure_port);
186static int mxc_audmux_v2_init(void) 186static int mxc_audmux_v2_init(void)
187{ 187{
188 int ret; 188 int ret;
189 189#if defined(CONFIG_ARCH_MX5)
190 if (cpu_is_mx51()) {
191 audmux_base = MX51_IO_ADDRESS(MX51_AUDMUX_BASE_ADDR);
192 ret = 0;
193 return ret;
194 }
195#endif
190#if defined(CONFIG_ARCH_MX3) 196#if defined(CONFIG_ARCH_MX3)
191 if (cpu_is_mx31()) 197 if (cpu_is_mx31())
192 audmux_base = MX31_IO_ADDRESS(MX31_AUDMUX_BASE_ADDR); 198 audmux_base = MX31_IO_ADDRESS(MX31_AUDMUX_BASE_ADDR);
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 9ab784b776f9..404799487f17 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -1,3 +1,10 @@
1config IMX_HAVE_PLATFORM_ESDHC
2 bool
3
4config IMX_HAVE_PLATFORM_FEC
5 bool
6 default y if ARCH_MX25 || SOC_IMX27 || ARCH_MX35 || ARCH_MX51
7
1config IMX_HAVE_PLATFORM_FLEXCAN 8config IMX_HAVE_PLATFORM_FLEXCAN
2 select HAVE_CAN_FLEXCAN 9 select HAVE_CAN_FLEXCAN
3 bool 10 bool
@@ -5,6 +12,9 @@ config IMX_HAVE_PLATFORM_FLEXCAN
5config IMX_HAVE_PLATFORM_IMX_I2C 12config IMX_HAVE_PLATFORM_IMX_I2C
6 bool 13 bool
7 14
15config IMX_HAVE_PLATFORM_IMX_SSI
16 bool
17
8config IMX_HAVE_PLATFORM_IMX_UART 18config IMX_HAVE_PLATFORM_IMX_UART
9 bool 19 bool
10 20
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 347da5161f7e..0a3c1f089413 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -1,8 +1,9 @@
1ifdef CONFIG_CAN_FLEXCAN 1obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
2# the ifdef can be removed once the flexcan driver has been merged 2obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
3obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o 3obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
4endif 4obj-y += platform-imx-dma.o
5obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o 5obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o 7obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
7obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o 8obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
8obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o 9obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
diff --git a/arch/arm/plat-mxc/devices/platform-esdhc.c b/arch/arm/plat-mxc/devices/platform-esdhc.c
new file mode 100644
index 000000000000..2605bfa0dfb0
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-esdhc.c
@@ -0,0 +1,71 @@
1/*
2 * Copyright (C) 2010 Pengutronix, Wolfram Sang <w.sang@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
7 */
8
9#include <mach/hardware.h>
10#include <mach/devices-common.h>
11#include <mach/esdhc.h>
12
13#define imx_esdhc_imx_data_entry_single(soc, _id, hwid) \
14 { \
15 .id = _id, \
16 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \
17 .irq = soc ## _INT_ESDHC ## hwid, \
18 }
19
20#define imx_esdhc_imx_data_entry(soc, id, hwid) \
21 [id] = imx_esdhc_imx_data_entry_single(soc, id, hwid)
22
23#ifdef CONFIG_ARCH_MX25
24const struct imx_esdhc_imx_data imx25_esdhc_data[] __initconst = {
25#define imx25_esdhc_data_entry(_id, _hwid) \
26 imx_esdhc_imx_data_entry(MX25, _id, _hwid)
27 imx25_esdhc_data_entry(0, 1),
28 imx25_esdhc_data_entry(1, 2),
29};
30#endif /* ifdef CONFIG_ARCH_MX25 */
31
32#ifdef CONFIG_ARCH_MX35
33const struct imx_esdhc_imx_data imx35_esdhc_data[] __initconst = {
34#define imx35_esdhc_data_entry(_id, _hwid) \
35 imx_esdhc_imx_data_entry(MX35, _id, _hwid)
36 imx35_esdhc_data_entry(0, 1),
37 imx35_esdhc_data_entry(1, 2),
38 imx35_esdhc_data_entry(2, 3),
39};
40#endif /* ifdef CONFIG_ARCH_MX35 */
41
42#ifdef CONFIG_ARCH_MX51
43const struct imx_esdhc_imx_data imx51_esdhc_data[] __initconst = {
44#define imx51_esdhc_data_entry(_id, _hwid) \
45 imx_esdhc_imx_data_entry(MX51, _id, _hwid)
46 imx51_esdhc_data_entry(0, 1),
47 imx51_esdhc_data_entry(1, 2),
48 imx51_esdhc_data_entry(2, 3),
49 imx51_esdhc_data_entry(3, 4),
50};
51#endif /* ifdef CONFIG_ARCH_MX51 */
52
53struct platform_device *__init imx_add_esdhc(
54 const struct imx_esdhc_imx_data *data,
55 const struct esdhc_platform_data *pdata)
56{
57 struct resource res[] = {
58 {
59 .start = data->iobase,
60 .end = data->iobase + SZ_16K - 1,
61 .flags = IORESOURCE_MEM,
62 }, {
63 .start = data->irq,
64 .end = data->irq,
65 .flags = IORESOURCE_IRQ,
66 },
67 };
68
69 return imx_add_platform_device("sdhci-esdhc-imx", data->id, res,
70 ARRAY_SIZE(res), pdata, sizeof(*pdata));
71}
diff --git a/arch/arm/plat-mxc/devices/platform-fec.c b/arch/arm/plat-mxc/devices/platform-fec.c
new file mode 100644
index 000000000000..11d087f4e219
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-fec.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <asm/sizes.h>
10#include <mach/hardware.h>
11#include <mach/devices-common.h>
12
13#define imx_fec_data_entry_single(soc) \
14 { \
15 .iobase = soc ## _FEC_BASE_ADDR, \
16 .irq = soc ## _INT_FEC, \
17 }
18
19#ifdef CONFIG_ARCH_MX25
20const struct imx_fec_data imx25_fec_data __initconst =
21 imx_fec_data_entry_single(MX25);
22#endif /* ifdef CONFIG_ARCH_MX25 */
23
24#ifdef CONFIG_SOC_IMX27
25const struct imx_fec_data imx27_fec_data __initconst =
26 imx_fec_data_entry_single(MX27);
27#endif /* ifdef CONFIG_SOC_IMX27 */
28
29#ifdef CONFIG_ARCH_MX35
30const struct imx_fec_data imx35_fec_data __initconst =
31 imx_fec_data_entry_single(MX35);
32#endif
33
34#ifdef CONFIG_ARCH_MX51
35const struct imx_fec_data imx51_fec_data __initconst =
36 imx_fec_data_entry_single(MX51);
37#endif
38
39struct platform_device *__init imx_add_fec(
40 const struct imx_fec_data *data,
41 const struct fec_platform_data *pdata)
42{
43 struct resource res[] = {
44 {
45 .start = data->iobase,
46 .end = data->iobase + SZ_4K,
47 .flags = IORESOURCE_MEM,
48 }, {
49 .start = data->irq,
50 .end = data->irq,
51 .flags = IORESOURCE_IRQ,
52 },
53 };
54
55 return imx_add_platform_device("fec", 0 /* -1? */,
56 res, ARRAY_SIZE(res),
57 pdata, sizeof(*pdata));
58}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/plat-mxc/devices/platform-imx-dma.c
new file mode 100644
index 000000000000..02d989018059
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx-dma.c
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <linux/compiler.h>
10#include <linux/err.h>
11#include <linux/init.h>
12
13#include <mach/hardware.h>
14#include <mach/devices-common.h>
15#ifdef SDMA_IS_MERGED
16#include <mach/sdma.h>
17#else
18struct sdma_platform_data {
19 int sdma_version;
20 char *cpu_name;
21 int to_version;
22};
23#endif
24
25struct imx_imx_sdma_data {
26 resource_size_t iobase;
27 resource_size_t irq;
28 struct sdma_platform_data pdata;
29};
30
31#define imx_imx_sdma_data_entry_single(soc, _sdma_version, _cpu_name, _to_version)\
32 { \
33 .iobase = soc ## _SDMA ## _BASE_ADDR, \
34 .irq = soc ## _INT_SDMA, \
35 .pdata = { \
36 .sdma_version = _sdma_version, \
37 .cpu_name = _cpu_name, \
38 .to_version = _to_version, \
39 }, \
40 }
41
42#ifdef CONFIG_ARCH_MX25
43const struct imx_imx_sdma_data imx25_imx_sdma_data __initconst =
44 imx_imx_sdma_data_entry_single(MX25, 1, "imx25", 0);
45#endif /* ifdef CONFIG_ARCH_MX25 */
46
47#ifdef CONFIG_ARCH_MX31
48struct imx_imx_sdma_data imx31_imx_sdma_data __initdata =
49 imx_imx_sdma_data_entry_single(MX31, 1, "imx31", 0);
50#endif /* ifdef CONFIG_ARCH_MX31 */
51
52#ifdef CONFIG_ARCH_MX35
53struct imx_imx_sdma_data imx35_imx_sdma_data __initdata =
54 imx_imx_sdma_data_entry_single(MX35, 2, "imx35", 0);
55#endif /* ifdef CONFIG_ARCH_MX35 */
56
57#ifdef CONFIG_ARCH_MX51
58const struct imx_imx_sdma_data imx51_imx_sdma_data __initconst =
59 imx_imx_sdma_data_entry_single(MX51, 2, "imx51", 0);
60#endif /* ifdef CONFIG_ARCH_MX51 */
61
62static struct platform_device __init __maybe_unused *imx_add_imx_sdma(
63 const struct imx_imx_sdma_data *data)
64{
65 struct resource res[] = {
66 {
67 .start = data->iobase,
68 .end = data->iobase + SZ_4K - 1,
69 .flags = IORESOURCE_MEM,
70 }, {
71 .start = data->irq,
72 .end = data->irq,
73 .flags = IORESOURCE_IRQ,
74 },
75 };
76
77 return imx_add_platform_device("imx-sdma", -1,
78 res, ARRAY_SIZE(res),
79 &data->pdata, sizeof(data->pdata));
80}
81
82static struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
83{
84 return imx_add_platform_device("imx-dma", -1, NULL, 0, NULL, 0);
85}
86
87static int __init imxXX_add_imx_dma(void)
88{
89 struct platform_device *ret;
90
91#if defined(CONFIG_SOC_IMX21) || defined(CONFIG_SOC_IMX27)
92 if (cpu_is_mx21() || cpu_is_mx27())
93 ret = imx_add_imx_dma();
94 else
95#endif
96
97#if defined(CONFIG_ARCH_MX25)
98 if (cpu_is_mx25())
99 ret = imx_add_imx_sdma(&imx25_imx_sdma_data);
100 else
101#endif
102
103#if defined(CONFIG_ARCH_MX31)
104 if (cpu_is_mx31()) {
105 imx31_imx_sdma_data.pdata.to_version = mx31_revision() >> 4;
106 ret = imx_add_imx_sdma(&imx31_imx_sdma_data);
107 } else
108#endif
109
110#if defined(CONFIG_ARCH_MX35)
111 if (cpu_is_mx35()) {
112 imx35_imx_sdma_data.pdata.to_version = mx35_revision() >> 4;
113 ret = imx_add_imx_sdma(&imx35_imx_sdma_data);
114 } else
115#endif
116
117#if defined(CONFIG_ARCH_MX51)
118 if (cpu_is_mx51())
119 ret = imx_add_imx_sdma(&imx51_imx_sdma_data);
120 else
121#endif
122 ret = ERR_PTR(-ENODEV);
123
124 if (IS_ERR(ret))
125 return PTR_ERR(ret);
126
127 return 0;
128}
129arch_initcall(imxXX_add_imx_dma);
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
index d0af9f7d8aed..679588453aad 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-i2c.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
@@ -6,24 +6,95 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h>
9#include <mach/devices-common.h> 10#include <mach/devices-common.h>
10 11
11struct platform_device *__init imx_add_imx_i2c(int id, 12#define imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size) \
12 resource_size_t iobase, resource_size_t iosize, int irq, 13 { \
14 .id = _id, \
15 .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_I2C ## _hwid, \
18 }
19
20#define imx_imx_i2c_data_entry(soc, _id, _hwid, _size) \
21 [_id] = imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size)
22
23#ifdef CONFIG_SOC_IMX1
24const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst =
25 imx_imx_i2c_data_entry_single(MX1, 0, , SZ_4K);
26#endif /* ifdef CONFIG_SOC_IMX1 */
27
28#ifdef CONFIG_SOC_IMX21
29const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
30 imx_imx_i2c_data_entry_single(MX21, 0, , SZ_4K);
31#endif /* ifdef CONFIG_SOC_IMX21 */
32
33#ifdef CONFIG_ARCH_MX25
34const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
35#define imx25_imx_i2c_data_entry(_id, _hwid) \
36 imx_imx_i2c_data_entry(MX25, _id, _hwid, SZ_16K)
37 imx25_imx_i2c_data_entry(0, 1),
38 imx25_imx_i2c_data_entry(1, 2),
39 imx25_imx_i2c_data_entry(2, 3),
40};
41#endif /* ifdef CONFIG_ARCH_MX25 */
42
43#ifdef CONFIG_SOC_IMX27
44const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
45#define imx27_imx_i2c_data_entry(_id, _hwid) \
46 imx_imx_i2c_data_entry(MX27, _id, _hwid, SZ_4K)
47 imx27_imx_i2c_data_entry(0, 1),
48 imx27_imx_i2c_data_entry(1, 2),
49};
50#endif /* ifdef CONFIG_SOC_IMX27 */
51
52#ifdef CONFIG_ARCH_MX31
53const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
54#define imx31_imx_i2c_data_entry(_id, _hwid) \
55 imx_imx_i2c_data_entry(MX31, _id, _hwid, SZ_4K)
56 imx31_imx_i2c_data_entry(0, 1),
57 imx31_imx_i2c_data_entry(1, 2),
58 imx31_imx_i2c_data_entry(2, 3),
59};
60#endif /* ifdef CONFIG_ARCH_MX31 */
61
62#ifdef CONFIG_ARCH_MX35
63const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
64#define imx35_imx_i2c_data_entry(_id, _hwid) \
65 imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K)
66 imx35_imx_i2c_data_entry(0, 1),
67 imx35_imx_i2c_data_entry(1, 2),
68 imx35_imx_i2c_data_entry(2, 3),
69};
70#endif /* ifdef CONFIG_ARCH_MX35 */
71
72#ifdef CONFIG_ARCH_MX51
73const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
74#define imx51_imx_i2c_data_entry(_id, _hwid) \
75 imx_imx_i2c_data_entry(MX51, _id, _hwid, SZ_4K)
76 imx51_imx_i2c_data_entry(0, 1),
77 imx51_imx_i2c_data_entry(1, 2),
78};
79#endif /* ifdef CONFIG_ARCH_MX51 */
80
81struct platform_device *__init imx_add_imx_i2c(
82 const struct imx_imx_i2c_data *data,
13 const struct imxi2c_platform_data *pdata) 83 const struct imxi2c_platform_data *pdata)
14{ 84{
15 struct resource res[] = { 85 struct resource res[] = {
16 { 86 {
17 .start = iobase, 87 .start = data->iobase,
18 .end = iobase + iosize - 1, 88 .end = data->iobase + data->iosize - 1,
19 .flags = IORESOURCE_MEM, 89 .flags = IORESOURCE_MEM,
20 }, { 90 }, {
21 .start = irq, 91 .start = data->irq,
22 .end = irq, 92 .end = data->irq,
23 .flags = IORESOURCE_IRQ, 93 .flags = IORESOURCE_IRQ,
24 }, 94 },
25 }; 95 };
26 96
27 return imx_add_platform_device("imx-i2c", id, res, ARRAY_SIZE(res), 97 return imx_add_platform_device("imx-i2c", data->id,
98 res, ARRAY_SIZE(res),
28 pdata, sizeof(*pdata)); 99 pdata, sizeof(*pdata));
29} 100}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-ssi.c b/arch/arm/plat-mxc/devices/platform-imx-ssi.c
new file mode 100644
index 000000000000..38a7a0b8f2f1
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx-ssi.c
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/hardware.h>
10#include <mach/devices-common.h>
11
12#define imx_imx_ssi_data_entry(soc, _id, _hwid, _size) \
13 [_id] = { \
14 .id = _id, \
15 .iobase = soc ## _SSI ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_SSI ## _hwid, \
18 .dmatx0 = soc ## _DMA_REQ_SSI ## _hwid ## _TX0, \
19 .dmarx0 = soc ## _DMA_REQ_SSI ## _hwid ## _RX0, \
20 .dmatx1 = soc ## _DMA_REQ_SSI ## _hwid ## _TX1, \
21 .dmarx1 = soc ## _DMA_REQ_SSI ## _hwid ## _RX1, \
22 }
23
24#ifdef CONFIG_SOC_IMX21
25const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst = {
26#define imx21_imx_ssi_data_entry(_id, _hwid) \
27 imx_imx_ssi_data_entry(MX21, _id, _hwid, SZ_4K)
28 imx21_imx_ssi_data_entry(0, 1),
29 imx21_imx_ssi_data_entry(1, 2),
30};
31#endif /* ifdef CONFIG_SOC_IMX21 */
32
33#ifdef CONFIG_ARCH_MX25
34const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst = {
35#define imx25_imx_ssi_data_entry(_id, _hwid) \
36 imx_imx_ssi_data_entry(MX25, _id, _hwid, SZ_4K)
37 imx25_imx_ssi_data_entry(0, 1),
38 imx25_imx_ssi_data_entry(1, 2),
39};
40#endif /* ifdef CONFIG_ARCH_MX25 */
41
42#ifdef CONFIG_SOC_IMX27
43const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
44#define imx27_imx_ssi_data_entry(_id, _hwid) \
45 imx_imx_ssi_data_entry(MX27, _id, _hwid, SZ_4K)
46 imx27_imx_ssi_data_entry(0, 1),
47 imx27_imx_ssi_data_entry(1, 2),
48};
49#endif /* ifdef CONFIG_SOC_IMX27 */
50
51#ifdef CONFIG_ARCH_MX31
52const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst = {
53#define imx31_imx_ssi_data_entry(_id, _hwid) \
54 imx_imx_ssi_data_entry(MX31, _id, _hwid, SZ_4K)
55 imx31_imx_ssi_data_entry(0, 1),
56 imx31_imx_ssi_data_entry(1, 2),
57};
58#endif /* ifdef CONFIG_ARCH_MX31 */
59
60#ifdef CONFIG_ARCH_MX35
61const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
62#define imx35_imx_ssi_data_entry(_id, _hwid) \
63 imx_imx_ssi_data_entry(MX35, _id, _hwid, SZ_4K)
64 imx35_imx_ssi_data_entry(0, 1),
65 imx35_imx_ssi_data_entry(1, 2),
66};
67#endif /* ifdef CONFIG_ARCH_MX35 */
68
69#ifdef CONFIG_ARCH_MX51
70const struct imx_imx_ssi_data imx51_imx_ssi_data[] __initconst = {
71#define imx51_imx_ssi_data_entry(_id, _hwid) \
72 imx_imx_ssi_data_entry(MX51, _id, _hwid, SZ_4K)
73 imx51_imx_ssi_data_entry(0, 1),
74 imx51_imx_ssi_data_entry(1, 2),
75};
76#endif /* ifdef CONFIG_ARCH_MX51 */
77
78struct platform_device *__init imx_add_imx_ssi(
79 const struct imx_imx_ssi_data *data,
80 const struct imx_ssi_platform_data *pdata)
81{
82 struct resource res[] = {
83 {
84 .start = data->iobase,
85 .end = data->iobase + data->iosize - 1,
86 .flags = IORESOURCE_MEM,
87 }, {
88 .start = data->irq,
89 .end = data->irq,
90 .flags = IORESOURCE_IRQ,
91 },
92#define DMARES(_name) { \
93 .name = #_name, \
94 .start = data->dma ## _name, \
95 .end = data->dma ## _name, \
96 .flags = IORESOURCE_DMA, \
97}
98 DMARES(tx0),
99 DMARES(rx0),
100 DMARES(tx1),
101 DMARES(rx1),
102 };
103
104 return imx_add_platform_device("imx-ssi", data->id,
105 res, ARRAY_SIZE(res),
106 pdata, sizeof(*pdata));
107}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-uart.c b/arch/arm/plat-mxc/devices/platform-imx-uart.c
index fa3dff1433e8..2039640adf27 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-uart.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-uart.c
@@ -6,55 +6,148 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h>
9#include <mach/devices-common.h> 10#include <mach/devices-common.h>
10 11
11struct platform_device *__init imx_add_imx_uart_3irq(int id, 12#define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size) \
12 resource_size_t iobase, resource_size_t iosize, 13 [_id] = { \
13 resource_size_t irqrx, resource_size_t irqtx, 14 .id = _id, \
14 resource_size_t irqrts, 15 .iobase = soc ## _UART ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irqrx = soc ## _INT_UART ## _hwid ## RX, \
18 .irqtx = soc ## _INT_UART ## _hwid ## TX, \
19 .irqrts = soc ## _INT_UART ## _hwid ## RTS, \
20 }
21
22#define imx_imx_uart_1irq_data_entry(soc, _id, _hwid, _size) \
23 [_id] = { \
24 .id = _id, \
25 .iobase = soc ## _UART ## _hwid ## _BASE_ADDR, \
26 .iosize = _size, \
27 .irq = soc ## _INT_UART ## _hwid, \
28 }
29
30#ifdef CONFIG_SOC_IMX1
31const struct imx_imx_uart_3irq_data imx1_imx_uart_data[] __initconst = {
32#define imx1_imx_uart_data_entry(_id, _hwid) \
33 imx_imx_uart_3irq_data_entry(MX1, _id, _hwid, 0xd0)
34 imx1_imx_uart_data_entry(0, 1),
35 imx1_imx_uart_data_entry(1, 2),
36};
37#endif /* ifdef CONFIG_SOC_IMX1 */
38
39#ifdef CONFIG_SOC_IMX21
40const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst = {
41#define imx21_imx_uart_data_entry(_id, _hwid) \
42 imx_imx_uart_1irq_data_entry(MX21, _id, _hwid, SZ_4K)
43 imx21_imx_uart_data_entry(0, 1),
44 imx21_imx_uart_data_entry(1, 2),
45 imx21_imx_uart_data_entry(2, 3),
46 imx21_imx_uart_data_entry(3, 4),
47};
48#endif
49
50#ifdef CONFIG_ARCH_MX25
51const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst = {
52#define imx25_imx_uart_data_entry(_id, _hwid) \
53 imx_imx_uart_1irq_data_entry(MX25, _id, _hwid, SZ_16K)
54 imx25_imx_uart_data_entry(0, 1),
55 imx25_imx_uart_data_entry(1, 2),
56 imx25_imx_uart_data_entry(2, 3),
57 imx25_imx_uart_data_entry(3, 4),
58 imx25_imx_uart_data_entry(4, 5),
59};
60#endif /* ifdef CONFIG_ARCH_MX25 */
61
62#ifdef CONFIG_SOC_IMX27
63const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst = {
64#define imx27_imx_uart_data_entry(_id, _hwid) \
65 imx_imx_uart_1irq_data_entry(MX27, _id, _hwid, SZ_4K)
66 imx27_imx_uart_data_entry(0, 1),
67 imx27_imx_uart_data_entry(1, 2),
68 imx27_imx_uart_data_entry(2, 3),
69 imx27_imx_uart_data_entry(3, 4),
70 imx27_imx_uart_data_entry(4, 5),
71 imx27_imx_uart_data_entry(5, 6),
72};
73#endif /* ifdef CONFIG_SOC_IMX27 */
74
75#ifdef CONFIG_ARCH_MX31
76const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst = {
77#define imx31_imx_uart_data_entry(_id, _hwid) \
78 imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_4K)
79 imx31_imx_uart_data_entry(0, 1),
80 imx31_imx_uart_data_entry(1, 2),
81 imx31_imx_uart_data_entry(2, 3),
82 imx31_imx_uart_data_entry(3, 4),
83 imx31_imx_uart_data_entry(4, 5),
84};
85#endif /* ifdef CONFIG_ARCH_MX31 */
86
87#ifdef CONFIG_ARCH_MX35
88const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
89#define imx35_imx_uart_data_entry(_id, _hwid) \
90 imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_16K)
91 imx35_imx_uart_data_entry(0, 1),
92 imx35_imx_uart_data_entry(1, 2),
93 imx35_imx_uart_data_entry(2, 3),
94};
95#endif /* ifdef CONFIG_ARCH_MX35 */
96
97#ifdef CONFIG_ARCH_MX51
98const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst = {
99#define imx51_imx_uart_data_entry(_id, _hwid) \
100 imx_imx_uart_1irq_data_entry(MX51, _id, _hwid, SZ_4K)
101 imx51_imx_uart_data_entry(0, 1),
102 imx51_imx_uart_data_entry(1, 2),
103 imx51_imx_uart_data_entry(2, 3),
104};
105#endif /* ifdef CONFIG_ARCH_MX51 */
106
107struct platform_device *__init imx_add_imx_uart_3irq(
108 const struct imx_imx_uart_3irq_data *data,
15 const struct imxuart_platform_data *pdata) 109 const struct imxuart_platform_data *pdata)
16{ 110{
17 struct resource res[] = { 111 struct resource res[] = {
18 { 112 {
19 .start = iobase, 113 .start = data->iobase,
20 .end = iobase + iosize - 1, 114 .end = data->iobase + data->iosize - 1,
21 .flags = IORESOURCE_MEM, 115 .flags = IORESOURCE_MEM,
22 }, { 116 }, {
23 .start = irqrx, 117 .start = data->irqrx,
24 .end = irqrx, 118 .end = data->irqrx,
25 .flags = IORESOURCE_IRQ, 119 .flags = IORESOURCE_IRQ,
26 }, { 120 }, {
27 .start = irqtx, 121 .start = data->irqtx,
28 .end = irqtx, 122 .end = data->irqtx,
29 .flags = IORESOURCE_IRQ, 123 .flags = IORESOURCE_IRQ,
30 }, { 124 }, {
31 .start = irqrts, 125 .start = data->irqrts,
32 .end = irqrx, 126 .end = data->irqrx,
33 .flags = IORESOURCE_IRQ, 127 .flags = IORESOURCE_IRQ,
34 }, 128 },
35 }; 129 };
36 130
37 return imx_add_platform_device("imx-uart", id, res, ARRAY_SIZE(res), 131 return imx_add_platform_device("imx-uart", data->id, res,
38 pdata, sizeof(*pdata)); 132 ARRAY_SIZE(res), pdata, sizeof(*pdata));
39} 133}
40 134
41struct platform_device *__init imx_add_imx_uart_1irq(int id, 135struct platform_device *__init imx_add_imx_uart_1irq(
42 resource_size_t iobase, resource_size_t iosize, 136 const struct imx_imx_uart_1irq_data *data,
43 resource_size_t irq,
44 const struct imxuart_platform_data *pdata) 137 const struct imxuart_platform_data *pdata)
45{ 138{
46 struct resource res[] = { 139 struct resource res[] = {
47 { 140 {
48 .start = iobase, 141 .start = data->iobase,
49 .end = iobase + iosize - 1, 142 .end = data->iobase + data->iosize - 1,
50 .flags = IORESOURCE_MEM, 143 .flags = IORESOURCE_MEM,
51 }, { 144 }, {
52 .start = irq, 145 .start = data->irq,
53 .end = irq, 146 .end = data->irq,
54 .flags = IORESOURCE_IRQ, 147 .flags = IORESOURCE_IRQ,
55 }, 148 },
56 }; 149 };
57 150
58 return imx_add_platform_device("imx-uart", id, res, ARRAY_SIZE(res), 151 return imx_add_platform_device("imx-uart", data->id, res, ARRAY_SIZE(res),
59 pdata, sizeof(*pdata)); 152 pdata, sizeof(*pdata));
60} 153}
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_nand.c b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
index 1c286418d123..3fdcc32e3d67 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_nand.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
@@ -7,38 +7,77 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <asm/sizes.h> 9#include <asm/sizes.h>
10#include <mach/hardware.h>
10#include <mach/devices-common.h> 11#include <mach/devices-common.h>
11 12
12static struct platform_device *__init imx_add_mxc_nand(resource_size_t iobase, 13#define imx_mxc_nand_data_entry_single(soc, _size) \
13 int irq, const struct mxc_nand_platform_data *pdata, 14 { \
14 resource_size_t iosize) 15 .iobase = soc ## _NFC_BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_NFC \
18 }
19
20#define imx_mxc_nandv3_data_entry_single(soc, _size) \
21 { \
22 .id = -1, \
23 .iobase = soc ## _NFC_BASE_ADDR, \
24 .iosize = _size, \
25 .axibase = soc ## _NFC_AXI_BASE_ADDR, \
26 .irq = soc ## _INT_NFC \
27 }
28
29#ifdef CONFIG_SOC_IMX21
30const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
31 imx_mxc_nand_data_entry_single(MX21, SZ_4K);
32#endif /* ifdef CONFIG_SOC_IMX21 */
33
34#ifdef CONFIG_ARCH_MX25
35const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
36 imx_mxc_nand_data_entry_single(MX25, SZ_8K);
37#endif /* ifdef CONFIG_ARCH_MX25 */
38
39#ifdef CONFIG_SOC_IMX27
40const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
41 imx_mxc_nand_data_entry_single(MX27, SZ_4K);
42#endif /* ifdef CONFIG_SOC_IMX27 */
43
44#ifdef CONFIG_ARCH_MX31
45const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
46 imx_mxc_nand_data_entry_single(MX31, SZ_4K);
47#endif
48
49#ifdef CONFIG_ARCH_MX35
50const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
51 imx_mxc_nand_data_entry_single(MX35, SZ_8K);
52#endif
53
54#ifdef CONFIG_ARCH_MX51
55const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
56 imx_mxc_nandv3_data_entry_single(MX51, SZ_16K);
57#endif
58
59struct platform_device *__init imx_add_mxc_nand(
60 const struct imx_mxc_nand_data *data,
61 const struct mxc_nand_platform_data *pdata)
15{ 62{
16 static int id = 0; 63 /* AXI has to come first, that's how the mxc_nand driver expect it */
17
18 struct resource res[] = { 64 struct resource res[] = {
19 { 65 {
20 .start = iobase, 66 .start = data->axibase,
21 .end = iobase + iosize - 1, 67 .end = data->axibase + SZ_16K - 1,
22 .flags = IORESOURCE_MEM, 68 .flags = IORESOURCE_MEM,
23 }, { 69 }, {
24 .start = irq, 70 .start = data->iobase,
25 .end = irq, 71 .end = data->iobase + data->iosize - 1,
72 .flags = IORESOURCE_MEM,
73 }, {
74 .start = data->irq,
75 .end = data->irq,
26 .flags = IORESOURCE_IRQ, 76 .flags = IORESOURCE_IRQ,
27 }, 77 },
28 }; 78 };
29 79 return imx_add_platform_device("mxc_nand", data->id,
30 return imx_add_platform_device("mxc_nand", id++, res, ARRAY_SIZE(res), 80 res + !data->axibase,
81 ARRAY_SIZE(res) - !data->axibase,
31 pdata, sizeof(*pdata)); 82 pdata, sizeof(*pdata));
32} 83}
33
34struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase,
35 int irq, const struct mxc_nand_platform_data *pdata)
36{
37 return imx_add_mxc_nand(iobase, irq, pdata, SZ_4K);
38}
39
40struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase,
41 int irq, const struct mxc_nand_platform_data *pdata)
42{
43 return imx_add_mxc_nand(iobase, irq, pdata, SZ_8K);
44}
diff --git a/arch/arm/plat-mxc/devices/platform-spi_imx.c b/arch/arm/plat-mxc/devices/platform-spi_imx.c
index 2831a6d3eb4b..e48340ec331e 100644
--- a/arch/arm/plat-mxc/devices/platform-spi_imx.c
+++ b/arch/arm/plat-mxc/devices/platform-spi_imx.c
@@ -6,25 +6,96 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <asm/sizes.h> 9#include <mach/hardware.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12struct platform_device *__init imx_add_spi_imx(int id, 12#define imx_spi_imx_data_entry_single(soc, type, _devid, _id, hwid, _size) \
13 resource_size_t iobase, resource_size_t iosize, int irq, 13 { \
14 .devid = _devid, \
15 .id = _id, \
16 .iobase = soc ## _ ## type ## hwid ## _BASE_ADDR, \
17 .iosize = _size, \
18 .irq = soc ## _INT_ ## type ## hwid, \
19 }
20
21#define imx_spi_imx_data_entry(soc, type, devid, id, hwid, size) \
22 [id] = imx_spi_imx_data_entry_single(soc, type, devid, id, hwid, size)
23
24#ifdef CONFIG_SOC_IMX21
25const struct imx_spi_imx_data imx21_cspi_data[] __initconst = {
26#define imx21_cspi_data_entry(_id, _hwid) \
27 imx_spi_imx_data_entry(MX21, CSPI, "imx21-cspi", _id, _hwid, SZ_4K)
28 imx21_cspi_data_entry(0, 1),
29 imx21_cspi_data_entry(1, 2),
30#endif
31
32#ifdef CONFIG_ARCH_MX25
33const struct imx_spi_imx_data imx25_cspi_data[] __initconst = {
34#define imx25_cspi_data_entry(_id, _hwid) \
35 imx_spi_imx_data_entry(MX25, CSPI, "imx25-cspi", _id, _hwid, SZ_16K)
36 imx25_cspi_data_entry(0, 1),
37 imx25_cspi_data_entry(1, 2),
38 imx25_cspi_data_entry(2, 3),
39};
40#endif /* ifdef CONFIG_ARCH_MX25 */
41
42#ifdef CONFIG_SOC_IMX27
43const struct imx_spi_imx_data imx27_cspi_data[] __initconst = {
44#define imx27_cspi_data_entry(_id, _hwid) \
45 imx_spi_imx_data_entry(MX27, CSPI, "imx27-cspi", _id, _hwid, SZ_4K)
46 imx27_cspi_data_entry(0, 1),
47 imx27_cspi_data_entry(1, 2),
48 imx27_cspi_data_entry(2, 3),
49};
50#endif /* ifdef CONFIG_SOC_IMX27 */
51
52#ifdef CONFIG_ARCH_MX31
53const struct imx_spi_imx_data imx31_cspi_data[] __initconst = {
54#define imx31_cspi_data_entry(_id, _hwid) \
55 imx_spi_imx_data_entry(MX31, CSPI, "imx31-cspi", _id, _hwid, SZ_4K)
56 imx31_cspi_data_entry(0, 1),
57 imx31_cspi_data_entry(1, 2),
58 imx31_cspi_data_entry(2, 3),
59};
60#endif /* ifdef CONFIG_ARCH_MX31 */
61
62#ifdef CONFIG_ARCH_MX35
63const struct imx_spi_imx_data imx35_cspi_data[] __initconst = {
64#define imx35_cspi_data_entry(_id, _hwid) \
65 imx_spi_imx_data_entry(MX35, CSPI, "imx35-cspi", _id, _hwid, SZ_4K)
66 imx35_cspi_data_entry(0, 1),
67 imx35_cspi_data_entry(1, 2),
68};
69#endif /* ifdef CONFIG_ARCH_MX35 */
70
71#ifdef CONFIG_ARCH_MX51
72const struct imx_spi_imx_data imx51_cspi_data __initconst =
73 imx_spi_imx_data_entry_single(MX51, CSPI, "imx51-cspi", 0, , SZ_4K);
74
75const struct imx_spi_imx_data imx51_ecspi_data[] __initconst = {
76#define imx51_ecspi_data_entry(_id, _hwid) \
77 imx_spi_imx_data_entry(MX51, ECSPI, "imx51-ecspi", _id, _hwid, SZ_4K)
78 imx51_ecspi_data_entry(0, 1),
79 imx51_ecspi_data_entry(1, 2),
80};
81#endif /* ifdef CONFIG_ARCH_MX51 */
82
83struct platform_device *__init imx_add_spi_imx(
84 const struct imx_spi_imx_data *data,
14 const struct spi_imx_master *pdata) 85 const struct spi_imx_master *pdata)
15{ 86{
16 struct resource res[] = { 87 struct resource res[] = {
17 { 88 {
18 .start = iobase, 89 .start = data->iobase,
19 .end = iobase + iosize - 1, 90 .end = data->iobase + data->iosize - 1,
20 .flags = IORESOURCE_MEM, 91 .flags = IORESOURCE_MEM,
21 }, { 92 }, {
22 .start = irq, 93 .start = data->irq,
23 .end = irq, 94 .end = data->irq,
24 .flags = IORESOURCE_IRQ, 95 .flags = IORESOURCE_IRQ,
25 }, 96 },
26 }; 97 };
27 98
28 return imx_add_platform_device("spi_imx", id, res, ARRAY_SIZE(res), 99 return imx_add_platform_device(data->devid, data->id,
29 pdata, sizeof(*pdata)); 100 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
30} 101}
diff --git a/arch/arm/plat-mxc/ehci.c b/arch/arm/plat-mxc/ehci.c
index 35a064ff02ba..9915607683de 100644
--- a/arch/arm/plat-mxc/ehci.c
+++ b/arch/arm/plat-mxc/ehci.c
@@ -249,8 +249,8 @@ int mxc_initialize_usb_hw(int port, unsigned int flags)
249#ifdef CONFIG_ARCH_MX51 249#ifdef CONFIG_ARCH_MX51
250 if (cpu_is_mx51()) { 250 if (cpu_is_mx51()) {
251 void __iomem *usb_base; 251 void __iomem *usb_base;
252 u32 usbotg_base; 252 void __iomem *usbotg_base;
253 u32 usbother_base; 253 void __iomem *usbother_base;
254 int ret = 0; 254 int ret = 0;
255 255
256 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); 256 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c
new file mode 100644
index 000000000000..ee9582f4972e
--- /dev/null
+++ b/arch/arm/plat-mxc/epit.c
@@ -0,0 +1,242 @@
1/*
2 * linux/arch/arm/plat-mxc/epit.c
3 *
4 * Copyright (C) 2010 Sascha Hauer <s.hauer@pengutronix.de>
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#define EPITCR 0x00
22#define EPITSR 0x04
23#define EPITLR 0x08
24#define EPITCMPR 0x0c
25#define EPITCNR 0x10
26
27#define EPITCR_EN (1 << 0)
28#define EPITCR_ENMOD (1 << 1)
29#define EPITCR_OCIEN (1 << 2)
30#define EPITCR_RLD (1 << 3)
31#define EPITCR_PRESC(x) (((x) & 0xfff) << 4)
32#define EPITCR_SWR (1 << 16)
33#define EPITCR_IOVW (1 << 17)
34#define EPITCR_DBGEN (1 << 18)
35#define EPITCR_WAITEN (1 << 19)
36#define EPITCR_RES (1 << 20)
37#define EPITCR_STOPEN (1 << 21)
38#define EPITCR_OM_DISCON (0 << 22)
39#define EPITCR_OM_TOGGLE (1 << 22)
40#define EPITCR_OM_CLEAR (2 << 22)
41#define EPITCR_OM_SET (3 << 22)
42#define EPITCR_CLKSRC_OFF (0 << 24)
43#define EPITCR_CLKSRC_PERIPHERAL (1 << 24)
44#define EPITCR_CLKSRC_REF_HIGH (1 << 24)
45#define EPITCR_CLKSRC_REF_LOW (3 << 24)
46
47#define EPITSR_OCIF (1 << 0)
48
49#include <linux/interrupt.h>
50#include <linux/irq.h>
51#include <linux/clockchips.h>
52#include <linux/clk.h>
53
54#include <mach/hardware.h>
55#include <asm/mach/time.h>
56#include <mach/common.h>
57
58static struct clock_event_device clockevent_epit;
59static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
60
61static void __iomem *timer_base;
62
63static inline void epit_irq_disable(void)
64{
65 u32 val;
66
67 val = __raw_readl(timer_base + EPITCR);
68 val &= ~EPITCR_OCIEN;
69 __raw_writel(val, timer_base + EPITCR);
70}
71
72static inline void epit_irq_enable(void)
73{
74 u32 val;
75
76 val = __raw_readl(timer_base + EPITCR);
77 val |= EPITCR_OCIEN;
78 __raw_writel(val, timer_base + EPITCR);
79}
80
81static void epit_irq_acknowledge(void)
82{
83 __raw_writel(EPITSR_OCIF, timer_base + EPITSR);
84}
85
86static cycle_t epit_read(struct clocksource *cs)
87{
88 return 0 - __raw_readl(timer_base + EPITCNR);
89}
90
91static struct clocksource clocksource_epit = {
92 .name = "epit",
93 .rating = 200,
94 .read = epit_read,
95 .mask = CLOCKSOURCE_MASK(32),
96 .shift = 20,
97 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
98};
99
100static int __init epit_clocksource_init(struct clk *timer_clk)
101{
102 unsigned int c = clk_get_rate(timer_clk);
103
104 clocksource_epit.mult = clocksource_hz2mult(c,
105 clocksource_epit.shift);
106 clocksource_register(&clocksource_epit);
107
108 return 0;
109}
110
111/* clock event */
112
113static int epit_set_next_event(unsigned long evt,
114 struct clock_event_device *unused)
115{
116 unsigned long tcmp;
117
118 tcmp = __raw_readl(timer_base + EPITCNR);
119
120 __raw_writel(tcmp - evt, timer_base + EPITCMPR);
121
122 return 0;
123}
124
125static void epit_set_mode(enum clock_event_mode mode,
126 struct clock_event_device *evt)
127{
128 unsigned long flags;
129
130 /*
131 * The timer interrupt generation is disabled at least
132 * for enough time to call epit_set_next_event()
133 */
134 local_irq_save(flags);
135
136 /* Disable interrupt in GPT module */
137 epit_irq_disable();
138
139 if (mode != clockevent_mode) {
140 /* Set event time into far-far future */
141
142 /* Clear pending interrupt */
143 epit_irq_acknowledge();
144 }
145
146 /* Remember timer mode */
147 clockevent_mode = mode;
148 local_irq_restore(flags);
149
150 switch (mode) {
151 case CLOCK_EVT_MODE_PERIODIC:
152 printk(KERN_ERR "epit_set_mode: Periodic mode is not "
153 "supported for i.MX EPIT\n");
154 break;
155 case CLOCK_EVT_MODE_ONESHOT:
156 /*
157 * Do not put overhead of interrupt enable/disable into
158 * epit_set_next_event(), the core has about 4 minutes
159 * to call epit_set_next_event() or shutdown clock after
160 * mode switching
161 */
162 local_irq_save(flags);
163 epit_irq_enable();
164 local_irq_restore(flags);
165 break;
166 case CLOCK_EVT_MODE_SHUTDOWN:
167 case CLOCK_EVT_MODE_UNUSED:
168 case CLOCK_EVT_MODE_RESUME:
169 /* Left event sources disabled, no more interrupts appear */
170 break;
171 }
172}
173
174/*
175 * IRQ handler for the timer
176 */
177static irqreturn_t epit_timer_interrupt(int irq, void *dev_id)
178{
179 struct clock_event_device *evt = &clockevent_epit;
180
181 epit_irq_acknowledge();
182
183 evt->event_handler(evt);
184
185 return IRQ_HANDLED;
186}
187
188static struct irqaction epit_timer_irq = {
189 .name = "i.MX EPIT Timer Tick",
190 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
191 .handler = epit_timer_interrupt,
192};
193
194static struct clock_event_device clockevent_epit = {
195 .name = "epit",
196 .features = CLOCK_EVT_FEAT_ONESHOT,
197 .shift = 32,
198 .set_mode = epit_set_mode,
199 .set_next_event = epit_set_next_event,
200 .rating = 200,
201};
202
203static int __init epit_clockevent_init(struct clk *timer_clk)
204{
205 unsigned int c = clk_get_rate(timer_clk);
206
207 clockevent_epit.mult = div_sc(c, NSEC_PER_SEC,
208 clockevent_epit.shift);
209 clockevent_epit.max_delta_ns =
210 clockevent_delta2ns(0xfffffffe, &clockevent_epit);
211 clockevent_epit.min_delta_ns =
212 clockevent_delta2ns(0x800, &clockevent_epit);
213
214 clockevent_epit.cpumask = cpumask_of(0);
215
216 clockevents_register_device(&clockevent_epit);
217
218 return 0;
219}
220
221void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
222{
223 clk_enable(timer_clk);
224
225 timer_base = base;
226
227 /*
228 * Initialise to a known state (all timers off, and timing reset)
229 */
230 __raw_writel(0x0, timer_base + EPITCR);
231
232 __raw_writel(0xffffffff, timer_base + EPITLR);
233 __raw_writel(EPITCR_EN | EPITCR_CLKSRC_REF_HIGH | EPITCR_WAITEN,
234 timer_base + EPITCR);
235
236 /* init and register the timer to the framework */
237 epit_clocksource_init(timer_clk);
238 epit_clockevent_init(timer_clk);
239
240 /* Make irqs happen */
241 setup_irq(irq, &epit_timer_irq);
242}
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 57ec4a896a5d..9d38da077edb 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -235,7 +235,7 @@ static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
235 unsigned long flags; 235 unsigned long flags;
236 236
237 spin_lock_irqsave(&port->lock, flags); 237 spin_lock_irqsave(&port->lock, flags);
238 l = (__raw_readl(reg) & (~(1 << offset))) | (value << offset); 238 l = (__raw_readl(reg) & (~(1 << offset))) | (!!value << offset);
239 __raw_writel(l, reg); 239 __raw_writel(l, reg);
240 spin_unlock_irqrestore(&port->lock, flags); 240 spin_unlock_irqrestore(&port->lock, flags);
241} 241}
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
new file mode 100644
index 000000000000..94b60dd47137
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
@@ -0,0 +1,33 @@
1/*
2 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_BOARD_MX31ADS_H__
12#define __ASM_ARCH_MXC_BOARD_MX31ADS_H__
13
14#include <mach/hardware.h>
15
16/*
17 * These symbols are used by drivers/net/cs89x0.c.
18 * This is ugly as hell, but we have to provide them until
19 * someone fixed the driver.
20 */
21
22/* Base address of PBC controller */
23#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
24/* Offsets for the PBC Controller register */
25
26/* Ethernet Controller IO base address */
27#define PBC_CS8900A_IOBASE 0x020000
28
29#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
30
31#define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8)
32
33#endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 2941472582d2..7a1e1f89ff09 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -32,6 +32,7 @@ extern void mx31_init_irq(void);
32extern void mx35_init_irq(void); 32extern void mx35_init_irq(void);
33extern void mx51_init_irq(void); 33extern void mx51_init_irq(void);
34extern void mxc91231_init_irq(void); 34extern void mxc91231_init_irq(void);
35extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq);
35extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int); 36extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int);
36extern int mx1_clocks_init(unsigned long fref); 37extern int mx1_clocks_init(unsigned long fref);
37extern int mx21_clocks_init(unsigned long lref, unsigned long fref); 38extern int mx21_clocks_init(unsigned long lref, unsigned long fref);
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index c5f68c587309..86d7575a564d 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -14,47 +14,105 @@ struct platform_device *imx_add_platform_device(const char *name, int id,
14 const struct resource *res, unsigned int num_resources, 14 const struct resource *res, unsigned int num_resources,
15 const void *data, size_t size_data); 15 const void *data, size_t size_data);
16 16
17#if defined (CONFIG_CAN_FLEXCAN) || defined (CONFIG_CAN_FLEXCAN_MODULE) 17#include <linux/fec.h>
18struct imx_fec_data {
19 resource_size_t iobase;
20 resource_size_t irq;
21};
22struct platform_device *__init imx_add_fec(
23 const struct imx_fec_data *data,
24 const struct fec_platform_data *pdata);
25
18#include <linux/can/platform/flexcan.h> 26#include <linux/can/platform/flexcan.h>
19struct platform_device *__init imx_add_flexcan(int id, 27struct platform_device *__init imx_add_flexcan(int id,
20 resource_size_t iobase, resource_size_t iosize, 28 resource_size_t iobase, resource_size_t iosize,
21 resource_size_t irq, 29 resource_size_t irq,
22 const struct flexcan_platform_data *pdata); 30 const struct flexcan_platform_data *pdata);
23#else
24/* the ifdef can be removed once the flexcan driver has been merged */
25struct flexcan_platform_data;
26static inline struct platform_device *__init imx_add_flexcan(int id,
27 resource_size_t iobase, resource_size_t iosize,
28 resource_size_t irq,
29 const struct flexcan_platform_data *pdata)
30{
31 return NULL;
32}
33#endif
34 31
35#include <mach/i2c.h> 32#include <mach/i2c.h>
36struct platform_device *__init imx_add_imx_i2c(int id, 33struct imx_imx_i2c_data {
37 resource_size_t iobase, resource_size_t iosize, int irq, 34 int id;
35 resource_size_t iobase;
36 resource_size_t iosize;
37 resource_size_t irq;
38};
39struct platform_device *__init imx_add_imx_i2c(
40 const struct imx_imx_i2c_data *data,
38 const struct imxi2c_platform_data *pdata); 41 const struct imxi2c_platform_data *pdata);
39 42
43#include <mach/ssi.h>
44struct imx_imx_ssi_data {
45 int id;
46 resource_size_t iobase;
47 resource_size_t iosize;
48 resource_size_t irq;
49 resource_size_t dmatx0;
50 resource_size_t dmarx0;
51 resource_size_t dmatx1;
52 resource_size_t dmarx1;
53};
54struct platform_device *__init imx_add_imx_ssi(
55 const struct imx_imx_ssi_data *data,
56 const struct imx_ssi_platform_data *pdata);
57
40#include <mach/imx-uart.h> 58#include <mach/imx-uart.h>
41struct platform_device *__init imx_add_imx_uart_3irq(int id, 59struct imx_imx_uart_3irq_data {
42 resource_size_t iobase, resource_size_t iosize, 60 int id;
43 resource_size_t irqrx, resource_size_t irqtx, 61 resource_size_t iobase;
44 resource_size_t irqrts, 62 resource_size_t iosize;
63 resource_size_t irqrx;
64 resource_size_t irqtx;
65 resource_size_t irqrts;
66};
67struct platform_device *__init imx_add_imx_uart_3irq(
68 const struct imx_imx_uart_3irq_data *data,
45 const struct imxuart_platform_data *pdata); 69 const struct imxuart_platform_data *pdata);
46struct platform_device *__init imx_add_imx_uart_1irq(int id, 70
47 resource_size_t iobase, resource_size_t iosize, 71struct imx_imx_uart_1irq_data {
48 resource_size_t irq, 72 int id;
73 resource_size_t iobase;
74 resource_size_t iosize;
75 resource_size_t irq;
76};
77struct platform_device *__init imx_add_imx_uart_1irq(
78 const struct imx_imx_uart_1irq_data *data,
49 const struct imxuart_platform_data *pdata); 79 const struct imxuart_platform_data *pdata);
50 80
51#include <mach/mxc_nand.h> 81#include <mach/mxc_nand.h>
52struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase, 82struct imx_mxc_nand_data {
53 int irq, const struct mxc_nand_platform_data *pdata); 83 /*
54struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase, 84 * id is traditionally 0, but -1 is more appropriate. We use -1 for new
55 int irq, const struct mxc_nand_platform_data *pdata); 85 * machines but don't change existing devices as the nand device usually
86 * appears in the kernel command line to pass its partitioning.
87 */
88 int id;
89 resource_size_t iobase;
90 resource_size_t iosize;
91 resource_size_t axibase;
92 resource_size_t irq;
93};
94struct platform_device *__init imx_add_mxc_nand(
95 const struct imx_mxc_nand_data *data,
96 const struct mxc_nand_platform_data *pdata);
56 97
57#include <mach/spi.h> 98#include <mach/spi.h>
58struct platform_device *__init imx_add_spi_imx(int id, 99struct imx_spi_imx_data {
59 resource_size_t iobase, resource_size_t iosize, int irq, 100 const char *devid;
101 int id;
102 resource_size_t iobase;
103 resource_size_t iosize;
104 int irq;
105};
106struct platform_device *__init imx_add_spi_imx(
107 const struct imx_spi_imx_data *data,
60 const struct spi_imx_master *pdata); 108 const struct spi_imx_master *pdata);
109
110#include <mach/esdhc.h>
111struct imx_esdhc_imx_data {
112 int id;
113 resource_size_t iobase;
114 resource_size_t irq;
115};
116struct platform_device *__init imx_add_esdhc(
117 const struct imx_esdhc_imx_data *data,
118 const struct esdhc_platform_data *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/esdhc.h b/arch/arm/plat-mxc/include/mach/esdhc.h
new file mode 100644
index 000000000000..a48a9aaa56b1
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/esdhc.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright 2010 Wolfram Sang <w.sang@pengutronix.de>
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; version 2
7 * of the License.
8 */
9
10#ifndef __ASM_ARCH_IMX_ESDHC_H
11#define __ASM_ARCH_IMX_ESDHC_H
12
13struct esdhc_platform_data {
14 unsigned int wp_gpio; /* write protect pin */
15};
16#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h b/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h
index 656acb45d434..a21d3313f994 100644
--- a/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h
+++ b/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h
@@ -28,19 +28,22 @@
28 * its own devices, it calls baseboard's init function. 28 * its own devices, it calls baseboard's init function.
29 * TODO: Add your own baseboard init function and call it from 29 * TODO: Add your own baseboard init function and call it from
30 * inside eukrea_cpuimx25_init() eukrea_cpuimx27_init() 30 * inside eukrea_cpuimx25_init() eukrea_cpuimx27_init()
31 * eukrea_cpuimx35_init() or eukrea_cpuimx51_init(). 31 * eukrea_cpuimx35_init() eukrea_cpuimx51_init()
32 * or eukrea_cpuimx51sd_init().
32 * 33 *
33 * This example here is for the development board. Refer 34 * This example here is for the development board. Refer
34 * mach-mx25/eukrea_mbimxsd-baseboard.c for cpuimx25 35 * mach-mx25/eukrea_mbimxsd-baseboard.c for cpuimx25
35 * mach-imx/eukrea_mbimx27-baseboard.c for cpuimx27 36 * mach-imx/eukrea_mbimx27-baseboard.c for cpuimx27
36 * mach-mx3/eukrea_mbimxsd-baseboard.c for cpuimx35 37 * mach-mx3/eukrea_mbimxsd-baseboard.c for cpuimx35
37 * mach-mx5/eukrea_mbimx51-baseboard.c for cpuimx51 38 * mach-mx5/eukrea_mbimx51-baseboard.c for cpuimx51
39 * mach-mx5/eukrea_mbimxsd-baseboard.c for cpuimx51sd
38 */ 40 */
39 41
40extern void eukrea_mbimxsd25_baseboard_init(void); 42extern void eukrea_mbimxsd25_baseboard_init(void);
41extern void eukrea_mbimx27_baseboard_init(void); 43extern void eukrea_mbimx27_baseboard_init(void);
42extern void eukrea_mbimxsd35_baseboard_init(void); 44extern void eukrea_mbimxsd35_baseboard_init(void);
43extern void eukrea_mbimx51_baseboard_init(void); 45extern void eukrea_mbimx51_baseboard_init(void);
46extern void eukrea_mbimxsd51_baseboard_init(void);
44 47
45#endif 48#endif
46 49
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
index 21bfa46785bb..e46b1c2836d4 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
@@ -45,6 +45,18 @@ typedef enum iomux_config {
45 PAD_CTL_PKE | PAD_CTL_HYS) 45 PAD_CTL_PKE | PAD_CTL_HYS)
46#define MX51_GPIO_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PKE | \ 46#define MX51_GPIO_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PKE | \
47 PAD_CTL_SRE_FAST) 47 PAD_CTL_SRE_FAST)
48#define MX51_ECSPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \
49 PAD_CTL_SRE_FAST)
50#define MX51_SDHCI_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PUS_47K_UP | \
51 PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_SRE_FAST | \
52 PAD_CTL_DVS)
53
54#define MX51_PAD_CTRL_1 (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \
55 PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_HYS)
56#define MX51_PAD_CTRL_2 (PAD_CTL_HYS | PAD_CTL_PKE)
57#define MX51_PAD_CTRL_3 (PAD_CTL_PKE | PAD_CTL_PUS_100K_UP)
58#define MX51_PAD_CTRL_4 (PAD_CTL_DVS | PAD_CTL_HYS | PAD_CTL_PKE)
59#define MX51_PAD_CTRL_5 (PAD_CTL_DVS | PAD_CTL_DSE_HIGH)
48 60
49/* 61/*
50 * The naming convention for the pad modes is MX51_PAD_<padname>__<padmode> 62 * The naming convention for the pad modes is MX51_PAD_<padname>__<padmode>
@@ -106,14 +118,20 @@ typedef enum iomux_config {
106#define MX51_PAD_EIM_EB0__EIM_EB0 IOMUX_PAD(0x460, 0x0cc, 0, 0x0, 0, NO_PAD_CTRL) 118#define MX51_PAD_EIM_EB0__EIM_EB0 IOMUX_PAD(0x460, 0x0cc, 0, 0x0, 0, NO_PAD_CTRL)
107#define MX51_PAD_EIM_EB1__EIM_EB1 IOMUX_PAD(0x464, 0x0d0, 0, 0x0, 0, NO_PAD_CTRL) 119#define MX51_PAD_EIM_EB1__EIM_EB1 IOMUX_PAD(0x464, 0x0d0, 0, 0x0, 0, NO_PAD_CTRL)
108#define MX51_PAD_EIM_EB2__GPIO_2_22 IOMUX_PAD(0x468, 0x0d4, 1, 0x0, 0, NO_PAD_CTRL) 120#define MX51_PAD_EIM_EB2__GPIO_2_22 IOMUX_PAD(0x468, 0x0d4, 1, 0x0, 0, NO_PAD_CTRL)
121#define MX51_PAD_EIM_EB2__FEC_MDIO IOMUX_PAD(0x468, 0x0d4, 3, 0x0, 0, MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP)
109#define MX51_PAD_EIM_EB3__GPIO_2_23 IOMUX_PAD(0x46c, 0x0d8, 1, 0x0, 0, NO_PAD_CTRL) 122#define MX51_PAD_EIM_EB3__GPIO_2_23 IOMUX_PAD(0x46c, 0x0d8, 1, 0x0, 0, NO_PAD_CTRL)
123#define MX51_PAD_EIM_EB3__FEC_RDAT1 IOMUX_PAD(0x46c, 0x0d8, 3, 0x0, 0, MX51_PAD_CTRL_2)
110#define MX51_PAD_EIM_OE__GPIO_2_24 IOMUX_PAD(0x470, 0x0dc, 1, 0x0, 0, NO_PAD_CTRL) 124#define MX51_PAD_EIM_OE__GPIO_2_24 IOMUX_PAD(0x470, 0x0dc, 1, 0x0, 0, NO_PAD_CTRL)
111#define MX51_PAD_EIM_CS0__GPIO_2_25 IOMUX_PAD(0x474, 0x0e0, 1, 0x0, 0, NO_PAD_CTRL) 125#define MX51_PAD_EIM_CS0__GPIO_2_25 IOMUX_PAD(0x474, 0x0e0, 1, 0x0, 0, NO_PAD_CTRL)
112#define MX51_PAD_EIM_CS1__GPIO_2_26 IOMUX_PAD(0x478, 0x0e4, 1, 0x0, 0, NO_PAD_CTRL) 126#define MX51_PAD_EIM_CS1__GPIO_2_26 IOMUX_PAD(0x478, 0x0e4, 1, 0x0, 0, NO_PAD_CTRL)
113#define MX51_PAD_EIM_CS2__GPIO_2_27 IOMUX_PAD(0x47c, 0x0e8, 1, 0x0, 0, NO_PAD_CTRL) 127#define MX51_PAD_EIM_CS2__GPIO_2_27 IOMUX_PAD(0x47c, 0x0e8, 1, 0x0, 0, NO_PAD_CTRL)
128#define MX51_PAD_EIM_CS2__FEC_RDAT2 IOMUX_PAD(0x47c, 0x0e8, 3, 0x0, 0, MX51_PAD_CTRL_2)
114#define MX51_PAD_EIM_CS3__GPIO_2_28 IOMUX_PAD(0x480, 0x0ec, 1, 0x0, 0, NO_PAD_CTRL) 129#define MX51_PAD_EIM_CS3__GPIO_2_28 IOMUX_PAD(0x480, 0x0ec, 1, 0x0, 0, NO_PAD_CTRL)
130#define MX51_PAD_EIM_CS3__FEC_RDAT3 IOMUX_PAD(0x480, 0x0ec, 3, 0x0, 0, MX51_PAD_CTRL_2)
115#define MX51_PAD_EIM_CS4__GPIO_2_29 IOMUX_PAD(0x484, 0x0f0, 1, 0x0, 0, NO_PAD_CTRL) 131#define MX51_PAD_EIM_CS4__GPIO_2_29 IOMUX_PAD(0x484, 0x0f0, 1, 0x0, 0, NO_PAD_CTRL)
132#define MX51_PAD_EIM_CS4__FEC_RX_ER IOMUX_PAD(0x484, 0x0f0, 3, 0x0, 0, MX51_PAD_CTRL_2)
116#define MX51_PAD_EIM_CS5__GPIO_2_30 IOMUX_PAD(0x488, 0x0f4, 1, 0x0, 0, NO_PAD_CTRL) 133#define MX51_PAD_EIM_CS5__GPIO_2_30 IOMUX_PAD(0x488, 0x0f4, 1, 0x0, 0, NO_PAD_CTRL)
134#define MX51_PAD_EIM_CS5__FEC_CRS IOMUX_PAD(0x488, 0x0f4, 3, 0x0, 0, MX51_PAD_CTRL_2)
117#define MX51_PAD_EIM_DTACK__GPIO_2_31 IOMUX_PAD(0x48c, 0x0f8, 1, 0x0, 0, NO_PAD_CTRL) 135#define MX51_PAD_EIM_DTACK__GPIO_2_31 IOMUX_PAD(0x48c, 0x0f8, 1, 0x0, 0, NO_PAD_CTRL)
118#define MX51_PAD_EIM_LBA__GPIO_3_1 IOMUX_PAD(0x494, 0x0FC, 1, 0x0, 0, NO_PAD_CTRL) 136#define MX51_PAD_EIM_LBA__GPIO_3_1 IOMUX_PAD(0x494, 0x0FC, 1, 0x0, 0, NO_PAD_CTRL)
119#define MX51_PAD_EIM_CRE__GPIO_3_2 IOMUX_PAD(0x4A0, 0x100, 1, 0x0, 0, NO_PAD_CTRL) 137#define MX51_PAD_EIM_CRE__GPIO_3_2 IOMUX_PAD(0x4A0, 0x100, 1, 0x0, 0, NO_PAD_CTRL)
@@ -126,18 +144,32 @@ typedef enum iomux_config {
126#define MX51_PAD_NANDF_RB0__GPIO_3_8 IOMUX_PAD(0x4F8, 0x11C, 3, 0x0, 0, NO_PAD_CTRL) 144#define MX51_PAD_NANDF_RB0__GPIO_3_8 IOMUX_PAD(0x4F8, 0x11C, 3, 0x0, 0, NO_PAD_CTRL)
127#define MX51_PAD_NANDF_RB1__GPIO_3_9 IOMUX_PAD(0x4FC, 0x120, 3, 0x0, 0, NO_PAD_CTRL) 145#define MX51_PAD_NANDF_RB1__GPIO_3_9 IOMUX_PAD(0x4FC, 0x120, 3, 0x0, 0, NO_PAD_CTRL)
128#define MX51_PAD_NANDF_RB2__GPIO_3_10 IOMUX_PAD(0x500, 0x124, 3, 0x0, 0, NO_PAD_CTRL) 146#define MX51_PAD_NANDF_RB2__GPIO_3_10 IOMUX_PAD(0x500, 0x124, 3, 0x0, 0, NO_PAD_CTRL)
147#define MX51_PAD_NANDF_RB2__ECSPI2_SCLK IOMUX_PAD(0x500, 0x124, 2, 0x0, 0, MX51_ECSPI_PAD_CTRL)
148#define MX51_PAD_NANDF_RB2__FEC_COL IOMUX_PAD(0x500, 0x124, 1, 0x0, 0, MX51_PAD_CTRL_2)
129#define MX51_PAD_NANDF_RB3__GPIO_3_11 IOMUX_PAD(0x504, 0x128, 3, 0x0, 0, NO_PAD_CTRL) 149#define MX51_PAD_NANDF_RB3__GPIO_3_11 IOMUX_PAD(0x504, 0x128, 3, 0x0, 0, NO_PAD_CTRL)
150#define MX51_PAD_NANDF_RB3__ECSPI2_MISO IOMUX_PAD(0x504, 0x128, 2, 0x0, 0, MX51_ECSPI_PAD_CTRL)
151#define MX51_PAD_NANDF_RB3__FEC_RXCLK IOMUX_PAD(0x504, 0x128, 1, 0x0, 0, MX51_PAD_CTRL_2)
152#define MX51_PAD_NANDF_RB6__FEC_RDAT0 IOMUX_PAD(0x5DC, 0x134, 1, 0x0, 0, MX51_PAD_CTRL_4)
153#define MX51_PAD_NANDF_RB7__FEC_TDAT0 IOMUX_PAD(0x5E0, 0x138, 1, 0x0, 0, MX51_PAD_CTRL_5)
130#define MX51_PAD_GPIO_NAND__GPIO_3_12 IOMUX_PAD(0x514, 0x12C, 3, 0x0, 0, NO_PAD_CTRL) 154#define MX51_PAD_GPIO_NAND__GPIO_3_12 IOMUX_PAD(0x514, 0x12C, 3, 0x0, 0, NO_PAD_CTRL)
131#define MX51_PAD_NANDF_CS0__GPIO_3_16 IOMUX_PAD(0x518, 0x130, 3, 0x0, 0, NO_PAD_CTRL) 155#define MX51_PAD_NANDF_CS0__GPIO_3_16 IOMUX_PAD(0x518, 0x130, 3, 0x0, 0, NO_PAD_CTRL)
132#define MX51_PAD_NANDF_CS1__GPIO_3_17 IOMUX_PAD(0x51C, 0x134, 3, 0x0, 0, NO_PAD_CTRL) 156#define MX51_PAD_NANDF_CS1__GPIO_3_17 IOMUX_PAD(0x51C, 0x134, 3, 0x0, 0, NO_PAD_CTRL)
133#define MX51_PAD_NANDF_CS2__GPIO_3_18 IOMUX_PAD(0x520, 0x138, 3, 0x0, 0, NO_PAD_CTRL) 157#define MX51_PAD_NANDF_CS2__GPIO_3_18 IOMUX_PAD(0x520, 0x138, 3, 0x0, 0, NO_PAD_CTRL)
158#define MX51_PAD_NANDF_CS2__FEC_TX_ER IOMUX_PAD(0x520, 0x138, 2, 0x0, 0, MX51_PAD_CTRL_5)
134#define MX51_PAD_NANDF_CS3__GPIO_3_19 IOMUX_PAD(0x524, 0x13C, 3, 0x0, 0, NO_PAD_CTRL) 159#define MX51_PAD_NANDF_CS3__GPIO_3_19 IOMUX_PAD(0x524, 0x13C, 3, 0x0, 0, NO_PAD_CTRL)
160#define MX51_PAD_NANDF_CS3__FEC_MDC IOMUX_PAD(0x524, 0x13C, 2, 0x0, 0, MX51_PAD_CTRL_5)
135#define MX51_PAD_NANDF_CS4__GPIO_3_20 IOMUX_PAD(0x528, 0x140, 3, 0x0, 0, NO_PAD_CTRL) 161#define MX51_PAD_NANDF_CS4__GPIO_3_20 IOMUX_PAD(0x528, 0x140, 3, 0x0, 0, NO_PAD_CTRL)
162#define MX51_PAD_NANDF_CS4__FEC_TDAT1 IOMUX_PAD(0x528, 0x140, 2, 0x0, 0, MX51_PAD_CTRL_5)
136#define MX51_PAD_NANDF_CS5__GPIO_3_21 IOMUX_PAD(0x52C, 0x144, 3, 0x0, 0, NO_PAD_CTRL) 163#define MX51_PAD_NANDF_CS5__GPIO_3_21 IOMUX_PAD(0x52C, 0x144, 3, 0x0, 0, NO_PAD_CTRL)
164#define MX51_PAD_NANDF_CS5__FEC_TDAT2 IOMUX_PAD(0x52C, 0x144, 2, 0x0, 0, MX51_PAD_CTRL_5)
137#define MX51_PAD_NANDF_CS6__GPIO_3_22 IOMUX_PAD(0x530, 0x148, 3, 0x0, 0, NO_PAD_CTRL) 165#define MX51_PAD_NANDF_CS6__GPIO_3_22 IOMUX_PAD(0x530, 0x148, 3, 0x0, 0, NO_PAD_CTRL)
166#define MX51_PAD_NANDF_CS6__FEC_TDAT3 IOMUX_PAD(0x530, 0x148, 2, 0x0, 0, MX51_PAD_CTRL_5)
138#define MX51_PAD_NANDF_CS7__GPIO_3_23 IOMUX_PAD(0x534, 0x14C, 3, 0x0, 0, NO_PAD_CTRL) 167#define MX51_PAD_NANDF_CS7__GPIO_3_23 IOMUX_PAD(0x534, 0x14C, 3, 0x0, 0, NO_PAD_CTRL)
168#define MX51_PAD_NANDF_CS7__FEC_TX_EN IOMUX_PAD(0x534, 0x14C, 1, 0x0, 0, MX51_PAD_CTRL_5)
139#define MX51_PAD_NANDF_RDY_INT__GPIO_3_24 IOMUX_PAD(0x538, 0x150, 3, 0x0, 0, NO_PAD_CTRL) 169#define MX51_PAD_NANDF_RDY_INT__GPIO_3_24 IOMUX_PAD(0x538, 0x150, 3, 0x0, 0, NO_PAD_CTRL)
170#define MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK IOMUX_PAD(0x538, 0x150, 1, 0x0, 0, MX51_PAD_CTRL_4)
140#define MX51_PAD_NANDF_D15__GPIO_3_25 IOMUX_PAD(0x53C, 0x154, 3, 0x0, 0, NO_PAD_CTRL) 171#define MX51_PAD_NANDF_D15__GPIO_3_25 IOMUX_PAD(0x53C, 0x154, 3, 0x0, 0, NO_PAD_CTRL)
172#define MX51_PAD_NANDF_D15__ECSPI2_MOSI IOMUX_PAD(0x53C, 0x154, 2, 0x0, 0, MX51_ECSPI_PAD_CTRL)
141#define MX51_PAD_NANDF_D14__GPIO_3_26 IOMUX_PAD(0x540, 0x158, 3, 0x0, 0, NO_PAD_CTRL) 173#define MX51_PAD_NANDF_D14__GPIO_3_26 IOMUX_PAD(0x540, 0x158, 3, 0x0, 0, NO_PAD_CTRL)
142#define MX51_PAD_NANDF_D13__GPIO_3_27 IOMUX_PAD(0x544, 0x15C, 3, 0x0, 0, NO_PAD_CTRL) 174#define MX51_PAD_NANDF_D13__GPIO_3_27 IOMUX_PAD(0x544, 0x15C, 3, 0x0, 0, NO_PAD_CTRL)
143#define MX51_PAD_NANDF_D12__GPIO_3_28 IOMUX_PAD(0x548, 0x160, 3, 0x0, 0, NO_PAD_CTRL) 175#define MX51_PAD_NANDF_D12__GPIO_3_28 IOMUX_PAD(0x548, 0x160, 3, 0x0, 0, NO_PAD_CTRL)
@@ -185,15 +217,25 @@ typedef enum iomux_config {
185#define MX51_PAD_I2C1_CLK__HSI2C_CLK IOMUX_PAD(0x5E8, 0x1F8, 0, 0x0, 0, NO_PAD_CTRL) 217#define MX51_PAD_I2C1_CLK__HSI2C_CLK IOMUX_PAD(0x5E8, 0x1F8, 0, 0x0, 0, NO_PAD_CTRL)
186#define MX51_PAD_I2C1_DAT__GPIO_4_17 IOMUX_PAD(0x5EC, 0x1FC, 3, 0x0, 0, NO_PAD_CTRL) 218#define MX51_PAD_I2C1_DAT__GPIO_4_17 IOMUX_PAD(0x5EC, 0x1FC, 3, 0x0, 0, NO_PAD_CTRL)
187#define MX51_PAD_I2C1_DAT__HSI2C_DAT IOMUX_PAD(0x5EC, 0x1FC, 0, 0x0, 0, NO_PAD_CTRL) 219#define MX51_PAD_I2C1_DAT__HSI2C_DAT IOMUX_PAD(0x5EC, 0x1FC, 0, 0x0, 0, NO_PAD_CTRL)
220#define MX51_PAD_AUD3_BB_TXD__AUD3_BB_TXD IOMUX_PAD(0x5F0, 0x200, IOMUX_CONFIG_SION, 0x0, 0, NO_PAD_CTRL)
188#define MX51_PAD_AUD3_BB_TXD__GPIO_4_18 IOMUX_PAD(0x5F0, 0x200, 3, 0x0, 0, NO_PAD_CTRL) 221#define MX51_PAD_AUD3_BB_TXD__GPIO_4_18 IOMUX_PAD(0x5F0, 0x200, 3, 0x0, 0, NO_PAD_CTRL)
222#define MX51_PAD_AUD3_BB_RXD__AUD3_BB_RXD IOMUX_PAD(0x5F4, 0x204, IOMUX_CONFIG_SION, 0x0, 0, NO_PAD_CTRL)
189#define MX51_PAD_AUD3_BB_RXD__GPIO_4_19 IOMUX_PAD(0x5F4, 0x204, 3, 0x0, 0, NO_PAD_CTRL) 223#define MX51_PAD_AUD3_BB_RXD__GPIO_4_19 IOMUX_PAD(0x5F4, 0x204, 3, 0x0, 0, NO_PAD_CTRL)
224#define MX51_PAD_AUD3_BB_CK__AUD3_BB_CK IOMUX_PAD(0x5F8, 0x208, IOMUX_CONFIG_SION, 0x0, 0, NO_PAD_CTRL)
190#define MX51_PAD_AUD3_BB_CK__GPIO_4_20 IOMUX_PAD(0x5F8, 0x208, 3, 0x0, 0, NO_PAD_CTRL) 225#define MX51_PAD_AUD3_BB_CK__GPIO_4_20 IOMUX_PAD(0x5F8, 0x208, 3, 0x0, 0, NO_PAD_CTRL)
226#define MX51_PAD_AUD3_BB_FS__AUD3_BB_FS IOMUX_PAD(0x5FC, 0x20C, IOMUX_CONFIG_SION, 0x0, 0, NO_PAD_CTRL)
191#define MX51_PAD_AUD3_BB_FS__GPIO_4_21 IOMUX_PAD(0x5FC, 0x20C, 3, 0x0, 0, NO_PAD_CTRL) 227#define MX51_PAD_AUD3_BB_FS__GPIO_4_21 IOMUX_PAD(0x5FC, 0x20C, 3, 0x0, 0, NO_PAD_CTRL)
228#define MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI IOMUX_PAD(0x600, 0x210, 0, 0x0, 0, MX51_ECSPI_PAD_CTRL)
192#define MX51_PAD_CSPI1_MOSI__GPIO_4_22 IOMUX_PAD(0x600, 0x210, 3, 0x0, 0, NO_PAD_CTRL) 229#define MX51_PAD_CSPI1_MOSI__GPIO_4_22 IOMUX_PAD(0x600, 0x210, 3, 0x0, 0, NO_PAD_CTRL)
230#define MX51_PAD_CSPI1_MISO__ECSPI1_MISO IOMUX_PAD(0x604, 0x214, 0, 0x0, 0, MX51_ECSPI_PAD_CTRL)
193#define MX51_PAD_CSPI1_MISO__GPIO_4_23 IOMUX_PAD(0x604, 0x214, 3, 0x0, 0, NO_PAD_CTRL) 231#define MX51_PAD_CSPI1_MISO__GPIO_4_23 IOMUX_PAD(0x604, 0x214, 3, 0x0, 0, NO_PAD_CTRL)
232#define MX51_PAD_CSPI1_SS0__ECSPI1_SS0 IOMUX_PAD(0x608, 0x218, 0, 0x0, 0, MX51_ECSPI_PAD_CTRL)
194#define MX51_PAD_CSPI1_SS0__GPIO_4_24 IOMUX_PAD(0x608, 0x218, 3, 0x0, 0, NO_PAD_CTRL) 233#define MX51_PAD_CSPI1_SS0__GPIO_4_24 IOMUX_PAD(0x608, 0x218, 3, 0x0, 0, NO_PAD_CTRL)
234#define MX51_PAD_CSPI1_SS1__ECSPI1_SS1 IOMUX_PAD(0x60C, 0x21C, 0, 0x0, 0, MX51_ECSPI_PAD_CTRL)
195#define MX51_PAD_CSPI1_SS1__GPIO_4_25 IOMUX_PAD(0x60C, 0x21C, 3, 0x0, 0, NO_PAD_CTRL) 235#define MX51_PAD_CSPI1_SS1__GPIO_4_25 IOMUX_PAD(0x60C, 0x21C, 3, 0x0, 0, NO_PAD_CTRL)
236#define MX51_PAD_CSPI1_RDY__ECSPI1_RDY IOMUX_PAD(0x610, 0x220, 0, 0x0, 0, MX51_ECSPI_PAD_CTRL)
196#define MX51_PAD_CSPI1_RDY__GPIO_4_26 IOMUX_PAD(0x610, 0x220, 3, 0x0, 0, NO_PAD_CTRL) 237#define MX51_PAD_CSPI1_RDY__GPIO_4_26 IOMUX_PAD(0x610, 0x220, 3, 0x0, 0, NO_PAD_CTRL)
238#define MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK IOMUX_PAD(0x614, 0x224, 0, 0x0, 0, MX51_ECSPI_PAD_CTRL)
197#define MX51_PAD_CSPI1_SCLK__GPIO_4_27 IOMUX_PAD(0x614, 0x224, 3, 0x0, 0, NO_PAD_CTRL) 239#define MX51_PAD_CSPI1_SCLK__GPIO_4_27 IOMUX_PAD(0x614, 0x224, 3, 0x0, 0, NO_PAD_CTRL)
198#define MX51_PAD_UART1_RXD__UART1_RXD IOMUX_PAD(0x618, 0x228, 0, 0x9e4, 0, MX51_UART1_PAD_CTRL | PAD_CTL_SRE_FAST) 240#define MX51_PAD_UART1_RXD__UART1_RXD IOMUX_PAD(0x618, 0x228, 0, 0x9e4, 0, MX51_UART1_PAD_CTRL | PAD_CTL_SRE_FAST)
199#define MX51_PAD_UART1_TXD__UART1_TXD IOMUX_PAD(0x61C, 0x22C, 0, 0x0, 0, MX51_UART1_PAD_CTRL | PAD_CTL_SRE_FAST) 241#define MX51_PAD_UART1_TXD__UART1_TXD IOMUX_PAD(0x61C, 0x22C, 0, 0x0, 0, MX51_UART1_PAD_CTRL | PAD_CTL_SRE_FAST)
@@ -236,14 +278,14 @@ typedef enum iomux_config {
236#define MX51_PAD_USBH1_DATA6__USBH1_DATA6 IOMUX_PAD(0x6A0, 0x2A0, 0, 0x0, 0, MX51_USBH1_PAD_CTRL) 278#define MX51_PAD_USBH1_DATA6__USBH1_DATA6 IOMUX_PAD(0x6A0, 0x2A0, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
237#define MX51_PAD_USBH1_DATA7__USBH1_DATA7 IOMUX_PAD(0x6A4, 0x2A4, 0, 0x0, 0, MX51_USBH1_PAD_CTRL) 279#define MX51_PAD_USBH1_DATA7__USBH1_DATA7 IOMUX_PAD(0x6A4, 0x2A4, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
238#define MX51_PAD_DI1_PIN11__GPIO_3_0 IOMUX_PAD(0x6A8, 0x2A8, 4, 0x0, 0, NO_PAD_CTRL) 280#define MX51_PAD_DI1_PIN11__GPIO_3_0 IOMUX_PAD(0x6A8, 0x2A8, 4, 0x0, 0, NO_PAD_CTRL)
239#define MX51_PAD_DI1_PIN12__GPIO_3_1 IOMUX_PAD(0x6AC, 0x2AC, 4, 0x0, 0, NO_PAD_CTRL) 281#define MX51_PAD_DI1_PIN12__GPIO_3_1 IOMUX_PAD(0x6AC, 0x2AC, 4, 0x978, 1, NO_PAD_CTRL)
240#define MX51_PAD_DI1_PIN13__GPIO_3_2 IOMUX_PAD(0x6B0, 0x2B0, 4, 0x0, 0, NO_PAD_CTRL) 282#define MX51_PAD_DI1_PIN13__GPIO_3_2 IOMUX_PAD(0x6B0, 0x2B0, 4, 0x97c, 1, NO_PAD_CTRL)
241#define MX51_PAD_DI1_D0_CS__GPIO_3_3 IOMUX_PAD(0x6B4, 0x2B4, 4, 0x0, 0, NO_PAD_CTRL) 283#define MX51_PAD_DI1_D0_CS__GPIO_3_3 IOMUX_PAD(0x6B4, 0x2B4, 4, 0x980, 1, NO_PAD_CTRL)
242#define MX51_PAD_DI1_D1_CS__GPIO_3_4 IOMUX_PAD(0x6B8, 0x2B8, 4, 0x0, 0, NO_PAD_CTRL) 284#define MX51_PAD_DI1_D1_CS__GPIO_3_4 IOMUX_PAD(0x6B8, 0x2B8, 4, 0x984, 1, NO_PAD_CTRL)
243#define MX51_PAD_DISPB2_SER_DIN__GPIO_3_5 IOMUX_PAD(0x6BC, 0x2BC, 4, 0x0, 0, NO_PAD_CTRL) 285#define MX51_PAD_DISPB2_SER_DIN__GPIO_3_5 IOMUX_PAD(0x6BC, 0x2BC, 4, 0x988, 1, NO_PAD_CTRL)
244#define MX51_PAD_DISPB2_SER_DIO__GPIO_3_6 IOMUX_PAD(0x6C0, 0x2C0, 4, 0x0, 0, NO_PAD_CTRL) 286#define MX51_PAD_DISPB2_SER_DIO__GPIO_3_6 IOMUX_PAD(0x6C0, 0x2C0, 4, 0x98c, 1, NO_PAD_CTRL)
245#define MX51_PAD_DISPB2_SER_CLK__GPIO_3_7 IOMUX_PAD(0x6C4, 0x2C4, 4, 0x0, 0, NO_PAD_CTRL) 287#define MX51_PAD_DISPB2_SER_CLK__GPIO_3_7 IOMUX_PAD(0x6C4, 0x2C4, 4, 0x990, 1, NO_PAD_CTRL)
246#define MX51_PAD_DISPB2_SER_RS__GPIO_3_8 IOMUX_PAD(0x6C8, 0x2C8, 4, 0x0, 0, NO_PAD_CTRL) 288#define MX51_PAD_DISPB2_SER_RS__GPIO_3_8 IOMUX_PAD(0x6C8, 0x2C8, 4, 0x994, 1, NO_PAD_CTRL)
247#define MX51_PAD_DISP1_DAT0__DISP1_DAT0 IOMUX_PAD(0x6CC, 0x2CC, 0, 0x0, 0, NO_PAD_CTRL) 289#define MX51_PAD_DISP1_DAT0__DISP1_DAT0 IOMUX_PAD(0x6CC, 0x2CC, 0, 0x0, 0, NO_PAD_CTRL)
248#define MX51_PAD_DISP1_DAT1__DISP1_DAT1 IOMUX_PAD(0x6D0, 0x2D0, 0, 0x0, 0, NO_PAD_CTRL) 290#define MX51_PAD_DISP1_DAT1__DISP1_DAT1 IOMUX_PAD(0x6D0, 0x2D0, 0, 0x0, 0, NO_PAD_CTRL)
249#define MX51_PAD_DISP1_DAT2__DISP1_DAT2 IOMUX_PAD(0x6D4, 0x2D4, 0, 0x0, 0, NO_PAD_CTRL) 291#define MX51_PAD_DISP1_DAT2__DISP1_DAT2 IOMUX_PAD(0x6D4, 0x2D4, 0, 0x0, 0, NO_PAD_CTRL)
@@ -294,32 +336,50 @@ typedef enum iomux_config {
294#define MX51_PAD_DISP2_DAT13__DISP2_DAT13 IOMUX_PAD(0x790, 0x388, 0, 0x0, 0, NO_PAD_CTRL) 336#define MX51_PAD_DISP2_DAT13__DISP2_DAT13 IOMUX_PAD(0x790, 0x388, 0, 0x0, 0, NO_PAD_CTRL)
295#define MX51_PAD_DISP2_DAT14__DISP2_DAT14 IOMUX_PAD(0x794, 0x38C, 0, 0x0, 0, NO_PAD_CTRL) 337#define MX51_PAD_DISP2_DAT14__DISP2_DAT14 IOMUX_PAD(0x794, 0x38C, 0, 0x0, 0, NO_PAD_CTRL)
296#define MX51_PAD_DISP2_DAT15__DISP2_DAT15 IOMUX_PAD(0x798, 0x390, 0, 0x0, 0, NO_PAD_CTRL) 338#define MX51_PAD_DISP2_DAT15__DISP2_DAT15 IOMUX_PAD(0x798, 0x390, 0, 0x0, 0, NO_PAD_CTRL)
297#define MX51_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x79C, 0x394, 0, 0x0, 0, NO_PAD_CTRL) 339#define MX51_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x79C, 0x394, IOMUX_CONFIG_SION, 0x0, 0, \
298#define MX51_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x7A0, 0x398, 0, 0x0, 0, NO_PAD_CTRL) 340 MX51_SDHCI_PAD_CTRL)
299#define MX51_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x7A4, 0x39C, 0, 0x0, 0, NO_PAD_CTRL) 341#define MX51_PAD_SD1_CMD__AUD5_RXFS IOMUX_PAD(0x79C, 0x394, 1, 0x8e0, 1, NO_PAD_CTRL)
300#define MX51_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x7A8, 0x3A0, 0, 0x0, 0, NO_PAD_CTRL) 342#define MX51_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x7A0, 0x398, IOMUX_CONFIG_SION, 0x0, 0, \
301#define MX51_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x7AC, 0x3A4, 0, 0x0, 0, NO_PAD_CTRL) 343 MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
302#define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7B0, 0x3A8, 0, 0x0, 0, NO_PAD_CTRL) 344#define MX51_PAD_SD1_CLK__AUD5_RXC IOMUX_PAD(0x7A0, 0x398, 1, 0x8dc, 1, NO_PAD_CTRL)
303#define MX51_PAD_GPIO_1_0__GPIO_1_0 IOMUX_PAD(0x7B4, 0x3AC, 1, 0x0, 0, NO_PAD_CTRL) 345#define MX51_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x7A4, 0x39C, IOMUX_CONFIG_SION, 0x0, 0, \
304#define MX51_PAD_GPIO_1_1__GPIO_1_1 IOMUX_PAD(0x7B8, 0x3B0, 1, 0x0, 0, NO_PAD_CTRL) 346 MX51_SDHCI_PAD_CTRL)
305#define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7BC, 0x3B4, 0, 0x0, 0, NO_PAD_CTRL) 347#define MX51_PAD_SD1_DATA0__AUD5_TXD IOMUX_PAD(0x7A4, 0x39C, 1, 0x8d8, 2, NO_PAD_CTRL)
306#define MX51_PAD_SD2_CLK__SD2_CLK IOMUX_PAD(0x7C0, 0x3B8, 0, 0x0, 0, NO_PAD_CTRL) 348#define MX51_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x7A8, 0x3A0, IOMUX_CONFIG_SION, 0x0, 0, \
307#define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7C4, 0x3BC, 0, 0x0, 0, NO_PAD_CTRL) 349 MX51_SDHCI_PAD_CTRL)
308#define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7C8, 0x3C0, 0, 0x0, 0, NO_PAD_CTRL) 350#define MX51_PAD_SD1_DATA1__AUD5_RXD IOMUX_PAD(0x7A8, 0x3A0, 1, 0x8d4, 2, NO_PAD_CTRL)
309#define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7CC, 0x3C4, 0, 0x0, 0, NO_PAD_CTRL) 351#define MX51_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x7AC, 0x3A4, IOMUX_CONFIG_SION, 0x0, 0, \
310#define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7D0, 0x3C8, 0, 0x0, 0, NO_PAD_CTRL) 352 MX51_SDHCI_PAD_CTRL)
311#define MX51_PAD_GPIO_1_2__GPIO_1_2 IOMUX_PAD(0x7D4, 0x3CC, 0, 0x0, 0, NO_PAD_CTRL) 353#define MX51_PAD_SD1_DATA2__AUD5_TXC IOMUX_PAD(0x7AC, 0x3A4, 1, 0x8e4, 2, NO_PAD_CTRL)
354#define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7B0, 0x3A8, IOMUX_CONFIG_SION, 0x0, 0, \
355 MX51_SDHCI_PAD_CTRL)
356#define MX51_PAD_SD1_DATA3__AUD5_TXFS IOMUX_PAD(0x7B0, 0x3A8, 1, 0x8e8, 2, NO_PAD_CTRL)
357#define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7BC, 0x3B4, IOMUX_CONFIG_SION, 0x0, 1, \
358 MX51_SDHCI_PAD_CTRL)
359#define MX51_PAD_SD2_CLK__SD2_CLK IOMUX_PAD(0x7C0, 0x3B8, IOMUX_CONFIG_SION, 0x0, 0, \
360 MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
361#define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7C4, 0x3BC, IOMUX_CONFIG_SION, 0x0, 0, \
362 MX51_SDHCI_PAD_CTRL)
363#define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7C8, 0x3C0, IOMUX_CONFIG_SION, 0x0, 0, \
364 MX51_SDHCI_PAD_CTRL)
365#define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7CC, 0x3C4, IOMUX_CONFIG_SION, 0x0, 0, \
366 MX51_SDHCI_PAD_CTRL)
367#define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7D0, 0x3C8, IOMUX_CONFIG_SION, 0x0, 0, \
368 MX51_SDHCI_PAD_CTRL)
369#define MX51_PAD_GPIO_1_0__GPIO_1_0 IOMUX_PAD(0x7B4, 0x3AC, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
370#define MX51_PAD_GPIO_1_1__GPIO_1_1 IOMUX_PAD(0x7B8, 0x3B0, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
371#define MX51_PAD_GPIO_1_2__GPIO_1_2 IOMUX_PAD(0x7D4, 0x3CC, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
312#define MX51_PAD_GPIO_1_2__I2C2_SCL IOMUX_PAD(0x7D4, 0x3CC, (2 | IOMUX_CONFIG_SION), \ 372#define MX51_PAD_GPIO_1_2__I2C2_SCL IOMUX_PAD(0x7D4, 0x3CC, (2 | IOMUX_CONFIG_SION), \
313 0x9b8, 3, MX51_I2C_PAD_CTRL) 373 0x9b8, 3, MX51_I2C_PAD_CTRL)
314#define MX51_PAD_GPIO_1_3__GPIO_1_3 IOMUX_PAD(0x7D8, 0x3D0, 0, 0x0, 0, NO_PAD_CTRL) 374#define MX51_PAD_GPIO_1_3__GPIO_1_3 IOMUX_PAD(0x7D8, 0x3D0, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
315#define MX51_PAD_GPIO_1_3__I2C2_SDA IOMUX_PAD(0x7D8, 0x3D0, (2 | IOMUX_CONFIG_SION), \ 375#define MX51_PAD_GPIO_1_3__I2C2_SDA IOMUX_PAD(0x7D8, 0x3D0, (2 | IOMUX_CONFIG_SION), \
316 0x9bc, 3, MX51_I2C_PAD_CTRL) 376 0x9bc, 3, MX51_I2C_PAD_CTRL)
317#define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ IOMUX_PAD(0x7FC, 0x3D4, 0, 0x0, 0, NO_PAD_CTRL) 377#define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ IOMUX_PAD(0x7FC, 0x3D4, 0, 0x0, 0, NO_PAD_CTRL)
318#define MX51_PAD_GPIO_1_4__GPIO_1_4 IOMUX_PAD(0x804, 0x3D8, 0, 0x0, 0, NO_PAD_CTRL) 378#define MX51_PAD_GPIO_1_4__GPIO_1_4 IOMUX_PAD(0x804, 0x3D8, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
319#define MX51_PAD_GPIO_1_5__GPIO_1_5 IOMUX_PAD(0x808, 0x3DC, 0, 0x0, 0, NO_PAD_CTRL) 379#define MX51_PAD_GPIO_1_5__GPIO_1_5 IOMUX_PAD(0x808, 0x3DC, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
320#define MX51_PAD_GPIO_1_6__GPIO_1_6 IOMUX_PAD(0x80C, 0x3E0, 0, 0x0, 0, MX51_GPIO_PAD_CTRL) 380#define MX51_PAD_GPIO_1_6__GPIO_1_6 IOMUX_PAD(0x80C, 0x3E0, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
321#define MX51_PAD_GPIO_1_7__GPIO_1_7 IOMUX_PAD(0x810, 0x3E4, 0, 0x0, 0, MX51_GPIO_PAD_CTRL) 381#define MX51_PAD_GPIO_1_7__GPIO_1_7 IOMUX_PAD(0x810, 0x3E4, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
322#define MX51_PAD_GPIO_1_8__GPIO_1_8 IOMUX_PAD(0x814, 0x3E8, 0, 0x0, 1, MX51_GPIO_PAD_CTRL) 382#define MX51_PAD_GPIO_1_8__GPIO_1_8 IOMUX_PAD(0x814, 0x3E8, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
323#define MX51_PAD_GPIO_1_9__GPIO_1_9 IOMUX_PAD(0x818, 0x3EC, 0, 0x0, 0, NO_PAD_CTRL) 383#define MX51_PAD_GPIO_1_9__GPIO_1_9 IOMUX_PAD(0x818, 0x3EC, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
324 384
325#endif /* __MACH_IOMUX_MX51_H__ */ 385#endif /* __MACH_IOMUX_MX51_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/iram.h b/arch/arm/plat-mxc/include/mach/iram.h
new file mode 100644
index 000000000000..022690c33702
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/iram.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
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 *
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#include <linux/errno.h>
20
21#ifdef CONFIG_IRAM_ALLOC
22
23int __init iram_init(unsigned long base, unsigned long size);
24void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr);
25void iram_free(unsigned long dma_addr, unsigned int size);
26
27#else
28
29static inline int __init iram_init(unsigned long base, unsigned long size)
30{
31 return -ENOMEM;
32}
33
34static inline void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr)
35{
36 return NULL;
37}
38
39static inline void iram_free(unsigned long base, unsigned long size) {}
40
41#endif
diff --git a/arch/arm/plat-mxc/include/mach/mx21.h b/arch/arm/plat-mxc/include/mach/mx21.h
index ed98b9c9f389..8bc59720b6e4 100644
--- a/arch/arm/plat-mxc/include/mach/mx21.h
+++ b/arch/arm/plat-mxc/include/mach/mx21.h
@@ -120,7 +120,7 @@
120#define MX21_INT_GPT1 26 120#define MX21_INT_GPT1 26
121#define MX21_INT_WDOG 27 121#define MX21_INT_WDOG 27
122#define MX21_INT_PCMCIA 28 122#define MX21_INT_PCMCIA 28
123#define MX21_INT_NANDFC 29 123#define MX21_INT_NFC 29
124#define MX21_INT_BMI 30 124#define MX21_INT_BMI 30
125#define MX21_INT_CSI 31 125#define MX21_INT_CSI 31
126#define MX21_INT_DMACH0 32 126#define MX21_INT_DMACH0 32
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h
index 4a6f800990f8..cf46a45b0d4e 100644
--- a/arch/arm/plat-mxc/include/mach/mx25.h
+++ b/arch/arm/plat-mxc/include/mach/mx25.h
@@ -50,8 +50,11 @@
50#define MX25_SSI1_BASE_ADDR 0x50034000 50#define MX25_SSI1_BASE_ADDR 0x50034000
51#define MX25_NFC_BASE_ADDR 0xbb000000 51#define MX25_NFC_BASE_ADDR 0xbb000000
52#define MX25_DRYICE_BASE_ADDR 0x53ffc000 52#define MX25_DRYICE_BASE_ADDR 0x53ffc000
53#define MX25_ESDHC1_BASE_ADDR 0x53fb4000
54#define MX25_ESDHC2_BASE_ADDR 0x53fb8000
53#define MX25_LCDC_BASE_ADDR 0x53fbc000 55#define MX25_LCDC_BASE_ADDR 0x53fbc000
54#define MX25_KPP_BASE_ADDR 0x43fa8000 56#define MX25_KPP_BASE_ADDR 0x43fa8000
57#define MX25_SDMA_BASE_ADDR 0x53fd4000
55#define MX25_OTG_BASE_ADDR 0x53ff4000 58#define MX25_OTG_BASE_ADDR 0x53ff4000
56#define MX25_CSI_BASE_ADDR 0x53ff8000 59#define MX25_CSI_BASE_ADDR 0x53ff8000
57 60
@@ -59,6 +62,8 @@
59#define MX25_INT_I2C1 3 62#define MX25_INT_I2C1 3
60#define MX25_INT_I2C2 4 63#define MX25_INT_I2C2 4
61#define MX25_INT_UART4 5 64#define MX25_INT_UART4 5
65#define MX25_INT_ESDHC2 8
66#define MX25_INT_ESDHC1 9
62#define MX25_INT_I2C3 10 67#define MX25_INT_I2C3 10
63#define MX25_INT_SSI2 11 68#define MX25_INT_SSI2 11
64#define MX25_INT_SSI1 12 69#define MX25_INT_SSI1 12
@@ -69,7 +74,8 @@
69#define MX25_INT_KPP 24 74#define MX25_INT_KPP 24
70#define MX25_INT_DRYICE 25 75#define MX25_INT_DRYICE 25
71#define MX25_INT_UART2 32 76#define MX25_INT_UART2 32
72#define MX25_INT_NANDFC 33 77#define MX25_INT_NFC 33
78#define MX25_INT_SDMA 34
73#define MX25_INT_LCDC 39 79#define MX25_INT_LCDC 39
74#define MX25_INT_UART5 40 80#define MX25_INT_UART5 40
75#define MX25_INT_CAN1 43 81#define MX25_INT_CAN1 43
@@ -77,4 +83,13 @@
77#define MX25_INT_UART1 45 83#define MX25_INT_UART1 45
78#define MX25_INT_FEC 57 84#define MX25_INT_FEC 57
79 85
86#define MX25_DMA_REQ_SSI2_RX1 22
87#define MX25_DMA_REQ_SSI2_TX1 23
88#define MX25_DMA_REQ_SSI2_RX0 24
89#define MX25_DMA_REQ_SSI2_TX0 25
90#define MX25_DMA_REQ_SSI1_RX1 26
91#define MX25_DMA_REQ_SSI1_TX1 27
92#define MX25_DMA_REQ_SSI1_RX0 28
93#define MX25_DMA_REQ_SSI1_TX0 29
94
80#endif /* ifndef __MACH_MX25_H__ */ 95#endif /* ifndef __MACH_MX25_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
index a8ab2e02a8ca..2237ba2e5351 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -167,7 +167,7 @@ static inline void mx27_setup_weimcs(size_t cs,
167#define MX27_INT_GPT1 26 167#define MX27_INT_GPT1 26
168#define MX27_INT_WDOG 27 168#define MX27_INT_WDOG 27
169#define MX27_INT_PCMCIA 28 169#define MX27_INT_PCMCIA 28
170#define MX27_INT_NANDFC 29 170#define MX27_INT_NFC 29
171#define MX27_INT_ATA 30 171#define MX27_INT_ATA 30
172#define MX27_INT_CSI 31 172#define MX27_INT_CSI 31
173#define MX27_INT_DMACH0 32 173#define MX27_INT_DMACH0 32
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index afee3ab9d62e..03e2afabc9fc 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -168,7 +168,7 @@ static inline void mx31_setup_weimcs(size_t cs,
168#define MX31_INT_POWER_FAIL 30 168#define MX31_INT_POWER_FAIL 30
169#define MX31_INT_CCM_DVFS 31 169#define MX31_INT_CCM_DVFS 31
170#define MX31_INT_UART2 32 170#define MX31_INT_UART2 32
171#define MX31_INT_NANDFC 33 171#define MX31_INT_NFC 33
172#define MX31_INT_SDMA 34 172#define MX31_INT_SDMA 34
173#define MX31_INT_USB1 35 173#define MX31_INT_USB1 35
174#define MX31_INT_USB2 36 174#define MX31_INT_USB2 36
@@ -197,6 +197,15 @@ static inline void mx31_setup_weimcs(size_t cs,
197#define MX31_INT_EXT_WDOG 62 197#define MX31_INT_EXT_WDOG 62
198#define MX31_INT_EXT_TV 63 198#define MX31_INT_EXT_TV 63
199 199
200#define MX31_DMA_REQ_SSI2_RX1 22
201#define MX31_DMA_REQ_SSI2_TX1 23
202#define MX31_DMA_REQ_SSI2_RX0 24
203#define MX31_DMA_REQ_SSI2_TX0 25
204#define MX31_DMA_REQ_SSI1_RX1 26
205#define MX31_DMA_REQ_SSI1_TX1 27
206#define MX31_DMA_REQ_SSI1_RX0 28
207#define MX31_DMA_REQ_SSI1_TX0 29
208
200#define MX31_PROD_SIGNATURE 0x1 /* For MX31 */ 209#define MX31_PROD_SIGNATURE 0x1 /* For MX31 */
201 210
202/* silicon revisions specific to i.MX31 */ 211/* silicon revisions specific to i.MX31 */
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h
index af3038c12e39..ff905cb32458 100644
--- a/arch/arm/plat-mxc/include/mach/mx35.h
+++ b/arch/arm/plat-mxc/include/mach/mx35.h
@@ -1,5 +1,6 @@
1#ifndef __MACH_MX35_H__ 1#ifndef __MACH_MX35_H__
2#define __MACH_MX35_H__ 2#define __MACH_MX35_H__
3
3/* 4/*
4 * IRAM 5 * IRAM
5 */ 6 */
@@ -52,6 +53,9 @@
52#define MX35_GPIO3_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xa4000) 53#define MX35_GPIO3_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xa4000)
53#define MX35_SCC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xac000) 54#define MX35_SCC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xac000)
54#define MX35_RNGA_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xb0000) 55#define MX35_RNGA_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xb0000)
56#define MX35_ESDHC1_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xb4000)
57#define MX35_ESDHC2_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xb8000)
58#define MX35_ESDHC3_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xbc000)
55#define MX35_IPU_CTRL_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xc0000) 59#define MX35_IPU_CTRL_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xc0000)
56#define MX35_AUDMUX_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xc4000) 60#define MX35_AUDMUX_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xc4000)
57#define MX35_GPIO1_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xcc000) 61#define MX35_GPIO1_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xcc000)
@@ -63,6 +67,8 @@
63#define MX35_CAN1_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe4000) 67#define MX35_CAN1_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe4000)
64#define MX35_CAN2_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe8000) 68#define MX35_CAN2_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe8000)
65#define MX35_RTIC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xec000) 69#define MX35_RTIC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xec000)
70#define MX35_IIM_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xf0000)
71
66#define MX35_OTG_BASE_ADDR 0x53ff4000 72#define MX35_OTG_BASE_ADDR 0x53ff4000
67 73
68#define MX35_ROMP_BASE_ADDR 0x60000000 74#define MX35_ROMP_BASE_ADDR 0x60000000
@@ -122,9 +128,9 @@
122#define MX35_INT_I2C3 3 128#define MX35_INT_I2C3 3
123#define MX35_INT_I2C2 4 129#define MX35_INT_I2C2 4
124#define MX35_INT_RTIC 6 130#define MX35_INT_RTIC 6
125#define MX35_INT_MMC_SDHC1 7 131#define MX35_INT_ESDHC1 7
126#define MX35_INT_MMC_SDHC2 8 132#define MX35_INT_ESDHC2 8
127#define MX35_INT_MMC_SDHC3 9 133#define MX35_INT_ESDHC3 9
128#define MX35_INT_I2C1 10 134#define MX35_INT_I2C1 10
129#define MX35_INT_SSI1 11 135#define MX35_INT_SSI1 11
130#define MX35_INT_SSI2 12 136#define MX35_INT_SSI2 12
@@ -145,7 +151,7 @@
145#define MX35_INT_GPT 29 151#define MX35_INT_GPT 29
146#define MX35_INT_POWER_FAIL 30 152#define MX35_INT_POWER_FAIL 30
147#define MX35_INT_UART2 32 153#define MX35_INT_UART2 32
148#define MX35_INT_NANDFC 33 154#define MX35_INT_NFC 33
149#define MX35_INT_SDMA 34 155#define MX35_INT_SDMA 34
150#define MX35_INT_USBHS 35 156#define MX35_INT_USBHS 35
151#define MX35_INT_USBOTG 37 157#define MX35_INT_USBOTG 37
@@ -173,22 +179,18 @@
173#define MX35_INT_EXT_WDOG 62 179#define MX35_INT_EXT_WDOG 62
174#define MX35_INT_EXT_TV 63 180#define MX35_INT_EXT_TV 63
175 181
182#define MX35_DMA_REQ_SSI2_RX1 22
183#define MX35_DMA_REQ_SSI2_TX1 23
184#define MX35_DMA_REQ_SSI2_RX0 24
185#define MX35_DMA_REQ_SSI2_TX0 25
186#define MX35_DMA_REQ_SSI1_RX1 26
187#define MX35_DMA_REQ_SSI1_TX1 27
188#define MX35_DMA_REQ_SSI1_RX0 28
189#define MX35_DMA_REQ_SSI1_TX0 29
190
176#define MX35_PROD_SIGNATURE 0x1 /* For MX31 */ 191#define MX35_PROD_SIGNATURE 0x1 /* For MX31 */
177 192
178/* silicon revisions specific to i.MX31 */ 193#define MX35_SYSTEM_REV_MIN MX3x_CHIP_REV_1_0
179#define MX35_CHIP_REV_1_0 0x10
180#define MX35_CHIP_REV_1_1 0x11
181#define MX35_CHIP_REV_1_2 0x12
182#define MX35_CHIP_REV_1_3 0x13
183#define MX35_CHIP_REV_2_0 0x20
184#define MX35_CHIP_REV_2_1 0x21
185#define MX35_CHIP_REV_2_2 0x22
186#define MX35_CHIP_REV_2_3 0x23
187#define MX35_CHIP_REV_3_0 0x30
188#define MX35_CHIP_REV_3_1 0x31
189#define MX35_CHIP_REV_3_2 0x32
190
191#define MX35_SYSTEM_REV_MIN MX35_CHIP_REV_1_0
192#define MX35_SYSTEM_REV_NUM 3 194#define MX35_SYSTEM_REV_NUM 3
193 195
194#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS 196#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
diff --git a/arch/arm/plat-mxc/include/mach/mx3x.h b/arch/arm/plat-mxc/include/mach/mx3x.h
index 7a356de385f5..d1bd26d7b8a6 100644
--- a/arch/arm/plat-mxc/include/mach/mx3x.h
+++ b/arch/arm/plat-mxc/include/mach/mx3x.h
@@ -240,7 +240,7 @@
240 240
241#define MX3x_PROD_SIGNATURE 0x1 /* For MX31 */ 241#define MX3x_PROD_SIGNATURE 0x1 /* For MX31 */
242 242
243/* silicon revisions specific to i.MX31 */ 243/* silicon revisions specific to i.MX31 and i.MX35 */
244#define MX3x_CHIP_REV_1_0 0x10 244#define MX3x_CHIP_REV_1_0 0x10
245#define MX3x_CHIP_REV_1_1 0x11 245#define MX3x_CHIP_REV_1_1 0x11
246#define MX3x_CHIP_REV_1_2 0x12 246#define MX3x_CHIP_REV_1_2 0x12
@@ -267,6 +267,14 @@ static inline int mx31_revision(void)
267{ 267{
268 return mx31_cpu_rev; 268 return mx31_cpu_rev;
269} 269}
270
271extern unsigned int mx35_cpu_rev;
272extern void mx35_read_cpu_rev(void);
273
274static inline int mx35_revision(void)
275{
276 return mx35_cpu_rev;
277}
270#endif 278#endif
271 279
272#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS 280#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
@@ -389,19 +397,6 @@ static inline int mx31_revision(void)
389#define MXC_INT_EXT_WDOG MX3x_INT_EXT_WDOG 397#define MXC_INT_EXT_WDOG MX3x_INT_EXT_WDOG
390#define MXC_INT_EXT_TV MX3x_INT_EXT_TV 398#define MXC_INT_EXT_TV MX3x_INT_EXT_TV
391#define PROD_SIGNATURE MX3x_PROD_SIGNATURE 399#define PROD_SIGNATURE MX3x_PROD_SIGNATURE
392#define CHIP_REV_1_0 MX3x_CHIP_REV_1_0
393#define CHIP_REV_1_1 MX3x_CHIP_REV_1_1
394#define CHIP_REV_1_2 MX3x_CHIP_REV_1_2
395#define CHIP_REV_1_3 MX3x_CHIP_REV_1_3
396#define CHIP_REV_2_0 MX3x_CHIP_REV_2_0
397#define CHIP_REV_2_1 MX3x_CHIP_REV_2_1
398#define CHIP_REV_2_2 MX3x_CHIP_REV_2_2
399#define CHIP_REV_2_3 MX3x_CHIP_REV_2_3
400#define CHIP_REV_3_0 MX3x_CHIP_REV_3_0
401#define CHIP_REV_3_1 MX3x_CHIP_REV_3_1
402#define CHIP_REV_3_2 MX3x_CHIP_REV_3_2
403#define SYSTEM_REV_MIN MX3x_SYSTEM_REV_MIN
404#define SYSTEM_REV_NUM MX3x_SYSTEM_REV_NUM
405#endif 400#endif
406 401
407#endif /* ifndef __MACH_MX3x_H__ */ 402#endif /* ifndef __MACH_MX3x_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/plat-mxc/include/mach/mx51.h
index 5aad344d5651..2af7a1056fc1 100644
--- a/arch/arm/plat-mxc/include/mach/mx51.h
+++ b/arch/arm/plat-mxc/include/mach/mx51.h
@@ -1,5 +1,5 @@
1#ifndef __ASM_ARCH_MXC_MX51_H__ 1#ifndef __MACH_MX51_H__
2#define __ASM_ARCH_MXC_MX51_H__ 2#define __MACH_MX51_H__
3 3
4/* 4/*
5 * MX51 memory map: 5 * MX51 memory map:
@@ -7,24 +7,23 @@
7 * 7 *
8 * Virt Phys Size What 8 * Virt Phys Size What
9 * --------------------------------------------------------------------------- 9 * ---------------------------------------------------------------------------
10 * FA3E0000 1FFE0000 128K IRAM (SCCv2 RAM) 10 * fa3e0000 1ffe0000 128K IRAM (SCCv2 RAM)
11 * 30000000 256M GPU 11 * 30000000 256M GPU
12 * 40000000 512M IPU 12 * 40000000 512M IPU
13 * FA200000 60000000 1M DEBUG 13 * fa200000 60000000 1M DEBUG
14 * FB100000 70000000 1M SPBA 0 14 * fb100000 70000000 1M SPBA 0
15 * FB000000 73F00000 1M AIPS 1 15 * fb000000 73f00000 1M AIPS 1
16 * FB200000 83F00000 1M AIPS 2 16 * fb200000 83f00000 1M AIPS 2
17 * 8FFFC000 16K TZIC (interrupt controller) 17 * 8fffc000 16K TZIC (interrupt controller)
18 * 90000000 256M CSD0 SDRAM/DDR 18 * 90000000 256M CSD0 SDRAM/DDR
19 * A0000000 256M CSD1 SDRAM/DDR 19 * a0000000 256M CSD1 SDRAM/DDR
20 * B0000000 128M CS0 Flash 20 * b0000000 128M CS0 Flash
21 * B8000000 128M CS1 Flash 21 * b8000000 128M CS1 Flash
22 * C0000000 128M CS2 Flash 22 * c0000000 128M CS2 Flash
23 * C8000000 64M CS3 Flash 23 * c8000000 64M CS3 Flash
24 * CC000000 32M CS4 SRAM 24 * cc000000 32M CS4 SRAM
25 * CE000000 32M CS5 SRAM 25 * ce000000 32M CS5 SRAM
26 * CFFF0000 64K NFC (NAND Flash AXI) 26 * cfff0000 64K NFC (NAND Flash AXI)
27 *
28 */ 27 */
29 28
30/* 29/*
@@ -36,65 +35,151 @@
36/* 35/*
37 * IRAM 36 * IRAM
38 */ 37 */
39#define MX51_IRAM_BASE_ADDR 0x1FFE0000 /* internal ram */ 38#define MX51_IRAM_BASE_ADDR 0x1ffe0000 /* internal ram */
40#define MX51_IRAM_BASE_ADDR_VIRT 0xFA3E0000 39#define MX51_IRAM_BASE_ADDR_VIRT 0xfa3e0000
41#define MX51_IRAM_PARTITIONS 16 40#define MX51_IRAM_PARTITIONS 16
42#define MX51_IRAM_PARTITIONS_TO1 12
43#define MX51_IRAM_SIZE (MX51_IRAM_PARTITIONS * SZ_8K) /* 128KB */ 41#define MX51_IRAM_SIZE (MX51_IRAM_PARTITIONS * SZ_8K) /* 128KB */
44 42
43#define MX51_GPU_BASE_ADDR 0x20000000
44#define MX51_GPU_CTRL_BASE_ADDR 0x30000000
45#define MX51_IPU_CTRL_BASE_ADDR 0x40000000
46
47#define MX51_DEBUG_BASE_ADDR 0x60000000
48#define MX51_DEBUG_BASE_ADDR_VIRT 0xfa200000
49#define MX51_DEBUG_SIZE SZ_1M
50
51#define MX51_ETB_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x01000)
52#define MX51_ETM_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x02000)
53#define MX51_TPIU_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x03000)
54#define MX51_CTI0_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x04000)
55#define MX51_CTI1_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x05000)
56#define MX51_CTI2_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x06000)
57#define MX51_CTI3_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x07000)
58#define MX51_CORTEX_DBG_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x08000)
59
45/* 60/*
46 * NFC 61 * SPBA global module enabled #0
47 */ 62 */
48#define MX51_NFC_AXI_BASE_ADDR 0xCFFF0000 /* NAND flash AXI */ 63#define MX51_SPBA0_BASE_ADDR 0x70000000
49#define MX51_NFC_AXI_SIZE SZ_64K 64#define MX51_SPBA0_BASE_ADDR_VIRT 0xfb100000
65#define MX51_SPBA0_SIZE SZ_1M
66
67#define MX51_ESDHC1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x04000)
68#define MX51_ESDHC2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x08000)
69#define MX51_UART3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x0c000)
70#define MX51_ECSPI1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x10000)
71#define MX51_SSI2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x14000)
72#define MX51_ESDHC3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x20000)
73#define MX51_ESDHC4_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x24000)
74#define MX51_SPDIF_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x28000)
75#define MX51_ATA_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x30000)
76#define MX51_SLIM_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x34000)
77#define MX51_HSI2C_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x38000)
78#define MX51_SPBA_CTRL_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x3c000)
50 79
51/* 80/*
52 * Graphics Memory of GPU 81 * AIPS 1
53 */ 82 */
54#define MX51_GPU_BASE_ADDR 0x20000000 83#define MX51_AIPS1_BASE_ADDR 0x73f00000
55#define MX51_GPU2D_BASE_ADDR 0xD0000000 84#define MX51_AIPS1_BASE_ADDR_VIRT 0xfb000000
85#define MX51_AIPS1_SIZE SZ_1M
86
87#define MX51_OTG_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x80000)
88#define MX51_GPIO1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x84000)
89#define MX51_GPIO2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x88000)
90#define MX51_GPIO3_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x8c000)
91#define MX51_GPIO4_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x90000)
92#define MX51_KPP_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x94000)
93#define MX51_WDOG_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x98000)
94#define MX51_WDOG2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x9c000)
95#define MX51_GPT1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xa0000)
96#define MX51_SRTC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xa4000)
97#define MX51_IOMUXC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xa8000)
98#define MX51_EPIT1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xac000)
99#define MX51_EPIT2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xb0000)
100#define MX51_PWM1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xb4000)
101#define MX51_PWM2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xb8000)
102#define MX51_UART1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xbc000)
103#define MX51_UART2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xc0000)
104#define MX51_SRC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xd0000)
105#define MX51_CCM_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xd4000)
106#define MX51_GPC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xd8000)
56 107
57#define MX51_TZIC_BASE_ADDR_TO1 0x8FFFC000 108/*
58#define MX51_TZIC_BASE_ADDR 0xE0000000 109 * AIPS 2
110 */
111#define MX51_AIPS2_BASE_ADDR 0x83f00000
112#define MX51_AIPS2_BASE_ADDR_VIRT 0xfb200000
113#define MX51_AIPS2_SIZE SZ_1M
59 114
60#define MX51_DEBUG_BASE_ADDR 0x60000000 115#define MX51_PLL1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x80000)
61#define MX51_DEBUG_BASE_ADDR_VIRT 0xFA200000 116#define MX51_PLL2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x84000)
62#define MX51_DEBUG_SIZE SZ_1M 117#define MX51_PLL3_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x88000)
63#define MX51_ETB_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x00001000) 118#define MX51_AHBMAX_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x94000)
64#define MX51_ETM_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x00002000) 119#define MX51_IIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x98000)
65#define MX51_TPIU_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x00003000) 120#define MX51_CSU_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x9c000)
66#define MX51_CTI0_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x00004000) 121#define MX51_ARM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xa0000)
67#define MX51_CTI1_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x00005000) 122#define MX51_OWIRE_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xa4000)
68#define MX51_CTI2_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x00006000) 123#define MX51_FIRI_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xa8000)
69#define MX51_CTI3_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x00007000) 124#define MX51_ECSPI2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xac000)
70#define MX51_CORTEX_DBG_BASE_ADDR (MX51_DEBUG_BASE_ADDR + 0x00008000) 125#define MX51_SDMA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xb0000)
126#define MX51_SCC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xb4000)
127#define MX51_ROMCP_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xb8000)
128#define MX51_RTIC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xbc000)
129#define MX51_CSPI_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xc0000)
130#define MX51_I2C2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xc4000)
131#define MX51_I2C1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xc8000)
132#define MX51_SSI1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xcc000)
133#define MX51_AUDMUX_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xd0000)
134#define MX51_M4IF_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xd8000)
135#define MX51_ESDCTL_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xd9000)
136#define MX51_WEIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xda000)
137#define MX51_NFC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xdb000)
138#define MX51_EMI_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xdbf00)
139#define MX51_MIPI_HSC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xdc000)
140#define MX51_ATA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe0000)
141#define MX51_SIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe4000)
142#define MX51_SSI3BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe8000)
143#define MX51_FEC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xec000)
144#define MX51_TVE_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf0000)
145#define MX51_VPU_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf4000)
146#define MX51_SAHARA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf8000)
147
148#define MX51_CSD0_BASE_ADDR 0x90000000
149#define MX51_CSD1_BASE_ADDR 0xa0000000
150#define MX51_CS0_BASE_ADDR 0xb0000000
151#define MX51_CS1_BASE_ADDR 0xb8000000
152#define MX51_CS2_BASE_ADDR 0xc0000000
153#define MX51_CS3_BASE_ADDR 0xc8000000
154#define MX51_CS4_BASE_ADDR 0xcc000000
155#define MX51_CS5_BASE_ADDR 0xce000000
71 156
72/* 157/*
73 * SPBA global module enabled #0 158 * NFC
74 */ 159 */
75#define MX51_SPBA0_BASE_ADDR 0x70000000 160#define MX51_NFC_AXI_BASE_ADDR 0xcfff0000 /* NAND flash AXI */
76#define MX51_SPBA0_BASE_ADDR_VIRT 0xFB100000 161#define MX51_NFC_AXI_SIZE SZ_64K
77#define MX51_SPBA0_SIZE SZ_1M 162
163#define MX51_GPU2D_BASE_ADDR 0xd0000000
164#define MX51_TZIC_BASE_ADDR 0xe0000000
78 165
79#define MX51_MMC_SDHC1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00004000) 166#define MX51_IO_ADDRESS(x) ( \
80#define MX51_MMC_SDHC2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00008000) 167 IMX_IO_ADDRESS(x, MX51_IRAM) ?: \
81#define MX51_UART3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x0000C000) 168 IMX_IO_ADDRESS(x, MX51_DEBUG) ?: \
82#define MX51_CSPI1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00010000) 169 IMX_IO_ADDRESS(x, MX51_SPBA0) ?: \
83#define MX51_SSI2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00014000) 170 IMX_IO_ADDRESS(x, MX51_AIPS1) ?: \
84#define MX51_MMC_SDHC3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00020000) 171 IMX_IO_ADDRESS(x, MX51_AIPS2))
85#define MX51_MMC_SDHC4_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00024000) 172
86#define MX51_SPDIF_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00028000) 173/* This is currently used in <mach/debug-macro.S>, but should go away */
87#define MX51_ATA_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00030000) 174#define MX51_AIPS1_IO_ADDRESS(x) \
88#define MX51_SLIM_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00034000) 175 (((x) - MX51_AIPS1_BASE_ADDR) + MX51_AIPS1_BASE_ADDR_VIRT)
89#define MX51_HSI2C_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x00038000)
90#define MX51_SPBA_CTRL_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x0003C000)
91 176
92/* 177/*
93 * defines for SPBA modules 178 * defines for SPBA modules
94 */ 179 */
95#define MX51_SPBA_SDHC1 0x04 180#define MX51_SPBA_SDHC1 0x04
96#define MX51_SPBA_SDHC2 0x08 181#define MX51_SPBA_SDHC2 0x08
97#define MX51_SPBA_UART3 0x0C 182#define MX51_SPBA_UART3 0x0c
98#define MX51_SPBA_CSPI1 0x10 183#define MX51_SPBA_CSPI1 0x10
99#define MX51_SPBA_SSI2 0x14 184#define MX51_SPBA_SSI2 0x14
100#define MX51_SPBA_SDHC3 0x20 185#define MX51_SPBA_SDHC3 0x20
@@ -103,35 +188,7 @@
103#define MX51_SPBA_ATA 0x30 188#define MX51_SPBA_ATA 0x30
104#define MX51_SPBA_SLIM 0x34 189#define MX51_SPBA_SLIM 0x34
105#define MX51_SPBA_HSI2C 0x38 190#define MX51_SPBA_HSI2C 0x38
106#define MX51_SPBA_CTRL 0x3C 191#define MX51_SPBA_CTRL 0x3c
107
108/*
109 * AIPS 1
110 */
111#define MX51_AIPS1_BASE_ADDR 0x73F00000
112#define MX51_AIPS1_BASE_ADDR_VIRT 0xFB000000
113#define MX51_AIPS1_SIZE SZ_1M
114
115#define MX51_OTG_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x00080000)
116#define MX51_GPIO1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x00084000)
117#define MX51_GPIO2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x00088000)
118#define MX51_GPIO3_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x0008C000)
119#define MX51_GPIO4_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x00090000)
120#define MX51_KPP_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x00094000)
121#define MX51_WDOG_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x00098000)
122#define MX51_WDOG2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x0009C000)
123#define MX51_GPT1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000A0000)
124#define MX51_SRTC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000A4000)
125#define MX51_IOMUXC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000A8000)
126#define MX51_EPIT1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000AC000)
127#define MX51_EPIT2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000B0000)
128#define MX51_PWM1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000B4000)
129#define MX51_PWM2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000B8000)
130#define MX51_UART1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000BC000)
131#define MX51_UART2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000C0000)
132#define MX51_SRC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000D0000)
133#define MX51_CCM_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000D4000)
134#define MX51_GPC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x000D8000)
135 192
136/* 193/*
137 * Defines for modules using static and dynamic DMA channels 194 * Defines for modules using static and dynamic DMA channels
@@ -164,282 +221,186 @@
164#define MX51_MXC_DMA_CHANNEL_ATA_TX MXC_DMA_DYNAMIC_CHANNEL 221#define MX51_MXC_DMA_CHANNEL_ATA_TX MXC_DMA_DYNAMIC_CHANNEL
165#define MX51_MXC_DMA_CHANNEL_MEMORY MXC_DMA_DYNAMIC_CHANNEL 222#define MX51_MXC_DMA_CHANNEL_MEMORY MXC_DMA_DYNAMIC_CHANNEL
166 223
167/*
168 * AIPS 2
169 */
170#define MX51_AIPS2_BASE_ADDR 0x83F00000
171#define MX51_AIPS2_BASE_ADDR_VIRT 0xFB200000
172#define MX51_AIPS2_SIZE SZ_1M
173
174#define MX51_PLL1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x00080000)
175#define MX51_PLL2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x00084000)
176#define MX51_PLL3_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x00088000)
177#define MX51_AHBMAX_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x00094000)
178#define MX51_IIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x00098000)
179#define MX51_CSU_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x0009C000)
180#define MX51_ARM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000A0000)
181#define MX51_OWIRE_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000A4000)
182#define MX51_FIRI_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000A8000)
183#define MX51_CSPI2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000AC000)
184#define MX51_SDMA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000B0000)
185#define MX51_SCC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000B4000)
186#define MX51_ROMCP_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000B8000)
187#define MX51_RTIC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000BC000)
188#define MX51_CSPI3_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000C0000)
189#define MX51_I2C2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000C4000)
190#define MX51_I2C1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000C8000)
191#define MX51_SSI1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000CC000)
192#define MX51_AUDMUX_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000D0000)
193#define MX51_M4IF_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000D8000)
194#define MX51_ESDCTL_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000D9000)
195#define MX51_WEIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000DA000)
196#define MX51_NFC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000DB000)
197#define MX51_EMI_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000DBF00)
198#define MX51_MIPI_HSC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000DC000)
199#define MX51_ATA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000E0000)
200#define MX51_SIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000E4000)
201#define MX51_SSI3BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000E8000)
202#define MX51_MXC_FEC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000EC000)
203#define MX51_TVE_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000F0000)
204#define MX51_VPU_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000F4000)
205#define MX51_SAHARA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x000F8000)
206
207/*
208 * Memory regions and CS
209 */
210#define MX51_GPU_CTRL_BASE_ADDR 0x30000000
211#define MX51_IPU_CTRL_BASE_ADDR 0x40000000
212#define MX51_CSD0_BASE_ADDR 0x90000000
213#define MX51_CSD1_BASE_ADDR 0xA0000000
214#define MX51_CS0_BASE_ADDR 0xB0000000
215#define MX51_CS1_BASE_ADDR 0xB8000000
216#define MX51_CS2_BASE_ADDR 0xC0000000
217#define MX51_CS3_BASE_ADDR 0xC8000000
218#define MX51_CS4_BASE_ADDR 0xCC000000
219#define MX51_CS5_BASE_ADDR 0xCE000000
220
221/* Does given address belongs to the specified memory region? */
222#define ADDRESS_IN_REGION(addr, start, size) \
223 (((addr) >= (start)) && ((addr) < (start)+(size)))
224
225/* Does given address belongs to the specified named `module'? */
226#define MX51_IS_MODULE(addr, module) \
227 ADDRESS_IN_REGION(addr, MX51_ ## module ## _BASE_ADDR, \
228 MX51_ ## module ## _SIZE)
229/*
230 * This macro defines the physical to virtual address mapping for all the
231 * peripheral modules. It is used by passing in the physical address as x
232 * and returning the virtual address. If the physical address is not mapped,
233 * it returns 0xDEADBEEF
234 */
235
236#define MX51_IO_ADDRESS(x) \
237 (void __iomem *) \
238 (MX51_IS_MODULE(x, IRAM) ? MX51_IRAM_IO_ADDRESS(x) : \
239 MX51_IS_MODULE(x, DEBUG) ? MX51_DEBUG_IO_ADDRESS(x) : \
240 MX51_IS_MODULE(x, SPBA0) ? MX51_SPBA0_IO_ADDRESS(x) : \
241 MX51_IS_MODULE(x, AIPS1) ? MX51_AIPS1_IO_ADDRESS(x) : \
242 MX51_IS_MODULE(x, AIPS2) ? MX51_AIPS2_IO_ADDRESS(x) : \
243 0xDEADBEEF)
244
245/*
246 * define the address mapping macros: in physical address order
247 */
248#define MX51_IRAM_IO_ADDRESS(x) \
249 (((x) - MX51_IRAM_BASE_ADDR) + MX51_IRAM_BASE_ADDR_VIRT)
250
251#define MX51_DEBUG_IO_ADDRESS(x) \
252 (((x) - MX51_DEBUG_BASE_ADDR) + MX51_DEBUG_BASE_ADDR_VIRT)
253
254#define MX51_SPBA0_IO_ADDRESS(x) \
255 (((x) - MX51_SPBA0_BASE_ADDR) + MX51_SPBA0_BASE_ADDR_VIRT)
256
257#define MX51_AIPS1_IO_ADDRESS(x) \
258 (((x) - MX51_AIPS1_BASE_ADDR) + MX51_AIPS1_BASE_ADDR_VIRT)
259
260#define MX51_AIPS2_IO_ADDRESS(x) \
261 (((x) - MX51_AIPS2_BASE_ADDR) + MX51_AIPS2_BASE_ADDR_VIRT)
262
263#define MX51_IS_MEM_DEVICE_NONSHARED(x) 0 224#define MX51_IS_MEM_DEVICE_NONSHARED(x) 0
264 225
265/* 226/*
266 * DMA request assignments 227 * DMA request assignments
267 */ 228 */
268#define MX51_DMA_REQ_SSI3_TX1 47 229#define MX51_DMA_REQ_VPU 0
269#define MX51_DMA_REQ_SSI3_RX1 46 230#define MX51_DMA_REQ_GPC 1
270#define MX51_DMA_REQ_SPDIF 45 231#define MX51_DMA_REQ_ATA_RX 2
271#define MX51_DMA_REQ_UART3_TX 44 232#define MX51_DMA_REQ_ATA_TX 3
272#define MX51_DMA_REQ_UART3_RX 43 233#define MX51_DMA_REQ_ATA_TX_END 4
273#define MX51_DMA_REQ_SLIM_B_TX 42 234#define MX51_DMA_REQ_SLIM_B 5
274#define MX51_DMA_REQ_SDHC4 41 235#define MX51_DMA_REQ_CSPI1_RX 6
275#define MX51_DMA_REQ_SDHC3 40 236#define MX51_DMA_REQ_CSPI1_TX 7
276#define MX51_DMA_REQ_CSPI_TX 39 237#define MX51_DMA_REQ_CSPI2_RX 8
277#define MX51_DMA_REQ_CSPI_RX 38 238#define MX51_DMA_REQ_CSPI2_TX 9
278#define MX51_DMA_REQ_SSI3_TX2 37 239#define MX51_DMA_REQ_HS_I2C_TX 10
279#define MX51_DMA_REQ_IPU 36 240#define MX51_DMA_REQ_HS_I2C_RX 11
280#define MX51_DMA_REQ_SSI3_RX2 35 241#define MX51_DMA_REQ_FIRI_RX 12
281#define MX51_DMA_REQ_EPIT2 34 242#define MX51_DMA_REQ_FIRI_TX 13
282#define MX51_DMA_REQ_CTI2_1 33 243#define MX51_DMA_REQ_EXTREQ1 14
283#define MX51_DMA_REQ_EMI_WR 32 244#define MX51_DMA_REQ_GPU 15
284#define MX51_DMA_REQ_CTI2_0 31 245#define MX51_DMA_REQ_UART2_RX 16
285#define MX51_DMA_REQ_EMI_RD 30 246#define MX51_DMA_REQ_UART2_TX 17
286#define MX51_DMA_REQ_SSI1_TX1 29 247#define MX51_DMA_REQ_UART1_RX 18
287#define MX51_DMA_REQ_SSI1_RX1 28 248#define MX51_DMA_REQ_UART1_TX 19
288#define MX51_DMA_REQ_SSI1_TX2 27 249#define MX51_DMA_REQ_SDHC1 20
289#define MX51_DMA_REQ_SSI1_RX2 26 250#define MX51_DMA_REQ_SDHC2 21
290#define MX51_DMA_REQ_SSI2_TX1 25 251#define MX51_DMA_REQ_SSI2_RX1 22
291#define MX51_DMA_REQ_SSI2_RX1 24 252#define MX51_DMA_REQ_SSI2_TX1 23
292#define MX51_DMA_REQ_SSI2_TX2 23 253#define MX51_DMA_REQ_SSI2_RX0 24
293#define MX51_DMA_REQ_SSI2_RX2 22 254#define MX51_DMA_REQ_SSI2_TX0 25
294#define MX51_DMA_REQ_SDHC2 21 255#define MX51_DMA_REQ_SSI1_RX1 26
295#define MX51_DMA_REQ_SDHC1 20 256#define MX51_DMA_REQ_SSI1_TX1 27
296#define MX51_DMA_REQ_UART1_TX 19 257#define MX51_DMA_REQ_SSI1_RX0 28
297#define MX51_DMA_REQ_UART1_RX 18 258#define MX51_DMA_REQ_SSI1_TX0 29
298#define MX51_DMA_REQ_UART2_TX 17 259#define MX51_DMA_REQ_EMI_RD 30
299#define MX51_DMA_REQ_UART2_RX 16 260#define MX51_DMA_REQ_CTI2_0 31
300#define MX51_DMA_REQ_GPU 15 261#define MX51_DMA_REQ_EMI_WR 32
301#define MX51_DMA_REQ_EXTREQ1 14 262#define MX51_DMA_REQ_CTI2_1 33
302#define MX51_DMA_REQ_FIRI_TX 13 263#define MX51_DMA_REQ_EPIT2 34
303#define MX51_DMA_REQ_FIRI_RX 12 264#define MX51_DMA_REQ_SSI3_RX2 35
304#define MX51_DMA_REQ_HS_I2C_RX 11 265#define MX51_DMA_REQ_IPU 36
305#define MX51_DMA_REQ_HS_I2C_TX 10 266#define MX51_DMA_REQ_SSI3_TX2 37
306#define MX51_DMA_REQ_CSPI2_TX 9 267#define MX51_DMA_REQ_CSPI_RX 38
307#define MX51_DMA_REQ_CSPI2_RX 8 268#define MX51_DMA_REQ_CSPI_TX 39
308#define MX51_DMA_REQ_CSPI1_TX 7 269#define MX51_DMA_REQ_SDHC3 40
309#define MX51_DMA_REQ_CSPI1_RX 6 270#define MX51_DMA_REQ_SDHC4 41
310#define MX51_DMA_REQ_SLIM_B 5 271#define MX51_DMA_REQ_SLIM_B_TX 42
311#define MX51_DMA_REQ_ATA_TX_END 4 272#define MX51_DMA_REQ_UART3_RX 43
312#define MX51_DMA_REQ_ATA_TX 3 273#define MX51_DMA_REQ_UART3_TX 44
313#define MX51_DMA_REQ_ATA_RX 2 274#define MX51_DMA_REQ_SPDIF 45
314#define MX51_DMA_REQ_GPC 1 275#define MX51_DMA_REQ_SSI3_RX1 46
315#define MX51_DMA_REQ_VPU 0 276#define MX51_DMA_REQ_SSI3_TX1 47
316 277
317/* 278/*
318 * Interrupt numbers 279 * Interrupt numbers
319 */ 280 */
320#define MX51_MXC_INT_BASE 0 281#define MX51_MXC_INT_BASE 0
321#define MX51_MXC_INT_RESV0 0 282#define MX51_MXC_INT_RESV0 0
322#define MX51_MXC_INT_MMC_SDHC1 1 283#define MX51_INT_ESDHC1 1
323#define MX51_MXC_INT_MMC_SDHC2 2 284#define MX51_INT_ESDHC2 2
324#define MX51_MXC_INT_MMC_SDHC3 3 285#define MX51_INT_ESDHC3 3
325#define MX51_MXC_INT_MMC_SDHC4 4 286#define MX51_INT_ESDHC4 4
326#define MX51_MXC_INT_RESV5 5 287#define MX51_MXC_INT_RESV5 5
327#define MX51_MXC_INT_SDMA 6 288#define MX51_INT_SDMA 6
328#define MX51_MXC_INT_IOMUX 7 289#define MX51_MXC_INT_IOMUX 7
329#define MX51_MXC_INT_NFC 8 290#define MX51_INT_NFC 8
330#define MX51_MXC_INT_VPU 9 291#define MX51_MXC_INT_VPU 9
331#define MX51_MXC_INT_IPU_ERR 10 292#define MX51_MXC_INT_IPU_ERR 10
332#define MX51_MXC_INT_IPU_SYN 11 293#define MX51_MXC_INT_IPU_SYN 11
333#define MX51_MXC_INT_GPU 12 294#define MX51_MXC_INT_GPU 12
334#define MX51_MXC_INT_RESV13 13 295#define MX51_MXC_INT_RESV13 13
335#define MX51_MXC_INT_USB_H1 14 296#define MX51_MXC_INT_USB_H1 14
336#define MX51_MXC_INT_EMI 15 297#define MX51_MXC_INT_EMI 15
337#define MX51_MXC_INT_USB_H2 16 298#define MX51_MXC_INT_USB_H2 16
338#define MX51_MXC_INT_USB_H3 17 299#define MX51_MXC_INT_USB_H3 17
339#define MX51_MXC_INT_USB_OTG 18 300#define MX51_MXC_INT_USB_OTG 18
340#define MX51_MXC_INT_SAHARA_H0 19 301#define MX51_MXC_INT_SAHARA_H0 19
341#define MX51_MXC_INT_SAHARA_H1 20 302#define MX51_MXC_INT_SAHARA_H1 20
342#define MX51_MXC_INT_SCC_SMN 21 303#define MX51_MXC_INT_SCC_SMN 21
343#define MX51_MXC_INT_SCC_STZ 22 304#define MX51_MXC_INT_SCC_STZ 22
344#define MX51_MXC_INT_SCC_SCM 23 305#define MX51_MXC_INT_SCC_SCM 23
345#define MX51_MXC_INT_SRTC_NTZ 24 306#define MX51_MXC_INT_SRTC_NTZ 24
346#define MX51_MXC_INT_SRTC_TZ 25 307#define MX51_MXC_INT_SRTC_TZ 25
347#define MX51_MXC_INT_RTIC 26 308#define MX51_MXC_INT_RTIC 26
348#define MX51_MXC_INT_CSU 27 309#define MX51_MXC_INT_CSU 27
349#define MX51_MXC_INT_SLIM_B 28 310#define MX51_MXC_INT_SLIM_B 28
350#define MX51_MXC_INT_SSI1 29 311#define MX51_INT_SSI1 29
351#define MX51_MXC_INT_SSI2 30 312#define MX51_INT_SSI2 30
352#define MX51_MXC_INT_UART1 31 313#define MX51_INT_UART1 31
353#define MX51_MXC_INT_UART2 32 314#define MX51_INT_UART2 32
354#define MX51_MXC_INT_UART3 33 315#define MX51_INT_UART3 33
355#define MX51_MXC_INT_RESV34 34 316#define MX51_MXC_INT_RESV34 34
356#define MX51_MXC_INT_RESV35 35 317#define MX51_MXC_INT_RESV35 35
357#define MX51_MXC_INT_CSPI1 36 318#define MX51_INT_ECSPI1 36
358#define MX51_MXC_INT_CSPI2 37 319#define MX51_INT_ECSPI2 37
359#define MX51_MXC_INT_CSPI 38 320#define MX51_INT_CSPI 38
360#define MX51_MXC_INT_GPT 39 321#define MX51_MXC_INT_GPT 39
361#define MX51_MXC_INT_EPIT1 40 322#define MX51_MXC_INT_EPIT1 40
362#define MX51_MXC_INT_EPIT2 41 323#define MX51_MXC_INT_EPIT2 41
363#define MX51_MXC_INT_GPIO1_INT7 42 324#define MX51_MXC_INT_GPIO1_INT7 42
364#define MX51_MXC_INT_GPIO1_INT6 43 325#define MX51_MXC_INT_GPIO1_INT6 43
365#define MX51_MXC_INT_GPIO1_INT5 44 326#define MX51_MXC_INT_GPIO1_INT5 44
366#define MX51_MXC_INT_GPIO1_INT4 45 327#define MX51_MXC_INT_GPIO1_INT4 45
367#define MX51_MXC_INT_GPIO1_INT3 46 328#define MX51_MXC_INT_GPIO1_INT3 46
368#define MX51_MXC_INT_GPIO1_INT2 47 329#define MX51_MXC_INT_GPIO1_INT2 47
369#define MX51_MXC_INT_GPIO1_INT1 48 330#define MX51_MXC_INT_GPIO1_INT1 48
370#define MX51_MXC_INT_GPIO1_INT0 49 331#define MX51_MXC_INT_GPIO1_INT0 49
371#define MX51_MXC_INT_GPIO1_LOW 50 332#define MX51_MXC_INT_GPIO1_LOW 50
372#define MX51_MXC_INT_GPIO1_HIGH 51 333#define MX51_MXC_INT_GPIO1_HIGH 51
373#define MX51_MXC_INT_GPIO2_LOW 52 334#define MX51_MXC_INT_GPIO2_LOW 52
374#define MX51_MXC_INT_GPIO2_HIGH 53 335#define MX51_MXC_INT_GPIO2_HIGH 53
375#define MX51_MXC_INT_GPIO3_LOW 54 336#define MX51_MXC_INT_GPIO3_LOW 54
376#define MX51_MXC_INT_GPIO3_HIGH 55 337#define MX51_MXC_INT_GPIO3_HIGH 55
377#define MX51_MXC_INT_GPIO4_LOW 56 338#define MX51_MXC_INT_GPIO4_LOW 56
378#define MX51_MXC_INT_GPIO4_HIGH 57 339#define MX51_MXC_INT_GPIO4_HIGH 57
379#define MX51_MXC_INT_WDOG1 58 340#define MX51_MXC_INT_WDOG1 58
380#define MX51_MXC_INT_WDOG2 59 341#define MX51_MXC_INT_WDOG2 59
381#define MX51_MXC_INT_KPP 60 342#define MX51_MXC_INT_KPP 60
382#define MX51_MXC_INT_PWM1 61 343#define MX51_MXC_INT_PWM1 61
383#define MX51_MXC_INT_I2C1 62 344#define MX51_INT_I2C1 62
384#define MX51_MXC_INT_I2C2 63 345#define MX51_INT_I2C2 63
385#define MX51_MXC_INT_HS_I2C 64 346#define MX51_MXC_INT_HS_I2C 64
386#define MX51_MXC_INT_RESV65 65 347#define MX51_MXC_INT_RESV65 65
387#define MX51_MXC_INT_RESV66 66 348#define MX51_MXC_INT_RESV66 66
388#define MX51_MXC_INT_SIM_IPB 67 349#define MX51_MXC_INT_SIM_IPB 67
389#define MX51_MXC_INT_SIM_DAT 68 350#define MX51_MXC_INT_SIM_DAT 68
390#define MX51_MXC_INT_IIM 69 351#define MX51_MXC_INT_IIM 69
391#define MX51_MXC_INT_ATA 70 352#define MX51_MXC_INT_ATA 70
392#define MX51_MXC_INT_CCM1 71 353#define MX51_MXC_INT_CCM1 71
393#define MX51_MXC_INT_CCM2 72 354#define MX51_MXC_INT_CCM2 72
394#define MX51_MXC_INT_GPC1 73 355#define MX51_MXC_INT_GPC1 73
395#define MX51_MXC_INT_GPC2 74 356#define MX51_MXC_INT_GPC2 74
396#define MX51_MXC_INT_SRC 75 357#define MX51_MXC_INT_SRC 75
397#define MX51_MXC_INT_NM 76 358#define MX51_MXC_INT_NM 76
398#define MX51_MXC_INT_PMU 77 359#define MX51_MXC_INT_PMU 77
399#define MX51_MXC_INT_CTI_IRQ 78 360#define MX51_MXC_INT_CTI_IRQ 78
400#define MX51_MXC_INT_CTI1_TG0 79 361#define MX51_MXC_INT_CTI1_TG0 79
401#define MX51_MXC_INT_CTI1_TG1 80 362#define MX51_MXC_INT_CTI1_TG1 80
402#define MX51_MXC_INT_MCG_ERR 81 363#define MX51_MXC_INT_MCG_ERR 81
403#define MX51_MXC_INT_MCG_TMR 82 364#define MX51_MXC_INT_MCG_TMR 82
404#define MX51_MXC_INT_MCG_FUNC 83 365#define MX51_MXC_INT_MCG_FUNC 83
405#define MX51_MXC_INT_GPU2_IRQ 84 366#define MX51_MXC_INT_GPU2_IRQ 84
406#define MX51_MXC_INT_GPU2_BUSY 85 367#define MX51_MXC_INT_GPU2_BUSY 85
407#define MX51_MXC_INT_RESV86 86 368#define MX51_MXC_INT_RESV86 86
408#define MX51_MXC_INT_FEC 87 369#define MX51_INT_FEC 87
409#define MX51_MXC_INT_OWIRE 88 370#define MX51_MXC_INT_OWIRE 88
410#define MX51_MXC_INT_CTI1_TG2 89 371#define MX51_MXC_INT_CTI1_TG2 89
411#define MX51_MXC_INT_SJC 90 372#define MX51_MXC_INT_SJC 90
412#define MX51_MXC_INT_SPDIF 91 373#define MX51_MXC_INT_SPDIF 91
413#define MX51_MXC_INT_TVE 92 374#define MX51_MXC_INT_TVE 92
414#define MX51_MXC_INT_FIRI 93 375#define MX51_MXC_INT_FIRI 93
415#define MX51_MXC_INT_PWM2 94 376#define MX51_MXC_INT_PWM2 94
416#define MX51_MXC_INT_SLIM_EXP 95 377#define MX51_MXC_INT_SLIM_EXP 95
417#define MX51_MXC_INT_SSI3 96 378#define MX51_MXC_INT_SSI3 96
418#define MX51_MXC_INT_EMI_BOOT 97 379#define MX51_MXC_INT_EMI_BOOT 97
419#define MX51_MXC_INT_CTI1_TG3 98 380#define MX51_MXC_INT_CTI1_TG3 98
420#define MX51_MXC_INT_SMC_RX 99 381#define MX51_MXC_INT_SMC_RX 99
421#define MX51_MXC_INT_VPU_IDLE 100 382#define MX51_MXC_INT_VPU_IDLE 100
422#define MX51_MXC_INT_EMI_NFC 101 383#define MX51_MXC_INT_EMI_NFC 101
423#define MX51_MXC_INT_GPU_IDLE 102 384#define MX51_MXC_INT_GPU_IDLE 102
424 385
425/* silicon revisions specific to i.MX51 */ 386/* silicon revisions specific to i.MX51 */
426#define MX51_CHIP_REV_1_0 0x10 387#define MX51_CHIP_REV_1_0 0x10
427#define MX51_CHIP_REV_1_1 0x11 388#define MX51_CHIP_REV_1_1 0x11
428#define MX51_CHIP_REV_1_2 0x12 389#define MX51_CHIP_REV_1_2 0x12
429#define MX51_CHIP_REV_1_3 0x13 390#define MX51_CHIP_REV_1_3 0x13
430#define MX51_CHIP_REV_2_0 0x20 391#define MX51_CHIP_REV_2_0 0x20
431#define MX51_CHIP_REV_2_1 0x21 392#define MX51_CHIP_REV_2_1 0x21
432#define MX51_CHIP_REV_2_2 0x22 393#define MX51_CHIP_REV_2_2 0x22
433#define MX51_CHIP_REV_2_3 0x23 394#define MX51_CHIP_REV_2_3 0x23
434#define MX51_CHIP_REV_3_0 0x30 395#define MX51_CHIP_REV_3_0 0x30
435#define MX51_CHIP_REV_3_1 0x31 396#define MX51_CHIP_REV_3_1 0x31
436#define MX51_CHIP_REV_3_2 0x32 397#define MX51_CHIP_REV_3_2 0x32
437
438/* Mandatory defines used globally */
439 398
440#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS) 399#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
441
442extern int mx51_revision(void); 400extern int mx51_revision(void);
443#endif 401#endif
444 402
445#endif /* __ASM_ARCH_MXC_MX51_H__ */ 403/* tape-out 1 defines */
404#define MX51_TZIC_BASE_ADDR_TO1 0x8fffc000
405
406#endif /* ifndef __MACH_MX51_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h
index 4acd1143a9bd..95be51bfe9a9 100644
--- a/arch/arm/plat-mxc/include/mach/system.h
+++ b/arch/arm/plat-mxc/include/mach/system.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (C) 1999 ARM Limited 2 * Copyright (C) 1999 ARM Limited
3 * Copyright (C) 2000 Deep Blue Solutions Ltd 3 * Copyright (C) 2000 Deep Blue Solutions Ltd
4 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. 4 * Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
@@ -28,8 +28,34 @@ static inline void arch_idle(void)
28 mxc91231_prepare_idle(); 28 mxc91231_prepare_idle();
29 } 29 }
30#endif 30#endif
31 31 /* fix i.MX31 errata TLSbo65953 and i.MX35 errata ENGcm09472 */
32 cpu_do_idle(); 32 if (cpu_is_mx31() || cpu_is_mx35()) {
33 unsigned long reg = 0;
34 __asm__ __volatile__(
35 /* disable I and D cache */
36 "mrc p15, 0, %0, c1, c0, 0\n"
37 "bic %0, %0, #0x00001000\n"
38 "bic %0, %0, #0x00000004\n"
39 "mcr p15, 0, %0, c1, c0, 0\n"
40 /* invalidate I cache */
41 "mov %0, #0\n"
42 "mcr p15, 0, %0, c7, c5, 0\n"
43 /* clear and invalidate D cache */
44 "mov %0, #0\n"
45 "mcr p15, 0, %0, c7, c14, 0\n"
46 /* WFI */
47 "mov %0, #0\n"
48 "mcr p15, 0, %0, c7, c0, 4\n"
49 "nop\n" "nop\n" "nop\n" "nop\n"
50 "nop\n" "nop\n" "nop\n"
51 /* enable I and D cache */
52 "mrc p15, 0, %0, c1, c0, 0\n"
53 "orr %0, %0, #0x00001000\n"
54 "orr %0, %0, #0x00000004\n"
55 "mcr p15, 0, %0, c1, c0, 0\n"
56 : "=r" (reg));
57 } else
58 cpu_do_idle();
33} 59}
34 60
35void arch_reset(char mode, const char *cmd); 61void arch_reset(char mode, const char *cmd);
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
index d9bd37e4667a..9dd9c2085aad 100644
--- a/arch/arm/plat-mxc/include/mach/uncompress.h
+++ b/arch/arm/plat-mxc/include/mach/uncompress.h
@@ -99,6 +99,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)
99 uart_base = MX3X_UART2_BASE_ADDR; 99 uart_base = MX3X_UART2_BASE_ADDR;
100 break; 100 break;
101 case MACH_TYPE_MX51_BABBAGE: 101 case MACH_TYPE_MX51_BABBAGE:
102 case MACH_TYPE_EUKREA_CPUIMX51SD:
102 uart_base = MX51_UART1_BASE_ADDR; 103 uart_base = MX51_UART1_BASE_ADDR;
103 break; 104 break;
104 default: 105 default:
diff --git a/arch/arm/plat-mxc/iram_alloc.c b/arch/arm/plat-mxc/iram_alloc.c
new file mode 100644
index 000000000000..074c3869626a
--- /dev/null
+++ b/arch/arm/plat-mxc/iram_alloc.c
@@ -0,0 +1,73 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
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 *
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/kernel.h>
21#include <linux/io.h>
22#include <linux/module.h>
23#include <linux/spinlock.h>
24#include <linux/genalloc.h>
25#include <mach/iram.h>
26
27static unsigned long iram_phys_base;
28static void __iomem *iram_virt_base;
29static struct gen_pool *iram_pool;
30
31static inline void __iomem *iram_phys_to_virt(unsigned long p)
32{
33 return iram_virt_base + (p - iram_phys_base);
34}
35
36void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr)
37{
38 if (!iram_pool)
39 return NULL;
40
41 *dma_addr = gen_pool_alloc(iram_pool, size);
42 pr_debug("iram alloc - %dB@0x%lX\n", size, *dma_addr);
43 if (!*dma_addr)
44 return NULL;
45 return iram_phys_to_virt(*dma_addr);
46}
47EXPORT_SYMBOL(iram_alloc);
48
49void iram_free(unsigned long addr, unsigned int size)
50{
51 if (!iram_pool)
52 return;
53
54 gen_pool_free(iram_pool, addr, size);
55}
56EXPORT_SYMBOL(iram_free);
57
58int __init iram_init(unsigned long base, unsigned long size)
59{
60 iram_phys_base = base;
61
62 iram_pool = gen_pool_create(PAGE_SHIFT, -1);
63 if (!iram_pool)
64 return -ENOMEM;
65
66 gen_pool_add(iram_pool, base, size, -1);
67 iram_virt_base = ioremap(iram_phys_base, size);
68 if (!iram_virt_base)
69 return -EIO;
70
71 pr_debug("i.MX IRAM pool: %ld KB@0x%p\n", size / 1024, iram_virt_base);
72 return 0;
73}
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index e39a417a368d..a92cb499313f 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -33,7 +33,7 @@ config OMAP_DEBUG_DEVICES
33config OMAP_DEBUG_LEDS 33config OMAP_DEBUG_LEDS
34 bool 34 bool
35 depends on OMAP_DEBUG_DEVICES 35 depends on OMAP_DEBUG_DEVICES
36 default y if LEDS 36 default y if LEDS_CLASS
37 37
38config OMAP_RESET_CLOCKS 38config OMAP_RESET_CLOCKS
39 bool "Reset unused clocks during boot" 39 bool "Reset unused clocks during boot"
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index a202a2ce6e3d..6cd151b31bc5 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -320,6 +320,7 @@ void flush_iotlb_page(struct iommu *obj, u32 da)
320 if ((start <= da) && (da < start + bytes)) { 320 if ((start <= da) && (da < start + bytes)) {
321 dev_dbg(obj->dev, "%s: %08x<=%08x(%x)\n", 321 dev_dbg(obj->dev, "%s: %08x<=%08x(%x)\n",
322 __func__, start, da, bytes); 322 __func__, start, da, bytes);
323 iotlb_load_cr(obj, &cr);
323 iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY); 324 iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY);
324 } 325 }
325 } 326 }
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index e31496e35b0f..0c8612fd8312 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -156,7 +156,7 @@ static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id)
156 /* Writing zero to RSYNC_ERR clears the IRQ */ 156 /* Writing zero to RSYNC_ERR clears the IRQ */
157 MCBSP_WRITE(mcbsp_rx, SPCR1, MCBSP_READ_CACHE(mcbsp_rx, SPCR1)); 157 MCBSP_WRITE(mcbsp_rx, SPCR1, MCBSP_READ_CACHE(mcbsp_rx, SPCR1));
158 } else { 158 } else {
159 complete(&mcbsp_rx->tx_irq_completion); 159 complete(&mcbsp_rx->rx_irq_completion);
160 } 160 }
161 161
162 return IRQ_HANDLED; 162 return IRQ_HANDLED;
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h b/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h
index 7b4eadc6df3a..abcc36eb1242 100644
--- a/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
+++ b/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h
@@ -25,6 +25,13 @@
25 * 25 *
26 * 4. matrix key and direct key will use the same debounce_interval by 26 * 4. matrix key and direct key will use the same debounce_interval by
27 * default, which should be sufficient in most cases 27 * default, which should be sufficient in most cases
28 *
29 * pxa168 keypad platform specific parameter
30 *
31 * NOTE:
32 * clear_wakeup_event callback is a workaround required to clear the
33 * keypad interrupt. The keypad wake must be cleared in addition to
34 * reading the MI/DI bits in the KPC register.
28 */ 35 */
29struct pxa27x_keypad_platform_data { 36struct pxa27x_keypad_platform_data {
30 37
@@ -52,6 +59,9 @@ struct pxa27x_keypad_platform_data {
52 59
53 /* key debounce interval */ 60 /* key debounce interval */
54 unsigned int debounce_interval; 61 unsigned int debounce_interval;
62
63 /* clear wakeup event requirement for pxa168 */
64 void (*clear_wakeup_event)(void);
55}; 65};
56 66
57extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info); 67extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index c6a855db2fb6..25960966af7c 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -7,7 +7,7 @@
7 7
8config PLAT_S5P 8config PLAT_S5P
9 bool 9 bool
10 depends on (ARCH_S5P6440 || ARCH_S5P6442 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_S5PV310) 10 depends on (ARCH_S5P64X0 || ARCH_S5P6442 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_S5PV310)
11 default y 11 default y
12 select ARM_VIC if !ARCH_S5PV310 12 select ARM_VIC if !ARCH_S5PV310
13 select ARM_GIC if ARCH_S5PV310 13 select ARM_GIC if ARCH_S5PV310
@@ -30,7 +30,7 @@ config S5P_EXT_INT
30 bool 30 bool
31 help 31 help
32 Use the external interrupts (other than GPIO interrupts.) 32 Use the external interrupts (other than GPIO interrupts.)
33 Note: Do not choose this for S5P6440. 33 Note: Do not choose this for S5P6440 and S5P6450.
34 34
35config S5P_DEV_FIMC0 35config S5P_DEV_FIMC0
36 bool 36 bool
@@ -46,3 +46,8 @@ config S5P_DEV_FIMC2
46 bool 46 bool
47 help 47 help
48 Compile in platform device definitions for FIMC controller 2 48 Compile in platform device definitions for FIMC controller 2
49
50config S5P_DEV_ONENAND
51 bool
52 help
53 Compile in platform device definition for OneNAND controller
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index b2e029673950..f3e917e27da8 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o
24obj-$(CONFIG_S5P_DEV_FIMC0) += dev-fimc0.o 24obj-$(CONFIG_S5P_DEV_FIMC0) += dev-fimc0.o
25obj-$(CONFIG_S5P_DEV_FIMC1) += dev-fimc1.o 25obj-$(CONFIG_S5P_DEV_FIMC1) += dev-fimc1.o
26obj-$(CONFIG_S5P_DEV_FIMC2) += dev-fimc2.o 26obj-$(CONFIG_S5P_DEV_FIMC2) += dev-fimc2.o
27obj-$(CONFIG_S5P_DEV_ONENAND) += dev-onenand.o
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index b5e255265f20..8aaf4e6b60c3 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -74,6 +74,13 @@ struct clk clk_fout_epll = {
74 .ctrlbit = (1 << 31), 74 .ctrlbit = (1 << 31),
75}; 75};
76 76
77/* DPLL clock output */
78struct clk clk_fout_dpll = {
79 .name = "fout_dpll",
80 .id = -1,
81 .ctrlbit = (1 << 31),
82};
83
77/* VPLL clock output */ 84/* VPLL clock output */
78struct clk clk_fout_vpll = { 85struct clk clk_fout_vpll = {
79 .name = "fout_vpll", 86 .name = "fout_vpll",
@@ -122,6 +129,17 @@ struct clksrc_sources clk_src_epll = {
122 .nr_sources = ARRAY_SIZE(clk_src_epll_list), 129 .nr_sources = ARRAY_SIZE(clk_src_epll_list),
123}; 130};
124 131
132/* Possible clock sources for DPLL Mux */
133static struct clk *clk_src_dpll_list[] = {
134 [0] = &clk_fin_dpll,
135 [1] = &clk_fout_dpll,
136};
137
138struct clksrc_sources clk_src_dpll = {
139 .sources = clk_src_dpll_list,
140 .nr_sources = ARRAY_SIZE(clk_src_dpll_list),
141};
142
125struct clk clk_vpll = { 143struct clk clk_vpll = {
126 .name = "vpll", 144 .name = "vpll",
127 .id = -1, 145 .id = -1,
@@ -145,6 +163,7 @@ static struct clk *s5p_clks[] __initdata = {
145 &clk_fout_apll, 163 &clk_fout_apll,
146 &clk_fout_mpll, 164 &clk_fout_mpll,
147 &clk_fout_epll, 165 &clk_fout_epll,
166 &clk_fout_dpll,
148 &clk_fout_vpll, 167 &clk_fout_vpll,
149 &clk_arm, 168 &clk_arm,
150 &clk_vpll, 169 &clk_vpll,
diff --git a/arch/arm/plat-s5p/cpu.c b/arch/arm/plat-s5p/cpu.c
index b07a078fd284..74f7f5a5446c 100644
--- a/arch/arm/plat-s5p/cpu.c
+++ b/arch/arm/plat-s5p/cpu.c
@@ -19,6 +19,7 @@
19#include <plat/cpu.h> 19#include <plat/cpu.h>
20#include <plat/s5p6440.h> 20#include <plat/s5p6440.h>
21#include <plat/s5p6442.h> 21#include <plat/s5p6442.h>
22#include <plat/s5p6450.h>
22#include <plat/s5pc100.h> 23#include <plat/s5pc100.h>
23#include <plat/s5pv210.h> 24#include <plat/s5pv210.h>
24#include <plat/s5pv310.h> 25#include <plat/s5pv310.h>
@@ -27,6 +28,7 @@
27 28
28static const char name_s5p6440[] = "S5P6440"; 29static const char name_s5p6440[] = "S5P6440";
29static const char name_s5p6442[] = "S5P6442"; 30static const char name_s5p6442[] = "S5P6442";
31static const char name_s5p6450[] = "S5P6450";
30static const char name_s5pc100[] = "S5PC100"; 32static const char name_s5pc100[] = "S5PC100";
31static const char name_s5pv210[] = "S5PV210/S5PC110"; 33static const char name_s5pv210[] = "S5PV210/S5PC110";
32static const char name_s5pv310[] = "S5PV310"; 34static const char name_s5pv310[] = "S5PV310";
@@ -38,7 +40,7 @@ static struct cpu_table cpu_ids[] __initdata = {
38 .map_io = s5p6440_map_io, 40 .map_io = s5p6440_map_io,
39 .init_clocks = s5p6440_init_clocks, 41 .init_clocks = s5p6440_init_clocks,
40 .init_uarts = s5p6440_init_uarts, 42 .init_uarts = s5p6440_init_uarts,
41 .init = s5p6440_init, 43 .init = s5p64x0_init,
42 .name = name_s5p6440, 44 .name = name_s5p6440,
43 }, { 45 }, {
44 .idcode = 0x36442000, 46 .idcode = 0x36442000,
@@ -49,6 +51,14 @@ static struct cpu_table cpu_ids[] __initdata = {
49 .init = s5p6442_init, 51 .init = s5p6442_init,
50 .name = name_s5p6442, 52 .name = name_s5p6442,
51 }, { 53 }, {
54 .idcode = 0x36450000,
55 .idmask = 0xffffff00,
56 .map_io = s5p6450_map_io,
57 .init_clocks = s5p6450_init_clocks,
58 .init_uarts = s5p6450_init_uarts,
59 .init = s5p64x0_init,
60 .name = name_s5p6450,
61 }, {
52 .idcode = 0x43100000, 62 .idcode = 0x43100000,
53 .idmask = 0xfffff000, 63 .idmask = 0xfffff000,
54 .map_io = s5pc100_map_io, 64 .map_io = s5pc100_map_io,
@@ -89,33 +99,11 @@ static struct map_desc s5p_iodesc[] __initdata = {
89 .length = SZ_64K, 99 .length = SZ_64K,
90 .type = MT_DEVICE, 100 .type = MT_DEVICE,
91 }, { 101 }, {
92 .virtual = (unsigned long)S3C_VA_UART,
93 .pfn = __phys_to_pfn(S3C_PA_UART),
94 .length = SZ_512K,
95 .type = MT_DEVICE,
96#ifdef CONFIG_ARM_VIC
97 }, {
98 .virtual = (unsigned long)VA_VIC0,
99 .pfn = __phys_to_pfn(S5P_PA_VIC0),
100 .length = SZ_16K,
101 .type = MT_DEVICE,
102 }, {
103 .virtual = (unsigned long)VA_VIC1,
104 .pfn = __phys_to_pfn(S5P_PA_VIC1),
105 .length = SZ_16K,
106 .type = MT_DEVICE,
107#endif
108 }, {
109 .virtual = (unsigned long)S3C_VA_TIMER, 102 .virtual = (unsigned long)S3C_VA_TIMER,
110 .pfn = __phys_to_pfn(S5P_PA_TIMER), 103 .pfn = __phys_to_pfn(S5P_PA_TIMER),
111 .length = SZ_16K, 104 .length = SZ_16K,
112 .type = MT_DEVICE, 105 .type = MT_DEVICE,
113 }, { 106 }, {
114 .virtual = (unsigned long)S5P_VA_GPIO,
115 .pfn = __phys_to_pfn(S5P_PA_GPIO),
116 .length = SZ_4K,
117 .type = MT_DEVICE,
118 }, {
119 .virtual = (unsigned long)S3C_VA_WATCHDOG, 107 .virtual = (unsigned long)S3C_VA_WATCHDOG,
120 .pfn = __phys_to_pfn(S3C_PA_WDT), 108 .pfn = __phys_to_pfn(S3C_PA_WDT),
121 .length = SZ_4K, 109 .length = SZ_4K,
diff --git a/arch/arm/mach-s5pv210/dev-onenand.c b/arch/arm/plat-s5p/dev-onenand.c
index f8ede33ee82b..6db926202caa 100644
--- a/arch/arm/mach-s5pv210/dev-onenand.c
+++ b/arch/arm/plat-s5p/dev-onenand.c
@@ -1,10 +1,12 @@
1/* 1/* linux/arch/arm/plat-s5p/dev-onenand.c
2 * linux/arch/arm/mach-s5pv210/dev-onenand.c 2 *
3 * Copyright 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
3 * 5 *
4 * Copyright (c) 2008-2010 Samsung Electronics 6 * Copyright (c) 2008-2010 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com> 7 * Kyungmin Park <kyungmin.park@samsung.com>
6 * 8 *
7 * S5PC110 series device definition for OneNAND devices 9 * S5P series device definition for OneNAND devices
8 * 10 *
9 * This program is free software; you can redistribute it and/or modify 11 * 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 12 * it under the terms of the GNU General Public License version 2 as
@@ -19,15 +21,15 @@
19#include <mach/irqs.h> 21#include <mach/irqs.h>
20#include <mach/map.h> 22#include <mach/map.h>
21 23
22static struct resource s5pc110_onenand_resources[] = { 24static struct resource s5p_onenand_resources[] = {
23 [0] = { 25 [0] = {
24 .start = S5PC110_PA_ONENAND, 26 .start = S5P_PA_ONENAND,
25 .end = S5PC110_PA_ONENAND + SZ_128K - 1, 27 .end = S5P_PA_ONENAND + SZ_128K - 1,
26 .flags = IORESOURCE_MEM, 28 .flags = IORESOURCE_MEM,
27 }, 29 },
28 [1] = { 30 [1] = {
29 .start = S5PC110_PA_ONENAND_DMA, 31 .start = S5P_PA_ONENAND_DMA,
30 .end = S5PC110_PA_ONENAND_DMA + SZ_8K - 1, 32 .end = S5P_PA_ONENAND_DMA + SZ_8K - 1,
31 .flags = IORESOURCE_MEM, 33 .flags = IORESOURCE_MEM,
32 }, 34 },
33 [2] = { 35 [2] = {
@@ -37,19 +39,19 @@ static struct resource s5pc110_onenand_resources[] = {
37 }, 39 },
38}; 40};
39 41
40struct platform_device s5pc110_device_onenand = { 42struct platform_device s5p_device_onenand = {
41 .name = "s5pc110-onenand", 43 .name = "s5pc110-onenand",
42 .id = -1, 44 .id = -1,
43 .num_resources = ARRAY_SIZE(s5pc110_onenand_resources), 45 .num_resources = ARRAY_SIZE(s5p_onenand_resources),
44 .resource = s5pc110_onenand_resources, 46 .resource = s5p_onenand_resources,
45}; 47};
46 48
47void s5pc110_onenand_set_platdata(struct onenand_platform_data *pdata) 49void s5p_onenand_set_platdata(struct onenand_platform_data *pdata)
48{ 50{
49 struct onenand_platform_data *pd; 51 struct onenand_platform_data *pd;
50 52
51 pd = kmemdup(pdata, sizeof(struct onenand_platform_data), GFP_KERNEL); 53 pd = kmemdup(pdata, sizeof(struct onenand_platform_data), GFP_KERNEL);
52 if (!pd) 54 if (!pd)
53 printk(KERN_ERR "%s: no memory for platform data\n", __func__); 55 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
54 s5pc110_device_onenand.dev.platform_data = pd; 56 s5p_device_onenand.dev.platform_data = pd;
55} 57}
diff --git a/arch/arm/plat-s5p/dev-uart.c b/arch/arm/plat-s5p/dev-uart.c
index a89331ef4ae1..6a7342886171 100644
--- a/arch/arm/plat-s5p/dev-uart.c
+++ b/arch/arm/plat-s5p/dev-uart.c
@@ -119,6 +119,56 @@ static struct resource s5p_uart3_resource[] = {
119#endif 119#endif
120}; 120};
121 121
122static struct resource s5p_uart4_resource[] = {
123#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
124 [0] = {
125 .start = S5P_PA_UART4,
126 .end = S5P_PA_UART4 + S5P_SZ_UART,
127 .flags = IORESOURCE_MEM,
128 },
129 [1] = {
130 .start = IRQ_S5P_UART_RX4,
131 .end = IRQ_S5P_UART_RX4,
132 .flags = IORESOURCE_IRQ,
133 },
134 [2] = {
135 .start = IRQ_S5P_UART_TX4,
136 .end = IRQ_S5P_UART_TX4,
137 .flags = IORESOURCE_IRQ,
138 },
139 [3] = {
140 .start = IRQ_S5P_UART_ERR4,
141 .end = IRQ_S5P_UART_ERR4,
142 .flags = IORESOURCE_IRQ,
143 },
144#endif
145};
146
147static struct resource s5p_uart5_resource[] = {
148#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
149 [0] = {
150 .start = S5P_PA_UART5,
151 .end = S5P_PA_UART5 + S5P_SZ_UART,
152 .flags = IORESOURCE_MEM,
153 },
154 [1] = {
155 .start = IRQ_S5P_UART_RX5,
156 .end = IRQ_S5P_UART_RX5,
157 .flags = IORESOURCE_IRQ,
158 },
159 [2] = {
160 .start = IRQ_S5P_UART_TX5,
161 .end = IRQ_S5P_UART_TX5,
162 .flags = IORESOURCE_IRQ,
163 },
164 [3] = {
165 .start = IRQ_S5P_UART_ERR5,
166 .end = IRQ_S5P_UART_ERR5,
167 .flags = IORESOURCE_IRQ,
168 },
169#endif
170};
171
122struct s3c24xx_uart_resources s5p_uart_resources[] __initdata = { 172struct s3c24xx_uart_resources s5p_uart_resources[] __initdata = {
123 [0] = { 173 [0] = {
124 .resources = s5p_uart0_resource, 174 .resources = s5p_uart0_resource,
@@ -136,4 +186,12 @@ struct s3c24xx_uart_resources s5p_uart_resources[] __initdata = {
136 .resources = s5p_uart3_resource, 186 .resources = s5p_uart3_resource,
137 .nr_resources = ARRAY_SIZE(s5p_uart3_resource), 187 .nr_resources = ARRAY_SIZE(s5p_uart3_resource),
138 }, 188 },
189 [4] = {
190 .resources = s5p_uart4_resource,
191 .nr_resources = ARRAY_SIZE(s5p_uart4_resource),
192 },
193 [5] = {
194 .resources = s5p_uart5_resource,
195 .nr_resources = ARRAY_SIZE(s5p_uart5_resource),
196 },
139}; 197};
diff --git a/arch/arm/plat-s5p/include/plat/pll.h b/arch/arm/plat-s5p/include/plat/pll.h
index 4e8fe08cb70d..bf28fadee7ae 100644
--- a/arch/arm/plat-s5p/include/plat/pll.h
+++ b/arch/arm/plat-s5p/include/plat/pll.h
@@ -47,6 +47,7 @@ static inline unsigned long s5p_get_pll45xx(unsigned long baseclk, u32 pll_con,
47} 47}
48 48
49#define PLL46XX_KDIV_MASK (0xFFFF) 49#define PLL46XX_KDIV_MASK (0xFFFF)
50#define PLL4650C_KDIV_MASK (0xFFF)
50#define PLL46XX_MDIV_MASK (0x1FF) 51#define PLL46XX_MDIV_MASK (0x1FF)
51#define PLL46XX_PDIV_MASK (0x3F) 52#define PLL46XX_PDIV_MASK (0x3F)
52#define PLL46XX_SDIV_MASK (0x7) 53#define PLL46XX_SDIV_MASK (0x7)
@@ -57,6 +58,7 @@ static inline unsigned long s5p_get_pll45xx(unsigned long baseclk, u32 pll_con,
57enum pll46xx_type_t { 58enum pll46xx_type_t {
58 pll_4600, 59 pll_4600,
59 pll_4650, 60 pll_4650,
61 pll_4650c,
60}; 62};
61 63
62static inline unsigned long s5p_get_pll46xx(unsigned long baseclk, 64static inline unsigned long s5p_get_pll46xx(unsigned long baseclk,
@@ -72,6 +74,11 @@ static inline unsigned long s5p_get_pll46xx(unsigned long baseclk,
72 sdiv = (pll_con0 >> PLL46XX_SDIV_SHIFT) & PLL46XX_SDIV_MASK; 74 sdiv = (pll_con0 >> PLL46XX_SDIV_SHIFT) & PLL46XX_SDIV_MASK;
73 kdiv = pll_con1 & PLL46XX_KDIV_MASK; 75 kdiv = pll_con1 & PLL46XX_KDIV_MASK;
74 76
77 if (pll_type == pll_4650c)
78 kdiv = pll_con1 & PLL4650C_KDIV_MASK;
79 else
80 kdiv = pll_con1 & PLL46XX_KDIV_MASK;
81
75 tmp = baseclk; 82 tmp = baseclk;
76 83
77 if (pll_type == pll_4600) { 84 if (pll_type == pll_4600) {
diff --git a/arch/arm/plat-s5p/include/plat/s5p-clock.h b/arch/arm/plat-s5p/include/plat/s5p-clock.h
index 09418b1101fe..17036c898409 100644
--- a/arch/arm/plat-s5p/include/plat/s5p-clock.h
+++ b/arch/arm/plat-s5p/include/plat/s5p-clock.h
@@ -1,7 +1,7 @@
1/* linux/arch/arm/plat-s5p/include/plat/s5p-clock.h 1/* linux/arch/arm/plat-s5p/include/plat/s5p-clock.h
2 * 2 *
3 * Copyright 2009 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com
5 * 5 *
6 * Header file for s5p clock support 6 * Header file for s5p clock support
7 * 7 *
@@ -20,6 +20,7 @@
20#define clk_fin_apll clk_ext_xtal_mux 20#define clk_fin_apll clk_ext_xtal_mux
21#define clk_fin_mpll clk_ext_xtal_mux 21#define clk_fin_mpll clk_ext_xtal_mux
22#define clk_fin_epll clk_ext_xtal_mux 22#define clk_fin_epll clk_ext_xtal_mux
23#define clk_fin_dpll clk_ext_xtal_mux
23#define clk_fin_vpll clk_ext_xtal_mux 24#define clk_fin_vpll clk_ext_xtal_mux
24#define clk_fin_hpll clk_ext_xtal_mux 25#define clk_fin_hpll clk_ext_xtal_mux
25 26
@@ -30,6 +31,7 @@ extern struct clk s5p_clk_27m;
30extern struct clk clk_fout_apll; 31extern struct clk clk_fout_apll;
31extern struct clk clk_fout_mpll; 32extern struct clk clk_fout_mpll;
32extern struct clk clk_fout_epll; 33extern struct clk clk_fout_epll;
34extern struct clk clk_fout_dpll;
33extern struct clk clk_fout_vpll; 35extern struct clk clk_fout_vpll;
34extern struct clk clk_arm; 36extern struct clk clk_arm;
35extern struct clk clk_vpll; 37extern struct clk clk_vpll;
@@ -37,8 +39,8 @@ extern struct clk clk_vpll;
37extern struct clksrc_sources clk_src_apll; 39extern struct clksrc_sources clk_src_apll;
38extern struct clksrc_sources clk_src_mpll; 40extern struct clksrc_sources clk_src_mpll;
39extern struct clksrc_sources clk_src_epll; 41extern struct clksrc_sources clk_src_epll;
42extern struct clksrc_sources clk_src_dpll;
40 43
41extern int s5p6440_clk48m_ctrl(struct clk *clk, int enable);
42extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable); 44extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable);
43 45
44#endif /* __ASM_PLAT_S5P_CLOCK_H */ 46#endif /* __ASM_PLAT_S5P_CLOCK_H */
diff --git a/arch/arm/plat-s5p/include/plat/s5p6440.h b/arch/arm/plat-s5p/include/plat/s5p6440.h
index a4cd75afeb3b..528585d2cafc 100644
--- a/arch/arm/plat-s5p/include/plat/s5p6440.h
+++ b/arch/arm/plat-s5p/include/plat/s5p6440.h
@@ -12,24 +12,23 @@
12 12
13 /* Common init code for S5P6440 related SoCs */ 13 /* Common init code for S5P6440 related SoCs */
14 14
15extern void s5p6440_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);
16extern void s5p6440_register_clocks(void); 15extern void s5p6440_register_clocks(void);
17extern void s5p6440_setup_clocks(void); 16extern void s5p6440_setup_clocks(void);
18 17
19#ifdef CONFIG_CPU_S5P6440 18#ifdef CONFIG_CPU_S5P6440
20 19
21extern int s5p6440_init(void); 20extern int s5p64x0_init(void);
22extern void s5p6440_init_irq(void); 21extern void s5p6440_init_irq(void);
23extern void s5p6440_map_io(void); 22extern void s5p6440_map_io(void);
24extern void s5p6440_init_clocks(int xtal); 23extern void s5p6440_init_clocks(int xtal);
25 24
26#define s5p6440_init_uarts s5p6440_common_init_uarts 25extern void s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no);
27 26
28#else 27#else
29#define s5p6440_init_clocks NULL 28#define s5p6440_init_clocks NULL
30#define s5p6440_init_uarts NULL 29#define s5p6440_init_uarts NULL
31#define s5p6440_map_io NULL 30#define s5p6440_map_io NULL
32#define s5p6440_init NULL 31#define s5p64x0_init NULL
33#endif 32#endif
34 33
35/* S5P6440 timer */ 34/* S5P6440 timer */
diff --git a/arch/arm/plat-s5p/include/plat/s5p6450.h b/arch/arm/plat-s5p/include/plat/s5p6450.h
new file mode 100644
index 000000000000..640a41c26be3
--- /dev/null
+++ b/arch/arm/plat-s5p/include/plat/s5p6450.h
@@ -0,0 +1,36 @@
1/* arch/arm/plat-s5p/include/plat/s5p6450.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Header file for s5p6450 cpu 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
13/* Common init code for S5P6450 related SoCs */
14
15extern void s5p6450_register_clocks(void);
16extern void s5p6450_setup_clocks(void);
17
18#ifdef CONFIG_CPU_S5P6450
19
20extern int s5p64x0_init(void);
21extern void s5p6450_init_irq(void);
22extern void s5p6450_map_io(void);
23extern void s5p6450_init_clocks(int xtal);
24
25extern void s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no);
26
27#else
28#define s5p6450_init_clocks NULL
29#define s5p6450_init_uarts NULL
30#define s5p6450_map_io NULL
31#define s5p64x0_init NULL
32#endif
33
34/* S5P6450 timer */
35
36extern struct sys_timer s5p6450_timer;
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 04d9521ddc9f..e8f2be2d67f2 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -435,7 +435,6 @@ static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state)
435static int s3c_adc_resume(struct platform_device *pdev) 435static int s3c_adc_resume(struct platform_device *pdev)
436{ 436{
437 struct adc_device *adc = platform_get_drvdata(pdev); 437 struct adc_device *adc = platform_get_drvdata(pdev);
438 unsigned long flags;
439 438
440 clk_enable(adc->clk); 439 clk_enable(adc->clk);
441 enable_irq(adc->irq); 440 enable_irq(adc->irq);
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index 90a20512d68d..e8d20b0bc50e 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -48,6 +48,9 @@
48#include <plat/clock.h> 48#include <plat/clock.h>
49#include <plat/cpu.h> 49#include <plat/cpu.h>
50 50
51#include <linux/serial_core.h>
52#include <plat/regs-serial.h> /* for s3c24xx_uart_devs */
53
51/* clock information */ 54/* clock information */
52 55
53static LIST_HEAD(clocks); 56static LIST_HEAD(clocks);
@@ -65,6 +68,28 @@ static int clk_null_enable(struct clk *clk, int enable)
65 return 0; 68 return 0;
66} 69}
67 70
71static int dev_is_s3c_uart(struct device *dev)
72{
73 struct platform_device **pdev = s3c24xx_uart_devs;
74 int i;
75 for (i = 0; i < ARRAY_SIZE(s3c24xx_uart_devs); i++, pdev++)
76 if (*pdev && dev == &(*pdev)->dev)
77 return 1;
78 return 0;
79}
80
81/*
82 * Serial drivers call get_clock() very early, before platform bus
83 * has been set up, this requires a special check to let them get
84 * a proper clock
85 */
86
87static int dev_is_platform_device(struct device *dev)
88{
89 return dev->bus == &platform_bus_type ||
90 (dev->bus == NULL && dev_is_s3c_uart(dev));
91}
92
68/* Clock API calls */ 93/* Clock API calls */
69 94
70struct clk *clk_get(struct device *dev, const char *id) 95struct clk *clk_get(struct device *dev, const char *id)
@@ -73,7 +98,7 @@ struct clk *clk_get(struct device *dev, const char *id)
73 struct clk *clk = ERR_PTR(-ENOENT); 98 struct clk *clk = ERR_PTR(-ENOENT);
74 int idno; 99 int idno;
75 100
76 if (dev == NULL || dev->bus != &platform_bus_type) 101 if (dev == NULL || !dev_is_platform_device(dev))
77 idno = -1; 102 idno = -1;
78 else 103 else
79 idno = to_platform_device(dev)->id; 104 idno = to_platform_device(dev)->id;
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 6412933d6fbb..9addb3dfb4bc 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -79,7 +79,7 @@ extern struct sysdev_class s3c2442_sysclass;
79extern struct sysdev_class s3c2443_sysclass; 79extern struct sysdev_class s3c2443_sysclass;
80extern struct sysdev_class s3c6410_sysclass; 80extern struct sysdev_class s3c6410_sysclass;
81extern struct sysdev_class s3c64xx_sysclass; 81extern struct sysdev_class s3c64xx_sysclass;
82extern struct sysdev_class s5p6440_sysclass; 82extern struct sysdev_class s5p64x0_sysclass;
83extern struct sysdev_class s5p6442_sysclass; 83extern struct sysdev_class s5p6442_sysclass;
84extern struct sysdev_class s5pv210_sysclass; 84extern struct sysdev_class s5pv210_sysclass;
85 85
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 85f6f23a510f..7d448e138792 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -67,13 +67,15 @@ extern struct platform_device s5pv210_device_spi0;
67extern struct platform_device s5pv210_device_spi1; 67extern struct platform_device s5pv210_device_spi1;
68extern struct platform_device s5p6440_device_spi0; 68extern struct platform_device s5p6440_device_spi0;
69extern struct platform_device s5p6440_device_spi1; 69extern struct platform_device s5p6440_device_spi1;
70extern struct platform_device s5p6450_device_spi0;
71extern struct platform_device s5p6450_device_spi1;
70 72
71extern struct platform_device s3c_device_hwmon; 73extern struct platform_device s3c_device_hwmon;
72 74
73extern struct platform_device s3c_device_nand; 75extern struct platform_device s3c_device_nand;
74extern struct platform_device s3c_device_onenand; 76extern struct platform_device s3c_device_onenand;
75extern struct platform_device s3c64xx_device_onenand1; 77extern struct platform_device s3c64xx_device_onenand1;
76extern struct platform_device s5pc110_device_onenand; 78extern struct platform_device s5p_device_onenand;
77 79
78extern struct platform_device s3c_device_usbgadget; 80extern struct platform_device s3c_device_usbgadget;
79extern struct platform_device s3c_device_usb_hsotg; 81extern struct platform_device s3c_device_usb_hsotg;
@@ -95,6 +97,9 @@ extern struct platform_device s5p6442_device_spi;
95extern struct platform_device s5p6440_device_pcm; 97extern struct platform_device s5p6440_device_pcm;
96extern struct platform_device s5p6440_device_iis; 98extern struct platform_device s5p6440_device_iis;
97 99
100extern struct platform_device s5p6450_device_iis0;
101extern struct platform_device s5p6450_device_pcm0;
102
98extern struct platform_device s5pc100_device_ac97; 103extern struct platform_device s5pc100_device_ac97;
99extern struct platform_device s5pc100_device_pcm0; 104extern struct platform_device s5pc100_device_pcm0;
100extern struct platform_device s5pc100_device_pcm1; 105extern struct platform_device s5pc100_device_pcm1;
diff --git a/arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h b/arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h
index 5fe6721b57f7..810744213120 100644
--- a/arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h
+++ b/arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h
@@ -32,6 +32,12 @@ enum dma_ch {
32 DMACH_UART2_TX, 32 DMACH_UART2_TX,
33 DMACH_UART3_RX, 33 DMACH_UART3_RX,
34 DMACH_UART3_TX, 34 DMACH_UART3_TX,
35 DMACH_UART4_RX,
36 DMACH_UART4_TX,
37 DMACH_UART5_RX,
38 DMACH_UART5_TX,
39 DMACH_USI_RX,
40 DMACH_USI_TX,
35 DMACH_IRDA, 41 DMACH_IRDA,
36 DMACH_I2S0_RX, 42 DMACH_I2S0_RX,
37 DMACH_I2S0_TX, 43 DMACH_I2S0_TX,
@@ -64,6 +70,20 @@ enum dma_ch {
64 DMACH_MSM_REQ2, 70 DMACH_MSM_REQ2,
65 DMACH_MSM_REQ1, 71 DMACH_MSM_REQ1,
66 DMACH_MSM_REQ0, 72 DMACH_MSM_REQ0,
73 DMACH_SLIMBUS0_RX,
74 DMACH_SLIMBUS0_TX,
75 DMACH_SLIMBUS0AUX_RX,
76 DMACH_SLIMBUS0AUX_TX,
77 DMACH_SLIMBUS1_RX,
78 DMACH_SLIMBUS1_TX,
79 DMACH_SLIMBUS2_RX,
80 DMACH_SLIMBUS2_TX,
81 DMACH_SLIMBUS3_RX,
82 DMACH_SLIMBUS3_TX,
83 DMACH_SLIMBUS4_RX,
84 DMACH_SLIMBUS4_TX,
85 DMACH_SLIMBUS5_RX,
86 DMACH_SLIMBUS5_TX,
67 /* END Marker, also used to denote a reserved channel */ 87 /* END Marker, also used to denote a reserved channel */
68 DMACH_MAX, 88 DMACH_MAX,
69}; 89};
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
index e5aba8f95b79..ae8e802bdca8 100644
--- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
+++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
@@ -65,7 +65,7 @@ struct s3c64xx_spi_info {
65extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); 65extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
66extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); 66extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
67extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); 67extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
68extern void s5p6440_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); 68extern void s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
69extern void s5p6442_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); 69extern void s5p6442_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
70 70
71#endif /* __S3C64XX_PLAT_SPI_H */ 71#endif /* __S3C64XX_PLAT_SPI_H */
diff --git a/arch/arm/plat-tcc/Kconfig b/arch/arm/plat-tcc/Kconfig
new file mode 100644
index 000000000000..1bf499570f42
--- /dev/null
+++ b/arch/arm/plat-tcc/Kconfig
@@ -0,0 +1,20 @@
1if ARCH_TCC_926
2
3menu "Telechips ARM926-based CPUs"
4
5choice
6 prompt "Telechips CPU type:"
7 default ARCH_TCC8K
8
9config ARCH_TCC8K
10 bool TCC8000
11 select USB_ARCH_HAS_OHCI
12 help
13 Support for Telechips TCC8000 systems
14
15endchoice
16
17source "arch/arm/mach-tcc8k/Kconfig"
18
19endmenu
20endif
diff --git a/arch/arm/plat-tcc/Makefile b/arch/arm/plat-tcc/Makefile
new file mode 100644
index 000000000000..eceabc869b8f
--- /dev/null
+++ b/arch/arm/plat-tcc/Makefile
@@ -0,0 +1,3 @@
1# "Telechips Platform Common Modules"
2
3obj-y := clock.o system.o
diff --git a/arch/arm/plat-tcc/clock.c b/arch/arm/plat-tcc/clock.c
new file mode 100644
index 000000000000..f3ced10d5271
--- /dev/null
+++ b/arch/arm/plat-tcc/clock.c
@@ -0,0 +1,179 @@
1/*
2 * Clock framework for Telechips SoCs
3 * Based on arch/arm/plat-mxc/clock.c
4 *
5 * Copyright (C) 2004 - 2005 Nokia corporation
6 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
7 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
8 * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
9 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
10 * Copyright 2010 Hans J. Koch, hjk@linutronix.de
11 *
12 * Licensed under the terms of the GPL v2.
13 */
14
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/errno.h>
18#include <linux/module.h>
19#include <linux/mutex.h>
20#include <linux/string.h>
21
22#include <mach/clock.h>
23#include <mach/hardware.h>
24
25static DEFINE_MUTEX(clocks_mutex);
26
27/*-------------------------------------------------------------------------
28 * Standard clock functions defined in include/linux/clk.h
29 *-------------------------------------------------------------------------*/
30
31static void __clk_disable(struct clk *clk)
32{
33 BUG_ON(clk->refcount == 0);
34
35 if (!(--clk->refcount) && clk->disable) {
36 /* Unconditionally disable the clock in hardware */
37 clk->disable(clk);
38 /* recursively disable parents */
39 if (clk->parent)
40 __clk_disable(clk->parent);
41 }
42}
43
44static int __clk_enable(struct clk *clk)
45{
46 int ret = 0;
47
48 if (clk->refcount++ == 0 && clk->enable) {
49 if (clk->parent)
50 ret = __clk_enable(clk->parent);
51 if (ret)
52 return ret;
53 else
54 return clk->enable(clk);
55 }
56
57 return 0;
58}
59
60/* This function increments the reference count on the clock and enables the
61 * clock if not already enabled. The parent clock tree is recursively enabled
62 */
63int clk_enable(struct clk *clk)
64{
65 int ret = 0;
66
67 if (!clk)
68 return -EINVAL;
69
70 mutex_lock(&clocks_mutex);
71 ret = __clk_enable(clk);
72 mutex_unlock(&clocks_mutex);
73
74 return ret;
75}
76EXPORT_SYMBOL_GPL(clk_enable);
77
78/* This function decrements the reference count on the clock and disables
79 * the clock when reference count is 0. The parent clock tree is
80 * recursively disabled
81 */
82void clk_disable(struct clk *clk)
83{
84 if (!clk)
85 return;
86
87 mutex_lock(&clocks_mutex);
88 __clk_disable(clk);
89 mutex_unlock(&clocks_mutex);
90}
91EXPORT_SYMBOL_GPL(clk_disable);
92
93/* Retrieve the *current* clock rate. If the clock itself
94 * does not provide a special calculation routine, ask
95 * its parent and so on, until one is able to return
96 * a valid clock rate
97 */
98unsigned long clk_get_rate(struct clk *clk)
99{
100 if (!clk)
101 return 0UL;
102
103 if (clk->get_rate)
104 return clk->get_rate(clk);
105
106 return clk_get_rate(clk->parent);
107}
108EXPORT_SYMBOL_GPL(clk_get_rate);
109
110/* Round the requested clock rate to the nearest supported
111 * rate that is less than or equal to the requested rate.
112 * This is dependent on the clock's current parent.
113 */
114long clk_round_rate(struct clk *clk, unsigned long rate)
115{
116 if (!clk)
117 return 0;
118 if (!clk->round_rate)
119 return 0;
120
121 return clk->round_rate(clk, rate);
122}
123EXPORT_SYMBOL_GPL(clk_round_rate);
124
125/* Set the clock to the requested clock rate. The rate must
126 * match a supported rate exactly based on what clk_round_rate returns
127 */
128int clk_set_rate(struct clk *clk, unsigned long rate)
129{
130 int ret = -EINVAL;
131
132 if (!clk)
133 return ret;
134 if (!clk->set_rate || !rate)
135 return ret;
136
137 mutex_lock(&clocks_mutex);
138 ret = clk->set_rate(clk, rate);
139 mutex_unlock(&clocks_mutex);
140
141 return ret;
142}
143EXPORT_SYMBOL_GPL(clk_set_rate);
144
145/* Set the clock's parent to another clock source */
146int clk_set_parent(struct clk *clk, struct clk *parent)
147{
148 struct clk *old;
149 int ret = -EINVAL;
150
151 if (!clk)
152 return ret;
153 if (!clk->set_parent || !parent)
154 return ret;
155
156 mutex_lock(&clocks_mutex);
157 old = clk->parent;
158 if (clk->refcount)
159 __clk_enable(parent);
160 ret = clk->set_parent(clk, parent);
161 if (ret)
162 old = parent;
163 if (clk->refcount)
164 __clk_disable(old);
165 mutex_unlock(&clocks_mutex);
166
167 return ret;
168}
169EXPORT_SYMBOL_GPL(clk_set_parent);
170
171/* Retrieve the clock's parent clock source */
172struct clk *clk_get_parent(struct clk *clk)
173{
174 if (!clk)
175 return NULL;
176
177 return clk->parent;
178}
179EXPORT_SYMBOL_GPL(clk_get_parent);
diff --git a/arch/arm/plat-tcc/include/mach/clkdev.h b/arch/arm/plat-tcc/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/plat-tcc/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/plat-tcc/include/mach/clock.h b/arch/arm/plat-tcc/include/mach/clock.h
new file mode 100644
index 000000000000..a12f58ad71a8
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/clock.h
@@ -0,0 +1,48 @@
1/*
2 * Low level clock header file for Telechips TCC architecture
3 * (C) 2010 Hans J. Koch <hjk@linutronix.de>
4 *
5 * Licensed under the GPL v2.
6 */
7
8#ifndef __ASM_ARCH_TCC_CLOCK_H__
9#define __ASM_ARCH_TCC_CLOCK_H__
10
11#ifndef __ASSEMBLY__
12
13struct clk {
14 struct clk *parent;
15 /* id number of a root clock, 0 for normal clocks */
16 int root_id;
17 /* Reference count of clock enable/disable */
18 int refcount;
19 /* Address of associated BCLKCTRx register. Must be set. */
20 void __iomem *bclkctr;
21 /* Bit position for BCLKCTRx. Must be set. */
22 int bclk_shift;
23 /* Address of ACLKxxx register, if any. */
24 void __iomem *aclkreg;
25 /* get the current clock rate (always a fresh value) */
26 unsigned long (*get_rate) (struct clk *);
27 /* Function ptr to set the clock to a new rate. The rate must match a
28 supported rate returned from round_rate. Leave blank if clock is not
29 programmable */
30 int (*set_rate) (struct clk *, unsigned long);
31 /* Function ptr to round the requested clock rate to the nearest
32 supported rate that is less than or equal to the requested rate. */
33 unsigned long (*round_rate) (struct clk *, unsigned long);
34 /* Function ptr to enable the clock. Leave blank if clock can not
35 be gated. */
36 int (*enable) (struct clk *);
37 /* Function ptr to disable the clock. Leave blank if clock can not
38 be gated. */
39 void (*disable) (struct clk *);
40 /* Function ptr to set the parent clock of the clock. */
41 int (*set_parent) (struct clk *, struct clk *);
42};
43
44int clk_register(struct clk *clk);
45void clk_unregister(struct clk *clk);
46
47#endif /* __ASSEMBLY__ */
48#endif /* __ASM_ARCH_MXC_CLOCK_H__ */
diff --git a/arch/arm/plat-tcc/include/mach/debug-macro.S b/arch/arm/plat-tcc/include/mach/debug-macro.S
new file mode 100644
index 000000000000..97537845df64
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/debug-macro.S
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 1994-1999 Russell King
3 * Copyright (C) 2008-2009 Telechips
4 * Copyright (C) 2009 Hans J. Koch <hjk@linutronix.de>
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 .macro addruart,rx,tmp
13 mrc p15, 0, \rx, c1, c0
14 tst \rx, #1 @ MMU enabled?
15 moveq \rx, #0x90000000 @ physical base address
16 movne \rx, #0xF1000000 @ virtual base
17 orr \rx, \rx, #0x00007000 @ UART0
18 .endm
19
20 .macro senduart,rd,rx
21 strb \rd, [\rx, #0x44]
22 .endm
23
24 .macro waituart,rd,rx
25 .endm
26
27 .macro busyuart,rd,rx
281001:
29 ldr \rd, [\rx, #0x14]
30 tst \rd, #0x20
31
32 beq 1001b
33 .endm
diff --git a/arch/arm/plat-tcc/include/mach/entry-macro.S b/arch/arm/plat-tcc/include/mach/entry-macro.S
new file mode 100644
index 000000000000..748f401e4b6d
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/entry-macro.S
@@ -0,0 +1,68 @@
1/*
2 * include/asm-arm/arch-tcc83x/entry-macro.S
3 *
4 * Author : <linux@telechips.com>
5 * Created: June 10, 2008
6 * Description: Low-level IRQ helper macros for Telechips-based platforms
7 *
8 * Copyright (C) 2008-2009 Telechips
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 <mach/hardware.h>
16#include <mach/irqs.h>
17
18 .macro disable_fiq
19 .endm
20
21 .macro get_irqnr_preamble, base, tmp
22 .endm
23
24 .macro arch_ret_to_user, tmp1, tmp2
25 .endm
26
27 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
28
29 ldr \base, =0xF2003000 @ base address of PIC registers
30
31 @@ read MREQ register of PIC0
32
33 mov \irqnr, #0
34 ldr \irqstat, [\base, #0x00000014 ] @ lower 32 interrupts
35 cmp \irqstat, #0
36 bne 1001f
37
38 @@ read MREQ register of PIC1
39
40 ldr \irqstat, [\base, #0x00000094] @ upper 32 interrupts
41 cmp \irqstat, #0
42 beq 1002f
43 mov \irqnr, #0x20
44
451001:
46 movs \tmp, \irqstat, lsl #16
47 movne \irqstat, \tmp
48 addeq \irqnr, \irqnr, #16
49
50 movs \tmp, \irqstat, lsl #8
51 movne \irqstat, \tmp
52 addeq \irqnr, \irqnr, #8
53
54 movs \tmp, \irqstat, lsl #4
55 movne \irqstat, \tmp
56 addeq \irqnr, \irqnr, #4
57
58 movs \tmp, \irqstat, lsl #2
59 movne \irqstat, \tmp
60 addeq \irqnr, \irqnr, #2
61
62 movs \tmp, \irqstat, lsl #1
63 addeq \irqnr, \irqnr, #1
64 orrs \base, \base, #1
651002:
66 @@ exit here, Z flag unset if IRQ
67
68 .endm
diff --git a/arch/arm/plat-tcc/include/mach/hardware.h b/arch/arm/plat-tcc/include/mach/hardware.h
new file mode 100644
index 000000000000..e70d126ccaf3
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/hardware.h
@@ -0,0 +1,43 @@
1/*
2 * Author: RidgeRun, Inc. Greg Lonnon <glonnon@ridgerun.com>
3 * Reorganized for Linux-2.6 by Tony Lindgren <tony@atomide.com>
4 * and Dirk Behme <dirk.behme@de.bosch.com>
5 * Rewritten by: <linux@telechips.com>
6 * Description: Hardware definitions for TCC8300 processors and boards
7 *
8 * Copyright (C) 2001 RidgeRun, Inc.
9 * Copyright (C) 2008-2009 Telechips
10 *
11 * Modifications for mainline (C) 2009 Hans J. Koch <hjk@linutronix.de>
12 *
13 * Licensed under the terms of the GNU Pulic License version 2.
14 */
15
16#ifndef __ASM_ARCH_TCC_HARDWARE_H
17#define __ASM_ARCH_TCC_HARDWARE_H
18
19#include <asm/sizes.h>
20#ifndef __ASSEMBLER__
21#include <asm/types.h>
22#endif
23#include <mach/io.h>
24
25/*
26 * ----------------------------------------------------------------------------
27 * Clocks
28 * ----------------------------------------------------------------------------
29 */
30#define CLKGEN_REG_BASE 0xfffece00
31#define ARM_CKCTL (CLKGEN_REG_BASE + 0x0)
32#define ARM_IDLECT1 (CLKGEN_REG_BASE + 0x4)
33#define ARM_IDLECT2 (CLKGEN_REG_BASE + 0x8)
34#define ARM_EWUPCT (CLKGEN_REG_BASE + 0xC)
35#define ARM_RSTCT1 (CLKGEN_REG_BASE + 0x10)
36#define ARM_RSTCT2 (CLKGEN_REG_BASE + 0x14)
37#define ARM_SYSST (CLKGEN_REG_BASE + 0x18)
38#define ARM_IDLECT3 (CLKGEN_REG_BASE + 0x24)
39
40/* DPLL control registers */
41#define DPLL_CTL 0xfffecf00
42
43#endif /* __ASM_ARCH_TCC_HARDWARE_H */
diff --git a/arch/arm/plat-tcc/include/mach/io.h b/arch/arm/plat-tcc/include/mach/io.h
new file mode 100644
index 000000000000..3e911d3ea0f1
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/io.h
@@ -0,0 +1,23 @@
1/*
2 * IO definitions for TCC8000 processors and boards
3 *
4 * Copyright (C) 1997-1999 Russell King
5 * Copyright (C) 2008-2009 Telechips
6 * Copyright (C) 2010 Hans J. Koch <hjk@linutronix.de>
7 *
8 * Licensed under the terms of the GNU Public License version 2.
9 */
10
11#ifndef __ASM_ARM_ARCH_IO_H
12#define __ASM_ARM_ARCH_IO_H
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16/*
17 * We don't actually have real ISA nor PCI buses, but there is so many
18 * drivers out there that might just work if we fake them...
19 */
20#define __io(a) __typesafe_io(a)
21#define __mem_pci(a) (a)
22
23#endif
diff --git a/arch/arm/plat-tcc/include/mach/irqs.h b/arch/arm/plat-tcc/include/mach/irqs.h
new file mode 100644
index 000000000000..da863894d498
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/irqs.h
@@ -0,0 +1,83 @@
1/*
2 * IRQ definitions for TCC8xxx
3 *
4 * Copyright (C) 2008-2009 Telechips
5 * Copyright (C) 2009 Hans J. Koch <hjk@linutronix.de>
6 *
7 * Licensed under the terms of the GPL v2.
8 *
9 */
10
11#ifndef __ASM_ARCH_TCC_IRQS_H
12#define __ASM_ARCH_TCC_IRQS_H
13
14#define NR_IRQS 64
15
16/* PIC0 interrupts */
17#define INT_ADMA1 0
18#define INT_BDMA 1
19#define INT_ADMA0 2
20#define INT_GDMA1 3
21#define INT_I2S0RX 4
22#define INT_I2S0TX 5
23#define INT_TC 6
24#define INT_UART0 7
25#define INT_USBD 8
26#define INT_SPI0TX 9
27#define INT_UDMA 10
28#define INT_LIRQ 11
29#define INT_GDMA2 12
30#define INT_GDMA0 13
31#define INT_TC32 14
32#define INT_LCD 15
33#define INT_ADC 16
34#define INT_I2C 17
35#define INT_RTCP 18
36#define INT_RTCA 19
37#define INT_NFC 20
38#define INT_SD0 21
39#define INT_GSB0 22
40#define INT_PK 23
41#define INT_USBH0 24
42#define INT_USBH1 25
43#define INT_G2D 26
44#define INT_ECC 27
45#define INT_SPI0RX 28
46#define INT_UART1 29
47#define INT_MSCL 30
48#define INT_GSB1 31
49/* PIC1 interrupts */
50#define INT_E0 32
51#define INT_E1 33
52#define INT_E2 34
53#define INT_E3 35
54#define INT_E4 36
55#define INT_E5 37
56#define INT_E6 38
57#define INT_E7 39
58#define INT_UART2 40
59#define INT_UART3 41
60#define INT_SPI1TX 42
61#define INT_SPI1RX 43
62#define INT_GSB2 44
63#define INT_SPDIF 45
64#define INT_CDIF 46
65#define INT_VBON 47
66#define INT_VBOFF 48
67#define INT_SD1 49
68#define INT_UART4 50
69#define INT_GDMA3 51
70#define INT_I2S1RX 52
71#define INT_I2S1TX 53
72#define INT_CAN0 54
73#define INT_CAN1 55
74#define INT_GSB3 56
75#define INT_KRST 57
76#define INT_UNUSED 58
77#define INT_SD0D3 59
78#define INT_SD1D3 60
79#define INT_GPS0 61
80#define INT_GPS1 62
81#define INT_GPS2 63
82
83#endif /* ASM_ARCH_TCC_IRQS_H */
diff --git a/arch/arm/plat-tcc/include/mach/memory.h b/arch/arm/plat-tcc/include/mach/memory.h
new file mode 100644
index 000000000000..cd91ba8a670b
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/memory.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright (C) 2000 RidgeRun, Inc.
4 * Copyright (C) 2008-2009 Telechips
5 * Copyright (C) 2010 Hans J. Koch <hjk@linutronix.de>
6 *
7 * Licensed under the terms of the GPL v2.
8 */
9
10#ifndef __ASM_ARCH_MEMORY_H
11#define __ASM_ARCH_MEMORY_H
12
13/*
14 * Physical DRAM offset.
15 */
16#define PHYS_OFFSET UL(0x20000000)
17
18#endif
diff --git a/arch/arm/plat-tcc/include/mach/system.h b/arch/arm/plat-tcc/include/mach/system.h
new file mode 100644
index 000000000000..909e6035d843
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/system.h
@@ -0,0 +1,31 @@
1/*
2 * Author: <linux@telechips.com>
3 * Created: June 10, 2008
4 * Description: LINUX SYSTEM FUNCTIONS for TCC83x
5 *
6 * Copyright (C) 2008-2009 Telechips
7 *
8 * Licensed under the terms of the GPL v2.
9 *
10 */
11
12#ifndef __ASM_ARCH_SYSTEM_H
13#define __ASM_ARCH_SYSTEM_H
14#include <linux/clk.h>
15
16#include <asm/mach-types.h>
17#include <mach/hardware.h>
18
19extern void plat_tcc_reboot(void);
20
21static inline void arch_idle(void)
22{
23 cpu_do_idle();
24}
25
26static inline void arch_reset(char mode, const char *cmd)
27{
28 plat_tcc_reboot();
29}
30
31#endif
diff --git a/arch/arm/plat-tcc/include/mach/tcc8k-regs.h b/arch/arm/plat-tcc/include/mach/tcc8k-regs.h
new file mode 100644
index 000000000000..1d9428295332
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/tcc8k-regs.h
@@ -0,0 +1,807 @@
1/*
2 * Telechips TCC8000 register definitions
3 *
4 * (C) 2009 Hans J. Koch <hjk@linutronix.de>
5 *
6 * Licensed under the terms of the GPLv2.
7 */
8
9#ifndef TCC8K_REGS_H
10#define TCC8K_REGS_H
11
12#include <linux/types.h>
13
14#define EXT_SDRAM_BASE 0x20000000
15#define INT_SRAM_BASE 0x30000000
16#define INT_SRAM_SIZE SZ_32K
17#define CS0_BASE 0x40000000
18#define CS1_BASE 0x50000000
19#define CS1_SIZE SZ_64K
20#define CS2_BASE 0x60000000
21#define CS3_BASE 0x70000000
22#define AHB_PERI_BASE 0x80000000
23#define AHB_PERI_SIZE SZ_64K
24#define APB0_PERI_BASE 0x90000000
25#define APB0_PERI_SIZE SZ_128K
26#define APB1_PERI_BASE 0x98000000
27#define APB1_PERI_SIZE SZ_128K
28#define DATA_TCM_BASE 0xa0000000
29#define DATA_TCM_SIZE SZ_8K
30#define EXT_MEM_CTRL_BASE 0xf0000000
31#define EXT_MEM_CTRL_SIZE SZ_4K
32
33#define CS1_BASE_VIRT (void __iomem *)0xf7000000
34#define AHB_PERI_BASE_VIRT (void __iomem *)0xf4000000
35#define APB0_PERI_BASE_VIRT (void __iomem *)0xf1000000
36#define APB1_PERI_BASE_VIRT (void __iomem *)0xf2000000
37#define EXT_MEM_CTRL_BASE_VIRT (void __iomem *)0xf3000000
38#define INT_SRAM_BASE_VIRT (void __iomem *)0xf5000000
39#define DATA_TCM_BASE_VIRT (void __iomem *)0xf6000000
40
41#define __REG(x) (*((volatile u32 *)(x)))
42
43/* USB Device Controller Registers */
44#define UDC_BASE (AHB_PERI_BASE_VIRT + 0x8000)
45#define UDC_BASE_PHYS (AHB_PERI_BASE + 0x8000)
46
47#define UDC_IR_OFFS 0x00
48#define UDC_EIR_OFFS 0x04
49#define UDC_EIER_OFFS 0x08
50#define UDC_FAR_OFFS 0x0c
51#define UDC_FNR_OFFS 0x10
52#define UDC_EDR_OFFS 0x14
53#define UDC_RT_OFFS 0x18
54#define UDC_SSR_OFFS 0x1c
55#define UDC_SCR_OFFS 0x20
56#define UDC_EP0SR_OFFS 0x24
57#define UDC_EP0CR_OFFS 0x28
58
59#define UDC_ESR_OFFS 0x2c
60#define UDC_ECR_OFFS 0x30
61#define UDC_BRCR_OFFS 0x34
62#define UDC_BWCR_OFFS 0x38
63#define UDC_MPR_OFFS 0x3c
64#define UDC_DCR_OFFS 0x40
65#define UDC_DTCR_OFFS 0x44
66#define UDC_DFCR_OFFS 0x48
67#define UDC_DTTCR1_OFFS 0x4c
68#define UDC_DTTCR2_OFFS 0x50
69#define UDC_ESR2_OFFS 0x54
70
71#define UDC_SCR2_OFFS 0x58
72#define UDC_EP0BUF_OFFS 0x60
73#define UDC_EP1BUF_OFFS 0x64
74#define UDC_EP2BUF_OFFS 0x68
75#define UDC_EP3BUF_OFFS 0x6c
76#define UDC_PLICR_OFFS 0xa0
77#define UDC_PCR_OFFS 0xa4
78
79#define UDC_UPCR0_OFFS 0xc8
80#define UDC_UPCR1_OFFS 0xcc
81#define UDC_UPCR2_OFFS 0xd0
82#define UDC_UPCR3_OFFS 0xd4
83
84/* Bits in UDC_EIR */
85#define UDC_EIR_EP0I (1 << 0)
86#define UDC_EIR_EP1I (1 << 1)
87#define UDC_EIR_EP2I (1 << 2)
88#define UDC_EIR_EP3I (1 << 3)
89#define UDC_EIR_EPI_MASK 0x0f
90
91/* Bits in UDC_EIER */
92#define UDC_EIER_EP0IE (1 << 0)
93#define UDC_EIER_EP1IE (1 << 1)
94#define UDC_EIER_EP2IE (1 << 2)
95#define UDC_EIER_EP3IE (1 << 3)
96
97/* Bits in UDC_FNR */
98#define UDC_FNR_FN_MASK 0x7ff
99#define UDC_FNR_SM (1 << 13)
100#define UDC_FNR_FTL (1 << 14)
101
102/* Bits in UDC_SSR */
103#define UDC_SSR_HFRES (1 << 0)
104#define UDC_SSR_HFSUSP (1 << 1)
105#define UDC_SSR_HFRM (1 << 2)
106#define UDC_SSR_SDE (1 << 3)
107#define UDC_SSR_HSP (1 << 4)
108#define UDC_SSR_DM (1 << 5)
109#define UDC_SSR_DP (1 << 6)
110#define UDC_SSR_TBM (1 << 7)
111#define UDC_SSR_VBON (1 << 8)
112#define UDC_SSR_VBOFF (1 << 9)
113#define UDC_SSR_EOERR (1 << 10)
114#define UDC_SSR_DCERR (1 << 11)
115#define UDC_SSR_TCERR (1 << 12)
116#define UDC_SSR_BSERR (1 << 13)
117#define UDC_SSR_TMERR (1 << 14)
118#define UDC_SSR_BAERR (1 << 15)
119
120/* Bits in UDC_SCR */
121#define UDC_SCR_HRESE (1 << 0)
122#define UDC_SCR_HSSPE (1 << 1)
123#define UDC_SCR_RRDE (1 << 5)
124#define UDC_SCR_SPDEN (1 << 6)
125#define UDC_SCR_DIEN (1 << 12)
126
127/* Bits in UDC_EP0SR */
128#define UDC_EP0SR_RSR (1 << 0)
129#define UDC_EP0SR_TST (1 << 1)
130#define UDC_EP0SR_SHT (1 << 4)
131#define UDC_EP0SR_LWO (1 << 6)
132
133/* Bits in UDC_EP0CR */
134#define UDC_EP0CR_ESS (1 << 1)
135
136/* Bits in UDC_ESR */
137#define UDC_ESR_RPS (1 << 0)
138#define UDC_ESR_TPS (1 << 1)
139#define UDC_ESR_LWO (1 << 4)
140#define UDC_ESR_FFS (1 << 6)
141
142/* Bits in UDC_ECR */
143#define UDC_ECR_ESS (1 << 1)
144#define UDC_ECR_CDP (1 << 2)
145
146#define UDC_ECR_FLUSH (1 << 6)
147#define UDC_ECR_DUEN (1 << 7)
148
149/* Bits in UDC_UPCR0 */
150#define UDC_UPCR0_VBD (1 << 1)
151#define UDC_UPCR0_VBDS (1 << 6)
152#define UDC_UPCR0_RCD_12 (0x0 << 9)
153#define UDC_UPCR0_RCD_24 (0x1 << 9)
154#define UDC_UPCR0_RCD_48 (0x2 << 9)
155#define UDC_UPCR0_RCS_EXT (0x1 << 11)
156#define UDC_UPCR0_RCS_XTAL (0x0 << 11)
157
158/* Bits in UDC_UPCR1 */
159#define UDC_UPCR1_CDT(x) ((x) << 0)
160#define UDC_UPCR1_OTGT(x) ((x) << 3)
161#define UDC_UPCR1_SQRXT(x) ((x) << 8)
162#define UDC_UPCR1_TXFSLST(x) ((x) << 12)
163
164/* Bits in UDC_UPCR2 */
165#define UDC_UPCR2_TP (1 << 0)
166#define UDC_UPCR2_TXRT(x) ((x) << 2)
167#define UDC_UPCR2_TXVRT(x) ((x) << 5)
168#define UDC_UPCR2_OPMODE(x) ((x) << 9)
169#define UDC_UPCR2_XCVRSEL(x) ((x) << 12)
170#define UDC_UPCR2_TM (1 << 14)
171
172/* USB Host Controller registers */
173#define USBH0_BASE (AHB_PERI_BASE_VIRT + 0xb000)
174#define USBH1_BASE (AHB_PERI_BASE_VIRT + 0xb800)
175
176#define OHCI_INT_ENABLE_OFFS 0x10
177
178#define RH_DESCRIPTOR_A_OFFS 0x48
179#define RH_DESCRIPTOR_B_OFFS 0x4c
180
181#define USBHTCFG0_OFFS 0x100
182#define USBHHCFG0_OFFS 0x104
183#define USBHHCFG1_OFFS 0x104
184
185/* DMA controller registers */
186#define DMAC0_BASE (AHB_PERI_BASE + 0x4000)
187#define DMAC1_BASE (AHB_PERI_BASE + 0xa000)
188#define DMAC2_BASE (AHB_PERI_BASE + 0x4800)
189#define DMAC3_BASE (AHB_PERI_BASE + 0xa800)
190
191#define DMAC_CH_OFFSET(ch) (ch * 0x30)
192
193#define ST_SADR_OFFS 0x00
194#define SPARAM_OFFS 0x04
195#define C_SADR_OFFS 0x0c
196#define ST_DADR_OFFS 0x10
197#define DPARAM_OFFS 0x14
198#define C_DADR_OFFS 0x1c
199#define HCOUNT_OFFS 0x20
200#define CHCTRL_OFFS 0x24
201#define RPTCTRL_OFFS 0x28
202#define EXTREQ_A_OFFS 0x2c
203
204/* Bits in CHCTRL register */
205#define CHCTRL_EN (1 << 0)
206
207#define CHCTRL_IEN (1 << 2)
208#define CHCTRL_FLAG (1 << 3)
209#define CHCTRL_WSIZE8 (0 << 4)
210#define CHCTRL_WSIZE16 (1 << 4)
211#define CHCTRL_WSIZE32 (2 << 4)
212
213#define CHCTRL_BSIZE1 (0 << 6)
214#define CHCTRL_BSIZE2 (1 << 6)
215#define CHCTRL_BSIZE4 (2 << 6)
216#define CHCTRL_BSIZE8 (3 << 6)
217
218#define CHCTRL_TYPE_SINGLE_E (0 << 8)
219#define CHCTRL_TYPE_HW (1 << 8)
220#define CHCTRL_TYPE_SW (2 << 8)
221#define CHCTRL_TYPE_SINGLE_L (3 << 8)
222
223#define CHCTRL_BST (1 << 10)
224
225/* Use DMA controller 0, channel 2 for USB */
226#define USB_DMA_BASE (DMAC0_BASE + DMAC_CH_OFFSET(2))
227
228/* NAND flash controller registers */
229#define NFC_BASE (AHB_PERI_BASE_VIRT + 0xd000)
230#define NFC_BASE_PHYS (AHB_PERI_BASE + 0xd000)
231
232#define NFC_CMD_OFFS 0x00
233#define NFC_LADDR_OFFS 0x04
234#define NFC_BADDR_OFFS 0x08
235#define NFC_SADDR_OFFS 0x0c
236#define NFC_WDATA_OFFS 0x10
237#define NFC_LDATA_OFFS 0x20
238#define NFC_SDATA_OFFS 0x40
239#define NFC_CTRL_OFFS 0x50
240#define NFC_PSTART_OFFS 0x54
241#define NFC_RSTART_OFFS 0x58
242#define NFC_DSIZE_OFFS 0x5c
243#define NFC_IREQ_OFFS 0x60
244#define NFC_RST_OFFS 0x64
245#define NFC_CTRL1_OFFS 0x68
246#define NFC_MDATA_OFFS 0x70
247
248#define NFC_WDATA_PHYS_ADDR (NFC_BASE_PHYS + NFC_WDATA_OFFS)
249
250/* Bits in NFC_CTRL */
251#define NFC_CTRL_BHLD_MASK (0xf << 0)
252#define NFC_CTRL_BPW_MASK (0xf << 4)
253#define NFC_CTRL_BSTP_MASK (0xf << 8)
254#define NFC_CTRL_CADDR_MASK (0x7 << 12)
255#define NFC_CTRL_CADDR_1 (0x0 << 12)
256#define NFC_CTRL_CADDR_2 (0x1 << 12)
257#define NFC_CTRL_CADDR_3 (0x2 << 12)
258#define NFC_CTRL_CADDR_4 (0x3 << 12)
259#define NFC_CTRL_CADDR_5 (0x4 << 12)
260#define NFC_CTRL_MSK (1 << 15)
261#define NFC_CTRL_PSIZE256 (0 << 16)
262#define NFC_CTRL_PSIZE512 (1 << 16)
263#define NFC_CTRL_PSIZE1024 (2 << 16)
264#define NFC_CTRL_PSIZE2048 (3 << 16)
265#define NFC_CTRL_PSIZE4096 (4 << 16)
266#define NFC_CTRL_PSIZE_MASK (7 << 16)
267#define NFC_CTRL_BSIZE1 (0 << 19)
268#define NFC_CTRL_BSIZE2 (1 << 19)
269#define NFC_CTRL_BSIZE4 (2 << 19)
270#define NFC_CTRL_BSIZE8 (3 << 19)
271#define NFC_CTRL_BSIZE_MASK (3 << 19)
272#define NFC_CTRL_RDY (1 << 21)
273#define NFC_CTRL_CS0SEL (1 << 22)
274#define NFC_CTRL_CS1SEL (1 << 23)
275#define NFC_CTRL_CS2SEL (1 << 24)
276#define NFC_CTRL_CS3SEL (1 << 25)
277#define NFC_CTRL_CSMASK (0xf << 22)
278#define NFC_CTRL_BW (1 << 26)
279#define NFC_CTRL_FS (1 << 27)
280#define NFC_CTRL_DEN (1 << 28)
281#define NFC_CTRL_READ_IEN (1 << 29)
282#define NFC_CTRL_PROG_IEN (1 << 30)
283#define NFC_CTRL_RDY_IEN (1 << 31)
284
285/* Bits in NFC_IREQ */
286#define NFC_IREQ_IRQ0 (1 << 0)
287#define NFC_IREQ_IRQ1 (1 << 1)
288#define NFC_IREQ_IRQ2 (1 << 2)
289
290#define NFC_IREQ_FLAG0 (1 << 4)
291#define NFC_IREQ_FLAG1 (1 << 5)
292#define NFC_IREQ_FLAG2 (1 << 6)
293
294/* MMC controller registers */
295#define MMC0_BASE (AHB_PERI_BASE_VIRT + 0xe000)
296#define MMC1_BASE (AHB_PERI_BASE_VIRT + 0xe800)
297
298/* UART base addresses */
299
300#define UART0_BASE (APB0_PERI_BASE_VIRT + 0x07000)
301#define UART0_BASE_PHYS (APB0_PERI_BASE + 0x07000)
302#define UART1_BASE (APB0_PERI_BASE_VIRT + 0x08000)
303#define UART1_BASE_PHYS (APB0_PERI_BASE + 0x08000)
304#define UART2_BASE (APB0_PERI_BASE_VIRT + 0x09000)
305#define UART2_BASE_PHYS (APB0_PERI_BASE + 0x09000)
306#define UART3_BASE (APB0_PERI_BASE_VIRT + 0x0a000)
307#define UART3_BASE_PHYS (APB0_PERI_BASE + 0x0a000)
308#define UART4_BASE (APB0_PERI_BASE_VIRT + 0x15000)
309#define UART4_BASE_PHYS (APB0_PERI_BASE + 0x15000)
310
311#define UART_BASE UART0_BASE
312#define UART_BASE_PHYS UART0_BASE_PHYS
313
314/* ECC controller */
315#define ECC_CTR_BASE (APB0_PERI_BASE_VIRT + 0xd000)
316
317#define ECC_CTRL_OFFS 0x00
318#define ECC_BASE_OFFS 0x04
319#define ECC_MASK_OFFS 0x08
320#define ECC_CLEAR_OFFS 0x0c
321#define ECC4_0_OFFS 0x10
322#define ECC4_1_OFFS 0x14
323
324#define ECC_EADDR0_OFFS 0x50
325
326#define ECC_ERRNUM_OFFS 0x90
327#define ECC_IREQ_OFFS 0x94
328
329/* Bits in ECC_CTRL */
330#define ECC_CTRL_ECC4_DIEN (1 << 28)
331#define ECC_CTRL_ECC8_DIEN (1 << 29)
332#define ECC_CTRL_ECC12_DIEN (1 << 30)
333#define ECC_CTRL_ECC_DISABLE 0x0
334#define ECC_CTRL_ECC_SLC_ENC 0x8
335#define ECC_CTRL_ECC_SLC_DEC 0x9
336#define ECC_CTRL_ECC4_ENC 0xa
337#define ECC_CTRL_ECC4_DEC 0xb
338#define ECC_CTRL_ECC8_ENC 0xc
339#define ECC_CTRL_ECC8_DEC 0xd
340#define ECC_CTRL_ECC12_ENC 0xe
341#define ECC_CTRL_ECC12_DEC 0xf
342
343/* Bits in ECC_IREQ */
344#define ECC_IREQ_E4DI (1 << 4)
345
346#define ECC_IREQ_E4DF (1 << 20)
347#define ECC_IREQ_E4EF (1 << 21)
348
349/* Interrupt controller */
350
351#define PIC0_BASE (APB1_PERI_BASE_VIRT + 0x3000)
352#define PIC0_BASE_PHYS (APB1_PERI_BASE + 0x3000)
353
354#define PIC0_IEN_OFFS 0x00
355#define PIC0_CREQ_OFFS 0x04
356#define PIC0_IREQ_OFFS 0x08
357#define PIC0_IRQSEL_OFFS 0x0c
358#define PIC0_SRC_OFFS 0x10
359#define PIC0_MREQ_OFFS 0x14
360#define PIC0_TSTREQ_OFFS 0x18
361#define PIC0_POL_OFFS 0x1c
362#define PIC0_IRQ_OFFS 0x20
363#define PIC0_FIQ_OFFS 0x24
364#define PIC0_MIRQ_OFFS 0x28
365#define PIC0_MFIQ_OFFS 0x2c
366#define PIC0_TMODE_OFFS 0x30
367#define PIC0_SYNC_OFFS 0x34
368#define PIC0_WKUP_OFFS 0x38
369#define PIC0_TMODEA_OFFS 0x3c
370#define PIC0_INTOEN_OFFS 0x40
371#define PIC0_MEN0_OFFS 0x44
372#define PIC0_MEN_OFFS 0x48
373
374#define PIC0_IEN __REG(PIC0_BASE + PIC0_IEN_OFFS)
375#define PIC0_IEN_PHYS __REG(PIC0_BASE_PHYS + PIC0_IEN_OFFS)
376#define PIC0_CREQ __REG(PIC0_BASE + PIC0_CREQ_OFFS)
377#define PIC0_CREQ_PHYS __REG(PIC0_BASE_PHYS + PIC0_CREQ_OFFS)
378#define PIC0_IREQ __REG(PIC0_BASE + PIC0_IREQ_OFFS)
379#define PIC0_IRQSEL __REG(PIC0_BASE + PIC0_IRQSEL_OFFS)
380#define PIC0_IRQSEL_PHYS __REG(PIC0_BASE_PHYS + PIC0_IRQSEL_OFFS)
381#define PIC0_SRC __REG(PIC0_BASE + PIC0_SRC_OFFS)
382#define PIC0_MREQ __REG(PIC0_BASE + PIC0_MREQ_OFFS)
383#define PIC0_TSTREQ __REG(PIC0_BASE + PIC0_TSTREQ_OFFS)
384#define PIC0_POL __REG(PIC0_BASE + PIC0_POL_OFFS)
385#define PIC0_IRQ __REG(PIC0_BASE + PIC0_IRQ_OFFS)
386#define PIC0_FIQ __REG(PIC0_BASE + PIC0_FIQ_OFFS)
387#define PIC0_MIRQ __REG(PIC0_BASE + PIC0_MIRQ_OFFS)
388#define PIC0_MFIQ __REG(PIC0_BASE + PIC0_MFIQ_OFFS)
389#define PIC0_TMODE __REG(PIC0_BASE + PIC0_TMODE_OFFS)
390#define PIC0_TMODE_PHYS __REG(PIC0_BASE_PHYS + PIC0_TMODE_OFFS)
391#define PIC0_SYNC __REG(PIC0_BASE + PIC0_SYNC_OFFS)
392#define PIC0_WKUP __REG(PIC0_BASE + PIC0_WKUP_OFFS)
393#define PIC0_TMODEA __REG(PIC0_BASE + PIC0_TMODEA_OFFS)
394#define PIC0_INTOEN __REG(PIC0_BASE + PIC0_INTOEN_OFFS)
395#define PIC0_MEN0 __REG(PIC0_BASE + PIC0_MEN0_OFFS)
396#define PIC0_MEN __REG(PIC0_BASE + PIC0_MEN_OFFS)
397
398#define PIC1_BASE (APB1_PERI_BASE_VIRT + 0x3080)
399
400#define PIC1_IEN_OFFS 0x00
401#define PIC1_CREQ_OFFS 0x04
402#define PIC1_IREQ_OFFS 0x08
403#define PIC1_IRQSEL_OFFS 0x0c
404#define PIC1_SRC_OFFS 0x10
405#define PIC1_MREQ_OFFS 0x14
406#define PIC1_TSTREQ_OFFS 0x18
407#define PIC1_POL_OFFS 0x1c
408#define PIC1_IRQ_OFFS 0x20
409#define PIC1_FIQ_OFFS 0x24
410#define PIC1_MIRQ_OFFS 0x28
411#define PIC1_MFIQ_OFFS 0x2c
412#define PIC1_TMODE_OFFS 0x30
413#define PIC1_SYNC_OFFS 0x34
414#define PIC1_WKUP_OFFS 0x38
415#define PIC1_TMODEA_OFFS 0x3c
416#define PIC1_INTOEN_OFFS 0x40
417#define PIC1_MEN1_OFFS 0x44
418#define PIC1_MEN_OFFS 0x48
419
420#define PIC1_IEN __REG(PIC1_BASE + PIC1_IEN_OFFS)
421#define PIC1_CREQ __REG(PIC1_BASE + PIC1_CREQ_OFFS)
422#define PIC1_IREQ __REG(PIC1_BASE + PIC1_IREQ_OFFS)
423#define PIC1_IRQSEL __REG(PIC1_BASE + PIC1_IRQSEL_OFFS)
424#define PIC1_SRC __REG(PIC1_BASE + PIC1_SRC_OFFS)
425#define PIC1_MREQ __REG(PIC1_BASE + PIC1_MREQ_OFFS)
426#define PIC1_TSTREQ __REG(PIC1_BASE + PIC1_TSTREQ_OFFS)
427#define PIC1_POL __REG(PIC1_BASE + PIC1_POL_OFFS)
428#define PIC1_IRQ __REG(PIC1_BASE + PIC1_IRQ_OFFS)
429#define PIC1_FIQ __REG(PIC1_BASE + PIC1_FIQ_OFFS)
430#define PIC1_MIRQ __REG(PIC1_BASE + PIC1_MIRQ_OFFS)
431#define PIC1_MFIQ __REG(PIC1_BASE + PIC1_MFIQ_OFFS)
432#define PIC1_TMODE __REG(PIC1_BASE + PIC1_TMODE_OFFS)
433#define PIC1_SYNC __REG(PIC1_BASE + PIC1_SYNC_OFFS)
434#define PIC1_WKUP __REG(PIC1_BASE + PIC1_WKUP_OFFS)
435#define PIC1_TMODEA __REG(PIC1_BASE + PIC1_TMODEA_OFFS)
436#define PIC1_INTOEN __REG(PIC1_BASE + PIC1_INTOEN_OFFS)
437#define PIC1_MEN1 __REG(PIC1_BASE + PIC1_MEN1_OFFS)
438#define PIC1_MEN __REG(PIC1_BASE + PIC1_MEN_OFFS)
439
440/* Timer registers */
441#define TIMER_BASE (APB1_PERI_BASE_VIRT + 0x4000)
442#define TIMER_BASE_PHYS (APB1_PERI_BASE + 0x4000)
443
444#define TWDCFG_OFFS 0x70
445
446#define TC32EN_OFFS 0x80
447#define TC32LDV_OFFS 0x84
448#define TC32CMP0_OFFS 0x88
449#define TC32CMP1_OFFS 0x8c
450#define TC32PCNT_OFFS 0x90
451#define TC32MCNT_OFFS 0x94
452#define TC32IRQ_OFFS 0x98
453
454/* Bits in TC32EN */
455#define TC32EN_PRESCALE_MASK 0x00ffffff
456#define TC32EN_ENABLE (1 << 24)
457#define TC32EN_LOADZERO (1 << 25)
458#define TC32EN_STOPMODE (1 << 26)
459#define TC32EN_LDM0 (1 << 28)
460#define TC32EN_LDM1 (1 << 29)
461
462/* Bits in TC32IRQ */
463#define TC32IRQ_MSTAT_MASK 0x0000001f
464#define TC32IRQ_RSTAT_MASK (0x1f << 8)
465#define TC32IRQ_IRQEN0 (1 << 16)
466#define TC32IRQ_IRQEN1 (1 << 17)
467#define TC32IRQ_IRQEN2 (1 << 18)
468#define TC32IRQ_IRQEN3 (1 << 19)
469#define TC32IRQ_IRQEN4 (1 << 20)
470#define TC32IRQ_RSYNC (1 << 30)
471#define TC32IRQ_IRQCLR (1 << 31)
472
473/* GPIO registers */
474#define GPIOPD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
475
476#define GPIOPD_DAT_OFFS 0x00
477#define GPIOPD_DOE_OFFS 0x04
478#define GPIOPD_FS0_OFFS 0x08
479#define GPIOPD_FS1_OFFS 0x0c
480#define GPIOPD_FS2_OFFS 0x10
481#define GPIOPD_RPU_OFFS 0x30
482#define GPIOPD_RPD_OFFS 0x34
483#define GPIOPD_DV0_OFFS 0x38
484#define GPIOPD_DV1_OFFS 0x3c
485
486#define GPIOPS_BASE (APB1_PERI_BASE_VIRT + 0x5000)
487
488#define GPIOPS_DAT_OFFS 0x40
489#define GPIOPS_DOE_OFFS 0x44
490#define GPIOPS_FS0_OFFS 0x48
491#define GPIOPS_FS1_OFFS 0x4c
492#define GPIOPS_FS2_OFFS 0x50
493#define GPIOPS_FS3_OFFS 0x54
494#define GPIOPS_RPU_OFFS 0x70
495#define GPIOPS_RPD_OFFS 0x74
496#define GPIOPS_DV0_OFFS 0x78
497#define GPIOPS_DV1_OFFS 0x7c
498
499#define GPIOPS_FS1_SDH0_BITS 0x000000ff
500#define GPIOPS_FS1_SDH1_BITS 0x0000ff00
501
502#define GPIOPU_BASE (APB1_PERI_BASE_VIRT + 0x5000)
503
504#define GPIOPU_DAT_OFFS 0x80
505#define GPIOPU_DOE_OFFS 0x84
506#define GPIOPU_FS0_OFFS 0x88
507#define GPIOPU_FS1_OFFS 0x8c
508#define GPIOPU_FS2_OFFS 0x90
509#define GPIOPU_RPU_OFFS 0xb0
510#define GPIOPU_RPD_OFFS 0xb4
511#define GPIOPU_DV0_OFFS 0xb8
512#define GPIOPU_DV1_OFFS 0xbc
513
514#define GPIOPU_FS0_TXD0 (1 << 0)
515#define GPIOPU_FS0_RXD0 (1 << 1)
516#define GPIOPU_FS0_CTS0 (1 << 2)
517#define GPIOPU_FS0_RTS0 (1 << 3)
518#define GPIOPU_FS0_TXD1 (1 << 4)
519#define GPIOPU_FS0_RXD1 (1 << 5)
520#define GPIOPU_FS0_CTS1 (1 << 6)
521#define GPIOPU_FS0_RTS1 (1 << 7)
522#define GPIOPU_FS0_TXD2 (1 << 8)
523#define GPIOPU_FS0_RXD2 (1 << 9)
524#define GPIOPU_FS0_CTS2 (1 << 10)
525#define GPIOPU_FS0_RTS2 (1 << 11)
526#define GPIOPU_FS0_TXD3 (1 << 12)
527#define GPIOPU_FS0_RXD3 (1 << 13)
528#define GPIOPU_FS0_CTS3 (1 << 14)
529#define GPIOPU_FS0_RTS3 (1 << 15)
530#define GPIOPU_FS0_TXD4 (1 << 16)
531#define GPIOPU_FS0_RXD4 (1 << 17)
532#define GPIOPU_FS0_CTS4 (1 << 18)
533#define GPIOPU_FS0_RTS4 (1 << 19)
534
535#define GPIOFC_BASE (APB1_PERI_BASE_VIRT + 0x5000)
536
537#define GPIOFC_DAT_OFFS 0xc0
538#define GPIOFC_DOE_OFFS 0xc4
539#define GPIOFC_FS0_OFFS 0xc8
540#define GPIOFC_FS1_OFFS 0xcc
541#define GPIOFC_FS2_OFFS 0xd0
542#define GPIOFC_FS3_OFFS 0xd4
543#define GPIOFC_RPU_OFFS 0xf0
544#define GPIOFC_RPD_OFFS 0xf4
545#define GPIOFC_DV0_OFFS 0xf8
546#define GPIOFC_DV1_OFFS 0xfc
547
548#define GPIOFD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
549
550#define GPIOFD_DAT_OFFS 0x100
551#define GPIOFD_DOE_OFFS 0x104
552#define GPIOFD_FS0_OFFS 0x108
553#define GPIOFD_FS1_OFFS 0x10c
554#define GPIOFD_FS2_OFFS 0x110
555#define GPIOFD_RPU_OFFS 0x130
556#define GPIOFD_RPD_OFFS 0x134
557#define GPIOFD_DV0_OFFS 0x138
558#define GPIOFD_DV1_OFFS 0x13c
559
560#define GPIOLC_BASE (APB1_PERI_BASE_VIRT + 0x5000)
561
562#define GPIOLC_DAT_OFFS 0x140
563#define GPIOLC_DOE_OFFS 0x144
564#define GPIOLC_FS0_OFFS 0x148
565#define GPIOLC_FS1_OFFS 0x14c
566#define GPIOLC_RPU_OFFS 0x170
567#define GPIOLC_RPD_OFFS 0x174
568#define GPIOLC_DV0_OFFS 0x178
569#define GPIOLC_DV1_OFFS 0x17c
570
571#define GPIOLD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
572
573#define GPIOLD_DAT_OFFS 0x180
574#define GPIOLD_DOE_OFFS 0x184
575#define GPIOLD_FS0_OFFS 0x188
576#define GPIOLD_FS1_OFFS 0x18c
577#define GPIOLD_FS2_OFFS 0x190
578#define GPIOLD_RPU_OFFS 0x1b0
579#define GPIOLD_RPD_OFFS 0x1b4
580#define GPIOLD_DV0_OFFS 0x1b8
581#define GPIOLD_DV1_OFFS 0x1bc
582
583#define GPIOAD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
584
585#define GPIOAD_DAT_OFFS 0x1c0
586#define GPIOAD_DOE_OFFS 0x1c4
587#define GPIOAD_FS0_OFFS 0x1c8
588#define GPIOAD_RPU_OFFS 0x1f0
589#define GPIOAD_RPD_OFFS 0x1f4
590#define GPIOAD_DV0_OFFS 0x1f8
591#define GPIOAD_DV1_OFFS 0x1fc
592
593#define GPIOXC_BASE (APB1_PERI_BASE_VIRT + 0x5000)
594
595#define GPIOXC_DAT_OFFS 0x200
596#define GPIOXC_DOE_OFFS 0x204
597#define GPIOXC_FS0_OFFS 0x208
598#define GPIOXC_RPU_OFFS 0x230
599#define GPIOXC_RPD_OFFS 0x234
600#define GPIOXC_DV0_OFFS 0x238
601#define GPIOXC_DV1_OFFS 0x23c
602
603#define GPIOXC_FS0 __REG(GPIOXC_BASE + GPIOXC_FS0_OFFS)
604
605#define GPIOXC_FS0_CS0 (1 << 26)
606#define GPIOXC_FS0_CS1 (1 << 27)
607
608#define GPIOXD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
609
610#define GPIOXD_DAT_OFFS 0x240
611#define GPIOXD_FS0_OFFS 0x248
612#define GPIOXD_RPU_OFFS 0x270
613#define GPIOXD_RPD_OFFS 0x274
614#define GPIOXD_DV0_OFFS 0x278
615#define GPIOXD_DV1_OFFS 0x27c
616
617#define GPIOPK_BASE (APB1_PERI_BASE_VIRT + 0x1c000)
618
619#define GPIOPK_RST_OFFS 0x008
620#define GPIOPK_DAT_OFFS 0x100
621#define GPIOPK_DOE_OFFS 0x104
622#define GPIOPK_FS0_OFFS 0x108
623#define GPIOPK_FS1_OFFS 0x10c
624#define GPIOPK_FS2_OFFS 0x110
625#define GPIOPK_IRQST_OFFS 0x210
626#define GPIOPK_IRQEN_OFFS 0x214
627#define GPIOPK_IRQPOL_OFFS 0x218
628#define GPIOPK_IRQTM0_OFFS 0x21c
629#define GPIOPK_IRQTM1_OFFS 0x220
630#define GPIOPK_CTL_OFFS 0x22c
631
632#define PMGPIO_BASE (APB1_PERI_BASE_VIRT + 0x10000)
633#define BACKUP_RAM_BASE PMGPIO_BASE
634
635#define PMGPIO_DAT_OFFS 0x800
636#define PMGPIO_DOE_OFFS 0x804
637#define PMGPIO_FS0_OFFS 0x808
638#define PMGPIO_RPU_OFFS 0x810
639#define PMGPIO_RPD_OFFS 0x814
640#define PMGPIO_DV0_OFFS 0x818
641#define PMGPIO_DV1_OFFS 0x81c
642#define PMGPIO_EE0_OFFS 0x820
643#define PMGPIO_EE1_OFFS 0x824
644#define PMGPIO_CTL_OFFS 0x828
645#define PMGPIO_DI_OFFS 0x82c
646#define PMGPIO_STR_OFFS 0x830
647#define PMGPIO_STF_OFFS 0x834
648#define PMGPIO_POL_OFFS 0x838
649#define PMGPIO_APB_OFFS 0x800
650
651/* Clock controller registers */
652#define CKC_BASE ((void __iomem *)(APB1_PERI_BASE_VIRT + 0x6000))
653
654#define CLKCTRL_OFFS 0x00
655#define PLL0CFG_OFFS 0x04
656#define PLL1CFG_OFFS 0x08
657#define CLKDIVC0_OFFS 0x0c
658
659#define BCLKCTR0_OFFS 0x14
660#define SWRESET0_OFFS 0x18
661
662#define BCLKCTR1_OFFS 0x60
663#define SWRESET1_OFFS 0x64
664#define PWDCTL_OFFS 0x68
665#define PLL2CFG_OFFS 0x6c
666#define CLKDIVC1_OFFS 0x70
667
668#define ACLKREF_OFFS 0x80
669#define ACLKI2C_OFFS 0x84
670#define ACLKSPI0_OFFS 0x88
671#define ACLKSPI1_OFFS 0x8c
672#define ACLKUART0_OFFS 0x90
673#define ACLKUART1_OFFS 0x94
674#define ACLKUART2_OFFS 0x98
675#define ACLKUART3_OFFS 0x9c
676#define ACLKUART4_OFFS 0xa0
677#define ACLKTCT_OFFS 0xa4
678#define ACLKTCX_OFFS 0xa8
679#define ACLKTCZ_OFFS 0xac
680#define ACLKADC_OFFS 0xb0
681#define ACLKDAI0_OFFS 0xb4
682#define ACLKDAI1_OFFS 0xb8
683#define ACLKLCD_OFFS 0xbc
684#define ACLKSPDIF_OFFS 0xc0
685#define ACLKUSBH_OFFS 0xc4
686#define ACLKSDH0_OFFS 0xc8
687#define ACLKSDH1_OFFS 0xcc
688#define ACLKC3DEC_OFFS 0xd0
689#define ACLKEXT_OFFS 0xd4
690#define ACLKCAN0_OFFS 0xd8
691#define ACLKCAN1_OFFS 0xdc
692#define ACLKGSB0_OFFS 0xe0
693#define ACLKGSB1_OFFS 0xe4
694#define ACLKGSB2_OFFS 0xe8
695#define ACLKGSB3_OFFS 0xec
696
697#define PLLxCFG_PD (1 << 31)
698
699/* CLKCTRL bits */
700#define CLKCTRL_XE (1 << 31)
701
702/* CLKDIVCx bits */
703#define CLKDIVC0_XTE (1 << 7)
704#define CLKDIVC0_XE (1 << 15)
705#define CLKDIVC0_P1E (1 << 23)
706#define CLKDIVC0_P0E (1 << 31)
707
708#define CLKDIVC1_P2E (1 << 7)
709
710/* BCLKCTR0 clock bits */
711#define BCLKCTR0_USBD (1 << 4)
712#define BCLKCTR0_ECC (1 << 9)
713#define BCLKCTR0_USBH0 (1 << 11)
714#define BCLKCTR0_NFC (1 << 16)
715
716/* BCLKCTR1 clock bits */
717#define BCLKCTR1_USBH1 (1 << 20)
718
719/* SWRESET0 bits */
720#define SWRESET0_USBD (1 << 4)
721#define SWRESET0_USBH0 (1 << 11)
722
723/* SWRESET1 bits */
724#define SWRESET1_USBH1 (1 << 20)
725
726/* System clock sources.
727 * Note: These are the clock sources that serve as parents for
728 * all other clocks. They have no parents themselves.
729 *
730 * These values are used for struct clk->root_id. All clocks
731 * that are not system clock sources have this value set to
732 * CLK_SRC_NOROOT.
733 * The values for system clocks start with CLK_SRC_PLL0 == 0
734 * because this gives us exactly the values needed for the lower
735 * 4 bits of ACLK_* registers. Therefore, CLK_SRC_NOROOT is
736 * defined as -1 to not disturb the order.
737 */
738enum root_clks {
739 CLK_SRC_NOROOT = -1,
740 CLK_SRC_PLL0 = 0,
741 CLK_SRC_PLL1,
742 CLK_SRC_PLL0DIV,
743 CLK_SRC_PLL1DIV,
744 CLK_SRC_XI,
745 CLK_SRC_XIDIV,
746 CLK_SRC_XTI,
747 CLK_SRC_XTIDIV,
748 CLK_SRC_PLL2,
749 CLK_SRC_PLL2DIV,
750 CLK_SRC_PK0,
751 CLK_SRC_PK1,
752 CLK_SRC_PK2,
753 CLK_SRC_PK3,
754 CLK_SRC_PK4,
755 CLK_SRC_48MHZ
756};
757
758#define CLK_SRC_MASK 0xf
759
760/* Bits in ACLK* registers */
761#define ACLK_EN (1 << 28)
762#define ACLK_SEL_SHIFT 24
763#define ACLK_SEL_MASK 0x0f000000
764#define ACLK_DIV_MASK 0x00000fff
765
766/* System configuration registers */
767
768#define SCFG_BASE (APB1_PERI_BASE_VIRT + 0x13000)
769
770#define BMI_OFFS 0x00
771#define AHBCON0_OFFS 0x04
772#define APBPWE_OFFS 0x08
773#define DTCMWAIT_OFFS 0x0c
774#define ECCSEL_OFFS 0x10
775#define AHBCON1_OFFS 0x14
776#define SDHCFG_OFFS 0x18
777#define REMAP_OFFS 0x20
778#define LCDSIAE_OFFS 0x24
779#define XMCCFG_OFFS 0xe0
780#define IMCCFG_OFFS 0xe4
781
782/* Values for ECCSEL */
783#define ECCSEL_EXTMEM 0x0
784#define ECCSEL_DTCM 0x1
785#define ECCSEL_INT_SRAM 0x2
786#define ECCSEL_AHB 0x3
787
788/* Bits in XMCCFG */
789#define XMCCFG_NFCE (1 << 1)
790#define XMCCFG_FDXD (1 << 2)
791
792/* External memory controller registers */
793
794#define EMC_BASE EXT_MEM_CTRL_BASE
795
796#define SDCFG_OFFS 0x00
797#define SDFSM_OFFS 0x04
798#define MCFG_OFFS 0x08
799
800#define CSCFG0_OFFS 0x10
801#define CSCFG1_OFFS 0x14
802#define CSCFG2_OFFS 0x18
803#define CSCFG3_OFFS 0x1c
804
805#define MCFG_SDEN (1 << 4)
806
807#endif /* TCC8K_REGS_H */
diff --git a/arch/arm/plat-tcc/include/mach/timex.h b/arch/arm/plat-tcc/include/mach/timex.h
new file mode 100644
index 000000000000..057acbe651d9
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/timex.h
@@ -0,0 +1,5 @@
1/*
2 * A definition needed by arch core code.
3 *
4 */
5#define CLOCK_TICK_RATE (HZ * 100000UL)
diff --git a/arch/arm/plat-tcc/include/mach/uncompress.h b/arch/arm/plat-tcc/include/mach/uncompress.h
new file mode 100644
index 000000000000..7a3e33a27a30
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/uncompress.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2009 Hans J. Koch <hjk@linutronix.de>
3 *
4 * This file is licensed under the terms of the GPL version 2.
5 */
6
7#include <linux/serial_reg.h>
8#include <linux/types.h>
9
10#include <mach/tcc8k-regs.h>
11
12unsigned int system_rev;
13
14#define ID_MASK 0x7fff
15
16static void putc(int c)
17{
18 u32 *uart_lsr = (u32 *)(UART_BASE_PHYS + (UART_LSR << 2));
19 u32 *uart_tx = (u32 *)(UART_BASE_PHYS + (UART_TX << 2));
20
21 while (!(*uart_lsr & UART_LSR_THRE))
22 barrier();
23 *uart_tx = c;
24}
25
26static inline void flush(void)
27{
28}
29
30/*
31 * nothing to do
32 */
33#define arch_decomp_setup()
34#define arch_decomp_wdog()
diff --git a/arch/arm/plat-tcc/include/mach/vmalloc.h b/arch/arm/plat-tcc/include/mach/vmalloc.h
new file mode 100644
index 000000000000..99414d9c2b94
--- /dev/null
+++ b/arch/arm/plat-tcc/include/mach/vmalloc.h
@@ -0,0 +1,10 @@
1/*
2 * Author: <linux@telechips.com>
3 * Created: June 10, 2008
4 *
5 * Copyright (C) 2000 Russell King.
6 * Copyright (C) 2008-2009 Telechips
7 *
8 * Licensed under the terms of the GPL v2.
9 */
10#define VMALLOC_END 0xf0000000UL
diff --git a/arch/arm/plat-tcc/system.c b/arch/arm/plat-tcc/system.c
new file mode 100644
index 000000000000..cc208fae3e7a
--- /dev/null
+++ b/arch/arm/plat-tcc/system.c
@@ -0,0 +1,25 @@
1/*
2 * System functions for Telechips TCCxxxx SoCs
3 *
4 * Copyright (C) Hans J. Koch <hjk@linutronix.de>
5 *
6 * Licensed under the terms of the GPL v2.
7 *
8 */
9
10#include <linux/io.h>
11
12#include <mach/tcc8k-regs.h>
13
14/* System reboot */
15void plat_tcc_reboot(void)
16{
17 /* Make sure clocks are on */
18 __raw_writel(0xffffffff, CKC_BASE + BCLKCTR0_OFFS);
19
20 /* Enable watchdog reset */
21 __raw_writel(0x49, TIMER_BASE + TWDCFG_OFFS);
22 /* Wait for reset */
23 while(1)
24 ;
25}
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index f51572772e21..9ac87255a03a 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -90,6 +90,7 @@ config PLATFORM_AT32AP
90 select ARCH_REQUIRE_GPIOLIB 90 select ARCH_REQUIRE_GPIOLIB
91 select GENERIC_ALLOCATOR 91 select GENERIC_ALLOCATOR
92 select HAVE_FB_ATMEL 92 select HAVE_FB_ATMEL
93 select HAVE_NET_MACB
93 94
94# 95#
95# CPU types 96# CPU types
diff --git a/arch/avr32/kernel/module.c b/arch/avr32/kernel/module.c
index 98f94d041d9c..a727f54d64d6 100644
--- a/arch/avr32/kernel/module.c
+++ b/arch/avr32/kernel/module.c
@@ -314,10 +314,9 @@ int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
314 vfree(module->arch.syminfo); 314 vfree(module->arch.syminfo);
315 module->arch.syminfo = NULL; 315 module->arch.syminfo = NULL;
316 316
317 return module_bug_finalize(hdr, sechdrs, module); 317 return 0;
318} 318}
319 319
320void module_arch_cleanup(struct module *module) 320void module_arch_cleanup(struct module *module)
321{ 321{
322 module_bug_cleanup(module);
323} 322}
diff --git a/arch/h8300/kernel/module.c b/arch/h8300/kernel/module.c
index 0865e291c20d..db4953dc4e1b 100644
--- a/arch/h8300/kernel/module.c
+++ b/arch/h8300/kernel/module.c
@@ -112,10 +112,9 @@ int module_finalize(const Elf_Ehdr *hdr,
112 const Elf_Shdr *sechdrs, 112 const Elf_Shdr *sechdrs,
113 struct module *me) 113 struct module *me)
114{ 114{
115 return module_bug_finalize(hdr, sechdrs, me); 115 return 0;
116} 116}
117 117
118void module_arch_cleanup(struct module *mod) 118void module_arch_cleanup(struct module *mod)
119{ 119{
120 module_bug_cleanup(mod);
121} 120}
diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
index 8f0640847ad2..05285d08e547 100644
--- a/arch/m68k/mac/macboing.c
+++ b/arch/m68k/mac/macboing.c
@@ -162,7 +162,7 @@ static void mac_init_asc( void )
162void mac_mksound( unsigned int freq, unsigned int length ) 162void mac_mksound( unsigned int freq, unsigned int length )
163{ 163{
164 __u32 cfreq = ( freq << 5 ) / 468; 164 __u32 cfreq = ( freq << 5 ) / 468;
165 __u32 flags; 165 unsigned long flags;
166 int i; 166 int i;
167 167
168 if ( mac_special_bell == NULL ) 168 if ( mac_special_bell == NULL )
@@ -224,7 +224,7 @@ static void mac_nosound( unsigned long ignored )
224 */ 224 */
225static void mac_quadra_start_bell( unsigned int freq, unsigned int length, unsigned int volume ) 225static void mac_quadra_start_bell( unsigned int freq, unsigned int length, unsigned int volume )
226{ 226{
227 __u32 flags; 227 unsigned long flags;
228 228
229 /* if the bell is already ringing, ring longer */ 229 /* if the bell is already ringing, ring longer */
230 if ( mac_bell_duration > 0 ) 230 if ( mac_bell_duration > 0 )
@@ -271,7 +271,7 @@ static void mac_quadra_start_bell( unsigned int freq, unsigned int length, unsig
271static void mac_quadra_ring_bell( unsigned long ignored ) 271static void mac_quadra_ring_bell( unsigned long ignored )
272{ 272{
273 int i, count = mac_asc_samplespersec / HZ; 273 int i, count = mac_asc_samplespersec / HZ;
274 __u32 flags; 274 unsigned long flags;
275 275
276 /* 276 /*
277 * we neither want a sound buffer overflow nor underflow, so we need to match 277 * we neither want a sound buffer overflow nor underflow, so we need to match
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 3ad59dde4852..5526faabfc21 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -13,6 +13,7 @@ config MIPS
13 select HAVE_KPROBES 13 select HAVE_KPROBES
14 select HAVE_KRETPROBES 14 select HAVE_KRETPROBES
15 select RTC_LIB if !MACH_LOONGSON 15 select RTC_LIB if !MACH_LOONGSON
16 select GENERIC_ATOMIC64 if !64BIT
16 17
17mainmenu "Linux/MIPS Kernel Configuration" 18mainmenu "Linux/MIPS Kernel Configuration"
18 19
@@ -1646,8 +1647,16 @@ config MIPS_MT_SMP
1646 select SYS_SUPPORTS_SMP 1647 select SYS_SUPPORTS_SMP
1647 select SMP_UP 1648 select SMP_UP
1648 help 1649 help
1649 This is a kernel model which is also known a VSMP or lately 1650 This is a kernel model which is known a VSMP but lately has been
1650 has been marketesed into SMVP. 1651 marketesed into SMVP.
1652 Virtual SMP uses the processor's VPEs to implement virtual
1653 processors. In currently available configuration of the 34K processor
1654 this allows for a dual processor. Both processors will share the same
1655 primary caches; each will obtain the half of the TLB for it's own
1656 exclusive use. For a layman this model can be described as similar to
1657 what Intel calls Hyperthreading.
1658
1659 For further information see http://www.linux-mips.org/wiki/34K#VSMP
1651 1660
1652config MIPS_MT_SMTC 1661config MIPS_MT_SMTC
1653 bool "SMTC: Use all TCs on all VPEs for SMP" 1662 bool "SMTC: Use all TCs on all VPEs for SMP"
@@ -1664,6 +1673,14 @@ config MIPS_MT_SMTC
1664 help 1673 help
1665 This is a kernel model which is known a SMTC or lately has been 1674 This is a kernel model which is known a SMTC or lately has been
1666 marketesed into SMVP. 1675 marketesed into SMVP.
1676 is presenting the available TC's of the core as processors to Linux.
1677 On currently available 34K processors this means a Linux system will
1678 see up to 5 processors. The implementation of the SMTC kernel differs
1679 significantly from VSMP and cannot efficiently coexist in the same
1680 kernel binary so the choice between VSMP and SMTC is a compile time
1681 decision.
1682
1683 For further information see http://www.linux-mips.org/wiki/34K#SMTC
1667 1684
1668endchoice 1685endchoice
1669 1686
diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/prom.c
index c29511b11d44..534021059629 100644
--- a/arch/mips/alchemy/common/prom.c
+++ b/arch/mips/alchemy/common/prom.c
@@ -43,7 +43,7 @@ int prom_argc;
43char **prom_argv; 43char **prom_argv;
44char **prom_envp; 44char **prom_envp;
45 45
46void prom_init_cmdline(void) 46void __init prom_init_cmdline(void)
47{ 47{
48 int i; 48 int i;
49 49
@@ -104,7 +104,7 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
104 } 104 }
105} 105}
106 106
107int prom_get_ethernet_addr(char *ethernet_addr) 107int __init prom_get_ethernet_addr(char *ethernet_addr)
108{ 108{
109 char *ethaddr_str; 109 char *ethaddr_str;
110 110
@@ -123,7 +123,6 @@ int prom_get_ethernet_addr(char *ethernet_addr)
123 123
124 return 0; 124 return 0;
125} 125}
126EXPORT_SYMBOL(prom_get_ethernet_addr);
127 126
128void __init prom_free_prom_memory(void) 127void __init prom_free_prom_memory(void)
129{ 128{
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index ed9bb709c9a3..5fd7f7a58b7e 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -59,7 +59,7 @@ $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
59hostprogs-y := calc_vmlinuz_load_addr 59hostprogs-y := calc_vmlinuz_load_addr
60 60
61VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ 61VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \
62 $(objtree)/$(KBUILD_IMAGE) $(VMLINUX_LOAD_ADDRESS)) 62 $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS))
63 63
64vmlinuzobjs-y += $(obj)/piggy.o 64vmlinuzobjs-y += $(obj)/piggy.o
65 65
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 094c17e38e16..47323ca452dc 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -83,3 +83,7 @@ config ARCH_SPARSEMEM_ENABLE
83 def_bool y 83 def_bool y
84 select SPARSEMEM_STATIC 84 select SPARSEMEM_STATIC
85 depends on CPU_CAVIUM_OCTEON 85 depends on CPU_CAVIUM_OCTEON
86
87config CAVIUM_OCTEON_HELPER
88 def_bool y
89 depends on OCTEON_ETHERNET || PCI
diff --git a/arch/mips/cavium-octeon/cpu.c b/arch/mips/cavium-octeon/cpu.c
index c664c8cc2b42..a5b427909b5c 100644
--- a/arch/mips/cavium-octeon/cpu.c
+++ b/arch/mips/cavium-octeon/cpu.c
@@ -41,7 +41,7 @@ static int cnmips_cu2_call(struct notifier_block *nfb, unsigned long action,
41 return NOTIFY_OK; /* Let default notifier send signals */ 41 return NOTIFY_OK; /* Let default notifier send signals */
42} 42}
43 43
44static int cnmips_cu2_setup(void) 44static int __init cnmips_cu2_setup(void)
45{ 45{
46 return cu2_notifier(cnmips_cu2_call, 0); 46 return cu2_notifier(cnmips_cu2_call, 0);
47} 47}
diff --git a/arch/mips/cavium-octeon/executive/Makefile b/arch/mips/cavium-octeon/executive/Makefile
index 2fd66db6939e..7f41c5be2190 100644
--- a/arch/mips/cavium-octeon/executive/Makefile
+++ b/arch/mips/cavium-octeon/executive/Makefile
@@ -11,4 +11,4 @@
11 11
12obj-y += cvmx-bootmem.o cvmx-l2c.o cvmx-sysinfo.o octeon-model.o 12obj-y += cvmx-bootmem.o cvmx-l2c.o cvmx-sysinfo.o octeon-model.o
13 13
14obj-$(CONFIG_PCI) += cvmx-helper-errata.o cvmx-helper-jtag.o 14obj-$(CONFIG_CAVIUM_OCTEON_HELPER) += cvmx-helper-errata.o cvmx-helper-jtag.o
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index c63c56bfd184..47d87da379f9 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -782,6 +782,10 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
782 */ 782 */
783#define atomic64_add_negative(i, v) (atomic64_add_return(i, (v)) < 0) 783#define atomic64_add_negative(i, v) (atomic64_add_return(i, (v)) < 0)
784 784
785#else /* !CONFIG_64BIT */
786
787#include <asm-generic/atomic64.h>
788
785#endif /* CONFIG_64BIT */ 789#endif /* CONFIG_64BIT */
786 790
787/* 791/*
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
index 2cb2f0c2c4f8..3532e2c5f098 100644
--- a/arch/mips/include/asm/cop2.h
+++ b/arch/mips/include/asm/cop2.h
@@ -24,7 +24,7 @@ extern int cu2_notifier_call_chain(unsigned long val, void *v);
24 24
25#define cu2_notifier(fn, pri) \ 25#define cu2_notifier(fn, pri) \
26({ \ 26({ \
27 static struct notifier_block fn##_nb __cpuinitdata = { \ 27 static struct notifier_block fn##_nb = { \
28 .notifier_call = fn, \ 28 .notifier_call = fn, \
29 .priority = pri \ 29 .priority = pri \
30 }; \ 30 }; \
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 9b9436a4d816..86548da650e7 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -321,6 +321,7 @@ struct gic_intrmask_regs {
321 */ 321 */
322struct gic_intr_map { 322struct gic_intr_map {
323 unsigned int cpunum; /* Directed to this CPU */ 323 unsigned int cpunum; /* Directed to this CPU */
324#define GIC_UNUSED 0xdead /* Dummy data */
324 unsigned int pin; /* Directed to this Pin */ 325 unsigned int pin; /* Directed to this Pin */
325 unsigned int polarity; /* Polarity : +/- */ 326 unsigned int polarity; /* Polarity : +/- */
326 unsigned int trigtype; /* Trigger : Edge/Levl */ 327 unsigned int trigtype; /* Trigger : Edge/Levl */
diff --git a/arch/mips/include/asm/mach-tx49xx/kmalloc.h b/arch/mips/include/asm/mach-tx49xx/kmalloc.h
index b74caf65482b..ff9a8b86cb93 100644
--- a/arch/mips/include/asm/mach-tx49xx/kmalloc.h
+++ b/arch/mips/include/asm/mach-tx49xx/kmalloc.h
@@ -1,6 +1,6 @@
1#ifndef __ASM_MACH_TX49XX_KMALLOC_H 1#ifndef __ASM_MACH_TX49XX_KMALLOC_H
2#define __ASM_MACH_TX49XX_KMALLOC_H 2#define __ASM_MACH_TX49XX_KMALLOC_H
3 3
4#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES 4#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
5 5
6#endif /* __ASM_MACH_TX49XX_KMALLOC_H */ 6#endif /* __ASM_MACH_TX49XX_KMALLOC_H */
diff --git a/arch/mips/include/asm/mips-boards/maltaint.h b/arch/mips/include/asm/mips-boards/maltaint.h
index cea872fc6f5c..d11aa02a956a 100644
--- a/arch/mips/include/asm/mips-boards/maltaint.h
+++ b/arch/mips/include/asm/mips-boards/maltaint.h
@@ -88,9 +88,6 @@
88 88
89#define GIC_EXT_INTR(x) x 89#define GIC_EXT_INTR(x) x
90 90
91/* Dummy data */
92#define X 0xdead
93
94/* External Interrupts used for IPI */ 91/* External Interrupts used for IPI */
95#define GIC_IPI_EXT_INTR_RESCHED_VPE0 16 92#define GIC_IPI_EXT_INTR_RESCHED_VPE0 16
96#define GIC_IPI_EXT_INTR_CALLFNC_VPE0 17 93#define GIC_IPI_EXT_INTR_CALLFNC_VPE0 17
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index a16beafcea91..e59cd1ac09c2 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -150,6 +150,20 @@ typedef struct { unsigned long pgprot; } pgprot_t;
150 ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET) 150 ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
151#endif 151#endif
152#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET)) 152#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
153
154/*
155 * RELOC_HIDE was originally added by 6007b903dfe5f1d13e0c711ac2894bdd4a61b1ad
156 * (lmo) rsp. 8431fd094d625b94d364fe393076ccef88e6ce18 (kernel.org). The
157 * discussion can be found in lkml posting
158 * <a2ebde260608230500o3407b108hc03debb9da6e62c@mail.gmail.com> which is
159 * archived at http://lists.linuxcoding.com/kernel/2006-q3/msg17360.html
160 *
161 * It is unclear if the misscompilations mentioned in
162 * http://lkml.org/lkml/2010/8/8/138 also affect MIPS so we keep this one
163 * until GCC 3.x has been retired before we can apply
164 * https://patchwork.linux-mips.org/patch/1541/
165 */
166
153#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0)) 167#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
154 168
155#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 169#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
diff --git a/arch/mips/include/asm/siginfo.h b/arch/mips/include/asm/siginfo.h
index 96e28f18dad1..1ca64b4d33d9 100644
--- a/arch/mips/include/asm/siginfo.h
+++ b/arch/mips/include/asm/siginfo.h
@@ -88,6 +88,7 @@ typedef struct siginfo {
88#ifdef __ARCH_SI_TRAPNO 88#ifdef __ARCH_SI_TRAPNO
89 int _trapno; /* TRAP # which caused the signal */ 89 int _trapno; /* TRAP # which caused the signal */
90#endif 90#endif
91 short _addr_lsb;
91 } _sigfault; 92 } _sigfault;
92 93
93 /* SIGPOLL, SIGXFSZ (To do ...) */ 94 /* SIGPOLL, SIGXFSZ (To do ...) */
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 2376f2e06e47..70df9c0d3c5b 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -146,7 +146,8 @@ register struct thread_info *__current_thread_info __asm__("$28");
146#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH) 146#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH)
147 147
148/* work to do on interrupt/exception return */ 148/* work to do on interrupt/exception return */
149#define _TIF_WORK_MASK (0x0000ffef & ~_TIF_SECCOMP) 149#define _TIF_WORK_MASK (0x0000ffef & \
150 ~(_TIF_SECCOMP | _TIF_SYSCALL_AUDIT))
150/* work to do on any return to u-space */ 151/* work to do on any return to u-space */
151#define _TIF_ALLWORK_MASK (0x8000ffff & ~_TIF_SECCOMP) 152#define _TIF_ALLWORK_MASK (0x8000ffff & ~_TIF_SECCOMP)
152 153
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index baa318a59c97..550725b881d5 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -356,16 +356,19 @@
356#define __NR_perf_event_open (__NR_Linux + 333) 356#define __NR_perf_event_open (__NR_Linux + 333)
357#define __NR_accept4 (__NR_Linux + 334) 357#define __NR_accept4 (__NR_Linux + 334)
358#define __NR_recvmmsg (__NR_Linux + 335) 358#define __NR_recvmmsg (__NR_Linux + 335)
359#define __NR_fanotify_init (__NR_Linux + 336)
360#define __NR_fanotify_mark (__NR_Linux + 337)
361#define __NR_prlimit64 (__NR_Linux + 338)
359 362
360/* 363/*
361 * Offset of the last Linux o32 flavoured syscall 364 * Offset of the last Linux o32 flavoured syscall
362 */ 365 */
363#define __NR_Linux_syscalls 335 366#define __NR_Linux_syscalls 338
364 367
365#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 368#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
366 369
367#define __NR_O32_Linux 4000 370#define __NR_O32_Linux 4000
368#define __NR_O32_Linux_syscalls 335 371#define __NR_O32_Linux_syscalls 338
369 372
370#if _MIPS_SIM == _MIPS_SIM_ABI64 373#if _MIPS_SIM == _MIPS_SIM_ABI64
371 374
@@ -668,16 +671,19 @@
668#define __NR_perf_event_open (__NR_Linux + 292) 671#define __NR_perf_event_open (__NR_Linux + 292)
669#define __NR_accept4 (__NR_Linux + 293) 672#define __NR_accept4 (__NR_Linux + 293)
670#define __NR_recvmmsg (__NR_Linux + 294) 673#define __NR_recvmmsg (__NR_Linux + 294)
674#define __NR_fanotify_init (__NR_Linux + 295)
675#define __NR_fanotify_mark (__NR_Linux + 296)
676#define __NR_prlimit64 (__NR_Linux + 297)
671 677
672/* 678/*
673 * Offset of the last Linux 64-bit flavoured syscall 679 * Offset of the last Linux 64-bit flavoured syscall
674 */ 680 */
675#define __NR_Linux_syscalls 294 681#define __NR_Linux_syscalls 297
676 682
677#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 683#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
678 684
679#define __NR_64_Linux 5000 685#define __NR_64_Linux 5000
680#define __NR_64_Linux_syscalls 294 686#define __NR_64_Linux_syscalls 297
681 687
682#if _MIPS_SIM == _MIPS_SIM_NABI32 688#if _MIPS_SIM == _MIPS_SIM_NABI32
683 689
@@ -985,16 +991,19 @@
985#define __NR_accept4 (__NR_Linux + 297) 991#define __NR_accept4 (__NR_Linux + 297)
986#define __NR_recvmmsg (__NR_Linux + 298) 992#define __NR_recvmmsg (__NR_Linux + 298)
987#define __NR_getdents64 (__NR_Linux + 299) 993#define __NR_getdents64 (__NR_Linux + 299)
994#define __NR_fanotify_init (__NR_Linux + 300)
995#define __NR_fanotify_mark (__NR_Linux + 301)
996#define __NR_prlimit64 (__NR_Linux + 302)
988 997
989/* 998/*
990 * Offset of the last N32 flavoured syscall 999 * Offset of the last N32 flavoured syscall
991 */ 1000 */
992#define __NR_Linux_syscalls 299 1001#define __NR_Linux_syscalls 302
993 1002
994#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1003#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
995 1004
996#define __NR_N32_Linux 6000 1005#define __NR_N32_Linux 6000
997#define __NR_N32_Linux_syscalls 299 1006#define __NR_N32_Linux_syscalls 302
998 1007
999#ifdef __KERNEL__ 1008#ifdef __KERNEL__
1000 1009
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index b181f2f0ea8e..82ba9f62f49e 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -7,7 +7,6 @@
7#include <asm/io.h> 7#include <asm/io.h>
8#include <asm/gic.h> 8#include <asm/gic.h>
9#include <asm/gcmpregs.h> 9#include <asm/gcmpregs.h>
10#include <asm/mips-boards/maltaint.h>
11#include <asm/irq.h> 10#include <asm/irq.h>
12#include <linux/hardirq.h> 11#include <linux/hardirq.h>
13#include <asm-generic/bitops/find.h> 12#include <asm-generic/bitops/find.h>
@@ -131,7 +130,7 @@ static int gic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
131 int i; 130 int i;
132 131
133 irq -= _irqbase; 132 irq -= _irqbase;
134 pr_debug(KERN_DEBUG "%s(%d) called\n", __func__, irq); 133 pr_debug("%s(%d) called\n", __func__, irq);
135 cpumask_and(&tmp, cpumask, cpu_online_mask); 134 cpumask_and(&tmp, cpumask, cpu_online_mask);
136 if (cpus_empty(tmp)) 135 if (cpus_empty(tmp))
137 return -1; 136 return -1;
@@ -222,7 +221,7 @@ static void __init gic_basic_init(int numintrs, int numvpes,
222 /* Setup specifics */ 221 /* Setup specifics */
223 for (i = 0; i < mapsize; i++) { 222 for (i = 0; i < mapsize; i++) {
224 cpu = intrmap[i].cpunum; 223 cpu = intrmap[i].cpunum;
225 if (cpu == X) 224 if (cpu == GIC_UNUSED)
226 continue; 225 continue;
227 if (cpu == 0 && i != 0 && intrmap[i].flags == 0) 226 if (cpu == 0 && i != 0 && intrmap[i].flags == 0)
228 continue; 227 continue;
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index 1f4e2fa64140..f4546e97c60d 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -283,7 +283,7 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
283 struct pt_regs *regs = args->regs; 283 struct pt_regs *regs = args->regs;
284 int trap = (regs->cp0_cause & 0x7c) >> 2; 284 int trap = (regs->cp0_cause & 0x7c) >> 2;
285 285
286 /* Userpace events, ignore. */ 286 /* Userspace events, ignore. */
287 if (user_mode(regs)) 287 if (user_mode(regs))
288 return NOTIFY_DONE; 288 return NOTIFY_DONE;
289 289
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 80e2ba694bab..29811f043399 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -251,7 +251,7 @@ void sp_work_handle_request(void)
251 memset(&tz, 0, sizeof(tz)); 251 memset(&tz, 0, sizeof(tz));
252 if ((ret.retval = sp_syscall(__NR_gettimeofday, (int)&tv, 252 if ((ret.retval = sp_syscall(__NR_gettimeofday, (int)&tv,
253 (int)&tz, 0, 0)) == 0) 253 (int)&tz, 0, 0)) == 0)
254 ret.retval = tv.tv_sec; 254 ret.retval = tv.tv_sec;
255 break; 255 break;
256 256
257 case MTSP_SYSCALL_EXIT: 257 case MTSP_SYSCALL_EXIT:
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index c2dab140dc98..6343b4a5b835 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -341,3 +341,10 @@ asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf,
341{ 341{
342 return sys_lookup_dcookie(merge_64(a0, a1), buf, len); 342 return sys_lookup_dcookie(merge_64(a0, a1), buf, len);
343} 343}
344
345SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags,
346 u64, a3, u64, a4, int, dfd, const char __user *, pathname)
347{
348 return sys_fanotify_mark(fanotify_fd, flags, merge_64(a3, a4),
349 dfd, pathname);
350}
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 17202bbe843f..584415eef8c9 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -583,7 +583,10 @@ einval: li v0, -ENOSYS
583 sys sys_rt_tgsigqueueinfo 4 583 sys sys_rt_tgsigqueueinfo 4
584 sys sys_perf_event_open 5 584 sys sys_perf_event_open 5
585 sys sys_accept4 4 585 sys sys_accept4 4
586 sys sys_recvmmsg 5 586 sys sys_recvmmsg 5 /* 4335 */
587 sys sys_fanotify_init 2
588 sys sys_fanotify_mark 6
589 sys sys_prlimit64 4
587 .endm 590 .endm
588 591
589 /* We pre-compute the number of _instruction_ bytes needed to 592 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index a8a6c596eb04..5573f8e4e326 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -416,9 +416,12 @@ sys_call_table:
416 PTR sys_pipe2 416 PTR sys_pipe2
417 PTR sys_inotify_init1 417 PTR sys_inotify_init1
418 PTR sys_preadv 418 PTR sys_preadv
419 PTR sys_pwritev /* 5390 */ 419 PTR sys_pwritev /* 5290 */
420 PTR sys_rt_tgsigqueueinfo 420 PTR sys_rt_tgsigqueueinfo
421 PTR sys_perf_event_open 421 PTR sys_perf_event_open
422 PTR sys_accept4 422 PTR sys_accept4
423 PTR sys_recvmmsg 423 PTR sys_recvmmsg
424 PTR sys_fanotify_init /* 5295 */
425 PTR sys_fanotify_mark
426 PTR sys_prlimit64
424 .size sys_call_table,.-sys_call_table 427 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index a3d66137731a..1e38ec97672e 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -419,5 +419,8 @@ EXPORT(sysn32_call_table)
419 PTR sys_perf_event_open 419 PTR sys_perf_event_open
420 PTR sys_accept4 420 PTR sys_accept4
421 PTR compat_sys_recvmmsg 421 PTR compat_sys_recvmmsg
422 PTR sys_getdents 422 PTR sys_getdents64
423 PTR sys_fanotify_init /* 6300 */
424 PTR sys_fanotify_mark
425 PTR sys_prlimit64
423 .size sysn32_call_table,.-sysn32_call_table 426 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 813689ef2384..171979fc98e5 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -538,5 +538,8 @@ sys_call_table:
538 PTR compat_sys_rt_tgsigqueueinfo 538 PTR compat_sys_rt_tgsigqueueinfo
539 PTR sys_perf_event_open 539 PTR sys_perf_event_open
540 PTR sys_accept4 540 PTR sys_accept4
541 PTR compat_sys_recvmmsg 541 PTR compat_sys_recvmmsg /* 4335 */
542 PTR sys_fanotify_init
543 PTR sys_32_fanotify_mark
544 PTR sys_prlimit64
542 .size sys_call_table,.-sys_call_table 545 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 7ba890860d98..469d4019f795 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -44,27 +44,39 @@ static inline int cpu_is_noncoherent_r10000(struct device *dev)
44 44
45static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp) 45static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
46{ 46{
47 gfp_t dma_flag;
48
47 /* ignore region specifiers */ 49 /* ignore region specifiers */
48 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM); 50 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
49 51
50#ifdef CONFIG_ZONE_DMA 52#ifdef CONFIG_ISA
51 if (dev == NULL) 53 if (dev == NULL)
52 gfp |= __GFP_DMA; 54 dma_flag = __GFP_DMA;
53 else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
54 gfp |= __GFP_DMA;
55 else 55 else
56#endif 56#endif
57#ifdef CONFIG_ZONE_DMA32 57#if defined(CONFIG_ZONE_DMA32) && defined(CONFIG_ZONE_DMA)
58 if (dev->coherent_dma_mask < DMA_BIT_MASK(32)) 58 if (dev->coherent_dma_mask < DMA_BIT_MASK(32))
59 gfp |= __GFP_DMA32; 59 dma_flag = __GFP_DMA;
60 else if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
61 dma_flag = __GFP_DMA32;
62 else
63#endif
64#if defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_ZONE_DMA)
65 if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
66 dma_flag = __GFP_DMA32;
67 else
68#endif
69#if defined(CONFIG_ZONE_DMA) && !defined(CONFIG_ZONE_DMA32)
70 if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
71 dma_flag = __GFP_DMA;
60 else 72 else
61#endif 73#endif
62 ; 74 dma_flag = 0;
63 75
64 /* Don't invoke OOM killer */ 76 /* Don't invoke OOM killer */
65 gfp |= __GFP_NORETRY; 77 gfp |= __GFP_NORETRY;
66 78
67 return gfp; 79 return gfp | dma_flag;
68} 80}
69 81
70void *dma_alloc_noncoherent(struct device *dev, size_t size, 82void *dma_alloc_noncoherent(struct device *dev, size_t size,
diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c
index 1ef75cd80a0d..274af3be1442 100644
--- a/arch/mips/mm/sc-rm7k.c
+++ b/arch/mips/mm/sc-rm7k.c
@@ -30,7 +30,7 @@
30#define tc_lsize 32 30#define tc_lsize 32
31 31
32extern unsigned long icache_way_size, dcache_way_size; 32extern unsigned long icache_way_size, dcache_way_size;
33unsigned long tcache_size; 33static unsigned long tcache_size;
34 34
35#include <asm/r4kcache.h> 35#include <asm/r4kcache.h>
36 36
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 15949b0be811..b79b24afe3a2 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -385,6 +385,8 @@ static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap);
385 */ 385 */
386 386
387#define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK 387#define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK
388#define X GIC_UNUSED
389
388static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = { 390static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
389 { X, X, X, X, 0 }, 391 { X, X, X, X, 0 },
390 { X, X, X, X, 0 }, 392 { X, X, X, X, 0 },
@@ -404,6 +406,7 @@ static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
404 { X, X, X, X, 0 }, 406 { X, X, X, X, 0 },
405 /* The remainder of this table is initialised by fill_ipi_map */ 407 /* The remainder of this table is initialised by fill_ipi_map */
406}; 408};
409#undef X
407 410
408/* 411/*
409 * GCMP needs to be detected before any SMP initialisation 412 * GCMP needs to be detected before any SMP initialisation
diff --git a/arch/mips/pci/pci-rc32434.c b/arch/mips/pci/pci-rc32434.c
index 71f7d27b0d4c..f31218e17d3c 100644
--- a/arch/mips/pci/pci-rc32434.c
+++ b/arch/mips/pci/pci-rc32434.c
@@ -118,7 +118,7 @@ static int __init rc32434_pcibridge_init(void)
118 if (!((pcicvalue == PCIM_H_EA) || 118 if (!((pcicvalue == PCIM_H_EA) ||
119 (pcicvalue == PCIM_H_IA_FIX) || 119 (pcicvalue == PCIM_H_IA_FIX) ||
120 (pcicvalue == PCIM_H_IA_RR))) { 120 (pcicvalue == PCIM_H_IA_RR))) {
121 pr_err(KERN_ERR "PCI init error!!!\n"); 121 pr_err("PCI init error!!!\n");
122 /* Not in Host Mode, return ERROR */ 122 /* Not in Host Mode, return ERROR */
123 return -1; 123 return -1;
124 } 124 }
diff --git a/arch/mips/pnx8550/common/reset.c b/arch/mips/pnx8550/common/reset.c
index fadd8744a6bc..e7a12ff304b9 100644
--- a/arch/mips/pnx8550/common/reset.c
+++ b/arch/mips/pnx8550/common/reset.c
@@ -22,29 +22,19 @@
22 */ 22 */
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24 24
25#include <asm/processor.h>
25#include <asm/reboot.h> 26#include <asm/reboot.h>
26#include <glb.h> 27#include <glb.h>
27 28
28void pnx8550_machine_restart(char *command) 29void pnx8550_machine_restart(char *command)
29{ 30{
30 char head[] = "************* Machine restart *************";
31 char foot[] = "*******************************************";
32
33 printk("\n\n");
34 printk("%s\n", head);
35 if (command != NULL)
36 printk("* %s\n", command);
37 printk("%s\n", foot);
38
39 PNX8550_RST_CTL = PNX8550_RST_DO_SW_RST; 31 PNX8550_RST_CTL = PNX8550_RST_DO_SW_RST;
40} 32}
41 33
42void pnx8550_machine_halt(void) 34void pnx8550_machine_halt(void)
43{ 35{
44 printk("*** Machine halt. (Not implemented) ***\n"); 36 while (1) {
45} 37 if (cpu_wait)
46 38 cpu_wait();
47void pnx8550_machine_power_off(void) 39 }
48{
49 printk("*** Machine power off. (Not implemented) ***\n");
50} 40}
diff --git a/arch/mips/pnx8550/common/setup.c b/arch/mips/pnx8550/common/setup.c
index 64246c9c875c..43cb3945fdbf 100644
--- a/arch/mips/pnx8550/common/setup.c
+++ b/arch/mips/pnx8550/common/setup.c
@@ -44,7 +44,6 @@
44extern void __init board_setup(void); 44extern void __init board_setup(void);
45extern void pnx8550_machine_restart(char *); 45extern void pnx8550_machine_restart(char *);
46extern void pnx8550_machine_halt(void); 46extern void pnx8550_machine_halt(void);
47extern void pnx8550_machine_power_off(void);
48extern struct resource ioport_resource; 47extern struct resource ioport_resource;
49extern struct resource iomem_resource; 48extern struct resource iomem_resource;
50extern char *prom_getcmdline(void); 49extern char *prom_getcmdline(void);
@@ -100,7 +99,7 @@ void __init plat_mem_setup(void)
100 99
101 _machine_restart = pnx8550_machine_restart; 100 _machine_restart = pnx8550_machine_restart;
102 _machine_halt = pnx8550_machine_halt; 101 _machine_halt = pnx8550_machine_halt;
103 pm_power_off = pnx8550_machine_power_off; 102 pm_power_off = pnx8550_machine_halt;
104 103
105 /* Clear the Global 2 Register, PCI Inta Output Enable Registers 104 /* Clear the Global 2 Register, PCI Inta Output Enable Registers
106 Bit 1:Enable DAC Powerdown 105 Bit 1:Enable DAC Powerdown
diff --git a/arch/mn10300/kernel/module.c b/arch/mn10300/kernel/module.c
index 6aea7fd76993..196a111e2e29 100644
--- a/arch/mn10300/kernel/module.c
+++ b/arch/mn10300/kernel/module.c
@@ -206,7 +206,7 @@ int module_finalize(const Elf_Ehdr *hdr,
206 const Elf_Shdr *sechdrs, 206 const Elf_Shdr *sechdrs,
207 struct module *me) 207 struct module *me)
208{ 208{
209 return module_bug_finalize(hdr, sechdrs, me); 209 return 0;
210} 210}
211 211
212/* 212/*
@@ -214,5 +214,4 @@ int module_finalize(const Elf_Ehdr *hdr,
214 */ 214 */
215void module_arch_cleanup(struct module *mod) 215void module_arch_cleanup(struct module *mod)
216{ 216{
217 module_bug_cleanup(mod);
218} 217}
diff --git a/arch/mn10300/mm/cache.c b/arch/mn10300/mm/cache.c
index 1b76719ec1c3..9261217e8d2c 100644
--- a/arch/mn10300/mm/cache.c
+++ b/arch/mn10300/mm/cache.c
@@ -54,13 +54,30 @@ EXPORT_SYMBOL(flush_icache_page);
54void flush_icache_range(unsigned long start, unsigned long end) 54void flush_icache_range(unsigned long start, unsigned long end)
55{ 55{
56#ifdef CONFIG_MN10300_CACHE_WBACK 56#ifdef CONFIG_MN10300_CACHE_WBACK
57 unsigned long addr, size, off; 57 unsigned long addr, size, base, off;
58 struct page *page; 58 struct page *page;
59 pgd_t *pgd; 59 pgd_t *pgd;
60 pud_t *pud; 60 pud_t *pud;
61 pmd_t *pmd; 61 pmd_t *pmd;
62 pte_t *ppte, pte; 62 pte_t *ppte, pte;
63 63
64 if (end > 0x80000000UL) {
65 /* addresses above 0xa0000000 do not go through the cache */
66 if (end > 0xa0000000UL) {
67 end = 0xa0000000UL;
68 if (start >= end)
69 return;
70 }
71
72 /* kernel addresses between 0x80000000 and 0x9fffffff do not
73 * require page tables, so we just map such addresses directly */
74 base = (start >= 0x80000000UL) ? start : 0x80000000UL;
75 mn10300_dcache_flush_range(base, end);
76 if (base == start)
77 goto invalidate;
78 end = base;
79 }
80
64 for (; start < end; start += size) { 81 for (; start < end; start += size) {
65 /* work out how much of the page to flush */ 82 /* work out how much of the page to flush */
66 off = start & (PAGE_SIZE - 1); 83 off = start & (PAGE_SIZE - 1);
@@ -104,6 +121,7 @@ void flush_icache_range(unsigned long start, unsigned long end)
104 } 121 }
105#endif 122#endif
106 123
124invalidate:
107 mn10300_icache_inv(); 125 mn10300_icache_inv();
108} 126}
109EXPORT_SYMBOL(flush_icache_range); 127EXPORT_SYMBOL(flush_icache_range);
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index 159a2b81e90c..6e81bb596e5b 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -941,11 +941,10 @@ int module_finalize(const Elf_Ehdr *hdr,
941 nsyms = newptr - (Elf_Sym *)symhdr->sh_addr; 941 nsyms = newptr - (Elf_Sym *)symhdr->sh_addr;
942 DEBUGP("NEW num_symtab %lu\n", nsyms); 942 DEBUGP("NEW num_symtab %lu\n", nsyms);
943 symhdr->sh_size = nsyms * sizeof(Elf_Sym); 943 symhdr->sh_size = nsyms * sizeof(Elf_Sym);
944 return module_bug_finalize(hdr, sechdrs, me); 944 return 0;
945} 945}
946 946
947void module_arch_cleanup(struct module *mod) 947void module_arch_cleanup(struct module *mod)
948{ 948{
949 deregister_unwind_table(mod); 949 deregister_unwind_table(mod);
950 module_bug_cleanup(mod);
951} 950}
diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
index 477c663e0140..49cee9df225b 100644
--- a/arch/powerpc/kernel/module.c
+++ b/arch/powerpc/kernel/module.c
@@ -63,11 +63,6 @@ int module_finalize(const Elf_Ehdr *hdr,
63 const Elf_Shdr *sechdrs, struct module *me) 63 const Elf_Shdr *sechdrs, struct module *me)
64{ 64{
65 const Elf_Shdr *sect; 65 const Elf_Shdr *sect;
66 int err;
67
68 err = module_bug_finalize(hdr, sechdrs, me);
69 if (err)
70 return err;
71 66
72 /* Apply feature fixups */ 67 /* Apply feature fixups */
73 sect = find_section(hdr, sechdrs, "__ftr_fixup"); 68 sect = find_section(hdr, sechdrs, "__ftr_fixup");
@@ -101,5 +96,4 @@ int module_finalize(const Elf_Ehdr *hdr,
101 96
102void module_arch_cleanup(struct module *mod) 97void module_arch_cleanup(struct module *mod)
103{ 98{
104 module_bug_cleanup(mod);
105} 99}
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 5b243bd3eb3b..3dc2a8d262b8 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -57,7 +57,7 @@ static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
57 int id_match = 0; 57 int id_match = 0;
58 58
59 if (dev == NULL || id == NULL) 59 if (dev == NULL || id == NULL)
60 return NULL; 60 return clk;
61 61
62 mutex_lock(&clocks_mutex); 62 mutex_lock(&clocks_mutex);
63 list_for_each_entry(p, &clocks, node) { 63 list_for_each_entry(p, &clocks, node) {
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 45c0cb9b67e6..18c104820198 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -99,7 +99,7 @@ static void __init efika_pcisetup(void)
99 if (bus_range == NULL || len < 2 * sizeof(int)) { 99 if (bus_range == NULL || len < 2 * sizeof(int)) {
100 printk(KERN_WARNING EFIKA_PLATFORM_NAME 100 printk(KERN_WARNING EFIKA_PLATFORM_NAME
101 ": Can't get bus-range for %s\n", pcictrl->full_name); 101 ": Can't get bus-range for %s\n", pcictrl->full_name);
102 return; 102 goto out_put;
103 } 103 }
104 104
105 if (bus_range[1] == bus_range[0]) 105 if (bus_range[1] == bus_range[0])
@@ -111,12 +111,12 @@ static void __init efika_pcisetup(void)
111 printk(" controlled by %s\n", pcictrl->full_name); 111 printk(" controlled by %s\n", pcictrl->full_name);
112 printk("\n"); 112 printk("\n");
113 113
114 hose = pcibios_alloc_controller(of_node_get(pcictrl)); 114 hose = pcibios_alloc_controller(pcictrl);
115 if (!hose) { 115 if (!hose) {
116 printk(KERN_WARNING EFIKA_PLATFORM_NAME 116 printk(KERN_WARNING EFIKA_PLATFORM_NAME
117 ": Can't allocate PCI controller structure for %s\n", 117 ": Can't allocate PCI controller structure for %s\n",
118 pcictrl->full_name); 118 pcictrl->full_name);
119 return; 119 goto out_put;
120 } 120 }
121 121
122 hose->first_busno = bus_range[0]; 122 hose->first_busno = bus_range[0];
@@ -124,6 +124,9 @@ static void __init efika_pcisetup(void)
124 hose->ops = &rtas_pci_ops; 124 hose->ops = &rtas_pci_ops;
125 125
126 pci_process_bridge_OF_ranges(hose, pcictrl, 0); 126 pci_process_bridge_OF_ranges(hose, pcictrl, 0);
127 return;
128out_put:
129 of_node_put(pcictrl);
127} 130}
128 131
129#else 132#else
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 6e905314ad5d..41f3a7eda1de 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -325,12 +325,16 @@ int mpc5200_psc_ac97_gpio_reset(int psc_number)
325 clrbits32(&simple_gpio->simple_dvo, sync | out); 325 clrbits32(&simple_gpio->simple_dvo, sync | out);
326 clrbits8(&wkup_gpio->wkup_dvo, reset); 326 clrbits8(&wkup_gpio->wkup_dvo, reset);
327 327
328 /* wait at lease 1 us */ 328 /* wait for 1 us */
329 udelay(2); 329 udelay(1);
330 330
331 /* Deassert reset */ 331 /* Deassert reset */
332 setbits8(&wkup_gpio->wkup_dvo, reset); 332 setbits8(&wkup_gpio->wkup_dvo, reset);
333 333
334 /* wait at least 200ns */
335 /* 7 ~= (200ns * timebase) / ns2sec */
336 __delay(7);
337
334 /* Restore pin-muxing */ 338 /* Restore pin-muxing */
335 out_be32(&simple_gpio->port_config, mux); 339 out_be32(&simple_gpio->port_config, mux);
336 340
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index 22cfd634c355..f7167ee4604c 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -407,10 +407,9 @@ int module_finalize(const Elf_Ehdr *hdr,
407{ 407{
408 vfree(me->arch.syminfo); 408 vfree(me->arch.syminfo);
409 me->arch.syminfo = NULL; 409 me->arch.syminfo = NULL;
410 return module_bug_finalize(hdr, sechdrs, me); 410 return 0;
411} 411}
412 412
413void module_arch_cleanup(struct module *mod) 413void module_arch_cleanup(struct module *mod)
414{ 414{
415 module_bug_cleanup(mod);
416} 415}
diff --git a/arch/sh/kernel/module.c b/arch/sh/kernel/module.c
index 43adddfe4c04..ae0be697a89e 100644
--- a/arch/sh/kernel/module.c
+++ b/arch/sh/kernel/module.c
@@ -149,13 +149,11 @@ int module_finalize(const Elf_Ehdr *hdr,
149 int ret = 0; 149 int ret = 0;
150 150
151 ret |= module_dwarf_finalize(hdr, sechdrs, me); 151 ret |= module_dwarf_finalize(hdr, sechdrs, me);
152 ret |= module_bug_finalize(hdr, sechdrs, me);
153 152
154 return ret; 153 return ret;
155} 154}
156 155
157void module_arch_cleanup(struct module *mod) 156void module_arch_cleanup(struct module *mod)
158{ 157{
159 module_bug_cleanup(mod);
160 module_dwarf_cleanup(mod); 158 module_dwarf_cleanup(mod);
161} 159}
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 2ab233ba32c1..47d0c37897d5 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -255,18 +255,6 @@ static void uml_net_tx_timeout(struct net_device *dev)
255 netif_wake_queue(dev); 255 netif_wake_queue(dev);
256} 256}
257 257
258static int uml_net_set_mac(struct net_device *dev, void *addr)
259{
260 struct uml_net_private *lp = netdev_priv(dev);
261 struct sockaddr *hwaddr = addr;
262
263 spin_lock_irq(&lp->lock);
264 eth_mac_addr(dev, hwaddr->sa_data);
265 spin_unlock_irq(&lp->lock);
266
267 return 0;
268}
269
270static int uml_net_change_mtu(struct net_device *dev, int new_mtu) 258static int uml_net_change_mtu(struct net_device *dev, int new_mtu)
271{ 259{
272 dev->mtu = new_mtu; 260 dev->mtu = new_mtu;
@@ -373,7 +361,7 @@ static const struct net_device_ops uml_netdev_ops = {
373 .ndo_start_xmit = uml_net_start_xmit, 361 .ndo_start_xmit = uml_net_start_xmit,
374 .ndo_set_multicast_list = uml_net_set_multicast_list, 362 .ndo_set_multicast_list = uml_net_set_multicast_list,
375 .ndo_tx_timeout = uml_net_tx_timeout, 363 .ndo_tx_timeout = uml_net_tx_timeout,
376 .ndo_set_mac_address = uml_net_set_mac, 364 .ndo_set_mac_address = eth_mac_addr,
377 .ndo_change_mtu = uml_net_change_mtu, 365 .ndo_change_mtu = uml_net_change_mtu,
378 .ndo_validate_addr = eth_validate_addr, 366 .ndo_validate_addr = eth_validate_addr,
379}; 367};
@@ -472,7 +460,8 @@ static void eth_configure(int n, void *init, char *mac,
472 ((*transport->user->init)(&lp->user, dev) != 0)) 460 ((*transport->user->init)(&lp->user, dev) != 0))
473 goto out_unregister; 461 goto out_unregister;
474 462
475 eth_mac_addr(dev, device->mac); 463 /* don't use eth_mac_addr, it will not work here */
464 memcpy(dev->dev_addr, device->mac, ETH_ALEN);
476 dev->mtu = transport->user->mtu; 465 dev->mtu = transport->user->mtu;
477 dev->netdev_ops = &uml_netdev_ops; 466 dev->netdev_ops = &uml_netdev_ops;
478 dev->ethtool_ops = &uml_net_ethtool_ops; 467 dev->ethtool_ops = &uml_net_ethtool_ops;
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 0350311906ae..2d93bdbc9ac0 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -34,7 +34,7 @@
34#include <asm/ia32.h> 34#include <asm/ia32.h>
35 35
36#undef WARN_OLD 36#undef WARN_OLD
37#undef CORE_DUMP /* probably broken */ 37#undef CORE_DUMP /* definitely broken */
38 38
39static int load_aout_binary(struct linux_binprm *, struct pt_regs *regs); 39static int load_aout_binary(struct linux_binprm *, struct pt_regs *regs);
40static int load_aout_library(struct file *); 40static int load_aout_library(struct file *);
@@ -131,21 +131,15 @@ static void set_brk(unsigned long start, unsigned long end)
131 * macros to write out all the necessary info. 131 * macros to write out all the necessary info.
132 */ 132 */
133 133
134static int dump_write(struct file *file, const void *addr, int nr) 134#include <linux/coredump.h>
135{
136 return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
137}
138 135
139#define DUMP_WRITE(addr, nr) \ 136#define DUMP_WRITE(addr, nr) \
140 if (!dump_write(file, (void *)(addr), (nr))) \ 137 if (!dump_write(file, (void *)(addr), (nr))) \
141 goto end_coredump; 138 goto end_coredump;
142 139
143#define DUMP_SEEK(offset) \ 140#define DUMP_SEEK(offset) \
144 if (file->f_op->llseek) { \ 141 if (!dump_seek(file, offset)) \
145 if (file->f_op->llseek(file, (offset), 0) != (offset)) \ 142 goto end_coredump;
146 goto end_coredump; \
147 } else \
148 file->f_pos = (offset)
149 143
150#define START_DATA() (u.u_tsize << PAGE_SHIFT) 144#define START_DATA() (u.u_tsize << PAGE_SHIFT)
151#define START_STACK(u) (u.start_stack) 145#define START_STACK(u) (u.start_stack)
@@ -217,12 +211,6 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
217 dump_size = dump.u_ssize << PAGE_SHIFT; 211 dump_size = dump.u_ssize << PAGE_SHIFT;
218 DUMP_WRITE(dump_start, dump_size); 212 DUMP_WRITE(dump_start, dump_size);
219 } 213 }
220 /*
221 * Finally dump the task struct. Not be used by gdb, but
222 * could be useful
223 */
224 set_fs(KERNEL_DS);
225 DUMP_WRITE(current, sizeof(*current));
226end_coredump: 214end_coredump:
227 set_fs(fs); 215 set_fs(fs);
228 return has_dumped; 216 return has_dumped;
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index fb7a5f052e2b..fb16f17e59be 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -61,7 +61,7 @@ struct cstate_entry {
61 unsigned int ecx; 61 unsigned int ecx;
62 } states[ACPI_PROCESSOR_MAX_POWER]; 62 } states[ACPI_PROCESSOR_MAX_POWER];
63}; 63};
64static struct cstate_entry *cpu_cstate_entry; /* per CPU ptr */ 64static struct cstate_entry __percpu *cpu_cstate_entry; /* per CPU ptr */
65 65
66static short mwait_supported[ACPI_PROCESSOR_MAX_POWER]; 66static short mwait_supported[ACPI_PROCESSOR_MAX_POWER];
67 67
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index f1efebaf5510..5c5b8f3dddb5 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -306,14 +306,19 @@ void arch_init_copy_chip_data(struct irq_desc *old_desc,
306 306
307 old_cfg = old_desc->chip_data; 307 old_cfg = old_desc->chip_data;
308 308
309 memcpy(cfg, old_cfg, sizeof(struct irq_cfg)); 309 cfg->vector = old_cfg->vector;
310 cfg->move_in_progress = old_cfg->move_in_progress;
311 cpumask_copy(cfg->domain, old_cfg->domain);
312 cpumask_copy(cfg->old_domain, old_cfg->old_domain);
310 313
311 init_copy_irq_2_pin(old_cfg, cfg, node); 314 init_copy_irq_2_pin(old_cfg, cfg, node);
312} 315}
313 316
314static void free_irq_cfg(struct irq_cfg *old_cfg) 317static void free_irq_cfg(struct irq_cfg *cfg)
315{ 318{
316 kfree(old_cfg); 319 free_cpumask_var(cfg->domain);
320 free_cpumask_var(cfg->old_domain);
321 kfree(cfg);
317} 322}
318 323
319void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc) 324void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 490dac63c2d2..f2f9ac7da25c 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -545,7 +545,7 @@ void __cpuinit cpu_detect(struct cpuinfo_x86 *c)
545 } 545 }
546} 546}
547 547
548static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c) 548void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
549{ 549{
550 u32 tfms, xlvl; 550 u32 tfms, xlvl;
551 u32 ebx; 551 u32 ebx;
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h
index 3624e8a0f71b..f668bb1f7d43 100644
--- a/arch/x86/kernel/cpu/cpu.h
+++ b/arch/x86/kernel/cpu/cpu.h
@@ -33,5 +33,6 @@ extern const struct cpu_dev *const __x86_cpu_dev_start[],
33 *const __x86_cpu_dev_end[]; 33 *const __x86_cpu_dev_end[];
34 34
35extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c); 35extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c);
36extern void get_cpu_cap(struct cpuinfo_x86 *c);
36 37
37#endif 38#endif
diff --git a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
index 994230d4dc4e..4f6f679f2799 100644
--- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
@@ -368,16 +368,22 @@ static int __init pcc_cpufreq_do_osc(acpi_handle *handle)
368 return -ENODEV; 368 return -ENODEV;
369 369
370 out_obj = output.pointer; 370 out_obj = output.pointer;
371 if (out_obj->type != ACPI_TYPE_BUFFER) 371 if (out_obj->type != ACPI_TYPE_BUFFER) {
372 return -ENODEV; 372 ret = -ENODEV;
373 goto out_free;
374 }
373 375
374 errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0); 376 errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0);
375 if (errors) 377 if (errors) {
376 return -ENODEV; 378 ret = -ENODEV;
379 goto out_free;
380 }
377 381
378 supported = *((u32 *)(out_obj->buffer.pointer + 4)); 382 supported = *((u32 *)(out_obj->buffer.pointer + 4));
379 if (!(supported & 0x1)) 383 if (!(supported & 0x1)) {
380 return -ENODEV; 384 ret = -ENODEV;
385 goto out_free;
386 }
381 387
382out_free: 388out_free:
383 kfree(output.pointer); 389 kfree(output.pointer);
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 85f69cdeae10..b4389441efbb 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -39,6 +39,7 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
39 misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID; 39 misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID;
40 wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable); 40 wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
41 c->cpuid_level = cpuid_eax(0); 41 c->cpuid_level = cpuid_eax(0);
42 get_cpu_cap(c);
42 } 43 }
43 } 44 }
44 45
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 5e975298fa81..39aaee5c1ab2 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -141,6 +141,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
141 address = (low & MASK_BLKPTR_LO) >> 21; 141 address = (low & MASK_BLKPTR_LO) >> 21;
142 if (!address) 142 if (!address)
143 break; 143 break;
144
144 address += MCG_XBLK_ADDR; 145 address += MCG_XBLK_ADDR;
145 } else 146 } else
146 ++address; 147 ++address;
@@ -148,12 +149,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
148 if (rdmsr_safe(address, &low, &high)) 149 if (rdmsr_safe(address, &low, &high))
149 break; 150 break;
150 151
151 if (!(high & MASK_VALID_HI)) { 152 if (!(high & MASK_VALID_HI))
152 if (block) 153 continue;
153 continue;
154 else
155 break;
156 }
157 154
158 if (!(high & MASK_CNTP_HI) || 155 if (!(high & MASK_CNTP_HI) ||
159 (high & MASK_LOCKED_HI)) 156 (high & MASK_LOCKED_HI))
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index d9368eeda309..169d8804a9f8 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -216,7 +216,7 @@ static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev,
216 err = sysfs_add_file_to_group(&sys_dev->kobj, 216 err = sysfs_add_file_to_group(&sys_dev->kobj,
217 &attr_core_power_limit_count.attr, 217 &attr_core_power_limit_count.attr,
218 thermal_attr_group.name); 218 thermal_attr_group.name);
219 if (cpu_has(c, X86_FEATURE_PTS)) 219 if (cpu_has(c, X86_FEATURE_PTS)) {
220 err = sysfs_add_file_to_group(&sys_dev->kobj, 220 err = sysfs_add_file_to_group(&sys_dev->kobj,
221 &attr_package_throttle_count.attr, 221 &attr_package_throttle_count.attr,
222 thermal_attr_group.name); 222 thermal_attr_group.name);
@@ -224,6 +224,7 @@ static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev,
224 err = sysfs_add_file_to_group(&sys_dev->kobj, 224 err = sysfs_add_file_to_group(&sys_dev->kobj,
225 &attr_package_power_limit_count.attr, 225 &attr_package_power_limit_count.attr,
226 thermal_attr_group.name); 226 thermal_attr_group.name);
227 }
227 228
228 return err; 229 return err;
229} 230}
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index b560db3305be..249015173992 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -660,8 +660,12 @@ static int p4_pmu_handle_irq(struct pt_regs *regs)
660 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 660 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
661 int overflow; 661 int overflow;
662 662
663 if (!test_bit(idx, cpuc->active_mask)) 663 if (!test_bit(idx, cpuc->active_mask)) {
664 /* catch in-flight IRQs */
665 if (__test_and_clear_bit(idx, cpuc->running))
666 handled++;
664 continue; 667 continue;
668 }
665 669
666 event = cpuc->events[idx]; 670 event = cpuc->events[idx];
667 hwc = &event->hw; 671 hwc = &event->hw;
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 410fdb3f1939..7494999141b3 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -506,7 +506,7 @@ static int hpet_assign_irq(struct hpet_dev *dev)
506{ 506{
507 unsigned int irq; 507 unsigned int irq;
508 508
509 irq = create_irq(); 509 irq = create_irq_nr(0, -1);
510 if (!irq) 510 if (!irq)
511 return -EINVAL; 511 return -EINVAL;
512 512
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index e0bc186d7501..1c355c550960 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -239,11 +239,10 @@ int module_finalize(const Elf_Ehdr *hdr,
239 apply_paravirt(pseg, pseg + para->sh_size); 239 apply_paravirt(pseg, pseg + para->sh_size);
240 } 240 }
241 241
242 return module_bug_finalize(hdr, sechdrs, me); 242 return 0;
243} 243}
244 244
245void module_arch_cleanup(struct module *mod) 245void module_arch_cleanup(struct module *mod)
246{ 246{
247 alternatives_smp_module_del(mod); 247 alternatives_smp_module_del(mod);
248 module_bug_cleanup(mod);
249} 248}
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index bc5b9b8d4a33..81ed28cb36e6 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -766,7 +766,6 @@ static void init_vmcb(struct vcpu_svm *svm)
766 766
767 control->iopm_base_pa = iopm_base; 767 control->iopm_base_pa = iopm_base;
768 control->msrpm_base_pa = __pa(svm->msrpm); 768 control->msrpm_base_pa = __pa(svm->msrpm);
769 control->tsc_offset = 0;
770 control->int_ctl = V_INTR_MASKING_MASK; 769 control->int_ctl = V_INTR_MASKING_MASK;
771 770
772 init_seg(&save->es); 771 init_seg(&save->es);
@@ -902,6 +901,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
902 svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; 901 svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT;
903 svm->asid_generation = 0; 902 svm->asid_generation = 0;
904 init_vmcb(svm); 903 init_vmcb(svm);
904 svm->vmcb->control.tsc_offset = 0-native_read_tsc();
905 905
906 err = fx_init(&svm->vcpu); 906 err = fx_init(&svm->vcpu);
907 if (err) 907 if (err)
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index f9897f7a9ef1..9c0d0d399c30 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -420,9 +420,11 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
420 return -1; 420 return -1;
421 } 421 }
422 422
423 for_each_node_mask(i, nodes_parsed) 423 for (i = 0; i < num_node_memblks; i++)
424 e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, 424 e820_register_active_regions(memblk_nodeid[i],
425 nodes[i].end >> PAGE_SHIFT); 425 node_memblk_range[i].start >> PAGE_SHIFT,
426 node_memblk_range[i].end >> PAGE_SHIFT);
427
426 /* for out of order entries in SRAT */ 428 /* for out of order entries in SRAT */
427 sort_node_map(); 429 sort_node_map();
428 if (!nodes_cover_memory(nodes)) { 430 if (!nodes_cover_memory(nodes)) {
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 009b819f48d0..f1575c9a2572 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -674,6 +674,7 @@ static int __init ppro_init(char **cpu_type)
674 case 0x0f: 674 case 0x0f:
675 case 0x16: 675 case 0x16:
676 case 0x17: 676 case 0x17:
677 case 0x1d:
677 *cpu_type = "i386/core_2"; 678 *cpu_type = "i386/core_2";
678 break; 679 break;
679 case 0x1a: 680 case 0x1a:
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 1a5353a753fc..b2bb5aa3b054 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -489,8 +489,9 @@ static void xen_hvm_setup_cpu_clockevents(void)
489__init void xen_hvm_init_time_ops(void) 489__init void xen_hvm_init_time_ops(void)
490{ 490{
491 /* vector callback is needed otherwise we cannot receive interrupts 491 /* vector callback is needed otherwise we cannot receive interrupts
492 * on cpu > 0 */ 492 * on cpu > 0 and at this point we don't know how many cpus are
493 if (!xen_have_vector_callback && num_present_cpus() > 1) 493 * available */
494 if (!xen_have_vector_callback)
494 return; 495 return;
495 if (!xen_feature(XENFEAT_hvm_safe_pvclock)) { 496 if (!xen_feature(XENFEAT_hvm_safe_pvclock)) {
496 printk(KERN_INFO "Xen doesn't support pvclock on HVM," 497 printk(KERN_INFO "Xen doesn't support pvclock on HVM,"
diff --git a/block/elevator.c b/block/elevator.c
index 205b09a5bd9e..4e11559aa2b0 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -938,6 +938,7 @@ int elv_register_queue(struct request_queue *q)
938 } 938 }
939 } 939 }
940 kobject_uevent(&e->kobj, KOBJ_ADD); 940 kobject_uevent(&e->kobj, KOBJ_ADD);
941 e->registered = 1;
941 } 942 }
942 return error; 943 return error;
943} 944}
@@ -947,6 +948,7 @@ static void __elv_unregister_queue(struct elevator_queue *e)
947{ 948{
948 kobject_uevent(&e->kobj, KOBJ_REMOVE); 949 kobject_uevent(&e->kobj, KOBJ_REMOVE);
949 kobject_del(&e->kobj); 950 kobject_del(&e->kobj);
951 e->registered = 0;
950} 952}
951 953
952void elv_unregister_queue(struct request_queue *q) 954void elv_unregister_queue(struct request_queue *q)
@@ -1042,11 +1044,13 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
1042 1044
1043 spin_unlock_irq(q->queue_lock); 1045 spin_unlock_irq(q->queue_lock);
1044 1046
1045 __elv_unregister_queue(old_elevator); 1047 if (old_elevator->registered) {
1048 __elv_unregister_queue(old_elevator);
1046 1049
1047 err = elv_register_queue(q); 1050 err = elv_register_queue(q);
1048 if (err) 1051 if (err)
1049 goto fail_register; 1052 goto fail_register;
1053 }
1050 1054
1051 /* 1055 /*
1052 * finally exit old elevator and turn off BYPASS. 1056 * finally exit old elevator and turn off BYPASS.
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index b811f2173f6f..88681aca88c5 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -105,7 +105,7 @@ config ACPI_EC_DEBUGFS
105 105
106 Be aware that using this interface can confuse your Embedded 106 Be aware that using this interface can confuse your Embedded
107 Controller in a way that a normal reboot is not enough. You then 107 Controller in a way that a normal reboot is not enough. You then
108 have to power of your system, and remove the laptop battery for 108 have to power off your system, and remove the laptop battery for
109 some seconds. 109 some seconds.
110 An Embedded Controller typically is available on laptops and reads 110 An Embedded Controller typically is available on laptops and reads
111 sensor values like battery state and temperature. 111 sensor values like battery state and temperature.
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index b76848c80be3..6b115f6c4313 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -382,31 +382,32 @@ static void acpi_pad_remove_sysfs(struct acpi_device *device)
382 device_remove_file(&device->dev, &dev_attr_rrtime); 382 device_remove_file(&device->dev, &dev_attr_rrtime);
383} 383}
384 384
385/* Query firmware how many CPUs should be idle */ 385/*
386static int acpi_pad_pur(acpi_handle handle, int *num_cpus) 386 * Query firmware how many CPUs should be idle
387 * return -1 on failure
388 */
389static int acpi_pad_pur(acpi_handle handle)
387{ 390{
388 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 391 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
389 union acpi_object *package; 392 union acpi_object *package;
390 int rev, num, ret = -EINVAL; 393 int num = -1;
391 394
392 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) 395 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer)))
393 return -EINVAL; 396 return num;
394 397
395 if (!buffer.length || !buffer.pointer) 398 if (!buffer.length || !buffer.pointer)
396 return -EINVAL; 399 return num;
397 400
398 package = buffer.pointer; 401 package = buffer.pointer;
399 if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) 402
400 goto out; 403 if (package->type == ACPI_TYPE_PACKAGE &&
401 rev = package->package.elements[0].integer.value; 404 package->package.count == 2 &&
402 num = package->package.elements[1].integer.value; 405 package->package.elements[0].integer.value == 1) /* rev 1 */
403 if (rev != 1 || num < 0) 406
404 goto out; 407 num = package->package.elements[1].integer.value;
405 *num_cpus = num; 408
406 ret = 0;
407out:
408 kfree(buffer.pointer); 409 kfree(buffer.pointer);
409 return ret; 410 return num;
410} 411}
411 412
412/* Notify firmware how many CPUs are idle */ 413/* Notify firmware how many CPUs are idle */
@@ -433,7 +434,8 @@ static void acpi_pad_handle_notify(acpi_handle handle)
433 uint32_t idle_cpus; 434 uint32_t idle_cpus;
434 435
435 mutex_lock(&isolated_cpus_lock); 436 mutex_lock(&isolated_cpus_lock);
436 if (acpi_pad_pur(handle, &num_cpus)) { 437 num_cpus = acpi_pad_pur(handle);
438 if (num_cpus < 0) {
437 mutex_unlock(&isolated_cpus_lock); 439 mutex_unlock(&isolated_cpus_lock);
438 return; 440 return;
439 } 441 }
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index df85b53a674f..7dad9160f209 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -854,6 +854,7 @@ struct acpi_bit_register_info {
854 ACPI_BITMASK_POWER_BUTTON_STATUS | \ 854 ACPI_BITMASK_POWER_BUTTON_STATUS | \
855 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ 855 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
856 ACPI_BITMASK_RT_CLOCK_STATUS | \ 856 ACPI_BITMASK_RT_CLOCK_STATUS | \
857 ACPI_BITMASK_PCIEXP_WAKE_DISABLE | \
857 ACPI_BITMASK_WAKE_STATUS) 858 ACPI_BITMASK_WAKE_STATUS)
858 859
859#define ACPI_BITMASK_TIMER_ENABLE 0x0001 860#define ACPI_BITMASK_TIMER_ENABLE 0x0001
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 74c24d517f81..4093522eed45 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -109,7 +109,7 @@ void acpi_ex_enter_interpreter(void)
109 * 109 *
110 * DESCRIPTION: Reacquire the interpreter execution region from within the 110 * DESCRIPTION: Reacquire the interpreter execution region from within the
111 * interpreter code. Failure to enter the interpreter region is a 111 * interpreter code. Failure to enter the interpreter region is a
112 * fatal system error. Used in conjuction with 112 * fatal system error. Used in conjunction with
113 * relinquish_interpreter 113 * relinquish_interpreter
114 * 114 *
115 ******************************************************************************/ 115 ******************************************************************************/
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index 22cfcfbd9fff..491191e6cf69 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -149,7 +149,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
149 149
150 /* 150 /*
151 * 16-, 32-, and 64-bit cases must use the move macros that perform 151 * 16-, 32-, and 64-bit cases must use the move macros that perform
152 * endian conversion and/or accomodate hardware that cannot perform 152 * endian conversion and/or accommodate hardware that cannot perform
153 * misaligned memory transfers 153 * misaligned memory transfers
154 */ 154 */
155 case ACPI_RSC_MOVE16: 155 case ACPI_RSC_MOVE16:
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig
index 907e350f1c7d..fca34ccfd294 100644
--- a/drivers/acpi/apei/Kconfig
+++ b/drivers/acpi/apei/Kconfig
@@ -34,6 +34,6 @@ config ACPI_APEI_ERST_DEBUG
34 depends on ACPI_APEI 34 depends on ACPI_APEI
35 help 35 help
36 ERST is a way provided by APEI to save and retrieve hardware 36 ERST is a way provided by APEI to save and retrieve hardware
37 error infomation to and from a persistent store. Enable this 37 error information to and from a persistent store. Enable this
38 if you want to debugging and testing the ERST kernel support 38 if you want to debugging and testing the ERST kernel support
39 and firmware implementation. 39 and firmware implementation.
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 73fd0c7487c1..4a904a4bf05f 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -445,11 +445,15 @@ EXPORT_SYMBOL_GPL(apei_resources_sub);
445int apei_resources_request(struct apei_resources *resources, 445int apei_resources_request(struct apei_resources *resources,
446 const char *desc) 446 const char *desc)
447{ 447{
448 struct apei_res *res, *res_bak; 448 struct apei_res *res, *res_bak = NULL;
449 struct resource *r; 449 struct resource *r;
450 int rc;
450 451
451 apei_resources_sub(resources, &apei_resources_all); 452 rc = apei_resources_sub(resources, &apei_resources_all);
453 if (rc)
454 return rc;
452 455
456 rc = -EINVAL;
453 list_for_each_entry(res, &resources->iomem, list) { 457 list_for_each_entry(res, &resources->iomem, list) {
454 r = request_mem_region(res->start, res->end - res->start, 458 r = request_mem_region(res->start, res->end - res->start,
455 desc); 459 desc);
@@ -475,7 +479,11 @@ int apei_resources_request(struct apei_resources *resources,
475 } 479 }
476 } 480 }
477 481
478 apei_resources_merge(&apei_resources_all, resources); 482 rc = apei_resources_merge(&apei_resources_all, resources);
483 if (rc) {
484 pr_err(APEI_PFX "Fail to merge resources!\n");
485 goto err_unmap_ioport;
486 }
479 487
480 return 0; 488 return 0;
481err_unmap_ioport: 489err_unmap_ioport:
@@ -491,12 +499,13 @@ err_unmap_iomem:
491 break; 499 break;
492 release_mem_region(res->start, res->end - res->start); 500 release_mem_region(res->start, res->end - res->start);
493 } 501 }
494 return -EINVAL; 502 return rc;
495} 503}
496EXPORT_SYMBOL_GPL(apei_resources_request); 504EXPORT_SYMBOL_GPL(apei_resources_request);
497 505
498void apei_resources_release(struct apei_resources *resources) 506void apei_resources_release(struct apei_resources *resources)
499{ 507{
508 int rc;
500 struct apei_res *res; 509 struct apei_res *res;
501 510
502 list_for_each_entry(res, &resources->iomem, list) 511 list_for_each_entry(res, &resources->iomem, list)
@@ -504,7 +513,9 @@ void apei_resources_release(struct apei_resources *resources)
504 list_for_each_entry(res, &resources->ioport, list) 513 list_for_each_entry(res, &resources->ioport, list)
505 release_region(res->start, res->end - res->start); 514 release_region(res->start, res->end - res->start);
506 515
507 apei_resources_sub(&apei_resources_all, resources); 516 rc = apei_resources_sub(&apei_resources_all, resources);
517 if (rc)
518 pr_err(APEI_PFX "Fail to sub resources!\n");
508} 519}
509EXPORT_SYMBOL_GPL(apei_resources_release); 520EXPORT_SYMBOL_GPL(apei_resources_release);
510 521
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 465c885938ee..cf29df69380b 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -426,7 +426,9 @@ DEFINE_SIMPLE_ATTRIBUTE(error_inject_fops, NULL,
426 426
427static int einj_check_table(struct acpi_table_einj *einj_tab) 427static int einj_check_table(struct acpi_table_einj *einj_tab)
428{ 428{
429 if (einj_tab->header_length != sizeof(struct acpi_table_einj)) 429 if ((einj_tab->header_length !=
430 (sizeof(struct acpi_table_einj) - sizeof(einj_tab->header)))
431 && (einj_tab->header_length != sizeof(struct acpi_table_einj)))
430 return -EINVAL; 432 return -EINVAL;
431 if (einj_tab->header.length < sizeof(struct acpi_table_einj)) 433 if (einj_tab->header.length < sizeof(struct acpi_table_einj))
432 return -EINVAL; 434 return -EINVAL;
diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c
index 5281ddda2777..da1228a9a544 100644
--- a/drivers/acpi/apei/erst-dbg.c
+++ b/drivers/acpi/apei/erst-dbg.c
@@ -2,7 +2,7 @@
2 * APEI Error Record Serialization Table debug support 2 * APEI Error Record Serialization Table debug support
3 * 3 *
4 * ERST is a way provided by APEI to save and retrieve hardware error 4 * ERST is a way provided by APEI to save and retrieve hardware error
5 * infomation to and from a persistent store. This file provide the 5 * information to and from a persistent store. This file provide the
6 * debugging/testing support for ERST kernel support and firmware 6 * debugging/testing support for ERST kernel support and firmware
7 * implementation. 7 * implementation.
8 * 8 *
@@ -111,11 +111,13 @@ retry:
111 goto out; 111 goto out;
112 } 112 }
113 if (len > erst_dbg_buf_len) { 113 if (len > erst_dbg_buf_len) {
114 kfree(erst_dbg_buf); 114 void *p;
115 rc = -ENOMEM; 115 rc = -ENOMEM;
116 erst_dbg_buf = kmalloc(len, GFP_KERNEL); 116 p = kmalloc(len, GFP_KERNEL);
117 if (!erst_dbg_buf) 117 if (!p)
118 goto out; 118 goto out;
119 kfree(erst_dbg_buf);
120 erst_dbg_buf = p;
119 erst_dbg_buf_len = len; 121 erst_dbg_buf_len = len;
120 goto retry; 122 goto retry;
121 } 123 }
@@ -150,11 +152,13 @@ static ssize_t erst_dbg_write(struct file *filp, const char __user *ubuf,
150 if (mutex_lock_interruptible(&erst_dbg_mutex)) 152 if (mutex_lock_interruptible(&erst_dbg_mutex))
151 return -EINTR; 153 return -EINTR;
152 if (usize > erst_dbg_buf_len) { 154 if (usize > erst_dbg_buf_len) {
153 kfree(erst_dbg_buf); 155 void *p;
154 rc = -ENOMEM; 156 rc = -ENOMEM;
155 erst_dbg_buf = kmalloc(usize, GFP_KERNEL); 157 p = kmalloc(usize, GFP_KERNEL);
156 if (!erst_dbg_buf) 158 if (!p)
157 goto out; 159 goto out;
160 kfree(erst_dbg_buf);
161 erst_dbg_buf = p;
158 erst_dbg_buf_len = usize; 162 erst_dbg_buf_len = usize;
159 } 163 }
160 rc = copy_from_user(erst_dbg_buf, ubuf, usize); 164 rc = copy_from_user(erst_dbg_buf, ubuf, usize);
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 18645f4e83cd..1211c03149e8 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -2,7 +2,7 @@
2 * APEI Error Record Serialization Table support 2 * APEI Error Record Serialization Table support
3 * 3 *
4 * ERST is a way provided by APEI to save and retrieve hardware error 4 * ERST is a way provided by APEI to save and retrieve hardware error
5 * infomation to and from a persistent store. 5 * information to and from a persistent store.
6 * 6 *
7 * For more information about ERST, please refer to ACPI Specification 7 * For more information about ERST, please refer to ACPI Specification
8 * version 4.0, section 17.4. 8 * version 4.0, section 17.4.
@@ -266,13 +266,30 @@ static int erst_exec_move_data(struct apei_exec_context *ctx,
266{ 266{
267 int rc; 267 int rc;
268 u64 offset; 268 u64 offset;
269 void *src, *dst;
270
271 /* ioremap does not work in interrupt context */
272 if (in_interrupt()) {
273 pr_warning(ERST_PFX
274 "MOVE_DATA can not be used in interrupt context");
275 return -EBUSY;
276 }
269 277
270 rc = __apei_exec_read_register(entry, &offset); 278 rc = __apei_exec_read_register(entry, &offset);
271 if (rc) 279 if (rc)
272 return rc; 280 return rc;
273 memmove((void *)ctx->dst_base + offset, 281
274 (void *)ctx->src_base + offset, 282 src = ioremap(ctx->src_base + offset, ctx->var2);
275 ctx->var2); 283 if (!src)
284 return -ENOMEM;
285 dst = ioremap(ctx->dst_base + offset, ctx->var2);
286 if (!dst)
287 return -ENOMEM;
288
289 memmove(dst, src, ctx->var2);
290
291 iounmap(src);
292 iounmap(dst);
276 293
277 return 0; 294 return 0;
278} 295}
@@ -750,7 +767,9 @@ __setup("erst_disable", setup_erst_disable);
750 767
751static int erst_check_table(struct acpi_table_erst *erst_tab) 768static int erst_check_table(struct acpi_table_erst *erst_tab)
752{ 769{
753 if (erst_tab->header_length != sizeof(struct acpi_table_erst)) 770 if ((erst_tab->header_length !=
771 (sizeof(struct acpi_table_erst) - sizeof(erst_tab->header)))
772 && (erst_tab->header_length != sizeof(struct acpi_table_einj)))
754 return -EINVAL; 773 return -EINVAL;
755 if (erst_tab->header.length < sizeof(struct acpi_table_erst)) 774 if (erst_tab->header.length < sizeof(struct acpi_table_erst))
756 return -EINVAL; 775 return -EINVAL;
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 385a6059714a..0d505e59214d 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -302,7 +302,7 @@ static int __devinit ghes_probe(struct platform_device *ghes_dev)
302 struct ghes *ghes = NULL; 302 struct ghes *ghes = NULL;
303 int rc = -EINVAL; 303 int rc = -EINVAL;
304 304
305 generic = ghes_dev->dev.platform_data; 305 generic = *(struct acpi_hest_generic **)ghes_dev->dev.platform_data;
306 if (!generic->enabled) 306 if (!generic->enabled)
307 return -ENODEV; 307 return -ENODEV;
308 308
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
index 343168d18266..1a3508a7fe03 100644
--- a/drivers/acpi/apei/hest.c
+++ b/drivers/acpi/apei/hest.c
@@ -137,20 +137,23 @@ static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data)
137 137
138static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) 138static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
139{ 139{
140 struct acpi_hest_generic *generic;
141 struct platform_device *ghes_dev; 140 struct platform_device *ghes_dev;
142 struct ghes_arr *ghes_arr = data; 141 struct ghes_arr *ghes_arr = data;
143 int rc; 142 int rc;
144 143
145 if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) 144 if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
146 return 0; 145 return 0;
147 generic = (struct acpi_hest_generic *)hest_hdr; 146
148 if (!generic->enabled) 147 if (!((struct acpi_hest_generic *)hest_hdr)->enabled)
149 return 0; 148 return 0;
150 ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id); 149 ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id);
151 if (!ghes_dev) 150 if (!ghes_dev)
152 return -ENOMEM; 151 return -ENOMEM;
153 ghes_dev->dev.platform_data = generic; 152
153 rc = platform_device_add_data(ghes_dev, &hest_hdr, sizeof(void *));
154 if (rc)
155 goto err;
156
154 rc = platform_device_add(ghes_dev); 157 rc = platform_device_add(ghes_dev);
155 if (rc) 158 if (rc)
156 goto err; 159 goto err;
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
index 8f8bd736d4ff..542e53903891 100644
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -142,7 +142,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr,
142 list_add_tail_rcu(&map->list, &acpi_iomaps); 142 list_add_tail_rcu(&map->list, &acpi_iomaps);
143 spin_unlock_irqrestore(&acpi_iomaps_lock, flags); 143 spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
144 144
145 return vaddr + (paddr - pg_off); 145 return map->vaddr + (paddr - map->paddr);
146err_unmap: 146err_unmap:
147 iounmap(vaddr); 147 iounmap(vaddr);
148 return NULL; 148 return NULL;
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index dc58402b0a17..98417201e9ce 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -273,7 +273,6 @@ static enum power_supply_property energy_battery_props[] = {
273 POWER_SUPPLY_PROP_CYCLE_COUNT, 273 POWER_SUPPLY_PROP_CYCLE_COUNT,
274 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 274 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
275 POWER_SUPPLY_PROP_VOLTAGE_NOW, 275 POWER_SUPPLY_PROP_VOLTAGE_NOW,
276 POWER_SUPPLY_PROP_CURRENT_NOW,
277 POWER_SUPPLY_PROP_POWER_NOW, 276 POWER_SUPPLY_PROP_POWER_NOW,
278 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 277 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
279 POWER_SUPPLY_PROP_ENERGY_FULL, 278 POWER_SUPPLY_PROP_ENERGY_FULL,
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 2bb28b9d91c4..af308d03f492 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -183,6 +183,8 @@ static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
183{ 183{
184 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); 184 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
185 acpi_osi_setup("!Windows 2006"); 185 acpi_osi_setup("!Windows 2006");
186 acpi_osi_setup("!Windows 2006 SP1");
187 acpi_osi_setup("!Windows 2006 SP2");
186 return 0; 188 return 0;
187} 189}
188static int __init dmi_disable_osi_win7(const struct dmi_system_id *d) 190static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
@@ -202,6 +204,23 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
202 }, 204 },
203 }, 205 },
204 { 206 {
207 /*
208 * There have a NVIF method in MSI GX723 DSDT need call by Nvidia
209 * driver (e.g. nouveau) when user press brightness hotkey.
210 * Currently, nouveau driver didn't do the job and it causes there
211 * have a infinite while loop in DSDT when user press hotkey.
212 * We add MSI GX723's dmi information to this table for workaround
213 * this issue.
214 * Will remove MSI GX723 from the table after nouveau grows support.
215 */
216 .callback = dmi_disable_osi_vista,
217 .ident = "MSI GX723",
218 .matches = {
219 DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
220 DMI_MATCH(DMI_PRODUCT_NAME, "GX723"),
221 },
222 },
223 {
205 .callback = dmi_disable_osi_vista, 224 .callback = dmi_disable_osi_vista,
206 .ident = "Sony VGN-NS10J_S", 225 .ident = "Sony VGN-NS10J_S",
207 .matches = { 226 .matches = {
@@ -226,6 +245,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
226 }, 245 },
227 }, 246 },
228 { 247 {
248 .callback = dmi_disable_osi_vista,
249 .ident = "Toshiba Satellite L355",
250 .matches = {
251 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
252 DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"),
253 },
254 },
255 {
229 .callback = dmi_disable_osi_win7, 256 .callback = dmi_disable_osi_win7,
230 .ident = "ASUS K50IJ", 257 .ident = "ASUS K50IJ",
231 .matches = { 258 .matches = {
@@ -233,6 +260,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
233 DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"), 260 DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
234 }, 261 },
235 }, 262 },
263 {
264 .callback = dmi_disable_osi_vista,
265 .ident = "Toshiba P305D",
266 .matches = {
267 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
268 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"),
269 },
270 },
236 271
237 /* 272 /*
238 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. 273 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 5c221ab535d5..310e3b9749cb 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -55,7 +55,7 @@ EXPORT_SYMBOL(acpi_root_dir);
55static int set_power_nocheck(const struct dmi_system_id *id) 55static int set_power_nocheck(const struct dmi_system_id *id)
56{ 56{
57 printk(KERN_NOTICE PREFIX "%s detected - " 57 printk(KERN_NOTICE PREFIX "%s detected - "
58 "disable power check in power transistion\n", id->ident); 58 "disable power check in power transition\n", id->ident);
59 acpi_power_nocheck = 1; 59 acpi_power_nocheck = 1;
60 return 0; 60 return 0;
61} 61}
@@ -80,23 +80,15 @@ static int set_copy_dsdt(const struct dmi_system_id *id)
80 80
81static struct dmi_system_id dsdt_dmi_table[] __initdata = { 81static struct dmi_system_id dsdt_dmi_table[] __initdata = {
82 /* 82 /*
83 * Insyde BIOS on some TOSHIBA machines corrupt the DSDT. 83 * Invoke DSDT corruption work-around on all Toshiba Satellite.
84 * https://bugzilla.kernel.org/show_bug.cgi?id=14679 84 * https://bugzilla.kernel.org/show_bug.cgi?id=14679
85 */ 85 */
86 { 86 {
87 .callback = set_copy_dsdt, 87 .callback = set_copy_dsdt,
88 .ident = "TOSHIBA Satellite A505", 88 .ident = "TOSHIBA Satellite",
89 .matches = { 89 .matches = {
90 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 90 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
91 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite A505"), 91 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"),
92 },
93 },
94 {
95 .callback = set_copy_dsdt,
96 .ident = "TOSHIBA Satellite L505D",
97 .matches = {
98 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
99 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite L505D"),
100 }, 92 },
101 }, 93 },
102 {} 94 {}
@@ -1027,7 +1019,7 @@ static int __init acpi_init(void)
1027 1019
1028 /* 1020 /*
1029 * If the laptop falls into the DMI check table, the power state check 1021 * If the laptop falls into the DMI check table, the power state check
1030 * will be disabled in the course of device power transistion. 1022 * will be disabled in the course of device power transition.
1031 */ 1023 */
1032 dmi_check_system(power_nocheck_dmi_table); 1024 dmi_check_system(power_nocheck_dmi_table);
1033 1025
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 8a3b840c0bb2..d94d2953c974 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -369,7 +369,9 @@ static void __exit acpi_fan_exit(void)
369 369
370 acpi_bus_unregister_driver(&acpi_fan_driver); 370 acpi_bus_unregister_driver(&acpi_fan_driver);
371 371
372#ifdef CONFIG_ACPI_PROCFS
372 remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); 373 remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
374#endif
373 375
374 return; 376 return;
375} 377}
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index e9699aaed109..bec561c14beb 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -29,12 +29,6 @@ static int set_no_mwait(const struct dmi_system_id *id)
29 29
30static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { 30static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = {
31 { 31 {
32 set_no_mwait, "IFL91 board", {
33 DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
34 DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"),
35 DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"),
36 DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL},
37 {
38 set_no_mwait, "Extensa 5220", { 32 set_no_mwait, "Extensa 5220", {
39 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), 33 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
40 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 34 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -352,4 +346,5 @@ void __init acpi_early_processor_set_pdc(void)
352 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, 346 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
353 ACPI_UINT32_MAX, 347 ACPI_UINT32_MAX,
354 early_init_pdc, NULL, NULL, NULL); 348 early_init_pdc, NULL, NULL, NULL);
349 acpi_get_devices("ACPI0007", early_init_pdc, NULL, NULL);
355} 350}
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 156021892389..347eb21b2353 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -850,7 +850,7 @@ static int __init acpi_processor_init(void)
850 printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", 850 printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n",
851 acpi_idle_driver.name); 851 acpi_idle_driver.name);
852 } else { 852 } else {
853 printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s", 853 printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s\n",
854 cpuidle_get_driver()->name); 854 cpuidle_get_driver()->name);
855 } 855 }
856 856
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index ba1bd263d903..3a73a93596e8 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -447,8 +447,8 @@ int acpi_processor_notify_smm(struct module *calling_module)
447 if (!try_module_get(calling_module)) 447 if (!try_module_get(calling_module))
448 return -EINVAL; 448 return -EINVAL;
449 449
450 /* is_done is set to negative if an error occured, 450 /* is_done is set to negative if an error occurred,
451 * and to postitive if _no_ error occured, but SMM 451 * and to postitive if _no_ error occurred, but SMM
452 * was already notified. This avoids double notification 452 * was already notified. This avoids double notification
453 * which might lead to unexpected results... 453 * which might lead to unexpected results...
454 */ 454 */
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index cf82989ae756..4754ff6e70e6 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -363,6 +363,12 @@ static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
363 return 0; 363 return 0;
364} 364}
365 365
366static int __init init_nvs_nosave(const struct dmi_system_id *d)
367{
368 acpi_nvs_nosave();
369 return 0;
370}
371
366static struct dmi_system_id __initdata acpisleep_dmi_table[] = { 372static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
367 { 373 {
368 .callback = init_old_suspend_ordering, 374 .callback = init_old_suspend_ordering,
@@ -397,6 +403,22 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
397 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), 403 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
398 }, 404 },
399 }, 405 },
406 {
407 .callback = init_nvs_nosave,
408 .ident = "Sony Vaio VGN-SR11M",
409 .matches = {
410 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
411 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"),
412 },
413 },
414 {
415 .callback = init_nvs_nosave,
416 .ident = "Everex StepNote Series",
417 .matches = {
418 DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."),
419 DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"),
420 },
421 },
400 {}, 422 {},
401}; 423};
402#endif /* CONFIG_SUSPEND */ 424#endif /* CONFIG_SUSPEND */
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 68e2e4582fa2..f8588f81048a 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -100,7 +100,7 @@ static const struct acpi_dlevel acpi_debug_levels[] = {
100 ACPI_DEBUG_INIT(ACPI_LV_EVENTS), 100 ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
101}; 101};
102 102
103static int param_get_debug_layer(char *buffer, struct kernel_param *kp) 103static int param_get_debug_layer(char *buffer, const struct kernel_param *kp)
104{ 104{
105 int result = 0; 105 int result = 0;
106 int i; 106 int i;
@@ -128,7 +128,7 @@ static int param_get_debug_layer(char *buffer, struct kernel_param *kp)
128 return result; 128 return result;
129} 129}
130 130
131static int param_get_debug_level(char *buffer, struct kernel_param *kp) 131static int param_get_debug_level(char *buffer, const struct kernel_param *kp)
132{ 132{
133 int result = 0; 133 int result = 0;
134 int i; 134 int i;
@@ -149,10 +149,18 @@ static int param_get_debug_level(char *buffer, struct kernel_param *kp)
149 return result; 149 return result;
150} 150}
151 151
152module_param_call(debug_layer, param_set_uint, param_get_debug_layer, 152static struct kernel_param_ops param_ops_debug_layer = {
153 &acpi_dbg_layer, 0644); 153 .set = param_set_uint,
154module_param_call(debug_level, param_set_uint, param_get_debug_level, 154 .get = param_get_debug_layer,
155 &acpi_dbg_level, 0644); 155};
156
157static struct kernel_param_ops param_ops_debug_level = {
158 .set = param_set_uint,
159 .get = param_get_debug_level,
160};
161
162module_param_cb(debug_layer, &param_ops_debug_layer, &acpi_dbg_layer, 0644);
163module_param_cb(debug_level, &param_ops_debug_level, &acpi_dbg_level, 0644);
156 164
157static char trace_method_name[6]; 165static char trace_method_name[6];
158module_param_string(trace_method_name, trace_method_name, 6, 0644); 166module_param_string(trace_method_name, trace_method_name, 6, 0644);
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index c5fef01b3c95..b83676126598 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -59,8 +59,8 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
59 "support\n")); 59 "support\n"));
60 *cap |= ACPI_VIDEO_BACKLIGHT; 60 *cap |= ACPI_VIDEO_BACKLIGHT;
61 if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy))) 61 if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy)))
62 printk(KERN_WARNING FW_BUG PREFIX "ACPI brightness " 62 printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
63 "control misses _BQC function\n"); 63 "cannot determine initial brightness\n");
64 /* We have backlight support, no need to scan further */ 64 /* We have backlight support, no need to scan further */
65 return AE_CTRL_TERMINATE; 65 return AE_CTRL_TERMINATE;
66 } 66 }
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index ee9ddeb53417..8cb0347dec28 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -3156,7 +3156,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
3156{ 3156{
3157 struct atm_dev *dev; 3157 struct atm_dev *dev;
3158 IADEV *iadev; 3158 IADEV *iadev;
3159 unsigned long flags;
3160 int ret; 3159 int ret;
3161 3160
3162 iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); 3161 iadev = kzalloc(sizeof(*iadev), GFP_KERNEL);
@@ -3188,19 +3187,14 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
3188 ia_dev[iadev_count] = iadev; 3187 ia_dev[iadev_count] = iadev;
3189 _ia_dev[iadev_count] = dev; 3188 _ia_dev[iadev_count] = dev;
3190 iadev_count++; 3189 iadev_count++;
3191 spin_lock_init(&iadev->misc_lock);
3192 /* First fixes first. I don't want to think about this now. */
3193 spin_lock_irqsave(&iadev->misc_lock, flags);
3194 if (ia_init(dev) || ia_start(dev)) { 3190 if (ia_init(dev) || ia_start(dev)) {
3195 IF_INIT(printk("IA register failed!\n");) 3191 IF_INIT(printk("IA register failed!\n");)
3196 iadev_count--; 3192 iadev_count--;
3197 ia_dev[iadev_count] = NULL; 3193 ia_dev[iadev_count] = NULL;
3198 _ia_dev[iadev_count] = NULL; 3194 _ia_dev[iadev_count] = NULL;
3199 spin_unlock_irqrestore(&iadev->misc_lock, flags);
3200 ret = -EINVAL; 3195 ret = -EINVAL;
3201 goto err_out_deregister_dev; 3196 goto err_out_deregister_dev;
3202 } 3197 }
3203 spin_unlock_irqrestore(&iadev->misc_lock, flags);
3204 IF_EVENT(printk("iadev_count = %d\n", iadev_count);) 3198 IF_EVENT(printk("iadev_count = %d\n", iadev_count);)
3205 3199
3206 iadev->next_board = ia_boards; 3200 iadev->next_board = ia_boards;
diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h
index b2cd20f549cb..077735e0e04b 100644
--- a/drivers/atm/iphase.h
+++ b/drivers/atm/iphase.h
@@ -1022,7 +1022,7 @@ typedef struct iadev_t {
1022 struct dle_q rx_dle_q; 1022 struct dle_q rx_dle_q;
1023 struct free_desc_q *rx_free_desc_qhead; 1023 struct free_desc_q *rx_free_desc_qhead;
1024 struct sk_buff_head rx_dma_q; 1024 struct sk_buff_head rx_dma_q;
1025 spinlock_t rx_lock, misc_lock; 1025 spinlock_t rx_lock;
1026 struct atm_vcc **rx_open; /* list of all open VCs */ 1026 struct atm_vcc **rx_open; /* list of all open VCs */
1027 u16 num_rx_desc, rx_buf_sz, rxing; 1027 u16 num_rx_desc, rx_buf_sz, rxing;
1028 u32 rx_pkt_ram, rx_tmp_cnt; 1028 u32 rx_pkt_ram, rx_tmp_cnt;
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index f916ddf63938..f46138ab38b6 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -444,6 +444,7 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr,
444 struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev); 444 struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev);
445 struct solos_card *card = atmdev->dev_data; 445 struct solos_card *card = atmdev->dev_data;
446 struct sk_buff *skb; 446 struct sk_buff *skb;
447 unsigned int len;
447 448
448 spin_lock(&card->cli_queue_lock); 449 spin_lock(&card->cli_queue_lock);
449 skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]); 450 skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]);
@@ -451,11 +452,12 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr,
451 if(skb == NULL) 452 if(skb == NULL)
452 return sprintf(buf, "No data.\n"); 453 return sprintf(buf, "No data.\n");
453 454
454 memcpy(buf, skb->data, skb->len); 455 len = skb->len;
455 dev_dbg(&card->dev->dev, "len: %d\n", skb->len); 456 memcpy(buf, skb->data, len);
457 dev_dbg(&card->dev->dev, "len: %d\n", len);
456 458
457 kfree_skb(skb); 459 kfree_skb(skb);
458 return skb->len; 460 return len;
459} 461}
460 462
461static int send_command(struct solos_card *card, int dev, const char *buf, size_t size) 463static int send_command(struct solos_card *card, int dev, const char *buf, size_t size)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 2aafafca2b13..1101e251a629 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -202,6 +202,7 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str)
202 struct virtio_blk *vblk = disk->private_data; 202 struct virtio_blk *vblk = disk->private_data;
203 struct request *req; 203 struct request *req;
204 struct bio *bio; 204 struct bio *bio;
205 int err;
205 206
206 bio = bio_map_kern(vblk->disk->queue, id_str, VIRTIO_BLK_ID_BYTES, 207 bio = bio_map_kern(vblk->disk->queue, id_str, VIRTIO_BLK_ID_BYTES,
207 GFP_KERNEL); 208 GFP_KERNEL);
@@ -215,7 +216,10 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str)
215 } 216 }
216 217
217 req->cmd_type = REQ_TYPE_SPECIAL; 218 req->cmd_type = REQ_TYPE_SPECIAL;
218 return blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); 219 err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false);
220 blk_put_request(req);
221
222 return err;
219} 223}
220 224
221static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode, 225static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode,
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index c2408bbe9c2e..f508690eb958 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -80,7 +80,7 @@
80 * Limiting Performance Impact 80 * Limiting Performance Impact
81 * --------------------------- 81 * ---------------------------
82 * C states, especially those with large exit latencies, can have a real 82 * C states, especially those with large exit latencies, can have a real
83 * noticable impact on workloads, which is not acceptable for most sysadmins, 83 * noticeable impact on workloads, which is not acceptable for most sysadmins,
84 * and in addition, less performance has a power price of its own. 84 * and in addition, less performance has a power price of its own.
85 * 85 *
86 * As a general rule of thumb, menu assumes that the following heuristic 86 * As a general rule of thumb, menu assumes that the following heuristic
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 216f9d383b5b..effd140fc042 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -879,7 +879,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca)
879 dma->device_issue_pending = ioat2_issue_pending; 879 dma->device_issue_pending = ioat2_issue_pending;
880 dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; 880 dma->device_alloc_chan_resources = ioat2_alloc_chan_resources;
881 dma->device_free_chan_resources = ioat2_free_chan_resources; 881 dma->device_free_chan_resources = ioat2_free_chan_resources;
882 dma->device_tx_status = ioat_tx_status; 882 dma->device_tx_status = ioat_dma_tx_status;
883 883
884 err = ioat_probe(device); 884 err = ioat_probe(device);
885 if (err) 885 if (err)
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index fb64cf36ba61..eb6b54dbb806 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -580,7 +580,6 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
580 580
581 sh_chan = to_sh_chan(chan); 581 sh_chan = to_sh_chan(chan);
582 param = chan->private; 582 param = chan->private;
583 slave_addr = param->config->addr;
584 583
585 /* Someone calling slave DMA on a public channel? */ 584 /* Someone calling slave DMA on a public channel? */
586 if (!param || !sg_len) { 585 if (!param || !sg_len) {
@@ -589,6 +588,8 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
589 return NULL; 588 return NULL;
590 } 589 }
591 590
591 slave_addr = param->config->addr;
592
592 /* 593 /*
593 * if (param != NULL), this is a successfully requested slave channel, 594 * if (param != NULL), this is a successfully requested slave channel,
594 * therefore param->config != NULL too. 595 * therefore param->config != NULL too.
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index e0187d16dd7c..0fd5b85a0f75 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1140,6 +1140,7 @@ static struct mcidev_sysfs_attribute i7core_udimm_counters_attrs[] = {
1140 ATTR_COUNTER(0), 1140 ATTR_COUNTER(0),
1141 ATTR_COUNTER(1), 1141 ATTR_COUNTER(1),
1142 ATTR_COUNTER(2), 1142 ATTR_COUNTER(2),
1143 { .attr = { .name = NULL } }
1143}; 1144};
1144 1145
1145static struct mcidev_sysfs_group i7core_udimm_counters = { 1146static struct mcidev_sysfs_group i7core_udimm_counters = {
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index bf92d07510df..5663d2719063 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -148,7 +148,7 @@ int drm_gem_object_init(struct drm_device *dev,
148 return -ENOMEM; 148 return -ENOMEM;
149 149
150 kref_init(&obj->refcount); 150 kref_init(&obj->refcount);
151 kref_init(&obj->handlecount); 151 atomic_set(&obj->handle_count, 0);
152 obj->size = size; 152 obj->size = size;
153 153
154 atomic_inc(&dev->object_count); 154 atomic_inc(&dev->object_count);
@@ -462,28 +462,6 @@ drm_gem_object_free(struct kref *kref)
462} 462}
463EXPORT_SYMBOL(drm_gem_object_free); 463EXPORT_SYMBOL(drm_gem_object_free);
464 464
465/**
466 * Called after the last reference to the object has been lost.
467 * Must be called without holding struct_mutex
468 *
469 * Frees the object
470 */
471void
472drm_gem_object_free_unlocked(struct kref *kref)
473{
474 struct drm_gem_object *obj = (struct drm_gem_object *) kref;
475 struct drm_device *dev = obj->dev;
476
477 if (dev->driver->gem_free_object_unlocked != NULL)
478 dev->driver->gem_free_object_unlocked(obj);
479 else if (dev->driver->gem_free_object != NULL) {
480 mutex_lock(&dev->struct_mutex);
481 dev->driver->gem_free_object(obj);
482 mutex_unlock(&dev->struct_mutex);
483 }
484}
485EXPORT_SYMBOL(drm_gem_object_free_unlocked);
486
487static void drm_gem_object_ref_bug(struct kref *list_kref) 465static void drm_gem_object_ref_bug(struct kref *list_kref)
488{ 466{
489 BUG(); 467 BUG();
@@ -496,12 +474,8 @@ static void drm_gem_object_ref_bug(struct kref *list_kref)
496 * called before drm_gem_object_free or we'll be touching 474 * called before drm_gem_object_free or we'll be touching
497 * freed memory 475 * freed memory
498 */ 476 */
499void 477void drm_gem_object_handle_free(struct drm_gem_object *obj)
500drm_gem_object_handle_free(struct kref *kref)
501{ 478{
502 struct drm_gem_object *obj = container_of(kref,
503 struct drm_gem_object,
504 handlecount);
505 struct drm_device *dev = obj->dev; 479 struct drm_device *dev = obj->dev;
506 480
507 /* Remove any name for this object */ 481 /* Remove any name for this object */
@@ -528,6 +502,10 @@ void drm_gem_vm_open(struct vm_area_struct *vma)
528 struct drm_gem_object *obj = vma->vm_private_data; 502 struct drm_gem_object *obj = vma->vm_private_data;
529 503
530 drm_gem_object_reference(obj); 504 drm_gem_object_reference(obj);
505
506 mutex_lock(&obj->dev->struct_mutex);
507 drm_vm_open_locked(vma);
508 mutex_unlock(&obj->dev->struct_mutex);
531} 509}
532EXPORT_SYMBOL(drm_gem_vm_open); 510EXPORT_SYMBOL(drm_gem_vm_open);
533 511
@@ -535,7 +513,10 @@ void drm_gem_vm_close(struct vm_area_struct *vma)
535{ 513{
536 struct drm_gem_object *obj = vma->vm_private_data; 514 struct drm_gem_object *obj = vma->vm_private_data;
537 515
538 drm_gem_object_unreference_unlocked(obj); 516 mutex_lock(&obj->dev->struct_mutex);
517 drm_vm_close_locked(vma);
518 drm_gem_object_unreference(obj);
519 mutex_unlock(&obj->dev->struct_mutex);
539} 520}
540EXPORT_SYMBOL(drm_gem_vm_close); 521EXPORT_SYMBOL(drm_gem_vm_close);
541 522
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
index 2ef2c7827243..974e970ce3f8 100644
--- a/drivers/gpu/drm/drm_info.c
+++ b/drivers/gpu/drm/drm_info.c
@@ -255,7 +255,7 @@ int drm_gem_one_name_info(int id, void *ptr, void *data)
255 255
256 seq_printf(m, "%6d %8zd %7d %8d\n", 256 seq_printf(m, "%6d %8zd %7d %8d\n",
257 obj->name, obj->size, 257 obj->name, obj->size,
258 atomic_read(&obj->handlecount.refcount), 258 atomic_read(&obj->handle_count),
259 atomic_read(&obj->refcount.refcount)); 259 atomic_read(&obj->refcount.refcount));
260 return 0; 260 return 0;
261} 261}
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index fda67468e603..5df450683aab 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -433,15 +433,7 @@ static void drm_vm_open(struct vm_area_struct *vma)
433 mutex_unlock(&dev->struct_mutex); 433 mutex_unlock(&dev->struct_mutex);
434} 434}
435 435
436/** 436void drm_vm_close_locked(struct vm_area_struct *vma)
437 * \c close method for all virtual memory types.
438 *
439 * \param vma virtual memory area.
440 *
441 * Search the \p vma private data entry in drm_device::vmalist, unlink it, and
442 * free it.
443 */
444static void drm_vm_close(struct vm_area_struct *vma)
445{ 437{
446 struct drm_file *priv = vma->vm_file->private_data; 438 struct drm_file *priv = vma->vm_file->private_data;
447 struct drm_device *dev = priv->minor->dev; 439 struct drm_device *dev = priv->minor->dev;
@@ -451,7 +443,6 @@ static void drm_vm_close(struct vm_area_struct *vma)
451 vma->vm_start, vma->vm_end - vma->vm_start); 443 vma->vm_start, vma->vm_end - vma->vm_start);
452 atomic_dec(&dev->vma_count); 444 atomic_dec(&dev->vma_count);
453 445
454 mutex_lock(&dev->struct_mutex);
455 list_for_each_entry_safe(pt, temp, &dev->vmalist, head) { 446 list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
456 if (pt->vma == vma) { 447 if (pt->vma == vma) {
457 list_del(&pt->head); 448 list_del(&pt->head);
@@ -459,6 +450,23 @@ static void drm_vm_close(struct vm_area_struct *vma)
459 break; 450 break;
460 } 451 }
461 } 452 }
453}
454
455/**
456 * \c close method for all virtual memory types.
457 *
458 * \param vma virtual memory area.
459 *
460 * Search the \p vma private data entry in drm_device::vmalist, unlink it, and
461 * free it.
462 */
463static void drm_vm_close(struct vm_area_struct *vma)
464{
465 struct drm_file *priv = vma->vm_file->private_data;
466 struct drm_device *dev = priv->minor->dev;
467
468 mutex_lock(&dev->struct_mutex);
469 drm_vm_close_locked(vma);
462 mutex_unlock(&dev->struct_mutex); 470 mutex_unlock(&dev->struct_mutex);
463} 471}
464 472
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index 61b4caf220fa..fb07e73581e8 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -116,7 +116,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
116static const struct file_operations i810_buffer_fops = { 116static const struct file_operations i810_buffer_fops = {
117 .open = drm_open, 117 .open = drm_open,
118 .release = drm_release, 118 .release = drm_release,
119 .unlocked_ioctl = drm_ioctl, 119 .unlocked_ioctl = i810_ioctl,
120 .mmap = i810_mmap_buffers, 120 .mmap = i810_mmap_buffers,
121 .fasync = drm_fasync, 121 .fasync = drm_fasync,
122}; 122};
diff --git a/drivers/gpu/drm/i830/i830_dma.c b/drivers/gpu/drm/i830/i830_dma.c
index 671aa18415ac..cc92c7e6236f 100644
--- a/drivers/gpu/drm/i830/i830_dma.c
+++ b/drivers/gpu/drm/i830/i830_dma.c
@@ -118,7 +118,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
118static const struct file_operations i830_buffer_fops = { 118static const struct file_operations i830_buffer_fops = {
119 .open = drm_open, 119 .open = drm_open,
120 .release = drm_release, 120 .release = drm_release,
121 .unlocked_ioctl = drm_ioctl, 121 .unlocked_ioctl = i830_ioctl,
122 .mmap = i830_mmap_buffers, 122 .mmap = i830_mmap_buffers,
123 .fasync = drm_fasync, 123 .fasync = drm_fasync,
124}; 124};
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 9d67b4853030..2dd2c93ebfa3 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1787,9 +1787,9 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv)
1787 } 1787 }
1788 } 1788 }
1789 1789
1790 div_u64(diff, diff1); 1790 diff = div_u64(diff, diff1);
1791 ret = ((m * diff) + c); 1791 ret = ((m * diff) + c);
1792 div_u64(ret, 10); 1792 ret = div_u64(ret, 10);
1793 1793
1794 dev_priv->last_count1 = total_count; 1794 dev_priv->last_count1 = total_count;
1795 dev_priv->last_time1 = now; 1795 dev_priv->last_time1 = now;
@@ -1858,7 +1858,7 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv)
1858 1858
1859 /* More magic constants... */ 1859 /* More magic constants... */
1860 diff = diff * 1181; 1860 diff = diff * 1181;
1861 div_u64(diff, diffms * 10); 1861 diff = div_u64(diff, diffms * 10);
1862 dev_priv->gfx_power = diff; 1862 dev_priv->gfx_power = diff;
1863} 1863}
1864 1864
@@ -2231,6 +2231,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2231 dev_priv->mchdev_lock = &mchdev_lock; 2231 dev_priv->mchdev_lock = &mchdev_lock;
2232 spin_unlock(&mchdev_lock); 2232 spin_unlock(&mchdev_lock);
2233 2233
2234 /* XXX Prevent module unload due to memory corruption bugs. */
2235 __module_get(THIS_MODULE);
2236
2234 return 0; 2237 return 0;
2235 2238
2236out_workqueue_free: 2239out_workqueue_free:
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index bced9b25c71e..90b1d6753b9d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -136,14 +136,12 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
136 return -ENOMEM; 136 return -ENOMEM;
137 137
138 ret = drm_gem_handle_create(file_priv, obj, &handle); 138 ret = drm_gem_handle_create(file_priv, obj, &handle);
139 /* drop reference from allocate - handle holds it now */
140 drm_gem_object_unreference_unlocked(obj);
139 if (ret) { 141 if (ret) {
140 drm_gem_object_unreference_unlocked(obj);
141 return ret; 142 return ret;
142 } 143 }
143 144
144 /* Sink the floating reference from kref_init(handlecount) */
145 drm_gem_object_handle_unreference_unlocked(obj);
146
147 args->handle = handle; 145 args->handle = handle;
148 return 0; 146 return 0;
149} 147}
@@ -471,14 +469,17 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
471 return -ENOENT; 469 return -ENOENT;
472 obj_priv = to_intel_bo(obj); 470 obj_priv = to_intel_bo(obj);
473 471
474 /* Bounds check source. 472 /* Bounds check source. */
475 * 473 if (args->offset > obj->size || args->size > obj->size - args->offset) {
476 * XXX: This could use review for overflow issues... 474 ret = -EINVAL;
477 */ 475 goto err;
478 if (args->offset > obj->size || args->size > obj->size || 476 }
479 args->offset + args->size > obj->size) { 477
480 drm_gem_object_unreference_unlocked(obj); 478 if (!access_ok(VERIFY_WRITE,
481 return -EINVAL; 479 (char __user *)(uintptr_t)args->data_ptr,
480 args->size)) {
481 ret = -EFAULT;
482 goto err;
482 } 483 }
483 484
484 if (i915_gem_object_needs_bit17_swizzle(obj)) { 485 if (i915_gem_object_needs_bit17_swizzle(obj)) {
@@ -490,8 +491,8 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
490 file_priv); 491 file_priv);
491 } 492 }
492 493
494err:
493 drm_gem_object_unreference_unlocked(obj); 495 drm_gem_object_unreference_unlocked(obj);
494
495 return ret; 496 return ret;
496} 497}
497 498
@@ -580,8 +581,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
580 581
581 user_data = (char __user *) (uintptr_t) args->data_ptr; 582 user_data = (char __user *) (uintptr_t) args->data_ptr;
582 remain = args->size; 583 remain = args->size;
583 if (!access_ok(VERIFY_READ, user_data, remain))
584 return -EFAULT;
585 584
586 585
587 mutex_lock(&dev->struct_mutex); 586 mutex_lock(&dev->struct_mutex);
@@ -934,14 +933,17 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
934 return -ENOENT; 933 return -ENOENT;
935 obj_priv = to_intel_bo(obj); 934 obj_priv = to_intel_bo(obj);
936 935
937 /* Bounds check destination. 936 /* Bounds check destination. */
938 * 937 if (args->offset > obj->size || args->size > obj->size - args->offset) {
939 * XXX: This could use review for overflow issues... 938 ret = -EINVAL;
940 */ 939 goto err;
941 if (args->offset > obj->size || args->size > obj->size || 940 }
942 args->offset + args->size > obj->size) { 941
943 drm_gem_object_unreference_unlocked(obj); 942 if (!access_ok(VERIFY_READ,
944 return -EINVAL; 943 (char __user *)(uintptr_t)args->data_ptr,
944 args->size)) {
945 ret = -EFAULT;
946 goto err;
945 } 947 }
946 948
947 /* We can only do the GTT pwrite on untiled buffers, as otherwise 949 /* We can only do the GTT pwrite on untiled buffers, as otherwise
@@ -975,8 +977,8 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
975 DRM_INFO("pwrite failed %d\n", ret); 977 DRM_INFO("pwrite failed %d\n", ret);
976#endif 978#endif
977 979
980err:
978 drm_gem_object_unreference_unlocked(obj); 981 drm_gem_object_unreference_unlocked(obj);
979
980 return ret; 982 return ret;
981} 983}
982 984
@@ -3258,6 +3260,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3258 (int) reloc->offset, 3260 (int) reloc->offset,
3259 reloc->read_domains, 3261 reloc->read_domains,
3260 reloc->write_domain); 3262 reloc->write_domain);
3263 drm_gem_object_unreference(target_obj);
3264 i915_gem_object_unpin(obj);
3261 return -EINVAL; 3265 return -EINVAL;
3262 } 3266 }
3263 if (reloc->write_domain & I915_GEM_DOMAIN_CPU || 3267 if (reloc->write_domain & I915_GEM_DOMAIN_CPU ||
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index e85246ef691c..5c428fa3e0b3 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -93,7 +93,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen
93{ 93{
94 drm_i915_private_t *dev_priv = dev->dev_private; 94 drm_i915_private_t *dev_priv = dev->dev_private;
95 struct list_head eviction_list, unwind_list; 95 struct list_head eviction_list, unwind_list;
96 struct drm_i915_gem_object *obj_priv, *tmp_obj_priv; 96 struct drm_i915_gem_object *obj_priv;
97 struct list_head *render_iter, *bsd_iter; 97 struct list_head *render_iter, *bsd_iter;
98 int ret = 0; 98 int ret = 0;
99 99
@@ -175,39 +175,34 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen
175 return -ENOSPC; 175 return -ENOSPC;
176 176
177found: 177found:
178 /* drm_mm doesn't allow any other other operations while
179 * scanning, therefore store to be evicted objects on a
180 * temporary list. */
178 INIT_LIST_HEAD(&eviction_list); 181 INIT_LIST_HEAD(&eviction_list);
179 list_for_each_entry_safe(obj_priv, tmp_obj_priv, 182 while (!list_empty(&unwind_list)) {
180 &unwind_list, evict_list) { 183 obj_priv = list_first_entry(&unwind_list,
184 struct drm_i915_gem_object,
185 evict_list);
181 if (drm_mm_scan_remove_block(obj_priv->gtt_space)) { 186 if (drm_mm_scan_remove_block(obj_priv->gtt_space)) {
182 /* drm_mm doesn't allow any other other operations while
183 * scanning, therefore store to be evicted objects on a
184 * temporary list. */
185 list_move(&obj_priv->evict_list, &eviction_list); 187 list_move(&obj_priv->evict_list, &eviction_list);
186 } else 188 continue;
187 drm_gem_object_unreference(&obj_priv->base); 189 }
190 list_del(&obj_priv->evict_list);
191 drm_gem_object_unreference(&obj_priv->base);
188 } 192 }
189 193
190 /* Unbinding will emit any required flushes */ 194 /* Unbinding will emit any required flushes */
191 list_for_each_entry_safe(obj_priv, tmp_obj_priv, 195 while (!list_empty(&eviction_list)) {
192 &eviction_list, evict_list) { 196 obj_priv = list_first_entry(&eviction_list,
193#if WATCH_LRU 197 struct drm_i915_gem_object,
194 DRM_INFO("%s: evicting %p\n", __func__, &obj_priv->base); 198 evict_list);
195#endif 199 if (ret == 0)
196 ret = i915_gem_object_unbind(&obj_priv->base); 200 ret = i915_gem_object_unbind(&obj_priv->base);
197 if (ret) 201 list_del(&obj_priv->evict_list);
198 return ret;
199
200 drm_gem_object_unreference(&obj_priv->base); 202 drm_gem_object_unreference(&obj_priv->base);
201 } 203 }
202 204
203 /* The just created free hole should be on the top of the free stack 205 return ret;
204 * maintained by drm_mm, so this BUG_ON actually executes in O(1).
205 * Furthermore all accessed data has just recently been used, so it
206 * should be really fast, too. */
207 BUG_ON(!drm_mm_search_free(&dev_priv->mm.gtt_space, min_size,
208 alignment, 0));
209
210 return 0;
211} 206}
212 207
213int 208int
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b5bf51a4502d..979228594599 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1013,8 +1013,8 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe)
1013 DRM_DEBUG_KMS("vblank wait timed out\n"); 1013 DRM_DEBUG_KMS("vblank wait timed out\n");
1014} 1014}
1015 1015
1016/** 1016/*
1017 * intel_wait_for_vblank_off - wait for vblank after disabling a pipe 1017 * intel_wait_for_pipe_off - wait for pipe to turn off
1018 * @dev: drm device 1018 * @dev: drm device
1019 * @pipe: pipe to wait for 1019 * @pipe: pipe to wait for
1020 * 1020 *
@@ -1022,25 +1022,39 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe)
1022 * spinning on the vblank interrupt status bit, since we won't actually 1022 * spinning on the vblank interrupt status bit, since we won't actually
1023 * see an interrupt when the pipe is disabled. 1023 * see an interrupt when the pipe is disabled.
1024 * 1024 *
1025 * So this function waits for the display line value to settle (it 1025 * On Gen4 and above:
1026 * usually ends up stopping at the start of the next frame). 1026 * wait for the pipe register state bit to turn off
1027 *
1028 * Otherwise:
1029 * wait for the display line value to settle (it usually
1030 * ends up stopping at the start of the next frame).
1031 *
1027 */ 1032 */
1028void intel_wait_for_vblank_off(struct drm_device *dev, int pipe) 1033static void intel_wait_for_pipe_off(struct drm_device *dev, int pipe)
1029{ 1034{
1030 struct drm_i915_private *dev_priv = dev->dev_private; 1035 struct drm_i915_private *dev_priv = dev->dev_private;
1031 int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL); 1036
1032 unsigned long timeout = jiffies + msecs_to_jiffies(100); 1037 if (INTEL_INFO(dev)->gen >= 4) {
1033 u32 last_line; 1038 int pipeconf_reg = (pipe == 0 ? PIPEACONF : PIPEBCONF);
1034 1039
1035 /* Wait for the display line to settle */ 1040 /* Wait for the Pipe State to go off */
1036 do { 1041 if (wait_for((I915_READ(pipeconf_reg) & I965_PIPECONF_ACTIVE) == 0,
1037 last_line = I915_READ(pipedsl_reg) & DSL_LINEMASK; 1042 100, 0))
1038 mdelay(5); 1043 DRM_DEBUG_KMS("pipe_off wait timed out\n");
1039 } while (((I915_READ(pipedsl_reg) & DSL_LINEMASK) != last_line) && 1044 } else {
1040 time_after(timeout, jiffies)); 1045 u32 last_line;
1041 1046 int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL);
1042 if (time_after(jiffies, timeout)) 1047 unsigned long timeout = jiffies + msecs_to_jiffies(100);
1043 DRM_DEBUG_KMS("vblank wait timed out\n"); 1048
1049 /* Wait for the display line to settle */
1050 do {
1051 last_line = I915_READ(pipedsl_reg) & DSL_LINEMASK;
1052 mdelay(5);
1053 } while (((I915_READ(pipedsl_reg) & DSL_LINEMASK) != last_line) &&
1054 time_after(timeout, jiffies));
1055 if (time_after(jiffies, timeout))
1056 DRM_DEBUG_KMS("pipe_off wait timed out\n");
1057 }
1044} 1058}
1045 1059
1046/* Parameters have changed, update FBC info */ 1060/* Parameters have changed, update FBC info */
@@ -2328,13 +2342,13 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
2328 I915_READ(dspbase_reg); 2342 I915_READ(dspbase_reg);
2329 } 2343 }
2330 2344
2331 /* Wait for vblank for the disable to take effect */
2332 intel_wait_for_vblank_off(dev, pipe);
2333
2334 /* Don't disable pipe A or pipe A PLLs if needed */ 2345 /* Don't disable pipe A or pipe A PLLs if needed */
2335 if (pipeconf_reg == PIPEACONF && 2346 if (pipeconf_reg == PIPEACONF &&
2336 (dev_priv->quirks & QUIRK_PIPEA_FORCE)) 2347 (dev_priv->quirks & QUIRK_PIPEA_FORCE)) {
2348 /* Wait for vblank for the disable to take effect */
2349 intel_wait_for_vblank(dev, pipe);
2337 goto skip_pipe_off; 2350 goto skip_pipe_off;
2351 }
2338 2352
2339 /* Next, disable display pipes */ 2353 /* Next, disable display pipes */
2340 temp = I915_READ(pipeconf_reg); 2354 temp = I915_READ(pipeconf_reg);
@@ -2343,8 +2357,8 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
2343 I915_READ(pipeconf_reg); 2357 I915_READ(pipeconf_reg);
2344 } 2358 }
2345 2359
2346 /* Wait for vblank for the disable to take effect. */ 2360 /* Wait for the pipe to turn off */
2347 intel_wait_for_vblank_off(dev, pipe); 2361 intel_wait_for_pipe_off(dev, pipe);
2348 2362
2349 temp = I915_READ(dpll_reg); 2363 temp = I915_READ(dpll_reg);
2350 if ((temp & DPLL_VCO_ENABLE) != 0) { 2364 if ((temp & DPLL_VCO_ENABLE) != 0) {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1a51ee07de3e..9ab8708ac6ba 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1138,18 +1138,14 @@ static bool
1138intel_dp_set_link_train(struct intel_dp *intel_dp, 1138intel_dp_set_link_train(struct intel_dp *intel_dp,
1139 uint32_t dp_reg_value, 1139 uint32_t dp_reg_value,
1140 uint8_t dp_train_pat, 1140 uint8_t dp_train_pat,
1141 uint8_t train_set[4], 1141 uint8_t train_set[4])
1142 bool first)
1143{ 1142{
1144 struct drm_device *dev = intel_dp->base.enc.dev; 1143 struct drm_device *dev = intel_dp->base.enc.dev;
1145 struct drm_i915_private *dev_priv = dev->dev_private; 1144 struct drm_i915_private *dev_priv = dev->dev_private;
1146 struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.enc.crtc);
1147 int ret; 1145 int ret;
1148 1146
1149 I915_WRITE(intel_dp->output_reg, dp_reg_value); 1147 I915_WRITE(intel_dp->output_reg, dp_reg_value);
1150 POSTING_READ(intel_dp->output_reg); 1148 POSTING_READ(intel_dp->output_reg);
1151 if (first)
1152 intel_wait_for_vblank(dev, intel_crtc->pipe);
1153 1149
1154 intel_dp_aux_native_write_1(intel_dp, 1150 intel_dp_aux_native_write_1(intel_dp,
1155 DP_TRAINING_PATTERN_SET, 1151 DP_TRAINING_PATTERN_SET,
@@ -1174,10 +1170,15 @@ intel_dp_link_train(struct intel_dp *intel_dp)
1174 uint8_t voltage; 1170 uint8_t voltage;
1175 bool clock_recovery = false; 1171 bool clock_recovery = false;
1176 bool channel_eq = false; 1172 bool channel_eq = false;
1177 bool first = true;
1178 int tries; 1173 int tries;
1179 u32 reg; 1174 u32 reg;
1180 uint32_t DP = intel_dp->DP; 1175 uint32_t DP = intel_dp->DP;
1176 struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.enc.crtc);
1177
1178 /* Enable output, wait for it to become active */
1179 I915_WRITE(intel_dp->output_reg, intel_dp->DP);
1180 POSTING_READ(intel_dp->output_reg);
1181 intel_wait_for_vblank(dev, intel_crtc->pipe);
1181 1182
1182 /* Write the link configuration data */ 1183 /* Write the link configuration data */
1183 intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, 1184 intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET,
@@ -1210,9 +1211,8 @@ intel_dp_link_train(struct intel_dp *intel_dp)
1210 reg = DP | DP_LINK_TRAIN_PAT_1; 1211 reg = DP | DP_LINK_TRAIN_PAT_1;
1211 1212
1212 if (!intel_dp_set_link_train(intel_dp, reg, 1213 if (!intel_dp_set_link_train(intel_dp, reg,
1213 DP_TRAINING_PATTERN_1, train_set, first)) 1214 DP_TRAINING_PATTERN_1, train_set))
1214 break; 1215 break;
1215 first = false;
1216 /* Set training pattern 1 */ 1216 /* Set training pattern 1 */
1217 1217
1218 udelay(100); 1218 udelay(100);
@@ -1266,8 +1266,7 @@ intel_dp_link_train(struct intel_dp *intel_dp)
1266 1266
1267 /* channel eq pattern */ 1267 /* channel eq pattern */
1268 if (!intel_dp_set_link_train(intel_dp, reg, 1268 if (!intel_dp_set_link_train(intel_dp, reg,
1269 DP_TRAINING_PATTERN_2, train_set, 1269 DP_TRAINING_PATTERN_2, train_set))
1270 false))
1271 break; 1270 break;
1272 1271
1273 udelay(400); 1272 udelay(400);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index ad312ca6b3e5..8828b3ac6414 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -229,7 +229,6 @@ extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
229 struct drm_crtc *crtc); 229 struct drm_crtc *crtc);
230int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, 230int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
231 struct drm_file *file_priv); 231 struct drm_file *file_priv);
232extern void intel_wait_for_vblank_off(struct drm_device *dev, int pipe);
233extern void intel_wait_for_vblank(struct drm_device *dev, int pipe); 232extern void intel_wait_for_vblank(struct drm_device *dev, int pipe);
234extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe); 233extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe);
235extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, 234extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 7bdc96256bf5..b61966c126d3 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -237,8 +237,10 @@ int intel_fbdev_destroy(struct drm_device *dev,
237 drm_fb_helper_fini(&ifbdev->helper); 237 drm_fb_helper_fini(&ifbdev->helper);
238 238
239 drm_framebuffer_cleanup(&ifb->base); 239 drm_framebuffer_cleanup(&ifb->base);
240 if (ifb->obj) 240 if (ifb->obj) {
241 drm_gem_object_unreference(ifb->obj); 241 drm_gem_object_unreference(ifb->obj);
242 ifb->obj = NULL;
243 }
242 244
243 return 0; 245 return 0;
244} 246}
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index ead7b8fc53fc..19620a6709f5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -167,11 +167,9 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
167 goto out; 167 goto out;
168 168
169 ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); 169 ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle);
170 /* drop reference from allocate - handle holds it now */
171 drm_gem_object_unreference_unlocked(nvbo->gem);
170out: 172out:
171 drm_gem_object_handle_unreference_unlocked(nvbo->gem);
172
173 if (ret)
174 drm_gem_object_unreference_unlocked(nvbo->gem);
175 return ret; 173 return ret;
176} 174}
177 175
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 79082d4398ae..2f93d46ae69a 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1137,7 +1137,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1137 1137
1138 WREG32(RCU_IND_INDEX, 0x203); 1138 WREG32(RCU_IND_INDEX, 0x203);
1139 efuse_straps_3 = RREG32(RCU_IND_DATA); 1139 efuse_straps_3 = RREG32(RCU_IND_DATA);
1140 efuse_box_bit_127_124 = (u8)(efuse_straps_3 & 0xF0000000) >> 28; 1140 efuse_box_bit_127_124 = (u8)((efuse_straps_3 & 0xF0000000) >> 28);
1141 1141
1142 switch(efuse_box_bit_127_124) { 1142 switch(efuse_box_bit_127_124) {
1143 case 0x0: 1143 case 0x0:
@@ -1407,6 +1407,7 @@ int evergreen_mc_init(struct radeon_device *rdev)
1407 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; 1407 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
1408 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; 1408 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
1409 rdev->mc.visible_vram_size = rdev->mc.aper_size; 1409 rdev->mc.visible_vram_size = rdev->mc.aper_size;
1410 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1410 r600_vram_gtt_location(rdev, &rdev->mc); 1411 r600_vram_gtt_location(rdev, &rdev->mc);
1411 radeon_update_bandwidth_info(rdev); 1412 radeon_update_bandwidth_info(rdev);
1412 1413
@@ -1520,7 +1521,7 @@ void evergreen_disable_interrupt_state(struct radeon_device *rdev)
1520{ 1521{
1521 u32 tmp; 1522 u32 tmp;
1522 1523
1523 WREG32(CP_INT_CNTL, 0); 1524 WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE);
1524 WREG32(GRBM_INT_CNTL, 0); 1525 WREG32(GRBM_INT_CNTL, 0);
1525 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 1526 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
1526 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 1527 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index e151f16a8f86..e59422320bb6 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -1030,6 +1030,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size)
1030 return r; 1030 return r;
1031 } 1031 }
1032 rdev->cp.ready = true; 1032 rdev->cp.ready = true;
1033 rdev->mc.active_vram_size = rdev->mc.real_vram_size;
1033 return 0; 1034 return 0;
1034} 1035}
1035 1036
@@ -1047,6 +1048,7 @@ void r100_cp_fini(struct radeon_device *rdev)
1047void r100_cp_disable(struct radeon_device *rdev) 1048void r100_cp_disable(struct radeon_device *rdev)
1048{ 1049{
1049 /* Disable ring */ 1050 /* Disable ring */
1051 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1050 rdev->cp.ready = false; 1052 rdev->cp.ready = false;
1051 WREG32(RADEON_CP_CSQ_MODE, 0); 1053 WREG32(RADEON_CP_CSQ_MODE, 0);
1052 WREG32(RADEON_CP_CSQ_CNTL, 0); 1054 WREG32(RADEON_CP_CSQ_CNTL, 0);
@@ -2295,6 +2297,7 @@ void r100_vram_init_sizes(struct radeon_device *rdev)
2295 /* FIXME we don't use the second aperture yet when we could use it */ 2297 /* FIXME we don't use the second aperture yet when we could use it */
2296 if (rdev->mc.visible_vram_size > rdev->mc.aper_size) 2298 if (rdev->mc.visible_vram_size > rdev->mc.aper_size)
2297 rdev->mc.visible_vram_size = rdev->mc.aper_size; 2299 rdev->mc.visible_vram_size = rdev->mc.aper_size;
2300 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
2298 config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); 2301 config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE);
2299 if (rdev->flags & RADEON_IS_IGP) { 2302 if (rdev->flags & RADEON_IS_IGP) {
2300 uint32_t tom; 2303 uint32_t tom;
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index ddc3adea1dda..7b65e4efe8af 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1248,6 +1248,7 @@ int r600_mc_init(struct radeon_device *rdev)
1248 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); 1248 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE);
1249 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); 1249 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
1250 rdev->mc.visible_vram_size = rdev->mc.aper_size; 1250 rdev->mc.visible_vram_size = rdev->mc.aper_size;
1251 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1251 r600_vram_gtt_location(rdev, &rdev->mc); 1252 r600_vram_gtt_location(rdev, &rdev->mc);
1252 1253
1253 if (rdev->flags & RADEON_IS_IGP) { 1254 if (rdev->flags & RADEON_IS_IGP) {
@@ -1917,6 +1918,7 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v)
1917 */ 1918 */
1918void r600_cp_stop(struct radeon_device *rdev) 1919void r600_cp_stop(struct radeon_device *rdev)
1919{ 1920{
1921 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1920 WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); 1922 WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1));
1921} 1923}
1922 1924
@@ -2910,7 +2912,7 @@ static void r600_disable_interrupt_state(struct radeon_device *rdev)
2910{ 2912{
2911 u32 tmp; 2913 u32 tmp;
2912 2914
2913 WREG32(CP_INT_CNTL, 0); 2915 WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE);
2914 WREG32(GRBM_INT_CNTL, 0); 2916 WREG32(GRBM_INT_CNTL, 0);
2915 WREG32(DxMODE_INT_MASK, 0); 2917 WREG32(DxMODE_INT_MASK, 0);
2916 if (ASIC_IS_DCE3(rdev)) { 2918 if (ASIC_IS_DCE3(rdev)) {
@@ -3528,7 +3530,8 @@ void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
3528 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read 3530 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read
3529 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL 3531 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL
3530 */ 3532 */
3531 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { 3533 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
3534 rdev->vram_scratch.ptr) {
3532 void __iomem *ptr = (void *)rdev->vram_scratch.ptr; 3535 void __iomem *ptr = (void *)rdev->vram_scratch.ptr;
3533 u32 tmp; 3536 u32 tmp;
3534 3537
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 9ceb2a1ce799..3473c00781ff 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -532,6 +532,7 @@ int r600_blit_init(struct radeon_device *rdev)
532 memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); 532 memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4);
533 radeon_bo_kunmap(rdev->r600_blit.shader_obj); 533 radeon_bo_kunmap(rdev->r600_blit.shader_obj);
534 radeon_bo_unreserve(rdev->r600_blit.shader_obj); 534 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
535 rdev->mc.active_vram_size = rdev->mc.real_vram_size;
535 return 0; 536 return 0;
536} 537}
537 538
@@ -539,6 +540,7 @@ void r600_blit_fini(struct radeon_device *rdev)
539{ 540{
540 int r; 541 int r;
541 542
543 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
542 if (rdev->r600_blit.shader_obj == NULL) 544 if (rdev->r600_blit.shader_obj == NULL)
543 return; 545 return;
544 /* If we can't reserve the bo, unref should be enough to destroy 546 /* If we can't reserve the bo, unref should be enough to destroy
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index a168d644bf9e..9ff38c99a6ea 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -344,6 +344,7 @@ struct radeon_mc {
344 * about vram size near mc fb location */ 344 * about vram size near mc fb location */
345 u64 mc_vram_size; 345 u64 mc_vram_size;
346 u64 visible_vram_size; 346 u64 visible_vram_size;
347 u64 active_vram_size;
347 u64 gtt_size; 348 u64 gtt_size;
348 u64 gtt_start; 349 u64 gtt_start;
349 u64 gtt_end; 350 u64 gtt_end;
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index ebae14c4b768..8e43ddae70cc 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -317,6 +317,15 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
317 *connector_type = DRM_MODE_CONNECTOR_DVID; 317 *connector_type = DRM_MODE_CONNECTOR_DVID;
318 } 318 }
319 319
320 /* MSI K9A2GM V2/V3 board has no HDMI or DVI */
321 if ((dev->pdev->device == 0x796e) &&
322 (dev->pdev->subsystem_vendor == 0x1462) &&
323 (dev->pdev->subsystem_device == 0x7302)) {
324 if ((supported_device == ATOM_DEVICE_DFP2_SUPPORT) ||
325 (supported_device == ATOM_DEVICE_DFP3_SUPPORT))
326 return false;
327 }
328
320 /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */ 329 /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */
321 if ((dev->pdev->device == 0x7941) && 330 if ((dev->pdev->device == 0x7941) &&
322 (dev->pdev->subsystem_vendor == 0x147b) && 331 (dev->pdev->subsystem_vendor == 0x147b) &&
@@ -1549,39 +1558,39 @@ radeon_atombios_get_tv_info(struct radeon_device *rdev)
1549 switch (tv_info->ucTV_BootUpDefaultStandard) { 1558 switch (tv_info->ucTV_BootUpDefaultStandard) {
1550 case ATOM_TV_NTSC: 1559 case ATOM_TV_NTSC:
1551 tv_std = TV_STD_NTSC; 1560 tv_std = TV_STD_NTSC;
1552 DRM_INFO("Default TV standard: NTSC\n"); 1561 DRM_DEBUG_KMS("Default TV standard: NTSC\n");
1553 break; 1562 break;
1554 case ATOM_TV_NTSCJ: 1563 case ATOM_TV_NTSCJ:
1555 tv_std = TV_STD_NTSC_J; 1564 tv_std = TV_STD_NTSC_J;
1556 DRM_INFO("Default TV standard: NTSC-J\n"); 1565 DRM_DEBUG_KMS("Default TV standard: NTSC-J\n");
1557 break; 1566 break;
1558 case ATOM_TV_PAL: 1567 case ATOM_TV_PAL:
1559 tv_std = TV_STD_PAL; 1568 tv_std = TV_STD_PAL;
1560 DRM_INFO("Default TV standard: PAL\n"); 1569 DRM_DEBUG_KMS("Default TV standard: PAL\n");
1561 break; 1570 break;
1562 case ATOM_TV_PALM: 1571 case ATOM_TV_PALM:
1563 tv_std = TV_STD_PAL_M; 1572 tv_std = TV_STD_PAL_M;
1564 DRM_INFO("Default TV standard: PAL-M\n"); 1573 DRM_DEBUG_KMS("Default TV standard: PAL-M\n");
1565 break; 1574 break;
1566 case ATOM_TV_PALN: 1575 case ATOM_TV_PALN:
1567 tv_std = TV_STD_PAL_N; 1576 tv_std = TV_STD_PAL_N;
1568 DRM_INFO("Default TV standard: PAL-N\n"); 1577 DRM_DEBUG_KMS("Default TV standard: PAL-N\n");
1569 break; 1578 break;
1570 case ATOM_TV_PALCN: 1579 case ATOM_TV_PALCN:
1571 tv_std = TV_STD_PAL_CN; 1580 tv_std = TV_STD_PAL_CN;
1572 DRM_INFO("Default TV standard: PAL-CN\n"); 1581 DRM_DEBUG_KMS("Default TV standard: PAL-CN\n");
1573 break; 1582 break;
1574 case ATOM_TV_PAL60: 1583 case ATOM_TV_PAL60:
1575 tv_std = TV_STD_PAL_60; 1584 tv_std = TV_STD_PAL_60;
1576 DRM_INFO("Default TV standard: PAL-60\n"); 1585 DRM_DEBUG_KMS("Default TV standard: PAL-60\n");
1577 break; 1586 break;
1578 case ATOM_TV_SECAM: 1587 case ATOM_TV_SECAM:
1579 tv_std = TV_STD_SECAM; 1588 tv_std = TV_STD_SECAM;
1580 DRM_INFO("Default TV standard: SECAM\n"); 1589 DRM_DEBUG_KMS("Default TV standard: SECAM\n");
1581 break; 1590 break;
1582 default: 1591 default:
1583 tv_std = TV_STD_NTSC; 1592 tv_std = TV_STD_NTSC;
1584 DRM_INFO("Unknown TV standard; defaulting to NTSC\n"); 1593 DRM_DEBUG_KMS("Unknown TV standard; defaulting to NTSC\n");
1585 break; 1594 break;
1586 } 1595 }
1587 } 1596 }
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index a04b7a6ad95f..7b7ea269549c 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -913,47 +913,47 @@ radeon_combios_get_tv_info(struct radeon_device *rdev)
913 switch (RBIOS8(tv_info + 7) & 0xf) { 913 switch (RBIOS8(tv_info + 7) & 0xf) {
914 case 1: 914 case 1:
915 tv_std = TV_STD_NTSC; 915 tv_std = TV_STD_NTSC;
916 DRM_INFO("Default TV standard: NTSC\n"); 916 DRM_DEBUG_KMS("Default TV standard: NTSC\n");
917 break; 917 break;
918 case 2: 918 case 2:
919 tv_std = TV_STD_PAL; 919 tv_std = TV_STD_PAL;
920 DRM_INFO("Default TV standard: PAL\n"); 920 DRM_DEBUG_KMS("Default TV standard: PAL\n");
921 break; 921 break;
922 case 3: 922 case 3:
923 tv_std = TV_STD_PAL_M; 923 tv_std = TV_STD_PAL_M;
924 DRM_INFO("Default TV standard: PAL-M\n"); 924 DRM_DEBUG_KMS("Default TV standard: PAL-M\n");
925 break; 925 break;
926 case 4: 926 case 4:
927 tv_std = TV_STD_PAL_60; 927 tv_std = TV_STD_PAL_60;
928 DRM_INFO("Default TV standard: PAL-60\n"); 928 DRM_DEBUG_KMS("Default TV standard: PAL-60\n");
929 break; 929 break;
930 case 5: 930 case 5:
931 tv_std = TV_STD_NTSC_J; 931 tv_std = TV_STD_NTSC_J;
932 DRM_INFO("Default TV standard: NTSC-J\n"); 932 DRM_DEBUG_KMS("Default TV standard: NTSC-J\n");
933 break; 933 break;
934 case 6: 934 case 6:
935 tv_std = TV_STD_SCART_PAL; 935 tv_std = TV_STD_SCART_PAL;
936 DRM_INFO("Default TV standard: SCART-PAL\n"); 936 DRM_DEBUG_KMS("Default TV standard: SCART-PAL\n");
937 break; 937 break;
938 default: 938 default:
939 tv_std = TV_STD_NTSC; 939 tv_std = TV_STD_NTSC;
940 DRM_INFO 940 DRM_DEBUG_KMS
941 ("Unknown TV standard; defaulting to NTSC\n"); 941 ("Unknown TV standard; defaulting to NTSC\n");
942 break; 942 break;
943 } 943 }
944 944
945 switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) { 945 switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) {
946 case 0: 946 case 0:
947 DRM_INFO("29.498928713 MHz TV ref clk\n"); 947 DRM_DEBUG_KMS("29.498928713 MHz TV ref clk\n");
948 break; 948 break;
949 case 1: 949 case 1:
950 DRM_INFO("28.636360000 MHz TV ref clk\n"); 950 DRM_DEBUG_KMS("28.636360000 MHz TV ref clk\n");
951 break; 951 break;
952 case 2: 952 case 2:
953 DRM_INFO("14.318180000 MHz TV ref clk\n"); 953 DRM_DEBUG_KMS("14.318180000 MHz TV ref clk\n");
954 break; 954 break;
955 case 3: 955 case 3:
956 DRM_INFO("27.000000000 MHz TV ref clk\n"); 956 DRM_DEBUG_KMS("27.000000000 MHz TV ref clk\n");
957 break; 957 break;
958 default: 958 default:
959 break; 959 break;
@@ -1324,7 +1324,7 @@ bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder,
1324 1324
1325 if (tmds_info) { 1325 if (tmds_info) {
1326 ver = RBIOS8(tmds_info); 1326 ver = RBIOS8(tmds_info);
1327 DRM_INFO("DFP table revision: %d\n", ver); 1327 DRM_DEBUG_KMS("DFP table revision: %d\n", ver);
1328 if (ver == 3) { 1328 if (ver == 3) {
1329 n = RBIOS8(tmds_info + 5) + 1; 1329 n = RBIOS8(tmds_info + 5) + 1;
1330 if (n > 4) 1330 if (n > 4)
@@ -1408,7 +1408,7 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder
1408 offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); 1408 offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE);
1409 if (offset) { 1409 if (offset) {
1410 ver = RBIOS8(offset); 1410 ver = RBIOS8(offset);
1411 DRM_INFO("External TMDS Table revision: %d\n", ver); 1411 DRM_DEBUG_KMS("External TMDS Table revision: %d\n", ver);
1412 tmds->slave_addr = RBIOS8(offset + 4 + 2); 1412 tmds->slave_addr = RBIOS8(offset + 4 + 2);
1413 tmds->slave_addr >>= 1; /* 7 bit addressing */ 1413 tmds->slave_addr >>= 1; /* 7 bit addressing */
1414 gpio = RBIOS8(offset + 4 + 3); 1414 gpio = RBIOS8(offset + 4 + 3);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 127a395f70fb..b92d2f2fcbed 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -349,6 +349,8 @@ static void radeon_print_display_setup(struct drm_device *dev)
349 DRM_INFO(" DFP4: %s\n", encoder_names[radeon_encoder->encoder_id]); 349 DRM_INFO(" DFP4: %s\n", encoder_names[radeon_encoder->encoder_id]);
350 if (devices & ATOM_DEVICE_DFP5_SUPPORT) 350 if (devices & ATOM_DEVICE_DFP5_SUPPORT)
351 DRM_INFO(" DFP5: %s\n", encoder_names[radeon_encoder->encoder_id]); 351 DRM_INFO(" DFP5: %s\n", encoder_names[radeon_encoder->encoder_id]);
352 if (devices & ATOM_DEVICE_DFP6_SUPPORT)
353 DRM_INFO(" DFP6: %s\n", encoder_names[radeon_encoder->encoder_id]);
352 if (devices & ATOM_DEVICE_TV1_SUPPORT) 354 if (devices & ATOM_DEVICE_TV1_SUPPORT)
353 DRM_INFO(" TV1: %s\n", encoder_names[radeon_encoder->encoder_id]); 355 DRM_INFO(" TV1: %s\n", encoder_names[radeon_encoder->encoder_id]);
354 if (devices & ATOM_DEVICE_CV_SUPPORT) 356 if (devices & ATOM_DEVICE_CV_SUPPORT)
@@ -841,8 +843,9 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb)
841{ 843{
842 struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb); 844 struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb);
843 845
844 if (radeon_fb->obj) 846 if (radeon_fb->obj) {
845 drm_gem_object_unreference_unlocked(radeon_fb->obj); 847 drm_gem_object_unreference_unlocked(radeon_fb->obj);
848 }
846 drm_framebuffer_cleanup(fb); 849 drm_framebuffer_cleanup(fb);
847 kfree(radeon_fb); 850 kfree(radeon_fb);
848} 851}
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index c74a8b20d941..40b0c087b592 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -94,6 +94,7 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj)
94 ret = radeon_bo_reserve(rbo, false); 94 ret = radeon_bo_reserve(rbo, false);
95 if (likely(ret == 0)) { 95 if (likely(ret == 0)) {
96 radeon_bo_kunmap(rbo); 96 radeon_bo_kunmap(rbo);
97 radeon_bo_unpin(rbo);
97 radeon_bo_unreserve(rbo); 98 radeon_bo_unreserve(rbo);
98 } 99 }
99 drm_gem_object_unreference_unlocked(gobj); 100 drm_gem_object_unreference_unlocked(gobj);
@@ -325,8 +326,6 @@ static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfb
325{ 326{
326 struct fb_info *info; 327 struct fb_info *info;
327 struct radeon_framebuffer *rfb = &rfbdev->rfb; 328 struct radeon_framebuffer *rfb = &rfbdev->rfb;
328 struct radeon_bo *rbo;
329 int r;
330 329
331 if (rfbdev->helper.fbdev) { 330 if (rfbdev->helper.fbdev) {
332 info = rfbdev->helper.fbdev; 331 info = rfbdev->helper.fbdev;
@@ -338,14 +337,8 @@ static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfb
338 } 337 }
339 338
340 if (rfb->obj) { 339 if (rfb->obj) {
341 rbo = rfb->obj->driver_private; 340 radeonfb_destroy_pinned_object(rfb->obj);
342 r = radeon_bo_reserve(rbo, false); 341 rfb->obj = NULL;
343 if (likely(r == 0)) {
344 radeon_bo_kunmap(rbo);
345 radeon_bo_unpin(rbo);
346 radeon_bo_unreserve(rbo);
347 }
348 drm_gem_object_unreference_unlocked(rfb->obj);
349 } 342 }
350 drm_fb_helper_fini(&rfbdev->helper); 343 drm_fb_helper_fini(&rfbdev->helper);
351 drm_framebuffer_cleanup(&rfb->base); 344 drm_framebuffer_cleanup(&rfb->base);
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index c578f265b24c..d1e595d91723 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -201,11 +201,11 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data,
201 return r; 201 return r;
202 } 202 }
203 r = drm_gem_handle_create(filp, gobj, &handle); 203 r = drm_gem_handle_create(filp, gobj, &handle);
204 /* drop reference from allocate - handle holds it now */
205 drm_gem_object_unreference_unlocked(gobj);
204 if (r) { 206 if (r) {
205 drm_gem_object_unreference_unlocked(gobj);
206 return r; 207 return r;
207 } 208 }
208 drm_gem_object_handle_unreference_unlocked(gobj);
209 args->handle = handle; 209 args->handle = handle;
210 return 0; 210 return 0;
211} 211}
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 0afd1e62347d..b3b5306bb578 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -69,7 +69,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
69 u32 c = 0; 69 u32 c = 0;
70 70
71 rbo->placement.fpfn = 0; 71 rbo->placement.fpfn = 0;
72 rbo->placement.lpfn = 0; 72 rbo->placement.lpfn = rbo->rdev->mc.active_vram_size >> PAGE_SHIFT;
73 rbo->placement.placement = rbo->placements; 73 rbo->placement.placement = rbo->placements;
74 rbo->placement.busy_placement = rbo->placements; 74 rbo->placement.busy_placement = rbo->placements;
75 if (domain & RADEON_GEM_DOMAIN_VRAM) 75 if (domain & RADEON_GEM_DOMAIN_VRAM)
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h
index 353998dc2c03..3481bc7f6f58 100644
--- a/drivers/gpu/drm/radeon/radeon_object.h
+++ b/drivers/gpu/drm/radeon/radeon_object.h
@@ -124,11 +124,8 @@ static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
124 int r; 124 int r;
125 125
126 r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0); 126 r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
127 if (unlikely(r != 0)) { 127 if (unlikely(r != 0))
128 if (r != -ERESTARTSYS)
129 dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo);
130 return r; 128 return r;
131 }
132 spin_lock(&bo->tbo.lock); 129 spin_lock(&bo->tbo.lock);
133 if (mem_type) 130 if (mem_type)
134 *mem_type = bo->tbo.mem.mem_type; 131 *mem_type = bo->tbo.mem.mem_type;
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index cc05b230d7ef..51d5f7b5ab21 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -693,6 +693,7 @@ void rs600_mc_init(struct radeon_device *rdev)
693 rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); 693 rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
694 rdev->mc.mc_vram_size = rdev->mc.real_vram_size; 694 rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
695 rdev->mc.visible_vram_size = rdev->mc.aper_size; 695 rdev->mc.visible_vram_size = rdev->mc.aper_size;
696 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
696 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 697 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
697 base = RREG32_MC(R_000004_MC_FB_LOCATION); 698 base = RREG32_MC(R_000004_MC_FB_LOCATION);
698 base = G_000004_MC_FB_START(base) << 16; 699 base = G_000004_MC_FB_START(base) << 16;
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 3e3f75718be3..4dc2a87ea680 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -157,6 +157,7 @@ void rs690_mc_init(struct radeon_device *rdev)
157 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); 157 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0);
158 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); 158 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0);
159 rdev->mc.visible_vram_size = rdev->mc.aper_size; 159 rdev->mc.visible_vram_size = rdev->mc.aper_size;
160 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
160 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); 161 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION);
161 base = G_000100_MC_FB_START(base) << 16; 162 base = G_000100_MC_FB_START(base) << 16;
162 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 163 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index bfa59db374d2..9490da700749 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -267,6 +267,7 @@ static void rv770_mc_program(struct radeon_device *rdev)
267 */ 267 */
268void r700_cp_stop(struct radeon_device *rdev) 268void r700_cp_stop(struct radeon_device *rdev)
269{ 269{
270 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
270 WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); 271 WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT));
271} 272}
272 273
@@ -992,6 +993,7 @@ int rv770_mc_init(struct radeon_device *rdev)
992 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); 993 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE);
993 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); 994 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
994 rdev->mc.visible_vram_size = rdev->mc.aper_size; 995 rdev->mc.visible_vram_size = rdev->mc.aper_size;
996 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
995 r600_vram_gtt_location(rdev, &rdev->mc); 997 r600_vram_gtt_location(rdev, &rdev->mc);
996 radeon_update_bandwidth_info(rdev); 998 radeon_update_bandwidth_info(rdev);
997 999
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index cb4cf7ef4d1e..db809e034cc4 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -442,6 +442,43 @@ out_err:
442} 442}
443 443
444/** 444/**
445 * Call bo::reserved and with the lru lock held.
446 * Will release GPU memory type usage on destruction.
447 * This is the place to put in driver specific hooks.
448 * Will release the bo::reserved lock and the
449 * lru lock on exit.
450 */
451
452static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
453{
454 struct ttm_bo_global *glob = bo->glob;
455
456 if (bo->ttm) {
457
458 /**
459 * Release the lru_lock, since we don't want to have
460 * an atomic requirement on ttm_tt[unbind|destroy].
461 */
462
463 spin_unlock(&glob->lru_lock);
464 ttm_tt_unbind(bo->ttm);
465 ttm_tt_destroy(bo->ttm);
466 bo->ttm = NULL;
467 spin_lock(&glob->lru_lock);
468 }
469
470 if (bo->mem.mm_node) {
471 drm_mm_put_block(bo->mem.mm_node);
472 bo->mem.mm_node = NULL;
473 }
474
475 atomic_set(&bo->reserved, 0);
476 wake_up_all(&bo->event_queue);
477 spin_unlock(&glob->lru_lock);
478}
479
480
481/**
445 * If bo idle, remove from delayed- and lru lists, and unref. 482 * If bo idle, remove from delayed- and lru lists, and unref.
446 * If not idle, and already on delayed list, do nothing. 483 * If not idle, and already on delayed list, do nothing.
447 * If not idle, and not on delayed list, put on delayed list, 484 * If not idle, and not on delayed list, put on delayed list,
@@ -456,6 +493,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all)
456 int ret; 493 int ret;
457 494
458 spin_lock(&bo->lock); 495 spin_lock(&bo->lock);
496retry:
459 (void) ttm_bo_wait(bo, false, false, !remove_all); 497 (void) ttm_bo_wait(bo, false, false, !remove_all);
460 498
461 if (!bo->sync_obj) { 499 if (!bo->sync_obj) {
@@ -464,31 +502,52 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all)
464 spin_unlock(&bo->lock); 502 spin_unlock(&bo->lock);
465 503
466 spin_lock(&glob->lru_lock); 504 spin_lock(&glob->lru_lock);
467 put_count = ttm_bo_del_from_lru(bo); 505 ret = ttm_bo_reserve_locked(bo, false, !remove_all, false, 0);
506
507 /**
508 * Someone else has the object reserved. Bail and retry.
509 */
468 510
469 ret = ttm_bo_reserve_locked(bo, false, false, false, 0); 511 if (unlikely(ret == -EBUSY)) {
470 BUG_ON(ret); 512 spin_unlock(&glob->lru_lock);
471 if (bo->ttm) 513 spin_lock(&bo->lock);
472 ttm_tt_unbind(bo->ttm); 514 goto requeue;
515 }
516
517 /**
518 * We can re-check for sync object without taking
519 * the bo::lock since setting the sync object requires
520 * also bo::reserved. A busy object at this point may
521 * be caused by another thread starting an accelerated
522 * eviction.
523 */
524
525 if (unlikely(bo->sync_obj)) {
526 atomic_set(&bo->reserved, 0);
527 wake_up_all(&bo->event_queue);
528 spin_unlock(&glob->lru_lock);
529 spin_lock(&bo->lock);
530 if (remove_all)
531 goto retry;
532 else
533 goto requeue;
534 }
535
536 put_count = ttm_bo_del_from_lru(bo);
473 537
474 if (!list_empty(&bo->ddestroy)) { 538 if (!list_empty(&bo->ddestroy)) {
475 list_del_init(&bo->ddestroy); 539 list_del_init(&bo->ddestroy);
476 ++put_count; 540 ++put_count;
477 } 541 }
478 if (bo->mem.mm_node) {
479 drm_mm_put_block(bo->mem.mm_node);
480 bo->mem.mm_node = NULL;
481 }
482 spin_unlock(&glob->lru_lock);
483 542
484 atomic_set(&bo->reserved, 0); 543 ttm_bo_cleanup_memtype_use(bo);
485 544
486 while (put_count--) 545 while (put_count--)
487 kref_put(&bo->list_kref, ttm_bo_ref_bug); 546 kref_put(&bo->list_kref, ttm_bo_ref_bug);
488 547
489 return 0; 548 return 0;
490 } 549 }
491 550requeue:
492 spin_lock(&glob->lru_lock); 551 spin_lock(&glob->lru_lock);
493 if (list_empty(&bo->ddestroy)) { 552 if (list_empty(&bo->ddestroy)) {
494 void *sync_obj = bo->sync_obj; 553 void *sync_obj = bo->sync_obj;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 72ec2e2b6e97..a96ed6d9d010 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -148,13 +148,16 @@ static struct pci_device_id vmw_pci_id_list[] = {
148 {0, 0, 0} 148 {0, 0, 0}
149}; 149};
150 150
151static char *vmw_devname = "vmwgfx"; 151static int enable_fbdev;
152 152
153static int vmw_probe(struct pci_dev *, const struct pci_device_id *); 153static int vmw_probe(struct pci_dev *, const struct pci_device_id *);
154static void vmw_master_init(struct vmw_master *); 154static void vmw_master_init(struct vmw_master *);
155static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, 155static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
156 void *ptr); 156 void *ptr);
157 157
158MODULE_PARM_DESC(enable_fbdev, "Enable vmwgfx fbdev");
159module_param_named(enable_fbdev, enable_fbdev, int, 0600);
160
158static void vmw_print_capabilities(uint32_t capabilities) 161static void vmw_print_capabilities(uint32_t capabilities)
159{ 162{
160 DRM_INFO("Capabilities:\n"); 163 DRM_INFO("Capabilities:\n");
@@ -192,8 +195,6 @@ static int vmw_request_device(struct vmw_private *dev_priv)
192{ 195{
193 int ret; 196 int ret;
194 197
195 vmw_kms_save_vga(dev_priv);
196
197 ret = vmw_fifo_init(dev_priv, &dev_priv->fifo); 198 ret = vmw_fifo_init(dev_priv, &dev_priv->fifo);
198 if (unlikely(ret != 0)) { 199 if (unlikely(ret != 0)) {
199 DRM_ERROR("Unable to initialize FIFO.\n"); 200 DRM_ERROR("Unable to initialize FIFO.\n");
@@ -206,9 +207,35 @@ static int vmw_request_device(struct vmw_private *dev_priv)
206static void vmw_release_device(struct vmw_private *dev_priv) 207static void vmw_release_device(struct vmw_private *dev_priv)
207{ 208{
208 vmw_fifo_release(dev_priv, &dev_priv->fifo); 209 vmw_fifo_release(dev_priv, &dev_priv->fifo);
209 vmw_kms_restore_vga(dev_priv);
210} 210}
211 211
212int vmw_3d_resource_inc(struct vmw_private *dev_priv)
213{
214 int ret = 0;
215
216 mutex_lock(&dev_priv->release_mutex);
217 if (unlikely(dev_priv->num_3d_resources++ == 0)) {
218 ret = vmw_request_device(dev_priv);
219 if (unlikely(ret != 0))
220 --dev_priv->num_3d_resources;
221 }
222 mutex_unlock(&dev_priv->release_mutex);
223 return ret;
224}
225
226
227void vmw_3d_resource_dec(struct vmw_private *dev_priv)
228{
229 int32_t n3d;
230
231 mutex_lock(&dev_priv->release_mutex);
232 if (unlikely(--dev_priv->num_3d_resources == 0))
233 vmw_release_device(dev_priv);
234 n3d = (int32_t) dev_priv->num_3d_resources;
235 mutex_unlock(&dev_priv->release_mutex);
236
237 BUG_ON(n3d < 0);
238}
212 239
213static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) 240static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
214{ 241{
@@ -228,6 +255,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
228 dev_priv->last_read_sequence = (uint32_t) -100; 255 dev_priv->last_read_sequence = (uint32_t) -100;
229 mutex_init(&dev_priv->hw_mutex); 256 mutex_init(&dev_priv->hw_mutex);
230 mutex_init(&dev_priv->cmdbuf_mutex); 257 mutex_init(&dev_priv->cmdbuf_mutex);
258 mutex_init(&dev_priv->release_mutex);
231 rwlock_init(&dev_priv->resource_lock); 259 rwlock_init(&dev_priv->resource_lock);
232 idr_init(&dev_priv->context_idr); 260 idr_init(&dev_priv->context_idr);
233 idr_init(&dev_priv->surface_idr); 261 idr_init(&dev_priv->surface_idr);
@@ -244,6 +272,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
244 dev_priv->vram_start = pci_resource_start(dev->pdev, 1); 272 dev_priv->vram_start = pci_resource_start(dev->pdev, 1);
245 dev_priv->mmio_start = pci_resource_start(dev->pdev, 2); 273 dev_priv->mmio_start = pci_resource_start(dev->pdev, 2);
246 274
275 dev_priv->enable_fb = enable_fbdev;
276
247 mutex_lock(&dev_priv->hw_mutex); 277 mutex_lock(&dev_priv->hw_mutex);
248 278
249 vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); 279 vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
@@ -343,17 +373,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
343 373
344 dev->dev_private = dev_priv; 374 dev->dev_private = dev_priv;
345 375
346 if (!dev->devname)
347 dev->devname = vmw_devname;
348
349 if (dev_priv->capabilities & SVGA_CAP_IRQMASK) {
350 ret = drm_irq_install(dev);
351 if (unlikely(ret != 0)) {
352 DRM_ERROR("Failed installing irq: %d\n", ret);
353 goto out_no_irq;
354 }
355 }
356
357 ret = pci_request_regions(dev->pdev, "vmwgfx probe"); 376 ret = pci_request_regions(dev->pdev, "vmwgfx probe");
358 dev_priv->stealth = (ret != 0); 377 dev_priv->stealth = (ret != 0);
359 if (dev_priv->stealth) { 378 if (dev_priv->stealth) {
@@ -369,26 +388,52 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
369 goto out_no_device; 388 goto out_no_device;
370 } 389 }
371 } 390 }
372 ret = vmw_request_device(dev_priv); 391 ret = vmw_kms_init(dev_priv);
373 if (unlikely(ret != 0)) 392 if (unlikely(ret != 0))
374 goto out_no_device; 393 goto out_no_kms;
375 vmw_kms_init(dev_priv);
376 vmw_overlay_init(dev_priv); 394 vmw_overlay_init(dev_priv);
377 vmw_fb_init(dev_priv); 395 if (dev_priv->enable_fb) {
396 ret = vmw_3d_resource_inc(dev_priv);
397 if (unlikely(ret != 0))
398 goto out_no_fifo;
399 vmw_kms_save_vga(dev_priv);
400 vmw_fb_init(dev_priv);
401 DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ?
402 "Detected device 3D availability.\n" :
403 "Detected no device 3D availability.\n");
404 } else {
405 DRM_INFO("Delayed 3D detection since we're not "
406 "running the device in SVGA mode yet.\n");
407 }
408
409 if (dev_priv->capabilities & SVGA_CAP_IRQMASK) {
410 ret = drm_irq_install(dev);
411 if (unlikely(ret != 0)) {
412 DRM_ERROR("Failed installing irq: %d\n", ret);
413 goto out_no_irq;
414 }
415 }
378 416
379 dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier; 417 dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier;
380 register_pm_notifier(&dev_priv->pm_nb); 418 register_pm_notifier(&dev_priv->pm_nb);
381 419
382 DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ? "Have 3D\n" : "No 3D\n");
383
384 return 0; 420 return 0;
385 421
386out_no_device:
387 if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
388 drm_irq_uninstall(dev_priv->dev);
389 if (dev->devname == vmw_devname)
390 dev->devname = NULL;
391out_no_irq: 422out_no_irq:
423 if (dev_priv->enable_fb) {
424 vmw_fb_close(dev_priv);
425 vmw_kms_restore_vga(dev_priv);
426 vmw_3d_resource_dec(dev_priv);
427 }
428out_no_fifo:
429 vmw_overlay_close(dev_priv);
430 vmw_kms_close(dev_priv);
431out_no_kms:
432 if (dev_priv->stealth)
433 pci_release_region(dev->pdev, 2);
434 else
435 pci_release_regions(dev->pdev);
436out_no_device:
392 ttm_object_device_release(&dev_priv->tdev); 437 ttm_object_device_release(&dev_priv->tdev);
393out_err4: 438out_err4:
394 iounmap(dev_priv->mmio_virt); 439 iounmap(dev_priv->mmio_virt);
@@ -415,19 +460,20 @@ static int vmw_driver_unload(struct drm_device *dev)
415 460
416 unregister_pm_notifier(&dev_priv->pm_nb); 461 unregister_pm_notifier(&dev_priv->pm_nb);
417 462
418 vmw_fb_close(dev_priv); 463 if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
464 drm_irq_uninstall(dev_priv->dev);
465 if (dev_priv->enable_fb) {
466 vmw_fb_close(dev_priv);
467 vmw_kms_restore_vga(dev_priv);
468 vmw_3d_resource_dec(dev_priv);
469 }
419 vmw_kms_close(dev_priv); 470 vmw_kms_close(dev_priv);
420 vmw_overlay_close(dev_priv); 471 vmw_overlay_close(dev_priv);
421 vmw_release_device(dev_priv);
422 if (dev_priv->stealth) 472 if (dev_priv->stealth)
423 pci_release_region(dev->pdev, 2); 473 pci_release_region(dev->pdev, 2);
424 else 474 else
425 pci_release_regions(dev->pdev); 475 pci_release_regions(dev->pdev);
426 476
427 if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
428 drm_irq_uninstall(dev_priv->dev);
429 if (dev->devname == vmw_devname)
430 dev->devname = NULL;
431 ttm_object_device_release(&dev_priv->tdev); 477 ttm_object_device_release(&dev_priv->tdev);
432 iounmap(dev_priv->mmio_virt); 478 iounmap(dev_priv->mmio_virt);
433 drm_mtrr_del(dev_priv->mmio_mtrr, dev_priv->mmio_start, 479 drm_mtrr_del(dev_priv->mmio_mtrr, dev_priv->mmio_start,
@@ -500,7 +546,7 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd,
500 struct drm_ioctl_desc *ioctl = 546 struct drm_ioctl_desc *ioctl =
501 &vmw_ioctls[nr - DRM_COMMAND_BASE]; 547 &vmw_ioctls[nr - DRM_COMMAND_BASE];
502 548
503 if (unlikely(ioctl->cmd != cmd)) { 549 if (unlikely(ioctl->cmd_drv != cmd)) {
504 DRM_ERROR("Invalid command format, ioctl %d\n", 550 DRM_ERROR("Invalid command format, ioctl %d\n",
505 nr - DRM_COMMAND_BASE); 551 nr - DRM_COMMAND_BASE);
506 return -EINVAL; 552 return -EINVAL;
@@ -589,6 +635,16 @@ static int vmw_master_set(struct drm_device *dev,
589 struct vmw_master *vmaster = vmw_master(file_priv->master); 635 struct vmw_master *vmaster = vmw_master(file_priv->master);
590 int ret = 0; 636 int ret = 0;
591 637
638 if (!dev_priv->enable_fb) {
639 ret = vmw_3d_resource_inc(dev_priv);
640 if (unlikely(ret != 0))
641 return ret;
642 vmw_kms_save_vga(dev_priv);
643 mutex_lock(&dev_priv->hw_mutex);
644 vmw_write(dev_priv, SVGA_REG_TRACES, 0);
645 mutex_unlock(&dev_priv->hw_mutex);
646 }
647
592 if (active) { 648 if (active) {
593 BUG_ON(active != &dev_priv->fbdev_master); 649 BUG_ON(active != &dev_priv->fbdev_master);
594 ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile); 650 ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile);
@@ -617,7 +673,13 @@ static int vmw_master_set(struct drm_device *dev,
617 return 0; 673 return 0;
618 674
619out_no_active_lock: 675out_no_active_lock:
620 vmw_release_device(dev_priv); 676 if (!dev_priv->enable_fb) {
677 mutex_lock(&dev_priv->hw_mutex);
678 vmw_write(dev_priv, SVGA_REG_TRACES, 1);
679 mutex_unlock(&dev_priv->hw_mutex);
680 vmw_kms_restore_vga(dev_priv);
681 vmw_3d_resource_dec(dev_priv);
682 }
621 return ret; 683 return ret;
622} 684}
623 685
@@ -645,11 +707,23 @@ static void vmw_master_drop(struct drm_device *dev,
645 707
646 ttm_lock_set_kill(&vmaster->lock, true, SIGTERM); 708 ttm_lock_set_kill(&vmaster->lock, true, SIGTERM);
647 709
710 if (!dev_priv->enable_fb) {
711 ret = ttm_bo_evict_mm(&dev_priv->bdev, TTM_PL_VRAM);
712 if (unlikely(ret != 0))
713 DRM_ERROR("Unable to clean VRAM on master drop.\n");
714 mutex_lock(&dev_priv->hw_mutex);
715 vmw_write(dev_priv, SVGA_REG_TRACES, 1);
716 mutex_unlock(&dev_priv->hw_mutex);
717 vmw_kms_restore_vga(dev_priv);
718 vmw_3d_resource_dec(dev_priv);
719 }
720
648 dev_priv->active_master = &dev_priv->fbdev_master; 721 dev_priv->active_master = &dev_priv->fbdev_master;
649 ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); 722 ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM);
650 ttm_vt_unlock(&dev_priv->fbdev_master.lock); 723 ttm_vt_unlock(&dev_priv->fbdev_master.lock);
651 724
652 vmw_fb_on(dev_priv); 725 if (dev_priv->enable_fb)
726 vmw_fb_on(dev_priv);
653} 727}
654 728
655 729
@@ -722,6 +796,7 @@ static struct drm_driver driver = {
722 .irq_postinstall = vmw_irq_postinstall, 796 .irq_postinstall = vmw_irq_postinstall,
723 .irq_uninstall = vmw_irq_uninstall, 797 .irq_uninstall = vmw_irq_uninstall,
724 .irq_handler = vmw_irq_handler, 798 .irq_handler = vmw_irq_handler,
799 .get_vblank_counter = vmw_get_vblank_counter,
725 .reclaim_buffers_locked = NULL, 800 .reclaim_buffers_locked = NULL,
726 .get_map_ofs = drm_core_get_map_ofs, 801 .get_map_ofs = drm_core_get_map_ofs,
727 .get_reg_ofs = drm_core_get_reg_ofs, 802 .get_reg_ofs = drm_core_get_reg_ofs,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 429f917b60bf..58de6393f611 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -277,6 +277,7 @@ struct vmw_private {
277 277
278 bool stealth; 278 bool stealth;
279 bool is_opened; 279 bool is_opened;
280 bool enable_fb;
280 281
281 /** 282 /**
282 * Master management. 283 * Master management.
@@ -285,6 +286,9 @@ struct vmw_private {
285 struct vmw_master *active_master; 286 struct vmw_master *active_master;
286 struct vmw_master fbdev_master; 287 struct vmw_master fbdev_master;
287 struct notifier_block pm_nb; 288 struct notifier_block pm_nb;
289
290 struct mutex release_mutex;
291 uint32_t num_3d_resources;
288}; 292};
289 293
290static inline struct vmw_private *vmw_priv(struct drm_device *dev) 294static inline struct vmw_private *vmw_priv(struct drm_device *dev)
@@ -319,6 +323,9 @@ static inline uint32_t vmw_read(struct vmw_private *dev_priv,
319 return val; 323 return val;
320} 324}
321 325
326int vmw_3d_resource_inc(struct vmw_private *dev_priv);
327void vmw_3d_resource_dec(struct vmw_private *dev_priv);
328
322/** 329/**
323 * GMR utilities - vmwgfx_gmr.c 330 * GMR utilities - vmwgfx_gmr.c
324 */ 331 */
@@ -511,6 +518,7 @@ void vmw_kms_write_svga(struct vmw_private *vmw_priv,
511 unsigned bbp, unsigned depth); 518 unsigned bbp, unsigned depth);
512int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, 519int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
513 struct drm_file *file_priv); 520 struct drm_file *file_priv);
521u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc);
514 522
515/** 523/**
516 * Overlay control - vmwgfx_overlay.c 524 * Overlay control - vmwgfx_overlay.c
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 870967a97c15..409e172f4abf 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -615,6 +615,11 @@ int vmw_dmabuf_to_start_of_vram(struct vmw_private *vmw_priv,
615 if (unlikely(ret != 0)) 615 if (unlikely(ret != 0))
616 goto err_unlock; 616 goto err_unlock;
617 617
618 if (bo->mem.mem_type == TTM_PL_VRAM &&
619 bo->mem.mm_node->start < bo->num_pages)
620 (void) ttm_bo_validate(bo, &vmw_sys_placement, false,
621 false, false);
622
618 ret = ttm_bo_validate(bo, &ne_placement, false, false, false); 623 ret = ttm_bo_validate(bo, &ne_placement, false, false, false);
619 624
620 /* Could probably bug on */ 625 /* Could probably bug on */
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
index e6a1eb7ea954..0fe31766e4cf 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
@@ -106,6 +106,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
106 mutex_lock(&dev_priv->hw_mutex); 106 mutex_lock(&dev_priv->hw_mutex);
107 dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE); 107 dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE);
108 dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE); 108 dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE);
109 dev_priv->traces_state = vmw_read(dev_priv, SVGA_REG_TRACES);
109 vmw_write(dev_priv, SVGA_REG_ENABLE, 1); 110 vmw_write(dev_priv, SVGA_REG_ENABLE, 1);
110 111
111 min = 4; 112 min = 4;
@@ -175,6 +176,8 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
175 dev_priv->config_done_state); 176 dev_priv->config_done_state);
176 vmw_write(dev_priv, SVGA_REG_ENABLE, 177 vmw_write(dev_priv, SVGA_REG_ENABLE,
177 dev_priv->enable_state); 178 dev_priv->enable_state);
179 vmw_write(dev_priv, SVGA_REG_TRACES,
180 dev_priv->traces_state);
178 181
179 mutex_unlock(&dev_priv->hw_mutex); 182 mutex_unlock(&dev_priv->hw_mutex);
180 vmw_fence_queue_takedown(&fifo->fence_queue); 183 vmw_fence_queue_takedown(&fifo->fence_queue);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 64d7f47df868..e882ba099f0c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -898,7 +898,19 @@ int vmw_kms_save_vga(struct vmw_private *vmw_priv)
898 save->width = vmw_read(vmw_priv, SVGA_REG_DISPLAY_WIDTH); 898 save->width = vmw_read(vmw_priv, SVGA_REG_DISPLAY_WIDTH);
899 save->height = vmw_read(vmw_priv, SVGA_REG_DISPLAY_HEIGHT); 899 save->height = vmw_read(vmw_priv, SVGA_REG_DISPLAY_HEIGHT);
900 vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); 900 vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID);
901 if (i == 0 && vmw_priv->num_displays == 1 &&
902 save->width == 0 && save->height == 0) {
903
904 /*
905 * It should be fairly safe to assume that these
906 * values are uninitialized.
907 */
908
909 save->width = vmw_priv->vga_width - save->pos_x;
910 save->height = vmw_priv->vga_height - save->pos_y;
911 }
901 } 912 }
913
902 return 0; 914 return 0;
903} 915}
904 916
@@ -984,3 +996,8 @@ out_unlock:
984 ttm_read_unlock(&vmaster->lock); 996 ttm_read_unlock(&vmaster->lock);
985 return ret; 997 return ret;
986} 998}
999
1000u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc)
1001{
1002 return 0;
1003}
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 7083b1a24df3..11cb39e3accb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -27,6 +27,8 @@
27 27
28#include "vmwgfx_kms.h" 28#include "vmwgfx_kms.h"
29 29
30#define VMWGFX_LDU_NUM_DU 8
31
30#define vmw_crtc_to_ldu(x) \ 32#define vmw_crtc_to_ldu(x) \
31 container_of(x, struct vmw_legacy_display_unit, base.crtc) 33 container_of(x, struct vmw_legacy_display_unit, base.crtc)
32#define vmw_encoder_to_ldu(x) \ 34#define vmw_encoder_to_ldu(x) \
@@ -536,6 +538,10 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
536 538
537int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv) 539int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv)
538{ 540{
541 struct drm_device *dev = dev_priv->dev;
542 int i;
543 int ret;
544
539 if (dev_priv->ldu_priv) { 545 if (dev_priv->ldu_priv) {
540 DRM_INFO("ldu system already on\n"); 546 DRM_INFO("ldu system already on\n");
541 return -EINVAL; 547 return -EINVAL;
@@ -553,23 +559,24 @@ int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv)
553 559
554 drm_mode_create_dirty_info_property(dev_priv->dev); 560 drm_mode_create_dirty_info_property(dev_priv->dev);
555 561
556 vmw_ldu_init(dev_priv, 0);
557 /* for old hardware without multimon only enable one display */
558 if (dev_priv->capabilities & SVGA_CAP_MULTIMON) { 562 if (dev_priv->capabilities & SVGA_CAP_MULTIMON) {
559 vmw_ldu_init(dev_priv, 1); 563 for (i = 0; i < VMWGFX_LDU_NUM_DU; ++i)
560 vmw_ldu_init(dev_priv, 2); 564 vmw_ldu_init(dev_priv, i);
561 vmw_ldu_init(dev_priv, 3); 565 ret = drm_vblank_init(dev, VMWGFX_LDU_NUM_DU);
562 vmw_ldu_init(dev_priv, 4); 566 } else {
563 vmw_ldu_init(dev_priv, 5); 567 /* for old hardware without multimon only enable one display */
564 vmw_ldu_init(dev_priv, 6); 568 vmw_ldu_init(dev_priv, 0);
565 vmw_ldu_init(dev_priv, 7); 569 ret = drm_vblank_init(dev, 1);
566 } 570 }
567 571
568 return 0; 572 return ret;
569} 573}
570 574
571int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv) 575int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv)
572{ 576{
577 struct drm_device *dev = dev_priv->dev;
578
579 drm_vblank_cleanup(dev);
573 if (!dev_priv->ldu_priv) 580 if (!dev_priv->ldu_priv)
574 return -ENOSYS; 581 return -ENOSYS;
575 582
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 5f2d5df01e5c..c8c40e9979db 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -211,6 +211,7 @@ static void vmw_hw_context_destroy(struct vmw_resource *res)
211 cmd->body.cid = cpu_to_le32(res->id); 211 cmd->body.cid = cpu_to_le32(res->id);
212 212
213 vmw_fifo_commit(dev_priv, sizeof(*cmd)); 213 vmw_fifo_commit(dev_priv, sizeof(*cmd));
214 vmw_3d_resource_dec(dev_priv);
214} 215}
215 216
216static int vmw_context_init(struct vmw_private *dev_priv, 217static int vmw_context_init(struct vmw_private *dev_priv,
@@ -247,6 +248,7 @@ static int vmw_context_init(struct vmw_private *dev_priv,
247 cmd->body.cid = cpu_to_le32(res->id); 248 cmd->body.cid = cpu_to_le32(res->id);
248 249
249 vmw_fifo_commit(dev_priv, sizeof(*cmd)); 250 vmw_fifo_commit(dev_priv, sizeof(*cmd));
251 (void) vmw_3d_resource_inc(dev_priv);
250 vmw_resource_activate(res, vmw_hw_context_destroy); 252 vmw_resource_activate(res, vmw_hw_context_destroy);
251 return 0; 253 return 0;
252} 254}
@@ -406,6 +408,7 @@ static void vmw_hw_surface_destroy(struct vmw_resource *res)
406 cmd->body.sid = cpu_to_le32(res->id); 408 cmd->body.sid = cpu_to_le32(res->id);
407 409
408 vmw_fifo_commit(dev_priv, sizeof(*cmd)); 410 vmw_fifo_commit(dev_priv, sizeof(*cmd));
411 vmw_3d_resource_dec(dev_priv);
409} 412}
410 413
411void vmw_surface_res_free(struct vmw_resource *res) 414void vmw_surface_res_free(struct vmw_resource *res)
@@ -473,6 +476,7 @@ int vmw_surface_init(struct vmw_private *dev_priv,
473 } 476 }
474 477
475 vmw_fifo_commit(dev_priv, submit_size); 478 vmw_fifo_commit(dev_priv, submit_size);
479 (void) vmw_3d_resource_inc(dev_priv);
476 vmw_resource_activate(res, vmw_hw_surface_destroy); 480 vmw_resource_activate(res, vmw_hw_surface_destroy);
477 return 0; 481 return 0;
478} 482}
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 537841ef44b9..75afb3b0e076 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -111,7 +111,7 @@ static struct platform_device *f71882fg_pdev;
111/* Super-I/O Function prototypes */ 111/* Super-I/O Function prototypes */
112static inline int superio_inb(int base, int reg); 112static inline int superio_inb(int base, int reg);
113static inline int superio_inw(int base, int reg); 113static inline int superio_inw(int base, int reg);
114static inline void superio_enter(int base); 114static inline int superio_enter(int base);
115static inline void superio_select(int base, int ld); 115static inline void superio_select(int base, int ld);
116static inline void superio_exit(int base); 116static inline void superio_exit(int base);
117 117
@@ -861,11 +861,20 @@ static int superio_inw(int base, int reg)
861 return val; 861 return val;
862} 862}
863 863
864static inline void superio_enter(int base) 864static inline int superio_enter(int base)
865{ 865{
866 /* Don't step on other drivers' I/O space by accident */
867 if (!request_muxed_region(base, 2, DRVNAME)) {
868 printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n",
869 base);
870 return -EBUSY;
871 }
872
866 /* according to the datasheet the key must be send twice! */ 873 /* according to the datasheet the key must be send twice! */
867 outb(SIO_UNLOCK_KEY, base); 874 outb(SIO_UNLOCK_KEY, base);
868 outb(SIO_UNLOCK_KEY, base); 875 outb(SIO_UNLOCK_KEY, base);
876
877 return 0;
869} 878}
870 879
871static inline void superio_select(int base, int ld) 880static inline void superio_select(int base, int ld)
@@ -877,6 +886,7 @@ static inline void superio_select(int base, int ld)
877static inline void superio_exit(int base) 886static inline void superio_exit(int base)
878{ 887{
879 outb(SIO_LOCK_KEY, base); 888 outb(SIO_LOCK_KEY, base);
889 release_region(base, 2);
880} 890}
881 891
882static inline int fan_from_reg(u16 reg) 892static inline int fan_from_reg(u16 reg)
@@ -2175,21 +2185,15 @@ static int f71882fg_remove(struct platform_device *pdev)
2175static int __init f71882fg_find(int sioaddr, unsigned short *address, 2185static int __init f71882fg_find(int sioaddr, unsigned short *address,
2176 struct f71882fg_sio_data *sio_data) 2186 struct f71882fg_sio_data *sio_data)
2177{ 2187{
2178 int err = -ENODEV;
2179 u16 devid; 2188 u16 devid;
2180 2189 int err = superio_enter(sioaddr);
2181 /* Don't step on other drivers' I/O space by accident */ 2190 if (err)
2182 if (!request_region(sioaddr, 2, DRVNAME)) { 2191 return err;
2183 printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n",
2184 (int)sioaddr);
2185 return -EBUSY;
2186 }
2187
2188 superio_enter(sioaddr);
2189 2192
2190 devid = superio_inw(sioaddr, SIO_REG_MANID); 2193 devid = superio_inw(sioaddr, SIO_REG_MANID);
2191 if (devid != SIO_FINTEK_ID) { 2194 if (devid != SIO_FINTEK_ID) {
2192 pr_debug(DRVNAME ": Not a Fintek device\n"); 2195 pr_debug(DRVNAME ": Not a Fintek device\n");
2196 err = -ENODEV;
2193 goto exit; 2197 goto exit;
2194 } 2198 }
2195 2199
@@ -2213,6 +2217,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
2213 default: 2217 default:
2214 printk(KERN_INFO DRVNAME ": Unsupported Fintek device: %04x\n", 2218 printk(KERN_INFO DRVNAME ": Unsupported Fintek device: %04x\n",
2215 (unsigned int)devid); 2219 (unsigned int)devid);
2220 err = -ENODEV;
2216 goto exit; 2221 goto exit;
2217 } 2222 }
2218 2223
@@ -2223,12 +2228,14 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
2223 2228
2224 if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { 2229 if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) {
2225 printk(KERN_WARNING DRVNAME ": Device not activated\n"); 2230 printk(KERN_WARNING DRVNAME ": Device not activated\n");
2231 err = -ENODEV;
2226 goto exit; 2232 goto exit;
2227 } 2233 }
2228 2234
2229 *address = superio_inw(sioaddr, SIO_REG_ADDR); 2235 *address = superio_inw(sioaddr, SIO_REG_ADDR);
2230 if (*address == 0) { 2236 if (*address == 0) {
2231 printk(KERN_WARNING DRVNAME ": Base address not set\n"); 2237 printk(KERN_WARNING DRVNAME ": Base address not set\n");
2238 err = -ENODEV;
2232 goto exit; 2239 goto exit;
2233 } 2240 }
2234 *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ 2241 *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */
@@ -2239,7 +2246,6 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
2239 (int)superio_inb(sioaddr, SIO_REG_DEVREV)); 2246 (int)superio_inb(sioaddr, SIO_REG_DEVREV));
2240exit: 2247exit:
2241 superio_exit(sioaddr); 2248 superio_exit(sioaddr);
2242 release_region(sioaddr, 2);
2243 return err; 2249 return err;
2244} 2250}
2245 2251
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index f7bd2613cecc..f2de3be35df3 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -677,6 +677,11 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev,
677 dev_dbg(&ofdev->dev, "hw routines for %s registered.\n", 677 dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
678 cpm->adap.name); 678 cpm->adap.name);
679 679
680 /*
681 * register OF I2C devices
682 */
683 of_i2c_register_devices(&cpm->adap);
684
680 return 0; 685 return 0;
681out_shut: 686out_shut:
682 cpm_i2c_shutdown(cpm); 687 cpm_i2c_shutdown(cpm);
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 2222c87876b9..b8feac5f2ef4 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -357,9 +357,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
357 357
358 dev->terminate = 0; 358 dev->terminate = 0;
359 359
360 /* write the data into mode register */
361 davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
362
363 /* 360 /*
364 * First byte should be set here, not after interrupt, 361 * First byte should be set here, not after interrupt,
365 * because transmit-data-ready interrupt can come before 362 * because transmit-data-ready interrupt can come before
@@ -371,6 +368,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
371 dev->buf_len--; 368 dev->buf_len--;
372 } 369 }
373 370
371 /* write the data into mode register; start transmitting */
372 davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
373
374 r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, 374 r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
375 dev->adapter.timeout); 375 dev->adapter.timeout);
376 if (r == 0) { 376 if (r == 0) {
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 43ca32fddde2..89eedf45d30e 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -761,6 +761,9 @@ static int __devinit iic_probe(struct platform_device *ofdev,
761 dev_info(&ofdev->dev, "using %s mode\n", 761 dev_info(&ofdev->dev, "using %s mode\n",
762 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); 762 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
763 763
764 /* Now register all the child nodes */
765 of_i2c_register_devices(adap);
766
764 return 0; 767 return 0;
765 768
766error_cleanup: 769error_cleanup:
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index a1c419a716af..b74e6dc6886c 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -632,6 +632,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
632 dev_err(i2c->dev, "failed to add adapter\n"); 632 dev_err(i2c->dev, "failed to add adapter\n");
633 goto fail_add; 633 goto fail_add;
634 } 634 }
635 of_i2c_register_devices(&i2c->adap);
635 636
636 return result; 637 return result;
637 638
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index 0e9f85d0a835..56dbe54e8811 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -218,7 +218,7 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c)
218 return result; 218 return result;
219 } else if (result == 0) { 219 } else if (result == 0) {
220 dev_dbg(i2c->dev, "%s: timeout\n", __func__); 220 dev_dbg(i2c->dev, "%s: timeout\n", __func__);
221 result = -ETIMEDOUT; 221 return -ETIMEDOUT;
222 } 222 }
223 223
224 return 0; 224 return 0;
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c
index bbd77603a417..29933f87d8fa 100644
--- a/drivers/i2c/busses/i2c-pca-isa.c
+++ b/drivers/i2c/busses/i2c-pca-isa.c
@@ -71,8 +71,8 @@ static int pca_isa_readbyte(void *pd, int reg)
71 71
72static int pca_isa_waitforcompletion(void *pd) 72static int pca_isa_waitforcompletion(void *pd)
73{ 73{
74 long ret = ~0;
75 unsigned long timeout; 74 unsigned long timeout;
75 long ret;
76 76
77 if (irq > -1) { 77 if (irq > -1) {
78 ret = wait_event_timeout(pca_wait, 78 ret = wait_event_timeout(pca_wait,
@@ -81,11 +81,15 @@ static int pca_isa_waitforcompletion(void *pd)
81 } else { 81 } else {
82 /* Do polling */ 82 /* Do polling */
83 timeout = jiffies + pca_isa_ops.timeout; 83 timeout = jiffies + pca_isa_ops.timeout;
84 while (((pca_isa_readbyte(pd, I2C_PCA_CON) 84 do {
85 & I2C_PCA_CON_SI) == 0) 85 ret = time_before(jiffies, timeout);
86 && (ret = time_before(jiffies, timeout))) 86 if (pca_isa_readbyte(pd, I2C_PCA_CON)
87 & I2C_PCA_CON_SI)
88 break;
87 udelay(100); 89 udelay(100);
90 } while (ret);
88 } 91 }
92
89 return ret > 0; 93 return ret > 0;
90} 94}
91 95
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index ef5c78487eb7..5f6d7f89e225 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -80,8 +80,8 @@ static void i2c_pca_pf_writebyte32(void *pd, int reg, int val)
80static int i2c_pca_pf_waitforcompletion(void *pd) 80static int i2c_pca_pf_waitforcompletion(void *pd)
81{ 81{
82 struct i2c_pca_pf_data *i2c = pd; 82 struct i2c_pca_pf_data *i2c = pd;
83 long ret = ~0;
84 unsigned long timeout; 83 unsigned long timeout;
84 long ret;
85 85
86 if (i2c->irq) { 86 if (i2c->irq) {
87 ret = wait_event_timeout(i2c->wait, 87 ret = wait_event_timeout(i2c->wait,
@@ -90,10 +90,13 @@ static int i2c_pca_pf_waitforcompletion(void *pd)
90 } else { 90 } else {
91 /* Do polling */ 91 /* Do polling */
92 timeout = jiffies + i2c->adap.timeout; 92 timeout = jiffies + i2c->adap.timeout;
93 while (((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) 93 do {
94 & I2C_PCA_CON_SI) == 0) 94 ret = time_before(jiffies, timeout);
95 && (ret = time_before(jiffies, timeout))) 95 if (i2c->algo_data.read_byte(i2c, I2C_PCA_CON)
96 & I2C_PCA_CON_SI)
97 break;
96 udelay(100); 98 udelay(100);
99 } while (ret);
97 } 100 }
98 101
99 return ret > 0; 102 return ret > 0;
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 72902e0bbfa7..bf831bf81587 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -662,8 +662,8 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
662 unsigned long sda_delay; 662 unsigned long sda_delay;
663 663
664 if (pdata->sda_delay) { 664 if (pdata->sda_delay) {
665 sda_delay = (freq / 1000) * pdata->sda_delay; 665 sda_delay = clkin * pdata->sda_delay;
666 sda_delay /= 1000000; 666 sda_delay = DIV_ROUND_UP(sda_delay, 1000000);
667 sda_delay = DIV_ROUND_UP(sda_delay, 5); 667 sda_delay = DIV_ROUND_UP(sda_delay, 5);
668 if (sda_delay > 3) 668 if (sda_delay > 3)
669 sda_delay = 3; 669 sda_delay = 3;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 6649176de940..bea4c5021d26 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -32,7 +32,6 @@
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/idr.h> 33#include <linux/idr.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/of_i2c.h>
36#include <linux/of_device.h> 35#include <linux/of_device.h>
37#include <linux/completion.h> 36#include <linux/completion.h>
38#include <linux/hardirq.h> 37#include <linux/hardirq.h>
@@ -197,11 +196,12 @@ static int i2c_device_pm_suspend(struct device *dev)
197{ 196{
198 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 197 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
199 198
200 if (pm_runtime_suspended(dev)) 199 if (pm) {
201 return 0; 200 if (pm_runtime_suspended(dev))
202 201 return 0;
203 if (pm) 202 else
204 return pm->suspend ? pm->suspend(dev) : 0; 203 return pm->suspend ? pm->suspend(dev) : 0;
204 }
205 205
206 return i2c_legacy_suspend(dev, PMSG_SUSPEND); 206 return i2c_legacy_suspend(dev, PMSG_SUSPEND);
207} 207}
@@ -216,12 +216,6 @@ static int i2c_device_pm_resume(struct device *dev)
216 else 216 else
217 ret = i2c_legacy_resume(dev); 217 ret = i2c_legacy_resume(dev);
218 218
219 if (!ret) {
220 pm_runtime_disable(dev);
221 pm_runtime_set_active(dev);
222 pm_runtime_enable(dev);
223 }
224
225 return ret; 219 return ret;
226} 220}
227 221
@@ -229,11 +223,12 @@ static int i2c_device_pm_freeze(struct device *dev)
229{ 223{
230 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 224 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
231 225
232 if (pm_runtime_suspended(dev)) 226 if (pm) {
233 return 0; 227 if (pm_runtime_suspended(dev))
234 228 return 0;
235 if (pm) 229 else
236 return pm->freeze ? pm->freeze(dev) : 0; 230 return pm->freeze ? pm->freeze(dev) : 0;
231 }
237 232
238 return i2c_legacy_suspend(dev, PMSG_FREEZE); 233 return i2c_legacy_suspend(dev, PMSG_FREEZE);
239} 234}
@@ -242,11 +237,12 @@ static int i2c_device_pm_thaw(struct device *dev)
242{ 237{
243 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 238 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
244 239
245 if (pm_runtime_suspended(dev)) 240 if (pm) {
246 return 0; 241 if (pm_runtime_suspended(dev))
247 242 return 0;
248 if (pm) 243 else
249 return pm->thaw ? pm->thaw(dev) : 0; 244 return pm->thaw ? pm->thaw(dev) : 0;
245 }
250 246
251 return i2c_legacy_resume(dev); 247 return i2c_legacy_resume(dev);
252} 248}
@@ -255,11 +251,12 @@ static int i2c_device_pm_poweroff(struct device *dev)
255{ 251{
256 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 252 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
257 253
258 if (pm_runtime_suspended(dev)) 254 if (pm) {
259 return 0; 255 if (pm_runtime_suspended(dev))
260 256 return 0;
261 if (pm) 257 else
262 return pm->poweroff ? pm->poweroff(dev) : 0; 258 return pm->poweroff ? pm->poweroff(dev) : 0;
259 }
263 260
264 return i2c_legacy_suspend(dev, PMSG_HIBERNATE); 261 return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
265} 262}
@@ -876,9 +873,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
876 if (adap->nr < __i2c_first_dynamic_bus_num) 873 if (adap->nr < __i2c_first_dynamic_bus_num)
877 i2c_scan_static_board_info(adap); 874 i2c_scan_static_board_info(adap);
878 875
879 /* Register devices from the device tree */
880 of_i2c_register_devices(adap);
881
882 /* Notify drivers */ 876 /* Notify drivers */
883 mutex_lock(&core_lock); 877 mutex_lock(&core_lock);
884 bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter); 878 bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter);
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index a10152bb1427..c37ef64d1465 100755..100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -83,7 +83,7 @@ static unsigned int mwait_substates;
83/* Reliable LAPIC Timer States, bit 1 for C1 etc. */ 83/* Reliable LAPIC Timer States, bit 1 for C1 etc. */
84static unsigned int lapic_timer_reliable_states; 84static unsigned int lapic_timer_reliable_states;
85 85
86static struct cpuidle_device *intel_idle_cpuidle_devices; 86static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
87static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state); 87static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state);
88 88
89static struct cpuidle_state *cpuidle_state_table; 89static struct cpuidle_state *cpuidle_state_table;
@@ -108,7 +108,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
108 .name = "NHM-C3", 108 .name = "NHM-C3",
109 .desc = "MWAIT 0x10", 109 .desc = "MWAIT 0x10",
110 .driver_data = (void *) 0x10, 110 .driver_data = (void *) 0x10,
111 .flags = CPUIDLE_FLAG_TIME_VALID, 111 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
112 .exit_latency = 20, 112 .exit_latency = 20,
113 .power_usage = 500, 113 .power_usage = 500,
114 .target_residency = 80, 114 .target_residency = 80,
@@ -117,7 +117,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
117 .name = "NHM-C6", 117 .name = "NHM-C6",
118 .desc = "MWAIT 0x20", 118 .desc = "MWAIT 0x20",
119 .driver_data = (void *) 0x20, 119 .driver_data = (void *) 0x20,
120 .flags = CPUIDLE_FLAG_TIME_VALID, 120 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
121 .exit_latency = 200, 121 .exit_latency = 200,
122 .power_usage = 350, 122 .power_usage = 350,
123 .target_residency = 800, 123 .target_residency = 800,
@@ -149,7 +149,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
149 .name = "ATM-C4", 149 .name = "ATM-C4",
150 .desc = "MWAIT 0x30", 150 .desc = "MWAIT 0x30",
151 .driver_data = (void *) 0x30, 151 .driver_data = (void *) 0x30,
152 .flags = CPUIDLE_FLAG_TIME_VALID, 152 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
153 .exit_latency = 100, 153 .exit_latency = 100,
154 .power_usage = 250, 154 .power_usage = 250,
155 .target_residency = 400, 155 .target_residency = 400,
@@ -157,13 +157,13 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
157 { /* MWAIT C5 */ }, 157 { /* MWAIT C5 */ },
158 { /* MWAIT C6 */ 158 { /* MWAIT C6 */
159 .name = "ATM-C6", 159 .name = "ATM-C6",
160 .desc = "MWAIT 0x40", 160 .desc = "MWAIT 0x52",
161 .driver_data = (void *) 0x40, 161 .driver_data = (void *) 0x52,
162 .flags = CPUIDLE_FLAG_TIME_VALID, 162 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
163 .exit_latency = 200, 163 .exit_latency = 140,
164 .power_usage = 150, 164 .power_usage = 150,
165 .target_residency = 800, 165 .target_residency = 560,
166 .enter = NULL }, /* disabled */ 166 .enter = &intel_idle },
167}; 167};
168 168
169/** 169/**
@@ -185,6 +185,16 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state)
185 185
186 local_irq_disable(); 186 local_irq_disable();
187 187
188 /*
189 * If the state flag indicates that the TLB will be flushed or if this
190 * is the deepest c-state supported, do a voluntary leave mm to avoid
191 * costly and mostly unnecessary wakeups for flushing the user TLB's
192 * associated with the active mm.
193 */
194 if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED ||
195 (&dev->states[dev->state_count - 1] == state))
196 leave_mm(cpu);
197
188 if (!(lapic_timer_reliable_states & (1 << (cstate)))) 198 if (!(lapic_timer_reliable_states & (1 << (cstate))))
189 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); 199 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
190 200
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index d85bd8a7967d..22239e988498 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -483,6 +483,9 @@ static int joydev_handle_JSIOCSAXMAP(struct joydev *joydev,
483 483
484 memcpy(joydev->abspam, abspam, len); 484 memcpy(joydev->abspam, abspam, len);
485 485
486 for (i = 0; i < joydev->nabs; i++)
487 joydev->absmap[joydev->abspam[i]] = i;
488
486 out: 489 out:
487 kfree(abspam); 490 kfree(abspam);
488 return retval; 491 return retval;
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 9cc488d21490..aa037fec2f86 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -338,7 +338,7 @@ config KEYBOARD_OPENCORES
338 338
339config KEYBOARD_PXA27x 339config KEYBOARD_PXA27x
340 tristate "PXA27x/PXA3xx keypad support" 340 tristate "PXA27x/PXA3xx keypad support"
341 depends on PXA27x || PXA3xx 341 depends on PXA27x || PXA3xx || ARCH_MMP
342 help 342 help
343 Enable support for PXA27x/PXA3xx keypad controller. 343 Enable support for PXA27x/PXA3xx keypad controller.
344 344
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index f32404f99189..4b0ec35259a1 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -32,7 +32,7 @@
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/pxa27x_keypad.h> 35#include <plat/pxa27x_keypad.h>
36/* 36/*
37 * Keypad Controller registers 37 * Keypad Controller registers
38 */ 38 */
@@ -330,11 +330,21 @@ static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad)
330 keypad->direct_key_state = new_state; 330 keypad->direct_key_state = new_state;
331} 331}
332 332
333static void clear_wakeup_event(struct pxa27x_keypad *keypad)
334{
335 struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
336
337 if (pdata->clear_wakeup_event)
338 (pdata->clear_wakeup_event)();
339}
340
333static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id) 341static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id)
334{ 342{
335 struct pxa27x_keypad *keypad = dev_id; 343 struct pxa27x_keypad *keypad = dev_id;
336 unsigned long kpc = keypad_readl(KPC); 344 unsigned long kpc = keypad_readl(KPC);
337 345
346 clear_wakeup_event(keypad);
347
338 if (kpc & KPC_DI) 348 if (kpc & KPC_DI)
339 pxa27x_keypad_scan_direct(keypad); 349 pxa27x_keypad_scan_direct(keypad);
340 350
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 0d4266a533a5..360698553eb5 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -404,6 +404,13 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu
404 retval = uinput_validate_absbits(dev); 404 retval = uinput_validate_absbits(dev);
405 if (retval < 0) 405 if (retval < 0)
406 goto exit; 406 goto exit;
407 if (test_bit(ABS_MT_SLOT, dev->absbit)) {
408 int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;
409 input_mt_create_slots(dev, nslot);
410 input_set_events_per_packet(dev, 6 * nslot);
411 } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
412 input_set_events_per_packet(dev, 60);
413 }
407 } 414 }
408 415
409 udev->state = UIST_SETUP_COMPLETE; 416 udev->state = UIST_SETUP_COMPLETE;
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 42ba3691d908..b35876ee6908 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -103,27 +103,26 @@ static void wacom_sys_irq(struct urb *urb)
103static int wacom_open(struct input_dev *dev) 103static int wacom_open(struct input_dev *dev)
104{ 104{
105 struct wacom *wacom = input_get_drvdata(dev); 105 struct wacom *wacom = input_get_drvdata(dev);
106 int retval = 0;
106 107
107 mutex_lock(&wacom->lock); 108 if (usb_autopm_get_interface(wacom->intf) < 0)
108
109 wacom->irq->dev = wacom->usbdev;
110
111 if (usb_autopm_get_interface(wacom->intf) < 0) {
112 mutex_unlock(&wacom->lock);
113 return -EIO; 109 return -EIO;
114 } 110
111 mutex_lock(&wacom->lock);
115 112
116 if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { 113 if (usb_submit_urb(wacom->irq, GFP_KERNEL)) {
117 usb_autopm_put_interface(wacom->intf); 114 retval = -EIO;
118 mutex_unlock(&wacom->lock); 115 goto out;
119 return -EIO;
120 } 116 }
121 117
122 wacom->open = true; 118 wacom->open = true;
123 wacom->intf->needs_remote_wakeup = 1; 119 wacom->intf->needs_remote_wakeup = 1;
124 120
121out:
125 mutex_unlock(&wacom->lock); 122 mutex_unlock(&wacom->lock);
126 return 0; 123 if (retval)
124 usb_autopm_put_interface(wacom->intf);
125 return retval;
127} 126}
128 127
129static void wacom_close(struct input_dev *dev) 128static void wacom_close(struct input_dev *dev)
@@ -135,6 +134,8 @@ static void wacom_close(struct input_dev *dev)
135 wacom->open = false; 134 wacom->open = false;
136 wacom->intf->needs_remote_wakeup = 0; 135 wacom->intf->needs_remote_wakeup = 0;
137 mutex_unlock(&wacom->lock); 136 mutex_unlock(&wacom->lock);
137
138 usb_autopm_put_interface(wacom->intf);
138} 139}
139 140
140static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, 141static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc,
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 6e29badb969e..47fd7a041c52 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -442,8 +442,10 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
442 /* general pen packet */ 442 /* general pen packet */
443 if ((data[1] & 0xb8) == 0xa0) { 443 if ((data[1] & 0xb8) == 0xa0) {
444 t = (data[6] << 2) | ((data[7] >> 6) & 3); 444 t = (data[6] << 2) | ((data[7] >> 6) & 3);
445 if (features->type >= INTUOS4S && features->type <= INTUOS4L) 445 if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
446 features->type == WACOM_21UX2) {
446 t = (t << 1) | (data[1] & 1); 447 t = (t << 1) | (data[1] & 1);
448 }
447 input_report_abs(input, ABS_PRESSURE, t); 449 input_report_abs(input, ABS_PRESSURE, t);
448 input_report_abs(input, ABS_TILT_X, 450 input_report_abs(input, ABS_TILT_X,
449 ((data[7] << 1) & 0x7e) | (data[8] >> 7)); 451 ((data[7] << 1) & 0x7e) | (data[8] >> 7));
diff --git a/drivers/isdn/sc/interrupt.c b/drivers/isdn/sc/interrupt.c
index 485be8b1e1b3..f0225bc0f267 100644
--- a/drivers/isdn/sc/interrupt.c
+++ b/drivers/isdn/sc/interrupt.c
@@ -112,11 +112,19 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst)
112 } 112 }
113 else if(callid>=0x0000 && callid<=0x7FFF) 113 else if(callid>=0x0000 && callid<=0x7FFF)
114 { 114 {
115 int len;
116
115 pr_debug("%s: Got Incoming Call\n", 117 pr_debug("%s: Got Incoming Call\n",
116 sc_adapter[card]->devicename); 118 sc_adapter[card]->devicename);
117 strcpy(setup.phone,&(rcvmsg.msg_data.byte_array[4])); 119 len = strlcpy(setup.phone, &(rcvmsg.msg_data.byte_array[4]),
118 strcpy(setup.eazmsn, 120 sizeof(setup.phone));
119 sc_adapter[card]->channel[rcvmsg.phy_link_no-1].dn); 121 if (len >= sizeof(setup.phone))
122 continue;
123 len = strlcpy(setup.eazmsn,
124 sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn,
125 sizeof(setup.eazmsn));
126 if (len >= sizeof(setup.eazmsn))
127 continue;
120 setup.si1 = 7; 128 setup.si1 = 7;
121 setup.si2 = 0; 129 setup.si2 = 0;
122 setup.plan = 0; 130 setup.plan = 0;
@@ -176,7 +184,9 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst)
176 * Handle a GetMyNumber Rsp 184 * Handle a GetMyNumber Rsp
177 */ 185 */
178 if (IS_CE_MESSAGE(rcvmsg,Call,0,GetMyNumber)){ 186 if (IS_CE_MESSAGE(rcvmsg,Call,0,GetMyNumber)){
179 strcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no-1].dn,rcvmsg.msg_data.byte_array); 187 strlcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn,
188 rcvmsg.msg_data.byte_array,
189 sizeof(rcvmsg.msg_data.byte_array));
180 continue; 190 continue;
181 } 191 }
182 192
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index e4112622e5a2..cc2a88d5192f 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -304,13 +304,22 @@ config LEDS_MC13783
304 304
305config LEDS_NS2 305config LEDS_NS2
306 tristate "LED support for Network Space v2 GPIO LEDs" 306 tristate "LED support for Network Space v2 GPIO LEDs"
307 depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 307 depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 || D2NET_V2
308 default y 308 default y
309 help 309 help
310 This option enable support for the dual-GPIO LED found on the 310 This option enable support for the dual-GPIO LED found on the
311 Network Space v2 board (and parents). This include Internet Space v2, 311 Network Space v2 board (and parents). This include Internet Space v2,
312 Network Space (Max) v2 and d2 Network v2 boards. 312 Network Space (Max) v2 and d2 Network v2 boards.
313 313
314config LEDS_NETXBIG
315 tristate "LED support for Big Network series LEDs"
316 depends on MACH_NET2BIG_V2 || MACH_NET5BIG_V2
317 default y
318 help
319 This option enable support for LEDs found on the LaCie 2Big
320 and 5Big Network v2 boards. The LEDs are wired to a CPLD and are
321 controlled through a GPIO extension bus.
322
314config LEDS_TRIGGERS 323config LEDS_TRIGGERS
315 bool "LED Trigger support" 324 bool "LED Trigger support"
316 help 325 help
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 7d6b95831f8e..9c96db40ef6d 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
38obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o 38obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o
39obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o 39obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o
40obj-$(CONFIG_LEDS_NS2) += leds-ns2.o 40obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
41obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
41 42
42# LED SPI Drivers 43# LED SPI Drivers
43obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o 44obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
new file mode 100644
index 000000000000..f2e51c134399
--- /dev/null
+++ b/drivers/leds/leds-netxbig.c
@@ -0,0 +1,449 @@
1/*
2 * leds-netxbig.c - Driver for the 2Big and 5Big Network series LEDs
3 *
4 * Copyright (C) 2010 LaCie
5 *
6 * Author: Simon Guinot <sguinot@lacie.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 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/module.h>
24#include <linux/init.h>
25#include <linux/irq.h>
26#include <linux/slab.h>
27#include <linux/spinlock.h>
28#include <linux/platform_device.h>
29#include <linux/gpio.h>
30#include <linux/leds.h>
31#include <mach/leds-netxbig.h>
32
33/*
34 * GPIO extension bus.
35 */
36
37static DEFINE_SPINLOCK(gpio_ext_lock);
38
39static void gpio_ext_set_addr(struct netxbig_gpio_ext *gpio_ext, int addr)
40{
41 int pin;
42
43 for (pin = 0; pin < gpio_ext->num_addr; pin++)
44 gpio_set_value(gpio_ext->addr[pin], (addr >> pin) & 1);
45}
46
47static void gpio_ext_set_data(struct netxbig_gpio_ext *gpio_ext, int data)
48{
49 int pin;
50
51 for (pin = 0; pin < gpio_ext->num_data; pin++)
52 gpio_set_value(gpio_ext->data[pin], (data >> pin) & 1);
53}
54
55static void gpio_ext_enable_select(struct netxbig_gpio_ext *gpio_ext)
56{
57 /* Enable select is done on the raising edge. */
58 gpio_set_value(gpio_ext->enable, 0);
59 gpio_set_value(gpio_ext->enable, 1);
60}
61
62static void gpio_ext_set_value(struct netxbig_gpio_ext *gpio_ext,
63 int addr, int value)
64{
65 unsigned long flags;
66
67 spin_lock_irqsave(&gpio_ext_lock, flags);
68 gpio_ext_set_addr(gpio_ext, addr);
69 gpio_ext_set_data(gpio_ext, value);
70 gpio_ext_enable_select(gpio_ext);
71 spin_unlock_irqrestore(&gpio_ext_lock, flags);
72}
73
74static int __devinit gpio_ext_init(struct netxbig_gpio_ext *gpio_ext)
75{
76 int err;
77 int i;
78
79 if (unlikely(!gpio_ext))
80 return -EINVAL;
81
82 /* Configure address GPIOs. */
83 for (i = 0; i < gpio_ext->num_addr; i++) {
84 err = gpio_request(gpio_ext->addr[i], "GPIO extension addr");
85 if (err)
86 goto err_free_addr;
87 err = gpio_direction_output(gpio_ext->addr[i], 0);
88 if (err) {
89 gpio_free(gpio_ext->addr[i]);
90 goto err_free_addr;
91 }
92 }
93 /* Configure data GPIOs. */
94 for (i = 0; i < gpio_ext->num_data; i++) {
95 err = gpio_request(gpio_ext->data[i], "GPIO extension data");
96 if (err)
97 goto err_free_data;
98 err = gpio_direction_output(gpio_ext->data[i], 0);
99 if (err) {
100 gpio_free(gpio_ext->data[i]);
101 goto err_free_data;
102 }
103 }
104 /* Configure "enable select" GPIO. */
105 err = gpio_request(gpio_ext->enable, "GPIO extension enable");
106 if (err)
107 goto err_free_data;
108 err = gpio_direction_output(gpio_ext->enable, 0);
109 if (err) {
110 gpio_free(gpio_ext->enable);
111 goto err_free_data;
112 }
113
114 return 0;
115
116err_free_data:
117 for (i = i - 1; i >= 0; i--)
118 gpio_free(gpio_ext->data[i]);
119 i = gpio_ext->num_addr;
120err_free_addr:
121 for (i = i - 1; i >= 0; i--)
122 gpio_free(gpio_ext->addr[i]);
123
124 return err;
125}
126
127static void __devexit gpio_ext_free(struct netxbig_gpio_ext *gpio_ext)
128{
129 int i;
130
131 gpio_free(gpio_ext->enable);
132 for (i = gpio_ext->num_addr - 1; i >= 0; i--)
133 gpio_free(gpio_ext->addr[i]);
134 for (i = gpio_ext->num_data - 1; i >= 0; i--)
135 gpio_free(gpio_ext->data[i]);
136}
137
138/*
139 * Class LED driver.
140 */
141
142struct netxbig_led_data {
143 struct netxbig_gpio_ext *gpio_ext;
144 struct led_classdev cdev;
145 int mode_addr;
146 int *mode_val;
147 int bright_addr;
148 int bright_max;
149 struct netxbig_led_timer *timer;
150 int num_timer;
151 enum netxbig_led_mode mode;
152 int sata;
153 spinlock_t lock;
154};
155
156static int netxbig_led_get_timer_mode(enum netxbig_led_mode *mode,
157 unsigned long delay_on,
158 unsigned long delay_off,
159 struct netxbig_led_timer *timer,
160 int num_timer)
161{
162 int i;
163
164 for (i = 0; i < num_timer; i++) {
165 if (timer[i].delay_on == delay_on &&
166 timer[i].delay_off == delay_off) {
167 *mode = timer[i].mode;
168 return 0;
169 }
170 }
171 return -EINVAL;
172}
173
174static int netxbig_led_blink_set(struct led_classdev *led_cdev,
175 unsigned long *delay_on,
176 unsigned long *delay_off)
177{
178 struct netxbig_led_data *led_dat =
179 container_of(led_cdev, struct netxbig_led_data, cdev);
180 enum netxbig_led_mode mode;
181 int mode_val;
182 int ret;
183
184 /* Look for a LED mode with the requested timer frequency. */
185 ret = netxbig_led_get_timer_mode(&mode, *delay_on, *delay_off,
186 led_dat->timer, led_dat->num_timer);
187 if (ret < 0)
188 return ret;
189
190 mode_val = led_dat->mode_val[mode];
191 if (mode_val == NETXBIG_LED_INVALID_MODE)
192 return -EINVAL;
193
194 spin_lock_irq(&led_dat->lock);
195
196 gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val);
197 led_dat->mode = mode;
198
199 spin_unlock_irq(&led_dat->lock);
200
201 return 0;
202}
203
204static void netxbig_led_set(struct led_classdev *led_cdev,
205 enum led_brightness value)
206{
207 struct netxbig_led_data *led_dat =
208 container_of(led_cdev, struct netxbig_led_data, cdev);
209 enum netxbig_led_mode mode;
210 int mode_val, bright_val;
211 int set_brightness = 1;
212 unsigned long flags;
213
214 spin_lock_irqsave(&led_dat->lock, flags);
215
216 if (value == LED_OFF) {
217 mode = NETXBIG_LED_OFF;
218 set_brightness = 0;
219 } else {
220 if (led_dat->sata)
221 mode = NETXBIG_LED_SATA;
222 else if (led_dat->mode == NETXBIG_LED_OFF)
223 mode = NETXBIG_LED_ON;
224 else /* Keep 'timer' mode. */
225 mode = led_dat->mode;
226 }
227 mode_val = led_dat->mode_val[mode];
228
229 gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val);
230 led_dat->mode = mode;
231 /*
232 * Note that the brightness register is shared between all the
233 * SATA LEDs. So, change the brightness setting for a single
234 * SATA LED will affect all the others.
235 */
236 if (set_brightness) {
237 bright_val = DIV_ROUND_UP(value * led_dat->bright_max,
238 LED_FULL);
239 gpio_ext_set_value(led_dat->gpio_ext,
240 led_dat->bright_addr, bright_val);
241 }
242
243 spin_unlock_irqrestore(&led_dat->lock, flags);
244}
245
246static ssize_t netxbig_led_sata_store(struct device *dev,
247 struct device_attribute *attr,
248 const char *buff, size_t count)
249{
250 struct led_classdev *led_cdev = dev_get_drvdata(dev);
251 struct netxbig_led_data *led_dat =
252 container_of(led_cdev, struct netxbig_led_data, cdev);
253 unsigned long enable;
254 enum netxbig_led_mode mode;
255 int mode_val;
256 int ret;
257
258 ret = strict_strtoul(buff, 10, &enable);
259 if (ret < 0)
260 return ret;
261
262 enable = !!enable;
263
264 spin_lock_irq(&led_dat->lock);
265
266 if (led_dat->sata == enable) {
267 ret = count;
268 goto exit_unlock;
269 }
270
271 if (led_dat->mode != NETXBIG_LED_ON &&
272 led_dat->mode != NETXBIG_LED_SATA)
273 mode = led_dat->mode; /* Keep modes 'off' and 'timer'. */
274 else if (enable)
275 mode = NETXBIG_LED_SATA;
276 else
277 mode = NETXBIG_LED_ON;
278
279 mode_val = led_dat->mode_val[mode];
280 if (mode_val == NETXBIG_LED_INVALID_MODE) {
281 ret = -EINVAL;
282 goto exit_unlock;
283 }
284
285 gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val);
286 led_dat->mode = mode;
287 led_dat->sata = enable;
288
289 ret = count;
290
291exit_unlock:
292 spin_unlock_irq(&led_dat->lock);
293
294 return ret;
295}
296
297static ssize_t netxbig_led_sata_show(struct device *dev,
298 struct device_attribute *attr, char *buf)
299{
300 struct led_classdev *led_cdev = dev_get_drvdata(dev);
301 struct netxbig_led_data *led_dat =
302 container_of(led_cdev, struct netxbig_led_data, cdev);
303
304 return sprintf(buf, "%d\n", led_dat->sata);
305}
306
307static DEVICE_ATTR(sata, 0644, netxbig_led_sata_show, netxbig_led_sata_store);
308
309static void __devexit delete_netxbig_led(struct netxbig_led_data *led_dat)
310{
311 if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE)
312 device_remove_file(led_dat->cdev.dev, &dev_attr_sata);
313 led_classdev_unregister(&led_dat->cdev);
314}
315
316static int __devinit
317create_netxbig_led(struct platform_device *pdev,
318 struct netxbig_led_data *led_dat,
319 const struct netxbig_led *template)
320{
321 struct netxbig_led_platform_data *pdata = pdev->dev.platform_data;
322 int ret;
323
324 spin_lock_init(&led_dat->lock);
325 led_dat->gpio_ext = pdata->gpio_ext;
326 led_dat->cdev.name = template->name;
327 led_dat->cdev.default_trigger = template->default_trigger;
328 led_dat->cdev.blink_set = netxbig_led_blink_set;
329 led_dat->cdev.brightness_set = netxbig_led_set;
330 /*
331 * Because the GPIO extension bus don't allow to read registers
332 * value, there is no way to probe the LED initial state.
333 * So, the initial sysfs LED value for the "brightness" and "sata"
334 * attributes are inconsistent.
335 *
336 * Note that the initial LED state can't be reconfigured.
337 * The reason is that the LED behaviour must stay uniform during
338 * the whole boot process (bootloader+linux).
339 */
340 led_dat->sata = 0;
341 led_dat->cdev.brightness = LED_OFF;
342 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
343 led_dat->mode_addr = template->mode_addr;
344 led_dat->mode_val = template->mode_val;
345 led_dat->bright_addr = template->bright_addr;
346 led_dat->bright_max = (1 << pdata->gpio_ext->num_data) - 1;
347 led_dat->timer = pdata->timer;
348 led_dat->num_timer = pdata->num_timer;
349
350 ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
351 if (ret < 0)
352 return ret;
353
354 /*
355 * If available, expose the SATA activity blink capability through
356 * a "sata" sysfs attribute.
357 */
358 if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) {
359 ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata);
360 if (ret)
361 led_classdev_unregister(&led_dat->cdev);
362 }
363
364 return ret;
365}
366
367static int __devinit netxbig_led_probe(struct platform_device *pdev)
368{
369 struct netxbig_led_platform_data *pdata = pdev->dev.platform_data;
370 struct netxbig_led_data *leds_data;
371 int i;
372 int ret;
373
374 if (!pdata)
375 return -EINVAL;
376
377 leds_data = kzalloc(sizeof(struct netxbig_led_data) * pdata->num_leds,
378 GFP_KERNEL);
379 if (!leds_data)
380 return -ENOMEM;
381
382 ret = gpio_ext_init(pdata->gpio_ext);
383 if (ret < 0)
384 goto err_free_data;
385
386 for (i = 0; i < pdata->num_leds; i++) {
387 ret = create_netxbig_led(pdev, &leds_data[i], &pdata->leds[i]);
388 if (ret < 0)
389 goto err_free_leds;
390 }
391
392 platform_set_drvdata(pdev, leds_data);
393
394 return 0;
395
396err_free_leds:
397 for (i = i - 1; i >= 0; i--)
398 delete_netxbig_led(&leds_data[i]);
399
400 gpio_ext_free(pdata->gpio_ext);
401err_free_data:
402 kfree(leds_data);
403
404 return ret;
405}
406
407static int __devexit netxbig_led_remove(struct platform_device *pdev)
408{
409 struct netxbig_led_platform_data *pdata = pdev->dev.platform_data;
410 struct netxbig_led_data *leds_data;
411 int i;
412
413 leds_data = platform_get_drvdata(pdev);
414
415 for (i = 0; i < pdata->num_leds; i++)
416 delete_netxbig_led(&leds_data[i]);
417
418 gpio_ext_free(pdata->gpio_ext);
419 kfree(leds_data);
420
421 return 0;
422}
423
424static struct platform_driver netxbig_led_driver = {
425 .probe = netxbig_led_probe,
426 .remove = __devexit_p(netxbig_led_remove),
427 .driver = {
428 .name = "leds-netxbig",
429 .owner = THIS_MODULE,
430 },
431};
432MODULE_ALIAS("platform:leds-netxbig");
433
434static int __init netxbig_led_init(void)
435{
436 return platform_driver_register(&netxbig_led_driver);
437}
438
439static void __exit netxbig_led_exit(void)
440{
441 platform_driver_unregister(&netxbig_led_driver);
442}
443
444module_init(netxbig_led_init);
445module_exit(netxbig_led_exit);
446
447MODULE_AUTHOR("Simon Guinot <sguinot@lacie.com>");
448MODULE_DESCRIPTION("LED driver for LaCie xBig Network boards");
449MODULE_LICENSE("GPL");
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index 350eb34f049c..f77d48d0b3e4 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -141,10 +141,12 @@ static ssize_t ns2_led_sata_store(struct device *dev,
141 struct device_attribute *attr, 141 struct device_attribute *attr,
142 const char *buff, size_t count) 142 const char *buff, size_t count)
143{ 143{
144 struct led_classdev *led_cdev = dev_get_drvdata(dev);
145 struct ns2_led_data *led_dat =
146 container_of(led_cdev, struct ns2_led_data, cdev);
144 int ret; 147 int ret;
145 unsigned long enable; 148 unsigned long enable;
146 enum ns2_led_modes mode; 149 enum ns2_led_modes mode;
147 struct ns2_led_data *led_dat = dev_get_drvdata(dev);
148 150
149 ret = strict_strtoul(buff, 10, &enable); 151 ret = strict_strtoul(buff, 10, &enable);
150 if (ret < 0) 152 if (ret < 0)
@@ -172,7 +174,9 @@ static ssize_t ns2_led_sata_store(struct device *dev,
172static ssize_t ns2_led_sata_show(struct device *dev, 174static ssize_t ns2_led_sata_show(struct device *dev,
173 struct device_attribute *attr, char *buf) 175 struct device_attribute *attr, char *buf)
174{ 176{
175 struct ns2_led_data *led_dat = dev_get_drvdata(dev); 177 struct led_classdev *led_cdev = dev_get_drvdata(dev);
178 struct ns2_led_data *led_dat =
179 container_of(led_cdev, struct ns2_led_data, cdev);
176 180
177 return sprintf(buf, "%d\n", led_dat->sata); 181 return sprintf(buf, "%d\n", led_dat->sata);
178} 182}
@@ -234,7 +238,6 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
234 if (ret < 0) 238 if (ret < 0)
235 goto err_free_slow; 239 goto err_free_slow;
236 240
237 dev_set_drvdata(led_dat->cdev.dev, led_dat);
238 ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); 241 ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata);
239 if (ret < 0) 242 if (ret < 0)
240 goto err_free_cdev; 243 goto err_free_cdev;
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index ed4900ade93a..e4fb58db5454 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1000,10 +1000,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
1000 page = bitmap->sb_page; 1000 page = bitmap->sb_page;
1001 offset = sizeof(bitmap_super_t); 1001 offset = sizeof(bitmap_super_t);
1002 if (!file) 1002 if (!file)
1003 read_sb_page(bitmap->mddev, 1003 page = read_sb_page(
1004 bitmap->mddev->bitmap_info.offset, 1004 bitmap->mddev,
1005 page, 1005 bitmap->mddev->bitmap_info.offset,
1006 index, count); 1006 page,
1007 index, count);
1007 } else if (file) { 1008 } else if (file) {
1008 page = read_page(file, index, bitmap, count); 1009 page = read_page(file, index, bitmap, count);
1009 offset = 0; 1010 offset = 0;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ad83a4dcadc3..0b830bbe1d8b 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1839,7 +1839,9 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1839 1839
1840 /* take from bio_init */ 1840 /* take from bio_init */
1841 bio->bi_next = NULL; 1841 bio->bi_next = NULL;
1842 bio->bi_flags &= ~(BIO_POOL_MASK-1);
1842 bio->bi_flags |= 1 << BIO_UPTODATE; 1843 bio->bi_flags |= 1 << BIO_UPTODATE;
1844 bio->bi_comp_cpu = -1;
1843 bio->bi_rw = READ; 1845 bio->bi_rw = READ;
1844 bio->bi_vcnt = 0; 1846 bio->bi_vcnt = 0;
1845 bio->bi_idx = 0; 1847 bio->bi_idx = 0;
@@ -1912,7 +1914,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1912 !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) 1914 !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
1913 break; 1915 break;
1914 BUG_ON(sync_blocks < (PAGE_SIZE>>9)); 1916 BUG_ON(sync_blocks < (PAGE_SIZE>>9));
1915 if (len > (sync_blocks<<9)) 1917 if ((len >> 9) > sync_blocks)
1916 len = sync_blocks<<9; 1918 len = sync_blocks<<9;
1917 } 1919 }
1918 1920
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 7e82a9df726b..7961d59f5cac 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -319,7 +319,7 @@ static void ir_timer_keyup(unsigned long cookie)
319 * a keyup event might follow immediately after the keydown. 319 * a keyup event might follow immediately after the keydown.
320 */ 320 */
321 spin_lock_irqsave(&ir->keylock, flags); 321 spin_lock_irqsave(&ir->keylock, flags);
322 if (time_is_after_eq_jiffies(ir->keyup_jiffies)) 322 if (time_is_before_eq_jiffies(ir->keyup_jiffies))
323 ir_keyup(ir); 323 ir_keyup(ir);
324 spin_unlock_irqrestore(&ir->keylock, flags); 324 spin_unlock_irqrestore(&ir->keylock, flags);
325} 325}
@@ -510,6 +510,13 @@ int __ir_input_register(struct input_dev *input_dev,
510 (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ? 510 (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ?
511 " in raw mode" : ""); 511 " in raw mode" : "");
512 512
513 /*
514 * Default delay of 250ms is too short for some protocols, expecially
515 * since the timeout is currently set to 250ms. Increase it to 500ms,
516 * to avoid wrong repetition of the keycodes.
517 */
518 input_dev->rep[REP_DELAY] = 500;
519
513 return 0; 520 return 0;
514 521
515out_event: 522out_event:
diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c
index 77b5946413c0..e63f757d5d72 100644
--- a/drivers/media/IR/ir-lirc-codec.c
+++ b/drivers/media/IR/ir-lirc-codec.c
@@ -267,7 +267,7 @@ static int ir_lirc_register(struct input_dev *input_dev)
267 features |= LIRC_CAN_SET_SEND_CARRIER; 267 features |= LIRC_CAN_SET_SEND_CARRIER;
268 268
269 if (ir_dev->props->s_tx_duty_cycle) 269 if (ir_dev->props->s_tx_duty_cycle)
270 features |= LIRC_CAN_SET_REC_DUTY_CYCLE; 270 features |= LIRC_CAN_SET_SEND_DUTY_CYCLE;
271 } 271 }
272 272
273 if (ir_dev->props->s_rx_carrier_range) 273 if (ir_dev->props->s_rx_carrier_range)
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
index 43094e7eccfa..8e0e1b1f8c87 100644
--- a/drivers/media/IR/ir-raw-event.c
+++ b/drivers/media/IR/ir-raw-event.c
@@ -279,9 +279,11 @@ int ir_raw_event_register(struct input_dev *input_dev)
279 "rc%u", (unsigned int)ir->devno); 279 "rc%u", (unsigned int)ir->devno);
280 280
281 if (IS_ERR(ir->raw->thread)) { 281 if (IS_ERR(ir->raw->thread)) {
282 int ret = PTR_ERR(ir->raw->thread);
283
282 kfree(ir->raw); 284 kfree(ir->raw);
283 ir->raw = NULL; 285 ir->raw = NULL;
284 return PTR_ERR(ir->raw->thread); 286 return ret;
285 } 287 }
286 288
287 mutex_lock(&ir_raw_handler_lock); 289 mutex_lock(&ir_raw_handler_lock);
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index 96dafc425c8e..46d42467f9b4 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -67,13 +67,14 @@ static ssize_t show_protocols(struct device *d,
67 char *tmp = buf; 67 char *tmp = buf;
68 int i; 68 int i;
69 69
70 if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { 70 if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) {
71 enabled = ir_dev->rc_tab.ir_type; 71 enabled = ir_dev->rc_tab.ir_type;
72 allowed = ir_dev->props->allowed_protos; 72 allowed = ir_dev->props->allowed_protos;
73 } else { 73 } else if (ir_dev->raw) {
74 enabled = ir_dev->raw->enabled_protocols; 74 enabled = ir_dev->raw->enabled_protocols;
75 allowed = ir_raw_get_allowed_protocols(); 75 allowed = ir_raw_get_allowed_protocols();
76 } 76 } else
77 return sprintf(tmp, "[builtin]\n");
77 78
78 IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", 79 IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
79 (long long)allowed, 80 (long long)allowed,
@@ -121,10 +122,14 @@ static ssize_t store_protocols(struct device *d,
121 int rc, i, count = 0; 122 int rc, i, count = 0;
122 unsigned long flags; 123 unsigned long flags;
123 124
124 if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) 125 if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE)
125 type = ir_dev->rc_tab.ir_type; 126 type = ir_dev->rc_tab.ir_type;
126 else 127 else if (ir_dev->raw)
127 type = ir_dev->raw->enabled_protocols; 128 type = ir_dev->raw->enabled_protocols;
129 else {
130 IR_dprintk(1, "Protocol switching not supported\n");
131 return -EINVAL;
132 }
128 133
129 while ((tmp = strsep((char **) &data, " \n")) != NULL) { 134 while ((tmp = strsep((char **) &data, " \n")) != NULL) {
130 if (!*tmp) 135 if (!*tmp)
@@ -185,7 +190,7 @@ static ssize_t store_protocols(struct device *d,
185 } 190 }
186 } 191 }
187 192
188 if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { 193 if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) {
189 spin_lock_irqsave(&ir_dev->rc_tab.lock, flags); 194 spin_lock_irqsave(&ir_dev->rc_tab.lock, flags);
190 ir_dev->rc_tab.ir_type = type; 195 ir_dev->rc_tab.ir_type = type;
191 spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); 196 spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags);
diff --git a/drivers/media/IR/keymaps/rc-rc6-mce.c b/drivers/media/IR/keymaps/rc-rc6-mce.c
index 64264f7f838f..39557ad401b6 100644
--- a/drivers/media/IR/keymaps/rc-rc6-mce.c
+++ b/drivers/media/IR/keymaps/rc-rc6-mce.c
@@ -19,6 +19,7 @@ static struct ir_scancode rc6_mce[] = {
19 19
20 { 0x800f0416, KEY_PLAY }, 20 { 0x800f0416, KEY_PLAY },
21 { 0x800f0418, KEY_PAUSE }, 21 { 0x800f0418, KEY_PAUSE },
22 { 0x800f046e, KEY_PLAYPAUSE },
22 { 0x800f0419, KEY_STOP }, 23 { 0x800f0419, KEY_STOP },
23 { 0x800f0417, KEY_RECORD }, 24 { 0x800f0417, KEY_RECORD },
24 25
@@ -37,6 +38,8 @@ static struct ir_scancode rc6_mce[] = {
37 { 0x800f0411, KEY_VOLUMEDOWN }, 38 { 0x800f0411, KEY_VOLUMEDOWN },
38 { 0x800f0412, KEY_CHANNELUP }, 39 { 0x800f0412, KEY_CHANNELUP },
39 { 0x800f0413, KEY_CHANNELDOWN }, 40 { 0x800f0413, KEY_CHANNELDOWN },
41 { 0x800f043a, KEY_BRIGHTNESSUP },
42 { 0x800f0480, KEY_BRIGHTNESSDOWN },
40 43
41 { 0x800f0401, KEY_NUMERIC_1 }, 44 { 0x800f0401, KEY_NUMERIC_1 },
42 { 0x800f0402, KEY_NUMERIC_2 }, 45 { 0x800f0402, KEY_NUMERIC_2 },
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c
index ac6bb2c01a48..bc620e10ef77 100644
--- a/drivers/media/IR/mceusb.c
+++ b/drivers/media/IR/mceusb.c
@@ -120,6 +120,10 @@ static struct usb_device_id mceusb_dev_table[] = {
120 { USB_DEVICE(VENDOR_PHILIPS, 0x0613) }, 120 { USB_DEVICE(VENDOR_PHILIPS, 0x0613) },
121 /* Philips eHome Infrared Transceiver */ 121 /* Philips eHome Infrared Transceiver */
122 { USB_DEVICE(VENDOR_PHILIPS, 0x0815) }, 122 { USB_DEVICE(VENDOR_PHILIPS, 0x0815) },
123 /* Philips/Spinel plus IR transceiver for ASUS */
124 { USB_DEVICE(VENDOR_PHILIPS, 0x206c) },
125 /* Philips/Spinel plus IR transceiver for ASUS */
126 { USB_DEVICE(VENDOR_PHILIPS, 0x2088) },
123 /* Realtek MCE IR Receiver */ 127 /* Realtek MCE IR Receiver */
124 { USB_DEVICE(VENDOR_REALTEK, 0x0161) }, 128 { USB_DEVICE(VENDOR_REALTEK, 0x0161) },
125 /* SMK/Toshiba G83C0004D410 */ 129 /* SMK/Toshiba G83C0004D410 */
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
index fe818348b8a3..48397f103d32 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -673,9 +673,6 @@ static int dib0700_probe(struct usb_interface *intf,
673 else 673 else
674 dev->props.rc.core.bulk_mode = false; 674 dev->props.rc.core.bulk_mode = false;
675 675
676 /* Need a higher delay, to avoid wrong repeat */
677 dev->rc_input_dev->rep[REP_DELAY] = 500;
678
679 dib0700_rc_setup(dev); 676 dib0700_rc_setup(dev);
680 677
681 return 0; 678 return 0;
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index f634d2e784b2..e06acd1fecb6 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -940,6 +940,58 @@ static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
940 return adap->fe == NULL ? -ENODEV : 0; 940 return adap->fe == NULL ? -ENODEV : 0;
941} 941}
942 942
943/* STK7770P */
944static struct dib7000p_config dib7770p_dib7000p_config = {
945 .output_mpeg2_in_188_bytes = 1,
946
947 .agc_config_count = 1,
948 .agc = &dib7070_agc_config,
949 .bw = &dib7070_bw_config_12_mhz,
950 .tuner_is_baseband = 1,
951 .spur_protect = 1,
952
953 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
954 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
955 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
956
957 .hostbus_diversity = 1,
958 .enable_current_mirror = 1,
959 .disable_sample_and_hold = 0,
960};
961
962static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
963{
964 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
965 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
966 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
967 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
968 else
969 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
970 msleep(10);
971 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
972 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
973 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
974 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
975
976 dib0700_ctrl_clock(adap->dev, 72, 1);
977
978 msleep(10);
979 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
980 msleep(10);
981 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
982
983 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
984 &dib7770p_dib7000p_config) != 0) {
985 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
986 __func__);
987 return -ENODEV;
988 }
989
990 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
991 &dib7770p_dib7000p_config);
992 return adap->fe == NULL ? -ENODEV : 0;
993}
994
943/* DIB807x generic */ 995/* DIB807x generic */
944static struct dibx000_agc_config dib807x_agc_config[2] = { 996static struct dibx000_agc_config dib807x_agc_config[2] = {
945 { 997 {
@@ -1781,7 +1833,7 @@ struct usb_device_id dib0700_usb_id_table[] = {
1781/* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) }, 1833/* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
1782 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) }, 1834 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
1783 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) }, 1835 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
1784 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) }, 1836 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
1785 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) }, 1837 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
1786/* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) }, 1838/* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
1787 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, 1839 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
@@ -2406,7 +2458,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2406 .pid_filter_count = 32, 2458 .pid_filter_count = 32,
2407 .pid_filter = stk70x0p_pid_filter, 2459 .pid_filter = stk70x0p_pid_filter,
2408 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, 2460 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2409 .frontend_attach = stk7070p_frontend_attach, 2461 .frontend_attach = stk7770p_frontend_attach,
2410 .tuner_attach = dib7770p_tuner_attach, 2462 .tuner_attach = dib7770p_tuner_attach,
2411 2463
2412 DIB0700_DEFAULT_STREAMING_CONFIG(0x02), 2464 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c
index 6b22ec64ab0c..f896337b4535 100644
--- a/drivers/media/dvb/dvb-usb/opera1.c
+++ b/drivers/media/dvb/dvb-usb/opera1.c
@@ -483,9 +483,7 @@ static int opera1_xilinx_load_firmware(struct usb_device *dev,
483 } 483 }
484 } 484 }
485 kfree(p); 485 kfree(p);
486 if (fw) { 486 release_firmware(fw);
487 release_firmware(fw);
488 }
489 return ret; 487 return ret;
490} 488}
491 489
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c
index 2e28b973dfd3..3aed0d433921 100644
--- a/drivers/media/dvb/frontends/dib7000p.c
+++ b/drivers/media/dvb/frontends/dib7000p.c
@@ -260,6 +260,9 @@ static void dib7000p_set_adc_state(struct dib7000p_state *state, enum dibx000_ad
260 260
261// dprintk( "908: %x, 909: %x\n", reg_908, reg_909); 261// dprintk( "908: %x, 909: %x\n", reg_908, reg_909);
262 262
263 reg_909 |= (state->cfg.disable_sample_and_hold & 1) << 4;
264 reg_908 |= (state->cfg.enable_current_mirror & 1) << 7;
265
263 dib7000p_write_word(state, 908, reg_908); 266 dib7000p_write_word(state, 908, reg_908);
264 dib7000p_write_word(state, 909, reg_909); 267 dib7000p_write_word(state, 909, reg_909);
265} 268}
@@ -778,7 +781,10 @@ static void dib7000p_set_channel(struct dib7000p_state *state, struct dvb_fronte
778 default: 781 default:
779 case GUARD_INTERVAL_1_32: value *= 1; break; 782 case GUARD_INTERVAL_1_32: value *= 1; break;
780 } 783 }
781 state->div_sync_wait = (value * 3) / 2 + 32; // add 50% SFN margin + compensate for one DVSY-fifo TODO 784 if (state->cfg.diversity_delay == 0)
785 state->div_sync_wait = (value * 3) / 2 + 48; // add 50% SFN margin + compensate for one DVSY-fifo
786 else
787 state->div_sync_wait = (value * 3) / 2 + state->cfg.diversity_delay; // add 50% SFN margin + compensate for one DVSY-fifo
782 788
783 /* deactive the possibility of diversity reception if extended interleaver */ 789 /* deactive the possibility of diversity reception if extended interleaver */
784 state->div_force_off = !1 && ch->u.ofdm.transmission_mode != TRANSMISSION_MODE_8K; 790 state->div_force_off = !1 && ch->u.ofdm.transmission_mode != TRANSMISSION_MODE_8K;
diff --git a/drivers/media/dvb/frontends/dib7000p.h b/drivers/media/dvb/frontends/dib7000p.h
index 805dd13a97ee..da17345bf5bd 100644
--- a/drivers/media/dvb/frontends/dib7000p.h
+++ b/drivers/media/dvb/frontends/dib7000p.h
@@ -33,6 +33,11 @@ struct dib7000p_config {
33 int (*agc_control) (struct dvb_frontend *, u8 before); 33 int (*agc_control) (struct dvb_frontend *, u8 before);
34 34
35 u8 output_mode; 35 u8 output_mode;
36 u8 disable_sample_and_hold : 1;
37
38 u8 enable_current_mirror : 1;
39 u8 diversity_delay;
40
36}; 41};
37 42
38#define DEFAULT_DIB7000P_I2C_ADDRESS 18 43#define DEFAULT_DIB7000P_I2C_ADDRESS 18
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index d93468cd3a85..ff3b0fa901b3 100644
--- a/drivers/media/dvb/siano/smscoreapi.c
+++ b/drivers/media/dvb/siano/smscoreapi.c
@@ -1098,33 +1098,26 @@ EXPORT_SYMBOL_GPL(smscore_onresponse);
1098 * 1098 *
1099 * @return pointer to descriptor on success, NULL on error. 1099 * @return pointer to descriptor on success, NULL on error.
1100 */ 1100 */
1101struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev) 1101
1102struct smscore_buffer_t *get_entry(struct smscore_device_t *coredev)
1102{ 1103{
1103 struct smscore_buffer_t *cb = NULL; 1104 struct smscore_buffer_t *cb = NULL;
1104 unsigned long flags; 1105 unsigned long flags;
1105 1106
1106 DEFINE_WAIT(wait);
1107
1108 spin_lock_irqsave(&coredev->bufferslock, flags); 1107 spin_lock_irqsave(&coredev->bufferslock, flags);
1109 1108 if (!list_empty(&coredev->buffers)) {
1110 /* This function must return a valid buffer, since the buffer list is 1109 cb = (struct smscore_buffer_t *) coredev->buffers.next;
1111 * finite, we check that there is an available buffer, if not, we wait 1110 list_del(&cb->entry);
1112 * until such buffer become available.
1113 */
1114
1115 prepare_to_wait(&coredev->buffer_mng_waitq, &wait, TASK_INTERRUPTIBLE);
1116 if (list_empty(&coredev->buffers)) {
1117 spin_unlock_irqrestore(&coredev->bufferslock, flags);
1118 schedule();
1119 spin_lock_irqsave(&coredev->bufferslock, flags);
1120 } 1111 }
1112 spin_unlock_irqrestore(&coredev->bufferslock, flags);
1113 return cb;
1114}
1121 1115
1122 finish_wait(&coredev->buffer_mng_waitq, &wait); 1116struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev)
1123 1117{
1124 cb = (struct smscore_buffer_t *) coredev->buffers.next; 1118 struct smscore_buffer_t *cb = NULL;
1125 list_del(&cb->entry);
1126 1119
1127 spin_unlock_irqrestore(&coredev->bufferslock, flags); 1120 wait_event(coredev->buffer_mng_waitq, (cb = get_entry(coredev)));
1128 1121
1129 return cb; 1122 return cb;
1130} 1123}
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
index 67a4ec8768a6..4ce541a5eb47 100644
--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
+++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
@@ -395,7 +395,7 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client,
395 radio->registers[POWERCFG] = POWERCFG_ENABLE; 395 radio->registers[POWERCFG] = POWERCFG_ENABLE;
396 if (si470x_set_register(radio, POWERCFG) < 0) { 396 if (si470x_set_register(radio, POWERCFG) < 0) {
397 retval = -EIO; 397 retval = -EIO;
398 goto err_all; 398 goto err_video;
399 } 399 }
400 msleep(110); 400 msleep(110);
401 401
diff --git a/drivers/media/video/cx231xx/Makefile b/drivers/media/video/cx231xx/Makefile
index 755dd0ce65ff..6f2b57384488 100644
--- a/drivers/media/video/cx231xx/Makefile
+++ b/drivers/media/video/cx231xx/Makefile
@@ -11,4 +11,5 @@ EXTRA_CFLAGS += -Idrivers/media/video
11EXTRA_CFLAGS += -Idrivers/media/common/tuners 11EXTRA_CFLAGS += -Idrivers/media/common/tuners
12EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core 12EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
13EXTRA_CFLAGS += -Idrivers/media/dvb/frontends 13EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
14EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-usb
14 15
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c
index 6bdc0ef18119..f2a4900014bc 100644
--- a/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -32,6 +32,7 @@
32#include <media/v4l2-chip-ident.h> 32#include <media/v4l2-chip-ident.h>
33 33
34#include <media/cx25840.h> 34#include <media/cx25840.h>
35#include "dvb-usb-ids.h"
35#include "xc5000.h" 36#include "xc5000.h"
36 37
37#include "cx231xx.h" 38#include "cx231xx.h"
@@ -175,6 +176,8 @@ struct usb_device_id cx231xx_id_table[] = {
175 .driver_info = CX231XX_BOARD_CNXT_RDE_250}, 176 .driver_info = CX231XX_BOARD_CNXT_RDE_250},
176 {USB_DEVICE(0x0572, 0x58A1), 177 {USB_DEVICE(0x0572, 0x58A1),
177 .driver_info = CX231XX_BOARD_CNXT_RDU_250}, 178 .driver_info = CX231XX_BOARD_CNXT_RDU_250},
179 {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000,0x4fff),
180 .driver_info = CX231XX_BOARD_UNKNOWN},
178 {}, 181 {},
179}; 182};
180 183
@@ -226,14 +229,16 @@ void cx231xx_pre_card_setup(struct cx231xx *dev)
226 dev->board.name, dev->model); 229 dev->board.name, dev->model);
227 230
228 /* set the direction for GPIO pins */ 231 /* set the direction for GPIO pins */
229 cx231xx_set_gpio_direction(dev, dev->board.tuner_gpio->bit, 1); 232 if (dev->board.tuner_gpio) {
230 cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1); 233 cx231xx_set_gpio_direction(dev, dev->board.tuner_gpio->bit, 1);
231 cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1); 234 cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1);
235 cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1);
232 236
233 /* request some modules if any required */ 237 /* request some modules if any required */
234 238
235 /* reset the Tuner */ 239 /* reset the Tuner */
236 cx231xx_gpio_set(dev, dev->board.tuner_gpio); 240 cx231xx_gpio_set(dev, dev->board.tuner_gpio);
241 }
237 242
238 /* set the mode to Analog mode initially */ 243 /* set the mode to Analog mode initially */
239 cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); 244 cx231xx_set_mode(dev, CX231XX_ANALOG_MODE);
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 86ca8c2359dd..f5a3e74c3c7c 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1996,7 +1996,7 @@ static int cx25840_probe(struct i2c_client *client,
1996 1996
1997 state->volume = v4l2_ctrl_new_std(&state->hdl, 1997 state->volume = v4l2_ctrl_new_std(&state->hdl,
1998 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, 1998 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,
1999 0, 65335, 65535 / 100, default_volume); 1999 0, 65535, 65535 / 100, default_volume);
2000 state->mute = v4l2_ctrl_new_std(&state->hdl, 2000 state->mute = v4l2_ctrl_new_std(&state->hdl,
2001 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_MUTE, 2001 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_MUTE,
2002 0, 1, 1, 0); 2002 0, 1, 1, 0);
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 99dbae117591..0fa85cbefbb1 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -17,7 +17,7 @@ config VIDEO_CX88
17 17
18config VIDEO_CX88_ALSA 18config VIDEO_CX88_ALSA
19 tristate "Conexant 2388x DMA audio support" 19 tristate "Conexant 2388x DMA audio support"
20 depends on VIDEO_CX88 && SND && EXPERIMENTAL 20 depends on VIDEO_CX88 && SND
21 select SND_PCM 21 select SND_PCM
22 ---help--- 22 ---help---
23 This is a video4linux driver for direct (DMA) audio on 23 This is a video4linux driver for direct (DMA) audio on
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index b9846106913e..78abc1c1f9d5 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -223,6 +223,7 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev,
223 usb_rcvintpipe(dev, ep->bEndpointAddress), 223 usb_rcvintpipe(dev, ep->bEndpointAddress),
224 buffer, buffer_len, 224 buffer, buffer_len,
225 int_irq, (void *)gspca_dev, interval); 225 int_irq, (void *)gspca_dev, interval);
226 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
226 gspca_dev->int_urb = urb; 227 gspca_dev->int_urb = urb;
227 ret = usb_submit_urb(urb, GFP_KERNEL); 228 ret = usb_submit_urb(urb, GFP_KERNEL);
228 if (ret < 0) { 229 if (ret < 0) {
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index 83a718f0f3f9..9052d5702556 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -2357,8 +2357,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2357 (data[33] << 10); 2357 (data[33] << 10);
2358 avg_lum >>= 9; 2358 avg_lum >>= 9;
2359 atomic_set(&sd->avg_lum, avg_lum); 2359 atomic_set(&sd->avg_lum, avg_lum);
2360 gspca_frame_add(gspca_dev, LAST_PACKET, 2360 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
2361 data, len);
2362 return; 2361 return;
2363 } 2362 }
2364 if (gspca_dev->last_packet_type == LAST_PACKET) { 2363 if (gspca_dev->last_packet_type == LAST_PACKET) {
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c
index be03a712731c..f0316d02f09f 100644
--- a/drivers/media/video/ivtv/ivtvfb.c
+++ b/drivers/media/video/ivtv/ivtvfb.c
@@ -466,6 +466,8 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar
466 struct fb_vblank vblank; 466 struct fb_vblank vblank;
467 u32 trace; 467 u32 trace;
468 468
469 memset(&vblank, 0, sizeof(struct fb_vblank));
470
469 vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | 471 vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT |
470 FB_VBLANK_HAVE_VSYNC; 472 FB_VBLANK_HAVE_VSYNC;
471 trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; 473 trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16;
diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c
index 4525335f9bd4..a7210d981388 100644
--- a/drivers/media/video/mem2mem_testdev.c
+++ b/drivers/media/video/mem2mem_testdev.c
@@ -239,7 +239,7 @@ static int device_process(struct m2mtest_ctx *ctx,
239 return -EFAULT; 239 return -EFAULT;
240 } 240 }
241 241
242 if (in_buf->vb.size < out_buf->vb.size) { 242 if (in_buf->vb.size > out_buf->vb.size) {
243 v4l2_err(&dev->v4l2_dev, "Output buffer is too small\n"); 243 v4l2_err(&dev->v4l2_dev, "Output buffer is too small\n");
244 return -EINVAL; 244 return -EINVAL;
245 } 245 }
@@ -1014,6 +1014,7 @@ static int m2mtest_remove(struct platform_device *pdev)
1014 v4l2_m2m_release(dev->m2m_dev); 1014 v4l2_m2m_release(dev->m2m_dev);
1015 del_timer_sync(&dev->timer); 1015 del_timer_sync(&dev->timer);
1016 video_unregister_device(dev->vfd); 1016 video_unregister_device(dev->vfd);
1017 video_device_release(dev->vfd);
1017 v4l2_device_unregister(&dev->v4l2_dev); 1018 v4l2_device_unregister(&dev->v4l2_dev);
1018 kfree(dev); 1019 kfree(dev);
1019 1020
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index 758a4db27d65..c71af4e0e517 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -447,6 +447,9 @@ static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
447 dev_dbg(&client->dev, "%s left=%d, top=%d, width=%d, height=%d\n", 447 dev_dbg(&client->dev, "%s left=%d, top=%d, width=%d, height=%d\n",
448 __func__, rect.left, rect.top, rect.width, rect.height); 448 __func__, rect.left, rect.top, rect.width, rect.height);
449 449
450 if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
451 return -EINVAL;
452
450 ret = mt9m111_make_rect(client, &rect); 453 ret = mt9m111_make_rect(client, &rect);
451 if (!ret) 454 if (!ret)
452 mt9m111->rect = rect; 455 mt9m111->rect = rect;
@@ -466,12 +469,14 @@ static int mt9m111_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
466 469
467static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) 470static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
468{ 471{
472 if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
473 return -EINVAL;
474
469 a->bounds.left = MT9M111_MIN_DARK_COLS; 475 a->bounds.left = MT9M111_MIN_DARK_COLS;
470 a->bounds.top = MT9M111_MIN_DARK_ROWS; 476 a->bounds.top = MT9M111_MIN_DARK_ROWS;
471 a->bounds.width = MT9M111_MAX_WIDTH; 477 a->bounds.width = MT9M111_MAX_WIDTH;
472 a->bounds.height = MT9M111_MAX_HEIGHT; 478 a->bounds.height = MT9M111_MAX_HEIGHT;
473 a->defrect = a->bounds; 479 a->defrect = a->bounds;
474 a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
475 a->pixelaspect.numerator = 1; 480 a->pixelaspect.numerator = 1;
476 a->pixelaspect.denominator = 1; 481 a->pixelaspect.denominator = 1;
477 482
@@ -487,6 +492,7 @@ static int mt9m111_g_fmt(struct v4l2_subdev *sd,
487 mf->width = mt9m111->rect.width; 492 mf->width = mt9m111->rect.width;
488 mf->height = mt9m111->rect.height; 493 mf->height = mt9m111->rect.height;
489 mf->code = mt9m111->fmt->code; 494 mf->code = mt9m111->fmt->code;
495 mf->colorspace = mt9m111->fmt->colorspace;
490 mf->field = V4L2_FIELD_NONE; 496 mf->field = V4L2_FIELD_NONE;
491 497
492 return 0; 498 return 0;
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index e7cd23cd6394..b48473c7896b 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -402,9 +402,6 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd,
402 if (mt9v022->model != V4L2_IDENT_MT9V022IX7ATC) 402 if (mt9v022->model != V4L2_IDENT_MT9V022IX7ATC)
403 return -EINVAL; 403 return -EINVAL;
404 break; 404 break;
405 case 0:
406 /* No format change, only geometry */
407 break;
408 default: 405 default:
409 return -EINVAL; 406 return -EINVAL;
410 } 407 }
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 66ff174151b5..b6ea67221d1d 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -378,6 +378,9 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb,
378 378
379 spin_lock_irqsave(&pcdev->lock, flags); 379 spin_lock_irqsave(&pcdev->lock, flags);
380 380
381 if (*fb_active == NULL)
382 goto out;
383
381 vb = &(*fb_active)->vb; 384 vb = &(*fb_active)->vb;
382 dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 385 dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
383 vb, vb->baddr, vb->bsize); 386 vb, vb->baddr, vb->bsize);
@@ -402,6 +405,7 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb,
402 405
403 *fb_active = buf; 406 *fb_active = buf;
404 407
408out:
405 spin_unlock_irqrestore(&pcdev->lock, flags); 409 spin_unlock_irqrestore(&pcdev->lock, flags);
406} 410}
407 411
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index 1b992b847198..55ea914c7fcd 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -513,7 +513,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr,
513 if (ret >= 0) { 513 if (ret >= 0) {
514 ret = pvr2_ctrl_range_check(cptr,*valptr); 514 ret = pvr2_ctrl_range_check(cptr,*valptr);
515 } 515 }
516 if (maskptr) *maskptr = ~0; 516 *maskptr = ~0;
517 } else if (cptr->info->type == pvr2_ctl_bool) { 517 } else if (cptr->info->type == pvr2_ctl_bool) {
518 ret = parse_token(ptr,len,valptr,boolNames, 518 ret = parse_token(ptr,len,valptr,boolNames,
519 ARRAY_SIZE(boolNames)); 519 ARRAY_SIZE(boolNames));
@@ -522,7 +522,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr,
522 } else if (ret == 0) { 522 } else if (ret == 0) {
523 *valptr = (*valptr & 1) ? !0 : 0; 523 *valptr = (*valptr & 1) ? !0 : 0;
524 } 524 }
525 if (maskptr) *maskptr = 1; 525 *maskptr = 1;
526 } else if (cptr->info->type == pvr2_ctl_enum) { 526 } else if (cptr->info->type == pvr2_ctl_enum) {
527 ret = parse_token( 527 ret = parse_token(
528 ptr,len,valptr, 528 ptr,len,valptr,
@@ -531,7 +531,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr,
531 if (ret >= 0) { 531 if (ret >= 0) {
532 ret = pvr2_ctrl_range_check(cptr,*valptr); 532 ret = pvr2_ctrl_range_check(cptr,*valptr);
533 } 533 }
534 if (maskptr) *maskptr = ~0; 534 *maskptr = ~0;
535 } else if (cptr->info->type == pvr2_ctl_bitmask) { 535 } else if (cptr->info->type == pvr2_ctl_bitmask) {
536 ret = parse_tlist( 536 ret = parse_tlist(
537 ptr,len,maskptr,valptr, 537 ptr,len,maskptr,valptr,
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index b151c7be8a50..6961c55baf9b 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -393,6 +393,37 @@ static void fimc_set_yuv_order(struct fimc_ctx *ctx)
393 dbg("ctx->out_order_1p= %d", ctx->out_order_1p); 393 dbg("ctx->out_order_1p= %d", ctx->out_order_1p);
394} 394}
395 395
396static void fimc_prepare_dma_offset(struct fimc_ctx *ctx, struct fimc_frame *f)
397{
398 struct samsung_fimc_variant *variant = ctx->fimc_dev->variant;
399
400 f->dma_offset.y_h = f->offs_h;
401 if (!variant->pix_hoff)
402 f->dma_offset.y_h *= (f->fmt->depth >> 3);
403
404 f->dma_offset.y_v = f->offs_v;
405
406 f->dma_offset.cb_h = f->offs_h;
407 f->dma_offset.cb_v = f->offs_v;
408
409 f->dma_offset.cr_h = f->offs_h;
410 f->dma_offset.cr_v = f->offs_v;
411
412 if (!variant->pix_hoff) {
413 if (f->fmt->planes_cnt == 3) {
414 f->dma_offset.cb_h >>= 1;
415 f->dma_offset.cr_h >>= 1;
416 }
417 if (f->fmt->color == S5P_FIMC_YCBCR420) {
418 f->dma_offset.cb_v >>= 1;
419 f->dma_offset.cr_v >>= 1;
420 }
421 }
422
423 dbg("in_offset: color= %d, y_h= %d, y_v= %d",
424 f->fmt->color, f->dma_offset.y_h, f->dma_offset.y_v);
425}
426
396/** 427/**
397 * fimc_prepare_config - check dimensions, operation and color mode 428 * fimc_prepare_config - check dimensions, operation and color mode
398 * and pre-calculate offset and the scaling coefficients. 429 * and pre-calculate offset and the scaling coefficients.
@@ -406,7 +437,6 @@ static int fimc_prepare_config(struct fimc_ctx *ctx, u32 flags)
406{ 437{
407 struct fimc_frame *s_frame, *d_frame; 438 struct fimc_frame *s_frame, *d_frame;
408 struct fimc_vid_buffer *buf = NULL; 439 struct fimc_vid_buffer *buf = NULL;
409 struct samsung_fimc_variant *variant = ctx->fimc_dev->variant;
410 int ret = 0; 440 int ret = 0;
411 441
412 s_frame = &ctx->s_frame; 442 s_frame = &ctx->s_frame;
@@ -419,61 +449,16 @@ static int fimc_prepare_config(struct fimc_ctx *ctx, u32 flags)
419 swap(d_frame->width, d_frame->height); 449 swap(d_frame->width, d_frame->height);
420 } 450 }
421 451
422 /* Prepare the output offset ratios for scaler. */ 452 /* Prepare the DMA offset ratios for scaler. */
423 d_frame->dma_offset.y_h = d_frame->offs_h; 453 fimc_prepare_dma_offset(ctx, &ctx->s_frame);
424 if (!variant->pix_hoff) 454 fimc_prepare_dma_offset(ctx, &ctx->d_frame);
425 d_frame->dma_offset.y_h *= (d_frame->fmt->depth >> 3);
426
427 d_frame->dma_offset.y_v = d_frame->offs_v;
428
429 d_frame->dma_offset.cb_h = d_frame->offs_h;
430 d_frame->dma_offset.cb_v = d_frame->offs_v;
431
432 d_frame->dma_offset.cr_h = d_frame->offs_h;
433 d_frame->dma_offset.cr_v = d_frame->offs_v;
434 455
435 if (!variant->pix_hoff && d_frame->fmt->planes_cnt == 3) {
436 d_frame->dma_offset.cb_h >>= 1;
437 d_frame->dma_offset.cb_v >>= 1;
438 d_frame->dma_offset.cr_h >>= 1;
439 d_frame->dma_offset.cr_v >>= 1;
440 }
441
442 dbg("out offset: color= %d, y_h= %d, y_v= %d",
443 d_frame->fmt->color,
444 d_frame->dma_offset.y_h, d_frame->dma_offset.y_v);
445
446 /* Prepare the input offset ratios for scaler. */
447 s_frame->dma_offset.y_h = s_frame->offs_h;
448 if (!variant->pix_hoff)
449 s_frame->dma_offset.y_h *= (s_frame->fmt->depth >> 3);
450 s_frame->dma_offset.y_v = s_frame->offs_v;
451
452 s_frame->dma_offset.cb_h = s_frame->offs_h;
453 s_frame->dma_offset.cb_v = s_frame->offs_v;
454
455 s_frame->dma_offset.cr_h = s_frame->offs_h;
456 s_frame->dma_offset.cr_v = s_frame->offs_v;
457
458 if (!variant->pix_hoff && s_frame->fmt->planes_cnt == 3) {
459 s_frame->dma_offset.cb_h >>= 1;
460 s_frame->dma_offset.cb_v >>= 1;
461 s_frame->dma_offset.cr_h >>= 1;
462 s_frame->dma_offset.cr_v >>= 1;
463 }
464
465 dbg("in offset: color= %d, y_h= %d, y_v= %d",
466 s_frame->fmt->color, s_frame->dma_offset.y_h,
467 s_frame->dma_offset.y_v);
468
469 fimc_set_yuv_order(ctx);
470
471 /* Check against the scaler ratio. */
472 if (s_frame->height > (SCALER_MAX_VRATIO * d_frame->height) || 456 if (s_frame->height > (SCALER_MAX_VRATIO * d_frame->height) ||
473 s_frame->width > (SCALER_MAX_HRATIO * d_frame->width)) { 457 s_frame->width > (SCALER_MAX_HRATIO * d_frame->width)) {
474 err("out of scaler range"); 458 err("out of scaler range");
475 return -EINVAL; 459 return -EINVAL;
476 } 460 }
461 fimc_set_yuv_order(ctx);
477 } 462 }
478 463
479 /* Input DMA mode is not allowed when the scaler is disabled. */ 464 /* Input DMA mode is not allowed when the scaler is disabled. */
@@ -822,7 +807,8 @@ static int fimc_m2m_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
822 } else { 807 } else {
823 v4l2_err(&ctx->fimc_dev->m2m.v4l2_dev, 808 v4l2_err(&ctx->fimc_dev->m2m.v4l2_dev,
824 "Wrong buffer/video queue type (%d)\n", f->type); 809 "Wrong buffer/video queue type (%d)\n", f->type);
825 return -EINVAL; 810 ret = -EINVAL;
811 goto s_fmt_out;
826 } 812 }
827 813
828 pix = &f->fmt.pix; 814 pix = &f->fmt.pix;
@@ -1414,8 +1400,10 @@ static int fimc_probe(struct platform_device *pdev)
1414 } 1400 }
1415 1401
1416 fimc->work_queue = create_workqueue(dev_name(&fimc->pdev->dev)); 1402 fimc->work_queue = create_workqueue(dev_name(&fimc->pdev->dev));
1417 if (!fimc->work_queue) 1403 if (!fimc->work_queue) {
1404 ret = -ENOMEM;
1418 goto err_irq; 1405 goto err_irq;
1406 }
1419 1407
1420 ret = fimc_register_m2m_device(fimc); 1408 ret = fimc_register_m2m_device(fimc);
1421 if (ret) 1409 if (ret)
@@ -1492,6 +1480,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = {
1492}; 1480};
1493 1481
1494static struct samsung_fimc_variant fimc01_variant_s5pv210 = { 1482static struct samsung_fimc_variant fimc01_variant_s5pv210 = {
1483 .pix_hoff = 1,
1495 .has_inp_rot = 1, 1484 .has_inp_rot = 1,
1496 .has_out_rot = 1, 1485 .has_out_rot = 1,
1497 .min_inp_pixsize = 16, 1486 .min_inp_pixsize = 16,
@@ -1506,6 +1495,7 @@ static struct samsung_fimc_variant fimc01_variant_s5pv210 = {
1506}; 1495};
1507 1496
1508static struct samsung_fimc_variant fimc2_variant_s5pv210 = { 1497static struct samsung_fimc_variant fimc2_variant_s5pv210 = {
1498 .pix_hoff = 1,
1509 .min_inp_pixsize = 16, 1499 .min_inp_pixsize = 16,
1510 .min_out_pixsize = 32, 1500 .min_out_pixsize = 32,
1511 1501
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index ec697fcd406e..bb8d83d8ddaf 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -4323,13 +4323,13 @@ struct saa7134_board saa7134_boards[] = {
4323 }, 4323 },
4324 [SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM] = { 4324 [SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM] = {
4325 /* Beholder Intl. Ltd. 2008 */ 4325 /* Beholder Intl. Ltd. 2008 */
4326 /*Dmitry Belimov <d.belimov@gmail.com> */ 4326 /* Dmitry Belimov <d.belimov@gmail.com> */
4327 .name = "Beholder BeholdTV Columbus TVFM", 4327 .name = "Beholder BeholdTV Columbus TV/FM",
4328 .audio_clock = 0x00187de7, 4328 .audio_clock = 0x00187de7,
4329 .tuner_type = TUNER_ALPS_TSBE5_PAL, 4329 .tuner_type = TUNER_ALPS_TSBE5_PAL,
4330 .radio_type = UNSET, 4330 .radio_type = TUNER_TEA5767,
4331 .tuner_addr = ADDR_UNSET, 4331 .tuner_addr = 0xc2 >> 1,
4332 .radio_addr = ADDR_UNSET, 4332 .radio_addr = 0xc0 >> 1,
4333 .tda9887_conf = TDA9887_PRESENT, 4333 .tda9887_conf = TDA9887_PRESENT,
4334 .gpiomask = 0x000A8004, 4334 .gpiomask = 0x000A8004,
4335 .inputs = {{ 4335 .inputs = {{
diff --git a/drivers/media/video/saa7164/saa7164-buffer.c b/drivers/media/video/saa7164/saa7164-buffer.c
index 5713f3a4b76c..ddd25d32723d 100644
--- a/drivers/media/video/saa7164/saa7164-buffer.c
+++ b/drivers/media/video/saa7164/saa7164-buffer.c
@@ -136,10 +136,11 @@ ret:
136int saa7164_buffer_dealloc(struct saa7164_tsport *port, 136int saa7164_buffer_dealloc(struct saa7164_tsport *port,
137 struct saa7164_buffer *buf) 137 struct saa7164_buffer *buf)
138{ 138{
139 struct saa7164_dev *dev = port->dev; 139 struct saa7164_dev *dev;
140 140
141 if ((buf == 0) || (port == 0)) 141 if (!buf || !port)
142 return SAA_ERR_BAD_PARAMETER; 142 return SAA_ERR_BAD_PARAMETER;
143 dev = port->dev;
143 144
144 dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf); 145 dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf);
145 146
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index 8bdd940f32e6..2ac85d8984f0 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -486,6 +486,12 @@ static int uvc_parse_format(struct uvc_device *dev,
486 max(frame->dwFrameInterval[0], 486 max(frame->dwFrameInterval[0],
487 frame->dwDefaultFrameInterval)); 487 frame->dwDefaultFrameInterval));
488 488
489 if (dev->quirks & UVC_QUIRK_RESTRICT_FRAME_RATE) {
490 frame->bFrameIntervalType = 1;
491 frame->dwFrameInterval[0] =
492 frame->dwDefaultFrameInterval;
493 }
494
489 uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n", 495 uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n",
490 frame->wWidth, frame->wHeight, 496 frame->wWidth, frame->wHeight,
491 10000000/frame->dwDefaultFrameInterval, 497 10000000/frame->dwDefaultFrameInterval,
@@ -2026,6 +2032,15 @@ static struct usb_device_id uvc_ids[] = {
2026 .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 2032 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2027 .bInterfaceSubClass = 1, 2033 .bInterfaceSubClass = 1,
2028 .bInterfaceProtocol = 0 }, 2034 .bInterfaceProtocol = 0 },
2035 /* Chicony CNF7129 (Asus EEE 100HE) */
2036 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2037 | USB_DEVICE_ID_MATCH_INT_INFO,
2038 .idVendor = 0x04f2,
2039 .idProduct = 0xb071,
2040 .bInterfaceClass = USB_CLASS_VIDEO,
2041 .bInterfaceSubClass = 1,
2042 .bInterfaceProtocol = 0,
2043 .driver_info = UVC_QUIRK_RESTRICT_FRAME_RATE },
2029 /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */ 2044 /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */
2030 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE 2045 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2031 | USB_DEVICE_ID_MATCH_INT_INFO, 2046 | USB_DEVICE_ID_MATCH_INT_INFO,
@@ -2091,6 +2106,15 @@ static struct usb_device_id uvc_ids[] = {
2091 .bInterfaceProtocol = 0, 2106 .bInterfaceProtocol = 0,
2092 .driver_info = UVC_QUIRK_PROBE_MINMAX 2107 .driver_info = UVC_QUIRK_PROBE_MINMAX
2093 | UVC_QUIRK_PROBE_DEF }, 2108 | UVC_QUIRK_PROBE_DEF },
2109 /* IMC Networks (Medion Akoya) */
2110 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2111 | USB_DEVICE_ID_MATCH_INT_INFO,
2112 .idVendor = 0x13d3,
2113 .idProduct = 0x5103,
2114 .bInterfaceClass = USB_CLASS_VIDEO,
2115 .bInterfaceSubClass = 1,
2116 .bInterfaceProtocol = 0,
2117 .driver_info = UVC_QUIRK_STREAM_NO_FID },
2094 /* Syntek (HP Spartan) */ 2118 /* Syntek (HP Spartan) */
2095 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE 2119 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2096 | USB_DEVICE_ID_MATCH_INT_INFO, 2120 | USB_DEVICE_ID_MATCH_INT_INFO,
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
index bdacf3beabf5..892e0e51916c 100644
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -182,6 +182,7 @@ struct uvc_xu_control {
182#define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020 182#define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020
183#define UVC_QUIRK_FIX_BANDWIDTH 0x00000080 183#define UVC_QUIRK_FIX_BANDWIDTH 0x00000080
184#define UVC_QUIRK_PROBE_DEF 0x00000100 184#define UVC_QUIRK_PROBE_DEF 0x00000100
185#define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200
185 186
186/* Format flags */ 187/* Format flags */
187#define UVC_FMT_FLAG_COMPRESSED 0x00000001 188#define UVC_FMT_FLAG_COMPRESSED 0x00000001
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c
index 372b87efcd05..6ff9e4bac3ea 100644
--- a/drivers/media/video/videobuf-dma-contig.c
+++ b/drivers/media/video/videobuf-dma-contig.c
@@ -393,8 +393,10 @@ void videobuf_dma_contig_free(struct videobuf_queue *q,
393 } 393 }
394 394
395 /* read() method */ 395 /* read() method */
396 dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle); 396 if (mem->vaddr) {
397 mem->vaddr = NULL; 397 dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle);
398 mem->vaddr = NULL;
399 }
398} 400}
399EXPORT_SYMBOL_GPL(videobuf_dma_contig_free); 401EXPORT_SYMBOL_GPL(videobuf_dma_contig_free);
400 402
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index 06f9a9c2a39a..2ad0bc252b0e 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -94,7 +94,7 @@ err:
94 * must free the memory. 94 * must free the memory.
95 */ 95 */
96static struct scatterlist *videobuf_pages_to_sg(struct page **pages, 96static struct scatterlist *videobuf_pages_to_sg(struct page **pages,
97 int nr_pages, int offset) 97 int nr_pages, int offset, size_t size)
98{ 98{
99 struct scatterlist *sglist; 99 struct scatterlist *sglist;
100 int i; 100 int i;
@@ -110,12 +110,14 @@ static struct scatterlist *videobuf_pages_to_sg(struct page **pages,
110 /* DMA to highmem pages might not work */ 110 /* DMA to highmem pages might not work */
111 goto highmem; 111 goto highmem;
112 sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset); 112 sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset);
113 size -= PAGE_SIZE - offset;
113 for (i = 1; i < nr_pages; i++) { 114 for (i = 1; i < nr_pages; i++) {
114 if (NULL == pages[i]) 115 if (NULL == pages[i])
115 goto nopage; 116 goto nopage;
116 if (PageHighMem(pages[i])) 117 if (PageHighMem(pages[i]))
117 goto highmem; 118 goto highmem;
118 sg_set_page(&sglist[i], pages[i], PAGE_SIZE, 0); 119 sg_set_page(&sglist[i], pages[i], min(PAGE_SIZE, size), 0);
120 size -= min(PAGE_SIZE, size);
119 } 121 }
120 return sglist; 122 return sglist;
121 123
@@ -170,7 +172,8 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
170 172
171 first = (data & PAGE_MASK) >> PAGE_SHIFT; 173 first = (data & PAGE_MASK) >> PAGE_SHIFT;
172 last = ((data+size-1) & PAGE_MASK) >> PAGE_SHIFT; 174 last = ((data+size-1) & PAGE_MASK) >> PAGE_SHIFT;
173 dma->offset = data & ~PAGE_MASK; 175 dma->offset = data & ~PAGE_MASK;
176 dma->size = size;
174 dma->nr_pages = last-first+1; 177 dma->nr_pages = last-first+1;
175 dma->pages = kmalloc(dma->nr_pages * sizeof(struct page *), GFP_KERNEL); 178 dma->pages = kmalloc(dma->nr_pages * sizeof(struct page *), GFP_KERNEL);
176 if (NULL == dma->pages) 179 if (NULL == dma->pages)
@@ -252,7 +255,7 @@ int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma)
252 255
253 if (dma->pages) { 256 if (dma->pages) {
254 dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages, 257 dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages,
255 dma->offset); 258 dma->offset, dma->size);
256 } 259 }
257 if (dma->vaddr) { 260 if (dma->vaddr) {
258 dma->sglist = videobuf_vmalloc_to_sg(dma->vaddr, 261 dma->sglist = videobuf_vmalloc_to_sg(dma->vaddr,
diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c
index 04028a9ee082..428377a5a6f5 100644
--- a/drivers/mfd/max8925-core.c
+++ b/drivers/mfd/max8925-core.c
@@ -429,24 +429,25 @@ static void max8925_irq_sync_unlock(unsigned int irq)
429 irq_tsc = cache_tsc; 429 irq_tsc = cache_tsc;
430 for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) { 430 for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) {
431 irq_data = &max8925_irqs[i]; 431 irq_data = &max8925_irqs[i];
432 /* 1 -- disable, 0 -- enable */
432 switch (irq_data->mask_reg) { 433 switch (irq_data->mask_reg) {
433 case MAX8925_CHG_IRQ1_MASK: 434 case MAX8925_CHG_IRQ1_MASK:
434 irq_chg[0] &= irq_data->enable; 435 irq_chg[0] &= ~irq_data->enable;
435 break; 436 break;
436 case MAX8925_CHG_IRQ2_MASK: 437 case MAX8925_CHG_IRQ2_MASK:
437 irq_chg[1] &= irq_data->enable; 438 irq_chg[1] &= ~irq_data->enable;
438 break; 439 break;
439 case MAX8925_ON_OFF_IRQ1_MASK: 440 case MAX8925_ON_OFF_IRQ1_MASK:
440 irq_on[0] &= irq_data->enable; 441 irq_on[0] &= ~irq_data->enable;
441 break; 442 break;
442 case MAX8925_ON_OFF_IRQ2_MASK: 443 case MAX8925_ON_OFF_IRQ2_MASK:
443 irq_on[1] &= irq_data->enable; 444 irq_on[1] &= ~irq_data->enable;
444 break; 445 break;
445 case MAX8925_RTC_IRQ_MASK: 446 case MAX8925_RTC_IRQ_MASK:
446 irq_rtc &= irq_data->enable; 447 irq_rtc &= ~irq_data->enable;
447 break; 448 break;
448 case MAX8925_TSC_IRQ_MASK: 449 case MAX8925_TSC_IRQ_MASK:
449 irq_tsc &= irq_data->enable; 450 irq_tsc &= ~irq_data->enable;
450 break; 451 break;
451 default: 452 default:
452 dev_err(chip->dev, "wrong IRQ\n"); 453 dev_err(chip->dev, "wrong IRQ\n");
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c
index 7dabe4dbd373..294183b6260b 100644
--- a/drivers/mfd/wm831x-irq.c
+++ b/drivers/mfd/wm831x-irq.c
@@ -394,8 +394,13 @@ static int wm831x_irq_set_type(unsigned int irq, unsigned int type)
394 394
395 irq = irq - wm831x->irq_base; 395 irq = irq - wm831x->irq_base;
396 396
397 if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) 397 if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) {
398 return -EINVAL; 398 /* Ignore internal-only IRQs */
399 if (irq >= 0 && irq < WM831X_NUM_IRQS)
400 return 0;
401 else
402 return -EINVAL;
403 }
399 404
400 switch (type) { 405 switch (type) {
401 case IRQ_TYPE_EDGE_BOTH: 406 case IRQ_TYPE_EDGE_BOTH:
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
index 714c6b487313..d5f3a3fd2319 100644
--- a/drivers/misc/bh1780gli.c
+++ b/drivers/misc/bh1780gli.c
@@ -190,7 +190,6 @@ static int __devexit bh1780_remove(struct i2c_client *client)
190 190
191 ddata = i2c_get_clientdata(client); 191 ddata = i2c_get_clientdata(client);
192 sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group); 192 sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group);
193 i2c_set_clientdata(client, NULL);
194 kfree(ddata); 193 kfree(ddata);
195 194
196 return 0; 195 return 0;
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 133d51528f8d..513e0a76a4a7 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -413,7 +413,7 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr,
413 prefetch_status = gpmc_read_status(GPMC_PREFETCH_COUNT); 413 prefetch_status = gpmc_read_status(GPMC_PREFETCH_COUNT);
414 } while (prefetch_status); 414 } while (prefetch_status);
415 /* disable and stop the PFPW engine */ 415 /* disable and stop the PFPW engine */
416 gpmc_prefetch_reset(); 416 gpmc_prefetch_reset(info->gpmc_cs);
417 417
418 dma_unmap_single(&info->pdev->dev, dma_addr, len, dir); 418 dma_unmap_single(&info->pdev->dev, dma_addr, len, dir);
419 return 0; 419 return 0;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 2cc81a54cbf3..77efe462b921 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2,6 +2,9 @@
2# Network device configuration 2# Network device configuration
3# 3#
4 4
5config HAVE_NET_MACB
6 bool
7
5menuconfig NETDEVICES 8menuconfig NETDEVICES
6 default y if UML 9 default y if UML
7 depends on NET 10 depends on NET
@@ -221,7 +224,7 @@ config MII
221 224
222config MACB 225config MACB
223 tristate "Atmel MACB support" 226 tristate "Atmel MACB support"
224 depends on AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263 || ARCH_AT91SAM9G20 || ARCH_AT91SAM9G45 || ARCH_AT91CAP9 227 depends on HAVE_NET_MACB
225 select PHYLIB 228 select PHYLIB
226 help 229 help
227 The Atmel MACB ethernet interface is found on many AT32 and AT91 230 The Atmel MACB ethernet interface is found on many AT32 and AT91
@@ -2428,7 +2431,7 @@ config UGETH_TX_ON_DEMAND
2428 2431
2429config MV643XX_ETH 2432config MV643XX_ETH
2430 tristate "Marvell Discovery (643XX) and Orion ethernet support" 2433 tristate "Marvell Discovery (643XX) and Orion ethernet support"
2431 depends on MV64X60 || PPC32 || PLAT_ORION 2434 depends on (MV64X60 || PPC32 || PLAT_ORION) && INET
2432 select INET_LRO 2435 select INET_LRO
2433 select PHYLIB 2436 select PHYLIB
2434 help 2437 help
@@ -2803,7 +2806,7 @@ config NIU
2803 2806
2804config PASEMI_MAC 2807config PASEMI_MAC
2805 tristate "PA Semi 1/10Gbit MAC" 2808 tristate "PA Semi 1/10Gbit MAC"
2806 depends on PPC_PASEMI && PCI 2809 depends on PPC_PASEMI && PCI && INET
2807 select PHYLIB 2810 select PHYLIB
2808 select INET_LRO 2811 select INET_LRO
2809 help 2812 help
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 1e620e287ae0..efeffdf9e5fa 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -2170,8 +2170,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
2170 dev->irq = sdev->irq; 2170 dev->irq = sdev->irq;
2171 SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); 2171 SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
2172 2172
2173 netif_carrier_off(dev);
2174
2175 err = ssb_bus_powerup(sdev->bus, 0); 2173 err = ssb_bus_powerup(sdev->bus, 0);
2176 if (err) { 2174 if (err) {
2177 dev_err(sdev->dev, 2175 dev_err(sdev->dev,
@@ -2213,6 +2211,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
2213 goto err_out_powerdown; 2211 goto err_out_powerdown;
2214 } 2212 }
2215 2213
2214 netif_carrier_off(dev);
2215
2216 ssb_set_drvdata(sdev, dev); 2216 ssb_set_drvdata(sdev, dev);
2217 2217
2218 /* Chip reset provides power to the b44 MAC & PCI cores, which 2218 /* Chip reset provides power to the b44 MAC & PCI cores, which
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3b16f62d5606..e953c6ad6e6d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5164,6 +5164,15 @@ int bond_create(struct net *net, const char *name)
5164 res = dev_alloc_name(bond_dev, "bond%d"); 5164 res = dev_alloc_name(bond_dev, "bond%d");
5165 if (res < 0) 5165 if (res < 0)
5166 goto out; 5166 goto out;
5167 } else {
5168 /*
5169 * If we're given a name to register
5170 * we need to ensure that its not already
5171 * registered
5172 */
5173 res = -EEXIST;
5174 if (__dev_get_by_name(net, name) != NULL)
5175 goto out;
5167 } 5176 }
5168 5177
5169 res = register_netdevice(bond_dev); 5178 res = register_netdevice(bond_dev);
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index a333b42111b8..6372610ed240 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -533,8 +533,15 @@ static inline void ehea_fill_skb(struct net_device *dev,
533 int length = cqe->num_bytes_transfered - 4; /*remove CRC */ 533 int length = cqe->num_bytes_transfered - 4; /*remove CRC */
534 534
535 skb_put(skb, length); 535 skb_put(skb, length);
536 skb->ip_summed = CHECKSUM_UNNECESSARY;
537 skb->protocol = eth_type_trans(skb, dev); 536 skb->protocol = eth_type_trans(skb, dev);
537
538 /* The packet was not an IPV4 packet so a complemented checksum was
539 calculated. The value is found in the Internet Checksum field. */
540 if (cqe->status & EHEA_CQE_BLIND_CKSUM) {
541 skb->ip_summed = CHECKSUM_COMPLETE;
542 skb->csum = csum_unfold(~cqe->inet_checksum_value);
543 } else
544 skb->ip_summed = CHECKSUM_UNNECESSARY;
538} 545}
539 546
540static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, 547static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index f608a6c54af5..38104734a3be 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -150,6 +150,7 @@ struct ehea_rwqe {
150#define EHEA_CQE_TYPE_RQ 0x60 150#define EHEA_CQE_TYPE_RQ 0x60
151#define EHEA_CQE_STAT_ERR_MASK 0x700F 151#define EHEA_CQE_STAT_ERR_MASK 0x700F
152#define EHEA_CQE_STAT_FAT_ERR_MASK 0xF 152#define EHEA_CQE_STAT_FAT_ERR_MASK 0xF
153#define EHEA_CQE_BLIND_CKSUM 0x8000
153#define EHEA_CQE_STAT_ERR_TCP 0x4000 154#define EHEA_CQE_STAT_ERR_TCP 0x4000
154#define EHEA_CQE_STAT_ERR_IP 0x2000 155#define EHEA_CQE_STAT_ERR_IP 0x2000
155#define EHEA_CQE_STAT_ERR_CRC 0x1000 156#define EHEA_CQE_STAT_ERR_CRC 0x1000
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 768b840aeb6b..cce32d43175f 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -678,24 +678,37 @@ static int fec_enet_mii_probe(struct net_device *dev)
678{ 678{
679 struct fec_enet_private *fep = netdev_priv(dev); 679 struct fec_enet_private *fep = netdev_priv(dev);
680 struct phy_device *phy_dev = NULL; 680 struct phy_device *phy_dev = NULL;
681 int ret; 681 char mdio_bus_id[MII_BUS_ID_SIZE];
682 char phy_name[MII_BUS_ID_SIZE + 3];
683 int phy_id;
682 684
683 fep->phy_dev = NULL; 685 fep->phy_dev = NULL;
684 686
685 /* find the first phy */ 687 /* check for attached phy */
686 phy_dev = phy_find_first(fep->mii_bus); 688 for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
687 if (!phy_dev) { 689 if ((fep->mii_bus->phy_mask & (1 << phy_id)))
688 printk(KERN_ERR "%s: no PHY found\n", dev->name); 690 continue;
689 return -ENODEV; 691 if (fep->mii_bus->phy_map[phy_id] == NULL)
692 continue;
693 if (fep->mii_bus->phy_map[phy_id]->phy_id == 0)
694 continue;
695 strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
696 break;
690 } 697 }
691 698
692 /* attach the mac to the phy */ 699 if (phy_id >= PHY_MAX_ADDR) {
693 ret = phy_connect_direct(dev, phy_dev, 700 printk(KERN_INFO "%s: no PHY, assuming direct connection "
694 &fec_enet_adjust_link, 0, 701 "to switch\n", dev->name);
695 PHY_INTERFACE_MODE_MII); 702 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE);
696 if (ret) { 703 phy_id = 0;
697 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 704 }
698 return ret; 705
706 snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
707 phy_dev = phy_connect(dev, phy_name, &fec_enet_adjust_link, 0,
708 PHY_INTERFACE_MODE_MII);
709 if (IS_ERR(phy_dev)) {
710 printk(KERN_ERR "%s: could not attach to PHY\n", dev->name);
711 return PTR_ERR(phy_dev);
699 } 712 }
700 713
701 /* mask with MAC supported features */ 714 /* mask with MAC supported features */
@@ -738,7 +751,7 @@ static int fec_enet_mii_init(struct platform_device *pdev)
738 fep->mii_bus->read = fec_enet_mdio_read; 751 fep->mii_bus->read = fec_enet_mdio_read;
739 fep->mii_bus->write = fec_enet_mdio_write; 752 fep->mii_bus->write = fec_enet_mdio_write;
740 fep->mii_bus->reset = fec_enet_mdio_reset; 753 fep->mii_bus->reset = fec_enet_mdio_reset;
741 snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); 754 snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id + 1);
742 fep->mii_bus->priv = fep; 755 fep->mii_bus->priv = fep;
743 fep->mii_bus->parent = &pdev->dev; 756 fep->mii_bus->parent = &pdev->dev;
744 757
@@ -1311,6 +1324,9 @@ fec_probe(struct platform_device *pdev)
1311 if (ret) 1324 if (ret)
1312 goto failed_mii_init; 1325 goto failed_mii_init;
1313 1326
1327 /* Carrier starts down, phylib will bring it up */
1328 netif_carrier_off(ndev);
1329
1314 ret = register_netdev(ndev); 1330 ret = register_netdev(ndev);
1315 if (ret) 1331 if (ret)
1316 goto failed_register; 1332 goto failed_register;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index a0da4a17b025..992db2fa136e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1212,7 +1212,8 @@ static void rtl8169_update_counters(struct net_device *dev)
1212 if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) 1212 if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0)
1213 return; 1213 return;
1214 1214
1215 counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); 1215 counters = dma_alloc_coherent(&tp->pci_dev->dev, sizeof(*counters),
1216 &paddr, GFP_KERNEL);
1216 if (!counters) 1217 if (!counters)
1217 return; 1218 return;
1218 1219
@@ -1233,7 +1234,8 @@ static void rtl8169_update_counters(struct net_device *dev)
1233 RTL_W32(CounterAddrLow, 0); 1234 RTL_W32(CounterAddrLow, 0);
1234 RTL_W32(CounterAddrHigh, 0); 1235 RTL_W32(CounterAddrHigh, 0);
1235 1236
1236 pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); 1237 dma_free_coherent(&tp->pci_dev->dev, sizeof(*counters), counters,
1238 paddr);
1237} 1239}
1238 1240
1239static void rtl8169_get_ethtool_stats(struct net_device *dev, 1241static void rtl8169_get_ethtool_stats(struct net_device *dev,
@@ -3292,15 +3294,15 @@ static int rtl8169_open(struct net_device *dev)
3292 3294
3293 /* 3295 /*
3294 * Rx and Tx desscriptors needs 256 bytes alignment. 3296 * Rx and Tx desscriptors needs 256 bytes alignment.
3295 * pci_alloc_consistent provides more. 3297 * dma_alloc_coherent provides more.
3296 */ 3298 */
3297 tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, 3299 tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES,
3298 &tp->TxPhyAddr); 3300 &tp->TxPhyAddr, GFP_KERNEL);
3299 if (!tp->TxDescArray) 3301 if (!tp->TxDescArray)
3300 goto err_pm_runtime_put; 3302 goto err_pm_runtime_put;
3301 3303
3302 tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, 3304 tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES,
3303 &tp->RxPhyAddr); 3305 &tp->RxPhyAddr, GFP_KERNEL);
3304 if (!tp->RxDescArray) 3306 if (!tp->RxDescArray)
3305 goto err_free_tx_0; 3307 goto err_free_tx_0;
3306 3308
@@ -3334,12 +3336,12 @@ out:
3334err_release_ring_2: 3336err_release_ring_2:
3335 rtl8169_rx_clear(tp); 3337 rtl8169_rx_clear(tp);
3336err_free_rx_1: 3338err_free_rx_1:
3337 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, 3339 dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
3338 tp->RxPhyAddr); 3340 tp->RxPhyAddr);
3339 tp->RxDescArray = NULL; 3341 tp->RxDescArray = NULL;
3340err_free_tx_0: 3342err_free_tx_0:
3341 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, 3343 dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
3342 tp->TxPhyAddr); 3344 tp->TxPhyAddr);
3343 tp->TxDescArray = NULL; 3345 tp->TxDescArray = NULL;
3344err_pm_runtime_put: 3346err_pm_runtime_put:
3345 pm_runtime_put_noidle(&pdev->dev); 3347 pm_runtime_put_noidle(&pdev->dev);
@@ -3975,7 +3977,7 @@ static void rtl8169_free_rx_skb(struct rtl8169_private *tp,
3975{ 3977{
3976 struct pci_dev *pdev = tp->pci_dev; 3978 struct pci_dev *pdev = tp->pci_dev;
3977 3979
3978 pci_unmap_single(pdev, le64_to_cpu(desc->addr), tp->rx_buf_sz, 3980 dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz,
3979 PCI_DMA_FROMDEVICE); 3981 PCI_DMA_FROMDEVICE);
3980 dev_kfree_skb(*sk_buff); 3982 dev_kfree_skb(*sk_buff);
3981 *sk_buff = NULL; 3983 *sk_buff = NULL;
@@ -4000,7 +4002,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
4000static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, 4002static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
4001 struct net_device *dev, 4003 struct net_device *dev,
4002 struct RxDesc *desc, int rx_buf_sz, 4004 struct RxDesc *desc, int rx_buf_sz,
4003 unsigned int align) 4005 unsigned int align, gfp_t gfp)
4004{ 4006{
4005 struct sk_buff *skb; 4007 struct sk_buff *skb;
4006 dma_addr_t mapping; 4008 dma_addr_t mapping;
@@ -4008,13 +4010,13 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
4008 4010
4009 pad = align ? align : NET_IP_ALIGN; 4011 pad = align ? align : NET_IP_ALIGN;
4010 4012
4011 skb = netdev_alloc_skb(dev, rx_buf_sz + pad); 4013 skb = __netdev_alloc_skb(dev, rx_buf_sz + pad, gfp);
4012 if (!skb) 4014 if (!skb)
4013 goto err_out; 4015 goto err_out;
4014 4016
4015 skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); 4017 skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad);
4016 4018
4017 mapping = pci_map_single(pdev, skb->data, rx_buf_sz, 4019 mapping = dma_map_single(&pdev->dev, skb->data, rx_buf_sz,
4018 PCI_DMA_FROMDEVICE); 4020 PCI_DMA_FROMDEVICE);
4019 4021
4020 rtl8169_map_to_asic(desc, mapping, rx_buf_sz); 4022 rtl8169_map_to_asic(desc, mapping, rx_buf_sz);
@@ -4039,7 +4041,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp)
4039} 4041}
4040 4042
4041static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, 4043static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
4042 u32 start, u32 end) 4044 u32 start, u32 end, gfp_t gfp)
4043{ 4045{
4044 u32 cur; 4046 u32 cur;
4045 4047
@@ -4054,7 +4056,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
4054 4056
4055 skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, 4057 skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev,
4056 tp->RxDescArray + i, 4058 tp->RxDescArray + i,
4057 tp->rx_buf_sz, tp->align); 4059 tp->rx_buf_sz, tp->align, gfp);
4058 if (!skb) 4060 if (!skb)
4059 break; 4061 break;
4060 4062
@@ -4082,7 +4084,7 @@ static int rtl8169_init_ring(struct net_device *dev)
4082 memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); 4084 memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info));
4083 memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); 4085 memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *));
4084 4086
4085 if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) 4087 if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, GFP_KERNEL) != NUM_RX_DESC)
4086 goto err_out; 4088 goto err_out;
4087 4089
4088 rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); 4090 rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1);
@@ -4099,7 +4101,8 @@ static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb,
4099{ 4101{
4100 unsigned int len = tx_skb->len; 4102 unsigned int len = tx_skb->len;
4101 4103
4102 pci_unmap_single(pdev, le64_to_cpu(desc->addr), len, PCI_DMA_TODEVICE); 4104 dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len,
4105 PCI_DMA_TODEVICE);
4103 desc->opts1 = 0x00; 4106 desc->opts1 = 0x00;
4104 desc->opts2 = 0x00; 4107 desc->opts2 = 0x00;
4105 desc->addr = 0x00; 4108 desc->addr = 0x00;
@@ -4243,7 +4246,8 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb,
4243 txd = tp->TxDescArray + entry; 4246 txd = tp->TxDescArray + entry;
4244 len = frag->size; 4247 len = frag->size;
4245 addr = ((void *) page_address(frag->page)) + frag->page_offset; 4248 addr = ((void *) page_address(frag->page)) + frag->page_offset;
4246 mapping = pci_map_single(tp->pci_dev, addr, len, PCI_DMA_TODEVICE); 4249 mapping = dma_map_single(&tp->pci_dev->dev, addr, len,
4250 PCI_DMA_TODEVICE);
4247 4251
4248 /* anti gcc 2.95.3 bugware (sic) */ 4252 /* anti gcc 2.95.3 bugware (sic) */
4249 status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); 4253 status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC));
@@ -4313,7 +4317,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
4313 tp->tx_skb[entry].skb = skb; 4317 tp->tx_skb[entry].skb = skb;
4314 } 4318 }
4315 4319
4316 mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); 4320 mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len,
4321 PCI_DMA_TODEVICE);
4317 4322
4318 tp->tx_skb[entry].len = len; 4323 tp->tx_skb[entry].len = len;
4319 txd->addr = cpu_to_le64(mapping); 4324 txd->addr = cpu_to_le64(mapping);
@@ -4477,8 +4482,8 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff,
4477 if (!skb) 4482 if (!skb)
4478 goto out; 4483 goto out;
4479 4484
4480 pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size, 4485 dma_sync_single_for_cpu(&tp->pci_dev->dev, addr, pkt_size,
4481 PCI_DMA_FROMDEVICE); 4486 PCI_DMA_FROMDEVICE);
4482 skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); 4487 skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size);
4483 *sk_buff = skb; 4488 *sk_buff = skb;
4484 done = true; 4489 done = true;
@@ -4549,11 +4554,11 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
4549 rtl8169_rx_csum(skb, desc); 4554 rtl8169_rx_csum(skb, desc);
4550 4555
4551 if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { 4556 if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) {
4552 pci_dma_sync_single_for_device(pdev, addr, 4557 dma_sync_single_for_device(&pdev->dev, addr,
4553 pkt_size, PCI_DMA_FROMDEVICE); 4558 pkt_size, PCI_DMA_FROMDEVICE);
4554 rtl8169_mark_to_asic(desc, tp->rx_buf_sz); 4559 rtl8169_mark_to_asic(desc, tp->rx_buf_sz);
4555 } else { 4560 } else {
4556 pci_unmap_single(pdev, addr, tp->rx_buf_sz, 4561 dma_unmap_single(&pdev->dev, addr, tp->rx_buf_sz,
4557 PCI_DMA_FROMDEVICE); 4562 PCI_DMA_FROMDEVICE);
4558 tp->Rx_skbuff[entry] = NULL; 4563 tp->Rx_skbuff[entry] = NULL;
4559 } 4564 }
@@ -4583,7 +4588,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
4583 count = cur_rx - tp->cur_rx; 4588 count = cur_rx - tp->cur_rx;
4584 tp->cur_rx = cur_rx; 4589 tp->cur_rx = cur_rx;
4585 4590
4586 delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); 4591 delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, GFP_ATOMIC);
4587 if (!delta && count) 4592 if (!delta && count)
4588 netif_info(tp, intr, dev, "no Rx buffer allocated\n"); 4593 netif_info(tp, intr, dev, "no Rx buffer allocated\n");
4589 tp->dirty_rx += delta; 4594 tp->dirty_rx += delta;
@@ -4769,10 +4774,10 @@ static int rtl8169_close(struct net_device *dev)
4769 4774
4770 free_irq(dev->irq, dev); 4775 free_irq(dev->irq, dev);
4771 4776
4772 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, 4777 dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
4773 tp->RxPhyAddr); 4778 tp->RxPhyAddr);
4774 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, 4779 dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
4775 tp->TxPhyAddr); 4780 tp->TxPhyAddr);
4776 tp->TxDescArray = NULL; 4781 tp->TxDescArray = NULL;
4777 tp->RxDescArray = NULL; 4782 tp->RxDescArray = NULL;
4778 4783
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 40e5c46e7571..465ae7e84507 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -43,6 +43,7 @@
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44#include <linux/mii.h> 44#include <linux/mii.h>
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <linux/dmi.h>
46#include <asm/irq.h> 47#include <asm/irq.h>
47 48
48#include "skge.h" 49#include "skge.h"
@@ -3868,6 +3869,8 @@ static void __devinit skge_show_addr(struct net_device *dev)
3868 netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); 3869 netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr);
3869} 3870}
3870 3871
3872static int only_32bit_dma;
3873
3871static int __devinit skge_probe(struct pci_dev *pdev, 3874static int __devinit skge_probe(struct pci_dev *pdev,
3872 const struct pci_device_id *ent) 3875 const struct pci_device_id *ent)
3873{ 3876{
@@ -3889,7 +3892,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3889 3892
3890 pci_set_master(pdev); 3893 pci_set_master(pdev);
3891 3894
3892 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { 3895 if (!only_32bit_dma && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
3893 using_dac = 1; 3896 using_dac = 1;
3894 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); 3897 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
3895 } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { 3898 } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) {
@@ -4147,8 +4150,21 @@ static struct pci_driver skge_driver = {
4147 .shutdown = skge_shutdown, 4150 .shutdown = skge_shutdown,
4148}; 4151};
4149 4152
4153static struct dmi_system_id skge_32bit_dma_boards[] = {
4154 {
4155 .ident = "Gigabyte nForce boards",
4156 .matches = {
4157 DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"),
4158 DMI_MATCH(DMI_BOARD_NAME, "nForce"),
4159 },
4160 },
4161 {}
4162};
4163
4150static int __init skge_init_module(void) 4164static int __init skge_init_module(void)
4151{ 4165{
4166 if (dmi_check_system(skge_32bit_dma_boards))
4167 only_32bit_dma = 1;
4152 skge_debug_init(); 4168 skge_debug_init();
4153 return pci_register_driver(&skge_driver); 4169 return pci_register_driver(&skge_driver);
4154} 4170}
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index bc3af78a869f..1ec4b9e0239a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4666,7 +4666,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
4666 desc_idx, *post_ptr); 4666 desc_idx, *post_ptr);
4667 drop_it_no_recycle: 4667 drop_it_no_recycle:
4668 /* Other statistics kept track of by card. */ 4668 /* Other statistics kept track of by card. */
4669 tp->net_stats.rx_dropped++; 4669 tp->rx_dropped++;
4670 goto next_pkt; 4670 goto next_pkt;
4671 } 4671 }
4672 4672
@@ -4726,7 +4726,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
4726 if (len > (tp->dev->mtu + ETH_HLEN) && 4726 if (len > (tp->dev->mtu + ETH_HLEN) &&
4727 skb->protocol != htons(ETH_P_8021Q)) { 4727 skb->protocol != htons(ETH_P_8021Q)) {
4728 dev_kfree_skb(skb); 4728 dev_kfree_skb(skb);
4729 goto next_pkt; 4729 goto drop_it_no_recycle;
4730 } 4730 }
4731 4731
4732 if (desc->type_flags & RXD_FLAG_VLAN && 4732 if (desc->type_flags & RXD_FLAG_VLAN &&
@@ -9240,6 +9240,8 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
9240 stats->rx_missed_errors = old_stats->rx_missed_errors + 9240 stats->rx_missed_errors = old_stats->rx_missed_errors +
9241 get_stat64(&hw_stats->rx_discards); 9241 get_stat64(&hw_stats->rx_discards);
9242 9242
9243 stats->rx_dropped = tp->rx_dropped;
9244
9243 return stats; 9245 return stats;
9244} 9246}
9245 9247
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 4937bd190964..be7ff138a7f9 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2759,7 +2759,7 @@ struct tg3 {
2759 2759
2760 2760
2761 /* begin "everything else" cacheline(s) section */ 2761 /* begin "everything else" cacheline(s) section */
2762 struct rtnl_link_stats64 net_stats; 2762 unsigned long rx_dropped;
2763 struct rtnl_link_stats64 net_stats_prev; 2763 struct rtnl_link_stats64 net_stats_prev;
2764 struct tg3_ethtool_stats estats; 2764 struct tg3_ethtool_stats estats;
2765 struct tg3_ethtool_stats estats_prev; 2765 struct tg3_ethtool_stats estats_prev;
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
index 8cc9e319f435..1737d1488b35 100644
--- a/drivers/net/wimax/i2400m/rx.c
+++ b/drivers/net/wimax/i2400m/rx.c
@@ -1244,16 +1244,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
1244 int i, result; 1244 int i, result;
1245 struct device *dev = i2400m_dev(i2400m); 1245 struct device *dev = i2400m_dev(i2400m);
1246 const struct i2400m_msg_hdr *msg_hdr; 1246 const struct i2400m_msg_hdr *msg_hdr;
1247 size_t pl_itr, pl_size, skb_len; 1247 size_t pl_itr, pl_size;
1248 unsigned long flags; 1248 unsigned long flags;
1249 unsigned num_pls, single_last; 1249 unsigned num_pls, single_last, skb_len;
1250 1250
1251 skb_len = skb->len; 1251 skb_len = skb->len;
1252 d_fnstart(4, dev, "(i2400m %p skb %p [size %zu])\n", 1252 d_fnstart(4, dev, "(i2400m %p skb %p [size %u])\n",
1253 i2400m, skb, skb_len); 1253 i2400m, skb, skb_len);
1254 result = -EIO; 1254 result = -EIO;
1255 msg_hdr = (void *) skb->data; 1255 msg_hdr = (void *) skb->data;
1256 result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb->len); 1256 result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb_len);
1257 if (result < 0) 1257 if (result < 0)
1258 goto error_msg_hdr_check; 1258 goto error_msg_hdr_check;
1259 result = -EIO; 1259 result = -EIO;
@@ -1261,10 +1261,10 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
1261 pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ 1261 pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */
1262 num_pls * sizeof(msg_hdr->pld[0]); 1262 num_pls * sizeof(msg_hdr->pld[0]);
1263 pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); 1263 pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN);
1264 if (pl_itr > skb->len) { /* got all the payload descriptors? */ 1264 if (pl_itr > skb_len) { /* got all the payload descriptors? */
1265 dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " 1265 dev_err(dev, "RX: HW BUG? message too short (%u bytes) for "
1266 "%u payload descriptors (%zu each, total %zu)\n", 1266 "%u payload descriptors (%zu each, total %zu)\n",
1267 skb->len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); 1267 skb_len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr);
1268 goto error_pl_descr_short; 1268 goto error_pl_descr_short;
1269 } 1269 }
1270 /* Walk each payload payload--check we really got it */ 1270 /* Walk each payload payload--check we really got it */
@@ -1272,7 +1272,7 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
1272 /* work around old gcc warnings */ 1272 /* work around old gcc warnings */
1273 pl_size = i2400m_pld_size(&msg_hdr->pld[i]); 1273 pl_size = i2400m_pld_size(&msg_hdr->pld[i]);
1274 result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], 1274 result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i],
1275 pl_itr, skb->len); 1275 pl_itr, skb_len);
1276 if (result < 0) 1276 if (result < 0)
1277 goto error_pl_descr_check; 1277 goto error_pl_descr_check;
1278 single_last = num_pls == 1 || i == num_pls - 1; 1278 single_last = num_pls == 1 || i == num_pls - 1;
@@ -1290,16 +1290,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
1290 if (i < i2400m->rx_pl_min) 1290 if (i < i2400m->rx_pl_min)
1291 i2400m->rx_pl_min = i; 1291 i2400m->rx_pl_min = i;
1292 i2400m->rx_num++; 1292 i2400m->rx_num++;
1293 i2400m->rx_size_acc += skb->len; 1293 i2400m->rx_size_acc += skb_len;
1294 if (skb->len < i2400m->rx_size_min) 1294 if (skb_len < i2400m->rx_size_min)
1295 i2400m->rx_size_min = skb->len; 1295 i2400m->rx_size_min = skb_len;
1296 if (skb->len > i2400m->rx_size_max) 1296 if (skb_len > i2400m->rx_size_max)
1297 i2400m->rx_size_max = skb->len; 1297 i2400m->rx_size_max = skb_len;
1298 spin_unlock_irqrestore(&i2400m->rx_lock, flags); 1298 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
1299error_pl_descr_check: 1299error_pl_descr_check:
1300error_pl_descr_short: 1300error_pl_descr_short:
1301error_msg_hdr_check: 1301error_msg_hdr_check:
1302 d_fnend(4, dev, "(i2400m %p skb %p [size %zu]) = %d\n", 1302 d_fnend(4, dev, "(i2400m %p skb %p [size %u]) = %d\n",
1303 i2400m, skb, skb_len, result); 1303 i2400m, skb, skb_len, result);
1304 return result; 1304 return result;
1305} 1305}
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index cc648b6ae31c..a3d95cca8f0c 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -543,7 +543,7 @@ static u8 ath9k_hw_chan_2_clockrate_mhz(struct ath_hw *ah)
543 if (conf_is_ht40(conf)) 543 if (conf_is_ht40(conf))
544 return clockrate * 2; 544 return clockrate * 2;
545 545
546 return clockrate * 2; 546 return clockrate;
547} 547}
548 548
549static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) 549static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 9dd9e64c2b0b..8fd00a6e5120 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1411,7 +1411,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
1411 clear_bit(STATUS_SCAN_HW, &priv->status); 1411 clear_bit(STATUS_SCAN_HW, &priv->status);
1412 clear_bit(STATUS_SCANNING, &priv->status); 1412 clear_bit(STATUS_SCANNING, &priv->status);
1413 /* inform mac80211 scan aborted */ 1413 /* inform mac80211 scan aborted */
1414 queue_work(priv->workqueue, &priv->scan_completed); 1414 queue_work(priv->workqueue, &priv->abort_scan);
1415} 1415}
1416 1416
1417int iwlagn_manage_ibss_station(struct iwl_priv *priv, 1417int iwlagn_manage_ibss_station(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 59a308b02f95..d31661c1ce77 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3018,7 +3018,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
3018 clear_bit(STATUS_SCANNING, &priv->status); 3018 clear_bit(STATUS_SCANNING, &priv->status);
3019 3019
3020 /* inform mac80211 scan aborted */ 3020 /* inform mac80211 scan aborted */
3021 queue_work(priv->workqueue, &priv->scan_completed); 3021 queue_work(priv->workqueue, &priv->abort_scan);
3022} 3022}
3023 3023
3024static void iwl3945_bg_restart(struct work_struct *data) 3024static void iwl3945_bg_restart(struct work_struct *data)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 89ed181cd90c..857ae01734a6 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -163,6 +163,26 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_d
163DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs); 163DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs);
164 164
165/* 165/*
166 * Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear
167 * for some HT machines to use C4 w/o hanging.
168 */
169static void __devinit quirk_tigerpoint_bm_sts(struct pci_dev *dev)
170{
171 u32 pmbase;
172 u16 pm1a;
173
174 pci_read_config_dword(dev, 0x40, &pmbase);
175 pmbase = pmbase & 0xff80;
176 pm1a = inw(pmbase);
177
178 if (pm1a & 0x10) {
179 dev_info(&dev->dev, FW_BUG "TigerPoint LPC.BM_STS cleared\n");
180 outw(0x10, pmbase);
181 }
182}
183DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk_tigerpoint_bm_sts);
184
185/*
166 * Chipsets where PCI->PCI transfers vanish or hang 186 * Chipsets where PCI->PCI transfers vanish or hang
167 */ 187 */
168static void __devinit quirk_nopcipci(struct pci_dev *dev) 188static void __devinit quirk_nopcipci(struct pci_dev *dev)
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 9024480a8228..c44a5e8b8b82 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -51,7 +51,6 @@
51 * TODO: 51 * TODO:
52 * - handle CPU hotplug 52 * - handle CPU hotplug
53 * - provide turbo enable/disable api 53 * - provide turbo enable/disable api
54 * - make sure we can write turbo enable/disable reg based on MISC_EN
55 * 54 *
56 * Related documents: 55 * Related documents:
57 * - CDI 403777, 403778 - Auburndale EDS vol 1 & 2 56 * - CDI 403777, 403778 - Auburndale EDS vol 1 & 2
@@ -230,7 +229,7 @@
230#define THM_TC2 0xac 229#define THM_TC2 0xac
231#define THM_DTV 0xb0 230#define THM_DTV 0xb0
232#define THM_ITV 0xd8 231#define THM_ITV 0xd8
233#define ITV_ME_SEQNO_MASK 0x000f0000 /* ME should update every ~200ms */ 232#define ITV_ME_SEQNO_MASK 0x00ff0000 /* ME should update every ~200ms */
234#define ITV_ME_SEQNO_SHIFT (16) 233#define ITV_ME_SEQNO_SHIFT (16)
235#define ITV_MCH_TEMP_MASK 0x0000ff00 234#define ITV_MCH_TEMP_MASK 0x0000ff00
236#define ITV_MCH_TEMP_SHIFT (8) 235#define ITV_MCH_TEMP_SHIFT (8)
@@ -325,6 +324,7 @@ struct ips_driver {
325 bool gpu_preferred; 324 bool gpu_preferred;
326 bool poll_turbo_status; 325 bool poll_turbo_status;
327 bool second_cpu; 326 bool second_cpu;
327 bool turbo_toggle_allowed;
328 struct ips_mcp_limits *limits; 328 struct ips_mcp_limits *limits;
329 329
330 /* Optional MCH interfaces for if i915 is in use */ 330 /* Optional MCH interfaces for if i915 is in use */
@@ -415,7 +415,7 @@ static void ips_cpu_lower(struct ips_driver *ips)
415 new_limit = cur_limit - 8; /* 1W decrease */ 415 new_limit = cur_limit - 8; /* 1W decrease */
416 416
417 /* Clamp to SKU TDP limit */ 417 /* Clamp to SKU TDP limit */
418 if (((new_limit * 10) / 8) < (ips->orig_turbo_limit & TURBO_TDP_MASK)) 418 if (new_limit < (ips->orig_turbo_limit & TURBO_TDP_MASK))
419 new_limit = ips->orig_turbo_limit & TURBO_TDP_MASK; 419 new_limit = ips->orig_turbo_limit & TURBO_TDP_MASK;
420 420
421 thm_writew(THM_MPCPC, (new_limit * 10) / 8); 421 thm_writew(THM_MPCPC, (new_limit * 10) / 8);
@@ -461,7 +461,8 @@ static void ips_enable_cpu_turbo(struct ips_driver *ips)
461 if (ips->__cpu_turbo_on) 461 if (ips->__cpu_turbo_on)
462 return; 462 return;
463 463
464 on_each_cpu(do_enable_cpu_turbo, ips, 1); 464 if (ips->turbo_toggle_allowed)
465 on_each_cpu(do_enable_cpu_turbo, ips, 1);
465 466
466 ips->__cpu_turbo_on = true; 467 ips->__cpu_turbo_on = true;
467} 468}
@@ -498,7 +499,8 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips)
498 if (!ips->__cpu_turbo_on) 499 if (!ips->__cpu_turbo_on)
499 return; 500 return;
500 501
501 on_each_cpu(do_disable_cpu_turbo, ips, 1); 502 if (ips->turbo_toggle_allowed)
503 on_each_cpu(do_disable_cpu_turbo, ips, 1);
502 504
503 ips->__cpu_turbo_on = false; 505 ips->__cpu_turbo_on = false;
504} 506}
@@ -598,17 +600,29 @@ static bool mcp_exceeded(struct ips_driver *ips)
598{ 600{
599 unsigned long flags; 601 unsigned long flags;
600 bool ret = false; 602 bool ret = false;
603 u32 temp_limit;
604 u32 avg_power;
605 const char *msg = "MCP limit exceeded: ";
601 606
602 spin_lock_irqsave(&ips->turbo_status_lock, flags); 607 spin_lock_irqsave(&ips->turbo_status_lock, flags);
603 if (ips->mcp_avg_temp > (ips->mcp_temp_limit * 100)) 608
604 ret = true; 609 temp_limit = ips->mcp_temp_limit * 100;
605 if (ips->cpu_avg_power + ips->mch_avg_power > ips->mcp_power_limit) 610 if (ips->mcp_avg_temp > temp_limit) {
611 dev_info(&ips->dev->dev,
612 "%sAvg temp %u, limit %u\n", msg, ips->mcp_avg_temp,
613 temp_limit);
606 ret = true; 614 ret = true;
607 spin_unlock_irqrestore(&ips->turbo_status_lock, flags); 615 }
608 616
609 if (ret) 617 avg_power = ips->cpu_avg_power + ips->mch_avg_power;
618 if (avg_power > ips->mcp_power_limit) {
610 dev_info(&ips->dev->dev, 619 dev_info(&ips->dev->dev,
611 "MCP power or thermal limit exceeded\n"); 620 "%sAvg power %u, limit %u\n", msg, avg_power,
621 ips->mcp_power_limit);
622 ret = true;
623 }
624
625 spin_unlock_irqrestore(&ips->turbo_status_lock, flags);
612 626
613 return ret; 627 return ret;
614} 628}
@@ -663,6 +677,27 @@ static bool mch_exceeded(struct ips_driver *ips)
663} 677}
664 678
665/** 679/**
680 * verify_limits - verify BIOS provided limits
681 * @ips: IPS structure
682 *
683 * BIOS can optionally provide non-default limits for power and temp. Check
684 * them here and use the defaults if the BIOS values are not provided or
685 * are otherwise unusable.
686 */
687static void verify_limits(struct ips_driver *ips)
688{
689 if (ips->mcp_power_limit < ips->limits->mcp_power_limit ||
690 ips->mcp_power_limit > 35000)
691 ips->mcp_power_limit = ips->limits->mcp_power_limit;
692
693 if (ips->mcp_temp_limit < ips->limits->core_temp_limit ||
694 ips->mcp_temp_limit < ips->limits->mch_temp_limit ||
695 ips->mcp_temp_limit > 150)
696 ips->mcp_temp_limit = min(ips->limits->core_temp_limit,
697 ips->limits->mch_temp_limit);
698}
699
700/**
666 * update_turbo_limits - get various limits & settings from regs 701 * update_turbo_limits - get various limits & settings from regs
667 * @ips: IPS driver struct 702 * @ips: IPS driver struct
668 * 703 *
@@ -680,12 +715,21 @@ static void update_turbo_limits(struct ips_driver *ips)
680 u32 hts = thm_readl(THM_HTS); 715 u32 hts = thm_readl(THM_HTS);
681 716
682 ips->cpu_turbo_enabled = !(hts & HTS_PCTD_DIS); 717 ips->cpu_turbo_enabled = !(hts & HTS_PCTD_DIS);
683 ips->gpu_turbo_enabled = !(hts & HTS_GTD_DIS); 718 /*
719 * Disable turbo for now, until we can figure out why the power figures
720 * are wrong
721 */
722 ips->cpu_turbo_enabled = false;
723
724 if (ips->gpu_busy)
725 ips->gpu_turbo_enabled = !(hts & HTS_GTD_DIS);
726
684 ips->core_power_limit = thm_readw(THM_MPCPC); 727 ips->core_power_limit = thm_readw(THM_MPCPC);
685 ips->mch_power_limit = thm_readw(THM_MMGPC); 728 ips->mch_power_limit = thm_readw(THM_MMGPC);
686 ips->mcp_temp_limit = thm_readw(THM_PTL); 729 ips->mcp_temp_limit = thm_readw(THM_PTL);
687 ips->mcp_power_limit = thm_readw(THM_MPPC); 730 ips->mcp_power_limit = thm_readw(THM_MPPC);
688 731
732 verify_limits(ips);
689 /* Ignore BIOS CPU vs GPU pref */ 733 /* Ignore BIOS CPU vs GPU pref */
690} 734}
691 735
@@ -858,7 +902,7 @@ static u32 get_cpu_power(struct ips_driver *ips, u32 *last, int period)
858 ret = (ret * 1000) / 65535; 902 ret = (ret * 1000) / 65535;
859 *last = val; 903 *last = val;
860 904
861 return ret; 905 return 0;
862} 906}
863 907
864static const u16 temp_decay_factor = 2; 908static const u16 temp_decay_factor = 2;
@@ -940,7 +984,6 @@ static int ips_monitor(void *data)
940 kfree(mch_samples); 984 kfree(mch_samples);
941 kfree(cpu_samples); 985 kfree(cpu_samples);
942 kfree(mchp_samples); 986 kfree(mchp_samples);
943 kthread_stop(ips->adjust);
944 return -ENOMEM; 987 return -ENOMEM;
945 } 988 }
946 989
@@ -948,7 +991,7 @@ static int ips_monitor(void *data)
948 ITV_ME_SEQNO_SHIFT; 991 ITV_ME_SEQNO_SHIFT;
949 seqno_timestamp = get_jiffies_64(); 992 seqno_timestamp = get_jiffies_64();
950 993
951 old_cpu_power = thm_readl(THM_CEC) / 65535; 994 old_cpu_power = thm_readl(THM_CEC);
952 schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD)); 995 schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD));
953 996
954 /* Collect an initial average */ 997 /* Collect an initial average */
@@ -1150,11 +1193,18 @@ static irqreturn_t ips_irq_handler(int irq, void *arg)
1150 STS_GPL_SHIFT; 1193 STS_GPL_SHIFT;
1151 /* ignore EC CPU vs GPU pref */ 1194 /* ignore EC CPU vs GPU pref */
1152 ips->cpu_turbo_enabled = !(sts & STS_PCTD_DIS); 1195 ips->cpu_turbo_enabled = !(sts & STS_PCTD_DIS);
1153 ips->gpu_turbo_enabled = !(sts & STS_GTD_DIS); 1196 /*
1197 * Disable turbo for now, until we can figure
1198 * out why the power figures are wrong
1199 */
1200 ips->cpu_turbo_enabled = false;
1201 if (ips->gpu_busy)
1202 ips->gpu_turbo_enabled = !(sts & STS_GTD_DIS);
1154 ips->mcp_temp_limit = (sts & STS_PTL_MASK) >> 1203 ips->mcp_temp_limit = (sts & STS_PTL_MASK) >>
1155 STS_PTL_SHIFT; 1204 STS_PTL_SHIFT;
1156 ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >> 1205 ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >>
1157 STS_PPL_SHIFT; 1206 STS_PPL_SHIFT;
1207 verify_limits(ips);
1158 spin_unlock(&ips->turbo_status_lock); 1208 spin_unlock(&ips->turbo_status_lock);
1159 1209
1160 thm_writeb(THM_SEC, SEC_ACK); 1210 thm_writeb(THM_SEC, SEC_ACK);
@@ -1333,8 +1383,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips)
1333 * turbo manually or we'll get an illegal MSR access, even though 1383 * turbo manually or we'll get an illegal MSR access, even though
1334 * turbo will still be available. 1384 * turbo will still be available.
1335 */ 1385 */
1336 if (!(misc_en & IA32_MISC_TURBO_EN)) 1386 if (misc_en & IA32_MISC_TURBO_EN)
1337 ; /* add turbo MSR write allowed flag if necessary */ 1387 ips->turbo_toggle_allowed = true;
1388 else
1389 ips->turbo_toggle_allowed = false;
1338 1390
1339 if (strstr(boot_cpu_data.x86_model_id, "CPU M")) 1391 if (strstr(boot_cpu_data.x86_model_id, "CPU M"))
1340 limits = &ips_sv_limits; 1392 limits = &ips_sv_limits;
@@ -1351,9 +1403,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips)
1351 tdp = turbo_power & TURBO_TDP_MASK; 1403 tdp = turbo_power & TURBO_TDP_MASK;
1352 1404
1353 /* Sanity check TDP against CPU */ 1405 /* Sanity check TDP against CPU */
1354 if (limits->mcp_power_limit != (tdp / 8) * 1000) { 1406 if (limits->core_power_limit != (tdp / 8) * 1000) {
1355 dev_warn(&ips->dev->dev, "Warning: CPU TDP doesn't match expected value (found %d, expected %d)\n", 1407 dev_info(&ips->dev->dev, "CPU TDP doesn't match expected value (found %d, expected %d)\n",
1356 tdp / 8, limits->mcp_power_limit / 1000); 1408 tdp / 8, limits->core_power_limit / 1000);
1409 limits->core_power_limit = (tdp / 8) * 1000;
1357 } 1410 }
1358 1411
1359out: 1412out:
@@ -1390,7 +1443,7 @@ static bool ips_get_i915_syms(struct ips_driver *ips)
1390 return true; 1443 return true;
1391 1444
1392out_put_busy: 1445out_put_busy:
1393 symbol_put(i915_gpu_turbo_disable); 1446 symbol_put(i915_gpu_busy);
1394out_put_lower: 1447out_put_lower:
1395 symbol_put(i915_gpu_lower); 1448 symbol_put(i915_gpu_lower);
1396out_put_raise: 1449out_put_raise:
@@ -1532,22 +1585,27 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
1532 /* Save turbo limits & ratios */ 1585 /* Save turbo limits & ratios */
1533 rdmsrl(TURBO_POWER_CURRENT_LIMIT, ips->orig_turbo_limit); 1586 rdmsrl(TURBO_POWER_CURRENT_LIMIT, ips->orig_turbo_limit);
1534 1587
1535 ips_enable_cpu_turbo(ips); 1588 ips_disable_cpu_turbo(ips);
1536 ips->cpu_turbo_enabled = true; 1589 ips->cpu_turbo_enabled = false;
1537 1590
1538 /* Set up the work queue and monitor/adjust threads */ 1591 /* Create thermal adjust thread */
1539 ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor"); 1592 ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust");
1540 if (IS_ERR(ips->monitor)) { 1593 if (IS_ERR(ips->adjust)) {
1541 dev_err(&dev->dev, 1594 dev_err(&dev->dev,
1542 "failed to create thermal monitor thread, aborting\n"); 1595 "failed to create thermal adjust thread, aborting\n");
1543 ret = -ENOMEM; 1596 ret = -ENOMEM;
1544 goto error_free_irq; 1597 goto error_free_irq;
1598
1545 } 1599 }
1546 1600
1547 ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust"); 1601 /*
1548 if (IS_ERR(ips->adjust)) { 1602 * Set up the work queue and monitor thread. The monitor thread
1603 * will wake up ips_adjust thread.
1604 */
1605 ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor");
1606 if (IS_ERR(ips->monitor)) {
1549 dev_err(&dev->dev, 1607 dev_err(&dev->dev,
1550 "failed to create thermal adjust thread, aborting\n"); 1608 "failed to create thermal monitor thread, aborting\n");
1551 ret = -ENOMEM; 1609 ret = -ENOMEM;
1552 goto error_thread_cleanup; 1610 goto error_thread_cleanup;
1553 } 1611 }
@@ -1566,7 +1624,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
1566 return ret; 1624 return ret;
1567 1625
1568error_thread_cleanup: 1626error_thread_cleanup:
1569 kthread_stop(ips->monitor); 1627 kthread_stop(ips->adjust);
1570error_free_irq: 1628error_free_irq:
1571 free_irq(ips->dev->irq, ips); 1629 free_irq(ips->dev->irq, ips);
1572error_unmap: 1630error_unmap:
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c
index df1fb53c09d2..a4be41614eeb 100644
--- a/drivers/regulator/ad5398.c
+++ b/drivers/regulator/ad5398.c
@@ -256,7 +256,6 @@ static int __devexit ad5398_remove(struct i2c_client *client)
256 256
257 regulator_unregister(chip->rdev); 257 regulator_unregister(chip->rdev);
258 kfree(chip); 258 kfree(chip);
259 i2c_set_clientdata(client, NULL);
260 259
261 return 0; 260 return 0;
262} 261}
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 422a709d271d..cc8b337b9119 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -700,7 +700,7 @@ static void print_constraints(struct regulator_dev *rdev)
700 constraints->min_uA != constraints->max_uA) { 700 constraints->min_uA != constraints->max_uA) {
701 ret = _regulator_get_current_limit(rdev); 701 ret = _regulator_get_current_limit(rdev);
702 if (ret > 0) 702 if (ret > 0)
703 count += sprintf(buf + count, "at %d uA ", ret / 1000); 703 count += sprintf(buf + count, "at %d mA ", ret / 1000);
704 } 704 }
705 705
706 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) 706 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST)
@@ -2302,8 +2302,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
2302 dev_set_name(&rdev->dev, "regulator.%d", 2302 dev_set_name(&rdev->dev, "regulator.%d",
2303 atomic_inc_return(&regulator_no) - 1); 2303 atomic_inc_return(&regulator_no) - 1);
2304 ret = device_register(&rdev->dev); 2304 ret = device_register(&rdev->dev);
2305 if (ret != 0) 2305 if (ret != 0) {
2306 put_device(&rdev->dev);
2306 goto clean; 2307 goto clean;
2308 }
2307 2309
2308 dev_set_drvdata(&rdev->dev, rdev); 2310 dev_set_drvdata(&rdev->dev, rdev);
2309 2311
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index d61ecb885a8c..b8cc6389a541 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -191,8 +191,6 @@ static int __devexit isl6271a_remove(struct i2c_client *i2c)
191 struct isl_pmic *pmic = i2c_get_clientdata(i2c); 191 struct isl_pmic *pmic = i2c_get_clientdata(i2c);
192 int i; 192 int i;
193 193
194 i2c_set_clientdata(i2c, NULL);
195
196 for (i = 0; i < 3; i++) 194 for (i = 0; i < 3; i++)
197 regulator_unregister(pmic->rdev[i]); 195 regulator_unregister(pmic->rdev[i]);
198 196
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index 4520ace3f7e7..6b60a9c0366b 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -330,7 +330,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
330 /* set external clock frequency */ 330 /* set external clock frequency */
331 info->extclk_freq = pdata->extclk_freq; 331 info->extclk_freq = pdata->extclk_freq;
332 max8649_set_bits(info->i2c, MAX8649_SYNC, MAX8649_EXT_MASK, 332 max8649_set_bits(info->i2c, MAX8649_SYNC, MAX8649_EXT_MASK,
333 info->extclk_freq); 333 info->extclk_freq << 6);
334 } 334 }
335 335
336 if (pdata->ramp_timing) { 336 if (pdata->ramp_timing) {
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 9daed8db83d3..9de8516e3531 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -268,7 +268,6 @@ out_irq:
268 free_irq(client->irq, client); 268 free_irq(client->irq, client);
269 269
270out_free: 270out_free:
271 i2c_set_clientdata(client, NULL);
272 kfree(ds3232); 271 kfree(ds3232);
273 return ret; 272 return ret;
274} 273}
@@ -287,7 +286,6 @@ static int __devexit ds3232_remove(struct i2c_client *client)
287 } 286 }
288 287
289 rtc_device_unregister(ds3232->rtc); 288 rtc_device_unregister(ds3232->rtc);
290 i2c_set_clientdata(client, NULL);
291 kfree(ds3232); 289 kfree(ds3232);
292 return 0; 290 return 0;
293} 291}
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 12900f7083b0..3198c5335f0b 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -458,6 +458,7 @@ config SERIAL_SAMSUNG_UARTS
458 int 458 int
459 depends on ARM && PLAT_SAMSUNG 459 depends on ARM && PLAT_SAMSUNG
460 default 2 if ARCH_S3C2400 460 default 2 if ARCH_S3C2400
461 default 6 if ARCH_S5P6450
461 default 4 if SERIAL_SAMSUNG_UARTS_4 462 default 4 if SERIAL_SAMSUNG_UARTS_4
462 default 3 463 default 3
463 help 464 help
@@ -526,12 +527,12 @@ config SERIAL_S3C24A0
526 Serial port support for the Samsung S3C24A0 SoC 527 Serial port support for the Samsung S3C24A0 SoC
527 528
528config SERIAL_S3C6400 529config SERIAL_S3C6400
529 tristate "Samsung S3C6400/S3C6410/S5P6440/S5PC100 Serial port support" 530 tristate "Samsung S3C6400/S3C6410/S5P6440/S5P6450/S5PC100 Serial port support"
530 depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5PC100) 531 depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5P6450 || CPU_S5PC100)
531 select SERIAL_SAMSUNG_UARTS_4 532 select SERIAL_SAMSUNG_UARTS_4
532 default y 533 default y
533 help 534 help
534 Serial port support for the Samsung S3C6400, S3C6410, S5P6440 535 Serial port support for the Samsung S3C6400, S3C6410, S5P6440, S5P6450
535 and S5PC100 SoCs 536 and S5PC100 SoCs
536 537
537config SERIAL_S5PV210 538config SERIAL_S5PV210
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c
index 324c385a653d..5dff45c76d32 100644
--- a/drivers/serial/mfd.c
+++ b/drivers/serial/mfd.c
@@ -27,6 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/console.h> 28#include <linux/console.h>
29#include <linux/sysrq.h> 29#include <linux/sysrq.h>
30#include <linux/slab.h>
30#include <linux/serial_reg.h> 31#include <linux/serial_reg.h>
31#include <linux/circ_buf.h> 32#include <linux/circ_buf.h>
32#include <linux/delay.h> 33#include <linux/delay.h>
diff --git a/drivers/serial/mrst_max3110.c b/drivers/serial/mrst_max3110.c
index f6ad1ecbff79..51c15f58e01e 100644
--- a/drivers/serial/mrst_max3110.c
+++ b/drivers/serial/mrst_max3110.c
@@ -29,6 +29,7 @@
29 29
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/irq.h>
32#include <linux/init.h> 33#include <linux/init.h>
33#include <linux/console.h> 34#include <linux/console.h>
34#include <linux/sysrq.h> 35#include <linux/sysrq.h>
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c
index b1156ba8ad14..7ac2bf5167cd 100644
--- a/drivers/serial/samsung.c
+++ b/drivers/serial/samsung.c
@@ -1101,7 +1101,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1101 dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); 1101 dbg("resource %p (%lx..%lx)\n", res, res->start, res->end);
1102 1102
1103 port->mapbase = res->start; 1103 port->mapbase = res->start;
1104 port->membase = S3C_VA_UART + res->start - (S3C_PA_UART & 0xfff00000); 1104 port->membase = S3C_VA_UART + (res->start & 0xfffff);
1105 ret = platform_get_irq(platdev, 0); 1105 ret = platform_get_irq(platdev, 0);
1106 if (ret < 0) 1106 if (ret < 0)
1107 port->irq = 0; 1107 port->irq = 0;
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 91c2f4f3af10..7e631fa51098 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -143,10 +143,26 @@ config SPI_GPIO
143 GPIO operations, you should be able to leverage that for better 143 GPIO operations, you should be able to leverage that for better
144 speed with a custom version of this driver; see the source code. 144 speed with a custom version of this driver; see the source code.
145 145
146config SPI_IMX_VER_IMX1
147 def_bool y if SOC_IMX1
148
149config SPI_IMX_VER_0_0
150 def_bool y if SOC_IMX21 || SOC_IMX27
151
152config SPI_IMX_VER_0_4
153 def_bool y if ARCH_MX31
154
155config SPI_IMX_VER_0_7
156 def_bool y if ARCH_MX25 || ARCH_MX35 || ARCH_MX51
157
158config SPI_IMX_VER_2_3
159 def_bool y if ARCH_MX51
160
146config SPI_IMX 161config SPI_IMX
147 tristate "Freescale i.MX SPI controllers" 162 tristate "Freescale i.MX SPI controllers"
148 depends on ARCH_MXC 163 depends on ARCH_MXC
149 select SPI_BITBANG 164 select SPI_BITBANG
165 default m if IMX_HAVE_PLATFORM_SPI_IMX
150 help 166 help
151 This enables using the Freescale i.MX SPI controllers in master 167 This enables using the Freescale i.MX SPI controllers in master
152 mode. 168 mode.
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 0bcf4c1601a2..b5a78a1f4421 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/cache.h> 24#include <linux/cache.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/of_device.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
27#include <linux/mod_devicetable.h> 28#include <linux/mod_devicetable.h>
28#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
@@ -86,6 +87,10 @@ static int spi_match_device(struct device *dev, struct device_driver *drv)
86 const struct spi_device *spi = to_spi_device(dev); 87 const struct spi_device *spi = to_spi_device(dev);
87 const struct spi_driver *sdrv = to_spi_driver(drv); 88 const struct spi_driver *sdrv = to_spi_driver(drv);
88 89
90 /* Attempt an OF style match */
91 if (of_driver_match_device(dev, drv))
92 return 1;
93
89 if (sdrv->id_table) 94 if (sdrv->id_table)
90 return !!spi_match_id(sdrv->id_table, spi); 95 return !!spi_match_id(sdrv->id_table, spi);
91 96
diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c
index e24a63498acb..63e51b011d50 100644
--- a/drivers/spi/spi_gpio.c
+++ b/drivers/spi/spi_gpio.c
@@ -350,7 +350,7 @@ static int __init spi_gpio_probe(struct platform_device *pdev)
350 spi_gpio->bitbang.master = spi_master_get(master); 350 spi_gpio->bitbang.master = spi_master_get(master);
351 spi_gpio->bitbang.chipselect = spi_gpio_chipselect; 351 spi_gpio->bitbang.chipselect = spi_gpio_chipselect;
352 352
353 if ((master_flags & (SPI_MASTER_NO_RX | SPI_MASTER_NO_RX)) == 0) { 353 if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) {
354 spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0; 354 spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0;
355 spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1; 355 spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1;
356 spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_word_mode2; 356 spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_word_mode2;
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 7972e9077473..55a38e2c6c13 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -56,7 +56,28 @@ struct spi_imx_config {
56 unsigned int speed_hz; 56 unsigned int speed_hz;
57 unsigned int bpw; 57 unsigned int bpw;
58 unsigned int mode; 58 unsigned int mode;
59 int cs; 59 u8 cs;
60};
61
62enum spi_imx_devtype {
63 SPI_IMX_VER_IMX1,
64 SPI_IMX_VER_0_0,
65 SPI_IMX_VER_0_4,
66 SPI_IMX_VER_0_5,
67 SPI_IMX_VER_0_7,
68 SPI_IMX_VER_2_3,
69 SPI_IMX_VER_AUTODETECT,
70};
71
72struct spi_imx_data;
73
74struct spi_imx_devtype_data {
75 void (*intctrl)(struct spi_imx_data *, int);
76 int (*config)(struct spi_imx_data *, struct spi_imx_config *);
77 void (*trigger)(struct spi_imx_data *);
78 int (*rx_available)(struct spi_imx_data *);
79 void (*reset)(struct spi_imx_data *);
80 unsigned int fifosize;
60}; 81};
61 82
62struct spi_imx_data { 83struct spi_imx_data {
@@ -76,11 +97,7 @@ struct spi_imx_data {
76 const void *tx_buf; 97 const void *tx_buf;
77 unsigned int txfifo; /* number of words pushed in tx FIFO */ 98 unsigned int txfifo; /* number of words pushed in tx FIFO */
78 99
79 /* SoC specific functions */ 100 struct spi_imx_devtype_data devtype_data;
80 void (*intctrl)(struct spi_imx_data *, int);
81 int (*config)(struct spi_imx_data *, struct spi_imx_config *);
82 void (*trigger)(struct spi_imx_data *);
83 int (*rx_available)(struct spi_imx_data *);
84}; 101};
85 102
86#define MXC_SPI_BUF_RX(type) \ 103#define MXC_SPI_BUF_RX(type) \
@@ -140,7 +157,7 @@ static unsigned int spi_imx_clkdiv_1(unsigned int fin,
140 return max; 157 return max;
141} 158}
142 159
143/* MX1, MX31, MX35 */ 160/* MX1, MX31, MX35, MX51 CSPI */
144static unsigned int spi_imx_clkdiv_2(unsigned int fin, 161static unsigned int spi_imx_clkdiv_2(unsigned int fin,
145 unsigned int fspi) 162 unsigned int fspi)
146{ 163{
@@ -155,6 +172,128 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
155 return 7; 172 return 7;
156} 173}
157 174
175#define SPI_IMX2_3_CTRL 0x08
176#define SPI_IMX2_3_CTRL_ENABLE (1 << 0)
177#define SPI_IMX2_3_CTRL_XCH (1 << 2)
178#define SPI_IMX2_3_CTRL_MODE(cs) (1 << ((cs) + 4))
179#define SPI_IMX2_3_CTRL_POSTDIV_OFFSET 8
180#define SPI_IMX2_3_CTRL_PREDIV_OFFSET 12
181#define SPI_IMX2_3_CTRL_CS(cs) ((cs) << 18)
182#define SPI_IMX2_3_CTRL_BL_OFFSET 20
183
184#define SPI_IMX2_3_CONFIG 0x0c
185#define SPI_IMX2_3_CONFIG_SCLKPHA(cs) (1 << ((cs) + 0))
186#define SPI_IMX2_3_CONFIG_SCLKPOL(cs) (1 << ((cs) + 4))
187#define SPI_IMX2_3_CONFIG_SBBCTRL(cs) (1 << ((cs) + 8))
188#define SPI_IMX2_3_CONFIG_SSBPOL(cs) (1 << ((cs) + 12))
189
190#define SPI_IMX2_3_INT 0x10
191#define SPI_IMX2_3_INT_TEEN (1 << 0)
192#define SPI_IMX2_3_INT_RREN (1 << 3)
193
194#define SPI_IMX2_3_STAT 0x18
195#define SPI_IMX2_3_STAT_RR (1 << 3)
196
197/* MX51 eCSPI */
198static unsigned int spi_imx2_3_clkdiv(unsigned int fin, unsigned int fspi)
199{
200 /*
201 * there are two 4-bit dividers, the pre-divider divides by
202 * $pre, the post-divider by 2^$post
203 */
204 unsigned int pre, post;
205
206 if (unlikely(fspi > fin))
207 return 0;
208
209 post = fls(fin) - fls(fspi);
210 if (fin > fspi << post)
211 post++;
212
213 /* now we have: (fin <= fspi << post) with post being minimal */
214
215 post = max(4U, post) - 4;
216 if (unlikely(post > 0xf)) {
217 pr_err("%s: cannot set clock freq: %u (base freq: %u)\n",
218 __func__, fspi, fin);
219 return 0xff;
220 }
221
222 pre = DIV_ROUND_UP(fin, fspi << post) - 1;
223
224 pr_debug("%s: fin: %u, fspi: %u, post: %u, pre: %u\n",
225 __func__, fin, fspi, post, pre);
226 return (pre << SPI_IMX2_3_CTRL_PREDIV_OFFSET) |
227 (post << SPI_IMX2_3_CTRL_POSTDIV_OFFSET);
228}
229
230static void __maybe_unused spi_imx2_3_intctrl(struct spi_imx_data *spi_imx, int enable)
231{
232 unsigned val = 0;
233
234 if (enable & MXC_INT_TE)
235 val |= SPI_IMX2_3_INT_TEEN;
236
237 if (enable & MXC_INT_RR)
238 val |= SPI_IMX2_3_INT_RREN;
239
240 writel(val, spi_imx->base + SPI_IMX2_3_INT);
241}
242
243static void __maybe_unused spi_imx2_3_trigger(struct spi_imx_data *spi_imx)
244{
245 u32 reg;
246
247 reg = readl(spi_imx->base + SPI_IMX2_3_CTRL);
248 reg |= SPI_IMX2_3_CTRL_XCH;
249 writel(reg, spi_imx->base + SPI_IMX2_3_CTRL);
250}
251
252static int __maybe_unused spi_imx2_3_config(struct spi_imx_data *spi_imx,
253 struct spi_imx_config *config)
254{
255 u32 ctrl = SPI_IMX2_3_CTRL_ENABLE, cfg = 0;
256
257 /* set master mode */
258 ctrl |= SPI_IMX2_3_CTRL_MODE(config->cs);
259
260 /* set clock speed */
261 ctrl |= spi_imx2_3_clkdiv(spi_imx->spi_clk, config->speed_hz);
262
263 /* set chip select to use */
264 ctrl |= SPI_IMX2_3_CTRL_CS(config->cs);
265
266 ctrl |= (config->bpw - 1) << SPI_IMX2_3_CTRL_BL_OFFSET;
267
268 cfg |= SPI_IMX2_3_CONFIG_SBBCTRL(config->cs);
269
270 if (config->mode & SPI_CPHA)
271 cfg |= SPI_IMX2_3_CONFIG_SCLKPHA(config->cs);
272
273 if (config->mode & SPI_CPOL)
274 cfg |= SPI_IMX2_3_CONFIG_SCLKPOL(config->cs);
275
276 if (config->mode & SPI_CS_HIGH)
277 cfg |= SPI_IMX2_3_CONFIG_SSBPOL(config->cs);
278
279 writel(ctrl, spi_imx->base + SPI_IMX2_3_CTRL);
280 writel(cfg, spi_imx->base + SPI_IMX2_3_CONFIG);
281
282 return 0;
283}
284
285static int __maybe_unused spi_imx2_3_rx_available(struct spi_imx_data *spi_imx)
286{
287 return readl(spi_imx->base + SPI_IMX2_3_STAT) & SPI_IMX2_3_STAT_RR;
288}
289
290static void __maybe_unused spi_imx2_3_reset(struct spi_imx_data *spi_imx)
291{
292 /* drain receive buffer */
293 while (spi_imx2_3_rx_available(spi_imx))
294 readl(spi_imx->base + MXC_CSPIRXDATA);
295}
296
158#define MX31_INTREG_TEEN (1 << 0) 297#define MX31_INTREG_TEEN (1 << 0)
159#define MX31_INTREG_RREN (1 << 3) 298#define MX31_INTREG_RREN (1 << 3)
160 299
@@ -178,7 +317,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
178 * the i.MX35 has a slightly different register layout for bits 317 * the i.MX35 has a slightly different register layout for bits
179 * we do not use here. 318 * we do not use here.
180 */ 319 */
181static void mx31_intctrl(struct spi_imx_data *spi_imx, int enable) 320static void __maybe_unused mx31_intctrl(struct spi_imx_data *spi_imx, int enable)
182{ 321{
183 unsigned int val = 0; 322 unsigned int val = 0;
184 323
@@ -190,7 +329,7 @@ static void mx31_intctrl(struct spi_imx_data *spi_imx, int enable)
190 writel(val, spi_imx->base + MXC_CSPIINT); 329 writel(val, spi_imx->base + MXC_CSPIINT);
191} 330}
192 331
193static void mx31_trigger(struct spi_imx_data *spi_imx) 332static void __maybe_unused mx31_trigger(struct spi_imx_data *spi_imx)
194{ 333{
195 unsigned int reg; 334 unsigned int reg;
196 335
@@ -199,20 +338,16 @@ static void mx31_trigger(struct spi_imx_data *spi_imx)
199 writel(reg, spi_imx->base + MXC_CSPICTRL); 338 writel(reg, spi_imx->base + MXC_CSPICTRL);
200} 339}
201 340
202static int mx31_config(struct spi_imx_data *spi_imx, 341static int __maybe_unused spi_imx0_4_config(struct spi_imx_data *spi_imx,
203 struct spi_imx_config *config) 342 struct spi_imx_config *config)
204{ 343{
205 unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; 344 unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER;
345 int cs = spi_imx->chipselect[config->cs];
206 346
207 reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << 347 reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) <<
208 MX31_CSPICTRL_DR_SHIFT; 348 MX31_CSPICTRL_DR_SHIFT;
209 349
210 if (cpu_is_mx31()) 350 reg |= (config->bpw - 1) << MX31_CSPICTRL_BC_SHIFT;
211 reg |= (config->bpw - 1) << MX31_CSPICTRL_BC_SHIFT;
212 else if (cpu_is_mx25() || cpu_is_mx35()) {
213 reg |= (config->bpw - 1) << MX35_CSPICTRL_BL_SHIFT;
214 reg |= MX31_CSPICTRL_SSCTL;
215 }
216 351
217 if (config->mode & SPI_CPHA) 352 if (config->mode & SPI_CPHA)
218 reg |= MX31_CSPICTRL_PHA; 353 reg |= MX31_CSPICTRL_PHA;
@@ -220,23 +355,52 @@ static int mx31_config(struct spi_imx_data *spi_imx,
220 reg |= MX31_CSPICTRL_POL; 355 reg |= MX31_CSPICTRL_POL;
221 if (config->mode & SPI_CS_HIGH) 356 if (config->mode & SPI_CS_HIGH)
222 reg |= MX31_CSPICTRL_SSPOL; 357 reg |= MX31_CSPICTRL_SSPOL;
223 if (config->cs < 0) { 358 if (cs < 0)
224 if (cpu_is_mx31()) 359 reg |= (cs + 32) << MX31_CSPICTRL_CS_SHIFT;
225 reg |= (config->cs + 32) << MX31_CSPICTRL_CS_SHIFT; 360
226 else if (cpu_is_mx25() || cpu_is_mx35()) 361 writel(reg, spi_imx->base + MXC_CSPICTRL);
227 reg |= (config->cs + 32) << MX35_CSPICTRL_CS_SHIFT; 362
228 } 363 return 0;
364}
365
366static int __maybe_unused spi_imx0_7_config(struct spi_imx_data *spi_imx,
367 struct spi_imx_config *config)
368{
369 unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER;
370 int cs = spi_imx->chipselect[config->cs];
371
372 reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) <<
373 MX31_CSPICTRL_DR_SHIFT;
374
375 reg |= (config->bpw - 1) << MX35_CSPICTRL_BL_SHIFT;
376 reg |= MX31_CSPICTRL_SSCTL;
377
378 if (config->mode & SPI_CPHA)
379 reg |= MX31_CSPICTRL_PHA;
380 if (config->mode & SPI_CPOL)
381 reg |= MX31_CSPICTRL_POL;
382 if (config->mode & SPI_CS_HIGH)
383 reg |= MX31_CSPICTRL_SSPOL;
384 if (cs < 0)
385 reg |= (cs + 32) << MX35_CSPICTRL_CS_SHIFT;
229 386
230 writel(reg, spi_imx->base + MXC_CSPICTRL); 387 writel(reg, spi_imx->base + MXC_CSPICTRL);
231 388
232 return 0; 389 return 0;
233} 390}
234 391
235static int mx31_rx_available(struct spi_imx_data *spi_imx) 392static int __maybe_unused mx31_rx_available(struct spi_imx_data *spi_imx)
236{ 393{
237 return readl(spi_imx->base + MX31_CSPISTATUS) & MX31_STATUS_RR; 394 return readl(spi_imx->base + MX31_CSPISTATUS) & MX31_STATUS_RR;
238} 395}
239 396
397static void __maybe_unused spi_imx0_4_reset(struct spi_imx_data *spi_imx)
398{
399 /* drain receive buffer */
400 while (readl(spi_imx->base + MX3_CSPISTAT) & MX3_CSPISTAT_RR)
401 readl(spi_imx->base + MXC_CSPIRXDATA);
402}
403
240#define MX27_INTREG_RR (1 << 4) 404#define MX27_INTREG_RR (1 << 4)
241#define MX27_INTREG_TEEN (1 << 9) 405#define MX27_INTREG_TEEN (1 << 9)
242#define MX27_INTREG_RREN (1 << 13) 406#define MX27_INTREG_RREN (1 << 13)
@@ -250,7 +414,7 @@ static int mx31_rx_available(struct spi_imx_data *spi_imx)
250#define MX27_CSPICTRL_DR_SHIFT 14 414#define MX27_CSPICTRL_DR_SHIFT 14
251#define MX27_CSPICTRL_CS_SHIFT 19 415#define MX27_CSPICTRL_CS_SHIFT 19
252 416
253static void mx27_intctrl(struct spi_imx_data *spi_imx, int enable) 417static void __maybe_unused mx27_intctrl(struct spi_imx_data *spi_imx, int enable)
254{ 418{
255 unsigned int val = 0; 419 unsigned int val = 0;
256 420
@@ -262,7 +426,7 @@ static void mx27_intctrl(struct spi_imx_data *spi_imx, int enable)
262 writel(val, spi_imx->base + MXC_CSPIINT); 426 writel(val, spi_imx->base + MXC_CSPIINT);
263} 427}
264 428
265static void mx27_trigger(struct spi_imx_data *spi_imx) 429static void __maybe_unused mx27_trigger(struct spi_imx_data *spi_imx)
266{ 430{
267 unsigned int reg; 431 unsigned int reg;
268 432
@@ -271,10 +435,11 @@ static void mx27_trigger(struct spi_imx_data *spi_imx)
271 writel(reg, spi_imx->base + MXC_CSPICTRL); 435 writel(reg, spi_imx->base + MXC_CSPICTRL);
272} 436}
273 437
274static int mx27_config(struct spi_imx_data *spi_imx, 438static int __maybe_unused mx27_config(struct spi_imx_data *spi_imx,
275 struct spi_imx_config *config) 439 struct spi_imx_config *config)
276{ 440{
277 unsigned int reg = MX27_CSPICTRL_ENABLE | MX27_CSPICTRL_MASTER; 441 unsigned int reg = MX27_CSPICTRL_ENABLE | MX27_CSPICTRL_MASTER;
442 int cs = spi_imx->chipselect[config->cs];
278 443
279 reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, config->speed_hz) << 444 reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, config->speed_hz) <<
280 MX27_CSPICTRL_DR_SHIFT; 445 MX27_CSPICTRL_DR_SHIFT;
@@ -286,19 +451,24 @@ static int mx27_config(struct spi_imx_data *spi_imx,
286 reg |= MX27_CSPICTRL_POL; 451 reg |= MX27_CSPICTRL_POL;
287 if (config->mode & SPI_CS_HIGH) 452 if (config->mode & SPI_CS_HIGH)
288 reg |= MX27_CSPICTRL_SSPOL; 453 reg |= MX27_CSPICTRL_SSPOL;
289 if (config->cs < 0) 454 if (cs < 0)
290 reg |= (config->cs + 32) << MX27_CSPICTRL_CS_SHIFT; 455 reg |= (cs + 32) << MX27_CSPICTRL_CS_SHIFT;
291 456
292 writel(reg, spi_imx->base + MXC_CSPICTRL); 457 writel(reg, spi_imx->base + MXC_CSPICTRL);
293 458
294 return 0; 459 return 0;
295} 460}
296 461
297static int mx27_rx_available(struct spi_imx_data *spi_imx) 462static int __maybe_unused mx27_rx_available(struct spi_imx_data *spi_imx)
298{ 463{
299 return readl(spi_imx->base + MXC_CSPIINT) & MX27_INTREG_RR; 464 return readl(spi_imx->base + MXC_CSPIINT) & MX27_INTREG_RR;
300} 465}
301 466
467static void __maybe_unused spi_imx0_0_reset(struct spi_imx_data *spi_imx)
468{
469 writel(1, spi_imx->base + MXC_RESET);
470}
471
302#define MX1_INTREG_RR (1 << 3) 472#define MX1_INTREG_RR (1 << 3)
303#define MX1_INTREG_TEEN (1 << 8) 473#define MX1_INTREG_TEEN (1 << 8)
304#define MX1_INTREG_RREN (1 << 11) 474#define MX1_INTREG_RREN (1 << 11)
@@ -310,7 +480,7 @@ static int mx27_rx_available(struct spi_imx_data *spi_imx)
310#define MX1_CSPICTRL_MASTER (1 << 10) 480#define MX1_CSPICTRL_MASTER (1 << 10)
311#define MX1_CSPICTRL_DR_SHIFT 13 481#define MX1_CSPICTRL_DR_SHIFT 13
312 482
313static void mx1_intctrl(struct spi_imx_data *spi_imx, int enable) 483static void __maybe_unused mx1_intctrl(struct spi_imx_data *spi_imx, int enable)
314{ 484{
315 unsigned int val = 0; 485 unsigned int val = 0;
316 486
@@ -322,7 +492,7 @@ static void mx1_intctrl(struct spi_imx_data *spi_imx, int enable)
322 writel(val, spi_imx->base + MXC_CSPIINT); 492 writel(val, spi_imx->base + MXC_CSPIINT);
323} 493}
324 494
325static void mx1_trigger(struct spi_imx_data *spi_imx) 495static void __maybe_unused mx1_trigger(struct spi_imx_data *spi_imx)
326{ 496{
327 unsigned int reg; 497 unsigned int reg;
328 498
@@ -331,7 +501,7 @@ static void mx1_trigger(struct spi_imx_data *spi_imx)
331 writel(reg, spi_imx->base + MXC_CSPICTRL); 501 writel(reg, spi_imx->base + MXC_CSPICTRL);
332} 502}
333 503
334static int mx1_config(struct spi_imx_data *spi_imx, 504static int __maybe_unused mx1_config(struct spi_imx_data *spi_imx,
335 struct spi_imx_config *config) 505 struct spi_imx_config *config)
336{ 506{
337 unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; 507 unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER;
@@ -350,11 +520,73 @@ static int mx1_config(struct spi_imx_data *spi_imx,
350 return 0; 520 return 0;
351} 521}
352 522
353static int mx1_rx_available(struct spi_imx_data *spi_imx) 523static int __maybe_unused mx1_rx_available(struct spi_imx_data *spi_imx)
354{ 524{
355 return readl(spi_imx->base + MXC_CSPIINT) & MX1_INTREG_RR; 525 return readl(spi_imx->base + MXC_CSPIINT) & MX1_INTREG_RR;
356} 526}
357 527
528static void __maybe_unused mx1_reset(struct spi_imx_data *spi_imx)
529{
530 writel(1, spi_imx->base + MXC_RESET);
531}
532
533/*
534 * These version numbers are taken from the Freescale driver. Unfortunately it
535 * doesn't support i.MX1, so this entry doesn't match the scheme. :-(
536 */
537static struct spi_imx_devtype_data spi_imx_devtype_data[] __devinitdata = {
538#ifdef CONFIG_SPI_IMX_VER_IMX1
539 [SPI_IMX_VER_IMX1] = {
540 .intctrl = mx1_intctrl,
541 .config = mx1_config,
542 .trigger = mx1_trigger,
543 .rx_available = mx1_rx_available,
544 .reset = mx1_reset,
545 .fifosize = 8,
546 },
547#endif
548#ifdef CONFIG_SPI_IMX_VER_0_0
549 [SPI_IMX_VER_0_0] = {
550 .intctrl = mx27_intctrl,
551 .config = mx27_config,
552 .trigger = mx27_trigger,
553 .rx_available = mx27_rx_available,
554 .reset = spi_imx0_0_reset,
555 .fifosize = 8,
556 },
557#endif
558#ifdef CONFIG_SPI_IMX_VER_0_4
559 [SPI_IMX_VER_0_4] = {
560 .intctrl = mx31_intctrl,
561 .config = spi_imx0_4_config,
562 .trigger = mx31_trigger,
563 .rx_available = mx31_rx_available,
564 .reset = spi_imx0_4_reset,
565 .fifosize = 8,
566 },
567#endif
568#ifdef CONFIG_SPI_IMX_VER_0_7
569 [SPI_IMX_VER_0_7] = {
570 .intctrl = mx31_intctrl,
571 .config = spi_imx0_7_config,
572 .trigger = mx31_trigger,
573 .rx_available = mx31_rx_available,
574 .reset = spi_imx0_4_reset,
575 .fifosize = 8,
576 },
577#endif
578#ifdef CONFIG_SPI_IMX_VER_2_3
579 [SPI_IMX_VER_2_3] = {
580 .intctrl = spi_imx2_3_intctrl,
581 .config = spi_imx2_3_config,
582 .trigger = spi_imx2_3_trigger,
583 .rx_available = spi_imx2_3_rx_available,
584 .reset = spi_imx2_3_reset,
585 .fifosize = 64,
586 },
587#endif
588};
589
358static void spi_imx_chipselect(struct spi_device *spi, int is_active) 590static void spi_imx_chipselect(struct spi_device *spi, int is_active)
359{ 591{
360 struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); 592 struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master);
@@ -370,21 +602,21 @@ static void spi_imx_chipselect(struct spi_device *spi, int is_active)
370 602
371static void spi_imx_push(struct spi_imx_data *spi_imx) 603static void spi_imx_push(struct spi_imx_data *spi_imx)
372{ 604{
373 while (spi_imx->txfifo < 8) { 605 while (spi_imx->txfifo < spi_imx->devtype_data.fifosize) {
374 if (!spi_imx->count) 606 if (!spi_imx->count)
375 break; 607 break;
376 spi_imx->tx(spi_imx); 608 spi_imx->tx(spi_imx);
377 spi_imx->txfifo++; 609 spi_imx->txfifo++;
378 } 610 }
379 611
380 spi_imx->trigger(spi_imx); 612 spi_imx->devtype_data.trigger(spi_imx);
381} 613}
382 614
383static irqreturn_t spi_imx_isr(int irq, void *dev_id) 615static irqreturn_t spi_imx_isr(int irq, void *dev_id)
384{ 616{
385 struct spi_imx_data *spi_imx = dev_id; 617 struct spi_imx_data *spi_imx = dev_id;
386 618
387 while (spi_imx->rx_available(spi_imx)) { 619 while (spi_imx->devtype_data.rx_available(spi_imx)) {
388 spi_imx->rx(spi_imx); 620 spi_imx->rx(spi_imx);
389 spi_imx->txfifo--; 621 spi_imx->txfifo--;
390 } 622 }
@@ -398,11 +630,12 @@ static irqreturn_t spi_imx_isr(int irq, void *dev_id)
398 /* No data left to push, but still waiting for rx data, 630 /* No data left to push, but still waiting for rx data,
399 * enable receive data available interrupt. 631 * enable receive data available interrupt.
400 */ 632 */
401 spi_imx->intctrl(spi_imx, MXC_INT_RR); 633 spi_imx->devtype_data.intctrl(
634 spi_imx, MXC_INT_RR);
402 return IRQ_HANDLED; 635 return IRQ_HANDLED;
403 } 636 }
404 637
405 spi_imx->intctrl(spi_imx, 0); 638 spi_imx->devtype_data.intctrl(spi_imx, 0);
406 complete(&spi_imx->xfer_done); 639 complete(&spi_imx->xfer_done);
407 640
408 return IRQ_HANDLED; 641 return IRQ_HANDLED;
@@ -417,7 +650,7 @@ static int spi_imx_setupxfer(struct spi_device *spi,
417 config.bpw = t ? t->bits_per_word : spi->bits_per_word; 650 config.bpw = t ? t->bits_per_word : spi->bits_per_word;
418 config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; 651 config.speed_hz = t ? t->speed_hz : spi->max_speed_hz;
419 config.mode = spi->mode; 652 config.mode = spi->mode;
420 config.cs = spi_imx->chipselect[spi->chip_select]; 653 config.cs = spi->chip_select;
421 654
422 if (!config.speed_hz) 655 if (!config.speed_hz)
423 config.speed_hz = spi->max_speed_hz; 656 config.speed_hz = spi->max_speed_hz;
@@ -439,7 +672,7 @@ static int spi_imx_setupxfer(struct spi_device *spi,
439 } else 672 } else
440 BUG(); 673 BUG();
441 674
442 spi_imx->config(spi_imx, &config); 675 spi_imx->devtype_data.config(spi_imx, &config);
443 676
444 return 0; 677 return 0;
445} 678}
@@ -458,7 +691,7 @@ static int spi_imx_transfer(struct spi_device *spi,
458 691
459 spi_imx_push(spi_imx); 692 spi_imx_push(spi_imx);
460 693
461 spi_imx->intctrl(spi_imx, MXC_INT_TE); 694 spi_imx->devtype_data.intctrl(spi_imx, MXC_INT_TE);
462 695
463 wait_for_completion(&spi_imx->xfer_done); 696 wait_for_completion(&spi_imx->xfer_done);
464 697
@@ -485,6 +718,39 @@ static void spi_imx_cleanup(struct spi_device *spi)
485{ 718{
486} 719}
487 720
721static struct platform_device_id spi_imx_devtype[] = {
722 {
723 .name = DRIVER_NAME,
724 .driver_data = SPI_IMX_VER_AUTODETECT,
725 }, {
726 .name = "imx1-cspi",
727 .driver_data = SPI_IMX_VER_IMX1,
728 }, {
729 .name = "imx21-cspi",
730 .driver_data = SPI_IMX_VER_0_0,
731 }, {
732 .name = "imx25-cspi",
733 .driver_data = SPI_IMX_VER_0_7,
734 }, {
735 .name = "imx27-cspi",
736 .driver_data = SPI_IMX_VER_0_0,
737 }, {
738 .name = "imx31-cspi",
739 .driver_data = SPI_IMX_VER_0_4,
740 }, {
741 .name = "imx35-cspi",
742 .driver_data = SPI_IMX_VER_0_7,
743 }, {
744 .name = "imx51-cspi",
745 .driver_data = SPI_IMX_VER_0_7,
746 }, {
747 .name = "imx51-ecspi",
748 .driver_data = SPI_IMX_VER_2_3,
749 }, {
750 /* sentinel */
751 }
752};
753
488static int __devinit spi_imx_probe(struct platform_device *pdev) 754static int __devinit spi_imx_probe(struct platform_device *pdev)
489{ 755{
490 struct spi_imx_master *mxc_platform_info; 756 struct spi_imx_master *mxc_platform_info;
@@ -536,6 +802,31 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
536 802
537 init_completion(&spi_imx->xfer_done); 803 init_completion(&spi_imx->xfer_done);
538 804
805 if (pdev->id_entry->driver_data == SPI_IMX_VER_AUTODETECT) {
806 if (cpu_is_mx25() || cpu_is_mx35())
807 spi_imx->devtype_data =
808 spi_imx_devtype_data[SPI_IMX_VER_0_7];
809 else if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35())
810 spi_imx->devtype_data =
811 spi_imx_devtype_data[SPI_IMX_VER_0_4];
812 else if (cpu_is_mx27() || cpu_is_mx21())
813 spi_imx->devtype_data =
814 spi_imx_devtype_data[SPI_IMX_VER_0_0];
815 else if (cpu_is_mx1())
816 spi_imx->devtype_data =
817 spi_imx_devtype_data[SPI_IMX_VER_IMX1];
818 else
819 BUG();
820 } else
821 spi_imx->devtype_data =
822 spi_imx_devtype_data[pdev->id_entry->driver_data];
823
824 if (!spi_imx->devtype_data.intctrl) {
825 dev_err(&pdev->dev, "no support for this device compiled in\n");
826 ret = -ENODEV;
827 goto out_gpio_free;
828 }
829
539 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 830 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
540 if (!res) { 831 if (!res) {
541 dev_err(&pdev->dev, "can't get platform resource\n"); 832 dev_err(&pdev->dev, "can't get platform resource\n");
@@ -567,24 +858,6 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
567 goto out_iounmap; 858 goto out_iounmap;
568 } 859 }
569 860
570 if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35()) {
571 spi_imx->intctrl = mx31_intctrl;
572 spi_imx->config = mx31_config;
573 spi_imx->trigger = mx31_trigger;
574 spi_imx->rx_available = mx31_rx_available;
575 } else if (cpu_is_mx27() || cpu_is_mx21()) {
576 spi_imx->intctrl = mx27_intctrl;
577 spi_imx->config = mx27_config;
578 spi_imx->trigger = mx27_trigger;
579 spi_imx->rx_available = mx27_rx_available;
580 } else if (cpu_is_mx1()) {
581 spi_imx->intctrl = mx1_intctrl;
582 spi_imx->config = mx1_config;
583 spi_imx->trigger = mx1_trigger;
584 spi_imx->rx_available = mx1_rx_available;
585 } else
586 BUG();
587
588 spi_imx->clk = clk_get(&pdev->dev, NULL); 861 spi_imx->clk = clk_get(&pdev->dev, NULL);
589 if (IS_ERR(spi_imx->clk)) { 862 if (IS_ERR(spi_imx->clk)) {
590 dev_err(&pdev->dev, "unable to get clock\n"); 863 dev_err(&pdev->dev, "unable to get clock\n");
@@ -595,15 +868,9 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
595 clk_enable(spi_imx->clk); 868 clk_enable(spi_imx->clk);
596 spi_imx->spi_clk = clk_get_rate(spi_imx->clk); 869 spi_imx->spi_clk = clk_get_rate(spi_imx->clk);
597 870
598 if (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27()) 871 spi_imx->devtype_data.reset(spi_imx);
599 writel(1, spi_imx->base + MXC_RESET);
600
601 /* drain receive buffer */
602 if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35())
603 while (readl(spi_imx->base + MX3_CSPISTAT) & MX3_CSPISTAT_RR)
604 readl(spi_imx->base + MXC_CSPIRXDATA);
605 872
606 spi_imx->intctrl(spi_imx, 0); 873 spi_imx->devtype_data.intctrl(spi_imx, 0);
607 874
608 ret = spi_bitbang_start(&spi_imx->bitbang); 875 ret = spi_bitbang_start(&spi_imx->bitbang);
609 if (ret) { 876 if (ret) {
@@ -668,6 +935,7 @@ static struct platform_driver spi_imx_driver = {
668 .name = DRIVER_NAME, 935 .name = DRIVER_NAME,
669 .owner = THIS_MODULE, 936 .owner = THIS_MODULE,
670 }, 937 },
938 .id_table = spi_imx_devtype,
671 .probe = spi_imx_probe, 939 .probe = spi_imx_probe,
672 .remove = __devexit_p(spi_imx_remove), 940 .remove = __devexit_p(spi_imx_remove),
673}; 941};
diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c
index d31b57f7baaf..1dd86b835cd8 100644
--- a/drivers/spi/spi_mpc8xxx.c
+++ b/drivers/spi/spi_mpc8xxx.c
@@ -408,11 +408,17 @@ static void mpc8xxx_spi_cpm_bufs_start(struct mpc8xxx_spi *mspi)
408 408
409 xfer_ofs = mspi->xfer_in_progress->len - mspi->count; 409 xfer_ofs = mspi->xfer_in_progress->len - mspi->count;
410 410
411 out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs); 411 if (mspi->rx_dma == mspi->dma_dummy_rx)
412 out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma);
413 else
414 out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);
412 out_be16(&rx_bd->cbd_datlen, 0); 415 out_be16(&rx_bd->cbd_datlen, 0);
413 out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP); 416 out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP);
414 417
415 out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs); 418 if (mspi->tx_dma == mspi->dma_dummy_tx)
419 out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma);
420 else
421 out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);
416 out_be16(&tx_bd->cbd_datlen, xfer_len); 422 out_be16(&tx_bd->cbd_datlen, xfer_len);
417 out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP | 423 out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP |
418 BD_SC_LAST); 424 BD_SC_LAST);
diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig
index c725356cc346..de7ebb99d8f6 100644
--- a/drivers/staging/tm6000/Kconfig
+++ b/drivers/staging/tm6000/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_TM6000 1config VIDEO_TM6000
2 tristate "TV Master TM5600/6000/6010 driver" 2 tristate "TV Master TM5600/6000/6010 driver"
3 depends on VIDEO_DEV && I2C && INPUT && USB && EXPERIMENTAL 3 depends on VIDEO_DEV && I2C && INPUT && IR_CORE && USB && EXPERIMENTAL
4 select VIDEO_TUNER 4 select VIDEO_TUNER
5 select MEDIA_TUNER_XC2028 5 select MEDIA_TUNER_XC2028
6 select MEDIA_TUNER_XC5000 6 select MEDIA_TUNER_XC5000
diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c
index 32f7a0af6938..54f7667cc706 100644
--- a/drivers/staging/tm6000/tm6000-input.c
+++ b/drivers/staging/tm6000/tm6000-input.c
@@ -46,7 +46,7 @@ MODULE_PARM_DESC(enable_ir, "enable ir (default is enable");
46 } 46 }
47 47
48struct tm6000_ir_poll_result { 48struct tm6000_ir_poll_result {
49 u8 rc_data[4]; 49 u16 rc_data;
50}; 50};
51 51
52struct tm6000_IR { 52struct tm6000_IR {
@@ -60,9 +60,9 @@ struct tm6000_IR {
60 int polling; 60 int polling;
61 struct delayed_work work; 61 struct delayed_work work;
62 u8 wait:1; 62 u8 wait:1;
63 u8 key:1;
63 struct urb *int_urb; 64 struct urb *int_urb;
64 u8 *urb_data; 65 u8 *urb_data;
65 u8 key:1;
66 66
67 int (*get_key) (struct tm6000_IR *, struct tm6000_ir_poll_result *); 67 int (*get_key) (struct tm6000_IR *, struct tm6000_ir_poll_result *);
68 68
@@ -122,13 +122,14 @@ static void tm6000_ir_urb_received(struct urb *urb)
122 122
123 if (urb->status != 0) 123 if (urb->status != 0)
124 printk(KERN_INFO "not ready\n"); 124 printk(KERN_INFO "not ready\n");
125 else if (urb->actual_length > 0) 125 else if (urb->actual_length > 0) {
126 memcpy(ir->urb_data, urb->transfer_buffer, urb->actual_length); 126 memcpy(ir->urb_data, urb->transfer_buffer, urb->actual_length);
127 127
128 dprintk("data %02x %02x %02x %02x\n", ir->urb_data[0], 128 dprintk("data %02x %02x %02x %02x\n", ir->urb_data[0],
129 ir->urb_data[1], ir->urb_data[2], ir->urb_data[3]); 129 ir->urb_data[1], ir->urb_data[2], ir->urb_data[3]);
130 130
131 ir->key = 1; 131 ir->key = 1;
132 }
132 133
133 rc = usb_submit_urb(urb, GFP_ATOMIC); 134 rc = usb_submit_urb(urb, GFP_ATOMIC);
134} 135}
@@ -140,30 +141,47 @@ static int default_polling_getkey(struct tm6000_IR *ir,
140 int rc; 141 int rc;
141 u8 buf[2]; 142 u8 buf[2];
142 143
143 if (ir->wait && !&dev->int_in) { 144 if (ir->wait && !&dev->int_in)
144 poll_result->rc_data[0] = 0xff;
145 return 0; 145 return 0;
146 }
147 146
148 if (&dev->int_in) { 147 if (&dev->int_in) {
149 poll_result->rc_data[0] = ir->urb_data[0]; 148 if (ir->ir.ir_type == IR_TYPE_RC5)
150 poll_result->rc_data[1] = ir->urb_data[1]; 149 poll_result->rc_data = ir->urb_data[0];
150 else
151 poll_result->rc_data = ir->urb_data[0] | ir->urb_data[1] << 8;
151 } else { 152 } else {
152 tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 0); 153 tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 0);
153 msleep(10); 154 msleep(10);
154 tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 1); 155 tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 1);
155 msleep(10); 156 msleep(10);
156 157
157 rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | 158 if (ir->ir.ir_type == IR_TYPE_RC5) {
158 USB_RECIP_DEVICE, REQ_02_GET_IR_CODE, 0, 0, buf, 1); 159 rc = tm6000_read_write_usb(dev, USB_DIR_IN |
160 USB_TYPE_VENDOR | USB_RECIP_DEVICE,
161 REQ_02_GET_IR_CODE, 0, 0, buf, 1);
159 162
160 msleep(10); 163 msleep(10);
161 164
162 dprintk("read data=%02x\n", buf[0]); 165 dprintk("read data=%02x\n", buf[0]);
163 if (rc < 0) 166 if (rc < 0)
164 return rc; 167 return rc;
165 168
166 poll_result->rc_data[0] = buf[0]; 169 poll_result->rc_data = buf[0];
170 } else {
171 rc = tm6000_read_write_usb(dev, USB_DIR_IN |
172 USB_TYPE_VENDOR | USB_RECIP_DEVICE,
173 REQ_02_GET_IR_CODE, 0, 0, buf, 2);
174
175 msleep(10);
176
177 dprintk("read data=%04x\n", buf[0] | buf[1] << 8);
178 if (rc < 0)
179 return rc;
180
181 poll_result->rc_data = buf[0] | buf[1] << 8;
182 }
183 if ((poll_result->rc_data & 0x00ff) != 0xff)
184 ir->key = 1;
167 } 185 }
168 return 0; 186 return 0;
169} 187}
@@ -180,12 +198,11 @@ static void tm6000_ir_handle_key(struct tm6000_IR *ir)
180 return; 198 return;
181 } 199 }
182 200
183 dprintk("ir->get_key result data=%02x %02x\n", 201 dprintk("ir->get_key result data=%04x\n", poll_result.rc_data);
184 poll_result.rc_data[0], poll_result.rc_data[1]);
185 202
186 if (poll_result.rc_data[0] != 0xff && ir->key == 1) { 203 if (ir->key) {
187 ir_input_keydown(ir->input->input_dev, &ir->ir, 204 ir_input_keydown(ir->input->input_dev, &ir->ir,
188 poll_result.rc_data[0] | poll_result.rc_data[1] << 8); 205 (u32)poll_result.rc_data);
189 206
190 ir_input_nokey(ir->input->input_dev, &ir->ir); 207 ir_input_nokey(ir->input->input_dev, &ir->ir);
191 ir->key = 0; 208 ir->key = 0;
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 418163894775..afef7b0a4195 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -24,6 +24,7 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <mach/ohci.h> 26#include <mach/ohci.h>
27#include <mach/pxa3xx-u2d.h>
27 28
28/* 29/*
29 * UHC: USB Host Controller (OHCI-like) register definitions 30 * UHC: USB Host Controller (OHCI-like) register definitions
@@ -235,6 +236,9 @@ static int pxa27x_start_hc(struct pxa27x_ohci *ohci, struct device *dev)
235 if (retval < 0) 236 if (retval < 0)
236 return retval; 237 return retval;
237 238
239 if (cpu_is_pxa3xx())
240 pxa3xx_u2d_start_hc(&ohci_to_hcd(&ohci->ohci)->self);
241
238 uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE; 242 uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE;
239 __raw_writel(uhchr, ohci->mmio_base + UHCHR); 243 __raw_writel(uhchr, ohci->mmio_base + UHCHR);
240 __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE); 244 __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE);
@@ -251,6 +255,9 @@ static void pxa27x_stop_hc(struct pxa27x_ohci *ohci, struct device *dev)
251 255
252 inf = dev->platform_data; 256 inf = dev->platform_data;
253 257
258 if (cpu_is_pxa3xx())
259 pxa3xx_u2d_stop_hc(&ohci_to_hcd(&ohci->ohci)->self);
260
254 if (inf->exit) 261 if (inf->exit)
255 inf->exit(dev); 262 inf->exit(dev);
256 263
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c
index a31a77ff6f3d..cea6403ae71c 100644
--- a/drivers/video/pxa168fb.c
+++ b/drivers/video/pxa168fb.c
@@ -784,12 +784,53 @@ failed:
784 return ret; 784 return ret;
785} 785}
786 786
787static int __devexit pxa168fb_remove(struct platform_device *pdev)
788{
789 struct pxa168fb_info *fbi = platform_get_drvdata(pdev);
790 struct fb_info *info;
791 int irq;
792 unsigned int data;
793
794 if (!fbi)
795 return 0;
796
797 /* disable DMA transfer */
798 data = readl(fbi->reg_base + LCD_SPU_DMA_CTRL0);
799 data &= ~CFG_GRA_ENA_MASK;
800 writel(data, fbi->reg_base + LCD_SPU_DMA_CTRL0);
801
802 info = fbi->info;
803
804 unregister_framebuffer(info);
805
806 writel(GRA_FRAME_IRQ0_ENA(0x0), fbi->reg_base + SPU_IRQ_ENA);
807
808 if (info->cmap.len)
809 fb_dealloc_cmap(&info->cmap);
810
811 irq = platform_get_irq(pdev, 0);
812 free_irq(irq, fbi);
813
814 dma_free_writecombine(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
815 info->screen_base, info->fix.smem_start);
816
817 iounmap(fbi->reg_base);
818
819 clk_disable(fbi->clk);
820 clk_put(fbi->clk);
821
822 framebuffer_release(info);
823
824 return 0;
825}
826
787static struct platform_driver pxa168fb_driver = { 827static struct platform_driver pxa168fb_driver = {
788 .driver = { 828 .driver = {
789 .name = "pxa168-fb", 829 .name = "pxa168-fb",
790 .owner = THIS_MODULE, 830 .owner = THIS_MODULE,
791 }, 831 },
792 .probe = pxa168fb_probe, 832 .probe = pxa168fb_probe,
833 .remove = __devexit_p(pxa168fb_remove),
793}; 834};
794 835
795static int __init pxa168fb_init(void) 836static int __init pxa168fb_init(void)
@@ -798,6 +839,12 @@ static int __init pxa168fb_init(void)
798} 839}
799module_init(pxa168fb_init); 840module_init(pxa168fb_init);
800 841
842static void __exit pxa168fb_exit(void)
843{
844 platform_driver_unregister(&pxa168fb_driver);
845}
846module_exit(pxa168fb_exit);
847
801MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> " 848MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> "
802 "Green Wan <gwan@marvell.com>"); 849 "Green Wan <gwan@marvell.com>");
803MODULE_DESCRIPTION("Framebuffer driver for PXA168/910"); 850MODULE_DESCRIPTION("Framebuffer driver for PXA168/910");
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 29bac5118877..d409495876f1 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -755,7 +755,10 @@ int register_xenstore_notifier(struct notifier_block *nb)
755{ 755{
756 int ret = 0; 756 int ret = 0;
757 757
758 blocking_notifier_chain_register(&xenstore_chain, nb); 758 if (xenstored_ready > 0)
759 ret = nb->notifier_call(nb, 0, NULL);
760 else
761 blocking_notifier_chain_register(&xenstore_chain, nb);
759 762
760 return ret; 763 return ret;
761} 764}
@@ -769,7 +772,7 @@ EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
769 772
770void xenbus_probe(struct work_struct *unused) 773void xenbus_probe(struct work_struct *unused)
771{ 774{
772 BUG_ON((xenstored_ready <= 0)); 775 xenstored_ready = 1;
773 776
774 /* Enumerate devices in xenstore and watch for changes. */ 777 /* Enumerate devices in xenstore and watch for changes. */
775 xenbus_probe_devices(&xenbus_frontend); 778 xenbus_probe_devices(&xenbus_frontend);
@@ -835,8 +838,8 @@ static int __init xenbus_init(void)
835 xen_store_evtchn = xen_start_info->store_evtchn; 838 xen_store_evtchn = xen_start_info->store_evtchn;
836 xen_store_mfn = xen_start_info->store_mfn; 839 xen_store_mfn = xen_start_info->store_mfn;
837 xen_store_interface = mfn_to_virt(xen_store_mfn); 840 xen_store_interface = mfn_to_virt(xen_store_mfn);
841 xenstored_ready = 1;
838 } 842 }
839 xenstored_ready = 1;
840 } 843 }
841 844
842 /* Initialize the interface to xenstore. */ 845 /* Initialize the interface to xenstore. */
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index f96eff04e11a..a6395bdb26ae 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -134,10 +134,6 @@ static int aout_core_dump(struct coredump_params *cprm)
134 if (!dump_write(file, dump_start, dump_size)) 134 if (!dump_write(file, dump_start, dump_size))
135 goto end_coredump; 135 goto end_coredump;
136 } 136 }
137/* Finally dump the task struct. Not be used by gdb, but could be useful */
138 set_fs(KERNEL_DS);
139 if (!dump_write(file, current, sizeof(*current)))
140 goto end_coredump;
141end_coredump: 137end_coredump:
142 set_fs(fs); 138 set_fs(fs);
143 return has_dumped; 139 return has_dumped;
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 73c153092f72..5e9da996a151 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2283,7 +2283,8 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
2283{ 2283{
2284 struct ceph_inode_info *ci = ceph_inode(inode); 2284 struct ceph_inode_info *ci = ceph_inode(inode);
2285 int mds = session->s_mds; 2285 int mds = session->s_mds;
2286 int seq = le32_to_cpu(grant->seq); 2286 unsigned seq = le32_to_cpu(grant->seq);
2287 unsigned issue_seq = le32_to_cpu(grant->issue_seq);
2287 int newcaps = le32_to_cpu(grant->caps); 2288 int newcaps = le32_to_cpu(grant->caps);
2288 int issued, implemented, used, wanted, dirty; 2289 int issued, implemented, used, wanted, dirty;
2289 u64 size = le64_to_cpu(grant->size); 2290 u64 size = le64_to_cpu(grant->size);
@@ -2295,8 +2296,8 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
2295 int revoked_rdcache = 0; 2296 int revoked_rdcache = 0;
2296 int queue_invalidate = 0; 2297 int queue_invalidate = 0;
2297 2298
2298 dout("handle_cap_grant inode %p cap %p mds%d seq %d %s\n", 2299 dout("handle_cap_grant inode %p cap %p mds%d seq %u/%u %s\n",
2299 inode, cap, mds, seq, ceph_cap_string(newcaps)); 2300 inode, cap, mds, seq, issue_seq, ceph_cap_string(newcaps));
2300 dout(" size %llu max_size %llu, i_size %llu\n", size, max_size, 2301 dout(" size %llu max_size %llu, i_size %llu\n", size, max_size,
2301 inode->i_size); 2302 inode->i_size);
2302 2303
@@ -2392,6 +2393,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
2392 } 2393 }
2393 2394
2394 cap->seq = seq; 2395 cap->seq = seq;
2396 cap->issue_seq = issue_seq;
2395 2397
2396 /* file layout may have changed */ 2398 /* file layout may have changed */
2397 ci->i_layout = grant->layout; 2399 ci->i_layout = grant->layout;
@@ -2774,15 +2776,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2774 if (op == CEPH_CAP_OP_IMPORT) 2776 if (op == CEPH_CAP_OP_IMPORT)
2775 __queue_cap_release(session, vino.ino, cap_id, 2777 __queue_cap_release(session, vino.ino, cap_id,
2776 mseq, seq); 2778 mseq, seq);
2777 2779 goto flush_cap_releases;
2778 /*
2779 * send any full release message to try to move things
2780 * along for the mds (who clearly thinks we still have this
2781 * cap).
2782 */
2783 ceph_add_cap_releases(mdsc, session);
2784 ceph_send_cap_releases(mdsc, session);
2785 goto done;
2786 } 2780 }
2787 2781
2788 /* these will work even if we don't have a cap yet */ 2782 /* these will work even if we don't have a cap yet */
@@ -2810,7 +2804,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2810 dout(" no cap on %p ino %llx.%llx from mds%d\n", 2804 dout(" no cap on %p ino %llx.%llx from mds%d\n",
2811 inode, ceph_ino(inode), ceph_snap(inode), mds); 2805 inode, ceph_ino(inode), ceph_snap(inode), mds);
2812 spin_unlock(&inode->i_lock); 2806 spin_unlock(&inode->i_lock);
2813 goto done; 2807 goto flush_cap_releases;
2814 } 2808 }
2815 2809
2816 /* note that each of these drops i_lock for us */ 2810 /* note that each of these drops i_lock for us */
@@ -2834,6 +2828,17 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2834 ceph_cap_op_name(op)); 2828 ceph_cap_op_name(op));
2835 } 2829 }
2836 2830
2831 goto done;
2832
2833flush_cap_releases:
2834 /*
2835 * send any full release message to try to move things
2836 * along for the mds (who clearly thinks we still have this
2837 * cap).
2838 */
2839 ceph_add_cap_releases(mdsc, session);
2840 ceph_send_cap_releases(mdsc, session);
2841
2837done: 2842done:
2838 mutex_unlock(&session->s_mutex); 2843 mutex_unlock(&session->s_mutex);
2839done_unlocked: 2844done_unlocked:
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 4480cb1c63e7..e38423e82f2e 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -42,32 +42,37 @@ struct ceph_nfs_confh {
42static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, 42static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
43 int connectable) 43 int connectable)
44{ 44{
45 int type;
45 struct ceph_nfs_fh *fh = (void *)rawfh; 46 struct ceph_nfs_fh *fh = (void *)rawfh;
46 struct ceph_nfs_confh *cfh = (void *)rawfh; 47 struct ceph_nfs_confh *cfh = (void *)rawfh;
47 struct dentry *parent = dentry->d_parent; 48 struct dentry *parent = dentry->d_parent;
48 struct inode *inode = dentry->d_inode; 49 struct inode *inode = dentry->d_inode;
49 int type; 50 int connected_handle_length = sizeof(*cfh)/4;
51 int handle_length = sizeof(*fh)/4;
50 52
51 /* don't re-export snaps */ 53 /* don't re-export snaps */
52 if (ceph_snap(inode) != CEPH_NOSNAP) 54 if (ceph_snap(inode) != CEPH_NOSNAP)
53 return -EINVAL; 55 return -EINVAL;
54 56
55 if (*max_len >= sizeof(*cfh)) { 57 if (*max_len >= connected_handle_length) {
56 dout("encode_fh %p connectable\n", dentry); 58 dout("encode_fh %p connectable\n", dentry);
57 cfh->ino = ceph_ino(dentry->d_inode); 59 cfh->ino = ceph_ino(dentry->d_inode);
58 cfh->parent_ino = ceph_ino(parent->d_inode); 60 cfh->parent_ino = ceph_ino(parent->d_inode);
59 cfh->parent_name_hash = parent->d_name.hash; 61 cfh->parent_name_hash = parent->d_name.hash;
60 *max_len = sizeof(*cfh); 62 *max_len = connected_handle_length;
61 type = 2; 63 type = 2;
62 } else if (*max_len > sizeof(*fh)) { 64 } else if (*max_len >= handle_length) {
63 if (connectable) 65 if (connectable) {
64 return -ENOSPC; 66 *max_len = connected_handle_length;
67 return 255;
68 }
65 dout("encode_fh %p\n", dentry); 69 dout("encode_fh %p\n", dentry);
66 fh->ino = ceph_ino(dentry->d_inode); 70 fh->ino = ceph_ino(dentry->d_inode);
67 *max_len = sizeof(*fh); 71 *max_len = handle_length;
68 type = 1; 72 type = 1;
69 } else { 73 } else {
70 return -ENOSPC; 74 *max_len = handle_length;
75 return 255;
71 } 76 }
72 return type; 77 return type;
73} 78}
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 8c044a4f0457..66e4da6dba22 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -697,7 +697,7 @@ more:
697 * start_request so that a tid has been assigned. 697 * start_request so that a tid has been assigned.
698 */ 698 */
699 spin_lock(&ci->i_unsafe_lock); 699 spin_lock(&ci->i_unsafe_lock);
700 list_add(&ci->i_unsafe_writes, &req->r_unsafe_item); 700 list_add(&req->r_unsafe_item, &ci->i_unsafe_writes);
701 spin_unlock(&ci->i_unsafe_lock); 701 spin_unlock(&ci->i_unsafe_lock);
702 ceph_get_cap_refs(ci, CEPH_CAP_FILE_WR); 702 ceph_get_cap_refs(ci, CEPH_CAP_FILE_WR);
703 } 703 }
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index dfced1dacbcd..3b5571b8ce22 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -549,7 +549,7 @@ static void __unregister_request(struct ceph_osd_client *osdc,
549 */ 549 */
550static void __cancel_request(struct ceph_osd_request *req) 550static void __cancel_request(struct ceph_osd_request *req)
551{ 551{
552 if (req->r_sent) { 552 if (req->r_sent && req->r_osd) {
553 ceph_con_revoke(&req->r_osd->o_con, req->r_request); 553 ceph_con_revoke(&req->r_osd->o_con, req->r_request);
554 req->r_sent = 0; 554 req->r_sent = 0;
555 } 555 }
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index c65c3419dd37..7e83b356cc9e 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -232,7 +232,7 @@ static int
232small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, 232small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
233 void **request_buf) 233 void **request_buf)
234{ 234{
235 int rc = 0; 235 int rc;
236 236
237 rc = cifs_reconnect_tcon(tcon, smb_command); 237 rc = cifs_reconnect_tcon(tcon, smb_command);
238 if (rc) 238 if (rc)
@@ -250,7 +250,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
250 if (tcon != NULL) 250 if (tcon != NULL)
251 cifs_stats_inc(&tcon->num_smbs_sent); 251 cifs_stats_inc(&tcon->num_smbs_sent);
252 252
253 return rc; 253 return 0;
254} 254}
255 255
256int 256int
@@ -281,16 +281,9 @@ small_smb_init_no_tc(const int smb_command, const int wct,
281 281
282/* If the return code is zero, this function must fill in request_buf pointer */ 282/* If the return code is zero, this function must fill in request_buf pointer */
283static int 283static int
284smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, 284__smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
285 void **request_buf /* returned */ , 285 void **request_buf, void **response_buf)
286 void **response_buf /* returned */ )
287{ 286{
288 int rc = 0;
289
290 rc = cifs_reconnect_tcon(tcon, smb_command);
291 if (rc)
292 return rc;
293
294 *request_buf = cifs_buf_get(); 287 *request_buf = cifs_buf_get();
295 if (*request_buf == NULL) { 288 if (*request_buf == NULL) {
296 /* BB should we add a retry in here if not a writepage? */ 289 /* BB should we add a retry in here if not a writepage? */
@@ -309,7 +302,31 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
309 if (tcon != NULL) 302 if (tcon != NULL)
310 cifs_stats_inc(&tcon->num_smbs_sent); 303 cifs_stats_inc(&tcon->num_smbs_sent);
311 304
312 return rc; 305 return 0;
306}
307
308/* If the return code is zero, this function must fill in request_buf pointer */
309static int
310smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
311 void **request_buf, void **response_buf)
312{
313 int rc;
314
315 rc = cifs_reconnect_tcon(tcon, smb_command);
316 if (rc)
317 return rc;
318
319 return __smb_init(smb_command, wct, tcon, request_buf, response_buf);
320}
321
322static int
323smb_init_no_reconnect(int smb_command, int wct, struct cifsTconInfo *tcon,
324 void **request_buf, void **response_buf)
325{
326 if (tcon->ses->need_reconnect || tcon->need_reconnect)
327 return -EHOSTDOWN;
328
329 return __smb_init(smb_command, wct, tcon, request_buf, response_buf);
313} 330}
314 331
315static int validate_t2(struct smb_t2_rsp *pSMB) 332static int validate_t2(struct smb_t2_rsp *pSMB)
@@ -4534,8 +4551,8 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon)
4534 4551
4535 cFYI(1, "In QFSUnixInfo"); 4552 cFYI(1, "In QFSUnixInfo");
4536QFSUnixRetry: 4553QFSUnixRetry:
4537 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, 4554 rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, tcon,
4538 (void **) &pSMBr); 4555 (void **) &pSMB, (void **) &pSMBr);
4539 if (rc) 4556 if (rc)
4540 return rc; 4557 return rc;
4541 4558
@@ -4604,8 +4621,8 @@ CIFSSMBSetFSUnixInfo(const int xid, struct cifsTconInfo *tcon, __u64 cap)
4604 cFYI(1, "In SETFSUnixInfo"); 4621 cFYI(1, "In SETFSUnixInfo");
4605SETFSUnixRetry: 4622SETFSUnixRetry:
4606 /* BB switch to small buf init to save memory */ 4623 /* BB switch to small buf init to save memory */
4607 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, 4624 rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, tcon,
4608 (void **) &pSMBr); 4625 (void **) &pSMB, (void **) &pSMBr);
4609 if (rc) 4626 if (rc)
4610 return rc; 4627 return rc;
4611 4628
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 93f77d438d3c..53cce8cc2224 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -801,6 +801,8 @@ retry_iget5_locked:
801 inode->i_flags |= S_NOATIME | S_NOCMTIME; 801 inode->i_flags |= S_NOATIME | S_NOCMTIME;
802 if (inode->i_state & I_NEW) { 802 if (inode->i_state & I_NEW) {
803 inode->i_ino = hash; 803 inode->i_ino = hash;
804 if (S_ISREG(inode->i_mode))
805 inode->i_data.backing_dev_info = sb->s_bdi;
804#ifdef CONFIG_CIFS_FSCACHE 806#ifdef CONFIG_CIFS_FSCACHE
805 /* initialize per-inode cache cookie pointer */ 807 /* initialize per-inode cache cookie pointer */
806 CIFS_I(inode)->fscache = NULL; 808 CIFS_I(inode)->fscache = NULL;
diff --git a/fs/exec.c b/fs/exec.c
index 828dd2461d6b..03278c984ba0 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -2014,3 +2014,41 @@ fail_creds:
2014fail: 2014fail:
2015 return; 2015 return;
2016} 2016}
2017
2018/*
2019 * Core dumping helper functions. These are the only things you should
2020 * do on a core-file: use only these functions to write out all the
2021 * necessary info.
2022 */
2023int dump_write(struct file *file, const void *addr, int nr)
2024{
2025 return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr;
2026}
2027
2028int dump_seek(struct file *file, loff_t off)
2029{
2030 int ret = 1;
2031
2032 if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
2033 if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
2034 return 0;
2035 } else {
2036 char *buf = (char *)get_zeroed_page(GFP_KERNEL);
2037
2038 if (!buf)
2039 return 0;
2040 while (off > 0) {
2041 unsigned long n = off;
2042
2043 if (n > PAGE_SIZE)
2044 n = PAGE_SIZE;
2045 if (!dump_write(file, buf, n)) {
2046 ret = 0;
2047 break;
2048 }
2049 off -= n;
2050 }
2051 free_page((unsigned long)buf);
2052 }
2053 return ret;
2054}
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index eb7368ebd8cd..3eadd97324b1 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -54,6 +54,9 @@ struct page_collect {
54 unsigned nr_pages; 54 unsigned nr_pages;
55 unsigned long length; 55 unsigned long length;
56 loff_t pg_first; /* keep 64bit also in 32-arches */ 56 loff_t pg_first; /* keep 64bit also in 32-arches */
57 bool read_4_write; /* This means two things: that the read is sync
58 * And the pages should not be unlocked.
59 */
57}; 60};
58 61
59static void _pcol_init(struct page_collect *pcol, unsigned expected_pages, 62static void _pcol_init(struct page_collect *pcol, unsigned expected_pages,
@@ -71,6 +74,7 @@ static void _pcol_init(struct page_collect *pcol, unsigned expected_pages,
71 pcol->nr_pages = 0; 74 pcol->nr_pages = 0;
72 pcol->length = 0; 75 pcol->length = 0;
73 pcol->pg_first = -1; 76 pcol->pg_first = -1;
77 pcol->read_4_write = false;
74} 78}
75 79
76static void _pcol_reset(struct page_collect *pcol) 80static void _pcol_reset(struct page_collect *pcol)
@@ -347,7 +351,8 @@ static int readpage_strip(void *data, struct page *page)
347 if (PageError(page)) 351 if (PageError(page))
348 ClearPageError(page); 352 ClearPageError(page);
349 353
350 unlock_page(page); 354 if (!pcol->read_4_write)
355 unlock_page(page);
351 EXOFS_DBGMSG("readpage_strip(0x%lx, 0x%lx) empty page," 356 EXOFS_DBGMSG("readpage_strip(0x%lx, 0x%lx) empty page,"
352 " splitting\n", inode->i_ino, page->index); 357 " splitting\n", inode->i_ino, page->index);
353 358
@@ -428,6 +433,7 @@ static int _readpage(struct page *page, bool is_sync)
428 /* readpage_strip might call read_exec(,is_sync==false) at several 433 /* readpage_strip might call read_exec(,is_sync==false) at several
429 * places but not if we have a single page. 434 * places but not if we have a single page.
430 */ 435 */
436 pcol.read_4_write = is_sync;
431 ret = readpage_strip(&pcol, page); 437 ret = readpage_strip(&pcol, page);
432 if (ret) { 438 if (ret) {
433 EXOFS_ERR("_readpage => %d\n", ret); 439 EXOFS_ERR("_readpage => %d\n", ret);
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 5581122bd2c0..ab38fef1c9a1 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -72,22 +72,11 @@ int writeback_in_progress(struct backing_dev_info *bdi)
72static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) 72static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
73{ 73{
74 struct super_block *sb = inode->i_sb; 74 struct super_block *sb = inode->i_sb;
75 struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info;
76 75
77 /* 76 if (strcmp(sb->s_type->name, "bdev") == 0)
78 * For inodes on standard filesystems, we use superblock's bdi. For 77 return inode->i_mapping->backing_dev_info;
79 * inodes on virtual filesystems, we want to use inode mapping's bdi 78
80 * because they can possibly point to something useful (think about 79 return sb->s_bdi;
81 * block_dev filesystem).
82 */
83 if (sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) {
84 /* Some device inodes could play dirty tricks. Catch them... */
85 WARN(bdi != sb->s_bdi && bdi_cap_writeback_dirty(bdi),
86 "Dirtiable inode bdi %s != sb bdi %s\n",
87 bdi->name, sb->s_bdi->name);
88 return sb->s_bdi;
89 }
90 return bdi;
91} 80}
92 81
93static void bdi_queue_work(struct backing_dev_info *bdi, 82static void bdi_queue_work(struct backing_dev_info *bdi,
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index d367af1514ef..cde755cca564 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1354,7 +1354,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
1354 loff_t file_size; 1354 loff_t file_size;
1355 unsigned int num; 1355 unsigned int num;
1356 unsigned int offset; 1356 unsigned int offset;
1357 size_t total_len; 1357 size_t total_len = 0;
1358 1358
1359 req = fuse_get_req(fc); 1359 req = fuse_get_req(fc);
1360 if (IS_ERR(req)) 1360 if (IS_ERR(req))
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
index cdfb8c6a4206..c16f8d8331b5 100644
--- a/fs/nfsd/nfsfh.h
+++ b/fs/nfsd/nfsfh.h
@@ -196,8 +196,6 @@ fh_lock(struct svc_fh *fhp)
196static inline void 196static inline void
197fh_unlock(struct svc_fh *fhp) 197fh_unlock(struct svc_fh *fhp)
198{ 198{
199 BUG_ON(!fhp->fh_dentry);
200
201 if (fhp->fh_locked) { 199 if (fhp->fh_locked) {
202 fill_post_wcc(fhp); 200 fill_post_wcc(fhp);
203 mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); 201 mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex);
diff --git a/fs/notify/Kconfig b/fs/notify/Kconfig
index 22c629eedd82..b388443c3a09 100644
--- a/fs/notify/Kconfig
+++ b/fs/notify/Kconfig
@@ -3,4 +3,4 @@ config FSNOTIFY
3 3
4source "fs/notify/dnotify/Kconfig" 4source "fs/notify/dnotify/Kconfig"
5source "fs/notify/inotify/Kconfig" 5source "fs/notify/inotify/Kconfig"
6source "fs/notify/fanotify/Kconfig" 6#source "fs/notify/fanotify/Kconfig"
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index 32499d213fc4..9975457c981f 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -128,7 +128,7 @@ static void *ocfs2_fast_follow_link(struct dentry *dentry,
128 } 128 }
129 129
130 /* Fast symlinks can't be large */ 130 /* Fast symlinks can't be large */
131 len = strlen(target); 131 len = strnlen(target, ocfs2_fast_symlink_chars(inode->i_sb));
132 link = kzalloc(len + 1, GFP_NOFS); 132 link = kzalloc(len + 1, GFP_NOFS);
133 if (!link) { 133 if (!link) {
134 status = -ENOMEM; 134 status = -ENOMEM;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a1c43e7c8a7b..8e4addaa5424 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2675,7 +2675,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2675 INF("auxv", S_IRUSR, proc_pid_auxv), 2675 INF("auxv", S_IRUSR, proc_pid_auxv),
2676 ONE("status", S_IRUGO, proc_pid_status), 2676 ONE("status", S_IRUGO, proc_pid_status),
2677 ONE("personality", S_IRUSR, proc_pid_personality), 2677 ONE("personality", S_IRUSR, proc_pid_personality),
2678 INF("limits", S_IRUSR, proc_pid_limits), 2678 INF("limits", S_IRUGO, proc_pid_limits),
2679#ifdef CONFIG_SCHED_DEBUG 2679#ifdef CONFIG_SCHED_DEBUG
2680 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations), 2680 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
2681#endif 2681#endif
@@ -3011,7 +3011,7 @@ static const struct pid_entry tid_base_stuff[] = {
3011 INF("auxv", S_IRUSR, proc_pid_auxv), 3011 INF("auxv", S_IRUSR, proc_pid_auxv),
3012 ONE("status", S_IRUGO, proc_pid_status), 3012 ONE("status", S_IRUGO, proc_pid_status),
3013 ONE("personality", S_IRUSR, proc_pid_personality), 3013 ONE("personality", S_IRUSR, proc_pid_personality),
3014 INF("limits", S_IRUSR, proc_pid_limits), 3014 INF("limits", S_IRUGO, proc_pid_limits),
3015#ifdef CONFIG_SCHED_DEBUG 3015#ifdef CONFIG_SCHED_DEBUG
3016 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations), 3016 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
3017#endif 3017#endif
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index f53505de0712..5cbb81e134ac 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -170,6 +170,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
170int reiserfs_unpack(struct inode *inode, struct file *filp) 170int reiserfs_unpack(struct inode *inode, struct file *filp)
171{ 171{
172 int retval = 0; 172 int retval = 0;
173 int depth;
173 int index; 174 int index;
174 struct page *page; 175 struct page *page;
175 struct address_space *mapping; 176 struct address_space *mapping;
@@ -188,8 +189,8 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
188 /* we need to make sure nobody is changing the file size beneath 189 /* we need to make sure nobody is changing the file size beneath
189 ** us 190 ** us
190 */ 191 */
191 mutex_lock(&inode->i_mutex); 192 reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb);
192 reiserfs_write_lock(inode->i_sb); 193 depth = reiserfs_write_lock_once(inode->i_sb);
193 194
194 write_from = inode->i_size & (blocksize - 1); 195 write_from = inode->i_size & (blocksize - 1);
195 /* if we are on a block boundary, we are already unpacked. */ 196 /* if we are on a block boundary, we are already unpacked. */
@@ -224,6 +225,6 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
224 225
225 out: 226 out:
226 mutex_unlock(&inode->i_mutex); 227 mutex_unlock(&inode->i_mutex);
227 reiserfs_write_unlock(inode->i_sb); 228 reiserfs_write_unlock_once(inode->i_sb, depth);
228 return retval; 229 return retval;
229} 230}
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index d59c4a65d492..81976ffed7d6 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -668,14 +668,11 @@ xfs_inode_set_reclaim_tag(
668 xfs_perag_put(pag); 668 xfs_perag_put(pag);
669} 669}
670 670
671void 671STATIC void
672__xfs_inode_clear_reclaim_tag( 672__xfs_inode_clear_reclaim(
673 xfs_mount_t *mp,
674 xfs_perag_t *pag, 673 xfs_perag_t *pag,
675 xfs_inode_t *ip) 674 xfs_inode_t *ip)
676{ 675{
677 radix_tree_tag_clear(&pag->pag_ici_root,
678 XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG);
679 pag->pag_ici_reclaimable--; 676 pag->pag_ici_reclaimable--;
680 if (!pag->pag_ici_reclaimable) { 677 if (!pag->pag_ici_reclaimable) {
681 /* clear the reclaim tag from the perag radix tree */ 678 /* clear the reclaim tag from the perag radix tree */
@@ -689,6 +686,17 @@ __xfs_inode_clear_reclaim_tag(
689 } 686 }
690} 687}
691 688
689void
690__xfs_inode_clear_reclaim_tag(
691 xfs_mount_t *mp,
692 xfs_perag_t *pag,
693 xfs_inode_t *ip)
694{
695 radix_tree_tag_clear(&pag->pag_ici_root,
696 XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG);
697 __xfs_inode_clear_reclaim(pag, ip);
698}
699
692/* 700/*
693 * Inodes in different states need to be treated differently, and the return 701 * Inodes in different states need to be treated differently, and the return
694 * value of xfs_iflush is not sufficient to get this right. The following table 702 * value of xfs_iflush is not sufficient to get this right. The following table
@@ -838,6 +846,7 @@ reclaim:
838 if (!radix_tree_delete(&pag->pag_ici_root, 846 if (!radix_tree_delete(&pag->pag_ici_root,
839 XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino))) 847 XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino)))
840 ASSERT(0); 848 ASSERT(0);
849 __xfs_inode_clear_reclaim(pag, ip);
841 write_unlock(&pag->pag_ici_lock); 850 write_unlock(&pag->pag_ici_lock);
842 851
843 /* 852 /*
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index ed575fb4b495..7e206fc1fa36 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -405,9 +405,15 @@ xlog_cil_push(
405 new_ctx = kmem_zalloc(sizeof(*new_ctx), KM_SLEEP|KM_NOFS); 405 new_ctx = kmem_zalloc(sizeof(*new_ctx), KM_SLEEP|KM_NOFS);
406 new_ctx->ticket = xlog_cil_ticket_alloc(log); 406 new_ctx->ticket = xlog_cil_ticket_alloc(log);
407 407
408 /* lock out transaction commit, but don't block on background push */ 408 /*
409 * Lock out transaction commit, but don't block for background pushes
410 * unless we are well over the CIL space limit. See the definition of
411 * XLOG_CIL_HARD_SPACE_LIMIT() for the full explanation of the logic
412 * used here.
413 */
409 if (!down_write_trylock(&cil->xc_ctx_lock)) { 414 if (!down_write_trylock(&cil->xc_ctx_lock)) {
410 if (!push_seq) 415 if (!push_seq &&
416 cil->xc_ctx->space_used < XLOG_CIL_HARD_SPACE_LIMIT(log))
411 goto out_free_ticket; 417 goto out_free_ticket;
412 down_write(&cil->xc_ctx_lock); 418 down_write(&cil->xc_ctx_lock);
413 } 419 }
@@ -422,7 +428,7 @@ xlog_cil_push(
422 goto out_skip; 428 goto out_skip;
423 429
424 /* check for a previously pushed seqeunce */ 430 /* check for a previously pushed seqeunce */
425 if (push_seq < cil->xc_ctx->sequence) 431 if (push_seq && push_seq < cil->xc_ctx->sequence)
426 goto out_skip; 432 goto out_skip;
427 433
428 /* 434 /*
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index ced52b98b322..edcdfe01617f 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -426,13 +426,13 @@ struct xfs_cil {
426}; 426};
427 427
428/* 428/*
429 * The amount of log space we should the CIL to aggregate is difficult to size. 429 * The amount of log space we allow the CIL to aggregate is difficult to size.
430 * Whatever we chose we have to make we can get a reservation for the log space 430 * Whatever we choose, we have to make sure we can get a reservation for the
431 * effectively, that it is large enough to capture sufficient relogging to 431 * log space effectively, that it is large enough to capture sufficient
432 * reduce log buffer IO significantly, but it is not too large for the log or 432 * relogging to reduce log buffer IO significantly, but it is not too large for
433 * induces too much latency when writing out through the iclogs. We track both 433 * the log or induces too much latency when writing out through the iclogs. We
434 * space consumed and the number of vectors in the checkpoint context, so we 434 * track both space consumed and the number of vectors in the checkpoint
435 * need to decide which to use for limiting. 435 * context, so we need to decide which to use for limiting.
436 * 436 *
437 * Every log buffer we write out during a push needs a header reserved, which 437 * Every log buffer we write out during a push needs a header reserved, which
438 * is at least one sector and more for v2 logs. Hence we need a reservation of 438 * is at least one sector and more for v2 logs. Hence we need a reservation of
@@ -459,16 +459,21 @@ struct xfs_cil {
459 * checkpoint transaction ticket is specific to the checkpoint context, rather 459 * checkpoint transaction ticket is specific to the checkpoint context, rather
460 * than the CIL itself. 460 * than the CIL itself.
461 * 461 *
462 * With dynamic reservations, we can basically make up arbitrary limits for the 462 * With dynamic reservations, we can effectively make up arbitrary limits for
463 * checkpoint size so long as they don't violate any other size rules. Hence 463 * the checkpoint size so long as they don't violate any other size rules.
464 * the initial maximum size for the checkpoint transaction will be set to a 464 * Recovery imposes a rule that no transaction exceed half the log, so we are
465 * quarter of the log or 8MB, which ever is smaller. 8MB is an arbitrary limit 465 * limited by that. Furthermore, the log transaction reservation subsystem
466 * right now based on the latency of writing out a large amount of data through 466 * tries to keep 25% of the log free, so we need to keep below that limit or we
467 * the circular iclog buffers. 467 * risk running out of free log space to start any new transactions.
468 *
469 * In order to keep background CIL push efficient, we will set a lower
470 * threshold at which background pushing is attempted without blocking current
471 * transaction commits. A separate, higher bound defines when CIL pushes are
472 * enforced to ensure we stay within our maximum checkpoint size bounds.
473 * threshold, yet give us plenty of space for aggregation on large logs.
468 */ 474 */
469 475#define XLOG_CIL_SPACE_LIMIT(log) (log->l_logsize >> 3)
470#define XLOG_CIL_SPACE_LIMIT(log) \ 476#define XLOG_CIL_HARD_SPACE_LIMIT(log) (3 * (log->l_logsize >> 4))
471 (min((log->l_logsize >> 2), (8 * 1024 * 1024)))
472 477
473/* 478/*
474 * The reservation head lsn is not made up of a cycle number and block number. 479 * The reservation head lsn is not made up of a cycle number and block number.
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index c0786d446a00..984cdc62e30b 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -55,7 +55,7 @@
55extern u8 acpi_gbl_permanent_mmap; 55extern u8 acpi_gbl_permanent_mmap;
56 56
57/* 57/*
58 * Globals that are publically available, allowing for 58 * Globals that are publicly available, allowing for
59 * run time configuration 59 * run time configuration
60 */ 60 */
61extern u32 acpi_dbg_level; 61extern u32 acpi_dbg_level;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7809d230adee..4c9461a4f9e6 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -612,7 +612,7 @@ struct drm_gem_object {
612 struct kref refcount; 612 struct kref refcount;
613 613
614 /** Handle count of this object. Each handle also holds a reference */ 614 /** Handle count of this object. Each handle also holds a reference */
615 struct kref handlecount; 615 atomic_t handle_count; /* number of handles on this object */
616 616
617 /** Related drm device */ 617 /** Related drm device */
618 struct drm_device *dev; 618 struct drm_device *dev;
@@ -808,7 +808,6 @@ struct drm_driver {
808 */ 808 */
809 int (*gem_init_object) (struct drm_gem_object *obj); 809 int (*gem_init_object) (struct drm_gem_object *obj);
810 void (*gem_free_object) (struct drm_gem_object *obj); 810 void (*gem_free_object) (struct drm_gem_object *obj);
811 void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
812 811
813 /* vga arb irq handler */ 812 /* vga arb irq handler */
814 void (*vgaarb_irq)(struct drm_device *dev, bool state); 813 void (*vgaarb_irq)(struct drm_device *dev, bool state);
@@ -1175,6 +1174,7 @@ extern int drm_release(struct inode *inode, struct file *filp);
1175extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1174extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1176extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1175extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1177extern void drm_vm_open_locked(struct vm_area_struct *vma); 1176extern void drm_vm_open_locked(struct vm_area_struct *vma);
1177extern void drm_vm_close_locked(struct vm_area_struct *vma);
1178extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map); 1178extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
1179extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev); 1179extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
1180extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1180extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
@@ -1455,12 +1455,11 @@ int drm_gem_init(struct drm_device *dev);
1455void drm_gem_destroy(struct drm_device *dev); 1455void drm_gem_destroy(struct drm_device *dev);
1456void drm_gem_object_release(struct drm_gem_object *obj); 1456void drm_gem_object_release(struct drm_gem_object *obj);
1457void drm_gem_object_free(struct kref *kref); 1457void drm_gem_object_free(struct kref *kref);
1458void drm_gem_object_free_unlocked(struct kref *kref);
1459struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1458struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1460 size_t size); 1459 size_t size);
1461int drm_gem_object_init(struct drm_device *dev, 1460int drm_gem_object_init(struct drm_device *dev,
1462 struct drm_gem_object *obj, size_t size); 1461 struct drm_gem_object *obj, size_t size);
1463void drm_gem_object_handle_free(struct kref *kref); 1462void drm_gem_object_handle_free(struct drm_gem_object *obj);
1464void drm_gem_vm_open(struct vm_area_struct *vma); 1463void drm_gem_vm_open(struct vm_area_struct *vma);
1465void drm_gem_vm_close(struct vm_area_struct *vma); 1464void drm_gem_vm_close(struct vm_area_struct *vma);
1466int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1465int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
@@ -1483,8 +1482,12 @@ drm_gem_object_unreference(struct drm_gem_object *obj)
1483static inline void 1482static inline void
1484drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) 1483drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1485{ 1484{
1486 if (obj != NULL) 1485 if (obj != NULL) {
1487 kref_put(&obj->refcount, drm_gem_object_free_unlocked); 1486 struct drm_device *dev = obj->dev;
1487 mutex_lock(&dev->struct_mutex);
1488 kref_put(&obj->refcount, drm_gem_object_free);
1489 mutex_unlock(&dev->struct_mutex);
1490 }
1488} 1491}
1489 1492
1490int drm_gem_handle_create(struct drm_file *file_priv, 1493int drm_gem_handle_create(struct drm_file *file_priv,
@@ -1495,7 +1498,7 @@ static inline void
1495drm_gem_object_handle_reference(struct drm_gem_object *obj) 1498drm_gem_object_handle_reference(struct drm_gem_object *obj)
1496{ 1499{
1497 drm_gem_object_reference(obj); 1500 drm_gem_object_reference(obj);
1498 kref_get(&obj->handlecount); 1501 atomic_inc(&obj->handle_count);
1499} 1502}
1500 1503
1501static inline void 1504static inline void
@@ -1504,12 +1507,15 @@ drm_gem_object_handle_unreference(struct drm_gem_object *obj)
1504 if (obj == NULL) 1507 if (obj == NULL)
1505 return; 1508 return;
1506 1509
1510 if (atomic_read(&obj->handle_count) == 0)
1511 return;
1507 /* 1512 /*
1508 * Must bump handle count first as this may be the last 1513 * Must bump handle count first as this may be the last
1509 * ref, in which case the object would disappear before we 1514 * ref, in which case the object would disappear before we
1510 * checked for a name 1515 * checked for a name
1511 */ 1516 */
1512 kref_put(&obj->handlecount, drm_gem_object_handle_free); 1517 if (atomic_dec_and_test(&obj->handle_count))
1518 drm_gem_object_handle_free(obj);
1513 drm_gem_object_unreference(obj); 1519 drm_gem_object_unreference(obj);
1514} 1520}
1515 1521
@@ -1519,12 +1525,17 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
1519 if (obj == NULL) 1525 if (obj == NULL)
1520 return; 1526 return;
1521 1527
1528 if (atomic_read(&obj->handle_count) == 0)
1529 return;
1530
1522 /* 1531 /*
1523 * Must bump handle count first as this may be the last 1532 * Must bump handle count first as this may be the last
1524 * ref, in which case the object would disappear before we 1533 * ref, in which case the object would disappear before we
1525 * checked for a name 1534 * checked for a name
1526 */ 1535 */
1527 kref_put(&obj->handlecount, drm_gem_object_handle_free); 1536
1537 if (atomic_dec_and_test(&obj->handle_count))
1538 drm_gem_object_handle_free(obj);
1528 drm_gem_object_unreference_unlocked(obj); 1539 drm_gem_object_unreference_unlocked(obj);
1529} 1540}
1530 1541
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 3a9940ef728b..883c1d439899 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -85,7 +85,6 @@
85 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 85 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
86 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 86 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
87 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 87 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
88 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
89 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \ 88 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
90 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \ 89 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
91 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \ 90 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
@@ -103,6 +102,7 @@
103 {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 102 {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
104 {0x1002, 0x5652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 103 {0x1002, 0x5652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
105 {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 104 {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
105 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
106 {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \ 106 {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \
107 {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 107 {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
108 {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ 108 {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 267a86c74e2e..2040e6c4f172 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -246,9 +246,11 @@ struct ttm_buffer_object {
246 246
247 atomic_t reserved; 247 atomic_t reserved;
248 248
249
250 /** 249 /**
251 * Members protected by the bo::lock 250 * Members protected by the bo::lock
251 * In addition, setting sync_obj to anything else
252 * than NULL requires bo::reserved to be held. This allows for
253 * checking NULL while reserved but not holding bo::lock.
252 */ 254 */
253 255
254 void *sync_obj_arg; 256 void *sync_obj_arg;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 626b629429ff..4e8ea8c8ec1e 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -118,7 +118,6 @@ header-y += eventpoll.h
118header-y += ext2_fs.h 118header-y += ext2_fs.h
119header-y += fadvise.h 119header-y += fadvise.h
120header-y += falloc.h 120header-y += falloc.h
121header-y += fanotify.h
122header-y += fb.h 121header-y += fb.h
123header-y += fcntl.h 122header-y += fcntl.h
124header-y += fd.h 123header-y += fd.h
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index 8ba66a9d9022..ba4b85a6d9b8 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -9,37 +9,7 @@
9 * These are the only things you should do on a core-file: use only these 9 * These are the only things you should do on a core-file: use only these
10 * functions to write out all the necessary info. 10 * functions to write out all the necessary info.
11 */ 11 */
12static inline int dump_write(struct file *file, const void *addr, int nr) 12extern int dump_write(struct file *file, const void *addr, int nr);
13{ 13extern int dump_seek(struct file *file, loff_t off);
14 return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
15}
16
17static inline int dump_seek(struct file *file, loff_t off)
18{
19 int ret = 1;
20
21 if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
22 if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
23 return 0;
24 } else {
25 char *buf = (char *)get_zeroed_page(GFP_KERNEL);
26
27 if (!buf)
28 return 0;
29 while (off > 0) {
30 unsigned long n = off;
31
32 if (n > PAGE_SIZE)
33 n = PAGE_SIZE;
34 if (!dump_write(file, buf, n)) {
35 ret = 0;
36 break;
37 }
38 off -= n;
39 }
40 free_page((unsigned long)buf);
41 }
42 return ret;
43}
44 14
45#endif /* _LINUX_COREDUMP_H */ 15#endif /* _LINUX_COREDUMP_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 36ca9721a0c2..1be416bbbb82 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -53,6 +53,7 @@ struct cpuidle_state {
53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */ 53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */
54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */ 54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */
55#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */ 55#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */
56#define CPUIDLE_FLAG_TLB_FLUSHED (0x200) /* tlb will be flushed */
56 57
57#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 58#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
58 59
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index c61d4ca27bcc..e2106495cc11 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -548,7 +548,7 @@ static inline bool dma_dev_has_pq_continue(struct dma_device *dma)
548 return (dma->max_pq & DMA_HAS_PQ_CONTINUE) == DMA_HAS_PQ_CONTINUE; 548 return (dma->max_pq & DMA_HAS_PQ_CONTINUE) == DMA_HAS_PQ_CONTINUE;
549} 549}
550 550
551static unsigned short dma_dev_to_maxpq(struct dma_device *dma) 551static inline unsigned short dma_dev_to_maxpq(struct dma_device *dma)
552{ 552{
553 return dma->max_pq & ~DMA_HAS_PQ_CONTINUE; 553 return dma->max_pq & ~DMA_HAS_PQ_CONTINUE;
554} 554}
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 926b50322a46..4fd978e7eb83 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -93,6 +93,7 @@ struct elevator_queue
93 struct elevator_type *elevator_type; 93 struct elevator_type *elevator_type;
94 struct mutex sysfs_lock; 94 struct mutex sysfs_lock;
95 struct hlist_head *hash; 95 struct hlist_head *hash;
96 unsigned int registered:1;
96}; 97};
97 98
98/* 99/*
diff --git a/include/linux/module.h b/include/linux/module.h
index 8a6b9fdc7ffa..aace066bad8f 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -686,17 +686,16 @@ extern int module_sysfs_initialized;
686 686
687 687
688#ifdef CONFIG_GENERIC_BUG 688#ifdef CONFIG_GENERIC_BUG
689int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *, 689void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
690 struct module *); 690 struct module *);
691void module_bug_cleanup(struct module *); 691void module_bug_cleanup(struct module *);
692 692
693#else /* !CONFIG_GENERIC_BUG */ 693#else /* !CONFIG_GENERIC_BUG */
694 694
695static inline int module_bug_finalize(const Elf_Ehdr *hdr, 695static inline void module_bug_finalize(const Elf_Ehdr *hdr,
696 const Elf_Shdr *sechdrs, 696 const Elf_Shdr *sechdrs,
697 struct module *mod) 697 struct module *mod)
698{ 698{
699 return 0;
700} 699}
701static inline void module_bug_cleanup(struct module *mod) {} 700static inline void module_bug_cleanup(struct module *mod) {}
702#endif /* CONFIG_GENERIC_BUG */ 701#endif /* CONFIG_GENERIC_BUG */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 9fbc54a2585d..83af1f8d8b74 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -454,7 +454,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
454 * Makes rcu_dereference_check() do the dirty work. 454 * Makes rcu_dereference_check() do the dirty work.
455 */ 455 */
456#define rcu_dereference_bh(p) \ 456#define rcu_dereference_bh(p) \
457 rcu_dereference_check(p, rcu_read_lock_bh_held()) 457 rcu_dereference_check(p, rcu_read_lock_bh_held() || irqs_disabled())
458 458
459/** 459/**
460 * rcu_dereference_sched - fetch RCU-protected pointer, checking for RCU-sched 460 * rcu_dereference_sched - fetch RCU-protected pointer, checking for RCU-sched
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 0836ccc57121..3efc9f3f43a0 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -614,6 +614,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
614 (wait)->private = current; \ 614 (wait)->private = current; \
615 (wait)->func = autoremove_wake_function; \ 615 (wait)->func = autoremove_wake_function; \
616 INIT_LIST_HEAD(&(wait)->task_list); \ 616 INIT_LIST_HEAD(&(wait)->task_list); \
617 (wait)->flags = 0; \
617 } while (0) 618 } while (0)
618 619
619/** 620/**
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index 97e07f46a0fa..aa4ebb42a565 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -48,6 +48,7 @@ struct videobuf_dmabuf {
48 48
49 /* for userland buffer */ 49 /* for userland buffer */
50 int offset; 50 int offset;
51 size_t size;
51 struct page **pages; 52 struct page **pages;
52 53
53 /* for kernel buffers */ 54 /* for kernel buffers */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 27a902d9b3a9..30fce0128dd7 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -161,12 +161,30 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l
161{ 161{
162 struct sk_buff *skb; 162 struct sk_buff *skb;
163 163
164 release_sock(sk);
164 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { 165 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) {
165 skb_reserve(skb, BT_SKB_RESERVE); 166 skb_reserve(skb, BT_SKB_RESERVE);
166 bt_cb(skb)->incoming = 0; 167 bt_cb(skb)->incoming = 0;
167 } 168 }
169 lock_sock(sk);
170
171 if (!skb && *err)
172 return NULL;
173
174 *err = sock_error(sk);
175 if (*err)
176 goto out;
177
178 if (sk->sk_shutdown) {
179 *err = -ECONNRESET;
180 goto out;
181 }
168 182
169 return skb; 183 return skb;
184
185out:
186 kfree_skb(skb);
187 return NULL;
170} 188}
171 189
172int bt_err(__u16 code); 190int bt_err(__u16 code);
diff --git a/ipc/sem.c b/ipc/sem.c
index 40a8f462a822..0e0d49bbb867 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -743,6 +743,8 @@ static unsigned long copy_semid_to_user(void __user *buf, struct semid64_ds *in,
743 { 743 {
744 struct semid_ds out; 744 struct semid_ds out;
745 745
746 memset(&out, 0, sizeof(out));
747
746 ipc64_perm_to_ipc_perm(&in->sem_perm, &out.sem_perm); 748 ipc64_perm_to_ipc_perm(&in->sem_perm, &out.sem_perm);
747 749
748 out.sem_otime = in->sem_otime; 750 out.sem_otime = in->sem_otime;
diff --git a/kernel/kfifo.c b/kernel/kfifo.c
index 6b5580c57644..01a0700e873f 100644
--- a/kernel/kfifo.c
+++ b/kernel/kfifo.c
@@ -365,8 +365,6 @@ static unsigned int setup_sgl(struct __kfifo *fifo, struct scatterlist *sgl,
365 n = setup_sgl_buf(sgl, fifo->data + off, nents, l); 365 n = setup_sgl_buf(sgl, fifo->data + off, nents, l);
366 n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - l); 366 n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - l);
367 367
368 if (n)
369 sg_mark_end(sgl + n - 1);
370 return n; 368 return n;
371} 369}
372 370
diff --git a/kernel/module.c b/kernel/module.c
index d0b5f8db11b4..ccd641991842 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1537,6 +1537,7 @@ static int __unlink_module(void *_mod)
1537{ 1537{
1538 struct module *mod = _mod; 1538 struct module *mod = _mod;
1539 list_del(&mod->list); 1539 list_del(&mod->list);
1540 module_bug_cleanup(mod);
1540 return 0; 1541 return 0;
1541} 1542}
1542 1543
@@ -2625,6 +2626,7 @@ static struct module *load_module(void __user *umod,
2625 if (err < 0) 2626 if (err < 0)
2626 goto ddebug; 2627 goto ddebug;
2627 2628
2629 module_bug_finalize(info.hdr, info.sechdrs, mod);
2628 list_add_rcu(&mod->list, &modules); 2630 list_add_rcu(&mod->list, &modules);
2629 mutex_unlock(&module_mutex); 2631 mutex_unlock(&module_mutex);
2630 2632
@@ -2650,6 +2652,8 @@ static struct module *load_module(void __user *umod,
2650 mutex_lock(&module_mutex); 2652 mutex_lock(&module_mutex);
2651 /* Unlink carefully: kallsyms could be walking list. */ 2653 /* Unlink carefully: kallsyms could be walking list. */
2652 list_del_rcu(&mod->list); 2654 list_del_rcu(&mod->list);
2655 module_bug_cleanup(mod);
2656
2653 ddebug: 2657 ddebug:
2654 if (!mod->taints) 2658 if (!mod->taints)
2655 dynamic_debug_remove(info.debug); 2659 dynamic_debug_remove(info.debug);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index db5b56064687..b98bed3d8182 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2202,15 +2202,13 @@ static void perf_event_for_each(struct perf_event *event,
2202static int perf_event_period(struct perf_event *event, u64 __user *arg) 2202static int perf_event_period(struct perf_event *event, u64 __user *arg)
2203{ 2203{
2204 struct perf_event_context *ctx = event->ctx; 2204 struct perf_event_context *ctx = event->ctx;
2205 unsigned long size;
2206 int ret = 0; 2205 int ret = 0;
2207 u64 value; 2206 u64 value;
2208 2207
2209 if (!event->attr.sample_period) 2208 if (!event->attr.sample_period)
2210 return -EINVAL; 2209 return -EINVAL;
2211 2210
2212 size = copy_from_user(&value, arg, sizeof(value)); 2211 if (copy_from_user(&value, arg, sizeof(value)))
2213 if (size != sizeof(value))
2214 return -EFAULT; 2212 return -EFAULT;
2215 2213
2216 if (!value) 2214 if (!value)
diff --git a/kernel/signal.c b/kernel/signal.c
index bded65187780..919562c3d6b7 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2215,6 +2215,14 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
2215#ifdef __ARCH_SI_TRAPNO 2215#ifdef __ARCH_SI_TRAPNO
2216 err |= __put_user(from->si_trapno, &to->si_trapno); 2216 err |= __put_user(from->si_trapno, &to->si_trapno);
2217#endif 2217#endif
2218#ifdef BUS_MCEERR_AO
2219 /*
2220 * Other callers might not initialize the si_lsb field,
2221 * so check explicitely for the right codes here.
2222 */
2223 if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
2224 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
2225#endif
2218 break; 2226 break;
2219 case __SI_CHLD: 2227 case __SI_CHLD:
2220 err |= __put_user(from->si_pid, &to->si_pid); 2228 err |= __put_user(from->si_pid, &to->si_pid);
diff --git a/kernel/smp.c b/kernel/smp.c
index 75c970c715d3..ed6aacfcb7ef 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -365,9 +365,10 @@ call:
365EXPORT_SYMBOL_GPL(smp_call_function_any); 365EXPORT_SYMBOL_GPL(smp_call_function_any);
366 366
367/** 367/**
368 * __smp_call_function_single(): Run a function on another CPU 368 * __smp_call_function_single(): Run a function on a specific CPU
369 * @cpu: The CPU to run on. 369 * @cpu: The CPU to run on.
370 * @data: Pre-allocated and setup data structure 370 * @data: Pre-allocated and setup data structure
371 * @wait: If true, wait until function has completed on specified CPU.
371 * 372 *
372 * Like smp_call_function_single(), but allow caller to pass in a 373 * Like smp_call_function_single(), but allow caller to pass in a
373 * pre-allocated data structure. Useful for embedding @data inside 374 * pre-allocated data structure. Useful for embedding @data inside
@@ -376,8 +377,10 @@ EXPORT_SYMBOL_GPL(smp_call_function_any);
376void __smp_call_function_single(int cpu, struct call_single_data *data, 377void __smp_call_function_single(int cpu, struct call_single_data *data,
377 int wait) 378 int wait)
378{ 379{
379 csd_lock(data); 380 unsigned int this_cpu;
381 unsigned long flags;
380 382
383 this_cpu = get_cpu();
381 /* 384 /*
382 * Can deadlock when called with interrupts disabled. 385 * Can deadlock when called with interrupts disabled.
383 * We allow cpu's that are not yet online though, as no one else can 386 * We allow cpu's that are not yet online though, as no one else can
@@ -387,7 +390,15 @@ void __smp_call_function_single(int cpu, struct call_single_data *data,
387 WARN_ON_ONCE(cpu_online(smp_processor_id()) && wait && irqs_disabled() 390 WARN_ON_ONCE(cpu_online(smp_processor_id()) && wait && irqs_disabled()
388 && !oops_in_progress); 391 && !oops_in_progress);
389 392
390 generic_exec_single(cpu, data, wait); 393 if (cpu == this_cpu) {
394 local_irq_save(flags);
395 data->func(data->info);
396 local_irq_restore(flags);
397 } else {
398 csd_lock(data);
399 generic_exec_single(cpu, data, wait);
400 }
401 put_cpu();
391} 402}
392 403
393/** 404/**
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f88552c6d227..3a45c224770f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2485,7 +2485,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
2485 kbuf[left] = 0; 2485 kbuf[left] = 0;
2486 } 2486 }
2487 2487
2488 for (; left && vleft--; i++, min++, max++, first=0) { 2488 for (; left && vleft--; i++, first = 0) {
2489 unsigned long val; 2489 unsigned long val;
2490 2490
2491 if (write) { 2491 if (write) {
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 492197e2f86c..bca96377fd4e 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -405,7 +405,7 @@ static inline int test_time_stamp(u64 delta)
405#define BUF_MAX_DATA_SIZE (BUF_PAGE_SIZE - (sizeof(u32) * 2)) 405#define BUF_MAX_DATA_SIZE (BUF_PAGE_SIZE - (sizeof(u32) * 2))
406 406
407/* Max number of timestamps that can fit on a page */ 407/* Max number of timestamps that can fit on a page */
408#define RB_TIMESTAMPS_PER_PAGE (BUF_PAGE_SIZE / RB_LEN_TIME_STAMP) 408#define RB_TIMESTAMPS_PER_PAGE (BUF_PAGE_SIZE / RB_LEN_TIME_EXTEND)
409 409
410int ring_buffer_print_page_header(struct trace_seq *s) 410int ring_buffer_print_page_header(struct trace_seq *s)
411{ 411{
diff --git a/lib/bug.c b/lib/bug.c
index 7cdfad88128f..19552096d16b 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -72,8 +72,8 @@ static const struct bug_entry *module_find_bug(unsigned long bugaddr)
72 return NULL; 72 return NULL;
73} 73}
74 74
75int module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, 75void module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
76 struct module *mod) 76 struct module *mod)
77{ 77{
78 char *secstrings; 78 char *secstrings;
79 unsigned int i; 79 unsigned int i;
@@ -97,8 +97,6 @@ int module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
97 * could potentially lead to deadlock and thus be counter-productive. 97 * could potentially lead to deadlock and thus be counter-productive.
98 */ 98 */
99 list_add(&mod->bug_list, &module_bug_list); 99 list_add(&mod->bug_list, &module_bug_list);
100
101 return 0;
102} 100}
103 101
104void module_bug_cleanup(struct module *mod) 102void module_bug_cleanup(struct module *mod)
diff --git a/lib/list_sort.c b/lib/list_sort.c
index 4b5cb794c38b..a7616fa3162e 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -70,7 +70,7 @@ static void merge_and_restore_back_links(void *priv,
70 * element comparison is needed, so the client's cmp() 70 * element comparison is needed, so the client's cmp()
71 * routine can invoke cond_resched() periodically. 71 * routine can invoke cond_resched() periodically.
72 */ 72 */
73 (*cmp)(priv, tail, tail); 73 (*cmp)(priv, tail->next, tail->next);
74 74
75 tail->next->prev = tail; 75 tail->next->prev = tail;
76 tail = tail->next; 76 tail = tail->next;
diff --git a/mm/ksm.c b/mm/ksm.c
index b1873cf03ed9..65ab5c7067d9 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -712,7 +712,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
712 if (!ptep) 712 if (!ptep)
713 goto out; 713 goto out;
714 714
715 if (pte_write(*ptep)) { 715 if (pte_write(*ptep) || pte_dirty(*ptep)) {
716 pte_t entry; 716 pte_t entry;
717 717
718 swapped = PageSwapCache(page); 718 swapped = PageSwapCache(page);
@@ -735,7 +735,9 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
735 set_pte_at(mm, addr, ptep, entry); 735 set_pte_at(mm, addr, ptep, entry);
736 goto out_unlock; 736 goto out_unlock;
737 } 737 }
738 entry = pte_wrprotect(entry); 738 if (pte_dirty(entry))
739 set_page_dirty(page);
740 entry = pte_mkclean(pte_wrprotect(entry));
739 set_pte_at_notify(mm, addr, ptep, entry); 741 set_pte_at_notify(mm, addr, ptep, entry);
740 } 742 }
741 *orig_pte = *ptep; 743 *orig_pte = *ptep;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3eed583895a6..9be3cf8a5da4 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3587,9 +3587,13 @@ unlock:
3587 3587
3588static void mem_cgroup_threshold(struct mem_cgroup *memcg) 3588static void mem_cgroup_threshold(struct mem_cgroup *memcg)
3589{ 3589{
3590 __mem_cgroup_threshold(memcg, false); 3590 while (memcg) {
3591 if (do_swap_account) 3591 __mem_cgroup_threshold(memcg, false);
3592 __mem_cgroup_threshold(memcg, true); 3592 if (do_swap_account)
3593 __mem_cgroup_threshold(memcg, true);
3594
3595 memcg = parent_mem_cgroup(memcg);
3596 }
3593} 3597}
3594 3598
3595static int compare_thresholds(const void *a, const void *b) 3599static int compare_thresholds(const void *a, const void *b)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 9c26eeca1342..757f6b0accfe 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -183,7 +183,7 @@ EXPORT_SYMBOL_GPL(hwpoison_filter);
183 * signal. 183 * signal.
184 */ 184 */
185static int kill_proc_ao(struct task_struct *t, unsigned long addr, int trapno, 185static int kill_proc_ao(struct task_struct *t, unsigned long addr, int trapno,
186 unsigned long pfn) 186 unsigned long pfn, struct page *page)
187{ 187{
188 struct siginfo si; 188 struct siginfo si;
189 int ret; 189 int ret;
@@ -198,7 +198,7 @@ static int kill_proc_ao(struct task_struct *t, unsigned long addr, int trapno,
198#ifdef __ARCH_SI_TRAPNO 198#ifdef __ARCH_SI_TRAPNO
199 si.si_trapno = trapno; 199 si.si_trapno = trapno;
200#endif 200#endif
201 si.si_addr_lsb = PAGE_SHIFT; 201 si.si_addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT;
202 /* 202 /*
203 * Don't use force here, it's convenient if the signal 203 * Don't use force here, it's convenient if the signal
204 * can be temporarily blocked. 204 * can be temporarily blocked.
@@ -235,7 +235,7 @@ void shake_page(struct page *p, int access)
235 int nr; 235 int nr;
236 do { 236 do {
237 nr = shrink_slab(1000, GFP_KERNEL, 1000); 237 nr = shrink_slab(1000, GFP_KERNEL, 1000);
238 if (page_count(p) == 0) 238 if (page_count(p) == 1)
239 break; 239 break;
240 } while (nr > 10); 240 } while (nr > 10);
241 } 241 }
@@ -327,7 +327,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p,
327 * wrong earlier. 327 * wrong earlier.
328 */ 328 */
329static void kill_procs_ao(struct list_head *to_kill, int doit, int trapno, 329static void kill_procs_ao(struct list_head *to_kill, int doit, int trapno,
330 int fail, unsigned long pfn) 330 int fail, struct page *page, unsigned long pfn)
331{ 331{
332 struct to_kill *tk, *next; 332 struct to_kill *tk, *next;
333 333
@@ -352,7 +352,7 @@ static void kill_procs_ao(struct list_head *to_kill, int doit, int trapno,
352 * process anyways. 352 * process anyways.
353 */ 353 */
354 else if (kill_proc_ao(tk->tsk, tk->addr, trapno, 354 else if (kill_proc_ao(tk->tsk, tk->addr, trapno,
355 pfn) < 0) 355 pfn, page) < 0)
356 printk(KERN_ERR 356 printk(KERN_ERR
357 "MCE %#lx: Cannot send advisory machine check signal to %s:%d\n", 357 "MCE %#lx: Cannot send advisory machine check signal to %s:%d\n",
358 pfn, tk->tsk->comm, tk->tsk->pid); 358 pfn, tk->tsk->comm, tk->tsk->pid);
@@ -928,7 +928,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
928 * any accesses to the poisoned memory. 928 * any accesses to the poisoned memory.
929 */ 929 */
930 kill_procs_ao(&tokill, !!PageDirty(hpage), trapno, 930 kill_procs_ao(&tokill, !!PageDirty(hpage), trapno,
931 ret != SWAP_SUCCESS, pfn); 931 ret != SWAP_SUCCESS, p, pfn);
932 932
933 return ret; 933 return ret;
934} 934}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a8cfa9cc6e86..f12ad1836abe 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5182,9 +5182,9 @@ void *__init alloc_large_system_hash(const char *tablename,
5182 if (!table) 5182 if (!table)
5183 panic("Failed to allocate %s hash table\n", tablename); 5183 panic("Failed to allocate %s hash table\n", tablename);
5184 5184
5185 printk(KERN_INFO "%s hash table entries: %d (order: %d, %lu bytes)\n", 5185 printk(KERN_INFO "%s hash table entries: %ld (order: %d, %lu bytes)\n",
5186 tablename, 5186 tablename,
5187 (1U << log2qty), 5187 (1UL << log2qty),
5188 ilog2(size) - PAGE_SHIFT, 5188 ilog2(size) - PAGE_SHIFT,
5189 size); 5189 size);
5190 5190
diff --git a/mm/rmap.c b/mm/rmap.c
index 9d2ba01bd4f9..92e6757f196e 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -381,7 +381,13 @@ vma_address(struct page *page, struct vm_area_struct *vma)
381unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma) 381unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
382{ 382{
383 if (PageAnon(page)) { 383 if (PageAnon(page)) {
384 if (vma->anon_vma->root != page_anon_vma(page)->root) 384 struct anon_vma *page__anon_vma = page_anon_vma(page);
385 /*
386 * Note: swapoff's unuse_vma() is more efficient with this
387 * check, and needs it to match anon_vma when KSM is active.
388 */
389 if (!vma->anon_vma || !page__anon_vma ||
390 vma->anon_vma->root != page__anon_vma->root)
385 return -EFAULT; 391 return -EFAULT;
386 } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) { 392 } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) {
387 if (!vma->vm_file || 393 if (!vma->vm_file ||
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 01ddb0472f86..0eb96f7e44be 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -24,8 +24,11 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
24 24
25 if (vlan_dev) 25 if (vlan_dev)
26 skb->dev = vlan_dev; 26 skb->dev = vlan_dev;
27 else if (vlan_id) 27 else if (vlan_id) {
28 goto drop; 28 if (!(skb->dev->flags & IFF_PROMISC))
29 goto drop;
30 skb->pkt_type = PACKET_OTHERHOST;
31 }
29 32
30 return (polling ? netif_receive_skb(skb) : netif_rx(skb)); 33 return (polling ? netif_receive_skb(skb) : netif_rx(skb));
31 34
@@ -102,8 +105,11 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
102 105
103 if (vlan_dev) 106 if (vlan_dev)
104 skb->dev = vlan_dev; 107 skb->dev = vlan_dev;
105 else if (vlan_id) 108 else if (vlan_id) {
106 goto drop; 109 if (!(skb->dev->flags & IFF_PROMISC))
110 goto drop;
111 skb->pkt_type = PACKET_OTHERHOST;
112 }
107 113
108 for (p = napi->gro_list; p; p = p->next) { 114 for (p = napi->gro_list; p; p = p->next) {
109 NAPI_GRO_CB(p)->same_flow = 115 NAPI_GRO_CB(p)->same_flow =
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 622b471e14e0..74bcc662c3dd 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -778,7 +778,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
778 eg->packets_rcvd++; 778 eg->packets_rcvd++;
779 mpc->eg_ops->put(eg); 779 mpc->eg_ops->put(eg);
780 780
781 memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); 781 memset(ATM_SKB(new_skb), 0, sizeof(struct atm_skb_data));
782 netif_rx(new_skb); 782 netif_rx(new_skb);
783} 783}
784 784
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index fadf26b4ed7c..0b54b7dd8401 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1441,33 +1441,23 @@ static inline void l2cap_do_send(struct sock *sk, struct sk_buff *skb)
1441 1441
1442static void l2cap_streaming_send(struct sock *sk) 1442static void l2cap_streaming_send(struct sock *sk)
1443{ 1443{
1444 struct sk_buff *skb, *tx_skb; 1444 struct sk_buff *skb;
1445 struct l2cap_pinfo *pi = l2cap_pi(sk); 1445 struct l2cap_pinfo *pi = l2cap_pi(sk);
1446 u16 control, fcs; 1446 u16 control, fcs;
1447 1447
1448 while ((skb = sk->sk_send_head)) { 1448 while ((skb = skb_dequeue(TX_QUEUE(sk)))) {
1449 tx_skb = skb_clone(skb, GFP_ATOMIC); 1449 control = get_unaligned_le16(skb->data + L2CAP_HDR_SIZE);
1450
1451 control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE);
1452 control |= pi->next_tx_seq << L2CAP_CTRL_TXSEQ_SHIFT; 1450 control |= pi->next_tx_seq << L2CAP_CTRL_TXSEQ_SHIFT;
1453 put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE); 1451 put_unaligned_le16(control, skb->data + L2CAP_HDR_SIZE);
1454 1452
1455 if (pi->fcs == L2CAP_FCS_CRC16) { 1453 if (pi->fcs == L2CAP_FCS_CRC16) {
1456 fcs = crc16(0, (u8 *)tx_skb->data, tx_skb->len - 2); 1454 fcs = crc16(0, (u8 *)skb->data, skb->len - 2);
1457 put_unaligned_le16(fcs, tx_skb->data + tx_skb->len - 2); 1455 put_unaligned_le16(fcs, skb->data + skb->len - 2);
1458 } 1456 }
1459 1457
1460 l2cap_do_send(sk, tx_skb); 1458 l2cap_do_send(sk, skb);
1461 1459
1462 pi->next_tx_seq = (pi->next_tx_seq + 1) % 64; 1460 pi->next_tx_seq = (pi->next_tx_seq + 1) % 64;
1463
1464 if (skb_queue_is_last(TX_QUEUE(sk), skb))
1465 sk->sk_send_head = NULL;
1466 else
1467 sk->sk_send_head = skb_queue_next(TX_QUEUE(sk), skb);
1468
1469 skb = skb_dequeue(TX_QUEUE(sk));
1470 kfree_skb(skb);
1471 } 1461 }
1472} 1462}
1473 1463
@@ -1960,6 +1950,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
1960 1950
1961 switch (optname) { 1951 switch (optname) {
1962 case L2CAP_OPTIONS: 1952 case L2CAP_OPTIONS:
1953 if (sk->sk_state == BT_CONNECTED) {
1954 err = -EINVAL;
1955 break;
1956 }
1957
1963 opts.imtu = l2cap_pi(sk)->imtu; 1958 opts.imtu = l2cap_pi(sk)->imtu;
1964 opts.omtu = l2cap_pi(sk)->omtu; 1959 opts.omtu = l2cap_pi(sk)->omtu;
1965 opts.flush_to = l2cap_pi(sk)->flush_to; 1960 opts.flush_to = l2cap_pi(sk)->flush_to;
@@ -2771,10 +2766,10 @@ static int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *data,
2771 case L2CAP_CONF_MTU: 2766 case L2CAP_CONF_MTU:
2772 if (val < L2CAP_DEFAULT_MIN_MTU) { 2767 if (val < L2CAP_DEFAULT_MIN_MTU) {
2773 *result = L2CAP_CONF_UNACCEPT; 2768 *result = L2CAP_CONF_UNACCEPT;
2774 pi->omtu = L2CAP_DEFAULT_MIN_MTU; 2769 pi->imtu = L2CAP_DEFAULT_MIN_MTU;
2775 } else 2770 } else
2776 pi->omtu = val; 2771 pi->imtu = val;
2777 l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu); 2772 l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu);
2778 break; 2773 break;
2779 2774
2780 case L2CAP_CONF_FLUSH_TO: 2775 case L2CAP_CONF_FLUSH_TO:
@@ -3071,6 +3066,17 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
3071 return 0; 3066 return 0;
3072} 3067}
3073 3068
3069static inline void set_default_fcs(struct l2cap_pinfo *pi)
3070{
3071 /* FCS is enabled only in ERTM or streaming mode, if one or both
3072 * sides request it.
3073 */
3074 if (pi->mode != L2CAP_MODE_ERTM && pi->mode != L2CAP_MODE_STREAMING)
3075 pi->fcs = L2CAP_FCS_NONE;
3076 else if (!(pi->conf_state & L2CAP_CONF_NO_FCS_RECV))
3077 pi->fcs = L2CAP_FCS_CRC16;
3078}
3079
3074static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data) 3080static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data)
3075{ 3081{
3076 struct l2cap_conf_req *req = (struct l2cap_conf_req *) data; 3082 struct l2cap_conf_req *req = (struct l2cap_conf_req *) data;
@@ -3088,14 +3094,8 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
3088 if (!sk) 3094 if (!sk)
3089 return -ENOENT; 3095 return -ENOENT;
3090 3096
3091 if (sk->sk_state != BT_CONFIG) { 3097 if (sk->sk_state == BT_DISCONN)
3092 struct l2cap_cmd_rej rej;
3093
3094 rej.reason = cpu_to_le16(0x0002);
3095 l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ,
3096 sizeof(rej), &rej);
3097 goto unlock; 3098 goto unlock;
3098 }
3099 3099
3100 /* Reject if config buffer is too small. */ 3100 /* Reject if config buffer is too small. */
3101 len = cmd_len - sizeof(*req); 3101 len = cmd_len - sizeof(*req);
@@ -3135,9 +3135,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
3135 goto unlock; 3135 goto unlock;
3136 3136
3137 if (l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE) { 3137 if (l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE) {
3138 if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_NO_FCS_RECV) || 3138 set_default_fcs(l2cap_pi(sk));
3139 l2cap_pi(sk)->fcs != L2CAP_FCS_NONE)
3140 l2cap_pi(sk)->fcs = L2CAP_FCS_CRC16;
3141 3139
3142 sk->sk_state = BT_CONNECTED; 3140 sk->sk_state = BT_CONNECTED;
3143 3141
@@ -3225,9 +3223,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
3225 l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE; 3223 l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE;
3226 3224
3227 if (l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE) { 3225 if (l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE) {
3228 if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_NO_FCS_RECV) || 3226 set_default_fcs(l2cap_pi(sk));
3229 l2cap_pi(sk)->fcs != L2CAP_FCS_NONE)
3230 l2cap_pi(sk)->fcs = L2CAP_FCS_CRC16;
3231 3227
3232 sk->sk_state = BT_CONNECTED; 3228 sk->sk_state = BT_CONNECTED;
3233 l2cap_pi(sk)->next_tx_seq = 0; 3229 l2cap_pi(sk)->next_tx_seq = 0;
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 44a623275951..194b3a04cfd3 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -82,11 +82,14 @@ static void rfcomm_sk_data_ready(struct rfcomm_dlc *d, struct sk_buff *skb)
82static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err) 82static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err)
83{ 83{
84 struct sock *sk = d->owner, *parent; 84 struct sock *sk = d->owner, *parent;
85 unsigned long flags;
86
85 if (!sk) 87 if (!sk)
86 return; 88 return;
87 89
88 BT_DBG("dlc %p state %ld err %d", d, d->state, err); 90 BT_DBG("dlc %p state %ld err %d", d, d->state, err);
89 91
92 local_irq_save(flags);
90 bh_lock_sock(sk); 93 bh_lock_sock(sk);
91 94
92 if (err) 95 if (err)
@@ -108,6 +111,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err)
108 } 111 }
109 112
110 bh_unlock_sock(sk); 113 bh_unlock_sock(sk);
114 local_irq_restore(flags);
111 115
112 if (parent && sock_flag(sk, SOCK_ZAPPED)) { 116 if (parent && sock_flag(sk, SOCK_ZAPPED)) {
113 /* We have to drop DLC lock here, otherwise 117 /* We have to drop DLC lock here, otherwise
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index 8ce904786116..4bf28f25f368 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -827,6 +827,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
827 long timeo; 827 long timeo;
828 int err; 828 int err;
829 int ifindex, headroom, tailroom; 829 int ifindex, headroom, tailroom;
830 unsigned int mtu;
830 struct net_device *dev; 831 struct net_device *dev;
831 832
832 lock_sock(sk); 833 lock_sock(sk);
@@ -896,15 +897,23 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
896 cf_sk->sk.sk_state = CAIF_DISCONNECTED; 897 cf_sk->sk.sk_state = CAIF_DISCONNECTED;
897 goto out; 898 goto out;
898 } 899 }
899 dev = dev_get_by_index(sock_net(sk), ifindex); 900
901 err = -ENODEV;
902 rcu_read_lock();
903 dev = dev_get_by_index_rcu(sock_net(sk), ifindex);
904 if (!dev) {
905 rcu_read_unlock();
906 goto out;
907 }
900 cf_sk->headroom = LL_RESERVED_SPACE_EXTRA(dev, headroom); 908 cf_sk->headroom = LL_RESERVED_SPACE_EXTRA(dev, headroom);
909 mtu = dev->mtu;
910 rcu_read_unlock();
911
901 cf_sk->tailroom = tailroom; 912 cf_sk->tailroom = tailroom;
902 cf_sk->maxframe = dev->mtu - (headroom + tailroom); 913 cf_sk->maxframe = mtu - (headroom + tailroom);
903 dev_put(dev);
904 if (cf_sk->maxframe < 1) { 914 if (cf_sk->maxframe < 1) {
905 pr_warning("CAIF: %s(): CAIF Interface MTU too small (%d)\n", 915 pr_warning("CAIF: %s(): CAIF Interface MTU too small (%u)\n",
906 __func__, dev->mtu); 916 __func__, mtu);
907 err = -ENODEV;
908 goto out; 917 goto out;
909 } 918 }
910 919
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 7a85367b3c2f..8451ab481095 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -348,7 +348,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
348 if (info.cmd == ETHTOOL_GRXCLSRLALL) { 348 if (info.cmd == ETHTOOL_GRXCLSRLALL) {
349 if (info.rule_cnt > 0) { 349 if (info.rule_cnt > 0) {
350 if (info.rule_cnt <= KMALLOC_MAX_SIZE / sizeof(u32)) 350 if (info.rule_cnt <= KMALLOC_MAX_SIZE / sizeof(u32))
351 rule_buf = kmalloc(info.rule_cnt * sizeof(u32), 351 rule_buf = kzalloc(info.rule_cnt * sizeof(u32),
352 GFP_USER); 352 GFP_USER);
353 if (!rule_buf) 353 if (!rule_buf)
354 return -ENOMEM; 354 return -ENOMEM;
@@ -397,7 +397,7 @@ static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev,
397 (KMALLOC_MAX_SIZE - sizeof(*indir)) / sizeof(*indir->ring_index)) 397 (KMALLOC_MAX_SIZE - sizeof(*indir)) / sizeof(*indir->ring_index))
398 return -ENOMEM; 398 return -ENOMEM;
399 full_size = sizeof(*indir) + sizeof(*indir->ring_index) * table_size; 399 full_size = sizeof(*indir) + sizeof(*indir->ring_index) * table_size;
400 indir = kmalloc(full_size, GFP_USER); 400 indir = kzalloc(full_size, GFP_USER);
401 if (!indir) 401 if (!indir)
402 return -ENOMEM; 402 return -ENOMEM;
403 403
@@ -538,7 +538,7 @@ static int ethtool_get_rx_ntuple(struct net_device *dev, void __user *useraddr)
538 538
539 gstrings.len = ret; 539 gstrings.len = ret;
540 540
541 data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); 541 data = kzalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
542 if (!data) 542 if (!data)
543 return -ENOMEM; 543 return -ENOMEM;
544 544
@@ -775,7 +775,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
775 if (regs.len > reglen) 775 if (regs.len > reglen)
776 regs.len = reglen; 776 regs.len = reglen;
777 777
778 regbuf = kmalloc(reglen, GFP_USER); 778 regbuf = kzalloc(reglen, GFP_USER);
779 if (!regbuf) 779 if (!regbuf)
780 return -ENOMEM; 780 return -ENOMEM;
781 781
diff --git a/net/core/stream.c b/net/core/stream.c
index d959e0f41528..f5df85dcd20b 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -141,10 +141,10 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
141 141
142 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); 142 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
143 sk->sk_write_pending++; 143 sk->sk_write_pending++;
144 sk_wait_event(sk, &current_timeo, !sk->sk_err && 144 sk_wait_event(sk, &current_timeo, sk->sk_err ||
145 !(sk->sk_shutdown & SEND_SHUTDOWN) && 145 (sk->sk_shutdown & SEND_SHUTDOWN) ||
146 sk_stream_memory_free(sk) && 146 (sk_stream_memory_free(sk) &&
147 vm_wait); 147 !vm_wait));
148 sk->sk_write_pending--; 148 sk->sk_write_pending--;
149 149
150 if (vm_wait) { 150 if (vm_wait) {
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 571f8950ed06..7cd7760144f7 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -217,6 +217,7 @@ config NET_IPIP
217 217
218config NET_IPGRE 218config NET_IPGRE
219 tristate "IP: GRE tunnels over IP" 219 tristate "IP: GRE tunnels over IP"
220 depends on IPV6 || IPV6=n
220 help 221 help
221 Tunneling means encapsulating data of one protocol type within 222 Tunneling means encapsulating data of one protocol type within
222 another protocol and sending it over a channel that understands the 223 another protocol and sending it over a channel that understands the
@@ -412,7 +413,7 @@ config INET_XFRM_MODE_BEET
412 If unsure, say Y. 413 If unsure, say Y.
413 414
414config INET_LRO 415config INET_LRO
415 bool "Large Receive Offload (ipv4/tcp)" 416 tristate "Large Receive Offload (ipv4/tcp)"
416 default y 417 default y
417 ---help--- 418 ---help---
418 Support for Large Receive Offload (ipv4/tcp). 419 Support for Large Receive Offload (ipv4/tcp).
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 1fdcacd36ce7..2a4bb76f2132 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -834,7 +834,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
834 int mark = 0; 834 int mark = 0;
835 835
836 836
837 if (len == 8 || IGMP_V2_SEEN(in_dev)) { 837 if (len == 8) {
838 if (ih->code == 0) { 838 if (ih->code == 0) {
839 /* Alas, old v1 router presents here. */ 839 /* Alas, old v1 router presents here. */
840 840
@@ -856,6 +856,18 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
856 igmpv3_clear_delrec(in_dev); 856 igmpv3_clear_delrec(in_dev);
857 } else if (len < 12) { 857 } else if (len < 12) {
858 return; /* ignore bogus packet; freed by caller */ 858 return; /* ignore bogus packet; freed by caller */
859 } else if (IGMP_V1_SEEN(in_dev)) {
860 /* This is a v3 query with v1 queriers present */
861 max_delay = IGMP_Query_Response_Interval;
862 group = 0;
863 } else if (IGMP_V2_SEEN(in_dev)) {
864 /* this is a v3 query with v2 queriers present;
865 * Interpretation of the max_delay code is problematic here.
866 * A real v2 host would use ih_code directly, while v3 has a
867 * different encoding. We use the v3 encoding as more likely
868 * to be intended in a v3 query.
869 */
870 max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE);
859 } else { /* v3 */ 871 } else { /* v3 */
860 if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) 872 if (!pskb_may_pull(skb, sizeof(struct igmpv3_query)))
861 return; 873 return;
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index c35b469e851c..74c54b30600f 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -135,13 +135,16 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk)
135 135
136/* This function calculates a "timeout" which is equivalent to the timeout of a 136/* This function calculates a "timeout" which is equivalent to the timeout of a
137 * TCP connection after "boundary" unsuccessful, exponentially backed-off 137 * TCP connection after "boundary" unsuccessful, exponentially backed-off
138 * retransmissions with an initial RTO of TCP_RTO_MIN. 138 * retransmissions with an initial RTO of TCP_RTO_MIN or TCP_TIMEOUT_INIT if
139 * syn_set flag is set.
139 */ 140 */
140static bool retransmits_timed_out(struct sock *sk, 141static bool retransmits_timed_out(struct sock *sk,
141 unsigned int boundary) 142 unsigned int boundary,
143 bool syn_set)
142{ 144{
143 unsigned int timeout, linear_backoff_thresh; 145 unsigned int timeout, linear_backoff_thresh;
144 unsigned int start_ts; 146 unsigned int start_ts;
147 unsigned int rto_base = syn_set ? TCP_TIMEOUT_INIT : TCP_RTO_MIN;
145 148
146 if (!inet_csk(sk)->icsk_retransmits) 149 if (!inet_csk(sk)->icsk_retransmits)
147 return false; 150 return false;
@@ -151,12 +154,12 @@ static bool retransmits_timed_out(struct sock *sk,
151 else 154 else
152 start_ts = tcp_sk(sk)->retrans_stamp; 155 start_ts = tcp_sk(sk)->retrans_stamp;
153 156
154 linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN); 157 linear_backoff_thresh = ilog2(TCP_RTO_MAX/rto_base);
155 158
156 if (boundary <= linear_backoff_thresh) 159 if (boundary <= linear_backoff_thresh)
157 timeout = ((2 << boundary) - 1) * TCP_RTO_MIN; 160 timeout = ((2 << boundary) - 1) * rto_base;
158 else 161 else
159 timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN + 162 timeout = ((2 << linear_backoff_thresh) - 1) * rto_base +
160 (boundary - linear_backoff_thresh) * TCP_RTO_MAX; 163 (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
161 164
162 return (tcp_time_stamp - start_ts) >= timeout; 165 return (tcp_time_stamp - start_ts) >= timeout;
@@ -167,14 +170,15 @@ static int tcp_write_timeout(struct sock *sk)
167{ 170{
168 struct inet_connection_sock *icsk = inet_csk(sk); 171 struct inet_connection_sock *icsk = inet_csk(sk);
169 int retry_until; 172 int retry_until;
170 bool do_reset; 173 bool do_reset, syn_set = 0;
171 174
172 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { 175 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
173 if (icsk->icsk_retransmits) 176 if (icsk->icsk_retransmits)
174 dst_negative_advice(sk); 177 dst_negative_advice(sk);
175 retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries; 178 retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries;
179 syn_set = 1;
176 } else { 180 } else {
177 if (retransmits_timed_out(sk, sysctl_tcp_retries1)) { 181 if (retransmits_timed_out(sk, sysctl_tcp_retries1, 0)) {
178 /* Black hole detection */ 182 /* Black hole detection */
179 tcp_mtu_probing(icsk, sk); 183 tcp_mtu_probing(icsk, sk);
180 184
@@ -187,14 +191,14 @@ static int tcp_write_timeout(struct sock *sk)
187 191
188 retry_until = tcp_orphan_retries(sk, alive); 192 retry_until = tcp_orphan_retries(sk, alive);
189 do_reset = alive || 193 do_reset = alive ||
190 !retransmits_timed_out(sk, retry_until); 194 !retransmits_timed_out(sk, retry_until, 0);
191 195
192 if (tcp_out_of_resources(sk, do_reset)) 196 if (tcp_out_of_resources(sk, do_reset))
193 return 1; 197 return 1;
194 } 198 }
195 } 199 }
196 200
197 if (retransmits_timed_out(sk, retry_until)) { 201 if (retransmits_timed_out(sk, retry_until, syn_set)) {
198 /* Has it gone just too far? */ 202 /* Has it gone just too far? */
199 tcp_write_err(sk); 203 tcp_write_err(sk);
200 return 1; 204 return 1;
@@ -436,7 +440,7 @@ out_reset_timer:
436 icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX); 440 icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX);
437 } 441 }
438 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, TCP_RTO_MAX); 442 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, TCP_RTO_MAX);
439 if (retransmits_timed_out(sk, sysctl_tcp_retries1 + 1)) 443 if (retransmits_timed_out(sk, sysctl_tcp_retries1 + 1, 0))
440 __sk_dst_reset(sk); 444 __sk_dst_reset(sk);
441 445
442out:; 446out:;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 8323136bdc54..a275c6e1e25c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1556,14 +1556,13 @@ out:
1556 * i.e. Path MTU discovery 1556 * i.e. Path MTU discovery
1557 */ 1557 */
1558 1558
1559void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, 1559static void rt6_do_pmtu_disc(struct in6_addr *daddr, struct in6_addr *saddr,
1560 struct net_device *dev, u32 pmtu) 1560 struct net *net, u32 pmtu, int ifindex)
1561{ 1561{
1562 struct rt6_info *rt, *nrt; 1562 struct rt6_info *rt, *nrt;
1563 struct net *net = dev_net(dev);
1564 int allfrag = 0; 1563 int allfrag = 0;
1565 1564
1566 rt = rt6_lookup(net, daddr, saddr, dev->ifindex, 0); 1565 rt = rt6_lookup(net, daddr, saddr, ifindex, 0);
1567 if (rt == NULL) 1566 if (rt == NULL)
1568 return; 1567 return;
1569 1568
@@ -1631,6 +1630,27 @@ out:
1631 dst_release(&rt->dst); 1630 dst_release(&rt->dst);
1632} 1631}
1633 1632
1633void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1634 struct net_device *dev, u32 pmtu)
1635{
1636 struct net *net = dev_net(dev);
1637
1638 /*
1639 * RFC 1981 states that a node "MUST reduce the size of the packets it
1640 * is sending along the path" that caused the Packet Too Big message.
1641 * Since it's not possible in the general case to determine which
1642 * interface was used to send the original packet, we update the MTU
1643 * on the interface that will be used to send future packets. We also
1644 * update the MTU on the interface that received the Packet Too Big in
1645 * case the original packet was forced out that interface with
1646 * SO_BINDTODEVICE or similar. This is the next best thing to the
1647 * correct behaviour, which would be to update the MTU on all
1648 * interfaces.
1649 */
1650 rt6_do_pmtu_disc(daddr, saddr, net, pmtu, 0);
1651 rt6_do_pmtu_disc(daddr, saddr, net, pmtu, dev->ifindex);
1652}
1653
1634/* 1654/*
1635 * Misc support functions 1655 * Misc support functions
1636 */ 1656 */
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index c893f236acea..8f23401832b7 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -175,6 +175,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
175 175
176 set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); 176 set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state);
177 177
178 del_timer_sync(&tid_tx->addba_resp_timer);
179
178 /* 180 /*
179 * After this packets are no longer handed right through 181 * After this packets are no longer handed right through
180 * to the driver but are put onto tid_tx->pending instead, 182 * to the driver but are put onto tid_tx->pending instead,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index fa0f37e4afe4..28624282c5f3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2199,9 +2199,6 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
2199 struct net_device *prev_dev = NULL; 2199 struct net_device *prev_dev = NULL;
2200 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 2200 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
2201 2201
2202 if (status->flag & RX_FLAG_INTERNAL_CMTR)
2203 goto out_free_skb;
2204
2205 if (skb_headroom(skb) < sizeof(*rthdr) && 2202 if (skb_headroom(skb) < sizeof(*rthdr) &&
2206 pskb_expand_head(skb, sizeof(*rthdr), 0, GFP_ATOMIC)) 2203 pskb_expand_head(skb, sizeof(*rthdr), 0, GFP_ATOMIC))
2207 goto out_free_skb; 2204 goto out_free_skb;
@@ -2260,7 +2257,6 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
2260 } else 2257 } else
2261 goto out_free_skb; 2258 goto out_free_skb;
2262 2259
2263 status->flag |= RX_FLAG_INTERNAL_CMTR;
2264 return; 2260 return;
2265 2261
2266 out_free_skb: 2262 out_free_skb:
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 10caec5ea8fa..34da67995d94 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -377,7 +377,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
377 skb2 = skb_clone(skb, GFP_ATOMIC); 377 skb2 = skb_clone(skb, GFP_ATOMIC);
378 if (skb2) { 378 if (skb2) {
379 skb2->dev = prev_dev; 379 skb2->dev = prev_dev;
380 netif_receive_skb(skb2); 380 netif_rx(skb2);
381 } 381 }
382 } 382 }
383 383
@@ -386,7 +386,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
386 } 386 }
387 if (prev_dev) { 387 if (prev_dev) {
388 skb->dev = prev_dev; 388 skb->dev = prev_dev;
389 netif_receive_skb(skb); 389 netif_rx(skb);
390 skb = NULL; 390 skb = NULL;
391 } 391 }
392 rcu_read_unlock(); 392 rcu_read_unlock();
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index b2a3ae6cad78..15003021f4f0 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -225,12 +225,13 @@ static void pipe_grant_credits(struct sock *sk)
225static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb) 225static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
226{ 226{
227 struct pep_sock *pn = pep_sk(sk); 227 struct pep_sock *pn = pep_sk(sk);
228 struct pnpipehdr *hdr = pnp_hdr(skb); 228 struct pnpipehdr *hdr;
229 int wake = 0; 229 int wake = 0;
230 230
231 if (!pskb_may_pull(skb, sizeof(*hdr) + 4)) 231 if (!pskb_may_pull(skb, sizeof(*hdr) + 4))
232 return -EINVAL; 232 return -EINVAL;
233 233
234 hdr = pnp_hdr(skb);
234 if (hdr->data[0] != PN_PEP_TYPE_COMMON) { 235 if (hdr->data[0] != PN_PEP_TYPE_COMMON) {
235 LIMIT_NETDEBUG(KERN_DEBUG"Phonet unknown PEP type: %u\n", 236 LIMIT_NETDEBUG(KERN_DEBUG"Phonet unknown PEP type: %u\n",
236 (unsigned)hdr->data[0]); 237 (unsigned)hdr->data[0]);
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 7416a5c73b2a..b0c2a82178af 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -137,7 +137,7 @@ next_knode:
137 int toff = off + key->off + (off2 & key->offmask); 137 int toff = off + key->off + (off2 & key->offmask);
138 __be32 *data, _data; 138 __be32 *data, _data;
139 139
140 if (skb_headroom(skb) + toff < 0) 140 if (skb_headroom(skb) + toff > INT_MAX)
141 goto out; 141 goto out;
142 142
143 data = skb_header_pointer(skb, toff, 4, &_data); 143 data = skb_header_pointer(skb, toff, 4, &_data);
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 86366390038a..ddbbf7c81fa1 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -543,16 +543,20 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc)
543 id = ntohs(hmacs->hmac_ids[i]); 543 id = ntohs(hmacs->hmac_ids[i]);
544 544
545 /* Check the id is in the supported range */ 545 /* Check the id is in the supported range */
546 if (id > SCTP_AUTH_HMAC_ID_MAX) 546 if (id > SCTP_AUTH_HMAC_ID_MAX) {
547 id = 0;
547 continue; 548 continue;
549 }
548 550
549 /* See is we support the id. Supported IDs have name and 551 /* See is we support the id. Supported IDs have name and
550 * length fields set, so that we can allocated and use 552 * length fields set, so that we can allocated and use
551 * them. We can safely just check for name, for without the 553 * them. We can safely just check for name, for without the
552 * name, we can't allocate the TFM. 554 * name, we can't allocate the TFM.
553 */ 555 */
554 if (!sctp_hmac_list[id].hmac_name) 556 if (!sctp_hmac_list[id].hmac_name) {
557 id = 0;
555 continue; 558 continue;
559 }
556 560
557 break; 561 break;
558 } 562 }
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index ca44917872d2..fbb70770ad05 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -916,6 +916,11 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk,
916 /* Walk through the addrs buffer and count the number of addresses. */ 916 /* Walk through the addrs buffer and count the number of addresses. */
917 addr_buf = kaddrs; 917 addr_buf = kaddrs;
918 while (walk_size < addrs_size) { 918 while (walk_size < addrs_size) {
919 if (walk_size + sizeof(sa_family_t) > addrs_size) {
920 kfree(kaddrs);
921 return -EINVAL;
922 }
923
919 sa_addr = (struct sockaddr *)addr_buf; 924 sa_addr = (struct sockaddr *)addr_buf;
920 af = sctp_get_af_specific(sa_addr->sa_family); 925 af = sctp_get_af_specific(sa_addr->sa_family);
921 926
@@ -1002,9 +1007,13 @@ static int __sctp_connect(struct sock* sk,
1002 /* Walk through the addrs buffer and count the number of addresses. */ 1007 /* Walk through the addrs buffer and count the number of addresses. */
1003 addr_buf = kaddrs; 1008 addr_buf = kaddrs;
1004 while (walk_size < addrs_size) { 1009 while (walk_size < addrs_size) {
1010 if (walk_size + sizeof(sa_family_t) > addrs_size) {
1011 err = -EINVAL;
1012 goto out_free;
1013 }
1014
1005 sa_addr = (union sctp_addr *)addr_buf; 1015 sa_addr = (union sctp_addr *)addr_buf;
1006 af = sctp_get_af_specific(sa_addr->sa.sa_family); 1016 af = sctp_get_af_specific(sa_addr->sa.sa_family);
1007 port = ntohs(sa_addr->v4.sin_port);
1008 1017
1009 /* If the address family is not supported or if this address 1018 /* If the address family is not supported or if this address
1010 * causes the address buffer to overflow return EINVAL. 1019 * causes the address buffer to overflow return EINVAL.
@@ -1014,6 +1023,8 @@ static int __sctp_connect(struct sock* sk,
1014 goto out_free; 1023 goto out_free;
1015 } 1024 }
1016 1025
1026 port = ntohs(sa_addr->v4.sin_port);
1027
1017 /* Save current address so we can work with it */ 1028 /* Save current address so we can work with it */
1018 memcpy(&to, sa_addr, af->sockaddr_len); 1029 memcpy(&to, sa_addr, af->sockaddr_len);
1019 1030
diff --git a/samples/kfifo/dma-example.c b/samples/kfifo/dma-example.c
index ee03a4f0b64f..06473791c08a 100644
--- a/samples/kfifo/dma-example.c
+++ b/samples/kfifo/dma-example.c
@@ -24,6 +24,7 @@ static int __init example_init(void)
24{ 24{
25 int i; 25 int i;
26 unsigned int ret; 26 unsigned int ret;
27 unsigned int nents;
27 struct scatterlist sg[10]; 28 struct scatterlist sg[10];
28 29
29 printk(KERN_INFO "DMA fifo test start\n"); 30 printk(KERN_INFO "DMA fifo test start\n");
@@ -61,9 +62,9 @@ static int __init example_init(void)
61 * byte at the beginning, after the kfifo_skip(). 62 * byte at the beginning, after the kfifo_skip().
62 */ 63 */
63 sg_init_table(sg, ARRAY_SIZE(sg)); 64 sg_init_table(sg, ARRAY_SIZE(sg));
64 ret = kfifo_dma_in_prepare(&fifo, sg, ARRAY_SIZE(sg), FIFO_SIZE); 65 nents = kfifo_dma_in_prepare(&fifo, sg, ARRAY_SIZE(sg), FIFO_SIZE);
65 printk(KERN_INFO "DMA sgl entries: %d\n", ret); 66 printk(KERN_INFO "DMA sgl entries: %d\n", nents);
66 if (!ret) { 67 if (!nents) {
67 /* fifo is full and no sgl was created */ 68 /* fifo is full and no sgl was created */
68 printk(KERN_WARNING "error kfifo_dma_in_prepare\n"); 69 printk(KERN_WARNING "error kfifo_dma_in_prepare\n");
69 return -EIO; 70 return -EIO;
@@ -71,7 +72,7 @@ static int __init example_init(void)
71 72
72 /* receive data */ 73 /* receive data */
73 printk(KERN_INFO "scatterlist for receive:\n"); 74 printk(KERN_INFO "scatterlist for receive:\n");
74 for (i = 0; i < ARRAY_SIZE(sg); i++) { 75 for (i = 0; i < nents; i++) {
75 printk(KERN_INFO 76 printk(KERN_INFO
76 "sg[%d] -> " 77 "sg[%d] -> "
77 "page_link 0x%.8lx offset 0x%.8x length 0x%.8x\n", 78 "page_link 0x%.8lx offset 0x%.8x length 0x%.8x\n",
@@ -91,16 +92,16 @@ static int __init example_init(void)
91 kfifo_dma_in_finish(&fifo, ret); 92 kfifo_dma_in_finish(&fifo, ret);
92 93
93 /* Prepare to transmit data, example: 8 bytes */ 94 /* Prepare to transmit data, example: 8 bytes */
94 ret = kfifo_dma_out_prepare(&fifo, sg, ARRAY_SIZE(sg), 8); 95 nents = kfifo_dma_out_prepare(&fifo, sg, ARRAY_SIZE(sg), 8);
95 printk(KERN_INFO "DMA sgl entries: %d\n", ret); 96 printk(KERN_INFO "DMA sgl entries: %d\n", nents);
96 if (!ret) { 97 if (!nents) {
97 /* no data was available and no sgl was created */ 98 /* no data was available and no sgl was created */
98 printk(KERN_WARNING "error kfifo_dma_out_prepare\n"); 99 printk(KERN_WARNING "error kfifo_dma_out_prepare\n");
99 return -EIO; 100 return -EIO;
100 } 101 }
101 102
102 printk(KERN_INFO "scatterlist for transmit:\n"); 103 printk(KERN_INFO "scatterlist for transmit:\n");
103 for (i = 0; i < ARRAY_SIZE(sg); i++) { 104 for (i = 0; i < nents; i++) {
104 printk(KERN_INFO 105 printk(KERN_INFO
105 "sg[%d] -> " 106 "sg[%d] -> "
106 "page_link 0x%.8lx offset 0x%.8x length 0x%.8x\n", 107 "page_link 0x%.8lx offset 0x%.8x length 0x%.8x\n",
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 5b7c86ea43a1..7ef429cd5cb3 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -427,7 +427,7 @@ static void check_conf(struct menu *menu)
427 if (sym->name && !sym_is_choice_value(sym)) { 427 if (sym->name && !sym_is_choice_value(sym)) {
428 printf("CONFIG_%s\n", sym->name); 428 printf("CONFIG_%s\n", sym->name);
429 } 429 }
430 } else { 430 } else if (input_mode != oldnoconfig) {
431 if (!conf_cnt++) 431 if (!conf_cnt++)
432 printf(_("*\n* Restart config...\n*\n")); 432 printf(_("*\n* Restart config...\n*\n"));
433 rootEntry = menu_get_parent_menu(menu); 433 rootEntry = menu_get_parent_menu(menu);
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 6ee2e4fb1481..170459c224a1 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -165,7 +165,6 @@ struct menu {
165 struct symbol *sym; 165 struct symbol *sym;
166 struct property *prompt; 166 struct property *prompt;
167 struct expr *dep; 167 struct expr *dep;
168 struct expr *dir_dep;
169 unsigned int flags; 168 unsigned int flags;
170 char *help; 169 char *help;
171 struct file *file; 170 struct file *file;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 4fb590247f33..edda8b49619d 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -107,7 +107,6 @@ static struct expr *menu_check_dep(struct expr *e)
107void menu_add_dep(struct expr *dep) 107void menu_add_dep(struct expr *dep)
108{ 108{
109 current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep)); 109 current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep));
110 current_entry->dir_dep = current_entry->dep;
111} 110}
112 111
113void menu_set_type(int type) 112void menu_set_type(int type)
@@ -291,10 +290,6 @@ void menu_finalize(struct menu *parent)
291 for (menu = parent->list; menu; menu = menu->next) 290 for (menu = parent->list; menu; menu = menu->next)
292 menu_finalize(menu); 291 menu_finalize(menu);
293 } else if (sym) { 292 } else if (sym) {
294 /* ignore inherited dependencies for dir_dep */
295 sym->dir_dep.expr = expr_transform(expr_copy(parent->dir_dep));
296 sym->dir_dep.expr = expr_eliminate_dups(sym->dir_dep.expr);
297
298 basedep = parent->prompt ? parent->prompt->visible.expr : NULL; 293 basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
299 basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no); 294 basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
300 basedep = expr_eliminate_dups(expr_transform(basedep)); 295 basedep = expr_eliminate_dups(expr_transform(basedep));
@@ -325,6 +320,8 @@ void menu_finalize(struct menu *parent)
325 parent->next = last_menu->next; 320 parent->next = last_menu->next;
326 last_menu->next = NULL; 321 last_menu->next = NULL;
327 } 322 }
323
324 sym->dir_dep.expr = parent->dep;
328 } 325 }
329 for (menu = parent->list; menu; menu = menu->next) { 326 for (menu = parent->list; menu; menu = menu->next) {
330 if (sym && sym_is_choice(sym) && 327 if (sym && sym_is_choice(sym) &&
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 943712ca6c0a..1f8b305449db 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -350,6 +350,7 @@ void sym_calc_value(struct symbol *sym)
350 } 350 }
351 } 351 }
352 calc_newval: 352 calc_newval:
353#if 0
353 if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) { 354 if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
354 fprintf(stderr, "warning: ("); 355 fprintf(stderr, "warning: (");
355 expr_fprint(sym->rev_dep.expr, stderr); 356 expr_fprint(sym->rev_dep.expr, stderr);
@@ -358,6 +359,7 @@ void sym_calc_value(struct symbol *sym)
358 expr_fprint(sym->dir_dep.expr, stderr); 359 expr_fprint(sym->dir_dep.expr, stderr);
359 fprintf(stderr, ")\n"); 360 fprintf(stderr, ")\n");
360 } 361 }
362#endif
361 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); 363 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
362 } 364 }
363 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) 365 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
diff --git a/sound/core/control.c b/sound/core/control.c
index 070aab490191..45a818002d99 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -31,6 +31,7 @@
31 31
32/* max number of user-defined controls */ 32/* max number of user-defined controls */
33#define MAX_USER_CONTROLS 32 33#define MAX_USER_CONTROLS 32
34#define MAX_CONTROL_COUNT 1028
34 35
35struct snd_kctl_ioctl { 36struct snd_kctl_ioctl {
36 struct list_head list; /* list of all ioctls */ 37 struct list_head list; /* list of all ioctls */
@@ -195,6 +196,10 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
195 196
196 if (snd_BUG_ON(!control || !control->count)) 197 if (snd_BUG_ON(!control || !control->count))
197 return NULL; 198 return NULL;
199
200 if (control->count > MAX_CONTROL_COUNT)
201 return NULL;
202
198 kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); 203 kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
199 if (kctl == NULL) { 204 if (kctl == NULL) {
200 snd_printk(KERN_ERR "Cannot allocate control instance\n"); 205 snd_printk(KERN_ERR "Cannot allocate control instance\n");
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c
index 1adb8a3c2b62..42d7844ecd0b 100644
--- a/sound/i2c/other/ak4xxx-adda.c
+++ b/sound/i2c/other/ak4xxx-adda.c
@@ -900,7 +900,7 @@ static int proc_init(struct snd_akm4xxx *ak)
900 return 0; 900 return 0;
901} 901}
902#else /* !CONFIG_PROC_FS */ 902#else /* !CONFIG_PROC_FS */
903static int proc_init(struct snd_akm4xxx *ak) {} 903static int proc_init(struct snd_akm4xxx *ak) { return 0; }
904#endif 904#endif
905 905
906int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak) 906int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak)
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index 92aa762ffb7e..07f803e6d203 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -391,11 +391,11 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
391 case SND_DEV_DSP: 391 case SND_DEV_DSP:
392 case SND_DEV_DSP16: 392 case SND_DEV_DSP16:
393 case SND_DEV_AUDIO: 393 case SND_DEV_AUDIO:
394 return audio_ioctl(dev, file, cmd, p); 394 ret = audio_ioctl(dev, file, cmd, p);
395 break; 395 break;
396 396
397 case SND_DEV_MIDIN: 397 case SND_DEV_MIDIN:
398 return MIDIbuf_ioctl(dev, file, cmd, p); 398 ret = MIDIbuf_ioctl(dev, file, cmd, p);
399 break; 399 break;
400 400
401 } 401 }
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 95148e58026c..c16c5ba0fda0 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1747,6 +1747,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1747 "HP dv6", STAC_HP_DV5), 1747 "HP dv6", STAC_HP_DV5),
1748 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061, 1748 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
1749 "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */ 1749 "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
1750 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
1751 "HP DV6", STAC_HP_DV5),
1750 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010, 1752 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
1751 "HP", STAC_HP_DV5), 1753 "HP", STAC_HP_DV5),
1752 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, 1754 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 4f1fa77c1feb..1950e19af1cf 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -1017,7 +1017,7 @@ builtin-revert.o wt-status.o: wt-status.h
1017# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So 1017# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
1018# we depend the various files onto their directories. 1018# we depend the various files onto their directories.
1019DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h 1019DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
1020$(DIRECTORY_DEPS): $(sort $(dir $(DIRECTORY_DEPS))) 1020$(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS)))
1021# In the second step, we make a rule to actually create these directories 1021# In the second step, we make a rule to actually create these directories
1022$(sort $(dir $(DIRECTORY_DEPS))): 1022$(sort $(dir $(DIRECTORY_DEPS))):
1023 $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null 1023 $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index ef7aa0a0c526..95aaf565c704 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -73,6 +73,18 @@ void get_term_dimensions(struct winsize *ws);
73#define cpu_relax() asm volatile("":::"memory") 73#define cpu_relax() asm volatile("":::"memory")
74#endif 74#endif
75 75
76#ifdef __mips__
77#include "../../arch/mips/include/asm/unistd.h"
78#define rmb() asm volatile( \
79 ".set mips2\n\t" \
80 "sync\n\t" \
81 ".set mips0" \
82 : /* no output */ \
83 : /* no input */ \
84 : "memory")
85#define cpu_relax() asm volatile("" ::: "memory")
86#endif
87
76#include <time.h> 88#include <time.h>
77#include <unistd.h> 89#include <unistd.h>
78#include <sys/types.h> 90#include <sys/types.h>
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 7ea983acfaea..f7af2fca965d 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -97,7 +97,7 @@ void setup_python_scripting(void)
97 register_python_scripting(&python_scripting_unsupported_ops); 97 register_python_scripting(&python_scripting_unsupported_ops);
98} 98}
99#else 99#else
100struct scripting_ops python_scripting_ops; 100extern struct scripting_ops python_scripting_ops;
101 101
102void setup_python_scripting(void) 102void setup_python_scripting(void)
103{ 103{
@@ -158,7 +158,7 @@ void setup_perl_scripting(void)
158 register_perl_scripting(&perl_scripting_unsupported_ops); 158 register_perl_scripting(&perl_scripting_unsupported_ops);
159} 159}
160#else 160#else
161struct scripting_ops perl_scripting_ops; 161extern struct scripting_ops perl_scripting_ops;
162 162
163void setup_perl_scripting(void) 163void setup_perl_scripting(void)
164{ 164{
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index dafdf6775d77..6866aa4c41e0 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -773,7 +773,7 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
773 773
774 switch (key) { 774 switch (key) {
775 case 'a': 775 case 'a':
776 if (browser->selection->map == NULL && 776 if (browser->selection->map == NULL ||
777 browser->selection->map->dso->annotate_warned) 777 browser->selection->map->dso->annotate_warned)
778 continue; 778 continue;
779 goto do_annotate; 779 goto do_annotate;