aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2011-09-15 09:08:05 -0400
committerJiri Kosina <jkosina@suse.cz>2011-09-15 09:08:18 -0400
commite060c38434b2caa78efe7cedaff4191040b65a15 (patch)
tree407361230bf6733f63d8e788e4b5e6566ee04818 /arch
parent10e4ac572eeffe5317019bd7330b6058a400dfc2 (diff)
parentcc39c6a9bbdebfcf1a7dee64d83bf302bc38d941 (diff)
Merge branch 'master' into for-next
Fast-forward merge with Linus to be able to merge patches based on more recent version of the tree.
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig3
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/alpha/include/asm/atomic.h12
-rw-r--r--arch/alpha/include/asm/bitops.h3
-rw-r--r--arch/alpha/include/asm/local.h2
-rw-r--r--arch/alpha/include/asm/ptrace.h1
-rw-r--r--arch/alpha/include/asm/sysinfo.h9
-rw-r--r--arch/alpha/include/asm/thread_info.h8
-rw-r--r--arch/alpha/kernel/osf_sys.c12
-rw-r--r--arch/alpha/kernel/perf_event.c2
-rw-r--r--arch/alpha/kernel/smp.c2
-rw-r--r--arch/alpha/kernel/sys_alcor.c2
-rw-r--r--arch/alpha/kernel/sys_cabriolet.c6
-rw-r--r--arch/alpha/kernel/sys_dp264.c8
-rw-r--r--arch/alpha/kernel/sys_eb64p.c2
-rw-r--r--arch/alpha/kernel/sys_eiger.c2
-rw-r--r--arch/alpha/kernel/sys_marvel.c2
-rw-r--r--arch/alpha/kernel/sys_miata.c2
-rw-r--r--arch/alpha/kernel/sys_mikasa.c2
-rw-r--r--arch/alpha/kernel/sys_nautilus.c2
-rw-r--r--arch/alpha/kernel/sys_noritake.c2
-rw-r--r--arch/alpha/kernel/sys_rawhide.c2
-rw-r--r--arch/alpha/kernel/sys_ruffian.c2
-rw-r--r--arch/alpha/kernel/sys_rx164.c2
-rw-r--r--arch/alpha/kernel/sys_sable.c4
-rw-r--r--arch/alpha/kernel/sys_sio.c4
-rw-r--r--arch/alpha/kernel/sys_sx164.c2
-rw-r--r--arch/alpha/kernel/sys_takara.c4
-rw-r--r--arch/alpha/kernel/sys_titan.c2
-rw-r--r--arch/alpha/kernel/sys_wildfire.c2
-rw-r--r--arch/alpha/kernel/systbls.S2
-rw-r--r--arch/alpha/lib/dec_and_lock.c2
-rw-r--r--arch/arm/Kconfig56
-rw-r--r--arch/arm/Makefile10
-rw-r--r--arch/arm/boot/Makefile6
-rw-r--r--arch/arm/boot/compressed/mmcif-sh7372.c2
-rw-r--r--arch/arm/boot/compressed/sdhi-sh7372.c2
-rw-r--r--arch/arm/boot/dts/prima2-cb.dts416
-rw-r--r--arch/arm/boot/dts/skeleton.dtsi13
-rw-r--r--arch/arm/boot/dts/tegra-harmony.dts70
-rw-r--r--arch/arm/boot/dts/tegra-seaboard.dts28
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi139
-rw-r--r--arch/arm/boot/dts/versatile-ab.dts192
-rw-r--r--arch/arm/boot/dts/versatile-pb.dts48
-rw-r--r--arch/arm/boot/dts/zynq-ep107.dts52
-rw-r--r--arch/arm/common/gic.c6
-rw-r--r--arch/arm/common/it8152.c2
-rw-r--r--arch/arm/configs/mxs_defconfig2
-rw-r--r--arch/arm/configs/u8500_defconfig32
-rw-r--r--arch/arm/include/asm/atomic.h10
-rw-r--r--arch/arm/include/asm/bitops.h5
-rw-r--r--arch/arm/include/asm/clkdev.h5
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h11
-rw-r--r--arch/arm/include/asm/hardware/gic.h6
-rw-r--r--arch/arm/include/asm/hardware/it8152.h2
-rw-r--r--arch/arm/include/asm/irq.h1
-rw-r--r--arch/arm/include/asm/mach/arch.h7
-rw-r--r--arch/arm/include/asm/mach/pci.h4
-rw-r--r--arch/arm/include/asm/pci.h12
-rw-r--r--arch/arm/include/asm/pmu.h10
-rw-r--r--arch/arm/include/asm/prom.h5
-rw-r--r--arch/arm/include/asm/vga.h5
-rw-r--r--arch/arm/kernel/armksyms.c3
-rw-r--r--arch/arm/kernel/bios32.c2
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/kernel/devtree.c14
-rw-r--r--arch/arm/kernel/irq.c19
-rw-r--r--arch/arm/kernel/iwmmxt.S6
-rw-r--r--arch/arm/kernel/module.c4
-rw-r--r--arch/arm/kernel/pmu.c26
-rw-r--r--arch/arm/kernel/process.c4
-rw-r--r--arch/arm/kernel/relocate_kernel.S3
-rw-r--r--arch/arm/kernel/setup.c15
-rw-r--r--arch/arm/kernel/smp.c2
-rw-r--r--arch/arm/kernel/smp_twd.c4
-rw-r--r--arch/arm/kernel/traps.c2
-rw-r--r--arch/arm/lib/Makefile2
-rw-r--r--arch/arm/lib/ecard.S1
-rw-r--r--arch/arm/lib/io-readsw-armv3.S1
-rw-r--r--arch/arm/lib/io-writesw-armv3.S1
-rw-r--r--arch/arm/lib/sha1.S211
-rw-r--r--arch/arm/mach-at91/Makefile2
-rw-r--r--arch/arm/mach-at91/at91cap9.c45
-rw-r--r--arch/arm/mach-at91/at91rm9200.c47
-rw-r--r--arch/arm/mach-at91/at91sam9260.c100
-rw-r--r--arch/arm/mach-at91/at91sam9261.c64
-rw-r--r--arch/arm/mach-at91/at91sam9263.c51
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c45
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c59
-rw-r--r--arch/arm/mach-at91/board-1arm.c11
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c12
-rw-r--r--arch/arm/mach-at91/board-cam60.c12
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c12
-rw-r--r--arch/arm/mach-at91/board-carmeva.c11
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c11
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c11
-rw-r--r--arch/arm/mach-at91/board-csb337.c11
-rw-r--r--arch/arm/mach-at91/board-csb637.c11
-rw-r--r--arch/arm/mach-at91/board-eb9200.c11
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c11
-rw-r--r--arch/arm/mach-at91/board-eco920.c11
-rw-r--r--arch/arm/mach-at91/board-flexibity.c11
-rw-r--r--arch/arm/mach-at91/board-foxg20.c12
-rw-r--r--arch/arm/mach-at91/board-gsia18s.c9
-rw-r--r--arch/arm/mach-at91/board-kafa.c11
-rw-r--r--arch/arm/mach-at91/board-kb9202.c11
-rw-r--r--arch/arm/mach-at91/board-neocore926.c12
-rw-r--r--arch/arm/mach-at91/board-pcontrol-g20.c11
-rw-r--r--arch/arm/mach-at91/board-picotux200.c11
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c12
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c11
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c11
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c12
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c12
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c12
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c12
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c16
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c12
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c12
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c11
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c16
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c12
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c12
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c12
-rw-r--r--arch/arm/mach-at91/generic.h34
-rw-r--r--arch/arm/mach-at91/include/mach/at91_dbgu.h27
-rw-r--r--arch/arm/mach-at91/include/mach/at91_wdt.h37
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9.h1
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200.h1
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260.h1
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261.h1
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9263.h1
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9g45.h1
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl.h1
-rw-r--r--arch/arm/mach-at91/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h159
-rw-r--r--arch/arm/mach-at91/include/mach/debug-macro.S14
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h14
-rw-r--r--arch/arm/mach-at91/include/mach/io.h11
-rw-r--r--arch/arm/mach-at91/pm.c2
-rw-r--r--arch/arm/mach-at91/setup.c297
-rw-r--r--arch/arm/mach-at91/soc.h59
-rw-r--r--arch/arm/mach-bcmring/dma.c2
-rw-r--r--arch/arm/mach-bcmring/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-bcmring/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c3
-rw-r--r--arch/arm/mach-cns3xxx/core.c43
-rw-r--r--arch/arm/mach-cns3xxx/core.h6
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/entry-macro.S1
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/hardware.h22
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/pm.h2
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/system.h1
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/uncompress.h1
-rw-r--r--arch/arm/mach-cns3xxx/pcie.c7
-rw-r--r--arch/arm/mach-cns3xxx/pm.c2
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c35
-rw-r--r--arch/arm/mach-davinci/clock.c8
-rw-r--r--arch/arm/mach-davinci/clock.h1
-rw-r--r--arch/arm/mach-davinci/da850.c10
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c126
-rw-r--r--arch/arm/mach-davinci/include/mach/clkdev.h15
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/psc.h5
-rw-r--r--arch/arm/mach-davinci/psc.c14
-rw-r--r--arch/arm/mach-davinci/sleep.S6
-rw-r--r--arch/arm/mach-dove/include/mach/hardware.h7
-rw-r--r--arch/arm/mach-dove/pcie.c5
-rw-r--r--arch/arm/mach-ep93xx/include/mach/clkdev.h11
-rw-r--r--arch/arm/mach-ep93xx/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-ep93xx/include/mach/ts72xx.h26
-rw-r--r--arch/arm/mach-exynos4/Kconfig30
-rw-r--r--arch/arm/mach-exynos4/Makefile11
-rw-r--r--arch/arm/mach-exynos4/clock.c63
-rw-r--r--arch/arm/mach-exynos4/cpu.c50
-rw-r--r--arch/arm/mach-exynos4/dev-audio.c2
-rw-r--r--arch/arm/mach-exynos4/dev-dwmci.c82
-rw-r--r--arch/arm/mach-exynos4/hotplug.c13
-rw-r--r--arch/arm/mach-exynos4/include/mach/dwmci.h20
-rw-r--r--arch/arm/mach-exynos4/include/mach/entry-macro.S11
-rw-r--r--arch/arm/mach-exynos4/include/mach/irqs.h195
-rw-r--r--arch/arm/mach-exynos4/include/mach/map.h19
-rw-r--r--arch/arm/mach-exynos4/include/mach/pm-core.h10
-rw-r--r--arch/arm/mach-exynos4/include/mach/pmu.h25
-rw-r--r--arch/arm/mach-exynos4/include/mach/regs-audss.h18
-rw-r--r--arch/arm/mach-exynos4/include/mach/regs-clock.h12
-rw-r--r--arch/arm/mach-exynos4/include/mach/regs-pmu.h3
-rw-r--r--arch/arm/mach-exynos4/irq-eint.c7
-rw-r--r--arch/arm/mach-exynos4/localtimer.c26
-rw-r--r--arch/arm/mach-exynos4/mach-nuri.c753
-rw-r--r--arch/arm/mach-exynos4/mach-smdkc210.c70
-rw-r--r--arch/arm/mach-exynos4/mach-smdkv310.c3
-rw-r--r--arch/arm/mach-exynos4/mach-universal_c210.c125
-rw-r--r--arch/arm/mach-exynos4/mct.c2
-rw-r--r--arch/arm/mach-exynos4/platsmp.c57
-rw-r--r--arch/arm/mach-exynos4/pm.c273
-rw-r--r--arch/arm/mach-exynos4/pmu.c175
-rw-r--r--arch/arm/mach-exynos4/setup-fimd0.c43
-rw-r--r--arch/arm/mach-exynos4/setup-usb-phy.c2
-rw-r--r--arch/arm/mach-exynos4/time.c301
-rw-r--r--arch/arm/mach-footbridge/Kconfig1
-rw-r--r--arch/arm/mach-footbridge/cats-pci.c2
-rw-r--r--arch/arm/mach-footbridge/dc21285.c4
-rw-r--r--arch/arm/mach-footbridge/ebsa285-pci.c2
-rw-r--r--arch/arm/mach-footbridge/include/mach/hardware.h5
-rw-r--r--arch/arm/mach-footbridge/netwinder-pci.c2
-rw-r--r--arch/arm/mach-footbridge/personal-pci.c3
-rw-r--r--arch/arm/mach-imx/Kconfig1
-rw-r--r--arch/arm/mach-imx/clock-imx1.c6
-rw-r--r--arch/arm/mach-imx/clock-imx21.c8
-rw-r--r--arch/arm/mach-imx/clock-imx25.c23
-rw-r--r--arch/arm/mach-imx/clock-imx27.c15
-rw-r--r--arch/arm/mach-imx/clock-imx31.c13
-rw-r--r--arch/arm/mach-imx/clock-imx35.c18
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c3
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c3
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c2
-rw-r--r--arch/arm/mach-imx/mach-cpuimx35.c2
-rw-r--r--arch/arm/mach-imx/mach-eukrea_cpuimx25.c2
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c13
-rw-r--r--arch/arm/mach-imx/mach-mx25_3ds.c2
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c93
-rw-r--r--arch/arm/mach-imx/mach-mx31ads.c4
-rw-r--r--arch/arm/mach-imx/mach-mx31lilly.c2
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c2
-rw-r--r--arch/arm/mach-imx/mm-imx21.c3
-rw-r--r--arch/arm/mach-imx/mm-imx25.c25
-rw-r--r--arch/arm/mach-imx/mm-imx27.c3
-rw-r--r--arch/arm/mach-imx/mm-imx31.c26
-rw-r--r--arch/arm/mach-imx/mm-imx35.c46
-rw-r--r--arch/arm/mach-integrator/include/mach/hardware.h7
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c6
-rw-r--r--arch/arm/mach-integrator/pci.c2
-rw-r--r--arch/arm/mach-integrator/pci_v3.c5
-rw-r--r--arch/arm/mach-iop13xx/include/mach/hardware.h7
-rw-r--r--arch/arm/mach-iop13xx/iq81340mc.c2
-rw-r--r--arch/arm/mach-iop13xx/pci.c7
-rw-r--r--arch/arm/mach-iop32x/em7210.c2
-rw-r--r--arch/arm/mach-iop32x/glantank.c2
-rw-r--r--arch/arm/mach-iop32x/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-iop32x/iq31244.c4
-rw-r--r--arch/arm/mach-iop32x/iq80321.c2
-rw-r--r--arch/arm/mach-iop32x/n2100.c2
-rw-r--r--arch/arm/mach-iop33x/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-iop33x/iq80331.c2
-rw-r--r--arch/arm/mach-iop33x/iq80332.c2
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c3
-rw-r--r--arch/arm/mach-ixp2000/include/mach/hardware.h8
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c3
-rw-r--r--arch/arm/mach-ixp2000/ixdp2800.c3
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c3
-rw-r--r--arch/arm/mach-ixp2000/pci.c5
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c2
-rw-r--r--arch/arm/mach-ixp23xx/pci.c5
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c3
-rw-r--r--arch/arm/mach-ixp4xx/avila-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c5
-rw-r--r--arch/arm/mach-ixp4xx/coyote-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/fsg-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/gateway7001-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/goramo_mlr.c2
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/hardware.h5
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixdpg425-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/vulcan-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/wg302v2-pci.c2
-rw-r--r--arch/arm/mach-kirkwood/include/mach/hardware.h7
-rw-r--r--arch/arm/mach-kirkwood/pcie.c6
-rw-r--r--arch/arm/mach-ks8695/board-dsm320.c2
-rw-r--r--arch/arm/mach-ks8695/board-micrel.c2
-rw-r--r--arch/arm/mach-ks8695/include/mach/devices.h2
-rw-r--r--arch/arm/mach-ks8695/include/mach/hardware.h9
-rw-r--r--arch/arm/mach-ks8695/pci.c3
-rw-r--r--arch/arm/mach-lpc32xx/clock.c2
-rw-r--r--arch/arm/mach-lpc32xx/common.c42
-rw-r--r--arch/arm/mach-lpc32xx/common.h2
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/clkdev.h25
-rw-r--r--arch/arm/mach-mmp/Kconfig7
-rw-r--r--arch/arm/mach-mmp/Makefile1
-rw-r--r--arch/arm/mach-mmp/clock.c15
-rw-r--r--arch/arm/mach-mmp/clock.h1
-rw-r--r--arch/arm/mach-mmp/gplugd.c197
-rw-r--r--arch/arm/mach-mmp/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-pxa168.h56
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa168.h8
-rw-r--r--arch/arm/mach-mmp/include/mach/regs-apmu.h1
-rw-r--r--arch/arm/mach-mmp/pxa168.c6
-rw-r--r--arch/arm/mach-mmp/time.c62
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c31
-rw-r--r--arch/arm/mach-msm/Kconfig4
-rw-r--r--arch/arm/mach-msm/Makefile8
-rw-r--r--arch/arm/mach-msm/gpio-v2.c433
-rw-r--r--arch/arm/mach-msm/gpio.c376
-rw-r--r--arch/arm/mach-msm/gpio_hw.h278
-rw-r--r--arch/arm/mach-msm/gpiomux.h17
-rw-r--r--arch/arm/mach-msm/include/mach/msm_gpiomux.h (renamed from arch/arm/mach-msm/include/mach/clkdev.h)29
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-7x00.h10
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-7x30.h10
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-8x50.h10
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap.h2
-rw-r--r--arch/arm/mach-msm/io.c12
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/hardware.h7
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c6
-rw-r--r--arch/arm/mach-mx5/Kconfig14
-rw-r--r--arch/arm/mach-mx5/Makefile2
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c2
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c26
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikamx.c6
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikasb.c15
-rw-r--r--arch/arm/mach-mx5/board-mx53_ard.c254
-rw-r--r--arch/arm/mach-mx5/board-mx53_evk.c17
-rw-r--r--arch/arm/mach-mx5/board-mx53_loco.c39
-rw-r--r--arch/arm/mach-mx5/clock-mx51-mx53.c64
-rw-r--r--arch/arm/mach-mx5/crm_regs.h2
-rw-r--r--arch/arm/mach-mx5/devices-imx53.h8
-rw-r--r--arch/arm/mach-mx5/mm.c44
-rw-r--r--arch/arm/mach-mx5/mx51_efika.c6
-rw-r--r--arch/arm/mach-mx5/pm-imx5.c73
-rw-r--r--arch/arm/mach-mxs/Kconfig2
-rw-r--r--arch/arm/mach-mxs/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c21
-rw-r--r--arch/arm/mach-mxs/mach-tx28.c6
-rw-r--r--arch/arm/mach-nomadik/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-nuc93x/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-omap1/include/mach/clkdev.h5
-rw-r--r--arch/arm/mach-omap1/pm.c2
-rw-r--r--arch/arm/mach-omap2/Kconfig7
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c203
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c2
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c95
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c101
-rw-r--r--arch/arm/mach-omap2/board-overo.c1
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c147
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c9
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c10
-rw-r--r--arch/arm/mach-omap2/clock.c28
-rw-r--r--arch/arm/mach-omap2/clock.h3
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c22
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c32
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c46
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c271
-rw-r--r--arch/arm/mach-omap2/clockdomain.c212
-rw-r--r--arch/arm/mach-omap2/clockdomain.h11
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c6
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c13
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/cm-regbits-44xx.h36
-rw-r--r--arch/arm/mach-omap2/cm44xx.h8
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c150
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h33
-rw-r--r--arch/arm/mach-omap2/devices.c3
-rw-r--r--arch/arm/mach-omap2/display.c26
-rw-r--r--arch/arm/mach-omap2/hsmmc.c7
-rw-r--r--arch/arm/mach-omap2/i2c.c68
-rw-r--r--arch/arm/mach-omap2/id.c53
-rw-r--r--arch/arm/mach-omap2/include/mach/clkdev.h5
-rw-r--r--arch/arm/mach-omap2/iommu2.c4
-rw-r--r--arch/arm/mach-omap2/mux.c14
-rw-r--r--arch/arm/mach-omap2/omap-iommu.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c261
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c9
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c18
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c491
-rw-r--r--arch/arm/mach-omap2/pm.c8
-rw-r--r--arch/arm/mach-omap2/powerdomain.c25
-rw-r--r--arch/arm/mach-omap2/powerdomains44xx_data.c9
-rw-r--r--arch/arm/mach-omap2/prcm.c2
-rw-r--r--arch/arm/mach-omap2/prm-regbits-44xx.h8
-rw-r--r--arch/arm/mach-omap2/prm44xx.c145
-rw-r--r--arch/arm/mach-omap2/prm44xx.h10
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c112
-rw-r--r--arch/arm/mach-omap2/prminst44xx.h12
-rw-r--r--arch/arm/mach-omap2/smartreflex.c3
-rw-r--r--arch/arm/mach-omap2/timer.c3
-rw-r--r--arch/arm/mach-omap2/twl-common.c84
-rw-r--r--arch/arm/mach-orion5x/common.h2
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c3
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c2
-rw-r--r--arch/arm/mach-orion5x/include/mach/hardware.h7
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c3
-rw-r--r--arch/arm/mach-orion5x/mss2-setup.c2
-rw-r--r--arch/arm/mach-orion5x/pci.c5
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c2
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c2
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c3
-rw-r--r--arch/arm/mach-orion5x/terastation_pro2-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c3
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c3
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c3
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c3
-rw-r--r--arch/arm/mach-pnx4008/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-prima2/Makefile7
-rw-r--r--arch/arm/mach-prima2/Makefile.boot3
-rw-r--r--arch/arm/mach-prima2/clock.c510
-rw-r--r--arch/arm/mach-prima2/common.h26
-rw-r--r--arch/arm/mach-prima2/include/mach/clkdev.h15
-rw-r--r--arch/arm/mach-prima2/include/mach/debug-macro.S29
-rw-r--r--arch/arm/mach-prima2/include/mach/entry-macro.S29
-rw-r--r--arch/arm/mach-prima2/include/mach/hardware.h15
-rw-r--r--arch/arm/mach-prima2/include/mach/io.h16
-rw-r--r--arch/arm/mach-prima2/include/mach/irqs.h17
-rw-r--r--arch/arm/mach-prima2/include/mach/map.h16
-rw-r--r--arch/arm/mach-prima2/include/mach/memory.h21
-rw-r--r--arch/arm/mach-prima2/include/mach/system.h29
-rw-r--r--arch/arm/mach-prima2/include/mach/timex.h14
-rw-r--r--arch/arm/mach-prima2/include/mach/uart.h23
-rw-r--r--arch/arm/mach-prima2/include/mach/uncompress.h40
-rw-r--r--arch/arm/mach-prima2/include/mach/vmalloc.h16
-rw-r--r--arch/arm/mach-prima2/irq.c72
-rw-r--r--arch/arm/mach-prima2/l2x0.c59
-rw-r--r--arch/arm/mach-prima2/lluart.c25
-rw-r--r--arch/arm/mach-prima2/prima2.c41
-rw-r--r--arch/arm/mach-prima2/rstc.c70
-rw-r--r--arch/arm/mach-prima2/timer.c218
-rw-r--r--arch/arm/mach-pxa/balloon3.c1
-rw-r--r--arch/arm/mach-pxa/capc7117.c1
-rw-r--r--arch/arm/mach-pxa/clock.c15
-rw-r--r--arch/arm/mach-pxa/clock.h1
-rw-r--r--arch/arm/mach-pxa/cm-x2xx-pci.c5
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c5
-rw-r--r--arch/arm/mach-pxa/cm-x300.c1
-rw-r--r--arch/arm/mach-pxa/colibri-pxa270.c2
-rw-r--r--arch/arm/mach-pxa/colibri-pxa300.c1
-rw-r--r--arch/arm/mach-pxa/colibri-pxa320.c4
-rw-r--r--arch/arm/mach-pxa/corgi.c3
-rw-r--r--arch/arm/mach-pxa/csb726.c4
-rw-r--r--arch/arm/mach-pxa/em-x270.c2
-rw-r--r--arch/arm/mach-pxa/eseries.c6
-rw-r--r--arch/arm/mach-pxa/ezx.c6
-rw-r--r--arch/arm/mach-pxa/generic.h13
-rw-r--r--arch/arm/mach-pxa/gumstix.c1
-rw-r--r--arch/arm/mach-pxa/h5000.c2
-rw-r--r--arch/arm/mach-pxa/himalaya.c4
-rw-r--r--arch/arm/mach-pxa/hx4700.c1
-rw-r--r--arch/arm/mach-pxa/icontrol.c1
-rw-r--r--arch/arm/mach-pxa/idp.c1
-rw-r--r--arch/arm/mach-pxa/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-pxa/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h12
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa25x.h9
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa27x.h5
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa300.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa320.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa3xx.h14
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa930.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-intc.h30
-rw-r--r--arch/arm/mach-pxa/irq.c36
-rw-r--r--arch/arm/mach-pxa/littleton.c1
-rw-r--r--arch/arm/mach-pxa/lpd270.c1
-rw-r--r--arch/arm/mach-pxa/lubbock.c1
-rw-r--r--arch/arm/mach-pxa/magician.c1
-rw-r--r--arch/arm/mach-pxa/mainstone.c1
-rw-r--r--arch/arm/mach-pxa/mioa701.c1
-rw-r--r--arch/arm/mach-pxa/mp900.c1
-rw-r--r--arch/arm/mach-pxa/palmld.c1
-rw-r--r--arch/arm/mach-pxa/palmt5.c1
-rw-r--r--arch/arm/mach-pxa/palmtc.c4
-rw-r--r--arch/arm/mach-pxa/palmte2.c3
-rw-r--r--arch/arm/mach-pxa/palmtreo.c2
-rw-r--r--arch/arm/mach-pxa/palmtx.c1
-rw-r--r--arch/arm/mach-pxa/palmz72.c1
-rw-r--r--arch/arm/mach-pxa/pcm027.c1
-rw-r--r--arch/arm/mach-pxa/poodle.c1
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c5
-rw-r--r--arch/arm/mach-pxa/pxa95x.c1
-rw-r--r--arch/arm/mach-pxa/raumfeld.c8
-rw-r--r--arch/arm/mach-pxa/saar.c1
-rw-r--r--arch/arm/mach-pxa/saarb.c1
-rw-r--r--arch/arm/mach-pxa/spitz.c3
-rw-r--r--arch/arm/mach-pxa/stargate2.c2
-rw-r--r--arch/arm/mach-pxa/tavorevb.c1
-rw-r--r--arch/arm/mach-pxa/tavorevb3.c1
-rw-r--r--arch/arm/mach-pxa/tosa.c1
-rw-r--r--arch/arm/mach-pxa/trizeps4.c2
-rw-r--r--arch/arm/mach-pxa/viper.c1
-rw-r--r--arch/arm/mach-pxa/vpac270.c1
-rw-r--r--arch/arm/mach-pxa/xcep.c4
-rw-r--r--arch/arm/mach-pxa/z2.c18
-rw-r--r--arch/arm/mach-pxa/zeus.c4
-rw-r--r--arch/arm/mach-pxa/zylonite.c3
-rw-r--r--arch/arm/mach-realview/include/mach/system.h1
-rw-r--r--arch/arm/mach-s3c2410/include/mach/pm-core.h3
-rw-r--r--arch/arm/mach-s3c2440/clock.c2
-rw-r--r--arch/arm/mach-s3c2440/s3c2442.c2
-rw-r--r--arch/arm/mach-s3c2440/s3c244x-clock.c2
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig23
-rw-r--r--arch/arm/mach-s3c64xx/Makefile1
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/pm-core.h19
-rw-r--r--arch/arm/mach-s3c64xx/irq.c12
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c774
-rw-r--r--arch/arm/mach-s3c64xx/pm.c1
-rw-r--r--arch/arm/mach-s5p64x0/Makefile2
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-gpio.h10
-rw-r--r--arch/arm/mach-s5p64x0/irq-eint.c152
-rw-r--r--arch/arm/mach-s5pv210/Kconfig1
-rw-r--r--arch/arm/mach-s5pv210/clock.c7
-rw-r--r--arch/arm/mach-s5pv210/cpu.c2
-rw-r--r--arch/arm/mach-s5pv210/dev-audio.c2
-rw-r--r--arch/arm/mach-s5pv210/include/mach/map.h3
-rw-r--r--arch/arm/mach-s5pv210/include/mach/pm-core.h3
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-audss.h18
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c10
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c1
-rw-r--r--arch/arm/mach-s5pv210/pm.c2
-rw-r--r--arch/arm/mach-sa1100/include/mach/hardware.h8
-rw-r--r--arch/arm/mach-sa1100/pci-nanoengine.c7
-rw-r--r--arch/arm/mach-shark/include/mach/hardware.h6
-rw-r--r--arch/arm/mach-shark/pci.c14
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c3
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c13
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c18
-rw-r--r--arch/arm/mach-shmobile/clock-sh7367.c3
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c35
-rw-r--r--arch/arm/mach-shmobile/clock-sh7377.c3
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c6
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h4
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c7
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c176
-rw-r--r--arch/arm/mach-spear3xx/include/mach/clkdev.h19
-rw-r--r--arch/arm/mach-spear6xx/include/mach/clkdev.h19
-rw-r--r--arch/arm/mach-tegra/Kconfig12
-rw-r--r--arch/arm/mach-tegra/Makefile3
-rw-r--r--arch/arm/mach-tegra/Makefile.boot3
-rw-r--r--arch/arm/mach-tegra/board-dt.c119
-rw-r--r--arch/arm/mach-tegra/board-harmony.c22
-rw-r--r--arch/arm/mach-tegra/board-paz00-pinmux.c10
-rw-r--r--arch/arm/mach-tegra/board-paz00.c31
-rw-r--r--arch/arm/mach-tegra/board-paz00.h10
-rw-r--r--arch/arm/mach-tegra/board-seaboard.c26
-rw-r--r--arch/arm/mach-tegra/board-trimslice-pinmux.c7
-rw-r--r--arch/arm/mach-tegra/board-trimslice.c56
-rw-r--r--arch/arm/mach-tegra/board-trimslice.h3
-rw-r--r--arch/arm/mach-tegra/devices.c53
-rw-r--r--arch/arm/mach-tegra/include/mach/barriers.h30
-rw-r--r--arch/arm/mach-tegra/include/mach/system.h1
-rw-r--r--arch/arm/mach-tegra/io.c1
-rw-r--r--arch/arm/mach-tegra/pcie.c4
-rw-r--r--arch/arm/mach-tegra/platsmp.c3
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c4
-rw-r--r--arch/arm/mach-u300/spi.c4
-rw-r--r--arch/arm/mach-u300/timer.c33
-rw-r--r--arch/arm/mach-ux500/Kconfig15
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c43
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c9
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c61
-rw-r--r--arch/arm/mach-ux500/board-mop500-uib.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500.c154
-rw-r--r--arch/arm/mach-ux500/board-mop500.h5
-rw-r--r--arch/arm/mach-ux500/clock.c48
-rw-r--r--arch/arm/mach-ux500/cpu-db5500.c1
-rw-r--r--arch/arm/mach-ux500/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-ux500/include/mach/uncompress.h3
-rw-r--r--arch/arm/mach-ux500/usb.c1
-rw-r--r--arch/arm/mach-versatile/Kconfig8
-rw-r--r--arch/arm/mach-versatile/Makefile1
-rw-r--r--arch/arm/mach-versatile/core.c62
-rw-r--r--arch/arm/mach-versatile/core.h4
-rw-r--r--arch/arm/mach-versatile/include/mach/hardware.h6
-rw-r--r--arch/arm/mach-versatile/pci.c5
-rw-r--r--arch/arm/mach-versatile/versatile_dt.c51
-rw-r--r--arch/arm/mach-vexpress/v2m.c7
-rw-r--r--arch/arm/mach-w90x900/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-zynq/Makefile6
-rw-r--r--arch/arm/mach-zynq/Makefile.boot3
-rw-r--r--arch/arm/mach-zynq/common.c118
-rw-r--r--arch/arm/mach-zynq/common.h (renamed from arch/arm/mach-tegra/include/mach/hardware.h)20
-rw-r--r--arch/arm/mach-zynq/include/mach/clkdev.h32
-rw-r--r--arch/arm/mach-zynq/include/mach/debug-macro.S36
-rw-r--r--arch/arm/mach-zynq/include/mach/entry-macro.S30
-rw-r--r--arch/arm/mach-zynq/include/mach/hardware.h18
-rw-r--r--arch/arm/mach-zynq/include/mach/io.h33
-rw-r--r--arch/arm/mach-zynq/include/mach/irqs.h21
-rw-r--r--arch/arm/mach-zynq/include/mach/memory.h22
-rw-r--r--arch/arm/mach-zynq/include/mach/system.h (renamed from arch/arm/mach-tegra/include/mach/clkdev.h)22
-rw-r--r--arch/arm/mach-zynq/include/mach/timex.h23
-rw-r--r--arch/arm/mach-zynq/include/mach/uart.h25
-rw-r--r--arch/arm/mach-zynq/include/mach/uncompress.h51
-rw-r--r--arch/arm/mach-zynq/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-zynq/include/mach/zynq_soc.h48
-rw-r--r--arch/arm/mach-zynq/timer.c298
-rw-r--r--arch/arm/mm/Kconfig3
-rw-r--r--arch/arm/mm/abort-macro.S2
-rw-r--r--arch/arm/mm/alignment.c56
-rw-r--r--arch/arm/mm/cache-l2x0.c21
-rw-r--r--arch/arm/mm/init.c4
-rw-r--r--arch/arm/mm/iomap.c12
-rw-r--r--arch/arm/mm/proc-arm920.S2
-rw-r--r--arch/arm/mm/proc-arm926.S2
-rw-r--r--arch/arm/mm/proc-arm946.S3
-rw-r--r--arch/arm/mm/proc-sa1100.S10
-rw-r--r--arch/arm/mm/proc-v6.S16
-rw-r--r--arch/arm/mm/proc-v7.S6
-rw-r--r--arch/arm/mm/proc-xsc3.S7
-rw-r--r--arch/arm/plat-iop/pci.c3
-rw-r--r--arch/arm/plat-mxc/devices.c16
-rw-r--r--arch/arm/plat-mxc/devices/platform-fec.c21
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-dma.c204
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-i2c.c3
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-keypad.c5
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-ssi.c10
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-uart.c9
-rw-r--r--arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c29
-rw-r--r--arch/arm/plat-mxc/include/mach/clkdev.h7
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S8
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h8
-rw-r--r--arch/arm/plat-mxc/include/mach/dma.h3
-rw-r--r--arch/arm/plat-mxc/include/mach/esdhc.h25
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx53.h31
-rw-r--r--arch/arm/plat-mxc/include/mach/mx53.h28
-rw-r--r--arch/arm/plat-mxc/include/mach/sdma.h8
-rw-r--r--arch/arm/plat-mxc/include/mach/uncompress.h1
-rw-r--r--arch/arm/plat-mxc/irq-common.c13
-rw-r--r--arch/arm/plat-mxc/tzic.c97
-rw-r--r--arch/arm/plat-omap/Kconfig1
-rw-r--r--arch/arm/plat-omap/clock.c39
-rw-r--r--arch/arm/plat-omap/dmtimer.c4
-rw-r--r--arch/arm/plat-omap/include/plat/clkdev.h13
-rw-r--r--arch/arm/plat-omap/include/plat/clkdev_omap.h1
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h2
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h35
-rw-r--r--arch/arm/plat-omap/include/plat/dma.h5
-rw-r--r--arch/arm/plat-omap/include/plat/i2c.h6
-rw-r--r--arch/arm/plat-omap/include/plat/irqs.h13
-rw-r--r--arch/arm/plat-omap/include/plat/omap4-keypad.h3
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h15
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h3
-rw-r--r--arch/arm/plat-omap/include/plat/uncompress.h1
-rw-r--r--arch/arm/plat-omap/iovmm.c9
-rw-r--r--arch/arm/plat-omap/mcbsp.c27
-rw-r--r--arch/arm/plat-omap/omap_device.c91
-rw-r--r--arch/arm/plat-s5p/Kconfig11
-rw-r--r--arch/arm/plat-s5p/Makefile3
-rw-r--r--arch/arm/plat-s5p/clock.c2
-rw-r--r--arch/arm/plat-s5p/dev-fimd0.c67
-rw-r--r--arch/arm/plat-s5p/dev-mfc.c123
-rw-r--r--arch/arm/plat-s5p/include/plat/map-s5p.h5
-rw-r--r--arch/arm/plat-s5p/include/plat/mfc.h27
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c6
-rw-r--r--arch/arm/plat-samsung/adc.c84
-rw-r--r--arch/arm/plat-samsung/dev-asocdma.c10
-rw-r--r--arch/arm/plat-samsung/include/plat/audio.h1
-rw-r--r--arch/arm/plat-samsung/include/plat/backlight.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h6
-rw-r--r--arch/arm/plat-samsung/include/plat/fb-core.h15
-rw-r--r--arch/arm/plat-samsung/include/plat/fb.h15
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-adc.h1
-rw-r--r--arch/arm/plat-samsung/irq-uart.c7
-rw-r--r--arch/arm/plat-samsung/irq-vic-timer.c5
-rw-r--r--arch/arm/plat-samsung/pm.c2
-rw-r--r--arch/arm/plat-spear/include/plat/clkdev.h20
-rw-r--r--arch/arm/plat-tcc/include/mach/clkdev.h7
-rw-r--r--arch/arm/tools/mach-types8
-rw-r--r--arch/avr32/Kconfig1
-rw-r--r--arch/avr32/include/asm/atomic.h60
-rw-r--r--arch/avr32/include/asm/ptrace.h2
-rw-r--r--arch/avr32/kernel/syscall_table.S2
-rw-r--r--arch/blackfin/include/asm/atomic.h8
-rw-r--r--arch/blackfin/include/asm/dma.h2
-rw-r--r--arch/blackfin/include/asm/ipipe.h2
-rw-r--r--arch/blackfin/include/asm/ptrace.h1
-rw-r--r--arch/blackfin/include/asm/spinlock.h2
-rw-r--r--arch/blackfin/kernel/ftrace.c2
-rw-r--r--arch/blackfin/kernel/ipipe.c2
-rw-r--r--arch/blackfin/kernel/nmi.c2
-rw-r--r--arch/blackfin/mach-common/entry.S2
-rw-r--r--arch/blackfin/mach-common/smp.c2
-rw-r--r--arch/cris/arch-v10/drivers/sync_serial.c6
-rw-r--r--arch/cris/arch-v10/kernel/entry.S2
-rw-r--r--arch/cris/arch-v10/kernel/irq.c3
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c2
-rw-r--r--arch/cris/arch-v32/kernel/entry.S2
-rw-r--r--arch/cris/arch-v32/kernel/smp.c2
-rw-r--r--arch/cris/include/arch-v10/arch/ptrace.h1
-rw-r--r--arch/cris/include/arch-v32/arch/ptrace.h1
-rw-r--r--arch/cris/include/asm/atomic.h6
-rw-r--r--arch/cris/include/asm/bitops.h5
-rw-r--r--arch/cris/include/asm/serial.h9
-rw-r--r--arch/cris/include/asm/thread_info.h6
-rw-r--r--arch/cris/kernel/process.c2
-rw-r--r--arch/frv/Kconfig1
-rw-r--r--arch/frv/include/asm/atomic.h6
-rw-r--r--arch/frv/include/asm/bitops.h3
-rw-r--r--arch/frv/include/asm/hardirq.h2
-rw-r--r--arch/frv/include/asm/processor.h1
-rw-r--r--arch/frv/include/asm/ptrace.h1
-rw-r--r--arch/frv/kernel/entry.S2
-rw-r--r--arch/frv/kernel/irq.c2
-rw-r--r--arch/frv/kernel/process.c5
-rw-r--r--arch/frv/mm/pgalloc.c8
-rw-r--r--arch/h8300/include/asm/atomic.h6
-rw-r--r--arch/h8300/include/asm/posix_types.h2
-rw-r--r--arch/h8300/include/asm/ptrace.h1
-rw-r--r--arch/h8300/kernel/syscalls.S2
-rw-r--r--arch/ia64/Kconfig6
-rw-r--r--arch/ia64/configs/generic_defconfig1
-rw-r--r--arch/ia64/include/asm/atomic.h6
-rw-r--r--arch/ia64/include/asm/bitops.h3
-rw-r--r--arch/ia64/include/asm/gpio.h55
-rw-r--r--arch/ia64/include/asm/processor.h2
-rw-r--r--arch/ia64/include/asm/ptrace.h1
-rw-r--r--arch/ia64/include/asm/spinlock.h2
-rw-r--r--arch/ia64/kernel/efi.c2
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/smp.c2
-rw-r--r--arch/ia64/kernel/smpboot.c2
-rw-r--r--arch/ia64/kernel/uncached.c2
-rw-r--r--arch/m32r/include/asm/atomic.h10
-rw-r--r--arch/m32r/include/asm/mmu_context.h2
-rw-r--r--arch/m32r/include/asm/ptrace.h2
-rw-r--r--arch/m32r/include/asm/spinlock.h2
-rw-r--r--arch/m32r/kernel/smp.c2
-rw-r--r--arch/m32r/kernel/syscall_table.S2
-rw-r--r--arch/m32r/kernel/traps.c2
-rw-r--r--arch/m68k/Kconfig1
-rw-r--r--arch/m68k/Kconfig.mmu6
-rw-r--r--arch/m68k/amiga/chipram.c136
-rw-r--r--arch/m68k/atari/stram.c354
-rw-r--r--arch/m68k/include/asm/atari_stram.h3
-rw-r--r--arch/m68k/include/asm/atarihw.h4
-rw-r--r--arch/m68k/include/asm/atomic.h7
-rw-r--r--arch/m68k/include/asm/page_mm.h2
-rw-r--r--arch/m68k/include/asm/posix_types.h2
-rw-r--r--arch/m68k/include/asm/ptrace.h1
-rw-r--r--arch/m68k/kernel/setup_mm.c2
-rw-r--r--arch/m68k/kernel/syscalltable.S2
-rw-r--r--arch/m68k/math-emu/fp_log.c3
-rw-r--r--arch/m68k/math-emu/multi_arith.h530
-rw-r--r--arch/m68k/mm/init_mm.c5
-rw-r--r--arch/microblaze/include/asm/cpuinfo.h1
-rw-r--r--arch/microblaze/include/asm/irqflags.h20
-rw-r--r--arch/microblaze/include/asm/mmu_context_mm.h2
-rw-r--r--arch/microblaze/include/asm/pci-bridge.h64
-rw-r--r--arch/microblaze/include/asm/processor.h3
-rw-r--r--arch/microblaze/include/asm/prom.h10
-rw-r--r--arch/microblaze/include/asm/ptrace.h2
-rw-r--r--arch/microblaze/include/asm/pvr.h5
-rw-r--r--arch/microblaze/include/asm/setup.h1
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c1
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-static.c1
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo.c4
-rw-r--r--arch/microblaze/kernel/cpu/mb.c9
-rw-r--r--arch/microblaze/kernel/early_printk.c68
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S56
-rw-r--r--arch/microblaze/kernel/intc.c2
-rw-r--r--arch/microblaze/kernel/process.c1
-rw-r--r--arch/microblaze/kernel/prom.c97
-rw-r--r--arch/microblaze/kernel/setup.c5
-rw-r--r--arch/microblaze/kernel/syscall_table.S2
-rw-r--r--arch/mips/Kbuild.platforms1
-rw-r--r--arch/mips/Makefile12
-rw-r--r--arch/mips/ar7/clock.c2
-rw-r--r--arch/mips/ar7/platform.c2
-rw-r--r--arch/mips/ar7/prom.c2
-rw-r--r--arch/mips/include/asm/atomic.h17
-rw-r--r--arch/mips/include/asm/fixmap.h10
-rw-r--r--arch/mips/include/asm/gt64120.h2
-rw-r--r--arch/mips/include/asm/hw_irq.h2
-rw-r--r--arch/mips/include/asm/irq.h1
-rw-r--r--arch/mips/include/asm/local.h2
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h1
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/spaces.h17
-rw-r--r--arch/mips/include/asm/mach-generic/dma-coherence.h1
-rw-r--r--arch/mips/include/asm/mach-generic/spaces.h4
-rw-r--r--arch/mips/include/asm/mach-ip27/dma-coherence.h1
-rw-r--r--arch/mips/include/asm/mach-jazz/dma-coherence.h1
-rw-r--r--arch/mips/include/asm/mach-loongson/dma-coherence.h1
-rw-r--r--arch/mips/include/asm/mach-malta/cpu-feature-overrides.h2
-rw-r--r--arch/mips/include/asm/mach-mipssim/cpu-feature-overrides.h2
-rw-r--r--arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h59
-rw-r--r--arch/mips/include/asm/mach-powertv/dma-coherence.h1
-rw-r--r--arch/mips/include/asm/mach-tx39xx/spaces.h17
-rw-r--r--arch/mips/include/asm/mach-tx49xx/spaces.h17
-rw-r--r--arch/mips/include/asm/pgtable.h1
-rw-r--r--arch/mips/include/asm/smp-ops.h43
-rw-r--r--arch/mips/include/asm/smp.h2
-rw-r--r--arch/mips/include/asm/smtc.h1
-rw-r--r--arch/mips/include/asm/uasm.h2
-rw-r--r--arch/mips/include/asm/unistd.h21
-rw-r--r--arch/mips/kernel/cpu-probe.c1
-rw-r--r--arch/mips/kernel/irq.c2
-rw-r--r--arch/mips/kernel/irq_cpu.c14
-rw-r--r--arch/mips/kernel/mips-mt.c2
-rw-r--r--arch/mips/kernel/perf_event.c2
-rw-r--r--arch/mips/kernel/process.c1
-rw-r--r--arch/mips/kernel/rtlx.c2
-rw-r--r--arch/mips/kernel/scall32-o32.S3
-rw-r--r--arch/mips/kernel/scall64-64.S3
-rw-r--r--arch/mips/kernel/scall64-n32.S3
-rw-r--r--arch/mips/kernel/scall64-o32.S3
-rw-r--r--arch/mips/kernel/smp-cmp.c2
-rw-r--r--arch/mips/kernel/smp-mt.c2
-rw-r--r--arch/mips/kernel/smp.c2
-rw-r--r--arch/mips/kernel/smtc-proc.c2
-rw-r--r--arch/mips/kernel/smtc.c2
-rw-r--r--arch/mips/kernel/sync-r4k.c2
-rw-r--r--arch/mips/kernel/vpe.c2
-rw-r--r--arch/mips/lantiq/clk.c13
-rw-r--r--arch/mips/loongson/lemote-2f/ec_kb3310b.c2
-rw-r--r--arch/mips/mipssim/sim_setup.c18
-rw-r--r--arch/mips/mipssim/sim_smtc.c2
-rw-r--r--arch/mips/mm/c-r4k.c4
-rw-r--r--arch/mips/mm/dma-default.c114
-rw-r--r--arch/mips/mm/init.c8
-rw-r--r--arch/mips/mm/mmap.c193
-rw-r--r--arch/mips/mm/pgtable-32.c2
-rw-r--r--arch/mips/mm/pgtable-64.c2
-rw-r--r--arch/mips/mm/tlbex.c292
-rw-r--r--arch/mips/mti-malta/malta-init.c14
-rw-r--r--arch/mips/mti-malta/malta-smtc.c2
-rw-r--r--arch/mips/netlogic/Platform11
-rw-r--r--arch/mips/netlogic/xlr/irq.c2
-rw-r--r--arch/mips/netlogic/xlr/smp.c13
-rw-r--r--arch/mips/nxp/pnx8550/common/setup.c2
-rw-r--r--arch/mips/pci/ops-nile4.c1
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_setup.c8
-rw-r--r--arch/mips/pnx8550/common/setup.c2
-rw-r--r--arch/mips/rb532/devices.c24
-rw-r--r--arch/mips/sgi-ip27/ip27-nmi.c2
-rw-r--r--arch/mips/sibyte/sb1250/irq.c8
-rw-r--r--arch/mn10300/include/asm/atomic.h7
-rw-r--r--arch/mn10300/include/asm/bitops.h7
-rw-r--r--arch/mn10300/include/asm/mmu_context.h2
-rw-r--r--arch/mn10300/include/asm/processor.h1
-rw-r--r--arch/mn10300/include/asm/ptrace.h1
-rw-r--r--arch/mn10300/include/asm/spinlock.h2
-rw-r--r--arch/mn10300/include/asm/system.h2
-rw-r--r--arch/mn10300/kernel/entry.S2
-rw-r--r--arch/mn10300/kernel/mn10300-watchdog.c2
-rw-r--r--arch/mn10300/kernel/traps.c2
-rw-r--r--arch/mn10300/mm/misalignment.c2
-rw-r--r--arch/mn10300/proc-mn2ws0050/proc-init.c2
-rw-r--r--arch/openrisc/include/asm/dma-mapping.h59
-rw-r--r--arch/openrisc/include/asm/sigcontext.h7
-rw-r--r--arch/openrisc/kernel/dma.c28
-rw-r--r--arch/openrisc/kernel/signal.c29
-rw-r--r--arch/parisc/Kconfig1
-rw-r--r--arch/parisc/include/asm/atomic.h20
-rw-r--r--arch/parisc/include/asm/bitops.h11
-rw-r--r--arch/parisc/include/asm/futex.h66
-rw-r--r--arch/parisc/include/asm/mmu_context.h2
-rw-r--r--arch/parisc/include/asm/ptrace.h1
-rw-r--r--arch/parisc/include/asm/unistd.h3
-rw-r--r--arch/parisc/kernel/parisc_ksyms.c2
-rw-r--r--arch/parisc/kernel/smp.c2
-rw-r--r--arch/parisc/kernel/syscall_table.S3
-rw-r--r--arch/parisc/kernel/traps.c2
-rw-r--r--arch/parisc/lib/bitops.c2
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/boot/dts/p1023rds.dts2
-rw-r--r--arch/powerpc/configs/85xx/p1023rds_defconfig1
-rw-r--r--arch/powerpc/configs/corenet32_smp_defconfig1
-rw-r--r--arch/powerpc/configs/corenet64_smp_defconfig5
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig1
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig1
-rw-r--r--arch/powerpc/include/asm/atomic.h19
-rw-r--r--arch/powerpc/include/asm/bitops.h5
-rw-r--r--arch/powerpc/include/asm/emulated_ops.h2
-rw-r--r--arch/powerpc/include/asm/irq.h2
-rw-r--r--arch/powerpc/include/asm/jump_label.h2
-rw-r--r--arch/powerpc/include/asm/kdump.h10
-rw-r--r--arch/powerpc/include/asm/local.h2
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h50
-rw-r--r--arch/powerpc/include/asm/pci.h2
-rw-r--r--arch/powerpc/include/asm/prom.h2
-rw-r--r--arch/powerpc/include/asm/reg.h8
-rw-r--r--arch/powerpc/include/asm/systbl.h2
-rw-r--r--arch/powerpc/include/asm/system.h1
-rw-r--r--arch/powerpc/kernel/cputable.c11
-rw-r--r--arch/powerpc/kernel/iomap.c2
-rw-r--r--arch/powerpc/kernel/machine_kexec.c10
-rw-r--r--arch/powerpc/kernel/of_platform.c2
-rw-r--r--arch/powerpc/kernel/pci-common.c22
-rw-r--r--arch/powerpc/kernel/pci_32.c2
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/kernel/perf_callchain.c20
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c2
-rw-r--r--arch/powerpc/kernel/prom_init.c14
-rw-r--r--arch/powerpc/kernel/rtas.c2
-rw-r--r--arch/powerpc/kernel/rtas_pci.c2
-rw-r--r--arch/powerpc/kernel/rtasd.c2
-rw-r--r--arch/powerpc/kernel/smp-tbsync.c2
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S4
-rw-r--r--arch/powerpc/platforms/40x/ep405.c2
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c2
-rw-r--r--arch/powerpc/platforms/40x/walnut.c2
-rw-r--r--arch/powerpc/platforms/44x/canyonlands.c2
-rw-r--r--arch/powerpc/platforms/44x/ebony.c2
-rw-r--r--arch/powerpc/platforms/44x/ppc44x_simple.c2
-rw-r--r--arch/powerpc/platforms/44x/sam440ep.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pci.c2
-rw-r--r--arch/powerpc/platforms/82xx/pq2.c2
-rw-r--r--arch/powerpc/platforms/83xx/km83xx.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c2
-rw-r--r--arch/powerpc/platforms/83xx/sbc834x.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c2
-rw-r--r--arch/powerpc/platforms/85xx/sbc8548.c2
-rw-r--r--arch/powerpc/platforms/Kconfig2
-rw-r--r--arch/powerpc/platforms/cell/cpufreq_spudemand.c2
-rw-r--r--arch/powerpc/platforms/cell/smp.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c2
-rw-r--r--arch/powerpc/platforms/chrp/pci.c2
-rw-r--r--arch/powerpc/platforms/chrp/smp.c2
-rw-r--r--arch/powerpc/platforms/iseries/smp.c2
-rw-r--r--arch/powerpc/platforms/powermac/backlight.c2
-rw-r--r--arch/powerpc/platforms/powermac/pci.c6
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c4
-rw-r--r--arch/powerpc/platforms/pseries/io_event_irq.c8
-rw-r--r--arch/powerpc/platforms/pseries/kexec.c34
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c19
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h12
-rw-r--r--arch/powerpc/platforms/pseries/setup.c5
-rw-r--r--arch/powerpc/platforms/pseries/smp.c2
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c4
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c5
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c2
-rw-r--r--arch/powerpc/sysdev/grackle.c2
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c7
-rw-r--r--arch/powerpc/sysdev/tsi108_dev.c2
-rw-r--r--arch/s390/Kconfig9
-rw-r--r--arch/s390/include/asm/atomic.h7
-rw-r--r--arch/s390/include/asm/bitops.h5
-rw-r--r--arch/s390/include/asm/ipl.h1
-rw-r--r--arch/s390/include/asm/lowcore.h11
-rw-r--r--arch/s390/include/asm/processor.h2
-rw-r--r--arch/s390/include/asm/ptrace.h1
-rw-r--r--arch/s390/include/asm/system.h1
-rw-r--r--arch/s390/kernel/asm-offsets.c10
-rw-r--r--arch/s390/kernel/base.S36
-rw-r--r--arch/s390/kernel/compat_signal.c43
-rw-r--r--arch/s390/kernel/compat_wrapper.S6
-rw-r--r--arch/s390/kernel/dis.c2
-rw-r--r--arch/s390/kernel/early.c14
-rw-r--r--arch/s390/kernel/entry.S28
-rw-r--r--arch/s390/kernel/entry64.S20
-rw-r--r--arch/s390/kernel/ipl.c50
-rw-r--r--arch/s390/kernel/reipl64.S80
-rw-r--r--arch/s390/kernel/setup.c25
-rw-r--r--arch/s390/kernel/signal.c61
-rw-r--r--arch/s390/kernel/smp.c24
-rw-r--r--arch/s390/kernel/syscalls.S2
-rw-r--r--arch/s390/kernel/traps.c2
-rw-r--r--arch/s390/mm/maccess.c16
-rw-r--r--arch/s390/mm/pgtable.c1
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/sh/Makefile1
-rw-r--r--arch/sh/boards/board-apsh4a3a.c2
-rw-r--r--arch/sh/boards/board-apsh4ad0a.c2
-rw-r--r--arch/sh/boards/board-sh7785lcr.c2
-rw-r--r--arch/sh/boards/board-urquell.c2
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c15
-rw-r--r--arch/sh/boards/mach-highlander/setup.c2
-rw-r--r--arch/sh/boards/mach-sdk7786/setup.c2
-rw-r--r--arch/sh/drivers/pci/fixups-cayman.c2
-rw-r--r--arch/sh/drivers/pci/fixups-dreamcast.c2
-rw-r--r--arch/sh/drivers/pci/fixups-landisk.c2
-rw-r--r--arch/sh/drivers/pci/fixups-r7780rp.c2
-rw-r--r--arch/sh/drivers/pci/fixups-rts7751r2d.c2
-rw-r--r--arch/sh/drivers/pci/fixups-sdk7780.c2
-rw-r--r--arch/sh/drivers/pci/fixups-se7751.c2
-rw-r--r--arch/sh/drivers/pci/fixups-sh03.c2
-rw-r--r--arch/sh/drivers/pci/fixups-snapgear.c2
-rw-r--r--arch/sh/drivers/pci/fixups-titan.c2
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.c2
-rw-r--r--arch/sh/include/asm/atomic.h12
-rw-r--r--arch/sh/include/asm/hw_irq.h2
-rw-r--r--arch/sh/include/asm/pci.h2
-rw-r--r--arch/sh/include/asm/ptrace.h4
-rw-r--r--arch/sh/include/asm/smp.h2
-rw-r--r--arch/sh/include/cpu-sh3/cpu/serial.h10
-rw-r--r--arch/sh/include/cpu-sh4a/cpu/serial.h7
-rw-r--r--arch/sh/kernel/cpu/clock-cpg.c2
-rw-r--r--arch/sh/kernel/cpu/sh3/Makefile18
-rw-r--r--arch/sh/kernel/cpu/sh3/serial-sh770x.c33
-rw-r--r--arch/sh/kernel/cpu/sh3/serial-sh7710.c20
-rw-r--r--arch/sh/kernel/cpu/sh3/serial-sh7720.c37
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7705.c5
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh770x.c9
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7720.c5
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4-202.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7750.c4
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7760.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/Makefile2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7343.c33
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7366.c25
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c46
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7723.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c84
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7757.c36
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7763.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7780.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7785.c79
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7786.c115
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-shx3.c67
-rw-r--r--arch/sh/kernel/cpu/sh4a/serial-sh7722.c23
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c1
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c7
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c9
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c9
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c1
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7763.c3
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7780.c3
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7785.c8
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7786.c8
-rw-r--r--arch/sh/kernel/idle.c8
-rw-r--r--arch/sh/kernel/smp.c2
-rw-r--r--arch/sh/kernel/syscalls_32.S2
-rw-r--r--arch/sh/kernel/syscalls_64.S2
-rw-r--r--arch/sh/kernel/traps_32.c37
-rw-r--r--arch/sh/kernel/traps_64.c2
-rw-r--r--arch/sh/kernel/unwinder.c2
-rw-r--r--arch/sparc/Kconfig2
-rw-r--r--arch/sparc/include/asm/Kbuild5
-rw-r--r--arch/sparc/include/asm/atomic_32.h4
-rw-r--r--arch/sparc/include/asm/atomic_64.h6
-rw-r--r--arch/sparc/include/asm/bitops_64.h54
-rw-r--r--arch/sparc/include/asm/div64.h1
-rw-r--r--arch/sparc/include/asm/elf_64.h63
-rw-r--r--arch/sparc/include/asm/hypervisor.h14
-rw-r--r--arch/sparc/include/asm/irq_regs.h1
-rw-r--r--arch/sparc/include/asm/leon_pci.h2
-rw-r--r--arch/sparc/include/asm/local.h6
-rw-r--r--arch/sparc/include/asm/local64.h1
-rw-r--r--arch/sparc/include/asm/prom.h2
-rw-r--r--arch/sparc/include/asm/ptrace.h2
-rw-r--r--arch/sparc/include/asm/sigcontext.h14
-rw-r--r--arch/sparc/include/asm/smp_32.h2
-rw-r--r--arch/sparc/include/asm/smp_64.h2
-rw-r--r--arch/sparc/include/asm/spinlock_32.h11
-rw-r--r--arch/sparc/include/asm/spinlock_64.h6
-rw-r--r--arch/sparc/include/asm/spitfire.h1
-rw-r--r--arch/sparc/include/asm/tsb.h51
-rw-r--r--arch/sparc/include/asm/xor_64.h3
-rw-r--r--arch/sparc/kernel/Makefile1
-rw-r--r--arch/sparc/kernel/cpu.c8
-rw-r--r--arch/sparc/kernel/cpumap.c1
-rw-r--r--arch/sparc/kernel/ds.c31
-rw-r--r--arch/sparc/kernel/entry.h14
-rw-r--r--arch/sparc/kernel/head_64.S33
-rw-r--r--arch/sparc/kernel/hvapi.c7
-rw-r--r--arch/sparc/kernel/hvcalls.S7
-rw-r--r--arch/sparc/kernel/ioport.c32
-rw-r--r--arch/sparc/kernel/irq.h2
-rw-r--r--arch/sparc/kernel/irq_64.c2
-rw-r--r--arch/sparc/kernel/kernel.h15
-rw-r--r--arch/sparc/kernel/ktlb.S24
-rw-r--r--arch/sparc/kernel/leon_pci_grpci2.c2
-rw-r--r--arch/sparc/kernel/leon_smp.c2
-rw-r--r--arch/sparc/kernel/mdesc.c30
-rw-r--r--arch/sparc/kernel/pcic.c4
-rw-r--r--arch/sparc/kernel/pcr.c11
-rw-r--r--arch/sparc/kernel/perf_event.c5
-rw-r--r--arch/sparc/kernel/setup_64.c192
-rw-r--r--arch/sparc/kernel/signal32.c184
-rw-r--r--arch/sparc/kernel/signal_32.c172
-rw-r--r--arch/sparc/kernel/signal_64.c108
-rw-r--r--arch/sparc/kernel/sigutil.h9
-rw-r--r--arch/sparc/kernel/sigutil_32.c120
-rw-r--r--arch/sparc/kernel/sigutil_64.c93
-rw-r--r--arch/sparc/kernel/smp_32.c2
-rw-r--r--arch/sparc/kernel/smp_64.c2
-rw-r--r--arch/sparc/kernel/sparc_ksyms_64.c11
-rw-r--r--arch/sparc/kernel/sstate.c9
-rw-r--r--arch/sparc/kernel/sys32.S1
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/sparc/kernel/unaligned_64.c15
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S21
-rw-r--r--arch/sparc/lib/Makefile4
-rw-r--r--arch/sparc/lib/NG2page.S61
-rw-r--r--arch/sparc/lib/NGpage.S114
-rw-r--r--arch/sparc/lib/atomic32.c8
-rw-r--r--arch/sparc/lib/ffs.S84
-rw-r--r--arch/sparc/lib/hweight.S51
-rw-r--r--arch/sparc/mm/init_64.c42
-rw-r--r--arch/tile/Kconfig1
-rw-r--r--arch/tile/include/asm/Kbuild38
-rw-r--r--arch/tile/include/asm/atomic.h14
-rw-r--r--arch/tile/include/asm/atomic_32.h14
-rw-r--r--arch/tile/include/asm/atomic_64.h6
-rw-r--r--arch/tile/include/asm/bitops_32.h2
-rw-r--r--arch/tile/include/asm/bitops_64.h7
-rw-r--r--arch/tile/include/asm/bug.h1
-rw-r--r--arch/tile/include/asm/bugs.h1
-rw-r--r--arch/tile/include/asm/cputime.h1
-rw-r--r--arch/tile/include/asm/device.h1
-rw-r--r--arch/tile/include/asm/div64.h1
-rw-r--r--arch/tile/include/asm/emergency-restart.h1
-rw-r--r--arch/tile/include/asm/errno.h1
-rw-r--r--arch/tile/include/asm/fb.h1
-rw-r--r--arch/tile/include/asm/fcntl.h1
-rw-r--r--arch/tile/include/asm/fixmap.h6
-rw-r--r--arch/tile/include/asm/ioctl.h1
-rw-r--r--arch/tile/include/asm/ioctls.h1
-rw-r--r--arch/tile/include/asm/ipc.h1
-rw-r--r--arch/tile/include/asm/ipcbuf.h1
-rw-r--r--arch/tile/include/asm/irq_regs.h1
-rw-r--r--arch/tile/include/asm/kdebug.h1
-rw-r--r--arch/tile/include/asm/local.h1
-rw-r--r--arch/tile/include/asm/module.h1
-rw-r--r--arch/tile/include/asm/msgbuf.h1
-rw-r--r--arch/tile/include/asm/mutex.h1
-rw-r--r--arch/tile/include/asm/param.h1
-rw-r--r--arch/tile/include/asm/parport.h1
-rw-r--r--arch/tile/include/asm/poll.h1
-rw-r--r--arch/tile/include/asm/posix_types.h1
-rw-r--r--arch/tile/include/asm/ptrace.h2
-rw-r--r--arch/tile/include/asm/resource.h1
-rw-r--r--arch/tile/include/asm/scatterlist.h1
-rw-r--r--arch/tile/include/asm/sembuf.h1
-rw-r--r--arch/tile/include/asm/serial.h1
-rw-r--r--arch/tile/include/asm/shmbuf.h1
-rw-r--r--arch/tile/include/asm/shmparam.h1
-rw-r--r--arch/tile/include/asm/socket.h1
-rw-r--r--arch/tile/include/asm/sockios.h1
-rw-r--r--arch/tile/include/asm/spinlock_32.h2
-rw-r--r--arch/tile/include/asm/statfs.h1
-rw-r--r--arch/tile/include/asm/termbits.h1
-rw-r--r--arch/tile/include/asm/termios.h1
-rw-r--r--arch/tile/include/asm/types.h1
-rw-r--r--arch/tile/include/asm/ucontext.h1
-rw-r--r--arch/tile/include/asm/xor.h1
-rw-r--r--arch/tile/include/hv/drv_srom_intf.h41
-rw-r--r--arch/tile/kernel/intvec_32.S2
-rw-r--r--arch/tile/kernel/pci.c2
-rw-r--r--arch/tile/kernel/time.c5
-rw-r--r--arch/tile/lib/atomic_32.c2
-rw-r--r--arch/tile/lib/atomic_asm_32.S2
-rw-r--r--arch/tile/mm/init.c3
-rw-r--r--arch/um/Kconfig.x864
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/drivers/line.c61
-rw-r--r--arch/um/drivers/xterm.c1
-rw-r--r--arch/um/include/asm/ptrace-generic.h6
-rw-r--r--arch/um/include/shared/line.h1
-rw-r--r--arch/um/include/shared/registers.h2
-rw-r--r--arch/um/kernel/process.c2
-rw-r--r--arch/um/kernel/ptrace.c28
-rw-r--r--arch/um/os-Linux/registers.c9
-rw-r--r--arch/um/os-Linux/skas/mem.c2
-rw-r--r--arch/um/os-Linux/skas/process.c19
-rw-r--r--arch/um/sys-i386/asm/ptrace.h5
-rw-r--r--arch/um/sys-i386/ptrace.c28
-rw-r--r--arch/um/sys-i386/shared/sysdep/ptrace.h1
-rw-r--r--arch/um/sys-x86_64/ptrace.c12
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/ptrace.h1
-rw-r--r--arch/unicore32/kernel/pci.c2
-rw-r--r--arch/x86/Kconfig46
-rw-r--r--arch/x86/ia32/ia32entry.S2
-rw-r--r--arch/x86/ia32/sys_ia32.c2
-rw-r--r--arch/x86/include/asm/apic.h2
-rw-r--r--arch/x86/include/asm/atomic.h10
-rw-r--r--arch/x86/include/asm/atomic64_32.h2
-rw-r--r--arch/x86/include/asm/atomic64_64.h2
-rw-r--r--arch/x86/include/asm/bitops.h5
-rw-r--r--arch/x86/include/asm/desc.h4
-rw-r--r--arch/x86/include/asm/hw_irq.h2
-rw-r--r--arch/x86/include/asm/io.h3
-rw-r--r--arch/x86/include/asm/irq_vectors.h4
-rw-r--r--arch/x86/include/asm/kdebug.h1
-rw-r--r--arch/x86/include/asm/local.h2
-rw-r--r--arch/x86/include/asm/mce.h2
-rw-r--r--arch/x86/include/asm/mmu_context.h2
-rw-r--r--arch/x86/include/asm/olpc.h51
-rw-r--r--arch/x86/include/asm/paravirt_types.h6
-rw-r--r--arch/x86/include/asm/processor.h2
-rw-r--r--arch/x86/include/asm/prom.h2
-rw-r--r--arch/x86/include/asm/ptrace.h19
-rw-r--r--arch/x86/include/asm/pvclock.h2
-rw-r--r--arch/x86/include/asm/spinlock.h2
-rw-r--r--arch/x86/include/asm/thread_info.h2
-rw-r--r--arch/x86/include/asm/traps.h2
-rw-r--r--arch/x86/include/asm/unistd_64.h4
-rw-r--r--arch/x86/include/asm/vsyscall.h6
-rw-r--r--arch/x86/include/asm/xen/page.h4
-rw-r--r--arch/x86/kernel/Makefile13
-rw-r--r--arch/x86/kernel/acpi/cstate.c23
-rw-r--r--arch/x86/kernel/amd_gart_64.c2
-rw-r--r--arch/x86/kernel/apic/apic.c2
-rw-r--r--arch/x86/kernel/apic/es7000_32.c2
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c1
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c2
-rw-r--r--arch/x86/kernel/cpu/perf_event.c3
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c1
-rw-r--r--arch/x86/kernel/entry_32.S8
-rw-r--r--arch/x86/kernel/entry_64.S1
-rw-r--r--arch/x86/kernel/i8259.c2
-rw-r--r--arch/x86/kernel/irqinit.c2
-rw-r--r--arch/x86/kernel/paravirt.c4
-rw-r--r--arch/x86/kernel/process.c23
-rw-r--r--arch/x86/kernel/process_32.c4
-rw-r--r--arch/x86/kernel/process_64.c4
-rw-r--r--arch/x86/kernel/step.c2
-rw-r--r--arch/x86/kernel/syscall_table_32.S2
-rw-r--r--arch/x86/kernel/traps.c8
-rw-r--r--arch/x86/kernel/vmlinux.lds.S41
-rw-r--r--arch/x86/kernel/vsyscall_64.c90
-rw-r--r--arch/x86/kernel/vsyscall_emu_64.S36
-rw-r--r--arch/x86/kernel/vsyscall_trace.h29
-rw-r--r--arch/x86/kvm/Kconfig3
-rw-r--r--arch/x86/kvm/lapic.c2
-rw-r--r--arch/x86/kvm/timer.c2
-rw-r--r--arch/x86/lib/atomic64_32.c2
-rw-r--r--arch/x86/mm/fault.c15
-rw-r--r--arch/x86/mm/mmio-mod.c2
-rw-r--r--arch/x86/pci/acpi.c21
-rw-r--r--arch/x86/pci/ce4100.c2
-rw-r--r--arch/x86/pci/common.c14
-rw-r--r--arch/x86/pci/direct.c6
-rw-r--r--arch/x86/pci/numaq_32.c2
-rw-r--r--arch/x86/pci/olpc.c4
-rw-r--r--arch/x86/pci/pcbios.c2
-rw-r--r--arch/x86/pci/visws.c2
-rw-r--r--arch/x86/platform/mrst/Makefile1
-rw-r--r--arch/x86/platform/mrst/mrst.c4
-rw-r--r--arch/x86/platform/mrst/pmu.c817
-rw-r--r--arch/x86/platform/mrst/pmu.h234
-rw-r--r--arch/x86/platform/olpc/Makefile5
-rw-r--r--arch/x86/platform/olpc/olpc-xo1-pm.c215
-rw-r--r--arch/x86/platform/olpc/olpc-xo1-rtc.c81
-rw-r--r--arch/x86/platform/olpc/olpc-xo1-sci.c614
-rw-r--r--arch/x86/platform/olpc/olpc-xo1.c146
-rw-r--r--arch/x86/platform/olpc/olpc-xo15-sci.c168
-rw-r--r--arch/x86/platform/olpc/olpc.c99
-rw-r--r--arch/x86/platform/olpc/olpc_dt.c103
-rw-r--r--arch/x86/platform/olpc/xo1-wakeup.S124
-rw-r--r--arch/x86/vdso/vdso.S1
-rw-r--r--arch/x86/vdso/vdso32/sysenter.S2
-rw-r--r--arch/x86/xen/Makefile4
-rw-r--r--arch/x86/xen/enlighten.c8
-rw-r--r--arch/x86/xen/mmu.c16
-rw-r--r--arch/x86/xen/setup.c32
-rw-r--r--arch/x86/xen/smp.c14
-rw-r--r--arch/x86/xen/time.c5
-rw-r--r--arch/x86/xen/trace.c1
-rw-r--r--arch/x86/xen/xen-asm_32.S8
-rw-r--r--arch/xtensa/include/asm/atomic.h10
-rw-r--r--arch/xtensa/include/asm/bitops.h14
-rw-r--r--arch/xtensa/include/asm/posix_types.h2
-rw-r--r--arch/xtensa/include/asm/ptrace.h1
-rw-r--r--arch/xtensa/include/asm/unistd.h2
-rw-r--r--arch/xtensa/kernel/process.c2
1258 files changed, 19407 insertions, 8443 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 26b0e2397a5..4b0669cbb3b 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -178,4 +178,7 @@ config HAVE_ARCH_MUTEX_CPU_RELAX
178config HAVE_RCU_TABLE_FREE 178config HAVE_RCU_TABLE_FREE
179 bool 179 bool
180 180
181config ARCH_HAVE_NMI_SAFE_CMPXCHG
182 bool
183
181source "kernel/gcov/Kconfig" 184source "kernel/gcov/Kconfig"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index ca2da8da6e9..8bb936226de 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -14,6 +14,7 @@ config ALPHA
14 select AUTO_IRQ_AFFINITY if SMP 14 select AUTO_IRQ_AFFINITY if SMP
15 select GENERIC_IRQ_SHOW 15 select GENERIC_IRQ_SHOW
16 select ARCH_WANT_OPTIONAL_GPIOLIB 16 select ARCH_WANT_OPTIONAL_GPIOLIB
17 select ARCH_HAVE_NMI_SAFE_CMPXCHG
17 help 18 help
18 The Alpha is a 64-bit general-purpose processor designed and 19 The Alpha is a 64-bit general-purpose processor designed and
19 marketed by the Digital Equipment Corporation of blessed memory, 20 marketed by the Digital Equipment Corporation of blessed memory,
@@ -50,7 +51,7 @@ config GENERIC_CMOS_UPDATE
50 def_bool y 51 def_bool y
51 52
52config GENERIC_GPIO 53config GENERIC_GPIO
53 def_bool y 54 bool
54 55
55config ZONE_DMA 56config ZONE_DMA
56 bool 57 bool
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
index e756d04b6cd..640f909ddd4 100644
--- a/arch/alpha/include/asm/atomic.h
+++ b/arch/alpha/include/asm/atomic.h
@@ -176,15 +176,15 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
176#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 176#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
177 177
178/** 178/**
179 * atomic_add_unless - add unless the number is a given value 179 * __atomic_add_unless - add unless the number is a given value
180 * @v: pointer of type atomic_t 180 * @v: pointer of type atomic_t
181 * @a: the amount to add to v... 181 * @a: the amount to add to v...
182 * @u: ...unless v is equal to u. 182 * @u: ...unless v is equal to u.
183 * 183 *
184 * Atomically adds @a to @v, so long as it was not @u. 184 * Atomically adds @a to @v, so long as it was not @u.
185 * Returns non-zero if @v was not @u, and zero otherwise. 185 * Returns the old value of @v.
186 */ 186 */
187static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 187static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
188{ 188{
189 int c, old; 189 int c, old;
190 c = atomic_read(v); 190 c = atomic_read(v);
@@ -196,10 +196,9 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
196 break; 196 break;
197 c = old; 197 c = old;
198 } 198 }
199 return c != (u); 199 return c;
200} 200}
201 201
202#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
203 202
204/** 203/**
205 * atomic64_add_unless - add unless the number is a given value 204 * atomic64_add_unless - add unless the number is a given value
@@ -208,7 +207,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
208 * @u: ...unless v is equal to u. 207 * @u: ...unless v is equal to u.
209 * 208 *
210 * Atomically adds @a to @v, so long as it was not @u. 209 * Atomically adds @a to @v, so long as it was not @u.
211 * Returns non-zero if @v was not @u, and zero otherwise. 210 * Returns the old value of @v.
212 */ 211 */
213static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) 212static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
214{ 213{
@@ -256,5 +255,4 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
256#define smp_mb__before_atomic_inc() smp_mb() 255#define smp_mb__before_atomic_inc() smp_mb()
257#define smp_mb__after_atomic_inc() smp_mb() 256#define smp_mb__after_atomic_inc() smp_mb()
258 257
259#include <asm-generic/atomic-long.h>
260#endif /* _ALPHA_ATOMIC_H */ 258#endif /* _ALPHA_ATOMIC_H */
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h
index 85b81521577..a19ba5efea4 100644
--- a/arch/alpha/include/asm/bitops.h
+++ b/arch/alpha/include/asm/bitops.h
@@ -456,8 +456,7 @@ sched_find_first_bit(const unsigned long b[2])
456 456
457#include <asm-generic/bitops/le.h> 457#include <asm-generic/bitops/le.h>
458 458
459#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 459#include <asm-generic/bitops/ext2-atomic-setbit.h>
460#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
461 460
462#endif /* __KERNEL__ */ 461#endif /* __KERNEL__ */
463 462
diff --git a/arch/alpha/include/asm/local.h b/arch/alpha/include/asm/local.h
index b9e3e331837..9c94b845604 100644
--- a/arch/alpha/include/asm/local.h
+++ b/arch/alpha/include/asm/local.h
@@ -2,7 +2,7 @@
2#define _ALPHA_LOCAL_H 2#define _ALPHA_LOCAL_H
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <asm/atomic.h> 5#include <linux/atomic.h>
6 6
7typedef struct 7typedef struct
8{ 8{
diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
index 65cf3e28e2f..fd698a174f2 100644
--- a/arch/alpha/include/asm/ptrace.h
+++ b/arch/alpha/include/asm/ptrace.h
@@ -72,7 +72,6 @@ struct switch_stack {
72#define user_mode(regs) (((regs)->ps & 8) != 0) 72#define user_mode(regs) (((regs)->ps & 8) != 0)
73#define instruction_pointer(regs) ((regs)->pc) 73#define instruction_pointer(regs) ((regs)->pc)
74#define profile_pc(regs) instruction_pointer(regs) 74#define profile_pc(regs) instruction_pointer(regs)
75extern void show_regs(struct pt_regs *);
76 75
77#define task_pt_regs(task) \ 76#define task_pt_regs(task) \
78 ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1) 77 ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1)
diff --git a/arch/alpha/include/asm/sysinfo.h b/arch/alpha/include/asm/sysinfo.h
index 086aba284df..e77d77cd07b 100644
--- a/arch/alpha/include/asm/sysinfo.h
+++ b/arch/alpha/include/asm/sysinfo.h
@@ -27,13 +27,4 @@
27#define UAC_NOFIX 2 27#define UAC_NOFIX 2
28#define UAC_SIGBUS 4 28#define UAC_SIGBUS 4
29 29
30
31#ifdef __KERNEL__
32
33/* This is the shift that is applied to the UAC bits as stored in the
34 per-thread flags. See thread_info.h. */
35#define UAC_SHIFT 6
36
37#endif
38
39#endif /* __ASM_ALPHA_SYSINFO_H */ 30#endif /* __ASM_ALPHA_SYSINFO_H */
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h
index 6f32f9c84a2..ff73db02234 100644
--- a/arch/alpha/include/asm/thread_info.h
+++ b/arch/alpha/include/asm/thread_info.h
@@ -74,9 +74,9 @@ register struct thread_info *__current_thread_info __asm__("$8");
74#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 74#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
75#define TIF_POLLING_NRFLAG 8 /* poll_idle is polling NEED_RESCHED */ 75#define TIF_POLLING_NRFLAG 8 /* poll_idle is polling NEED_RESCHED */
76#define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */ 76#define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */
77#define TIF_UAC_NOPRINT 10 /* see sysinfo.h */ 77#define TIF_UAC_NOPRINT 10 /* ! Preserve sequence of following */
78#define TIF_UAC_NOFIX 11 78#define TIF_UAC_NOFIX 11 /* ! flags as they match */
79#define TIF_UAC_SIGBUS 12 79#define TIF_UAC_SIGBUS 12 /* ! userspace part of 'osf_sysinfo' */
80#define TIF_MEMDIE 13 /* is terminating due to OOM killer */ 80#define TIF_MEMDIE 13 /* is terminating due to OOM killer */
81#define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */ 81#define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */
82#define TIF_FREEZE 16 /* is freezing for suspend */ 82#define TIF_FREEZE 16 /* is freezing for suspend */
@@ -97,7 +97,7 @@ register struct thread_info *__current_thread_info __asm__("$8");
97#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \ 97#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
98 | _TIF_SYSCALL_TRACE) 98 | _TIF_SYSCALL_TRACE)
99 99
100#define ALPHA_UAC_SHIFT 10 100#define ALPHA_UAC_SHIFT TIF_UAC_NOPRINT
101#define ALPHA_UAC_MASK (1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \ 101#define ALPHA_UAC_MASK (1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \
102 1 << TIF_UAC_SIGBUS) 102 1 << TIF_UAC_SIGBUS)
103 103
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 326f0a2d56e..01e8715e26d 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -42,6 +42,7 @@
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43#include <asm/system.h> 43#include <asm/system.h>
44#include <asm/sysinfo.h> 44#include <asm/sysinfo.h>
45#include <asm/thread_info.h>
45#include <asm/hwrpb.h> 46#include <asm/hwrpb.h>
46#include <asm/processor.h> 47#include <asm/processor.h>
47 48
@@ -633,9 +634,10 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer,
633 case GSI_UACPROC: 634 case GSI_UACPROC:
634 if (nbytes < sizeof(unsigned int)) 635 if (nbytes < sizeof(unsigned int))
635 return -EINVAL; 636 return -EINVAL;
636 w = (current_thread_info()->flags >> UAC_SHIFT) & UAC_BITMASK; 637 w = (current_thread_info()->flags >> ALPHA_UAC_SHIFT) &
637 if (put_user(w, (unsigned int __user *)buffer)) 638 UAC_BITMASK;
638 return -EFAULT; 639 if (put_user(w, (unsigned int __user *)buffer))
640 return -EFAULT;
639 return 1; 641 return 1;
640 642
641 case GSI_PROC_TYPE: 643 case GSI_PROC_TYPE:
@@ -756,8 +758,8 @@ SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer,
756 case SSIN_UACPROC: 758 case SSIN_UACPROC:
757 again: 759 again:
758 old = current_thread_info()->flags; 760 old = current_thread_info()->flags;
759 new = old & ~(UAC_BITMASK << UAC_SHIFT); 761 new = old & ~(UAC_BITMASK << ALPHA_UAC_SHIFT);
760 new = new | (w & UAC_BITMASK) << UAC_SHIFT; 762 new = new | (w & UAC_BITMASK) << ALPHA_UAC_SHIFT;
761 if (cmpxchg(&current_thread_info()->flags, 763 if (cmpxchg(&current_thread_info()->flags,
762 old, new) != old) 764 old, new) != old)
763 goto again; 765 goto again;
diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 8e47709160f..8143cd7cdbf 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -17,7 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18 18
19#include <asm/hwrpb.h> 19#include <asm/hwrpb.h>
20#include <asm/atomic.h> 20#include <linux/atomic.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/irq_regs.h> 22#include <asm/irq_regs.h>
23#include <asm/pal.h> 23#include <asm/pal.h>
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index d739703608f..4087a569b43 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -31,7 +31,7 @@
31 31
32#include <asm/hwrpb.h> 32#include <asm/hwrpb.h>
33#include <asm/ptrace.h> 33#include <asm/ptrace.h>
34#include <asm/atomic.h> 34#include <linux/atomic.h>
35 35
36#include <asm/io.h> 36#include <asm/io.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c
index 0e1439904cd..8606d77e516 100644
--- a/arch/alpha/kernel/sys_alcor.c
+++ b/arch/alpha/kernel/sys_alcor.c
@@ -183,7 +183,7 @@ alcor_init_irq(void)
183 */ 183 */
184 184
185static int __init 185static int __init
186alcor_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 186alcor_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
187{ 187{
188 static char irq_tab[7][5] __initdata = { 188 static char irq_tab[7][5] __initdata = {
189 /*INT INTA INTB INTC INTD */ 189 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c
index c8c112d5158..1029619fb6c 100644
--- a/arch/alpha/kernel/sys_cabriolet.c
+++ b/arch/alpha/kernel/sys_cabriolet.c
@@ -175,7 +175,7 @@ pc164_init_irq(void)
175 */ 175 */
176 176
177static inline int __init 177static inline int __init
178eb66p_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 178eb66p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
179{ 179{
180 static char irq_tab[5][5] __initdata = { 180 static char irq_tab[5][5] __initdata = {
181 /*INT INTA INTB INTC INTD */ 181 /*INT INTA INTB INTC INTD */
@@ -205,7 +205,7 @@ eb66p_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
205 */ 205 */
206 206
207static inline int __init 207static inline int __init
208cabriolet_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 208cabriolet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
209{ 209{
210 static char irq_tab[5][5] __initdata = { 210 static char irq_tab[5][5] __initdata = {
211 /*INT INTA INTB INTC INTD */ 211 /*INT INTA INTB INTC INTD */
@@ -289,7 +289,7 @@ cia_cab_init_pci(void)
289 */ 289 */
290 290
291static inline int __init 291static inline int __init
292alphapc164_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 292alphapc164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
293{ 293{
294 static char irq_tab[7][5] __initdata = { 294 static char irq_tab[7][5] __initdata = {
295 /*INT INTA INTB INTC INTD */ 295 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index f8856829c22..bb7f0c7cb17 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -382,7 +382,7 @@ isa_irq_fixup(struct pci_dev *dev, int irq)
382} 382}
383 383
384static int __init 384static int __init
385dp264_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 385dp264_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
386{ 386{
387 static char irq_tab[6][5] __initdata = { 387 static char irq_tab[6][5] __initdata = {
388 /*INT INTA INTB INTC INTD */ 388 /*INT INTA INTB INTC INTD */
@@ -404,7 +404,7 @@ dp264_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
404} 404}
405 405
406static int __init 406static int __init
407monet_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 407monet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
408{ 408{
409 static char irq_tab[13][5] __initdata = { 409 static char irq_tab[13][5] __initdata = {
410 /*INT INTA INTB INTC INTD */ 410 /*INT INTA INTB INTC INTD */
@@ -466,7 +466,7 @@ monet_swizzle(struct pci_dev *dev, u8 *pinp)
466} 466}
467 467
468static int __init 468static int __init
469webbrick_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 469webbrick_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
470{ 470{
471 static char irq_tab[13][5] __initdata = { 471 static char irq_tab[13][5] __initdata = {
472 /*INT INTA INTB INTC INTD */ 472 /*INT INTA INTB INTC INTD */
@@ -488,7 +488,7 @@ webbrick_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
488} 488}
489 489
490static int __init 490static int __init
491clipper_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 491clipper_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
492{ 492{
493 static char irq_tab[7][5] __initdata = { 493 static char irq_tab[7][5] __initdata = {
494 /*INT INTA INTB INTC INTD */ 494 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c
index a7a23b40eec..3c6c13cd8b1 100644
--- a/arch/alpha/kernel/sys_eb64p.c
+++ b/arch/alpha/kernel/sys_eb64p.c
@@ -169,7 +169,7 @@ eb64p_init_irq(void)
169 */ 169 */
170 170
171static int __init 171static int __init
172eb64p_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 172eb64p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
173{ 173{
174 static char irq_tab[5][5] __initdata = { 174 static char irq_tab[5][5] __initdata = {
175 /*INT INTA INTB INTC INTD */ 175 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
index a60cd5b2621..35f480db771 100644
--- a/arch/alpha/kernel/sys_eiger.c
+++ b/arch/alpha/kernel/sys_eiger.c
@@ -144,7 +144,7 @@ eiger_init_irq(void)
144} 144}
145 145
146static int __init 146static int __init
147eiger_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 147eiger_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
148{ 148{
149 u8 irq_orig; 149 u8 irq_orig;
150 150
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 388b99d1779..95cfc83ece8 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -318,7 +318,7 @@ marvel_init_irq(void)
318} 318}
319 319
320static int 320static int
321marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 321marvel_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
322{ 322{
323 struct pci_controller *hose = dev->sysdata; 323 struct pci_controller *hose = dev->sysdata;
324 struct io7_port *io7_port = hose->sysdata; 324 struct io7_port *io7_port = hose->sysdata;
diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c
index 61ccd95579e..258da684670 100644
--- a/arch/alpha/kernel/sys_miata.c
+++ b/arch/alpha/kernel/sys_miata.c
@@ -151,7 +151,7 @@ miata_init_irq(void)
151 */ 151 */
152 152
153static int __init 153static int __init
154miata_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 154miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
155{ 155{
156 static char irq_tab[18][5] __initdata = { 156 static char irq_tab[18][5] __initdata = {
157 /*INT INTA INTB INTC INTD */ 157 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c
index 0e6e4697a02..c0fd7284dec 100644
--- a/arch/alpha/kernel/sys_mikasa.c
+++ b/arch/alpha/kernel/sys_mikasa.c
@@ -146,7 +146,7 @@ mikasa_init_irq(void)
146 */ 146 */
147 147
148static int __init 148static int __init
149mikasa_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 149mikasa_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
150{ 150{
151 static char irq_tab[8][5] __initdata = { 151 static char irq_tab[8][5] __initdata = {
152 /*INT INTA INTB INTC INTD */ 152 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 99c0f46f6b9..4112200307c 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -65,7 +65,7 @@ nautilus_init_irq(void)
65} 65}
66 66
67static int __init 67static int __init
68nautilus_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 68nautilus_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
69{ 69{
70 /* Preserve the IRQ set up by the console. */ 70 /* Preserve the IRQ set up by the console. */
71 71
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c
index a00ac708716..21725283cdd 100644
--- a/arch/alpha/kernel/sys_noritake.c
+++ b/arch/alpha/kernel/sys_noritake.c
@@ -194,7 +194,7 @@ noritake_init_irq(void)
194 */ 194 */
195 195
196static int __init 196static int __init
197noritake_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 197noritake_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
198{ 198{
199 static char irq_tab[15][5] __initdata = { 199 static char irq_tab[15][5] __initdata = {
200 /*INT INTA INTB INTC INTD */ 200 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c
index 7f52161f3d8..a125d6bea7e 100644
--- a/arch/alpha/kernel/sys_rawhide.c
+++ b/arch/alpha/kernel/sys_rawhide.c
@@ -223,7 +223,7 @@ rawhide_init_irq(void)
223 */ 223 */
224 224
225static int __init 225static int __init
226rawhide_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 226rawhide_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
227{ 227{
228 static char irq_tab[5][5] __initdata = { 228 static char irq_tab[5][5] __initdata = {
229 /*INT INTA INTB INTC INTD */ 229 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c
index f33648e4e8c..2581cbec6fc 100644
--- a/arch/alpha/kernel/sys_ruffian.c
+++ b/arch/alpha/kernel/sys_ruffian.c
@@ -119,7 +119,7 @@ ruffian_kill_arch (int mode)
119 */ 119 */
120 120
121static int __init 121static int __init
122ruffian_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 122ruffian_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
123{ 123{
124 static char irq_tab[11][5] __initdata = { 124 static char irq_tab[11][5] __initdata = {
125 /*INT INTA INTB INTC INTD */ 125 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c
index 216d94d9c0c..b172b27555a 100644
--- a/arch/alpha/kernel/sys_rx164.c
+++ b/arch/alpha/kernel/sys_rx164.c
@@ -144,7 +144,7 @@ rx164_init_irq(void)
144 */ 144 */
145 145
146static int __init 146static int __init
147rx164_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 147rx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
148{ 148{
149#if 0 149#if 0
150 static char irq_tab_pass1[6][5] __initdata = { 150 static char irq_tab_pass1[6][5] __initdata = {
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c
index da714e427c5..98d1dbffe98 100644
--- a/arch/alpha/kernel/sys_sable.c
+++ b/arch/alpha/kernel/sys_sable.c
@@ -194,7 +194,7 @@ sable_init_irq(void)
194 */ 194 */
195 195
196static int __init 196static int __init
197sable_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 197sable_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
198{ 198{
199 static char irq_tab[9][5] __initdata = { 199 static char irq_tab[9][5] __initdata = {
200 /*INT INTA INTB INTC INTD */ 200 /*INT INTA INTB INTC INTD */
@@ -376,7 +376,7 @@ lynx_init_irq(void)
376 */ 376 */
377 377
378static int __init 378static int __init
379lynx_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 379lynx_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
380{ 380{
381 static char irq_tab[19][5] __initdata = { 381 static char irq_tab[19][5] __initdata = {
382 /*INT INTA INTB INTC INTD */ 382 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c
index 85b4aea01ef..47bec1e97d1 100644
--- a/arch/alpha/kernel/sys_sio.c
+++ b/arch/alpha/kernel/sys_sio.c
@@ -146,7 +146,7 @@ sio_fixup_irq_levels(unsigned int level_bits)
146} 146}
147 147
148static inline int __init 148static inline int __init
149noname_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 149noname_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
150{ 150{
151 /* 151 /*
152 * The Noname board has 5 PCI slots with each of the 4 152 * The Noname board has 5 PCI slots with each of the 4
@@ -185,7 +185,7 @@ noname_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
185} 185}
186 186
187static inline int __init 187static inline int __init
188p2k_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 188p2k_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
189{ 189{
190 static char irq_tab[][5] __initdata = { 190 static char irq_tab[][5] __initdata = {
191 /*INT A B C D */ 191 /*INT A B C D */
diff --git a/arch/alpha/kernel/sys_sx164.c b/arch/alpha/kernel/sys_sx164.c
index 41d4ad4c7c4..73e1c317afc 100644
--- a/arch/alpha/kernel/sys_sx164.c
+++ b/arch/alpha/kernel/sys_sx164.c
@@ -95,7 +95,7 @@ sx164_init_irq(void)
95 */ 95 */
96 96
97static int __init 97static int __init
98sx164_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 98sx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
99{ 99{
100 static char irq_tab[5][5] __initdata = { 100 static char irq_tab[5][5] __initdata = {
101 /*INT INTA INTB INTC INTD */ 101 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c
index a31f8cd9bd6..2ae99ad6975 100644
--- a/arch/alpha/kernel/sys_takara.c
+++ b/arch/alpha/kernel/sys_takara.c
@@ -157,7 +157,7 @@ takara_init_irq(void)
157 */ 157 */
158 158
159static int __init 159static int __init
160takara_map_irq_srm(struct pci_dev *dev, u8 slot, u8 pin) 160takara_map_irq_srm(const struct pci_dev *dev, u8 slot, u8 pin)
161{ 161{
162 static char irq_tab[15][5] __initdata = { 162 static char irq_tab[15][5] __initdata = {
163 { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */ 163 { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */
@@ -188,7 +188,7 @@ takara_map_irq_srm(struct pci_dev *dev, u8 slot, u8 pin)
188} 188}
189 189
190static int __init 190static int __init
191takara_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 191takara_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
192{ 192{
193 static char irq_tab[15][5] __initdata = { 193 static char irq_tab[15][5] __initdata = {
194 { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */ 194 { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 6994407e242..f47b30a2a11 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -305,7 +305,7 @@ titan_late_init(void)
305} 305}
306 306
307static int __devinit 307static int __devinit
308titan_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 308titan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
309{ 309{
310 u8 intline; 310 u8 intline;
311 int irq; 311 int irq;
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c
index d92cdc715c6..17c85a65e7b 100644
--- a/arch/alpha/kernel/sys_wildfire.c
+++ b/arch/alpha/kernel/sys_wildfire.c
@@ -290,7 +290,7 @@ wildfire_device_interrupt(unsigned long vector)
290 */ 290 */
291 291
292static int __init 292static int __init
293wildfire_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 293wildfire_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
294{ 294{
295 static char irq_tab[8][5] __initdata = { 295 static char irq_tab[8][5] __initdata = {
296 /*INT INTA INTB INTC INTD */ 296 /*INT INTA INTB INTC INTD */
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index b9c28f3f195..6acea1f96de 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -360,7 +360,7 @@ sys_call_table:
360 .quad sys_newuname 360 .quad sys_newuname
361 .quad sys_nanosleep /* 340 */ 361 .quad sys_nanosleep /* 340 */
362 .quad sys_mremap 362 .quad sys_mremap
363 .quad sys_nfsservctl 363 .quad sys_ni_syscall /* old nfsservctl */
364 .quad sys_setresuid 364 .quad sys_setresuid
365 .quad sys_getresuid 365 .quad sys_getresuid
366 .quad sys_pciconfig_read /* 345 */ 366 .quad sys_pciconfig_read /* 345 */
diff --git a/arch/alpha/lib/dec_and_lock.c b/arch/alpha/lib/dec_and_lock.c
index 0f5520d2f45..f9f5fe830e9 100644
--- a/arch/alpha/lib/dec_and_lock.c
+++ b/arch/alpha/lib/dec_and_lock.c
@@ -6,7 +6,7 @@
6 */ 6 */
7 7
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <asm/atomic.h> 9#include <linux/atomic.h>
10 10
11 asm (".text \n\ 11 asm (".text \n\
12 .global _atomic_dec_and_lock \n\ 12 .global _atomic_dec_and_lock \n\
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9cb1f4bd761..3269576dbfa 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -195,8 +195,7 @@ config VECTORS_BASE
195 The base address of exception vectors. 195 The base address of exception vectors.
196 196
197config ARM_PATCH_PHYS_VIRT 197config ARM_PATCH_PHYS_VIRT
198 bool "Patch physical to virtual translations at runtime (EXPERIMENTAL)" 198 bool "Patch physical to virtual translations at runtime"
199 depends on EXPERIMENTAL
200 depends on !XIP_KERNEL && MMU 199 depends on !XIP_KERNEL && MMU
201 depends on !ARCH_REALVIEW || !SPARSEMEM 200 depends on !ARCH_REALVIEW || !SPARSEMEM
202 help 201 help
@@ -242,6 +241,7 @@ config ARCH_INTEGRATOR
242 select ARM_AMBA 241 select ARM_AMBA
243 select ARCH_HAS_CPUFREQ 242 select ARCH_HAS_CPUFREQ
244 select CLKDEV_LOOKUP 243 select CLKDEV_LOOKUP
244 select HAVE_MACH_CLKDEV
245 select ICST 245 select ICST
246 select GENERIC_CLOCKEVENTS 246 select GENERIC_CLOCKEVENTS
247 select PLAT_VERSATILE 247 select PLAT_VERSATILE
@@ -253,6 +253,7 @@ config ARCH_REALVIEW
253 bool "ARM Ltd. RealView family" 253 bool "ARM Ltd. RealView family"
254 select ARM_AMBA 254 select ARM_AMBA
255 select CLKDEV_LOOKUP 255 select CLKDEV_LOOKUP
256 select HAVE_MACH_CLKDEV
256 select ICST 257 select ICST
257 select GENERIC_CLOCKEVENTS 258 select GENERIC_CLOCKEVENTS
258 select ARCH_WANT_OPTIONAL_GPIOLIB 259 select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -268,6 +269,7 @@ config ARCH_VERSATILE
268 select ARM_AMBA 269 select ARM_AMBA
269 select ARM_VIC 270 select ARM_VIC
270 select CLKDEV_LOOKUP 271 select CLKDEV_LOOKUP
272 select HAVE_MACH_CLKDEV
271 select ICST 273 select ICST
272 select GENERIC_CLOCKEVENTS 274 select GENERIC_CLOCKEVENTS
273 select ARCH_WANT_OPTIONAL_GPIOLIB 275 select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -284,6 +286,7 @@ config ARCH_VEXPRESS
284 select ARM_AMBA 286 select ARM_AMBA
285 select ARM_TIMER_SP804 287 select ARM_TIMER_SP804
286 select CLKDEV_LOOKUP 288 select CLKDEV_LOOKUP
289 select HAVE_MACH_CLKDEV
287 select GENERIC_CLOCKEVENTS 290 select GENERIC_CLOCKEVENTS
288 select HAVE_CLK 291 select HAVE_CLK
289 select HAVE_PATA_PLATFORM 292 select HAVE_PATA_PLATFORM
@@ -324,7 +327,7 @@ config ARCH_CLPS711X
324 327
325config ARCH_CNS3XXX 328config ARCH_CNS3XXX
326 bool "Cavium Networks CNS3XXX family" 329 bool "Cavium Networks CNS3XXX family"
327 select CPU_V6 330 select CPU_V6K
328 select GENERIC_CLOCKEVENTS 331 select GENERIC_CLOCKEVENTS
329 select ARM_GIC 332 select ARM_GIC
330 select MIGHT_HAVE_PCI 333 select MIGHT_HAVE_PCI
@@ -340,6 +343,19 @@ config ARCH_GEMINI
340 help 343 help
341 Support for the Cortina Systems Gemini family SoCs 344 Support for the Cortina Systems Gemini family SoCs
342 345
346config ARCH_PRIMA2
347 bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform"
348 select CPU_V7
349 select GENERIC_TIME
350 select NO_IOPORT
351 select GENERIC_CLOCKEVENTS
352 select CLKDEV_LOOKUP
353 select GENERIC_IRQ_CHIP
354 select USE_OF
355 select ZONE_DMA
356 help
357 Support for CSR SiRFSoC ARM Cortex A9 Platform
358
343config ARCH_EBSA110 359config ARCH_EBSA110
344 bool "EBSA-110" 360 bool "EBSA-110"
345 select CPU_SA110 361 select CPU_SA110
@@ -379,6 +395,7 @@ config ARCH_MXC
379 select ARCH_REQUIRE_GPIOLIB 395 select ARCH_REQUIRE_GPIOLIB
380 select CLKDEV_LOOKUP 396 select CLKDEV_LOOKUP
381 select CLKSRC_MMIO 397 select CLKSRC_MMIO
398 select GENERIC_IRQ_CHIP
382 select HAVE_SCHED_CLOCK 399 select HAVE_SCHED_CLOCK
383 help 400 help
384 Support for Freescale MXC/iMX-based family of processors 401 Support for Freescale MXC/iMX-based family of processors
@@ -586,7 +603,6 @@ config ARCH_TEGRA
586 select GENERIC_GPIO 603 select GENERIC_GPIO
587 select HAVE_CLK 604 select HAVE_CLK
588 select HAVE_SCHED_CLOCK 605 select HAVE_SCHED_CLOCK
589 select ARCH_HAS_BARRIERS if CACHE_L2X0
590 select ARCH_HAS_CPUFREQ 606 select ARCH_HAS_CPUFREQ
591 help 607 help
592 This enables support for NVIDIA Tegra based systems (Tegra APX, 608 This enables support for NVIDIA Tegra based systems (Tegra APX,
@@ -613,6 +629,8 @@ config ARCH_PXA
613 select TICK_ONESHOT 629 select TICK_ONESHOT
614 select PLAT_PXA 630 select PLAT_PXA
615 select SPARSE_IRQ 631 select SPARSE_IRQ
632 select AUTO_ZRELADDR
633 select MULTI_IRQ_HANDLER
616 help 634 help
617 Support for Intel/Marvell's PXA2xx/PXA3xx processor line. 635 Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
618 636
@@ -633,6 +651,7 @@ config ARCH_SHMOBILE
633 bool "Renesas SH-Mobile / R-Mobile" 651 bool "Renesas SH-Mobile / R-Mobile"
634 select HAVE_CLK 652 select HAVE_CLK
635 select CLKDEV_LOOKUP 653 select CLKDEV_LOOKUP
654 select HAVE_MACH_CLKDEV
636 select GENERIC_CLOCKEVENTS 655 select GENERIC_CLOCKEVENTS
637 select NO_IOPORT 656 select NO_IOPORT
638 select SPARSE_IRQ 657 select SPARSE_IRQ
@@ -750,6 +769,7 @@ config ARCH_S5PV210
750 bool "Samsung S5PV210/S5PC110" 769 bool "Samsung S5PV210/S5PC110"
751 select CPU_V7 770 select CPU_V7
752 select ARCH_SPARSEMEM_ENABLE 771 select ARCH_SPARSEMEM_ENABLE
772 select ARCH_HAS_HOLES_MEMORYMODEL
753 select GENERIC_GPIO 773 select GENERIC_GPIO
754 select HAVE_CLK 774 select HAVE_CLK
755 select CLKDEV_LOOKUP 775 select CLKDEV_LOOKUP
@@ -768,6 +788,7 @@ config ARCH_EXYNOS4
768 bool "Samsung EXYNOS4" 788 bool "Samsung EXYNOS4"
769 select CPU_V7 789 select CPU_V7
770 select ARCH_SPARSEMEM_ENABLE 790 select ARCH_SPARSEMEM_ENABLE
791 select ARCH_HAS_HOLES_MEMORYMODEL
771 select GENERIC_GPIO 792 select GENERIC_GPIO
772 select HAVE_CLK 793 select HAVE_CLK
773 select CLKDEV_LOOKUP 794 select CLKDEV_LOOKUP
@@ -812,6 +833,7 @@ config ARCH_U300
812 select ARM_VIC 833 select ARM_VIC
813 select GENERIC_CLOCKEVENTS 834 select GENERIC_CLOCKEVENTS
814 select CLKDEV_LOOKUP 835 select CLKDEV_LOOKUP
836 select HAVE_MACH_CLKDEV
815 select GENERIC_GPIO 837 select GENERIC_GPIO
816 help 838 help
817 Support for ST-Ericsson U300 series mobile platforms. 839 Support for ST-Ericsson U300 series mobile platforms.
@@ -884,6 +906,19 @@ config ARCH_VT8500
884 select HAVE_PWM 906 select HAVE_PWM
885 help 907 help
886 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. 908 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
909
910config ARCH_ZYNQ
911 bool "Xilinx Zynq ARM Cortex A9 Platform"
912 select CPU_V7
913 select GENERIC_TIME
914 select GENERIC_CLOCKEVENTS
915 select CLKDEV_LOOKUP
916 select ARM_GIC
917 select ARM_AMBA
918 select ICST
919 select USE_OF
920 help
921 Support for Xilinx Zynq ARM Cortex A9 Platform
887endchoice 922endchoice
888 923
889# 924#
@@ -1236,6 +1271,18 @@ config ARM_ERRATA_754327
1236 This workaround defines cpu_relax() as smp_mb(), preventing correctly 1271 This workaround defines cpu_relax() as smp_mb(), preventing correctly
1237 written polling loops from denying visibility of updates to memory. 1272 written polling loops from denying visibility of updates to memory.
1238 1273
1274config ARM_ERRATA_364296
1275 bool "ARM errata: Possible cache data corruption with hit-under-miss enabled"
1276 depends on CPU_V6 && !SMP
1277 help
1278 This options enables the workaround for the 364296 ARM1136
1279 r0p2 erratum (possible cache data corruption with
1280 hit-under-miss enabled). It sets the undocumented bit 31 in
1281 the auxiliary control register and the FI bit in the control
1282 register, thus disabling hit-under-miss without putting the
1283 processor into full low interrupt latency mode. ARM11MPCore
1284 is not affected.
1285
1239endmenu 1286endmenu
1240 1287
1241source "arch/arm/common/Kconfig" 1288source "arch/arm/common/Kconfig"
@@ -1680,6 +1727,7 @@ config USE_OF
1680 bool "Flattened Device Tree support" 1727 bool "Flattened Device Tree support"
1681 select OF 1728 select OF
1682 select OF_EARLY_FLATTREE 1729 select OF_EARLY_FLATTREE
1730 select IRQ_DOMAIN
1683 help 1731 help
1684 Include support for flattened device tree machine descriptions. 1732 Include support for flattened device tree machine descriptions.
1685 1733
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 206c34ecb9e..70c424eaf7b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -168,6 +168,7 @@ machine-$(CONFIG_ARCH_OMAP3) := omap2
168machine-$(CONFIG_ARCH_OMAP4) := omap2 168machine-$(CONFIG_ARCH_OMAP4) := omap2
169machine-$(CONFIG_ARCH_ORION5X) := orion5x 169machine-$(CONFIG_ARCH_ORION5X) := orion5x
170machine-$(CONFIG_ARCH_PNX4008) := pnx4008 170machine-$(CONFIG_ARCH_PNX4008) := pnx4008
171machine-$(CONFIG_ARCH_PRIMA2) := prima2
171machine-$(CONFIG_ARCH_PXA) := pxa 172machine-$(CONFIG_ARCH_PXA) := pxa
172machine-$(CONFIG_ARCH_REALVIEW) := realview 173machine-$(CONFIG_ARCH_REALVIEW) := realview
173machine-$(CONFIG_ARCH_RPC) := rpc 174machine-$(CONFIG_ARCH_RPC) := rpc
@@ -194,6 +195,7 @@ machine-$(CONFIG_MACH_SPEAR300) := spear3xx
194machine-$(CONFIG_MACH_SPEAR310) := spear3xx 195machine-$(CONFIG_MACH_SPEAR310) := spear3xx
195machine-$(CONFIG_MACH_SPEAR320) := spear3xx 196machine-$(CONFIG_MACH_SPEAR320) := spear3xx
196machine-$(CONFIG_MACH_SPEAR600) := spear6xx 197machine-$(CONFIG_MACH_SPEAR600) := spear6xx
198machine-$(CONFIG_ARCH_ZYNQ) := zynq
197 199
198# Platform directory name. This list is sorted alphanumerically 200# Platform directory name. This list is sorted alphanumerically
199# by CONFIG_* macro name. 201# by CONFIG_* macro name.
@@ -201,6 +203,7 @@ plat-$(CONFIG_ARCH_MXC) := mxc
201plat-$(CONFIG_ARCH_OMAP) := omap 203plat-$(CONFIG_ARCH_OMAP) := omap
202plat-$(CONFIG_ARCH_S3C64XX) := samsung 204plat-$(CONFIG_ARCH_S3C64XX) := samsung
203plat-$(CONFIG_ARCH_TCC_926) := tcc 205plat-$(CONFIG_ARCH_TCC_926) := tcc
206plat-$(CONFIG_ARCH_ZYNQ) := versatile
204plat-$(CONFIG_PLAT_IOP) := iop 207plat-$(CONFIG_PLAT_IOP) := iop
205plat-$(CONFIG_PLAT_NOMADIK) := nomadik 208plat-$(CONFIG_PLAT_NOMADIK) := nomadik
206plat-$(CONFIG_PLAT_ORION) := orion 209plat-$(CONFIG_PLAT_ORION) := orion
@@ -279,6 +282,12 @@ zImage Image xipImage bootpImage uImage: vmlinux
279zinstall uinstall install: vmlinux 282zinstall uinstall install: vmlinux
280 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 283 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
281 284
285%.dtb:
286 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
287
288dtbs:
289 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
290
282# We use MRPROPER_FILES and CLEAN_FILES now 291# We use MRPROPER_FILES and CLEAN_FILES now
283archclean: 292archclean:
284 $(Q)$(MAKE) $(clean)=$(boot) 293 $(Q)$(MAKE) $(clean)=$(boot)
@@ -295,6 +304,7 @@ define archhelp
295 echo ' uImage - U-Boot wrapped zImage' 304 echo ' uImage - U-Boot wrapped zImage'
296 echo ' bootpImage - Combined zImage and initial RAM disk' 305 echo ' bootpImage - Combined zImage and initial RAM disk'
297 echo ' (supply initrd image via make variable INITRD=<path>)' 306 echo ' (supply initrd image via make variable INITRD=<path>)'
307 echo ' dtbs - Build device tree blobs for enabled boards'
298 echo ' install - Install uncompressed kernel' 308 echo ' install - Install uncompressed kernel'
299 echo ' zinstall - Install compressed kernel' 309 echo ' zinstall - Install compressed kernel'
300 echo ' uinstall - Install U-Boot wrapped compressed kernel' 310 echo ' uinstall - Install U-Boot wrapped compressed kernel'
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 9128fddf110..a1edfd5a129 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -59,6 +59,12 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
59 59
60endif 60endif
61 61
62# Rule to build device tree blobs
63$(obj)/%.dtb: $(src)/dts/%.dts
64 $(call cmd,dtc)
65
66$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
67
62quiet_cmd_uimage = UIMAGE $@ 68quiet_cmd_uimage = UIMAGE $@
63 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ 69 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
64 -C none -a $(LOADADDR) -e $(STARTADDR) \ 70 -C none -a $(LOADADDR) -e $(STARTADDR) \
diff --git a/arch/arm/boot/compressed/mmcif-sh7372.c b/arch/arm/boot/compressed/mmcif-sh7372.c
index b6f61d9a5a1..672ae95db5c 100644
--- a/arch/arm/boot/compressed/mmcif-sh7372.c
+++ b/arch/arm/boot/compressed/mmcif-sh7372.c
@@ -82,7 +82,7 @@ asmlinkage void mmc_loader(unsigned char *buf, unsigned long len)
82 82
83 83
84 /* Disable clock to MMC hardware block */ 84 /* Disable clock to MMC hardware block */
85 __raw_writel(__raw_readl(SMSTPCR3) & (1 << 12), SMSTPCR3); 85 __raw_writel(__raw_readl(SMSTPCR3) | (1 << 12), SMSTPCR3);
86 86
87 mmc_update_progress(MMC_PROGRESS_DONE); 87 mmc_update_progress(MMC_PROGRESS_DONE);
88} 88}
diff --git a/arch/arm/boot/compressed/sdhi-sh7372.c b/arch/arm/boot/compressed/sdhi-sh7372.c
index d403a8b24d7..d279294f238 100644
--- a/arch/arm/boot/compressed/sdhi-sh7372.c
+++ b/arch/arm/boot/compressed/sdhi-sh7372.c
@@ -85,7 +85,7 @@ asmlinkage void mmc_loader(unsigned short *buf, unsigned long len)
85 goto err; 85 goto err;
86 86
87 /* Disable clock to SDHI1 hardware block */ 87 /* Disable clock to SDHI1 hardware block */
88 __raw_writel(__raw_readl(SMSTPCR3) & (1 << 13), SMSTPCR3); 88 __raw_writel(__raw_readl(SMSTPCR3) | (1 << 13), SMSTPCR3);
89 89
90 mmc_update_progress(MMC_PROGRESS_DONE); 90 mmc_update_progress(MMC_PROGRESS_DONE);
91 91
diff --git a/arch/arm/boot/dts/prima2-cb.dts b/arch/arm/boot/dts/prima2-cb.dts
new file mode 100644
index 00000000000..6fecc88065b
--- /dev/null
+++ b/arch/arm/boot/dts/prima2-cb.dts
@@ -0,0 +1,416 @@
1/dts-v1/;
2/ {
3 model = "SiRF Prima2 eVB";
4 compatible = "sirf,prima2-cb", "sirf,prima2";
5 #address-cells = <1>;
6 #size-cells = <1>;
7 interrupt-parent = <&intc>;
8
9 memory {
10 reg = <0x00000000 0x20000000>;
11 };
12
13 chosen {
14 bootargs = "mem=512M real_root=/dev/mmcblk0p2 console=ttyS0 panel=1 bootsplash=true bpp=16 androidboot.console=ttyS1";
15 linux,stdout-path = &uart1;
16 };
17
18 cpus {
19 #address-cells = <1>;
20 #size-cells = <0>;
21
22 cpu@0 {
23 reg = <0x0>;
24 d-cache-line-size = <32>;
25 i-cache-line-size = <32>;
26 d-cache-size = <32768>;
27 i-cache-size = <32768>;
28 /* from bootloader */
29 timebase-frequency = <0>;
30 bus-frequency = <0>;
31 clock-frequency = <0>;
32 };
33 };
34
35 axi {
36 compatible = "simple-bus";
37 #address-cells = <1>;
38 #size-cells = <1>;
39 ranges = <0x40000000 0x40000000 0x80000000>;
40
41 l2-cache-controller@80040000 {
42 compatible = "arm,pl310-cache";
43 reg = <0x80040000 0x1000>;
44 interrupts = <59>;
45 };
46
47 intc: interrupt-controller@80020000 {
48 #interrupt-cells = <1>;
49 interrupt-controller;
50 compatible = "sirf,prima2-intc";
51 reg = <0x80020000 0x1000>;
52 };
53
54 sys-iobg {
55 compatible = "simple-bus";
56 #address-cells = <1>;
57 #size-cells = <1>;
58 ranges = <0x88000000 0x88000000 0x40000>;
59
60 clock-controller@88000000 {
61 compatible = "sirf,prima2-clkc";
62 reg = <0x88000000 0x1000>;
63 interrupts = <3>;
64 };
65
66 reset-controller@88010000 {
67 compatible = "sirf,prima2-rstc";
68 reg = <0x88010000 0x1000>;
69 };
70 };
71
72 mem-iobg {
73 compatible = "simple-bus";
74 #address-cells = <1>;
75 #size-cells = <1>;
76 ranges = <0x90000000 0x90000000 0x10000>;
77
78 memory-controller@90000000 {
79 compatible = "sirf,prima2-memc";
80 reg = <0x90000000 0x10000>;
81 interrupts = <27>;
82 };
83 };
84
85 disp-iobg {
86 compatible = "simple-bus";
87 #address-cells = <1>;
88 #size-cells = <1>;
89 ranges = <0x90010000 0x90010000 0x30000>;
90
91 display@90010000 {
92 compatible = "sirf,prima2-lcd";
93 reg = <0x90010000 0x20000>;
94 interrupts = <30>;
95 };
96
97 vpp@90020000 {
98 compatible = "sirf,prima2-vpp";
99 reg = <0x90020000 0x10000>;
100 interrupts = <31>;
101 };
102 };
103
104 graphics-iobg {
105 compatible = "simple-bus";
106 #address-cells = <1>;
107 #size-cells = <1>;
108 ranges = <0x98000000 0x98000000 0x8000000>;
109
110 graphics@98000000 {
111 compatible = "powervr,sgx531";
112 reg = <0x98000000 0x8000000>;
113 interrupts = <6>;
114 };
115 };
116
117 multimedia-iobg {
118 compatible = "simple-bus";
119 #address-cells = <1>;
120 #size-cells = <1>;
121 ranges = <0xa0000000 0xa0000000 0x8000000>;
122
123 multimedia@a0000000 {
124 compatible = "sirf,prima2-video-codec";
125 reg = <0xa0000000 0x8000000>;
126 interrupts = <5>;
127 };
128 };
129
130 dsp-iobg {
131 compatible = "simple-bus";
132 #address-cells = <1>;
133 #size-cells = <1>;
134 ranges = <0xa8000000 0xa8000000 0x2000000>;
135
136 dspif@a8000000 {
137 compatible = "sirf,prima2-dspif";
138 reg = <0xa8000000 0x10000>;
139 interrupts = <9>;
140 };
141
142 gps@a8010000 {
143 compatible = "sirf,prima2-gps";
144 reg = <0xa8010000 0x10000>;
145 interrupts = <7>;
146 };
147
148 dsp@a9000000 {
149 compatible = "sirf,prima2-dsp";
150 reg = <0xa9000000 0x1000000>;
151 interrupts = <8>;
152 };
153 };
154
155 peri-iobg {
156 compatible = "simple-bus";
157 #address-cells = <1>;
158 #size-cells = <1>;
159 ranges = <0xb0000000 0xb0000000 0x180000>;
160
161 timer@b0020000 {
162 compatible = "sirf,prima2-tick";
163 reg = <0xb0020000 0x1000>;
164 interrupts = <0>;
165 };
166
167 nand@b0030000 {
168 compatible = "sirf,prima2-nand";
169 reg = <0xb0030000 0x10000>;
170 interrupts = <41>;
171 };
172
173 audio@b0040000 {
174 compatible = "sirf,prima2-audio";
175 reg = <0xb0040000 0x10000>;
176 interrupts = <35>;
177 };
178
179 uart0: uart@b0050000 {
180 cell-index = <0>;
181 compatible = "sirf,prima2-uart";
182 reg = <0xb0050000 0x10000>;
183 interrupts = <17>;
184 };
185
186 uart1: uart@b0060000 {
187 cell-index = <1>;
188 compatible = "sirf,prima2-uart";
189 reg = <0xb0060000 0x10000>;
190 interrupts = <18>;
191 };
192
193 uart2: uart@b0070000 {
194 cell-index = <2>;
195 compatible = "sirf,prima2-uart";
196 reg = <0xb0070000 0x10000>;
197 interrupts = <19>;
198 };
199
200 usp0: usp@b0080000 {
201 cell-index = <0>;
202 compatible = "sirf,prima2-usp";
203 reg = <0xb0080000 0x10000>;
204 interrupts = <20>;
205 };
206
207 usp1: usp@b0090000 {
208 cell-index = <1>;
209 compatible = "sirf,prima2-usp";
210 reg = <0xb0090000 0x10000>;
211 interrupts = <21>;
212 };
213
214 usp2: usp@b00a0000 {
215 cell-index = <2>;
216 compatible = "sirf,prima2-usp";
217 reg = <0xb00a0000 0x10000>;
218 interrupts = <22>;
219 };
220
221 dmac0: dma-controller@b00b0000 {
222 cell-index = <0>;
223 compatible = "sirf,prima2-dmac";
224 reg = <0xb00b0000 0x10000>;
225 interrupts = <12>;
226 };
227
228 dmac1: dma-controller@b0160000 {
229 cell-index = <1>;
230 compatible = "sirf,prima2-dmac";
231 reg = <0xb0160000 0x10000>;
232 interrupts = <13>;
233 };
234
235 vip@b00C0000 {
236 compatible = "sirf,prima2-vip";
237 reg = <0xb00C0000 0x10000>;
238 };
239
240 spi0: spi@b00d0000 {
241 cell-index = <0>;
242 compatible = "sirf,prima2-spi";
243 reg = <0xb00d0000 0x10000>;
244 interrupts = <15>;
245 };
246
247 spi1: spi@b0170000 {
248 cell-index = <1>;
249 compatible = "sirf,prima2-spi";
250 reg = <0xb0170000 0x10000>;
251 interrupts = <16>;
252 };
253
254 i2c0: i2c@b00e0000 {
255 cell-index = <0>;
256 compatible = "sirf,prima2-i2c";
257 reg = <0xb00e0000 0x10000>;
258 interrupts = <24>;
259 };
260
261 i2c1: i2c@b00f0000 {
262 cell-index = <1>;
263 compatible = "sirf,prima2-i2c";
264 reg = <0xb00f0000 0x10000>;
265 interrupts = <25>;
266 };
267
268 tsc@b0110000 {
269 compatible = "sirf,prima2-tsc";
270 reg = <0xb0110000 0x10000>;
271 interrupts = <33>;
272 };
273
274 gpio: gpio-controller@b0120000 {
275 #gpio-cells = <2>;
276 #interrupt-cells = <2>;
277 compatible = "sirf,prima2-gpio";
278 reg = <0xb0120000 0x10000>;
279 gpio-controller;
280 interrupt-controller;
281 };
282
283 pwm@b0130000 {
284 compatible = "sirf,prima2-pwm";
285 reg = <0xb0130000 0x10000>;
286 };
287
288 efusesys@b0140000 {
289 compatible = "sirf,prima2-efuse";
290 reg = <0xb0140000 0x10000>;
291 };
292
293 pulsec@b0150000 {
294 compatible = "sirf,prima2-pulsec";
295 reg = <0xb0150000 0x10000>;
296 interrupts = <48>;
297 };
298
299 pci-iobg {
300 compatible = "sirf,prima2-pciiobg", "simple-bus";
301 #address-cells = <1>;
302 #size-cells = <1>;
303 ranges = <0x56000000 0x56000000 0x1b00000>;
304
305 sd0: sdhci@56000000 {
306 cell-index = <0>;
307 compatible = "sirf,prima2-sdhc";
308 reg = <0x56000000 0x100000>;
309 interrupts = <38>;
310 };
311
312 sd1: sdhci@56100000 {
313 cell-index = <1>;
314 compatible = "sirf,prima2-sdhc";
315 reg = <0x56100000 0x100000>;
316 interrupts = <38>;
317 };
318
319 sd2: sdhci@56200000 {
320 cell-index = <2>;
321 compatible = "sirf,prima2-sdhc";
322 reg = <0x56200000 0x100000>;
323 interrupts = <23>;
324 };
325
326 sd3: sdhci@56300000 {
327 cell-index = <3>;
328 compatible = "sirf,prima2-sdhc";
329 reg = <0x56300000 0x100000>;
330 interrupts = <23>;
331 };
332
333 sd4: sdhci@56400000 {
334 cell-index = <4>;
335 compatible = "sirf,prima2-sdhc";
336 reg = <0x56400000 0x100000>;
337 interrupts = <39>;
338 };
339
340 sd5: sdhci@56500000 {
341 cell-index = <5>;
342 compatible = "sirf,prima2-sdhc";
343 reg = <0x56500000 0x100000>;
344 interrupts = <39>;
345 };
346
347 pci-copy@57900000 {
348 compatible = "sirf,prima2-pcicp";
349 reg = <0x57900000 0x100000>;
350 interrupts = <40>;
351 };
352
353 rom-interface@57a00000 {
354 compatible = "sirf,prima2-romif";
355 reg = <0x57a00000 0x100000>;
356 };
357 };
358 };
359
360 rtc-iobg {
361 compatible = "sirf,prima2-rtciobg", "simple-bus";
362 #address-cells = <1>;
363 #size-cells = <1>;
364 reg = <0x80030000 0x10000>;
365
366 gpsrtc@1000 {
367 compatible = "sirf,prima2-gpsrtc";
368 reg = <0x1000 0x1000>;
369 interrupts = <55 56 57>;
370 };
371
372 sysrtc@2000 {
373 compatible = "sirf,prima2-sysrtc";
374 reg = <0x2000 0x1000>;
375 interrupts = <52 53 54>;
376 };
377
378 pwrc@3000 {
379 compatible = "sirf,prima2-pwrc";
380 reg = <0x3000 0x1000>;
381 interrupts = <32>;
382 };
383 };
384
385 uus-iobg {
386 compatible = "simple-bus";
387 #address-cells = <1>;
388 #size-cells = <1>;
389 ranges = <0xb8000000 0xb8000000 0x40000>;
390
391 usb0: usb@b00e0000 {
392 compatible = "chipidea,ci13611a-prima2";
393 reg = <0xb8000000 0x10000>;
394 interrupts = <10>;
395 };
396
397 usb1: usb@b00f0000 {
398 compatible = "chipidea,ci13611a-prima2";
399 reg = <0xb8010000 0x10000>;
400 interrupts = <11>;
401 };
402
403 sata@b00f0000 {
404 compatible = "synopsys,dwc-ahsata";
405 reg = <0xb8020000 0x10000>;
406 interrupts = <37>;
407 };
408
409 security@b00f0000 {
410 compatible = "sirf,prima2-security";
411 reg = <0xb8030000 0x10000>;
412 interrupts = <42>;
413 };
414 };
415 };
416};
diff --git a/arch/arm/boot/dts/skeleton.dtsi b/arch/arm/boot/dts/skeleton.dtsi
new file mode 100644
index 00000000000..b41d241de2c
--- /dev/null
+++ b/arch/arm/boot/dts/skeleton.dtsi
@@ -0,0 +1,13 @@
1/*
2 * Skeleton device tree; the bare minimum needed to boot; just include and
3 * add a compatible value. The bootloader will typically populate the memory
4 * node.
5 */
6
7/ {
8 #address-cells = <1>;
9 #size-cells = <1>;
10 chosen { };
11 aliases { };
12 memory { device_type = "memory"; reg = <0 0>; };
13};
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts
new file mode 100644
index 00000000000..4c053340ce3
--- /dev/null
+++ b/arch/arm/boot/dts/tegra-harmony.dts
@@ -0,0 +1,70 @@
1/dts-v1/;
2
3/memreserve/ 0x1c000000 0x04000000;
4/include/ "tegra20.dtsi"
5
6/ {
7 model = "NVIDIA Tegra2 Harmony evaluation board";
8 compatible = "nvidia,harmony", "nvidia,tegra20";
9
10 chosen {
11 bootargs = "vmalloc=192M video=tegrafb console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw rootwait";
12 };
13
14 memory@0 {
15 reg = < 0x00000000 0x40000000 >;
16 };
17
18 i2c@7000c000 {
19 clock-frequency = <400000>;
20
21 codec: wm8903@1a {
22 compatible = "wlf,wm8903";
23 reg = <0x1a>;
24 interrupts = < 347 >;
25
26 gpio-controller;
27 #gpio-cells = <2>;
28
29 /* 0x8000 = Not configured */
30 gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >;
31 };
32 };
33
34 i2c@7000c400 {
35 clock-frequency = <400000>;
36 };
37
38 i2c@7000c500 {
39 clock-frequency = <400000>;
40 };
41
42 i2c@7000d000 {
43 clock-frequency = <400000>;
44 };
45
46 sound {
47 compatible = "nvidia,harmony-sound", "nvidia,tegra-wm8903";
48
49 spkr-en-gpios = <&codec 2 0>;
50 hp-det-gpios = <&gpio 178 0>;
51 int-mic-en-gpios = <&gpio 184 0>;
52 ext-mic-en-gpios = <&gpio 185 0>;
53 };
54
55 serial@70006300 {
56 clock-frequency = < 216000000 >;
57 };
58
59 sdhci@c8000200 {
60 gpios = <&gpio 69 0>, /* cd, gpio PI5 */
61 <&gpio 57 0>, /* wp, gpio PH1 */
62 <&gpio 155 0>; /* power, gpio PT3 */
63 };
64
65 sdhci@c8000600 {
66 gpios = <&gpio 58 0>, /* cd, gpio PH2 */
67 <&gpio 59 0>, /* wp, gpio PH3 */
68 <&gpio 70 0>; /* power, gpio PI6 */
69 };
70};
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts
new file mode 100644
index 00000000000..1940cae0074
--- /dev/null
+++ b/arch/arm/boot/dts/tegra-seaboard.dts
@@ -0,0 +1,28 @@
1/dts-v1/;
2
3/memreserve/ 0x1c000000 0x04000000;
4/include/ "tegra20.dtsi"
5
6/ {
7 model = "NVIDIA Seaboard";
8 compatible = "nvidia,seaboard", "nvidia,tegra20";
9
10 chosen {
11 bootargs = "vmalloc=192M video=tegrafb console=ttyS0,115200n8 root=/dev/mmcblk1p3 rw rootwait";
12 };
13
14 memory {
15 device_type = "memory";
16 reg = < 0x00000000 0x40000000 >;
17 };
18
19 serial@70006300 {
20 clock-frequency = < 216000000 >;
21 };
22
23 sdhci@c8000400 {
24 gpios = <&gpio 69 0>, /* cd, gpio PI5 */
25 <&gpio 57 0>, /* wp, gpio PH1 */
26 <&gpio 70 0>; /* power, gpio PI6 */
27 };
28};
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
new file mode 100644
index 00000000000..5727595cde6
--- /dev/null
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -0,0 +1,139 @@
1/include/ "skeleton.dtsi"
2
3/ {
4 compatible = "nvidia,tegra20";
5 interrupt-parent = <&intc>;
6
7 intc: interrupt-controller@50041000 {
8 compatible = "nvidia,tegra20-gic";
9 interrupt-controller;
10 #interrupt-cells = <1>;
11 reg = < 0x50041000 0x1000 >,
12 < 0x50040100 0x0100 >;
13 };
14
15 i2c@7000c000 {
16 #address-cells = <1>;
17 #size-cells = <0>;
18 compatible = "nvidia,tegra20-i2c";
19 reg = <0x7000C000 0x100>;
20 interrupts = < 70 >;
21 };
22
23 i2c@7000c400 {
24 #address-cells = <1>;
25 #size-cells = <0>;
26 compatible = "nvidia,tegra20-i2c";
27 reg = <0x7000C400 0x100>;
28 interrupts = < 116 >;
29 };
30
31 i2c@7000c500 {
32 #address-cells = <1>;
33 #size-cells = <0>;
34 compatible = "nvidia,tegra20-i2c";
35 reg = <0x7000C500 0x100>;
36 interrupts = < 124 >;
37 };
38
39 i2c@7000d000 {
40 #address-cells = <1>;
41 #size-cells = <0>;
42 compatible = "nvidia,tegra20-i2c";
43 reg = <0x7000D000 0x200>;
44 interrupts = < 85 >;
45 };
46
47 i2s@70002800 {
48 #address-cells = <1>;
49 #size-cells = <0>;
50 compatible = "nvidia,tegra20-i2s";
51 reg = <0x70002800 0x200>;
52 interrupts = < 45 >;
53 dma-channel = < 2 >;
54 };
55
56 i2s@70002a00 {
57 #address-cells = <1>;
58 #size-cells = <0>;
59 compatible = "nvidia,tegra20-i2s";
60 reg = <0x70002a00 0x200>;
61 interrupts = < 35 >;
62 dma-channel = < 1 >;
63 };
64
65 das@70000c00 {
66 #address-cells = <1>;
67 #size-cells = <0>;
68 compatible = "nvidia,tegra20-das";
69 reg = <0x70000c00 0x80>;
70 };
71
72 gpio: gpio@6000d000 {
73 compatible = "nvidia,tegra20-gpio";
74 reg = < 0x6000d000 0x1000 >;
75 interrupts = < 64 65 66 67 87 119 121 >;
76 #gpio-cells = <2>;
77 gpio-controller;
78 };
79
80 serial@70006000 {
81 compatible = "nvidia,tegra20-uart";
82 reg = <0x70006000 0x40>;
83 reg-shift = <2>;
84 interrupts = < 68 >;
85 };
86
87 serial@70006040 {
88 compatible = "nvidia,tegra20-uart";
89 reg = <0x70006040 0x40>;
90 reg-shift = <2>;
91 interrupts = < 69 >;
92 };
93
94 serial@70006200 {
95 compatible = "nvidia,tegra20-uart";
96 reg = <0x70006200 0x100>;
97 reg-shift = <2>;
98 interrupts = < 78 >;
99 };
100
101 serial@70006300 {
102 compatible = "nvidia,tegra20-uart";
103 reg = <0x70006300 0x100>;
104 reg-shift = <2>;
105 interrupts = < 122 >;
106 };
107
108 serial@70006400 {
109 compatible = "nvidia,tegra20-uart";
110 reg = <0x70006400 0x100>;
111 reg-shift = <2>;
112 interrupts = < 123 >;
113 };
114
115 sdhci@c8000000 {
116 compatible = "nvidia,tegra20-sdhci";
117 reg = <0xc8000000 0x200>;
118 interrupts = < 46 >;
119 };
120
121 sdhci@c8000200 {
122 compatible = "nvidia,tegra20-sdhci";
123 reg = <0xc8000200 0x200>;
124 interrupts = < 47 >;
125 };
126
127 sdhci@c8000400 {
128 compatible = "nvidia,tegra20-sdhci";
129 reg = <0xc8000400 0x200>;
130 interrupts = < 51 >;
131 };
132
133 sdhci@c8000600 {
134 compatible = "nvidia,tegra20-sdhci";
135 reg = <0xc8000600 0x200>;
136 interrupts = < 63 >;
137 };
138};
139
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
new file mode 100644
index 00000000000..0b32925f214
--- /dev/null
+++ b/arch/arm/boot/dts/versatile-ab.dts
@@ -0,0 +1,192 @@
1/dts-v1/;
2/include/ "skeleton.dtsi"
3
4/ {
5 model = "ARM Versatile AB";
6 compatible = "arm,versatile-ab";
7 #address-cells = <1>;
8 #size-cells = <1>;
9 interrupt-parent = <&vic>;
10
11 aliases {
12 serial0 = &uart0;
13 serial1 = &uart1;
14 serial2 = &uart2;
15 i2c0 = &i2c0;
16 };
17
18 memory {
19 reg = <0x0 0x08000000>;
20 };
21
22 flash@34000000 {
23 compatible = "arm,versatile-flash";
24 reg = <0x34000000 0x4000000>;
25 bank-width = <4>;
26 };
27
28 i2c0: i2c@10002000 {
29 #address-cells = <1>;
30 #size-cells = <0>;
31 compatible = "arm,versatile-i2c";
32 reg = <0x10002000 0x1000>;
33
34 rtc@68 {
35 compatible = "dallas,ds1338";
36 reg = <0x68>;
37 };
38 };
39
40 net@10010000 {
41 compatible = "smsc,lan91c111";
42 reg = <0x10010000 0x10000>;
43 interrupts = <25>;
44 };
45
46 lcd@10008000 {
47 compatible = "arm,versatile-lcd";
48 reg = <0x10008000 0x1000>;
49 };
50
51 amba {
52 compatible = "arm,amba-bus";
53 #address-cells = <1>;
54 #size-cells = <1>;
55 ranges;
56
57 vic: intc@10140000 {
58 compatible = "arm,versatile-vic";
59 interrupt-controller;
60 #interrupt-cells = <1>;
61 reg = <0x10140000 0x1000>;
62 };
63
64 sic: intc@10003000 {
65 compatible = "arm,versatile-sic";
66 interrupt-controller;
67 #interrupt-cells = <1>;
68 reg = <0x10003000 0x1000>;
69 interrupt-parent = <&vic>;
70 interrupts = <31>; /* Cascaded to vic */
71 };
72
73 dma@10130000 {
74 compatible = "arm,pl081", "arm,primecell";
75 reg = <0x10130000 0x1000>;
76 interrupts = <17>;
77 };
78
79 uart0: uart@101f1000 {
80 compatible = "arm,pl011", "arm,primecell";
81 reg = <0x101f1000 0x1000>;
82 interrupts = <12>;
83 };
84
85 uart1: uart@101f2000 {
86 compatible = "arm,pl011", "arm,primecell";
87 reg = <0x101f2000 0x1000>;
88 interrupts = <13>;
89 };
90
91 uart2: uart@101f3000 {
92 compatible = "arm,pl011", "arm,primecell";
93 reg = <0x101f3000 0x1000>;
94 interrupts = <14>;
95 };
96
97 smc@10100000 {
98 compatible = "arm,primecell";
99 reg = <0x10100000 0x1000>;
100 };
101
102 mpmc@10110000 {
103 compatible = "arm,primecell";
104 reg = <0x10110000 0x1000>;
105 };
106
107 display@10120000 {
108 compatible = "arm,pl110", "arm,primecell";
109 reg = <0x10120000 0x1000>;
110 interrupts = <16>;
111 };
112
113 sctl@101e0000 {
114 compatible = "arm,primecell";
115 reg = <0x101e0000 0x1000>;
116 };
117
118 watchdog@101e1000 {
119 compatible = "arm,primecell";
120 reg = <0x101e1000 0x1000>;
121 interrupts = <0>;
122 };
123
124 gpio0: gpio@101e4000 {
125 compatible = "arm,pl061", "arm,primecell";
126 reg = <0x101e4000 0x1000>;
127 gpio-controller;
128 interrupts = <6>;
129 #gpio-cells = <2>;
130 interrupt-controller;
131 #interrupt-cells = <2>;
132 };
133
134 gpio1: gpio@101e5000 {
135 compatible = "arm,pl061", "arm,primecell";
136 reg = <0x101e5000 0x1000>;
137 interrupts = <7>;
138 gpio-controller;
139 #gpio-cells = <2>;
140 interrupt-controller;
141 #interrupt-cells = <2>;
142 };
143
144 rtc@101e8000 {
145 compatible = "arm,pl030", "arm,primecell";
146 reg = <0x101e8000 0x1000>;
147 interrupts = <10>;
148 };
149
150 sci@101f0000 {
151 compatible = "arm,primecell";
152 reg = <0x101f0000 0x1000>;
153 interrupts = <15>;
154 };
155
156 ssp@101f4000 {
157 compatible = "arm,pl022", "arm,primecell";
158 reg = <0x101f4000 0x1000>;
159 interrupts = <11>;
160 };
161
162 fpga {
163 compatible = "arm,versatile-fpga", "simple-bus";
164 #address-cells = <1>;
165 #size-cells = <1>;
166 ranges = <0 0x10000000 0x10000>;
167
168 aaci@4000 {
169 compatible = "arm,primecell";
170 reg = <0x4000 0x1000>;
171 interrupts = <24>;
172 };
173 mmc@5000 {
174 compatible = "arm,primecell";
175 reg = < 0x5000 0x1000>;
176 interrupts = <22>;
177 };
178 kmi@6000 {
179 compatible = "arm,pl050", "arm,primecell";
180 reg = <0x6000 0x1000>;
181 interrupt-parent = <&sic>;
182 interrupts = <3>;
183 };
184 kmi@7000 {
185 compatible = "arm,pl050", "arm,primecell";
186 reg = <0x7000 0x1000>;
187 interrupt-parent = <&sic>;
188 interrupts = <4>;
189 };
190 };
191 };
192};
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts
new file mode 100644
index 00000000000..8a614e39800
--- /dev/null
+++ b/arch/arm/boot/dts/versatile-pb.dts
@@ -0,0 +1,48 @@
1/include/ "versatile-ab.dts"
2
3/ {
4 model = "ARM Versatile PB";
5 compatible = "arm,versatile-pb";
6
7 amba {
8 gpio2: gpio@101e6000 {
9 compatible = "arm,pl061", "arm,primecell";
10 reg = <0x101e6000 0x1000>;
11 interrupts = <8>;
12 gpio-controller;
13 #gpio-cells = <2>;
14 interrupt-controller;
15 #interrupt-cells = <2>;
16 };
17
18 gpio3: gpio@101e7000 {
19 compatible = "arm,pl061", "arm,primecell";
20 reg = <0x101e7000 0x1000>;
21 interrupts = <9>;
22 gpio-controller;
23 #gpio-cells = <2>;
24 interrupt-controller;
25 #interrupt-cells = <2>;
26 };
27
28 fpga {
29 uart@9000 {
30 compatible = "arm,pl011", "arm,primecell";
31 reg = <0x9000 0x1000>;
32 interrupt-parent = <&sic>;
33 interrupts = <6>;
34 };
35 sci@a000 {
36 compatible = "arm,primecell";
37 reg = <0xa000 0x1000>;
38 interrupt-parent = <&sic>;
39 interrupts = <5>;
40 };
41 mmc@b000 {
42 compatible = "arm,primecell";
43 reg = <0xb000 0x1000>;
44 interrupts = <23>;
45 };
46 };
47 };
48};
diff --git a/arch/arm/boot/dts/zynq-ep107.dts b/arch/arm/boot/dts/zynq-ep107.dts
new file mode 100644
index 00000000000..37ca192fb19
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-ep107.dts
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2011 Xilinx
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14/dts-v1/;
15/ {
16 model = "Xilinx Zynq EP107";
17 compatible = "xlnx,zynq-ep107";
18 #address-cells = <1>;
19 #size-cells = <1>;
20 interrupt-parent = <&intc>;
21
22 memory {
23 device_type = "memory";
24 reg = <0x0 0x10000000>;
25 };
26
27 chosen {
28 bootargs = "console=ttyPS0,9600 root=/dev/ram rw initrd=0x800000,8M earlyprintk";
29 linux,stdout-path = &uart0;
30 };
31
32 amba {
33 compatible = "simple-bus";
34 #address-cells = <1>;
35 #size-cells = <1>;
36 ranges;
37
38 intc: interrupt-controller@f8f01000 {
39 interrupt-controller;
40 compatible = "arm,gic";
41 reg = <0xF8F01000 0x1000>;
42 #interrupt-cells = <2>;
43 };
44
45 uart0: uart@e0000000 {
46 compatible = "xlnx,xuartps";
47 reg = <0xE0000000 0x1000>;
48 interrupts = <59 0>;
49 clock = <50000000>;
50 };
51 };
52};
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 7bdd91766d6..3227ca952a1 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -38,12 +38,6 @@ static DEFINE_SPINLOCK(irq_controller_lock);
38/* Address of GIC 0 CPU interface */ 38/* Address of GIC 0 CPU interface */
39void __iomem *gic_cpu_base_addr __read_mostly; 39void __iomem *gic_cpu_base_addr __read_mostly;
40 40
41struct gic_chip_data {
42 unsigned int irq_offset;
43 void __iomem *dist_base;
44 void __iomem *cpu_base;
45};
46
47/* 41/*
48 * Supported arch specific GIC irq extension. 42 * Supported arch specific GIC irq extension.
49 * Default make them NULL. 43 * Default make them NULL.
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
index 14ad62e16dd..a7934ba9e1d 100644
--- a/arch/arm/common/it8152.c
+++ b/arch/arm/common/it8152.c
@@ -144,7 +144,7 @@ void it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
144} 144}
145 145
146/* mapping for on-chip devices */ 146/* mapping for on-chip devices */
147int __init it8152_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 147int __init it8152_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
148{ 148{
149 if ((dev->vendor == PCI_VENDOR_ID_ITE) && 149 if ((dev->vendor == PCI_VENDOR_ID_ITE) &&
150 (dev->device == PCI_DEVICE_ID_ITE_8152)) { 150 (dev->device == PCI_DEVICE_ID_ITE_8152)) {
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 5a6ff7c605d..db2cb7d180d 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -22,6 +22,8 @@ CONFIG_BLK_DEV_INTEGRITY=y
22# CONFIG_IOSCHED_DEADLINE is not set 22# CONFIG_IOSCHED_DEADLINE is not set
23# CONFIG_IOSCHED_CFQ is not set 23# CONFIG_IOSCHED_CFQ is not set
24CONFIG_ARCH_MXS=y 24CONFIG_ARCH_MXS=y
25CONFIG_MACH_MX23EVK=y
26CONFIG_MACH_MX28EVK=y
25CONFIG_MACH_STMP378X_DEVB=y 27CONFIG_MACH_STMP378X_DEVB=y
26CONFIG_MACH_TX28=y 28CONFIG_MACH_TX28=y
27# CONFIG_ARM_THUMB is not set 29# CONFIG_ARM_THUMB is not set
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index a5cce242a77..97d31a4663d 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -11,12 +11,12 @@ CONFIG_ARCH_U8500=y
11CONFIG_UX500_SOC_DB5500=y 11CONFIG_UX500_SOC_DB5500=y
12CONFIG_UX500_SOC_DB8500=y 12CONFIG_UX500_SOC_DB8500=y
13CONFIG_MACH_U8500=y 13CONFIG_MACH_U8500=y
14CONFIG_MACH_SNOWBALL=y
14CONFIG_MACH_U5500=y 15CONFIG_MACH_U5500=y
15CONFIG_NO_HZ=y 16CONFIG_NO_HZ=y
16CONFIG_HIGH_RES_TIMERS=y 17CONFIG_HIGH_RES_TIMERS=y
17CONFIG_SMP=y 18CONFIG_SMP=y
18CONFIG_NR_CPUS=2 19CONFIG_NR_CPUS=2
19CONFIG_HOTPLUG_CPU=y
20CONFIG_PREEMPT=y 20CONFIG_PREEMPT=y
21CONFIG_AEABI=y 21CONFIG_AEABI=y
22CONFIG_CMDLINE="root=/dev/ram0 console=ttyAMA2,115200n8" 22CONFIG_CMDLINE="root=/dev/ram0 console=ttyAMA2,115200n8"
@@ -25,8 +25,13 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
25CONFIG_VFP=y 25CONFIG_VFP=y
26CONFIG_NEON=y 26CONFIG_NEON=y
27CONFIG_NET=y 27CONFIG_NET=y
28CONFIG_PACKET=y
29CONFIG_UNIX=y
30CONFIG_INET=y
31CONFIG_IP_PNP=y
32CONFIG_IP_PNP_DHCP=y
33CONFIG_NETFILTER=y
28CONFIG_PHONET=y 34CONFIG_PHONET=y
29CONFIG_PHONET_PIPECTRLR=y
30# CONFIG_WIRELESS is not set 35# CONFIG_WIRELESS is not set
31CONFIG_CAIF=y 36CONFIG_CAIF=y
32CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 37CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
@@ -35,6 +40,13 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
35CONFIG_MISC_DEVICES=y 40CONFIG_MISC_DEVICES=y
36CONFIG_AB8500_PWM=y 41CONFIG_AB8500_PWM=y
37CONFIG_SENSORS_BH1780=y 42CONFIG_SENSORS_BH1780=y
43CONFIG_NETDEVICES=y
44CONFIG_SMSC_PHY=y
45CONFIG_NET_ETHERNET=y
46CONFIG_SMSC911X=y
47# CONFIG_NETDEV_1000 is not set
48# CONFIG_NETDEV_10000 is not set
49# CONFIG_WLAN is not set
38# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 50# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
39CONFIG_INPUT_EVDEV=y 51CONFIG_INPUT_EVDEV=y
40# CONFIG_KEYBOARD_ATKBD is not set 52# CONFIG_KEYBOARD_ATKBD is not set
@@ -49,9 +61,9 @@ CONFIG_INPUT_MISC=y
49CONFIG_INPUT_AB8500_PONKEY=y 61CONFIG_INPUT_AB8500_PONKEY=y
50# CONFIG_SERIO is not set 62# CONFIG_SERIO is not set
51CONFIG_VT_HW_CONSOLE_BINDING=y 63CONFIG_VT_HW_CONSOLE_BINDING=y
64# CONFIG_LEGACY_PTYS is not set
52CONFIG_SERIAL_AMBA_PL011=y 65CONFIG_SERIAL_AMBA_PL011=y
53CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 66CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
54# CONFIG_LEGACY_PTYS is not set
55CONFIG_HW_RANDOM=y 67CONFIG_HW_RANDOM=y
56CONFIG_HW_RANDOM_NOMADIK=y 68CONFIG_HW_RANDOM_NOMADIK=y
57CONFIG_I2C=y 69CONFIG_I2C=y
@@ -64,14 +76,19 @@ CONFIG_GPIO_TC3589X=y
64CONFIG_MFD_STMPE=y 76CONFIG_MFD_STMPE=y
65CONFIG_MFD_TC3589X=y 77CONFIG_MFD_TC3589X=y
66CONFIG_AB8500_CORE=y 78CONFIG_AB8500_CORE=y
67CONFIG_REGULATOR=y
68CONFIG_REGULATOR_AB8500=y 79CONFIG_REGULATOR_AB8500=y
69# CONFIG_HID_SUPPORT is not set 80# CONFIG_HID_SUPPORT is not set
70# CONFIG_USB_SUPPORT is not set 81CONFIG_USB_MUSB_HDRC=y
82CONFIG_USB_GADGET_MUSB_HDRC=y
83CONFIG_MUSB_PIO_ONLY=y
84CONFIG_USB_GADGET=y
85CONFIG_AB8500_USB=y
71CONFIG_MMC=y 86CONFIG_MMC=y
87CONFIG_MMC_CLKGATE=y
72CONFIG_MMC_ARMMMCI=y 88CONFIG_MMC_ARMMMCI=y
73CONFIG_NEW_LEDS=y 89CONFIG_NEW_LEDS=y
74CONFIG_LEDS_CLASS=y 90CONFIG_LEDS_CLASS=y
91CONFIG_LEDS_LM3530=y
75CONFIG_LEDS_LP5521=y 92CONFIG_LEDS_LP5521=y
76CONFIG_RTC_CLASS=y 93CONFIG_RTC_CLASS=y
77CONFIG_RTC_DRV_AB8500=y 94CONFIG_RTC_DRV_AB8500=y
@@ -79,7 +96,6 @@ CONFIG_RTC_DRV_PL031=y
79CONFIG_DMADEVICES=y 96CONFIG_DMADEVICES=y
80CONFIG_STE_DMA40=y 97CONFIG_STE_DMA40=y
81CONFIG_STAGING=y 98CONFIG_STAGING=y
82# CONFIG_STAGING_EXCLUDE_BUILD is not set
83CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4=y 99CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4=y
84CONFIG_EXT2_FS=y 100CONFIG_EXT2_FS=y
85CONFIG_EXT2_FS_XATTR=y 101CONFIG_EXT2_FS_XATTR=y
@@ -91,6 +107,8 @@ CONFIG_TMPFS=y
91CONFIG_TMPFS_POSIX_ACL=y 107CONFIG_TMPFS_POSIX_ACL=y
92CONFIG_CONFIGFS_FS=m 108CONFIG_CONFIGFS_FS=m
93# CONFIG_MISC_FILESYSTEMS is not set 109# CONFIG_MISC_FILESYSTEMS is not set
110CONFIG_NFS_FS=y
111CONFIG_ROOT_NFS=y
94CONFIG_NLS_CODEPAGE_437=y 112CONFIG_NLS_CODEPAGE_437=y
95CONFIG_NLS_ISO8859_1=y 113CONFIG_NLS_ISO8859_1=y
96CONFIG_MAGIC_SYSRQ=y 114CONFIG_MAGIC_SYSRQ=y
@@ -99,7 +117,5 @@ CONFIG_DEBUG_KERNEL=y
99# CONFIG_SCHED_DEBUG is not set 117# CONFIG_SCHED_DEBUG is not set
100# CONFIG_DEBUG_PREEMPT is not set 118# CONFIG_DEBUG_PREEMPT is not set
101CONFIG_DEBUG_INFO=y 119CONFIG_DEBUG_INFO=y
102# CONFIG_RCU_CPU_STALL_DETECTOR is not set
103# CONFIG_FTRACE is not set 120# CONFIG_FTRACE is not set
104CONFIG_DEBUG_USER=y 121CONFIG_DEBUG_USER=y
105CONFIG_DEBUG_ERRORS=y
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index 7e79503ab89..86976d03438 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -208,16 +208,15 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
208 208
209#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 209#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
210 210
211static inline int atomic_add_unless(atomic_t *v, int a, int u) 211static inline int __atomic_add_unless(atomic_t *v, int a, int u)
212{ 212{
213 int c, old; 213 int c, old;
214 214
215 c = atomic_read(v); 215 c = atomic_read(v);
216 while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c) 216 while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c)
217 c = old; 217 c = old;
218 return c != u; 218 return c;
219} 219}
220#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
221 220
222#define atomic_inc(v) atomic_add(1, v) 221#define atomic_inc(v) atomic_add(1, v)
223#define atomic_dec(v) atomic_sub(1, v) 222#define atomic_dec(v) atomic_sub(1, v)
@@ -460,9 +459,6 @@ static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
460#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0) 459#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
461#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL) 460#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL)
462 461
463#else /* !CONFIG_GENERIC_ATOMIC64 */ 462#endif /* !CONFIG_GENERIC_ATOMIC64 */
464#include <asm-generic/atomic64.h>
465#endif
466#include <asm-generic/atomic-long.h>
467#endif 463#endif
468#endif 464#endif
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index f4280593dfa..f7419ef9c8f 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -310,10 +310,7 @@ static inline int find_next_bit_le(const void *p, int size, int offset)
310/* 310/*
311 * Ext2 is defined to use little-endian byte ordering. 311 * Ext2 is defined to use little-endian byte ordering.
312 */ 312 */
313#define ext2_set_bit_atomic(lock, nr, p) \ 313#include <asm-generic/bitops/ext2-atomic-setbit.h>
314 test_and_set_bit_le(nr, p)
315#define ext2_clear_bit_atomic(lock, nr, p) \
316 test_and_clear_bit_le(nr, p)
317 314
318#endif /* __KERNEL__ */ 315#endif /* __KERNEL__ */
319 316
diff --git a/arch/arm/include/asm/clkdev.h b/arch/arm/include/asm/clkdev.h
index 765d3322236..80751c15c30 100644
--- a/arch/arm/include/asm/clkdev.h
+++ b/arch/arm/include/asm/clkdev.h
@@ -14,7 +14,12 @@
14 14
15#include <linux/slab.h> 15#include <linux/slab.h>
16 16
17#ifdef CONFIG_HAVE_MACH_CLKDEV
17#include <mach/clkdev.h> 18#include <mach/clkdev.h>
19#else
20#define __clk_get(clk) ({ 1; })
21#define __clk_put(clk) do { } while (0)
22#endif
18 23
19static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) 24static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
20{ 25{
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 16bd4803158..99a6ed7e1bf 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -45,8 +45,13 @@
45#define L2X0_CLEAN_INV_LINE_PA 0x7F0 45#define L2X0_CLEAN_INV_LINE_PA 0x7F0
46#define L2X0_CLEAN_INV_LINE_IDX 0x7F8 46#define L2X0_CLEAN_INV_LINE_IDX 0x7F8
47#define L2X0_CLEAN_INV_WAY 0x7FC 47#define L2X0_CLEAN_INV_WAY 0x7FC
48#define L2X0_LOCKDOWN_WAY_D 0x900 48/*
49#define L2X0_LOCKDOWN_WAY_I 0x904 49 * The lockdown registers repeat 8 times for L310, the L210 has only one
50 * D and one I lockdown register at 0x0900 and 0x0904.
51 */
52#define L2X0_LOCKDOWN_WAY_D_BASE 0x900
53#define L2X0_LOCKDOWN_WAY_I_BASE 0x904
54#define L2X0_LOCKDOWN_STRIDE 0x08
50#define L2X0_TEST_OPERATION 0xF00 55#define L2X0_TEST_OPERATION 0xF00
51#define L2X0_LINE_DATA 0xF10 56#define L2X0_LINE_DATA 0xF10
52#define L2X0_LINE_TAG 0xF30 57#define L2X0_LINE_TAG 0xF30
@@ -64,7 +69,7 @@
64#define L2X0_AUX_CTRL_MASK 0xc0000fff 69#define L2X0_AUX_CTRL_MASK 0xc0000fff
65#define L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT 16 70#define L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT 16
66#define L2X0_AUX_CTRL_WAY_SIZE_SHIFT 17 71#define L2X0_AUX_CTRL_WAY_SIZE_SHIFT 17
67#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x3 << 17) 72#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x7 << 17)
68#define L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT 22 73#define L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT 22
69#define L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT 26 74#define L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT 26
70#define L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT 27 75#define L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT 27
diff --git a/arch/arm/include/asm/hardware/gic.h b/arch/arm/include/asm/hardware/gic.h
index 0691f9dcc50..435d3f86c70 100644
--- a/arch/arm/include/asm/hardware/gic.h
+++ b/arch/arm/include/asm/hardware/gic.h
@@ -41,6 +41,12 @@ void gic_secondary_init(unsigned int);
41void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); 41void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
42void gic_raise_softirq(const struct cpumask *mask, unsigned int irq); 42void gic_raise_softirq(const struct cpumask *mask, unsigned int irq);
43void gic_enable_ppi(unsigned int); 43void gic_enable_ppi(unsigned int);
44
45struct gic_chip_data {
46 unsigned int irq_offset;
47 void __iomem *dist_base;
48 void __iomem *cpu_base;
49};
44#endif 50#endif
45 51
46#endif 52#endif
diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h
index b2f95c72287..b3fea38d55c 100644
--- a/arch/arm/include/asm/hardware/it8152.h
+++ b/arch/arm/include/asm/hardware/it8152.h
@@ -105,7 +105,7 @@ struct pci_sys_data;
105 105
106extern void it8152_irq_demux(unsigned int irq, struct irq_desc *desc); 106extern void it8152_irq_demux(unsigned int irq, struct irq_desc *desc);
107extern void it8152_init_irq(void); 107extern void it8152_init_irq(void);
108extern int it8152_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin); 108extern int it8152_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
109extern int it8152_pci_setup(int nr, struct pci_sys_data *sys); 109extern int it8152_pci_setup(int nr, struct pci_sys_data *sys);
110extern struct pci_bus *it8152_pci_scan_bus(int nr, struct pci_sys_data *sys); 110extern struct pci_bus *it8152_pci_scan_bus(int nr, struct pci_sys_data *sys);
111 111
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index 2721a5814cb..5a526afb5f1 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -23,6 +23,7 @@ struct pt_regs;
23extern void migrate_irqs(void); 23extern void migrate_irqs(void);
24 24
25extern void asm_do_IRQ(unsigned int, struct pt_regs *); 25extern void asm_do_IRQ(unsigned int, struct pt_regs *);
26void handle_IRQ(unsigned int, struct pt_regs *);
26void init_IRQ(void); 27void init_IRQ(void);
27 28
28#endif 29#endif
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 3281fb4b12e..217aa1911dd 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -74,4 +74,11 @@ static const struct machine_desc __mach_desc_##_type \
74#define MACHINE_END \ 74#define MACHINE_END \
75}; 75};
76 76
77#define DT_MACHINE_START(_name, _namestr) \
78static const struct machine_desc __mach_desc_##_name \
79 __used \
80 __attribute__((__section__(".arch.info.init"))) = { \
81 .nr = ~0, \
82 .name = _namestr,
83
77#endif 84#endif
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 16330bd0657..186efd4e05c 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -25,7 +25,7 @@ struct hw_pci {
25 void (*preinit)(void); 25 void (*preinit)(void);
26 void (*postinit)(void); 26 void (*postinit)(void);
27 u8 (*swizzle)(struct pci_dev *dev, u8 *pin); 27 u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
28 int (*map_irq)(struct pci_dev *dev, u8 slot, u8 pin); 28 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
29}; 29};
30 30
31/* 31/*
@@ -44,7 +44,7 @@ struct pci_sys_data {
44 /* Bridge swizzling */ 44 /* Bridge swizzling */
45 u8 (*swizzle)(struct pci_dev *, u8 *); 45 u8 (*swizzle)(struct pci_dev *, u8 *);
46 /* IRQ mapping */ 46 /* IRQ mapping */
47 int (*map_irq)(struct pci_dev *, u8, u8); 47 int (*map_irq)(const struct pci_dev *, u8, u8);
48 struct hw_pci *hw; 48 struct hw_pci *hw;
49 void *private_data; /* platform controller private data */ 49 void *private_data; /* platform controller private data */
50}; 50};
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index 92e2a833693..2b1f245db0c 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -3,9 +3,19 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5#include <asm-generic/pci-dma-compat.h> 5#include <asm-generic/pci-dma-compat.h>
6#include <asm-generic/pci-bridge.h>
6 7
7#include <asm/mach/pci.h> /* for pci_sys_data */ 8#include <asm/mach/pci.h> /* for pci_sys_data */
8#include <mach/hardware.h> /* for PCIBIOS_MIN_* */ 9
10extern unsigned long pcibios_min_io;
11#define PCIBIOS_MIN_IO pcibios_min_io
12extern unsigned long pcibios_min_mem;
13#define PCIBIOS_MIN_MEM pcibios_min_mem
14
15static inline int pcibios_assign_all_busses(void)
16{
17 return pci_has_flag(PCI_REASSIGN_ALL_RSRC);
18}
9 19
10#ifdef CONFIG_PCI_DOMAINS 20#ifdef CONFIG_PCI_DOMAINS
11static inline int pci_domain_nr(struct pci_bus *bus) 21static inline int pci_domain_nr(struct pci_bus *bus)
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
index 67c70a31a1b..b7e82c4aced 100644
--- a/arch/arm/include/asm/pmu.h
+++ b/arch/arm/include/asm/pmu.h
@@ -41,7 +41,7 @@ struct arm_pmu_platdata {
41 * encoded error on failure. 41 * encoded error on failure.
42 */ 42 */
43extern struct platform_device * 43extern struct platform_device *
44reserve_pmu(enum arm_pmu_type device); 44reserve_pmu(enum arm_pmu_type type);
45 45
46/** 46/**
47 * release_pmu() - Relinquish control of the performance counters 47 * release_pmu() - Relinquish control of the performance counters
@@ -62,26 +62,26 @@ release_pmu(enum arm_pmu_type type);
62 * the actual hardware initialisation. 62 * the actual hardware initialisation.
63 */ 63 */
64extern int 64extern int
65init_pmu(enum arm_pmu_type device); 65init_pmu(enum arm_pmu_type type);
66 66
67#else /* CONFIG_CPU_HAS_PMU */ 67#else /* CONFIG_CPU_HAS_PMU */
68 68
69#include <linux/err.h> 69#include <linux/err.h>
70 70
71static inline struct platform_device * 71static inline struct platform_device *
72reserve_pmu(enum arm_pmu_type device) 72reserve_pmu(enum arm_pmu_type type)
73{ 73{
74 return ERR_PTR(-ENODEV); 74 return ERR_PTR(-ENODEV);
75} 75}
76 76
77static inline int 77static inline int
78release_pmu(struct platform_device *pdev) 78release_pmu(enum arm_pmu_type type)
79{ 79{
80 return -ENODEV; 80 return -ENODEV;
81} 81}
82 82
83static inline int 83static inline int
84init_pmu(enum arm_pmu_type device) 84init_pmu(enum arm_pmu_type type)
85{ 85{
86 return -ENODEV; 86 return -ENODEV;
87} 87}
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h
index 11b8708fc4d..6f65ca86a5e 100644
--- a/arch/arm/include/asm/prom.h
+++ b/arch/arm/include/asm/prom.h
@@ -16,11 +16,6 @@
16#include <asm/setup.h> 16#include <asm/setup.h>
17#include <asm/irq.h> 17#include <asm/irq.h>
18 18
19static inline void irq_dispose_mapping(unsigned int virq)
20{
21 return;
22}
23
24extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); 19extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
25extern void arm_dt_memblock_reserve(void); 20extern void arm_dt_memblock_reserve(void);
26 21
diff --git a/arch/arm/include/asm/vga.h b/arch/arm/include/asm/vga.h
index 250a4dd0063..91f40217bfa 100644
--- a/arch/arm/include/asm/vga.h
+++ b/arch/arm/include/asm/vga.h
@@ -2,9 +2,10 @@
2#define ASMARM_VGA_H 2#define ASMARM_VGA_H
3 3
4#include <linux/io.h> 4#include <linux/io.h>
5#include <mach/hardware.h>
6 5
7#define VGA_MAP_MEM(x,s) (PCIMEM_BASE + (x)) 6extern unsigned long vga_base;
7
8#define VGA_MAP_MEM(x,s) (vga_base + (x))
8 9
9#define vga_readb(x) (*((volatile unsigned char *)x)) 10#define vga_readb(x) (*((volatile unsigned char *)x))
10#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x)) 11#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x))
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index acca35aebe2..aeef960ff79 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -112,9 +112,6 @@ EXPORT_SYMBOL(__put_user_4);
112EXPORT_SYMBOL(__put_user_8); 112EXPORT_SYMBOL(__put_user_8);
113#endif 113#endif
114 114
115 /* crypto hash */
116EXPORT_SYMBOL(sha_transform);
117
118 /* gcc lib functions */ 115 /* gcc lib functions */
119EXPORT_SYMBOL(__ashldi3); 116EXPORT_SYMBOL(__ashldi3);
120EXPORT_SYMBOL(__ashrdi3); 117EXPORT_SYMBOL(__ashrdi3);
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index e4ee050aad7..d6df359408f 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -476,7 +476,7 @@ static u8 __devinit pcibios_swizzle(struct pci_dev *dev, u8 *pin)
476/* 476/*
477 * Map a slot/pin to an IRQ. 477 * Map a slot/pin to an IRQ.
478 */ 478 */
479static int pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 479static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
480{ 480{
481 struct pci_sys_data *sys = dev->sysdata; 481 struct pci_sys_data *sys = dev->sysdata;
482 int irq = -1; 482 int irq = -1;
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 80f7896cc01..9943e9e74a1 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -178,7 +178,7 @@
178 CALL(sys_ni_syscall) /* vm86 */ 178 CALL(sys_ni_syscall) /* vm86 */
179 CALL(sys_ni_syscall) /* was sys_query_module */ 179 CALL(sys_ni_syscall) /* was sys_query_module */
180 CALL(sys_poll) 180 CALL(sys_poll)
181 CALL(sys_nfsservctl) 181 CALL(sys_ni_syscall) /* was nfsservctl */
182/* 170 */ CALL(sys_setresgid16) 182/* 170 */ CALL(sys_setresgid16)
183 CALL(sys_getresgid16) 183 CALL(sys_getresgid16)
184 CALL(sys_prctl) 184 CALL(sys_prctl)
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 0cdd7b456cb..1a33e9d6bb1 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -132,17 +132,3 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
132 132
133 return mdesc_best; 133 return mdesc_best;
134} 134}
135
136/**
137 * irq_create_of_mapping - Hook to resolve OF irq specifier into a Linux irq#
138 *
139 * Currently the mapping mechanism is trivial; simple flat hwirq numbers are
140 * mapped 1:1 onto Linux irq numbers. Cascaded irq controllers are not
141 * supported.
142 */
143unsigned int irq_create_of_mapping(struct device_node *controller,
144 const u32 *intspec, unsigned int intsize)
145{
146 return intspec[0];
147}
148EXPORT_SYMBOL_GPL(irq_create_of_mapping);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 0f928a131af..de3dcab8610 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -67,12 +67,12 @@ int arch_show_interrupts(struct seq_file *p, int prec)
67} 67}
68 68
69/* 69/*
70 * do_IRQ handles all hardware IRQ's. Decoded IRQs should not 70 * handle_IRQ handles all hardware IRQ's. Decoded IRQs should
71 * come via this function. Instead, they should provide their 71 * not come via this function. Instead, they should provide their
72 * own 'handler' 72 * own 'handler'. Used by platform code implementing C-based 1st
73 * level decoding.
73 */ 74 */
74asmlinkage void __exception_irq_entry 75void handle_IRQ(unsigned int irq, struct pt_regs *regs)
75asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
76{ 76{
77 struct pt_regs *old_regs = set_irq_regs(regs); 77 struct pt_regs *old_regs = set_irq_regs(regs);
78 78
@@ -97,6 +97,15 @@ asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
97 set_irq_regs(old_regs); 97 set_irq_regs(old_regs);
98} 98}
99 99
100/*
101 * asm_do_IRQ is the interface to be used from assembly code.
102 */
103asmlinkage void __exception_irq_entry
104asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
105{
106 handle_IRQ(irq, regs);
107}
108
100void set_irq_flags(unsigned int irq, unsigned int iflags) 109void set_irq_flags(unsigned int irq, unsigned int iflags)
101{ 110{
102 unsigned long clr = 0, set = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; 111 unsigned long clr = 0, set = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
diff --git a/arch/arm/kernel/iwmmxt.S b/arch/arm/kernel/iwmmxt.S
index 7fa3bb0d239..a08783823b3 100644
--- a/arch/arm/kernel/iwmmxt.S
+++ b/arch/arm/kernel/iwmmxt.S
@@ -195,10 +195,10 @@ ENTRY(iwmmxt_task_disable)
195 195
196 @ enable access to CP0 and CP1 196 @ enable access to CP0 and CP1
197 XSC(mrc p15, 0, r4, c15, c1, 0) 197 XSC(mrc p15, 0, r4, c15, c1, 0)
198 XSC(orr r4, r4, #0xf) 198 XSC(orr r4, r4, #0x3)
199 XSC(mcr p15, 0, r4, c15, c1, 0) 199 XSC(mcr p15, 0, r4, c15, c1, 0)
200 PJ4(mrc p15, 0, r4, c1, c0, 2) 200 PJ4(mrc p15, 0, r4, c1, c0, 2)
201 PJ4(orr r4, r4, #0x3) 201 PJ4(orr r4, r4, #0xf)
202 PJ4(mcr p15, 0, r4, c1, c0, 2) 202 PJ4(mcr p15, 0, r4, c1, c0, 2)
203 203
204 mov r0, #0 @ nothing to load 204 mov r0, #0 @ nothing to load
@@ -313,7 +313,7 @@ ENTRY(iwmmxt_task_switch)
313 teq r2, r3 @ next task owns it? 313 teq r2, r3 @ next task owns it?
314 movne pc, lr @ no: leave Concan disabled 314 movne pc, lr @ no: leave Concan disabled
315 315
3161: @ flip Conan access 3161: @ flip Concan access
317 XSC(eor r1, r1, #0x3) 317 XSC(eor r1, r1, #0x3)
318 XSC(mcr p15, 0, r1, c15, c1, 0) 318 XSC(mcr p15, 0, r1, c15, c1, 0)
319 PJ4(eor r1, r1, #0xf) 319 PJ4(eor r1, r1, #0xf)
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 05b377616fd..cc2020c2c70 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -323,7 +323,11 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
323#endif 323#endif
324 s = find_mod_section(hdr, sechdrs, ".alt.smp.init"); 324 s = find_mod_section(hdr, sechdrs, ".alt.smp.init");
325 if (s && !is_smp()) 325 if (s && !is_smp())
326#ifdef CONFIG_SMP_ON_UP
326 fixup_smp((void *)s->sh_addr, s->sh_size); 327 fixup_smp((void *)s->sh_addr, s->sh_size);
328#else
329 return -EINVAL;
330#endif
327 return 0; 331 return 0;
328} 332}
329 333
diff --git a/arch/arm/kernel/pmu.c b/arch/arm/kernel/pmu.c
index 2b70709376c..c53474fe84d 100644
--- a/arch/arm/kernel/pmu.c
+++ b/arch/arm/kernel/pmu.c
@@ -31,7 +31,7 @@ static int __devinit pmu_register(struct platform_device *pdev,
31{ 31{
32 if (type < 0 || type >= ARM_NUM_PMU_DEVICES) { 32 if (type < 0 || type >= ARM_NUM_PMU_DEVICES) {
33 pr_warning("received registration request for unknown " 33 pr_warning("received registration request for unknown "
34 "device %d\n", type); 34 "PMU device type %d\n", type);
35 return -EINVAL; 35 return -EINVAL;
36 } 36 }
37 37
@@ -112,17 +112,17 @@ static int __init register_pmu_driver(void)
112device_initcall(register_pmu_driver); 112device_initcall(register_pmu_driver);
113 113
114struct platform_device * 114struct platform_device *
115reserve_pmu(enum arm_pmu_type device) 115reserve_pmu(enum arm_pmu_type type)
116{ 116{
117 struct platform_device *pdev; 117 struct platform_device *pdev;
118 118
119 if (test_and_set_bit_lock(device, &pmu_lock)) { 119 if (test_and_set_bit_lock(type, &pmu_lock)) {
120 pdev = ERR_PTR(-EBUSY); 120 pdev = ERR_PTR(-EBUSY);
121 } else if (pmu_devices[device] == NULL) { 121 } else if (pmu_devices[type] == NULL) {
122 clear_bit_unlock(device, &pmu_lock); 122 clear_bit_unlock(type, &pmu_lock);
123 pdev = ERR_PTR(-ENODEV); 123 pdev = ERR_PTR(-ENODEV);
124 } else { 124 } else {
125 pdev = pmu_devices[device]; 125 pdev = pmu_devices[type];
126 } 126 }
127 127
128 return pdev; 128 return pdev;
@@ -130,11 +130,11 @@ reserve_pmu(enum arm_pmu_type device)
130EXPORT_SYMBOL_GPL(reserve_pmu); 130EXPORT_SYMBOL_GPL(reserve_pmu);
131 131
132int 132int
133release_pmu(enum arm_pmu_type device) 133release_pmu(enum arm_pmu_type type)
134{ 134{
135 if (WARN_ON(!pmu_devices[device])) 135 if (WARN_ON(!pmu_devices[type]))
136 return -EINVAL; 136 return -EINVAL;
137 clear_bit_unlock(device, &pmu_lock); 137 clear_bit_unlock(type, &pmu_lock);
138 return 0; 138 return 0;
139} 139}
140EXPORT_SYMBOL_GPL(release_pmu); 140EXPORT_SYMBOL_GPL(release_pmu);
@@ -182,17 +182,17 @@ init_cpu_pmu(void)
182} 182}
183 183
184int 184int
185init_pmu(enum arm_pmu_type device) 185init_pmu(enum arm_pmu_type type)
186{ 186{
187 int err = 0; 187 int err = 0;
188 188
189 switch (device) { 189 switch (type) {
190 case ARM_PMU_DEVICE_CPU: 190 case ARM_PMU_DEVICE_CPU:
191 err = init_cpu_pmu(); 191 err = init_cpu_pmu();
192 break; 192 break;
193 default: 193 default:
194 pr_warning("attempt to initialise unknown device %d\n", 194 pr_warning("attempt to initialise PMU of unknown "
195 device); 195 "type %d\n", type);
196 err = -EINVAL; 196 err = -EINVAL;
197 } 197 }
198 198
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 5e1e5419722..1a347f481e5 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -30,6 +30,7 @@
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/random.h> 31#include <linux/random.h>
32#include <linux/hw_breakpoint.h> 32#include <linux/hw_breakpoint.h>
33#include <linux/cpuidle.h>
33 34
34#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
35#include <asm/leds.h> 36#include <asm/leds.h>
@@ -196,7 +197,8 @@ void cpu_idle(void)
196 cpu_relax(); 197 cpu_relax();
197 } else { 198 } else {
198 stop_critical_timings(); 199 stop_critical_timings();
199 pm_idle(); 200 if (cpuidle_idle_call())
201 pm_idle();
200 start_critical_timings(); 202 start_critical_timings();
201 /* 203 /*
202 * This will eventually be removed - pm_idle 204 * This will eventually be removed - pm_idle
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index 9cf4cbf8f95..d0cdedf4864 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -57,7 +57,8 @@ relocate_new_kernel:
57 mov r0,#0 57 mov r0,#0
58 ldr r1,kexec_mach_type 58 ldr r1,kexec_mach_type
59 ldr r2,kexec_boot_atags 59 ldr r2,kexec_boot_atags
60 mov pc,lr 60 ARM( mov pc, lr )
61 THUMB( bx lr )
61 62
62 .align 63 .align
63 64
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 70bca649e92..e514c76043b 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -280,18 +280,19 @@ static void __init cacheid_init(void)
280 if (arch >= CPU_ARCH_ARMv6) { 280 if (arch >= CPU_ARCH_ARMv6) {
281 if ((cachetype & (7 << 29)) == 4 << 29) { 281 if ((cachetype & (7 << 29)) == 4 << 29) {
282 /* ARMv7 register format */ 282 /* ARMv7 register format */
283 arch = CPU_ARCH_ARMv7;
283 cacheid = CACHEID_VIPT_NONALIASING; 284 cacheid = CACHEID_VIPT_NONALIASING;
284 if ((cachetype & (3 << 14)) == 1 << 14) 285 if ((cachetype & (3 << 14)) == 1 << 14)
285 cacheid |= CACHEID_ASID_TAGGED; 286 cacheid |= CACHEID_ASID_TAGGED;
286 else if (cpu_has_aliasing_icache(CPU_ARCH_ARMv7))
287 cacheid |= CACHEID_VIPT_I_ALIASING;
288 } else if (cachetype & (1 << 23)) {
289 cacheid = CACHEID_VIPT_ALIASING;
290 } else { 287 } else {
291 cacheid = CACHEID_VIPT_NONALIASING; 288 arch = CPU_ARCH_ARMv6;
292 if (cpu_has_aliasing_icache(CPU_ARCH_ARMv6)) 289 if (cachetype & (1 << 23))
293 cacheid |= CACHEID_VIPT_I_ALIASING; 290 cacheid = CACHEID_VIPT_ALIASING;
291 else
292 cacheid = CACHEID_VIPT_NONALIASING;
294 } 293 }
294 if (cpu_has_aliasing_icache(arch))
295 cacheid |= CACHEID_VIPT_I_ALIASING;
295 } else { 296 } else {
296 cacheid = CACHEID_VIVT; 297 cacheid = CACHEID_VIVT;
297 } 298 }
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 167e3cbe1f2..d88ff0230e8 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -27,7 +27,7 @@
27#include <linux/clockchips.h> 27#include <linux/clockchips.h>
28#include <linux/completion.h> 28#include <linux/completion.h>
29 29
30#include <asm/atomic.h> 30#include <linux/atomic.h>
31#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
32#include <asm/cpu.h> 32#include <asm/cpu.h>
33#include <asm/cputype.h> 33#include <asm/cputype.h>
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 2c277d40cee..01c186222f3 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -137,8 +137,8 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
137 clk->max_delta_ns = clockevent_delta2ns(0xffffffff, clk); 137 clk->max_delta_ns = clockevent_delta2ns(0xffffffff, clk);
138 clk->min_delta_ns = clockevent_delta2ns(0xf, clk); 138 clk->min_delta_ns = clockevent_delta2ns(0xf, clk);
139 139
140 clockevents_register_device(clk);
141
140 /* Make sure our local interrupt controller has this enabled */ 142 /* Make sure our local interrupt controller has this enabled */
141 gic_enable_ppi(clk->irq); 143 gic_enable_ppi(clk->irq);
142
143 clockevents_register_device(clk);
144} 144}
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 2d3436e9f71..bc9f9da782c 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -25,7 +25,7 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27 27
28#include <asm/atomic.h> 28#include <linux/atomic.h>
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/unistd.h> 31#include <asm/unistd.h>
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 59ff42ddf0a..cf73a7f742d 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -12,7 +12,7 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
12 strchr.o strrchr.o \ 12 strchr.o strrchr.o \
13 testchangebit.o testclearbit.o testsetbit.o \ 13 testchangebit.o testclearbit.o testsetbit.o \
14 ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 14 ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
15 ucmpdi2.o lib1funcs.o div64.o sha1.o \ 15 ucmpdi2.o lib1funcs.o div64.o \
16 io-readsb.o io-writesb.o io-readsl.o io-writesl.o 16 io-readsb.o io-writesb.o io-readsl.o io-writesl.o
17 17
18mmu-y := clear_user.o copy_page.o getuser.o putuser.o 18mmu-y := clear_user.o copy_page.o getuser.o putuser.o
diff --git a/arch/arm/lib/ecard.S b/arch/arm/lib/ecard.S
index 8678eb2b7a6..e6057fa851b 100644
--- a/arch/arm/lib/ecard.S
+++ b/arch/arm/lib/ecard.S
@@ -12,7 +12,6 @@
12 */ 12 */
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15#include <mach/hardware.h>
16 15
17#define CPSR2SPSR(rt) \ 16#define CPSR2SPSR(rt) \
18 mrs rt, cpsr; \ 17 mrs rt, cpsr; \
diff --git a/arch/arm/lib/io-readsw-armv3.S b/arch/arm/lib/io-readsw-armv3.S
index 9aaf7c72065..88487c8c4f2 100644
--- a/arch/arm/lib/io-readsw-armv3.S
+++ b/arch/arm/lib/io-readsw-armv3.S
@@ -9,7 +9,6 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <asm/assembler.h> 11#include <asm/assembler.h>
12#include <mach/hardware.h>
13 12
14.Linsw_bad_alignment: 13.Linsw_bad_alignment:
15 adr r0, .Linsw_bad_align_msg 14 adr r0, .Linsw_bad_align_msg
diff --git a/arch/arm/lib/io-writesw-armv3.S b/arch/arm/lib/io-writesw-armv3.S
index cd34503e424..49b800419e3 100644
--- a/arch/arm/lib/io-writesw-armv3.S
+++ b/arch/arm/lib/io-writesw-armv3.S
@@ -9,7 +9,6 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <asm/assembler.h> 11#include <asm/assembler.h>
12#include <mach/hardware.h>
13 12
14.Loutsw_bad_alignment: 13.Loutsw_bad_alignment:
15 adr r0, .Loutsw_bad_align_msg 14 adr r0, .Loutsw_bad_align_msg
diff --git a/arch/arm/lib/sha1.S b/arch/arm/lib/sha1.S
deleted file mode 100644
index eb0edb80d7b..00000000000
--- a/arch/arm/lib/sha1.S
+++ /dev/null
@@ -1,211 +0,0 @@
1/*
2 * linux/arch/arm/lib/sha1.S
3 *
4 * SHA transform optimized for ARM
5 *
6 * Copyright: (C) 2005 by Nicolas Pitre <nico@fluxnic.net>
7 * Created: September 17, 2005
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 * The reference implementation for this code is linux/lib/sha1.c
14 */
15
16#include <linux/linkage.h>
17
18 .text
19
20
21/*
22 * void sha_transform(__u32 *digest, const char *in, __u32 *W)
23 *
24 * Note: the "in" ptr may be unaligned.
25 */
26
27ENTRY(sha_transform)
28
29 stmfd sp!, {r4 - r8, lr}
30
31 @ for (i = 0; i < 16; i++)
32 @ W[i] = be32_to_cpu(in[i]);
33
34#ifdef __ARMEB__
35 mov r4, r0
36 mov r0, r2
37 mov r2, #64
38 bl memcpy
39 mov r2, r0
40 mov r0, r4
41#else
42 mov r3, r2
43 mov lr, #16
441: ldrb r4, [r1], #1
45 ldrb r5, [r1], #1
46 ldrb r6, [r1], #1
47 ldrb r7, [r1], #1
48 subs lr, lr, #1
49 orr r5, r5, r4, lsl #8
50 orr r6, r6, r5, lsl #8
51 orr r7, r7, r6, lsl #8
52 str r7, [r3], #4
53 bne 1b
54#endif
55
56 @ for (i = 0; i < 64; i++)
57 @ W[i+16] = ror(W[i+13] ^ W[i+8] ^ W[i+2] ^ W[i], 31);
58
59 sub r3, r2, #4
60 mov lr, #64
612: ldr r4, [r3, #4]!
62 subs lr, lr, #1
63 ldr r5, [r3, #8]
64 ldr r6, [r3, #32]
65 ldr r7, [r3, #52]
66 eor r4, r4, r5
67 eor r4, r4, r6
68 eor r4, r4, r7
69 mov r4, r4, ror #31
70 str r4, [r3, #64]
71 bne 2b
72
73 /*
74 * The SHA functions are:
75 *
76 * f1(B,C,D) = (D ^ (B & (C ^ D)))
77 * f2(B,C,D) = (B ^ C ^ D)
78 * f3(B,C,D) = ((B & C) | (D & (B | C)))
79 *
80 * Then the sub-blocks are processed as follows:
81 *
82 * A' = ror(A, 27) + f(B,C,D) + E + K + *W++
83 * B' = A
84 * C' = ror(B, 2)
85 * D' = C
86 * E' = D
87 *
88 * We therefore unroll each loop 5 times to avoid register shuffling.
89 * Also the ror for C (and also D and E which are successivelyderived
90 * from it) is applied in place to cut on an additional mov insn for
91 * each round.
92 */
93
94 .macro sha_f1, A, B, C, D, E
95 ldr r3, [r2], #4
96 eor ip, \C, \D
97 add \E, r1, \E, ror #2
98 and ip, \B, ip, ror #2
99 add \E, \E, \A, ror #27
100 eor ip, ip, \D, ror #2
101 add \E, \E, r3
102 add \E, \E, ip
103 .endm
104
105 .macro sha_f2, A, B, C, D, E
106 ldr r3, [r2], #4
107 add \E, r1, \E, ror #2
108 eor ip, \B, \C, ror #2
109 add \E, \E, \A, ror #27
110 eor ip, ip, \D, ror #2
111 add \E, \E, r3
112 add \E, \E, ip
113 .endm
114
115 .macro sha_f3, A, B, C, D, E
116 ldr r3, [r2], #4
117 add \E, r1, \E, ror #2
118 orr ip, \B, \C, ror #2
119 add \E, \E, \A, ror #27
120 and ip, ip, \D, ror #2
121 add \E, \E, r3
122 and r3, \B, \C, ror #2
123 orr ip, ip, r3
124 add \E, \E, ip
125 .endm
126
127 ldmia r0, {r4 - r8}
128
129 mov lr, #4
130 ldr r1, .L_sha_K + 0
131
132 /* adjust initial values */
133 mov r6, r6, ror #30
134 mov r7, r7, ror #30
135 mov r8, r8, ror #30
136
1373: subs lr, lr, #1
138 sha_f1 r4, r5, r6, r7, r8
139 sha_f1 r8, r4, r5, r6, r7
140 sha_f1 r7, r8, r4, r5, r6
141 sha_f1 r6, r7, r8, r4, r5
142 sha_f1 r5, r6, r7, r8, r4
143 bne 3b
144
145 ldr r1, .L_sha_K + 4
146 mov lr, #4
147
1484: subs lr, lr, #1
149 sha_f2 r4, r5, r6, r7, r8
150 sha_f2 r8, r4, r5, r6, r7
151 sha_f2 r7, r8, r4, r5, r6
152 sha_f2 r6, r7, r8, r4, r5
153 sha_f2 r5, r6, r7, r8, r4
154 bne 4b
155
156 ldr r1, .L_sha_K + 8
157 mov lr, #4
158
1595: subs lr, lr, #1
160 sha_f3 r4, r5, r6, r7, r8
161 sha_f3 r8, r4, r5, r6, r7
162 sha_f3 r7, r8, r4, r5, r6
163 sha_f3 r6, r7, r8, r4, r5
164 sha_f3 r5, r6, r7, r8, r4
165 bne 5b
166
167 ldr r1, .L_sha_K + 12
168 mov lr, #4
169
1706: subs lr, lr, #1
171 sha_f2 r4, r5, r6, r7, r8
172 sha_f2 r8, r4, r5, r6, r7
173 sha_f2 r7, r8, r4, r5, r6
174 sha_f2 r6, r7, r8, r4, r5
175 sha_f2 r5, r6, r7, r8, r4
176 bne 6b
177
178 ldmia r0, {r1, r2, r3, ip, lr}
179 add r4, r1, r4
180 add r5, r2, r5
181 add r6, r3, r6, ror #2
182 add r7, ip, r7, ror #2
183 add r8, lr, r8, ror #2
184 stmia r0, {r4 - r8}
185
186 ldmfd sp!, {r4 - r8, pc}
187
188ENDPROC(sha_transform)
189
190 .align 2
191.L_sha_K:
192 .word 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6
193
194
195/*
196 * void sha_init(__u32 *buf)
197 */
198
199 .align 2
200.L_sha_initial_digest:
201 .word 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
202
203ENTRY(sha_init)
204
205 str lr, [sp, #-4]!
206 adr r1, .L_sha_initial_digest
207 ldmia r1, {r1, r2, r3, ip, lr}
208 stmia r0, {r1, r2, r3, ip, lr}
209 ldr pc, [sp], #4
210
211ENDPROC(sha_init)
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 96966231920..bf57e8b1c9d 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := irq.o gpio.o 5obj-y := irq.o gpio.o setup.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index f1013d08bb5..bfc684441ef 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -25,23 +25,10 @@
25#include <mach/at91_rstc.h> 25#include <mach/at91_rstc.h>
26#include <mach/at91_shdwc.h> 26#include <mach/at91_shdwc.h>
27 27
28#include "soc.h"
28#include "generic.h" 29#include "generic.h"
29#include "clock.h" 30#include "clock.h"
30 31
31static struct map_desc at91cap9_io_desc[] __initdata = {
32 {
33 .virtual = AT91_VA_BASE_SYS,
34 .pfn = __phys_to_pfn(AT91_BASE_SYS),
35 .length = SZ_16K,
36 .type = MT_DEVICE,
37 }, {
38 .virtual = AT91_IO_VIRT_BASE - AT91CAP9_SRAM_SIZE,
39 .pfn = __phys_to_pfn(AT91CAP9_SRAM_BASE),
40 .length = AT91CAP9_SRAM_SIZE,
41 .type = MT_DEVICE,
42 },
43};
44
45/* -------------------------------------------------------------------- 32/* --------------------------------------------------------------------
46 * Clocks 33 * Clocks
47 * -------------------------------------------------------------------- */ 34 * -------------------------------------------------------------------- */
@@ -339,24 +326,17 @@ static void at91cap9_poweroff(void)
339 * AT91CAP9 processor initialization 326 * AT91CAP9 processor initialization
340 * -------------------------------------------------------------------- */ 327 * -------------------------------------------------------------------- */
341 328
342void __init at91cap9_map_io(void) 329static void __init at91cap9_map_io(void)
343{ 330{
344 /* Map peripherals */ 331 at91_init_sram(0, AT91CAP9_SRAM_BASE, AT91CAP9_SRAM_SIZE);
345 iotable_init(at91cap9_io_desc, ARRAY_SIZE(at91cap9_io_desc));
346} 332}
347 333
348void __init at91cap9_initialize(unsigned long main_clock) 334static void __init at91cap9_initialize(void)
349{ 335{
350 at91_arch_reset = at91cap9_reset; 336 at91_arch_reset = at91cap9_reset;
351 pm_power_off = at91cap9_poweroff; 337 pm_power_off = at91cap9_poweroff;
352 at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1); 338 at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
353 339
354 /* Init clock subsystem */
355 at91_clock_init(main_clock);
356
357 /* Register the processor-specific clocks */
358 at91cap9_register_clocks();
359
360 /* Register GPIO subsystem */ 340 /* Register GPIO subsystem */
361 at91_gpio_init(at91cap9_gpio, 4); 341 at91_gpio_init(at91cap9_gpio, 4);
362 342
@@ -409,14 +389,9 @@ static unsigned int at91cap9_default_irq_priority[NR_AIC_IRQS] __initdata = {
409 0, /* Advanced Interrupt Controller (IRQ1) */ 389 0, /* Advanced Interrupt Controller (IRQ1) */
410}; 390};
411 391
412void __init at91cap9_init_interrupts(unsigned int priority[NR_AIC_IRQS]) 392struct at91_init_soc __initdata at91cap9_soc = {
413{ 393 .map_io = at91cap9_map_io,
414 if (!priority) 394 .default_irq_priority = at91cap9_default_irq_priority,
415 priority = at91cap9_default_irq_priority; 395 .register_clocks = at91cap9_register_clocks,
416 396 .init = at91cap9_initialize,
417 /* Initialize the AIC interrupt controller */ 397};
418 at91_aic_init(priority);
419
420 /* Enable GPIO interrupts */
421 at91_gpio_irq_setup();
422}
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 83a1a3fee55..f73302dbc6a 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -20,25 +20,16 @@
20#include <mach/at91_st.h> 20#include <mach/at91_st.h>
21#include <mach/cpu.h> 21#include <mach/cpu.h>
22 22
23#include "soc.h"
23#include "generic.h" 24#include "generic.h"
24#include "clock.h" 25#include "clock.h"
25 26
26static struct map_desc at91rm9200_io_desc[] __initdata = { 27static struct map_desc at91rm9200_io_desc[] __initdata = {
27 { 28 {
28 .virtual = AT91_VA_BASE_SYS,
29 .pfn = __phys_to_pfn(AT91_BASE_SYS),
30 .length = SZ_4K,
31 .type = MT_DEVICE,
32 }, {
33 .virtual = AT91_VA_BASE_EMAC, 29 .virtual = AT91_VA_BASE_EMAC,
34 .pfn = __phys_to_pfn(AT91RM9200_BASE_EMAC), 30 .pfn = __phys_to_pfn(AT91RM9200_BASE_EMAC),
35 .length = SZ_16K, 31 .length = SZ_16K,
36 .type = MT_DEVICE, 32 .type = MT_DEVICE,
37 }, {
38 .virtual = AT91_IO_VIRT_BASE - AT91RM9200_SRAM_SIZE,
39 .pfn = __phys_to_pfn(AT91RM9200_SRAM_BASE),
40 .length = AT91RM9200_SRAM_SIZE,
41 .type = MT_DEVICE,
42 }, 33 },
43}; 34};
44 35
@@ -304,24 +295,17 @@ static void at91rm9200_reset(void)
304 at91_sys_write(AT91_ST_CR, AT91_ST_WDRST); 295 at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
305} 296}
306 297
307int rm9200_type;
308EXPORT_SYMBOL(rm9200_type);
309
310void __init at91rm9200_set_type(int type)
311{
312 rm9200_type = type;
313}
314
315/* -------------------------------------------------------------------- 298/* --------------------------------------------------------------------
316 * AT91RM9200 processor initialization 299 * AT91RM9200 processor initialization
317 * -------------------------------------------------------------------- */ 300 * -------------------------------------------------------------------- */
318void __init at91rm9200_map_io(void) 301static void __init at91rm9200_map_io(void)
319{ 302{
320 /* Map peripherals */ 303 /* Map peripherals */
304 at91_init_sram(0, AT91RM9200_SRAM_BASE, AT91RM9200_SRAM_SIZE);
321 iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc)); 305 iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc));
322} 306}
323 307
324void __init at91rm9200_initialize(unsigned long main_clock) 308static void __init at91rm9200_initialize(void)
325{ 309{
326 at91_arch_reset = at91rm9200_reset; 310 at91_arch_reset = at91rm9200_reset;
327 at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1) 311 at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
@@ -329,12 +313,6 @@ void __init at91rm9200_initialize(unsigned long main_clock)
329 | (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5) 313 | (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
330 | (1 << AT91RM9200_ID_IRQ6); 314 | (1 << AT91RM9200_ID_IRQ6);
331 315
332 /* Init clock subsystem */
333 at91_clock_init(main_clock);
334
335 /* Register the processor-specific clocks */
336 at91rm9200_register_clocks();
337
338 /* Initialize GPIO subsystem */ 316 /* Initialize GPIO subsystem */
339 at91_gpio_init(at91rm9200_gpio, 317 at91_gpio_init(at91rm9200_gpio,
340 cpu_is_at91rm9200_bga() ? AT91RM9200_BGA : AT91RM9200_PQFP); 318 cpu_is_at91rm9200_bga() ? AT91RM9200_BGA : AT91RM9200_PQFP);
@@ -383,14 +361,9 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
383 0 /* Advanced Interrupt Controller (IRQ6) */ 361 0 /* Advanced Interrupt Controller (IRQ6) */
384}; 362};
385 363
386void __init at91rm9200_init_interrupts(unsigned int priority[NR_AIC_IRQS]) 364struct at91_init_soc __initdata at91rm9200_soc = {
387{ 365 .map_io = at91rm9200_map_io,
388 if (!priority) 366 .default_irq_priority = at91rm9200_default_irq_priority,
389 priority = at91rm9200_default_irq_priority; 367 .register_clocks = at91rm9200_register_clocks,
390 368 .init = at91rm9200_initialize,
391 /* Initialize the AIC interrupt controller */ 369};
392 at91_aic_init(priority);
393
394 /* Enable GPIO interrupts */
395 at91_gpio_irq_setup();
396}
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 7d606b04d31..cb397be1444 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -17,58 +17,16 @@
17#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <mach/cpu.h> 19#include <mach/cpu.h>
20#include <mach/at91_dbgu.h>
20#include <mach/at91sam9260.h> 21#include <mach/at91sam9260.h>
21#include <mach/at91_pmc.h> 22#include <mach/at91_pmc.h>
22#include <mach/at91_rstc.h> 23#include <mach/at91_rstc.h>
23#include <mach/at91_shdwc.h> 24#include <mach/at91_shdwc.h>
24 25
26#include "soc.h"
25#include "generic.h" 27#include "generic.h"
26#include "clock.h" 28#include "clock.h"
27 29
28static struct map_desc at91sam9260_io_desc[] __initdata = {
29 {
30 .virtual = AT91_VA_BASE_SYS,
31 .pfn = __phys_to_pfn(AT91_BASE_SYS),
32 .length = SZ_16K,
33 .type = MT_DEVICE,
34 }
35};
36
37static struct map_desc at91sam9260_sram_desc[] __initdata = {
38 {
39 .virtual = AT91_IO_VIRT_BASE - AT91SAM9260_SRAM0_SIZE,
40 .pfn = __phys_to_pfn(AT91SAM9260_SRAM0_BASE),
41 .length = AT91SAM9260_SRAM0_SIZE,
42 .type = MT_DEVICE,
43 }, {
44 .virtual = AT91_IO_VIRT_BASE - AT91SAM9260_SRAM0_SIZE - AT91SAM9260_SRAM1_SIZE,
45 .pfn = __phys_to_pfn(AT91SAM9260_SRAM1_BASE),
46 .length = AT91SAM9260_SRAM1_SIZE,
47 .type = MT_DEVICE,
48 }
49};
50
51static struct map_desc at91sam9g20_sram_desc[] __initdata = {
52 {
53 .virtual = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE,
54 .pfn = __phys_to_pfn(AT91SAM9G20_SRAM0_BASE),
55 .length = AT91SAM9G20_SRAM0_SIZE,
56 .type = MT_DEVICE,
57 }, {
58 .virtual = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE - AT91SAM9G20_SRAM1_SIZE,
59 .pfn = __phys_to_pfn(AT91SAM9G20_SRAM1_BASE),
60 .length = AT91SAM9G20_SRAM1_SIZE,
61 .type = MT_DEVICE,
62 }
63};
64
65static struct map_desc at91sam9xe_sram_desc[] __initdata = {
66 {
67 .pfn = __phys_to_pfn(AT91SAM9XE_SRAM_BASE),
68 .type = MT_DEVICE,
69 }
70};
71
72/* -------------------------------------------------------------------- 30/* --------------------------------------------------------------------
73 * Clocks 31 * Clocks
74 * -------------------------------------------------------------------- */ 32 * -------------------------------------------------------------------- */
@@ -330,11 +288,9 @@ static void at91sam9260_poweroff(void)
330 288
331static void __init at91sam9xe_map_io(void) 289static void __init at91sam9xe_map_io(void)
332{ 290{
333 unsigned long cidr, sram_size; 291 unsigned long sram_size;
334
335 cidr = at91_sys_read(AT91_DBGU_CIDR);
336 292
337 switch (cidr & AT91_CIDR_SRAMSIZ) { 293 switch (at91_soc_initdata.cidr & AT91_CIDR_SRAMSIZ) {
338 case AT91_CIDR_SRAMSIZ_32K: 294 case AT91_CIDR_SRAMSIZ_32K:
339 sram_size = 2 * SZ_16K; 295 sram_size = 2 * SZ_16K;
340 break; 296 break;
@@ -343,38 +299,29 @@ static void __init at91sam9xe_map_io(void)
343 sram_size = SZ_16K; 299 sram_size = SZ_16K;
344 } 300 }
345 301
346 at91sam9xe_sram_desc->virtual = AT91_IO_VIRT_BASE - sram_size; 302 at91_init_sram(0, AT91SAM9XE_SRAM_BASE, sram_size);
347 at91sam9xe_sram_desc->length = sram_size;
348
349 iotable_init(at91sam9xe_sram_desc, ARRAY_SIZE(at91sam9xe_sram_desc));
350} 303}
351 304
352void __init at91sam9260_map_io(void) 305static void __init at91sam9260_map_io(void)
353{ 306{
354 /* Map peripherals */ 307 if (cpu_is_at91sam9xe()) {
355 iotable_init(at91sam9260_io_desc, ARRAY_SIZE(at91sam9260_io_desc));
356
357 if (cpu_is_at91sam9xe())
358 at91sam9xe_map_io(); 308 at91sam9xe_map_io();
359 else if (cpu_is_at91sam9g20()) 309 } else if (cpu_is_at91sam9g20()) {
360 iotable_init(at91sam9g20_sram_desc, ARRAY_SIZE(at91sam9g20_sram_desc)); 310 at91_init_sram(0, AT91SAM9G20_SRAM0_BASE, AT91SAM9G20_SRAM0_SIZE);
361 else 311 at91_init_sram(1, AT91SAM9G20_SRAM1_BASE, AT91SAM9G20_SRAM1_SIZE);
362 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc)); 312 } else {
313 at91_init_sram(0, AT91SAM9260_SRAM0_BASE, AT91SAM9260_SRAM0_SIZE);
314 at91_init_sram(1, AT91SAM9260_SRAM1_BASE, AT91SAM9260_SRAM1_SIZE);
315 }
363} 316}
364 317
365void __init at91sam9260_initialize(unsigned long main_clock) 318static void __init at91sam9260_initialize(void)
366{ 319{
367 at91_arch_reset = at91sam9_alt_reset; 320 at91_arch_reset = at91sam9_alt_reset;
368 pm_power_off = at91sam9260_poweroff; 321 pm_power_off = at91sam9260_poweroff;
369 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1) 322 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
370 | (1 << AT91SAM9260_ID_IRQ2); 323 | (1 << AT91SAM9260_ID_IRQ2);
371 324
372 /* Init clock subsystem */
373 at91_clock_init(main_clock);
374
375 /* Register the processor-specific clocks */
376 at91sam9260_register_clocks();
377
378 /* Register GPIO subsystem */ 325 /* Register GPIO subsystem */
379 at91_gpio_init(at91sam9260_gpio, 3); 326 at91_gpio_init(at91sam9260_gpio, 3);
380} 327}
@@ -421,14 +368,9 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
421 0, /* Advanced Interrupt Controller */ 368 0, /* Advanced Interrupt Controller */
422}; 369};
423 370
424void __init at91sam9260_init_interrupts(unsigned int priority[NR_AIC_IRQS]) 371struct at91_init_soc __initdata at91sam9260_soc = {
425{ 372 .map_io = at91sam9260_map_io,
426 if (!priority) 373 .default_irq_priority = at91sam9260_default_irq_priority,
427 priority = at91sam9260_default_irq_priority; 374 .register_clocks = at91sam9260_register_clocks,
428 375 .init = at91sam9260_initialize,
429 /* Initialize the AIC interrupt controller */ 376};
430 at91_aic_init(priority);
431
432 /* Enable GPIO interrupts */
433 at91_gpio_irq_setup();
434}
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index c1483168c97..6c8e3b5f669 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -22,36 +22,10 @@
22#include <mach/at91_rstc.h> 22#include <mach/at91_rstc.h>
23#include <mach/at91_shdwc.h> 23#include <mach/at91_shdwc.h>
24 24
25#include "soc.h"
25#include "generic.h" 26#include "generic.h"
26#include "clock.h" 27#include "clock.h"
27 28
28static struct map_desc at91sam9261_io_desc[] __initdata = {
29 {
30 .virtual = AT91_VA_BASE_SYS,
31 .pfn = __phys_to_pfn(AT91_BASE_SYS),
32 .length = SZ_16K,
33 .type = MT_DEVICE,
34 },
35};
36
37static struct map_desc at91sam9261_sram_desc[] __initdata = {
38 {
39 .virtual = AT91_IO_VIRT_BASE - AT91SAM9261_SRAM_SIZE,
40 .pfn = __phys_to_pfn(AT91SAM9261_SRAM_BASE),
41 .length = AT91SAM9261_SRAM_SIZE,
42 .type = MT_DEVICE,
43 },
44};
45
46static struct map_desc at91sam9g10_sram_desc[] __initdata = {
47 {
48 .virtual = AT91_IO_VIRT_BASE - AT91SAM9G10_SRAM_SIZE,
49 .pfn = __phys_to_pfn(AT91SAM9G10_SRAM_BASE),
50 .length = AT91SAM9G10_SRAM_SIZE,
51 .type = MT_DEVICE,
52 },
53};
54
55/* -------------------------------------------------------------------- 29/* --------------------------------------------------------------------
56 * Clocks 30 * Clocks
57 * -------------------------------------------------------------------- */ 31 * -------------------------------------------------------------------- */
@@ -183,7 +157,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
183 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), 157 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
184 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), 158 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
185 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk), 159 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
186 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc1_clk), 160 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
187 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 161 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
188 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 162 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
189 CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), 163 CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
@@ -302,30 +276,21 @@ static void at91sam9261_poweroff(void)
302 * AT91SAM9261 processor initialization 276 * AT91SAM9261 processor initialization
303 * -------------------------------------------------------------------- */ 277 * -------------------------------------------------------------------- */
304 278
305void __init at91sam9261_map_io(void) 279static void __init at91sam9261_map_io(void)
306{ 280{
307 /* Map peripherals */
308 iotable_init(at91sam9261_io_desc, ARRAY_SIZE(at91sam9261_io_desc));
309
310 if (cpu_is_at91sam9g10()) 281 if (cpu_is_at91sam9g10())
311 iotable_init(at91sam9g10_sram_desc, ARRAY_SIZE(at91sam9g10_sram_desc)); 282 at91_init_sram(0, AT91SAM9G10_SRAM_BASE, AT91SAM9G10_SRAM_SIZE);
312 else 283 else
313 iotable_init(at91sam9261_sram_desc, ARRAY_SIZE(at91sam9261_sram_desc)); 284 at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE);
314} 285}
315 286
316void __init at91sam9261_initialize(unsigned long main_clock) 287static void __init at91sam9261_initialize(void)
317{ 288{
318 at91_arch_reset = at91sam9_alt_reset; 289 at91_arch_reset = at91sam9_alt_reset;
319 pm_power_off = at91sam9261_poweroff; 290 pm_power_off = at91sam9261_poweroff;
320 at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1) 291 at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
321 | (1 << AT91SAM9261_ID_IRQ2); 292 | (1 << AT91SAM9261_ID_IRQ2);
322 293
323 /* Init clock subsystem */
324 at91_clock_init(main_clock);
325
326 /* Register the processor-specific clocks */
327 at91sam9261_register_clocks();
328
329 /* Register GPIO subsystem */ 294 /* Register GPIO subsystem */
330 at91_gpio_init(at91sam9261_gpio, 3); 295 at91_gpio_init(at91sam9261_gpio, 3);
331} 296}
@@ -372,14 +337,9 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
372 0, /* Advanced Interrupt Controller */ 337 0, /* Advanced Interrupt Controller */
373}; 338};
374 339
375void __init at91sam9261_init_interrupts(unsigned int priority[NR_AIC_IRQS]) 340struct at91_init_soc __initdata at91sam9261_soc = {
376{ 341 .map_io = at91sam9261_map_io,
377 if (!priority) 342 .default_irq_priority = at91sam9261_default_irq_priority,
378 priority = at91sam9261_default_irq_priority; 343 .register_clocks = at91sam9261_register_clocks,
379 344 .init = at91sam9261_initialize,
380 /* Initialize the AIC interrupt controller */ 345};
381 at91_aic_init(priority);
382
383 /* Enable GPIO interrupts */
384 at91_gpio_irq_setup();
385}
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index dc28477d14f..044f3c927e6 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -21,28 +21,10 @@
21#include <mach/at91_rstc.h> 21#include <mach/at91_rstc.h>
22#include <mach/at91_shdwc.h> 22#include <mach/at91_shdwc.h>
23 23
24#include "soc.h"
24#include "generic.h" 25#include "generic.h"
25#include "clock.h" 26#include "clock.h"
26 27
27static struct map_desc at91sam9263_io_desc[] __initdata = {
28 {
29 .virtual = AT91_VA_BASE_SYS,
30 .pfn = __phys_to_pfn(AT91_BASE_SYS),
31 .length = SZ_16K,
32 .type = MT_DEVICE,
33 }, {
34 .virtual = AT91_IO_VIRT_BASE - AT91SAM9263_SRAM0_SIZE,
35 .pfn = __phys_to_pfn(AT91SAM9263_SRAM0_BASE),
36 .length = AT91SAM9263_SRAM0_SIZE,
37 .type = MT_DEVICE,
38 }, {
39 .virtual = AT91_IO_VIRT_BASE - AT91SAM9263_SRAM0_SIZE - AT91SAM9263_SRAM1_SIZE,
40 .pfn = __phys_to_pfn(AT91SAM9263_SRAM1_BASE),
41 .length = AT91SAM9263_SRAM1_SIZE,
42 .type = MT_DEVICE,
43 },
44};
45
46/* -------------------------------------------------------------------- 28/* --------------------------------------------------------------------
47 * Clocks 29 * Clocks
48 * -------------------------------------------------------------------- */ 30 * -------------------------------------------------------------------- */
@@ -313,24 +295,18 @@ static void at91sam9263_poweroff(void)
313 * AT91SAM9263 processor initialization 295 * AT91SAM9263 processor initialization
314 * -------------------------------------------------------------------- */ 296 * -------------------------------------------------------------------- */
315 297
316void __init at91sam9263_map_io(void) 298static void __init at91sam9263_map_io(void)
317{ 299{
318 /* Map peripherals */ 300 at91_init_sram(0, AT91SAM9263_SRAM0_BASE, AT91SAM9263_SRAM0_SIZE);
319 iotable_init(at91sam9263_io_desc, ARRAY_SIZE(at91sam9263_io_desc)); 301 at91_init_sram(1, AT91SAM9263_SRAM1_BASE, AT91SAM9263_SRAM1_SIZE);
320} 302}
321 303
322void __init at91sam9263_initialize(unsigned long main_clock) 304static void __init at91sam9263_initialize(void)
323{ 305{
324 at91_arch_reset = at91sam9_alt_reset; 306 at91_arch_reset = at91sam9_alt_reset;
325 pm_power_off = at91sam9263_poweroff; 307 pm_power_off = at91sam9263_poweroff;
326 at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1); 308 at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
327 309
328 /* Init clock subsystem */
329 at91_clock_init(main_clock);
330
331 /* Register the processor-specific clocks */
332 at91sam9263_register_clocks();
333
334 /* Register GPIO subsystem */ 310 /* Register GPIO subsystem */
335 at91_gpio_init(at91sam9263_gpio, 5); 311 at91_gpio_init(at91sam9263_gpio, 5);
336} 312}
@@ -377,14 +353,9 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
377 0, /* Advanced Interrupt Controller (IRQ1) */ 353 0, /* Advanced Interrupt Controller (IRQ1) */
378}; 354};
379 355
380void __init at91sam9263_init_interrupts(unsigned int priority[NR_AIC_IRQS]) 356struct at91_init_soc __initdata at91sam9263_soc = {
381{ 357 .map_io = at91sam9263_map_io,
382 if (!priority) 358 .default_irq_priority = at91sam9263_default_irq_priority,
383 priority = at91sam9263_default_irq_priority; 359 .register_clocks = at91sam9263_register_clocks,
384 360 .init = at91sam9263_initialize,
385 /* Initialize the AIC interrupt controller */ 361};
386 at91_aic_init(priority);
387
388 /* Enable GPIO interrupts */
389 at91_gpio_irq_setup();
390}
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 11e214121b2..e04c5fb6f1e 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -22,23 +22,10 @@
22#include <mach/at91_shdwc.h> 22#include <mach/at91_shdwc.h>
23#include <mach/cpu.h> 23#include <mach/cpu.h>
24 24
25#include "soc.h"
25#include "generic.h" 26#include "generic.h"
26#include "clock.h" 27#include "clock.h"
27 28
28static struct map_desc at91sam9g45_io_desc[] __initdata = {
29 {
30 .virtual = AT91_VA_BASE_SYS,
31 .pfn = __phys_to_pfn(AT91_BASE_SYS),
32 .length = SZ_16K,
33 .type = MT_DEVICE,
34 }, {
35 .virtual = AT91_IO_VIRT_BASE - AT91SAM9G45_SRAM_SIZE,
36 .pfn = __phys_to_pfn(AT91SAM9G45_SRAM_BASE),
37 .length = AT91SAM9G45_SRAM_SIZE,
38 .type = MT_DEVICE,
39 }
40};
41
42/* -------------------------------------------------------------------- 29/* --------------------------------------------------------------------
43 * Clocks 30 * Clocks
44 * -------------------------------------------------------------------- */ 31 * -------------------------------------------------------------------- */
@@ -329,24 +316,17 @@ static void at91sam9g45_poweroff(void)
329 * AT91SAM9G45 processor initialization 316 * AT91SAM9G45 processor initialization
330 * -------------------------------------------------------------------- */ 317 * -------------------------------------------------------------------- */
331 318
332void __init at91sam9g45_map_io(void) 319static void __init at91sam9g45_map_io(void)
333{ 320{
334 /* Map peripherals */ 321 at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE);
335 iotable_init(at91sam9g45_io_desc, ARRAY_SIZE(at91sam9g45_io_desc));
336} 322}
337 323
338void __init at91sam9g45_initialize(unsigned long main_clock) 324static void __init at91sam9g45_initialize(void)
339{ 325{
340 at91_arch_reset = at91sam9g45_reset; 326 at91_arch_reset = at91sam9g45_reset;
341 pm_power_off = at91sam9g45_poweroff; 327 pm_power_off = at91sam9g45_poweroff;
342 at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0); 328 at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0);
343 329
344 /* Init clock subsystem */
345 at91_clock_init(main_clock);
346
347 /* Register the processor-specific clocks */
348 at91sam9g45_register_clocks();
349
350 /* Register GPIO subsystem */ 330 /* Register GPIO subsystem */
351 at91_gpio_init(at91sam9g45_gpio, 5); 331 at91_gpio_init(at91sam9g45_gpio, 5);
352} 332}
@@ -393,14 +373,9 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {
393 0, /* Advanced Interrupt Controller (IRQ0) */ 373 0, /* Advanced Interrupt Controller (IRQ0) */
394}; 374};
395 375
396void __init at91sam9g45_init_interrupts(unsigned int priority[NR_AIC_IRQS]) 376struct at91_init_soc __initdata at91sam9g45_soc = {
397{ 377 .map_io = at91sam9g45_map_io,
398 if (!priority) 378 .default_irq_priority = at91sam9g45_default_irq_priority,
399 priority = at91sam9g45_default_irq_priority; 379 .register_clocks = at91sam9g45_register_clocks,
400 380 .init = at91sam9g45_initialize,
401 /* Initialize the AIC interrupt controller */ 381};
402 at91_aic_init(priority);
403
404 /* Enable GPIO interrupts */
405 at91_gpio_irq_setup();
406}
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 29dff18ed13..a238105d2c1 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -16,30 +16,16 @@
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <mach/cpu.h> 18#include <mach/cpu.h>
19#include <mach/at91_dbgu.h>
19#include <mach/at91sam9rl.h> 20#include <mach/at91sam9rl.h>
20#include <mach/at91_pmc.h> 21#include <mach/at91_pmc.h>
21#include <mach/at91_rstc.h> 22#include <mach/at91_rstc.h>
22#include <mach/at91_shdwc.h> 23#include <mach/at91_shdwc.h>
23 24
25#include "soc.h"
24#include "generic.h" 26#include "generic.h"
25#include "clock.h" 27#include "clock.h"
26 28
27static struct map_desc at91sam9rl_io_desc[] __initdata = {
28 {
29 .virtual = AT91_VA_BASE_SYS,
30 .pfn = __phys_to_pfn(AT91_BASE_SYS),
31 .length = SZ_16K,
32 .type = MT_DEVICE,
33 },
34};
35
36static struct map_desc at91sam9rl_sram_desc[] __initdata = {
37 {
38 .pfn = __phys_to_pfn(AT91SAM9RL_SRAM_BASE),
39 .type = MT_DEVICE,
40 }
41};
42
43/* -------------------------------------------------------------------- 29/* --------------------------------------------------------------------
44 * Clocks 30 * Clocks
45 * -------------------------------------------------------------------- */ 31 * -------------------------------------------------------------------- */
@@ -287,16 +273,11 @@ static void at91sam9rl_poweroff(void)
287 * AT91SAM9RL processor initialization 273 * AT91SAM9RL processor initialization
288 * -------------------------------------------------------------------- */ 274 * -------------------------------------------------------------------- */
289 275
290void __init at91sam9rl_map_io(void) 276static void __init at91sam9rl_map_io(void)
291{ 277{
292 unsigned long cidr, sram_size; 278 unsigned long sram_size;
293
294 /* Map peripherals */
295 iotable_init(at91sam9rl_io_desc, ARRAY_SIZE(at91sam9rl_io_desc));
296
297 cidr = at91_sys_read(AT91_DBGU_CIDR);
298 279
299 switch (cidr & AT91_CIDR_SRAMSIZ) { 280 switch (at91_soc_initdata.cidr & AT91_CIDR_SRAMSIZ) {
300 case AT91_CIDR_SRAMSIZ_32K: 281 case AT91_CIDR_SRAMSIZ_32K:
301 sram_size = 2 * SZ_16K; 282 sram_size = 2 * SZ_16K;
302 break; 283 break;
@@ -305,25 +286,16 @@ void __init at91sam9rl_map_io(void)
305 sram_size = SZ_16K; 286 sram_size = SZ_16K;
306 } 287 }
307 288
308 at91sam9rl_sram_desc->virtual = AT91_IO_VIRT_BASE - sram_size;
309 at91sam9rl_sram_desc->length = sram_size;
310
311 /* Map SRAM */ 289 /* Map SRAM */
312 iotable_init(at91sam9rl_sram_desc, ARRAY_SIZE(at91sam9rl_sram_desc)); 290 at91_init_sram(0, AT91SAM9RL_SRAM_BASE, sram_size);
313} 291}
314 292
315void __init at91sam9rl_initialize(unsigned long main_clock) 293static void __init at91sam9rl_initialize(void)
316{ 294{
317 at91_arch_reset = at91sam9_alt_reset; 295 at91_arch_reset = at91sam9_alt_reset;
318 pm_power_off = at91sam9rl_poweroff; 296 pm_power_off = at91sam9rl_poweroff;
319 at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0); 297 at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
320 298
321 /* Init clock subsystem */
322 at91_clock_init(main_clock);
323
324 /* Register the processor-specific clocks */
325 at91sam9rl_register_clocks();
326
327 /* Register GPIO subsystem */ 299 /* Register GPIO subsystem */
328 at91_gpio_init(at91sam9rl_gpio, 4); 300 at91_gpio_init(at91sam9rl_gpio, 4);
329} 301}
@@ -370,14 +342,9 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
370 0, /* Advanced Interrupt Controller */ 342 0, /* Advanced Interrupt Controller */
371}; 343};
372 344
373void __init at91sam9rl_init_interrupts(unsigned int priority[NR_AIC_IRQS]) 345struct at91_init_soc __initdata at91sam9rl_soc = {
374{ 346 .map_io = at91sam9rl_map_io,
375 if (!priority) 347 .default_irq_priority = at91sam9rl_default_irq_priority,
376 priority = at91sam9rl_default_irq_priority; 348 .register_clocks = at91sam9rl_register_clocks,
377 349 .init = at91sam9rl_initialize,
378 /* Initialize the AIC interrupt controller */ 350};
379 at91_aic_init(priority);
380
381 /* Enable GPIO interrupts */
382 at91_gpio_irq_setup();
383}
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index ab1d463aa47..5aa58851eb3 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -46,7 +46,7 @@ static void __init onearm_init_early(void)
46 at91rm9200_set_type(ARCH_REVISON_9200_PQFP); 46 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
47 47
48 /* Initialize processor: 18.432 MHz crystal */ 48 /* Initialize processor: 18.432 MHz crystal */
49 at91rm9200_initialize(18432000); 49 at91_initialize(18432000);
50 50
51 /* DBGU on ttyS0. (Rx & Tx only) */ 51 /* DBGU on ttyS0. (Rx & Tx only) */
52 at91_register_uart(0, 0, 0); 52 at91_register_uart(0, 0, 0);
@@ -63,11 +63,6 @@ static void __init onearm_init_early(void)
63 at91_set_serial_console(0); 63 at91_set_serial_console(0);
64} 64}
65 65
66static void __init onearm_init_irq(void)
67{
68 at91rm9200_init_interrupts(NULL);
69}
70
71static struct at91_eth_data __initdata onearm_eth_data = { 66static struct at91_eth_data __initdata onearm_eth_data = {
72 .phy_irq_pin = AT91_PIN_PC4, 67 .phy_irq_pin = AT91_PIN_PC4,
73 .is_rmii = 1, 68 .is_rmii = 1,
@@ -97,8 +92,8 @@ static void __init onearm_board_init(void)
97MACHINE_START(ONEARM, "Ajeco 1ARM single board computer") 92MACHINE_START(ONEARM, "Ajeco 1ARM single board computer")
98 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 93 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
99 .timer = &at91rm9200_timer, 94 .timer = &at91rm9200_timer,
100 .map_io = at91rm9200_map_io, 95 .map_io = at91_map_io,
101 .init_early = onearm_init_early, 96 .init_early = onearm_init_early,
102 .init_irq = onearm_init_irq, 97 .init_irq = at91_init_irq_default,
103 .init_machine = onearm_board_init, 98 .init_machine = onearm_board_init,
104MACHINE_END 99MACHINE_END
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index a4924de48c3..b0c796d42e4 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -51,7 +51,7 @@
51static void __init afeb9260_init_early(void) 51static void __init afeb9260_init_early(void)
52{ 52{
53 /* Initialize processor: 18.432 MHz crystal */ 53 /* Initialize processor: 18.432 MHz crystal */
54 at91sam9260_initialize(18432000); 54 at91_initialize(18432000);
55 55
56 /* DBGU on ttyS0. (Rx & Tx only) */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0); 57 at91_register_uart(0, 0, 0);
@@ -70,12 +70,6 @@ static void __init afeb9260_init_early(void)
70 at91_set_serial_console(0); 70 at91_set_serial_console(0);
71} 71}
72 72
73static void __init afeb9260_init_irq(void)
74{
75 at91sam9260_init_interrupts(NULL);
76}
77
78
79/* 73/*
80 * USB Host port 74 * USB Host port
81 */ 75 */
@@ -219,9 +213,9 @@ static void __init afeb9260_board_init(void)
219MACHINE_START(AFEB9260, "Custom afeb9260 board") 213MACHINE_START(AFEB9260, "Custom afeb9260 board")
220 /* Maintainer: Sergey Lapin <slapin@ossfans.org> */ 214 /* Maintainer: Sergey Lapin <slapin@ossfans.org> */
221 .timer = &at91sam926x_timer, 215 .timer = &at91sam926x_timer,
222 .map_io = at91sam9260_map_io, 216 .map_io = at91_map_io,
223 .init_early = afeb9260_init_early, 217 .init_early = afeb9260_init_early,
224 .init_irq = afeb9260_init_irq, 218 .init_irq = at91_init_irq_default,
225 .init_machine = afeb9260_board_init, 219 .init_machine = afeb9260_board_init,
226MACHINE_END 220MACHINE_END
227 221
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index 148fccb9a25..d1abd5898e8 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -48,7 +48,7 @@
48static void __init cam60_init_early(void) 48static void __init cam60_init_early(void)
49{ 49{
50 /* Initialize processor: 10 MHz crystal */ 50 /* Initialize processor: 10 MHz crystal */
51 at91sam9260_initialize(10000000); 51 at91_initialize(10000000);
52 52
53 /* DBGU on ttyS0. (Rx & Tx only) */ 53 /* DBGU on ttyS0. (Rx & Tx only) */
54 at91_register_uart(0, 0, 0); 54 at91_register_uart(0, 0, 0);
@@ -57,12 +57,6 @@ static void __init cam60_init_early(void)
57 at91_set_serial_console(0); 57 at91_set_serial_console(0);
58} 58}
59 59
60static void __init cam60_init_irq(void)
61{
62 at91sam9260_init_interrupts(NULL);
63}
64
65
66/* 60/*
67 * USB Host 61 * USB Host
68 */ 62 */
@@ -199,8 +193,8 @@ static void __init cam60_board_init(void)
199MACHINE_START(CAM60, "KwikByte CAM60") 193MACHINE_START(CAM60, "KwikByte CAM60")
200 /* Maintainer: KwikByte */ 194 /* Maintainer: KwikByte */
201 .timer = &at91sam926x_timer, 195 .timer = &at91sam926x_timer,
202 .map_io = at91sam9260_map_io, 196 .map_io = at91_map_io,
203 .init_early = cam60_init_early, 197 .init_early = cam60_init_early,
204 .init_irq = cam60_init_irq, 198 .init_irq = at91_init_irq_default,
205 .init_machine = cam60_board_init, 199 .init_machine = cam60_board_init,
206MACHINE_END 200MACHINE_END
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index cdb65d48325..679b0b743e9 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -53,7 +53,7 @@
53static void __init cap9adk_init_early(void) 53static void __init cap9adk_init_early(void)
54{ 54{
55 /* Initialize processor: 12 MHz crystal */ 55 /* Initialize processor: 12 MHz crystal */
56 at91cap9_initialize(12000000); 56 at91_initialize(12000000);
57 57
58 /* Setup the LEDs: USER1 and USER2 LED for cpu/timer... */ 58 /* Setup the LEDs: USER1 and USER2 LED for cpu/timer... */
59 at91_init_leds(AT91_PIN_PA10, AT91_PIN_PA11); 59 at91_init_leds(AT91_PIN_PA10, AT91_PIN_PA11);
@@ -65,12 +65,6 @@ static void __init cap9adk_init_early(void)
65 at91_set_serial_console(0); 65 at91_set_serial_console(0);
66} 66}
67 67
68static void __init cap9adk_init_irq(void)
69{
70 at91cap9_init_interrupts(NULL);
71}
72
73
74/* 68/*
75 * USB Host port 69 * USB Host port
76 */ 70 */
@@ -397,8 +391,8 @@ static void __init cap9adk_board_init(void)
397MACHINE_START(AT91CAP9ADK, "Atmel AT91CAP9A-DK") 391MACHINE_START(AT91CAP9ADK, "Atmel AT91CAP9A-DK")
398 /* Maintainer: Stelian Pop <stelian.pop@leadtechdesign.com> */ 392 /* Maintainer: Stelian Pop <stelian.pop@leadtechdesign.com> */
399 .timer = &at91sam926x_timer, 393 .timer = &at91sam926x_timer,
400 .map_io = at91cap9_map_io, 394 .map_io = at91_map_io,
401 .init_early = cap9adk_init_early, 395 .init_early = cap9adk_init_early,
402 .init_irq = cap9adk_init_irq, 396 .init_irq = at91_init_irq_default,
403 .init_machine = cap9adk_board_init, 397 .init_machine = cap9adk_board_init,
404MACHINE_END 398MACHINE_END
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index f36b1868749..c578c5d9072 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -43,7 +43,7 @@
43static void __init carmeva_init_early(void) 43static void __init carmeva_init_early(void)
44{ 44{
45 /* Initialize processor: 20.000 MHz crystal */ 45 /* Initialize processor: 20.000 MHz crystal */
46 at91rm9200_initialize(20000000); 46 at91_initialize(20000000);
47 47
48 /* DBGU on ttyS0. (Rx & Tx only) */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
49 at91_register_uart(0, 0, 0); 49 at91_register_uart(0, 0, 0);
@@ -57,11 +57,6 @@ static void __init carmeva_init_early(void)
57 at91_set_serial_console(0); 57 at91_set_serial_console(0);
58} 58}
59 59
60static void __init carmeva_init_irq(void)
61{
62 at91rm9200_init_interrupts(NULL);
63}
64
65static struct at91_eth_data __initdata carmeva_eth_data = { 60static struct at91_eth_data __initdata carmeva_eth_data = {
66 .phy_irq_pin = AT91_PIN_PC4, 61 .phy_irq_pin = AT91_PIN_PC4,
67 .is_rmii = 1, 62 .is_rmii = 1,
@@ -163,8 +158,8 @@ static void __init carmeva_board_init(void)
163MACHINE_START(CARMEVA, "Carmeva") 158MACHINE_START(CARMEVA, "Carmeva")
164 /* Maintainer: Conitec Datasystems */ 159 /* Maintainer: Conitec Datasystems */
165 .timer = &at91rm9200_timer, 160 .timer = &at91rm9200_timer,
166 .map_io = at91rm9200_map_io, 161 .map_io = at91_map_io,
167 .init_early = carmeva_init_early, 162 .init_early = carmeva_init_early,
168 .init_irq = carmeva_init_irq, 163 .init_irq = at91_init_irq_default,
169 .init_machine = carmeva_board_init, 164 .init_machine = carmeva_board_init,
170MACHINE_END 165MACHINE_END
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 980511084fe..f4da8a16d5d 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -50,7 +50,7 @@
50static void __init cpu9krea_init_early(void) 50static void __init cpu9krea_init_early(void)
51{ 51{
52 /* Initialize processor: 18.432 MHz crystal */ 52 /* Initialize processor: 18.432 MHz crystal */
53 at91sam9260_initialize(18432000); 53 at91_initialize(18432000);
54 54
55 /* DGBU on ttyS0. (Rx & Tx only) */ 55 /* DGBU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0); 56 at91_register_uart(0, 0, 0);
@@ -81,11 +81,6 @@ static void __init cpu9krea_init_early(void)
81 at91_set_serial_console(0); 81 at91_set_serial_console(0);
82} 82}
83 83
84static void __init cpu9krea_init_irq(void)
85{
86 at91sam9260_init_interrupts(NULL);
87}
88
89/* 84/*
90 * USB Host port 85 * USB Host port
91 */ 86 */
@@ -376,8 +371,8 @@ MACHINE_START(CPUAT9G20, "Eukrea CPU9G20")
376#endif 371#endif
377 /* Maintainer: Eric Benard - EUKREA Electromatique */ 372 /* Maintainer: Eric Benard - EUKREA Electromatique */
378 .timer = &at91sam926x_timer, 373 .timer = &at91sam926x_timer,
379 .map_io = at91sam9260_map_io, 374 .map_io = at91_map_io,
380 .init_early = cpu9krea_init_early, 375 .init_early = cpu9krea_init_early,
381 .init_irq = cpu9krea_init_irq, 376 .init_irq = at91_init_irq_default,
382 .init_machine = cpu9krea_board_init, 377 .init_machine = cpu9krea_board_init,
383MACHINE_END 378MACHINE_END
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 6daabe3907a..2d919f5a4f5 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -57,7 +57,7 @@ static void __init cpuat91_init_early(void)
57 at91rm9200_set_type(ARCH_REVISON_9200_PQFP); 57 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
58 58
59 /* Initialize processor: 18.432 MHz crystal */ 59 /* Initialize processor: 18.432 MHz crystal */
60 at91rm9200_initialize(18432000); 60 at91_initialize(18432000);
61 61
62 /* DBGU on ttyS0. (Rx & Tx only) */ 62 /* DBGU on ttyS0. (Rx & Tx only) */
63 at91_register_uart(0, 0, 0); 63 at91_register_uart(0, 0, 0);
@@ -82,11 +82,6 @@ static void __init cpuat91_init_early(void)
82 at91_set_serial_console(0); 82 at91_set_serial_console(0);
83} 83}
84 84
85static void __init cpuat91_init_irq(void)
86{
87 at91rm9200_init_interrupts(NULL);
88}
89
90static struct at91_eth_data __initdata cpuat91_eth_data = { 85static struct at91_eth_data __initdata cpuat91_eth_data = {
91 .is_rmii = 1, 86 .is_rmii = 1,
92}; 87};
@@ -180,8 +175,8 @@ static void __init cpuat91_board_init(void)
180MACHINE_START(CPUAT91, "Eukrea") 175MACHINE_START(CPUAT91, "Eukrea")
181 /* Maintainer: Eric Benard - EUKREA Electromatique */ 176 /* Maintainer: Eric Benard - EUKREA Electromatique */
182 .timer = &at91rm9200_timer, 177 .timer = &at91rm9200_timer,
183 .map_io = at91rm9200_map_io, 178 .map_io = at91_map_io,
184 .init_early = cpuat91_init_early, 179 .init_early = cpuat91_init_early,
185 .init_irq = cpuat91_init_irq, 180 .init_irq = at91_init_irq_default,
186 .init_machine = cpuat91_board_init, 181 .init_machine = cpuat91_board_init,
187MACHINE_END 182MACHINE_END
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index d98bcec1dfe..17654d5e94e 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -46,7 +46,7 @@
46static void __init csb337_init_early(void) 46static void __init csb337_init_early(void)
47{ 47{
48 /* Initialize processor: 3.6864 MHz crystal */ 48 /* Initialize processor: 3.6864 MHz crystal */
49 at91rm9200_initialize(3686400); 49 at91_initialize(3686400);
50 50
51 /* Setup the LEDs */ 51 /* Setup the LEDs */
52 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1); 52 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
@@ -58,11 +58,6 @@ static void __init csb337_init_early(void)
58 at91_set_serial_console(0); 58 at91_set_serial_console(0);
59} 59}
60 60
61static void __init csb337_init_irq(void)
62{
63 at91rm9200_init_interrupts(NULL);
64}
65
66static struct at91_eth_data __initdata csb337_eth_data = { 61static struct at91_eth_data __initdata csb337_eth_data = {
67 .phy_irq_pin = AT91_PIN_PC2, 62 .phy_irq_pin = AT91_PIN_PC2,
68 .is_rmii = 0, 63 .is_rmii = 0,
@@ -258,8 +253,8 @@ static void __init csb337_board_init(void)
258MACHINE_START(CSB337, "Cogent CSB337") 253MACHINE_START(CSB337, "Cogent CSB337")
259 /* Maintainer: Bill Gatliff */ 254 /* Maintainer: Bill Gatliff */
260 .timer = &at91rm9200_timer, 255 .timer = &at91rm9200_timer,
261 .map_io = at91rm9200_map_io, 256 .map_io = at91_map_io,
262 .init_early = csb337_init_early, 257 .init_early = csb337_init_early,
263 .init_irq = csb337_init_irq, 258 .init_irq = at91_init_irq_default,
264 .init_machine = csb337_board_init, 259 .init_machine = csb337_board_init,
265MACHINE_END 260MACHINE_END
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 019aab4e20b..72b55674616 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -43,7 +43,7 @@
43static void __init csb637_init_early(void) 43static void __init csb637_init_early(void)
44{ 44{
45 /* Initialize processor: 3.6864 MHz crystal */ 45 /* Initialize processor: 3.6864 MHz crystal */
46 at91rm9200_initialize(3686400); 46 at91_initialize(3686400);
47 47
48 /* DBGU on ttyS0. (Rx & Tx only) */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
49 at91_register_uart(0, 0, 0); 49 at91_register_uart(0, 0, 0);
@@ -52,11 +52,6 @@ static void __init csb637_init_early(void)
52 at91_set_serial_console(0); 52 at91_set_serial_console(0);
53} 53}
54 54
55static void __init csb637_init_irq(void)
56{
57 at91rm9200_init_interrupts(NULL);
58}
59
60static struct at91_eth_data __initdata csb637_eth_data = { 55static struct at91_eth_data __initdata csb637_eth_data = {
61 .phy_irq_pin = AT91_PIN_PC0, 56 .phy_irq_pin = AT91_PIN_PC0,
62 .is_rmii = 0, 57 .is_rmii = 0,
@@ -139,8 +134,8 @@ static void __init csb637_board_init(void)
139MACHINE_START(CSB637, "Cogent CSB637") 134MACHINE_START(CSB637, "Cogent CSB637")
140 /* Maintainer: Bill Gatliff */ 135 /* Maintainer: Bill Gatliff */
141 .timer = &at91rm9200_timer, 136 .timer = &at91rm9200_timer,
142 .map_io = at91rm9200_map_io, 137 .map_io = at91_map_io,
143 .init_early = csb637_init_early, 138 .init_early = csb637_init_early,
144 .init_irq = csb637_init_irq, 139 .init_irq = at91_init_irq_default,
145 .init_machine = csb637_board_init, 140 .init_machine = csb637_board_init,
146MACHINE_END 141MACHINE_END
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index e9484535cbc..01170a2766a 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -43,7 +43,7 @@
43static void __init eb9200_init_early(void) 43static void __init eb9200_init_early(void)
44{ 44{
45 /* Initialize processor: 18.432 MHz crystal */ 45 /* Initialize processor: 18.432 MHz crystal */
46 at91rm9200_initialize(18432000); 46 at91_initialize(18432000);
47 47
48 /* DBGU on ttyS0. (Rx & Tx only) */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
49 at91_register_uart(0, 0, 0); 49 at91_register_uart(0, 0, 0);
@@ -60,11 +60,6 @@ static void __init eb9200_init_early(void)
60 at91_set_serial_console(0); 60 at91_set_serial_console(0);
61} 61}
62 62
63static void __init eb9200_init_irq(void)
64{
65 at91rm9200_init_interrupts(NULL);
66}
67
68static struct at91_eth_data __initdata eb9200_eth_data = { 63static struct at91_eth_data __initdata eb9200_eth_data = {
69 .phy_irq_pin = AT91_PIN_PC4, 64 .phy_irq_pin = AT91_PIN_PC4,
70 .is_rmii = 1, 65 .is_rmii = 1,
@@ -121,8 +116,8 @@ static void __init eb9200_board_init(void)
121 116
122MACHINE_START(ATEB9200, "Embest ATEB9200") 117MACHINE_START(ATEB9200, "Embest ATEB9200")
123 .timer = &at91rm9200_timer, 118 .timer = &at91rm9200_timer,
124 .map_io = at91rm9200_map_io, 119 .map_io = at91_map_io,
125 .init_early = eb9200_init_early, 120 .init_early = eb9200_init_early,
126 .init_irq = eb9200_init_irq, 121 .init_irq = at91_init_irq_default,
127 .init_machine = eb9200_board_init, 122 .init_machine = eb9200_board_init,
128MACHINE_END 123MACHINE_END
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index a6f57faa10a..7c0313c51f2 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -49,7 +49,7 @@ static void __init ecb_at91init_early(void)
49 at91rm9200_set_type(ARCH_REVISON_9200_PQFP); 49 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
50 50
51 /* Initialize processor: 18.432 MHz crystal */ 51 /* Initialize processor: 18.432 MHz crystal */
52 at91rm9200_initialize(18432000); 52 at91_initialize(18432000);
53 53
54 /* Setup the LEDs */ 54 /* Setup the LEDs */
55 at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7); 55 at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
@@ -64,11 +64,6 @@ static void __init ecb_at91init_early(void)
64 at91_set_serial_console(0); 64 at91_set_serial_console(0);
65} 65}
66 66
67static void __init ecb_at91init_irq(void)
68{
69 at91rm9200_init_interrupts(NULL);
70}
71
72static struct at91_eth_data __initdata ecb_at91eth_data = { 67static struct at91_eth_data __initdata ecb_at91eth_data = {
73 .phy_irq_pin = AT91_PIN_PC4, 68 .phy_irq_pin = AT91_PIN_PC4,
74 .is_rmii = 0, 69 .is_rmii = 0,
@@ -173,8 +168,8 @@ static void __init ecb_at91board_init(void)
173MACHINE_START(ECBAT91, "emQbit's ECB_AT91") 168MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
174 /* Maintainer: emQbit.com */ 169 /* Maintainer: emQbit.com */
175 .timer = &at91rm9200_timer, 170 .timer = &at91rm9200_timer,
176 .map_io = at91rm9200_map_io, 171 .map_io = at91_map_io,
177 .init_early = ecb_at91init_early, 172 .init_early = ecb_at91init_early,
178 .init_irq = ecb_at91init_irq, 173 .init_irq = at91_init_irq_default,
179 .init_machine = ecb_at91board_init, 174 .init_machine = ecb_at91board_init,
180MACHINE_END 175MACHINE_END
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index bfc0062d148..8252c722607 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -35,7 +35,7 @@ static void __init eco920_init_early(void)
35 /* Set cpu type: PQFP */ 35 /* Set cpu type: PQFP */
36 at91rm9200_set_type(ARCH_REVISON_9200_PQFP); 36 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
37 37
38 at91rm9200_initialize(18432000); 38 at91_initialize(18432000);
39 39
40 /* Setup the LEDs */ 40 /* Setup the LEDs */
41 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1); 41 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
@@ -47,11 +47,6 @@ static void __init eco920_init_early(void)
47 at91_set_serial_console(0); 47 at91_set_serial_console(0);
48} 48}
49 49
50static void __init eco920_init_irq(void)
51{
52 at91rm9200_init_interrupts(NULL);
53}
54
55static struct at91_eth_data __initdata eco920_eth_data = { 50static struct at91_eth_data __initdata eco920_eth_data = {
56 .phy_irq_pin = AT91_PIN_PC2, 51 .phy_irq_pin = AT91_PIN_PC2,
57 .is_rmii = 1, 52 .is_rmii = 1,
@@ -135,8 +130,8 @@ static void __init eco920_board_init(void)
135MACHINE_START(ECO920, "eco920") 130MACHINE_START(ECO920, "eco920")
136 /* Maintainer: Sascha Hauer */ 131 /* Maintainer: Sascha Hauer */
137 .timer = &at91rm9200_timer, 132 .timer = &at91rm9200_timer,
138 .map_io = at91rm9200_map_io, 133 .map_io = at91_map_io,
139 .init_early = eco920_init_early, 134 .init_early = eco920_init_early,
140 .init_irq = eco920_init_irq, 135 .init_irq = at91_init_irq_default,
141 .init_machine = eco920_board_init, 136 .init_machine = eco920_board_init,
142MACHINE_END 137MACHINE_END
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index 466c063b8d2..4c3f65d9c59 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -40,7 +40,7 @@
40static void __init flexibity_init_early(void) 40static void __init flexibity_init_early(void)
41{ 41{
42 /* Initialize processor: 18.432 MHz crystal */ 42 /* Initialize processor: 18.432 MHz crystal */
43 at91sam9260_initialize(18432000); 43 at91_initialize(18432000);
44 44
45 /* DBGU on ttyS0. (Rx & Tx only) */ 45 /* DBGU on ttyS0. (Rx & Tx only) */
46 at91_register_uart(0, 0, 0); 46 at91_register_uart(0, 0, 0);
@@ -49,11 +49,6 @@ static void __init flexibity_init_early(void)
49 at91_set_serial_console(0); 49 at91_set_serial_console(0);
50} 50}
51 51
52static void __init flexibity_init_irq(void)
53{
54 at91sam9260_init_interrupts(NULL);
55}
56
57/* USB Host port */ 52/* USB Host port */
58static struct at91_usbh_data __initdata flexibity_usbh_data = { 53static struct at91_usbh_data __initdata flexibity_usbh_data = {
59 .ports = 2, 54 .ports = 2,
@@ -155,8 +150,8 @@ static void __init flexibity_board_init(void)
155MACHINE_START(FLEXIBITY, "Flexibity Connect") 150MACHINE_START(FLEXIBITY, "Flexibity Connect")
156 /* Maintainer: Maxim Osipov */ 151 /* Maintainer: Maxim Osipov */
157 .timer = &at91sam926x_timer, 152 .timer = &at91sam926x_timer,
158 .map_io = at91sam9260_map_io, 153 .map_io = at91_map_io,
159 .init_early = flexibity_init_early, 154 .init_early = flexibity_init_early,
160 .init_irq = flexibity_init_irq, 155 .init_irq = at91_init_irq_default,
161 .init_machine = flexibity_board_init, 156 .init_machine = flexibity_board_init,
162MACHINE_END 157MACHINE_END
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index e2d1dc9eff4..f27d1a780cf 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -60,7 +60,7 @@
60static void __init foxg20_init_early(void) 60static void __init foxg20_init_early(void)
61{ 61{
62 /* Initialize processor: 18.432 MHz crystal */ 62 /* Initialize processor: 18.432 MHz crystal */
63 at91sam9260_initialize(18432000); 63 at91_initialize(18432000);
64 64
65 /* DBGU on ttyS0. (Rx & Tx only) */ 65 /* DBGU on ttyS0. (Rx & Tx only) */
66 at91_register_uart(0, 0, 0); 66 at91_register_uart(0, 0, 0);
@@ -101,12 +101,6 @@ static void __init foxg20_init_early(void)
101 101
102} 102}
103 103
104static void __init foxg20_init_irq(void)
105{
106 at91sam9260_init_interrupts(NULL);
107}
108
109
110/* 104/*
111 * USB Host port 105 * USB Host port
112 */ 106 */
@@ -267,8 +261,8 @@ static void __init foxg20_board_init(void)
267MACHINE_START(ACMENETUSFOXG20, "Acme Systems srl FOX Board G20") 261MACHINE_START(ACMENETUSFOXG20, "Acme Systems srl FOX Board G20")
268 /* Maintainer: Sergio Tanzilli */ 262 /* Maintainer: Sergio Tanzilli */
269 .timer = &at91sam926x_timer, 263 .timer = &at91sam926x_timer,
270 .map_io = at91sam9260_map_io, 264 .map_io = at91_map_io,
271 .init_early = foxg20_init_early, 265 .init_early = foxg20_init_early,
272 .init_irq = foxg20_init_irq, 266 .init_irq = at91_init_irq_default,
273 .init_machine = foxg20_board_init, 267 .init_machine = foxg20_board_init,
274MACHINE_END 268MACHINE_END
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index 1d4f36b3cb2..2e95949737e 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -75,11 +75,6 @@ static void __init gsia18s_init_early(void)
75 at91_register_uart(AT91SAM9260_ID_US4, 5, 0); 75 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
76} 76}
77 77
78static void __init init_irq(void)
79{
80 at91sam9260_init_interrupts(NULL);
81}
82
83/* 78/*
84 * Two USB Host ports 79 * Two USB Host ports
85 */ 80 */
@@ -577,8 +572,8 @@ static void __init gsia18s_board_init(void)
577 572
578MACHINE_START(GSIA18S, "GS_IA18_S") 573MACHINE_START(GSIA18S, "GS_IA18_S")
579 .timer = &at91sam926x_timer, 574 .timer = &at91sam926x_timer,
580 .map_io = at91sam9260_map_io, 575 .map_io = at91_map_io,
581 .init_early = gsia18s_init_early, 576 .init_early = gsia18s_init_early,
582 .init_irq = init_irq, 577 .init_irq = at91_init_irq_default,
583 .init_machine = gsia18s_board_init, 578 .init_machine = gsia18s_board_init,
584MACHINE_END 579MACHINE_END
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index 9b003ff744b..4a170890b3b 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -46,7 +46,7 @@ static void __init kafa_init_early(void)
46 at91rm9200_set_type(ARCH_REVISON_9200_PQFP); 46 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
47 47
48 /* Initialize processor: 18.432 MHz crystal */ 48 /* Initialize processor: 18.432 MHz crystal */
49 at91rm9200_initialize(18432000); 49 at91_initialize(18432000);
50 50
51 /* Set up the LEDs */ 51 /* Set up the LEDs */
52 at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4); 52 at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4);
@@ -61,11 +61,6 @@ static void __init kafa_init_early(void)
61 at91_set_serial_console(0); 61 at91_set_serial_console(0);
62} 62}
63 63
64static void __init kafa_init_irq(void)
65{
66 at91rm9200_init_interrupts(NULL);
67}
68
69static struct at91_eth_data __initdata kafa_eth_data = { 64static struct at91_eth_data __initdata kafa_eth_data = {
70 .phy_irq_pin = AT91_PIN_PC4, 65 .phy_irq_pin = AT91_PIN_PC4,
71 .is_rmii = 0, 66 .is_rmii = 0,
@@ -99,8 +94,8 @@ static void __init kafa_board_init(void)
99MACHINE_START(KAFA, "Sperry-Sun KAFA") 94MACHINE_START(KAFA, "Sperry-Sun KAFA")
100 /* Maintainer: Sergei Sharonov */ 95 /* Maintainer: Sergei Sharonov */
101 .timer = &at91rm9200_timer, 96 .timer = &at91rm9200_timer,
102 .map_io = at91rm9200_map_io, 97 .map_io = at91_map_io,
103 .init_early = kafa_init_early, 98 .init_early = kafa_init_early,
104 .init_irq = kafa_init_irq, 99 .init_irq = at91_init_irq_default,
105 .init_machine = kafa_board_init, 100 .init_machine = kafa_board_init,
106MACHINE_END 101MACHINE_END
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index a813a74b65f..9dc8d496ead 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -48,7 +48,7 @@ static void __init kb9202_init_early(void)
48 at91rm9200_set_type(ARCH_REVISON_9200_PQFP); 48 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
49 49
50 /* Initialize processor: 10 MHz crystal */ 50 /* Initialize processor: 10 MHz crystal */
51 at91rm9200_initialize(10000000); 51 at91_initialize(10000000);
52 52
53 /* Set up the LEDs */ 53 /* Set up the LEDs */
54 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18); 54 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
@@ -69,11 +69,6 @@ static void __init kb9202_init_early(void)
69 at91_set_serial_console(0); 69 at91_set_serial_console(0);
70} 70}
71 71
72static void __init kb9202_init_irq(void)
73{
74 at91rm9200_init_interrupts(NULL);
75}
76
77static struct at91_eth_data __initdata kb9202_eth_data = { 72static struct at91_eth_data __initdata kb9202_eth_data = {
78 .phy_irq_pin = AT91_PIN_PB29, 73 .phy_irq_pin = AT91_PIN_PB29,
79 .is_rmii = 0, 74 .is_rmii = 0,
@@ -140,8 +135,8 @@ static void __init kb9202_board_init(void)
140MACHINE_START(KB9200, "KB920x") 135MACHINE_START(KB9200, "KB920x")
141 /* Maintainer: KwikByte, Inc. */ 136 /* Maintainer: KwikByte, Inc. */
142 .timer = &at91rm9200_timer, 137 .timer = &at91rm9200_timer,
143 .map_io = at91rm9200_map_io, 138 .map_io = at91_map_io,
144 .init_early = kb9202_init_early, 139 .init_early = kb9202_init_early,
145 .init_irq = kb9202_init_irq, 140 .init_irq = at91_init_irq_default,
146 .init_machine = kb9202_board_init, 141 .init_machine = kb9202_board_init,
147MACHINE_END 142MACHINE_END
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index 961e805db68..9bc6ab32e0a 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -54,7 +54,7 @@
54static void __init neocore926_init_early(void) 54static void __init neocore926_init_early(void)
55{ 55{
56 /* Initialize processor: 20 MHz crystal */ 56 /* Initialize processor: 20 MHz crystal */
57 at91sam9263_initialize(20000000); 57 at91_initialize(20000000);
58 58
59 /* DBGU on ttyS0. (Rx & Tx only) */ 59 /* DBGU on ttyS0. (Rx & Tx only) */
60 at91_register_uart(0, 0, 0); 60 at91_register_uart(0, 0, 0);
@@ -66,12 +66,6 @@ static void __init neocore926_init_early(void)
66 at91_set_serial_console(0); 66 at91_set_serial_console(0);
67} 67}
68 68
69static void __init neocore926_init_irq(void)
70{
71 at91sam9263_init_interrupts(NULL);
72}
73
74
75/* 69/*
76 * USB Host port 70 * USB Host port
77 */ 71 */
@@ -388,8 +382,8 @@ static void __init neocore926_board_init(void)
388MACHINE_START(NEOCORE926, "ADENEO NEOCORE 926") 382MACHINE_START(NEOCORE926, "ADENEO NEOCORE 926")
389 /* Maintainer: ADENEO */ 383 /* Maintainer: ADENEO */
390 .timer = &at91sam926x_timer, 384 .timer = &at91sam926x_timer,
391 .map_io = at91sam9263_map_io, 385 .map_io = at91_map_io,
392 .init_early = neocore926_init_early, 386 .init_early = neocore926_init_early,
393 .init_irq = neocore926_init_irq, 387 .init_irq = at91_init_irq_default,
394 .init_machine = neocore926_board_init, 388 .init_machine = neocore926_board_init,
395MACHINE_END 389MACHINE_END
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index 21a21af2587..49e3f699b48 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -53,13 +53,6 @@ static void __init pcontrol_g20_init_early(void)
53 at91_register_uart(AT91SAM9260_ID_US4, 3, 0); 53 at91_register_uart(AT91SAM9260_ID_US4, 3, 0);
54} 54}
55 55
56
57static void __init init_irq(void)
58{
59 at91sam9260_init_interrupts(NULL);
60}
61
62
63static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { { 56static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
64 .ncs_read_setup = 16, 57 .ncs_read_setup = 16,
65 .nrd_setup = 18, 58 .nrd_setup = 18,
@@ -223,8 +216,8 @@ static void __init pcontrol_g20_board_init(void)
223MACHINE_START(PCONTROL_G20, "PControl G20") 216MACHINE_START(PCONTROL_G20, "PControl G20")
224 /* Maintainer: pgsellmann@portner-elektronik.at */ 217 /* Maintainer: pgsellmann@portner-elektronik.at */
225 .timer = &at91sam926x_timer, 218 .timer = &at91sam926x_timer,
226 .map_io = at91sam9260_map_io, 219 .map_io = at91_map_io,
227 .init_early = pcontrol_g20_init_early, 220 .init_early = pcontrol_g20_init_early,
228 .init_irq = init_irq, 221 .init_irq = at91_init_irq_default,
229 .init_machine = pcontrol_g20_board_init, 222 .init_machine = pcontrol_g20_board_init,
230MACHINE_END 223MACHINE_END
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 756cc2a745d..b7b8390e8a0 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -46,7 +46,7 @@
46static void __init picotux200_init_early(void) 46static void __init picotux200_init_early(void)
47{ 47{
48 /* Initialize processor: 18.432 MHz crystal */ 48 /* Initialize processor: 18.432 MHz crystal */
49 at91rm9200_initialize(18432000); 49 at91_initialize(18432000);
50 50
51 /* DBGU on ttyS0. (Rx & Tx only) */ 51 /* DBGU on ttyS0. (Rx & Tx only) */
52 at91_register_uart(0, 0, 0); 52 at91_register_uart(0, 0, 0);
@@ -60,11 +60,6 @@ static void __init picotux200_init_early(void)
60 at91_set_serial_console(0); 60 at91_set_serial_console(0);
61} 61}
62 62
63static void __init picotux200_init_irq(void)
64{
65 at91rm9200_init_interrupts(NULL);
66}
67
68static struct at91_eth_data __initdata picotux200_eth_data = { 63static struct at91_eth_data __initdata picotux200_eth_data = {
69 .phy_irq_pin = AT91_PIN_PC4, 64 .phy_irq_pin = AT91_PIN_PC4,
70 .is_rmii = 1, 65 .is_rmii = 1,
@@ -124,8 +119,8 @@ static void __init picotux200_board_init(void)
124MACHINE_START(PICOTUX2XX, "picotux 200") 119MACHINE_START(PICOTUX2XX, "picotux 200")
125 /* Maintainer: Kleinhenz Elektronik GmbH */ 120 /* Maintainer: Kleinhenz Elektronik GmbH */
126 .timer = &at91rm9200_timer, 121 .timer = &at91rm9200_timer,
127 .map_io = at91rm9200_map_io, 122 .map_io = at91_map_io,
128 .init_early = picotux200_init_early, 123 .init_early = picotux200_init_early,
129 .init_irq = picotux200_init_irq, 124 .init_irq = at91_init_irq_default,
130 .init_machine = picotux200_board_init, 125 .init_machine = picotux200_board_init,
131MACHINE_END 126MACHINE_END
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index d1a6001b0bd..81f91103368 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -51,7 +51,7 @@
51static void __init ek_init_early(void) 51static void __init ek_init_early(void)
52{ 52{
53 /* Initialize processor: 12.000 MHz crystal */ 53 /* Initialize processor: 12.000 MHz crystal */
54 at91sam9260_initialize(12000000); 54 at91_initialize(12000000);
55 55
56 /* DBGU on ttyS0. (Rx & Tx only) */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0); 57 at91_register_uart(0, 0, 0);
@@ -72,12 +72,6 @@ static void __init ek_init_early(void)
72 72
73} 73}
74 74
75static void __init ek_init_irq(void)
76{
77 at91sam9260_init_interrupts(NULL);
78}
79
80
81/* 75/*
82 * USB Host port 76 * USB Host port
83 */ 77 */
@@ -269,8 +263,8 @@ static void __init ek_board_init(void)
269MACHINE_START(QIL_A9260, "CALAO QIL_A9260") 263MACHINE_START(QIL_A9260, "CALAO QIL_A9260")
270 /* Maintainer: calao-systems */ 264 /* Maintainer: calao-systems */
271 .timer = &at91sam926x_timer, 265 .timer = &at91sam926x_timer,
272 .map_io = at91sam9260_map_io, 266 .map_io = at91_map_io,
273 .init_early = ek_init_early, 267 .init_early = ek_init_early,
274 .init_irq = ek_init_irq, 268 .init_irq = at91_init_irq_default,
275 .init_machine = ek_board_init, 269 .init_machine = ek_board_init,
276MACHINE_END 270MACHINE_END
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index aef9627710b..6f08faadb47 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -48,7 +48,7 @@
48static void __init dk_init_early(void) 48static void __init dk_init_early(void)
49{ 49{
50 /* Initialize processor: 18.432 MHz crystal */ 50 /* Initialize processor: 18.432 MHz crystal */
51 at91rm9200_initialize(18432000); 51 at91_initialize(18432000);
52 52
53 /* Setup the LEDs */ 53 /* Setup the LEDs */
54 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); 54 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
@@ -65,11 +65,6 @@ static void __init dk_init_early(void)
65 at91_set_serial_console(0); 65 at91_set_serial_console(0);
66} 66}
67 67
68static void __init dk_init_irq(void)
69{
70 at91rm9200_init_interrupts(NULL);
71}
72
73static struct at91_eth_data __initdata dk_eth_data = { 68static struct at91_eth_data __initdata dk_eth_data = {
74 .phy_irq_pin = AT91_PIN_PC4, 69 .phy_irq_pin = AT91_PIN_PC4,
75 .is_rmii = 1, 70 .is_rmii = 1,
@@ -228,8 +223,8 @@ static void __init dk_board_init(void)
228MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK") 223MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")
229 /* Maintainer: SAN People/Atmel */ 224 /* Maintainer: SAN People/Atmel */
230 .timer = &at91rm9200_timer, 225 .timer = &at91rm9200_timer,
231 .map_io = at91rm9200_map_io, 226 .map_io = at91_map_io,
232 .init_early = dk_init_early, 227 .init_early = dk_init_early,
233 .init_irq = dk_init_irq, 228 .init_irq = at91_init_irq_default,
234 .init_machine = dk_board_init, 229 .init_machine = dk_board_init,
235MACHINE_END 230MACHINE_END
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 015a0218308..85bcccd7b9e 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -48,7 +48,7 @@
48static void __init ek_init_early(void) 48static void __init ek_init_early(void)
49{ 49{
50 /* Initialize processor: 18.432 MHz crystal */ 50 /* Initialize processor: 18.432 MHz crystal */
51 at91rm9200_initialize(18432000); 51 at91_initialize(18432000);
52 52
53 /* Setup the LEDs */ 53 /* Setup the LEDs */
54 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2); 54 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
@@ -65,11 +65,6 @@ static void __init ek_init_early(void)
65 at91_set_serial_console(0); 65 at91_set_serial_console(0);
66} 66}
67 67
68static void __init ek_init_irq(void)
69{
70 at91rm9200_init_interrupts(NULL);
71}
72
73static struct at91_eth_data __initdata ek_eth_data = { 68static struct at91_eth_data __initdata ek_eth_data = {
74 .phy_irq_pin = AT91_PIN_PC4, 69 .phy_irq_pin = AT91_PIN_PC4,
75 .is_rmii = 1, 70 .is_rmii = 1,
@@ -194,8 +189,8 @@ static void __init ek_board_init(void)
194MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK") 189MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK")
195 /* Maintainer: SAN People/Atmel */ 190 /* Maintainer: SAN People/Atmel */
196 .timer = &at91rm9200_timer, 191 .timer = &at91rm9200_timer,
197 .map_io = at91rm9200_map_io, 192 .map_io = at91_map_io,
198 .init_early = ek_init_early, 193 .init_early = ek_init_early,
199 .init_irq = ek_init_irq, 194 .init_irq = at91_init_irq_default,
200 .init_machine = ek_board_init, 195 .init_machine = ek_board_init,
201MACHINE_END 196MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index aaf1bf0989b..4d3a02f1289 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -47,7 +47,7 @@
47static void __init ek_init_early(void) 47static void __init ek_init_early(void)
48{ 48{
49 /* Initialize processor: 18.432 MHz crystal */ 49 /* Initialize processor: 18.432 MHz crystal */
50 at91sam9260_initialize(18432000); 50 at91_initialize(18432000);
51 51
52 /* Setup the LEDs */ 52 /* Setup the LEDs */
53 at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6); 53 at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6);
@@ -67,12 +67,6 @@ static void __init ek_init_early(void)
67 at91_set_serial_console(0); 67 at91_set_serial_console(0);
68} 68}
69 69
70static void __init ek_init_irq(void)
71{
72 at91sam9260_init_interrupts(NULL);
73}
74
75
76/* 70/*
77 * USB Host port 71 * USB Host port
78 */ 72 */
@@ -213,8 +207,8 @@ static void __init ek_board_init(void)
213MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260") 207MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260")
214 /* Maintainer: Olimex */ 208 /* Maintainer: Olimex */
215 .timer = &at91sam926x_timer, 209 .timer = &at91sam926x_timer,
216 .map_io = at91sam9260_map_io, 210 .map_io = at91_map_io,
217 .init_early = ek_init_early, 211 .init_early = ek_init_early,
218 .init_irq = ek_init_irq, 212 .init_irq = at91_init_irq_default,
219 .init_machine = ek_board_init, 213 .init_machine = ek_board_init,
220MACHINE_END 214MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 5c240743c5b..8a50c3e6718 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -53,7 +53,7 @@
53static void __init ek_init_early(void) 53static void __init ek_init_early(void)
54{ 54{
55 /* Initialize processor: 18.432 MHz crystal */ 55 /* Initialize processor: 18.432 MHz crystal */
56 at91sam9260_initialize(18432000); 56 at91_initialize(18432000);
57 57
58 /* DBGU on ttyS0. (Rx & Tx only) */ 58 /* DBGU on ttyS0. (Rx & Tx only) */
59 at91_register_uart(0, 0, 0); 59 at91_register_uart(0, 0, 0);
@@ -70,12 +70,6 @@ static void __init ek_init_early(void)
70 at91_set_serial_console(0); 70 at91_set_serial_console(0);
71} 71}
72 72
73static void __init ek_init_irq(void)
74{
75 at91sam9260_init_interrupts(NULL);
76}
77
78
79/* 73/*
80 * USB Host port 74 * USB Host port
81 */ 75 */
@@ -354,8 +348,8 @@ static void __init ek_board_init(void)
354MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK") 348MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
355 /* Maintainer: Atmel */ 349 /* Maintainer: Atmel */
356 .timer = &at91sam926x_timer, 350 .timer = &at91sam926x_timer,
357 .map_io = at91sam9260_map_io, 351 .map_io = at91_map_io,
358 .init_early = ek_init_early, 352 .init_early = ek_init_early,
359 .init_irq = ek_init_irq, 353 .init_irq = at91_init_irq_default,
360 .init_machine = ek_board_init, 354 .init_machine = ek_board_init,
361MACHINE_END 355MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index b60c22b6e24..5096a0ec50c 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -57,7 +57,7 @@
57static void __init ek_init_early(void) 57static void __init ek_init_early(void)
58{ 58{
59 /* Initialize processor: 18.432 MHz crystal */ 59 /* Initialize processor: 18.432 MHz crystal */
60 at91sam9261_initialize(18432000); 60 at91_initialize(18432000);
61 61
62 /* Setup the LEDs */ 62 /* Setup the LEDs */
63 at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14); 63 at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14);
@@ -69,12 +69,6 @@ static void __init ek_init_early(void)
69 at91_set_serial_console(0); 69 at91_set_serial_console(0);
70} 70}
71 71
72static void __init ek_init_irq(void)
73{
74 at91sam9261_init_interrupts(NULL);
75}
76
77
78/* 72/*
79 * DM9000 ethernet device 73 * DM9000 ethernet device
80 */ 74 */
@@ -621,8 +615,8 @@ MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK")
621#endif 615#endif
622 /* Maintainer: Atmel */ 616 /* Maintainer: Atmel */
623 .timer = &at91sam926x_timer, 617 .timer = &at91sam926x_timer,
624 .map_io = at91sam9261_map_io, 618 .map_io = at91_map_io,
625 .init_early = ek_init_early, 619 .init_early = ek_init_early,
626 .init_irq = ek_init_irq, 620 .init_irq = at91_init_irq_default,
627 .init_machine = ek_board_init, 621 .init_machine = ek_board_init,
628MACHINE_END 622MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 9bbdc92ea19..ea8f185d3b9 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -56,7 +56,7 @@
56static void __init ek_init_early(void) 56static void __init ek_init_early(void)
57{ 57{
58 /* Initialize processor: 16.367 MHz crystal */ 58 /* Initialize processor: 16.367 MHz crystal */
59 at91sam9263_initialize(16367660); 59 at91_initialize(16367660);
60 60
61 /* DBGU on ttyS0. (Rx & Tx only) */ 61 /* DBGU on ttyS0. (Rx & Tx only) */
62 at91_register_uart(0, 0, 0); 62 at91_register_uart(0, 0, 0);
@@ -68,12 +68,6 @@ static void __init ek_init_early(void)
68 at91_set_serial_console(0); 68 at91_set_serial_console(0);
69} 69}
70 70
71static void __init ek_init_irq(void)
72{
73 at91sam9263_init_interrupts(NULL);
74}
75
76
77/* 71/*
78 * USB Host port 72 * USB Host port
79 */ 73 */
@@ -452,8 +446,8 @@ static void __init ek_board_init(void)
452MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") 446MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
453 /* Maintainer: Atmel */ 447 /* Maintainer: Atmel */
454 .timer = &at91sam926x_timer, 448 .timer = &at91sam926x_timer,
455 .map_io = at91sam9263_map_io, 449 .map_io = at91_map_io,
456 .init_early = ek_init_early, 450 .init_early = ek_init_early,
457 .init_irq = ek_init_irq, 451 .init_irq = at91_init_irq_default,
458 .init_machine = ek_board_init, 452 .init_machine = ek_board_init,
459MACHINE_END 453MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 1325a50101a..817f59d7251 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -64,7 +64,7 @@ static int inline ek_have_2mmc(void)
64static void __init ek_init_early(void) 64static void __init ek_init_early(void)
65{ 65{
66 /* Initialize processor: 18.432 MHz crystal */ 66 /* Initialize processor: 18.432 MHz crystal */
67 at91sam9260_initialize(18432000); 67 at91_initialize(18432000);
68 68
69 /* DBGU on ttyS0. (Rx & Tx only) */ 69 /* DBGU on ttyS0. (Rx & Tx only) */
70 at91_register_uart(0, 0, 0); 70 at91_register_uart(0, 0, 0);
@@ -81,12 +81,6 @@ static void __init ek_init_early(void)
81 at91_set_serial_console(0); 81 at91_set_serial_console(0);
82} 82}
83 83
84static void __init ek_init_irq(void)
85{
86 at91sam9260_init_interrupts(NULL);
87}
88
89
90/* 84/*
91 * USB Host port 85 * USB Host port
92 */ 86 */
@@ -404,17 +398,17 @@ static void __init ek_board_init(void)
404MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK") 398MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
405 /* Maintainer: Atmel */ 399 /* Maintainer: Atmel */
406 .timer = &at91sam926x_timer, 400 .timer = &at91sam926x_timer,
407 .map_io = at91sam9260_map_io, 401 .map_io = at91_map_io,
408 .init_early = ek_init_early, 402 .init_early = ek_init_early,
409 .init_irq = ek_init_irq, 403 .init_irq = at91_init_irq_default,
410 .init_machine = ek_board_init, 404 .init_machine = ek_board_init,
411MACHINE_END 405MACHINE_END
412 406
413MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod") 407MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod")
414 /* Maintainer: Atmel */ 408 /* Maintainer: Atmel */
415 .timer = &at91sam926x_timer, 409 .timer = &at91sam926x_timer,
416 .map_io = at91sam9260_map_io, 410 .map_io = at91_map_io,
417 .init_early = ek_init_early, 411 .init_early = ek_init_early,
418 .init_irq = ek_init_irq, 412 .init_irq = at91_init_irq_default,
419 .init_machine = ek_board_init, 413 .init_machine = ek_board_init,
420MACHINE_END 414MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 33eaa135f24..ad234ccbf57 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -50,7 +50,7 @@
50static void __init ek_init_early(void) 50static void __init ek_init_early(void)
51{ 51{
52 /* Initialize processor: 12.000 MHz crystal */ 52 /* Initialize processor: 12.000 MHz crystal */
53 at91sam9g45_initialize(12000000); 53 at91_initialize(12000000);
54 54
55 /* DGBU on ttyS0. (Rx & Tx only) */ 55 /* DGBU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0); 56 at91_register_uart(0, 0, 0);
@@ -63,12 +63,6 @@ static void __init ek_init_early(void)
63 at91_set_serial_console(0); 63 at91_set_serial_console(0);
64} 64}
65 65
66static void __init ek_init_irq(void)
67{
68 at91sam9g45_init_interrupts(NULL);
69}
70
71
72/* 66/*
73 * USB HS Host port (common to OHCI & EHCI) 67 * USB HS Host port (common to OHCI & EHCI)
74 */ 68 */
@@ -422,8 +416,8 @@ static void __init ek_board_init(void)
422MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK") 416MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK")
423 /* Maintainer: Atmel */ 417 /* Maintainer: Atmel */
424 .timer = &at91sam926x_timer, 418 .timer = &at91sam926x_timer,
425 .map_io = at91sam9g45_map_io, 419 .map_io = at91_map_io,
426 .init_early = ek_init_early, 420 .init_early = ek_init_early,
427 .init_irq = ek_init_irq, 421 .init_irq = at91_init_irq_default,
428 .init_machine = ek_board_init, 422 .init_machine = ek_board_init,
429MACHINE_END 423MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index effb399a80a..4f14b54b93a 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -41,7 +41,7 @@
41static void __init ek_init_early(void) 41static void __init ek_init_early(void)
42{ 42{
43 /* Initialize processor: 12.000 MHz crystal */ 43 /* Initialize processor: 12.000 MHz crystal */
44 at91sam9rl_initialize(12000000); 44 at91_initialize(12000000);
45 45
46 /* DBGU on ttyS0. (Rx & Tx only) */ 46 /* DBGU on ttyS0. (Rx & Tx only) */
47 at91_register_uart(0, 0, 0); 47 at91_register_uart(0, 0, 0);
@@ -53,12 +53,6 @@ static void __init ek_init_early(void)
53 at91_set_serial_console(0); 53 at91_set_serial_console(0);
54} 54}
55 55
56static void __init ek_init_irq(void)
57{
58 at91sam9rl_init_interrupts(NULL);
59}
60
61
62/* 56/*
63 * USB HS Device port 57 * USB HS Device port
64 */ 58 */
@@ -330,8 +324,8 @@ static void __init ek_board_init(void)
330MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK") 324MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK")
331 /* Maintainer: Atmel */ 325 /* Maintainer: Atmel */
332 .timer = &at91sam926x_timer, 326 .timer = &at91sam926x_timer,
333 .map_io = at91sam9rl_map_io, 327 .map_io = at91_map_io,
334 .init_early = ek_init_early, 328 .init_early = ek_init_early,
335 .init_irq = ek_init_irq, 329 .init_irq = at91_init_irq_default,
336 .init_machine = ek_board_init, 330 .init_machine = ek_board_init,
337MACHINE_END 331MACHINE_END
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 6010ce16b3c..c73d25e5fae 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -42,7 +42,7 @@
42 42
43static void __init snapper9260_init_early(void) 43static void __init snapper9260_init_early(void)
44{ 44{
45 at91sam9260_initialize(18432000); 45 at91_initialize(18432000);
46 46
47 /* Debug on ttyS0 */ 47 /* Debug on ttyS0 */
48 at91_register_uart(0, 0, 0); 48 at91_register_uart(0, 0, 0);
@@ -55,11 +55,6 @@ static void __init snapper9260_init_early(void)
55 at91_register_uart(AT91SAM9260_ID_US2, 3, 0); 55 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
56} 56}
57 57
58static void __init snapper9260_init_irq(void)
59{
60 at91sam9260_init_interrupts(NULL);
61}
62
63static struct at91_usbh_data __initdata snapper9260_usbh_data = { 58static struct at91_usbh_data __initdata snapper9260_usbh_data = {
64 .ports = 2, 59 .ports = 2,
65}; 60};
@@ -179,9 +174,9 @@ static void __init snapper9260_board_init(void)
179 174
180MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module") 175MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module")
181 .timer = &at91sam926x_timer, 176 .timer = &at91sam926x_timer,
182 .map_io = at91sam9260_map_io, 177 .map_io = at91_map_io,
183 .init_early = snapper9260_init_early, 178 .init_early = snapper9260_init_early,
184 .init_irq = snapper9260_init_irq, 179 .init_irq = at91_init_irq_default,
185 .init_machine = snapper9260_board_init, 180 .init_machine = snapper9260_board_init,
186MACHINE_END 181MACHINE_END
187 182
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index 5e5c85688f5..936e5fd7f40 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -35,7 +35,7 @@
35void __init stamp9g20_init_early(void) 35void __init stamp9g20_init_early(void)
36{ 36{
37 /* Initialize processor: 18.432 MHz crystal */ 37 /* Initialize processor: 18.432 MHz crystal */
38 at91sam9260_initialize(18432000); 38 at91_initialize(18432000);
39 39
40 /* DGBU on ttyS0. (Rx & Tx only) */ 40 /* DGBU on ttyS0. (Rx & Tx only) */
41 at91_register_uart(0, 0, 0); 41 at91_register_uart(0, 0, 0);
@@ -76,12 +76,6 @@ static void __init portuxg20_init_early(void)
76 at91_register_uart(AT91SAM9260_ID_US5, 6, 0); 76 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
77} 77}
78 78
79static void __init init_irq(void)
80{
81 at91sam9260_init_interrupts(NULL);
82}
83
84
85/* 79/*
86 * NAND flash 80 * NAND flash
87 */ 81 */
@@ -299,17 +293,17 @@ static void __init stamp9g20evb_board_init(void)
299MACHINE_START(PORTUXG20, "taskit PortuxG20") 293MACHINE_START(PORTUXG20, "taskit PortuxG20")
300 /* Maintainer: taskit GmbH */ 294 /* Maintainer: taskit GmbH */
301 .timer = &at91sam926x_timer, 295 .timer = &at91sam926x_timer,
302 .map_io = at91sam9260_map_io, 296 .map_io = at91_map_io,
303 .init_early = portuxg20_init_early, 297 .init_early = portuxg20_init_early,
304 .init_irq = init_irq, 298 .init_irq = at91_init_irq_default,
305 .init_machine = portuxg20_board_init, 299 .init_machine = portuxg20_board_init,
306MACHINE_END 300MACHINE_END
307 301
308MACHINE_START(STAMP9G20, "taskit Stamp9G20") 302MACHINE_START(STAMP9G20, "taskit Stamp9G20")
309 /* Maintainer: taskit GmbH */ 303 /* Maintainer: taskit GmbH */
310 .timer = &at91sam926x_timer, 304 .timer = &at91sam926x_timer,
311 .map_io = at91sam9260_map_io, 305 .map_io = at91_map_io,
312 .init_early = stamp9g20evb_init_early, 306 .init_early = stamp9g20evb_init_early,
313 .init_irq = init_irq, 307 .init_irq = at91_init_irq_default,
314 .init_machine = stamp9g20evb_board_init, 308 .init_machine = stamp9g20evb_board_init,
315MACHINE_END 309MACHINE_END
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index 0e784e6fede..8c4c1a02c4b 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -51,7 +51,7 @@
51static void __init ek_init_early(void) 51static void __init ek_init_early(void)
52{ 52{
53 /* Initialize processor: 12.000 MHz crystal */ 53 /* Initialize processor: 12.000 MHz crystal */
54 at91sam9260_initialize(12000000); 54 at91_initialize(12000000);
55 55
56 /* DBGU on ttyS0. (Rx & Tx only) */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0); 57 at91_register_uart(0, 0, 0);
@@ -60,12 +60,6 @@ static void __init ek_init_early(void)
60 at91_set_serial_console(0); 60 at91_set_serial_console(0);
61} 61}
62 62
63static void __init ek_init_irq(void)
64{
65 at91sam9260_init_interrupts(NULL);
66}
67
68
69/* 63/*
70 * USB Host port 64 * USB Host port
71 */ 65 */
@@ -229,8 +223,8 @@ static void __init ek_board_init(void)
229MACHINE_START(USB_A9260, "CALAO USB_A9260") 223MACHINE_START(USB_A9260, "CALAO USB_A9260")
230 /* Maintainer: calao-systems */ 224 /* Maintainer: calao-systems */
231 .timer = &at91sam926x_timer, 225 .timer = &at91sam926x_timer,
232 .map_io = at91sam9260_map_io, 226 .map_io = at91_map_io,
233 .init_early = ek_init_early, 227 .init_early = ek_init_early,
234 .init_irq = ek_init_irq, 228 .init_irq = at91_init_irq_default,
235 .init_machine = ek_board_init, 229 .init_machine = ek_board_init,
236MACHINE_END 230MACHINE_END
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index cf626dd14b2..25e793782a4 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -50,7 +50,7 @@
50static void __init ek_init_early(void) 50static void __init ek_init_early(void)
51{ 51{
52 /* Initialize processor: 12.00 MHz crystal */ 52 /* Initialize processor: 12.00 MHz crystal */
53 at91sam9263_initialize(12000000); 53 at91_initialize(12000000);
54 54
55 /* DBGU on ttyS0. (Rx & Tx only) */ 55 /* DBGU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0); 56 at91_register_uart(0, 0, 0);
@@ -59,12 +59,6 @@ static void __init ek_init_early(void)
59 at91_set_serial_console(0); 59 at91_set_serial_console(0);
60} 60}
61 61
62static void __init ek_init_irq(void)
63{
64 at91sam9263_init_interrupts(NULL);
65}
66
67
68/* 62/*
69 * USB Host port 63 * USB Host port
70 */ 64 */
@@ -245,8 +239,8 @@ static void __init ek_board_init(void)
245MACHINE_START(USB_A9263, "CALAO USB_A9263") 239MACHINE_START(USB_A9263, "CALAO USB_A9263")
246 /* Maintainer: calao-systems */ 240 /* Maintainer: calao-systems */
247 .timer = &at91sam926x_timer, 241 .timer = &at91sam926x_timer,
248 .map_io = at91sam9263_map_io, 242 .map_io = at91_map_io,
249 .init_early = ek_init_early, 243 .init_early = ek_init_early,
250 .init_irq = ek_init_irq, 244 .init_irq = at91_init_irq_default,
251 .init_machine = ek_board_init, 245 .init_machine = ek_board_init,
252MACHINE_END 246MACHINE_END
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index c208cc334d7..95edcbd2aec 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -56,7 +56,7 @@ static void __init yl9200_init_early(void)
56 at91rm9200_set_type(ARCH_REVISON_9200_PQFP); 56 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
57 57
58 /* Initialize processor: 18.432 MHz crystal */ 58 /* Initialize processor: 18.432 MHz crystal */
59 at91rm9200_initialize(18432000); 59 at91_initialize(18432000);
60 60
61 /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */ 61 /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
62 at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17); 62 at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
@@ -79,12 +79,6 @@ static void __init yl9200_init_early(void)
79 at91_set_serial_console(0); 79 at91_set_serial_console(0);
80} 80}
81 81
82static void __init yl9200_init_irq(void)
83{
84 at91rm9200_init_interrupts(NULL);
85}
86
87
88/* 82/*
89 * LEDs 83 * LEDs
90 */ 84 */
@@ -599,8 +593,8 @@ static void __init yl9200_board_init(void)
599MACHINE_START(YL9200, "uCdragon YL-9200") 593MACHINE_START(YL9200, "uCdragon YL-9200")
600 /* Maintainer: S.Birtles */ 594 /* Maintainer: S.Birtles */
601 .timer = &at91rm9200_timer, 595 .timer = &at91rm9200_timer,
602 .map_io = at91rm9200_map_io, 596 .map_io = at91_map_io,
603 .init_early = yl9200_init_early, 597 .init_early = yl9200_init_early,
604 .init_irq = yl9200_init_irq, 598 .init_irq = at91_init_irq_default,
605 .init_machine = yl9200_board_init, 599 .init_machine = yl9200_board_init,
606MACHINE_END 600MACHINE_END
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 8ff3418f343..938b34f5774 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -11,35 +11,19 @@
11#include <linux/clkdev.h> 11#include <linux/clkdev.h>
12 12
13 /* Map io */ 13 /* Map io */
14extern void __init at91rm9200_map_io(void); 14extern void __init at91_map_io(void);
15extern void __init at91sam9260_map_io(void); 15extern void __init at91_init_sram(int bank, unsigned long base,
16extern void __init at91sam9261_map_io(void); 16 unsigned int length);
17extern void __init at91sam9263_map_io(void);
18extern void __init at91sam9rl_map_io(void);
19extern void __init at91sam9g45_map_io(void);
20extern void __init at91x40_map_io(void);
21extern void __init at91cap9_map_io(void);
22 17
23 /* Processors */ 18 /* Processors */
24extern void __init at91rm9200_set_type(int type); 19extern void __init at91rm9200_set_type(int type);
25extern void __init at91rm9200_initialize(unsigned long main_clock); 20extern void __init at91_initialize(unsigned long main_clock);
26extern void __init at91sam9260_initialize(unsigned long main_clock);
27extern void __init at91sam9261_initialize(unsigned long main_clock);
28extern void __init at91sam9263_initialize(unsigned long main_clock);
29extern void __init at91sam9rl_initialize(unsigned long main_clock);
30extern void __init at91sam9g45_initialize(unsigned long main_clock);
31extern void __init at91x40_initialize(unsigned long main_clock); 21extern void __init at91x40_initialize(unsigned long main_clock);
32extern void __init at91cap9_initialize(unsigned long main_clock);
33 22
34 /* Interrupts */ 23 /* Interrupts */
35extern void __init at91rm9200_init_interrupts(unsigned int priority[]); 24extern void __init at91_init_irq_default(void);
36extern void __init at91sam9260_init_interrupts(unsigned int priority[]); 25extern void __init at91_init_interrupts(unsigned int priority[]);
37extern void __init at91sam9261_init_interrupts(unsigned int priority[]);
38extern void __init at91sam9263_init_interrupts(unsigned int priority[]);
39extern void __init at91sam9rl_init_interrupts(unsigned int priority[]);
40extern void __init at91sam9g45_init_interrupts(unsigned int priority[]);
41extern void __init at91x40_init_interrupts(unsigned int priority[]); 26extern void __init at91x40_init_interrupts(unsigned int priority[]);
42extern void __init at91cap9_init_interrupts(unsigned int priority[]);
43extern void __init at91_aic_init(unsigned int priority[]); 27extern void __init at91_aic_init(unsigned int priority[]);
44 28
45 /* Timer */ 29 /* Timer */
@@ -49,7 +33,6 @@ extern struct sys_timer at91sam926x_timer;
49extern struct sys_timer at91x40_timer; 33extern struct sys_timer at91x40_timer;
50 34
51 /* Clocks */ 35 /* Clocks */
52extern int __init at91_clock_init(unsigned long main_clock);
53/* 36/*
54 * function to specify the clock of the default console. As we do not 37 * function to specify the clock of the default console. As we do not
55 * use the device/driver bus, the dev_name is not intialize. So we need 38 * use the device/driver bus, the dev_name is not intialize. So we need
@@ -62,6 +45,11 @@ extern void __init at91sam9263_set_console_clock(int id);
62extern void __init at91sam9rl_set_console_clock(int id); 45extern void __init at91sam9rl_set_console_clock(int id);
63extern void __init at91sam9g45_set_console_clock(int id); 46extern void __init at91sam9g45_set_console_clock(int id);
64extern void __init at91cap9_set_console_clock(int id); 47extern void __init at91cap9_set_console_clock(int id);
48#ifdef CONFIG_AT91_PMC_UNIT
49extern int __init at91_clock_init(unsigned long main_clock);
50#else
51static int inline at91_clock_init(unsigned long main_clock) { return 0; }
52#endif
65struct device; 53struct device;
66 54
67 /* Power Management */ 55 /* Power Management */
diff --git a/arch/arm/mach-at91/include/mach/at91_dbgu.h b/arch/arm/mach-at91/include/mach/at91_dbgu.h
index 6dcaa771687..dbfe455a4c4 100644
--- a/arch/arm/mach-at91/include/mach/at91_dbgu.h
+++ b/arch/arm/mach-at91/include/mach/at91_dbgu.h
@@ -16,22 +16,25 @@
16#ifndef AT91_DBGU_H 16#ifndef AT91_DBGU_H
17#define AT91_DBGU_H 17#define AT91_DBGU_H
18 18
19#define dbgu_readl(dbgu, field) \
20 __raw_readl(AT91_VA_BASE_SYS + dbgu + AT91_DBGU_ ## field)
21
19#ifdef AT91_DBGU 22#ifdef AT91_DBGU
20#define AT91_DBGU_CR (AT91_DBGU + 0x00) /* Control Register */ 23#define AT91_DBGU_CR (0x00) /* Control Register */
21#define AT91_DBGU_MR (AT91_DBGU + 0x04) /* Mode Register */ 24#define AT91_DBGU_MR (0x04) /* Mode Register */
22#define AT91_DBGU_IER (AT91_DBGU + 0x08) /* Interrupt Enable Register */ 25#define AT91_DBGU_IER (0x08) /* Interrupt Enable Register */
23#define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */ 26#define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */
24#define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */ 27#define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */
25#define AT91_DBGU_IDR (AT91_DBGU + 0x0c) /* Interrupt Disable Register */ 28#define AT91_DBGU_IDR (0x0c) /* Interrupt Disable Register */
26#define AT91_DBGU_IMR (AT91_DBGU + 0x10) /* Interrupt Mask Register */ 29#define AT91_DBGU_IMR (0x10) /* Interrupt Mask Register */
27#define AT91_DBGU_SR (AT91_DBGU + 0x14) /* Status Register */ 30#define AT91_DBGU_SR (0x14) /* Status Register */
28#define AT91_DBGU_RHR (AT91_DBGU + 0x18) /* Receiver Holding Register */ 31#define AT91_DBGU_RHR (0x18) /* Receiver Holding Register */
29#define AT91_DBGU_THR (AT91_DBGU + 0x1c) /* Transmitter Holding Register */ 32#define AT91_DBGU_THR (0x1c) /* Transmitter Holding Register */
30#define AT91_DBGU_BRGR (AT91_DBGU + 0x20) /* Baud Rate Generator Register */ 33#define AT91_DBGU_BRGR (0x20) /* Baud Rate Generator Register */
31 34
32#define AT91_DBGU_CIDR (AT91_DBGU + 0x40) /* Chip ID Register */ 35#define AT91_DBGU_CIDR (0x40) /* Chip ID Register */
33#define AT91_DBGU_EXID (AT91_DBGU + 0x44) /* Chip ID Extension Register */ 36#define AT91_DBGU_EXID (0x44) /* Chip ID Extension Register */
34#define AT91_DBGU_FNR (AT91_DBGU + 0x48) /* Force NTRST Register [SAM9 only] */ 37#define AT91_DBGU_FNR (0x48) /* Force NTRST Register [SAM9 only] */
35#define AT91_DBGU_FNTRST (1 << 0) /* Force NTRST */ 38#define AT91_DBGU_FNTRST (1 << 0) /* Force NTRST */
36 39
37#endif /* AT91_DBGU */ 40#endif /* AT91_DBGU */
diff --git a/arch/arm/mach-at91/include/mach/at91_wdt.h b/arch/arm/mach-at91/include/mach/at91_wdt.h
deleted file mode 100644
index fecc2e9f0ca..00000000000
--- a/arch/arm/mach-at91/include/mach/at91_wdt.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_wdt.h
3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
7 * Watchdog Timer (WDT) - System peripherals regsters.
8 * Based on AT91SAM9261 datasheet revision D.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_WDT_H
17#define AT91_WDT_H
18
19#define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */
20#define AT91_WDT_WDRSTT (1 << 0) /* Restart */
21#define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */
22
23#define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */
24#define AT91_WDT_WDV (0xfff << 0) /* Counter Value */
25#define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */
26#define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */
27#define AT91_WDT_WDRPROC (1 << 14) /* Timer Restart */
28#define AT91_WDT_WDDIS (1 << 15) /* Watchdog Disable */
29#define AT91_WDT_WDD (0xfff << 16) /* Delta Value */
30#define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */
31#define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */
32
33#define AT91_WDT_SR (AT91_WDT + 0x08) /* Watchdog Status Register */
34#define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */
35#define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */
36
37#endif
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h
index 665993849a7..c5df1e8f195 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9.h
@@ -75,7 +75,6 @@
75#define AT91CAP9_BASE_EMAC 0xfffbc000 75#define AT91CAP9_BASE_EMAC 0xfffbc000
76#define AT91CAP9_BASE_ADC 0xfffc0000 76#define AT91CAP9_BASE_ADC 0xfffc0000
77#define AT91CAP9_BASE_ISI 0xfffc4000 77#define AT91CAP9_BASE_ISI 0xfffc4000
78#define AT91_BASE_SYS 0xffffe200
79 78
80/* 79/*
81 * System Peripherals (offset from AT91_BASE_SYS) 80 * System Peripherals (offset from AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h
index 99e0f8d02d7..e4037b50030 100644
--- a/arch/arm/mach-at91/include/mach/at91rm9200.h
+++ b/arch/arm/mach-at91/include/mach/at91rm9200.h
@@ -74,7 +74,6 @@
74#define AT91RM9200_BASE_SSC1 0xfffd4000 74#define AT91RM9200_BASE_SSC1 0xfffd4000
75#define AT91RM9200_BASE_SSC2 0xfffd8000 75#define AT91RM9200_BASE_SSC2 0xfffd8000
76#define AT91RM9200_BASE_SPI 0xfffe0000 76#define AT91RM9200_BASE_SPI 0xfffe0000
77#define AT91_BASE_SYS 0xfffff000
78 77
79 78
80/* 79/*
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
index 8b6bf835cd7..9a791165913 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -76,7 +76,6 @@
76#define AT91SAM9260_BASE_TC4 0xfffdc040 76#define AT91SAM9260_BASE_TC4 0xfffdc040
77#define AT91SAM9260_BASE_TC5 0xfffdc080 77#define AT91SAM9260_BASE_TC5 0xfffdc080
78#define AT91SAM9260_BASE_ADC 0xfffe0000 78#define AT91SAM9260_BASE_ADC 0xfffe0000
79#define AT91_BASE_SYS 0xffffe800
80 79
81/* 80/*
82 * System Peripherals (offset from AT91_BASE_SYS) 81 * System Peripherals (offset from AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
index eafbddaf523..ce596204cef 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -60,7 +60,6 @@
60#define AT91SAM9261_BASE_SSC2 0xfffc4000 60#define AT91SAM9261_BASE_SSC2 0xfffc4000
61#define AT91SAM9261_BASE_SPI0 0xfffc8000 61#define AT91SAM9261_BASE_SPI0 0xfffc8000
62#define AT91SAM9261_BASE_SPI1 0xfffcc000 62#define AT91SAM9261_BASE_SPI1 0xfffcc000
63#define AT91_BASE_SYS 0xffffea00
64 63
65 64
66/* 65/*
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h
index e2d348213a7..f1b92961a2b 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9263.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9263.h
@@ -70,7 +70,6 @@
70#define AT91SAM9263_BASE_EMAC 0xfffbc000 70#define AT91SAM9263_BASE_EMAC 0xfffbc000
71#define AT91SAM9263_BASE_ISI 0xfffc4000 71#define AT91SAM9263_BASE_ISI 0xfffc4000
72#define AT91SAM9263_BASE_2DGE 0xfffc8000 72#define AT91SAM9263_BASE_2DGE 0xfffc8000
73#define AT91_BASE_SYS 0xffffe000
74 73
75/* 74/*
76 * System Peripherals (offset from AT91_BASE_SYS) 75 * System Peripherals (offset from AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index 659304aa73d..2c611b9a013 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -82,7 +82,6 @@
82#define AT91SAM9G45_BASE_TC3 0xfffd4000 82#define AT91SAM9G45_BASE_TC3 0xfffd4000
83#define AT91SAM9G45_BASE_TC4 0xfffd4040 83#define AT91SAM9G45_BASE_TC4 0xfffd4040
84#define AT91SAM9G45_BASE_TC5 0xfffd4080 84#define AT91SAM9G45_BASE_TC5 0xfffd4080
85#define AT91_BASE_SYS 0xffffe200
86 85
87/* 86/*
88 * System Peripherals (offset from AT91_BASE_SYS) 87 * System Peripherals (offset from AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h
index 41dbbe61055..1aabacd315d 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -64,7 +64,6 @@
64#define AT91SAM9RL_BASE_TSC 0xfffd0000 64#define AT91SAM9RL_BASE_TSC 0xfffd0000
65#define AT91SAM9RL_BASE_UDPHS 0xfffd4000 65#define AT91SAM9RL_BASE_UDPHS 0xfffd4000
66#define AT91SAM9RL_BASE_AC97C 0xfffd8000 66#define AT91SAM9RL_BASE_AC97C 0xfffd8000
67#define AT91_BASE_SYS 0xffffc000
68 67
69 68
70/* 69/*
diff --git a/arch/arm/mach-at91/include/mach/clkdev.h b/arch/arm/mach-at91/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/mach-at91/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index df966c2bc2d..f6ce936dba2 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/cpu.h 2 * arch/arm/mach-at91/include/mach/cpu.h
3 * 3 *
4 * Copyright (C) 2006 SAN People 4 * Copyright (C) 2006 SAN People
5 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -10,12 +11,8 @@
10 * 11 *
11 */ 12 */
12 13
13#ifndef __ASM_ARCH_CPU_H 14#ifndef __MACH_CPU_H__
14#define __ASM_ARCH_CPU_H 15#define __MACH_CPU_H__
15
16#include <mach/hardware.h>
17#include <mach/at91_dbgu.h>
18
19 16
20#define ARCH_ID_AT91RM9200 0x09290780 17#define ARCH_ID_AT91RM9200 0x09290780
21#define ARCH_ID_AT91SAM9260 0x019803a0 18#define ARCH_ID_AT91SAM9260 0x019803a0
@@ -39,16 +36,6 @@
39#define ARCH_ID_AT91M40807 0x14080745 36#define ARCH_ID_AT91M40807 0x14080745
40#define ARCH_ID_AT91R40008 0x44000840 37#define ARCH_ID_AT91R40008 0x44000840
41 38
42static inline unsigned long at91_cpu_identify(void)
43{
44 return (at91_sys_read(AT91_DBGU_CIDR) & ~AT91_CIDR_VERSION);
45}
46
47static inline unsigned long at91_cpu_fully_identify(void)
48{
49 return at91_sys_read(AT91_DBGU_CIDR);
50}
51
52#define ARCH_EXID_AT91SAM9M11 0x00000001 39#define ARCH_EXID_AT91SAM9M11 0x00000001
53#define ARCH_EXID_AT91SAM9M10 0x00000002 40#define ARCH_EXID_AT91SAM9M10 0x00000002
54#define ARCH_EXID_AT91SAM9G46 0x00000003 41#define ARCH_EXID_AT91SAM9G46 0x00000003
@@ -60,40 +47,80 @@ static inline unsigned long at91_cpu_fully_identify(void)
60#define ARCH_EXID_AT91SAM9G25 0x00000003 47#define ARCH_EXID_AT91SAM9G25 0x00000003
61#define ARCH_EXID_AT91SAM9X25 0x00000004 48#define ARCH_EXID_AT91SAM9X25 0x00000004
62 49
63static inline unsigned long at91_exid_identify(void)
64{
65 return at91_sys_read(AT91_DBGU_EXID);
66}
67
68
69#define ARCH_FAMILY_AT91X92 0x09200000 50#define ARCH_FAMILY_AT91X92 0x09200000
70#define ARCH_FAMILY_AT91SAM9 0x01900000 51#define ARCH_FAMILY_AT91SAM9 0x01900000
71#define ARCH_FAMILY_AT91SAM9XE 0x02900000 52#define ARCH_FAMILY_AT91SAM9XE 0x02900000
72 53
73static inline unsigned long at91_arch_identify(void) 54/* PMC revision */
74{
75 return (at91_sys_read(AT91_DBGU_CIDR) & AT91_CIDR_ARCH);
76}
77
78#ifdef CONFIG_ARCH_AT91CAP9
79#include <mach/at91_pmc.h>
80
81#define ARCH_REVISION_CAP9_B 0x399 55#define ARCH_REVISION_CAP9_B 0x399
82#define ARCH_REVISION_CAP9_C 0x601 56#define ARCH_REVISION_CAP9_C 0x601
83 57
84static inline unsigned long at91cap9_rev_identify(void) 58/* RM9200 type */
59#define ARCH_REVISON_9200_BGA (0 << 0)
60#define ARCH_REVISON_9200_PQFP (1 << 0)
61
62enum at91_soc_type {
63 /* 920T */
64 AT91_SOC_RM9200,
65
66 /* CAP */
67 AT91_SOC_CAP9,
68
69 /* SAM92xx */
70 AT91_SOC_SAM9260, AT91_SOC_SAM9261, AT91_SOC_SAM9263,
71
72 /* SAM9Gxx */
73 AT91_SOC_SAM9G10, AT91_SOC_SAM9G20, AT91_SOC_SAM9G45,
74
75 /* SAM9RL */
76 AT91_SOC_SAM9RL,
77
78 /* SAM9X5 */
79 AT91_SOC_SAM9X5,
80
81 /* Unknown type */
82 AT91_SOC_NONE
83};
84
85enum at91_soc_subtype {
86 /* RM9200 */
87 AT91_SOC_RM9200_BGA, AT91_SOC_RM9200_PQFP,
88
89 /* CAP9 */
90 AT91_SOC_CAP9_REV_B, AT91_SOC_CAP9_REV_C,
91
92 /* SAM9260 */
93 AT91_SOC_SAM9XE,
94
95 /* SAM9G45 */
96 AT91_SOC_SAM9G45ES, AT91_SOC_SAM9M10, AT91_SOC_SAM9G46, AT91_SOC_SAM9M11,
97
98 /* SAM9X5 */
99 AT91_SOC_SAM9G15, AT91_SOC_SAM9G35, AT91_SOC_SAM9X35,
100 AT91_SOC_SAM9G25, AT91_SOC_SAM9X25,
101
102 /* Unknown subtype */
103 AT91_SOC_SUBTYPE_NONE
104};
105
106struct at91_socinfo {
107 unsigned int type, subtype;
108 unsigned int cidr, exid;
109};
110
111extern struct at91_socinfo at91_soc_initdata;
112const char *at91_get_soc_type(struct at91_socinfo *c);
113const char *at91_get_soc_subtype(struct at91_socinfo *c);
114
115static inline int at91_soc_is_detected(void)
85{ 116{
86 return (at91_sys_read(AT91_PMC_VER)); 117 return at91_soc_initdata.type != AT91_SOC_NONE;
87} 118}
88#endif
89 119
90#ifdef CONFIG_ARCH_AT91RM9200 120#ifdef CONFIG_ARCH_AT91RM9200
91extern int rm9200_type; 121#define cpu_is_at91rm9200() (at91_soc_initdata.type == AT91_SOC_RM9200)
92#define ARCH_REVISON_9200_BGA (0 << 0) 122#define cpu_is_at91rm9200_bga() (at91_soc_initdata.subtype == AT91_SOC_RM9200_BGA)
93#define ARCH_REVISON_9200_PQFP (1 << 0) 123#define cpu_is_at91rm9200_pqfp() (at91_soc_initdata.subtype == AT91_SOC_RM9200_PQFP)
94#define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200)
95#define cpu_is_at91rm9200_bga() (!cpu_is_at91rm9200_pqfp())
96#define cpu_is_at91rm9200_pqfp() (cpu_is_at91rm9200() && rm9200_type & ARCH_REVISON_9200_PQFP)
97#else 124#else
98#define cpu_is_at91rm9200() (0) 125#define cpu_is_at91rm9200() (0)
99#define cpu_is_at91rm9200_bga() (0) 126#define cpu_is_at91rm9200_bga() (0)
@@ -101,52 +128,49 @@ extern int rm9200_type;
101#endif 128#endif
102 129
103#ifdef CONFIG_ARCH_AT91SAM9260 130#ifdef CONFIG_ARCH_AT91SAM9260
104#define cpu_is_at91sam9xe() (at91_arch_identify() == ARCH_FAMILY_AT91SAM9XE) 131#define cpu_is_at91sam9xe() (at91_soc_initdata.subtype == AT91_SOC_SAM9XE)
105#define cpu_is_at91sam9260() ((at91_cpu_identify() == ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe()) 132#define cpu_is_at91sam9260() (at91_soc_initdata.type == AT91_SOC_SAM9260)
106#else 133#else
107#define cpu_is_at91sam9xe() (0) 134#define cpu_is_at91sam9xe() (0)
108#define cpu_is_at91sam9260() (0) 135#define cpu_is_at91sam9260() (0)
109#endif 136#endif
110 137
111#ifdef CONFIG_ARCH_AT91SAM9G20 138#ifdef CONFIG_ARCH_AT91SAM9G20
112#define cpu_is_at91sam9g20() (at91_cpu_identify() == ARCH_ID_AT91SAM9G20) 139#define cpu_is_at91sam9g20() (at91_soc_initdata.type == AT91_SOC_SAM9G20)
113#else 140#else
114#define cpu_is_at91sam9g20() (0) 141#define cpu_is_at91sam9g20() (0)
115#endif 142#endif
116 143
117#ifdef CONFIG_ARCH_AT91SAM9261 144#ifdef CONFIG_ARCH_AT91SAM9261
118#define cpu_is_at91sam9261() (at91_cpu_identify() == ARCH_ID_AT91SAM9261) 145#define cpu_is_at91sam9261() (at91_soc_initdata.type == AT91_SOC_SAM9261)
119#else 146#else
120#define cpu_is_at91sam9261() (0) 147#define cpu_is_at91sam9261() (0)
121#endif 148#endif
122 149
123#ifdef CONFIG_ARCH_AT91SAM9G10 150#ifdef CONFIG_ARCH_AT91SAM9G10
124#define cpu_is_at91sam9g10() ((at91_cpu_identify() & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) 151#define cpu_is_at91sam9g10() (at91_soc_initdata.type == AT91_SOC_SAM9G10)
125#else 152#else
126#define cpu_is_at91sam9g10() (0) 153#define cpu_is_at91sam9g10() (0)
127#endif 154#endif
128 155
129#ifdef CONFIG_ARCH_AT91SAM9263 156#ifdef CONFIG_ARCH_AT91SAM9263
130#define cpu_is_at91sam9263() (at91_cpu_identify() == ARCH_ID_AT91SAM9263) 157#define cpu_is_at91sam9263() (at91_soc_initdata.type == AT91_SOC_SAM9263)
131#else 158#else
132#define cpu_is_at91sam9263() (0) 159#define cpu_is_at91sam9263() (0)
133#endif 160#endif
134 161
135#ifdef CONFIG_ARCH_AT91SAM9RL 162#ifdef CONFIG_ARCH_AT91SAM9RL
136#define cpu_is_at91sam9rl() (at91_cpu_identify() == ARCH_ID_AT91SAM9RL64) 163#define cpu_is_at91sam9rl() (at91_soc_initdata.type == AT91_SOC_SAM9RL)
137#else 164#else
138#define cpu_is_at91sam9rl() (0) 165#define cpu_is_at91sam9rl() (0)
139#endif 166#endif
140 167
141#ifdef CONFIG_ARCH_AT91SAM9G45 168#ifdef CONFIG_ARCH_AT91SAM9G45
142#define cpu_is_at91sam9g45() (at91_cpu_identify() == ARCH_ID_AT91SAM9G45) 169#define cpu_is_at91sam9g45() (at91_soc_initdata.type == AT91_SOC_SAM9G45)
143#define cpu_is_at91sam9g45es() (at91_cpu_fully_identify() == ARCH_ID_AT91SAM9G45ES) 170#define cpu_is_at91sam9g45es() (at91_soc_initdata.subtype == AT91_SOC_SAM9G45ES)
144#define cpu_is_at91sam9m10() (cpu_is_at91sam9g45() && \ 171#define cpu_is_at91sam9m10() (at91_soc_initdata.subtype == AT91_SOC_SAM9M10)
145 (at91_exid_identify() == ARCH_EXID_AT91SAM9M10)) 172#define cpu_is_at91sam9g46() (at91_soc_initdata.subtype == AT91_SOC_SAM9G46)
146#define cpu_is_at91sam9m46() (cpu_is_at91sam9g45() && \ 173#define cpu_is_at91sam9m11() (at91_soc_initdata.subtype == AT91_SOC_SAM9M11)
147 (at91_exid_identify() == ARCH_EXID_AT91SAM9G46))
148#define cpu_is_at91sam9m11() (cpu_is_at91sam9g45() && \
149 (at91_exid_identify() == ARCH_EXID_AT91SAM9M11))
150#else 174#else
151#define cpu_is_at91sam9g45() (0) 175#define cpu_is_at91sam9g45() (0)
152#define cpu_is_at91sam9g45es() (0) 176#define cpu_is_at91sam9g45es() (0)
@@ -156,17 +180,12 @@ extern int rm9200_type;
156#endif 180#endif
157 181
158#ifdef CONFIG_ARCH_AT91SAM9X5 182#ifdef CONFIG_ARCH_AT91SAM9X5
159#define cpu_is_at91sam9x5() (at91_cpu_identify() == ARCH_ID_AT91SAM9X5) 183#define cpu_is_at91sam9x5() (at91_soc_initdata.type == AT91_SOC_SAM9X5)
160#define cpu_is_at91sam9g15() (cpu_is_at91sam9x5() && \ 184#define cpu_is_at91sam9g15() (at91_soc_initdata.subtype == AT91_SOC_SAM9G15)
161 (at91_exid_identify() == ARCH_EXID_AT91SAM9G15)) 185#define cpu_is_at91sam9g35() (at91_soc_initdata.subtype == AT91_SOC_SAM9G35)
162#define cpu_is_at91sam9g35() (cpu_is_at91sam9x5() && \ 186#define cpu_is_at91sam9x35() (at91_soc_initdata.subtype == AT91_SOC_SAM9X35)
163 (at91_exid_identify() == ARCH_EXID_AT91SAM9G35)) 187#define cpu_is_at91sam9g25() (at91_soc_initdata.subtype == AT91_SOC_SAM9G25)
164#define cpu_is_at91sam9x35() (cpu_is_at91sam9x5() && \ 188#define cpu_is_at91sam9x25() (at91_soc_initdata.subtype == AT91_SOC_SAM9X25)
165 (at91_exid_identify() == ARCH_EXID_AT91SAM9X35))
166#define cpu_is_at91sam9g25() (cpu_is_at91sam9x5() && \
167 (at91_exid_identify() == ARCH_EXID_AT91SAM9G25))
168#define cpu_is_at91sam9x25() (cpu_is_at91sam9x5() && \
169 (at91_exid_identify() == ARCH_EXID_AT91SAM9X25))
170#else 189#else
171#define cpu_is_at91sam9x5() (0) 190#define cpu_is_at91sam9x5() (0)
172#define cpu_is_at91sam9g15() (0) 191#define cpu_is_at91sam9g15() (0)
@@ -177,9 +196,9 @@ extern int rm9200_type;
177#endif 196#endif
178 197
179#ifdef CONFIG_ARCH_AT91CAP9 198#ifdef CONFIG_ARCH_AT91CAP9
180#define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9) 199#define cpu_is_at91cap9() (at91_soc_initdata.type == AT91_SOC_CAP9)
181#define cpu_is_at91cap9_revB() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B) 200#define cpu_is_at91cap9_revB() (at91_soc_initdata.subtype == AT91_SOC_CAP9_REV_B)
182#define cpu_is_at91cap9_revC() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_C) 201#define cpu_is_at91cap9_revC() (at91_soc_initdata.subtype == AT91_SOC_CAP9_REV_C)
183#else 202#else
184#define cpu_is_at91cap9() (0) 203#define cpu_is_at91cap9() (0)
185#define cpu_is_at91cap9_revB() (0) 204#define cpu_is_at91cap9_revB() (0)
@@ -192,4 +211,4 @@ extern int rm9200_type;
192 */ 211 */
193#define cpu_is_at32ap7000() (0) 212#define cpu_is_at32ap7000() (0)
194 213
195#endif 214#endif /* __MACH_CPU_H__ */
diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/mach-at91/include/mach/debug-macro.S
index 0f959faf74a..bc1e0b2e2f4 100644
--- a/arch/arm/mach-at91/include/mach/debug-macro.S
+++ b/arch/arm/mach-at91/include/mach/debug-macro.S
@@ -15,23 +15,23 @@
15#include <mach/at91_dbgu.h> 15#include <mach/at91_dbgu.h>
16 16
17 .macro addruart, rp, rv 17 .macro addruart, rp, rv
18 ldr \rp, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address) 18 ldr \rp, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address)
19 ldr \rv, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address) 19 ldr \rv, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address)
20 .endm 20 .endm
21 21
22 .macro senduart,rd,rx 22 .macro senduart,rd,rx
23 strb \rd, [\rx, #(AT91_DBGU_THR - AT91_DBGU)] @ Write to Transmitter Holding Register 23 strb \rd, [\rx, #(AT91_DBGU_THR)] @ Write to Transmitter Holding Register
24 .endm 24 .endm
25 25
26 .macro waituart,rd,rx 26 .macro waituart,rd,rx
271001: ldr \rd, [\rx, #(AT91_DBGU_SR - AT91_DBGU)] @ Read Status Register 271001: ldr \rd, [\rx, #(AT91_DBGU_SR)] @ Read Status Register
28 tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit 28 tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit
29 beq 1001b 29 beq 1001b
30 .endm 30 .endm
31 31
32 .macro busyuart,rd,rx 32 .macro busyuart,rd,rx
331001: ldr \rd, [\rx, #(AT91_DBGU_SR - AT91_DBGU)] @ Read Status Register 331001: ldr \rd, [\rx, #(AT91_DBGU_SR)] @ Read Status Register
34 tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete 34 tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete
35 beq 1001b 35 beq 1001b
36 .endm 36 .endm
37 37
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index 1008b9fb507..483478d8be6 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -36,6 +36,20 @@
36#error "Unsupported AT91 processor" 36#error "Unsupported AT91 processor"
37#endif 37#endif
38 38
39#if !defined(CONFIG_ARCH_AT91X40)
40/*
41 * On all at91 except rm9200 and x40 have the System Controller starts
42 * at address 0xffffc000 and has a size of 16KiB.
43 *
44 * On rm9200 it's start at 0xfffe4000 of 111KiB with non reserved data starting
45 * at 0xfffff000
46 *
47 * Removes the individual definitions of AT91_BASE_SYS and
48 * replaces them with a common version at base 0xfffffc000 and size 16KiB
49 * and map the same memory space
50 */
51#define AT91_BASE_SYS 0xffffc000
52#endif
39 53
40/* 54/*
41 * Peripheral identifiers/interrupts. 55 * Peripheral identifiers/interrupts.
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h
index 0b0cccc46e6..4298e7806c7 100644
--- a/arch/arm/mach-at91/include/mach/io.h
+++ b/arch/arm/mach-at91/include/mach/io.h
@@ -21,14 +21,23 @@
21#ifndef __ASM_ARCH_IO_H 21#ifndef __ASM_ARCH_IO_H
22#define __ASM_ARCH_IO_H 22#define __ASM_ARCH_IO_H
23 23
24#include <mach/hardware.h>
25
24#define IO_SPACE_LIMIT 0xFFFFFFFF 26#define IO_SPACE_LIMIT 0xFFFFFFFF
25 27
26#define __io(a) __typesafe_io(a) 28#define __io(a) __typesafe_io(a)
27#define __mem_pci(a) (a) 29#define __mem_pci(a) (a)
28 30
29
30#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
31 32
33#ifndef CONFIG_ARCH_AT91X40
34#define __arch_ioremap at91_ioremap
35#define __arch_iounmap at91_iounmap
36#endif
37
38void __iomem *at91_ioremap(unsigned long phys, size_t size, unsigned int type);
39void at91_iounmap(volatile void __iomem *addr);
40
32static inline unsigned int at91_sys_read(unsigned int reg_offset) 41static inline unsigned int at91_sys_read(unsigned int reg_offset)
33{ 42{
34 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS; 43 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index ea53f4d9b28..4159eca7894 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -20,7 +20,7 @@
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/atomic.h> 23#include <linux/atomic.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26 26
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
new file mode 100644
index 00000000000..aa64294c7db
--- /dev/null
+++ b/arch/arm/mach-at91/setup.c
@@ -0,0 +1,297 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation.
3 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
4 *
5 * Under GPLv2
6 */
7
8#include <linux/module.h>
9#include <linux/io.h>
10#include <linux/mm.h>
11
12#include <asm/mach/map.h>
13
14#include <mach/hardware.h>
15#include <mach/cpu.h>
16#include <mach/at91_dbgu.h>
17#include <mach/at91_pmc.h>
18
19#include "soc.h"
20#include "generic.h"
21
22struct at91_init_soc __initdata at91_boot_soc;
23
24struct at91_socinfo at91_soc_initdata;
25EXPORT_SYMBOL(at91_soc_initdata);
26
27void __init at91rm9200_set_type(int type)
28{
29 if (type == ARCH_REVISON_9200_PQFP)
30 at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
31 else
32 at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP;
33}
34
35void __init at91_init_irq_default(void)
36{
37 at91_init_interrupts(at91_boot_soc.default_irq_priority);
38}
39
40void __init at91_init_interrupts(unsigned int *priority)
41{
42 /* Initialize the AIC interrupt controller */
43 at91_aic_init(priority);
44
45 /* Enable GPIO interrupts */
46 at91_gpio_irq_setup();
47}
48
49static struct map_desc sram_desc[2] __initdata;
50
51void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
52{
53 struct map_desc *desc = &sram_desc[bank];
54
55 desc->virtual = AT91_IO_VIRT_BASE - length;
56 if (bank > 0)
57 desc->virtual -= sram_desc[bank - 1].length;
58
59 desc->pfn = __phys_to_pfn(base);
60 desc->length = length;
61 desc->type = MT_DEVICE;
62
63 pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n",
64 base, length, desc->virtual);
65
66 iotable_init(desc, 1);
67}
68
69static struct map_desc at91_io_desc __initdata = {
70 .virtual = AT91_VA_BASE_SYS,
71 .pfn = __phys_to_pfn(AT91_BASE_SYS),
72 .length = SZ_16K,
73 .type = MT_DEVICE,
74};
75
76void __iomem *at91_ioremap(unsigned long p, size_t size, unsigned int type)
77{
78 if (p >= AT91_BASE_SYS && p <= (AT91_BASE_SYS + SZ_16K - 1))
79 return (void __iomem *)AT91_IO_P2V(p);
80
81 return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
82}
83EXPORT_SYMBOL(at91_ioremap);
84
85void at91_iounmap(volatile void __iomem *addr)
86{
87 unsigned long virt = (unsigned long)addr;
88
89 if (virt >= VMALLOC_START && virt < VMALLOC_END)
90 __iounmap(addr);
91}
92EXPORT_SYMBOL(at91_iounmap);
93
94#define AT91_DBGU0 0xfffff200
95#define AT91_DBGU1 0xffffee00
96
97static void __init soc_detect(u32 dbgu_base)
98{
99 u32 cidr, socid;
100
101 cidr = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_CIDR);
102 socid = cidr & ~AT91_CIDR_VERSION;
103
104 switch (socid) {
105 case ARCH_ID_AT91CAP9: {
106#ifdef CONFIG_AT91_PMC_UNIT
107 u32 pmc_ver = at91_sys_read(AT91_PMC_VER);
108
109 if (pmc_ver == ARCH_REVISION_CAP9_B)
110 at91_soc_initdata.subtype = AT91_SOC_CAP9_REV_B;
111 else if (pmc_ver == ARCH_REVISION_CAP9_C)
112 at91_soc_initdata.subtype = AT91_SOC_CAP9_REV_C;
113#endif
114 at91_soc_initdata.type = AT91_SOC_CAP9;
115 at91_boot_soc = at91cap9_soc;
116 break;
117 }
118
119 case ARCH_ID_AT91RM9200:
120 at91_soc_initdata.type = AT91_SOC_RM9200;
121 at91_boot_soc = at91rm9200_soc;
122 break;
123
124 case ARCH_ID_AT91SAM9260:
125 at91_soc_initdata.type = AT91_SOC_SAM9260;
126 at91_boot_soc = at91sam9260_soc;
127 break;
128
129 case ARCH_ID_AT91SAM9261:
130 at91_soc_initdata.type = AT91_SOC_SAM9261;
131 at91_boot_soc = at91sam9261_soc;
132 break;
133
134 case ARCH_ID_AT91SAM9263:
135 at91_soc_initdata.type = AT91_SOC_SAM9263;
136 at91_boot_soc = at91sam9263_soc;
137 break;
138
139 case ARCH_ID_AT91SAM9G20:
140 at91_soc_initdata.type = AT91_SOC_SAM9G20;
141 at91_boot_soc = at91sam9260_soc;
142 break;
143
144 case ARCH_ID_AT91SAM9G45:
145 at91_soc_initdata.type = AT91_SOC_SAM9G45;
146 if (cidr == ARCH_ID_AT91SAM9G45ES)
147 at91_soc_initdata.subtype = AT91_SOC_SAM9G45ES;
148 at91_boot_soc = at91sam9g45_soc;
149 break;
150
151 case ARCH_ID_AT91SAM9RL64:
152 at91_soc_initdata.type = AT91_SOC_SAM9RL;
153 at91_boot_soc = at91sam9rl_soc;
154 break;
155
156 case ARCH_ID_AT91SAM9X5:
157 at91_soc_initdata.type = AT91_SOC_SAM9X5;
158 at91_boot_soc = at91sam9x5_soc;
159 break;
160 }
161
162 /* at91sam9g10 */
163 if ((cidr & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) {
164 at91_soc_initdata.type = AT91_SOC_SAM9G10;
165 at91_boot_soc = at91sam9261_soc;
166 }
167 /* at91sam9xe */
168 else if ((cidr & AT91_CIDR_ARCH) == ARCH_FAMILY_AT91SAM9XE) {
169 at91_soc_initdata.type = AT91_SOC_SAM9260;
170 at91_soc_initdata.subtype = AT91_SOC_SAM9XE;
171 at91_boot_soc = at91sam9260_soc;
172 }
173
174 if (!at91_soc_is_detected())
175 return;
176
177 at91_soc_initdata.cidr = cidr;
178
179 /* sub version of soc */
180 at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
181
182 if (at91_soc_initdata.type == AT91_SOC_SAM9G45) {
183 switch (at91_soc_initdata.exid) {
184 case ARCH_EXID_AT91SAM9M10:
185 at91_soc_initdata.subtype = AT91_SOC_SAM9M10;
186 break;
187 case ARCH_EXID_AT91SAM9G46:
188 at91_soc_initdata.subtype = AT91_SOC_SAM9G46;
189 break;
190 case ARCH_EXID_AT91SAM9M11:
191 at91_soc_initdata.subtype = AT91_SOC_SAM9M11;
192 break;
193 }
194 }
195
196 if (at91_soc_initdata.type == AT91_SOC_SAM9X5) {
197 switch (at91_soc_initdata.exid) {
198 case ARCH_EXID_AT91SAM9G15:
199 at91_soc_initdata.subtype = AT91_SOC_SAM9G15;
200 break;
201 case ARCH_EXID_AT91SAM9G35:
202 at91_soc_initdata.subtype = AT91_SOC_SAM9G35;
203 break;
204 case ARCH_EXID_AT91SAM9X35:
205 at91_soc_initdata.subtype = AT91_SOC_SAM9X35;
206 break;
207 case ARCH_EXID_AT91SAM9G25:
208 at91_soc_initdata.subtype = AT91_SOC_SAM9G25;
209 break;
210 case ARCH_EXID_AT91SAM9X25:
211 at91_soc_initdata.subtype = AT91_SOC_SAM9X25;
212 break;
213 }
214 }
215}
216
217static const char *soc_name[] = {
218 [AT91_SOC_RM9200] = "at91rm9200",
219 [AT91_SOC_CAP9] = "at91cap9",
220 [AT91_SOC_SAM9260] = "at91sam9260",
221 [AT91_SOC_SAM9261] = "at91sam9261",
222 [AT91_SOC_SAM9263] = "at91sam9263",
223 [AT91_SOC_SAM9G10] = "at91sam9g10",
224 [AT91_SOC_SAM9G20] = "at91sam9g20",
225 [AT91_SOC_SAM9G45] = "at91sam9g45",
226 [AT91_SOC_SAM9RL] = "at91sam9rl",
227 [AT91_SOC_SAM9X5] = "at91sam9x5",
228 [AT91_SOC_NONE] = "Unknown"
229};
230
231const char *at91_get_soc_type(struct at91_socinfo *c)
232{
233 return soc_name[c->type];
234}
235EXPORT_SYMBOL(at91_get_soc_type);
236
237static const char *soc_subtype_name[] = {
238 [AT91_SOC_RM9200_BGA] = "at91rm9200 BGA",
239 [AT91_SOC_RM9200_PQFP] = "at91rm9200 PQFP",
240 [AT91_SOC_CAP9_REV_B] = "at91cap9 revB",
241 [AT91_SOC_CAP9_REV_C] = "at91cap9 revC",
242 [AT91_SOC_SAM9XE] = "at91sam9xe",
243 [AT91_SOC_SAM9G45ES] = "at91sam9g45es",
244 [AT91_SOC_SAM9M10] = "at91sam9m10",
245 [AT91_SOC_SAM9G46] = "at91sam9g46",
246 [AT91_SOC_SAM9M11] = "at91sam9m11",
247 [AT91_SOC_SAM9G15] = "at91sam9g15",
248 [AT91_SOC_SAM9G35] = "at91sam9g35",
249 [AT91_SOC_SAM9X35] = "at91sam9x35",
250 [AT91_SOC_SAM9G25] = "at91sam9g25",
251 [AT91_SOC_SAM9X25] = "at91sam9x25",
252 [AT91_SOC_SUBTYPE_NONE] = "Unknown"
253};
254
255const char *at91_get_soc_subtype(struct at91_socinfo *c)
256{
257 return soc_subtype_name[c->subtype];
258}
259EXPORT_SYMBOL(at91_get_soc_subtype);
260
261void __init at91_map_io(void)
262{
263 /* Map peripherals */
264 iotable_init(&at91_io_desc, 1);
265
266 at91_soc_initdata.type = AT91_SOC_NONE;
267 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE;
268
269 soc_detect(AT91_DBGU0);
270 if (!at91_soc_is_detected())
271 soc_detect(AT91_DBGU1);
272
273 if (!at91_soc_is_detected())
274 panic("AT91: Impossible to detect the SOC type");
275
276 pr_info("AT91: Detected soc type: %s\n",
277 at91_get_soc_type(&at91_soc_initdata));
278 pr_info("AT91: Detected soc subtype: %s\n",
279 at91_get_soc_subtype(&at91_soc_initdata));
280
281 if (!at91_soc_is_enabled())
282 panic("AT91: Soc not enabled");
283
284 if (at91_boot_soc.map_io)
285 at91_boot_soc.map_io();
286}
287
288void __init at91_initialize(unsigned long main_clock)
289{
290 /* Init clock subsystem */
291 at91_clock_init(main_clock);
292
293 /* Register the processor-specific clocks */
294 at91_boot_soc.register_clocks();
295
296 at91_boot_soc.init();
297}
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
new file mode 100644
index 00000000000..21ed8816e6f
--- /dev/null
+++ b/arch/arm/mach-at91/soc.h
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
3 *
4 * Under GPLv2
5 */
6
7struct at91_init_soc {
8 unsigned int *default_irq_priority;
9 void (*map_io)(void);
10 void (*register_clocks)(void);
11 void (*init)(void);
12};
13
14extern struct at91_init_soc at91_boot_soc;
15extern struct at91_init_soc at91cap9_soc;
16extern struct at91_init_soc at91rm9200_soc;
17extern struct at91_init_soc at91sam9260_soc;
18extern struct at91_init_soc at91sam9261_soc;
19extern struct at91_init_soc at91sam9263_soc;
20extern struct at91_init_soc at91sam9g45_soc;
21extern struct at91_init_soc at91sam9rl_soc;
22extern struct at91_init_soc at91sam9x5_soc;
23
24static inline int at91_soc_is_enabled(void)
25{
26 return at91_boot_soc.init != NULL;
27}
28
29#if !defined(CONFIG_ARCH_AT91CAP9)
30#define at91cap9_soc at91_boot_soc
31#endif
32
33#if !defined(CONFIG_ARCH_AT91RM9200)
34#define at91rm9200_soc at91_boot_soc
35#endif
36
37#if !(defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20))
38#define at91sam9260_soc at91_boot_soc
39#endif
40
41#if !(defined(CONFIG_ARCH_AT91SAM9261) || defined(CONFIG_ARCH_AT91SAM9G10))
42#define at91sam9261_soc at91_boot_soc
43#endif
44
45#if !defined(CONFIG_ARCH_AT91SAM9263)
46#define at91sam9263_soc at91_boot_soc
47#endif
48
49#if !defined(CONFIG_ARCH_AT91SAM9G45)
50#define at91sam9g45_soc at91_boot_soc
51#endif
52
53#if !defined(CONFIG_ARCH_AT91SAM9RL)
54#define at91sam9rl_soc at91_boot_soc
55#endif
56
57#if !defined(CONFIG_ARCH_AT91SAM9X5)
58#define at91sam9x5_soc at91_boot_soc
59#endif
diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c
index 9f2a948e0e7..0ca00050666 100644
--- a/arch/arm/mach-bcmring/dma.c
+++ b/arch/arm/mach-bcmring/dma.c
@@ -34,7 +34,7 @@
34 34
35#include <linux/mm.h> 35#include <linux/mm.h>
36#include <linux/pfn.h> 36#include <linux/pfn.h>
37#include <asm/atomic.h> 37#include <linux/atomic.h>
38#include <mach/dma.h> 38#include <mach/dma.h>
39 39
40/* I don't quite understand why dc4 fails when this is set to 1 and DMA is enabled */ 40/* I don't quite understand why dc4 fails when this is set to 1 and DMA is enabled */
diff --git a/arch/arm/mach-bcmring/include/mach/clkdev.h b/arch/arm/mach-bcmring/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/mach-bcmring/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-bcmring/include/mach/hardware.h b/arch/arm/mach-bcmring/include/mach/hardware.h
index 8bf3564fba5..ed78aabb8e9 100644
--- a/arch/arm/mach-bcmring/include/mach/hardware.h
+++ b/arch/arm/mach-bcmring/include/mach/hardware.h
@@ -36,8 +36,6 @@
36#define RAM_SIZE (CFG_GLOBAL_RAM_SIZE-CFG_GLOBAL_RAM_SIZE_RESERVED) 36#define RAM_SIZE (CFG_GLOBAL_RAM_SIZE-CFG_GLOBAL_RAM_SIZE_RESERVED)
37#define RAM_BASE PAGE_OFFSET 37#define RAM_BASE PAGE_OFFSET
38 38
39#define pcibios_assign_all_busses() 1
40
41/* Macros to make managing spinlocks a bit more controlled in terms of naming. */ 39/* Macros to make managing spinlocks a bit more controlled in terms of naming. */
42/* See reg_gpio.h, reg_irq.h, arch.c, gpio.c for example usage. */ 40/* See reg_gpio.h, reg_irq.h, arch.c, gpio.c for example usage. */
43#if defined(__KERNEL__) 41#if defined(__KERNEL__)
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 08e5c875950..3e7d1496cb4 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -29,7 +29,6 @@
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <asm/mach/time.h> 31#include <asm/mach/time.h>
32#include <mach/hardware.h>
33#include <mach/cns3xxx.h> 32#include <mach/cns3xxx.h>
34#include <mach/irqs.h> 33#include <mach/irqs.h>
35#include "core.h" 34#include "core.h"
@@ -170,6 +169,8 @@ static struct platform_device *cns3420_pdevs[] __initdata = {
170 169
171static void __init cns3420_init(void) 170static void __init cns3420_init(void)
172{ 171{
172 cns3xxx_l2x0_init();
173
173 platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs)); 174 platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs));
174 175
175 cns3xxx_ahci_init(); 176 cns3xxx_ahci_init();
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
index da30078a80c..941a308e125 100644
--- a/arch/arm/mach-cns3xxx/core.c
+++ b/arch/arm/mach-cns3xxx/core.c
@@ -16,6 +16,7 @@
16#include <asm/mach/time.h> 16#include <asm/mach/time.h>
17#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
18#include <asm/hardware/gic.h> 18#include <asm/hardware/gic.h>
19#include <asm/hardware/cache-l2x0.h>
19#include <mach/cns3xxx.h> 20#include <mach/cns3xxx.h>
20#include "core.h" 21#include "core.h"
21 22
@@ -244,3 +245,45 @@ static void __init cns3xxx_timer_init(void)
244struct sys_timer cns3xxx_timer = { 245struct sys_timer cns3xxx_timer = {
245 .init = cns3xxx_timer_init, 246 .init = cns3xxx_timer_init,
246}; 247};
248
249#ifdef CONFIG_CACHE_L2X0
250
251void __init cns3xxx_l2x0_init(void)
252{
253 void __iomem *base = ioremap(CNS3XXX_L2C_BASE, SZ_4K);
254 u32 val;
255
256 if (WARN_ON(!base))
257 return;
258
259 /*
260 * Tag RAM Control register
261 *
262 * bit[10:8] - 1 cycle of write accesses latency
263 * bit[6:4] - 1 cycle of read accesses latency
264 * bit[3:0] - 1 cycle of setup latency
265 *
266 * 1 cycle of latency for setup, read and write accesses
267 */
268 val = readl(base + L2X0_TAG_LATENCY_CTRL);
269 val &= 0xfffff888;
270 writel(val, base + L2X0_TAG_LATENCY_CTRL);
271
272 /*
273 * Data RAM Control register
274 *
275 * bit[10:8] - 1 cycles of write accesses latency
276 * bit[6:4] - 1 cycles of read accesses latency
277 * bit[3:0] - 1 cycle of setup latency
278 *
279 * 1 cycle of latency for setup, read and write accesses
280 */
281 val = readl(base + L2X0_DATA_LATENCY_CTRL);
282 val &= 0xfffff888;
283 writel(val, base + L2X0_DATA_LATENCY_CTRL);
284
285 /* 32 KiB, 8-way, parity disable */
286 l2x0_init(base, 0x00540000, 0xfe000fff);
287}
288
289#endif /* CONFIG_CACHE_L2X0 */
diff --git a/arch/arm/mach-cns3xxx/core.h b/arch/arm/mach-cns3xxx/core.h
index ffeb3a8b73b..fcd225343c6 100644
--- a/arch/arm/mach-cns3xxx/core.h
+++ b/arch/arm/mach-cns3xxx/core.h
@@ -13,6 +13,12 @@
13 13
14extern struct sys_timer cns3xxx_timer; 14extern struct sys_timer cns3xxx_timer;
15 15
16#ifdef CONFIG_CACHE_L2X0
17void __init cns3xxx_l2x0_init(void);
18#else
19static inline void cns3xxx_l2x0_init(void) {}
20#endif /* CONFIG_CACHE_L2X0 */
21
16void __init cns3xxx_map_io(void); 22void __init cns3xxx_map_io(void);
17void __init cns3xxx_init_irq(void); 23void __init cns3xxx_init_irq(void);
18void cns3xxx_power_off(void); 24void cns3xxx_power_off(void);
diff --git a/arch/arm/mach-cns3xxx/include/mach/entry-macro.S b/arch/arm/mach-cns3xxx/include/mach/entry-macro.S
index 6bd83ed90af..d87bfc397d3 100644
--- a/arch/arm/mach-cns3xxx/include/mach/entry-macro.S
+++ b/arch/arm/mach-cns3xxx/include/mach/entry-macro.S
@@ -8,7 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <mach/hardware.h>
12#include <asm/hardware/entry-macro-gic.S> 11#include <asm/hardware/entry-macro-gic.S>
13 12
14 .macro disable_fiq 13 .macro disable_fiq
diff --git a/arch/arm/mach-cns3xxx/include/mach/hardware.h b/arch/arm/mach-cns3xxx/include/mach/hardware.h
deleted file mode 100644
index 57e09836f9d..00000000000
--- a/arch/arm/mach-cns3xxx/include/mach/hardware.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * This file contains the hardware definitions of the Cavium Networks boards.
3 *
4 * Copyright 2003 ARM Limited.
5 * Copyright 2008 Cavium Networks
6 *
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License, Version 2, as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __MACH_HARDWARE_H
13#define __MACH_HARDWARE_H
14
15#include <asm/sizes.h>
16
17/* macro to get at IO space when running virtually */
18#define PCIBIOS_MIN_IO 0x00000000
19#define PCIBIOS_MIN_MEM 0x00000000
20#define pcibios_assign_all_busses() 1
21
22#endif
diff --git a/arch/arm/mach-cns3xxx/include/mach/pm.h b/arch/arm/mach-cns3xxx/include/mach/pm.h
index 6eae7f764d1..c2588cc991d 100644
--- a/arch/arm/mach-cns3xxx/include/mach/pm.h
+++ b/arch/arm/mach-cns3xxx/include/mach/pm.h
@@ -11,7 +11,7 @@
11#ifndef __CNS3XXX_PM_H 11#ifndef __CNS3XXX_PM_H
12#define __CNS3XXX_PM_H 12#define __CNS3XXX_PM_H
13 13
14#include <asm/atomic.h> 14#include <linux/atomic.h>
15 15
16void cns3xxx_pwr_clk_en(unsigned int block); 16void cns3xxx_pwr_clk_en(unsigned int block);
17void cns3xxx_pwr_clk_dis(unsigned int block); 17void cns3xxx_pwr_clk_dis(unsigned int block);
diff --git a/arch/arm/mach-cns3xxx/include/mach/system.h b/arch/arm/mach-cns3xxx/include/mach/system.h
index 58bb03ae3cf..4f16c9b79f7 100644
--- a/arch/arm/mach-cns3xxx/include/mach/system.h
+++ b/arch/arm/mach-cns3xxx/include/mach/system.h
@@ -13,7 +13,6 @@
13 13
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/proc-fns.h> 15#include <asm/proc-fns.h>
16#include <mach/hardware.h>
17 16
18static inline void arch_idle(void) 17static inline void arch_idle(void)
19{ 18{
diff --git a/arch/arm/mach-cns3xxx/include/mach/uncompress.h b/arch/arm/mach-cns3xxx/include/mach/uncompress.h
index de8ead9b91f..a91b6058ab4 100644
--- a/arch/arm/mach-cns3xxx/include/mach/uncompress.h
+++ b/arch/arm/mach-cns3xxx/include/mach/uncompress.h
@@ -8,7 +8,6 @@
8 */ 8 */
9 9
10#include <asm/mach-types.h> 10#include <asm/mach-types.h>
11#include <mach/hardware.h>
12#include <mach/cns3xxx.h> 11#include <mach/cns3xxx.h>
13 12
14#define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00)) 13#define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00))
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c
index 78defd71a82..0f8fca48a5e 100644
--- a/arch/arm/mach-cns3xxx/pcie.c
+++ b/arch/arm/mach-cns3xxx/pcie.c
@@ -49,7 +49,7 @@ static struct cns3xxx_pcie *sysdata_to_cnspci(void *sysdata)
49 return &cns3xxx_pcie[root->domain]; 49 return &cns3xxx_pcie[root->domain];
50} 50}
51 51
52static struct cns3xxx_pcie *pdev_to_cnspci(struct pci_dev *dev) 52static struct cns3xxx_pcie *pdev_to_cnspci(const struct pci_dev *dev)
53{ 53{
54 return sysdata_to_cnspci(dev->sysdata); 54 return sysdata_to_cnspci(dev->sysdata);
55} 55}
@@ -172,7 +172,7 @@ static struct pci_bus *cns3xxx_pci_scan_bus(int nr, struct pci_sys_data *sys)
172 return pci_scan_bus(sys->busnr, &cns3xxx_pcie_ops, sys); 172 return pci_scan_bus(sys->busnr, &cns3xxx_pcie_ops, sys);
173} 173}
174 174
175static int cns3xxx_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 175static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
176{ 176{
177 struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev); 177 struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev);
178 int irq = cnspci->irqs[slot]; 178 int irq = cnspci->irqs[slot];
@@ -369,6 +369,9 @@ static int __init cns3xxx_pcie_init(void)
369{ 369{
370 int i; 370 int i;
371 371
372 pcibios_min_io = 0;
373 pcibios_min_mem = 0;
374
372 hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 0, 375 hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 0,
373 "imprecise external abort"); 376 "imprecise external abort");
374 377
diff --git a/arch/arm/mach-cns3xxx/pm.c b/arch/arm/mach-cns3xxx/pm.c
index 5e579552aa5..0c04678615c 100644
--- a/arch/arm/mach-cns3xxx/pm.c
+++ b/arch/arm/mach-cns3xxx/pm.c
@@ -10,7 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <asm/atomic.h> 13#include <linux/atomic.h>
14#include <mach/system.h> 14#include <mach/system.h>
15#include <mach/cns3xxx.h> 15#include <mach/cns3xxx.h>
16#include <mach/pm.h> 16#include <mach/pm.h>
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 29671ef0715..008d51407cd 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -115,6 +115,32 @@ static struct spi_board_info da850evm_spi_info[] = {
115 }, 115 },
116}; 116};
117 117
118#ifdef CONFIG_MTD
119static void da850_evm_m25p80_notify_add(struct mtd_info *mtd)
120{
121 char *mac_addr = davinci_soc_info.emac_pdata->mac_addr;
122 size_t retlen;
123
124 if (!strcmp(mtd->name, "MAC-Address")) {
125 mtd->read(mtd, 0, ETH_ALEN, &retlen, mac_addr);
126 if (retlen == ETH_ALEN)
127 pr_info("Read MAC addr from SPI Flash: %pM\n",
128 mac_addr);
129 }
130}
131
132static struct mtd_notifier da850evm_spi_notifier = {
133 .add = da850_evm_m25p80_notify_add,
134};
135
136static void da850_evm_setup_mac_addr(void)
137{
138 register_mtd_user(&da850evm_spi_notifier);
139}
140#else
141static void da850_evm_setup_mac_addr(void) { }
142#endif
143
118static struct mtd_partition da850_evm_norflash_partition[] = { 144static struct mtd_partition da850_evm_norflash_partition[] = {
119 { 145 {
120 .name = "bootloaders + env", 146 .name = "bootloaders + env",
@@ -1117,6 +1143,8 @@ static __init int da850_evm_init_cpufreq(void)
1117static __init int da850_evm_init_cpufreq(void) { return 0; } 1143static __init int da850_evm_init_cpufreq(void) { return 0; }
1118#endif 1144#endif
1119 1145
1146#define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000)
1147
1120static __init void da850_evm_init(void) 1148static __init void da850_evm_init(void)
1121{ 1149{
1122 int ret; 1150 int ret;
@@ -1237,6 +1265,13 @@ static __init void da850_evm_init(void)
1237 if (ret) 1265 if (ret)
1238 pr_warning("da850_evm_init: spi 1 registration failed: %d\n", 1266 pr_warning("da850_evm_init: spi 1 registration failed: %d\n",
1239 ret); 1267 ret);
1268
1269 ret = da850_register_sata(DA850EVM_SATA_REFCLKPN_RATE);
1270 if (ret)
1271 pr_warning("da850_evm_init: sata registration failed: %d\n",
1272 ret);
1273
1274 da850_evm_setup_mac_addr();
1240} 1275}
1241 1276
1242#ifdef CONFIG_SERIAL_8250_CONSOLE 1277#ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index ae653194b64..00861139101 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -44,7 +44,7 @@ static void __clk_enable(struct clk *clk)
44 __clk_enable(clk->parent); 44 __clk_enable(clk->parent);
45 if (clk->usecount++ == 0 && (clk->flags & CLK_PSC)) 45 if (clk->usecount++ == 0 && (clk->flags & CLK_PSC))
46 davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc, 46 davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc,
47 PSC_STATE_ENABLE); 47 true, clk->flags);
48} 48}
49 49
50static void __clk_disable(struct clk *clk) 50static void __clk_disable(struct clk *clk)
@@ -54,8 +54,7 @@ static void __clk_disable(struct clk *clk)
54 if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) && 54 if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) &&
55 (clk->flags & CLK_PSC)) 55 (clk->flags & CLK_PSC))
56 davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc, 56 davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc,
57 (clk->flags & PSC_SWRSTDISABLE) ? 57 false, clk->flags);
58 PSC_STATE_SWRSTDISABLE : PSC_STATE_DISABLE);
59 if (clk->parent) 58 if (clk->parent)
60 __clk_disable(clk->parent); 59 __clk_disable(clk->parent);
61} 60}
@@ -239,8 +238,7 @@ static int __init clk_disable_unused(void)
239 pr_debug("Clocks: disable unused %s\n", ck->name); 238 pr_debug("Clocks: disable unused %s\n", ck->name);
240 239
241 davinci_psc_config(psc_domain(ck), ck->gpsc, ck->lpsc, 240 davinci_psc_config(psc_domain(ck), ck->gpsc, ck->lpsc,
242 (ck->flags & PSC_SWRSTDISABLE) ? 241 false, ck->flags);
243 PSC_STATE_SWRSTDISABLE : PSC_STATE_DISABLE);
244 } 242 }
245 spin_unlock_irq(&clockfw_lock); 243 spin_unlock_irq(&clockfw_lock);
246 244
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index 50b2482e0ba..a705f367a84 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -111,6 +111,7 @@ struct clk {
111#define CLK_PLL BIT(4) /* PLL-derived clock */ 111#define CLK_PLL BIT(4) /* PLL-derived clock */
112#define PRE_PLL BIT(5) /* source is before PLL mult/div */ 112#define PRE_PLL BIT(5) /* source is before PLL mult/div */
113#define PSC_SWRSTDISABLE BIT(6) /* Disable state is SwRstDisable */ 113#define PSC_SWRSTDISABLE BIT(6) /* Disable state is SwRstDisable */
114#define PSC_FORCE BIT(7) /* Force module state transtition */
114 115
115#define CLK(dev, con, ck) \ 116#define CLK(dev, con, ck) \
116 { \ 117 { \
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 133aac40585..935dbed5c54 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -58,6 +58,7 @@ static struct pll_data pll0_data = {
58static struct clk ref_clk = { 58static struct clk ref_clk = {
59 .name = "ref_clk", 59 .name = "ref_clk",
60 .rate = DA850_REF_FREQ, 60 .rate = DA850_REF_FREQ,
61 .set_rate = davinci_simple_set_rate,
61}; 62};
62 63
63static struct clk pll0_clk = { 64static struct clk pll0_clk = {
@@ -373,6 +374,14 @@ static struct clk spi1_clk = {
373 .flags = DA850_CLK_ASYNC3, 374 .flags = DA850_CLK_ASYNC3,
374}; 375};
375 376
377static struct clk sata_clk = {
378 .name = "sata",
379 .parent = &pll0_sysclk2,
380 .lpsc = DA850_LPSC1_SATA,
381 .gpsc = 1,
382 .flags = PSC_FORCE,
383};
384
376static struct clk_lookup da850_clks[] = { 385static struct clk_lookup da850_clks[] = {
377 CLK(NULL, "ref", &ref_clk), 386 CLK(NULL, "ref", &ref_clk),
378 CLK(NULL, "pll0", &pll0_clk), 387 CLK(NULL, "pll0", &pll0_clk),
@@ -419,6 +428,7 @@ static struct clk_lookup da850_clks[] = {
419 CLK(NULL, "usb20", &usb20_clk), 428 CLK(NULL, "usb20", &usb20_clk),
420 CLK("spi_davinci.0", NULL, &spi0_clk), 429 CLK("spi_davinci.0", NULL, &spi0_clk),
421 CLK("spi_davinci.1", NULL, &spi1_clk), 430 CLK("spi_davinci.1", NULL, &spi1_clk),
431 CLK("ahci", NULL, &sata_clk),
422 CLK(NULL, NULL, NULL), 432 CLK(NULL, NULL, NULL),
423}; 433};
424 434
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index fc4e98ea754..2f7e719636f 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -14,6 +14,8 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/ahci_platform.h>
18#include <linux/clk.h>
17 19
18#include <mach/cputype.h> 20#include <mach/cputype.h>
19#include <mach/common.h> 21#include <mach/common.h>
@@ -33,6 +35,7 @@
33#define DA8XX_SPI0_BASE 0x01c41000 35#define DA8XX_SPI0_BASE 0x01c41000
34#define DA830_SPI1_BASE 0x01e12000 36#define DA830_SPI1_BASE 0x01e12000
35#define DA8XX_LCD_CNTRL_BASE 0x01e13000 37#define DA8XX_LCD_CNTRL_BASE 0x01e13000
38#define DA850_SATA_BASE 0x01e18000
36#define DA850_MMCSD1_BASE 0x01e1b000 39#define DA850_MMCSD1_BASE 0x01e1b000
37#define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000 40#define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000
38#define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000 41#define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000
@@ -842,3 +845,126 @@ int __init da8xx_register_spi(int instance, struct spi_board_info *info,
842 845
843 return platform_device_register(&da8xx_spi_device[instance]); 846 return platform_device_register(&da8xx_spi_device[instance]);
844} 847}
848
849#ifdef CONFIG_ARCH_DAVINCI_DA850
850
851static struct resource da850_sata_resources[] = {
852 {
853 .start = DA850_SATA_BASE,
854 .end = DA850_SATA_BASE + 0x1fff,
855 .flags = IORESOURCE_MEM,
856 },
857 {
858 .start = IRQ_DA850_SATAINT,
859 .flags = IORESOURCE_IRQ,
860 },
861};
862
863/* SATA PHY Control Register offset from AHCI base */
864#define SATA_P0PHYCR_REG 0x178
865
866#define SATA_PHY_MPY(x) ((x) << 0)
867#define SATA_PHY_LOS(x) ((x) << 6)
868#define SATA_PHY_RXCDR(x) ((x) << 10)
869#define SATA_PHY_RXEQ(x) ((x) << 13)
870#define SATA_PHY_TXSWING(x) ((x) << 19)
871#define SATA_PHY_ENPLL(x) ((x) << 31)
872
873static struct clk *da850_sata_clk;
874static unsigned long da850_sata_refclkpn;
875
876/* Supported DA850 SATA crystal frequencies */
877#define KHZ_TO_HZ(freq) ((freq) * 1000)
878static unsigned long da850_sata_xtal[] = {
879 KHZ_TO_HZ(300000),
880 KHZ_TO_HZ(250000),
881 0, /* Reserved */
882 KHZ_TO_HZ(187500),
883 KHZ_TO_HZ(150000),
884 KHZ_TO_HZ(125000),
885 KHZ_TO_HZ(120000),
886 KHZ_TO_HZ(100000),
887 KHZ_TO_HZ(75000),
888 KHZ_TO_HZ(60000),
889};
890
891static int da850_sata_init(struct device *dev, void __iomem *addr)
892{
893 int i, ret;
894 unsigned int val;
895
896 da850_sata_clk = clk_get(dev, NULL);
897 if (IS_ERR(da850_sata_clk))
898 return PTR_ERR(da850_sata_clk);
899
900 ret = clk_enable(da850_sata_clk);
901 if (ret)
902 goto err0;
903
904 /* Enable SATA clock receiver */
905 val = __raw_readl(DA8XX_SYSCFG1_VIRT(DA8XX_PWRDN_REG));
906 val &= ~BIT(0);
907 __raw_writel(val, DA8XX_SYSCFG1_VIRT(DA8XX_PWRDN_REG));
908
909 /* Get the multiplier needed for 1.5GHz PLL output */
910 for (i = 0; i < ARRAY_SIZE(da850_sata_xtal); i++)
911 if (da850_sata_xtal[i] == da850_sata_refclkpn)
912 break;
913
914 if (i == ARRAY_SIZE(da850_sata_xtal)) {
915 ret = -EINVAL;
916 goto err1;
917 }
918
919 val = SATA_PHY_MPY(i + 1) |
920 SATA_PHY_LOS(1) |
921 SATA_PHY_RXCDR(4) |
922 SATA_PHY_RXEQ(1) |
923 SATA_PHY_TXSWING(3) |
924 SATA_PHY_ENPLL(1);
925
926 __raw_writel(val, addr + SATA_P0PHYCR_REG);
927
928 return 0;
929
930err1:
931 clk_disable(da850_sata_clk);
932err0:
933 clk_put(da850_sata_clk);
934 return ret;
935}
936
937static void da850_sata_exit(struct device *dev)
938{
939 clk_disable(da850_sata_clk);
940 clk_put(da850_sata_clk);
941}
942
943static struct ahci_platform_data da850_sata_pdata = {
944 .init = da850_sata_init,
945 .exit = da850_sata_exit,
946};
947
948static u64 da850_sata_dmamask = DMA_BIT_MASK(32);
949
950static struct platform_device da850_sata_device = {
951 .name = "ahci",
952 .id = -1,
953 .dev = {
954 .platform_data = &da850_sata_pdata,
955 .dma_mask = &da850_sata_dmamask,
956 .coherent_dma_mask = DMA_BIT_MASK(32),
957 },
958 .num_resources = ARRAY_SIZE(da850_sata_resources),
959 .resource = da850_sata_resources,
960};
961
962int __init da850_register_sata(unsigned long refclkpn)
963{
964 da850_sata_refclkpn = refclkpn;
965 if (!da850_sata_refclkpn)
966 return -EINVAL;
967
968 return platform_device_register(&da850_sata_device);
969}
970#endif
diff --git a/arch/arm/mach-davinci/include/mach/clkdev.h b/arch/arm/mach-davinci/include/mach/clkdev.h
deleted file mode 100644
index 14a50488718..00000000000
--- a/arch/arm/mach-davinci/include/mach/clkdev.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef __MACH_CLKDEV_H
2#define __MACH_CLKDEV_H
3
4struct clk;
5
6static inline int __clk_get(struct clk *clk)
7{
8 return 1;
9}
10
11static inline void __clk_put(struct clk *clk)
12{
13}
14
15#endif
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index ad64da713fc..eaca7d8b9d6 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -57,6 +57,7 @@ extern unsigned int da850_max_speed;
57#define DA8XX_SYSCFG1_BASE (IO_PHYS + 0x22C000) 57#define DA8XX_SYSCFG1_BASE (IO_PHYS + 0x22C000)
58#define DA8XX_SYSCFG1_VIRT(x) (da8xx_syscfg1_base + (x)) 58#define DA8XX_SYSCFG1_VIRT(x) (da8xx_syscfg1_base + (x))
59#define DA8XX_DEEPSLEEP_REG 0x8 59#define DA8XX_DEEPSLEEP_REG 0x8
60#define DA8XX_PWRDN_REG 0x18
60 61
61#define DA8XX_PSC0_BASE 0x01c10000 62#define DA8XX_PSC0_BASE 0x01c10000
62#define DA8XX_PLL0_BASE 0x01c11000 63#define DA8XX_PLL0_BASE 0x01c11000
@@ -89,6 +90,7 @@ int da850_register_cpufreq(char *async_clk);
89int da8xx_register_cpuidle(void); 90int da8xx_register_cpuidle(void);
90void __iomem * __init da8xx_get_mem_ctlr(void); 91void __iomem * __init da8xx_get_mem_ctlr(void);
91int da850_register_pm(struct platform_device *pdev); 92int da850_register_pm(struct platform_device *pdev);
93int __init da850_register_sata(unsigned long refclkpn);
92 94
93extern struct platform_device da8xx_serial_device; 95extern struct platform_device da8xx_serial_device;
94extern struct emac_platform_data da8xx_emac_pdata; 96extern struct emac_platform_data da8xx_emac_pdata;
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h
index 1110fdd77ba..fa59c097223 100644
--- a/arch/arm/mach-davinci/include/mach/psc.h
+++ b/arch/arm/mach-davinci/include/mach/psc.h
@@ -243,13 +243,14 @@
243#define PSC_STATE_DISABLE 2 243#define PSC_STATE_DISABLE 2
244#define PSC_STATE_ENABLE 3 244#define PSC_STATE_ENABLE 3
245 245
246#define MDSTAT_STATE_MASK 0x1f 246#define MDSTAT_STATE_MASK 0x3f
247#define MDCTL_FORCE BIT(31)
247 248
248#ifndef __ASSEMBLER__ 249#ifndef __ASSEMBLER__
249 250
250extern int davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id); 251extern int davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id);
251extern void davinci_psc_config(unsigned int domain, unsigned int ctlr, 252extern void davinci_psc_config(unsigned int domain, unsigned int ctlr,
252 unsigned int id, u32 next_state); 253 unsigned int id, bool enable, u32 flags);
253 254
254#endif 255#endif
255 256
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index a4158040070..1fb6bdff38c 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -25,6 +25,8 @@
25#include <mach/cputype.h> 25#include <mach/cputype.h>
26#include <mach/psc.h> 26#include <mach/psc.h>
27 27
28#include "clock.h"
29
28/* Return nonzero iff the domain's clock is active */ 30/* Return nonzero iff the domain's clock is active */
29int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) 31int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id)
30{ 32{
@@ -48,11 +50,12 @@ int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id)
48 50
49/* Enable or disable a PSC domain */ 51/* Enable or disable a PSC domain */
50void davinci_psc_config(unsigned int domain, unsigned int ctlr, 52void davinci_psc_config(unsigned int domain, unsigned int ctlr,
51 unsigned int id, u32 next_state) 53 unsigned int id, bool enable, u32 flags)
52{ 54{
53 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl; 55 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl;
54 void __iomem *psc_base; 56 void __iomem *psc_base;
55 struct davinci_soc_info *soc_info = &davinci_soc_info; 57 struct davinci_soc_info *soc_info = &davinci_soc_info;
58 u32 next_state = PSC_STATE_ENABLE;
56 59
57 if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { 60 if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) {
58 pr_warning("PSC: Bad psc data: 0x%x[%d]\n", 61 pr_warning("PSC: Bad psc data: 0x%x[%d]\n",
@@ -62,9 +65,18 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
62 65
63 psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K); 66 psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K);
64 67
68 if (!enable) {
69 if (flags & PSC_SWRSTDISABLE)
70 next_state = PSC_STATE_SWRSTDISABLE;
71 else
72 next_state = PSC_STATE_DISABLE;
73 }
74
65 mdctl = __raw_readl(psc_base + MDCTL + 4 * id); 75 mdctl = __raw_readl(psc_base + MDCTL + 4 * id);
66 mdctl &= ~MDSTAT_STATE_MASK; 76 mdctl &= ~MDSTAT_STATE_MASK;
67 mdctl |= next_state; 77 mdctl |= next_state;
78 if (flags & PSC_FORCE)
79 mdctl |= MDCTL_FORCE;
68 __raw_writel(mdctl, psc_base + MDCTL + 4 * id); 80 __raw_writel(mdctl, psc_base + MDCTL + 4 * id);
69 81
70 pdstat = __raw_readl(psc_base + PDSTAT); 82 pdstat = __raw_readl(psc_base + PDSTAT);
diff --git a/arch/arm/mach-davinci/sleep.S b/arch/arm/mach-davinci/sleep.S
index fb5e72b532b..5f1e045a3ad 100644
--- a/arch/arm/mach-davinci/sleep.S
+++ b/arch/arm/mach-davinci/sleep.S
@@ -217,7 +217,11 @@ ddr2clk_stop_done:
217ENDPROC(davinci_ddr_psc_config) 217ENDPROC(davinci_ddr_psc_config)
218 218
219CACHE_FLUSH: 219CACHE_FLUSH:
220 .word arm926_flush_kern_cache_all 220#ifdef CONFIG_CPU_V6
221 .word v6_flush_kern_cache_all
222#else
223 .word arm926_flush_kern_cache_all
224#endif
221 225
222ENTRY(davinci_cpu_suspend_sz) 226ENTRY(davinci_cpu_suspend_sz)
223 .word . - davinci_cpu_suspend 227 .word . - davinci_cpu_suspend
diff --git a/arch/arm/mach-dove/include/mach/hardware.h b/arch/arm/mach-dove/include/mach/hardware.h
index 32b0826e787..f1368b9a8ec 100644
--- a/arch/arm/mach-dove/include/mach/hardware.h
+++ b/arch/arm/mach-dove/include/mach/hardware.h
@@ -11,13 +11,6 @@
11 11
12#include "dove.h" 12#include "dove.h"
13 13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x1000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE DOVE_PCIE0_MEM_PHYS_BASE
19
20
21/* Macros below are required for compatibility with PXA AC'97 driver. */ 14/* Macros below are required for compatibility with PXA AC'97 driver. */
22#define __REG(x) (*((volatile u32 *)((x) - DOVE_SB_REGS_PHYS_BASE + \ 15#define __REG(x) (*((volatile u32 *)((x) - DOVE_SB_REGS_PHYS_BASE + \
23 DOVE_SB_REGS_VIRT_BASE))) 16 DOVE_SB_REGS_VIRT_BASE)))
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index 502d1ca2f4b..aa2b3a09a51 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <video/vga.h>
14#include <asm/mach/pci.h> 15#include <asm/mach/pci.h>
15#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
16#include <asm/setup.h> 17#include <asm/setup.h>
@@ -192,7 +193,7 @@ dove_pcie_scan_bus(int nr, struct pci_sys_data *sys)
192 return bus; 193 return bus;
193} 194}
194 195
195static int __init dove_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 196static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
196{ 197{
197 struct pcie_port *pp = bus_to_port(dev->bus->number); 198 struct pcie_port *pp = bus_to_port(dev->bus->number);
198 199
@@ -228,6 +229,8 @@ static void __init add_pcie_port(int index, unsigned long base)
228 229
229void __init dove_pcie_init(int init_port0, int init_port1) 230void __init dove_pcie_init(int init_port0, int init_port1)
230{ 231{
232 vga_base = DOVE_PCIE0_MEM_PHYS_BASE;
233
231 if (init_port0) 234 if (init_port0)
232 add_pcie_port(0, DOVE_PCIE0_VIRT_BASE); 235 add_pcie_port(0, DOVE_PCIE0_VIRT_BASE);
233 236
diff --git a/arch/arm/mach-ep93xx/include/mach/clkdev.h b/arch/arm/mach-ep93xx/include/mach/clkdev.h
deleted file mode 100644
index 50cb991eade..00000000000
--- a/arch/arm/mach-ep93xx/include/mach/clkdev.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/clkdev.h
3 */
4
5#ifndef __ASM_MACH_CLKDEV_H
6#define __ASM_MACH_CLKDEV_H
7
8#define __clk_get(clk) ({ 1; })
9#define __clk_put(clk) do { } while (0)
10
11#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/hardware.h b/arch/arm/mach-ep93xx/include/mach/hardware.h
index 5a3ce024b59..4df842897ea 100644
--- a/arch/arm/mach-ep93xx/include/mach/hardware.h
+++ b/arch/arm/mach-ep93xx/include/mach/hardware.h
@@ -8,8 +8,6 @@
8#include <mach/ep93xx-regs.h> 8#include <mach/ep93xx-regs.h>
9#include <mach/platform.h> 9#include <mach/platform.h>
10 10
11#define pcibios_assign_all_busses() 0
12
13/* 11/*
14 * The EP93xx has two external crystal oscillators. To generate the 12 * The EP93xx has two external crystal oscillators. To generate the
15 * required high-frequency clocks, the processor uses two phase-locked- 13 * required high-frequency clocks, the processor uses two phase-locked-
diff --git a/arch/arm/mach-ep93xx/include/mach/ts72xx.h b/arch/arm/mach-ep93xx/include/mach/ts72xx.h
index 0eabec62cd9..f1397a13e76 100644
--- a/arch/arm/mach-ep93xx/include/mach/ts72xx.h
+++ b/arch/arm/mach-ep93xx/include/mach/ts72xx.h
@@ -6,7 +6,7 @@
6 * TS72xx memory map: 6 * TS72xx memory map:
7 * 7 *
8 * virt phys size 8 * virt phys size
9 * febff000 22000000 4K model number register 9 * febff000 22000000 4K model number register (bits 0-2)
10 * febfe000 22400000 4K options register 10 * febfe000 22400000 4K options register
11 * febfd000 22800000 4K options register #2 11 * febfd000 22800000 4K options register #2
12 * febf9000 10800000 4K TS-5620 RTC index register 12 * febf9000 10800000 4K TS-5620 RTC index register
@@ -20,6 +20,9 @@
20#define TS72XX_MODEL_TS7200 0x00 20#define TS72XX_MODEL_TS7200 0x00
21#define TS72XX_MODEL_TS7250 0x01 21#define TS72XX_MODEL_TS7250 0x01
22#define TS72XX_MODEL_TS7260 0x02 22#define TS72XX_MODEL_TS7260 0x02
23#define TS72XX_MODEL_TS7300 0x03
24#define TS72XX_MODEL_TS7400 0x04
25#define TS72XX_MODEL_MASK 0x07
23 26
24 27
25#define TS72XX_OPTIONS_PHYS_BASE 0x22400000 28#define TS72XX_OPTIONS_PHYS_BASE 0x22400000
@@ -51,19 +54,34 @@
51 54
52#ifndef __ASSEMBLY__ 55#ifndef __ASSEMBLY__
53 56
57static inline int ts72xx_model(void)
58{
59 return __raw_readb(TS72XX_MODEL_VIRT_BASE) & TS72XX_MODEL_MASK;
60}
61
54static inline int board_is_ts7200(void) 62static inline int board_is_ts7200(void)
55{ 63{
56 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7200; 64 return ts72xx_model() == TS72XX_MODEL_TS7200;
57} 65}
58 66
59static inline int board_is_ts7250(void) 67static inline int board_is_ts7250(void)
60{ 68{
61 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7250; 69 return ts72xx_model() == TS72XX_MODEL_TS7250;
62} 70}
63 71
64static inline int board_is_ts7260(void) 72static inline int board_is_ts7260(void)
65{ 73{
66 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7260; 74 return ts72xx_model() == TS72XX_MODEL_TS7260;
75}
76
77static inline int board_is_ts7300(void)
78{
79 return ts72xx_model() == TS72XX_MODEL_TS7300;
80}
81
82static inline int board_is_ts7400(void)
83{
84 return ts72xx_model() == TS72XX_MODEL_TS7400;
67} 85}
68 86
69static inline int is_max197_installed(void) 87static inline int is_max197_installed(void)
diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index ae433a052df..0c77ab99fa1 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -16,7 +16,8 @@ config CPU_EXYNOS4210
16 Enable EXYNOS4210 CPU support 16 Enable EXYNOS4210 CPU support
17 17
18config EXYNOS4_MCT 18config EXYNOS4_MCT
19 bool "Kernel timer support by MCT" 19 bool
20 default y
20 help 21 help
21 Use MCT (Multi Core Timer) as kernel timers 22 Use MCT (Multi Core Timer) as kernel timers
22 23
@@ -25,6 +26,11 @@ config EXYNOS4_DEV_AHCI
25 help 26 help
26 Compile in platform device definitions for AHCI 27 Compile in platform device definitions for AHCI
27 28
29config EXYNOS4_SETUP_FIMD0
30 bool
31 help
32 Common setup code for FIMD0.
33
28config EXYNOS4_DEV_PD 34config EXYNOS4_DEV_PD
29 bool 35 bool
30 help 36 help
@@ -35,6 +41,11 @@ config EXYNOS4_DEV_SYSMMU
35 help 41 help
36 Common setup code for SYSTEM MMU in EXYNOS4 42 Common setup code for SYSTEM MMU in EXYNOS4
37 43
44config EXYNOS4_DEV_DWMCI
45 bool
46 help
47 Compile in platform device definitions for DWMCI
48
38config EXYNOS4_SETUP_I2C1 49config EXYNOS4_SETUP_I2C1
39 bool 50 bool
40 help 51 help
@@ -103,6 +114,7 @@ menu "EXYNOS4 Machines"
103config MACH_SMDKC210 114config MACH_SMDKC210
104 bool "SMDKC210" 115 bool "SMDKC210"
105 select CPU_EXYNOS4210 116 select CPU_EXYNOS4210
117 select S5P_DEV_FIMD0
106 select S3C_DEV_RTC 118 select S3C_DEV_RTC
107 select S3C_DEV_WDT 119 select S3C_DEV_WDT
108 select S3C_DEV_I2C1 120 select S3C_DEV_I2C1
@@ -114,6 +126,7 @@ config MACH_SMDKC210
114 select SAMSUNG_DEV_BACKLIGHT 126 select SAMSUNG_DEV_BACKLIGHT
115 select EXYNOS4_DEV_PD 127 select EXYNOS4_DEV_PD
116 select EXYNOS4_DEV_SYSMMU 128 select EXYNOS4_DEV_SYSMMU
129 select EXYNOS4_SETUP_FIMD0
117 select EXYNOS4_SETUP_I2C1 130 select EXYNOS4_SETUP_I2C1
118 select EXYNOS4_SETUP_SDHCI 131 select EXYNOS4_SETUP_SDHCI
119 help 132 help
@@ -122,6 +135,7 @@ config MACH_SMDKC210
122config MACH_SMDKV310 135config MACH_SMDKV310
123 bool "SMDKV310" 136 bool "SMDKV310"
124 select CPU_EXYNOS4210 137 select CPU_EXYNOS4210
138 select S5P_DEV_FIMD0
125 select S3C_DEV_RTC 139 select S3C_DEV_RTC
126 select S3C_DEV_WDT 140 select S3C_DEV_WDT
127 select S3C_DEV_I2C1 141 select S3C_DEV_I2C1
@@ -130,10 +144,12 @@ config MACH_SMDKV310
130 select S3C_DEV_HSMMC2 144 select S3C_DEV_HSMMC2
131 select S3C_DEV_HSMMC3 145 select S3C_DEV_HSMMC3
132 select SAMSUNG_DEV_BACKLIGHT 146 select SAMSUNG_DEV_BACKLIGHT
147 select EXYNOS4_DEV_AHCI
133 select SAMSUNG_DEV_KEYPAD 148 select SAMSUNG_DEV_KEYPAD
134 select EXYNOS4_DEV_PD 149 select EXYNOS4_DEV_PD
135 select SAMSUNG_DEV_PWM 150 select SAMSUNG_DEV_PWM
136 select EXYNOS4_DEV_SYSMMU 151 select EXYNOS4_DEV_SYSMMU
152 select EXYNOS4_SETUP_FIMD0
137 select EXYNOS4_SETUP_I2C1 153 select EXYNOS4_SETUP_I2C1
138 select EXYNOS4_SETUP_KEYPAD 154 select EXYNOS4_SETUP_KEYPAD
139 select EXYNOS4_SETUP_SDHCI 155 select EXYNOS4_SETUP_SDHCI
@@ -157,13 +173,22 @@ config MACH_ARMLEX4210
157config MACH_UNIVERSAL_C210 173config MACH_UNIVERSAL_C210
158 bool "Mobile UNIVERSAL_C210 Board" 174 bool "Mobile UNIVERSAL_C210 Board"
159 select CPU_EXYNOS4210 175 select CPU_EXYNOS4210
176 select S5P_GPIO_INT
177 select S5P_DEV_FIMC0
178 select S5P_DEV_FIMC1
179 select S5P_DEV_FIMC2
180 select S5P_DEV_FIMC3
160 select S3C_DEV_HSMMC 181 select S3C_DEV_HSMMC
161 select S3C_DEV_HSMMC2 182 select S3C_DEV_HSMMC2
162 select S3C_DEV_HSMMC3 183 select S3C_DEV_HSMMC3
163 select S3C_DEV_I2C1 184 select S3C_DEV_I2C1
185 select S3C_DEV_I2C3
164 select S3C_DEV_I2C5 186 select S3C_DEV_I2C5
187 select S5P_DEV_MFC
165 select S5P_DEV_ONENAND 188 select S5P_DEV_ONENAND
189 select EXYNOS4_DEV_PD
166 select EXYNOS4_SETUP_I2C1 190 select EXYNOS4_SETUP_I2C1
191 select EXYNOS4_SETUP_I2C3
167 select EXYNOS4_SETUP_I2C5 192 select EXYNOS4_SETUP_I2C5
168 select EXYNOS4_SETUP_SDHCI 193 select EXYNOS4_SETUP_SDHCI
169 help 194 help
@@ -180,13 +205,16 @@ config MACH_NURI
180 select S3C_DEV_I2C1 205 select S3C_DEV_I2C1
181 select S3C_DEV_I2C3 206 select S3C_DEV_I2C3
182 select S3C_DEV_I2C5 207 select S3C_DEV_I2C5
208 select S5P_DEV_MFC
183 select S5P_DEV_USB_EHCI 209 select S5P_DEV_USB_EHCI
210 select EXYNOS4_DEV_PD
184 select EXYNOS4_SETUP_I2C1 211 select EXYNOS4_SETUP_I2C1
185 select EXYNOS4_SETUP_I2C3 212 select EXYNOS4_SETUP_I2C3
186 select EXYNOS4_SETUP_I2C5 213 select EXYNOS4_SETUP_I2C5
187 select EXYNOS4_SETUP_SDHCI 214 select EXYNOS4_SETUP_SDHCI
188 select EXYNOS4_SETUP_USB_PHY 215 select EXYNOS4_SETUP_USB_PHY
189 select SAMSUNG_DEV_PWM 216 select SAMSUNG_DEV_PWM
217 select SAMSUNG_DEV_ADC
190 help 218 help
191 Machine support for Samsung Mobile NURI Board. 219 Machine support for Samsung Mobile NURI Board.
192 220
diff --git a/arch/arm/mach-exynos4/Makefile b/arch/arm/mach-exynos4/Makefile
index 1366995d8c2..b7fe1d7b0b1 100644
--- a/arch/arm/mach-exynos4/Makefile
+++ b/arch/arm/mach-exynos4/Makefile
@@ -13,18 +13,13 @@ obj- :=
13# Core support for EXYNOS4 system 13# Core support for EXYNOS4 system
14 14
15obj-$(CONFIG_CPU_EXYNOS4210) += cpu.o init.o clock.o irq-combiner.o 15obj-$(CONFIG_CPU_EXYNOS4210) += cpu.o init.o clock.o irq-combiner.o
16obj-$(CONFIG_CPU_EXYNOS4210) += setup-i2c0.o irq-eint.o dma.o 16obj-$(CONFIG_CPU_EXYNOS4210) += setup-i2c0.o irq-eint.o dma.o pmu.o
17obj-$(CONFIG_PM) += pm.o sleep.o 17obj-$(CONFIG_PM) += pm.o sleep.o
18obj-$(CONFIG_CPU_IDLE) += cpuidle.o 18obj-$(CONFIG_CPU_IDLE) += cpuidle.o
19 19
20obj-$(CONFIG_SMP) += platsmp.o headsmp.o 20obj-$(CONFIG_SMP) += platsmp.o headsmp.o
21 21
22ifeq ($(CONFIG_EXYNOS4_MCT),y) 22obj-$(CONFIG_EXYNOS4_MCT) += mct.o
23obj-y += mct.o
24else
25obj-y += time.o
26obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
27endif
28 23
29obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 24obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
30 25
@@ -42,8 +37,10 @@ obj-y += dev-audio.o
42obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o 37obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o
43obj-$(CONFIG_EXYNOS4_DEV_PD) += dev-pd.o 38obj-$(CONFIG_EXYNOS4_DEV_PD) += dev-pd.o
44obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o 39obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o
40obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o
45 41
46obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o 42obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o
43obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o
47obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o 44obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o
48obj-$(CONFIG_EXYNOS4_SETUP_I2C2) += setup-i2c2.o 45obj-$(CONFIG_EXYNOS4_SETUP_I2C2) += setup-i2c2.o
49obj-$(CONFIG_EXYNOS4_SETUP_I2C3) += setup-i2c3.o 46obj-$(CONFIG_EXYNOS4_SETUP_I2C3) += setup-i2c3.o
diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 66494f28bbe..1561b036a9b 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -520,7 +520,7 @@ static struct clk init_clocks_off[] = {
520 .ctrlbit = (1 << 21), 520 .ctrlbit = (1 << 21),
521 }, { 521 }, {
522 .name = "ac97", 522 .name = "ac97",
523 .id = -1, 523 .devname = "samsung-ac97",
524 .enable = exynos4_clk_ip_peril_ctrl, 524 .enable = exynos4_clk_ip_peril_ctrl,
525 .ctrlbit = (1 << 27), 525 .ctrlbit = (1 << 27),
526 }, { 526 }, {
@@ -528,6 +528,11 @@ static struct clk init_clocks_off[] = {
528 .enable = exynos4_clk_ip_image_ctrl, 528 .enable = exynos4_clk_ip_image_ctrl,
529 .ctrlbit = (1 << 0), 529 .ctrlbit = (1 << 0),
530 }, { 530 }, {
531 .name = "mfc",
532 .devname = "s5p-mfc",
533 .enable = exynos4_clk_ip_mfc_ctrl,
534 .ctrlbit = (1 << 0),
535 }, {
531 .name = "i2c", 536 .name = "i2c",
532 .devname = "s3c2440-i2c.0", 537 .devname = "s3c2440-i2c.0",
533 .parent = &clk_aclk_100.clk, 538 .parent = &clk_aclk_100.clk,
@@ -731,6 +736,52 @@ static struct clksrc_sources clkset_mout_g2d = {
731 .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list), 736 .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
732}; 737};
733 738
739static struct clk *clkset_mout_mfc0_list[] = {
740 [0] = &clk_mout_mpll.clk,
741 [1] = &clk_sclk_apll.clk,
742};
743
744static struct clksrc_sources clkset_mout_mfc0 = {
745 .sources = clkset_mout_mfc0_list,
746 .nr_sources = ARRAY_SIZE(clkset_mout_mfc0_list),
747};
748
749static struct clksrc_clk clk_mout_mfc0 = {
750 .clk = {
751 .name = "mout_mfc0",
752 },
753 .sources = &clkset_mout_mfc0,
754 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 0, .size = 1 },
755};
756
757static struct clk *clkset_mout_mfc1_list[] = {
758 [0] = &clk_mout_epll.clk,
759 [1] = &clk_sclk_vpll.clk,
760};
761
762static struct clksrc_sources clkset_mout_mfc1 = {
763 .sources = clkset_mout_mfc1_list,
764 .nr_sources = ARRAY_SIZE(clkset_mout_mfc1_list),
765};
766
767static struct clksrc_clk clk_mout_mfc1 = {
768 .clk = {
769 .name = "mout_mfc1",
770 },
771 .sources = &clkset_mout_mfc1,
772 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 4, .size = 1 },
773};
774
775static struct clk *clkset_mout_mfc_list[] = {
776 [0] = &clk_mout_mfc0.clk,
777 [1] = &clk_mout_mfc1.clk,
778};
779
780static struct clksrc_sources clkset_mout_mfc = {
781 .sources = clkset_mout_mfc_list,
782 .nr_sources = ARRAY_SIZE(clkset_mout_mfc_list),
783};
784
734static struct clksrc_clk clk_dout_mmc0 = { 785static struct clksrc_clk clk_dout_mmc0 = {
735 .clk = { 786 .clk = {
736 .name = "dout_mmc0", 787 .name = "dout_mmc0",
@@ -974,6 +1025,14 @@ static struct clksrc_clk clksrcs[] = {
974 .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 }, 1025 .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 },
975 }, { 1026 }, {
976 .clk = { 1027 .clk = {
1028 .name = "sclk_mfc",
1029 .devname = "s5p-mfc",
1030 },
1031 .sources = &clkset_mout_mfc,
1032 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 8, .size = 1 },
1033 .reg_div = { .reg = S5P_CLKDIV_MFC, .shift = 0, .size = 4 },
1034 }, {
1035 .clk = {
977 .name = "sclk_mmc", 1036 .name = "sclk_mmc",
978 .devname = "s3c-sdhci.0", 1037 .devname = "s3c-sdhci.0",
979 .parent = &clk_dout_mmc0.clk, 1038 .parent = &clk_dout_mmc0.clk,
@@ -1049,6 +1108,8 @@ static struct clksrc_clk *sysclks[] = {
1049 &clk_dout_mmc2, 1108 &clk_dout_mmc2,
1050 &clk_dout_mmc3, 1109 &clk_dout_mmc3,
1051 &clk_dout_mmc4, 1110 &clk_dout_mmc4,
1111 &clk_mout_mfc0,
1112 &clk_mout_mfc1,
1052}; 1113};
1053 1114
1054static int xtal_rate; 1115static int xtal_rate;
diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c
index bfd621460ab..746d6fc6d39 100644
--- a/arch/arm/mach-exynos4/cpu.c
+++ b/arch/arm/mach-exynos4/cpu.c
@@ -16,16 +16,21 @@
16 16
17#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
18#include <asm/hardware/cache-l2x0.h> 18#include <asm/hardware/cache-l2x0.h>
19#include <asm/hardware/gic.h>
19 20
20#include <plat/cpu.h> 21#include <plat/cpu.h>
21#include <plat/clock.h> 22#include <plat/clock.h>
23#include <plat/devs.h>
22#include <plat/exynos4.h> 24#include <plat/exynos4.h>
25#include <plat/adc-core.h>
23#include <plat/sdhci.h> 26#include <plat/sdhci.h>
24#include <plat/devs.h> 27#include <plat/fb-core.h>
25#include <plat/fimc-core.h> 28#include <plat/fimc-core.h>
26#include <plat/iic-core.h> 29#include <plat/iic-core.h>
30#include <plat/reset.h>
27 31
28#include <mach/regs-irq.h> 32#include <mach/regs-irq.h>
33#include <mach/regs-pmu.h>
29 34
30extern int combiner_init(unsigned int combiner_nr, void __iomem *base, 35extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
31 unsigned int irq_start); 36 unsigned int irq_start);
@@ -103,7 +108,17 @@ static struct map_desc exynos4_iodesc[] __initdata = {
103 .pfn = __phys_to_pfn(EXYNOS4_PA_HSPHY), 108 .pfn = __phys_to_pfn(EXYNOS4_PA_HSPHY),
104 .length = SZ_4K, 109 .length = SZ_4K,
105 .type = MT_DEVICE, 110 .type = MT_DEVICE,
106 } 111 }, {
112 .virtual = (unsigned long)S5P_VA_GIC_CPU,
113 .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_CPU),
114 .length = SZ_64K,
115 .type = MT_DEVICE,
116 }, {
117 .virtual = (unsigned long)S5P_VA_GIC_DIST,
118 .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_DIST),
119 .length = SZ_64K,
120 .type = MT_DEVICE,
121 },
107}; 122};
108 123
109static void exynos4_idle(void) 124static void exynos4_idle(void)
@@ -114,6 +129,11 @@ static void exynos4_idle(void)
114 local_irq_enable(); 129 local_irq_enable();
115} 130}
116 131
132static void exynos4_sw_reset(void)
133{
134 __raw_writel(0x1, S5P_SWRESET);
135}
136
117/* 137/*
118 * exynos4_map_io 138 * exynos4_map_io
119 * 139 *
@@ -129,6 +149,8 @@ void __init exynos4_map_io(void)
129 exynos4_default_sdhci2(); 149 exynos4_default_sdhci2();
130 exynos4_default_sdhci3(); 150 exynos4_default_sdhci3();
131 151
152 s3c_adc_setname("samsung-adc-v3");
153
132 s3c_fimc_setname(0, "exynos4-fimc"); 154 s3c_fimc_setname(0, "exynos4-fimc");
133 s3c_fimc_setname(1, "exynos4-fimc"); 155 s3c_fimc_setname(1, "exynos4-fimc");
134 s3c_fimc_setname(2, "exynos4-fimc"); 156 s3c_fimc_setname(2, "exynos4-fimc");
@@ -138,6 +160,8 @@ void __init exynos4_map_io(void)
138 s3c_i2c0_setname("s3c2440-i2c"); 160 s3c_i2c0_setname("s3c2440-i2c");
139 s3c_i2c1_setname("s3c2440-i2c"); 161 s3c_i2c1_setname("s3c2440-i2c");
140 s3c_i2c2_setname("s3c2440-i2c"); 162 s3c_i2c2_setname("s3c2440-i2c");
163
164 s5p_fb_setname(0, "exynos4-fb");
141} 165}
142 166
143void __init exynos4_init_clocks(int xtal) 167void __init exynos4_init_clocks(int xtal)
@@ -150,22 +174,23 @@ void __init exynos4_init_clocks(int xtal)
150 exynos4_setup_clocks(); 174 exynos4_setup_clocks();
151} 175}
152 176
177static void exynos4_gic_irq_eoi(struct irq_data *d)
178{
179 struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
180
181 gic_data->cpu_base = S5P_VA_GIC_CPU +
182 (EXYNOS4_GIC_BANK_OFFSET * smp_processor_id());
183}
184
153void __init exynos4_init_irq(void) 185void __init exynos4_init_irq(void)
154{ 186{
155 int irq; 187 int irq;
156 188
157 gic_init(0, IRQ_LOCALTIMER, S5P_VA_GIC_DIST, S5P_VA_GIC_CPU); 189 gic_init(0, IRQ_SPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
190 gic_arch_extn.irq_eoi = exynos4_gic_irq_eoi;
158 191
159 for (irq = 0; irq < MAX_COMBINER_NR; irq++) { 192 for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
160 193
161 /*
162 * From SPI(0) to SPI(39) and SPI(51), SPI(53) are
163 * connected to the interrupt combiner. These irqs
164 * should be initialized to support cascade interrupt.
165 */
166 if ((irq >= 40) && !(irq == 51) && !(irq == 53))
167 continue;
168
169 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), 194 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
170 COMBINER_IRQ(irq, 0)); 195 COMBINER_IRQ(irq, 0));
171 combiner_cascade_irq(irq, IRQ_SPI(irq)); 196 combiner_cascade_irq(irq, IRQ_SPI(irq));
@@ -222,5 +247,8 @@ int __init exynos4_init(void)
222 /* set idle function */ 247 /* set idle function */
223 pm_idle = exynos4_idle; 248 pm_idle = exynos4_idle;
224 249
250 /* set sw_reset function */
251 s5p_reset_hook = exynos4_sw_reset;
252
225 return sysdev_register(&exynos4_sysdev); 253 return sysdev_register(&exynos4_sysdev);
226} 254}
diff --git a/arch/arm/mach-exynos4/dev-audio.c b/arch/arm/mach-exynos4/dev-audio.c
index 983069a5323..5a9f9c2e53b 100644
--- a/arch/arm/mach-exynos4/dev-audio.c
+++ b/arch/arm/mach-exynos4/dev-audio.c
@@ -21,6 +21,7 @@
21#include <mach/map.h> 21#include <mach/map.h>
22#include <mach/dma.h> 22#include <mach/dma.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24#include <mach/regs-audss.h>
24 25
25static const char *rclksrc[] = { 26static const char *rclksrc[] = {
26 [0] = "busclk", 27 [0] = "busclk",
@@ -55,6 +56,7 @@ static struct s3c_audio_pdata i2sv5_pdata = {
55 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI 56 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
56 | QUIRK_NEED_RSTCLR, 57 | QUIRK_NEED_RSTCLR,
57 .src_clk = rclksrc, 58 .src_clk = rclksrc,
59 .idma_addr = EXYNOS4_AUDSS_INT_MEM,
58 }, 60 },
59 }, 61 },
60}; 62};
diff --git a/arch/arm/mach-exynos4/dev-dwmci.c b/arch/arm/mach-exynos4/dev-dwmci.c
new file mode 100644
index 00000000000..b025db4bf60
--- /dev/null
+++ b/arch/arm/mach-exynos4/dev-dwmci.c
@@ -0,0 +1,82 @@
1/*
2 * linux/arch/arm/mach-exynos4/dev-dwmci.c
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Platform device for Synopsys DesignWare Mobile Storage IP
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/dma-mapping.h>
17#include <linux/platform_device.h>
18#include <linux/interrupt.h>
19#include <linux/mmc/dw_mmc.h>
20
21#include <plat/devs.h>
22
23#include <mach/map.h>
24
25static int exynos4_dwmci_get_bus_wd(u32 slot_id)
26{
27 return 4;
28}
29
30static int exynos4_dwmci_init(u32 slot_id, irq_handler_t handler, void *data)
31{
32 return 0;
33}
34
35static struct resource exynos4_dwmci_resource[] = {
36 [0] = {
37 .start = EXYNOS4_PA_DWMCI,
38 .end = EXYNOS4_PA_DWMCI + SZ_4K - 1,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = IRQ_DWMCI,
43 .end = IRQ_DWMCI,
44 .flags = IORESOURCE_IRQ,
45 }
46};
47
48static struct dw_mci_board exynos4_dwci_pdata = {
49 .num_slots = 1,
50 .quirks = DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
51 .bus_hz = 80 * 1000 * 1000,
52 .detect_delay_ms = 200,
53 .init = exynos4_dwmci_init,
54 .get_bus_wd = exynos4_dwmci_get_bus_wd,
55};
56
57static u64 exynos4_dwmci_dmamask = DMA_BIT_MASK(32);
58
59struct platform_device exynos4_device_dwmci = {
60 .name = "dw_mmc",
61 .id = -1,
62 .num_resources = ARRAY_SIZE(exynos4_dwmci_resource),
63 .resource = exynos4_dwmci_resource,
64 .dev = {
65 .dma_mask = &exynos4_dwmci_dmamask,
66 .coherent_dma_mask = DMA_BIT_MASK(32),
67 .platform_data = &exynos4_dwci_pdata,
68 },
69};
70
71void __init exynos4_dwmci_set_platdata(struct dw_mci_board *pd)
72{
73 struct dw_mci_board *npd;
74
75 npd = s3c_set_platdata(pd, sizeof(struct dw_mci_board),
76 &exynos4_device_dwmci);
77
78 if (!npd->init)
79 npd->init = exynos4_dwmci_init;
80 if (!npd->get_bus_wd)
81 npd->get_bus_wd = exynos4_dwmci_get_bus_wd;
82}
diff --git a/arch/arm/mach-exynos4/hotplug.c b/arch/arm/mach-exynos4/hotplug.c
index 2b5909e2ccd..7490789784c 100644
--- a/arch/arm/mach-exynos4/hotplug.c
+++ b/arch/arm/mach-exynos4/hotplug.c
@@ -13,9 +13,12 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/io.h>
16 17
17#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
18 19
20#include <mach/regs-pmu.h>
21
19extern volatile int pen_release; 22extern volatile int pen_release;
20 23
21static inline void cpu_enter_lowpower(void) 24static inline void cpu_enter_lowpower(void)
@@ -58,12 +61,12 @@ static inline void cpu_leave_lowpower(void)
58 61
59static inline void platform_do_lowpower(unsigned int cpu, int *spurious) 62static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
60{ 63{
61 /*
62 * there is no power-control hardware on this platform, so all
63 * we can do is put the core into WFI; this is safe as the calling
64 * code will have already disabled interrupts
65 */
66 for (;;) { 64 for (;;) {
65
66 /* make cpu1 to be turned off at next WFI command */
67 if (cpu == 1)
68 __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION);
69
67 /* 70 /*
68 * here's the WFI 71 * here's the WFI
69 */ 72 */
diff --git a/arch/arm/mach-exynos4/include/mach/dwmci.h b/arch/arm/mach-exynos4/include/mach/dwmci.h
new file mode 100644
index 00000000000..7ce657459cc
--- /dev/null
+++ b/arch/arm/mach-exynos4/include/mach/dwmci.h
@@ -0,0 +1,20 @@
1/* linux/arch/arm/mach-exynos4/include/mach/dwmci.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Synopsys DesignWare Mobile Storage for EXYNOS4210
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_ARM_ARCH_DWMCI_H
14#define __ASM_ARM_ARCH_DWMCI_H __FILE__
15
16#include <linux/mmc/dw_mmc.h>
17
18extern void exynos4_dwmci_set_platdata(struct dw_mci_board *pd);
19
20#endif /* __ASM_ARM_ARCH_DWMCI_H */
diff --git a/arch/arm/mach-exynos4/include/mach/entry-macro.S b/arch/arm/mach-exynos4/include/mach/entry-macro.S
index d8f38c2e565..d7a1e281ce7 100644
--- a/arch/arm/mach-exynos4/include/mach/entry-macro.S
+++ b/arch/arm/mach-exynos4/include/mach/entry-macro.S
@@ -10,6 +10,7 @@
10*/ 10*/
11 11
12#include <mach/hardware.h> 12#include <mach/hardware.h>
13#include <mach/map.h>
13#include <asm/hardware/gic.h> 14#include <asm/hardware/gic.h>
14 15
15 .macro disable_fiq 16 .macro disable_fiq
@@ -18,6 +19,10 @@
18 .macro get_irqnr_preamble, base, tmp 19 .macro get_irqnr_preamble, base, tmp
19 ldr \base, =gic_cpu_base_addr 20 ldr \base, =gic_cpu_base_addr
20 ldr \base, [\base] 21 ldr \base, [\base]
22 mrc p15, 0, \tmp, c0, c0, 5
23 and \tmp, \tmp, #3
24 cmp \tmp, #1
25 addeq \base, \base, #EXYNOS4_GIC_BANK_OFFSET
21 .endm 26 .endm
22 27
23 .macro arch_ret_to_user, tmp1, tmp2 28 .macro arch_ret_to_user, tmp1, tmp2
@@ -75,10 +80,4 @@
75 /* As above, this assumes that irqstat and base are preserved.. */ 80 /* As above, this assumes that irqstat and base are preserved.. */
76 81
77 .macro test_for_ltirq, irqnr, irqstat, base, tmp 82 .macro test_for_ltirq, irqnr, irqstat, base, tmp
78 bic \irqnr, \irqstat, #0x1c00
79 mov \tmp, #0
80 cmp \irqnr, #29
81 moveq \tmp, #1
82 streq \irqstat, [\base, #GIC_CPU_EOI]
83 cmp \tmp, #0
84 .endm 83 .endm
diff --git a/arch/arm/mach-exynos4/include/mach/irqs.h b/arch/arm/mach-exynos4/include/mach/irqs.h
index 5d037301d21..f8952f8f375 100644
--- a/arch/arm/mach-exynos4/include/mach/irqs.h
+++ b/arch/arm/mach-exynos4/include/mach/irqs.h
@@ -19,40 +19,104 @@
19 19
20#define IRQ_PPI(x) S5P_IRQ(x+16) 20#define IRQ_PPI(x) S5P_IRQ(x+16)
21 21
22#define IRQ_LOCALTIMER IRQ_PPI(13)
23
24/* SPI: Shared Peripheral Interrupt */ 22/* SPI: Shared Peripheral Interrupt */
25 23
26#define IRQ_SPI(x) S5P_IRQ(x+32) 24#define IRQ_SPI(x) S5P_IRQ(x+32)
27 25
28#define IRQ_MCT1 IRQ_SPI(35) 26#define IRQ_EINT0 IRQ_SPI(16)
29 27#define IRQ_EINT1 IRQ_SPI(17)
30#define IRQ_EINT0 IRQ_SPI(40) 28#define IRQ_EINT2 IRQ_SPI(18)
31#define IRQ_EINT1 IRQ_SPI(41) 29#define IRQ_EINT3 IRQ_SPI(19)
32#define IRQ_EINT2 IRQ_SPI(42) 30#define IRQ_EINT4 IRQ_SPI(20)
33#define IRQ_EINT3 IRQ_SPI(43) 31#define IRQ_EINT5 IRQ_SPI(21)
34#define IRQ_USB_HSOTG IRQ_SPI(44) 32#define IRQ_EINT6 IRQ_SPI(22)
35#define IRQ_USB_HOST IRQ_SPI(45) 33#define IRQ_EINT7 IRQ_SPI(23)
36#define IRQ_MODEM_IF IRQ_SPI(46) 34#define IRQ_EINT8 IRQ_SPI(24)
37#define IRQ_ROTATOR IRQ_SPI(47) 35#define IRQ_EINT9 IRQ_SPI(25)
38#define IRQ_JPEG IRQ_SPI(48) 36#define IRQ_EINT10 IRQ_SPI(26)
39#define IRQ_2D IRQ_SPI(49) 37#define IRQ_EINT11 IRQ_SPI(27)
40#define IRQ_PCIE IRQ_SPI(50) 38#define IRQ_EINT12 IRQ_SPI(28)
41#define IRQ_MCT0 IRQ_SPI(51) 39#define IRQ_EINT13 IRQ_SPI(29)
42#define IRQ_MFC IRQ_SPI(52) 40#define IRQ_EINT14 IRQ_SPI(30)
43#define IRQ_AUDIO_SS IRQ_SPI(54) 41#define IRQ_EINT15 IRQ_SPI(31)
44#define IRQ_AC97 IRQ_SPI(55) 42#define IRQ_EINT16_31 IRQ_SPI(32)
45#define IRQ_SPDIF IRQ_SPI(56) 43
46#define IRQ_KEYPAD IRQ_SPI(57) 44#define IRQ_PDMA0 IRQ_SPI(35)
47#define IRQ_INTFEEDCTRL_SSS IRQ_SPI(58) 45#define IRQ_PDMA1 IRQ_SPI(36)
48#define IRQ_SLIMBUS IRQ_SPI(59) 46#define IRQ_TIMER0_VIC IRQ_SPI(37)
49#define IRQ_PMU IRQ_SPI(60) 47#define IRQ_TIMER1_VIC IRQ_SPI(38)
50#define IRQ_TSI IRQ_SPI(61) 48#define IRQ_TIMER2_VIC IRQ_SPI(39)
51#define IRQ_SATA IRQ_SPI(62) 49#define IRQ_TIMER3_VIC IRQ_SPI(40)
52#define IRQ_GPS IRQ_SPI(63) 50#define IRQ_TIMER4_VIC IRQ_SPI(41)
51#define IRQ_MCT_L0 IRQ_SPI(42)
52#define IRQ_WDT IRQ_SPI(43)
53#define IRQ_RTC_ALARM IRQ_SPI(44)
54#define IRQ_RTC_TIC IRQ_SPI(45)
55#define IRQ_GPIO_XB IRQ_SPI(46)
56#define IRQ_GPIO_XA IRQ_SPI(47)
57#define IRQ_MCT_L1 IRQ_SPI(48)
58
59#define IRQ_UART0 IRQ_SPI(52)
60#define IRQ_UART1 IRQ_SPI(53)
61#define IRQ_UART2 IRQ_SPI(54)
62#define IRQ_UART3 IRQ_SPI(55)
63#define IRQ_UART4 IRQ_SPI(56)
64#define IRQ_MCT_G0 IRQ_SPI(57)
65#define IRQ_IIC IRQ_SPI(58)
66#define IRQ_IIC1 IRQ_SPI(59)
67#define IRQ_IIC2 IRQ_SPI(60)
68#define IRQ_IIC3 IRQ_SPI(61)
69#define IRQ_IIC4 IRQ_SPI(62)
70#define IRQ_IIC5 IRQ_SPI(63)
71#define IRQ_IIC6 IRQ_SPI(64)
72#define IRQ_IIC7 IRQ_SPI(65)
73
74#define IRQ_USB_HOST IRQ_SPI(70)
75#define IRQ_USB_HSOTG IRQ_SPI(71)
76#define IRQ_MODEM_IF IRQ_SPI(72)
77#define IRQ_HSMMC0 IRQ_SPI(73)
78#define IRQ_HSMMC1 IRQ_SPI(74)
79#define IRQ_HSMMC2 IRQ_SPI(75)
80#define IRQ_HSMMC3 IRQ_SPI(76)
81#define IRQ_DWMCI IRQ_SPI(77)
82
83#define IRQ_MIPI_CSIS0 IRQ_SPI(78)
84#define IRQ_MIPI_CSIS1 IRQ_SPI(80)
85
86#define IRQ_ONENAND_AUDI IRQ_SPI(82)
87#define IRQ_ROTATOR IRQ_SPI(83)
88#define IRQ_FIMC0 IRQ_SPI(84)
89#define IRQ_FIMC1 IRQ_SPI(85)
90#define IRQ_FIMC2 IRQ_SPI(86)
91#define IRQ_FIMC3 IRQ_SPI(87)
92#define IRQ_JPEG IRQ_SPI(88)
93#define IRQ_2D IRQ_SPI(89)
94#define IRQ_PCIE IRQ_SPI(90)
95
96#define IRQ_MFC IRQ_SPI(94)
97
98#define IRQ_AUDIO_SS IRQ_SPI(96)
99#define IRQ_I2S0 IRQ_SPI(97)
100#define IRQ_I2S1 IRQ_SPI(98)
101#define IRQ_I2S2 IRQ_SPI(99)
102#define IRQ_AC97 IRQ_SPI(100)
103
104#define IRQ_SPDIF IRQ_SPI(104)
105#define IRQ_ADC0 IRQ_SPI(105)
106#define IRQ_PEN0 IRQ_SPI(106)
107#define IRQ_ADC1 IRQ_SPI(107)
108#define IRQ_PEN1 IRQ_SPI(108)
109#define IRQ_KEYPAD IRQ_SPI(109)
110#define IRQ_PMU IRQ_SPI(110)
111#define IRQ_GPS IRQ_SPI(111)
112#define IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
113#define IRQ_SLIMBUS IRQ_SPI(113)
114
115#define IRQ_TSI IRQ_SPI(115)
116#define IRQ_SATA IRQ_SPI(116)
53 117
54#define MAX_IRQ_IN_COMBINER 8 118#define MAX_IRQ_IN_COMBINER 8
55#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(64)) 119#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128))
56#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y) 120#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y)
57 121
58#define IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0) 122#define IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)
@@ -73,75 +137,14 @@
73#define IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6) 137#define IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6)
74#define IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7) 138#define IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7)
75 139
76#define IRQ_PDMA0 COMBINER_IRQ(21, 0) 140#define IRQ_FIMD0_FIFO COMBINER_IRQ(11, 0)
77#define IRQ_PDMA1 COMBINER_IRQ(21, 1) 141#define IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1)
78 142#define IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2)
79#define IRQ_TIMER0_VIC COMBINER_IRQ(22, 0)
80#define IRQ_TIMER1_VIC COMBINER_IRQ(22, 1)
81#define IRQ_TIMER2_VIC COMBINER_IRQ(22, 2)
82#define IRQ_TIMER3_VIC COMBINER_IRQ(22, 3)
83#define IRQ_TIMER4_VIC COMBINER_IRQ(22, 4)
84
85#define IRQ_RTC_ALARM COMBINER_IRQ(23, 0)
86#define IRQ_RTC_TIC COMBINER_IRQ(23, 1)
87
88#define IRQ_GPIO_XB COMBINER_IRQ(24, 0)
89#define IRQ_GPIO_XA COMBINER_IRQ(24, 1)
90
91#define IRQ_UART0 COMBINER_IRQ(26, 0)
92#define IRQ_UART1 COMBINER_IRQ(26, 1)
93#define IRQ_UART2 COMBINER_IRQ(26, 2)
94#define IRQ_UART3 COMBINER_IRQ(26, 3)
95#define IRQ_UART4 COMBINER_IRQ(26, 4)
96
97#define IRQ_IIC COMBINER_IRQ(27, 0)
98#define IRQ_IIC1 COMBINER_IRQ(27, 1)
99#define IRQ_IIC2 COMBINER_IRQ(27, 2)
100#define IRQ_IIC3 COMBINER_IRQ(27, 3)
101#define IRQ_IIC4 COMBINER_IRQ(27, 4)
102#define IRQ_IIC5 COMBINER_IRQ(27, 5)
103#define IRQ_IIC6 COMBINER_IRQ(27, 6)
104#define IRQ_IIC7 COMBINER_IRQ(27, 7)
105
106#define IRQ_HSMMC0 COMBINER_IRQ(29, 0)
107#define IRQ_HSMMC1 COMBINER_IRQ(29, 1)
108#define IRQ_HSMMC2 COMBINER_IRQ(29, 2)
109#define IRQ_HSMMC3 COMBINER_IRQ(29, 3)
110
111#define IRQ_MIPI_CSIS0 COMBINER_IRQ(30, 0)
112#define IRQ_MIPI_CSIS1 COMBINER_IRQ(30, 1)
113
114#define IRQ_FIMC0 COMBINER_IRQ(32, 0)
115#define IRQ_FIMC1 COMBINER_IRQ(32, 1)
116#define IRQ_FIMC2 COMBINER_IRQ(33, 0)
117#define IRQ_FIMC3 COMBINER_IRQ(33, 1)
118
119#define IRQ_ONENAND_AUDI COMBINER_IRQ(34, 0)
120
121#define IRQ_MCT_L1 COMBINER_IRQ(35, 3)
122
123#define IRQ_EINT4 COMBINER_IRQ(37, 0)
124#define IRQ_EINT5 COMBINER_IRQ(37, 1)
125#define IRQ_EINT6 COMBINER_IRQ(37, 2)
126#define IRQ_EINT7 COMBINER_IRQ(37, 3)
127#define IRQ_EINT8 COMBINER_IRQ(38, 0)
128
129#define IRQ_EINT9 COMBINER_IRQ(38, 1)
130#define IRQ_EINT10 COMBINER_IRQ(38, 2)
131#define IRQ_EINT11 COMBINER_IRQ(38, 3)
132#define IRQ_EINT12 COMBINER_IRQ(38, 4)
133#define IRQ_EINT13 COMBINER_IRQ(38, 5)
134#define IRQ_EINT14 COMBINER_IRQ(38, 6)
135#define IRQ_EINT15 COMBINER_IRQ(38, 7)
136
137#define IRQ_EINT16_31 COMBINER_IRQ(39, 0)
138
139#define IRQ_MCT_L0 COMBINER_IRQ(51, 0)
140 143
141#define IRQ_WDT COMBINER_IRQ(53, 0) 144#define MAX_COMBINER_NR 16
142#define IRQ_MCT_G0 COMBINER_IRQ(53, 4)
143 145
144#define MAX_COMBINER_NR 54 146#define IRQ_ADC IRQ_ADC0
147#define IRQ_TC IRQ_PEN0
145 148
146#define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0) 149#define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0)
147 150
@@ -155,6 +158,6 @@
155#define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT) 158#define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT)
156 159
157/* Set the default NR_IRQS */ 160/* Set the default NR_IRQS */
158#define NR_IRQS (IRQ_GPIO_END) 161#define NR_IRQS (IRQ_GPIO_END + 64)
159 162
160#endif /* __ASM_ARCH_IRQS_H */ 163#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-exynos4/include/mach/map.h b/arch/arm/mach-exynos4/include/mach/map.h
index 0009e77a05f..d32296dc65e 100644
--- a/arch/arm/mach-exynos4/include/mach/map.h
+++ b/arch/arm/mach-exynos4/include/mach/map.h
@@ -57,12 +57,14 @@
57 57
58#define EXYNOS4_PA_DMC0 0x10400000 58#define EXYNOS4_PA_DMC0 0x10400000
59 59
60#define EXYNOS4_PA_COMBINER 0x10448000 60#define EXYNOS4_PA_COMBINER 0x10440000
61
62#define EXYNOS4_PA_GIC_CPU 0x10480000
63#define EXYNOS4_PA_GIC_DIST 0x10490000
64#define EXYNOS4_GIC_BANK_OFFSET 0x8000
61 65
62#define EXYNOS4_PA_COREPERI 0x10500000 66#define EXYNOS4_PA_COREPERI 0x10500000
63#define EXYNOS4_PA_GIC_CPU 0x10500100
64#define EXYNOS4_PA_TWD 0x10500600 67#define EXYNOS4_PA_TWD 0x10500600
65#define EXYNOS4_PA_GIC_DIST 0x10501000
66#define EXYNOS4_PA_L2CC 0x10502000 68#define EXYNOS4_PA_L2CC 0x10502000
67 69
68#define EXYNOS4_PA_MDMA 0x10810000 70#define EXYNOS4_PA_MDMA 0x10810000
@@ -93,7 +95,10 @@
93#define EXYNOS4_PA_MIPI_CSIS0 0x11880000 95#define EXYNOS4_PA_MIPI_CSIS0 0x11880000
94#define EXYNOS4_PA_MIPI_CSIS1 0x11890000 96#define EXYNOS4_PA_MIPI_CSIS1 0x11890000
95 97
98#define EXYNOS4_PA_FIMD0 0x11C00000
99
96#define EXYNOS4_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) 100#define EXYNOS4_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000))
101#define EXYNOS4_PA_DWMCI 0x12550000
97 102
98#define EXYNOS4_PA_SATA 0x12560000 103#define EXYNOS4_PA_SATA 0x12560000
99#define EXYNOS4_PA_SATAPHY 0x125D0000 104#define EXYNOS4_PA_SATAPHY 0x125D0000
@@ -103,11 +108,15 @@
103 108
104#define EXYNOS4_PA_EHCI 0x12580000 109#define EXYNOS4_PA_EHCI 0x12580000
105#define EXYNOS4_PA_HSPHY 0x125B0000 110#define EXYNOS4_PA_HSPHY 0x125B0000
111#define EXYNOS4_PA_MFC 0x13400000
106 112
107#define EXYNOS4_PA_UART 0x13800000 113#define EXYNOS4_PA_UART 0x13800000
108 114
109#define EXYNOS4_PA_IIC(x) (0x13860000 + ((x) * 0x10000)) 115#define EXYNOS4_PA_IIC(x) (0x13860000 + ((x) * 0x10000))
110 116
117#define EXYNOS4_PA_ADC 0x13910000
118#define EXYNOS4_PA_ADC1 0x13911000
119
111#define EXYNOS4_PA_AC97 0x139A0000 120#define EXYNOS4_PA_AC97 0x139A0000
112 121
113#define EXYNOS4_PA_SPDIF 0x139B0000 122#define EXYNOS4_PA_SPDIF 0x139B0000
@@ -130,6 +139,8 @@
130#define S3C_PA_IIC5 EXYNOS4_PA_IIC(5) 139#define S3C_PA_IIC5 EXYNOS4_PA_IIC(5)
131#define S3C_PA_IIC6 EXYNOS4_PA_IIC(6) 140#define S3C_PA_IIC6 EXYNOS4_PA_IIC(6)
132#define S3C_PA_IIC7 EXYNOS4_PA_IIC(7) 141#define S3C_PA_IIC7 EXYNOS4_PA_IIC(7)
142#define SAMSUNG_PA_ADC EXYNOS4_PA_ADC
143#define SAMSUNG_PA_ADC1 EXYNOS4_PA_ADC1
133#define S3C_PA_RTC EXYNOS4_PA_RTC 144#define S3C_PA_RTC EXYNOS4_PA_RTC
134#define S3C_PA_WDT EXYNOS4_PA_WATCHDOG 145#define S3C_PA_WDT EXYNOS4_PA_WATCHDOG
135 146
@@ -140,10 +151,12 @@
140#define S5P_PA_FIMC3 EXYNOS4_PA_FIMC3 151#define S5P_PA_FIMC3 EXYNOS4_PA_FIMC3
141#define S5P_PA_MIPI_CSIS0 EXYNOS4_PA_MIPI_CSIS0 152#define S5P_PA_MIPI_CSIS0 EXYNOS4_PA_MIPI_CSIS0
142#define S5P_PA_MIPI_CSIS1 EXYNOS4_PA_MIPI_CSIS1 153#define S5P_PA_MIPI_CSIS1 EXYNOS4_PA_MIPI_CSIS1
154#define S5P_PA_FIMD0 EXYNOS4_PA_FIMD0
143#define S5P_PA_ONENAND EXYNOS4_PA_ONENAND 155#define S5P_PA_ONENAND EXYNOS4_PA_ONENAND
144#define S5P_PA_ONENAND_DMA EXYNOS4_PA_ONENAND_DMA 156#define S5P_PA_ONENAND_DMA EXYNOS4_PA_ONENAND_DMA
145#define S5P_PA_SDRAM EXYNOS4_PA_SDRAM 157#define S5P_PA_SDRAM EXYNOS4_PA_SDRAM
146#define S5P_PA_SROMC EXYNOS4_PA_SROMC 158#define S5P_PA_SROMC EXYNOS4_PA_SROMC
159#define S5P_PA_MFC EXYNOS4_PA_MFC
147#define S5P_PA_SYSCON EXYNOS4_PA_SYSCON 160#define S5P_PA_SYSCON EXYNOS4_PA_SYSCON
148#define S5P_PA_TIMER EXYNOS4_PA_TIMER 161#define S5P_PA_TIMER EXYNOS4_PA_TIMER
149#define S5P_PA_EHCI EXYNOS4_PA_EHCI 162#define S5P_PA_EHCI EXYNOS4_PA_EHCI
diff --git a/arch/arm/mach-exynos4/include/mach/pm-core.h b/arch/arm/mach-exynos4/include/mach/pm-core.h
index f26e46bc06c..1df3b81f96e 100644
--- a/arch/arm/mach-exynos4/include/mach/pm-core.h
+++ b/arch/arm/mach-exynos4/include/mach/pm-core.h
@@ -47,3 +47,13 @@ static inline void s3c_pm_arch_update_uart(void __iomem *regs,
47{ 47{
48 /* nothing here yet */ 48 /* nothing here yet */
49} 49}
50
51static inline void s3c_pm_restored_gpios(void)
52{
53 /* nothing here yet */
54}
55
56static inline void s3c_pm_saved_gpios(void)
57{
58 /* nothing here yet */
59}
diff --git a/arch/arm/mach-exynos4/include/mach/pmu.h b/arch/arm/mach-exynos4/include/mach/pmu.h
new file mode 100644
index 00000000000..a952904b010
--- /dev/null
+++ b/arch/arm/mach-exynos4/include/mach/pmu.h
@@ -0,0 +1,25 @@
1/* linux/arch/arm/mach-exynos4/include/mach/pmu.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * EXYNOS4210 - PMU(Power Management Unit) 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_PMU_H
14#define __ASM_ARCH_PMU_H __FILE__
15
16enum sys_powerdown {
17 SYS_AFTR,
18 SYS_LPA,
19 SYS_SLEEP,
20 NUM_SYS_POWERDOWN,
21};
22
23extern void exynos4_sys_powerdown_conf(enum sys_powerdown mode);
24
25#endif /* __ASM_ARCH_PMU_H */
diff --git a/arch/arm/mach-exynos4/include/mach/regs-audss.h b/arch/arm/mach-exynos4/include/mach/regs-audss.h
new file mode 100644
index 00000000000..ca5a8b64218
--- /dev/null
+++ b/arch/arm/mach-exynos4/include/mach/regs-audss.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-exynos4/include/mach/regs-audss.h
2 *
3 * Copyright (c) 2011 Samsung Electronics
4 * http://www.samsung.com
5 *
6 * Exynos4 Audio SubSystem clock register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __PLAT_REGS_AUDSS_H
14#define __PLAT_REGS_AUDSS_H __FILE__
15
16#define EXYNOS4_AUDSS_INT_MEM (0x03000000)
17
18#endif /* _PLAT_REGS_AUDSS_H */
diff --git a/arch/arm/mach-exynos4/include/mach/regs-clock.h b/arch/arm/mach-exynos4/include/mach/regs-clock.h
index 6e311c1157f..d493fdb422f 100644
--- a/arch/arm/mach-exynos4/include/mach/regs-clock.h
+++ b/arch/arm/mach-exynos4/include/mach/regs-clock.h
@@ -25,6 +25,9 @@
25#define S5P_CLKDIV_STAT_RIGHTBUS S5P_CLKREG(0x08600) 25#define S5P_CLKDIV_STAT_RIGHTBUS S5P_CLKREG(0x08600)
26#define S5P_CLKGATE_IP_RIGHTBUS S5P_CLKREG(0x08800) 26#define S5P_CLKGATE_IP_RIGHTBUS S5P_CLKREG(0x08800)
27 27
28#define S5P_EPLL_LOCK S5P_CLKREG(0x0C010)
29#define S5P_VPLL_LOCK S5P_CLKREG(0x0C020)
30
28#define S5P_EPLL_CON0 S5P_CLKREG(0x0C110) 31#define S5P_EPLL_CON0 S5P_CLKREG(0x0C110)
29#define S5P_EPLL_CON1 S5P_CLKREG(0x0C114) 32#define S5P_EPLL_CON1 S5P_CLKREG(0x0C114)
30#define S5P_VPLL_CON0 S5P_CLKREG(0x0C120) 33#define S5P_VPLL_CON0 S5P_CLKREG(0x0C120)
@@ -33,7 +36,9 @@
33#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210) 36#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210)
34#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214) 37#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214)
35#define S5P_CLKSRC_CAM S5P_CLKREG(0x0C220) 38#define S5P_CLKSRC_CAM S5P_CLKREG(0x0C220)
39#define S5P_CLKSRC_TV S5P_CLKREG(0x0C224)
36#define S5P_CLKSRC_MFC S5P_CLKREG(0x0C228) 40#define S5P_CLKSRC_MFC S5P_CLKREG(0x0C228)
41#define S5P_CLKSRC_G3D S5P_CLKREG(0x0C22C)
37#define S5P_CLKSRC_IMAGE S5P_CLKREG(0x0C230) 42#define S5P_CLKSRC_IMAGE S5P_CLKREG(0x0C230)
38#define S5P_CLKSRC_LCD0 S5P_CLKREG(0x0C234) 43#define S5P_CLKSRC_LCD0 S5P_CLKREG(0x0C234)
39#define S5P_CLKSRC_LCD1 S5P_CLKREG(0x0C238) 44#define S5P_CLKSRC_LCD1 S5P_CLKREG(0x0C238)
@@ -61,6 +66,7 @@
61#define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x0C55C) 66#define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x0C55C)
62#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560) 67#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560)
63#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564) 68#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564)
69#define S5P_CLKDIV2_RATIO S5P_CLKREG(0x0C580)
64 70
65#define S5P_CLKSRC_MASK_TOP S5P_CLKREG(0x0C310) 71#define S5P_CLKSRC_MASK_TOP S5P_CLKREG(0x0C310)
66#define S5P_CLKSRC_MASK_CAM S5P_CLKREG(0x0C320) 72#define S5P_CLKSRC_MASK_CAM S5P_CLKREG(0x0C320)
@@ -120,6 +126,12 @@
120#define S5P_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1) 126#define S5P_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1)
121#define S5P_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1) 127#define S5P_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1)
122 128
129#define S5P_EPLLCON0_ENABLE_SHIFT (31)
130#define S5P_EPLLCON0_LOCKED_SHIFT (29)
131
132#define S5P_VPLLCON0_ENABLE_SHIFT (31)
133#define S5P_VPLLCON0_LOCKED_SHIFT (29)
134
123#define S5P_CLKSRC_CPU_MUXCORE_SHIFT (16) 135#define S5P_CLKSRC_CPU_MUXCORE_SHIFT (16)
124#define S5P_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << S5P_CLKSRC_CPU_MUXCORE_SHIFT) 136#define S5P_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << S5P_CLKSRC_CPU_MUXCORE_SHIFT)
125 137
diff --git a/arch/arm/mach-exynos4/include/mach/regs-pmu.h b/arch/arm/mach-exynos4/include/mach/regs-pmu.h
index a9643371f8e..cdf9b47c303 100644
--- a/arch/arm/mach-exynos4/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos4/include/mach/regs-pmu.h
@@ -29,6 +29,8 @@
29#define S5P_USE_STANDBY_WFE1 (1 << 25) 29#define S5P_USE_STANDBY_WFE1 (1 << 25)
30#define S5P_USE_MASK ((0x3 << 16) | (0x3 << 24)) 30#define S5P_USE_MASK ((0x3 << 16) | (0x3 << 24))
31 31
32#define S5P_SWRESET S5P_PMUREG(0x0400)
33
32#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) 34#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600)
33#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604) 35#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604)
34#define S5P_WAKEUP_MASK S5P_PMUREG(0x0608) 36#define S5P_WAKEUP_MASK S5P_PMUREG(0x0608)
@@ -158,6 +160,7 @@
158#define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0) 160#define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0)
159 161
160#define S5P_PMU_SATA_PHY_CONTROL_EN 0x1 162#define S5P_PMU_SATA_PHY_CONTROL_EN 0x1
163#define S5P_CORE_LOCAL_PWR_EN 0x3
161#define S5P_INT_LOCAL_PWR_EN 0x7 164#define S5P_INT_LOCAL_PWR_EN 0x7
162 165
163#define S5P_CHECK_SLEEP 0x00000BAD 166#define S5P_CHECK_SLEEP 0x00000BAD
diff --git a/arch/arm/mach-exynos4/irq-eint.c b/arch/arm/mach-exynos4/irq-eint.c
index 9d87d2ac7f6..badb8c66fc9 100644
--- a/arch/arm/mach-exynos4/irq-eint.c
+++ b/arch/arm/mach-exynos4/irq-eint.c
@@ -23,6 +23,8 @@
23 23
24#include <mach/regs-gpio.h> 24#include <mach/regs-gpio.h>
25 25
26#include <asm/mach/irq.h>
27
26static DEFINE_SPINLOCK(eint_lock); 28static DEFINE_SPINLOCK(eint_lock);
27 29
28static unsigned int eint0_15_data[16]; 30static unsigned int eint0_15_data[16];
@@ -184,8 +186,11 @@ static inline void exynos4_irq_demux_eint(unsigned int start)
184 186
185static void exynos4_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) 187static void exynos4_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
186{ 188{
189 struct irq_chip *chip = irq_get_chip(irq);
190 chained_irq_enter(chip, desc);
187 exynos4_irq_demux_eint(IRQ_EINT(16)); 191 exynos4_irq_demux_eint(IRQ_EINT(16));
188 exynos4_irq_demux_eint(IRQ_EINT(24)); 192 exynos4_irq_demux_eint(IRQ_EINT(24));
193 chained_irq_exit(chip, desc);
189} 194}
190 195
191static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc) 196static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
@@ -193,6 +198,7 @@ static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
193 u32 *irq_data = irq_get_handler_data(irq); 198 u32 *irq_data = irq_get_handler_data(irq);
194 struct irq_chip *chip = irq_get_chip(irq); 199 struct irq_chip *chip = irq_get_chip(irq);
195 200
201 chained_irq_enter(chip, desc);
196 chip->irq_mask(&desc->irq_data); 202 chip->irq_mask(&desc->irq_data);
197 203
198 if (chip->irq_ack) 204 if (chip->irq_ack)
@@ -201,6 +207,7 @@ static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
201 generic_handle_irq(*irq_data); 207 generic_handle_irq(*irq_data);
202 208
203 chip->irq_unmask(&desc->irq_data); 209 chip->irq_unmask(&desc->irq_data);
210 chained_irq_exit(chip, desc);
204} 211}
205 212
206int __init exynos4_init_irq_eint(void) 213int __init exynos4_init_irq_eint(void)
diff --git a/arch/arm/mach-exynos4/localtimer.c b/arch/arm/mach-exynos4/localtimer.c
deleted file mode 100644
index 6bf3d0ab962..00000000000
--- a/arch/arm/mach-exynos4/localtimer.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/* linux/arch/arm/mach-exynos4/localtimer.c
2 *
3 * Cloned from linux/arch/arm/mach-realview/localtimer.c
4 *
5 * Copyright (C) 2002 ARM Ltd.
6 * All Rights Reserved
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/clockchips.h>
14
15#include <asm/irq.h>
16#include <asm/localtimer.h>
17
18/*
19 * Setup the local clock events for a CPU.
20 */
21int __cpuinit local_timer_setup(struct clock_event_device *evt)
22{
23 evt->irq = IRQ_LOCALTIMER;
24 twd_timer_setup(evt);
25 return 0;
26}
diff --git a/arch/arm/mach-exynos4/mach-nuri.c b/arch/arm/mach-exynos4/mach-nuri.c
index 642702bb5b1..43be71b799c 100644
--- a/arch/arm/mach-exynos4/mach-nuri.c
+++ b/arch/arm/mach-exynos4/mach-nuri.c
@@ -13,10 +13,15 @@
13#include <linux/input.h> 13#include <linux/input.h>
14#include <linux/i2c.h> 14#include <linux/i2c.h>
15#include <linux/i2c/atmel_mxt_ts.h> 15#include <linux/i2c/atmel_mxt_ts.h>
16#include <linux/i2c-gpio.h>
16#include <linux/gpio_keys.h> 17#include <linux/gpio_keys.h>
17#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/power/max8903_charger.h>
20#include <linux/power/max17042_battery.h>
18#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
19#include <linux/regulator/fixed.h> 22#include <linux/regulator/fixed.h>
23#include <linux/mfd/max8997.h>
24#include <linux/mfd/max8997-private.h>
20#include <linux/mmc/host.h> 25#include <linux/mmc/host.h>
21#include <linux/fb.h> 26#include <linux/fb.h>
22#include <linux/pwm_backlight.h> 27#include <linux/pwm_backlight.h>
@@ -26,6 +31,7 @@
26#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
27#include <asm/mach-types.h> 32#include <asm/mach-types.h>
28 33
34#include <plat/adc.h>
29#include <plat/regs-serial.h> 35#include <plat/regs-serial.h>
30#include <plat/exynos4.h> 36#include <plat/exynos4.h>
31#include <plat/cpu.h> 37#include <plat/cpu.h>
@@ -35,6 +41,8 @@
35#include <plat/clock.h> 41#include <plat/clock.h>
36#include <plat/gpio-cfg.h> 42#include <plat/gpio-cfg.h>
37#include <plat/iic.h> 43#include <plat/iic.h>
44#include <plat/mfc.h>
45#include <plat/pd.h>
38 46
39#include <mach/map.h> 47#include <mach/map.h>
40 48
@@ -54,6 +62,7 @@
54 62
55enum fixed_regulator_id { 63enum fixed_regulator_id {
56 FIXED_REG_ID_MMC = 0, 64 FIXED_REG_ID_MMC = 0,
65 FIXED_REG_ID_MAX8903,
57}; 66};
58 67
59static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { 68static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
@@ -344,10 +353,730 @@ static void __init nuri_tsp_init(void)
344 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); 353 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
345} 354}
346 355
356static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
357 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
358};
359static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
360 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
361};
362static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
363 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
364};
365static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
366 REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
367};
368static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
369 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
370};
371static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
372 REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */
373 REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
374};
375static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
376 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
377};
378static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
379 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
380};
381static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
382 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */
383};
384static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
385 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
386};
387static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
388 REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
389};
390static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
391 REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
392};
393static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
394 REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
395};
396static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
397 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
398};
399static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
400 REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
401};
402static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
403 REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
404};
405static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
406 REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
407};
408static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
409 REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
410};
411static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
412 REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
413};
414static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
415 REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
416};
417
418static struct regulator_consumer_supply __initdata max8997_charger_[] = {
419 REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
420};
421static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
422 REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
423};
424
425static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
426 REGULATOR_SUPPLY("gps_clk", "bcm4751"),
427 REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
428 REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
429};
430
431static struct regulator_init_data __initdata max8997_ldo1_data = {
432 .constraints = {
433 .name = "VADC_3.3V_C210",
434 .min_uV = 3300000,
435 .max_uV = 3300000,
436 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
437 .apply_uV = 1,
438 .state_mem = {
439 .disabled = 1,
440 },
441 },
442 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_),
443 .consumer_supplies = max8997_ldo1_,
444};
445
446static struct regulator_init_data __initdata max8997_ldo2_data = {
447 .constraints = {
448 .name = "VALIVE_1.1V_C210",
449 .min_uV = 1100000,
450 .max_uV = 1100000,
451 .apply_uV = 1,
452 .always_on = 1,
453 .state_mem = {
454 .enabled = 1,
455 },
456 },
457};
458
459static struct regulator_init_data __initdata max8997_ldo3_data = {
460 .constraints = {
461 .name = "VUSB_1.1V_C210",
462 .min_uV = 1100000,
463 .max_uV = 1100000,
464 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
465 .apply_uV = 1,
466 .state_mem = {
467 .disabled = 1,
468 },
469 },
470 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
471 .consumer_supplies = max8997_ldo3_,
472};
473
474static struct regulator_init_data __initdata max8997_ldo4_data = {
475 .constraints = {
476 .name = "VMIPI_1.8V",
477 .min_uV = 1800000,
478 .max_uV = 1800000,
479 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
480 .apply_uV = 1,
481 .state_mem = {
482 .disabled = 1,
483 },
484 },
485 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
486 .consumer_supplies = max8997_ldo4_,
487};
488
489static struct regulator_init_data __initdata max8997_ldo5_data = {
490 .constraints = {
491 .name = "VHSIC_1.2V_C210",
492 .min_uV = 1200000,
493 .max_uV = 1200000,
494 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
495 .apply_uV = 1,
496 .state_mem = {
497 .disabled = 1,
498 },
499 },
500 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_),
501 .consumer_supplies = max8997_ldo5_,
502};
503
504static struct regulator_init_data __initdata max8997_ldo6_data = {
505 .constraints = {
506 .name = "VCC_1.8V_PDA",
507 .min_uV = 1800000,
508 .max_uV = 1800000,
509 .apply_uV = 1,
510 .always_on = 1,
511 .state_mem = {
512 .enabled = 1,
513 },
514 },
515};
516
517static struct regulator_init_data __initdata max8997_ldo7_data = {
518 .constraints = {
519 .name = "CAM_ISP_1.8V",
520 .min_uV = 1800000,
521 .max_uV = 1800000,
522 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
523 .apply_uV = 1,
524 .state_mem = {
525 .disabled = 1,
526 },
527 },
528 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
529 .consumer_supplies = max8997_ldo7_,
530};
531
532static struct regulator_init_data __initdata max8997_ldo8_data = {
533 .constraints = {
534 .name = "VUSB/VDAC_3.3V_C210",
535 .min_uV = 3300000,
536 .max_uV = 3300000,
537 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
538 .apply_uV = 1,
539 .state_mem = {
540 .disabled = 1,
541 },
542 },
543 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
544 .consumer_supplies = max8997_ldo8_,
545};
546
547static struct regulator_init_data __initdata max8997_ldo9_data = {
548 .constraints = {
549 .name = "VCC_2.8V_PDA",
550 .min_uV = 2800000,
551 .max_uV = 2800000,
552 .apply_uV = 1,
553 .always_on = 1,
554 .state_mem = {
555 .enabled = 1,
556 },
557 },
558};
559
560static struct regulator_init_data __initdata max8997_ldo10_data = {
561 .constraints = {
562 .name = "VPLL_1.1V_C210",
563 .min_uV = 1100000,
564 .max_uV = 1100000,
565 .apply_uV = 1,
566 .always_on = 1,
567 .state_mem = {
568 .disabled = 1,
569 },
570 },
571};
572
573static struct regulator_init_data __initdata max8997_ldo11_data = {
574 .constraints = {
575 .name = "LVDS_VDD3.3V",
576 .min_uV = 3300000,
577 .max_uV = 3300000,
578 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
579 .apply_uV = 1,
580 .boot_on = 1,
581 .state_mem = {
582 .disabled = 1,
583 },
584 },
585 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
586 .consumer_supplies = max8997_ldo11_,
587};
588
589static struct regulator_init_data __initdata max8997_ldo12_data = {
590 .constraints = {
591 .name = "VT_CAM_1.8V",
592 .min_uV = 1800000,
593 .max_uV = 1800000,
594 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
595 .apply_uV = 1,
596 .state_mem = {
597 .disabled = 1,
598 },
599 },
600 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_),
601 .consumer_supplies = max8997_ldo12_,
602};
603
604static struct regulator_init_data __initdata max8997_ldo13_data = {
605 .constraints = {
606 .name = "VTF_2.8V",
607 .min_uV = 2800000,
608 .max_uV = 2800000,
609 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
610 .apply_uV = 1,
611 .state_mem = {
612 .disabled = 1,
613 },
614 },
615 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
616 .consumer_supplies = max8997_ldo13_,
617};
618
619static struct regulator_init_data __initdata max8997_ldo14_data = {
620 .constraints = {
621 .name = "VCC_3.0V_MOTOR",
622 .min_uV = 3000000,
623 .max_uV = 3000000,
624 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
625 .apply_uV = 1,
626 .state_mem = {
627 .disabled = 1,
628 },
629 },
630 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_),
631 .consumer_supplies = max8997_ldo14_,
632};
633
634static struct regulator_init_data __initdata max8997_ldo15_data = {
635 .constraints = {
636 .name = "VTOUCH_ADVV2.8V",
637 .min_uV = 2800000,
638 .max_uV = 2800000,
639 .apply_uV = 1,
640 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
641 .state_mem = {
642 .disabled = 1,
643 },
644 },
645 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
646 .consumer_supplies = max8997_ldo15_,
647};
648
649static struct regulator_init_data __initdata max8997_ldo16_data = {
650 .constraints = {
651 .name = "CAM_SENSOR_IO_1.8V",
652 .min_uV = 1800000,
653 .max_uV = 1800000,
654 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
655 .apply_uV = 1,
656 .state_mem = {
657 .disabled = 1,
658 },
659 },
660 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
661 .consumer_supplies = max8997_ldo16_,
662};
663
664static struct regulator_init_data __initdata max8997_ldo18_data = {
665 .constraints = {
666 .name = "VTOUCH_VDD2.8V",
667 .min_uV = 2800000,
668 .max_uV = 2800000,
669 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
670 .apply_uV = 1,
671 .state_mem = {
672 .disabled = 1,
673 },
674 },
675 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
676 .consumer_supplies = max8997_ldo18_,
677};
678
679static struct regulator_init_data __initdata max8997_ldo21_data = {
680 .constraints = {
681 .name = "VDDQ_M1M2_1.2V",
682 .min_uV = 1200000,
683 .max_uV = 1200000,
684 .apply_uV = 1,
685 .always_on = 1,
686 .state_mem = {
687 .disabled = 1,
688 },
689 },
690};
691
692static struct regulator_init_data __initdata max8997_buck1_data = {
693 .constraints = {
694 .name = "VARM_1.2V_C210",
695 .min_uV = 900000,
696 .max_uV = 1350000,
697 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
698 .always_on = 1,
699 .state_mem = {
700 .disabled = 1,
701 },
702 },
703 .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
704 .consumer_supplies = max8997_buck1_,
705};
706
707static struct regulator_init_data __initdata max8997_buck2_data = {
708 .constraints = {
709 .name = "VINT_1.1V_C210",
710 .min_uV = 900000,
711 .max_uV = 1100000,
712 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
713 .always_on = 1,
714 .state_mem = {
715 .disabled = 1,
716 },
717 },
718 .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
719 .consumer_supplies = max8997_buck2_,
720};
721
722static struct regulator_init_data __initdata max8997_buck3_data = {
723 .constraints = {
724 .name = "VG3D_1.1V_C210",
725 .min_uV = 900000,
726 .max_uV = 1100000,
727 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
728 REGULATOR_CHANGE_STATUS,
729 .state_mem = {
730 .disabled = 1,
731 },
732 },
733 .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
734 .consumer_supplies = max8997_buck3_,
735};
736
737static struct regulator_init_data __initdata max8997_buck4_data = {
738 .constraints = {
739 .name = "CAM_ISP_CORE_1.2V",
740 .min_uV = 1200000,
741 .max_uV = 1200000,
742 .apply_uV = 1,
743 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
744 .state_mem = {
745 .disabled = 1,
746 },
747 },
748 .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
749 .consumer_supplies = max8997_buck4_,
750};
751
752static struct regulator_init_data __initdata max8997_buck5_data = {
753 .constraints = {
754 .name = "VMEM_1.2V_C210",
755 .min_uV = 1200000,
756 .max_uV = 1200000,
757 .apply_uV = 1,
758 .always_on = 1,
759 .state_mem = {
760 .enabled = 1,
761 },
762 },
763};
764
765static struct regulator_init_data __initdata max8997_buck6_data = {
766 .constraints = {
767 .name = "CAM_AF_2.8V",
768 .min_uV = 2800000,
769 .max_uV = 2800000,
770 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
771 .state_mem = {
772 .disabled = 1,
773 },
774 },
775 .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
776 .consumer_supplies = max8997_buck6_,
777};
778
779static struct regulator_init_data __initdata max8997_buck7_data = {
780 .constraints = {
781 .name = "VCC_SUB_2.0V",
782 .min_uV = 2000000,
783 .max_uV = 2000000,
784 .apply_uV = 1,
785 .always_on = 1,
786 .state_mem = {
787 .enabled = 1,
788 },
789 },
790};
791
792static struct regulator_init_data __initdata max8997_32khz_ap_data = {
793 .constraints = {
794 .name = "32KHz AP",
795 .always_on = 1,
796 .state_mem = {
797 .enabled = 1,
798 },
799 },
800 .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
801 .consumer_supplies = max8997_32khz_ap_,
802};
803
804static struct regulator_init_data __initdata max8997_32khz_cp_data = {
805 .constraints = {
806 .name = "32KHz CP",
807 .state_mem = {
808 .disabled = 1,
809 },
810 },
811};
812
813static struct regulator_init_data __initdata max8997_vichg_data = {
814 .constraints = {
815 .name = "VICHG",
816 .state_mem = {
817 .disabled = 1,
818 },
819 },
820};
821
822static struct regulator_init_data __initdata max8997_esafeout1_data = {
823 .constraints = {
824 .name = "SAFEOUT1",
825 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
826 .state_mem = {
827 .disabled = 1,
828 },
829 },
830 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
831 .consumer_supplies = max8997_esafeout1_,
832};
833
834static struct regulator_init_data __initdata max8997_esafeout2_data = {
835 .constraints = {
836 .name = "SAFEOUT2",
837 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
838 .state_mem = {
839 .disabled = 1,
840 },
841 },
842 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
843 .consumer_supplies = max8997_esafeout2_,
844};
845
846static struct regulator_init_data __initdata max8997_charger_cv_data = {
847 .constraints = {
848 .name = "CHARGER_CV",
849 .min_uV = 4200000,
850 .max_uV = 4200000,
851 .apply_uV = 1,
852 },
853};
854
855static struct regulator_init_data __initdata max8997_charger_data = {
856 .constraints = {
857 .name = "CHARGER",
858 .min_uA = 200000,
859 .max_uA = 950000,
860 .boot_on = 1,
861 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
862 REGULATOR_CHANGE_CURRENT,
863 },
864 .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
865 .consumer_supplies = max8997_charger_,
866};
867
868static struct regulator_init_data __initdata max8997_charger_topoff_data = {
869 .constraints = {
870 .name = "CHARGER TOPOFF",
871 .min_uA = 50000,
872 .max_uA = 200000,
873 .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
874 },
875 .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
876 .consumer_supplies = max8997_chg_toff_,
877};
878
879static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
880 { MAX8997_LDO1, &max8997_ldo1_data },
881 { MAX8997_LDO2, &max8997_ldo2_data },
882 { MAX8997_LDO3, &max8997_ldo3_data },
883 { MAX8997_LDO4, &max8997_ldo4_data },
884 { MAX8997_LDO5, &max8997_ldo5_data },
885 { MAX8997_LDO6, &max8997_ldo6_data },
886 { MAX8997_LDO7, &max8997_ldo7_data },
887 { MAX8997_LDO8, &max8997_ldo8_data },
888 { MAX8997_LDO9, &max8997_ldo9_data },
889 { MAX8997_LDO10, &max8997_ldo10_data },
890 { MAX8997_LDO11, &max8997_ldo11_data },
891 { MAX8997_LDO12, &max8997_ldo12_data },
892 { MAX8997_LDO13, &max8997_ldo13_data },
893 { MAX8997_LDO14, &max8997_ldo14_data },
894 { MAX8997_LDO15, &max8997_ldo15_data },
895 { MAX8997_LDO16, &max8997_ldo16_data },
896
897 { MAX8997_LDO18, &max8997_ldo18_data },
898 { MAX8997_LDO21, &max8997_ldo21_data },
899
900 { MAX8997_BUCK1, &max8997_buck1_data },
901 { MAX8997_BUCK2, &max8997_buck2_data },
902 { MAX8997_BUCK3, &max8997_buck3_data },
903 { MAX8997_BUCK4, &max8997_buck4_data },
904 { MAX8997_BUCK5, &max8997_buck5_data },
905 { MAX8997_BUCK6, &max8997_buck6_data },
906 { MAX8997_BUCK7, &max8997_buck7_data },
907
908 { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
909 { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
910
911 { MAX8997_ENVICHG, &max8997_vichg_data },
912 { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
913 { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
914 { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
915 { MAX8997_CHARGER, &max8997_charger_data },
916 { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
917};
918
919static struct max8997_platform_data __initdata nuri_max8997_pdata = {
920 .wakeup = 1,
921
922 .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
923 .regulators = nuri_max8997_regulators,
924
925 .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
926 .buck2_gpiodvs = true,
927
928 .buck1_voltage[0] = 1350000, /* 1.35V */
929 .buck1_voltage[1] = 1300000, /* 1.3V */
930 .buck1_voltage[2] = 1250000, /* 1.25V */
931 .buck1_voltage[3] = 1200000, /* 1.2V */
932 .buck1_voltage[4] = 1150000, /* 1.15V */
933 .buck1_voltage[5] = 1100000, /* 1.1V */
934 .buck1_voltage[6] = 1000000, /* 1.0V */
935 .buck1_voltage[7] = 950000, /* 0.95V */
936
937 .buck2_voltage[0] = 1100000, /* 1.1V */
938 .buck2_voltage[1] = 1000000, /* 1.0V */
939 .buck2_voltage[2] = 950000, /* 0.95V */
940 .buck2_voltage[3] = 900000, /* 0.9V */
941 .buck2_voltage[4] = 1100000, /* 1.1V */
942 .buck2_voltage[5] = 1000000, /* 1.0V */
943 .buck2_voltage[6] = 950000, /* 0.95V */
944 .buck2_voltage[7] = 900000, /* 0.9V */
945
946 .buck5_voltage[0] = 1200000, /* 1.2V */
947 .buck5_voltage[1] = 1200000, /* 1.2V */
948 .buck5_voltage[2] = 1200000, /* 1.2V */
949 .buck5_voltage[3] = 1200000, /* 1.2V */
950 .buck5_voltage[4] = 1200000, /* 1.2V */
951 .buck5_voltage[5] = 1200000, /* 1.2V */
952 .buck5_voltage[6] = 1200000, /* 1.2V */
953 .buck5_voltage[7] = 1200000, /* 1.2V */
954};
955
347/* GPIO I2C 5 (PMIC) */ 956/* GPIO I2C 5 (PMIC) */
957enum { I2C5_MAX8997 };
348static struct i2c_board_info i2c5_devs[] __initdata = { 958static struct i2c_board_info i2c5_devs[] __initdata = {
349 /* max8997, To be updated */ 959 [I2C5_MAX8997] = {
960 I2C_BOARD_INFO("max8997", 0xCC >> 1),
961 .platform_data = &nuri_max8997_pdata,
962 },
963};
964
965static struct max17042_platform_data nuri_battery_platform_data = {
966};
967
968/* GPIO I2C 9 (Fuel Gauge) */
969static struct i2c_gpio_platform_data i2c9_gpio_data = {
970 .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
971 .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
972};
973static struct platform_device i2c9_gpio = {
974 .name = "i2c-gpio",
975 .id = 9,
976 .dev = {
977 .platform_data = &i2c9_gpio_data,
978 },
350}; 979};
980enum { I2C9_MAX17042};
981static struct i2c_board_info i2c9_devs[] __initdata = {
982 [I2C9_MAX17042] = {
983 I2C_BOARD_INFO("max17042", 0x36),
984 .platform_data = &nuri_battery_platform_data,
985 },
986};
987
988/* MAX8903 Secondary Charger */
989static struct regulator_consumer_supply supplies_max8903[] = {
990 REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
991};
992
993static struct regulator_init_data max8903_charger_en_data = {
994 .constraints = {
995 .name = "VOUT_CHARGER",
996 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
997 .boot_on = 1,
998 },
999 .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
1000 .consumer_supplies = supplies_max8903,
1001};
1002
1003static struct fixed_voltage_config max8903_charger_en = {
1004 .supply_name = "VOUT_CHARGER",
1005 .microvolts = 5000000, /* Assume 5VDC */
1006 .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
1007 .enable_high = 0, /* Enable = Low */
1008 .enabled_at_boot = 1,
1009 .init_data = &max8903_charger_en_data,
1010};
1011
1012static struct platform_device max8903_fixed_reg_dev = {
1013 .name = "reg-fixed-voltage",
1014 .id = FIXED_REG_ID_MAX8903,
1015 .dev = { .platform_data = &max8903_charger_en },
1016};
1017
1018static struct max8903_pdata nuri_max8903 = {
1019 /*
1020 * cen: don't control with the driver, let it be
1021 * controlled by regulator above
1022 */
1023 .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
1024 /* uok, usus: not connected */
1025 .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
1026 /* flt: vcc_1.8V_pda */
1027 .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
1028
1029 .dc_valid = true,
1030 .usb_valid = false, /* USB is not wired to MAX8903 */
1031};
1032
1033static struct platform_device nuri_max8903_device = {
1034 .name = "max8903-charger",
1035 .dev = {
1036 .platform_data = &nuri_max8903,
1037 },
1038};
1039
1040static struct device *nuri_cm_devices[] = {
1041 &s3c_device_i2c5.dev,
1042 &s3c_device_adc.dev,
1043 NULL, /* Reserved for UART */
1044 NULL,
1045};
1046
1047static void __init nuri_power_init(void)
1048{
1049 int gpio;
1050 int irq_base = IRQ_GPIO_END + 1;
1051 int ta_en = 0;
1052
1053 nuri_max8997_pdata.irq_base = irq_base;
1054 irq_base += MAX8997_IRQ_NR;
1055
1056 gpio = EXYNOS4_GPX0(7);
1057 gpio_request(gpio, "AP_PMIC_IRQ");
1058 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1059 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1060
1061 gpio = EXYNOS4_GPX2(3);
1062 gpio_request(gpio, "FUEL_ALERT");
1063 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1064 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1065
1066 gpio = nuri_max8903.dok;
1067 gpio_request(gpio, "TA_nCONNECTED");
1068 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1069 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1070 ta_en = gpio_get_value(gpio) ? 0 : 1;
1071
1072 gpio = nuri_max8903.chg;
1073 gpio_request(gpio, "TA_nCHG");
1074 gpio_direction_input(gpio);
1075
1076 gpio = nuri_max8903.dcm;
1077 gpio_request(gpio, "CURR_ADJ");
1078 gpio_direction_output(gpio, ta_en);
1079}
351 1080
352/* USB EHCI */ 1081/* USB EHCI */
353static struct s5p_ehci_platdata nuri_ehci_pdata; 1082static struct s5p_ehci_platdata nuri_ehci_pdata;
@@ -361,6 +1090,7 @@ static void __init nuri_ehci_init(void)
361 1090
362static struct platform_device *nuri_devices[] __initdata = { 1091static struct platform_device *nuri_devices[] __initdata = {
363 /* Samsung Platform Devices */ 1092 /* Samsung Platform Devices */
1093 &s3c_device_i2c5, /* PMIC should initialize first */
364 &emmc_fixed_voltage, 1094 &emmc_fixed_voltage,
365 &s3c_device_hsmmc0, 1095 &s3c_device_hsmmc0,
366 &s3c_device_hsmmc2, 1096 &s3c_device_hsmmc2,
@@ -369,11 +1099,20 @@ static struct platform_device *nuri_devices[] __initdata = {
369 &s3c_device_timer[0], 1099 &s3c_device_timer[0],
370 &s5p_device_ehci, 1100 &s5p_device_ehci,
371 &s3c_device_i2c3, 1101 &s3c_device_i2c3,
1102 &i2c9_gpio,
1103 &s3c_device_adc,
1104 &s3c_device_rtc,
1105 &s5p_device_mfc,
1106 &s5p_device_mfc_l,
1107 &s5p_device_mfc_r,
1108 &exynos4_device_pd[PD_MFC],
372 1109
373 /* NURI Devices */ 1110 /* NURI Devices */
374 &nuri_gpio_keys, 1111 &nuri_gpio_keys,
375 &nuri_lcd_device, 1112 &nuri_lcd_device,
376 &nuri_backlight_device, 1113 &nuri_backlight_device,
1114 &max8903_fixed_reg_dev,
1115 &nuri_max8903_device,
377}; 1116};
378 1117
379static void __init nuri_map_io(void) 1118static void __init nuri_map_io(void)
@@ -383,21 +1122,32 @@ static void __init nuri_map_io(void)
383 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); 1122 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
384} 1123}
385 1124
1125static void __init nuri_reserve(void)
1126{
1127 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
1128}
1129
386static void __init nuri_machine_init(void) 1130static void __init nuri_machine_init(void)
387{ 1131{
388 nuri_sdhci_init(); 1132 nuri_sdhci_init();
389 nuri_tsp_init(); 1133 nuri_tsp_init();
1134 nuri_power_init();
390 1135
391 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); 1136 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
392 s3c_i2c3_set_platdata(&i2c3_data); 1137 s3c_i2c3_set_platdata(&i2c3_data);
393 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); 1138 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
1139 s3c_i2c5_set_platdata(NULL);
1140 i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
394 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); 1141 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
1142 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
1143 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
395 1144
396 nuri_ehci_init(); 1145 nuri_ehci_init();
397 clk_xusbxti.rate = 24000000; 1146 clk_xusbxti.rate = 24000000;
398 1147
399 /* Last */ 1148 /* Last */
400 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); 1149 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
1150 s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
401} 1151}
402 1152
403MACHINE_START(NURI, "NURI") 1153MACHINE_START(NURI, "NURI")
@@ -407,4 +1157,5 @@ MACHINE_START(NURI, "NURI")
407 .map_io = nuri_map_io, 1157 .map_io = nuri_map_io,
408 .init_machine = nuri_machine_init, 1158 .init_machine = nuri_machine_init,
409 .timer = &exynos4_timer, 1159 .timer = &exynos4_timer,
1160 .reserve = &nuri_reserve,
410MACHINE_END 1161MACHINE_END
diff --git a/arch/arm/mach-exynos4/mach-smdkc210.c b/arch/arm/mach-exynos4/mach-smdkc210.c
index f606ea75bf4..a7c65e05c1e 100644
--- a/arch/arm/mach-exynos4/mach-smdkc210.c
+++ b/arch/arm/mach-exynos4/mach-smdkc210.c
@@ -9,7 +9,9 @@
9*/ 9*/
10 10
11#include <linux/serial_core.h> 11#include <linux/serial_core.h>
12#include <linux/delay.h>
12#include <linux/gpio.h> 13#include <linux/gpio.h>
14#include <linux/lcd.h>
13#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
14#include <linux/platform_device.h> 16#include <linux/platform_device.h>
15#include <linux/smsc911x.h> 17#include <linux/smsc911x.h>
@@ -20,11 +22,15 @@
20#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
21#include <asm/mach-types.h> 23#include <asm/mach-types.h>
22 24
25#include <video/platform_lcd.h>
26
23#include <plat/regs-serial.h> 27#include <plat/regs-serial.h>
24#include <plat/regs-srom.h> 28#include <plat/regs-srom.h>
29#include <plat/regs-fb-v4.h>
25#include <plat/exynos4.h> 30#include <plat/exynos4.h>
26#include <plat/cpu.h> 31#include <plat/cpu.h>
27#include <plat/devs.h> 32#include <plat/devs.h>
33#include <plat/fb.h>
28#include <plat/sdhci.h> 34#include <plat/sdhci.h>
29#include <plat/iic.h> 35#include <plat/iic.h>
30#include <plat/pd.h> 36#include <plat/pd.h>
@@ -114,6 +120,67 @@ static struct s3c_sdhci_platdata smdkc210_hsmmc3_pdata __initdata = {
114 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, 120 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
115}; 121};
116 122
123static void lcd_lte480wv_set_power(struct plat_lcd_data *pd,
124 unsigned int power)
125{
126 if (power) {
127#if !defined(CONFIG_BACKLIGHT_PWM)
128 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0");
129 gpio_free(EXYNOS4_GPD0(1));
130#endif
131 /* fire nRESET on power up */
132 gpio_request(EXYNOS4_GPX0(6), "GPX0");
133
134 gpio_direction_output(EXYNOS4_GPX0(6), 1);
135 mdelay(100);
136
137 gpio_set_value(EXYNOS4_GPX0(6), 0);
138 mdelay(10);
139
140 gpio_set_value(EXYNOS4_GPX0(6), 1);
141 mdelay(10);
142
143 gpio_free(EXYNOS4_GPX0(6));
144 } else {
145#if !defined(CONFIG_BACKLIGHT_PWM)
146 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0");
147 gpio_free(EXYNOS4_GPD0(1));
148#endif
149 }
150}
151
152static struct plat_lcd_data smdkc210_lcd_lte480wv_data = {
153 .set_power = lcd_lte480wv_set_power,
154};
155
156static struct platform_device smdkc210_lcd_lte480wv = {
157 .name = "platform-lcd",
158 .dev.parent = &s5p_device_fimd0.dev,
159 .dev.platform_data = &smdkc210_lcd_lte480wv_data,
160};
161
162static struct s3c_fb_pd_win smdkc210_fb_win0 = {
163 .win_mode = {
164 .left_margin = 13,
165 .right_margin = 8,
166 .upper_margin = 7,
167 .lower_margin = 5,
168 .hsync_len = 3,
169 .vsync_len = 1,
170 .xres = 800,
171 .yres = 480,
172 },
173 .max_bpp = 32,
174 .default_bpp = 24,
175};
176
177static struct s3c_fb_platdata smdkc210_lcd0_pdata __initdata = {
178 .win[0] = &smdkc210_fb_win0,
179 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
180 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
181 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
182};
183
117static struct resource smdkc210_smsc911x_resources[] = { 184static struct resource smdkc210_smsc911x_resources[] = {
118 [0] = { 185 [0] = {
119 .start = EXYNOS4_PA_SROM_BANK(1), 186 .start = EXYNOS4_PA_SROM_BANK(1),
@@ -168,6 +235,8 @@ static struct platform_device *smdkc210_devices[] __initdata = {
168 &exynos4_device_pd[PD_GPS], 235 &exynos4_device_pd[PD_GPS],
169 &exynos4_device_sysmmu, 236 &exynos4_device_sysmmu,
170 &samsung_asoc_dma, 237 &samsung_asoc_dma,
238 &s5p_device_fimd0,
239 &smdkc210_lcd_lte480wv,
171 &smdkc210_smsc911x, 240 &smdkc210_smsc911x,
172}; 241};
173 242
@@ -225,6 +294,7 @@ static void __init smdkc210_machine_init(void)
225 s3c_sdhci3_set_platdata(&smdkc210_hsmmc3_pdata); 294 s3c_sdhci3_set_platdata(&smdkc210_hsmmc3_pdata);
226 295
227 samsung_bl_set(&smdkc210_bl_gpio_info, &smdkc210_bl_data); 296 samsung_bl_set(&smdkc210_bl_gpio_info, &smdkc210_bl_data);
297 s5p_fimd0_set_platdata(&smdkc210_lcd0_pdata);
228 298
229 platform_add_devices(smdkc210_devices, ARRAY_SIZE(smdkc210_devices)); 299 platform_add_devices(smdkc210_devices, ARRAY_SIZE(smdkc210_devices));
230} 300}
diff --git a/arch/arm/mach-exynos4/mach-smdkv310.c b/arch/arm/mach-exynos4/mach-smdkv310.c
index df1107828ab..ea414955686 100644
--- a/arch/arm/mach-exynos4/mach-smdkv310.c
+++ b/arch/arm/mach-exynos4/mach-smdkv310.c
@@ -184,9 +184,12 @@ static struct platform_device *smdkv310_devices[] __initdata = {
184 &exynos4_device_pd[PD_CAM], 184 &exynos4_device_pd[PD_CAM],
185 &exynos4_device_pd[PD_TV], 185 &exynos4_device_pd[PD_TV],
186 &exynos4_device_pd[PD_GPS], 186 &exynos4_device_pd[PD_GPS],
187 &exynos4_device_spdif,
187 &exynos4_device_sysmmu, 188 &exynos4_device_sysmmu,
188 &samsung_asoc_dma, 189 &samsung_asoc_dma,
190 &samsung_asoc_idma,
189 &smdkv310_smsc911x, 191 &smdkv310_smsc911x,
192 &exynos4_device_ahci,
190}; 193};
191 194
192static void __init smdkv310_smsc911x_init(void) 195static void __init smdkv310_smsc911x_init(void)
diff --git a/arch/arm/mach-exynos4/mach-universal_c210.c b/arch/arm/mach-exynos4/mach-universal_c210.c
index 97d329fff2c..b3b5d891100 100644
--- a/arch/arm/mach-exynos4/mach-universal_c210.c
+++ b/arch/arm/mach-exynos4/mach-universal_c210.c
@@ -18,6 +18,9 @@
18#include <linux/regulator/fixed.h> 18#include <linux/regulator/fixed.h>
19#include <linux/regulator/max8952.h> 19#include <linux/regulator/max8952.h>
20#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
21#include <linux/i2c-gpio.h>
22#include <linux/i2c/mcs.h>
23#include <linux/i2c/atmel_mxt_ts.h>
21 24
22#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
23#include <asm/mach-types.h> 26#include <asm/mach-types.h>
@@ -27,7 +30,10 @@
27#include <plat/cpu.h> 30#include <plat/cpu.h>
28#include <plat/devs.h> 31#include <plat/devs.h>
29#include <plat/iic.h> 32#include <plat/iic.h>
33#include <plat/gpio-cfg.h>
34#include <plat/mfc.h>
30#include <plat/sdhci.h> 35#include <plat/sdhci.h>
36#include <plat/pd.h>
31 37
32#include <mach/map.h> 38#include <mach/map.h>
33 39
@@ -73,7 +79,7 @@ static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
73}; 79};
74 80
75static struct regulator_consumer_supply max8952_consumer = 81static struct regulator_consumer_supply max8952_consumer =
76 REGULATOR_SUPPLY("vddarm", NULL); 82 REGULATOR_SUPPLY("vdd_arm", NULL);
77 83
78static struct max8952_platform_data universal_max8952_pdata __initdata = { 84static struct max8952_platform_data universal_max8952_pdata __initdata = {
79 .gpio_vid0 = EXYNOS4_GPX0(3), 85 .gpio_vid0 = EXYNOS4_GPX0(3),
@@ -99,7 +105,7 @@ static struct max8952_platform_data universal_max8952_pdata __initdata = {
99}; 105};
100 106
101static struct regulator_consumer_supply lp3974_buck1_consumer = 107static struct regulator_consumer_supply lp3974_buck1_consumer =
102 REGULATOR_SUPPLY("vddint", NULL); 108 REGULATOR_SUPPLY("vdd_int", NULL);
103 109
104static struct regulator_consumer_supply lp3974_buck2_consumer = 110static struct regulator_consumer_supply lp3974_buck2_consumer =
105 REGULATOR_SUPPLY("vddg3d", NULL); 111 REGULATOR_SUPPLY("vddg3d", NULL);
@@ -477,6 +483,96 @@ static struct i2c_board_info i2c5_devs[] __initdata = {
477 }, 483 },
478}; 484};
479 485
486/* I2C3 (TSP) */
487static struct mxt_platform_data qt602240_platform_data = {
488 .x_line = 19,
489 .y_line = 11,
490 .x_size = 800,
491 .y_size = 480,
492 .blen = 0x11,
493 .threshold = 0x28,
494 .voltage = 2800000, /* 2.8V */
495 .orient = MXT_DIAGONAL,
496};
497
498static struct i2c_board_info i2c3_devs[] __initdata = {
499 {
500 I2C_BOARD_INFO("qt602240_ts", 0x4a),
501 .platform_data = &qt602240_platform_data,
502 },
503};
504
505static void __init universal_tsp_init(void)
506{
507 int gpio;
508
509 /* TSP_LDO_ON: XMDMADDR_11 */
510 gpio = EXYNOS4_GPE2(3);
511 gpio_request(gpio, "TSP_LDO_ON");
512 gpio_direction_output(gpio, 1);
513 gpio_export(gpio, 0);
514
515 /* TSP_INT: XMDMADDR_7 */
516 gpio = EXYNOS4_GPE1(7);
517 gpio_request(gpio, "TSP_INT");
518
519 s5p_register_gpio_interrupt(gpio);
520 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
521 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
522 i2c3_devs[0].irq = gpio_to_irq(gpio);
523}
524
525
526/* GPIO I2C 12 (3 Touchkey) */
527static uint32_t touchkey_keymap[] = {
528 /* MCS_KEY_MAP(value, keycode) */
529 MCS_KEY_MAP(0, KEY_MENU), /* KEY_SEND */
530 MCS_KEY_MAP(1, KEY_BACK), /* KEY_END */
531};
532
533static struct mcs_platform_data touchkey_data = {
534 .keymap = touchkey_keymap,
535 .keymap_size = ARRAY_SIZE(touchkey_keymap),
536 .key_maxval = 2,
537};
538
539/* GPIO I2C 3_TOUCH 2.8V */
540#define I2C_GPIO_BUS_12 12
541static struct i2c_gpio_platform_data i2c_gpio12_data = {
542 .sda_pin = EXYNOS4_GPE4(0), /* XMDMDATA_8 */
543 .scl_pin = EXYNOS4_GPE4(1), /* XMDMDATA_9 */
544};
545
546static struct platform_device i2c_gpio12 = {
547 .name = "i2c-gpio",
548 .id = I2C_GPIO_BUS_12,
549 .dev = {
550 .platform_data = &i2c_gpio12_data,
551 },
552};
553
554static struct i2c_board_info i2c_gpio12_devs[] __initdata = {
555 {
556 I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
557 .platform_data = &touchkey_data,
558 },
559};
560
561static void __init universal_touchkey_init(void)
562{
563 int gpio;
564
565 gpio = EXYNOS4_GPE3(7); /* XMDMDATA_7 */
566 gpio_request(gpio, "3_TOUCH_INT");
567 s5p_register_gpio_interrupt(gpio);
568 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
569 i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
570
571 gpio = EXYNOS4_GPE3(3); /* XMDMDATA_3 */
572 gpio_request(gpio, "3_TOUCH_EN");
573 gpio_direction_output(gpio, 1);
574}
575
480/* GPIO KEYS */ 576/* GPIO KEYS */
481static struct gpio_keys_button universal_gpio_keys_tables[] = { 577static struct gpio_keys_button universal_gpio_keys_tables[] = {
482 { 578 {
@@ -608,15 +704,25 @@ static struct i2c_board_info i2c1_devs[] __initdata = {
608 704
609static struct platform_device *universal_devices[] __initdata = { 705static struct platform_device *universal_devices[] __initdata = {
610 /* Samsung Platform Devices */ 706 /* Samsung Platform Devices */
707 &s5p_device_fimc0,
708 &s5p_device_fimc1,
709 &s5p_device_fimc2,
710 &s5p_device_fimc3,
611 &mmc0_fixed_voltage, 711 &mmc0_fixed_voltage,
612 &s3c_device_hsmmc0, 712 &s3c_device_hsmmc0,
613 &s3c_device_hsmmc2, 713 &s3c_device_hsmmc2,
614 &s3c_device_hsmmc3, 714 &s3c_device_hsmmc3,
715 &s3c_device_i2c3,
615 &s3c_device_i2c5, 716 &s3c_device_i2c5,
616 717
617 /* Universal Devices */ 718 /* Universal Devices */
719 &i2c_gpio12,
618 &universal_gpio_keys, 720 &universal_gpio_keys,
619 &s5p_device_onenand, 721 &s5p_device_onenand,
722 &s5p_device_mfc,
723 &s5p_device_mfc_l,
724 &s5p_device_mfc_r,
725 &exynos4_device_pd[PD_MFC],
620}; 726};
621 727
622static void __init universal_map_io(void) 728static void __init universal_map_io(void)
@@ -626,6 +732,11 @@ static void __init universal_map_io(void)
626 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); 732 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
627} 733}
628 734
735static void __init universal_reserve(void)
736{
737 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
738}
739
629static void __init universal_machine_init(void) 740static void __init universal_machine_init(void)
630{ 741{
631 universal_sdhci_init(); 742 universal_sdhci_init();
@@ -633,11 +744,20 @@ static void __init universal_machine_init(void)
633 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs)); 744 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
634 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); 745 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
635 746
747 universal_tsp_init();
748 s3c_i2c3_set_platdata(NULL);
749 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
750
636 s3c_i2c5_set_platdata(NULL); 751 s3c_i2c5_set_platdata(NULL);
637 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); 752 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
638 753
754 universal_touchkey_init();
755 i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
756 ARRAY_SIZE(i2c_gpio12_devs));
757
639 /* Last */ 758 /* Last */
640 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices)); 759 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
760 s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
641} 761}
642 762
643MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") 763MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
@@ -647,4 +767,5 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
647 .map_io = universal_map_io, 767 .map_io = universal_map_io,
648 .init_machine = universal_machine_init, 768 .init_machine = universal_machine_init,
649 .timer = &exynos4_timer, 769 .timer = &exynos4_timer,
770 .reserve = &universal_reserve,
650MACHINE_END 771MACHINE_END
diff --git a/arch/arm/mach-exynos4/mct.c b/arch/arm/mach-exynos4/mct.c
index 14ac10b7ec0..1ae059b7ad7 100644
--- a/arch/arm/mach-exynos4/mct.c
+++ b/arch/arm/mach-exynos4/mct.c
@@ -383,8 +383,8 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)
383 setup_irq(IRQ_MCT_L0, &mct_tick0_event_irq); 383 setup_irq(IRQ_MCT_L0, &mct_tick0_event_irq);
384 } else { 384 } else {
385 mct_tick1_event_irq.dev_id = &mct_tick[cpu]; 385 mct_tick1_event_irq.dev_id = &mct_tick[cpu];
386 irq_set_affinity(IRQ_MCT1, cpumask_of(1));
387 setup_irq(IRQ_MCT_L1, &mct_tick1_event_irq); 386 setup_irq(IRQ_MCT_L1, &mct_tick1_event_irq);
387 irq_set_affinity(IRQ_MCT_L1, cpumask_of(1));
388 } 388 }
389} 389}
390 390
diff --git a/arch/arm/mach-exynos4/platsmp.c b/arch/arm/mach-exynos4/platsmp.c
index b68d5bdf04c..7c2282c6ba8 100644
--- a/arch/arm/mach-exynos4/platsmp.c
+++ b/arch/arm/mach-exynos4/platsmp.c
@@ -28,9 +28,12 @@
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/regs-clock.h> 30#include <mach/regs-clock.h>
31#include <mach/regs-pmu.h>
31 32
32extern void exynos4_secondary_startup(void); 33extern void exynos4_secondary_startup(void);
33 34
35#define CPU1_BOOT_REG S5P_VA_SYSRAM
36
34/* 37/*
35 * control for which core is the next to come out of the secondary 38 * control for which core is the next to come out of the secondary
36 * boot "holding pen" 39 * boot "holding pen"
@@ -58,6 +61,31 @@ static void __iomem *scu_base_addr(void)
58 61
59static DEFINE_SPINLOCK(boot_lock); 62static DEFINE_SPINLOCK(boot_lock);
60 63
64static void __cpuinit exynos4_gic_secondary_init(void)
65{
66 void __iomem *dist_base = S5P_VA_GIC_DIST +
67 (EXYNOS4_GIC_BANK_OFFSET * smp_processor_id());
68 void __iomem *cpu_base = S5P_VA_GIC_CPU +
69 (EXYNOS4_GIC_BANK_OFFSET * smp_processor_id());
70 int i;
71
72 /*
73 * Deal with the banked PPI and SGI interrupts - disable all
74 * PPI interrupts, ensure all SGI interrupts are enabled.
75 */
76 __raw_writel(0xffff0000, dist_base + GIC_DIST_ENABLE_CLEAR);
77 __raw_writel(0x0000ffff, dist_base + GIC_DIST_ENABLE_SET);
78
79 /*
80 * Set priority on PPI and SGI interrupts
81 */
82 for (i = 0; i < 32; i += 4)
83 __raw_writel(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 4);
84
85 __raw_writel(0xf0, cpu_base + GIC_CPU_PRIMASK);
86 __raw_writel(1, cpu_base + GIC_CPU_CTRL);
87}
88
61void __cpuinit platform_secondary_init(unsigned int cpu) 89void __cpuinit platform_secondary_init(unsigned int cpu)
62{ 90{
63 /* 91 /*
@@ -65,7 +93,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
65 * core (e.g. timer irq), then they will not have been enabled 93 * core (e.g. timer irq), then they will not have been enabled
66 * for us: do so 94 * for us: do so
67 */ 95 */
68 gic_secondary_init(0); 96 exynos4_gic_secondary_init();
69 97
70 /* 98 /*
71 * let the primary processor know we're out of the 99 * let the primary processor know we're out of the
@@ -100,16 +128,41 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
100 */ 128 */
101 write_pen_release(cpu); 129 write_pen_release(cpu);
102 130
131 if (!(__raw_readl(S5P_ARM_CORE1_STATUS) & S5P_CORE_LOCAL_PWR_EN)) {
132 __raw_writel(S5P_CORE_LOCAL_PWR_EN,
133 S5P_ARM_CORE1_CONFIGURATION);
134
135 timeout = 10;
136
137 /* wait max 10 ms until cpu1 is on */
138 while ((__raw_readl(S5P_ARM_CORE1_STATUS)
139 & S5P_CORE_LOCAL_PWR_EN) != S5P_CORE_LOCAL_PWR_EN) {
140 if (timeout-- == 0)
141 break;
142
143 mdelay(1);
144 }
145
146 if (timeout == 0) {
147 printk(KERN_ERR "cpu1 power enable failed");
148 spin_unlock(&boot_lock);
149 return -ETIMEDOUT;
150 }
151 }
103 /* 152 /*
104 * Send the secondary CPU a soft interrupt, thereby causing 153 * Send the secondary CPU a soft interrupt, thereby causing
105 * the boot monitor to read the system wide flags register, 154 * the boot monitor to read the system wide flags register,
106 * and branch to the address found there. 155 * and branch to the address found there.
107 */ 156 */
108 gic_raise_softirq(cpumask_of(cpu), 1);
109 157
110 timeout = jiffies + (1 * HZ); 158 timeout = jiffies + (1 * HZ);
111 while (time_before(jiffies, timeout)) { 159 while (time_before(jiffies, timeout)) {
112 smp_rmb(); 160 smp_rmb();
161
162 __raw_writel(BSYM(virt_to_phys(exynos4_secondary_startup)),
163 CPU1_BOOT_REG);
164 gic_raise_softirq(cpumask_of(cpu), 1);
165
113 if (pen_release == -1) 166 if (pen_release == -1)
114 break; 167 break;
115 168
diff --git a/arch/arm/mach-exynos4/pm.c b/arch/arm/mach-exynos4/pm.c
index 533c28f758c..bc6ca9482de 100644
--- a/arch/arm/mach-exynos4/pm.c
+++ b/arch/arm/mach-exynos4/pm.c
@@ -18,92 +18,23 @@
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/syscore_ops.h> 19#include <linux/syscore_ops.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/err.h>
22#include <linux/clk.h>
21 23
22#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
23#include <asm/hardware/cache-l2x0.h> 25#include <asm/hardware/cache-l2x0.h>
24 26
25#include <plat/cpu.h> 27#include <plat/cpu.h>
26#include <plat/pm.h> 28#include <plat/pm.h>
29#include <plat/pll.h>
30#include <plat/regs-srom.h>
27 31
28#include <mach/regs-irq.h> 32#include <mach/regs-irq.h>
29#include <mach/regs-gpio.h> 33#include <mach/regs-gpio.h>
30#include <mach/regs-clock.h> 34#include <mach/regs-clock.h>
31#include <mach/regs-pmu.h> 35#include <mach/regs-pmu.h>
32#include <mach/pm-core.h> 36#include <mach/pm-core.h>
33 37#include <mach/pmu.h>
34static struct sleep_save exynos4_sleep[] = {
35 { .reg = S5P_ARM_CORE0_LOWPWR , .val = 0x2, },
36 { .reg = S5P_DIS_IRQ_CORE0 , .val = 0x0, },
37 { .reg = S5P_DIS_IRQ_CENTRAL0 , .val = 0x0, },
38 { .reg = S5P_ARM_CORE1_LOWPWR , .val = 0x2, },
39 { .reg = S5P_DIS_IRQ_CORE1 , .val = 0x0, },
40 { .reg = S5P_DIS_IRQ_CENTRAL1 , .val = 0x0, },
41 { .reg = S5P_ARM_COMMON_LOWPWR , .val = 0x2, },
42 { .reg = S5P_L2_0_LOWPWR , .val = 0x3, },
43 { .reg = S5P_L2_1_LOWPWR , .val = 0x3, },
44 { .reg = S5P_CMU_ACLKSTOP_LOWPWR , .val = 0x0, },
45 { .reg = S5P_CMU_SCLKSTOP_LOWPWR , .val = 0x0, },
46 { .reg = S5P_CMU_RESET_LOWPWR , .val = 0x0, },
47 { .reg = S5P_APLL_SYSCLK_LOWPWR , .val = 0x0, },
48 { .reg = S5P_MPLL_SYSCLK_LOWPWR , .val = 0x0, },
49 { .reg = S5P_VPLL_SYSCLK_LOWPWR , .val = 0x0, },
50 { .reg = S5P_EPLL_SYSCLK_LOWPWR , .val = 0x0, },
51 { .reg = S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR , .val = 0x0, },
52 { .reg = S5P_CMU_RESET_GPSALIVE_LOWPWR , .val = 0x0, },
53 { .reg = S5P_CMU_CLKSTOP_CAM_LOWPWR , .val = 0x0, },
54 { .reg = S5P_CMU_CLKSTOP_TV_LOWPWR , .val = 0x0, },
55 { .reg = S5P_CMU_CLKSTOP_MFC_LOWPWR , .val = 0x0, },
56 { .reg = S5P_CMU_CLKSTOP_G3D_LOWPWR , .val = 0x0, },
57 { .reg = S5P_CMU_CLKSTOP_LCD0_LOWPWR , .val = 0x0, },
58 { .reg = S5P_CMU_CLKSTOP_LCD1_LOWPWR , .val = 0x0, },
59 { .reg = S5P_CMU_CLKSTOP_MAUDIO_LOWPWR , .val = 0x0, },
60 { .reg = S5P_CMU_CLKSTOP_GPS_LOWPWR , .val = 0x0, },
61 { .reg = S5P_CMU_RESET_CAM_LOWPWR , .val = 0x0, },
62 { .reg = S5P_CMU_RESET_TV_LOWPWR , .val = 0x0, },
63 { .reg = S5P_CMU_RESET_MFC_LOWPWR , .val = 0x0, },
64 { .reg = S5P_CMU_RESET_G3D_LOWPWR , .val = 0x0, },
65 { .reg = S5P_CMU_RESET_LCD0_LOWPWR , .val = 0x0, },
66 { .reg = S5P_CMU_RESET_LCD1_LOWPWR , .val = 0x0, },
67 { .reg = S5P_CMU_RESET_MAUDIO_LOWPWR , .val = 0x0, },
68 { .reg = S5P_CMU_RESET_GPS_LOWPWR , .val = 0x0, },
69 { .reg = S5P_TOP_BUS_LOWPWR , .val = 0x0, },
70 { .reg = S5P_TOP_RETENTION_LOWPWR , .val = 0x1, },
71 { .reg = S5P_TOP_PWR_LOWPWR , .val = 0x3, },
72 { .reg = S5P_LOGIC_RESET_LOWPWR , .val = 0x0, },
73 { .reg = S5P_ONENAND_MEM_LOWPWR , .val = 0x0, },
74 { .reg = S5P_MODIMIF_MEM_LOWPWR , .val = 0x0, },
75 { .reg = S5P_G2D_ACP_MEM_LOWPWR , .val = 0x0, },
76 { .reg = S5P_USBOTG_MEM_LOWPWR , .val = 0x0, },
77 { .reg = S5P_HSMMC_MEM_LOWPWR , .val = 0x0, },
78 { .reg = S5P_CSSYS_MEM_LOWPWR , .val = 0x0, },
79 { .reg = S5P_SECSS_MEM_LOWPWR , .val = 0x0, },
80 { .reg = S5P_PCIE_MEM_LOWPWR , .val = 0x0, },
81 { .reg = S5P_SATA_MEM_LOWPWR , .val = 0x0, },
82 { .reg = S5P_PAD_RETENTION_DRAM_LOWPWR , .val = 0x0, },
83 { .reg = S5P_PAD_RETENTION_MAUDIO_LOWPWR , .val = 0x0, },
84 { .reg = S5P_PAD_RETENTION_GPIO_LOWPWR , .val = 0x0, },
85 { .reg = S5P_PAD_RETENTION_UART_LOWPWR , .val = 0x0, },
86 { .reg = S5P_PAD_RETENTION_MMCA_LOWPWR , .val = 0x0, },
87 { .reg = S5P_PAD_RETENTION_MMCB_LOWPWR , .val = 0x0, },
88 { .reg = S5P_PAD_RETENTION_EBIA_LOWPWR , .val = 0x0, },
89 { .reg = S5P_PAD_RETENTION_EBIB_LOWPWR , .val = 0x0, },
90 { .reg = S5P_PAD_RETENTION_ISOLATION_LOWPWR , .val = 0x0, },
91 { .reg = S5P_PAD_RETENTION_ALV_SEL_LOWPWR , .val = 0x0, },
92 { .reg = S5P_XUSBXTI_LOWPWR , .val = 0x0, },
93 { .reg = S5P_XXTI_LOWPWR , .val = 0x0, },
94 { .reg = S5P_EXT_REGULATOR_LOWPWR , .val = 0x0, },
95 { .reg = S5P_GPIO_MODE_LOWPWR , .val = 0x0, },
96 { .reg = S5P_GPIO_MODE_MAUDIO_LOWPWR , .val = 0x0, },
97 { .reg = S5P_CAM_LOWPWR , .val = 0x0, },
98 { .reg = S5P_TV_LOWPWR , .val = 0x0, },
99 { .reg = S5P_MFC_LOWPWR , .val = 0x0, },
100 { .reg = S5P_G3D_LOWPWR , .val = 0x0, },
101 { .reg = S5P_LCD0_LOWPWR , .val = 0x0, },
102 { .reg = S5P_LCD1_LOWPWR , .val = 0x0, },
103 { .reg = S5P_MAUDIO_LOWPWR , .val = 0x0, },
104 { .reg = S5P_GPS_LOWPWR , .val = 0x0, },
105 { .reg = S5P_GPS_ALIVE_LOWPWR , .val = 0x0, },
106};
107 38
108static struct sleep_save exynos4_set_clksrc[] = { 39static struct sleep_save exynos4_set_clksrc[] = {
109 { .reg = S5P_CLKSRC_MASK_TOP , .val = 0x00000001, }, 40 { .reg = S5P_CLKSRC_MASK_TOP , .val = 0x00000001, },
@@ -118,20 +49,28 @@ static struct sleep_save exynos4_set_clksrc[] = {
118 { .reg = S5P_CLKSRC_MASK_DMC , .val = 0x00010000, }, 49 { .reg = S5P_CLKSRC_MASK_DMC , .val = 0x00010000, },
119}; 50};
120 51
52static struct sleep_save exynos4_epll_save[] = {
53 SAVE_ITEM(S5P_EPLL_CON0),
54 SAVE_ITEM(S5P_EPLL_CON1),
55};
56
57static struct sleep_save exynos4_vpll_save[] = {
58 SAVE_ITEM(S5P_VPLL_CON0),
59 SAVE_ITEM(S5P_VPLL_CON1),
60};
61
121static struct sleep_save exynos4_core_save[] = { 62static struct sleep_save exynos4_core_save[] = {
122 /* CMU side */ 63 /* CMU side */
123 SAVE_ITEM(S5P_CLKDIV_LEFTBUS), 64 SAVE_ITEM(S5P_CLKDIV_LEFTBUS),
124 SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS), 65 SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS),
125 SAVE_ITEM(S5P_CLKDIV_RIGHTBUS), 66 SAVE_ITEM(S5P_CLKDIV_RIGHTBUS),
126 SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS), 67 SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS),
127 SAVE_ITEM(S5P_EPLL_CON0),
128 SAVE_ITEM(S5P_EPLL_CON1),
129 SAVE_ITEM(S5P_VPLL_CON0),
130 SAVE_ITEM(S5P_VPLL_CON1),
131 SAVE_ITEM(S5P_CLKSRC_TOP0), 68 SAVE_ITEM(S5P_CLKSRC_TOP0),
132 SAVE_ITEM(S5P_CLKSRC_TOP1), 69 SAVE_ITEM(S5P_CLKSRC_TOP1),
133 SAVE_ITEM(S5P_CLKSRC_CAM), 70 SAVE_ITEM(S5P_CLKSRC_CAM),
71 SAVE_ITEM(S5P_CLKSRC_TV),
134 SAVE_ITEM(S5P_CLKSRC_MFC), 72 SAVE_ITEM(S5P_CLKSRC_MFC),
73 SAVE_ITEM(S5P_CLKSRC_G3D),
135 SAVE_ITEM(S5P_CLKSRC_IMAGE), 74 SAVE_ITEM(S5P_CLKSRC_IMAGE),
136 SAVE_ITEM(S5P_CLKSRC_LCD0), 75 SAVE_ITEM(S5P_CLKSRC_LCD0),
137 SAVE_ITEM(S5P_CLKSRC_LCD1), 76 SAVE_ITEM(S5P_CLKSRC_LCD1),
@@ -158,6 +97,7 @@ static struct sleep_save exynos4_core_save[] = {
158 SAVE_ITEM(S5P_CLKDIV_PERIL4), 97 SAVE_ITEM(S5P_CLKDIV_PERIL4),
159 SAVE_ITEM(S5P_CLKDIV_PERIL5), 98 SAVE_ITEM(S5P_CLKDIV_PERIL5),
160 SAVE_ITEM(S5P_CLKDIV_TOP), 99 SAVE_ITEM(S5P_CLKDIV_TOP),
100 SAVE_ITEM(S5P_CLKSRC_MASK_TOP),
161 SAVE_ITEM(S5P_CLKSRC_MASK_CAM), 101 SAVE_ITEM(S5P_CLKSRC_MASK_CAM),
162 SAVE_ITEM(S5P_CLKSRC_MASK_TV), 102 SAVE_ITEM(S5P_CLKSRC_MASK_TV),
163 SAVE_ITEM(S5P_CLKSRC_MASK_LCD0), 103 SAVE_ITEM(S5P_CLKSRC_MASK_LCD0),
@@ -166,6 +106,7 @@ static struct sleep_save exynos4_core_save[] = {
166 SAVE_ITEM(S5P_CLKSRC_MASK_FSYS), 106 SAVE_ITEM(S5P_CLKSRC_MASK_FSYS),
167 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0), 107 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0),
168 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1), 108 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1),
109 SAVE_ITEM(S5P_CLKDIV2_RATIO),
169 SAVE_ITEM(S5P_CLKGATE_SCLKCAM), 110 SAVE_ITEM(S5P_CLKGATE_SCLKCAM),
170 SAVE_ITEM(S5P_CLKGATE_IP_CAM), 111 SAVE_ITEM(S5P_CLKGATE_IP_CAM),
171 SAVE_ITEM(S5P_CLKGATE_IP_TV), 112 SAVE_ITEM(S5P_CLKGATE_IP_TV),
@@ -186,8 +127,10 @@ static struct sleep_save exynos4_core_save[] = {
186 SAVE_ITEM(S5P_CLKGATE_IP_DMC), 127 SAVE_ITEM(S5P_CLKGATE_IP_DMC),
187 SAVE_ITEM(S5P_CLKSRC_CPU), 128 SAVE_ITEM(S5P_CLKSRC_CPU),
188 SAVE_ITEM(S5P_CLKDIV_CPU), 129 SAVE_ITEM(S5P_CLKDIV_CPU),
130 SAVE_ITEM(S5P_CLKDIV_CPU + 0x4),
189 SAVE_ITEM(S5P_CLKGATE_SCLKCPU), 131 SAVE_ITEM(S5P_CLKGATE_SCLKCPU),
190 SAVE_ITEM(S5P_CLKGATE_IP_CPU), 132 SAVE_ITEM(S5P_CLKGATE_IP_CPU),
133
191 /* GIC side */ 134 /* GIC side */
192 SAVE_ITEM(S5P_VA_GIC_CPU + 0x000), 135 SAVE_ITEM(S5P_VA_GIC_CPU + 0x000),
193 SAVE_ITEM(S5P_VA_GIC_CPU + 0x004), 136 SAVE_ITEM(S5P_VA_GIC_CPU + 0x004),
@@ -270,6 +213,13 @@ static struct sleep_save exynos4_core_save[] = {
270 SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x070), 213 SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x070),
271 SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x080), 214 SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x080),
272 SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x090), 215 SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x090),
216
217 /* SROM side */
218 SAVE_ITEM(S5P_SROM_BW),
219 SAVE_ITEM(S5P_SROM_BC0),
220 SAVE_ITEM(S5P_SROM_BC1),
221 SAVE_ITEM(S5P_SROM_BC2),
222 SAVE_ITEM(S5P_SROM_BC3),
273}; 223};
274 224
275static struct sleep_save exynos4_l2cc_save[] = { 225static struct sleep_save exynos4_l2cc_save[] = {
@@ -280,37 +230,11 @@ static struct sleep_save exynos4_l2cc_save[] = {
280 SAVE_ITEM(S5P_VA_L2CC + L2X0_AUX_CTRL), 230 SAVE_ITEM(S5P_VA_L2CC + L2X0_AUX_CTRL),
281}; 231};
282 232
233/* For Cortex-A9 Diagnostic and Power control register */
234static unsigned int save_arm_register[2];
235
283static int exynos4_cpu_suspend(unsigned long arg) 236static int exynos4_cpu_suspend(unsigned long arg)
284{ 237{
285 unsigned long tmp;
286 unsigned long mask = 0xFFFFFFFF;
287
288 /* Setting Central Sequence Register for power down mode */
289
290 tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
291 tmp &= ~(S5P_CENTRAL_LOWPWR_CFG);
292 __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
293
294 /* Setting Central Sequence option Register */
295
296 tmp = __raw_readl(S5P_CENTRAL_SEQ_OPTION);
297 tmp &= ~(S5P_USE_MASK);
298 tmp |= S5P_USE_STANDBY_WFI0;
299 __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
300
301 /* Clear all interrupt pending to avoid early wakeup */
302
303 __raw_writel(mask, (S5P_VA_GIC_DIST + 0x280));
304 __raw_writel(mask, (S5P_VA_GIC_DIST + 0x284));
305 __raw_writel(mask, (S5P_VA_GIC_DIST + 0x288));
306
307 /* Disable all interrupt */
308
309 __raw_writel(0x0, (S5P_VA_GIC_CPU + 0x000));
310 __raw_writel(0x0, (S5P_VA_GIC_DIST + 0x000));
311 __raw_writel(mask, (S5P_VA_GIC_DIST + 0x184));
312 __raw_writel(mask, (S5P_VA_GIC_DIST + 0x188));
313
314 outer_flush_all(); 238 outer_flush_all();
315 239
316 /* issue the standby signal into the pm unit. */ 240 /* issue the standby signal into the pm unit. */
@@ -326,12 +250,14 @@ static void exynos4_pm_prepare(void)
326 250
327 s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save)); 251 s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save));
328 s3c_pm_do_save(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save)); 252 s3c_pm_do_save(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save));
253 s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save));
254 s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save));
329 255
330 tmp = __raw_readl(S5P_INFORM1); 256 tmp = __raw_readl(S5P_INFORM1);
331 257
332 /* Set value of power down register for sleep mode */ 258 /* Set value of power down register for sleep mode */
333 259
334 s3c_pm_do_restore_core(exynos4_sleep, ARRAY_SIZE(exynos4_sleep)); 260 exynos4_sys_powerdown_conf(SYS_SLEEP);
335 __raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1); 261 __raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1);
336 262
337 /* ensure at least INFORM0 has the resume address */ 263 /* ensure at least INFORM0 has the resume address */
@@ -373,12 +299,80 @@ void exynos4_scu_enable(void __iomem *scu_base)
373 flush_cache_all(); 299 flush_cache_all();
374} 300}
375 301
302static unsigned long pll_base_rate;
303
304static void exynos4_restore_pll(void)
305{
306 unsigned long pll_con, locktime, lockcnt;
307 unsigned long pll_in_rate;
308 unsigned int p_div, epll_wait = 0, vpll_wait = 0;
309
310 if (pll_base_rate == 0)
311 return;
312
313 pll_in_rate = pll_base_rate;
314
315 /* EPLL */
316 pll_con = exynos4_epll_save[0].val;
317
318 if (pll_con & (1 << 31)) {
319 pll_con &= (PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT);
320 p_div = (pll_con >> PLL46XX_PDIV_SHIFT);
321
322 pll_in_rate /= 1000000;
323
324 locktime = (3000 / pll_in_rate) * p_div;
325 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
326
327 __raw_writel(lockcnt, S5P_EPLL_LOCK);
328
329 s3c_pm_do_restore_core(exynos4_epll_save,
330 ARRAY_SIZE(exynos4_epll_save));
331 epll_wait = 1;
332 }
333
334 pll_in_rate = pll_base_rate;
335
336 /* VPLL */
337 pll_con = exynos4_vpll_save[0].val;
338
339 if (pll_con & (1 << 31)) {
340 pll_in_rate /= 1000000;
341 /* 750us */
342 locktime = 750;
343 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
344
345 __raw_writel(lockcnt, S5P_VPLL_LOCK);
346
347 s3c_pm_do_restore_core(exynos4_vpll_save,
348 ARRAY_SIZE(exynos4_vpll_save));
349 vpll_wait = 1;
350 }
351
352 /* Wait PLL locking */
353
354 do {
355 if (epll_wait) {
356 pll_con = __raw_readl(S5P_EPLL_CON0);
357 if (pll_con & (1 << S5P_EPLLCON0_LOCKED_SHIFT))
358 epll_wait = 0;
359 }
360
361 if (vpll_wait) {
362 pll_con = __raw_readl(S5P_VPLL_CON0);
363 if (pll_con & (1 << S5P_VPLLCON0_LOCKED_SHIFT))
364 vpll_wait = 0;
365 }
366 } while (epll_wait || vpll_wait);
367}
368
376static struct sysdev_driver exynos4_pm_driver = { 369static struct sysdev_driver exynos4_pm_driver = {
377 .add = exynos4_pm_add, 370 .add = exynos4_pm_add,
378}; 371};
379 372
380static __init int exynos4_pm_drvinit(void) 373static __init int exynos4_pm_drvinit(void)
381{ 374{
375 struct clk *pll_base;
382 unsigned int tmp; 376 unsigned int tmp;
383 377
384 s3c_pm_init(); 378 s3c_pm_init();
@@ -389,12 +383,69 @@ static __init int exynos4_pm_drvinit(void)
389 tmp |= ((0xFF << 8) | (0x1F << 1)); 383 tmp |= ((0xFF << 8) | (0x1F << 1));
390 __raw_writel(tmp, S5P_WAKEUP_MASK); 384 __raw_writel(tmp, S5P_WAKEUP_MASK);
391 385
386 pll_base = clk_get(NULL, "xtal");
387
388 if (!IS_ERR(pll_base)) {
389 pll_base_rate = clk_get_rate(pll_base);
390 clk_put(pll_base);
391 }
392
392 return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver); 393 return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver);
393} 394}
394arch_initcall(exynos4_pm_drvinit); 395arch_initcall(exynos4_pm_drvinit);
395 396
397static int exynos4_pm_suspend(void)
398{
399 unsigned long tmp;
400
401 /* Setting Central Sequence Register for power down mode */
402
403 tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
404 tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
405 __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
406
407 /* Save Power control register */
408 asm ("mrc p15, 0, %0, c15, c0, 0"
409 : "=r" (tmp) : : "cc");
410 save_arm_register[0] = tmp;
411
412 /* Save Diagnostic register */
413 asm ("mrc p15, 0, %0, c15, c0, 1"
414 : "=r" (tmp) : : "cc");
415 save_arm_register[1] = tmp;
416
417 return 0;
418}
419
396static void exynos4_pm_resume(void) 420static void exynos4_pm_resume(void)
397{ 421{
422 unsigned long tmp;
423
424 /*
425 * If PMU failed while entering sleep mode, WFI will be
426 * ignored by PMU and then exiting cpu_do_idle().
427 * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
428 * in this situation.
429 */
430 tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
431 if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
432 tmp |= S5P_CENTRAL_LOWPWR_CFG;
433 __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
434 /* No need to perform below restore code */
435 goto early_wakeup;
436 }
437 /* Restore Power control register */
438 tmp = save_arm_register[0];
439 asm volatile ("mcr p15, 0, %0, c15, c0, 0"
440 : : "r" (tmp)
441 : "cc");
442
443 /* Restore Diagnostic register */
444 tmp = save_arm_register[1];
445 asm volatile ("mcr p15, 0, %0, c15, c0, 1"
446 : : "r" (tmp)
447 : "cc");
448
398 /* For release retention */ 449 /* For release retention */
399 450
400 __raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION); 451 __raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION);
@@ -407,6 +458,8 @@ static void exynos4_pm_resume(void)
407 458
408 s3c_pm_do_restore_core(exynos4_core_save, ARRAY_SIZE(exynos4_core_save)); 459 s3c_pm_do_restore_core(exynos4_core_save, ARRAY_SIZE(exynos4_core_save));
409 460
461 exynos4_restore_pll();
462
410 exynos4_scu_enable(S5P_VA_SCU); 463 exynos4_scu_enable(S5P_VA_SCU);
411 464
412#ifdef CONFIG_CACHE_L2X0 465#ifdef CONFIG_CACHE_L2X0
@@ -415,9 +468,13 @@ static void exynos4_pm_resume(void)
415 /* enable L2X0*/ 468 /* enable L2X0*/
416 writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL); 469 writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL);
417#endif 470#endif
471
472early_wakeup:
473 return;
418} 474}
419 475
420static struct syscore_ops exynos4_pm_syscore_ops = { 476static struct syscore_ops exynos4_pm_syscore_ops = {
477 .suspend = exynos4_pm_suspend,
421 .resume = exynos4_pm_resume, 478 .resume = exynos4_pm_resume,
422}; 479};
423 480
diff --git a/arch/arm/mach-exynos4/pmu.c b/arch/arm/mach-exynos4/pmu.c
new file mode 100644
index 00000000000..7ea9eb2a20d
--- /dev/null
+++ b/arch/arm/mach-exynos4/pmu.c
@@ -0,0 +1,175 @@
1/* linux/arch/arm/mach-exynos4/pmu.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * EXYNOS4210 - CPU PMU(Power Management Unit) 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/io.h>
14#include <linux/kernel.h>
15
16#include <mach/regs-clock.h>
17#include <mach/pmu.h>
18
19static void __iomem *sys_powerdown_reg[] = {
20 S5P_ARM_CORE0_LOWPWR,
21 S5P_DIS_IRQ_CORE0,
22 S5P_DIS_IRQ_CENTRAL0,
23 S5P_ARM_CORE1_LOWPWR,
24 S5P_DIS_IRQ_CORE1,
25 S5P_DIS_IRQ_CENTRAL1,
26 S5P_ARM_COMMON_LOWPWR,
27 S5P_L2_0_LOWPWR,
28 S5P_L2_1_LOWPWR,
29 S5P_CMU_ACLKSTOP_LOWPWR,
30 S5P_CMU_SCLKSTOP_LOWPWR,
31 S5P_CMU_RESET_LOWPWR,
32 S5P_APLL_SYSCLK_LOWPWR,
33 S5P_MPLL_SYSCLK_LOWPWR,
34 S5P_VPLL_SYSCLK_LOWPWR,
35 S5P_EPLL_SYSCLK_LOWPWR,
36 S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR,
37 S5P_CMU_RESET_GPSALIVE_LOWPWR,
38 S5P_CMU_CLKSTOP_CAM_LOWPWR,
39 S5P_CMU_CLKSTOP_TV_LOWPWR,
40 S5P_CMU_CLKSTOP_MFC_LOWPWR,
41 S5P_CMU_CLKSTOP_G3D_LOWPWR,
42 S5P_CMU_CLKSTOP_LCD0_LOWPWR,
43 S5P_CMU_CLKSTOP_LCD1_LOWPWR,
44 S5P_CMU_CLKSTOP_MAUDIO_LOWPWR,
45 S5P_CMU_CLKSTOP_GPS_LOWPWR,
46 S5P_CMU_RESET_CAM_LOWPWR,
47 S5P_CMU_RESET_TV_LOWPWR,
48 S5P_CMU_RESET_MFC_LOWPWR,
49 S5P_CMU_RESET_G3D_LOWPWR,
50 S5P_CMU_RESET_LCD0_LOWPWR,
51 S5P_CMU_RESET_LCD1_LOWPWR,
52 S5P_CMU_RESET_MAUDIO_LOWPWR,
53 S5P_CMU_RESET_GPS_LOWPWR,
54 S5P_TOP_BUS_LOWPWR,
55 S5P_TOP_RETENTION_LOWPWR,
56 S5P_TOP_PWR_LOWPWR,
57 S5P_LOGIC_RESET_LOWPWR,
58 S5P_ONENAND_MEM_LOWPWR,
59 S5P_MODIMIF_MEM_LOWPWR,
60 S5P_G2D_ACP_MEM_LOWPWR,
61 S5P_USBOTG_MEM_LOWPWR,
62 S5P_HSMMC_MEM_LOWPWR,
63 S5P_CSSYS_MEM_LOWPWR,
64 S5P_SECSS_MEM_LOWPWR,
65 S5P_PCIE_MEM_LOWPWR,
66 S5P_SATA_MEM_LOWPWR,
67 S5P_PAD_RETENTION_DRAM_LOWPWR,
68 S5P_PAD_RETENTION_MAUDIO_LOWPWR,
69 S5P_PAD_RETENTION_GPIO_LOWPWR,
70 S5P_PAD_RETENTION_UART_LOWPWR,
71 S5P_PAD_RETENTION_MMCA_LOWPWR,
72 S5P_PAD_RETENTION_MMCB_LOWPWR,
73 S5P_PAD_RETENTION_EBIA_LOWPWR,
74 S5P_PAD_RETENTION_EBIB_LOWPWR,
75 S5P_PAD_RETENTION_ISOLATION_LOWPWR,
76 S5P_PAD_RETENTION_ALV_SEL_LOWPWR,
77 S5P_XUSBXTI_LOWPWR,
78 S5P_XXTI_LOWPWR,
79 S5P_EXT_REGULATOR_LOWPWR,
80 S5P_GPIO_MODE_LOWPWR,
81 S5P_GPIO_MODE_MAUDIO_LOWPWR,
82 S5P_CAM_LOWPWR,
83 S5P_TV_LOWPWR,
84 S5P_MFC_LOWPWR,
85 S5P_G3D_LOWPWR,
86 S5P_LCD0_LOWPWR,
87 S5P_LCD1_LOWPWR,
88 S5P_MAUDIO_LOWPWR,
89 S5P_GPS_LOWPWR,
90 S5P_GPS_ALIVE_LOWPWR,
91};
92
93static const unsigned int sys_powerdown_val[][NUM_SYS_POWERDOWN] = {
94 /* { AFTR, LPA, SLEEP }*/
95 { 0, 0, 2 }, /* ARM_CORE0 */
96 { 0, 0, 0 }, /* ARM_DIS_IRQ_CORE0 */
97 { 0, 0, 0 }, /* ARM_DIS_IRQ_CENTRAL0 */
98 { 0, 0, 2 }, /* ARM_CORE1 */
99 { 0, 0, 0 }, /* ARM_DIS_IRQ_CORE1 */
100 { 0, 0, 0 }, /* ARM_DIS_IRQ_CENTRAL1 */
101 { 0, 0, 2 }, /* ARM_COMMON */
102 { 2, 2, 3 }, /* ARM_CPU_L2_0 */
103 { 2, 2, 3 }, /* ARM_CPU_L2_1 */
104 { 1, 0, 0 }, /* CMU_ACLKSTOP */
105 { 1, 0, 0 }, /* CMU_SCLKSTOP */
106 { 1, 1, 0 }, /* CMU_RESET */
107 { 1, 0, 0 }, /* APLL_SYSCLK */
108 { 1, 0, 0 }, /* MPLL_SYSCLK */
109 { 1, 0, 0 }, /* VPLL_SYSCLK */
110 { 1, 1, 0 }, /* EPLL_SYSCLK */
111 { 1, 1, 0 }, /* CMU_CLKSTOP_GPS_ALIVE */
112 { 1, 1, 0 }, /* CMU_RESET_GPS_ALIVE */
113 { 1, 1, 0 }, /* CMU_CLKSTOP_CAM */
114 { 1, 1, 0 }, /* CMU_CLKSTOP_TV */
115 { 1, 1, 0 }, /* CMU_CLKSTOP_MFC */
116 { 1, 1, 0 }, /* CMU_CLKSTOP_G3D */
117 { 1, 1, 0 }, /* CMU_CLKSTOP_LCD0 */
118 { 1, 1, 0 }, /* CMU_CLKSTOP_LCD1 */
119 { 1, 1, 0 }, /* CMU_CLKSTOP_MAUDIO */
120 { 1, 1, 0 }, /* CMU_CLKSTOP_GPS */
121 { 1, 1, 0 }, /* CMU_RESET_CAM */
122 { 1, 1, 0 }, /* CMU_RESET_TV */
123 { 1, 1, 0 }, /* CMU_RESET_MFC */
124 { 1, 1, 0 }, /* CMU_RESET_G3D */
125 { 1, 1, 0 }, /* CMU_RESET_LCD0 */
126 { 1, 1, 0 }, /* CMU_RESET_LCD1 */
127 { 1, 1, 0 }, /* CMU_RESET_MAUDIO */
128 { 1, 1, 0 }, /* CMU_RESET_GPS */
129 { 3, 0, 0 }, /* TOP_BUS */
130 { 1, 0, 1 }, /* TOP_RETENTION */
131 { 3, 0, 3 }, /* TOP_PWR */
132 { 1, 1, 0 }, /* LOGIC_RESET */
133 { 3, 0, 0 }, /* ONENAND_MEM */
134 { 3, 0, 0 }, /* MODIMIF_MEM */
135 { 3, 0, 0 }, /* G2D_ACP_MEM */
136 { 3, 0, 0 }, /* USBOTG_MEM */
137 { 3, 0, 0 }, /* HSMMC_MEM */
138 { 3, 0, 0 }, /* CSSYS_MEM */
139 { 3, 0, 0 }, /* SECSS_MEM */
140 { 3, 0, 0 }, /* PCIE_MEM */
141 { 3, 0, 0 }, /* SATA_MEM */
142 { 1, 0, 0 }, /* PAD_RETENTION_DRAM */
143 { 1, 1, 0 }, /* PAD_RETENTION_MAUDIO */
144 { 1, 0, 0 }, /* PAD_RETENTION_GPIO */
145 { 1, 0, 0 }, /* PAD_RETENTION_UART */
146 { 1, 0, 0 }, /* PAD_RETENTION_MMCA */
147 { 1, 0, 0 }, /* PAD_RETENTION_MMCB */
148 { 1, 0, 0 }, /* PAD_RETENTION_EBIA */
149 { 1, 0, 0 }, /* PAD_RETENTION_EBIB */
150 { 1, 0, 0 }, /* PAD_RETENTION_ISOLATION */
151 { 1, 0, 0 }, /* PAD_RETENTION_ALV_SEL */
152 { 1, 1, 0 }, /* XUSBXTI */
153 { 1, 1, 0 }, /* XXTI */
154 { 1, 1, 0 }, /* EXT_REGULATOR */
155 { 1, 0, 0 }, /* GPIO_MODE */
156 { 1, 1, 0 }, /* GPIO_MODE_MAUDIO */
157 { 7, 0, 0 }, /* CAM */
158 { 7, 0, 0 }, /* TV */
159 { 7, 0, 0 }, /* MFC */
160 { 7, 0, 0 }, /* G3D */
161 { 7, 0, 0 }, /* LCD0 */
162 { 7, 0, 0 }, /* LCD1 */
163 { 7, 7, 0 }, /* MAUDIO */
164 { 7, 0, 0 }, /* GPS */
165 { 7, 0, 0 }, /* GPS_ALIVE */
166};
167
168void exynos4_sys_powerdown_conf(enum sys_powerdown mode)
169{
170 unsigned int count = ARRAY_SIZE(sys_powerdown_reg);
171
172 for (; count > 0; count--)
173 __raw_writel(sys_powerdown_val[count - 1][mode],
174 sys_powerdown_reg[count - 1]);
175}
diff --git a/arch/arm/mach-exynos4/setup-fimd0.c b/arch/arm/mach-exynos4/setup-fimd0.c
new file mode 100644
index 00000000000..07a6dbeecdd
--- /dev/null
+++ b/arch/arm/mach-exynos4/setup-fimd0.c
@@ -0,0 +1,43 @@
1/* linux/arch/arm/mach-exynos4/setup-fimd0.c
2 *
3 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Base Exynos4 FIMD 0 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
13#include <linux/fb.h>
14#include <linux/gpio.h>
15
16#include <plat/gpio-cfg.h>
17#include <plat/regs-fb-v4.h>
18
19#include <mach/map.h>
20
21void exynos4_fimd0_gpio_setup_24bpp(void)
22{
23 unsigned int reg;
24
25 s3c_gpio_cfgrange_nopull(EXYNOS4_GPF0(0), 8, S3C_GPIO_SFN(2));
26 s3c_gpio_cfgrange_nopull(EXYNOS4_GPF1(0), 8, S3C_GPIO_SFN(2));
27 s3c_gpio_cfgrange_nopull(EXYNOS4_GPF2(0), 8, S3C_GPIO_SFN(2));
28 s3c_gpio_cfgrange_nopull(EXYNOS4_GPF3(0), 4, S3C_GPIO_SFN(2));
29
30 /*
31 * Set DISPLAY_CONTROL register for Display path selection.
32 *
33 * DISPLAY_CONTROL[1:0]
34 * ---------------------
35 * 00 | MIE
36 * 01 | MDINE
37 * 10 | FIMD : selected
38 * 11 | FIMD
39 */
40 reg = __raw_readl(S3C_VA_SYS + 0x0210);
41 reg |= (1 << 1);
42 __raw_writel(reg, S3C_VA_SYS + 0x0210);
43}
diff --git a/arch/arm/mach-exynos4/setup-usb-phy.c b/arch/arm/mach-exynos4/setup-usb-phy.c
index 0883c1b824b..39aca045f66 100644
--- a/arch/arm/mach-exynos4/setup-usb-phy.c
+++ b/arch/arm/mach-exynos4/setup-usb-phy.c
@@ -82,7 +82,7 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
82 82
83 rstcon &= ~(HOST_LINK_PORT_SWRST_MASK | PHY1_SWRST_MASK); 83 rstcon &= ~(HOST_LINK_PORT_SWRST_MASK | PHY1_SWRST_MASK);
84 writel(rstcon, EXYNOS4_RSTCON); 84 writel(rstcon, EXYNOS4_RSTCON);
85 udelay(50); 85 udelay(80);
86 86
87 clk_disable(otg_clk); 87 clk_disable(otg_clk);
88 clk_put(otg_clk); 88 clk_put(otg_clk);
diff --git a/arch/arm/mach-exynos4/time.c b/arch/arm/mach-exynos4/time.c
deleted file mode 100644
index ebb8f38d540..00000000000
--- a/arch/arm/mach-exynos4/time.c
+++ /dev/null
@@ -1,301 +0,0 @@
1/* linux/arch/arm/mach-exynos4/time.c
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 (and compatible) HRT support
7 * PWM 2/4 is used for this feature
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/sched.h>
15#include <linux/interrupt.h>
16#include <linux/irq.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/clockchips.h>
20#include <linux/platform_device.h>
21
22#include <asm/smp_twd.h>
23
24#include <mach/map.h>
25#include <plat/regs-timer.h>
26#include <asm/mach/time.h>
27
28static unsigned long clock_count_per_tick;
29
30static struct clk *tin2;
31static struct clk *tin4;
32static struct clk *tdiv2;
33static struct clk *tdiv4;
34static struct clk *timerclk;
35
36static void exynos4_pwm_stop(unsigned int pwm_id)
37{
38 unsigned long tcon;
39
40 tcon = __raw_readl(S3C2410_TCON);
41
42 switch (pwm_id) {
43 case 2:
44 tcon &= ~S3C2410_TCON_T2START;
45 break;
46 case 4:
47 tcon &= ~S3C2410_TCON_T4START;
48 break;
49 default:
50 break;
51 }
52 __raw_writel(tcon, S3C2410_TCON);
53}
54
55static void exynos4_pwm_init(unsigned int pwm_id, unsigned long tcnt)
56{
57 unsigned long tcon;
58
59 tcon = __raw_readl(S3C2410_TCON);
60
61 /* timers reload after counting zero, so reduce the count by 1 */
62 tcnt--;
63
64 /* ensure timer is stopped... */
65 switch (pwm_id) {
66 case 2:
67 tcon &= ~(0xf<<12);
68 tcon |= S3C2410_TCON_T2MANUALUPD;
69
70 __raw_writel(tcnt, S3C2410_TCNTB(2));
71 __raw_writel(tcnt, S3C2410_TCMPB(2));
72 __raw_writel(tcon, S3C2410_TCON);
73
74 break;
75 case 4:
76 tcon &= ~(7<<20);
77 tcon |= S3C2410_TCON_T4MANUALUPD;
78
79 __raw_writel(tcnt, S3C2410_TCNTB(4));
80 __raw_writel(tcnt, S3C2410_TCMPB(4));
81 __raw_writel(tcon, S3C2410_TCON);
82
83 break;
84 default:
85 break;
86 }
87}
88
89static inline void exynos4_pwm_start(unsigned int pwm_id, bool periodic)
90{
91 unsigned long tcon;
92
93 tcon = __raw_readl(S3C2410_TCON);
94
95 switch (pwm_id) {
96 case 2:
97 tcon |= S3C2410_TCON_T2START;
98 tcon &= ~S3C2410_TCON_T2MANUALUPD;
99
100 if (periodic)
101 tcon |= S3C2410_TCON_T2RELOAD;
102 else
103 tcon &= ~S3C2410_TCON_T2RELOAD;
104 break;
105 case 4:
106 tcon |= S3C2410_TCON_T4START;
107 tcon &= ~S3C2410_TCON_T4MANUALUPD;
108
109 if (periodic)
110 tcon |= S3C2410_TCON_T4RELOAD;
111 else
112 tcon &= ~S3C2410_TCON_T4RELOAD;
113 break;
114 default:
115 break;
116 }
117 __raw_writel(tcon, S3C2410_TCON);
118}
119
120static int exynos4_pwm_set_next_event(unsigned long cycles,
121 struct clock_event_device *evt)
122{
123 exynos4_pwm_init(2, cycles);
124 exynos4_pwm_start(2, 0);
125 return 0;
126}
127
128static void exynos4_pwm_set_mode(enum clock_event_mode mode,
129 struct clock_event_device *evt)
130{
131 exynos4_pwm_stop(2);
132
133 switch (mode) {
134 case CLOCK_EVT_MODE_PERIODIC:
135 exynos4_pwm_init(2, clock_count_per_tick);
136 exynos4_pwm_start(2, 1);
137 break;
138 case CLOCK_EVT_MODE_ONESHOT:
139 break;
140 case CLOCK_EVT_MODE_UNUSED:
141 case CLOCK_EVT_MODE_SHUTDOWN:
142 case CLOCK_EVT_MODE_RESUME:
143 break;
144 }
145}
146
147static struct clock_event_device pwm_event_device = {
148 .name = "pwm_timer2",
149 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
150 .rating = 200,
151 .shift = 32,
152 .set_next_event = exynos4_pwm_set_next_event,
153 .set_mode = exynos4_pwm_set_mode,
154};
155
156irqreturn_t exynos4_clock_event_isr(int irq, void *dev_id)
157{
158 struct clock_event_device *evt = &pwm_event_device;
159
160 evt->event_handler(evt);
161
162 return IRQ_HANDLED;
163}
164
165static struct irqaction exynos4_clock_event_irq = {
166 .name = "pwm_timer2_irq",
167 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
168 .handler = exynos4_clock_event_isr,
169};
170
171static void __init exynos4_clockevent_init(void)
172{
173 unsigned long pclk;
174 unsigned long clock_rate;
175 struct clk *tscaler;
176
177 pclk = clk_get_rate(timerclk);
178
179 /* configure clock tick */
180
181 tscaler = clk_get_parent(tdiv2);
182
183 clk_set_rate(tscaler, pclk / 2);
184 clk_set_rate(tdiv2, pclk / 2);
185 clk_set_parent(tin2, tdiv2);
186
187 clock_rate = clk_get_rate(tin2);
188
189 clock_count_per_tick = clock_rate / HZ;
190
191 pwm_event_device.mult =
192 div_sc(clock_rate, NSEC_PER_SEC, pwm_event_device.shift);
193 pwm_event_device.max_delta_ns =
194 clockevent_delta2ns(-1, &pwm_event_device);
195 pwm_event_device.min_delta_ns =
196 clockevent_delta2ns(1, &pwm_event_device);
197
198 pwm_event_device.cpumask = cpumask_of(0);
199 clockevents_register_device(&pwm_event_device);
200
201 setup_irq(IRQ_TIMER2, &exynos4_clock_event_irq);
202}
203
204static cycle_t exynos4_pwm4_read(struct clocksource *cs)
205{
206 return (cycle_t) ~__raw_readl(S3C_TIMERREG(0x40));
207}
208
209#ifdef CONFIG_PM
210static void exynos4_pwm4_resume(struct clocksource *cs)
211{
212 unsigned long pclk;
213
214 pclk = clk_get_rate(timerclk);
215
216 clk_set_rate(tdiv4, pclk / 2);
217 clk_set_parent(tin4, tdiv4);
218
219 exynos4_pwm_init(4, ~0);
220 exynos4_pwm_start(4, 1);
221}
222#endif
223
224struct clocksource pwm_clocksource = {
225 .name = "pwm_timer4",
226 .rating = 250,
227 .read = exynos4_pwm4_read,
228 .mask = CLOCKSOURCE_MASK(32),
229 .flags = CLOCK_SOURCE_IS_CONTINUOUS ,
230#ifdef CONFIG_PM
231 .resume = exynos4_pwm4_resume,
232#endif
233};
234
235static void __init exynos4_clocksource_init(void)
236{
237 unsigned long pclk;
238 unsigned long clock_rate;
239
240 pclk = clk_get_rate(timerclk);
241
242 clk_set_rate(tdiv4, pclk / 2);
243 clk_set_parent(tin4, tdiv4);
244
245 clock_rate = clk_get_rate(tin4);
246
247 exynos4_pwm_init(4, ~0);
248 exynos4_pwm_start(4, 1);
249
250 if (clocksource_register_hz(&pwm_clocksource, clock_rate))
251 panic("%s: can't register clocksource\n", pwm_clocksource.name);
252}
253
254static void __init exynos4_timer_resources(void)
255{
256 struct platform_device tmpdev;
257
258 tmpdev.dev.bus = &platform_bus_type;
259
260 timerclk = clk_get(NULL, "timers");
261 if (IS_ERR(timerclk))
262 panic("failed to get timers clock for system timer");
263
264 clk_enable(timerclk);
265
266 tmpdev.id = 2;
267 tin2 = clk_get(&tmpdev.dev, "pwm-tin");
268 if (IS_ERR(tin2))
269 panic("failed to get pwm-tin2 clock for system timer");
270
271 tdiv2 = clk_get(&tmpdev.dev, "pwm-tdiv");
272 if (IS_ERR(tdiv2))
273 panic("failed to get pwm-tdiv2 clock for system timer");
274 clk_enable(tin2);
275
276 tmpdev.id = 4;
277 tin4 = clk_get(&tmpdev.dev, "pwm-tin");
278 if (IS_ERR(tin4))
279 panic("failed to get pwm-tin4 clock for system timer");
280
281 tdiv4 = clk_get(&tmpdev.dev, "pwm-tdiv");
282 if (IS_ERR(tdiv4))
283 panic("failed to get pwm-tdiv4 clock for system timer");
284
285 clk_enable(tin4);
286}
287
288static void __init exynos4_timer_init(void)
289{
290#ifdef CONFIG_LOCAL_TIMERS
291 twd_base = S5P_VA_TWD;
292#endif
293
294 exynos4_timer_resources();
295 exynos4_clockevent_init();
296 exynos4_clocksource_init();
297}
298
299struct sys_timer exynos4_timer = {
300 .init = exynos4_timer_init,
301};
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig
index dc26fff22cf..c8e7afcf14e 100644
--- a/arch/arm/mach-footbridge/Kconfig
+++ b/arch/arm/mach-footbridge/Kconfig
@@ -62,6 +62,7 @@ config ARCH_EBSA285_HOST
62config ARCH_NETWINDER 62config ARCH_NETWINDER
63 bool "NetWinder" 63 bool "NetWinder"
64 select CLKSRC_I8253 64 select CLKSRC_I8253
65 select CLKEVT_I8253
65 select FOOTBRIDGE_HOST 66 select FOOTBRIDGE_HOST
66 select ISA 67 select ISA
67 select ISA_DMA 68 select ISA_DMA
diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c
index ae3e1c8c758..32321f66dec 100644
--- a/arch/arm/mach-footbridge/cats-pci.c
+++ b/arch/arm/mach-footbridge/cats-pci.c
@@ -16,7 +16,7 @@
16/* cats host-specific stuff */ 16/* cats host-specific stuff */
17static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; 17static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
18 18
19static int __init cats_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 19static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
20{ 20{
21 if (dev->irq >= 255) 21 if (dev->irq >= 255)
22 return -1; /* not a valid interrupt. */ 22 return -1; /* not a valid interrupt. */
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index 3ffa54841ec..18c32a5541d 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -18,6 +18,7 @@
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <video/vga.h>
21 22
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/system.h> 24#include <asm/system.h>
@@ -295,6 +296,9 @@ void __init dc21285_preinit(void)
295 unsigned int mem_size, mem_mask; 296 unsigned int mem_size, mem_mask;
296 int cfn_mode; 297 int cfn_mode;
297 298
299 pcibios_min_mem = 0x81000000;
300 vga_base = PCIMEM_BASE;
301
298 mem_size = (unsigned int)high_memory - PAGE_OFFSET; 302 mem_size = (unsigned int)high_memory - PAGE_OFFSET;
299 for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1) 303 for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1)
300 if (mem_mask >= mem_size) 304 if (mem_mask >= mem_size)
diff --git a/arch/arm/mach-footbridge/ebsa285-pci.c b/arch/arm/mach-footbridge/ebsa285-pci.c
index e5ab5bddbc8..511c673ffa9 100644
--- a/arch/arm/mach-footbridge/ebsa285-pci.c
+++ b/arch/arm/mach-footbridge/ebsa285-pci.c
@@ -15,7 +15,7 @@
15 15
16static int irqmap_ebsa285[] __initdata = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI }; 16static int irqmap_ebsa285[] __initdata = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI };
17 17
18static int __init ebsa285_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 18static int __init ebsa285_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
19{ 19{
20 if (dev->vendor == PCI_VENDOR_ID_CONTAQ && 20 if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
21 dev->device == PCI_DEVICE_ID_CONTAQ_82C693) 21 dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
diff --git a/arch/arm/mach-footbridge/include/mach/hardware.h b/arch/arm/mach-footbridge/include/mach/hardware.h
index b6fdf23ecf6..15d54981674 100644
--- a/arch/arm/mach-footbridge/include/mach/hardware.h
+++ b/arch/arm/mach-footbridge/include/mach/hardware.h
@@ -100,9 +100,4 @@ extern unsigned int nw_gpio_read(void);
100extern void nw_cpld_modify(unsigned int mask, unsigned int set); 100extern void nw_cpld_modify(unsigned int mask, unsigned int set);
101#endif 101#endif
102 102
103#define pcibios_assign_all_busses() 1
104
105#define PCIBIOS_MIN_IO 0x1000
106#define PCIBIOS_MIN_MEM 0x81000000
107
108#endif 103#endif
diff --git a/arch/arm/mach-footbridge/netwinder-pci.c b/arch/arm/mach-footbridge/netwinder-pci.c
index e263d6d54a0..62187610e17 100644
--- a/arch/arm/mach-footbridge/netwinder-pci.c
+++ b/arch/arm/mach-footbridge/netwinder-pci.c
@@ -17,7 +17,7 @@
17 * We now use the slot ID instead of the device identifiers to select 17 * We now use the slot ID instead of the device identifiers to select
18 * which interrupt is routed where. 18 * which interrupt is routed where.
19 */ 19 */
20static int __init netwinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 20static int __init netwinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
21{ 21{
22 switch (slot) { 22 switch (slot) {
23 case 0: /* host bridge */ 23 case 0: /* host bridge */
diff --git a/arch/arm/mach-footbridge/personal-pci.c b/arch/arm/mach-footbridge/personal-pci.c
index d5fca95afda..aeb651d914a 100644
--- a/arch/arm/mach-footbridge/personal-pci.c
+++ b/arch/arm/mach-footbridge/personal-pci.c
@@ -18,7 +18,8 @@ static int irqmap_personal_server[] __initdata = {
18 IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI 18 IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI
19}; 19};
20 20
21static int __init personal_server_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 21static int __init personal_server_map_irq(const struct pci_dev *dev, u8 slot,
22 u8 pin)
22{ 23{
23 unsigned char line; 24 unsigned char line;
24 25
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index e8dd22fa7d6..0519dd7f034 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -278,6 +278,7 @@ config MACH_MX27_3DS
278 select SOC_IMX27 278 select SOC_IMX27
279 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 279 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
280 select IMX_HAVE_PLATFORM_IMX2_WDT 280 select IMX_HAVE_PLATFORM_IMX2_WDT
281 select IMX_HAVE_PLATFORM_IMX_FB
281 select IMX_HAVE_PLATFORM_IMX_I2C 282 select IMX_HAVE_PLATFORM_IMX_I2C
282 select IMX_HAVE_PLATFORM_IMX_KEYPAD 283 select IMX_HAVE_PLATFORM_IMX_KEYPAD
283 select IMX_HAVE_PLATFORM_IMX_UART 284 select IMX_HAVE_PLATFORM_IMX_UART
diff --git a/arch/arm/mach-imx/clock-imx1.c b/arch/arm/mach-imx/clock-imx1.c
index dcc41728fe7..4aabeb24156 100644
--- a/arch/arm/mach-imx/clock-imx1.c
+++ b/arch/arm/mach-imx/clock-imx1.c
@@ -587,9 +587,9 @@ static struct clk_lookup lookups[] __initdata = {
587 _REGISTER_CLOCK(NULL, "mma", mma_clk) 587 _REGISTER_CLOCK(NULL, "mma", mma_clk)
588 _REGISTER_CLOCK("imx_udc.0", NULL, usbd_clk) 588 _REGISTER_CLOCK("imx_udc.0", NULL, usbd_clk)
589 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 589 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
590 _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk) 590 _REGISTER_CLOCK("imx1-uart.0", NULL, uart_clk)
591 _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk) 591 _REGISTER_CLOCK("imx1-uart.1", NULL, uart_clk)
592 _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk) 592 _REGISTER_CLOCK("imx1-uart.2", NULL, uart_clk)
593 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 593 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
594 _REGISTER_CLOCK("imx1-cspi.0", NULL, spi_clk) 594 _REGISTER_CLOCK("imx1-cspi.0", NULL, spi_clk)
595 _REGISTER_CLOCK("imx1-cspi.1", NULL, spi_clk) 595 _REGISTER_CLOCK("imx1-cspi.1", NULL, spi_clk)
diff --git a/arch/arm/mach-imx/clock-imx21.c b/arch/arm/mach-imx/clock-imx21.c
index bf30a8c7ce6..ee15d8c9db0 100644
--- a/arch/arm/mach-imx/clock-imx21.c
+++ b/arch/arm/mach-imx/clock-imx21.c
@@ -1162,10 +1162,10 @@ static struct clk_lookup lookups[] = {
1162 _REGISTER_CLOCK(NULL, "perclk3", per_clk[2]) 1162 _REGISTER_CLOCK(NULL, "perclk3", per_clk[2])
1163 _REGISTER_CLOCK(NULL, "perclk4", per_clk[3]) 1163 _REGISTER_CLOCK(NULL, "perclk4", per_clk[3])
1164 _REGISTER_CLOCK(NULL, "clko", clko_clk) 1164 _REGISTER_CLOCK(NULL, "clko", clko_clk)
1165 _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk[0]) 1165 _REGISTER_CLOCK("imx21-uart.0", NULL, uart_clk[0])
1166 _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk[1]) 1166 _REGISTER_CLOCK("imx21-uart.1", NULL, uart_clk[1])
1167 _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk[2]) 1167 _REGISTER_CLOCK("imx21-uart.2", NULL, uart_clk[2])
1168 _REGISTER_CLOCK("imx-uart.3", NULL, uart_clk[3]) 1168 _REGISTER_CLOCK("imx21-uart.3", NULL, uart_clk[3])
1169 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[0]) 1169 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[0])
1170 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[1]) 1170 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[1])
1171 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[2]) 1171 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[2])
diff --git a/arch/arm/mach-imx/clock-imx25.c b/arch/arm/mach-imx/clock-imx25.c
index af1c580b06b..e63e23504fe 100644
--- a/arch/arm/mach-imx/clock-imx25.c
+++ b/arch/arm/mach-imx/clock-imx25.c
@@ -272,11 +272,12 @@ DEFINE_CLOCK(can2_clk, 1, CCM_CGCR1, 3, get_rate_ipg, NULL, NULL);
272 }, 272 },
273 273
274static struct clk_lookup lookups[] = { 274static struct clk_lookup lookups[] = {
275 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 275 /* i.mx25 has the i.mx21 type uart */
276 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 276 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
277 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 277 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
278 _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 278 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
279 _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 279 _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk)
280 _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk)
280 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk) 281 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk)
281 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk) 282 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)
282 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk) 283 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
@@ -295,19 +296,20 @@ static struct clk_lookup lookups[] = {
295 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 296 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
296 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk) 297 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
297 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk) 298 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
298 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 299 _REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
299 _REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk) 300 _REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
300 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 301 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
301 _REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk) 302 _REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk)
302 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 303 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
303 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 304 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
304 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 305 _REGISTER_CLOCK("sdhci-esdhc-imx25.0", NULL, esdhc1_clk)
305 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 306 _REGISTER_CLOCK("sdhci-esdhc-imx25.1", NULL, esdhc2_clk)
306 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk) 307 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
307 _REGISTER_CLOCK(NULL, "audmux", audmux_clk) 308 _REGISTER_CLOCK(NULL, "audmux", audmux_clk)
308 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk) 309 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
309 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk) 310 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
310 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 311 /* i.mx25 has the i.mx35 type sdma */
312 _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
311}; 313};
312 314
313int __init mx25_clocks_init(void) 315int __init mx25_clocks_init(void)
@@ -329,6 +331,9 @@ int __init mx25_clocks_init(void)
329 __raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7) | (1 << 0), 331 __raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7) | (1 << 0),
330 CRM_BASE + 0x64); 332 CRM_BASE + 0x64);
331 333
334 /* Clock source for gpt is ahb_div */
335 __raw_writel(__raw_readl(CRM_BASE+0x64) & ~(1 << 5), CRM_BASE + 0x64);
336
332 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); 337 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
333 338
334 return 0; 339 return 0;
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c
index 583f2515c1d..6912b821b37 100644
--- a/arch/arm/mach-imx/clock-imx27.c
+++ b/arch/arm/mach-imx/clock-imx27.c
@@ -624,12 +624,13 @@ DEFINE_CLOCK1(csi_clk, 0, NULL, 0, parent, &csi_clk1, &per4_clk);
624 }, 624 },
625 625
626static struct clk_lookup lookups[] = { 626static struct clk_lookup lookups[] = {
627 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 627 /* i.mx27 has the i.mx21 type uart */
628 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 628 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
629 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 629 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
630 _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 630 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
631 _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 631 _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk)
632 _REGISTER_CLOCK("imx-uart.5", NULL, uart6_clk) 632 _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk)
633 _REGISTER_CLOCK("imx21-uart.5", NULL, uart6_clk)
633 _REGISTER_CLOCK(NULL, "gpt1", gpt1_clk) 634 _REGISTER_CLOCK(NULL, "gpt1", gpt1_clk)
634 _REGISTER_CLOCK(NULL, "gpt2", gpt2_clk) 635 _REGISTER_CLOCK(NULL, "gpt2", gpt2_clk)
635 _REGISTER_CLOCK(NULL, "gpt3", gpt3_clk) 636 _REGISTER_CLOCK(NULL, "gpt3", gpt3_clk)
@@ -662,7 +663,7 @@ static struct clk_lookup lookups[] = {
662 _REGISTER_CLOCK(NULL, "brom", brom_clk) 663 _REGISTER_CLOCK(NULL, "brom", brom_clk)
663 _REGISTER_CLOCK(NULL, "emma", emma_clk) 664 _REGISTER_CLOCK(NULL, "emma", emma_clk)
664 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk) 665 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
665 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 666 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
666 _REGISTER_CLOCK(NULL, "emi", emi_clk) 667 _REGISTER_CLOCK(NULL, "emi", emi_clk)
667 _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk) 668 _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
668 _REGISTER_CLOCK(NULL, "ata", ata_clk) 669 _REGISTER_CLOCK(NULL, "ata", ata_clk)
diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c
index 25f343fca2b..d973770b1f9 100644
--- a/arch/arm/mach-imx/clock-imx31.c
+++ b/arch/arm/mach-imx/clock-imx31.c
@@ -547,11 +547,12 @@ static struct clk_lookup lookups[] = {
547 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk1) 547 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk1)
548 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk2) 548 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk2)
549 _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk) 549 _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk)
550 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 550 /* i.mx31 has the i.mx21 type uart */
551 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 551 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
552 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 552 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
553 _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 553 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
554 _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 554 _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk)
555 _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk)
555 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 556 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
556 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 557 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
557 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_clk) 558 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_clk)
@@ -564,7 +565,7 @@ static struct clk_lookup lookups[] = {
564 _REGISTER_CLOCK(NULL, "ata", ata_clk) 565 _REGISTER_CLOCK(NULL, "ata", ata_clk)
565 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 566 _REGISTER_CLOCK(NULL, "rtic", rtic_clk)
566 _REGISTER_CLOCK(NULL, "rng", rng_clk) 567 _REGISTER_CLOCK(NULL, "rng", rng_clk)
567 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1) 568 _REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1)
568 _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2) 569 _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2)
569 _REGISTER_CLOCK(NULL, "mstick", mstick1_clk) 570 _REGISTER_CLOCK(NULL, "mstick", mstick1_clk)
570 _REGISTER_CLOCK(NULL, "mstick", mstick2_clk) 571 _REGISTER_CLOCK(NULL, "mstick", mstick2_clk)
diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
index 5a4cc1ea405..88b62a071ae 100644
--- a/arch/arm/mach-imx/clock-imx35.c
+++ b/arch/arm/mach-imx/clock-imx35.c
@@ -458,10 +458,11 @@ static struct clk_lookup lookups[] = {
458 _REGISTER_CLOCK("imx-epit.0", NULL, epit1_clk) 458 _REGISTER_CLOCK("imx-epit.0", NULL, epit1_clk)
459 _REGISTER_CLOCK("imx-epit.1", NULL, epit2_clk) 459 _REGISTER_CLOCK("imx-epit.1", NULL, epit2_clk)
460 _REGISTER_CLOCK(NULL, "esai", esai_clk) 460 _REGISTER_CLOCK(NULL, "esai", esai_clk)
461 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 461 _REGISTER_CLOCK("sdhci-esdhc-imx35.0", NULL, esdhc1_clk)
462 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 462 _REGISTER_CLOCK("sdhci-esdhc-imx35.1", NULL, esdhc2_clk)
463 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk) 463 _REGISTER_CLOCK("sdhci-esdhc-imx35.2", NULL, esdhc3_clk)
464 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 464 /* i.mx35 has the i.mx27 type fec */
465 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
465 _REGISTER_CLOCK(NULL, "gpio", gpio1_clk) 466 _REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
466 _REGISTER_CLOCK(NULL, "gpio", gpio2_clk) 467 _REGISTER_CLOCK(NULL, "gpio", gpio2_clk)
467 _REGISTER_CLOCK(NULL, "gpio", gpio3_clk) 468 _REGISTER_CLOCK(NULL, "gpio", gpio3_clk)
@@ -481,14 +482,15 @@ static struct clk_lookup lookups[] = {
481 _REGISTER_CLOCK(NULL, "rtc", rtc_clk) 482 _REGISTER_CLOCK(NULL, "rtc", rtc_clk)
482 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 483 _REGISTER_CLOCK(NULL, "rtic", rtic_clk)
483 _REGISTER_CLOCK(NULL, "scc", scc_clk) 484 _REGISTER_CLOCK(NULL, "scc", scc_clk)
484 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 485 _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
485 _REGISTER_CLOCK(NULL, "spba", spba_clk) 486 _REGISTER_CLOCK(NULL, "spba", spba_clk)
486 _REGISTER_CLOCK(NULL, "spdif", spdif_clk) 487 _REGISTER_CLOCK(NULL, "spdif", spdif_clk)
487 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 488 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
488 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 489 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
489 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 490 /* i.mx35 has the i.mx21 type uart */
490 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 491 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
491 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 492 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
493 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
492 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk) 494 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk)
493 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk) 495 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)
494 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk) 496 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
index 01ebcb31e48..66e8726253f 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
@@ -225,7 +225,8 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
225 225
226static struct esdhc_platform_data sd1_pdata = { 226static struct esdhc_platform_data sd1_pdata = {
227 .cd_gpio = GPIO_SD1CD, 227 .cd_gpio = GPIO_SD1CD,
228 .wp_gpio = -EINVAL, 228 .cd_type = ESDHC_CD_GPIO,
229 .wp_type = ESDHC_WP_NONE,
229}; 230};
230 231
231/* 232/*
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
index 558eb526ba5..0f0af02b318 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
@@ -236,7 +236,8 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
236 236
237static struct esdhc_platform_data sd1_pdata = { 237static struct esdhc_platform_data sd1_pdata = {
238 .cd_gpio = GPIO_SD1CD, 238 .cd_gpio = GPIO_SD1CD,
239 .wp_gpio = -EINVAL, 239 .cd_type = ESDHC_CD_GPIO,
240 .wp_type = ESDHC_WP_NONE,
240}; 241};
241 242
242/* 243/*
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 87887ac5806..f851fe90368 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -310,7 +310,7 @@ static struct sys_timer eukrea_cpuimx27_timer = {
310 .init = eukrea_cpuimx27_timer_init, 310 .init = eukrea_cpuimx27_timer_init,
311}; 311};
312 312
313MACHINE_START(CPUIMX27, "EUKREA CPUIMX27") 313MACHINE_START(EUKREA_CPUIMX27, "EUKREA CPUIMX27")
314 .boot_params = MX27_PHYS_OFFSET + 0x100, 314 .boot_params = MX27_PHYS_OFFSET + 0x100,
315 .map_io = mx27_map_io, 315 .map_io = mx27_map_io,
316 .init_early = imx27_init_early, 316 .init_early = imx27_init_early,
diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
index f39a478ba1a..4bd083ba9af 100644
--- a/arch/arm/mach-imx/mach-cpuimx35.c
+++ b/arch/arm/mach-imx/mach-cpuimx35.c
@@ -192,7 +192,7 @@ struct sys_timer eukrea_cpuimx35_timer = {
192 .init = eukrea_cpuimx35_timer_init, 192 .init = eukrea_cpuimx35_timer_init,
193}; 193};
194 194
195MACHINE_START(EUKREA_CPUIMX35, "Eukrea CPUIMX35") 195MACHINE_START(EUKREA_CPUIMX35SD, "Eukrea CPUIMX35")
196 /* Maintainer: Eukrea Electromatique */ 196 /* Maintainer: Eukrea Electromatique */
197 .boot_params = MX3x_PHYS_OFFSET + 0x100, 197 .boot_params = MX3x_PHYS_OFFSET + 0x100,
198 .map_io = mx35_map_io, 198 .map_io = mx35_map_io,
diff --git a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
index da36da52969..2442d5da883 100644
--- a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
+++ b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
@@ -161,7 +161,7 @@ static struct sys_timer eukrea_cpuimx25_timer = {
161 .init = eukrea_cpuimx25_timer_init, 161 .init = eukrea_cpuimx25_timer_init,
162}; 162};
163 163
164MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25") 164MACHINE_START(EUKREA_CPUIMX25SD, "Eukrea CPUIMX25")
165 /* Maintainer: Eukrea Electromatique */ 165 /* Maintainer: Eukrea Electromatique */
166 .boot_params = MX25_PHYS_OFFSET + 0x100, 166 .boot_params = MX25_PHYS_OFFSET + 0x100,
167 .map_io = mx25_map_io, 167 .map_io = mx25_map_io,
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index 6707de0ab71..6778f8193bc 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -30,6 +30,7 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <sound/tlv320aic32x4.h>
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
35#include <asm/mach/time.h> 36#include <asm/mach/time.h>
@@ -196,6 +197,17 @@ static struct pca953x_platform_data visstrim_m10_pca9555_pdata = {
196 .invert = 0, 197 .invert = 0,
197}; 198};
198 199
200static struct aic32x4_pdata visstrim_m10_aic32x4_pdata = {
201 .power_cfg = AIC32X4_PWR_MICBIAS_2075_LDOIN |
202 AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE |
203 AIC32X4_PWR_AIC32X4_LDO_ENABLE |
204 AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36 |
205 AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED,
206 .micpga_routing = AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K |
207 AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K,
208 .swapdacs = false,
209};
210
199static struct i2c_board_info visstrim_m10_i2c_devices[] = { 211static struct i2c_board_info visstrim_m10_i2c_devices[] = {
200 { 212 {
201 I2C_BOARD_INFO("pca9555", 0x20), 213 I2C_BOARD_INFO("pca9555", 0x20),
@@ -203,6 +215,7 @@ static struct i2c_board_info visstrim_m10_i2c_devices[] = {
203 }, 215 },
204 { 216 {
205 I2C_BOARD_INFO("tlv320aic32x4", 0x18), 217 I2C_BOARD_INFO("tlv320aic32x4", 0x18),
218 .platform_data = &visstrim_m10_aic32x4_pdata,
206 } 219 }
207}; 220};
208 221
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
index 01534bb6130..7f66a91df36 100644
--- a/arch/arm/mach-imx/mach-mx25_3ds.c
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c
@@ -215,6 +215,8 @@ static const struct imxi2c_platform_data mx25_3ds_i2c0_data __initconst = {
215static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = { 215static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = {
216 .wp_gpio = SD1_GPIO_WP, 216 .wp_gpio = SD1_GPIO_WP,
217 .cd_gpio = SD1_GPIO_CD, 217 .cd_gpio = SD1_GPIO_CD,
218 .wp_type = ESDHC_WP_GPIO,
219 .cd_type = ESDHC_CD_GPIO,
218}; 220};
219 221
220static void __init mx25pdk_init(void) 222static void __init mx25pdk_init(void)
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index b31d4129e10..6fa6934ab15 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -29,6 +29,7 @@
29#include <linux/mfd/mc13783.h> 29#include <linux/mfd/mc13783.h>
30#include <linux/spi/spi.h> 30#include <linux/spi/spi.h>
31#include <linux/regulator/machine.h> 31#include <linux/regulator/machine.h>
32#include <linux/spi/l4f00242t03.h>
32 33
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
@@ -47,7 +48,10 @@
47#define SPI2_SS0 IMX_GPIO_NR(4, 21) 48#define SPI2_SS0 IMX_GPIO_NR(4, 21)
48#define EXPIO_PARENT_INT gpio_to_irq(IMX_GPIO_NR(3, 28)) 49#define EXPIO_PARENT_INT gpio_to_irq(IMX_GPIO_NR(3, 28))
49#define PMIC_INT IMX_GPIO_NR(3, 14) 50#define PMIC_INT IMX_GPIO_NR(3, 14)
51#define SPI1_SS0 IMX_GPIO_NR(4, 28)
50#define SD1_CD IMX_GPIO_NR(2, 26) 52#define SD1_CD IMX_GPIO_NR(2, 26)
53#define LCD_RESET IMX_GPIO_NR(1, 3)
54#define LCD_ENABLE IMX_GPIO_NR(1, 31)
51 55
52static const int mx27pdk_pins[] __initconst = { 56static const int mx27pdk_pins[] __initconst = {
53 /* UART1 */ 57 /* UART1 */
@@ -96,6 +100,12 @@ static const int mx27pdk_pins[] __initconst = {
96 PE2_PF_USBOTG_DIR, 100 PE2_PF_USBOTG_DIR,
97 PE24_PF_USBOTG_CLK, 101 PE24_PF_USBOTG_CLK,
98 PE25_PF_USBOTG_DATA7, 102 PE25_PF_USBOTG_DATA7,
103 /* CSPI1 */
104 PD31_PF_CSPI1_MOSI,
105 PD30_PF_CSPI1_MISO,
106 PD29_PF_CSPI1_SCLK,
107 PD25_PF_CSPI1_RDY,
108 SPI1_SS0 | GPIO_GPIO | GPIO_OUT,
99 /* CSPI2 */ 109 /* CSPI2 */
100 PD22_PF_CSPI2_SCLK, 110 PD22_PF_CSPI2_SCLK,
101 PD23_PF_CSPI2_MISO, 111 PD23_PF_CSPI2_MISO,
@@ -106,6 +116,31 @@ static const int mx27pdk_pins[] __initconst = {
106 PD18_PF_I2C_CLK, 116 PD18_PF_I2C_CLK,
107 /* PMIC INT */ 117 /* PMIC INT */
108 PMIC_INT | GPIO_GPIO | GPIO_IN, 118 PMIC_INT | GPIO_GPIO | GPIO_IN,
119 /* LCD */
120 PA5_PF_LSCLK,
121 PA6_PF_LD0,
122 PA7_PF_LD1,
123 PA8_PF_LD2,
124 PA9_PF_LD3,
125 PA10_PF_LD4,
126 PA11_PF_LD5,
127 PA12_PF_LD6,
128 PA13_PF_LD7,
129 PA14_PF_LD8,
130 PA15_PF_LD9,
131 PA16_PF_LD10,
132 PA17_PF_LD11,
133 PA18_PF_LD12,
134 PA19_PF_LD13,
135 PA20_PF_LD14,
136 PA21_PF_LD15,
137 PA22_PF_LD16,
138 PA23_PF_LD17,
139 PA28_PF_HSYNC,
140 PA29_PF_VSYNC,
141 PA30_PF_CONTRAST,
142 LCD_ENABLE | GPIO_GPIO | GPIO_OUT,
143 LCD_RESET | GPIO_GPIO | GPIO_OUT,
109}; 144};
110 145
111static const struct imxuart_platform_data uart_pdata __initconst = { 146static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -258,10 +293,18 @@ static struct mc13xxx_platform_data mc13783_pdata = {
258 .num_regulators = ARRAY_SIZE(mx27_3ds_regulators), 293 .num_regulators = ARRAY_SIZE(mx27_3ds_regulators),
259 294
260 }, 295 },
261 .flags = MC13783_USE_REGULATOR, 296 .flags = MC13783_USE_REGULATOR | MC13783_USE_TOUCHSCREEN |
297 MC13783_USE_RTC,
262}; 298};
263 299
264/* SPI */ 300/* SPI */
301static int spi1_chipselect[] = {SPI1_SS0};
302
303static const struct spi_imx_master spi1_pdata __initconst = {
304 .chipselect = spi1_chipselect,
305 .num_chipselect = ARRAY_SIZE(spi1_chipselect),
306};
307
265static int spi2_chipselect[] = {SPI2_SS0}; 308static int spi2_chipselect[] = {SPI2_SS0};
266 309
267static const struct spi_imx_master spi2_pdata __initconst = { 310static const struct spi_imx_master spi2_pdata __initconst = {
@@ -269,6 +312,46 @@ static const struct spi_imx_master spi2_pdata __initconst = {
269 .num_chipselect = ARRAY_SIZE(spi2_chipselect), 312 .num_chipselect = ARRAY_SIZE(spi2_chipselect),
270}; 313};
271 314
315static struct imx_fb_videomode mx27_3ds_modes[] = {
316 { /* 480x640 @ 60 Hz */
317 .mode = {
318 .name = "Epson-VGA",
319 .refresh = 60,
320 .xres = 480,
321 .yres = 640,
322 .pixclock = 41701,
323 .left_margin = 20,
324 .right_margin = 41,
325 .upper_margin = 10,
326 .lower_margin = 5,
327 .hsync_len = 20,
328 .vsync_len = 10,
329 .sync = FB_SYNC_OE_ACT_HIGH |
330 FB_SYNC_CLK_INVERT,
331 .vmode = FB_VMODE_NONINTERLACED,
332 .flag = 0,
333 },
334 .bpp = 16,
335 .pcr = 0xFAC08B82,
336 },
337};
338
339static const struct imx_fb_platform_data mx27_3ds_fb_data __initconst = {
340 .mode = mx27_3ds_modes,
341 .num_modes = ARRAY_SIZE(mx27_3ds_modes),
342 .pwmr = 0x00A903FF,
343 .lscr1 = 0x00120300,
344 .dmacr = 0x00020010,
345};
346
347/* LCD */
348static struct l4f00242t03_pdata mx27_3ds_lcd_pdata = {
349 .reset_gpio = LCD_RESET,
350 .data_enable_gpio = LCD_ENABLE,
351 .core_supply = "lcd_2v8",
352 .io_supply = "vdd_lcdio",
353};
354
272static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { 355static struct spi_board_info mx27_3ds_spi_devs[] __initdata = {
273 { 356 {
274 .modalias = "mc13783", 357 .modalias = "mc13783",
@@ -278,6 +361,12 @@ static struct spi_board_info mx27_3ds_spi_devs[] __initdata = {
278 .platform_data = &mc13783_pdata, 361 .platform_data = &mc13783_pdata,
279 .irq = gpio_to_irq(PMIC_INT), 362 .irq = gpio_to_irq(PMIC_INT),
280 .mode = SPI_CS_HIGH, 363 .mode = SPI_CS_HIGH,
364 }, {
365 .modalias = "l4f00242t03",
366 .max_speed_hz = 5000000,
367 .bus_num = 0,
368 .chip_select = 0, /* SS0 */
369 .platform_data = &mx27_3ds_lcd_pdata,
281 }, 370 },
282}; 371};
283 372
@@ -311,12 +400,14 @@ static void __init mx27pdk_init(void)
311 imx27_add_fsl_usb2_udc(&otg_device_pdata); 400 imx27_add_fsl_usb2_udc(&otg_device_pdata);
312 401
313 imx27_add_spi_imx1(&spi2_pdata); 402 imx27_add_spi_imx1(&spi2_pdata);
403 imx27_add_spi_imx0(&spi1_pdata);
314 spi_register_board_info(mx27_3ds_spi_devs, 404 spi_register_board_info(mx27_3ds_spi_devs,
315 ARRAY_SIZE(mx27_3ds_spi_devs)); 405 ARRAY_SIZE(mx27_3ds_spi_devs));
316 406
317 if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) 407 if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT))
318 pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); 408 pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n");
319 imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); 409 imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data);
410 imx27_add_imx_fb(&mx27_3ds_fb_data);
320} 411}
321 412
322static void __init mx27pdk_timer_init(void) 413static void __init mx27pdk_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c
index 0ce49478a47..29ca8907a78 100644
--- a/arch/arm/mach-imx/mach-mx31ads.c
+++ b/arch/arm/mach-imx/mach-mx31ads.c
@@ -468,7 +468,7 @@ static struct i2c_board_info __initdata mx31ads_i2c1_devices[] = {
468#endif 468#endif
469}; 469};
470 470
471static void mxc_init_i2c(void) 471static void __init mxc_init_i2c(void)
472{ 472{
473 i2c_register_board_info(1, mx31ads_i2c1_devices, 473 i2c_register_board_info(1, mx31ads_i2c1_devices,
474 ARRAY_SIZE(mx31ads_i2c1_devices)); 474 ARRAY_SIZE(mx31ads_i2c1_devices));
@@ -486,7 +486,7 @@ static unsigned int ssi_pins[] = {
486 MX31_PIN_STXD5__STXD5, 486 MX31_PIN_STXD5__STXD5,
487}; 487};
488 488
489static void mxc_init_audio(void) 489static void __init mxc_init_audio(void)
490{ 490{
491 imx31_add_imx_ssi(0, NULL); 491 imx31_add_imx_ssi(0, NULL);
492 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); 492 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi");
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c
index 750368ddf0f..126913ad106 100644
--- a/arch/arm/mach-imx/mach-mx31lilly.c
+++ b/arch/arm/mach-imx/mach-mx31lilly.c
@@ -192,7 +192,7 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
192 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, 192 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
193}; 193};
194 194
195static void lilly1131_usb_init(void) 195static void __init lilly1131_usb_init(void)
196{ 196{
197 imx31_add_mxc_ehci_hs(1, &usbh1_pdata); 197 imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
198 198
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 163cc318caf..660ec3e80cf 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -349,6 +349,8 @@ __setup("otg_mode=", pcm043_otg_mode);
349static struct esdhc_platform_data sd1_pdata = { 349static struct esdhc_platform_data sd1_pdata = {
350 .wp_gpio = SD1_GPIO_WP, 350 .wp_gpio = SD1_GPIO_WP,
351 .cd_gpio = SD1_GPIO_CD, 351 .cd_gpio = SD1_GPIO_CD,
352 .wp_type = ESDHC_WP_GPIO,
353 .cd_type = ESDHC_CD_GPIO,
352}; 354};
353 355
354/* 356/*
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
index 6d7d518686a..3f05dfebacc 100644
--- a/arch/arm/mach-imx/mm-imx21.c
+++ b/arch/arm/mach-imx/mm-imx21.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/common.h> 24#include <mach/common.h>
25#include <mach/devices-common.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
27#include <mach/irqs.h> 28#include <mach/irqs.h>
@@ -82,4 +83,6 @@ void __init imx21_soc_init(void)
82 mxc_register_gpio("imx21-gpio", 3, MX21_GPIO4_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 83 mxc_register_gpio("imx21-gpio", 3, MX21_GPIO4_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
83 mxc_register_gpio("imx21-gpio", 4, MX21_GPIO5_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 84 mxc_register_gpio("imx21-gpio", 4, MX21_GPIO5_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
84 mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 85 mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
86
87 imx_add_imx_dma();
85} 88}
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index 9a1591c2508..cc4d152bd9b 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -24,6 +24,7 @@
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include <mach/common.h> 26#include <mach/common.h>
27#include <mach/devices-common.h>
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <mach/mx25.h> 29#include <mach/mx25.h>
29#include <mach/iomux-v3.h> 30#include <mach/iomux-v3.h>
@@ -61,6 +62,27 @@ void __init mx25_init_irq(void)
61 mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR)); 62 mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR));
62} 63}
63 64
65static struct sdma_script_start_addrs imx25_sdma_script __initdata = {
66 .ap_2_ap_addr = 729,
67 .uart_2_mcu_addr = 904,
68 .per_2_app_addr = 1255,
69 .mcu_2_app_addr = 834,
70 .uartsh_2_mcu_addr = 1120,
71 .per_2_shp_addr = 1329,
72 .mcu_2_shp_addr = 1048,
73 .ata_2_mcu_addr = 1560,
74 .mcu_2_ata_addr = 1479,
75 .app_2_per_addr = 1189,
76 .app_2_mcu_addr = 770,
77 .shp_2_per_addr = 1407,
78 .shp_2_mcu_addr = 979,
79};
80
81static struct sdma_platform_data imx25_sdma_pdata __initdata = {
82 .fw_name = "sdma-imx25.bin",
83 .script_addrs = &imx25_sdma_script,
84};
85
64void __init imx25_soc_init(void) 86void __init imx25_soc_init(void)
65{ 87{
66 /* i.mx25 has the i.mx31 type gpio */ 88 /* i.mx25 has the i.mx31 type gpio */
@@ -68,4 +90,7 @@ void __init imx25_soc_init(void)
68 mxc_register_gpio("imx31-gpio", 1, MX25_GPIO2_BASE_ADDR, SZ_16K, MX25_INT_GPIO2, 0); 90 mxc_register_gpio("imx31-gpio", 1, MX25_GPIO2_BASE_ADDR, SZ_16K, MX25_INT_GPIO2, 0);
69 mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0); 91 mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0);
70 mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0); 92 mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0);
93
94 /* i.mx25 has the i.mx35 type sdma */
95 imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
71} 96}
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
index 133b30003dd..96dd1f5ea7b 100644
--- a/arch/arm/mach-imx/mm-imx27.c
+++ b/arch/arm/mach-imx/mm-imx27.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/common.h> 24#include <mach/common.h>
25#include <mach/devices-common.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
27#include <mach/irqs.h> 28#include <mach/irqs.h>
@@ -83,4 +84,6 @@ void __init imx27_soc_init(void)
83 mxc_register_gpio("imx21-gpio", 3, MX27_GPIO4_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 84 mxc_register_gpio("imx21-gpio", 3, MX27_GPIO4_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
84 mxc_register_gpio("imx21-gpio", 4, MX27_GPIO5_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 85 mxc_register_gpio("imx21-gpio", 4, MX27_GPIO5_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
85 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 86 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
87
88 imx_add_imx_dma();
86} 89}
diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c
index 6d103c01b8b..b7c55e7db00 100644
--- a/arch/arm/mach-imx/mm-imx31.c
+++ b/arch/arm/mach-imx/mm-imx31.c
@@ -24,6 +24,7 @@
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include <mach/common.h> 26#include <mach/common.h>
27#include <mach/devices-common.h>
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <mach/iomux-v3.h> 29#include <mach/iomux-v3.h>
29#include <mach/irqs.h> 30#include <mach/irqs.h>
@@ -57,9 +58,34 @@ void __init mx31_init_irq(void)
57 mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR)); 58 mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR));
58} 59}
59 60
61static struct sdma_script_start_addrs imx31_to1_sdma_script __initdata = {
62 .per_2_per_addr = 1677,
63};
64
65static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {
66 .ap_2_ap_addr = 423,
67 .ap_2_bp_addr = 829,
68 .bp_2_ap_addr = 1029,
69};
70
71static struct sdma_platform_data imx31_sdma_pdata __initdata = {
72 .fw_name = "sdma-imx31-to2.bin",
73 .script_addrs = &imx31_to2_sdma_script,
74};
75
60void __init imx31_soc_init(void) 76void __init imx31_soc_init(void)
61{ 77{
78 int to_version = mx31_revision() >> 4;
79
62 mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0); 80 mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0);
63 mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0); 81 mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0);
64 mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0); 82 mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0);
83
84 if (to_version == 1) {
85 strncpy(imx31_sdma_pdata.fw_name, "sdma-imx31-to1.bin",
86 strlen(imx31_sdma_pdata.fw_name));
87 imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script;
88 }
89
90 imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
65} 91}
diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c
index bb068bc8dab..f49bac7a1ed 100644
--- a/arch/arm/mach-imx/mm-imx35.c
+++ b/arch/arm/mach-imx/mm-imx35.c
@@ -25,6 +25,7 @@
25#include <asm/hardware/cache-l2x0.h> 25#include <asm/hardware/cache-l2x0.h>
26 26
27#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/devices-common.h>
28#include <mach/hardware.h> 29#include <mach/hardware.h>
29#include <mach/iomux-v3.h> 30#include <mach/iomux-v3.h>
30#include <mach/irqs.h> 31#include <mach/irqs.h>
@@ -54,10 +55,55 @@ void __init mx35_init_irq(void)
54 mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR)); 55 mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR));
55} 56}
56 57
58static struct sdma_script_start_addrs imx35_to1_sdma_script __initdata = {
59 .ap_2_ap_addr = 642,
60 .uart_2_mcu_addr = 817,
61 .mcu_2_app_addr = 747,
62 .uartsh_2_mcu_addr = 1183,
63 .per_2_shp_addr = 1033,
64 .mcu_2_shp_addr = 961,
65 .ata_2_mcu_addr = 1333,
66 .mcu_2_ata_addr = 1252,
67 .app_2_mcu_addr = 683,
68 .shp_2_per_addr = 1111,
69 .shp_2_mcu_addr = 892,
70};
71
72static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {
73 .ap_2_ap_addr = 729,
74 .uart_2_mcu_addr = 904,
75 .per_2_app_addr = 1597,
76 .mcu_2_app_addr = 834,
77 .uartsh_2_mcu_addr = 1270,
78 .per_2_shp_addr = 1120,
79 .mcu_2_shp_addr = 1048,
80 .ata_2_mcu_addr = 1429,
81 .mcu_2_ata_addr = 1339,
82 .app_2_per_addr = 1531,
83 .app_2_mcu_addr = 770,
84 .shp_2_per_addr = 1198,
85 .shp_2_mcu_addr = 979,
86};
87
88static struct sdma_platform_data imx35_sdma_pdata __initdata = {
89 .fw_name = "sdma-imx35-to2.bin",
90 .script_addrs = &imx35_to2_sdma_script,
91};
92
57void __init imx35_soc_init(void) 93void __init imx35_soc_init(void)
58{ 94{
95 int to_version = mx35_revision() >> 4;
96
59 /* i.mx35 has the i.mx31 type gpio */ 97 /* i.mx35 has the i.mx31 type gpio */
60 mxc_register_gpio("imx31-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0); 98 mxc_register_gpio("imx31-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0);
61 mxc_register_gpio("imx31-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0); 99 mxc_register_gpio("imx31-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0);
62 mxc_register_gpio("imx31-gpio", 2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0); 100 mxc_register_gpio("imx31-gpio", 2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0);
101
102 if (to_version == 1) {
103 strncpy(imx35_sdma_pdata.fw_name, "sdma-imx35-to1.bin",
104 strlen(imx35_sdma_pdata.fw_name));
105 imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script;
106 }
107
108 imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
63} 109}
diff --git a/arch/arm/mach-integrator/include/mach/hardware.h b/arch/arm/mach-integrator/include/mach/hardware.h
index 57f51ba1125..65fed7c0eb8 100644
--- a/arch/arm/mach-integrator/include/mach/hardware.h
+++ b/arch/arm/mach-integrator/include/mach/hardware.h
@@ -32,13 +32,6 @@
32#define IO_SIZE 0x0B000000 // How much? 32#define IO_SIZE 0x0B000000 // How much?
33#define IO_START INTEGRATOR_HDR_BASE // PA of IO 33#define IO_START INTEGRATOR_HDR_BASE // PA of IO
34 34
35#define PCIMEM_BASE PCI_MEMORY_VADDR
36
37#define pcibios_assign_all_busses() 1
38
39#define PCIBIOS_MIN_IO 0x6000
40#define PCIBIOS_MIN_MEM 0x00100000
41
42/* macro to get at IO space when running virtually */ 35/* macro to get at IO space when running virtually */
43#ifdef CONFIG_MMU 36#ifdef CONFIG_MMU
44#define IO_ADDRESS(x) (((x) & 0x000fffff) | (((x) >> 4) & 0x0ff00000) | IO_BASE) 37#define IO_ADDRESS(x) (((x) & 0x000fffff) | (((x) >> 4) & 0x0ff00000) | IO_BASE)
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 2fbbdd5eac3..fcf0ae95651 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -337,15 +337,15 @@ static unsigned long timer_reload;
337static void integrator_clocksource_init(u32 khz) 337static void integrator_clocksource_init(u32 khz)
338{ 338{
339 void __iomem *base = (void __iomem *)TIMER2_VA_BASE; 339 void __iomem *base = (void __iomem *)TIMER2_VA_BASE;
340 u32 ctrl = TIMER_CTRL_ENABLE; 340 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC;
341 341
342 if (khz >= 1500) { 342 if (khz >= 1500) {
343 khz /= 16; 343 khz /= 16;
344 ctrl = TIMER_CTRL_DIV16; 344 ctrl |= TIMER_CTRL_DIV16;
345 } 345 }
346 346
347 writel(ctrl, base + TIMER_CTRL);
348 writel(0xffff, base + TIMER_LOAD); 347 writel(0xffff, base + TIMER_LOAD);
348 writel(ctrl, base + TIMER_CTRL);
349 349
350 clocksource_mmio_init(base + TIMER_VALUE, "timer2", 350 clocksource_mmio_init(base + TIMER_VALUE, "timer2",
351 khz * 1000, 200, 16, clocksource_mmio_readl_down); 351 khz * 1000, 200, 16, clocksource_mmio_readl_down);
diff --git a/arch/arm/mach-integrator/pci.c b/arch/arm/mach-integrator/pci.c
index 2fdb95433f0..520b6bf81bb 100644
--- a/arch/arm/mach-integrator/pci.c
+++ b/arch/arm/mach-integrator/pci.c
@@ -95,7 +95,7 @@ static int irq_tab[4] __initdata = {
95 * map the specified device/slot/pin to an IRQ. This works out such 95 * map the specified device/slot/pin to an IRQ. This works out such
96 * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1. 96 * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1.
97 */ 97 */
98static int __init integrator_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 98static int __init integrator_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
99{ 99{
100 int intnr = ((slot - 9) + (pin - 1)) & 3; 100 int intnr = ((slot - 9) + (pin - 1)) & 3;
101 101
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index 6467d99fa2e..dd56bfb351e 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -27,6 +27,7 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/io.h> 29#include <linux/io.h>
30#include <video/vga.h>
30 31
31#include <mach/hardware.h> 32#include <mach/hardware.h>
32#include <mach/platform.h> 33#include <mach/platform.h>
@@ -502,6 +503,10 @@ void __init pci_v3_preinit(void)
502 unsigned int temp; 503 unsigned int temp;
503 int ret; 504 int ret;
504 505
506 pcibios_min_io = 0x6000;
507 pcibios_min_mem = 0x00100000;
508 vga_base = PCI_MEMORY_VADDR;
509
505 /* 510 /*
506 * Hook in our fault handler for PCI errors 511 * Hook in our fault handler for PCI errors
507 */ 512 */
diff --git a/arch/arm/mach-iop13xx/include/mach/hardware.h b/arch/arm/mach-iop13xx/include/mach/hardware.h
index 8e1d5628984..786fa266fab 100644
--- a/arch/arm/mach-iop13xx/include/mach/hardware.h
+++ b/arch/arm/mach-iop13xx/include/mach/hardware.h
@@ -2,18 +2,11 @@
2#define __ASM_ARCH_HARDWARE_H 2#define __ASM_ARCH_HARDWARE_H
3#include <asm/types.h> 3#include <asm/types.h>
4 4
5#define pcibios_assign_all_busses() 1
6
7#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
8extern unsigned long iop13xx_pcibios_min_io;
9extern unsigned long iop13xx_pcibios_min_mem;
10extern u16 iop13xx_dev_id(void); 6extern u16 iop13xx_dev_id(void);
11extern void iop13xx_set_atu_mmr_bases(void); 7extern void iop13xx_set_atu_mmr_bases(void);
12#endif 8#endif
13 9
14#define PCIBIOS_MIN_IO (iop13xx_pcibios_min_io)
15#define PCIBIOS_MIN_MEM (iop13xx_pcibios_min_mem)
16
17/* 10/*
18 * Generic chipset bits 11 * Generic chipset bits
19 * 12 *
diff --git a/arch/arm/mach-iop13xx/iq81340mc.c b/arch/arm/mach-iop13xx/iq81340mc.c
index 9b5a63f5d07..23dfaffc586 100644
--- a/arch/arm/mach-iop13xx/iq81340mc.c
+++ b/arch/arm/mach-iop13xx/iq81340mc.c
@@ -30,7 +30,7 @@
30extern int init_atu; /* Flag to select which ATU(s) to initialize / disable */ 30extern int init_atu; /* Flag to select which ATU(s) to initialize / disable */
31 31
32static int __init 32static int __init
33iq81340mc_pcix_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) 33iq81340mc_pcix_map_irq(const struct pci_dev *dev, u8 idsel, u8 pin)
34{ 34{
35 switch (idsel) { 35 switch (idsel) {
36 case 1: 36 case 1:
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index ba3dae352a2..251c40897da 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -39,8 +39,6 @@ u32 iop13xx_atue_mem_base;
39u32 iop13xx_atux_mem_base; 39u32 iop13xx_atux_mem_base;
40size_t iop13xx_atue_mem_size; 40size_t iop13xx_atue_mem_size;
41size_t iop13xx_atux_mem_size; 41size_t iop13xx_atux_mem_size;
42unsigned long iop13xx_pcibios_min_io = 0;
43unsigned long iop13xx_pcibios_min_mem = 0;
44 42
45EXPORT_SYMBOL(iop13xx_atue_mem_base); 43EXPORT_SYMBOL(iop13xx_atue_mem_base);
46EXPORT_SYMBOL(iop13xx_atux_mem_base); 44EXPORT_SYMBOL(iop13xx_atux_mem_base);
@@ -390,7 +388,7 @@ static int iop13xx_atue_pci_status(int clear)
390} 388}
391 389
392static int 390static int
393iop13xx_pcie_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) 391iop13xx_pcie_map_irq(const struct pci_dev *dev, u8 idsel, u8 pin)
394{ 392{
395 WARN_ON(idsel != 0); 393 WARN_ON(idsel != 0);
396 394
@@ -971,7 +969,8 @@ void __init iop13xx_pci_init(void)
971 __raw_writel(__raw_readl(IOP13XX_XBG_BECSR) & 3, IOP13XX_XBG_BECSR); 969 __raw_writel(__raw_readl(IOP13XX_XBG_BECSR) & 3, IOP13XX_XBG_BECSR);
972 970
973 /* Setup the Min Address for PCI memory... */ 971 /* Setup the Min Address for PCI memory... */
974 iop13xx_pcibios_min_mem = IOP13XX_PCIX_LOWER_MEM_BA; 972 pcibios_min_io = 0;
973 pcibios_min_mem = IOP13XX_PCIX_LOWER_MEM_BA;
975 974
976 /* if Linux is given control of an ATU 975 /* if Linux is given control of an ATU
977 * clear out its prior configuration, 976 * clear out its prior configuration,
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
index 779f924af30..6cbffbfc2bb 100644
--- a/arch/arm/mach-iop32x/em7210.c
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -81,7 +81,7 @@ void __init em7210_map_io(void)
81#define INTD IRQ_IOP32X_XINT3 81#define INTD IRQ_IOP32X_XINT3
82 82
83static int __init 83static int __init
84em7210_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 84em7210_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
85{ 85{
86 static int pci_irq_table[][4] = { 86 static int pci_irq_table[][4] = {
87 /* 87 /*
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c
index c6b6f9c5650..ceef5d4dce1 100644
--- a/arch/arm/mach-iop32x/glantank.c
+++ b/arch/arm/mach-iop32x/glantank.c
@@ -77,7 +77,7 @@ void __init glantank_map_io(void)
77#define INTD IRQ_IOP32X_XINT3 77#define INTD IRQ_IOP32X_XINT3
78 78
79static int __init 79static int __init
80glantank_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 80glantank_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
81{ 81{
82 static int pci_irq_table[][4] = { 82 static int pci_irq_table[][4] = {
83 /* 83 /*
diff --git a/arch/arm/mach-iop32x/include/mach/hardware.h b/arch/arm/mach-iop32x/include/mach/hardware.h
index d559c4e6095..48cb1b20ba9 100644
--- a/arch/arm/mach-iop32x/include/mach/hardware.h
+++ b/arch/arm/mach-iop32x/include/mach/hardware.h
@@ -18,9 +18,6 @@
18 * but when we read them, we convert them to virtual addresses. See 18 * but when we read them, we convert them to virtual addresses. See
19 * arch/arm/plat-iop/pci.c. 19 * arch/arm/plat-iop/pci.c.
20 */ 20 */
21#define pcibios_assign_all_busses() 1
22#define PCIBIOS_MIN_IO 0x00000000
23#define PCIBIOS_MIN_MEM 0x00000000
24 21
25#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
26void iop32x_init_irq(void); 23void iop32x_init_irq(void);
diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
index fde962c057f..3a62514dae7 100644
--- a/arch/arm/mach-iop32x/iq31244.c
+++ b/arch/arm/mach-iop32x/iq31244.c
@@ -103,7 +103,7 @@ void __init iq31244_map_io(void)
103 * EP80219/IQ31244 PCI. 103 * EP80219/IQ31244 PCI.
104 */ 104 */
105static int __init 105static int __init
106ep80219_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 106ep80219_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
107{ 107{
108 int irq; 108 int irq;
109 109
@@ -139,7 +139,7 @@ static struct hw_pci ep80219_pci __initdata = {
139}; 139};
140 140
141static int __init 141static int __init
142iq31244_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 142iq31244_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
143{ 143{
144 int irq; 144 int irq;
145 145
diff --git a/arch/arm/mach-iop32x/iq80321.c b/arch/arm/mach-iop32x/iq80321.c
index 3a95950e873..35b7e6914d3 100644
--- a/arch/arm/mach-iop32x/iq80321.c
+++ b/arch/arm/mach-iop32x/iq80321.c
@@ -71,7 +71,7 @@ void __init iq80321_map_io(void)
71 * IQ80321 PCI. 71 * IQ80321 PCI.
72 */ 72 */
73static int __init 73static int __init
74iq80321_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 74iq80321_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
75{ 75{
76 int irq; 76 int irq;
77 77
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index 626aa375915..1a374eab600 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -78,7 +78,7 @@ void __init n2100_map_io(void)
78 * N2100 PCI. 78 * N2100 PCI.
79 */ 79 */
80static int __init 80static int __init
81n2100_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 81n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
82{ 82{
83 int irq; 83 int irq;
84 84
diff --git a/arch/arm/mach-iop33x/include/mach/hardware.h b/arch/arm/mach-iop33x/include/mach/hardware.h
index 8c10e430655..839285315e4 100644
--- a/arch/arm/mach-iop33x/include/mach/hardware.h
+++ b/arch/arm/mach-iop33x/include/mach/hardware.h
@@ -18,9 +18,6 @@
18 * but when we read them, we convert them to virtual addresses. See 18 * but when we read them, we convert them to virtual addresses. See
19 * arch/arm/mach-iop3xx/iop3xx-pci.c 19 * arch/arm/mach-iop3xx/iop3xx-pci.c
20 */ 20 */
21#define pcibios_assign_all_busses() 1
22#define PCIBIOS_MIN_IO 0x00000000
23#define PCIBIOS_MIN_MEM 0x00000000
24 21
25#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
26void iop33x_init_irq(void); 23void iop33x_init_irq(void);
diff --git a/arch/arm/mach-iop33x/iq80331.c b/arch/arm/mach-iop33x/iq80331.c
index c565f8d1e3a..637c0272d5e 100644
--- a/arch/arm/mach-iop33x/iq80331.c
+++ b/arch/arm/mach-iop33x/iq80331.c
@@ -54,7 +54,7 @@ static struct sys_timer iq80331_timer = {
54 * IQ80331 PCI. 54 * IQ80331 PCI.
55 */ 55 */
56static int __init 56static int __init
57iq80331_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 57iq80331_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
58{ 58{
59 int irq; 59 int irq;
60 60
diff --git a/arch/arm/mach-iop33x/iq80332.c b/arch/arm/mach-iop33x/iq80332.c
index 36a9efb254c..90a0436d725 100644
--- a/arch/arm/mach-iop33x/iq80332.c
+++ b/arch/arm/mach-iop33x/iq80332.c
@@ -54,7 +54,7 @@ static struct sys_timer iq80332_timer = {
54 * IQ80332 PCI. 54 * IQ80332 PCI.
55 */ 55 */
56static int __init 56static int __init
57iq80332_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 57iq80332_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
58{ 58{
59 int irq; 59 int irq;
60 60
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
index 88663ab1d2a..62c60ade527 100644
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ b/arch/arm/mach-ixp2000/enp2611.c
@@ -148,7 +148,8 @@ static struct pci_bus * __init enp2611_pci_scan_bus(int nr,
148 return pci_scan_bus(sys->busnr, &enp2611_pci_ops, sys); 148 return pci_scan_bus(sys->busnr, &enp2611_pci_ops, sys);
149} 149}
150 150
151static int __init enp2611_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 151static int __init enp2611_pci_map_irq(const struct pci_dev *dev, u8 slot,
152 u8 pin)
152{ 153{
153 int irq; 154 int irq;
154 155
diff --git a/arch/arm/mach-ixp2000/include/mach/hardware.h b/arch/arm/mach-ixp2000/include/mach/hardware.h
index f033de4e749..cdaf1db8400 100644
--- a/arch/arm/mach-ixp2000/include/mach/hardware.h
+++ b/arch/arm/mach-ixp2000/include/mach/hardware.h
@@ -19,16 +19,8 @@
19#ifndef __ASM_ARCH_HARDWARE_H__ 19#ifndef __ASM_ARCH_HARDWARE_H__
20#define __ASM_ARCH_HARDWARE_H__ 20#define __ASM_ARCH_HARDWARE_H__
21 21
22/*
23 * This needs to be platform-specific?
24 */
25#define PCIBIOS_MIN_IO 0x00000000
26#define PCIBIOS_MIN_MEM 0x00000000
27
28#include "ixp2000-regs.h" /* Chipset Registers */ 22#include "ixp2000-regs.h" /* Chipset Registers */
29 23
30#define pcibios_assign_all_busses() 0
31
32/* 24/*
33 * Platform helper functions 25 * Platform helper functions
34 */ 26 */
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index dfffc1e817f..5bad1a8419b 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -78,7 +78,8 @@ int ixdp2400_pci_setup(int nr, struct pci_sys_data *sys)
78 return 1; 78 return 1;
79} 79}
80 80
81static int __init ixdp2400_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 81static int __init ixdp2400_pci_map_irq(const struct pci_dev *dev, u8 slot,
82 u8 pin)
82{ 83{
83 if (ixdp2x00_master_npu()) { 84 if (ixdp2x00_master_npu()) {
84 85
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c
index cd4c9bcff2b..3d3cef87646 100644
--- a/arch/arm/mach-ixp2000/ixdp2800.c
+++ b/arch/arm/mach-ixp2000/ixdp2800.c
@@ -161,7 +161,8 @@ static int __init ixdp2800_pci_setup(int nr, struct pci_sys_data *sys)
161 return 1; 161 return 1;
162} 162}
163 163
164static int __init ixdp2800_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 164static int __init ixdp2800_pci_map_irq(const struct pci_dev *dev, u8 slot,
165 u8 pin)
165{ 166{
166 if (ixdp2x00_master_npu()) { 167 if (ixdp2x00_master_npu()) {
167 168
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
index 84835b20955..be2a254f137 100644
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c
@@ -252,7 +252,8 @@ void __init ixdp2x01_pci_preinit(void)
252 252
253#define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) 253#define DEVPIN(dev, pin) ((pin) | ((dev) << 3))
254 254
255static int __init ixdp2x01_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 255static int __init ixdp2x01_pci_map_irq(const struct pci_dev *dev, u8 slot,
256 u8 pin)
256{ 257{
257 u8 bus = dev->bus->number; 258 u8 bus = dev->bus->number;
258 u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin); 259 u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin);
diff --git a/arch/arm/mach-ixp2000/pci.c b/arch/arm/mach-ixp2000/pci.c
index f797c5f538b..f5098b306fd 100644
--- a/arch/arm/mach-ixp2000/pci.c
+++ b/arch/arm/mach-ixp2000/pci.c
@@ -196,6 +196,11 @@ clear_master_aborts(void)
196void __init 196void __init
197ixp2000_pci_preinit(void) 197ixp2000_pci_preinit(void)
198{ 198{
199 pci_set_flags(0);
200
201 pcibios_min_io = 0;
202 pcibios_min_mem = 0;
203
199#ifndef CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO 204#ifndef CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO
200 /* 205 /*
201 * Configure the PCI unit to properly byteswap I/O transactions, 206 * Configure the PCI unit to properly byteswap I/O transactions,
diff --git a/arch/arm/mach-ixp23xx/include/mach/hardware.h b/arch/arm/mach-ixp23xx/include/mach/hardware.h
index 57b508bfe28..60e55fa1023 100644
--- a/arch/arm/mach-ixp23xx/include/mach/hardware.h
+++ b/arch/arm/mach-ixp23xx/include/mach/hardware.h
@@ -15,13 +15,9 @@
15#define __ASM_ARCH_HARDWARE_H 15#define __ASM_ARCH_HARDWARE_H
16 16
17/* PCI IO info */ 17/* PCI IO info */
18#define PCIBIOS_MIN_IO 0x00000000
19#define PCIBIOS_MIN_MEM 0xe0000000
20 18
21#include "ixp23xx.h" 19#include "ixp23xx.h"
22 20
23#define pcibios_assign_all_busses() 0
24
25/* 21/*
26 * Platform helper functions 22 * Platform helper functions
27 */ 23 */
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
index 8dcba17c81e..ec028e35f40 100644
--- a/arch/arm/mach-ixp23xx/ixdp2351.c
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -168,7 +168,7 @@ void __init ixdp2351_init_irq(void)
168 */ 168 */
169#define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) 169#define DEVPIN(dev, pin) ((pin) | ((dev) << 3))
170 170
171static int __init ixdp2351_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 171static int __init ixdp2351_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
172{ 172{
173 u8 bus = dev->bus->number; 173 u8 bus = dev->bus->number;
174 u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin); 174 u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin);
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c
index 563819a8329..e6be5711c70 100644
--- a/arch/arm/mach-ixp23xx/pci.c
+++ b/arch/arm/mach-ixp23xx/pci.c
@@ -227,6 +227,11 @@ static void __init ixp23xx_pci_common_init(void)
227 227
228void __init ixp23xx_pci_preinit(void) 228void __init ixp23xx_pci_preinit(void)
229{ 229{
230 pcibios_min_io = 0;
231 pcibios_min_mem = 0xe0000000;
232
233 pci_set_flags(0);
234
230 ixp23xx_pci_common_init(); 235 ixp23xx_pci_common_init();
231 236
232 hook_fault_code(16+6, ixp23xx_pci_abort_handler, SIGBUS, 0, 237 hook_fault_code(16+6, ixp23xx_pci_abort_handler, SIGBUS, 0,
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
index 8fe0c627326..844551d2368 100644
--- a/arch/arm/mach-ixp23xx/roadrunner.c
+++ b/arch/arm/mach-ixp23xx/roadrunner.c
@@ -56,7 +56,8 @@
56#define INTC_PIN IXP23XX_GPIO_PIN_11 56#define INTC_PIN IXP23XX_GPIO_PIN_11
57#define INTD_PIN IXP23XX_GPIO_PIN_12 57#define INTD_PIN IXP23XX_GPIO_PIN_12
58 58
59static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) 59static int __init roadrunner_map_irq(const struct pci_dev *dev, u8 idsel,
60 u8 pin)
60{ 61{
61 static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA}; 62 static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
62 static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD}; 63 static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
diff --git a/arch/arm/mach-ixp4xx/avila-pci.c b/arch/arm/mach-ixp4xx/avila-pci.c
index 162043ff29f..8fea0a3c524 100644
--- a/arch/arm/mach-ixp4xx/avila-pci.c
+++ b/arch/arm/mach-ixp4xx/avila-pci.c
@@ -46,7 +46,7 @@ void __init avila_pci_preinit(void)
46 ixp4xx_pci_preinit(); 46 ixp4xx_pci_preinit();
47} 47}
48 48
49static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 49static int __init avila_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
50{ 50{
51 static int pci_irq_table[IRQ_LINES] = { 51 static int pci_irq_table[IRQ_LINES] = {
52 IXP4XX_GPIO_IRQ(INTA), 52 IXP4XX_GPIO_IRQ(INTA),
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index e2e98bbb641..2131832ee6b 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -346,6 +346,11 @@ void __init ixp4xx_pci_preinit(void)
346{ 346{
347 unsigned long cpuid = read_cpuid_id(); 347 unsigned long cpuid = read_cpuid_id();
348 348
349#ifdef CONFIG_IXP4XX_INDIRECT_PCI
350 pcibios_min_mem = 0x10000000; /* 1 GB of indirect PCI MMIO space */
351#else
352 pcibios_min_mem = 0x48000000; /* 64 MB of PCI MMIO space */
353#endif
349 /* 354 /*
350 * Determine which PCI read method to use. 355 * Determine which PCI read method to use.
351 * Rev 0 IXP425 requires workaround. 356 * Rev 0 IXP425 requires workaround.
diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c
index 37fda7d6e83..71f5c9c60fc 100644
--- a/arch/arm/mach-ixp4xx/coyote-pci.c
+++ b/arch/arm/mach-ixp4xx/coyote-pci.c
@@ -37,7 +37,7 @@ void __init coyote_pci_preinit(void)
37 ixp4xx_pci_preinit(); 37 ixp4xx_pci_preinit();
38} 38}
39 39
40static int __init coyote_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 40static int __init coyote_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
41{ 41{
42 if (slot == SLOT0_DEVID) 42 if (slot == SLOT0_DEVID)
43 return IXP4XX_GPIO_IRQ(SLOT0_INTA); 43 return IXP4XX_GPIO_IRQ(SLOT0_INTA);
diff --git a/arch/arm/mach-ixp4xx/dsmg600-pci.c b/arch/arm/mach-ixp4xx/dsmg600-pci.c
index c7612010b3f..0532510b5e8 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-pci.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-pci.c
@@ -44,7 +44,7 @@ void __init dsmg600_pci_preinit(void)
44 ixp4xx_pci_preinit(); 44 ixp4xx_pci_preinit();
45} 45}
46 46
47static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 47static int __init dsmg600_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
48{ 48{
49 static int pci_irq_table[MAX_DEV][IRQ_LINES] = { 49 static int pci_irq_table[MAX_DEV][IRQ_LINES] = {
50 { IXP4XX_GPIO_IRQ(INTE), -1, -1 }, 50 { IXP4XX_GPIO_IRQ(INTE), -1, -1 },
diff --git a/arch/arm/mach-ixp4xx/fsg-pci.c b/arch/arm/mach-ixp4xx/fsg-pci.c
index 44ccde9d487..d2ac803328f 100644
--- a/arch/arm/mach-ixp4xx/fsg-pci.c
+++ b/arch/arm/mach-ixp4xx/fsg-pci.c
@@ -38,7 +38,7 @@ void __init fsg_pci_preinit(void)
38 ixp4xx_pci_preinit(); 38 ixp4xx_pci_preinit();
39} 39}
40 40
41static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 41static int __init fsg_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
42{ 42{
43 static int pci_irq_table[IRQ_LINES] = { 43 static int pci_irq_table[IRQ_LINES] = {
44 IXP4XX_GPIO_IRQ(INTC), 44 IXP4XX_GPIO_IRQ(INTC),
diff --git a/arch/arm/mach-ixp4xx/gateway7001-pci.c b/arch/arm/mach-ixp4xx/gateway7001-pci.c
index fc112416887..76581fb467c 100644
--- a/arch/arm/mach-ixp4xx/gateway7001-pci.c
+++ b/arch/arm/mach-ixp4xx/gateway7001-pci.c
@@ -35,7 +35,8 @@ void __init gateway7001_pci_preinit(void)
35 ixp4xx_pci_preinit(); 35 ixp4xx_pci_preinit();
36} 36}
37 37
38static int __init gateway7001_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 38static int __init gateway7001_map_irq(const struct pci_dev *dev, u8 slot,
39 u8 pin)
39{ 40{
40 if (slot == 1) 41 if (slot == 1)
41 return IRQ_IXP4XX_GPIO11; 42 return IRQ_IXP4XX_GPIO11;
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index 5f00ad224fe..7548d9a2efe 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -462,7 +462,7 @@ static void __init gmlr_pci_postinit(void)
462 } 462 }
463} 463}
464 464
465static int __init gmlr_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 465static int __init gmlr_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
466{ 466{
467 switch(slot) { 467 switch(slot) {
468 case SLOT_ETHA: return IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA); 468 case SLOT_ETHA: return IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA);
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
index 38cc0725dbd..d68fc068c38 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
@@ -49,7 +49,7 @@ void __init gtwx5715_pci_preinit(void)
49} 49}
50 50
51 51
52static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 52static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
53{ 53{
54 int rc = -1; 54 int rc = -1;
55 55
diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h
index 8138371c406..c30e7e923a7 100644
--- a/arch/arm/mach-ixp4xx/include/mach/hardware.h
+++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h
@@ -17,19 +17,14 @@
17#ifndef __ASM_ARCH_HARDWARE_H__ 17#ifndef __ASM_ARCH_HARDWARE_H__
18#define __ASM_ARCH_HARDWARE_H__ 18#define __ASM_ARCH_HARDWARE_H__
19 19
20#define PCIBIOS_MIN_IO 0x00001000
21#ifdef CONFIG_IXP4XX_INDIRECT_PCI 20#ifdef CONFIG_IXP4XX_INDIRECT_PCI
22#define PCIBIOS_MIN_MEM 0x10000000 /* 1 GB of indirect PCI MMIO space */
23#define PCIBIOS_MAX_MEM 0x4FFFFFFF 21#define PCIBIOS_MAX_MEM 0x4FFFFFFF
24#else 22#else
25#define PCIBIOS_MIN_MEM 0x48000000 /* 64 MB of PCI MMIO space */
26#define PCIBIOS_MAX_MEM 0x4BFFFFFF 23#define PCIBIOS_MAX_MEM 0x4BFFFFFF
27#endif 24#endif
28 25
29#define ARCH_HAS_DMA_SET_COHERENT_MASK 26#define ARCH_HAS_DMA_SET_COHERENT_MASK
30 27
31#define pcibios_assign_all_busses() 1
32
33/* Register locations and bits */ 28/* Register locations and bits */
34#include "ixp4xx-regs.h" 29#include "ixp4xx-regs.h"
35 30
diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c
index 58f400417ea..fffd8c5e40b 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
@@ -43,7 +43,7 @@ void __init ixdp425_pci_preinit(void)
43 ixp4xx_pci_preinit(); 43 ixp4xx_pci_preinit();
44} 44}
45 45
46static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 46static int __init ixdp425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
47{ 47{
48 static int pci_irq_table[IRQ_LINES] = { 48 static int pci_irq_table[IRQ_LINES] = {
49 IXP4XX_GPIO_IRQ(INTA), 49 IXP4XX_GPIO_IRQ(INTA),
diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
index e64f6d04148..34efe75015e 100644
--- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
@@ -31,7 +31,7 @@ void __init ixdpg425_pci_preinit(void)
31 ixp4xx_pci_preinit(); 31 ixp4xx_pci_preinit();
32} 32}
33 33
34static int __init ixdpg425_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 34static int __init ixdpg425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
35{ 35{
36 if (slot == 12 || slot == 13) 36 if (slot == 12 || slot == 13)
37 return IRQ_IXP4XX_GPIO7; 37 return IRQ_IXP4XX_GPIO7;
diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c
index 428d1202b79..5434ccf553e 100644
--- a/arch/arm/mach-ixp4xx/nas100d-pci.c
+++ b/arch/arm/mach-ixp4xx/nas100d-pci.c
@@ -41,7 +41,7 @@ void __init nas100d_pci_preinit(void)
41 ixp4xx_pci_preinit(); 41 ixp4xx_pci_preinit();
42} 42}
43 43
44static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 44static int __init nas100d_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
45{ 45{
46 static int pci_irq_table[MAX_DEV][IRQ_LINES] = { 46 static int pci_irq_table[MAX_DEV][IRQ_LINES] = {
47 { IXP4XX_GPIO_IRQ(INTA), -1, -1 }, 47 { IXP4XX_GPIO_IRQ(INTA), -1, -1 },
diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c
index 2e85f76b950..b57160535e4 100644
--- a/arch/arm/mach-ixp4xx/nslu2-pci.c
+++ b/arch/arm/mach-ixp4xx/nslu2-pci.c
@@ -38,7 +38,7 @@ void __init nslu2_pci_preinit(void)
38 ixp4xx_pci_preinit(); 38 ixp4xx_pci_preinit();
39} 39}
40 40
41static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 41static int __init nslu2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
42{ 42{
43 static int pci_irq_table[IRQ_LINES] = { 43 static int pci_irq_table[IRQ_LINES] = {
44 IXP4XX_GPIO_IRQ(INTA), 44 IXP4XX_GPIO_IRQ(INTA),
diff --git a/arch/arm/mach-ixp4xx/vulcan-pci.c b/arch/arm/mach-ixp4xx/vulcan-pci.c
index 03bdec5140a..0bc3f34c282 100644
--- a/arch/arm/mach-ixp4xx/vulcan-pci.c
+++ b/arch/arm/mach-ixp4xx/vulcan-pci.c
@@ -43,7 +43,7 @@ void __init vulcan_pci_preinit(void)
43 ixp4xx_pci_preinit(); 43 ixp4xx_pci_preinit();
44} 44}
45 45
46static int __init vulcan_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 46static int __init vulcan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
47{ 47{
48 if (slot == 1) 48 if (slot == 1)
49 return IXP4XX_GPIO_IRQ(INTA); 49 return IXP4XX_GPIO_IRQ(INTA);
diff --git a/arch/arm/mach-ixp4xx/wg302v2-pci.c b/arch/arm/mach-ixp4xx/wg302v2-pci.c
index 17f3cf59a31..f27dfcfe811 100644
--- a/arch/arm/mach-ixp4xx/wg302v2-pci.c
+++ b/arch/arm/mach-ixp4xx/wg302v2-pci.c
@@ -35,7 +35,7 @@ void __init wg302v2_pci_preinit(void)
35 ixp4xx_pci_preinit(); 35 ixp4xx_pci_preinit();
36} 36}
37 37
38static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 38static int __init wg302v2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
39{ 39{
40 if (slot == 1) 40 if (slot == 1)
41 return IRQ_IXP4XX_GPIO8; 41 return IRQ_IXP4XX_GPIO8;
diff --git a/arch/arm/mach-kirkwood/include/mach/hardware.h b/arch/arm/mach-kirkwood/include/mach/hardware.h
index cde85283f7d..742b74f43e4 100644
--- a/arch/arm/mach-kirkwood/include/mach/hardware.h
+++ b/arch/arm/mach-kirkwood/include/mach/hardware.h
@@ -11,11 +11,4 @@
11 11
12#include "kirkwood.h" 12#include "kirkwood.h"
13 13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x00001000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE KIRKWOOD_PCIE_MEM_PHYS_BASE /* mem base for VGA */
19
20
21#endif 14#endif
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index ca294ff6d5b..74b992d810e 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -12,6 +12,7 @@
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/mbus.h> 14#include <linux/mbus.h>
15#include <video/vga.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/mach/pci.h> 17#include <asm/mach/pci.h>
17#include <plat/pcie.h> 18#include <plat/pcie.h>
@@ -244,7 +245,8 @@ kirkwood_pcie_scan_bus(int nr, struct pci_sys_data *sys)
244 return bus; 245 return bus;
245} 246}
246 247
247static int __init kirkwood_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 248static int __init kirkwood_pcie_map_irq(const struct pci_dev *dev, u8 slot,
249 u8 pin)
248{ 250{
249 struct pcie_port *pp = bus_to_port(dev->bus); 251 struct pcie_port *pp = bus_to_port(dev->bus);
250 252
@@ -271,6 +273,8 @@ static void __init add_pcie_port(int index, unsigned long base)
271 273
272void __init kirkwood_pcie_init(unsigned int portmask) 274void __init kirkwood_pcie_init(unsigned int portmask)
273{ 275{
276 vga_base = KIRKWOOD_PCIE_MEM_PHYS_BASE;
277
274 if (portmask & KW_PCIE0) 278 if (portmask & KW_PCIE0)
275 add_pcie_port(0, PCIE_VIRT_BASE); 279 add_pcie_port(0, PCIE_VIRT_BASE);
276 280
diff --git a/arch/arm/mach-ks8695/board-dsm320.c b/arch/arm/mach-ks8695/board-dsm320.c
index ada92b6bed2..1338cb3e982 100644
--- a/arch/arm/mach-ks8695/board-dsm320.c
+++ b/arch/arm/mach-ks8695/board-dsm320.c
@@ -34,7 +34,7 @@
34#include "generic.h" 34#include "generic.h"
35 35
36#ifdef CONFIG_PCI 36#ifdef CONFIG_PCI
37static int dsm320_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 37static int dsm320_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
38{ 38{
39 switch (slot) { 39 switch (slot) {
40 case 0: 40 case 0:
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c
index c7ad09bd6ea..e2e3cba8dcd 100644
--- a/arch/arm/mach-ks8695/board-micrel.c
+++ b/arch/arm/mach-ks8695/board-micrel.c
@@ -24,7 +24,7 @@
24#include "generic.h" 24#include "generic.h"
25 25
26#ifdef CONFIG_PCI 26#ifdef CONFIG_PCI
27static int micrel_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 27static int micrel_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
28{ 28{
29 return KS8695_IRQ_EXTERN0; 29 return KS8695_IRQ_EXTERN0;
30} 30}
diff --git a/arch/arm/mach-ks8695/include/mach/devices.h b/arch/arm/mach-ks8695/include/mach/devices.h
index 2744fecb429..85a3c9aa7d1 100644
--- a/arch/arm/mach-ks8695/include/mach/devices.h
+++ b/arch/arm/mach-ks8695/include/mach/devices.h
@@ -30,7 +30,7 @@ extern void __init ks8695_init_leds(u8 cpu_led, u8 timer_led);
30 30
31struct ks8695_pci_cfg { 31struct ks8695_pci_cfg {
32 short mode; 32 short mode;
33 int (*map_irq)(struct pci_dev *, u8, u8); 33 int (*map_irq)(const struct pci_dev *, u8, u8);
34}; 34};
35extern __init void ks8695_init_pci(struct ks8695_pci_cfg *); 35extern __init void ks8695_init_pci(struct ks8695_pci_cfg *);
36 36
diff --git a/arch/arm/mach-ks8695/include/mach/hardware.h b/arch/arm/mach-ks8695/include/mach/hardware.h
index e0f911d9e02..5e0c388143d 100644
--- a/arch/arm/mach-ks8695/include/mach/hardware.h
+++ b/arch/arm/mach-ks8695/include/mach/hardware.h
@@ -42,13 +42,4 @@
42#define KS8695_PCIIO_PA 0x80000000 42#define KS8695_PCIIO_PA 0x80000000
43#define KS8695_PCIIO_SIZE SZ_64K 43#define KS8695_PCIIO_SIZE SZ_64K
44 44
45
46/*
47 * PCI support
48 */
49#define pcibios_assign_all_busses() 1
50
51#define PCIBIOS_MIN_IO 0
52#define PCIBIOS_MIN_MEM 0
53
54#endif 45#endif
diff --git a/arch/arm/mach-ks8695/pci.c b/arch/arm/mach-ks8695/pci.c
index 5fcd082a17f..c7c9a188d10 100644
--- a/arch/arm/mach-ks8695/pci.c
+++ b/arch/arm/mach-ks8695/pci.c
@@ -317,6 +317,9 @@ void __init ks8695_init_pci(struct ks8695_pci_cfg *cfg)
317 return; 317 return;
318 } 318 }
319 319
320 pcibios_min_io = 0;
321 pcibios_min_mem = 0;
322
320 printk(KERN_INFO "PCI: Initialising\n"); 323 printk(KERN_INFO "PCI: Initialising\n");
321 ks8695_show_pciregs(); 324 ks8695_show_pciregs();
322 325
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c
index da0e6498110..1e027514096 100644
--- a/arch/arm/mach-lpc32xx/clock.c
+++ b/arch/arm/mach-lpc32xx/clock.c
@@ -1077,7 +1077,7 @@ static struct clk_lookup lookups[] = {
1077 _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) 1077 _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand)
1078 _REGISTER_CLOCK("tbd", "i2s0_ck", clk_i2s0) 1078 _REGISTER_CLOCK("tbd", "i2s0_ck", clk_i2s0)
1079 _REGISTER_CLOCK("tbd", "i2s1_ck", clk_i2s1) 1079 _REGISTER_CLOCK("tbd", "i2s1_ck", clk_i2s1)
1080 _REGISTER_CLOCK("lpc32xx-ts", NULL, clk_tsc) 1080 _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc)
1081 _REGISTER_CLOCK("dev:mmc0", "MCLK", clk_mmc) 1081 _REGISTER_CLOCK("dev:mmc0", "MCLK", clk_mmc)
1082 _REGISTER_CLOCK("lpc-net.0", NULL, clk_net) 1082 _REGISTER_CLOCK("lpc-net.0", NULL, clk_net)
1083 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd) 1083 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd)
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index ee24dc28e93..205b2dbb565 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -95,6 +95,48 @@ struct platform_device lpc32xx_i2c2_device = {
95 }, 95 },
96}; 96};
97 97
98/* TSC (Touch Screen Controller) */
99
100static struct resource lpc32xx_tsc_resources[] = {
101 {
102 .start = LPC32XX_ADC_BASE,
103 .end = LPC32XX_ADC_BASE + SZ_4K - 1,
104 .flags = IORESOURCE_MEM,
105 }, {
106 .start = IRQ_LPC32XX_TS_IRQ,
107 .end = IRQ_LPC32XX_TS_IRQ,
108 .flags = IORESOURCE_IRQ,
109 },
110};
111
112struct platform_device lpc32xx_tsc_device = {
113 .name = "ts-lpc32xx",
114 .id = -1,
115 .num_resources = ARRAY_SIZE(lpc32xx_tsc_resources),
116 .resource = lpc32xx_tsc_resources,
117};
118
119/* RTC */
120
121static struct resource lpc32xx_rtc_resources[] = {
122 {
123 .start = LPC32XX_RTC_BASE,
124 .end = LPC32XX_RTC_BASE + SZ_4K - 1,
125 .flags = IORESOURCE_MEM,
126 },{
127 .start = IRQ_LPC32XX_RTC,
128 .end = IRQ_LPC32XX_RTC,
129 .flags = IORESOURCE_IRQ,
130 },
131};
132
133struct platform_device lpc32xx_rtc_device = {
134 .name = "rtc-lpc32xx",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(lpc32xx_rtc_resources),
137 .resource = lpc32xx_rtc_resources,
138};
139
98/* 140/*
99 * Returns the unique ID for the device 141 * Returns the unique ID for the device
100 */ 142 */
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index f82211fd80c..5583f52662b 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -28,6 +28,8 @@ extern struct platform_device lpc32xx_watchdog_device;
28extern struct platform_device lpc32xx_i2c0_device; 28extern struct platform_device lpc32xx_i2c0_device;
29extern struct platform_device lpc32xx_i2c1_device; 29extern struct platform_device lpc32xx_i2c1_device;
30extern struct platform_device lpc32xx_i2c2_device; 30extern struct platform_device lpc32xx_i2c2_device;
31extern struct platform_device lpc32xx_tsc_device;
32extern struct platform_device lpc32xx_rtc_device;
31 33
32/* 34/*
33 * Other arch specific structures and functions 35 * Other arch specific structures and functions
diff --git a/arch/arm/mach-lpc32xx/include/mach/clkdev.h b/arch/arm/mach-lpc32xx/include/mach/clkdev.h
deleted file mode 100644
index 9bf0637e29c..00000000000
--- a/arch/arm/mach-lpc32xx/include/mach/clkdev.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/clkdev.h
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
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
19#ifndef __ASM_ARCH_CLKDEV_H
20#define __ASM_ARCH_CLKDEV_H
21
22#define __clk_get(clk) ({ 1; })
23#define __clk_put(clk) do { } while (0)
24
25#endif
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 67793a69027..56ef5f6c811 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -77,6 +77,13 @@ config MACH_TETON_BGA
77 Say 'Y' here if you want to support the Marvell PXA168-based 77 Say 'Y' here if you want to support the Marvell PXA168-based
78 Teton BGA Development Board. 78 Teton BGA Development Board.
79 79
80config MACH_SHEEVAD
81 bool "Marvell's PXA168 GuruPlug Display (gplugD) Board"
82 select CPU_PXA168
83 help
84 Say 'Y' here if you want to support the Marvell PXA168-based
85 GuruPlug Display (gplugD) Board
86
80endmenu 87endmenu
81 88
82config CPU_PXA168 89config CPU_PXA168
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index 5c68382141a..b0ac942327a 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_MACH_BROWNSTONE) += brownstone.o
19obj-$(CONFIG_MACH_FLINT) += flint.o 19obj-$(CONFIG_MACH_FLINT) += flint.o
20obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o 20obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
21obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o 21obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o
22obj-$(CONFIG_MACH_SHEEVAD) += gplugd.o
diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index 886e05648f0..7c6f95f2914 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -88,3 +88,18 @@ unsigned long clk_get_rate(struct clk *clk)
88 return rate; 88 return rate;
89} 89}
90EXPORT_SYMBOL(clk_get_rate); 90EXPORT_SYMBOL(clk_get_rate);
91
92int clk_set_rate(struct clk *clk, unsigned long rate)
93{
94 unsigned long flags;
95 int ret = -EINVAL;
96
97 if (clk->ops->setrate) {
98 spin_lock_irqsave(&clocks_lock, flags);
99 ret = clk->ops->setrate(clk, rate);
100 spin_unlock_irqrestore(&clocks_lock, flags);
101 }
102
103 return ret;
104}
105EXPORT_SYMBOL(clk_set_rate);
diff --git a/arch/arm/mach-mmp/clock.h b/arch/arm/mach-mmp/clock.h
index 9b027d7491f..3143e994e67 100644
--- a/arch/arm/mach-mmp/clock.h
+++ b/arch/arm/mach-mmp/clock.h
@@ -12,6 +12,7 @@ struct clkops {
12 void (*enable)(struct clk *); 12 void (*enable)(struct clk *);
13 void (*disable)(struct clk *); 13 void (*disable)(struct clk *);
14 unsigned long (*getrate)(struct clk *); 14 unsigned long (*getrate)(struct clk *);
15 int (*setrate)(struct clk *, unsigned long);
15}; 16};
16 17
17struct clk { 18struct clk {
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
new file mode 100644
index 00000000000..98e25d9aaab
--- /dev/null
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -0,0 +1,197 @@
1/*
2 * linux/arch/arm/mach-mmp/gplugd.c
3 *
4 * Support for the Marvell PXA168-based GuruPlug Display (gplugD) 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
11#include <linux/init.h>
12
13#include <asm/mach/arch.h>
14#include <asm/mach-types.h>
15
16#include <mach/gpio.h>
17#include <mach/pxa168.h>
18#include <mach/mfp-pxa168.h>
19
20#include "common.h"
21
22static unsigned long gplugd_pin_config[] __initdata = {
23 /* UART3 */
24 GPIO8_UART3_TXD,
25 GPIO9_UART3_RXD,
26 GPIO1O_UART3_CTS,
27 GPIO11_UART3_RTS,
28
29 /* USB OTG PEN */
30 GPIO18_GPIO,
31
32 /* MMC2 */
33 GPIO28_MMC2_CMD,
34 GPIO29_MMC2_CLK,
35 GPIO30_MMC2_DAT0,
36 GPIO31_MMC2_DAT1,
37 GPIO32_MMC2_DAT2,
38 GPIO33_MMC2_DAT3,
39
40 /* LCD & HDMI clock selection GPIO: 0: 74.176MHz, 1: 74.25 MHz */
41 GPIO35_GPIO,
42 GPIO36_GPIO, /* CEC Interrupt */
43
44 /* MMC1 */
45 GPIO43_MMC1_CLK,
46 GPIO49_MMC1_CMD,
47 GPIO41_MMC1_DAT0,
48 GPIO40_MMC1_DAT1,
49 GPIO52_MMC1_DAT2,
50 GPIO51_MMC1_DAT3,
51 GPIO53_MMC1_CD,
52
53 /* LCD */
54 GPIO56_LCD_FCLK_RD,
55 GPIO57_LCD_LCLK_A0,
56 GPIO58_LCD_PCLK_WR,
57 GPIO59_LCD_DENA_BIAS,
58 GPIO60_LCD_DD0,
59 GPIO61_LCD_DD1,
60 GPIO62_LCD_DD2,
61 GPIO63_LCD_DD3,
62 GPIO64_LCD_DD4,
63 GPIO65_LCD_DD5,
64 GPIO66_LCD_DD6,
65 GPIO67_LCD_DD7,
66 GPIO68_LCD_DD8,
67 GPIO69_LCD_DD9,
68 GPIO70_LCD_DD10,
69 GPIO71_LCD_DD11,
70 GPIO72_LCD_DD12,
71 GPIO73_LCD_DD13,
72 GPIO74_LCD_DD14,
73 GPIO75_LCD_DD15,
74 GPIO76_LCD_DD16,
75 GPIO77_LCD_DD17,
76 GPIO78_LCD_DD18,
77 GPIO79_LCD_DD19,
78 GPIO80_LCD_DD20,
79 GPIO81_LCD_DD21,
80 GPIO82_LCD_DD22,
81 GPIO83_LCD_DD23,
82
83 /* GPIO */
84 GPIO84_GPIO,
85 GPIO85_GPIO,
86
87 /* Fast-Ethernet*/
88 GPIO86_TX_CLK,
89 GPIO87_TX_EN,
90 GPIO88_TX_DQ3,
91 GPIO89_TX_DQ2,
92 GPIO90_TX_DQ1,
93 GPIO91_TX_DQ0,
94 GPIO92_MII_CRS,
95 GPIO93_MII_COL,
96 GPIO94_RX_CLK,
97 GPIO95_RX_ER,
98 GPIO96_RX_DQ3,
99 GPIO97_RX_DQ2,
100 GPIO98_RX_DQ1,
101 GPIO99_RX_DQ0,
102 GPIO100_MII_MDC,
103 GPIO101_MII_MDIO,
104 GPIO103_RX_DV,
105 GPIO104_GPIO, /* Reset PHY */
106
107 /* RTC interrupt */
108 GPIO102_GPIO,
109
110 /* I2C */
111 GPIO105_CI2C_SDA,
112 GPIO106_CI2C_SCL,
113
114 /* SPI NOR Flash on SSP2 */
115 GPIO107_SSP2_RXD,
116 GPIO108_SSP2_TXD,
117 GPIO110_GPIO, /* SPI_CSn */
118 GPIO111_SSP2_CLK,
119
120 /* Select JTAG */
121 GPIO109_GPIO,
122
123 /* I2S */
124 GPIO114_I2S_FRM,
125 GPIO115_I2S_BCLK,
126 GPIO116_I2S_TXD
127};
128
129static struct i2c_board_info gplugd_i2c_board_info[] = {
130 {
131 .type = "isl1208",
132 .addr = 0x6F,
133 }
134};
135
136/* Bring PHY out of reset by setting GPIO 104 */
137static int gplugd_eth_init(void)
138{
139 if (unlikely(gpio_request(104, "ETH_RESET_N"))) {
140 printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet "
141 "PHY out of reset\n");
142 return -EIO;
143 }
144
145 gpio_direction_output(104, 1);
146 gpio_free(104);
147 return 0;
148}
149
150struct pxa168_eth_platform_data gplugd_eth_platform_data = {
151 .port_number = 0,
152 .phy_addr = 0,
153 .speed = 0, /* Autonagotiation */
154 .init = gplugd_eth_init,
155};
156
157static void __init select_disp_freq(void)
158{
159 /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */
160 if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) {
161 printk(KERN_ERR "Can't get hold of GPIO 35 to select display "
162 "frequency\n");
163 } else {
164 gpio_direction_output(35, 1);
165 gpio_free(35);
166 }
167
168 if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
169 printk(KERN_ERR "Can't get hold of GPIO 85 to select display "
170 "frequency\n");
171 } else {
172 gpio_direction_output(85, 0);
173 gpio_free(85);
174 }
175}
176
177static void __init gplugd_init(void)
178{
179 mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));
180
181 select_disp_freq();
182
183 /* on-chip devices */
184 pxa168_add_uart(3);
185 pxa168_add_ssp(0);
186 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
187
188 pxa168_add_eth(&gplugd_eth_platform_data);
189}
190
191MACHINE_START(SHEEVAD, "PXA168-based GuruPlug Display (gplugD) Platform")
192 .map_io = mmp_map_io,
193 .nr_irqs = IRQ_BOARD_START,
194 .init_irq = pxa168_init_irq,
195 .timer = &pxa168_timer,
196 .init_machine = gplugd_init,
197MACHINE_END
diff --git a/arch/arm/mach-mmp/include/mach/clkdev.h b/arch/arm/mach-mmp/include/mach/clkdev.h
deleted file mode 100644
index 2fb354e54e0..00000000000
--- a/arch/arm/mach-mmp/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
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 /* __ASM_MACH_CLKDEV_H */
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
index 713be155a44..92aaa3c19d6 100644
--- a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
@@ -203,6 +203,10 @@
203#define GPIO33_CF_nCD2 MFP_CFG(GPIO33, AF3) 203#define GPIO33_CF_nCD2 MFP_CFG(GPIO33, AF3)
204 204
205/* UART */ 205/* UART */
206#define GPIO8_UART3_TXD MFP_CFG(GPIO8, AF2)
207#define GPIO9_UART3_RXD MFP_CFG(GPIO9, AF2)
208#define GPIO1O_UART3_CTS MFP_CFG(GPIO10, AF2)
209#define GPIO11_UART3_RTS MFP_CFG(GPIO11, AF2)
206#define GPIO88_UART2_TXD MFP_CFG(GPIO88, AF2) 210#define GPIO88_UART2_TXD MFP_CFG(GPIO88, AF2)
207#define GPIO89_UART2_RXD MFP_CFG(GPIO89, AF2) 211#define GPIO89_UART2_RXD MFP_CFG(GPIO89, AF2)
208#define GPIO107_UART1_TXD MFP_CFG_DRV(GPIO107, AF1, FAST) 212#define GPIO107_UART1_TXD MFP_CFG_DRV(GPIO107, AF1, FAST)
@@ -232,6 +236,22 @@
232#define GPIO53_MMC1_CD MFP_CFG(GPIO53, AF1) 236#define GPIO53_MMC1_CD MFP_CFG(GPIO53, AF1)
233#define GPIO46_MMC1_WP MFP_CFG(GPIO46, AF1) 237#define GPIO46_MMC1_WP MFP_CFG(GPIO46, AF1)
234 238
239/* MMC2 */
240#define GPIO28_MMC2_CMD MFP_CFG_DRV(GPIO28, AF6, FAST)
241#define GPIO29_MMC2_CLK MFP_CFG_DRV(GPIO29, AF6, FAST)
242#define GPIO30_MMC2_DAT0 MFP_CFG_DRV(GPIO30, AF6, FAST)
243#define GPIO31_MMC2_DAT1 MFP_CFG_DRV(GPIO31, AF6, FAST)
244#define GPIO32_MMC2_DAT2 MFP_CFG_DRV(GPIO32, AF6, FAST)
245#define GPIO33_MMC2_DAT3 MFP_CFG_DRV(GPIO33, AF6, FAST)
246
247/* MMC4 */
248#define GPIO125_MMC4_DAT3 MFP_CFG_DRV(GPIO125, AF7, FAST)
249#define GPIO126_MMC4_DAT2 MFP_CFG_DRV(GPIO126, AF7, FAST)
250#define GPIO127_MMC4_DAT1 MFP_CFG_DRV(GPIO127, AF7, FAST)
251#define GPIO0_2_MMC4_DAT0 MFP_CFG_DRV(GPIO0_2, AF7, FAST)
252#define GPIO1_2_MMC4_CMD MFP_CFG_DRV(GPIO1_2, AF7, FAST)
253#define GPIO2_2_MMC4_CLK MFP_CFG_DRV(GPIO2_2, AF7, FAST)
254
235/* LCD */ 255/* LCD */
236#define GPIO84_LCD_CS MFP_CFG(GPIO84, AF1) 256#define GPIO84_LCD_CS MFP_CFG(GPIO84, AF1)
237#define GPIO60_LCD_DD0 MFP_CFG(GPIO60, AF1) 257#define GPIO60_LCD_DD0 MFP_CFG(GPIO60, AF1)
@@ -269,11 +289,12 @@
269#define GPIO106_CI2C_SCL MFP_CFG(GPIO106, AF1) 289#define GPIO106_CI2C_SCL MFP_CFG(GPIO106, AF1)
270 290
271/* I2S */ 291/* I2S */
272#define GPIO113_I2S_MCLK MFP_CFG(GPIO113,AF6) 292#define GPIO113_I2S_MCLK MFP_CFG(GPIO113, AF6)
273#define GPIO114_I2S_FRM MFP_CFG(GPIO114,AF1) 293#define GPIO114_I2S_FRM MFP_CFG(GPIO114, AF1)
274#define GPIO115_I2S_BCLK MFP_CFG(GPIO115,AF1) 294#define GPIO115_I2S_BCLK MFP_CFG(GPIO115, AF1)
275#define GPIO116_I2S_RXD MFP_CFG(GPIO116,AF2) 295#define GPIO116_I2S_RXD MFP_CFG(GPIO116, AF2)
276#define GPIO117_I2S_TXD MFP_CFG(GPIO117,AF2) 296#define GPIO116_I2S_TXD MFP_CFG(GPIO116, AF1)
297#define GPIO117_I2S_TXD MFP_CFG(GPIO117, AF2)
277 298
278/* PWM */ 299/* PWM */
279#define GPIO96_PWM3_OUT MFP_CFG(GPIO96, AF1) 300#define GPIO96_PWM3_OUT MFP_CFG(GPIO96, AF1)
@@ -305,4 +326,29 @@
305#define GPIO112_KP_MKOUT6 MFP_CFG(GPIO112, AF7) 326#define GPIO112_KP_MKOUT6 MFP_CFG(GPIO112, AF7)
306#define GPIO121_KP_MKIN4 MFP_CFG(GPIO121, AF7) 327#define GPIO121_KP_MKIN4 MFP_CFG(GPIO121, AF7)
307 328
329/* Fast Ethernet */
330#define GPIO86_TX_CLK MFP_CFG(GPIO86, AF5)
331#define GPIO87_TX_EN MFP_CFG(GPIO87, AF5)
332#define GPIO88_TX_DQ3 MFP_CFG(GPIO88, AF5)
333#define GPIO89_TX_DQ2 MFP_CFG(GPIO89, AF5)
334#define GPIO90_TX_DQ1 MFP_CFG(GPIO90, AF5)
335#define GPIO91_TX_DQ0 MFP_CFG(GPIO91, AF5)
336#define GPIO92_MII_CRS MFP_CFG(GPIO92, AF5)
337#define GPIO93_MII_COL MFP_CFG(GPIO93, AF5)
338#define GPIO94_RX_CLK MFP_CFG(GPIO94, AF5)
339#define GPIO95_RX_ER MFP_CFG(GPIO95, AF5)
340#define GPIO96_RX_DQ3 MFP_CFG(GPIO96, AF5)
341#define GPIO97_RX_DQ2 MFP_CFG(GPIO97, AF5)
342#define GPIO98_RX_DQ1 MFP_CFG(GPIO98, AF5)
343#define GPIO99_RX_DQ0 MFP_CFG(GPIO99, AF5)
344#define GPIO100_MII_MDC MFP_CFG(GPIO100, AF5)
345#define GPIO101_MII_MDIO MFP_CFG(GPIO101, AF5)
346#define GPIO103_RX_DV MFP_CFG(GPIO103, AF5)
347
348/* SSP2 */
349#define GPIO107_SSP2_RXD MFP_CFG(GPIO107, AF4)
350#define GPIO108_SSP2_TXD MFP_CFG(GPIO108, AF4)
351#define GPIO111_SSP2_CLK MFP_CFG(GPIO111, AF4)
352#define GPIO112_SSP2_FRM MFP_CFG(GPIO112, AF4)
353
308#endif /* __ASM_MACH_MFP_PXA168_H */ 354#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 a52b3d2f325..7f005843a70 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -14,9 +14,11 @@ extern void pxa168_clear_keypad_wakeup(void);
14#include <video/pxa168fb.h> 14#include <video/pxa168fb.h>
15#include <plat/pxa27x_keypad.h> 15#include <plat/pxa27x_keypad.h>
16#include <mach/cputype.h> 16#include <mach/cputype.h>
17#include <linux/pxa168_eth.h>
17 18
18extern struct pxa_device_desc pxa168_device_uart1; 19extern struct pxa_device_desc pxa168_device_uart1;
19extern struct pxa_device_desc pxa168_device_uart2; 20extern struct pxa_device_desc pxa168_device_uart2;
21extern struct pxa_device_desc pxa168_device_uart3;
20extern struct pxa_device_desc pxa168_device_twsi0; 22extern struct pxa_device_desc pxa168_device_twsi0;
21extern struct pxa_device_desc pxa168_device_twsi1; 23extern struct pxa_device_desc pxa168_device_twsi1;
22extern struct pxa_device_desc pxa168_device_pwm1; 24extern struct pxa_device_desc pxa168_device_pwm1;
@@ -31,6 +33,7 @@ extern struct pxa_device_desc pxa168_device_ssp5;
31extern struct pxa_device_desc pxa168_device_nand; 33extern struct pxa_device_desc pxa168_device_nand;
32extern struct pxa_device_desc pxa168_device_fb; 34extern struct pxa_device_desc pxa168_device_fb;
33extern struct pxa_device_desc pxa168_device_keypad; 35extern struct pxa_device_desc pxa168_device_keypad;
36extern struct pxa_device_desc pxa168_device_eth;
34 37
35static inline int pxa168_add_uart(int id) 38static inline int pxa168_add_uart(int id)
36{ 39{
@@ -39,6 +42,7 @@ static inline int pxa168_add_uart(int id)
39 switch (id) { 42 switch (id) {
40 case 1: d = &pxa168_device_uart1; break; 43 case 1: d = &pxa168_device_uart1; break;
41 case 2: d = &pxa168_device_uart2; break; 44 case 2: d = &pxa168_device_uart2; break;
45 case 3: d = &pxa168_device_uart3; break;
42 } 46 }
43 47
44 if (d == NULL) 48 if (d == NULL)
@@ -117,4 +121,8 @@ static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
117 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data)); 121 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
118} 122}
119 123
124static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data)
125{
126 return pxa_register_device(&pxa168_device_eth, data, sizeof(*data));
127}
120#endif /* __ASM_MACH_PXA168_H */ 128#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 f7011ef70bf..8447ac63e28 100644
--- a/arch/arm/mach-mmp/include/mach/regs-apmu.h
+++ b/arch/arm/mach-mmp/include/mach/regs-apmu.h
@@ -29,6 +29,7 @@
29#define APMU_BUS APMU_REG(0x06c) 29#define APMU_BUS APMU_REG(0x06c)
30#define APMU_SDH2 APMU_REG(0x0e8) 30#define APMU_SDH2 APMU_REG(0x0e8)
31#define APMU_SDH3 APMU_REG(0x0ec) 31#define APMU_SDH3 APMU_REG(0x0ec)
32#define APMU_ETH APMU_REG(0x0fc)
32 33
33#define APMU_FNCLK_EN (1 << 4) 34#define APMU_FNCLK_EN (1 << 4)
34#define APMU_AXICLK_EN (1 << 3) 35#define APMU_AXICLK_EN (1 << 3)
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index ab9f999106c..0156f535dae 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -66,6 +66,7 @@ void __init pxa168_init_irq(void)
66/* APB peripheral clocks */ 66/* APB peripheral clocks */
67static APBC_CLK(uart1, PXA168_UART1, 1, 14745600); 67static APBC_CLK(uart1, PXA168_UART1, 1, 14745600);
68static APBC_CLK(uart2, PXA168_UART2, 1, 14745600); 68static APBC_CLK(uart2, PXA168_UART2, 1, 14745600);
69static APBC_CLK(uart3, PXA168_UART3, 1, 14745600);
69static APBC_CLK(twsi0, PXA168_TWSI0, 1, 33000000); 70static APBC_CLK(twsi0, PXA168_TWSI0, 1, 33000000);
70static APBC_CLK(twsi1, PXA168_TWSI1, 1, 33000000); 71static APBC_CLK(twsi1, PXA168_TWSI1, 1, 33000000);
71static APBC_CLK(pwm1, PXA168_PWM1, 1, 13000000); 72static APBC_CLK(pwm1, PXA168_PWM1, 1, 13000000);
@@ -81,11 +82,13 @@ static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
81 82
82static APMU_CLK(nand, NAND, 0x19b, 156000000); 83static APMU_CLK(nand, NAND, 0x19b, 156000000);
83static APMU_CLK(lcd, LCD, 0x7f, 312000000); 84static APMU_CLK(lcd, LCD, 0x7f, 312000000);
85static APMU_CLK(eth, ETH, 0x09, 0);
84 86
85/* device and clock bindings */ 87/* device and clock bindings */
86static struct clk_lookup pxa168_clkregs[] = { 88static struct clk_lookup pxa168_clkregs[] = {
87 INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL), 89 INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
88 INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL), 90 INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL),
91 INIT_CLKREG(&clk_uart3, "pxa2xx-uart.2", NULL),
89 INIT_CLKREG(&clk_twsi0, "pxa2xx-i2c.0", NULL), 92 INIT_CLKREG(&clk_twsi0, "pxa2xx-i2c.0", NULL),
90 INIT_CLKREG(&clk_twsi1, "pxa2xx-i2c.1", NULL), 93 INIT_CLKREG(&clk_twsi1, "pxa2xx-i2c.1", NULL),
91 INIT_CLKREG(&clk_pwm1, "pxa168-pwm.0", NULL), 94 INIT_CLKREG(&clk_pwm1, "pxa168-pwm.0", NULL),
@@ -100,6 +103,7 @@ static struct clk_lookup pxa168_clkregs[] = {
100 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 103 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
101 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL), 104 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
102 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 105 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
106 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
103}; 107};
104 108
105static int __init pxa168_init(void) 109static int __init pxa168_init(void)
@@ -149,6 +153,7 @@ void pxa168_clear_keypad_wakeup(void)
149/* on-chip devices */ 153/* on-chip devices */
150PXA168_DEVICE(uart1, "pxa2xx-uart", 0, UART1, 0xd4017000, 0x30, 21, 22); 154PXA168_DEVICE(uart1, "pxa2xx-uart", 0, UART1, 0xd4017000, 0x30, 21, 22);
151PXA168_DEVICE(uart2, "pxa2xx-uart", 1, UART2, 0xd4018000, 0x30, 23, 24); 155PXA168_DEVICE(uart2, "pxa2xx-uart", 1, UART2, 0xd4018000, 0x30, 23, 24);
156PXA168_DEVICE(uart3, "pxa2xx-uart", 2, UART3, 0xd4026000, 0x30, 23, 24);
152PXA168_DEVICE(twsi0, "pxa2xx-i2c", 0, TWSI0, 0xd4011000, 0x28); 157PXA168_DEVICE(twsi0, "pxa2xx-i2c", 0, TWSI0, 0xd4011000, 0x28);
153PXA168_DEVICE(twsi1, "pxa2xx-i2c", 1, TWSI1, 0xd4025000, 0x28); 158PXA168_DEVICE(twsi1, "pxa2xx-i2c", 1, TWSI1, 0xd4025000, 0x28);
154PXA168_DEVICE(pwm1, "pxa168-pwm", 0, NONE, 0xd401a000, 0x10); 159PXA168_DEVICE(pwm1, "pxa168-pwm", 0, NONE, 0xd401a000, 0x10);
@@ -163,3 +168,4 @@ PXA168_DEVICE(ssp4, "pxa168-ssp", 3, SSP4, 0xd4020000, 0x40, 58, 59);
163PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61); 168PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61);
164PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8); 169PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
165PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c); 170PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c);
171PXA168_DEVICE(eth, "pxa168-eth", -1, MFU, 0xc0800000, 0x0fff);
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 99833b9485c..4e91ee6e27c 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -51,12 +51,12 @@ static inline uint32_t timer_read(void)
51{ 51{
52 int delay = 100; 52 int delay = 100;
53 53
54 __raw_writel(1, TIMERS_VIRT_BASE + TMR_CVWR(0)); 54 __raw_writel(1, TIMERS_VIRT_BASE + TMR_CVWR(1));
55 55
56 while (delay--) 56 while (delay--)
57 cpu_relax(); 57 cpu_relax();
58 58
59 return __raw_readl(TIMERS_VIRT_BASE + TMR_CVWR(0)); 59 return __raw_readl(TIMERS_VIRT_BASE + TMR_CVWR(1));
60} 60}
61 61
62unsigned long long notrace sched_clock(void) 62unsigned long long notrace sched_clock(void)
@@ -75,28 +75,51 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
75{ 75{
76 struct clock_event_device *c = dev_id; 76 struct clock_event_device *c = dev_id;
77 77
78 /* disable and clear pending interrupt status */ 78 /*
79 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(0)); 79 * Clear pending interrupt status.
80 __raw_writel(0x1, TIMERS_VIRT_BASE + TMR_ICR(0)); 80 */
81 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0));
82
83 /*
84 * Disable timer 0.
85 */
86 __raw_writel(0x02, TIMERS_VIRT_BASE + TMR_CER);
87
81 c->event_handler(c); 88 c->event_handler(c);
89
82 return IRQ_HANDLED; 90 return IRQ_HANDLED;
83} 91}
84 92
85static int timer_set_next_event(unsigned long delta, 93static int timer_set_next_event(unsigned long delta,
86 struct clock_event_device *dev) 94 struct clock_event_device *dev)
87{ 95{
88 unsigned long flags, next; 96 unsigned long flags;
89 97
90 local_irq_save(flags); 98 local_irq_save(flags);
91 99
92 /* clear pending interrupt status and enable */ 100 /*
101 * Disable timer 0.
102 */
103 __raw_writel(0x02, TIMERS_VIRT_BASE + TMR_CER);
104
105 /*
106 * Clear and enable timer match 0 interrupt.
107 */
93 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0)); 108 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0));
94 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_IER(0)); 109 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_IER(0));
95 110
96 next = timer_read() + delta; 111 /*
97 __raw_writel(next, TIMERS_VIRT_BASE + TMR_TN_MM(0, 0)); 112 * Setup new clockevent timer value.
113 */
114 __raw_writel(delta - 1, TIMERS_VIRT_BASE + TMR_TN_MM(0, 0));
115
116 /*
117 * Enable timer 0.
118 */
119 __raw_writel(0x03, TIMERS_VIRT_BASE + TMR_CER);
98 120
99 local_irq_restore(flags); 121 local_irq_restore(flags);
122
100 return 0; 123 return 0;
101} 124}
102 125
@@ -145,23 +168,26 @@ static struct clocksource cksrc = {
145static void __init timer_config(void) 168static void __init timer_config(void)
146{ 169{
147 uint32_t ccr = __raw_readl(TIMERS_VIRT_BASE + TMR_CCR); 170 uint32_t ccr = __raw_readl(TIMERS_VIRT_BASE + TMR_CCR);
148 uint32_t cer = __raw_readl(TIMERS_VIRT_BASE + TMR_CER);
149 uint32_t cmr = __raw_readl(TIMERS_VIRT_BASE + TMR_CMR);
150 171
151 __raw_writel(cer & ~0x1, TIMERS_VIRT_BASE + TMR_CER); /* disable */ 172 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_CER); /* disable */
152 173
153 ccr &= (cpu_is_mmp2()) ? TMR_CCR_CS_0(0) : TMR_CCR_CS_0(3); 174 ccr &= (cpu_is_mmp2()) ? (TMR_CCR_CS_0(0) | TMR_CCR_CS_1(0)) :
175 (TMR_CCR_CS_0(3) | TMR_CCR_CS_1(3));
154 __raw_writel(ccr, TIMERS_VIRT_BASE + TMR_CCR); 176 __raw_writel(ccr, TIMERS_VIRT_BASE + TMR_CCR);
155 177
156 /* free-running mode */ 178 /* set timer 0 to periodic mode, and timer 1 to free-running mode */
157 __raw_writel(cmr | 0x01, TIMERS_VIRT_BASE + TMR_CMR); 179 __raw_writel(0x2, TIMERS_VIRT_BASE + TMR_CMR);
158 180
159 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_PLCR(0)); /* free-running */ 181 __raw_writel(0x1, TIMERS_VIRT_BASE + TMR_PLCR(0)); /* periodic */
160 __raw_writel(0x7, TIMERS_VIRT_BASE + TMR_ICR(0)); /* clear status */ 182 __raw_writel(0x7, TIMERS_VIRT_BASE + TMR_ICR(0)); /* clear status */
161 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(0)); 183 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(0));
162 184
163 /* enable timer counter */ 185 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_PLCR(1)); /* free-running */
164 __raw_writel(cer | 0x01, TIMERS_VIRT_BASE + TMR_CER); 186 __raw_writel(0x7, TIMERS_VIRT_BASE + TMR_ICR(1)); /* clear status */
187 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(1));
188
189 /* enable timer 1 counter */
190 __raw_writel(0x2, TIMERS_VIRT_BASE + TMR_CER);
165} 191}
166 192
167static struct irqaction timer_irq = { 193static struct irqaction timer_irq = {
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index e411039ea59..6bd37a27e5f 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -15,6 +15,8 @@
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#include <linux/interrupt.h>
18#include <linux/i2c/pca953x.h>
19#include <linux/gpio.h>
18 20
19#include <asm/mach-types.h> 21#include <asm/mach-types.h>
20#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
@@ -25,7 +27,17 @@
25 27
26#include "common.h" 28#include "common.h"
27 29
28#define TTCDKB_NR_IRQS (IRQ_BOARD_START + 24) 30#define TTCDKB_GPIO_EXT0(x) (NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
31 ((x < 16) ? x : 15)))
32#define TTCDKB_GPIO_EXT1(x) (NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
33 ((x < 16) ? x : 15)))
34
35/*
36 * 16 board interrupts -- MAX7312 GPIO expander
37 * 16 board interrupts -- PCA9575 GPIO expander
38 * 24 board interrupts -- 88PM860x PMIC
39 */
40#define TTCDKB_NR_IRQS (IRQ_BOARD_START + 16 + 16 + 24)
29 41
30static unsigned long ttc_dkb_pin_config[] __initdata = { 42static unsigned long ttc_dkb_pin_config[] __initdata = {
31 /* UART2 */ 43 /* UART2 */
@@ -113,6 +125,22 @@ static struct platform_device *ttc_dkb_devices[] = {
113 &ttc_dkb_device_onenand, 125 &ttc_dkb_device_onenand,
114}; 126};
115 127
128static struct pca953x_platform_data max7312_data[] = {
129 {
130 .gpio_base = TTCDKB_GPIO_EXT0(0),
131 .irq_base = IRQ_BOARD_START,
132 },
133};
134
135static struct i2c_board_info ttc_dkb_i2c_info[] = {
136 {
137 .type = "max7312",
138 .addr = 0x23,
139 .irq = IRQ_GPIO(80),
140 .platform_data = &max7312_data,
141 },
142};
143
116static void __init ttc_dkb_init(void) 144static void __init ttc_dkb_init(void)
117{ 145{
118 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config)); 146 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
@@ -121,6 +149,7 @@ static void __init ttc_dkb_init(void)
121 pxa910_add_uart(1); 149 pxa910_add_uart(1);
122 150
123 /* off-chip devices */ 151 /* off-chip devices */
152 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
124 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices)); 153 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
125} 154}
126 155
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 888e92502e1..ebde97f5d5f 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -11,6 +11,7 @@ config ARCH_MSM7X00A
11 select MSM_SMD 11 select MSM_SMD
12 select MSM_SMD_PKG3 12 select MSM_SMD_PKG3
13 select CPU_V6 13 select CPU_V6
14 select GPIO_MSM_V1
14 select MSM_PROC_COMM 15 select MSM_PROC_COMM
15 select HAS_MSM_DEBUG_UART_PHYS 16 select HAS_MSM_DEBUG_UART_PHYS
16 17
@@ -22,6 +23,7 @@ config ARCH_MSM7X30
22 select MSM_VIC 23 select MSM_VIC
23 select CPU_V7 24 select CPU_V7
24 select MSM_GPIOMUX 25 select MSM_GPIOMUX
26 select GPIO_MSM_V1
25 select MSM_PROC_COMM 27 select MSM_PROC_COMM
26 select HAS_MSM_DEBUG_UART_PHYS 28 select HAS_MSM_DEBUG_UART_PHYS
27 29
@@ -33,6 +35,7 @@ config ARCH_QSD8X50
33 select MSM_VIC 35 select MSM_VIC
34 select CPU_V7 36 select CPU_V7
35 select MSM_GPIOMUX 37 select MSM_GPIOMUX
38 select GPIO_MSM_V1
36 select MSM_PROC_COMM 39 select MSM_PROC_COMM
37 select HAS_MSM_DEBUG_UART_PHYS 40 select HAS_MSM_DEBUG_UART_PHYS
38 41
@@ -44,6 +47,7 @@ config ARCH_MSM8X60
44 select ARM_GIC 47 select ARM_GIC
45 select CPU_V7 48 select CPU_V7
46 select MSM_V2_TLMM 49 select MSM_V2_TLMM
50 select GPIO_MSM_V2
47 select MSM_GPIOMUX 51 select MSM_GPIOMUX
48 select MSM_SCM if SMP 52 select MSM_SCM if SMP
49 53
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index b70658c5ae0..4285dfd80b6 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -29,11 +29,3 @@ obj-$(CONFIG_ARCH_MSM8960) += board-msm8960.o devices-msm8960.o
29obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o 29obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o
30obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o 30obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
31obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o 31obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
32ifdef CONFIG_MSM_V2_TLMM
33ifndef CONFIG_ARCH_MSM8960
34# TODO: TLMM Mapping issues need to be resolved
35obj-y += gpio-v2.o
36endif
37else
38obj-y += gpio.o
39endif
diff --git a/arch/arm/mach-msm/gpio-v2.c b/arch/arm/mach-msm/gpio-v2.c
deleted file mode 100644
index cc9c4fd7ccc..00000000000
--- a/arch/arm/mach-msm/gpio-v2.c
+++ /dev/null
@@ -1,433 +0,0 @@
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) "%s: " fmt, __func__
19
20#include <linux/bitmap.h>
21#include <linux/bitops.h>
22#include <linux/gpio.h>
23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <linux/io.h>
26#include <linux/irq.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/spinlock.h>
30
31#include <asm/mach/irq.h>
32
33#include <mach/msm_iomap.h>
34#include "gpiomux.h"
35
36/* Bits of interest in the GPIO_IN_OUT register.
37 */
38enum {
39 GPIO_IN = 0,
40 GPIO_OUT = 1
41};
42
43/* Bits of interest in the GPIO_INTR_STATUS register.
44 */
45enum {
46 INTR_STATUS = 0,
47};
48
49/* Bits of interest in the GPIO_CFG register.
50 */
51enum {
52 GPIO_OE = 9,
53};
54
55/* Bits of interest in the GPIO_INTR_CFG register.
56 * When a GPIO triggers, two separate decisions are made, controlled
57 * by two separate flags.
58 *
59 * - First, INTR_RAW_STATUS_EN controls whether or not the GPIO_INTR_STATUS
60 * register for that GPIO will be updated to reflect the triggering of that
61 * gpio. If this bit is 0, this register will not be updated.
62 * - Second, INTR_ENABLE controls whether an interrupt is triggered.
63 *
64 * If INTR_ENABLE is set and INTR_RAW_STATUS_EN is NOT set, an interrupt
65 * can be triggered but the status register will not reflect it.
66 */
67enum {
68 INTR_ENABLE = 0,
69 INTR_POL_CTL = 1,
70 INTR_DECT_CTL = 2,
71 INTR_RAW_STATUS_EN = 3,
72};
73
74/* Codes of interest in GPIO_INTR_CFG_SU.
75 */
76enum {
77 TARGET_PROC_SCORPION = 4,
78 TARGET_PROC_NONE = 7,
79};
80
81
82#define GPIO_INTR_CFG_SU(gpio) (MSM_TLMM_BASE + 0x0400 + (0x04 * (gpio)))
83#define GPIO_CONFIG(gpio) (MSM_TLMM_BASE + 0x1000 + (0x10 * (gpio)))
84#define GPIO_IN_OUT(gpio) (MSM_TLMM_BASE + 0x1004 + (0x10 * (gpio)))
85#define GPIO_INTR_CFG(gpio) (MSM_TLMM_BASE + 0x1008 + (0x10 * (gpio)))
86#define GPIO_INTR_STATUS(gpio) (MSM_TLMM_BASE + 0x100c + (0x10 * (gpio)))
87
88/**
89 * struct msm_gpio_dev: the MSM8660 SoC GPIO device structure
90 *
91 * @enabled_irqs: a bitmap used to optimize the summary-irq handler. By
92 * keeping track of which gpios are unmasked as irq sources, we avoid
93 * having to do readl calls on hundreds of iomapped registers each time
94 * the summary interrupt fires in order to locate the active interrupts.
95 *
96 * @wake_irqs: a bitmap for tracking which interrupt lines are enabled
97 * as wakeup sources. When the device is suspended, interrupts which are
98 * not wakeup sources are disabled.
99 *
100 * @dual_edge_irqs: a bitmap used to track which irqs are configured
101 * as dual-edge, as this is not supported by the hardware and requires
102 * some special handling in the driver.
103 */
104struct msm_gpio_dev {
105 struct gpio_chip gpio_chip;
106 DECLARE_BITMAP(enabled_irqs, NR_GPIO_IRQS);
107 DECLARE_BITMAP(wake_irqs, NR_GPIO_IRQS);
108 DECLARE_BITMAP(dual_edge_irqs, NR_GPIO_IRQS);
109};
110
111static DEFINE_SPINLOCK(tlmm_lock);
112
113static inline struct msm_gpio_dev *to_msm_gpio_dev(struct gpio_chip *chip)
114{
115 return container_of(chip, struct msm_gpio_dev, gpio_chip);
116}
117
118static inline void set_gpio_bits(unsigned n, void __iomem *reg)
119{
120 writel(readl(reg) | n, reg);
121}
122
123static inline void clear_gpio_bits(unsigned n, void __iomem *reg)
124{
125 writel(readl(reg) & ~n, reg);
126}
127
128static int msm_gpio_get(struct gpio_chip *chip, unsigned offset)
129{
130 return readl(GPIO_IN_OUT(offset)) & BIT(GPIO_IN);
131}
132
133static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
134{
135 writel(val ? BIT(GPIO_OUT) : 0, GPIO_IN_OUT(offset));
136}
137
138static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
139{
140 unsigned long irq_flags;
141
142 spin_lock_irqsave(&tlmm_lock, irq_flags);
143 clear_gpio_bits(BIT(GPIO_OE), GPIO_CONFIG(offset));
144 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
145 return 0;
146}
147
148static int msm_gpio_direction_output(struct gpio_chip *chip,
149 unsigned offset,
150 int val)
151{
152 unsigned long irq_flags;
153
154 spin_lock_irqsave(&tlmm_lock, irq_flags);
155 msm_gpio_set(chip, offset, val);
156 set_gpio_bits(BIT(GPIO_OE), GPIO_CONFIG(offset));
157 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
158 return 0;
159}
160
161static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
162{
163 return msm_gpiomux_get(chip->base + offset);
164}
165
166static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
167{
168 msm_gpiomux_put(chip->base + offset);
169}
170
171static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
172{
173 return MSM_GPIO_TO_INT(chip->base + offset);
174}
175
176static inline int msm_irq_to_gpio(struct gpio_chip *chip, unsigned irq)
177{
178 return irq - MSM_GPIO_TO_INT(chip->base);
179}
180
181static struct msm_gpio_dev msm_gpio = {
182 .gpio_chip = {
183 .base = 0,
184 .ngpio = NR_GPIO_IRQS,
185 .direction_input = msm_gpio_direction_input,
186 .direction_output = msm_gpio_direction_output,
187 .get = msm_gpio_get,
188 .set = msm_gpio_set,
189 .to_irq = msm_gpio_to_irq,
190 .request = msm_gpio_request,
191 .free = msm_gpio_free,
192 },
193};
194
195/* For dual-edge interrupts in software, since the hardware has no
196 * such support:
197 *
198 * At appropriate moments, this function may be called to flip the polarity
199 * settings of both-edge irq lines to try and catch the next edge.
200 *
201 * The attempt is considered successful if:
202 * - the status bit goes high, indicating that an edge was caught, or
203 * - the input value of the gpio doesn't change during the attempt.
204 * If the value changes twice during the process, that would cause the first
205 * test to fail but would force the second, as two opposite
206 * transitions would cause a detection no matter the polarity setting.
207 *
208 * The do-loop tries to sledge-hammer closed the timing hole between
209 * the initial value-read and the polarity-write - if the line value changes
210 * during that window, an interrupt is lost, the new polarity setting is
211 * incorrect, and the first success test will fail, causing a retry.
212 *
213 * Algorithm comes from Google's msmgpio driver, see mach-msm/gpio.c.
214 */
215static void msm_gpio_update_dual_edge_pos(unsigned gpio)
216{
217 int loop_limit = 100;
218 unsigned val, val2, intstat;
219
220 do {
221 val = readl(GPIO_IN_OUT(gpio)) & BIT(GPIO_IN);
222 if (val)
223 clear_gpio_bits(BIT(INTR_POL_CTL), GPIO_INTR_CFG(gpio));
224 else
225 set_gpio_bits(BIT(INTR_POL_CTL), GPIO_INTR_CFG(gpio));
226 val2 = readl(GPIO_IN_OUT(gpio)) & BIT(GPIO_IN);
227 intstat = readl(GPIO_INTR_STATUS(gpio)) & BIT(INTR_STATUS);
228 if (intstat || val == val2)
229 return;
230 } while (loop_limit-- > 0);
231 pr_err("dual-edge irq failed to stabilize, "
232 "interrupts dropped. %#08x != %#08x\n",
233 val, val2);
234}
235
236static void msm_gpio_irq_ack(struct irq_data *d)
237{
238 int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);
239
240 writel(BIT(INTR_STATUS), GPIO_INTR_STATUS(gpio));
241 if (test_bit(gpio, msm_gpio.dual_edge_irqs))
242 msm_gpio_update_dual_edge_pos(gpio);
243}
244
245static void msm_gpio_irq_mask(struct irq_data *d)
246{
247 int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);
248 unsigned long irq_flags;
249
250 spin_lock_irqsave(&tlmm_lock, irq_flags);
251 writel(TARGET_PROC_NONE, GPIO_INTR_CFG_SU(gpio));
252 clear_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio));
253 __clear_bit(gpio, msm_gpio.enabled_irqs);
254 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
255}
256
257static void msm_gpio_irq_unmask(struct irq_data *d)
258{
259 int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);
260 unsigned long irq_flags;
261
262 spin_lock_irqsave(&tlmm_lock, irq_flags);
263 __set_bit(gpio, msm_gpio.enabled_irqs);
264 set_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio));
265 writel(TARGET_PROC_SCORPION, GPIO_INTR_CFG_SU(gpio));
266 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
267}
268
269static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type)
270{
271 int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);
272 unsigned long irq_flags;
273 uint32_t bits;
274
275 spin_lock_irqsave(&tlmm_lock, irq_flags);
276
277 bits = readl(GPIO_INTR_CFG(gpio));
278
279 if (flow_type & IRQ_TYPE_EDGE_BOTH) {
280 bits |= BIT(INTR_DECT_CTL);
281 __irq_set_handler_locked(d->irq, handle_edge_irq);
282 if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH)
283 __set_bit(gpio, msm_gpio.dual_edge_irqs);
284 else
285 __clear_bit(gpio, msm_gpio.dual_edge_irqs);
286 } else {
287 bits &= ~BIT(INTR_DECT_CTL);
288 __irq_set_handler_locked(d->irq, handle_level_irq);
289 __clear_bit(gpio, msm_gpio.dual_edge_irqs);
290 }
291
292 if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH))
293 bits |= BIT(INTR_POL_CTL);
294 else
295 bits &= ~BIT(INTR_POL_CTL);
296
297 writel(bits, GPIO_INTR_CFG(gpio));
298
299 if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH)
300 msm_gpio_update_dual_edge_pos(gpio);
301
302 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
303
304 return 0;
305}
306
307/*
308 * When the summary IRQ is raised, any number of GPIO lines may be high.
309 * It is the job of the summary handler to find all those GPIO lines
310 * which have been set as summary IRQ lines and which are triggered,
311 * and to call their interrupt handlers.
312 */
313static void msm_summary_irq_handler(unsigned int irq, struct irq_desc *desc)
314{
315 unsigned long i;
316 struct irq_chip *chip = irq_desc_get_chip(desc);
317
318 chained_irq_enter(chip, desc);
319
320 for (i = find_first_bit(msm_gpio.enabled_irqs, NR_GPIO_IRQS);
321 i < NR_GPIO_IRQS;
322 i = find_next_bit(msm_gpio.enabled_irqs, NR_GPIO_IRQS, i + 1)) {
323 if (readl(GPIO_INTR_STATUS(i)) & BIT(INTR_STATUS))
324 generic_handle_irq(msm_gpio_to_irq(&msm_gpio.gpio_chip,
325 i));
326 }
327
328 chained_irq_exit(chip, desc);
329}
330
331static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
332{
333 int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);
334
335 if (on) {
336 if (bitmap_empty(msm_gpio.wake_irqs, NR_GPIO_IRQS))
337 irq_set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 1);
338 set_bit(gpio, msm_gpio.wake_irqs);
339 } else {
340 clear_bit(gpio, msm_gpio.wake_irqs);
341 if (bitmap_empty(msm_gpio.wake_irqs, NR_GPIO_IRQS))
342 irq_set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 0);
343 }
344
345 return 0;
346}
347
348static struct irq_chip msm_gpio_irq_chip = {
349 .name = "msmgpio",
350 .irq_mask = msm_gpio_irq_mask,
351 .irq_unmask = msm_gpio_irq_unmask,
352 .irq_ack = msm_gpio_irq_ack,
353 .irq_set_type = msm_gpio_irq_set_type,
354 .irq_set_wake = msm_gpio_irq_set_wake,
355};
356
357static int __devinit msm_gpio_probe(struct platform_device *dev)
358{
359 int i, irq, ret;
360
361 bitmap_zero(msm_gpio.enabled_irqs, NR_GPIO_IRQS);
362 bitmap_zero(msm_gpio.wake_irqs, NR_GPIO_IRQS);
363 bitmap_zero(msm_gpio.dual_edge_irqs, NR_GPIO_IRQS);
364 msm_gpio.gpio_chip.label = dev->name;
365 ret = gpiochip_add(&msm_gpio.gpio_chip);
366 if (ret < 0)
367 return ret;
368
369 for (i = 0; i < msm_gpio.gpio_chip.ngpio; ++i) {
370 irq = msm_gpio_to_irq(&msm_gpio.gpio_chip, i);
371 irq_set_chip_and_handler(irq, &msm_gpio_irq_chip,
372 handle_level_irq);
373 set_irq_flags(irq, IRQF_VALID);
374 }
375
376 irq_set_chained_handler(TLMM_SCSS_SUMMARY_IRQ,
377 msm_summary_irq_handler);
378 return 0;
379}
380
381static int __devexit msm_gpio_remove(struct platform_device *dev)
382{
383 int ret = gpiochip_remove(&msm_gpio.gpio_chip);
384
385 if (ret < 0)
386 return ret;
387
388 irq_set_handler(TLMM_SCSS_SUMMARY_IRQ, NULL);
389
390 return 0;
391}
392
393static struct platform_driver msm_gpio_driver = {
394 .probe = msm_gpio_probe,
395 .remove = __devexit_p(msm_gpio_remove),
396 .driver = {
397 .name = "msmgpio",
398 .owner = THIS_MODULE,
399 },
400};
401
402static struct platform_device msm_device_gpio = {
403 .name = "msmgpio",
404 .id = -1,
405};
406
407static int __init msm_gpio_init(void)
408{
409 int rc;
410
411 rc = platform_driver_register(&msm_gpio_driver);
412 if (!rc) {
413 rc = platform_device_register(&msm_device_gpio);
414 if (rc)
415 platform_driver_unregister(&msm_gpio_driver);
416 }
417
418 return rc;
419}
420
421static void __exit msm_gpio_exit(void)
422{
423 platform_device_unregister(&msm_device_gpio);
424 platform_driver_unregister(&msm_gpio_driver);
425}
426
427postcore_initcall(msm_gpio_init);
428module_exit(msm_gpio_exit);
429
430MODULE_AUTHOR("Gregory Bean <gbean@codeaurora.org>");
431MODULE_DESCRIPTION("Driver for Qualcomm MSM TLMMv2 SoC GPIOs");
432MODULE_LICENSE("GPL v2");
433MODULE_ALIAS("platform:msmgpio");
diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c
deleted file mode 100644
index 5ea273b00da..00000000000
--- a/arch/arm/mach-msm/gpio.c
+++ /dev/null
@@ -1,376 +0,0 @@
1/* linux/arch/arm/mach-msm/gpio.c
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <linux/bitops.h>
18#include <linux/gpio.h>
19#include <linux/interrupt.h>
20#include <linux/io.h>
21#include <linux/irq.h>
22#include <linux/module.h>
23#include "gpio_hw.h"
24#include "gpiomux.h"
25
26#define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
27
28#define MSM_GPIO_BANK(bank, first, last) \
29 { \
30 .regs = { \
31 .out = MSM_GPIO_OUT_##bank, \
32 .in = MSM_GPIO_IN_##bank, \
33 .int_status = MSM_GPIO_INT_STATUS_##bank, \
34 .int_clear = MSM_GPIO_INT_CLEAR_##bank, \
35 .int_en = MSM_GPIO_INT_EN_##bank, \
36 .int_edge = MSM_GPIO_INT_EDGE_##bank, \
37 .int_pos = MSM_GPIO_INT_POS_##bank, \
38 .oe = MSM_GPIO_OE_##bank, \
39 }, \
40 .chip = { \
41 .base = (first), \
42 .ngpio = (last) - (first) + 1, \
43 .get = msm_gpio_get, \
44 .set = msm_gpio_set, \
45 .direction_input = msm_gpio_direction_input, \
46 .direction_output = msm_gpio_direction_output, \
47 .to_irq = msm_gpio_to_irq, \
48 .request = msm_gpio_request, \
49 .free = msm_gpio_free, \
50 } \
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);
88 return 0;
89}
90
91static void msm_gpio_update_both_edge_detect(struct msm_gpio_chip *msm_chip)
92{
93 int loop_limit = 100;
94 unsigned pol, val, val2, intstat;
95 do {
96 val = readl(msm_chip->regs.in);
97 pol = readl(msm_chip->regs.int_pos);
98 pol = (pol & ~msm_chip->both_edge_detect) |
99 (~val & msm_chip->both_edge_detect);
100 writel(pol, msm_chip->regs.int_pos);
101 intstat = readl(msm_chip->regs.int_status);
102 val2 = readl(msm_chip->regs.in);
103 if (((val ^ val2) & msm_chip->both_edge_detect & ~intstat) == 0)
104 return;
105 } while (loop_limit-- > 0);
106 printk(KERN_ERR "msm_gpio_update_both_edge_detect, "
107 "failed to reach stable state %x != %x\n", val, val2);
108}
109
110static int msm_gpio_clear_detect_status(struct msm_gpio_chip *msm_chip,
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(struct irq_data *d)
229{
230 unsigned long irq_flags;
231 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
232 spin_lock_irqsave(&msm_chip->lock, irq_flags);
233 msm_gpio_clear_detect_status(msm_chip,
234 d->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(struct irq_data *d)
239{
240 unsigned long irq_flags;
241 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
242 unsigned offset = d->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(struct irq_data *d)
254{
255 unsigned long irq_flags;
256 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
257 unsigned offset = d->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(struct irq_data *d, unsigned int on)
269{
270 unsigned long irq_flags;
271 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
272 unsigned offset = d->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(struct irq_data *d, unsigned int flow_type)
286{
287 unsigned long irq_flags;
288 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
289 unsigned offset = d->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_set_handler_locked(d->irq, handle_edge_irq);
297 } else {
298 writel(val & ~mask, msm_chip->regs.int_edge);
299 __irq_set_handler_locked(d->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);
311 }
312 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
313 return 0;
314}
315
316static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
317{
318 int i, j, mask;
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->irq_data.chip->irq_ack(&desc->irq_data);
337}
338
339static struct irq_chip msm_gpio_irq_chip = {
340 .name = "msmgpio",
341 .irq_ack = msm_gpio_irq_ack,
342 .irq_mask = msm_gpio_irq_mask,
343 .irq_unmask = msm_gpio_irq_unmask,
344 .irq_set_wake = msm_gpio_irq_set_wake,
345 .irq_set_type = msm_gpio_irq_set_type,
346};
347
348static int __init msm_init_gpio(void)
349{
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 irq_set_chip_data(i, &msm_gpio_chips[j]);
358 irq_set_chip_and_handler(i, &msm_gpio_irq_chip,
359 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 irq_set_chained_handler(INT_GPIO_GROUP1, msm_gpio_irq_handler);
370 irq_set_chained_handler(INT_GPIO_GROUP2, msm_gpio_irq_handler);
371 irq_set_irq_wake(INT_GPIO_GROUP1, 1);
372 irq_set_irq_wake(INT_GPIO_GROUP2, 2);
373 return 0;
374}
375
376postcore_initcall(msm_init_gpio);
diff --git a/arch/arm/mach-msm/gpio_hw.h b/arch/arm/mach-msm/gpio_hw.h
deleted file mode 100644
index 6b5066038ba..00000000000
--- a/arch/arm/mach-msm/gpio_hw.h
+++ /dev/null
@@ -1,278 +0,0 @@
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.h b/arch/arm/mach-msm/gpiomux.h
index b178d9cb742..00459f6ee13 100644
--- a/arch/arm/mach-msm/gpiomux.h
+++ b/arch/arm/mach-msm/gpiomux.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <mach/msm_gpiomux.h>
22 23
23#if defined(CONFIG_MSM_V2_TLMM) 24#if defined(CONFIG_MSM_V2_TLMM)
24#include "gpiomux-v2.h" 25#include "gpiomux-v2.h"
@@ -71,12 +72,6 @@ enum {
71 */ 72 */
72extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS]; 73extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
73 74
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 75/* Install a new configuration to the gpio line. To avoid overwriting
81 * a configuration, leave the VALID bit out. 76 * a configuration, leave the VALID bit out.
82 */ 77 */
@@ -94,16 +89,6 @@ int msm_gpiomux_write(unsigned gpio,
94 */ 89 */
95void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val); 90void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val);
96#else 91#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, 92static inline int msm_gpiomux_write(unsigned gpio,
108 gpiomux_config_t active, 93 gpiomux_config_t active,
109 gpiomux_config_t suspended) 94 gpiomux_config_t suspended)
diff --git a/arch/arm/mach-msm/include/mach/clkdev.h b/arch/arm/mach-msm/include/mach/msm_gpiomux.h
index f87a57b5953..0c7d3936e02 100644
--- a/arch/arm/mach-msm/include/mach/clkdev.h
+++ b/arch/arm/mach-msm/include/mach/msm_gpiomux.h
@@ -9,11 +9,30 @@
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details. 10 * GNU General Public License for more details.
11 */ 11 */
12#ifndef __ASM_ARCH_MSM_CLKDEV_H
13#define __ASM_ARCH_MSM_CLKDEV_H
14 12
15struct clk; 13#ifndef _LINUX_MSM_GPIOMUX_H
14#define _LINUX_MSM_GPIOMUX_H
15
16#ifdef CONFIG_MSM_GPIOMUX
17
18/* Increment a gpio's reference count, possibly activating the line. */
19int __must_check msm_gpiomux_get(unsigned gpio);
20
21/* Decrement a gpio's reference count, possibly suspending the line. */
22int msm_gpiomux_put(unsigned gpio);
23
24#else
25
26static inline int __must_check msm_gpiomux_get(unsigned gpio)
27{
28 return -ENOSYS;
29}
30
31static inline int msm_gpiomux_put(unsigned gpio)
32{
33 return -ENOSYS;
34}
16 35
17static inline int __clk_get(struct clk *clk) { return 1; }
18static inline void __clk_put(struct clk *clk) { }
19#endif 36#endif
37
38#endif /* _LINUX_MSM_GPIOMUX_H */
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
index 8f99d97615a..94fe9fe6feb 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
@@ -55,13 +55,11 @@
55#define MSM_DMOV_PHYS 0xA9700000 55#define MSM_DMOV_PHYS 0xA9700000
56#define MSM_DMOV_SIZE SZ_4K 56#define MSM_DMOV_SIZE SZ_4K
57 57
58#define MSM_GPIO1_BASE IOMEM(0xE0003000) 58#define MSM7X00_GPIO1_PHYS 0xA9200000
59#define MSM_GPIO1_PHYS 0xA9200000 59#define MSM7X00_GPIO1_SIZE SZ_4K
60#define MSM_GPIO1_SIZE SZ_4K
61 60
62#define MSM_GPIO2_BASE IOMEM(0xE0004000) 61#define MSM7X00_GPIO2_PHYS 0xA9300000
63#define MSM_GPIO2_PHYS 0xA9300000 62#define MSM7X00_GPIO2_SIZE SZ_4K
64#define MSM_GPIO2_SIZE SZ_4K
65 63
66#define MSM_CLK_CTL_BASE IOMEM(0xE0005000) 64#define MSM_CLK_CTL_BASE IOMEM(0xE0005000)
67#define MSM_CLK_CTL_PHYS 0xA8600000 65#define MSM_CLK_CTL_PHYS 0xA8600000
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
index 4d84be15955..37694442d1b 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
@@ -46,13 +46,11 @@
46#define MSM_DMOV_PHYS 0xAC400000 46#define MSM_DMOV_PHYS 0xAC400000
47#define MSM_DMOV_SIZE SZ_4K 47#define MSM_DMOV_SIZE SZ_4K
48 48
49#define MSM_GPIO1_BASE IOMEM(0xE0003000) 49#define MSM7X30_GPIO1_PHYS 0xAC001000
50#define MSM_GPIO1_PHYS 0xAC001000 50#define MSM7X30_GPIO1_SIZE SZ_4K
51#define MSM_GPIO1_SIZE SZ_4K
52 51
53#define MSM_GPIO2_BASE IOMEM(0xE0004000) 52#define MSM7X30_GPIO2_PHYS 0xAC101000
54#define MSM_GPIO2_PHYS 0xAC101000 53#define MSM7X30_GPIO2_SIZE SZ_4K
55#define MSM_GPIO2_SIZE SZ_4K
56 54
57#define MSM_CLK_CTL_BASE IOMEM(0xE0005000) 55#define MSM_CLK_CTL_BASE IOMEM(0xE0005000)
58#define MSM_CLK_CTL_PHYS 0xAB800000 56#define MSM_CLK_CTL_PHYS 0xAB800000
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
index d4143201999..d67cd73316f 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
@@ -46,13 +46,11 @@
46#define MSM_DMOV_PHYS 0xA9700000 46#define MSM_DMOV_PHYS 0xA9700000
47#define MSM_DMOV_SIZE SZ_4K 47#define MSM_DMOV_SIZE SZ_4K
48 48
49#define MSM_GPIO1_BASE IOMEM(0xE0003000) 49#define QSD8X50_GPIO1_PHYS 0xA9000000
50#define MSM_GPIO1_PHYS 0xA9000000 50#define QSD8X50_GPIO1_SIZE SZ_4K
51#define MSM_GPIO1_SIZE SZ_4K
52 51
53#define MSM_GPIO2_BASE IOMEM(0xE0004000) 52#define QSD8X50_GPIO2_PHYS 0xA9100000
54#define MSM_GPIO2_PHYS 0xA9100000 53#define QSD8X50_GPIO2_SIZE SZ_4K
55#define MSM_GPIO2_SIZE SZ_4K
56 54
57#define MSM_CLK_CTL_BASE IOMEM(0xE0005000) 55#define MSM_CLK_CTL_BASE IOMEM(0xE0005000)
58#define MSM_CLK_CTL_PHYS 0xA8600000 56#define MSM_CLK_CTL_PHYS 0xA8600000
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h
index 2f494b6a9d0..4ded15238b6 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap.h
@@ -61,5 +61,7 @@
61#define MSM_QGIC_CPU_BASE IOMEM(0xF0001000) 61#define MSM_QGIC_CPU_BASE IOMEM(0xF0001000)
62#define MSM_TMR_BASE IOMEM(0xF0200000) 62#define MSM_TMR_BASE IOMEM(0xF0200000)
63#define MSM_TMR0_BASE IOMEM(0xF0201000) 63#define MSM_TMR0_BASE IOMEM(0xF0201000)
64#define MSM_GPIO1_BASE IOMEM(0xE0003000)
65#define MSM_GPIO2_BASE IOMEM(0xE0004000)
64 66
65#endif 67#endif
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index cec6ed1c91d..140ddbbc3a8 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -43,8 +43,8 @@ static struct map_desc msm_io_desc[] __initdata = {
43 MSM_DEVICE(VIC), 43 MSM_DEVICE(VIC),
44 MSM_CHIP_DEVICE(CSR, MSM7X00), 44 MSM_CHIP_DEVICE(CSR, MSM7X00),
45 MSM_DEVICE(DMOV), 45 MSM_DEVICE(DMOV),
46 MSM_DEVICE(GPIO1), 46 MSM_CHIP_DEVICE(GPIO1, MSM7X00),
47 MSM_DEVICE(GPIO2), 47 MSM_CHIP_DEVICE(GPIO2, MSM7X00),
48 MSM_DEVICE(CLK_CTL), 48 MSM_DEVICE(CLK_CTL),
49#ifdef CONFIG_MSM_DEBUG_UART 49#ifdef CONFIG_MSM_DEBUG_UART
50 MSM_DEVICE(DEBUG_UART), 50 MSM_DEVICE(DEBUG_UART),
@@ -76,8 +76,8 @@ static struct map_desc qsd8x50_io_desc[] __initdata = {
76 MSM_DEVICE(VIC), 76 MSM_DEVICE(VIC),
77 MSM_CHIP_DEVICE(CSR, QSD8X50), 77 MSM_CHIP_DEVICE(CSR, QSD8X50),
78 MSM_DEVICE(DMOV), 78 MSM_DEVICE(DMOV),
79 MSM_DEVICE(GPIO1), 79 MSM_CHIP_DEVICE(GPIO1, QSD8X50),
80 MSM_DEVICE(GPIO2), 80 MSM_CHIP_DEVICE(GPIO2, QSD8X50),
81 MSM_DEVICE(CLK_CTL), 81 MSM_DEVICE(CLK_CTL),
82 MSM_DEVICE(SIRC), 82 MSM_DEVICE(SIRC),
83 MSM_DEVICE(SCPLL), 83 MSM_DEVICE(SCPLL),
@@ -135,8 +135,8 @@ static struct map_desc msm7x30_io_desc[] __initdata = {
135 MSM_DEVICE(VIC), 135 MSM_DEVICE(VIC),
136 MSM_CHIP_DEVICE(CSR, MSM7X30), 136 MSM_CHIP_DEVICE(CSR, MSM7X30),
137 MSM_DEVICE(DMOV), 137 MSM_DEVICE(DMOV),
138 MSM_DEVICE(GPIO1), 138 MSM_CHIP_DEVICE(GPIO1, MSM7X30),
139 MSM_DEVICE(GPIO2), 139 MSM_CHIP_DEVICE(GPIO2, MSM7X30),
140 MSM_DEVICE(CLK_CTL), 140 MSM_DEVICE(CLK_CTL),
141 MSM_DEVICE(CLK_CTL_SH2), 141 MSM_DEVICE(CLK_CTL_SH2),
142 MSM_DEVICE(AD5), 142 MSM_DEVICE(AD5),
diff --git a/arch/arm/mach-mv78xx0/include/mach/hardware.h b/arch/arm/mach-mv78xx0/include/mach/hardware.h
index 5d887557e12..67cab0a08e0 100644
--- a/arch/arm/mach-mv78xx0/include/mach/hardware.h
+++ b/arch/arm/mach-mv78xx0/include/mach/hardware.h
@@ -11,11 +11,4 @@
11 11
12#include "mv78xx0.h" 12#include "mv78xx0.h"
13 13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x00001000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE MV78XX0_PCIE_MEM_PHYS_BASE /* mem base for VGA */
19
20
21#endif 14#endif
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index f27c7d2fa9f..c51af1cac30 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <video/vga.h>
14#include <asm/irq.h> 15#include <asm/irq.h>
15#include <asm/mach/pci.h> 16#include <asm/mach/pci.h>
16#include <plat/pcie.h> 17#include <plat/pcie.h>
@@ -259,7 +260,8 @@ mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys)
259 return bus; 260 return bus;
260} 261}
261 262
262static int __init mv78xx0_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 263static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot,
264 u8 pin)
263{ 265{
264 struct pcie_port *pp = bus_to_port(dev->bus->number); 266 struct pcie_port *pp = bus_to_port(dev->bus->number);
265 267
@@ -297,6 +299,8 @@ static void __init add_pcie_port(int maj, int min, unsigned long base)
297 299
298void __init mv78xx0_pcie_init(int init_port0, int init_port1) 300void __init mv78xx0_pcie_init(int init_port0, int init_port1)
299{ 301{
302 vga_base = MV78XX0_PCIE_MEM_PHYS_BASE;
303
300 if (init_port0) { 304 if (init_port0) {
301 add_pcie_port(0, 0, PCIE00_VIRT_BASE); 305 add_pcie_port(0, 0, PCIE00_VIRT_BASE);
302 if (!orion_pcie_x4_mode((void __iomem *)PCIE00_VIRT_BASE)) { 306 if (!orion_pcie_x4_mode((void __iomem *)PCIE00_VIRT_BASE)) {
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index f25e9d7bf0f..b4e7c58bbb3 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -180,6 +180,7 @@ config MACH_MX53_EVK
180 select IMX_HAVE_PLATFORM_IMX_I2C 180 select IMX_HAVE_PLATFORM_IMX_I2C
181 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 181 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
182 select IMX_HAVE_PLATFORM_SPI_IMX 182 select IMX_HAVE_PLATFORM_SPI_IMX
183 select LEDS_GPIO_REGISTER
183 help 184 help
184 Include support for MX53 EVK platform. This includes specific 185 Include support for MX53 EVK platform. This includes specific
185 configurations for the board and its peripherals. 186 configurations for the board and its peripherals.
@@ -203,10 +204,23 @@ config MACH_MX53_LOCO
203 select IMX_HAVE_PLATFORM_IMX_UART 204 select IMX_HAVE_PLATFORM_IMX_UART
204 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 205 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
205 select IMX_HAVE_PLATFORM_GPIO_KEYS 206 select IMX_HAVE_PLATFORM_GPIO_KEYS
207 select LEDS_GPIO_REGISTER
206 help 208 help
207 Include support for MX53 LOCO platform. This includes specific 209 Include support for MX53 LOCO platform. This includes specific
208 configurations for the board and its peripherals. 210 configurations for the board and its peripherals.
209 211
212config MACH_MX53_ARD
213 bool "Support MX53 ARD platforms"
214 select SOC_IMX53
215 select IMX_HAVE_PLATFORM_IMX2_WDT
216 select IMX_HAVE_PLATFORM_IMX_I2C
217 select IMX_HAVE_PLATFORM_IMX_UART
218 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
219 select IMX_HAVE_PLATFORM_GPIO_KEYS
220 help
221 Include support for MX53 ARD platform. This includes specific
222 configurations for the board and its peripherals.
223
210endif # ARCH_MX53_SUPPORTED 224endif # ARCH_MX53_SUPPORTED
211 225
212endif 226endif
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index 0b9338cec51..383e7cd3fbc 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -6,12 +6,14 @@
6obj-y := cpu.o mm.o clock-mx51-mx53.o devices.o ehci.o system.o 6obj-y := cpu.o mm.o clock-mx51-mx53.o devices.o ehci.o system.o
7obj-$(CONFIG_SOC_IMX50) += mm-mx50.o 7obj-$(CONFIG_SOC_IMX50) += mm-mx50.o
8 8
9obj-$(CONFIG_PM) += pm-imx5.o
9obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o 10obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o
10obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o 11obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
11obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o 12obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o
12obj-$(CONFIG_MACH_MX53_EVK) += board-mx53_evk.o 13obj-$(CONFIG_MACH_MX53_EVK) += board-mx53_evk.o
13obj-$(CONFIG_MACH_MX53_SMD) += board-mx53_smd.o 14obj-$(CONFIG_MACH_MX53_SMD) += board-mx53_smd.o
14obj-$(CONFIG_MACH_MX53_LOCO) += board-mx53_loco.o 15obj-$(CONFIG_MACH_MX53_LOCO) += board-mx53_loco.o
16obj-$(CONFIG_MACH_MX53_ARD) += board-mx53_ard.o
15obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o 17obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o
16obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o 18obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o
17obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o 19obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index 7c893fa7026..68934ea8725 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -81,7 +81,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
81 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, 81 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
82 }, { 82 }, {
83 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000), 83 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000),
84 .irq = irq_to_gpio(CPUIMX51_QUARTD_GPIO), 84 .irq = gpio_to_irq(CPUIMX51_QUARTD_GPIO),
85 .irqflags = IRQF_TRIGGER_HIGH, 85 .irqflags = IRQF_TRIGGER_HIGH,
86 .uartclk = CPUIMX51_QUART_XTAL, 86 .uartclk = CPUIMX51_QUART_XTAL,
87 .regshift = CPUIMX51_QUART_REGSHIFT, 87 .regshift = CPUIMX51_QUART_REGSHIFT,
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index e54e4bf61cf..11b0ff67f89 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -41,6 +41,8 @@
41#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21) 41#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21)
42#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24) 42#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
43#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25) 43#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
44#define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6)
45#define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5)
44 46
45/* USB_CTRL_1 */ 47/* USB_CTRL_1 */
46#define MX51_USB_CTRL_1_OFFSET 0x10 48#define MX51_USB_CTRL_1_OFFSET 0x10
@@ -142,6 +144,9 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
142 MX51_PAD_SD1_DATA1__SD1_DATA1, 144 MX51_PAD_SD1_DATA1__SD1_DATA1,
143 MX51_PAD_SD1_DATA2__SD1_DATA2, 145 MX51_PAD_SD1_DATA2__SD1_DATA2,
144 MX51_PAD_SD1_DATA3__SD1_DATA3, 146 MX51_PAD_SD1_DATA3__SD1_DATA3,
147 /* CD/WP from controller */
148 MX51_PAD_GPIO1_0__SD1_CD,
149 MX51_PAD_GPIO1_1__SD1_WP,
145 150
146 /* SD 2 */ 151 /* SD 2 */
147 MX51_PAD_SD2_CMD__SD2_CMD, 152 MX51_PAD_SD2_CMD__SD2_CMD,
@@ -150,6 +155,9 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
150 MX51_PAD_SD2_DATA1__SD2_DATA1, 155 MX51_PAD_SD2_DATA1__SD2_DATA1,
151 MX51_PAD_SD2_DATA2__SD2_DATA2, 156 MX51_PAD_SD2_DATA2__SD2_DATA2,
152 MX51_PAD_SD2_DATA3__SD2_DATA3, 157 MX51_PAD_SD2_DATA3__SD2_DATA3,
158 /* CD/WP gpio */
159 MX51_PAD_GPIO1_6__GPIO1_6,
160 MX51_PAD_GPIO1_5__GPIO1_5,
153 161
154 /* eCSPI1 */ 162 /* eCSPI1 */
155 MX51_PAD_CSPI1_MISO__ECSPI1_MISO, 163 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
@@ -331,6 +339,18 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {
331 .num_chipselect = ARRAY_SIZE(mx51_babbage_spi_cs), 339 .num_chipselect = ARRAY_SIZE(mx51_babbage_spi_cs),
332}; 340};
333 341
342static const struct esdhc_platform_data mx51_babbage_sd1_data __initconst = {
343 .cd_type = ESDHC_CD_CONTROLLER,
344 .wp_type = ESDHC_WP_CONTROLLER,
345};
346
347static const struct esdhc_platform_data mx51_babbage_sd2_data __initconst = {
348 .cd_gpio = BABBAGE_SD2_CD,
349 .wp_gpio = BABBAGE_SD2_WP,
350 .cd_type = ESDHC_CD_GPIO,
351 .wp_type = ESDHC_WP_GPIO,
352};
353
334/* 354/*
335 * Board specific initialization. 355 * Board specific initialization.
336 */ 356 */
@@ -349,7 +369,7 @@ static void __init mx51_babbage_init(void)
349 ARRAY_SIZE(mx51babbage_pads)); 369 ARRAY_SIZE(mx51babbage_pads));
350 370
351 imx51_add_imx_uart(0, &uart_pdata); 371 imx51_add_imx_uart(0, &uart_pdata);
352 imx51_add_imx_uart(1, &uart_pdata); 372 imx51_add_imx_uart(1, NULL);
353 imx51_add_imx_uart(2, &uart_pdata); 373 imx51_add_imx_uart(2, &uart_pdata);
354 374
355 babbage_fec_reset(); 375 babbage_fec_reset();
@@ -376,8 +396,8 @@ static void __init mx51_babbage_init(void)
376 mxc_iomux_v3_setup_pad(usbh1stp); 396 mxc_iomux_v3_setup_pad(usbh1stp);
377 babbage_usbhub_reset(); 397 babbage_usbhub_reset();
378 398
379 imx51_add_sdhci_esdhc_imx(0, NULL); 399 imx51_add_sdhci_esdhc_imx(0, &mx51_babbage_sd1_data);
380 imx51_add_sdhci_esdhc_imx(1, NULL); 400 imx51_add_sdhci_esdhc_imx(1, &mx51_babbage_sd2_data);
381 401
382 spi_register_board_info(mx51_babbage_spi_board_info, 402 spi_register_board_info(mx51_babbage_spi_board_info,
383 ARRAY_SIZE(mx51_babbage_spi_board_info)); 403 ARRAY_SIZE(mx51_babbage_spi_board_info));
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
index f70700dc0ec..551daf85ff8 100644
--- a/arch/arm/mach-mx5/board-mx51_efikamx.c
+++ b/arch/arm/mach-mx5/board-mx51_efikamx.c
@@ -108,9 +108,9 @@ static void __init mx51_efikamx_board_id(void)
108 gpio_request(EFIKAMX_PCBID2, "pcbid2"); 108 gpio_request(EFIKAMX_PCBID2, "pcbid2");
109 gpio_direction_input(EFIKAMX_PCBID2); 109 gpio_direction_input(EFIKAMX_PCBID2);
110 110
111 id = gpio_get_value(EFIKAMX_PCBID0); 111 id = gpio_get_value(EFIKAMX_PCBID0) ? 1 : 0;
112 id |= gpio_get_value(EFIKAMX_PCBID1) << 1; 112 id |= (gpio_get_value(EFIKAMX_PCBID1) ? 1 : 0) << 1;
113 id |= gpio_get_value(EFIKAMX_PCBID2) << 2; 113 id |= (gpio_get_value(EFIKAMX_PCBID2) ? 1 : 0) << 2;
114 114
115 switch (id) { 115 switch (id) {
116 case 7: 116 case 7:
diff --git a/arch/arm/mach-mx5/board-mx51_efikasb.c b/arch/arm/mach-mx5/board-mx51_efikasb.c
index 2e4d9d32a87..8a9bca22beb 100644
--- a/arch/arm/mach-mx5/board-mx51_efikasb.c
+++ b/arch/arm/mach-mx5/board-mx51_efikasb.c
@@ -156,23 +156,24 @@ static struct gpio_keys_button mx51_efikasb_keys[] = {
156 { 156 {
157 .code = KEY_POWER, 157 .code = KEY_POWER,
158 .gpio = EFIKASB_PWRKEY, 158 .gpio = EFIKASB_PWRKEY,
159 .type = EV_PWR, 159 .type = EV_KEY,
160 .desc = "Power Button", 160 .desc = "Power Button",
161 .wakeup = 1, 161 .wakeup = 1,
162 .debounce_interval = 10, /* ms */ 162 .active_low = 1,
163 }, 163 },
164 { 164 {
165 .code = SW_LID, 165 .code = SW_LID,
166 .gpio = EFIKASB_LID, 166 .gpio = EFIKASB_LID,
167 .type = EV_SW, 167 .type = EV_SW,
168 .desc = "Lid Switch", 168 .desc = "Lid Switch",
169 .active_low = 1,
169 }, 170 },
170 { 171 {
171 /* SW_RFKILLALL vs KEY_RFKILL ? */ 172 .code = KEY_RFKILL,
172 .code = SW_RFKILL_ALL,
173 .gpio = EFIKASB_RFKILL, 173 .gpio = EFIKASB_RFKILL,
174 .type = EV_SW, 174 .type = EV_KEY,
175 .desc = "rfkill", 175 .desc = "rfkill",
176 .active_low = 1,
176 }, 177 },
177}; 178};
178 179
@@ -224,8 +225,8 @@ static void __init mx51_efikasb_board_id(void)
224 gpio_request(EFIKASB_PCBID1, "pcb id1"); 225 gpio_request(EFIKASB_PCBID1, "pcb id1");
225 gpio_direction_input(EFIKASB_PCBID1); 226 gpio_direction_input(EFIKASB_PCBID1);
226 227
227 id = gpio_get_value(EFIKASB_PCBID0); 228 id = gpio_get_value(EFIKASB_PCBID0) ? 1 : 0;
228 id |= gpio_get_value(EFIKASB_PCBID1) << 1; 229 id |= (gpio_get_value(EFIKASB_PCBID1) ? 1 : 0) << 1;
229 230
230 switch (id) { 231 switch (id) {
231 default: 232 default:
diff --git a/arch/arm/mach-mx5/board-mx53_ard.c b/arch/arm/mach-mx5/board-mx53_ard.c
new file mode 100644
index 00000000000..76a67c4a2a0
--- /dev/null
+++ b/arch/arm/mach-mx5/board-mx53_ard.c
@@ -0,0 +1,254 @@
1/*
2 * Copyright (C) 2011 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 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 along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/init.h>
22#include <linux/clk.h>
23#include <linux/delay.h>
24#include <linux/gpio.h>
25#include <linux/smsc911x.h>
26
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/iomux-mx53.h>
30
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/time.h>
34
35#include "crm_regs.h"
36#include "devices-imx53.h"
37
38#define ARD_ETHERNET_INT_B IMX_GPIO_NR(2, 31)
39#define ARD_SD1_CD IMX_GPIO_NR(1, 1)
40#define ARD_SD1_WP IMX_GPIO_NR(1, 9)
41#define ARD_I2CPORTEXP_B IMX_GPIO_NR(2, 3)
42#define ARD_VOLUMEDOWN IMX_GPIO_NR(4, 0)
43#define ARD_HOME IMX_GPIO_NR(5, 10)
44#define ARD_BACK IMX_GPIO_NR(5, 11)
45#define ARD_PROG IMX_GPIO_NR(5, 12)
46#define ARD_VOLUMEUP IMX_GPIO_NR(5, 13)
47
48static iomux_v3_cfg_t mx53_ard_pads[] = {
49 /* UART1 */
50 MX53_PAD_PATA_DIOW__UART1_TXD_MUX,
51 MX53_PAD_PATA_DMACK__UART1_RXD_MUX,
52 /* WEIM for CS1 */
53 MX53_PAD_EIM_EB3__GPIO2_31, /* ETHERNET_INT_B */
54 MX53_PAD_EIM_D16__EMI_WEIM_D_16,
55 MX53_PAD_EIM_D17__EMI_WEIM_D_17,
56 MX53_PAD_EIM_D18__EMI_WEIM_D_18,
57 MX53_PAD_EIM_D19__EMI_WEIM_D_19,
58 MX53_PAD_EIM_D20__EMI_WEIM_D_20,
59 MX53_PAD_EIM_D21__EMI_WEIM_D_21,
60 MX53_PAD_EIM_D22__EMI_WEIM_D_22,
61 MX53_PAD_EIM_D23__EMI_WEIM_D_23,
62 MX53_PAD_EIM_D24__EMI_WEIM_D_24,
63 MX53_PAD_EIM_D25__EMI_WEIM_D_25,
64 MX53_PAD_EIM_D26__EMI_WEIM_D_26,
65 MX53_PAD_EIM_D27__EMI_WEIM_D_27,
66 MX53_PAD_EIM_D28__EMI_WEIM_D_28,
67 MX53_PAD_EIM_D29__EMI_WEIM_D_29,
68 MX53_PAD_EIM_D30__EMI_WEIM_D_30,
69 MX53_PAD_EIM_D31__EMI_WEIM_D_31,
70 MX53_PAD_EIM_DA0__EMI_NAND_WEIM_DA_0,
71 MX53_PAD_EIM_DA1__EMI_NAND_WEIM_DA_1,
72 MX53_PAD_EIM_DA2__EMI_NAND_WEIM_DA_2,
73 MX53_PAD_EIM_DA3__EMI_NAND_WEIM_DA_3,
74 MX53_PAD_EIM_DA4__EMI_NAND_WEIM_DA_4,
75 MX53_PAD_EIM_DA5__EMI_NAND_WEIM_DA_5,
76 MX53_PAD_EIM_DA6__EMI_NAND_WEIM_DA_6,
77 MX53_PAD_EIM_OE__EMI_WEIM_OE,
78 MX53_PAD_EIM_RW__EMI_WEIM_RW,
79 MX53_PAD_EIM_CS1__EMI_WEIM_CS_1,
80 /* SDHC1 */
81 MX53_PAD_SD1_CMD__ESDHC1_CMD,
82 MX53_PAD_SD1_CLK__ESDHC1_CLK,
83 MX53_PAD_SD1_DATA0__ESDHC1_DAT0,
84 MX53_PAD_SD1_DATA1__ESDHC1_DAT1,
85 MX53_PAD_SD1_DATA2__ESDHC1_DAT2,
86 MX53_PAD_SD1_DATA3__ESDHC1_DAT3,
87 MX53_PAD_PATA_DATA8__ESDHC1_DAT4,
88 MX53_PAD_PATA_DATA9__ESDHC1_DAT5,
89 MX53_PAD_PATA_DATA10__ESDHC1_DAT6,
90 MX53_PAD_PATA_DATA11__ESDHC1_DAT7,
91 MX53_PAD_GPIO_1__GPIO1_1,
92 MX53_PAD_GPIO_9__GPIO1_9,
93 /* I2C2 */
94 MX53_PAD_EIM_EB2__I2C2_SCL,
95 MX53_PAD_KEY_ROW3__I2C2_SDA,
96 /* I2C3 */
97 MX53_PAD_GPIO_3__I2C3_SCL,
98 MX53_PAD_GPIO_16__I2C3_SDA,
99 /* GPIO */
100 MX53_PAD_DISP0_DAT16__GPIO5_10, /* home */
101 MX53_PAD_DISP0_DAT17__GPIO5_11, /* back */
102 MX53_PAD_DISP0_DAT18__GPIO5_12, /* prog */
103 MX53_PAD_DISP0_DAT19__GPIO5_13, /* vol up */
104 MX53_PAD_GPIO_10__GPIO4_0, /* vol down */
105};
106
107#define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake) \
108{ \
109 .gpio = gpio_num, \
110 .type = EV_KEY, \
111 .code = ev_code, \
112 .active_low = act_low, \
113 .desc = "btn " descr, \
114 .wakeup = wake, \
115}
116
117static struct gpio_keys_button ard_buttons[] = {
118 GPIO_BUTTON(ARD_HOME, KEY_HOME, 1, "home", 0),
119 GPIO_BUTTON(ARD_BACK, KEY_BACK, 1, "back", 0),
120 GPIO_BUTTON(ARD_PROG, KEY_PROGRAM, 1, "program", 0),
121 GPIO_BUTTON(ARD_VOLUMEUP, KEY_VOLUMEUP, 1, "volume-up", 0),
122 GPIO_BUTTON(ARD_VOLUMEDOWN, KEY_VOLUMEDOWN, 1, "volume-down", 0),
123};
124
125static const struct gpio_keys_platform_data ard_button_data __initconst = {
126 .buttons = ard_buttons,
127 .nbuttons = ARRAY_SIZE(ard_buttons),
128};
129
130static struct resource ard_smsc911x_resources[] = {
131 {
132 .start = MX53_CS1_64MB_BASE_ADDR,
133 .end = MX53_CS1_64MB_BASE_ADDR + SZ_32M - 1,
134 .flags = IORESOURCE_MEM,
135 },
136 {
137 .start = gpio_to_irq(ARD_ETHERNET_INT_B),
138 .end = gpio_to_irq(ARD_ETHERNET_INT_B),
139 .flags = IORESOURCE_IRQ,
140 },
141};
142
143struct smsc911x_platform_config ard_smsc911x_config = {
144 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
145 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
146 .flags = SMSC911X_USE_32BIT,
147};
148
149static struct platform_device ard_smsc_lan9220_device = {
150 .name = "smsc911x",
151 .id = -1,
152 .num_resources = ARRAY_SIZE(ard_smsc911x_resources),
153 .resource = ard_smsc911x_resources,
154 .dev = {
155 .platform_data = &ard_smsc911x_config,
156 },
157};
158
159static const struct esdhc_platform_data mx53_ard_sd1_data __initconst = {
160 .cd_gpio = ARD_SD1_CD,
161 .wp_gpio = ARD_SD1_WP,
162};
163
164static struct imxi2c_platform_data mx53_ard_i2c2_data = {
165 .bitrate = 50000,
166};
167
168static struct imxi2c_platform_data mx53_ard_i2c3_data = {
169 .bitrate = 400000,
170};
171
172static void __init mx53_ard_io_init(void)
173{
174 mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads,
175 ARRAY_SIZE(mx53_ard_pads));
176
177 gpio_request(ARD_ETHERNET_INT_B, "eth-int-b");
178 gpio_direction_input(ARD_ETHERNET_INT_B);
179
180 gpio_request(ARD_I2CPORTEXP_B, "i2cptexp-rst");
181 gpio_direction_output(ARD_I2CPORTEXP_B, 1);
182}
183
184/* Config CS1 settings for ethernet controller */
185static int weim_cs_config(void)
186{
187 u32 reg;
188 void __iomem *weim_base, *iomuxc_base;
189
190 weim_base = ioremap(MX53_WEIM_BASE_ADDR, SZ_4K);
191 if (!weim_base)
192 return -ENOMEM;
193
194 iomuxc_base = ioremap(MX53_IOMUXC_BASE_ADDR, SZ_4K);
195 if (!iomuxc_base)
196 return -ENOMEM;
197
198 /* CS1 timings for LAN9220 */
199 writel(0x20001, (weim_base + 0x18));
200 writel(0x0, (weim_base + 0x1C));
201 writel(0x16000202, (weim_base + 0x20));
202 writel(0x00000002, (weim_base + 0x24));
203 writel(0x16002082, (weim_base + 0x28));
204 writel(0x00000000, (weim_base + 0x2C));
205 writel(0x00000000, (weim_base + 0x90));
206
207 /* specify 64 MB on CS1 and CS0 on GPR1 */
208 reg = readl(iomuxc_base + 0x4);
209 reg &= ~0x3F;
210 reg |= 0x1B;
211 writel(reg, (iomuxc_base + 0x4));
212
213 iounmap(iomuxc_base);
214 iounmap(weim_base);
215
216 return 0;
217}
218
219static struct platform_device *devices[] __initdata = {
220 &ard_smsc_lan9220_device,
221};
222
223static void __init mx53_ard_board_init(void)
224{
225 imx53_soc_init();
226 imx53_add_imx_uart(0, NULL);
227
228 mx53_ard_io_init();
229 weim_cs_config();
230 platform_add_devices(devices, ARRAY_SIZE(devices));
231
232 imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data);
233 imx53_add_imx2_wdt(0, NULL);
234 imx53_add_imx_i2c(1, &mx53_ard_i2c2_data);
235 imx53_add_imx_i2c(2, &mx53_ard_i2c3_data);
236 imx_add_gpio_keys(&ard_button_data);
237}
238
239static void __init mx53_ard_timer_init(void)
240{
241 mx53_clocks_init(32768, 24000000, 22579200, 0);
242}
243
244static struct sys_timer mx53_ard_timer = {
245 .init = mx53_ard_timer_init,
246};
247
248MACHINE_START(MX53_ARD, "Freescale MX53 ARD Board")
249 .map_io = mx53_map_io,
250 .init_early = imx53_init_early,
251 .init_irq = mx53_init_irq,
252 .timer = &mx53_ard_timer,
253 .init_machine = mx53_ard_board_init,
254MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
index 0d9218a6e2d..1b417b06b73 100644
--- a/arch/arm/mach-mx5/board-mx53_evk.c
+++ b/arch/arm/mach-mx5/board-mx53_evk.c
@@ -35,6 +35,7 @@
35#define MX53_EVK_FEC_PHY_RST IMX_GPIO_NR(7, 6) 35#define MX53_EVK_FEC_PHY_RST IMX_GPIO_NR(7, 6)
36#define EVK_ECSPI1_CS0 IMX_GPIO_NR(2, 30) 36#define EVK_ECSPI1_CS0 IMX_GPIO_NR(2, 30)
37#define EVK_ECSPI1_CS1 IMX_GPIO_NR(3, 19) 37#define EVK_ECSPI1_CS1 IMX_GPIO_NR(3, 19)
38#define MX53EVK_LED IMX_GPIO_NR(7, 7)
38 39
39#include "crm_regs.h" 40#include "crm_regs.h"
40#include "devices-imx53.h" 41#include "devices-imx53.h"
@@ -58,12 +59,27 @@ static iomux_v3_cfg_t mx53_evk_pads[] = {
58 /* ecspi chip select lines */ 59 /* ecspi chip select lines */
59 MX53_PAD_EIM_EB2__GPIO2_30, 60 MX53_PAD_EIM_EB2__GPIO2_30,
60 MX53_PAD_EIM_D19__GPIO3_19, 61 MX53_PAD_EIM_D19__GPIO3_19,
62 /* LED */
63 MX53_PAD_PATA_DA_1__GPIO7_7,
61}; 64};
62 65
63static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = { 66static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = {
64 .flags = IMXUART_HAVE_RTSCTS, 67 .flags = IMXUART_HAVE_RTSCTS,
65}; 68};
66 69
70static const struct gpio_led mx53evk_leds[] __initconst = {
71 {
72 .name = "green",
73 .default_trigger = "heartbeat",
74 .gpio = MX53EVK_LED,
75 },
76};
77
78static const struct gpio_led_platform_data mx53evk_leds_data __initconst = {
79 .leds = mx53evk_leds,
80 .num_leds = ARRAY_SIZE(mx53evk_leds),
81};
82
67static inline void mx53_evk_init_uart(void) 83static inline void mx53_evk_init_uart(void)
68{ 84{
69 imx53_add_imx_uart(0, NULL); 85 imx53_add_imx_uart(0, NULL);
@@ -135,6 +151,7 @@ static void __init mx53_evk_board_init(void)
135 ARRAY_SIZE(mx53_evk_spi_board_info)); 151 ARRAY_SIZE(mx53_evk_spi_board_info));
136 imx53_add_ecspi(0, &mx53_evk_spi_data); 152 imx53_add_ecspi(0, &mx53_evk_spi_data);
137 imx53_add_imx2_wdt(0, NULL); 153 imx53_add_imx2_wdt(0, NULL);
154 gpio_led_register_device(-1, &mx53evk_leds_data);
138} 155}
139 156
140static void __init mx53_evk_timer_init(void) 157static void __init mx53_evk_timer_init(void)
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
index 359c3e248ad..4e1d51d252d 100644
--- a/arch/arm/mach-mx5/board-mx53_loco.c
+++ b/arch/arm/mach-mx5/board-mx53_loco.c
@@ -38,6 +38,10 @@
38#define MX53_LOCO_UI1 IMX_GPIO_NR(2, 14) 38#define MX53_LOCO_UI1 IMX_GPIO_NR(2, 14)
39#define MX53_LOCO_UI2 IMX_GPIO_NR(2, 15) 39#define MX53_LOCO_UI2 IMX_GPIO_NR(2, 15)
40#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6) 40#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)
41#define LOCO_LED IMX_GPIO_NR(7, 7)
42#define LOCO_SD3_CD IMX_GPIO_NR(3, 11)
43#define LOCO_SD3_WP IMX_GPIO_NR(3, 12)
44#define LOCO_SD1_CD IMX_GPIO_NR(3, 13)
41 45
42static iomux_v3_cfg_t mx53_loco_pads[] = { 46static iomux_v3_cfg_t mx53_loco_pads[] = {
43 /* FEC */ 47 /* FEC */
@@ -70,6 +74,8 @@ static iomux_v3_cfg_t mx53_loco_pads[] = {
70 MX53_PAD_SD1_DATA1__ESDHC1_DAT1, 74 MX53_PAD_SD1_DATA1__ESDHC1_DAT1,
71 MX53_PAD_SD1_DATA2__ESDHC1_DAT2, 75 MX53_PAD_SD1_DATA2__ESDHC1_DAT2,
72 MX53_PAD_SD1_DATA3__ESDHC1_DAT3, 76 MX53_PAD_SD1_DATA3__ESDHC1_DAT3,
77 /* SD1_CD */
78 MX53_PAD_EIM_DA13__GPIO3_13,
73 /* SD3 */ 79 /* SD3 */
74 MX53_PAD_PATA_DATA8__ESDHC3_DAT0, 80 MX53_PAD_PATA_DATA8__ESDHC3_DAT0,
75 MX53_PAD_PATA_DATA9__ESDHC3_DAT1, 81 MX53_PAD_PATA_DATA9__ESDHC3_DAT1,
@@ -163,7 +169,7 @@ static iomux_v3_cfg_t mx53_loco_pads[] = {
163 MX53_PAD_GPIO_7__SPDIF_PLOCK, 169 MX53_PAD_GPIO_7__SPDIF_PLOCK,
164 MX53_PAD_GPIO_17__SPDIF_OUT1, 170 MX53_PAD_GPIO_17__SPDIF_OUT1,
165 /* GPIO */ 171 /* GPIO */
166 MX53_PAD_PATA_DA_1__GPIO7_7, 172 MX53_PAD_PATA_DA_1__GPIO7_7, /* LED */
167 MX53_PAD_PATA_DA_2__GPIO7_8, 173 MX53_PAD_PATA_DA_2__GPIO7_8,
168 MX53_PAD_PATA_DATA5__GPIO2_5, 174 MX53_PAD_PATA_DATA5__GPIO2_5,
169 MX53_PAD_PATA_DATA6__GPIO2_6, 175 MX53_PAD_PATA_DATA6__GPIO2_6,
@@ -202,6 +208,19 @@ static const struct gpio_keys_platform_data loco_button_data __initconst = {
202 .nbuttons = ARRAY_SIZE(loco_buttons), 208 .nbuttons = ARRAY_SIZE(loco_buttons),
203}; 209};
204 210
211static const struct esdhc_platform_data mx53_loco_sd1_data __initconst = {
212 .cd_gpio = LOCO_SD1_CD,
213 .cd_type = ESDHC_CD_GPIO,
214 .wp_type = ESDHC_WP_NONE,
215};
216
217static const struct esdhc_platform_data mx53_loco_sd3_data __initconst = {
218 .cd_gpio = LOCO_SD3_CD,
219 .wp_gpio = LOCO_SD3_WP,
220 .cd_type = ESDHC_CD_GPIO,
221 .wp_type = ESDHC_WP_GPIO,
222};
223
205static inline void mx53_loco_fec_reset(void) 224static inline void mx53_loco_fec_reset(void)
206{ 225{
207 int ret; 226 int ret;
@@ -225,6 +244,19 @@ static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst = {
225 .bitrate = 100000, 244 .bitrate = 100000,
226}; 245};
227 246
247static const struct gpio_led mx53loco_leds[] __initconst = {
248 {
249 .name = "green",
250 .default_trigger = "heartbeat",
251 .gpio = LOCO_LED,
252 },
253};
254
255static const struct gpio_led_platform_data mx53loco_leds_data __initconst = {
256 .leds = mx53loco_leds,
257 .num_leds = ARRAY_SIZE(mx53loco_leds),
258};
259
228static void __init mx53_loco_board_init(void) 260static void __init mx53_loco_board_init(void)
229{ 261{
230 imx53_soc_init(); 262 imx53_soc_init();
@@ -237,9 +269,10 @@ static void __init mx53_loco_board_init(void)
237 imx53_add_imx2_wdt(0, NULL); 269 imx53_add_imx2_wdt(0, NULL);
238 imx53_add_imx_i2c(0, &mx53_loco_i2c_data); 270 imx53_add_imx_i2c(0, &mx53_loco_i2c_data);
239 imx53_add_imx_i2c(1, &mx53_loco_i2c_data); 271 imx53_add_imx_i2c(1, &mx53_loco_i2c_data);
240 imx53_add_sdhci_esdhc_imx(0, NULL); 272 imx53_add_sdhci_esdhc_imx(0, &mx53_loco_sd1_data);
241 imx53_add_sdhci_esdhc_imx(2, NULL); 273 imx53_add_sdhci_esdhc_imx(2, &mx53_loco_sd3_data);
242 imx_add_gpio_keys(&loco_button_data); 274 imx_add_gpio_keys(&loco_button_data);
275 gpio_led_register_device(-1, &mx53loco_leds_data);
243} 276}
244 277
245static void __init mx53_loco_timer_init(void) 278static void __init mx53_loco_timer_init(void)
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 0adeea17d12..f7bf996f463 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -271,7 +271,11 @@ static int _clk_pll_enable(struct clk *clk)
271 int i = 0; 271 int i = 0;
272 272
273 pllbase = _get_pll_base(clk); 273 pllbase = _get_pll_base(clk);
274 reg = __raw_readl(pllbase + MXC_PLL_DP_CTL) | MXC_PLL_DP_CTL_UPEN; 274 reg = __raw_readl(pllbase + MXC_PLL_DP_CTL);
275 if (reg & MXC_PLL_DP_CTL_UPEN)
276 return 0;
277
278 reg |= MXC_PLL_DP_CTL_UPEN;
275 __raw_writel(reg, pllbase + MXC_PLL_DP_CTL); 279 __raw_writel(reg, pllbase + MXC_PLL_DP_CTL);
276 280
277 /* Wait for lock */ 281 /* Wait for lock */
@@ -1254,12 +1258,20 @@ DEFINE_CLOCK(uart2_ipg_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG5_OFFSET,
1254 NULL, NULL, &ipg_clk, &aips_tz1_clk); 1258 NULL, NULL, &ipg_clk, &aips_tz1_clk);
1255DEFINE_CLOCK(uart3_ipg_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG7_OFFSET, 1259DEFINE_CLOCK(uart3_ipg_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG7_OFFSET,
1256 NULL, NULL, &ipg_clk, &spba_clk); 1260 NULL, NULL, &ipg_clk, &spba_clk);
1261DEFINE_CLOCK(uart4_ipg_clk, 3, MXC_CCM_CCGR7, MXC_CCM_CCGRx_CG4_OFFSET,
1262 NULL, NULL, &ipg_clk, &spba_clk);
1263DEFINE_CLOCK(uart5_ipg_clk, 4, MXC_CCM_CCGR7, MXC_CCM_CCGRx_CG6_OFFSET,
1264 NULL, NULL, &ipg_clk, &spba_clk);
1257DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG4_OFFSET, 1265DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG4_OFFSET,
1258 NULL, NULL, &uart_root_clk, &uart1_ipg_clk); 1266 NULL, NULL, &uart_root_clk, &uart1_ipg_clk);
1259DEFINE_CLOCK(uart2_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG6_OFFSET, 1267DEFINE_CLOCK(uart2_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG6_OFFSET,
1260 NULL, NULL, &uart_root_clk, &uart2_ipg_clk); 1268 NULL, NULL, &uart_root_clk, &uart2_ipg_clk);
1261DEFINE_CLOCK(uart3_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG8_OFFSET, 1269DEFINE_CLOCK(uart3_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG8_OFFSET,
1262 NULL, NULL, &uart_root_clk, &uart3_ipg_clk); 1270 NULL, NULL, &uart_root_clk, &uart3_ipg_clk);
1271DEFINE_CLOCK(uart4_clk, 3, MXC_CCM_CCGR7, MXC_CCM_CCGRx_CG5_OFFSET,
1272 NULL, NULL, &uart_root_clk, &uart4_ipg_clk);
1273DEFINE_CLOCK(uart5_clk, 4, MXC_CCM_CCGR7, MXC_CCM_CCGRx_CG7_OFFSET,
1274 NULL, NULL, &uart_root_clk, &uart5_ipg_clk);
1263 1275
1264/* GPT */ 1276/* GPT */
1265DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET, 1277DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET,
@@ -1279,6 +1291,8 @@ DEFINE_CLOCK(i2c2_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG10_OFFSET,
1279 NULL, NULL, &ipg_perclk, NULL); 1291 NULL, NULL, &ipg_perclk, NULL);
1280DEFINE_CLOCK(hsi2c_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG11_OFFSET, 1292DEFINE_CLOCK(hsi2c_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG11_OFFSET,
1281 NULL, NULL, &ipg_clk, NULL); 1293 NULL, NULL, &ipg_clk, NULL);
1294DEFINE_CLOCK(i2c3_mx53_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG11_OFFSET,
1295 NULL, NULL, &ipg_perclk, NULL);
1282 1296
1283/* FEC */ 1297/* FEC */
1284DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET, 1298DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET,
@@ -1412,11 +1426,13 @@ DEFINE_CLOCK(ipu_di1_clk, 0, MXC_CCM_CCGR6, MXC_CCM_CCGRx_CG6_OFFSET,
1412 }, 1426 },
1413 1427
1414static struct clk_lookup mx51_lookups[] = { 1428static struct clk_lookup mx51_lookups[] = {
1415 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 1429 /* i.mx51 has the i.mx21 type uart */
1416 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 1430 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
1417 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 1431 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
1432 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
1418 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 1433 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
1419 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 1434 /* i.mx51 has the i.mx27 type fec */
1435 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
1420 _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk) 1436 _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
1421 _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk) 1437 _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
1422 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 1438 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
@@ -1436,7 +1452,8 @@ static struct clk_lookup mx51_lookups[] = {
1436 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 1452 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
1437 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 1453 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
1438 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk) 1454 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
1439 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 1455 /* i.mx51 has the i.mx35 type sdma */
1456 _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
1440 _REGISTER_CLOCK(NULL, "ckih", ckih_clk) 1457 _REGISTER_CLOCK(NULL, "ckih", ckih_clk)
1441 _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk) 1458 _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk)
1442 _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk) 1459 _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk)
@@ -1444,10 +1461,10 @@ static struct clk_lookup mx51_lookups[] = {
1444 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) 1461 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk)
1445 /* i.mx51 has the i.mx35 type cspi */ 1462 /* i.mx51 has the i.mx35 type cspi */
1446 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk) 1463 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk)
1447 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1464 _REGISTER_CLOCK("sdhci-esdhc-imx51.0", NULL, esdhc1_clk)
1448 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 1465 _REGISTER_CLOCK("sdhci-esdhc-imx51.1", NULL, esdhc2_clk)
1449 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk) 1466 _REGISTER_CLOCK("sdhci-esdhc-imx51.2", NULL, esdhc3_clk)
1450 _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_clk) 1467 _REGISTER_CLOCK("sdhci-esdhc-imx51.3", NULL, esdhc4_clk)
1451 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk) 1468 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk)
1452 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1469 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
1453 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) 1470 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
@@ -1460,25 +1477,36 @@ static struct clk_lookup mx51_lookups[] = {
1460}; 1477};
1461 1478
1462static struct clk_lookup mx53_lookups[] = { 1479static struct clk_lookup mx53_lookups[] = {
1463 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 1480 /* i.mx53 has the i.mx21 type uart */
1464 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 1481 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
1465 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 1482 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
1483 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
1484 _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk)
1485 _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk)
1466 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 1486 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
1467 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 1487 /* i.mx53 has the i.mx25 type fec */
1488 _REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
1468 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1489 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
1469 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 1490 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
1470 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 1491 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
1471 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1492 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_mx53_clk)
1472 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_mx53_clk)
1473 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_mx53_clk)
1474 _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_mx53_clk)
1475 /* i.mx53 has the i.mx51 type ecspi */ 1493 /* i.mx53 has the i.mx51 type ecspi */
1476 _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk) 1494 _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk)
1477 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) 1495 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk)
1478 /* i.mx53 has the i.mx25 type cspi */ 1496 /* i.mx53 has the i.mx25 type cspi */
1479 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk) 1497 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk)
1498 _REGISTER_CLOCK("sdhci-esdhc-imx53.0", NULL, esdhc1_clk)
1499 _REGISTER_CLOCK("sdhci-esdhc-imx53.1", NULL, esdhc2_mx53_clk)
1500 _REGISTER_CLOCK("sdhci-esdhc-imx53.2", NULL, esdhc3_mx53_clk)
1501 _REGISTER_CLOCK("sdhci-esdhc-imx53.3", NULL, esdhc4_mx53_clk)
1480 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) 1502 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
1481 _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk) 1503 _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
1504 /* i.mx53 has the i.mx35 type sdma */
1505 _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
1506 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
1507 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
1508 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
1509 _REGISTER_CLOCK("imx-keypad", NULL, dummy_clk)
1482}; 1510};
1483 1511
1484static void clk_tree_init(void) 1512static void clk_tree_init(void)
diff --git a/arch/arm/mach-mx5/crm_regs.h b/arch/arm/mach-mx5/crm_regs.h
index 87c0c58f27a..5e11ba7daee 100644
--- a/arch/arm/mach-mx5/crm_regs.h
+++ b/arch/arm/mach-mx5/crm_regs.h
@@ -114,6 +114,8 @@
114#define MXC_CCM_CCGR4 (MX51_CCM_BASE + 0x78) 114#define MXC_CCM_CCGR4 (MX51_CCM_BASE + 0x78)
115#define MXC_CCM_CCGR5 (MX51_CCM_BASE + 0x7C) 115#define MXC_CCM_CCGR5 (MX51_CCM_BASE + 0x7C)
116#define MXC_CCM_CCGR6 (MX51_CCM_BASE + 0x80) 116#define MXC_CCM_CCGR6 (MX51_CCM_BASE + 0x80)
117#define MXC_CCM_CCGR7 (MX51_CCM_BASE + 0x84)
118
117#define MXC_CCM_CMEOR (MX51_CCM_BASE + 0x84) 119#define MXC_CCM_CMEOR (MX51_CCM_BASE + 0x84)
118 120
119/* Define the bits in register CCR */ 121/* Define the bits in register CCR */
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index 48f4c8cc42f..c27fe8bb476 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -32,3 +32,11 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[];
32extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[]; 32extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[];
33#define imx53_add_imx2_wdt(id, pdata) \ 33#define imx53_add_imx2_wdt(id, pdata) \
34 imx_add_imx2_wdt(&imx53_imx2_wdt_data[id]) 34 imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
35
36extern const struct imx_imx_ssi_data imx53_imx_ssi_data[];
37#define imx53_add_imx_ssi(id, pdata) \
38 imx_add_imx_ssi(&imx53_imx_ssi_data[id], pdata)
39
40extern const struct imx_imx_keypad_data imx53_imx_keypad_data;
41#define imx53_add_imx_keypad(pdata) \
42 imx_add_imx_keypad(&imx53_imx_keypad_data, pdata)
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
index 665843d6c2b..baea6e5cddd 100644
--- a/arch/arm/mach-mx5/mm.c
+++ b/arch/arm/mach-mx5/mm.c
@@ -18,6 +18,7 @@
18 18
19#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <mach/common.h> 20#include <mach/common.h>
21#include <mach/devices-common.h>
21#include <mach/iomux-v3.h> 22#include <mach/iomux-v3.h>
22 23
23/* 24/*
@@ -100,6 +101,43 @@ void __init mx53_init_irq(void)
100 tzic_init_irq(tzic_virt); 101 tzic_init_irq(tzic_virt);
101} 102}
102 103
104static struct sdma_script_start_addrs imx51_sdma_script __initdata = {
105 .ap_2_ap_addr = 642,
106 .uart_2_mcu_addr = 817,
107 .mcu_2_app_addr = 747,
108 .mcu_2_shp_addr = 961,
109 .ata_2_mcu_addr = 1473,
110 .mcu_2_ata_addr = 1392,
111 .app_2_per_addr = 1033,
112 .app_2_mcu_addr = 683,
113 .shp_2_per_addr = 1251,
114 .shp_2_mcu_addr = 892,
115};
116
117static struct sdma_platform_data imx51_sdma_pdata __initdata = {
118 .fw_name = "sdma-imx51.bin",
119 .script_addrs = &imx51_sdma_script,
120};
121
122static struct sdma_script_start_addrs imx53_sdma_script __initdata = {
123 .ap_2_ap_addr = 642,
124 .app_2_mcu_addr = 683,
125 .mcu_2_app_addr = 747,
126 .uart_2_mcu_addr = 817,
127 .shp_2_mcu_addr = 891,
128 .mcu_2_shp_addr = 960,
129 .uartsh_2_mcu_addr = 1032,
130 .spdif_2_mcu_addr = 1100,
131 .mcu_2_spdif_addr = 1134,
132 .firi_2_mcu_addr = 1193,
133 .mcu_2_firi_addr = 1290,
134};
135
136static struct sdma_platform_data imx53_sdma_pdata __initdata = {
137 .fw_name = "sdma-imx53.bin",
138 .script_addrs = &imx53_sdma_script,
139};
140
103void __init imx51_soc_init(void) 141void __init imx51_soc_init(void)
104{ 142{
105 /* i.mx51 has the i.mx31 type gpio */ 143 /* i.mx51 has the i.mx31 type gpio */
@@ -107,6 +145,9 @@ void __init imx51_soc_init(void)
107 mxc_register_gpio("imx31-gpio", 1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO2_LOW, MX51_MXC_INT_GPIO2_HIGH); 145 mxc_register_gpio("imx31-gpio", 1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO2_LOW, MX51_MXC_INT_GPIO2_HIGH);
108 mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH); 146 mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH);
109 mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH); 147 mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH);
148
149 /* i.mx51 has the i.mx35 type sdma */
150 imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
110} 151}
111 152
112void __init imx53_soc_init(void) 153void __init imx53_soc_init(void)
@@ -119,4 +160,7 @@ void __init imx53_soc_init(void)
119 mxc_register_gpio("imx31-gpio", 4, MX53_GPIO5_BASE_ADDR, SZ_16K, MX53_INT_GPIO5_LOW, MX53_INT_GPIO5_HIGH); 160 mxc_register_gpio("imx31-gpio", 4, MX53_GPIO5_BASE_ADDR, SZ_16K, MX53_INT_GPIO5_LOW, MX53_INT_GPIO5_HIGH);
120 mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH); 161 mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH);
121 mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH); 162 mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH);
163
164 /* i.mx53 has the i.mx35 type sdma */
165 imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
122} 166}
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
index 56739c23aca..c9209454807 100644
--- a/arch/arm/mach-mx5/mx51_efika.c
+++ b/arch/arm/mach-mx5/mx51_efika.c
@@ -186,7 +186,7 @@ static int initialize_usbh1_port(struct platform_device *pdev)
186 186
187 mdelay(10); 187 mdelay(10);
188 188
189 return mx51_initialize_usb_hw(0, MXC_EHCI_ITC_NO_THRESHOLD); 189 return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_ITC_NO_THRESHOLD);
190} 190}
191 191
192static struct mxc_usbh_platform_data usbh1_config = { 192static struct mxc_usbh_platform_data usbh1_config = {
@@ -260,8 +260,8 @@ static struct regulator_consumer_supply vvideo_consumers[] = {
260}; 260};
261 261
262static struct regulator_consumer_supply vsd_consumers[] = { 262static struct regulator_consumer_supply vsd_consumers[] = {
263 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.0"), 263 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.0"),
264 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.1"), 264 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.1"),
265}; 265};
266 266
267static struct regulator_consumer_supply pwgt1_consumer[] = { 267static struct regulator_consumer_supply pwgt1_consumer[] = {
diff --git a/arch/arm/mach-mx5/pm-imx5.c b/arch/arm/mach-mx5/pm-imx5.c
new file mode 100644
index 00000000000..e4529af0da7
--- /dev/null
+++ b/arch/arm/mach-mx5/pm-imx5.c
@@ -0,0 +1,73 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11#include <linux/suspend.h>
12#include <linux/clk.h>
13#include <linux/io.h>
14#include <linux/err.h>
15#include <asm/cacheflush.h>
16#include <asm/tlbflush.h>
17#include <mach/system.h>
18#include "crm_regs.h"
19
20static struct clk *gpc_dvfs_clk;
21
22static int mx5_suspend_enter(suspend_state_t state)
23{
24 clk_enable(gpc_dvfs_clk);
25 switch (state) {
26 case PM_SUSPEND_MEM:
27 mx5_cpu_lp_set(STOP_POWER_OFF);
28 break;
29 case PM_SUSPEND_STANDBY:
30 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF);
31 break;
32 default:
33 return -EINVAL;
34 }
35
36 if (state == PM_SUSPEND_MEM) {
37 local_flush_tlb_all();
38 flush_cache_all();
39
40 /*clear the EMPGC0/1 bits */
41 __raw_writel(0, MXC_SRPG_EMPGC0_SRPGCR);
42 __raw_writel(0, MXC_SRPG_EMPGC1_SRPGCR);
43 }
44 cpu_do_idle();
45 clk_disable(gpc_dvfs_clk);
46
47 return 0;
48}
49
50static int mx5_pm_valid(suspend_state_t state)
51{
52 return (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX);
53}
54
55static const struct platform_suspend_ops mx5_suspend_ops = {
56 .valid = mx5_pm_valid,
57 .enter = mx5_suspend_enter,
58};
59
60static int __init mx5_pm_init(void)
61{
62 if (gpc_dvfs_clk == NULL)
63 gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs");
64
65 if (!IS_ERR(gpc_dvfs_clk)) {
66 if (cpu_is_mx51())
67 suspend_set_ops(&mx5_suspend_ops);
68 } else
69 return -EPERM;
70
71 return 0;
72}
73device_initcall(mx5_pm_init);
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 162b0b0bc35..4cd0231ee53 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -41,6 +41,7 @@ config MACH_MX23EVK
41config MACH_MX28EVK 41config MACH_MX28EVK
42 bool "Support MX28EVK Platform" 42 bool "Support MX28EVK Platform"
43 select SOC_IMX28 43 select SOC_IMX28
44 select LEDS_GPIO_REGISTER
44 select MXS_HAVE_AMBA_DUART 45 select MXS_HAVE_AMBA_DUART
45 select MXS_HAVE_PLATFORM_AUART 46 select MXS_HAVE_PLATFORM_AUART
46 select MXS_HAVE_PLATFORM_FEC 47 select MXS_HAVE_PLATFORM_FEC
@@ -60,6 +61,7 @@ config MODULE_TX28
60 select MXS_HAVE_PLATFORM_AUART 61 select MXS_HAVE_PLATFORM_AUART
61 select MXS_HAVE_PLATFORM_FEC 62 select MXS_HAVE_PLATFORM_FEC
62 select MXS_HAVE_PLATFORM_MXS_I2C 63 select MXS_HAVE_PLATFORM_MXS_I2C
64 select MXS_HAVE_PLATFORM_MXS_MMC
63 select MXS_HAVE_PLATFORM_MXS_PWM 65 select MXS_HAVE_PLATFORM_MXS_PWM
64 66
65config MACH_TX28 67config MACH_TX28
diff --git a/arch/arm/mach-mxs/include/mach/clkdev.h b/arch/arm/mach-mxs/include/mach/clkdev.h
deleted file mode 100644
index 3a8f2e3a630..00000000000
--- a/arch/arm/mach-mxs/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __MACH_MXS_CLKDEV_H__
2#define __MACH_MXS_CLKDEV_H__
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index 56767a5cce0..eaaf6ff2899 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -15,6 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/leds.h>
18#include <linux/irq.h> 19#include <linux/irq.h>
19#include <linux/clk.h> 20#include <linux/clk.h>
20 21
@@ -29,6 +30,7 @@
29 30
30#define MX28EVK_FLEXCAN_SWITCH MXS_GPIO_NR(2, 13) 31#define MX28EVK_FLEXCAN_SWITCH MXS_GPIO_NR(2, 13)
31#define MX28EVK_FEC_PHY_POWER MXS_GPIO_NR(2, 15) 32#define MX28EVK_FEC_PHY_POWER MXS_GPIO_NR(2, 15)
33#define MX28EVK_GPIO_LED MXS_GPIO_NR(3, 5)
32#define MX28EVK_BL_ENABLE MXS_GPIO_NR(3, 18) 34#define MX28EVK_BL_ENABLE MXS_GPIO_NR(3, 18)
33#define MX28EVK_LCD_ENABLE MXS_GPIO_NR(3, 30) 35#define MX28EVK_LCD_ENABLE MXS_GPIO_NR(3, 30)
34#define MX28EVK_FEC_PHY_RESET MXS_GPIO_NR(4, 13) 36#define MX28EVK_FEC_PHY_RESET MXS_GPIO_NR(4, 13)
@@ -178,6 +180,23 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = {
178 /* slot power enable */ 180 /* slot power enable */
179 MX28_PAD_PWM4__GPIO_3_29 | 181 MX28_PAD_PWM4__GPIO_3_29 |
180 (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 182 (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
183
184 /* led */
185 MX28_PAD_AUART1_TX__GPIO_3_5 | MXS_PAD_CTRL,
186};
187
188/* led */
189static const struct gpio_led mx28evk_leds[] __initconst = {
190 {
191 .name = "GPIO-LED",
192 .default_trigger = "heartbeat",
193 .gpio = MX28EVK_GPIO_LED,
194 },
195};
196
197static const struct gpio_led_platform_data mx28evk_led_data __initconst = {
198 .leds = mx28evk_leds,
199 .num_leds = ARRAY_SIZE(mx28evk_leds),
181}; 200};
182 201
183/* fec */ 202/* fec */
@@ -385,6 +404,8 @@ static void __init mx28evk_init(void)
385 if (ret) 404 if (ret)
386 pr_warn("failed to request gpio mmc1-slot-power: %d\n", ret); 405 pr_warn("failed to request gpio mmc1-slot-power: %d\n", ret);
387 mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]); 406 mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]);
407
408 gpio_led_register_device(0, &mx28evk_led_data);
388} 409}
389 410
390static void __init mx28evk_timer_init(void) 411static void __init mx28evk_timer_init(void)
diff --git a/arch/arm/mach-mxs/mach-tx28.c b/arch/arm/mach-mxs/mach-tx28.c
index 6766a12cca7..515a423f82c 100644
--- a/arch/arm/mach-mxs/mach-tx28.c
+++ b/arch/arm/mach-mxs/mach-tx28.c
@@ -139,6 +139,11 @@ static struct i2c_board_info tx28_stk5v3_i2c_boardinfo[] __initdata = {
139 }, 139 },
140}; 140};
141 141
142static struct mxs_mmc_platform_data tx28_mmc0_pdata __initdata = {
143 .wp_gpio = -EINVAL,
144 .flags = SLOTF_4_BIT_CAPABLE,
145};
146
142static void __init tx28_stk5v3_init(void) 147static void __init tx28_stk5v3_init(void)
143{ 148{
144 mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads, 149 mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads,
@@ -155,6 +160,7 @@ static void __init tx28_stk5v3_init(void)
155 mx28_add_mxs_i2c(0); 160 mx28_add_mxs_i2c(0);
156 i2c_register_board_info(0, tx28_stk5v3_i2c_boardinfo, 161 i2c_register_board_info(0, tx28_stk5v3_i2c_boardinfo,
157 ARRAY_SIZE(tx28_stk5v3_i2c_boardinfo)); 162 ARRAY_SIZE(tx28_stk5v3_i2c_boardinfo));
163 mx28_add_mxs_mmc(0, &tx28_mmc0_pdata);
158} 164}
159 165
160static void __init tx28_timer_init(void) 166static void __init tx28_timer_init(void)
diff --git a/arch/arm/mach-nomadik/include/mach/clkdev.h b/arch/arm/mach-nomadik/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/mach-nomadik/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-nuc93x/include/mach/clkdev.h b/arch/arm/mach-nuc93x/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/mach-nuc93x/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-omap1/include/mach/clkdev.h b/arch/arm/mach-omap1/include/mach/clkdev.h
deleted file mode 100644
index ea8640e4603..00000000000
--- a/arch/arm/mach-omap1/include/mach/clkdev.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * arch/arm/mach-omap1/include/mach/clkdev.h
3 */
4
5#include <plat/clkdev.h>
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 98ba9784aa1..495b3987d46 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -44,7 +44,7 @@
44#include <linux/io.h> 44#include <linux/io.h>
45 45
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/atomic.h> 47#include <linux/atomic.h>
48#include <asm/mach/time.h> 48#include <asm/mach/time.h>
49#include <asm/mach/irq.h> 49#include <asm/mach/irq.h>
50 50
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 19d5891c48e..57b66d590c5 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -7,7 +7,6 @@ config ARCH_OMAP2PLUS_TYPICAL
7 default y 7 default y
8 select AEABI 8 select AEABI
9 select REGULATOR 9 select REGULATOR
10 select PM
11 select PM_RUNTIME 10 select PM_RUNTIME
12 select VFP 11 select VFP
13 select NEON if ARCH_OMAP3 || ARCH_OMAP4 12 select NEON if ARCH_OMAP3 || ARCH_OMAP4
@@ -266,9 +265,10 @@ config MACH_OMAP_ZOOM3
266 select REGULATOR_FIXED_VOLTAGE 265 select REGULATOR_FIXED_VOLTAGE
267 266
268config MACH_CM_T35 267config MACH_CM_T35
269 bool "CompuLab CM-T35 module" 268 bool "CompuLab CM-T35/CM-T3730 modules"
270 depends on ARCH_OMAP3 269 depends on ARCH_OMAP3
271 default y 270 default y
271 select MACH_CM_T3730
272 select OMAP_PACKAGE_CUS 272 select OMAP_PACKAGE_CUS
273 273
274config MACH_CM_T3517 274config MACH_CM_T3517
@@ -277,6 +277,9 @@ config MACH_CM_T3517
277 default y 277 default y
278 select OMAP_PACKAGE_CBB 278 select OMAP_PACKAGE_CBB
279 279
280config MACH_CM_T3730
281 bool
282
280config MACH_IGEP0020 283config MACH_IGEP0020
281 bool "IGEP v2 board" 284 bool "IGEP v2 board"
282 depends on ARCH_OMAP3 285 depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 933b25bb10d..c7cef44c75d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -22,6 +22,7 @@
22#include <linux/i2c/twl.h> 22#include <linux/i2c/twl.h>
23#include <linux/gpio_keys.h> 23#include <linux/gpio_keys.h>
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/regulator/fixed.h>
25#include <linux/leds.h> 26#include <linux/leds.h>
26#include <linux/leds_pwm.h> 27#include <linux/leds_pwm.h>
27 28
@@ -37,6 +38,7 @@
37#include <plat/mmc.h> 38#include <plat/mmc.h>
38#include <plat/omap4-keypad.h> 39#include <plat/omap4-keypad.h>
39#include <video/omapdss.h> 40#include <video/omapdss.h>
41#include <linux/wl12xx.h>
40 42
41#include "mux.h" 43#include "mux.h"
42#include "hsmmc.h" 44#include "hsmmc.h"
@@ -51,6 +53,9 @@
51#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */ 53#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
52#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ 54#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
53 55
56#define GPIO_WIFI_PMENA 54
57#define GPIO_WIFI_IRQ 53
58
54static const int sdp4430_keymap[] = { 59static const int sdp4430_keymap[] = {
55 KEY(0, 0, KEY_E), 60 KEY(0, 0, KEY_E),
56 KEY(0, 1, KEY_R), 61 KEY(0, 1, KEY_R),
@@ -124,6 +129,64 @@ static const int sdp4430_keymap[] = {
124 KEY(7, 6, KEY_OK), 129 KEY(7, 6, KEY_OK),
125 KEY(7, 7, KEY_DOWN), 130 KEY(7, 7, KEY_DOWN),
126}; 131};
132static struct omap_device_pad keypad_pads[] __initdata = {
133 { .name = "kpd_col1.kpd_col1",
134 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
135 },
136 { .name = "kpd_col1.kpd_col1",
137 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
138 },
139 { .name = "kpd_col2.kpd_col2",
140 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
141 },
142 { .name = "kpd_col3.kpd_col3",
143 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
144 },
145 { .name = "kpd_col4.kpd_col4",
146 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
147 },
148 { .name = "kpd_col5.kpd_col5",
149 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
150 },
151 { .name = "gpmc_a23.kpd_col7",
152 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
153 },
154 { .name = "gpmc_a22.kpd_col6",
155 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
156 },
157 { .name = "kpd_row0.kpd_row0",
158 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
159 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
160 },
161 { .name = "kpd_row1.kpd_row1",
162 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
163 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
164 },
165 { .name = "kpd_row2.kpd_row2",
166 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
167 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
168 },
169 { .name = "kpd_row3.kpd_row3",
170 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
171 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
172 },
173 { .name = "kpd_row4.kpd_row4",
174 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
175 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
176 },
177 { .name = "kpd_row5.kpd_row5",
178 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
179 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
180 },
181 { .name = "gpmc_a18.kpd_row6",
182 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
183 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
184 },
185 { .name = "gpmc_a19.kpd_row7",
186 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
187 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
188 },
189};
127 190
128static struct matrix_keymap_data sdp4430_keymap_data = { 191static struct matrix_keymap_data sdp4430_keymap_data = {
129 .keymap = sdp4430_keymap, 192 .keymap = sdp4430_keymap,
@@ -135,6 +198,13 @@ static struct omap4_keypad_platform_data sdp4430_keypad_data = {
135 .rows = 8, 198 .rows = 8,
136 .cols = 8, 199 .cols = 8,
137}; 200};
201
202static struct omap_board_data keypad_data = {
203 .id = 1,
204 .pads = keypad_pads,
205 .pads_cnt = ARRAY_SIZE(keypad_pads),
206};
207
138static struct gpio_led sdp4430_gpio_leds[] = { 208static struct gpio_led sdp4430_gpio_leds[] = {
139 { 209 {
140 .name = "omap4:green:debug0", 210 .name = "omap4:green:debug0",
@@ -275,11 +345,40 @@ static struct platform_device sdp4430_lcd_device = {
275 .id = -1, 345 .id = -1,
276}; 346};
277 347
348static struct regulator_consumer_supply sdp4430_vbat_supply[] = {
349 REGULATOR_SUPPLY("vddvibl", "twl6040-vibra"),
350 REGULATOR_SUPPLY("vddvibr", "twl6040-vibra"),
351};
352
353static struct regulator_init_data sdp4430_vbat_data = {
354 .constraints = {
355 .always_on = 1,
356 },
357 .num_consumer_supplies = ARRAY_SIZE(sdp4430_vbat_supply),
358 .consumer_supplies = sdp4430_vbat_supply,
359};
360
361static struct fixed_voltage_config sdp4430_vbat_pdata = {
362 .supply_name = "VBAT",
363 .microvolts = 3750000,
364 .init_data = &sdp4430_vbat_data,
365 .gpio = -EINVAL,
366};
367
368static struct platform_device sdp4430_vbat = {
369 .name = "reg-fixed-voltage",
370 .id = -1,
371 .dev = {
372 .platform_data = &sdp4430_vbat_pdata,
373 },
374};
375
278static struct platform_device *sdp4430_devices[] __initdata = { 376static struct platform_device *sdp4430_devices[] __initdata = {
279 &sdp4430_lcd_device, 377 &sdp4430_lcd_device,
280 &sdp4430_gpio_keys_device, 378 &sdp4430_gpio_keys_device,
281 &sdp4430_leds_gpio, 379 &sdp4430_leds_gpio,
282 &sdp4430_leds_pwm, 380 &sdp4430_leds_pwm,
381 &sdp4430_vbat,
283}; 382};
284 383
285static struct omap_lcd_config sdp4430_lcd_config __initdata = { 384static struct omap_lcd_config sdp4430_lcd_config __initdata = {
@@ -315,7 +414,16 @@ static struct omap2_hsmmc_info mmc[] = {
315 { 414 {
316 .mmc = 1, 415 .mmc = 1,
317 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 416 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
417 .gpio_cd = -EINVAL,
418 .gpio_wp = -EINVAL,
419 },
420 {
421 .mmc = 5,
422 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
423 .gpio_cd = -EINVAL,
318 .gpio_wp = -EINVAL, 424 .gpio_wp = -EINVAL,
425 .ocr_mask = MMC_VDD_165_195,
426 .nonremovable = true,
319 }, 427 },
320 {} /* Terminator */ 428 {} /* Terminator */
321}; 429};
@@ -324,6 +432,37 @@ static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
324 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), 432 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
325}; 433};
326 434
435static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = {
436 .supply = "vmmc",
437 .dev_name = "omap_hsmmc.4",
438};
439
440static struct regulator_init_data sdp4430_vmmc5 = {
441 .constraints = {
442 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
443 },
444 .num_consumer_supplies = 1,
445 .consumer_supplies = &omap4_sdp4430_vmmc5_supply,
446};
447
448static struct fixed_voltage_config sdp4430_vwlan = {
449 .supply_name = "vwl1271",
450 .microvolts = 1800000, /* 1.8V */
451 .gpio = GPIO_WIFI_PMENA,
452 .startup_delay = 70000, /* 70msec */
453 .enable_high = 1,
454 .enabled_at_boot = 0,
455 .init_data = &sdp4430_vmmc5,
456};
457
458static struct platform_device omap_vwlan_device = {
459 .name = "reg-fixed-voltage",
460 .id = 1,
461 .dev = {
462 .platform_data = &sdp4430_vwlan,
463 },
464};
465
327static int omap4_twl6030_hsmmc_late_init(struct device *dev) 466static int omap4_twl6030_hsmmc_late_init(struct device *dev)
328{ 467{
329 int ret = 0; 468 int ret = 0;
@@ -395,7 +534,33 @@ static struct regulator_init_data sdp4430_vusim = {
395 }, 534 },
396}; 535};
397 536
537static struct twl4030_codec_data twl6040_codec = {
538 /* single-step ramp for headset and handsfree */
539 .hs_left_step = 0x0f,
540 .hs_right_step = 0x0f,
541 .hf_left_step = 0x1d,
542 .hf_right_step = 0x1d,
543};
544
545static struct twl4030_vibra_data twl6040_vibra = {
546 .vibldrv_res = 8,
547 .vibrdrv_res = 3,
548 .viblmotor_res = 10,
549 .vibrmotor_res = 10,
550 .vddvibl_uV = 0, /* fixed volt supply - VBAT */
551 .vddvibr_uV = 0, /* fixed volt supply - VBAT */
552};
553
554static struct twl4030_audio_data twl6040_audio = {
555 .codec = &twl6040_codec,
556 .vibra = &twl6040_vibra,
557 .audpwron_gpio = 127,
558 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
559 .irq_base = TWL6040_CODEC_IRQ_BASE,
560};
561
398static struct twl4030_platform_data sdp4430_twldata = { 562static struct twl4030_platform_data sdp4430_twldata = {
563 .audio = &twl6040_audio,
399 /* Regulators */ 564 /* Regulators */
400 .vusim = &sdp4430_vusim, 565 .vusim = &sdp4430_vusim,
401 .vaux1 = &sdp4430_vaux1, 566 .vaux1 = &sdp4430_vaux1,
@@ -593,6 +758,41 @@ static inline void board_serial_init(void)
593} 758}
594 #endif 759 #endif
595 760
761static void omap4_sdp4430_wifi_mux_init(void)
762{
763 omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT |
764 OMAP_PIN_OFF_WAKEUPENABLE);
765 omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT);
766
767 omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd",
768 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
769 omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk",
770 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
771 omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0",
772 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
773 omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1",
774 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
775 omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2",
776 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
777 omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3",
778 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
779
780}
781
782static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
783 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
784 .board_ref_clock = WL12XX_REFCLOCK_26,
785 .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
786};
787
788static void omap4_sdp4430_wifi_init(void)
789{
790 omap4_sdp4430_wifi_mux_init();
791 if (wl12xx_set_platform_data(&omap4_sdp4430_wlan_data))
792 pr_err("Error setting wl12xx data\n");
793 platform_device_register(&omap_vwlan_device);
794}
795
596static void __init omap_4430sdp_init(void) 796static void __init omap_4430sdp_init(void)
597{ 797{
598 int status; 798 int status;
@@ -609,6 +809,7 @@ static void __init omap_4430sdp_init(void)
609 omap_sfh7741prox_init(); 809 omap_sfh7741prox_init();
610 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); 810 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
611 board_serial_init(); 811 board_serial_init();
812 omap4_sdp4430_wifi_init();
612 omap4_twl6030_hsmmc_init(mmc); 813 omap4_twl6030_hsmmc_init(mmc);
613 814
614 usb_musb_init(&musb_board_data); 815 usb_musb_init(&musb_board_data);
@@ -622,7 +823,7 @@ static void __init omap_4430sdp_init(void)
622 ARRAY_SIZE(sdp4430_spi_board_info)); 823 ARRAY_SIZE(sdp4430_spi_board_info));
623 } 824 }
624 825
625 status = omap4_keyboard_init(&sdp4430_keypad_data); 826 status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
626 if (status) 827 if (status)
627 pr_err("Keypad initialization failed: %d\n", status); 828 pr_err("Keypad initialization failed: %d\n", status);
628 829
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 5f2b55ff04f..933e9353cb3 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -45,8 +45,6 @@ static struct omap_board_config_kernel am3517_crane_config[] __initdata = {
45static struct omap_board_mux board_mux[] __initdata = { 45static struct omap_board_mux board_mux[] __initdata = {
46 { .reg_offset = OMAP_MUX_TERMINATOR }, 46 { .reg_offset = OMAP_MUX_TERMINATOR },
47}; 47};
48#else
49#define board_mux NULL
50#endif 48#endif
51 49
52static void __init am3517_crane_init_early(void) 50static void __init am3517_crane_init_early(void)
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 35891d49c63..3af8aab435b 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -1,8 +1,9 @@
1/* 1/*
2 * board-cm-t35.c (CompuLab CM-T35 module) 2 * CompuLab CM-T35/CM-T3730 modules support
3 * 3 *
4 * Copyright (C) 2009 CompuLab, Ltd. 4 * Copyright (C) 2009-2011 CompuLab, Ltd.
5 * Author: Mike Rapoport <mike@compulab.co.il> 5 * Authors: Mike Rapoport <mike@compulab.co.il>
6 * Igor Grinberg <grinberg@compulab.co.il>
6 * 7 *
7 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 9 * modify it under the terms of the GNU General Public License
@@ -13,11 +14,6 @@
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details. 15 * General Public License for more details.
15 * 16 *
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 St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */ 17 */
22 18
23#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -149,12 +145,12 @@ static struct mtd_partition cm_t35_nand_partitions[] = {
149 }, 145 },
150 { 146 {
151 .name = "linux", 147 .name = "linux",
152 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ 148 .offset = MTDPART_OFS_APPEND, /* Offset = 0x2A0000 */
153 .size = 32 * NAND_BLOCK_SIZE, 149 .size = 32 * NAND_BLOCK_SIZE,
154 }, 150 },
155 { 151 {
156 .name = "rootfs", 152 .name = "rootfs",
157 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ 153 .offset = MTDPART_OFS_APPEND, /* Offset = 0x6A0000 */
158 .size = MTDPART_SIZ_FULL, 154 .size = MTDPART_SIZ_FULL,
159 }, 155 },
160}; 156};
@@ -433,9 +429,9 @@ static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
433 if (gpio_request_one(wlan_rst, GPIOF_OUT_INIT_HIGH, "WLAN RST") == 0) { 429 if (gpio_request_one(wlan_rst, GPIOF_OUT_INIT_HIGH, "WLAN RST") == 0) {
434 gpio_export(wlan_rst, 0); 430 gpio_export(wlan_rst, 0);
435 udelay(10); 431 udelay(10);
436 gpio_set_value(wlan_rst, 0); 432 gpio_set_value_cansleep(wlan_rst, 0);
437 udelay(10); 433 udelay(10);
438 gpio_set_value(wlan_rst, 1); 434 gpio_set_value_cansleep(wlan_rst, 1);
439 } else { 435 } else {
440 pr_err("CM-T35: could not obtain gpio for WiFi reset\n"); 436 pr_err("CM-T35: could not obtain gpio for WiFi reset\n");
441 } 437 }
@@ -539,17 +535,11 @@ static struct omap_board_mux board_mux[] __initdata = {
539 OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 535 OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
540 OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 536 OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
541 537
542 /* DSS */ 538 /* common DSS */
543 OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 539 OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
544 OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 540 OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
545 OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 541 OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
546 OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 542 OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
547 OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
548 OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
549 OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
550 OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
551 OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
552 OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
553 OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 543 OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
554 OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 544 OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
555 OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 545 OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
@@ -562,12 +552,6 @@ static struct omap_board_mux board_mux[] __initdata = {
562 OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 552 OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
563 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 553 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
564 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 554 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
565 OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
566 OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
567 OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
568 OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
569 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
570 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
571 555
572 /* display controls */ 556 /* display controls */
573 OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 557 OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
@@ -580,19 +564,53 @@ static struct omap_board_mux board_mux[] __initdata = {
580 564
581 { .reg_offset = OMAP_MUX_TERMINATOR }, 565 { .reg_offset = OMAP_MUX_TERMINATOR },
582}; 566};
567
568static void __init cm_t3x_common_dss_mux_init(int mux_mode)
569{
570 omap_mux_init_signal("dss_data18", mux_mode);
571 omap_mux_init_signal("dss_data19", mux_mode);
572 omap_mux_init_signal("dss_data20", mux_mode);
573 omap_mux_init_signal("dss_data21", mux_mode);
574 omap_mux_init_signal("dss_data22", mux_mode);
575 omap_mux_init_signal("dss_data23", mux_mode);
576}
577
578static void __init cm_t35_init_mux(void)
579{
580 omap_mux_init_signal("gpio_70", OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT);
581 omap_mux_init_signal("gpio_71", OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT);
582 omap_mux_init_signal("gpio_72", OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT);
583 omap_mux_init_signal("gpio_73", OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT);
584 omap_mux_init_signal("gpio_74", OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT);
585 omap_mux_init_signal("gpio_75", OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT);
586 cm_t3x_common_dss_mux_init(OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT);
587}
588
589static void __init cm_t3730_init_mux(void)
590{
591 omap_mux_init_signal("sys_boot0", OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
592 omap_mux_init_signal("sys_boot1", OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
593 omap_mux_init_signal("sys_boot3", OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
594 omap_mux_init_signal("sys_boot4", OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
595 omap_mux_init_signal("sys_boot5", OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
596 omap_mux_init_signal("sys_boot6", OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
597 cm_t3x_common_dss_mux_init(OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
598}
599#else
600static inline void cm_t35_init_mux(void) {}
601static inline void cm_t3730_init_mux(void) {}
583#endif 602#endif
584 603
585static struct omap_board_config_kernel cm_t35_config[] __initdata = { 604static struct omap_board_config_kernel cm_t35_config[] __initdata = {
586}; 605};
587 606
588static void __init cm_t35_init(void) 607static void __init cm_t3x_common_init(void)
589{ 608{
590 omap_board_config = cm_t35_config; 609 omap_board_config = cm_t35_config;
591 omap_board_config_size = ARRAY_SIZE(cm_t35_config); 610 omap_board_config_size = ARRAY_SIZE(cm_t35_config);
592 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); 611 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
593 omap_serial_init(); 612 omap_serial_init();
594 cm_t35_init_i2c(); 613 cm_t35_init_i2c();
595 cm_t35_init_nand();
596 omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL); 614 omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL);
597 cm_t35_init_ethernet(); 615 cm_t35_init_ethernet();
598 cm_t35_init_led(); 616 cm_t35_init_led();
@@ -602,6 +620,19 @@ static void __init cm_t35_init(void)
602 usbhs_init(&usbhs_bdata); 620 usbhs_init(&usbhs_bdata);
603} 621}
604 622
623static void __init cm_t35_init(void)
624{
625 cm_t3x_common_init();
626 cm_t35_init_mux();
627 cm_t35_init_nand();
628}
629
630static void __init cm_t3730_init(void)
631{
632 cm_t3x_common_init();
633 cm_t3730_init_mux();
634}
635
605MACHINE_START(CM_T35, "Compulab CM-T35") 636MACHINE_START(CM_T35, "Compulab CM-T35")
606 .boot_params = 0x80000100, 637 .boot_params = 0x80000100,
607 .reserve = omap_reserve, 638 .reserve = omap_reserve,
@@ -611,3 +642,13 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
611 .init_machine = cm_t35_init, 642 .init_machine = cm_t35_init,
612 .timer = &omap3_timer, 643 .timer = &omap3_timer,
613MACHINE_END 644MACHINE_END
645
646MACHINE_START(CM_T3730, "Compulab CM-T3730")
647 .boot_params = 0x80000100,
648 .reserve = omap_reserve,
649 .map_io = omap3_map_io,
650 .init_early = cm_t35_init_early,
651 .init_irq = omap3_init_irq,
652 .init_machine = cm_t3730_init,
653 .timer = &omap3_timer,
654MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 34f84111276..3ae16b4e3f5 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -60,7 +60,8 @@
60 * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1 60 * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1
61 * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0 61 * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0
62 * C4 = GPIO173, GPIO172, GPIO171: 1 0 1 62 * C4 = GPIO173, GPIO172, GPIO171: 1 0 1
63 * XM = GPIO173, GPIO172, GPIO171: 0 0 0 63 * XMA/XMB = GPIO173, GPIO172, GPIO171: 0 0 0
64 * XMC = GPIO173, GPIO172, GPIO171: 0 1 0
64 */ 65 */
65enum { 66enum {
66 OMAP3BEAGLE_BOARD_UNKN = 0, 67 OMAP3BEAGLE_BOARD_UNKN = 0,
@@ -68,14 +69,26 @@ enum {
68 OMAP3BEAGLE_BOARD_C1_3, 69 OMAP3BEAGLE_BOARD_C1_3,
69 OMAP3BEAGLE_BOARD_C4, 70 OMAP3BEAGLE_BOARD_C4,
70 OMAP3BEAGLE_BOARD_XM, 71 OMAP3BEAGLE_BOARD_XM,
72 OMAP3BEAGLE_BOARD_XMC,
71}; 73};
72 74
73static u8 omap3_beagle_version; 75static u8 omap3_beagle_version;
74 76
75static u8 omap3_beagle_get_rev(void) 77/*
76{ 78 * Board-specific configuration
77 return omap3_beagle_version; 79 * Defaults to BeagleBoard-xMC
78} 80 */
81static struct {
82 int mmc1_gpio_wp;
83 int usb_pwr_level;
84 int reset_gpio;
85 int usr_button_gpio;
86} beagle_config = {
87 .mmc1_gpio_wp = -EINVAL,
88 .usb_pwr_level = GPIOF_OUT_INIT_LOW,
89 .reset_gpio = 129,
90 .usr_button_gpio = 4,
91};
79 92
80static struct gpio omap3_beagle_rev_gpios[] __initdata = { 93static struct gpio omap3_beagle_rev_gpios[] __initdata = {
81 { 171, GPIOF_IN, "rev_id_0" }, 94 { 171, GPIOF_IN, "rev_id_0" },
@@ -110,18 +123,32 @@ static void __init omap3_beagle_init_rev(void)
110 case 7: 123 case 7:
111 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); 124 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
112 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX; 125 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
126 beagle_config.mmc1_gpio_wp = 29;
127 beagle_config.reset_gpio = 170;
128 beagle_config.usr_button_gpio = 7;
113 break; 129 break;
114 case 6: 130 case 6:
115 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); 131 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
116 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3; 132 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
133 beagle_config.mmc1_gpio_wp = 23;
134 beagle_config.reset_gpio = 170;
135 beagle_config.usr_button_gpio = 7;
117 break; 136 break;
118 case 5: 137 case 5:
119 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); 138 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
120 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4; 139 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
140 beagle_config.mmc1_gpio_wp = 23;
141 beagle_config.reset_gpio = 170;
142 beagle_config.usr_button_gpio = 7;
121 break; 143 break;
122 case 0: 144 case 0:
123 printk(KERN_INFO "OMAP3 Beagle Rev: xM\n"); 145 printk(KERN_INFO "OMAP3 Beagle Rev: xM Ax/Bx\n");
124 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM; 146 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
147 beagle_config.usb_pwr_level = GPIOF_OUT_INIT_HIGH;
148 break;
149 case 2:
150 printk(KERN_INFO "OMAP3 Beagle Rev: xM C\n");
151 omap3_beagle_version = OMAP3BEAGLE_BOARD_XMC;
125 break; 152 break;
126 default: 153 default:
127 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); 154 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
@@ -225,7 +252,7 @@ static struct omap2_hsmmc_info mmc[] = {
225 { 252 {
226 .mmc = 1, 253 .mmc = 1,
227 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 254 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
228 .gpio_wp = 29, 255 .gpio_wp = -EINVAL,
229 }, 256 },
230 {} /* Terminator */ 257 {} /* Terminator */
231}; 258};
@@ -243,17 +270,11 @@ static struct gpio_led gpio_leds[];
243static int beagle_twl_gpio_setup(struct device *dev, 270static int beagle_twl_gpio_setup(struct device *dev,
244 unsigned gpio, unsigned ngpio) 271 unsigned gpio, unsigned ngpio)
245{ 272{
246 int r, usb_pwr_level; 273 int r;
247 274
248 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 275 if (beagle_config.mmc1_gpio_wp != -EINVAL)
249 mmc[0].gpio_wp = -EINVAL; 276 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
250 } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) || 277 mmc[0].gpio_wp = beagle_config.mmc1_gpio_wp;
251 (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) {
252 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
253 mmc[0].gpio_wp = 23;
254 } else {
255 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
256 }
257 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 278 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
258 mmc[0].gpio_cd = gpio + 0; 279 mmc[0].gpio_cd = gpio + 0;
259 omap2_hsmmc_init(mmc); 280 omap2_hsmmc_init(mmc);
@@ -263,9 +284,8 @@ static int beagle_twl_gpio_setup(struct device *dev,
263 * high / others active low) 284 * high / others active low)
264 * DVI reset GPIO is different between beagle revisions 285 * DVI reset GPIO is different between beagle revisions
265 */ 286 */
266 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 287 /* Valid for all -xM revisions */
267 usb_pwr_level = GPIOF_OUT_INIT_HIGH; 288 if (cpu_is_omap3630()) {
268 beagle_dvi_device.reset_gpio = 129;
269 /* 289 /*
270 * gpio + 1 on Xm controls the TFP410's enable line (active low) 290 * gpio + 1 on Xm controls the TFP410's enable line (active low)
271 * gpio + 2 control varies depending on the board rev as below: 291 * gpio + 2 control varies depending on the board rev as below:
@@ -283,8 +303,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
283 pr_err("%s: unable to configure DVI_LDO_EN\n", 303 pr_err("%s: unable to configure DVI_LDO_EN\n",
284 __func__); 304 __func__);
285 } else { 305 } else {
286 usb_pwr_level = GPIOF_OUT_INIT_LOW;
287 beagle_dvi_device.reset_gpio = 170;
288 /* 306 /*
289 * REVISIT: need ehci-omap hooks for external VBUS 307 * REVISIT: need ehci-omap hooks for external VBUS
290 * power switch and overcurrent detect 308 * power switch and overcurrent detect
@@ -292,8 +310,10 @@ static int beagle_twl_gpio_setup(struct device *dev,
292 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) 310 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
293 pr_err("%s: unable to configure EHCI_nOC\n", __func__); 311 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
294 } 312 }
313 beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
295 314
296 gpio_request_one(gpio + TWL4030_GPIO_MAX, usb_pwr_level, "nEN_USB_PWR"); 315 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
316 "nEN_USB_PWR");
297 317
298 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 318 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
299 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 319 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -404,7 +424,8 @@ static struct platform_device leds_gpio = {
404static struct gpio_keys_button gpio_buttons[] = { 424static struct gpio_keys_button gpio_buttons[] = {
405 { 425 {
406 .code = BTN_EXTRA, 426 .code = BTN_EXTRA,
407 .gpio = 7, 427 /* Dynamically assigned depending on board */
428 .gpio = -EINVAL,
408 .desc = "user", 429 .desc = "user",
409 .wakeup = 1, 430 .wakeup = 1,
410 }, 431 },
@@ -468,25 +489,24 @@ static void __init beagle_opp_init(void)
468 return; 489 return;
469 } 490 }
470 491
471 /* Custom OPP enabled for XM */ 492 /* Custom OPP enabled for all xM versions */
472 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 493 if (cpu_is_omap3630()) {
473 struct omap_hwmod *mh = omap_hwmod_lookup("mpu"); 494 struct device *mpu_dev, *iva_dev;
474 struct omap_hwmod *dh = omap_hwmod_lookup("iva");
475 struct device *dev;
476 495
477 if (!mh || !dh) { 496 mpu_dev = omap2_get_mpuss_device();
497 iva_dev = omap2_get_iva_device();
498
499 if (!mpu_dev || !iva_dev) {
478 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", 500 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
479 __func__, mh, dh); 501 __func__, mpu_dev, iva_dev);
480 return; 502 return;
481 } 503 }
482 /* Enable MPU 1GHz and lower opps */ 504 /* Enable MPU 1GHz and lower opps */
483 dev = &mh->od->pdev.dev; 505 r = opp_enable(mpu_dev, 800000000);
484 r = opp_enable(dev, 800000000);
485 /* TODO: MPU 1GHz needs SR and ABB */ 506 /* TODO: MPU 1GHz needs SR and ABB */
486 507
487 /* Enable IVA 800MHz and lower opps */ 508 /* Enable IVA 800MHz and lower opps */
488 dev = &dh->od->pdev.dev; 509 r |= opp_enable(iva_dev, 660000000);
489 r |= opp_enable(dev, 660000000);
490 /* TODO: DSP 800MHz needs SR and ABB */ 510 /* TODO: DSP 800MHz needs SR and ABB */
491 if (r) { 511 if (r) {
492 pr_err("%s: failed to enable higher opp %d\n", 512 pr_err("%s: failed to enable higher opp %d\n",
@@ -495,10 +515,8 @@ static void __init beagle_opp_init(void)
495 * Cleanup - disable the higher freqs - we dont care 515 * Cleanup - disable the higher freqs - we dont care
496 * about the results 516 * about the results
497 */ 517 */
498 dev = &mh->od->pdev.dev; 518 opp_disable(mpu_dev, 800000000);
499 opp_disable(dev, 800000000); 519 opp_disable(iva_dev, 660000000);
500 dev = &dh->od->pdev.dev;
501 opp_disable(dev, 660000000);
502 } 520 }
503 } 521 }
504 return; 522 return;
@@ -509,6 +527,9 @@ static void __init omap3_beagle_init(void)
509 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 527 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
510 omap3_beagle_init_rev(); 528 omap3_beagle_init_rev();
511 omap3_beagle_i2c_init(); 529 omap3_beagle_i2c_init();
530
531 gpio_buttons[0].gpio = beagle_config.usr_button_gpio;
532
512 platform_add_devices(omap3_beagle_devices, 533 platform_add_devices(omap3_beagle_devices,
513 ARRAY_SIZE(omap3_beagle_devices)); 534 ARRAY_SIZE(omap3_beagle_devices));
514 omap_display_init(&beagle_dss_data); 535 omap_display_init(&beagle_dss_data);
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index f1f18d03d24..f949a9954d7 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -519,7 +519,6 @@ static void __init overo_init(void)
519 usb_musb_init(NULL); 519 usb_musb_init(NULL);
520 usbhs_init(&usbhs_bdata); 520 usbhs_init(&usbhs_bdata);
521 overo_spi_init(); 521 overo_spi_init();
522 overo_ads7846_init();
523 overo_init_smsc911x(); 522 overo_init_smsc911x();
524 overo_display_init(); 523 overo_display_init();
525 overo_init_led(); 524 overo_init_led();
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index bdb24db3600..5a886cd2c59 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -39,6 +39,7 @@
39#include <sound/tpa6130a2-plat.h> 39#include <sound/tpa6130a2-plat.h>
40#include <media/radio-si4713.h> 40#include <media/radio-si4713.h>
41#include <media/si4713.h> 41#include <media/si4713.h>
42#include <linux/leds-lp5523.h>
42 43
43#include <../drivers/staging/iio/light/tsl2563.h> 44#include <../drivers/staging/iio/light/tsl2563.h>
44 45
@@ -53,6 +54,7 @@
53#define RX51_WL1251_IRQ_GPIO 42 54#define RX51_WL1251_IRQ_GPIO 42
54#define RX51_FMTX_RESET_GPIO 163 55#define RX51_FMTX_RESET_GPIO 163
55#define RX51_FMTX_IRQ 53 56#define RX51_FMTX_IRQ 53
57#define RX51_LP5523_CHIP_EN_GPIO 41
56 58
57#define RX51_USB_TRANSCEIVER_RST_GPIO 67 59#define RX51_USB_TRANSCEIVER_RST_GPIO 67
58 60
@@ -71,6 +73,64 @@ static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
71}; 73};
72#endif 74#endif
73 75
76#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
77static struct lp5523_led_config rx51_lp5523_led_config[] = {
78 {
79 .chan_nr = 0,
80 .led_current = 50,
81 }, {
82 .chan_nr = 1,
83 .led_current = 50,
84 }, {
85 .chan_nr = 2,
86 .led_current = 50,
87 }, {
88 .chan_nr = 3,
89 .led_current = 50,
90 }, {
91 .chan_nr = 4,
92 .led_current = 50,
93 }, {
94 .chan_nr = 5,
95 .led_current = 50,
96 }, {
97 .chan_nr = 6,
98 .led_current = 50,
99 }, {
100 .chan_nr = 7,
101 .led_current = 50,
102 }, {
103 .chan_nr = 8,
104 .led_current = 50,
105 }
106};
107
108static int rx51_lp5523_setup(void)
109{
110 return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
111 "lp5523_enable");
112}
113
114static void rx51_lp5523_release(void)
115{
116 gpio_free(RX51_LP5523_CHIP_EN_GPIO);
117}
118
119static void rx51_lp5523_enable(bool state)
120{
121 gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
122}
123
124static struct lp5523_platform_data rx51_lp5523_platform_data = {
125 .led_config = rx51_lp5523_led_config,
126 .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
127 .clock_mode = LP5523_CLOCK_AUTO,
128 .setup_resources = rx51_lp5523_setup,
129 .release_resources = rx51_lp5523_release,
130 .enable = rx51_lp5523_enable,
131};
132#endif
133
74static struct omap2_mcspi_device_config wl1251_mcspi_config = { 134static struct omap2_mcspi_device_config wl1251_mcspi_config = {
75 .turbo_mode = 0, 135 .turbo_mode = 0,
76 .single_channel = 1, 136 .single_channel = 1,
@@ -358,6 +418,10 @@ static struct regulator_consumer_supply rx51_vmmc1_supply[] = {
358 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), 418 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
359}; 419};
360 420
421static struct regulator_consumer_supply rx51_vaux2_supply[] = {
422 REGULATOR_SUPPLY("vdds_csib", "omap3isp"),
423};
424
361static struct regulator_consumer_supply rx51_vaux3_supply[] = { 425static struct regulator_consumer_supply rx51_vaux3_supply[] = {
362 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), 426 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
363}; 427};
@@ -419,6 +483,8 @@ static struct regulator_init_data rx51_vaux2 = {
419 .valid_ops_mask = REGULATOR_CHANGE_MODE 483 .valid_ops_mask = REGULATOR_CHANGE_MODE
420 | REGULATOR_CHANGE_STATUS, 484 | REGULATOR_CHANGE_STATUS,
421 }, 485 },
486 .num_consumer_supplies = ARRAY_SIZE(rx51_vaux2_supply),
487 .consumer_supplies = rx51_vaux2_supply,
422}; 488};
423 489
424/* VAUX3 - adds more power to VIO_18 rail */ 490/* VAUX3 - adds more power to VIO_18 rail */
@@ -495,6 +561,32 @@ static struct regulator_init_data rx51_vmmc2 = {
495 .consumer_supplies = rx51_vmmc2_supplies, 561 .consumer_supplies = rx51_vmmc2_supplies,
496}; 562};
497 563
564static struct regulator_init_data rx51_vpll1 = {
565 .constraints = {
566 .name = "VPLL",
567 .min_uV = 1800000,
568 .max_uV = 1800000,
569 .apply_uV = true,
570 .always_on = true,
571 .valid_modes_mask = REGULATOR_MODE_NORMAL
572 | REGULATOR_MODE_STANDBY,
573 .valid_ops_mask = REGULATOR_CHANGE_MODE,
574 },
575};
576
577static struct regulator_init_data rx51_vpll2 = {
578 .constraints = {
579 .name = "VSDI_CSI",
580 .min_uV = 1800000,
581 .max_uV = 1800000,
582 .apply_uV = true,
583 .always_on = true,
584 .valid_modes_mask = REGULATOR_MODE_NORMAL
585 | REGULATOR_MODE_STANDBY,
586 .valid_ops_mask = REGULATOR_CHANGE_MODE,
587 },
588};
589
498static struct regulator_init_data rx51_vsim = { 590static struct regulator_init_data rx51_vsim = {
499 .constraints = { 591 .constraints = {
500 .name = "VMMC2_IO_18", 592 .name = "VMMC2_IO_18",
@@ -524,6 +616,43 @@ static struct regulator_init_data rx51_vio = {
524 .consumer_supplies = rx51_vio_supplies, 616 .consumer_supplies = rx51_vio_supplies,
525}; 617};
526 618
619static struct regulator_init_data rx51_vintana1 = {
620 .constraints = {
621 .name = "VINTANA1",
622 .min_uV = 1500000,
623 .max_uV = 1500000,
624 .always_on = true,
625 .valid_modes_mask = REGULATOR_MODE_NORMAL
626 | REGULATOR_MODE_STANDBY,
627 .valid_ops_mask = REGULATOR_CHANGE_MODE,
628 },
629};
630
631static struct regulator_init_data rx51_vintana2 = {
632 .constraints = {
633 .name = "VINTANA2",
634 .min_uV = 2750000,
635 .max_uV = 2750000,
636 .apply_uV = true,
637 .always_on = true,
638 .valid_modes_mask = REGULATOR_MODE_NORMAL
639 | REGULATOR_MODE_STANDBY,
640 .valid_ops_mask = REGULATOR_CHANGE_MODE,
641 },
642};
643
644static struct regulator_init_data rx51_vintdig = {
645 .constraints = {
646 .name = "VINTDIG",
647 .min_uV = 1500000,
648 .max_uV = 1500000,
649 .always_on = true,
650 .valid_modes_mask = REGULATOR_MODE_NORMAL
651 | REGULATOR_MODE_STANDBY,
652 .valid_ops_mask = REGULATOR_CHANGE_MODE,
653 },
654};
655
527static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = { 656static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
528 .gpio_reset = RX51_FMTX_RESET_GPIO, 657 .gpio_reset = RX51_FMTX_RESET_GPIO,
529}; 658};
@@ -741,11 +870,11 @@ static struct twl4030_power_data rx51_t2scripts_data __initdata = {
741 .resource_config = twl4030_rconfig, 870 .resource_config = twl4030_rconfig,
742}; 871};
743 872
744struct twl4030_codec_vibra_data rx51_vibra_data __initdata = { 873struct twl4030_vibra_data rx51_vibra_data __initdata = {
745 .coexist = 0, 874 .coexist = 0,
746}; 875};
747 876
748struct twl4030_codec_data rx51_codec_data __initdata = { 877struct twl4030_audio_data rx51_audio_data __initdata = {
749 .audio_mclk = 26000000, 878 .audio_mclk = 26000000,
750 .vibra = &rx51_vibra_data, 879 .vibra = &rx51_vibra_data,
751}; 880};
@@ -755,13 +884,18 @@ static struct twl4030_platform_data rx51_twldata __initdata = {
755 .gpio = &rx51_gpio_data, 884 .gpio = &rx51_gpio_data,
756 .keypad = &rx51_kp_data, 885 .keypad = &rx51_kp_data,
757 .power = &rx51_t2scripts_data, 886 .power = &rx51_t2scripts_data,
758 .codec = &rx51_codec_data, 887 .audio = &rx51_audio_data,
759 888
760 .vaux1 = &rx51_vaux1, 889 .vaux1 = &rx51_vaux1,
761 .vaux2 = &rx51_vaux2, 890 .vaux2 = &rx51_vaux2,
762 .vaux4 = &rx51_vaux4, 891 .vaux4 = &rx51_vaux4,
763 .vmmc1 = &rx51_vmmc1, 892 .vmmc1 = &rx51_vmmc1,
893 .vpll1 = &rx51_vpll1,
894 .vpll2 = &rx51_vpll2,
764 .vsim = &rx51_vsim, 895 .vsim = &rx51_vsim,
896 .vintana1 = &rx51_vintana1,
897 .vintana2 = &rx51_vintana2,
898 .vintdig = &rx51_vintdig,
765 .vio = &rx51_vio, 899 .vio = &rx51_vio,
766}; 900};
767 901
@@ -800,6 +934,12 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
800 .platform_data = &rx51_tsl2563_platform_data, 934 .platform_data = &rx51_tsl2563_platform_data,
801 }, 935 },
802#endif 936#endif
937#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
938 {
939 I2C_BOARD_INFO("lp5523", 0x32),
940 .platform_data = &rx51_lp5523_platform_data,
941 },
942#endif
803 { 943 {
804 I2C_BOARD_INFO("tpa6130a2", 0x60), 944 I2C_BOARD_INFO("tpa6130a2", 0x60),
805 .platform_data = &rx51_tpa6130a2_data, 945 .platform_data = &rx51_tpa6130a2_data,
@@ -950,6 +1090,7 @@ error:
950void __init rx51_peripherals_init(void) 1090void __init rx51_peripherals_init(void)
951{ 1091{
952 rx51_i2c_init(); 1092 rx51_i2c_init();
1093 regulator_has_full_constraints();
953 gpmc_onenand_init(board_onenand_data); 1094 gpmc_onenand_init(board_onenand_data);
954 board_smc91x_init(); 1095 board_smc91x_init();
955 rx51_add_gpio_keys(); 1096 rx51_add_gpio_keys();
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index 6402e781c45..369c2eb7715 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -23,6 +23,7 @@
23#define ZOOM_SMSC911X_GPIO 158 23#define ZOOM_SMSC911X_GPIO 158
24#define ZOOM_QUADUART_CS 3 24#define ZOOM_QUADUART_CS 3
25#define ZOOM_QUADUART_GPIO 102 25#define ZOOM_QUADUART_GPIO 102
26#define ZOOM_QUADUART_RST_GPIO 152
26#define QUART_CLK 1843200 27#define QUART_CLK 1843200
27#define DEBUG_BASE 0x08000000 28#define DEBUG_BASE 0x08000000
28#define ZOOM_ETHR_START DEBUG_BASE 29#define ZOOM_ETHR_START DEBUG_BASE
@@ -67,6 +68,14 @@ static inline void __init zoom_init_quaduart(void)
67 unsigned long cs_mem_base; 68 unsigned long cs_mem_base;
68 int quart_gpio = 0; 69 int quart_gpio = 0;
69 70
71 if (gpio_request_one(ZOOM_QUADUART_RST_GPIO,
72 GPIOF_OUT_INIT_LOW,
73 "TL16CP754C GPIO") < 0) {
74 pr_err("Failed to request GPIO%d for TL16CP754C\n",
75 ZOOM_QUADUART_RST_GPIO);
76 return;
77 }
78
70 quart_cs = ZOOM_QUADUART_CS; 79 quart_cs = ZOOM_QUADUART_CS;
71 80
72 if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) { 81 if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) {
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 13a64423366..6d0aa4fcb7c 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -274,12 +274,12 @@ static int __init omap_i2c_init(void)
274 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2); 274 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
275 275
276 if (machine_is_omap_zoom2()) { 276 if (machine_is_omap_zoom2()) {
277 struct twl4030_codec_audio_data *audio_data; 277 struct twl4030_codec_data *codec_data;
278 audio_data = zoom_twldata.codec->audio; 278 codec_data = zoom_twldata.audio->codec;
279 279
280 audio_data->ramp_delay_value = 3; /* 161 ms */ 280 codec_data->ramp_delay_value = 3; /* 161 ms */
281 audio_data->hs_extmute = 1; 281 codec_data->hs_extmute = 1;
282 audio_data->set_hs_extmute = zoom2_set_hs_extmute; 282 codec_data->set_hs_extmute = zoom2_set_hs_extmute;
283 } 283 }
284 omap_pmic_init(1, 2400, "twl5030", INT_34XX_SYS_NIRQ, &zoom_twldata); 284 omap_pmic_init(1, 2400, "twl5030", INT_34XX_SYS_NIRQ, &zoom_twldata);
285 omap_register_i2c_bus(2, 400, NULL, 0); 285 omap_register_i2c_bus(2, 400, NULL, 0);
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 180299e4a83..1f3481f8d69 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -38,6 +38,14 @@
38u8 cpu_mask; 38u8 cpu_mask;
39 39
40/* 40/*
41 * clkdm_control: if true, then when a clock is enabled in the
42 * hardware, its clockdomain will first be enabled; and when a clock
43 * is disabled in the hardware, its clockdomain will be disabled
44 * afterwards.
45 */
46static bool clkdm_control = true;
47
48/*
41 * OMAP2+ specific clock functions 49 * OMAP2+ specific clock functions
42 */ 50 */
43 51
@@ -100,6 +108,19 @@ void omap2_init_clk_clkdm(struct clk *clk)
100} 108}
101 109
102/** 110/**
111 * omap2_clk_disable_clkdm_control - disable clkdm control on clk enable/disable
112 *
113 * Prevent the OMAP clock code from calling into the clockdomain code
114 * when a hardware clock in that clockdomain is enabled or disabled.
115 * Intended to be called at init time from omap*_clk_init(). No
116 * return value.
117 */
118void __init omap2_clk_disable_clkdm_control(void)
119{
120 clkdm_control = false;
121}
122
123/**
103 * omap2_clk_dflt_find_companion - find companion clock to @clk 124 * omap2_clk_dflt_find_companion - find companion clock to @clk
104 * @clk: struct clk * to find the companion clock of 125 * @clk: struct clk * to find the companion clock of
105 * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in 126 * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in
@@ -268,7 +289,7 @@ void omap2_clk_disable(struct clk *clk)
268 clk->ops->disable(clk); 289 clk->ops->disable(clk);
269 } 290 }
270 291
271 if (clk->clkdm) 292 if (clkdm_control && clk->clkdm)
272 clkdm_clk_disable(clk->clkdm, clk); 293 clkdm_clk_disable(clk->clkdm, clk);
273 294
274 if (clk->parent) 295 if (clk->parent)
@@ -308,7 +329,7 @@ int omap2_clk_enable(struct clk *clk)
308 } 329 }
309 } 330 }
310 331
311 if (clk->clkdm) { 332 if (clkdm_control && clk->clkdm) {
312 ret = clkdm_clk_enable(clk->clkdm, clk); 333 ret = clkdm_clk_enable(clk->clkdm, clk);
313 if (ret) { 334 if (ret) {
314 WARN(1, "clock: %s: could not enable clockdomain %s: " 335 WARN(1, "clock: %s: could not enable clockdomain %s: "
@@ -330,7 +351,7 @@ int omap2_clk_enable(struct clk *clk)
330 return 0; 351 return 0;
331 352
332oce_err3: 353oce_err3:
333 if (clk->clkdm) 354 if (clkdm_control && clk->clkdm)
334 clkdm_clk_disable(clk->clkdm, clk); 355 clkdm_clk_disable(clk->clkdm, clk);
335oce_err2: 356oce_err2:
336 if (clk->parent) 357 if (clk->parent)
@@ -453,6 +474,7 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name)
453 if (IS_ERR_VALUE(r)) { 474 if (IS_ERR_VALUE(r)) {
454 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", 475 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n",
455 mpurate_ck->name, mpurate, r); 476 mpurate_ck->name, mpurate, r);
477 clk_put(mpurate_ck);
456 return -EINVAL; 478 return -EINVAL;
457 } 479 }
458 480
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index e10ff2b5484..48ac568881b 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -16,6 +16,8 @@
16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H 16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H
17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H 17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H
18 18
19#include <linux/kernel.h>
20
19#include <plat/clock.h> 21#include <plat/clock.h>
20 22
21/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 23/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
@@ -72,6 +74,7 @@ void omap2_clk_disable_unused(struct clk *clk);
72#endif 74#endif
73 75
74void omap2_init_clk_clkdm(struct clk *clk); 76void omap2_init_clk_clkdm(struct clk *clk);
77void __init omap2_clk_disable_clkdm_control(void);
75 78
76/* clkt_clksel.c public functions */ 79/* clkt_clksel.c public functions */
77u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, 80u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index 2926d028b6e..debc040872f 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1805,9 +1805,9 @@ static struct omap_clk omap2420_clks[] = {
1805 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X), 1805 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X),
1806 /* DSS domain clocks */ 1806 /* DSS domain clocks */
1807 CLK("omapdss_dss", "ick", &dss_ick, CK_242X), 1807 CLK("omapdss_dss", "ick", &dss_ick, CK_242X),
1808 CLK("omapdss_dss", "fck", &dss1_fck, CK_242X), 1808 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X),
1809 CLK("omapdss_dss", "sys_clk", &dss2_fck, CK_242X), 1809 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X),
1810 CLK("omapdss_dss", "tv_clk", &dss_54m_fck, CK_242X), 1810 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X),
1811 /* L3 domain clocks */ 1811 /* L3 domain clocks */
1812 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X), 1812 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X),
1813 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X), 1813 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X),
@@ -1844,13 +1844,13 @@ static struct omap_clk omap2420_clks[] = {
1844 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X), 1844 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X),
1845 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X), 1845 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X),
1846 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X), 1846 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X),
1847 CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_242X), 1847 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X),
1848 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X), 1848 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X),
1849 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_242X), 1849 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X),
1850 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X), 1850 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X),
1851 CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_242X), 1851 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X),
1852 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X), 1852 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X),
1853 CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_242X), 1853 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X),
1854 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X), 1854 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X),
1855 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X), 1855 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X),
1856 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X), 1856 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X),
@@ -1860,7 +1860,7 @@ static struct omap_clk omap2420_clks[] = {
1860 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X), 1860 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X),
1861 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X), 1861 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
1862 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X), 1862 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
1863 CLK("omap_wdt", "fck", &mpu_wdt_fck, CK_242X), 1863 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X),
1864 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X), 1864 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
1865 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X), 1865 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
1866 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X), 1866 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
@@ -1880,11 +1880,11 @@ static struct omap_clk omap2420_clks[] = {
1880 CLK(NULL, "eac_ick", &eac_ick, CK_242X), 1880 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
1881 CLK(NULL, "eac_fck", &eac_fck, CK_242X), 1881 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
1882 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X), 1882 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X),
1883 CLK("omap_hdq.1", "fck", &hdq_fck, CK_242X), 1883 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X),
1884 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X), 1884 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X),
1885 CLK("omap_i2c.1", "fck", &i2c1_fck, CK_242X), 1885 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X),
1886 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X), 1886 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X),
1887 CLK("omap_i2c.2", "fck", &i2c2_fck, CK_242X), 1887 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X),
1888 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X), 1888 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1889 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X), 1889 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
1890 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X), 1890 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X),
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 0c79d39e302..96a942e42db 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1895,9 +1895,9 @@ static struct omap_clk omap2430_clks[] = {
1895 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X), 1895 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
1896 /* DSS domain clocks */ 1896 /* DSS domain clocks */
1897 CLK("omapdss_dss", "ick", &dss_ick, CK_243X), 1897 CLK("omapdss_dss", "ick", &dss_ick, CK_243X),
1898 CLK("omapdss_dss", "fck", &dss1_fck, CK_243X), 1898 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X),
1899 CLK("omapdss_dss", "sys_clk", &dss2_fck, CK_243X), 1899 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X),
1900 CLK("omapdss_dss", "tv_clk", &dss_54m_fck, CK_243X), 1900 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X),
1901 /* L3 domain clocks */ 1901 /* L3 domain clocks */
1902 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X), 1902 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X),
1903 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X), 1903 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X),
@@ -1934,21 +1934,21 @@ static struct omap_clk omap2430_clks[] = {
1934 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X), 1934 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X),
1935 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X), 1935 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X),
1936 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X), 1936 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X),
1937 CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_243X), 1937 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X),
1938 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X), 1938 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X),
1939 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_243X), 1939 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X),
1940 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X), 1940 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
1941 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_243X), 1941 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X),
1942 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X), 1942 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
1943 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_243X), 1943 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X),
1944 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X), 1944 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
1945 CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_243X), 1945 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X),
1946 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X), 1946 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X),
1947 CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_243X), 1947 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X),
1948 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X), 1948 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X),
1949 CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_243X), 1949 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X),
1950 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X), 1950 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
1951 CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_243X), 1951 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X),
1952 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X), 1952 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X),
1953 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X), 1953 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X),
1954 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X), 1954 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X),
@@ -1958,7 +1958,7 @@ static struct omap_clk omap2430_clks[] = {
1958 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X), 1958 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X),
1959 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X), 1959 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
1960 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X), 1960 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
1961 CLK("omap_wdt", "fck", &mpu_wdt_fck, CK_243X), 1961 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X),
1962 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X), 1962 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
1963 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X), 1963 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
1964 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X), 1964 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
@@ -1975,9 +1975,9 @@ static struct omap_clk omap2430_clks[] = {
1975 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X), 1975 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X),
1976 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X), 1976 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X),
1977 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X), 1977 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X),
1978 CLK("omap_i2c.1", "fck", &i2chs1_fck, CK_243X), 1978 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X),
1979 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X), 1979 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X),
1980 CLK("omap_i2c.2", "fck", &i2chs2_fck, CK_243X), 1980 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X),
1981 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X), 1981 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X),
1982 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X), 1982 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X),
1983 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X), 1983 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X),
@@ -1990,9 +1990,9 @@ static struct omap_clk omap2430_clks[] = {
1990 CLK(NULL, "usb_fck", &usb_fck, CK_243X), 1990 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
1991 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X), 1991 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
1992 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X), 1992 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X),
1993 CLK("omap_hsmmc.0", "fck", &mmchs1_fck, CK_243X), 1993 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X),
1994 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X), 1994 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X),
1995 CLK("omap_hsmmc.1", "fck", &mmchs2_fck, CK_243X), 1995 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X),
1996 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X), 1996 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
1997 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X), 1997 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
1998 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X), 1998 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 75b119bd9cd..b9b84468314 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3078,6 +3078,7 @@ static struct clk gpt12_fck = {
3078 .name = "gpt12_fck", 3078 .name = "gpt12_fck",
3079 .ops = &clkops_null, 3079 .ops = &clkops_null,
3080 .parent = &secure_32k_fck, 3080 .parent = &secure_32k_fck,
3081 .clkdm_name = "wkup_clkdm",
3081 .recalc = &followparent_recalc, 3082 .recalc = &followparent_recalc,
3082}; 3083};
3083 3084
@@ -3085,6 +3086,7 @@ static struct clk wdt1_fck = {
3085 .name = "wdt1_fck", 3086 .name = "wdt1_fck",
3086 .ops = &clkops_null, 3087 .ops = &clkops_null,
3087 .parent = &secure_32k_fck, 3088 .parent = &secure_32k_fck,
3089 .clkdm_name = "wkup_clkdm",
3088 .recalc = &followparent_recalc, 3090 .recalc = &followparent_recalc,
3089}; 3091};
3090 3092
@@ -3289,25 +3291,25 @@ static struct omap_clk omap3xxx_clks[] = {
3289 CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck, CK_3XXX), 3291 CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck, CK_3XXX),
3290 CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck, CK_3XXX), 3292 CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck, CK_3XXX),
3291 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX), 3293 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3292 CLK("omap_hsmmc.2", "fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3294 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3293 CLK("omap_hsmmc.1", "fck", &mmchs2_fck, CK_3XXX), 3295 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
3294 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX), 3296 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX),
3295 CLK("omap_hsmmc.0", "fck", &mmchs1_fck, CK_3XXX), 3297 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_3XXX),
3296 CLK("omap_i2c.3", "fck", &i2c3_fck, CK_3XXX), 3298 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_3XXX),
3297 CLK("omap_i2c.2", "fck", &i2c2_fck, CK_3XXX), 3299 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_3XXX),
3298 CLK("omap_i2c.1", "fck", &i2c1_fck, CK_3XXX), 3300 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_3XXX),
3299 CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_3XXX), 3301 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_3XXX),
3300 CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_3XXX), 3302 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_3XXX),
3301 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX), 3303 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX),
3302 CLK("omap2_mcspi.4", "fck", &mcspi4_fck, CK_3XXX), 3304 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_3XXX),
3303 CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_3XXX), 3305 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_3XXX),
3304 CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_3XXX), 3306 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_3XXX),
3305 CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_3XXX), 3307 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_3XXX),
3306 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX), 3308 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX),
3307 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX), 3309 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX),
3308 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1), 3310 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3309 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX), 3311 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX),
3310 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX), 3312 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX),
3311 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1), 3313 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3312 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX), 3314 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3313 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1), 3315 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
@@ -3356,11 +3358,11 @@ static struct omap_clk omap3xxx_clks[] = {
3356 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX), 3358 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX),
3357 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX), 3359 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX),
3358 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX), 3360 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX),
3359 CLK("omapdss_dss", "fck", &dss1_alwon_fck_3430es1, CK_3430ES1), 3361 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
3360 CLK("omapdss_dss", "fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3362 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3361 CLK("omapdss_dss", "tv_clk", &dss_tv_fck, CK_3XXX), 3363 CLK(NULL, "dss_tv_fck", &dss_tv_fck, CK_3XXX),
3362 CLK("omapdss_dss", "video_clk", &dss_96m_fck, CK_3XXX), 3364 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX),
3363 CLK("omapdss_dss", "sys_clk", &dss2_alwon_fck, CK_3XXX), 3365 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX),
3364 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1), 3366 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1),
3365 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3367 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3366 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX), 3368 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX),
@@ -3385,7 +3387,7 @@ static struct omap_clk omap3xxx_clks[] = {
3385 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX), 3387 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3386 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX), 3388 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
3387 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX), 3389 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX),
3388 CLK("omap_wdt", "fck", &wdt2_fck, CK_3XXX), 3390 CLK(NULL, "wdt2_fck", &wdt2_fck, CK_3XXX),
3389 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX), 3391 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3390 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX), 3392 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3391 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX), 3393 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
@@ -3436,9 +3438,9 @@ static struct omap_clk omap3xxx_clks[] = {
3436 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX), 3438 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3437 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX), 3439 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3438 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX), 3440 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3439 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_3XXX), 3441 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3440 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_3XXX), 3442 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3441 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_3XXX), 3443 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3442 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX), 3444 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3443 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX), 3445 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3444 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX), 3446 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 044df38f65c..c0b6fbda340 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -1397,6 +1397,40 @@ static struct clk dss_dss_clk = {
1397 .recalc = &followparent_recalc, 1397 .recalc = &followparent_recalc,
1398}; 1398};
1399 1399
1400static const struct clksel_rate div3_8to32_rates[] = {
1401 { .div = 8, .val = 0, .flags = RATE_IN_44XX },
1402 { .div = 16, .val = 1, .flags = RATE_IN_44XX },
1403 { .div = 32, .val = 2, .flags = RATE_IN_44XX },
1404 { .div = 0 },
1405};
1406
1407static const struct clksel div_ts_div[] = {
1408 { .parent = &l4_wkup_clk_mux_ck, .rates = div3_8to32_rates },
1409 { .parent = NULL },
1410};
1411
1412static struct clk div_ts_ck = {
1413 .name = "div_ts_ck",
1414 .parent = &l4_wkup_clk_mux_ck,
1415 .clksel = div_ts_div,
1416 .clksel_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1417 .clksel_mask = OMAP4430_CLKSEL_24_25_MASK,
1418 .ops = &clkops_null,
1419 .recalc = &omap2_clksel_recalc,
1420 .round_rate = &omap2_clksel_round_rate,
1421 .set_rate = &omap2_clksel_set_rate,
1422};
1423
1424static struct clk bandgap_ts_fclk = {
1425 .name = "bandgap_ts_fclk",
1426 .ops = &clkops_omap2_dflt,
1427 .enable_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1428 .enable_bit = OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
1429 .clkdm_name = "l4_wkup_clkdm",
1430 .parent = &div_ts_ck,
1431 .recalc = &followparent_recalc,
1432};
1433
1400static struct clk dss_48mhz_clk = { 1434static struct clk dss_48mhz_clk = {
1401 .name = "dss_48mhz_clk", 1435 .name = "dss_48mhz_clk",
1402 .ops = &clkops_omap2_dflt, 1436 .ops = &clkops_omap2_dflt,
@@ -1605,6 +1639,7 @@ static struct clk gpmc_ick = {
1605 .ops = &clkops_omap2_dflt, 1639 .ops = &clkops_omap2_dflt,
1606 .enable_reg = OMAP4430_CM_L3_2_GPMC_CLKCTRL, 1640 .enable_reg = OMAP4430_CM_L3_2_GPMC_CLKCTRL,
1607 .enable_bit = OMAP4430_MODULEMODE_HWCTRL, 1641 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1642 .flags = ENABLE_ON_INIT,
1608 .clkdm_name = "l3_2_clkdm", 1643 .clkdm_name = "l3_2_clkdm",
1609 .parent = &l3_div_ck, 1644 .parent = &l3_div_ck,
1610 .recalc = &followparent_recalc, 1645 .recalc = &followparent_recalc,
@@ -2773,19 +2808,39 @@ static struct clk trace_clk_div_ck = {
2773 2808
2774/* SCRM aux clk nodes */ 2809/* SCRM aux clk nodes */
2775 2810
2776static const struct clksel auxclk_sel[] = { 2811static const struct clksel auxclk_src_sel[] = {
2777 { .parent = &sys_clkin_ck, .rates = div_1_0_rates }, 2812 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
2778 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates }, 2813 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
2779 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates }, 2814 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
2780 { .parent = NULL }, 2815 { .parent = NULL },
2781}; 2816};
2782 2817
2783static struct clk auxclk0_ck = { 2818static const struct clksel_rate div16_1to16_rates[] = {
2784 .name = "auxclk0_ck", 2819 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
2820 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
2821 { .div = 3, .val = 2, .flags = RATE_IN_4430 },
2822 { .div = 4, .val = 3, .flags = RATE_IN_4430 },
2823 { .div = 5, .val = 4, .flags = RATE_IN_4430 },
2824 { .div = 6, .val = 5, .flags = RATE_IN_4430 },
2825 { .div = 7, .val = 6, .flags = RATE_IN_4430 },
2826 { .div = 8, .val = 7, .flags = RATE_IN_4430 },
2827 { .div = 9, .val = 8, .flags = RATE_IN_4430 },
2828 { .div = 10, .val = 9, .flags = RATE_IN_4430 },
2829 { .div = 11, .val = 10, .flags = RATE_IN_4430 },
2830 { .div = 12, .val = 11, .flags = RATE_IN_4430 },
2831 { .div = 13, .val = 12, .flags = RATE_IN_4430 },
2832 { .div = 14, .val = 13, .flags = RATE_IN_4430 },
2833 { .div = 15, .val = 14, .flags = RATE_IN_4430 },
2834 { .div = 16, .val = 15, .flags = RATE_IN_4430 },
2835 { .div = 0 },
2836};
2837
2838static struct clk auxclk0_src_ck = {
2839 .name = "auxclk0_src_ck",
2785 .parent = &sys_clkin_ck, 2840 .parent = &sys_clkin_ck,
2786 .init = &omap2_init_clksel_parent, 2841 .init = &omap2_init_clksel_parent,
2787 .ops = &clkops_omap2_dflt, 2842 .ops = &clkops_omap2_dflt,
2788 .clksel = auxclk_sel, 2843 .clksel = auxclk_src_sel,
2789 .clksel_reg = OMAP4_SCRM_AUXCLK0, 2844 .clksel_reg = OMAP4_SCRM_AUXCLK0,
2790 .clksel_mask = OMAP4_SRCSELECT_MASK, 2845 .clksel_mask = OMAP4_SRCSELECT_MASK,
2791 .recalc = &omap2_clksel_recalc, 2846 .recalc = &omap2_clksel_recalc,
@@ -2793,12 +2848,29 @@ static struct clk auxclk0_ck = {
2793 .enable_bit = OMAP4_ENABLE_SHIFT, 2848 .enable_bit = OMAP4_ENABLE_SHIFT,
2794}; 2849};
2795 2850
2796static struct clk auxclk1_ck = { 2851static const struct clksel auxclk0_sel[] = {
2797 .name = "auxclk1_ck", 2852 { .parent = &auxclk0_src_ck, .rates = div16_1to16_rates },
2853 { .parent = NULL },
2854};
2855
2856static struct clk auxclk0_ck = {
2857 .name = "auxclk0_ck",
2858 .parent = &auxclk0_src_ck,
2859 .clksel = auxclk0_sel,
2860 .clksel_reg = OMAP4_SCRM_AUXCLK0,
2861 .clksel_mask = OMAP4_CLKDIV_MASK,
2862 .ops = &clkops_null,
2863 .recalc = &omap2_clksel_recalc,
2864 .round_rate = &omap2_clksel_round_rate,
2865 .set_rate = &omap2_clksel_set_rate,
2866};
2867
2868static struct clk auxclk1_src_ck = {
2869 .name = "auxclk1_src_ck",
2798 .parent = &sys_clkin_ck, 2870 .parent = &sys_clkin_ck,
2799 .init = &omap2_init_clksel_parent, 2871 .init = &omap2_init_clksel_parent,
2800 .ops = &clkops_omap2_dflt, 2872 .ops = &clkops_omap2_dflt,
2801 .clksel = auxclk_sel, 2873 .clksel = auxclk_src_sel,
2802 .clksel_reg = OMAP4_SCRM_AUXCLK1, 2874 .clksel_reg = OMAP4_SCRM_AUXCLK1,
2803 .clksel_mask = OMAP4_SRCSELECT_MASK, 2875 .clksel_mask = OMAP4_SRCSELECT_MASK,
2804 .recalc = &omap2_clksel_recalc, 2876 .recalc = &omap2_clksel_recalc,
@@ -2806,12 +2878,29 @@ static struct clk auxclk1_ck = {
2806 .enable_bit = OMAP4_ENABLE_SHIFT, 2878 .enable_bit = OMAP4_ENABLE_SHIFT,
2807}; 2879};
2808 2880
2809static struct clk auxclk2_ck = { 2881static const struct clksel auxclk1_sel[] = {
2810 .name = "auxclk2_ck", 2882 { .parent = &auxclk1_src_ck, .rates = div16_1to16_rates },
2883 { .parent = NULL },
2884};
2885
2886static struct clk auxclk1_ck = {
2887 .name = "auxclk1_ck",
2888 .parent = &auxclk1_src_ck,
2889 .clksel = auxclk1_sel,
2890 .clksel_reg = OMAP4_SCRM_AUXCLK1,
2891 .clksel_mask = OMAP4_CLKDIV_MASK,
2892 .ops = &clkops_null,
2893 .recalc = &omap2_clksel_recalc,
2894 .round_rate = &omap2_clksel_round_rate,
2895 .set_rate = &omap2_clksel_set_rate,
2896};
2897
2898static struct clk auxclk2_src_ck = {
2899 .name = "auxclk2_src_ck",
2811 .parent = &sys_clkin_ck, 2900 .parent = &sys_clkin_ck,
2812 .init = &omap2_init_clksel_parent, 2901 .init = &omap2_init_clksel_parent,
2813 .ops = &clkops_omap2_dflt, 2902 .ops = &clkops_omap2_dflt,
2814 .clksel = auxclk_sel, 2903 .clksel = auxclk_src_sel,
2815 .clksel_reg = OMAP4_SCRM_AUXCLK2, 2904 .clksel_reg = OMAP4_SCRM_AUXCLK2,
2816 .clksel_mask = OMAP4_SRCSELECT_MASK, 2905 .clksel_mask = OMAP4_SRCSELECT_MASK,
2817 .recalc = &omap2_clksel_recalc, 2906 .recalc = &omap2_clksel_recalc,
@@ -2819,12 +2908,29 @@ static struct clk auxclk2_ck = {
2819 .enable_bit = OMAP4_ENABLE_SHIFT, 2908 .enable_bit = OMAP4_ENABLE_SHIFT,
2820}; 2909};
2821 2910
2822static struct clk auxclk3_ck = { 2911static const struct clksel auxclk2_sel[] = {
2823 .name = "auxclk3_ck", 2912 { .parent = &auxclk2_src_ck, .rates = div16_1to16_rates },
2913 { .parent = NULL },
2914};
2915
2916static struct clk auxclk2_ck = {
2917 .name = "auxclk2_ck",
2918 .parent = &auxclk2_src_ck,
2919 .clksel = auxclk2_sel,
2920 .clksel_reg = OMAP4_SCRM_AUXCLK2,
2921 .clksel_mask = OMAP4_CLKDIV_MASK,
2922 .ops = &clkops_null,
2923 .recalc = &omap2_clksel_recalc,
2924 .round_rate = &omap2_clksel_round_rate,
2925 .set_rate = &omap2_clksel_set_rate,
2926};
2927
2928static struct clk auxclk3_src_ck = {
2929 .name = "auxclk3_src_ck",
2824 .parent = &sys_clkin_ck, 2930 .parent = &sys_clkin_ck,
2825 .init = &omap2_init_clksel_parent, 2931 .init = &omap2_init_clksel_parent,
2826 .ops = &clkops_omap2_dflt, 2932 .ops = &clkops_omap2_dflt,
2827 .clksel = auxclk_sel, 2933 .clksel = auxclk_src_sel,
2828 .clksel_reg = OMAP4_SCRM_AUXCLK3, 2934 .clksel_reg = OMAP4_SCRM_AUXCLK3,
2829 .clksel_mask = OMAP4_SRCSELECT_MASK, 2935 .clksel_mask = OMAP4_SRCSELECT_MASK,
2830 .recalc = &omap2_clksel_recalc, 2936 .recalc = &omap2_clksel_recalc,
@@ -2832,12 +2938,29 @@ static struct clk auxclk3_ck = {
2832 .enable_bit = OMAP4_ENABLE_SHIFT, 2938 .enable_bit = OMAP4_ENABLE_SHIFT,
2833}; 2939};
2834 2940
2835static struct clk auxclk4_ck = { 2941static const struct clksel auxclk3_sel[] = {
2836 .name = "auxclk4_ck", 2942 { .parent = &auxclk3_src_ck, .rates = div16_1to16_rates },
2943 { .parent = NULL },
2944};
2945
2946static struct clk auxclk3_ck = {
2947 .name = "auxclk3_ck",
2948 .parent = &auxclk3_src_ck,
2949 .clksel = auxclk3_sel,
2950 .clksel_reg = OMAP4_SCRM_AUXCLK3,
2951 .clksel_mask = OMAP4_CLKDIV_MASK,
2952 .ops = &clkops_null,
2953 .recalc = &omap2_clksel_recalc,
2954 .round_rate = &omap2_clksel_round_rate,
2955 .set_rate = &omap2_clksel_set_rate,
2956};
2957
2958static struct clk auxclk4_src_ck = {
2959 .name = "auxclk4_src_ck",
2837 .parent = &sys_clkin_ck, 2960 .parent = &sys_clkin_ck,
2838 .init = &omap2_init_clksel_parent, 2961 .init = &omap2_init_clksel_parent,
2839 .ops = &clkops_omap2_dflt, 2962 .ops = &clkops_omap2_dflt,
2840 .clksel = auxclk_sel, 2963 .clksel = auxclk_src_sel,
2841 .clksel_reg = OMAP4_SCRM_AUXCLK4, 2964 .clksel_reg = OMAP4_SCRM_AUXCLK4,
2842 .clksel_mask = OMAP4_SRCSELECT_MASK, 2965 .clksel_mask = OMAP4_SRCSELECT_MASK,
2843 .recalc = &omap2_clksel_recalc, 2966 .recalc = &omap2_clksel_recalc,
@@ -2845,12 +2968,29 @@ static struct clk auxclk4_ck = {
2845 .enable_bit = OMAP4_ENABLE_SHIFT, 2968 .enable_bit = OMAP4_ENABLE_SHIFT,
2846}; 2969};
2847 2970
2848static struct clk auxclk5_ck = { 2971static const struct clksel auxclk4_sel[] = {
2849 .name = "auxclk5_ck", 2972 { .parent = &auxclk4_src_ck, .rates = div16_1to16_rates },
2973 { .parent = NULL },
2974};
2975
2976static struct clk auxclk4_ck = {
2977 .name = "auxclk4_ck",
2978 .parent = &auxclk4_src_ck,
2979 .clksel = auxclk4_sel,
2980 .clksel_reg = OMAP4_SCRM_AUXCLK4,
2981 .clksel_mask = OMAP4_CLKDIV_MASK,
2982 .ops = &clkops_null,
2983 .recalc = &omap2_clksel_recalc,
2984 .round_rate = &omap2_clksel_round_rate,
2985 .set_rate = &omap2_clksel_set_rate,
2986};
2987
2988static struct clk auxclk5_src_ck = {
2989 .name = "auxclk5_src_ck",
2850 .parent = &sys_clkin_ck, 2990 .parent = &sys_clkin_ck,
2851 .init = &omap2_init_clksel_parent, 2991 .init = &omap2_init_clksel_parent,
2852 .ops = &clkops_omap2_dflt, 2992 .ops = &clkops_omap2_dflt,
2853 .clksel = auxclk_sel, 2993 .clksel = auxclk_src_sel,
2854 .clksel_reg = OMAP4_SCRM_AUXCLK5, 2994 .clksel_reg = OMAP4_SCRM_AUXCLK5,
2855 .clksel_mask = OMAP4_SRCSELECT_MASK, 2995 .clksel_mask = OMAP4_SRCSELECT_MASK,
2856 .recalc = &omap2_clksel_recalc, 2996 .recalc = &omap2_clksel_recalc,
@@ -2858,6 +2998,23 @@ static struct clk auxclk5_ck = {
2858 .enable_bit = OMAP4_ENABLE_SHIFT, 2998 .enable_bit = OMAP4_ENABLE_SHIFT,
2859}; 2999};
2860 3000
3001static const struct clksel auxclk5_sel[] = {
3002 { .parent = &auxclk5_src_ck, .rates = div16_1to16_rates },
3003 { .parent = NULL },
3004};
3005
3006static struct clk auxclk5_ck = {
3007 .name = "auxclk5_ck",
3008 .parent = &auxclk5_src_ck,
3009 .clksel = auxclk5_sel,
3010 .clksel_reg = OMAP4_SCRM_AUXCLK5,
3011 .clksel_mask = OMAP4_CLKDIV_MASK,
3012 .ops = &clkops_null,
3013 .recalc = &omap2_clksel_recalc,
3014 .round_rate = &omap2_clksel_round_rate,
3015 .set_rate = &omap2_clksel_set_rate,
3016};
3017
2861static const struct clksel auxclkreq_sel[] = { 3018static const struct clksel auxclkreq_sel[] = {
2862 { .parent = &auxclk0_ck, .rates = div_1_0_rates }, 3019 { .parent = &auxclk0_ck, .rates = div_1_0_rates },
2863 { .parent = &auxclk1_ck, .rates = div_1_1_rates }, 3020 { .parent = &auxclk1_ck, .rates = div_1_1_rates },
@@ -3028,14 +3185,16 @@ static struct omap_clk omap44xx_clks[] = {
3028 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X), 3185 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X),
3029 CLK(NULL, "aess_fck", &aess_fck, CK_443X), 3186 CLK(NULL, "aess_fck", &aess_fck, CK_443X),
3030 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X), 3187 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X),
3188 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X),
3031 CLK(NULL, "des3des_fck", &des3des_fck, CK_443X), 3189 CLK(NULL, "des3des_fck", &des3des_fck, CK_443X),
3190 CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X),
3032 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X), 3191 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
3033 CLK(NULL, "dmic_fck", &dmic_fck, CK_443X), 3192 CLK(NULL, "dmic_fck", &dmic_fck, CK_443X),
3034 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X), 3193 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
3035 CLK("omapdss_dss", "sys_clk", &dss_sys_clk, CK_443X), 3194 CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X),
3036 CLK("omapdss_dss", "tv_clk", &dss_tv_clk, CK_443X), 3195 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
3037 CLK("omapdss_dss", "video_clk", &dss_48mhz_clk, CK_443X), 3196 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
3038 CLK("omapdss_dss", "fck", &dss_dss_clk, CK_443X), 3197 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
3039 CLK("omapdss_dss", "ick", &dss_fck, CK_443X), 3198 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
3040 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X), 3199 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
3041 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X), 3200 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
@@ -3056,12 +3215,12 @@ static struct omap_clk omap44xx_clks[] = {
3056 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X), 3215 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X),
3057 CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X), 3216 CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X),
3058 CLK(NULL, "gpu_fck", &gpu_fck, CK_443X), 3217 CLK(NULL, "gpu_fck", &gpu_fck, CK_443X),
3059 CLK("omap2_hdq.0", "fck", &hdq1w_fck, CK_443X), 3218 CLK(NULL, "hdq1w_fck", &hdq1w_fck, CK_443X),
3060 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X), 3219 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X),
3061 CLK("omap_i2c.1", "fck", &i2c1_fck, CK_443X), 3220 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_443X),
3062 CLK("omap_i2c.2", "fck", &i2c2_fck, CK_443X), 3221 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_443X),
3063 CLK("omap_i2c.3", "fck", &i2c3_fck, CK_443X), 3222 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_443X),
3064 CLK("omap_i2c.4", "fck", &i2c4_fck, CK_443X), 3223 CLK(NULL, "i2c4_fck", &i2c4_fck, CK_443X),
3065 CLK(NULL, "ipu_fck", &ipu_fck, CK_443X), 3224 CLK(NULL, "ipu_fck", &ipu_fck, CK_443X),
3066 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X), 3225 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X),
3067 CLK(NULL, "iss_fck", &iss_fck, CK_443X), 3226 CLK(NULL, "iss_fck", &iss_fck, CK_443X),
@@ -3072,23 +3231,23 @@ static struct omap_clk omap44xx_clks[] = {
3072 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X), 3231 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
3073 CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X), 3232 CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X),
3074 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X), 3233 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
3075 CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_443X), 3234 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_443X),
3076 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X), 3235 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
3077 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_443X), 3236 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_443X),
3078 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X), 3237 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
3079 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_443X), 3238 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_443X),
3080 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X), 3239 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
3081 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_443X), 3240 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_443X),
3082 CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X), 3241 CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X),
3083 CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_443X), 3242 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_443X),
3084 CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_443X), 3243 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_443X),
3085 CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_443X), 3244 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_443X),
3086 CLK("omap2_mcspi.4", "fck", &mcspi4_fck, CK_443X), 3245 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_443X),
3087 CLK("omap_hsmmc.0", "fck", &mmc1_fck, CK_443X), 3246 CLK(NULL, "mmc1_fck", &mmc1_fck, CK_443X),
3088 CLK("omap_hsmmc.1", "fck", &mmc2_fck, CK_443X), 3247 CLK(NULL, "mmc2_fck", &mmc2_fck, CK_443X),
3089 CLK("omap_hsmmc.2", "fck", &mmc3_fck, CK_443X), 3248 CLK(NULL, "mmc3_fck", &mmc3_fck, CK_443X),
3090 CLK("omap_hsmmc.3", "fck", &mmc4_fck, CK_443X), 3249 CLK(NULL, "mmc4_fck", &mmc4_fck, CK_443X),
3091 CLK("omap_hsmmc.4", "fck", &mmc5_fck, CK_443X), 3250 CLK(NULL, "mmc5_fck", &mmc5_fck, CK_443X),
3092 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X), 3251 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
3093 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X), 3252 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
3094 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X), 3253 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
@@ -3145,21 +3304,27 @@ static struct omap_clk omap44xx_clks[] = {
3145 CLK(NULL, "usim_ck", &usim_ck, CK_443X), 3304 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
3146 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X), 3305 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
3147 CLK(NULL, "usim_fck", &usim_fck, CK_443X), 3306 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
3148 CLK("omap_wdt", "fck", &wd_timer2_fck, CK_443X), 3307 CLK(NULL, "wd_timer2_fck", &wd_timer2_fck, CK_443X),
3149 CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X), 3308 CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X),
3150 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X), 3309 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
3151 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X), 3310 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
3311 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X),
3152 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X), 3312 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X),
3153 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
3154 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
3155 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
3156 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
3157 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
3158 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X), 3313 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X),
3314 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X),
3315 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
3159 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X), 3316 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X),
3317 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X),
3318 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
3160 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X), 3319 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X),
3320 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X),
3321 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
3161 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X), 3322 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X),
3323 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X),
3324 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
3162 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X), 3325 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X),
3326 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
3327 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
3163 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X), 3328 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
3164 CLK(NULL, "gpmc_ck", &dummy_ck, CK_443X), 3329 CLK(NULL, "gpmc_ck", &dummy_ck, CK_443X),
3165 CLK(NULL, "gpt1_ick", &dummy_ck, CK_443X), 3330 CLK(NULL, "gpt1_ick", &dummy_ck, CK_443X),
@@ -3208,10 +3373,22 @@ int __init omap4xxx_clk_init(void)
3208 if (cpu_is_omap44xx()) { 3373 if (cpu_is_omap44xx()) {
3209 cpu_mask = RATE_IN_4430; 3374 cpu_mask = RATE_IN_4430;
3210 cpu_clkflg = CK_443X; 3375 cpu_clkflg = CK_443X;
3376 } else if (cpu_is_omap446x()) {
3377 cpu_mask = RATE_IN_4460;
3378 cpu_clkflg = CK_446X;
3379 } else {
3380 return 0;
3211 } 3381 }
3212 3382
3213 clk_init(&omap2_clk_functions); 3383 clk_init(&omap2_clk_functions);
3214 3384
3385 /*
3386 * Must stay commented until all OMAP SoC drivers are
3387 * converted to runtime PM, or drivers may start crashing
3388 *
3389 * omap2_clk_disable_clkdm_control();
3390 */
3391
3215 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks); 3392 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
3216 c++) 3393 c++)
3217 clk_preinit(c->lk.clk); 3394 clk_preinit(c->lk.clk);
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 6cb6c03293d..8f0890685d7 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * OMAP2/3/4 clockdomain framework functions 2 * OMAP2/3/4 clockdomain framework functions
3 * 3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc. 4 * Copyright (C) 2008-2011 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation 5 * Copyright (C) 2008-2011 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley and Jouni Högander 7 * Written by Paul Walmsley and Jouni Högander
8 * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> 8 * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com>
@@ -92,6 +92,8 @@ static int _clkdm_register(struct clockdomain *clkdm)
92 92
93 pwrdm_add_clkdm(pwrdm, clkdm); 93 pwrdm_add_clkdm(pwrdm, clkdm);
94 94
95 spin_lock_init(&clkdm->lock);
96
95 pr_debug("clockdomain: registered %s\n", clkdm->name); 97 pr_debug("clockdomain: registered %s\n", clkdm->name);
96 98
97 return 0; 99 return 0;
@@ -690,6 +692,9 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
690 */ 692 */
691int clkdm_sleep(struct clockdomain *clkdm) 693int clkdm_sleep(struct clockdomain *clkdm)
692{ 694{
695 int ret;
696 unsigned long flags;
697
693 if (!clkdm) 698 if (!clkdm)
694 return -EINVAL; 699 return -EINVAL;
695 700
@@ -704,7 +709,11 @@ int clkdm_sleep(struct clockdomain *clkdm)
704 709
705 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name); 710 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name);
706 711
707 return arch_clkdm->clkdm_sleep(clkdm); 712 spin_lock_irqsave(&clkdm->lock, flags);
713 clkdm->_flags &= ~_CLKDM_FLAG_HWSUP_ENABLED;
714 ret = arch_clkdm->clkdm_sleep(clkdm);
715 spin_unlock_irqrestore(&clkdm->lock, flags);
716 return ret;
708} 717}
709 718
710/** 719/**
@@ -718,6 +727,9 @@ int clkdm_sleep(struct clockdomain *clkdm)
718 */ 727 */
719int clkdm_wakeup(struct clockdomain *clkdm) 728int clkdm_wakeup(struct clockdomain *clkdm)
720{ 729{
730 int ret;
731 unsigned long flags;
732
721 if (!clkdm) 733 if (!clkdm)
722 return -EINVAL; 734 return -EINVAL;
723 735
@@ -732,7 +744,12 @@ int clkdm_wakeup(struct clockdomain *clkdm)
732 744
733 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name); 745 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name);
734 746
735 return arch_clkdm->clkdm_wakeup(clkdm); 747 spin_lock_irqsave(&clkdm->lock, flags);
748 clkdm->_flags &= ~_CLKDM_FLAG_HWSUP_ENABLED;
749 ret = arch_clkdm->clkdm_wakeup(clkdm);
750 ret |= pwrdm_state_switch(clkdm->pwrdm.ptr);
751 spin_unlock_irqrestore(&clkdm->lock, flags);
752 return ret;
736} 753}
737 754
738/** 755/**
@@ -747,6 +764,8 @@ int clkdm_wakeup(struct clockdomain *clkdm)
747 */ 764 */
748void clkdm_allow_idle(struct clockdomain *clkdm) 765void clkdm_allow_idle(struct clockdomain *clkdm)
749{ 766{
767 unsigned long flags;
768
750 if (!clkdm) 769 if (!clkdm)
751 return; 770 return;
752 771
@@ -762,8 +781,11 @@ void clkdm_allow_idle(struct clockdomain *clkdm)
762 pr_debug("clockdomain: enabling automatic idle transitions for %s\n", 781 pr_debug("clockdomain: enabling automatic idle transitions for %s\n",
763 clkdm->name); 782 clkdm->name);
764 783
784 spin_lock_irqsave(&clkdm->lock, flags);
785 clkdm->_flags |= _CLKDM_FLAG_HWSUP_ENABLED;
765 arch_clkdm->clkdm_allow_idle(clkdm); 786 arch_clkdm->clkdm_allow_idle(clkdm);
766 pwrdm_clkdm_state_switch(clkdm); 787 pwrdm_clkdm_state_switch(clkdm);
788 spin_unlock_irqrestore(&clkdm->lock, flags);
767} 789}
768 790
769/** 791/**
@@ -777,6 +799,8 @@ void clkdm_allow_idle(struct clockdomain *clkdm)
777 */ 799 */
778void clkdm_deny_idle(struct clockdomain *clkdm) 800void clkdm_deny_idle(struct clockdomain *clkdm)
779{ 801{
802 unsigned long flags;
803
780 if (!clkdm) 804 if (!clkdm)
781 return; 805 return;
782 806
@@ -792,11 +816,91 @@ void clkdm_deny_idle(struct clockdomain *clkdm)
792 pr_debug("clockdomain: disabling automatic idle transitions for %s\n", 816 pr_debug("clockdomain: disabling automatic idle transitions for %s\n",
793 clkdm->name); 817 clkdm->name);
794 818
819 spin_lock_irqsave(&clkdm->lock, flags);
820 clkdm->_flags &= ~_CLKDM_FLAG_HWSUP_ENABLED;
795 arch_clkdm->clkdm_deny_idle(clkdm); 821 arch_clkdm->clkdm_deny_idle(clkdm);
822 pwrdm_state_switch(clkdm->pwrdm.ptr);
823 spin_unlock_irqrestore(&clkdm->lock, flags);
824}
825
826/**
827 * clkdm_in_hwsup - is clockdomain @clkdm have hardware-supervised idle enabled?
828 * @clkdm: struct clockdomain *
829 *
830 * Returns true if clockdomain @clkdm currently has
831 * hardware-supervised idle enabled, or false if it does not or if
832 * @clkdm is NULL. It is only valid to call this function after
833 * clkdm_init() has been called. This function does not actually read
834 * bits from the hardware; it instead tests an in-memory flag that is
835 * changed whenever the clockdomain code changes the auto-idle mode.
836 */
837bool clkdm_in_hwsup(struct clockdomain *clkdm)
838{
839 bool ret;
840 unsigned long flags;
841
842 if (!clkdm)
843 return false;
844
845 spin_lock_irqsave(&clkdm->lock, flags);
846 ret = (clkdm->_flags & _CLKDM_FLAG_HWSUP_ENABLED) ? true : false;
847 spin_unlock_irqrestore(&clkdm->lock, flags);
848
849 return ret;
850}
851
852/* Clockdomain-to-clock/hwmod framework interface code */
853
854static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
855{
856 unsigned long flags;
857
858 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_enable)
859 return -EINVAL;
860
861 /*
862 * For arch's with no autodeps, clkcm_clk_enable
863 * should be called for every clock instance or hwmod that is
864 * enabled, so the clkdm can be force woken up.
865 */
866 if ((atomic_inc_return(&clkdm->usecount) > 1) && autodeps)
867 return 0;
868
869 spin_lock_irqsave(&clkdm->lock, flags);
870 arch_clkdm->clkdm_clk_enable(clkdm);
871 pwrdm_wait_transition(clkdm->pwrdm.ptr);
872 pwrdm_clkdm_state_switch(clkdm);
873 spin_unlock_irqrestore(&clkdm->lock, flags);
874
875 pr_debug("clockdomain: clkdm %s: enabled\n", clkdm->name);
876
877 return 0;
796} 878}
797 879
880static int _clkdm_clk_hwmod_disable(struct clockdomain *clkdm)
881{
882 unsigned long flags;
883
884 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
885 return -EINVAL;
886
887 if (atomic_read(&clkdm->usecount) == 0) {
888 WARN_ON(1); /* underflow */
889 return -ERANGE;
890 }
891
892 if (atomic_dec_return(&clkdm->usecount) > 0)
893 return 0;
894
895 spin_lock_irqsave(&clkdm->lock, flags);
896 arch_clkdm->clkdm_clk_disable(clkdm);
897 pwrdm_clkdm_state_switch(clkdm);
898 spin_unlock_irqrestore(&clkdm->lock, flags);
798 899
799/* Clockdomain-to-clock framework interface code */ 900 pr_debug("clockdomain: clkdm %s: disabled\n", clkdm->name);
901
902 return 0;
903}
800 904
801/** 905/**
802 * clkdm_clk_enable - add an enabled downstream clock to this clkdm 906 * clkdm_clk_enable - add an enabled downstream clock to this clkdm
@@ -819,25 +923,10 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
819 * downstream clocks for debugging purposes? 923 * downstream clocks for debugging purposes?
820 */ 924 */
821 925
822 if (!clkdm || !clk) 926 if (!clk)
823 return -EINVAL; 927 return -EINVAL;
824 928
825 if (!arch_clkdm || !arch_clkdm->clkdm_clk_enable) 929 return _clkdm_clk_hwmod_enable(clkdm);
826 return -EINVAL;
827
828 if (atomic_inc_return(&clkdm->usecount) > 1)
829 return 0;
830
831 /* Clockdomain now has one enabled downstream clock */
832
833 pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name,
834 clk->name);
835
836 arch_clkdm->clkdm_clk_enable(clkdm);
837 pwrdm_wait_transition(clkdm->pwrdm.ptr);
838 pwrdm_clkdm_state_switch(clkdm);
839
840 return 0;
841} 930}
842 931
843/** 932/**
@@ -850,9 +939,8 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
850 * clockdomain usecount goes to 0, put the clockdomain to sleep 939 * clockdomain usecount goes to 0, put the clockdomain to sleep
851 * (software-supervised mode) or remove the clkdm autodependencies 940 * (software-supervised mode) or remove the clkdm autodependencies
852 * (hardware-supervised mode). Returns -EINVAL if passed null 941 * (hardware-supervised mode). Returns -EINVAL if passed null
853 * pointers; -ERANGE if the @clkdm usecount underflows and debugging 942 * pointers; -ERANGE if the @clkdm usecount underflows; or returns 0
854 * is enabled; or returns 0 upon success or if the clockdomain is in 943 * upon success or if the clockdomain is in hwsup idle mode.
855 * hwsup idle mode.
856 */ 944 */
857int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) 945int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
858{ 946{
@@ -861,30 +949,72 @@ int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
861 * downstream clocks for debugging purposes? 949 * downstream clocks for debugging purposes?
862 */ 950 */
863 951
864 if (!clkdm || !clk) 952 if (!clk)
865 return -EINVAL; 953 return -EINVAL;
866 954
867 if (!arch_clkdm || !arch_clkdm->clkdm_clk_disable) 955 return _clkdm_clk_hwmod_disable(clkdm);
956}
957
958/**
959 * clkdm_hwmod_enable - add an enabled downstream hwmod to this clkdm
960 * @clkdm: struct clockdomain *
961 * @oh: struct omap_hwmod * of the enabled downstream hwmod
962 *
963 * Increment the usecount of the clockdomain @clkdm and ensure that it
964 * is awake before @oh is enabled. Intended to be called by
965 * module_enable() code.
966 * If the clockdomain is in software-supervised idle mode, force the
967 * clockdomain to wake. If the clockdomain is in hardware-supervised idle
968 * mode, add clkdm-pwrdm autodependencies, to ensure that devices in the
969 * clockdomain can be read from/written to by on-chip processors.
970 * Returns -EINVAL if passed null pointers;
971 * returns 0 upon success or if the clockdomain is in hwsup idle mode.
972 */
973int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh)
974{
975 /* The clkdm attribute does not exist yet prior OMAP4 */
976 if (cpu_is_omap24xx() || cpu_is_omap34xx())
977 return 0;
978
979 /*
980 * XXX Rewrite this code to maintain a list of enabled
981 * downstream hwmods for debugging purposes?
982 */
983
984 if (!oh)
868 return -EINVAL; 985 return -EINVAL;
869 986
870#ifdef DEBUG 987 return _clkdm_clk_hwmod_enable(clkdm);
871 if (atomic_read(&clkdm->usecount) == 0) { 988}
872 WARN_ON(1); /* underflow */
873 return -ERANGE;
874 }
875#endif
876 989
877 if (atomic_dec_return(&clkdm->usecount) > 0) 990/**
991 * clkdm_hwmod_disable - remove an enabled downstream hwmod from this clkdm
992 * @clkdm: struct clockdomain *
993 * @oh: struct omap_hwmod * of the disabled downstream hwmod
994 *
995 * Decrement the usecount of this clockdomain @clkdm when @oh is
996 * disabled. Intended to be called by module_disable() code.
997 * If the clockdomain usecount goes to 0, put the clockdomain to sleep
998 * (software-supervised mode) or remove the clkdm autodependencies
999 * (hardware-supervised mode).
1000 * Returns -EINVAL if passed null pointers; -ERANGE if the @clkdm usecount
1001 * underflows; or returns 0 upon success or if the clockdomain is in hwsup
1002 * idle mode.
1003 */
1004int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1005{
1006 /* The clkdm attribute does not exist yet prior OMAP4 */
1007 if (cpu_is_omap24xx() || cpu_is_omap34xx())
878 return 0; 1008 return 0;
879 1009
880 /* All downstream clocks of this clockdomain are now disabled */ 1010 /*
881 1011 * XXX Rewrite this code to maintain a list of enabled
882 pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name, 1012 * downstream hwmods for debugging purposes?
883 clk->name); 1013 */
884 1014
885 arch_clkdm->clkdm_clk_disable(clkdm); 1015 if (!oh)
886 pwrdm_clkdm_state_switch(clkdm); 1016 return -EINVAL;
887 1017
888 return 0; 1018 return _clkdm_clk_hwmod_disable(clkdm);
889} 1019}
890 1020
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 5823584d9cd..1e50c88b8a0 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -17,9 +17,11 @@
17#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAIN_H 17#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAIN_H
18 18
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/spinlock.h>
20 21
21#include "powerdomain.h" 22#include "powerdomain.h"
22#include <plat/clock.h> 23#include <plat/clock.h>
24#include <plat/omap_hwmod.h>
23#include <plat/cpu.h> 25#include <plat/cpu.h>
24 26
25/* 27/*
@@ -82,6 +84,9 @@ struct clkdm_dep {
82 const struct omap_chip_id omap_chip; 84 const struct omap_chip_id omap_chip;
83}; 85};
84 86
87/* Possible flags for struct clockdomain._flags */
88#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0)
89
85/** 90/**
86 * struct clockdomain - OMAP clockdomain 91 * struct clockdomain - OMAP clockdomain
87 * @name: clockdomain name 92 * @name: clockdomain name
@@ -89,6 +94,7 @@ struct clkdm_dep {
89 * @clktrctrl_reg: CLKSTCTRL reg for the given clock domain 94 * @clktrctrl_reg: CLKSTCTRL reg for the given clock domain
90 * @clktrctrl_mask: CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg 95 * @clktrctrl_mask: CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg
91 * @flags: Clockdomain capability flags 96 * @flags: Clockdomain capability flags
97 * @_flags: Flags for use only by internal clockdomain code
92 * @dep_bit: Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit 98 * @dep_bit: Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit
93 * @prcm_partition: (OMAP4 only) PRCM partition ID for this clkdm's registers 99 * @prcm_partition: (OMAP4 only) PRCM partition ID for this clkdm's registers
94 * @cm_inst: (OMAP4 only) CM instance register offset 100 * @cm_inst: (OMAP4 only) CM instance register offset
@@ -113,6 +119,7 @@ struct clockdomain {
113 } pwrdm; 119 } pwrdm;
114 const u16 clktrctrl_mask; 120 const u16 clktrctrl_mask;
115 const u8 flags; 121 const u8 flags;
122 u8 _flags;
116 const u8 dep_bit; 123 const u8 dep_bit;
117 const u8 prcm_partition; 124 const u8 prcm_partition;
118 const s16 cm_inst; 125 const s16 cm_inst;
@@ -122,6 +129,7 @@ struct clockdomain {
122 const struct omap_chip_id omap_chip; 129 const struct omap_chip_id omap_chip;
123 atomic_t usecount; 130 atomic_t usecount;
124 struct list_head node; 131 struct list_head node;
132 spinlock_t lock;
125}; 133};
126 134
127/** 135/**
@@ -177,12 +185,15 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
177 185
178void clkdm_allow_idle(struct clockdomain *clkdm); 186void clkdm_allow_idle(struct clockdomain *clkdm);
179void clkdm_deny_idle(struct clockdomain *clkdm); 187void clkdm_deny_idle(struct clockdomain *clkdm);
188bool clkdm_in_hwsup(struct clockdomain *clkdm);
180 189
181int clkdm_wakeup(struct clockdomain *clkdm); 190int clkdm_wakeup(struct clockdomain *clkdm);
182int clkdm_sleep(struct clockdomain *clkdm); 191int clkdm_sleep(struct clockdomain *clkdm);
183 192
184int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk); 193int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
185int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk); 194int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
195int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
196int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
186 197
187extern void __init omap2xxx_clockdomains_init(void); 198extern void __init omap2xxx_clockdomains_init(void);
188extern void __init omap3xxx_clockdomains_init(void); 199extern void __init omap3xxx_clockdomains_init(void);
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
index 48d0db7e606..f740edb111f 100644
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
@@ -183,7 +183,8 @@ static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
183 _clkdm_add_autodeps(clkdm); 183 _clkdm_add_autodeps(clkdm);
184 _enable_hwsup(clkdm); 184 _enable_hwsup(clkdm);
185 } else { 185 } else {
186 clkdm_wakeup(clkdm); 186 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
187 omap2_clkdm_wakeup(clkdm);
187 } 188 }
188 189
189 return 0; 190 return 0;
@@ -205,7 +206,8 @@ static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
205 _clkdm_del_autodeps(clkdm); 206 _clkdm_del_autodeps(clkdm);
206 _enable_hwsup(clkdm); 207 _enable_hwsup(clkdm);
207 } else { 208 } else {
208 clkdm_sleep(clkdm); 209 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
210 omap2_clkdm_sleep(clkdm);
209 } 211 }
210 212
211 return 0; 213 return 0;
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
index a1a4ecd2654..b43706aa08b 100644
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ b/arch/arm/mach-omap2/clockdomain44xx.c
@@ -95,13 +95,8 @@ static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
95 95
96static int omap4_clkdm_clk_enable(struct clockdomain *clkdm) 96static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
97{ 97{
98 bool hwsup = false; 98 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
99 99 return omap4_clkdm_wakeup(clkdm);
100 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
101 clkdm->cm_inst, clkdm->clkdm_offs);
102
103 if (!hwsup)
104 clkdm_wakeup(clkdm);
105 100
106 return 0; 101 return 0;
107} 102}
@@ -113,8 +108,8 @@ static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
113 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition, 108 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
114 clkdm->cm_inst, clkdm->clkdm_offs); 109 clkdm->cm_inst, clkdm->clkdm_offs);
115 110
116 if (!hwsup) 111 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
117 clkdm_sleep(clkdm); 112 omap4_clkdm_sleep(clkdm);
118 113
119 return 0; 114 return 0;
120} 115}
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index 66090f2676c..dccc651fa0d 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -565,7 +565,7 @@ static struct clockdomain ducati_44xx_clkdm = {
565}; 565};
566 566
567static struct clockdomain mpu_44xx_clkdm = { 567static struct clockdomain mpu_44xx_clkdm = {
568 .name = "mpu_clkdm", 568 .name = "mpuss_clkdm",
569 .pwrdm = { .name = "mpu_pwrdm" }, 569 .pwrdm = { .name = "mpu_pwrdm" },
570 .prcm_partition = OMAP4430_CM1_PARTITION, 570 .prcm_partition = OMAP4430_CM1_PARTITION,
571 .cm_inst = OMAP4430_CM1_MPU_INST, 571 .cm_inst = OMAP4430_CM1_MPU_INST,
diff --git a/arch/arm/mach-omap2/cm-regbits-44xx.h b/arch/arm/mach-omap2/cm-regbits-44xx.h
index 0e77945d26e..65597a74563 100644
--- a/arch/arm/mach-omap2/cm-regbits-44xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-44xx.h
@@ -101,6 +101,10 @@
101#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_SHIFT 9 101#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_SHIFT 9
102#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_MASK (1 << 9) 102#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_MASK (1 << 9)
103 103
104/* Used by CM_L4CFG_CLKSTCTRL */
105#define OMAP4460_CLKACTIVITY_CORE_TS_GFCLK_SHIFT 9
106#define OMAP4460_CLKACTIVITY_CORE_TS_GFCLK_MASK (1 << 9)
107
104/* Used by CM_CEFUSE_CLKSTCTRL */ 108/* Used by CM_CEFUSE_CLKSTCTRL */
105#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT 9 109#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT 9
106#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_MASK (1 << 9) 110#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_MASK (1 << 9)
@@ -413,6 +417,10 @@
413#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_SHIFT 11 417#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_SHIFT 11
414#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_MASK (1 << 11) 418#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_MASK (1 << 11)
415 419
420/* Used by CM_WKUP_CLKSTCTRL */
421#define OMAP4460_CLKACTIVITY_WKUP_TS_GFCLK_SHIFT 13
422#define OMAP4460_CLKACTIVITY_WKUP_TS_GFCLK_MASK (1 << 13)
423
416/* 424/*
417 * Used by CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL, 425 * Used by CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL,
418 * CM1_ABE_TIMER7_CLKCTRL, CM1_ABE_TIMER8_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, 426 * CM1_ABE_TIMER7_CLKCTRL, CM1_ABE_TIMER8_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL,
@@ -444,6 +452,10 @@
444#define OMAP4430_CLKSEL_60M_SHIFT 24 452#define OMAP4430_CLKSEL_60M_SHIFT 24
445#define OMAP4430_CLKSEL_60M_MASK (1 << 24) 453#define OMAP4430_CLKSEL_60M_MASK (1 << 24)
446 454
455/* Used by CM_MPU_MPU_CLKCTRL */
456#define OMAP4460_CLKSEL_ABE_DIV_MODE_SHIFT 25
457#define OMAP4460_CLKSEL_ABE_DIV_MODE_MASK (1 << 25)
458
447/* Used by CM1_ABE_AESS_CLKCTRL */ 459/* Used by CM1_ABE_AESS_CLKCTRL */
448#define OMAP4430_CLKSEL_AESS_FCLK_SHIFT 24 460#define OMAP4430_CLKSEL_AESS_FCLK_SHIFT 24
449#define OMAP4430_CLKSEL_AESS_FCLK_MASK (1 << 24) 461#define OMAP4430_CLKSEL_AESS_FCLK_MASK (1 << 24)
@@ -460,6 +472,10 @@
460#define OMAP4430_CLKSEL_DIV_SHIFT 24 472#define OMAP4430_CLKSEL_DIV_SHIFT 24
461#define OMAP4430_CLKSEL_DIV_MASK (1 << 24) 473#define OMAP4430_CLKSEL_DIV_MASK (1 << 24)
462 474
475/* Used by CM_MPU_MPU_CLKCTRL */
476#define OMAP4460_CLKSEL_EMIF_DIV_MODE_SHIFT 24
477#define OMAP4460_CLKSEL_EMIF_DIV_MODE_MASK (1 << 24)
478
463/* Used by CM_CAM_FDIF_CLKCTRL */ 479/* Used by CM_CAM_FDIF_CLKCTRL */
464#define OMAP4430_CLKSEL_FCLK_SHIFT 24 480#define OMAP4430_CLKSEL_FCLK_SHIFT 24
465#define OMAP4430_CLKSEL_FCLK_MASK (0x3 << 24) 481#define OMAP4430_CLKSEL_FCLK_MASK (0x3 << 24)
@@ -555,6 +571,14 @@
555#define OMAP4430_D2D_STATDEP_SHIFT 18 571#define OMAP4430_D2D_STATDEP_SHIFT 18
556#define OMAP4430_D2D_STATDEP_MASK (1 << 18) 572#define OMAP4430_D2D_STATDEP_MASK (1 << 18)
557 573
574/* Used by CM_CLKSEL_DPLL_MPU */
575#define OMAP4460_DCC_COUNT_MAX_SHIFT 24
576#define OMAP4460_DCC_COUNT_MAX_MASK (0xff << 24)
577
578/* Used by CM_CLKSEL_DPLL_MPU */
579#define OMAP4460_DCC_EN_SHIFT 22
580#define OMAP4460_DCC_EN_MASK (1 << 22)
581
558/* 582/*
559 * Used by CM_SSC_DELTAMSTEP_DPLL_ABE, CM_SSC_DELTAMSTEP_DPLL_CORE, 583 * Used by CM_SSC_DELTAMSTEP_DPLL_ABE, CM_SSC_DELTAMSTEP_DPLL_CORE,
560 * CM_SSC_DELTAMSTEP_DPLL_DDRPHY, CM_SSC_DELTAMSTEP_DPLL_IVA, 584 * CM_SSC_DELTAMSTEP_DPLL_DDRPHY, CM_SSC_DELTAMSTEP_DPLL_IVA,
@@ -564,6 +588,10 @@
564#define OMAP4430_DELTAMSTEP_SHIFT 0 588#define OMAP4430_DELTAMSTEP_SHIFT 0
565#define OMAP4430_DELTAMSTEP_MASK (0xfffff << 0) 589#define OMAP4430_DELTAMSTEP_MASK (0xfffff << 0)
566 590
591/* Renamed from DELTAMSTEP Used by CM_SSC_DELTAMSTEP_DPLL_USB */
592#define OMAP4460_DELTAMSTEP_0_20_SHIFT 0
593#define OMAP4460_DELTAMSTEP_0_20_MASK (0x1fffff << 0)
594
567/* Used by CM_DLL_CTRL */ 595/* Used by CM_DLL_CTRL */
568#define OMAP4430_DLL_OVERRIDE_SHIFT 0 596#define OMAP4430_DLL_OVERRIDE_SHIFT 0
569#define OMAP4430_DLL_OVERRIDE_MASK (1 << 0) 597#define OMAP4430_DLL_OVERRIDE_MASK (1 << 0)
@@ -1106,6 +1134,10 @@
1106#define OMAP4430_MODULEMODE_SHIFT 0 1134#define OMAP4430_MODULEMODE_SHIFT 0
1107#define OMAP4430_MODULEMODE_MASK (0x3 << 0) 1135#define OMAP4430_MODULEMODE_MASK (0x3 << 0)
1108 1136
1137/* Used by CM_L4CFG_DYNAMICDEP */
1138#define OMAP4460_MPU_DYNDEP_SHIFT 19
1139#define OMAP4460_MPU_DYNDEP_MASK (1 << 19)
1140
1109/* Used by CM_DSS_DSS_CLKCTRL */ 1141/* Used by CM_DSS_DSS_CLKCTRL */
1110#define OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT 9 1142#define OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT 9
1111#define OMAP4430_OPTFCLKEN_48MHZ_CLK_MASK (1 << 9) 1143#define OMAP4430_OPTFCLKEN_48MHZ_CLK_MASK (1 << 9)
@@ -1198,6 +1230,10 @@
1198#define OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT 10 1230#define OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT 10
1199#define OMAP4430_OPTFCLKEN_SYS_CLK_MASK (1 << 10) 1231#define OMAP4430_OPTFCLKEN_SYS_CLK_MASK (1 << 10)
1200 1232
1233/* Used by CM_WKUP_BANDGAP_CLKCTRL */
1234#define OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT 8
1235#define OMAP4460_OPTFCLKEN_TS_FCLK_MASK (1 << 8)
1236
1201/* Used by CM_DSS_DSS_CLKCTRL */ 1237/* Used by CM_DSS_DSS_CLKCTRL */
1202#define OMAP4430_OPTFCLKEN_TV_CLK_SHIFT 11 1238#define OMAP4430_OPTFCLKEN_TV_CLK_SHIFT 11
1203#define OMAP4430_OPTFCLKEN_TV_CLK_MASK (1 << 11) 1239#define OMAP4430_OPTFCLKEN_TV_CLK_MASK (1 << 11)
diff --git a/arch/arm/mach-omap2/cm44xx.h b/arch/arm/mach-omap2/cm44xx.h
index 0b87ec82b41..3380beeace6 100644
--- a/arch/arm/mach-omap2/cm44xx.h
+++ b/arch/arm/mach-omap2/cm44xx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 Clock Management (CM) definitions 2 * OMAP4 Clock Management (CM) definitions
3 * 3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc. 4 * Copyright (C) 2007-2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -23,10 +23,4 @@
23#define OMAP4_CM_CLKSTCTRL 0x0000 23#define OMAP4_CM_CLKSTCTRL 0x0000
24#define OMAP4_CM_STATICDEP 0x0004 24#define OMAP4_CM_STATICDEP 0x0004
25 25
26/* Function prototypes */
27# ifndef __ASSEMBLER__
28
29extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);
30
31# endif
32#endif 26#endif
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index a482bfa0a95..eb2a472bbf4 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -2,6 +2,7 @@
2 * OMAP4 CM instance functions 2 * OMAP4 CM instance functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * 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
@@ -32,6 +33,22 @@
32#include "prm44xx.h" 33#include "prm44xx.h"
33#include "prcm_mpu44xx.h" 34#include "prcm_mpu44xx.h"
34 35
36/*
37 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield:
38 *
39 * 0x0 func: Module is fully functional, including OCP
40 * 0x1 trans: Module is performing transition: wakeup, or sleep, or sleep
41 * abortion
42 * 0x2 idle: Module is in Idle mode (only OCP part). It is functional if
43 * using separate functional clock
44 * 0x3 disabled: Module is disabled and cannot be accessed
45 *
46 */
47#define CLKCTRL_IDLEST_FUNCTIONAL 0x0
48#define CLKCTRL_IDLEST_INTRANSITION 0x1
49#define CLKCTRL_IDLEST_INTERFACE_IDLE 0x2
50#define CLKCTRL_IDLEST_DISABLED 0x3
51
35static u32 _cm_bases[OMAP4_MAX_PRCM_PARTITIONS] = { 52static u32 _cm_bases[OMAP4_MAX_PRCM_PARTITIONS] = {
36 [OMAP4430_INVALID_PRCM_PARTITION] = 0, 53 [OMAP4430_INVALID_PRCM_PARTITION] = 0,
37 [OMAP4430_PRM_PARTITION] = OMAP4430_PRM_BASE, 54 [OMAP4430_PRM_PARTITION] = OMAP4430_PRM_BASE,
@@ -41,6 +58,48 @@ static u32 _cm_bases[OMAP4_MAX_PRCM_PARTITIONS] = {
41 [OMAP4430_PRCM_MPU_PARTITION] = OMAP4430_PRCM_MPU_BASE, 58 [OMAP4430_PRCM_MPU_PARTITION] = OMAP4430_PRCM_MPU_BASE,
42}; 59};
43 60
61/* Private functions */
62
63/**
64 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield
65 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
66 * @inst: CM instance register offset (*_INST macro)
67 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
68 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
69 *
70 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
71 * bit 0.
72 */
73static u32 _clkctrl_idlest(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs)
74{
75 u32 v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs);
76 v &= OMAP4430_IDLEST_MASK;
77 v >>= OMAP4430_IDLEST_SHIFT;
78 return v;
79}
80
81/**
82 * _is_module_ready - can module registers be accessed without causing an abort?
83 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
84 * @inst: CM instance register offset (*_INST macro)
85 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
86 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
87 *
88 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
89 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
90 */
91static bool _is_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs)
92{
93 u32 v;
94
95 v = _clkctrl_idlest(part, inst, cdoffs, clkctrl_offs);
96
97 return (v == CLKCTRL_IDLEST_FUNCTIONAL ||
98 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false;
99}
100
101/* Public functions */
102
44/* Read a register in a CM instance */ 103/* Read a register in a CM instance */
45u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx) 104u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx)
46{ 105{
@@ -200,36 +259,93 @@ void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs)
200 */ 259 */
201 260
202/** 261/**
203 * omap4_cm_wait_module_ready - wait for a module to be in 'func' state 262 * omap4_cminst_wait_module_ready - wait for a module to be in 'func' state
204 * @clkctrl_reg: CLKCTRL module address 263 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
264 * @inst: CM instance register offset (*_INST macro)
265 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
266 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
205 * 267 *
206 * Wait for the module IDLEST to be functional. If the idle state is in any 268 * Wait for the module IDLEST to be functional. If the idle state is in any
207 * the non functional state (trans, idle or disabled), module and thus the 269 * the non functional state (trans, idle or disabled), module and thus the
208 * sysconfig cannot be accessed and will probably lead to an "imprecise 270 * sysconfig cannot be accessed and will probably lead to an "imprecise
209 * external abort" 271 * external abort"
272 */
273int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs,
274 u16 clkctrl_offs)
275{
276 int i = 0;
277
278 if (!clkctrl_offs)
279 return 0;
280
281 omap_test_timeout(_is_module_ready(part, inst, cdoffs, clkctrl_offs),
282 MAX_MODULE_READY_TIME, i);
283
284 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
285}
286
287/**
288 * omap4_cminst_wait_module_idle - wait for a module to be in 'disabled'
289 * state
290 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
291 * @inst: CM instance register offset (*_INST macro)
292 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
293 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
210 * 294 *
211 * Module idle state: 295 * Wait for the module IDLEST to be disabled. Some PRCM transition,
212 * 0x0 func: Module is fully functional, including OCP 296 * like reset assertion or parent clock de-activation must wait the
213 * 0x1 trans: Module is performing transition: wakeup, or sleep, or sleep 297 * module to be fully disabled.
214 * abortion
215 * 0x2 idle: Module is in Idle mode (only OCP part). It is functional if
216 * using separate functional clock
217 * 0x3 disabled: Module is disabled and cannot be accessed
218 *
219 */ 298 */
220int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg) 299int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs)
221{ 300{
222 int i = 0; 301 int i = 0;
223 302
224 if (!clkctrl_reg) 303 if (!clkctrl_offs)
225 return 0; 304 return 0;
226 305
227 omap_test_timeout(( 306 omap_test_timeout((_clkctrl_idlest(part, inst, cdoffs, clkctrl_offs) ==
228 ((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) == 0) || 307 CLKCTRL_IDLEST_DISABLED),
229 (((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) >> 308 MAX_MODULE_READY_TIME, i);
230 OMAP4430_IDLEST_SHIFT) == 0x2)),
231 MAX_MODULE_READY_TIME, i);
232 309
233 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 310 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
234} 311}
235 312
313/**
314 * omap4_cminst_module_enable - Enable the modulemode inside CLKCTRL
315 * @mode: Module mode (SW or HW)
316 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
317 * @inst: CM instance register offset (*_INST macro)
318 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
319 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
320 *
321 * No return value.
322 */
323void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
324 u16 clkctrl_offs)
325{
326 u32 v;
327
328 v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs);
329 v &= ~OMAP4430_MODULEMODE_MASK;
330 v |= mode << OMAP4430_MODULEMODE_SHIFT;
331 omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
332}
333
334/**
335 * omap4_cminst_module_disable - Disable the module inside CLKCTRL
336 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
337 * @inst: CM instance register offset (*_INST macro)
338 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
339 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
340 *
341 * No return value.
342 */
343void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
344 u16 clkctrl_offs)
345{
346 u32 v;
347
348 v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs);
349 v &= ~OMAP4430_MODULEMODE_MASK;
350 omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
351}
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index 2b32c181a2e..a018a732787 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -17,6 +17,37 @@ extern void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs);
17extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs); 17extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs);
18extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs); 18extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs);
19 19
20extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);
21
22# ifdef CONFIG_ARCH_OMAP4
23extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
24 u16 clkctrl_offs);
25
26extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
27 u16 clkctrl_offs);
28extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
29 u16 clkctrl_offs);
30
31# else
32
33static inline int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
34 u16 clkctrl_offs)
35{
36 return 0;
37}
38
39static inline void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
40 s16 cdoffs, u16 clkctrl_offs)
41{
42}
43
44static inline void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
45 u16 clkctrl_offs)
46{
47}
48
49# endif
50
20/* 51/*
21 * In an ideal world, we would not export these low-level functions, 52 * In an ideal world, we would not export these low-level functions,
22 * but this will probably take some time to fix properly 53 * but this will probably take some time to fix properly
@@ -32,6 +63,4 @@ extern u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst,
32extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, 63extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
33 u32 mask); 64 u32 mask);
34 65
35extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);
36
37#endif 66#endif
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 5b8ca680ed9..1077ad663f9 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -230,7 +230,7 @@ struct omap_device_pm_latency omap_keyboard_latency[] = {
230}; 230};
231 231
232int __init omap4_keyboard_init(struct omap4_keypad_platform_data 232int __init omap4_keyboard_init(struct omap4_keypad_platform_data
233 *sdp4430_keypad_data) 233 *sdp4430_keypad_data, struct omap_board_data *bdata)
234{ 234{
235 struct omap_device *od; 235 struct omap_device *od;
236 struct omap_hwmod *oh; 236 struct omap_hwmod *oh;
@@ -257,6 +257,7 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
257 name, oh->name); 257 name, oh->name);
258 return PTR_ERR(od); 258 return PTR_ERR(od);
259 } 259 }
260 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
260 261
261 return 0; 262 return 0;
262} 263}
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 543fcb8b518..a5b7a236aa5 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -25,6 +25,7 @@
25#include <video/omapdss.h> 25#include <video/omapdss.h>
26#include <plat/omap_hwmod.h> 26#include <plat/omap_hwmod.h>
27#include <plat/omap_device.h> 27#include <plat/omap_device.h>
28#include <plat/omap-pm.h>
28 29
29static struct platform_device omap_display_device = { 30static struct platform_device omap_display_device = {
30 .name = "omapdss", 31 .name = "omapdss",
@@ -42,20 +43,6 @@ static struct omap_device_pm_latency omap_dss_latency[] = {
42 }, 43 },
43}; 44};
44 45
45/* oh_core is used for getting opt-clocks */
46static struct omap_hwmod *oh_core;
47
48static bool opt_clock_available(const char *clk_role)
49{
50 int i;
51
52 for (i = 0; i < oh_core->opt_clks_cnt; i++) {
53 if (!strcmp(oh_core->opt_clks[i].role, clk_role))
54 return true;
55 }
56 return false;
57}
58
59struct omap_dss_hwmod_data { 46struct omap_dss_hwmod_data {
60 const char *oh_name; 47 const char *oh_name;
61 const char *dev_name; 48 const char *dev_name;
@@ -109,16 +96,9 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
109 oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); 96 oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
110 } 97 }
111 98
112 /* opt_clks are always associated with dss hwmod */
113 oh_core = omap_hwmod_lookup("dss_core");
114 if (!oh_core) {
115 pr_err("Could not look up dss_core.\n");
116 return -ENODEV;
117 }
118
119 pdata.board_data = board_data; 99 pdata.board_data = board_data;
120 pdata.board_data->get_last_off_on_transaction_id = NULL; 100 pdata.board_data->get_context_loss_count =
121 pdata.opt_clock_available = opt_clock_available; 101 omap_pm_get_dev_context_loss_count;
122 102
123 for (i = 0; i < oh_count; i++) { 103 for (i = 0; i < oh_count; i++) {
124 oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name); 104 oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 66868c5d5a2..a9b45c76e1d 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -13,6 +13,7 @@
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/gpio.h>
16#include <mach/hardware.h> 17#include <mach/hardware.h>
17#include <plat/mmc.h> 18#include <plat/mmc.h>
18#include <plat/omap-pm.h> 19#include <plat/omap-pm.h>
@@ -213,12 +214,10 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
213static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, 214static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
214 int controller_nr) 215 int controller_nr)
215{ 216{
216 if ((mmc_controller->slots[0].switch_pin > 0) && \ 217 if (gpio_is_valid(mmc_controller->slots[0].switch_pin))
217 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
218 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, 218 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
219 OMAP_PIN_INPUT_PULLUP); 219 OMAP_PIN_INPUT_PULLUP);
220 if ((mmc_controller->slots[0].gpio_wp > 0) && \ 220 if (gpio_is_valid(mmc_controller->slots[0].gpio_wp))
221 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
222 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, 221 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
223 OMAP_PIN_INPUT_PULLUP); 222 OMAP_PIN_INPUT_PULLUP);
224 if (cpu_is_omap34xx()) { 223 if (cpu_is_omap34xx()) {
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index 79c478c4cb1..ace99944e96 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -21,9 +21,19 @@
21 21
22#include <plat/cpu.h> 22#include <plat/cpu.h>
23#include <plat/i2c.h> 23#include <plat/i2c.h>
24#include <plat/common.h>
25#include <plat/omap_hwmod.h>
24 26
25#include "mux.h" 27#include "mux.h"
26 28
29/* In register I2C_CON, Bit 15 is the I2C enable bit */
30#define I2C_EN BIT(15)
31#define OMAP2_I2C_CON_OFFSET 0x24
32#define OMAP4_I2C_CON_OFFSET 0xA4
33
34/* Maximum microseconds to wait for OMAP module to softreset */
35#define MAX_MODULE_SOFTRESET_WAIT 10000
36
27void __init omap2_i2c_mux_pins(int bus_id) 37void __init omap2_i2c_mux_pins(int bus_id)
28{ 38{
29 char mux_name[sizeof("i2c2_scl.i2c2_scl")]; 39 char mux_name[sizeof("i2c2_scl.i2c2_scl")];
@@ -37,3 +47,61 @@ void __init omap2_i2c_mux_pins(int bus_id)
37 sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id); 47 sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id);
38 omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); 48 omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
39} 49}
50
51/**
52 * omap_i2c_reset - reset the omap i2c module.
53 * @oh: struct omap_hwmod *
54 *
55 * The i2c moudle in omap2, omap3 had a special sequence to reset. The
56 * sequence is:
57 * - Disable the I2C.
58 * - Write to SOFTRESET bit.
59 * - Enable the I2C.
60 * - Poll on the RESETDONE bit.
61 * The sequence is implemented in below function. This is called for 2420,
62 * 2430 and omap3.
63 */
64int omap_i2c_reset(struct omap_hwmod *oh)
65{
66 u32 v;
67 u16 i2c_con;
68 int c = 0;
69
70 if (oh->class->rev == OMAP_I2C_IP_VERSION_2) {
71 i2c_con = OMAP4_I2C_CON_OFFSET;
72 } else if (oh->class->rev == OMAP_I2C_IP_VERSION_1) {
73 i2c_con = OMAP2_I2C_CON_OFFSET;
74 } else {
75 WARN(1, "Cannot reset I2C block %s: unsupported revision\n",
76 oh->name);
77 return -EINVAL;
78 }
79
80 /* Disable I2C */
81 v = omap_hwmod_read(oh, i2c_con);
82 v &= ~I2C_EN;
83 omap_hwmod_write(v, oh, i2c_con);
84
85 /* Write to the SOFTRESET bit */
86 omap_hwmod_softreset(oh);
87
88 /* Enable I2C */
89 v = omap_hwmod_read(oh, i2c_con);
90 v |= I2C_EN;
91 omap_hwmod_write(v, oh, i2c_con);
92
93 /* Poll on RESETDONE bit */
94 omap_test_timeout((omap_hwmod_read(oh,
95 oh->class->sysc->syss_offs)
96 & SYSS_RESETDONE_MASK),
97 MAX_MODULE_SOFTRESET_WAIT, c);
98
99 if (c == MAX_MODULE_SOFTRESET_WAIT)
100 pr_warning("%s: %s: softreset failed (waited %d usec)\n",
101 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
102 else
103 pr_debug("%s: %s: softreset in %d usec\n", __func__,
104 oh->name, c);
105
106 return 0;
107}
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 2537090aa33..37efb869692 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -31,7 +31,7 @@
31static struct omap_chip_id omap_chip; 31static struct omap_chip_id omap_chip;
32static unsigned int omap_revision; 32static unsigned int omap_revision;
33 33
34u32 omap3_features; 34u32 omap_features;
35 35
36unsigned int omap_rev(void) 36unsigned int omap_rev(void)
37{ 37{
@@ -183,14 +183,14 @@ static void __init omap24xx_check_revision(void)
183#define OMAP3_CHECK_FEATURE(status,feat) \ 183#define OMAP3_CHECK_FEATURE(status,feat) \
184 if (((status & OMAP3_ ##feat## _MASK) \ 184 if (((status & OMAP3_ ##feat## _MASK) \
185 >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \ 185 >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \
186 omap3_features |= OMAP3_HAS_ ##feat; \ 186 omap_features |= OMAP3_HAS_ ##feat; \
187 } 187 }
188 188
189static void __init omap3_check_features(void) 189static void __init omap3_check_features(void)
190{ 190{
191 u32 status; 191 u32 status;
192 192
193 omap3_features = 0; 193 omap_features = 0;
194 194
195 status = omap_ctrl_readl(OMAP3_CONTROL_OMAP_STATUS); 195 status = omap_ctrl_readl(OMAP3_CONTROL_OMAP_STATUS);
196 196
@@ -200,11 +200,11 @@ static void __init omap3_check_features(void)
200 OMAP3_CHECK_FEATURE(status, NEON); 200 OMAP3_CHECK_FEATURE(status, NEON);
201 OMAP3_CHECK_FEATURE(status, ISP); 201 OMAP3_CHECK_FEATURE(status, ISP);
202 if (cpu_is_omap3630()) 202 if (cpu_is_omap3630())
203 omap3_features |= OMAP3_HAS_192MHZ_CLK; 203 omap_features |= OMAP3_HAS_192MHZ_CLK;
204 if (!cpu_is_omap3505() && !cpu_is_omap3517()) 204 if (!cpu_is_omap3505() && !cpu_is_omap3517())
205 omap3_features |= OMAP3_HAS_IO_WAKEUP; 205 omap_features |= OMAP3_HAS_IO_WAKEUP;
206 206
207 omap3_features |= OMAP3_HAS_SDRC; 207 omap_features |= OMAP3_HAS_SDRC;
208 208
209 /* 209 /*
210 * TODO: Get additional info (where applicable) 210 * TODO: Get additional info (where applicable)
@@ -212,9 +212,34 @@ static void __init omap3_check_features(void)
212 */ 212 */
213} 213}
214 214
215static void __init omap4_check_features(void)
216{
217 u32 si_type;
218
219 if (cpu_is_omap443x())
220 omap_features |= OMAP4_HAS_MPU_1GHZ;
221
222
223 if (cpu_is_omap446x()) {
224 si_type =
225 read_tap_reg(OMAP4_CTRL_MODULE_CORE_STD_FUSE_PROD_ID_1);
226 switch ((si_type & (3 << 16)) >> 16) {
227 case 2:
228 /* High performance device */
229 omap_features |= OMAP4_HAS_MPU_1_5GHZ;
230 break;
231 case 1:
232 default:
233 /* Standard device */
234 omap_features |= OMAP4_HAS_MPU_1_2GHZ;
235 break;
236 }
237 }
238}
239
215static void __init ti816x_check_features(void) 240static void __init ti816x_check_features(void)
216{ 241{
217 omap3_features = OMAP3_HAS_NEON; 242 omap_features = OMAP3_HAS_NEON;
218} 243}
219 244
220static void __init omap3_check_revision(void) 245static void __init omap3_check_revision(void)
@@ -344,10 +369,10 @@ static void __init omap4_check_revision(void)
344 rev = (idcode >> 28) & 0xf; 369 rev = (idcode >> 28) & 0xf;
345 370
346 /* 371 /*
347 * Few initial ES2.0 samples IDCODE is same as ES1.0 372 * Few initial 4430 ES2.0 samples IDCODE is same as ES1.0
348 * Use ARM register to detect the correct ES version 373 * Use ARM register to detect the correct ES version
349 */ 374 */
350 if (!rev) { 375 if (!rev && (hawkeye != 0xb94e)) {
351 idcode = read_cpuid(CPUID_ID); 376 idcode = read_cpuid(CPUID_ID);
352 rev = (idcode & 0xf) - 1; 377 rev = (idcode & 0xf) - 1;
353 } 378 }
@@ -377,6 +402,15 @@ static void __init omap4_check_revision(void)
377 omap_chip.oc |= CHIP_IS_OMAP4430ES2_2; 402 omap_chip.oc |= CHIP_IS_OMAP4430ES2_2;
378 } 403 }
379 break; 404 break;
405 case 0xb94e:
406 switch (rev) {
407 case 0:
408 default:
409 omap_revision = OMAP4460_REV_ES1_0;
410 omap_chip.oc |= CHIP_IS_OMAP4460ES1_0;
411 break;
412 }
413 break;
380 default: 414 default:
381 /* Unknown default to latest silicon rev as default */ 415 /* Unknown default to latest silicon rev as default */
382 omap_revision = OMAP4430_REV_ES2_2; 416 omap_revision = OMAP4430_REV_ES2_2;
@@ -518,6 +552,7 @@ void __init omap2_check_revision(void)
518 return; 552 return;
519 } else if (cpu_is_omap44xx()) { 553 } else if (cpu_is_omap44xx()) {
520 omap4_check_revision(); 554 omap4_check_revision();
555 omap4_check_features();
521 return; 556 return;
522 } else { 557 } else {
523 pr_err("OMAP revision unknown, please fix!\n"); 558 pr_err("OMAP revision unknown, please fix!\n");
diff --git a/arch/arm/mach-omap2/include/mach/clkdev.h b/arch/arm/mach-omap2/include/mach/clkdev.h
deleted file mode 100644
index 53b027441c5..00000000000
--- a/arch/arm/mach-omap2/include/mach/clkdev.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * arch/arm/mach-omap2/include/mach/clkdev.h
3 */
4
5#include <plat/clkdev.h>
diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c
index adb083e41ac..f286012783c 100644
--- a/arch/arm/mach-omap2/iommu2.c
+++ b/arch/arm/mach-omap2/iommu2.c
@@ -225,8 +225,8 @@ static u32 omap2_get_pte_attr(struct iotlb_entry *e)
225 attr = e->mixed << 5; 225 attr = e->mixed << 5;
226 attr |= e->endian; 226 attr |= e->endian;
227 attr |= e->elsz >> 3; 227 attr |= e->elsz >> 3;
228 attr <<= ((e->pgsz & MMU_CAM_PGSZ_4K) ? 0 : 6); 228 attr <<= (((e->pgsz == MMU_CAM_PGSZ_4K) ||
229 229 (e->pgsz == MMU_CAM_PGSZ_64K)) ? 0 : 6);
230 return attr; 230 return attr;
231} 231}
232 232
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index c7fb22abc21..655e9480eb9 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -821,11 +821,10 @@ static void __init omap_mux_set_cmdline_signals(void)
821 if (!omap_mux_options) 821 if (!omap_mux_options)
822 return; 822 return;
823 823
824 options = kmalloc(strlen(omap_mux_options) + 1, GFP_KERNEL); 824 options = kstrdup(omap_mux_options, GFP_KERNEL);
825 if (!options) 825 if (!options)
826 return; 826 return;
827 827
828 strcpy(options, omap_mux_options);
829 next_opt = options; 828 next_opt = options;
830 829
831 while ((token = strsep(&next_opt, ",")) != NULL) { 830 while ((token = strsep(&next_opt, ",")) != NULL) {
@@ -855,24 +854,19 @@ static int __init omap_mux_copy_names(struct omap_mux *src,
855 854
856 for (i = 0; i < OMAP_MUX_NR_MODES; i++) { 855 for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
857 if (src->muxnames[i]) { 856 if (src->muxnames[i]) {
858 dst->muxnames[i] = 857 dst->muxnames[i] = kstrdup(src->muxnames[i],
859 kmalloc(strlen(src->muxnames[i]) + 1, 858 GFP_KERNEL);
860 GFP_KERNEL);
861 if (!dst->muxnames[i]) 859 if (!dst->muxnames[i])
862 goto free; 860 goto free;
863 strcpy(dst->muxnames[i], src->muxnames[i]);
864 } 861 }
865 } 862 }
866 863
867#ifdef CONFIG_DEBUG_FS 864#ifdef CONFIG_DEBUG_FS
868 for (i = 0; i < OMAP_MUX_NR_SIDES; i++) { 865 for (i = 0; i < OMAP_MUX_NR_SIDES; i++) {
869 if (src->balls[i]) { 866 if (src->balls[i]) {
870 dst->balls[i] = 867 dst->balls[i] = kstrdup(src->balls[i], GFP_KERNEL);
871 kmalloc(strlen(src->balls[i]) + 1,
872 GFP_KERNEL);
873 if (!dst->balls[i]) 868 if (!dst->balls[i])
874 goto free; 869 goto free;
875 strcpy(dst->balls[i], src->balls[i]);
876 } 870 }
877 } 871 }
878#endif 872#endif
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index 3fc5dc7233d..e61feadcda4 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -67,7 +67,7 @@ static struct iommu_device omap4_devices[] = {
67 .pdata = { 67 .pdata = {
68 .name = "ducati", 68 .name = "ducati",
69 .nr_tlb_entries = 32, 69 .nr_tlb_entries = 32,
70 .clk_name = "ducati_ick", 70 .clk_name = "ipu_fck",
71 .da_start = 0x0, 71 .da_start = 0x0,
72 .da_end = 0xFFFFF000, 72 .da_end = 0xFFFFF000,
73 }, 73 },
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 7d242c9e2a2..84cc0bdda3a 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -146,9 +146,10 @@
146#include <plat/prcm.h> 146#include <plat/prcm.h>
147 147
148#include "cm2xxx_3xxx.h" 148#include "cm2xxx_3xxx.h"
149#include "cm44xx.h" 149#include "cminst44xx.h"
150#include "prm2xxx_3xxx.h" 150#include "prm2xxx_3xxx.h"
151#include "prm44xx.h" 151#include "prm44xx.h"
152#include "prminst44xx.h"
152#include "mux.h" 153#include "mux.h"
153 154
154/* Maximum microseconds to wait for OMAP module to softreset */ 155/* Maximum microseconds to wait for OMAP module to softreset */
@@ -679,6 +680,56 @@ static void _disable_optional_clocks(struct omap_hwmod *oh)
679} 680}
680 681
681/** 682/**
683 * _enable_module - enable CLKCTRL modulemode on OMAP4
684 * @oh: struct omap_hwmod *
685 *
686 * Enables the PRCM module mode related to the hwmod @oh.
687 * No return value.
688 */
689static void _enable_module(struct omap_hwmod *oh)
690{
691 /* The module mode does not exist prior OMAP4 */
692 if (cpu_is_omap24xx() || cpu_is_omap34xx())
693 return;
694
695 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
696 return;
697
698 pr_debug("omap_hwmod: %s: _enable_module: %d\n",
699 oh->name, oh->prcm.omap4.modulemode);
700
701 omap4_cminst_module_enable(oh->prcm.omap4.modulemode,
702 oh->clkdm->prcm_partition,
703 oh->clkdm->cm_inst,
704 oh->clkdm->clkdm_offs,
705 oh->prcm.omap4.clkctrl_offs);
706}
707
708/**
709 * _disable_module - enable CLKCTRL modulemode on OMAP4
710 * @oh: struct omap_hwmod *
711 *
712 * Disable the PRCM module mode related to the hwmod @oh.
713 * No return value.
714 */
715static void _disable_module(struct omap_hwmod *oh)
716{
717 /* The module mode does not exist prior OMAP4 */
718 if (cpu_is_omap24xx() || cpu_is_omap34xx())
719 return;
720
721 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
722 return;
723
724 pr_debug("omap_hwmod: %s: _disable_module\n", oh->name);
725
726 omap4_cminst_module_disable(oh->clkdm->prcm_partition,
727 oh->clkdm->cm_inst,
728 oh->clkdm->clkdm_offs,
729 oh->prcm.omap4.clkctrl_offs);
730}
731
732/**
682 * _count_mpu_irqs - count the number of MPU IRQ lines associated with @oh 733 * _count_mpu_irqs - count the number of MPU IRQ lines associated with @oh
683 * @oh: struct omap_hwmod *oh 734 * @oh: struct omap_hwmod *oh
684 * 735 *
@@ -990,9 +1041,40 @@ static struct omap_hwmod *_lookup(const char *name)
990 1041
991 return oh; 1042 return oh;
992} 1043}
1044/**
1045 * _init_clkdm - look up a clockdomain name, store pointer in omap_hwmod
1046 * @oh: struct omap_hwmod *
1047 *
1048 * Convert a clockdomain name stored in a struct omap_hwmod into a
1049 * clockdomain pointer, and save it into the struct omap_hwmod.
1050 * return -EINVAL if clkdm_name does not exist or if the lookup failed.
1051 */
1052static int _init_clkdm(struct omap_hwmod *oh)
1053{
1054 if (cpu_is_omap24xx() || cpu_is_omap34xx())
1055 return 0;
1056
1057 if (!oh->clkdm_name) {
1058 pr_warning("omap_hwmod: %s: no clkdm_name\n", oh->name);
1059 return -EINVAL;
1060 }
1061
1062 oh->clkdm = clkdm_lookup(oh->clkdm_name);
1063 if (!oh->clkdm) {
1064 pr_warning("omap_hwmod: %s: could not associate to clkdm %s\n",
1065 oh->name, oh->clkdm_name);
1066 return -EINVAL;
1067 }
1068
1069 pr_debug("omap_hwmod: %s: associated to clkdm %s\n",
1070 oh->name, oh->clkdm_name);
1071
1072 return 0;
1073}
993 1074
994/** 1075/**
995 * _init_clocks - clk_get() all clocks associated with this hwmod 1076 * _init_clocks - clk_get() all clocks associated with this hwmod. Retrieve as
1077 * well the clockdomain.
996 * @oh: struct omap_hwmod * 1078 * @oh: struct omap_hwmod *
997 * @data: not used; pass NULL 1079 * @data: not used; pass NULL
998 * 1080 *
@@ -1012,6 +1094,7 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1012 ret |= _init_main_clk(oh); 1094 ret |= _init_main_clk(oh);
1013 ret |= _init_interface_clks(oh); 1095 ret |= _init_interface_clks(oh);
1014 ret |= _init_opt_clks(oh); 1096 ret |= _init_opt_clks(oh);
1097 ret |= _init_clkdm(oh);
1015 1098
1016 if (!ret) 1099 if (!ret)
1017 oh->_state = _HWMOD_STATE_CLKS_INITED; 1100 oh->_state = _HWMOD_STATE_CLKS_INITED;
@@ -1028,7 +1111,7 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1028 * Wait for a module @oh to leave slave idle. Returns 0 if the module 1111 * Wait for a module @oh to leave slave idle. Returns 0 if the module
1029 * does not have an IDLEST bit or if the module successfully leaves 1112 * does not have an IDLEST bit or if the module successfully leaves
1030 * slave idle; otherwise, pass along the return value of the 1113 * slave idle; otherwise, pass along the return value of the
1031 * appropriate *_cm_wait_module_ready() function. 1114 * appropriate *_cm*_wait_module_ready() function.
1032 */ 1115 */
1033static int _wait_target_ready(struct omap_hwmod *oh) 1116static int _wait_target_ready(struct omap_hwmod *oh)
1034{ 1117{
@@ -1055,7 +1138,13 @@ static int _wait_target_ready(struct omap_hwmod *oh)
1055 oh->prcm.omap2.idlest_reg_id, 1138 oh->prcm.omap2.idlest_reg_id,
1056 oh->prcm.omap2.idlest_idle_bit); 1139 oh->prcm.omap2.idlest_idle_bit);
1057 } else if (cpu_is_omap44xx()) { 1140 } else if (cpu_is_omap44xx()) {
1058 ret = omap4_cm_wait_module_ready(oh->prcm.omap4.clkctrl_reg); 1141 if (!oh->clkdm)
1142 return -EINVAL;
1143
1144 ret = omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition,
1145 oh->clkdm->cm_inst,
1146 oh->clkdm->clkdm_offs,
1147 oh->prcm.omap4.clkctrl_offs);
1059 } else { 1148 } else {
1060 BUG(); 1149 BUG();
1061 }; 1150 };
@@ -1064,6 +1153,36 @@ static int _wait_target_ready(struct omap_hwmod *oh)
1064} 1153}
1065 1154
1066/** 1155/**
1156 * _wait_target_disable - wait for a module to be disabled
1157 * @oh: struct omap_hwmod *
1158 *
1159 * Wait for a module @oh to enter slave idle. Returns 0 if the module
1160 * does not have an IDLEST bit or if the module successfully enters
1161 * slave idle; otherwise, pass along the return value of the
1162 * appropriate *_cm*_wait_module_idle() function.
1163 */
1164static int _wait_target_disable(struct omap_hwmod *oh)
1165{
1166 /* TODO: For now just handle OMAP4+ */
1167 if (cpu_is_omap24xx() || cpu_is_omap34xx())
1168 return 0;
1169
1170 if (!oh)
1171 return -EINVAL;
1172
1173 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
1174 return 0;
1175
1176 if (oh->flags & HWMOD_NO_IDLEST)
1177 return 0;
1178
1179 return omap4_cminst_wait_module_idle(oh->clkdm->prcm_partition,
1180 oh->clkdm->cm_inst,
1181 oh->clkdm->clkdm_offs,
1182 oh->prcm.omap4.clkctrl_offs);
1183}
1184
1185/**
1067 * _lookup_hardreset - fill register bit info for this hwmod/reset line 1186 * _lookup_hardreset - fill register bit info for this hwmod/reset line
1068 * @oh: struct omap_hwmod * 1187 * @oh: struct omap_hwmod *
1069 * @name: name of the reset line in the context of this hwmod 1188 * @name: name of the reset line in the context of this hwmod
@@ -1119,8 +1238,10 @@ static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1119 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, 1238 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs,
1120 ohri.rst_shift); 1239 ohri.rst_shift);
1121 else if (cpu_is_omap44xx()) 1240 else if (cpu_is_omap44xx())
1122 return omap4_prm_assert_hardreset(oh->prcm.omap4.rstctrl_reg, 1241 return omap4_prminst_assert_hardreset(ohri.rst_shift,
1123 ohri.rst_shift); 1242 oh->clkdm->pwrdm.ptr->prcm_partition,
1243 oh->clkdm->pwrdm.ptr->prcm_offs,
1244 oh->prcm.omap4.rstctrl_offs);
1124 else 1245 else
1125 return -EINVAL; 1246 return -EINVAL;
1126} 1247}
@@ -1155,8 +1276,10 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1155 if (ohri.st_shift) 1276 if (ohri.st_shift)
1156 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", 1277 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
1157 oh->name, name); 1278 oh->name, name);
1158 ret = omap4_prm_deassert_hardreset(oh->prcm.omap4.rstctrl_reg, 1279 ret = omap4_prminst_deassert_hardreset(ohri.rst_shift,
1159 ohri.rst_shift); 1280 oh->clkdm->pwrdm.ptr->prcm_partition,
1281 oh->clkdm->pwrdm.ptr->prcm_offs,
1282 oh->prcm.omap4.rstctrl_offs);
1160 } else { 1283 } else {
1161 return -EINVAL; 1284 return -EINVAL;
1162 } 1285 }
@@ -1191,8 +1314,10 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1191 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs, 1314 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs,
1192 ohri.st_shift); 1315 ohri.st_shift);
1193 } else if (cpu_is_omap44xx()) { 1316 } else if (cpu_is_omap44xx()) {
1194 return omap4_prm_is_hardreset_asserted(oh->prcm.omap4.rstctrl_reg, 1317 return omap4_prminst_is_hardreset_asserted(ohri.rst_shift,
1195 ohri.rst_shift); 1318 oh->clkdm->pwrdm.ptr->prcm_partition,
1319 oh->clkdm->pwrdm.ptr->prcm_offs,
1320 oh->prcm.omap4.rstctrl_offs);
1196 } else { 1321 } else {
1197 return -EINVAL; 1322 return -EINVAL;
1198 } 1323 }
@@ -1312,6 +1437,7 @@ static int _reset(struct omap_hwmod *oh)
1312static int _enable(struct omap_hwmod *oh) 1437static int _enable(struct omap_hwmod *oh)
1313{ 1438{
1314 int r; 1439 int r;
1440 int hwsup = 0;
1315 1441
1316 pr_debug("omap_hwmod: %s: enabling\n", oh->name); 1442 pr_debug("omap_hwmod: %s: enabling\n", oh->name);
1317 1443
@@ -1323,14 +1449,6 @@ static int _enable(struct omap_hwmod *oh)
1323 return -EINVAL; 1449 return -EINVAL;
1324 } 1450 }
1325 1451
1326 /* Mux pins for device runtime if populated */
1327 if (oh->mux && (!oh->mux->enabled ||
1328 ((oh->_state == _HWMOD_STATE_IDLE) &&
1329 oh->mux->pads_dynamic)))
1330 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
1331
1332 _add_initiator_dep(oh, mpu_oh);
1333 _enable_clocks(oh);
1334 1452
1335 /* 1453 /*
1336 * If an IP contains only one HW reset line, then de-assert it in order 1454 * If an IP contains only one HW reset line, then de-assert it in order
@@ -1341,22 +1459,56 @@ static int _enable(struct omap_hwmod *oh)
1341 oh->_state == _HWMOD_STATE_DISABLED) && oh->rst_lines_cnt == 1) 1459 oh->_state == _HWMOD_STATE_DISABLED) && oh->rst_lines_cnt == 1)
1342 _deassert_hardreset(oh, oh->rst_lines[0].name); 1460 _deassert_hardreset(oh, oh->rst_lines[0].name);
1343 1461
1344 r = _wait_target_ready(oh); 1462 /* Mux pins for device runtime if populated */
1345 if (r) { 1463 if (oh->mux && (!oh->mux->enabled ||
1346 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", 1464 ((oh->_state == _HWMOD_STATE_IDLE) &&
1347 oh->name, r); 1465 oh->mux->pads_dynamic)))
1348 _disable_clocks(oh); 1466 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
1467
1468 _add_initiator_dep(oh, mpu_oh);
1349 1469
1350 return r; 1470 if (oh->clkdm) {
1471 /*
1472 * A clockdomain must be in SW_SUP before enabling
1473 * completely the module. The clockdomain can be set
1474 * in HW_AUTO only when the module become ready.
1475 */
1476 hwsup = clkdm_in_hwsup(oh->clkdm);
1477 r = clkdm_hwmod_enable(oh->clkdm, oh);
1478 if (r) {
1479 WARN(1, "omap_hwmod: %s: could not enable clockdomain %s: %d\n",
1480 oh->name, oh->clkdm->name, r);
1481 return r;
1482 }
1351 } 1483 }
1352 1484
1353 oh->_state = _HWMOD_STATE_ENABLED; 1485 _enable_clocks(oh);
1486 _enable_module(oh);
1487
1488 r = _wait_target_ready(oh);
1489 if (!r) {
1490 /*
1491 * Set the clockdomain to HW_AUTO only if the target is ready,
1492 * assuming that the previous state was HW_AUTO
1493 */
1494 if (oh->clkdm && hwsup)
1495 clkdm_allow_idle(oh->clkdm);
1496
1497 oh->_state = _HWMOD_STATE_ENABLED;
1354 1498
1355 /* Access the sysconfig only if the target is ready */ 1499 /* Access the sysconfig only if the target is ready */
1356 if (oh->class->sysc) { 1500 if (oh->class->sysc) {
1357 if (!(oh->_int_flags & _HWMOD_SYSCONFIG_LOADED)) 1501 if (!(oh->_int_flags & _HWMOD_SYSCONFIG_LOADED))
1358 _update_sysc_cache(oh); 1502 _update_sysc_cache(oh);
1359 _enable_sysc(oh); 1503 _enable_sysc(oh);
1504 }
1505 } else {
1506 _disable_clocks(oh);
1507 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",
1508 oh->name, r);
1509
1510 if (oh->clkdm)
1511 clkdm_hwmod_disable(oh->clkdm, oh);
1360 } 1512 }
1361 1513
1362 return r; 1514 return r;
@@ -1372,6 +1524,8 @@ static int _enable(struct omap_hwmod *oh)
1372 */ 1524 */
1373static int _idle(struct omap_hwmod *oh) 1525static int _idle(struct omap_hwmod *oh)
1374{ 1526{
1527 int ret;
1528
1375 pr_debug("omap_hwmod: %s: idling\n", oh->name); 1529 pr_debug("omap_hwmod: %s: idling\n", oh->name);
1376 1530
1377 if (oh->_state != _HWMOD_STATE_ENABLED) { 1531 if (oh->_state != _HWMOD_STATE_ENABLED) {
@@ -1383,7 +1537,20 @@ static int _idle(struct omap_hwmod *oh)
1383 if (oh->class->sysc) 1537 if (oh->class->sysc)
1384 _idle_sysc(oh); 1538 _idle_sysc(oh);
1385 _del_initiator_dep(oh, mpu_oh); 1539 _del_initiator_dep(oh, mpu_oh);
1540 _disable_module(oh);
1541 ret = _wait_target_disable(oh);
1542 if (ret)
1543 pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
1544 oh->name);
1545 /*
1546 * The module must be in idle mode before disabling any parents
1547 * clocks. Otherwise, the parent clock might be disabled before
1548 * the module transition is done, and thus will prevent the
1549 * transition to complete properly.
1550 */
1386 _disable_clocks(oh); 1551 _disable_clocks(oh);
1552 if (oh->clkdm)
1553 clkdm_hwmod_disable(oh->clkdm, oh);
1387 1554
1388 /* Mux pins for device idle if populated */ 1555 /* Mux pins for device idle if populated */
1389 if (oh->mux && oh->mux->pads_dynamic) 1556 if (oh->mux && oh->mux->pads_dynamic)
@@ -1475,7 +1642,14 @@ static int _shutdown(struct omap_hwmod *oh)
1475 if (oh->_state == _HWMOD_STATE_ENABLED) { 1642 if (oh->_state == _HWMOD_STATE_ENABLED) {
1476 _del_initiator_dep(oh, mpu_oh); 1643 _del_initiator_dep(oh, mpu_oh);
1477 /* XXX what about the other system initiators here? dma, dsp */ 1644 /* XXX what about the other system initiators here? dma, dsp */
1645 _disable_module(oh);
1646 ret = _wait_target_disable(oh);
1647 if (ret)
1648 pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
1649 oh->name);
1478 _disable_clocks(oh); 1650 _disable_clocks(oh);
1651 if (oh->clkdm)
1652 clkdm_hwmod_disable(oh->clkdm, oh);
1479 } 1653 }
1480 /* XXX Should this code also force-disable the optional clocks? */ 1654 /* XXX Should this code also force-disable the optional clocks? */
1481 1655
@@ -1656,6 +1830,33 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
1656} 1830}
1657 1831
1658/** 1832/**
1833 * omap_hwmod_softreset - reset a module via SYSCONFIG.SOFTRESET bit
1834 * @oh: struct omap_hwmod *
1835 *
1836 * This is a public function exposed to drivers. Some drivers may need to do
1837 * some settings before and after resetting the device. Those drivers after
1838 * doing the necessary settings could use this function to start a reset by
1839 * setting the SYSCONFIG.SOFTRESET bit.
1840 */
1841int omap_hwmod_softreset(struct omap_hwmod *oh)
1842{
1843 u32 v;
1844 int ret;
1845
1846 if (!oh || !(oh->_sysc_cache))
1847 return -EINVAL;
1848
1849 v = oh->_sysc_cache;
1850 ret = _set_softreset(oh, &v);
1851 if (ret)
1852 goto error;
1853 _write_sysconfig(v, oh);
1854
1855error:
1856 return ret;
1857}
1858
1859/**
1659 * omap_hwmod_set_slave_idlemode - set the hwmod's OCP slave idlemode 1860 * omap_hwmod_set_slave_idlemode - set the hwmod's OCP slave idlemode
1660 * @oh: struct omap_hwmod * 1861 * @oh: struct omap_hwmod *
1661 * @idlemode: SIDLEMODE field bits (shifted to bit 0) 1862 * @idlemode: SIDLEMODE field bits (shifted to bit 0)
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index f3901abf2c2..a015c69068f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -1029,9 +1029,16 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
1029static struct omap_hwmod_class i2c_class = { 1029static struct omap_hwmod_class i2c_class = {
1030 .name = "i2c", 1030 .name = "i2c",
1031 .sysc = &i2c_sysc, 1031 .sysc = &i2c_sysc,
1032 .rev = OMAP_I2C_IP_VERSION_1,
1033 .reset = &omap_i2c_reset,
1032}; 1034};
1033 1035
1034static struct omap_i2c_dev_attr i2c_dev_attr; 1036static struct omap_i2c_dev_attr i2c_dev_attr = {
1037 .flags = OMAP_I2C_FLAG_NO_FIFO |
1038 OMAP_I2C_FLAG_SIMPLE_CLOCK |
1039 OMAP_I2C_FLAG_16BIT_DATA_REG |
1040 OMAP_I2C_FLAG_BUS_SHIFT_2,
1041};
1035 1042
1036/* I2C1 */ 1043/* I2C1 */
1037 1044
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 2a52f025bd0..408193d8e04 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -192,6 +192,7 @@ static struct omap_hwmod_addr_space omap2430_usbhsotg_addrs[] = {
192 .pa_end = OMAP243X_HS_BASE + SZ_4K - 1, 192 .pa_end = OMAP243X_HS_BASE + SZ_4K - 1,
193 .flags = ADDR_TYPE_RT 193 .flags = ADDR_TYPE_RT
194 }, 194 },
195 { }
195}; 196};
196 197
197/* l4_core ->usbhsotg interface */ 198/* l4_core ->usbhsotg interface */
@@ -1078,10 +1079,15 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
1078static struct omap_hwmod_class i2c_class = { 1079static struct omap_hwmod_class i2c_class = {
1079 .name = "i2c", 1080 .name = "i2c",
1080 .sysc = &i2c_sysc, 1081 .sysc = &i2c_sysc,
1082 .rev = OMAP_I2C_IP_VERSION_1,
1083 .reset = &omap_i2c_reset,
1081}; 1084};
1082 1085
1083static struct omap_i2c_dev_attr i2c_dev_attr = { 1086static struct omap_i2c_dev_attr i2c_dev_attr = {
1084 .fifo_depth = 8, /* bytes */ 1087 .fifo_depth = 8, /* bytes */
1088 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
1089 OMAP_I2C_FLAG_BUS_SHIFT_2 |
1090 OMAP_I2C_FLAG_FORCE_19200_INT_CLK,
1085}; 1091};
1086 1092
1087/* I2C1 */ 1093/* I2C1 */
@@ -1092,6 +1098,7 @@ static struct omap_hwmod_ocp_if *omap2430_i2c1_slaves[] = {
1092 1098
1093static struct omap_hwmod omap2430_i2c1_hwmod = { 1099static struct omap_hwmod omap2430_i2c1_hwmod = {
1094 .name = "i2c1", 1100 .name = "i2c1",
1101 .flags = HWMOD_16BIT_REG,
1095 .mpu_irqs = omap2_i2c1_mpu_irqs, 1102 .mpu_irqs = omap2_i2c1_mpu_irqs,
1096 .sdma_reqs = omap2_i2c1_sdma_reqs, 1103 .sdma_reqs = omap2_i2c1_sdma_reqs,
1097 .main_clk = "i2chs1_fck", 1104 .main_clk = "i2chs1_fck",
@@ -1127,6 +1134,7 @@ static struct omap_hwmod_ocp_if *omap2430_i2c2_slaves[] = {
1127 1134
1128static struct omap_hwmod omap2430_i2c2_hwmod = { 1135static struct omap_hwmod omap2430_i2c2_hwmod = {
1129 .name = "i2c2", 1136 .name = "i2c2",
1137 .flags = HWMOD_16BIT_REG,
1130 .mpu_irqs = omap2_i2c2_mpu_irqs, 1138 .mpu_irqs = omap2_i2c2_mpu_irqs,
1131 .sdma_reqs = omap2_i2c2_sdma_reqs, 1139 .sdma_reqs = omap2_i2c2_sdma_reqs,
1132 .main_clk = "i2chs2_fck", 1140 .main_clk = "i2chs2_fck",
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 1a52716e48b..25bf43b5a4e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -1306,8 +1306,10 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
1306}; 1306};
1307 1307
1308static struct omap_hwmod_class i2c_class = { 1308static struct omap_hwmod_class i2c_class = {
1309 .name = "i2c", 1309 .name = "i2c",
1310 .sysc = &i2c_sysc, 1310 .sysc = &i2c_sysc,
1311 .rev = OMAP_I2C_IP_VERSION_1,
1312 .reset = &omap_i2c_reset,
1311}; 1313};
1312 1314
1313static struct omap_hwmod_dma_info omap3xxx_dss_sdma_chs[] = { 1315static struct omap_hwmod_dma_info omap3xxx_dss_sdma_chs[] = {
@@ -1607,6 +1609,9 @@ static struct omap_hwmod omap3xxx_dss_venc_hwmod = {
1607 1609
1608static struct omap_i2c_dev_attr i2c1_dev_attr = { 1610static struct omap_i2c_dev_attr i2c1_dev_attr = {
1609 .fifo_depth = 8, /* bytes */ 1611 .fifo_depth = 8, /* bytes */
1612 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
1613 OMAP_I2C_FLAG_RESET_REGS_POSTIDLE |
1614 OMAP_I2C_FLAG_BUS_SHIFT_2,
1610}; 1615};
1611 1616
1612static struct omap_hwmod_ocp_if *omap3xxx_i2c1_slaves[] = { 1617static struct omap_hwmod_ocp_if *omap3xxx_i2c1_slaves[] = {
@@ -1615,6 +1620,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c1_slaves[] = {
1615 1620
1616static struct omap_hwmod omap3xxx_i2c1_hwmod = { 1621static struct omap_hwmod omap3xxx_i2c1_hwmod = {
1617 .name = "i2c1", 1622 .name = "i2c1",
1623 .flags = HWMOD_16BIT_REG,
1618 .mpu_irqs = omap2_i2c1_mpu_irqs, 1624 .mpu_irqs = omap2_i2c1_mpu_irqs,
1619 .sdma_reqs = omap2_i2c1_sdma_reqs, 1625 .sdma_reqs = omap2_i2c1_sdma_reqs,
1620 .main_clk = "i2c1_fck", 1626 .main_clk = "i2c1_fck",
@@ -1638,6 +1644,9 @@ static struct omap_hwmod omap3xxx_i2c1_hwmod = {
1638 1644
1639static struct omap_i2c_dev_attr i2c2_dev_attr = { 1645static struct omap_i2c_dev_attr i2c2_dev_attr = {
1640 .fifo_depth = 8, /* bytes */ 1646 .fifo_depth = 8, /* bytes */
1647 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
1648 OMAP_I2C_FLAG_RESET_REGS_POSTIDLE |
1649 OMAP_I2C_FLAG_BUS_SHIFT_2,
1641}; 1650};
1642 1651
1643static struct omap_hwmod_ocp_if *omap3xxx_i2c2_slaves[] = { 1652static struct omap_hwmod_ocp_if *omap3xxx_i2c2_slaves[] = {
@@ -1646,6 +1655,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c2_slaves[] = {
1646 1655
1647static struct omap_hwmod omap3xxx_i2c2_hwmod = { 1656static struct omap_hwmod omap3xxx_i2c2_hwmod = {
1648 .name = "i2c2", 1657 .name = "i2c2",
1658 .flags = HWMOD_16BIT_REG,
1649 .mpu_irqs = omap2_i2c2_mpu_irqs, 1659 .mpu_irqs = omap2_i2c2_mpu_irqs,
1650 .sdma_reqs = omap2_i2c2_sdma_reqs, 1660 .sdma_reqs = omap2_i2c2_sdma_reqs,
1651 .main_clk = "i2c2_fck", 1661 .main_clk = "i2c2_fck",
@@ -1669,6 +1679,9 @@ static struct omap_hwmod omap3xxx_i2c2_hwmod = {
1669 1679
1670static struct omap_i2c_dev_attr i2c3_dev_attr = { 1680static struct omap_i2c_dev_attr i2c3_dev_attr = {
1671 .fifo_depth = 64, /* bytes */ 1681 .fifo_depth = 64, /* bytes */
1682 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
1683 OMAP_I2C_FLAG_RESET_REGS_POSTIDLE |
1684 OMAP_I2C_FLAG_BUS_SHIFT_2,
1672}; 1685};
1673 1686
1674static struct omap_hwmod_irq_info i2c3_mpu_irqs[] = { 1687static struct omap_hwmod_irq_info i2c3_mpu_irqs[] = {
@@ -1688,6 +1701,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c3_slaves[] = {
1688 1701
1689static struct omap_hwmod omap3xxx_i2c3_hwmod = { 1702static struct omap_hwmod omap3xxx_i2c3_hwmod = {
1690 .name = "i2c3", 1703 .name = "i2c3",
1704 .flags = HWMOD_16BIT_REG,
1691 .mpu_irqs = i2c3_mpu_irqs, 1705 .mpu_irqs = i2c3_mpu_irqs,
1692 .sdma_reqs = i2c3_sdma_reqs, 1706 .sdma_reqs = i2c3_sdma_reqs,
1693 .main_clk = "i2c3_fck", 1707 .main_clk = "i2c3_fck",
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index e01143725b0..6201422c060 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -22,11 +22,13 @@
22 22
23#include <plat/omap_hwmod.h> 23#include <plat/omap_hwmod.h>
24#include <plat/cpu.h> 24#include <plat/cpu.h>
25#include <plat/i2c.h>
25#include <plat/gpio.h> 26#include <plat/gpio.h>
26#include <plat/dma.h> 27#include <plat/dma.h>
27#include <plat/mcspi.h> 28#include <plat/mcspi.h>
28#include <plat/mcbsp.h> 29#include <plat/mcbsp.h>
29#include <plat/mmc.h> 30#include <plat/mmc.h>
31#include <plat/i2c.h>
30 32
31#include "omap_hwmod_common_data.h" 33#include "omap_hwmod_common_data.h"
32 34
@@ -121,9 +123,16 @@ static struct omap_hwmod_ocp_if *omap44xx_dmm_slaves[] = {
121static struct omap_hwmod omap44xx_dmm_hwmod = { 123static struct omap_hwmod omap44xx_dmm_hwmod = {
122 .name = "dmm", 124 .name = "dmm",
123 .class = &omap44xx_dmm_hwmod_class, 125 .class = &omap44xx_dmm_hwmod_class,
124 .mpu_irqs = omap44xx_dmm_irqs, 126 .clkdm_name = "l3_emif_clkdm",
127 .prcm = {
128 .omap4 = {
129 .clkctrl_offs = OMAP4_CM_MEMIF_DMM_CLKCTRL_OFFSET,
130 .context_offs = OMAP4_RM_MEMIF_DMM_CONTEXT_OFFSET,
131 },
132 },
125 .slaves = omap44xx_dmm_slaves, 133 .slaves = omap44xx_dmm_slaves,
126 .slaves_cnt = ARRAY_SIZE(omap44xx_dmm_slaves), 134 .slaves_cnt = ARRAY_SIZE(omap44xx_dmm_slaves),
135 .mpu_irqs = omap44xx_dmm_irqs,
127 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 136 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
128}; 137};
129 138
@@ -171,6 +180,13 @@ static struct omap_hwmod_ocp_if *omap44xx_emif_fw_slaves[] = {
171static struct omap_hwmod omap44xx_emif_fw_hwmod = { 180static struct omap_hwmod omap44xx_emif_fw_hwmod = {
172 .name = "emif_fw", 181 .name = "emif_fw",
173 .class = &omap44xx_emif_fw_hwmod_class, 182 .class = &omap44xx_emif_fw_hwmod_class,
183 .clkdm_name = "l3_emif_clkdm",
184 .prcm = {
185 .omap4 = {
186 .clkctrl_offs = OMAP4_CM_MEMIF_EMIF_FW_CLKCTRL_OFFSET,
187 .context_offs = OMAP4_RM_MEMIF_EMIF_FW_CONTEXT_OFFSET,
188 },
189 },
174 .slaves = omap44xx_emif_fw_slaves, 190 .slaves = omap44xx_emif_fw_slaves,
175 .slaves_cnt = ARRAY_SIZE(omap44xx_emif_fw_slaves), 191 .slaves_cnt = ARRAY_SIZE(omap44xx_emif_fw_slaves),
176 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 192 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -210,6 +226,14 @@ static struct omap_hwmod_ocp_if *omap44xx_l3_instr_slaves[] = {
210static struct omap_hwmod omap44xx_l3_instr_hwmod = { 226static struct omap_hwmod omap44xx_l3_instr_hwmod = {
211 .name = "l3_instr", 227 .name = "l3_instr",
212 .class = &omap44xx_l3_hwmod_class, 228 .class = &omap44xx_l3_hwmod_class,
229 .clkdm_name = "l3_instr_clkdm",
230 .prcm = {
231 .omap4 = {
232 .clkctrl_offs = OMAP4_CM_L3INSTR_L3_INSTR_CLKCTRL_OFFSET,
233 .context_offs = OMAP4_RM_L3INSTR_L3_INSTR_CONTEXT_OFFSET,
234 .modulemode = MODULEMODE_HWCTRL,
235 },
236 },
213 .slaves = omap44xx_l3_instr_slaves, 237 .slaves = omap44xx_l3_instr_slaves,
214 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_instr_slaves), 238 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_instr_slaves),
215 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 239 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -302,7 +326,14 @@ static struct omap_hwmod_ocp_if *omap44xx_l3_main_1_slaves[] = {
302static struct omap_hwmod omap44xx_l3_main_1_hwmod = { 326static struct omap_hwmod omap44xx_l3_main_1_hwmod = {
303 .name = "l3_main_1", 327 .name = "l3_main_1",
304 .class = &omap44xx_l3_hwmod_class, 328 .class = &omap44xx_l3_hwmod_class,
329 .clkdm_name = "l3_1_clkdm",
305 .mpu_irqs = omap44xx_l3_main_1_irqs, 330 .mpu_irqs = omap44xx_l3_main_1_irqs,
331 .prcm = {
332 .omap4 = {
333 .clkctrl_offs = OMAP4_CM_L3_1_L3_1_CLKCTRL_OFFSET,
334 .context_offs = OMAP4_RM_L3_1_L3_1_CONTEXT_OFFSET,
335 },
336 },
306 .slaves = omap44xx_l3_main_1_slaves, 337 .slaves = omap44xx_l3_main_1_slaves,
307 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_1_slaves), 338 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_1_slaves),
308 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 339 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -398,6 +429,13 @@ static struct omap_hwmod_ocp_if *omap44xx_l3_main_2_slaves[] = {
398static struct omap_hwmod omap44xx_l3_main_2_hwmod = { 429static struct omap_hwmod omap44xx_l3_main_2_hwmod = {
399 .name = "l3_main_2", 430 .name = "l3_main_2",
400 .class = &omap44xx_l3_hwmod_class, 431 .class = &omap44xx_l3_hwmod_class,
432 .clkdm_name = "l3_2_clkdm",
433 .prcm = {
434 .omap4 = {
435 .clkctrl_offs = OMAP4_CM_L3_2_L3_2_CLKCTRL_OFFSET,
436 .context_offs = OMAP4_RM_L3_2_L3_2_CONTEXT_OFFSET,
437 },
438 },
401 .slaves = omap44xx_l3_main_2_slaves, 439 .slaves = omap44xx_l3_main_2_slaves,
402 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_2_slaves), 440 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_2_slaves),
403 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 441 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -448,6 +486,14 @@ static struct omap_hwmod_ocp_if *omap44xx_l3_main_3_slaves[] = {
448static struct omap_hwmod omap44xx_l3_main_3_hwmod = { 486static struct omap_hwmod omap44xx_l3_main_3_hwmod = {
449 .name = "l3_main_3", 487 .name = "l3_main_3",
450 .class = &omap44xx_l3_hwmod_class, 488 .class = &omap44xx_l3_hwmod_class,
489 .clkdm_name = "l3_instr_clkdm",
490 .prcm = {
491 .omap4 = {
492 .clkctrl_offs = OMAP4_CM_L3INSTR_L3_3_CLKCTRL_OFFSET,
493 .context_offs = OMAP4_RM_L3INSTR_L3_3_CONTEXT_OFFSET,
494 .modulemode = MODULEMODE_HWCTRL,
495 },
496 },
451 .slaves = omap44xx_l3_main_3_slaves, 497 .slaves = omap44xx_l3_main_3_slaves,
452 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_3_slaves), 498 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_3_slaves),
453 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 499 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -505,6 +551,12 @@ static struct omap_hwmod_ocp_if *omap44xx_l4_abe_slaves[] = {
505static struct omap_hwmod omap44xx_l4_abe_hwmod = { 551static struct omap_hwmod omap44xx_l4_abe_hwmod = {
506 .name = "l4_abe", 552 .name = "l4_abe",
507 .class = &omap44xx_l4_hwmod_class, 553 .class = &omap44xx_l4_hwmod_class,
554 .clkdm_name = "abe_clkdm",
555 .prcm = {
556 .omap4 = {
557 .clkctrl_offs = OMAP4_CM1_ABE_L4ABE_CLKCTRL_OFFSET,
558 },
559 },
508 .slaves = omap44xx_l4_abe_slaves, 560 .slaves = omap44xx_l4_abe_slaves,
509 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_abe_slaves), 561 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_abe_slaves),
510 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 562 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -527,6 +579,13 @@ static struct omap_hwmod_ocp_if *omap44xx_l4_cfg_slaves[] = {
527static struct omap_hwmod omap44xx_l4_cfg_hwmod = { 579static struct omap_hwmod omap44xx_l4_cfg_hwmod = {
528 .name = "l4_cfg", 580 .name = "l4_cfg",
529 .class = &omap44xx_l4_hwmod_class, 581 .class = &omap44xx_l4_hwmod_class,
582 .clkdm_name = "l4_cfg_clkdm",
583 .prcm = {
584 .omap4 = {
585 .clkctrl_offs = OMAP4_CM_L4CFG_L4_CFG_CLKCTRL_OFFSET,
586 .context_offs = OMAP4_RM_L4CFG_L4_CFG_CONTEXT_OFFSET,
587 },
588 },
530 .slaves = omap44xx_l4_cfg_slaves, 589 .slaves = omap44xx_l4_cfg_slaves,
531 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_cfg_slaves), 590 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_cfg_slaves),
532 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 591 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -549,6 +608,13 @@ static struct omap_hwmod_ocp_if *omap44xx_l4_per_slaves[] = {
549static struct omap_hwmod omap44xx_l4_per_hwmod = { 608static struct omap_hwmod omap44xx_l4_per_hwmod = {
550 .name = "l4_per", 609 .name = "l4_per",
551 .class = &omap44xx_l4_hwmod_class, 610 .class = &omap44xx_l4_hwmod_class,
611 .clkdm_name = "l4_per_clkdm",
612 .prcm = {
613 .omap4 = {
614 .clkctrl_offs = OMAP4_CM_L4PER_L4PER_CLKCTRL_OFFSET,
615 .context_offs = OMAP4_RM_L4PER_L4_PER_CONTEXT_OFFSET,
616 },
617 },
552 .slaves = omap44xx_l4_per_slaves, 618 .slaves = omap44xx_l4_per_slaves,
553 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_per_slaves), 619 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_per_slaves),
554 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 620 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -571,6 +637,13 @@ static struct omap_hwmod_ocp_if *omap44xx_l4_wkup_slaves[] = {
571static struct omap_hwmod omap44xx_l4_wkup_hwmod = { 637static struct omap_hwmod omap44xx_l4_wkup_hwmod = {
572 .name = "l4_wkup", 638 .name = "l4_wkup",
573 .class = &omap44xx_l4_hwmod_class, 639 .class = &omap44xx_l4_hwmod_class,
640 .clkdm_name = "l4_wkup_clkdm",
641 .prcm = {
642 .omap4 = {
643 .clkctrl_offs = OMAP4_CM_WKUP_L4WKUP_CLKCTRL_OFFSET,
644 .context_offs = OMAP4_RM_WKUP_L4WKUP_CONTEXT_OFFSET,
645 },
646 },
574 .slaves = omap44xx_l4_wkup_slaves, 647 .slaves = omap44xx_l4_wkup_slaves,
575 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_wkup_slaves), 648 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_wkup_slaves),
576 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 649 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -601,6 +674,7 @@ static struct omap_hwmod_ocp_if *omap44xx_mpu_private_slaves[] = {
601static struct omap_hwmod omap44xx_mpu_private_hwmod = { 674static struct omap_hwmod omap44xx_mpu_private_hwmod = {
602 .name = "mpu_private", 675 .name = "mpu_private",
603 .class = &omap44xx_mpu_bus_hwmod_class, 676 .class = &omap44xx_mpu_bus_hwmod_class,
677 .clkdm_name = "mpuss_clkdm",
604 .slaves = omap44xx_mpu_private_slaves, 678 .slaves = omap44xx_mpu_private_slaves,
605 .slaves_cnt = ARRAY_SIZE(omap44xx_mpu_private_slaves), 679 .slaves_cnt = ARRAY_SIZE(omap44xx_mpu_private_slaves),
606 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 680 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -739,12 +813,15 @@ static struct omap_hwmod_ocp_if *omap44xx_aess_slaves[] = {
739static struct omap_hwmod omap44xx_aess_hwmod = { 813static struct omap_hwmod omap44xx_aess_hwmod = {
740 .name = "aess", 814 .name = "aess",
741 .class = &omap44xx_aess_hwmod_class, 815 .class = &omap44xx_aess_hwmod_class,
816 .clkdm_name = "abe_clkdm",
742 .mpu_irqs = omap44xx_aess_irqs, 817 .mpu_irqs = omap44xx_aess_irqs,
743 .sdma_reqs = omap44xx_aess_sdma_reqs, 818 .sdma_reqs = omap44xx_aess_sdma_reqs,
744 .main_clk = "aess_fck", 819 .main_clk = "aess_fck",
745 .prcm = { 820 .prcm = {
746 .omap4 = { 821 .omap4 = {
747 .clkctrl_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL, 822 .clkctrl_offs = OMAP4_CM1_ABE_AESS_CLKCTRL_OFFSET,
823 .context_offs = OMAP4_RM_ABE_AESS_CONTEXT_OFFSET,
824 .modulemode = MODULEMODE_SWCTRL,
748 }, 825 },
749 }, 826 },
750 .slaves = omap44xx_aess_slaves, 827 .slaves = omap44xx_aess_slaves,
@@ -771,9 +848,10 @@ static struct omap_hwmod_opt_clk bandgap_opt_clks[] = {
771static struct omap_hwmod omap44xx_bandgap_hwmod = { 848static struct omap_hwmod omap44xx_bandgap_hwmod = {
772 .name = "bandgap", 849 .name = "bandgap",
773 .class = &omap44xx_bandgap_hwmod_class, 850 .class = &omap44xx_bandgap_hwmod_class,
851 .clkdm_name = "l4_wkup_clkdm",
774 .prcm = { 852 .prcm = {
775 .omap4 = { 853 .omap4 = {
776 .clkctrl_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL, 854 .clkctrl_offs = OMAP4_CM_WKUP_BANDGAP_CLKCTRL_OFFSET,
777 }, 855 },
778 }, 856 },
779 .opt_clks = bandgap_opt_clks, 857 .opt_clks = bandgap_opt_clks,
@@ -828,11 +906,13 @@ static struct omap_hwmod_ocp_if *omap44xx_counter_32k_slaves[] = {
828static struct omap_hwmod omap44xx_counter_32k_hwmod = { 906static struct omap_hwmod omap44xx_counter_32k_hwmod = {
829 .name = "counter_32k", 907 .name = "counter_32k",
830 .class = &omap44xx_counter_hwmod_class, 908 .class = &omap44xx_counter_hwmod_class,
909 .clkdm_name = "l4_wkup_clkdm",
831 .flags = HWMOD_SWSUP_SIDLE, 910 .flags = HWMOD_SWSUP_SIDLE,
832 .main_clk = "sys_32k_ck", 911 .main_clk = "sys_32k_ck",
833 .prcm = { 912 .prcm = {
834 .omap4 = { 913 .omap4 = {
835 .clkctrl_reg = OMAP4430_CM_WKUP_SYNCTIMER_CLKCTRL, 914 .clkctrl_offs = OMAP4_CM_WKUP_SYNCTIMER_CLKCTRL_OFFSET,
915 .context_offs = OMAP4_RM_WKUP_SYNCTIMER_CONTEXT_OFFSET,
836 }, 916 },
837 }, 917 },
838 .slaves = omap44xx_counter_32k_slaves, 918 .slaves = omap44xx_counter_32k_slaves,
@@ -911,11 +991,13 @@ static struct omap_hwmod_ocp_if *omap44xx_dma_system_slaves[] = {
911static struct omap_hwmod omap44xx_dma_system_hwmod = { 991static struct omap_hwmod omap44xx_dma_system_hwmod = {
912 .name = "dma_system", 992 .name = "dma_system",
913 .class = &omap44xx_dma_hwmod_class, 993 .class = &omap44xx_dma_hwmod_class,
994 .clkdm_name = "l3_dma_clkdm",
914 .mpu_irqs = omap44xx_dma_system_irqs, 995 .mpu_irqs = omap44xx_dma_system_irqs,
915 .main_clk = "l3_div_ck", 996 .main_clk = "l3_div_ck",
916 .prcm = { 997 .prcm = {
917 .omap4 = { 998 .omap4 = {
918 .clkctrl_reg = OMAP4430_CM_SDMA_SDMA_CLKCTRL, 999 .clkctrl_offs = OMAP4_CM_SDMA_SDMA_CLKCTRL_OFFSET,
1000 .context_offs = OMAP4_RM_SDMA_SDMA_CONTEXT_OFFSET,
919 }, 1001 },
920 }, 1002 },
921 .dev_attr = &dma_dev_attr, 1003 .dev_attr = &dma_dev_attr,
@@ -1003,12 +1085,15 @@ static struct omap_hwmod_ocp_if *omap44xx_dmic_slaves[] = {
1003static struct omap_hwmod omap44xx_dmic_hwmod = { 1085static struct omap_hwmod omap44xx_dmic_hwmod = {
1004 .name = "dmic", 1086 .name = "dmic",
1005 .class = &omap44xx_dmic_hwmod_class, 1087 .class = &omap44xx_dmic_hwmod_class,
1088 .clkdm_name = "abe_clkdm",
1006 .mpu_irqs = omap44xx_dmic_irqs, 1089 .mpu_irqs = omap44xx_dmic_irqs,
1007 .sdma_reqs = omap44xx_dmic_sdma_reqs, 1090 .sdma_reqs = omap44xx_dmic_sdma_reqs,
1008 .main_clk = "dmic_fck", 1091 .main_clk = "dmic_fck",
1009 .prcm = { 1092 .prcm = {
1010 .omap4 = { 1093 .omap4 = {
1011 .clkctrl_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL, 1094 .clkctrl_offs = OMAP4_CM1_ABE_DMIC_CLKCTRL_OFFSET,
1095 .context_offs = OMAP4_RM_ABE_DMIC_CONTEXT_OFFSET,
1096 .modulemode = MODULEMODE_SWCTRL,
1012 }, 1097 },
1013 }, 1098 },
1014 .slaves = omap44xx_dmic_slaves, 1099 .slaves = omap44xx_dmic_slaves,
@@ -1070,12 +1155,13 @@ static struct omap_hwmod_ocp_if *omap44xx_dsp_slaves[] = {
1070static struct omap_hwmod omap44xx_dsp_c0_hwmod = { 1155static struct omap_hwmod omap44xx_dsp_c0_hwmod = {
1071 .name = "dsp_c0", 1156 .name = "dsp_c0",
1072 .class = &omap44xx_dsp_hwmod_class, 1157 .class = &omap44xx_dsp_hwmod_class,
1158 .clkdm_name = "tesla_clkdm",
1073 .flags = HWMOD_INIT_NO_RESET, 1159 .flags = HWMOD_INIT_NO_RESET,
1074 .rst_lines = omap44xx_dsp_c0_resets, 1160 .rst_lines = omap44xx_dsp_c0_resets,
1075 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_c0_resets), 1161 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_c0_resets),
1076 .prcm = { 1162 .prcm = {
1077 .omap4 = { 1163 .omap4 = {
1078 .rstctrl_reg = OMAP4430_RM_TESLA_RSTCTRL, 1164 .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET,
1079 }, 1165 },
1080 }, 1166 },
1081 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 1167 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1084,14 +1170,17 @@ static struct omap_hwmod omap44xx_dsp_c0_hwmod = {
1084static struct omap_hwmod omap44xx_dsp_hwmod = { 1170static struct omap_hwmod omap44xx_dsp_hwmod = {
1085 .name = "dsp", 1171 .name = "dsp",
1086 .class = &omap44xx_dsp_hwmod_class, 1172 .class = &omap44xx_dsp_hwmod_class,
1173 .clkdm_name = "tesla_clkdm",
1087 .mpu_irqs = omap44xx_dsp_irqs, 1174 .mpu_irqs = omap44xx_dsp_irqs,
1088 .rst_lines = omap44xx_dsp_resets, 1175 .rst_lines = omap44xx_dsp_resets,
1089 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_resets), 1176 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_resets),
1090 .main_clk = "dsp_fck", 1177 .main_clk = "dsp_fck",
1091 .prcm = { 1178 .prcm = {
1092 .omap4 = { 1179 .omap4 = {
1093 .clkctrl_reg = OMAP4430_CM_TESLA_TESLA_CLKCTRL, 1180 .clkctrl_offs = OMAP4_CM_TESLA_TESLA_CLKCTRL_OFFSET,
1094 .rstctrl_reg = OMAP4430_RM_TESLA_RSTCTRL, 1181 .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET,
1182 .context_offs = OMAP4_RM_TESLA_TESLA_CONTEXT_OFFSET,
1183 .modulemode = MODULEMODE_HWCTRL,
1095 }, 1184 },
1096 }, 1185 },
1097 .slaves = omap44xx_dsp_slaves, 1186 .slaves = omap44xx_dsp_slaves,
@@ -1136,7 +1225,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_dma_addrs[] = {
1136static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss = { 1225static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss = {
1137 .master = &omap44xx_l3_main_2_hwmod, 1226 .master = &omap44xx_l3_main_2_hwmod,
1138 .slave = &omap44xx_dss_hwmod, 1227 .slave = &omap44xx_dss_hwmod,
1139 .clk = "l3_div_ck", 1228 .clk = "dss_fck",
1140 .addr = omap44xx_dss_dma_addrs, 1229 .addr = omap44xx_dss_dma_addrs,
1141 .user = OCP_USER_SDMA, 1230 .user = OCP_USER_SDMA,
1142}; 1231};
@@ -1175,10 +1264,12 @@ static struct omap_hwmod_opt_clk dss_opt_clks[] = {
1175static struct omap_hwmod omap44xx_dss_hwmod = { 1264static struct omap_hwmod omap44xx_dss_hwmod = {
1176 .name = "dss_core", 1265 .name = "dss_core",
1177 .class = &omap44xx_dss_hwmod_class, 1266 .class = &omap44xx_dss_hwmod_class,
1178 .main_clk = "dss_fck", 1267 .clkdm_name = "l3_dss_clkdm",
1268 .main_clk = "dss_dss_clk",
1179 .prcm = { 1269 .prcm = {
1180 .omap4 = { 1270 .omap4 = {
1181 .clkctrl_reg = OMAP4430_CM_DSS_DSS_CLKCTRL, 1271 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
1272 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
1182 }, 1273 },
1183 }, 1274 },
1184 .opt_clks = dss_opt_clks, 1275 .opt_clks = dss_opt_clks,
@@ -1238,7 +1329,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_dispc_dma_addrs[] = {
1238static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dispc = { 1329static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dispc = {
1239 .master = &omap44xx_l3_main_2_hwmod, 1330 .master = &omap44xx_l3_main_2_hwmod,
1240 .slave = &omap44xx_dss_dispc_hwmod, 1331 .slave = &omap44xx_dss_dispc_hwmod,
1241 .clk = "l3_div_ck", 1332 .clk = "dss_fck",
1242 .addr = omap44xx_dss_dispc_dma_addrs, 1333 .addr = omap44xx_dss_dispc_dma_addrs,
1243 .user = OCP_USER_SDMA, 1334 .user = OCP_USER_SDMA,
1244}; 1335};
@@ -1267,17 +1358,27 @@ static struct omap_hwmod_ocp_if *omap44xx_dss_dispc_slaves[] = {
1267 &omap44xx_l4_per__dss_dispc, 1358 &omap44xx_l4_per__dss_dispc,
1268}; 1359};
1269 1360
1361static struct omap_hwmod_opt_clk dss_dispc_opt_clks[] = {
1362 { .role = "sys_clk", .clk = "dss_sys_clk" },
1363 { .role = "tv_clk", .clk = "dss_tv_clk" },
1364 { .role = "hdmi_clk", .clk = "dss_48mhz_clk" },
1365};
1366
1270static struct omap_hwmod omap44xx_dss_dispc_hwmod = { 1367static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
1271 .name = "dss_dispc", 1368 .name = "dss_dispc",
1272 .class = &omap44xx_dispc_hwmod_class, 1369 .class = &omap44xx_dispc_hwmod_class,
1370 .clkdm_name = "l3_dss_clkdm",
1273 .mpu_irqs = omap44xx_dss_dispc_irqs, 1371 .mpu_irqs = omap44xx_dss_dispc_irqs,
1274 .sdma_reqs = omap44xx_dss_dispc_sdma_reqs, 1372 .sdma_reqs = omap44xx_dss_dispc_sdma_reqs,
1275 .main_clk = "dss_fck", 1373 .main_clk = "dss_dss_clk",
1276 .prcm = { 1374 .prcm = {
1277 .omap4 = { 1375 .omap4 = {
1278 .clkctrl_reg = OMAP4430_CM_DSS_DSS_CLKCTRL, 1376 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
1377 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
1279 }, 1378 },
1280 }, 1379 },
1380 .opt_clks = dss_dispc_opt_clks,
1381 .opt_clks_cnt = ARRAY_SIZE(dss_dispc_opt_clks),
1281 .slaves = omap44xx_dss_dispc_slaves, 1382 .slaves = omap44xx_dss_dispc_slaves,
1282 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dispc_slaves), 1383 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dispc_slaves),
1283 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 1384 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1329,7 +1430,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_dsi1_dma_addrs[] = {
1329static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi1 = { 1430static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi1 = {
1330 .master = &omap44xx_l3_main_2_hwmod, 1431 .master = &omap44xx_l3_main_2_hwmod,
1331 .slave = &omap44xx_dss_dsi1_hwmod, 1432 .slave = &omap44xx_dss_dsi1_hwmod,
1332 .clk = "l3_div_ck", 1433 .clk = "dss_fck",
1333 .addr = omap44xx_dss_dsi1_dma_addrs, 1434 .addr = omap44xx_dss_dsi1_dma_addrs,
1334 .user = OCP_USER_SDMA, 1435 .user = OCP_USER_SDMA,
1335}; 1436};
@@ -1358,17 +1459,25 @@ static struct omap_hwmod_ocp_if *omap44xx_dss_dsi1_slaves[] = {
1358 &omap44xx_l4_per__dss_dsi1, 1459 &omap44xx_l4_per__dss_dsi1,
1359}; 1460};
1360 1461
1462static struct omap_hwmod_opt_clk dss_dsi1_opt_clks[] = {
1463 { .role = "sys_clk", .clk = "dss_sys_clk" },
1464};
1465
1361static struct omap_hwmod omap44xx_dss_dsi1_hwmod = { 1466static struct omap_hwmod omap44xx_dss_dsi1_hwmod = {
1362 .name = "dss_dsi1", 1467 .name = "dss_dsi1",
1363 .class = &omap44xx_dsi_hwmod_class, 1468 .class = &omap44xx_dsi_hwmod_class,
1469 .clkdm_name = "l3_dss_clkdm",
1364 .mpu_irqs = omap44xx_dss_dsi1_irqs, 1470 .mpu_irqs = omap44xx_dss_dsi1_irqs,
1365 .sdma_reqs = omap44xx_dss_dsi1_sdma_reqs, 1471 .sdma_reqs = omap44xx_dss_dsi1_sdma_reqs,
1366 .main_clk = "dss_fck", 1472 .main_clk = "dss_dss_clk",
1367 .prcm = { 1473 .prcm = {
1368 .omap4 = { 1474 .omap4 = {
1369 .clkctrl_reg = OMAP4430_CM_DSS_DSS_CLKCTRL, 1475 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
1476 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
1370 }, 1477 },
1371 }, 1478 },
1479 .opt_clks = dss_dsi1_opt_clks,
1480 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks),
1372 .slaves = omap44xx_dss_dsi1_slaves, 1481 .slaves = omap44xx_dss_dsi1_slaves,
1373 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi1_slaves), 1482 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi1_slaves),
1374 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 1483 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1399,7 +1508,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_dsi2_dma_addrs[] = {
1399static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi2 = { 1508static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi2 = {
1400 .master = &omap44xx_l3_main_2_hwmod, 1509 .master = &omap44xx_l3_main_2_hwmod,
1401 .slave = &omap44xx_dss_dsi2_hwmod, 1510 .slave = &omap44xx_dss_dsi2_hwmod,
1402 .clk = "l3_div_ck", 1511 .clk = "dss_fck",
1403 .addr = omap44xx_dss_dsi2_dma_addrs, 1512 .addr = omap44xx_dss_dsi2_dma_addrs,
1404 .user = OCP_USER_SDMA, 1513 .user = OCP_USER_SDMA,
1405}; 1514};
@@ -1428,17 +1537,25 @@ static struct omap_hwmod_ocp_if *omap44xx_dss_dsi2_slaves[] = {
1428 &omap44xx_l4_per__dss_dsi2, 1537 &omap44xx_l4_per__dss_dsi2,
1429}; 1538};
1430 1539
1540static struct omap_hwmod_opt_clk dss_dsi2_opt_clks[] = {
1541 { .role = "sys_clk", .clk = "dss_sys_clk" },
1542};
1543
1431static struct omap_hwmod omap44xx_dss_dsi2_hwmod = { 1544static struct omap_hwmod omap44xx_dss_dsi2_hwmod = {
1432 .name = "dss_dsi2", 1545 .name = "dss_dsi2",
1433 .class = &omap44xx_dsi_hwmod_class, 1546 .class = &omap44xx_dsi_hwmod_class,
1547 .clkdm_name = "l3_dss_clkdm",
1434 .mpu_irqs = omap44xx_dss_dsi2_irqs, 1548 .mpu_irqs = omap44xx_dss_dsi2_irqs,
1435 .sdma_reqs = omap44xx_dss_dsi2_sdma_reqs, 1549 .sdma_reqs = omap44xx_dss_dsi2_sdma_reqs,
1436 .main_clk = "dss_fck", 1550 .main_clk = "dss_dss_clk",
1437 .prcm = { 1551 .prcm = {
1438 .omap4 = { 1552 .omap4 = {
1439 .clkctrl_reg = OMAP4430_CM_DSS_DSS_CLKCTRL, 1553 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
1554 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
1440 }, 1555 },
1441 }, 1556 },
1557 .opt_clks = dss_dsi2_opt_clks,
1558 .opt_clks_cnt = ARRAY_SIZE(dss_dsi2_opt_clks),
1442 .slaves = omap44xx_dss_dsi2_slaves, 1559 .slaves = omap44xx_dss_dsi2_slaves,
1443 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi2_slaves), 1560 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi2_slaves),
1444 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 1561 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1489,7 +1606,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_hdmi_dma_addrs[] = {
1489static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_hdmi = { 1606static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_hdmi = {
1490 .master = &omap44xx_l3_main_2_hwmod, 1607 .master = &omap44xx_l3_main_2_hwmod,
1491 .slave = &omap44xx_dss_hdmi_hwmod, 1608 .slave = &omap44xx_dss_hdmi_hwmod,
1492 .clk = "l3_div_ck", 1609 .clk = "dss_fck",
1493 .addr = omap44xx_dss_hdmi_dma_addrs, 1610 .addr = omap44xx_dss_hdmi_dma_addrs,
1494 .user = OCP_USER_SDMA, 1611 .user = OCP_USER_SDMA,
1495}; 1612};
@@ -1518,17 +1635,25 @@ static struct omap_hwmod_ocp_if *omap44xx_dss_hdmi_slaves[] = {
1518 &omap44xx_l4_per__dss_hdmi, 1635 &omap44xx_l4_per__dss_hdmi,
1519}; 1636};
1520 1637
1638static struct omap_hwmod_opt_clk dss_hdmi_opt_clks[] = {
1639 { .role = "sys_clk", .clk = "dss_sys_clk" },
1640};
1641
1521static struct omap_hwmod omap44xx_dss_hdmi_hwmod = { 1642static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
1522 .name = "dss_hdmi", 1643 .name = "dss_hdmi",
1523 .class = &omap44xx_hdmi_hwmod_class, 1644 .class = &omap44xx_hdmi_hwmod_class,
1645 .clkdm_name = "l3_dss_clkdm",
1524 .mpu_irqs = omap44xx_dss_hdmi_irqs, 1646 .mpu_irqs = omap44xx_dss_hdmi_irqs,
1525 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs, 1647 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs,
1526 .main_clk = "dss_fck", 1648 .main_clk = "dss_dss_clk",
1527 .prcm = { 1649 .prcm = {
1528 .omap4 = { 1650 .omap4 = {
1529 .clkctrl_reg = OMAP4430_CM_DSS_DSS_CLKCTRL, 1651 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
1652 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
1530 }, 1653 },
1531 }, 1654 },
1655 .opt_clks = dss_hdmi_opt_clks,
1656 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks),
1532 .slaves = omap44xx_dss_hdmi_slaves, 1657 .slaves = omap44xx_dss_hdmi_slaves,
1533 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_hdmi_slaves), 1658 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_hdmi_slaves),
1534 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 1659 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1574,7 +1699,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_rfbi_dma_addrs[] = {
1574static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_rfbi = { 1699static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_rfbi = {
1575 .master = &omap44xx_l3_main_2_hwmod, 1700 .master = &omap44xx_l3_main_2_hwmod,
1576 .slave = &omap44xx_dss_rfbi_hwmod, 1701 .slave = &omap44xx_dss_rfbi_hwmod,
1577 .clk = "l3_div_ck", 1702 .clk = "dss_fck",
1578 .addr = omap44xx_dss_rfbi_dma_addrs, 1703 .addr = omap44xx_dss_rfbi_dma_addrs,
1579 .user = OCP_USER_SDMA, 1704 .user = OCP_USER_SDMA,
1580}; 1705};
@@ -1603,16 +1728,24 @@ static struct omap_hwmod_ocp_if *omap44xx_dss_rfbi_slaves[] = {
1603 &omap44xx_l4_per__dss_rfbi, 1728 &omap44xx_l4_per__dss_rfbi,
1604}; 1729};
1605 1730
1731static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
1732 { .role = "ick", .clk = "dss_fck" },
1733};
1734
1606static struct omap_hwmod omap44xx_dss_rfbi_hwmod = { 1735static struct omap_hwmod omap44xx_dss_rfbi_hwmod = {
1607 .name = "dss_rfbi", 1736 .name = "dss_rfbi",
1608 .class = &omap44xx_rfbi_hwmod_class, 1737 .class = &omap44xx_rfbi_hwmod_class,
1738 .clkdm_name = "l3_dss_clkdm",
1609 .sdma_reqs = omap44xx_dss_rfbi_sdma_reqs, 1739 .sdma_reqs = omap44xx_dss_rfbi_sdma_reqs,
1610 .main_clk = "dss_fck", 1740 .main_clk = "dss_dss_clk",
1611 .prcm = { 1741 .prcm = {
1612 .omap4 = { 1742 .omap4 = {
1613 .clkctrl_reg = OMAP4430_CM_DSS_DSS_CLKCTRL, 1743 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
1744 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
1614 }, 1745 },
1615 }, 1746 },
1747 .opt_clks = dss_rfbi_opt_clks,
1748 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
1616 .slaves = omap44xx_dss_rfbi_slaves, 1749 .slaves = omap44xx_dss_rfbi_slaves,
1617 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_rfbi_slaves), 1750 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_rfbi_slaves),
1618 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 1751 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1642,7 +1775,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_venc_dma_addrs[] = {
1642static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_venc = { 1775static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_venc = {
1643 .master = &omap44xx_l3_main_2_hwmod, 1776 .master = &omap44xx_l3_main_2_hwmod,
1644 .slave = &omap44xx_dss_venc_hwmod, 1777 .slave = &omap44xx_dss_venc_hwmod,
1645 .clk = "l3_div_ck", 1778 .clk = "dss_fck",
1646 .addr = omap44xx_dss_venc_dma_addrs, 1779 .addr = omap44xx_dss_venc_dma_addrs,
1647 .user = OCP_USER_SDMA, 1780 .user = OCP_USER_SDMA,
1648}; 1781};
@@ -1674,10 +1807,12 @@ static struct omap_hwmod_ocp_if *omap44xx_dss_venc_slaves[] = {
1674static struct omap_hwmod omap44xx_dss_venc_hwmod = { 1807static struct omap_hwmod omap44xx_dss_venc_hwmod = {
1675 .name = "dss_venc", 1808 .name = "dss_venc",
1676 .class = &omap44xx_venc_hwmod_class, 1809 .class = &omap44xx_venc_hwmod_class,
1677 .main_clk = "dss_fck", 1810 .clkdm_name = "l3_dss_clkdm",
1811 .main_clk = "dss_dss_clk",
1678 .prcm = { 1812 .prcm = {
1679 .omap4 = { 1813 .omap4 = {
1680 .clkctrl_reg = OMAP4430_CM_DSS_DSS_CLKCTRL, 1814 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
1815 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
1681 }, 1816 },
1682 }, 1817 },
1683 .slaves = omap44xx_dss_venc_slaves, 1818 .slaves = omap44xx_dss_venc_slaves,
@@ -1751,11 +1886,14 @@ static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
1751static struct omap_hwmod omap44xx_gpio1_hwmod = { 1886static struct omap_hwmod omap44xx_gpio1_hwmod = {
1752 .name = "gpio1", 1887 .name = "gpio1",
1753 .class = &omap44xx_gpio_hwmod_class, 1888 .class = &omap44xx_gpio_hwmod_class,
1889 .clkdm_name = "l4_wkup_clkdm",
1754 .mpu_irqs = omap44xx_gpio1_irqs, 1890 .mpu_irqs = omap44xx_gpio1_irqs,
1755 .main_clk = "gpio1_ick", 1891 .main_clk = "gpio1_ick",
1756 .prcm = { 1892 .prcm = {
1757 .omap4 = { 1893 .omap4 = {
1758 .clkctrl_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL, 1894 .clkctrl_offs = OMAP4_CM_WKUP_GPIO1_CLKCTRL_OFFSET,
1895 .context_offs = OMAP4_RM_WKUP_GPIO1_CONTEXT_OFFSET,
1896 .modulemode = MODULEMODE_HWCTRL,
1759 }, 1897 },
1760 }, 1898 },
1761 .opt_clks = gpio1_opt_clks, 1899 .opt_clks = gpio1_opt_clks,
@@ -1803,12 +1941,15 @@ static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
1803static struct omap_hwmod omap44xx_gpio2_hwmod = { 1941static struct omap_hwmod omap44xx_gpio2_hwmod = {
1804 .name = "gpio2", 1942 .name = "gpio2",
1805 .class = &omap44xx_gpio_hwmod_class, 1943 .class = &omap44xx_gpio_hwmod_class,
1944 .clkdm_name = "l4_per_clkdm",
1806 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 1945 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1807 .mpu_irqs = omap44xx_gpio2_irqs, 1946 .mpu_irqs = omap44xx_gpio2_irqs,
1808 .main_clk = "gpio2_ick", 1947 .main_clk = "gpio2_ick",
1809 .prcm = { 1948 .prcm = {
1810 .omap4 = { 1949 .omap4 = {
1811 .clkctrl_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL, 1950 .clkctrl_offs = OMAP4_CM_L4PER_GPIO2_CLKCTRL_OFFSET,
1951 .context_offs = OMAP4_RM_L4PER_GPIO2_CONTEXT_OFFSET,
1952 .modulemode = MODULEMODE_HWCTRL,
1812 }, 1953 },
1813 }, 1954 },
1814 .opt_clks = gpio2_opt_clks, 1955 .opt_clks = gpio2_opt_clks,
@@ -1856,12 +1997,15 @@ static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
1856static struct omap_hwmod omap44xx_gpio3_hwmod = { 1997static struct omap_hwmod omap44xx_gpio3_hwmod = {
1857 .name = "gpio3", 1998 .name = "gpio3",
1858 .class = &omap44xx_gpio_hwmod_class, 1999 .class = &omap44xx_gpio_hwmod_class,
2000 .clkdm_name = "l4_per_clkdm",
1859 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 2001 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1860 .mpu_irqs = omap44xx_gpio3_irqs, 2002 .mpu_irqs = omap44xx_gpio3_irqs,
1861 .main_clk = "gpio3_ick", 2003 .main_clk = "gpio3_ick",
1862 .prcm = { 2004 .prcm = {
1863 .omap4 = { 2005 .omap4 = {
1864 .clkctrl_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL, 2006 .clkctrl_offs = OMAP4_CM_L4PER_GPIO3_CLKCTRL_OFFSET,
2007 .context_offs = OMAP4_RM_L4PER_GPIO3_CONTEXT_OFFSET,
2008 .modulemode = MODULEMODE_HWCTRL,
1865 }, 2009 },
1866 }, 2010 },
1867 .opt_clks = gpio3_opt_clks, 2011 .opt_clks = gpio3_opt_clks,
@@ -1909,12 +2053,15 @@ static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
1909static struct omap_hwmod omap44xx_gpio4_hwmod = { 2053static struct omap_hwmod omap44xx_gpio4_hwmod = {
1910 .name = "gpio4", 2054 .name = "gpio4",
1911 .class = &omap44xx_gpio_hwmod_class, 2055 .class = &omap44xx_gpio_hwmod_class,
2056 .clkdm_name = "l4_per_clkdm",
1912 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 2057 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1913 .mpu_irqs = omap44xx_gpio4_irqs, 2058 .mpu_irqs = omap44xx_gpio4_irqs,
1914 .main_clk = "gpio4_ick", 2059 .main_clk = "gpio4_ick",
1915 .prcm = { 2060 .prcm = {
1916 .omap4 = { 2061 .omap4 = {
1917 .clkctrl_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL, 2062 .clkctrl_offs = OMAP4_CM_L4PER_GPIO4_CLKCTRL_OFFSET,
2063 .context_offs = OMAP4_RM_L4PER_GPIO4_CONTEXT_OFFSET,
2064 .modulemode = MODULEMODE_HWCTRL,
1918 }, 2065 },
1919 }, 2066 },
1920 .opt_clks = gpio4_opt_clks, 2067 .opt_clks = gpio4_opt_clks,
@@ -1962,12 +2109,15 @@ static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
1962static struct omap_hwmod omap44xx_gpio5_hwmod = { 2109static struct omap_hwmod omap44xx_gpio5_hwmod = {
1963 .name = "gpio5", 2110 .name = "gpio5",
1964 .class = &omap44xx_gpio_hwmod_class, 2111 .class = &omap44xx_gpio_hwmod_class,
2112 .clkdm_name = "l4_per_clkdm",
1965 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 2113 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1966 .mpu_irqs = omap44xx_gpio5_irqs, 2114 .mpu_irqs = omap44xx_gpio5_irqs,
1967 .main_clk = "gpio5_ick", 2115 .main_clk = "gpio5_ick",
1968 .prcm = { 2116 .prcm = {
1969 .omap4 = { 2117 .omap4 = {
1970 .clkctrl_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL, 2118 .clkctrl_offs = OMAP4_CM_L4PER_GPIO5_CLKCTRL_OFFSET,
2119 .context_offs = OMAP4_RM_L4PER_GPIO5_CONTEXT_OFFSET,
2120 .modulemode = MODULEMODE_HWCTRL,
1971 }, 2121 },
1972 }, 2122 },
1973 .opt_clks = gpio5_opt_clks, 2123 .opt_clks = gpio5_opt_clks,
@@ -2015,12 +2165,15 @@ static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
2015static struct omap_hwmod omap44xx_gpio6_hwmod = { 2165static struct omap_hwmod omap44xx_gpio6_hwmod = {
2016 .name = "gpio6", 2166 .name = "gpio6",
2017 .class = &omap44xx_gpio_hwmod_class, 2167 .class = &omap44xx_gpio_hwmod_class,
2168 .clkdm_name = "l4_per_clkdm",
2018 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 2169 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
2019 .mpu_irqs = omap44xx_gpio6_irqs, 2170 .mpu_irqs = omap44xx_gpio6_irqs,
2020 .main_clk = "gpio6_ick", 2171 .main_clk = "gpio6_ick",
2021 .prcm = { 2172 .prcm = {
2022 .omap4 = { 2173 .omap4 = {
2023 .clkctrl_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL, 2174 .clkctrl_offs = OMAP4_CM_L4PER_GPIO6_CLKCTRL_OFFSET,
2175 .context_offs = OMAP4_RM_L4PER_GPIO6_CONTEXT_OFFSET,
2176 .modulemode = MODULEMODE_HWCTRL,
2024 }, 2177 },
2025 }, 2178 },
2026 .opt_clks = gpio6_opt_clks, 2179 .opt_clks = gpio6_opt_clks,
@@ -2094,11 +2247,14 @@ static struct omap_hwmod_ocp_if *omap44xx_hsi_slaves[] = {
2094static struct omap_hwmod omap44xx_hsi_hwmod = { 2247static struct omap_hwmod omap44xx_hsi_hwmod = {
2095 .name = "hsi", 2248 .name = "hsi",
2096 .class = &omap44xx_hsi_hwmod_class, 2249 .class = &omap44xx_hsi_hwmod_class,
2250 .clkdm_name = "l3_init_clkdm",
2097 .mpu_irqs = omap44xx_hsi_irqs, 2251 .mpu_irqs = omap44xx_hsi_irqs,
2098 .main_clk = "hsi_fck", 2252 .main_clk = "hsi_fck",
2099 .prcm = { 2253 .prcm = {
2100 .omap4 = { 2254 .omap4 = {
2101 .clkctrl_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL, 2255 .clkctrl_offs = OMAP4_CM_L3INIT_HSI_CLKCTRL_OFFSET,
2256 .context_offs = OMAP4_RM_L3INIT_HSI_CONTEXT_OFFSET,
2257 .modulemode = MODULEMODE_HWCTRL,
2102 }, 2258 },
2103 }, 2259 },
2104 .slaves = omap44xx_hsi_slaves, 2260 .slaves = omap44xx_hsi_slaves,
@@ -2127,6 +2283,12 @@ static struct omap_hwmod_class_sysconfig omap44xx_i2c_sysc = {
2127static struct omap_hwmod_class omap44xx_i2c_hwmod_class = { 2283static struct omap_hwmod_class omap44xx_i2c_hwmod_class = {
2128 .name = "i2c", 2284 .name = "i2c",
2129 .sysc = &omap44xx_i2c_sysc, 2285 .sysc = &omap44xx_i2c_sysc,
2286 .rev = OMAP_I2C_IP_VERSION_2,
2287 .reset = &omap_i2c_reset,
2288};
2289
2290static struct omap_i2c_dev_attr i2c_dev_attr = {
2291 .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
2130}; 2292};
2131 2293
2132/* i2c1 */ 2294/* i2c1 */
@@ -2168,17 +2330,21 @@ static struct omap_hwmod_ocp_if *omap44xx_i2c1_slaves[] = {
2168static struct omap_hwmod omap44xx_i2c1_hwmod = { 2330static struct omap_hwmod omap44xx_i2c1_hwmod = {
2169 .name = "i2c1", 2331 .name = "i2c1",
2170 .class = &omap44xx_i2c_hwmod_class, 2332 .class = &omap44xx_i2c_hwmod_class,
2171 .flags = HWMOD_INIT_NO_RESET, 2333 .clkdm_name = "l4_per_clkdm",
2334 .flags = HWMOD_16BIT_REG,
2172 .mpu_irqs = omap44xx_i2c1_irqs, 2335 .mpu_irqs = omap44xx_i2c1_irqs,
2173 .sdma_reqs = omap44xx_i2c1_sdma_reqs, 2336 .sdma_reqs = omap44xx_i2c1_sdma_reqs,
2174 .main_clk = "i2c1_fck", 2337 .main_clk = "i2c1_fck",
2175 .prcm = { 2338 .prcm = {
2176 .omap4 = { 2339 .omap4 = {
2177 .clkctrl_reg = OMAP4430_CM_L4PER_I2C1_CLKCTRL, 2340 .clkctrl_offs = OMAP4_CM_L4PER_I2C1_CLKCTRL_OFFSET,
2341 .context_offs = OMAP4_RM_L4PER_I2C1_CONTEXT_OFFSET,
2342 .modulemode = MODULEMODE_SWCTRL,
2178 }, 2343 },
2179 }, 2344 },
2180 .slaves = omap44xx_i2c1_slaves, 2345 .slaves = omap44xx_i2c1_slaves,
2181 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c1_slaves), 2346 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c1_slaves),
2347 .dev_attr = &i2c_dev_attr,
2182 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 2348 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2183}; 2349};
2184 2350
@@ -2221,17 +2387,21 @@ static struct omap_hwmod_ocp_if *omap44xx_i2c2_slaves[] = {
2221static struct omap_hwmod omap44xx_i2c2_hwmod = { 2387static struct omap_hwmod omap44xx_i2c2_hwmod = {
2222 .name = "i2c2", 2388 .name = "i2c2",
2223 .class = &omap44xx_i2c_hwmod_class, 2389 .class = &omap44xx_i2c_hwmod_class,
2224 .flags = HWMOD_INIT_NO_RESET, 2390 .clkdm_name = "l4_per_clkdm",
2391 .flags = HWMOD_16BIT_REG,
2225 .mpu_irqs = omap44xx_i2c2_irqs, 2392 .mpu_irqs = omap44xx_i2c2_irqs,
2226 .sdma_reqs = omap44xx_i2c2_sdma_reqs, 2393 .sdma_reqs = omap44xx_i2c2_sdma_reqs,
2227 .main_clk = "i2c2_fck", 2394 .main_clk = "i2c2_fck",
2228 .prcm = { 2395 .prcm = {
2229 .omap4 = { 2396 .omap4 = {
2230 .clkctrl_reg = OMAP4430_CM_L4PER_I2C2_CLKCTRL, 2397 .clkctrl_offs = OMAP4_CM_L4PER_I2C2_CLKCTRL_OFFSET,
2398 .context_offs = OMAP4_RM_L4PER_I2C2_CONTEXT_OFFSET,
2399 .modulemode = MODULEMODE_SWCTRL,
2231 }, 2400 },
2232 }, 2401 },
2233 .slaves = omap44xx_i2c2_slaves, 2402 .slaves = omap44xx_i2c2_slaves,
2234 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c2_slaves), 2403 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c2_slaves),
2404 .dev_attr = &i2c_dev_attr,
2235 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 2405 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2236}; 2406};
2237 2407
@@ -2274,17 +2444,21 @@ static struct omap_hwmod_ocp_if *omap44xx_i2c3_slaves[] = {
2274static struct omap_hwmod omap44xx_i2c3_hwmod = { 2444static struct omap_hwmod omap44xx_i2c3_hwmod = {
2275 .name = "i2c3", 2445 .name = "i2c3",
2276 .class = &omap44xx_i2c_hwmod_class, 2446 .class = &omap44xx_i2c_hwmod_class,
2277 .flags = HWMOD_INIT_NO_RESET, 2447 .clkdm_name = "l4_per_clkdm",
2448 .flags = HWMOD_16BIT_REG,
2278 .mpu_irqs = omap44xx_i2c3_irqs, 2449 .mpu_irqs = omap44xx_i2c3_irqs,
2279 .sdma_reqs = omap44xx_i2c3_sdma_reqs, 2450 .sdma_reqs = omap44xx_i2c3_sdma_reqs,
2280 .main_clk = "i2c3_fck", 2451 .main_clk = "i2c3_fck",
2281 .prcm = { 2452 .prcm = {
2282 .omap4 = { 2453 .omap4 = {
2283 .clkctrl_reg = OMAP4430_CM_L4PER_I2C3_CLKCTRL, 2454 .clkctrl_offs = OMAP4_CM_L4PER_I2C3_CLKCTRL_OFFSET,
2455 .context_offs = OMAP4_RM_L4PER_I2C3_CONTEXT_OFFSET,
2456 .modulemode = MODULEMODE_SWCTRL,
2284 }, 2457 },
2285 }, 2458 },
2286 .slaves = omap44xx_i2c3_slaves, 2459 .slaves = omap44xx_i2c3_slaves,
2287 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c3_slaves), 2460 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c3_slaves),
2461 .dev_attr = &i2c_dev_attr,
2288 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 2462 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2289}; 2463};
2290 2464
@@ -2327,17 +2501,21 @@ static struct omap_hwmod_ocp_if *omap44xx_i2c4_slaves[] = {
2327static struct omap_hwmod omap44xx_i2c4_hwmod = { 2501static struct omap_hwmod omap44xx_i2c4_hwmod = {
2328 .name = "i2c4", 2502 .name = "i2c4",
2329 .class = &omap44xx_i2c_hwmod_class, 2503 .class = &omap44xx_i2c_hwmod_class,
2330 .flags = HWMOD_INIT_NO_RESET, 2504 .clkdm_name = "l4_per_clkdm",
2505 .flags = HWMOD_16BIT_REG,
2331 .mpu_irqs = omap44xx_i2c4_irqs, 2506 .mpu_irqs = omap44xx_i2c4_irqs,
2332 .sdma_reqs = omap44xx_i2c4_sdma_reqs, 2507 .sdma_reqs = omap44xx_i2c4_sdma_reqs,
2333 .main_clk = "i2c4_fck", 2508 .main_clk = "i2c4_fck",
2334 .prcm = { 2509 .prcm = {
2335 .omap4 = { 2510 .omap4 = {
2336 .clkctrl_reg = OMAP4430_CM_L4PER_I2C4_CLKCTRL, 2511 .clkctrl_offs = OMAP4_CM_L4PER_I2C4_CLKCTRL_OFFSET,
2512 .context_offs = OMAP4_RM_L4PER_I2C4_CONTEXT_OFFSET,
2513 .modulemode = MODULEMODE_SWCTRL,
2337 }, 2514 },
2338 }, 2515 },
2339 .slaves = omap44xx_i2c4_slaves, 2516 .slaves = omap44xx_i2c4_slaves,
2340 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c4_slaves), 2517 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c4_slaves),
2518 .dev_attr = &i2c_dev_attr,
2341 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 2519 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2342}; 2520};
2343 2521
@@ -2390,12 +2568,13 @@ static struct omap_hwmod_ocp_if *omap44xx_ipu_slaves[] = {
2390static struct omap_hwmod omap44xx_ipu_c0_hwmod = { 2568static struct omap_hwmod omap44xx_ipu_c0_hwmod = {
2391 .name = "ipu_c0", 2569 .name = "ipu_c0",
2392 .class = &omap44xx_ipu_hwmod_class, 2570 .class = &omap44xx_ipu_hwmod_class,
2571 .clkdm_name = "ducati_clkdm",
2393 .flags = HWMOD_INIT_NO_RESET, 2572 .flags = HWMOD_INIT_NO_RESET,
2394 .rst_lines = omap44xx_ipu_c0_resets, 2573 .rst_lines = omap44xx_ipu_c0_resets,
2395 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c0_resets), 2574 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c0_resets),
2396 .prcm = { 2575 .prcm = {
2397 .omap4 = { 2576 .omap4 = {
2398 .rstctrl_reg = OMAP4430_RM_DUCATI_RSTCTRL, 2577 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
2399 }, 2578 },
2400 }, 2579 },
2401 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 2580 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -2405,12 +2584,13 @@ static struct omap_hwmod omap44xx_ipu_c0_hwmod = {
2405static struct omap_hwmod omap44xx_ipu_c1_hwmod = { 2584static struct omap_hwmod omap44xx_ipu_c1_hwmod = {
2406 .name = "ipu_c1", 2585 .name = "ipu_c1",
2407 .class = &omap44xx_ipu_hwmod_class, 2586 .class = &omap44xx_ipu_hwmod_class,
2587 .clkdm_name = "ducati_clkdm",
2408 .flags = HWMOD_INIT_NO_RESET, 2588 .flags = HWMOD_INIT_NO_RESET,
2409 .rst_lines = omap44xx_ipu_c1_resets, 2589 .rst_lines = omap44xx_ipu_c1_resets,
2410 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c1_resets), 2590 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c1_resets),
2411 .prcm = { 2591 .prcm = {
2412 .omap4 = { 2592 .omap4 = {
2413 .rstctrl_reg = OMAP4430_RM_DUCATI_RSTCTRL, 2593 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
2414 }, 2594 },
2415 }, 2595 },
2416 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 2596 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -2419,14 +2599,17 @@ static struct omap_hwmod omap44xx_ipu_c1_hwmod = {
2419static struct omap_hwmod omap44xx_ipu_hwmod = { 2599static struct omap_hwmod omap44xx_ipu_hwmod = {
2420 .name = "ipu", 2600 .name = "ipu",
2421 .class = &omap44xx_ipu_hwmod_class, 2601 .class = &omap44xx_ipu_hwmod_class,
2602 .clkdm_name = "ducati_clkdm",
2422 .mpu_irqs = omap44xx_ipu_irqs, 2603 .mpu_irqs = omap44xx_ipu_irqs,
2423 .rst_lines = omap44xx_ipu_resets, 2604 .rst_lines = omap44xx_ipu_resets,
2424 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_resets), 2605 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_resets),
2425 .main_clk = "ipu_fck", 2606 .main_clk = "ipu_fck",
2426 .prcm = { 2607 .prcm = {
2427 .omap4 = { 2608 .omap4 = {
2428 .clkctrl_reg = OMAP4430_CM_DUCATI_DUCATI_CLKCTRL, 2609 .clkctrl_offs = OMAP4_CM_DUCATI_DUCATI_CLKCTRL_OFFSET,
2429 .rstctrl_reg = OMAP4430_RM_DUCATI_RSTCTRL, 2610 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
2611 .context_offs = OMAP4_RM_DUCATI_DUCATI_CONTEXT_OFFSET,
2612 .modulemode = MODULEMODE_HWCTRL,
2430 }, 2613 },
2431 }, 2614 },
2432 .slaves = omap44xx_ipu_slaves, 2615 .slaves = omap44xx_ipu_slaves,
@@ -2506,12 +2689,15 @@ static struct omap_hwmod_opt_clk iss_opt_clks[] = {
2506static struct omap_hwmod omap44xx_iss_hwmod = { 2689static struct omap_hwmod omap44xx_iss_hwmod = {
2507 .name = "iss", 2690 .name = "iss",
2508 .class = &omap44xx_iss_hwmod_class, 2691 .class = &omap44xx_iss_hwmod_class,
2692 .clkdm_name = "iss_clkdm",
2509 .mpu_irqs = omap44xx_iss_irqs, 2693 .mpu_irqs = omap44xx_iss_irqs,
2510 .sdma_reqs = omap44xx_iss_sdma_reqs, 2694 .sdma_reqs = omap44xx_iss_sdma_reqs,
2511 .main_clk = "iss_fck", 2695 .main_clk = "iss_fck",
2512 .prcm = { 2696 .prcm = {
2513 .omap4 = { 2697 .omap4 = {
2514 .clkctrl_reg = OMAP4430_CM_CAM_ISS_CLKCTRL, 2698 .clkctrl_offs = OMAP4_CM_CAM_ISS_CLKCTRL_OFFSET,
2699 .context_offs = OMAP4_RM_CAM_ISS_CONTEXT_OFFSET,
2700 .modulemode = MODULEMODE_SWCTRL,
2515 }, 2701 },
2516 }, 2702 },
2517 .opt_clks = iss_opt_clks, 2703 .opt_clks = iss_opt_clks,
@@ -2586,12 +2772,13 @@ static struct omap_hwmod_ocp_if *omap44xx_iva_slaves[] = {
2586static struct omap_hwmod omap44xx_iva_seq0_hwmod = { 2772static struct omap_hwmod omap44xx_iva_seq0_hwmod = {
2587 .name = "iva_seq0", 2773 .name = "iva_seq0",
2588 .class = &omap44xx_iva_hwmod_class, 2774 .class = &omap44xx_iva_hwmod_class,
2775 .clkdm_name = "ivahd_clkdm",
2589 .flags = HWMOD_INIT_NO_RESET, 2776 .flags = HWMOD_INIT_NO_RESET,
2590 .rst_lines = omap44xx_iva_seq0_resets, 2777 .rst_lines = omap44xx_iva_seq0_resets,
2591 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq0_resets), 2778 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq0_resets),
2592 .prcm = { 2779 .prcm = {
2593 .omap4 = { 2780 .omap4 = {
2594 .rstctrl_reg = OMAP4430_RM_IVAHD_RSTCTRL, 2781 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
2595 }, 2782 },
2596 }, 2783 },
2597 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 2784 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -2601,12 +2788,13 @@ static struct omap_hwmod omap44xx_iva_seq0_hwmod = {
2601static struct omap_hwmod omap44xx_iva_seq1_hwmod = { 2788static struct omap_hwmod omap44xx_iva_seq1_hwmod = {
2602 .name = "iva_seq1", 2789 .name = "iva_seq1",
2603 .class = &omap44xx_iva_hwmod_class, 2790 .class = &omap44xx_iva_hwmod_class,
2791 .clkdm_name = "ivahd_clkdm",
2604 .flags = HWMOD_INIT_NO_RESET, 2792 .flags = HWMOD_INIT_NO_RESET,
2605 .rst_lines = omap44xx_iva_seq1_resets, 2793 .rst_lines = omap44xx_iva_seq1_resets,
2606 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq1_resets), 2794 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq1_resets),
2607 .prcm = { 2795 .prcm = {
2608 .omap4 = { 2796 .omap4 = {
2609 .rstctrl_reg = OMAP4430_RM_IVAHD_RSTCTRL, 2797 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
2610 }, 2798 },
2611 }, 2799 },
2612 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 2800 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -2615,14 +2803,17 @@ static struct omap_hwmod omap44xx_iva_seq1_hwmod = {
2615static struct omap_hwmod omap44xx_iva_hwmod = { 2803static struct omap_hwmod omap44xx_iva_hwmod = {
2616 .name = "iva", 2804 .name = "iva",
2617 .class = &omap44xx_iva_hwmod_class, 2805 .class = &omap44xx_iva_hwmod_class,
2806 .clkdm_name = "ivahd_clkdm",
2618 .mpu_irqs = omap44xx_iva_irqs, 2807 .mpu_irqs = omap44xx_iva_irqs,
2619 .rst_lines = omap44xx_iva_resets, 2808 .rst_lines = omap44xx_iva_resets,
2620 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_resets), 2809 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_resets),
2621 .main_clk = "iva_fck", 2810 .main_clk = "iva_fck",
2622 .prcm = { 2811 .prcm = {
2623 .omap4 = { 2812 .omap4 = {
2624 .clkctrl_reg = OMAP4430_CM_IVAHD_IVAHD_CLKCTRL, 2813 .clkctrl_offs = OMAP4_CM_IVAHD_IVAHD_CLKCTRL_OFFSET,
2625 .rstctrl_reg = OMAP4430_RM_IVAHD_RSTCTRL, 2814 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
2815 .context_offs = OMAP4_RM_IVAHD_IVAHD_CONTEXT_OFFSET,
2816 .modulemode = MODULEMODE_HWCTRL,
2626 }, 2817 },
2627 }, 2818 },
2628 .slaves = omap44xx_iva_slaves, 2819 .slaves = omap44xx_iva_slaves,
@@ -2687,11 +2878,14 @@ static struct omap_hwmod_ocp_if *omap44xx_kbd_slaves[] = {
2687static struct omap_hwmod omap44xx_kbd_hwmod = { 2878static struct omap_hwmod omap44xx_kbd_hwmod = {
2688 .name = "kbd", 2879 .name = "kbd",
2689 .class = &omap44xx_kbd_hwmod_class, 2880 .class = &omap44xx_kbd_hwmod_class,
2881 .clkdm_name = "l4_wkup_clkdm",
2690 .mpu_irqs = omap44xx_kbd_irqs, 2882 .mpu_irqs = omap44xx_kbd_irqs,
2691 .main_clk = "kbd_fck", 2883 .main_clk = "kbd_fck",
2692 .prcm = { 2884 .prcm = {
2693 .omap4 = { 2885 .omap4 = {
2694 .clkctrl_reg = OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL, 2886 .clkctrl_offs = OMAP4_CM_WKUP_KEYBOARD_CLKCTRL_OFFSET,
2887 .context_offs = OMAP4_RM_WKUP_KEYBOARD_CONTEXT_OFFSET,
2888 .modulemode = MODULEMODE_SWCTRL,
2695 }, 2889 },
2696 }, 2890 },
2697 .slaves = omap44xx_kbd_slaves, 2891 .slaves = omap44xx_kbd_slaves,
@@ -2752,10 +2946,12 @@ static struct omap_hwmod_ocp_if *omap44xx_mailbox_slaves[] = {
2752static struct omap_hwmod omap44xx_mailbox_hwmod = { 2946static struct omap_hwmod omap44xx_mailbox_hwmod = {
2753 .name = "mailbox", 2947 .name = "mailbox",
2754 .class = &omap44xx_mailbox_hwmod_class, 2948 .class = &omap44xx_mailbox_hwmod_class,
2949 .clkdm_name = "l4_cfg_clkdm",
2755 .mpu_irqs = omap44xx_mailbox_irqs, 2950 .mpu_irqs = omap44xx_mailbox_irqs,
2756 .prcm = { 2951 .prcm = {
2757 .omap4 = { 2952 .omap4 = {
2758 .clkctrl_reg = OMAP4430_CM_L4CFG_MAILBOX_CLKCTRL, 2953 .clkctrl_offs = OMAP4_CM_L4CFG_MAILBOX_CLKCTRL_OFFSET,
2954 .context_offs = OMAP4_RM_L4CFG_MAILBOX_CONTEXT_OFFSET,
2759 }, 2955 },
2760 }, 2956 },
2761 .slaves = omap44xx_mailbox_slaves, 2957 .slaves = omap44xx_mailbox_slaves,
@@ -2842,12 +3038,15 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp1_slaves[] = {
2842static struct omap_hwmod omap44xx_mcbsp1_hwmod = { 3038static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
2843 .name = "mcbsp1", 3039 .name = "mcbsp1",
2844 .class = &omap44xx_mcbsp_hwmod_class, 3040 .class = &omap44xx_mcbsp_hwmod_class,
3041 .clkdm_name = "abe_clkdm",
2845 .mpu_irqs = omap44xx_mcbsp1_irqs, 3042 .mpu_irqs = omap44xx_mcbsp1_irqs,
2846 .sdma_reqs = omap44xx_mcbsp1_sdma_reqs, 3043 .sdma_reqs = omap44xx_mcbsp1_sdma_reqs,
2847 .main_clk = "mcbsp1_fck", 3044 .main_clk = "mcbsp1_fck",
2848 .prcm = { 3045 .prcm = {
2849 .omap4 = { 3046 .omap4 = {
2850 .clkctrl_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL, 3047 .clkctrl_offs = OMAP4_CM1_ABE_MCBSP1_CLKCTRL_OFFSET,
3048 .context_offs = OMAP4_RM_ABE_MCBSP1_CONTEXT_OFFSET,
3049 .modulemode = MODULEMODE_SWCTRL,
2851 }, 3050 },
2852 }, 3051 },
2853 .slaves = omap44xx_mcbsp1_slaves, 3052 .slaves = omap44xx_mcbsp1_slaves,
@@ -2915,12 +3114,15 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp2_slaves[] = {
2915static struct omap_hwmod omap44xx_mcbsp2_hwmod = { 3114static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
2916 .name = "mcbsp2", 3115 .name = "mcbsp2",
2917 .class = &omap44xx_mcbsp_hwmod_class, 3116 .class = &omap44xx_mcbsp_hwmod_class,
3117 .clkdm_name = "abe_clkdm",
2918 .mpu_irqs = omap44xx_mcbsp2_irqs, 3118 .mpu_irqs = omap44xx_mcbsp2_irqs,
2919 .sdma_reqs = omap44xx_mcbsp2_sdma_reqs, 3119 .sdma_reqs = omap44xx_mcbsp2_sdma_reqs,
2920 .main_clk = "mcbsp2_fck", 3120 .main_clk = "mcbsp2_fck",
2921 .prcm = { 3121 .prcm = {
2922 .omap4 = { 3122 .omap4 = {
2923 .clkctrl_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL, 3123 .clkctrl_offs = OMAP4_CM1_ABE_MCBSP2_CLKCTRL_OFFSET,
3124 .context_offs = OMAP4_RM_ABE_MCBSP2_CONTEXT_OFFSET,
3125 .modulemode = MODULEMODE_SWCTRL,
2924 }, 3126 },
2925 }, 3127 },
2926 .slaves = omap44xx_mcbsp2_slaves, 3128 .slaves = omap44xx_mcbsp2_slaves,
@@ -2988,12 +3190,15 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp3_slaves[] = {
2988static struct omap_hwmod omap44xx_mcbsp3_hwmod = { 3190static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
2989 .name = "mcbsp3", 3191 .name = "mcbsp3",
2990 .class = &omap44xx_mcbsp_hwmod_class, 3192 .class = &omap44xx_mcbsp_hwmod_class,
3193 .clkdm_name = "abe_clkdm",
2991 .mpu_irqs = omap44xx_mcbsp3_irqs, 3194 .mpu_irqs = omap44xx_mcbsp3_irqs,
2992 .sdma_reqs = omap44xx_mcbsp3_sdma_reqs, 3195 .sdma_reqs = omap44xx_mcbsp3_sdma_reqs,
2993 .main_clk = "mcbsp3_fck", 3196 .main_clk = "mcbsp3_fck",
2994 .prcm = { 3197 .prcm = {
2995 .omap4 = { 3198 .omap4 = {
2996 .clkctrl_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL, 3199 .clkctrl_offs = OMAP4_CM1_ABE_MCBSP3_CLKCTRL_OFFSET,
3200 .context_offs = OMAP4_RM_ABE_MCBSP3_CONTEXT_OFFSET,
3201 .modulemode = MODULEMODE_SWCTRL,
2997 }, 3202 },
2998 }, 3203 },
2999 .slaves = omap44xx_mcbsp3_slaves, 3204 .slaves = omap44xx_mcbsp3_slaves,
@@ -3040,12 +3245,15 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp4_slaves[] = {
3040static struct omap_hwmod omap44xx_mcbsp4_hwmod = { 3245static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
3041 .name = "mcbsp4", 3246 .name = "mcbsp4",
3042 .class = &omap44xx_mcbsp_hwmod_class, 3247 .class = &omap44xx_mcbsp_hwmod_class,
3248 .clkdm_name = "l4_per_clkdm",
3043 .mpu_irqs = omap44xx_mcbsp4_irqs, 3249 .mpu_irqs = omap44xx_mcbsp4_irqs,
3044 .sdma_reqs = omap44xx_mcbsp4_sdma_reqs, 3250 .sdma_reqs = omap44xx_mcbsp4_sdma_reqs,
3045 .main_clk = "mcbsp4_fck", 3251 .main_clk = "mcbsp4_fck",
3046 .prcm = { 3252 .prcm = {
3047 .omap4 = { 3253 .omap4 = {
3048 .clkctrl_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL, 3254 .clkctrl_offs = OMAP4_CM_L4PER_MCBSP4_CLKCTRL_OFFSET,
3255 .context_offs = OMAP4_RM_L4PER_MCBSP4_CONTEXT_OFFSET,
3256 .modulemode = MODULEMODE_SWCTRL,
3049 }, 3257 },
3050 }, 3258 },
3051 .slaves = omap44xx_mcbsp4_slaves, 3259 .slaves = omap44xx_mcbsp4_slaves,
@@ -3132,12 +3340,15 @@ static struct omap_hwmod_ocp_if *omap44xx_mcpdm_slaves[] = {
3132static struct omap_hwmod omap44xx_mcpdm_hwmod = { 3340static struct omap_hwmod omap44xx_mcpdm_hwmod = {
3133 .name = "mcpdm", 3341 .name = "mcpdm",
3134 .class = &omap44xx_mcpdm_hwmod_class, 3342 .class = &omap44xx_mcpdm_hwmod_class,
3343 .clkdm_name = "abe_clkdm",
3135 .mpu_irqs = omap44xx_mcpdm_irqs, 3344 .mpu_irqs = omap44xx_mcpdm_irqs,
3136 .sdma_reqs = omap44xx_mcpdm_sdma_reqs, 3345 .sdma_reqs = omap44xx_mcpdm_sdma_reqs,
3137 .main_clk = "mcpdm_fck", 3346 .main_clk = "mcpdm_fck",
3138 .prcm = { 3347 .prcm = {
3139 .omap4 = { 3348 .omap4 = {
3140 .clkctrl_reg = OMAP4430_CM1_ABE_PDM_CLKCTRL, 3349 .clkctrl_offs = OMAP4_CM1_ABE_PDM_CLKCTRL_OFFSET,
3350 .context_offs = OMAP4_RM_ABE_PDM_CONTEXT_OFFSET,
3351 .modulemode = MODULEMODE_SWCTRL,
3141 }, 3352 },
3142 }, 3353 },
3143 .slaves = omap44xx_mcpdm_slaves, 3354 .slaves = omap44xx_mcpdm_slaves,
@@ -3217,12 +3428,15 @@ static struct omap2_mcspi_dev_attr mcspi1_dev_attr = {
3217static struct omap_hwmod omap44xx_mcspi1_hwmod = { 3428static struct omap_hwmod omap44xx_mcspi1_hwmod = {
3218 .name = "mcspi1", 3429 .name = "mcspi1",
3219 .class = &omap44xx_mcspi_hwmod_class, 3430 .class = &omap44xx_mcspi_hwmod_class,
3431 .clkdm_name = "l4_per_clkdm",
3220 .mpu_irqs = omap44xx_mcspi1_irqs, 3432 .mpu_irqs = omap44xx_mcspi1_irqs,
3221 .sdma_reqs = omap44xx_mcspi1_sdma_reqs, 3433 .sdma_reqs = omap44xx_mcspi1_sdma_reqs,
3222 .main_clk = "mcspi1_fck", 3434 .main_clk = "mcspi1_fck",
3223 .prcm = { 3435 .prcm = {
3224 .omap4 = { 3436 .omap4 = {
3225 .clkctrl_reg = OMAP4430_CM_L4PER_MCSPI1_CLKCTRL, 3437 .clkctrl_offs = OMAP4_CM_L4PER_MCSPI1_CLKCTRL_OFFSET,
3438 .context_offs = OMAP4_RM_L4PER_MCSPI1_CONTEXT_OFFSET,
3439 .modulemode = MODULEMODE_SWCTRL,
3226 }, 3440 },
3227 }, 3441 },
3228 .dev_attr = &mcspi1_dev_attr, 3442 .dev_attr = &mcspi1_dev_attr,
@@ -3277,12 +3491,15 @@ static struct omap2_mcspi_dev_attr mcspi2_dev_attr = {
3277static struct omap_hwmod omap44xx_mcspi2_hwmod = { 3491static struct omap_hwmod omap44xx_mcspi2_hwmod = {
3278 .name = "mcspi2", 3492 .name = "mcspi2",
3279 .class = &omap44xx_mcspi_hwmod_class, 3493 .class = &omap44xx_mcspi_hwmod_class,
3494 .clkdm_name = "l4_per_clkdm",
3280 .mpu_irqs = omap44xx_mcspi2_irqs, 3495 .mpu_irqs = omap44xx_mcspi2_irqs,
3281 .sdma_reqs = omap44xx_mcspi2_sdma_reqs, 3496 .sdma_reqs = omap44xx_mcspi2_sdma_reqs,
3282 .main_clk = "mcspi2_fck", 3497 .main_clk = "mcspi2_fck",
3283 .prcm = { 3498 .prcm = {
3284 .omap4 = { 3499 .omap4 = {
3285 .clkctrl_reg = OMAP4430_CM_L4PER_MCSPI2_CLKCTRL, 3500 .clkctrl_offs = OMAP4_CM_L4PER_MCSPI2_CLKCTRL_OFFSET,
3501 .context_offs = OMAP4_RM_L4PER_MCSPI2_CONTEXT_OFFSET,
3502 .modulemode = MODULEMODE_SWCTRL,
3286 }, 3503 },
3287 }, 3504 },
3288 .dev_attr = &mcspi2_dev_attr, 3505 .dev_attr = &mcspi2_dev_attr,
@@ -3337,12 +3554,15 @@ static struct omap2_mcspi_dev_attr mcspi3_dev_attr = {
3337static struct omap_hwmod omap44xx_mcspi3_hwmod = { 3554static struct omap_hwmod omap44xx_mcspi3_hwmod = {
3338 .name = "mcspi3", 3555 .name = "mcspi3",
3339 .class = &omap44xx_mcspi_hwmod_class, 3556 .class = &omap44xx_mcspi_hwmod_class,
3557 .clkdm_name = "l4_per_clkdm",
3340 .mpu_irqs = omap44xx_mcspi3_irqs, 3558 .mpu_irqs = omap44xx_mcspi3_irqs,
3341 .sdma_reqs = omap44xx_mcspi3_sdma_reqs, 3559 .sdma_reqs = omap44xx_mcspi3_sdma_reqs,
3342 .main_clk = "mcspi3_fck", 3560 .main_clk = "mcspi3_fck",
3343 .prcm = { 3561 .prcm = {
3344 .omap4 = { 3562 .omap4 = {
3345 .clkctrl_reg = OMAP4430_CM_L4PER_MCSPI3_CLKCTRL, 3563 .clkctrl_offs = OMAP4_CM_L4PER_MCSPI3_CLKCTRL_OFFSET,
3564 .context_offs = OMAP4_RM_L4PER_MCSPI3_CONTEXT_OFFSET,
3565 .modulemode = MODULEMODE_SWCTRL,
3346 }, 3566 },
3347 }, 3567 },
3348 .dev_attr = &mcspi3_dev_attr, 3568 .dev_attr = &mcspi3_dev_attr,
@@ -3395,12 +3615,15 @@ static struct omap2_mcspi_dev_attr mcspi4_dev_attr = {
3395static struct omap_hwmod omap44xx_mcspi4_hwmod = { 3615static struct omap_hwmod omap44xx_mcspi4_hwmod = {
3396 .name = "mcspi4", 3616 .name = "mcspi4",
3397 .class = &omap44xx_mcspi_hwmod_class, 3617 .class = &omap44xx_mcspi_hwmod_class,
3618 .clkdm_name = "l4_per_clkdm",
3398 .mpu_irqs = omap44xx_mcspi4_irqs, 3619 .mpu_irqs = omap44xx_mcspi4_irqs,
3399 .sdma_reqs = omap44xx_mcspi4_sdma_reqs, 3620 .sdma_reqs = omap44xx_mcspi4_sdma_reqs,
3400 .main_clk = "mcspi4_fck", 3621 .main_clk = "mcspi4_fck",
3401 .prcm = { 3622 .prcm = {
3402 .omap4 = { 3623 .omap4 = {
3403 .clkctrl_reg = OMAP4430_CM_L4PER_MCSPI4_CLKCTRL, 3624 .clkctrl_offs = OMAP4_CM_L4PER_MCSPI4_CLKCTRL_OFFSET,
3625 .context_offs = OMAP4_RM_L4PER_MCSPI4_CONTEXT_OFFSET,
3626 .modulemode = MODULEMODE_SWCTRL,
3404 }, 3627 },
3405 }, 3628 },
3406 .dev_attr = &mcspi4_dev_attr, 3629 .dev_attr = &mcspi4_dev_attr,
@@ -3479,12 +3702,15 @@ static struct omap_mmc_dev_attr mmc1_dev_attr = {
3479static struct omap_hwmod omap44xx_mmc1_hwmod = { 3702static struct omap_hwmod omap44xx_mmc1_hwmod = {
3480 .name = "mmc1", 3703 .name = "mmc1",
3481 .class = &omap44xx_mmc_hwmod_class, 3704 .class = &omap44xx_mmc_hwmod_class,
3705 .clkdm_name = "l3_init_clkdm",
3482 .mpu_irqs = omap44xx_mmc1_irqs, 3706 .mpu_irqs = omap44xx_mmc1_irqs,
3483 .sdma_reqs = omap44xx_mmc1_sdma_reqs, 3707 .sdma_reqs = omap44xx_mmc1_sdma_reqs,
3484 .main_clk = "mmc1_fck", 3708 .main_clk = "mmc1_fck",
3485 .prcm = { 3709 .prcm = {
3486 .omap4 = { 3710 .omap4 = {
3487 .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL, 3711 .clkctrl_offs = OMAP4_CM_L3INIT_MMC1_CLKCTRL_OFFSET,
3712 .context_offs = OMAP4_RM_L3INIT_MMC1_CONTEXT_OFFSET,
3713 .modulemode = MODULEMODE_SWCTRL,
3488 }, 3714 },
3489 }, 3715 },
3490 .dev_attr = &mmc1_dev_attr, 3716 .dev_attr = &mmc1_dev_attr,
@@ -3538,12 +3764,15 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc2_slaves[] = {
3538static struct omap_hwmod omap44xx_mmc2_hwmod = { 3764static struct omap_hwmod omap44xx_mmc2_hwmod = {
3539 .name = "mmc2", 3765 .name = "mmc2",
3540 .class = &omap44xx_mmc_hwmod_class, 3766 .class = &omap44xx_mmc_hwmod_class,
3767 .clkdm_name = "l3_init_clkdm",
3541 .mpu_irqs = omap44xx_mmc2_irqs, 3768 .mpu_irqs = omap44xx_mmc2_irqs,
3542 .sdma_reqs = omap44xx_mmc2_sdma_reqs, 3769 .sdma_reqs = omap44xx_mmc2_sdma_reqs,
3543 .main_clk = "mmc2_fck", 3770 .main_clk = "mmc2_fck",
3544 .prcm = { 3771 .prcm = {
3545 .omap4 = { 3772 .omap4 = {
3546 .clkctrl_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL, 3773 .clkctrl_offs = OMAP4_CM_L3INIT_MMC2_CLKCTRL_OFFSET,
3774 .context_offs = OMAP4_RM_L3INIT_MMC2_CONTEXT_OFFSET,
3775 .modulemode = MODULEMODE_SWCTRL,
3547 }, 3776 },
3548 }, 3777 },
3549 .slaves = omap44xx_mmc2_slaves, 3778 .slaves = omap44xx_mmc2_slaves,
@@ -3592,12 +3821,15 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc3_slaves[] = {
3592static struct omap_hwmod omap44xx_mmc3_hwmod = { 3821static struct omap_hwmod omap44xx_mmc3_hwmod = {
3593 .name = "mmc3", 3822 .name = "mmc3",
3594 .class = &omap44xx_mmc_hwmod_class, 3823 .class = &omap44xx_mmc_hwmod_class,
3824 .clkdm_name = "l4_per_clkdm",
3595 .mpu_irqs = omap44xx_mmc3_irqs, 3825 .mpu_irqs = omap44xx_mmc3_irqs,
3596 .sdma_reqs = omap44xx_mmc3_sdma_reqs, 3826 .sdma_reqs = omap44xx_mmc3_sdma_reqs,
3597 .main_clk = "mmc3_fck", 3827 .main_clk = "mmc3_fck",
3598 .prcm = { 3828 .prcm = {
3599 .omap4 = { 3829 .omap4 = {
3600 .clkctrl_reg = OMAP4430_CM_L4PER_MMCSD3_CLKCTRL, 3830 .clkctrl_offs = OMAP4_CM_L4PER_MMCSD3_CLKCTRL_OFFSET,
3831 .context_offs = OMAP4_RM_L4PER_MMCSD3_CONTEXT_OFFSET,
3832 .modulemode = MODULEMODE_SWCTRL,
3601 }, 3833 },
3602 }, 3834 },
3603 .slaves = omap44xx_mmc3_slaves, 3835 .slaves = omap44xx_mmc3_slaves,
@@ -3644,13 +3876,16 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc4_slaves[] = {
3644static struct omap_hwmod omap44xx_mmc4_hwmod = { 3876static struct omap_hwmod omap44xx_mmc4_hwmod = {
3645 .name = "mmc4", 3877 .name = "mmc4",
3646 .class = &omap44xx_mmc_hwmod_class, 3878 .class = &omap44xx_mmc_hwmod_class,
3879 .clkdm_name = "l4_per_clkdm",
3647 .mpu_irqs = omap44xx_mmc4_irqs, 3880 .mpu_irqs = omap44xx_mmc4_irqs,
3648 3881
3649 .sdma_reqs = omap44xx_mmc4_sdma_reqs, 3882 .sdma_reqs = omap44xx_mmc4_sdma_reqs,
3650 .main_clk = "mmc4_fck", 3883 .main_clk = "mmc4_fck",
3651 .prcm = { 3884 .prcm = {
3652 .omap4 = { 3885 .omap4 = {
3653 .clkctrl_reg = OMAP4430_CM_L4PER_MMCSD4_CLKCTRL, 3886 .clkctrl_offs = OMAP4_CM_L4PER_MMCSD4_CLKCTRL_OFFSET,
3887 .context_offs = OMAP4_RM_L4PER_MMCSD4_CONTEXT_OFFSET,
3888 .modulemode = MODULEMODE_SWCTRL,
3654 }, 3889 },
3655 }, 3890 },
3656 .slaves = omap44xx_mmc4_slaves, 3891 .slaves = omap44xx_mmc4_slaves,
@@ -3697,12 +3932,15 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc5_slaves[] = {
3697static struct omap_hwmod omap44xx_mmc5_hwmod = { 3932static struct omap_hwmod omap44xx_mmc5_hwmod = {
3698 .name = "mmc5", 3933 .name = "mmc5",
3699 .class = &omap44xx_mmc_hwmod_class, 3934 .class = &omap44xx_mmc_hwmod_class,
3935 .clkdm_name = "l4_per_clkdm",
3700 .mpu_irqs = omap44xx_mmc5_irqs, 3936 .mpu_irqs = omap44xx_mmc5_irqs,
3701 .sdma_reqs = omap44xx_mmc5_sdma_reqs, 3937 .sdma_reqs = omap44xx_mmc5_sdma_reqs,
3702 .main_clk = "mmc5_fck", 3938 .main_clk = "mmc5_fck",
3703 .prcm = { 3939 .prcm = {
3704 .omap4 = { 3940 .omap4 = {
3705 .clkctrl_reg = OMAP4430_CM_L4PER_MMCSD5_CLKCTRL, 3941 .clkctrl_offs = OMAP4_CM_L4PER_MMCSD5_CLKCTRL_OFFSET,
3942 .context_offs = OMAP4_RM_L4PER_MMCSD5_CONTEXT_OFFSET,
3943 .modulemode = MODULEMODE_SWCTRL,
3706 }, 3944 },
3707 }, 3945 },
3708 .slaves = omap44xx_mmc5_slaves, 3946 .slaves = omap44xx_mmc5_slaves,
@@ -3737,12 +3975,14 @@ static struct omap_hwmod_ocp_if *omap44xx_mpu_masters[] = {
3737static struct omap_hwmod omap44xx_mpu_hwmod = { 3975static struct omap_hwmod omap44xx_mpu_hwmod = {
3738 .name = "mpu", 3976 .name = "mpu",
3739 .class = &omap44xx_mpu_hwmod_class, 3977 .class = &omap44xx_mpu_hwmod_class,
3978 .clkdm_name = "mpuss_clkdm",
3740 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 3979 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
3741 .mpu_irqs = omap44xx_mpu_irqs, 3980 .mpu_irqs = omap44xx_mpu_irqs,
3742 .main_clk = "dpll_mpu_m2_ck", 3981 .main_clk = "dpll_mpu_m2_ck",
3743 .prcm = { 3982 .prcm = {
3744 .omap4 = { 3983 .omap4 = {
3745 .clkctrl_reg = OMAP4430_CM_MPU_MPU_CLKCTRL, 3984 .clkctrl_offs = OMAP4_CM_MPU_MPU_CLKCTRL_OFFSET,
3985 .context_offs = OMAP4_RM_MPU_MPU_CONTEXT_OFFSET,
3746 }, 3986 },
3747 }, 3987 },
3748 .masters = omap44xx_mpu_masters, 3988 .masters = omap44xx_mpu_masters,
@@ -3809,13 +4049,16 @@ static struct omap_hwmod_ocp_if *omap44xx_smartreflex_core_slaves[] = {
3809static struct omap_hwmod omap44xx_smartreflex_core_hwmod = { 4049static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
3810 .name = "smartreflex_core", 4050 .name = "smartreflex_core",
3811 .class = &omap44xx_smartreflex_hwmod_class, 4051 .class = &omap44xx_smartreflex_hwmod_class,
4052 .clkdm_name = "l4_ao_clkdm",
3812 .mpu_irqs = omap44xx_smartreflex_core_irqs, 4053 .mpu_irqs = omap44xx_smartreflex_core_irqs,
3813 4054
3814 .main_clk = "smartreflex_core_fck", 4055 .main_clk = "smartreflex_core_fck",
3815 .vdd_name = "core", 4056 .vdd_name = "core",
3816 .prcm = { 4057 .prcm = {
3817 .omap4 = { 4058 .omap4 = {
3818 .clkctrl_reg = OMAP4430_CM_ALWON_SR_CORE_CLKCTRL, 4059 .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET,
4060 .context_offs = OMAP4_RM_ALWON_SR_CORE_CONTEXT_OFFSET,
4061 .modulemode = MODULEMODE_SWCTRL,
3819 }, 4062 },
3820 }, 4063 },
3821 .slaves = omap44xx_smartreflex_core_slaves, 4064 .slaves = omap44xx_smartreflex_core_slaves,
@@ -3856,12 +4099,15 @@ static struct omap_hwmod_ocp_if *omap44xx_smartreflex_iva_slaves[] = {
3856static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = { 4099static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
3857 .name = "smartreflex_iva", 4100 .name = "smartreflex_iva",
3858 .class = &omap44xx_smartreflex_hwmod_class, 4101 .class = &omap44xx_smartreflex_hwmod_class,
4102 .clkdm_name = "l4_ao_clkdm",
3859 .mpu_irqs = omap44xx_smartreflex_iva_irqs, 4103 .mpu_irqs = omap44xx_smartreflex_iva_irqs,
3860 .main_clk = "smartreflex_iva_fck", 4104 .main_clk = "smartreflex_iva_fck",
3861 .vdd_name = "iva", 4105 .vdd_name = "iva",
3862 .prcm = { 4106 .prcm = {
3863 .omap4 = { 4107 .omap4 = {
3864 .clkctrl_reg = OMAP4430_CM_ALWON_SR_IVA_CLKCTRL, 4108 .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET,
4109 .context_offs = OMAP4_RM_ALWON_SR_IVA_CONTEXT_OFFSET,
4110 .modulemode = MODULEMODE_SWCTRL,
3865 }, 4111 },
3866 }, 4112 },
3867 .slaves = omap44xx_smartreflex_iva_slaves, 4113 .slaves = omap44xx_smartreflex_iva_slaves,
@@ -3902,12 +4148,15 @@ static struct omap_hwmod_ocp_if *omap44xx_smartreflex_mpu_slaves[] = {
3902static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = { 4148static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
3903 .name = "smartreflex_mpu", 4149 .name = "smartreflex_mpu",
3904 .class = &omap44xx_smartreflex_hwmod_class, 4150 .class = &omap44xx_smartreflex_hwmod_class,
4151 .clkdm_name = "l4_ao_clkdm",
3905 .mpu_irqs = omap44xx_smartreflex_mpu_irqs, 4152 .mpu_irqs = omap44xx_smartreflex_mpu_irqs,
3906 .main_clk = "smartreflex_mpu_fck", 4153 .main_clk = "smartreflex_mpu_fck",
3907 .vdd_name = "mpu", 4154 .vdd_name = "mpu",
3908 .prcm = { 4155 .prcm = {
3909 .omap4 = { 4156 .omap4 = {
3910 .clkctrl_reg = OMAP4430_CM_ALWON_SR_MPU_CLKCTRL, 4157 .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET,
4158 .context_offs = OMAP4_RM_ALWON_SR_MPU_CONTEXT_OFFSET,
4159 .modulemode = MODULEMODE_SWCTRL,
3911 }, 4160 },
3912 }, 4161 },
3913 .slaves = omap44xx_smartreflex_mpu_slaves, 4162 .slaves = omap44xx_smartreflex_mpu_slaves,
@@ -3966,9 +4215,11 @@ static struct omap_hwmod_ocp_if *omap44xx_spinlock_slaves[] = {
3966static struct omap_hwmod omap44xx_spinlock_hwmod = { 4215static struct omap_hwmod omap44xx_spinlock_hwmod = {
3967 .name = "spinlock", 4216 .name = "spinlock",
3968 .class = &omap44xx_spinlock_hwmod_class, 4217 .class = &omap44xx_spinlock_hwmod_class,
4218 .clkdm_name = "l4_cfg_clkdm",
3969 .prcm = { 4219 .prcm = {
3970 .omap4 = { 4220 .omap4 = {
3971 .clkctrl_reg = OMAP4430_CM_L4CFG_HW_SEM_CLKCTRL, 4221 .clkctrl_offs = OMAP4_CM_L4CFG_HW_SEM_CLKCTRL_OFFSET,
4222 .context_offs = OMAP4_RM_L4CFG_HW_SEM_CONTEXT_OFFSET,
3972 }, 4223 },
3973 }, 4224 },
3974 .slaves = omap44xx_spinlock_slaves, 4225 .slaves = omap44xx_spinlock_slaves,
@@ -4047,11 +4298,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer1_slaves[] = {
4047static struct omap_hwmod omap44xx_timer1_hwmod = { 4298static struct omap_hwmod omap44xx_timer1_hwmod = {
4048 .name = "timer1", 4299 .name = "timer1",
4049 .class = &omap44xx_timer_1ms_hwmod_class, 4300 .class = &omap44xx_timer_1ms_hwmod_class,
4301 .clkdm_name = "l4_wkup_clkdm",
4050 .mpu_irqs = omap44xx_timer1_irqs, 4302 .mpu_irqs = omap44xx_timer1_irqs,
4051 .main_clk = "timer1_fck", 4303 .main_clk = "timer1_fck",
4052 .prcm = { 4304 .prcm = {
4053 .omap4 = { 4305 .omap4 = {
4054 .clkctrl_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL, 4306 .clkctrl_offs = OMAP4_CM_WKUP_TIMER1_CLKCTRL_OFFSET,
4307 .context_offs = OMAP4_RM_WKUP_TIMER1_CONTEXT_OFFSET,
4308 .modulemode = MODULEMODE_SWCTRL,
4055 }, 4309 },
4056 }, 4310 },
4057 .slaves = omap44xx_timer1_slaves, 4311 .slaves = omap44xx_timer1_slaves,
@@ -4092,11 +4346,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer2_slaves[] = {
4092static struct omap_hwmod omap44xx_timer2_hwmod = { 4346static struct omap_hwmod omap44xx_timer2_hwmod = {
4093 .name = "timer2", 4347 .name = "timer2",
4094 .class = &omap44xx_timer_1ms_hwmod_class, 4348 .class = &omap44xx_timer_1ms_hwmod_class,
4349 .clkdm_name = "l4_per_clkdm",
4095 .mpu_irqs = omap44xx_timer2_irqs, 4350 .mpu_irqs = omap44xx_timer2_irqs,
4096 .main_clk = "timer2_fck", 4351 .main_clk = "timer2_fck",
4097 .prcm = { 4352 .prcm = {
4098 .omap4 = { 4353 .omap4 = {
4099 .clkctrl_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL, 4354 .clkctrl_offs = OMAP4_CM_L4PER_DMTIMER2_CLKCTRL_OFFSET,
4355 .context_offs = OMAP4_RM_L4PER_DMTIMER2_CONTEXT_OFFSET,
4356 .modulemode = MODULEMODE_SWCTRL,
4100 }, 4357 },
4101 }, 4358 },
4102 .slaves = omap44xx_timer2_slaves, 4359 .slaves = omap44xx_timer2_slaves,
@@ -4137,11 +4394,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer3_slaves[] = {
4137static struct omap_hwmod omap44xx_timer3_hwmod = { 4394static struct omap_hwmod omap44xx_timer3_hwmod = {
4138 .name = "timer3", 4395 .name = "timer3",
4139 .class = &omap44xx_timer_hwmod_class, 4396 .class = &omap44xx_timer_hwmod_class,
4397 .clkdm_name = "l4_per_clkdm",
4140 .mpu_irqs = omap44xx_timer3_irqs, 4398 .mpu_irqs = omap44xx_timer3_irqs,
4141 .main_clk = "timer3_fck", 4399 .main_clk = "timer3_fck",
4142 .prcm = { 4400 .prcm = {
4143 .omap4 = { 4401 .omap4 = {
4144 .clkctrl_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL, 4402 .clkctrl_offs = OMAP4_CM_L4PER_DMTIMER3_CLKCTRL_OFFSET,
4403 .context_offs = OMAP4_RM_L4PER_DMTIMER3_CONTEXT_OFFSET,
4404 .modulemode = MODULEMODE_SWCTRL,
4145 }, 4405 },
4146 }, 4406 },
4147 .slaves = omap44xx_timer3_slaves, 4407 .slaves = omap44xx_timer3_slaves,
@@ -4182,11 +4442,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer4_slaves[] = {
4182static struct omap_hwmod omap44xx_timer4_hwmod = { 4442static struct omap_hwmod omap44xx_timer4_hwmod = {
4183 .name = "timer4", 4443 .name = "timer4",
4184 .class = &omap44xx_timer_hwmod_class, 4444 .class = &omap44xx_timer_hwmod_class,
4445 .clkdm_name = "l4_per_clkdm",
4185 .mpu_irqs = omap44xx_timer4_irqs, 4446 .mpu_irqs = omap44xx_timer4_irqs,
4186 .main_clk = "timer4_fck", 4447 .main_clk = "timer4_fck",
4187 .prcm = { 4448 .prcm = {
4188 .omap4 = { 4449 .omap4 = {
4189 .clkctrl_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL, 4450 .clkctrl_offs = OMAP4_CM_L4PER_DMTIMER4_CLKCTRL_OFFSET,
4451 .context_offs = OMAP4_RM_L4PER_DMTIMER4_CONTEXT_OFFSET,
4452 .modulemode = MODULEMODE_SWCTRL,
4190 }, 4453 },
4191 }, 4454 },
4192 .slaves = omap44xx_timer4_slaves, 4455 .slaves = omap44xx_timer4_slaves,
@@ -4246,11 +4509,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer5_slaves[] = {
4246static struct omap_hwmod omap44xx_timer5_hwmod = { 4509static struct omap_hwmod omap44xx_timer5_hwmod = {
4247 .name = "timer5", 4510 .name = "timer5",
4248 .class = &omap44xx_timer_hwmod_class, 4511 .class = &omap44xx_timer_hwmod_class,
4512 .clkdm_name = "abe_clkdm",
4249 .mpu_irqs = omap44xx_timer5_irqs, 4513 .mpu_irqs = omap44xx_timer5_irqs,
4250 .main_clk = "timer5_fck", 4514 .main_clk = "timer5_fck",
4251 .prcm = { 4515 .prcm = {
4252 .omap4 = { 4516 .omap4 = {
4253 .clkctrl_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL, 4517 .clkctrl_offs = OMAP4_CM1_ABE_TIMER5_CLKCTRL_OFFSET,
4518 .context_offs = OMAP4_RM_ABE_TIMER5_CONTEXT_OFFSET,
4519 .modulemode = MODULEMODE_SWCTRL,
4254 }, 4520 },
4255 }, 4521 },
4256 .slaves = omap44xx_timer5_slaves, 4522 .slaves = omap44xx_timer5_slaves,
@@ -4310,12 +4576,15 @@ static struct omap_hwmod_ocp_if *omap44xx_timer6_slaves[] = {
4310static struct omap_hwmod omap44xx_timer6_hwmod = { 4576static struct omap_hwmod omap44xx_timer6_hwmod = {
4311 .name = "timer6", 4577 .name = "timer6",
4312 .class = &omap44xx_timer_hwmod_class, 4578 .class = &omap44xx_timer_hwmod_class,
4579 .clkdm_name = "abe_clkdm",
4313 .mpu_irqs = omap44xx_timer6_irqs, 4580 .mpu_irqs = omap44xx_timer6_irqs,
4314 4581
4315 .main_clk = "timer6_fck", 4582 .main_clk = "timer6_fck",
4316 .prcm = { 4583 .prcm = {
4317 .omap4 = { 4584 .omap4 = {
4318 .clkctrl_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL, 4585 .clkctrl_offs = OMAP4_CM1_ABE_TIMER6_CLKCTRL_OFFSET,
4586 .context_offs = OMAP4_RM_ABE_TIMER6_CONTEXT_OFFSET,
4587 .modulemode = MODULEMODE_SWCTRL,
4319 }, 4588 },
4320 }, 4589 },
4321 .slaves = omap44xx_timer6_slaves, 4590 .slaves = omap44xx_timer6_slaves,
@@ -4375,11 +4644,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer7_slaves[] = {
4375static struct omap_hwmod omap44xx_timer7_hwmod = { 4644static struct omap_hwmod omap44xx_timer7_hwmod = {
4376 .name = "timer7", 4645 .name = "timer7",
4377 .class = &omap44xx_timer_hwmod_class, 4646 .class = &omap44xx_timer_hwmod_class,
4647 .clkdm_name = "abe_clkdm",
4378 .mpu_irqs = omap44xx_timer7_irqs, 4648 .mpu_irqs = omap44xx_timer7_irqs,
4379 .main_clk = "timer7_fck", 4649 .main_clk = "timer7_fck",
4380 .prcm = { 4650 .prcm = {
4381 .omap4 = { 4651 .omap4 = {
4382 .clkctrl_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL, 4652 .clkctrl_offs = OMAP4_CM1_ABE_TIMER7_CLKCTRL_OFFSET,
4653 .context_offs = OMAP4_RM_ABE_TIMER7_CONTEXT_OFFSET,
4654 .modulemode = MODULEMODE_SWCTRL,
4383 }, 4655 },
4384 }, 4656 },
4385 .slaves = omap44xx_timer7_slaves, 4657 .slaves = omap44xx_timer7_slaves,
@@ -4439,11 +4711,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer8_slaves[] = {
4439static struct omap_hwmod omap44xx_timer8_hwmod = { 4711static struct omap_hwmod omap44xx_timer8_hwmod = {
4440 .name = "timer8", 4712 .name = "timer8",
4441 .class = &omap44xx_timer_hwmod_class, 4713 .class = &omap44xx_timer_hwmod_class,
4714 .clkdm_name = "abe_clkdm",
4442 .mpu_irqs = omap44xx_timer8_irqs, 4715 .mpu_irqs = omap44xx_timer8_irqs,
4443 .main_clk = "timer8_fck", 4716 .main_clk = "timer8_fck",
4444 .prcm = { 4717 .prcm = {
4445 .omap4 = { 4718 .omap4 = {
4446 .clkctrl_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL, 4719 .clkctrl_offs = OMAP4_CM1_ABE_TIMER8_CLKCTRL_OFFSET,
4720 .context_offs = OMAP4_RM_ABE_TIMER8_CONTEXT_OFFSET,
4721 .modulemode = MODULEMODE_SWCTRL,
4447 }, 4722 },
4448 }, 4723 },
4449 .slaves = omap44xx_timer8_slaves, 4724 .slaves = omap44xx_timer8_slaves,
@@ -4484,11 +4759,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer9_slaves[] = {
4484static struct omap_hwmod omap44xx_timer9_hwmod = { 4759static struct omap_hwmod omap44xx_timer9_hwmod = {
4485 .name = "timer9", 4760 .name = "timer9",
4486 .class = &omap44xx_timer_hwmod_class, 4761 .class = &omap44xx_timer_hwmod_class,
4762 .clkdm_name = "l4_per_clkdm",
4487 .mpu_irqs = omap44xx_timer9_irqs, 4763 .mpu_irqs = omap44xx_timer9_irqs,
4488 .main_clk = "timer9_fck", 4764 .main_clk = "timer9_fck",
4489 .prcm = { 4765 .prcm = {
4490 .omap4 = { 4766 .omap4 = {
4491 .clkctrl_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL, 4767 .clkctrl_offs = OMAP4_CM_L4PER_DMTIMER9_CLKCTRL_OFFSET,
4768 .context_offs = OMAP4_RM_L4PER_DMTIMER9_CONTEXT_OFFSET,
4769 .modulemode = MODULEMODE_SWCTRL,
4492 }, 4770 },
4493 }, 4771 },
4494 .slaves = omap44xx_timer9_slaves, 4772 .slaves = omap44xx_timer9_slaves,
@@ -4529,11 +4807,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer10_slaves[] = {
4529static struct omap_hwmod omap44xx_timer10_hwmod = { 4807static struct omap_hwmod omap44xx_timer10_hwmod = {
4530 .name = "timer10", 4808 .name = "timer10",
4531 .class = &omap44xx_timer_1ms_hwmod_class, 4809 .class = &omap44xx_timer_1ms_hwmod_class,
4810 .clkdm_name = "l4_per_clkdm",
4532 .mpu_irqs = omap44xx_timer10_irqs, 4811 .mpu_irqs = omap44xx_timer10_irqs,
4533 .main_clk = "timer10_fck", 4812 .main_clk = "timer10_fck",
4534 .prcm = { 4813 .prcm = {
4535 .omap4 = { 4814 .omap4 = {
4536 .clkctrl_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL, 4815 .clkctrl_offs = OMAP4_CM_L4PER_DMTIMER10_CLKCTRL_OFFSET,
4816 .context_offs = OMAP4_RM_L4PER_DMTIMER10_CONTEXT_OFFSET,
4817 .modulemode = MODULEMODE_SWCTRL,
4537 }, 4818 },
4538 }, 4819 },
4539 .slaves = omap44xx_timer10_slaves, 4820 .slaves = omap44xx_timer10_slaves,
@@ -4574,11 +4855,14 @@ static struct omap_hwmod_ocp_if *omap44xx_timer11_slaves[] = {
4574static struct omap_hwmod omap44xx_timer11_hwmod = { 4855static struct omap_hwmod omap44xx_timer11_hwmod = {
4575 .name = "timer11", 4856 .name = "timer11",
4576 .class = &omap44xx_timer_hwmod_class, 4857 .class = &omap44xx_timer_hwmod_class,
4858 .clkdm_name = "l4_per_clkdm",
4577 .mpu_irqs = omap44xx_timer11_irqs, 4859 .mpu_irqs = omap44xx_timer11_irqs,
4578 .main_clk = "timer11_fck", 4860 .main_clk = "timer11_fck",
4579 .prcm = { 4861 .prcm = {
4580 .omap4 = { 4862 .omap4 = {
4581 .clkctrl_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL, 4863 .clkctrl_offs = OMAP4_CM_L4PER_DMTIMER11_CLKCTRL_OFFSET,
4864 .context_offs = OMAP4_RM_L4PER_DMTIMER11_CONTEXT_OFFSET,
4865 .modulemode = MODULEMODE_SWCTRL,
4582 }, 4866 },
4583 }, 4867 },
4584 .slaves = omap44xx_timer11_slaves, 4868 .slaves = omap44xx_timer11_slaves,
@@ -4647,12 +4931,15 @@ static struct omap_hwmod_ocp_if *omap44xx_uart1_slaves[] = {
4647static struct omap_hwmod omap44xx_uart1_hwmod = { 4931static struct omap_hwmod omap44xx_uart1_hwmod = {
4648 .name = "uart1", 4932 .name = "uart1",
4649 .class = &omap44xx_uart_hwmod_class, 4933 .class = &omap44xx_uart_hwmod_class,
4934 .clkdm_name = "l4_per_clkdm",
4650 .mpu_irqs = omap44xx_uart1_irqs, 4935 .mpu_irqs = omap44xx_uart1_irqs,
4651 .sdma_reqs = omap44xx_uart1_sdma_reqs, 4936 .sdma_reqs = omap44xx_uart1_sdma_reqs,
4652 .main_clk = "uart1_fck", 4937 .main_clk = "uart1_fck",
4653 .prcm = { 4938 .prcm = {
4654 .omap4 = { 4939 .omap4 = {
4655 .clkctrl_reg = OMAP4430_CM_L4PER_UART1_CLKCTRL, 4940 .clkctrl_offs = OMAP4_CM_L4PER_UART1_CLKCTRL_OFFSET,
4941 .context_offs = OMAP4_RM_L4PER_UART1_CONTEXT_OFFSET,
4942 .modulemode = MODULEMODE_SWCTRL,
4656 }, 4943 },
4657 }, 4944 },
4658 .slaves = omap44xx_uart1_slaves, 4945 .slaves = omap44xx_uart1_slaves,
@@ -4699,12 +4986,15 @@ static struct omap_hwmod_ocp_if *omap44xx_uart2_slaves[] = {
4699static struct omap_hwmod omap44xx_uart2_hwmod = { 4986static struct omap_hwmod omap44xx_uart2_hwmod = {
4700 .name = "uart2", 4987 .name = "uart2",
4701 .class = &omap44xx_uart_hwmod_class, 4988 .class = &omap44xx_uart_hwmod_class,
4989 .clkdm_name = "l4_per_clkdm",
4702 .mpu_irqs = omap44xx_uart2_irqs, 4990 .mpu_irqs = omap44xx_uart2_irqs,
4703 .sdma_reqs = omap44xx_uart2_sdma_reqs, 4991 .sdma_reqs = omap44xx_uart2_sdma_reqs,
4704 .main_clk = "uart2_fck", 4992 .main_clk = "uart2_fck",
4705 .prcm = { 4993 .prcm = {
4706 .omap4 = { 4994 .omap4 = {
4707 .clkctrl_reg = OMAP4430_CM_L4PER_UART2_CLKCTRL, 4995 .clkctrl_offs = OMAP4_CM_L4PER_UART2_CLKCTRL_OFFSET,
4996 .context_offs = OMAP4_RM_L4PER_UART2_CONTEXT_OFFSET,
4997 .modulemode = MODULEMODE_SWCTRL,
4708 }, 4998 },
4709 }, 4999 },
4710 .slaves = omap44xx_uart2_slaves, 5000 .slaves = omap44xx_uart2_slaves,
@@ -4751,13 +5041,16 @@ static struct omap_hwmod_ocp_if *omap44xx_uart3_slaves[] = {
4751static struct omap_hwmod omap44xx_uart3_hwmod = { 5041static struct omap_hwmod omap44xx_uart3_hwmod = {
4752 .name = "uart3", 5042 .name = "uart3",
4753 .class = &omap44xx_uart_hwmod_class, 5043 .class = &omap44xx_uart_hwmod_class,
5044 .clkdm_name = "l4_per_clkdm",
4754 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 5045 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
4755 .mpu_irqs = omap44xx_uart3_irqs, 5046 .mpu_irqs = omap44xx_uart3_irqs,
4756 .sdma_reqs = omap44xx_uart3_sdma_reqs, 5047 .sdma_reqs = omap44xx_uart3_sdma_reqs,
4757 .main_clk = "uart3_fck", 5048 .main_clk = "uart3_fck",
4758 .prcm = { 5049 .prcm = {
4759 .omap4 = { 5050 .omap4 = {
4760 .clkctrl_reg = OMAP4430_CM_L4PER_UART3_CLKCTRL, 5051 .clkctrl_offs = OMAP4_CM_L4PER_UART3_CLKCTRL_OFFSET,
5052 .context_offs = OMAP4_RM_L4PER_UART3_CONTEXT_OFFSET,
5053 .modulemode = MODULEMODE_SWCTRL,
4761 }, 5054 },
4762 }, 5055 },
4763 .slaves = omap44xx_uart3_slaves, 5056 .slaves = omap44xx_uart3_slaves,
@@ -4804,12 +5097,15 @@ static struct omap_hwmod_ocp_if *omap44xx_uart4_slaves[] = {
4804static struct omap_hwmod omap44xx_uart4_hwmod = { 5097static struct omap_hwmod omap44xx_uart4_hwmod = {
4805 .name = "uart4", 5098 .name = "uart4",
4806 .class = &omap44xx_uart_hwmod_class, 5099 .class = &omap44xx_uart_hwmod_class,
5100 .clkdm_name = "l4_per_clkdm",
4807 .mpu_irqs = omap44xx_uart4_irqs, 5101 .mpu_irqs = omap44xx_uart4_irqs,
4808 .sdma_reqs = omap44xx_uart4_sdma_reqs, 5102 .sdma_reqs = omap44xx_uart4_sdma_reqs,
4809 .main_clk = "uart4_fck", 5103 .main_clk = "uart4_fck",
4810 .prcm = { 5104 .prcm = {
4811 .omap4 = { 5105 .omap4 = {
4812 .clkctrl_reg = OMAP4430_CM_L4PER_UART4_CLKCTRL, 5106 .clkctrl_offs = OMAP4_CM_L4PER_UART4_CLKCTRL_OFFSET,
5107 .context_offs = OMAP4_RM_L4PER_UART4_CONTEXT_OFFSET,
5108 .modulemode = MODULEMODE_SWCTRL,
4813 }, 5109 },
4814 }, 5110 },
4815 .slaves = omap44xx_uart4_slaves, 5111 .slaves = omap44xx_uart4_slaves,
@@ -4882,12 +5178,15 @@ static struct omap_hwmod_opt_clk usb_otg_hs_opt_clks[] = {
4882static struct omap_hwmod omap44xx_usb_otg_hs_hwmod = { 5178static struct omap_hwmod omap44xx_usb_otg_hs_hwmod = {
4883 .name = "usb_otg_hs", 5179 .name = "usb_otg_hs",
4884 .class = &omap44xx_usb_otg_hs_hwmod_class, 5180 .class = &omap44xx_usb_otg_hs_hwmod_class,
5181 .clkdm_name = "l3_init_clkdm",
4885 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, 5182 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
4886 .mpu_irqs = omap44xx_usb_otg_hs_irqs, 5183 .mpu_irqs = omap44xx_usb_otg_hs_irqs,
4887 .main_clk = "usb_otg_hs_ick", 5184 .main_clk = "usb_otg_hs_ick",
4888 .prcm = { 5185 .prcm = {
4889 .omap4 = { 5186 .omap4 = {
4890 .clkctrl_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL, 5187 .clkctrl_offs = OMAP4_CM_L3INIT_USB_OTG_CLKCTRL_OFFSET,
5188 .context_offs = OMAP4_RM_L3INIT_USB_OTG_CONTEXT_OFFSET,
5189 .modulemode = MODULEMODE_HWCTRL,
4891 }, 5190 },
4892 }, 5191 },
4893 .opt_clks = usb_otg_hs_opt_clks, 5192 .opt_clks = usb_otg_hs_opt_clks,
@@ -4955,11 +5254,14 @@ static struct omap_hwmod_ocp_if *omap44xx_wd_timer2_slaves[] = {
4955static struct omap_hwmod omap44xx_wd_timer2_hwmod = { 5254static struct omap_hwmod omap44xx_wd_timer2_hwmod = {
4956 .name = "wd_timer2", 5255 .name = "wd_timer2",
4957 .class = &omap44xx_wd_timer_hwmod_class, 5256 .class = &omap44xx_wd_timer_hwmod_class,
5257 .clkdm_name = "l4_wkup_clkdm",
4958 .mpu_irqs = omap44xx_wd_timer2_irqs, 5258 .mpu_irqs = omap44xx_wd_timer2_irqs,
4959 .main_clk = "wd_timer2_fck", 5259 .main_clk = "wd_timer2_fck",
4960 .prcm = { 5260 .prcm = {
4961 .omap4 = { 5261 .omap4 = {
4962 .clkctrl_reg = OMAP4430_CM_WKUP_WDT2_CLKCTRL, 5262 .clkctrl_offs = OMAP4_CM_WKUP_WDT2_CLKCTRL_OFFSET,
5263 .context_offs = OMAP4_RM_WKUP_WDT2_CONTEXT_OFFSET,
5264 .modulemode = MODULEMODE_SWCTRL,
4963 }, 5265 },
4964 }, 5266 },
4965 .slaves = omap44xx_wd_timer2_slaves, 5267 .slaves = omap44xx_wd_timer2_slaves,
@@ -5019,11 +5321,14 @@ static struct omap_hwmod_ocp_if *omap44xx_wd_timer3_slaves[] = {
5019static struct omap_hwmod omap44xx_wd_timer3_hwmod = { 5321static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
5020 .name = "wd_timer3", 5322 .name = "wd_timer3",
5021 .class = &omap44xx_wd_timer_hwmod_class, 5323 .class = &omap44xx_wd_timer_hwmod_class,
5324 .clkdm_name = "abe_clkdm",
5022 .mpu_irqs = omap44xx_wd_timer3_irqs, 5325 .mpu_irqs = omap44xx_wd_timer3_irqs,
5023 .main_clk = "wd_timer3_fck", 5326 .main_clk = "wd_timer3_fck",
5024 .prcm = { 5327 .prcm = {
5025 .omap4 = { 5328 .omap4 = {
5026 .clkctrl_reg = OMAP4430_CM1_ABE_WDT3_CLKCTRL, 5329 .clkctrl_offs = OMAP4_CM1_ABE_WDT3_CLKCTRL_OFFSET,
5330 .context_offs = OMAP4_RM_ABE_WDT3_CONTEXT_OFFSET,
5331 .modulemode = MODULEMODE_SWCTRL,
5027 }, 5332 },
5028 }, 5333 },
5029 .slaves = omap44xx_wd_timer3_slaves, 5334 .slaves = omap44xx_wd_timer3_slaves,
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 49486f522dc..472bf22d5e8 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -106,8 +106,9 @@ static void omap2_init_processor_devices(void)
106int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state) 106int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
107{ 107{
108 u32 cur_state; 108 u32 cur_state;
109 int sleep_switch = 0; 109 int sleep_switch = -1;
110 int ret = 0; 110 int ret = 0;
111 int hwsup = 0;
111 112
112 if (pwrdm == NULL || IS_ERR(pwrdm)) 113 if (pwrdm == NULL || IS_ERR(pwrdm))
113 return -EINVAL; 114 return -EINVAL;
@@ -127,8 +128,8 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
127 (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) { 128 (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
128 sleep_switch = LOWPOWERSTATE_SWITCH; 129 sleep_switch = LOWPOWERSTATE_SWITCH;
129 } else { 130 } else {
131 hwsup = clkdm_in_hwsup(pwrdm->pwrdm_clkdms[0]);
130 clkdm_wakeup(pwrdm->pwrdm_clkdms[0]); 132 clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
131 pwrdm_wait_transition(pwrdm);
132 sleep_switch = FORCEWAKEUP_SWITCH; 133 sleep_switch = FORCEWAKEUP_SWITCH;
133 } 134 }
134 } 135 }
@@ -142,7 +143,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
142 143
143 switch (sleep_switch) { 144 switch (sleep_switch) {
144 case FORCEWAKEUP_SWITCH: 145 case FORCEWAKEUP_SWITCH:
145 if (pwrdm->pwrdm_clkdms[0]->flags & CLKDM_CAN_ENABLE_AUTO) 146 if (hwsup)
146 clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); 147 clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
147 else 148 else
148 clkdm_sleep(pwrdm->pwrdm_clkdms[0]); 149 clkdm_sleep(pwrdm->pwrdm_clkdms[0]);
@@ -154,7 +155,6 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
154 return ret; 155 return ret;
155 } 156 }
156 157
157 pwrdm_wait_transition(pwrdm);
158 pwrdm_state_switch(pwrdm); 158 pwrdm_state_switch(pwrdm);
159err: 159err:
160 return ret; 160 return ret;
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 9af08473bf1..ef71fdd40fc 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -195,28 +195,35 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
195 195
196/** 196/**
197 * pwrdm_init - set up the powerdomain layer 197 * pwrdm_init - set up the powerdomain layer
198 * @pwrdm_list: array of struct powerdomain pointers to register 198 * @pwrdms: array of struct powerdomain pointers to register
199 * @custom_funcs: func pointers for arch specific implementations 199 * @custom_funcs: func pointers for arch specific implementations
200 * 200 *
201 * Loop through the array of powerdomains @pwrdm_list, registering all 201 * Loop through the array of powerdomains @pwrdms, registering all
202 * that are available on the current CPU. If pwrdm_list is supplied 202 * that are available on the current CPU. Also, program all
203 * and not null, all of the referenced powerdomains will be 203 * powerdomain target state as ON; this is to prevent domains from
204 * registered. No return value. XXX pwrdm_list is not really a 204 * hitting low power states (if bootloader has target states set to
205 * "list"; it is an array. Rename appropriately. 205 * something other than ON) and potentially even losing context while
206 * PM is not fully initialized. The PM late init code can then program
207 * the desired target state for all the power domains. No return
208 * value.
206 */ 209 */
207void pwrdm_init(struct powerdomain **pwrdm_list, struct pwrdm_ops *custom_funcs) 210void pwrdm_init(struct powerdomain **pwrdms, struct pwrdm_ops *custom_funcs)
208{ 211{
209 struct powerdomain **p = NULL; 212 struct powerdomain **p = NULL;
213 struct powerdomain *temp_p;
210 214
211 if (!custom_funcs) 215 if (!custom_funcs)
212 WARN(1, "powerdomain: No custom pwrdm functions registered\n"); 216 WARN(1, "powerdomain: No custom pwrdm functions registered\n");
213 else 217 else
214 arch_pwrdm = custom_funcs; 218 arch_pwrdm = custom_funcs;
215 219
216 if (pwrdm_list) { 220 if (pwrdms) {
217 for (p = pwrdm_list; *p; p++) 221 for (p = pwrdms; *p; p++)
218 _pwrdm_register(*p); 222 _pwrdm_register(*p);
219 } 223 }
224
225 list_for_each_entry(temp_p, &pwrdm_list, node)
226 pwrdm_set_next_pwrst(temp_p, PWRDM_POWER_ON);
220} 227}
221 228
222/** 229/**
diff --git a/arch/arm/mach-omap2/powerdomains44xx_data.c b/arch/arm/mach-omap2/powerdomains44xx_data.c
index 3a7e678fd5f..247e7949511 100644
--- a/arch/arm/mach-omap2/powerdomains44xx_data.c
+++ b/arch/arm/mach-omap2/powerdomains44xx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 Power domains framework 2 * OMAP4 Power domains framework
3 * 3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc. 4 * Copyright (C) 2009-2011 Texas Instruments, Inc.
5 * Copyright (C) 2009-2011 Nokia Corporation 5 * Copyright (C) 2009-2011 Nokia Corporation
6 * 6 *
7 * Abhijit Pagare (abhijitpagare@ti.com) 7 * Abhijit Pagare (abhijitpagare@ti.com)
@@ -41,14 +41,14 @@ static struct powerdomain core_44xx_pwrdm = {
41 .banks = 5, 41 .banks = 5,
42 .pwrsts_mem_ret = { 42 .pwrsts_mem_ret = {
43 [0] = PWRSTS_OFF, /* core_nret_bank */ 43 [0] = PWRSTS_OFF, /* core_nret_bank */
44 [1] = PWRSTS_OFF_RET, /* core_ocmram */ 44 [1] = PWRSTS_RET, /* core_ocmram */
45 [2] = PWRSTS_RET, /* core_other_bank */ 45 [2] = PWRSTS_RET, /* core_other_bank */
46 [3] = PWRSTS_OFF_RET, /* ducati_l2ram */ 46 [3] = PWRSTS_OFF_RET, /* ducati_l2ram */
47 [4] = PWRSTS_OFF_RET, /* ducati_unicache */ 47 [4] = PWRSTS_OFF_RET, /* ducati_unicache */
48 }, 48 },
49 .pwrsts_mem_on = { 49 .pwrsts_mem_on = {
50 [0] = PWRSTS_ON, /* core_nret_bank */ 50 [0] = PWRSTS_ON, /* core_nret_bank */
51 [1] = PWRSTS_OFF_RET, /* core_ocmram */ 51 [1] = PWRSTS_ON, /* core_ocmram */
52 [2] = PWRSTS_ON, /* core_other_bank */ 52 [2] = PWRSTS_ON, /* core_other_bank */
53 [3] = PWRSTS_ON, /* ducati_l2ram */ 53 [3] = PWRSTS_ON, /* ducati_l2ram */
54 [4] = PWRSTS_ON, /* ducati_unicache */ 54 [4] = PWRSTS_ON, /* ducati_unicache */
@@ -205,7 +205,7 @@ static struct powerdomain mpu_44xx_pwrdm = {
205 .prcm_offs = OMAP4430_PRM_MPU_INST, 205 .prcm_offs = OMAP4430_PRM_MPU_INST,
206 .prcm_partition = OMAP4430_PRM_PARTITION, 206 .prcm_partition = OMAP4430_PRM_PARTITION,
207 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 207 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
208 .pwrsts = PWRSTS_OFF_RET_ON, 208 .pwrsts = PWRSTS_RET_ON,
209 .pwrsts_logic_ret = PWRSTS_OFF_RET, 209 .pwrsts_logic_ret = PWRSTS_OFF_RET,
210 .banks = 3, 210 .banks = 3,
211 .pwrsts_mem_ret = { 211 .pwrsts_mem_ret = {
@@ -318,6 +318,7 @@ static struct powerdomain cefuse_44xx_pwrdm = {
318 .prcm_partition = OMAP4430_PRM_PARTITION, 318 .prcm_partition = OMAP4430_PRM_PARTITION,
319 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 319 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
320 .pwrsts = PWRSTS_OFF_ON, 320 .pwrsts = PWRSTS_OFF_ON,
321 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
321}; 322};
322 323
323/* 324/*
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 6be14389e4f..2e40a5cf016 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -70,7 +70,7 @@ static void omap_prcm_arch_reset(char mode, const char *cmd)
70 prcm_offs = OMAP3430_GR_MOD; 70 prcm_offs = OMAP3430_GR_MOD;
71 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0)); 71 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
72 } else if (cpu_is_omap44xx()) { 72 } else if (cpu_is_omap44xx()) {
73 omap4_prm_global_warm_sw_reset(); /* never returns */ 73 omap4_prminst_global_warm_sw_reset(); /* never returns */
74 } else { 74 } else {
75 WARN_ON(1); 75 WARN_ON(1);
76 } 76 }
diff --git a/arch/arm/mach-omap2/prm-regbits-44xx.h b/arch/arm/mach-omap2/prm-regbits-44xx.h
index 6d2776f6fc0..3cb247bebda 100644
--- a/arch/arm/mach-omap2/prm-regbits-44xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-44xx.h
@@ -283,6 +283,14 @@
283#define OMAP4430_DUCATI_UNICACHE_STATEST_SHIFT 10 283#define OMAP4430_DUCATI_UNICACHE_STATEST_SHIFT 10
284#define OMAP4430_DUCATI_UNICACHE_STATEST_MASK (0x3 << 10) 284#define OMAP4430_DUCATI_UNICACHE_STATEST_MASK (0x3 << 10)
285 285
286/* Used by PRM_DEVICE_OFF_CTRL */
287#define OMAP4460_EMIF1_OFFWKUP_DISABLE_SHIFT 8
288#define OMAP4460_EMIF1_OFFWKUP_DISABLE_MASK (1 << 8)
289
290/* Used by PRM_DEVICE_OFF_CTRL */
291#define OMAP4460_EMIF2_OFFWKUP_DISABLE_SHIFT 9
292#define OMAP4460_EMIF2_OFFWKUP_DISABLE_MASK (1 << 9)
293
286/* Used by RM_MPU_RSTST */ 294/* Used by RM_MPU_RSTST */
287#define OMAP4430_EMULATION_RST_SHIFT 0 295#define OMAP4430_EMULATION_RST_SHIFT 0
288#define OMAP4430_EMULATION_RST_MASK (1 << 0) 296#define OMAP4430_EMULATION_RST_MASK (1 << 0)
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index a2a04bfa962..00165558fc4 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 PRM module functions 2 * OMAP4 PRM module functions
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments, Inc. 4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson 6 * Benoît Cousson
7 * Paul Walmsley 7 * Paul Walmsley
@@ -24,12 +24,6 @@
24#include "prm44xx.h" 24#include "prm44xx.h"
25#include "prm-regbits-44xx.h" 25#include "prm-regbits-44xx.h"
26 26
27/*
28 * Address offset (in bytes) between the reset control and the reset
29 * status registers: 4 bytes on OMAP4
30 */
31#define OMAP4_RST_CTRL_ST_OFFSET 4
32
33/* PRM low-level functions */ 27/* PRM low-level functions */
34 28
35/* Read a register in a CM/PRM instance in the PRM module */ 29/* Read a register in a CM/PRM instance in the PRM module */
@@ -56,140 +50,3 @@ u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
56 50
57 return v; 51 return v;
58} 52}
59
60/* Read a PRM register, AND it, and shift the result down to bit 0 */
61/* XXX deprecated */
62u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
63{
64 u32 v;
65
66 v = __raw_readl(reg);
67 v &= mask;
68 v >>= __ffs(mask);
69
70 return v;
71}
72
73/* Read-modify-write a register in a PRM module. Caller must lock */
74/* XXX deprecated */
75u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
76{
77 u32 v;
78
79 v = __raw_readl(reg);
80 v &= ~mask;
81 v |= bits;
82 __raw_writel(v, reg);
83
84 return v;
85}
86
87u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 reg)
88{
89 return omap4_prm_rmw_inst_reg_bits(bits, bits, inst, reg);
90}
91
92u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 reg)
93{
94 return omap4_prm_rmw_inst_reg_bits(bits, 0x0, inst, reg);
95}
96
97/**
98 * omap4_prm_is_hardreset_asserted - read the HW reset line state of
99 * submodules contained in the hwmod module
100 * @rstctrl_reg: RM_RSTCTRL register address for this module
101 * @shift: register bit shift corresponding to the reset line to check
102 *
103 * Returns 1 if the (sub)module hardreset line is currently asserted,
104 * 0 if the (sub)module hardreset line is not currently asserted, or
105 * -EINVAL upon parameter error.
106 */
107int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg, u8 shift)
108{
109 if (!cpu_is_omap44xx() || !rstctrl_reg)
110 return -EINVAL;
111
112 return omap4_prm_read_bits_shift(rstctrl_reg, (1 << shift));
113}
114
115/**
116 * omap4_prm_assert_hardreset - assert the HW reset line of a submodule
117 * @rstctrl_reg: RM_RSTCTRL register address for this module
118 * @shift: register bit shift corresponding to the reset line to assert
119 *
120 * Some IPs like dsp, ipu or iva contain processors that require an HW
121 * reset line to be asserted / deasserted in order to fully enable the
122 * IP. These modules may have multiple hard-reset lines that reset
123 * different 'submodules' inside the IP block. This function will
124 * place the submodule into reset. Returns 0 upon success or -EINVAL
125 * upon an argument error.
126 */
127int omap4_prm_assert_hardreset(void __iomem *rstctrl_reg, u8 shift)
128{
129 u32 mask;
130
131 if (!cpu_is_omap44xx() || !rstctrl_reg)
132 return -EINVAL;
133
134 mask = 1 << shift;
135 omap4_prm_rmw_reg_bits(mask, mask, rstctrl_reg);
136
137 return 0;
138}
139
140/**
141 * omap4_prm_deassert_hardreset - deassert a submodule hardreset line and wait
142 * @rstctrl_reg: RM_RSTCTRL register address for this module
143 * @shift: register bit shift corresponding to the reset line to deassert
144 *
145 * Some IPs like dsp, ipu or iva contain processors that require an HW
146 * reset line to be asserted / deasserted in order to fully enable the
147 * IP. These modules may have multiple hard-reset lines that reset
148 * different 'submodules' inside the IP block. This function will
149 * take the submodule out of reset and wait until the PRCM indicates
150 * that the reset has completed before returning. Returns 0 upon success or
151 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
152 * of reset, or -EBUSY if the submodule did not exit reset promptly.
153 */
154int omap4_prm_deassert_hardreset(void __iomem *rstctrl_reg, u8 shift)
155{
156 u32 mask;
157 void __iomem *rstst_reg;
158 int c;
159
160 if (!cpu_is_omap44xx() || !rstctrl_reg)
161 return -EINVAL;
162
163 rstst_reg = rstctrl_reg + OMAP4_RST_CTRL_ST_OFFSET;
164
165 mask = 1 << shift;
166
167 /* Check the current status to avoid de-asserting the line twice */
168 if (omap4_prm_read_bits_shift(rstctrl_reg, mask) == 0)
169 return -EEXIST;
170
171 /* Clear the reset status by writing 1 to the status bit */
172 omap4_prm_rmw_reg_bits(0xffffffff, mask, rstst_reg);
173 /* de-assert the reset control line */
174 omap4_prm_rmw_reg_bits(mask, 0, rstctrl_reg);
175 /* wait the status to be set */
176 omap_test_timeout(omap4_prm_read_bits_shift(rstst_reg, mask),
177 MAX_MODULE_HARDRESET_WAIT, c);
178
179 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
180}
181
182void omap4_prm_global_warm_sw_reset(void)
183{
184 u32 v;
185
186 v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
187 OMAP4_RM_RSTCTRL);
188 v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK;
189 omap4_prm_write_inst_reg(v, OMAP4430_PRM_DEVICE_INST,
190 OMAP4_RM_RSTCTRL);
191
192 /* OCP barrier */
193 v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
194 OMAP4_RM_RSTCTRL);
195}
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index 6e53120fd6c..7dfa379b625 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -750,16 +750,6 @@
750extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx); 750extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
751extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx); 751extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
752extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx); 752extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
753extern u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
754extern u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 idx);
755extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx);
756extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
757
758extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg, u8 shift);
759extern int omap4_prm_assert_hardreset(void __iomem *rstctrl_reg, u8 shift);
760extern int omap4_prm_deassert_hardreset(void __iomem *rstctrl_reg, u8 shift);
761
762extern void omap4_prm_global_warm_sw_reset(void);
763 753
764# endif 754# endif
765 755
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index a3032429727..3a7bab16edd 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -2,6 +2,7 @@
2 * OMAP4 PRM instance functions 2 * OMAP4 PRM instance functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * 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
@@ -53,7 +54,7 @@ void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
53 54
54/* Read-modify-write a register in PRM. Caller must lock */ 55/* Read-modify-write a register in PRM. Caller must lock */
55u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst, 56u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst,
56 s16 idx) 57 u16 idx)
57{ 58{
58 u32 v; 59 u32 v;
59 60
@@ -64,3 +65,112 @@ u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst,
64 65
65 return v; 66 return v;
66} 67}
68
69/*
70 * Address offset (in bytes) between the reset control and the reset
71 * status registers: 4 bytes on OMAP4
72 */
73#define OMAP4_RST_CTRL_ST_OFFSET 4
74
75/**
76 * omap4_prminst_is_hardreset_asserted - read the HW reset line state of
77 * submodules contained in the hwmod module
78 * @rstctrl_reg: RM_RSTCTRL register address for this module
79 * @shift: register bit shift corresponding to the reset line to check
80 *
81 * Returns 1 if the (sub)module hardreset line is currently asserted,
82 * 0 if the (sub)module hardreset line is not currently asserted, or
83 * -EINVAL upon parameter error.
84 */
85int omap4_prminst_is_hardreset_asserted(u8 shift, u8 part, s16 inst,
86 u16 rstctrl_offs)
87{
88 u32 v;
89
90 v = omap4_prminst_read_inst_reg(part, inst, rstctrl_offs);
91 v &= 1 << shift;
92 v >>= shift;
93
94 return v;
95}
96
97/**
98 * omap4_prminst_assert_hardreset - assert the HW reset line of a submodule
99 * @rstctrl_reg: RM_RSTCTRL register address for this module
100 * @shift: register bit shift corresponding to the reset line to assert
101 *
102 * Some IPs like dsp, ipu or iva contain processors that require an HW
103 * reset line to be asserted / deasserted in order to fully enable the
104 * IP. These modules may have multiple hard-reset lines that reset
105 * different 'submodules' inside the IP block. This function will
106 * place the submodule into reset. Returns 0 upon success or -EINVAL
107 * upon an argument error.
108 */
109int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
110 u16 rstctrl_offs)
111{
112 u32 mask = 1 << shift;
113
114 omap4_prminst_rmw_inst_reg_bits(mask, mask, part, inst, rstctrl_offs);
115
116 return 0;
117}
118
119/**
120 * omap4_prminst_deassert_hardreset - deassert a submodule hardreset line and
121 * wait
122 * @rstctrl_reg: RM_RSTCTRL register address for this module
123 * @shift: register bit shift corresponding to the reset line to deassert
124 *
125 * Some IPs like dsp, ipu or iva contain processors that require an HW
126 * reset line to be asserted / deasserted in order to fully enable the
127 * IP. These modules may have multiple hard-reset lines that reset
128 * different 'submodules' inside the IP block. This function will
129 * take the submodule out of reset and wait until the PRCM indicates
130 * that the reset has completed before returning. Returns 0 upon success or
131 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
132 * of reset, or -EBUSY if the submodule did not exit reset promptly.
133 */
134int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
135 u16 rstctrl_offs)
136{
137 int c;
138 u32 mask = 1 << shift;
139 u16 rstst_offs = rstctrl_offs + OMAP4_RST_CTRL_ST_OFFSET;
140
141 /* Check the current status to avoid de-asserting the line twice */
142 if (omap4_prminst_is_hardreset_asserted(shift, part, inst,
143 rstctrl_offs) == 0)
144 return -EEXIST;
145
146 /* Clear the reset status by writing 1 to the status bit */
147 omap4_prminst_rmw_inst_reg_bits(0xffffffff, mask, part, inst,
148 rstst_offs);
149 /* de-assert the reset control line */
150 omap4_prminst_rmw_inst_reg_bits(mask, 0, part, inst, rstctrl_offs);
151 /* wait the status to be set */
152 omap_test_timeout(omap4_prminst_is_hardreset_asserted(shift, part, inst,
153 rstst_offs),
154 MAX_MODULE_HARDRESET_WAIT, c);
155
156 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
157}
158
159
160void omap4_prminst_global_warm_sw_reset(void)
161{
162 u32 v;
163
164 v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
165 OMAP4430_PRM_DEVICE_INST,
166 OMAP4_PRM_RSTCTRL_OFFSET);
167 v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK;
168 omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION,
169 OMAP4430_PRM_DEVICE_INST,
170 OMAP4_PRM_RSTCTRL_OFFSET);
171
172 /* OCP barrier */
173 v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
174 OMAP4430_PRM_DEVICE_INST,
175 OMAP4_PRM_RSTCTRL_OFFSET);
176}
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index 02dd66ddda8..46f2efb3659 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -2,6 +2,7 @@
2 * OMAP4 Power/Reset Management (PRM) function prototypes 2 * OMAP4 Power/Reset Management (PRM) function prototypes
3 * 3 *
4 * Copyright (C) 2010 Nokia Corporation 4 * Copyright (C) 2010 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * 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
@@ -18,8 +19,15 @@
18extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx); 19extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx);
19extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx); 20extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx);
20extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, 21extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
21 s16 inst, s16 idx); 22 s16 inst, u16 idx);
22 23
23extern void omap4_prm_global_warm_sw_reset(void); 24extern void omap4_prminst_global_warm_sw_reset(void);
25
26extern int omap4_prminst_is_hardreset_asserted(u8 shift, u8 part, s16 inst,
27 u16 rstctrl_offs);
28extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
29 u16 rstctrl_offs);
30extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
31 u16 rstctrl_offs);
24 32
25#endif 33#endif
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index f56b1bd41f2..f49804f181d 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -621,7 +621,7 @@ void sr_disable(struct voltagedomain *voltdm)
621 sr_v2_disable(sr); 621 sr_v2_disable(sr);
622 } 622 }
623 623
624 pm_runtime_put_sync(&sr->pdev->dev); 624 pm_runtime_put_sync_suspend(&sr->pdev->dev);
625} 625}
626 626
627/** 627/**
@@ -860,6 +860,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
860 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 860 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
861 861
862 pm_runtime_enable(&pdev->dev); 862 pm_runtime_enable(&pdev->dev);
863 pm_runtime_irq_safe(&pdev->dev);
863 864
864 sr_info->pdev = pdev; 865 sr_info->pdev = pdev;
865 sr_info->srid = pdev->id; 866 sr_info->srid = pdev->id;
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index e9640728239..cf1de7d2630 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -293,7 +293,8 @@ static void __init omap2_gp_clocksource_init(int gptimer_id,
293 pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n", 293 pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
294 gptimer_id, clksrc.rate); 294 gptimer_id, clksrc.rate);
295 295
296 __omap_dm_timer_load_start(clksrc.io_base, OMAP_TIMER_CTRL_ST, 0, 1); 296 __omap_dm_timer_load_start(clksrc.io_base,
297 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1);
297 init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate); 298 init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
298 299
299 if (clocksource_register_hz(&clocksource_gpt, clksrc.rate)) 300 if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 3aaa46f6cd1..daa056ed873 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -48,14 +48,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
48 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 48 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
49} 49}
50 50
51static struct twl4030_usb_data omap4_usb_pdata = { 51#if defined(CONFIG_ARCH_OMAP3)
52 .phy_init = omap4430_phy_init,
53 .phy_exit = omap4430_phy_exit,
54 .phy_power = omap4430_phy_power,
55 .phy_set_clock = omap4430_phy_set_clk,
56 .phy_suspend = omap4430_phy_suspend,
57};
58
59static struct twl4030_usb_data omap3_usb_pdata = { 52static struct twl4030_usb_data omap3_usb_pdata = {
60 .usb_mode = T2_USB_MODE_ULPI, 53 .usb_mode = T2_USB_MODE_ULPI,
61}; 54};
@@ -80,11 +73,11 @@ static struct twl4030_madc_platform_data omap3_madc_pdata = {
80 .irq_line = 1, 73 .irq_line = 1,
81}; 74};
82 75
83static struct twl4030_codec_audio_data omap3_audio; 76static struct twl4030_codec_data omap3_codec;
84 77
85static struct twl4030_codec_data omap3_codec_pdata = { 78static struct twl4030_audio_data omap3_audio_pdata = {
86 .audio_mclk = 26000000, 79 .audio_mclk = 26000000,
87 .audio = &omap3_audio, 80 .codec = &omap3_codec,
88}; 81};
89 82
90static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = { 83static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = {
@@ -122,6 +115,45 @@ static struct regulator_init_data omap3_vpll2_idata = {
122 .consumer_supplies = omap3_vpll2_supplies, 115 .consumer_supplies = omap3_vpll2_supplies,
123}; 116};
124 117
118void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
119 u32 pdata_flags, u32 regulators_flags)
120{
121 if (!pmic_data->irq_base)
122 pmic_data->irq_base = TWL4030_IRQ_BASE;
123 if (!pmic_data->irq_end)
124 pmic_data->irq_end = TWL4030_IRQ_END;
125
126 /* Common platform data configurations */
127 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
128 pmic_data->usb = &omap3_usb_pdata;
129
130 if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
131 pmic_data->bci = &omap3_bci_pdata;
132
133 if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
134 pmic_data->madc = &omap3_madc_pdata;
135
136 if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
137 pmic_data->audio = &omap3_audio_pdata;
138
139 /* Common regulator configurations */
140 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
141 pmic_data->vdac = &omap3_vdac_idata;
142
143 if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
144 pmic_data->vpll2 = &omap3_vpll2_idata;
145}
146#endif /* CONFIG_ARCH_OMAP3 */
147
148#if defined(CONFIG_ARCH_OMAP4)
149static struct twl4030_usb_data omap4_usb_pdata = {
150 .phy_init = omap4430_phy_init,
151 .phy_exit = omap4430_phy_exit,
152 .phy_power = omap4430_phy_power,
153 .phy_set_clock = omap4430_phy_set_clk,
154 .phy_suspend = omap4430_phy_suspend,
155};
156
125static struct regulator_init_data omap4_vdac_idata = { 157static struct regulator_init_data omap4_vdac_idata = {
126 .constraints = { 158 .constraints = {
127 .min_uV = 1800000, 159 .min_uV = 1800000,
@@ -273,32 +305,4 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
273 !pmic_data->clk32kg) 305 !pmic_data->clk32kg)
274 pmic_data->clk32kg = &omap4_clk32kg_idata; 306 pmic_data->clk32kg = &omap4_clk32kg_idata;
275} 307}
276 308#endif /* CONFIG_ARCH_OMAP4 */
277void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
278 u32 pdata_flags, u32 regulators_flags)
279{
280 if (!pmic_data->irq_base)
281 pmic_data->irq_base = TWL4030_IRQ_BASE;
282 if (!pmic_data->irq_end)
283 pmic_data->irq_end = TWL4030_IRQ_END;
284
285 /* Common platform data configurations */
286 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
287 pmic_data->usb = &omap3_usb_pdata;
288
289 if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
290 pmic_data->bci = &omap3_bci_pdata;
291
292 if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
293 pmic_data->madc = &omap3_madc_pdata;
294
295 if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->codec)
296 pmic_data->codec = &omap3_codec_pdata;
297
298 /* Common regulator configurations */
299 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
300 pmic_data->vdac = &omap3_vdac_idata;
301
302 if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
303 pmic_data->vpll2 = &omap3_vpll2_idata;
304}
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index f2b2b35e864..3e5499dda49 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -51,7 +51,7 @@ void orion5x_pci_disable(void);
51void orion5x_pci_set_cardbus_mode(void); 51void orion5x_pci_set_cardbus_mode(void);
52int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); 52int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
53struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); 53struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
54int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin); 54int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
55 55
56struct machine_desc; 56struct machine_desc;
57struct meminfo; 57struct meminfo;
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index f95d3cb01cb..a3e3e9e5e32 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -237,7 +237,8 @@ void __init db88f5281_pci_preinit(void)
237 } 237 }
238} 238}
239 239
240static int __init db88f5281_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 240static int __init db88f5281_pci_map_irq(const struct pci_dev *dev, u8 slot,
241 u8 pin)
241{ 242{
242 int irq; 243 int irq;
243 244
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 855e0e77d56..c105556a0ee 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -70,7 +70,7 @@ enum {
70 * PCI setup 70 * PCI setup
71 */ 71 */
72 72
73static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 73static int __init dns323_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
74{ 74{
75 int irq; 75 int irq;
76 76
diff --git a/arch/arm/mach-orion5x/include/mach/hardware.h b/arch/arm/mach-orion5x/include/mach/hardware.h
index e51aaf4bf2b..39573548247 100644
--- a/arch/arm/mach-orion5x/include/mach/hardware.h
+++ b/arch/arm/mach-orion5x/include/mach/hardware.h
@@ -11,11 +11,4 @@
11 11
12#include "orion5x.h" 12#include "orion5x.h"
13 13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x00001000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE ORION5X_PCIE_MEM_PHYS_BASE
19
20
21#endif 14#endif
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index c0eb6462633..00381249d76 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -119,7 +119,8 @@ static struct platform_device kurobox_pro_nor_flash = {
119 * PCI 119 * PCI
120 ****************************************************************************/ 120 ****************************************************************************/
121 121
122static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 122static int __init kurobox_pro_pci_map_irq(const struct pci_dev *dev, u8 slot,
123 u8 pin)
123{ 124{
124 int irq; 125 int irq;
125 126
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c
index 59263b73d1e..ef3bb8e9a4c 100644
--- a/arch/arm/mach-orion5x/mss2-setup.c
+++ b/arch/arm/mach-orion5x/mss2-setup.c
@@ -73,7 +73,7 @@ static struct platform_device mss2_nor_flash = {
73/**************************************************************************** 73/****************************************************************************
74 * PCI setup 74 * PCI setup
75 ****************************************************************************/ 75 ****************************************************************************/
76static int __init mss2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 76static int __init mss2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
77{ 77{
78 int irq; 78 int irq;
79 79
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index e8706f15a67..bc4a920e26e 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -14,6 +14,7 @@
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/mbus.h> 16#include <linux/mbus.h>
17#include <video/vga.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <asm/mach/pci.h> 19#include <asm/mach/pci.h>
19#include <plat/pcie.h> 20#include <plat/pcie.h>
@@ -560,6 +561,8 @@ int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys)
560{ 561{
561 int ret = 0; 562 int ret = 0;
562 563
564 vga_base = ORION5X_PCIE_MEM_PHYS_BASE;
565
563 if (nr == 0) { 566 if (nr == 0) {
564 orion_pcie_set_local_bus_nr(PCIE_BASE, sys->busnr); 567 orion_pcie_set_local_bus_nr(PCIE_BASE, sys->busnr);
565 ret = pcie_setup(sys); 568 ret = pcie_setup(sys);
@@ -587,7 +590,7 @@ struct pci_bus __init *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys
587 return bus; 590 return bus;
588} 591}
589 592
590int __init orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 593int __init orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
591{ 594{
592 int bus = dev->bus->number; 595 int bus = dev->bus->number;
593 596
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index 9eec7c2375e..291d22bf44c 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -131,7 +131,7 @@ static void __init rd88f5181l_fxo_init(void)
131} 131}
132 132
133static int __init 133static int __init
134rd88f5181l_fxo_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 134rd88f5181l_fxo_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
135{ 135{
136 int irq; 136 int irq;
137 137
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index 0cc90bbfd32..3f02362e163 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -140,7 +140,7 @@ static void __init rd88f5181l_ge_init(void)
140} 140}
141 141
142static int __init 142static int __init
143rd88f5181l_ge_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 143rd88f5181l_ge_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
144{ 144{
145 int irq; 145 int irq;
146 146
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 48da39b9bdb..27fd38e658b 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -172,7 +172,8 @@ void __init rd88f5182_pci_preinit(void)
172 } 172 }
173} 173}
174 174
175static int __init rd88f5182_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 175static int __init rd88f5182_pci_map_irq(const struct pci_dev *dev, u8 slot,
176 u8 pin)
176{ 177{
177 int irq; 178 int irq;
178 179
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c
index 29ce826c3c2..a34e4fac72b 100644
--- a/arch/arm/mach-orion5x/terastation_pro2-setup.c
+++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c
@@ -100,7 +100,7 @@ void __init tsp2_pci_preinit(void)
100 } 100 }
101} 101}
102 102
103static int __init tsp2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 103static int __init tsp2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
104{ 104{
105 int irq; 105 int irq;
106 106
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index 47162fd5f04..c9831614e35 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -143,7 +143,8 @@ void __init qnap_ts209_pci_preinit(void)
143 } 143 }
144} 144}
145 145
146static int __init qnap_ts209_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 146static int __init qnap_ts209_pci_map_irq(const struct pci_dev *dev, u8 slot,
147 u8 pin)
147{ 148{
148 int irq; 149 int irq;
149 150
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index 5aacc7ac5cf..cc33b2222ba 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -121,7 +121,8 @@ static struct platform_device qnap_ts409_nor_flash = {
121 * PCI 121 * PCI
122 ****************************************************************************/ 122 ****************************************************************************/
123 123
124static int __init qnap_ts409_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 124static int __init qnap_ts409_pci_map_irq(const struct pci_dev *dev, u8 slot,
125 u8 pin)
125{ 126{
126 int irq; 127 int irq;
127 128
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
index 444a1c7fdfd..2653595f901 100644
--- a/arch/arm/mach-orion5x/wnr854t-setup.c
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -133,7 +133,8 @@ static void __init wnr854t_init(void)
133 platform_device_register(&wnr854t_nor_flash); 133 platform_device_register(&wnr854t_nor_flash);
134} 134}
135 135
136static int __init wnr854t_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 136static int __init wnr854t_pci_map_irq(const struct pci_dev *dev, u8 slot,
137 u8 pin)
137{ 138{
138 int irq; 139 int irq;
139 140
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index d1952be0ae1..251ef1543e5 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -221,7 +221,8 @@ static void __init wrt350n_v2_init(void)
221 platform_device_register(&wrt350n_v2_button_device); 221 platform_device_register(&wrt350n_v2_button_device);
222} 222}
223 223
224static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 224static int __init wrt350n_v2_pci_map_irq(const struct pci_dev *dev, u8 slot,
225 u8 pin)
225{ 226{
226 int irq; 227 int irq;
227 228
diff --git a/arch/arm/mach-pnx4008/include/mach/clkdev.h b/arch/arm/mach-pnx4008/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/mach-pnx4008/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-prima2/Makefile b/arch/arm/mach-prima2/Makefile
new file mode 100644
index 00000000000..7af7fc05d56
--- /dev/null
+++ b/arch/arm/mach-prima2/Makefile
@@ -0,0 +1,7 @@
1obj-y := timer.o
2obj-y += irq.o
3obj-y += clock.o
4obj-y += rstc.o
5obj-y += prima2.o
6obj-$(CONFIG_DEBUG_LL) += lluart.o
7obj-$(CONFIG_CACHE_L2X0) += l2x0.o
diff --git a/arch/arm/mach-prima2/Makefile.boot b/arch/arm/mach-prima2/Makefile.boot
new file mode 100644
index 00000000000..d023db3ae4f
--- /dev/null
+++ b/arch/arm/mach-prima2/Makefile.boot
@@ -0,0 +1,3 @@
1zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-prima2/clock.c b/arch/arm/mach-prima2/clock.c
new file mode 100644
index 00000000000..615a4e75cea
--- /dev/null
+++ b/arch/arm/mach-prima2/clock.c
@@ -0,0 +1,510 @@
1/*
2 * Clock tree for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/module.h>
10#include <linux/bitops.h>
11#include <linux/err.h>
12#include <linux/errno.h>
13#include <linux/io.h>
14#include <linux/clkdev.h>
15#include <linux/clk.h>
16#include <linux/spinlock.h>
17#include <linux/of.h>
18#include <linux/of_address.h>
19#include <asm/mach/map.h>
20#include <mach/map.h>
21
22#define SIRFSOC_CLKC_CLK_EN0 0x0000
23#define SIRFSOC_CLKC_CLK_EN1 0x0004
24#define SIRFSOC_CLKC_REF_CFG 0x0014
25#define SIRFSOC_CLKC_CPU_CFG 0x0018
26#define SIRFSOC_CLKC_MEM_CFG 0x001c
27#define SIRFSOC_CLKC_SYS_CFG 0x0020
28#define SIRFSOC_CLKC_IO_CFG 0x0024
29#define SIRFSOC_CLKC_DSP_CFG 0x0028
30#define SIRFSOC_CLKC_GFX_CFG 0x002c
31#define SIRFSOC_CLKC_MM_CFG 0x0030
32#define SIRFSOC_LKC_LCD_CFG 0x0034
33#define SIRFSOC_CLKC_MMC_CFG 0x0038
34#define SIRFSOC_CLKC_PLL1_CFG0 0x0040
35#define SIRFSOC_CLKC_PLL2_CFG0 0x0044
36#define SIRFSOC_CLKC_PLL3_CFG0 0x0048
37#define SIRFSOC_CLKC_PLL1_CFG1 0x004c
38#define SIRFSOC_CLKC_PLL2_CFG1 0x0050
39#define SIRFSOC_CLKC_PLL3_CFG1 0x0054
40#define SIRFSOC_CLKC_PLL1_CFG2 0x0058
41#define SIRFSOC_CLKC_PLL2_CFG2 0x005c
42#define SIRFSOC_CLKC_PLL3_CFG2 0x0060
43
44#define SIRFSOC_CLOCK_VA_BASE SIRFSOC_VA(0x005000)
45
46#define KHZ 1000
47#define MHZ (KHZ * KHZ)
48
49struct clk_ops {
50 unsigned long (*get_rate)(struct clk *clk);
51 long (*round_rate)(struct clk *clk, unsigned long rate);
52 int (*set_rate)(struct clk *clk, unsigned long rate);
53 int (*enable)(struct clk *clk);
54 int (*disable)(struct clk *clk);
55 struct clk *(*get_parent)(struct clk *clk);
56 int (*set_parent)(struct clk *clk, struct clk *parent);
57};
58
59struct clk {
60 struct clk *parent; /* parent clk */
61 unsigned long rate; /* clock rate in Hz */
62 signed char usage; /* clock enable count */
63 signed char enable_bit; /* enable bit: 0 ~ 63 */
64 unsigned short regofs; /* register offset */
65 struct clk_ops *ops; /* clock operation */
66};
67
68static DEFINE_SPINLOCK(clocks_lock);
69
70static inline unsigned long clkc_readl(unsigned reg)
71{
72 return readl(SIRFSOC_CLOCK_VA_BASE + reg);
73}
74
75static inline void clkc_writel(u32 val, unsigned reg)
76{
77 writel(val, SIRFSOC_CLOCK_VA_BASE + reg);
78}
79
80/*
81 * osc_rtc - real time oscillator - 32.768KHz
82 * osc_sys - high speed oscillator - 26MHz
83 */
84
85static struct clk clk_rtc = {
86 .rate = 32768,
87};
88
89static struct clk clk_osc = {
90 .rate = 26 * MHZ,
91};
92
93/*
94 * std pll
95 */
96static unsigned long std_pll_get_rate(struct clk *clk)
97{
98 unsigned long fin = clk_get_rate(clk->parent);
99 u32 regcfg2 = clk->regofs + SIRFSOC_CLKC_PLL1_CFG2 -
100 SIRFSOC_CLKC_PLL1_CFG0;
101
102 if (clkc_readl(regcfg2) & BIT(2)) {
103 /* pll bypass mode */
104 clk->rate = fin;
105 } else {
106 /* fout = fin * nf / nr / od */
107 u32 cfg0 = clkc_readl(clk->regofs);
108 u32 nf = (cfg0 & (BIT(13) - 1)) + 1;
109 u32 nr = ((cfg0 >> 13) & (BIT(6) - 1)) + 1;
110 u32 od = ((cfg0 >> 19) & (BIT(4) - 1)) + 1;
111 WARN_ON(fin % MHZ);
112 clk->rate = fin / MHZ * nf / nr / od * MHZ;
113 }
114
115 return clk->rate;
116}
117
118static int std_pll_set_rate(struct clk *clk, unsigned long rate)
119{
120 unsigned long fin, nf, nr, od, reg;
121
122 /*
123 * fout = fin * nf / (nr * od);
124 * set od = 1, nr = fin/MHz, so fout = nf * MHz
125 */
126
127 nf = rate / MHZ;
128 if (unlikely((rate % MHZ) || nf > BIT(13) || nf < 1))
129 return -EINVAL;
130
131 fin = clk_get_rate(clk->parent);
132 BUG_ON(fin < MHZ);
133
134 nr = fin / MHZ;
135 BUG_ON((fin % MHZ) || nr > BIT(6));
136
137 od = 1;
138
139 reg = (nf - 1) | ((nr - 1) << 13) | ((od - 1) << 19);
140 clkc_writel(reg, clk->regofs);
141
142 reg = clk->regofs + SIRFSOC_CLKC_PLL1_CFG1 - SIRFSOC_CLKC_PLL1_CFG0;
143 clkc_writel((nf >> 1) - 1, reg);
144
145 reg = clk->regofs + SIRFSOC_CLKC_PLL1_CFG2 - SIRFSOC_CLKC_PLL1_CFG0;
146 while (!(clkc_readl(reg) & BIT(6)))
147 cpu_relax();
148
149 clk->rate = 0; /* set to zero will force recalculation */
150 return 0;
151}
152
153static struct clk_ops std_pll_ops = {
154 .get_rate = std_pll_get_rate,
155 .set_rate = std_pll_set_rate,
156};
157
158static struct clk clk_pll1 = {
159 .parent = &clk_osc,
160 .regofs = SIRFSOC_CLKC_PLL1_CFG0,
161 .ops = &std_pll_ops,
162};
163
164static struct clk clk_pll2 = {
165 .parent = &clk_osc,
166 .regofs = SIRFSOC_CLKC_PLL2_CFG0,
167 .ops = &std_pll_ops,
168};
169
170static struct clk clk_pll3 = {
171 .parent = &clk_osc,
172 .regofs = SIRFSOC_CLKC_PLL3_CFG0,
173 .ops = &std_pll_ops,
174};
175
176/*
177 * clock domains - cpu, mem, sys/io
178 */
179
180static struct clk clk_mem;
181
182static struct clk *dmn_get_parent(struct clk *clk)
183{
184 struct clk *clks[] = {
185 &clk_osc, &clk_rtc, &clk_pll1, &clk_pll2, &clk_pll3
186 };
187 u32 cfg = clkc_readl(clk->regofs);
188 WARN_ON((cfg & (BIT(3) - 1)) > 4);
189 return clks[cfg & (BIT(3) - 1)];
190}
191
192static int dmn_set_parent(struct clk *clk, struct clk *parent)
193{
194 const struct clk *clks[] = {
195 &clk_osc, &clk_rtc, &clk_pll1, &clk_pll2, &clk_pll3
196 };
197 u32 cfg = clkc_readl(clk->regofs);
198 int i;
199 for (i = 0; i < ARRAY_SIZE(clks); i++) {
200 if (clks[i] == parent) {
201 cfg &= ~(BIT(3) - 1);
202 clkc_writel(cfg | i, clk->regofs);
203 /* BIT(3) - switching status: 1 - busy, 0 - done */
204 while (clkc_readl(clk->regofs) & BIT(3))
205 cpu_relax();
206 return 0;
207 }
208 }
209 return -EINVAL;
210}
211
212static unsigned long dmn_get_rate(struct clk *clk)
213{
214 unsigned long fin = clk_get_rate(clk->parent);
215 u32 cfg = clkc_readl(clk->regofs);
216 if (cfg & BIT(24)) {
217 /* fcd bypass mode */
218 clk->rate = fin;
219 } else {
220 /*
221 * wait count: bit[19:16], hold count: bit[23:20]
222 */
223 u32 wait = (cfg >> 16) & (BIT(4) - 1);
224 u32 hold = (cfg >> 20) & (BIT(4) - 1);
225
226 clk->rate = fin / (wait + hold + 2);
227 }
228
229 return clk->rate;
230}
231
232static int dmn_set_rate(struct clk *clk, unsigned long rate)
233{
234 unsigned long fin;
235 unsigned ratio, wait, hold, reg;
236 unsigned bits = (clk == &clk_mem) ? 3 : 4;
237
238 fin = clk_get_rate(clk->parent);
239 ratio = fin / rate;
240
241 if (unlikely(ratio < 2 || ratio > BIT(bits + 1)))
242 return -EINVAL;
243
244 WARN_ON(fin % rate);
245
246 wait = (ratio >> 1) - 1;
247 hold = ratio - wait - 2;
248
249 reg = clkc_readl(clk->regofs);
250 reg &= ~(((BIT(bits) - 1) << 16) | ((BIT(bits) - 1) << 20));
251 reg |= (wait << 16) | (hold << 20) | BIT(25);
252 clkc_writel(reg, clk->regofs);
253
254 /* waiting FCD been effective */
255 while (clkc_readl(clk->regofs) & BIT(25))
256 cpu_relax();
257
258 clk->rate = 0; /* set to zero will force recalculation */
259
260 return 0;
261}
262
263/*
264 * cpu clock has no FCD register in Prima2, can only change pll
265 */
266static int cpu_set_rate(struct clk *clk, unsigned long rate)
267{
268 int ret1, ret2;
269 struct clk *cur_parent, *tmp_parent;
270
271 cur_parent = dmn_get_parent(clk);
272 BUG_ON(cur_parent == NULL || cur_parent->usage > 1);
273
274 /* switch to tmp pll before setting parent clock's rate */
275 tmp_parent = cur_parent == &clk_pll1 ? &clk_pll2 : &clk_pll1;
276 ret1 = dmn_set_parent(clk, tmp_parent);
277 BUG_ON(ret1);
278
279 ret2 = clk_set_rate(cur_parent, rate);
280
281 ret1 = dmn_set_parent(clk, cur_parent);
282
283 clk->rate = 0; /* set to zero will force recalculation */
284
285 return ret2 ? ret2 : ret1;
286}
287
288static struct clk_ops cpu_ops = {
289 .get_parent = dmn_get_parent,
290 .set_parent = dmn_set_parent,
291 .set_rate = cpu_set_rate,
292};
293
294static struct clk clk_cpu = {
295 .parent = &clk_pll1,
296 .regofs = SIRFSOC_CLKC_CPU_CFG,
297 .ops = &cpu_ops,
298};
299
300
301static struct clk_ops msi_ops = {
302 .set_rate = dmn_set_rate,
303 .get_rate = dmn_get_rate,
304 .set_parent = dmn_set_parent,
305 .get_parent = dmn_get_parent,
306};
307
308static struct clk clk_mem = {
309 .parent = &clk_pll2,
310 .regofs = SIRFSOC_CLKC_MEM_CFG,
311 .ops = &msi_ops,
312};
313
314static struct clk clk_sys = {
315 .parent = &clk_pll3,
316 .regofs = SIRFSOC_CLKC_SYS_CFG,
317 .ops = &msi_ops,
318};
319
320static struct clk clk_io = {
321 .parent = &clk_pll3,
322 .regofs = SIRFSOC_CLKC_IO_CFG,
323 .ops = &msi_ops,
324};
325
326/*
327 * on-chip clock sets
328 */
329static struct clk_lookup onchip_clks[] = {
330 {
331 .dev_id = "rtc",
332 .clk = &clk_rtc,
333 }, {
334 .dev_id = "osc",
335 .clk = &clk_osc,
336 }, {
337 .dev_id = "pll1",
338 .clk = &clk_pll1,
339 }, {
340 .dev_id = "pll2",
341 .clk = &clk_pll2,
342 }, {
343 .dev_id = "pll3",
344 .clk = &clk_pll3,
345 }, {
346 .dev_id = "cpu",
347 .clk = &clk_cpu,
348 }, {
349 .dev_id = "mem",
350 .clk = &clk_mem,
351 }, {
352 .dev_id = "sys",
353 .clk = &clk_sys,
354 }, {
355 .dev_id = "io",
356 .clk = &clk_io,
357 },
358};
359
360int clk_enable(struct clk *clk)
361{
362 unsigned long flags;
363
364 if (unlikely(IS_ERR_OR_NULL(clk)))
365 return -EINVAL;
366
367 if (clk->parent)
368 clk_enable(clk->parent);
369
370 spin_lock_irqsave(&clocks_lock, flags);
371 if (!clk->usage++ && clk->ops && clk->ops->enable)
372 clk->ops->enable(clk);
373 spin_unlock_irqrestore(&clocks_lock, flags);
374 return 0;
375}
376EXPORT_SYMBOL(clk_enable);
377
378void clk_disable(struct clk *clk)
379{
380 unsigned long flags;
381
382 if (unlikely(IS_ERR_OR_NULL(clk)))
383 return;
384
385 WARN_ON(!clk->usage);
386
387 spin_lock_irqsave(&clocks_lock, flags);
388 if (--clk->usage == 0 && clk->ops && clk->ops->disable)
389 clk->ops->disable(clk);
390 spin_unlock_irqrestore(&clocks_lock, flags);
391
392 if (clk->parent)
393 clk_disable(clk->parent);
394}
395EXPORT_SYMBOL(clk_disable);
396
397unsigned long clk_get_rate(struct clk *clk)
398{
399 if (unlikely(IS_ERR_OR_NULL(clk)))
400 return 0;
401
402 if (clk->rate)
403 return clk->rate;
404
405 if (clk->ops && clk->ops->get_rate)
406 return clk->ops->get_rate(clk);
407
408 return clk_get_rate(clk->parent);
409}
410EXPORT_SYMBOL(clk_get_rate);
411
412long clk_round_rate(struct clk *clk, unsigned long rate)
413{
414 if (unlikely(IS_ERR_OR_NULL(clk)))
415 return 0;
416
417 if (clk->ops && clk->ops->round_rate)
418 return clk->ops->round_rate(clk, rate);
419
420 return 0;
421}
422EXPORT_SYMBOL(clk_round_rate);
423
424int clk_set_rate(struct clk *clk, unsigned long rate)
425{
426 if (unlikely(IS_ERR_OR_NULL(clk)))
427 return -EINVAL;
428
429 if (!clk->ops || !clk->ops->set_rate)
430 return -EINVAL;
431
432 return clk->ops->set_rate(clk, rate);
433}
434EXPORT_SYMBOL(clk_set_rate);
435
436int clk_set_parent(struct clk *clk, struct clk *parent)
437{
438 int ret;
439 unsigned long flags;
440
441 if (unlikely(IS_ERR_OR_NULL(clk)))
442 return -EINVAL;
443
444 if (!clk->ops || !clk->ops->set_parent)
445 return -EINVAL;
446
447 spin_lock_irqsave(&clocks_lock, flags);
448 ret = clk->ops->set_parent(clk, parent);
449 if (!ret) {
450 parent->usage += clk->usage;
451 clk->parent->usage -= clk->usage;
452 BUG_ON(clk->parent->usage < 0);
453 clk->parent = parent;
454 }
455 spin_unlock_irqrestore(&clocks_lock, flags);
456 return ret;
457}
458EXPORT_SYMBOL(clk_set_parent);
459
460struct clk *clk_get_parent(struct clk *clk)
461{
462 unsigned long flags;
463
464 if (unlikely(IS_ERR_OR_NULL(clk)))
465 return NULL;
466
467 if (!clk->ops || !clk->ops->get_parent)
468 return clk->parent;
469
470 spin_lock_irqsave(&clocks_lock, flags);
471 clk->parent = clk->ops->get_parent(clk);
472 spin_unlock_irqrestore(&clocks_lock, flags);
473 return clk->parent;
474}
475EXPORT_SYMBOL(clk_get_parent);
476
477static void __init sirfsoc_clk_init(void)
478{
479 clkdev_add_table(onchip_clks, ARRAY_SIZE(onchip_clks));
480}
481
482static struct of_device_id clkc_ids[] = {
483 { .compatible = "sirf,prima2-clkc" },
484 {},
485};
486
487void __init sirfsoc_of_clk_init(void)
488{
489 struct device_node *np;
490 struct resource res;
491 struct map_desc sirfsoc_clkc_iodesc = {
492 .virtual = SIRFSOC_CLOCK_VA_BASE,
493 .type = MT_DEVICE,
494 };
495
496 np = of_find_matching_node(NULL, clkc_ids);
497 if (!np)
498 panic("unable to find compatible clkc node in dtb\n");
499
500 if (of_address_to_resource(np, 0, &res))
501 panic("unable to find clkc range in dtb");
502 of_node_put(np);
503
504 sirfsoc_clkc_iodesc.pfn = __phys_to_pfn(res.start);
505 sirfsoc_clkc_iodesc.length = 1 + res.end - res.start;
506
507 iotable_init(&sirfsoc_clkc_iodesc, 1);
508
509 sirfsoc_clk_init();
510}
diff --git a/arch/arm/mach-prima2/common.h b/arch/arm/mach-prima2/common.h
new file mode 100644
index 00000000000..83e5d212811
--- /dev/null
+++ b/arch/arm/mach-prima2/common.h
@@ -0,0 +1,26 @@
1/*
2 * This file contains common function prototypes to avoid externs in the c files.
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_PRIMA2_COMMON_H__
10#define __MACH_PRIMA2_COMMON_H__
11
12#include <linux/init.h>
13#include <asm/mach/time.h>
14
15extern struct sys_timer sirfsoc_timer;
16
17extern void __init sirfsoc_of_irq_init(void);
18extern void __init sirfsoc_of_clk_init(void);
19
20#ifndef CONFIG_DEBUG_LL
21static inline void sirfsoc_map_lluart(void) {}
22#else
23extern void __init sirfsoc_map_lluart(void);
24#endif
25
26#endif
diff --git a/arch/arm/mach-prima2/include/mach/clkdev.h b/arch/arm/mach-prima2/include/mach/clkdev.h
new file mode 100644
index 00000000000..66932518b1b
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/clkdev.h
@@ -0,0 +1,15 @@
1/*
2 * arch/arm/mach-prima2/include/mach/clkdev.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_CLKDEV_H
10#define __MACH_CLKDEV_H
11
12#define __clk_get(clk) ({ 1; })
13#define __clk_put(clk) do { } while (0)
14
15#endif
diff --git a/arch/arm/mach-prima2/include/mach/debug-macro.S b/arch/arm/mach-prima2/include/mach/debug-macro.S
new file mode 100644
index 00000000000..bf75106333f
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/debug-macro.S
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/mach-prima2/include/mach/debug-macro.S
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <mach/hardware.h>
10#include <mach/uart.h>
11
12 .macro addruart, rp, rv
13 ldr \rp, =SIRFSOC_UART1_PA_BASE @ physical
14 ldr \rv, =SIRFSOC_UART1_VA_BASE @ virtual
15 .endm
16
17 .macro senduart,rd,rx
18 str \rd, [\rx, #SIRFSOC_UART_TXFIFO_DATA]
19 .endm
20
21 .macro busyuart,rd,rx
22 .endm
23
24 .macro waituart,rd,rx
251001: ldr \rd, [\rx, #SIRFSOC_UART_TXFIFO_STATUS]
26 tst \rd, #SIRFSOC_UART1_TXFIFO_EMPTY
27 beq 1001b
28 .endm
29
diff --git a/arch/arm/mach-prima2/include/mach/entry-macro.S b/arch/arm/mach-prima2/include/mach/entry-macro.S
new file mode 100644
index 00000000000..1c8a50f102a
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/entry-macro.S
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/mach-prima2/include/mach/entry-macro.S
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <mach/hardware.h>
10
11#define SIRFSOC_INT_ID 0x38
12
13 .macro get_irqnr_preamble, base, tmp
14 ldr \base, =sirfsoc_intc_base
15 ldr \base, [\base]
16 .endm
17
18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
19 ldr \irqnr, [\base, #SIRFSOC_INT_ID] @ Get the highest priority irq
20 cmp \irqnr, #0x40 @ the irq num can't be larger than 0x3f
21 movges \irqnr, #0
22 .endm
23
24 .macro disable_fiq
25 .endm
26
27 .macro arch_ret_to_user, tmp1, tmp2
28 .endm
29
diff --git a/arch/arm/mach-prima2/include/mach/hardware.h b/arch/arm/mach-prima2/include/mach/hardware.h
new file mode 100644
index 00000000000..105b96964f2
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/hardware.h
@@ -0,0 +1,15 @@
1/*
2 * arch/arm/mach-prima2/include/mach/hardware.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_HARDWARE_H__
10#define __MACH_HARDWARE_H__
11
12#include <asm/sizes.h>
13#include <mach/map.h>
14
15#endif
diff --git a/arch/arm/mach-prima2/include/mach/io.h b/arch/arm/mach-prima2/include/mach/io.h
new file mode 100644
index 00000000000..6c31e9ec279
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/io.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/mach-prima2/include/mach/io.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_PRIMA2_IO_H
10#define __MACH_PRIMA2_IO_H
11
12#define IO_SPACE_LIMIT ((resource_size_t)0)
13
14#define __mem_pci(a) (a)
15
16#endif
diff --git a/arch/arm/mach-prima2/include/mach/irqs.h b/arch/arm/mach-prima2/include/mach/irqs.h
new file mode 100644
index 00000000000..bb354f952fd
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/irqs.h
@@ -0,0 +1,17 @@
1/*
2 * arch/arm/mach-prima2/include/mach/irqs.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __ASM_ARCH_IRQS_H
10#define __ASM_ARCH_IRQS_H
11
12#define SIRFSOC_INTENAL_IRQ_START 0
13#define SIRFSOC_INTENAL_IRQ_END 59
14
15#define NR_IRQS 220
16
17#endif
diff --git a/arch/arm/mach-prima2/include/mach/map.h b/arch/arm/mach-prima2/include/mach/map.h
new file mode 100644
index 00000000000..66b1ae2e553
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/map.h
@@ -0,0 +1,16 @@
1/*
2 * memory & I/O static mapping definitions for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_PRIMA2_MAP_H__
10#define __MACH_PRIMA2_MAP_H__
11
12#include <mach/vmalloc.h>
13
14#define SIRFSOC_VA(x) (VMALLOC_END + ((x) & 0x00FFF000))
15
16#endif
diff --git a/arch/arm/mach-prima2/include/mach/memory.h b/arch/arm/mach-prima2/include/mach/memory.h
new file mode 100644
index 00000000000..368cd5a0601
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/memory.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-prima2/include/mach/memory.h
3 *
4 * Copyright (c) 2010 – 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __ASM_ARCH_MEMORY_H
10#define __ASM_ARCH_MEMORY_H
11
12#define PLAT_PHYS_OFFSET UL(0x00000000)
13
14/*
15 * Restrict DMA-able region to workaround silicon limitation.
16 * The limitation restricts buffers available for DMA to SD/MMC
17 * hardware to be below 256MB
18 */
19#define ARM_DMA_ZONE_SIZE (SZ_256M)
20
21#endif
diff --git a/arch/arm/mach-prima2/include/mach/system.h b/arch/arm/mach-prima2/include/mach/system.h
new file mode 100644
index 00000000000..0dbd257ad16
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/system.h
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/mach-prima2/include/mach/system.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_SYSTEM_H__
10#define __MACH_SYSTEM_H__
11
12#include <linux/bitops.h>
13#include <mach/hardware.h>
14
15#define SIRFSOC_SYS_RST_BIT BIT(31)
16
17extern void __iomem *sirfsoc_rstc_base;
18
19static inline void arch_idle(void)
20{
21 cpu_do_idle();
22}
23
24static inline void arch_reset(char mode, const char *cmd)
25{
26 writel(SIRFSOC_SYS_RST_BIT, sirfsoc_rstc_base);
27}
28
29#endif
diff --git a/arch/arm/mach-prima2/include/mach/timex.h b/arch/arm/mach-prima2/include/mach/timex.h
new file mode 100644
index 00000000000..d6f98a75e56
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/timex.h
@@ -0,0 +1,14 @@
1/*
2 * arch/arm/mach-prima2/include/mach/timex.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_TIMEX_H__
10#define __MACH_TIMEX_H__
11
12#define CLOCK_TICK_RATE 1000000
13
14#endif
diff --git a/arch/arm/mach-prima2/include/mach/uart.h b/arch/arm/mach-prima2/include/mach/uart.h
new file mode 100644
index 00000000000..c98b4d5ac24
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/uart.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-prima2/include/mach/uart.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_PRIMA2_SIRFSOC_UART_H
10#define __MACH_PRIMA2_SIRFSOC_UART_H
11
12/* UART-1: used as serial debug port */
13#define SIRFSOC_UART1_PA_BASE 0xb0060000
14#define SIRFSOC_UART1_VA_BASE SIRFSOC_VA(0x060000)
15#define SIRFSOC_UART1_SIZE SZ_4K
16
17#define SIRFSOC_UART_TXFIFO_STATUS 0x0114
18#define SIRFSOC_UART_TXFIFO_DATA 0x0118
19
20#define SIRFSOC_UART1_TXFIFO_FULL (1 << 5)
21#define SIRFSOC_UART1_TXFIFO_EMPTY (1 << 6)
22
23#endif
diff --git a/arch/arm/mach-prima2/include/mach/uncompress.h b/arch/arm/mach-prima2/include/mach/uncompress.h
new file mode 100644
index 00000000000..83125c6a30b
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/uncompress.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-prima2/include/mach/uncompress.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __ASM_ARCH_UNCOMPRESS_H
10#define __ASM_ARCH_UNCOMPRESS_H
11
12#include <linux/io.h>
13#include <mach/hardware.h>
14#include <mach/uart.h>
15
16void arch_decomp_setup(void)
17{
18}
19
20#define arch_decomp_wdog()
21
22static __inline__ void putc(char c)
23{
24 /*
25 * during kernel decompression, all mappings are flat:
26 * virt_addr == phys_addr
27 */
28 while (__raw_readl(SIRFSOC_UART1_PA_BASE + SIRFSOC_UART_TXFIFO_STATUS)
29 & SIRFSOC_UART1_TXFIFO_FULL)
30 barrier();
31
32 __raw_writel(c, SIRFSOC_UART1_PA_BASE + SIRFSOC_UART_TXFIFO_DATA);
33}
34
35static inline void flush(void)
36{
37}
38
39#endif
40
diff --git a/arch/arm/mach-prima2/include/mach/vmalloc.h b/arch/arm/mach-prima2/include/mach/vmalloc.h
new file mode 100644
index 00000000000..c9f90fec78e
--- /dev/null
+++ b/arch/arm/mach-prima2/include/mach/vmalloc.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/ach-prima2/include/mach/vmalloc.h
3 *
4 * Copyright (c) 2010 – 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_VMALLOC_H
10#define __MACH_VMALLOC_H
11
12#include <linux/const.h>
13
14#define VMALLOC_END _AC(0xFEC00000, UL)
15
16#endif
diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/mach-prima2/irq.c
new file mode 100644
index 00000000000..7af254d046b
--- /dev/null
+++ b/arch/arm/mach-prima2/irq.c
@@ -0,0 +1,72 @@
1/*
2 * interrupt controller support for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/init.h>
10#include <linux/io.h>
11#include <linux/irq.h>
12#include <mach/hardware.h>
13#include <asm/mach/irq.h>
14#include <linux/of.h>
15#include <linux/of_address.h>
16
17#define SIRFSOC_INT_RISC_MASK0 0x0018
18#define SIRFSOC_INT_RISC_MASK1 0x001C
19#define SIRFSOC_INT_RISC_LEVEL0 0x0020
20#define SIRFSOC_INT_RISC_LEVEL1 0x0024
21
22void __iomem *sirfsoc_intc_base;
23
24static __init void
25sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
26{
27 struct irq_chip_generic *gc;
28 struct irq_chip_type *ct;
29
30 gc = irq_alloc_generic_chip("SIRFINTC", 1, irq_start, base, handle_level_irq);
31 ct = gc->chip_types;
32
33 ct->chip.irq_mask = irq_gc_mask_clr_bit;
34 ct->chip.irq_unmask = irq_gc_mask_set_bit;
35 ct->regs.mask = SIRFSOC_INT_RISC_MASK0;
36
37 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, 0);
38}
39
40static __init void sirfsoc_irq_init(void)
41{
42 sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32);
43 sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32, SIRFSOC_INTENAL_IRQ_END - 32);
44
45 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0);
46 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1);
47
48 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_MASK0);
49 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_MASK1);
50}
51
52static struct of_device_id intc_ids[] = {
53 { .compatible = "sirf,prima2-intc" },
54 {},
55};
56
57void __init sirfsoc_of_irq_init(void)
58{
59 struct device_node *np;
60
61 np = of_find_matching_node(NULL, intc_ids);
62 if (!np)
63 panic("unable to find compatible intc node in dtb\n");
64
65 sirfsoc_intc_base = of_iomap(np, 0);
66 if (!sirfsoc_intc_base)
67 panic("unable to map intc cpu registers\n");
68
69 of_node_put(np);
70
71 sirfsoc_irq_init();
72}
diff --git a/arch/arm/mach-prima2/l2x0.c b/arch/arm/mach-prima2/l2x0.c
new file mode 100644
index 00000000000..9cda2057bcf
--- /dev/null
+++ b/arch/arm/mach-prima2/l2x0.c
@@ -0,0 +1,59 @@
1/*
2 * l2 cache initialization for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/io.h>
12#include <linux/errno.h>
13#include <linux/of.h>
14#include <linux/of_address.h>
15#include <asm/hardware/cache-l2x0.h>
16#include <mach/memory.h>
17
18#define L2X0_ADDR_FILTERING_START 0xC00
19#define L2X0_ADDR_FILTERING_END 0xC04
20
21static struct of_device_id l2x_ids[] = {
22 { .compatible = "arm,pl310-cache" },
23};
24
25static int __init sirfsoc_of_l2x_init(void)
26{
27 struct device_node *np;
28 void __iomem *sirfsoc_l2x_base;
29
30 np = of_find_matching_node(NULL, l2x_ids);
31 if (!np)
32 panic("unable to find compatible l2x node in dtb\n");
33
34 sirfsoc_l2x_base = of_iomap(np, 0);
35 if (!sirfsoc_l2x_base)
36 panic("unable to map l2x cpu registers\n");
37
38 of_node_put(np);
39
40 if (!(readl_relaxed(sirfsoc_l2x_base + L2X0_CTRL) & 1)) {
41 /*
42 * set the physical memory windows L2 cache will cover
43 */
44 writel_relaxed(PLAT_PHYS_OFFSET + 1024 * 1024 * 1024,
45 sirfsoc_l2x_base + L2X0_ADDR_FILTERING_END);
46 writel_relaxed(PLAT_PHYS_OFFSET | 0x1,
47 sirfsoc_l2x_base + L2X0_ADDR_FILTERING_START);
48
49 writel_relaxed(0,
50 sirfsoc_l2x_base + L2X0_TAG_LATENCY_CTRL);
51 writel_relaxed(0,
52 sirfsoc_l2x_base + L2X0_DATA_LATENCY_CTRL);
53 }
54 l2x0_init((void __iomem *)sirfsoc_l2x_base, 0x00040000,
55 0x00000000);
56
57 return 0;
58}
59early_initcall(sirfsoc_of_l2x_init);
diff --git a/arch/arm/mach-prima2/lluart.c b/arch/arm/mach-prima2/lluart.c
new file mode 100644
index 00000000000..a89f9b3c8cc
--- /dev/null
+++ b/arch/arm/mach-prima2/lluart.c
@@ -0,0 +1,25 @@
1/*
2 * Static memory mapping for DEBUG_LL
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/kernel.h>
10#include <asm/page.h>
11#include <asm/mach/map.h>
12#include <mach/map.h>
13#include <mach/uart.h>
14
15void __init sirfsoc_map_lluart(void)
16{
17 struct map_desc sirfsoc_lluart_map = {
18 .virtual = SIRFSOC_UART1_VA_BASE,
19 .pfn = __phys_to_pfn(SIRFSOC_UART1_PA_BASE),
20 .length = SIRFSOC_UART1_SIZE,
21 .type = MT_DEVICE,
22 };
23
24 iotable_init(&sirfsoc_lluart_map, 1);
25}
diff --git a/arch/arm/mach-prima2/prima2.c b/arch/arm/mach-prima2/prima2.c
new file mode 100644
index 00000000000..f57124bdd14
--- /dev/null
+++ b/arch/arm/mach-prima2/prima2.c
@@ -0,0 +1,41 @@
1/*
2 * Defines machines for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <asm/mach-types.h>
12#include <asm/mach/arch.h>
13#include <linux/of.h>
14#include <linux/of_platform.h>
15#include "common.h"
16
17static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
18 { .compatible = "simple-bus", },
19 {},
20};
21
22void __init sirfsoc_mach_init(void)
23{
24 of_platform_bus_probe(NULL, sirfsoc_of_bus_ids, NULL);
25}
26
27static const char *prima2cb_dt_match[] __initdata = {
28 "sirf,prima2-cb",
29 NULL
30};
31
32MACHINE_START(PRIMA2_EVB, "prima2cb")
33 /* Maintainer: Barry Song <baohua.song@csr.com> */
34 .boot_params = 0x00000100,
35 .init_early = sirfsoc_of_clk_init,
36 .map_io = sirfsoc_map_lluart,
37 .init_irq = sirfsoc_of_irq_init,
38 .timer = &sirfsoc_timer,
39 .init_machine = sirfsoc_mach_init,
40 .dt_compat = prima2cb_dt_match,
41MACHINE_END
diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
new file mode 100644
index 00000000000..492cfa8d261
--- /dev/null
+++ b/arch/arm/mach-prima2/rstc.c
@@ -0,0 +1,70 @@
1/*
2 * reset controller for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/kernel.h>
10#include <linux/mutex.h>
11#include <linux/io.h>
12#include <linux/delay.h>
13#include <linux/device.h>
14#include <linux/of.h>
15#include <linux/of_address.h>
16
17void __iomem *sirfsoc_rstc_base;
18static DEFINE_MUTEX(rstc_lock);
19
20static struct of_device_id rstc_ids[] = {
21 { .compatible = "sirf,prima2-rstc" },
22 {},
23};
24
25static int __init sirfsoc_of_rstc_init(void)
26{
27 struct device_node *np;
28
29 np = of_find_matching_node(NULL, rstc_ids);
30 if (!np)
31 panic("unable to find compatible rstc node in dtb\n");
32
33 sirfsoc_rstc_base = of_iomap(np, 0);
34 if (!sirfsoc_rstc_base)
35 panic("unable to map rstc cpu registers\n");
36
37 of_node_put(np);
38
39 return 0;
40}
41early_initcall(sirfsoc_of_rstc_init);
42
43int sirfsoc_reset_device(struct device *dev)
44{
45 const unsigned int *prop = of_get_property(dev->of_node, "reset-bit", NULL);
46 unsigned int reset_bit;
47
48 if (!prop)
49 return -ENODEV;
50
51 reset_bit = be32_to_cpup(prop);
52
53 mutex_lock(&rstc_lock);
54
55 /*
56 * Writing 1 to this bit resets corresponding block. Writing 0 to this
57 * bit de-asserts reset signal of the corresponding block.
58 * datasheet doesn't require explicit delay between the set and clear
59 * of reset bit. it could be shorter if tests pass.
60 */
61 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) | reset_bit,
62 sirfsoc_rstc_base + (reset_bit / 32) * 4);
63 msleep(10);
64 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) & ~reset_bit,
65 sirfsoc_rstc_base + (reset_bit / 32) * 4);
66
67 mutex_unlock(&rstc_lock);
68
69 return 0;
70}
diff --git a/arch/arm/mach-prima2/timer.c b/arch/arm/mach-prima2/timer.c
new file mode 100644
index 00000000000..ed7ec48d11d
--- /dev/null
+++ b/arch/arm/mach-prima2/timer.c
@@ -0,0 +1,218 @@
1/*
2 * System timer for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/kernel.h>
10#include <linux/interrupt.h>
11#include <linux/clockchips.h>
12#include <linux/clocksource.h>
13#include <linux/bitops.h>
14#include <linux/irq.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/slab.h>
18#include <linux/of.h>
19#include <linux/of_address.h>
20#include <mach/map.h>
21#include <asm/mach/time.h>
22
23#define SIRFSOC_TIMER_COUNTER_LO 0x0000
24#define SIRFSOC_TIMER_COUNTER_HI 0x0004
25#define SIRFSOC_TIMER_MATCH_0 0x0008
26#define SIRFSOC_TIMER_MATCH_1 0x000C
27#define SIRFSOC_TIMER_MATCH_2 0x0010
28#define SIRFSOC_TIMER_MATCH_3 0x0014
29#define SIRFSOC_TIMER_MATCH_4 0x0018
30#define SIRFSOC_TIMER_MATCH_5 0x001C
31#define SIRFSOC_TIMER_STATUS 0x0020
32#define SIRFSOC_TIMER_INT_EN 0x0024
33#define SIRFSOC_TIMER_WATCHDOG_EN 0x0028
34#define SIRFSOC_TIMER_DIV 0x002C
35#define SIRFSOC_TIMER_LATCH 0x0030
36#define SIRFSOC_TIMER_LATCHED_LO 0x0034
37#define SIRFSOC_TIMER_LATCHED_HI 0x0038
38
39#define SIRFSOC_TIMER_WDT_INDEX 5
40
41#define SIRFSOC_TIMER_LATCH_BIT BIT(0)
42
43static void __iomem *sirfsoc_timer_base;
44static void __init sirfsoc_of_timer_map(void);
45
46/* timer0 interrupt handler */
47static irqreturn_t sirfsoc_timer_interrupt(int irq, void *dev_id)
48{
49 struct clock_event_device *ce = dev_id;
50
51 WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
52
53 /* clear timer0 interrupt */
54 writel_relaxed(BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_STATUS);
55
56 ce->event_handler(ce);
57
58 return IRQ_HANDLED;
59}
60
61/* read 64-bit timer counter */
62static cycle_t sirfsoc_timer_read(struct clocksource *cs)
63{
64 u64 cycles;
65
66 /* latch the 64-bit timer counter */
67 writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
68 cycles = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_HI);
69 cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
70
71 return cycles;
72}
73
74static int sirfsoc_timer_set_next_event(unsigned long delta,
75 struct clock_event_device *ce)
76{
77 unsigned long now, next;
78
79 writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
80 now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
81 next = now + delta;
82 writel_relaxed(next, sirfsoc_timer_base + SIRFSOC_TIMER_MATCH_0);
83 writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
84 now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
85
86 return next - now > delta ? -ETIME : 0;
87}
88
89static void sirfsoc_timer_set_mode(enum clock_event_mode mode,
90 struct clock_event_device *ce)
91{
92 u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
93 switch (mode) {
94 case CLOCK_EVT_MODE_PERIODIC:
95 WARN_ON(1);
96 break;
97 case CLOCK_EVT_MODE_ONESHOT:
98 writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
99 break;
100 case CLOCK_EVT_MODE_SHUTDOWN:
101 writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
102 break;
103 case CLOCK_EVT_MODE_UNUSED:
104 case CLOCK_EVT_MODE_RESUME:
105 break;
106 }
107}
108
109static struct clock_event_device sirfsoc_clockevent = {
110 .name = "sirfsoc_clockevent",
111 .rating = 200,
112 .features = CLOCK_EVT_FEAT_ONESHOT,
113 .set_mode = sirfsoc_timer_set_mode,
114 .set_next_event = sirfsoc_timer_set_next_event,
115};
116
117static struct clocksource sirfsoc_clocksource = {
118 .name = "sirfsoc_clocksource",
119 .rating = 200,
120 .mask = CLOCKSOURCE_MASK(64),
121 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
122 .read = sirfsoc_timer_read,
123};
124
125static struct irqaction sirfsoc_timer_irq = {
126 .name = "sirfsoc_timer0",
127 .flags = IRQF_TIMER,
128 .irq = 0,
129 .handler = sirfsoc_timer_interrupt,
130 .dev_id = &sirfsoc_clockevent,
131};
132
133/* Overwrite weak default sched_clock with more precise one */
134unsigned long long notrace sched_clock(void)
135{
136 static int is_mapped = 0;
137
138 /*
139 * sched_clock is called earlier than .init of sys_timer
140 * if we map timer memory in .init of sys_timer, system
141 * will panic due to illegal memory access
142 */
143 if(!is_mapped) {
144 sirfsoc_of_timer_map();
145 is_mapped = 1;
146 }
147
148 return sirfsoc_timer_read(NULL) * (NSEC_PER_SEC / CLOCK_TICK_RATE);
149}
150
151static void __init sirfsoc_clockevent_init(void)
152{
153 clockevents_calc_mult_shift(&sirfsoc_clockevent, CLOCK_TICK_RATE, 60);
154
155 sirfsoc_clockevent.max_delta_ns =
156 clockevent_delta2ns(-2, &sirfsoc_clockevent);
157 sirfsoc_clockevent.min_delta_ns =
158 clockevent_delta2ns(2, &sirfsoc_clockevent);
159
160 sirfsoc_clockevent.cpumask = cpumask_of(0);
161 clockevents_register_device(&sirfsoc_clockevent);
162}
163
164/* initialize the kernel jiffy timer source */
165static void __init sirfsoc_timer_init(void)
166{
167 unsigned long rate;
168
169 /* timer's input clock is io clock */
170 struct clk *clk = clk_get_sys("io", NULL);
171
172 BUG_ON(IS_ERR(clk));
173
174 rate = clk_get_rate(clk);
175
176 BUG_ON(rate < CLOCK_TICK_RATE);
177 BUG_ON(rate % CLOCK_TICK_RATE);
178
179 writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV);
180 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
181 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
182 writel_relaxed(BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_STATUS);
183
184 BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE));
185
186 BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq));
187
188 sirfsoc_clockevent_init();
189}
190
191static struct of_device_id timer_ids[] = {
192 { .compatible = "sirf,prima2-tick" },
193 {},
194};
195
196static void __init sirfsoc_of_timer_map(void)
197{
198 struct device_node *np;
199 const unsigned int *intspec;
200
201 np = of_find_matching_node(NULL, timer_ids);
202 if (!np)
203 panic("unable to find compatible timer node in dtb\n");
204 sirfsoc_timer_base = of_iomap(np, 0);
205 if (!sirfsoc_timer_base)
206 panic("unable to map timer cpu registers\n");
207
208 /* Get the interrupts property */
209 intspec = of_get_property(np, "interrupts", NULL);
210 BUG_ON(!intspec);
211 sirfsoc_timer_irq.irq = be32_to_cpup(intspec);
212
213 of_node_put(np);
214}
215
216struct sys_timer sirfsoc_timer = {
217 .init = sirfsoc_timer_init,
218};
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 810a982a66f..ef3e8b1e06c 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -825,6 +825,7 @@ MACHINE_START(BALLOON3, "Balloon3")
825 .map_io = balloon3_map_io, 825 .map_io = balloon3_map_io,
826 .nr_irqs = BALLOON3_NR_IRQS, 826 .nr_irqs = BALLOON3_NR_IRQS,
827 .init_irq = balloon3_init_irq, 827 .init_irq = balloon3_init_irq,
828 .handle_irq = pxa27x_handle_irq,
828 .timer = &pxa_timer, 829 .timer = &pxa_timer,
829 .init_machine = balloon3_init, 830 .init_machine = balloon3_init,
830 .boot_params = PLAT_PHYS_OFFSET + 0x100, 831 .boot_params = PLAT_PHYS_OFFSET + 0x100,
diff --git a/arch/arm/mach-pxa/capc7117.c b/arch/arm/mach-pxa/capc7117.c
index 4284513f396..648b0ab2bf7 100644
--- a/arch/arm/mach-pxa/capc7117.c
+++ b/arch/arm/mach-pxa/capc7117.c
@@ -151,6 +151,7 @@ MACHINE_START(CAPC7117,
151 .boot_params = 0xa0000100, 151 .boot_params = 0xa0000100,
152 .map_io = pxa3xx_map_io, 152 .map_io = pxa3xx_map_io,
153 .init_irq = pxa3xx_init_irq, 153 .init_irq = pxa3xx_init_irq,
154 .handle_irq = pxa3xx_handle_irq,
154 .timer = &pxa_timer, 155 .timer = &pxa_timer,
155 .init_machine = capc7117_init 156 .init_machine = capc7117_init
156MACHINE_END 157MACHINE_END
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index d5152220ce9..4d466102a02 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -53,6 +53,21 @@ unsigned long clk_get_rate(struct clk *clk)
53} 53}
54EXPORT_SYMBOL(clk_get_rate); 54EXPORT_SYMBOL(clk_get_rate);
55 55
56int clk_set_rate(struct clk *clk, unsigned long rate)
57{
58 unsigned long flags;
59 int ret = -EINVAL;
60
61 if (clk->ops->setrate) {
62 spin_lock_irqsave(&clocks_lock, flags);
63 ret = clk->ops->setrate(clk, rate);
64 spin_unlock_irqrestore(&clocks_lock, flags);
65 }
66
67 return ret;
68}
69EXPORT_SYMBOL(clk_set_rate);
70
56void clk_dummy_enable(struct clk *clk) 71void clk_dummy_enable(struct clk *clk)
57{ 72{
58} 73}
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 1f2fb9c43f0..3a258b1bf1a 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -5,6 +5,7 @@ struct clkops {
5 void (*enable)(struct clk *); 5 void (*enable)(struct clk *);
6 void (*disable)(struct clk *); 6 void (*disable)(struct clk *);
7 unsigned long (*getrate)(struct clk *); 7 unsigned long (*getrate)(struct clk *);
8 int (*setrate)(struct clk *, unsigned long);
8}; 9};
9 10
10struct clk { 11struct clk {
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
index 1afc0fb7d6d..6bf479d9b5a 100644
--- a/arch/arm/mach-pxa/cm-x2xx-pci.c
+++ b/arch/arm/mach-pxa/cm-x2xx-pci.c
@@ -77,7 +77,7 @@ void cmx2xx_pci_resume(void) {}
77#endif 77#endif
78 78
79/* PCI IRQ mapping*/ 79/* PCI IRQ mapping*/
80static int __init cmx2xx_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 80static int __init cmx2xx_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
81{ 81{
82 int irq; 82 int irq;
83 83
@@ -125,6 +125,9 @@ static void cmx2xx_pci_preinit(void)
125{ 125{
126 pr_info("Initializing CM-X2XX PCI subsystem\n"); 126 pr_info("Initializing CM-X2XX PCI subsystem\n");
127 127
128 pcibios_min_io = 0;
129 pcibios_min_mem = 0;
130
128 __raw_writel(0x800, IT8152_PCI_CFG_ADDR); 131 __raw_writel(0x800, IT8152_PCI_CFG_ADDR);
129 if (__raw_readl(IT8152_PCI_CFG_DATA) == 0x81521283) { 132 if (__raw_readl(IT8152_PCI_CFG_DATA) == 0x81521283) {
130 pr_info("PCI Bridge found.\n"); 133 pr_info("PCI Bridge found.\n");
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index bc55d07566c..13cf518bbbf 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -21,7 +21,8 @@
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23 23
24#include <mach/pxa2xx-regs.h> 24#include <mach/pxa25x.h>
25#include <mach/pxa27x.h>
25#include <mach/audio.h> 26#include <mach/audio.h>
26#include <mach/pxafb.h> 27#include <mach/pxafb.h>
27#include <mach/smemc.h> 28#include <mach/smemc.h>
@@ -516,6 +517,8 @@ MACHINE_START(ARMCORE, "Compulab CM-X2XX")
516 .map_io = cmx2xx_map_io, 517 .map_io = cmx2xx_map_io,
517 .nr_irqs = CMX2XX_NR_IRQS, 518 .nr_irqs = CMX2XX_NR_IRQS,
518 .init_irq = cmx2xx_init_irq, 519 .init_irq = cmx2xx_init_irq,
520 /* NOTE: pxa25x_handle_irq() works on PXA27x w/o camera support */
521 .handle_irq = pxa25x_handle_irq,
519 .timer = &pxa_timer, 522 .timer = &pxa_timer,
520 .init_machine = cmx2xx_init, 523 .init_machine = cmx2xx_init,
521#ifdef CONFIG_PCI 524#ifdef CONFIG_PCI
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index b199596f9c3..b6a51340270 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -855,6 +855,7 @@ MACHINE_START(CM_X300, "CM-X300 module")
855 .boot_params = 0xa0000100, 855 .boot_params = 0xa0000100,
856 .map_io = pxa3xx_map_io, 856 .map_io = pxa3xx_map_io,
857 .init_irq = pxa3xx_init_irq, 857 .init_irq = pxa3xx_init_irq,
858 .handle_irq = pxa3xx_handle_irq,
858 .timer = &pxa_timer, 859 .timer = &pxa_timer,
859 .init_machine = cm_x300_init, 860 .init_machine = cm_x300_init,
860 .fixup = cm_x300_fixup, 861 .fixup = cm_x300_fixup,
diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c
index 7545a48ed88..870920934ec 100644
--- a/arch/arm/mach-pxa/colibri-pxa270.c
+++ b/arch/arm/mach-pxa/colibri-pxa270.c
@@ -310,6 +310,7 @@ MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
310 .init_machine = colibri_pxa270_init, 310 .init_machine = colibri_pxa270_init,
311 .map_io = pxa27x_map_io, 311 .map_io = pxa27x_map_io,
312 .init_irq = pxa27x_init_irq, 312 .init_irq = pxa27x_init_irq,
313 .handle_irq = pxa27x_handle_irq,
313 .timer = &pxa_timer, 314 .timer = &pxa_timer,
314MACHINE_END 315MACHINE_END
315 316
@@ -318,6 +319,7 @@ MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC")
318 .init_machine = colibri_pxa270_income_init, 319 .init_machine = colibri_pxa270_income_init,
319 .map_io = pxa27x_map_io, 320 .map_io = pxa27x_map_io,
320 .init_irq = pxa27x_init_irq, 321 .init_irq = pxa27x_init_irq,
322 .handle_irq = pxa27x_handle_irq,
321 .timer = &pxa_timer, 323 .timer = &pxa_timer,
322MACHINE_END 324MACHINE_END
323 325
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
index 66dd81cbc8a..60a6781e7a8 100644
--- a/arch/arm/mach-pxa/colibri-pxa300.c
+++ b/arch/arm/mach-pxa/colibri-pxa300.c
@@ -187,6 +187,7 @@ MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
187 .init_machine = colibri_pxa300_init, 187 .init_machine = colibri_pxa300_init,
188 .map_io = pxa3xx_map_io, 188 .map_io = pxa3xx_map_io,
189 .init_irq = pxa3xx_init_irq, 189 .init_irq = pxa3xx_init_irq,
190 .handle_irq = pxa3xx_handle_irq,
190 .timer = &pxa_timer, 191 .timer = &pxa_timer,
191MACHINE_END 192MACHINE_END
192 193
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
index ff9ff5f4fc4..d2c6631915d 100644
--- a/arch/arm/mach-pxa/colibri-pxa320.c
+++ b/arch/arm/mach-pxa/colibri-pxa320.c
@@ -23,8 +23,7 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/irq.h> 24#include <asm/mach/irq.h>
25 25
26#include <mach/pxa3xx-regs.h> 26#include <mach/pxa320.h>
27#include <mach/mfp-pxa320.h>
28#include <mach/colibri.h> 27#include <mach/colibri.h>
29#include <mach/pxafb.h> 28#include <mach/pxafb.h>
30#include <mach/ohci.h> 29#include <mach/ohci.h>
@@ -258,6 +257,7 @@ MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
258 .init_machine = colibri_pxa320_init, 257 .init_machine = colibri_pxa320_init,
259 .map_io = pxa3xx_map_io, 258 .map_io = pxa3xx_map_io,
260 .init_irq = pxa3xx_init_irq, 259 .init_irq = pxa3xx_init_irq,
260 .handle_irq = pxa3xx_handle_irq,
261 .timer = &pxa_timer, 261 .timer = &pxa_timer,
262MACHINE_END 262MACHINE_END
263 263
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 3a5507e3191..185a37cad25 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -722,6 +722,7 @@ MACHINE_START(CORGI, "SHARP Corgi")
722 .fixup = fixup_corgi, 722 .fixup = fixup_corgi,
723 .map_io = pxa25x_map_io, 723 .map_io = pxa25x_map_io,
724 .init_irq = pxa25x_init_irq, 724 .init_irq = pxa25x_init_irq,
725 .handle_irq = pxa25x_handle_irq,
725 .init_machine = corgi_init, 726 .init_machine = corgi_init,
726 .timer = &pxa_timer, 727 .timer = &pxa_timer,
727MACHINE_END 728MACHINE_END
@@ -732,6 +733,7 @@ MACHINE_START(SHEPHERD, "SHARP Shepherd")
732 .fixup = fixup_corgi, 733 .fixup = fixup_corgi,
733 .map_io = pxa25x_map_io, 734 .map_io = pxa25x_map_io,
734 .init_irq = pxa25x_init_irq, 735 .init_irq = pxa25x_init_irq,
736 .handle_irq = pxa25x_handle_irq,
735 .init_machine = corgi_init, 737 .init_machine = corgi_init,
736 .timer = &pxa_timer, 738 .timer = &pxa_timer,
737MACHINE_END 739MACHINE_END
@@ -742,6 +744,7 @@ MACHINE_START(HUSKY, "SHARP Husky")
742 .fixup = fixup_corgi, 744 .fixup = fixup_corgi,
743 .map_io = pxa25x_map_io, 745 .map_io = pxa25x_map_io,
744 .init_irq = pxa25x_init_irq, 746 .init_irq = pxa25x_init_irq,
747 .handle_irq = pxa25x_handle_irq,
745 .init_machine = corgi_init, 748 .init_machine = corgi_init,
746 .timer = &pxa_timer, 749 .timer = &pxa_timer,
747MACHINE_END 750MACHINE_END
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c
index 0481c29a70e..fe812eafb1f 100644
--- a/arch/arm/mach-pxa/csb726.c
+++ b/arch/arm/mach-pxa/csb726.c
@@ -22,10 +22,9 @@
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <mach/csb726.h> 24#include <mach/csb726.h>
25#include <mach/mfp-pxa27x.h> 25#include <mach/pxa27x.h>
26#include <mach/mmc.h> 26#include <mach/mmc.h>
27#include <mach/ohci.h> 27#include <mach/ohci.h>
28#include <mach/pxa2xx-regs.h>
29#include <mach/audio.h> 28#include <mach/audio.h>
30#include <mach/smemc.h> 29#include <mach/smemc.h>
31 30
@@ -276,6 +275,7 @@ MACHINE_START(CSB726, "Cogent CSB726")
276 .boot_params = 0xa0000100, 275 .boot_params = 0xa0000100,
277 .map_io = pxa27x_map_io, 276 .map_io = pxa27x_map_io,
278 .init_irq = pxa27x_init_irq, 277 .init_irq = pxa27x_init_irq,
278 .handle_irq = pxa27x_handle_irq,
279 .init_machine = csb726_init, 279 .init_machine = csb726_init,
280 .timer = &pxa_timer, 280 .timer = &pxa_timer,
281MACHINE_END 281MACHINE_END
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index f8a6e9d79a3..2e37ea52b37 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -1302,6 +1302,7 @@ MACHINE_START(EM_X270, "Compulab EM-X270")
1302 .boot_params = 0xa0000100, 1302 .boot_params = 0xa0000100,
1303 .map_io = pxa27x_map_io, 1303 .map_io = pxa27x_map_io,
1304 .init_irq = pxa27x_init_irq, 1304 .init_irq = pxa27x_init_irq,
1305 .handle_irq = pxa27x_handle_irq,
1305 .timer = &pxa_timer, 1306 .timer = &pxa_timer,
1306 .init_machine = em_x270_init, 1307 .init_machine = em_x270_init,
1307MACHINE_END 1308MACHINE_END
@@ -1310,6 +1311,7 @@ MACHINE_START(EXEDA, "Compulab eXeda")
1310 .boot_params = 0xa0000100, 1311 .boot_params = 0xa0000100,
1311 .map_io = pxa27x_map_io, 1312 .map_io = pxa27x_map_io,
1312 .init_irq = pxa27x_init_irq, 1313 .init_irq = pxa27x_init_irq,
1314 .handle_irq = pxa27x_handle_irq,
1313 .timer = &pxa_timer, 1315 .timer = &pxa_timer,
1314 .init_machine = em_x270_init, 1316 .init_machine = em_x270_init,
1315MACHINE_END 1317MACHINE_END
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index 2e3970fdde0..b4599ec9d61 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -193,6 +193,7 @@ MACHINE_START(E330, "Toshiba e330")
193 .map_io = pxa25x_map_io, 193 .map_io = pxa25x_map_io,
194 .nr_irqs = ESERIES_NR_IRQS, 194 .nr_irqs = ESERIES_NR_IRQS,
195 .init_irq = pxa25x_init_irq, 195 .init_irq = pxa25x_init_irq,
196 .handle_irq = pxa25x_handle_irq,
196 .fixup = eseries_fixup, 197 .fixup = eseries_fixup,
197 .init_machine = e330_init, 198 .init_machine = e330_init,
198 .timer = &pxa_timer, 199 .timer = &pxa_timer,
@@ -242,6 +243,7 @@ MACHINE_START(E350, "Toshiba e350")
242 .map_io = pxa25x_map_io, 243 .map_io = pxa25x_map_io,
243 .nr_irqs = ESERIES_NR_IRQS, 244 .nr_irqs = ESERIES_NR_IRQS,
244 .init_irq = pxa25x_init_irq, 245 .init_irq = pxa25x_init_irq,
246 .handle_irq = pxa25x_handle_irq,
245 .fixup = eseries_fixup, 247 .fixup = eseries_fixup,
246 .init_machine = e350_init, 248 .init_machine = e350_init,
247 .timer = &pxa_timer, 249 .timer = &pxa_timer,
@@ -364,6 +366,7 @@ MACHINE_START(E400, "Toshiba e400")
364 .map_io = pxa25x_map_io, 366 .map_io = pxa25x_map_io,
365 .nr_irqs = ESERIES_NR_IRQS, 367 .nr_irqs = ESERIES_NR_IRQS,
366 .init_irq = pxa25x_init_irq, 368 .init_irq = pxa25x_init_irq,
369 .handle_irq = pxa25x_handle_irq,
367 .fixup = eseries_fixup, 370 .fixup = eseries_fixup,
368 .init_machine = e400_init, 371 .init_machine = e400_init,
369 .timer = &pxa_timer, 372 .timer = &pxa_timer,
@@ -552,6 +555,7 @@ MACHINE_START(E740, "Toshiba e740")
552 .map_io = pxa25x_map_io, 555 .map_io = pxa25x_map_io,
553 .nr_irqs = ESERIES_NR_IRQS, 556 .nr_irqs = ESERIES_NR_IRQS,
554 .init_irq = pxa25x_init_irq, 557 .init_irq = pxa25x_init_irq,
558 .handle_irq = pxa25x_handle_irq,
555 .fixup = eseries_fixup, 559 .fixup = eseries_fixup,
556 .init_machine = e740_init, 560 .init_machine = e740_init,
557 .timer = &pxa_timer, 561 .timer = &pxa_timer,
@@ -743,6 +747,7 @@ MACHINE_START(E750, "Toshiba e750")
743 .map_io = pxa25x_map_io, 747 .map_io = pxa25x_map_io,
744 .nr_irqs = ESERIES_NR_IRQS, 748 .nr_irqs = ESERIES_NR_IRQS,
745 .init_irq = pxa25x_init_irq, 749 .init_irq = pxa25x_init_irq,
750 .handle_irq = pxa25x_handle_irq,
746 .fixup = eseries_fixup, 751 .fixup = eseries_fixup,
747 .init_machine = e750_init, 752 .init_machine = e750_init,
748 .timer = &pxa_timer, 753 .timer = &pxa_timer,
@@ -947,6 +952,7 @@ MACHINE_START(E800, "Toshiba e800")
947 .map_io = pxa25x_map_io, 952 .map_io = pxa25x_map_io,
948 .nr_irqs = ESERIES_NR_IRQS, 953 .nr_irqs = ESERIES_NR_IRQS,
949 .init_irq = pxa25x_init_irq, 954 .init_irq = pxa25x_init_irq,
955 .handle_irq = pxa25x_handle_irq,
950 .fixup = eseries_fixup, 956 .fixup = eseries_fixup,
951 .init_machine = e800_init, 957 .init_machine = e800_init,
952 .timer = &pxa_timer, 958 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index d88aed8fbe1..b73eadb9f5d 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -801,6 +801,7 @@ MACHINE_START(EZX_A780, "Motorola EZX A780")
801 .map_io = pxa27x_map_io, 801 .map_io = pxa27x_map_io,
802 .nr_irqs = EZX_NR_IRQS, 802 .nr_irqs = EZX_NR_IRQS,
803 .init_irq = pxa27x_init_irq, 803 .init_irq = pxa27x_init_irq,
804 .handle_irq = pxa27x_handle_irq,
804 .timer = &pxa_timer, 805 .timer = &pxa_timer,
805 .init_machine = a780_init, 806 .init_machine = a780_init,
806MACHINE_END 807MACHINE_END
@@ -866,6 +867,7 @@ MACHINE_START(EZX_E680, "Motorola EZX E680")
866 .map_io = pxa27x_map_io, 867 .map_io = pxa27x_map_io,
867 .nr_irqs = EZX_NR_IRQS, 868 .nr_irqs = EZX_NR_IRQS,
868 .init_irq = pxa27x_init_irq, 869 .init_irq = pxa27x_init_irq,
870 .handle_irq = pxa27x_handle_irq,
869 .timer = &pxa_timer, 871 .timer = &pxa_timer,
870 .init_machine = e680_init, 872 .init_machine = e680_init,
871MACHINE_END 873MACHINE_END
@@ -931,6 +933,7 @@ MACHINE_START(EZX_A1200, "Motorola EZX A1200")
931 .map_io = pxa27x_map_io, 933 .map_io = pxa27x_map_io,
932 .nr_irqs = EZX_NR_IRQS, 934 .nr_irqs = EZX_NR_IRQS,
933 .init_irq = pxa27x_init_irq, 935 .init_irq = pxa27x_init_irq,
936 .handle_irq = pxa27x_handle_irq,
934 .timer = &pxa_timer, 937 .timer = &pxa_timer,
935 .init_machine = a1200_init, 938 .init_machine = a1200_init,
936MACHINE_END 939MACHINE_END
@@ -1121,6 +1124,7 @@ MACHINE_START(EZX_A910, "Motorola EZX A910")
1121 .map_io = pxa27x_map_io, 1124 .map_io = pxa27x_map_io,
1122 .nr_irqs = EZX_NR_IRQS, 1125 .nr_irqs = EZX_NR_IRQS,
1123 .init_irq = pxa27x_init_irq, 1126 .init_irq = pxa27x_init_irq,
1127 .handle_irq = pxa27x_handle_irq,
1124 .timer = &pxa_timer, 1128 .timer = &pxa_timer,
1125 .init_machine = a910_init, 1129 .init_machine = a910_init,
1126MACHINE_END 1130MACHINE_END
@@ -1186,6 +1190,7 @@ MACHINE_START(EZX_E6, "Motorola EZX E6")
1186 .map_io = pxa27x_map_io, 1190 .map_io = pxa27x_map_io,
1187 .nr_irqs = EZX_NR_IRQS, 1191 .nr_irqs = EZX_NR_IRQS,
1188 .init_irq = pxa27x_init_irq, 1192 .init_irq = pxa27x_init_irq,
1193 .handle_irq = pxa27x_handle_irq,
1189 .timer = &pxa_timer, 1194 .timer = &pxa_timer,
1190 .init_machine = e6_init, 1195 .init_machine = e6_init,
1191MACHINE_END 1196MACHINE_END
@@ -1225,6 +1230,7 @@ MACHINE_START(EZX_E2, "Motorola EZX E2")
1225 .map_io = pxa27x_map_io, 1230 .map_io = pxa27x_map_io,
1226 .nr_irqs = EZX_NR_IRQS, 1231 .nr_irqs = EZX_NR_IRQS,
1227 .init_irq = pxa27x_init_irq, 1232 .init_irq = pxa27x_init_irq,
1233 .handle_irq = pxa27x_handle_irq,
1228 .timer = &pxa_timer, 1234 .timer = &pxa_timer,
1229 .init_machine = e2_init, 1235 .init_machine = e2_init,
1230MACHINE_END 1236MACHINE_END
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index e6c9344a95a..92a2e85ab02 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -13,21 +13,8 @@ struct irq_data;
13struct sys_timer; 13struct sys_timer;
14 14
15extern struct sys_timer pxa_timer; 15extern struct sys_timer pxa_timer;
16extern void __init pxa_init_irq(int irq_nr,
17 int (*set_wake)(struct irq_data *,
18 unsigned int));
19extern void __init pxa25x_init_irq(void);
20#ifdef CONFIG_CPU_PXA26x
21extern void __init pxa26x_init_irq(void);
22#endif
23extern void __init pxa27x_init_irq(void);
24extern void __init pxa3xx_init_irq(void);
25extern void __init pxa95x_init_irq(void);
26 16
27extern void __init pxa_map_io(void); 17extern void __init pxa_map_io(void);
28extern void __init pxa25x_map_io(void);
29extern void __init pxa27x_map_io(void);
30extern void __init pxa3xx_map_io(void);
31 18
32extern unsigned int get_clk_frequency_khz(int info); 19extern unsigned int get_clk_frequency_khz(int info);
33 20
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index d65e4bde9b9..deaa111c91f 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -236,6 +236,7 @@ MACHINE_START(GUMSTIX, "Gumstix")
236 .boot_params = 0xa0000100, /* match u-boot bi_boot_params */ 236 .boot_params = 0xa0000100, /* match u-boot bi_boot_params */
237 .map_io = pxa25x_map_io, 237 .map_io = pxa25x_map_io,
238 .init_irq = pxa25x_init_irq, 238 .init_irq = pxa25x_init_irq,
239 .handle_irq = pxa25x_handle_irq,
239 .timer = &pxa_timer, 240 .timer = &pxa_timer,
240 .init_machine = gumstix_init, 241 .init_machine = gumstix_init,
241MACHINE_END 242MACHINE_END
diff --git a/arch/arm/mach-pxa/h5000.c b/arch/arm/mach-pxa/h5000.c
index 657db469de1..0a235128914 100644
--- a/arch/arm/mach-pxa/h5000.c
+++ b/arch/arm/mach-pxa/h5000.c
@@ -28,6 +28,7 @@
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <asm/irq.h>
31 32
32#include <mach/pxa25x.h> 33#include <mach/pxa25x.h>
33#include <mach/h5000.h> 34#include <mach/h5000.h>
@@ -205,6 +206,7 @@ MACHINE_START(H5400, "HP iPAQ H5000")
205 .boot_params = 0xa0000100, 206 .boot_params = 0xa0000100,
206 .map_io = pxa25x_map_io, 207 .map_io = pxa25x_map_io,
207 .init_irq = pxa25x_init_irq, 208 .init_irq = pxa25x_init_irq,
209 .handle_irq = pxa25x_handle_irq,
208 .timer = &pxa_timer, 210 .timer = &pxa_timer,
209 .init_machine = h5000_init, 211 .init_machine = h5000_init,
210MACHINE_END 212MACHINE_END
diff --git a/arch/arm/mach-pxa/himalaya.c b/arch/arm/mach-pxa/himalaya.c
index e8603eba54b..a997d0ab287 100644
--- a/arch/arm/mach-pxa/himalaya.c
+++ b/arch/arm/mach-pxa/himalaya.c
@@ -24,8 +24,7 @@
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26 26
27#include <mach/mfp-pxa25x.h> 27#include <mach/pxa25x.h>
28#include <mach/hardware.h>
29 28
30#include "generic.h" 29#include "generic.h"
31 30
@@ -162,6 +161,7 @@ MACHINE_START(HIMALAYA, "HTC Himalaya")
162 .boot_params = 0xa0000100, 161 .boot_params = 0xa0000100,
163 .map_io = pxa25x_map_io, 162 .map_io = pxa25x_map_io,
164 .init_irq = pxa25x_init_irq, 163 .init_irq = pxa25x_init_irq,
164 .handle_irq = pxa25x_handle_irq,
165 .init_machine = himalaya_init, 165 .init_machine = himalaya_init,
166 .timer = &pxa_timer, 166 .timer = &pxa_timer,
167MACHINE_END 167MACHINE_END
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 99960a1814e..c748a473a2f 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -842,6 +842,7 @@ MACHINE_START(H4700, "HP iPAQ HX4700")
842 .map_io = pxa27x_map_io, 842 .map_io = pxa27x_map_io,
843 .nr_irqs = HX4700_NR_IRQS, 843 .nr_irqs = HX4700_NR_IRQS,
844 .init_irq = pxa27x_init_irq, 844 .init_irq = pxa27x_init_irq,
845 .handle_irq = pxa27x_handle_irq,
845 .init_machine = hx4700_init, 846 .init_machine = hx4700_init,
846 .timer = &pxa_timer, 847 .timer = &pxa_timer,
847MACHINE_END 848MACHINE_END
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c
index 6cedc81da3b..d427429f1f3 100644
--- a/arch/arm/mach-pxa/icontrol.c
+++ b/arch/arm/mach-pxa/icontrol.c
@@ -194,6 +194,7 @@ MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM")
194 .boot_params = 0xa0000100, 194 .boot_params = 0xa0000100,
195 .map_io = pxa3xx_map_io, 195 .map_io = pxa3xx_map_io,
196 .init_irq = pxa3xx_init_irq, 196 .init_irq = pxa3xx_init_irq,
197 .handle_irq = pxa3xx_handle_irq,
197 .timer = &pxa_timer, 198 .timer = &pxa_timer,
198 .init_machine = icontrol_init 199 .init_machine = icontrol_init
199MACHINE_END 200MACHINE_END
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
index f7fb64f11a7..ddf20e5c376 100644
--- a/arch/arm/mach-pxa/idp.c
+++ b/arch/arm/mach-pxa/idp.c
@@ -196,6 +196,7 @@ MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
196 /* Maintainer: Vibren Technologies */ 196 /* Maintainer: Vibren Technologies */
197 .map_io = idp_map_io, 197 .map_io = idp_map_io,
198 .init_irq = pxa25x_init_irq, 198 .init_irq = pxa25x_init_irq,
199 .handle_irq = pxa25x_handle_irq,
199 .timer = &pxa_timer, 200 .timer = &pxa_timer,
200 .init_machine = idp_init, 201 .init_machine = idp_init,
201MACHINE_END 202MACHINE_END
diff --git a/arch/arm/mach-pxa/include/mach/clkdev.h b/arch/arm/mach-pxa/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/mach-pxa/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index 6957ba56025..de63ca3016b 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -337,9 +337,6 @@ extern unsigned long get_clock_tick_rate(void);
337#endif 337#endif
338 338
339#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) 339#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
340#define PCIBIOS_MIN_IO 0
341#define PCIBIOS_MIN_MEM 0
342#define pcibios_assign_all_busses() 1
343#define ARCH_HAS_DMA_SET_COHERENT_MASK 340#define ARCH_HAS_DMA_SET_COHERENT_MASK
344#endif 341#endif
345 342
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index 038402404e3..7cc5a781e99 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -104,4 +104,16 @@
104 104
105#define NR_IRQS (IRQ_BOARD_START) 105#define NR_IRQS (IRQ_BOARD_START)
106 106
107#ifndef __ASSEMBLY__
108struct irq_data;
109struct pt_regs;
110
111void pxa_mask_irq(struct irq_data *);
112void pxa_unmask_irq(struct irq_data *);
113void icip_handle_irq(struct pt_regs *);
114void ichp_handle_irq(struct pt_regs *);
115
116void pxa_init_irq(int irq_nr, int (*set_wake)(struct irq_data *, unsigned int));
117#endif
118
107#endif /* __ASM_MACH_IRQS_H */ 119#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa25x.h b/arch/arm/mach-pxa/include/mach/pxa25x.h
index 508c3ba1f4d..3ac0baac735 100644
--- a/arch/arm/mach-pxa/include/mach/pxa25x.h
+++ b/arch/arm/mach-pxa/include/mach/pxa25x.h
@@ -4,5 +4,14 @@
4#include <mach/hardware.h> 4#include <mach/hardware.h>
5#include <mach/pxa2xx-regs.h> 5#include <mach/pxa2xx-regs.h>
6#include <mach/mfp-pxa25x.h> 6#include <mach/mfp-pxa25x.h>
7#include <mach/irqs.h>
8
9extern void __init pxa25x_map_io(void);
10extern void __init pxa25x_init_irq(void);
11#ifdef CONFIG_CPU_PXA26x
12extern void __init pxa26x_init_irq(void);
13#endif
14
15#define pxa25x_handle_irq icip_handle_irq
7 16
8#endif /* __MACH_PXA25x_H */ 17#endif /* __MACH_PXA25x_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h
index 0b702693f45..b9b1bdc4bac 100644
--- a/arch/arm/mach-pxa/include/mach/pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/pxa27x.h
@@ -4,6 +4,7 @@
4#include <mach/hardware.h> 4#include <mach/hardware.h>
5#include <mach/pxa2xx-regs.h> 5#include <mach/pxa2xx-regs.h>
6#include <mach/mfp-pxa27x.h> 6#include <mach/mfp-pxa27x.h>
7#include <mach/irqs.h>
7 8
8#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */ 9#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */
9 10
@@ -17,6 +18,10 @@
17#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ 18#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
18#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ 19#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
19 20
21extern void __init pxa27x_map_io(void);
22extern void __init pxa27x_init_irq(void);
20extern int __init pxa27x_set_pwrmode(unsigned int mode); 23extern int __init pxa27x_set_pwrmode(unsigned int mode);
21 24
25#define pxa27x_handle_irq ichp_handle_irq
26
22#endif /* __MACH_PXA27x_H */ 27#endif /* __MACH_PXA27x_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa300.h b/arch/arm/mach-pxa/include/mach/pxa300.h
index 2f33076c9e4..733b6412c3d 100644
--- a/arch/arm/mach-pxa/include/mach/pxa300.h
+++ b/arch/arm/mach-pxa/include/mach/pxa300.h
@@ -1,8 +1,7 @@
1#ifndef __MACH_PXA300_H 1#ifndef __MACH_PXA300_H
2#define __MACH_PXA300_H 2#define __MACH_PXA300_H
3 3
4#include <mach/hardware.h> 4#include <mach/pxa3xx.h>
5#include <mach/pxa3xx-regs.h>
6#include <mach/mfp-pxa300.h> 5#include <mach/mfp-pxa300.h>
7 6
8#endif /* __MACH_PXA300_H */ 7#endif /* __MACH_PXA300_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa320.h b/arch/arm/mach-pxa/include/mach/pxa320.h
index cab78e90327..b6204e470d8 100644
--- a/arch/arm/mach-pxa/include/mach/pxa320.h
+++ b/arch/arm/mach-pxa/include/mach/pxa320.h
@@ -1,8 +1,7 @@
1#ifndef __MACH_PXA320_H 1#ifndef __MACH_PXA320_H
2#define __MACH_PXA320_H 2#define __MACH_PXA320_H
3 3
4#include <mach/hardware.h> 4#include <mach/pxa3xx.h>
5#include <mach/pxa3xx-regs.h>
6#include <mach/mfp-pxa320.h> 5#include <mach/mfp-pxa320.h>
7 6
8#endif /* __MACH_PXA320_H */ 7#endif /* __MACH_PXA320_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx.h b/arch/arm/mach-pxa/include/mach/pxa3xx.h
new file mode 100644
index 00000000000..cd3e57f4268
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx.h
@@ -0,0 +1,14 @@
1#ifndef __MACH_PXA3XX_H
2#define __MACH_PXA3XX_H
3
4#include <mach/hardware.h>
5#include <mach/pxa3xx-regs.h>
6#include <mach/irqs.h>
7
8extern void __init pxa3xx_map_io(void);
9extern void __init pxa3xx_init_irq(void);
10extern void __init pxa95x_init_irq(void);
11
12#define pxa3xx_handle_irq ichp_handle_irq
13
14#endif /* __MACH_PXA3XX_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa930.h b/arch/arm/mach-pxa/include/mach/pxa930.h
index d45f76a9b54..190363b98d0 100644
--- a/arch/arm/mach-pxa/include/mach/pxa930.h
+++ b/arch/arm/mach-pxa/include/mach/pxa930.h
@@ -1,8 +1,7 @@
1#ifndef __MACH_PXA930_H 1#ifndef __MACH_PXA930_H
2#define __MACH_PXA930_H 2#define __MACH_PXA930_H
3 3
4#include <mach/hardware.h> 4#include <mach/pxa3xx.h>
5#include <mach/pxa3xx-regs.h>
6#include <mach/mfp-pxa930.h> 5#include <mach/mfp-pxa930.h>
7 6
8#endif /* __MACH_PXA930_H */ 7#endif /* __MACH_PXA930_H */
diff --git a/arch/arm/mach-pxa/include/mach/regs-intc.h b/arch/arm/mach-pxa/include/mach/regs-intc.h
deleted file mode 100644
index 662288eb6f9..00000000000
--- a/arch/arm/mach-pxa/include/mach/regs-intc.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef __ASM_MACH_REGS_INTC_H
2#define __ASM_MACH_REGS_INTC_H
3
4#include <mach/hardware.h>
5
6/*
7 * Interrupt Controller
8 */
9
10#define ICIP __REG(0x40D00000) /* Interrupt Controller IRQ Pending Register */
11#define ICMR __REG(0x40D00004) /* Interrupt Controller Mask Register */
12#define ICLR __REG(0x40D00008) /* Interrupt Controller Level Register */
13#define ICFP __REG(0x40D0000C) /* Interrupt Controller FIQ Pending Register */
14#define ICPR __REG(0x40D00010) /* Interrupt Controller Pending Register */
15#define ICCR __REG(0x40D00014) /* Interrupt Controller Control Register */
16#define ICHP __REG(0x40D00018) /* Interrupt Controller Highest Priority Register */
17
18#define ICIP2 __REG(0x40D0009C) /* Interrupt Controller IRQ Pending Register 2 */
19#define ICMR2 __REG(0x40D000A0) /* Interrupt Controller Mask Register 2 */
20#define ICLR2 __REG(0x40D000A4) /* Interrupt Controller Level Register 2 */
21#define ICFP2 __REG(0x40D000A8) /* Interrupt Controller FIQ Pending Register 2 */
22#define ICPR2 __REG(0x40D000AC) /* Interrupt Controller Pending Register 2 */
23
24#define ICIP3 __REG(0x40D00130) /* Interrupt Controller IRQ Pending Register 3 */
25#define ICMR3 __REG(0x40D00134) /* Interrupt Controller Mask Register 3 */
26#define ICLR3 __REG(0x40D00138) /* Interrupt Controller Level Register 3 */
27#define ICFP3 __REG(0x40D0013C) /* Interrupt Controller FIQ Pending Register 3 */
28#define ICPR3 __REG(0x40D00140) /* Interrupt Controller Pending Register 3 */
29
30#endif /* __ASM_MACH_REGS_INTC_H */
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 32ed551bf9c..b09e848eb6c 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -37,6 +37,8 @@
37#define IPR(i) (((i) < 32) ? (0x01c + ((i) << 2)) : \ 37#define IPR(i) (((i) < 32) ? (0x01c + ((i) << 2)) : \
38 ((i) < 64) ? (0x0b0 + (((i) - 32) << 2)) : \ 38 ((i) < 64) ? (0x0b0 + (((i) - 32) << 2)) : \
39 (0x144 + (((i) - 64) << 2))) 39 (0x144 + (((i) - 64) << 2)))
40#define ICHP_VAL_IRQ (1 << 31)
41#define ICHP_IRQ(i) (((i) >> 16) & 0x7fff)
40#define IPR_VALID (1 << 31) 42#define IPR_VALID (1 << 31)
41#define IRQ_BIT(n) (((n) - PXA_IRQ(0)) & 0x1f) 43#define IRQ_BIT(n) (((n) - PXA_IRQ(0)) & 0x1f)
42 44
@@ -64,7 +66,7 @@ static inline void __iomem *irq_base(int i)
64 return (void __iomem *)io_p2v(phys_base[i]); 66 return (void __iomem *)io_p2v(phys_base[i]);
65} 67}
66 68
67static void pxa_mask_irq(struct irq_data *d) 69void pxa_mask_irq(struct irq_data *d)
68{ 70{
69 void __iomem *base = irq_data_get_irq_chip_data(d); 71 void __iomem *base = irq_data_get_irq_chip_data(d);
70 uint32_t icmr = __raw_readl(base + ICMR); 72 uint32_t icmr = __raw_readl(base + ICMR);
@@ -73,7 +75,7 @@ static void pxa_mask_irq(struct irq_data *d)
73 __raw_writel(icmr, base + ICMR); 75 __raw_writel(icmr, base + ICMR);
74} 76}
75 77
76static void pxa_unmask_irq(struct irq_data *d) 78void pxa_unmask_irq(struct irq_data *d)
77{ 79{
78 void __iomem *base = irq_data_get_irq_chip_data(d); 80 void __iomem *base = irq_data_get_irq_chip_data(d);
79 uint32_t icmr = __raw_readl(base + ICMR); 81 uint32_t icmr = __raw_readl(base + ICMR);
@@ -127,6 +129,36 @@ static struct irq_chip pxa_low_gpio_chip = {
127 .irq_set_type = pxa_set_low_gpio_type, 129 .irq_set_type = pxa_set_low_gpio_type,
128}; 130};
129 131
132asmlinkage void __exception_irq_entry icip_handle_irq(struct pt_regs *regs)
133{
134 uint32_t icip, icmr, mask;
135
136 do {
137 icip = __raw_readl(IRQ_BASE + ICIP);
138 icmr = __raw_readl(IRQ_BASE + ICMR);
139 mask = icip & icmr;
140
141 if (mask == 0)
142 break;
143
144 handle_IRQ(PXA_IRQ(fls(mask) - 1), regs);
145 } while (1);
146}
147
148asmlinkage void __exception_irq_entry ichp_handle_irq(struct pt_regs *regs)
149{
150 uint32_t ichp;
151
152 do {
153 __asm__ __volatile__("mrc p6, 0, %0, c5, c0, 0\n": "=r"(ichp));
154
155 if ((ichp & ICHP_VAL_IRQ) == 0)
156 break;
157
158 handle_IRQ(PXA_IRQ(ICHP_IRQ(ichp)), regs);
159 } while (1);
160}
161
130static void __init pxa_init_low_gpio_irq(set_wake_t fn) 162static void __init pxa_init_low_gpio_irq(set_wake_t fn)
131{ 163{
132 int irq; 164 int irq;
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index e5e326d2cdc..8f97e15e86e 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -441,6 +441,7 @@ MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleto
441 .map_io = pxa3xx_map_io, 441 .map_io = pxa3xx_map_io,
442 .nr_irqs = LITTLETON_NR_IRQS, 442 .nr_irqs = LITTLETON_NR_IRQS,
443 .init_irq = pxa3xx_init_irq, 443 .init_irq = pxa3xx_init_irq,
444 .handle_irq = pxa3xx_handle_irq,
444 .timer = &pxa_timer, 445 .timer = &pxa_timer,
445 .init_machine = littleton_init, 446 .init_machine = littleton_init,
446MACHINE_END 447MACHINE_END
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index 6cf8180bf5b..c171d6ebee4 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -503,6 +503,7 @@ MACHINE_START(LOGICPD_PXA270, "LogicPD PXA270 Card Engine")
503 .map_io = lpd270_map_io, 503 .map_io = lpd270_map_io,
504 .nr_irqs = LPD270_NR_IRQS, 504 .nr_irqs = LPD270_NR_IRQS,
505 .init_irq = lpd270_init_irq, 505 .init_irq = lpd270_init_irq,
506 .handle_irq = pxa27x_handle_irq,
506 .timer = &pxa_timer, 507 .timer = &pxa_timer,
507 .init_machine = lpd270_init, 508 .init_machine = lpd270_init,
508MACHINE_END 509MACHINE_END
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index e10ddb82714..a8c696bfc13 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -553,6 +553,7 @@ MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
553 .map_io = lubbock_map_io, 553 .map_io = lubbock_map_io,
554 .nr_irqs = LUBBOCK_NR_IRQS, 554 .nr_irqs = LUBBOCK_NR_IRQS,
555 .init_irq = lubbock_init_irq, 555 .init_irq = lubbock_init_irq,
556 .handle_irq = pxa25x_handle_irq,
556 .timer = &pxa_timer, 557 .timer = &pxa_timer,
557 .init_machine = lubbock_init, 558 .init_machine = lubbock_init,
558MACHINE_END 559MACHINE_END
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 0e42798942f..5fe5bcd7c0a 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -757,6 +757,7 @@ MACHINE_START(MAGICIAN, "HTC Magician")
757 .map_io = pxa27x_map_io, 757 .map_io = pxa27x_map_io,
758 .nr_irqs = MAGICIAN_NR_IRQS, 758 .nr_irqs = MAGICIAN_NR_IRQS,
759 .init_irq = pxa27x_init_irq, 759 .init_irq = pxa27x_init_irq,
760 .handle_irq = pxa27x_handle_irq,
760 .init_machine = magician_init, 761 .init_machine = magician_init,
761 .timer = &pxa_timer, 762 .timer = &pxa_timer,
762MACHINE_END 763MACHINE_END
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 3479e2b3b51..4622eb78ef2 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -620,6 +620,7 @@ MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
620 .map_io = mainstone_map_io, 620 .map_io = mainstone_map_io,
621 .nr_irqs = MAINSTONE_NR_IRQS, 621 .nr_irqs = MAINSTONE_NR_IRQS,
622 .init_irq = mainstone_init_irq, 622 .init_irq = mainstone_init_irq,
623 .handle_irq = pxa27x_handle_irq,
623 .timer = &pxa_timer, 624 .timer = &pxa_timer,
624 .init_machine = mainstone_init, 625 .init_machine = mainstone_init,
625MACHINE_END 626MACHINE_END
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index aa67637ae41..64810f908e5 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -754,6 +754,7 @@ MACHINE_START(MIOA701, "MIO A701")
754 .boot_params = 0xa0000100, 754 .boot_params = 0xa0000100,
755 .map_io = &pxa27x_map_io, 755 .map_io = &pxa27x_map_io,
756 .init_irq = &pxa27x_init_irq, 756 .init_irq = &pxa27x_init_irq,
757 .handle_irq = &pxa27x_handle_irq,
757 .init_machine = mioa701_machine_init, 758 .init_machine = mioa701_machine_init,
758 .timer = &pxa_timer, 759 .timer = &pxa_timer,
759MACHINE_END 760MACHINE_END
diff --git a/arch/arm/mach-pxa/mp900.c b/arch/arm/mach-pxa/mp900.c
index 59cce78aebd..fb408861dbc 100644
--- a/arch/arm/mach-pxa/mp900.c
+++ b/arch/arm/mach-pxa/mp900.c
@@ -96,6 +96,7 @@ MACHINE_START(NEC_MP900, "MobilePro900/C")
96 .timer = &pxa_timer, 96 .timer = &pxa_timer,
97 .map_io = pxa25x_map_io, 97 .map_io = pxa25x_map_io,
98 .init_irq = pxa25x_init_irq, 98 .init_irq = pxa25x_init_irq,
99 .handle_irq = pxa25x_handle_irq,
99 .init_machine = mp900c_init, 100 .init_machine = mp900c_init,
100MACHINE_END 101MACHINE_END
101 102
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 4061ecddee7..6b77365ed93 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -345,6 +345,7 @@ MACHINE_START(PALMLD, "Palm LifeDrive")
345 .boot_params = 0xa0000100, 345 .boot_params = 0xa0000100,
346 .map_io = palmld_map_io, 346 .map_io = palmld_map_io,
347 .init_irq = pxa27x_init_irq, 347 .init_irq = pxa27x_init_irq,
348 .handle_irq = pxa27x_handle_irq,
348 .timer = &pxa_timer, 349 .timer = &pxa_timer,
349 .init_machine = palmld_init 350 .init_machine = palmld_init
350MACHINE_END 351MACHINE_END
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index df4d7d009fb..9bd3e47486f 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -206,6 +206,7 @@ MACHINE_START(PALMT5, "Palm Tungsten|T5")
206 .map_io = pxa27x_map_io, 206 .map_io = pxa27x_map_io,
207 .reserve = palmt5_reserve, 207 .reserve = palmt5_reserve,
208 .init_irq = pxa27x_init_irq, 208 .init_irq = pxa27x_init_irq,
209 .handle_irq = pxa27x_handle_irq,
209 .timer = &pxa_timer, 210 .timer = &pxa_timer,
210 .init_machine = palmt5_init 211 .init_machine = palmt5_init
211MACHINE_END 212MACHINE_END
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c
index fb06bd04727..6ad4a6c7bc9 100644
--- a/arch/arm/mach-pxa/palmtc.c
+++ b/arch/arm/mach-pxa/palmtc.c
@@ -31,14 +31,13 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <mach/pxa25x.h>
34#include <mach/audio.h> 35#include <mach/audio.h>
35#include <mach/palmtc.h> 36#include <mach/palmtc.h>
36#include <mach/mmc.h> 37#include <mach/mmc.h>
37#include <mach/pxafb.h> 38#include <mach/pxafb.h>
38#include <mach/mfp-pxa25x.h>
39#include <mach/irda.h> 39#include <mach/irda.h>
40#include <mach/udc.h> 40#include <mach/udc.h>
41#include <mach/pxa2xx-regs.h>
42 41
43#include "generic.h" 42#include "generic.h"
44#include "devices.h" 43#include "devices.h"
@@ -541,6 +540,7 @@ MACHINE_START(PALMTC, "Palm Tungsten|C")
541 .boot_params = 0xa0000100, 540 .boot_params = 0xa0000100,
542 .map_io = pxa25x_map_io, 541 .map_io = pxa25x_map_io,
543 .init_irq = pxa25x_init_irq, 542 .init_irq = pxa25x_init_irq,
543 .handle_irq = pxa25x_handle_irq,
544 .timer = &pxa_timer, 544 .timer = &pxa_timer,
545 .init_machine = palmtc_init 545 .init_machine = palmtc_init
546MACHINE_END 546MACHINE_END
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c
index 726f5b98dcd..664232f3e62 100644
--- a/arch/arm/mach-pxa/palmte2.c
+++ b/arch/arm/mach-pxa/palmte2.c
@@ -31,11 +31,11 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <mach/pxa25x.h>
34#include <mach/audio.h> 35#include <mach/audio.h>
35#include <mach/palmte2.h> 36#include <mach/palmte2.h>
36#include <mach/mmc.h> 37#include <mach/mmc.h>
37#include <mach/pxafb.h> 38#include <mach/pxafb.h>
38#include <mach/mfp-pxa25x.h>
39#include <mach/irda.h> 39#include <mach/irda.h>
40#include <mach/udc.h> 40#include <mach/udc.h>
41#include <mach/palmasoc.h> 41#include <mach/palmasoc.h>
@@ -359,6 +359,7 @@ MACHINE_START(PALMTE2, "Palm Tungsten|E2")
359 .boot_params = 0xa0000100, 359 .boot_params = 0xa0000100,
360 .map_io = pxa25x_map_io, 360 .map_io = pxa25x_map_io,
361 .init_irq = pxa25x_init_irq, 361 .init_irq = pxa25x_init_irq,
362 .handle_irq = pxa25x_handle_irq,
362 .timer = &pxa_timer, 363 .timer = &pxa_timer,
363 .init_machine = palmte2_init 364 .init_machine = palmte2_init
364MACHINE_END 365MACHINE_END
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index 20d1b18b173..bb27d4b688d 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -444,6 +444,7 @@ MACHINE_START(TREO680, "Palm Treo 680")
444 .map_io = pxa27x_map_io, 444 .map_io = pxa27x_map_io,
445 .reserve = treo_reserve, 445 .reserve = treo_reserve,
446 .init_irq = pxa27x_init_irq, 446 .init_irq = pxa27x_init_irq,
447 .handle_irq = pxa27x_handle_irq,
447 .timer = &pxa_timer, 448 .timer = &pxa_timer,
448 .init_machine = treo680_init, 449 .init_machine = treo680_init,
449MACHINE_END 450MACHINE_END
@@ -453,6 +454,7 @@ MACHINE_START(CENTRO, "Palm Centro 685")
453 .map_io = pxa27x_map_io, 454 .map_io = pxa27x_map_io,
454 .reserve = treo_reserve, 455 .reserve = treo_reserve,
455 .init_irq = pxa27x_init_irq, 456 .init_irq = pxa27x_init_irq,
457 .handle_irq = pxa27x_handle_irq,
456 .timer = &pxa_timer, 458 .timer = &pxa_timer,
457 .init_machine = centro_init, 459 .init_machine = centro_init,
458MACHINE_END 460MACHINE_END
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 595f002066c..fc4285589c1 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -367,6 +367,7 @@ MACHINE_START(PALMTX, "Palm T|X")
367 .boot_params = 0xa0000100, 367 .boot_params = 0xa0000100,
368 .map_io = palmtx_map_io, 368 .map_io = palmtx_map_io,
369 .init_irq = pxa27x_init_irq, 369 .init_irq = pxa27x_init_irq,
370 .handle_irq = pxa27x_handle_irq,
370 .timer = &pxa_timer, 371 .timer = &pxa_timer,
371 .init_machine = palmtx_init 372 .init_machine = palmtx_init
372MACHINE_END 373MACHINE_END
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 5a5329bc33f..e61c1cc0551 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -402,6 +402,7 @@ MACHINE_START(PALMZ72, "Palm Zire72")
402 .boot_params = 0xa0000100, 402 .boot_params = 0xa0000100,
403 .map_io = pxa27x_map_io, 403 .map_io = pxa27x_map_io,
404 .init_irq = pxa27x_init_irq, 404 .init_irq = pxa27x_init_irq,
405 .handle_irq = pxa27x_handle_irq,
405 .timer = &pxa_timer, 406 .timer = &pxa_timer,
406 .init_machine = palmz72_init 407 .init_machine = palmz72_init
407MACHINE_END 408MACHINE_END
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c
index 1fc8a66407a..ffa65dfb8c6 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 .map_io = pcm027_map_io, 262 .map_io = pcm027_map_io,
263 .nr_irqs = PCM027_NR_IRQS, 263 .nr_irqs = PCM027_NR_IRQS,
264 .init_irq = pxa27x_init_irq, 264 .init_irq = pxa27x_init_irq,
265 .handle_irq = pxa27x_handle_irq,
265 .timer = &pxa_timer, 266 .timer = &pxa_timer,
266 .init_machine = pcm027_init, 267 .init_machine = pcm027_init,
267MACHINE_END 268MACHINE_END
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 16d14fd79b4..a113ea9ab4a 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -468,6 +468,7 @@ MACHINE_START(POODLE, "SHARP Poodle")
468 .map_io = pxa25x_map_io, 468 .map_io = pxa25x_map_io,
469 .nr_irqs = POODLE_NR_IRQS, /* 4 for LoCoMo */ 469 .nr_irqs = POODLE_NR_IRQS, /* 4 for LoCoMo */
470 .init_irq = pxa25x_init_irq, 470 .init_irq = pxa25x_init_irq,
471 .handle_irq = pxa25x_handle_irq,
471 .timer = &pxa_timer, 472 .timer = &pxa_timer,
472 .init_machine = poodle_init, 473 .init_machine = poodle_init,
473MACHINE_END 474MACHINE_END
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index ef1c56a67af..b5cd9e5aba3 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -32,7 +32,6 @@
32#include <mach/ohci.h> 32#include <mach/ohci.h>
33#include <mach/pm.h> 33#include <mach/pm.h>
34#include <mach/dma.h> 34#include <mach/dma.h>
35#include <mach/regs-intc.h>
36#include <mach/smemc.h> 35#include <mach/smemc.h>
37 36
38#include "generic.h" 37#include "generic.h"
@@ -338,13 +337,13 @@ static void pxa_ack_ext_wakeup(struct irq_data *d)
338 337
339static void pxa_mask_ext_wakeup(struct irq_data *d) 338static void pxa_mask_ext_wakeup(struct irq_data *d)
340{ 339{
341 ICMR2 &= ~(1 << ((d->irq - PXA_IRQ(0)) & 0x1f)); 340 pxa_mask_irq(d);
342 PECR &= ~PECR_IE(d->irq - IRQ_WAKEUP0); 341 PECR &= ~PECR_IE(d->irq - IRQ_WAKEUP0);
343} 342}
344 343
345static void pxa_unmask_ext_wakeup(struct irq_data *d) 344static void pxa_unmask_ext_wakeup(struct irq_data *d)
346{ 345{
347 ICMR2 |= 1 << ((d->irq - PXA_IRQ(0)) & 0x1f); 346 pxa_unmask_irq(d);
348 PECR |= PECR_IE(d->irq - IRQ_WAKEUP0); 347 PECR |= PECR_IE(d->irq - IRQ_WAKEUP0);
349} 348}
350 349
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c
index ecc82a330fa..0ee166b61f8 100644
--- a/arch/arm/mach-pxa/pxa95x.c
+++ b/arch/arm/mach-pxa/pxa95x.c
@@ -27,7 +27,6 @@
27#include <mach/reset.h> 27#include <mach/reset.h>
28#include <mach/pm.h> 28#include <mach/pm.h>
29#include <mach/dma.h> 29#include <mach/dma.h>
30#include <mach/regs-intc.h>
31 30
32#include "generic.h" 31#include "generic.h"
33#include "devices.h" 32#include "devices.h"
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index 2f37d43f51b..bbcd90562eb 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -46,10 +46,7 @@
46#include <asm/mach-types.h> 46#include <asm/mach-types.h>
47#include <asm/mach/arch.h> 47#include <asm/mach/arch.h>
48 48
49#include <mach/hardware.h> 49#include <mach/pxa300.h>
50#include <mach/pxa3xx-regs.h>
51#include <mach/mfp-pxa3xx.h>
52#include <mach/mfp-pxa300.h>
53#include <mach/ohci.h> 50#include <mach/ohci.h>
54#include <mach/pxafb.h> 51#include <mach/pxafb.h>
55#include <mach/mmc.h> 52#include <mach/mmc.h>
@@ -1093,6 +1090,7 @@ MACHINE_START(RAUMFELD_RC, "Raumfeld Controller")
1093 .init_machine = raumfeld_controller_init, 1090 .init_machine = raumfeld_controller_init,
1094 .map_io = pxa3xx_map_io, 1091 .map_io = pxa3xx_map_io,
1095 .init_irq = pxa3xx_init_irq, 1092 .init_irq = pxa3xx_init_irq,
1093 .handle_irq = pxa3xx_handle_irq,
1096 .timer = &pxa_timer, 1094 .timer = &pxa_timer,
1097MACHINE_END 1095MACHINE_END
1098#endif 1096#endif
@@ -1103,6 +1101,7 @@ MACHINE_START(RAUMFELD_CONNECTOR, "Raumfeld Connector")
1103 .init_machine = raumfeld_connector_init, 1101 .init_machine = raumfeld_connector_init,
1104 .map_io = pxa3xx_map_io, 1102 .map_io = pxa3xx_map_io,
1105 .init_irq = pxa3xx_init_irq, 1103 .init_irq = pxa3xx_init_irq,
1104 .handle_irq = pxa3xx_handle_irq,
1106 .timer = &pxa_timer, 1105 .timer = &pxa_timer,
1107MACHINE_END 1106MACHINE_END
1108#endif 1107#endif
@@ -1113,6 +1112,7 @@ MACHINE_START(RAUMFELD_SPEAKER, "Raumfeld Speaker")
1113 .init_machine = raumfeld_speaker_init, 1112 .init_machine = raumfeld_speaker_init,
1114 .map_io = pxa3xx_map_io, 1113 .map_io = pxa3xx_map_io,
1115 .init_irq = pxa3xx_init_irq, 1114 .init_irq = pxa3xx_init_irq,
1115 .handle_irq = pxa3xx_handle_irq,
1116 .timer = &pxa_timer, 1116 .timer = &pxa_timer,
1117MACHINE_END 1117MACHINE_END
1118#endif 1118#endif
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index fee97a93512..df4356e8aca 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -599,6 +599,7 @@ MACHINE_START(SAAR, "PXA930 Handheld Platform (aka SAAR)")
599 .boot_params = 0xa0000100, 599 .boot_params = 0xa0000100,
600 .map_io = pxa3xx_map_io, 600 .map_io = pxa3xx_map_io,
601 .init_irq = pxa3xx_init_irq, 601 .init_irq = pxa3xx_init_irq,
602 .handle_irq = pxa3xx_handle_irq,
602 .timer = &pxa_timer, 603 .timer = &pxa_timer,
603 .init_machine = saar_init, 604 .init_machine = saar_init,
604MACHINE_END 605MACHINE_END
diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
index e53a3334c94..ebd6379c496 100644
--- a/arch/arm/mach-pxa/saarb.c
+++ b/arch/arm/mach-pxa/saarb.c
@@ -107,6 +107,7 @@ MACHINE_START(SAARB, "PXA955 Handheld Platform (aka SAARB)")
107 .map_io = pxa3xx_map_io, 107 .map_io = pxa3xx_map_io,
108 .nr_irqs = SAARB_NR_IRQS, 108 .nr_irqs = SAARB_NR_IRQS,
109 .init_irq = pxa95x_init_irq, 109 .init_irq = pxa95x_init_irq,
110 .handle_irq = pxa3xx_handle_irq,
110 .timer = &pxa_timer, 111 .timer = &pxa_timer,
111 .init_machine = saarb_init, 112 .init_machine = saarb_init,
112MACHINE_END 113MACHINE_END
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 01c576963e9..438c7b5e451 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -984,6 +984,7 @@ MACHINE_START(SPITZ, "SHARP Spitz")
984 .fixup = spitz_fixup, 984 .fixup = spitz_fixup,
985 .map_io = pxa27x_map_io, 985 .map_io = pxa27x_map_io,
986 .init_irq = pxa27x_init_irq, 986 .init_irq = pxa27x_init_irq,
987 .handle_irq = pxa27x_handle_irq,
987 .init_machine = spitz_init, 988 .init_machine = spitz_init,
988 .timer = &pxa_timer, 989 .timer = &pxa_timer,
989MACHINE_END 990MACHINE_END
@@ -994,6 +995,7 @@ MACHINE_START(BORZOI, "SHARP Borzoi")
994 .fixup = spitz_fixup, 995 .fixup = spitz_fixup,
995 .map_io = pxa27x_map_io, 996 .map_io = pxa27x_map_io,
996 .init_irq = pxa27x_init_irq, 997 .init_irq = pxa27x_init_irq,
998 .handle_irq = pxa27x_handle_irq,
997 .init_machine = spitz_init, 999 .init_machine = spitz_init,
998 .timer = &pxa_timer, 1000 .timer = &pxa_timer,
999MACHINE_END 1001MACHINE_END
@@ -1004,6 +1006,7 @@ MACHINE_START(AKITA, "SHARP Akita")
1004 .fixup = spitz_fixup, 1006 .fixup = spitz_fixup,
1005 .map_io = pxa27x_map_io, 1007 .map_io = pxa27x_map_io,
1006 .init_irq = pxa27x_init_irq, 1008 .init_irq = pxa27x_init_irq,
1009 .handle_irq = pxa27x_handle_irq,
1007 .init_machine = spitz_init, 1010 .init_machine = spitz_init,
1008 .timer = &pxa_timer, 1011 .timer = &pxa_timer,
1009MACHINE_END 1012MACHINE_END
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index cb5611daf5f..3f8d0af9e2f 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -1001,6 +1001,7 @@ static void __init stargate2_init(void)
1001MACHINE_START(INTELMOTE2, "IMOTE 2") 1001MACHINE_START(INTELMOTE2, "IMOTE 2")
1002 .map_io = pxa27x_map_io, 1002 .map_io = pxa27x_map_io,
1003 .init_irq = pxa27x_init_irq, 1003 .init_irq = pxa27x_init_irq,
1004 .handle_irq = pxa27x_handle_irq,
1004 .timer = &pxa_timer, 1005 .timer = &pxa_timer,
1005 .init_machine = imote2_init, 1006 .init_machine = imote2_init,
1006 .boot_params = 0xA0000100, 1007 .boot_params = 0xA0000100,
@@ -1012,6 +1013,7 @@ MACHINE_START(STARGATE2, "Stargate 2")
1012 .map_io = pxa27x_map_io, 1013 .map_io = pxa27x_map_io,
1013 .nr_irqs = STARGATE_NR_IRQS, 1014 .nr_irqs = STARGATE_NR_IRQS,
1014 .init_irq = pxa27x_init_irq, 1015 .init_irq = pxa27x_init_irq,
1016 .handle_irq = pxa27x_handle_irq,
1015 .timer = &pxa_timer, 1017 .timer = &pxa_timer,
1016 .init_machine = stargate2_init, 1018 .init_machine = stargate2_init,
1017 .boot_params = 0xA0000100, 1019 .boot_params = 0xA0000100,
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index 53d4a472b69..32fb58e01b1 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -492,6 +492,7 @@ MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)")
492 .boot_params = 0xa0000100, 492 .boot_params = 0xa0000100,
493 .map_io = pxa3xx_map_io, 493 .map_io = pxa3xx_map_io,
494 .init_irq = pxa3xx_init_irq, 494 .init_irq = pxa3xx_init_irq,
495 .handle_irq = pxa3xx_handle_irq,
495 .timer = &pxa_timer, 496 .timer = &pxa_timer,
496 .init_machine = tavorevb_init, 497 .init_machine = tavorevb_init,
497MACHINE_END 498MACHINE_END
diff --git a/arch/arm/mach-pxa/tavorevb3.c b/arch/arm/mach-pxa/tavorevb3.c
index 79f4422f12f..fd5a8eae0a8 100644
--- a/arch/arm/mach-pxa/tavorevb3.c
+++ b/arch/arm/mach-pxa/tavorevb3.c
@@ -129,6 +129,7 @@ MACHINE_START(TAVOREVB3, "PXA950 Evaluation Board (aka TavorEVB3)")
129 .map_io = pxa3xx_map_io, 129 .map_io = pxa3xx_map_io,
130 .nr_irqs = TAVOREVB3_NR_IRQS, 130 .nr_irqs = TAVOREVB3_NR_IRQS,
131 .init_irq = pxa3xx_init_irq, 131 .init_irq = pxa3xx_init_irq,
132 .handle_irq = pxa3xx_handle_irq,
132 .timer = &pxa_timer, 133 .timer = &pxa_timer,
133 .init_machine = evb3_init, 134 .init_machine = evb3_init,
134MACHINE_END 135MACHINE_END
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 5fa145778e7..9f69a268269 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -974,6 +974,7 @@ MACHINE_START(TOSA, "SHARP Tosa")
974 .map_io = pxa25x_map_io, 974 .map_io = pxa25x_map_io,
975 .nr_irqs = TOSA_NR_IRQS, 975 .nr_irqs = TOSA_NR_IRQS,
976 .init_irq = pxa25x_init_irq, 976 .init_irq = pxa25x_init_irq,
977 .handle_irq = pxa25x_handle_irq,
977 .init_machine = tosa_init, 978 .init_machine = tosa_init,
978 .timer = &pxa_timer, 979 .timer = &pxa_timer,
979MACHINE_END 980MACHINE_END
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 687417a9369..c0417508f39 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -558,6 +558,7 @@ MACHINE_START(TRIZEPS4, "Keith und Koep Trizeps IV module")
558 .init_machine = trizeps4_init, 558 .init_machine = trizeps4_init,
559 .map_io = trizeps4_map_io, 559 .map_io = trizeps4_map_io,
560 .init_irq = pxa27x_init_irq, 560 .init_irq = pxa27x_init_irq,
561 .handle_irq = pxa27x_handle_irq,
561 .timer = &pxa_timer, 562 .timer = &pxa_timer,
562MACHINE_END 563MACHINE_END
563 564
@@ -567,5 +568,6 @@ MACHINE_START(TRIZEPS4WL, "Keith und Koep Trizeps IV-WL module")
567 .init_machine = trizeps4_init, 568 .init_machine = trizeps4_init,
568 .map_io = trizeps4_map_io, 569 .map_io = trizeps4_map_io,
569 .init_irq = pxa27x_init_irq, 570 .init_irq = pxa27x_init_irq,
571 .handle_irq = pxa27x_handle_irq,
570 .timer = &pxa_timer, 572 .timer = &pxa_timer,
571MACHINE_END 573MACHINE_END
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 903218eab56..d4a3dc74e84 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -995,6 +995,7 @@ MACHINE_START(VIPER, "Arcom/Eurotech VIPER SBC")
995 .boot_params = 0xa0000100, 995 .boot_params = 0xa0000100,
996 .map_io = viper_map_io, 996 .map_io = viper_map_io,
997 .init_irq = viper_init_irq, 997 .init_irq = viper_init_irq,
998 .handle_irq = pxa25x_handle_irq,
998 .timer = &pxa_timer, 999 .timer = &pxa_timer,
999 .init_machine = viper_init, 1000 .init_machine = viper_init,
1000MACHINE_END 1001MACHINE_END
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c
index 67bd41488bf..5f8490ab07c 100644
--- a/arch/arm/mach-pxa/vpac270.c
+++ b/arch/arm/mach-pxa/vpac270.c
@@ -719,6 +719,7 @@ MACHINE_START(VPAC270, "Voipac PXA270")
719 .boot_params = 0xa0000100, 719 .boot_params = 0xa0000100,
720 .map_io = pxa27x_map_io, 720 .map_io = pxa27x_map_io,
721 .init_irq = pxa27x_init_irq, 721 .init_irq = pxa27x_init_irq,
722 .handle_irq = pxa27x_handle_irq,
722 .timer = &pxa_timer, 723 .timer = &pxa_timer,
723 .init_machine = vpac270_init 724 .init_machine = vpac270_init
724MACHINE_END 725MACHINE_END
diff --git a/arch/arm/mach-pxa/xcep.c b/arch/arm/mach-pxa/xcep.c
index f55f8f2e0db..acc600f5e72 100644
--- a/arch/arm/mach-pxa/xcep.c
+++ b/arch/arm/mach-pxa/xcep.c
@@ -28,8 +28,7 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/pxa2xx-regs.h> 31#include <mach/pxa25x.h>
32#include <mach/mfp-pxa25x.h>
33#include <mach/smemc.h> 32#include <mach/smemc.h>
34 33
35#include "generic.h" 34#include "generic.h"
@@ -185,6 +184,7 @@ MACHINE_START(XCEP, "Iskratel XCEP")
185 .init_machine = xcep_init, 184 .init_machine = xcep_init,
186 .map_io = pxa25x_map_io, 185 .map_io = pxa25x_map_io,
187 .init_irq = pxa25x_init_irq, 186 .init_irq = pxa25x_init_irq,
187 .handle_irq = pxa25x_handle_irq,
188 .timer = &pxa_timer, 188 .timer = &pxa_timer,
189MACHINE_END 189MACHINE_END
190 190
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index fbe9e02e2f9..6c9275a20c9 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -40,6 +40,7 @@
40#include <mach/pxafb.h> 40#include <mach/pxafb.h>
41#include <mach/mmc.h> 41#include <mach/mmc.h>
42#include <plat/pxa27x_keypad.h> 42#include <plat/pxa27x_keypad.h>
43#include <mach/pm.h>
43 44
44#include "generic.h" 45#include "generic.h"
45#include "devices.h" 46#include "devices.h"
@@ -677,6 +678,20 @@ static void __init z2_pmic_init(void)
677static inline void z2_pmic_init(void) {} 678static inline void z2_pmic_init(void) {}
678#endif 679#endif
679 680
681#ifdef CONFIG_PM
682static void z2_power_off(void)
683{
684 /* We're using deep sleep as poweroff, so clear PSPR to ensure that
685 * bootloader will jump to its entry point in resume handler
686 */
687 PSPR = 0x0;
688 local_irq_disable();
689 pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP, PLAT_PHYS_OFFSET - PAGE_OFFSET);
690}
691#else
692#define z2_power_off NULL
693#endif
694
680/****************************************************************************** 695/******************************************************************************
681 * Machine init 696 * Machine init
682 ******************************************************************************/ 697 ******************************************************************************/
@@ -698,12 +713,15 @@ static void __init z2_init(void)
698 z2_leds_init(); 713 z2_leds_init();
699 z2_keys_init(); 714 z2_keys_init();
700 z2_pmic_init(); 715 z2_pmic_init();
716
717 pm_power_off = z2_power_off;
701} 718}
702 719
703MACHINE_START(ZIPIT2, "Zipit Z2") 720MACHINE_START(ZIPIT2, "Zipit Z2")
704 .boot_params = 0xa0000100, 721 .boot_params = 0xa0000100,
705 .map_io = pxa27x_map_io, 722 .map_io = pxa27x_map_io,
706 .init_irq = pxa27x_init_irq, 723 .init_irq = pxa27x_init_irq,
724 .handle_irq = pxa27x_handle_irq,
707 .timer = &pxa_timer, 725 .timer = &pxa_timer,
708 .init_machine = z2_init, 726 .init_machine = z2_init,
709MACHINE_END 727MACHINE_END
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index 9b99cc164de..99c49bcd9f7 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -35,14 +35,13 @@
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37 37
38#include <mach/pxa2xx-regs.h> 38#include <mach/pxa27x.h>
39#include <mach/regs-uart.h> 39#include <mach/regs-uart.h>
40#include <mach/ohci.h> 40#include <mach/ohci.h>
41#include <mach/mmc.h> 41#include <mach/mmc.h>
42#include <mach/pxa27x-udc.h> 42#include <mach/pxa27x-udc.h>
43#include <mach/udc.h> 43#include <mach/udc.h>
44#include <mach/pxafb.h> 44#include <mach/pxafb.h>
45#include <mach/mfp-pxa27x.h>
46#include <mach/pm.h> 45#include <mach/pm.h>
47#include <mach/audio.h> 46#include <mach/audio.h>
48#include <mach/arcom-pcmcia.h> 47#include <mach/arcom-pcmcia.h>
@@ -909,6 +908,7 @@ MACHINE_START(ARCOM_ZEUS, "Arcom/Eurotech ZEUS")
909 .map_io = zeus_map_io, 908 .map_io = zeus_map_io,
910 .nr_irqs = ZEUS_NR_IRQS, 909 .nr_irqs = ZEUS_NR_IRQS,
911 .init_irq = zeus_init_irq, 910 .init_irq = zeus_init_irq,
911 .handle_irq = pxa27x_handle_irq,
912 .timer = &pxa_timer, 912 .timer = &pxa_timer,
913 .init_machine = zeus_init, 913 .init_machine = zeus_init,
914MACHINE_END 914MACHINE_END
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 5821185f77a..15ec66b3471 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -24,7 +24,7 @@
24 24
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include <mach/hardware.h> 27#include <mach/pxa3xx.h>
28#include <mach/audio.h> 28#include <mach/audio.h>
29#include <mach/pxafb.h> 29#include <mach/pxafb.h>
30#include <mach/zylonite.h> 30#include <mach/zylonite.h>
@@ -426,6 +426,7 @@ MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
426 .map_io = pxa3xx_map_io, 426 .map_io = pxa3xx_map_io,
427 .nr_irqs = ZYLONITE_NR_IRQS, 427 .nr_irqs = ZYLONITE_NR_IRQS,
428 .init_irq = pxa3xx_init_irq, 428 .init_irq = pxa3xx_init_irq,
429 .handle_irq = pxa3xx_handle_irq,
429 .timer = &pxa_timer, 430 .timer = &pxa_timer,
430 .init_machine = zylonite_init, 431 .init_machine = zylonite_init,
431MACHINE_END 432MACHINE_END
diff --git a/arch/arm/mach-realview/include/mach/system.h b/arch/arm/mach-realview/include/mach/system.h
index a30f2e3ec17..6657ff23116 100644
--- a/arch/arm/mach-realview/include/mach/system.h
+++ b/arch/arm/mach-realview/include/mach/system.h
@@ -44,6 +44,7 @@ static inline void arch_reset(char mode, const char *cmd)
44 */ 44 */
45 if (realview_reset) 45 if (realview_reset)
46 realview_reset(mode); 46 realview_reset(mode);
47 dsb();
47} 48}
48 49
49#endif 50#endif
diff --git a/arch/arm/mach-s3c2410/include/mach/pm-core.h b/arch/arm/mach-s3c2410/include/mach/pm-core.h
index 70a83b209e2..45eea5210c8 100644
--- a/arch/arm/mach-s3c2410/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c2410/include/mach/pm-core.h
@@ -62,3 +62,6 @@ static inline void s3c_pm_arch_update_uart(void __iomem *regs,
62 struct pm_uart_save *save) 62 struct pm_uart_save *save)
63{ 63{
64} 64}
65
66static inline void s3c_pm_restored_gpios(void) { }
67static inline void s3c_pm_saved_gpios(void) { }
diff --git a/arch/arm/mach-s3c2440/clock.c b/arch/arm/mach-s3c2440/clock.c
index 554e0d3ec70..f9e6bdaf41d 100644
--- a/arch/arm/mach-s3c2440/clock.c
+++ b/arch/arm/mach-s3c2440/clock.c
@@ -36,7 +36,7 @@
36#include <linux/io.h> 36#include <linux/io.h>
37 37
38#include <mach/hardware.h> 38#include <mach/hardware.h>
39#include <asm/atomic.h> 39#include <linux/atomic.h>
40#include <asm/irq.h> 40#include <asm/irq.h>
41 41
42#include <mach/regs-clock.h> 42#include <mach/regs-clock.h>
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c
index 6224bad4d60..9ad99f8016a 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c2440/s3c2442.c
@@ -38,7 +38,7 @@
38#include <linux/io.h> 38#include <linux/io.h>
39 39
40#include <mach/hardware.h> 40#include <mach/hardware.h>
41#include <asm/atomic.h> 41#include <linux/atomic.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43 43
44#include <mach/regs-clock.h> 44#include <mach/regs-clock.h>
diff --git a/arch/arm/mach-s3c2440/s3c244x-clock.c b/arch/arm/mach-s3c2440/s3c244x-clock.c
index f8d96130d1d..7f5ea0a169a 100644
--- a/arch/arm/mach-s3c2440/s3c244x-clock.c
+++ b/arch/arm/mach-s3c2440/s3c244x-clock.c
@@ -35,7 +35,7 @@
35#include <linux/io.h> 35#include <linux/io.h>
36 36
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <asm/atomic.h> 38#include <linux/atomic.h>
39#include <asm/irq.h> 39#include <asm/irq.h>
40 40
41#include <mach/regs-clock.h> 41#include <mach/regs-clock.h>
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index fdc89fc3b46..f057b6ae4f9 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -267,3 +267,26 @@ config MACH_SMARTQ7
267 select MACH_SMARTQ 267 select MACH_SMARTQ
268 help 268 help
269 Machine support for the SmartQ 7 269 Machine support for the SmartQ 7
270
271config MACH_WLF_CRAGG_6410
272 bool "Wolfson Cragganmore 6410"
273 select CPU_S3C6410
274 select S3C64XX_SETUP_SDHCI
275 select S3C64XX_SETUP_I2C1
276 select S3C64XX_SETUP_IDE
277 select S3C64XX_SETUP_FB_24BPP
278 select S3C64XX_SETUP_KEYPAD
279 select SAMSUNG_DEV_ADC
280 select SAMSUNG_DEV_KEYPAD
281 select S3C_DEV_USB_HOST
282 select S3C_DEV_USB_HSOTG
283 select S3C_DEV_HSMMC
284 select S3C_DEV_HSMMC1
285 select S3C_DEV_HSMMC2
286 select S3C_DEV_I2C1
287 select S3C_DEV_WDT
288 select S3C_DEV_RTC
289 select S3C64XX_DEV_SPI
290 select S3C24XX_GPIO_EXTRA128
291 help
292 Machine support for the Wolfson Cragganmore S3C6410 variant.
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index f5a7144a052..61b4034a0c2 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_MACH_HMT) += mach-hmt.o
55obj-$(CONFIG_MACH_SMARTQ) += mach-smartq.o 55obj-$(CONFIG_MACH_SMARTQ) += mach-smartq.o
56obj-$(CONFIG_MACH_SMARTQ5) += mach-smartq5.o 56obj-$(CONFIG_MACH_SMARTQ5) += mach-smartq5.o
57obj-$(CONFIG_MACH_SMARTQ7) += mach-smartq7.o 57obj-$(CONFIG_MACH_SMARTQ7) += mach-smartq7.o
58obj-$(CONFIG_MACH_WLF_CRAGG_6410) += mach-crag6410.o
58 59
59# device support 60# device support
60 61
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index 8e2df26cf14..c026f67a80d 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -198,7 +198,9 @@
198 * interrupt controllers). */ 198 * interrupt controllers). */
199#define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1) 199#define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
200 200
201#ifdef CONFIG_SMDK6410_WM1190_EV1 201#ifdef CONFIG_MACH_WLF_CRAGG_6410
202#define IRQ_BOARD_NR 128
203#elif defined(CONFIG_SMDK6410_WM1190_EV1)
202#define IRQ_BOARD_NR 64 204#define IRQ_BOARD_NR 64
203#elif defined(CONFIG_SMDK6410_WM1192_EV1) 205#elif defined(CONFIG_SMDK6410_WM1192_EV1)
204#define IRQ_BOARD_NR 64 206#define IRQ_BOARD_NR 64
@@ -215,6 +217,7 @@
215/* Compatibility */ 217/* Compatibility */
216 218
217#define IRQ_ONENAND IRQ_ONENAND0 219#define IRQ_ONENAND IRQ_ONENAND0
220#define IRQ_I2S0 IRQ_S3C6410_IIS
218 221
219#endif /* __ASM_MACH_S3C64XX_IRQS_H */ 222#endif /* __ASM_MACH_S3C64XX_IRQS_H */
220 223
diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
index 1e9f20f0bb7..38659bebe4b 100644
--- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
@@ -53,7 +53,7 @@ static inline void s3c_pm_arch_show_resume_irqs(void)
53 * the IRQ wake controls depending on the CPU we are running on */ 53 * the IRQ wake controls depending on the CPU we are running on */
54 54
55#define s3c_irqwake_eintallow ((1 << 28) - 1) 55#define s3c_irqwake_eintallow ((1 << 28) - 1)
56#define s3c_irqwake_intallow (0) 56#define s3c_irqwake_intallow (~0)
57 57
58static inline void s3c_pm_arch_update_uart(void __iomem *regs, 58static inline void s3c_pm_arch_update_uart(void __iomem *regs,
59 struct pm_uart_save *save) 59 struct pm_uart_save *save)
@@ -96,3 +96,20 @@ static inline void s3c_pm_arch_update_uart(void __iomem *regs,
96 save->ucon = new_ucon; 96 save->ucon = new_ucon;
97 } 97 }
98} 98}
99
100static inline void s3c_pm_restored_gpios(void)
101{
102 /* ensure sleep mode has been cleared from the system */
103
104 __raw_writel(0, S3C64XX_SLPEN);
105}
106
107static inline void s3c_pm_saved_gpios(void)
108{
109 /* turn on the sleep mode and keep it there, as it seems that during
110 * suspend the xCON registers get re-set and thus you can end up with
111 * problems between going to sleep and resuming.
112 */
113
114 __raw_writel(S3C64XX_SLPEN_USE_xSLP, S3C64XX_SLPEN);
115}
diff --git a/arch/arm/mach-s3c64xx/irq.c b/arch/arm/mach-s3c64xx/irq.c
index 97660c8141a..75d9a0e4919 100644
--- a/arch/arm/mach-s3c64xx/irq.c
+++ b/arch/arm/mach-s3c64xx/irq.c
@@ -48,14 +48,22 @@ static struct s3c_uart_irq uart_irqs[] = {
48 }, 48 },
49}; 49};
50 50
51/* setup the sources the vic should advertise resume for, even though it
52 * is not doing the wake (set_irq_wake needs to be valid) */
53#define IRQ_VIC0_RESUME (1 << (IRQ_RTC_TIC - IRQ_VIC0_BASE))
54#define IRQ_VIC1_RESUME (1 << (IRQ_RTC_ALARM - IRQ_VIC1_BASE) | \
55 1 << (IRQ_PENDN - IRQ_VIC1_BASE) | \
56 1 << (IRQ_HSMMC0 - IRQ_VIC1_BASE) | \
57 1 << (IRQ_HSMMC1 - IRQ_VIC1_BASE) | \
58 1 << (IRQ_HSMMC2 - IRQ_VIC1_BASE))
51 59
52void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid) 60void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
53{ 61{
54 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__); 62 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
55 63
56 /* initialise the pair of VICs */ 64 /* initialise the pair of VICs */
57 vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, 0); 65 vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
58 vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, 0); 66 vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);
59 67
60 /* add the timer sub-irqs */ 68 /* add the timer sub-irqs */
61 s3c_init_vic_timer_irq(5, IRQ_TIMER0); 69 s3c_init_vic_timer_irq(5, IRQ_TIMER0);
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
new file mode 100644
index 00000000000..af0c2fe1ea3
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -0,0 +1,774 @@
1/* linux/arch/arm/mach-s3c64xx/mach-crag6410.c
2 *
3 * Copyright 2011 Wolfson Microelectronics plc
4 * Mark Brown <broonie@opensource.wolfsonmicro.com>
5 *
6 * Copyright 2011 Simtec Electronics
7 * Ben Dooks <ben@simtec.co.uk>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/list.h>
16#include <linux/serial_core.h>
17#include <linux/platform_device.h>
18#include <linux/fb.h>
19#include <linux/io.h>
20#include <linux/init.h>
21#include <linux/gpio.h>
22#include <linux/delay.h>
23#include <linux/regulator/machine.h>
24#include <linux/regulator/fixed.h>
25#include <linux/pwm_backlight.h>
26#include <linux/dm9000.h>
27#include <linux/gpio_keys.h>
28#include <linux/basic_mmio_gpio.h>
29#include <linux/spi/spi.h>
30
31#include <linux/i2c/pca953x.h>
32
33#include <video/platform_lcd.h>
34
35#include <linux/mfd/wm831x/core.h>
36#include <linux/mfd/wm831x/pdata.h>
37#include <linux/mfd/wm831x/irq.h>
38#include <linux/mfd/wm831x/gpio.h>
39
40#include <asm/mach/arch.h>
41#include <asm/mach-types.h>
42
43#include <mach/hardware.h>
44#include <mach/map.h>
45
46#include <mach/s3c6410.h>
47#include <mach/regs-sys.h>
48#include <mach/regs-gpio.h>
49#include <mach/regs-modem.h>
50
51#include <mach/regs-gpio-memport.h>
52
53#include <plat/regs-serial.h>
54#include <plat/regs-fb-v4.h>
55#include <plat/fb.h>
56#include <plat/sdhci.h>
57#include <plat/gpio-cfg.h>
58#include <plat/s3c64xx-spi.h>
59
60#include <plat/keypad.h>
61#include <plat/clock.h>
62#include <plat/devs.h>
63#include <plat/cpu.h>
64#include <plat/adc.h>
65#include <plat/iic.h>
66#include <plat/pm.h>
67
68#include <sound/wm8996.h>
69#include <sound/wm8962.h>
70#include <sound/wm9081.h>
71
72#define BANFF_PMIC_IRQ_BASE IRQ_BOARD_START
73#define GLENFARCLAS_PMIC_IRQ_BASE (IRQ_BOARD_START + 64)
74
75#define PCA935X_GPIO_BASE GPIO_BOARD_START
76#define CODEC_GPIO_BASE (GPIO_BOARD_START + 8)
77#define GLENFARCLAS_PMIC_GPIO_BASE (GPIO_BOARD_START + 16)
78
79/* serial port setup */
80
81#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
82#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
83#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
84
85static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
86 [0] = {
87 .hwport = 0,
88 .flags = 0,
89 .ucon = UCON,
90 .ulcon = ULCON,
91 .ufcon = UFCON,
92 },
93 [1] = {
94 .hwport = 1,
95 .flags = 0,
96 .ucon = UCON,
97 .ulcon = ULCON,
98 .ufcon = UFCON,
99 },
100 [2] = {
101 .hwport = 2,
102 .flags = 0,
103 .ucon = UCON,
104 .ulcon = ULCON,
105 .ufcon = UFCON,
106 },
107 [3] = {
108 .hwport = 3,
109 .flags = 0,
110 .ucon = UCON,
111 .ulcon = ULCON,
112 .ufcon = UFCON,
113 },
114};
115
116static struct platform_pwm_backlight_data crag6410_backlight_data = {
117 .pwm_id = 0,
118 .max_brightness = 1000,
119 .dft_brightness = 600,
120 .pwm_period_ns = 100000, /* about 1kHz */
121};
122
123static struct platform_device crag6410_backlight_device = {
124 .name = "pwm-backlight",
125 .id = -1,
126 .dev = {
127 .parent = &s3c_device_timer[0].dev,
128 .platform_data = &crag6410_backlight_data,
129 },
130};
131
132static void crag6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
133{
134 pr_debug("%s: setting power %d\n", __func__, power);
135
136 if (power) {
137 gpio_set_value(S3C64XX_GPB(0), 1);
138 msleep(1);
139 s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C_GPIO_SFN(2));
140 } else {
141 gpio_direction_output(S3C64XX_GPF(14), 0);
142 gpio_set_value(S3C64XX_GPB(0), 0);
143 }
144}
145
146static struct platform_device crag6410_lcd_powerdev = {
147 .name = "platform-lcd",
148 .id = -1,
149 .dev.parent = &s3c_device_fb.dev,
150 .dev.platform_data = &(struct plat_lcd_data) {
151 .set_power = crag6410_lcd_power_set,
152 },
153};
154
155/* 640x480 URT */
156static struct s3c_fb_pd_win crag6410_fb_win0 = {
157 /* this is to ensure we use win0 */
158 .win_mode = {
159 .left_margin = 150,
160 .right_margin = 80,
161 .upper_margin = 40,
162 .lower_margin = 5,
163 .hsync_len = 40,
164 .vsync_len = 5,
165 .xres = 640,
166 .yres = 480,
167 },
168 .max_bpp = 32,
169 .default_bpp = 16,
170 .virtual_y = 480 * 2,
171 .virtual_x = 640,
172};
173
174/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
175static struct s3c_fb_platdata crag6410_lcd_pdata __initdata = {
176 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
177 .win[0] = &crag6410_fb_win0,
178 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
179 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
180};
181
182/* 2x6 keypad */
183
184static uint32_t crag6410_keymap[] __initdata = {
185 /* KEY(row, col, keycode) */
186 KEY(0, 0, KEY_VOLUMEUP),
187 KEY(0, 1, KEY_HOME),
188 KEY(0, 2, KEY_VOLUMEDOWN),
189 KEY(0, 3, KEY_HELP),
190 KEY(0, 4, KEY_MENU),
191 KEY(0, 5, KEY_MEDIA),
192 KEY(1, 0, 232),
193 KEY(1, 1, KEY_DOWN),
194 KEY(1, 2, KEY_LEFT),
195 KEY(1, 3, KEY_UP),
196 KEY(1, 4, KEY_RIGHT),
197 KEY(1, 5, KEY_CAMERA),
198};
199
200static struct matrix_keymap_data crag6410_keymap_data __initdata = {
201 .keymap = crag6410_keymap,
202 .keymap_size = ARRAY_SIZE(crag6410_keymap),
203};
204
205static struct samsung_keypad_platdata crag6410_keypad_data __initdata = {
206 .keymap_data = &crag6410_keymap_data,
207 .rows = 2,
208 .cols = 6,
209};
210
211static struct gpio_keys_button crag6410_gpio_keys[] = {
212 [0] = {
213 .code = KEY_SUSPEND,
214 .gpio = S3C64XX_GPL(10), /* EINT 18 */
215 .type = EV_KEY,
216 .wakeup = 1,
217 .active_low = 1,
218 },
219 [1] = {
220 .code = SW_FRONT_PROXIMITY,
221 .gpio = S3C64XX_GPN(11), /* EINT 11 */
222 .type = EV_SW,
223 },
224};
225
226static struct gpio_keys_platform_data crag6410_gpio_keydata = {
227 .buttons = crag6410_gpio_keys,
228 .nbuttons = ARRAY_SIZE(crag6410_gpio_keys),
229};
230
231static struct platform_device crag6410_gpio_keydev = {
232 .name = "gpio-keys",
233 .id = 0,
234 .dev.platform_data = &crag6410_gpio_keydata,
235};
236
237static struct resource crag6410_dm9k_resource[] = {
238 [0] = {
239 .start = S3C64XX_PA_XM0CSN5,
240 .end = S3C64XX_PA_XM0CSN5 + 1,
241 .flags = IORESOURCE_MEM,
242 },
243 [1] = {
244 .start = S3C64XX_PA_XM0CSN5 + (1 << 8),
245 .end = S3C64XX_PA_XM0CSN5 + (1 << 8) + 1,
246 .flags = IORESOURCE_MEM,
247 },
248 [2] = {
249 .start = S3C_EINT(17),
250 .end = S3C_EINT(17),
251 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
252 },
253};
254
255static struct dm9000_plat_data mini6410_dm9k_pdata = {
256 .flags = DM9000_PLATF_16BITONLY,
257};
258
259static struct platform_device crag6410_dm9k_device = {
260 .name = "dm9000",
261 .id = -1,
262 .num_resources = ARRAY_SIZE(crag6410_dm9k_resource),
263 .resource = crag6410_dm9k_resource,
264 .dev.platform_data = &mini6410_dm9k_pdata,
265};
266
267static struct resource crag6410_mmgpio_resource[] = {
268 [0] = {
269 .start = S3C64XX_PA_XM0CSN4 + 1,
270 .end = S3C64XX_PA_XM0CSN4 + 1,
271 .flags = IORESOURCE_MEM,
272 },
273};
274
275static struct platform_device crag6410_mmgpio = {
276 .name = "basic-mmio-gpio",
277 .id = -1,
278 .resource = crag6410_mmgpio_resource,
279 .num_resources = ARRAY_SIZE(crag6410_mmgpio_resource),
280 .dev.platform_data = &(struct bgpio_pdata) {
281 .base = -1,
282 },
283};
284
285static struct platform_device speyside_device = {
286 .name = "speyside",
287 .id = -1,
288};
289
290static struct platform_device speyside_wm8962_device = {
291 .name = "speyside-wm8962",
292 .id = -1,
293};
294
295static struct regulator_consumer_supply wallvdd_consumers[] = {
296 REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
297 REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
298};
299
300static struct regulator_init_data wallvdd_data = {
301 .constraints = {
302 .always_on = 1,
303 },
304 .num_consumer_supplies = ARRAY_SIZE(wallvdd_consumers),
305 .consumer_supplies = wallvdd_consumers,
306};
307
308static struct fixed_voltage_config wallvdd_pdata = {
309 .supply_name = "WALLVDD",
310 .microvolts = 5000000,
311 .init_data = &wallvdd_data,
312 .gpio = -EINVAL,
313};
314
315static struct platform_device wallvdd_device = {
316 .name = "reg-fixed-voltage",
317 .id = -1,
318 .dev = {
319 .platform_data = &wallvdd_pdata,
320 },
321};
322
323static struct platform_device *crag6410_devices[] __initdata = {
324 &s3c_device_hsmmc0,
325 &s3c_device_hsmmc1,
326 &s3c_device_hsmmc2,
327 &s3c_device_i2c0,
328 &s3c_device_i2c1,
329 &s3c_device_fb,
330 &s3c_device_ohci,
331 &s3c_device_usb_hsotg,
332 &s3c_device_adc,
333 &s3c_device_rtc,
334 &s3c_device_ts,
335 &s3c_device_timer[0],
336 &s3c64xx_device_iis0,
337 &s3c64xx_device_iis1,
338 &samsung_asoc_dma,
339 &samsung_device_keypad,
340 &crag6410_gpio_keydev,
341 &crag6410_dm9k_device,
342 &s3c64xx_device_spi0,
343 &crag6410_mmgpio,
344 &crag6410_lcd_powerdev,
345 &crag6410_backlight_device,
346 &speyside_device,
347 &speyside_wm8962_device,
348 &wallvdd_device,
349};
350
351static struct pca953x_platform_data crag6410_pca_data = {
352 .gpio_base = PCA935X_GPIO_BASE,
353 .irq_base = 0,
354};
355
356static struct regulator_consumer_supply vddarm_consumers[] __initdata = {
357 REGULATOR_SUPPLY("vddarm", NULL),
358};
359
360static struct regulator_init_data vddarm __initdata = {
361 .constraints = {
362 .name = "VDDARM",
363 .min_uV = 1000000,
364 .max_uV = 1300000,
365 .always_on = 1,
366 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
367 },
368 .num_consumer_supplies = ARRAY_SIZE(vddarm_consumers),
369 .consumer_supplies = vddarm_consumers,
370 .supply_regulator = "WALLVDD",
371};
372
373static struct regulator_init_data vddint __initdata = {
374 .constraints = {
375 .name = "VDDINT",
376 .min_uV = 1000000,
377 .max_uV = 1200000,
378 .always_on = 1,
379 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
380 },
381};
382
383static struct regulator_init_data vddmem __initdata = {
384 .constraints = {
385 .name = "VDDMEM",
386 .always_on = 1,
387 },
388};
389
390static struct regulator_init_data vddsys __initdata = {
391 .constraints = {
392 .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS",
393 .always_on = 1,
394 },
395};
396
397static struct regulator_consumer_supply vddmmc_consumers[] __initdata = {
398 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
399 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"),
400 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
401};
402
403static struct regulator_init_data vddmmc __initdata = {
404 .constraints = {
405 .name = "VDDMMC,UH",
406 .always_on = 1,
407 },
408 .num_consumer_supplies = ARRAY_SIZE(vddmmc_consumers),
409 .consumer_supplies = vddmmc_consumers,
410 .supply_regulator = "WALLVDD",
411};
412
413static struct regulator_init_data vddotgi __initdata = {
414 .constraints = {
415 .name = "VDDOTGi",
416 .always_on = 1,
417 },
418 .supply_regulator = "WALLVDD",
419};
420
421static struct regulator_init_data vddotg __initdata = {
422 .constraints = {
423 .name = "VDDOTG",
424 .always_on = 1,
425 },
426 .supply_regulator = "WALLVDD",
427};
428
429static struct regulator_init_data vddhi __initdata = {
430 .constraints = {
431 .name = "VDDHI",
432 .always_on = 1,
433 },
434 .supply_regulator = "WALLVDD",
435};
436
437static struct regulator_init_data vddadc __initdata = {
438 .constraints = {
439 .name = "VDDADC,VDDDAC",
440 .always_on = 1,
441 },
442 .supply_regulator = "WALLVDD",
443};
444
445static struct regulator_init_data vddmem0 __initdata = {
446 .constraints = {
447 .name = "VDDMEM0",
448 .always_on = 1,
449 },
450 .supply_regulator = "WALLVDD",
451};
452
453static struct regulator_init_data vddpll __initdata = {
454 .constraints = {
455 .name = "VDDPLL",
456 .always_on = 1,
457 },
458 .supply_regulator = "WALLVDD",
459};
460
461static struct regulator_init_data vddlcd __initdata = {
462 .constraints = {
463 .name = "VDDLCD",
464 .always_on = 1,
465 },
466 .supply_regulator = "WALLVDD",
467};
468
469static struct regulator_init_data vddalive __initdata = {
470 .constraints = {
471 .name = "VDDALIVE",
472 .always_on = 1,
473 },
474 .supply_regulator = "WALLVDD",
475};
476
477static struct wm831x_backup_pdata banff_backup_pdata __initdata = {
478 .charger_enable = 1,
479 .vlim = 2500, /* mV */
480 .ilim = 200, /* uA */
481};
482
483static struct wm831x_status_pdata banff_red_led __initdata = {
484 .name = "banff:red:",
485 .default_src = WM831X_STATUS_MANUAL,
486};
487
488static struct wm831x_status_pdata banff_green_led __initdata = {
489 .name = "banff:green:",
490 .default_src = WM831X_STATUS_MANUAL,
491};
492
493static struct wm831x_touch_pdata touch_pdata __initdata = {
494 .data_irq = S3C_EINT(26),
495 .pd_irq = S3C_EINT(27),
496};
497
498static struct wm831x_pdata crag_pmic_pdata __initdata = {
499 .wm831x_num = 1,
500 .irq_base = BANFF_PMIC_IRQ_BASE,
501 .gpio_base = GPIO_BOARD_START + 8,
502
503 .backup = &banff_backup_pdata,
504
505 .gpio_defaults = {
506 /* GPIO11: Touchscreen data - CMOS, DBVDD, active high*/
507 [10] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x6,
508 /* GPIO12: Touchscreen pen down - CMOS, DBVDD, active high*/
509 [11] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x7,
510 },
511
512 .dcdc = {
513 &vddarm, /* DCDC1 */
514 &vddint, /* DCDC2 */
515 &vddmem, /* DCDC3 */
516 },
517
518 .ldo = {
519 &vddsys, /* LDO1 */
520 &vddmmc, /* LDO2 */
521 NULL, /* LDO3 */
522 &vddotgi, /* LDO4 */
523 &vddotg, /* LDO5 */
524 &vddhi, /* LDO6 */
525 &vddadc, /* LDO7 */
526 &vddmem0, /* LDO8 */
527 &vddpll, /* LDO9 */
528 &vddlcd, /* LDO10 */
529 &vddalive, /* LDO11 */
530 },
531
532 .status = {
533 &banff_green_led,
534 &banff_red_led,
535 },
536
537 .touch = &touch_pdata,
538};
539
540static struct i2c_board_info i2c_devs0[] __initdata = {
541 { I2C_BOARD_INFO("24c08", 0x50), },
542 { I2C_BOARD_INFO("tca6408", 0x20),
543 .platform_data = &crag6410_pca_data,
544 },
545 { I2C_BOARD_INFO("wm8312", 0x34),
546 .platform_data = &crag_pmic_pdata,
547 .irq = S3C_EINT(23),
548 },
549};
550
551static struct s3c2410_platform_i2c i2c0_pdata = {
552 .frequency = 400000,
553};
554
555static struct regulator_init_data pvdd_1v2 __initdata = {
556 .constraints = {
557 .name = "PVDD_1V2",
558 .always_on = 1,
559 },
560};
561
562static struct regulator_consumer_supply pvdd_1v8_consumers[] __initdata = {
563 REGULATOR_SUPPLY("PLLVDD", "1-001a"),
564 REGULATOR_SUPPLY("DBVDD", "1-001a"),
565 REGULATOR_SUPPLY("CPVDD", "1-001a"),
566 REGULATOR_SUPPLY("AVDD2", "1-001a"),
567 REGULATOR_SUPPLY("DCVDD", "1-001a"),
568 REGULATOR_SUPPLY("AVDD", "1-001a"),
569};
570
571static struct regulator_init_data pvdd_1v8 __initdata = {
572 .constraints = {
573 .name = "PVDD_1V8",
574 .always_on = 1,
575 },
576
577 .consumer_supplies = pvdd_1v8_consumers,
578 .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers),
579};
580
581static struct regulator_consumer_supply pvdd_3v3_consumers[] __initdata = {
582 REGULATOR_SUPPLY("MICVDD", "1-001a"),
583 REGULATOR_SUPPLY("AVDD1", "1-001a"),
584};
585
586static struct regulator_init_data pvdd_3v3 __initdata = {
587 .constraints = {
588 .name = "PVDD_3V3",
589 .always_on = 1,
590 },
591
592 .consumer_supplies = pvdd_3v3_consumers,
593 .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers),
594};
595
596static struct wm831x_pdata glenfarclas_pmic_pdata __initdata = {
597 .wm831x_num = 2,
598 .irq_base = GLENFARCLAS_PMIC_IRQ_BASE,
599 .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE,
600
601 .gpio_defaults = {
602 /* GPIO1-3: IRQ inputs, rising edge triggered, CMOS */
603 [0] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
604 [1] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
605 [2] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
606 },
607
608 .dcdc = {
609 &pvdd_1v2, /* DCDC1 */
610 &pvdd_1v8, /* DCDC2 */
611 &pvdd_3v3, /* DCDC3 */
612 },
613
614 .disable_touch = true,
615};
616
617static struct wm8996_retune_mobile_config wm8996_retune[] = {
618 {
619 .name = "Sub LPF",
620 .rate = 48000,
621 .regs = {
622 0x6318, 0x6300, 0x1000, 0x0000, 0x0004, 0x2000, 0xF000,
623 0x0000, 0x0004, 0x2000, 0xF000, 0x0000, 0x0004, 0x2000,
624 0xF000, 0x0000, 0x0004, 0x1000, 0x0800, 0x4000
625 },
626 },
627 {
628 .name = "Sub HPF",
629 .rate = 48000,
630 .regs = {
631 0x000A, 0x6300, 0x1000, 0x0000, 0x0004, 0x2000, 0xF000,
632 0x0000, 0x0004, 0x2000, 0xF000, 0x0000, 0x0004, 0x2000,
633 0xF000, 0x0000, 0x0004, 0x1000, 0x0800, 0x4000
634 },
635 },
636};
637
638static struct wm8996_pdata wm8996_pdata __initdata = {
639 .ldo_ena = S3C64XX_GPN(7),
640 .gpio_base = CODEC_GPIO_BASE,
641 .micdet_def = 1,
642 .inl_mode = WM8996_DIFFERRENTIAL_1,
643 .inr_mode = WM8996_DIFFERRENTIAL_1,
644
645 .irq_flags = IRQF_TRIGGER_RISING,
646
647 .gpio_default = {
648 0x8001, /* GPIO1 == ADCLRCLK1 */
649 0x8001, /* GPIO2 == ADCLRCLK2, input due to CPU */
650 0x0141, /* GPIO3 == HP_SEL */
651 0x0002, /* GPIO4 == IRQ */
652 0x020e, /* GPIO5 == CLKOUT */
653 },
654
655 .retune_mobile_cfgs = wm8996_retune,
656 .num_retune_mobile_cfgs = ARRAY_SIZE(wm8996_retune),
657};
658
659static struct wm8962_pdata wm8962_pdata __initdata = {
660 .gpio_init = {
661 0,
662 WM8962_GPIO_FN_OPCLK,
663 WM8962_GPIO_FN_DMICCLK,
664 0,
665 0x8000 | WM8962_GPIO_FN_DMICDAT,
666 WM8962_GPIO_FN_IRQ, /* Open drain mode */
667 },
668 .irq_active_low = true,
669};
670
671static struct wm9081_pdata wm9081_pdata __initdata = {
672 .irq_high = false,
673 .irq_cmos = false,
674};
675
676static struct i2c_board_info i2c_devs1[] __initdata = {
677 { I2C_BOARD_INFO("wm8311", 0x34),
678 .irq = S3C_EINT(0),
679 .platform_data = &glenfarclas_pmic_pdata },
680
681 { I2C_BOARD_INFO("wm1250-ev1", 0x27) },
682 { I2C_BOARD_INFO("wm8996", 0x1a),
683 .platform_data = &wm8996_pdata,
684 .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
685 },
686 { I2C_BOARD_INFO("wm9081", 0x6c),
687 .platform_data = &wm9081_pdata, },
688 { I2C_BOARD_INFO("wm8962", 0x1a),
689 .platform_data = &wm8962_pdata,
690 .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
691 },
692};
693
694static void __init crag6410_map_io(void)
695{
696 s3c64xx_init_io(NULL, 0);
697 s3c24xx_init_clocks(12000000);
698 s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
699
700 /* LCD type and Bypass set by bootloader */
701}
702
703static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = {
704 .max_width = 4,
705 .cd_type = S3C_SDHCI_CD_PERMANENT,
706};
707
708static struct s3c_sdhci_platdata crag6410_hsmmc1_pdata = {
709 .max_width = 4,
710 .cd_type = S3C_SDHCI_CD_GPIO,
711 .ext_cd_gpio = S3C64XX_GPF(11),
712};
713
714static void crag6410_cfg_sdhci0(struct platform_device *dev, int width)
715{
716 /* Set all the necessary GPG pins to special-function 2 */
717 s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
718
719 /* force card-detected for prototype 0 */
720 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_DOWN);
721}
722
723static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
724 .max_width = 4,
725 .cd_type = S3C_SDHCI_CD_INTERNAL,
726 .cfg_gpio = crag6410_cfg_sdhci0,
727};
728
729static void __init crag6410_machine_init(void)
730{
731 /* Open drain IRQs need pullups */
732 s3c_gpio_setpull(S3C64XX_GPM(0), S3C_GPIO_PULL_UP);
733 s3c_gpio_setpull(S3C64XX_GPN(0), S3C_GPIO_PULL_UP);
734
735 gpio_request(S3C64XX_GPB(0), "LCD power");
736 gpio_direction_output(S3C64XX_GPB(0), 0);
737
738 gpio_request(S3C64XX_GPF(14), "LCD PWM");
739 gpio_direction_output(S3C64XX_GPF(14), 0); /* turn off */
740
741 gpio_request(S3C64XX_GPB(1), "SD power");
742 gpio_direction_output(S3C64XX_GPB(1), 0);
743
744 gpio_request(S3C64XX_GPF(10), "nRESETSEL");
745 gpio_direction_output(S3C64XX_GPF(10), 1);
746
747 s3c_sdhci0_set_platdata(&crag6410_hsmmc0_pdata);
748 s3c_sdhci1_set_platdata(&crag6410_hsmmc1_pdata);
749 s3c_sdhci2_set_platdata(&crag6410_hsmmc2_pdata);
750
751 s3c_i2c0_set_platdata(&i2c0_pdata);
752 s3c_i2c1_set_platdata(NULL);
753 s3c_fb_set_platdata(&crag6410_lcd_pdata);
754
755 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
756 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
757
758 samsung_keypad_set_platdata(&crag6410_keypad_data);
759
760 platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
761
762 regulator_has_full_constraints();
763
764 s3c_pm_init();
765}
766
767MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
768 /* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
769 .boot_params = S3C64XX_PA_SDRAM + 0x100,
770 .init_irq = s3c6410_init_irq,
771 .map_io = crag6410_map_io,
772 .init_machine = crag6410_machine_init,
773 .timer = &s3c24xx_timer,
774MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
index 8bad6437068..055e2858b0d 100644
--- a/arch/arm/mach-s3c64xx/pm.c
+++ b/arch/arm/mach-s3c64xx/pm.c
@@ -16,6 +16,7 @@
16#include <linux/suspend.h> 16#include <linux/suspend.h>
17#include <linux/serial_core.h> 17#include <linux/serial_core.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/gpio.h>
19 20
20#include <mach/map.h> 21#include <mach/map.h>
21#include <mach/irqs.h> 22#include <mach/irqs.h>
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index ae6bf6feba8..5f6afdf067e 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -13,7 +13,7 @@ obj- :=
13# Core support for S5P64X0 system 13# Core support for S5P64X0 system
14 14
15obj-$(CONFIG_ARCH_S5P64X0) += cpu.o init.o clock.o dma.o gpiolib.o 15obj-$(CONFIG_ARCH_S5P64X0) += cpu.o init.o clock.o dma.o gpiolib.o
16obj-$(CONFIG_ARCH_S5P64X0) += setup-i2c0.o 16obj-$(CONFIG_ARCH_S5P64X0) += setup-i2c0.o irq-eint.o
17obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o 17obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o
18obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o 18obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o
19 19
diff --git a/arch/arm/mach-s5p64x0/include/mach/irqs.h b/arch/arm/mach-s5p64x0/include/mach/irqs.h
index 513abffc760..5837a36ece8 100644
--- a/arch/arm/mach-s5p64x0/include/mach/irqs.h
+++ b/arch/arm/mach-s5p64x0/include/mach/irqs.h
@@ -85,6 +85,8 @@
85#define IRQ_S3CUART_RX4 IRQ_S5P_UART_RX4 85#define IRQ_S3CUART_RX4 IRQ_S5P_UART_RX4
86#define IRQ_S3CUART_RX5 IRQ_S5P_UART_RX5 86#define IRQ_S3CUART_RX5 IRQ_S5P_UART_RX5
87 87
88#define IRQ_I2S0 IRQ_I2SV40
89
88/* S5P6450 EINT feature will be added */ 90/* S5P6450 EINT feature will be added */
89 91
90/* 92/*
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
index 0953ef6b1c7..6ce254729f3 100644
--- a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
@@ -34,4 +34,14 @@
34#define S5P6450_GPQ_BASE (S5P_VA_GPIO + 0x0180) 34#define S5P6450_GPQ_BASE (S5P_VA_GPIO + 0x0180)
35#define S5P6450_GPS_BASE (S5P_VA_GPIO + 0x0300) 35#define S5P6450_GPS_BASE (S5P_VA_GPIO + 0x0300)
36 36
37/* External interrupt control registers for group0 */
38
39#define EINT0CON0_OFFSET (0x900)
40#define EINT0MASK_OFFSET (0x920)
41#define EINT0PEND_OFFSET (0x924)
42
43#define S5P64X0_EINT0CON0 (S5P_VA_GPIO + EINT0CON0_OFFSET)
44#define S5P64X0_EINT0MASK (S5P_VA_GPIO + EINT0MASK_OFFSET)
45#define S5P64X0_EINT0PEND (S5P_VA_GPIO + EINT0PEND_OFFSET)
46
37#endif /* __ASM_ARCH_REGS_GPIO_H */ 47#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-s5p64x0/irq-eint.c b/arch/arm/mach-s5p64x0/irq-eint.c
new file mode 100644
index 00000000000..fe7380f5c3c
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/irq-eint.c
@@ -0,0 +1,152 @@
1/* arch/arm/mach-s5p64x0/irq-eint.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd
4 * http://www.samsung.com/
5 *
6 * Based on linux/arch/arm/mach-s3c64xx/irq-eint.c
7 *
8 * S5P64X0 - Interrupt handling for External Interrupts.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/gpio.h>
17#include <linux/irq.h>
18#include <linux/io.h>
19
20#include <plat/regs-irqtype.h>
21#include <plat/gpio-cfg.h>
22
23#include <mach/regs-gpio.h>
24#include <mach/regs-clock.h>
25
26#define eint_offset(irq) ((irq) - IRQ_EINT(0))
27
28static int s5p64x0_irq_eint_set_type(struct irq_data *data, unsigned int type)
29{
30 int offs = eint_offset(data->irq);
31 int shift;
32 u32 ctrl, mask;
33 u32 newvalue = 0;
34
35 if (offs > 15)
36 return -EINVAL;
37
38 switch (type) {
39 case IRQ_TYPE_NONE:
40 printk(KERN_WARNING "No edge setting!\n");
41 break;
42 case IRQ_TYPE_EDGE_RISING:
43 newvalue = S3C2410_EXTINT_RISEEDGE;
44 break;
45 case IRQ_TYPE_EDGE_FALLING:
46 newvalue = S3C2410_EXTINT_FALLEDGE;
47 break;
48 case IRQ_TYPE_EDGE_BOTH:
49 newvalue = S3C2410_EXTINT_BOTHEDGE;
50 break;
51 case IRQ_TYPE_LEVEL_LOW:
52 newvalue = S3C2410_EXTINT_LOWLEV;
53 break;
54 case IRQ_TYPE_LEVEL_HIGH:
55 newvalue = S3C2410_EXTINT_HILEV;
56 break;
57 default:
58 printk(KERN_ERR "No such irq type %d", type);
59 return -EINVAL;
60 }
61
62 shift = (offs / 2) * 4;
63 mask = 0x7 << shift;
64
65 ctrl = __raw_readl(S5P64X0_EINT0CON0) & ~mask;
66 ctrl |= newvalue << shift;
67 __raw_writel(ctrl, S5P64X0_EINT0CON0);
68
69 /* Configure the GPIO pin for 6450 or 6440 based on CPU ID */
70 if (0x50000 == (__raw_readl(S5P64X0_SYS_ID) & 0xFF000))
71 s3c_gpio_cfgpin(S5P6450_GPN(offs), S3C_GPIO_SFN(2));
72 else
73 s3c_gpio_cfgpin(S5P6440_GPN(offs), S3C_GPIO_SFN(2));
74
75 return 0;
76}
77
78/*
79 * s5p64x0_irq_demux_eint
80 *
81 * This function demuxes the IRQ from the group0 external interrupts,
82 * from IRQ_EINT(0) to IRQ_EINT(15). It is designed to be inlined into
83 * the specific handlers s5p64x0_irq_demux_eintX_Y.
84 */
85static inline void s5p64x0_irq_demux_eint(unsigned int start, unsigned int end)
86{
87 u32 status = __raw_readl(S5P64X0_EINT0PEND);
88 u32 mask = __raw_readl(S5P64X0_EINT0MASK);
89 unsigned int irq;
90
91 status &= ~mask;
92 status >>= start;
93 status &= (1 << (end - start + 1)) - 1;
94
95 for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
96 if (status & 1)
97 generic_handle_irq(irq);
98 status >>= 1;
99 }
100}
101
102static void s5p64x0_irq_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
103{
104 s5p64x0_irq_demux_eint(0, 3);
105}
106
107static void s5p64x0_irq_demux_eint4_11(unsigned int irq, struct irq_desc *desc)
108{
109 s5p64x0_irq_demux_eint(4, 11);
110}
111
112static void s5p64x0_irq_demux_eint12_15(unsigned int irq,
113 struct irq_desc *desc)
114{
115 s5p64x0_irq_demux_eint(12, 15);
116}
117
118static int s5p64x0_alloc_gc(void)
119{
120 struct irq_chip_generic *gc;
121 struct irq_chip_type *ct;
122
123 gc = irq_alloc_generic_chip("s5p64x0-eint", 1, S5P_IRQ_EINT_BASE,
124 S5P_VA_GPIO, handle_level_irq);
125 if (!gc) {
126 printk(KERN_ERR "%s: irq_alloc_generic_chip for group 0"
127 "external interrupts failed\n", __func__);
128 return -EINVAL;
129 }
130
131 ct = gc->chip_types;
132 ct->chip.irq_ack = irq_gc_ack_set_bit;
133 ct->chip.irq_mask = irq_gc_mask_set_bit;
134 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
135 ct->chip.irq_set_type = s5p64x0_irq_eint_set_type;
136 ct->regs.ack = EINT0PEND_OFFSET;
137 ct->regs.mask = EINT0MASK_OFFSET;
138 irq_setup_generic_chip(gc, IRQ_MSK(16), IRQ_GC_INIT_MASK_CACHE,
139 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
140 return 0;
141}
142
143static int __init s5p64x0_init_irq_eint(void)
144{
145 int ret = s5p64x0_alloc_gc();
146 irq_set_chained_handler(IRQ_EINT0_3, s5p64x0_irq_demux_eint0_3);
147 irq_set_chained_handler(IRQ_EINT4_11, s5p64x0_irq_demux_eint4_11);
148 irq_set_chained_handler(IRQ_EINT12_15, s5p64x0_irq_demux_eint12_15);
149
150 return ret;
151}
152arch_initcall(s5p64x0_init_irq_eint);
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 79bb3a0314e..69dd87cd8e2 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -90,6 +90,7 @@ config MACH_GONI
90 select S3C_DEV_HSMMC2 90 select S3C_DEV_HSMMC2
91 select S3C_DEV_I2C1 91 select S3C_DEV_I2C1
92 select S3C_DEV_I2C2 92 select S3C_DEV_I2C2
93 select S5P_DEV_MFC
93 select S3C_DEV_USB_HSOTG 94 select S3C_DEV_USB_HSOTG
94 select S5P_DEV_ONENAND 95 select S5P_DEV_ONENAND
95 select SAMSUNG_DEV_KEYPAD 96 select SAMSUNG_DEV_KEYPAD
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index ae72f87eab1..52a8e607bcc 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -324,6 +324,12 @@ static struct clk init_clocks_off[] = {
324 .enable = s5pv210_clk_ip0_ctrl, 324 .enable = s5pv210_clk_ip0_ctrl,
325 .ctrlbit = (1 << 26), 325 .ctrlbit = (1 << 26),
326 }, { 326 }, {
327 .name = "mfc",
328 .devname = "s5p-mfc",
329 .parent = &clk_pclk_psys.clk,
330 .enable = s5pv210_clk_ip0_ctrl,
331 .ctrlbit = (1 << 16),
332 }, {
327 .name = "otg", 333 .name = "otg",
328 .parent = &clk_hclk_psys.clk, 334 .parent = &clk_hclk_psys.clk,
329 .enable = s5pv210_clk_ip1_ctrl, 335 .enable = s5pv210_clk_ip1_ctrl,
@@ -879,6 +885,7 @@ static struct clksrc_clk clksrcs[] = {
879 }, { 885 }, {
880 .clk = { 886 .clk = {
881 .name = "sclk_mfc", 887 .name = "sclk_mfc",
888 .devname = "s5p-mfc",
882 .enable = s5pv210_clk_ip0_ctrl, 889 .enable = s5pv210_clk_ip0_ctrl,
883 .ctrlbit = (1 << 16), 890 .ctrlbit = (1 << 16),
884 }, 891 },
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c
index 61e6c24b90a..79907ec78d4 100644
--- a/arch/arm/mach-s5pv210/cpu.c
+++ b/arch/arm/mach-s5pv210/cpu.c
@@ -126,7 +126,7 @@ void __init s5pv210_map_io(void)
126 s5pv210_default_sdhci2(); 126 s5pv210_default_sdhci2();
127 s5pv210_default_sdhci3(); 127 s5pv210_default_sdhci3();
128 128
129 s3c_adc_setname("s3c64xx-adc"); 129 s3c_adc_setname("samsung-adc-v3");
130 130
131 s3c_cfcon_setname("s5pv210-pata"); 131 s3c_cfcon_setname("s5pv210-pata");
132 132
diff --git a/arch/arm/mach-s5pv210/dev-audio.c b/arch/arm/mach-s5pv210/dev-audio.c
index 8d58f192624..63f5d82004b 100644
--- a/arch/arm/mach-s5pv210/dev-audio.c
+++ b/arch/arm/mach-s5pv210/dev-audio.c
@@ -18,6 +18,7 @@
18#include <mach/map.h> 18#include <mach/map.h>
19#include <mach/dma.h> 19#include <mach/dma.h>
20#include <mach/irqs.h> 20#include <mach/irqs.h>
21#include <mach/regs-audss.h>
21 22
22static const char *rclksrc[] = { 23static const char *rclksrc[] = {
23 [0] = "busclk", 24 [0] = "busclk",
@@ -52,6 +53,7 @@ static struct s3c_audio_pdata i2sv5_pdata = {
52 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI 53 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
53 | QUIRK_NEED_RSTCLR, 54 | QUIRK_NEED_RSTCLR,
54 .src_clk = rclksrc, 55 .src_clk = rclksrc,
56 .idma_addr = S5PV210_AUDSS_INT_MEM,
55 }, 57 },
56 }, 58 },
57}; 59};
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h
index 1dd58836fd4..aac343c180b 100644
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ b/arch/arm/mach-s5pv210/include/mach/map.h
@@ -59,6 +59,8 @@
59 59
60#define S5PV210_PA_CFCON 0xE8200000 60#define S5PV210_PA_CFCON 0xE8200000
61 61
62#define S5PV210_PA_MFC 0xF1700000
63
62#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000)) 64#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000))
63 65
64#define S5PV210_PA_HSOTG 0xEC000000 66#define S5PV210_PA_HSOTG 0xEC000000
@@ -107,6 +109,7 @@
107#define S5P_PA_FIMC1 S5PV210_PA_FIMC1 109#define S5P_PA_FIMC1 S5PV210_PA_FIMC1
108#define S5P_PA_FIMC2 S5PV210_PA_FIMC2 110#define S5P_PA_FIMC2 S5PV210_PA_FIMC2
109#define S5P_PA_MIPI_CSIS0 S5PV210_PA_MIPI_CSIS 111#define S5P_PA_MIPI_CSIS0 S5PV210_PA_MIPI_CSIS
112#define S5P_PA_MFC S5PV210_PA_MFC
110#define S5P_PA_ONENAND S5PC110_PA_ONENAND 113#define S5P_PA_ONENAND S5PC110_PA_ONENAND
111#define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA 114#define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA
112#define S5P_PA_SDRAM S5PV210_PA_SDRAM 115#define S5P_PA_SDRAM S5PV210_PA_SDRAM
diff --git a/arch/arm/mach-s5pv210/include/mach/pm-core.h b/arch/arm/mach-s5pv210/include/mach/pm-core.h
index e8d394f8b05..3e22109e1b7 100644
--- a/arch/arm/mach-s5pv210/include/mach/pm-core.h
+++ b/arch/arm/mach-s5pv210/include/mach/pm-core.h
@@ -41,3 +41,6 @@ static inline void s3c_pm_arch_update_uart(void __iomem *regs,
41{ 41{
42 /* nothing here yet */ 42 /* nothing here yet */
43} 43}
44
45static inline void s3c_pm_restored_gpios(void) { }
46static inline void s3c_pm_saved_gpios(void) { }
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-audss.h b/arch/arm/mach-s5pv210/include/mach/regs-audss.h
new file mode 100644
index 00000000000..eacc1f79080
--- /dev/null
+++ b/arch/arm/mach-s5pv210/include/mach/regs-audss.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-s5pv210/include/mach/regs-audss.h
2 *
3 * Copyright (c) 2011 Samsung Electronics
4 * http://www.samsung.com
5 *
6 * S5PV210 Audio SubSystem clock register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __PLAT_REGS_AUDSS_H
14#define __PLAT_REGS_AUDSS_H __FILE__
15
16#define S5PV210_AUDSS_INT_MEM (0xC0000000)
17
18#endif /* _PLAT_REGS_AUDSS_H */
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index e0c4d06b9db..85c2d51a095 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -46,6 +46,7 @@
46#include <plat/sdhci.h> 46#include <plat/sdhci.h>
47#include <plat/clock.h> 47#include <plat/clock.h>
48#include <plat/s5p-time.h> 48#include <plat/s5p-time.h>
49#include <plat/mfc.h>
49#include <plat/regs-fb-v4.h> 50#include <plat/regs-fb-v4.h>
50 51
51/* Following are default values for UCON, ULCON and UFCON UART registers */ 52/* Following are default values for UCON, ULCON and UFCON UART registers */
@@ -808,6 +809,9 @@ static struct platform_device *goni_devices[] __initdata = {
808 &goni_i2c_gpio5, 809 &goni_i2c_gpio5,
809 &mmc2_fixed_voltage, 810 &mmc2_fixed_voltage,
810 &goni_device_gpiokeys, 811 &goni_device_gpiokeys,
812 &s5p_device_mfc,
813 &s5p_device_mfc_l,
814 &s5p_device_mfc_r,
811 &s3c_device_i2c0, 815 &s3c_device_i2c0,
812 &s5p_device_fimc0, 816 &s5p_device_fimc0,
813 &s5p_device_fimc1, 817 &s5p_device_fimc1,
@@ -841,6 +845,11 @@ static void __init goni_map_io(void)
841 s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 845 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
842} 846}
843 847
848static void __init goni_reserve(void)
849{
850 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
851}
852
844static void __init goni_machine_init(void) 853static void __init goni_machine_init(void)
845{ 854{
846 /* Radio: call before I2C 1 registeration */ 855 /* Radio: call before I2C 1 registeration */
@@ -893,4 +902,5 @@ MACHINE_START(GONI, "GONI")
893 .map_io = goni_map_io, 902 .map_io = goni_map_io,
894 .init_machine = goni_machine_init, 903 .init_machine = goni_machine_init,
895 .timer = &s5p_timer, 904 .timer = &s5p_timer,
905 .reserve = &goni_reserve,
896MACHINE_END 906MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index ef20f922249..5e011fc6720 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -229,6 +229,7 @@ static struct platform_device *smdkv210_devices[] __initdata = {
229 &s5pv210_device_iis0, 229 &s5pv210_device_iis0,
230 &s5pv210_device_spdif, 230 &s5pv210_device_spdif,
231 &samsung_asoc_dma, 231 &samsung_asoc_dma,
232 &samsung_asoc_idma,
232 &samsung_device_keypad, 233 &samsung_device_keypad,
233 &smdkv210_dm9000, 234 &smdkv210_dm9000,
234 &smdkv210_lcd_lte480wv, 235 &smdkv210_lcd_lte480wv,
diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c
index 309e388a8a8..f149d278377 100644
--- a/arch/arm/mach-s5pv210/pm.c
+++ b/arch/arm/mach-s5pv210/pm.c
@@ -88,7 +88,7 @@ static struct sleep_save s5pv210_core_save[] = {
88 SAVE_ITEM(S3C2410_TCNTO(0)), 88 SAVE_ITEM(S3C2410_TCNTO(0)),
89}; 89};
90 90
91void s5pv210_cpu_suspend(unsigned long arg) 91static int s5pv210_cpu_suspend(unsigned long arg)
92{ 92{
93 unsigned long tmp; 93 unsigned long tmp;
94 94
diff --git a/arch/arm/mach-sa1100/include/mach/hardware.h b/arch/arm/mach-sa1100/include/mach/hardware.h
index 967ae768439..99f5856d8de 100644
--- a/arch/arm/mach-sa1100/include/mach/hardware.h
+++ b/arch/arm/mach-sa1100/include/mach/hardware.h
@@ -76,12 +76,4 @@ static inline unsigned long get_clock_tick_rate(void)
76#include "SA-1101.h" 76#include "SA-1101.h"
77#endif 77#endif
78 78
79#if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_PCI)
80#define PCIBIOS_MIN_IO 0
81#define PCIBIOS_MIN_MEM 0
82#define pcibios_assign_all_busses() 1
83#define HAVE_ARCH_PCI_SET_DMA_MASK 1
84#endif
85
86
87#endif /* _ASM_ARCH_HARDWARE_H */ 79#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
index fba7a913f12..dd39fee5954 100644
--- a/arch/arm/mach-sa1100/pci-nanoengine.c
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -28,6 +28,7 @@
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29 29
30#include <mach/nanoengine.h> 30#include <mach/nanoengine.h>
31#include <mach/hardware.h>
31 32
32static DEFINE_SPINLOCK(nano_lock); 33static DEFINE_SPINLOCK(nano_lock);
33 34
@@ -122,7 +123,8 @@ static struct pci_ops pci_nano_ops = {
122 .write = nanoengine_write_config, 123 .write = nanoengine_write_config,
123}; 124};
124 125
125static int __init pci_nanoengine_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 126static int __init pci_nanoengine_map_irq(const struct pci_dev *dev, u8 slot,
127 u8 pin)
126{ 128{
127 return NANOENGINE_IRQ_GPIO_PCI; 129 return NANOENGINE_IRQ_GPIO_PCI;
128} 130}
@@ -252,6 +254,9 @@ int __init pci_nanoengine_setup(int nr, struct pci_sys_data *sys)
252{ 254{
253 int ret = 0; 255 int ret = 0;
254 256
257 pcibios_min_io = 0;
258 pcibios_min_mem = 0;
259
255 if (nr == 0) { 260 if (nr == 0) {
256 sys->mem_offset = NANO_PCI_MEM_RW_PHYS; 261 sys->mem_offset = NANO_PCI_MEM_RW_PHYS;
257 sys->io_offset = 0x400; 262 sys->io_offset = 0x400;
diff --git a/arch/arm/mach-shark/include/mach/hardware.h b/arch/arm/mach-shark/include/mach/hardware.h
index 94d84b27a0c..663f952a8ab 100644
--- a/arch/arm/mach-shark/include/mach/hardware.h
+++ b/arch/arm/mach-shark/include/mach/hardware.h
@@ -12,11 +12,5 @@
12 12
13#define UNCACHEABLE_ADDR 0xdf010000 13#define UNCACHEABLE_ADDR 0xdf010000
14 14
15#define pcibios_assign_all_busses() 1
16
17#define PCIBIOS_MIN_IO 0x6000
18#define PCIBIOS_MIN_MEM 0x50000000
19#define PCIMEM_BASE 0xe8000000
20
21#endif 15#endif
22 16
diff --git a/arch/arm/mach-shark/pci.c b/arch/arm/mach-shark/pci.c
index 89d175ce74d..7cb79a092f3 100644
--- a/arch/arm/mach-shark/pci.c
+++ b/arch/arm/mach-shark/pci.c
@@ -8,12 +8,13 @@
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <video/vga.h>
11 12
12#include <asm/irq.h> 13#include <asm/irq.h>
13#include <asm/mach/pci.h> 14#include <asm/mach/pci.h>
14#include <asm/mach-types.h> 15#include <asm/mach-types.h>
15 16
16static int __init shark_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 17static int __init shark_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
17{ 18{
18 if (dev->bus->number == 0) 19 if (dev->bus->number == 0)
19 if (dev->devfn == 0) 20 if (dev->devfn == 0)
@@ -37,8 +38,15 @@ static struct hw_pci shark_pci __initdata = {
37 38
38static int __init shark_pci_init(void) 39static int __init shark_pci_init(void)
39{ 40{
40 if (machine_is_shark()) 41 if (!machine_is_shark())
41 pci_common_init(&shark_pci); 42 return;
43
44 pcibios_min_io = 0x6000;
45 pcibios_min_mem = 0x50000000;
46 vga_base = 0xe8000000;
47
48 pci_common_init(&shark_pci);
49
42 return 0; 50 return 0;
43} 51}
44 52
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index ce5c2513c6c..cdfdd624d21 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -341,6 +341,7 @@ static struct platform_device mipidsi0_device = {
341static struct sh_mobile_sdhi_info sdhi0_info = { 341static struct sh_mobile_sdhi_info sdhi0_info = {
342 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 342 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
343 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 343 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
344 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
344 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 345 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
345 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 346 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
346}; 347};
@@ -382,7 +383,7 @@ void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
382} 383}
383 384
384static struct sh_mobile_sdhi_info sh_sdhi1_info = { 385static struct sh_mobile_sdhi_info sh_sdhi1_info = {
385 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, 386 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
386 .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ, 387 .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ,
387 .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 388 .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
388 .set_pwr = ag5evm_sdhi1_set_pwr, 389 .set_pwr = ag5evm_sdhi1_set_pwr,
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 837138e369b..523f608eb8c 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -957,19 +957,16 @@ static struct resource csi2_resources[] = {
957 }, 957 },
958}; 958};
959 959
960static struct platform_device csi2_device = { 960static struct sh_mobile_ceu_companion csi2 = {
961 .name = "sh-mobile-csi2", 961 .id = 0,
962 .id = 0,
963 .num_resources = ARRAY_SIZE(csi2_resources), 962 .num_resources = ARRAY_SIZE(csi2_resources),
964 .resource = csi2_resources, 963 .resource = csi2_resources,
965 .dev = { 964 .platform_data = &csi2_info,
966 .platform_data = &csi2_info,
967 },
968}; 965};
969 966
970static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 967static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
971 .flags = SH_CEU_FLAG_USE_8BIT_BUS, 968 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
972 .csi2_dev = &csi2_device.dev, 969 .csi2 = &csi2,
973}; 970};
974 971
975static struct resource ceu_resources[] = { 972static struct resource ceu_resources[] = {
@@ -1013,7 +1010,6 @@ static struct platform_device *ap4evb_devices[] __initdata = {
1013 &lcdc1_device, 1010 &lcdc1_device,
1014 &lcdc_device, 1011 &lcdc_device,
1015 &hdmi_device, 1012 &hdmi_device,
1016 &csi2_device,
1017 &ceu_device, 1013 &ceu_device,
1018 &ap4evb_camera, 1014 &ap4evb_camera,
1019 &meram_device, 1015 &meram_device,
@@ -1416,6 +1412,7 @@ static void __init ap4evb_init(void)
1416 fsi_init_pm_clock(); 1412 fsi_init_pm_clock();
1417 sh7372_pm_init(); 1413 sh7372_pm_init();
1418 pm_clk_add(&fsi_device.dev, "spu2"); 1414 pm_clk_add(&fsi_device.dev, "spu2");
1415 pm_clk_add(&lcdc1_device.dev, "hdmi");
1419} 1416}
1420 1417
1421static void __init ap4evb_timer_init(void) 1418static void __init ap4evb_timer_init(void)
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 5b36b6c5b44..17c19dc2560 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -641,6 +641,8 @@ static struct usbhs_private usbhs0_private = {
641 }, 641 },
642 .driver_param = { 642 .driver_param = {
643 .buswait_bwait = 4, 643 .buswait_bwait = 4,
644 .d0_tx_id = SHDMA_SLAVE_USB0_TX,
645 .d1_rx_id = SHDMA_SLAVE_USB0_RX,
644 }, 646 },
645 }, 647 },
646}; 648};
@@ -810,6 +812,8 @@ static struct usbhs_private usbhs1_private = {
810 .buswait_bwait = 4, 812 .buswait_bwait = 4,
811 .pipe_type = usbhs1_pipe_cfg, 813 .pipe_type = usbhs1_pipe_cfg,
812 .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg), 814 .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg),
815 .d0_tx_id = SHDMA_SLAVE_USB1_TX,
816 .d1_rx_id = SHDMA_SLAVE_USB1_RX,
813 }, 817 },
814 }, 818 },
815}; 819};
@@ -1192,8 +1196,8 @@ static struct platform_device sh_mmcif_device = {
1192}; 1196};
1193 1197
1194 1198
1195static int mackerel_camera_add(struct soc_camera_link *icl, struct device *dev); 1199static int mackerel_camera_add(struct soc_camera_device *icd);
1196static void mackerel_camera_del(struct soc_camera_link *icl); 1200static void mackerel_camera_del(struct soc_camera_device *icd);
1197 1201
1198static int camera_set_capture(struct soc_camera_platform_info *info, 1202static int camera_set_capture(struct soc_camera_platform_info *info,
1199 int enable) 1203 int enable)
@@ -1232,16 +1236,15 @@ static void mackerel_camera_release(struct device *dev)
1232 soc_camera_platform_release(&camera_device); 1236 soc_camera_platform_release(&camera_device);
1233} 1237}
1234 1238
1235static int mackerel_camera_add(struct soc_camera_link *icl, 1239static int mackerel_camera_add(struct soc_camera_device *icd)
1236 struct device *dev)
1237{ 1240{
1238 return soc_camera_platform_add(icl, dev, &camera_device, &camera_link, 1241 return soc_camera_platform_add(icd, &camera_device, &camera_link,
1239 mackerel_camera_release, 0); 1242 mackerel_camera_release, 0);
1240} 1243}
1241 1244
1242static void mackerel_camera_del(struct soc_camera_link *icl) 1245static void mackerel_camera_del(struct soc_camera_device *icd)
1243{ 1246{
1244 soc_camera_platform_del(icl, camera_device, &camera_link); 1247 soc_camera_platform_del(icd, camera_device, &camera_link);
1245} 1248}
1246 1249
1247static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 1250static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
@@ -1589,6 +1592,7 @@ static void __init mackerel_init(void)
1589 hdmi_init_pm_clock(); 1592 hdmi_init_pm_clock();
1590 sh7372_pm_init(); 1593 sh7372_pm_init();
1591 pm_clk_add(&fsi_device.dev, "spu2"); 1594 pm_clk_add(&fsi_device.dev, "spu2");
1595 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi");
1592} 1596}
1593 1597
1594static void __init mackerel_timer_init(void) 1598static void __init mackerel_timer_init(void)
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
index 6b186aefcbd..5218c34a9cc 100644
--- a/arch/arm/mach-shmobile/clock-sh7367.c
+++ b/arch/arm/mach-shmobile/clock-sh7367.c
@@ -259,9 +259,6 @@ static struct clk mstp_clks[MSTP_NR] = {
259 [CMMSTP003] = MSTP(&r_clk, CMMSTPCR0, 3, 0), /* KEYSC */ 259 [CMMSTP003] = MSTP(&r_clk, CMMSTPCR0, 3, 0), /* KEYSC */
260}; 260};
261 261
262#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
263#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
264
265static struct clk_lookup lookups[] = { 262static struct clk_lookup lookups[] = {
266 /* main clocks */ 263 /* main clocks */
267 CLKDEV_CON_ID("r_clk", &r_clk), 264 CLKDEV_CON_ID("r_clk", &r_clk),
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 91f5779abdd..66975921e64 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -503,16 +503,17 @@ static struct clk *late_main_clks[] = {
503 &sh7372_fsidivb_clk, 503 &sh7372_fsidivb_clk,
504}; 504};
505 505
506enum { MSTP001, 506enum { MSTP001, MSTP000,
507 MSTP131, MSTP130, 507 MSTP131, MSTP130,
508 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, 508 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125,
509 MSTP118, MSTP117, MSTP116, MSTP113, 509 MSTP118, MSTP117, MSTP116, MSTP113,
510 MSTP106, MSTP101, MSTP100, 510 MSTP106, MSTP101, MSTP100,
511 MSTP223, 511 MSTP223,
512 MSTP218, MSTP217, MSTP216, 512 MSTP218, MSTP217, MSTP216, MSTP214, MSTP208, MSTP207,
513 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 513 MSTP206, MSTP205, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
514 MSTP329, MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312, 514 MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312,
515 MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403, 515 MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP407, MSTP406,
516 MSTP405, MSTP404, MSTP403, MSTP400,
516 MSTP_NR }; 517 MSTP_NR };
517 518
518#define MSTP(_parent, _reg, _bit, _flags) \ 519#define MSTP(_parent, _reg, _bit, _flags) \
@@ -520,6 +521,7 @@ enum { MSTP001,
520 521
521static struct clk mstp_clks[MSTP_NR] = { 522static struct clk mstp_clks[MSTP_NR] = {
522 [MSTP001] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR0, 1, 0), /* IIC2 */ 523 [MSTP001] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR0, 1, 0), /* IIC2 */
524 [MSTP000] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR0, 0, 0), /* MSIOF0 */
523 [MSTP131] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 31, 0), /* VEU3 */ 525 [MSTP131] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 31, 0), /* VEU3 */
524 [MSTP130] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 30, 0), /* VEU2 */ 526 [MSTP130] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 30, 0), /* VEU2 */
525 [MSTP129] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 29, 0), /* VEU1 */ 527 [MSTP129] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 29, 0), /* VEU1 */
@@ -538,14 +540,16 @@ static struct clk mstp_clks[MSTP_NR] = {
538 [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ 540 [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */
539 [MSTP217] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ 541 [MSTP217] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */
540 [MSTP216] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 16, 0), /* DMAC3 */ 542 [MSTP216] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 16, 0), /* DMAC3 */
543 [MSTP214] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 14, 0), /* USBDMAC */
544 [MSTP208] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 8, 0), /* MSIOF1 */
541 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ 545 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
542 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ 546 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
547 [MSTP205] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 5, 0), /* MSIOF2 */
543 [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ 548 [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
544 [MSTP203] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 3, 0), /* SCIFA1 */ 549 [MSTP203] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 3, 0), /* SCIFA1 */
545 [MSTP202] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 2, 0), /* SCIFA2 */ 550 [MSTP202] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 2, 0), /* SCIFA2 */
546 [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */ 551 [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */
547 [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */ 552 [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
548 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
549 [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, 0), /* FSI2 */ 553 [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, 0), /* FSI2 */
550 [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */ 554 [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
551 [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */ 555 [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */
@@ -557,14 +561,14 @@ static struct clk mstp_clks[MSTP_NR] = {
557 [MSTP413] = MSTP(&pllc1_div2_clk, SMSTPCR4, 13, 0), /* HDMI */ 561 [MSTP413] = MSTP(&pllc1_div2_clk, SMSTPCR4, 13, 0), /* HDMI */
558 [MSTP411] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 11, 0), /* IIC3 */ 562 [MSTP411] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 11, 0), /* IIC3 */
559 [MSTP410] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 10, 0), /* IIC4 */ 563 [MSTP410] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 10, 0), /* IIC4 */
564 [MSTP407] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 7, 0), /* USB-DMAC1 */
560 [MSTP406] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 6, 0), /* USB1 */ 565 [MSTP406] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 6, 0), /* USB1 */
566 [MSTP405] = MSTP(&r_clk, SMSTPCR4, 5, 0), /* CMT4 */
567 [MSTP404] = MSTP(&r_clk, SMSTPCR4, 4, 0), /* CMT3 */
561 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ 568 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
569 [MSTP400] = MSTP(&r_clk, SMSTPCR4, 0, 0), /* CMT2 */
562}; 570};
563 571
564#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
565#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
566#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
567
568static struct clk_lookup lookups[] = { 572static struct clk_lookup lookups[] = {
569 /* main clocks */ 573 /* main clocks */
570 CLKDEV_CON_ID("dv_clki_div2_clk", &sh7372_dv_clki_div2_clk), 574 CLKDEV_CON_ID("dv_clki_div2_clk", &sh7372_dv_clki_div2_clk),
@@ -613,6 +617,7 @@ static struct clk_lookup lookups[] = {
613 617
614 /* MSTP32 clocks */ 618 /* MSTP32 clocks */
615 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */ 619 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */
620 CLKDEV_DEV_ID("spi_sh_msiof.0", &mstp_clks[MSTP000]), /* MSIOF0 */
616 CLKDEV_DEV_ID("uio_pdrv_genirq.4", &mstp_clks[MSTP131]), /* VEU3 */ 621 CLKDEV_DEV_ID("uio_pdrv_genirq.4", &mstp_clks[MSTP131]), /* VEU3 */
617 CLKDEV_DEV_ID("uio_pdrv_genirq.3", &mstp_clks[MSTP130]), /* VEU2 */ 622 CLKDEV_DEV_ID("uio_pdrv_genirq.3", &mstp_clks[MSTP130]), /* VEU2 */
618 CLKDEV_DEV_ID("uio_pdrv_genirq.2", &mstp_clks[MSTP129]), /* VEU1 */ 623 CLKDEV_DEV_ID("uio_pdrv_genirq.2", &mstp_clks[MSTP129]), /* VEU1 */
@@ -633,14 +638,16 @@ static struct clk_lookup lookups[] = {
633 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* DMAC1 */ 638 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* DMAC1 */
634 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* DMAC2 */ 639 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* DMAC2 */
635 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), /* DMAC3 */ 640 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), /* DMAC3 */
641 CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]), /* USB-DMAC0 */
642 CLKDEV_DEV_ID("spi_sh_msiof.1", &mstp_clks[MSTP208]), /* MSIOF1 */
636 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ 643 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
637 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP206]), /* SCIFB */ 644 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP206]), /* SCIFB */
645 CLKDEV_DEV_ID("spi_sh_msiof.2", &mstp_clks[MSTP205]), /* MSIOF2 */
638 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ 646 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
639 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ 647 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
640 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */ 648 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */
641 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */ 649 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
642 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ 650 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
643 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
644 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI2 */ 651 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI2 */
645 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */ 652 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */
646 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USB0 */ 653 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USB0 */
@@ -654,11 +661,17 @@ static struct clk_lookup lookups[] = {
654 CLKDEV_DEV_ID("sh-mobile-hdmi", &mstp_clks[MSTP413]), /* HDMI */ 661 CLKDEV_DEV_ID("sh-mobile-hdmi", &mstp_clks[MSTP413]), /* HDMI */
655 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* IIC3 */ 662 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* IIC3 */
656 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* IIC4 */ 663 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* IIC4 */
664 CLKDEV_DEV_ID("sh-dma-engine.4", &mstp_clks[MSTP407]), /* USB-DMAC1 */
657 CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */ 665 CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */
658 CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */ 666 CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */
659 CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[MSTP406]), /* USB1 */ 667 CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[MSTP406]), /* USB1 */
668 CLKDEV_DEV_ID("sh_cmt.4", &mstp_clks[MSTP405]), /* CMT4 */
669 CLKDEV_DEV_ID("sh_cmt.3", &mstp_clks[MSTP404]), /* CMT3 */
660 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ 670 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
671 CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */
661 672
673 CLKDEV_ICK_ID("hdmi", "sh_mobile_lcdc_fb.1",
674 &div6_reparent_clks[DIV6_HDMI]),
662 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]), 675 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
663 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]), 676 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]),
664 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]), 677 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]),
diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c
index 95942466e63..8cee7b151ae 100644
--- a/arch/arm/mach-shmobile/clock-sh7377.c
+++ b/arch/arm/mach-shmobile/clock-sh7377.c
@@ -267,9 +267,6 @@ static struct clk mstp_clks[] = {
267 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ 267 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
268}; 268};
269 269
270#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
271#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
272
273static struct clk_lookup lookups[] = { 270static struct clk_lookup lookups[] = {
274 /* main clocks */ 271 /* main clocks */
275 CLKDEV_CON_ID("r_clk", &r_clk), 272 CLKDEV_CON_ID("r_clk", &r_clk),
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index bcacb1e8cf8..61a846bb30f 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -306,10 +306,6 @@ static struct clk mstp_clks[MSTP_NR] = {
306 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ 306 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
307}; 307};
308 308
309#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
310#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
311#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
312
313static struct clk_lookup lookups[] = { 309static struct clk_lookup lookups[] = {
314 /* main clocks */ 310 /* main clocks */
315 CLKDEV_CON_ID("r_clk", &r_clk), 311 CLKDEV_CON_ID("r_clk", &r_clk),
@@ -369,7 +365,7 @@ void __init sh73a0_clock_init(void)
369 __raw_writel(0x108, SD2CKCR); 365 __raw_writel(0x108, SD2CKCR);
370 366
371 /* detect main clock parent */ 367 /* detect main clock parent */
372 switch ((__raw_readl(CKSCR) >> 24) & 0x03) { 368 switch ((__raw_readl(CKSCR) >> 28) & 0x03) {
373 case 0: 369 case 0:
374 main_clk.parent = &sh73a0_extal1_clk; 370 main_clk.parent = &sh73a0_extal1_clk;
375 break; 371 break;
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index ce595cee86c..24e63a85e66 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -459,6 +459,10 @@ enum {
459 SHDMA_SLAVE_SDHI2_TX, 459 SHDMA_SLAVE_SDHI2_TX,
460 SHDMA_SLAVE_MMCIF_RX, 460 SHDMA_SLAVE_MMCIF_RX,
461 SHDMA_SLAVE_MMCIF_TX, 461 SHDMA_SLAVE_MMCIF_TX,
462 SHDMA_SLAVE_USB0_TX,
463 SHDMA_SLAVE_USB0_RX,
464 SHDMA_SLAVE_USB1_TX,
465 SHDMA_SLAVE_USB1_RX,
462}; 466};
463 467
464extern struct clk sh7372_extal1_clk; 468extern struct clk sh7372_extal1_clk;
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index 3b28743c77e..739315e30eb 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -379,7 +379,7 @@ enum {
379 /* BBIF2 */ 379 /* BBIF2 */
380 VPU, 380 VPU,
381 TSIF1, 381 TSIF1,
382 _3DG_SGX530, 382 /* 3DG */
383 _2DDMAC, 383 _2DDMAC,
384 IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2, 384 IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2,
385 IPMMU_IPMMUR, IPMMU_IPMMUR2, 385 IPMMU_IPMMUR, IPMMU_IPMMUR2,
@@ -436,7 +436,7 @@ static struct intc_vect intcs_vectors[] = {
436 /* BBIF2 */ 436 /* BBIF2 */
437 INTCS_VECT(VPU, 0x980), 437 INTCS_VECT(VPU, 0x980),
438 INTCS_VECT(TSIF1, 0x9a0), 438 INTCS_VECT(TSIF1, 0x9a0),
439 INTCS_VECT(_3DG_SGX530, 0x9e0), 439 /* 3DG */
440 INTCS_VECT(_2DDMAC, 0xa00), 440 INTCS_VECT(_2DDMAC, 0xa00),
441 INTCS_VECT(IIC2_ALI2, 0xa80), INTCS_VECT(IIC2_TACKI2, 0xaa0), 441 INTCS_VECT(IIC2_ALI2, 0xa80), INTCS_VECT(IIC2_TACKI2, 0xaa0),
442 INTCS_VECT(IIC2_WAITI2, 0xac0), INTCS_VECT(IIC2_DTEI2, 0xae0), 442 INTCS_VECT(IIC2_WAITI2, 0xac0), INTCS_VECT(IIC2_DTEI2, 0xae0),
@@ -521,7 +521,7 @@ static struct intc_mask_reg intcs_mask_registers[] = {
521 RTDMAC_1_DEI3, RTDMAC_1_DEI2, RTDMAC_1_DEI1, RTDMAC_1_DEI0 } }, 521 RTDMAC_1_DEI3, RTDMAC_1_DEI2, RTDMAC_1_DEI1, RTDMAC_1_DEI0 } },
522 { 0xffd20198, 0xffd201d8, 8, /* IMR6SA / IMCR6SA */ 522 { 0xffd20198, 0xffd201d8, 8, /* IMR6SA / IMCR6SA */
523 { 0, 0, MSIOF, 0, 523 { 0, 0, MSIOF, 0,
524 _3DG_SGX530, 0, 0, 0 } }, 524 0, 0, 0, 0 } },
525 { 0xffd2019c, 0xffd201dc, 8, /* IMR7SA / IMCR7SA */ 525 { 0xffd2019c, 0xffd201dc, 8, /* IMR7SA / IMCR7SA */
526 { 0, TMU_TUNI2, TMU_TUNI1, TMU_TUNI0, 526 { 0, TMU_TUNI2, TMU_TUNI1, TMU_TUNI0,
527 0, 0, 0, 0 } }, 527 0, 0, 0, 0 } },
@@ -561,7 +561,6 @@ static struct intc_prio_reg intcs_prio_registers[] = {
561 TMU_TUNI2, TSIF1 } }, 561 TMU_TUNI2, TSIF1 } },
562 { 0xffd2001c, 0, 16, 4, /* IPRHS */ { 0, 0, VEU, BEU } }, 562 { 0xffd2001c, 0, 16, 4, /* IPRHS */ { 0, 0, VEU, BEU } },
563 { 0xffd20020, 0, 16, 4, /* IPRIS */ { 0, MSIOF, TSIF0, IIC0 } }, 563 { 0xffd20020, 0, 16, 4, /* IPRIS */ { 0, MSIOF, TSIF0, IIC0 } },
564 { 0xffd20024, 0, 16, 4, /* IPRJS */ { 0, _3DG_SGX530, 0, 0 } },
565 { 0xffd20028, 0, 16, 4, /* IPRKS */ { 0, 0, LMB, 0 } }, 564 { 0xffd20028, 0, 16, 4, /* IPRKS */ { 0, 0, LMB, 0 } },
566 { 0xffd2002c, 0, 16, 4, /* IPRLS */ { IPMMU, 0, 0, 0 } }, 565 { 0xffd2002c, 0, 16, 4, /* IPRLS */ { IPMMU, 0, 0, 0 } },
567 { 0xffd20030, 0, 16, 4, /* IPRMS */ { IIC2, 0, 0, 0 } }, 566 { 0xffd20030, 0, 16, 4, /* IPRMS */ { IIC2, 0, 0, 0 } },
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 79f0413d872..2d9b1b1a253 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -169,35 +169,35 @@ static struct platform_device scif6_device = {
169}; 169};
170 170
171/* CMT */ 171/* CMT */
172static struct sh_timer_config cmt10_platform_data = { 172static struct sh_timer_config cmt2_platform_data = {
173 .name = "CMT10", 173 .name = "CMT2",
174 .channel_offset = 0x10, 174 .channel_offset = 0x40,
175 .timer_bit = 0, 175 .timer_bit = 5,
176 .clockevent_rating = 125, 176 .clockevent_rating = 125,
177 .clocksource_rating = 125, 177 .clocksource_rating = 125,
178}; 178};
179 179
180static struct resource cmt10_resources[] = { 180static struct resource cmt2_resources[] = {
181 [0] = { 181 [0] = {
182 .name = "CMT10", 182 .name = "CMT2",
183 .start = 0xe6138010, 183 .start = 0xe6130040,
184 .end = 0xe613801b, 184 .end = 0xe613004b,
185 .flags = IORESOURCE_MEM, 185 .flags = IORESOURCE_MEM,
186 }, 186 },
187 [1] = { 187 [1] = {
188 .start = evt2irq(0x0b00), /* CMT1_CMT10 */ 188 .start = evt2irq(0x0b80), /* CMT2 */
189 .flags = IORESOURCE_IRQ, 189 .flags = IORESOURCE_IRQ,
190 }, 190 },
191}; 191};
192 192
193static struct platform_device cmt10_device = { 193static struct platform_device cmt2_device = {
194 .name = "sh_cmt", 194 .name = "sh_cmt",
195 .id = 10, 195 .id = 2,
196 .dev = { 196 .dev = {
197 .platform_data = &cmt10_platform_data, 197 .platform_data = &cmt2_platform_data,
198 }, 198 },
199 .resource = cmt10_resources, 199 .resource = cmt2_resources,
200 .num_resources = ARRAY_SIZE(cmt10_resources), 200 .num_resources = ARRAY_SIZE(cmt2_resources),
201}; 201};
202 202
203/* TMU */ 203/* TMU */
@@ -602,6 +602,150 @@ static struct platform_device dma2_device = {
602 }, 602 },
603}; 603};
604 604
605/*
606 * USB-DMAC
607 */
608
609unsigned int usbts_shift[] = {3, 4, 5};
610
611enum {
612 XMIT_SZ_8BYTE = 0,
613 XMIT_SZ_16BYTE = 1,
614 XMIT_SZ_32BYTE = 2,
615};
616
617#define USBTS_INDEX2VAL(i) (((i) & 3) << 6)
618
619static const struct sh_dmae_channel sh7372_usb_dmae_channels[] = {
620 {
621 .offset = 0,
622 }, {
623 .offset = 0x20,
624 },
625};
626
627/* USB DMAC0 */
628static const struct sh_dmae_slave_config sh7372_usb_dmae0_slaves[] = {
629 {
630 .slave_id = SHDMA_SLAVE_USB0_TX,
631 .chcr = USBTS_INDEX2VAL(XMIT_SZ_8BYTE),
632 }, {
633 .slave_id = SHDMA_SLAVE_USB0_RX,
634 .chcr = USBTS_INDEX2VAL(XMIT_SZ_8BYTE),
635 },
636};
637
638static struct sh_dmae_pdata usb_dma0_platform_data = {
639 .slave = sh7372_usb_dmae0_slaves,
640 .slave_num = ARRAY_SIZE(sh7372_usb_dmae0_slaves),
641 .channel = sh7372_usb_dmae_channels,
642 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
643 .ts_low_shift = 6,
644 .ts_low_mask = 0xc0,
645 .ts_high_shift = 0,
646 .ts_high_mask = 0,
647 .ts_shift = usbts_shift,
648 .ts_shift_num = ARRAY_SIZE(usbts_shift),
649 .dmaor_init = DMAOR_DME,
650 .chcr_offset = 0x14,
651 .chcr_ie_bit = 1 << 5,
652 .dmaor_is_32bit = 1,
653 .needs_tend_set = 1,
654 .no_dmars = 1,
655};
656
657static struct resource sh7372_usb_dmae0_resources[] = {
658 {
659 /* Channel registers and DMAOR */
660 .start = 0xe68a0020,
661 .end = 0xe68a0064 - 1,
662 .flags = IORESOURCE_MEM,
663 },
664 {
665 /* VCR/SWR/DMICR */
666 .start = 0xe68a0000,
667 .end = 0xe68a0014 - 1,
668 .flags = IORESOURCE_MEM,
669 },
670 {
671 /* IRQ for channels */
672 .start = evt2irq(0x0a00),
673 .end = evt2irq(0x0a00),
674 .flags = IORESOURCE_IRQ,
675 },
676};
677
678static struct platform_device usb_dma0_device = {
679 .name = "sh-dma-engine",
680 .id = 3,
681 .resource = sh7372_usb_dmae0_resources,
682 .num_resources = ARRAY_SIZE(sh7372_usb_dmae0_resources),
683 .dev = {
684 .platform_data = &usb_dma0_platform_data,
685 },
686};
687
688/* USB DMAC1 */
689static const struct sh_dmae_slave_config sh7372_usb_dmae1_slaves[] = {
690 {
691 .slave_id = SHDMA_SLAVE_USB1_TX,
692 .chcr = USBTS_INDEX2VAL(XMIT_SZ_8BYTE),
693 }, {
694 .slave_id = SHDMA_SLAVE_USB1_RX,
695 .chcr = USBTS_INDEX2VAL(XMIT_SZ_8BYTE),
696 },
697};
698
699static struct sh_dmae_pdata usb_dma1_platform_data = {
700 .slave = sh7372_usb_dmae1_slaves,
701 .slave_num = ARRAY_SIZE(sh7372_usb_dmae1_slaves),
702 .channel = sh7372_usb_dmae_channels,
703 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
704 .ts_low_shift = 6,
705 .ts_low_mask = 0xc0,
706 .ts_high_shift = 0,
707 .ts_high_mask = 0,
708 .ts_shift = usbts_shift,
709 .ts_shift_num = ARRAY_SIZE(usbts_shift),
710 .dmaor_init = DMAOR_DME,
711 .chcr_offset = 0x14,
712 .chcr_ie_bit = 1 << 5,
713 .dmaor_is_32bit = 1,
714 .needs_tend_set = 1,
715 .no_dmars = 1,
716};
717
718static struct resource sh7372_usb_dmae1_resources[] = {
719 {
720 /* Channel registers and DMAOR */
721 .start = 0xe68c0020,
722 .end = 0xe68c0064 - 1,
723 .flags = IORESOURCE_MEM,
724 },
725 {
726 /* VCR/SWR/DMICR */
727 .start = 0xe68c0000,
728 .end = 0xe68c0014 - 1,
729 .flags = IORESOURCE_MEM,
730 },
731 {
732 /* IRQ for channels */
733 .start = evt2irq(0x1d00),
734 .end = evt2irq(0x1d00),
735 .flags = IORESOURCE_IRQ,
736 },
737};
738
739static struct platform_device usb_dma1_device = {
740 .name = "sh-dma-engine",
741 .id = 4,
742 .resource = sh7372_usb_dmae1_resources,
743 .num_resources = ARRAY_SIZE(sh7372_usb_dmae1_resources),
744 .dev = {
745 .platform_data = &usb_dma1_platform_data,
746 },
747};
748
605/* VPU */ 749/* VPU */
606static struct uio_info vpu_platform_data = { 750static struct uio_info vpu_platform_data = {
607 .name = "VPU5HG", 751 .name = "VPU5HG",
@@ -818,7 +962,7 @@ static struct platform_device *sh7372_early_devices[] __initdata = {
818 &scif4_device, 962 &scif4_device,
819 &scif5_device, 963 &scif5_device,
820 &scif6_device, 964 &scif6_device,
821 &cmt10_device, 965 &cmt2_device,
822 &tmu00_device, 966 &tmu00_device,
823 &tmu01_device, 967 &tmu01_device,
824}; 968};
@@ -829,6 +973,8 @@ static struct platform_device *sh7372_late_devices[] __initdata = {
829 &dma0_device, 973 &dma0_device,
830 &dma1_device, 974 &dma1_device,
831 &dma2_device, 975 &dma2_device,
976 &usb_dma0_device,
977 &usb_dma1_device,
832 &vpu_device, 978 &vpu_device,
833 &veu0_device, 979 &veu0_device,
834 &veu1_device, 980 &veu1_device,
diff --git a/arch/arm/mach-spear3xx/include/mach/clkdev.h b/arch/arm/mach-spear3xx/include/mach/clkdev.h
deleted file mode 100644
index a3d07339d9f..00000000000
--- a/arch/arm/mach-spear3xx/include/mach/clkdev.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/clkdev.h
3 *
4 * Clock Dev framework definitions for SPEAr3xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_CLKDEV_H
15#define __MACH_CLKDEV_H
16
17#include <plat/clkdev.h>
18
19#endif /* __MACH_CLKDEV_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/clkdev.h b/arch/arm/mach-spear6xx/include/mach/clkdev.h
deleted file mode 100644
index 05676bf440d..00000000000
--- a/arch/arm/mach-spear6xx/include/mach/clkdev.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/clkdev.h
3 *
4 * Clock Dev framework definitions for SPEAr6xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_CLKDEV_H
15#define __MACH_CLKDEV_H
16
17#include <plat/clkdev.h>
18
19#endif /* __MACH_CLKDEV_H */
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 5ec1846aa1d..d82ebab50e1 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -27,14 +27,14 @@ comment "Tegra board type"
27 27
28config MACH_HARMONY 28config MACH_HARMONY
29 bool "Harmony board" 29 bool "Harmony board"
30 select MACH_HAS_SND_SOC_TEGRA_WM8903 30 select MACH_HAS_SND_SOC_TEGRA_WM8903 if SND_SOC
31 help 31 help
32 Support for nVidia Harmony development platform 32 Support for nVidia Harmony development platform
33 33
34config MACH_KAEN 34config MACH_KAEN
35 bool "Kaen board" 35 bool "Kaen board"
36 select MACH_SEABOARD 36 select MACH_SEABOARD
37 select MACH_HAS_SND_SOC_TEGRA_WM8903 37 select MACH_HAS_SND_SOC_TEGRA_WM8903 if SND_SOC
38 help 38 help
39 Support for the Kaen version of Seaboard 39 Support for the Kaen version of Seaboard
40 40
@@ -45,12 +45,18 @@ config MACH_PAZ00
45 45
46config MACH_SEABOARD 46config MACH_SEABOARD
47 bool "Seaboard board" 47 bool "Seaboard board"
48 select MACH_HAS_SND_SOC_TEGRA_WM8903 48 select MACH_HAS_SND_SOC_TEGRA_WM8903 if SND_SOC
49 help 49 help
50 Support for nVidia Seaboard development platform. It will 50 Support for nVidia Seaboard development platform. It will
51 also be included for some of the derivative boards that 51 also be included for some of the derivative boards that
52 have large similarities with the seaboard design. 52 have large similarities with the seaboard design.
53 53
54config MACH_TEGRA_DT
55 bool "Generic Tegra board (FDT support)"
56 select USE_OF
57 help
58 Support for generic nVidia Tegra boards using Flattened Device Tree
59
54config MACH_TRIMSLICE 60config MACH_TRIMSLICE
55 bool "TrimSlice board" 61 bool "TrimSlice board"
56 select TEGRA_PCI 62 select TEGRA_PCI
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index ed58ef9019b..f11b9100114 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -29,5 +29,8 @@ obj-${CONFIG_MACH_PAZ00} += board-paz00-pinmux.o
29obj-${CONFIG_MACH_SEABOARD} += board-seaboard.o 29obj-${CONFIG_MACH_SEABOARD} += board-seaboard.o
30obj-${CONFIG_MACH_SEABOARD} += board-seaboard-pinmux.o 30obj-${CONFIG_MACH_SEABOARD} += board-seaboard-pinmux.o
31 31
32obj-${CONFIG_MACH_TEGRA_DT} += board-dt.o
33obj-${CONFIG_MACH_TEGRA_DT} += board-harmony-pinmux.o
34
32obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice.o 35obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice.o
33obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice-pinmux.o 36obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice-pinmux.o
diff --git a/arch/arm/mach-tegra/Makefile.boot b/arch/arm/mach-tegra/Makefile.boot
index db52d61a738..428ad122be0 100644
--- a/arch/arm/mach-tegra/Makefile.boot
+++ b/arch/arm/mach-tegra/Makefile.boot
@@ -1,3 +1,6 @@
1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000 1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000
2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100 2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100
3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000 3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000
4
5dtb-$(CONFIG_MACH_HARMONY) += tegra-harmony.dtb
6dtb-$(CONFIG_MACH_SEABOARD) += tegra-seaboard.dtb
diff --git a/arch/arm/mach-tegra/board-dt.c b/arch/arm/mach-tegra/board-dt.c
new file mode 100644
index 00000000000..9f47e04446f
--- /dev/null
+++ b/arch/arm/mach-tegra/board-dt.c
@@ -0,0 +1,119 @@
1/*
2 * nVidia Tegra device tree board support
3 *
4 * Copyright (C) 2010 Secret Lab Technologies, Ltd.
5 * Copyright (C) 2010 Google, Inc.
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#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/serial_8250.h>
22#include <linux/clk.h>
23#include <linux/dma-mapping.h>
24#include <linux/irqdomain.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
27#include <linux/of_fdt.h>
28#include <linux/of_irq.h>
29#include <linux/of_platform.h>
30#include <linux/pda_power.h>
31#include <linux/io.h>
32#include <linux/i2c.h>
33#include <linux/i2c-tegra.h>
34
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/mach/time.h>
38#include <asm/setup.h>
39
40#include <mach/iomap.h>
41#include <mach/irqs.h>
42
43#include "board.h"
44#include "board-harmony.h"
45#include "clock.h"
46#include "devices.h"
47
48void harmony_pinmux_init(void);
49void seaboard_pinmux_init(void);
50
51
52struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
53 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL),
54 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL),
55 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, "sdhci-tegra.2", NULL),
56 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC4_BASE, "sdhci-tegra.3", NULL),
57 OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C_BASE, "tegra-i2c.0", NULL),
58 OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C2_BASE, "tegra-i2c.1", NULL),
59 OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C3_BASE, "tegra-i2c.2", NULL),
60 OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_DVC_BASE, "tegra-i2c.3", NULL),
61 OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.0", NULL),
62 OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.1", NULL),
63 OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, "tegra-das", NULL),
64 {}
65};
66
67static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
68 /* name parent rate enabled */
69 { "uartd", "pll_p", 216000000, true },
70 { NULL, NULL, 0, 0},
71};
72
73static struct of_device_id tegra_dt_match_table[] __initdata = {
74 { .compatible = "simple-bus", },
75 {}
76};
77
78static struct of_device_id tegra_dt_gic_match[] __initdata = {
79 { .compatible = "nvidia,tegra20-gic", },
80 {}
81};
82
83static void __init tegra_dt_init(void)
84{
85 struct device_node *node;
86
87 node = of_find_matching_node_by_address(NULL, tegra_dt_gic_match,
88 TEGRA_ARM_INT_DIST_BASE);
89 if (node)
90 irq_domain_add_simple(node, INT_GIC_BASE);
91
92 tegra_clk_init_from_table(tegra_dt_clk_init_table);
93
94 if (of_machine_is_compatible("nvidia,harmony"))
95 harmony_pinmux_init();
96 else if (of_machine_is_compatible("nvidia,seaboard"))
97 seaboard_pinmux_init();
98
99 /*
100 * Finished with the static registrations now; fill in the missing
101 * devices
102 */
103 of_platform_populate(NULL, tegra_dt_match_table, tegra20_auxdata_lookup, NULL);
104}
105
106static const char * tegra_dt_board_compat[] = {
107 "nvidia,harmony",
108 "nvidia,seaboard",
109 NULL
110};
111
112DT_MACHINE_START(TEGRA_DT, "nVidia Tegra (Flattened Device Tree)")
113 .map_io = tegra_map_common_io,
114 .init_early = tegra_init_early,
115 .init_irq = tegra_init_irq,
116 .timer = &tegra_timer,
117 .init_machine = tegra_dt_init,
118 .dt_compat = tegra_dt_board_compat,
119MACHINE_END
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index 30e18bc6064..846cd7d69e3 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -25,7 +25,6 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c-tegra.h>
29 28
30#include <sound/wm8903.h> 29#include <sound/wm8903.h>
31 30
@@ -83,22 +82,6 @@ static struct platform_device harmony_audio_device = {
83 }, 82 },
84}; 83};
85 84
86static struct tegra_i2c_platform_data harmony_i2c1_platform_data = {
87 .bus_clk_rate = 400000,
88};
89
90static struct tegra_i2c_platform_data harmony_i2c2_platform_data = {
91 .bus_clk_rate = 400000,
92};
93
94static struct tegra_i2c_platform_data harmony_i2c3_platform_data = {
95 .bus_clk_rate = 400000,
96};
97
98static struct tegra_i2c_platform_data harmony_dvc_platform_data = {
99 .bus_clk_rate = 400000,
100};
101
102static struct wm8903_platform_data harmony_wm8903_pdata = { 85static struct wm8903_platform_data harmony_wm8903_pdata = {
103 .irq_active_low = 0, 86 .irq_active_low = 0,
104 .micdet_cfg = 0, 87 .micdet_cfg = 0,
@@ -121,11 +104,6 @@ static struct i2c_board_info __initdata wm8903_board_info = {
121 104
122static void __init harmony_i2c_init(void) 105static void __init harmony_i2c_init(void)
123{ 106{
124 tegra_i2c_device1.dev.platform_data = &harmony_i2c1_platform_data;
125 tegra_i2c_device2.dev.platform_data = &harmony_i2c2_platform_data;
126 tegra_i2c_device3.dev.platform_data = &harmony_i2c3_platform_data;
127 tegra_i2c_device4.dev.platform_data = &harmony_dvc_platform_data;
128
129 platform_device_register(&tegra_i2c_device1); 107 platform_device_register(&tegra_i2c_device1);
130 platform_device_register(&tegra_i2c_device2); 108 platform_device_register(&tegra_i2c_device2);
131 platform_device_register(&tegra_i2c_device3); 109 platform_device_register(&tegra_i2c_device3);
diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c
index 2643d1bd568..bdd2627dd87 100644
--- a/arch/arm/mach-tegra/board-paz00-pinmux.c
+++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
@@ -141,12 +141,10 @@ static struct tegra_pingroup_config paz00_pinmux[] = {
141}; 141};
142 142
143static struct tegra_gpio_table gpio_table[] = { 143static struct tegra_gpio_table gpio_table[] = {
144 { .gpio = TEGRA_GPIO_SD1_CD, .enable = true }, 144 { .gpio = TEGRA_GPIO_SD1_CD, .enable = true },
145 { .gpio = TEGRA_GPIO_SD1_WP, .enable = true }, 145 { .gpio = TEGRA_GPIO_SD1_WP, .enable = true },
146 { .gpio = TEGRA_GPIO_SD1_POWER, .enable = true }, 146 { .gpio = TEGRA_GPIO_SD1_POWER, .enable = true },
147 { .gpio = TEGRA_GPIO_SD4_CD, .enable = true }, 147 { .gpio = TEGRA_ULPI_RST, .enable = true },
148 { .gpio = TEGRA_GPIO_SD4_WP, .enable = true },
149 { .gpio = TEGRA_GPIO_SD4_POWER, .enable = true },
150}; 148};
151 149
152void paz00_pinmux_init(void) 150void paz00_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 57e50a823ee..ea2f79c9879 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -25,6 +25,7 @@
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/pda_power.h> 26#include <linux/pda_power.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/i2c.h>
28 29
29#include <asm/mach-types.h> 30#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
@@ -34,6 +35,7 @@
34#include <mach/iomap.h> 35#include <mach/iomap.h>
35#include <mach/irqs.h> 36#include <mach/irqs.h>
36#include <mach/sdhci.h> 37#include <mach/sdhci.h>
38#include <mach/gpio.h>
37 39
38#include "board.h" 40#include "board.h"
39#include "board-paz00.h" 41#include "board-paz00.h"
@@ -66,10 +68,22 @@ static struct platform_device debug_uart = {
66static struct platform_device *paz00_devices[] __initdata = { 68static struct platform_device *paz00_devices[] __initdata = {
67 &debug_uart, 69 &debug_uart,
68 &tegra_sdhci_device1, 70 &tegra_sdhci_device1,
69 &tegra_sdhci_device2,
70 &tegra_sdhci_device4, 71 &tegra_sdhci_device4,
71}; 72};
72 73
74static void paz00_i2c_init(void)
75{
76 platform_device_register(&tegra_i2c_device1);
77 platform_device_register(&tegra_i2c_device2);
78 platform_device_register(&tegra_i2c_device4);
79}
80
81static void paz00_usb_init(void)
82{
83 platform_device_register(&tegra_ehci2_device);
84 platform_device_register(&tegra_ehci3_device);
85}
86
73static void __init tegra_paz00_fixup(struct machine_desc *desc, 87static void __init tegra_paz00_fixup(struct machine_desc *desc,
74 struct tag *tags, char **cmdline, struct meminfo *mi) 88 struct tag *tags, char **cmdline, struct meminfo *mi)
75{ 89{
@@ -84,23 +98,16 @@ static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
84 { NULL, NULL, 0, 0}, 98 { NULL, NULL, 0, 0},
85}; 99};
86 100
87
88static struct tegra_sdhci_platform_data sdhci_pdata1 = { 101static struct tegra_sdhci_platform_data sdhci_pdata1 = {
89 .cd_gpio = TEGRA_GPIO_SD1_CD, 102 .cd_gpio = TEGRA_GPIO_SD1_CD,
90 .wp_gpio = TEGRA_GPIO_SD1_WP, 103 .wp_gpio = TEGRA_GPIO_SD1_WP,
91 .power_gpio = TEGRA_GPIO_SD1_POWER, 104 .power_gpio = TEGRA_GPIO_SD1_POWER,
92}; 105};
93 106
94static struct tegra_sdhci_platform_data sdhci_pdata2 = { 107static struct tegra_sdhci_platform_data sdhci_pdata4 = {
95 .cd_gpio = -1, 108 .cd_gpio = -1,
96 .wp_gpio = -1, 109 .wp_gpio = -1,
97 .power_gpio = -1, 110 .power_gpio = -1,
98};
99
100static struct tegra_sdhci_platform_data sdhci_pdata4 = {
101 .cd_gpio = TEGRA_GPIO_SD4_CD,
102 .wp_gpio = TEGRA_GPIO_SD4_WP,
103 .power_gpio = TEGRA_GPIO_SD4_POWER,
104 .is_8bit = 1, 111 .is_8bit = 1,
105}; 112};
106 113
@@ -111,13 +118,15 @@ static void __init tegra_paz00_init(void)
111 paz00_pinmux_init(); 118 paz00_pinmux_init();
112 119
113 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; 120 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
114 tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
115 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; 121 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
116 122
117 platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices)); 123 platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices));
124
125 paz00_i2c_init();
126 paz00_usb_init();
118} 127}
119 128
120MACHINE_START(PAZ00, "paz00") 129MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
121 .boot_params = 0x00000100, 130 .boot_params = 0x00000100,
122 .fixup = tegra_paz00_fixup, 131 .fixup = tegra_paz00_fixup,
123 .map_io = tegra_map_common_io, 132 .map_io = tegra_map_common_io,
diff --git a/arch/arm/mach-tegra/board-paz00.h b/arch/arm/mach-tegra/board-paz00.h
index da193ca76d3..d4ff39ddaeb 100644
--- a/arch/arm/mach-tegra/board-paz00.h
+++ b/arch/arm/mach-tegra/board-paz00.h
@@ -17,12 +17,10 @@
17#ifndef _MACH_TEGRA_BOARD_PAZ00_H 17#ifndef _MACH_TEGRA_BOARD_PAZ00_H
18#define _MACH_TEGRA_BOARD_PAZ00_H 18#define _MACH_TEGRA_BOARD_PAZ00_H
19 19
20#define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5 20#define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5
21#define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1 21#define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1
22#define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PT3 22#define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PT3
23#define TEGRA_GPIO_SD4_CD TEGRA_GPIO_PH2 23#define TEGRA_ULPI_RST TEGRA_GPIO_PV0
24#define TEGRA_GPIO_SD4_WP TEGRA_GPIO_PH3
25#define TEGRA_GPIO_SD4_POWER TEGRA_GPIO_PI6
26 24
27void paz00_pinmux_init(void); 25void paz00_pinmux_init(void);
28 26
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c
index 10fbbdc8699..56cbabf6aa6 100644
--- a/arch/arm/mach-tegra/board-seaboard.c
+++ b/arch/arm/mach-tegra/board-seaboard.c
@@ -19,7 +19,6 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/serial_8250.h> 20#include <linux/serial_8250.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/i2c-tegra.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
24#include <linux/input.h> 23#include <linux/input.h>
25#include <linux/io.h> 24#include <linux/io.h>
@@ -66,22 +65,6 @@ static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = {
66 { NULL, NULL, 0, 0}, 65 { NULL, NULL, 0, 0},
67}; 66};
68 67
69static struct tegra_i2c_platform_data seaboard_i2c1_platform_data = {
70 .bus_clk_rate = 400000.
71};
72
73static struct tegra_i2c_platform_data seaboard_i2c2_platform_data = {
74 .bus_clk_rate = 400000,
75};
76
77static struct tegra_i2c_platform_data seaboard_i2c3_platform_data = {
78 .bus_clk_rate = 400000,
79};
80
81static struct tegra_i2c_platform_data seaboard_dvc_platform_data = {
82 .bus_clk_rate = 400000,
83};
84
85static struct gpio_keys_button seaboard_gpio_keys_buttons[] = { 68static struct gpio_keys_button seaboard_gpio_keys_buttons[] = {
86 { 69 {
87 .code = SW_LID, 70 .code = SW_LID,
@@ -137,9 +120,9 @@ static struct tegra_sdhci_platform_data sdhci_pdata4 = {
137static struct platform_device *seaboard_devices[] __initdata = { 120static struct platform_device *seaboard_devices[] __initdata = {
138 &debug_uart, 121 &debug_uart,
139 &tegra_pmu_device, 122 &tegra_pmu_device,
140 &tegra_sdhci_device1,
141 &tegra_sdhci_device3,
142 &tegra_sdhci_device4, 123 &tegra_sdhci_device4,
124 &tegra_sdhci_device3,
125 &tegra_sdhci_device1,
143 &seaboard_gpio_keys_device, 126 &seaboard_gpio_keys_device,
144}; 127};
145 128
@@ -161,11 +144,6 @@ static void __init seaboard_i2c_init(void)
161 144
162 i2c_register_board_info(3, &adt7461_device, 1); 145 i2c_register_board_info(3, &adt7461_device, 1);
163 146
164 tegra_i2c_device1.dev.platform_data = &seaboard_i2c1_platform_data;
165 tegra_i2c_device2.dev.platform_data = &seaboard_i2c2_platform_data;
166 tegra_i2c_device3.dev.platform_data = &seaboard_i2c3_platform_data;
167 tegra_i2c_device4.dev.platform_data = &seaboard_dvc_platform_data;
168
169 platform_device_register(&tegra_i2c_device1); 147 platform_device_register(&tegra_i2c_device1);
170 platform_device_register(&tegra_i2c_device2); 148 platform_device_register(&tegra_i2c_device2);
171 platform_device_register(&tegra_i2c_device3); 149 platform_device_register(&tegra_i2c_device3);
diff --git a/arch/arm/mach-tegra/board-trimslice-pinmux.c b/arch/arm/mach-tegra/board-trimslice-pinmux.c
index d9dc5d297ed..47c596cdbf3 100644
--- a/arch/arm/mach-tegra/board-trimslice-pinmux.c
+++ b/arch/arm/mach-tegra/board-trimslice-pinmux.c
@@ -29,7 +29,7 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = {
29 {TEGRA_PINGROUP_ATC, TEGRA_MUX_NAND, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 29 {TEGRA_PINGROUP_ATC, TEGRA_MUX_NAND, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
30 {TEGRA_PINGROUP_ATD, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 30 {TEGRA_PINGROUP_ATD, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
31 {TEGRA_PINGROUP_ATE, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 31 {TEGRA_PINGROUP_ATE, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
32 {TEGRA_PINGROUP_CDEV1, TEGRA_MUX_OSC, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 32 {TEGRA_PINGROUP_CDEV1, TEGRA_MUX_PLLA_OUT, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
33 {TEGRA_PINGROUP_CDEV2, TEGRA_MUX_PLLP_OUT4, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 33 {TEGRA_PINGROUP_CDEV2, TEGRA_MUX_PLLP_OUT4, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
34 {TEGRA_PINGROUP_CRTP, TEGRA_MUX_CRT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 34 {TEGRA_PINGROUP_CRTP, TEGRA_MUX_CRT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
35 {TEGRA_PINGROUP_CSUS, TEGRA_MUX_VI_SENSOR_CLK, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 35 {TEGRA_PINGROUP_CSUS, TEGRA_MUX_VI_SENSOR_CLK, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
@@ -126,7 +126,7 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = {
126 {TEGRA_PINGROUP_SPIH, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 126 {TEGRA_PINGROUP_SPIH, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
127 {TEGRA_PINGROUP_UAA, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 127 {TEGRA_PINGROUP_UAA, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
128 {TEGRA_PINGROUP_UAB, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 128 {TEGRA_PINGROUP_UAB, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
129 {TEGRA_PINGROUP_UAC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 129 {TEGRA_PINGROUP_UAC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
130 {TEGRA_PINGROUP_UAD, TEGRA_MUX_IRDA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 130 {TEGRA_PINGROUP_UAD, TEGRA_MUX_IRDA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
131 {TEGRA_PINGROUP_UCA, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 131 {TEGRA_PINGROUP_UCA, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
132 {TEGRA_PINGROUP_UCB, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 132 {TEGRA_PINGROUP_UCB, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
@@ -145,6 +145,9 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = {
145static struct tegra_gpio_table gpio_table[] = { 145static struct tegra_gpio_table gpio_table[] = {
146 { .gpio = TRIMSLICE_GPIO_SD4_CD, .enable = true }, /* mmc4 cd */ 146 { .gpio = TRIMSLICE_GPIO_SD4_CD, .enable = true }, /* mmc4 cd */
147 { .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true }, /* mmc4 wp */ 147 { .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true }, /* mmc4 wp */
148
149 { .gpio = TRIMSLICE_GPIO_USB1_MODE, .enable = true }, /* USB1 mode */
150 { .gpio = TRIMSLICE_GPIO_USB2_RST, .enable = true }, /* USB2 PHY rst */
148}; 151};
149 152
150void __init trimslice_pinmux_init(void) 153void __init trimslice_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index cda4cfd78e8..89a6d2adc1d 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -23,6 +23,8 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/i2c.h>
27#include <linux/gpio.h>
26 28
27#include <asm/mach-types.h> 29#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
@@ -30,6 +32,7 @@
30 32
31#include <mach/iomap.h> 33#include <mach/iomap.h>
32#include <mach/sdhci.h> 34#include <mach/sdhci.h>
35#include <mach/gpio.h>
33 36
34#include "board.h" 37#include "board.h"
35#include "clock.h" 38#include "clock.h"
@@ -71,12 +74,58 @@ static struct tegra_sdhci_platform_data sdhci_pdata4 = {
71 .power_gpio = -1, 74 .power_gpio = -1,
72}; 75};
73 76
77static struct platform_device trimslice_audio_device = {
78 .name = "tegra-snd-trimslice",
79 .id = 0,
80};
81
74static struct platform_device *trimslice_devices[] __initdata = { 82static struct platform_device *trimslice_devices[] __initdata = {
75 &debug_uart, 83 &debug_uart,
76 &tegra_sdhci_device1, 84 &tegra_sdhci_device1,
77 &tegra_sdhci_device4, 85 &tegra_sdhci_device4,
86 &tegra_i2s_device1,
87 &tegra_das_device,
88 &tegra_pcm_device,
89 &trimslice_audio_device,
78}; 90};
79 91
92static struct i2c_board_info trimslice_i2c3_board_info[] = {
93 {
94 I2C_BOARD_INFO("tlv320aic23", 0x1a),
95 },
96 {
97 I2C_BOARD_INFO("em3027", 0x56),
98 },
99};
100
101static void trimslice_i2c_init(void)
102{
103 platform_device_register(&tegra_i2c_device1);
104 platform_device_register(&tegra_i2c_device2);
105 platform_device_register(&tegra_i2c_device3);
106
107 i2c_register_board_info(2, trimslice_i2c3_board_info,
108 ARRAY_SIZE(trimslice_i2c3_board_info));
109}
110
111static void trimslice_usb_init(void)
112{
113 int err;
114
115 platform_device_register(&tegra_ehci3_device);
116
117 platform_device_register(&tegra_ehci2_device);
118
119 err = gpio_request_one(TRIMSLICE_GPIO_USB1_MODE, GPIOF_OUT_INIT_HIGH,
120 "usb1mode");
121 if (err) {
122 pr_err("TrimSlice: failed to obtain USB1 mode gpio: %d\n", err);
123 return;
124 }
125
126 platform_device_register(&tegra_ehci1_device);
127}
128
80static void __init tegra_trimslice_fixup(struct machine_desc *desc, 129static void __init tegra_trimslice_fixup(struct machine_desc *desc,
81 struct tag *tags, char **cmdline, struct meminfo *mi) 130 struct tag *tags, char **cmdline, struct meminfo *mi)
82{ 131{
@@ -90,6 +139,10 @@ static void __init tegra_trimslice_fixup(struct machine_desc *desc,
90static __initdata struct tegra_clk_init_table trimslice_clk_init_table[] = { 139static __initdata struct tegra_clk_init_table trimslice_clk_init_table[] = {
91 /* name parent rate enabled */ 140 /* name parent rate enabled */
92 { "uarta", "pll_p", 216000000, true }, 141 { "uarta", "pll_p", 216000000, true },
142 { "pll_a", "pll_p_out1", 56448000, true },
143 { "pll_a_out0", "pll_a", 11289600, true },
144 { "cdev1", NULL, 0, true },
145 { "i2s1", "pll_a_out0", 11289600, false},
93 { NULL, NULL, 0, 0}, 146 { NULL, NULL, 0, 0},
94}; 147};
95 148
@@ -112,6 +165,9 @@ static void __init tegra_trimslice_init(void)
112 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; 165 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
113 166
114 platform_add_devices(trimslice_devices, ARRAY_SIZE(trimslice_devices)); 167 platform_add_devices(trimslice_devices, ARRAY_SIZE(trimslice_devices));
168
169 trimslice_i2c_init();
170 trimslice_usb_init();
115} 171}
116 172
117MACHINE_START(TRIMSLICE, "trimslice") 173MACHINE_START(TRIMSLICE, "trimslice")
diff --git a/arch/arm/mach-tegra/board-trimslice.h b/arch/arm/mach-tegra/board-trimslice.h
index e8ef6291c6f..7a7dee86b4d 100644
--- a/arch/arm/mach-tegra/board-trimslice.h
+++ b/arch/arm/mach-tegra/board-trimslice.h
@@ -20,6 +20,9 @@
20#define TRIMSLICE_GPIO_SD4_CD TEGRA_GPIO_PP1 /* mmc4 cd */ 20#define TRIMSLICE_GPIO_SD4_CD TEGRA_GPIO_PP1 /* mmc4 cd */
21#define TRIMSLICE_GPIO_SD4_WP TEGRA_GPIO_PP2 /* mmc4 wp */ 21#define TRIMSLICE_GPIO_SD4_WP TEGRA_GPIO_PP2 /* mmc4 wp */
22 22
23#define TRIMSLICE_GPIO_USB1_MODE TEGRA_GPIO_PV2 /* USB1 mode */
24#define TRIMSLICE_GPIO_USB2_RST TEGRA_GPIO_PV0 /* USB2 PHY reset */
25
23void trimslice_pinmux_init(void); 26void trimslice_pinmux_init(void);
24 27
25#endif 28#endif
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 1528f9daef1..57e35d20c24 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -22,10 +22,14 @@
22#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/fsl_devices.h> 23#include <linux/fsl_devices.h>
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25#include <linux/i2c-tegra.h>
26#include <linux/platform_data/tegra_usb.h>
25#include <asm/pmu.h> 27#include <asm/pmu.h>
26#include <mach/irqs.h> 28#include <mach/irqs.h>
27#include <mach/iomap.h> 29#include <mach/iomap.h>
28#include <mach/dma.h> 30#include <mach/dma.h>
31#include <mach/usb_phy.h>
32#include "gpio-names.h"
29 33
30static struct resource i2c_resource1[] = { 34static struct resource i2c_resource1[] = {
31 [0] = { 35 [0] = {
@@ -79,13 +83,29 @@ static struct resource i2c_resource4[] = {
79 }, 83 },
80}; 84};
81 85
86static struct tegra_i2c_platform_data tegra_i2c1_platform_data = {
87 .bus_clk_rate = 400000,
88};
89
90static struct tegra_i2c_platform_data tegra_i2c2_platform_data = {
91 .bus_clk_rate = 400000,
92};
93
94static struct tegra_i2c_platform_data tegra_i2c3_platform_data = {
95 .bus_clk_rate = 400000,
96};
97
98static struct tegra_i2c_platform_data tegra_dvc_platform_data = {
99 .bus_clk_rate = 400000,
100};
101
82struct platform_device tegra_i2c_device1 = { 102struct platform_device tegra_i2c_device1 = {
83 .name = "tegra-i2c", 103 .name = "tegra-i2c",
84 .id = 0, 104 .id = 0,
85 .resource = i2c_resource1, 105 .resource = i2c_resource1,
86 .num_resources = ARRAY_SIZE(i2c_resource1), 106 .num_resources = ARRAY_SIZE(i2c_resource1),
87 .dev = { 107 .dev = {
88 .platform_data = 0, 108 .platform_data = &tegra_i2c1_platform_data,
89 }, 109 },
90}; 110};
91 111
@@ -95,7 +115,7 @@ struct platform_device tegra_i2c_device2 = {
95 .resource = i2c_resource2, 115 .resource = i2c_resource2,
96 .num_resources = ARRAY_SIZE(i2c_resource2), 116 .num_resources = ARRAY_SIZE(i2c_resource2),
97 .dev = { 117 .dev = {
98 .platform_data = 0, 118 .platform_data = &tegra_i2c2_platform_data,
99 }, 119 },
100}; 120};
101 121
@@ -105,7 +125,7 @@ struct platform_device tegra_i2c_device3 = {
105 .resource = i2c_resource3, 125 .resource = i2c_resource3,
106 .num_resources = ARRAY_SIZE(i2c_resource3), 126 .num_resources = ARRAY_SIZE(i2c_resource3),
107 .dev = { 127 .dev = {
108 .platform_data = 0, 128 .platform_data = &tegra_i2c3_platform_data,
109 }, 129 },
110}; 130};
111 131
@@ -115,7 +135,7 @@ struct platform_device tegra_i2c_device4 = {
115 .resource = i2c_resource4, 135 .resource = i2c_resource4,
116 .num_resources = ARRAY_SIZE(i2c_resource4), 136 .num_resources = ARRAY_SIZE(i2c_resource4),
117 .dev = { 137 .dev = {
118 .platform_data = 0, 138 .platform_data = &tegra_dvc_platform_data,
119 }, 139 },
120}; 140};
121 141
@@ -334,6 +354,28 @@ static struct resource tegra_usb3_resources[] = {
334 }, 354 },
335}; 355};
336 356
357static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
358 /* All existing boards use GPIO PV0 for phy reset */
359 .reset_gpio = TEGRA_GPIO_PV0,
360 .clk = "cdev2",
361};
362
363static struct tegra_ehci_platform_data tegra_ehci1_pdata = {
364 .operating_mode = TEGRA_USB_OTG,
365 .power_down_on_bus_suspend = 1,
366};
367
368static struct tegra_ehci_platform_data tegra_ehci2_pdata = {
369 .phy_config = &tegra_ehci2_ulpi_phy_config,
370 .operating_mode = TEGRA_USB_HOST,
371 .power_down_on_bus_suspend = 1,
372};
373
374static struct tegra_ehci_platform_data tegra_ehci3_pdata = {
375 .operating_mode = TEGRA_USB_HOST,
376 .power_down_on_bus_suspend = 1,
377};
378
337static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32); 379static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32);
338 380
339struct platform_device tegra_ehci1_device = { 381struct platform_device tegra_ehci1_device = {
@@ -342,6 +384,7 @@ struct platform_device tegra_ehci1_device = {
342 .dev = { 384 .dev = {
343 .dma_mask = &tegra_ehci_dmamask, 385 .dma_mask = &tegra_ehci_dmamask,
344 .coherent_dma_mask = DMA_BIT_MASK(32), 386 .coherent_dma_mask = DMA_BIT_MASK(32),
387 .platform_data = &tegra_ehci1_pdata,
345 }, 388 },
346 .resource = tegra_usb1_resources, 389 .resource = tegra_usb1_resources,
347 .num_resources = ARRAY_SIZE(tegra_usb1_resources), 390 .num_resources = ARRAY_SIZE(tegra_usb1_resources),
@@ -353,6 +396,7 @@ struct platform_device tegra_ehci2_device = {
353 .dev = { 396 .dev = {
354 .dma_mask = &tegra_ehci_dmamask, 397 .dma_mask = &tegra_ehci_dmamask,
355 .coherent_dma_mask = DMA_BIT_MASK(32), 398 .coherent_dma_mask = DMA_BIT_MASK(32),
399 .platform_data = &tegra_ehci2_pdata,
356 }, 400 },
357 .resource = tegra_usb2_resources, 401 .resource = tegra_usb2_resources,
358 .num_resources = ARRAY_SIZE(tegra_usb2_resources), 402 .num_resources = ARRAY_SIZE(tegra_usb2_resources),
@@ -364,6 +408,7 @@ struct platform_device tegra_ehci3_device = {
364 .dev = { 408 .dev = {
365 .dma_mask = &tegra_ehci_dmamask, 409 .dma_mask = &tegra_ehci_dmamask,
366 .coherent_dma_mask = DMA_BIT_MASK(32), 410 .coherent_dma_mask = DMA_BIT_MASK(32),
411 .platform_data = &tegra_ehci3_pdata,
367 }, 412 },
368 .resource = tegra_usb3_resources, 413 .resource = tegra_usb3_resources,
369 .num_resources = ARRAY_SIZE(tegra_usb3_resources), 414 .num_resources = ARRAY_SIZE(tegra_usb3_resources),
diff --git a/arch/arm/mach-tegra/include/mach/barriers.h b/arch/arm/mach-tegra/include/mach/barriers.h
deleted file mode 100644
index 425b42e91ef..00000000000
--- a/arch/arm/mach-tegra/include/mach/barriers.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * arch/arm/mach-realview/include/mach/barriers.h
3 *
4 * Copyright (C) 2010 ARM Ltd.
5 * Written by Catalin Marinas <catalin.marinas@arm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __MACH_BARRIERS_H
22#define __MACH_BARRIERS_H
23
24#include <asm/outercache.h>
25
26#define rmb() dsb()
27#define wmb() do { dsb(); outer_sync(); } while (0)
28#define mb() wmb()
29
30#endif /* __MACH_BARRIERS_H */
diff --git a/arch/arm/mach-tegra/include/mach/system.h b/arch/arm/mach-tegra/include/mach/system.h
index d0183d876c3..027c4215d31 100644
--- a/arch/arm/mach-tegra/include/mach/system.h
+++ b/arch/arm/mach-tegra/include/mach/system.h
@@ -21,7 +21,6 @@
21#ifndef __MACH_TEGRA_SYSTEM_H 21#ifndef __MACH_TEGRA_SYSTEM_H
22#define __MACH_TEGRA_SYSTEM_H 22#define __MACH_TEGRA_SYSTEM_H
23 23
24#include <mach/hardware.h>
25#include <mach/iomap.h> 24#include <mach/iomap.h>
26 25
27extern void (*arch_reset)(char mode, const char *cmd); 26extern void (*arch_reset)(char mode, const char *cmd);
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
index 31848a9592f..ea50fe28cf6 100644
--- a/arch/arm/mach-tegra/io.c
+++ b/arch/arm/mach-tegra/io.c
@@ -24,7 +24,6 @@
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <mach/hardware.h>
28#include <asm/page.h> 27#include <asm/page.h>
29#include <asm/mach/map.h> 28#include <asm/mach/map.h>
30 29
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index 2941212b853..f1f699d86c3 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -449,7 +449,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys)
449 return 1; 449 return 1;
450} 450}
451 451
452static int tegra_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 452static int tegra_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
453{ 453{
454 return INT_PCIE_INTR; 454 return INT_PCIE_INTR;
455} 455}
@@ -912,6 +912,8 @@ int __init tegra_pcie_init(bool init_port0, bool init_port1)
912 if (!(init_port0 || init_port1)) 912 if (!(init_port0 || init_port1))
913 return -ENODEV; 913 return -ENODEV;
914 914
915 pcibios_min_mem = 0;
916
915 err = tegra_pcie_get_resources(); 917 err = tegra_pcie_get_resources();
916 if (err) 918 if (err)
917 return err; 919 return err;
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 1a594dce8fb..0886cbccdde 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -21,7 +21,6 @@
21 21
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/hardware/gic.h> 23#include <asm/hardware/gic.h>
24#include <mach/hardware.h>
25#include <asm/mach-types.h> 24#include <asm/mach-types.h>
26#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
27 26
@@ -122,7 +121,7 @@ void __init smp_init_cpus(void)
122 } 121 }
123 122
124 for (i = 0; i < ncores; i++) 123 for (i = 0; i < ncores; i++)
125 cpu_set(i, cpu_possible_map); 124 set_cpu_possible(i, true);
126 125
127 set_smp_cross_call(gic_raise_softirq); 126 set_smp_cross_call(gic_raise_softirq);
128} 127}
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index bb618075fab..0fe9b3ee294 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -2182,8 +2182,8 @@ struct clk tegra_list_clks[] = {
2182 PERIPH_CLK("tvo", "tvo", NULL, 49, 0x188, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ 2182 PERIPH_CLK("tvo", "tvo", NULL, 49, 0x188, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
2183 PERIPH_CLK("hdmi", "hdmi", NULL, 51, 0x18c, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ 2183 PERIPH_CLK("hdmi", "hdmi", NULL, 51, 0x18c, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
2184 PERIPH_CLK("tvdac", "tvdac", NULL, 53, 0x194, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ 2184 PERIPH_CLK("tvdac", "tvdac", NULL, 53, 0x194, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
2185 PERIPH_CLK("disp1", "tegradc.0", NULL, 27, 0x138, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* scales with voltage and process_id */ 2185 PERIPH_CLK("disp1", "tegradc.0", NULL, 27, 0x138, 600000000, mux_pllp_plld_pllc_clkm, MUX), /* scales with voltage and process_id */
2186 PERIPH_CLK("disp2", "tegradc.1", NULL, 26, 0x13c, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* scales with voltage and process_id */ 2186 PERIPH_CLK("disp2", "tegradc.1", NULL, 26, 0x13c, 600000000, mux_pllp_plld_pllc_clkm, MUX), /* scales with voltage and process_id */
2187 PERIPH_CLK("usbd", "fsl-tegra-udc", NULL, 22, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ 2187 PERIPH_CLK("usbd", "fsl-tegra-udc", NULL, 22, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
2188 PERIPH_CLK("usb2", "tegra-ehci.1", NULL, 58, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ 2188 PERIPH_CLK("usb2", "tegra-ehci.1", NULL, 58, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
2189 PERIPH_CLK("usb3", "tegra-ehci.2", NULL, 59, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ 2189 PERIPH_CLK("usb3", "tegra-ehci.2", NULL, 59, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
diff --git a/arch/arm/mach-u300/spi.c b/arch/arm/mach-u300/spi.c
index 5767208f1c1..7b597e2b19e 100644
--- a/arch/arm/mach-u300/spi.c
+++ b/arch/arm/mach-u300/spi.c
@@ -40,8 +40,8 @@ struct pl022_config_chip dummy_chip_info = {
40 .hierarchy = SSP_MASTER, 40 .hierarchy = SSP_MASTER,
41 /* 0 = drive TX even as slave, 1 = do not drive TX as slave */ 41 /* 0 = drive TX even as slave, 1 = do not drive TX as slave */
42 .slave_tx_disable = 0, 42 .slave_tx_disable = 0,
43 .rx_lev_trig = SSP_RX_1_OR_MORE_ELEM, 43 .rx_lev_trig = SSP_RX_4_OR_MORE_ELEM,
44 .tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC, 44 .tx_lev_trig = SSP_TX_4_OR_MORE_EMPTY_LOC,
45 .ctrl_len = SSP_BITS_12, 45 .ctrl_len = SSP_BITS_12,
46 .wait_state = SSP_MWIRE_WAIT_ZERO, 46 .wait_state = SSP_MWIRE_WAIT_ZERO,
47 .duplex = SSP_MICROWIRE_CHANNEL_FULL_DUPLEX, 47 .duplex = SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index 18d7fa0603c..5f51bdeef0e 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -27,9 +27,6 @@
27#include <asm/mach/time.h> 27#include <asm/mach/time.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30/* Be able to sleep for atleast 4 seconds (usually more) */
31#define APPTIMER_MIN_RANGE 4
32
33/* 30/*
34 * APP side special timer registers 31 * APP side special timer registers
35 * This timer contains four timers which can fire an interrupt each. 32 * This timer contains four timers which can fire an interrupt each.
@@ -309,11 +306,11 @@ static int u300_set_next_event(unsigned long cycles,
309 306
310/* Use general purpose timer 1 as clock event */ 307/* Use general purpose timer 1 as clock event */
311static struct clock_event_device clockevent_u300_1mhz = { 308static struct clock_event_device clockevent_u300_1mhz = {
312 .name = "GPT1", 309 .name = "GPT1",
313 .rating = 300, /* Reasonably fast and accurate clock event */ 310 .rating = 300, /* Reasonably fast and accurate clock event */
314 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 311 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
315 .set_next_event = u300_set_next_event, 312 .set_next_event = u300_set_next_event,
316 .set_mode = u300_set_mode, 313 .set_mode = u300_set_mode,
317}; 314};
318 315
319/* Clock event timer interrupt handler */ 316/* Clock event timer interrupt handler */
@@ -328,9 +325,9 @@ static irqreturn_t u300_timer_interrupt(int irq, void *dev_id)
328} 325}
329 326
330static struct irqaction u300_timer_irq = { 327static struct irqaction u300_timer_irq = {
331 .name = "U300 Timer Tick", 328 .name = "U300 Timer Tick",
332 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 329 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
333 .handler = u300_timer_interrupt, 330 .handler = u300_timer_interrupt,
334}; 331};
335 332
336/* 333/*
@@ -413,16 +410,10 @@ static void __init u300_timer_init(void)
413 "GPT2", rate, 300, 32, clocksource_mmio_readl_up)) 410 "GPT2", rate, 300, 32, clocksource_mmio_readl_up))
414 pr_err("timer: failed to initialize U300 clock source\n"); 411 pr_err("timer: failed to initialize U300 clock source\n");
415 412
416 clockevents_calc_mult_shift(&clockevent_u300_1mhz, 413 /* Configure and register the clockevent */
417 rate, APPTIMER_MIN_RANGE); 414 clockevents_config_and_register(&clockevent_u300_1mhz, rate,
418 /* 32bit counter, so 32bits delta is max */ 415 1, 0xffffffff);
419 clockevent_u300_1mhz.max_delta_ns = 416
420 clockevent_delta2ns(0xffffffff, &clockevent_u300_1mhz);
421 /* This timer is slow enough to set for 1 cycle == 1 MHz */
422 clockevent_u300_1mhz.min_delta_ns =
423 clockevent_delta2ns(1, &clockevent_u300_1mhz);
424 clockevent_u300_1mhz.cpumask = cpumask_of(0);
425 clockevents_register_device(&clockevent_u300_1mhz);
426 /* 417 /*
427 * TODO: init and register the rest of the timers too, they can be 418 * TODO: init and register the rest of the timers too, they can be
428 * used by hrtimers! 419 * used by hrtimers!
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index f8b9392ee34..4210cb434db 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -20,7 +20,7 @@ config UX500_SOC_DB8500
20 20
21endmenu 21endmenu
22 22
23menu "Ux500 target platform" 23menu "Ux500 target platform (boards)"
24 24
25config MACH_U8500 25config MACH_U8500
26 bool "U8500 Development platform" 26 bool "U8500 Development platform"
@@ -29,6 +29,19 @@ config MACH_U8500
29 help 29 help
30 Include support for the mop500 development platform. 30 Include support for the mop500 development platform.
31 31
32config MACH_HREFV60
33 bool "U85000 Development platform, HREFv60 version"
34 depends on UX500_SOC_DB8500
35 help
36 Include support for the HREFv60 new development platform.
37
38config MACH_SNOWBALL
39 bool "U8500 Snowball platform"
40 depends on UX500_SOC_DB8500
41 select MACH_U8500
42 help
43 Include support for the snowball development platform.
44
32config MACH_U5500 45config MACH_U5500
33 bool "U5500 Development platform" 46 bool "U5500 Development platform"
34 depends on UX500_SOC_DB5500 47 depends on UX500_SOC_DB5500
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index 70cdbd60596..f26fd76f72b 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -236,6 +236,46 @@ static pin_cfg_t mop500_pins_hrefv60[] = {
236 236
237}; 237};
238 238
239static pin_cfg_t snowball_pins[] = {
240 /* SSP0, to AB8500 */
241 GPIO143_SSP0_CLK,
242 GPIO144_SSP0_FRM,
243 GPIO145_SSP0_RXD | PIN_PULL_DOWN,
244 GPIO146_SSP0_TXD,
245
246 /* MMC0: MicroSD card */
247 GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH,
248
249 /* MMC2: LAN */
250 GPIO86_SM_ADQ0,
251 GPIO87_SM_ADQ1,
252 GPIO88_SM_ADQ2,
253 GPIO89_SM_ADQ3,
254 GPIO90_SM_ADQ4,
255 GPIO91_SM_ADQ5,
256 GPIO92_SM_ADQ6,
257 GPIO93_SM_ADQ7,
258
259 GPIO94_SM_ADVn,
260 GPIO95_SM_CS0n,
261 GPIO96_SM_OEn,
262 GPIO97_SM_WEn,
263
264 GPIO128_SM_CKO,
265 GPIO130_SM_FBCLK,
266 GPIO131_SM_ADQ8,
267 GPIO132_SM_ADQ9,
268 GPIO133_SM_ADQ10,
269 GPIO134_SM_ADQ11,
270 GPIO135_SM_ADQ12,
271 GPIO136_SM_ADQ13,
272 GPIO137_SM_ADQ14,
273 GPIO138_SM_ADQ15,
274
275 /* RSTn_LAN */
276 GPIO141_GPIO | PIN_OUTPUT_HIGH,
277};
278
239void __init mop500_pins_init(void) 279void __init mop500_pins_init(void)
240{ 280{
241 nmk_config_pins(mop500_pins_common, 281 nmk_config_pins(mop500_pins_common,
@@ -243,6 +283,9 @@ void __init mop500_pins_init(void)
243 if (machine_is_hrefv60()) 283 if (machine_is_hrefv60())
244 nmk_config_pins(mop500_pins_hrefv60, 284 nmk_config_pins(mop500_pins_hrefv60,
245 ARRAY_SIZE(mop500_pins_hrefv60)); 285 ARRAY_SIZE(mop500_pins_hrefv60));
286 else if (machine_is_snowball())
287 nmk_config_pins(snowball_pins,
288 ARRAY_SIZE(snowball_pins));
246 else 289 else
247 nmk_config_pins(mop500_pins_default, 290 nmk_config_pins(mop500_pins_default,
248 ARRAY_SIZE(mop500_pins_default)); 291 ARRAY_SIZE(mop500_pins_default));
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index 0f2e522f387..2735d03996c 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -272,7 +272,14 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
272 .max_uV = 2900000, 272 .max_uV = 2900000,
273 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 273 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
274 REGULATOR_CHANGE_STATUS, 274 REGULATOR_CHANGE_STATUS,
275 .boot_on = 1, /* must be on for display */ 275 .boot_on = 1, /* display is on at boot */
276 /*
277 * This voltage cannot be disabled right now because
278 * it is somehow affecting the external MMC
279 * functionality, though that typically will use
280 * AUX3.
281 */
282 .always_on = 1,
276 }, 283 },
277 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), 284 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers),
278 .consumer_supplies = ab8500_vaux1_consumers, 285 .consumer_supplies = ab8500_vaux1_consumers,
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 7c6cb4fa47a..d0cb9e5eb87 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -32,13 +32,32 @@
32#define MCI_DATA31DIREN (1 << 5) 32#define MCI_DATA31DIREN (1 << 5)
33#define MCI_FBCLKEN (1 << 7) 33#define MCI_FBCLKEN (1 << 7)
34 34
35/* GPIO pins used by the sdi0 level shifter */
36static int sdi0_en = -1;
37static int sdi0_vsel = -1;
38
35static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd, 39static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd,
36 unsigned char power_mode) 40 unsigned char power_mode)
37{ 41{
38 if (power_mode == MMC_POWER_UP) 42 switch (power_mode) {
39 gpio_set_value_cansleep(GPIO_SDMMC_EN, 1); 43 case MMC_POWER_UP:
40 else if (power_mode == MMC_POWER_OFF) 44 case MMC_POWER_ON:
41 gpio_set_value_cansleep(GPIO_SDMMC_EN, 0); 45 /*
46 * Level shifter voltage should depend on vdd to when deciding
47 * on either 1.8V or 2.9V. Once the decision has been made the
48 * level shifter must be disabled and re-enabled with a changed
49 * select signal in order to switch the voltage. Since there is
50 * no framework support yet for indicating 1.8V in vdd, use the
51 * default 2.9V.
52 */
53 gpio_direction_output(sdi0_vsel, 0);
54 gpio_direction_output(sdi0_en, 1);
55 break;
56 case MMC_POWER_OFF:
57 gpio_direction_output(sdi0_vsel, 0);
58 gpio_direction_output(sdi0_en, 0);
59 break;
60 }
42 61
43 return MCI_FBCLKEN | MCI_CMDDIREN | MCI_DATA0DIREN | 62 return MCI_FBCLKEN | MCI_CMDDIREN | MCI_DATA0DIREN |
44 MCI_DATA2DIREN | MCI_DATA31DIREN; 63 MCI_DATA2DIREN | MCI_DATA31DIREN;
@@ -67,8 +86,10 @@ static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
67static struct mmci_platform_data mop500_sdi0_data = { 86static struct mmci_platform_data mop500_sdi0_data = {
68 .vdd_handler = mop500_sdi0_vdd_handler, 87 .vdd_handler = mop500_sdi0_vdd_handler,
69 .ocr_mask = MMC_VDD_29_30, 88 .ocr_mask = MMC_VDD_29_30,
70 .f_max = 100000000, 89 .f_max = 50000000,
71 .capabilities = MMC_CAP_4_BIT_DATA, 90 .capabilities = MMC_CAP_4_BIT_DATA |
91 MMC_CAP_SD_HIGHSPEED |
92 MMC_CAP_MMC_HIGHSPEED,
72 .gpio_wp = -1, 93 .gpio_wp = -1,
73#ifdef CONFIG_STE_DMA40 94#ifdef CONFIG_STE_DMA40
74 .dma_filter = stedma40_filter, 95 .dma_filter = stedma40_filter,
@@ -77,10 +98,6 @@ static struct mmci_platform_data mop500_sdi0_data = {
77#endif 98#endif
78}; 99};
79 100
80/* GPIO pins used by the sdi0 level shifter */
81static int sdi0_en = -1;
82static int sdi0_vsel = -1;
83
84static void sdi0_configure(void) 101static void sdi0_configure(void)
85{ 102{
86 int ret; 103 int ret;
@@ -140,7 +157,7 @@ static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
140 157
141static struct mmci_platform_data mop500_sdi2_data = { 158static struct mmci_platform_data mop500_sdi2_data = {
142 .ocr_mask = MMC_VDD_165_195, 159 .ocr_mask = MMC_VDD_165_195,
143 .f_max = 100000000, 160 .f_max = 50000000,
144 .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 161 .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
145 .gpio_cd = -1, 162 .gpio_cd = -1,
146 .gpio_wp = -1, 163 .gpio_wp = -1,
@@ -177,7 +194,7 @@ static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
177 194
178static struct mmci_platform_data mop500_sdi4_data = { 195static struct mmci_platform_data mop500_sdi4_data = {
179 .ocr_mask = MMC_VDD_29_30, 196 .ocr_mask = MMC_VDD_29_30,
180 .f_max = 100000000, 197 .f_max = 50000000,
181 .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | 198 .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
182 MMC_CAP_MMC_HIGHSPEED, 199 MMC_CAP_MMC_HIGHSPEED,
183 .gpio_cd = -1, 200 .gpio_cd = -1,
@@ -199,17 +216,27 @@ void __init mop500_sdi_init(void)
199 /* PoP:ed eMMC on top of DB8500 v1.0 has problems with high speed */ 216 /* PoP:ed eMMC on top of DB8500 v1.0 has problems with high speed */
200 if (!cpu_is_u8500v10()) 217 if (!cpu_is_u8500v10())
201 mop500_sdi2_data.capabilities |= MMC_CAP_MMC_HIGHSPEED; 218 mop500_sdi2_data.capabilities |= MMC_CAP_MMC_HIGHSPEED;
202 db8500_add_sdi2(&mop500_sdi2_data, periphid); 219 /* sdi2 on snowball is in ATL_B mode for FSMC (LAN) */
220 if (!machine_is_snowball())
221 db8500_add_sdi2(&mop500_sdi2_data, periphid);
203 222
204 /* On-board eMMC */ 223 /* On-board eMMC */
205 db8500_add_sdi4(&mop500_sdi4_data, periphid); 224 db8500_add_sdi4(&mop500_sdi4_data, periphid);
206 225
207 if (machine_is_hrefv60()) { 226 if (machine_is_hrefv60() || machine_is_snowball()) {
208 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO; 227 if (machine_is_hrefv60()) {
209 sdi0_en = HREFV60_SDMMC_EN_GPIO; 228 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
210 sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO; 229 sdi0_en = HREFV60_SDMMC_EN_GPIO;
230 sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO;
231 } else if (machine_is_snowball()) {
232 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
233 mop500_sdi0_data.cd_invert = true;
234 sdi0_en = SNOWBALL_SDMMC_EN_GPIO;
235 sdi0_vsel = SNOWBALL_SDMMC_1V8_3V_GPIO;
236 }
211 sdi0_configure(); 237 sdi0_configure();
212 } 238 }
239
213 /* 240 /*
214 * On boards with the TC35892 GPIO expander, sdi0 will finally 241 * On boards with the TC35892 GPIO expander, sdi0 will finally
215 * be added when the TC35892 initializes and calls 242 * be added when the TC35892 initializes and calls
diff --git a/arch/arm/mach-ux500/board-mop500-uib.c b/arch/arm/mach-ux500/board-mop500-uib.c
index 69cce41f602..5af36aa56c0 100644
--- a/arch/arm/mach-ux500/board-mop500-uib.c
+++ b/arch/arm/mach-ux500/board-mop500-uib.c
@@ -25,7 +25,7 @@ struct uib {
25 void (*init)(void); 25 void (*init)(void);
26}; 26};
27 27
28static struct __initdata uib mop500_uibs[] = { 28static struct uib __initdata mop500_uibs[] = {
29 [STUIB] = { 29 [STUIB] = {
30 .name = "ST-UIB", 30 .name = "ST-UIB",
31 .option = "stuib", 31 .option = "stuib",
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 2a08c07dec6..cd54abaccd9 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -26,9 +26,11 @@
26#include <linux/mfd/ab8500/gpio.h> 26#include <linux/mfd/ab8500/gpio.h>
27#include <linux/leds-lp5521.h> 27#include <linux/leds-lp5521.h>
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/smsc911x.h>
29#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
30#include <linux/delay.h> 31#include <linux/delay.h>
31 32
33#include <linux/leds.h>
32#include <asm/mach-types.h> 34#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
34 36
@@ -47,6 +49,26 @@
47#include "board-mop500.h" 49#include "board-mop500.h"
48#include "board-mop500-regulators.h" 50#include "board-mop500-regulators.h"
49 51
52static struct gpio_led snowball_led_array[] = {
53 {
54 .name = "user_led",
55 .default_trigger = "none",
56 .gpio = 142,
57 },
58};
59
60static struct gpio_led_platform_data snowball_led_data = {
61 .leds = snowball_led_array,
62 .num_leds = ARRAY_SIZE(snowball_led_array),
63};
64
65static struct platform_device snowball_led_dev = {
66 .name = "leds-gpio",
67 .dev = {
68 .platform_data = &snowball_led_data,
69 },
70};
71
50static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { 72static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
51 .gpio_base = MOP500_AB8500_GPIO(0), 73 .gpio_base = MOP500_AB8500_GPIO(0),
52 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, 74 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
@@ -69,6 +91,97 @@ static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
69 0x7A, 0x00, 0x00}, 91 0x7A, 0x00, 0x00},
70}; 92};
71 93
94static struct gpio_keys_button snowball_key_array[] = {
95 {
96 .gpio = 32,
97 .type = EV_KEY,
98 .code = KEY_1,
99 .desc = "userpb",
100 .active_low = 1,
101 .debounce_interval = 50,
102 .wakeup = 1,
103 },
104 {
105 .gpio = 151,
106 .type = EV_KEY,
107 .code = KEY_2,
108 .desc = "extkb1",
109 .active_low = 1,
110 .debounce_interval = 50,
111 .wakeup = 1,
112 },
113 {
114 .gpio = 152,
115 .type = EV_KEY,
116 .code = KEY_3,
117 .desc = "extkb2",
118 .active_low = 1,
119 .debounce_interval = 50,
120 .wakeup = 1,
121 },
122 {
123 .gpio = 161,
124 .type = EV_KEY,
125 .code = KEY_4,
126 .desc = "extkb3",
127 .active_low = 1,
128 .debounce_interval = 50,
129 .wakeup = 1,
130 },
131 {
132 .gpio = 162,
133 .type = EV_KEY,
134 .code = KEY_5,
135 .desc = "extkb4",
136 .active_low = 1,
137 .debounce_interval = 50,
138 .wakeup = 1,
139 },
140};
141
142static struct gpio_keys_platform_data snowball_key_data = {
143 .buttons = snowball_key_array,
144 .nbuttons = ARRAY_SIZE(snowball_key_array),
145};
146
147static struct platform_device snowball_key_dev = {
148 .name = "gpio-keys",
149 .id = -1,
150 .dev = {
151 .platform_data = &snowball_key_data,
152 }
153};
154
155static struct smsc911x_platform_config snowball_sbnet_cfg = {
156 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
157 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
158 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
159 .shift = 1,
160};
161
162static struct resource sbnet_res[] = {
163 {
164 .name = "smsc911x-memory",
165 .start = (0x5000 << 16),
166 .end = (0x5000 << 16) + 0xffff,
167 .flags = IORESOURCE_MEM,
168 },
169 {
170 .start = NOMADIK_GPIO_TO_IRQ(140),
171 .end = NOMADIK_GPIO_TO_IRQ(140),
172 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
173 },
174};
175
176static struct platform_device snowball_sbnet_dev = {
177 .name = "smsc911x",
178 .num_resources = ARRAY_SIZE(sbnet_res),
179 .resource = sbnet_res,
180 .dev = {
181 .platform_data = &snowball_sbnet_cfg,
182 },
183};
184
72static struct ab8500_platform_data ab8500_platdata = { 185static struct ab8500_platform_data ab8500_platdata = {
73 .irq_base = MOP500_AB8500_IRQ_BASE, 186 .irq_base = MOP500_AB8500_IRQ_BASE,
74 .regulator_reg_init = ab8500_regulator_reg_init, 187 .regulator_reg_init = ab8500_regulator_reg_init,
@@ -295,8 +408,9 @@ static void mop500_prox_deactivate(struct device *dev)
295} 408}
296 409
297/* add any platform devices here - TODO */ 410/* add any platform devices here - TODO */
298static struct platform_device *platform_devs[] __initdata = { 411static struct platform_device *mop500_platform_devs[] __initdata = {
299 &mop500_gpio_keys_device, 412 &mop500_gpio_keys_device,
413 &ab8500_device,
300}; 414};
301 415
302#ifdef CONFIG_STE_DMA40 416#ifdef CONFIG_STE_DMA40
@@ -478,6 +592,13 @@ static void __init mop500_uart_init(void)
478 db8500_add_uart2(&uart2_plat); 592 db8500_add_uart2(&uart2_plat);
479} 593}
480 594
595static struct platform_device *snowball_platform_devs[] __initdata = {
596 &snowball_led_dev,
597 &snowball_key_dev,
598 &snowball_sbnet_dev,
599 &ab8500_device,
600};
601
481static void __init mop500_init_machine(void) 602static void __init mop500_init_machine(void)
482{ 603{
483 int i2c0_devs; 604 int i2c0_devs;
@@ -487,24 +608,29 @@ static void __init mop500_init_machine(void)
487 * all these GPIO pins to the internal GPIO controller 608 * all these GPIO pins to the internal GPIO controller
488 * instead. 609 * instead.
489 */ 610 */
490 if (machine_is_hrefv60()) 611 if (!machine_is_snowball()) {
491 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 612 if (machine_is_hrefv60())
492 else 613 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
493 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 614 else
615 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
616 }
494 617
495 u8500_init_devices(); 618 u8500_init_devices();
496 619
497 mop500_pins_init(); 620 mop500_pins_init();
498 621
499 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); 622 if (machine_is_snowball())
623 platform_add_devices(snowball_platform_devs,
624 ARRAY_SIZE(snowball_platform_devs));
625 else
626 platform_add_devices(mop500_platform_devs,
627 ARRAY_SIZE(mop500_platform_devs));
500 628
501 mop500_i2c_init(); 629 mop500_i2c_init();
502 mop500_sdi_init(); 630 mop500_sdi_init();
503 mop500_spi_init(); 631 mop500_spi_init();
504 mop500_uart_init(); 632 mop500_uart_init();
505 633
506 platform_device_register(&ab8500_device);
507
508 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 634 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
509 if (machine_is_hrefv60()) 635 if (machine_is_hrefv60())
510 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; 636 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
@@ -512,6 +638,9 @@ static void __init mop500_init_machine(void)
512 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); 638 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
513 i2c_register_board_info(2, mop500_i2c2_devices, 639 i2c_register_board_info(2, mop500_i2c2_devices,
514 ARRAY_SIZE(mop500_i2c2_devices)); 640 ARRAY_SIZE(mop500_i2c2_devices));
641
642 /* This board has full regulator constraints */
643 regulator_has_full_constraints();
515} 644}
516 645
517MACHINE_START(U8500, "ST-Ericsson MOP500 platform") 646MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
@@ -531,3 +660,12 @@ MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
531 .timer = &ux500_timer, 660 .timer = &ux500_timer,
532 .init_machine = mop500_init_machine, 661 .init_machine = mop500_init_machine,
533MACHINE_END 662MACHINE_END
663
664MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
665 .boot_params = 0x100,
666 .map_io = u8500_map_io,
667 .init_irq = ux500_init_irq,
668 /* we re-use nomadik timer here */
669 .timer = &ux500_timer,
670 .init_machine = mop500_init_machine,
671MACHINE_END
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index 03a31cc9b08..ee77a8970c3 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -7,6 +7,11 @@
7#ifndef __BOARD_MOP500_H 7#ifndef __BOARD_MOP500_H
8#define __BOARD_MOP500_H 8#define __BOARD_MOP500_H
9 9
10/* snowball GPIO for MMC card */
11#define SNOWBALL_SDMMC_EN_GPIO 217
12#define SNOWBALL_SDMMC_1V8_3V_GPIO 228
13#define SNOWBALL_SDMMC_CD_GPIO 218
14
10/* HREFv60-specific GPIO assignments, this board has no GPIO expander */ 15/* HREFv60-specific GPIO assignments, this board has no GPIO expander */
11#define HREFV60_TOUCH_RST_GPIO 143 16#define HREFV60_TOUCH_RST_GPIO 143
12#define HREFV60_PROX_SENSE_GPIO 217 17#define HREFV60_PROX_SENSE_GPIO 217
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
index 7d107be63eb..e832664d1bd 100644
--- a/arch/arm/mach-ux500/clock.c
+++ b/arch/arm/mach-ux500/clock.c
@@ -14,6 +14,7 @@
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/clkdev.h> 16#include <linux/clkdev.h>
17#include <linux/cpufreq.h>
17 18
18#include <plat/mtu.h> 19#include <plat/mtu.h>
19#include <mach/hardware.h> 20#include <mach/hardware.h>
@@ -742,6 +743,51 @@ err_out:
742late_initcall(clk_debugfs_init); 743late_initcall(clk_debugfs_init);
743#endif /* defined(CONFIG_DEBUG_FS) */ 744#endif /* defined(CONFIG_DEBUG_FS) */
744 745
746unsigned long clk_smp_twd_rate = 400000000;
747
748unsigned long clk_smp_twd_get_rate(struct clk *clk)
749{
750 return clk_smp_twd_rate;
751}
752
753static struct clk clk_smp_twd = {
754 .get_rate = clk_smp_twd_get_rate,
755 .name = "smp_twd",
756};
757
758static struct clk_lookup clk_smp_twd_lookup = {
759 .dev_id = "smp_twd",
760 .clk = &clk_smp_twd,
761};
762
763#ifdef CONFIG_CPU_FREQ
764
765static int clk_twd_cpufreq_transition(struct notifier_block *nb,
766 unsigned long state, void *data)
767{
768 struct cpufreq_freqs *f = data;
769
770 if (state == CPUFREQ_PRECHANGE) {
771 /* Save frequency in simple Hz */
772 clk_smp_twd_rate = f->new * 1000;
773 }
774
775 return NOTIFY_OK;
776}
777
778static struct notifier_block clk_twd_cpufreq_nb = {
779 .notifier_call = clk_twd_cpufreq_transition,
780};
781
782static int clk_init_smp_twd_cpufreq(void)
783{
784 return cpufreq_register_notifier(&clk_twd_cpufreq_nb,
785 CPUFREQ_TRANSITION_NOTIFIER);
786}
787late_initcall(clk_init_smp_twd_cpufreq);
788
789#endif
790
745int __init clk_init(void) 791int __init clk_init(void)
746{ 792{
747 if (cpu_is_u8500ed()) { 793 if (cpu_is_u8500ed()) {
@@ -762,6 +808,8 @@ int __init clk_init(void)
762 else 808 else
763 clkdev_add_table(u8500_v1_clks, ARRAY_SIZE(u8500_v1_clks)); 809 clkdev_add_table(u8500_v1_clks, ARRAY_SIZE(u8500_v1_clks));
764 810
811 clkdev_add(&clk_smp_twd_lookup);
812
765#ifdef CONFIG_DEBUG_FS 813#ifdef CONFIG_DEBUG_FS
766 clk_debugfs_add_table(u8500_common_clks, ARRAY_SIZE(u8500_common_clks)); 814 clk_debugfs_add_table(u8500_common_clks, ARRAY_SIZE(u8500_common_clks));
767 if (cpu_is_u8500ed()) 815 if (cpu_is_u8500ed())
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c
index c01bc19e3c5..22705d246fc 100644
--- a/arch/arm/mach-ux500/cpu-db5500.c
+++ b/arch/arm/mach-ux500/cpu-db5500.c
@@ -44,6 +44,7 @@ static struct map_desc u5500_io_desc[] __initdata = {
44 __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K), 44 __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
45 __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K), 45 __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
46 __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K), 46 __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
47 __IO_DEV_DESC(U5500_PRCMU_TCDM_BASE, SZ_4K),
47}; 48};
48 49
49static struct resource db5500_pmu_resources[] = { 50static struct resource db5500_pmu_resources[] = {
diff --git a/arch/arm/mach-ux500/include/mach/clkdev.h b/arch/arm/mach-ux500/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/mach-ux500/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-ux500/include/mach/uncompress.h b/arch/arm/mach-ux500/include/mach/uncompress.h
index 088b550c40d..7dd08074c37 100644
--- a/arch/arm/mach-ux500/include/mach/uncompress.h
+++ b/arch/arm/mach-ux500/include/mach/uncompress.h
@@ -54,7 +54,8 @@ static inline void arch_decomp_setup(void)
54 if (machine_is_u8500() || 54 if (machine_is_u8500() ||
55 machine_is_svp8500v1() || 55 machine_is_svp8500v1() ||
56 machine_is_svp8500v2() || 56 machine_is_svp8500v2() ||
57 machine_is_hrefv60()) 57 machine_is_hrefv60() ||
58 machine_is_snowball())
58 ux500_uart_base = U8500_UART2_BASE; 59 ux500_uart_base = U8500_UART2_BASE;
59 else if (machine_is_u5500()) 60 else if (machine_is_u5500())
60 ux500_uart_base = U5500_UART0_BASE; 61 ux500_uart_base = U5500_UART0_BASE;
diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
index 82e535953fd..0a01cbdfe06 100644
--- a/arch/arm/mach-ux500/usb.c
+++ b/arch/arm/mach-ux500/usb.c
@@ -6,6 +6,7 @@
6 */ 6 */
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/usb/musb.h> 8#include <linux/usb/musb.h>
9#include <linux/dma-mapping.h>
9#include <plat/ste_dma40.h> 10#include <plat/ste_dma40.h>
10#include <mach/hardware.h> 11#include <mach/hardware.h>
11#include <mach/usb.h> 12#include <mach/usb.h>
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 9cdec5aa04a..c1f38f6625b 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -17,4 +17,12 @@ config MACH_VERSATILE_AB
17 Include support for the ARM(R) Versatile Application Baseboard 17 Include support for the ARM(R) Versatile Application Baseboard
18 for the ARM926EJ-S. 18 for the ARM926EJ-S.
19 19
20config MACH_VERSATILE_DT
21 bool "Support Versatile platform from device tree"
22 select USE_OF
23 select CPU_ARM926T
24 help
25 Include support for the ARM(R) Versatile/PB platform,
26 using the device tree for discovery
27
20endmenu 28endmenu
diff --git a/arch/arm/mach-versatile/Makefile b/arch/arm/mach-versatile/Makefile
index 97cf4d831b0..81fa3fe25e1 100644
--- a/arch/arm/mach-versatile/Makefile
+++ b/arch/arm/mach-versatile/Makefile
@@ -5,4 +5,5 @@
5obj-y := core.o 5obj-y := core.o
6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o 6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o
7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o 7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o
8obj-$(CONFIG_MACH_VERSATILE_DT) += versatile_dt.o
8obj-$(CONFIG_PCI) += pci.o 9obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 0c99cf076c6..e340a54251d 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -24,6 +24,9 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irqdomain.h>
28#include <linux/of_address.h>
29#include <linux/of_platform.h>
27#include <linux/amba/bus.h> 30#include <linux/amba/bus.h>
28#include <linux/amba/clcd.h> 31#include <linux/amba/clcd.h>
29#include <linux/amba/pl061.h> 32#include <linux/amba/pl061.h>
@@ -83,13 +86,26 @@ static struct fpga_irq_data sic_irq = {
83#define PIC_MASK 0 86#define PIC_MASK 0
84#endif 87#endif
85 88
89/* Lookup table for finding a DT node that represents the vic instance */
90static const struct of_device_id vic_of_match[] __initconst = {
91 { .compatible = "arm,versatile-vic", },
92 {}
93};
94
95static const struct of_device_id sic_of_match[] __initconst = {
96 { .compatible = "arm,versatile-sic", },
97 {}
98};
99
86void __init versatile_init_irq(void) 100void __init versatile_init_irq(void)
87{ 101{
88 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0); 102 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);
103 irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START);
89 104
90 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 105 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
91 106
92 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq); 107 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq);
108 irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START);
93 109
94 /* 110 /*
95 * Interrupts on secondary controller from 0 to 8 are routed to 111 * Interrupts on secondary controller from 0 to 8 are routed to
@@ -646,6 +662,52 @@ static struct amba_device *amba_devs[] __initdata = {
646 &kmi1_device, 662 &kmi1_device,
647}; 663};
648 664
665#ifdef CONFIG_OF
666/*
667 * Lookup table for attaching a specific name and platform_data pointer to
668 * devices as they get created by of_platform_populate(). Ideally this table
669 * would not exist, but the current clock implementation depends on some devices
670 * having a specific name.
671 */
672struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = {
673 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", NULL),
674 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL),
675 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL),
676 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL),
677 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL),
678
679 OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data),
680 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL),
681 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL),
682 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL),
683 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", NULL),
684
685#if 0
686 /*
687 * These entries are unnecessary because no clocks referencing
688 * them. I've left them in for now as place holders in case
689 * any of them need to be added back, but they should be
690 * removed before actually committing this patch. --gcl
691 */
692 OF_DEV_AUXDATA("arm,primecell", VERSATILE_AACI_BASE, "fpga:04", NULL),
693 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI1_BASE, "fpga:0a", NULL),
694 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SMC_BASE, "dev:00", NULL),
695 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MPMC_BASE, "dev:10", NULL),
696 OF_DEV_AUXDATA("arm,primecell", VERSATILE_DMAC_BASE, "dev:30", NULL),
697
698 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCTL_BASE, "dev:e0", NULL),
699 OF_DEV_AUXDATA("arm,primecell", VERSATILE_WATCHDOG_BASE, "dev:e1", NULL),
700 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO0_BASE, "dev:e4", NULL),
701 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO1_BASE, "dev:e5", NULL),
702 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO2_BASE, "dev:e6", NULL),
703 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO3_BASE, "dev:e7", NULL),
704 OF_DEV_AUXDATA("arm,primecell", VERSATILE_RTC_BASE, "dev:e8", NULL),
705 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI_BASE, "dev:f0", NULL),
706#endif
707 {}
708};
709#endif
710
649#ifdef CONFIG_LEDS 711#ifdef CONFIG_LEDS
650#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET) 712#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
651 713
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index fd6404e5d78..e01422700eb 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -23,6 +23,7 @@
23#define __ASM_ARCH_VERSATILE_H 23#define __ASM_ARCH_VERSATILE_H
24 24
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/of_platform.h>
26 27
27extern void __init versatile_init(void); 28extern void __init versatile_init(void);
28extern void __init versatile_init_early(void); 29extern void __init versatile_init_early(void);
@@ -30,6 +31,9 @@ extern void __init versatile_init_irq(void);
30extern void __init versatile_map_io(void); 31extern void __init versatile_map_io(void);
31extern struct sys_timer versatile_timer; 32extern struct sys_timer versatile_timer;
32extern unsigned int mmc_status(struct device *dev); 33extern unsigned int mmc_status(struct device *dev);
34#ifdef CONFIG_OF
35extern struct of_dev_auxdata versatile_auxdata_lookup[];
36#endif
33 37
34#define AMBA_DEVICE(name,busid,base,plat) \ 38#define AMBA_DEVICE(name,busid,base,plat) \
35static struct amba_device name##_device = { \ 39static struct amba_device name##_device = { \
diff --git a/arch/arm/mach-versatile/include/mach/hardware.h b/arch/arm/mach-versatile/include/mach/hardware.h
index 6911e1f5f15..4d4973dd8fb 100644
--- a/arch/arm/mach-versatile/include/mach/hardware.h
+++ b/arch/arm/mach-versatile/include/mach/hardware.h
@@ -30,12 +30,6 @@
30#define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul 30#define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul
31#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul 31#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul
32 32
33/* CIK guesswork */
34#define PCIBIOS_MIN_IO 0x44000000
35#define PCIBIOS_MIN_MEM 0x50000000
36
37#define pcibios_assign_all_busses() 1
38
39/* macro to get at IO space when running virtually */ 33/* macro to get at IO space when running virtually */
40#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) 34#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
41 35
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 13c7e5f90a8..c898deb3ada 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -311,6 +311,9 @@ struct pci_bus * __init pci_versatile_scan_bus(int nr, struct pci_sys_data *sys)
311 311
312void __init pci_versatile_preinit(void) 312void __init pci_versatile_preinit(void)
313{ 313{
314 pcibios_min_io = 0x44000000;
315 pcibios_min_mem = 0x50000000;
316
314 __raw_writel(VERSATILE_PCI_MEM_BASE0 >> 28, PCI_IMAP0); 317 __raw_writel(VERSATILE_PCI_MEM_BASE0 >> 28, PCI_IMAP0);
315 __raw_writel(VERSATILE_PCI_MEM_BASE1 >> 28, PCI_IMAP1); 318 __raw_writel(VERSATILE_PCI_MEM_BASE1 >> 28, PCI_IMAP1);
316 __raw_writel(VERSATILE_PCI_MEM_BASE2 >> 28, PCI_IMAP2); 319 __raw_writel(VERSATILE_PCI_MEM_BASE2 >> 28, PCI_IMAP2);
@@ -325,7 +328,7 @@ void __init pci_versatile_preinit(void)
325/* 328/*
326 * map the specified device/slot/pin to an IRQ. Different backplanes may need to modify this. 329 * map the specified device/slot/pin to an IRQ. Different backplanes may need to modify this.
327 */ 330 */
328static int __init versatile_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 331static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
329{ 332{
330 int irq; 333 int irq;
331 int devslot = PCI_SLOT(dev->devfn); 334 int devslot = PCI_SLOT(dev->devfn);
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c
new file mode 100644
index 00000000000..54e037c090f
--- /dev/null
+++ b/arch/arm/mach-versatile/versatile_dt.c
@@ -0,0 +1,51 @@
1/*
2 * Versatile board support using the device tree
3 *
4 * Copyright (C) 2010 Secret Lab Technologies Ltd.
5 * Copyright (C) 2009 Jeremy Kerr <jeremy.kerr@canonical.com>
6 * Copyright (C) 2004 ARM Limited
7 * Copyright (C) 2000 Deep Blue Solutions Ltd
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/init.h>
25#include <linux/of_irq.h>
26#include <linux/of_platform.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29
30#include "core.h"
31
32static void __init versatile_dt_init(void)
33{
34 of_platform_populate(NULL, of_default_bus_match_table,
35 versatile_auxdata_lookup, NULL);
36}
37
38static const char *versatile_dt_match[] __initconst = {
39 "arm,versatile-ab",
40 "arm,versatile-pb",
41 NULL,
42};
43
44DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)")
45 .map_io = versatile_map_io,
46 .init_early = versatile_init_early,
47 .init_irq = versatile_init_irq,
48 .timer = &versatile_timer,
49 .init_machine = versatile_dt_init,
50 .dt_compat = versatile_dt_match,
51MACHINE_END
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 9e6b93b1a04..d0d267a8d3f 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -318,6 +318,10 @@ static struct clk v2m_sp804_clk = {
318 .rate = 1000000, 318 .rate = 1000000,
319}; 319};
320 320
321static struct clk v2m_ref_clk = {
322 .rate = 32768,
323};
324
321static struct clk dummy_apb_pclk; 325static struct clk dummy_apb_pclk;
322 326
323static struct clk_lookup v2m_lookups[] = { 327static struct clk_lookup v2m_lookups[] = {
@@ -348,6 +352,9 @@ static struct clk_lookup v2m_lookups[] = {
348 }, { /* CLCD */ 352 }, { /* CLCD */
349 .dev_id = "mb:clcd", 353 .dev_id = "mb:clcd",
350 .clk = &osc1_clk, 354 .clk = &osc1_clk,
355 }, { /* SP805 WDT */
356 .dev_id = "mb:wdt",
357 .clk = &v2m_ref_clk,
351 }, { /* SP804 timers */ 358 }, { /* SP804 timers */
352 .dev_id = "sp804", 359 .dev_id = "sp804",
353 .con_id = "v2m-timer0", 360 .con_id = "v2m-timer0",
diff --git a/arch/arm/mach-w90x900/include/mach/clkdev.h b/arch/arm/mach-w90x900/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/mach-w90x900/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile
new file mode 100644
index 00000000000..397268c1b25
--- /dev/null
+++ b/arch/arm/mach-zynq/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Common support
6obj-y := common.o timer.o
diff --git a/arch/arm/mach-zynq/Makefile.boot b/arch/arm/mach-zynq/Makefile.boot
new file mode 100644
index 00000000000..67039c3e0c4
--- /dev/null
+++ b/arch/arm/mach-zynq/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
new file mode 100644
index 00000000000..73e93687b81
--- /dev/null
+++ b/arch/arm/mach-zynq/common.c
@@ -0,0 +1,118 @@
1/*
2 * This file contains common code that is intended to be used across
3 * boards so that it's not replicated.
4 *
5 * Copyright (C) 2011 Xilinx
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#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/cpumask.h>
20#include <linux/platform_device.h>
21#include <linux/clk.h>
22#include <linux/of_irq.h>
23#include <linux/of_platform.h>
24#include <linux/of.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28#include <asm/mach-types.h>
29#include <asm/page.h>
30#include <asm/hardware/gic.h>
31#include <asm/hardware/cache-l2x0.h>
32
33#include <mach/zynq_soc.h>
34#include <mach/clkdev.h>
35#include "common.h"
36
37static struct of_device_id zynq_of_bus_ids[] __initdata = {
38 { .compatible = "simple-bus", },
39 {}
40};
41
42/**
43 * xilinx_init_machine() - System specific initialization, intended to be
44 * called from board specific initialization.
45 */
46static void __init xilinx_init_machine(void)
47{
48#ifdef CONFIG_CACHE_L2X0
49 /*
50 * 64KB way size, 8-way associativity, parity disabled
51 */
52 l2x0_init(PL310_L2CC_BASE, 0x02060000, 0xF0F0FFFF);
53#endif
54
55 of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
56}
57
58/**
59 * xilinx_irq_init() - Interrupt controller initialization for the GIC.
60 */
61static void __init xilinx_irq_init(void)
62{
63 gic_init(0, 29, SCU_GIC_DIST_BASE, SCU_GIC_CPU_BASE);
64}
65
66/* The minimum devices needed to be mapped before the VM system is up and
67 * running include the GIC, UART and Timer Counter.
68 */
69
70static struct map_desc io_desc[] __initdata = {
71 {
72 .virtual = TTC0_VIRT,
73 .pfn = __phys_to_pfn(TTC0_PHYS),
74 .length = SZ_4K,
75 .type = MT_DEVICE,
76 }, {
77 .virtual = SCU_PERIPH_VIRT,
78 .pfn = __phys_to_pfn(SCU_PERIPH_PHYS),
79 .length = SZ_8K,
80 .type = MT_DEVICE,
81 }, {
82 .virtual = PL310_L2CC_VIRT,
83 .pfn = __phys_to_pfn(PL310_L2CC_PHYS),
84 .length = SZ_4K,
85 .type = MT_DEVICE,
86 },
87
88#ifdef CONFIG_DEBUG_LL
89 {
90 .virtual = UART0_VIRT,
91 .pfn = __phys_to_pfn(UART0_PHYS),
92 .length = SZ_4K,
93 .type = MT_DEVICE,
94 },
95#endif
96
97};
98
99/**
100 * xilinx_map_io() - Create memory mappings needed for early I/O.
101 */
102static void __init xilinx_map_io(void)
103{
104 iotable_init(io_desc, ARRAY_SIZE(io_desc));
105}
106
107static const char *xilinx_dt_match[] = {
108 "xlnx,zynq-ep107",
109 NULL
110};
111
112MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
113 .map_io = xilinx_map_io,
114 .init_irq = xilinx_irq_init,
115 .init_machine = xilinx_init_machine,
116 .timer = &xttcpss_sys_timer,
117 .dt_compat = xilinx_dt_match,
118MACHINE_END
diff --git a/arch/arm/mach-tegra/include/mach/hardware.h b/arch/arm/mach-zynq/common.h
index 56e43b3a5b9..a009644a155 100644
--- a/arch/arm/mach-tegra/include/mach/hardware.h
+++ b/arch/arm/mach-zynq/common.h
@@ -1,11 +1,8 @@
1/* 1/*
2 * arch/arm/mach-tegra/include/mach/hardware.h 2 * This file contains common function prototypes to avoid externs
3 * in the c files.
3 * 4 *
4 * Copyright (C) 2010 Google, Inc. 5 * Copyright (C) 2011 Xilinx
5 *
6 * Author:
7 * Colin Cross <ccross@google.com>
8 * Erik Gilling <konkers@google.com>
9 * 6 *
10 * This software is licensed under the terms of the GNU General Public 7 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and 8 * License version 2, as published by the Free Software Foundation, and
@@ -15,14 +12,13 @@
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details. 14 * GNU General Public License for more details.
18 *
19 */ 15 */
20 16
21#ifndef __MACH_TEGRA_HARDWARE_H 17#ifndef __MACH_ZYNQ_COMMON_H__
22#define __MACH_TEGRA_HARDWARE_H 18#define __MACH_ZYNQ_COMMON_H__
19
20#include <asm/mach/time.h>
23 21
24#define PCIBIOS_MIN_IO 0x1000 22extern struct sys_timer xttcpss_sys_timer;
25#define PCIBIOS_MIN_MEM 0
26#define pcibios_assign_all_busses() 1
27 23
28#endif 24#endif
diff --git a/arch/arm/mach-zynq/include/mach/clkdev.h b/arch/arm/mach-zynq/include/mach/clkdev.h
new file mode 100644
index 00000000000..c6e73d81a45
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/clkdev.h
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-zynq/include/mach/clkdev.h
3 *
4 * Copyright (C) 2011 Xilinx, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __MACH_CLKDEV_H__
18#define __MACH_CLKDEV_H__
19
20#include <plat/clock.h>
21
22struct clk {
23 unsigned long rate;
24 const struct clk_ops *ops;
25 const struct icst_params *params;
26 void __iomem *vcoreg;
27};
28
29#define __clk_get(clk) ({ 1; })
30#define __clk_put(clk) do { } while (0)
31
32#endif
diff --git a/arch/arm/mach-zynq/include/mach/debug-macro.S b/arch/arm/mach-zynq/include/mach/debug-macro.S
new file mode 100644
index 00000000000..9f664d5eb81
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/debug-macro.S
@@ -0,0 +1,36 @@
1/* arch/arm/mach-zynq/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 2011 Xilinx
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#include <mach/zynq_soc.h>
18#include <mach/uart.h>
19
20 .macro addruart, rp, rv
21 ldr \rp, =LL_UART_PADDR @ physical
22 ldr \rv, =LL_UART_VADDR @ virtual
23 .endm
24
25 .macro senduart,rd,rx
26 str \rd, [\rx, #UART_FIFO_OFFSET] @ TXDATA
27 .endm
28
29 .macro waituart,rd,rx
30 .endm
31
32 .macro busyuart,rd,rx
331002: ldr \rd, [\rx, #UART_SR_OFFSET] @ get status register
34 tst \rd, #UART_SR_TXFULL @
35 bne 1002b @ wait if FIFO is full
36 .endm
diff --git a/arch/arm/mach-zynq/include/mach/entry-macro.S b/arch/arm/mach-zynq/include/mach/entry-macro.S
new file mode 100644
index 00000000000..3cfc01b3746
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/entry-macro.S
@@ -0,0 +1,30 @@
1/*
2 * arch/arm/mach-zynq/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros
5 *
6 * Copyright (C) 2011 Xilinx
7 *
8 * based on arch/plat-mxc/include/mach/entry-macro.S
9 *
10 * Copyright (C) 2007 Lennert Buytenhek <buytenh@wantstofly.org>
11 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
12 *
13 * This software is licensed under the terms of the GNU General Public
14 * License version 2, as published by the Free Software Foundation, and
15 * may be copied, distributed, and modified under those terms.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 */
22
23#include <mach/hardware.h>
24#include <asm/hardware/entry-macro-gic.S>
25
26 .macro disable_fiq
27 .endm
28
29 .macro arch_ret_to_user, tmp1, tmp2
30 .endm
diff --git a/arch/arm/mach-zynq/include/mach/hardware.h b/arch/arm/mach-zynq/include/mach/hardware.h
new file mode 100644
index 00000000000..d558d8a94be
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/hardware.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-zynq/include/mach/hardware.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_HARDWARE_H__
16#define __MACH_HARDWARE_H__
17
18#endif
diff --git a/arch/arm/mach-zynq/include/mach/io.h b/arch/arm/mach-zynq/include/mach/io.h
new file mode 100644
index 00000000000..39d9885e0e9
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/io.h
@@ -0,0 +1,33 @@
1/* arch/arm/mach-zynq/include/mach/io.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_IO_H__
16#define __MACH_IO_H__
17
18/* Allow IO space to be anywhere in the memory */
19
20#define IO_SPACE_LIMIT 0xffff
21
22/* IO address mapping macros, nothing special at this time but required */
23
24#ifdef __ASSEMBLER__
25#define IOMEM(x) (x)
26#else
27#define IOMEM(x) ((void __force __iomem *)(x))
28#endif
29
30#define __io(a) __typesafe_io(a)
31#define __mem_pci(a) (a)
32
33#endif
diff --git a/arch/arm/mach-zynq/include/mach/irqs.h b/arch/arm/mach-zynq/include/mach/irqs.h
new file mode 100644
index 00000000000..5fb04fd3bac
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/irqs.h
@@ -0,0 +1,21 @@
1/* arch/arm/mach-zynq/include/mach/irqs.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_IRQS_H
16#define __MACH_IRQS_H
17
18#define ARCH_NR_GPIOS 118
19#define NR_IRQS (128 + ARCH_NR_GPIOS)
20
21#endif
diff --git a/arch/arm/mach-zynq/include/mach/memory.h b/arch/arm/mach-zynq/include/mach/memory.h
new file mode 100644
index 00000000000..35a92634dcc
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/memory.h
@@ -0,0 +1,22 @@
1/* arch/arm/mach-zynq/include/mach/memory.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_MEMORY_H__
16#define __MACH_MEMORY_H__
17
18#include <asm/sizes.h>
19
20#define PLAT_PHYS_OFFSET UL(0x0)
21
22#endif
diff --git a/arch/arm/mach-tegra/include/mach/clkdev.h b/arch/arm/mach-zynq/include/mach/system.h
index 66cd3f4fc89..1b84d705c67 100644
--- a/arch/arm/mach-tegra/include/mach/clkdev.h
+++ b/arch/arm/mach-zynq/include/mach/system.h
@@ -1,10 +1,6 @@
1/* 1/* arch/arm/mach-zynq/include/mach/system.h
2 * arch/arm/mach-tegra/include/mach/clkdev.h
3 * 2 *
4 * Copyright (C) 2010 Google, Inc. 3 * Copyright (C) 2011 Xilinx
5 *
6 * Author:
7 * Colin Cross <ccross@google.com>
8 * 4 *
9 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and 6 * License version 2, as published by the Free Software Foundation, and
@@ -14,21 +10,19 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 12 * GNU General Public License for more details.
17 *
18 */ 13 */
19 14
20#ifndef __MACH_CLKDEV_H 15#ifndef __MACH_SYSTEM_H__
21#define __MACH_CLKDEV_H 16#define __MACH_SYSTEM_H__
22
23struct clk;
24 17
25static inline int __clk_get(struct clk *clk) 18static inline void arch_idle(void)
26{ 19{
27 return 1; 20 cpu_do_idle();
28} 21}
29 22
30static inline void __clk_put(struct clk *clk) 23static inline void arch_reset(char mode, const char *cmd)
31{ 24{
25 /* Add architecture specific reset processing here */
32} 26}
33 27
34#endif 28#endif
diff --git a/arch/arm/mach-zynq/include/mach/timex.h b/arch/arm/mach-zynq/include/mach/timex.h
new file mode 100644
index 00000000000..6c0245e42a5
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/timex.h
@@ -0,0 +1,23 @@
1/* arch/arm/mach-zynq/include/mach/timex.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_TIMEX_H__
16#define __MACH_TIMEX_H__
17
18/* the following is needed for the system to build but will be removed
19 in the future, the value is not important but won't hurt
20*/
21#define CLOCK_TICK_RATE (100 * HZ)
22
23#endif
diff --git a/arch/arm/mach-zynq/include/mach/uart.h b/arch/arm/mach-zynq/include/mach/uart.h
new file mode 100644
index 00000000000..5c47c97156f
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/uart.h
@@ -0,0 +1,25 @@
1/* arch/arm/mach-zynq/include/mach/uart.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_UART_H__
16#define __MACH_UART_H__
17
18#define UART_CR_OFFSET 0x00 /* Control Register [8:0] */
19#define UART_SR_OFFSET 0x2C /* Channel Status [11:0] */
20#define UART_FIFO_OFFSET 0x30 /* FIFO [15:0] or [7:0] */
21
22#define UART_SR_TXFULL 0x00000010 /* TX FIFO full */
23#define UART_SR_TXEMPTY 0x00000008 /* TX FIFO empty */
24
25#endif
diff --git a/arch/arm/mach-zynq/include/mach/uncompress.h b/arch/arm/mach-zynq/include/mach/uncompress.h
new file mode 100644
index 00000000000..af4e8447bfa
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/uncompress.h
@@ -0,0 +1,51 @@
1/* arch/arm/mach-zynq/include/mach/uncompress.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_UNCOMPRESS_H__
16#define __MACH_UNCOMPRESS_H__
17
18#include <linux/io.h>
19#include <asm/processor.h>
20#include <mach/zynq_soc.h>
21#include <mach/uart.h>
22
23void arch_decomp_setup(void)
24{
25}
26
27static inline void flush(void)
28{
29 /*
30 * Wait while the FIFO is not empty
31 */
32 while (!(__raw_readl(IOMEM(LL_UART_PADDR + UART_SR_OFFSET)) &
33 UART_SR_TXEMPTY))
34 cpu_relax();
35}
36
37#define arch_decomp_wdog()
38
39static void putc(char ch)
40{
41 /*
42 * Wait for room in the FIFO, then write the char into the FIFO
43 */
44 while (__raw_readl(IOMEM(LL_UART_PADDR + UART_SR_OFFSET)) &
45 UART_SR_TXFULL)
46 cpu_relax();
47
48 __raw_writel(ch, IOMEM(LL_UART_PADDR + UART_FIFO_OFFSET));
49}
50
51#endif
diff --git a/arch/arm/mach-zynq/include/mach/vmalloc.h b/arch/arm/mach-zynq/include/mach/vmalloc.h
new file mode 100644
index 00000000000..2398eff1e8b
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/* arch/arm/mach-zynq/include/mach/vmalloc.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_VMALLOC_H__
16#define __MACH_VMALLOC_H__
17
18#define VMALLOC_END 0xE0000000UL
19
20#endif
diff --git a/arch/arm/mach-zynq/include/mach/zynq_soc.h b/arch/arm/mach-zynq/include/mach/zynq_soc.h
new file mode 100644
index 00000000000..d0d3f8fb06d
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/zynq_soc.h
@@ -0,0 +1,48 @@
1/* arch/arm/mach-zynq/include/mach/zynq_soc.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_XILINX_SOC_H__
16#define __MACH_XILINX_SOC_H__
17
18#define PERIPHERAL_CLOCK_RATE 2500000
19
20/* For now, all mappings are flat (physical = virtual)
21 */
22#define UART0_PHYS 0xE0000000
23#define UART0_VIRT UART0_PHYS
24
25#define TTC0_PHYS 0xF8001000
26#define TTC0_VIRT TTC0_PHYS
27
28#define PL310_L2CC_PHYS 0xF8F02000
29#define PL310_L2CC_VIRT PL310_L2CC_PHYS
30
31#define SCU_PERIPH_PHYS 0xF8F00000
32#define SCU_PERIPH_VIRT SCU_PERIPH_PHYS
33
34/* The following are intended for the devices that are mapped early */
35
36#define TTC0_BASE IOMEM(TTC0_VIRT)
37#define SCU_PERIPH_BASE IOMEM(SCU_PERIPH_VIRT)
38#define SCU_GIC_CPU_BASE (SCU_PERIPH_BASE + 0x100)
39#define SCU_GIC_DIST_BASE (SCU_PERIPH_BASE + 0x1000)
40#define PL310_L2CC_BASE IOMEM(PL310_L2CC_VIRT)
41
42/*
43 * Mandatory for CONFIG_LL_DEBUG, UART is mapped virtual = physical
44 */
45#define LL_UART_PADDR UART0_PHYS
46#define LL_UART_VADDR UART0_VIRT
47
48#endif
diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c
new file mode 100644
index 00000000000..c2c96cc7d6e
--- /dev/null
+++ b/arch/arm/mach-zynq/timer.c
@@ -0,0 +1,298 @@
1/*
2 * This file contains driver for the Xilinx PS Timer Counter IP.
3 *
4 * Copyright (C) 2011 Xilinx
5 *
6 * based on arch/mips/kernel/time.c timer driver
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/interrupt.h>
21#include <linux/irq.h>
22#include <linux/types.h>
23#include <linux/clocksource.h>
24#include <linux/clockchips.h>
25#include <linux/io.h>
26
27#include <asm/mach/time.h>
28#include <mach/zynq_soc.h>
29#include "common.h"
30
31#define IRQ_TIMERCOUNTER0 42
32
33/*
34 * This driver configures the 2 16-bit count-up timers as follows:
35 *
36 * T1: Timer 1, clocksource for generic timekeeping
37 * T2: Timer 2, clockevent source for hrtimers
38 * T3: Timer 3, <unused>
39 *
40 * The input frequency to the timer module for emulation is 2.5MHz which is
41 * common to all the timer channels (T1, T2, and T3). With a pre-scaler of 32,
42 * the timers are clocked at 78.125KHz (12.8 us resolution).
43 *
44 * The input frequency to the timer module in silicon will be 200MHz. With the
45 * pre-scaler of 32, the timers are clocked at 6.25MHz (160ns resolution).
46 */
47#define XTTCPSS_CLOCKSOURCE 0 /* Timer 1 as a generic timekeeping */
48#define XTTCPSS_CLOCKEVENT 1 /* Timer 2 as a clock event */
49
50#define XTTCPSS_TIMER_BASE TTC0_BASE
51#define XTTCPCC_EVENT_TIMER_IRQ (IRQ_TIMERCOUNTER0 + 1)
52/*
53 * Timer Register Offset Definitions of Timer 1, Increment base address by 4
54 * and use same offsets for Timer 2
55 */
56#define XTTCPSS_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */
57#define XTTCPSS_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */
58#define XTTCPSS_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */
59#define XTTCPSS_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */
60#define XTTCPSS_MATCH_1_OFFSET 0x30 /* Match 1 Value Reg, RW */
61#define XTTCPSS_MATCH_2_OFFSET 0x3C /* Match 2 Value Reg, RW */
62#define XTTCPSS_MATCH_3_OFFSET 0x48 /* Match 3 Value Reg, RW */
63#define XTTCPSS_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */
64#define XTTCPSS_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */
65
66#define XTTCPSS_CNT_CNTRL_DISABLE_MASK 0x1
67
68/* Setup the timers to use pre-scaling */
69
70#define TIMER_RATE (PERIPHERAL_CLOCK_RATE / 32)
71
72/**
73 * struct xttcpss_timer - This definition defines local timer structure
74 *
75 * @base_addr: Base address of timer
76 **/
77struct xttcpss_timer {
78 void __iomem *base_addr;
79};
80
81static struct xttcpss_timer timers[2];
82static struct clock_event_device xttcpss_clockevent;
83
84/**
85 * xttcpss_set_interval - Set the timer interval value
86 *
87 * @timer: Pointer to the timer instance
88 * @cycles: Timer interval ticks
89 **/
90static void xttcpss_set_interval(struct xttcpss_timer *timer,
91 unsigned long cycles)
92{
93 u32 ctrl_reg;
94
95 /* Disable the counter, set the counter value and re-enable counter */
96 ctrl_reg = __raw_readl(timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
97 ctrl_reg |= XTTCPSS_CNT_CNTRL_DISABLE_MASK;
98 __raw_writel(ctrl_reg, timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
99
100 __raw_writel(cycles, timer->base_addr + XTTCPSS_INTR_VAL_OFFSET);
101
102 /* Reset the counter (0x10) so that it starts from 0, one-shot
103 mode makes this needed for timing to be right. */
104 ctrl_reg |= 0x10;
105 ctrl_reg &= ~XTTCPSS_CNT_CNTRL_DISABLE_MASK;
106 __raw_writel(ctrl_reg, timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
107}
108
109/**
110 * xttcpss_clock_event_interrupt - Clock event timer interrupt handler
111 *
112 * @irq: IRQ number of the Timer
113 * @dev_id: void pointer to the xttcpss_timer instance
114 *
115 * returns: Always IRQ_HANDLED - success
116 **/
117static irqreturn_t xttcpss_clock_event_interrupt(int irq, void *dev_id)
118{
119 struct clock_event_device *evt = &xttcpss_clockevent;
120 struct xttcpss_timer *timer = dev_id;
121
122 /* Acknowledge the interrupt and call event handler */
123 __raw_writel(__raw_readl(timer->base_addr + XTTCPSS_ISR_OFFSET),
124 timer->base_addr + XTTCPSS_ISR_OFFSET);
125
126 evt->event_handler(evt);
127
128 return IRQ_HANDLED;
129}
130
131static struct irqaction event_timer_irq = {
132 .name = "xttcpss clockevent",
133 .flags = IRQF_DISABLED | IRQF_TIMER,
134 .handler = xttcpss_clock_event_interrupt,
135};
136
137/**
138 * xttcpss_timer_hardware_init - Initialize the timer hardware
139 *
140 * Initialize the hardware to start the clock source, get the clock
141 * event timer ready to use, and hook up the interrupt.
142 **/
143static void __init xttcpss_timer_hardware_init(void)
144{
145 /* Setup the clock source counter to be an incrementing counter
146 * with no interrupt and it rolls over at 0xFFFF. Pre-scale
147 it by 32 also. Let it start running now.
148 */
149 timers[XTTCPSS_CLOCKSOURCE].base_addr = XTTCPSS_TIMER_BASE;
150
151 __raw_writel(0x0, timers[XTTCPSS_CLOCKSOURCE].base_addr +
152 XTTCPSS_IER_OFFSET);
153 __raw_writel(0x9, timers[XTTCPSS_CLOCKSOURCE].base_addr +
154 XTTCPSS_CLK_CNTRL_OFFSET);
155 __raw_writel(0x10, timers[XTTCPSS_CLOCKSOURCE].base_addr +
156 XTTCPSS_CNT_CNTRL_OFFSET);
157
158 /* Setup the clock event timer to be an interval timer which
159 * is prescaled by 32 using the interval interrupt. Leave it
160 * disabled for now.
161 */
162
163 timers[XTTCPSS_CLOCKEVENT].base_addr = XTTCPSS_TIMER_BASE + 4;
164
165 __raw_writel(0x23, timers[XTTCPSS_CLOCKEVENT].base_addr +
166 XTTCPSS_CNT_CNTRL_OFFSET);
167 __raw_writel(0x9, timers[XTTCPSS_CLOCKEVENT].base_addr +
168 XTTCPSS_CLK_CNTRL_OFFSET);
169 __raw_writel(0x1, timers[XTTCPSS_CLOCKEVENT].base_addr +
170 XTTCPSS_IER_OFFSET);
171
172 /* Setup IRQ the clock event timer */
173 event_timer_irq.dev_id = &timers[XTTCPSS_CLOCKEVENT];
174 setup_irq(XTTCPCC_EVENT_TIMER_IRQ, &event_timer_irq);
175}
176
177/**
178 * __raw_readl_cycles - Reads the timer counter register
179 *
180 * returns: Current timer counter register value
181 **/
182static cycle_t __raw_readl_cycles(struct clocksource *cs)
183{
184 struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKSOURCE];
185
186 return (cycle_t)__raw_readl(timer->base_addr +
187 XTTCPSS_COUNT_VAL_OFFSET);
188}
189
190
191/*
192 * Instantiate and initialize the clock source structure
193 */
194static struct clocksource clocksource_xttcpss = {
195 .name = "xttcpss_timer1",
196 .rating = 200, /* Reasonable clock source */
197 .read = __raw_readl_cycles,
198 .mask = CLOCKSOURCE_MASK(16),
199 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
200};
201
202
203/**
204 * xttcpss_set_next_event - Sets the time interval for next event
205 *
206 * @cycles: Timer interval ticks
207 * @evt: Address of clock event instance
208 *
209 * returns: Always 0 - success
210 **/
211static int xttcpss_set_next_event(unsigned long cycles,
212 struct clock_event_device *evt)
213{
214 struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKEVENT];
215
216 xttcpss_set_interval(timer, cycles);
217 return 0;
218}
219
220/**
221 * xttcpss_set_mode - Sets the mode of timer
222 *
223 * @mode: Mode to be set
224 * @evt: Address of clock event instance
225 **/
226static void xttcpss_set_mode(enum clock_event_mode mode,
227 struct clock_event_device *evt)
228{
229 struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKEVENT];
230 u32 ctrl_reg;
231
232 switch (mode) {
233 case CLOCK_EVT_MODE_PERIODIC:
234 xttcpss_set_interval(timer, TIMER_RATE / HZ);
235 break;
236 case CLOCK_EVT_MODE_ONESHOT:
237 case CLOCK_EVT_MODE_UNUSED:
238 case CLOCK_EVT_MODE_SHUTDOWN:
239 ctrl_reg = __raw_readl(timer->base_addr +
240 XTTCPSS_CNT_CNTRL_OFFSET);
241 ctrl_reg |= XTTCPSS_CNT_CNTRL_DISABLE_MASK;
242 __raw_writel(ctrl_reg,
243 timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
244 break;
245 case CLOCK_EVT_MODE_RESUME:
246 ctrl_reg = __raw_readl(timer->base_addr +
247 XTTCPSS_CNT_CNTRL_OFFSET);
248 ctrl_reg &= ~XTTCPSS_CNT_CNTRL_DISABLE_MASK;
249 __raw_writel(ctrl_reg,
250 timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
251 break;
252 }
253}
254
255/*
256 * Instantiate and initialize the clock event structure
257 */
258static struct clock_event_device xttcpss_clockevent = {
259 .name = "xttcpss_timer2",
260 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
261 .set_next_event = xttcpss_set_next_event,
262 .set_mode = xttcpss_set_mode,
263 .rating = 200,
264};
265
266/**
267 * xttcpss_timer_init - Initialize the timer
268 *
269 * Initializes the timer hardware and register the clock source and clock event
270 * timers with Linux kernal timer framework
271 **/
272static void __init xttcpss_timer_init(void)
273{
274 xttcpss_timer_hardware_init();
275 clocksource_register_hz(&clocksource_xttcpss, TIMER_RATE);
276
277 /* Calculate the parameters to allow the clockevent to operate using
278 integer math
279 */
280 clockevents_calc_mult_shift(&xttcpss_clockevent, TIMER_RATE, 4);
281
282 xttcpss_clockevent.max_delta_ns =
283 clockevent_delta2ns(0xfffe, &xttcpss_clockevent);
284 xttcpss_clockevent.min_delta_ns =
285 clockevent_delta2ns(1, &xttcpss_clockevent);
286
287 /* Indicate that clock event is on 1st CPU as SMP boot needs it */
288
289 xttcpss_clockevent.cpumask = cpumask_of(0);
290 clockevents_register_device(&xttcpss_clockevent);
291}
292
293/*
294 * Instantiate and initialize the system timer structure
295 */
296struct sys_timer xttcpss_sys_timer = {
297 .init = xttcpss_timer_init,
298};
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 0074b8dba79..88633fe01a5 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -821,7 +821,8 @@ config CACHE_L2X0
821 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \ 821 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \
822 REALVIEW_EB_A9MP || SOC_IMX35 || SOC_IMX31 || MACH_REALVIEW_PBX || \ 822 REALVIEW_EB_A9MP || SOC_IMX35 || SOC_IMX31 || MACH_REALVIEW_PBX || \
823 ARCH_NOMADIK || ARCH_OMAP4 || ARCH_EXYNOS4 || ARCH_TEGRA || \ 823 ARCH_NOMADIK || ARCH_OMAP4 || ARCH_EXYNOS4 || ARCH_TEGRA || \
824 ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE 824 ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE || \
825 ARCH_PRIMA2 || ARCH_ZYNQ || ARCH_CNS3XXX
825 default y 826 default y
826 select OUTER_CACHE 827 select OUTER_CACHE
827 select OUTER_CACHE_SYNC 828 select OUTER_CACHE_SYNC
diff --git a/arch/arm/mm/abort-macro.S b/arch/arm/mm/abort-macro.S
index 52162d59407..2cbf68ef0e8 100644
--- a/arch/arm/mm/abort-macro.S
+++ b/arch/arm/mm/abort-macro.S
@@ -17,7 +17,7 @@
17 cmp \tmp, # 0x5600 @ Is it ldrsb? 17 cmp \tmp, # 0x5600 @ Is it ldrsb?
18 orreq \tmp, \tmp, #1 << 11 @ Set L-bit if yes 18 orreq \tmp, \tmp, #1 << 11 @ Set L-bit if yes
19 tst \tmp, #1 << 11 @ L = 0 -> write 19 tst \tmp, #1 << 11 @ L = 0 -> write
20 orreq \psr, \psr, #1 << 11 @ yes. 20 orreq \fsr, \fsr, #1 << 11 @ yes.
21 b do_DataAbort 21 b do_DataAbort
22not_thumb: 22not_thumb:
23 .endm 23 .endm
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index be7c638b648..cfbcf8b9559 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -22,6 +22,7 @@
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/uaccess.h> 23#include <linux/uaccess.h>
24 24
25#include <asm/system.h>
25#include <asm/unaligned.h> 26#include <asm/unaligned.h>
26 27
27#include "fault.h" 28#include "fault.h"
@@ -95,6 +96,33 @@ static const char *usermode_action[] = {
95 "signal+warn" 96 "signal+warn"
96}; 97};
97 98
99/* Return true if and only if the ARMv6 unaligned access model is in use. */
100static bool cpu_is_v6_unaligned(void)
101{
102 return cpu_architecture() >= CPU_ARCH_ARMv6 && (cr_alignment & CR_U);
103}
104
105static int safe_usermode(int new_usermode, bool warn)
106{
107 /*
108 * ARMv6 and later CPUs can perform unaligned accesses for
109 * most single load and store instructions up to word size.
110 * LDM, STM, LDRD and STRD still need to be handled.
111 *
112 * Ignoring the alignment fault is not an option on these
113 * CPUs since we spin re-faulting the instruction without
114 * making any progress.
115 */
116 if (cpu_is_v6_unaligned() && !(new_usermode & (UM_FIXUP | UM_SIGNAL))) {
117 new_usermode |= UM_FIXUP;
118
119 if (warn)
120 printk(KERN_WARNING "alignment: ignoring faults is unsafe on this CPU. Defaulting to fixup mode.\n");
121 }
122
123 return new_usermode;
124}
125
98static int alignment_proc_show(struct seq_file *m, void *v) 126static int alignment_proc_show(struct seq_file *m, void *v)
99{ 127{
100 seq_printf(m, "User:\t\t%lu\n", ai_user); 128 seq_printf(m, "User:\t\t%lu\n", ai_user);
@@ -125,7 +153,7 @@ static ssize_t alignment_proc_write(struct file *file, const char __user *buffer
125 if (get_user(mode, buffer)) 153 if (get_user(mode, buffer))
126 return -EFAULT; 154 return -EFAULT;
127 if (mode >= '0' && mode <= '5') 155 if (mode >= '0' && mode <= '5')
128 ai_usermode = mode - '0'; 156 ai_usermode = safe_usermode(mode - '0', true);
129 } 157 }
130 return count; 158 return count;
131} 159}
@@ -886,9 +914,16 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
886 if (ai_usermode & UM_FIXUP) 914 if (ai_usermode & UM_FIXUP)
887 goto fixup; 915 goto fixup;
888 916
889 if (ai_usermode & UM_SIGNAL) 917 if (ai_usermode & UM_SIGNAL) {
890 force_sig(SIGBUS, current); 918 siginfo_t si;
891 else { 919
920 si.si_signo = SIGBUS;
921 si.si_errno = 0;
922 si.si_code = BUS_ADRALN;
923 si.si_addr = (void __user *)addr;
924
925 force_sig_info(si.si_signo, &si, current);
926 } else {
892 /* 927 /*
893 * We're about to disable the alignment trap and return to 928 * We're about to disable the alignment trap and return to
894 * user space. But if an interrupt occurs before actually 929 * user space. But if an interrupt occurs before actually
@@ -926,20 +961,11 @@ static int __init alignment_init(void)
926 return -ENOMEM; 961 return -ENOMEM;
927#endif 962#endif
928 963
929 /* 964 if (cpu_is_v6_unaligned()) {
930 * ARMv6 and later CPUs can perform unaligned accesses for
931 * most single load and store instructions up to word size.
932 * LDM, STM, LDRD and STRD still need to be handled.
933 *
934 * Ignoring the alignment fault is not an option on these
935 * CPUs since we spin re-faulting the instruction without
936 * making any progress.
937 */
938 if (cpu_architecture() >= CPU_ARCH_ARMv6 && (cr_alignment & CR_U)) {
939 cr_alignment &= ~CR_A; 965 cr_alignment &= ~CR_A;
940 cr_no_alignment &= ~CR_A; 966 cr_no_alignment &= ~CR_A;
941 set_cr(cr_alignment); 967 set_cr(cr_alignment);
942 ai_usermode = UM_FIXUP; 968 ai_usermode = safe_usermode(ai_usermode, false);
943 } 969 }
944 970
945 hook_fault_code(1, do_alignment, SIGBUS, BUS_ADRALN, 971 hook_fault_code(1, do_alignment, SIGBUS, BUS_ADRALN,
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 44c086710d2..9ecfdb51195 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -277,6 +277,25 @@ static void l2x0_disable(void)
277 spin_unlock_irqrestore(&l2x0_lock, flags); 277 spin_unlock_irqrestore(&l2x0_lock, flags);
278} 278}
279 279
280static void __init l2x0_unlock(__u32 cache_id)
281{
282 int lockregs;
283 int i;
284
285 if (cache_id == L2X0_CACHE_ID_PART_L310)
286 lockregs = 8;
287 else
288 /* L210 and unknown types */
289 lockregs = 1;
290
291 for (i = 0; i < lockregs; i++) {
292 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE +
293 i * L2X0_LOCKDOWN_STRIDE);
294 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_I_BASE +
295 i * L2X0_LOCKDOWN_STRIDE);
296 }
297}
298
280void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) 299void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
281{ 300{
282 __u32 aux; 301 __u32 aux;
@@ -328,6 +347,8 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
328 * accessing the below registers will fault. 347 * accessing the below registers will fault.
329 */ 348 */
330 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 349 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
350 /* Make sure that I&D is not locked down when starting */
351 l2x0_unlock(cache_id);
331 352
332 /* l2x0 controller is disabled */ 353 /* l2x0 controller is disabled */
333 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL); 354 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 2fee782077c..cc7e2d8be9a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -298,7 +298,7 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
298#ifdef CONFIG_HAVE_ARCH_PFN_VALID 298#ifdef CONFIG_HAVE_ARCH_PFN_VALID
299int pfn_valid(unsigned long pfn) 299int pfn_valid(unsigned long pfn)
300{ 300{
301 return memblock_is_memory(pfn << PAGE_SHIFT); 301 return memblock_is_memory(__pfn_to_phys(pfn));
302} 302}
303EXPORT_SYMBOL(pfn_valid); 303EXPORT_SYMBOL(pfn_valid);
304#endif 304#endif
@@ -441,7 +441,7 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s)
441static inline void poison_init_mem(void *s, size_t count) 441static inline void poison_init_mem(void *s, size_t count)
442{ 442{
443 u32 *p = (u32 *)s; 443 u32 *p = (u32 *)s;
444 while ((count = count - 4)) 444 for (; count != 0; count -= 4)
445 *p++ = 0xe7fddef0; 445 *p++ = 0xe7fddef0;
446} 446}
447 447
diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
index ffad039cbb7..430df1a5978 100644
--- a/arch/arm/mm/iomap.c
+++ b/arch/arm/mm/iomap.c
@@ -9,6 +9,9 @@
9#include <linux/ioport.h> 9#include <linux/ioport.h>
10#include <linux/io.h> 10#include <linux/io.h>
11 11
12unsigned long vga_base;
13EXPORT_SYMBOL(vga_base);
14
12#ifdef __io 15#ifdef __io
13void __iomem *ioport_map(unsigned long port, unsigned int nr) 16void __iomem *ioport_map(unsigned long port, unsigned int nr)
14{ 17{
@@ -23,6 +26,15 @@ EXPORT_SYMBOL(ioport_unmap);
23#endif 26#endif
24 27
25#ifdef CONFIG_PCI 28#ifdef CONFIG_PCI
29unsigned long pcibios_min_io = 0x1000;
30EXPORT_SYMBOL(pcibios_min_io);
31
32unsigned long pcibios_min_mem = 0x01000000;
33EXPORT_SYMBOL(pcibios_min_mem);
34
35unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
36EXPORT_SYMBOL(pci_flags);
37
26void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 38void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
27{ 39{
28 resource_size_t start = pci_resource_start(dev, bar); 40 resource_size_t start = pci_resource_start(dev, bar);
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index 92bd102e398..2e6849b41f6 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -379,7 +379,7 @@ ENTRY(cpu_arm920_set_pte_ext)
379 379
380/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ 380/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */
381.globl cpu_arm920_suspend_size 381.globl cpu_arm920_suspend_size
382.equ cpu_arm920_suspend_size, 4 * 3 382.equ cpu_arm920_suspend_size, 4 * 4
383#ifdef CONFIG_PM_SLEEP 383#ifdef CONFIG_PM_SLEEP
384ENTRY(cpu_arm920_do_suspend) 384ENTRY(cpu_arm920_do_suspend)
385 stmfd sp!, {r4 - r7, lr} 385 stmfd sp!, {r4 - r7, lr}
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 2bbcf053dff..cd8f79c3a28 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -394,7 +394,7 @@ ENTRY(cpu_arm926_set_pte_ext)
394 394
395/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ 395/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */
396.globl cpu_arm926_suspend_size 396.globl cpu_arm926_suspend_size
397.equ cpu_arm926_suspend_size, 4 * 3 397.equ cpu_arm926_suspend_size, 4 * 4
398#ifdef CONFIG_PM_SLEEP 398#ifdef CONFIG_PM_SLEEP
399ENTRY(cpu_arm926_do_suspend) 399ENTRY(cpu_arm926_do_suspend)
400 stmfd sp!, {r4 - r7, lr} 400 stmfd sp!, {r4 - r7, lr}
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index f8f7ea34bfc..683af3a182b 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -410,6 +410,7 @@ __arm946_proc_info:
410 .long 0x41009460 410 .long 0x41009460
411 .long 0xff00fff0 411 .long 0xff00fff0
412 .long 0 412 .long 0
413 .long 0
413 b __arm946_setup 414 b __arm946_setup
414 .long cpu_arch_name 415 .long cpu_arch_name
415 .long cpu_elf_name 416 .long cpu_elf_name
@@ -418,6 +419,6 @@ __arm946_proc_info:
418 .long arm946_processor_functions 419 .long arm946_processor_functions
419 .long 0 420 .long 0
420 .long 0 421 .long 0
421 .long arm940_cache_fns 422 .long arm946_cache_fns
422 .size __arm946_proc_info, . - __arm946_proc_info 423 .size __arm946_proc_info, . - __arm946_proc_info
423 424
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index 07219c2ae11..69e7f2ef738 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -182,11 +182,11 @@ ENDPROC(cpu_sa1100_do_suspend)
182 182
183ENTRY(cpu_sa1100_do_resume) 183ENTRY(cpu_sa1100_do_resume)
184 ldmia r0, {r4 - r7} @ load cp regs 184 ldmia r0, {r4 - r7} @ load cp regs
185 mov r1, #0 185 mov ip, #0
186 mcr p15, 0, r1, c8, c7, 0 @ flush I+D TLBs 186 mcr p15, 0, ip, c8, c7, 0 @ flush I+D TLBs
187 mcr p15, 0, r1, c7, c7, 0 @ flush I&D cache 187 mcr p15, 0, ip, c7, c7, 0 @ flush I&D cache
188 mcr p15, 0, r1, c9, c0, 0 @ invalidate RB 188 mcr p15, 0, ip, c9, c0, 0 @ invalidate RB
189 mcr p15, 0, r1, c9, c0, 5 @ allow user space to use RB 189 mcr p15, 0, ip, c9, c0, 5 @ allow user space to use RB
190 190
191 mcr p15, 0, r4, c3, c0, 0 @ domain ID 191 mcr p15, 0, r4, c3, c0, 0 @ domain ID
192 mcr p15, 0, r5, c2, c0, 0 @ translation table base addr 192 mcr p15, 0, r5, c2, c0, 0 @ translation table base addr
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 219138d2f15..a923aa0fd00 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -223,6 +223,22 @@ __v6_setup:
223 mrc p15, 0, r0, c1, c0, 0 @ read control register 223 mrc p15, 0, r0, c1, c0, 0 @ read control register
224 bic r0, r0, r5 @ clear bits them 224 bic r0, r0, r5 @ clear bits them
225 orr r0, r0, r6 @ set them 225 orr r0, r0, r6 @ set them
226#ifdef CONFIG_ARM_ERRATA_364296
227 /*
228 * Workaround for the 364296 ARM1136 r0p2 erratum (possible cache data
229 * corruption with hit-under-miss enabled). The conditional code below
230 * (setting the undocumented bit 31 in the auxiliary control register
231 * and the FI bit in the control register) disables hit-under-miss
232 * without putting the processor into full low interrupt latency mode.
233 */
234 ldr r6, =0x4107b362 @ id for ARM1136 r0p2
235 mrc p15, 0, r5, c0, c0, 0 @ get processor id
236 teq r5, r6 @ check for the faulty core
237 mrceq p15, 0, r5, c1, c0, 1 @ load aux control reg
238 orreq r5, r5, #(1 << 31) @ set the undocumented bit 31
239 mcreq p15, 0, r5, c1, c0, 1 @ write aux control reg
240 orreq r0, r0, #(1 << 21) @ low interrupt latency configuration
241#endif
226 mov pc, lr @ return to head.S:__ret 242 mov pc, lr @ return to head.S:__ret
227 243
228 /* 244 /*
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index a30e78542cc..9049c0764db 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -66,6 +66,7 @@ ENDPROC(cpu_v7_proc_fin)
66ENTRY(cpu_v7_reset) 66ENTRY(cpu_v7_reset)
67 mrc p15, 0, r1, c1, c0, 0 @ ctrl register 67 mrc p15, 0, r1, c1, c0, 0 @ ctrl register
68 bic r1, r1, #0x1 @ ...............m 68 bic r1, r1, #0x1 @ ...............m
69 THUMB( bic r1, r1, #1 << 30 ) @ SCTLR.TE (Thumb exceptions)
69 mcr p15, 0, r1, c1, c0, 0 @ disable MMU 70 mcr p15, 0, r1, c1, c0, 0 @ disable MMU
70 isb 71 isb
71 mov pc, r0 72 mov pc, r0
@@ -247,13 +248,16 @@ ENTRY(cpu_v7_do_resume)
247 mcr p15, 0, r7, c2, c0, 0 @ TTB 0 248 mcr p15, 0, r7, c2, c0, 0 @ TTB 0
248 mcr p15, 0, r8, c2, c0, 1 @ TTB 1 249 mcr p15, 0, r8, c2, c0, 1 @ TTB 1
249 mcr p15, 0, ip, c2, c0, 2 @ TTB control register 250 mcr p15, 0, ip, c2, c0, 2 @ TTB control register
250 mcr p15, 0, r10, c1, c0, 1 @ Auxiliary control register 251 mrc p15, 0, r4, c1, c0, 1 @ Read Auxiliary control register
252 teq r4, r10 @ Is it already set?
253 mcrne p15, 0, r10, c1, c0, 1 @ No, so write it
251 mcr p15, 0, r11, c1, c0, 2 @ Co-processor access control 254 mcr p15, 0, r11, c1, c0, 2 @ Co-processor access control
252 ldr r4, =PRRR @ PRRR 255 ldr r4, =PRRR @ PRRR
253 ldr r5, =NMRR @ NMRR 256 ldr r5, =NMRR @ NMRR
254 mcr p15, 0, r4, c10, c2, 0 @ write PRRR 257 mcr p15, 0, r4, c10, c2, 0 @ write PRRR
255 mcr p15, 0, r5, c10, c2, 1 @ write NMRR 258 mcr p15, 0, r5, c10, c2, 1 @ write NMRR
256 isb 259 isb
260 dsb
257 mov r0, r9 @ control register 261 mov r0, r9 @ control register
258 mov r2, r7, lsr #14 @ get TTB0 base 262 mov r2, r7, lsr #14 @ get TTB0 base
259 mov r2, r2, lsl #14 263 mov r2, r2, lsl #14
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index 64f1fc7edf0..755e1bf2268 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -28,7 +28,6 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <asm/assembler.h> 29#include <asm/assembler.h>
30#include <asm/hwcap.h> 30#include <asm/hwcap.h>
31#include <mach/hardware.h>
32#include <asm/pgtable.h> 31#include <asm/pgtable.h>
33#include <asm/pgtable-hwdef.h> 32#include <asm/pgtable-hwdef.h>
34#include <asm/page.h> 33#include <asm/page.h>
@@ -407,7 +406,7 @@ ENTRY(cpu_xsc3_set_pte_ext)
407 .align 406 .align
408 407
409.globl cpu_xsc3_suspend_size 408.globl cpu_xsc3_suspend_size
410.equ cpu_xsc3_suspend_size, 4 * 8 409.equ cpu_xsc3_suspend_size, 4 * 7
411#ifdef CONFIG_PM_SLEEP 410#ifdef CONFIG_PM_SLEEP
412ENTRY(cpu_xsc3_do_suspend) 411ENTRY(cpu_xsc3_do_suspend)
413 stmfd sp!, {r4 - r10, lr} 412 stmfd sp!, {r4 - r10, lr}
@@ -419,12 +418,12 @@ ENTRY(cpu_xsc3_do_suspend)
419 mrc p15, 0, r9, c1, c0, 1 @ auxiliary control reg 418 mrc p15, 0, r9, c1, c0, 1 @ auxiliary control reg
420 mrc p15, 0, r10, c1, c0, 0 @ control reg 419 mrc p15, 0, r10, c1, c0, 0 @ control reg
421 bic r4, r4, #2 @ clear frequency change bit 420 bic r4, r4, #2 @ clear frequency change bit
422 stmia r0, {r1, r4 - r10} @ store v:p offset + cp regs 421 stmia r0, {r4 - r10} @ store cp regs
423 ldmia sp!, {r4 - r10, pc} 422 ldmia sp!, {r4 - r10, pc}
424ENDPROC(cpu_xsc3_do_suspend) 423ENDPROC(cpu_xsc3_do_suspend)
425 424
426ENTRY(cpu_xsc3_do_resume) 425ENTRY(cpu_xsc3_do_resume)
427 ldmia r0, {r1, r4 - r10} @ load v:p offset + cp regs 426 ldmia r0, {r4 - r10} @ load cp regs
428 mov ip, #0 427 mov ip, #0
429 mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB 428 mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB
430 mcr p15, 0, ip, c7, c10, 4 @ drain write (&fill) buffer 429 mcr p15, 0, ip, c7, c10, 4 @ drain write (&fill) buffer
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c
index 43f2b158237..845549cbbb2 100644
--- a/arch/arm/plat-iop/pci.c
+++ b/arch/arm/plat-iop/pci.c
@@ -374,6 +374,9 @@ void __init iop3xx_pci_preinit_cond(void)
374 374
375void __init iop3xx_pci_preinit(void) 375void __init iop3xx_pci_preinit(void)
376{ 376{
377 pcibios_min_io = 0;
378 pcibios_min_mem = 0;
379
377 iop3xx_atu_disable(); 380 iop3xx_atu_disable();
378 iop3xx_atu_setup(); 381 iop3xx_atu_setup();
379 iop3xx_atu_debug(); 382 iop3xx_atu_debug();
diff --git a/arch/arm/plat-mxc/devices.c b/arch/arm/plat-mxc/devices.c
index fb166b20f60..0d6ed31bdbf 100644
--- a/arch/arm/plat-mxc/devices.c
+++ b/arch/arm/plat-mxc/devices.c
@@ -95,8 +95,22 @@ struct device mxc_aips_bus = {
95 .parent = &platform_bus, 95 .parent = &platform_bus,
96}; 96};
97 97
98struct device mxc_ahb_bus = {
99 .init_name = "mxc_ahb",
100 .parent = &platform_bus,
101};
102
98static int __init mxc_device_init(void) 103static int __init mxc_device_init(void)
99{ 104{
100 return device_register(&mxc_aips_bus); 105 int ret;
106
107 ret = device_register(&mxc_aips_bus);
108 if (IS_ERR_VALUE(ret))
109 goto done;
110
111 ret = device_register(&mxc_ahb_bus);
112
113done:
114 return ret;
101} 115}
102core_initcall(mxc_device_init); 116core_initcall(mxc_device_init);
diff --git a/arch/arm/plat-mxc/devices/platform-fec.c b/arch/arm/plat-mxc/devices/platform-fec.c
index 4fc6ffc2a13..0bae44e890d 100644
--- a/arch/arm/plat-mxc/devices/platform-fec.c
+++ b/arch/arm/plat-mxc/devices/platform-fec.c
@@ -11,40 +11,45 @@
11#include <mach/hardware.h> 11#include <mach/hardware.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13 13
14#define imx_fec_data_entry_single(soc) \ 14#define imx_fec_data_entry_single(soc, _devid) \
15 { \ 15 { \
16 .devid = _devid, \
16 .iobase = soc ## _FEC_BASE_ADDR, \ 17 .iobase = soc ## _FEC_BASE_ADDR, \
17 .irq = soc ## _INT_FEC, \ 18 .irq = soc ## _INT_FEC, \
18 } 19 }
19 20
20#ifdef CONFIG_SOC_IMX25 21#ifdef CONFIG_SOC_IMX25
21const struct imx_fec_data imx25_fec_data __initconst = 22const struct imx_fec_data imx25_fec_data __initconst =
22 imx_fec_data_entry_single(MX25); 23 imx_fec_data_entry_single(MX25, "imx25-fec");
23#endif /* ifdef CONFIG_SOC_IMX25 */ 24#endif /* ifdef CONFIG_SOC_IMX25 */
24 25
25#ifdef CONFIG_SOC_IMX27 26#ifdef CONFIG_SOC_IMX27
26const struct imx_fec_data imx27_fec_data __initconst = 27const struct imx_fec_data imx27_fec_data __initconst =
27 imx_fec_data_entry_single(MX27); 28 imx_fec_data_entry_single(MX27, "imx27-fec");
28#endif /* ifdef CONFIG_SOC_IMX27 */ 29#endif /* ifdef CONFIG_SOC_IMX27 */
29 30
30#ifdef CONFIG_SOC_IMX35 31#ifdef CONFIG_SOC_IMX35
32/* i.mx35 has the i.mx27 type fec */
31const struct imx_fec_data imx35_fec_data __initconst = 33const struct imx_fec_data imx35_fec_data __initconst =
32 imx_fec_data_entry_single(MX35); 34 imx_fec_data_entry_single(MX35, "imx27-fec");
33#endif 35#endif
34 36
35#ifdef CONFIG_SOC_IMX50 37#ifdef CONFIG_SOC_IMX50
38/* i.mx50 has the i.mx25 type fec */
36const struct imx_fec_data imx50_fec_data __initconst = 39const struct imx_fec_data imx50_fec_data __initconst =
37 imx_fec_data_entry_single(MX50); 40 imx_fec_data_entry_single(MX50, "imx25-fec");
38#endif 41#endif
39 42
40#ifdef CONFIG_SOC_IMX51 43#ifdef CONFIG_SOC_IMX51
44/* i.mx51 has the i.mx27 type fec */
41const struct imx_fec_data imx51_fec_data __initconst = 45const struct imx_fec_data imx51_fec_data __initconst =
42 imx_fec_data_entry_single(MX51); 46 imx_fec_data_entry_single(MX51, "imx27-fec");
43#endif 47#endif
44 48
45#ifdef CONFIG_SOC_IMX53 49#ifdef CONFIG_SOC_IMX53
50/* i.mx53 has the i.mx25 type fec */
46const struct imx_fec_data imx53_fec_data __initconst = 51const struct imx_fec_data imx53_fec_data __initconst =
47 imx_fec_data_entry_single(MX53); 52 imx_fec_data_entry_single(MX53, "imx25-fec");
48#endif 53#endif
49 54
50struct platform_device *__init imx_add_fec( 55struct platform_device *__init imx_add_fec(
@@ -63,7 +68,7 @@ struct platform_device *__init imx_add_fec(
63 }, 68 },
64 }; 69 };
65 70
66 return imx_add_platform_device_dmamask("fec", 0, 71 return imx_add_platform_device_dmamask(data->devid, 0,
67 res, ARRAY_SIZE(res), 72 res, ARRAY_SIZE(res),
68 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 73 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
69} 74}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/plat-mxc/devices/platform-imx-dma.c
index c64f015e031..7fa7e9c9246 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-dma.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-dma.c
@@ -6,207 +6,29 @@
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 <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> 9#include <mach/devices-common.h>
15#include <mach/sdma.h>
16
17struct imx_imx_sdma_data {
18 resource_size_t iobase;
19 resource_size_t irq;
20 struct sdma_platform_data pdata;
21};
22
23#define imx_imx_sdma_data_entry_single(soc, _sdma_version, _cpu_name, _to_version)\
24 { \
25 .iobase = soc ## _SDMA ## _BASE_ADDR, \
26 .irq = soc ## _INT_SDMA, \
27 .pdata = { \
28 .sdma_version = _sdma_version, \
29 .cpu_name = _cpu_name, \
30 .to_version = _to_version, \
31 }, \
32 }
33
34#ifdef CONFIG_SOC_IMX25
35struct imx_imx_sdma_data imx25_imx_sdma_data __initconst =
36 imx_imx_sdma_data_entry_single(MX25, 2, "imx25", 1);
37#endif /* ifdef CONFIG_SOC_IMX25 */
38 10
39#ifdef CONFIG_SOC_IMX31 11struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
40struct imx_imx_sdma_data imx31_imx_sdma_data __initdata = 12{
41 imx_imx_sdma_data_entry_single(MX31, 1, "imx31", 1); 13 return platform_device_register_resndata(&mxc_ahb_bus,
42#endif /* ifdef CONFIG_SOC_IMX31 */ 14 "imx-dma", -1, NULL, 0, NULL, 0);
43 15}
44#ifdef CONFIG_SOC_IMX35
45struct imx_imx_sdma_data imx35_imx_sdma_data __initdata =
46 imx_imx_sdma_data_entry_single(MX35, 2, "imx35", 1);
47#endif /* ifdef CONFIG_SOC_IMX35 */
48
49#ifdef CONFIG_SOC_IMX51
50struct imx_imx_sdma_data imx51_imx_sdma_data __initconst =
51 imx_imx_sdma_data_entry_single(MX51, 2, "imx51", 1);
52#endif /* ifdef CONFIG_SOC_IMX51 */
53 16
54static struct platform_device __init __maybe_unused *imx_add_imx_sdma( 17struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
55 const struct imx_imx_sdma_data *data) 18 resource_size_t iobase, int irq, struct sdma_platform_data *pdata)
56{ 19{
57 struct resource res[] = { 20 struct resource res[] = {
58 { 21 {
59 .start = data->iobase, 22 .start = iobase,
60 .end = data->iobase + SZ_16K - 1, 23 .end = iobase + SZ_16K - 1,
61 .flags = IORESOURCE_MEM, 24 .flags = IORESOURCE_MEM,
62 }, { 25 }, {
63 .start = data->irq, 26 .start = irq,
64 .end = data->irq, 27 .end = irq,
65 .flags = IORESOURCE_IRQ, 28 .flags = IORESOURCE_IRQ,
66 }, 29 },
67 }; 30 };
68 31
69 return imx_add_platform_device("imx-sdma", -1, 32 return platform_device_register_resndata(&mxc_ahb_bus, name,
70 res, ARRAY_SIZE(res), 33 -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
71 &data->pdata, sizeof(data->pdata));
72}
73
74static struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
75{
76 return imx_add_platform_device("imx-dma", -1, NULL, 0, NULL, 0);
77}
78
79#ifdef CONFIG_ARCH_MX25
80static struct sdma_script_start_addrs addr_imx25 = {
81 .ap_2_ap_addr = 729,
82 .uart_2_mcu_addr = 904,
83 .per_2_app_addr = 1255,
84 .mcu_2_app_addr = 834,
85 .uartsh_2_mcu_addr = 1120,
86 .per_2_shp_addr = 1329,
87 .mcu_2_shp_addr = 1048,
88 .ata_2_mcu_addr = 1560,
89 .mcu_2_ata_addr = 1479,
90 .app_2_per_addr = 1189,
91 .app_2_mcu_addr = 770,
92 .shp_2_per_addr = 1407,
93 .shp_2_mcu_addr = 979,
94};
95#endif
96
97#ifdef CONFIG_SOC_IMX31
98static struct sdma_script_start_addrs addr_imx31_to1 = {
99 .per_2_per_addr = 1677,
100};
101
102static struct sdma_script_start_addrs addr_imx31_to2 = {
103 .ap_2_ap_addr = 423,
104 .ap_2_bp_addr = 829,
105 .bp_2_ap_addr = 1029,
106};
107#endif
108
109#ifdef CONFIG_SOC_IMX35
110static struct sdma_script_start_addrs addr_imx35_to1 = {
111 .ap_2_ap_addr = 642,
112 .uart_2_mcu_addr = 817,
113 .mcu_2_app_addr = 747,
114 .uartsh_2_mcu_addr = 1183,
115 .per_2_shp_addr = 1033,
116 .mcu_2_shp_addr = 961,
117 .ata_2_mcu_addr = 1333,
118 .mcu_2_ata_addr = 1252,
119 .app_2_mcu_addr = 683,
120 .shp_2_per_addr = 1111,
121 .shp_2_mcu_addr = 892,
122};
123
124static struct sdma_script_start_addrs addr_imx35_to2 = {
125 .ap_2_ap_addr = 729,
126 .uart_2_mcu_addr = 904,
127 .per_2_app_addr = 1597,
128 .mcu_2_app_addr = 834,
129 .uartsh_2_mcu_addr = 1270,
130 .per_2_shp_addr = 1120,
131 .mcu_2_shp_addr = 1048,
132 .ata_2_mcu_addr = 1429,
133 .mcu_2_ata_addr = 1339,
134 .app_2_per_addr = 1531,
135 .app_2_mcu_addr = 770,
136 .shp_2_per_addr = 1198,
137 .shp_2_mcu_addr = 979,
138};
139#endif
140
141#ifdef CONFIG_SOC_IMX51
142static struct sdma_script_start_addrs addr_imx51 = {
143 .ap_2_ap_addr = 642,
144 .uart_2_mcu_addr = 817,
145 .mcu_2_app_addr = 747,
146 .mcu_2_shp_addr = 961,
147 .ata_2_mcu_addr = 1473,
148 .mcu_2_ata_addr = 1392,
149 .app_2_per_addr = 1033,
150 .app_2_mcu_addr = 683,
151 .shp_2_per_addr = 1251,
152 .shp_2_mcu_addr = 892,
153};
154#endif
155
156static int __init imxXX_add_imx_dma(void)
157{
158 struct platform_device *ret;
159
160#if defined(CONFIG_SOC_IMX21) || defined(CONFIG_SOC_IMX27)
161 if (cpu_is_mx21() || cpu_is_mx27())
162 ret = imx_add_imx_dma();
163 else
164#endif
165
166#if defined(CONFIG_SOC_IMX25)
167 if (cpu_is_mx25()) {
168 imx25_imx_sdma_data.pdata.script_addrs = &addr_imx25;
169 ret = imx_add_imx_sdma(&imx25_imx_sdma_data);
170 } else
171#endif
172
173#if defined(CONFIG_SOC_IMX31)
174 if (cpu_is_mx31()) {
175 int to_version = mx31_revision() >> 4;
176 imx31_imx_sdma_data.pdata.to_version = to_version;
177 if (to_version == 1)
178 imx31_imx_sdma_data.pdata.script_addrs = &addr_imx31_to1;
179 else
180 imx31_imx_sdma_data.pdata.script_addrs = &addr_imx31_to2;
181 ret = imx_add_imx_sdma(&imx31_imx_sdma_data);
182 } else
183#endif
184
185#if defined(CONFIG_SOC_IMX35)
186 if (cpu_is_mx35()) {
187 int to_version = mx35_revision() >> 4;
188 imx35_imx_sdma_data.pdata.to_version = to_version;
189 if (to_version == 1)
190 imx35_imx_sdma_data.pdata.script_addrs = &addr_imx35_to1;
191 else
192 imx35_imx_sdma_data.pdata.script_addrs = &addr_imx35_to2;
193 ret = imx_add_imx_sdma(&imx35_imx_sdma_data);
194 } else
195#endif
196
197#if defined(CONFIG_SOC_IMX51)
198 if (cpu_is_mx51()) {
199 int to_version = mx51_revision() >> 4;
200 imx51_imx_sdma_data.pdata.to_version = to_version;
201 imx51_imx_sdma_data.pdata.script_addrs = &addr_imx51;
202 ret = imx_add_imx_sdma(&imx51_imx_sdma_data);
203 } else
204#endif
205 ret = ERR_PTR(-ENODEV);
206
207 if (IS_ERR(ret))
208 return PTR_ERR(ret);
209
210 return 0;
211} 34}
212arch_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 2ab74f0da9a..afe60f7244a 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-i2c.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
@@ -94,8 +94,9 @@ const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst = {
94 imx_imx_i2c_data_entry(MX53, _id, _hwid, SZ_4K) 94 imx_imx_i2c_data_entry(MX53, _id, _hwid, SZ_4K)
95 imx53_imx_i2c_data_entry(0, 1), 95 imx53_imx_i2c_data_entry(0, 1),
96 imx53_imx_i2c_data_entry(1, 2), 96 imx53_imx_i2c_data_entry(1, 2),
97 imx53_imx_i2c_data_entry(2, 3),
97}; 98};
98#endif /* ifdef CONFIG_SOC_IMX51 */ 99#endif /* ifdef CONFIG_SOC_IMX53 */
99 100
100struct platform_device *__init imx_add_imx_i2c( 101struct platform_device *__init imx_add_imx_i2c(
101 const struct imx_imx_i2c_data *data, 102 const struct imx_imx_i2c_data *data,
diff --git a/arch/arm/plat-mxc/devices/platform-imx-keypad.c b/arch/arm/plat-mxc/devices/platform-imx-keypad.c
index 26366114b02..479c3e9f771 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-keypad.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-keypad.c
@@ -46,6 +46,11 @@ const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst =
46 imx_imx_keypad_data_entry_single(MX51, SZ_16); 46 imx_imx_keypad_data_entry_single(MX51, SZ_16);
47#endif /* ifdef CONFIG_SOC_IMX51 */ 47#endif /* ifdef CONFIG_SOC_IMX51 */
48 48
49#ifdef CONFIG_SOC_IMX53
50const struct imx_imx_keypad_data imx53_imx_keypad_data __initconst =
51 imx_imx_keypad_data_entry_single(MX53, SZ_16);
52#endif /* ifdef CONFIG_SOC_IMX53 */
53
49struct platform_device *__init imx_add_imx_keypad( 54struct platform_device *__init imx_add_imx_keypad(
50 const struct imx_imx_keypad_data *data, 55 const struct imx_imx_keypad_data *data,
51 const struct matrix_keymap_data *pdata) 56 const struct matrix_keymap_data *pdata)
diff --git a/arch/arm/plat-mxc/devices/platform-imx-ssi.c b/arch/arm/plat-mxc/devices/platform-imx-ssi.c
index 66b8593e9b6..21c6f30e101 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-ssi.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-ssi.c
@@ -76,6 +76,16 @@ const struct imx_imx_ssi_data imx51_imx_ssi_data[] __initconst = {
76}; 76};
77#endif /* ifdef CONFIG_SOC_IMX51 */ 77#endif /* ifdef CONFIG_SOC_IMX51 */
78 78
79#ifdef CONFIG_SOC_IMX53
80const struct imx_imx_ssi_data imx53_imx_ssi_data[] __initconst = {
81#define imx53_imx_ssi_data_entry(_id, _hwid) \
82 imx_imx_ssi_data_entry(MX53, _id, _hwid, SZ_16K)
83 imx53_imx_ssi_data_entry(0, 1),
84 imx53_imx_ssi_data_entry(1, 2),
85 imx53_imx_ssi_data_entry(2, 3),
86};
87#endif /* ifdef CONFIG_SOC_IMX53 */
88
79struct platform_device *__init imx_add_imx_ssi( 89struct platform_device *__init imx_add_imx_ssi(
80 const struct imx_imx_ssi_data *data, 90 const struct imx_imx_ssi_data *data,
81 const struct imx_ssi_platform_data *pdata) 91 const struct imx_ssi_platform_data *pdata)
diff --git a/arch/arm/plat-mxc/devices/platform-imx-uart.c b/arch/arm/plat-mxc/devices/platform-imx-uart.c
index 3c854c2cc6d..2020d84956c 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-uart.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-uart.c
@@ -123,6 +123,8 @@ const struct imx_imx_uart_1irq_data imx53_imx_uart_data[] __initconst = {
123 imx53_imx_uart_data_entry(0, 1), 123 imx53_imx_uart_data_entry(0, 1),
124 imx53_imx_uart_data_entry(1, 2), 124 imx53_imx_uart_data_entry(1, 2),
125 imx53_imx_uart_data_entry(2, 3), 125 imx53_imx_uart_data_entry(2, 3),
126 imx53_imx_uart_data_entry(3, 4),
127 imx53_imx_uart_data_entry(4, 5),
126}; 128};
127#endif /* ifdef CONFIG_SOC_IMX53 */ 129#endif /* ifdef CONFIG_SOC_IMX53 */
128 130
@@ -150,7 +152,7 @@ struct platform_device *__init imx_add_imx_uart_3irq(
150 }, 152 },
151 }; 153 };
152 154
153 return imx_add_platform_device("imx-uart", data->id, res, 155 return imx_add_platform_device("imx1-uart", data->id, res,
154 ARRAY_SIZE(res), pdata, sizeof(*pdata)); 156 ARRAY_SIZE(res), pdata, sizeof(*pdata));
155} 157}
156 158
@@ -170,6 +172,7 @@ struct platform_device *__init imx_add_imx_uart_1irq(
170 }, 172 },
171 }; 173 };
172 174
173 return imx_add_platform_device("imx-uart", data->id, res, ARRAY_SIZE(res), 175 /* i.mx21 type uart runs on all i.mx except i.mx1 */
174 pdata, sizeof(*pdata)); 176 return imx_add_platform_device("imx21-uart", data->id,
177 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
175} 178}
diff --git a/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c b/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
index 6b2940b93d9..5955f5da82e 100644
--- a/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
+++ b/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
@@ -10,21 +10,22 @@
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11#include <mach/esdhc.h> 11#include <mach/esdhc.h>
12 12
13#define imx_sdhci_esdhc_imx_data_entry_single(soc, _id, hwid) \ 13#define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \
14 { \ 14 { \
15 .devid = _devid, \
15 .id = _id, \ 16 .id = _id, \
16 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \ 17 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \
17 .irq = soc ## _INT_ESDHC ## hwid, \ 18 .irq = soc ## _INT_ESDHC ## hwid, \
18 } 19 }
19 20
20#define imx_sdhci_esdhc_imx_data_entry(soc, id, hwid) \ 21#define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \
21 [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, id, hwid) 22 [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid)
22 23
23#ifdef CONFIG_SOC_IMX25 24#ifdef CONFIG_SOC_IMX25
24const struct imx_sdhci_esdhc_imx_data 25const struct imx_sdhci_esdhc_imx_data
25imx25_sdhci_esdhc_imx_data[] __initconst = { 26imx25_sdhci_esdhc_imx_data[] __initconst = {
26#define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 27#define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \
27 imx_sdhci_esdhc_imx_data_entry(MX25, _id, _hwid) 28 imx_sdhci_esdhc_imx_data_entry(MX25, "sdhci-esdhc-imx25", _id, _hwid)
28 imx25_sdhci_esdhc_imx_data_entry(0, 1), 29 imx25_sdhci_esdhc_imx_data_entry(0, 1),
29 imx25_sdhci_esdhc_imx_data_entry(1, 2), 30 imx25_sdhci_esdhc_imx_data_entry(1, 2),
30}; 31};
@@ -34,7 +35,7 @@ imx25_sdhci_esdhc_imx_data[] __initconst = {
34const struct imx_sdhci_esdhc_imx_data 35const struct imx_sdhci_esdhc_imx_data
35imx35_sdhci_esdhc_imx_data[] __initconst = { 36imx35_sdhci_esdhc_imx_data[] __initconst = {
36#define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 37#define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \
37 imx_sdhci_esdhc_imx_data_entry(MX35, _id, _hwid) 38 imx_sdhci_esdhc_imx_data_entry(MX35, "sdhci-esdhc-imx35", _id, _hwid)
38 imx35_sdhci_esdhc_imx_data_entry(0, 1), 39 imx35_sdhci_esdhc_imx_data_entry(0, 1),
39 imx35_sdhci_esdhc_imx_data_entry(1, 2), 40 imx35_sdhci_esdhc_imx_data_entry(1, 2),
40 imx35_sdhci_esdhc_imx_data_entry(2, 3), 41 imx35_sdhci_esdhc_imx_data_entry(2, 3),
@@ -45,7 +46,7 @@ imx35_sdhci_esdhc_imx_data[] __initconst = {
45const struct imx_sdhci_esdhc_imx_data 46const struct imx_sdhci_esdhc_imx_data
46imx51_sdhci_esdhc_imx_data[] __initconst = { 47imx51_sdhci_esdhc_imx_data[] __initconst = {
47#define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 48#define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \
48 imx_sdhci_esdhc_imx_data_entry(MX51, _id, _hwid) 49 imx_sdhci_esdhc_imx_data_entry(MX51, "sdhci-esdhc-imx51", _id, _hwid)
49 imx51_sdhci_esdhc_imx_data_entry(0, 1), 50 imx51_sdhci_esdhc_imx_data_entry(0, 1),
50 imx51_sdhci_esdhc_imx_data_entry(1, 2), 51 imx51_sdhci_esdhc_imx_data_entry(1, 2),
51 imx51_sdhci_esdhc_imx_data_entry(2, 3), 52 imx51_sdhci_esdhc_imx_data_entry(2, 3),
@@ -57,7 +58,7 @@ imx51_sdhci_esdhc_imx_data[] __initconst = {
57const struct imx_sdhci_esdhc_imx_data 58const struct imx_sdhci_esdhc_imx_data
58imx53_sdhci_esdhc_imx_data[] __initconst = { 59imx53_sdhci_esdhc_imx_data[] __initconst = {
59#define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 60#define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \
60 imx_sdhci_esdhc_imx_data_entry(MX53, _id, _hwid) 61 imx_sdhci_esdhc_imx_data_entry(MX53, "sdhci-esdhc-imx53", _id, _hwid)
61 imx53_sdhci_esdhc_imx_data_entry(0, 1), 62 imx53_sdhci_esdhc_imx_data_entry(0, 1),
62 imx53_sdhci_esdhc_imx_data_entry(1, 2), 63 imx53_sdhci_esdhc_imx_data_entry(1, 2),
63 imx53_sdhci_esdhc_imx_data_entry(2, 3), 64 imx53_sdhci_esdhc_imx_data_entry(2, 3),
@@ -65,6 +66,11 @@ imx53_sdhci_esdhc_imx_data[] __initconst = {
65}; 66};
66#endif /* ifdef CONFIG_SOC_IMX53 */ 67#endif /* ifdef CONFIG_SOC_IMX53 */
67 68
69static const struct esdhc_platform_data default_esdhc_pdata __initconst = {
70 .wp_type = ESDHC_WP_NONE,
71 .cd_type = ESDHC_CD_NONE,
72};
73
68struct platform_device *__init imx_add_sdhci_esdhc_imx( 74struct platform_device *__init imx_add_sdhci_esdhc_imx(
69 const struct imx_sdhci_esdhc_imx_data *data, 75 const struct imx_sdhci_esdhc_imx_data *data,
70 const struct esdhc_platform_data *pdata) 76 const struct esdhc_platform_data *pdata)
@@ -81,6 +87,13 @@ struct platform_device *__init imx_add_sdhci_esdhc_imx(
81 }, 87 },
82 }; 88 };
83 89
84 return imx_add_platform_device("sdhci-esdhc-imx", data->id, res, 90 /*
91 * If machine does not provide pdata, use the default one
92 * which means no WP/CD support
93 */
94 if (!pdata)
95 pdata = &default_esdhc_pdata;
96
97 return imx_add_platform_device(data->devid, data->id, res,
85 ARRAY_SIZE(res), pdata, sizeof(*pdata)); 98 ARRAY_SIZE(res), pdata, sizeof(*pdata));
86} 99}
diff --git a/arch/arm/plat-mxc/include/mach/clkdev.h b/arch/arm/plat-mxc/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/plat-mxc/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
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-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index 91fc7cdb5dc..e4dde91f023 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -44,6 +44,14 @@
44#define UART_PADDR MX51_UART1_BASE_ADDR 44#define UART_PADDR MX51_UART1_BASE_ADDR
45#endif 45#endif
46 46
47/* iMX50/53 have same addresses, but not iMX51 */
48#if defined(CONFIG_SOC_IMX50) || defined(CONFIG_SOC_IMX53)
49#ifdef UART_PADDR
50#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
51#endif
52#define UART_PADDR MX53_UART1_BASE_ADDR
53#endif
54
47#define UART_VADDR IMX_IO_ADDRESS(UART_PADDR) 55#define UART_VADDR IMX_IO_ADDRESS(UART_PADDR)
48 56
49 .macro addruart, rp, rv 57 .macro addruart, rp, rv
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 03f62664537..524538aabc4 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -9,8 +9,10 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <mach/sdma.h>
12 13
13extern struct device mxc_aips_bus; 14extern struct device mxc_aips_bus;
15extern struct device mxc_ahb_bus;
14 16
15struct platform_device *imx_add_platform_device_dmamask( 17struct platform_device *imx_add_platform_device_dmamask(
16 const char *name, int id, 18 const char *name, int id,
@@ -28,6 +30,7 @@ static inline struct platform_device *imx_add_platform_device(
28 30
29#include <linux/fec.h> 31#include <linux/fec.h>
30struct imx_fec_data { 32struct imx_fec_data {
33 const char *devid;
31 resource_size_t iobase; 34 resource_size_t iobase;
32 resource_size_t irq; 35 resource_size_t irq;
33}; 36};
@@ -274,6 +277,7 @@ struct platform_device *__init imx_add_mxc_w1(
274 277
275#include <mach/esdhc.h> 278#include <mach/esdhc.h>
276struct imx_sdhci_esdhc_imx_data { 279struct imx_sdhci_esdhc_imx_data {
280 const char *devid;
277 int id; 281 int id;
278 resource_size_t iobase; 282 resource_size_t iobase;
279 resource_size_t irq; 283 resource_size_t irq;
@@ -293,3 +297,7 @@ struct imx_spi_imx_data {
293struct platform_device *__init imx_add_spi_imx( 297struct platform_device *__init imx_add_spi_imx(
294 const struct imx_spi_imx_data *data, 298 const struct imx_spi_imx_data *data,
295 const struct spi_imx_master *pdata); 299 const struct spi_imx_master *pdata);
300
301struct platform_device *imx_add_imx_dma(void);
302struct platform_device *imx_add_imx_sdma(char *name,
303 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
index ef7751546f5..233d0a5e2d6 100644
--- a/arch/arm/plat-mxc/include/mach/dma.h
+++ b/arch/arm/plat-mxc/include/mach/dma.h
@@ -60,7 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
60 60
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan) 61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{ 62{
63 return !strcmp(dev_name(chan->device->dev), "imx-sdma") || 63 return !strcmp(dev_name(chan->device->dev), "imx31-sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx35-sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx-dma"); 65 !strcmp(dev_name(chan->device->dev), "imx-dma");
65} 66}
66 67
diff --git a/arch/arm/plat-mxc/include/mach/esdhc.h b/arch/arm/plat-mxc/include/mach/esdhc.h
index 86003f41175..aaf97481f41 100644
--- a/arch/arm/plat-mxc/include/mach/esdhc.h
+++ b/arch/arm/plat-mxc/include/mach/esdhc.h
@@ -10,17 +10,34 @@
10#ifndef __ASM_ARCH_IMX_ESDHC_H 10#ifndef __ASM_ARCH_IMX_ESDHC_H
11#define __ASM_ARCH_IMX_ESDHC_H 11#define __ASM_ARCH_IMX_ESDHC_H
12 12
13enum wp_types {
14 ESDHC_WP_NONE, /* no WP, neither controller nor gpio */
15 ESDHC_WP_CONTROLLER, /* mmc controller internal WP */
16 ESDHC_WP_GPIO, /* external gpio pin for WP */
17};
18
19enum cd_types {
20 ESDHC_CD_NONE, /* no CD, neither controller nor gpio */
21 ESDHC_CD_CONTROLLER, /* mmc controller internal CD */
22 ESDHC_CD_GPIO, /* external gpio pin for CD */
23 ESDHC_CD_PERMANENT, /* no CD, card permanently wired to host */
24};
25
13/** 26/**
14 * struct esdhc_platform_data - optional platform data for esdhc on i.MX 27 * struct esdhc_platform_data - platform data for esdhc on i.MX
15 * 28 *
16 * strongly recommended for i.MX25/35, not needed for other variants 29 * ESDHC_WP(CD)_CONTROLLER type is not available on i.MX25/35.
17 * 30 *
18 * @wp_gpio: gpio for write_protect (-EINVAL if unused) 31 * @wp_gpio: gpio for write_protect
19 * @cd_gpio: gpio for card_detect interrupt (-EINVAL if unused) 32 * @cd_gpio: gpio for card_detect interrupt
33 * @wp_type: type of write_protect method (see wp_types enum above)
34 * @cd_type: type of card_detect method (see cd_types enum above)
20 */ 35 */
21 36
22struct esdhc_platform_data { 37struct esdhc_platform_data {
23 unsigned int wp_gpio; 38 unsigned int wp_gpio;
24 unsigned int cd_gpio; 39 unsigned int cd_gpio;
40 enum wp_types wp_type;
41 enum cd_types cd_type;
25}; 42};
26#endif /* __ASM_ARCH_IMX_ESDHC_H */ 43#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx53.h b/arch/arm/plat-mxc/include/mach/iomux-mx53.h
index 9440b9e00e8..5408fd1fc73 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx53.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx53.h
@@ -30,6 +30,9 @@
30#define MX53_SDHC_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_PUE | \ 30#define MX53_SDHC_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_PUE | \
31 PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_HIGH | \ 31 PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_HIGH | \
32 PAD_CTL_SRE_FAST) 32 PAD_CTL_SRE_FAST)
33#define PAD_CTRL_I2C (PAD_CTL_SRE_FAST | PAD_CTL_ODE | PAD_CTL_PKE | \
34 PAD_CTL_PUE | PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP \
35 | PAD_CTL_HYS)
33 36
34#define _MX53_PAD_GPIO_19__KPP_COL_5 IOMUX_PAD(0x348, 0x20, 0, 0x840, 0, 0) 37#define _MX53_PAD_GPIO_19__KPP_COL_5 IOMUX_PAD(0x348, 0x20, 0, 0x840, 0, 0)
35#define _MX53_PAD_GPIO_19__GPIO4_5 IOMUX_PAD(0x348, 0x20, 1, 0x0, 0, 0) 38#define _MX53_PAD_GPIO_19__GPIO4_5 IOMUX_PAD(0x348, 0x20, 1, 0x0, 0, 0)
@@ -1256,7 +1259,7 @@
1256#define MX53_PAD_KEY_COL3__GPIO4_12 (_MX53_PAD_KEY_COL3__GPIO4_12 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1259#define MX53_PAD_KEY_COL3__GPIO4_12 (_MX53_PAD_KEY_COL3__GPIO4_12 | MUX_PAD_CTRL(NO_PAD_CTRL))
1257#define MX53_PAD_KEY_COL3__USBOH3_H2_DP (_MX53_PAD_KEY_COL3__USBOH3_H2_DP | MUX_PAD_CTRL(NO_PAD_CTRL)) 1260#define MX53_PAD_KEY_COL3__USBOH3_H2_DP (_MX53_PAD_KEY_COL3__USBOH3_H2_DP | MUX_PAD_CTRL(NO_PAD_CTRL))
1258#define MX53_PAD_KEY_COL3__SPDIF_IN1 (_MX53_PAD_KEY_COL3__SPDIF_IN1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1261#define MX53_PAD_KEY_COL3__SPDIF_IN1 (_MX53_PAD_KEY_COL3__SPDIF_IN1 | MUX_PAD_CTRL(NO_PAD_CTRL))
1259#define MX53_PAD_KEY_COL3__I2C2_SCL (_MX53_PAD_KEY_COL3__I2C2_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1262#define MX53_PAD_KEY_COL3__I2C2_SCL (_MX53_PAD_KEY_COL3__I2C2_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1260#define MX53_PAD_KEY_COL3__ECSPI1_SS3 (_MX53_PAD_KEY_COL3__ECSPI1_SS3 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1263#define MX53_PAD_KEY_COL3__ECSPI1_SS3 (_MX53_PAD_KEY_COL3__ECSPI1_SS3 | MUX_PAD_CTRL(NO_PAD_CTRL))
1261#define MX53_PAD_KEY_COL3__FEC_CRS (_MX53_PAD_KEY_COL3__FEC_CRS | MUX_PAD_CTRL(NO_PAD_CTRL)) 1264#define MX53_PAD_KEY_COL3__FEC_CRS (_MX53_PAD_KEY_COL3__FEC_CRS | MUX_PAD_CTRL(NO_PAD_CTRL))
1262#define MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK (_MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1265#define MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK (_MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1264,7 +1267,7 @@
1264#define MX53_PAD_KEY_ROW3__GPIO4_13 (_MX53_PAD_KEY_ROW3__GPIO4_13 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1267#define MX53_PAD_KEY_ROW3__GPIO4_13 (_MX53_PAD_KEY_ROW3__GPIO4_13 | MUX_PAD_CTRL(NO_PAD_CTRL))
1265#define MX53_PAD_KEY_ROW3__USBOH3_H2_DM (_MX53_PAD_KEY_ROW3__USBOH3_H2_DM | MUX_PAD_CTRL(NO_PAD_CTRL)) 1268#define MX53_PAD_KEY_ROW3__USBOH3_H2_DM (_MX53_PAD_KEY_ROW3__USBOH3_H2_DM | MUX_PAD_CTRL(NO_PAD_CTRL))
1266#define MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK (_MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1269#define MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK (_MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1267#define MX53_PAD_KEY_ROW3__I2C2_SDA (_MX53_PAD_KEY_ROW3__I2C2_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1270#define MX53_PAD_KEY_ROW3__I2C2_SDA (_MX53_PAD_KEY_ROW3__I2C2_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1268#define MX53_PAD_KEY_ROW3__OSC32K_32K_OUT (_MX53_PAD_KEY_ROW3__OSC32K_32K_OUT | MUX_PAD_CTRL(NO_PAD_CTRL)) 1271#define MX53_PAD_KEY_ROW3__OSC32K_32K_OUT (_MX53_PAD_KEY_ROW3__OSC32K_32K_OUT | MUX_PAD_CTRL(NO_PAD_CTRL))
1269#define MX53_PAD_KEY_ROW3__CCM_PLL4_BYP (_MX53_PAD_KEY_ROW3__CCM_PLL4_BYP | MUX_PAD_CTRL(NO_PAD_CTRL)) 1272#define MX53_PAD_KEY_ROW3__CCM_PLL4_BYP (_MX53_PAD_KEY_ROW3__CCM_PLL4_BYP | MUX_PAD_CTRL(NO_PAD_CTRL))
1270#define MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 (_MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1273#define MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 (_MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1536,7 +1539,7 @@
1536#define MX53_PAD_CSI0_DAT8__KPP_COL_7 (_MX53_PAD_CSI0_DAT8__KPP_COL_7 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1539#define MX53_PAD_CSI0_DAT8__KPP_COL_7 (_MX53_PAD_CSI0_DAT8__KPP_COL_7 | MUX_PAD_CTRL(NO_PAD_CTRL))
1537#define MX53_PAD_CSI0_DAT8__ECSPI2_SCLK (_MX53_PAD_CSI0_DAT8__ECSPI2_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1540#define MX53_PAD_CSI0_DAT8__ECSPI2_SCLK (_MX53_PAD_CSI0_DAT8__ECSPI2_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1538#define MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC (_MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC | MUX_PAD_CTRL(NO_PAD_CTRL)) 1541#define MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC (_MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC | MUX_PAD_CTRL(NO_PAD_CTRL))
1539#define MX53_PAD_CSI0_DAT8__I2C1_SDA (_MX53_PAD_CSI0_DAT8__I2C1_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1542#define MX53_PAD_CSI0_DAT8__I2C1_SDA (_MX53_PAD_CSI0_DAT8__I2C1_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1540#define MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 (_MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1543#define MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 (_MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 | MUX_PAD_CTRL(NO_PAD_CTRL))
1541#define MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 (_MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1544#define MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 (_MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 | MUX_PAD_CTRL(NO_PAD_CTRL))
1542#define MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 (_MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1545#define MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 (_MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1544,7 +1547,7 @@
1544#define MX53_PAD_CSI0_DAT9__KPP_ROW_7 (_MX53_PAD_CSI0_DAT9__KPP_ROW_7 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1547#define MX53_PAD_CSI0_DAT9__KPP_ROW_7 (_MX53_PAD_CSI0_DAT9__KPP_ROW_7 | MUX_PAD_CTRL(NO_PAD_CTRL))
1545#define MX53_PAD_CSI0_DAT9__ECSPI2_MOSI (_MX53_PAD_CSI0_DAT9__ECSPI2_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL)) 1548#define MX53_PAD_CSI0_DAT9__ECSPI2_MOSI (_MX53_PAD_CSI0_DAT9__ECSPI2_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL))
1546#define MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR (_MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR | MUX_PAD_CTRL(NO_PAD_CTRL)) 1549#define MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR (_MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR | MUX_PAD_CTRL(NO_PAD_CTRL))
1547#define MX53_PAD_CSI0_DAT9__I2C1_SCL (_MX53_PAD_CSI0_DAT9__I2C1_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1550#define MX53_PAD_CSI0_DAT9__I2C1_SCL (_MX53_PAD_CSI0_DAT9__I2C1_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1548#define MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 (_MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1551#define MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 (_MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 | MUX_PAD_CTRL(NO_PAD_CTRL))
1549#define MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 (_MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1552#define MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 (_MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 | MUX_PAD_CTRL(NO_PAD_CTRL))
1550#define MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 (_MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1553#define MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 (_MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1631,25 +1634,25 @@
1631#define MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK (_MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1634#define MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK (_MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1632#define MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS (_MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS | MUX_PAD_CTRL(NO_PAD_CTRL)) 1635#define MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS (_MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS | MUX_PAD_CTRL(NO_PAD_CTRL))
1633#define MX53_PAD_EIM_EB2__ECSPI1_SS0 (_MX53_PAD_EIM_EB2__ECSPI1_SS0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1636#define MX53_PAD_EIM_EB2__ECSPI1_SS0 (_MX53_PAD_EIM_EB2__ECSPI1_SS0 | MUX_PAD_CTRL(NO_PAD_CTRL))
1634#define MX53_PAD_EIM_EB2__I2C2_SCL (_MX53_PAD_EIM_EB2__I2C2_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1637#define MX53_PAD_EIM_EB2__I2C2_SCL (_MX53_PAD_EIM_EB2__I2C2_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1635#define MX53_PAD_EIM_D16__EMI_WEIM_D_16 (_MX53_PAD_EIM_D16__EMI_WEIM_D_16 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1638#define MX53_PAD_EIM_D16__EMI_WEIM_D_16 (_MX53_PAD_EIM_D16__EMI_WEIM_D_16 | MUX_PAD_CTRL(NO_PAD_CTRL))
1636#define MX53_PAD_EIM_D16__GPIO3_16 (_MX53_PAD_EIM_D16__GPIO3_16 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1639#define MX53_PAD_EIM_D16__GPIO3_16 (_MX53_PAD_EIM_D16__GPIO3_16 | MUX_PAD_CTRL(NO_PAD_CTRL))
1637#define MX53_PAD_EIM_D16__IPU_DI0_PIN5 (_MX53_PAD_EIM_D16__IPU_DI0_PIN5 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1640#define MX53_PAD_EIM_D16__IPU_DI0_PIN5 (_MX53_PAD_EIM_D16__IPU_DI0_PIN5 | MUX_PAD_CTRL(NO_PAD_CTRL))
1638#define MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK (_MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1641#define MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK (_MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1639#define MX53_PAD_EIM_D16__ECSPI1_SCLK (_MX53_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1642#define MX53_PAD_EIM_D16__ECSPI1_SCLK (_MX53_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1640#define MX53_PAD_EIM_D16__I2C2_SDA (_MX53_PAD_EIM_D16__I2C2_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1643#define MX53_PAD_EIM_D16__I2C2_SDA (_MX53_PAD_EIM_D16__I2C2_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1641#define MX53_PAD_EIM_D17__EMI_WEIM_D_17 (_MX53_PAD_EIM_D17__EMI_WEIM_D_17 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1644#define MX53_PAD_EIM_D17__EMI_WEIM_D_17 (_MX53_PAD_EIM_D17__EMI_WEIM_D_17 | MUX_PAD_CTRL(NO_PAD_CTRL))
1642#define MX53_PAD_EIM_D17__GPIO3_17 (_MX53_PAD_EIM_D17__GPIO3_17 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1645#define MX53_PAD_EIM_D17__GPIO3_17 (_MX53_PAD_EIM_D17__GPIO3_17 | MUX_PAD_CTRL(NO_PAD_CTRL))
1643#define MX53_PAD_EIM_D17__IPU_DI0_PIN6 (_MX53_PAD_EIM_D17__IPU_DI0_PIN6 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1646#define MX53_PAD_EIM_D17__IPU_DI0_PIN6 (_MX53_PAD_EIM_D17__IPU_DI0_PIN6 | MUX_PAD_CTRL(NO_PAD_CTRL))
1644#define MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN (_MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN | MUX_PAD_CTRL(NO_PAD_CTRL)) 1647#define MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN (_MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN | MUX_PAD_CTRL(NO_PAD_CTRL))
1645#define MX53_PAD_EIM_D17__ECSPI1_MISO (_MX53_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(NO_PAD_CTRL)) 1648#define MX53_PAD_EIM_D17__ECSPI1_MISO (_MX53_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(NO_PAD_CTRL))
1646#define MX53_PAD_EIM_D17__I2C3_SCL (_MX53_PAD_EIM_D17__I2C3_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1649#define MX53_PAD_EIM_D17__I2C3_SCL (_MX53_PAD_EIM_D17__I2C3_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1647#define MX53_PAD_EIM_D18__EMI_WEIM_D_18 (_MX53_PAD_EIM_D18__EMI_WEIM_D_18 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1650#define MX53_PAD_EIM_D18__EMI_WEIM_D_18 (_MX53_PAD_EIM_D18__EMI_WEIM_D_18 | MUX_PAD_CTRL(NO_PAD_CTRL))
1648#define MX53_PAD_EIM_D18__GPIO3_18 (_MX53_PAD_EIM_D18__GPIO3_18 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1651#define MX53_PAD_EIM_D18__GPIO3_18 (_MX53_PAD_EIM_D18__GPIO3_18 | MUX_PAD_CTRL(NO_PAD_CTRL))
1649#define MX53_PAD_EIM_D18__IPU_DI0_PIN7 (_MX53_PAD_EIM_D18__IPU_DI0_PIN7 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1652#define MX53_PAD_EIM_D18__IPU_DI0_PIN7 (_MX53_PAD_EIM_D18__IPU_DI0_PIN7 | MUX_PAD_CTRL(NO_PAD_CTRL))
1650#define MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO (_MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO | MUX_PAD_CTRL(NO_PAD_CTRL)) 1653#define MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO (_MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO | MUX_PAD_CTRL(NO_PAD_CTRL))
1651#define MX53_PAD_EIM_D18__ECSPI1_MOSI (_MX53_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL)) 1654#define MX53_PAD_EIM_D18__ECSPI1_MOSI (_MX53_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL))
1652#define MX53_PAD_EIM_D18__I2C3_SDA (_MX53_PAD_EIM_D18__I2C3_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1655#define MX53_PAD_EIM_D18__I2C3_SDA (_MX53_PAD_EIM_D18__I2C3_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1653#define MX53_PAD_EIM_D18__IPU_DI1_D0_CS (_MX53_PAD_EIM_D18__IPU_DI1_D0_CS | MUX_PAD_CTRL(NO_PAD_CTRL)) 1656#define MX53_PAD_EIM_D18__IPU_DI1_D0_CS (_MX53_PAD_EIM_D18__IPU_DI1_D0_CS | MUX_PAD_CTRL(NO_PAD_CTRL))
1654#define MX53_PAD_EIM_D19__EMI_WEIM_D_19 (_MX53_PAD_EIM_D19__EMI_WEIM_D_19 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1657#define MX53_PAD_EIM_D19__EMI_WEIM_D_19 (_MX53_PAD_EIM_D19__EMI_WEIM_D_19 | MUX_PAD_CTRL(NO_PAD_CTRL))
1655#define MX53_PAD_EIM_D19__GPIO3_19 (_MX53_PAD_EIM_D19__GPIO3_19 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1658#define MX53_PAD_EIM_D19__GPIO3_19 (_MX53_PAD_EIM_D19__GPIO3_19 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1672,7 +1675,7 @@
1672#define MX53_PAD_EIM_D21__IPU_DI0_PIN17 (_MX53_PAD_EIM_D21__IPU_DI0_PIN17 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1675#define MX53_PAD_EIM_D21__IPU_DI0_PIN17 (_MX53_PAD_EIM_D21__IPU_DI0_PIN17 | MUX_PAD_CTRL(NO_PAD_CTRL))
1673#define MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK (_MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1676#define MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK (_MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1674#define MX53_PAD_EIM_D21__CSPI_SCLK (_MX53_PAD_EIM_D21__CSPI_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1677#define MX53_PAD_EIM_D21__CSPI_SCLK (_MX53_PAD_EIM_D21__CSPI_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1675#define MX53_PAD_EIM_D21__I2C1_SCL (_MX53_PAD_EIM_D21__I2C1_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1678#define MX53_PAD_EIM_D21__I2C1_SCL (_MX53_PAD_EIM_D21__I2C1_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1676#define MX53_PAD_EIM_D21__USBOH3_USBOTG_OC (_MX53_PAD_EIM_D21__USBOH3_USBOTG_OC | MUX_PAD_CTRL(NO_PAD_CTRL)) 1679#define MX53_PAD_EIM_D21__USBOH3_USBOTG_OC (_MX53_PAD_EIM_D21__USBOH3_USBOTG_OC | MUX_PAD_CTRL(NO_PAD_CTRL))
1677#define MX53_PAD_EIM_D22__EMI_WEIM_D_22 (_MX53_PAD_EIM_D22__EMI_WEIM_D_22 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1680#define MX53_PAD_EIM_D22__EMI_WEIM_D_22 (_MX53_PAD_EIM_D22__EMI_WEIM_D_22 | MUX_PAD_CTRL(NO_PAD_CTRL))
1678#define MX53_PAD_EIM_D22__GPIO3_22 (_MX53_PAD_EIM_D22__GPIO3_22 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1681#define MX53_PAD_EIM_D22__GPIO3_22 (_MX53_PAD_EIM_D22__GPIO3_22 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1732,7 +1735,7 @@
1732#define MX53_PAD_EIM_D28__UART2_CTS (_MX53_PAD_EIM_D28__UART2_CTS | MUX_PAD_CTRL(MX53_UART_PAD_CTRL)) 1735#define MX53_PAD_EIM_D28__UART2_CTS (_MX53_PAD_EIM_D28__UART2_CTS | MUX_PAD_CTRL(MX53_UART_PAD_CTRL))
1733#define MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO (_MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO | MUX_PAD_CTRL(NO_PAD_CTRL)) 1736#define MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO (_MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO | MUX_PAD_CTRL(NO_PAD_CTRL))
1734#define MX53_PAD_EIM_D28__CSPI_MOSI (_MX53_PAD_EIM_D28__CSPI_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL)) 1737#define MX53_PAD_EIM_D28__CSPI_MOSI (_MX53_PAD_EIM_D28__CSPI_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL))
1735#define MX53_PAD_EIM_D28__I2C1_SDA (_MX53_PAD_EIM_D28__I2C1_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1738#define MX53_PAD_EIM_D28__I2C1_SDA (_MX53_PAD_EIM_D28__I2C1_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1736#define MX53_PAD_EIM_D28__IPU_EXT_TRIG (_MX53_PAD_EIM_D28__IPU_EXT_TRIG | MUX_PAD_CTRL(NO_PAD_CTRL)) 1739#define MX53_PAD_EIM_D28__IPU_EXT_TRIG (_MX53_PAD_EIM_D28__IPU_EXT_TRIG | MUX_PAD_CTRL(NO_PAD_CTRL))
1737#define MX53_PAD_EIM_D28__IPU_DI0_PIN13 (_MX53_PAD_EIM_D28__IPU_DI0_PIN13 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1740#define MX53_PAD_EIM_D28__IPU_DI0_PIN13 (_MX53_PAD_EIM_D28__IPU_DI0_PIN13 | MUX_PAD_CTRL(NO_PAD_CTRL))
1738#define MX53_PAD_EIM_D29__EMI_WEIM_D_29 (_MX53_PAD_EIM_D29__EMI_WEIM_D_29 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1741#define MX53_PAD_EIM_D29__EMI_WEIM_D_29 (_MX53_PAD_EIM_D29__EMI_WEIM_D_29 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -2297,7 +2300,7 @@
2297#define MX53_PAD_GPIO_9__SCC_FAIL_STATE (_MX53_PAD_GPIO_9__SCC_FAIL_STATE | MUX_PAD_CTRL(NO_PAD_CTRL)) 2300#define MX53_PAD_GPIO_9__SCC_FAIL_STATE (_MX53_PAD_GPIO_9__SCC_FAIL_STATE | MUX_PAD_CTRL(NO_PAD_CTRL))
2298#define MX53_PAD_GPIO_3__ESAI1_HCKR (_MX53_PAD_GPIO_3__ESAI1_HCKR | MUX_PAD_CTRL(NO_PAD_CTRL)) 2301#define MX53_PAD_GPIO_3__ESAI1_HCKR (_MX53_PAD_GPIO_3__ESAI1_HCKR | MUX_PAD_CTRL(NO_PAD_CTRL))
2299#define MX53_PAD_GPIO_3__GPIO1_3 (_MX53_PAD_GPIO_3__GPIO1_3 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2302#define MX53_PAD_GPIO_3__GPIO1_3 (_MX53_PAD_GPIO_3__GPIO1_3 | MUX_PAD_CTRL(NO_PAD_CTRL))
2300#define MX53_PAD_GPIO_3__I2C3_SCL (_MX53_PAD_GPIO_3__I2C3_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 2303#define MX53_PAD_GPIO_3__I2C3_SCL (_MX53_PAD_GPIO_3__I2C3_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
2301#define MX53_PAD_GPIO_3__DPLLIP1_TOG_EN (_MX53_PAD_GPIO_3__DPLLIP1_TOG_EN | MUX_PAD_CTRL(NO_PAD_CTRL)) 2304#define MX53_PAD_GPIO_3__DPLLIP1_TOG_EN (_MX53_PAD_GPIO_3__DPLLIP1_TOG_EN | MUX_PAD_CTRL(NO_PAD_CTRL))
2302#define MX53_PAD_GPIO_3__CCM_CLKO2 (_MX53_PAD_GPIO_3__CCM_CLKO2 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2305#define MX53_PAD_GPIO_3__CCM_CLKO2 (_MX53_PAD_GPIO_3__CCM_CLKO2 | MUX_PAD_CTRL(NO_PAD_CTRL))
2303#define MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 (_MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2306#define MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 (_MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -2305,7 +2308,7 @@
2305#define MX53_PAD_GPIO_3__MLB_MLBCLK (_MX53_PAD_GPIO_3__MLB_MLBCLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 2308#define MX53_PAD_GPIO_3__MLB_MLBCLK (_MX53_PAD_GPIO_3__MLB_MLBCLK | MUX_PAD_CTRL(NO_PAD_CTRL))
2306#define MX53_PAD_GPIO_6__ESAI1_SCKT (_MX53_PAD_GPIO_6__ESAI1_SCKT | MUX_PAD_CTRL(NO_PAD_CTRL)) 2309#define MX53_PAD_GPIO_6__ESAI1_SCKT (_MX53_PAD_GPIO_6__ESAI1_SCKT | MUX_PAD_CTRL(NO_PAD_CTRL))
2307#define MX53_PAD_GPIO_6__GPIO1_6 (_MX53_PAD_GPIO_6__GPIO1_6 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2310#define MX53_PAD_GPIO_6__GPIO1_6 (_MX53_PAD_GPIO_6__GPIO1_6 | MUX_PAD_CTRL(NO_PAD_CTRL))
2308#define MX53_PAD_GPIO_6__I2C3_SDA (_MX53_PAD_GPIO_6__I2C3_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 2311#define MX53_PAD_GPIO_6__I2C3_SDA (_MX53_PAD_GPIO_6__I2C3_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
2309#define MX53_PAD_GPIO_6__CCM_CCM_OUT_0 (_MX53_PAD_GPIO_6__CCM_CCM_OUT_0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2312#define MX53_PAD_GPIO_6__CCM_CCM_OUT_0 (_MX53_PAD_GPIO_6__CCM_CCM_OUT_0 | MUX_PAD_CTRL(NO_PAD_CTRL))
2310#define MX53_PAD_GPIO_6__CSU_CSU_INT_DEB (_MX53_PAD_GPIO_6__CSU_CSU_INT_DEB | MUX_PAD_CTRL(NO_PAD_CTRL)) 2313#define MX53_PAD_GPIO_6__CSU_CSU_INT_DEB (_MX53_PAD_GPIO_6__CSU_CSU_INT_DEB | MUX_PAD_CTRL(NO_PAD_CTRL))
2311#define MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 (_MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2314#define MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 (_MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -2333,7 +2336,7 @@
2333#define MX53_PAD_GPIO_5__CCM_CLKO (_MX53_PAD_GPIO_5__CCM_CLKO | MUX_PAD_CTRL(NO_PAD_CTRL)) 2336#define MX53_PAD_GPIO_5__CCM_CLKO (_MX53_PAD_GPIO_5__CCM_CLKO | MUX_PAD_CTRL(NO_PAD_CTRL))
2334#define MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 (_MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2337#define MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 (_MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 | MUX_PAD_CTRL(NO_PAD_CTRL))
2335#define MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 (_MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2338#define MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 (_MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 | MUX_PAD_CTRL(NO_PAD_CTRL))
2336#define MX53_PAD_GPIO_5__I2C3_SCL (_MX53_PAD_GPIO_5__I2C3_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 2339#define MX53_PAD_GPIO_5__I2C3_SCL (_MX53_PAD_GPIO_5__I2C3_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
2337#define MX53_PAD_GPIO_5__CCM_PLL1_BYP (_MX53_PAD_GPIO_5__CCM_PLL1_BYP | MUX_PAD_CTRL(NO_PAD_CTRL)) 2340#define MX53_PAD_GPIO_5__CCM_PLL1_BYP (_MX53_PAD_GPIO_5__CCM_PLL1_BYP | MUX_PAD_CTRL(NO_PAD_CTRL))
2338#define MX53_PAD_GPIO_7__ESAI1_TX4_RX1 (_MX53_PAD_GPIO_7__ESAI1_TX4_RX1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2341#define MX53_PAD_GPIO_7__ESAI1_TX4_RX1 (_MX53_PAD_GPIO_7__ESAI1_TX4_RX1 | MUX_PAD_CTRL(NO_PAD_CTRL))
2339#define MX53_PAD_GPIO_7__GPIO1_7 (_MX53_PAD_GPIO_7__GPIO1_7 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2342#define MX53_PAD_GPIO_7__GPIO1_7 (_MX53_PAD_GPIO_7__GPIO1_7 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -2356,7 +2359,7 @@
2356#define MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT (_MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT | MUX_PAD_CTRL(NO_PAD_CTRL)) 2359#define MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT (_MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT | MUX_PAD_CTRL(NO_PAD_CTRL))
2357#define MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 (_MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2360#define MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 (_MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 | MUX_PAD_CTRL(NO_PAD_CTRL))
2358#define MX53_PAD_GPIO_16__SPDIF_IN1 (_MX53_PAD_GPIO_16__SPDIF_IN1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2361#define MX53_PAD_GPIO_16__SPDIF_IN1 (_MX53_PAD_GPIO_16__SPDIF_IN1 | MUX_PAD_CTRL(NO_PAD_CTRL))
2359#define MX53_PAD_GPIO_16__I2C3_SDA (_MX53_PAD_GPIO_16__I2C3_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 2362#define MX53_PAD_GPIO_16__I2C3_SDA (_MX53_PAD_GPIO_16__I2C3_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
2360#define MX53_PAD_GPIO_16__SJC_DE_B (_MX53_PAD_GPIO_16__SJC_DE_B | MUX_PAD_CTRL(NO_PAD_CTRL)) 2363#define MX53_PAD_GPIO_16__SJC_DE_B (_MX53_PAD_GPIO_16__SJC_DE_B | MUX_PAD_CTRL(NO_PAD_CTRL))
2361#define MX53_PAD_GPIO_17__ESAI1_TX0 (_MX53_PAD_GPIO_17__ESAI1_TX0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2364#define MX53_PAD_GPIO_17__ESAI1_TX0 (_MX53_PAD_GPIO_17__ESAI1_TX0 | MUX_PAD_CTRL(NO_PAD_CTRL))
2362#define MX53_PAD_GPIO_17__GPIO7_12 (_MX53_PAD_GPIO_17__GPIO7_12 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2365#define MX53_PAD_GPIO_17__GPIO7_12 (_MX53_PAD_GPIO_17__GPIO7_12 | MUX_PAD_CTRL(NO_PAD_CTRL))
diff --git a/arch/arm/plat-mxc/include/mach/mx53.h b/arch/arm/plat-mxc/include/mach/mx53.h
index 74cd093203e..5e3c3236ebf 100644
--- a/arch/arm/plat-mxc/include/mach/mx53.h
+++ b/arch/arm/plat-mxc/include/mach/mx53.h
@@ -176,10 +176,10 @@
176/* 176/*
177 * DMA request assignments 177 * DMA request assignments
178 */ 178 */
179#define MX53_DMA_REQ_SSI3_TX1 47 179#define MX53_DMA_REQ_SSI3_TX0 47
180#define MX53_DMA_REQ_SSI3_RX1 46 180#define MX53_DMA_REQ_SSI3_RX0 46
181#define MX53_DMA_REQ_SSI3_TX2 45 181#define MX53_DMA_REQ_SSI3_TX1 45
182#define MX53_DMA_REQ_SSI3_RX2 44 182#define MX53_DMA_REQ_SSI3_RX1 44
183#define MX53_DMA_REQ_UART3_TX 43 183#define MX53_DMA_REQ_UART3_TX 43
184#define MX53_DMA_REQ_UART3_RX 42 184#define MX53_DMA_REQ_UART3_RX 42
185#define MX53_DMA_REQ_ESAI_TX 41 185#define MX53_DMA_REQ_ESAI_TX 41
@@ -194,14 +194,14 @@
194#define MX53_DMA_REQ_ASRC_DMA1 32 194#define MX53_DMA_REQ_ASRC_DMA1 32
195#define MX53_DMA_REQ_EMI_WR 31 195#define MX53_DMA_REQ_EMI_WR 31
196#define MX53_DMA_REQ_EMI_RD 30 196#define MX53_DMA_REQ_EMI_RD 30
197#define MX53_DMA_REQ_SSI1_TX1 29 197#define MX53_DMA_REQ_SSI1_TX0 29
198#define MX53_DMA_REQ_SSI1_RX1 28 198#define MX53_DMA_REQ_SSI1_RX0 28
199#define MX53_DMA_REQ_SSI1_TX2 27 199#define MX53_DMA_REQ_SSI1_TX1 27
200#define MX53_DMA_REQ_SSI1_RX2 26 200#define MX53_DMA_REQ_SSI1_RX1 26
201#define MX53_DMA_REQ_SSI2_TX1 25 201#define MX53_DMA_REQ_SSI2_TX0 25
202#define MX53_DMA_REQ_SSI2_RX1 24 202#define MX53_DMA_REQ_SSI2_RX0 24
203#define MX53_DMA_REQ_SSI2_TX2 23 203#define MX53_DMA_REQ_SSI2_TX1 23
204#define MX53_DMA_REQ_SSI2_RX2 22 204#define MX53_DMA_REQ_SSI2_RX1 22
205#define MX53_DMA_REQ_I2C2_SDHC2 21 205#define MX53_DMA_REQ_I2C2_SDHC2 21
206#define MX53_DMA_REQ_I2C1_SDHC1 20 206#define MX53_DMA_REQ_I2C1_SDHC1 20
207#define MX53_DMA_REQ_UART1_TX 19 207#define MX53_DMA_REQ_UART1_TX 19
@@ -241,7 +241,7 @@
241#define MX53_INT_IPU_ERR 10 241#define MX53_INT_IPU_ERR 10
242#define MX53_INT_IPU_SYN 11 242#define MX53_INT_IPU_SYN 11
243#define MX53_INT_GPU 12 243#define MX53_INT_GPU 12
244#define MX53_INT_RESV13 13 244#define MX53_INT_UART4 13
245#define MX53_INT_USB_H1 14 245#define MX53_INT_USB_H1 14
246#define MX53_INT_EMI 15 246#define MX53_INT_EMI 15
247#define MX53_INT_USB_H2 16 247#define MX53_INT_USB_H2 16
@@ -314,7 +314,7 @@
314#define MX53_INT_CAN2 83 314#define MX53_INT_CAN2 83
315#define MX53_INT_GPU2_IRQ 84 315#define MX53_INT_GPU2_IRQ 84
316#define MX53_INT_GPU2_BUSY 85 316#define MX53_INT_GPU2_BUSY 85
317#define MX53_INT_RESV86 86 317#define MX53_INT_UART5 86
318#define MX53_INT_FEC 87 318#define MX53_INT_FEC 87
319#define MX53_INT_OWIRE 88 319#define MX53_INT_OWIRE 88
320#define MX53_INT_CTI1_TG2 89 320#define MX53_INT_CTI1_TG2 89
diff --git a/arch/arm/plat-mxc/include/mach/sdma.h b/arch/arm/plat-mxc/include/mach/sdma.h
index 913e0432e40..3a3942823c2 100644
--- a/arch/arm/plat-mxc/include/mach/sdma.h
+++ b/arch/arm/plat-mxc/include/mach/sdma.h
@@ -48,15 +48,11 @@ struct sdma_script_start_addrs {
48/** 48/**
49 * struct sdma_platform_data - platform specific data for SDMA engine 49 * struct sdma_platform_data - platform specific data for SDMA engine
50 * 50 *
51 * @sdma_version The version of this SDMA engine 51 * @fw_name The firmware name
52 * @cpu_name used to generate the firmware name
53 * @to_version CPU Tape out version
54 * @script_addrs SDMA scripts addresses in SDMA ROM 52 * @script_addrs SDMA scripts addresses in SDMA ROM
55 */ 53 */
56struct sdma_platform_data { 54struct sdma_platform_data {
57 int sdma_version; 55 char *fw_name;
58 char *cpu_name;
59 int to_version;
60 struct sdma_script_start_addrs *script_addrs; 56 struct sdma_script_start_addrs *script_addrs;
61}; 57};
62 58
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
index d85e2d1c032..88fd4045256 100644
--- a/arch/arm/plat-mxc/include/mach/uncompress.h
+++ b/arch/arm/plat-mxc/include/mach/uncompress.h
@@ -117,6 +117,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)
117 case MACH_TYPE_MX53_EVK: 117 case MACH_TYPE_MX53_EVK:
118 case MACH_TYPE_MX53_LOCO: 118 case MACH_TYPE_MX53_LOCO:
119 case MACH_TYPE_MX53_SMD: 119 case MACH_TYPE_MX53_SMD:
120 case MACH_TYPE_MX53_ARD:
120 uart_base = MX53_UART1_BASE_ADDR; 121 uart_base = MX53_UART1_BASE_ADDR;
121 break; 122 break;
122 default: 123 default:
diff --git a/arch/arm/plat-mxc/irq-common.c b/arch/arm/plat-mxc/irq-common.c
index e1c6eff7258..96953e2e4f1 100644
--- a/arch/arm/plat-mxc/irq-common.c
+++ b/arch/arm/plat-mxc/irq-common.c
@@ -42,17 +42,16 @@ EXPORT_SYMBOL(imx_irq_set_priority);
42 42
43int mxc_set_irq_fiq(unsigned int irq, unsigned int type) 43int mxc_set_irq_fiq(unsigned int irq, unsigned int type)
44{ 44{
45 struct mxc_irq_chip *chip; 45 struct irq_chip_generic *gc;
46 struct irq_chip *base; 46 int (*set_irq_fiq)(unsigned int, unsigned int);
47 int ret; 47 int ret;
48 48
49 ret = -ENOSYS; 49 ret = -ENOSYS;
50 50
51 base = irq_get_chip(irq); 51 gc = irq_get_chip_data(irq);
52 if (base) { 52 if (gc && gc->private) {
53 chip = container_of(base, struct mxc_irq_chip, base); 53 set_irq_fiq = gc->private;
54 if (chip->set_irq_fiq) 54 ret = set_irq_fiq(irq, type);
55 ret = chip->set_irq_fiq(irq, type);
56 } 55 }
57 56
58 return ret; 57 return ret;
diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c
index 710f2e7da4c..f257fccdc39 100644
--- a/arch/arm/plat-mxc/tzic.c
+++ b/arch/arm/plat-mxc/tzic.c
@@ -68,78 +68,34 @@ static int tzic_set_irq_fiq(unsigned int irq, unsigned int type)
68 68
69 return 0; 69 return 0;
70} 70}
71#else
72#define tzic_set_irq_fiq NULL
71#endif 73#endif
72 74
73/** 75static unsigned int *wakeup_intr[4];
74 * tzic_mask_irq() - Disable interrupt source "d" in the TZIC
75 *
76 * @param d interrupt source
77 */
78static void tzic_mask_irq(struct irq_data *d)
79{
80 int index, off;
81
82 index = d->irq >> 5;
83 off = d->irq & 0x1F;
84 __raw_writel(1 << off, tzic_base + TZIC_ENCLEAR0(index));
85}
86
87/**
88 * tzic_unmask_irq() - Enable interrupt source "d" in the TZIC
89 *
90 * @param d interrupt source
91 */
92static void tzic_unmask_irq(struct irq_data *d)
93{
94 int index, off;
95
96 index = d->irq >> 5;
97 off = d->irq & 0x1F;
98 __raw_writel(1 << off, tzic_base + TZIC_ENSET0(index));
99}
100
101static unsigned int wakeup_intr[4];
102 76
103/** 77static __init void tzic_init_gc(unsigned int irq_start)
104 * tzic_set_wake_irq() - Set interrupt source "d" in the TZIC as a wake-up source.
105 *
106 * @param d interrupt source
107 * @param enable enable as wake-up if equal to non-zero
108 * disble as wake-up if equal to zero
109 *
110 * @return This function returns 0 on success.
111 */
112static int tzic_set_wake_irq(struct irq_data *d, unsigned int enable)
113{ 78{
114 unsigned int index, off; 79 struct irq_chip_generic *gc;
115 80 struct irq_chip_type *ct;
116 index = d->irq >> 5; 81 int idx = irq_start >> 5;
117 off = d->irq & 0x1F; 82
118 83 gc = irq_alloc_generic_chip("tzic", 1, irq_start, tzic_base,
119 if (index > 3) 84 handle_level_irq);
120 return -EINVAL; 85 gc->private = tzic_set_irq_fiq;
121 86 gc->wake_enabled = IRQ_MSK(32);
122 if (enable) 87 wakeup_intr[idx] = &gc->wake_active;
123 wakeup_intr[index] |= (1 << off); 88
124 else 89 ct = gc->chip_types;
125 wakeup_intr[index] &= ~(1 << off); 90 ct->chip.irq_mask = irq_gc_mask_disable_reg;
126 91 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
127 return 0; 92 ct->chip.irq_set_wake = irq_gc_set_wake;
93 ct->regs.disable = TZIC_ENCLEAR0(idx);
94 ct->regs.enable = TZIC_ENSET0(idx);
95
96 irq_setup_generic_chip(gc, IRQ_MSK(32), 0, IRQ_NOREQUEST, 0);
128} 97}
129 98
130static struct mxc_irq_chip mxc_tzic_chip = {
131 .base = {
132 .name = "MXC_TZIC",
133 .irq_ack = tzic_mask_irq,
134 .irq_mask = tzic_mask_irq,
135 .irq_unmask = tzic_unmask_irq,
136 .irq_set_wake = tzic_set_wake_irq,
137 },
138#ifdef CONFIG_FIQ
139 .set_irq_fiq = tzic_set_irq_fiq,
140#endif
141};
142
143/* 99/*
144 * This function initializes the TZIC hardware and disables all the 100 * This function initializes the TZIC hardware and disables all the
145 * interrupts. It registers the interrupt enable and disable functions 101 * interrupts. It registers the interrupt enable and disable functions
@@ -168,11 +124,8 @@ void __init tzic_init_irq(void __iomem *irqbase)
168 124
169 /* all IRQ no FIQ Warning :: No selection */ 125 /* all IRQ no FIQ Warning :: No selection */
170 126
171 for (i = 0; i < TZIC_NUM_IRQS; i++) { 127 for (i = 0; i < TZIC_NUM_IRQS; i += 32)
172 irq_set_chip_and_handler(i, &mxc_tzic_chip.base, 128 tzic_init_gc(i);
173 handle_level_irq);
174 set_irq_flags(i, IRQF_VALID);
175 }
176 129
177#ifdef CONFIG_FIQ 130#ifdef CONFIG_FIQ
178 /* Initialize FIQ */ 131 /* Initialize FIQ */
@@ -199,7 +152,7 @@ int tzic_enable_wake(int is_idle)
199 152
200 for (i = 0; i < 4; i++) { 153 for (i = 0; i < 4; i++) {
201 v = is_idle ? __raw_readl(tzic_base + TZIC_ENSET0(i)) : 154 v = is_idle ? __raw_readl(tzic_base + TZIC_ENSET0(i)) :
202 wakeup_intr[i]; 155 *wakeup_intr[i];
203 __raw_writel(v, tzic_base + TZIC_WAKEUP0(i)); 156 __raw_writel(v, tzic_base + TZIC_WAKEUP0(i));
204 } 157 }
205 158
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 6e6735f04ee..bb8f4a6b3e3 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -13,6 +13,7 @@ config ARCH_OMAP1
13 bool "TI OMAP1" 13 bool "TI OMAP1"
14 select CLKDEV_LOOKUP 14 select CLKDEV_LOOKUP
15 select CLKSRC_MMIO 15 select CLKSRC_MMIO
16 select GENERIC_IRQ_CHIP
16 help 17 help
17 "Systems based on omap7xx, omap15xx or omap16xx" 18 "Systems based on omap7xx, omap15xx or omap16xx"
18 19
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 964704f40bb..3ba4d11ca73 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -475,8 +475,41 @@ int __init clk_init(struct clk_functions * custom_clocks)
475/* 475/*
476 * debugfs support to trace clock tree hierarchy and attributes 476 * debugfs support to trace clock tree hierarchy and attributes
477 */ 477 */
478
479#include <linux/debugfs.h>
480#include <linux/seq_file.h>
481
478static struct dentry *clk_debugfs_root; 482static struct dentry *clk_debugfs_root;
479 483
484static int clk_dbg_show_summary(struct seq_file *s, void *unused)
485{
486 struct clk *c;
487 struct clk *pa;
488
489 seq_printf(s, "%-30s %-30s %-10s %s\n",
490 "clock-name", "parent-name", "rate", "use-count");
491
492 list_for_each_entry(c, &clocks, node) {
493 pa = c->parent;
494 seq_printf(s, "%-30s %-30s %-10lu %d\n",
495 c->name, pa ? pa->name : "none", c->rate, c->usecount);
496 }
497
498 return 0;
499}
500
501static int clk_dbg_open(struct inode *inode, struct file *file)
502{
503 return single_open(file, clk_dbg_show_summary, inode->i_private);
504}
505
506static const struct file_operations debug_clock_fops = {
507 .open = clk_dbg_open,
508 .read = seq_read,
509 .llseek = seq_lseek,
510 .release = single_release,
511};
512
480static int clk_debugfs_register_one(struct clk *c) 513static int clk_debugfs_register_one(struct clk *c)
481{ 514{
482 int err; 515 int err;
@@ -545,6 +578,12 @@ static int __init clk_debugfs_init(void)
545 if (err) 578 if (err)
546 goto err_out; 579 goto err_out;
547 } 580 }
581
582 d = debugfs_create_file("summary", S_IRUGO,
583 d, NULL, &debug_clock_fops);
584 if (!d)
585 return -ENOMEM;
586
548 return 0; 587 return 0;
549err_out: 588err_out:
550 debugfs_remove_recursive(clk_debugfs_root); 589 debugfs_remove_recursive(clk_debugfs_root);
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 8dfb8186b2c..75a847dd776 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -209,8 +209,8 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer)
209 } 209 }
210 omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ); 210 omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
211 211
212 /* Enable autoidle on OMAP2 / OMAP3 */ 212 /* Enable autoidle on OMAP2+ */
213 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 213 if (cpu_class_is_omap2())
214 autoidle = 1; 214 autoidle = 1;
215 215
216 /* 216 /*
diff --git a/arch/arm/plat-omap/include/plat/clkdev.h b/arch/arm/plat-omap/include/plat/clkdev.h
deleted file mode 100644
index 730c49d1ebd..00000000000
--- a/arch/arm/plat-omap/include/plat/clkdev.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __MACH_CLKDEV_H
2#define __MACH_CLKDEV_H
3
4static inline int __clk_get(struct clk *clk)
5{
6 return 1;
7}
8
9static inline void __clk_put(struct clk *clk)
10{
11}
12
13#endif
diff --git a/arch/arm/plat-omap/include/plat/clkdev_omap.h b/arch/arm/plat-omap/include/plat/clkdev_omap.h
index f1899a3e417..387a9638991 100644
--- a/arch/arm/plat-omap/include/plat/clkdev_omap.h
+++ b/arch/arm/plat-omap/include/plat/clkdev_omap.h
@@ -39,6 +39,7 @@ struct omap_clk {
39#define CK_36XX (1 << 10) /* 36xx/37xx-specific clocks */ 39#define CK_36XX (1 << 10) /* 36xx/37xx-specific clocks */
40#define CK_443X (1 << 11) 40#define CK_443X (1 << 11)
41#define CK_TI816X (1 << 12) 41#define CK_TI816X (1 << 12)
42#define CK_446X (1 << 13)
42 43
43 44
44#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS) 45#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index f57e0649ab3..df4b9683f17 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -58,10 +58,12 @@ struct clkops {
58#define RATE_IN_36XX (1 << 4) 58#define RATE_IN_36XX (1 << 4)
59#define RATE_IN_4430 (1 << 5) 59#define RATE_IN_4430 (1 << 5)
60#define RATE_IN_TI816X (1 << 6) 60#define RATE_IN_TI816X (1 << 6)
61#define RATE_IN_4460 (1 << 7)
61 62
62#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X) 63#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
63#define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS) 64#define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
64#define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX) 65#define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX)
66#define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460)
65 67
66/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */ 68/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
67#define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX) 69#define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 8198bb6cdb5..67b3d75884c 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -88,6 +88,7 @@ unsigned int omap_rev(void);
88 * cpu_is_omap243x(): True for OMAP2430 88 * cpu_is_omap243x(): True for OMAP2430
89 * cpu_is_omap343x(): True for OMAP3430 89 * cpu_is_omap343x(): True for OMAP3430
90 * cpu_is_omap443x(): True for OMAP4430 90 * cpu_is_omap443x(): True for OMAP4430
91 * cpu_is_omap446x(): True for OMAP4460
91 */ 92 */
92#define GET_OMAP_CLASS (omap_rev() & 0xff) 93#define GET_OMAP_CLASS (omap_rev() & 0xff)
93 94
@@ -123,6 +124,7 @@ IS_OMAP_SUBCLASS(243x, 0x243)
123IS_OMAP_SUBCLASS(343x, 0x343) 124IS_OMAP_SUBCLASS(343x, 0x343)
124IS_OMAP_SUBCLASS(363x, 0x363) 125IS_OMAP_SUBCLASS(363x, 0x363)
125IS_OMAP_SUBCLASS(443x, 0x443) 126IS_OMAP_SUBCLASS(443x, 0x443)
127IS_OMAP_SUBCLASS(446x, 0x446)
126 128
127IS_TI_SUBCLASS(816x, 0x816) 129IS_TI_SUBCLASS(816x, 0x816)
128 130
@@ -137,6 +139,7 @@ IS_TI_SUBCLASS(816x, 0x816)
137#define cpu_is_ti816x() 0 139#define cpu_is_ti816x() 0
138#define cpu_is_omap44xx() 0 140#define cpu_is_omap44xx() 0
139#define cpu_is_omap443x() 0 141#define cpu_is_omap443x() 0
142#define cpu_is_omap446x() 0
140 143
141#if defined(MULTI_OMAP1) 144#if defined(MULTI_OMAP1)
142# if defined(CONFIG_ARCH_OMAP730) 145# if defined(CONFIG_ARCH_OMAP730)
@@ -361,8 +364,10 @@ IS_OMAP_TYPE(3517, 0x3517)
361# if defined(CONFIG_ARCH_OMAP4) 364# if defined(CONFIG_ARCH_OMAP4)
362# undef cpu_is_omap44xx 365# undef cpu_is_omap44xx
363# undef cpu_is_omap443x 366# undef cpu_is_omap443x
367# undef cpu_is_omap446x
364# define cpu_is_omap44xx() is_omap44xx() 368# define cpu_is_omap44xx() is_omap44xx()
365# define cpu_is_omap443x() is_omap443x() 369# define cpu_is_omap443x() is_omap443x()
370# define cpu_is_omap446x() is_omap446x()
366# endif 371# endif
367 372
368/* Macros to detect if we have OMAP1 or OMAP2 */ 373/* Macros to detect if we have OMAP1 or OMAP2 */
@@ -410,6 +415,9 @@ IS_OMAP_TYPE(3517, 0x3517)
410#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8)) 415#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
411#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8)) 416#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
412 417
418#define OMAP446X_CLASS 0x44600044
419#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
420
413/* 421/*
414 * omap_chip bits 422 * omap_chip bits
415 * 423 *
@@ -439,13 +447,15 @@ IS_OMAP_TYPE(3517, 0x3517)
439#define CHIP_IS_OMAP4430ES2_1 (1 << 12) 447#define CHIP_IS_OMAP4430ES2_1 (1 << 12)
440#define CHIP_IS_OMAP4430ES2_2 (1 << 13) 448#define CHIP_IS_OMAP4430ES2_2 (1 << 13)
441#define CHIP_IS_TI816X (1 << 14) 449#define CHIP_IS_TI816X (1 << 14)
450#define CHIP_IS_OMAP4460ES1_0 (1 << 15)
442 451
443#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) 452#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
444 453
445#define CHIP_IS_OMAP4430 (CHIP_IS_OMAP4430ES1 | \ 454#define CHIP_IS_OMAP4430 (CHIP_IS_OMAP4430ES1 | \
446 CHIP_IS_OMAP4430ES2 | \ 455 CHIP_IS_OMAP4430ES2 | \
447 CHIP_IS_OMAP4430ES2_1 | \ 456 CHIP_IS_OMAP4430ES2_1 | \
448 CHIP_IS_OMAP4430ES2_2) 457 CHIP_IS_OMAP4430ES2_2 | \
458 CHIP_IS_OMAP4460ES1_0)
449 459
450/* 460/*
451 * "GE" here represents "greater than or equal to" in terms of ES 461 * "GE" here represents "greater than or equal to" in terms of ES
@@ -468,7 +478,7 @@ void omap2_check_revision(void);
468/* 478/*
469 * Runtime detection of OMAP3 features 479 * Runtime detection of OMAP3 features
470 */ 480 */
471extern u32 omap3_features; 481extern u32 omap_features;
472 482
473#define OMAP3_HAS_L2CACHE BIT(0) 483#define OMAP3_HAS_L2CACHE BIT(0)
474#define OMAP3_HAS_IVA BIT(1) 484#define OMAP3_HAS_IVA BIT(1)
@@ -478,11 +488,15 @@ extern u32 omap3_features;
478#define OMAP3_HAS_192MHZ_CLK BIT(5) 488#define OMAP3_HAS_192MHZ_CLK BIT(5)
479#define OMAP3_HAS_IO_WAKEUP BIT(6) 489#define OMAP3_HAS_IO_WAKEUP BIT(6)
480#define OMAP3_HAS_SDRC BIT(7) 490#define OMAP3_HAS_SDRC BIT(7)
491#define OMAP4_HAS_MPU_1GHZ BIT(8)
492#define OMAP4_HAS_MPU_1_2GHZ BIT(9)
493#define OMAP4_HAS_MPU_1_5GHZ BIT(10)
494
481 495
482#define OMAP3_HAS_FEATURE(feat,flag) \ 496#define OMAP3_HAS_FEATURE(feat,flag) \
483static inline unsigned int omap3_has_ ##feat(void) \ 497static inline unsigned int omap3_has_ ##feat(void) \
484{ \ 498{ \
485 return (omap3_features & OMAP3_HAS_ ##flag); \ 499 return omap_features & OMAP3_HAS_ ##flag; \
486} \ 500} \
487 501
488OMAP3_HAS_FEATURE(l2cache, L2CACHE) 502OMAP3_HAS_FEATURE(l2cache, L2CACHE)
@@ -494,4 +508,19 @@ OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
494OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) 508OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
495OMAP3_HAS_FEATURE(sdrc, SDRC) 509OMAP3_HAS_FEATURE(sdrc, SDRC)
496 510
511/*
512 * Runtime detection of OMAP4 features
513 */
514extern u32 omap_features;
515
516#define OMAP4_HAS_FEATURE(feat, flag) \
517static inline unsigned int omap4_has_ ##feat(void) \
518{ \
519 return omap_features & OMAP4_HAS_ ##flag; \
520} \
521
522OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
523OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
524OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
525
497#endif 526#endif
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h
index d1c916fcf77..dc562a5c0a8 100644
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ b/arch/arm/plat-omap/include/plat/dma.h
@@ -195,6 +195,11 @@
195 195
196#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */ 196#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
197#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */ 197#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
198
199/* Only for AM35xx */
200#define AM35XX_DMA_UART4_TX 54
201#define AM35XX_DMA_UART4_RX 55
202
198/*----------------------------------------------------------------------------*/ 203/*----------------------------------------------------------------------------*/
199 204
200#define OMAP1_DMA_TOUT_IRQ (1 << 0) 205#define OMAP1_DMA_TOUT_IRQ (1 << 0)
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h
index 878d632c409..7c22b9e10dc 100644
--- a/arch/arm/plat-omap/include/plat/i2c.h
+++ b/arch/arm/plat-omap/include/plat/i2c.h
@@ -22,6 +22,7 @@
22#define __ASM__ARCH_OMAP_I2C_H 22#define __ASM__ARCH_OMAP_I2C_H
23 23
24#include <linux/i2c.h> 24#include <linux/i2c.h>
25#include <linux/i2c-omap.h>
25 26
26#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) 27#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
27extern int omap_register_i2c_bus(int bus_id, u32 clkrate, 28extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
@@ -46,10 +47,13 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
46 */ 47 */
47struct omap_i2c_dev_attr { 48struct omap_i2c_dev_attr {
48 u8 fifo_depth; 49 u8 fifo_depth;
49 u8 flags; 50 u32 flags;
50}; 51};
51 52
52void __init omap1_i2c_mux_pins(int bus_id); 53void __init omap1_i2c_mux_pins(int bus_id);
53void __init omap2_i2c_mux_pins(int bus_id); 54void __init omap2_i2c_mux_pins(int bus_id);
54 55
56struct omap_hwmod;
57int omap_i2c_reset(struct omap_hwmod *oh);
58
55#endif /* __ASM__ARCH_OMAP_I2C_H */ 59#endif /* __ASM__ARCH_OMAP_I2C_H */
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index c8843200566..30e10719b77 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -357,6 +357,7 @@
357#define INT_35XX_EMAC_C0_TX_PULSE_IRQ 69 357#define INT_35XX_EMAC_C0_TX_PULSE_IRQ 69
358#define INT_35XX_EMAC_C0_MISC_PULSE_IRQ 70 358#define INT_35XX_EMAC_C0_MISC_PULSE_IRQ 70
359#define INT_35XX_USBOTG_IRQ 71 359#define INT_35XX_USBOTG_IRQ 71
360#define INT_35XX_UART4 84
360#define INT_35XX_CCDC_VD0_IRQ 88 361#define INT_35XX_CCDC_VD0_IRQ 88
361#define INT_35XX_CCDC_VD1_IRQ 92 362#define INT_35XX_CCDC_VD1_IRQ 92
362#define INT_35XX_CCDC_VD2_IRQ 93 363#define INT_35XX_CCDC_VD2_IRQ 93
@@ -407,11 +408,19 @@
407#endif 408#endif
408#define TWL6030_IRQ_END (TWL6030_IRQ_BASE + TWL6030_BASE_NR_IRQS) 409#define TWL6030_IRQ_END (TWL6030_IRQ_BASE + TWL6030_BASE_NR_IRQS)
409 410
411#define TWL6040_CODEC_IRQ_BASE TWL6030_IRQ_END
412#ifdef CONFIG_TWL6040_CODEC
413#define TWL6040_CODEC_NR_IRQS 6
414#else
415#define TWL6040_CODEC_NR_IRQS 0
416#endif
417#define TWL6040_CODEC_IRQ_END (TWL6040_CODEC_IRQ_BASE + TWL6040_CODEC_NR_IRQS)
418
410/* Total number of interrupts depends on the enabled blocks above */ 419/* Total number of interrupts depends on the enabled blocks above */
411#if (TWL4030_GPIO_IRQ_END > TWL6030_IRQ_END) 420#if (TWL4030_GPIO_IRQ_END > TWL6040_CODEC_IRQ_END)
412#define TWL_IRQ_END TWL4030_GPIO_IRQ_END 421#define TWL_IRQ_END TWL4030_GPIO_IRQ_END
413#else 422#else
414#define TWL_IRQ_END TWL6030_IRQ_END 423#define TWL_IRQ_END TWL6040_CODEC_IRQ_END
415#endif 424#endif
416 425
417/* GPMC related */ 426/* GPMC related */
diff --git a/arch/arm/plat-omap/include/plat/omap4-keypad.h b/arch/arm/plat-omap/include/plat/omap4-keypad.h
index 2b1d9bc1eeb..9fe6c878323 100644
--- a/arch/arm/plat-omap/include/plat/omap4-keypad.h
+++ b/arch/arm/plat-omap/include/plat/omap4-keypad.h
@@ -10,5 +10,6 @@ struct omap4_keypad_platform_data {
10 u8 cols; 10 u8 cols;
11}; 11};
12 12
13extern int omap4_keyboard_init(struct omap4_keypad_platform_data *); 13extern int omap4_keyboard_init(struct omap4_keypad_platform_data *,
14 struct omap_board_data *);
14#endif 15#endif
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index ce06ac6a970..0e329ca88a7 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -2,6 +2,7 @@
2 * omap_hwmod macros, structures 2 * omap_hwmod macros, structures
3 * 3 *
4 * Copyright (C) 2009-2011 Nokia Corporation 4 * Copyright (C) 2009-2011 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * Created in collaboration with (alphabetical order): Benoît Cousson, 8 * Created in collaboration with (alphabetical order): Benoît Cousson,
@@ -79,6 +80,11 @@ extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2;
79#define HWMOD_IDLEMODE_SMART (1 << 2) 80#define HWMOD_IDLEMODE_SMART (1 << 2)
80#define HWMOD_IDLEMODE_SMART_WKUP (1 << 3) 81#define HWMOD_IDLEMODE_SMART_WKUP (1 << 3)
81 82
83/* modulemode control type (SW or HW) */
84#define MODULEMODE_HWCTRL 1
85#define MODULEMODE_SWCTRL 2
86
87
82/** 88/**
83 * struct omap_hwmod_mux_info - hwmod specific mux configuration 89 * struct omap_hwmod_mux_info - hwmod specific mux configuration
84 * @pads: array of omap_device_pad entries 90 * @pads: array of omap_device_pad entries
@@ -360,9 +366,11 @@ struct omap_hwmod_omap2_prcm {
360 * @submodule_wkdep_bit: bit shift of the WKDEP range 366 * @submodule_wkdep_bit: bit shift of the WKDEP range
361 */ 367 */
362struct omap_hwmod_omap4_prcm { 368struct omap_hwmod_omap4_prcm {
363 void __iomem *clkctrl_reg; 369 u16 clkctrl_offs;
364 void __iomem *rstctrl_reg; 370 u16 rstctrl_offs;
371 u16 context_offs;
365 u8 submodule_wkdep_bit; 372 u8 submodule_wkdep_bit;
373 u8 modulemode;
366}; 374};
367 375
368 376
@@ -515,6 +523,8 @@ struct omap_hwmod {
515 const char *main_clk; 523 const char *main_clk;
516 struct clk *_clk; 524 struct clk *_clk;
517 struct omap_hwmod_opt_clk *opt_clks; 525 struct omap_hwmod_opt_clk *opt_clks;
526 char *clkdm_name;
527 struct clockdomain *clkdm;
518 char *vdd_name; 528 char *vdd_name;
519 struct voltagedomain *voltdm; 529 struct voltagedomain *voltdm;
520 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ 530 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */
@@ -566,6 +576,7 @@ void omap_hwmod_ocp_barrier(struct omap_hwmod *oh);
566 576
567void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs); 577void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs);
568u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs); 578u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs);
579int omap_hwmod_softreset(struct omap_hwmod *oh);
569 580
570int omap_hwmod_count_resources(struct omap_hwmod *oh); 581int omap_hwmod_count_resources(struct omap_hwmod *oh);
571int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res); 582int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res);
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 2723f9166ea..de3b10c1812 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -56,6 +56,9 @@
56#define TI816X_UART2_BASE 0x48022000 56#define TI816X_UART2_BASE 0x48022000
57#define TI816X_UART3_BASE 0x48024000 57#define TI816X_UART3_BASE 0x48024000
58 58
59/* AM3505/3517 UART4 */
60#define AM35XX_UART4_BASE 0x4809E000 /* Only on AM3505/3517 */
61
59/* External port on Zoom2/3 */ 62/* External port on Zoom2/3 */
60#define ZOOM_UART_BASE 0x10000000 63#define ZOOM_UART_BASE 0x10000000
61#define ZOOM_UART_VIRT 0xfa400000 64#define ZOOM_UART_VIRT 0xfa400000
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index ac4b60d9aa2..a067484cc4a 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -148,6 +148,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
148 /* omap3 based boards using UART3 */ 148 /* omap3 based boards using UART3 */
149 DEBUG_LL_OMAP3(3, cm_t35); 149 DEBUG_LL_OMAP3(3, cm_t35);
150 DEBUG_LL_OMAP3(3, cm_t3517); 150 DEBUG_LL_OMAP3(3, cm_t3517);
151 DEBUG_LL_OMAP3(3, cm_t3730);
151 DEBUG_LL_OMAP3(3, craneboard); 152 DEBUG_LL_OMAP3(3, craneboard);
152 DEBUG_LL_OMAP3(3, devkit8000); 153 DEBUG_LL_OMAP3(3, devkit8000);
153 DEBUG_LL_OMAP3(3, igep0020); 154 DEBUG_LL_OMAP3(3, igep0020);
diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
index 83a37c54342..79e7fedb860 100644
--- a/arch/arm/plat-omap/iovmm.c
+++ b/arch/arm/plat-omap/iovmm.c
@@ -72,7 +72,7 @@ static size_t sgtable_len(const struct sg_table *sgt)
72 for_each_sg(sgt->sgl, sg, sgt->nents, i) { 72 for_each_sg(sgt->sgl, sg, sgt->nents, i) {
73 size_t bytes; 73 size_t bytes;
74 74
75 bytes = sg_dma_len(sg); 75 bytes = sg->length;
76 76
77 if (!iopgsz_ok(bytes)) { 77 if (!iopgsz_ok(bytes)) {
78 pr_err("%s: sg[%d] not iommu pagesize(%x)\n", 78 pr_err("%s: sg[%d] not iommu pagesize(%x)\n",
@@ -198,7 +198,7 @@ static void *vmap_sg(const struct sg_table *sgt)
198 int err; 198 int err;
199 199
200 pa = sg_phys(sg); 200 pa = sg_phys(sg);
201 bytes = sg_dma_len(sg); 201 bytes = sg->length;
202 202
203 BUG_ON(bytes != PAGE_SIZE); 203 BUG_ON(bytes != PAGE_SIZE);
204 204
@@ -423,9 +423,6 @@ static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, u32 da,
423{ 423{
424 unsigned int i; 424 unsigned int i;
425 struct scatterlist *sg; 425 struct scatterlist *sg;
426 void *va;
427
428 va = phys_to_virt(pa);
429 426
430 for_each_sg(sgt->sgl, sg, sgt->nents, i) { 427 for_each_sg(sgt->sgl, sg, sgt->nents, i) {
431 unsigned bytes; 428 unsigned bytes;
@@ -476,7 +473,7 @@ static int map_iovm_area(struct iommu *obj, struct iovm_struct *new,
476 struct iotlb_entry e; 473 struct iotlb_entry e;
477 474
478 pa = sg_phys(sg); 475 pa = sg_phys(sg);
479 bytes = sg_dma_len(sg); 476 bytes = sg->length;
480 477
481 flags &= ~IOVMF_PGSZ_MASK; 478 flags &= ~IOVMF_PGSZ_MASK;
482 pgsz = bytes_to_iopgsz(bytes); 479 pgsz = bytes_to_iopgsz(bytes);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 3c1fbdc9246..6c62af10871 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -966,6 +966,33 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
966} 966}
967EXPORT_SYMBOL(omap_mcbsp_stop); 967EXPORT_SYMBOL(omap_mcbsp_stop);
968 968
969/*
970 * The following functions are only required on an OMAP1-only build.
971 * mach-omap2/mcbsp.c contains the real functions
972 */
973#ifndef CONFIG_ARCH_OMAP2PLUS
974int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
975{
976 WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
977 __func__);
978 return -EINVAL;
979}
980
981void omap2_mcbsp1_mux_clkr_src(u8 mux)
982{
983 WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
984 __func__);
985 return;
986}
987
988void omap2_mcbsp1_mux_fsr_src(u8 mux)
989{
990 WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
991 __func__);
992 return;
993}
994#endif
995
969#ifdef CONFIG_ARCH_OMAP3 996#ifdef CONFIG_ARCH_OMAP3
970#define max_thres(m) (mcbsp->pdata->buffer_size) 997#define max_thres(m) (mcbsp->pdata->buffer_size)
971#define valid_threshold(m, val) ((val) <= max_thres(m)) 998#define valid_threshold(m, val) ((val) <= max_thres(m))
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 3471c650743..02609eee056 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -236,56 +236,71 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
236 return 0; 236 return 0;
237} 237}
238 238
239static void _add_clkdev(struct omap_device *od, const char *clk_alias,
240 const char *clk_name)
241{
242 struct clk *r;
243 struct clk_lookup *l;
244
245 if (!clk_alias || !clk_name)
246 return;
247
248 pr_debug("omap_device: %s: Creating %s -> %s\n",
249 dev_name(&od->pdev.dev), clk_alias, clk_name);
250
251 r = clk_get_sys(dev_name(&od->pdev.dev), clk_alias);
252 if (!IS_ERR(r)) {
253 pr_warning("omap_device: %s: alias %s already exists\n",
254 dev_name(&od->pdev.dev), clk_alias);
255 clk_put(r);
256 return;
257 }
258
259 r = omap_clk_get_by_name(clk_name);
260 if (IS_ERR(r)) {
261 pr_err("omap_device: %s: omap_clk_get_by_name for %s failed\n",
262 dev_name(&od->pdev.dev), clk_name);
263 return;
264 }
265
266 l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev.dev));
267 if (!l) {
268 pr_err("omap_device: %s: clkdev_alloc for %s failed\n",
269 dev_name(&od->pdev.dev), clk_alias);
270 return;
271 }
272
273 clkdev_add(l);
274}
275
239/** 276/**
240 * _add_optional_clock_clkdev - Add clkdev entry for hwmod optional clocks 277 * _add_hwmod_clocks_clkdev - Add clkdev entry for hwmod optional clocks
278 * and main clock
241 * @od: struct omap_device *od 279 * @od: struct omap_device *od
280 * @oh: struct omap_hwmod *oh
242 * 281 *
243 * For every optional clock present per hwmod per omap_device, this function 282 * For the main clock and every optional clock present per hwmod per
244 * adds an entry in the clkdev table of the form <dev-id=dev_name, con-id=role> 283 * omap_device, this function adds an entry in the clkdev table of the
245 * if it does not exist already. 284 * form <dev-id=dev_name, con-id=role> if it does not exist already.
246 * 285 *
247 * The function is called from inside omap_device_build_ss(), after 286 * The function is called from inside omap_device_build_ss(), after
248 * omap_device_register. 287 * omap_device_register.
249 * 288 *
250 * This allows drivers to get a pointer to its optional clocks based on its role 289 * This allows drivers to get a pointer to its optional clocks based on its role
251 * by calling clk_get(<dev*>, <role>). 290 * by calling clk_get(<dev*>, <role>).
291 * In the case of the main clock, a "fck" alias is used.
252 * 292 *
253 * No return value. 293 * No return value.
254 */ 294 */
255static void _add_optional_clock_clkdev(struct omap_device *od, 295static void _add_hwmod_clocks_clkdev(struct omap_device *od,
256 struct omap_hwmod *oh) 296 struct omap_hwmod *oh)
257{ 297{
258 int i; 298 int i;
259 299
260 for (i = 0; i < oh->opt_clks_cnt; i++) { 300 _add_clkdev(od, "fck", oh->main_clk);
261 struct omap_hwmod_opt_clk *oc;
262 struct clk *r;
263 struct clk_lookup *l;
264
265 oc = &oh->opt_clks[i];
266
267 if (!oc->_clk)
268 continue;
269
270 r = clk_get_sys(dev_name(&od->pdev.dev), oc->role);
271 if (!IS_ERR(r))
272 continue; /* clkdev entry exists */
273 301
274 r = omap_clk_get_by_name((char *)oc->clk); 302 for (i = 0; i < oh->opt_clks_cnt; i++)
275 if (IS_ERR(r)) { 303 _add_clkdev(od, oh->opt_clks[i].role, oh->opt_clks[i].clk);
276 pr_err("omap_device: %s: omap_clk_get_by_name for %s failed\n",
277 dev_name(&od->pdev.dev), oc->clk);
278 continue;
279 }
280
281 l = clkdev_alloc(r, oc->role, dev_name(&od->pdev.dev));
282 if (!l) {
283 pr_err("omap_device: %s: clkdev_alloc for %s failed\n",
284 dev_name(&od->pdev.dev), oc->role);
285 return;
286 }
287 clkdev_add(l);
288 }
289} 304}
290 305
291 306
@@ -492,7 +507,7 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
492 507
493 for (i = 0; i < oh_cnt; i++) { 508 for (i = 0; i < oh_cnt; i++) {
494 hwmods[i]->od = od; 509 hwmods[i]->od = od;
495 _add_optional_clock_clkdev(od, hwmods[i]); 510 _add_hwmod_clocks_clkdev(od, hwmods[i]);
496 } 511 }
497 512
498 if (ret) 513 if (ret)
@@ -600,6 +615,9 @@ static int _od_resume_noirq(struct device *dev)
600 615
601 return pm_generic_resume_noirq(dev); 616 return pm_generic_resume_noirq(dev);
602} 617}
618#else
619#define _od_suspend_noirq NULL
620#define _od_resume_noirq NULL
603#endif 621#endif
604 622
605static struct dev_pm_domain omap_device_pm_domain = { 623static struct dev_pm_domain omap_device_pm_domain = {
@@ -607,7 +625,8 @@ static struct dev_pm_domain omap_device_pm_domain = {
607 SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume, 625 SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume,
608 _od_runtime_idle) 626 _od_runtime_idle)
609 USE_PLATFORM_PM_SLEEP_OPS 627 USE_PLATFORM_PM_SLEEP_OPS
610 SET_SYSTEM_SLEEP_PM_OPS(_od_suspend_noirq, _od_resume_noirq) 628 .suspend_noirq = _od_suspend_noirq,
629 .resume_noirq = _od_resume_noirq,
611 } 630 }
612}; 631};
613 632
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index e98f5c5c787..9843c954c04 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -39,6 +39,7 @@ config S5P_GPIO_INT
39 39
40config S5P_HRT 40config S5P_HRT
41 bool 41 bool
42 select SAMSUNG_DEV_PWM
42 help 43 help
43 Use the High Resolution timer support 44 Use the High Resolution timer support
44 45
@@ -70,6 +71,16 @@ config S5P_DEV_FIMC3
70 help 71 help
71 Compile in platform device definitions for FIMC controller 3 72 Compile in platform device definitions for FIMC controller 3
72 73
74config S5P_DEV_FIMD0
75 bool
76 help
77 Compile in platform device definitions for FIMD controller 0
78
79config S5P_DEV_MFC
80 bool
81 help
82 Compile in platform device definitions for MFC
83
73config S5P_DEV_ONENAND 84config S5P_DEV_ONENAND
74 bool 85 bool
75 help 86 help
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index e234cc4d49a..4b53e04eeca 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -25,11 +25,12 @@ obj-$(CONFIG_PM) += irq-pm.o
25obj-$(CONFIG_S5P_HRT) += s5p-time.o 25obj-$(CONFIG_S5P_HRT) += s5p-time.o
26 26
27# devices 27# devices
28 28obj-$(CONFIG_S5P_DEV_MFC) += dev-mfc.o
29obj-$(CONFIG_S5P_DEV_FIMC0) += dev-fimc0.o 29obj-$(CONFIG_S5P_DEV_FIMC0) += dev-fimc0.o
30obj-$(CONFIG_S5P_DEV_FIMC1) += dev-fimc1.o 30obj-$(CONFIG_S5P_DEV_FIMC1) += dev-fimc1.o
31obj-$(CONFIG_S5P_DEV_FIMC2) += dev-fimc2.o 31obj-$(CONFIG_S5P_DEV_FIMC2) += dev-fimc2.o
32obj-$(CONFIG_S5P_DEV_FIMC3) += dev-fimc3.o 32obj-$(CONFIG_S5P_DEV_FIMC3) += dev-fimc3.o
33obj-$(CONFIG_S5P_DEV_FIMD0) += dev-fimd0.o
33obj-$(CONFIG_S5P_DEV_ONENAND) += dev-onenand.o 34obj-$(CONFIG_S5P_DEV_ONENAND) += dev-onenand.o
34obj-$(CONFIG_S5P_DEV_CSIS0) += dev-csis0.o 35obj-$(CONFIG_S5P_DEV_CSIS0) += dev-csis0.o
35obj-$(CONFIG_S5P_DEV_CSIS1) += dev-csis1.o 36obj-$(CONFIG_S5P_DEV_CSIS1) += dev-csis1.o
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index 02af235298e..5f84a3f13ef 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -192,7 +192,7 @@ unsigned long s5p_spdif_get_rate(struct clk *clk)
192 if (IS_ERR(pclk)) 192 if (IS_ERR(pclk))
193 return -EINVAL; 193 return -EINVAL;
194 194
195 rate = pclk->ops->get_rate(clk); 195 rate = pclk->ops->get_rate(pclk);
196 clk_put(pclk); 196 clk_put(pclk);
197 197
198 return rate; 198 return rate;
diff --git a/arch/arm/plat-s5p/dev-fimd0.c b/arch/arm/plat-s5p/dev-fimd0.c
new file mode 100644
index 00000000000..f728bb5abce
--- /dev/null
+++ b/arch/arm/plat-s5p/dev-fimd0.c
@@ -0,0 +1,67 @@
1/* linux/arch/arm/plat-s5p/dev-fimd0.c
2 *
3 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Core file for Samsung Display Controller (FIMD) driver
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/string.h>
15#include <linux/platform_device.h>
16#include <linux/fb.h>
17#include <linux/gfp.h>
18#include <linux/dma-mapping.h>
19
20#include <mach/irqs.h>
21#include <mach/map.h>
22
23#include <plat/fb.h>
24#include <plat/devs.h>
25#include <plat/cpu.h>
26
27static struct resource s5p_fimd0_resource[] = {
28 [0] = {
29 .start = S5P_PA_FIMD0,
30 .end = S5P_PA_FIMD0 + SZ_32K - 1,
31 .flags = IORESOURCE_MEM,
32 },
33 [1] = {
34 .start = IRQ_FIMD0_VSYNC,
35 .end = IRQ_FIMD0_VSYNC,
36 .flags = IORESOURCE_IRQ,
37 },
38 [2] = {
39 .start = IRQ_FIMD0_FIFO,
40 .end = IRQ_FIMD0_FIFO,
41 .flags = IORESOURCE_IRQ,
42 },
43 [3] = {
44 .start = IRQ_FIMD0_SYSTEM,
45 .end = IRQ_FIMD0_SYSTEM,
46 .flags = IORESOURCE_IRQ,
47 },
48};
49
50static u64 fimd0_dmamask = DMA_BIT_MASK(32);
51
52struct platform_device s5p_device_fimd0 = {
53 .name = "s5p-fb",
54 .id = 0,
55 .num_resources = ARRAY_SIZE(s5p_fimd0_resource),
56 .resource = s5p_fimd0_resource,
57 .dev = {
58 .dma_mask = &fimd0_dmamask,
59 .coherent_dma_mask = DMA_BIT_MASK(32),
60 },
61};
62
63void __init s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd)
64{
65 s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
66 &s5p_device_fimd0);
67}
diff --git a/arch/arm/plat-s5p/dev-mfc.c b/arch/arm/plat-s5p/dev-mfc.c
new file mode 100644
index 00000000000..94226a0010f
--- /dev/null
+++ b/arch/arm/plat-s5p/dev-mfc.c
@@ -0,0 +1,123 @@
1/* linux/arch/arm/plat-s5p/dev-mfc.c
2 *
3 * Copyright (C) 2010-2011 Samsung Electronics Co.Ltd
4 *
5 * Base S5P MFC resource and device definitions
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/dma-mapping.h>
17#include <linux/memblock.h>
18#include <linux/ioport.h>
19
20#include <mach/map.h>
21#include <plat/devs.h>
22#include <plat/irqs.h>
23#include <plat/mfc.h>
24
25static struct resource s5p_mfc_resource[] = {
26 [0] = {
27 .start = S5P_PA_MFC,
28 .end = S5P_PA_MFC + SZ_64K - 1,
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .start = IRQ_MFC,
33 .end = IRQ_MFC,
34 .flags = IORESOURCE_IRQ,
35 }
36};
37
38struct platform_device s5p_device_mfc = {
39 .name = "s5p-mfc",
40 .id = -1,
41 .num_resources = ARRAY_SIZE(s5p_mfc_resource),
42 .resource = s5p_mfc_resource,
43};
44
45/*
46 * MFC hardware has 2 memory interfaces which are modelled as two separate
47 * platform devices to let dma-mapping distinguish between them.
48 *
49 * MFC parent device (s5p_device_mfc) must be registered before memory
50 * interface specific devices (s5p_device_mfc_l and s5p_device_mfc_r).
51 */
52
53static u64 s5p_mfc_dma_mask = DMA_BIT_MASK(32);
54
55struct platform_device s5p_device_mfc_l = {
56 .name = "s5p-mfc-l",
57 .id = -1,
58 .dev = {
59 .parent = &s5p_device_mfc.dev,
60 .dma_mask = &s5p_mfc_dma_mask,
61 .coherent_dma_mask = DMA_BIT_MASK(32),
62 },
63};
64
65struct platform_device s5p_device_mfc_r = {
66 .name = "s5p-mfc-r",
67 .id = -1,
68 .dev = {
69 .parent = &s5p_device_mfc.dev,
70 .dma_mask = &s5p_mfc_dma_mask,
71 .coherent_dma_mask = DMA_BIT_MASK(32),
72 },
73};
74
75struct s5p_mfc_reserved_mem {
76 phys_addr_t base;
77 unsigned long size;
78 struct device *dev;
79};
80
81static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata;
82
83void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
84 phys_addr_t lbase, unsigned int lsize)
85{
86 int i;
87
88 s5p_mfc_mem[0].dev = &s5p_device_mfc_r.dev;
89 s5p_mfc_mem[0].base = rbase;
90 s5p_mfc_mem[0].size = rsize;
91
92 s5p_mfc_mem[1].dev = &s5p_device_mfc_l.dev;
93 s5p_mfc_mem[1].base = lbase;
94 s5p_mfc_mem[1].size = lsize;
95
96 for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) {
97 struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i];
98 if (memblock_remove(area->base, area->size)) {
99 printk(KERN_ERR "Failed to reserve memory for MFC device (%ld bytes at 0x%08lx)\n",
100 area->size, (unsigned long) area->base);
101 area->base = 0;
102 }
103 }
104}
105
106static int __init s5p_mfc_memory_init(void)
107{
108 int i;
109
110 for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) {
111 struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i];
112 if (!area->base)
113 continue;
114
115 if (dma_declare_coherent_memory(area->dev, area->base,
116 area->base, area->size,
117 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE) == 0)
118 printk(KERN_ERR "Failed to declare coherent memory for MFC device (%ld bytes at 0x%08lx)\n",
119 area->size, (unsigned long) area->base);
120 }
121 return 0;
122}
123device_initcall(s5p_mfc_memory_init);
diff --git a/arch/arm/plat-s5p/include/plat/map-s5p.h b/arch/arm/plat-s5p/include/plat/map-s5p.h
index d973d39666a..36d3551173b 100644
--- a/arch/arm/plat-s5p/include/plat/map-s5p.h
+++ b/arch/arm/plat-s5p/include/plat/map-s5p.h
@@ -35,9 +35,10 @@
35#define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000) 35#define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000)
36#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x)) 36#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x))
37#define S5P_VA_SCU S5P_VA_COREPERI(0x0) 37#define S5P_VA_SCU S5P_VA_COREPERI(0x0)
38#define S5P_VA_GIC_CPU S5P_VA_COREPERI(0x100)
39#define S5P_VA_TWD S5P_VA_COREPERI(0x600) 38#define S5P_VA_TWD S5P_VA_COREPERI(0x600)
40#define S5P_VA_GIC_DIST S5P_VA_COREPERI(0x1000) 39
40#define S5P_VA_GIC_CPU S3C_ADDR(0x02810000)
41#define S5P_VA_GIC_DIST S3C_ADDR(0x02820000)
41 42
42#define S3C_VA_USB_HSPHY S3C_ADDR(0x02900000) 43#define S3C_VA_USB_HSPHY S3C_ADDR(0x02900000)
43 44
diff --git a/arch/arm/plat-s5p/include/plat/mfc.h b/arch/arm/plat-s5p/include/plat/mfc.h
new file mode 100644
index 00000000000..6697f8cb294
--- /dev/null
+++ b/arch/arm/plat-s5p/include/plat/mfc.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __PLAT_S5P_MFC_H
11#define __PLAT_S5P_MFC_H
12
13/**
14 * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver
15 * @rbase: base address for MFC 'right' memory interface
16 * @rsize: size of the memory reserved for MFC 'right' interface
17 * @lbase: base address for MFC 'left' memory interface
18 * @lsize: size of the memory reserved for MFC 'left' interface
19 *
20 * This function reserves system memory for both MFC device memory
21 * interfaces and registers it to respective struct device entries as
22 * coherent memory.
23 */
24void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
25 phys_addr_t lbase, unsigned int lsize);
26
27#endif /* __PLAT_S5P_MFC_H */
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
index 327ab9f662e..f71078ef6bb 100644
--- a/arch/arm/plat-s5p/irq-gpioint.c
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -23,6 +23,8 @@
23#include <plat/gpio-core.h> 23#include <plat/gpio-core.h>
24#include <plat/gpio-cfg.h> 24#include <plat/gpio-cfg.h>
25 25
26#include <asm/mach/irq.h>
27
26#define GPIO_BASE(chip) (((unsigned long)(chip)->base) & 0xFFFFF000u) 28#define GPIO_BASE(chip) (((unsigned long)(chip)->base) & 0xFFFFF000u)
27 29
28#define CON_OFFSET 0x700 30#define CON_OFFSET 0x700
@@ -81,6 +83,9 @@ static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc)
81 int group, pend_offset, mask_offset; 83 int group, pend_offset, mask_offset;
82 unsigned int pend, mask; 84 unsigned int pend, mask;
83 85
86 struct irq_chip *chip = irq_get_chip(irq);
87 chained_irq_enter(chip, desc);
88
84 for (group = 0; group < bank->nr_groups; group++) { 89 for (group = 0; group < bank->nr_groups; group++) {
85 struct s3c_gpio_chip *chip = bank->chips[group]; 90 struct s3c_gpio_chip *chip = bank->chips[group];
86 if (!chip) 91 if (!chip)
@@ -102,6 +107,7 @@ static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc)
102 pend &= ~BIT(offset); 107 pend &= ~BIT(offset);
103 } 108 }
104 } 109 }
110 chained_irq_exit(chip, desc);
105} 111}
106 112
107static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip) 113static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index e8f2be2d67f..ee8deef1948 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -21,6 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/regulator/consumer.h>
24 25
25#include <plat/regs-adc.h> 26#include <plat/regs-adc.h>
26#include <plat/adc.h> 27#include <plat/adc.h>
@@ -39,8 +40,9 @@
39 */ 40 */
40 41
41enum s3c_cpu_type { 42enum s3c_cpu_type {
42 TYPE_S3C24XX, 43 TYPE_ADCV1, /* S3C24XX */
43 TYPE_S3C64XX 44 TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */
45 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
44}; 46};
45 47
46struct s3c_adc_client { 48struct s3c_adc_client {
@@ -71,6 +73,7 @@ struct adc_device {
71 unsigned int prescale; 73 unsigned int prescale;
72 74
73 int irq; 75 int irq;
76 struct regulator *vdd;
74}; 77};
75 78
76static struct adc_device *adc_dev; 79static struct adc_device *adc_dev;
@@ -91,6 +94,7 @@ static inline void s3c_adc_select(struct adc_device *adc,
91 struct s3c_adc_client *client) 94 struct s3c_adc_client *client)
92{ 95{
93 unsigned con = readl(adc->regs + S3C2410_ADCCON); 96 unsigned con = readl(adc->regs + S3C2410_ADCCON);
97 enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
94 98
95 client->select_cb(client, 1); 99 client->select_cb(client, 1);
96 100
@@ -98,8 +102,12 @@ static inline void s3c_adc_select(struct adc_device *adc,
98 con &= ~S3C2410_ADCCON_STDBM; 102 con &= ~S3C2410_ADCCON_STDBM;
99 con &= ~S3C2410_ADCCON_STARTMASK; 103 con &= ~S3C2410_ADCCON_STARTMASK;
100 104
101 if (!client->is_ts) 105 if (!client->is_ts) {
102 con |= S3C2410_ADCCON_SELMUX(client->channel); 106 if (cpu == TYPE_ADCV3)
107 writel(client->channel & 0xf, adc->regs + S5P_ADCMUX);
108 else
109 con |= S3C2410_ADCCON_SELMUX(client->channel);
110 }
103 111
104 writel(con, adc->regs + S3C2410_ADCCON); 112 writel(con, adc->regs + S3C2410_ADCCON);
105} 113}
@@ -285,8 +293,8 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
285 293
286 client->nr_samples--; 294 client->nr_samples--;
287 295
288 if (cpu == TYPE_S3C64XX) { 296 if (cpu != TYPE_ADCV1) {
289 /* S3C64XX ADC resolution is 12-bit */ 297 /* S3C64XX/S5P ADC resolution is 12-bit */
290 data0 &= 0xfff; 298 data0 &= 0xfff;
291 data1 &= 0xfff; 299 data1 &= 0xfff;
292 } else { 300 } else {
@@ -312,7 +320,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
312 } 320 }
313 321
314exit: 322exit:
315 if (cpu == TYPE_S3C64XX) { 323 if (cpu != TYPE_ADCV1) {
316 /* Clear ADC interrupt */ 324 /* Clear ADC interrupt */
317 writel(0, adc->regs + S3C64XX_ADCCLRINT); 325 writel(0, adc->regs + S3C64XX_ADCCLRINT);
318 } 326 }
@@ -338,17 +346,24 @@ static int s3c_adc_probe(struct platform_device *pdev)
338 adc->pdev = pdev; 346 adc->pdev = pdev;
339 adc->prescale = S3C2410_ADCCON_PRSCVL(49); 347 adc->prescale = S3C2410_ADCCON_PRSCVL(49);
340 348
349 adc->vdd = regulator_get(dev, "vdd");
350 if (IS_ERR(adc->vdd)) {
351 dev_err(dev, "operating without regulator \"vdd\" .\n");
352 ret = PTR_ERR(adc->vdd);
353 goto err_alloc;
354 }
355
341 adc->irq = platform_get_irq(pdev, 1); 356 adc->irq = platform_get_irq(pdev, 1);
342 if (adc->irq <= 0) { 357 if (adc->irq <= 0) {
343 dev_err(dev, "failed to get adc irq\n"); 358 dev_err(dev, "failed to get adc irq\n");
344 ret = -ENOENT; 359 ret = -ENOENT;
345 goto err_alloc; 360 goto err_reg;
346 } 361 }
347 362
348 ret = request_irq(adc->irq, s3c_adc_irq, 0, dev_name(dev), adc); 363 ret = request_irq(adc->irq, s3c_adc_irq, 0, dev_name(dev), adc);
349 if (ret < 0) { 364 if (ret < 0) {
350 dev_err(dev, "failed to attach adc irq\n"); 365 dev_err(dev, "failed to attach adc irq\n");
351 goto err_alloc; 366 goto err_reg;
352 } 367 }
353 368
354 adc->clk = clk_get(dev, "adc"); 369 adc->clk = clk_get(dev, "adc");
@@ -372,10 +387,14 @@ static int s3c_adc_probe(struct platform_device *pdev)
372 goto err_clk; 387 goto err_clk;
373 } 388 }
374 389
390 ret = regulator_enable(adc->vdd);
391 if (ret)
392 goto err_ioremap;
393
375 clk_enable(adc->clk); 394 clk_enable(adc->clk);
376 395
377 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; 396 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
378 if (platform_get_device_id(pdev)->driver_data == TYPE_S3C64XX) { 397 if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) {
379 /* Enable 12-bit ADC resolution */ 398 /* Enable 12-bit ADC resolution */
380 tmp |= S3C64XX_ADCCON_RESSEL; 399 tmp |= S3C64XX_ADCCON_RESSEL;
381 } 400 }
@@ -388,12 +407,15 @@ static int s3c_adc_probe(struct platform_device *pdev)
388 407
389 return 0; 408 return 0;
390 409
410 err_ioremap:
411 iounmap(adc->regs);
391 err_clk: 412 err_clk:
392 clk_put(adc->clk); 413 clk_put(adc->clk);
393 414
394 err_irq: 415 err_irq:
395 free_irq(adc->irq, adc); 416 free_irq(adc->irq, adc);
396 417 err_reg:
418 regulator_put(adc->vdd);
397 err_alloc: 419 err_alloc:
398 kfree(adc); 420 kfree(adc);
399 return ret; 421 return ret;
@@ -406,6 +428,8 @@ static int __devexit s3c_adc_remove(struct platform_device *pdev)
406 iounmap(adc->regs); 428 iounmap(adc->regs);
407 free_irq(adc->irq, adc); 429 free_irq(adc->irq, adc);
408 clk_disable(adc->clk); 430 clk_disable(adc->clk);
431 regulator_disable(adc->vdd);
432 regulator_put(adc->vdd);
409 clk_put(adc->clk); 433 clk_put(adc->clk);
410 kfree(adc); 434 kfree(adc);
411 435
@@ -413,8 +437,10 @@ static int __devexit s3c_adc_remove(struct platform_device *pdev)
413} 437}
414 438
415#ifdef CONFIG_PM 439#ifdef CONFIG_PM
416static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state) 440static int s3c_adc_suspend(struct device *dev)
417{ 441{
442 struct platform_device *pdev = container_of(dev,
443 struct platform_device, dev);
418 struct adc_device *adc = platform_get_drvdata(pdev); 444 struct adc_device *adc = platform_get_drvdata(pdev);
419 unsigned long flags; 445 unsigned long flags;
420 u32 con; 446 u32 con;
@@ -428,19 +454,30 @@ static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state)
428 disable_irq(adc->irq); 454 disable_irq(adc->irq);
429 spin_unlock_irqrestore(&adc->lock, flags); 455 spin_unlock_irqrestore(&adc->lock, flags);
430 clk_disable(adc->clk); 456 clk_disable(adc->clk);
457 regulator_disable(adc->vdd);
431 458
432 return 0; 459 return 0;
433} 460}
434 461
435static int s3c_adc_resume(struct platform_device *pdev) 462static int s3c_adc_resume(struct device *dev)
436{ 463{
464 struct platform_device *pdev = container_of(dev,
465 struct platform_device, dev);
437 struct adc_device *adc = platform_get_drvdata(pdev); 466 struct adc_device *adc = platform_get_drvdata(pdev);
467 int ret;
468 unsigned long tmp;
438 469
470 ret = regulator_enable(adc->vdd);
471 if (ret)
472 return ret;
439 clk_enable(adc->clk); 473 clk_enable(adc->clk);
440 enable_irq(adc->irq); 474 enable_irq(adc->irq);
441 475
442 writel(adc->prescale | S3C2410_ADCCON_PRSCEN, 476 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
443 adc->regs + S3C2410_ADCCON); 477 /* Enable 12-bit ADC resolution */
478 if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1)
479 tmp |= S3C64XX_ADCCON_RESSEL;
480 writel(tmp, adc->regs + S3C2410_ADCCON);
444 481
445 return 0; 482 return 0;
446} 483}
@@ -453,25 +490,32 @@ static int s3c_adc_resume(struct platform_device *pdev)
453static struct platform_device_id s3c_adc_driver_ids[] = { 490static struct platform_device_id s3c_adc_driver_ids[] = {
454 { 491 {
455 .name = "s3c24xx-adc", 492 .name = "s3c24xx-adc",
456 .driver_data = TYPE_S3C24XX, 493 .driver_data = TYPE_ADCV1,
457 }, { 494 }, {
458 .name = "s3c64xx-adc", 495 .name = "s3c64xx-adc",
459 .driver_data = TYPE_S3C64XX, 496 .driver_data = TYPE_ADCV2,
497 }, {
498 .name = "samsung-adc-v3",
499 .driver_data = TYPE_ADCV3,
460 }, 500 },
461 { } 501 { }
462}; 502};
463MODULE_DEVICE_TABLE(platform, s3c_adc_driver_ids); 503MODULE_DEVICE_TABLE(platform, s3c_adc_driver_ids);
464 504
505static const struct dev_pm_ops adc_pm_ops = {
506 .suspend = s3c_adc_suspend,
507 .resume = s3c_adc_resume,
508};
509
465static struct platform_driver s3c_adc_driver = { 510static struct platform_driver s3c_adc_driver = {
466 .id_table = s3c_adc_driver_ids, 511 .id_table = s3c_adc_driver_ids,
467 .driver = { 512 .driver = {
468 .name = "s3c-adc", 513 .name = "s3c-adc",
469 .owner = THIS_MODULE, 514 .owner = THIS_MODULE,
515 .pm = &adc_pm_ops,
470 }, 516 },
471 .probe = s3c_adc_probe, 517 .probe = s3c_adc_probe,
472 .remove = __devexit_p(s3c_adc_remove), 518 .remove = __devexit_p(s3c_adc_remove),
473 .suspend = s3c_adc_suspend,
474 .resume = s3c_adc_resume,
475}; 519};
476 520
477static int __init adc_init(void) 521static int __init adc_init(void)
@@ -485,4 +529,4 @@ static int __init adc_init(void)
485 return ret; 529 return ret;
486} 530}
487 531
488arch_initcall(adc_init); 532module_init(adc_init);
diff --git a/arch/arm/plat-samsung/dev-asocdma.c b/arch/arm/plat-samsung/dev-asocdma.c
index a068c4f42d5..97e35d3c064 100644
--- a/arch/arm/plat-samsung/dev-asocdma.c
+++ b/arch/arm/plat-samsung/dev-asocdma.c
@@ -23,3 +23,13 @@ struct platform_device samsung_asoc_dma = {
23 } 23 }
24}; 24};
25EXPORT_SYMBOL(samsung_asoc_dma); 25EXPORT_SYMBOL(samsung_asoc_dma);
26
27struct platform_device samsung_asoc_idma = {
28 .name = "samsung-idma",
29 .id = -1,
30 .dev = {
31 .dma_mask = &audio_dmamask,
32 .coherent_dma_mask = DMA_BIT_MASK(32),
33 }
34};
35EXPORT_SYMBOL(samsung_asoc_idma);
diff --git a/arch/arm/plat-samsung/include/plat/audio.h b/arch/arm/plat-samsung/include/plat/audio.h
index a0826ed2f9f..aa9875f77c4 100644
--- a/arch/arm/plat-samsung/include/plat/audio.h
+++ b/arch/arm/plat-samsung/include/plat/audio.h
@@ -44,6 +44,7 @@ struct samsung_i2s {
44 * Also corresponds to clocks of I2SMOD[10] 44 * Also corresponds to clocks of I2SMOD[10]
45 */ 45 */
46 const char **src_clk; 46 const char **src_clk;
47 dma_addr_t idma_addr;
47}; 48};
48 49
49/** 50/**
diff --git a/arch/arm/plat-samsung/include/plat/backlight.h b/arch/arm/plat-samsung/include/plat/backlight.h
index 51d8da846a6..ad530c78fe8 100644
--- a/arch/arm/plat-samsung/include/plat/backlight.h
+++ b/arch/arm/plat-samsung/include/plat/backlight.h
@@ -20,7 +20,7 @@ struct samsung_bl_gpio_info {
20 int func; 20 int func;
21}; 21};
22 22
23extern void samsung_bl_set(struct samsung_bl_gpio_info *gpio_info, 23extern void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
24 struct platform_pwm_backlight_data *bl_data); 24 struct platform_pwm_backlight_data *bl_data);
25 25
26#endif /* __ASM_PLAT_BACKLIGHT_H */ 26#endif /* __ASM_PLAT_BACKLIGHT_H */
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index e3b31c26ac3..24ebb1e1de4 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -40,6 +40,7 @@ extern struct platform_device s3c64xx_device_spi0;
40extern struct platform_device s3c64xx_device_spi1; 40extern struct platform_device s3c64xx_device_spi1;
41 41
42extern struct platform_device samsung_asoc_dma; 42extern struct platform_device samsung_asoc_dma;
43extern struct platform_device samsung_asoc_idma;
43 44
44extern struct platform_device s3c64xx_device_pcm0; 45extern struct platform_device s3c64xx_device_pcm0;
45extern struct platform_device s3c64xx_device_pcm1; 46extern struct platform_device s3c64xx_device_pcm1;
@@ -49,6 +50,7 @@ extern struct platform_device s3c64xx_device_ac97;
49extern struct platform_device s3c_device_ts; 50extern struct platform_device s3c_device_ts;
50 51
51extern struct platform_device s3c_device_fb; 52extern struct platform_device s3c_device_fb;
53extern struct platform_device s5p_device_fimd0;
52extern struct platform_device s3c_device_ohci; 54extern struct platform_device s3c_device_ohci;
53extern struct platform_device s3c_device_lcd; 55extern struct platform_device s3c_device_lcd;
54extern struct platform_device s3c_device_wdt; 56extern struct platform_device s3c_device_wdt;
@@ -112,6 +114,7 @@ extern struct platform_device exynos4_device_i2s2;
112extern struct platform_device exynos4_device_spdif; 114extern struct platform_device exynos4_device_spdif;
113extern struct platform_device exynos4_device_pd[]; 115extern struct platform_device exynos4_device_pd[];
114extern struct platform_device exynos4_device_ahci; 116extern struct platform_device exynos4_device_ahci;
117extern struct platform_device exynos4_device_dwmci;
115 118
116extern struct platform_device s5p6440_device_pcm; 119extern struct platform_device s5p6440_device_pcm;
117extern struct platform_device s5p6440_device_iis; 120extern struct platform_device s5p6440_device_iis;
@@ -136,6 +139,9 @@ extern struct platform_device s5p_device_fimc1;
136extern struct platform_device s5p_device_fimc2; 139extern struct platform_device s5p_device_fimc2;
137extern struct platform_device s5p_device_fimc3; 140extern struct platform_device s5p_device_fimc3;
138 141
142extern struct platform_device s5p_device_mfc;
143extern struct platform_device s5p_device_mfc_l;
144extern struct platform_device s5p_device_mfc_r;
139extern struct platform_device s5p_device_mipi_csis0; 145extern struct platform_device s5p_device_mipi_csis0;
140extern struct platform_device s5p_device_mipi_csis1; 146extern struct platform_device s5p_device_mipi_csis1;
141 147
diff --git a/arch/arm/plat-samsung/include/plat/fb-core.h b/arch/arm/plat-samsung/include/plat/fb-core.h
index bca383efcf6..6abcbf139ce 100644
--- a/arch/arm/plat-samsung/include/plat/fb-core.h
+++ b/arch/arm/plat-samsung/include/plat/fb-core.h
@@ -26,4 +26,19 @@ static inline void s3c_fb_setname(char *name)
26#endif 26#endif
27} 27}
28 28
29/* Re-define device name depending on support. */
30static inline void s5p_fb_setname(int id, char *name)
31{
32 switch (id) {
33#ifdef CONFIG_S5P_DEV_FIMD0
34 case 0:
35 s5p_device_fimd0.name = name;
36 break;
37#endif
38 default:
39 printk(KERN_ERR "%s: invalid device id(%d)\n", __func__, id);
40 break;
41 }
42}
43
29#endif /* __ASM_PLAT_FB_CORE_H */ 44#endif /* __ASM_PLAT_FB_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h
index cb3ca3adc68..01f10e4d00c 100644
--- a/arch/arm/plat-samsung/include/plat/fb.h
+++ b/arch/arm/plat-samsung/include/plat/fb.h
@@ -74,6 +74,14 @@ struct s3c_fb_platdata {
74extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd); 74extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd);
75 75
76/** 76/**
77 * s5p_fimd0_set_platdata() - Setup the FB device with platform data.
78 * @pd: The platform data to set. The data is copied from the passed structure
79 * so the machine data can mark the data __initdata so that any unused
80 * machines will end up dumping their data at runtime.
81 */
82extern void s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd);
83
84/**
77 * s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD 85 * s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD
78 * 86 *
79 * Initialise the GPIO for an 24bpp LCD display on the RGB interface. 87 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
@@ -94,4 +102,11 @@ extern void s5pc100_fb_gpio_setup_24bpp(void);
94 */ 102 */
95extern void s5pv210_fb_gpio_setup_24bpp(void); 103extern void s5pv210_fb_gpio_setup_24bpp(void);
96 104
105/**
106 * exynos4_fimd0_gpio_setup_24bpp() - Exynos4 setup function for 24bpp LCD0
107 *
108 * Initialise the GPIO for an 24bpp LCD display on the RGB interface 0.
109 */
110extern void exynos4_fimd0_gpio_setup_24bpp(void);
111
97#endif /* __PLAT_S3C_FB_H */ 112#endif /* __PLAT_S3C_FB_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-adc.h b/arch/arm/plat-samsung/include/plat/regs-adc.h
index 7554c4fcddb..035e8c38d69 100644
--- a/arch/arm/plat-samsung/include/plat/regs-adc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-adc.h
@@ -21,6 +21,7 @@
21#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) 21#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10)
22#define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) 22#define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14)
23#define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) 23#define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18)
24#define S5P_ADCMUX S3C2410_ADCREG(0x1C)
24#define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) 25#define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20)
25 26
26 27
diff --git a/arch/arm/plat-samsung/irq-uart.c b/arch/arm/plat-samsung/irq-uart.c
index 657405c481d..3014c7226bd 100644
--- a/arch/arm/plat-samsung/irq-uart.c
+++ b/arch/arm/plat-samsung/irq-uart.c
@@ -19,6 +19,8 @@
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <asm/mach/irq.h>
23
22#include <mach/map.h> 24#include <mach/map.h>
23#include <plat/irq-uart.h> 25#include <plat/irq-uart.h>
24#include <plat/regs-serial.h> 26#include <plat/regs-serial.h>
@@ -30,9 +32,12 @@
30static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc) 32static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
31{ 33{
32 struct s3c_uart_irq *uirq = desc->irq_data.handler_data; 34 struct s3c_uart_irq *uirq = desc->irq_data.handler_data;
35 struct irq_chip *chip = irq_get_chip(irq);
33 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP); 36 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP);
34 int base = uirq->base_irq; 37 int base = uirq->base_irq;
35 38
39 chained_irq_enter(chip, desc);
40
36 if (pend & (1 << 0)) 41 if (pend & (1 << 0))
37 generic_handle_irq(base); 42 generic_handle_irq(base);
38 if (pend & (1 << 1)) 43 if (pend & (1 << 1))
@@ -41,6 +46,8 @@ static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
41 generic_handle_irq(base + 2); 46 generic_handle_irq(base + 2);
42 if (pend & (1 << 3)) 47 if (pend & (1 << 3))
43 generic_handle_irq(base + 3); 48 generic_handle_irq(base + 3);
49
50 chained_irq_exit(chip, desc);
44} 51}
45 52
46static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq) 53static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
index f714d060370..51583cd3016 100644
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ b/arch/arm/plat-samsung/irq-vic-timer.c
@@ -22,9 +22,14 @@
22#include <plat/irq-vic-timer.h> 22#include <plat/irq-vic-timer.h>
23#include <plat/regs-timer.h> 23#include <plat/regs-timer.h>
24 24
25#include <asm/mach/irq.h>
26
25static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc) 27static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc)
26{ 28{
29 struct irq_chip *chip = irq_get_chip(irq);
30 chained_irq_enter(chip, desc);
27 generic_handle_irq((int)desc->irq_data.handler_data); 31 generic_handle_irq((int)desc->irq_data.handler_data);
32 chained_irq_exit(chip, desc);
28} 33}
29 34
30/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */ 35/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 5fa1742d019..ae6f99834cd 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -269,6 +269,7 @@ static int s3c_pm_enter(suspend_state_t state)
269 /* save all necessary core registers not covered by the drivers */ 269 /* save all necessary core registers not covered by the drivers */
270 270
271 s3c_pm_save_gpios(); 271 s3c_pm_save_gpios();
272 s3c_pm_saved_gpios();
272 s3c_pm_save_uarts(); 273 s3c_pm_save_uarts();
273 s3c_pm_save_core(); 274 s3c_pm_save_core();
274 275
@@ -306,6 +307,7 @@ static int s3c_pm_enter(suspend_state_t state)
306 s3c_pm_restore_core(); 307 s3c_pm_restore_core();
307 s3c_pm_restore_uarts(); 308 s3c_pm_restore_uarts();
308 s3c_pm_restore_gpios(); 309 s3c_pm_restore_gpios();
310 s3c_pm_restored_gpios();
309 311
310 s3c_pm_debug_init(); 312 s3c_pm_debug_init();
311 313
diff --git a/arch/arm/plat-spear/include/plat/clkdev.h b/arch/arm/plat-spear/include/plat/clkdev.h
deleted file mode 100644
index a2d0112fcaf..00000000000
--- a/arch/arm/plat-spear/include/plat/clkdev.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * arch/arm/plat-spear/include/plat/clkdev.h
3 *
4 * Clock Dev framework definitions for SPEAr platform
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_CLKDEV_H
15#define __PLAT_CLKDEV_H
16
17#define __clk_get(clk) ({ 1; })
18#define __clk_put(clk) do { } while (0)
19
20#endif /* __PLAT_CLKDEV_H */
diff --git a/arch/arm/plat-tcc/include/mach/clkdev.h b/arch/arm/plat-tcc/include/mach/clkdev.h
deleted file mode 100644
index 04b37a89801..00000000000
--- a/arch/arm/plat-tcc/include/mach/clkdev.h
+++ /dev/null
@@ -1,7 +0,0 @@
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/tools/mach-types b/arch/arm/tools/mach-types
index 3b3776d0a1a..62cc8f98117 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -351,7 +351,7 @@ centro MACH_CENTRO CENTRO 1944
351nokia_rx51 MACH_NOKIA_RX51 NOKIA_RX51 1955 351nokia_rx51 MACH_NOKIA_RX51 NOKIA_RX51 1955
352omap_zoom2 MACH_OMAP_ZOOM2 OMAP_ZOOM2 1967 352omap_zoom2 MACH_OMAP_ZOOM2 OMAP_ZOOM2 1967
353cpuat9260 MACH_CPUAT9260 CPUAT9260 1973 353cpuat9260 MACH_CPUAT9260 CPUAT9260 1973
354eukrea_cpuimx27 MACH_CPUIMX27 CPUIMX27 1975 354eukrea_cpuimx27 MACH_EUKREA_CPUIMX27 EUKREA_CPUIMX27 1975
355acs5k MACH_ACS5K ACS5K 1982 355acs5k MACH_ACS5K ACS5K 1982
356snapper_9260 MACH_SNAPPER_9260 SNAPPER_9260 1987 356snapper_9260 MACH_SNAPPER_9260 SNAPPER_9260 1987
357dsm320 MACH_DSM320 DSM320 1988 357dsm320 MACH_DSM320 DSM320 1988
@@ -476,8 +476,8 @@ cns3420vb MACH_CNS3420VB CNS3420VB 2776
476omap4_panda MACH_OMAP4_PANDA OMAP4_PANDA 2791 476omap4_panda MACH_OMAP4_PANDA OMAP4_PANDA 2791
477ti8168evm MACH_TI8168EVM TI8168EVM 2800 477ti8168evm MACH_TI8168EVM TI8168EVM 2800
478teton_bga MACH_TETON_BGA TETON_BGA 2816 478teton_bga MACH_TETON_BGA TETON_BGA 2816
479eukrea_cpuimx25sd MACH_EUKREA_CPUIMX25 EUKREA_CPUIMX25 2820 479eukrea_cpuimx25sd MACH_EUKREA_CPUIMX25SD EUKREA_CPUIMX25SD 2820
480eukrea_cpuimx35sd MACH_EUKREA_CPUIMX35 EUKREA_CPUIMX35 2821 480eukrea_cpuimx35sd MACH_EUKREA_CPUIMX35SD EUKREA_CPUIMX35SD 2821
481eukrea_cpuimx51sd MACH_EUKREA_CPUIMX51SD EUKREA_CPUIMX51SD 2822 481eukrea_cpuimx51sd MACH_EUKREA_CPUIMX51SD EUKREA_CPUIMX51SD 2822
482eukrea_cpuimx51 MACH_EUKREA_CPUIMX51 EUKREA_CPUIMX51 2823 482eukrea_cpuimx51 MACH_EUKREA_CPUIMX51 EUKREA_CPUIMX51 2823
483smdkc210 MACH_SMDKC210 SMDKC210 2838 483smdkc210 MACH_SMDKC210 SMDKC210 2838
@@ -910,7 +910,7 @@ omapl138_case_a3 MACH_OMAPL138_CASE_A3 OMAPL138_CASE_A3 3280
910uemd MACH_UEMD UEMD 3281 910uemd MACH_UEMD UEMD 3281
911ccwmx51mut MACH_CCWMX51MUT CCWMX51MUT 3282 911ccwmx51mut MACH_CCWMX51MUT CCWMX51MUT 3282
912rockhopper MACH_ROCKHOPPER ROCKHOPPER 3283 912rockhopper MACH_ROCKHOPPER ROCKHOPPER 3283
913nookcolor MACH_NOOKCOLOR NOOKCOLOR 3284 913encore MACH_ENCORE ENCORE 3284
914hkdkc100 MACH_HKDKC100 HKDKC100 3285 914hkdkc100 MACH_HKDKC100 HKDKC100 3285
915ts42xx MACH_TS42XX TS42XX 3286 915ts42xx MACH_TS42XX TS42XX 3286
916aebl MACH_AEBL AEBL 3287 916aebl MACH_AEBL AEBL 3287
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index e9d689b7c83..197e96f7040 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -10,6 +10,7 @@ config AVR32
10 select GENERIC_IRQ_PROBE 10 select GENERIC_IRQ_PROBE
11 select HARDIRQS_SW_RESEND 11 select HARDIRQS_SW_RESEND
12 select GENERIC_IRQ_SHOW 12 select GENERIC_IRQ_SHOW
13 select ARCH_HAVE_NMI_SAFE_CMPXCHG
13 help 14 help
14 AVR32 is a high-performance 32-bit RISC microprocessor core, 15 AVR32 is a high-performance 32-bit RISC microprocessor core,
15 designed for cost-sensitive embedded applications, with particular 16 designed for cost-sensitive embedded applications, with particular
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h
index bbce6a1c6bb..e0ac2631c87 100644
--- a/arch/avr32/include/asm/atomic.h
+++ b/arch/avr32/include/asm/atomic.h
@@ -78,70 +78,63 @@ static inline int atomic_add_return(int i, atomic_t *v)
78/* 78/*
79 * atomic_sub_unless - sub unless the number is a given value 79 * atomic_sub_unless - sub unless the number is a given value
80 * @v: pointer of type atomic_t 80 * @v: pointer of type atomic_t
81 * @a: the amount to add to v... 81 * @a: the amount to subtract from v...
82 * @u: ...unless v is equal to u. 82 * @u: ...unless v is equal to u.
83 * 83 *
84 * If the atomic value v is not equal to u, this function subtracts a 84 * Atomically subtract @a from @v, so long as it was not @u.
85 * from v, and returns non zero. If v is equal to u then it returns 85 * Returns the old value of @v.
86 * zero. This is done as an atomic operation.
87*/ 86*/
88static inline int atomic_sub_unless(atomic_t *v, int a, int u) 87static inline void atomic_sub_unless(atomic_t *v, int a, int u)
89{ 88{
90 int tmp, result = 0; 89 int tmp;
91 90
92 asm volatile( 91 asm volatile(
93 "/* atomic_sub_unless */\n" 92 "/* atomic_sub_unless */\n"
94 "1: ssrf 5\n" 93 "1: ssrf 5\n"
95 " ld.w %0, %3\n" 94 " ld.w %0, %2\n"
96 " cp.w %0, %5\n" 95 " cp.w %0, %4\n"
97 " breq 1f\n" 96 " breq 1f\n"
98 " sub %0, %4\n" 97 " sub %0, %3\n"
99 " stcond %2, %0\n" 98 " stcond %1, %0\n"
100 " brne 1b\n" 99 " brne 1b\n"
101 " mov %1, 1\n"
102 "1:" 100 "1:"
103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 101 : "=&r"(tmp), "=o"(v->counter)
104 : "m"(v->counter), "rKs21"(a), "rKs21"(u), "1"(result) 102 : "m"(v->counter), "rKs21"(a), "rKs21"(u)
105 : "cc", "memory"); 103 : "cc", "memory");
106
107 return result;
108} 104}
109 105
110/* 106/*
111 * atomic_add_unless - add unless the number is a given value 107 * __atomic_add_unless - add unless the number is a given value
112 * @v: pointer of type atomic_t 108 * @v: pointer of type atomic_t
113 * @a: the amount to add to v... 109 * @a: the amount to add to v...
114 * @u: ...unless v is equal to u. 110 * @u: ...unless v is equal to u.
115 * 111 *
116 * If the atomic value v is not equal to u, this function adds a to v, 112 * Atomically adds @a to @v, so long as it was not @u.
117 * and returns non zero. If v is equal to u then it returns zero. This 113 * Returns the old value of @v.
118 * is done as an atomic operation.
119*/ 114*/
120static inline int atomic_add_unless(atomic_t *v, int a, int u) 115static inline int __atomic_add_unless(atomic_t *v, int a, int u)
121{ 116{
122 int tmp, result; 117 int tmp, old = atomic_read(v);
123 118
124 if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576)) 119 if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576))
125 result = atomic_sub_unless(v, -a, u); 120 atomic_sub_unless(v, -a, u);
126 else { 121 else {
127 result = 0;
128 asm volatile( 122 asm volatile(
129 "/* atomic_add_unless */\n" 123 "/* __atomic_add_unless */\n"
130 "1: ssrf 5\n" 124 "1: ssrf 5\n"
131 " ld.w %0, %3\n" 125 " ld.w %0, %2\n"
132 " cp.w %0, %5\n" 126 " cp.w %0, %4\n"
133 " breq 1f\n" 127 " breq 1f\n"
134 " add %0, %4\n" 128 " add %0, %3\n"
135 " stcond %2, %0\n" 129 " stcond %1, %0\n"
136 " brne 1b\n" 130 " brne 1b\n"
137 " mov %1, 1\n"
138 "1:" 131 "1:"
139 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 132 : "=&r"(tmp), "=o"(v->counter)
140 : "m"(v->counter), "r"(a), "ir"(u), "1"(result) 133 : "m"(v->counter), "r"(a), "ir"(u)
141 : "cc", "memory"); 134 : "cc", "memory");
142 } 135 }
143 136
144 return result; 137 return old;
145} 138}
146 139
147/* 140/*
@@ -188,7 +181,6 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)
188#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) 181#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
189#define atomic_add_negative(i, v) (atomic_add_return(i, v) < 0) 182#define atomic_add_negative(i, v) (atomic_add_return(i, v) < 0)
190 183
191#define atomic_inc_not_zero(v) atomic_add_unless(v, 1, 0)
192#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v) 184#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
193 185
194#define smp_mb__before_atomic_dec() barrier() 186#define smp_mb__before_atomic_dec() barrier()
@@ -196,6 +188,4 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)
196#define smp_mb__before_atomic_inc() barrier() 188#define smp_mb__before_atomic_inc() barrier()
197#define smp_mb__after_atomic_inc() barrier() 189#define smp_mb__after_atomic_inc() barrier()
198 190
199#include <asm-generic/atomic-long.h>
200
201#endif /* __ASM_AVR32_ATOMIC_H */ 191#endif /* __ASM_AVR32_ATOMIC_H */
diff --git a/arch/avr32/include/asm/ptrace.h b/arch/avr32/include/asm/ptrace.h
index e53dd0d900f..c67a007f672 100644
--- a/arch/avr32/include/asm/ptrace.h
+++ b/arch/avr32/include/asm/ptrace.h
@@ -132,8 +132,6 @@ struct pt_regs {
132#define instruction_pointer(regs) ((regs)->pc) 132#define instruction_pointer(regs) ((regs)->pc)
133#define profile_pc(regs) instruction_pointer(regs) 133#define profile_pc(regs) instruction_pointer(regs)
134 134
135extern void show_regs (struct pt_regs *);
136
137static __inline__ int valid_user_regs(struct pt_regs *regs) 135static __inline__ int valid_user_regs(struct pt_regs *regs)
138{ 136{
139 /* 137 /*
diff --git a/arch/avr32/kernel/syscall_table.S b/arch/avr32/kernel/syscall_table.S
index c7fd394d28a..6eba53530d1 100644
--- a/arch/avr32/kernel/syscall_table.S
+++ b/arch/avr32/kernel/syscall_table.S
@@ -158,7 +158,7 @@ sys_call_table:
158 .long sys_sched_rr_get_interval 158 .long sys_sched_rr_get_interval
159 .long sys_nanosleep 159 .long sys_nanosleep
160 .long sys_poll 160 .long sys_poll
161 .long sys_nfsservctl /* 145 */ 161 .long sys_ni_syscall /* 145 was nfsservctl */
162 .long sys_setresgid 162 .long sys_setresgid
163 .long sys_getresgid 163 .long sys_getresgid
164 .long sys_prctl 164 .long sys_prctl
diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h
index 4c707dbe1ff..135225696fd 100644
--- a/arch/blackfin/include/asm/atomic.h
+++ b/arch/blackfin/include/asm/atomic.h
@@ -89,15 +89,14 @@ static inline void atomic_set_mask(int mask, atomic_t *v)
89#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 89#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
90#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 90#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
91 91
92#define atomic_add_unless(v, a, u) \ 92#define __atomic_add_unless(v, a, u) \
93({ \ 93({ \
94 int c, old; \ 94 int c, old; \
95 c = atomic_read(v); \ 95 c = atomic_read(v); \
96 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 96 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
97 c = old; \ 97 c = old; \
98 c != (u); \ 98 c; \
99}) 99})
100#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
101 100
102/* 101/*
103 * atomic_inc_and_test - increment and test 102 * atomic_inc_and_test - increment and test
@@ -112,10 +111,7 @@ static inline void atomic_set_mask(int mask, atomic_t *v)
112#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) 111#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
113#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) 112#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
114 113
115#include <asm-generic/atomic-long.h>
116 114
117#endif 115#endif
118 116
119#include <asm-generic/atomic64.h>
120
121#endif 117#endif
diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h
index d9dbc1a5353..dac0c97242b 100644
--- a/arch/blackfin/include/asm/dma.h
+++ b/arch/blackfin/include/asm/dma.h
@@ -10,7 +10,7 @@
10 10
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <mach/dma.h> 12#include <mach/dma.h>
13#include <asm/atomic.h> 13#include <linux/atomic.h>
14#include <asm/blackfin.h> 14#include <asm/blackfin.h>
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm-generic/dma.h> 16#include <asm-generic/dma.h>
diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h
index 9e0cc0e2534..17b5e92e3bc 100644
--- a/arch/blackfin/include/asm/ipipe.h
+++ b/arch/blackfin/include/asm/ipipe.h
@@ -32,7 +32,7 @@
32#include <asm/ptrace.h> 32#include <asm/ptrace.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/bitops.h> 34#include <asm/bitops.h>
35#include <asm/atomic.h> 35#include <linux/atomic.h>
36#include <asm/traps.h> 36#include <asm/traps.h>
37#include <asm/bitsperlong.h> 37#include <asm/bitsperlong.h>
38 38
diff --git a/arch/blackfin/include/asm/ptrace.h b/arch/blackfin/include/asm/ptrace.h
index 7854d4367c1..10d8641180f 100644
--- a/arch/blackfin/include/asm/ptrace.h
+++ b/arch/blackfin/include/asm/ptrace.h
@@ -102,7 +102,6 @@ struct pt_regs {
102/* user_mode returns true if only one bit is set in IPEND, other than the 102/* user_mode returns true if only one bit is set in IPEND, other than the
103 master interrupt enable. */ 103 master interrupt enable. */
104#define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1))) 104#define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1)))
105extern void show_regs(struct pt_regs *);
106 105
107#define arch_has_single_step() (1) 106#define arch_has_single_step() (1)
108/* common code demands this function */ 107/* common code demands this function */
diff --git a/arch/blackfin/include/asm/spinlock.h b/arch/blackfin/include/asm/spinlock.h
index 2336093fca2..490c7caa02d 100644
--- a/arch/blackfin/include/asm/spinlock.h
+++ b/arch/blackfin/include/asm/spinlock.h
@@ -11,7 +11,7 @@
11# include <asm-generic/spinlock.h> 11# include <asm-generic/spinlock.h>
12#else 12#else
13 13
14#include <asm/atomic.h> 14#include <linux/atomic.h>
15 15
16asmlinkage int __raw_spin_is_locked_asm(volatile int *ptr); 16asmlinkage int __raw_spin_is_locked_asm(volatile int *ptr);
17asmlinkage void __raw_spin_lock_asm(volatile int *ptr); 17asmlinkage void __raw_spin_lock_asm(volatile int *ptr);
diff --git a/arch/blackfin/kernel/ftrace.c b/arch/blackfin/kernel/ftrace.c
index 48808a12b42..9277905b82c 100644
--- a/arch/blackfin/kernel/ftrace.c
+++ b/arch/blackfin/kernel/ftrace.c
@@ -9,7 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/uaccess.h> 11#include <linux/uaccess.h>
12#include <asm/atomic.h> 12#include <linux/atomic.h>
13#include <asm/cacheflush.h> 13#include <asm/cacheflush.h>
14 14
15#ifdef CONFIG_DYNAMIC_FTRACE 15#ifdef CONFIG_DYNAMIC_FTRACE
diff --git a/arch/blackfin/kernel/ipipe.c b/arch/blackfin/kernel/ipipe.c
index 486426f8a0d..dbe11220cc5 100644
--- a/arch/blackfin/kernel/ipipe.c
+++ b/arch/blackfin/kernel/ipipe.c
@@ -32,7 +32,7 @@
32#include <linux/unistd.h> 32#include <linux/unistd.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/atomic.h> 35#include <linux/atomic.h>
36#include <asm/irq_handler.h> 36#include <asm/irq_handler.h>
37 37
38DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs); 38DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
diff --git a/arch/blackfin/kernel/nmi.c b/arch/blackfin/kernel/nmi.c
index 679d0db3525..9919d29287d 100644
--- a/arch/blackfin/kernel/nmi.c
+++ b/arch/blackfin/kernel/nmi.c
@@ -18,7 +18,7 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <asm/blackfin.h> 20#include <asm/blackfin.h>
21#include <asm/atomic.h> 21#include <linux/atomic.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/bfin_watchdog.h> 23#include <asm/bfin_watchdog.h>
24 24
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 225d311c970..e4137297b79 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -1543,7 +1543,7 @@ ENTRY(_sys_call_table)
1543 .long _sys_ni_syscall /* for vm86 */ 1543 .long _sys_ni_syscall /* for vm86 */
1544 .long _sys_ni_syscall /* old "query_module" */ 1544 .long _sys_ni_syscall /* old "query_module" */
1545 .long _sys_ni_syscall /* sys_poll */ 1545 .long _sys_ni_syscall /* sys_poll */
1546 .long _sys_nfsservctl 1546 .long _sys_ni_syscall /* old nfsservctl */
1547 .long _sys_setresgid /* setresgid16 */ /* 170 */ 1547 .long _sys_setresgid /* setresgid16 */ /* 170 */
1548 .long _sys_getresgid /* getresgid16 */ 1548 .long _sys_getresgid /* getresgid16 */
1549 .long _sys_prctl 1549 .long _sys_prctl
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 1c143a4de5f..107622aacf6 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -23,7 +23,7 @@
23#include <linux/seq_file.h> 23#include <linux/seq_file.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <asm/atomic.h> 26#include <linux/atomic.h>
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28#include <asm/irq_handler.h> 28#include <asm/irq_handler.h>
29#include <asm/mmu_context.h> 29#include <asm/mmu_context.h>
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
index 85026537361..466af40c582 100644
--- a/arch/cris/arch-v10/drivers/sync_serial.c
+++ b/arch/cris/arch-v10/drivers/sync_serial.c
@@ -158,7 +158,7 @@ static int sync_serial_open(struct inode *inode, struct file *file);
158static int sync_serial_release(struct inode *inode, struct file *file); 158static int sync_serial_release(struct inode *inode, struct file *file);
159static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); 159static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
160 160
161static int sync_serial_ioctl(struct file *file, 161static long sync_serial_ioctl(struct file *file,
162 unsigned int cmd, unsigned long arg); 162 unsigned int cmd, unsigned long arg);
163static ssize_t sync_serial_write(struct file *file, const char *buf, 163static ssize_t sync_serial_write(struct file *file, const char *buf,
164 size_t count, loff_t *ppos); 164 size_t count, loff_t *ppos);
@@ -625,11 +625,11 @@ static int sync_serial_open(struct inode *inode, struct file *file)
625 *R_IRQ_MASK1_SET = 1 << port->data_avail_bit; 625 *R_IRQ_MASK1_SET = 1 << port->data_avail_bit;
626 DEBUG(printk(KERN_DEBUG "sser%d rec started\n", dev)); 626 DEBUG(printk(KERN_DEBUG "sser%d rec started\n", dev));
627 } 627 }
628 ret = 0; 628 err = 0;
629 629
630out: 630out:
631 mutex_unlock(&sync_serial_mutex); 631 mutex_unlock(&sync_serial_mutex);
632 return ret; 632 return err;
633} 633}
634 634
635static int sync_serial_release(struct inode *inode, struct file *file) 635static int sync_serial_release(struct inode *inode, struct file *file)
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index 1161883eb58..592fbe9dfb6 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -771,7 +771,7 @@ sys_call_table:
771 .long sys_ni_syscall /* sys_vm86 */ 771 .long sys_ni_syscall /* sys_vm86 */
772 .long sys_ni_syscall /* Old sys_query_module */ 772 .long sys_ni_syscall /* Old sys_query_module */
773 .long sys_poll 773 .long sys_poll
774 .long sys_nfsservctl 774 .long sys_ni_syscall /* old nfsservctl */
775 .long sys_setresgid16 /* 170 */ 775 .long sys_setresgid16 /* 170 */
776 .long sys_getresgid16 776 .long sys_getresgid16
777 .long sys_prctl 777 .long sys_prctl
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index 907cfb5a873..ba0e5965d6e 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -20,6 +20,9 @@
20#define crisv10_mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr)); 20#define crisv10_mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
21#define crisv10_unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr)); 21#define crisv10_unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
22 22
23extern void kgdb_init(void);
24extern void breakpoint(void);
25
23/* don't use set_int_vector, it bypasses the linux interrupt handlers. it is 26/* don't use set_int_vector, it bypasses the linux interrupt handlers. it is
24 * global just so that the kernel gdb can use it. 27 * global just so that the kernel gdb can use it.
25 */ 28 */
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index c03bc3bc30c..642c6fed43d 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -16,7 +16,7 @@
16 16
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20 20
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index 84fed7e91ad..c3ea4694fba 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -714,7 +714,7 @@ sys_call_table:
714 .long sys_ni_syscall /* sys_vm86 */ 714 .long sys_ni_syscall /* sys_vm86 */
715 .long sys_ni_syscall /* Old sys_query_module */ 715 .long sys_ni_syscall /* Old sys_query_module */
716 .long sys_poll 716 .long sys_poll
717 .long sys_nfsservctl 717 .long sys_ni_syscall /* Old nfsservctl */
718 .long sys_setresgid16 /* 170 */ 718 .long sys_setresgid16 /* 170 */
719 .long sys_getresgid16 719 .long sys_getresgid16
720 .long sys_prctl 720 .long sys_prctl
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index a0843a71aae..0b99df72d2a 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -7,7 +7,7 @@
7#include <asm/mmu_context.h> 7#include <asm/mmu_context.h>
8#include <hwregs/asm/mmu_defs_asm.h> 8#include <hwregs/asm/mmu_defs_asm.h>
9#include <hwregs/supp_reg.h> 9#include <hwregs/supp_reg.h>
10#include <asm/atomic.h> 10#include <linux/atomic.h>
11 11
12#include <linux/err.h> 12#include <linux/err.h>
13#include <linux/init.h> 13#include <linux/init.h>
diff --git a/arch/cris/include/arch-v10/arch/ptrace.h b/arch/cris/include/arch-v10/arch/ptrace.h
index 2f464eab3a5..1a232739565 100644
--- a/arch/cris/include/arch-v10/arch/ptrace.h
+++ b/arch/cris/include/arch-v10/arch/ptrace.h
@@ -112,7 +112,6 @@ struct switch_stack {
112#define user_mode(regs) (((regs)->dccr & 0x100) != 0) 112#define user_mode(regs) (((regs)->dccr & 0x100) != 0)
113#define instruction_pointer(regs) ((regs)->irp) 113#define instruction_pointer(regs) ((regs)->irp)
114#define profile_pc(regs) instruction_pointer(regs) 114#define profile_pc(regs) instruction_pointer(regs)
115extern void show_regs(struct pt_regs *);
116 115
117#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
118 117
diff --git a/arch/cris/include/arch-v32/arch/ptrace.h b/arch/cris/include/arch-v32/arch/ptrace.h
index ffca8d0f2e1..19773d3bd4c 100644
--- a/arch/cris/include/arch-v32/arch/ptrace.h
+++ b/arch/cris/include/arch-v32/arch/ptrace.h
@@ -111,7 +111,6 @@ struct switch_stack {
111#define arch_has_single_step() (1) 111#define arch_has_single_step() (1)
112#define user_mode(regs) (((regs)->ccs & (1 << (U_CCS_BITNR + CCS_SHIFT))) != 0) 112#define user_mode(regs) (((regs)->ccs & (1 << (U_CCS_BITNR + CCS_SHIFT))) != 0)
113#define instruction_pointer(regs) ((regs)->erp) 113#define instruction_pointer(regs) ((regs)->erp)
114extern void show_regs(struct pt_regs *);
115#define profile_pc(regs) instruction_pointer(regs) 114#define profile_pc(regs) instruction_pointer(regs)
116 115
117#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
diff --git a/arch/cris/include/asm/atomic.h b/arch/cris/include/asm/atomic.h
index 88dc9b9c4ba..bbf093814db 100644
--- a/arch/cris/include/asm/atomic.h
+++ b/arch/cris/include/asm/atomic.h
@@ -138,7 +138,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
138 138
139#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 139#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
140 140
141static inline int atomic_add_unless(atomic_t *v, int a, int u) 141static inline int __atomic_add_unless(atomic_t *v, int a, int u)
142{ 142{
143 int ret; 143 int ret;
144 unsigned long flags; 144 unsigned long flags;
@@ -148,9 +148,8 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
148 if (ret != u) 148 if (ret != u)
149 v->counter += a; 149 v->counter += a;
150 cris_atomic_restore(v, flags); 150 cris_atomic_restore(v, flags);
151 return ret != u; 151 return ret;
152} 152}
153#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
154 153
155/* Atomic operations are already serializing */ 154/* Atomic operations are already serializing */
156#define smp_mb__before_atomic_dec() barrier() 155#define smp_mb__before_atomic_dec() barrier()
@@ -158,5 +157,4 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
158#define smp_mb__before_atomic_inc() barrier() 157#define smp_mb__before_atomic_inc() barrier()
159#define smp_mb__after_atomic_inc() barrier() 158#define smp_mb__after_atomic_inc() barrier()
160 159
161#include <asm-generic/atomic-long.h>
162#endif 160#endif
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h
index 310e0de67aa..a78a2d70cd8 100644
--- a/arch/cris/include/asm/bitops.h
+++ b/arch/cris/include/asm/bitops.h
@@ -20,7 +20,7 @@
20 20
21#include <arch/bitops.h> 21#include <arch/bitops.h>
22#include <asm/system.h> 22#include <asm/system.h>
23#include <asm/atomic.h> 23#include <linux/atomic.h>
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25 25
26/* 26/*
@@ -156,8 +156,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
156 156
157#include <asm-generic/bitops/le.h> 157#include <asm-generic/bitops/le.h>
158 158
159#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 159#include <asm-generic/bitops/ext2-atomic-setbit.h>
160#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
161 160
162#include <asm-generic/bitops/sched.h> 161#include <asm-generic/bitops/sched.h>
163 162
diff --git a/arch/cris/include/asm/serial.h b/arch/cris/include/asm/serial.h
new file mode 100644
index 00000000000..af7535a955f
--- /dev/null
+++ b/arch/cris/include/asm/serial.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_SERIAL_H
2#define _ASM_SERIAL_H
3
4/*
5 * This assumes you have a 1.8432 MHz clock for your UART.
6 */
7#define BASE_BAUD (1843200 / 16)
8
9#endif /* _ASM_SERIAL_H */
diff --git a/arch/cris/include/asm/thread_info.h b/arch/cris/include/asm/thread_info.h
index 29b74a10583..332f19c5455 100644
--- a/arch/cris/include/asm/thread_info.h
+++ b/arch/cris/include/asm/thread_info.h
@@ -11,8 +11,6 @@
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13 13
14#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
15
16#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
17#include <asm/types.h> 15#include <asm/types.h>
18#include <asm/processor.h> 16#include <asm/processor.h>
@@ -67,8 +65,10 @@ struct thread_info {
67 65
68#define init_thread_info (init_thread_union.thread_info) 66#define init_thread_info (init_thread_union.thread_info)
69 67
68#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
70/* thread information allocation */ 69/* thread information allocation */
71#define alloc_thread_info(tsk, node) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 70#define alloc_thread_info_node(tsk, node) \
71 ((struct thread_info *) __get_free_pages(GFP_KERNEL, 1))
72#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 72#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
73 73
74#endif /* !__ASSEMBLY__ */ 74#endif /* !__ASSEMBLY__ */
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index c99aeab7cef..aa585e4e979 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -12,7 +12,7 @@
12 * This file handles the architecture-dependent parts of process handling.. 12 * This file handles the architecture-dependent parts of process handling..
13 */ 13 */
14 14
15#include <asm/atomic.h> 15#include <linux/atomic.h>
16#include <asm/pgtable.h> 16#include <asm/pgtable.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/irq.h> 18#include <asm/irq.h>
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index cb884e48942..bad27a6ff40 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -7,6 +7,7 @@ config FRV
7 select HAVE_PERF_EVENTS 7 select HAVE_PERF_EVENTS
8 select HAVE_GENERIC_HARDIRQS 8 select HAVE_GENERIC_HARDIRQS
9 select GENERIC_IRQ_SHOW 9 select GENERIC_IRQ_SHOW
10 select ARCH_HAVE_NMI_SAFE_CMPXCHG
10 11
11config ZONE_DMA 12config ZONE_DMA
12 bool 13 bool
diff --git a/arch/frv/include/asm/atomic.h b/arch/frv/include/asm/atomic.h
index fae32c7fdcb..0d8a7d66174 100644
--- a/arch/frv/include/asm/atomic.h
+++ b/arch/frv/include/asm/atomic.h
@@ -241,7 +241,7 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v);
241#define atomic64_cmpxchg(v, old, new) (__cmpxchg_64(old, new, &(v)->counter)) 241#define atomic64_cmpxchg(v, old, new) (__cmpxchg_64(old, new, &(v)->counter))
242#define atomic64_xchg(v, new) (__xchg_64(new, &(v)->counter)) 242#define atomic64_xchg(v, new) (__xchg_64(new, &(v)->counter))
243 243
244static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 244static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
245{ 245{
246 int c, old; 246 int c, old;
247 c = atomic_read(v); 247 c = atomic_read(v);
@@ -253,10 +253,8 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
253 break; 253 break;
254 c = old; 254 c = old;
255 } 255 }
256 return c != (u); 256 return c;
257} 257}
258 258
259#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
260 259
261#include <asm-generic/atomic-long.h>
262#endif /* _ASM_ATOMIC_H */ 260#endif /* _ASM_ATOMIC_H */
diff --git a/arch/frv/include/asm/bitops.h b/arch/frv/include/asm/bitops.h
index a1d00b0c6ed..57bf85db893 100644
--- a/arch/frv/include/asm/bitops.h
+++ b/arch/frv/include/asm/bitops.h
@@ -403,8 +403,7 @@ int __ilog2_u64(u64 n)
403 403
404#include <asm-generic/bitops/le.h> 404#include <asm-generic/bitops/le.h>
405 405
406#define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr)) 406#include <asm-generic/bitops/ext2-atomic-setbit.h>
407#define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr))
408 407
409#endif /* __KERNEL__ */ 408#endif /* __KERNEL__ */
410 409
diff --git a/arch/frv/include/asm/hardirq.h b/arch/frv/include/asm/hardirq.h
index 5fc8b6f5bc5..c62833d6ebb 100644
--- a/arch/frv/include/asm/hardirq.h
+++ b/arch/frv/include/asm/hardirq.h
@@ -12,7 +12,7 @@
12#ifndef __ASM_HARDIRQ_H 12#ifndef __ASM_HARDIRQ_H
13#define __ASM_HARDIRQ_H 13#define __ASM_HARDIRQ_H
14 14
15#include <asm/atomic.h> 15#include <linux/atomic.h>
16 16
17extern atomic_t irq_err_count; 17extern atomic_t irq_err_count;
18static inline void ack_bad_irq(int irq) 18static inline void ack_bad_irq(int irq)
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h
index 4b789ab182b..81c2e271d62 100644
--- a/arch/frv/include/asm/processor.h
+++ b/arch/frv/include/asm/processor.h
@@ -97,7 +97,6 @@ extern struct task_struct *__kernel_current_task;
97 */ 97 */
98#define start_thread(_regs, _pc, _usp) \ 98#define start_thread(_regs, _pc, _usp) \
99do { \ 99do { \
100 set_fs(USER_DS); /* reads from user space */ \
101 __frame = __kernel_frame0_ptr; \ 100 __frame = __kernel_frame0_ptr; \
102 __frame->pc = (_pc); \ 101 __frame->pc = (_pc); \
103 __frame->psr &= ~PSR_S; \ 102 __frame->psr &= ~PSR_S; \
diff --git a/arch/frv/include/asm/ptrace.h b/arch/frv/include/asm/ptrace.h
index 6bfad4cf190..ef6635ca4ec 100644
--- a/arch/frv/include/asm/ptrace.h
+++ b/arch/frv/include/asm/ptrace.h
@@ -78,7 +78,6 @@ register struct pt_regs *__frame asm("gr28");
78#define user_stack_pointer(regs) ((regs)->sp) 78#define user_stack_pointer(regs) ((regs)->sp)
79 79
80extern unsigned long user_stack(const struct pt_regs *); 80extern unsigned long user_stack(const struct pt_regs *);
81extern void show_regs(struct pt_regs *);
82#define profile_pc(regs) ((regs)->pc) 81#define profile_pc(regs) ((regs)->pc)
83 82
84#define task_pt_regs(task) ((task)->thread.frame0) 83#define task_pt_regs(task) ((task)->thread.frame0)
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 017d6d7b784..5ba23f715ea 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -1358,7 +1358,7 @@ sys_call_table:
1358 .long sys_ni_syscall /* for vm86 */ 1358 .long sys_ni_syscall /* for vm86 */
1359 .long sys_ni_syscall /* Old sys_query_module */ 1359 .long sys_ni_syscall /* Old sys_query_module */
1360 .long sys_poll 1360 .long sys_poll
1361 .long sys_nfsservctl 1361 .long sys_ni_syscall /* Old nfsservctl */
1362 .long sys_setresgid16 /* 170 */ 1362 .long sys_setresgid16 /* 170 */
1363 .long sys_getresgid16 1363 .long sys_getresgid16
1364 .long sys_prctl 1364 .long sys_prctl
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index a5f624a9f55..3facbc28cbb 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -25,7 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/bitops.h> 26#include <linux/bitops.h>
27 27
28#include <asm/atomic.h> 28#include <linux/atomic.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/smp.h> 30#include <asm/smp.h>
31#include <asm/system.h> 31#include <asm/system.h>
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 9d359752646..3901df1213c 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -143,10 +143,7 @@ void machine_power_off(void)
143 143
144void flush_thread(void) 144void flush_thread(void)
145{ 145{
146#if 0 //ndef NO_FPU 146 /* nothing */
147 unsigned long zero = 0;
148#endif
149 set_fs(USER_DS);
150} 147}
151 148
152inline unsigned long user_stack(const struct pt_regs *regs) 149inline unsigned long user_stack(const struct pt_regs *regs)
diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c
index c42c83d507b..4fb63a36bd5 100644
--- a/arch/frv/mm/pgalloc.c
+++ b/arch/frv/mm/pgalloc.c
@@ -133,13 +133,7 @@ void pgd_dtor(void *pgd)
133 133
134pgd_t *pgd_alloc(struct mm_struct *mm) 134pgd_t *pgd_alloc(struct mm_struct *mm)
135{ 135{
136 pgd_t *pgd; 136 return quicklist_alloc(0, GFP_KERNEL, pgd_ctor);
137
138 pgd = quicklist_alloc(0, GFP_KERNEL, pgd_ctor);
139 if (!pgd)
140 return pgd;
141
142 return pgd;
143} 137}
144 138
145void pgd_free(struct mm_struct *mm, pgd_t *pgd) 139void pgd_free(struct mm_struct *mm, pgd_t *pgd)
diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h
index 984221abb66..f5a38c1f548 100644
--- a/arch/h8300/include/asm/atomic.h
+++ b/arch/h8300/include/asm/atomic.h
@@ -104,7 +104,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
104 104
105#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 105#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
106 106
107static inline int atomic_add_unless(atomic_t *v, int a, int u) 107static inline int __atomic_add_unless(atomic_t *v, int a, int u)
108{ 108{
109 int ret; 109 int ret;
110 unsigned long flags; 110 unsigned long flags;
@@ -114,9 +114,8 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
114 if (ret != u) 114 if (ret != u)
115 v->counter += a; 115 v->counter += a;
116 local_irq_restore(flags); 116 local_irq_restore(flags);
117 return ret != u; 117 return ret;
118} 118}
119#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
120 119
121static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *v) 120static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *v)
122{ 121{
@@ -146,5 +145,4 @@ static __inline__ void atomic_set_mask(unsigned long mask, unsigned long *v)
146#define smp_mb__before_atomic_inc() barrier() 145#define smp_mb__before_atomic_inc() barrier()
147#define smp_mb__after_atomic_inc() barrier() 146#define smp_mb__after_atomic_inc() barrier()
148 147
149#include <asm-generic/atomic-long.h>
150#endif /* __ARCH_H8300_ATOMIC __ */ 148#endif /* __ARCH_H8300_ATOMIC __ */
diff --git a/arch/h8300/include/asm/posix_types.h b/arch/h8300/include/asm/posix_types.h
index 5c553927fc5..6f833a16f69 100644
--- a/arch/h8300/include/asm/posix_types.h
+++ b/arch/h8300/include/asm/posix_types.h
@@ -50,7 +50,7 @@ typedef struct {
50#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) 50#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
51 51
52#undef __FD_ISSET 52#undef __FD_ISSET
53#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) 53#define __FD_ISSET(d, set) (!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d)))
54 54
55#undef __FD_ZERO 55#undef __FD_ZERO
56#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp))) 56#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
diff --git a/arch/h8300/include/asm/ptrace.h b/arch/h8300/include/asm/ptrace.h
index d866c0efba8..d09c440bdba 100644
--- a/arch/h8300/include/asm/ptrace.h
+++ b/arch/h8300/include/asm/ptrace.h
@@ -60,7 +60,6 @@ struct pt_regs {
60#define user_mode(regs) (!((regs)->ccr & PS_S)) 60#define user_mode(regs) (!((regs)->ccr & PS_S))
61#define instruction_pointer(regs) ((regs)->pc) 61#define instruction_pointer(regs) ((regs)->pc)
62#define profile_pc(regs) instruction_pointer(regs) 62#define profile_pc(regs) instruction_pointer(regs)
63extern void show_regs(struct pt_regs *);
64#endif /* __KERNEL__ */ 63#endif /* __KERNEL__ */
65#endif /* __ASSEMBLY__ */ 64#endif /* __ASSEMBLY__ */
66#endif /* _H8300_PTRACE_H */ 65#endif /* _H8300_PTRACE_H */
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index f4b2e67bcc3..4be2ea2fbe2 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -183,7 +183,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
183 .long SYMBOL_NAME(sys_ni_syscall) /* for vm86 */ 183 .long SYMBOL_NAME(sys_ni_syscall) /* for vm86 */
184 .long SYMBOL_NAME(sys_ni_syscall) /* sys_query_module */ 184 .long SYMBOL_NAME(sys_ni_syscall) /* sys_query_module */
185 .long SYMBOL_NAME(sys_poll) 185 .long SYMBOL_NAME(sys_poll)
186 .long SYMBOL_NAME(sys_nfsservctl) 186 .long SYMBOL_NAME(sys_ni_syscall) /* old nfsservctl */
187 .long SYMBOL_NAME(sys_setresgid16) /* 170 */ 187 .long SYMBOL_NAME(sys_setresgid16) /* 170 */
188 .long SYMBOL_NAME(sys_getresgid16) 188 .long SYMBOL_NAME(sys_getresgid16)
189 .long SYMBOL_NAME(sys_prctl) 189 .long SYMBOL_NAME(sys_prctl)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 137b277f7e5..3ff7785b3be 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -27,6 +27,8 @@ config IA64
27 select GENERIC_PENDING_IRQ if SMP 27 select GENERIC_PENDING_IRQ if SMP
28 select IRQ_PER_CPU 28 select IRQ_PER_CPU
29 select GENERIC_IRQ_SHOW 29 select GENERIC_IRQ_SHOW
30 select ARCH_WANT_OPTIONAL_GPIOLIB
31 select ARCH_HAVE_NMI_SAFE_CMPXCHG
30 default y 32 default y
31 help 33 help
32 The Itanium Processor Family is Intel's 64-bit successor to 34 The Itanium Processor Family is Intel's 64-bit successor to
@@ -89,6 +91,9 @@ config GENERIC_TIME_VSYSCALL
89config HAVE_SETUP_PER_CPU_AREA 91config HAVE_SETUP_PER_CPU_AREA
90 def_bool y 92 def_bool y
91 93
94config GENERIC_GPIO
95 def_bool y
96
92config DMI 97config DMI
93 bool 98 bool
94 default y 99 default y
@@ -157,7 +162,6 @@ config IA64_GENERIC
157 select ACPI_NUMA 162 select ACPI_NUMA
158 select SWIOTLB 163 select SWIOTLB
159 select PCI_MSI 164 select PCI_MSI
160 select DMAR
161 help 165 help
162 This selects the system type of your hardware. A "generic" kernel 166 This selects the system type of your hardware. A "generic" kernel
163 will run on any supported IA-64 system. However, if you configure 167 will run on any supported IA-64 system. However, if you configure
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 1d7bca0a396..0e5cd1405e0 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -234,3 +234,4 @@ CONFIG_CRYPTO_MD5=y
234# CONFIG_CRYPTO_ANSI_CPRNG is not set 234# CONFIG_CRYPTO_ANSI_CPRNG is not set
235CONFIG_CRC_T10DIF=y 235CONFIG_CRC_T10DIF=y
236CONFIG_MISC_DEVICES=y 236CONFIG_MISC_DEVICES=y
237CONFIG_DMAR=y
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h
index 44688143967..3fad89ee01c 100644
--- a/arch/ia64/include/asm/atomic.h
+++ b/arch/ia64/include/asm/atomic.h
@@ -90,7 +90,7 @@ ia64_atomic64_sub (__s64 i, atomic64_t *v)
90 (cmpxchg(&((v)->counter), old, new)) 90 (cmpxchg(&((v)->counter), old, new))
91#define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) 91#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
92 92
93static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 93static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
94{ 94{
95 int c, old; 95 int c, old;
96 c = atomic_read(v); 96 c = atomic_read(v);
@@ -102,10 +102,9 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
102 break; 102 break;
103 c = old; 103 c = old;
104 } 104 }
105 return c != (u); 105 return c;
106} 106}
107 107
108#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
109 108
110static __inline__ long atomic64_add_unless(atomic64_t *v, long a, long u) 109static __inline__ long atomic64_add_unless(atomic64_t *v, long a, long u)
111{ 110{
@@ -216,5 +215,4 @@ atomic64_add_negative (__s64 i, atomic64_t *v)
216#define smp_mb__before_atomic_inc() barrier() 215#define smp_mb__before_atomic_inc() barrier()
217#define smp_mb__after_atomic_inc() barrier() 216#define smp_mb__after_atomic_inc() barrier()
218 217
219#include <asm-generic/atomic-long.h>
220#endif /* _ASM_IA64_ATOMIC_H */ 218#endif /* _ASM_IA64_ATOMIC_H */
diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h
index b76f7e00921..8e20bff39f7 100644
--- a/arch/ia64/include/asm/bitops.h
+++ b/arch/ia64/include/asm/bitops.h
@@ -458,8 +458,7 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
458 458
459#include <asm-generic/bitops/le.h> 459#include <asm-generic/bitops/le.h>
460 460
461#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 461#include <asm-generic/bitops/ext2-atomic-setbit.h>
462#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
463 462
464#include <asm-generic/bitops/sched.h> 463#include <asm-generic/bitops/sched.h>
465 464
diff --git a/arch/ia64/include/asm/gpio.h b/arch/ia64/include/asm/gpio.h
new file mode 100644
index 00000000000..590a20debc4
--- /dev/null
+++ b/arch/ia64/include/asm/gpio.h
@@ -0,0 +1,55 @@
1/*
2 * Generic GPIO API implementation for IA-64.
3 *
4 * A stright copy of that for PowerPC which was:
5 *
6 * Copyright (c) 2007-2008 MontaVista Software, Inc.
7 *
8 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef _ASM_IA64_GPIO_H
17#define _ASM_IA64_GPIO_H
18
19#include <linux/errno.h>
20#include <asm-generic/gpio.h>
21
22#ifdef CONFIG_GPIOLIB
23
24/*
25 * We don't (yet) implement inlined/rapid versions for on-chip gpios.
26 * Just call gpiolib.
27 */
28static inline int gpio_get_value(unsigned int gpio)
29{
30 return __gpio_get_value(gpio);
31}
32
33static inline void gpio_set_value(unsigned int gpio, int value)
34{
35 __gpio_set_value(gpio, value);
36}
37
38static inline int gpio_cansleep(unsigned int gpio)
39{
40 return __gpio_cansleep(gpio);
41}
42
43static inline int gpio_to_irq(unsigned int gpio)
44{
45 return __gpio_to_irq(gpio);
46}
47
48static inline int irq_to_gpio(unsigned int irq)
49{
50 return -EINVAL;
51}
52
53#endif /* CONFIG_GPIOLIB */
54
55#endif /* _ASM_IA64_GPIO_H */
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index 03afe797074..d9f397fae03 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -75,7 +75,7 @@
75#include <asm/percpu.h> 75#include <asm/percpu.h>
76#include <asm/rse.h> 76#include <asm/rse.h>
77#include <asm/unwind.h> 77#include <asm/unwind.h>
78#include <asm/atomic.h> 78#include <linux/atomic.h>
79#ifdef CONFIG_NUMA 79#ifdef CONFIG_NUMA
80#include <asm/nodedata.h> 80#include <asm/nodedata.h>
81#endif 81#endif
diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h
index 7ae9c3f15a1..f5cb27614e3 100644
--- a/arch/ia64/include/asm/ptrace.h
+++ b/arch/ia64/include/asm/ptrace.h
@@ -286,7 +286,6 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
286 struct task_struct; /* forward decl */ 286 struct task_struct; /* forward decl */
287 struct unw_frame_info; /* forward decl */ 287 struct unw_frame_info; /* forward decl */
288 288
289 extern void show_regs (struct pt_regs *);
290 extern void ia64_do_show_stack (struct unw_frame_info *, void *); 289 extern void ia64_do_show_stack (struct unw_frame_info *, void *);
291 extern unsigned long ia64_get_user_rbs_end (struct task_struct *, struct pt_regs *, 290 extern unsigned long ia64_get_user_rbs_end (struct task_struct *, struct pt_regs *,
292 unsigned long *); 291 unsigned long *);
diff --git a/arch/ia64/include/asm/spinlock.h b/arch/ia64/include/asm/spinlock.h
index 1a91c9121d1..b77768d35f9 100644
--- a/arch/ia64/include/asm/spinlock.h
+++ b/arch/ia64/include/asm/spinlock.h
@@ -13,7 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15 15
16#include <asm/atomic.h> 16#include <linux/atomic.h>
17#include <asm/intrinsics.h> 17#include <asm/intrinsics.h>
18#include <asm/system.h> 18#include <asm/system.h>
19 19
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 6fc03aff046..c38d22e5e90 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -156,7 +156,7 @@ prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, \
156#define STUB_SET_VARIABLE(prefix, adjust_arg) \ 156#define STUB_SET_VARIABLE(prefix, adjust_arg) \
157static efi_status_t \ 157static efi_status_t \
158prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, \ 158prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, \
159 unsigned long attr, unsigned long data_size, \ 159 u32 attr, unsigned long data_size, \
160 void *data) \ 160 void *data) \
161{ \ 161{ \
162 struct ia64_fpreg fr[6]; \ 162 struct ia64_fpreg fr[6]; \
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 97dd2abdeb1..198c753d100 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1614,7 +1614,7 @@ sys_call_table:
1614 data8 sys_sched_get_priority_min 1614 data8 sys_sched_get_priority_min
1615 data8 sys_sched_rr_get_interval 1615 data8 sys_sched_rr_get_interval
1616 data8 sys_nanosleep 1616 data8 sys_nanosleep
1617 data8 sys_nfsservctl 1617 data8 sys_ni_syscall // old nfsservctl
1618 data8 sys_prctl // 1170 1618 data8 sys_prctl // 1170
1619 data8 sys_getpagesize 1619 data8 sys_getpagesize
1620 data8 sys_mmap2 1620 data8 sys_mmap2
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index be450a3e987..0bd537b4ea6 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -32,7 +32,7 @@
32#include <linux/bitops.h> 32#include <linux/bitops.h>
33#include <linux/kexec.h> 33#include <linux/kexec.h>
34 34
35#include <asm/atomic.h> 35#include <linux/atomic.h>
36#include <asm/current.h> 36#include <asm/current.h>
37#include <asm/delay.h> 37#include <asm/delay.h>
38#include <asm/machvec.h> 38#include <asm/machvec.h>
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 14ec641003d..55909798667 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -40,7 +40,7 @@
40#include <linux/percpu.h> 40#include <linux/percpu.h>
41#include <linux/bitops.h> 41#include <linux/bitops.h>
42 42
43#include <asm/atomic.h> 43#include <linux/atomic.h>
44#include <asm/cache.h> 44#include <asm/cache.h>
45#include <asm/current.h> 45#include <asm/current.h>
46#include <asm/delay.h> 46#include <asm/delay.h>
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index c4696d217ce..6a867dc45c0 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -25,7 +25,7 @@
25#include <asm/pal.h> 25#include <asm/pal.h>
26#include <asm/system.h> 26#include <asm/system.h>
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
28#include <asm/atomic.h> 28#include <linux/atomic.h>
29#include <asm/tlbflush.h> 29#include <asm/tlbflush.h>
30#include <asm/sn/arch.h> 30#include <asm/sn/arch.h>
31 31
diff --git a/arch/m32r/include/asm/atomic.h b/arch/m32r/include/asm/atomic.h
index d44a51e5271..1e7f29fb21f 100644
--- a/arch/m32r/include/asm/atomic.h
+++ b/arch/m32r/include/asm/atomic.h
@@ -239,15 +239,15 @@ static __inline__ int atomic_dec_return(atomic_t *v)
239#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 239#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
240 240
241/** 241/**
242 * atomic_add_unless - add unless the number is a given value 242 * __atomic_add_unless - add unless the number is a given value
243 * @v: pointer of type atomic_t 243 * @v: pointer of type atomic_t
244 * @a: the amount to add to v... 244 * @a: the amount to add to v...
245 * @u: ...unless v is equal to u. 245 * @u: ...unless v is equal to u.
246 * 246 *
247 * Atomically adds @a to @v, so long as it was not @u. 247 * Atomically adds @a to @v, so long as it was not @u.
248 * Returns non-zero if @v was not @u, and zero otherwise. 248 * Returns the old value of @v.
249 */ 249 */
250static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 250static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
251{ 251{
252 int c, old; 252 int c, old;
253 c = atomic_read(v); 253 c = atomic_read(v);
@@ -259,10 +259,9 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
259 break; 259 break;
260 c = old; 260 c = old;
261 } 261 }
262 return c != (u); 262 return c;
263} 263}
264 264
265#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
266 265
267static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *addr) 266static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *addr)
268{ 267{
@@ -314,5 +313,4 @@ static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *addr)
314#define smp_mb__before_atomic_inc() barrier() 313#define smp_mb__before_atomic_inc() barrier()
315#define smp_mb__after_atomic_inc() barrier() 314#define smp_mb__after_atomic_inc() barrier()
316 315
317#include <asm-generic/atomic-long.h>
318#endif /* _ASM_M32R_ATOMIC_H */ 316#endif /* _ASM_M32R_ATOMIC_H */
diff --git a/arch/m32r/include/asm/mmu_context.h b/arch/m32r/include/asm/mmu_context.h
index a70a3df3363..a979a419816 100644
--- a/arch/m32r/include/asm/mmu_context.h
+++ b/arch/m32r/include/asm/mmu_context.h
@@ -11,7 +11,7 @@
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13 13
14#include <asm/atomic.h> 14#include <linux/atomic.h>
15#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
16#include <asm/mmu.h> 16#include <asm/mmu.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
diff --git a/arch/m32r/include/asm/ptrace.h b/arch/m32r/include/asm/ptrace.h
index 840a1231ede..527527584dd 100644
--- a/arch/m32r/include/asm/ptrace.h
+++ b/arch/m32r/include/asm/ptrace.h
@@ -138,8 +138,6 @@ extern void init_debug_traps(struct task_struct *);
138#define instruction_pointer(regs) ((regs)->bpc) 138#define instruction_pointer(regs) ((regs)->bpc)
139#define profile_pc(regs) instruction_pointer(regs) 139#define profile_pc(regs) instruction_pointer(regs)
140 140
141extern void show_regs(struct pt_regs *);
142
143extern void withdraw_debug_trap(struct pt_regs *regs); 141extern void withdraw_debug_trap(struct pt_regs *regs);
144 142
145#define task_pt_regs(task) \ 143#define task_pt_regs(task) \
diff --git a/arch/m32r/include/asm/spinlock.h b/arch/m32r/include/asm/spinlock.h
index 179a06489b1..b0ea2f26da3 100644
--- a/arch/m32r/include/asm/spinlock.h
+++ b/arch/m32r/include/asm/spinlock.h
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <asm/atomic.h> 13#include <linux/atomic.h>
14#include <asm/page.h> 14#include <asm/page.h>
15 15
16/* 16/*
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index 092d40a6708..ce7aea34fdf 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -26,7 +26,7 @@
26 26
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28#include <asm/pgalloc.h> 28#include <asm/pgalloc.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/mmu_context.h> 31#include <asm/mmu_context.h>
32#include <asm/m32r.h> 32#include <asm/m32r.h>
diff --git a/arch/m32r/kernel/syscall_table.S b/arch/m32r/kernel/syscall_table.S
index 528f2e6ad06..f365c19795e 100644
--- a/arch/m32r/kernel/syscall_table.S
+++ b/arch/m32r/kernel/syscall_table.S
@@ -168,7 +168,7 @@ ENTRY(sys_call_table)
168 .long sys_tas /* vm86 syscall holder */ 168 .long sys_tas /* vm86 syscall holder */
169 .long sys_ni_syscall /* query_module syscall holder */ 169 .long sys_ni_syscall /* query_module syscall holder */
170 .long sys_poll 170 .long sys_poll
171 .long sys_nfsservctl 171 .long sys_ni_syscall /* was nfsservctl */
172 .long sys_setresgid /* 170 */ 172 .long sys_setresgid /* 170 */
173 .long sys_getresgid 173 .long sys_getresgid
174 .long sys_prctl 174 .long sys_prctl
diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c
index fbd109031df..ee6a9199561 100644
--- a/arch/m32r/kernel/traps.c
+++ b/arch/m32r/kernel/traps.c
@@ -21,7 +21,7 @@
21#include <asm/system.h> 21#include <asm/system.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25 25
26#include <asm/smp.h> 26#include <asm/smp.h>
27 27
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 284cd3771ea..9e8ee9d2b8c 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -6,6 +6,7 @@ config M68K
6 select GENERIC_ATOMIC64 if MMU 6 select GENERIC_ATOMIC64 if MMU
7 select HAVE_GENERIC_HARDIRQS if !MMU 7 select HAVE_GENERIC_HARDIRQS if !MMU
8 select GENERIC_IRQ_SHOW if !MMU 8 select GENERIC_IRQ_SHOW if !MMU
9 select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
9 10
10config RWSEM_GENERIC_SPINLOCK 11config RWSEM_GENERIC_SPINLOCK
11 bool 12 bool
diff --git a/arch/m68k/Kconfig.mmu b/arch/m68k/Kconfig.mmu
index 16539b1d5d3..13e20bbc407 100644
--- a/arch/m68k/Kconfig.mmu
+++ b/arch/m68k/Kconfig.mmu
@@ -372,12 +372,6 @@ config AMIGA_PCMCIA
372 Include support in the kernel for pcmcia on Amiga 1200 and Amiga 372 Include support in the kernel for pcmcia on Amiga 1200 and Amiga
373 600. If you intend to use pcmcia cards say Y; otherwise say N. 373 600. If you intend to use pcmcia cards say Y; otherwise say N.
374 374
375config STRAM_PROC
376 bool "ST-RAM statistics in /proc"
377 depends on ATARI
378 help
379 Say Y here to report ST-RAM usage statistics in /proc/stram.
380
381config HEARTBEAT 375config HEARTBEAT
382 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 376 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
383 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 377 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c
index dd0447db1c9..99449fbf9a7 100644
--- a/arch/m68k/amiga/chipram.c
+++ b/arch/m68k/amiga/chipram.c
@@ -16,6 +16,7 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/module.h> 17#include <linux/module.h>
18 18
19#include <asm/atomic.h>
19#include <asm/page.h> 20#include <asm/page.h>
20#include <asm/amigahw.h> 21#include <asm/amigahw.h>
21 22
@@ -23,111 +24,100 @@ unsigned long amiga_chip_size;
23EXPORT_SYMBOL(amiga_chip_size); 24EXPORT_SYMBOL(amiga_chip_size);
24 25
25static struct resource chipram_res = { 26static struct resource chipram_res = {
26 .name = "Chip RAM", .start = CHIP_PHYSADDR 27 .name = "Chip RAM", .start = CHIP_PHYSADDR
27}; 28};
28static unsigned long chipavail; 29static atomic_t chipavail;
29 30
30 31
31void __init amiga_chip_init(void) 32void __init amiga_chip_init(void)
32{ 33{
33 if (!AMIGAHW_PRESENT(CHIP_RAM)) 34 if (!AMIGAHW_PRESENT(CHIP_RAM))
34 return; 35 return;
35 36
36 chipram_res.end = amiga_chip_size-1; 37 chipram_res.end = CHIP_PHYSADDR + amiga_chip_size - 1;
37 request_resource(&iomem_resource, &chipram_res); 38 request_resource(&iomem_resource, &chipram_res);
38 39
39 chipavail = amiga_chip_size; 40 atomic_set(&chipavail, amiga_chip_size);
40} 41}
41 42
42 43
43void *amiga_chip_alloc(unsigned long size, const char *name) 44void *amiga_chip_alloc(unsigned long size, const char *name)
44{ 45{
45 struct resource *res; 46 struct resource *res;
47 void *p;
46 48
47 /* round up */ 49 res = kzalloc(sizeof(struct resource), GFP_KERNEL);
48 size = PAGE_ALIGN(size); 50 if (!res)
51 return NULL;
49 52
50#ifdef DEBUG 53 res->name = name;
51 printk("amiga_chip_alloc: allocate %ld bytes\n", size); 54 p = amiga_chip_alloc_res(size, res);
52#endif 55 if (!p) {
53 res = kzalloc(sizeof(struct resource), GFP_KERNEL); 56 kfree(res);
54 if (!res) 57 return NULL;
55 return NULL; 58 }
56 res->name = name;
57 59
58 if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) { 60 return p;
59 kfree(res);
60 return NULL;
61 }
62 chipavail -= size;
63#ifdef DEBUG
64 printk("amiga_chip_alloc: returning %lx\n", res->start);
65#endif
66 return (void *)ZTWO_VADDR(res->start);
67} 61}
68EXPORT_SYMBOL(amiga_chip_alloc); 62EXPORT_SYMBOL(amiga_chip_alloc);
69 63
70 64
71 /* 65 /*
72 * Warning: 66 * Warning:
73 * amiga_chip_alloc_res is meant only for drivers that need to allocate 67 * amiga_chip_alloc_res is meant only for drivers that need to
74 * Chip RAM before kmalloc() is functional. As a consequence, those 68 * allocate Chip RAM before kmalloc() is functional. As a consequence,
75 * drivers must not free that Chip RAM afterwards. 69 * those drivers must not free that Chip RAM afterwards.
76 */ 70 */
77 71
78void * __init amiga_chip_alloc_res(unsigned long size, struct resource *res) 72void *amiga_chip_alloc_res(unsigned long size, struct resource *res)
79{ 73{
80 unsigned long start; 74 int error;
81 75
82 /* round up */ 76 /* round up */
83 size = PAGE_ALIGN(size); 77 size = PAGE_ALIGN(size);
84 /* dmesg into chipmem prefers memory at the safe end */ 78
85 start = CHIP_PHYSADDR + chipavail - size; 79 pr_debug("amiga_chip_alloc_res: allocate %lu bytes\n", size);
86 80 error = allocate_resource(&chipram_res, res, size, 0, UINT_MAX,
87#ifdef DEBUG 81 PAGE_SIZE, NULL, NULL);
88 printk("amiga_chip_alloc_res: allocate %ld bytes\n", size); 82 if (error < 0) {
89#endif 83 pr_err("amiga_chip_alloc_res: allocate_resource() failed %d!\n",
90 if (allocate_resource(&chipram_res, res, size, start, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) { 84 error);
91 printk("amiga_chip_alloc_res: first alloc failed!\n"); 85 return NULL;
92 if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) 86 }
93 return NULL; 87
94 } 88 atomic_sub(size, &chipavail);
95 chipavail -= size; 89 pr_debug("amiga_chip_alloc_res: returning %pR\n", res);
96#ifdef DEBUG 90 return (void *)ZTWO_VADDR(res->start);
97 printk("amiga_chip_alloc_res: returning %lx\n", res->start);
98#endif
99 return (void *)ZTWO_VADDR(res->start);
100} 91}
101 92
102void amiga_chip_free(void *ptr) 93void amiga_chip_free(void *ptr)
103{ 94{
104 unsigned long start = ZTWO_PADDR(ptr); 95 unsigned long start = ZTWO_PADDR(ptr);
105 struct resource **p, *res; 96 struct resource *res;
106 unsigned long size; 97 unsigned long size;
107 98
108 for (p = &chipram_res.child; (res = *p); p = &res->sibling) { 99 res = lookup_resource(&chipram_res, start);
109 if (res->start != start) 100 if (!res) {
110 continue; 101 pr_err("amiga_chip_free: trying to free nonexistent region at "
111 *p = res->sibling; 102 "%p\n", ptr);
112 size = res->end-start; 103 return;
113#ifdef DEBUG 104 }
114 printk("amiga_chip_free: free %ld bytes at %p\n", size, ptr); 105
115#endif 106 size = resource_size(res);
116 chipavail += size; 107 pr_debug("amiga_chip_free: free %lu bytes at %p\n", size, ptr);
108 atomic_add(size, &chipavail);
109 release_resource(res);
117 kfree(res); 110 kfree(res);
118 return;
119 }
120 printk("amiga_chip_free: trying to free nonexistent region at %p\n", ptr);
121} 111}
122EXPORT_SYMBOL(amiga_chip_free); 112EXPORT_SYMBOL(amiga_chip_free);
123 113
124 114
125unsigned long amiga_chip_avail(void) 115unsigned long amiga_chip_avail(void)
126{ 116{
127#ifdef DEBUG 117 unsigned long n = atomic_read(&chipavail);
128 printk("amiga_chip_avail : %ld bytes\n", chipavail); 118
129#endif 119 pr_debug("amiga_chip_avail : %lu bytes\n", n);
130 return chipavail; 120 return n;
131} 121}
132EXPORT_SYMBOL(amiga_chip_avail); 122EXPORT_SYMBOL(amiga_chip_avail);
133 123
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 6ec3b7f3377..0810c8d56e5 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/m68k/atari/stram.c: Functions for ST-RAM allocations 2 * Functions for ST-RAM allocations
3 * 3 *
4 * Copyright 1994-97 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> 4 * Copyright 1994-97 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
5 * 5 *
@@ -30,91 +30,35 @@
30#include <asm/atari_stram.h> 30#include <asm/atari_stram.h>
31#include <asm/io.h> 31#include <asm/io.h>
32 32
33#undef DEBUG
34
35#ifdef DEBUG
36#define DPRINTK(fmt,args...) printk( fmt, ##args )
37#else
38#define DPRINTK(fmt,args...)
39#endif
40
41#if defined(CONFIG_PROC_FS) && defined(CONFIG_STRAM_PROC)
42/* abbrev for the && above... */
43#define DO_PROC
44#include <linux/proc_fs.h>
45#include <linux/seq_file.h>
46#endif
47 33
48/* 34/*
49 * ++roman: 35 * The ST-RAM allocator allocates memory from a pool of reserved ST-RAM of
50 * 36 * configurable size, set aside on ST-RAM init.
51 * New version of ST-Ram buffer allocation. Instead of using the 37 * As long as this pool is not exhausted, allocation of real ST-RAM can be
52 * 1 MB - 4 KB that remain when the ST-Ram chunk starts at $1000 38 * guaranteed.
53 * (1 MB granularity!), such buffers are reserved like this:
54 *
55 * - If the kernel resides in ST-Ram anyway, we can take the buffer
56 * from behind the current kernel data space the normal way
57 * (incrementing start_mem).
58 *
59 * - If the kernel is in TT-Ram, stram_init() initializes start and
60 * end of the available region. Buffers are allocated from there
61 * and mem_init() later marks the such used pages as reserved.
62 * Since each TT-Ram chunk is at least 4 MB in size, I hope there
63 * won't be an overrun of the ST-Ram region by normal kernel data
64 * space.
65 *
66 * For that, ST-Ram may only be allocated while kernel initialization
67 * is going on, or exactly: before mem_init() is called. There is also
68 * no provision now for freeing ST-Ram buffers. It seems that isn't
69 * really needed.
70 *
71 */ 39 */
72 40
73/* Start and end (virtual) of ST-RAM */
74static void *stram_start, *stram_end;
75
76/* set after memory_init() executed and allocations via start_mem aren't
77 * possible anymore */
78static int mem_init_done;
79
80/* set if kernel is in ST-RAM */ 41/* set if kernel is in ST-RAM */
81static int kernel_in_stram; 42static int kernel_in_stram;
82 43
83typedef struct stram_block { 44static struct resource stram_pool = {
84 struct stram_block *next; 45 .name = "ST-RAM Pool"
85 void *start; 46};
86 unsigned long size;
87 unsigned flags;
88 const char *owner;
89} BLOCK;
90
91/* values for flags field */
92#define BLOCK_FREE 0x01 /* free structure in the BLOCKs pool */
93#define BLOCK_KMALLOCED 0x02 /* structure allocated by kmalloc() */
94#define BLOCK_GFP 0x08 /* block allocated with __get_dma_pages() */
95 47
96/* list of allocated blocks */ 48static unsigned long pool_size = 1024*1024;
97static BLOCK *alloc_list;
98 49
99/* We can't always use kmalloc() to allocate BLOCK structures, since
100 * stram_alloc() can be called rather early. So we need some pool of
101 * statically allocated structures. 20 of them is more than enough, so in most
102 * cases we never should need to call kmalloc(). */
103#define N_STATIC_BLOCKS 20
104static BLOCK static_blocks[N_STATIC_BLOCKS];
105 50
106/***************************** Prototypes *****************************/ 51static int __init atari_stram_setup(char *arg)
52{
53 if (!MACH_IS_ATARI)
54 return 0;
107 55
108static BLOCK *add_region( void *addr, unsigned long size ); 56 pool_size = memparse(arg, NULL);
109static BLOCK *find_region( void *addr ); 57 return 0;
110static int remove_region( BLOCK *block ); 58}
111 59
112/************************* End of Prototypes **************************/ 60early_param("stram_pool", atari_stram_setup);
113 61
114
115/* ------------------------------------------------------------------------ */
116/* Public Interface */
117/* ------------------------------------------------------------------------ */
118 62
119/* 63/*
120 * This init function is called very early by atari/config.c 64 * This init function is called very early by atari/config.c
@@ -123,25 +67,23 @@ static int remove_region( BLOCK *block );
123void __init atari_stram_init(void) 67void __init atari_stram_init(void)
124{ 68{
125 int i; 69 int i;
70 void *stram_start;
126 71
127 /* initialize static blocks */ 72 /*
128 for( i = 0; i < N_STATIC_BLOCKS; ++i ) 73 * determine whether kernel code resides in ST-RAM
129 static_blocks[i].flags = BLOCK_FREE; 74 * (then ST-RAM is the first memory block at virtual 0x0)
130 75 */
131 /* determine whether kernel code resides in ST-RAM (then ST-RAM is the
132 * first memory block at virtual 0x0) */
133 stram_start = phys_to_virt(0); 76 stram_start = phys_to_virt(0);
134 kernel_in_stram = (stram_start == 0); 77 kernel_in_stram = (stram_start == 0);
135 78
136 for( i = 0; i < m68k_num_memory; ++i ) { 79 for (i = 0; i < m68k_num_memory; ++i) {
137 if (m68k_memory[i].addr == 0) { 80 if (m68k_memory[i].addr == 0) {
138 /* skip first 2kB or page (supervisor-only!) */
139 stram_end = stram_start + m68k_memory[i].size;
140 return; 81 return;
141 } 82 }
142 } 83 }
84
143 /* Should never come here! (There is always ST-Ram!) */ 85 /* Should never come here! (There is always ST-Ram!) */
144 panic( "atari_stram_init: no ST-RAM found!" ); 86 panic("atari_stram_init: no ST-RAM found!");
145} 87}
146 88
147 89
@@ -151,226 +93,68 @@ void __init atari_stram_init(void)
151 */ 93 */
152void __init atari_stram_reserve_pages(void *start_mem) 94void __init atari_stram_reserve_pages(void *start_mem)
153{ 95{
154 /* always reserve first page of ST-RAM, the first 2 kB are 96 /*
155 * supervisor-only! */ 97 * always reserve first page of ST-RAM, the first 2 KiB are
98 * supervisor-only!
99 */
156 if (!kernel_in_stram) 100 if (!kernel_in_stram)
157 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT); 101 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
158 102
159} 103 stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size);
104 stram_pool.end = stram_pool.start + pool_size - 1;
105 request_resource(&iomem_resource, &stram_pool);
160 106
161void atari_stram_mem_init_hook (void) 107 pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
162{ 108 pool_size, &stram_pool);
163 mem_init_done = 1;
164} 109}
165 110
166 111
167/* 112void *atari_stram_alloc(unsigned long size, const char *owner)
168 * This is main public interface: somehow allocate a ST-RAM block
169 *
170 * - If we're before mem_init(), we have to make a static allocation. The
171 * region is taken in the kernel data area (if the kernel is in ST-RAM) or
172 * from the start of ST-RAM (if the kernel is in TT-RAM) and added to the
173 * rsvd_stram_* region. The ST-RAM is somewhere in the middle of kernel
174 * address space in the latter case.
175 *
176 * - If mem_init() already has been called, try with __get_dma_pages().
177 * This has the disadvantage that it's very hard to get more than 1 page,
178 * and it is likely to fail :-(
179 *
180 */
181void *atari_stram_alloc(long size, const char *owner)
182{ 113{
183 void *addr = NULL; 114 struct resource *res;
184 BLOCK *block; 115 int error;
185 int flags; 116
186 117 pr_debug("atari_stram_alloc: allocate %lu bytes\n", size);
187 DPRINTK("atari_stram_alloc(size=%08lx,owner=%s)\n", size, owner); 118
188 119 /* round up */
189 if (!mem_init_done) 120 size = PAGE_ALIGN(size);
190 return alloc_bootmem_low(size); 121
191 else { 122 res = kzalloc(sizeof(struct resource), GFP_KERNEL);
192 /* After mem_init(): can only resort to __get_dma_pages() */ 123 if (!res)
193 addr = (void *)__get_dma_pages(GFP_KERNEL, get_order(size)); 124 return NULL;
194 flags = BLOCK_GFP; 125
195 DPRINTK( "atari_stram_alloc: after mem_init, " 126 res->name = owner;
196 "get_pages=%p\n", addr ); 127 error = allocate_resource(&stram_pool, res, size, 0, UINT_MAX,
128 PAGE_SIZE, NULL, NULL);
129 if (error < 0) {
130 pr_err("atari_stram_alloc: allocate_resource() failed %d!\n",
131 error);
132 kfree(res);
133 return NULL;
197 } 134 }
198 135
199 if (addr) { 136 pr_debug("atari_stram_alloc: returning %pR\n", res);
200 if (!(block = add_region( addr, size ))) { 137 return (void *)res->start;
201 /* out of memory for BLOCK structure :-( */
202 DPRINTK( "atari_stram_alloc: out of mem for BLOCK -- "
203 "freeing again\n" );
204 free_pages((unsigned long)addr, get_order(size));
205 return( NULL );
206 }
207 block->owner = owner;
208 block->flags |= flags;
209 }
210 return( addr );
211} 138}
212EXPORT_SYMBOL(atari_stram_alloc); 139EXPORT_SYMBOL(atari_stram_alloc);
213 140
214void atari_stram_free( void *addr )
215 141
142void atari_stram_free(void *addr)
216{ 143{
217 BLOCK *block; 144 unsigned long start = (unsigned long)addr;
218 145 struct resource *res;
219 DPRINTK( "atari_stram_free(addr=%p)\n", addr ); 146 unsigned long size;
220 147
221 if (!(block = find_region( addr ))) { 148 res = lookup_resource(&stram_pool, start);
222 printk( KERN_ERR "Attempt to free non-allocated ST-RAM block at %p " 149 if (!res) {
223 "from %p\n", addr, __builtin_return_address(0) ); 150 pr_err("atari_stram_free: trying to free nonexistent region "
151 "at %p\n", addr);
224 return; 152 return;
225 } 153 }
226 DPRINTK( "atari_stram_free: found block (%p): size=%08lx, owner=%s, "
227 "flags=%02x\n", block, block->size, block->owner, block->flags );
228
229 if (!(block->flags & BLOCK_GFP))
230 goto fail;
231 154
232 DPRINTK("atari_stram_free: is kmalloced, order_size=%d\n", 155 size = resource_size(res);
233 get_order(block->size)); 156 pr_debug("atari_stram_free: free %lu bytes at %p\n", size, addr);
234 free_pages((unsigned long)addr, get_order(block->size)); 157 release_resource(res);
235 remove_region( block ); 158 kfree(res);
236 return;
237
238 fail:
239 printk( KERN_ERR "atari_stram_free: cannot free block at %p "
240 "(called from %p)\n", addr, __builtin_return_address(0) );
241} 159}
242EXPORT_SYMBOL(atari_stram_free); 160EXPORT_SYMBOL(atari_stram_free);
243
244
245/* ------------------------------------------------------------------------ */
246/* Region Management */
247/* ------------------------------------------------------------------------ */
248
249
250/* insert a region into the alloced list (sorted) */
251static BLOCK *add_region( void *addr, unsigned long size )
252{
253 BLOCK **p, *n = NULL;
254 int i;
255
256 for( i = 0; i < N_STATIC_BLOCKS; ++i ) {
257 if (static_blocks[i].flags & BLOCK_FREE) {
258 n = &static_blocks[i];
259 n->flags = 0;
260 break;
261 }
262 }
263 if (!n && mem_init_done) {
264 /* if statics block pool exhausted and we can call kmalloc() already
265 * (after mem_init()), try that */
266 n = kmalloc( sizeof(BLOCK), GFP_KERNEL );
267 if (n)
268 n->flags = BLOCK_KMALLOCED;
269 }
270 if (!n) {
271 printk( KERN_ERR "Out of memory for ST-RAM descriptor blocks\n" );
272 return( NULL );
273 }
274 n->start = addr;
275 n->size = size;
276
277 for( p = &alloc_list; *p; p = &((*p)->next) )
278 if ((*p)->start > addr) break;
279 n->next = *p;
280 *p = n;
281
282 return( n );
283}
284
285
286/* find a region (by start addr) in the alloced list */
287static BLOCK *find_region( void *addr )
288{
289 BLOCK *p;
290
291 for( p = alloc_list; p; p = p->next ) {
292 if (p->start == addr)
293 return( p );
294 if (p->start > addr)
295 break;
296 }
297 return( NULL );
298}
299
300
301/* remove a block from the alloced list */
302static int remove_region( BLOCK *block )
303{
304 BLOCK **p;
305
306 for( p = &alloc_list; *p; p = &((*p)->next) )
307 if (*p == block) break;
308 if (!*p)
309 return( 0 );
310
311 *p = block->next;
312 if (block->flags & BLOCK_KMALLOCED)
313 kfree( block );
314 else
315 block->flags |= BLOCK_FREE;
316 return( 1 );
317}
318
319
320
321/* ------------------------------------------------------------------------ */
322/* /proc statistics file stuff */
323/* ------------------------------------------------------------------------ */
324
325#ifdef DO_PROC
326
327#define PRINT_PROC(fmt,args...) seq_printf( m, fmt, ##args )
328
329static int stram_proc_show(struct seq_file *m, void *v)
330{
331 BLOCK *p;
332
333 PRINT_PROC("Total ST-RAM: %8u kB\n",
334 (stram_end - stram_start) >> 10);
335 PRINT_PROC( "Allocated regions:\n" );
336 for( p = alloc_list; p; p = p->next ) {
337 PRINT_PROC("0x%08lx-0x%08lx: %s (",
338 virt_to_phys(p->start),
339 virt_to_phys(p->start+p->size-1),
340 p->owner);
341 if (p->flags & BLOCK_GFP)
342 PRINT_PROC( "page-alloced)\n" );
343 else
344 PRINT_PROC( "??)\n" );
345 }
346
347 return 0;
348}
349
350static int stram_proc_open(struct inode *inode, struct file *file)
351{
352 return single_open(file, stram_proc_show, NULL);
353}
354
355static const struct file_operations stram_proc_fops = {
356 .open = stram_proc_open,
357 .read = seq_read,
358 .llseek = seq_lseek,
359 .release = single_release,
360};
361
362static int __init proc_stram_init(void)
363{
364 proc_create("stram", 0, NULL, &stram_proc_fops);
365 return 0;
366}
367module_init(proc_stram_init);
368#endif
369
370
371/*
372 * Local variables:
373 * c-indent-level: 4
374 * tab-width: 4
375 * End:
376 */
diff --git a/arch/m68k/include/asm/atari_stram.h b/arch/m68k/include/asm/atari_stram.h
index 7546d13963b..62e27598af9 100644
--- a/arch/m68k/include/asm/atari_stram.h
+++ b/arch/m68k/include/asm/atari_stram.h
@@ -6,12 +6,11 @@
6 */ 6 */
7 7
8/* public interface */ 8/* public interface */
9void *atari_stram_alloc(long size, const char *owner); 9void *atari_stram_alloc(unsigned long size, const char *owner);
10void atari_stram_free(void *); 10void atari_stram_free(void *);
11 11
12/* functions called internally by other parts of the kernel */ 12/* functions called internally by other parts of the kernel */
13void atari_stram_init(void); 13void atari_stram_init(void);
14void atari_stram_reserve_pages(void *start_mem); 14void atari_stram_reserve_pages(void *start_mem);
15void atari_stram_mem_init_hook (void);
16 15
17#endif /*_M68K_ATARI_STRAM_H */ 16#endif /*_M68K_ATARI_STRAM_H */
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h
index f51f709bbf3..0392b28656a 100644
--- a/arch/m68k/include/asm/atarihw.h
+++ b/arch/m68k/include/asm/atarihw.h
@@ -399,8 +399,8 @@ struct CODEC
399#define CODEC_OVERFLOW_LEFT 2 399#define CODEC_OVERFLOW_LEFT 2
400 u_char unused2, unused3, unused4, unused5; 400 u_char unused2, unused3, unused4, unused5;
401 u_char gpio_directions; 401 u_char gpio_directions;
402#define GPIO_IN 0 402#define CODEC_GPIO_IN 0
403#define GPIO_OUT 1 403#define CODEC_GPIO_OUT 1
404 u_char unused6; 404 u_char unused6;
405 u_char gpio_data; 405 u_char gpio_data;
406}; 406};
diff --git a/arch/m68k/include/asm/atomic.h b/arch/m68k/include/asm/atomic.h
index 307a573881a..65c6be6c818 100644
--- a/arch/m68k/include/asm/atomic.h
+++ b/arch/m68k/include/asm/atomic.h
@@ -183,7 +183,7 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *v)
183 __asm__ __volatile__("orl %1,%0" : "+m" (*v) : ASM_DI (mask)); 183 __asm__ __volatile__("orl %1,%0" : "+m" (*v) : ASM_DI (mask));
184} 184}
185 185
186static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 186static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
187{ 187{
188 int c, old; 188 int c, old;
189 c = atomic_read(v); 189 c = atomic_read(v);
@@ -195,10 +195,9 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
195 break; 195 break;
196 c = old; 196 c = old;
197 } 197 }
198 return c != (u); 198 return c;
199} 199}
200 200
201#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
202 201
203/* Atomic operations are already serializing */ 202/* Atomic operations are already serializing */
204#define smp_mb__before_atomic_dec() barrier() 203#define smp_mb__before_atomic_dec() barrier()
@@ -206,6 +205,4 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
206#define smp_mb__before_atomic_inc() barrier() 205#define smp_mb__before_atomic_inc() barrier()
207#define smp_mb__after_atomic_inc() barrier() 206#define smp_mb__after_atomic_inc() barrier()
208 207
209#include <asm-generic/atomic-long.h>
210#include <asm-generic/atomic64.h>
211#endif /* __ARCH_M68K_ATOMIC __ */ 208#endif /* __ARCH_M68K_ATOMIC __ */
diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h
index 31d5570d656..89f201434b5 100644
--- a/arch/m68k/include/asm/page_mm.h
+++ b/arch/m68k/include/asm/page_mm.h
@@ -162,7 +162,7 @@ static inline __attribute_const__ int __virt_to_node_shift(void)
162 pgdat->node_mem_map + (__pfn - pgdat->node_start_pfn); \ 162 pgdat->node_mem_map + (__pfn - pgdat->node_start_pfn); \
163}) 163})
164#define page_to_pfn(_page) ({ \ 164#define page_to_pfn(_page) ({ \
165 struct page *__p = (_page); \ 165 const struct page *__p = (_page); \
166 struct pglist_data *pgdat; \ 166 struct pglist_data *pgdat; \
167 pgdat = &pg_data_map[page_to_nid(__p)]; \ 167 pgdat = &pg_data_map[page_to_nid(__p)]; \
168 ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \ 168 ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \
diff --git a/arch/m68k/include/asm/posix_types.h b/arch/m68k/include/asm/posix_types.h
index 63cdcc142d9..98d0970d9ba 100644
--- a/arch/m68k/include/asm/posix_types.h
+++ b/arch/m68k/include/asm/posix_types.h
@@ -51,7 +51,7 @@ typedef struct {
51#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) 51#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
52 52
53#undef __FD_ISSET 53#undef __FD_ISSET
54#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) 54#define __FD_ISSET(d, set) (!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d)))
55 55
56#undef __FD_ZERO 56#undef __FD_ZERO
57#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp))) 57#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
diff --git a/arch/m68k/include/asm/ptrace.h b/arch/m68k/include/asm/ptrace.h
index 6e6e3ac1d91..65322b17b6c 100644
--- a/arch/m68k/include/asm/ptrace.h
+++ b/arch/m68k/include/asm/ptrace.h
@@ -85,7 +85,6 @@ struct switch_stack {
85#define user_mode(regs) (!((regs)->sr & PS_S)) 85#define user_mode(regs) (!((regs)->sr & PS_S))
86#define instruction_pointer(regs) ((regs)->pc) 86#define instruction_pointer(regs) ((regs)->pc)
87#define profile_pc(regs) instruction_pointer(regs) 87#define profile_pc(regs) instruction_pointer(regs)
88extern void show_regs(struct pt_regs *);
89 88
90#define arch_has_single_step() (1) 89#define arch_has_single_step() (1)
91 90
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 334d8364037..c3b45061dd0 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -216,7 +216,9 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
216 216
217void __init setup_arch(char **cmdline_p) 217void __init setup_arch(char **cmdline_p)
218{ 218{
219#ifndef CONFIG_SUN3
219 int i; 220 int i;
221#endif
220 222
221 /* The bootinfo is located right after the kernel bss */ 223 /* The bootinfo is located right after the kernel bss */
222 m68k_parse_bootinfo((const struct bi_record *)_end); 224 m68k_parse_bootinfo((const struct bi_record *)_end);
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
index 00d1452f957..c468f2edaa8 100644
--- a/arch/m68k/kernel/syscalltable.S
+++ b/arch/m68k/kernel/syscalltable.S
@@ -189,7 +189,7 @@ ENTRY(sys_call_table)
189 .long sys_getpagesize 189 .long sys_getpagesize
190 .long sys_ni_syscall /* old "query_module" */ 190 .long sys_ni_syscall /* old "query_module" */
191 .long sys_poll 191 .long sys_poll
192 .long sys_nfsservctl 192 .long sys_ni_syscall /* old nfsservctl */
193 .long sys_setresgid16 /* 170 */ 193 .long sys_setresgid16 /* 170 */
194 .long sys_getresgid16 194 .long sys_getresgid16
195 .long sys_prctl 195 .long sys_prctl
diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index 367ecee2f98..3384a5244fb 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -105,9 +105,6 @@ fp_fetoxm1(struct fp_ext *dest, struct fp_ext *src)
105 105
106 fp_monadic_check(dest, src); 106 fp_monadic_check(dest, src);
107 107
108 if (IS_ZERO(dest))
109 return dest;
110
111 return dest; 108 return dest;
112} 109}
113 110
diff --git a/arch/m68k/math-emu/multi_arith.h b/arch/m68k/math-emu/multi_arith.h
index 4ad0ca918e2..4b5eb3d8563 100644
--- a/arch/m68k/math-emu/multi_arith.h
+++ b/arch/m68k/math-emu/multi_arith.h
@@ -19,246 +19,6 @@
19#ifndef MULTI_ARITH_H 19#ifndef MULTI_ARITH_H
20#define MULTI_ARITH_H 20#define MULTI_ARITH_H
21 21
22#if 0 /* old code... */
23
24/* Unsigned only, because we don't need signs to multiply and divide. */
25typedef unsigned int int128[4];
26
27/* Word order */
28enum {
29 MSW128,
30 NMSW128,
31 NLSW128,
32 LSW128
33};
34
35/* big-endian */
36#define LO_WORD(ll) (((unsigned int *) &ll)[1])
37#define HI_WORD(ll) (((unsigned int *) &ll)[0])
38
39/* Convenience functions to stuff various integer values into int128s */
40
41static inline void zero128(int128 a)
42{
43 a[LSW128] = a[NLSW128] = a[NMSW128] = a[MSW128] = 0;
44}
45
46/* Human-readable word order in the arguments */
47static inline void set128(unsigned int i3, unsigned int i2, unsigned int i1,
48 unsigned int i0, int128 a)
49{
50 a[LSW128] = i0;
51 a[NLSW128] = i1;
52 a[NMSW128] = i2;
53 a[MSW128] = i3;
54}
55
56/* Convenience functions (for testing as well) */
57static inline void int64_to_128(unsigned long long src, int128 dest)
58{
59 dest[LSW128] = (unsigned int) src;
60 dest[NLSW128] = src >> 32;
61 dest[NMSW128] = dest[MSW128] = 0;
62}
63
64static inline void int128_to_64(const int128 src, unsigned long long *dest)
65{
66 *dest = src[LSW128] | (long long) src[NLSW128] << 32;
67}
68
69static inline void put_i128(const int128 a)
70{
71 printk("%08x %08x %08x %08x\n", a[MSW128], a[NMSW128],
72 a[NLSW128], a[LSW128]);
73}
74
75/* Internal shifters:
76
77 Note that these are only good for 0 < count < 32.
78 */
79
80static inline void _lsl128(unsigned int count, int128 a)
81{
82 a[MSW128] = (a[MSW128] << count) | (a[NMSW128] >> (32 - count));
83 a[NMSW128] = (a[NMSW128] << count) | (a[NLSW128] >> (32 - count));
84 a[NLSW128] = (a[NLSW128] << count) | (a[LSW128] >> (32 - count));
85 a[LSW128] <<= count;
86}
87
88static inline void _lsr128(unsigned int count, int128 a)
89{
90 a[LSW128] = (a[LSW128] >> count) | (a[NLSW128] << (32 - count));
91 a[NLSW128] = (a[NLSW128] >> count) | (a[NMSW128] << (32 - count));
92 a[NMSW128] = (a[NMSW128] >> count) | (a[MSW128] << (32 - count));
93 a[MSW128] >>= count;
94}
95
96/* Should be faster, one would hope */
97
98static inline void lslone128(int128 a)
99{
100 asm volatile ("lsl.l #1,%0\n"
101 "roxl.l #1,%1\n"
102 "roxl.l #1,%2\n"
103 "roxl.l #1,%3\n"
104 :
105 "=d" (a[LSW128]),
106 "=d"(a[NLSW128]),
107 "=d"(a[NMSW128]),
108 "=d"(a[MSW128])
109 :
110 "0"(a[LSW128]),
111 "1"(a[NLSW128]),
112 "2"(a[NMSW128]),
113 "3"(a[MSW128]));
114}
115
116static inline void lsrone128(int128 a)
117{
118 asm volatile ("lsr.l #1,%0\n"
119 "roxr.l #1,%1\n"
120 "roxr.l #1,%2\n"
121 "roxr.l #1,%3\n"
122 :
123 "=d" (a[MSW128]),
124 "=d"(a[NMSW128]),
125 "=d"(a[NLSW128]),
126 "=d"(a[LSW128])
127 :
128 "0"(a[MSW128]),
129 "1"(a[NMSW128]),
130 "2"(a[NLSW128]),
131 "3"(a[LSW128]));
132}
133
134/* Generalized 128-bit shifters:
135
136 These bit-shift to a multiple of 32, then move whole longwords. */
137
138static inline void lsl128(unsigned int count, int128 a)
139{
140 int wordcount, i;
141
142 if (count % 32)
143 _lsl128(count % 32, a);
144
145 if (0 == (wordcount = count / 32))
146 return;
147
148 /* argh, gak, endian-sensitive */
149 for (i = 0; i < 4 - wordcount; i++) {
150 a[i] = a[i + wordcount];
151 }
152 for (i = 3; i >= 4 - wordcount; --i) {
153 a[i] = 0;
154 }
155}
156
157static inline void lsr128(unsigned int count, int128 a)
158{
159 int wordcount, i;
160
161 if (count % 32)
162 _lsr128(count % 32, a);
163
164 if (0 == (wordcount = count / 32))
165 return;
166
167 for (i = 3; i >= wordcount; --i) {
168 a[i] = a[i - wordcount];
169 }
170 for (i = 0; i < wordcount; i++) {
171 a[i] = 0;
172 }
173}
174
175static inline int orl128(int a, int128 b)
176{
177 b[LSW128] |= a;
178}
179
180static inline int btsthi128(const int128 a)
181{
182 return a[MSW128] & 0x80000000;
183}
184
185/* test bits (numbered from 0 = LSB) up to and including "top" */
186static inline int bftestlo128(int top, const int128 a)
187{
188 int r = 0;
189
190 if (top > 31)
191 r |= a[LSW128];
192 if (top > 63)
193 r |= a[NLSW128];
194 if (top > 95)
195 r |= a[NMSW128];
196
197 r |= a[3 - (top / 32)] & ((1 << (top % 32 + 1)) - 1);
198
199 return (r != 0);
200}
201
202/* Aargh. We need these because GCC is broken */
203/* FIXME: do them in assembly, for goodness' sake! */
204static inline void mask64(int pos, unsigned long long *mask)
205{
206 *mask = 0;
207
208 if (pos < 32) {
209 LO_WORD(*mask) = (1 << pos) - 1;
210 return;
211 }
212 LO_WORD(*mask) = -1;
213 HI_WORD(*mask) = (1 << (pos - 32)) - 1;
214}
215
216static inline void bset64(int pos, unsigned long long *dest)
217{
218 /* This conditional will be optimized away. Thanks, GCC! */
219 if (pos < 32)
220 asm volatile ("bset %1,%0":"=m"
221 (LO_WORD(*dest)):"id"(pos));
222 else
223 asm volatile ("bset %1,%0":"=m"
224 (HI_WORD(*dest)):"id"(pos - 32));
225}
226
227static inline int btst64(int pos, unsigned long long dest)
228{
229 if (pos < 32)
230 return (0 != (LO_WORD(dest) & (1 << pos)));
231 else
232 return (0 != (HI_WORD(dest) & (1 << (pos - 32))));
233}
234
235static inline void lsl64(int count, unsigned long long *dest)
236{
237 if (count < 32) {
238 HI_WORD(*dest) = (HI_WORD(*dest) << count)
239 | (LO_WORD(*dest) >> count);
240 LO_WORD(*dest) <<= count;
241 return;
242 }
243 count -= 32;
244 HI_WORD(*dest) = LO_WORD(*dest) << count;
245 LO_WORD(*dest) = 0;
246}
247
248static inline void lsr64(int count, unsigned long long *dest)
249{
250 if (count < 32) {
251 LO_WORD(*dest) = (LO_WORD(*dest) >> count)
252 | (HI_WORD(*dest) << (32 - count));
253 HI_WORD(*dest) >>= count;
254 return;
255 }
256 count -= 32;
257 LO_WORD(*dest) = HI_WORD(*dest) >> count;
258 HI_WORD(*dest) = 0;
259}
260#endif
261
262static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt) 22static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt)
263{ 23{
264 reg->exp += cnt; 24 reg->exp += cnt;
@@ -481,117 +241,6 @@ static inline void fp_dividemant(union fp_mant128 *dest, struct fp_ext *src,
481 } 241 }
482} 242}
483 243
484#if 0
485static inline unsigned int fp_fls128(union fp_mant128 *src)
486{
487 unsigned long data;
488 unsigned int res, off;
489
490 if ((data = src->m32[0]))
491 off = 0;
492 else if ((data = src->m32[1]))
493 off = 32;
494 else if ((data = src->m32[2]))
495 off = 64;
496 else if ((data = src->m32[3]))
497 off = 96;
498 else
499 return 128;
500
501 asm ("bfffo %1{#0,#32},%0" : "=d" (res) : "dm" (data));
502 return res + off;
503}
504
505static inline void fp_shiftmant128(union fp_mant128 *src, int shift)
506{
507 unsigned long sticky;
508
509 switch (shift) {
510 case 0:
511 return;
512 case 1:
513 asm volatile ("lsl.l #1,%0"
514 : "=d" (src->m32[3]) : "0" (src->m32[3]));
515 asm volatile ("roxl.l #1,%0"
516 : "=d" (src->m32[2]) : "0" (src->m32[2]));
517 asm volatile ("roxl.l #1,%0"
518 : "=d" (src->m32[1]) : "0" (src->m32[1]));
519 asm volatile ("roxl.l #1,%0"
520 : "=d" (src->m32[0]) : "0" (src->m32[0]));
521 return;
522 case 2 ... 31:
523 src->m32[0] = (src->m32[0] << shift) | (src->m32[1] >> (32 - shift));
524 src->m32[1] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift));
525 src->m32[2] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
526 src->m32[3] = (src->m32[3] << shift);
527 return;
528 case 32 ... 63:
529 shift -= 32;
530 src->m32[0] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift));
531 src->m32[1] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
532 src->m32[2] = (src->m32[3] << shift);
533 src->m32[3] = 0;
534 return;
535 case 64 ... 95:
536 shift -= 64;
537 src->m32[0] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
538 src->m32[1] = (src->m32[3] << shift);
539 src->m32[2] = src->m32[3] = 0;
540 return;
541 case 96 ... 127:
542 shift -= 96;
543 src->m32[0] = (src->m32[3] << shift);
544 src->m32[1] = src->m32[2] = src->m32[3] = 0;
545 return;
546 case -31 ... -1:
547 shift = -shift;
548 sticky = 0;
549 if (src->m32[3] << (32 - shift))
550 sticky = 1;
551 src->m32[3] = (src->m32[3] >> shift) | (src->m32[2] << (32 - shift)) | sticky;
552 src->m32[2] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift));
553 src->m32[1] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift));
554 src->m32[0] = (src->m32[0] >> shift);
555 return;
556 case -63 ... -32:
557 shift = -shift - 32;
558 sticky = 0;
559 if ((src->m32[2] << (32 - shift)) || src->m32[3])
560 sticky = 1;
561 src->m32[3] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift)) | sticky;
562 src->m32[2] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift));
563 src->m32[1] = (src->m32[0] >> shift);
564 src->m32[0] = 0;
565 return;
566 case -95 ... -64:
567 shift = -shift - 64;
568 sticky = 0;
569 if ((src->m32[1] << (32 - shift)) || src->m32[2] || src->m32[3])
570 sticky = 1;
571 src->m32[3] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)) | sticky;
572 src->m32[2] = (src->m32[0] >> shift);
573 src->m32[1] = src->m32[0] = 0;
574 return;
575 case -127 ... -96:
576 shift = -shift - 96;
577 sticky = 0;
578 if ((src->m32[0] << (32 - shift)) || src->m32[1] || src->m32[2] || src->m32[3])
579 sticky = 1;
580 src->m32[3] = (src->m32[0] >> shift) | sticky;
581 src->m32[2] = src->m32[1] = src->m32[0] = 0;
582 return;
583 }
584
585 if (shift < 0 && (src->m32[0] || src->m32[1] || src->m32[2] || src->m32[3]))
586 src->m32[3] = 1;
587 else
588 src->m32[3] = 0;
589 src->m32[2] = 0;
590 src->m32[1] = 0;
591 src->m32[0] = 0;
592}
593#endif
594
595static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src, 244static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src,
596 int shift) 245 int shift)
597{ 246{
@@ -637,183 +286,4 @@ static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src,
637 } 286 }
638} 287}
639 288
640#if 0 /* old code... */
641static inline int fls(unsigned int a)
642{
643 int r;
644
645 asm volatile ("bfffo %1{#0,#32},%0"
646 : "=d" (r) : "md" (a));
647 return r;
648}
649
650/* fls = "find last set" (cf. ffs(3)) */
651static inline int fls128(const int128 a)
652{
653 if (a[MSW128])
654 return fls(a[MSW128]);
655 if (a[NMSW128])
656 return fls(a[NMSW128]) + 32;
657 /* XXX: it probably never gets beyond this point in actual
658 use, but that's indicative of a more general problem in the
659 algorithm (i.e. as per the actual 68881 implementation, we
660 really only need at most 67 bits of precision [plus
661 overflow]) so I'm not going to fix it. */
662 if (a[NLSW128])
663 return fls(a[NLSW128]) + 64;
664 if (a[LSW128])
665 return fls(a[LSW128]) + 96;
666 else
667 return -1;
668}
669
670static inline int zerop128(const int128 a)
671{
672 return !(a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]);
673}
674
675static inline int nonzerop128(const int128 a)
676{
677 return (a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]);
678}
679
680/* Addition and subtraction */
681/* Do these in "pure" assembly, because "extended" asm is unmanageable
682 here */
683static inline void add128(const int128 a, int128 b)
684{
685 /* rotating carry flags */
686 unsigned int carry[2];
687
688 carry[0] = a[LSW128] > (0xffffffff - b[LSW128]);
689 b[LSW128] += a[LSW128];
690
691 carry[1] = a[NLSW128] > (0xffffffff - b[NLSW128] - carry[0]);
692 b[NLSW128] = a[NLSW128] + b[NLSW128] + carry[0];
693
694 carry[0] = a[NMSW128] > (0xffffffff - b[NMSW128] - carry[1]);
695 b[NMSW128] = a[NMSW128] + b[NMSW128] + carry[1];
696
697 b[MSW128] = a[MSW128] + b[MSW128] + carry[0];
698}
699
700/* Note: assembler semantics: "b -= a" */
701static inline void sub128(const int128 a, int128 b)
702{
703 /* rotating borrow flags */
704 unsigned int borrow[2];
705
706 borrow[0] = b[LSW128] < a[LSW128];
707 b[LSW128] -= a[LSW128];
708
709 borrow[1] = b[NLSW128] < a[NLSW128] + borrow[0];
710 b[NLSW128] = b[NLSW128] - a[NLSW128] - borrow[0];
711
712 borrow[0] = b[NMSW128] < a[NMSW128] + borrow[1];
713 b[NMSW128] = b[NMSW128] - a[NMSW128] - borrow[1];
714
715 b[MSW128] = b[MSW128] - a[MSW128] - borrow[0];
716}
717
718/* Poor man's 64-bit expanding multiply */
719static inline void mul64(unsigned long long a, unsigned long long b, int128 c)
720{
721 unsigned long long acc;
722 int128 acc128;
723
724 zero128(acc128);
725 zero128(c);
726
727 /* first the low words */
728 if (LO_WORD(a) && LO_WORD(b)) {
729 acc = (long long) LO_WORD(a) * LO_WORD(b);
730 c[NLSW128] = HI_WORD(acc);
731 c[LSW128] = LO_WORD(acc);
732 }
733 /* Next the high words */
734 if (HI_WORD(a) && HI_WORD(b)) {
735 acc = (long long) HI_WORD(a) * HI_WORD(b);
736 c[MSW128] = HI_WORD(acc);
737 c[NMSW128] = LO_WORD(acc);
738 }
739 /* The middle words */
740 if (LO_WORD(a) && HI_WORD(b)) {
741 acc = (long long) LO_WORD(a) * HI_WORD(b);
742 acc128[NMSW128] = HI_WORD(acc);
743 acc128[NLSW128] = LO_WORD(acc);
744 add128(acc128, c);
745 }
746 /* The first and last words */
747 if (HI_WORD(a) && LO_WORD(b)) {
748 acc = (long long) HI_WORD(a) * LO_WORD(b);
749 acc128[NMSW128] = HI_WORD(acc);
750 acc128[NLSW128] = LO_WORD(acc);
751 add128(acc128, c);
752 }
753}
754
755/* Note: unsigned */
756static inline int cmp128(int128 a, int128 b)
757{
758 if (a[MSW128] < b[MSW128])
759 return -1;
760 if (a[MSW128] > b[MSW128])
761 return 1;
762 if (a[NMSW128] < b[NMSW128])
763 return -1;
764 if (a[NMSW128] > b[NMSW128])
765 return 1;
766 if (a[NLSW128] < b[NLSW128])
767 return -1;
768 if (a[NLSW128] > b[NLSW128])
769 return 1;
770
771 return (signed) a[LSW128] - b[LSW128];
772}
773
774inline void div128(int128 a, int128 b, int128 c)
775{
776 int128 mask;
777
778 /* Algorithm:
779
780 Shift the divisor until it's at least as big as the
781 dividend, keeping track of the position to which we've
782 shifted it, i.e. the power of 2 which we've multiplied it
783 by.
784
785 Then, for this power of 2 (the mask), and every one smaller
786 than it, subtract the mask from the dividend and add it to
787 the quotient until the dividend is smaller than the raised
788 divisor. At this point, divide the dividend and the mask
789 by 2 (i.e. shift one place to the right). Lather, rinse,
790 and repeat, until there are no more powers of 2 left. */
791
792 /* FIXME: needless to say, there's room for improvement here too. */
793
794 /* Shift up */
795 /* XXX: since it just has to be "at least as big", we can
796 probably eliminate this horribly wasteful loop. I will
797 have to prove this first, though */
798 set128(0, 0, 0, 1, mask);
799 while (cmp128(b, a) < 0 && !btsthi128(b)) {
800 lslone128(b);
801 lslone128(mask);
802 }
803
804 /* Shift down */
805 zero128(c);
806 do {
807 if (cmp128(a, b) >= 0) {
808 sub128(b, a);
809 add128(mask, c);
810 }
811 lsrone128(mask);
812 lsrone128(b);
813 } while (nonzerop128(mask));
814
815 /* The remainder is in a... */
816}
817#endif
818
819#endif /* MULTI_ARITH_H */ 289#endif /* MULTI_ARITH_H */
diff --git a/arch/m68k/mm/init_mm.c b/arch/m68k/mm/init_mm.c
index 9113c2f1760..bbe525434cc 100644
--- a/arch/m68k/mm/init_mm.c
+++ b/arch/m68k/mm/init_mm.c
@@ -83,11 +83,6 @@ void __init mem_init(void)
83 int initpages = 0; 83 int initpages = 0;
84 int i; 84 int i;
85 85
86#ifdef CONFIG_ATARI
87 if (MACH_IS_ATARI)
88 atari_stram_mem_init_hook();
89#endif
90
91 /* this will put all memory onto the freelists */ 86 /* this will put all memory onto the freelists */
92 totalram_pages = num_physpages = 0; 87 totalram_pages = num_physpages = 0;
93 for_each_online_pgdat(pgdat) { 88 for_each_online_pgdat(pgdat) {
diff --git a/arch/microblaze/include/asm/cpuinfo.h b/arch/microblaze/include/asm/cpuinfo.h
index d8f013347a9..7d6831ac8a4 100644
--- a/arch/microblaze/include/asm/cpuinfo.h
+++ b/arch/microblaze/include/asm/cpuinfo.h
@@ -38,6 +38,7 @@ struct cpuinfo {
38 u32 use_exc; 38 u32 use_exc;
39 u32 ver_code; 39 u32 ver_code;
40 u32 mmu; 40 u32 mmu;
41 u32 mmu_privins;
41 u32 endian; 42 u32 endian;
42 43
43 /* CPU caches */ 44 /* CPU caches */
diff --git a/arch/microblaze/include/asm/irqflags.h b/arch/microblaze/include/asm/irqflags.h
index c4532f032b3..c9a6262832c 100644
--- a/arch/microblaze/include/asm/irqflags.h
+++ b/arch/microblaze/include/asm/irqflags.h
@@ -14,7 +14,7 @@
14 14
15#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 15#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
16 16
17static inline unsigned long arch_local_irq_save(void) 17static inline notrace unsigned long arch_local_irq_save(void)
18{ 18{
19 unsigned long flags; 19 unsigned long flags;
20 asm volatile(" msrclr %0, %1 \n" 20 asm volatile(" msrclr %0, %1 \n"
@@ -25,7 +25,7 @@ static inline unsigned long arch_local_irq_save(void)
25 return flags; 25 return flags;
26} 26}
27 27
28static inline void arch_local_irq_disable(void) 28static inline notrace void arch_local_irq_disable(void)
29{ 29{
30 /* this uses r0 without declaring it - is that correct? */ 30 /* this uses r0 without declaring it - is that correct? */
31 asm volatile(" msrclr r0, %0 \n" 31 asm volatile(" msrclr r0, %0 \n"
@@ -35,7 +35,7 @@ static inline void arch_local_irq_disable(void)
35 : "memory"); 35 : "memory");
36} 36}
37 37
38static inline void arch_local_irq_enable(void) 38static inline notrace void arch_local_irq_enable(void)
39{ 39{
40 /* this uses r0 without declaring it - is that correct? */ 40 /* this uses r0 without declaring it - is that correct? */
41 asm volatile(" msrset r0, %0 \n" 41 asm volatile(" msrset r0, %0 \n"
@@ -47,7 +47,7 @@ static inline void arch_local_irq_enable(void)
47 47
48#else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ 48#else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
49 49
50static inline unsigned long arch_local_irq_save(void) 50static inline notrace unsigned long arch_local_irq_save(void)
51{ 51{
52 unsigned long flags, tmp; 52 unsigned long flags, tmp;
53 asm volatile (" mfs %0, rmsr \n" 53 asm volatile (" mfs %0, rmsr \n"
@@ -61,7 +61,7 @@ static inline unsigned long arch_local_irq_save(void)
61 return flags; 61 return flags;
62} 62}
63 63
64static inline void arch_local_irq_disable(void) 64static inline notrace void arch_local_irq_disable(void)
65{ 65{
66 unsigned long tmp; 66 unsigned long tmp;
67 asm volatile(" mfs %0, rmsr \n" 67 asm volatile(" mfs %0, rmsr \n"
@@ -74,7 +74,7 @@ static inline void arch_local_irq_disable(void)
74 : "memory"); 74 : "memory");
75} 75}
76 76
77static inline void arch_local_irq_enable(void) 77static inline notrace void arch_local_irq_enable(void)
78{ 78{
79 unsigned long tmp; 79 unsigned long tmp;
80 asm volatile(" mfs %0, rmsr \n" 80 asm volatile(" mfs %0, rmsr \n"
@@ -89,7 +89,7 @@ static inline void arch_local_irq_enable(void)
89 89
90#endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ 90#endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
91 91
92static inline unsigned long arch_local_save_flags(void) 92static inline notrace unsigned long arch_local_save_flags(void)
93{ 93{
94 unsigned long flags; 94 unsigned long flags;
95 asm volatile(" mfs %0, rmsr \n" 95 asm volatile(" mfs %0, rmsr \n"
@@ -100,7 +100,7 @@ static inline unsigned long arch_local_save_flags(void)
100 return flags; 100 return flags;
101} 101}
102 102
103static inline void arch_local_irq_restore(unsigned long flags) 103static inline notrace void arch_local_irq_restore(unsigned long flags)
104{ 104{
105 asm volatile(" mts rmsr, %0 \n" 105 asm volatile(" mts rmsr, %0 \n"
106 " nop \n" 106 " nop \n"
@@ -109,12 +109,12 @@ static inline void arch_local_irq_restore(unsigned long flags)
109 : "memory"); 109 : "memory");
110} 110}
111 111
112static inline bool arch_irqs_disabled_flags(unsigned long flags) 112static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
113{ 113{
114 return (flags & MSR_IE) == 0; 114 return (flags & MSR_IE) == 0;
115} 115}
116 116
117static inline bool arch_irqs_disabled(void) 117static inline notrace bool arch_irqs_disabled(void)
118{ 118{
119 return arch_irqs_disabled_flags(arch_local_save_flags()); 119 return arch_irqs_disabled_flags(arch_local_save_flags());
120} 120}
diff --git a/arch/microblaze/include/asm/mmu_context_mm.h b/arch/microblaze/include/asm/mmu_context_mm.h
index 3e5c254e8d1..d6864774644 100644
--- a/arch/microblaze/include/asm/mmu_context_mm.h
+++ b/arch/microblaze/include/asm/mmu_context_mm.h
@@ -11,7 +11,7 @@
11#ifndef _ASM_MICROBLAZE_MMU_CONTEXT_H 11#ifndef _ASM_MICROBLAZE_MMU_CONTEXT_H
12#define _ASM_MICROBLAZE_MMU_CONTEXT_H 12#define _ASM_MICROBLAZE_MMU_CONTEXT_H
13 13
14#include <asm/atomic.h> 14#include <linux/atomic.h>
15#include <asm/bitops.h> 15#include <asm/bitops.h>
16#include <asm/mmu.h> 16#include <asm/mmu.h>
17#include <asm-generic/mm_hooks.h> 17#include <asm-generic/mm_hooks.h>
diff --git a/arch/microblaze/include/asm/pci-bridge.h b/arch/microblaze/include/asm/pci-bridge.h
index 242be57a319..32764cd077c 100644
--- a/arch/microblaze/include/asm/pci-bridge.h
+++ b/arch/microblaze/include/asm/pci-bridge.h
@@ -10,28 +10,19 @@
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/ioport.h> 12#include <linux/ioport.h>
13#include <asm-generic/pci-bridge.h>
13 14
14struct device_node; 15struct device_node;
15 16
16enum { 17#ifdef CONFIG_PCI
17 /* Force re-assigning all resources (ignore firmware 18extern struct list_head hose_list;
18 * setup completely) 19extern int pcibios_vaddr_is_ioport(void __iomem *address);
19 */ 20#else
20 PCI_REASSIGN_ALL_RSRC = 0x00000001, 21static inline int pcibios_vaddr_is_ioport(void __iomem *address)
21 22{
22 /* Do not try to assign, just use existing setup */ 23 return 0;
23 PCI_PROBE_ONLY = 0x00000004, 24}
24 25#endif
25 /* Don't bother with ISA alignment unless the bridge has
26 * ISA forwarding enabled
27 */
28 PCI_CAN_SKIP_ISA_ALIGN = 0x00000008,
29
30 /* Enable domain numbers in /proc */
31 PCI_ENABLE_PROC_DOMAINS = 0x00000010,
32 /* ... except for domain 0 */
33 PCI_COMPAT_DOMAIN_0 = 0x00000020,
34};
35 26
36/* 27/*
37 * Structure of a PCI controller (host bridge) 28 * Structure of a PCI controller (host bridge)
@@ -151,40 +142,5 @@ extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev);
151extern void pcibios_free_controller(struct pci_controller *phb); 142extern void pcibios_free_controller(struct pci_controller *phb);
152extern void pcibios_setup_phb_resources(struct pci_controller *hose); 143extern void pcibios_setup_phb_resources(struct pci_controller *hose);
153 144
154#ifdef CONFIG_PCI
155extern unsigned int pci_flags;
156
157static inline void pci_set_flags(int flags)
158{
159 pci_flags = flags;
160}
161
162static inline void pci_add_flags(int flags)
163{
164 pci_flags |= flags;
165}
166
167static inline int pci_has_flag(int flag)
168{
169 return pci_flags & flag;
170}
171
172extern struct list_head hose_list;
173
174extern int pcibios_vaddr_is_ioport(void __iomem *address);
175#else
176static inline int pcibios_vaddr_is_ioport(void __iomem *address)
177{
178 return 0;
179}
180
181static inline void pci_set_flags(int flags) { }
182static inline void pci_add_flags(int flags) { }
183static inline int pci_has_flag(int flag)
184{
185 return 0;
186}
187#endif /* CONFIG_PCI */
188
189#endif /* __KERNEL__ */ 145#endif /* __KERNEL__ */
190#endif /* _ASM_MICROBLAZE_PCI_BRIDGE_H */ 146#endif /* _ASM_MICROBLAZE_PCI_BRIDGE_H */
diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h
index aed2a6be8e2..7283bfb2f7e 100644
--- a/arch/microblaze/include/asm/processor.h
+++ b/arch/microblaze/include/asm/processor.h
@@ -125,9 +125,6 @@ struct thread_struct {
125 .pgdir = swapper_pg_dir, \ 125 .pgdir = swapper_pg_dir, \
126} 126}
127 127
128/* Do necessary setup to start up a newly executed thread. */
129void start_thread(struct pt_regs *regs,
130 unsigned long pc, unsigned long usp);
131 128
132/* Free all resources held by a thread. */ 129/* Free all resources held by a thread. */
133extern inline void release_thread(struct task_struct *dead_task) 130extern inline void release_thread(struct task_struct *dead_task)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 9bd01ecb00d..20c5e8e5121 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -21,13 +21,17 @@
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25 25
26#define HAVE_ARCH_DEVTREE_FIXUPS 26#define HAVE_ARCH_DEVTREE_FIXUPS
27 27
28/* Other Prototypes */ 28/* Other Prototypes */
29extern int early_uartlite_console(void); 29enum early_consoles {
30extern int early_uart16550_console(void); 30 UARTLITE = 1,
31 UART16550 = 2,
32};
33
34extern int of_early_console(void *version);
31 35
32/* 36/*
33 * OF address retreival & translation 37 * OF address retreival & translation
diff --git a/arch/microblaze/include/asm/ptrace.h b/arch/microblaze/include/asm/ptrace.h
index d9b66304d5d..816bee64b19 100644
--- a/arch/microblaze/include/asm/ptrace.h
+++ b/arch/microblaze/include/asm/ptrace.h
@@ -61,8 +61,6 @@ struct pt_regs {
61#define instruction_pointer(regs) ((regs)->pc) 61#define instruction_pointer(regs) ((regs)->pc)
62#define profile_pc(regs) instruction_pointer(regs) 62#define profile_pc(regs) instruction_pointer(regs)
63 63
64void show_regs(struct pt_regs *);
65
66#else /* __KERNEL__ */ 64#else /* __KERNEL__ */
67 65
68/* pt_regs offsets used by gdbserver etc in ptrace syscalls */ 66/* pt_regs offsets used by gdbserver etc in ptrace syscalls */
diff --git a/arch/microblaze/include/asm/pvr.h b/arch/microblaze/include/asm/pvr.h
index a10bec62e85..4bbdb4c03b5 100644
--- a/arch/microblaze/include/asm/pvr.h
+++ b/arch/microblaze/include/asm/pvr.h
@@ -111,16 +111,16 @@ struct pvr_s {
111/* Target family PVR mask */ 111/* Target family PVR mask */
112#define PVR10_TARGET_FAMILY_MASK 0xFF000000 112#define PVR10_TARGET_FAMILY_MASK 0xFF000000
113 113
114/* MMU descrtiption */ 114/* MMU description */
115#define PVR11_USE_MMU 0xC0000000 115#define PVR11_USE_MMU 0xC0000000
116#define PVR11_MMU_ITLB_SIZE 0x38000000 116#define PVR11_MMU_ITLB_SIZE 0x38000000
117#define PVR11_MMU_DTLB_SIZE 0x07000000 117#define PVR11_MMU_DTLB_SIZE 0x07000000
118#define PVR11_MMU_TLB_ACCESS 0x00C00000 118#define PVR11_MMU_TLB_ACCESS 0x00C00000
119#define PVR11_MMU_ZONES 0x003C0000 119#define PVR11_MMU_ZONES 0x003C0000
120#define PVR11_MMU_PRIVINS 0x00010000
120/* MSR Reset value PVR mask */ 121/* MSR Reset value PVR mask */
121#define PVR11_MSR_RESET_VALUE_MASK 0x000007FF 122#define PVR11_MSR_RESET_VALUE_MASK 0x000007FF
122 123
123
124/* PVR access macros */ 124/* PVR access macros */
125#define PVR_IS_FULL(_pvr) (_pvr.pvr[0] & PVR0_PVR_FULL_MASK) 125#define PVR_IS_FULL(_pvr) (_pvr.pvr[0] & PVR0_PVR_FULL_MASK)
126#define PVR_USE_BARREL(_pvr) (_pvr.pvr[0] & PVR0_USE_BARREL_MASK) 126#define PVR_USE_BARREL(_pvr) (_pvr.pvr[0] & PVR0_USE_BARREL_MASK)
@@ -216,6 +216,7 @@ struct pvr_s {
216#define PVR_MMU_DTLB_SIZE(_pvr) (_pvr.pvr[11] & PVR11_MMU_DTLB_SIZE) 216#define PVR_MMU_DTLB_SIZE(_pvr) (_pvr.pvr[11] & PVR11_MMU_DTLB_SIZE)
217#define PVR_MMU_TLB_ACCESS(_pvr) (_pvr.pvr[11] & PVR11_MMU_TLB_ACCESS) 217#define PVR_MMU_TLB_ACCESS(_pvr) (_pvr.pvr[11] & PVR11_MMU_TLB_ACCESS)
218#define PVR_MMU_ZONES(_pvr) (_pvr.pvr[11] & PVR11_MMU_ZONES) 218#define PVR_MMU_ZONES(_pvr) (_pvr.pvr[11] & PVR11_MMU_ZONES)
219#define PVR_MMU_PRIVINS(pvr) (pvr.pvr[11] & PVR11_MMU_PRIVINS)
219 220
220/* endian */ 221/* endian */
221#define PVR_ENDIAN(_pvr) (_pvr.pvr[0] & PVR0_ENDI) 222#define PVR_ENDIAN(_pvr) (_pvr.pvr[0] & PVR0_ENDI)
diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h
index 8f3968971e4..904e5ef6a11 100644
--- a/arch/microblaze/include/asm/setup.h
+++ b/arch/microblaze/include/asm/setup.h
@@ -23,6 +23,7 @@ extern char cmd_line[COMMAND_LINE_SIZE];
23void early_printk(const char *fmt, ...); 23void early_printk(const char *fmt, ...);
24 24
25int setup_early_printk(char *opt); 25int setup_early_printk(char *opt);
26void remap_early_printk(void);
26void disable_early_printk(void); 27void disable_early_printk(void);
27 28
28#if defined(CONFIG_EARLY_PRINTK) 29#if defined(CONFIG_EARLY_PRINTK)
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
index f70a6047f08..916aaedf194 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
@@ -72,6 +72,7 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
72 CI(pvr_user2, USER2); 72 CI(pvr_user2, USER2);
73 73
74 CI(mmu, USE_MMU); 74 CI(mmu, USE_MMU);
75 CI(mmu_privins, MMU_PRIVINS);
75 CI(endian, ENDIAN); 76 CI(endian, ENDIAN);
76 77
77 CI(use_icache, USE_ICACHE); 78 CI(use_icache, USE_ICACHE);
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c
index b16b994ca3d..592bb2e838c 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-static.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
@@ -119,6 +119,7 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
119 ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2"); 119 ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2");
120 120
121 ci->mmu = fcpu(cpu, "xlnx,use-mmu"); 121 ci->mmu = fcpu(cpu, "xlnx,use-mmu");
122 ci->mmu_privins = fcpu(cpu, "xlnx,mmu-privileged-instr");
122 ci->endian = fcpu(cpu, "xlnx,endianness"); 123 ci->endian = fcpu(cpu, "xlnx,endianness");
123 124
124 ci->ver_code = 0; 125 ci->ver_code = 0;
diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c
index c1640c52711..44394d80a68 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo.c
@@ -88,4 +88,8 @@ void __init setup_cpuinfo(void)
88 printk(KERN_WARNING "%s: Unsupported PVR setting\n", __func__); 88 printk(KERN_WARNING "%s: Unsupported PVR setting\n", __func__);
89 set_cpuinfo_static(&cpuinfo, cpu); 89 set_cpuinfo_static(&cpuinfo, cpu);
90 } 90 }
91
92 if (cpuinfo.mmu_privins)
93 printk(KERN_WARNING "%s: Stream instructions enabled"
94 " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__);
91} 95}
diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
index b4048af0261..7b5dca7ed39 100644
--- a/arch/microblaze/kernel/cpu/mb.c
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -97,6 +97,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
97 (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "", 97 (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
98 (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : ""); 98 (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
99 99
100 count += seq_printf(m,
101 "Stream-insns:\t%sprivileged\n",
102 cpuinfo.mmu_privins ? "un" : "");
103
100 if (cpuinfo.use_icache) 104 if (cpuinfo.use_icache)
101 count += seq_printf(m, 105 count += seq_printf(m,
102 "Icache:\t\t%ukB\tline length:\t%dB\n", 106 "Icache:\t\t%ukB\tline length:\t%dB\n",
@@ -110,10 +114,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
110 "Dcache:\t\t%ukB\tline length:\t%dB\n", 114 "Dcache:\t\t%ukB\tline length:\t%dB\n",
111 cpuinfo.dcache_size >> 10, 115 cpuinfo.dcache_size >> 10,
112 cpuinfo.dcache_line_length); 116 cpuinfo.dcache_line_length);
117 seq_printf(m, "Dcache-Policy:\t");
113 if (cpuinfo.dcache_wb) 118 if (cpuinfo.dcache_wb)
114 count += seq_printf(m, "\t\twrite-back\n"); 119 count += seq_printf(m, "write-back\n");
115 else 120 else
116 count += seq_printf(m, "\t\twrite-through\n"); 121 count += seq_printf(m, "write-through\n");
117 } else 122 } else
118 count += seq_printf(m, "Dcache:\t\tno\n"); 123 count += seq_printf(m, "Dcache:\t\tno\n");
119 124
diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
index c3616a080eb..d26d92d4775 100644
--- a/arch/microblaze/kernel/early_printk.c
+++ b/arch/microblaze/kernel/early_printk.c
@@ -35,7 +35,7 @@ static void early_printk_uartlite_putc(char c)
35 * we'll never timeout on a working UART. 35 * we'll never timeout on a working UART.
36 */ 36 */
37 37
38 unsigned retries = 10000; 38 unsigned retries = 1000000;
39 /* read status bit - 0x8 offset */ 39 /* read status bit - 0x8 offset */
40 while (--retries && (in_be32(base_addr + 8) & (1 << 3))) 40 while (--retries && (in_be32(base_addr + 8) & (1 << 3)))
41 ; 41 ;
@@ -60,7 +60,7 @@ static void early_printk_uartlite_write(struct console *unused,
60static struct console early_serial_uartlite_console = { 60static struct console early_serial_uartlite_console = {
61 .name = "earlyser", 61 .name = "earlyser",
62 .write = early_printk_uartlite_write, 62 .write = early_printk_uartlite_write,
63 .flags = CON_PRINTBUFFER, 63 .flags = CON_PRINTBUFFER | CON_BOOT,
64 .index = -1, 64 .index = -1,
65}; 65};
66#endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */ 66#endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */
@@ -104,7 +104,7 @@ static void early_printk_uart16550_write(struct console *unused,
104static struct console early_serial_uart16550_console = { 104static struct console early_serial_uart16550_console = {
105 .name = "earlyser", 105 .name = "earlyser",
106 .write = early_printk_uart16550_write, 106 .write = early_printk_uart16550_write,
107 .flags = CON_PRINTBUFFER, 107 .flags = CON_PRINTBUFFER | CON_BOOT,
108 .index = -1, 108 .index = -1,
109}; 109};
110#endif /* CONFIG_SERIAL_8250_CONSOLE */ 110#endif /* CONFIG_SERIAL_8250_CONSOLE */
@@ -127,48 +127,56 @@ void early_printk(const char *fmt, ...)
127 127
128int __init setup_early_printk(char *opt) 128int __init setup_early_printk(char *opt)
129{ 129{
130 int version = 0;
131
130 if (early_console_initialized) 132 if (early_console_initialized)
131 return 1; 133 return 1;
132 134
133#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE 135 base_addr = of_early_console(&version);
134 base_addr = early_uartlite_console();
135 if (base_addr) { 136 if (base_addr) {
136 early_console_initialized = 1;
137#ifdef CONFIG_MMU 137#ifdef CONFIG_MMU
138 early_console_reg_tlb_alloc(base_addr); 138 early_console_reg_tlb_alloc(base_addr);
139#endif 139#endif
140 early_console = &early_serial_uartlite_console; 140 switch (version) {
141 early_printk("early_printk_console is enabled at 0x%08x\n", 141#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
142 base_addr); 142 case UARTLITE:
143 143 printk(KERN_INFO "Early console on uartlite "
144 /* register_console(early_console); */ 144 "at 0x%08x\n", base_addr);
145 145 early_console = &early_serial_uartlite_console;
146 return 0; 146 break;
147 } 147#endif
148#endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */
149
150#ifdef CONFIG_SERIAL_8250_CONSOLE 148#ifdef CONFIG_SERIAL_8250_CONSOLE
151 base_addr = early_uart16550_console(); 149 case UART16550:
152 base_addr &= ~3; /* clear register offset */ 150 printk(KERN_INFO "Early console on uart16650 "
153 if (base_addr) { 151 "at 0x%08x\n", base_addr);
154 early_console_initialized = 1; 152 early_console = &early_serial_uart16550_console;
155#ifdef CONFIG_MMU 153 break;
156 early_console_reg_tlb_alloc(base_addr);
157#endif 154#endif
158 early_console = &early_serial_uart16550_console; 155 default:
159 156 printk(KERN_INFO "Unsupported early console %d\n",
160 early_printk("early_printk_console is enabled at 0x%08x\n", 157 version);
161 base_addr); 158 return 1;
162 159 }
163 /* register_console(early_console); */
164 160
161 register_console(early_console);
162 early_console_initialized = 1;
165 return 0; 163 return 0;
166 } 164 }
167#endif /* CONFIG_SERIAL_8250_CONSOLE */
168
169 return 1; 165 return 1;
170} 166}
171 167
168/* Remap early console to virtual address and do not allocate one TLB
169 * only for early console because of performance degression */
170void __init remap_early_printk(void)
171{
172 if (!early_console_initialized || !early_console)
173 return;
174 printk(KERN_INFO "early_printk_console remaping from 0x%x to ",
175 base_addr);
176 base_addr = (u32) ioremap(base_addr, PAGE_SIZE);
177 printk(KERN_CONT "0x%x\n", base_addr);
178}
179
172void __init disable_early_printk(void) 180void __init disable_early_printk(void)
173{ 181{
174 if (!early_console_initialized || !early_console) 182 if (!early_console_initialized || !early_console)
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index 56572e923a8..e62be837960 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -1113,23 +1113,23 @@ lw_r10_vm: R3_TO_LWREG_VM_V (10);
1113lw_r11_vm: R3_TO_LWREG_VM_V (11); 1113lw_r11_vm: R3_TO_LWREG_VM_V (11);
1114lw_r12_vm: R3_TO_LWREG_VM_V (12); 1114lw_r12_vm: R3_TO_LWREG_VM_V (12);
1115lw_r13_vm: R3_TO_LWREG_VM_V (13); 1115lw_r13_vm: R3_TO_LWREG_VM_V (13);
1116lw_r14_vm: R3_TO_LWREG_VM (14); 1116lw_r14_vm: R3_TO_LWREG_VM_V (14);
1117lw_r15_vm: R3_TO_LWREG_VM_V (15); 1117lw_r15_vm: R3_TO_LWREG_VM_V (15);
1118lw_r16_vm: R3_TO_LWREG_VM (16); 1118lw_r16_vm: R3_TO_LWREG_VM_V (16);
1119lw_r17_vm: R3_TO_LWREG_VM_V (17); 1119lw_r17_vm: R3_TO_LWREG_VM_V (17);
1120lw_r18_vm: R3_TO_LWREG_VM_V (18); 1120lw_r18_vm: R3_TO_LWREG_VM_V (18);
1121lw_r19_vm: R3_TO_LWREG_VM (19); 1121lw_r19_vm: R3_TO_LWREG_VM_V (19);
1122lw_r20_vm: R3_TO_LWREG_VM (20); 1122lw_r20_vm: R3_TO_LWREG_VM_V (20);
1123lw_r21_vm: R3_TO_LWREG_VM (21); 1123lw_r21_vm: R3_TO_LWREG_VM_V (21);
1124lw_r22_vm: R3_TO_LWREG_VM (22); 1124lw_r22_vm: R3_TO_LWREG_VM_V (22);
1125lw_r23_vm: R3_TO_LWREG_VM (23); 1125lw_r23_vm: R3_TO_LWREG_VM_V (23);
1126lw_r24_vm: R3_TO_LWREG_VM (24); 1126lw_r24_vm: R3_TO_LWREG_VM_V (24);
1127lw_r25_vm: R3_TO_LWREG_VM (25); 1127lw_r25_vm: R3_TO_LWREG_VM_V (25);
1128lw_r26_vm: R3_TO_LWREG_VM (26); 1128lw_r26_vm: R3_TO_LWREG_VM_V (26);
1129lw_r27_vm: R3_TO_LWREG_VM (27); 1129lw_r27_vm: R3_TO_LWREG_VM_V (27);
1130lw_r28_vm: R3_TO_LWREG_VM (28); 1130lw_r28_vm: R3_TO_LWREG_VM_V (28);
1131lw_r29_vm: R3_TO_LWREG_VM (29); 1131lw_r29_vm: R3_TO_LWREG_VM_V (29);
1132lw_r30_vm: R3_TO_LWREG_VM (30); 1132lw_r30_vm: R3_TO_LWREG_VM_V (30);
1133lw_r31_vm: R3_TO_LWREG_VM_V (31); 1133lw_r31_vm: R3_TO_LWREG_VM_V (31);
1134 1134
1135sw_table_vm: 1135sw_table_vm:
@@ -1147,23 +1147,23 @@ sw_r10_vm: SWREG_TO_R3_VM_V (10);
1147sw_r11_vm: SWREG_TO_R3_VM_V (11); 1147sw_r11_vm: SWREG_TO_R3_VM_V (11);
1148sw_r12_vm: SWREG_TO_R3_VM_V (12); 1148sw_r12_vm: SWREG_TO_R3_VM_V (12);
1149sw_r13_vm: SWREG_TO_R3_VM_V (13); 1149sw_r13_vm: SWREG_TO_R3_VM_V (13);
1150sw_r14_vm: SWREG_TO_R3_VM (14); 1150sw_r14_vm: SWREG_TO_R3_VM_V (14);
1151sw_r15_vm: SWREG_TO_R3_VM_V (15); 1151sw_r15_vm: SWREG_TO_R3_VM_V (15);
1152sw_r16_vm: SWREG_TO_R3_VM (16); 1152sw_r16_vm: SWREG_TO_R3_VM_V (16);
1153sw_r17_vm: SWREG_TO_R3_VM_V (17); 1153sw_r17_vm: SWREG_TO_R3_VM_V (17);
1154sw_r18_vm: SWREG_TO_R3_VM_V (18); 1154sw_r18_vm: SWREG_TO_R3_VM_V (18);
1155sw_r19_vm: SWREG_TO_R3_VM (19); 1155sw_r19_vm: SWREG_TO_R3_VM_V (19);
1156sw_r20_vm: SWREG_TO_R3_VM (20); 1156sw_r20_vm: SWREG_TO_R3_VM_V (20);
1157sw_r21_vm: SWREG_TO_R3_VM (21); 1157sw_r21_vm: SWREG_TO_R3_VM_V (21);
1158sw_r22_vm: SWREG_TO_R3_VM (22); 1158sw_r22_vm: SWREG_TO_R3_VM_V (22);
1159sw_r23_vm: SWREG_TO_R3_VM (23); 1159sw_r23_vm: SWREG_TO_R3_VM_V (23);
1160sw_r24_vm: SWREG_TO_R3_VM (24); 1160sw_r24_vm: SWREG_TO_R3_VM_V (24);
1161sw_r25_vm: SWREG_TO_R3_VM (25); 1161sw_r25_vm: SWREG_TO_R3_VM_V (25);
1162sw_r26_vm: SWREG_TO_R3_VM (26); 1162sw_r26_vm: SWREG_TO_R3_VM_V (26);
1163sw_r27_vm: SWREG_TO_R3_VM (27); 1163sw_r27_vm: SWREG_TO_R3_VM_V (27);
1164sw_r28_vm: SWREG_TO_R3_VM (28); 1164sw_r28_vm: SWREG_TO_R3_VM_V (28);
1165sw_r29_vm: SWREG_TO_R3_VM (29); 1165sw_r29_vm: SWREG_TO_R3_VM_V (29);
1166sw_r30_vm: SWREG_TO_R3_VM (30); 1166sw_r30_vm: SWREG_TO_R3_VM_V (30);
1167sw_r31_vm: SWREG_TO_R3_VM_V (31); 1167sw_r31_vm: SWREG_TO_R3_VM_V (31);
1168#endif /* CONFIG_MMU */ 1168#endif /* CONFIG_MMU */
1169 1169
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c
index c88f066f41b..eb41441c7fd 100644
--- a/arch/microblaze/kernel/intc.c
+++ b/arch/microblaze/kernel/intc.c
@@ -134,7 +134,7 @@ void __init init_IRQ(void)
134 intr_type = 134 intr_type =
135 be32_to_cpup(of_get_property(intc, 135 be32_to_cpup(of_get_property(intc,
136 "xlnx,kind-of-intr", NULL)); 136 "xlnx,kind-of-intr", NULL));
137 if (intr_type >= (1 << (nr_irq + 1))) 137 if (intr_type > (u32)((1ULL << nr_irq) - 1))
138 printk(KERN_INFO " ERROR: Mismatch in kind-of-intr param\n"); 138 printk(KERN_INFO " ERROR: Mismatch in kind-of-intr param\n");
139 139
140#ifdef CONFIG_SELFMOD_INTC 140#ifdef CONFIG_SELFMOD_INTC
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index 968648a81c1..dbb812421d8 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -237,7 +237,6 @@ unsigned long get_wchan(struct task_struct *p)
237/* Set up a thread for executing a new program */ 237/* Set up a thread for executing a new program */
238void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp) 238void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp)
239{ 239{
240 set_fs(USER_DS);
241 regs->pc = pc; 240 regs->pc = pc;
242 regs->r1 = usp; 241 regs->r1 = usp;
243 regs->pt_mode = 0; 242 regs->pt_mode = 0;
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index b15cc219b1d..977484add21 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -53,69 +53,58 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
53} 53}
54 54
55#ifdef CONFIG_EARLY_PRINTK 55#ifdef CONFIG_EARLY_PRINTK
56/* MS this is Microblaze specifig function */ 56char *stdout;
57static int __init early_init_dt_scan_serial(unsigned long node,
58 const char *uname, int depth, void *data)
59{
60 unsigned long l;
61 char *p;
62 const __be32 *addr;
63
64 pr_debug("search \"serial\", depth: %d, uname: %s\n", depth, uname);
65
66/* find all serial nodes */
67 if (strncmp(uname, "serial", 6) != 0)
68 return 0;
69
70/* find compatible node with uartlite */
71 p = of_get_flat_dt_prop(node, "compatible", &l);
72 if ((strncmp(p, "xlnx,xps-uartlite", 17) != 0) &&
73 (strncmp(p, "xlnx,opb-uartlite", 17) != 0) &&
74 (strncmp(p, "xlnx,axi-uartlite", 17) != 0))
75 return 0;
76
77 addr = of_get_flat_dt_prop(node, "reg", &l);
78 return be32_to_cpup(addr); /* return address */
79}
80 57
81/* this function is looking for early uartlite console - Microblaze specific */ 58int __init early_init_dt_scan_chosen_serial(unsigned long node,
82int __init early_uartlite_console(void)
83{
84 return of_scan_flat_dt(early_init_dt_scan_serial, NULL);
85}
86
87/* MS this is Microblaze specifig function */
88static int __init early_init_dt_scan_serial_full(unsigned long node,
89 const char *uname, int depth, void *data) 59 const char *uname, int depth, void *data)
90{ 60{
91 unsigned long l; 61 unsigned long l;
92 char *p; 62 char *p;
93 unsigned int addr;
94
95 pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
96
97/* find all serial nodes */
98 if (strncmp(uname, "serial", 6) != 0)
99 return 0;
100 63
101 early_init_dt_check_for_initrd(node); 64 pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname);
102 65
103/* find compatible node with uartlite */ 66 if (depth == 1 && (strcmp(uname, "chosen") == 0 ||
104 p = of_get_flat_dt_prop(node, "compatible", &l); 67 strcmp(uname, "chosen@0") == 0)) {
105 68 p = of_get_flat_dt_prop(node, "linux,stdout-path", &l);
106 if ((strncmp(p, "xlnx,xps-uart16550", 18) != 0) && 69 if (p != NULL && l > 0)
107 (strncmp(p, "xlnx,axi-uart16550", 18) != 0)) 70 stdout = p; /* store pointer to stdout-path */
108 return 0; 71 }
109 72
110 addr = *(u32 *)of_get_flat_dt_prop(node, "reg", &l); 73 if (stdout && strstr(stdout, uname)) {
111 addr += *(u32 *)of_get_flat_dt_prop(node, "reg-offset", &l); 74 p = of_get_flat_dt_prop(node, "compatible", &l);
112 return be32_to_cpu(addr); /* return address */ 75 pr_debug("Compatible string: %s\n", p);
76
77 if ((strncmp(p, "xlnx,xps-uart16550", 18) == 0) ||
78 (strncmp(p, "xlnx,axi-uart16550", 18) == 0)) {
79 unsigned int addr;
80
81 *(u32 *)data = UART16550;
82
83 addr = *(u32 *)of_get_flat_dt_prop(node, "reg", &l);
84 addr += *(u32 *)of_get_flat_dt_prop(node,
85 "reg-offset", &l);
86 /* clear register offset */
87 return be32_to_cpu(addr) & ~3;
88 }
89 if ((strncmp(p, "xlnx,xps-uartlite", 17) == 0) ||
90 (strncmp(p, "xlnx,opb-uartlite", 17) == 0) ||
91 (strncmp(p, "xlnx,axi-uartlite", 17) == 0) ||
92 (strncmp(p, "xlnx,mdm", 8) == 0)) {
93 unsigned int *addrp;
94
95 *(u32 *)data = UARTLITE;
96
97 addrp = of_get_flat_dt_prop(node, "reg", &l);
98 return be32_to_cpup(addrp); /* return address */
99 }
100 }
101 return 0;
113} 102}
114 103
115/* this function is looking for early uartlite console - Microblaze specific */ 104/* this function is looking for early console - Microblaze specific */
116int __init early_uart16550_console(void) 105int __init of_early_console(void *version)
117{ 106{
118 return of_scan_flat_dt(early_init_dt_scan_serial_full, NULL); 107 return of_scan_flat_dt(early_init_dt_scan_chosen_serial, version);
119} 108}
120#endif 109#endif
121 110
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 8e2c09b7ff2..0e654a12d37 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -59,6 +59,11 @@ void __init setup_arch(char **cmdline_p)
59 59
60 setup_memory(); 60 setup_memory();
61 61
62#ifdef CONFIG_EARLY_PRINTK
63 /* remap early console to virtual address */
64 remap_early_printk();
65#endif
66
62 xilinx_pci_init(); 67 xilinx_pci_init();
63 68
64#if defined(CONFIG_SELFMOD_INTC) || defined(CONFIG_SELFMOD_TIMER) 69#if defined(CONFIG_SELFMOD_INTC) || defined(CONFIG_SELFMOD_TIMER)
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index d915a122c86..8789daa2a34 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -173,7 +173,7 @@ ENTRY(sys_call_table)
173 .long sys_ni_syscall /* sys_vm86 */ 173 .long sys_ni_syscall /* sys_vm86 */
174 .long sys_ni_syscall /* Old sys_query_module */ 174 .long sys_ni_syscall /* Old sys_query_module */
175 .long sys_poll 175 .long sys_poll
176 .long sys_nfsservctl 176 .long sys_ni_syscall /* old nfsservctl */
177 .long sys_setresgid /* 170 */ 177 .long sys_setresgid /* 170 */
178 .long sys_getresgid 178 .long sys_getresgid
179 .long sys_prctl 179 .long sys_prctl
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms
index aef6c917b45..5ce8029f558 100644
--- a/arch/mips/Kbuild.platforms
+++ b/arch/mips/Kbuild.platforms
@@ -16,6 +16,7 @@ platforms += lasat
16platforms += loongson 16platforms += loongson
17platforms += mipssim 17platforms += mipssim
18platforms += mti-malta 18platforms += mti-malta
19platforms += netlogic
19platforms += pmc-sierra 20platforms += pmc-sierra
20platforms += pnx833x 21platforms += pnx833x
21platforms += pnx8550 22platforms += pnx8550
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 884819cd060..53e3514ba10 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -191,18 +191,6 @@ endif
191# 191#
192include $(srctree)/arch/mips/Kbuild.platforms 192include $(srctree)/arch/mips/Kbuild.platforms
193 193
194#
195# NETLOGIC SOC Common (common)
196#
197cflags-$(CONFIG_NLM_COMMON) += -I$(srctree)/arch/mips/include/asm/mach-netlogic
198cflags-$(CONFIG_NLM_COMMON) += -I$(srctree)/arch/mips/include/asm/netlogic
199
200#
201# NETLOGIC XLR/XLS SoC, Simulator and boards
202#
203core-$(CONFIG_NLM_XLR) += arch/mips/netlogic/xlr/
204load-$(CONFIG_NLM_XLR_BOARD) += 0xffffffff84000000
205
206cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic 194cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
207drivers-$(CONFIG_PCI) += arch/mips/pci/ 195drivers-$(CONFIG_PCI) += arch/mips/pci/
208 196
diff --git a/arch/mips/ar7/clock.c b/arch/mips/ar7/clock.c
index 2ca4ada1c29..2460f9d23f1 100644
--- a/arch/mips/ar7/clock.c
+++ b/arch/mips/ar7/clock.c
@@ -443,7 +443,7 @@ struct clk *clk_get(struct device *dev, const char *id)
443 return &vbus_clk; 443 return &vbus_clk;
444 if (!strcmp(id, "cpu")) 444 if (!strcmp(id, "cpu"))
445 return &cpu_clk; 445 return &cpu_clk;
446 if (!strcmp(id, "dsp")); 446 if (!strcmp(id, "dsp"))
447 return &dsp_clk; 447 return &dsp_clk;
448 if (!strcmp(id, "vbus")) 448 if (!strcmp(id, "vbus"))
449 return &vbus_clk; 449 return &vbus_clk;
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 7d2fab39232..33ffecf6a6d 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -229,7 +229,7 @@ static struct resource cpmac_low_res[] = {
229 .name = "irq", 229 .name = "irq",
230 .flags = IORESOURCE_IRQ, 230 .flags = IORESOURCE_IRQ,
231 .start = 27, 231 .start = 27,
232 .end = 27, 232 .end = 27,
233 }, 233 },
234}; 234};
235 235
diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c
index 23818d29912..8088c6fdb83 100644
--- a/arch/mips/ar7/prom.c
+++ b/arch/mips/ar7/prom.c
@@ -77,7 +77,7 @@ struct psp_env_chunk {
77 u16 csum; 77 u16 csum;
78 u8 len; 78 u8 len;
79 char data[11]; 79 char data[11];
80} __attribute__ ((packed)); 80} __packed;
81 81
82struct psp_var_map_entry { 82struct psp_var_map_entry {
83 u8 num; 83 u8 num;
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 4a02fe891ab..1d93f81d57e 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -303,15 +303,15 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
303#define atomic_xchg(v, new) (xchg(&((v)->counter), (new))) 303#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
304 304
305/** 305/**
306 * atomic_add_unless - add unless the number is a given value 306 * __atomic_add_unless - add unless the number is a given value
307 * @v: pointer of type atomic_t 307 * @v: pointer of type atomic_t
308 * @a: the amount to add to v... 308 * @a: the amount to add to v...
309 * @u: ...unless v is equal to u. 309 * @u: ...unless v is equal to u.
310 * 310 *
311 * Atomically adds @a to @v, so long as it was not @u. 311 * Atomically adds @a to @v, so long as it was not @u.
312 * Returns non-zero if @v was not @u, and zero otherwise. 312 * Returns the old value of @v.
313 */ 313 */
314static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 314static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
315{ 315{
316 int c, old; 316 int c, old;
317 c = atomic_read(v); 317 c = atomic_read(v);
@@ -323,9 +323,8 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
323 break; 323 break;
324 c = old; 324 c = old;
325 } 325 }
326 return c != (u); 326 return c;
327} 327}
328#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
329 328
330#define atomic_dec_return(v) atomic_sub_return(1, (v)) 329#define atomic_dec_return(v) atomic_sub_return(1, (v))
331#define atomic_inc_return(v) atomic_add_return(1, (v)) 330#define atomic_inc_return(v) atomic_add_return(1, (v))
@@ -680,7 +679,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
680 * @u: ...unless v is equal to u. 679 * @u: ...unless v is equal to u.
681 * 680 *
682 * Atomically adds @a to @v, so long as it was not @u. 681 * Atomically adds @a to @v, so long as it was not @u.
683 * Returns non-zero if @v was not @u, and zero otherwise. 682 * Returns the old value of @v.
684 */ 683 */
685static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) 684static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
686{ 685{
@@ -766,10 +765,6 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
766 */ 765 */
767#define atomic64_add_negative(i, v) (atomic64_add_return(i, (v)) < 0) 766#define atomic64_add_negative(i, v) (atomic64_add_return(i, (v)) < 0)
768 767
769#else /* !CONFIG_64BIT */
770
771#include <asm-generic/atomic64.h>
772
773#endif /* CONFIG_64BIT */ 768#endif /* CONFIG_64BIT */
774 769
775/* 770/*
@@ -781,6 +776,4 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
781#define smp_mb__before_atomic_inc() smp_mb__before_llsc() 776#define smp_mb__before_atomic_inc() smp_mb__before_llsc()
782#define smp_mb__after_atomic_inc() smp_llsc_mb() 777#define smp_mb__after_atomic_inc() smp_llsc_mb()
783 778
784#include <asm-generic/atomic-long.h>
785
786#endif /* _ASM_ATOMIC_H */ 779#endif /* _ASM_ATOMIC_H */
diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h
index 0b89b83e205..98bcc98cf29 100644
--- a/arch/mips/include/asm/fixmap.h
+++ b/arch/mips/include/asm/fixmap.h
@@ -14,6 +14,7 @@
14#define _ASM_FIXMAP_H 14#define _ASM_FIXMAP_H
15 15
16#include <asm/page.h> 16#include <asm/page.h>
17#include <spaces.h>
17#ifdef CONFIG_HIGHMEM 18#ifdef CONFIG_HIGHMEM
18#include <linux/threads.h> 19#include <linux/threads.h>
19#include <asm/kmap_types.h> 20#include <asm/kmap_types.h>
@@ -67,15 +68,6 @@ enum fixed_addresses {
67 * the start of the fixmap, and leave one page empty 68 * the start of the fixmap, and leave one page empty
68 * at the top of mem.. 69 * at the top of mem..
69 */ 70 */
70#ifdef CONFIG_BCM63XX
71#define FIXADDR_TOP ((unsigned long)(long)(int)0xff000000)
72#else
73#if defined(CONFIG_CPU_TX39XX) || defined(CONFIG_CPU_TX49XX)
74#define FIXADDR_TOP ((unsigned long)(long)(int)(0xff000000 - 0x20000))
75#else
76#define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
77#endif
78#endif
79#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 71#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
80#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 72#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
81 73
diff --git a/arch/mips/include/asm/gt64120.h b/arch/mips/include/asm/gt64120.h
index e64b41093c4..0aa44abc77f 100644
--- a/arch/mips/include/asm/gt64120.h
+++ b/arch/mips/include/asm/gt64120.h
@@ -21,8 +21,6 @@
21#ifndef _ASM_GT64120_H 21#ifndef _ASM_GT64120_H
22#define _ASM_GT64120_H 22#define _ASM_GT64120_H
23 23
24#include <linux/clocksource.h>
25
26#include <asm/addrspace.h> 24#include <asm/addrspace.h>
27#include <asm/byteorder.h> 25#include <asm/byteorder.h>
28 26
diff --git a/arch/mips/include/asm/hw_irq.h b/arch/mips/include/asm/hw_irq.h
index 77adda297ad..9e8ef5994c9 100644
--- a/arch/mips/include/asm/hw_irq.h
+++ b/arch/mips/include/asm/hw_irq.h
@@ -8,7 +8,7 @@
8#ifndef __ASM_HW_IRQ_H 8#ifndef __ASM_HW_IRQ_H
9#define __ASM_HW_IRQ_H 9#define __ASM_HW_IRQ_H
10 10
11#include <asm/atomic.h> 11#include <linux/atomic.h>
12 12
13extern atomic_t irq_err_count; 13extern atomic_t irq_err_count;
14 14
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
index 0ec01294b06..2354c870a63 100644
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -18,7 +18,6 @@
18 18
19static inline void irq_dispose_mapping(unsigned int virq) 19static inline void irq_dispose_mapping(unsigned int virq)
20{ 20{
21 return;
22} 21}
23 22
24#ifdef CONFIG_I8259 23#ifdef CONFIG_I8259
diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
index fffc8307a80..94fde8d0fac 100644
--- a/arch/mips/include/asm/local.h
+++ b/arch/mips/include/asm/local.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <linux/bitops.h> 5#include <linux/bitops.h>
6#include <asm/atomic.h> 6#include <linux/atomic.h>
7#include <asm/cmpxchg.h> 7#include <asm/cmpxchg.h>
8#include <asm/war.h> 8#include <asm/war.h>
9 9
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
index 85fd27509aa..0ed5230243c 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -89,7 +89,6 @@
89 89
90/* Interrupt Mask register */ 90/* Interrupt Mask register */
91#define PERF_IRQMASK_REG 0xc 91#define PERF_IRQMASK_REG 0xc
92#define PERF_IRQSTAT_REG 0x10
93 92
94/* Interrupt Status register */ 93/* Interrupt Status register */
95#define PERF_IRQSTAT_REG 0x10 94#define PERF_IRQSTAT_REG 0x10
diff --git a/arch/mips/include/asm/mach-bcm63xx/spaces.h b/arch/mips/include/asm/mach-bcm63xx/spaces.h
new file mode 100644
index 00000000000..61e750fb465
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/spaces.h
@@ -0,0 +1,17 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_BCM63XX_SPACES_H
11#define _ASM_BCM63XX_SPACES_H
12
13#define FIXADDR_TOP ((unsigned long)(long)(int)0xff000000)
14
15#include <asm/mach-generic/spaces.h>
16
17#endif /* __ASM_BCM63XX_SPACES_H */
diff --git a/arch/mips/include/asm/mach-generic/dma-coherence.h b/arch/mips/include/asm/mach-generic/dma-coherence.h
index 8da98073e95..9c95177f7a7 100644
--- a/arch/mips/include/asm/mach-generic/dma-coherence.h
+++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
@@ -49,7 +49,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
49 49
50static inline void plat_extra_sync_for_device(struct device *dev) 50static inline void plat_extra_sync_for_device(struct device *dev)
51{ 51{
52 return;
53} 52}
54 53
55static inline int plat_dma_mapping_error(struct device *dev, 54static inline int plat_dma_mapping_error(struct device *dev,
diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h
index c9fa4b14968..d7a9efd3a5c 100644
--- a/arch/mips/include/asm/mach-generic/spaces.h
+++ b/arch/mips/include/asm/mach-generic/spaces.h
@@ -82,4 +82,8 @@
82#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET) 82#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
83#endif 83#endif
84 84
85#ifndef FIXADDR_TOP
86#define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
87#endif
88
85#endif /* __ASM_MACH_GENERIC_SPACES_H */ 89#endif /* __ASM_MACH_GENERIC_SPACES_H */
diff --git a/arch/mips/include/asm/mach-ip27/dma-coherence.h b/arch/mips/include/asm/mach-ip27/dma-coherence.h
index 016d0989b14..06c441968e6 100644
--- a/arch/mips/include/asm/mach-ip27/dma-coherence.h
+++ b/arch/mips/include/asm/mach-ip27/dma-coherence.h
@@ -60,7 +60,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
60 60
61static inline void plat_extra_sync_for_device(struct device *dev) 61static inline void plat_extra_sync_for_device(struct device *dev)
62{ 62{
63 return;
64} 63}
65 64
66static inline int plat_dma_mapping_error(struct device *dev, 65static inline int plat_dma_mapping_error(struct device *dev,
diff --git a/arch/mips/include/asm/mach-jazz/dma-coherence.h b/arch/mips/include/asm/mach-jazz/dma-coherence.h
index 302101b54ac..9fc1e9ad703 100644
--- a/arch/mips/include/asm/mach-jazz/dma-coherence.h
+++ b/arch/mips/include/asm/mach-jazz/dma-coherence.h
@@ -50,7 +50,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
50 50
51static inline void plat_extra_sync_for_device(struct device *dev) 51static inline void plat_extra_sync_for_device(struct device *dev)
52{ 52{
53 return;
54} 53}
55 54
56static inline int plat_dma_mapping_error(struct device *dev, 55static inline int plat_dma_mapping_error(struct device *dev,
diff --git a/arch/mips/include/asm/mach-loongson/dma-coherence.h b/arch/mips/include/asm/mach-loongson/dma-coherence.h
index 981c75f91a7..e1433055fe9 100644
--- a/arch/mips/include/asm/mach-loongson/dma-coherence.h
+++ b/arch/mips/include/asm/mach-loongson/dma-coherence.h
@@ -55,7 +55,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
55 55
56static inline void plat_extra_sync_for_device(struct device *dev) 56static inline void plat_extra_sync_for_device(struct device *dev)
57{ 57{
58 return;
59} 58}
60 59
61static inline int plat_dma_mapping_error(struct device *dev, 60static inline int plat_dma_mapping_error(struct device *dev,
diff --git a/arch/mips/include/asm/mach-malta/cpu-feature-overrides.h b/arch/mips/include/asm/mach-malta/cpu-feature-overrides.h
index 2848cea42bc..37e3583a9fd 100644
--- a/arch/mips/include/asm/mach-malta/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-malta/cpu-feature-overrides.h
@@ -32,6 +32,7 @@
32/* #define cpu_has_vtag_icache ? */ 32/* #define cpu_has_vtag_icache ? */
33/* #define cpu_has_dc_aliases ? */ 33/* #define cpu_has_dc_aliases ? */
34/* #define cpu_has_ic_fills_f_dc ? */ 34/* #define cpu_has_ic_fills_f_dc ? */
35#define cpu_has_clo_clz 1
35#define cpu_has_nofpuex 0 36#define cpu_has_nofpuex 0
36/* #define cpu_has_64bits ? */ 37/* #define cpu_has_64bits ? */
37/* #define cpu_has_64bit_zero_reg ? */ 38/* #define cpu_has_64bit_zero_reg ? */
@@ -58,6 +59,7 @@
58/* #define cpu_has_vtag_icache ? */ 59/* #define cpu_has_vtag_icache ? */
59/* #define cpu_has_dc_aliases ? */ 60/* #define cpu_has_dc_aliases ? */
60/* #define cpu_has_ic_fills_f_dc ? */ 61/* #define cpu_has_ic_fills_f_dc ? */
62#define cpu_has_clo_clz 1
61#define cpu_has_nofpuex 0 63#define cpu_has_nofpuex 0
62/* #define cpu_has_64bits ? */ 64/* #define cpu_has_64bits ? */
63/* #define cpu_has_64bit_zero_reg ? */ 65/* #define cpu_has_64bit_zero_reg ? */
diff --git a/arch/mips/include/asm/mach-mipssim/cpu-feature-overrides.h b/arch/mips/include/asm/mach-mipssim/cpu-feature-overrides.h
index 779b0220573..27aaaa5d925 100644
--- a/arch/mips/include/asm/mach-mipssim/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-mipssim/cpu-feature-overrides.h
@@ -31,6 +31,7 @@
31/* #define cpu_has_vtag_icache ? */ 31/* #define cpu_has_vtag_icache ? */
32/* #define cpu_has_dc_aliases ? */ 32/* #define cpu_has_dc_aliases ? */
33/* #define cpu_has_ic_fills_f_dc ? */ 33/* #define cpu_has_ic_fills_f_dc ? */
34#define cpu_has_clo_clz 1
34#define cpu_has_nofpuex 0 35#define cpu_has_nofpuex 0
35/* #define cpu_has_64bits ? */ 36/* #define cpu_has_64bits ? */
36/* #define cpu_has_64bit_zero_reg ? */ 37/* #define cpu_has_64bit_zero_reg ? */
@@ -56,6 +57,7 @@
56/* #define cpu_has_vtag_icache ? */ 57/* #define cpu_has_vtag_icache ? */
57/* #define cpu_has_dc_aliases ? */ 58/* #define cpu_has_dc_aliases ? */
58/* #define cpu_has_ic_fills_f_dc ? */ 59/* #define cpu_has_ic_fills_f_dc ? */
60#define cpu_has_clo_clz 1
59#define cpu_has_nofpuex 0 61#define cpu_has_nofpuex 0
60/* #define cpu_has_64bits ? */ 62/* #define cpu_has_64bits ? */
61/* #define cpu_has_64bit_zero_reg ? */ 63/* #define cpu_has_64bit_zero_reg ? */
diff --git a/arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h b/arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h
new file mode 100644
index 00000000000..f751e3ec56f
--- /dev/null
+++ b/arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2010 Cisco Systems, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef _ASM_MACH_POWERTV_CPU_FEATURE_OVERRIDES_H_
20#define _ASM_MACH_POWERTV_CPU_FEATURE_OVERRIDES_H_
21#define cpu_has_tlb 1
22#define cpu_has_4kex 1
23#define cpu_has_3k_cache 0
24#define cpu_has_4k_cache 1
25#define cpu_has_tx39_cache 0
26#define cpu_has_fpu 0
27#define cpu_has_counter 1
28#define cpu_has_watch 1
29#define cpu_has_divec 1
30#define cpu_has_vce 0
31#define cpu_has_cache_cdex_p 0
32#define cpu_has_cache_cdex_s 0
33#define cpu_has_mcheck 1
34#define cpu_has_ejtag 1
35#define cpu_has_llsc 1
36#define cpu_has_mips16 0
37#define cpu_has_mdmx 0
38#define cpu_has_mips3d 0
39#define cpu_has_smartmips 0
40#define cpu_has_vtag_icache 0
41#define cpu_has_dc_aliases 0
42#define cpu_has_ic_fills_f_dc 0
43#define cpu_has_mips32r1 0
44#define cpu_has_mips32r2 1
45#define cpu_has_mips64r1 0
46#define cpu_has_mips64r2 0
47#define cpu_has_dsp 0
48#define cpu_has_mipsmt 0
49#define cpu_has_userlocal 0
50#define cpu_has_nofpuex 0
51#define cpu_has_64bits 0
52#define cpu_has_64bit_zero_reg 0
53#define cpu_has_vint 1
54#define cpu_has_veic 1
55#define cpu_has_inclusive_pcaches 0
56
57#define cpu_dcache_line_size() 32
58#define cpu_icache_line_size() 32
59#endif
diff --git a/arch/mips/include/asm/mach-powertv/dma-coherence.h b/arch/mips/include/asm/mach-powertv/dma-coherence.h
index a8e72cf1214..62c09408594 100644
--- a/arch/mips/include/asm/mach-powertv/dma-coherence.h
+++ b/arch/mips/include/asm/mach-powertv/dma-coherence.h
@@ -102,7 +102,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
102 102
103static inline void plat_extra_sync_for_device(struct device *dev) 103static inline void plat_extra_sync_for_device(struct device *dev)
104{ 104{
105 return;
106} 105}
107 106
108static inline int plat_dma_mapping_error(struct device *dev, 107static inline int plat_dma_mapping_error(struct device *dev,
diff --git a/arch/mips/include/asm/mach-tx39xx/spaces.h b/arch/mips/include/asm/mach-tx39xx/spaces.h
new file mode 100644
index 00000000000..151fe7a1cf1
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx39xx/spaces.h
@@ -0,0 +1,17 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_TX39XX_SPACES_H
11#define _ASM_TX39XX_SPACES_H
12
13#define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000)
14
15#include <asm/mach-generic/spaces.h>
16
17#endif /* __ASM_TX39XX_SPACES_H */
diff --git a/arch/mips/include/asm/mach-tx49xx/spaces.h b/arch/mips/include/asm/mach-tx49xx/spaces.h
new file mode 100644
index 00000000000..0cb10a6f489
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx49xx/spaces.h
@@ -0,0 +1,17 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_TX49XX_SPACES_H
11#define _ASM_TX49XX_SPACES_H
12
13#define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000)
14
15#include <asm/mach-generic/spaces.h>
16
17#endif /* __ASM_TX49XX_SPACES_H */
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 7e40f377817..b2202a68cf0 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -414,6 +414,7 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
414 * constraints placed on us by the cache architecture. 414 * constraints placed on us by the cache architecture.
415 */ 415 */
416#define HAVE_ARCH_UNMAPPED_AREA 416#define HAVE_ARCH_UNMAPPED_AREA
417#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
417 418
418/* 419/*
419 * No page table caches to initialise 420 * No page table caches to initialise
diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h
index 9e09af34c8a..ef2a8041e78 100644
--- a/arch/mips/include/asm/smp-ops.h
+++ b/arch/mips/include/asm/smp-ops.h
@@ -11,6 +11,8 @@
11#ifndef __ASM_SMP_OPS_H 11#ifndef __ASM_SMP_OPS_H
12#define __ASM_SMP_OPS_H 12#define __ASM_SMP_OPS_H
13 13
14#include <linux/errno.h>
15
14#ifdef CONFIG_SMP 16#ifdef CONFIG_SMP
15 17
16#include <linux/cpumask.h> 18#include <linux/cpumask.h>
@@ -56,8 +58,43 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
56 58
57#endif /* !CONFIG_SMP */ 59#endif /* !CONFIG_SMP */
58 60
59extern struct plat_smp_ops up_smp_ops; 61static inline int register_up_smp_ops(void)
60extern struct plat_smp_ops cmp_smp_ops; 62{
61extern struct plat_smp_ops vsmp_smp_ops; 63#ifdef CONFIG_SMP_UP
64 extern struct plat_smp_ops up_smp_ops;
65
66 register_smp_ops(&up_smp_ops);
67
68 return 0;
69#else
70 return -ENODEV;
71#endif
72}
73
74static inline int register_cmp_smp_ops(void)
75{
76#ifdef CONFIG_MIPS_CMP
77 extern struct plat_smp_ops cmp_smp_ops;
78
79 register_smp_ops(&cmp_smp_ops);
80
81 return 0;
82#else
83 return -ENODEV;
84#endif
85}
86
87static inline int register_vsmp_smp_ops(void)
88{
89#ifdef CONFIG_MIPS_MT_SMP
90 extern struct plat_smp_ops vsmp_smp_ops;
91
92 register_smp_ops(&vsmp_smp_ops);
93
94 return 0;
95#else
96 return -ENODEV;
97#endif
98}
62 99
63#endif /* __ASM_SMP_OPS_H */ 100#endif /* __ASM_SMP_OPS_H */
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index af42385245d..d4fb4d852a6 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -17,7 +17,7 @@
17#include <linux/threads.h> 17#include <linux/threads.h>
18#include <linux/cpumask.h> 18#include <linux/cpumask.h>
19 19
20#include <asm/atomic.h> 20#include <linux/atomic.h>
21#include <asm/smp-ops.h> 21#include <asm/smp-ops.h>
22 22
23extern int smp_num_siblings; 23extern int smp_num_siblings;
diff --git a/arch/mips/include/asm/smtc.h b/arch/mips/include/asm/smtc.h
index ea60bf08dcb..c9736fc0632 100644
--- a/arch/mips/include/asm/smtc.h
+++ b/arch/mips/include/asm/smtc.h
@@ -46,6 +46,7 @@ extern void smtc_prepare_cpus(int cpus);
46extern void smtc_smp_finish(void); 46extern void smtc_smp_finish(void);
47extern void smtc_boot_secondary(int cpu, struct task_struct *t); 47extern void smtc_boot_secondary(int cpu, struct task_struct *t);
48extern void smtc_cpus_done(void); 48extern void smtc_cpus_done(void);
49extern void smtc_init_secondary(void);
49 50
50 51
51/* 52/*
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index dcbd4bb417e..504d40aedfa 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -150,6 +150,7 @@ static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
150# define UASM_i_SLL(buf, rs, rt, sh) uasm_i_dsll(buf, rs, rt, sh) 150# define UASM_i_SLL(buf, rs, rt, sh) uasm_i_dsll(buf, rs, rt, sh)
151# define UASM_i_SRA(buf, rs, rt, sh) uasm_i_dsra(buf, rs, rt, sh) 151# define UASM_i_SRA(buf, rs, rt, sh) uasm_i_dsra(buf, rs, rt, sh)
152# define UASM_i_SRL(buf, rs, rt, sh) uasm_i_dsrl(buf, rs, rt, sh) 152# define UASM_i_SRL(buf, rs, rt, sh) uasm_i_dsrl(buf, rs, rt, sh)
153# define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_dsrl_safe(buf, rs, rt, sh)
153# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh) 154# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh)
154# define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd) 155# define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd)
155# define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd) 156# define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd)
@@ -165,6 +166,7 @@ static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
165# define UASM_i_SLL(buf, rs, rt, sh) uasm_i_sll(buf, rs, rt, sh) 166# define UASM_i_SLL(buf, rs, rt, sh) uasm_i_sll(buf, rs, rt, sh)
166# define UASM_i_SRA(buf, rs, rt, sh) uasm_i_sra(buf, rs, rt, sh) 167# define UASM_i_SRA(buf, rs, rt, sh) uasm_i_sra(buf, rs, rt, sh)
167# define UASM_i_SRL(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh) 168# define UASM_i_SRL(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh)
169# define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh)
168# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh) 170# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh)
169# define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd) 171# define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd)
170# define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd) 172# define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd)
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 6fcfc480e9d..ecea7871dec 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -363,17 +363,18 @@
363#define __NR_open_by_handle_at (__NR_Linux + 340) 363#define __NR_open_by_handle_at (__NR_Linux + 340)
364#define __NR_clock_adjtime (__NR_Linux + 341) 364#define __NR_clock_adjtime (__NR_Linux + 341)
365#define __NR_syncfs (__NR_Linux + 342) 365#define __NR_syncfs (__NR_Linux + 342)
366#define __NR_setns (__NR_Linux + 343) 366#define __NR_sendmmsg (__NR_Linux + 343)
367#define __NR_setns (__NR_Linux + 344)
367 368
368/* 369/*
369 * Offset of the last Linux o32 flavoured syscall 370 * Offset of the last Linux o32 flavoured syscall
370 */ 371 */
371#define __NR_Linux_syscalls 343 372#define __NR_Linux_syscalls 344
372 373
373#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 374#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
374 375
375#define __NR_O32_Linux 4000 376#define __NR_O32_Linux 4000
376#define __NR_O32_Linux_syscalls 343 377#define __NR_O32_Linux_syscalls 344
377 378
378#if _MIPS_SIM == _MIPS_SIM_ABI64 379#if _MIPS_SIM == _MIPS_SIM_ABI64
379 380
@@ -683,17 +684,18 @@
683#define __NR_open_by_handle_at (__NR_Linux + 299) 684#define __NR_open_by_handle_at (__NR_Linux + 299)
684#define __NR_clock_adjtime (__NR_Linux + 300) 685#define __NR_clock_adjtime (__NR_Linux + 300)
685#define __NR_syncfs (__NR_Linux + 301) 686#define __NR_syncfs (__NR_Linux + 301)
686#define __NR_setns (__NR_Linux + 302) 687#define __NR_sendmmsg (__NR_Linux + 302)
688#define __NR_setns (__NR_Linux + 303)
687 689
688/* 690/*
689 * Offset of the last Linux 64-bit flavoured syscall 691 * Offset of the last Linux 64-bit flavoured syscall
690 */ 692 */
691#define __NR_Linux_syscalls 302 693#define __NR_Linux_syscalls 303
692 694
693#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 695#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
694 696
695#define __NR_64_Linux 5000 697#define __NR_64_Linux 5000
696#define __NR_64_Linux_syscalls 302 698#define __NR_64_Linux_syscalls 303
697 699
698#if _MIPS_SIM == _MIPS_SIM_NABI32 700#if _MIPS_SIM == _MIPS_SIM_NABI32
699 701
@@ -1008,17 +1010,18 @@
1008#define __NR_open_by_handle_at (__NR_Linux + 304) 1010#define __NR_open_by_handle_at (__NR_Linux + 304)
1009#define __NR_clock_adjtime (__NR_Linux + 305) 1011#define __NR_clock_adjtime (__NR_Linux + 305)
1010#define __NR_syncfs (__NR_Linux + 306) 1012#define __NR_syncfs (__NR_Linux + 306)
1011#define __NR_setns (__NR_Linux + 307) 1013#define __NR_sendmmsg (__NR_Linux + 307)
1014#define __NR_setns (__NR_Linux + 308)
1012 1015
1013/* 1016/*
1014 * Offset of the last N32 flavoured syscall 1017 * Offset of the last N32 flavoured syscall
1015 */ 1018 */
1016#define __NR_Linux_syscalls 307 1019#define __NR_Linux_syscalls 308
1017 1020
1018#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1021#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
1019 1022
1020#define __NR_N32_Linux 6000 1023#define __NR_N32_Linux 6000
1021#define __NR_N32_Linux_syscalls 307 1024#define __NR_N32_Linux_syscalls 308
1022 1025
1023#ifdef __KERNEL__ 1026#ifdef __KERNEL__
1024 1027
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index bb133d10b14..ebc0cd20b35 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -71,7 +71,6 @@ void r4k_wait_irqoff(void)
71 local_irq_enable(); 71 local_irq_enable();
72 __asm__(" .globl __pastwait \n" 72 __asm__(" .globl __pastwait \n"
73 "__pastwait: \n"); 73 "__pastwait: \n");
74 return;
75} 74}
76 75
77/* 76/*
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 9b734d74ae8..b53970d8099 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -23,7 +23,7 @@
23#include <linux/kgdb.h> 23#include <linux/kgdb.h>
24#include <linux/ftrace.h> 24#include <linux/ftrace.h>
25 25
26#include <asm/atomic.h> 26#include <linux/atomic.h>
27#include <asm/system.h> 27#include <asm/system.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29 29
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 6e71b284f6c..191eb52228c 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -103,14 +103,12 @@ void __init mips_cpu_irq_init(void)
103 clear_c0_status(ST0_IM); 103 clear_c0_status(ST0_IM);
104 clear_c0_cause(CAUSEF_IP); 104 clear_c0_cause(CAUSEF_IP);
105 105
106 /* 106 /* Software interrupts are used for MT/CMT IPI */
107 * Only MT is using the software interrupts currently, so we just 107 for (i = irq_base; i < irq_base + 2; i++)
108 * leave them uninitialized for other processors. 108 irq_set_chip_and_handler(i, cpu_has_mipsmt ?
109 */ 109 &mips_mt_cpu_irq_controller :
110 if (cpu_has_mipsmt) 110 &mips_cpu_irq_controller,
111 for (i = irq_base; i < irq_base + 2; i++) 111 handle_percpu_irq);
112 irq_set_chip_and_handler(i, &mips_mt_cpu_irq_controller,
113 handle_percpu_irq);
114 112
115 for (i = irq_base + 2; i < irq_base + 8; i++) 113 for (i = irq_base + 2; i < irq_base + 8; i++)
116 irq_set_chip_and_handler(i, &mips_cpu_irq_controller, 114 irq_set_chip_and_handler(i, &mips_cpu_irq_controller,
diff --git a/arch/mips/kernel/mips-mt.c b/arch/mips/kernel/mips-mt.c
index b2259e7cd82..594ca69cb86 100644
--- a/arch/mips/kernel/mips-mt.c
+++ b/arch/mips/kernel/mips-mt.c
@@ -12,7 +12,7 @@
12 12
13#include <asm/cpu.h> 13#include <asm/cpu.h>
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/atomic.h> 15#include <linux/atomic.h>
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/hardirq.h> 17#include <asm/hardirq.h>
18#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
diff --git a/arch/mips/kernel/perf_event.c b/arch/mips/kernel/perf_event.c
index d0deaab9ace..0aee944ac38 100644
--- a/arch/mips/kernel/perf_event.c
+++ b/arch/mips/kernel/perf_event.c
@@ -192,8 +192,6 @@ again:
192 192
193 local64_add(delta, &event->count); 193 local64_add(delta, &event->count);
194 local64_sub(delta, &hwc->period_left); 194 local64_sub(delta, &hwc->period_left);
195
196 return;
197} 195}
198 196
199static void mipspmu_start(struct perf_event *event, int flags) 197static void mipspmu_start(struct perf_event *event, int flags)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index c28fbe6107b..b30cb2573aa 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -103,7 +103,6 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
103 __init_dsp(); 103 __init_dsp();
104 regs->cp0_epc = pc; 104 regs->cp0_epc = pc;
105 regs->regs[29] = sp; 105 regs->regs[29] = sp;
106 current_thread_info()->addr_limit = USER_DS;
107} 106}
108 107
109void exit_thread(void) 108void exit_thread(void)
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 557ef72472e..7a80b7cda7c 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -36,7 +36,7 @@
36#include <asm/mipsmtregs.h> 36#include <asm/mipsmtregs.h>
37#include <asm/mips_mt.h> 37#include <asm/mips_mt.h>
38#include <asm/cacheflush.h> 38#include <asm/cacheflush.h>
39#include <asm/atomic.h> 39#include <linux/atomic.h>
40#include <asm/cpu.h> 40#include <asm/cpu.h>
41#include <asm/processor.h> 41#include <asm/processor.h>
42#include <asm/system.h> 42#include <asm/system.h>
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 99e656e425f..865bc7a6f5a 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -424,7 +424,7 @@ einval: li v0, -ENOSYS
424 sys sys_getresuid 3 424 sys sys_getresuid 3
425 sys sys_ni_syscall 0 /* was sys_query_module */ 425 sys sys_ni_syscall 0 /* was sys_query_module */
426 sys sys_poll 3 426 sys sys_poll 3
427 sys sys_nfsservctl 3 427 sys sys_ni_syscall 0 /* was nfsservctl */
428 sys sys_setresgid 3 /* 4190 */ 428 sys sys_setresgid 3 /* 4190 */
429 sys sys_getresgid 3 429 sys sys_getresgid 3
430 sys sys_prctl 5 430 sys sys_prctl 5
@@ -589,6 +589,7 @@ einval: li v0, -ENOSYS
589 sys sys_open_by_handle_at 3 /* 4340 */ 589 sys sys_open_by_handle_at 3 /* 4340 */
590 sys sys_clock_adjtime 2 590 sys sys_clock_adjtime 2
591 sys sys_syncfs 1 591 sys sys_syncfs 1
592 sys sys_sendmmsg 4
592 sys sys_setns 2 593 sys sys_setns 2
593 .endm 594 .endm
594 595
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index fb0575f47f3..fb7334bea73 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -299,7 +299,7 @@ sys_call_table:
299 PTR sys_ni_syscall /* 5170, was get_kernel_syms */ 299 PTR sys_ni_syscall /* 5170, was get_kernel_syms */
300 PTR sys_ni_syscall /* was query_module */ 300 PTR sys_ni_syscall /* was query_module */
301 PTR sys_quotactl 301 PTR sys_quotactl
302 PTR sys_nfsservctl 302 PTR sys_ni_syscall /* was nfsservctl */
303 PTR sys_ni_syscall /* res. for getpmsg */ 303 PTR sys_ni_syscall /* res. for getpmsg */
304 PTR sys_ni_syscall /* 5175 for putpmsg */ 304 PTR sys_ni_syscall /* 5175 for putpmsg */
305 PTR sys_ni_syscall /* res. for afs_syscall */ 305 PTR sys_ni_syscall /* res. for afs_syscall */
@@ -428,5 +428,6 @@ sys_call_table:
428 PTR sys_open_by_handle_at 428 PTR sys_open_by_handle_at
429 PTR sys_clock_adjtime /* 5300 */ 429 PTR sys_clock_adjtime /* 5300 */
430 PTR sys_syncfs 430 PTR sys_syncfs
431 PTR sys_sendmmsg
431 PTR sys_setns 432 PTR sys_setns
432 .size sys_call_table,.-sys_call_table 433 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 4de0c5534e7..f9296e894e4 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -294,7 +294,7 @@ EXPORT(sysn32_call_table)
294 PTR sys_ni_syscall /* 6170, was get_kernel_syms */ 294 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
295 PTR sys_ni_syscall /* was query_module */ 295 PTR sys_ni_syscall /* was query_module */
296 PTR sys_quotactl 296 PTR sys_quotactl
297 PTR compat_sys_nfsservctl 297 PTR sys_ni_syscall /* was nfsservctl */
298 PTR sys_ni_syscall /* res. for getpmsg */ 298 PTR sys_ni_syscall /* res. for getpmsg */
299 PTR sys_ni_syscall /* 6175 for putpmsg */ 299 PTR sys_ni_syscall /* 6175 for putpmsg */
300 PTR sys_ni_syscall /* res. for afs_syscall */ 300 PTR sys_ni_syscall /* res. for afs_syscall */
@@ -428,5 +428,6 @@ EXPORT(sysn32_call_table)
428 PTR sys_open_by_handle_at 428 PTR sys_open_by_handle_at
429 PTR compat_sys_clock_adjtime /* 6305 */ 429 PTR compat_sys_clock_adjtime /* 6305 */
430 PTR sys_syncfs 430 PTR sys_syncfs
431 PTR compat_sys_sendmmsg
431 PTR sys_setns 432 PTR sys_setns
432 .size sysn32_call_table,.-sysn32_call_table 433 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 4a387de08bf..4d7c9827706 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -392,7 +392,7 @@ sys_call_table:
392 PTR sys_getresuid 392 PTR sys_getresuid
393 PTR sys_ni_syscall /* was query_module */ 393 PTR sys_ni_syscall /* was query_module */
394 PTR sys_poll 394 PTR sys_poll
395 PTR compat_sys_nfsservctl 395 PTR sys_ni_syscall /* was nfsservctl */
396 PTR sys_setresgid /* 4190 */ 396 PTR sys_setresgid /* 4190 */
397 PTR sys_getresgid 397 PTR sys_getresgid
398 PTR sys_prctl 398 PTR sys_prctl
@@ -546,5 +546,6 @@ sys_call_table:
546 PTR compat_sys_open_by_handle_at /* 4340 */ 546 PTR compat_sys_open_by_handle_at /* 4340 */
547 PTR compat_sys_clock_adjtime 547 PTR compat_sys_clock_adjtime
548 PTR sys_syncfs 548 PTR sys_syncfs
549 PTR compat_sys_sendmmsg
549 PTR sys_setns 550 PTR sys_setns
550 .size sys_call_table,.-sys_call_table 551 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c
index cc81771b882..fe309516065 100644
--- a/arch/mips/kernel/smp-cmp.c
+++ b/arch/mips/kernel/smp-cmp.c
@@ -25,7 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/compiler.h> 26#include <linux/compiler.h>
27 27
28#include <asm/atomic.h> 28#include <linux/atomic.h>
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30#include <asm/cpu.h> 30#include <asm/cpu.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 1ec56e635d0..ce9e286f0a7 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -24,7 +24,7 @@
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/smp.h> 25#include <linux/smp.h>
26 26
27#include <asm/atomic.h> 27#include <linux/atomic.h>
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/cpu.h> 29#include <asm/cpu.h>
30#include <asm/processor.h> 30#include <asm/processor.h>
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 32a25610108..32c1e954cd3 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -34,7 +34,7 @@
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/ftrace.h> 35#include <linux/ftrace.h>
36 36
37#include <asm/atomic.h> 37#include <linux/atomic.h>
38#include <asm/cpu.h> 38#include <asm/cpu.h>
39#include <asm/processor.h> 39#include <asm/processor.h>
40#include <asm/r4k-timer.h> 40#include <asm/r4k-timer.h>
diff --git a/arch/mips/kernel/smtc-proc.c b/arch/mips/kernel/smtc-proc.c
index fe256559c99..928a5a61e1a 100644
--- a/arch/mips/kernel/smtc-proc.c
+++ b/arch/mips/kernel/smtc-proc.c
@@ -10,7 +10,7 @@
10 10
11#include <asm/cpu.h> 11#include <asm/cpu.h>
12#include <asm/processor.h> 12#include <asm/processor.h>
13#include <asm/atomic.h> 13#include <linux/atomic.h>
14#include <asm/system.h> 14#include <asm/system.h>
15#include <asm/hardirq.h> 15#include <asm/hardirq.h>
16#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index cedac463374..f0895e70e28 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -30,7 +30,7 @@
30 30
31#include <asm/cpu.h> 31#include <asm/cpu.h>
32#include <asm/processor.h> 32#include <asm/processor.h>
33#include <asm/atomic.h> 33#include <linux/atomic.h>
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/hardirq.h> 35#include <asm/hardirq.h>
36#include <asm/hazards.h> 36#include <asm/hazards.h>
diff --git a/arch/mips/kernel/sync-r4k.c b/arch/mips/kernel/sync-r4k.c
index 05dd170a83f..99f913c8d7a 100644
--- a/arch/mips/kernel/sync-r4k.c
+++ b/arch/mips/kernel/sync-r4k.c
@@ -16,7 +16,7 @@
16#include <linux/cpumask.h> 16#include <linux/cpumask.h>
17 17
18#include <asm/r4k-timer.h> 18#include <asm/r4k-timer.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20#include <asm/barrier.h> 20#include <asm/barrier.h>
21#include <asm/mipsregs.h> 21#include <asm/mipsregs.h>
22 22
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index dbb6b408f00..2cd50ad0d5c 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -46,7 +46,7 @@
46#include <asm/mipsregs.h> 46#include <asm/mipsregs.h>
47#include <asm/mipsmtregs.h> 47#include <asm/mipsmtregs.h>
48#include <asm/cacheflush.h> 48#include <asm/cacheflush.h>
49#include <asm/atomic.h> 49#include <linux/atomic.h>
50#include <asm/cpu.h> 50#include <asm/cpu.h>
51#include <asm/mips_mt.h> 51#include <asm/mips_mt.h>
52#include <asm/processor.h> 52#include <asm/processor.h>
diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c
index 94560899d13..7e9c0ffc11a 100644
--- a/arch/mips/lantiq/clk.c
+++ b/arch/mips/lantiq/clk.c
@@ -100,6 +100,19 @@ void clk_put(struct clk *clk)
100} 100}
101EXPORT_SYMBOL(clk_put); 101EXPORT_SYMBOL(clk_put);
102 102
103int clk_enable(struct clk *clk)
104{
105 /* not used */
106 return 0;
107}
108EXPORT_SYMBOL(clk_enable);
109
110void clk_disable(struct clk *clk)
111{
112 /* not used */
113}
114EXPORT_SYMBOL(clk_disable);
115
103static inline u32 ltq_get_counter_resolution(void) 116static inline u32 ltq_get_counter_resolution(void)
104{ 117{
105 u32 res; 118 u32 res;
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.c b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
index 64057244eec..2b666d3a394 100644
--- a/arch/mips/loongson/lemote-2f/ec_kb3310b.c
+++ b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
@@ -45,8 +45,6 @@ void ec_write(unsigned short addr, unsigned char val)
45 /* flush the write action */ 45 /* flush the write action */
46 inb(EC_IO_PORT_DATA); 46 inb(EC_IO_PORT_DATA);
47 spin_unlock_irqrestore(&index_access_lock, flags); 47 spin_unlock_irqrestore(&index_access_lock, flags);
48
49 return;
50} 48}
51EXPORT_SYMBOL_GPL(ec_write); 49EXPORT_SYMBOL_GPL(ec_write);
52 50
diff --git a/arch/mips/mipssim/sim_setup.c b/arch/mips/mipssim/sim_setup.c
index 55f22a3afe6..256e0cdaa49 100644
--- a/arch/mips/mipssim/sim_setup.c
+++ b/arch/mips/mipssim/sim_setup.c
@@ -34,6 +34,7 @@
34#include <asm/time.h> 34#include <asm/time.h>
35#include <asm/mips-boards/sim.h> 35#include <asm/mips-boards/sim.h>
36#include <asm/mips-boards/simint.h> 36#include <asm/mips-boards/simint.h>
37#include <asm/smp-ops.h>
37 38
38 39
39static void __init serial_init(void); 40static void __init serial_init(void);
@@ -59,18 +60,17 @@ void __init prom_init(void)
59 60
60 prom_meminit(); 61 prom_meminit();
61 62
62#ifdef CONFIG_MIPS_MT_SMP 63 if (cpu_has_mipsmt) {
63 if (cpu_has_mipsmt) 64 if (!register_vsmp_smp_ops())
64 register_smp_ops(&vsmp_smp_ops); 65 return;
65 else 66
66 register_smp_ops(&up_smp_ops);
67#endif
68#ifdef CONFIG_MIPS_MT_SMTC 67#ifdef CONFIG_MIPS_MT_SMTC
69 if (cpu_has_mipsmt)
70 register_smp_ops(&ssmtc_smp_ops); 68 register_smp_ops(&ssmtc_smp_ops);
71 else 69 return;
72 register_smp_ops(&up_smp_ops);
73#endif 70#endif
71 }
72
73 register_up_smp_ops();
74} 74}
75 75
76static void __init serial_init(void) 76static void __init serial_init(void)
diff --git a/arch/mips/mipssim/sim_smtc.c b/arch/mips/mipssim/sim_smtc.c
index 30df47258c2..915063991f6 100644
--- a/arch/mips/mipssim/sim_smtc.c
+++ b/arch/mips/mipssim/sim_smtc.c
@@ -24,7 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/smp.h> 25#include <linux/smp.h>
26 26
27#include <asm/atomic.h> 27#include <linux/atomic.h>
28#include <asm/cpu.h> 28#include <asm/cpu.h>
29#include <asm/processor.h> 29#include <asm/processor.h>
30#include <asm/smtc.h> 30#include <asm/smtc.h>
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index eeb642e4066..b9aabb998a3 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -604,6 +604,7 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
604 r4k_blast_scache(); 604 r4k_blast_scache();
605 else 605 else
606 blast_scache_range(addr, addr + size); 606 blast_scache_range(addr, addr + size);
607 __sync();
607 return; 608 return;
608 } 609 }
609 610
@@ -620,6 +621,7 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
620 } 621 }
621 622
622 bc_wback_inv(addr, size); 623 bc_wback_inv(addr, size);
624 __sync();
623} 625}
624 626
625static void r4k_dma_cache_inv(unsigned long addr, unsigned long size) 627static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
@@ -647,6 +649,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
647 (addr + size - 1) & almask); 649 (addr + size - 1) & almask);
648 blast_inv_scache_range(addr, addr + size); 650 blast_inv_scache_range(addr, addr + size);
649 } 651 }
652 __sync();
650 return; 653 return;
651 } 654 }
652 655
@@ -663,6 +666,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
663 } 666 }
664 667
665 bc_inv(addr, size); 668 bc_inv(addr, size);
669 __sync();
666} 670}
667#endif /* CONFIG_DMA_NONCOHERENT */ 671#endif /* CONFIG_DMA_NONCOHERENT */
668 672
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 21ea14efb83..46084912e58 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -15,18 +15,18 @@
15#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/gfp.h> 17#include <linux/gfp.h>
18#include <linux/highmem.h>
18 19
19#include <asm/cache.h> 20#include <asm/cache.h>
20#include <asm/io.h> 21#include <asm/io.h>
21 22
22#include <dma-coherence.h> 23#include <dma-coherence.h>
23 24
24static inline unsigned long dma_addr_to_virt(struct device *dev, 25static inline struct page *dma_addr_to_page(struct device *dev,
25 dma_addr_t dma_addr) 26 dma_addr_t dma_addr)
26{ 27{
27 unsigned long addr = plat_dma_addr_to_phys(dev, dma_addr); 28 return pfn_to_page(
28 29 plat_dma_addr_to_phys(dev, dma_addr) >> PAGE_SHIFT);
29 return (unsigned long)phys_to_virt(addr);
30} 30}
31 31
32/* 32/*
@@ -148,20 +148,20 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
148 free_pages(addr, get_order(size)); 148 free_pages(addr, get_order(size));
149} 149}
150 150
151static inline void __dma_sync(unsigned long addr, size_t size, 151static inline void __dma_sync_virtual(void *addr, size_t size,
152 enum dma_data_direction direction) 152 enum dma_data_direction direction)
153{ 153{
154 switch (direction) { 154 switch (direction) {
155 case DMA_TO_DEVICE: 155 case DMA_TO_DEVICE:
156 dma_cache_wback(addr, size); 156 dma_cache_wback((unsigned long)addr, size);
157 break; 157 break;
158 158
159 case DMA_FROM_DEVICE: 159 case DMA_FROM_DEVICE:
160 dma_cache_inv(addr, size); 160 dma_cache_inv((unsigned long)addr, size);
161 break; 161 break;
162 162
163 case DMA_BIDIRECTIONAL: 163 case DMA_BIDIRECTIONAL:
164 dma_cache_wback_inv(addr, size); 164 dma_cache_wback_inv((unsigned long)addr, size);
165 break; 165 break;
166 166
167 default: 167 default:
@@ -169,12 +169,49 @@ static inline void __dma_sync(unsigned long addr, size_t size,
169 } 169 }
170} 170}
171 171
172/*
173 * A single sg entry may refer to multiple physically contiguous
174 * pages. But we still need to process highmem pages individually.
175 * If highmem is not configured then the bulk of this loop gets
176 * optimized out.
177 */
178static inline void __dma_sync(struct page *page,
179 unsigned long offset, size_t size, enum dma_data_direction direction)
180{
181 size_t left = size;
182
183 do {
184 size_t len = left;
185
186 if (PageHighMem(page)) {
187 void *addr;
188
189 if (offset + len > PAGE_SIZE) {
190 if (offset >= PAGE_SIZE) {
191 page += offset >> PAGE_SHIFT;
192 offset &= ~PAGE_MASK;
193 }
194 len = PAGE_SIZE - offset;
195 }
196
197 addr = kmap_atomic(page);
198 __dma_sync_virtual(addr + offset, len, direction);
199 kunmap_atomic(addr);
200 } else
201 __dma_sync_virtual(page_address(page) + offset,
202 size, direction);
203 offset = 0;
204 page++;
205 left -= len;
206 } while (left);
207}
208
172static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, 209static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
173 size_t size, enum dma_data_direction direction, struct dma_attrs *attrs) 210 size_t size, enum dma_data_direction direction, struct dma_attrs *attrs)
174{ 211{
175 if (cpu_is_noncoherent_r10000(dev)) 212 if (cpu_is_noncoherent_r10000(dev))
176 __dma_sync(dma_addr_to_virt(dev, dma_addr), size, 213 __dma_sync(dma_addr_to_page(dev, dma_addr),
177 direction); 214 dma_addr & ~PAGE_MASK, size, direction);
178 215
179 plat_unmap_dma_mem(dev, dma_addr, size, direction); 216 plat_unmap_dma_mem(dev, dma_addr, size, direction);
180} 217}
@@ -185,13 +222,11 @@ static int mips_dma_map_sg(struct device *dev, struct scatterlist *sg,
185 int i; 222 int i;
186 223
187 for (i = 0; i < nents; i++, sg++) { 224 for (i = 0; i < nents; i++, sg++) {
188 unsigned long addr; 225 if (!plat_device_is_coherent(dev))
189 226 __dma_sync(sg_page(sg), sg->offset, sg->length,
190 addr = (unsigned long) sg_virt(sg); 227 direction);
191 if (!plat_device_is_coherent(dev) && addr) 228 sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) +
192 __dma_sync(addr, sg->length, direction); 229 sg->offset;
193 sg->dma_address = plat_map_dma_mem(dev,
194 (void *)addr, sg->length);
195 } 230 }
196 231
197 return nents; 232 return nents;
@@ -201,30 +236,23 @@ static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page,
201 unsigned long offset, size_t size, enum dma_data_direction direction, 236 unsigned long offset, size_t size, enum dma_data_direction direction,
202 struct dma_attrs *attrs) 237 struct dma_attrs *attrs)
203{ 238{
204 unsigned long addr;
205
206 addr = (unsigned long) page_address(page) + offset;
207
208 if (!plat_device_is_coherent(dev)) 239 if (!plat_device_is_coherent(dev))
209 __dma_sync(addr, size, direction); 240 __dma_sync(page, offset, size, direction);
210 241
211 return plat_map_dma_mem(dev, (void *)addr, size); 242 return plat_map_dma_mem_page(dev, page) + offset;
212} 243}
213 244
214static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg, 245static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
215 int nhwentries, enum dma_data_direction direction, 246 int nhwentries, enum dma_data_direction direction,
216 struct dma_attrs *attrs) 247 struct dma_attrs *attrs)
217{ 248{
218 unsigned long addr;
219 int i; 249 int i;
220 250
221 for (i = 0; i < nhwentries; i++, sg++) { 251 for (i = 0; i < nhwentries; i++, sg++) {
222 if (!plat_device_is_coherent(dev) && 252 if (!plat_device_is_coherent(dev) &&
223 direction != DMA_TO_DEVICE) { 253 direction != DMA_TO_DEVICE)
224 addr = (unsigned long) sg_virt(sg); 254 __dma_sync(sg_page(sg), sg->offset, sg->length,
225 if (addr) 255 direction);
226 __dma_sync(addr, sg->length, direction);
227 }
228 plat_unmap_dma_mem(dev, sg->dma_address, sg->length, direction); 256 plat_unmap_dma_mem(dev, sg->dma_address, sg->length, direction);
229 } 257 }
230} 258}
@@ -232,24 +260,18 @@ static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
232static void mips_dma_sync_single_for_cpu(struct device *dev, 260static void mips_dma_sync_single_for_cpu(struct device *dev,
233 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) 261 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
234{ 262{
235 if (cpu_is_noncoherent_r10000(dev)) { 263 if (cpu_is_noncoherent_r10000(dev))
236 unsigned long addr; 264 __dma_sync(dma_addr_to_page(dev, dma_handle),
237 265 dma_handle & ~PAGE_MASK, size, direction);
238 addr = dma_addr_to_virt(dev, dma_handle);
239 __dma_sync(addr, size, direction);
240 }
241} 266}
242 267
243static void mips_dma_sync_single_for_device(struct device *dev, 268static void mips_dma_sync_single_for_device(struct device *dev,
244 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) 269 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
245{ 270{
246 plat_extra_sync_for_device(dev); 271 plat_extra_sync_for_device(dev);
247 if (!plat_device_is_coherent(dev)) { 272 if (!plat_device_is_coherent(dev))
248 unsigned long addr; 273 __dma_sync(dma_addr_to_page(dev, dma_handle),
249 274 dma_handle & ~PAGE_MASK, size, direction);
250 addr = dma_addr_to_virt(dev, dma_handle);
251 __dma_sync(addr, size, direction);
252 }
253} 275}
254 276
255static void mips_dma_sync_sg_for_cpu(struct device *dev, 277static void mips_dma_sync_sg_for_cpu(struct device *dev,
@@ -260,8 +282,8 @@ static void mips_dma_sync_sg_for_cpu(struct device *dev,
260 /* Make sure that gcc doesn't leave the empty loop body. */ 282 /* Make sure that gcc doesn't leave the empty loop body. */
261 for (i = 0; i < nelems; i++, sg++) { 283 for (i = 0; i < nelems; i++, sg++) {
262 if (cpu_is_noncoherent_r10000(dev)) 284 if (cpu_is_noncoherent_r10000(dev))
263 __dma_sync((unsigned long)page_address(sg_page(sg)), 285 __dma_sync(sg_page(sg), sg->offset, sg->length,
264 sg->length, direction); 286 direction);
265 } 287 }
266} 288}
267 289
@@ -273,8 +295,8 @@ static void mips_dma_sync_sg_for_device(struct device *dev,
273 /* Make sure that gcc doesn't leave the empty loop body. */ 295 /* Make sure that gcc doesn't leave the empty loop body. */
274 for (i = 0; i < nelems; i++, sg++) { 296 for (i = 0; i < nelems; i++, sg++) {
275 if (!plat_device_is_coherent(dev)) 297 if (!plat_device_is_coherent(dev))
276 __dma_sync((unsigned long)page_address(sg_page(sg)), 298 __dma_sync(sg_page(sg), sg->offset, sg->length,
277 sg->length, direction); 299 direction);
278 } 300 }
279} 301}
280 302
@@ -295,7 +317,7 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
295 317
296 plat_extra_sync_for_device(dev); 318 plat_extra_sync_for_device(dev);
297 if (!plat_device_is_coherent(dev)) 319 if (!plat_device_is_coherent(dev))
298 __dma_sync((unsigned long)vaddr, size, direction); 320 __dma_sync_virtual(vaddr, size, direction);
299} 321}
300 322
301EXPORT_SYMBOL(dma_cache_sync); 323EXPORT_SYMBOL(dma_cache_sync);
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 1aadeb42c5a..b7ebc4fa89b 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -277,11 +277,11 @@ void __init fixrange_init(unsigned long start, unsigned long end,
277 k = __pmd_offset(vaddr); 277 k = __pmd_offset(vaddr);
278 pgd = pgd_base + i; 278 pgd = pgd_base + i;
279 279
280 for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) { 280 for ( ; (i < PTRS_PER_PGD) && (vaddr < end); pgd++, i++) {
281 pud = (pud_t *)pgd; 281 pud = (pud_t *)pgd;
282 for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) { 282 for ( ; (j < PTRS_PER_PUD) && (vaddr < end); pud++, j++) {
283 pmd = (pmd_t *)pud; 283 pmd = (pmd_t *)pud;
284 for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) { 284 for (; (k < PTRS_PER_PMD) && (vaddr < end); pmd++, k++) {
285 if (pmd_none(*pmd)) { 285 if (pmd_none(*pmd)) {
286 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); 286 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
287 set_pmd(pmd, __pmd((unsigned long)pte)); 287 set_pmd(pmd, __pmd((unsigned long)pte));
@@ -368,7 +368,7 @@ void __init mem_init(void)
368#ifdef CONFIG_DISCONTIGMEM 368#ifdef CONFIG_DISCONTIGMEM
369#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet" 369#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"
370#endif 370#endif
371 max_mapnr = highend_pfn; 371 max_mapnr = highend_pfn ? highend_pfn : max_low_pfn;
372#else 372#else
373 max_mapnr = max_low_pfn; 373 max_mapnr = max_low_pfn;
374#endif 374#endif
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index ae3c20a9556..9ff5d0fac55 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -10,6 +10,7 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/mman.h> 11#include <linux/mman.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/personality.h>
13#include <linux/random.h> 14#include <linux/random.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
15 16
@@ -17,21 +18,65 @@ unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */
17 18
18EXPORT_SYMBOL(shm_align_mask); 19EXPORT_SYMBOL(shm_align_mask);
19 20
21/* gap between mmap and stack */
22#define MIN_GAP (128*1024*1024UL)
23#define MAX_GAP ((TASK_SIZE)/6*5)
24
25static int mmap_is_legacy(void)
26{
27 if (current->personality & ADDR_COMPAT_LAYOUT)
28 return 1;
29
30 if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
31 return 1;
32
33 return sysctl_legacy_va_layout;
34}
35
36static unsigned long mmap_base(unsigned long rnd)
37{
38 unsigned long gap = rlimit(RLIMIT_STACK);
39
40 if (gap < MIN_GAP)
41 gap = MIN_GAP;
42 else if (gap > MAX_GAP)
43 gap = MAX_GAP;
44
45 return PAGE_ALIGN(TASK_SIZE - gap - rnd);
46}
47
48static inline unsigned long COLOUR_ALIGN_DOWN(unsigned long addr,
49 unsigned long pgoff)
50{
51 unsigned long base = addr & ~shm_align_mask;
52 unsigned long off = (pgoff << PAGE_SHIFT) & shm_align_mask;
53
54 if (base + off <= addr)
55 return base + off;
56
57 return base - off;
58}
59
20#define COLOUR_ALIGN(addr,pgoff) \ 60#define COLOUR_ALIGN(addr,pgoff) \
21 ((((addr) + shm_align_mask) & ~shm_align_mask) + \ 61 ((((addr) + shm_align_mask) & ~shm_align_mask) + \
22 (((pgoff) << PAGE_SHIFT) & shm_align_mask)) 62 (((pgoff) << PAGE_SHIFT) & shm_align_mask))
23 63
24unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, 64enum mmap_allocation_direction {UP, DOWN};
25 unsigned long len, unsigned long pgoff, unsigned long flags) 65
66static unsigned long arch_get_unmapped_area_foo(struct file *filp,
67 unsigned long addr0, unsigned long len, unsigned long pgoff,
68 unsigned long flags, enum mmap_allocation_direction dir)
26{ 69{
27 struct vm_area_struct * vmm; 70 struct mm_struct *mm = current->mm;
71 struct vm_area_struct *vma;
72 unsigned long addr = addr0;
28 int do_color_align; 73 int do_color_align;
29 74
30 if (len > TASK_SIZE) 75 if (unlikely(len > TASK_SIZE))
31 return -ENOMEM; 76 return -ENOMEM;
32 77
33 if (flags & MAP_FIXED) { 78 if (flags & MAP_FIXED) {
34 /* Even MAP_FIXED mappings must reside within TASK_SIZE. */ 79 /* Even MAP_FIXED mappings must reside within TASK_SIZE */
35 if (TASK_SIZE - len < addr) 80 if (TASK_SIZE - len < addr)
36 return -EINVAL; 81 return -EINVAL;
37 82
@@ -48,34 +93,130 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
48 do_color_align = 0; 93 do_color_align = 0;
49 if (filp || (flags & MAP_SHARED)) 94 if (filp || (flags & MAP_SHARED))
50 do_color_align = 1; 95 do_color_align = 1;
96
97 /* requesting a specific address */
51 if (addr) { 98 if (addr) {
52 if (do_color_align) 99 if (do_color_align)
53 addr = COLOUR_ALIGN(addr, pgoff); 100 addr = COLOUR_ALIGN(addr, pgoff);
54 else 101 else
55 addr = PAGE_ALIGN(addr); 102 addr = PAGE_ALIGN(addr);
56 vmm = find_vma(current->mm, addr); 103
104 vma = find_vma(mm, addr);
57 if (TASK_SIZE - len >= addr && 105 if (TASK_SIZE - len >= addr &&
58 (!vmm || addr + len <= vmm->vm_start)) 106 (!vma || addr + len <= vma->vm_start))
59 return addr; 107 return addr;
60 } 108 }
61 addr = current->mm->mmap_base;
62 if (do_color_align)
63 addr = COLOUR_ALIGN(addr, pgoff);
64 else
65 addr = PAGE_ALIGN(addr);
66 109
67 for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { 110 if (dir == UP) {
68 /* At this point: (!vmm || addr < vmm->vm_end). */ 111 addr = mm->mmap_base;
69 if (TASK_SIZE - len < addr) 112 if (do_color_align)
70 return -ENOMEM; 113 addr = COLOUR_ALIGN(addr, pgoff);
71 if (!vmm || addr + len <= vmm->vm_start) 114 else
72 return addr; 115 addr = PAGE_ALIGN(addr);
73 addr = vmm->vm_end; 116
117 for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
118 /* At this point: (!vma || addr < vma->vm_end). */
119 if (TASK_SIZE - len < addr)
120 return -ENOMEM;
121 if (!vma || addr + len <= vma->vm_start)
122 return addr;
123 addr = vma->vm_end;
124 if (do_color_align)
125 addr = COLOUR_ALIGN(addr, pgoff);
126 }
127 } else {
128 /* check if free_area_cache is useful for us */
129 if (len <= mm->cached_hole_size) {
130 mm->cached_hole_size = 0;
131 mm->free_area_cache = mm->mmap_base;
132 }
133
134 /* either no address requested or can't fit in requested address hole */
135 addr = mm->free_area_cache;
136 if (do_color_align) {
137 unsigned long base =
138 COLOUR_ALIGN_DOWN(addr - len, pgoff);
139
140 addr = base + len;
141 }
142
143 /* make sure it can fit in the remaining address space */
144 if (likely(addr > len)) {
145 vma = find_vma(mm, addr - len);
146 if (!vma || addr <= vma->vm_start) {
147 /* remember the address as a hint for next time */
148 return mm->free_area_cache = addr-len;
149 }
150 }
151
152 if (unlikely(mm->mmap_base < len))
153 goto bottomup;
154
155 addr = mm->mmap_base-len;
74 if (do_color_align) 156 if (do_color_align)
75 addr = COLOUR_ALIGN(addr, pgoff); 157 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
158
159 do {
160 /*
161 * Lookup failure means no vma is above this address,
162 * else if new region fits below vma->vm_start,
163 * return with success:
164 */
165 vma = find_vma(mm, addr);
166 if (likely(!vma || addr+len <= vma->vm_start)) {
167 /* remember the address as a hint for next time */
168 return mm->free_area_cache = addr;
169 }
170
171 /* remember the largest hole we saw so far */
172 if (addr + mm->cached_hole_size < vma->vm_start)
173 mm->cached_hole_size = vma->vm_start - addr;
174
175 /* try just below the current vma->vm_start */
176 addr = vma->vm_start-len;
177 if (do_color_align)
178 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
179 } while (likely(len < vma->vm_start));
180
181bottomup:
182 /*
183 * A failed mmap() very likely causes application failure,
184 * so fall back to the bottom-up function here. This scenario
185 * can happen with large stack limits and large mmap()
186 * allocations.
187 */
188 mm->cached_hole_size = ~0UL;
189 mm->free_area_cache = TASK_UNMAPPED_BASE;
190 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
191 /*
192 * Restore the topdown base:
193 */
194 mm->free_area_cache = mm->mmap_base;
195 mm->cached_hole_size = ~0UL;
196
197 return addr;
76 } 198 }
77} 199}
78 200
201unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr0,
202 unsigned long len, unsigned long pgoff, unsigned long flags)
203{
204 return arch_get_unmapped_area_foo(filp,
205 addr0, len, pgoff, flags, UP);
206}
207
208/*
209 * There is no need to export this but sched.h declares the function as
210 * extern so making it static here results in an error.
211 */
212unsigned long arch_get_unmapped_area_topdown(struct file *filp,
213 unsigned long addr0, unsigned long len, unsigned long pgoff,
214 unsigned long flags)
215{
216 return arch_get_unmapped_area_foo(filp,
217 addr0, len, pgoff, flags, DOWN);
218}
219
79void arch_pick_mmap_layout(struct mm_struct *mm) 220void arch_pick_mmap_layout(struct mm_struct *mm)
80{ 221{
81 unsigned long random_factor = 0UL; 222 unsigned long random_factor = 0UL;
@@ -89,9 +230,15 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
89 random_factor &= 0xffffffful; 230 random_factor &= 0xffffffful;
90 } 231 }
91 232
92 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; 233 if (mmap_is_legacy()) {
93 mm->get_unmapped_area = arch_get_unmapped_area; 234 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
94 mm->unmap_area = arch_unmap_area; 235 mm->get_unmapped_area = arch_get_unmapped_area;
236 mm->unmap_area = arch_unmap_area;
237 } else {
238 mm->mmap_base = mmap_base(random_factor);
239 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
240 mm->unmap_area = arch_unmap_area_topdown;
241 }
95} 242}
96 243
97static inline unsigned long brk_rnd(void) 244static inline unsigned long brk_rnd(void)
diff --git a/arch/mips/mm/pgtable-32.c b/arch/mips/mm/pgtable-32.c
index 575e4019227..adc6911ba74 100644
--- a/arch/mips/mm/pgtable-32.c
+++ b/arch/mips/mm/pgtable-32.c
@@ -52,7 +52,7 @@ void __init pagetable_init(void)
52 * Fixed mappings: 52 * Fixed mappings:
53 */ 53 */
54 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; 54 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
55 fixrange_init(vaddr, 0, pgd_base); 55 fixrange_init(vaddr, vaddr + FIXADDR_SIZE, pgd_base);
56 56
57#ifdef CONFIG_HIGHMEM 57#ifdef CONFIG_HIGHMEM
58 /* 58 /*
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
index 78eaa4f0b0e..cda4e300eb0 100644
--- a/arch/mips/mm/pgtable-64.c
+++ b/arch/mips/mm/pgtable-64.c
@@ -76,5 +76,5 @@ void __init pagetable_init(void)
76 * Fixed mappings: 76 * Fixed mappings:
77 */ 77 */
78 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; 78 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
79 fixrange_init(vaddr, 0, pgd_base); 79 fixrange_init(vaddr, vaddr + FIXADDR_SIZE, pgd_base);
80} 80}
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 424ed4b92e6..b6e1cff5066 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -42,6 +42,18 @@
42extern void tlb_do_page_fault_0(void); 42extern void tlb_do_page_fault_0(void);
43extern void tlb_do_page_fault_1(void); 43extern void tlb_do_page_fault_1(void);
44 44
45struct work_registers {
46 int r1;
47 int r2;
48 int r3;
49};
50
51struct tlb_reg_save {
52 unsigned long a;
53 unsigned long b;
54} ____cacheline_aligned_in_smp;
55
56static struct tlb_reg_save handler_reg_save[NR_CPUS];
45 57
46static inline int r45k_bvahwbug(void) 58static inline int r45k_bvahwbug(void)
47{ 59{
@@ -248,6 +260,73 @@ static int scratch_reg __cpuinitdata;
248static int pgd_reg __cpuinitdata; 260static int pgd_reg __cpuinitdata;
249enum vmalloc64_mode {not_refill, refill_scratch, refill_noscratch}; 261enum vmalloc64_mode {not_refill, refill_scratch, refill_noscratch};
250 262
263static struct work_registers __cpuinit build_get_work_registers(u32 **p)
264{
265 struct work_registers r;
266
267 int smp_processor_id_reg;
268 int smp_processor_id_sel;
269 int smp_processor_id_shift;
270
271 if (scratch_reg > 0) {
272 /* Save in CPU local C0_KScratch? */
273 UASM_i_MTC0(p, 1, 31, scratch_reg);
274 r.r1 = K0;
275 r.r2 = K1;
276 r.r3 = 1;
277 return r;
278 }
279
280 if (num_possible_cpus() > 1) {
281#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
282 smp_processor_id_shift = 51;
283 smp_processor_id_reg = 20; /* XContext */
284 smp_processor_id_sel = 0;
285#else
286# ifdef CONFIG_32BIT
287 smp_processor_id_shift = 25;
288 smp_processor_id_reg = 4; /* Context */
289 smp_processor_id_sel = 0;
290# endif
291# ifdef CONFIG_64BIT
292 smp_processor_id_shift = 26;
293 smp_processor_id_reg = 4; /* Context */
294 smp_processor_id_sel = 0;
295# endif
296#endif
297 /* Get smp_processor_id */
298 UASM_i_MFC0(p, K0, smp_processor_id_reg, smp_processor_id_sel);
299 UASM_i_SRL_SAFE(p, K0, K0, smp_processor_id_shift);
300
301 /* handler_reg_save index in K0 */
302 UASM_i_SLL(p, K0, K0, ilog2(sizeof(struct tlb_reg_save)));
303
304 UASM_i_LA(p, K1, (long)&handler_reg_save);
305 UASM_i_ADDU(p, K0, K0, K1);
306 } else {
307 UASM_i_LA(p, K0, (long)&handler_reg_save);
308 }
309 /* K0 now points to save area, save $1 and $2 */
310 UASM_i_SW(p, 1, offsetof(struct tlb_reg_save, a), K0);
311 UASM_i_SW(p, 2, offsetof(struct tlb_reg_save, b), K0);
312
313 r.r1 = K1;
314 r.r2 = 1;
315 r.r3 = 2;
316 return r;
317}
318
319static void __cpuinit build_restore_work_registers(u32 **p)
320{
321 if (scratch_reg > 0) {
322 UASM_i_MFC0(p, 1, 31, scratch_reg);
323 return;
324 }
325 /* K0 already points to save area, restore $1 and $2 */
326 UASM_i_LW(p, 1, offsetof(struct tlb_reg_save, a), K0);
327 UASM_i_LW(p, 2, offsetof(struct tlb_reg_save, b), K0);
328}
329
251#ifndef CONFIG_MIPS_PGD_C0_CONTEXT 330#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
252 331
253/* 332/*
@@ -1160,9 +1239,6 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1160 memset(relocs, 0, sizeof(relocs)); 1239 memset(relocs, 0, sizeof(relocs));
1161 memset(final_handler, 0, sizeof(final_handler)); 1240 memset(final_handler, 0, sizeof(final_handler));
1162 1241
1163 if (scratch_reg == 0)
1164 scratch_reg = allocate_kscratch();
1165
1166 if ((scratch_reg > 0 || scratchpad_available()) && use_bbit_insns()) { 1242 if ((scratch_reg > 0 || scratchpad_available()) && use_bbit_insns()) {
1167 htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1, 1243 htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1,
1168 scratch_reg); 1244 scratch_reg);
@@ -1462,22 +1538,28 @@ iPTE_SW(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr,
1462 */ 1538 */
1463static void __cpuinit 1539static void __cpuinit
1464build_pte_present(u32 **p, struct uasm_reloc **r, 1540build_pte_present(u32 **p, struct uasm_reloc **r,
1465 unsigned int pte, unsigned int ptr, enum label_id lid) 1541 int pte, int ptr, int scratch, enum label_id lid)
1466{ 1542{
1543 int t = scratch >= 0 ? scratch : pte;
1544
1467 if (kernel_uses_smartmips_rixi) { 1545 if (kernel_uses_smartmips_rixi) {
1468 if (use_bbit_insns()) { 1546 if (use_bbit_insns()) {
1469 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_PRESENT), lid); 1547 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_PRESENT), lid);
1470 uasm_i_nop(p); 1548 uasm_i_nop(p);
1471 } else { 1549 } else {
1472 uasm_i_andi(p, pte, pte, _PAGE_PRESENT); 1550 uasm_i_andi(p, t, pte, _PAGE_PRESENT);
1473 uasm_il_beqz(p, r, pte, lid); 1551 uasm_il_beqz(p, r, t, lid);
1474 iPTE_LW(p, pte, ptr); 1552 if (pte == t)
1553 /* You lose the SMP race :-(*/
1554 iPTE_LW(p, pte, ptr);
1475 } 1555 }
1476 } else { 1556 } else {
1477 uasm_i_andi(p, pte, pte, _PAGE_PRESENT | _PAGE_READ); 1557 uasm_i_andi(p, t, pte, _PAGE_PRESENT | _PAGE_READ);
1478 uasm_i_xori(p, pte, pte, _PAGE_PRESENT | _PAGE_READ); 1558 uasm_i_xori(p, t, t, _PAGE_PRESENT | _PAGE_READ);
1479 uasm_il_bnez(p, r, pte, lid); 1559 uasm_il_bnez(p, r, t, lid);
1480 iPTE_LW(p, pte, ptr); 1560 if (pte == t)
1561 /* You lose the SMP race :-(*/
1562 iPTE_LW(p, pte, ptr);
1481 } 1563 }
1482} 1564}
1483 1565
@@ -1497,19 +1579,19 @@ build_make_valid(u32 **p, struct uasm_reloc **r, unsigned int pte,
1497 */ 1579 */
1498static void __cpuinit 1580static void __cpuinit
1499build_pte_writable(u32 **p, struct uasm_reloc **r, 1581build_pte_writable(u32 **p, struct uasm_reloc **r,
1500 unsigned int pte, unsigned int ptr, enum label_id lid) 1582 unsigned int pte, unsigned int ptr, int scratch,
1583 enum label_id lid)
1501{ 1584{
1502 if (use_bbit_insns()) { 1585 int t = scratch >= 0 ? scratch : pte;
1503 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_PRESENT), lid); 1586
1504 uasm_i_nop(p); 1587 uasm_i_andi(p, t, pte, _PAGE_PRESENT | _PAGE_WRITE);
1505 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_WRITE), lid); 1588 uasm_i_xori(p, t, t, _PAGE_PRESENT | _PAGE_WRITE);
1506 uasm_i_nop(p); 1589 uasm_il_bnez(p, r, t, lid);
1507 } else { 1590 if (pte == t)
1508 uasm_i_andi(p, pte, pte, _PAGE_PRESENT | _PAGE_WRITE); 1591 /* You lose the SMP race :-(*/
1509 uasm_i_xori(p, pte, pte, _PAGE_PRESENT | _PAGE_WRITE);
1510 uasm_il_bnez(p, r, pte, lid);
1511 iPTE_LW(p, pte, ptr); 1592 iPTE_LW(p, pte, ptr);
1512 } 1593 else
1594 uasm_i_nop(p);
1513} 1595}
1514 1596
1515/* Make PTE writable, update software status bits as well, then store 1597/* Make PTE writable, update software status bits as well, then store
@@ -1531,15 +1613,19 @@ build_make_write(u32 **p, struct uasm_reloc **r, unsigned int pte,
1531 */ 1613 */
1532static void __cpuinit 1614static void __cpuinit
1533build_pte_modifiable(u32 **p, struct uasm_reloc **r, 1615build_pte_modifiable(u32 **p, struct uasm_reloc **r,
1534 unsigned int pte, unsigned int ptr, enum label_id lid) 1616 unsigned int pte, unsigned int ptr, int scratch,
1617 enum label_id lid)
1535{ 1618{
1536 if (use_bbit_insns()) { 1619 if (use_bbit_insns()) {
1537 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_WRITE), lid); 1620 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_WRITE), lid);
1538 uasm_i_nop(p); 1621 uasm_i_nop(p);
1539 } else { 1622 } else {
1540 uasm_i_andi(p, pte, pte, _PAGE_WRITE); 1623 int t = scratch >= 0 ? scratch : pte;
1541 uasm_il_beqz(p, r, pte, lid); 1624 uasm_i_andi(p, t, pte, _PAGE_WRITE);
1542 iPTE_LW(p, pte, ptr); 1625 uasm_il_beqz(p, r, t, lid);
1626 if (pte == t)
1627 /* You lose the SMP race :-(*/
1628 iPTE_LW(p, pte, ptr);
1543 } 1629 }
1544} 1630}
1545 1631
@@ -1619,7 +1705,7 @@ static void __cpuinit build_r3000_tlb_load_handler(void)
1619 memset(relocs, 0, sizeof(relocs)); 1705 memset(relocs, 0, sizeof(relocs));
1620 1706
1621 build_r3000_tlbchange_handler_head(&p, K0, K1); 1707 build_r3000_tlbchange_handler_head(&p, K0, K1);
1622 build_pte_present(&p, &r, K0, K1, label_nopage_tlbl); 1708 build_pte_present(&p, &r, K0, K1, -1, label_nopage_tlbl);
1623 uasm_i_nop(&p); /* load delay */ 1709 uasm_i_nop(&p); /* load delay */
1624 build_make_valid(&p, &r, K0, K1); 1710 build_make_valid(&p, &r, K0, K1);
1625 build_r3000_tlb_reload_write(&p, &l, &r, K0, K1); 1711 build_r3000_tlb_reload_write(&p, &l, &r, K0, K1);
@@ -1649,7 +1735,7 @@ static void __cpuinit build_r3000_tlb_store_handler(void)
1649 memset(relocs, 0, sizeof(relocs)); 1735 memset(relocs, 0, sizeof(relocs));
1650 1736
1651 build_r3000_tlbchange_handler_head(&p, K0, K1); 1737 build_r3000_tlbchange_handler_head(&p, K0, K1);
1652 build_pte_writable(&p, &r, K0, K1, label_nopage_tlbs); 1738 build_pte_writable(&p, &r, K0, K1, -1, label_nopage_tlbs);
1653 uasm_i_nop(&p); /* load delay */ 1739 uasm_i_nop(&p); /* load delay */
1654 build_make_write(&p, &r, K0, K1); 1740 build_make_write(&p, &r, K0, K1);
1655 build_r3000_tlb_reload_write(&p, &l, &r, K0, K1); 1741 build_r3000_tlb_reload_write(&p, &l, &r, K0, K1);
@@ -1673,13 +1759,14 @@ static void __cpuinit build_r3000_tlb_modify_handler(void)
1673 u32 *p = handle_tlbm; 1759 u32 *p = handle_tlbm;
1674 struct uasm_label *l = labels; 1760 struct uasm_label *l = labels;
1675 struct uasm_reloc *r = relocs; 1761 struct uasm_reloc *r = relocs;
1762 struct work_registers wr;
1676 1763
1677 memset(handle_tlbm, 0, sizeof(handle_tlbm)); 1764 memset(handle_tlbm, 0, sizeof(handle_tlbm));
1678 memset(labels, 0, sizeof(labels)); 1765 memset(labels, 0, sizeof(labels));
1679 memset(relocs, 0, sizeof(relocs)); 1766 memset(relocs, 0, sizeof(relocs));
1680 1767
1681 build_r3000_tlbchange_handler_head(&p, K0, K1); 1768 build_r3000_tlbchange_handler_head(&p, K0, K1);
1682 build_pte_modifiable(&p, &r, K0, K1, label_nopage_tlbm); 1769 build_pte_modifiable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbm);
1683 uasm_i_nop(&p); /* load delay */ 1770 uasm_i_nop(&p); /* load delay */
1684 build_make_write(&p, &r, K0, K1); 1771 build_make_write(&p, &r, K0, K1);
1685 build_r3000_pte_reload_tlbwi(&p, K0, K1); 1772 build_r3000_pte_reload_tlbwi(&p, K0, K1);
@@ -1702,15 +1789,16 @@ static void __cpuinit build_r3000_tlb_modify_handler(void)
1702/* 1789/*
1703 * R4000 style TLB load/store/modify handlers. 1790 * R4000 style TLB load/store/modify handlers.
1704 */ 1791 */
1705static void __cpuinit 1792static struct work_registers __cpuinit
1706build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l, 1793build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l,
1707 struct uasm_reloc **r, unsigned int pte, 1794 struct uasm_reloc **r)
1708 unsigned int ptr)
1709{ 1795{
1796 struct work_registers wr = build_get_work_registers(p);
1797
1710#ifdef CONFIG_64BIT 1798#ifdef CONFIG_64BIT
1711 build_get_pmde64(p, l, r, pte, ptr); /* get pmd in ptr */ 1799 build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */
1712#else 1800#else
1713 build_get_pgde32(p, pte, ptr); /* get pgd in ptr */ 1801 build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
1714#endif 1802#endif
1715 1803
1716#ifdef CONFIG_HUGETLB_PAGE 1804#ifdef CONFIG_HUGETLB_PAGE
@@ -1719,21 +1807,22 @@ build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l,
1719 * instead contains the tlb pte. Check the PAGE_HUGE bit and 1807 * instead contains the tlb pte. Check the PAGE_HUGE bit and
1720 * see if we need to jump to huge tlb processing. 1808 * see if we need to jump to huge tlb processing.
1721 */ 1809 */
1722 build_is_huge_pte(p, r, pte, ptr, label_tlb_huge_update); 1810 build_is_huge_pte(p, r, wr.r1, wr.r2, label_tlb_huge_update);
1723#endif 1811#endif
1724 1812
1725 UASM_i_MFC0(p, pte, C0_BADVADDR); 1813 UASM_i_MFC0(p, wr.r1, C0_BADVADDR);
1726 UASM_i_LW(p, ptr, 0, ptr); 1814 UASM_i_LW(p, wr.r2, 0, wr.r2);
1727 UASM_i_SRL(p, pte, pte, PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2); 1815 UASM_i_SRL(p, wr.r1, wr.r1, PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2);
1728 uasm_i_andi(p, pte, pte, (PTRS_PER_PTE - 1) << PTE_T_LOG2); 1816 uasm_i_andi(p, wr.r1, wr.r1, (PTRS_PER_PTE - 1) << PTE_T_LOG2);
1729 UASM_i_ADDU(p, ptr, ptr, pte); 1817 UASM_i_ADDU(p, wr.r2, wr.r2, wr.r1);
1730 1818
1731#ifdef CONFIG_SMP 1819#ifdef CONFIG_SMP
1732 uasm_l_smp_pgtable_change(l, *p); 1820 uasm_l_smp_pgtable_change(l, *p);
1733#endif 1821#endif
1734 iPTE_LW(p, pte, ptr); /* get even pte */ 1822 iPTE_LW(p, wr.r1, wr.r2); /* get even pte */
1735 if (!m4kc_tlbp_war()) 1823 if (!m4kc_tlbp_war())
1736 build_tlb_probe_entry(p); 1824 build_tlb_probe_entry(p);
1825 return wr;
1737} 1826}
1738 1827
1739static void __cpuinit 1828static void __cpuinit
@@ -1746,6 +1835,7 @@ build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l,
1746 build_update_entries(p, tmp, ptr); 1835 build_update_entries(p, tmp, ptr);
1747 build_tlb_write_entry(p, l, r, tlb_indexed); 1836 build_tlb_write_entry(p, l, r, tlb_indexed);
1748 uasm_l_leave(l, *p); 1837 uasm_l_leave(l, *p);
1838 build_restore_work_registers(p);
1749 uasm_i_eret(p); /* return from trap */ 1839 uasm_i_eret(p); /* return from trap */
1750 1840
1751#ifdef CONFIG_64BIT 1841#ifdef CONFIG_64BIT
@@ -1758,6 +1848,7 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1758 u32 *p = handle_tlbl; 1848 u32 *p = handle_tlbl;
1759 struct uasm_label *l = labels; 1849 struct uasm_label *l = labels;
1760 struct uasm_reloc *r = relocs; 1850 struct uasm_reloc *r = relocs;
1851 struct work_registers wr;
1761 1852
1762 memset(handle_tlbl, 0, sizeof(handle_tlbl)); 1853 memset(handle_tlbl, 0, sizeof(handle_tlbl));
1763 memset(labels, 0, sizeof(labels)); 1854 memset(labels, 0, sizeof(labels));
@@ -1777,8 +1868,8 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1777 /* No need for uasm_i_nop */ 1868 /* No need for uasm_i_nop */
1778 } 1869 }
1779 1870
1780 build_r4000_tlbchange_handler_head(&p, &l, &r, K0, K1); 1871 wr = build_r4000_tlbchange_handler_head(&p, &l, &r);
1781 build_pte_present(&p, &r, K0, K1, label_nopage_tlbl); 1872 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl);
1782 if (m4kc_tlbp_war()) 1873 if (m4kc_tlbp_war())
1783 build_tlb_probe_entry(&p); 1874 build_tlb_probe_entry(&p);
1784 1875
@@ -1788,44 +1879,43 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1788 * have triggered it. Skip the expensive test.. 1879 * have triggered it. Skip the expensive test..
1789 */ 1880 */
1790 if (use_bbit_insns()) { 1881 if (use_bbit_insns()) {
1791 uasm_il_bbit0(&p, &r, K0, ilog2(_PAGE_VALID), 1882 uasm_il_bbit0(&p, &r, wr.r1, ilog2(_PAGE_VALID),
1792 label_tlbl_goaround1); 1883 label_tlbl_goaround1);
1793 } else { 1884 } else {
1794 uasm_i_andi(&p, K0, K0, _PAGE_VALID); 1885 uasm_i_andi(&p, wr.r3, wr.r1, _PAGE_VALID);
1795 uasm_il_beqz(&p, &r, K0, label_tlbl_goaround1); 1886 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround1);
1796 } 1887 }
1797 uasm_i_nop(&p); 1888 uasm_i_nop(&p);
1798 1889
1799 uasm_i_tlbr(&p); 1890 uasm_i_tlbr(&p);
1800 /* Examine entrylo 0 or 1 based on ptr. */ 1891 /* Examine entrylo 0 or 1 based on ptr. */
1801 if (use_bbit_insns()) { 1892 if (use_bbit_insns()) {
1802 uasm_i_bbit0(&p, K1, ilog2(sizeof(pte_t)), 8); 1893 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
1803 } else { 1894 } else {
1804 uasm_i_andi(&p, K0, K1, sizeof(pte_t)); 1895 uasm_i_andi(&p, wr.r3, wr.r2, sizeof(pte_t));
1805 uasm_i_beqz(&p, K0, 8); 1896 uasm_i_beqz(&p, wr.r3, 8);
1806 } 1897 }
1807 1898 /* load it in the delay slot*/
1808 UASM_i_MFC0(&p, K0, C0_ENTRYLO0); /* load it in the delay slot*/ 1899 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO0);
1809 UASM_i_MFC0(&p, K0, C0_ENTRYLO1); /* load it if ptr is odd */ 1900 /* load it if ptr is odd */
1901 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO1);
1810 /* 1902 /*
1811 * If the entryLo (now in K0) is valid (bit 1), RI or 1903 * If the entryLo (now in wr.r3) is valid (bit 1), RI or
1812 * XI must have triggered it. 1904 * XI must have triggered it.
1813 */ 1905 */
1814 if (use_bbit_insns()) { 1906 if (use_bbit_insns()) {
1815 uasm_il_bbit1(&p, &r, K0, 1, label_nopage_tlbl); 1907 uasm_il_bbit1(&p, &r, wr.r3, 1, label_nopage_tlbl);
1816 /* Reload the PTE value */ 1908 uasm_i_nop(&p);
1817 iPTE_LW(&p, K0, K1);
1818 uasm_l_tlbl_goaround1(&l, p); 1909 uasm_l_tlbl_goaround1(&l, p);
1819 } else { 1910 } else {
1820 uasm_i_andi(&p, K0, K0, 2); 1911 uasm_i_andi(&p, wr.r3, wr.r3, 2);
1821 uasm_il_bnez(&p, &r, K0, label_nopage_tlbl); 1912 uasm_il_bnez(&p, &r, wr.r3, label_nopage_tlbl);
1822 uasm_l_tlbl_goaround1(&l, p); 1913 uasm_i_nop(&p);
1823 /* Reload the PTE value */
1824 iPTE_LW(&p, K0, K1);
1825 } 1914 }
1915 uasm_l_tlbl_goaround1(&l, p);
1826 } 1916 }
1827 build_make_valid(&p, &r, K0, K1); 1917 build_make_valid(&p, &r, wr.r1, wr.r2);
1828 build_r4000_tlbchange_handler_tail(&p, &l, &r, K0, K1); 1918 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
1829 1919
1830#ifdef CONFIG_HUGETLB_PAGE 1920#ifdef CONFIG_HUGETLB_PAGE
1831 /* 1921 /*
@@ -1833,8 +1923,8 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1833 * spots a huge page. 1923 * spots a huge page.
1834 */ 1924 */
1835 uasm_l_tlb_huge_update(&l, p); 1925 uasm_l_tlb_huge_update(&l, p);
1836 iPTE_LW(&p, K0, K1); 1926 iPTE_LW(&p, wr.r1, wr.r2);
1837 build_pte_present(&p, &r, K0, K1, label_nopage_tlbl); 1927 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl);
1838 build_tlb_probe_entry(&p); 1928 build_tlb_probe_entry(&p);
1839 1929
1840 if (kernel_uses_smartmips_rixi) { 1930 if (kernel_uses_smartmips_rixi) {
@@ -1843,50 +1933,51 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1843 * have triggered it. Skip the expensive test.. 1933 * have triggered it. Skip the expensive test..
1844 */ 1934 */
1845 if (use_bbit_insns()) { 1935 if (use_bbit_insns()) {
1846 uasm_il_bbit0(&p, &r, K0, ilog2(_PAGE_VALID), 1936 uasm_il_bbit0(&p, &r, wr.r1, ilog2(_PAGE_VALID),
1847 label_tlbl_goaround2); 1937 label_tlbl_goaround2);
1848 } else { 1938 } else {
1849 uasm_i_andi(&p, K0, K0, _PAGE_VALID); 1939 uasm_i_andi(&p, wr.r3, wr.r1, _PAGE_VALID);
1850 uasm_il_beqz(&p, &r, K0, label_tlbl_goaround2); 1940 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2);
1851 } 1941 }
1852 uasm_i_nop(&p); 1942 uasm_i_nop(&p);
1853 1943
1854 uasm_i_tlbr(&p); 1944 uasm_i_tlbr(&p);
1855 /* Examine entrylo 0 or 1 based on ptr. */ 1945 /* Examine entrylo 0 or 1 based on ptr. */
1856 if (use_bbit_insns()) { 1946 if (use_bbit_insns()) {
1857 uasm_i_bbit0(&p, K1, ilog2(sizeof(pte_t)), 8); 1947 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
1858 } else { 1948 } else {
1859 uasm_i_andi(&p, K0, K1, sizeof(pte_t)); 1949 uasm_i_andi(&p, wr.r3, wr.r2, sizeof(pte_t));
1860 uasm_i_beqz(&p, K0, 8); 1950 uasm_i_beqz(&p, wr.r3, 8);
1861 } 1951 }
1862 UASM_i_MFC0(&p, K0, C0_ENTRYLO0); /* load it in the delay slot*/ 1952 /* load it in the delay slot*/
1863 UASM_i_MFC0(&p, K0, C0_ENTRYLO1); /* load it if ptr is odd */ 1953 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO0);
1954 /* load it if ptr is odd */
1955 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO1);
1864 /* 1956 /*
1865 * If the entryLo (now in K0) is valid (bit 1), RI or 1957 * If the entryLo (now in wr.r3) is valid (bit 1), RI or
1866 * XI must have triggered it. 1958 * XI must have triggered it.
1867 */ 1959 */
1868 if (use_bbit_insns()) { 1960 if (use_bbit_insns()) {
1869 uasm_il_bbit0(&p, &r, K0, 1, label_tlbl_goaround2); 1961 uasm_il_bbit0(&p, &r, wr.r3, 1, label_tlbl_goaround2);
1870 } else { 1962 } else {
1871 uasm_i_andi(&p, K0, K0, 2); 1963 uasm_i_andi(&p, wr.r3, wr.r3, 2);
1872 uasm_il_beqz(&p, &r, K0, label_tlbl_goaround2); 1964 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2);
1873 } 1965 }
1874 /* Reload the PTE value */
1875 iPTE_LW(&p, K0, K1);
1876 1966
1877 /* 1967 /*
1878 * We clobbered C0_PAGEMASK, restore it. On the other branch 1968 * We clobbered C0_PAGEMASK, restore it. On the other branch
1879 * it is restored in build_huge_tlb_write_entry. 1969 * it is restored in build_huge_tlb_write_entry.
1880 */ 1970 */
1881 build_restore_pagemask(&p, &r, K0, label_nopage_tlbl, 0); 1971 build_restore_pagemask(&p, &r, wr.r3, label_nopage_tlbl, 0);
1882 1972
1883 uasm_l_tlbl_goaround2(&l, p); 1973 uasm_l_tlbl_goaround2(&l, p);
1884 } 1974 }
1885 uasm_i_ori(&p, K0, K0, (_PAGE_ACCESSED | _PAGE_VALID)); 1975 uasm_i_ori(&p, wr.r1, wr.r1, (_PAGE_ACCESSED | _PAGE_VALID));
1886 build_huge_handler_tail(&p, &r, &l, K0, K1); 1976 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2);
1887#endif 1977#endif
1888 1978
1889 uasm_l_nopage_tlbl(&l, p); 1979 uasm_l_nopage_tlbl(&l, p);
1980 build_restore_work_registers(&p);
1890 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff); 1981 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff);
1891 uasm_i_nop(&p); 1982 uasm_i_nop(&p);
1892 1983
@@ -1905,17 +1996,18 @@ static void __cpuinit build_r4000_tlb_store_handler(void)
1905 u32 *p = handle_tlbs; 1996 u32 *p = handle_tlbs;
1906 struct uasm_label *l = labels; 1997 struct uasm_label *l = labels;
1907 struct uasm_reloc *r = relocs; 1998 struct uasm_reloc *r = relocs;
1999 struct work_registers wr;
1908 2000
1909 memset(handle_tlbs, 0, sizeof(handle_tlbs)); 2001 memset(handle_tlbs, 0, sizeof(handle_tlbs));
1910 memset(labels, 0, sizeof(labels)); 2002 memset(labels, 0, sizeof(labels));
1911 memset(relocs, 0, sizeof(relocs)); 2003 memset(relocs, 0, sizeof(relocs));
1912 2004
1913 build_r4000_tlbchange_handler_head(&p, &l, &r, K0, K1); 2005 wr = build_r4000_tlbchange_handler_head(&p, &l, &r);
1914 build_pte_writable(&p, &r, K0, K1, label_nopage_tlbs); 2006 build_pte_writable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbs);
1915 if (m4kc_tlbp_war()) 2007 if (m4kc_tlbp_war())
1916 build_tlb_probe_entry(&p); 2008 build_tlb_probe_entry(&p);
1917 build_make_write(&p, &r, K0, K1); 2009 build_make_write(&p, &r, wr.r1, wr.r2);
1918 build_r4000_tlbchange_handler_tail(&p, &l, &r, K0, K1); 2010 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
1919 2011
1920#ifdef CONFIG_HUGETLB_PAGE 2012#ifdef CONFIG_HUGETLB_PAGE
1921 /* 2013 /*
@@ -1923,15 +2015,16 @@ static void __cpuinit build_r4000_tlb_store_handler(void)
1923 * build_r4000_tlbchange_handler_head spots a huge page. 2015 * build_r4000_tlbchange_handler_head spots a huge page.
1924 */ 2016 */
1925 uasm_l_tlb_huge_update(&l, p); 2017 uasm_l_tlb_huge_update(&l, p);
1926 iPTE_LW(&p, K0, K1); 2018 iPTE_LW(&p, wr.r1, wr.r2);
1927 build_pte_writable(&p, &r, K0, K1, label_nopage_tlbs); 2019 build_pte_writable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbs);
1928 build_tlb_probe_entry(&p); 2020 build_tlb_probe_entry(&p);
1929 uasm_i_ori(&p, K0, K0, 2021 uasm_i_ori(&p, wr.r1, wr.r1,
1930 _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_VALID | _PAGE_DIRTY); 2022 _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_VALID | _PAGE_DIRTY);
1931 build_huge_handler_tail(&p, &r, &l, K0, K1); 2023 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2);
1932#endif 2024#endif
1933 2025
1934 uasm_l_nopage_tlbs(&l, p); 2026 uasm_l_nopage_tlbs(&l, p);
2027 build_restore_work_registers(&p);
1935 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); 2028 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
1936 uasm_i_nop(&p); 2029 uasm_i_nop(&p);
1937 2030
@@ -1950,18 +2043,19 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)
1950 u32 *p = handle_tlbm; 2043 u32 *p = handle_tlbm;
1951 struct uasm_label *l = labels; 2044 struct uasm_label *l = labels;
1952 struct uasm_reloc *r = relocs; 2045 struct uasm_reloc *r = relocs;
2046 struct work_registers wr;
1953 2047
1954 memset(handle_tlbm, 0, sizeof(handle_tlbm)); 2048 memset(handle_tlbm, 0, sizeof(handle_tlbm));
1955 memset(labels, 0, sizeof(labels)); 2049 memset(labels, 0, sizeof(labels));
1956 memset(relocs, 0, sizeof(relocs)); 2050 memset(relocs, 0, sizeof(relocs));
1957 2051
1958 build_r4000_tlbchange_handler_head(&p, &l, &r, K0, K1); 2052 wr = build_r4000_tlbchange_handler_head(&p, &l, &r);
1959 build_pte_modifiable(&p, &r, K0, K1, label_nopage_tlbm); 2053 build_pte_modifiable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbm);
1960 if (m4kc_tlbp_war()) 2054 if (m4kc_tlbp_war())
1961 build_tlb_probe_entry(&p); 2055 build_tlb_probe_entry(&p);
1962 /* Present and writable bits set, set accessed and dirty bits. */ 2056 /* Present and writable bits set, set accessed and dirty bits. */
1963 build_make_write(&p, &r, K0, K1); 2057 build_make_write(&p, &r, wr.r1, wr.r2);
1964 build_r4000_tlbchange_handler_tail(&p, &l, &r, K0, K1); 2058 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
1965 2059
1966#ifdef CONFIG_HUGETLB_PAGE 2060#ifdef CONFIG_HUGETLB_PAGE
1967 /* 2061 /*
@@ -1969,15 +2063,16 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)
1969 * build_r4000_tlbchange_handler_head spots a huge page. 2063 * build_r4000_tlbchange_handler_head spots a huge page.
1970 */ 2064 */
1971 uasm_l_tlb_huge_update(&l, p); 2065 uasm_l_tlb_huge_update(&l, p);
1972 iPTE_LW(&p, K0, K1); 2066 iPTE_LW(&p, wr.r1, wr.r2);
1973 build_pte_modifiable(&p, &r, K0, K1, label_nopage_tlbm); 2067 build_pte_modifiable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbm);
1974 build_tlb_probe_entry(&p); 2068 build_tlb_probe_entry(&p);
1975 uasm_i_ori(&p, K0, K0, 2069 uasm_i_ori(&p, wr.r1, wr.r1,
1976 _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_VALID | _PAGE_DIRTY); 2070 _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_VALID | _PAGE_DIRTY);
1977 build_huge_handler_tail(&p, &r, &l, K0, K1); 2071 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2);
1978#endif 2072#endif
1979 2073
1980 uasm_l_nopage_tlbm(&l, p); 2074 uasm_l_nopage_tlbm(&l, p);
2075 build_restore_work_registers(&p);
1981 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); 2076 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
1982 uasm_i_nop(&p); 2077 uasm_i_nop(&p);
1983 2078
@@ -2036,6 +2131,7 @@ void __cpuinit build_tlb_refill_handler(void)
2036 2131
2037 default: 2132 default:
2038 if (!run_once) { 2133 if (!run_once) {
2134 scratch_reg = allocate_kscratch();
2039#ifdef CONFIG_MIPS_PGD_C0_CONTEXT 2135#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
2040 build_r4000_setup_pgd(); 2136 build_r4000_setup_pgd();
2041#endif 2137#endif
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index 31180c321a1..4b988b9a30d 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -28,6 +28,7 @@
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/system.h> 29#include <asm/system.h>
30#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
31#include <asm/smp-ops.h>
31#include <asm/traps.h> 32#include <asm/traps.h>
32 33
33#include <asm/gcmpregs.h> 34#include <asm/gcmpregs.h>
@@ -358,15 +359,14 @@ void __init prom_init(void)
358#ifdef CONFIG_SERIAL_8250_CONSOLE 359#ifdef CONFIG_SERIAL_8250_CONSOLE
359 console_config(); 360 console_config();
360#endif 361#endif
361#ifdef CONFIG_MIPS_CMP
362 /* Early detection of CMP support */ 362 /* Early detection of CMP support */
363 if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ)) 363 if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ))
364 register_smp_ops(&cmp_smp_ops); 364 if (!register_cmp_smp_ops())
365 else 365 return;
366#endif 366
367#ifdef CONFIG_MIPS_MT_SMP 367 if (!register_vsmp_smp_ops())
368 register_smp_ops(&vsmp_smp_ops); 368 return;
369#endif 369
370#ifdef CONFIG_MIPS_MT_SMTC 370#ifdef CONFIG_MIPS_MT_SMTC
371 register_smp_ops(&msmtc_smp_ops); 371 register_smp_ops(&msmtc_smp_ops);
372#endif 372#endif
diff --git a/arch/mips/mti-malta/malta-smtc.c b/arch/mips/mti-malta/malta-smtc.c
index 49a38b09a48..1efc8c39448 100644
--- a/arch/mips/mti-malta/malta-smtc.c
+++ b/arch/mips/mti-malta/malta-smtc.c
@@ -152,7 +152,7 @@ int plat_set_irq_affinity(struct irq_data *d, const struct cpumask *affinity,
152 * runtime code can anyway deal with the null set 152 * runtime code can anyway deal with the null set
153 */ 153 */
154 printk(KERN_WARNING 154 printk(KERN_WARNING
155 "IRQ affinity leaves no legal CPU for IRQ %d\n", irq); 155 "IRQ affinity leaves no legal CPU for IRQ %d\n", d->irq);
156 156
157 /* Do any generic SMTC IRQ affinity setup */ 157 /* Do any generic SMTC IRQ affinity setup */
158 smtc_set_irq_affinity(d->irq, tmask); 158 smtc_set_irq_affinity(d->irq, tmask);
diff --git a/arch/mips/netlogic/Platform b/arch/mips/netlogic/Platform
new file mode 100644
index 00000000000..f87c1640abb
--- /dev/null
+++ b/arch/mips/netlogic/Platform
@@ -0,0 +1,11 @@
1#
2# NETLOGIC includes
3#
4cflags-$(CONFIG_NLM_COMMON) += -I$(srctree)/arch/mips/include/asm/mach-netlogic
5cflags-$(CONFIG_NLM_COMMON) += -I$(srctree)/arch/mips/include/asm/netlogic
6
7#
8# NETLOGIC XLR/XLS SoC, Simulator and boards
9#
10core-$(CONFIG_NLM_XLR) += arch/mips/netlogic/xlr/
11load-$(CONFIG_NLM_XLR_BOARD) += 0xffffffff84000000
diff --git a/arch/mips/netlogic/xlr/irq.c b/arch/mips/netlogic/xlr/irq.c
index 1446d58e364..521bb7377eb 100644
--- a/arch/mips/netlogic/xlr/irq.c
+++ b/arch/mips/netlogic/xlr/irq.c
@@ -209,7 +209,7 @@ void __init init_xlr_irqs(void)
209 irq_set_chip_and_handler(i, &xlr_pic, handle_level_irq); 209 irq_set_chip_and_handler(i, &xlr_pic, handle_level_irq);
210 else 210 else
211 irq_set_chip_and_handler(i, &nlm_cpu_intr, 211 irq_set_chip_and_handler(i, &nlm_cpu_intr,
212 handle_level_irq); 212 handle_percpu_irq);
213 } 213 }
214#ifdef CONFIG_SMP 214#ifdef CONFIG_SMP
215 irq_set_chip_and_handler(IRQ_IPI_SMP_FUNCTION, &nlm_cpu_intr, 215 irq_set_chip_and_handler(IRQ_IPI_SMP_FUNCTION, &nlm_cpu_intr,
diff --git a/arch/mips/netlogic/xlr/smp.c b/arch/mips/netlogic/xlr/smp.c
index b495a7f1433..d842bce5c94 100644
--- a/arch/mips/netlogic/xlr/smp.c
+++ b/arch/mips/netlogic/xlr/smp.c
@@ -87,17 +87,7 @@ void nlm_smp_function_ipi_handler(unsigned int irq, struct irq_desc *desc)
87/* IRQ_IPI_SMP_RESCHEDULE handler */ 87/* IRQ_IPI_SMP_RESCHEDULE handler */
88void nlm_smp_resched_ipi_handler(unsigned int irq, struct irq_desc *desc) 88void nlm_smp_resched_ipi_handler(unsigned int irq, struct irq_desc *desc)
89{ 89{
90 set_need_resched(); 90 scheduler_ipi();
91}
92
93void nlm_common_ipi_handler(int irq, struct pt_regs *regs)
94{
95 if (irq == IRQ_IPI_SMP_FUNCTION) {
96 smp_call_function_interrupt();
97 } else {
98 /* Announce that we are for reschduling */
99 set_need_resched();
100 }
101} 91}
102 92
103/* 93/*
@@ -122,6 +112,7 @@ void nlm_smp_finish(void)
122#ifdef notyet 112#ifdef notyet
123 nlm_common_msgring_cpu_init(); 113 nlm_common_msgring_cpu_init();
124#endif 114#endif
115 local_irq_enable();
125} 116}
126 117
127void nlm_cpus_done(void) 118void nlm_cpus_done(void)
diff --git a/arch/mips/nxp/pnx8550/common/setup.c b/arch/mips/nxp/pnx8550/common/setup.c
index 64246c9c875..71adac32332 100644
--- a/arch/mips/nxp/pnx8550/common/setup.c
+++ b/arch/mips/nxp/pnx8550/common/setup.c
@@ -140,6 +140,4 @@ void __init plat_mem_setup(void)
140 PNX8XXX_UART_LCR_8BIT; 140 PNX8XXX_UART_LCR_8BIT;
141 ip3106_baud(UART_BASE, pnx8550_console_port) = 5; 141 ip3106_baud(UART_BASE, pnx8550_console_port) = 5;
142 } 142 }
143
144 return;
145} 143}
diff --git a/arch/mips/pci/ops-nile4.c b/arch/mips/pci/ops-nile4.c
index b7f0fb0210f..99929cf8841 100644
--- a/arch/mips/pci/ops-nile4.c
+++ b/arch/mips/pci/ops-nile4.c
@@ -4,7 +4,6 @@
4#include <asm/bootinfo.h> 4#include <asm/bootinfo.h>
5 5
6#include <asm/lasat/lasat.h> 6#include <asm/lasat/lasat.h>
7#include <asm/gt64120.h>
8#include <asm/nile4.h> 7#include <asm/nile4.h>
9 8
10#define PCI_ACCESS_READ 0 9#define PCI_ACCESS_READ 0
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_setup.c b/arch/mips/pmc-sierra/msp71xx/msp_setup.c
index 2413ea67877..0abfbe04ffc 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_setup.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_setup.c
@@ -228,13 +228,11 @@ void __init prom_init(void)
228 */ 228 */
229 msp_serial_setup(); 229 msp_serial_setup();
230 230
231#ifdef CONFIG_MIPS_MT_SMP 231 if (register_vsmp_smp_ops()) {
232 register_smp_ops(&vsmp_smp_ops);
233#endif
234
235#ifdef CONFIG_MIPS_MT_SMTC 232#ifdef CONFIG_MIPS_MT_SMTC
236 register_smp_ops(&msp_smtc_smp_ops); 233 register_smp_ops(&msp_smtc_smp_ops);
237#endif 234#endif
235 }
238 236
239#ifdef CONFIG_PMCTWILED 237#ifdef CONFIG_PMCTWILED
240 /* 238 /*
diff --git a/arch/mips/pnx8550/common/setup.c b/arch/mips/pnx8550/common/setup.c
index 43cb3945fdb..fccd6b0c6d3 100644
--- a/arch/mips/pnx8550/common/setup.c
+++ b/arch/mips/pnx8550/common/setup.c
@@ -139,6 +139,4 @@ void __init plat_mem_setup(void)
139 PNX8XXX_UART_LCR_8BIT; 139 PNX8XXX_UART_LCR_8BIT;
140 ip3106_baud(UART_BASE, pnx8550_console_port) = 5; 140 ip3106_baud(UART_BASE, pnx8550_console_port) = 5;
141 } 141 }
142
143 return;
144} 142}
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 041fc1afc3f..a969eb82663 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -251,28 +251,22 @@ static struct platform_device *rb532_devs[] = {
251 251
252static void __init parse_mac_addr(char *macstr) 252static void __init parse_mac_addr(char *macstr)
253{ 253{
254 int i, j; 254 int i, h, l;
255 unsigned char result, value;
256 255
257 for (i = 0; i < 6; i++) { 256 for (i = 0; i < 6; i++) {
258 result = 0;
259
260 if (i != 5 && *(macstr + 2) != ':') 257 if (i != 5 && *(macstr + 2) != ':')
261 return; 258 return;
262 259
263 for (j = 0; j < 2; j++) { 260 h = hex_to_bin(*macstr++);
264 if (isxdigit(*macstr) 261 if (h == -1)
265 && (value = 262 return;
266 isdigit(*macstr) ? *macstr - 263
267 '0' : toupper(*macstr) - 'A' + 10) < 16) { 264 l = hex_to_bin(*macstr++);
268 result = result * 16 + value; 265 if (l == -1)
269 macstr++; 266 return;
270 } else
271 return;
272 }
273 267
274 macstr++; 268 macstr++;
275 korina_dev0_data.mac[i] = result; 269 korina_dev0_data.mac[i] = (h << 4) + l;
276 } 270 }
277} 271}
278 272
diff --git a/arch/mips/sgi-ip27/ip27-nmi.c b/arch/mips/sgi-ip27/ip27-nmi.c
index bc4fa8dd67f..005c29ed419 100644
--- a/arch/mips/sgi-ip27/ip27-nmi.c
+++ b/arch/mips/sgi-ip27/ip27-nmi.c
@@ -3,7 +3,7 @@
3#include <linux/nodemask.h> 3#include <linux/nodemask.h>
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <linux/smp.h> 5#include <linux/smp.h>
6#include <asm/atomic.h> 6#include <linux/atomic.h>
7#include <asm/sn/types.h> 7#include <asm/sn/types.h>
8#include <asm/sn/addrs.h> 8#include <asm/sn/addrs.h>
9#include <asm/sn/nmi.h> 9#include <asm/sn/nmi.h>
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index be4460a5f6a..76ee045e2ce 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -123,6 +123,13 @@ static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask,
123} 123}
124#endif 124#endif
125 125
126static void disable_sb1250_irq(struct irq_data *d)
127{
128 unsigned int irq = d->irq;
129
130 sb1250_mask_irq(sb1250_irq_owner[irq], irq);
131}
132
126static void enable_sb1250_irq(struct irq_data *d) 133static void enable_sb1250_irq(struct irq_data *d)
127{ 134{
128 unsigned int irq = d->irq; 135 unsigned int irq = d->irq;
@@ -180,6 +187,7 @@ static struct irq_chip sb1250_irq_type = {
180 .name = "SB1250-IMR", 187 .name = "SB1250-IMR",
181 .irq_mask_ack = ack_sb1250_irq, 188 .irq_mask_ack = ack_sb1250_irq,
182 .irq_unmask = enable_sb1250_irq, 189 .irq_unmask = enable_sb1250_irq,
190 .irq_mask = disable_sb1250_irq,
183#ifdef CONFIG_SMP 191#ifdef CONFIG_SMP
184 .irq_set_affinity = sb1250_set_affinity 192 .irq_set_affinity = sb1250_set_affinity
185#endif 193#endif
diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h
index 9d773a63951..b9a8f846126 100644
--- a/arch/mn10300/include/asm/atomic.h
+++ b/arch/mn10300/include/asm/atomic.h
@@ -260,16 +260,15 @@ static inline void atomic_dec(atomic_t *v)
260#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) 260#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
261#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) 261#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
262 262
263#define atomic_add_unless(v, a, u) \ 263#define __atomic_add_unless(v, a, u) \
264({ \ 264({ \
265 int c, old; \ 265 int c, old; \
266 c = atomic_read(v); \ 266 c = atomic_read(v); \
267 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 267 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
268 c = old; \ 268 c = old; \
269 c != (u); \ 269 c; \
270}) 270})
271 271
272#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
273 272
274/** 273/**
275 * atomic_clear_mask - Atomically clear bits in memory 274 * atomic_clear_mask - Atomically clear bits in memory
@@ -344,8 +343,6 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *addr)
344#define smp_mb__before_atomic_inc() barrier() 343#define smp_mb__before_atomic_inc() barrier()
345#define smp_mb__after_atomic_inc() barrier() 344#define smp_mb__after_atomic_inc() barrier()
346 345
347#include <asm-generic/atomic-long.h>
348
349#endif /* __KERNEL__ */ 346#endif /* __KERNEL__ */
350#endif /* CONFIG_SMP */ 347#endif /* CONFIG_SMP */
351#endif /* _ASM_ATOMIC_H */ 348#endif /* _ASM_ATOMIC_H */
diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h
index 0939462967e..596bb2706d8 100644
--- a/arch/mn10300/include/asm/bitops.h
+++ b/arch/mn10300/include/asm/bitops.h
@@ -227,12 +227,7 @@ int ffs(int x)
227#include <asm-generic/bitops/find.h> 227#include <asm-generic/bitops/find.h>
228#include <asm-generic/bitops/sched.h> 228#include <asm-generic/bitops/sched.h>
229#include <asm-generic/bitops/hweight.h> 229#include <asm-generic/bitops/hweight.h>
230 230#include <asm-generic/bitops/ext2-atomic-setbit.h>
231#define ext2_set_bit_atomic(lock, nr, addr) \
232 test_and_set_bit((nr), (addr))
233#define ext2_clear_bit_atomic(lock, nr, addr) \
234 test_and_clear_bit((nr), (addr))
235
236#include <asm-generic/bitops/le.h> 231#include <asm-generic/bitops/le.h>
237 232
238#endif /* __KERNEL__ */ 233#endif /* __KERNEL__ */
diff --git a/arch/mn10300/include/asm/mmu_context.h b/arch/mn10300/include/asm/mmu_context.h
index c8f6c82672a..c67c2b5365a 100644
--- a/arch/mn10300/include/asm/mmu_context.h
+++ b/arch/mn10300/include/asm/mmu_context.h
@@ -22,7 +22,7 @@
22#ifndef _ASM_MMU_CONTEXT_H 22#ifndef _ASM_MMU_CONTEXT_H
23#define _ASM_MMU_CONTEXT_H 23#define _ASM_MMU_CONTEXT_H
24 24
25#include <asm/atomic.h> 25#include <linux/atomic.h>
26#include <asm/pgalloc.h> 26#include <asm/pgalloc.h>
27#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
28#include <asm-generic/mm_hooks.h> 28#include <asm-generic/mm_hooks.h>
diff --git a/arch/mn10300/include/asm/processor.h b/arch/mn10300/include/asm/processor.h
index 4c1b5cc14c1..f7b3c9ab2cb 100644
--- a/arch/mn10300/include/asm/processor.h
+++ b/arch/mn10300/include/asm/processor.h
@@ -127,7 +127,6 @@ static inline void start_thread(struct pt_regs *regs,
127{ 127{
128 struct thread_info *ti = current_thread_info(); 128 struct thread_info *ti = current_thread_info();
129 struct pt_regs *frame0; 129 struct pt_regs *frame0;
130 set_fs(USER_DS);
131 130
132 frame0 = thread_info_to_uregs(ti); 131 frame0 = thread_info_to_uregs(ti);
133 frame0->epsw = EPSW_nSL | EPSW_IE | EPSW_IM; 132 frame0->epsw = EPSW_nSL | EPSW_IE | EPSW_IM;
diff --git a/arch/mn10300/include/asm/ptrace.h b/arch/mn10300/include/asm/ptrace.h
index b6961811d44..55b79ef1002 100644
--- a/arch/mn10300/include/asm/ptrace.h
+++ b/arch/mn10300/include/asm/ptrace.h
@@ -89,7 +89,6 @@ struct pt_regs {
89#define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) 89#define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL)
90#define instruction_pointer(regs) ((regs)->pc) 90#define instruction_pointer(regs) ((regs)->pc)
91#define user_stack_pointer(regs) ((regs)->sp) 91#define user_stack_pointer(regs) ((regs)->sp)
92extern void show_regs(struct pt_regs *);
93 92
94#define arch_has_single_step() (1) 93#define arch_has_single_step() (1)
95 94
diff --git a/arch/mn10300/include/asm/spinlock.h b/arch/mn10300/include/asm/spinlock.h
index 93429154e89..1ae580f3893 100644
--- a/arch/mn10300/include/asm/spinlock.h
+++ b/arch/mn10300/include/asm/spinlock.h
@@ -11,7 +11,7 @@
11#ifndef _ASM_SPINLOCK_H 11#ifndef _ASM_SPINLOCK_H
12#define _ASM_SPINLOCK_H 12#define _ASM_SPINLOCK_H
13 13
14#include <asm/atomic.h> 14#include <linux/atomic.h>
15#include <asm/rwlock.h> 15#include <asm/rwlock.h>
16#include <asm/page.h> 16#include <asm/page.h>
17 17
diff --git a/arch/mn10300/include/asm/system.h b/arch/mn10300/include/asm/system.h
index 8ff3e5aaca4..94b4c5e1491 100644
--- a/arch/mn10300/include/asm/system.h
+++ b/arch/mn10300/include/asm/system.h
@@ -19,7 +19,7 @@
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/irqflags.h> 21#include <linux/irqflags.h>
22#include <asm/atomic.h> 22#include <linux/atomic.h>
23 23
24#if !defined(CONFIG_LAZY_SAVE_FPU) 24#if !defined(CONFIG_LAZY_SAVE_FPU)
25struct fpu_state_struct; 25struct fpu_state_struct;
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index ae435e1d566..3e3620d9fc4 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -589,7 +589,7 @@ ENTRY(sys_call_table)
589 .long sys_ni_syscall /* vm86 */ 589 .long sys_ni_syscall /* vm86 */
590 .long sys_ni_syscall /* Old sys_query_module */ 590 .long sys_ni_syscall /* Old sys_query_module */
591 .long sys_poll 591 .long sys_poll
592 .long sys_nfsservctl 592 .long sys_ni_syscall /* was nfsservctl */
593 .long sys_setresgid16 /* 170 */ 593 .long sys_setresgid16 /* 170 */
594 .long sys_getresgid16 594 .long sys_getresgid16
595 .long sys_prctl 595 .long sys_prctl
diff --git a/arch/mn10300/kernel/mn10300-watchdog.c b/arch/mn10300/kernel/mn10300-watchdog.c
index c5e12bfd9fc..a45f0c7549a 100644
--- a/arch/mn10300/kernel/mn10300-watchdog.c
+++ b/arch/mn10300/kernel/mn10300-watchdog.c
@@ -19,7 +19,7 @@
19#include <linux/nmi.h> 19#include <linux/nmi.h>
20#include <asm/processor.h> 20#include <asm/processor.h>
21#include <asm/system.h> 21#include <asm/system.h>
22#include <asm/atomic.h> 22#include <linux/atomic.h>
23#include <asm/intctl-regs.h> 23#include <asm/intctl-regs.h>
24#include <asm/rtc-regs.h> 24#include <asm/rtc-regs.h>
25#include <asm/div64.h> 25#include <asm/div64.h>
diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c
index bd3e5e73826..9220a75a7b4 100644
--- a/arch/mn10300/kernel/traps.c
+++ b/arch/mn10300/kernel/traps.c
@@ -30,7 +30,7 @@
30#include <asm/system.h> 30#include <asm/system.h>
31#include <linux/uaccess.h> 31#include <linux/uaccess.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/atomic.h> 33#include <linux/atomic.h>
34#include <asm/smp.h> 34#include <asm/smp.h>
35#include <asm/pgalloc.h> 35#include <asm/pgalloc.h>
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.c
index eef989c1d0c..f9bb8cb1c14 100644
--- a/arch/mn10300/mm/misalignment.c
+++ b/arch/mn10300/mm/misalignment.c
@@ -26,7 +26,7 @@
26#include <asm/system.h> 26#include <asm/system.h>
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30#include <asm/smp.h> 30#include <asm/smp.h>
31#include <asm/pgalloc.h> 31#include <asm/pgalloc.h>
32#include <asm/cpu-regs.h> 32#include <asm/cpu-regs.h>
diff --git a/arch/mn10300/proc-mn2ws0050/proc-init.c b/arch/mn10300/proc-mn2ws0050/proc-init.c
index c58249b9525..fe6e24906ff 100644
--- a/arch/mn10300/proc-mn2ws0050/proc-init.c
+++ b/arch/mn10300/proc-mn2ws0050/proc-init.c
@@ -18,7 +18,7 @@
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/atomic.h> 21#include <linux/atomic.h>
22#include <asm/smp.h> 22#include <asm/smp.h>
23#include <asm/pgalloc.h> 23#include <asm/pgalloc.h>
24#include <asm/busctl-regs.h> 24#include <asm/busctl-regs.h>
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
index 052f877b52a..60b47223390 100644
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ b/arch/openrisc/include/asm/dma-mapping.h
@@ -31,7 +31,6 @@
31 31
32#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 32#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
33 33
34int dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
35 34
36#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 35#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
37#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 36#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
@@ -47,6 +46,12 @@ dma_addr_t or1k_map_page(struct device *dev, struct page *page,
47void or1k_unmap_page(struct device *dev, dma_addr_t dma_handle, 46void or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
48 size_t size, enum dma_data_direction dir, 47 size_t size, enum dma_data_direction dir,
49 struct dma_attrs *attrs); 48 struct dma_attrs *attrs);
49int or1k_map_sg(struct device *dev, struct scatterlist *sg,
50 int nents, enum dma_data_direction dir,
51 struct dma_attrs *attrs);
52void or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
53 int nents, enum dma_data_direction dir,
54 struct dma_attrs *attrs);
50void or1k_sync_single_for_cpu(struct device *dev, 55void or1k_sync_single_for_cpu(struct device *dev,
51 dma_addr_t dma_handle, size_t size, 56 dma_addr_t dma_handle, size_t size,
52 enum dma_data_direction dir); 57 enum dma_data_direction dir);
@@ -98,6 +103,51 @@ static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
98 debug_dma_unmap_page(dev, addr, size, dir, true); 103 debug_dma_unmap_page(dev, addr, size, dir, true);
99} 104}
100 105
106static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
107 int nents, enum dma_data_direction dir)
108{
109 int i, ents;
110 struct scatterlist *s;
111
112 for_each_sg(sg, s, nents, i)
113 kmemcheck_mark_initialized(sg_virt(s), s->length);
114 BUG_ON(!valid_dma_direction(dir));
115 ents = or1k_map_sg(dev, sg, nents, dir, NULL);
116 debug_dma_map_sg(dev, sg, nents, ents, dir);
117
118 return ents;
119}
120
121static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
122 int nents, enum dma_data_direction dir)
123{
124 BUG_ON(!valid_dma_direction(dir));
125 debug_dma_unmap_sg(dev, sg, nents, dir);
126 or1k_unmap_sg(dev, sg, nents, dir, NULL);
127}
128
129static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
130 size_t offset, size_t size,
131 enum dma_data_direction dir)
132{
133 dma_addr_t addr;
134
135 kmemcheck_mark_initialized(page_address(page) + offset, size);
136 BUG_ON(!valid_dma_direction(dir));
137 addr = or1k_map_page(dev, page, offset, size, dir, NULL);
138 debug_dma_map_page(dev, page, offset, size, dir, addr, false);
139
140 return addr;
141}
142
143static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
144 size_t size, enum dma_data_direction dir)
145{
146 BUG_ON(!valid_dma_direction(dir));
147 or1k_unmap_page(dev, addr, size, dir, NULL);
148 debug_dma_unmap_page(dev, addr, size, dir, true);
149}
150
101static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, 151static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
102 size_t size, 152 size_t size,
103 enum dma_data_direction dir) 153 enum dma_data_direction dir)
@@ -119,7 +169,12 @@ static inline void dma_sync_single_for_device(struct device *dev,
119static inline int dma_supported(struct device *dev, u64 dma_mask) 169static inline int dma_supported(struct device *dev, u64 dma_mask)
120{ 170{
121 /* Support 32 bit DMA mask exclusively */ 171 /* Support 32 bit DMA mask exclusively */
122 return dma_mask == 0xffffffffULL; 172 return dma_mask == DMA_BIT_MASK(32);
173}
174
175static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
176{
177 return 0;
123} 178}
124 179
125static inline int dma_set_mask(struct device *dev, u64 dma_mask) 180static inline int dma_set_mask(struct device *dev, u64 dma_mask)
diff --git a/arch/openrisc/include/asm/sigcontext.h b/arch/openrisc/include/asm/sigcontext.h
index 54a5c50132e..b79c2b19afb 100644
--- a/arch/openrisc/include/asm/sigcontext.h
+++ b/arch/openrisc/include/asm/sigcontext.h
@@ -23,16 +23,11 @@
23 23
24/* This struct is saved by setup_frame in signal.c, to keep the current 24/* This struct is saved by setup_frame in signal.c, to keep the current
25 context while a signal handler is executed. It's restored by sys_sigreturn. 25 context while a signal handler is executed. It's restored by sys_sigreturn.
26
27 To keep things simple, we use pt_regs here even though normally you just
28 specify the list of regs to save. Then we can use copy_from_user on the
29 entire regs instead of a bunch of get_user's as well...
30*/ 26*/
31 27
32struct sigcontext { 28struct sigcontext {
33 struct pt_regs regs; /* needs to be first */ 29 struct user_regs_struct regs; /* needs to be first */
34 unsigned long oldmask; 30 unsigned long oldmask;
35 unsigned long usp; /* usp before stacking this gunk on it */
36}; 31};
37 32
38#endif /* __ASM_OPENRISC_SIGCONTEXT_H */ 33#endif /* __ASM_OPENRISC_SIGCONTEXT_H */
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index 968d3ee477e..f1c8ee2895d 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -154,6 +154,33 @@ void or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
154 /* Nothing special to do here... */ 154 /* Nothing special to do here... */
155} 155}
156 156
157int or1k_map_sg(struct device *dev, struct scatterlist *sg,
158 int nents, enum dma_data_direction dir,
159 struct dma_attrs *attrs)
160{
161 struct scatterlist *s;
162 int i;
163
164 for_each_sg(sg, s, nents, i) {
165 s->dma_address = or1k_map_page(dev, sg_page(s), s->offset,
166 s->length, dir, NULL);
167 }
168
169 return nents;
170}
171
172void or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
173 int nents, enum dma_data_direction dir,
174 struct dma_attrs *attrs)
175{
176 struct scatterlist *s;
177 int i;
178
179 for_each_sg(sg, s, nents, i) {
180 or1k_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, NULL);
181 }
182}
183
157void or1k_sync_single_for_cpu(struct device *dev, 184void or1k_sync_single_for_cpu(struct device *dev,
158 dma_addr_t dma_handle, size_t size, 185 dma_addr_t dma_handle, size_t size,
159 enum dma_data_direction dir) 186 enum dma_data_direction dir)
@@ -187,5 +214,4 @@ static int __init dma_init(void)
187 214
188 return 0; 215 return 0;
189} 216}
190
191fs_initcall(dma_init); 217fs_initcall(dma_init);
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index 5f759c76834..95207ab0c99 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -52,31 +52,25 @@ struct rt_sigframe {
52static int restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc) 52static int restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
53{ 53{
54 unsigned int err = 0; 54 unsigned int err = 0;
55 unsigned long old_usp;
56 55
57 /* Alwys make any pending restarted system call return -EINTR */ 56 /* Alwys make any pending restarted system call return -EINTR */
58 current_thread_info()->restart_block.fn = do_no_restart_syscall; 57 current_thread_info()->restart_block.fn = do_no_restart_syscall;
59 58
60 /* restore the regs from &sc->regs (same as sc, since regs is first) 59 /*
60 * Restore the regs from &sc->regs.
61 * (sc is already checked for VERIFY_READ since the sigframe was 61 * (sc is already checked for VERIFY_READ since the sigframe was
62 * checked in sys_sigreturn previously) 62 * checked in sys_sigreturn previously)
63 */ 63 */
64 64 if (__copy_from_user(regs, sc->regs.gpr, 32 * sizeof(unsigned long)))
65 if (__copy_from_user(regs, sc, sizeof(struct pt_regs))) 65 goto badframe;
66 if (__copy_from_user(&regs->pc, &sc->regs.pc, sizeof(unsigned long)))
67 goto badframe;
68 if (__copy_from_user(&regs->sr, &sc->regs.sr, sizeof(unsigned long)))
66 goto badframe; 69 goto badframe;
67 70
68 /* make sure the SM-bit is cleared so user-mode cannot fool us */ 71 /* make sure the SM-bit is cleared so user-mode cannot fool us */
69 regs->sr &= ~SPR_SR_SM; 72 regs->sr &= ~SPR_SR_SM;
70 73
71 /* restore the old USP as it was before we stacked the sc etc.
72 * (we cannot just pop the sigcontext since we aligned the sp and
73 * stuff after pushing it)
74 */
75
76 err |= __get_user(old_usp, &sc->usp);
77
78 regs->sp = old_usp;
79
80 /* TODO: the other ports use regs->orig_XX to disable syscall checks 74 /* TODO: the other ports use regs->orig_XX to disable syscall checks
81 * after this completes, but we don't use that mechanism. maybe we can 75 * after this completes, but we don't use that mechanism. maybe we can
82 * use it now ? 76 * use it now ?
@@ -137,18 +131,17 @@ static int setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
137 unsigned long mask) 131 unsigned long mask)
138{ 132{
139 int err = 0; 133 int err = 0;
140 unsigned long usp = regs->sp;
141 134
142 /* copy the regs. they are first in sc so we can use sc directly */ 135 /* copy the regs */
143 136
144 err |= __copy_to_user(sc, regs, sizeof(struct pt_regs)); 137 err |= __copy_to_user(sc->regs.gpr, regs, 32 * sizeof(unsigned long));
138 err |= __copy_to_user(&sc->regs.pc, &regs->pc, sizeof(unsigned long));
139 err |= __copy_to_user(&sc->regs.sr, &regs->sr, sizeof(unsigned long));
145 140
146 /* then some other stuff */ 141 /* then some other stuff */
147 142
148 err |= __put_user(mask, &sc->oldmask); 143 err |= __put_user(mask, &sc->oldmask);
149 144
150 err |= __put_user(usp, &sc->usp);
151
152 return err; 145 return err;
153} 146}
154 147
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 65adc86a230..e077b0bf56c 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -15,6 +15,7 @@ config PARISC
15 select HAVE_GENERIC_HARDIRQS 15 select HAVE_GENERIC_HARDIRQS
16 select GENERIC_IRQ_PROBE 16 select GENERIC_IRQ_PROBE
17 select IRQ_PER_CPU 17 select IRQ_PER_CPU
18 select ARCH_HAVE_NMI_SAFE_CMPXCHG
18 19
19 help 20 help
20 The PA-RISC microprocessor is designed by Hewlett-Packard and used 21 The PA-RISC microprocessor is designed by Hewlett-Packard and used
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h
index f81955934ae..4054b31e0fa 100644
--- a/arch/parisc/include/asm/atomic.h
+++ b/arch/parisc/include/asm/atomic.h
@@ -197,15 +197,15 @@ static __inline__ int atomic_read(const atomic_t *v)
197#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 197#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
198 198
199/** 199/**
200 * atomic_add_unless - add unless the number is a given value 200 * __atomic_add_unless - add unless the number is a given value
201 * @v: pointer of type atomic_t 201 * @v: pointer of type atomic_t
202 * @a: the amount to add to v... 202 * @a: the amount to add to v...
203 * @u: ...unless v is equal to u. 203 * @u: ...unless v is equal to u.
204 * 204 *
205 * Atomically adds @a to @v, so long as it was not @u. 205 * Atomically adds @a to @v, so long as it was not @u.
206 * Returns non-zero if @v was not @u, and zero otherwise. 206 * Returns the old value of @v.
207 */ 207 */
208static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 208static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
209{ 209{
210 int c, old; 210 int c, old;
211 c = atomic_read(v); 211 c = atomic_read(v);
@@ -217,10 +217,9 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
217 break; 217 break;
218 c = old; 218 c = old;
219 } 219 }
220 return c != (u); 220 return c;
221} 221}
222 222
223#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
224 223
225#define atomic_add(i,v) ((void)(__atomic_add_return( (i),(v)))) 224#define atomic_add(i,v) ((void)(__atomic_add_return( (i),(v))))
226#define atomic_sub(i,v) ((void)(__atomic_add_return(-(i),(v)))) 225#define atomic_sub(i,v) ((void)(__atomic_add_return(-(i),(v))))
@@ -259,10 +258,10 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
259 258
260#define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) 259#define ATOMIC64_INIT(i) ((atomic64_t) { (i) })
261 260
262static __inline__ int 261static __inline__ s64
263__atomic64_add_return(s64 i, atomic64_t *v) 262__atomic64_add_return(s64 i, atomic64_t *v)
264{ 263{
265 int ret; 264 s64 ret;
266 unsigned long flags; 265 unsigned long flags;
267 _atomic_spin_lock_irqsave(v, flags); 266 _atomic_spin_lock_irqsave(v, flags);
268 267
@@ -317,7 +316,7 @@ atomic64_read(const atomic64_t *v)
317 * @u: ...unless v is equal to u. 316 * @u: ...unless v is equal to u.
318 * 317 *
319 * Atomically adds @a to @v, so long as it was not @u. 318 * Atomically adds @a to @v, so long as it was not @u.
320 * Returns non-zero if @v was not @u, and zero otherwise. 319 * Returns the old value of @v.
321 */ 320 */
322static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) 321static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
323{ 322{
@@ -336,12 +335,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
336 335
337#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 336#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
338 337
339#else /* CONFIG_64BIT */
340
341#include <asm-generic/atomic64.h>
342
343#endif /* !CONFIG_64BIT */ 338#endif /* !CONFIG_64BIT */
344 339
345#include <asm-generic/atomic-long.h>
346 340
347#endif /* _ASM_PARISC_ATOMIC_H_ */ 341#endif /* _ASM_PARISC_ATOMIC_H_ */
diff --git a/arch/parisc/include/asm/bitops.h b/arch/parisc/include/asm/bitops.h
index 43c516fa17f..8c9b631d2a7 100644
--- a/arch/parisc/include/asm/bitops.h
+++ b/arch/parisc/include/asm/bitops.h
@@ -8,7 +8,7 @@
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <asm/types.h> /* for BITS_PER_LONG/SHIFT_PER_LONG */ 9#include <asm/types.h> /* for BITS_PER_LONG/SHIFT_PER_LONG */
10#include <asm/byteorder.h> 10#include <asm/byteorder.h>
11#include <asm/atomic.h> 11#include <linux/atomic.h>
12 12
13/* 13/*
14 * HP-PARISC specific bit operations 14 * HP-PARISC specific bit operations
@@ -223,14 +223,7 @@ static __inline__ int fls(int x)
223#ifdef __KERNEL__ 223#ifdef __KERNEL__
224 224
225#include <asm-generic/bitops/le.h> 225#include <asm-generic/bitops/le.h>
226 226#include <asm-generic/bitops/ext2-atomic-setbit.h>
227/* '3' is bits per byte */
228#define LE_BYTE_ADDR ((sizeof(unsigned long) - 1) << 3)
229
230#define ext2_set_bit_atomic(l,nr,addr) \
231 test_and_set_bit((nr) ^ LE_BYTE_ADDR, (unsigned long *)addr)
232#define ext2_clear_bit_atomic(l,nr,addr) \
233 test_and_clear_bit( (nr) ^ LE_BYTE_ADDR, (unsigned long *)addr)
234 227
235#endif /* __KERNEL__ */ 228#endif /* __KERNEL__ */
236 229
diff --git a/arch/parisc/include/asm/futex.h b/arch/parisc/include/asm/futex.h
index 67a33cc27ef..2388bdb3283 100644
--- a/arch/parisc/include/asm/futex.h
+++ b/arch/parisc/include/asm/futex.h
@@ -5,11 +5,14 @@
5 5
6#include <linux/futex.h> 6#include <linux/futex.h>
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8#include <asm/atomic.h>
8#include <asm/errno.h> 9#include <asm/errno.h>
9 10
10static inline int 11static inline int
11futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) 12futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
12{ 13{
14 unsigned long int flags;
15 u32 val;
13 int op = (encoded_op >> 28) & 7; 16 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15; 17 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20; 18 int oparg = (encoded_op << 8) >> 20;
@@ -18,21 +21,58 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 21 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg; 22 oparg = 1 << oparg;
20 23
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32))) 24 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(*uaddr)))
22 return -EFAULT; 25 return -EFAULT;
23 26
24 pagefault_disable(); 27 pagefault_disable();
25 28
29 _atomic_spin_lock_irqsave(uaddr, flags);
30
26 switch (op) { 31 switch (op) {
27 case FUTEX_OP_SET: 32 case FUTEX_OP_SET:
33 /* *(int *)UADDR2 = OPARG; */
34 ret = get_user(oldval, uaddr);
35 if (!ret)
36 ret = put_user(oparg, uaddr);
37 break;
28 case FUTEX_OP_ADD: 38 case FUTEX_OP_ADD:
39 /* *(int *)UADDR2 += OPARG; */
40 ret = get_user(oldval, uaddr);
41 if (!ret) {
42 val = oldval + oparg;
43 ret = put_user(val, uaddr);
44 }
45 break;
29 case FUTEX_OP_OR: 46 case FUTEX_OP_OR:
47 /* *(int *)UADDR2 |= OPARG; */
48 ret = get_user(oldval, uaddr);
49 if (!ret) {
50 val = oldval | oparg;
51 ret = put_user(val, uaddr);
52 }
53 break;
30 case FUTEX_OP_ANDN: 54 case FUTEX_OP_ANDN:
55 /* *(int *)UADDR2 &= ~OPARG; */
56 ret = get_user(oldval, uaddr);
57 if (!ret) {
58 val = oldval & ~oparg;
59 ret = put_user(val, uaddr);
60 }
61 break;
31 case FUTEX_OP_XOR: 62 case FUTEX_OP_XOR:
63 /* *(int *)UADDR2 ^= OPARG; */
64 ret = get_user(oldval, uaddr);
65 if (!ret) {
66 val = oldval ^ oparg;
67 ret = put_user(val, uaddr);
68 }
69 break;
32 default: 70 default:
33 ret = -ENOSYS; 71 ret = -ENOSYS;
34 } 72 }
35 73
74 _atomic_spin_unlock_irqrestore(uaddr, flags);
75
36 pagefault_enable(); 76 pagefault_enable();
37 77
38 if (!ret) { 78 if (!ret) {
@@ -54,7 +94,9 @@ static inline int
54futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, 94futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
55 u32 oldval, u32 newval) 95 u32 oldval, u32 newval)
56{ 96{
97 int ret;
57 u32 val; 98 u32 val;
99 unsigned long flags;
58 100
59 /* futex.c wants to do a cmpxchg_inatomic on kernel NULL, which is 101 /* futex.c wants to do a cmpxchg_inatomic on kernel NULL, which is
60 * our gateway page, and causes no end of trouble... 102 * our gateway page, and causes no end of trouble...
@@ -65,12 +107,24 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
65 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) 107 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
66 return -EFAULT; 108 return -EFAULT;
67 109
68 if (get_user(val, uaddr)) 110 /* HPPA has no cmpxchg in hardware and therefore the
69 return -EFAULT; 111 * best we can do here is use an array of locks. The
70 if (val == oldval && put_user(newval, uaddr)) 112 * lock selected is based on a hash of the userspace
71 return -EFAULT; 113 * address. This should scale to a couple of CPUs.
114 */
115
116 _atomic_spin_lock_irqsave(uaddr, flags);
117
118 ret = get_user(val, uaddr);
119
120 if (!ret && val == oldval)
121 ret = put_user(newval, uaddr);
122
72 *uval = val; 123 *uval = val;
73 return 0; 124
125 _atomic_spin_unlock_irqrestore(uaddr, flags);
126
127 return ret;
74} 128}
75 129
76#endif /*__KERNEL__*/ 130#endif /*__KERNEL__*/
diff --git a/arch/parisc/include/asm/mmu_context.h b/arch/parisc/include/asm/mmu_context.h
index 354b2aca990..59be2576443 100644
--- a/arch/parisc/include/asm/mmu_context.h
+++ b/arch/parisc/include/asm/mmu_context.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <asm/atomic.h> 6#include <linux/atomic.h>
7#include <asm/pgalloc.h> 7#include <asm/pgalloc.h>
8#include <asm/pgtable.h> 8#include <asm/pgtable.h>
9#include <asm-generic/mm_hooks.h> 9#include <asm-generic/mm_hooks.h>
diff --git a/arch/parisc/include/asm/ptrace.h b/arch/parisc/include/asm/ptrace.h
index 7f09533da77..250ae35aa06 100644
--- a/arch/parisc/include/asm/ptrace.h
+++ b/arch/parisc/include/asm/ptrace.h
@@ -56,7 +56,6 @@ struct pt_regs {
56#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3) 56#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3)
57#define user_stack_pointer(regs) ((regs)->gr[30]) 57#define user_stack_pointer(regs) ((regs)->gr[30])
58unsigned long profile_pc(struct pt_regs *); 58unsigned long profile_pc(struct pt_regs *);
59extern void show_regs(struct pt_regs *);
60 59
61 60
62#endif /* __KERNEL__ */ 61#endif /* __KERNEL__ */
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index 3392de3e7be..d61de64f990 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -821,8 +821,9 @@
821#define __NR_open_by_handle_at (__NR_Linux + 326) 821#define __NR_open_by_handle_at (__NR_Linux + 326)
822#define __NR_syncfs (__NR_Linux + 327) 822#define __NR_syncfs (__NR_Linux + 327)
823#define __NR_setns (__NR_Linux + 328) 823#define __NR_setns (__NR_Linux + 328)
824#define __NR_sendmmsg (__NR_Linux + 329)
824 825
825#define __NR_Linux_syscalls (__NR_setns + 1) 826#define __NR_Linux_syscalls (__NR_sendmmsg + 1)
826 827
827 828
828#define __IGNORE_select /* newselect */ 829#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
index df653663d3d..a7bb757a549 100644
--- a/arch/parisc/kernel/parisc_ksyms.c
+++ b/arch/parisc/kernel/parisc_ksyms.c
@@ -31,7 +31,7 @@
31#include <linux/string.h> 31#include <linux/string.h>
32EXPORT_SYMBOL(memset); 32EXPORT_SYMBOL(memset);
33 33
34#include <asm/atomic.h> 34#include <linux/atomic.h>
35EXPORT_SYMBOL(__xchg8); 35EXPORT_SYMBOL(__xchg8);
36EXPORT_SYMBOL(__xchg32); 36EXPORT_SYMBOL(__xchg32);
37EXPORT_SYMBOL(__cmpxchg_u32); 37EXPORT_SYMBOL(__cmpxchg_u32);
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 828305f19cf..32d588488f0 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -33,7 +33,7 @@
33#include <linux/ftrace.h> 33#include <linux/ftrace.h>
34 34
35#include <asm/system.h> 35#include <asm/system.h>
36#include <asm/atomic.h> 36#include <linux/atomic.h>
37#include <asm/current.h> 37#include <asm/current.h>
38#include <asm/delay.h> 38#include <asm/delay.h>
39#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 34a4f5a2fff..3735abd7f8f 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -259,7 +259,7 @@
259 ENTRY_SAME(ni_syscall) /* query_module */ 259 ENTRY_SAME(ni_syscall) /* query_module */
260 ENTRY_SAME(poll) 260 ENTRY_SAME(poll)
261 /* structs contain pointers and an in_addr... */ 261 /* structs contain pointers and an in_addr... */
262 ENTRY_COMP(nfsservctl) 262 ENTRY_SAME(ni_syscall) /* was nfsservctl */
263 ENTRY_SAME(setresgid) /* 170 */ 263 ENTRY_SAME(setresgid) /* 170 */
264 ENTRY_SAME(getresgid) 264 ENTRY_SAME(getresgid)
265 ENTRY_SAME(prctl) 265 ENTRY_SAME(prctl)
@@ -427,6 +427,7 @@
427 ENTRY_COMP(open_by_handle_at) 427 ENTRY_COMP(open_by_handle_at)
428 ENTRY_SAME(syncfs) 428 ENTRY_SAME(syncfs)
429 ENTRY_SAME(setns) 429 ENTRY_SAME(setns)
430 ENTRY_COMP(sendmmsg)
430 431
431 /* Nothing yet */ 432 /* Nothing yet */
432 433
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 8b58bf0b7d5..f19e6604026 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -33,7 +33,7 @@
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/traps.h> 34#include <asm/traps.h>
35#include <asm/unaligned.h> 35#include <asm/unaligned.h>
36#include <asm/atomic.h> 36#include <linux/atomic.h>
37#include <asm/smp.h> 37#include <asm/smp.h>
38#include <asm/pdc.h> 38#include <asm/pdc.h>
39#include <asm/pdc_chassis.h> 39#include <asm/pdc_chassis.h>
diff --git a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c
index 353963d4205..a8bffd8af77 100644
--- a/arch/parisc/lib/bitops.c
+++ b/arch/parisc/lib/bitops.c
@@ -9,7 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <asm/system.h> 11#include <asm/system.h>
12#include <asm/atomic.h> 12#include <linux/atomic.h>
13 13
14#ifdef CONFIG_SMP 14#ifdef CONFIG_SMP
15arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = { 15arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = {
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 374c475e56a..6926b61acfe 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -136,6 +136,7 @@ config PPC
136 select HAVE_SYSCALL_TRACEPOINTS 136 select HAVE_SYSCALL_TRACEPOINTS
137 select HAVE_BPF_JIT if (PPC64 && NET) 137 select HAVE_BPF_JIT if (PPC64 && NET)
138 select HAVE_ARCH_JUMP_LABEL 138 select HAVE_ARCH_JUMP_LABEL
139 select ARCH_HAVE_NMI_SAFE_CMPXCHG
139 140
140config EARLY_PRINTK 141config EARLY_PRINTK
141 bool 142 bool
diff --git a/arch/powerpc/boot/dts/p1023rds.dts b/arch/powerpc/boot/dts/p1023rds.dts
index bfa96aa8f2c..d9b776740a6 100644
--- a/arch/powerpc/boot/dts/p1023rds.dts
+++ b/arch/powerpc/boot/dts/p1023rds.dts
@@ -387,7 +387,7 @@
387 #size-cells = <1>; 387 #size-cells = <1>;
388 compatible = "cfi-flash"; 388 compatible = "cfi-flash";
389 reg = <0x0 0x0 0x02000000>; 389 reg = <0x0 0x0 0x02000000>;
390 bank-width = <1>; 390 bank-width = <2>;
391 device-width = <1>; 391 device-width = <1>;
392 partition@0 { 392 partition@0 {
393 label = "ramdisk"; 393 label = "ramdisk";
diff --git a/arch/powerpc/configs/85xx/p1023rds_defconfig b/arch/powerpc/configs/85xx/p1023rds_defconfig
index 980ff8f61fd..3ff5a81c709 100644
--- a/arch/powerpc/configs/85xx/p1023rds_defconfig
+++ b/arch/powerpc/configs/85xx/p1023rds_defconfig
@@ -171,3 +171,4 @@ CONFIG_CRYPTO_SHA256=y
171CONFIG_CRYPTO_SHA512=y 171CONFIG_CRYPTO_SHA512=y
172CONFIG_CRYPTO_AES=y 172CONFIG_CRYPTO_AES=y
173# CONFIG_CRYPTO_ANSI_CPRNG is not set 173# CONFIG_CRYPTO_ANSI_CPRNG is not set
174CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig
index 10562a5c65b..4311d02a3bf 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -185,3 +185,4 @@ CONFIG_CRYPTO_SHA256=y
185CONFIG_CRYPTO_SHA512=y 185CONFIG_CRYPTO_SHA512=y
186CONFIG_CRYPTO_AES=y 186CONFIG_CRYPTO_AES=y
187# CONFIG_CRYPTO_ANSI_CPRNG is not set 187# CONFIG_CRYPTO_ANSI_CPRNG is not set
188CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index d32283555b5..c92c204a204 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -100,5 +100,8 @@ CONFIG_DEBUG_INFO=y
100CONFIG_SYSCTL_SYSCALL_CHECK=y 100CONFIG_SYSCTL_SYSCALL_CHECK=y
101CONFIG_VIRQ_DEBUG=y 101CONFIG_VIRQ_DEBUG=y
102CONFIG_CRYPTO_PCBC=m 102CONFIG_CRYPTO_PCBC=m
103CONFIG_CRYPTO_SHA256=y
104CONFIG_CRYPTO_SHA512=y
105CONFIG_CRYPTO_AES=y
103# CONFIG_CRYPTO_ANSI_CPRNG is not set 106# CONFIG_CRYPTO_ANSI_CPRNG is not set
104CONFIG_CRYPTO_DEV_TALITOS=y 107CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index fcd85d2c72d..a3467bfb767 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -139,6 +139,7 @@ CONFIG_SND=y
139CONFIG_SND_INTEL8X0=y 139CONFIG_SND_INTEL8X0=y
140# CONFIG_SND_PPC is not set 140# CONFIG_SND_PPC is not set
141# CONFIG_SND_USB is not set 141# CONFIG_SND_USB is not set
142CONFIG_SND_SOC=y
142CONFIG_HID_A4TECH=y 143CONFIG_HID_A4TECH=y
143CONFIG_HID_APPLE=y 144CONFIG_HID_APPLE=y
144CONFIG_HID_BELKIN=y 145CONFIG_HID_BELKIN=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 908c941fc24..9693f6ed3da 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -140,6 +140,7 @@ CONFIG_SND=y
140CONFIG_SND_INTEL8X0=y 140CONFIG_SND_INTEL8X0=y
141# CONFIG_SND_PPC is not set 141# CONFIG_SND_PPC is not set
142# CONFIG_SND_USB is not set 142# CONFIG_SND_USB is not set
143CONFIG_SND_SOC=y
143CONFIG_HID_A4TECH=y 144CONFIG_HID_A4TECH=y
144CONFIG_HID_APPLE=y 145CONFIG_HID_APPLE=y
145CONFIG_HID_BELKIN=y 146CONFIG_HID_BELKIN=y
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
index b8f152ece02..e2a4c26ad37 100644
--- a/arch/powerpc/include/asm/atomic.h
+++ b/arch/powerpc/include/asm/atomic.h
@@ -181,21 +181,21 @@ static __inline__ int atomic_dec_return(atomic_t *v)
181#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 181#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
182 182
183/** 183/**
184 * atomic_add_unless - add unless the number is a given value 184 * __atomic_add_unless - add unless the number is a given value
185 * @v: pointer of type atomic_t 185 * @v: pointer of type atomic_t
186 * @a: the amount to add to v... 186 * @a: the amount to add to v...
187 * @u: ...unless v is equal to u. 187 * @u: ...unless v is equal to u.
188 * 188 *
189 * Atomically adds @a to @v, so long as it was not @u. 189 * Atomically adds @a to @v, so long as it was not @u.
190 * Returns non-zero if @v was not @u, and zero otherwise. 190 * Returns the old value of @v.
191 */ 191 */
192static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 192static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
193{ 193{
194 int t; 194 int t;
195 195
196 __asm__ __volatile__ ( 196 __asm__ __volatile__ (
197 PPC_RELEASE_BARRIER 197 PPC_RELEASE_BARRIER
198"1: lwarx %0,0,%1 # atomic_add_unless\n\ 198"1: lwarx %0,0,%1 # __atomic_add_unless\n\
199 cmpw 0,%0,%3 \n\ 199 cmpw 0,%0,%3 \n\
200 beq- 2f \n\ 200 beq- 2f \n\
201 add %0,%2,%0 \n" 201 add %0,%2,%0 \n"
@@ -209,10 +209,9 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
209 : "r" (&v->counter), "r" (a), "r" (u) 209 : "r" (&v->counter), "r" (a), "r" (u)
210 : "cc", "memory"); 210 : "cc", "memory");
211 211
212 return t != u; 212 return t;
213} 213}
214 214
215#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
216 215
217#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0) 216#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0)
218#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0) 217#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0)
@@ -444,7 +443,7 @@ static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
444 * @u: ...unless v is equal to u. 443 * @u: ...unless v is equal to u.
445 * 444 *
446 * Atomically adds @a to @v, so long as it was not @u. 445 * Atomically adds @a to @v, so long as it was not @u.
447 * Returns non-zero if @v was not @u, and zero otherwise. 446 * Returns the old value of @v.
448 */ 447 */
449static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) 448static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
450{ 449{
@@ -452,7 +451,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
452 451
453 __asm__ __volatile__ ( 452 __asm__ __volatile__ (
454 PPC_RELEASE_BARRIER 453 PPC_RELEASE_BARRIER
455"1: ldarx %0,0,%1 # atomic_add_unless\n\ 454"1: ldarx %0,0,%1 # __atomic_add_unless\n\
456 cmpd 0,%0,%3 \n\ 455 cmpd 0,%0,%3 \n\
457 beq- 2f \n\ 456 beq- 2f \n\
458 add %0,%2,%0 \n" 457 add %0,%2,%0 \n"
@@ -470,11 +469,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
470 469
471#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 470#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
472 471
473#else /* __powerpc64__ */
474#include <asm-generic/atomic64.h>
475
476#endif /* __powerpc64__ */ 472#endif /* __powerpc64__ */
477 473
478#include <asm-generic/atomic-long.h>
479#endif /* __KERNEL__ */ 474#endif /* __KERNEL__ */
480#endif /* _ASM_POWERPC_ATOMIC_H_ */ 475#endif /* _ASM_POWERPC_ATOMIC_H_ */
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
index f18c6d9b951..e137afcc10f 100644
--- a/arch/powerpc/include/asm/bitops.h
+++ b/arch/powerpc/include/asm/bitops.h
@@ -327,10 +327,7 @@ unsigned long find_next_bit_le(const void *addr,
327 unsigned long size, unsigned long offset); 327 unsigned long size, unsigned long offset);
328/* Bitmap functions for the ext2 filesystem */ 328/* Bitmap functions for the ext2 filesystem */
329 329
330#define ext2_set_bit_atomic(lock, nr, addr) \ 330#include <asm-generic/bitops/ext2-atomic-setbit.h>
331 test_and_set_bit_le((nr), (unsigned long*)addr)
332#define ext2_clear_bit_atomic(lock, nr, addr) \
333 test_and_clear_bit_le((nr), (unsigned long*)addr)
334 331
335#include <asm-generic/bitops/sched.h> 332#include <asm-generic/bitops/sched.h>
336 333
diff --git a/arch/powerpc/include/asm/emulated_ops.h b/arch/powerpc/include/asm/emulated_ops.h
index 2cc41c715d2..63f2a22e995 100644
--- a/arch/powerpc/include/asm/emulated_ops.h
+++ b/arch/powerpc/include/asm/emulated_ops.h
@@ -18,7 +18,7 @@
18#ifndef _ASM_POWERPC_EMULATED_OPS_H 18#ifndef _ASM_POWERPC_EMULATED_OPS_H
19#define _ASM_POWERPC_EMULATED_OPS_H 19#define _ASM_POWERPC_EMULATED_OPS_H
20 20
21#include <asm/atomic.h> 21#include <linux/atomic.h>
22#include <linux/perf_event.h> 22#include <linux/perf_event.h>
23 23
24 24
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index c57a28e52b6..c0e1bc319e3 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -14,7 +14,7 @@
14#include <linux/radix-tree.h> 14#include <linux/radix-tree.h>
15 15
16#include <asm/types.h> 16#include <asm/types.h>
17#include <asm/atomic.h> 17#include <linux/atomic.h>
18 18
19 19
20/* Define a way to iterate across irqs. */ 20/* Define a way to iterate across irqs. */
diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
index 1f780b95c0f..938986e412f 100644
--- a/arch/powerpc/include/asm/jump_label.h
+++ b/arch/powerpc/include/asm/jump_label.h
@@ -22,7 +22,6 @@ static __always_inline bool arch_static_branch(struct jump_label_key *key)
22 asm goto("1:\n\t" 22 asm goto("1:\n\t"
23 "nop\n\t" 23 "nop\n\t"
24 ".pushsection __jump_table, \"aw\"\n\t" 24 ".pushsection __jump_table, \"aw\"\n\t"
25 ".align 4\n\t"
26 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t" 25 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t"
27 ".popsection \n\t" 26 ".popsection \n\t"
28 : : "i" (key) : : l_yes); 27 : : "i" (key) : : l_yes);
@@ -41,7 +40,6 @@ struct jump_entry {
41 jump_label_t code; 40 jump_label_t code;
42 jump_label_t target; 41 jump_label_t target;
43 jump_label_t key; 42 jump_label_t key;
44 jump_label_t pad;
45}; 43};
46 44
47#endif /* _ASM_POWERPC_JUMP_LABEL_H */ 45#endif /* _ASM_POWERPC_JUMP_LABEL_H */
diff --git a/arch/powerpc/include/asm/kdump.h b/arch/powerpc/include/asm/kdump.h
index 6857af58b02..bffd062adf7 100644
--- a/arch/powerpc/include/asm/kdump.h
+++ b/arch/powerpc/include/asm/kdump.h
@@ -3,17 +3,7 @@
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5 5
6/*
7 * If CONFIG_RELOCATABLE is enabled we can place the kdump kernel anywhere.
8 * To keep enough space in the RMO for the first stage kernel on 64bit, we
9 * place it at 64MB. If CONFIG_RELOCATABLE is not enabled we must place
10 * the second stage at 32MB.
11 */
12#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_PPC64)
13#define KDUMP_KERNELBASE 0x4000000
14#else
15#define KDUMP_KERNELBASE 0x2000000 6#define KDUMP_KERNELBASE 0x2000000
16#endif
17 7
18/* How many bytes to reserve at zero for kdump. The reserve limit should 8/* How many bytes to reserve at zero for kdump. The reserve limit should
19 * be greater or equal to the trampoline's end address. 9 * be greater or equal to the trampoline's end address.
diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
index c2410af6bfd..b8da9136386 100644
--- a/arch/powerpc/include/asm/local.h
+++ b/arch/powerpc/include/asm/local.h
@@ -2,7 +2,7 @@
2#define _ARCH_POWERPC_LOCAL_H 2#define _ARCH_POWERPC_LOCAL_H
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <asm/atomic.h> 5#include <linux/atomic.h>
6 6
7typedef struct 7typedef struct
8{ 8{
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 90bd3ed4816..56b879ab3a4 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -10,58 +10,10 @@
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/ioport.h> 12#include <linux/ioport.h>
13#include <asm-generic/pci-bridge.h>
13 14
14struct device_node; 15struct device_node;
15 16
16enum {
17 /* Force re-assigning all resources (ignore firmware
18 * setup completely)
19 */
20 PPC_PCI_REASSIGN_ALL_RSRC = 0x00000001,
21
22 /* Re-assign all bus numbers */
23 PPC_PCI_REASSIGN_ALL_BUS = 0x00000002,
24
25 /* Do not try to assign, just use existing setup */
26 PPC_PCI_PROBE_ONLY = 0x00000004,
27
28 /* Don't bother with ISA alignment unless the bridge has
29 * ISA forwarding enabled
30 */
31 PPC_PCI_CAN_SKIP_ISA_ALIGN = 0x00000008,
32
33 /* Enable domain numbers in /proc */
34 PPC_PCI_ENABLE_PROC_DOMAINS = 0x00000010,
35 /* ... except for domain 0 */
36 PPC_PCI_COMPAT_DOMAIN_0 = 0x00000020,
37};
38#ifdef CONFIG_PCI
39extern unsigned int ppc_pci_flags;
40
41static inline void ppc_pci_set_flags(int flags)
42{
43 ppc_pci_flags = flags;
44}
45
46static inline void ppc_pci_add_flags(int flags)
47{
48 ppc_pci_flags |= flags;
49}
50
51static inline int ppc_pci_has_flag(int flag)
52{
53 return (ppc_pci_flags & flag);
54}
55#else
56static inline void ppc_pci_set_flags(int flags) { }
57static inline void ppc_pci_add_flags(int flags) { }
58static inline int ppc_pci_has_flag(int flag)
59{
60 return 0;
61}
62#endif
63
64
65/* 17/*
66 * Structure of a PCI controller (host bridge) 18 * Structure of a PCI controller (host bridge)
67 */ 19 */
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 1f522680ea1..49c3de582be 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -44,7 +44,7 @@ struct pci_dev;
44 * bus numbers (don't do that on ppc64 yet !) 44 * bus numbers (don't do that on ppc64 yet !)
45 */ 45 */
46#define pcibios_assign_all_busses() \ 46#define pcibios_assign_all_busses() \
47 (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS)) 47 (pci_has_flag(PCI_REASSIGN_ALL_BUS))
48 48
49static inline void pcibios_set_master(struct pci_dev *dev) 49static inline void pcibios_set_master(struct pci_dev *dev)
50{ 50{
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index b823536375d..b5c91901e38 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -18,7 +18,7 @@
18 */ 18 */
19#include <linux/types.h> 19#include <linux/types.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/atomic.h> 21#include <linux/atomic.h>
22 22
23#define HAVE_ARCH_DEVTREE_FIXUPS 23#define HAVE_ARCH_DEVTREE_FIXUPS
24 24
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index e8aaf6fce38..559da199edb 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1003,7 +1003,6 @@
1003#define PV_970 0x0039 1003#define PV_970 0x0039
1004#define PV_POWER5 0x003A 1004#define PV_POWER5 0x003A
1005#define PV_POWER5p 0x003B 1005#define PV_POWER5p 0x003B
1006#define PV_POWER7 0x003F
1007#define PV_970FX 0x003C 1006#define PV_970FX 0x003C
1008#define PV_POWER6 0x003E 1007#define PV_POWER6 0x003E
1009#define PV_POWER7 0x003F 1008#define PV_POWER7 0x003F
@@ -1024,13 +1023,16 @@
1024#define mtmsrd(v) __mtmsrd((v), 0) 1023#define mtmsrd(v) __mtmsrd((v), 0)
1025#define mtmsr(v) mtmsrd(v) 1024#define mtmsr(v) mtmsrd(v)
1026#else 1025#else
1027#define mtmsr(v) asm volatile("mtmsr %0" : : "r" (v) : "memory") 1026#define mtmsr(v) asm volatile("mtmsr %0" : \
1027 : "r" ((unsigned long)(v)) \
1028 : "memory")
1028#endif 1029#endif
1029 1030
1030#define mfspr(rn) ({unsigned long rval; \ 1031#define mfspr(rn) ({unsigned long rval; \
1031 asm volatile("mfspr %0," __stringify(rn) \ 1032 asm volatile("mfspr %0," __stringify(rn) \
1032 : "=r" (rval)); rval;}) 1033 : "=r" (rval)); rval;})
1033#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)\ 1034#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : \
1035 : "r" ((unsigned long)(v)) \
1034 : "memory") 1036 : "memory")
1035 1037
1036#ifdef __powerpc64__ 1038#ifdef __powerpc64__
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index f6736b7da46..fa0d27a400d 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -171,7 +171,7 @@ SYSCALL_SPU(setresuid)
171SYSCALL_SPU(getresuid) 171SYSCALL_SPU(getresuid)
172SYSCALL(ni_syscall) 172SYSCALL(ni_syscall)
173SYSCALL_SPU(poll) 173SYSCALL_SPU(poll)
174COMPAT_SYS(nfsservctl) 174SYSCALL(ni_syscall)
175SYSCALL_SPU(setresgid) 175SYSCALL_SPU(setresgid)
176SYSCALL_SPU(getresgid) 176SYSCALL_SPU(getresgid)
177COMPAT_SYS_SPU(prctl) 177COMPAT_SYS_SPU(prctl)
diff --git a/arch/powerpc/include/asm/system.h b/arch/powerpc/include/asm/system.h
index 2dc595dda03..e30a13d1ee7 100644
--- a/arch/powerpc/include/asm/system.h
+++ b/arch/powerpc/include/asm/system.h
@@ -120,7 +120,6 @@ extern void do_dabr(struct pt_regs *regs, unsigned long address,
120 unsigned long error_code); 120 unsigned long error_code);
121#endif 121#endif
122extern void print_backtrace(unsigned long *); 122extern void print_backtrace(unsigned long *);
123extern void show_regs(struct pt_regs * regs);
124extern void flush_instruction_cache(void); 123extern void flush_instruction_cache(void);
125extern void hard_reset_now(void); 124extern void hard_reset_now(void);
126extern void poweroff_now(void); 125extern void poweroff_now(void);
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 9fb933248ab..fa44ff53886 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2051,7 +2051,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
2051 2051
2052static struct cpu_spec the_cpu_spec; 2052static struct cpu_spec the_cpu_spec;
2053 2053
2054static void __init setup_cpu_spec(unsigned long offset, struct cpu_spec *s) 2054static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
2055 struct cpu_spec *s)
2055{ 2056{
2056 struct cpu_spec *t = &the_cpu_spec; 2057 struct cpu_spec *t = &the_cpu_spec;
2057 struct cpu_spec old; 2058 struct cpu_spec old;
@@ -2114,6 +2115,8 @@ static void __init setup_cpu_spec(unsigned long offset, struct cpu_spec *s)
2114 t->cpu_setup(offset, t); 2115 t->cpu_setup(offset, t);
2115 } 2116 }
2116#endif /* CONFIG_PPC64 || CONFIG_BOOKE */ 2117#endif /* CONFIG_PPC64 || CONFIG_BOOKE */
2118
2119 return t;
2117} 2120}
2118 2121
2119struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr) 2122struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
@@ -2124,10 +2127,8 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
2124 s = PTRRELOC(s); 2127 s = PTRRELOC(s);
2125 2128
2126 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++) { 2129 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++) {
2127 if ((pvr & s->pvr_mask) == s->pvr_value) { 2130 if ((pvr & s->pvr_mask) == s->pvr_value)
2128 setup_cpu_spec(offset, s); 2131 return setup_cpu_spec(offset, s);
2129 return s;
2130 }
2131 } 2132 }
2132 2133
2133 BUG(); 2134 BUG();
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index 1577434f408..b25f6325fc7 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -117,6 +117,7 @@ void ioport_unmap(void __iomem *addr)
117EXPORT_SYMBOL(ioport_map); 117EXPORT_SYMBOL(ioport_map);
118EXPORT_SYMBOL(ioport_unmap); 118EXPORT_SYMBOL(ioport_unmap);
119 119
120#ifdef CONFIG_PCI
120void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) 121void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
121{ 122{
122 resource_size_t start = pci_resource_start(dev, bar); 123 resource_size_t start = pci_resource_start(dev, bar);
@@ -146,3 +147,4 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
146 147
147EXPORT_SYMBOL(pci_iomap); 148EXPORT_SYMBOL(pci_iomap);
148EXPORT_SYMBOL(pci_iounmap); 149EXPORT_SYMBOL(pci_iounmap);
150#endif /* CONFIG_PCI */
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 6658a158995..9ce1672afb5 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -136,12 +136,16 @@ void __init reserve_crashkernel(void)
136 crashk_res.start = KDUMP_KERNELBASE; 136 crashk_res.start = KDUMP_KERNELBASE;
137#else 137#else
138 if (!crashk_res.start) { 138 if (!crashk_res.start) {
139#ifdef CONFIG_PPC64
139 /* 140 /*
140 * unspecified address, choose a region of specified size 141 * On 64bit we split the RMO in half but cap it at half of
141 * can overlap with initrd (ignoring corruption when retained) 142 * a small SLB (128MB) since the crash kernel needs to place
142 * ppc64 requires kernel and some stacks to be in first segemnt 143 * itself and some stacks to be in the first segment.
143 */ 144 */
145 crashk_res.start = min(0x80000000ULL, (ppc64_rma_size / 2));
146#else
144 crashk_res.start = KDUMP_KERNELBASE; 147 crashk_res.start = KDUMP_KERNELBASE;
148#endif
145 } 149 }
146 150
147 crash_base = PAGE_ALIGN(crashk_res.start); 151 crash_base = PAGE_ALIGN(crashk_res.start);
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 24582181b6e..59dbf6abaaf 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -26,7 +26,7 @@
26#include <asm/topology.h> 26#include <asm/topology.h>
27#include <asm/pci-bridge.h> 27#include <asm/pci-bridge.h>
28#include <asm/ppc-pci.h> 28#include <asm/ppc-pci.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30 30
31#ifdef CONFIG_PPC_OF_PLATFORM_PCI 31#ifdef CONFIG_PPC_OF_PLATFORM_PCI
32 32
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0187829c338..32656f10525 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -50,7 +50,7 @@ static int global_phb_number; /* Global phb counter */
50resource_size_t isa_mem_base; 50resource_size_t isa_mem_base;
51 51
52/* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */ 52/* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */
53unsigned int ppc_pci_flags = 0; 53unsigned int pci_flags = 0;
54 54
55 55
56static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; 56static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
@@ -842,9 +842,9 @@ int pci_proc_domain(struct pci_bus *bus)
842{ 842{
843 struct pci_controller *hose = pci_bus_to_host(bus); 843 struct pci_controller *hose = pci_bus_to_host(bus);
844 844
845 if (!(ppc_pci_flags & PPC_PCI_ENABLE_PROC_DOMAINS)) 845 if (!pci_has_flag(PCI_ENABLE_PROC_DOMAINS))
846 return 0; 846 return 0;
847 if (ppc_pci_flags & PPC_PCI_COMPAT_DOMAIN_0) 847 if (pci_has_flag(PCI_COMPAT_DOMAIN_0))
848 return hose->global_number != 0; 848 return hose->global_number != 0;
849 return 1; 849 return 1;
850} 850}
@@ -920,13 +920,13 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
920 struct resource *res = dev->resource + i; 920 struct resource *res = dev->resource + i;
921 if (!res->flags) 921 if (!res->flags)
922 continue; 922 continue;
923 /* On platforms that have PPC_PCI_PROBE_ONLY set, we don't 923 /* On platforms that have PCI_PROBE_ONLY set, we don't
924 * consider 0 as an unassigned BAR value. It's technically 924 * consider 0 as an unassigned BAR value. It's technically
925 * a valid value, but linux doesn't like it... so when we can 925 * a valid value, but linux doesn't like it... so when we can
926 * re-assign things, we do so, but if we can't, we keep it 926 * re-assign things, we do so, but if we can't, we keep it
927 * around and hope for the best... 927 * around and hope for the best...
928 */ 928 */
929 if (res->start == 0 && !(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) { 929 if (res->start == 0 && !pci_has_flag(PCI_PROBE_ONLY)) {
930 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] is unassigned\n", 930 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] is unassigned\n",
931 pci_name(dev), i, 931 pci_name(dev), i,
932 (unsigned long long)res->start, 932 (unsigned long long)res->start,
@@ -973,7 +973,7 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
973 int i; 973 int i;
974 974
975 /* We don't do anything if PCI_PROBE_ONLY is set */ 975 /* We don't do anything if PCI_PROBE_ONLY is set */
976 if (ppc_pci_flags & PPC_PCI_PROBE_ONLY) 976 if (pci_has_flag(PCI_PROBE_ONLY))
977 return 0; 977 return 0;
978 978
979 /* Job is a bit different between memory and IO */ 979 /* Job is a bit different between memory and IO */
@@ -1143,7 +1143,7 @@ void __devinit pci_fixup_cardbus(struct pci_bus *bus)
1143 1143
1144static int skip_isa_ioresource_align(struct pci_dev *dev) 1144static int skip_isa_ioresource_align(struct pci_dev *dev)
1145{ 1145{
1146 if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && 1146 if (pci_has_flag(PCI_CAN_SKIP_ISA_ALIGN) &&
1147 !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA)) 1147 !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA))
1148 return 1; 1148 return 1;
1149 return 0; 1149 return 0;
@@ -1271,7 +1271,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1271 * and as such ensure proper re-allocation 1271 * and as such ensure proper re-allocation
1272 * later. 1272 * later.
1273 */ 1273 */
1274 if (ppc_pci_flags & PPC_PCI_REASSIGN_ALL_RSRC) 1274 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC))
1275 goto clear_resource; 1275 goto clear_resource;
1276 pr = pci_find_parent_resource(bus->self, res); 1276 pr = pci_find_parent_resource(bus->self, res);
1277 if (pr == res) { 1277 if (pr == res) {
@@ -1456,7 +1456,7 @@ void __init pcibios_resource_survey(void)
1456 list_for_each_entry(b, &pci_root_buses, node) 1456 list_for_each_entry(b, &pci_root_buses, node)
1457 pcibios_allocate_bus_resources(b); 1457 pcibios_allocate_bus_resources(b);
1458 1458
1459 if (!(ppc_pci_flags & PPC_PCI_REASSIGN_ALL_RSRC)) { 1459 if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) {
1460 pcibios_allocate_resources(0); 1460 pcibios_allocate_resources(0);
1461 pcibios_allocate_resources(1); 1461 pcibios_allocate_resources(1);
1462 } 1462 }
@@ -1465,7 +1465,7 @@ void __init pcibios_resource_survey(void)
1465 * the low IO area and the VGA memory area if they intersect the 1465 * the low IO area and the VGA memory area if they intersect the
1466 * bus available resources to avoid allocating things on top of them 1466 * bus available resources to avoid allocating things on top of them
1467 */ 1467 */
1468 if (!(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) { 1468 if (!pci_has_flag(PCI_PROBE_ONLY)) {
1469 list_for_each_entry(b, &pci_root_buses, node) 1469 list_for_each_entry(b, &pci_root_buses, node)
1470 pcibios_reserve_legacy_regions(b); 1470 pcibios_reserve_legacy_regions(b);
1471 } 1471 }
@@ -1473,7 +1473,7 @@ void __init pcibios_resource_survey(void)
1473 /* Now, if the platform didn't decide to blindly trust the firmware, 1473 /* Now, if the platform didn't decide to blindly trust the firmware,
1474 * we proceed to assigning things that were left unassigned 1474 * we proceed to assigning things that were left unassigned
1475 */ 1475 */
1476 if (!(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) { 1476 if (!pci_has_flag(PCI_PROBE_ONLY)) {
1477 pr_debug("PCI: Assigning unassigned resources...\n"); 1477 pr_debug("PCI: Assigning unassigned resources...\n");
1478 pci_assign_unassigned_resources(); 1478 pci_assign_unassigned_resources();
1479 } 1479 }
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index e2f24badf78..bb154511db5 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -230,7 +230,7 @@ static int __init pcibios_init(void)
230 230
231 printk(KERN_INFO "PCI: Probing PCI hardware\n"); 231 printk(KERN_INFO "PCI: Probing PCI hardware\n");
232 232
233 if (ppc_pci_flags & PPC_PCI_REASSIGN_ALL_BUS) 233 if (pci_has_flag(PCI_REASSIGN_ALL_BUS))
234 pci_assign_all_buses = 1; 234 pci_assign_all_buses = 1;
235 235
236 /* Scan all of the recorded PCI controllers. */ 236 /* Scan all of the recorded PCI controllers. */
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index fc6452b6be9..ab34046752b 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -55,12 +55,12 @@ static int __init pcibios_init(void)
55 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot; 55 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
56 56
57 if (pci_probe_only) 57 if (pci_probe_only)
58 ppc_pci_flags |= PPC_PCI_PROBE_ONLY; 58 pci_add_flags(PCI_PROBE_ONLY);
59 59
60 /* On ppc64, we always enable PCI domains and we keep domain 0 60 /* On ppc64, we always enable PCI domains and we keep domain 0
61 * backward compatible in /proc for video cards 61 * backward compatible in /proc for video cards
62 */ 62 */
63 ppc_pci_flags |= PPC_PCI_ENABLE_PROC_DOMAINS | PPC_PCI_COMPAT_DOMAIN_0; 63 pci_add_flags(PCI_ENABLE_PROC_DOMAINS | PCI_COMPAT_DOMAIN_0);
64 64
65 /* Scan all of the recorded PCI controllers. */ 65 /* Scan all of the recorded PCI controllers. */
66 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 66 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
diff --git a/arch/powerpc/kernel/perf_callchain.c b/arch/powerpc/kernel/perf_callchain.c
index d05ae4204bb..564c1d8bdb5 100644
--- a/arch/powerpc/kernel/perf_callchain.c
+++ b/arch/powerpc/kernel/perf_callchain.c
@@ -154,8 +154,12 @@ static int read_user_stack_64(unsigned long __user *ptr, unsigned long *ret)
154 ((unsigned long)ptr & 7)) 154 ((unsigned long)ptr & 7))
155 return -EFAULT; 155 return -EFAULT;
156 156
157 if (!__get_user_inatomic(*ret, ptr)) 157 pagefault_disable();
158 if (!__get_user_inatomic(*ret, ptr)) {
159 pagefault_enable();
158 return 0; 160 return 0;
161 }
162 pagefault_enable();
159 163
160 return read_user_stack_slow(ptr, ret, 8); 164 return read_user_stack_slow(ptr, ret, 8);
161} 165}
@@ -166,8 +170,12 @@ static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
166 ((unsigned long)ptr & 3)) 170 ((unsigned long)ptr & 3))
167 return -EFAULT; 171 return -EFAULT;
168 172
169 if (!__get_user_inatomic(*ret, ptr)) 173 pagefault_disable();
174 if (!__get_user_inatomic(*ret, ptr)) {
175 pagefault_enable();
170 return 0; 176 return 0;
177 }
178 pagefault_enable();
171 179
172 return read_user_stack_slow(ptr, ret, 4); 180 return read_user_stack_slow(ptr, ret, 4);
173} 181}
@@ -294,11 +302,17 @@ static inline int current_is_64bit(void)
294 */ 302 */
295static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret) 303static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
296{ 304{
305 int rc;
306
297 if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) || 307 if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) ||
298 ((unsigned long)ptr & 3)) 308 ((unsigned long)ptr & 3))
299 return -EFAULT; 309 return -EFAULT;
300 310
301 return __get_user_inatomic(*ret, ptr); 311 pagefault_disable();
312 rc = __get_user_inatomic(*ret, ptr);
313 pagefault_enable();
314
315 return rc;
302} 316}
303 317
304static inline void perf_callchain_user_64(struct perf_callchain_entry *entry, 318static inline void perf_callchain_user_64(struct perf_callchain_entry *entry,
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 7d28f540200..f5ae872a2ef 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -18,7 +18,7 @@
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/atomic.h> 21#include <linux/atomic.h>
22#include <asm/checksum.h> 22#include <asm/checksum.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index c016033ba78..a909f4e9343 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1020,7 +1020,7 @@ static unsigned long __init alloc_up(unsigned long size, unsigned long align)
1020 } 1020 }
1021 if (addr == 0) 1021 if (addr == 0)
1022 return 0; 1022 return 0;
1023 RELOC(alloc_bottom) = addr; 1023 RELOC(alloc_bottom) = addr + size;
1024 1024
1025 prom_debug(" -> %x\n", addr); 1025 prom_debug(" -> %x\n", addr);
1026 prom_debug(" alloc_bottom : %x\n", RELOC(alloc_bottom)); 1026 prom_debug(" alloc_bottom : %x\n", RELOC(alloc_bottom));
@@ -1830,11 +1830,13 @@ static void __init *make_room(unsigned long *mem_start, unsigned long *mem_end,
1830 if (room > DEVTREE_CHUNK_SIZE) 1830 if (room > DEVTREE_CHUNK_SIZE)
1831 room = DEVTREE_CHUNK_SIZE; 1831 room = DEVTREE_CHUNK_SIZE;
1832 if (room < PAGE_SIZE) 1832 if (room < PAGE_SIZE)
1833 prom_panic("No memory for flatten_device_tree (no room)"); 1833 prom_panic("No memory for flatten_device_tree "
1834 "(no room)\n");
1834 chunk = alloc_up(room, 0); 1835 chunk = alloc_up(room, 0);
1835 if (chunk == 0) 1836 if (chunk == 0)
1836 prom_panic("No memory for flatten_device_tree (claim failed)"); 1837 prom_panic("No memory for flatten_device_tree "
1837 *mem_end = RELOC(alloc_top); 1838 "(claim failed)\n");
1839 *mem_end = chunk + room;
1838 } 1840 }
1839 1841
1840 ret = (void *)*mem_start; 1842 ret = (void *)*mem_start;
@@ -2042,7 +2044,7 @@ static void __init flatten_device_tree(void)
2042 2044
2043 /* 2045 /*
2044 * Check how much room we have between alloc top & bottom (+/- a 2046 * Check how much room we have between alloc top & bottom (+/- a
2045 * few pages), crop to 4Mb, as this is our "chuck" size 2047 * few pages), crop to 1MB, as this is our "chunk" size
2046 */ 2048 */
2047 room = RELOC(alloc_top) - RELOC(alloc_bottom) - 0x4000; 2049 room = RELOC(alloc_top) - RELOC(alloc_bottom) - 0x4000;
2048 if (room > DEVTREE_CHUNK_SIZE) 2050 if (room > DEVTREE_CHUNK_SIZE)
@@ -2053,7 +2055,7 @@ static void __init flatten_device_tree(void)
2053 mem_start = (unsigned long)alloc_up(room, PAGE_SIZE); 2055 mem_start = (unsigned long)alloc_up(room, PAGE_SIZE);
2054 if (mem_start == 0) 2056 if (mem_start == 0)
2055 prom_panic("Can't allocate initial device-tree chunk\n"); 2057 prom_panic("Can't allocate initial device-tree chunk\n");
2056 mem_end = RELOC(alloc_top); 2058 mem_end = mem_start + room;
2057 2059
2058 /* Get root of tree */ 2060 /* Get root of tree */
2059 root = call_prom("peer", 1, 1, (phandle)0); 2061 root = call_prom("peer", 1, 1, (phandle)0);
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 0e0ea941156..d5ca8236315 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -39,7 +39,7 @@
39#include <asm/udbg.h> 39#include <asm/udbg.h>
40#include <asm/syscalls.h> 40#include <asm/syscalls.h>
41#include <asm/smp.h> 41#include <asm/smp.h>
42#include <asm/atomic.h> 42#include <linux/atomic.h>
43#include <asm/time.h> 43#include <asm/time.h>
44#include <asm/mmu.h> 44#include <asm/mmu.h>
45#include <asm/topology.h> 45#include <asm/topology.h>
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 54e66da8f74..6cd8f0196b6 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -291,7 +291,7 @@ void __init find_and_init_phbs(void)
291 prop = of_get_property(of_chosen, 291 prop = of_get_property(of_chosen,
292 "linux,pci-assign-all-buses", NULL); 292 "linux,pci-assign-all-buses", NULL);
293 if (prop && *prop) 293 if (prop && *prop)
294 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 294 pci_add_flags(PCI_REASSIGN_ALL_BUS);
295#endif /* CONFIG_PPC32 */ 295#endif /* CONFIG_PPC32 */
296 } 296 }
297} 297}
diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c
index 67f6c3b5135..481ef064c8f 100644
--- a/arch/powerpc/kernel/rtasd.c
+++ b/arch/powerpc/kernel/rtasd.c
@@ -27,7 +27,7 @@
27#include <asm/rtas.h> 27#include <asm/rtas.h>
28#include <asm/prom.h> 28#include <asm/prom.h>
29#include <asm/nvram.h> 29#include <asm/nvram.h>
30#include <asm/atomic.h> 30#include <linux/atomic.h>
31#include <asm/machdep.h> 31#include <asm/machdep.h>
32 32
33 33
diff --git a/arch/powerpc/kernel/smp-tbsync.c b/arch/powerpc/kernel/smp-tbsync.c
index 03e45c4a9ef..640de836e46 100644
--- a/arch/powerpc/kernel/smp-tbsync.c
+++ b/arch/powerpc/kernel/smp-tbsync.c
@@ -11,7 +11,7 @@
11#include <linux/unistd.h> 11#include <linux/unistd.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <asm/atomic.h> 14#include <linux/atomic.h>
15#include <asm/smp.h> 15#include <asm/smp.h>
16#include <asm/time.h> 16#include <asm/time.h>
17 17
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index f932f8a0cf0..7bf2187dfd9 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -33,7 +33,7 @@
33#include <linux/topology.h> 33#include <linux/topology.h>
34 34
35#include <asm/ptrace.h> 35#include <asm/ptrace.h>
36#include <asm/atomic.h> 36#include <linux/atomic.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/page.h> 38#include <asm/page.h>
39#include <asm/pgtable.h> 39#include <asm/pgtable.h>
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 6dd33581a22..de2950135e6 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1251,7 +1251,7 @@ BEGIN_FTR_SECTION
1251 reg = 0 1251 reg = 0
1252 .rept 32 1252 .rept 32
1253 li r6,reg*16+VCPU_VSRS 1253 li r6,reg*16+VCPU_VSRS
1254 stxvd2x reg,r6,r3 1254 STXVD2X(reg,r6,r3)
1255 reg = reg + 1 1255 reg = reg + 1
1256 .endr 1256 .endr
1257FTR_SECTION_ELSE 1257FTR_SECTION_ELSE
@@ -1313,7 +1313,7 @@ BEGIN_FTR_SECTION
1313 reg = 0 1313 reg = 0
1314 .rept 32 1314 .rept 32
1315 li r7,reg*16+VCPU_VSRS 1315 li r7,reg*16+VCPU_VSRS
1316 lxvd2x reg,r7,r4 1316 LXVD2X(reg,r7,r4)
1317 reg = reg + 1 1317 reg = reg + 1
1318 .endr 1318 .endr
1319FTR_SECTION_ELSE 1319FTR_SECTION_ELSE
diff --git a/arch/powerpc/platforms/40x/ep405.c b/arch/powerpc/platforms/40x/ep405.c
index 4058fd1e7fc..b0389bbe4f9 100644
--- a/arch/powerpc/platforms/40x/ep405.c
+++ b/arch/powerpc/platforms/40x/ep405.c
@@ -100,7 +100,7 @@ static void __init ep405_setup_arch(void)
100 /* Find & init the BCSR CPLD */ 100 /* Find & init the BCSR CPLD */
101 ep405_init_bcsr(); 101 ep405_init_bcsr();
102 102
103 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 103 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
104} 104}
105 105
106static int __init ep405_probe(void) 106static int __init ep405_probe(void)
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 2521d93ef13..e8dd5c5df7d 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -61,7 +61,7 @@ static const char *board[] __initdata = {
61static int __init ppc40x_probe(void) 61static int __init ppc40x_probe(void)
62{ 62{
63 if (of_flat_dt_match(of_get_flat_dt_root(), board)) { 63 if (of_flat_dt_match(of_get_flat_dt_root(), board)) {
64 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 64 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
65 return 1; 65 return 1;
66 } 66 }
67 67
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index 335df91fbee..8b691df72f7 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -51,7 +51,7 @@ static int __init walnut_probe(void)
51 if (!of_flat_dt_is_compatible(root, "ibm,walnut")) 51 if (!of_flat_dt_is_compatible(root, "ibm,walnut"))
52 return 0; 52 return 0;
53 53
54 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; 54 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
55 55
56 return 1; 56 return 1;
57} 57}
diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c
index afc5e8ea377..e300dd4c89b 100644
--- a/arch/powerpc/platforms/44x/canyonlands.c
+++ b/arch/powerpc/platforms/44x/canyonlands.c
@@ -55,7 +55,7 @@ static int __init ppc460ex_probe(void)
55{ 55{
56 unsigned long root = of_get_flat_dt_root(); 56 unsigned long root = of_get_flat_dt_root();
57 if (of_flat_dt_is_compatible(root, "amcc,canyonlands")) { 57 if (of_flat_dt_is_compatible(root, "amcc,canyonlands")) {
58 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 58 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
59 return 1; 59 return 1;
60 } 60 }
61 return 0; 61 return 0;
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 88b9117fa69..6a4232bbdf8 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -54,7 +54,7 @@ static int __init ebony_probe(void)
54 if (!of_flat_dt_is_compatible(root, "ibm,ebony")) 54 if (!of_flat_dt_is_compatible(root, "ibm,ebony"))
55 return 0; 55 return 0;
56 56
57 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 57 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
58 58
59 return 1; 59 return 1;
60} 60}
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
index c81c19c0b3d..8d220276341 100644
--- a/arch/powerpc/platforms/44x/ppc44x_simple.c
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -72,7 +72,7 @@ static int __init ppc44x_probe(void)
72 72
73 for (i = 0; i < ARRAY_SIZE(board); i++) { 73 for (i = 0; i < ARRAY_SIZE(board); i++) {
74 if (of_flat_dt_is_compatible(root, board[i])) { 74 if (of_flat_dt_is_compatible(root, board[i])) {
75 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 75 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
76 return 1; 76 return 1;
77 } 77 }
78 } 78 }
diff --git a/arch/powerpc/platforms/44x/sam440ep.c b/arch/powerpc/platforms/44x/sam440ep.c
index a78e8eb6da4..9e09b835758 100644
--- a/arch/powerpc/platforms/44x/sam440ep.c
+++ b/arch/powerpc/platforms/44x/sam440ep.c
@@ -51,7 +51,7 @@ static int __init sam440ep_probe(void)
51 if (!of_flat_dt_is_compatible(root, "acube,sam440ep")) 51 if (!of_flat_dt_is_compatible(root, "acube,sam440ep"))
52 return 0; 52 return 0;
53 53
54 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 54 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
55 55
56 return 1; 56 return 1;
57} 57}
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
index 5f5e6930908..bfb11e01133 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -371,7 +371,7 @@ mpc52xx_add_bridge(struct device_node *node)
371 371
372 pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name); 372 pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name);
373 373
374 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 374 pci_add_flags(PCI_REASSIGN_ALL_BUS);
375 375
376 if (of_address_to_resource(node, 0, &rsrc) != 0) { 376 if (of_address_to_resource(node, 0, &rsrc) != 0) {
377 printk(KERN_ERR "Can't get %s resources\n", node->full_name); 377 printk(KERN_ERR "Can't get %s resources\n", node->full_name);
diff --git a/arch/powerpc/platforms/82xx/pq2.c b/arch/powerpc/platforms/82xx/pq2.c
index 9761a59f175..d111b024eaf 100644
--- a/arch/powerpc/platforms/82xx/pq2.c
+++ b/arch/powerpc/platforms/82xx/pq2.c
@@ -53,7 +53,7 @@ static void __init pq2_pci_add_bridge(struct device_node *np)
53 if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b) 53 if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b)
54 goto err; 54 goto err;
55 55
56 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 56 pci_add_flags(PCI_REASSIGN_ALL_BUS);
57 57
58 hose = pcibios_alloc_controller(np); 58 hose = pcibios_alloc_controller(np);
59 if (!hose) 59 if (!hose)
diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c
index f8fa2fc3129..c55129f5760 100644
--- a/arch/powerpc/platforms/83xx/km83xx.c
+++ b/arch/powerpc/platforms/83xx/km83xx.c
@@ -28,7 +28,7 @@
28#include <linux/of_device.h> 28#include <linux/of_device.h>
29 29
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/time.h> 32#include <asm/time.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/machdep.h> 34#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 93e60f1f21a..32a52896822 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -27,7 +27,7 @@
27#include <linux/of_device.h> 27#include <linux/of_device.h>
28 28
29#include <asm/system.h> 29#include <asm/system.h>
30#include <asm/atomic.h> 30#include <linux/atomic.h>
31#include <asm/time.h> 31#include <asm/time.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/machdep.h> 33#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 81e44fa1c64..6b45969567d 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -26,7 +26,7 @@
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27 27
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30#include <asm/time.h> 30#include <asm/time.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/machdep.h> 32#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index c1b1dc50b32..041c5177e73 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -26,7 +26,7 @@
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27 27
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30#include <asm/time.h> 30#include <asm/time.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/machdep.h> 32#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 81c052b1353..934cc8c46bb 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -34,7 +34,7 @@
34#include <linux/of_device.h> 34#include <linux/of_device.h>
35 35
36#include <asm/system.h> 36#include <asm/system.h>
37#include <asm/atomic.h> 37#include <linux/atomic.h>
38#include <asm/time.h> 38#include <asm/time.h>
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/machdep.h> 40#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/83xx/sbc834x.c b/arch/powerpc/platforms/83xx/sbc834x.c
index 49023dbe157..af41d8c810a 100644
--- a/arch/powerpc/platforms/83xx/sbc834x.c
+++ b/arch/powerpc/platforms/83xx/sbc834x.c
@@ -28,7 +28,7 @@
28#include <linux/of_platform.h> 28#include <linux/of_platform.h>
29 29
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/time.h> 32#include <asm/time.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/machdep.h> 34#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 6299a2a51ae..2bf99786d24 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -31,7 +31,7 @@
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/atomic.h> 34#include <linux/atomic.h>
35#include <asm/time.h> 35#include <asm/time.h>
36#include <asm/io.h> 36#include <asm/io.h>
37#include <asm/machdep.h> 37#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 747d1ee661f..973b3f4a4b4 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -36,7 +36,7 @@
36#include <linux/memblock.h> 36#include <linux/memblock.h>
37 37
38#include <asm/system.h> 38#include <asm/system.h>
39#include <asm/atomic.h> 39#include <linux/atomic.h>
40#include <asm/time.h> 40#include <asm/time.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/machdep.h> 42#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index ecdd8c09e4e..d07dcb7f4ee 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -34,7 +34,7 @@
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/page.h> 36#include <asm/page.h>
37#include <asm/atomic.h> 37#include <linux/atomic.h>
38#include <asm/time.h> 38#include <asm/time.h>
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/machdep.h> 40#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index d0af7fb2f34..b9ba86191ae 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -24,7 +24,7 @@ source "arch/powerpc/platforms/wsp/Kconfig"
24 24
25config KVM_GUEST 25config KVM_GUEST
26 bool "KVM Guest support" 26 bool "KVM Guest support"
27 default y 27 default n
28 ---help--- 28 ---help---
29 This option enables various optimizations for running under the KVM 29 This option enables various optimizations for running under the KVM
30 hypervisor. Overhead for the kernel when not running inside KVM should 30 hypervisor. Overhead for the kernel when not running inside KVM should
diff --git a/arch/powerpc/platforms/cell/cpufreq_spudemand.c b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
index d809836bcf5..7f92096fe96 100644
--- a/arch/powerpc/platforms/cell/cpufreq_spudemand.c
+++ b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
@@ -24,7 +24,7 @@
24#include <linux/sched.h> 24#include <linux/sched.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <asm/atomic.h> 27#include <linux/atomic.h>
28#include <asm/machdep.h> 28#include <asm/machdep.h>
29#include <asm/spu.h> 29#include <asm/spu.h>
30 30
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index dbb641ea90d..f2e1dfe4bf3 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -28,7 +28,7 @@
28#include <linux/cpu.h> 28#include <linux/cpu.h>
29 29
30#include <asm/ptrace.h> 30#include <asm/ptrace.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/pgtable.h> 34#include <asm/pgtable.h>
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 0c87bcd2452..bf4d41d8fa1 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -24,7 +24,7 @@
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <asm/atomic.h> 27#include <linux/atomic.h>
28#include <asm/spu.h> 28#include <asm/spu.h>
29#include <asm/spu_csa.h> 29#include <asm/spu_csa.h>
30#include "spufs.h" 30#include "spufs.h"
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 3f65443f171..83285c5a204 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -199,7 +199,7 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
199 printk ("RTAS supporting Pegasos OF not found, please upgrade" 199 printk ("RTAS supporting Pegasos OF not found, please upgrade"
200 " your firmware\n"); 200 " your firmware\n");
201 } 201 }
202 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 202 pci_add_flags(PCI_REASSIGN_ALL_BUS);
203 /* keep the reference to the root node */ 203 /* keep the reference to the root node */
204} 204}
205 205
diff --git a/arch/powerpc/platforms/chrp/smp.c b/arch/powerpc/platforms/chrp/smp.c
index a800122e4dd..feab30bbae2 100644
--- a/arch/powerpc/platforms/chrp/smp.c
+++ b/arch/powerpc/platforms/chrp/smp.c
@@ -18,7 +18,7 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19 19
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/atomic.h> 21#include <linux/atomic.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index 2df48c2287b..8bda9be06fa 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -29,7 +29,7 @@
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30 30
31#include <asm/ptrace.h> 31#include <asm/ptrace.h>
32#include <asm/atomic.h> 32#include <linux/atomic.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/page.h> 34#include <asm/page.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
index d679964ae2a..c2f3e861f5e 100644
--- a/arch/powerpc/platforms/powermac/backlight.c
+++ b/arch/powerpc/platforms/powermac/backlight.c
@@ -12,7 +12,7 @@
12#include <linux/backlight.h> 12#include <linux/backlight.h>
13#include <linux/adb.h> 13#include <linux/adb.h>
14#include <linux/pmu.h> 14#include <linux/pmu.h>
15#include <asm/atomic.h> 15#include <linux/atomic.h>
16#include <asm/prom.h> 16#include <asm/prom.h>
17#include <asm/backlight.h> 17#include <asm/backlight.h>
18 18
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 41a80a4fb97..5cc83851ad0 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -732,7 +732,7 @@ static void __init setup_bandit(struct pci_controller *hose,
732static int __init setup_uninorth(struct pci_controller *hose, 732static int __init setup_uninorth(struct pci_controller *hose,
733 struct resource *addr) 733 struct resource *addr)
734{ 734{
735 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 735 pci_add_flags(PCI_REASSIGN_ALL_BUS);
736 has_uninorth = 1; 736 has_uninorth = 1;
737 hose->ops = &macrisc_pci_ops; 737 hose->ops = &macrisc_pci_ops;
738 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000); 738 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000);
@@ -998,7 +998,7 @@ void __init pmac_pci_init(void)
998 struct device_node *np, *root; 998 struct device_node *np, *root;
999 struct device_node *ht = NULL; 999 struct device_node *ht = NULL;
1000 1000
1001 ppc_pci_set_flags(PPC_PCI_CAN_SKIP_ISA_ALIGN); 1001 pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);
1002 1002
1003 root = of_find_node_by_path("/"); 1003 root = of_find_node_by_path("/");
1004 if (root == NULL) { 1004 if (root == NULL) {
@@ -1057,7 +1057,7 @@ void __init pmac_pci_init(void)
1057 * some offset between bus number and domains for now when we 1057 * some offset between bus number and domains for now when we
1058 * assign all busses should help for now 1058 * assign all busses should help for now
1059 */ 1059 */
1060 if (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS)) 1060 if (pci_has_flag(PCI_REASSIGN_ALL_BUS))
1061 pcibios_assign_bus_offset = 0x10; 1061 pcibios_assign_bus_offset = 0x10;
1062#endif 1062#endif
1063} 1063}
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index d15fca32297..9a521dc8e48 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -35,7 +35,7 @@
35#include <linux/compiler.h> 35#include <linux/compiler.h>
36 36
37#include <asm/ptrace.h> 37#include <asm/ptrace.h>
38#include <asm/atomic.h> 38#include <linux/atomic.h>
39#include <asm/code-patching.h> 39#include <asm/code-patching.h>
40#include <asm/irq.h> 40#include <asm/irq.h>
41#include <asm/page.h> 41#include <asm/page.h>
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index e9190073bb9..0e865637006 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -181,7 +181,7 @@ static void dtl_stop(struct dtl *dtl)
181 181
182 lppaca_of(dtl->cpu).dtl_enable_mask = 0x0; 182 lppaca_of(dtl->cpu).dtl_enable_mask = 0x0;
183 183
184 unregister_dtl(hwcpu, __pa(dtl->buf)); 184 unregister_dtl(hwcpu);
185} 185}
186 186
187static u64 dtl_current_index(struct dtl *dtl) 187static u64 dtl_current_index(struct dtl *dtl)
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 46b55cf563e..ada6e07532e 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -31,7 +31,7 @@
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/of.h> 32#include <linux/of.h>
33 33
34#include <asm/atomic.h> 34#include <linux/atomic.h>
35#include <asm/eeh.h> 35#include <asm/eeh.h>
36#include <asm/eeh_event.h> 36#include <asm/eeh_event.h>
37#include <asm/io.h> 37#include <asm/io.h>
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index 8ed0d2d0e1b..fc5ae767989 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -25,7 +25,7 @@
25#include <linux/rbtree.h> 25#include <linux/rbtree.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <asm/atomic.h> 28#include <linux/atomic.h>
29#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
30#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
31 31
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index bc0288501f1..83a3ca2fd28 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -135,7 +135,7 @@ static void pseries_mach_cpu_die(void)
135 get_lppaca()->idle = 0; 135 get_lppaca()->idle = 0;
136 136
137 if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) { 137 if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
138 unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); 138 unregister_slb_shadow(hwcpu);
139 139
140 /* 140 /*
141 * Call to start_secondary_resume() will not return. 141 * Call to start_secondary_resume() will not return.
@@ -150,7 +150,7 @@ static void pseries_mach_cpu_die(void)
150 WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE); 150 WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE);
151 151
152 set_cpu_current_state(cpu, CPU_STATE_OFFLINE); 152 set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
153 unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); 153 unregister_slb_shadow(hwcpu);
154 rtas_stop_self(); 154 rtas_stop_self();
155 155
156 /* Should never get here... */ 156 /* Should never get here... */
diff --git a/arch/powerpc/platforms/pseries/io_event_irq.c b/arch/powerpc/platforms/pseries/io_event_irq.c
index c829e6067d5..2c4dd1fb833 100644
--- a/arch/powerpc/platforms/pseries/io_event_irq.c
+++ b/arch/powerpc/platforms/pseries/io_event_irq.c
@@ -212,17 +212,15 @@ static int __init ioei_init(void)
212 struct device_node *np; 212 struct device_node *np;
213 213
214 ioei_check_exception_token = rtas_token("check-exception"); 214 ioei_check_exception_token = rtas_token("check-exception");
215 if (ioei_check_exception_token == RTAS_UNKNOWN_SERVICE) { 215 if (ioei_check_exception_token == RTAS_UNKNOWN_SERVICE)
216 pr_warning("IO Event IRQ not supported on this system !\n");
217 return -ENODEV; 216 return -ENODEV;
218 } 217
219 np = of_find_node_by_path("/event-sources/ibm,io-events"); 218 np = of_find_node_by_path("/event-sources/ibm,io-events");
220 if (np) { 219 if (np) {
221 request_event_sources_irqs(np, ioei_interrupt, "IO_EVENT"); 220 request_event_sources_irqs(np, ioei_interrupt, "IO_EVENT");
221 pr_info("IBM I/O event interrupts enabled\n");
222 of_node_put(np); 222 of_node_put(np);
223 } else { 223 } else {
224 pr_err("io_event_irq: No ibm,io-events on system! "
225 "IO Event interrupt disabled.\n");
226 return -ENODEV; 224 return -ENODEV;
227 } 225 }
228 return 0; 226 return 0;
diff --git a/arch/powerpc/platforms/pseries/kexec.c b/arch/powerpc/platforms/pseries/kexec.c
index 54cf3a4aa16..7d94bdc63d5 100644
--- a/arch/powerpc/platforms/pseries/kexec.c
+++ b/arch/powerpc/platforms/pseries/kexec.c
@@ -25,20 +25,30 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
25{ 25{
26 /* Don't risk a hypervisor call if we're crashing */ 26 /* Don't risk a hypervisor call if we're crashing */
27 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { 27 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
28 unsigned long addr; 28 int ret;
29 int cpu = smp_processor_id();
30 int hwcpu = hard_smp_processor_id();
29 31
30 addr = __pa(get_slb_shadow()); 32 if (get_lppaca()->dtl_enable_mask) {
31 if (unregister_slb_shadow(hard_smp_processor_id(), addr)) 33 ret = unregister_dtl(hwcpu);
32 printk("SLB shadow buffer deregistration of " 34 if (ret) {
33 "cpu %u (hw_cpu_id %d) failed\n", 35 pr_err("WARNING: DTL deregistration for cpu "
34 smp_processor_id(), 36 "%d (hw %d) failed with %d\n",
35 hard_smp_processor_id()); 37 cpu, hwcpu, ret);
38 }
39 }
40
41 ret = unregister_slb_shadow(hwcpu);
42 if (ret) {
43 pr_err("WARNING: SLB shadow buffer deregistration "
44 "for cpu %d (hw %d) failed with %d\n",
45 cpu, hwcpu, ret);
46 }
36 47
37 addr = __pa(get_lppaca()); 48 ret = unregister_vpa(hwcpu);
38 if (unregister_vpa(hard_smp_processor_id(), addr)) { 49 if (ret) {
39 printk("VPA deregistration of cpu %u (hw_cpu_id %d) " 50 pr_err("WARNING: VPA deregistration for cpu %d "
40 "failed\n", smp_processor_id(), 51 "(hw %d) failed with %d\n", cpu, hwcpu, ret);
41 hard_smp_processor_id());
42 } 52 }
43 } 53 }
44} 54}
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index f7205d344ef..c9a29dae8c0 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -67,9 +67,8 @@ void vpa_init(int cpu)
67 ret = register_vpa(hwcpu, addr); 67 ret = register_vpa(hwcpu, addr);
68 68
69 if (ret) { 69 if (ret) {
70 printk(KERN_ERR "WARNING: vpa_init: VPA registration for " 70 pr_err("WARNING: VPA registration for cpu %d (hw %d) of area "
71 "cpu %d (hw %d) of area %lx returns %ld\n", 71 "%lx failed with %ld\n", cpu, hwcpu, addr, ret);
72 cpu, hwcpu, addr, ret);
73 return; 72 return;
74 } 73 }
75 /* 74 /*
@@ -80,10 +79,9 @@ void vpa_init(int cpu)
80 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 79 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
81 ret = register_slb_shadow(hwcpu, addr); 80 ret = register_slb_shadow(hwcpu, addr);
82 if (ret) 81 if (ret)
83 printk(KERN_ERR 82 pr_err("WARNING: SLB shadow buffer registration for "
84 "WARNING: vpa_init: SLB shadow buffer " 83 "cpu %d (hw %d) of area %lx failed with %ld\n",
85 "registration for cpu %d (hw %d) of area %lx " 84 cpu, hwcpu, addr, ret);
86 "returns %ld\n", cpu, hwcpu, addr, ret);
87 } 85 }
88 86
89 /* 87 /*
@@ -100,8 +98,9 @@ void vpa_init(int cpu)
100 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES; 98 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES;
101 ret = register_dtl(hwcpu, __pa(dtl)); 99 ret = register_dtl(hwcpu, __pa(dtl));
102 if (ret) 100 if (ret)
103 pr_warn("DTL registration failed for cpu %d (%ld)\n", 101 pr_err("WARNING: DTL registration of cpu %d (hw %d) "
104 cpu, ret); 102 "failed with %ld\n", smp_processor_id(),
103 hwcpu, ret);
105 lppaca_of(cpu).dtl_enable_mask = 2; 104 lppaca_of(cpu).dtl_enable_mask = 2;
106 } 105 }
107} 106}
@@ -204,7 +203,7 @@ static void pSeries_lpar_hptab_clear(void)
204 unsigned long ptel; 203 unsigned long ptel;
205 } ptes[4]; 204 } ptes[4];
206 long lpar_rc; 205 long lpar_rc;
207 int i, j; 206 unsigned long i, j;
208 207
209 /* Read in batches of 4, 208 /* Read in batches of 4,
210 * invalidate only valid entries not in the VRMA 209 * invalidate only valid entries not in the VRMA
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 4bf21207d7d..41c24c146d6 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -53,9 +53,9 @@ static inline long vpa_call(unsigned long flags, unsigned long cpu,
53 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa); 53 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
54} 54}
55 55
56static inline long unregister_vpa(unsigned long cpu, unsigned long vpa) 56static inline long unregister_vpa(unsigned long cpu)
57{ 57{
58 return vpa_call(0x5, cpu, vpa); 58 return vpa_call(0x5, cpu, 0);
59} 59}
60 60
61static inline long register_vpa(unsigned long cpu, unsigned long vpa) 61static inline long register_vpa(unsigned long cpu, unsigned long vpa)
@@ -63,9 +63,9 @@ static inline long register_vpa(unsigned long cpu, unsigned long vpa)
63 return vpa_call(0x1, cpu, vpa); 63 return vpa_call(0x1, cpu, vpa);
64} 64}
65 65
66static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa) 66static inline long unregister_slb_shadow(unsigned long cpu)
67{ 67{
68 return vpa_call(0x7, cpu, vpa); 68 return vpa_call(0x7, cpu, 0);
69} 69}
70 70
71static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa) 71static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
@@ -73,9 +73,9 @@ static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
73 return vpa_call(0x3, cpu, vpa); 73 return vpa_call(0x3, cpu, vpa);
74} 74}
75 75
76static inline long unregister_dtl(unsigned long cpu, unsigned long vpa) 76static inline long unregister_dtl(unsigned long cpu)
77{ 77{
78 return vpa_call(0x6, cpu, vpa); 78 return vpa_call(0x6, cpu, 0);
79} 79}
80 80
81static inline long register_dtl(unsigned long cpu, unsigned long vpa) 81static inline long register_dtl(unsigned long cpu, unsigned long vpa)
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index d00e52926b7..0969fd98c4f 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -324,8 +324,9 @@ static int alloc_dispatch_logs(void)
324 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES; 324 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES;
325 ret = register_dtl(hard_smp_processor_id(), __pa(dtl)); 325 ret = register_dtl(hard_smp_processor_id(), __pa(dtl));
326 if (ret) 326 if (ret)
327 pr_warn("DTL registration failed for boot cpu %d (%d)\n", 327 pr_err("WARNING: DTL registration of cpu %d (hw %d) failed "
328 smp_processor_id(), ret); 328 "with %d\n", smp_processor_id(),
329 hard_smp_processor_id(), ret);
329 get_paca()->lppaca_ptr->dtl_enable_mask = 2; 330 get_paca()->lppaca_ptr->dtl_enable_mask = 2;
330 331
331 return 0; 332 return 0;
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 1672db2d1b0..4e44c4dcd11 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -27,7 +27,7 @@
27#include <linux/cpu.h> 27#include <linux/cpu.h>
28 28
29#include <asm/ptrace.h> 29#include <asm/ptrace.h>
30#include <asm/atomic.h> 30#include <linux/atomic.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 3bba8bdb58b..4ce547e0047 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -351,7 +351,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
351 printk(KERN_WARNING "Can't get bus-range for %s, assume" 351 printk(KERN_WARNING "Can't get bus-range for %s, assume"
352 " bus 0\n", dev->full_name); 352 " bus 0\n", dev->full_name);
353 353
354 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 354 pci_add_flags(PCI_REASSIGN_ALL_BUS);
355 hose = pcibios_alloc_controller(dev); 355 hose = pcibios_alloc_controller(dev);
356 if (!hose) 356 if (!hose)
357 return -ENOMEM; 357 return -ENOMEM;
@@ -640,7 +640,7 @@ int __init mpc83xx_add_bridge(struct device_node *dev)
640 " bus 0\n", dev->full_name); 640 " bus 0\n", dev->full_name);
641 } 641 }
642 642
643 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 643 pci_add_flags(PCI_REASSIGN_ALL_BUS);
644 hose = pcibios_alloc_controller(dev); 644 hose = pcibios_alloc_controller(dev);
645 if (!hose) 645 if (!hose)
646 return -ENOMEM; 646 return -ENOMEM;
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 2de8551df40..c65f75aa7ff 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -54,6 +54,7 @@
54#define ODSR_CLEAR 0x1c00 54#define ODSR_CLEAR 0x1c00
55#define LTLEECSR_ENABLE_ALL 0xFFC000FC 55#define LTLEECSR_ENABLE_ALL 0xFFC000FC
56#define ESCSR_CLEAR 0x07120204 56#define ESCSR_CLEAR 0x07120204
57#define IECSR_CLEAR 0x80000000
57 58
58#define RIO_PORT1_EDCSR 0x0640 59#define RIO_PORT1_EDCSR 0x0640
59#define RIO_PORT2_EDCSR 0x0680 60#define RIO_PORT2_EDCSR 0x0680
@@ -1089,11 +1090,11 @@ static void port_error_handler(struct rio_mport *port, int offset)
1089 1090
1090 if (offset == 0) { 1091 if (offset == 0) {
1091 out_be32((u32 *)(rio_regs_win + RIO_PORT1_EDCSR), 0); 1092 out_be32((u32 *)(rio_regs_win + RIO_PORT1_EDCSR), 0);
1092 out_be32((u32 *)(rio_regs_win + RIO_PORT1_IECSR), 0); 1093 out_be32((u32 *)(rio_regs_win + RIO_PORT1_IECSR), IECSR_CLEAR);
1093 out_be32((u32 *)(rio_regs_win + RIO_ESCSR), ESCSR_CLEAR); 1094 out_be32((u32 *)(rio_regs_win + RIO_ESCSR), ESCSR_CLEAR);
1094 } else { 1095 } else {
1095 out_be32((u32 *)(rio_regs_win + RIO_PORT2_EDCSR), 0); 1096 out_be32((u32 *)(rio_regs_win + RIO_PORT2_EDCSR), 0);
1096 out_be32((u32 *)(rio_regs_win + RIO_PORT2_IECSR), 0); 1097 out_be32((u32 *)(rio_regs_win + RIO_PORT2_IECSR), IECSR_CLEAR);
1097 out_be32((u32 *)(rio_regs_win + RIO_PORT2_ESCSR), ESCSR_CLEAR); 1098 out_be32((u32 *)(rio_regs_win + RIO_PORT2_ESCSR), ESCSR_CLEAR);
1098 } 1099 }
1099} 1100}
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 265313e8396..2d66275e489 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -32,7 +32,7 @@
32#include <linux/fs_uart_pd.h> 32#include <linux/fs_uart_pd.h>
33 33
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/atomic.h> 35#include <linux/atomic.h>
36#include <asm/io.h> 36#include <asm/io.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/time.h> 38#include <asm/time.h>
diff --git a/arch/powerpc/sysdev/grackle.c b/arch/powerpc/sysdev/grackle.c
index cf27df6e508..08abe91ae79 100644
--- a/arch/powerpc/sysdev/grackle.c
+++ b/arch/powerpc/sysdev/grackle.c
@@ -57,7 +57,7 @@ void __init setup_grackle(struct pci_controller *hose)
57{ 57{
58 setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0); 58 setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0);
59 if (of_machine_is_compatible("PowerMac1,1")) 59 if (of_machine_is_compatible("PowerMac1,1"))
60 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 60 pci_add_flags(PCI_REASSIGN_ALL_BUS);
61 if (of_machine_is_compatible("AAPL,PowerBook1998")) 61 if (of_machine_is_compatible("AAPL,PowerBook1998"))
62 grackle_set_loop_snoop(hose, 1); 62 grackle_set_loop_snoop(hose, 1);
63#if 0 /* Disabled for now, HW problems ??? */ 63#if 0 /* Disabled for now, HW problems ??? */
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index 2ec4f3bb816..dbfe96bc878 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -655,8 +655,6 @@ struct ppc4xx_pciex_hwops
655 655
656static struct ppc4xx_pciex_hwops *ppc4xx_pciex_hwops; 656static struct ppc4xx_pciex_hwops *ppc4xx_pciex_hwops;
657 657
658#ifdef CONFIG_44x
659
660static int __init ppc4xx_pciex_wait_on_sdr(struct ppc4xx_pciex_port *port, 658static int __init ppc4xx_pciex_wait_on_sdr(struct ppc4xx_pciex_port *port,
661 unsigned int sdr_offset, 659 unsigned int sdr_offset,
662 unsigned int mask, 660 unsigned int mask,
@@ -688,6 +686,7 @@ static int __init ppc4xx_pciex_port_reset_sdr(struct ppc4xx_pciex_port *port)
688 return 0; 686 return 0;
689} 687}
690 688
689
691static void __init ppc4xx_pciex_check_link_sdr(struct ppc4xx_pciex_port *port) 690static void __init ppc4xx_pciex_check_link_sdr(struct ppc4xx_pciex_port *port)
692{ 691{
693 printk(KERN_INFO "PCIE%d: Checking link...\n", port->index); 692 printk(KERN_INFO "PCIE%d: Checking link...\n", port->index);
@@ -718,6 +717,8 @@ static void __init ppc4xx_pciex_check_link_sdr(struct ppc4xx_pciex_port *port)
718 printk(KERN_INFO "PCIE%d: No device detected.\n", port->index); 717 printk(KERN_INFO "PCIE%d: No device detected.\n", port->index);
719} 718}
720 719
720#ifdef CONFIG_44x
721
721/* Check various reset bits of the 440SPe PCIe core */ 722/* Check various reset bits of the 440SPe PCIe core */
722static int __init ppc440spe_pciex_check_reset(struct device_node *np) 723static int __init ppc440spe_pciex_check_reset(struct device_node *np)
723{ 724{
@@ -1977,7 +1978,7 @@ static int __init ppc4xx_pci_find_bridges(void)
1977{ 1978{
1978 struct device_node *np; 1979 struct device_node *np;
1979 1980
1980 ppc_pci_flags |= PPC_PCI_ENABLE_PROC_DOMAINS | PPC_PCI_COMPAT_DOMAIN_0; 1981 pci_add_flags(PCI_ENABLE_PROC_DOMAINS | PCI_COMPAT_DOMAIN_0);
1981 1982
1982#ifdef CONFIG_PPC4xx_PCI_EXPRESS 1983#ifdef CONFIG_PPC4xx_PCI_EXPRESS
1983 for_each_compatible_node(np, NULL, "ibm,plb-pciex") 1984 for_each_compatible_node(np, NULL, "ibm,plb-pciex")
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
index ee056807b52..9f51f97abb5 100644
--- a/arch/powerpc/sysdev/tsi108_dev.c
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -23,7 +23,7 @@
23#include <asm/tsi108.h> 23#include <asm/tsi108.h>
24 24
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/atomic.h> 26#include <linux/atomic.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/prom.h> 29#include <asm/prom.h>
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index c03fef7a9c2..ed5cb5af528 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -81,6 +81,7 @@ config S390
81 select INIT_ALL_POSSIBLE 81 select INIT_ALL_POSSIBLE
82 select HAVE_IRQ_WORK 82 select HAVE_IRQ_WORK
83 select HAVE_PERF_EVENTS 83 select HAVE_PERF_EVENTS
84 select ARCH_HAVE_NMI_SAFE_CMPXCHG
84 select HAVE_KERNEL_GZIP 85 select HAVE_KERNEL_GZIP
85 select HAVE_KERNEL_BZIP2 86 select HAVE_KERNEL_BZIP2
86 select HAVE_KERNEL_LZMA 87 select HAVE_KERNEL_LZMA
@@ -273,11 +274,11 @@ config MARCH_Z10
273 on older machines. 274 on older machines.
274 275
275config MARCH_Z196 276config MARCH_Z196
276 bool "IBM zEnterprise 196" 277 bool "IBM zEnterprise 114 and 196"
277 help 278 help
278 Select this to enable optimizations for IBM zEnterprise 196 279 Select this to enable optimizations for IBM zEnterprise 114 and 196
279 (2817 series). The kernel will be slightly faster but will not work 280 (2818 and 2817 series). The kernel will be slightly faster but will
280 on older machines. 281 not work on older machines.
281 282
282endchoice 283endchoice
283 284
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
index d9db13810d1..8517d2ae3b5 100644
--- a/arch/s390/include/asm/atomic.h
+++ b/arch/s390/include/asm/atomic.h
@@ -93,7 +93,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
93 return old; 93 return old;
94} 94}
95 95
96static inline int atomic_add_unless(atomic_t *v, int a, int u) 96static inline int __atomic_add_unless(atomic_t *v, int a, int u)
97{ 97{
98 int c, old; 98 int c, old;
99 c = atomic_read(v); 99 c = atomic_read(v);
@@ -105,10 +105,9 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
105 break; 105 break;
106 c = old; 106 c = old;
107 } 107 }
108 return c != u; 108 return c;
109} 109}
110 110
111#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
112 111
113#undef __CS_LOOP 112#undef __CS_LOOP
114 113
@@ -332,6 +331,4 @@ static inline long long atomic64_dec_if_positive(atomic64_t *v)
332#define smp_mb__before_atomic_inc() smp_mb() 331#define smp_mb__before_atomic_inc() smp_mb()
333#define smp_mb__after_atomic_inc() smp_mb() 332#define smp_mb__after_atomic_inc() smp_mb()
334 333
335#include <asm-generic/atomic-long.h>
336
337#endif /* __ARCH_S390_ATOMIC__ */ 334#endif /* __ARCH_S390_ATOMIC__ */
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 667c6e9f6a3..e5beb490959 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -832,10 +832,7 @@ static inline int find_next_bit_le(void *vaddr, unsigned long size,
832 832
833#include <asm-generic/bitops/le.h> 833#include <asm-generic/bitops/le.h>
834 834
835#define ext2_set_bit_atomic(lock, nr, addr) \ 835#include <asm-generic/bitops/ext2-atomic-setbit.h>
836 test_and_set_bit_le(nr, addr)
837#define ext2_clear_bit_atomic(lock, nr, addr) \
838 test_and_clear_bit_le(nr, addr)
839 836
840 837
841#endif /* __KERNEL__ */ 838#endif /* __KERNEL__ */
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
index 5e95d95450b..97cc4403fab 100644
--- a/arch/s390/include/asm/ipl.h
+++ b/arch/s390/include/asm/ipl.h
@@ -167,5 +167,6 @@ enum diag308_rc {
167}; 167};
168 168
169extern int diag308(unsigned long subcode, void *addr); 169extern int diag308(unsigned long subcode, void *addr);
170extern void diag308_reset(void);
170 171
171#endif /* _ASM_S390_IPL_H */ 172#endif /* _ASM_S390_IPL_H */
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
index f26280d9e88..e85c911aabf 100644
--- a/arch/s390/include/asm/lowcore.h
+++ b/arch/s390/include/asm/lowcore.h
@@ -18,6 +18,7 @@ void system_call(void);
18void pgm_check_handler(void); 18void pgm_check_handler(void);
19void mcck_int_handler(void); 19void mcck_int_handler(void);
20void io_int_handler(void); 20void io_int_handler(void);
21void psw_restart_int_handler(void);
21 22
22#ifdef CONFIG_32BIT 23#ifdef CONFIG_32BIT
23 24
@@ -150,7 +151,10 @@ struct _lowcore {
150 */ 151 */
151 __u32 ipib; /* 0x0e00 */ 152 __u32 ipib; /* 0x0e00 */
152 __u32 ipib_checksum; /* 0x0e04 */ 153 __u32 ipib_checksum; /* 0x0e04 */
153 __u8 pad_0x0e08[0x0f00-0x0e08]; /* 0x0e08 */ 154
155 /* 64 bit save area */
156 __u64 save_area_64; /* 0x0e08 */
157 __u8 pad_0x0e10[0x0f00-0x0e10]; /* 0x0e10 */
154 158
155 /* Extended facility list */ 159 /* Extended facility list */
156 __u64 stfle_fac_list[32]; /* 0x0f00 */ 160 __u64 stfle_fac_list[32]; /* 0x0f00 */
@@ -286,7 +290,10 @@ struct _lowcore {
286 */ 290 */
287 __u64 ipib; /* 0x0e00 */ 291 __u64 ipib; /* 0x0e00 */
288 __u32 ipib_checksum; /* 0x0e08 */ 292 __u32 ipib_checksum; /* 0x0e08 */
289 __u8 pad_0x0e0c[0x0f00-0x0e0c]; /* 0x0e0c */ 293
294 /* 64 bit save area */
295 __u64 save_area_64; /* 0x0e0c */
296 __u8 pad_0x0e14[0x0f00-0x0e14]; /* 0x0e14 */
290 297
291 /* Extended facility list */ 298 /* Extended facility list */
292 __u64 stfle_fac_list[32]; /* 0x0f00 */ 299 __u64 stfle_fac_list[32]; /* 0x0f00 */
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 55dfcc8bdc0..a4b6229e5d4 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -119,14 +119,12 @@ struct stack_frame {
119 * Do necessary setup to start up a new thread. 119 * Do necessary setup to start up a new thread.
120 */ 120 */
121#define start_thread(regs, new_psw, new_stackp) do { \ 121#define start_thread(regs, new_psw, new_stackp) do { \
122 set_fs(USER_DS); \
123 regs->psw.mask = psw_user_bits; \ 122 regs->psw.mask = psw_user_bits; \
124 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 123 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
125 regs->gprs[15] = new_stackp; \ 124 regs->gprs[15] = new_stackp; \
126} while (0) 125} while (0)
127 126
128#define start_thread31(regs, new_psw, new_stackp) do { \ 127#define start_thread31(regs, new_psw, new_stackp) do { \
129 set_fs(USER_DS); \
130 regs->psw.mask = psw_user32_bits; \ 128 regs->psw.mask = psw_user32_bits; \
131 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 129 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
132 regs->gprs[15] = new_stackp; \ 130 regs->gprs[15] = new_stackp; \
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index 9ad628a8574..62fd80c9e98 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -539,7 +539,6 @@ struct user_regs_struct
539 * These are defined as per linux/ptrace.h, which see. 539 * These are defined as per linux/ptrace.h, which see.
540 */ 540 */
541#define arch_has_single_step() (1) 541#define arch_has_single_step() (1)
542extern void show_regs(struct pt_regs * regs);
543 542
544#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) 543#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
545#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) 544#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h
index d382629a017..6582f69f238 100644
--- a/arch/s390/include/asm/system.h
+++ b/arch/s390/include/asm/system.h
@@ -113,6 +113,7 @@ extern void pfault_fini(void);
113 113
114extern void cmma_init(void); 114extern void cmma_init(void);
115extern int memcpy_real(void *, void *, size_t); 115extern int memcpy_real(void *, void *, size_t);
116extern void copy_to_absolute_zero(void *dest, void *src, size_t count);
116 117
117#define finish_arch_switch(prev) do { \ 118#define finish_arch_switch(prev) do { \
118 set_fs(current->thread.mm_segment); \ 119 set_fs(current->thread.mm_segment); \
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 05d8f38734e..532fd432215 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -27,12 +27,9 @@ int main(void)
27 BLANK(); 27 BLANK();
28 DEFINE(__TASK_pid, offsetof(struct task_struct, pid)); 28 DEFINE(__TASK_pid, offsetof(struct task_struct, pid));
29 BLANK(); 29 BLANK();
30 DEFINE(__THREAD_per_cause, 30 DEFINE(__THREAD_per_cause, offsetof(struct task_struct, thread.per_event.cause));
31 offsetof(struct task_struct, thread.per_event.cause)); 31 DEFINE(__THREAD_per_address, offsetof(struct task_struct, thread.per_event.address));
32 DEFINE(__THREAD_per_address, 32 DEFINE(__THREAD_per_paid, offsetof(struct task_struct, thread.per_event.paid));
33 offsetof(struct task_struct, thread.per_event.address));
34 DEFINE(__THREAD_per_paid,
35 offsetof(struct task_struct, thread.per_event.paid));
36 BLANK(); 33 BLANK();
37 DEFINE(__TI_task, offsetof(struct thread_info, task)); 34 DEFINE(__TI_task, offsetof(struct thread_info, task));
38 DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain)); 35 DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain));
@@ -142,6 +139,7 @@ int main(void)
142 DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area)); 139 DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area));
143 DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area)); 140 DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area));
144 DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area)); 141 DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area));
142 DEFINE(__LC_SAVE_AREA_64, offsetof(struct _lowcore, save_area_64));
145#ifdef CONFIG_32BIT 143#ifdef CONFIG_32BIT
146 DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr)); 144 DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr));
147#else /* CONFIG_32BIT */ 145#else /* CONFIG_32BIT */
diff --git a/arch/s390/kernel/base.S b/arch/s390/kernel/base.S
index 209938c1dfc..255435663bf 100644
--- a/arch/s390/kernel/base.S
+++ b/arch/s390/kernel/base.S
@@ -76,6 +76,42 @@ s390_base_pgm_handler_fn:
76 .quad 0 76 .quad 0
77 .previous 77 .previous
78 78
79#
80# Calls diag 308 subcode 1 and continues execution
81#
82# The following conditions must be ensured before calling this function:
83# * Prefix register = 0
84# * Lowcore protection is disabled
85#
86ENTRY(diag308_reset)
87 larl %r4,.Lctlregs # Save control registers
88 stctg %c0,%c15,0(%r4)
89 larl %r4,.Lrestart_psw # Setup restart PSW at absolute 0
90 lghi %r3,0
91 lg %r4,0(%r4) # Save PSW
92 sturg %r4,%r3 # Use sturg, because of large pages
93 lghi %r1,1
94 diag %r1,%r1,0x308
95.Lrestart_part2:
96 lhi %r0,0 # Load r0 with zero
97 lhi %r1,2 # Use mode 2 = ESAME (dump)
98 sigp %r1,%r0,0x12 # Switch to ESAME mode
99 sam64 # Switch to 64 bit addressing mode
100 larl %r4,.Lctlregs # Restore control registers
101 lctlg %c0,%c15,0(%r4)
102 br %r14
103.align 16
104.Lrestart_psw:
105 .long 0x00080000,0x80000000 + .Lrestart_part2
106
107 .section .bss
108.align 8
109.Lctlregs:
110 .rept 16
111 .quad 0
112 .endr
113 .previous
114
79#else /* CONFIG_64BIT */ 115#else /* CONFIG_64BIT */
80 116
81ENTRY(s390_base_mcck_handler) 117ENTRY(s390_base_mcck_handler)
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index eee999853a7..a9a285b8c4a 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -380,20 +380,13 @@ asmlinkage long sys32_sigreturn(void)
380 goto badframe; 380 goto badframe;
381 if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) 381 if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32))
382 goto badframe; 382 goto badframe;
383
384 sigdelsetmask(&set, ~_BLOCKABLE); 383 sigdelsetmask(&set, ~_BLOCKABLE);
385 spin_lock_irq(&current->sighand->siglock); 384 set_current_blocked(&set);
386 current->blocked = set;
387 recalc_sigpending();
388 spin_unlock_irq(&current->sighand->siglock);
389
390 if (restore_sigregs32(regs, &frame->sregs)) 385 if (restore_sigregs32(regs, &frame->sregs))
391 goto badframe; 386 goto badframe;
392 if (restore_sigregs_gprs_high(regs, frame->gprs_high)) 387 if (restore_sigregs_gprs_high(regs, frame->gprs_high))
393 goto badframe; 388 goto badframe;
394
395 return regs->gprs[2]; 389 return regs->gprs[2];
396
397badframe: 390badframe:
398 force_sig(SIGSEGV, current); 391 force_sig(SIGSEGV, current);
399 return 0; 392 return 0;
@@ -413,31 +406,22 @@ asmlinkage long sys32_rt_sigreturn(void)
413 goto badframe; 406 goto badframe;
414 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 407 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
415 goto badframe; 408 goto badframe;
416
417 sigdelsetmask(&set, ~_BLOCKABLE); 409 sigdelsetmask(&set, ~_BLOCKABLE);
418 spin_lock_irq(&current->sighand->siglock); 410 set_current_blocked(&set);
419 current->blocked = set;
420 recalc_sigpending();
421 spin_unlock_irq(&current->sighand->siglock);
422
423 if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) 411 if (restore_sigregs32(regs, &frame->uc.uc_mcontext))
424 goto badframe; 412 goto badframe;
425 if (restore_sigregs_gprs_high(regs, frame->gprs_high)) 413 if (restore_sigregs_gprs_high(regs, frame->gprs_high))
426 goto badframe; 414 goto badframe;
427
428 err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); 415 err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp);
429 st.ss_sp = compat_ptr(ss_sp); 416 st.ss_sp = compat_ptr(ss_sp);
430 err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); 417 err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size);
431 err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); 418 err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags);
432 if (err) 419 if (err)
433 goto badframe; 420 goto badframe;
434
435 set_fs (KERNEL_DS); 421 set_fs (KERNEL_DS);
436 do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]); 422 do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]);
437 set_fs (old_fs); 423 set_fs (old_fs);
438
439 return regs->gprs[2]; 424 return regs->gprs[2];
440
441badframe: 425badframe:
442 force_sig(SIGSEGV, current); 426 force_sig(SIGSEGV, current);
443 return 0; 427 return 0;
@@ -605,10 +589,10 @@ give_sigsegv:
605 * OK, we're invoking a handler 589 * OK, we're invoking a handler
606 */ 590 */
607 591
608int 592int handle_signal32(unsigned long sig, struct k_sigaction *ka,
609handle_signal32(unsigned long sig, struct k_sigaction *ka, 593 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
610 siginfo_t *info, sigset_t *oldset, struct pt_regs * regs)
611{ 594{
595 sigset_t blocked;
612 int ret; 596 int ret;
613 597
614 /* Set up the stack frame */ 598 /* Set up the stack frame */
@@ -616,15 +600,12 @@ handle_signal32(unsigned long sig, struct k_sigaction *ka,
616 ret = setup_rt_frame32(sig, ka, info, oldset, regs); 600 ret = setup_rt_frame32(sig, ka, info, oldset, regs);
617 else 601 else
618 ret = setup_frame32(sig, ka, oldset, regs); 602 ret = setup_frame32(sig, ka, oldset, regs);
619 603 if (ret)
620 if (ret == 0) { 604 return ret;
621 spin_lock_irq(&current->sighand->siglock); 605 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
622 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 606 if (!(ka->sa.sa_flags & SA_NODEFER))
623 if (!(ka->sa.sa_flags & SA_NODEFER)) 607 sigaddset(&blocked, sig);
624 sigaddset(&current->blocked,sig); 608 set_current_blocked(&blocked);
625 recalc_sigpending(); 609 return 0;
626 spin_unlock_irq(&current->sighand->siglock);
627 }
628 return ret;
629} 610}
630 611
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 08ab9aa6a0d..7526db6bf50 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -665,12 +665,6 @@ ENTRY(sys32_poll_wrapper)
665 lgfr %r4,%r4 # long 665 lgfr %r4,%r4 # long
666 jg sys_poll # branch to system call 666 jg sys_poll # branch to system call
667 667
668ENTRY(compat_sys_nfsservctl_wrapper)
669 lgfr %r2,%r2 # int
670 llgtr %r3,%r3 # struct compat_nfsctl_arg*
671 llgtr %r4,%r4 # union compat_nfsctl_res*
672 jg compat_sys_nfsservctl # branch to system call
673
674ENTRY(sys32_setresgid16_wrapper) 668ENTRY(sys32_setresgid16_wrapper)
675 llgfr %r2,%r2 # __kernel_old_gid_emu31_t 669 llgfr %r2,%r2 # __kernel_old_gid_emu31_t
676 llgfr %r3,%r3 # __kernel_old_gid_emu31_t 670 llgfr %r3,%r3 # __kernel_old_gid_emu31_t
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index 1ca3d1d6a86..45df6d456aa 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -27,7 +27,7 @@
27#include <asm/system.h> 27#include <asm/system.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/atomic.h> 30#include <linux/atomic.h>
31#include <asm/mathemu.h> 31#include <asm/mathemu.h>
32#include <asm/cpcmd.h> 32#include <asm/cpcmd.h>
33#include <asm/lowcore.h> 33#include <asm/lowcore.h>
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 068f8465c4e..f297456dba7 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -396,17 +396,19 @@ static __init void detect_machine_facilities(void)
396static __init void rescue_initrd(void) 396static __init void rescue_initrd(void)
397{ 397{
398#ifdef CONFIG_BLK_DEV_INITRD 398#ifdef CONFIG_BLK_DEV_INITRD
399 unsigned long min_initrd_addr = (unsigned long) _end + (4UL << 20);
399 /* 400 /*
400 * Move the initrd right behind the bss section in case it starts 401 * Just like in case of IPL from VM reader we make sure there is a
401 * within the bss section. So we don't overwrite it when the bss 402 * gap of 4MB between end of kernel and start of initrd.
402 * section gets cleared. 403 * That way we can also be sure that saving an NSS will succeed,
404 * which however only requires different segments.
403 */ 405 */
404 if (!INITRD_START || !INITRD_SIZE) 406 if (!INITRD_START || !INITRD_SIZE)
405 return; 407 return;
406 if (INITRD_START >= (unsigned long) __bss_stop) 408 if (INITRD_START >= min_initrd_addr)
407 return; 409 return;
408 memmove(__bss_stop, (void *) INITRD_START, INITRD_SIZE); 410 memmove((void *) min_initrd_addr, (void *) INITRD_START, INITRD_SIZE);
409 INITRD_START = (unsigned long) __bss_stop; 411 INITRD_START = min_initrd_addr;
410#endif 412#endif
411} 413}
412 414
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 3eab7cfab07..02ec8fe7d03 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -849,6 +849,34 @@ restart_crash:
849restart_go: 849restart_go:
850#endif 850#endif
851 851
852#
853# PSW restart interrupt handler
854#
855ENTRY(psw_restart_int_handler)
856 st %r15,__LC_SAVE_AREA_64(%r0) # save r15
857 basr %r15,0
8580: l %r15,.Lrestart_stack-0b(%r15) # load restart stack
859 l %r15,0(%r15)
860 ahi %r15,-SP_SIZE # make room for pt_regs
861 stm %r0,%r14,SP_R0(%r15) # store gprs %r0-%r14 to stack
862 mvc SP_R15(4,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack
863 mvc SP_PSW(8,%r15),__LC_RST_OLD_PSW(%r0) # store restart old psw
864 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0
865 basr %r14,0
8661: l %r14,.Ldo_restart-1b(%r14)
867 basr %r14,%r14
868
869 basr %r14,0 # load disabled wait PSW if
8702: lpsw restart_psw_crash-2b(%r14) # do_restart returns
871 .align 4
872.Ldo_restart:
873 .long do_restart
874.Lrestart_stack:
875 .long restart_stack
876 .align 8
877restart_psw_crash:
878 .long 0x000a0000,0x00000000 + restart_psw_crash
879
852 .section .kprobes.text, "ax" 880 .section .kprobes.text, "ax"
853 881
854#ifdef CONFIG_CHECK_STACK 882#ifdef CONFIG_CHECK_STACK
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 7a0fd426ca9..5f729d627ce 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -865,6 +865,26 @@ restart_crash:
865restart_go: 865restart_go:
866#endif 866#endif
867 867
868#
869# PSW restart interrupt handler
870#
871ENTRY(psw_restart_int_handler)
872 stg %r15,__LC_SAVE_AREA_64(%r0) # save r15
873 larl %r15,restart_stack # load restart stack
874 lg %r15,0(%r15)
875 aghi %r15,-SP_SIZE # make room for pt_regs
876 stmg %r0,%r14,SP_R0(%r15) # store gprs %r0-%r14 to stack
877 mvc SP_R15(8,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack
878 mvc SP_PSW(16,%r15),__LC_RST_OLD_PSW(%r0)# store restart old psw
879 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0
880 brasl %r14,do_restart
881
882 larl %r14,restart_psw_crash # load disabled wait PSW if
883 lpswe 0(%r14) # do_restart returns
884 .align 8
885restart_psw_crash:
886 .quad 0x0002000080000000,0x0000000000000000 + restart_psw_crash
887
868 .section .kprobes.text, "ax" 888 .section .kprobes.text, "ax"
869 889
870#ifdef CONFIG_CHECK_STACK 890#ifdef CONFIG_CHECK_STACK
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index a689070be28..48c71020636 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -45,11 +45,13 @@
45 * - halt 45 * - halt
46 * - power off 46 * - power off
47 * - reipl 47 * - reipl
48 * - restart
48 */ 49 */
49#define ON_PANIC_STR "on_panic" 50#define ON_PANIC_STR "on_panic"
50#define ON_HALT_STR "on_halt" 51#define ON_HALT_STR "on_halt"
51#define ON_POFF_STR "on_poff" 52#define ON_POFF_STR "on_poff"
52#define ON_REIPL_STR "on_reboot" 53#define ON_REIPL_STR "on_reboot"
54#define ON_RESTART_STR "on_restart"
53 55
54struct shutdown_action; 56struct shutdown_action;
55struct shutdown_trigger { 57struct shutdown_trigger {
@@ -1218,7 +1220,7 @@ static int __init reipl_fcp_init(void)
1218 /* sysfs: create fcp kset for mixing attr group and bin attrs */ 1220 /* sysfs: create fcp kset for mixing attr group and bin attrs */
1219 reipl_fcp_kset = kset_create_and_add(IPL_FCP_STR, NULL, 1221 reipl_fcp_kset = kset_create_and_add(IPL_FCP_STR, NULL,
1220 &reipl_kset->kobj); 1222 &reipl_kset->kobj);
1221 if (!reipl_kset) { 1223 if (!reipl_fcp_kset) {
1222 free_page((unsigned long) reipl_block_fcp); 1224 free_page((unsigned long) reipl_block_fcp);
1223 return -ENOMEM; 1225 return -ENOMEM;
1224 } 1226 }
@@ -1544,17 +1546,20 @@ static char vmcmd_on_reboot[128];
1544static char vmcmd_on_panic[128]; 1546static char vmcmd_on_panic[128];
1545static char vmcmd_on_halt[128]; 1547static char vmcmd_on_halt[128];
1546static char vmcmd_on_poff[128]; 1548static char vmcmd_on_poff[128];
1549static char vmcmd_on_restart[128];
1547 1550
1548DEFINE_IPL_ATTR_STR_RW(vmcmd, on_reboot, "%s\n", "%s\n", vmcmd_on_reboot); 1551DEFINE_IPL_ATTR_STR_RW(vmcmd, on_reboot, "%s\n", "%s\n", vmcmd_on_reboot);
1549DEFINE_IPL_ATTR_STR_RW(vmcmd, on_panic, "%s\n", "%s\n", vmcmd_on_panic); 1552DEFINE_IPL_ATTR_STR_RW(vmcmd, on_panic, "%s\n", "%s\n", vmcmd_on_panic);
1550DEFINE_IPL_ATTR_STR_RW(vmcmd, on_halt, "%s\n", "%s\n", vmcmd_on_halt); 1553DEFINE_IPL_ATTR_STR_RW(vmcmd, on_halt, "%s\n", "%s\n", vmcmd_on_halt);
1551DEFINE_IPL_ATTR_STR_RW(vmcmd, on_poff, "%s\n", "%s\n", vmcmd_on_poff); 1554DEFINE_IPL_ATTR_STR_RW(vmcmd, on_poff, "%s\n", "%s\n", vmcmd_on_poff);
1555DEFINE_IPL_ATTR_STR_RW(vmcmd, on_restart, "%s\n", "%s\n", vmcmd_on_restart);
1552 1556
1553static struct attribute *vmcmd_attrs[] = { 1557static struct attribute *vmcmd_attrs[] = {
1554 &sys_vmcmd_on_reboot_attr.attr, 1558 &sys_vmcmd_on_reboot_attr.attr,
1555 &sys_vmcmd_on_panic_attr.attr, 1559 &sys_vmcmd_on_panic_attr.attr,
1556 &sys_vmcmd_on_halt_attr.attr, 1560 &sys_vmcmd_on_halt_attr.attr,
1557 &sys_vmcmd_on_poff_attr.attr, 1561 &sys_vmcmd_on_poff_attr.attr,
1562 &sys_vmcmd_on_restart_attr.attr,
1558 NULL, 1563 NULL,
1559}; 1564};
1560 1565
@@ -1576,6 +1581,8 @@ static void vmcmd_run(struct shutdown_trigger *trigger)
1576 cmd = vmcmd_on_halt; 1581 cmd = vmcmd_on_halt;
1577 else if (strcmp(trigger->name, ON_POFF_STR) == 0) 1582 else if (strcmp(trigger->name, ON_POFF_STR) == 0)
1578 cmd = vmcmd_on_poff; 1583 cmd = vmcmd_on_poff;
1584 else if (strcmp(trigger->name, ON_RESTART_STR) == 0)
1585 cmd = vmcmd_on_restart;
1579 else 1586 else
1580 return; 1587 return;
1581 1588
@@ -1611,7 +1618,8 @@ static struct shutdown_action vmcmd_action = {SHUTDOWN_ACTION_VMCMD_STR,
1611 1618
1612static void stop_run(struct shutdown_trigger *trigger) 1619static void stop_run(struct shutdown_trigger *trigger)
1613{ 1620{
1614 if (strcmp(trigger->name, ON_PANIC_STR) == 0) 1621 if (strcmp(trigger->name, ON_PANIC_STR) == 0 ||
1622 strcmp(trigger->name, ON_RESTART_STR) == 0)
1615 disabled_wait((unsigned long) __builtin_return_address(0)); 1623 disabled_wait((unsigned long) __builtin_return_address(0));
1616 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy) 1624 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy)
1617 cpu_relax(); 1625 cpu_relax();
@@ -1707,6 +1715,34 @@ static void do_panic(void)
1707 stop_run(&on_panic_trigger); 1715 stop_run(&on_panic_trigger);
1708} 1716}
1709 1717
1718/* on restart */
1719
1720static struct shutdown_trigger on_restart_trigger = {ON_RESTART_STR,
1721 &stop_action};
1722
1723static ssize_t on_restart_show(struct kobject *kobj,
1724 struct kobj_attribute *attr, char *page)
1725{
1726 return sprintf(page, "%s\n", on_restart_trigger.action->name);
1727}
1728
1729static ssize_t on_restart_store(struct kobject *kobj,
1730 struct kobj_attribute *attr,
1731 const char *buf, size_t len)
1732{
1733 return set_trigger(buf, &on_restart_trigger, len);
1734}
1735
1736static struct kobj_attribute on_restart_attr =
1737 __ATTR(on_restart, 0644, on_restart_show, on_restart_store);
1738
1739void do_restart(void)
1740{
1741 smp_send_stop();
1742 on_restart_trigger.action->fn(&on_restart_trigger);
1743 stop_run(&on_restart_trigger);
1744}
1745
1710/* on halt */ 1746/* on halt */
1711 1747
1712static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action}; 1748static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action};
@@ -1783,7 +1819,9 @@ static void __init shutdown_triggers_init(void)
1783 if (sysfs_create_file(&shutdown_actions_kset->kobj, 1819 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1784 &on_poff_attr.attr)) 1820 &on_poff_attr.attr))
1785 goto fail; 1821 goto fail;
1786 1822 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1823 &on_restart_attr.attr))
1824 goto fail;
1787 return; 1825 return;
1788fail: 1826fail:
1789 panic("shutdown_triggers_init failed\n"); 1827 panic("shutdown_triggers_init failed\n");
@@ -1959,6 +1997,12 @@ static void do_reset_calls(void)
1959{ 1997{
1960 struct reset_call *reset; 1998 struct reset_call *reset;
1961 1999
2000#ifdef CONFIG_64BIT
2001 if (diag308_set_works) {
2002 diag308_reset();
2003 return;
2004 }
2005#endif
1962 list_for_each_entry(reset, &rcall, list) 2006 list_for_each_entry(reset, &rcall, list)
1963 reset->fn(); 2007 reset->fn();
1964} 2008}
diff --git a/arch/s390/kernel/reipl64.S b/arch/s390/kernel/reipl64.S
index 78eb7cfbd3d..e690975403f 100644
--- a/arch/s390/kernel/reipl64.S
+++ b/arch/s390/kernel/reipl64.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp 2000,2009 2 * Copyright IBM Corp 2000,2011
3 * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>, 3 * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>,
4 * Denis Joseph Barrow, 4 * Denis Joseph Barrow,
5 */ 5 */
@@ -8,6 +8,64 @@
8#include <asm/asm-offsets.h> 8#include <asm/asm-offsets.h>
9 9
10# 10#
11# store_status
12#
13# Prerequisites to run this function:
14# - Prefix register is set to zero
15# - Original prefix register is stored in "dump_prefix_page"
16# - Lowcore protection is off
17#
18ENTRY(store_status)
19 /* Save register one and load save area base */
20 stg %r1,__LC_SAVE_AREA_64(%r0)
21 lghi %r1,SAVE_AREA_BASE
22 /* General purpose registers */
23 stmg %r0,%r15,__LC_GPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
24 lg %r2,__LC_SAVE_AREA_64(%r0)
25 stg %r2,__LC_GPREGS_SAVE_AREA-SAVE_AREA_BASE+8(%r1)
26 /* Control registers */
27 stctg %c0,%c15,__LC_CREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
28 /* Access registers */
29 stam %a0,%a15,__LC_AREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
30 /* Floating point registers */
31 std %f0, 0x00 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
32 std %f1, 0x08 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
33 std %f2, 0x10 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
34 std %f3, 0x18 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
35 std %f4, 0x20 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
36 std %f5, 0x28 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
37 std %f6, 0x30 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
38 std %f7, 0x38 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
39 std %f8, 0x40 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
40 std %f9, 0x48 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
41 std %f10,0x50 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
42 std %f11,0x58 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
43 std %f12,0x60 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
44 std %f13,0x68 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
45 std %f14,0x70 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
46 std %f15,0x78 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
47 /* Floating point control register */
48 stfpc __LC_FP_CREG_SAVE_AREA-SAVE_AREA_BASE(%r1)
49 /* CPU timer */
50 stpt __LC_CPU_TIMER_SAVE_AREA-SAVE_AREA_BASE(%r1)
51 /* Saved prefix register */
52 larl %r2,dump_prefix_page
53 mvc __LC_PREFIX_SAVE_AREA-SAVE_AREA_BASE(4,%r1),0(%r2)
54 /* Clock comparator - seven bytes */
55 larl %r2,.Lclkcmp
56 stckc 0(%r2)
57 mvc __LC_CLOCK_COMP_SAVE_AREA-SAVE_AREA_BASE + 1(7,%r1),1(%r2)
58 /* Program status word */
59 epsw %r2,%r3
60 st %r2,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 0(%r1)
61 st %r3,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 4(%r1)
62 larl %r2,store_status
63 stg %r2,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 8(%r1)
64 br %r14
65.align 8
66.Lclkcmp: .quad 0x0000000000000000
67
68#
11# do_reipl_asm 69# do_reipl_asm
12# Parameter: r2 = schid of reipl device 70# Parameter: r2 = schid of reipl device
13# 71#
@@ -15,22 +73,7 @@
15ENTRY(do_reipl_asm) 73ENTRY(do_reipl_asm)
16 basr %r13,0 74 basr %r13,0
17.Lpg0: lpswe .Lnewpsw-.Lpg0(%r13) 75.Lpg0: lpswe .Lnewpsw-.Lpg0(%r13)
18.Lpg1: # do store status of all registers 76.Lpg1: brasl %r14,store_status
19
20 stg %r1,.Lregsave-.Lpg0(%r13)
21 lghi %r1,0x1000
22 stmg %r0,%r15,__LC_GPREGS_SAVE_AREA-0x1000(%r1)
23 lg %r0,.Lregsave-.Lpg0(%r13)
24 stg %r0,__LC_GPREGS_SAVE_AREA-0x1000+8(%r1)
25 stctg %c0,%c15,__LC_CREGS_SAVE_AREA-0x1000(%r1)
26 stam %a0,%a15,__LC_AREGS_SAVE_AREA-0x1000(%r1)
27 lg %r10,.Ldump_pfx-.Lpg0(%r13)
28 mvc __LC_PREFIX_SAVE_AREA-0x1000(4,%r1),0(%r10)
29 stfpc __LC_FP_CREG_SAVE_AREA-0x1000(%r1)
30 stckc .Lclkcmp-.Lpg0(%r13)
31 mvc __LC_CLOCK_COMP_SAVE_AREA-0x1000(7,%r1),.Lclkcmp-.Lpg0(%r13)
32 stpt __LC_CPU_TIMER_SAVE_AREA-0x1000(%r1)
33 stg %r13, __LC_PSW_SAVE_AREA-0x1000+8(%r1)
34 77
35 lctlg %c6,%c6,.Lall-.Lpg0(%r13) 78 lctlg %c6,%c6,.Lall-.Lpg0(%r13)
36 lgr %r1,%r2 79 lgr %r1,%r2
@@ -67,10 +110,7 @@ ENTRY(do_reipl_asm)
67 st %r14,.Ldispsw+12-.Lpg0(%r13) 110 st %r14,.Ldispsw+12-.Lpg0(%r13)
68 lpswe .Ldispsw-.Lpg0(%r13) 111 lpswe .Ldispsw-.Lpg0(%r13)
69 .align 8 112 .align 8
70.Lclkcmp: .quad 0x0000000000000000
71.Lall: .quad 0x00000000ff000000 113.Lall: .quad 0x00000000ff000000
72.Ldump_pfx: .quad dump_prefix_page
73.Lregsave: .quad 0x0000000000000000
74 .align 16 114 .align 16
75/* 115/*
76 * These addresses have to be 31 bit otherwise 116 * These addresses have to be 31 bit otherwise
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 0c35dee10b0..7b371c37061 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -346,7 +346,7 @@ setup_lowcore(void)
346 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); 346 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0);
347 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 347 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
348 lc->restart_psw.addr = 348 lc->restart_psw.addr =
349 PSW_ADDR_AMODE | (unsigned long) restart_int_handler; 349 PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler;
350 if (user_mode != HOME_SPACE_MODE) 350 if (user_mode != HOME_SPACE_MODE)
351 lc->restart_psw.mask |= PSW_ASC_HOME; 351 lc->restart_psw.mask |= PSW_ASC_HOME;
352 lc->external_new_psw.mask = psw_kernel_bits; 352 lc->external_new_psw.mask = psw_kernel_bits;
@@ -529,6 +529,27 @@ static void __init setup_memory_end(void)
529 memory_end = memory_size; 529 memory_end = memory_size;
530} 530}
531 531
532void *restart_stack __attribute__((__section__(".data")));
533
534/*
535 * Setup new PSW and allocate stack for PSW restart interrupt
536 */
537static void __init setup_restart_psw(void)
538{
539 psw_t psw;
540
541 restart_stack = __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0);
542 restart_stack += ASYNC_SIZE;
543
544 /*
545 * Setup restart PSW for absolute zero lowcore. This is necesary
546 * if PSW restart is done on an offline CPU that has lowcore zero
547 */
548 psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
549 psw.addr = PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler;
550 copy_to_absolute_zero(&S390_lowcore.restart_psw, &psw, sizeof(psw));
551}
552
532static void __init 553static void __init
533setup_memory(void) 554setup_memory(void)
534{ 555{
@@ -731,6 +752,7 @@ static void __init setup_hwcaps(void)
731 strcpy(elf_platform, "z10"); 752 strcpy(elf_platform, "z10");
732 break; 753 break;
733 case 0x2817: 754 case 0x2817:
755 case 0x2818:
734 strcpy(elf_platform, "z196"); 756 strcpy(elf_platform, "z196");
735 break; 757 break;
736 } 758 }
@@ -792,6 +814,7 @@ setup_arch(char **cmdline_p)
792 setup_addressing_mode(); 814 setup_addressing_mode();
793 setup_memory(); 815 setup_memory();
794 setup_resources(); 816 setup_resources();
817 setup_restart_psw();
795 setup_lowcore(); 818 setup_lowcore();
796 819
797 cpu_init(); 820 cpu_init();
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index abbb3c3c7aa..9a40e1cc5ec 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -57,17 +57,15 @@ typedef struct
57 */ 57 */
58SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask) 58SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
59{ 59{
60 mask &= _BLOCKABLE; 60 sigset_t blocked;
61 spin_lock_irq(&current->sighand->siglock);
62 current->saved_sigmask = current->blocked;
63 siginitset(&current->blocked, mask);
64 recalc_sigpending();
65 spin_unlock_irq(&current->sighand->siglock);
66 61
62 current->saved_sigmask = current->blocked;
63 mask &= _BLOCKABLE;
64 siginitset(&blocked, mask);
65 set_current_blocked(&blocked);
67 set_current_state(TASK_INTERRUPTIBLE); 66 set_current_state(TASK_INTERRUPTIBLE);
68 schedule(); 67 schedule();
69 set_thread_flag(TIF_RESTORE_SIGMASK); 68 set_restore_sigmask();
70
71 return -ERESTARTNOHAND; 69 return -ERESTARTNOHAND;
72} 70}
73 71
@@ -172,18 +170,11 @@ SYSCALL_DEFINE0(sigreturn)
172 goto badframe; 170 goto badframe;
173 if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) 171 if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE))
174 goto badframe; 172 goto badframe;
175
176 sigdelsetmask(&set, ~_BLOCKABLE); 173 sigdelsetmask(&set, ~_BLOCKABLE);
177 spin_lock_irq(&current->sighand->siglock); 174 set_current_blocked(&set);
178 current->blocked = set;
179 recalc_sigpending();
180 spin_unlock_irq(&current->sighand->siglock);
181
182 if (restore_sigregs(regs, &frame->sregs)) 175 if (restore_sigregs(regs, &frame->sregs))
183 goto badframe; 176 goto badframe;
184
185 return regs->gprs[2]; 177 return regs->gprs[2];
186
187badframe: 178badframe:
188 force_sig(SIGSEGV, current); 179 force_sig(SIGSEGV, current);
189 return 0; 180 return 0;
@@ -199,21 +190,14 @@ SYSCALL_DEFINE0(rt_sigreturn)
199 goto badframe; 190 goto badframe;
200 if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) 191 if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set)))
201 goto badframe; 192 goto badframe;
202
203 sigdelsetmask(&set, ~_BLOCKABLE); 193 sigdelsetmask(&set, ~_BLOCKABLE);
204 spin_lock_irq(&current->sighand->siglock); 194 set_current_blocked(&set);
205 current->blocked = set;
206 recalc_sigpending();
207 spin_unlock_irq(&current->sighand->siglock);
208
209 if (restore_sigregs(regs, &frame->uc.uc_mcontext)) 195 if (restore_sigregs(regs, &frame->uc.uc_mcontext))
210 goto badframe; 196 goto badframe;
211
212 if (do_sigaltstack(&frame->uc.uc_stack, NULL, 197 if (do_sigaltstack(&frame->uc.uc_stack, NULL,
213 regs->gprs[15]) == -EFAULT) 198 regs->gprs[15]) == -EFAULT)
214 goto badframe; 199 goto badframe;
215 return regs->gprs[2]; 200 return regs->gprs[2];
216
217badframe: 201badframe:
218 force_sig(SIGSEGV, current); 202 force_sig(SIGSEGV, current);
219 return 0; 203 return 0;
@@ -385,14 +369,11 @@ give_sigsegv:
385 return -EFAULT; 369 return -EFAULT;
386} 370}
387 371
388/* 372static int handle_signal(unsigned long sig, struct k_sigaction *ka,
389 * OK, we're invoking a handler 373 siginfo_t *info, sigset_t *oldset,
390 */ 374 struct pt_regs *regs)
391
392static int
393handle_signal(unsigned long sig, struct k_sigaction *ka,
394 siginfo_t *info, sigset_t *oldset, struct pt_regs * regs)
395{ 375{
376 sigset_t blocked;
396 int ret; 377 int ret;
397 378
398 /* Set up the stack frame */ 379 /* Set up the stack frame */
@@ -400,17 +381,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
400 ret = setup_rt_frame(sig, ka, info, oldset, regs); 381 ret = setup_rt_frame(sig, ka, info, oldset, regs);
401 else 382 else
402 ret = setup_frame(sig, ka, oldset, regs); 383 ret = setup_frame(sig, ka, oldset, regs);
403 384 if (ret)
404 if (ret == 0) { 385 return ret;
405 spin_lock_irq(&current->sighand->siglock); 386 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
406 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 387 if (!(ka->sa.sa_flags & SA_NODEFER))
407 if (!(ka->sa.sa_flags & SA_NODEFER)) 388 sigaddset(&blocked, sig);
408 sigaddset(&current->blocked,sig); 389 set_current_blocked(&blocked);
409 recalc_sigpending(); 390 return 0;
410 spin_unlock_irq(&current->sighand->siglock);
411 }
412
413 return ret;
414} 391}
415 392
416/* 393/*
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index a6d85c0a7f2..6ab16ac64d2 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -452,23 +452,27 @@ out:
452 */ 452 */
453int __cpuinit start_secondary(void *cpuvoid) 453int __cpuinit start_secondary(void *cpuvoid)
454{ 454{
455 /* Setup the cpu */
456 cpu_init(); 455 cpu_init();
457 preempt_disable(); 456 preempt_disable();
458 /* Enable TOD clock interrupts on the secondary cpu. */
459 init_cpu_timer(); 457 init_cpu_timer();
460 /* Enable cpu timer interrupts on the secondary cpu. */
461 init_cpu_vtimer(); 458 init_cpu_vtimer();
462 /* Enable pfault pseudo page faults on this cpu. */
463 pfault_init(); 459 pfault_init();
464 460
465 /* call cpu notifiers */
466 notify_cpu_starting(smp_processor_id()); 461 notify_cpu_starting(smp_processor_id());
467 /* Mark this cpu as online */
468 ipi_call_lock(); 462 ipi_call_lock();
469 set_cpu_online(smp_processor_id(), true); 463 set_cpu_online(smp_processor_id(), true);
470 ipi_call_unlock(); 464 ipi_call_unlock();
471 /* Switch on interrupts */ 465 __ctl_clear_bit(0, 28); /* Disable lowcore protection */
466 S390_lowcore.restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
467 S390_lowcore.restart_psw.addr =
468 PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler;
469 __ctl_set_bit(0, 28); /* Enable lowcore protection */
470 /*
471 * Wait until the cpu which brought this one up marked it
472 * active before enabling interrupts.
473 */
474 while (!cpumask_test_cpu(smp_processor_id(), cpu_active_mask))
475 cpu_relax();
472 local_irq_enable(); 476 local_irq_enable();
473 /* cpu_idle will call schedule for us */ 477 /* cpu_idle will call schedule for us */
474 cpu_idle(); 478 cpu_idle();
@@ -507,7 +511,11 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
507 memset((char *)lowcore + 512, 0, sizeof(*lowcore) - 512); 511 memset((char *)lowcore + 512, 0, sizeof(*lowcore) - 512);
508 lowcore->async_stack = async_stack + ASYNC_SIZE; 512 lowcore->async_stack = async_stack + ASYNC_SIZE;
509 lowcore->panic_stack = panic_stack + PAGE_SIZE; 513 lowcore->panic_stack = panic_stack + PAGE_SIZE;
510 514 lowcore->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
515 lowcore->restart_psw.addr =
516 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
517 if (user_mode != HOME_SPACE_MODE)
518 lowcore->restart_psw.mask |= PSW_ASC_HOME;
511#ifndef CONFIG_64BIT 519#ifndef CONFIG_64BIT
512 if (MACHINE_HAS_IEEE) { 520 if (MACHINE_HAS_IEEE) {
513 unsigned long save_area; 521 unsigned long save_area;
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 6ee39ef8fe4..73eb08c874f 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -177,7 +177,7 @@ SYSCALL(sys_getresuid16,sys_ni_syscall,sys32_getresuid16_wrapper) /* 165 old get
177NI_SYSCALL /* for vm86 */ 177NI_SYSCALL /* for vm86 */
178NI_SYSCALL /* old sys_query_module */ 178NI_SYSCALL /* old sys_query_module */
179SYSCALL(sys_poll,sys_poll,sys32_poll_wrapper) 179SYSCALL(sys_poll,sys_poll,sys32_poll_wrapper)
180SYSCALL(sys_nfsservctl,sys_nfsservctl,compat_sys_nfsservctl_wrapper) 180NI_SYSCALL /* old nfsservctl */
181SYSCALL(sys_setresgid16,sys_ni_syscall,sys32_setresgid16_wrapper) /* 170 old setresgid16 syscall */ 181SYSCALL(sys_setresgid16,sys_ni_syscall,sys32_setresgid16_wrapper) /* 170 old setresgid16 syscall */
182SYSCALL(sys_getresgid16,sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */ 182SYSCALL(sys_getresgid16,sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */
183SYSCALL(sys_prctl,sys_prctl,sys32_prctl_wrapper) 183SYSCALL(sys_prctl,sys_prctl,sys32_prctl_wrapper)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index e9372c77cce..ffabcd9d336 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -36,7 +36,7 @@
36#include <asm/system.h> 36#include <asm/system.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/atomic.h> 39#include <linux/atomic.h>
40#include <asm/mathemu.h> 40#include <asm/mathemu.h>
41#include <asm/cpcmd.h> 41#include <asm/cpcmd.h>
42#include <asm/lowcore.h> 42#include <asm/lowcore.h>
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index 51e5cd9b906..5dbbaa6e594 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -85,3 +85,19 @@ int memcpy_real(void *dest, void *src, size_t count)
85 arch_local_irq_restore(flags); 85 arch_local_irq_restore(flags);
86 return rc; 86 return rc;
87} 87}
88
89/*
90 * Copy memory to absolute zero
91 */
92void copy_to_absolute_zero(void *dest, void *src, size_t count)
93{
94 unsigned long cr0;
95
96 BUG_ON((unsigned long) dest + count >= sizeof(struct _lowcore));
97 preempt_disable();
98 __ctl_store(cr0, 0, 0);
99 __ctl_clear_bit(0, 28); /* disable lowcore protection */
100 memcpy_real(dest + store_prefix(), src, count);
101 __ctl_load(cr0, 0, 0);
102 preempt_enable();
103}
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 2adb23938a7..4d1f2bce87b 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -528,6 +528,7 @@ static inline void page_table_free_pgste(unsigned long *table)
528static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm, 528static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm,
529 unsigned long vmaddr) 529 unsigned long vmaddr)
530{ 530{
531 return NULL;
531} 532}
532 533
533static inline void page_table_free_pgste(unsigned long *table) 534static inline void page_table_free_pgste(unsigned long *table)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 748ff192006..ff9177c8f64 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -11,6 +11,7 @@ config SUPERH
11 select HAVE_DMA_ATTRS 11 select HAVE_DMA_ATTRS
12 select HAVE_IRQ_WORK 12 select HAVE_IRQ_WORK
13 select HAVE_PERF_EVENTS 13 select HAVE_PERF_EVENTS
14 select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
14 select PERF_USE_VMALLOC 15 select PERF_USE_VMALLOC
15 select HAVE_KERNEL_GZIP 16 select HAVE_KERNEL_GZIP
16 select HAVE_KERNEL_BZIP2 17 select HAVE_KERNEL_BZIP2
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index e3d8170ad00..99385d0b3f3 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -173,6 +173,7 @@ core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/
173cpuincdir-$(CONFIG_CPU_SH2A) += cpu-sh2a 173cpuincdir-$(CONFIG_CPU_SH2A) += cpu-sh2a
174cpuincdir-$(CONFIG_CPU_SH2) += cpu-sh2 174cpuincdir-$(CONFIG_CPU_SH2) += cpu-sh2
175cpuincdir-$(CONFIG_CPU_SH3) += cpu-sh3 175cpuincdir-$(CONFIG_CPU_SH3) += cpu-sh3
176cpuincdir-$(CONFIG_CPU_SH4A) += cpu-sh4a
176cpuincdir-$(CONFIG_CPU_SH4) += cpu-sh4 177cpuincdir-$(CONFIG_CPU_SH4) += cpu-sh4
177cpuincdir-$(CONFIG_CPU_SH5) += cpu-sh5 178cpuincdir-$(CONFIG_CPU_SH5) += cpu-sh5
178cpuincdir-y += cpu-common # Must be last 179cpuincdir-y += cpu-common # Must be last
diff --git a/arch/sh/boards/board-apsh4a3a.c b/arch/sh/boards/board-apsh4a3a.c
index 8e2a27057bc..2823619c600 100644
--- a/arch/sh/boards/board-apsh4a3a.c
+++ b/arch/sh/boards/board-apsh4a3a.c
@@ -116,7 +116,7 @@ static int apsh4a3a_clk_init(void)
116 int ret; 116 int ret;
117 117
118 clk = clk_get(NULL, "extal"); 118 clk = clk_get(NULL, "extal");
119 if (!clk || IS_ERR(clk)) 119 if (IS_ERR(clk))
120 return PTR_ERR(clk); 120 return PTR_ERR(clk);
121 ret = clk_set_rate(clk, 33333000); 121 ret = clk_set_rate(clk, 33333000);
122 clk_put(clk); 122 clk_put(clk);
diff --git a/arch/sh/boards/board-apsh4ad0a.c b/arch/sh/boards/board-apsh4ad0a.c
index e2bd218a054..b4d6292a924 100644
--- a/arch/sh/boards/board-apsh4ad0a.c
+++ b/arch/sh/boards/board-apsh4ad0a.c
@@ -94,7 +94,7 @@ static int apsh4ad0a_clk_init(void)
94 int ret; 94 int ret;
95 95
96 clk = clk_get(NULL, "extal"); 96 clk = clk_get(NULL, "extal");
97 if (!clk || IS_ERR(clk)) 97 if (IS_ERR(clk))
98 return PTR_ERR(clk); 98 return PTR_ERR(clk);
99 ret = clk_set_rate(clk, 33333000); 99 ret = clk_set_rate(clk, 33333000);
100 clk_put(clk); 100 clk_put(clk);
diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c
index ee65ff05c55..d879848f3cd 100644
--- a/arch/sh/boards/board-sh7785lcr.c
+++ b/arch/sh/boards/board-sh7785lcr.c
@@ -299,7 +299,7 @@ static int sh7785lcr_clk_init(void)
299 int ret; 299 int ret;
300 300
301 clk = clk_get(NULL, "extal"); 301 clk = clk_get(NULL, "extal");
302 if (!clk || IS_ERR(clk)) 302 if (IS_ERR(clk))
303 return PTR_ERR(clk); 303 return PTR_ERR(clk);
304 ret = clk_set_rate(clk, 33333333); 304 ret = clk_set_rate(clk, 33333333);
305 clk_put(clk); 305 clk_put(clk);
diff --git a/arch/sh/boards/board-urquell.c b/arch/sh/boards/board-urquell.c
index d81c609decc..24e3316c5c1 100644
--- a/arch/sh/boards/board-urquell.c
+++ b/arch/sh/boards/board-urquell.c
@@ -190,7 +190,7 @@ static int urquell_clk_init(void)
190 return -EINVAL; 190 return -EINVAL;
191 191
192 clk = clk_get(NULL, "extal"); 192 clk = clk_get(NULL, "extal");
193 if (!clk || IS_ERR(clk)) 193 if (IS_ERR(clk))
194 return PTR_ERR(clk); 194 return PTR_ERR(clk);
195 ret = clk_set_rate(clk, 33333333); 195 ret = clk_set_rate(clk, 33333333);
196 clk_put(clk); 196 clk_put(clk);
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 1dc924b2f50..d3626575891 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -332,8 +332,8 @@ static int camera_set_capture(struct soc_camera_platform_info *info,
332 return ret; 332 return ret;
333} 333}
334 334
335static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev); 335static int ap325rxa_camera_add(struct soc_camera_device *icd);
336static void ap325rxa_camera_del(struct soc_camera_link *icl); 336static void ap325rxa_camera_del(struct soc_camera_device *icd);
337 337
338static struct soc_camera_platform_info camera_info = { 338static struct soc_camera_platform_info camera_info = {
339 .format_name = "UYVY", 339 .format_name = "UYVY",
@@ -366,24 +366,23 @@ static void ap325rxa_camera_release(struct device *dev)
366 soc_camera_platform_release(&camera_device); 366 soc_camera_platform_release(&camera_device);
367} 367}
368 368
369static int ap325rxa_camera_add(struct soc_camera_link *icl, 369static int ap325rxa_camera_add(struct soc_camera_device *icd)
370 struct device *dev)
371{ 370{
372 int ret = soc_camera_platform_add(icl, dev, &camera_device, &camera_link, 371 int ret = soc_camera_platform_add(icd, &camera_device, &camera_link,
373 ap325rxa_camera_release, 0); 372 ap325rxa_camera_release, 0);
374 if (ret < 0) 373 if (ret < 0)
375 return ret; 374 return ret;
376 375
377 ret = camera_probe(); 376 ret = camera_probe();
378 if (ret < 0) 377 if (ret < 0)
379 soc_camera_platform_del(icl, camera_device, &camera_link); 378 soc_camera_platform_del(icd, camera_device, &camera_link);
380 379
381 return ret; 380 return ret;
382} 381}
383 382
384static void ap325rxa_camera_del(struct soc_camera_link *icl) 383static void ap325rxa_camera_del(struct soc_camera_device *icd)
385{ 384{
386 soc_camera_platform_del(icl, camera_device, &camera_link); 385 soc_camera_platform_del(icd, camera_device, &camera_link);
387} 386}
388#endif /* CONFIG_I2C */ 387#endif /* CONFIG_I2C */
389 388
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
index 87618c91d17..74b8db1b74a 100644
--- a/arch/sh/boards/mach-highlander/setup.c
+++ b/arch/sh/boards/mach-highlander/setup.c
@@ -335,8 +335,6 @@ static struct clk *r7780rp_clocks[] = {
335 &ivdr_clk, 335 &ivdr_clk,
336}; 336};
337 337
338#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
339
340static struct clk_lookup lookups[] = { 338static struct clk_lookup lookups[] = {
341 /* main clocks */ 339 /* main clocks */
342 CLKDEV_CON_ID("ivdr_clk", &ivdr_clk), 340 CLKDEV_CON_ID("ivdr_clk", &ivdr_clk),
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c
index 1521aa75ee3..486d1ac3694 100644
--- a/arch/sh/boards/mach-sdk7786/setup.c
+++ b/arch/sh/boards/mach-sdk7786/setup.c
@@ -194,7 +194,7 @@ static int sdk7786_clk_init(void)
194 return -EINVAL; 194 return -EINVAL;
195 195
196 clk = clk_get(NULL, "extal"); 196 clk = clk_get(NULL, "extal");
197 if (!clk || IS_ERR(clk)) 197 if (IS_ERR(clk))
198 return PTR_ERR(clk); 198 return PTR_ERR(clk);
199 ret = clk_set_rate(clk, 33333333); 199 ret = clk_set_rate(clk, 33333333);
200 clk_put(clk); 200 clk_put(clk);
diff --git a/arch/sh/drivers/pci/fixups-cayman.c b/arch/sh/drivers/pci/fixups-cayman.c
index b68b61d22c6..edc2fb7a5bb 100644
--- a/arch/sh/drivers/pci/fixups-cayman.c
+++ b/arch/sh/drivers/pci/fixups-cayman.c
@@ -5,7 +5,7 @@
5#include <cpu/irq.h> 5#include <cpu/irq.h>
6#include "pci-sh5.h" 6#include "pci-sh5.h"
7 7
8int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) 8int __init pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin)
9{ 9{
10 int result = -1; 10 int result = -1;
11 11
diff --git a/arch/sh/drivers/pci/fixups-dreamcast.c b/arch/sh/drivers/pci/fixups-dreamcast.c
index 942ef4f155f..edeea8960c3 100644
--- a/arch/sh/drivers/pci/fixups-dreamcast.c
+++ b/arch/sh/drivers/pci/fixups-dreamcast.c
@@ -64,7 +64,7 @@ static void __init gapspci_fixup_resources(struct pci_dev *dev)
64} 64}
65DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, gapspci_fixup_resources); 65DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, gapspci_fixup_resources);
66 66
67int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) 67int __init pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin)
68{ 68{
69 /* 69 /*
70 * The interrupt routing semantics here are quite trivial. 70 * The interrupt routing semantics here are quite trivial.
diff --git a/arch/sh/drivers/pci/fixups-landisk.c b/arch/sh/drivers/pci/fixups-landisk.c
index 95c6e2d94a0..ecb1d106063 100644
--- a/arch/sh/drivers/pci/fixups-landisk.c
+++ b/arch/sh/drivers/pci/fixups-landisk.c
@@ -19,7 +19,7 @@
19#define PCIMCR_MRSET_OFF 0xBFFFFFFF 19#define PCIMCR_MRSET_OFF 0xBFFFFFFF
20#define PCIMCR_RFSH_OFF 0xFFFFFFFB 20#define PCIMCR_RFSH_OFF 0xFFFFFFFB
21 21
22int pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 22int pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
23{ 23{
24 /* 24 /*
25 * slot0: pin1-4 = irq5,6,7,8 25 * slot0: pin1-4 = irq5,6,7,8
diff --git a/arch/sh/drivers/pci/fixups-r7780rp.c b/arch/sh/drivers/pci/fixups-r7780rp.c
index 08b2d8658a0..f9370dce0b7 100644
--- a/arch/sh/drivers/pci/fixups-r7780rp.c
+++ b/arch/sh/drivers/pci/fixups-r7780rp.c
@@ -18,7 +18,7 @@ static char irq_tab[] __initdata = {
18 65, 66, 67, 68, 18 65, 66, 67, 68,
19}; 19};
20 20
21int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 21int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
22{ 22{
23 return irq_tab[slot]; 23 return irq_tab[slot];
24} 24}
diff --git a/arch/sh/drivers/pci/fixups-rts7751r2d.c b/arch/sh/drivers/pci/fixups-rts7751r2d.c
index e248516118a..eaddb56c45c 100644
--- a/arch/sh/drivers/pci/fixups-rts7751r2d.c
+++ b/arch/sh/drivers/pci/fixups-rts7751r2d.c
@@ -31,7 +31,7 @@ static char lboxre2_irq_tab[] __initdata = {
31 IRQ_ETH0, IRQ_ETH1, IRQ_INTA, IRQ_INTD, 31 IRQ_ETH0, IRQ_ETH1, IRQ_INTA, IRQ_INTD,
32}; 32};
33 33
34int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 34int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
35{ 35{
36 if (mach_is_lboxre2()) 36 if (mach_is_lboxre2())
37 return lboxre2_irq_tab[slot]; 37 return lboxre2_irq_tab[slot];
diff --git a/arch/sh/drivers/pci/fixups-sdk7780.c b/arch/sh/drivers/pci/fixups-sdk7780.c
index 0930f988ac2..0b8472501b8 100644
--- a/arch/sh/drivers/pci/fixups-sdk7780.c
+++ b/arch/sh/drivers/pci/fixups-sdk7780.c
@@ -27,7 +27,7 @@ static char sdk7780_irq_tab[4][16] __initdata = {
27 { 68, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, 27 { 68, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
28}; 28};
29 29
30int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 30int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
31{ 31{
32 return sdk7780_irq_tab[pin-1][slot]; 32 return sdk7780_irq_tab[pin-1][slot];
33} 33}
diff --git a/arch/sh/drivers/pci/fixups-se7751.c b/arch/sh/drivers/pci/fixups-se7751.c
index fd3e6b02f28..2ec146c3fa4 100644
--- a/arch/sh/drivers/pci/fixups-se7751.c
+++ b/arch/sh/drivers/pci/fixups-se7751.c
@@ -6,7 +6,7 @@
6#include <linux/io.h> 6#include <linux/io.h>
7#include "pci-sh4.h" 7#include "pci-sh4.h"
8 8
9int __init pcibios_map_platform_irq(struct pci_dev *, u8 slot, u8 pin) 9int __init pcibios_map_platform_irq(const struct pci_dev *, u8 slot, u8 pin)
10{ 10{
11 switch (slot) { 11 switch (slot) {
12 case 0: return 13; 12 case 0: return 13;
diff --git a/arch/sh/drivers/pci/fixups-sh03.c b/arch/sh/drivers/pci/fixups-sh03.c
index 2e8a18b7ee5..1615e590616 100644
--- a/arch/sh/drivers/pci/fixups-sh03.c
+++ b/arch/sh/drivers/pci/fixups-sh03.c
@@ -3,7 +3,7 @@
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/pci.h> 4#include <linux/pci.h>
5 5
6int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) 6int __init pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin)
7{ 7{
8 int irq; 8 int irq;
9 9
diff --git a/arch/sh/drivers/pci/fixups-snapgear.c b/arch/sh/drivers/pci/fixups-snapgear.c
index 5a39ecc1adb..4a093c648d1 100644
--- a/arch/sh/drivers/pci/fixups-snapgear.c
+++ b/arch/sh/drivers/pci/fixups-snapgear.c
@@ -18,7 +18,7 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include "pci-sh4.h" 19#include "pci-sh4.h"
20 20
21int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 21int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
22{ 22{
23 int irq = -1; 23 int irq = -1;
24 24
diff --git a/arch/sh/drivers/pci/fixups-titan.c b/arch/sh/drivers/pci/fixups-titan.c
index 3a79fa8254a..bd1addb1b8b 100644
--- a/arch/sh/drivers/pci/fixups-titan.c
+++ b/arch/sh/drivers/pci/fixups-titan.c
@@ -27,7 +27,7 @@ static char titan_irq_tab[] __initdata = {
27 TITAN_IRQ_USB, 27 TITAN_IRQ_USB,
28}; 28};
29 29
30int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 30int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
31{ 31{
32 int irq = titan_irq_tab[slot]; 32 int irq = titan_irq_tab[slot];
33 33
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c
index 4418f9070ed..4df27c4fbf9 100644
--- a/arch/sh/drivers/pci/pcie-sh7786.c
+++ b/arch/sh/drivers/pci/pcie-sh7786.c
@@ -466,7 +466,7 @@ static int __init pcie_init(struct sh7786_pcie_port *port)
466 return 0; 466 return 0;
467} 467}
468 468
469int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 469int __init pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
470{ 470{
471 return 71; 471 return 71;
472} 472}
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h
index c7983124d99..63a27dbc952 100644
--- a/arch/sh/include/asm/atomic.h
+++ b/arch/sh/include/asm/atomic.h
@@ -30,7 +30,6 @@
30#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) 30#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
31#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) 31#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
32#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) 32#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
33#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
34 33
35#define atomic_inc(v) atomic_add(1, (v)) 34#define atomic_inc(v) atomic_add(1, (v))
36#define atomic_dec(v) atomic_sub(1, (v)) 35#define atomic_dec(v) atomic_sub(1, (v))
@@ -39,15 +38,15 @@
39#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) 38#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
40 39
41/** 40/**
42 * atomic_add_unless - add unless the number is a given value 41 * __atomic_add_unless - add unless the number is a given value
43 * @v: pointer of type atomic_t 42 * @v: pointer of type atomic_t
44 * @a: the amount to add to v... 43 * @a: the amount to add to v...
45 * @u: ...unless v is equal to u. 44 * @u: ...unless v is equal to u.
46 * 45 *
47 * Atomically adds @a to @v, so long as it was not @u. 46 * Atomically adds @a to @v, so long as it was not @u.
48 * Returns non-zero if @v was not @u, and zero otherwise. 47 * Returns the old value of @v.
49 */ 48 */
50static inline int atomic_add_unless(atomic_t *v, int a, int u) 49static inline int __atomic_add_unless(atomic_t *v, int a, int u)
51{ 50{
52 int c, old; 51 int c, old;
53 c = atomic_read(v); 52 c = atomic_read(v);
@@ -60,7 +59,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
60 c = old; 59 c = old;
61 } 60 }
62 61
63 return c != (u); 62 return c;
64} 63}
65 64
66#define smp_mb__before_atomic_dec() smp_mb() 65#define smp_mb__before_atomic_dec() smp_mb()
@@ -68,7 +67,4 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
68#define smp_mb__before_atomic_inc() smp_mb() 67#define smp_mb__before_atomic_inc() smp_mb()
69#define smp_mb__after_atomic_inc() smp_mb() 68#define smp_mb__after_atomic_inc() smp_mb()
70 69
71#include <asm-generic/atomic-long.h>
72#include <asm-generic/atomic64.h>
73
74#endif /* __ASM_SH_ATOMIC_H */ 70#endif /* __ASM_SH_ATOMIC_H */
diff --git a/arch/sh/include/asm/hw_irq.h b/arch/sh/include/asm/hw_irq.h
index 603cdde813d..693d4418405 100644
--- a/arch/sh/include/asm/hw_irq.h
+++ b/arch/sh/include/asm/hw_irq.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/sh_intc.h> 5#include <linux/sh_intc.h>
6#include <asm/atomic.h> 6#include <linux/atomic.h>
7 7
8extern atomic_t irq_err_count; 8extern atomic_t irq_err_count;
9 9
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index f0efe97f175..cb21e2399dc 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -112,7 +112,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
112#endif 112#endif
113 113
114/* Board-specific fixup routines. */ 114/* Board-specific fixup routines. */
115int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin); 115int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
116 116
117extern void pcibios_resource_to_bus(struct pci_dev *dev, 117extern void pcibios_resource_to_bus(struct pci_dev *dev,
118 struct pci_bus_region *region, struct resource *res); 118 struct pci_bus_region *region, struct resource *res);
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 88bd6be168a..2d3679b2447 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -45,8 +45,6 @@
45#define GET_FP(regs) ((regs)->regs[14]) 45#define GET_FP(regs) ((regs)->regs[14])
46#define GET_USP(regs) ((regs)->regs[15]) 46#define GET_USP(regs) ((regs)->regs[15])
47 47
48extern void show_regs(struct pt_regs *);
49
50#define arch_has_single_step() (1) 48#define arch_has_single_step() (1)
51 49
52/* 50/*
@@ -125,7 +123,7 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
125struct perf_event; 123struct perf_event;
126struct perf_sample_data; 124struct perf_sample_data;
127 125
128extern void ptrace_triggered(struct perf_event *bp, int nmi, 126extern void ptrace_triggered(struct perf_event *bp,
129 struct perf_sample_data *data, struct pt_regs *regs); 127 struct perf_sample_data *data, struct pt_regs *regs);
130 128
131#define task_pt_regs(task) \ 129#define task_pt_regs(task) \
diff --git a/arch/sh/include/asm/smp.h b/arch/sh/include/asm/smp.h
index 9070d943ddd..78b0d0f4b24 100644
--- a/arch/sh/include/asm/smp.h
+++ b/arch/sh/include/asm/smp.h
@@ -8,7 +8,7 @@
8#ifdef CONFIG_SMP 8#ifdef CONFIG_SMP
9 9
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <asm/atomic.h> 11#include <linux/atomic.h>
12#include <asm/current.h> 12#include <asm/current.h>
13#include <asm/percpu.h> 13#include <asm/percpu.h>
14 14
diff --git a/arch/sh/include/cpu-sh3/cpu/serial.h b/arch/sh/include/cpu-sh3/cpu/serial.h
new file mode 100644
index 00000000000..7766329bc10
--- /dev/null
+++ b/arch/sh/include/cpu-sh3/cpu/serial.h
@@ -0,0 +1,10 @@
1#ifndef __CPU_SH3_SERIAL_H
2#define __CPU_SH3_SERIAL_H
3
4#include <linux/serial_sci.h>
5
6extern struct plat_sci_port_ops sh770x_sci_port_ops;
7extern struct plat_sci_port_ops sh7710_sci_port_ops;
8extern struct plat_sci_port_ops sh7720_sci_port_ops;
9
10#endif /* __CPU_SH3_SERIAL_H */
diff --git a/arch/sh/include/cpu-sh4a/cpu/serial.h b/arch/sh/include/cpu-sh4a/cpu/serial.h
new file mode 100644
index 00000000000..ff1bc275d21
--- /dev/null
+++ b/arch/sh/include/cpu-sh4a/cpu/serial.h
@@ -0,0 +1,7 @@
1#ifndef __CPU_SH4A_SERIAL_H
2#define __CPU_SH4A_SERIAL_H
3
4/* arch/sh/kernel/cpu/sh4a/serial-sh7722.c */
5extern struct plat_sci_port_ops sh7722_sci_port_ops;
6
7#endif /* __CPU_SH4A_SERIAL_H */
diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
index 8f63a264a84..f59b1f30d44 100644
--- a/arch/sh/kernel/cpu/clock-cpg.c
+++ b/arch/sh/kernel/cpu/clock-cpg.c
@@ -35,8 +35,6 @@ static struct clk *onchip_clocks[] = {
35 &cpu_clk, 35 &cpu_clk,
36}; 36};
37 37
38#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
39
40static struct clk_lookup lookups[] = { 38static struct clk_lookup lookups[] = {
41 /* main clocks */ 39 /* main clocks */
42 CLKDEV_CON_ID("master_clk", &master_clk), 40 CLKDEV_CON_ID("master_clk", &master_clk),
diff --git a/arch/sh/kernel/cpu/sh3/Makefile b/arch/sh/kernel/cpu/sh3/Makefile
index ecab274141a..6f13f33a35f 100644
--- a/arch/sh/kernel/cpu/sh3/Makefile
+++ b/arch/sh/kernel/cpu/sh3/Makefile
@@ -7,15 +7,15 @@ obj-y := ex.o probe.o entry.o setup-sh3.o
7obj-$(CONFIG_HIBERNATION) += swsusp.o 7obj-$(CONFIG_HIBERNATION) += swsusp.o
8 8
9# CPU subtype setup 9# CPU subtype setup
10obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o serial-sh770x.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh770x.o 11obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh770x.o serial-sh770x.o
12obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh770x.o 12obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh770x.o serial-sh770x.o
13obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh770x.o 13obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh770x.o serial-sh770x.o
14obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh770x.o 14obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh770x.o serial-sh770x.o
15obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o 15obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o serial-sh7710.o
16obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o 16obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o serial-sh7710.o
17obj-$(CONFIG_CPU_SUBTYPE_SH7720) += setup-sh7720.o 17obj-$(CONFIG_CPU_SUBTYPE_SH7720) += setup-sh7720.o serial-sh7720.o
18obj-$(CONFIG_CPU_SUBTYPE_SH7721) += setup-sh7720.o 18obj-$(CONFIG_CPU_SUBTYPE_SH7721) += setup-sh7720.o serial-sh7720.o
19 19
20# Primary on-chip clocks (common) 20# Primary on-chip clocks (common)
21clock-$(CONFIG_CPU_SH3) := clock-sh3.o 21clock-$(CONFIG_CPU_SH3) := clock-sh3.o
diff --git a/arch/sh/kernel/cpu/sh3/serial-sh770x.c b/arch/sh/kernel/cpu/sh3/serial-sh770x.c
new file mode 100644
index 00000000000..4f7242c676b
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/serial-sh770x.c
@@ -0,0 +1,33 @@
1#include <linux/serial_sci.h>
2#include <linux/serial_core.h>
3#include <linux/io.h>
4#include <cpu/serial.h>
5
6#define SCPCR 0xA4000116
7#define SCPDR 0xA4000136
8
9static void sh770x_sci_init_pins(struct uart_port *port, unsigned int cflag)
10{
11 unsigned short data;
12
13 /* We need to set SCPCR to enable RTS/CTS */
14 data = __raw_readw(SCPCR);
15 /* Clear out SCP7MD1,0, SCP6MD1,0, SCP4MD1,0*/
16 __raw_writew(data & 0x0fcf, SCPCR);
17
18 if (!(cflag & CRTSCTS)) {
19 /* We need to set SCPCR to enable RTS/CTS */
20 data = __raw_readw(SCPCR);
21 /* Clear out SCP7MD1,0, SCP4MD1,0,
22 Set SCP6MD1,0 = {01} (output) */
23 __raw_writew((data & 0x0fcf) | 0x1000, SCPCR);
24
25 data = __raw_readb(SCPDR);
26 /* Set /RTS2 (bit6) = 0 */
27 __raw_writeb(data & 0xbf, SCPDR);
28 }
29}
30
31struct plat_sci_port_ops sh770x_sci_port_ops = {
32 .init_pins = sh770x_sci_init_pins,
33};
diff --git a/arch/sh/kernel/cpu/sh3/serial-sh7710.c b/arch/sh/kernel/cpu/sh3/serial-sh7710.c
new file mode 100644
index 00000000000..42190ef6aeb
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/serial-sh7710.c
@@ -0,0 +1,20 @@
1#include <linux/serial_sci.h>
2#include <linux/serial_core.h>
3#include <linux/io.h>
4#include <cpu/serial.h>
5
6#define PACR 0xa4050100
7#define PBCR 0xa4050102
8
9static void sh7710_sci_init_pins(struct uart_port *port, unsigned int cflag)
10{
11 if (port->mapbase == 0xA4400000) {
12 __raw_writew(__raw_readw(PACR) & 0xffc0, PACR);
13 __raw_writew(__raw_readw(PBCR) & 0x0fff, PBCR);
14 } else if (port->mapbase == 0xA4410000)
15 __raw_writew(__raw_readw(PBCR) & 0xf003, PBCR);
16}
17
18struct plat_sci_port_ops sh7710_sci_port_ops = {
19 .init_pins = sh7710_sci_init_pins,
20};
diff --git a/arch/sh/kernel/cpu/sh3/serial-sh7720.c b/arch/sh/kernel/cpu/sh3/serial-sh7720.c
new file mode 100644
index 00000000000..8832c526cdf
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/serial-sh7720.c
@@ -0,0 +1,37 @@
1#include <linux/serial_sci.h>
2#include <linux/serial_core.h>
3#include <linux/io.h>
4#include <cpu/serial.h>
5#include <asm/gpio.h>
6
7static void sh7720_sci_init_pins(struct uart_port *port, unsigned int cflag)
8{
9 unsigned short data;
10
11 if (cflag & CRTSCTS) {
12 /* enable RTS/CTS */
13 if (port->mapbase == 0xa4430000) { /* SCIF0 */
14 /* Clear PTCR bit 9-2; enable all scif pins but sck */
15 data = __raw_readw(PORT_PTCR);
16 __raw_writew((data & 0xfc03), PORT_PTCR);
17 } else if (port->mapbase == 0xa4438000) { /* SCIF1 */
18 /* Clear PVCR bit 9-2 */
19 data = __raw_readw(PORT_PVCR);
20 __raw_writew((data & 0xfc03), PORT_PVCR);
21 }
22 } else {
23 if (port->mapbase == 0xa4430000) { /* SCIF0 */
24 /* Clear PTCR bit 5-2; enable only tx and rx */
25 data = __raw_readw(PORT_PTCR);
26 __raw_writew((data & 0xffc3), PORT_PTCR);
27 } else if (port->mapbase == 0xa4438000) { /* SCIF1 */
28 /* Clear PVCR bit 5-2 */
29 data = __raw_readw(PORT_PVCR);
30 __raw_writew((data & 0xffc3), PORT_PVCR);
31 }
32 }
33}
34
35struct plat_sci_port_ops sh7720_sci_port_ops = {
36 .init_pins = sh7720_sci_init_pins,
37};
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
index cd2e702feb7..2309618c015 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
@@ -15,6 +15,7 @@
15#include <linux/serial_sci.h> 15#include <linux/serial_sci.h>
16#include <linux/sh_timer.h> 16#include <linux/sh_timer.h>
17#include <asm/rtc.h> 17#include <asm/rtc.h>
18#include <cpu/serial.h>
18 19
19enum { 20enum {
20 UNUSED = 0, 21 UNUSED = 0,
@@ -75,6 +76,8 @@ static struct plat_sci_port scif0_platform_data = {
75 .scbrr_algo_id = SCBRR_ALGO_4, 76 .scbrr_algo_id = SCBRR_ALGO_4,
76 .type = PORT_SCIF, 77 .type = PORT_SCIF,
77 .irqs = { 56, 56, 56 }, 78 .irqs = { 56, 56, 56 },
79 .ops = &sh770x_sci_port_ops,
80 .regtype = SCIx_SH7705_SCIF_REGTYPE,
78}; 81};
79 82
80static struct platform_device scif0_device = { 83static struct platform_device scif0_device = {
@@ -92,6 +95,8 @@ static struct plat_sci_port scif1_platform_data = {
92 .scbrr_algo_id = SCBRR_ALGO_4, 95 .scbrr_algo_id = SCBRR_ALGO_4,
93 .type = PORT_SCIF, 96 .type = PORT_SCIF,
94 .irqs = { 52, 52, 52 }, 97 .irqs = { 52, 52, 52 },
98 .ops = &sh770x_sci_port_ops,
99 .regtype = SCIx_SH7705_SCIF_REGTYPE,
95}; 100};
96 101
97static struct platform_device scif1_device = { 102static struct platform_device scif1_device = {
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
index 4551ad647c2..3f3d5fe5892 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
@@ -19,6 +19,7 @@
19#include <linux/serial.h> 19#include <linux/serial.h>
20#include <linux/serial_sci.h> 20#include <linux/serial_sci.h>
21#include <linux/sh_timer.h> 21#include <linux/sh_timer.h>
22#include <cpu/serial.h>
22 23
23enum { 24enum {
24 UNUSED = 0, 25 UNUSED = 0,
@@ -108,11 +109,14 @@ static struct platform_device rtc_device = {
108 109
109static struct plat_sci_port scif0_platform_data = { 110static struct plat_sci_port scif0_platform_data = {
110 .mapbase = 0xfffffe80, 111 .mapbase = 0xfffffe80,
112 .port_reg = 0xa4000136,
111 .flags = UPF_BOOT_AUTOCONF, 113 .flags = UPF_BOOT_AUTOCONF,
112 .scscr = SCSCR_TE | SCSCR_RE, 114 .scscr = SCSCR_TE | SCSCR_RE,
113 .scbrr_algo_id = SCBRR_ALGO_2, 115 .scbrr_algo_id = SCBRR_ALGO_2,
114 .type = PORT_SCI, 116 .type = PORT_SCI,
115 .irqs = { 23, 23, 23, 0 }, 117 .irqs = { 23, 23, 23, 0 },
118 .ops = &sh770x_sci_port_ops,
119 .regshift = 1,
116}; 120};
117 121
118static struct platform_device scif0_device = { 122static struct platform_device scif0_device = {
@@ -132,6 +136,8 @@ static struct plat_sci_port scif1_platform_data = {
132 .scbrr_algo_id = SCBRR_ALGO_2, 136 .scbrr_algo_id = SCBRR_ALGO_2,
133 .type = PORT_SCIF, 137 .type = PORT_SCIF,
134 .irqs = { 56, 56, 56, 56 }, 138 .irqs = { 56, 56, 56, 56 },
139 .ops = &sh770x_sci_port_ops,
140 .regtype = SCIx_SH3_SCIF_REGTYPE,
135}; 141};
136 142
137static struct platform_device scif1_device = { 143static struct platform_device scif1_device = {
@@ -146,11 +152,14 @@ static struct platform_device scif1_device = {
146 defined(CONFIG_CPU_SUBTYPE_SH7709) 152 defined(CONFIG_CPU_SUBTYPE_SH7709)
147static struct plat_sci_port scif2_platform_data = { 153static struct plat_sci_port scif2_platform_data = {
148 .mapbase = 0xa4000140, 154 .mapbase = 0xa4000140,
155 .port_reg = SCIx_NOT_SUPPORTED,
149 .flags = UPF_BOOT_AUTOCONF, 156 .flags = UPF_BOOT_AUTOCONF,
150 .scscr = SCSCR_TE | SCSCR_RE, 157 .scscr = SCSCR_TE | SCSCR_RE,
151 .scbrr_algo_id = SCBRR_ALGO_2, 158 .scbrr_algo_id = SCBRR_ALGO_2,
152 .type = PORT_IRDA, 159 .type = PORT_IRDA,
153 .irqs = { 52, 52, 52, 52 }, 160 .irqs = { 52, 52, 52, 52 },
161 .ops = &sh770x_sci_port_ops,
162 .regshift = 1,
154}; 163};
155 164
156static struct platform_device scif2_device = { 165static struct platform_device scif2_device = {
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
index 365b94a6fcb..94920345c14 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
@@ -20,6 +20,7 @@
20#include <linux/serial_sci.h> 20#include <linux/serial_sci.h>
21#include <linux/sh_timer.h> 21#include <linux/sh_timer.h>
22#include <asm/rtc.h> 22#include <asm/rtc.h>
23#include <cpu/serial.h>
23 24
24static struct resource rtc_resources[] = { 25static struct resource rtc_resources[] = {
25 [0] = { 26 [0] = {
@@ -55,6 +56,8 @@ static struct plat_sci_port scif0_platform_data = {
55 .scbrr_algo_id = SCBRR_ALGO_4, 56 .scbrr_algo_id = SCBRR_ALGO_4,
56 .type = PORT_SCIF, 57 .type = PORT_SCIF,
57 .irqs = { 80, 80, 80, 80 }, 58 .irqs = { 80, 80, 80, 80 },
59 .ops = &sh7720_sci_port_ops,
60 .regtype = SCIx_SH7705_SCIF_REGTYPE,
58}; 61};
59 62
60static struct platform_device scif0_device = { 63static struct platform_device scif0_device = {
@@ -72,6 +75,8 @@ static struct plat_sci_port scif1_platform_data = {
72 .scbrr_algo_id = SCBRR_ALGO_4, 75 .scbrr_algo_id = SCBRR_ALGO_4,
73 .type = PORT_SCIF, 76 .type = PORT_SCIF,
74 .irqs = { 81, 81, 81, 81 }, 77 .irqs = { 81, 81, 81, 81 },
78 .ops = &sh7720_sci_port_ops,
79 .regtype = SCIx_SH7705_SCIF_REGTYPE,
75}; 80};
76 81
77static struct platform_device scif1_device = { 82static struct platform_device scif1_device = {
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
index 3f6f8e98635..f4e262adb39 100644
--- a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
@@ -147,8 +147,6 @@ static struct clk *sh4202_onchip_clocks[] = {
147 &sh4202_shoc_clk, 147 &sh4202_shoc_clk,
148}; 148};
149 149
150#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
151
152static struct clk_lookup lookups[] = { 150static struct clk_lookup lookups[] = {
153 /* main clocks */ 151 /* main clocks */
154 CLKDEV_CON_ID("emi_clk", &sh4202_emi_clk), 152 CLKDEV_CON_ID("emi_clk", &sh4202_emi_clk),
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
index e53b4b38bd1..98cc0c794c7 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * SH7750/SH7751 Setup 2 * SH7091/SH7750/SH7750S/SH7750R/SH7751/SH7751R Setup
3 * 3 *
4 * Copyright (C) 2006 Paul Mundt 4 * Copyright (C) 2006 Paul Mundt
5 * Copyright (C) 2006 Jamie Lenehan 5 * Copyright (C) 2006 Jamie Lenehan
@@ -38,11 +38,13 @@ static struct platform_device rtc_device = {
38 38
39static struct plat_sci_port sci_platform_data = { 39static struct plat_sci_port sci_platform_data = {
40 .mapbase = 0xffe00000, 40 .mapbase = 0xffe00000,
41 .port_reg = 0xffe0001C,
41 .flags = UPF_BOOT_AUTOCONF, 42 .flags = UPF_BOOT_AUTOCONF,
42 .scscr = SCSCR_TE | SCSCR_RE, 43 .scscr = SCSCR_TE | SCSCR_RE,
43 .scbrr_algo_id = SCBRR_ALGO_2, 44 .scbrr_algo_id = SCBRR_ALGO_2,
44 .type = PORT_SCI, 45 .type = PORT_SCI,
45 .irqs = { 23, 23, 23, 0 }, 46 .irqs = { 23, 23, 23, 0 },
47 .regshift = 2,
46}; 48};
47 49
48static struct platform_device sci_device = { 50static struct platform_device sci_device = {
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
index 78bbf232e39..c0b4c774700 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
@@ -133,6 +133,7 @@ static struct plat_sci_port scif0_platform_data = {
133 .scbrr_algo_id = SCBRR_ALGO_2, 133 .scbrr_algo_id = SCBRR_ALGO_2,
134 .type = PORT_SCIF, 134 .type = PORT_SCIF,
135 .irqs = { 52, 53, 55, 54 }, 135 .irqs = { 52, 53, 55, 54 },
136 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
136}; 137};
137 138
138static struct platform_device scif0_device = { 139static struct platform_device scif0_device = {
@@ -150,6 +151,7 @@ static struct plat_sci_port scif1_platform_data = {
150 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 151 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
151 .scbrr_algo_id = SCBRR_ALGO_2, 152 .scbrr_algo_id = SCBRR_ALGO_2,
152 .irqs = { 72, 73, 75, 74 }, 153 .irqs = { 72, 73, 75, 74 },
154 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
153}; 155};
154 156
155static struct platform_device scif1_device = { 157static struct platform_device scif1_device = {
@@ -167,6 +169,7 @@ static struct plat_sci_port scif2_platform_data = {
167 .scbrr_algo_id = SCBRR_ALGO_2, 169 .scbrr_algo_id = SCBRR_ALGO_2,
168 .type = PORT_SCIF, 170 .type = PORT_SCIF,
169 .irqs = { 76, 77, 79, 78 }, 171 .irqs = { 76, 77, 79, 78 },
172 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
170}; 173};
171 174
172static struct platform_device scif2_device = { 175static struct platform_device scif2_device = {
@@ -184,6 +187,7 @@ static struct plat_sci_port scif3_platform_data = {
184 .scbrr_algo_id = SCBRR_ALGO_2, 187 .scbrr_algo_id = SCBRR_ALGO_2,
185 .type = PORT_SCI, 188 .type = PORT_SCI,
186 .irqs = { 80, 81, 82, 0 }, 189 .irqs = { 80, 81, 82, 0 },
190 .regshift = 2,
187}; 191};
188 192
189static struct platform_device scif3_device = { 193static struct platform_device scif3_device = {
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index cc122b1d303..c57fb287011 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7786) += setup-sh7786.o intc-shx3.o 11obj-$(CONFIG_CPU_SUBTYPE_SH7786) += setup-sh7786.o intc-shx3.o
12obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o 12obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o
13obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o 13obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o serial-sh7722.o
14obj-$(CONFIG_CPU_SUBTYPE_SH7723) += setup-sh7723.o 14obj-$(CONFIG_CPU_SUBTYPE_SH7723) += setup-sh7723.o
15obj-$(CONFIG_CPU_SUBTYPE_SH7724) += setup-sh7724.o 15obj-$(CONFIG_CPU_SUBTYPE_SH7724) += setup-sh7724.o
16obj-$(CONFIG_CPU_SUBTYPE_SH7366) += setup-sh7366.o 16obj-$(CONFIG_CPU_SUBTYPE_SH7366) += setup-sh7366.o
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
index 93c646072c1..70e45bdaadc 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
@@ -194,8 +194,6 @@ static struct clk mstp_clks[MSTP_NR] = {
194 [MSTP200] = MSTP(&div4_clks[DIV4_B], MSTPCR2, 0, 0), 194 [MSTP200] = MSTP(&div4_clks[DIV4_B], MSTPCR2, 0, 0),
195}; 195};
196 196
197#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
198
199static struct clk_lookup lookups[] = { 197static struct clk_lookup lookups[] = {
200 /* main clocks */ 198 /* main clocks */
201 CLKDEV_CON_ID("rclk", &r_clk), 199 CLKDEV_CON_ID("rclk", &r_clk),
@@ -233,32 +231,17 @@ static struct clk_lookup lookups[] = {
233 CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]), 231 CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]),
234 CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]), 232 CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]),
235 CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]), 233 CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]),
236 { 234
237 /* SCIF0 */ 235 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP007]),
238 .dev_id = "sh-sci.0", 236 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP006]),
239 .con_id = "sci_fck", 237 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP005]),
240 .clk = &mstp_clks[MSTP007], 238 CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP004]),
241 }, { 239
242 /* SCIF1 */
243 .dev_id = "sh-sci.1",
244 .con_id = "sci_fck",
245 .clk = &mstp_clks[MSTP006],
246 }, {
247 /* SCIF2 */
248 .dev_id = "sh-sci.2",
249 .con_id = "sci_fck",
250 .clk = &mstp_clks[MSTP005],
251 }, {
252 /* SCIF3 */
253 .dev_id = "sh-sci.3",
254 .con_id = "sci_fck",
255 .clk = &mstp_clks[MSTP004],
256 },
257 CLKDEV_CON_ID("sio0", &mstp_clks[MSTP003]), 240 CLKDEV_CON_ID("sio0", &mstp_clks[MSTP003]),
258 CLKDEV_CON_ID("siof0", &mstp_clks[MSTP002]), 241 CLKDEV_CON_ID("siof0", &mstp_clks[MSTP002]),
259 CLKDEV_CON_ID("siof1", &mstp_clks[MSTP001]), 242 CLKDEV_CON_ID("siof1", &mstp_clks[MSTP001]),
260 CLKDEV_CON_ID("i2c0", &mstp_clks[MSTP109]), 243 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP109]),
261 CLKDEV_CON_ID("i2c1", &mstp_clks[MSTP108]), 244 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP108]),
262 CLKDEV_CON_ID("tpu0", &mstp_clks[MSTP225]), 245 CLKDEV_CON_ID("tpu0", &mstp_clks[MSTP225]),
263 CLKDEV_CON_ID("irda0", &mstp_clks[MSTP224]), 246 CLKDEV_CON_ID("irda0", &mstp_clks[MSTP224]),
264 CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP218]), 247 CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP218]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
index 049dc0628cc..3c3165000c5 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
@@ -192,8 +192,6 @@ static struct clk mstp_clks[MSTP_NR] = {
192 [MSTP200] = MSTP(&div4_clks[DIV4_B], MSTPCR2, 0, 0), 192 [MSTP200] = MSTP(&div4_clks[DIV4_B], MSTPCR2, 0, 0),
193}; 193};
194 194
195#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
196
197static struct clk_lookup lookups[] = { 195static struct clk_lookup lookups[] = {
198 /* main clocks */ 196 /* main clocks */
199 CLKDEV_CON_ID("rclk", &r_clk), 197 CLKDEV_CON_ID("rclk", &r_clk),
@@ -231,25 +229,14 @@ static struct clk_lookup lookups[] = {
231 CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]), 229 CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]),
232 CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]), 230 CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]),
233 CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]), 231 CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]),
234 { 232
235 /* SCIF0 */ 233 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP007]),
236 .dev_id = "sh-sci.0", 234 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP006]),
237 .con_id = "sci_fck", 235 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP005]),
238 .clk = &mstp_clks[MSTP007], 236
239 }, {
240 /* SCIF1 */
241 .dev_id = "sh-sci.1",
242 .con_id = "sci_fck",
243 .clk = &mstp_clks[MSTP006],
244 }, {
245 /* SCIF2 */
246 .dev_id = "sh-sci.2",
247 .con_id = "sci_fck",
248 .clk = &mstp_clks[MSTP005],
249 },
250 CLKDEV_CON_ID("msiof0", &mstp_clks[MSTP002]), 237 CLKDEV_CON_ID("msiof0", &mstp_clks[MSTP002]),
251 CLKDEV_CON_ID("sbr0", &mstp_clks[MSTP001]), 238 CLKDEV_CON_ID("sbr0", &mstp_clks[MSTP001]),
252 CLKDEV_CON_ID("i2c0", &mstp_clks[MSTP109]), 239 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP109]),
253 CLKDEV_CON_ID("icb0", &mstp_clks[MSTP227]), 240 CLKDEV_CON_ID("icb0", &mstp_clks[MSTP227]),
254 CLKDEV_CON_ID("meram0", &mstp_clks[MSTP226]), 241 CLKDEV_CON_ID("meram0", &mstp_clks[MSTP226]),
255 CLKDEV_CON_ID("dacy1", &mstp_clks[MSTP224]), 242 CLKDEV_CON_ID("dacy1", &mstp_clks[MSTP224]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 9d23a36f064..c9a48088ad4 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -175,8 +175,6 @@ static struct clk mstp_clks[HWBLK_NR] = {
175 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_P], 0), 175 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_P], 0),
176}; 176};
177 177
178#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
179
180static struct clk_lookup lookups[] = { 178static struct clk_lookup lookups[] = {
181 /* main clocks */ 179 /* main clocks */
182 CLKDEV_CON_ID("rclk", &r_clk), 180 CLKDEV_CON_ID("rclk", &r_clk),
@@ -201,42 +199,20 @@ static struct clk_lookup lookups[] = {
201 /* MSTP clocks */ 199 /* MSTP clocks */
202 CLKDEV_CON_ID("uram0", &mstp_clks[HWBLK_URAM]), 200 CLKDEV_CON_ID("uram0", &mstp_clks[HWBLK_URAM]),
203 CLKDEV_CON_ID("xymem0", &mstp_clks[HWBLK_XYMEM]), 201 CLKDEV_CON_ID("xymem0", &mstp_clks[HWBLK_XYMEM]),
204 { 202
205 /* TMU0 */ 203 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU]),
206 .dev_id = "sh_tmu.0", 204 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU]),
207 .con_id = "tmu_fck", 205 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU]),
208 .clk = &mstp_clks[HWBLK_TMU], 206
209 }, {
210 /* TMU1 */
211 .dev_id = "sh_tmu.1",
212 .con_id = "tmu_fck",
213 .clk = &mstp_clks[HWBLK_TMU],
214 }, {
215 /* TMU2 */
216 .dev_id = "sh_tmu.2",
217 .con_id = "tmu_fck",
218 .clk = &mstp_clks[HWBLK_TMU],
219 },
220 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), 207 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
221 CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]), 208 CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]),
222 CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]), 209 CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]),
223 { 210
224 /* SCIF0 */ 211 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[HWBLK_SCIF0]),
225 .dev_id = "sh-sci.0", 212 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[HWBLK_SCIF1]),
226 .con_id = "sci_fck", 213 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[HWBLK_SCIF2]),
227 .clk = &mstp_clks[HWBLK_SCIF0], 214
228 }, { 215 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC]),
229 /* SCIF1 */
230 .dev_id = "sh-sci.1",
231 .con_id = "sci_fck",
232 .clk = &mstp_clks[HWBLK_SCIF1],
233 }, {
234 /* SCIF2 */
235 .dev_id = "sh-sci.2",
236 .con_id = "sci_fck",
237 .clk = &mstp_clks[HWBLK_SCIF2],
238 },
239 CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC]),
240 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), 216 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]),
241 CLKDEV_CON_ID("sdhi0", &mstp_clks[HWBLK_SDHI]), 217 CLKDEV_CON_ID("sdhi0", &mstp_clks[HWBLK_SDHI]),
242 CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]), 218 CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
index 55493cd5bd8..3cc3827380e 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
@@ -200,8 +200,6 @@ static struct clk mstp_clks[] = {
200 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0), 200 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0),
201}; 201};
202 202
203#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
204
205static struct clk_lookup lookups[] = { 203static struct clk_lookup lookups[] = {
206 /* main clocks */ 204 /* main clocks */
207 CLKDEV_CON_ID("rclk", &r_clk), 205 CLKDEV_CON_ID("rclk", &r_clk),
@@ -305,7 +303,7 @@ static struct clk_lookup lookups[] = {
305 CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]), 303 CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]),
306 CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]), 304 CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]),
307 CLKDEV_CON_ID("meram0", &mstp_clks[HWBLK_MERAM]), 305 CLKDEV_CON_ID("meram0", &mstp_clks[HWBLK_MERAM]),
308 CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC]), 306 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC]),
309 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), 307 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]),
310 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]), 308 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]),
311 CLKDEV_CON_ID("adc0", &mstp_clks[HWBLK_ADC]), 309 CLKDEV_CON_ID("adc0", &mstp_clks[HWBLK_ADC]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index d08fa953c88..8668f557e0a 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -252,8 +252,6 @@ static struct clk mstp_clks[HWBLK_NR] = {
252 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0), 252 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0),
253}; 253};
254 254
255#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
256
257static struct clk_lookup lookups[] = { 255static struct clk_lookup lookups[] = {
258 /* main clocks */ 256 /* main clocks */
259 CLKDEV_CON_ID("rclk", &r_clk), 257 CLKDEV_CON_ID("rclk", &r_clk),
@@ -289,77 +287,31 @@ static struct clk_lookup lookups[] = {
289 CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]), 287 CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]),
290 CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]), 288 CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]),
291 CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]), 289 CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]),
292 { 290
293 /* TMU0 */ 291 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU0]),
294 .dev_id = "sh_tmu.0", 292 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU0]),
295 .con_id = "tmu_fck", 293 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU0]),
296 .clk = &mstp_clks[HWBLK_TMU0], 294 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[HWBLK_TMU1]),
297 }, { 295
298 /* TMU1 */
299 .dev_id = "sh_tmu.1",
300 .con_id = "tmu_fck",
301 .clk = &mstp_clks[HWBLK_TMU0],
302 }, {
303 /* TMU2 */
304 .dev_id = "sh_tmu.2",
305 .con_id = "tmu_fck",
306 .clk = &mstp_clks[HWBLK_TMU0],
307 }, {
308 /* TMU3 */
309 .dev_id = "sh_tmu.3",
310 .con_id = "tmu_fck",
311 .clk = &mstp_clks[HWBLK_TMU1],
312 },
313 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), 296 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
314 CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]), 297 CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]),
315 CLKDEV_CON_ID("dmac1", &mstp_clks[HWBLK_DMAC1]), 298 CLKDEV_CON_ID("dmac1", &mstp_clks[HWBLK_DMAC1]),
316 { 299
317 /* TMU4 */ 300 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[HWBLK_TMU1]),
318 .dev_id = "sh_tmu.4", 301 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[HWBLK_TMU1]),
319 .con_id = "tmu_fck", 302 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[HWBLK_SCIF0]),
320 .clk = &mstp_clks[HWBLK_TMU1], 303 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[HWBLK_SCIF1]),
321 }, { 304 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[HWBLK_SCIF2]),
322 /* TMU5 */ 305 CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[HWBLK_SCIF3]),
323 .dev_id = "sh_tmu.5", 306 CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[HWBLK_SCIF4]),
324 .con_id = "tmu_fck", 307 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[HWBLK_SCIF5]),
325 .clk = &mstp_clks[HWBLK_TMU1], 308
326 }, {
327 /* SCIF0 */
328 .dev_id = "sh-sci.0",
329 .con_id = "sci_fck",
330 .clk = &mstp_clks[HWBLK_SCIF0],
331 }, {
332 /* SCIF1 */
333 .dev_id = "sh-sci.1",
334 .con_id = "sci_fck",
335 .clk = &mstp_clks[HWBLK_SCIF1],
336 }, {
337 /* SCIF2 */
338 .dev_id = "sh-sci.2",
339 .con_id = "sci_fck",
340 .clk = &mstp_clks[HWBLK_SCIF2],
341 }, {
342 /* SCIF3 */
343 .dev_id = "sh-sci.3",
344 .con_id = "sci_fck",
345 .clk = &mstp_clks[HWBLK_SCIF3],
346 }, {
347 /* SCIF4 */
348 .dev_id = "sh-sci.4",
349 .con_id = "sci_fck",
350 .clk = &mstp_clks[HWBLK_SCIF4],
351 }, {
352 /* SCIF5 */
353 .dev_id = "sh-sci.5",
354 .con_id = "sci_fck",
355 .clk = &mstp_clks[HWBLK_SCIF5],
356 },
357 CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]), 309 CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]),
358 CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]), 310 CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]),
359 CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]), 311 CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]),
360 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]), 312 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]),
361 CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC0]), 313 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC0]),
362 CLKDEV_CON_ID("i2c1", &mstp_clks[HWBLK_IIC1]), 314 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[HWBLK_IIC1]),
363 CLKDEV_CON_ID("mmc0", &mstp_clks[HWBLK_MMC]), 315 CLKDEV_CON_ID("mmc0", &mstp_clks[HWBLK_MMC]),
364 CLKDEV_CON_ID("eth0", &mstp_clks[HWBLK_ETHER]), 316 CLKDEV_CON_ID("eth0", &mstp_clks[HWBLK_ETHER]),
365 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]), 317 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
index eedddad1383..3b097b09a3b 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
@@ -101,8 +101,6 @@ static struct clk mstp_clks[MSTP_NR] = {
101 [MSTP220] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR2, 20, 0), 101 [MSTP220] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR2, 20, 0),
102}; 102};
103 103
104#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
105
106static struct clk_lookup lookups[] = { 104static struct clk_lookup lookups[] = {
107 /* main clocks */ 105 /* main clocks */
108 CLKDEV_CON_ID("extal", &extal_clk), 106 CLKDEV_CON_ID("extal", &extal_clk),
@@ -116,33 +114,13 @@ static struct clk_lookup lookups[] = {
116 /* MSTP32 clocks */ 114 /* MSTP32 clocks */
117 CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP004]), 115 CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP004]),
118 CLKDEV_CON_ID("riic", &mstp_clks[MSTP000]), 116 CLKDEV_CON_ID("riic", &mstp_clks[MSTP000]),
119 { 117
120 /* TMU0 */ 118 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP113]),
121 .dev_id = "sh_tmu.0", 119 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP114]),
122 .con_id = "tmu_fck", 120 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP112]),
123 .clk = &mstp_clks[MSTP113], 121 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP111]),
124 }, { 122 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP110]),
125 /* TMU1 */ 123
126 .dev_id = "sh_tmu.1",
127 .con_id = "tmu_fck",
128 .clk = &mstp_clks[MSTP114],
129 },
130 {
131 /* SCIF4 (But, ID is 2) */
132 .dev_id = "sh-sci.2",
133 .con_id = "sci_fck",
134 .clk = &mstp_clks[MSTP112],
135 }, {
136 /* SCIF3 */
137 .dev_id = "sh-sci.1",
138 .con_id = "sci_fck",
139 .clk = &mstp_clks[MSTP111],
140 }, {
141 /* SCIF2 */
142 .dev_id = "sh-sci.0",
143 .con_id = "sci_fck",
144 .clk = &mstp_clks[MSTP110],
145 },
146 CLKDEV_CON_ID("usb0", &mstp_clks[MSTP102]), 124 CLKDEV_CON_ID("usb0", &mstp_clks[MSTP102]),
147 CLKDEV_CON_ID("mmc0", &mstp_clks[MSTP220]), 125 CLKDEV_CON_ID("mmc0", &mstp_clks[MSTP220]),
148}; 126};
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
index 599630fc4d3..2d4c7fd79c0 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
@@ -91,8 +91,6 @@ static struct clk *sh7763_onchip_clocks[] = {
91 &sh7763_shyway_clk, 91 &sh7763_shyway_clk,
92}; 92};
93 93
94#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
95
96static struct clk_lookup lookups[] = { 94static struct clk_lookup lookups[] = {
97 /* main clocks */ 95 /* main clocks */
98 CLKDEV_CON_ID("shyway_clk", &sh7763_shyway_clk), 96 CLKDEV_CON_ID("shyway_clk", &sh7763_shyway_clk),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
index 8894926479a..3b53348fe2f 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
@@ -97,8 +97,6 @@ static struct clk *sh7780_onchip_clocks[] = {
97 &sh7780_shyway_clk, 97 &sh7780_shyway_clk,
98}; 98};
99 99
100#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
101
102static struct clk_lookup lookups[] = { 100static struct clk_lookup lookups[] = {
103 /* main clocks */ 101 /* main clocks */
104 CLKDEV_CON_ID("shyway_clk", &sh7780_shyway_clk), 102 CLKDEV_CON_ID("shyway_clk", &sh7780_shyway_clk),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
index 2d960247f3e..e5b420cc126 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
@@ -116,8 +116,6 @@ static struct clk mstp_clks[MSTP_NR] = {
116 [MSTP100] = SH_CLK_MSTP32(NULL, MSTPCR1, 0, 0), 116 [MSTP100] = SH_CLK_MSTP32(NULL, MSTPCR1, 0, 0),
117}; 117};
118 118
119#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
120
121static struct clk_lookup lookups[] = { 119static struct clk_lookup lookups[] = {
122 /* main clocks */ 120 /* main clocks */
123 CLKDEV_CON_ID("extal", &extal_clk), 121 CLKDEV_CON_ID("extal", &extal_clk),
@@ -134,74 +132,27 @@ static struct clk_lookup lookups[] = {
134 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), 132 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
135 133
136 /* MSTP32 clocks */ 134 /* MSTP32 clocks */
137 { 135 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP029]),
138 /* SCIF5 */ 136 CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP028]),
139 .dev_id = "sh-sci.5", 137 CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP027]),
140 .con_id = "sci_fck", 138 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP026]),
141 .clk = &mstp_clks[MSTP029], 139 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP025]),
142 }, { 140 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP024]),
143 /* SCIF4 */ 141
144 .dev_id = "sh-sci.4",
145 .con_id = "sci_fck",
146 .clk = &mstp_clks[MSTP028],
147 }, {
148 /* SCIF3 */
149 .dev_id = "sh-sci.3",
150 .con_id = "sci_fck",
151 .clk = &mstp_clks[MSTP027],
152 }, {
153 /* SCIF2 */
154 .dev_id = "sh-sci.2",
155 .con_id = "sci_fck",
156 .clk = &mstp_clks[MSTP026],
157 }, {
158 /* SCIF1 */
159 .dev_id = "sh-sci.1",
160 .con_id = "sci_fck",
161 .clk = &mstp_clks[MSTP025],
162 }, {
163 /* SCIF0 */
164 .dev_id = "sh-sci.0",
165 .con_id = "sci_fck",
166 .clk = &mstp_clks[MSTP024],
167 },
168 CLKDEV_CON_ID("ssi1_fck", &mstp_clks[MSTP021]), 142 CLKDEV_CON_ID("ssi1_fck", &mstp_clks[MSTP021]),
169 CLKDEV_CON_ID("ssi0_fck", &mstp_clks[MSTP020]), 143 CLKDEV_CON_ID("ssi0_fck", &mstp_clks[MSTP020]),
170 CLKDEV_CON_ID("hac1_fck", &mstp_clks[MSTP017]), 144 CLKDEV_CON_ID("hac1_fck", &mstp_clks[MSTP017]),
171 CLKDEV_CON_ID("hac0_fck", &mstp_clks[MSTP016]), 145 CLKDEV_CON_ID("hac0_fck", &mstp_clks[MSTP016]),
172 CLKDEV_CON_ID("mmcif_fck", &mstp_clks[MSTP013]), 146 CLKDEV_CON_ID("mmcif_fck", &mstp_clks[MSTP013]),
173 CLKDEV_CON_ID("flctl_fck", &mstp_clks[MSTP012]), 147 CLKDEV_CON_ID("flctl_fck", &mstp_clks[MSTP012]),
174 { 148
175 /* TMU0 */ 149 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]),
176 .dev_id = "sh_tmu.0", 150 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]),
177 .con_id = "tmu_fck", 151 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]),
178 .clk = &mstp_clks[MSTP008], 152 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]),
179 }, { 153 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
180 /* TMU1 */ 154 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
181 .dev_id = "sh_tmu.1", 155
182 .con_id = "tmu_fck",
183 .clk = &mstp_clks[MSTP008],
184 }, {
185 /* TMU2 */
186 .dev_id = "sh_tmu.2",
187 .con_id = "tmu_fck",
188 .clk = &mstp_clks[MSTP008],
189 }, {
190 /* TMU3 */
191 .dev_id = "sh_tmu.3",
192 .con_id = "tmu_fck",
193 .clk = &mstp_clks[MSTP009],
194 }, {
195 /* TMU4 */
196 .dev_id = "sh_tmu.4",
197 .con_id = "tmu_fck",
198 .clk = &mstp_clks[MSTP009],
199 }, {
200 /* TMU5 */
201 .dev_id = "sh_tmu.5",
202 .con_id = "tmu_fck",
203 .clk = &mstp_clks[MSTP009],
204 },
205 CLKDEV_CON_ID("siof_fck", &mstp_clks[MSTP003]), 156 CLKDEV_CON_ID("siof_fck", &mstp_clks[MSTP003]),
206 CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]), 157 CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]),
207 CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]), 158 CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
index 42e403be907..f6c0c3d5599 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
@@ -125,8 +125,6 @@ static struct clk mstp_clks[MSTP_NR] = {
125 [MSTP102] = SH_CLK_MSTP32(NULL, MSTPCR1, 2, 0), 125 [MSTP102] = SH_CLK_MSTP32(NULL, MSTPCR1, 2, 0),
126}; 126};
127 127
128#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
129
130static struct clk_lookup lookups[] = { 128static struct clk_lookup lookups[] = {
131 /* main clocks */ 129 /* main clocks */
132 CLKDEV_CON_ID("extal", &extal_clk), 130 CLKDEV_CON_ID("extal", &extal_clk),
@@ -141,37 +139,13 @@ static struct clk_lookup lookups[] = {
141 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), 139 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
142 140
143 /* MSTP32 clocks */ 141 /* MSTP32 clocks */
144 { 142 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP029]),
145 /* SCIF5 */ 143 CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP028]),
146 .dev_id = "sh-sci.5", 144 CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP027]),
147 .con_id = "sci_fck", 145 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP026]),
148 .clk = &mstp_clks[MSTP029], 146 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP025]),
149 }, { 147 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP024]),
150 /* SCIF4 */ 148
151 .dev_id = "sh-sci.4",
152 .con_id = "sci_fck",
153 .clk = &mstp_clks[MSTP028],
154 }, {
155 /* SCIF3 */
156 .dev_id = "sh-sci.3",
157 .con_id = "sci_fck",
158 .clk = &mstp_clks[MSTP027],
159 }, {
160 /* SCIF2 */
161 .dev_id = "sh-sci.2",
162 .con_id = "sci_fck",
163 .clk = &mstp_clks[MSTP026],
164 }, {
165 /* SCIF1 */
166 .dev_id = "sh-sci.1",
167 .con_id = "sci_fck",
168 .clk = &mstp_clks[MSTP025],
169 }, {
170 /* SCIF0 */
171 .dev_id = "sh-sci.0",
172 .con_id = "sci_fck",
173 .clk = &mstp_clks[MSTP024],
174 },
175 CLKDEV_CON_ID("ssi3_fck", &mstp_clks[MSTP023]), 149 CLKDEV_CON_ID("ssi3_fck", &mstp_clks[MSTP023]),
176 CLKDEV_CON_ID("ssi2_fck", &mstp_clks[MSTP022]), 150 CLKDEV_CON_ID("ssi2_fck", &mstp_clks[MSTP022]),
177 CLKDEV_CON_ID("ssi1_fck", &mstp_clks[MSTP021]), 151 CLKDEV_CON_ID("ssi1_fck", &mstp_clks[MSTP021]),
@@ -180,67 +154,20 @@ static struct clk_lookup lookups[] = {
180 CLKDEV_CON_ID("hac0_fck", &mstp_clks[MSTP016]), 154 CLKDEV_CON_ID("hac0_fck", &mstp_clks[MSTP016]),
181 CLKDEV_CON_ID("i2c1_fck", &mstp_clks[MSTP015]), 155 CLKDEV_CON_ID("i2c1_fck", &mstp_clks[MSTP015]),
182 CLKDEV_CON_ID("i2c0_fck", &mstp_clks[MSTP014]), 156 CLKDEV_CON_ID("i2c0_fck", &mstp_clks[MSTP014]),
183 { 157
184 /* TMU0 */ 158 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]),
185 .dev_id = "sh_tmu.0", 159 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]),
186 .con_id = "tmu_fck", 160 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]),
187 .clk = &mstp_clks[MSTP008], 161 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]),
188 }, { 162 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
189 /* TMU1 */ 163 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
190 .dev_id = "sh_tmu.1", 164 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.6", &mstp_clks[MSTP010]),
191 .con_id = "tmu_fck", 165 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.7", &mstp_clks[MSTP010]),
192 .clk = &mstp_clks[MSTP008], 166 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.8", &mstp_clks[MSTP010]),
193 }, { 167 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.9", &mstp_clks[MSTP011]),
194 /* TMU2 */ 168 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.10", &mstp_clks[MSTP011]),
195 .dev_id = "sh_tmu.2", 169 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.11", &mstp_clks[MSTP011]),
196 .con_id = "tmu_fck", 170
197 .clk = &mstp_clks[MSTP008],
198 }, {
199 /* TMU3 */
200 .dev_id = "sh_tmu.3",
201 .con_id = "tmu_fck",
202 .clk = &mstp_clks[MSTP009],
203 }, {
204 /* TMU4 */
205 .dev_id = "sh_tmu.4",
206 .con_id = "tmu_fck",
207 .clk = &mstp_clks[MSTP009],
208 }, {
209 /* TMU5 */
210 .dev_id = "sh_tmu.5",
211 .con_id = "tmu_fck",
212 .clk = &mstp_clks[MSTP009],
213 }, {
214 /* TMU6 */
215 .dev_id = "sh_tmu.6",
216 .con_id = "tmu_fck",
217 .clk = &mstp_clks[MSTP010],
218 }, {
219 /* TMU7 */
220 .dev_id = "sh_tmu.7",
221 .con_id = "tmu_fck",
222 .clk = &mstp_clks[MSTP010],
223 }, {
224 /* TMU8 */
225 .dev_id = "sh_tmu.8",
226 .con_id = "tmu_fck",
227 .clk = &mstp_clks[MSTP010],
228 }, {
229 /* TMU9 */
230 .dev_id = "sh_tmu.9",
231 .con_id = "tmu_fck",
232 .clk = &mstp_clks[MSTP011],
233 }, {
234 /* TMU10 */
235 .dev_id = "sh_tmu.10",
236 .con_id = "tmu_fck",
237 .clk = &mstp_clks[MSTP011],
238 }, {
239 /* TMU11 */
240 .dev_id = "sh_tmu.11",
241 .con_id = "tmu_fck",
242 .clk = &mstp_clks[MSTP011],
243 },
244 CLKDEV_CON_ID("sdif1_fck", &mstp_clks[MSTP005]), 171 CLKDEV_CON_ID("sdif1_fck", &mstp_clks[MSTP005]),
245 CLKDEV_CON_ID("sdif0_fck", &mstp_clks[MSTP004]), 172 CLKDEV_CON_ID("sdif0_fck", &mstp_clks[MSTP004]),
246 CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]), 173 CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-shx3.c b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
index 1afdb93b8cc..bf2d00b8b90 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
@@ -100,8 +100,6 @@ static struct clk mstp_clks[MSTP_NR] = {
100 [MSTP104] = SH_CLK_MSTP32(NULL, MSTPCR1, 4, 0), 100 [MSTP104] = SH_CLK_MSTP32(NULL, MSTPCR1, 4, 0),
101}; 101};
102 102
103#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
104
105static struct clk_lookup lookups[] = { 103static struct clk_lookup lookups[] = {
106 /* main clocks */ 104 /* main clocks */
107 CLKDEV_CON_ID("extal", &extal_clk), 105 CLKDEV_CON_ID("extal", &extal_clk),
@@ -116,62 +114,23 @@ static struct clk_lookup lookups[] = {
116 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), 114 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
117 115
118 /* MSTP32 clocks */ 116 /* MSTP32 clocks */
119 { 117 CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP027]),
120 /* SCIF3 */ 118 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP026]),
121 .dev_id = "sh-sci.3", 119 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP025]),
122 .con_id = "sci_fck", 120 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP024]),
123 .clk = &mstp_clks[MSTP027], 121
124 }, {
125 /* SCIF2 */
126 .dev_id = "sh-sci.2",
127 .con_id = "sci_fck",
128 .clk = &mstp_clks[MSTP026],
129 }, {
130 /* SCIF1 */
131 .dev_id = "sh-sci.1",
132 .con_id = "sci_fck",
133 .clk = &mstp_clks[MSTP025],
134 }, {
135 /* SCIF0 */
136 .dev_id = "sh-sci.0",
137 .con_id = "sci_fck",
138 .clk = &mstp_clks[MSTP024],
139 },
140 CLKDEV_CON_ID("h8ex_fck", &mstp_clks[MSTP003]), 122 CLKDEV_CON_ID("h8ex_fck", &mstp_clks[MSTP003]),
141 CLKDEV_CON_ID("csm_fck", &mstp_clks[MSTP002]), 123 CLKDEV_CON_ID("csm_fck", &mstp_clks[MSTP002]),
142 CLKDEV_CON_ID("fe1_fck", &mstp_clks[MSTP001]), 124 CLKDEV_CON_ID("fe1_fck", &mstp_clks[MSTP001]),
143 CLKDEV_CON_ID("fe0_fck", &mstp_clks[MSTP000]), 125 CLKDEV_CON_ID("fe0_fck", &mstp_clks[MSTP000]),
144 { 126
145 /* TMU0 */ 127 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]),
146 .dev_id = "sh_tmu.0", 128 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]),
147 .con_id = "tmu_fck", 129 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]),
148 .clk = &mstp_clks[MSTP008], 130 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]),
149 }, { 131 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
150 /* TMU1 */ 132 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
151 .dev_id = "sh_tmu.1", 133
152 .con_id = "tmu_fck",
153 .clk = &mstp_clks[MSTP008],
154 }, {
155 /* TMU2 */
156 .dev_id = "sh_tmu.2",
157 .con_id = "tmu_fck",
158 .clk = &mstp_clks[MSTP008],
159 }, {
160 /* TMU3 */
161 .dev_id = "sh_tmu.3",
162 .con_id = "tmu_fck",
163 .clk = &mstp_clks[MSTP009],
164 }, {
165 /* TMU4 */
166 .dev_id = "sh_tmu.4",
167 .con_id = "tmu_fck",
168 .clk = &mstp_clks[MSTP009],
169 }, {
170 /* TMU5 */
171 .dev_id = "sh_tmu.5",
172 .con_id = "tmu_fck",
173 .clk = &mstp_clks[MSTP009],
174 },
175 CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]), 134 CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]),
176 CLKDEV_CON_ID("dmac_11_6_fck", &mstp_clks[MSTP105]), 135 CLKDEV_CON_ID("dmac_11_6_fck", &mstp_clks[MSTP105]),
177 CLKDEV_CON_ID("dmac_5_0_fck", &mstp_clks[MSTP104]), 136 CLKDEV_CON_ID("dmac_5_0_fck", &mstp_clks[MSTP104]),
diff --git a/arch/sh/kernel/cpu/sh4a/serial-sh7722.c b/arch/sh/kernel/cpu/sh4a/serial-sh7722.c
new file mode 100644
index 00000000000..59bc3a72702
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/serial-sh7722.c
@@ -0,0 +1,23 @@
1#include <linux/serial_sci.h>
2#include <linux/serial_core.h>
3#include <linux/io.h>
4
5#define PSCR 0xA405011E
6
7static void sh7722_sci_init_pins(struct uart_port *port, unsigned int cflag)
8{
9 unsigned short data;
10
11 if (port->mapbase == 0xffe00000) {
12 data = __raw_readw(PSCR);
13 data &= ~0x03cf;
14 if (!(cflag & CRTSCTS))
15 data |= 0x0340;
16
17 __raw_writew(data, PSCR);
18 }
19}
20
21struct plat_sci_port_ops sh7722_sci_port_ops = {
22 .init_pins = sh7722_sci_init_pins,
23};
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index 82616af64d6..87773869a2f 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -20,6 +20,7 @@
20 20
21static struct plat_sci_port scif0_platform_data = { 21static struct plat_sci_port scif0_platform_data = {
22 .mapbase = 0xffe00000, 22 .mapbase = 0xffe00000,
23 .port_reg = 0xa405013e,
23 .flags = UPF_BOOT_AUTOCONF, 24 .flags = UPF_BOOT_AUTOCONF,
24 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 25 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
25 .scbrr_algo_id = SCBRR_ALGO_2, 26 .scbrr_algo_id = SCBRR_ALGO_2,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 5813d802361..278a0e57215 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -22,6 +22,7 @@
22 22
23#include <cpu/dma-register.h> 23#include <cpu/dma-register.h>
24#include <cpu/sh7722.h> 24#include <cpu/sh7722.h>
25#include <cpu/serial.h>
25 26
26static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = { 27static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
27 { 28 {
@@ -185,6 +186,8 @@ static struct plat_sci_port scif0_platform_data = {
185 .scbrr_algo_id = SCBRR_ALGO_2, 186 .scbrr_algo_id = SCBRR_ALGO_2,
186 .type = PORT_SCIF, 187 .type = PORT_SCIF,
187 .irqs = { 80, 80, 80, 80 }, 188 .irqs = { 80, 80, 80, 80 },
189 .ops = &sh7722_sci_port_ops,
190 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
188}; 191};
189 192
190static struct platform_device scif0_device = { 193static struct platform_device scif0_device = {
@@ -202,6 +205,8 @@ static struct plat_sci_port scif1_platform_data = {
202 .scbrr_algo_id = SCBRR_ALGO_2, 205 .scbrr_algo_id = SCBRR_ALGO_2,
203 .type = PORT_SCIF, 206 .type = PORT_SCIF,
204 .irqs = { 81, 81, 81, 81 }, 207 .irqs = { 81, 81, 81, 81 },
208 .ops = &sh7722_sci_port_ops,
209 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
205}; 210};
206 211
207static struct platform_device scif1_device = { 212static struct platform_device scif1_device = {
@@ -219,6 +224,8 @@ static struct plat_sci_port scif2_platform_data = {
219 .scbrr_algo_id = SCBRR_ALGO_2, 224 .scbrr_algo_id = SCBRR_ALGO_2,
220 .type = PORT_SCIF, 225 .type = PORT_SCIF,
221 .irqs = { 82, 82, 82, 82 }, 226 .irqs = { 82, 82, 82, 82 },
227 .ops = &sh7722_sci_port_ops,
228 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
222}; 229};
223 230
224static struct platform_device scif2_device = { 231static struct platform_device scif2_device = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index 072382280f9..3c2810d8f72 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -23,11 +23,13 @@
23/* Serial */ 23/* Serial */
24static struct plat_sci_port scif0_platform_data = { 24static struct plat_sci_port scif0_platform_data = {
25 .mapbase = 0xffe00000, 25 .mapbase = 0xffe00000,
26 .port_reg = 0xa4050160,
26 .flags = UPF_BOOT_AUTOCONF, 27 .flags = UPF_BOOT_AUTOCONF,
27 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 28 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
28 .scbrr_algo_id = SCBRR_ALGO_2, 29 .scbrr_algo_id = SCBRR_ALGO_2,
29 .type = PORT_SCIF, 30 .type = PORT_SCIF,
30 .irqs = { 80, 80, 80, 80 }, 31 .irqs = { 80, 80, 80, 80 },
32 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
31}; 33};
32 34
33static struct platform_device scif0_device = { 35static struct platform_device scif0_device = {
@@ -40,11 +42,13 @@ static struct platform_device scif0_device = {
40 42
41static struct plat_sci_port scif1_platform_data = { 43static struct plat_sci_port scif1_platform_data = {
42 .mapbase = 0xffe10000, 44 .mapbase = 0xffe10000,
45 .port_reg = SCIx_NOT_SUPPORTED,
43 .flags = UPF_BOOT_AUTOCONF, 46 .flags = UPF_BOOT_AUTOCONF,
44 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 47 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
45 .scbrr_algo_id = SCBRR_ALGO_2, 48 .scbrr_algo_id = SCBRR_ALGO_2,
46 .type = PORT_SCIF, 49 .type = PORT_SCIF,
47 .irqs = { 81, 81, 81, 81 }, 50 .irqs = { 81, 81, 81, 81 },
51 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
48}; 52};
49 53
50static struct platform_device scif1_device = { 54static struct platform_device scif1_device = {
@@ -57,11 +61,13 @@ static struct platform_device scif1_device = {
57 61
58static struct plat_sci_port scif2_platform_data = { 62static struct plat_sci_port scif2_platform_data = {
59 .mapbase = 0xffe20000, 63 .mapbase = 0xffe20000,
64 .port_reg = SCIx_NOT_SUPPORTED,
60 .flags = UPF_BOOT_AUTOCONF, 65 .flags = UPF_BOOT_AUTOCONF,
61 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 66 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
62 .scbrr_algo_id = SCBRR_ALGO_2, 67 .scbrr_algo_id = SCBRR_ALGO_2,
63 .type = PORT_SCIF, 68 .type = PORT_SCIF,
64 .irqs = { 82, 82, 82, 82 }, 69 .irqs = { 82, 82, 82, 82 },
70 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
65}; 71};
66 72
67static struct platform_device scif2_device = { 73static struct platform_device scif2_device = {
@@ -75,6 +81,7 @@ static struct platform_device scif2_device = {
75static struct plat_sci_port scif3_platform_data = { 81static struct plat_sci_port scif3_platform_data = {
76 .mapbase = 0xa4e30000, 82 .mapbase = 0xa4e30000,
77 .flags = UPF_BOOT_AUTOCONF, 83 .flags = UPF_BOOT_AUTOCONF,
84 .port_reg = SCIx_NOT_SUPPORTED,
78 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 85 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
79 .scbrr_algo_id = SCBRR_ALGO_3, 86 .scbrr_algo_id = SCBRR_ALGO_3,
80 .type = PORT_SCIFA, 87 .type = PORT_SCIFA,
@@ -91,6 +98,7 @@ static struct platform_device scif3_device = {
91 98
92static struct plat_sci_port scif4_platform_data = { 99static struct plat_sci_port scif4_platform_data = {
93 .mapbase = 0xa4e40000, 100 .mapbase = 0xa4e40000,
101 .port_reg = SCIx_NOT_SUPPORTED,
94 .flags = UPF_BOOT_AUTOCONF, 102 .flags = UPF_BOOT_AUTOCONF,
95 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 103 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
96 .scbrr_algo_id = SCBRR_ALGO_3, 104 .scbrr_algo_id = SCBRR_ALGO_3,
@@ -108,6 +116,7 @@ static struct platform_device scif4_device = {
108 116
109static struct plat_sci_port scif5_platform_data = { 117static struct plat_sci_port scif5_platform_data = {
110 .mapbase = 0xa4e50000, 118 .mapbase = 0xa4e50000,
119 .port_reg = SCIx_NOT_SUPPORTED,
111 .flags = UPF_BOOT_AUTOCONF, 120 .flags = UPF_BOOT_AUTOCONF,
112 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 121 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
113 .scbrr_algo_id = SCBRR_ALGO_3, 122 .scbrr_algo_id = SCBRR_ALGO_3,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index 134a397b191..a37dd72c367 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -296,11 +296,13 @@ static struct platform_device dma1_device = {
296/* Serial */ 296/* Serial */
297static struct plat_sci_port scif0_platform_data = { 297static struct plat_sci_port scif0_platform_data = {
298 .mapbase = 0xffe00000, 298 .mapbase = 0xffe00000,
299 .port_reg = SCIx_NOT_SUPPORTED,
299 .flags = UPF_BOOT_AUTOCONF, 300 .flags = UPF_BOOT_AUTOCONF,
300 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 301 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
301 .scbrr_algo_id = SCBRR_ALGO_2, 302 .scbrr_algo_id = SCBRR_ALGO_2,
302 .type = PORT_SCIF, 303 .type = PORT_SCIF,
303 .irqs = { 80, 80, 80, 80 }, 304 .irqs = { 80, 80, 80, 80 },
305 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
304}; 306};
305 307
306static struct platform_device scif0_device = { 308static struct platform_device scif0_device = {
@@ -313,11 +315,13 @@ static struct platform_device scif0_device = {
313 315
314static struct plat_sci_port scif1_platform_data = { 316static struct plat_sci_port scif1_platform_data = {
315 .mapbase = 0xffe10000, 317 .mapbase = 0xffe10000,
318 .port_reg = SCIx_NOT_SUPPORTED,
316 .flags = UPF_BOOT_AUTOCONF, 319 .flags = UPF_BOOT_AUTOCONF,
317 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 320 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
318 .scbrr_algo_id = SCBRR_ALGO_2, 321 .scbrr_algo_id = SCBRR_ALGO_2,
319 .type = PORT_SCIF, 322 .type = PORT_SCIF,
320 .irqs = { 81, 81, 81, 81 }, 323 .irqs = { 81, 81, 81, 81 },
324 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
321}; 325};
322 326
323static struct platform_device scif1_device = { 327static struct platform_device scif1_device = {
@@ -330,11 +334,13 @@ static struct platform_device scif1_device = {
330 334
331static struct plat_sci_port scif2_platform_data = { 335static struct plat_sci_port scif2_platform_data = {
332 .mapbase = 0xffe20000, 336 .mapbase = 0xffe20000,
337 .port_reg = SCIx_NOT_SUPPORTED,
333 .flags = UPF_BOOT_AUTOCONF, 338 .flags = UPF_BOOT_AUTOCONF,
334 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 339 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
335 .scbrr_algo_id = SCBRR_ALGO_2, 340 .scbrr_algo_id = SCBRR_ALGO_2,
336 .type = PORT_SCIF, 341 .type = PORT_SCIF,
337 .irqs = { 82, 82, 82, 82 }, 342 .irqs = { 82, 82, 82, 82 },
343 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
338}; 344};
339 345
340static struct platform_device scif2_device = { 346static struct platform_device scif2_device = {
@@ -347,6 +353,7 @@ static struct platform_device scif2_device = {
347 353
348static struct plat_sci_port scif3_platform_data = { 354static struct plat_sci_port scif3_platform_data = {
349 .mapbase = 0xa4e30000, 355 .mapbase = 0xa4e30000,
356 .port_reg = SCIx_NOT_SUPPORTED,
350 .flags = UPF_BOOT_AUTOCONF, 357 .flags = UPF_BOOT_AUTOCONF,
351 .scscr = SCSCR_RE | SCSCR_TE, 358 .scscr = SCSCR_RE | SCSCR_TE,
352 .scbrr_algo_id = SCBRR_ALGO_3, 359 .scbrr_algo_id = SCBRR_ALGO_3,
@@ -364,6 +371,7 @@ static struct platform_device scif3_device = {
364 371
365static struct plat_sci_port scif4_platform_data = { 372static struct plat_sci_port scif4_platform_data = {
366 .mapbase = 0xa4e40000, 373 .mapbase = 0xa4e40000,
374 .port_reg = SCIx_NOT_SUPPORTED,
367 .flags = UPF_BOOT_AUTOCONF, 375 .flags = UPF_BOOT_AUTOCONF,
368 .scscr = SCSCR_RE | SCSCR_TE, 376 .scscr = SCSCR_RE | SCSCR_TE,
369 .scbrr_algo_id = SCBRR_ALGO_3, 377 .scbrr_algo_id = SCBRR_ALGO_3,
@@ -381,6 +389,7 @@ static struct platform_device scif4_device = {
381 389
382static struct plat_sci_port scif5_platform_data = { 390static struct plat_sci_port scif5_platform_data = {
383 .mapbase = 0xa4e50000, 391 .mapbase = 0xa4e50000,
392 .port_reg = SCIx_NOT_SUPPORTED,
384 .flags = UPF_BOOT_AUTOCONF, 393 .flags = UPF_BOOT_AUTOCONF,
385 .scscr = SCSCR_RE | SCSCR_TE, 394 .scscr = SCSCR_RE | SCSCR_TE,
386 .scbrr_algo_id = SCBRR_ALGO_3, 395 .scbrr_algo_id = SCBRR_ALGO_3,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index e915deafac8..05559295d2c 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -15,6 +15,7 @@
15#include <linux/serial_sci.h> 15#include <linux/serial_sci.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/dma-mapping.h>
18#include <linux/sh_timer.h> 19#include <linux/sh_timer.h>
19#include <linux/sh_dma.h> 20#include <linux/sh_dma.h>
20 21
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
index 593eca6509b..00113515f23 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
@@ -23,6 +23,7 @@ static struct plat_sci_port scif0_platform_data = {
23 .scbrr_algo_id = SCBRR_ALGO_2, 23 .scbrr_algo_id = SCBRR_ALGO_2,
24 .type = PORT_SCIF, 24 .type = PORT_SCIF,
25 .irqs = { 40, 40, 40, 40 }, 25 .irqs = { 40, 40, 40, 40 },
26 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
26}; 27};
27 28
28static struct platform_device scif0_device = { 29static struct platform_device scif0_device = {
@@ -40,6 +41,7 @@ static struct plat_sci_port scif1_platform_data = {
40 .scbrr_algo_id = SCBRR_ALGO_2, 41 .scbrr_algo_id = SCBRR_ALGO_2,
41 .type = PORT_SCIF, 42 .type = PORT_SCIF,
42 .irqs = { 76, 76, 76, 76 }, 43 .irqs = { 76, 76, 76, 76 },
44 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
43}; 45};
44 46
45static struct platform_device scif1_device = { 47static struct platform_device scif1_device = {
@@ -57,6 +59,7 @@ static struct plat_sci_port scif2_platform_data = {
57 .scbrr_algo_id = SCBRR_ALGO_2, 59 .scbrr_algo_id = SCBRR_ALGO_2,
58 .type = PORT_SCIF, 60 .type = PORT_SCIF,
59 .irqs = { 104, 104, 104, 104 }, 61 .irqs = { 104, 104, 104, 104 },
62 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
60}; 63};
61 64
62static struct platform_device scif2_device = { 65static struct platform_device scif2_device = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
index 08add7fa684..3d4d2075c19 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
@@ -14,7 +14,6 @@
14#include <linux/serial_sci.h> 14#include <linux/serial_sci.h>
15#include <linux/sh_dma.h> 15#include <linux/sh_dma.h>
16#include <linux/sh_timer.h> 16#include <linux/sh_timer.h>
17
18#include <cpu/dma-register.h> 17#include <cpu/dma-register.h>
19 18
20static struct plat_sci_port scif0_platform_data = { 19static struct plat_sci_port scif0_platform_data = {
@@ -24,6 +23,7 @@ static struct plat_sci_port scif0_platform_data = {
24 .scbrr_algo_id = SCBRR_ALGO_1, 23 .scbrr_algo_id = SCBRR_ALGO_1,
25 .type = PORT_SCIF, 24 .type = PORT_SCIF,
26 .irqs = { 40, 40, 40, 40 }, 25 .irqs = { 40, 40, 40, 40 },
26 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
27}; 27};
28 28
29static struct platform_device scif0_device = { 29static struct platform_device scif0_device = {
@@ -41,6 +41,7 @@ static struct plat_sci_port scif1_platform_data = {
41 .scbrr_algo_id = SCBRR_ALGO_1, 41 .scbrr_algo_id = SCBRR_ALGO_1,
42 .type = PORT_SCIF, 42 .type = PORT_SCIF,
43 .irqs = { 76, 76, 76, 76 }, 43 .irqs = { 76, 76, 76, 76 },
44 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
44}; 45};
45 46
46static struct platform_device scif1_device = { 47static struct platform_device scif1_device = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
index 18d8fc136fb..b29e6340414 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
@@ -15,9 +15,7 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/sh_dma.h> 16#include <linux/sh_dma.h>
17#include <linux/sh_timer.h> 17#include <linux/sh_timer.h>
18
19#include <asm/mmzone.h> 18#include <asm/mmzone.h>
20
21#include <cpu/dma-register.h> 19#include <cpu/dma-register.h>
22 20
23static struct plat_sci_port scif0_platform_data = { 21static struct plat_sci_port scif0_platform_data = {
@@ -27,6 +25,7 @@ static struct plat_sci_port scif0_platform_data = {
27 .scbrr_algo_id = SCBRR_ALGO_1, 25 .scbrr_algo_id = SCBRR_ALGO_1,
28 .type = PORT_SCIF, 26 .type = PORT_SCIF,
29 .irqs = { 40, 40, 40, 40 }, 27 .irqs = { 40, 40, 40, 40 },
28 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
30}; 29};
31 30
32static struct platform_device scif0_device = { 31static struct platform_device scif0_device = {
@@ -44,6 +43,7 @@ static struct plat_sci_port scif1_platform_data = {
44 .scbrr_algo_id = SCBRR_ALGO_1, 43 .scbrr_algo_id = SCBRR_ALGO_1,
45 .type = PORT_SCIF, 44 .type = PORT_SCIF,
46 .irqs = { 44, 44, 44, 44 }, 45 .irqs = { 44, 44, 44, 44 },
46 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
47}; 47};
48 48
49static struct platform_device scif1_device = { 49static struct platform_device scif1_device = {
@@ -61,6 +61,7 @@ static struct plat_sci_port scif2_platform_data = {
61 .scbrr_algo_id = SCBRR_ALGO_1, 61 .scbrr_algo_id = SCBRR_ALGO_1,
62 .type = PORT_SCIF, 62 .type = PORT_SCIF,
63 .irqs = { 60, 60, 60, 60 }, 63 .irqs = { 60, 60, 60, 60 },
64 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
64}; 65};
65 66
66static struct platform_device scif2_device = { 67static struct platform_device scif2_device = {
@@ -78,6 +79,7 @@ static struct plat_sci_port scif3_platform_data = {
78 .scbrr_algo_id = SCBRR_ALGO_1, 79 .scbrr_algo_id = SCBRR_ALGO_1,
79 .type = PORT_SCIF, 80 .type = PORT_SCIF,
80 .irqs = { 61, 61, 61, 61 }, 81 .irqs = { 61, 61, 61, 61 },
82 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
81}; 83};
82 84
83static struct platform_device scif3_device = { 85static struct platform_device scif3_device = {
@@ -95,6 +97,7 @@ static struct plat_sci_port scif4_platform_data = {
95 .scbrr_algo_id = SCBRR_ALGO_1, 97 .scbrr_algo_id = SCBRR_ALGO_1,
96 .type = PORT_SCIF, 98 .type = PORT_SCIF,
97 .irqs = { 62, 62, 62, 62 }, 99 .irqs = { 62, 62, 62, 62 },
100 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
98}; 101};
99 102
100static struct platform_device scif4_device = { 103static struct platform_device scif4_device = {
@@ -112,6 +115,7 @@ static struct plat_sci_port scif5_platform_data = {
112 .scbrr_algo_id = SCBRR_ALGO_1, 115 .scbrr_algo_id = SCBRR_ALGO_1,
113 .type = PORT_SCIF, 116 .type = PORT_SCIF,
114 .irqs = { 63, 63, 63, 63 }, 117 .irqs = { 63, 63, 63, 63 },
118 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
115}; 119};
116 120
117static struct platform_device scif5_device = { 121static struct platform_device scif5_device = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index beba32beb6d..dd5e709f982 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SH7786 Setup 2 * SH7786 Setup
3 * 3 *
4 * Copyright (C) 2009 - 2010 Renesas Solutions Corp. 4 * Copyright (C) 2009 - 2011 Renesas Solutions Corp.
5 * Kuninori Morimoto <morimoto.kuninori@renesas.com> 5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
6 * Paul Mundt <paul.mundt@renesas.com> 6 * Paul Mundt <paul.mundt@renesas.com>
7 * 7 *
@@ -33,6 +33,7 @@ static struct plat_sci_port scif0_platform_data = {
33 .scbrr_algo_id = SCBRR_ALGO_1, 33 .scbrr_algo_id = SCBRR_ALGO_1,
34 .type = PORT_SCIF, 34 .type = PORT_SCIF,
35 .irqs = { 40, 41, 43, 42 }, 35 .irqs = { 40, 41, 43, 42 },
36 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
36}; 37};
37 38
38static struct platform_device scif0_device = { 39static struct platform_device scif0_device = {
@@ -53,6 +54,7 @@ static struct plat_sci_port scif1_platform_data = {
53 .scbrr_algo_id = SCBRR_ALGO_1, 54 .scbrr_algo_id = SCBRR_ALGO_1,
54 .type = PORT_SCIF, 55 .type = PORT_SCIF,
55 .irqs = { 44, 44, 44, 44 }, 56 .irqs = { 44, 44, 44, 44 },
57 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
56}; 58};
57 59
58static struct platform_device scif1_device = { 60static struct platform_device scif1_device = {
@@ -70,6 +72,7 @@ static struct plat_sci_port scif2_platform_data = {
70 .scbrr_algo_id = SCBRR_ALGO_1, 72 .scbrr_algo_id = SCBRR_ALGO_1,
71 .type = PORT_SCIF, 73 .type = PORT_SCIF,
72 .irqs = { 50, 50, 50, 50 }, 74 .irqs = { 50, 50, 50, 50 },
75 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
73}; 76};
74 77
75static struct platform_device scif2_device = { 78static struct platform_device scif2_device = {
@@ -87,6 +90,7 @@ static struct plat_sci_port scif3_platform_data = {
87 .scbrr_algo_id = SCBRR_ALGO_1, 90 .scbrr_algo_id = SCBRR_ALGO_1,
88 .type = PORT_SCIF, 91 .type = PORT_SCIF,
89 .irqs = { 51, 51, 51, 51 }, 92 .irqs = { 51, 51, 51, 51 },
93 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
90}; 94};
91 95
92static struct platform_device scif3_device = { 96static struct platform_device scif3_device = {
@@ -104,6 +108,7 @@ static struct plat_sci_port scif4_platform_data = {
104 .scbrr_algo_id = SCBRR_ALGO_1, 108 .scbrr_algo_id = SCBRR_ALGO_1,
105 .type = PORT_SCIF, 109 .type = PORT_SCIF,
106 .irqs = { 52, 52, 52, 52 }, 110 .irqs = { 52, 52, 52, 52 },
111 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
107}; 112};
108 113
109static struct platform_device scif4_device = { 114static struct platform_device scif4_device = {
@@ -121,6 +126,7 @@ static struct plat_sci_port scif5_platform_data = {
121 .scbrr_algo_id = SCBRR_ALGO_1, 126 .scbrr_algo_id = SCBRR_ALGO_1,
122 .type = PORT_SCIF, 127 .type = PORT_SCIF,
123 .irqs = { 53, 53, 53, 53 }, 128 .irqs = { 53, 53, 53, 53 },
129 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
124}; 130};
125 131
126static struct platform_device scif5_device = { 132static struct platform_device scif5_device = {
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
index 425d604e3a2..db4ecd731a0 100644
--- a/arch/sh/kernel/idle.c
+++ b/arch/sh/kernel/idle.c
@@ -16,12 +16,13 @@
16#include <linux/thread_info.h> 16#include <linux/thread_info.h>
17#include <linux/irqflags.h> 17#include <linux/irqflags.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/cpuidle.h>
19#include <asm/pgalloc.h> 20#include <asm/pgalloc.h>
20#include <asm/system.h> 21#include <asm/system.h>
21#include <asm/atomic.h> 22#include <linux/atomic.h>
22#include <asm/smp.h> 23#include <asm/smp.h>
23 24
24void (*pm_idle)(void) = NULL; 25void (*pm_idle)(void);
25 26
26static int hlt_counter; 27static int hlt_counter;
27 28
@@ -100,7 +101,8 @@ void cpu_idle(void)
100 local_irq_disable(); 101 local_irq_disable();
101 /* Don't trace irqs off for idle */ 102 /* Don't trace irqs off for idle */
102 stop_critical_timings(); 103 stop_critical_timings();
103 pm_idle(); 104 if (cpuidle_idle_call())
105 pm_idle();
104 /* 106 /*
105 * Sanity check to ensure that pm_idle() returns 107 * Sanity check to ensure that pm_idle() returns
106 * with IRQs enabled 108 * with IRQs enabled
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 6207561ea34..3147a9a6fb8 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -21,7 +21,7 @@
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25#include <asm/processor.h> 25#include <asm/processor.h>
26#include <asm/system.h> 26#include <asm/system.h>
27#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index 39b051de4c7..293e39c59c0 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -185,7 +185,7 @@ ENTRY(sys_call_table)
185 .long sys_ni_syscall /* vm86 */ 185 .long sys_ni_syscall /* vm86 */
186 .long sys_ni_syscall /* old "query_module" */ 186 .long sys_ni_syscall /* old "query_module" */
187 .long sys_poll 187 .long sys_poll
188 .long sys_nfsservctl 188 .long sys_ni_syscall /* was nfsservctl */
189 .long sys_setresgid16 /* 170 */ 189 .long sys_setresgid16 /* 170 */
190 .long sys_getresgid16 190 .long sys_getresgid16
191 .long sys_prctl 191 .long sys_prctl
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 089c4d825d0..ceb34b94afa 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -189,7 +189,7 @@ sys_call_table:
189 .long sys_ni_syscall /* vm86 */ 189 .long sys_ni_syscall /* vm86 */
190 .long sys_ni_syscall /* old "query_module" */ 190 .long sys_ni_syscall /* old "query_module" */
191 .long sys_poll 191 .long sys_poll
192 .long sys_nfsservctl 192 .long sys_ni_syscall /* was nfsservctl */
193 .long sys_setresgid16 /* 170 */ 193 .long sys_setresgid16 /* 170 */
194 .long sys_getresgid16 194 .long sys_getresgid16
195 .long sys_prctl 195 .long sys_prctl
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index d9006f8ffc1..7bbef95c9d1 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -316,6 +316,35 @@ static int handle_unaligned_ins(insn_size_t instruction, struct pt_regs *regs,
316 break; 316 break;
317 } 317 }
318 break; 318 break;
319
320 case 9: /* mov.w @(disp,PC),Rn */
321 srcu = (unsigned char __user *)regs->pc;
322 srcu += 4;
323 srcu += (instruction & 0x00FF) << 1;
324 dst = (unsigned char *)rn;
325 *(unsigned long *)dst = 0;
326
327#if !defined(__LITTLE_ENDIAN__)
328 dst += 2;
329#endif
330
331 if (ma->from(dst, srcu, 2))
332 goto fetch_fault;
333 sign_extend(2, dst);
334 ret = 0;
335 break;
336
337 case 0xd: /* mov.l @(disp,PC),Rn */
338 srcu = (unsigned char __user *)(regs->pc & ~0x3);
339 srcu += 4;
340 srcu += (instruction & 0x00FF) << 2;
341 dst = (unsigned char *)rn;
342 *(unsigned long *)dst = 0;
343
344 if (ma->from(dst, srcu, 4))
345 goto fetch_fault;
346 ret = 0;
347 break;
319 } 348 }
320 return ret; 349 return ret;
321 350
@@ -466,6 +495,7 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
466 case 0x0500: /* mov.w @(disp,Rm),R0 */ 495 case 0x0500: /* mov.w @(disp,Rm),R0 */
467 goto simple; 496 goto simple;
468 case 0x0B00: /* bf lab - no delayslot*/ 497 case 0x0B00: /* bf lab - no delayslot*/
498 ret = 0;
469 break; 499 break;
470 case 0x0F00: /* bf/s lab */ 500 case 0x0F00: /* bf/s lab */
471 ret = handle_delayslot(regs, instruction, ma); 501 ret = handle_delayslot(regs, instruction, ma);
@@ -479,6 +509,7 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
479 } 509 }
480 break; 510 break;
481 case 0x0900: /* bt lab - no delayslot */ 511 case 0x0900: /* bt lab - no delayslot */
512 ret = 0;
482 break; 513 break;
483 case 0x0D00: /* bt/s lab */ 514 case 0x0D00: /* bt/s lab */
484 ret = handle_delayslot(regs, instruction, ma); 515 ret = handle_delayslot(regs, instruction, ma);
@@ -494,6 +525,9 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
494 } 525 }
495 break; 526 break;
496 527
528 case 0x9000: /* mov.w @(disp,Rm),Rn */
529 goto simple;
530
497 case 0xA000: /* bra label */ 531 case 0xA000: /* bra label */
498 ret = handle_delayslot(regs, instruction, ma); 532 ret = handle_delayslot(regs, instruction, ma);
499 if (ret==0) 533 if (ret==0)
@@ -507,6 +541,9 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
507 regs->pc += SH_PC_12BIT_OFFSET(instruction); 541 regs->pc += SH_PC_12BIT_OFFSET(instruction);
508 } 542 }
509 break; 543 break;
544
545 case 0xD000: /* mov.l @(disp,Rm),Rn */
546 goto simple;
510 } 547 }
511 return ret; 548 return ret;
512 549
diff --git a/arch/sh/kernel/traps_64.c b/arch/sh/kernel/traps_64.c
index 67110be83fd..cd3a4048329 100644
--- a/arch/sh/kernel/traps_64.c
+++ b/arch/sh/kernel/traps_64.c
@@ -28,7 +28,7 @@
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/processor.h> 32#include <asm/processor.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34#include <asm/fpu.h> 34#include <asm/fpu.h>
diff --git a/arch/sh/kernel/unwinder.c b/arch/sh/kernel/unwinder.c
index 468889d958f..521b5432471 100644
--- a/arch/sh/kernel/unwinder.c
+++ b/arch/sh/kernel/unwinder.c
@@ -13,7 +13,7 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <asm/unwinder.h> 15#include <asm/unwinder.h>
16#include <asm/atomic.h> 16#include <linux/atomic.h>
17 17
18/* 18/*
19 * This is the most basic stack unwinder an architecture can 19 * This is the most basic stack unwinder an architecture can
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 1074dddcb10..1a6f20d4e7e 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -54,6 +54,8 @@ config SPARC64
54 select HAVE_PERF_EVENTS 54 select HAVE_PERF_EVENTS
55 select PERF_USE_VMALLOC 55 select PERF_USE_VMALLOC
56 select IRQ_PREFLOW_FASTEOI 56 select IRQ_PREFLOW_FASTEOI
57 select ARCH_HAVE_NMI_SAFE_CMPXCHG
58 select HAVE_C_RECORDMCOUNT
57 59
58config ARCH_DEFCONFIG 60config ARCH_DEFCONFIG
59 string 61 string
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 3c93f08ce18..2c2e38821f6 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -16,3 +16,8 @@ header-y += traps.h
16header-y += uctx.h 16header-y += uctx.h
17header-y += utrap.h 17header-y += utrap.h
18header-y += watchdog.h 18header-y += watchdog.h
19
20generic-y += div64.h
21generic-y += local64.h
22generic-y += irq_regs.h
23generic-y += local.h
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h
index 7ae128b19d3..5c3c8b69884 100644
--- a/arch/sparc/include/asm/atomic_32.h
+++ b/arch/sparc/include/asm/atomic_32.h
@@ -22,7 +22,7 @@
22extern int __atomic_add_return(int, atomic_t *); 22extern int __atomic_add_return(int, atomic_t *);
23extern int atomic_cmpxchg(atomic_t *, int, int); 23extern int atomic_cmpxchg(atomic_t *, int, int);
24#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 24#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
25extern int atomic_add_unless(atomic_t *, int, int); 25extern int __atomic_add_unless(atomic_t *, int, int);
26extern void atomic_set(atomic_t *, int); 26extern void atomic_set(atomic_t *, int);
27 27
28#define atomic_read(v) (*(volatile int *)&(v)->counter) 28#define atomic_read(v) (*(volatile int *)&(v)->counter)
@@ -52,7 +52,6 @@ extern void atomic_set(atomic_t *, int);
52#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) 52#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
53#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) 53#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
54 54
55#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
56 55
57/* This is the old 24-bit implementation. It's still used internally 56/* This is the old 24-bit implementation. It's still used internally
58 * by some sparc-specific code, notably the semaphore implementation. 57 * by some sparc-specific code, notably the semaphore implementation.
@@ -161,5 +160,4 @@ static inline int __atomic24_sub(int i, atomic24_t *v)
161 160
162#endif /* !(__KERNEL__) */ 161#endif /* !(__KERNEL__) */
163 162
164#include <asm-generic/atomic-long.h>
165#endif /* !(__ARCH_SPARC_ATOMIC__) */ 163#endif /* !(__ARCH_SPARC_ATOMIC__) */
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index bdb2ff880bd..9f421df46ae 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -70,7 +70,7 @@ extern long atomic64_sub_ret(long, atomic64_t *);
70#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) 70#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
71#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 71#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
72 72
73static inline int atomic_add_unless(atomic_t *v, int a, int u) 73static inline int __atomic_add_unless(atomic_t *v, int a, int u)
74{ 74{
75 int c, old; 75 int c, old;
76 c = atomic_read(v); 76 c = atomic_read(v);
@@ -82,10 +82,9 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
82 break; 82 break;
83 c = old; 83 c = old;
84 } 84 }
85 return c != (u); 85 return c;
86} 86}
87 87
88#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
89 88
90#define atomic64_cmpxchg(v, o, n) \ 89#define atomic64_cmpxchg(v, o, n) \
91 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n))) 90 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
@@ -114,5 +113,4 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
114#define smp_mb__before_atomic_inc() barrier() 113#define smp_mb__before_atomic_inc() barrier()
115#define smp_mb__after_atomic_inc() barrier() 114#define smp_mb__after_atomic_inc() barrier()
116 115
117#include <asm-generic/atomic-long.h>
118#endif /* !(__ARCH_SPARC64_ATOMIC__) */ 116#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index 38e9aa1b2ce..29011cc0e4b 100644
--- a/arch/sparc/include/asm/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
@@ -26,61 +26,28 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr);
26#define smp_mb__before_clear_bit() barrier() 26#define smp_mb__before_clear_bit() barrier()
27#define smp_mb__after_clear_bit() barrier() 27#define smp_mb__after_clear_bit() barrier()
28 28
29#include <asm-generic/bitops/ffz.h>
30#include <asm-generic/bitops/__ffs.h>
31#include <asm-generic/bitops/fls.h> 29#include <asm-generic/bitops/fls.h>
32#include <asm-generic/bitops/__fls.h> 30#include <asm-generic/bitops/__fls.h>
33#include <asm-generic/bitops/fls64.h> 31#include <asm-generic/bitops/fls64.h>
34 32
35#ifdef __KERNEL__ 33#ifdef __KERNEL__
36 34
35extern int ffs(int x);
36extern unsigned long __ffs(unsigned long);
37
38#include <asm-generic/bitops/ffz.h>
37#include <asm-generic/bitops/sched.h> 39#include <asm-generic/bitops/sched.h>
38#include <asm-generic/bitops/ffs.h>
39 40
40/* 41/*
41 * hweightN: returns the hamming weight (i.e. the number 42 * hweightN: returns the hamming weight (i.e. the number
42 * of bits set) of a N-bit word 43 * of bits set) of a N-bit word
43 */ 44 */
44 45
45#ifdef ULTRA_HAS_POPULATION_COUNT 46extern unsigned long __arch_hweight64(__u64 w);
46 47extern unsigned int __arch_hweight32(unsigned int w);
47static inline unsigned int __arch_hweight64(unsigned long w) 48extern unsigned int __arch_hweight16(unsigned int w);
48{ 49extern unsigned int __arch_hweight8(unsigned int w);
49 unsigned int res;
50
51 __asm__ ("popc %1,%0" : "=r" (res) : "r" (w));
52 return res;
53}
54
55static inline unsigned int __arch_hweight32(unsigned int w)
56{
57 unsigned int res;
58
59 __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff));
60 return res;
61}
62 50
63static inline unsigned int __arch_hweight16(unsigned int w)
64{
65 unsigned int res;
66
67 __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff));
68 return res;
69}
70
71static inline unsigned int __arch_hweight8(unsigned int w)
72{
73 unsigned int res;
74
75 __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xff));
76 return res;
77}
78
79#else
80
81#include <asm-generic/bitops/arch_hweight.h>
82
83#endif
84#include <asm-generic/bitops/const_hweight.h> 51#include <asm-generic/bitops/const_hweight.h>
85#include <asm-generic/bitops/lock.h> 52#include <asm-generic/bitops/lock.h>
86#endif /* __KERNEL__ */ 53#endif /* __KERNEL__ */
@@ -91,10 +58,7 @@ static inline unsigned int __arch_hweight8(unsigned int w)
91 58
92#include <asm-generic/bitops/le.h> 59#include <asm-generic/bitops/le.h>
93 60
94#define ext2_set_bit_atomic(lock,nr,addr) \ 61#include <asm-generic/bitops/ext2-atomic-setbit.h>
95 test_and_set_bit((nr) ^ 0x38,(unsigned long *)(addr))
96#define ext2_clear_bit_atomic(lock,nr,addr) \
97 test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr))
98 62
99#endif /* __KERNEL__ */ 63#endif /* __KERNEL__ */
100 64
diff --git a/arch/sparc/include/asm/div64.h b/arch/sparc/include/asm/div64.h
deleted file mode 100644
index 6cd978cefb2..00000000000
--- a/arch/sparc/include/asm/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index cfa9cd2e551..7df8b7f544d 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -59,15 +59,33 @@
59#define R_SPARC_6 45 59#define R_SPARC_6 45
60 60
61/* Bits present in AT_HWCAP, primarily for Sparc32. */ 61/* Bits present in AT_HWCAP, primarily for Sparc32. */
62 62#define HWCAP_SPARC_FLUSH 0x00000001
63#define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */ 63#define HWCAP_SPARC_STBAR 0x00000002
64#define HWCAP_SPARC_STBAR 2 64#define HWCAP_SPARC_SWAP 0x00000004
65#define HWCAP_SPARC_SWAP 4 65#define HWCAP_SPARC_MULDIV 0x00000008
66#define HWCAP_SPARC_MULDIV 8 66#define HWCAP_SPARC_V9 0x00000010
67#define HWCAP_SPARC_V9 16 67#define HWCAP_SPARC_ULTRA3 0x00000020
68#define HWCAP_SPARC_ULTRA3 32 68#define HWCAP_SPARC_BLKINIT 0x00000040
69#define HWCAP_SPARC_BLKINIT 64 69#define HWCAP_SPARC_N2 0x00000080
70#define HWCAP_SPARC_N2 128 70
71/* Solaris compatible AT_HWCAP bits. */
72#define AV_SPARC_MUL32 0x00000100 /* 32x32 multiply is efficient */
73#define AV_SPARC_DIV32 0x00000200 /* 32x32 divide is efficient */
74#define AV_SPARC_FSMULD 0x00000400 /* 'fsmuld' is efficient */
75#define AV_SPARC_V8PLUS 0x00000800 /* v9 insn available to 32bit */
76#define AV_SPARC_POPC 0x00001000 /* 'popc' is efficient */
77#define AV_SPARC_VIS 0x00002000 /* VIS insns available */
78#define AV_SPARC_VIS2 0x00004000 /* VIS2 insns available */
79#define AV_SPARC_ASI_BLK_INIT 0x00008000 /* block init ASIs available */
80#define AV_SPARC_FMAF 0x00010000 /* fused multiply-add */
81#define AV_SPARC_VIS3 0x00020000 /* VIS3 insns available */
82#define AV_SPARC_HPC 0x00040000 /* HPC insns available */
83#define AV_SPARC_RANDOM 0x00080000 /* 'random' insn available */
84#define AV_SPARC_TRANS 0x00100000 /* transaction insns available */
85#define AV_SPARC_FJFMAU 0x00200000 /* unfused multiply-add */
86#define AV_SPARC_IMA 0x00400000 /* integer multiply-add */
87#define AV_SPARC_ASI_CACHE_SPARING \
88 0x00800000 /* cache sparing ASIs available */
71 89
72#define CORE_DUMP_USE_REGSET 90#define CORE_DUMP_USE_REGSET
73 91
@@ -162,31 +180,8 @@ typedef struct {
162#define ELF_ET_DYN_BASE 0x0000010000000000UL 180#define ELF_ET_DYN_BASE 0x0000010000000000UL
163#define COMPAT_ELF_ET_DYN_BASE 0x0000000070000000UL 181#define COMPAT_ELF_ET_DYN_BASE 0x0000000070000000UL
164 182
165 183extern unsigned long sparc64_elf_hwcap;
166/* This yields a mask that user programs can use to figure out what 184#define ELF_HWCAP sparc64_elf_hwcap
167 instruction set this cpu supports. */
168
169/* On Ultra, we support all of the v8 capabilities. */
170static inline unsigned int sparc64_elf_hwcap(void)
171{
172 unsigned int cap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR |
173 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV |
174 HWCAP_SPARC_V9);
175
176 if (tlb_type == cheetah || tlb_type == cheetah_plus)
177 cap |= HWCAP_SPARC_ULTRA3;
178 else if (tlb_type == hypervisor) {
179 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
180 sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
181 cap |= HWCAP_SPARC_BLKINIT;
182 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
183 cap |= HWCAP_SPARC_N2;
184 }
185
186 return cap;
187}
188
189#define ELF_HWCAP sparc64_elf_hwcap()
190 185
191/* This yields a string that ld.so will use to load implementation 186/* This yields a string that ld.so will use to load implementation
192 specific libraries for optimization. This is more specific in 187 specific libraries for optimization. This is more specific in
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h
index 75686409be2..015a761eaa3 100644
--- a/arch/sparc/include/asm/hypervisor.h
+++ b/arch/sparc/include/asm/hypervisor.h
@@ -2927,6 +2927,13 @@ extern unsigned long sun4v_ncs_request(unsigned long request,
2927#define HV_FAST_FIRE_GET_PERFREG 0x120 2927#define HV_FAST_FIRE_GET_PERFREG 0x120
2928#define HV_FAST_FIRE_SET_PERFREG 0x121 2928#define HV_FAST_FIRE_SET_PERFREG 0x121
2929 2929
2930#define HV_FAST_REBOOT_DATA_SET 0x172
2931
2932#ifndef __ASSEMBLY__
2933extern unsigned long sun4v_reboot_data_set(unsigned long ra,
2934 unsigned long len);
2935#endif
2936
2930/* Function numbers for HV_CORE_TRAP. */ 2937/* Function numbers for HV_CORE_TRAP. */
2931#define HV_CORE_SET_VER 0x00 2938#define HV_CORE_SET_VER 0x00
2932#define HV_CORE_PUTCHAR 0x01 2939#define HV_CORE_PUTCHAR 0x01
@@ -2940,16 +2947,23 @@ extern unsigned long sun4v_ncs_request(unsigned long request,
2940#define HV_GRP_CORE 0x0001 2947#define HV_GRP_CORE 0x0001
2941#define HV_GRP_INTR 0x0002 2948#define HV_GRP_INTR 0x0002
2942#define HV_GRP_SOFT_STATE 0x0003 2949#define HV_GRP_SOFT_STATE 0x0003
2950#define HV_GRP_TM 0x0080
2943#define HV_GRP_PCI 0x0100 2951#define HV_GRP_PCI 0x0100
2944#define HV_GRP_LDOM 0x0101 2952#define HV_GRP_LDOM 0x0101
2945#define HV_GRP_SVC_CHAN 0x0102 2953#define HV_GRP_SVC_CHAN 0x0102
2946#define HV_GRP_NCS 0x0103 2954#define HV_GRP_NCS 0x0103
2947#define HV_GRP_RNG 0x0104 2955#define HV_GRP_RNG 0x0104
2956#define HV_GRP_PBOOT 0x0105
2957#define HV_GRP_TPM 0x0107
2958#define HV_GRP_SDIO 0x0108
2959#define HV_GRP_SDIO_ERR 0x0109
2960#define HV_GRP_REBOOT_DATA 0x0110
2948#define HV_GRP_NIAG_PERF 0x0200 2961#define HV_GRP_NIAG_PERF 0x0200
2949#define HV_GRP_FIRE_PERF 0x0201 2962#define HV_GRP_FIRE_PERF 0x0201
2950#define HV_GRP_N2_CPU 0x0202 2963#define HV_GRP_N2_CPU 0x0202
2951#define HV_GRP_NIU 0x0204 2964#define HV_GRP_NIU 0x0204
2952#define HV_GRP_VF_CPU 0x0205 2965#define HV_GRP_VF_CPU 0x0205
2966#define HV_GRP_KT_CPU 0x0209
2953#define HV_GRP_DIAG 0x0300 2967#define HV_GRP_DIAG 0x0300
2954 2968
2955#ifndef __ASSEMBLY__ 2969#ifndef __ASSEMBLY__
diff --git a/arch/sparc/include/asm/irq_regs.h b/arch/sparc/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b7027..00000000000
--- a/arch/sparc/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/sparc/include/asm/leon_pci.h b/arch/sparc/include/asm/leon_pci.h
index 42b4b31a82f..f48527ebdd8 100644
--- a/arch/sparc/include/asm/leon_pci.h
+++ b/arch/sparc/include/asm/leon_pci.h
@@ -12,7 +12,7 @@ struct leon_pci_info {
12 struct pci_ops *ops; 12 struct pci_ops *ops;
13 struct resource io_space; 13 struct resource io_space;
14 struct resource mem_space; 14 struct resource mem_space;
15 int (*map_irq)(struct pci_dev *dev, u8 slot, u8 pin); 15 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
16}; 16};
17 17
18extern void leon_pci_init(struct platform_device *ofdev, 18extern void leon_pci_init(struct platform_device *ofdev,
diff --git a/arch/sparc/include/asm/local.h b/arch/sparc/include/asm/local.h
deleted file mode 100644
index bc80815a435..00000000000
--- a/arch/sparc/include/asm/local.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _SPARC_LOCAL_H
2#define _SPARC_LOCAL_H
3
4#include <asm-generic/local.h>
5
6#endif
diff --git a/arch/sparc/include/asm/local64.h b/arch/sparc/include/asm/local64.h
deleted file mode 100644
index 36c93b5cc23..00000000000
--- a/arch/sparc/include/asm/local64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local64.h>
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 56bbaadef64..edd3d3cde46 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -21,7 +21,7 @@
21#include <linux/of_pdt.h> 21#include <linux/of_pdt.h>
22#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25 25
26#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2 26#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2
27#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 27#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
index b928b31424b..a0e1bcf843a 100644
--- a/arch/sparc/include/asm/ptrace.h
+++ b/arch/sparc/include/asm/ptrace.h
@@ -213,7 +213,6 @@ extern unsigned long profile_pc(struct pt_regs *);
213#else 213#else
214#define profile_pc(regs) instruction_pointer(regs) 214#define profile_pc(regs) instruction_pointer(regs)
215#endif 215#endif
216extern void show_regs(struct pt_regs *);
217#endif /* (__KERNEL__) */ 216#endif /* (__KERNEL__) */
218 217
219#else /* __ASSEMBLY__ */ 218#else /* __ASSEMBLY__ */
@@ -257,7 +256,6 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
257#define instruction_pointer(regs) ((regs)->pc) 256#define instruction_pointer(regs) ((regs)->pc)
258#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) 257#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
259unsigned long profile_pc(struct pt_regs *); 258unsigned long profile_pc(struct pt_regs *);
260extern void show_regs(struct pt_regs *);
261#endif /* (__KERNEL__) */ 259#endif /* (__KERNEL__) */
262 260
263#else /* (!__ASSEMBLY__) */ 261#else /* (!__ASSEMBLY__) */
diff --git a/arch/sparc/include/asm/sigcontext.h b/arch/sparc/include/asm/sigcontext.h
index a1607d18035..69914d74813 100644
--- a/arch/sparc/include/asm/sigcontext.h
+++ b/arch/sparc/include/asm/sigcontext.h
@@ -45,6 +45,19 @@ typedef struct {
45 int si_mask; 45 int si_mask;
46} __siginfo32_t; 46} __siginfo32_t;
47 47
48#define __SIGC_MAXWIN 7
49
50typedef struct {
51 unsigned long locals[8];
52 unsigned long ins[8];
53} __siginfo_reg_window;
54
55typedef struct {
56 int wsaved;
57 __siginfo_reg_window reg_window[__SIGC_MAXWIN];
58 unsigned long rwbuf_stkptrs[__SIGC_MAXWIN];
59} __siginfo_rwin_t;
60
48#ifdef CONFIG_SPARC64 61#ifdef CONFIG_SPARC64
49typedef struct { 62typedef struct {
50 unsigned int si_float_regs [64]; 63 unsigned int si_float_regs [64];
@@ -73,6 +86,7 @@ struct sigcontext {
73 unsigned long ss_size; 86 unsigned long ss_size;
74 } sigc_stack; 87 } sigc_stack;
75 unsigned long sigc_mask; 88 unsigned long sigc_mask;
89 __siginfo_rwin_t * sigc_rwin_save;
76}; 90};
77 91
78#else 92#else
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h
index 093f10843ff..01c51c70434 100644
--- a/arch/sparc/include/asm/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
@@ -22,7 +22,7 @@
22 22
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/asi.h> 24#include <asm/asi.h>
25#include <asm/atomic.h> 25#include <linux/atomic.h>
26 26
27/* 27/*
28 * Private routines/data 28 * Private routines/data
diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h
index 20bca895071..29862a9e906 100644
--- a/arch/sparc/include/asm/smp_64.h
+++ b/arch/sparc/include/asm/smp_64.h
@@ -27,7 +27,7 @@
27 */ 27 */
28 28
29#include <linux/bitops.h> 29#include <linux/bitops.h>
30#include <asm/atomic.h> 30#include <linux/atomic.h>
31#include <asm/percpu.h> 31#include <asm/percpu.h>
32 32
33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
diff --git a/arch/sparc/include/asm/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h
index 5f5b8bf3f50..bcc98fc3528 100644
--- a/arch/sparc/include/asm/spinlock_32.h
+++ b/arch/sparc/include/asm/spinlock_32.h
@@ -131,6 +131,15 @@ static inline void arch_write_lock(arch_rwlock_t *rw)
131 *(volatile __u32 *)&lp->lock = ~0U; 131 *(volatile __u32 *)&lp->lock = ~0U;
132} 132}
133 133
134static void inline arch_write_unlock(arch_rwlock_t *lock)
135{
136 __asm__ __volatile__(
137" st %%g0, [%0]"
138 : /* no outputs */
139 : "r" (lock)
140 : "memory");
141}
142
134static inline int arch_write_trylock(arch_rwlock_t *rw) 143static inline int arch_write_trylock(arch_rwlock_t *rw)
135{ 144{
136 unsigned int val; 145 unsigned int val;
@@ -175,8 +184,6 @@ static inline int __arch_read_trylock(arch_rwlock_t *rw)
175 res; \ 184 res; \
176}) 185})
177 186
178#define arch_write_unlock(rw) do { (rw)->lock = 0; } while(0)
179
180#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) 187#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
181#define arch_read_lock_flags(rw, flags) arch_read_lock(rw) 188#define arch_read_lock_flags(rw, flags) arch_read_lock(rw)
182#define arch_write_lock_flags(rw, flags) arch_write_lock(rw) 189#define arch_write_lock_flags(rw, flags) arch_write_lock(rw)
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index 073936a8b27..96891769497 100644
--- a/arch/sparc/include/asm/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
@@ -210,14 +210,8 @@ static int inline arch_write_trylock(arch_rwlock_t *lock)
210 return result; 210 return result;
211} 211}
212 212
213#define arch_read_lock(p) arch_read_lock(p)
214#define arch_read_lock_flags(p, f) arch_read_lock(p) 213#define arch_read_lock_flags(p, f) arch_read_lock(p)
215#define arch_read_trylock(p) arch_read_trylock(p)
216#define arch_read_unlock(p) arch_read_unlock(p)
217#define arch_write_lock(p) arch_write_lock(p)
218#define arch_write_lock_flags(p, f) arch_write_lock(p) 214#define arch_write_lock_flags(p, f) arch_write_lock(p)
219#define arch_write_unlock(p) arch_write_unlock(p)
220#define arch_write_trylock(p) arch_write_trylock(p)
221 215
222#define arch_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) 216#define arch_read_can_lock(rw) (!((rw)->lock & 0x80000000UL))
223#define arch_write_can_lock(rw) (!(rw)->lock) 217#define arch_write_can_lock(rw) (!(rw)->lock)
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index f0d0c40c44d..55a17c6efeb 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -42,6 +42,7 @@
42#define SUN4V_CHIP_INVALID 0x00 42#define SUN4V_CHIP_INVALID 0x00
43#define SUN4V_CHIP_NIAGARA1 0x01 43#define SUN4V_CHIP_NIAGARA1 0x01
44#define SUN4V_CHIP_NIAGARA2 0x02 44#define SUN4V_CHIP_NIAGARA2 0x02
45#define SUN4V_CHIP_NIAGARA3 0x03
45#define SUN4V_CHIP_UNKNOWN 0xff 46#define SUN4V_CHIP_UNKNOWN 0xff
46 47
47#ifndef __ASSEMBLY__ 48#ifndef __ASSEMBLY__
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index 83c571d8c8a..1a8afd1ad04 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -133,29 +133,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
133 sub TSB, 0x8, TSB; \ 133 sub TSB, 0x8, TSB; \
134 TSB_STORE(TSB, TAG); 134 TSB_STORE(TSB, TAG);
135 135
136#define KTSB_LOAD_QUAD(TSB, REG) \
137 ldda [TSB] ASI_NUCLEUS_QUAD_LDD, REG;
138
139#define KTSB_STORE(ADDR, VAL) \
140 stxa VAL, [ADDR] ASI_N;
141
142#define KTSB_LOCK_TAG(TSB, REG1, REG2) \
14399: lduwa [TSB] ASI_N, REG1; \
144 sethi %hi(TSB_TAG_LOCK_HIGH), REG2;\
145 andcc REG1, REG2, %g0; \
146 bne,pn %icc, 99b; \
147 nop; \
148 casa [TSB] ASI_N, REG1, REG2;\
149 cmp REG1, REG2; \
150 bne,pn %icc, 99b; \
151 nop; \
152
153#define KTSB_WRITE(TSB, TTE, TAG) \
154 add TSB, 0x8, TSB; \
155 stxa TTE, [TSB] ASI_N; \
156 sub TSB, 0x8, TSB; \
157 stxa TAG, [TSB] ASI_N;
158
159 /* Do a kernel page table walk. Leaves physical PTE pointer in 136 /* Do a kernel page table walk. Leaves physical PTE pointer in
160 * REG1. Jumps to FAIL_LABEL on early page table walk termination. 137 * REG1. Jumps to FAIL_LABEL on early page table walk termination.
161 * VADDR will not be clobbered, but REG2 will. 138 * VADDR will not be clobbered, but REG2 will.
@@ -239,6 +216,8 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
239 (KERNEL_TSB_SIZE_BYTES / 16) 216 (KERNEL_TSB_SIZE_BYTES / 16)
240#define KERNEL_TSB4M_NENTRIES 4096 217#define KERNEL_TSB4M_NENTRIES 4096
241 218
219#define KTSB_PHYS_SHIFT 15
220
242 /* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL 221 /* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL
243 * on TSB hit. REG1, REG2, REG3, and REG4 are used as temporaries 222 * on TSB hit. REG1, REG2, REG3, and REG4 are used as temporaries
244 * and the found TTE will be left in REG1. REG3 and REG4 must 223 * and the found TTE will be left in REG1. REG3 and REG4 must
@@ -247,13 +226,22 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
247 * VADDR and TAG will be preserved and not clobbered by this macro. 226 * VADDR and TAG will be preserved and not clobbered by this macro.
248 */ 227 */
249#define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ 228#define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
250 sethi %hi(swapper_tsb), REG1; \ 229661: sethi %hi(swapper_tsb), REG1; \
251 or REG1, %lo(swapper_tsb), REG1; \ 230 or REG1, %lo(swapper_tsb), REG1; \
231 .section .swapper_tsb_phys_patch, "ax"; \
232 .word 661b; \
233 .previous; \
234661: nop; \
235 .section .tsb_ldquad_phys_patch, "ax"; \
236 .word 661b; \
237 sllx REG1, KTSB_PHYS_SHIFT, REG1; \
238 sllx REG1, KTSB_PHYS_SHIFT, REG1; \
239 .previous; \
252 srlx VADDR, PAGE_SHIFT, REG2; \ 240 srlx VADDR, PAGE_SHIFT, REG2; \
253 and REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \ 241 and REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \
254 sllx REG2, 4, REG2; \ 242 sllx REG2, 4, REG2; \
255 add REG1, REG2, REG2; \ 243 add REG1, REG2, REG2; \
256 KTSB_LOAD_QUAD(REG2, REG3); \ 244 TSB_LOAD_QUAD(REG2, REG3); \
257 cmp REG3, TAG; \ 245 cmp REG3, TAG; \
258 be,a,pt %xcc, OK_LABEL; \ 246 be,a,pt %xcc, OK_LABEL; \
259 mov REG4, REG1; 247 mov REG4, REG1;
@@ -263,12 +251,21 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
263 * we can make use of that for the index computation. 251 * we can make use of that for the index computation.
264 */ 252 */
265#define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ 253#define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
266 sethi %hi(swapper_4m_tsb), REG1; \ 254661: sethi %hi(swapper_4m_tsb), REG1; \
267 or REG1, %lo(swapper_4m_tsb), REG1; \ 255 or REG1, %lo(swapper_4m_tsb), REG1; \
256 .section .swapper_4m_tsb_phys_patch, "ax"; \
257 .word 661b; \
258 .previous; \
259661: nop; \
260 .section .tsb_ldquad_phys_patch, "ax"; \
261 .word 661b; \
262 sllx REG1, KTSB_PHYS_SHIFT, REG1; \
263 sllx REG1, KTSB_PHYS_SHIFT, REG1; \
264 .previous; \
268 and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \ 265 and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
269 sllx REG2, 4, REG2; \ 266 sllx REG2, 4, REG2; \
270 add REG1, REG2, REG2; \ 267 add REG1, REG2, REG2; \
271 KTSB_LOAD_QUAD(REG2, REG3); \ 268 TSB_LOAD_QUAD(REG2, REG3); \
272 cmp REG3, TAG; \ 269 cmp REG3, TAG; \
273 be,a,pt %xcc, OK_LABEL; \ 270 be,a,pt %xcc, OK_LABEL; \
274 mov REG4, REG1; 271 mov REG4, REG1;
diff --git a/arch/sparc/include/asm/xor_64.h b/arch/sparc/include/asm/xor_64.h
index bee4bf4be3a..9ed6ff679ab 100644
--- a/arch/sparc/include/asm/xor_64.h
+++ b/arch/sparc/include/asm/xor_64.h
@@ -65,6 +65,7 @@ static struct xor_block_template xor_block_niagara = {
65#define XOR_SELECT_TEMPLATE(FASTEST) \ 65#define XOR_SELECT_TEMPLATE(FASTEST) \
66 ((tlb_type == hypervisor && \ 66 ((tlb_type == hypervisor && \
67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \ 67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2)) ? \ 68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \
69 sun4v_chip_type == SUN4V_CHIP_NIAGARA3)) ? \
69 &xor_block_niagara : \ 70 &xor_block_niagara : \
70 &xor_block_VIS) 71 &xor_block_VIS)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index b90b4a1d070..cb85458f89d 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_SPARC32) += sun4m_irq.o sun4c_irq.o sun4d_irq.o
32 32
33obj-y += process_$(BITS).o 33obj-y += process_$(BITS).o
34obj-y += signal_$(BITS).o 34obj-y += signal_$(BITS).o
35obj-y += sigutil_$(BITS).o
35obj-$(CONFIG_SPARC32) += ioport.o 36obj-$(CONFIG_SPARC32) += ioport.o
36obj-y += setup_$(BITS).o 37obj-y += setup_$(BITS).o
37obj-y += idprom.o 38obj-y += idprom.o
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 138dbbc8dc8..9810fd88105 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -396,6 +396,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
396 , cpu_data(0).clock_tick 396 , cpu_data(0).clock_tick
397#endif 397#endif
398 ); 398 );
399 cpucap_info(m);
399#ifdef CONFIG_SMP 400#ifdef CONFIG_SMP
400 smp_bogo(m); 401 smp_bogo(m);
401#endif 402#endif
@@ -474,11 +475,18 @@ static void __init sun4v_cpu_probe(void)
474 sparc_pmu_type = "niagara2"; 475 sparc_pmu_type = "niagara2";
475 break; 476 break;
476 477
478 case SUN4V_CHIP_NIAGARA3:
479 sparc_cpu_type = "UltraSparc T3 (Niagara3)";
480 sparc_fpu_type = "UltraSparc T3 integrated FPU";
481 sparc_pmu_type = "niagara3";
482 break;
483
477 default: 484 default:
478 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", 485 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
479 prom_cpu_compatible); 486 prom_cpu_compatible);
480 sparc_cpu_type = "Unknown SUN4V CPU"; 487 sparc_cpu_type = "Unknown SUN4V CPU";
481 sparc_fpu_type = "Unknown SUN4V FPU"; 488 sparc_fpu_type = "Unknown SUN4V FPU";
489 sparc_pmu_type = "Unknown SUN4V PMU";
482 break; 490 break;
483 } 491 }
484} 492}
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index d91fd782743..4197e8d62d4 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -324,6 +324,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
324 switch (sun4v_chip_type) { 324 switch (sun4v_chip_type) {
325 case SUN4V_CHIP_NIAGARA1: 325 case SUN4V_CHIP_NIAGARA1:
326 case SUN4V_CHIP_NIAGARA2: 326 case SUN4V_CHIP_NIAGARA2:
327 case SUN4V_CHIP_NIAGARA3:
327 rover_inc_table = niagara_iterate_method; 328 rover_inc_table = niagara_iterate_method;
328 break; 329 break;
329 default: 330 default:
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index dd1342c0a3b..7429b47c3ac 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -15,12 +15,15 @@
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16#include <linux/cpu.h> 16#include <linux/cpu.h>
17 17
18#include <asm/hypervisor.h>
18#include <asm/ldc.h> 19#include <asm/ldc.h>
19#include <asm/vio.h> 20#include <asm/vio.h>
20#include <asm/mdesc.h> 21#include <asm/mdesc.h>
21#include <asm/head.h> 22#include <asm/head.h>
22#include <asm/irq.h> 23#include <asm/irq.h>
23 24
25#include "kernel.h"
26
24#define DRV_MODULE_NAME "ds" 27#define DRV_MODULE_NAME "ds"
25#define PFX DRV_MODULE_NAME ": " 28#define PFX DRV_MODULE_NAME ": "
26#define DRV_MODULE_VERSION "1.0" 29#define DRV_MODULE_VERSION "1.0"
@@ -828,18 +831,32 @@ void ldom_set_var(const char *var, const char *value)
828 } 831 }
829} 832}
830 833
834static char full_boot_str[256] __attribute__((aligned(32)));
835static int reboot_data_supported;
836
831void ldom_reboot(const char *boot_command) 837void ldom_reboot(const char *boot_command)
832{ 838{
833 /* Don't bother with any of this if the boot_command 839 /* Don't bother with any of this if the boot_command
834 * is empty. 840 * is empty.
835 */ 841 */
836 if (boot_command && strlen(boot_command)) { 842 if (boot_command && strlen(boot_command)) {
837 char full_boot_str[256]; 843 unsigned long len;
838 844
839 strcpy(full_boot_str, "boot "); 845 strcpy(full_boot_str, "boot ");
840 strcpy(full_boot_str + strlen("boot "), boot_command); 846 strcpy(full_boot_str + strlen("boot "), boot_command);
847 len = strlen(full_boot_str);
841 848
842 ldom_set_var("reboot-command", full_boot_str); 849 if (reboot_data_supported) {
850 unsigned long ra = kimage_addr_to_ra(full_boot_str);
851 unsigned long hv_ret;
852
853 hv_ret = sun4v_reboot_data_set(ra, len);
854 if (hv_ret != HV_EOK)
855 pr_err("SUN4V: Unable to set reboot data "
856 "hv_ret=%lu\n", hv_ret);
857 } else {
858 ldom_set_var("reboot-command", full_boot_str);
859 }
843 } 860 }
844 sun4v_mach_sir(); 861 sun4v_mach_sir();
845} 862}
@@ -1237,6 +1254,16 @@ static struct vio_driver ds_driver = {
1237 1254
1238static int __init ds_init(void) 1255static int __init ds_init(void)
1239{ 1256{
1257 unsigned long hv_ret, major, minor;
1258
1259 if (tlb_type == hypervisor) {
1260 hv_ret = sun4v_get_version(HV_GRP_REBOOT_DATA, &major, &minor);
1261 if (hv_ret == HV_EOK) {
1262 pr_info("SUN4V: Reboot data supported (maj=%lu,min=%lu).\n",
1263 major, minor);
1264 reboot_data_supported = 1;
1265 }
1266 }
1240 kthread_run(ds_thread, NULL, "kldomd"); 1267 kthread_run(ds_thread, NULL, "kldomd");
1241 1268
1242 return vio_register_driver(&ds_driver); 1269 return vio_register_driver(&ds_driver);
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index d1f1361c416..e27f8ea8656 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -42,6 +42,20 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
42extern void fpload(unsigned long *fpregs, unsigned long *fsr); 42extern void fpload(unsigned long *fpregs, unsigned long *fsr);
43 43
44#else /* CONFIG_SPARC32 */ 44#else /* CONFIG_SPARC32 */
45struct popc_3insn_patch_entry {
46 unsigned int addr;
47 unsigned int insns[3];
48};
49extern struct popc_3insn_patch_entry __popc_3insn_patch,
50 __popc_3insn_patch_end;
51
52struct popc_6insn_patch_entry {
53 unsigned int addr;
54 unsigned int insns[6];
55};
56extern struct popc_6insn_patch_entry __popc_6insn_patch,
57 __popc_6insn_patch_end;
58
45extern void __init per_cpu_patch(void); 59extern void __init per_cpu_patch(void);
46extern void __init sun4v_patch(void); 60extern void __init sun4v_patch(void);
47extern void __init boot_cpu_id_too_large(int cpu); 61extern void __init boot_cpu_id_too_large(int cpu);
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index aa594c792d1..0eac1b2fc53 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -132,6 +132,8 @@ prom_sun4v_name:
132 .asciz "sun4v" 132 .asciz "sun4v"
133prom_niagara_prefix: 133prom_niagara_prefix:
134 .asciz "SUNW,UltraSPARC-T" 134 .asciz "SUNW,UltraSPARC-T"
135prom_sparc_prefix:
136 .asciz "SPARC-T"
135 .align 4 137 .align 4
136prom_root_compatible: 138prom_root_compatible:
137 .skip 64 139 .skip 64
@@ -382,6 +384,22 @@ sun4v_chip_type:
38290: ldub [%g7], %g2 38490: ldub [%g7], %g2
383 ldub [%g1], %g4 385 ldub [%g1], %g4
384 cmp %g2, %g4 386 cmp %g2, %g4
387 bne,pn %icc, 89f
388 add %g7, 1, %g7
389 subcc %g3, 1, %g3
390 bne,pt %xcc, 90b
391 add %g1, 1, %g1
392 ba,pt %xcc, 91f
393 nop
394
39589: sethi %hi(prom_cpu_compatible), %g1
396 or %g1, %lo(prom_cpu_compatible), %g1
397 sethi %hi(prom_sparc_prefix), %g7
398 or %g7, %lo(prom_sparc_prefix), %g7
399 mov 7, %g3
40090: ldub [%g7], %g2
401 ldub [%g1], %g4
402 cmp %g2, %g4
385 bne,pn %icc, 4f 403 bne,pn %icc, 4f
386 add %g7, 1, %g7 404 add %g7, 1, %g7
387 subcc %g3, 1, %g3 405 subcc %g3, 1, %g3
@@ -390,6 +408,15 @@ sun4v_chip_type:
390 408
391 sethi %hi(prom_cpu_compatible), %g1 409 sethi %hi(prom_cpu_compatible), %g1
392 or %g1, %lo(prom_cpu_compatible), %g1 410 or %g1, %lo(prom_cpu_compatible), %g1
411 ldub [%g1 + 7], %g2
412 cmp %g2, '3'
413 be,pt %xcc, 5f
414 mov SUN4V_CHIP_NIAGARA3, %g4
415 ba,pt %xcc, 4f
416 nop
417
41891: sethi %hi(prom_cpu_compatible), %g1
419 or %g1, %lo(prom_cpu_compatible), %g1
393 ldub [%g1 + 17], %g2 420 ldub [%g1 + 17], %g2
394 cmp %g2, '1' 421 cmp %g2, '1'
395 be,pt %xcc, 5f 422 be,pt %xcc, 5f
@@ -397,6 +424,7 @@ sun4v_chip_type:
397 cmp %g2, '2' 424 cmp %g2, '2'
398 be,pt %xcc, 5f 425 be,pt %xcc, 5f
399 mov SUN4V_CHIP_NIAGARA2, %g4 426 mov SUN4V_CHIP_NIAGARA2, %g4
427
4004: 4284:
401 mov SUN4V_CHIP_UNKNOWN, %g4 429 mov SUN4V_CHIP_UNKNOWN, %g4
4025: sethi %hi(sun4v_chip_type), %g2 4305: sethi %hi(sun4v_chip_type), %g2
@@ -514,6 +542,9 @@ niagara_tlb_fixup:
514 cmp %g1, SUN4V_CHIP_NIAGARA2 542 cmp %g1, SUN4V_CHIP_NIAGARA2
515 be,pt %xcc, niagara2_patch 543 be,pt %xcc, niagara2_patch
516 nop 544 nop
545 cmp %g1, SUN4V_CHIP_NIAGARA3
546 be,pt %xcc, niagara2_patch
547 nop
517 548
518 call generic_patch_copyops 549 call generic_patch_copyops
519 nop 550 nop
@@ -528,7 +559,7 @@ niagara2_patch:
528 nop 559 nop
529 call niagara_patch_bzero 560 call niagara_patch_bzero
530 nop 561 nop
531 call niagara2_patch_pageops 562 call niagara_patch_pageops
532 nop 563 nop
533 564
534 ba,a,pt %xcc, 80f 565 ba,a,pt %xcc, 80f
diff --git a/arch/sparc/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c
index 7c60afb835b..c2d055d8ba9 100644
--- a/arch/sparc/kernel/hvapi.c
+++ b/arch/sparc/kernel/hvapi.c
@@ -28,16 +28,23 @@ static struct api_info api_table[] = {
28 { .group = HV_GRP_CORE, .flags = FLAG_PRE_API }, 28 { .group = HV_GRP_CORE, .flags = FLAG_PRE_API },
29 { .group = HV_GRP_INTR, }, 29 { .group = HV_GRP_INTR, },
30 { .group = HV_GRP_SOFT_STATE, }, 30 { .group = HV_GRP_SOFT_STATE, },
31 { .group = HV_GRP_TM, },
31 { .group = HV_GRP_PCI, .flags = FLAG_PRE_API }, 32 { .group = HV_GRP_PCI, .flags = FLAG_PRE_API },
32 { .group = HV_GRP_LDOM, }, 33 { .group = HV_GRP_LDOM, },
33 { .group = HV_GRP_SVC_CHAN, .flags = FLAG_PRE_API }, 34 { .group = HV_GRP_SVC_CHAN, .flags = FLAG_PRE_API },
34 { .group = HV_GRP_NCS, .flags = FLAG_PRE_API }, 35 { .group = HV_GRP_NCS, .flags = FLAG_PRE_API },
35 { .group = HV_GRP_RNG, }, 36 { .group = HV_GRP_RNG, },
37 { .group = HV_GRP_PBOOT, },
38 { .group = HV_GRP_TPM, },
39 { .group = HV_GRP_SDIO, },
40 { .group = HV_GRP_SDIO_ERR, },
41 { .group = HV_GRP_REBOOT_DATA, },
36 { .group = HV_GRP_NIAG_PERF, .flags = FLAG_PRE_API }, 42 { .group = HV_GRP_NIAG_PERF, .flags = FLAG_PRE_API },
37 { .group = HV_GRP_FIRE_PERF, }, 43 { .group = HV_GRP_FIRE_PERF, },
38 { .group = HV_GRP_N2_CPU, }, 44 { .group = HV_GRP_N2_CPU, },
39 { .group = HV_GRP_NIU, }, 45 { .group = HV_GRP_NIU, },
40 { .group = HV_GRP_VF_CPU, }, 46 { .group = HV_GRP_VF_CPU, },
47 { .group = HV_GRP_KT_CPU, },
41 { .group = HV_GRP_DIAG, .flags = FLAG_PRE_API }, 48 { .group = HV_GRP_DIAG, .flags = FLAG_PRE_API },
42}; 49};
43 50
diff --git a/arch/sparc/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S
index 8a5f35ffb15..58d60de4d65 100644
--- a/arch/sparc/kernel/hvcalls.S
+++ b/arch/sparc/kernel/hvcalls.S
@@ -798,3 +798,10 @@ ENTRY(sun4v_niagara2_setperf)
798 retl 798 retl
799 nop 799 nop
800ENDPROC(sun4v_niagara2_setperf) 800ENDPROC(sun4v_niagara2_setperf)
801
802ENTRY(sun4v_reboot_data_set)
803 mov HV_FAST_REBOOT_DATA_SET, %o5
804 ta HV_FAST_TRAP
805 retl
806 nop
807ENDPROC(sun4v_reboot_data_set)
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 6ffccd6e015..d0479e2163f 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -65,9 +65,6 @@ static inline void dma_make_coherent(unsigned long pa, unsigned long len)
65} 65}
66#endif 66#endif
67 67
68static struct resource *_sparc_find_resource(struct resource *r,
69 unsigned long);
70
71static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz); 68static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
72static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, 69static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
73 unsigned long size, char *name); 70 unsigned long size, char *name);
@@ -143,7 +140,11 @@ void iounmap(volatile void __iomem *virtual)
143 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK; 140 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK;
144 struct resource *res; 141 struct resource *res;
145 142
146 if ((res = _sparc_find_resource(&sparc_iomap, vaddr)) == NULL) { 143 /*
144 * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
145 * This probably warrants some sort of hashing.
146 */
147 if ((res = lookup_resource(&sparc_iomap, vaddr)) == NULL) {
147 printk("free_io/iounmap: cannot free %lx\n", vaddr); 148 printk("free_io/iounmap: cannot free %lx\n", vaddr);
148 return; 149 return;
149 } 150 }
@@ -319,7 +320,7 @@ static void sbus_free_coherent(struct device *dev, size_t n, void *p,
319 struct resource *res; 320 struct resource *res;
320 struct page *pgv; 321 struct page *pgv;
321 322
322 if ((res = _sparc_find_resource(&_sparc_dvma, 323 if ((res = lookup_resource(&_sparc_dvma,
323 (unsigned long)p)) == NULL) { 324 (unsigned long)p)) == NULL) {
324 printk("sbus_free_consistent: cannot free %p\n", p); 325 printk("sbus_free_consistent: cannot free %p\n", p);
325 return; 326 return;
@@ -492,7 +493,7 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
492{ 493{
493 struct resource *res; 494 struct resource *res;
494 495
495 if ((res = _sparc_find_resource(&_sparc_dvma, 496 if ((res = lookup_resource(&_sparc_dvma,
496 (unsigned long)p)) == NULL) { 497 (unsigned long)p)) == NULL) {
497 printk("pci_free_consistent: cannot free %p\n", p); 498 printk("pci_free_consistent: cannot free %p\n", p);
498 return; 499 return;
@@ -715,25 +716,6 @@ static const struct file_operations sparc_io_proc_fops = {
715}; 716};
716#endif /* CONFIG_PROC_FS */ 717#endif /* CONFIG_PROC_FS */
717 718
718/*
719 * This is a version of find_resource and it belongs to kernel/resource.c.
720 * Until we have agreement with Linus and Martin, it lingers here.
721 *
722 * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
723 * This probably warrants some sort of hashing.
724 */
725static struct resource *_sparc_find_resource(struct resource *root,
726 unsigned long hit)
727{
728 struct resource *tmp;
729
730 for (tmp = root->child; tmp != 0; tmp = tmp->sibling) {
731 if (tmp->start <= hit && tmp->end >= hit)
732 return tmp;
733 }
734 return NULL;
735}
736
737static void register_proc_sparc_ioport(void) 719static void register_proc_sparc_ioport(void)
738{ 720{
739#ifdef CONFIG_PROC_FS 721#ifdef CONFIG_PROC_FS
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h
index 100b9c204e7..42851122bbd 100644
--- a/arch/sparc/kernel/irq.h
+++ b/arch/sparc/kernel/irq.h
@@ -88,7 +88,7 @@ BTFIXUPDEF_CALL(void, set_irq_udt, int)
88#define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu) 88#define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu)
89 89
90/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ 90/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
91#define SUN4D_IPI_IRQ 14 91#define SUN4D_IPI_IRQ 13
92 92
93extern void sun4d_ipi_interrupt(void); 93extern void sun4d_ipi_interrupt(void);
94 94
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index 4e78862d12f..0dd8422a469 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -26,7 +26,7 @@
26 26
27#include <asm/ptrace.h> 27#include <asm/ptrace.h>
28#include <asm/processor.h> 28#include <asm/processor.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/io.h> 32#include <asm/io.h>
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index 6f6544cfa0e..fd6c36b1df7 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -4,12 +4,27 @@
4#include <linux/interrupt.h> 4#include <linux/interrupt.h>
5 5
6#include <asm/traps.h> 6#include <asm/traps.h>
7#include <asm/head.h>
8#include <asm/io.h>
7 9
8/* cpu.c */ 10/* cpu.c */
9extern const char *sparc_pmu_type; 11extern const char *sparc_pmu_type;
10extern unsigned int fsr_storage; 12extern unsigned int fsr_storage;
11extern int ncpus_probed; 13extern int ncpus_probed;
12 14
15#ifdef CONFIG_SPARC64
16/* setup_64.c */
17struct seq_file;
18extern void cpucap_info(struct seq_file *);
19
20static inline unsigned long kimage_addr_to_ra(const char *p)
21{
22 unsigned long val = (unsigned long) p;
23
24 return kern_base + (val - KERNBASE);
25}
26#endif
27
13#ifdef CONFIG_SPARC32 28#ifdef CONFIG_SPARC32
14/* cpu.c */ 29/* cpu.c */
15extern void cpu_probe(void); 30extern void cpu_probe(void);
diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S
index 1d361477d7d..79f31036484 100644
--- a/arch/sparc/kernel/ktlb.S
+++ b/arch/sparc/kernel/ktlb.S
@@ -47,16 +47,16 @@ kvmap_itlb_tsb_miss:
47kvmap_itlb_vmalloc_addr: 47kvmap_itlb_vmalloc_addr:
48 KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_itlb_longpath) 48 KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_itlb_longpath)
49 49
50 KTSB_LOCK_TAG(%g1, %g2, %g7) 50 TSB_LOCK_TAG(%g1, %g2, %g7)
51 51
52 /* Load and check PTE. */ 52 /* Load and check PTE. */
53 ldxa [%g5] ASI_PHYS_USE_EC, %g5 53 ldxa [%g5] ASI_PHYS_USE_EC, %g5
54 mov 1, %g7 54 mov 1, %g7
55 sllx %g7, TSB_TAG_INVALID_BIT, %g7 55 sllx %g7, TSB_TAG_INVALID_BIT, %g7
56 brgez,a,pn %g5, kvmap_itlb_longpath 56 brgez,a,pn %g5, kvmap_itlb_longpath
57 KTSB_STORE(%g1, %g7) 57 TSB_STORE(%g1, %g7)
58 58
59 KTSB_WRITE(%g1, %g5, %g6) 59 TSB_WRITE(%g1, %g5, %g6)
60 60
61 /* fallthrough to TLB load */ 61 /* fallthrough to TLB load */
62 62
@@ -102,9 +102,9 @@ kvmap_itlb_longpath:
102kvmap_itlb_obp: 102kvmap_itlb_obp:
103 OBP_TRANS_LOOKUP(%g4, %g5, %g2, %g3, kvmap_itlb_longpath) 103 OBP_TRANS_LOOKUP(%g4, %g5, %g2, %g3, kvmap_itlb_longpath)
104 104
105 KTSB_LOCK_TAG(%g1, %g2, %g7) 105 TSB_LOCK_TAG(%g1, %g2, %g7)
106 106
107 KTSB_WRITE(%g1, %g5, %g6) 107 TSB_WRITE(%g1, %g5, %g6)
108 108
109 ba,pt %xcc, kvmap_itlb_load 109 ba,pt %xcc, kvmap_itlb_load
110 nop 110 nop
@@ -112,17 +112,17 @@ kvmap_itlb_obp:
112kvmap_dtlb_obp: 112kvmap_dtlb_obp:
113 OBP_TRANS_LOOKUP(%g4, %g5, %g2, %g3, kvmap_dtlb_longpath) 113 OBP_TRANS_LOOKUP(%g4, %g5, %g2, %g3, kvmap_dtlb_longpath)
114 114
115 KTSB_LOCK_TAG(%g1, %g2, %g7) 115 TSB_LOCK_TAG(%g1, %g2, %g7)
116 116
117 KTSB_WRITE(%g1, %g5, %g6) 117 TSB_WRITE(%g1, %g5, %g6)
118 118
119 ba,pt %xcc, kvmap_dtlb_load 119 ba,pt %xcc, kvmap_dtlb_load
120 nop 120 nop
121 121
122 .align 32 122 .align 32
123kvmap_dtlb_tsb4m_load: 123kvmap_dtlb_tsb4m_load:
124 KTSB_LOCK_TAG(%g1, %g2, %g7) 124 TSB_LOCK_TAG(%g1, %g2, %g7)
125 KTSB_WRITE(%g1, %g5, %g6) 125 TSB_WRITE(%g1, %g5, %g6)
126 ba,pt %xcc, kvmap_dtlb_load 126 ba,pt %xcc, kvmap_dtlb_load
127 nop 127 nop
128 128
@@ -222,16 +222,16 @@ kvmap_linear_patch:
222kvmap_dtlb_vmalloc_addr: 222kvmap_dtlb_vmalloc_addr:
223 KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_dtlb_longpath) 223 KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_dtlb_longpath)
224 224
225 KTSB_LOCK_TAG(%g1, %g2, %g7) 225 TSB_LOCK_TAG(%g1, %g2, %g7)
226 226
227 /* Load and check PTE. */ 227 /* Load and check PTE. */
228 ldxa [%g5] ASI_PHYS_USE_EC, %g5 228 ldxa [%g5] ASI_PHYS_USE_EC, %g5
229 mov 1, %g7 229 mov 1, %g7
230 sllx %g7, TSB_TAG_INVALID_BIT, %g7 230 sllx %g7, TSB_TAG_INVALID_BIT, %g7
231 brgez,a,pn %g5, kvmap_dtlb_longpath 231 brgez,a,pn %g5, kvmap_dtlb_longpath
232 KTSB_STORE(%g1, %g7) 232 TSB_STORE(%g1, %g7)
233 233
234 KTSB_WRITE(%g1, %g5, %g6) 234 TSB_WRITE(%g1, %g5, %g6)
235 235
236 /* fallthrough to TLB load */ 236 /* fallthrough to TLB load */
237 237
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c
index 44dc093ee33..fad1bd07cb5 100644
--- a/arch/sparc/kernel/leon_pci_grpci2.c
+++ b/arch/sparc/kernel/leon_pci_grpci2.c
@@ -215,7 +215,7 @@ struct grpci2_priv {
215DEFINE_SPINLOCK(grpci2_dev_lock); 215DEFINE_SPINLOCK(grpci2_dev_lock);
216struct grpci2_priv *grpci2priv; 216struct grpci2_priv *grpci2priv;
217 217
218int grpci2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 218int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
219{ 219{
220 struct grpci2_priv *priv = dev->bus->sysdata; 220 struct grpci2_priv *priv = dev->bus->sysdata;
221 int irq_group; 221 int irq_group;
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index fe8fb44c609..1210fde1874 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -28,7 +28,7 @@
28#include <asm/tlbflush.h> 28#include <asm/tlbflush.h>
29 29
30#include <asm/ptrace.h> 30#include <asm/ptrace.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/irq_regs.h> 32#include <asm/irq_regs.h>
33#include <asm/traps.h> 33#include <asm/traps.h>
34 34
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 42f28c7420e..acaebb63c4f 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -508,6 +508,8 @@ const char *mdesc_node_name(struct mdesc_handle *hp, u64 node)
508} 508}
509EXPORT_SYMBOL(mdesc_node_name); 509EXPORT_SYMBOL(mdesc_node_name);
510 510
511static u64 max_cpus = 64;
512
511static void __init report_platform_properties(void) 513static void __init report_platform_properties(void)
512{ 514{
513 struct mdesc_handle *hp = mdesc_grab(); 515 struct mdesc_handle *hp = mdesc_grab();
@@ -543,8 +545,10 @@ static void __init report_platform_properties(void)
543 if (v) 545 if (v)
544 printk("PLATFORM: watchdog-max-timeout [%llu ms]\n", *v); 546 printk("PLATFORM: watchdog-max-timeout [%llu ms]\n", *v);
545 v = mdesc_get_property(hp, pn, "max-cpus", NULL); 547 v = mdesc_get_property(hp, pn, "max-cpus", NULL);
546 if (v) 548 if (v) {
547 printk("PLATFORM: max-cpus [%llu]\n", *v); 549 max_cpus = *v;
550 printk("PLATFORM: max-cpus [%llu]\n", max_cpus);
551 }
548 552
549#ifdef CONFIG_SMP 553#ifdef CONFIG_SMP
550 { 554 {
@@ -715,7 +719,7 @@ static void __cpuinit set_proc_ids(struct mdesc_handle *hp)
715} 719}
716 720
717static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, 721static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask,
718 unsigned char def) 722 unsigned long def, unsigned long max)
719{ 723{
720 u64 val; 724 u64 val;
721 725
@@ -726,6 +730,9 @@ static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask,
726 if (!val || val >= 64) 730 if (!val || val >= 64)
727 goto use_default; 731 goto use_default;
728 732
733 if (val > max)
734 val = max;
735
729 *mask = ((1U << val) * 64U) - 1U; 736 *mask = ((1U << val) * 64U) - 1U;
730 return; 737 return;
731 738
@@ -736,19 +743,28 @@ use_default:
736static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp, 743static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp,
737 struct trap_per_cpu *tb) 744 struct trap_per_cpu *tb)
738{ 745{
746 static int printed;
739 const u64 *val; 747 const u64 *val;
740 748
741 val = mdesc_get_property(hp, mp, "q-cpu-mondo-#bits", NULL); 749 val = mdesc_get_property(hp, mp, "q-cpu-mondo-#bits", NULL);
742 get_one_mondo_bits(val, &tb->cpu_mondo_qmask, 7); 750 get_one_mondo_bits(val, &tb->cpu_mondo_qmask, 7, ilog2(max_cpus * 2));
743 751
744 val = mdesc_get_property(hp, mp, "q-dev-mondo-#bits", NULL); 752 val = mdesc_get_property(hp, mp, "q-dev-mondo-#bits", NULL);
745 get_one_mondo_bits(val, &tb->dev_mondo_qmask, 7); 753 get_one_mondo_bits(val, &tb->dev_mondo_qmask, 7, 8);
746 754
747 val = mdesc_get_property(hp, mp, "q-resumable-#bits", NULL); 755 val = mdesc_get_property(hp, mp, "q-resumable-#bits", NULL);
748 get_one_mondo_bits(val, &tb->resum_qmask, 6); 756 get_one_mondo_bits(val, &tb->resum_qmask, 6, 7);
749 757
750 val = mdesc_get_property(hp, mp, "q-nonresumable-#bits", NULL); 758 val = mdesc_get_property(hp, mp, "q-nonresumable-#bits", NULL);
751 get_one_mondo_bits(val, &tb->nonresum_qmask, 2); 759 get_one_mondo_bits(val, &tb->nonresum_qmask, 2, 2);
760 if (!printed++) {
761 pr_info("SUN4V: Mondo queue sizes "
762 "[cpu(%u) dev(%u) r(%u) nr(%u)]\n",
763 tb->cpu_mondo_qmask + 1,
764 tb->dev_mondo_qmask + 1,
765 tb->resum_qmask + 1,
766 tb->nonresum_qmask + 1);
767 }
752} 768}
753 769
754static void * __cpuinit mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask) 770static void * __cpuinit mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask)
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index a19f0419547..1aaf8c180be 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -352,8 +352,8 @@ int __init pcic_probe(void)
352 strcpy(pbm->prom_name, namebuf); 352 strcpy(pbm->prom_name, namebuf);
353 353
354 { 354 {
355 extern volatile int t_nmi[1]; 355 extern volatile int t_nmi[4];
356 extern int pcic_nmi_trap_patch[1]; 356 extern int pcic_nmi_trap_patch[4];
357 357
358 t_nmi[0] = pcic_nmi_trap_patch[0]; 358 t_nmi[0] = pcic_nmi_trap_patch[0];
359 t_nmi[1] = pcic_nmi_trap_patch[1]; 359 t_nmi[1] = pcic_nmi_trap_patch[1];
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
index 8ac23e66008..343b0f9e2e7 100644
--- a/arch/sparc/kernel/pcr.c
+++ b/arch/sparc/kernel/pcr.c
@@ -80,8 +80,11 @@ static void n2_pcr_write(u64 val)
80{ 80{
81 unsigned long ret; 81 unsigned long ret;
82 82
83 ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val); 83 if (val & PCR_N2_HTRACE) {
84 if (ret != HV_EOK) 84 ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
85 if (ret != HV_EOK)
86 write_pcr(val);
87 } else
85 write_pcr(val); 88 write_pcr(val);
86} 89}
87 90
@@ -106,6 +109,10 @@ static int __init register_perf_hsvc(void)
106 perf_hsvc_group = HV_GRP_N2_CPU; 109 perf_hsvc_group = HV_GRP_N2_CPU;
107 break; 110 break;
108 111
112 case SUN4V_CHIP_NIAGARA3:
113 perf_hsvc_group = HV_GRP_KT_CPU;
114 break;
115
109 default: 116 default:
110 return -ENODEV; 117 return -ENODEV;
111 } 118 }
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 62a034318b1..614da624330 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -22,7 +22,7 @@
22#include <asm/stacktrace.h> 22#include <asm/stacktrace.h>
23#include <asm/cpudata.h> 23#include <asm/cpudata.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/atomic.h> 25#include <linux/atomic.h>
26#include <asm/nmi.h> 26#include <asm/nmi.h>
27#include <asm/pcr.h> 27#include <asm/pcr.h>
28 28
@@ -1343,7 +1343,8 @@ static bool __init supported_pmu(void)
1343 sparc_pmu = &niagara1_pmu; 1343 sparc_pmu = &niagara1_pmu;
1344 return true; 1344 return true;
1345 } 1345 }
1346 if (!strcmp(sparc_pmu_type, "niagara2")) { 1346 if (!strcmp(sparc_pmu_type, "niagara2") ||
1347 !strcmp(sparc_pmu_type, "niagara3")) {
1347 sparc_pmu = &niagara2_pmu; 1348 sparc_pmu = &niagara2_pmu;
1348 return true; 1349 return true;
1349 } 1350 }
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index c4dd0999da8..3c5bb784214 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -29,6 +29,7 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/cpu.h> 30#include <linux/cpu.h>
31#include <linux/initrd.h> 31#include <linux/initrd.h>
32#include <linux/module.h>
32 33
33#include <asm/system.h> 34#include <asm/system.h>
34#include <asm/io.h> 35#include <asm/io.h>
@@ -46,6 +47,8 @@
46#include <asm/mmu.h> 47#include <asm/mmu.h>
47#include <asm/ns87303.h> 48#include <asm/ns87303.h>
48#include <asm/btext.h> 49#include <asm/btext.h>
50#include <asm/elf.h>
51#include <asm/mdesc.h>
49 52
50#ifdef CONFIG_IP_PNP 53#ifdef CONFIG_IP_PNP
51#include <net/ipconfig.h> 54#include <net/ipconfig.h>
@@ -269,6 +272,40 @@ void __init sun4v_patch(void)
269 sun4v_hvapi_init(); 272 sun4v_hvapi_init();
270} 273}
271 274
275static void __init popc_patch(void)
276{
277 struct popc_3insn_patch_entry *p3;
278 struct popc_6insn_patch_entry *p6;
279
280 p3 = &__popc_3insn_patch;
281 while (p3 < &__popc_3insn_patch_end) {
282 unsigned long i, addr = p3->addr;
283
284 for (i = 0; i < 3; i++) {
285 *(unsigned int *) (addr + (i * 4)) = p3->insns[i];
286 wmb();
287 __asm__ __volatile__("flush %0"
288 : : "r" (addr + (i * 4)));
289 }
290
291 p3++;
292 }
293
294 p6 = &__popc_6insn_patch;
295 while (p6 < &__popc_6insn_patch_end) {
296 unsigned long i, addr = p6->addr;
297
298 for (i = 0; i < 6; i++) {
299 *(unsigned int *) (addr + (i * 4)) = p6->insns[i];
300 wmb();
301 __asm__ __volatile__("flush %0"
302 : : "r" (addr + (i * 4)));
303 }
304
305 p6++;
306 }
307}
308
272#ifdef CONFIG_SMP 309#ifdef CONFIG_SMP
273void __init boot_cpu_id_too_large(int cpu) 310void __init boot_cpu_id_too_large(int cpu)
274{ 311{
@@ -278,6 +315,160 @@ void __init boot_cpu_id_too_large(int cpu)
278} 315}
279#endif 316#endif
280 317
318/* On Ultra, we support all of the v8 capabilities. */
319unsigned long sparc64_elf_hwcap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR |
320 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV |
321 HWCAP_SPARC_V9);
322EXPORT_SYMBOL(sparc64_elf_hwcap);
323
324static const char *hwcaps[] = {
325 "flush", "stbar", "swap", "muldiv", "v9",
326 "ultra3", "blkinit", "n2",
327
328 /* These strings are as they appear in the machine description
329 * 'hwcap-list' property for cpu nodes.
330 */
331 "mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
332 "ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau",
333 "ima", "cspare",
334};
335
336void cpucap_info(struct seq_file *m)
337{
338 unsigned long caps = sparc64_elf_hwcap;
339 int i, printed = 0;
340
341 seq_puts(m, "cpucaps\t\t: ");
342 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
343 unsigned long bit = 1UL << i;
344 if (caps & bit) {
345 seq_printf(m, "%s%s",
346 printed ? "," : "", hwcaps[i]);
347 printed++;
348 }
349 }
350 seq_putc(m, '\n');
351}
352
353static void __init report_hwcaps(unsigned long caps)
354{
355 int i, printed = 0;
356
357 printk(KERN_INFO "CPU CAPS: [");
358 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
359 unsigned long bit = 1UL << i;
360 if (caps & bit) {
361 printk(KERN_CONT "%s%s",
362 printed ? "," : "", hwcaps[i]);
363 if (++printed == 8) {
364 printk(KERN_CONT "]\n");
365 printk(KERN_INFO "CPU CAPS: [");
366 printed = 0;
367 }
368 }
369 }
370 printk(KERN_CONT "]\n");
371}
372
373static unsigned long __init mdesc_cpu_hwcap_list(void)
374{
375 struct mdesc_handle *hp;
376 unsigned long caps = 0;
377 const char *prop;
378 int len;
379 u64 pn;
380
381 hp = mdesc_grab();
382 if (!hp)
383 return 0;
384
385 pn = mdesc_node_by_name(hp, MDESC_NODE_NULL, "cpu");
386 if (pn == MDESC_NODE_NULL)
387 goto out;
388
389 prop = mdesc_get_property(hp, pn, "hwcap-list", &len);
390 if (!prop)
391 goto out;
392
393 while (len) {
394 int i, plen;
395
396 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
397 unsigned long bit = 1UL << i;
398
399 if (!strcmp(prop, hwcaps[i])) {
400 caps |= bit;
401 break;
402 }
403 }
404
405 plen = strlen(prop) + 1;
406 prop += plen;
407 len -= plen;
408 }
409
410out:
411 mdesc_release(hp);
412 return caps;
413}
414
415/* This yields a mask that user programs can use to figure out what
416 * instruction set this cpu supports.
417 */
418static void __init init_sparc64_elf_hwcap(void)
419{
420 unsigned long cap = sparc64_elf_hwcap;
421 unsigned long mdesc_caps;
422
423 if (tlb_type == cheetah || tlb_type == cheetah_plus)
424 cap |= HWCAP_SPARC_ULTRA3;
425 else if (tlb_type == hypervisor) {
426 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
427 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
428 sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
429 cap |= HWCAP_SPARC_BLKINIT;
430 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
431 sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
432 cap |= HWCAP_SPARC_N2;
433 }
434
435 cap |= (AV_SPARC_MUL32 | AV_SPARC_DIV32 | AV_SPARC_V8PLUS);
436
437 mdesc_caps = mdesc_cpu_hwcap_list();
438 if (!mdesc_caps) {
439 if (tlb_type == spitfire)
440 cap |= AV_SPARC_VIS;
441 if (tlb_type == cheetah || tlb_type == cheetah_plus)
442 cap |= AV_SPARC_VIS | AV_SPARC_VIS2;
443 if (tlb_type == cheetah_plus) {
444 unsigned long impl, ver;
445
446 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
447 impl = ((ver >> 32) & 0xffff);
448 if (impl == PANTHER_IMPL)
449 cap |= AV_SPARC_POPC;
450 }
451 if (tlb_type == hypervisor) {
452 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1)
453 cap |= AV_SPARC_ASI_BLK_INIT;
454 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
455 sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
456 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
457 AV_SPARC_ASI_BLK_INIT |
458 AV_SPARC_POPC);
459 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
460 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
461 AV_SPARC_FMAF);
462 }
463 }
464 sparc64_elf_hwcap = cap | mdesc_caps;
465
466 report_hwcaps(sparc64_elf_hwcap);
467
468 if (sparc64_elf_hwcap & AV_SPARC_POPC)
469 popc_patch();
470}
471
281void __init setup_arch(char **cmdline_p) 472void __init setup_arch(char **cmdline_p)
282{ 473{
283 /* Initialize PROM console and command line. */ 474 /* Initialize PROM console and command line. */
@@ -337,6 +528,7 @@ void __init setup_arch(char **cmdline_p)
337 init_cur_cpu_trap(current_thread_info()); 528 init_cur_cpu_trap(current_thread_info());
338 529
339 paging_init(); 530 paging_init();
531 init_sparc64_elf_hwcap();
340} 532}
341 533
342extern int stop_a_enabled; 534extern int stop_a_enabled;
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index 75fad425e24..1ba95aff5d5 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -29,6 +29,8 @@
29#include <asm/visasm.h> 29#include <asm/visasm.h>
30#include <asm/compat_signal.h> 30#include <asm/compat_signal.h>
31 31
32#include "sigutil.h"
33
32#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 34#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
33 35
34/* This magic should be in g_upper[0] for all upper parts 36/* This magic should be in g_upper[0] for all upper parts
@@ -44,14 +46,14 @@ typedef struct {
44struct signal_frame32 { 46struct signal_frame32 {
45 struct sparc_stackf32 ss; 47 struct sparc_stackf32 ss;
46 __siginfo32_t info; 48 __siginfo32_t info;
47 /* __siginfo_fpu32_t * */ u32 fpu_save; 49 /* __siginfo_fpu_t * */ u32 fpu_save;
48 unsigned int insns[2]; 50 unsigned int insns[2];
49 unsigned int extramask[_COMPAT_NSIG_WORDS - 1]; 51 unsigned int extramask[_COMPAT_NSIG_WORDS - 1];
50 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */ 52 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */
51 /* Only valid if (info.si_regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */ 53 /* Only valid if (info.si_regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */
52 siginfo_extra_v8plus_t v8plus; 54 siginfo_extra_v8plus_t v8plus;
53 __siginfo_fpu_t fpu_state; 55 /* __siginfo_rwin_t * */u32 rwin_save;
54}; 56} __attribute__((aligned(8)));
55 57
56typedef struct compat_siginfo{ 58typedef struct compat_siginfo{
57 int si_signo; 59 int si_signo;
@@ -110,18 +112,14 @@ struct rt_signal_frame32 {
110 compat_siginfo_t info; 112 compat_siginfo_t info;
111 struct pt_regs32 regs; 113 struct pt_regs32 regs;
112 compat_sigset_t mask; 114 compat_sigset_t mask;
113 /* __siginfo_fpu32_t * */ u32 fpu_save; 115 /* __siginfo_fpu_t * */ u32 fpu_save;
114 unsigned int insns[2]; 116 unsigned int insns[2];
115 stack_t32 stack; 117 stack_t32 stack;
116 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */ 118 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */
117 /* Only valid if (regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */ 119 /* Only valid if (regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */
118 siginfo_extra_v8plus_t v8plus; 120 siginfo_extra_v8plus_t v8plus;
119 __siginfo_fpu_t fpu_state; 121 /* __siginfo_rwin_t * */u32 rwin_save;
120}; 122} __attribute__((aligned(8)));
121
122/* Align macros */
123#define SF_ALIGNEDSZ (((sizeof(struct signal_frame32) + 15) & (~15)))
124#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame32) + 15) & (~15)))
125 123
126int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 124int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
127{ 125{
@@ -192,30 +190,13 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
192 return 0; 190 return 0;
193} 191}
194 192
195static int restore_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
196{
197 unsigned long *fpregs = current_thread_info()->fpregs;
198 unsigned long fprs;
199 int err;
200
201 err = __get_user(fprs, &fpu->si_fprs);
202 fprs_write(0);
203 regs->tstate &= ~TSTATE_PEF;
204 if (fprs & FPRS_DL)
205 err |= copy_from_user(fpregs, &fpu->si_float_regs[0], (sizeof(unsigned int) * 32));
206 if (fprs & FPRS_DU)
207 err |= copy_from_user(fpregs+16, &fpu->si_float_regs[32], (sizeof(unsigned int) * 32));
208 err |= __get_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
209 err |= __get_user(current_thread_info()->gsr[0], &fpu->si_gsr);
210 current_thread_info()->fpsaved[0] |= fprs;
211 return err;
212}
213
214void do_sigreturn32(struct pt_regs *regs) 193void do_sigreturn32(struct pt_regs *regs)
215{ 194{
216 struct signal_frame32 __user *sf; 195 struct signal_frame32 __user *sf;
196 compat_uptr_t fpu_save;
197 compat_uptr_t rwin_save;
217 unsigned int psr; 198 unsigned int psr;
218 unsigned pc, npc, fpu_save; 199 unsigned pc, npc;
219 sigset_t set; 200 sigset_t set;
220 unsigned seta[_COMPAT_NSIG_WORDS]; 201 unsigned seta[_COMPAT_NSIG_WORDS];
221 int err, i; 202 int err, i;
@@ -273,8 +254,13 @@ void do_sigreturn32(struct pt_regs *regs)
273 pt_regs_clear_syscall(regs); 254 pt_regs_clear_syscall(regs);
274 255
275 err |= __get_user(fpu_save, &sf->fpu_save); 256 err |= __get_user(fpu_save, &sf->fpu_save);
276 if (fpu_save) 257 if (!err && fpu_save)
277 err |= restore_fpu_state32(regs, &sf->fpu_state); 258 err |= restore_fpu_state(regs, compat_ptr(fpu_save));
259 err |= __get_user(rwin_save, &sf->rwin_save);
260 if (!err && rwin_save) {
261 if (restore_rwin_state(compat_ptr(rwin_save)))
262 goto segv;
263 }
278 err |= __get_user(seta[0], &sf->info.si_mask); 264 err |= __get_user(seta[0], &sf->info.si_mask);
279 err |= copy_from_user(seta+1, &sf->extramask, 265 err |= copy_from_user(seta+1, &sf->extramask,
280 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 266 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
@@ -300,7 +286,9 @@ segv:
300asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) 286asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
301{ 287{
302 struct rt_signal_frame32 __user *sf; 288 struct rt_signal_frame32 __user *sf;
303 unsigned int psr, pc, npc, fpu_save, u_ss_sp; 289 unsigned int psr, pc, npc, u_ss_sp;
290 compat_uptr_t fpu_save;
291 compat_uptr_t rwin_save;
304 mm_segment_t old_fs; 292 mm_segment_t old_fs;
305 sigset_t set; 293 sigset_t set;
306 compat_sigset_t seta; 294 compat_sigset_t seta;
@@ -359,8 +347,8 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
359 pt_regs_clear_syscall(regs); 347 pt_regs_clear_syscall(regs);
360 348
361 err |= __get_user(fpu_save, &sf->fpu_save); 349 err |= __get_user(fpu_save, &sf->fpu_save);
362 if (fpu_save) 350 if (!err && fpu_save)
363 err |= restore_fpu_state32(regs, &sf->fpu_state); 351 err |= restore_fpu_state(regs, compat_ptr(fpu_save));
364 err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t)); 352 err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t));
365 err |= __get_user(u_ss_sp, &sf->stack.ss_sp); 353 err |= __get_user(u_ss_sp, &sf->stack.ss_sp);
366 st.ss_sp = compat_ptr(u_ss_sp); 354 st.ss_sp = compat_ptr(u_ss_sp);
@@ -376,6 +364,12 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
376 do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf); 364 do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf);
377 set_fs(old_fs); 365 set_fs(old_fs);
378 366
367 err |= __get_user(rwin_save, &sf->rwin_save);
368 if (!err && rwin_save) {
369 if (restore_rwin_state(compat_ptr(rwin_save)))
370 goto segv;
371 }
372
379 switch (_NSIG_WORDS) { 373 switch (_NSIG_WORDS) {
380 case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32); 374 case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32);
381 case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32); 375 case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32);
@@ -433,26 +427,6 @@ static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, uns
433 return (void __user *) sp; 427 return (void __user *) sp;
434} 428}
435 429
436static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
437{
438 unsigned long *fpregs = current_thread_info()->fpregs;
439 unsigned long fprs;
440 int err = 0;
441
442 fprs = current_thread_info()->fpsaved[0];
443 if (fprs & FPRS_DL)
444 err |= copy_to_user(&fpu->si_float_regs[0], fpregs,
445 (sizeof(unsigned int) * 32));
446 if (fprs & FPRS_DU)
447 err |= copy_to_user(&fpu->si_float_regs[32], fpregs+16,
448 (sizeof(unsigned int) * 32));
449 err |= __put_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
450 err |= __put_user(current_thread_info()->gsr[0], &fpu->si_gsr);
451 err |= __put_user(fprs, &fpu->si_fprs);
452
453 return err;
454}
455
456/* The I-cache flush instruction only works in the primary ASI, which 430/* The I-cache flush instruction only works in the primary ASI, which
457 * right now is the nucleus, aka. kernel space. 431 * right now is the nucleus, aka. kernel space.
458 * 432 *
@@ -515,18 +489,23 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
515 int signo, sigset_t *oldset) 489 int signo, sigset_t *oldset)
516{ 490{
517 struct signal_frame32 __user *sf; 491 struct signal_frame32 __user *sf;
492 int i, err, wsaved;
493 void __user *tail;
518 int sigframe_size; 494 int sigframe_size;
519 u32 psr; 495 u32 psr;
520 int i, err;
521 unsigned int seta[_COMPAT_NSIG_WORDS]; 496 unsigned int seta[_COMPAT_NSIG_WORDS];
522 497
523 /* 1. Make sure everything is clean */ 498 /* 1. Make sure everything is clean */
524 synchronize_user_stack(); 499 synchronize_user_stack();
525 save_and_clear_fpu(); 500 save_and_clear_fpu();
526 501
527 sigframe_size = SF_ALIGNEDSZ; 502 wsaved = get_thread_wsaved();
528 if (!(current_thread_info()->fpsaved[0] & FPRS_FEF)) 503
529 sigframe_size -= sizeof(__siginfo_fpu_t); 504 sigframe_size = sizeof(*sf);
505 if (current_thread_info()->fpsaved[0] & FPRS_FEF)
506 sigframe_size += sizeof(__siginfo_fpu_t);
507 if (wsaved)
508 sigframe_size += sizeof(__siginfo_rwin_t);
530 509
531 sf = (struct signal_frame32 __user *) 510 sf = (struct signal_frame32 __user *)
532 get_sigframe(&ka->sa, regs, sigframe_size); 511 get_sigframe(&ka->sa, regs, sigframe_size);
@@ -534,8 +513,7 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
534 if (invalid_frame_pointer(sf, sigframe_size)) 513 if (invalid_frame_pointer(sf, sigframe_size))
535 goto sigill; 514 goto sigill;
536 515
537 if (get_thread_wsaved() != 0) 516 tail = (sf + 1);
538 goto sigill;
539 517
540 /* 2. Save the current process state */ 518 /* 2. Save the current process state */
541 if (test_thread_flag(TIF_32BIT)) { 519 if (test_thread_flag(TIF_32BIT)) {
@@ -560,11 +538,22 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
560 &sf->v8plus.asi); 538 &sf->v8plus.asi);
561 539
562 if (psr & PSR_EF) { 540 if (psr & PSR_EF) {
563 err |= save_fpu_state32(regs, &sf->fpu_state); 541 __siginfo_fpu_t __user *fp = tail;
564 err |= __put_user((u64)&sf->fpu_state, &sf->fpu_save); 542 tail += sizeof(*fp);
543 err |= save_fpu_state(regs, fp);
544 err |= __put_user((u64)fp, &sf->fpu_save);
565 } else { 545 } else {
566 err |= __put_user(0, &sf->fpu_save); 546 err |= __put_user(0, &sf->fpu_save);
567 } 547 }
548 if (wsaved) {
549 __siginfo_rwin_t __user *rwp = tail;
550 tail += sizeof(*rwp);
551 err |= save_rwin_state(wsaved, rwp);
552 err |= __put_user((u64)rwp, &sf->rwin_save);
553 set_thread_wsaved(0);
554 } else {
555 err |= __put_user(0, &sf->rwin_save);
556 }
568 557
569 switch (_NSIG_WORDS) { 558 switch (_NSIG_WORDS) {
570 case 4: seta[7] = (oldset->sig[3] >> 32); 559 case 4: seta[7] = (oldset->sig[3] >> 32);
@@ -580,10 +569,21 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
580 err |= __copy_to_user(sf->extramask, seta + 1, 569 err |= __copy_to_user(sf->extramask, seta + 1,
581 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 570 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
582 571
583 err |= copy_in_user((u32 __user *)sf, 572 if (!wsaved) {
584 (u32 __user *)(regs->u_regs[UREG_FP]), 573 err |= copy_in_user((u32 __user *)sf,
585 sizeof(struct reg_window32)); 574 (u32 __user *)(regs->u_regs[UREG_FP]),
586 575 sizeof(struct reg_window32));
576 } else {
577 struct reg_window *rp;
578
579 rp = &current_thread_info()->reg_window[wsaved - 1];
580 for (i = 0; i < 8; i++)
581 err |= __put_user(rp->locals[i], &sf->ss.locals[i]);
582 for (i = 0; i < 6; i++)
583 err |= __put_user(rp->ins[i], &sf->ss.ins[i]);
584 err |= __put_user(rp->ins[6], &sf->ss.fp);
585 err |= __put_user(rp->ins[7], &sf->ss.callers_pc);
586 }
587 if (err) 587 if (err)
588 goto sigsegv; 588 goto sigsegv;
589 589
@@ -613,7 +613,6 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
613 err |= __put_user(0x91d02010, &sf->insns[1]); /*t 0x10*/ 613 err |= __put_user(0x91d02010, &sf->insns[1]); /*t 0x10*/
614 if (err) 614 if (err)
615 goto sigsegv; 615 goto sigsegv;
616
617 flush_signal_insns(address); 616 flush_signal_insns(address);
618 } 617 }
619 return 0; 618 return 0;
@@ -632,18 +631,23 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
632 siginfo_t *info) 631 siginfo_t *info)
633{ 632{
634 struct rt_signal_frame32 __user *sf; 633 struct rt_signal_frame32 __user *sf;
634 int i, err, wsaved;
635 void __user *tail;
635 int sigframe_size; 636 int sigframe_size;
636 u32 psr; 637 u32 psr;
637 int i, err;
638 compat_sigset_t seta; 638 compat_sigset_t seta;
639 639
640 /* 1. Make sure everything is clean */ 640 /* 1. Make sure everything is clean */
641 synchronize_user_stack(); 641 synchronize_user_stack();
642 save_and_clear_fpu(); 642 save_and_clear_fpu();
643 643
644 sigframe_size = RT_ALIGNEDSZ; 644 wsaved = get_thread_wsaved();
645 if (!(current_thread_info()->fpsaved[0] & FPRS_FEF)) 645
646 sigframe_size -= sizeof(__siginfo_fpu_t); 646 sigframe_size = sizeof(*sf);
647 if (current_thread_info()->fpsaved[0] & FPRS_FEF)
648 sigframe_size += sizeof(__siginfo_fpu_t);
649 if (wsaved)
650 sigframe_size += sizeof(__siginfo_rwin_t);
647 651
648 sf = (struct rt_signal_frame32 __user *) 652 sf = (struct rt_signal_frame32 __user *)
649 get_sigframe(&ka->sa, regs, sigframe_size); 653 get_sigframe(&ka->sa, regs, sigframe_size);
@@ -651,8 +655,7 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
651 if (invalid_frame_pointer(sf, sigframe_size)) 655 if (invalid_frame_pointer(sf, sigframe_size))
652 goto sigill; 656 goto sigill;
653 657
654 if (get_thread_wsaved() != 0) 658 tail = (sf + 1);
655 goto sigill;
656 659
657 /* 2. Save the current process state */ 660 /* 2. Save the current process state */
658 if (test_thread_flag(TIF_32BIT)) { 661 if (test_thread_flag(TIF_32BIT)) {
@@ -677,11 +680,22 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
677 &sf->v8plus.asi); 680 &sf->v8plus.asi);
678 681
679 if (psr & PSR_EF) { 682 if (psr & PSR_EF) {
680 err |= save_fpu_state32(regs, &sf->fpu_state); 683 __siginfo_fpu_t __user *fp = tail;
681 err |= __put_user((u64)&sf->fpu_state, &sf->fpu_save); 684 tail += sizeof(*fp);
685 err |= save_fpu_state(regs, fp);
686 err |= __put_user((u64)fp, &sf->fpu_save);
682 } else { 687 } else {
683 err |= __put_user(0, &sf->fpu_save); 688 err |= __put_user(0, &sf->fpu_save);
684 } 689 }
690 if (wsaved) {
691 __siginfo_rwin_t __user *rwp = tail;
692 tail += sizeof(*rwp);
693 err |= save_rwin_state(wsaved, rwp);
694 err |= __put_user((u64)rwp, &sf->rwin_save);
695 set_thread_wsaved(0);
696 } else {
697 err |= __put_user(0, &sf->rwin_save);
698 }
685 699
686 /* Update the siginfo structure. */ 700 /* Update the siginfo structure. */
687 err |= copy_siginfo_to_user32(&sf->info, info); 701 err |= copy_siginfo_to_user32(&sf->info, info);
@@ -703,9 +717,21 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
703 } 717 }
704 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t)); 718 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t));
705 719
706 err |= copy_in_user((u32 __user *)sf, 720 if (!wsaved) {
707 (u32 __user *)(regs->u_regs[UREG_FP]), 721 err |= copy_in_user((u32 __user *)sf,
708 sizeof(struct reg_window32)); 722 (u32 __user *)(regs->u_regs[UREG_FP]),
723 sizeof(struct reg_window32));
724 } else {
725 struct reg_window *rp;
726
727 rp = &current_thread_info()->reg_window[wsaved - 1];
728 for (i = 0; i < 8; i++)
729 err |= __put_user(rp->locals[i], &sf->ss.locals[i]);
730 for (i = 0; i < 6; i++)
731 err |= __put_user(rp->ins[i], &sf->ss.ins[i]);
732 err |= __put_user(rp->ins[6], &sf->ss.fp);
733 err |= __put_user(rp->ins[7], &sf->ss.callers_pc);
734 }
709 if (err) 735 if (err)
710 goto sigsegv; 736 goto sigsegv;
711 737
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 5e5c5fd0378..04ede8f04ad 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -26,6 +26,8 @@
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/cacheflush.h> /* flush_sig_insns */ 27#include <asm/cacheflush.h> /* flush_sig_insns */
28 28
29#include "sigutil.h"
30
29#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 31#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
30 32
31extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 33extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
@@ -39,8 +41,8 @@ struct signal_frame {
39 unsigned long insns[2] __attribute__ ((aligned (8))); 41 unsigned long insns[2] __attribute__ ((aligned (8)));
40 unsigned int extramask[_NSIG_WORDS - 1]; 42 unsigned int extramask[_NSIG_WORDS - 1];
41 unsigned int extra_size; /* Should be 0 */ 43 unsigned int extra_size; /* Should be 0 */
42 __siginfo_fpu_t fpu_state; 44 __siginfo_rwin_t __user *rwin_save;
43}; 45} __attribute__((aligned(8)));
44 46
45struct rt_signal_frame { 47struct rt_signal_frame {
46 struct sparc_stackf ss; 48 struct sparc_stackf ss;
@@ -51,8 +53,8 @@ struct rt_signal_frame {
51 unsigned int insns[2]; 53 unsigned int insns[2];
52 stack_t stack; 54 stack_t stack;
53 unsigned int extra_size; /* Should be 0 */ 55 unsigned int extra_size; /* Should be 0 */
54 __siginfo_fpu_t fpu_state; 56 __siginfo_rwin_t __user *rwin_save;
55}; 57} __attribute__((aligned(8)));
56 58
57/* Align macros */ 59/* Align macros */
58#define SF_ALIGNEDSZ (((sizeof(struct signal_frame) + 7) & (~7))) 60#define SF_ALIGNEDSZ (((sizeof(struct signal_frame) + 7) & (~7)))
@@ -79,43 +81,13 @@ asmlinkage int sys_sigsuspend(old_sigset_t set)
79 return _sigpause_common(set); 81 return _sigpause_common(set);
80} 82}
81 83
82static inline int
83restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
84{
85 int err;
86#ifdef CONFIG_SMP
87 if (test_tsk_thread_flag(current, TIF_USEDFPU))
88 regs->psr &= ~PSR_EF;
89#else
90 if (current == last_task_used_math) {
91 last_task_used_math = NULL;
92 regs->psr &= ~PSR_EF;
93 }
94#endif
95 set_used_math();
96 clear_tsk_thread_flag(current, TIF_USEDFPU);
97
98 if (!access_ok(VERIFY_READ, fpu, sizeof(*fpu)))
99 return -EFAULT;
100
101 err = __copy_from_user(&current->thread.float_regs[0], &fpu->si_float_regs[0],
102 (sizeof(unsigned long) * 32));
103 err |= __get_user(current->thread.fsr, &fpu->si_fsr);
104 err |= __get_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
105 if (current->thread.fpqdepth != 0)
106 err |= __copy_from_user(&current->thread.fpqueue[0],
107 &fpu->si_fpqueue[0],
108 ((sizeof(unsigned long) +
109 (sizeof(unsigned long *)))*16));
110 return err;
111}
112
113asmlinkage void do_sigreturn(struct pt_regs *regs) 84asmlinkage void do_sigreturn(struct pt_regs *regs)
114{ 85{
115 struct signal_frame __user *sf; 86 struct signal_frame __user *sf;
116 unsigned long up_psr, pc, npc; 87 unsigned long up_psr, pc, npc;
117 sigset_t set; 88 sigset_t set;
118 __siginfo_fpu_t __user *fpu_save; 89 __siginfo_fpu_t __user *fpu_save;
90 __siginfo_rwin_t __user *rwin_save;
119 int err; 91 int err;
120 92
121 /* Always make any pending restarted system calls return -EINTR */ 93 /* Always make any pending restarted system calls return -EINTR */
@@ -150,9 +122,11 @@ asmlinkage void do_sigreturn(struct pt_regs *regs)
150 pt_regs_clear_syscall(regs); 122 pt_regs_clear_syscall(regs);
151 123
152 err |= __get_user(fpu_save, &sf->fpu_save); 124 err |= __get_user(fpu_save, &sf->fpu_save);
153
154 if (fpu_save) 125 if (fpu_save)
155 err |= restore_fpu_state(regs, fpu_save); 126 err |= restore_fpu_state(regs, fpu_save);
127 err |= __get_user(rwin_save, &sf->rwin_save);
128 if (rwin_save)
129 err |= restore_rwin_state(rwin_save);
156 130
157 /* This is pretty much atomic, no amount locking would prevent 131 /* This is pretty much atomic, no amount locking would prevent
158 * the races which exist anyways. 132 * the races which exist anyways.
@@ -180,6 +154,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
180 struct rt_signal_frame __user *sf; 154 struct rt_signal_frame __user *sf;
181 unsigned int psr, pc, npc; 155 unsigned int psr, pc, npc;
182 __siginfo_fpu_t __user *fpu_save; 156 __siginfo_fpu_t __user *fpu_save;
157 __siginfo_rwin_t __user *rwin_save;
183 mm_segment_t old_fs; 158 mm_segment_t old_fs;
184 sigset_t set; 159 sigset_t set;
185 stack_t st; 160 stack_t st;
@@ -207,8 +182,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
207 pt_regs_clear_syscall(regs); 182 pt_regs_clear_syscall(regs);
208 183
209 err |= __get_user(fpu_save, &sf->fpu_save); 184 err |= __get_user(fpu_save, &sf->fpu_save);
210 185 if (!err && fpu_save)
211 if (fpu_save)
212 err |= restore_fpu_state(regs, fpu_save); 186 err |= restore_fpu_state(regs, fpu_save);
213 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t)); 187 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t));
214 188
@@ -228,6 +202,12 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
228 do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf); 202 do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
229 set_fs(old_fs); 203 set_fs(old_fs);
230 204
205 err |= __get_user(rwin_save, &sf->rwin_save);
206 if (!err && rwin_save) {
207 if (restore_rwin_state(rwin_save))
208 goto segv;
209 }
210
231 sigdelsetmask(&set, ~_BLOCKABLE); 211 sigdelsetmask(&set, ~_BLOCKABLE);
232 spin_lock_irq(&current->sighand->siglock); 212 spin_lock_irq(&current->sighand->siglock);
233 current->blocked = set; 213 current->blocked = set;
@@ -280,53 +260,23 @@ static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *re
280 return (void __user *) sp; 260 return (void __user *) sp;
281} 261}
282 262
283static inline int
284save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
285{
286 int err = 0;
287#ifdef CONFIG_SMP
288 if (test_tsk_thread_flag(current, TIF_USEDFPU)) {
289 put_psr(get_psr() | PSR_EF);
290 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
291 &current->thread.fpqueue[0], &current->thread.fpqdepth);
292 regs->psr &= ~(PSR_EF);
293 clear_tsk_thread_flag(current, TIF_USEDFPU);
294 }
295#else
296 if (current == last_task_used_math) {
297 put_psr(get_psr() | PSR_EF);
298 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
299 &current->thread.fpqueue[0], &current->thread.fpqdepth);
300 last_task_used_math = NULL;
301 regs->psr &= ~(PSR_EF);
302 }
303#endif
304 err |= __copy_to_user(&fpu->si_float_regs[0],
305 &current->thread.float_regs[0],
306 (sizeof(unsigned long) * 32));
307 err |= __put_user(current->thread.fsr, &fpu->si_fsr);
308 err |= __put_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
309 if (current->thread.fpqdepth != 0)
310 err |= __copy_to_user(&fpu->si_fpqueue[0],
311 &current->thread.fpqueue[0],
312 ((sizeof(unsigned long) +
313 (sizeof(unsigned long *)))*16));
314 clear_used_math();
315 return err;
316}
317
318static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs, 263static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
319 int signo, sigset_t *oldset) 264 int signo, sigset_t *oldset)
320{ 265{
321 struct signal_frame __user *sf; 266 struct signal_frame __user *sf;
322 int sigframe_size, err; 267 int sigframe_size, err, wsaved;
268 void __user *tail;
323 269
324 /* 1. Make sure everything is clean */ 270 /* 1. Make sure everything is clean */
325 synchronize_user_stack(); 271 synchronize_user_stack();
326 272
327 sigframe_size = SF_ALIGNEDSZ; 273 wsaved = current_thread_info()->w_saved;
328 if (!used_math()) 274
329 sigframe_size -= sizeof(__siginfo_fpu_t); 275 sigframe_size = sizeof(*sf);
276 if (used_math())
277 sigframe_size += sizeof(__siginfo_fpu_t);
278 if (wsaved)
279 sigframe_size += sizeof(__siginfo_rwin_t);
330 280
331 sf = (struct signal_frame __user *) 281 sf = (struct signal_frame __user *)
332 get_sigframe(&ka->sa, regs, sigframe_size); 282 get_sigframe(&ka->sa, regs, sigframe_size);
@@ -334,8 +284,7 @@ static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
334 if (invalid_frame_pointer(sf, sigframe_size)) 284 if (invalid_frame_pointer(sf, sigframe_size))
335 goto sigill_and_return; 285 goto sigill_and_return;
336 286
337 if (current_thread_info()->w_saved != 0) 287 tail = sf + 1;
338 goto sigill_and_return;
339 288
340 /* 2. Save the current process state */ 289 /* 2. Save the current process state */
341 err = __copy_to_user(&sf->info.si_regs, regs, sizeof(struct pt_regs)); 290 err = __copy_to_user(&sf->info.si_regs, regs, sizeof(struct pt_regs));
@@ -343,17 +292,34 @@ static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
343 err |= __put_user(0, &sf->extra_size); 292 err |= __put_user(0, &sf->extra_size);
344 293
345 if (used_math()) { 294 if (used_math()) {
346 err |= save_fpu_state(regs, &sf->fpu_state); 295 __siginfo_fpu_t __user *fp = tail;
347 err |= __put_user(&sf->fpu_state, &sf->fpu_save); 296 tail += sizeof(*fp);
297 err |= save_fpu_state(regs, fp);
298 err |= __put_user(fp, &sf->fpu_save);
348 } else { 299 } else {
349 err |= __put_user(0, &sf->fpu_save); 300 err |= __put_user(0, &sf->fpu_save);
350 } 301 }
302 if (wsaved) {
303 __siginfo_rwin_t __user *rwp = tail;
304 tail += sizeof(*rwp);
305 err |= save_rwin_state(wsaved, rwp);
306 err |= __put_user(rwp, &sf->rwin_save);
307 } else {
308 err |= __put_user(0, &sf->rwin_save);
309 }
351 310
352 err |= __put_user(oldset->sig[0], &sf->info.si_mask); 311 err |= __put_user(oldset->sig[0], &sf->info.si_mask);
353 err |= __copy_to_user(sf->extramask, &oldset->sig[1], 312 err |= __copy_to_user(sf->extramask, &oldset->sig[1],
354 (_NSIG_WORDS - 1) * sizeof(unsigned int)); 313 (_NSIG_WORDS - 1) * sizeof(unsigned int));
355 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 314 if (!wsaved) {
356 sizeof(struct reg_window32)); 315 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
316 sizeof(struct reg_window32));
317 } else {
318 struct reg_window32 *rp;
319
320 rp = &current_thread_info()->reg_window[wsaved - 1];
321 err |= __copy_to_user(sf, rp, sizeof(struct reg_window32));
322 }
357 if (err) 323 if (err)
358 goto sigsegv; 324 goto sigsegv;
359 325
@@ -399,21 +365,24 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
399 int signo, sigset_t *oldset, siginfo_t *info) 365 int signo, sigset_t *oldset, siginfo_t *info)
400{ 366{
401 struct rt_signal_frame __user *sf; 367 struct rt_signal_frame __user *sf;
402 int sigframe_size; 368 int sigframe_size, wsaved;
369 void __user *tail;
403 unsigned int psr; 370 unsigned int psr;
404 int err; 371 int err;
405 372
406 synchronize_user_stack(); 373 synchronize_user_stack();
407 sigframe_size = RT_ALIGNEDSZ; 374 wsaved = current_thread_info()->w_saved;
408 if (!used_math()) 375 sigframe_size = sizeof(*sf);
409 sigframe_size -= sizeof(__siginfo_fpu_t); 376 if (used_math())
377 sigframe_size += sizeof(__siginfo_fpu_t);
378 if (wsaved)
379 sigframe_size += sizeof(__siginfo_rwin_t);
410 sf = (struct rt_signal_frame __user *) 380 sf = (struct rt_signal_frame __user *)
411 get_sigframe(&ka->sa, regs, sigframe_size); 381 get_sigframe(&ka->sa, regs, sigframe_size);
412 if (invalid_frame_pointer(sf, sigframe_size)) 382 if (invalid_frame_pointer(sf, sigframe_size))
413 goto sigill; 383 goto sigill;
414 if (current_thread_info()->w_saved != 0)
415 goto sigill;
416 384
385 tail = sf + 1;
417 err = __put_user(regs->pc, &sf->regs.pc); 386 err = __put_user(regs->pc, &sf->regs.pc);
418 err |= __put_user(regs->npc, &sf->regs.npc); 387 err |= __put_user(regs->npc, &sf->regs.npc);
419 err |= __put_user(regs->y, &sf->regs.y); 388 err |= __put_user(regs->y, &sf->regs.y);
@@ -425,11 +394,21 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
425 err |= __put_user(0, &sf->extra_size); 394 err |= __put_user(0, &sf->extra_size);
426 395
427 if (psr & PSR_EF) { 396 if (psr & PSR_EF) {
428 err |= save_fpu_state(regs, &sf->fpu_state); 397 __siginfo_fpu_t *fp = tail;
429 err |= __put_user(&sf->fpu_state, &sf->fpu_save); 398 tail += sizeof(*fp);
399 err |= save_fpu_state(regs, fp);
400 err |= __put_user(fp, &sf->fpu_save);
430 } else { 401 } else {
431 err |= __put_user(0, &sf->fpu_save); 402 err |= __put_user(0, &sf->fpu_save);
432 } 403 }
404 if (wsaved) {
405 __siginfo_rwin_t *rwp = tail;
406 tail += sizeof(*rwp);
407 err |= save_rwin_state(wsaved, rwp);
408 err |= __put_user(rwp, &sf->rwin_save);
409 } else {
410 err |= __put_user(0, &sf->rwin_save);
411 }
433 err |= __copy_to_user(&sf->mask, &oldset->sig[0], sizeof(sigset_t)); 412 err |= __copy_to_user(&sf->mask, &oldset->sig[0], sizeof(sigset_t));
434 413
435 /* Setup sigaltstack */ 414 /* Setup sigaltstack */
@@ -437,8 +416,15 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
437 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags); 416 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags);
438 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size); 417 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size);
439 418
440 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 419 if (!wsaved) {
441 sizeof(struct reg_window32)); 420 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
421 sizeof(struct reg_window32));
422 } else {
423 struct reg_window32 *rp;
424
425 rp = &current_thread_info()->reg_window[wsaved - 1];
426 err |= __copy_to_user(sf, rp, sizeof(struct reg_window32));
427 }
442 428
443 err |= copy_siginfo_to_user(&sf->info, info); 429 err |= copy_siginfo_to_user(&sf->info, info);
444 430
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 006fe451588..47509df3b89 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -34,6 +34,7 @@
34 34
35#include "entry.h" 35#include "entry.h"
36#include "systbls.h" 36#include "systbls.h"
37#include "sigutil.h"
37 38
38#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 39#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
39 40
@@ -236,7 +237,7 @@ struct rt_signal_frame {
236 __siginfo_fpu_t __user *fpu_save; 237 __siginfo_fpu_t __user *fpu_save;
237 stack_t stack; 238 stack_t stack;
238 sigset_t mask; 239 sigset_t mask;
239 __siginfo_fpu_t fpu_state; 240 __siginfo_rwin_t *rwin_save;
240}; 241};
241 242
242static long _sigpause_common(old_sigset_t set) 243static long _sigpause_common(old_sigset_t set)
@@ -266,33 +267,12 @@ asmlinkage long sys_sigsuspend(old_sigset_t set)
266 return _sigpause_common(set); 267 return _sigpause_common(set);
267} 268}
268 269
269static inline int
270restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
271{
272 unsigned long *fpregs = current_thread_info()->fpregs;
273 unsigned long fprs;
274 int err;
275
276 err = __get_user(fprs, &fpu->si_fprs);
277 fprs_write(0);
278 regs->tstate &= ~TSTATE_PEF;
279 if (fprs & FPRS_DL)
280 err |= copy_from_user(fpregs, &fpu->si_float_regs[0],
281 (sizeof(unsigned int) * 32));
282 if (fprs & FPRS_DU)
283 err |= copy_from_user(fpregs+16, &fpu->si_float_regs[32],
284 (sizeof(unsigned int) * 32));
285 err |= __get_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
286 err |= __get_user(current_thread_info()->gsr[0], &fpu->si_gsr);
287 current_thread_info()->fpsaved[0] |= fprs;
288 return err;
289}
290
291void do_rt_sigreturn(struct pt_regs *regs) 270void do_rt_sigreturn(struct pt_regs *regs)
292{ 271{
293 struct rt_signal_frame __user *sf; 272 struct rt_signal_frame __user *sf;
294 unsigned long tpc, tnpc, tstate; 273 unsigned long tpc, tnpc, tstate;
295 __siginfo_fpu_t __user *fpu_save; 274 __siginfo_fpu_t __user *fpu_save;
275 __siginfo_rwin_t __user *rwin_save;
296 sigset_t set; 276 sigset_t set;
297 int err; 277 int err;
298 278
@@ -325,8 +305,8 @@ void do_rt_sigreturn(struct pt_regs *regs)
325 regs->tstate |= (tstate & (TSTATE_ASI | TSTATE_ICC | TSTATE_XCC)); 305 regs->tstate |= (tstate & (TSTATE_ASI | TSTATE_ICC | TSTATE_XCC));
326 306
327 err |= __get_user(fpu_save, &sf->fpu_save); 307 err |= __get_user(fpu_save, &sf->fpu_save);
328 if (fpu_save) 308 if (!err && fpu_save)
329 err |= restore_fpu_state(regs, &sf->fpu_state); 309 err |= restore_fpu_state(regs, fpu_save);
330 310
331 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t)); 311 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t));
332 err |= do_sigaltstack(&sf->stack, NULL, (unsigned long)sf); 312 err |= do_sigaltstack(&sf->stack, NULL, (unsigned long)sf);
@@ -334,6 +314,12 @@ void do_rt_sigreturn(struct pt_regs *regs)
334 if (err) 314 if (err)
335 goto segv; 315 goto segv;
336 316
317 err |= __get_user(rwin_save, &sf->rwin_save);
318 if (!err && rwin_save) {
319 if (restore_rwin_state(rwin_save))
320 goto segv;
321 }
322
337 regs->tpc = tpc; 323 regs->tpc = tpc;
338 regs->tnpc = tnpc; 324 regs->tnpc = tnpc;
339 325
@@ -351,34 +337,13 @@ segv:
351} 337}
352 338
353/* Checks if the fp is valid */ 339/* Checks if the fp is valid */
354static int invalid_frame_pointer(void __user *fp, int fplen) 340static int invalid_frame_pointer(void __user *fp)
355{ 341{
356 if (((unsigned long) fp) & 15) 342 if (((unsigned long) fp) & 15)
357 return 1; 343 return 1;
358 return 0; 344 return 0;
359} 345}
360 346
361static inline int
362save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
363{
364 unsigned long *fpregs = current_thread_info()->fpregs;
365 unsigned long fprs;
366 int err = 0;
367
368 fprs = current_thread_info()->fpsaved[0];
369 if (fprs & FPRS_DL)
370 err |= copy_to_user(&fpu->si_float_regs[0], fpregs,
371 (sizeof(unsigned int) * 32));
372 if (fprs & FPRS_DU)
373 err |= copy_to_user(&fpu->si_float_regs[32], fpregs+16,
374 (sizeof(unsigned int) * 32));
375 err |= __put_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
376 err |= __put_user(current_thread_info()->gsr[0], &fpu->si_gsr);
377 err |= __put_user(fprs, &fpu->si_fprs);
378
379 return err;
380}
381
382static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize) 347static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize)
383{ 348{
384 unsigned long sp = regs->u_regs[UREG_FP] + STACK_BIAS; 349 unsigned long sp = regs->u_regs[UREG_FP] + STACK_BIAS;
@@ -414,34 +379,48 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
414 int signo, sigset_t *oldset, siginfo_t *info) 379 int signo, sigset_t *oldset, siginfo_t *info)
415{ 380{
416 struct rt_signal_frame __user *sf; 381 struct rt_signal_frame __user *sf;
417 int sigframe_size, err; 382 int wsaved, err, sf_size;
383 void __user *tail;
418 384
419 /* 1. Make sure everything is clean */ 385 /* 1. Make sure everything is clean */
420 synchronize_user_stack(); 386 synchronize_user_stack();
421 save_and_clear_fpu(); 387 save_and_clear_fpu();
422 388
423 sigframe_size = sizeof(struct rt_signal_frame); 389 wsaved = get_thread_wsaved();
424 if (!(current_thread_info()->fpsaved[0] & FPRS_FEF))
425 sigframe_size -= sizeof(__siginfo_fpu_t);
426 390
391 sf_size = sizeof(struct rt_signal_frame);
392 if (current_thread_info()->fpsaved[0] & FPRS_FEF)
393 sf_size += sizeof(__siginfo_fpu_t);
394 if (wsaved)
395 sf_size += sizeof(__siginfo_rwin_t);
427 sf = (struct rt_signal_frame __user *) 396 sf = (struct rt_signal_frame __user *)
428 get_sigframe(ka, regs, sigframe_size); 397 get_sigframe(ka, regs, sf_size);
429
430 if (invalid_frame_pointer (sf, sigframe_size))
431 goto sigill;
432 398
433 if (get_thread_wsaved() != 0) 399 if (invalid_frame_pointer (sf))
434 goto sigill; 400 goto sigill;
435 401
402 tail = (sf + 1);
403
436 /* 2. Save the current process state */ 404 /* 2. Save the current process state */
437 err = copy_to_user(&sf->regs, regs, sizeof (*regs)); 405 err = copy_to_user(&sf->regs, regs, sizeof (*regs));
438 406
439 if (current_thread_info()->fpsaved[0] & FPRS_FEF) { 407 if (current_thread_info()->fpsaved[0] & FPRS_FEF) {
440 err |= save_fpu_state(regs, &sf->fpu_state); 408 __siginfo_fpu_t __user *fpu_save = tail;
441 err |= __put_user((u64)&sf->fpu_state, &sf->fpu_save); 409 tail += sizeof(__siginfo_fpu_t);
410 err |= save_fpu_state(regs, fpu_save);
411 err |= __put_user((u64)fpu_save, &sf->fpu_save);
442 } else { 412 } else {
443 err |= __put_user(0, &sf->fpu_save); 413 err |= __put_user(0, &sf->fpu_save);
444 } 414 }
415 if (wsaved) {
416 __siginfo_rwin_t __user *rwin_save = tail;
417 tail += sizeof(__siginfo_rwin_t);
418 err |= save_rwin_state(wsaved, rwin_save);
419 err |= __put_user((u64)rwin_save, &sf->rwin_save);
420 set_thread_wsaved(0);
421 } else {
422 err |= __put_user(0, &sf->rwin_save);
423 }
445 424
446 /* Setup sigaltstack */ 425 /* Setup sigaltstack */
447 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); 426 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp);
@@ -450,10 +429,17 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
450 429
451 err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t)); 430 err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t));
452 431
453 err |= copy_in_user((u64 __user *)sf, 432 if (!wsaved) {
454 (u64 __user *)(regs->u_regs[UREG_FP]+STACK_BIAS), 433 err |= copy_in_user((u64 __user *)sf,
455 sizeof(struct reg_window)); 434 (u64 __user *)(regs->u_regs[UREG_FP] +
435 STACK_BIAS),
436 sizeof(struct reg_window));
437 } else {
438 struct reg_window *rp;
456 439
440 rp = &current_thread_info()->reg_window[wsaved - 1];
441 err |= copy_to_user(sf, rp, sizeof(struct reg_window));
442 }
457 if (info) 443 if (info)
458 err |= copy_siginfo_to_user(&sf->info, info); 444 err |= copy_siginfo_to_user(&sf->info, info);
459 else { 445 else {
diff --git a/arch/sparc/kernel/sigutil.h b/arch/sparc/kernel/sigutil.h
new file mode 100644
index 00000000000..d223aa432bb
--- /dev/null
+++ b/arch/sparc/kernel/sigutil.h
@@ -0,0 +1,9 @@
1#ifndef _SIGUTIL_H
2#define _SIGUTIL_H
3
4int save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu);
5int restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu);
6int save_rwin_state(int wsaved, __siginfo_rwin_t __user *rwin);
7int restore_rwin_state(__siginfo_rwin_t __user *rp);
8
9#endif /* _SIGUTIL_H */
diff --git a/arch/sparc/kernel/sigutil_32.c b/arch/sparc/kernel/sigutil_32.c
new file mode 100644
index 00000000000..35c7897b009
--- /dev/null
+++ b/arch/sparc/kernel/sigutil_32.c
@@ -0,0 +1,120 @@
1#include <linux/kernel.h>
2#include <linux/types.h>
3#include <linux/thread_info.h>
4#include <linux/uaccess.h>
5#include <linux/sched.h>
6
7#include <asm/sigcontext.h>
8#include <asm/fpumacro.h>
9#include <asm/ptrace.h>
10
11#include "sigutil.h"
12
13int save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
14{
15 int err = 0;
16#ifdef CONFIG_SMP
17 if (test_tsk_thread_flag(current, TIF_USEDFPU)) {
18 put_psr(get_psr() | PSR_EF);
19 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
20 &current->thread.fpqueue[0], &current->thread.fpqdepth);
21 regs->psr &= ~(PSR_EF);
22 clear_tsk_thread_flag(current, TIF_USEDFPU);
23 }
24#else
25 if (current == last_task_used_math) {
26 put_psr(get_psr() | PSR_EF);
27 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
28 &current->thread.fpqueue[0], &current->thread.fpqdepth);
29 last_task_used_math = NULL;
30 regs->psr &= ~(PSR_EF);
31 }
32#endif
33 err |= __copy_to_user(&fpu->si_float_regs[0],
34 &current->thread.float_regs[0],
35 (sizeof(unsigned long) * 32));
36 err |= __put_user(current->thread.fsr, &fpu->si_fsr);
37 err |= __put_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
38 if (current->thread.fpqdepth != 0)
39 err |= __copy_to_user(&fpu->si_fpqueue[0],
40 &current->thread.fpqueue[0],
41 ((sizeof(unsigned long) +
42 (sizeof(unsigned long *)))*16));
43 clear_used_math();
44 return err;
45}
46
47int restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
48{
49 int err;
50#ifdef CONFIG_SMP
51 if (test_tsk_thread_flag(current, TIF_USEDFPU))
52 regs->psr &= ~PSR_EF;
53#else
54 if (current == last_task_used_math) {
55 last_task_used_math = NULL;
56 regs->psr &= ~PSR_EF;
57 }
58#endif
59 set_used_math();
60 clear_tsk_thread_flag(current, TIF_USEDFPU);
61
62 if (!access_ok(VERIFY_READ, fpu, sizeof(*fpu)))
63 return -EFAULT;
64
65 err = __copy_from_user(&current->thread.float_regs[0], &fpu->si_float_regs[0],
66 (sizeof(unsigned long) * 32));
67 err |= __get_user(current->thread.fsr, &fpu->si_fsr);
68 err |= __get_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
69 if (current->thread.fpqdepth != 0)
70 err |= __copy_from_user(&current->thread.fpqueue[0],
71 &fpu->si_fpqueue[0],
72 ((sizeof(unsigned long) +
73 (sizeof(unsigned long *)))*16));
74 return err;
75}
76
77int save_rwin_state(int wsaved, __siginfo_rwin_t __user *rwin)
78{
79 int i, err = __put_user(wsaved, &rwin->wsaved);
80
81 for (i = 0; i < wsaved; i++) {
82 struct reg_window32 *rp;
83 unsigned long fp;
84
85 rp = &current_thread_info()->reg_window[i];
86 fp = current_thread_info()->rwbuf_stkptrs[i];
87 err |= copy_to_user(&rwin->reg_window[i], rp,
88 sizeof(struct reg_window32));
89 err |= __put_user(fp, &rwin->rwbuf_stkptrs[i]);
90 }
91 return err;
92}
93
94int restore_rwin_state(__siginfo_rwin_t __user *rp)
95{
96 struct thread_info *t = current_thread_info();
97 int i, wsaved, err;
98
99 __get_user(wsaved, &rp->wsaved);
100 if (wsaved > NSWINS)
101 return -EFAULT;
102
103 err = 0;
104 for (i = 0; i < wsaved; i++) {
105 err |= copy_from_user(&t->reg_window[i],
106 &rp->reg_window[i],
107 sizeof(struct reg_window32));
108 err |= __get_user(t->rwbuf_stkptrs[i],
109 &rp->rwbuf_stkptrs[i]);
110 }
111 if (err)
112 return err;
113
114 t->w_saved = wsaved;
115 synchronize_user_stack();
116 if (t->w_saved)
117 return -EFAULT;
118 return 0;
119
120}
diff --git a/arch/sparc/kernel/sigutil_64.c b/arch/sparc/kernel/sigutil_64.c
new file mode 100644
index 00000000000..e7dc508c38e
--- /dev/null
+++ b/arch/sparc/kernel/sigutil_64.c
@@ -0,0 +1,93 @@
1#include <linux/kernel.h>
2#include <linux/types.h>
3#include <linux/thread_info.h>
4#include <linux/uaccess.h>
5
6#include <asm/sigcontext.h>
7#include <asm/fpumacro.h>
8#include <asm/ptrace.h>
9
10#include "sigutil.h"
11
12int save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
13{
14 unsigned long *fpregs = current_thread_info()->fpregs;
15 unsigned long fprs;
16 int err = 0;
17
18 fprs = current_thread_info()->fpsaved[0];
19 if (fprs & FPRS_DL)
20 err |= copy_to_user(&fpu->si_float_regs[0], fpregs,
21 (sizeof(unsigned int) * 32));
22 if (fprs & FPRS_DU)
23 err |= copy_to_user(&fpu->si_float_regs[32], fpregs+16,
24 (sizeof(unsigned int) * 32));
25 err |= __put_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
26 err |= __put_user(current_thread_info()->gsr[0], &fpu->si_gsr);
27 err |= __put_user(fprs, &fpu->si_fprs);
28
29 return err;
30}
31
32int restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
33{
34 unsigned long *fpregs = current_thread_info()->fpregs;
35 unsigned long fprs;
36 int err;
37
38 err = __get_user(fprs, &fpu->si_fprs);
39 fprs_write(0);
40 regs->tstate &= ~TSTATE_PEF;
41 if (fprs & FPRS_DL)
42 err |= copy_from_user(fpregs, &fpu->si_float_regs[0],
43 (sizeof(unsigned int) * 32));
44 if (fprs & FPRS_DU)
45 err |= copy_from_user(fpregs+16, &fpu->si_float_regs[32],
46 (sizeof(unsigned int) * 32));
47 err |= __get_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
48 err |= __get_user(current_thread_info()->gsr[0], &fpu->si_gsr);
49 current_thread_info()->fpsaved[0] |= fprs;
50 return err;
51}
52
53int save_rwin_state(int wsaved, __siginfo_rwin_t __user *rwin)
54{
55 int i, err = __put_user(wsaved, &rwin->wsaved);
56
57 for (i = 0; i < wsaved; i++) {
58 struct reg_window *rp = &current_thread_info()->reg_window[i];
59 unsigned long fp = current_thread_info()->rwbuf_stkptrs[i];
60
61 err |= copy_to_user(&rwin->reg_window[i], rp,
62 sizeof(struct reg_window));
63 err |= __put_user(fp, &rwin->rwbuf_stkptrs[i]);
64 }
65 return err;
66}
67
68int restore_rwin_state(__siginfo_rwin_t __user *rp)
69{
70 struct thread_info *t = current_thread_info();
71 int i, wsaved, err;
72
73 __get_user(wsaved, &rp->wsaved);
74 if (wsaved > NSWINS)
75 return -EFAULT;
76
77 err = 0;
78 for (i = 0; i < wsaved; i++) {
79 err |= copy_from_user(&t->reg_window[i],
80 &rp->reg_window[i],
81 sizeof(struct reg_window));
82 err |= __get_user(t->rwbuf_stkptrs[i],
83 &rp->rwbuf_stkptrs[i]);
84 }
85 if (err)
86 return err;
87
88 set_thread_wsaved(wsaved);
89 synchronize_user_stack();
90 if (get_thread_wsaved())
91 return -EFAULT;
92 return 0;
93}
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index 21b125341bf..f671e7fd6dd 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -22,7 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23 23
24#include <asm/ptrace.h> 24#include <asm/ptrace.h>
25#include <asm/atomic.h> 25#include <linux/atomic.h>
26 26
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/page.h> 28#include <asm/page.h>
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 99cb17251bb..4a442c32e11 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -28,7 +28,7 @@
28 28
29#include <asm/head.h> 29#include <asm/head.h>
30#include <asm/ptrace.h> 30#include <asm/ptrace.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/tlbflush.h> 32#include <asm/tlbflush.h>
33#include <asm/mmu_context.h> 33#include <asm/mmu_context.h>
34#include <asm/cpudata.h> 34#include <asm/cpudata.h>
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c
index 372ad59c4cb..83b47ab02d9 100644
--- a/arch/sparc/kernel/sparc_ksyms_64.c
+++ b/arch/sparc/kernel/sparc_ksyms_64.c
@@ -8,6 +8,7 @@
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/bitops.h>
11 12
12#include <asm/system.h> 13#include <asm/system.h>
13#include <asm/cpudata.h> 14#include <asm/cpudata.h>
@@ -38,5 +39,15 @@ EXPORT_SYMBOL(sun4v_niagara_setperf);
38EXPORT_SYMBOL(sun4v_niagara2_getperf); 39EXPORT_SYMBOL(sun4v_niagara2_getperf);
39EXPORT_SYMBOL(sun4v_niagara2_setperf); 40EXPORT_SYMBOL(sun4v_niagara2_setperf);
40 41
42/* from hweight.S */
43EXPORT_SYMBOL(__arch_hweight8);
44EXPORT_SYMBOL(__arch_hweight16);
45EXPORT_SYMBOL(__arch_hweight32);
46EXPORT_SYMBOL(__arch_hweight64);
47
48/* from ffs_ffz.S */
49EXPORT_SYMBOL(ffs);
50EXPORT_SYMBOL(__ffs);
51
41/* Exporting a symbol from /init/main.c */ 52/* Exporting a symbol from /init/main.c */
42EXPORT_SYMBOL(saved_command_line); 53EXPORT_SYMBOL(saved_command_line);
diff --git a/arch/sparc/kernel/sstate.c b/arch/sparc/kernel/sstate.c
index 8cdbe5946b4..c59af546f52 100644
--- a/arch/sparc/kernel/sstate.c
+++ b/arch/sparc/kernel/sstate.c
@@ -14,14 +14,9 @@
14#include <asm/head.h> 14#include <asm/head.h>
15#include <asm/io.h> 15#include <asm/io.h>
16 16
17static int hv_supports_soft_state; 17#include "kernel.h"
18
19static unsigned long kimage_addr_to_ra(const char *p)
20{
21 unsigned long val = (unsigned long) p;
22 18
23 return kern_base + (val - KERNBASE); 19static int hv_supports_soft_state;
24}
25 20
26static void do_set_sstate(unsigned long state, const char *msg) 21static void do_set_sstate(unsigned long state, const char *msg)
27{ 22{
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index 44e5faf1ad5..d97f3eb72e0 100644
--- a/arch/sparc/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
@@ -81,7 +81,6 @@ SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4)
81SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5) 81SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5)
82SIGN2(sys32_bdflush, sys_bdflush, %o0, %o1) 82SIGN2(sys32_bdflush, sys_bdflush, %o0, %o1)
83SIGN1(sys32_mlockall, sys_mlockall, %o0) 83SIGN1(sys32_mlockall, sys_mlockall, %o0)
84SIGN1(sys32_nfsservctl, compat_sys_nfsservctl, %o0)
85SIGN1(sys32_clock_nanosleep, compat_sys_clock_nanosleep, %o1) 84SIGN1(sys32_clock_nanosleep, compat_sys_clock_nanosleep, %o1)
86SIGN1(sys32_timer_settime, compat_sys_timer_settime, %o1) 85SIGN1(sys32_timer_settime, compat_sys_timer_settime, %o1)
87SIGN1(sys32_io_submit, compat_sys_io_submit, %o1) 86SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 6e492d59f6b..09d8ec45445 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -67,7 +67,7 @@ sys_call_table:
67/*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall 67/*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
68/*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler 68/*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
69/*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep 69/*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
70/*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl 70/*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_ni_syscall
71/*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep 71/*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
72/*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun 72/*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
73/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy 73/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index f566518483b..edbec45d468 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -68,7 +68,7 @@ sys_call_table32:
68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall 68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall
69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler 69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler
70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep 70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
71/*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl 71/*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys_nis_syscall
72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep 72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun 73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
@@ -145,7 +145,7 @@ sys_call_table:
145 .word sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall 145 .word sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
146/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler 146/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
147 .word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep 147 .word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
148/*250*/ .word sys_64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl 148/*250*/ .word sys_64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nis_syscall
149 .word sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep 149 .word sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
150/*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun 150/*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
151 .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy 151 .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index 35cff1673aa..76e4ac1a13e 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -22,6 +22,7 @@
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <linux/perf_event.h> 23#include <linux/perf_event.h>
24#include <linux/ratelimit.h> 24#include <linux/ratelimit.h>
25#include <linux/bitops.h>
25#include <asm/fpumacro.h> 26#include <asm/fpumacro.h>
26 27
27enum direction { 28enum direction {
@@ -373,16 +374,11 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
373 } 374 }
374} 375}
375 376
376static char popc_helper[] = {
3770, 1, 1, 2, 1, 2, 2, 3,
3781, 2, 2, 3, 2, 3, 3, 4,
379};
380
381int handle_popc(u32 insn, struct pt_regs *regs) 377int handle_popc(u32 insn, struct pt_regs *regs)
382{ 378{
383 u64 value;
384 int ret, i, rd = ((insn >> 25) & 0x1f);
385 int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; 379 int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
380 int ret, rd = ((insn >> 25) & 0x1f);
381 u64 value;
386 382
387 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, 0); 383 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, 0);
388 if (insn & 0x2000) { 384 if (insn & 0x2000) {
@@ -392,10 +388,7 @@ int handle_popc(u32 insn, struct pt_regs *regs)
392 maybe_flush_windows(0, insn & 0x1f, rd, from_kernel); 388 maybe_flush_windows(0, insn & 0x1f, rd, from_kernel);
393 value = fetch_reg(insn & 0x1f, regs); 389 value = fetch_reg(insn & 0x1f, regs);
394 } 390 }
395 for (ret = 0, i = 0; i < 16; i++) { 391 ret = hweight64(value);
396 ret += popc_helper[value & 0xf];
397 value >>= 4;
398 }
399 if (rd < 16) { 392 if (rd < 16) {
400 if (rd) 393 if (rd)
401 regs->u_regs[rd] = ret; 394 regs->u_regs[rd] = ret;
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index c0220759003..0e1605697b4 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -107,7 +107,26 @@ SECTIONS
107 *(.sun4v_2insn_patch) 107 *(.sun4v_2insn_patch)
108 __sun4v_2insn_patch_end = .; 108 __sun4v_2insn_patch_end = .;
109 } 109 }
110 110 .swapper_tsb_phys_patch : {
111 __swapper_tsb_phys_patch = .;
112 *(.swapper_tsb_phys_patch)
113 __swapper_tsb_phys_patch_end = .;
114 }
115 .swapper_4m_tsb_phys_patch : {
116 __swapper_4m_tsb_phys_patch = .;
117 *(.swapper_4m_tsb_phys_patch)
118 __swapper_4m_tsb_phys_patch_end = .;
119 }
120 .popc_3insn_patch : {
121 __popc_3insn_patch = .;
122 *(.popc_3insn_patch)
123 __popc_3insn_patch_end = .;
124 }
125 .popc_6insn_patch : {
126 __popc_6insn_patch = .;
127 *(.popc_6insn_patch)
128 __popc_6insn_patch_end = .;
129 }
111 PERCPU_SECTION(SMP_CACHE_BYTES) 130 PERCPU_SECTION(SMP_CACHE_BYTES)
112 131
113 . = ALIGN(PAGE_SIZE); 132 . = ALIGN(PAGE_SIZE);
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 7f01b8fce8b..a3fc4375a15 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -31,13 +31,13 @@ lib-$(CONFIG_SPARC64) += NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o
31lib-$(CONFIG_SPARC64) += NGpatch.o NGpage.o NGbzero.o 31lib-$(CONFIG_SPARC64) += NGpatch.o NGpage.o NGbzero.o
32 32
33lib-$(CONFIG_SPARC64) += NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o 33lib-$(CONFIG_SPARC64) += NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o
34lib-$(CONFIG_SPARC64) += NG2patch.o NG2page.o 34lib-$(CONFIG_SPARC64) += NG2patch.o
35 35
36lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o 36lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o
37lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o 37lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o
38 38
39lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o 39lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
40lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o 40lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o
41 41
42obj-y += iomap.o 42obj-y += iomap.o
43obj-$(CONFIG_SPARC32) += atomic32.o 43obj-$(CONFIG_SPARC32) += atomic32.o
diff --git a/arch/sparc/lib/NG2page.S b/arch/sparc/lib/NG2page.S
deleted file mode 100644
index 73b6b7c72cb..00000000000
--- a/arch/sparc/lib/NG2page.S
+++ /dev/null
@@ -1,61 +0,0 @@
1/* NG2page.S: Niagara-2 optimized clear and copy page.
2 *
3 * Copyright (C) 2007 (davem@davemloft.net)
4 */
5
6#include <asm/asi.h>
7#include <asm/page.h>
8#include <asm/visasm.h>
9
10 .text
11 .align 32
12
13 /* This is heavily simplified from the sun4u variants
14 * because Niagara-2 does not have any D-cache aliasing issues.
15 */
16NG2copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
17 prefetch [%o1 + 0x00], #one_read
18 prefetch [%o1 + 0x40], #one_read
19 VISEntryHalf
20 set PAGE_SIZE, %g7
21 sub %o0, %o1, %g3
221: stxa %g0, [%o1 + %g3] ASI_BLK_INIT_QUAD_LDD_P
23 subcc %g7, 64, %g7
24 ldda [%o1] ASI_BLK_P, %f0
25 stda %f0, [%o1 + %g3] ASI_BLK_P
26 add %o1, 64, %o1
27 bne,pt %xcc, 1b
28 prefetch [%o1 + 0x40], #one_read
29 membar #Sync
30 VISExitHalf
31 retl
32 nop
33
34#define BRANCH_ALWAYS 0x10680000
35#define NOP 0x01000000
36#define NG_DO_PATCH(OLD, NEW) \
37 sethi %hi(NEW), %g1; \
38 or %g1, %lo(NEW), %g1; \
39 sethi %hi(OLD), %g2; \
40 or %g2, %lo(OLD), %g2; \
41 sub %g1, %g2, %g1; \
42 sethi %hi(BRANCH_ALWAYS), %g3; \
43 sll %g1, 11, %g1; \
44 srl %g1, 11 + 2, %g1; \
45 or %g3, %lo(BRANCH_ALWAYS), %g3; \
46 or %g3, %g1, %g3; \
47 stw %g3, [%g2]; \
48 sethi %hi(NOP), %g3; \
49 or %g3, %lo(NOP), %g3; \
50 stw %g3, [%g2 + 0x4]; \
51 flush %g2;
52
53 .globl niagara2_patch_pageops
54 .type niagara2_patch_pageops,#function
55niagara2_patch_pageops:
56 NG_DO_PATCH(copy_user_page, NG2copy_user_page)
57 NG_DO_PATCH(_clear_page, NGclear_page)
58 NG_DO_PATCH(clear_user_page, NGclear_user_page)
59 retl
60 nop
61 .size niagara2_patch_pageops,.-niagara2_patch_pageops
diff --git a/arch/sparc/lib/NGpage.S b/arch/sparc/lib/NGpage.S
index 428920de05b..b9e790b9c6b 100644
--- a/arch/sparc/lib/NGpage.S
+++ b/arch/sparc/lib/NGpage.S
@@ -16,55 +16,91 @@
16 */ 16 */
17 17
18NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ 18NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
19 prefetch [%o1 + 0x00], #one_read 19 save %sp, -192, %sp
20 mov 8, %g1 20 rd %asi, %g3
21 mov 16, %g2 21 wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
22 mov 24, %g3
23 set PAGE_SIZE, %g7 22 set PAGE_SIZE, %g7
23 prefetch [%i1 + 0x00], #one_read
24 prefetch [%i1 + 0x40], #one_read
24 25
251: ldda [%o1 + %g0] ASI_BLK_INIT_QUAD_LDD_P, %o2 261: prefetch [%i1 + 0x80], #one_read
26 ldda [%o1 + %g2] ASI_BLK_INIT_QUAD_LDD_P, %o4 27 prefetch [%i1 + 0xc0], #one_read
27 prefetch [%o1 + 0x40], #one_read 28 ldda [%i1 + 0x00] %asi, %o2
28 add %o1, 32, %o1 29 ldda [%i1 + 0x10] %asi, %o4
29 stxa %o2, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P 30 ldda [%i1 + 0x20] %asi, %l2
30 stxa %o3, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P 31 ldda [%i1 + 0x30] %asi, %l4
31 ldda [%o1 + %g0] ASI_BLK_INIT_QUAD_LDD_P, %o2 32 stxa %o2, [%i0 + 0x00] %asi
32 stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P 33 stxa %o3, [%i0 + 0x08] %asi
33 stxa %o5, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P 34 stxa %o4, [%i0 + 0x10] %asi
34 ldda [%o1 + %g2] ASI_BLK_INIT_QUAD_LDD_P, %o4 35 stxa %o5, [%i0 + 0x18] %asi
35 add %o1, 32, %o1 36 stxa %l2, [%i0 + 0x20] %asi
36 add %o0, 32, %o0 37 stxa %l3, [%i0 + 0x28] %asi
37 stxa %o2, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P 38 stxa %l4, [%i0 + 0x30] %asi
38 stxa %o3, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P 39 stxa %l5, [%i0 + 0x38] %asi
39 stxa %o4, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P 40 ldda [%i1 + 0x40] %asi, %o2
40 stxa %o5, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P 41 ldda [%i1 + 0x50] %asi, %o4
41 subcc %g7, 64, %g7 42 ldda [%i1 + 0x60] %asi, %l2
43 ldda [%i1 + 0x70] %asi, %l4
44 stxa %o2, [%i0 + 0x40] %asi
45 stxa %o3, [%i0 + 0x48] %asi
46 stxa %o4, [%i0 + 0x50] %asi
47 stxa %o5, [%i0 + 0x58] %asi
48 stxa %l2, [%i0 + 0x60] %asi
49 stxa %l3, [%i0 + 0x68] %asi
50 stxa %l4, [%i0 + 0x70] %asi
51 stxa %l5, [%i0 + 0x78] %asi
52 add %i1, 128, %i1
53 subcc %g7, 128, %g7
42 bne,pt %xcc, 1b 54 bne,pt %xcc, 1b
43 add %o0, 32, %o0 55 add %i0, 128, %i0
56 wr %g3, 0x0, %asi
44 membar #Sync 57 membar #Sync
45 retl 58 ret
46 nop 59 restore
47 60
48 .globl NGclear_page, NGclear_user_page 61 .align 32
49NGclear_page: /* %o0=dest */ 62NGclear_page: /* %o0=dest */
50NGclear_user_page: /* %o0=dest, %o1=vaddr */ 63NGclear_user_page: /* %o0=dest, %o1=vaddr */
51 mov 8, %g1 64 rd %asi, %g3
52 mov 16, %g2 65 wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
53 mov 24, %g3
54 set PAGE_SIZE, %g7 66 set PAGE_SIZE, %g7
55 67
561: stxa %g0, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P 681: stxa %g0, [%o0 + 0x00] %asi
57 stxa %g0, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P 69 stxa %g0, [%o0 + 0x08] %asi
58 stxa %g0, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P 70 stxa %g0, [%o0 + 0x10] %asi
59 stxa %g0, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P 71 stxa %g0, [%o0 + 0x18] %asi
60 add %o0, 32, %o0 72 stxa %g0, [%o0 + 0x20] %asi
61 stxa %g0, [%o0 + %g0] ASI_BLK_INIT_QUAD_LDD_P 73 stxa %g0, [%o0 + 0x28] %asi
62 stxa %g0, [%o0 + %g1] ASI_BLK_INIT_QUAD_LDD_P 74 stxa %g0, [%o0 + 0x30] %asi
63 stxa %g0, [%o0 + %g2] ASI_BLK_INIT_QUAD_LDD_P 75 stxa %g0, [%o0 + 0x38] %asi
64 stxa %g0, [%o0 + %g3] ASI_BLK_INIT_QUAD_LDD_P 76 stxa %g0, [%o0 + 0x40] %asi
65 subcc %g7, 64, %g7 77 stxa %g0, [%o0 + 0x48] %asi
78 stxa %g0, [%o0 + 0x50] %asi
79 stxa %g0, [%o0 + 0x58] %asi
80 stxa %g0, [%o0 + 0x60] %asi
81 stxa %g0, [%o0 + 0x68] %asi
82 stxa %g0, [%o0 + 0x70] %asi
83 stxa %g0, [%o0 + 0x78] %asi
84 stxa %g0, [%o0 + 0x80] %asi
85 stxa %g0, [%o0 + 0x88] %asi
86 stxa %g0, [%o0 + 0x90] %asi
87 stxa %g0, [%o0 + 0x98] %asi
88 stxa %g0, [%o0 + 0xa0] %asi
89 stxa %g0, [%o0 + 0xa8] %asi
90 stxa %g0, [%o0 + 0xb0] %asi
91 stxa %g0, [%o0 + 0xb8] %asi
92 stxa %g0, [%o0 + 0xc0] %asi
93 stxa %g0, [%o0 + 0xc8] %asi
94 stxa %g0, [%o0 + 0xd0] %asi
95 stxa %g0, [%o0 + 0xd8] %asi
96 stxa %g0, [%o0 + 0xe0] %asi
97 stxa %g0, [%o0 + 0xe8] %asi
98 stxa %g0, [%o0 + 0xf0] %asi
99 stxa %g0, [%o0 + 0xf8] %asi
100 subcc %g7, 256, %g7
66 bne,pt %xcc, 1b 101 bne,pt %xcc, 1b
67 add %o0, 32, %o0 102 add %o0, 256, %o0
103 wr %g3, 0x0, %asi
68 membar #Sync 104 membar #Sync
69 retl 105 retl
70 nop 106 nop
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index d3c7a12ad87..1d32b54089a 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -7,7 +7,7 @@
7 * Based on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf 7 * Based on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf
8 */ 8 */
9 9
10#include <asm/atomic.h> 10#include <linux/atomic.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/module.h> 12#include <linux/module.h>
13 13
@@ -55,7 +55,7 @@ int atomic_cmpxchg(atomic_t *v, int old, int new)
55} 55}
56EXPORT_SYMBOL(atomic_cmpxchg); 56EXPORT_SYMBOL(atomic_cmpxchg);
57 57
58int atomic_add_unless(atomic_t *v, int a, int u) 58int __atomic_add_unless(atomic_t *v, int a, int u)
59{ 59{
60 int ret; 60 int ret;
61 unsigned long flags; 61 unsigned long flags;
@@ -65,9 +65,9 @@ int atomic_add_unless(atomic_t *v, int a, int u)
65 if (ret != u) 65 if (ret != u)
66 v->counter += a; 66 v->counter += a;
67 spin_unlock_irqrestore(ATOMIC_HASH(v), flags); 67 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
68 return ret != u; 68 return ret;
69} 69}
70EXPORT_SYMBOL(atomic_add_unless); 70EXPORT_SYMBOL(__atomic_add_unless);
71 71
72/* Atomic operations are already serializing */ 72/* Atomic operations are already serializing */
73void atomic_set(atomic_t *v, int i) 73void atomic_set(atomic_t *v, int i)
diff --git a/arch/sparc/lib/ffs.S b/arch/sparc/lib/ffs.S
new file mode 100644
index 00000000000..b39389f6989
--- /dev/null
+++ b/arch/sparc/lib/ffs.S
@@ -0,0 +1,84 @@
1#include <linux/linkage.h>
2
3 .register %g2,#scratch
4
5 .text
6 .align 32
7
8ENTRY(ffs)
9 brnz,pt %o0, 1f
10 mov 1, %o1
11 retl
12 clr %o0
13 nop
14 nop
15ENTRY(__ffs)
16 sllx %o0, 32, %g1 /* 1 */
17 srlx %o0, 32, %g2
18
19 clr %o1 /* 2 */
20 movrz %g1, %g2, %o0
21
22 movrz %g1, 32, %o1 /* 3 */
231: clr %o2
24
25 sllx %o0, (64 - 16), %g1 /* 4 */
26 srlx %o0, 16, %g2
27
28 movrz %g1, %g2, %o0 /* 5 */
29 clr %o3
30
31 movrz %g1, 16, %o2 /* 6 */
32 clr %o4
33
34 and %o0, 0xff, %g1 /* 7 */
35 srlx %o0, 8, %g2
36
37 movrz %g1, %g2, %o0 /* 8 */
38 clr %o5
39
40 movrz %g1, 8, %o3 /* 9 */
41 add %o2, %o1, %o2
42
43 and %o0, 0xf, %g1 /* 10 */
44 srlx %o0, 4, %g2
45
46 movrz %g1, %g2, %o0 /* 11 */
47 add %o2, %o3, %o2
48
49 movrz %g1, 4, %o4 /* 12 */
50
51 and %o0, 0x3, %g1 /* 13 */
52 srlx %o0, 2, %g2
53
54 movrz %g1, %g2, %o0 /* 14 */
55 add %o2, %o4, %o2
56
57 movrz %g1, 2, %o5 /* 15 */
58
59 and %o0, 0x1, %g1 /* 16 */
60
61 add %o2, %o5, %o2 /* 17 */
62 xor %g1, 0x1, %g1
63
64 retl /* 18 */
65 add %o2, %g1, %o0
66ENDPROC(ffs)
67ENDPROC(__ffs)
68
69 .section .popc_6insn_patch, "ax"
70 .word ffs
71 brz,pn %o0, 98f
72 neg %o0, %g1
73 xnor %o0, %g1, %o1
74 popc %o1, %o0
7598: retl
76 nop
77 .word __ffs
78 neg %o0, %g1
79 xnor %o0, %g1, %o1
80 popc %o1, %o0
81 retl
82 sub %o0, 1, %o0
83 nop
84 .previous
diff --git a/arch/sparc/lib/hweight.S b/arch/sparc/lib/hweight.S
new file mode 100644
index 00000000000..95414e0a680
--- /dev/null
+++ b/arch/sparc/lib/hweight.S
@@ -0,0 +1,51 @@
1#include <linux/linkage.h>
2
3 .text
4 .align 32
5ENTRY(__arch_hweight8)
6 ba,pt %xcc, __sw_hweight8
7 nop
8 nop
9ENDPROC(__arch_hweight8)
10 .section .popc_3insn_patch, "ax"
11 .word __arch_hweight8
12 sllx %o0, 64-8, %g1
13 retl
14 popc %g1, %o0
15 .previous
16
17ENTRY(__arch_hweight16)
18 ba,pt %xcc, __sw_hweight16
19 nop
20 nop
21ENDPROC(__arch_hweight16)
22 .section .popc_3insn_patch, "ax"
23 .word __arch_hweight16
24 sllx %o0, 64-16, %g1
25 retl
26 popc %g1, %o0
27 .previous
28
29ENTRY(__arch_hweight32)
30 ba,pt %xcc, __sw_hweight32
31 nop
32 nop
33ENDPROC(__arch_hweight32)
34 .section .popc_3insn_patch, "ax"
35 .word __arch_hweight32
36 sllx %o0, 64-32, %g1
37 retl
38 popc %g1, %o0
39 .previous
40
41ENTRY(__arch_hweight64)
42 ba,pt %xcc, __sw_hweight64
43 nop
44 nop
45ENDPROC(__arch_hweight64)
46 .section .popc_3insn_patch, "ax"
47 .word __arch_hweight64
48 retl
49 popc %o0, %o0
50 nop
51 .previous
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 3fd8e18bed8..581531dbc8b 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1597,6 +1597,44 @@ static void __init tsb_phys_patch(void)
1597static struct hv_tsb_descr ktsb_descr[NUM_KTSB_DESCR]; 1597static struct hv_tsb_descr ktsb_descr[NUM_KTSB_DESCR];
1598extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; 1598extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES];
1599 1599
1600static void patch_one_ktsb_phys(unsigned int *start, unsigned int *end, unsigned long pa)
1601{
1602 pa >>= KTSB_PHYS_SHIFT;
1603
1604 while (start < end) {
1605 unsigned int *ia = (unsigned int *)(unsigned long)*start;
1606
1607 ia[0] = (ia[0] & ~0x3fffff) | (pa >> 10);
1608 __asm__ __volatile__("flush %0" : : "r" (ia));
1609
1610 ia[1] = (ia[1] & ~0x3ff) | (pa & 0x3ff);
1611 __asm__ __volatile__("flush %0" : : "r" (ia + 1));
1612
1613 start++;
1614 }
1615}
1616
1617static void ktsb_phys_patch(void)
1618{
1619 extern unsigned int __swapper_tsb_phys_patch;
1620 extern unsigned int __swapper_tsb_phys_patch_end;
1621 unsigned long ktsb_pa;
1622
1623 ktsb_pa = kern_base + ((unsigned long)&swapper_tsb[0] - KERNBASE);
1624 patch_one_ktsb_phys(&__swapper_tsb_phys_patch,
1625 &__swapper_tsb_phys_patch_end, ktsb_pa);
1626#ifndef CONFIG_DEBUG_PAGEALLOC
1627 {
1628 extern unsigned int __swapper_4m_tsb_phys_patch;
1629 extern unsigned int __swapper_4m_tsb_phys_patch_end;
1630 ktsb_pa = (kern_base +
1631 ((unsigned long)&swapper_4m_tsb[0] - KERNBASE));
1632 patch_one_ktsb_phys(&__swapper_4m_tsb_phys_patch,
1633 &__swapper_4m_tsb_phys_patch_end, ktsb_pa);
1634 }
1635#endif
1636}
1637
1600static void __init sun4v_ktsb_init(void) 1638static void __init sun4v_ktsb_init(void)
1601{ 1639{
1602 unsigned long ktsb_pa; 1640 unsigned long ktsb_pa;
@@ -1716,8 +1754,10 @@ void __init paging_init(void)
1716 sun4u_pgprot_init(); 1754 sun4u_pgprot_init();
1717 1755
1718 if (tlb_type == cheetah_plus || 1756 if (tlb_type == cheetah_plus ||
1719 tlb_type == hypervisor) 1757 tlb_type == hypervisor) {
1720 tsb_phys_patch(); 1758 tsb_phys_patch();
1759 ktsb_phys_patch();
1760 }
1721 1761
1722 if (tlb_type == hypervisor) { 1762 if (tlb_type == hypervisor) {
1723 sun4v_patch_tlb_handlers(); 1763 sun4v_patch_tlb_handlers();
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 0249b8b4db5..b30f71ac0d0 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -12,6 +12,7 @@ config TILE
12 select GENERIC_PENDING_IRQ if SMP 12 select GENERIC_PENDING_IRQ if SMP
13 select GENERIC_IRQ_SHOW 13 select GENERIC_IRQ_SHOW
14 select SYS_HYPERVISOR 14 select SYS_HYPERVISOR
15 select ARCH_HAVE_NMI_SAFE_CMPXCHG if !M386
15 16
16# FIXME: investigate whether we need/want these options. 17# FIXME: investigate whether we need/want these options.
17# select HAVE_IOREMAP_PROT 18# select HAVE_IOREMAP_PROT
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 849ab2fa1f5..aec60dc0600 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -2,3 +2,41 @@ include include/asm-generic/Kbuild.asm
2 2
3header-y += ucontext.h 3header-y += ucontext.h
4header-y += hardwall.h 4header-y += hardwall.h
5
6generic-y += bug.h
7generic-y += bugs.h
8generic-y += cputime.h
9generic-y += device.h
10generic-y += div64.h
11generic-y += emergency-restart.h
12generic-y += errno.h
13generic-y += fb.h
14generic-y += fcntl.h
15generic-y += ioctl.h
16generic-y += ioctls.h
17generic-y += ipc.h
18generic-y += ipcbuf.h
19generic-y += irq_regs.h
20generic-y += kdebug.h
21generic-y += local.h
22generic-y += module.h
23generic-y += msgbuf.h
24generic-y += mutex.h
25generic-y += param.h
26generic-y += parport.h
27generic-y += poll.h
28generic-y += posix_types.h
29generic-y += resource.h
30generic-y += scatterlist.h
31generic-y += sembuf.h
32generic-y += serial.h
33generic-y += shmbuf.h
34generic-y += shmparam.h
35generic-y += socket.h
36generic-y += sockios.h
37generic-y += statfs.h
38generic-y += termbits.h
39generic-y += termios.h
40generic-y += types.h
41generic-y += ucontext.h
42generic-y += xor.h
diff --git a/arch/tile/include/asm/atomic.h b/arch/tile/include/asm/atomic.h
index 739cfe0499d..921dbeb8a70 100644
--- a/arch/tile/include/asm/atomic.h
+++ b/arch/tile/include/asm/atomic.h
@@ -121,15 +121,6 @@ static inline int atomic_read(const atomic_t *v)
121 */ 121 */
122#define atomic_add_negative(i, v) (atomic_add_return((i), (v)) < 0) 122#define atomic_add_negative(i, v) (atomic_add_return((i), (v)) < 0)
123 123
124/**
125 * atomic_inc_not_zero - increment unless the number is zero
126 * @v: pointer of type atomic_t
127 *
128 * Atomically increments @v by 1, so long as @v is non-zero.
129 * Returns non-zero if @v was non-zero, and zero otherwise.
130 */
131#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
132
133/* Nonexistent functions intended to cause link errors. */ 124/* Nonexistent functions intended to cause link errors. */
134extern unsigned long __xchg_called_with_bad_pointer(void); 125extern unsigned long __xchg_called_with_bad_pointer(void);
135extern unsigned long __cmpxchg_called_with_bad_pointer(void); 126extern unsigned long __cmpxchg_called_with_bad_pointer(void);
@@ -186,9 +177,4 @@ extern unsigned long __cmpxchg_called_with_bad_pointer(void);
186#include <asm/atomic_64.h> 177#include <asm/atomic_64.h>
187#endif 178#endif
188 179
189/* Provide the appropriate atomic_long_t definitions. */
190#ifndef __ASSEMBLY__
191#include <asm-generic/atomic-long.h>
192#endif
193
194#endif /* _ASM_TILE_ATOMIC_H */ 180#endif /* _ASM_TILE_ATOMIC_H */
diff --git a/arch/tile/include/asm/atomic_32.h b/arch/tile/include/asm/atomic_32.h
index 92a8bee3231..c03349e0ca9 100644
--- a/arch/tile/include/asm/atomic_32.h
+++ b/arch/tile/include/asm/atomic_32.h
@@ -11,7 +11,7 @@
11 * NON INFRINGEMENT. See the GNU General Public License for 11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details. 12 * more details.
13 * 13 *
14 * Do not include directly; use <asm/atomic.h>. 14 * Do not include directly; use <linux/atomic.h>.
15 */ 15 */
16 16
17#ifndef _ASM_TILE_ATOMIC_32_H 17#ifndef _ASM_TILE_ATOMIC_32_H
@@ -21,7 +21,7 @@
21 21
22#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
23 23
24/* Tile-specific routines to support <asm/atomic.h>. */ 24/* Tile-specific routines to support <linux/atomic.h>. */
25int _atomic_xchg(atomic_t *v, int n); 25int _atomic_xchg(atomic_t *v, int n);
26int _atomic_xchg_add(atomic_t *v, int i); 26int _atomic_xchg_add(atomic_t *v, int i);
27int _atomic_xchg_add_unless(atomic_t *v, int a, int u); 27int _atomic_xchg_add_unless(atomic_t *v, int a, int u);
@@ -81,18 +81,18 @@ static inline int atomic_add_return(int i, atomic_t *v)
81} 81}
82 82
83/** 83/**
84 * atomic_add_unless - add unless the number is already a given value 84 * __atomic_add_unless - add unless the number is already a given value
85 * @v: pointer of type atomic_t 85 * @v: pointer of type atomic_t
86 * @a: the amount to add to v... 86 * @a: the amount to add to v...
87 * @u: ...unless v is equal to u. 87 * @u: ...unless v is equal to u.
88 * 88 *
89 * Atomically adds @a to @v, so long as @v was not already @u. 89 * Atomically adds @a to @v, so long as @v was not already @u.
90 * Returns non-zero if @v was not @u, and zero otherwise. 90 * Returns the old value of @v.
91 */ 91 */
92static inline int atomic_add_unless(atomic_t *v, int a, int u) 92static inline int __atomic_add_unless(atomic_t *v, int a, int u)
93{ 93{
94 smp_mb(); /* barrier for proper semantics */ 94 smp_mb(); /* barrier for proper semantics */
95 return _atomic_xchg_add_unless(v, a, u) != u; 95 return _atomic_xchg_add_unless(v, a, u);
96} 96}
97 97
98/** 98/**
@@ -199,7 +199,7 @@ static inline u64 atomic64_add_return(u64 i, atomic64_t *v)
199 * @u: ...unless v is equal to u. 199 * @u: ...unless v is equal to u.
200 * 200 *
201 * Atomically adds @a to @v, so long as @v was not already @u. 201 * Atomically adds @a to @v, so long as @v was not already @u.
202 * Returns non-zero if @v was not @u, and zero otherwise. 202 * Returns the old value of @v.
203 */ 203 */
204static inline u64 atomic64_add_unless(atomic64_t *v, u64 a, u64 u) 204static inline u64 atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
205{ 205{
diff --git a/arch/tile/include/asm/atomic_64.h b/arch/tile/include/asm/atomic_64.h
index 1c1e60d8ccb..27fe667fddf 100644
--- a/arch/tile/include/asm/atomic_64.h
+++ b/arch/tile/include/asm/atomic_64.h
@@ -11,7 +11,7 @@
11 * NON INFRINGEMENT. See the GNU General Public License for 11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details. 12 * more details.
13 * 13 *
14 * Do not include directly; use <asm/atomic.h>. 14 * Do not include directly; use <linux/atomic.h>.
15 */ 15 */
16 16
17#ifndef _ASM_TILE_ATOMIC_64_H 17#ifndef _ASM_TILE_ATOMIC_64_H
@@ -64,7 +64,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
64 return val; 64 return val;
65} 65}
66 66
67static inline int atomic_add_unless(atomic_t *v, int a, int u) 67static inline int __atomic_add_unless(atomic_t *v, int a, int u)
68{ 68{
69 int guess, oldval = v->counter; 69 int guess, oldval = v->counter;
70 do { 70 do {
@@ -73,7 +73,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
73 guess = oldval; 73 guess = oldval;
74 oldval = atomic_cmpxchg(v, guess, guess + a); 74 oldval = atomic_cmpxchg(v, guess, guess + a);
75 } while (guess != oldval); 75 } while (guess != oldval);
76 return oldval != u; 76 return oldval;
77} 77}
78 78
79/* Now the true 64-bit operations. */ 79/* Now the true 64-bit operations. */
diff --git a/arch/tile/include/asm/bitops_32.h b/arch/tile/include/asm/bitops_32.h
index d31ab905cfa..571b118bfd9 100644
--- a/arch/tile/include/asm/bitops_32.h
+++ b/arch/tile/include/asm/bitops_32.h
@@ -16,7 +16,7 @@
16#define _ASM_TILE_BITOPS_32_H 16#define _ASM_TILE_BITOPS_32_H
17 17
18#include <linux/compiler.h> 18#include <linux/compiler.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20#include <asm/system.h> 20#include <asm/system.h>
21 21
22/* Tile-specific routines to support <asm/bitops.h>. */ 22/* Tile-specific routines to support <asm/bitops.h>. */
diff --git a/arch/tile/include/asm/bitops_64.h b/arch/tile/include/asm/bitops_64.h
index 99615e8d2d8..e9c8e381ee0 100644
--- a/arch/tile/include/asm/bitops_64.h
+++ b/arch/tile/include/asm/bitops_64.h
@@ -16,7 +16,7 @@
16#define _ASM_TILE_BITOPS_64_H 16#define _ASM_TILE_BITOPS_64_H
17 17
18#include <linux/compiler.h> 18#include <linux/compiler.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20#include <asm/system.h> 20#include <asm/system.h>
21 21
22/* See <asm/bitops.h> for API comments. */ 22/* See <asm/bitops.h> for API comments. */
@@ -97,9 +97,6 @@ static inline int test_and_change_bit(unsigned nr,
97 return (oldval & mask) != 0; 97 return (oldval & mask) != 0;
98} 98}
99 99
100#define ext2_set_bit_atomic(lock, nr, addr) \ 100#include <asm-generic/bitops/ext2-atomic-setbit.h>
101 test_and_set_bit((nr), (unsigned long *)(addr))
102#define ext2_clear_bit_atomic(lock, nr, addr) \
103 test_and_clear_bit((nr), (unsigned long *)(addr))
104 101
105#endif /* _ASM_TILE_BITOPS_64_H */ 102#endif /* _ASM_TILE_BITOPS_64_H */
diff --git a/arch/tile/include/asm/bug.h b/arch/tile/include/asm/bug.h
deleted file mode 100644
index b12fd89e42e..00000000000
--- a/arch/tile/include/asm/bug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/bug.h>
diff --git a/arch/tile/include/asm/bugs.h b/arch/tile/include/asm/bugs.h
deleted file mode 100644
index 61791e1ad9f..00000000000
--- a/arch/tile/include/asm/bugs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/bugs.h>
diff --git a/arch/tile/include/asm/cputime.h b/arch/tile/include/asm/cputime.h
deleted file mode 100644
index 6d68ad7e0ea..00000000000
--- a/arch/tile/include/asm/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/cputime.h>
diff --git a/arch/tile/include/asm/device.h b/arch/tile/include/asm/device.h
deleted file mode 100644
index f0a4c256403..00000000000
--- a/arch/tile/include/asm/device.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/device.h>
diff --git a/arch/tile/include/asm/div64.h b/arch/tile/include/asm/div64.h
deleted file mode 100644
index 6cd978cefb2..00000000000
--- a/arch/tile/include/asm/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/arch/tile/include/asm/emergency-restart.h b/arch/tile/include/asm/emergency-restart.h
deleted file mode 100644
index 3711bd9d50b..00000000000
--- a/arch/tile/include/asm/emergency-restart.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/emergency-restart.h>
diff --git a/arch/tile/include/asm/errno.h b/arch/tile/include/asm/errno.h
deleted file mode 100644
index 4c82b503d92..00000000000
--- a/arch/tile/include/asm/errno.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/errno.h>
diff --git a/arch/tile/include/asm/fb.h b/arch/tile/include/asm/fb.h
deleted file mode 100644
index 3a4988e8df4..00000000000
--- a/arch/tile/include/asm/fb.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/fb.h>
diff --git a/arch/tile/include/asm/fcntl.h b/arch/tile/include/asm/fcntl.h
deleted file mode 100644
index 46ab12db573..00000000000
--- a/arch/tile/include/asm/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/fcntl.h>
diff --git a/arch/tile/include/asm/fixmap.h b/arch/tile/include/asm/fixmap.h
index 51537ff9265..c66f7933bea 100644
--- a/arch/tile/include/asm/fixmap.h
+++ b/arch/tile/include/asm/fixmap.h
@@ -75,12 +75,6 @@ extern void __set_fixmap(enum fixed_addresses idx,
75 75
76#define set_fixmap(idx, phys) \ 76#define set_fixmap(idx, phys) \
77 __set_fixmap(idx, phys, PAGE_KERNEL) 77 __set_fixmap(idx, phys, PAGE_KERNEL)
78/*
79 * Some hardware wants to get fixmapped without caching.
80 */
81#define set_fixmap_nocache(idx, phys) \
82 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
83
84#define clear_fixmap(idx) \ 78#define clear_fixmap(idx) \
85 __set_fixmap(idx, 0, __pgprot(0)) 79 __set_fixmap(idx, 0, __pgprot(0))
86 80
diff --git a/arch/tile/include/asm/ioctl.h b/arch/tile/include/asm/ioctl.h
deleted file mode 100644
index b279fe06dfe..00000000000
--- a/arch/tile/include/asm/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/arch/tile/include/asm/ioctls.h b/arch/tile/include/asm/ioctls.h
deleted file mode 100644
index ec34c760665..00000000000
--- a/arch/tile/include/asm/ioctls.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctls.h>
diff --git a/arch/tile/include/asm/ipc.h b/arch/tile/include/asm/ipc.h
deleted file mode 100644
index a46e3d9c2a3..00000000000
--- a/arch/tile/include/asm/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/arch/tile/include/asm/ipcbuf.h b/arch/tile/include/asm/ipcbuf.h
deleted file mode 100644
index 84c7e51cb6d..00000000000
--- a/arch/tile/include/asm/ipcbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipcbuf.h>
diff --git a/arch/tile/include/asm/irq_regs.h b/arch/tile/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b7027..00000000000
--- a/arch/tile/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/tile/include/asm/kdebug.h b/arch/tile/include/asm/kdebug.h
deleted file mode 100644
index 6ece1b03766..00000000000
--- a/arch/tile/include/asm/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/arch/tile/include/asm/local.h b/arch/tile/include/asm/local.h
deleted file mode 100644
index c11c530f74d..00000000000
--- a/arch/tile/include/asm/local.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local.h>
diff --git a/arch/tile/include/asm/module.h b/arch/tile/include/asm/module.h
deleted file mode 100644
index 1e4b79fe858..00000000000
--- a/arch/tile/include/asm/module.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/module.h>
diff --git a/arch/tile/include/asm/msgbuf.h b/arch/tile/include/asm/msgbuf.h
deleted file mode 100644
index 809134c644a..00000000000
--- a/arch/tile/include/asm/msgbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/msgbuf.h>
diff --git a/arch/tile/include/asm/mutex.h b/arch/tile/include/asm/mutex.h
deleted file mode 100644
index ff6101aa2c7..00000000000
--- a/arch/tile/include/asm/mutex.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/mutex-dec.h>
diff --git a/arch/tile/include/asm/param.h b/arch/tile/include/asm/param.h
deleted file mode 100644
index 965d4542797..00000000000
--- a/arch/tile/include/asm/param.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/param.h>
diff --git a/arch/tile/include/asm/parport.h b/arch/tile/include/asm/parport.h
deleted file mode 100644
index cf252af6459..00000000000
--- a/arch/tile/include/asm/parport.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/parport.h>
diff --git a/arch/tile/include/asm/poll.h b/arch/tile/include/asm/poll.h
deleted file mode 100644
index c98509d3149..00000000000
--- a/arch/tile/include/asm/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/arch/tile/include/asm/posix_types.h b/arch/tile/include/asm/posix_types.h
deleted file mode 100644
index 22cae6230ce..00000000000
--- a/arch/tile/include/asm/posix_types.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/posix_types.h>
diff --git a/arch/tile/include/asm/ptrace.h b/arch/tile/include/asm/ptrace.h
index 6be2246e015..c6cddd7e8d5 100644
--- a/arch/tile/include/asm/ptrace.h
+++ b/arch/tile/include/asm/ptrace.h
@@ -112,8 +112,6 @@ struct pt_regs *get_pt_regs(struct pt_regs *);
112/* Trace the current syscall. */ 112/* Trace the current syscall. */
113extern void do_syscall_trace(void); 113extern void do_syscall_trace(void);
114 114
115extern void show_regs(struct pt_regs *);
116
117#define arch_has_single_step() (1) 115#define arch_has_single_step() (1)
118 116
119/* 117/*
diff --git a/arch/tile/include/asm/resource.h b/arch/tile/include/asm/resource.h
deleted file mode 100644
index 04bc4db8921..00000000000
--- a/arch/tile/include/asm/resource.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/resource.h>
diff --git a/arch/tile/include/asm/scatterlist.h b/arch/tile/include/asm/scatterlist.h
deleted file mode 100644
index 35d786fe93a..00000000000
--- a/arch/tile/include/asm/scatterlist.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/scatterlist.h>
diff --git a/arch/tile/include/asm/sembuf.h b/arch/tile/include/asm/sembuf.h
deleted file mode 100644
index 7673b83cfef..00000000000
--- a/arch/tile/include/asm/sembuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/sembuf.h>
diff --git a/arch/tile/include/asm/serial.h b/arch/tile/include/asm/serial.h
deleted file mode 100644
index a0cb0caff15..00000000000
--- a/arch/tile/include/asm/serial.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/serial.h>
diff --git a/arch/tile/include/asm/shmbuf.h b/arch/tile/include/asm/shmbuf.h
deleted file mode 100644
index 83c05fc2de3..00000000000
--- a/arch/tile/include/asm/shmbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/shmbuf.h>
diff --git a/arch/tile/include/asm/shmparam.h b/arch/tile/include/asm/shmparam.h
deleted file mode 100644
index 93f30deb95d..00000000000
--- a/arch/tile/include/asm/shmparam.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/shmparam.h>
diff --git a/arch/tile/include/asm/socket.h b/arch/tile/include/asm/socket.h
deleted file mode 100644
index 6b71384b9d8..00000000000
--- a/arch/tile/include/asm/socket.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/socket.h>
diff --git a/arch/tile/include/asm/sockios.h b/arch/tile/include/asm/sockios.h
deleted file mode 100644
index def6d4746ee..00000000000
--- a/arch/tile/include/asm/sockios.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/sockios.h>
diff --git a/arch/tile/include/asm/spinlock_32.h b/arch/tile/include/asm/spinlock_32.h
index a8f2c6e31a8..a5e4208d34f 100644
--- a/arch/tile/include/asm/spinlock_32.h
+++ b/arch/tile/include/asm/spinlock_32.h
@@ -17,7 +17,7 @@
17#ifndef _ASM_TILE_SPINLOCK_32_H 17#ifndef _ASM_TILE_SPINLOCK_32_H
18#define _ASM_TILE_SPINLOCK_32_H 18#define _ASM_TILE_SPINLOCK_32_H
19 19
20#include <asm/atomic.h> 20#include <linux/atomic.h>
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/system.h> 22#include <asm/system.h>
23#include <linux/compiler.h> 23#include <linux/compiler.h>
diff --git a/arch/tile/include/asm/statfs.h b/arch/tile/include/asm/statfs.h
deleted file mode 100644
index 0b91fe198c2..00000000000
--- a/arch/tile/include/asm/statfs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/statfs.h>
diff --git a/arch/tile/include/asm/termbits.h b/arch/tile/include/asm/termbits.h
deleted file mode 100644
index 3935b106de7..00000000000
--- a/arch/tile/include/asm/termbits.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/termbits.h>
diff --git a/arch/tile/include/asm/termios.h b/arch/tile/include/asm/termios.h
deleted file mode 100644
index 280d78a9d96..00000000000
--- a/arch/tile/include/asm/termios.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/termios.h>
diff --git a/arch/tile/include/asm/types.h b/arch/tile/include/asm/types.h
deleted file mode 100644
index b9e79bc580d..00000000000
--- a/arch/tile/include/asm/types.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/types.h>
diff --git a/arch/tile/include/asm/ucontext.h b/arch/tile/include/asm/ucontext.h
deleted file mode 100644
index 9bc07b9f30f..00000000000
--- a/arch/tile/include/asm/ucontext.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ucontext.h>
diff --git a/arch/tile/include/asm/xor.h b/arch/tile/include/asm/xor.h
deleted file mode 100644
index c82eb12a5b1..00000000000
--- a/arch/tile/include/asm/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/xor.h>
diff --git a/arch/tile/include/hv/drv_srom_intf.h b/arch/tile/include/hv/drv_srom_intf.h
new file mode 100644
index 00000000000..6395faa6d9e
--- /dev/null
+++ b/arch/tile/include/hv/drv_srom_intf.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright 2011 Tilera Corporation. 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, version 2.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details.
13 */
14
15/**
16 * @file drv_srom_intf.h
17 * Interface definitions for the SPI Flash ROM driver.
18 */
19
20#ifndef _SYS_HV_INCLUDE_DRV_SROM_INTF_H
21#define _SYS_HV_INCLUDE_DRV_SROM_INTF_H
22
23/** Read this offset to get the total device size. */
24#define SROM_TOTAL_SIZE_OFF 0xF0000000
25
26/** Read this offset to get the device sector size. */
27#define SROM_SECTOR_SIZE_OFF 0xF0000004
28
29/** Read this offset to get the device page size. */
30#define SROM_PAGE_SIZE_OFF 0xF0000008
31
32/** Write this offset to flush any pending writes. */
33#define SROM_FLUSH_OFF 0xF1000000
34
35/** Write this offset, plus the byte offset of the start of a sector, to
36 * erase a sector. Any write data is ignored, but there must be at least
37 * one byte of write data. Only applies when the driver is in MTD mode.
38 */
39#define SROM_ERASE_OFF 0xF2000000
40
41#endif /* _SYS_HV_INCLUDE_DRV_SROM_INTF_H */
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index 72ade79b621..fc94607f0bd 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -21,7 +21,7 @@
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/thread_info.h> 22#include <asm/thread_info.h>
23#include <asm/irqflags.h> 23#include <asm/irqflags.h>
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
26#include <hv/hypervisor.h> 26#include <hv/hypervisor.h>
27#include <arch/abi.h> 27#include <arch/abi.h>
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 6d4cb5d7a9f..2a8014cb1ff 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -228,7 +228,7 @@ err_cont:
228 * (pin - 1) converts from the PCI standard's [1:4] convention to 228 * (pin - 1) converts from the PCI standard's [1:4] convention to
229 * a normal [0:3] range. 229 * a normal [0:3] range.
230 */ 230 */
231static int tile_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 231static int tile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
232{ 232{
233 struct pci_controller *controller = 233 struct pci_controller *controller =
234 (struct pci_controller *)dev->sysdata; 234 (struct pci_controller *)dev->sysdata;
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index c4be58cc5d5..f6f50f2a5e3 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -78,7 +78,6 @@ static struct clocksource cycle_counter_cs = {
78 .rating = 300, 78 .rating = 300,
79 .read = clocksource_get_cycles, 79 .read = clocksource_get_cycles,
80 .mask = CLOCKSOURCE_MASK(64), 80 .mask = CLOCKSOURCE_MASK(64),
81 .shift = 22, /* typical value, e.g. x86 tsc uses this */
82 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 81 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
83}; 82};
84 83
@@ -91,8 +90,6 @@ void __init setup_clock(void)
91 cycles_per_sec = hv_sysconf(HV_SYSCONF_CPU_SPEED); 90 cycles_per_sec = hv_sysconf(HV_SYSCONF_CPU_SPEED);
92 sched_clock_mult = 91 sched_clock_mult =
93 clocksource_hz2mult(cycles_per_sec, SCHED_CLOCK_SHIFT); 92 clocksource_hz2mult(cycles_per_sec, SCHED_CLOCK_SHIFT);
94 cycle_counter_cs.mult =
95 clocksource_hz2mult(cycles_per_sec, cycle_counter_cs.shift);
96} 93}
97 94
98void __init calibrate_delay(void) 95void __init calibrate_delay(void)
@@ -107,7 +104,7 @@ void __init calibrate_delay(void)
107void __init time_init(void) 104void __init time_init(void)
108{ 105{
109 /* Initialize and register the clock source. */ 106 /* Initialize and register the clock source. */
110 clocksource_register(&cycle_counter_cs); 107 clocksource_register_hz(&cycle_counter_cs, cycles_per_sec);
111 108
112 /* Start up the tile-timer interrupt source on the boot cpu. */ 109 /* Start up the tile-timer interrupt source on the boot cpu. */
113 setup_tile_timer(); 110 setup_tile_timer();
diff --git a/arch/tile/lib/atomic_32.c b/arch/tile/lib/atomic_32.c
index 46570211df5..771b251b409 100644
--- a/arch/tile/lib/atomic_32.c
+++ b/arch/tile/lib/atomic_32.c
@@ -17,7 +17,7 @@
17#include <linux/uaccess.h> 17#include <linux/uaccess.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <asm/atomic.h> 20#include <linux/atomic.h>
21#include <asm/futex.h> 21#include <asm/futex.h>
22#include <arch/chip.h> 22#include <arch/chip.h>
23 23
diff --git a/arch/tile/lib/atomic_asm_32.S b/arch/tile/lib/atomic_asm_32.S
index 24448734f6f..1f75a2a5610 100644
--- a/arch/tile/lib/atomic_asm_32.S
+++ b/arch/tile/lib/atomic_asm_32.S
@@ -70,7 +70,7 @@
70 */ 70 */
71 71
72#include <linux/linkage.h> 72#include <linux/linkage.h>
73#include <asm/atomic.h> 73#include <linux/atomic.h>
74#include <asm/page.h> 74#include <asm/page.h>
75#include <asm/processor.h> 75#include <asm/processor.h>
76 76
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index 4e10c402302..7309988c979 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -836,8 +836,7 @@ void __init mem_init(void)
836#endif 836#endif
837 837
838#ifdef CONFIG_FLATMEM 838#ifdef CONFIG_FLATMEM
839 if (!mem_map) 839 BUG_ON(!mem_map);
840 BUG();
841#endif 840#endif
842 841
843#ifdef CONFIG_HIGHMEM 842#ifdef CONFIG_HIGHMEM
diff --git a/arch/um/Kconfig.x86 b/arch/um/Kconfig.x86
index d31ecf346b4..21bebe63df6 100644
--- a/arch/um/Kconfig.x86
+++ b/arch/um/Kconfig.x86
@@ -10,6 +10,10 @@ config CMPXCHG_LOCAL
10 bool 10 bool
11 default n 11 default n
12 12
13config CMPXCHG_DOUBLE
14 bool
15 default n
16
13source "arch/x86/Kconfig.cpu" 17source "arch/x86/Kconfig.cpu"
14 18
15endmenu 19endmenu
diff --git a/arch/um/Makefile b/arch/um/Makefile
index fab8121d2b3..c0f712cc7c5 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -41,7 +41,7 @@ KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)
41KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ 41KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \
42 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ 42 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
43 -Din6addr_loopback=kernel_in6addr_loopback \ 43 -Din6addr_loopback=kernel_in6addr_loopback \
44 -Din6addr_any=kernel_in6addr_any 44 -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
45 45
46KBUILD_AFLAGS += $(ARCH_INCLUDE) 46KBUILD_AFLAGS += $(ARCH_INCLUDE)
47 47
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index d51c404239a..364c8a15c4c 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -399,8 +399,8 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data)
399 * is done under a spinlock. Checking whether the device is in use is 399 * is done under a spinlock. Checking whether the device is in use is
400 * line->tty->count > 1, also under the spinlock. 400 * line->tty->count > 1, also under the spinlock.
401 * 401 *
402 * tty->count serves to decide whether the device should be enabled or 402 * line->count serves to decide whether the device should be enabled or
403 * disabled on the host. If it's equal to 1, then we are doing the 403 * disabled on the host. If it's equal to 0, then we are doing the
404 * first open or last close. Otherwise, open and close just return. 404 * first open or last close. Otherwise, open and close just return.
405 */ 405 */
406 406
@@ -414,16 +414,16 @@ int line_open(struct line *lines, struct tty_struct *tty)
414 goto out_unlock; 414 goto out_unlock;
415 415
416 err = 0; 416 err = 0;
417 if (tty->count > 1) 417 if (line->count++)
418 goto out_unlock; 418 goto out_unlock;
419 419
420 spin_unlock(&line->count_lock); 420 BUG_ON(tty->driver_data);
421
422 tty->driver_data = line; 421 tty->driver_data = line;
423 line->tty = tty; 422 line->tty = tty;
424 423
424 spin_unlock(&line->count_lock);
425 err = enable_chan(line); 425 err = enable_chan(line);
426 if (err) 426 if (err) /* line_close() will be called by our caller */
427 return err; 427 return err;
428 428
429 INIT_DELAYED_WORK(&line->task, line_timer_cb); 429 INIT_DELAYED_WORK(&line->task, line_timer_cb);
@@ -436,7 +436,7 @@ int line_open(struct line *lines, struct tty_struct *tty)
436 chan_window_size(&line->chan_list, &tty->winsize.ws_row, 436 chan_window_size(&line->chan_list, &tty->winsize.ws_row,
437 &tty->winsize.ws_col); 437 &tty->winsize.ws_col);
438 438
439 return err; 439 return 0;
440 440
441out_unlock: 441out_unlock:
442 spin_unlock(&line->count_lock); 442 spin_unlock(&line->count_lock);
@@ -460,17 +460,16 @@ void line_close(struct tty_struct *tty, struct file * filp)
460 flush_buffer(line); 460 flush_buffer(line);
461 461
462 spin_lock(&line->count_lock); 462 spin_lock(&line->count_lock);
463 if (!line->valid) 463 BUG_ON(!line->valid);
464 goto out_unlock;
465 464
466 if (tty->count > 1) 465 if (--line->count)
467 goto out_unlock; 466 goto out_unlock;
468 467
469 spin_unlock(&line->count_lock);
470
471 line->tty = NULL; 468 line->tty = NULL;
472 tty->driver_data = NULL; 469 tty->driver_data = NULL;
473 470
471 spin_unlock(&line->count_lock);
472
474 if (line->sigio) { 473 if (line->sigio) {
475 unregister_winch(tty); 474 unregister_winch(tty);
476 line->sigio = 0; 475 line->sigio = 0;
@@ -498,7 +497,7 @@ static int setup_one_line(struct line *lines, int n, char *init, int init_prio,
498 497
499 spin_lock(&line->count_lock); 498 spin_lock(&line->count_lock);
500 499
501 if (line->tty != NULL) { 500 if (line->count) {
502 *error_out = "Device is already open"; 501 *error_out = "Device is already open";
503 goto out; 502 goto out;
504 } 503 }
@@ -722,41 +721,53 @@ struct winch {
722 int pid; 721 int pid;
723 struct tty_struct *tty; 722 struct tty_struct *tty;
724 unsigned long stack; 723 unsigned long stack;
724 struct work_struct work;
725}; 725};
726 726
727static void free_winch(struct winch *winch, int free_irq_ok) 727static void __free_winch(struct work_struct *work)
728{ 728{
729 if (free_irq_ok) 729 struct winch *winch = container_of(work, struct winch, work);
730 free_irq(WINCH_IRQ, winch); 730 free_irq(WINCH_IRQ, winch);
731
732 list_del(&winch->list);
733 731
734 if (winch->pid != -1) 732 if (winch->pid != -1)
735 os_kill_process(winch->pid, 1); 733 os_kill_process(winch->pid, 1);
736 if (winch->fd != -1)
737 os_close_file(winch->fd);
738 if (winch->stack != 0) 734 if (winch->stack != 0)
739 free_stack(winch->stack, 0); 735 free_stack(winch->stack, 0);
740 kfree(winch); 736 kfree(winch);
741} 737}
742 738
739static void free_winch(struct winch *winch)
740{
741 int fd = winch->fd;
742 winch->fd = -1;
743 if (fd != -1)
744 os_close_file(fd);
745 list_del(&winch->list);
746 __free_winch(&winch->work);
747}
748
743static irqreturn_t winch_interrupt(int irq, void *data) 749static irqreturn_t winch_interrupt(int irq, void *data)
744{ 750{
745 struct winch *winch = data; 751 struct winch *winch = data;
746 struct tty_struct *tty; 752 struct tty_struct *tty;
747 struct line *line; 753 struct line *line;
754 int fd = winch->fd;
748 int err; 755 int err;
749 char c; 756 char c;
750 757
751 if (winch->fd != -1) { 758 if (fd != -1) {
752 err = generic_read(winch->fd, &c, NULL); 759 err = generic_read(fd, &c, NULL);
753 if (err < 0) { 760 if (err < 0) {
754 if (err != -EAGAIN) { 761 if (err != -EAGAIN) {
762 winch->fd = -1;
763 list_del(&winch->list);
764 os_close_file(fd);
755 printk(KERN_ERR "winch_interrupt : " 765 printk(KERN_ERR "winch_interrupt : "
756 "read failed, errno = %d\n", -err); 766 "read failed, errno = %d\n", -err);
757 printk(KERN_ERR "fd %d is losing SIGWINCH " 767 printk(KERN_ERR "fd %d is losing SIGWINCH "
758 "support\n", winch->tty_fd); 768 "support\n", winch->tty_fd);
759 free_winch(winch, 0); 769 INIT_WORK(&winch->work, __free_winch);
770 schedule_work(&winch->work);
760 return IRQ_HANDLED; 771 return IRQ_HANDLED;
761 } 772 }
762 goto out; 773 goto out;
@@ -828,7 +839,7 @@ static void unregister_winch(struct tty_struct *tty)
828 list_for_each_safe(ele, next, &winch_handlers) { 839 list_for_each_safe(ele, next, &winch_handlers) {
829 winch = list_entry(ele, struct winch, list); 840 winch = list_entry(ele, struct winch, list);
830 if (winch->tty == tty) { 841 if (winch->tty == tty) {
831 free_winch(winch, 1); 842 free_winch(winch);
832 break; 843 break;
833 } 844 }
834 } 845 }
@@ -844,7 +855,7 @@ static void winch_cleanup(void)
844 855
845 list_for_each_safe(ele, next, &winch_handlers) { 856 list_for_each_safe(ele, next, &winch_handlers) {
846 winch = list_entry(ele, struct winch, list); 857 winch = list_entry(ele, struct winch, list);
847 free_winch(winch, 1); 858 free_winch(winch);
848 } 859 }
849 860
850 spin_unlock(&winch_handler_lock); 861 spin_unlock(&winch_handler_lock);
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index 8ac7146c237..2e1de572860 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -123,6 +123,7 @@ static int xterm_open(int input, int output, int primary, void *d,
123 err = -errno; 123 err = -errno;
124 printk(UM_KERN_ERR "xterm_open : unlink failed, errno = %d\n", 124 printk(UM_KERN_ERR "xterm_open : unlink failed, errno = %d\n",
125 errno); 125 errno);
126 close(fd);
126 return err; 127 return err;
127 } 128 }
128 close(fd); 129 close(fd);
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h
index b7c5bab9bd7..1a7d2757fe0 100644
--- a/arch/um/include/asm/ptrace-generic.h
+++ b/arch/um/include/asm/ptrace-generic.h
@@ -42,12 +42,6 @@ extern long subarch_ptrace(struct task_struct *child, long request,
42 unsigned long addr, unsigned long data); 42 unsigned long addr, unsigned long data);
43extern unsigned long getreg(struct task_struct *child, int regno); 43extern unsigned long getreg(struct task_struct *child, int regno);
44extern int putreg(struct task_struct *child, int regno, unsigned long value); 44extern int putreg(struct task_struct *child, int regno, unsigned long value);
45extern int get_fpregs(struct user_i387_struct __user *buf,
46 struct task_struct *child);
47extern int set_fpregs(struct user_i387_struct __user *buf,
48 struct task_struct *child);
49
50extern void show_regs(struct pt_regs *regs);
51 45
52extern int arch_copy_tls(struct task_struct *new); 46extern int arch_copy_tls(struct task_struct *new);
53extern void clear_flushed_tls(struct task_struct *task); 47extern void clear_flushed_tls(struct task_struct *task);
diff --git a/arch/um/include/shared/line.h b/arch/um/include/shared/line.h
index 72f4f25af24..63df3ca02ac 100644
--- a/arch/um/include/shared/line.h
+++ b/arch/um/include/shared/line.h
@@ -33,6 +33,7 @@ struct line_driver {
33struct line { 33struct line {
34 struct tty_struct *tty; 34 struct tty_struct *tty;
35 spinlock_t count_lock; 35 spinlock_t count_lock;
36 unsigned long count;
36 int valid; 37 int valid;
37 38
38 char *init_str; 39 char *init_str;
diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h
index b0b4589e0eb..f1e0aa56c52 100644
--- a/arch/um/include/shared/registers.h
+++ b/arch/um/include/shared/registers.h
@@ -16,7 +16,7 @@ extern int restore_fpx_registers(int pid, unsigned long *fp_regs);
16extern int save_registers(int pid, struct uml_pt_regs *regs); 16extern int save_registers(int pid, struct uml_pt_regs *regs);
17extern int restore_registers(int pid, struct uml_pt_regs *regs); 17extern int restore_registers(int pid, struct uml_pt_regs *regs);
18extern int init_registers(int pid); 18extern int init_registers(int pid);
19extern void get_safe_registers(unsigned long *regs); 19extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs);
20extern unsigned long get_thread_reg(int reg, jmp_buf *buf); 20extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
21extern int get_fp_registers(int pid, unsigned long *regs); 21extern int get_fp_registers(int pid, unsigned long *regs);
22extern int put_fp_registers(int pid, unsigned long *regs); 22extern int put_fp_registers(int pid, unsigned long *regs);
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index fab4371184f..21c1ae7c3d7 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -202,7 +202,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
202 arch_copy_thread(&current->thread.arch, &p->thread.arch); 202 arch_copy_thread(&current->thread.arch, &p->thread.arch);
203 } 203 }
204 else { 204 else {
205 get_safe_registers(p->thread.regs.regs.gp); 205 get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp);
206 p->thread.request.u.thread = current->thread.request.u.thread; 206 p->thread.request.u.thread = current->thread.request.u.thread;
207 handler = new_thread_handler; 207 handler = new_thread_handler;
208 } 208 }
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 701b672c112..c9da32b0c70 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -50,23 +50,11 @@ long arch_ptrace(struct task_struct *child, long request,
50 void __user *vp = p; 50 void __user *vp = p;
51 51
52 switch (request) { 52 switch (request) {
53 /* read word at location addr. */
54 case PTRACE_PEEKTEXT:
55 case PTRACE_PEEKDATA:
56 ret = generic_ptrace_peekdata(child, addr, data);
57 break;
58
59 /* read the word at location addr in the USER area. */ 53 /* read the word at location addr in the USER area. */
60 case PTRACE_PEEKUSR: 54 case PTRACE_PEEKUSR:
61 ret = peek_user(child, addr, data); 55 ret = peek_user(child, addr, data);
62 break; 56 break;
63 57
64 /* write the word at location addr. */
65 case PTRACE_POKETEXT:
66 case PTRACE_POKEDATA:
67 ret = generic_ptrace_pokedata(child, addr, data);
68 break;
69
70 /* write the word at location addr in the USER area */ 58 /* write the word at location addr in the USER area */
71 case PTRACE_POKEUSR: 59 case PTRACE_POKEUSR:
72 ret = poke_user(child, addr, data); 60 ret = poke_user(child, addr, data);
@@ -107,16 +95,6 @@ long arch_ptrace(struct task_struct *child, long request,
107 break; 95 break;
108 } 96 }
109#endif 97#endif
110#ifdef PTRACE_GETFPREGS
111 case PTRACE_GETFPREGS: /* Get the child FPU state. */
112 ret = get_fpregs(vp, child);
113 break;
114#endif
115#ifdef PTRACE_SETFPREGS
116 case PTRACE_SETFPREGS: /* Set the child FPU state. */
117 ret = set_fpregs(vp, child);
118 break;
119#endif
120 case PTRACE_GET_THREAD_AREA: 98 case PTRACE_GET_THREAD_AREA:
121 ret = ptrace_get_thread_area(child, addr, vp); 99 ret = ptrace_get_thread_area(child, addr, vp);
122 break; 100 break;
@@ -154,12 +132,6 @@ long arch_ptrace(struct task_struct *child, long request,
154 break; 132 break;
155 } 133 }
156#endif 134#endif
157#ifdef PTRACE_ARCH_PRCTL
158 case PTRACE_ARCH_PRCTL:
159 /* XXX Calls ptrace on the host - needs some SMP thinking */
160 ret = arch_prctl(child, data, (void __user *) addr);
161 break;
162#endif
163 default: 135 default:
164 ret = ptrace_request(child, request, addr, data); 136 ret = ptrace_request(child, request, addr, data);
165 if (ret == -EIO) 137 if (ret == -EIO)
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c
index 830fe6a1518..b866b9e3bef 100644
--- a/arch/um/os-Linux/registers.c
+++ b/arch/um/os-Linux/registers.c
@@ -8,6 +8,8 @@
8#include <string.h> 8#include <string.h>
9#include <sys/ptrace.h> 9#include <sys/ptrace.h>
10#include "sysdep/ptrace.h" 10#include "sysdep/ptrace.h"
11#include "sysdep/ptrace_user.h"
12#include "registers.h"
11 13
12int save_registers(int pid, struct uml_pt_regs *regs) 14int save_registers(int pid, struct uml_pt_regs *regs)
13{ 15{
@@ -32,6 +34,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs)
32/* This is set once at boot time and not changed thereafter */ 34/* This is set once at boot time and not changed thereafter */
33 35
34static unsigned long exec_regs[MAX_REG_NR]; 36static unsigned long exec_regs[MAX_REG_NR];
37static unsigned long exec_fp_regs[FP_SIZE];
35 38
36int init_registers(int pid) 39int init_registers(int pid)
37{ 40{
@@ -42,10 +45,14 @@ int init_registers(int pid)
42 return -errno; 45 return -errno;
43 46
44 arch_init_registers(pid); 47 arch_init_registers(pid);
48 get_fp_registers(pid, exec_fp_regs);
45 return 0; 49 return 0;
46} 50}
47 51
48void get_safe_registers(unsigned long *regs) 52void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
49{ 53{
50 memcpy(regs, exec_regs, sizeof(exec_regs)); 54 memcpy(regs, exec_regs, sizeof(exec_regs));
55
56 if (fp_regs)
57 memcpy(fp_regs, exec_fp_regs, sizeof(exec_fp_regs));
51} 58}
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index d261f170d12..e771398be5f 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -39,7 +39,7 @@ static unsigned long syscall_regs[MAX_REG_NR];
39 39
40static int __init init_syscall_regs(void) 40static int __init init_syscall_regs(void)
41{ 41{
42 get_safe_registers(syscall_regs); 42 get_safe_registers(syscall_regs, NULL);
43 syscall_regs[REGS_IP_INDEX] = STUB_CODE + 43 syscall_regs[REGS_IP_INDEX] = STUB_CODE +
44 ((unsigned long) &batch_syscall_stub - 44 ((unsigned long) &batch_syscall_stub -
45 (unsigned long) &__syscall_stub_start); 45 (unsigned long) &__syscall_stub_start);
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index d6e0a2234b8..dee0e8cf8ad 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -373,6 +373,9 @@ void userspace(struct uml_pt_regs *regs)
373 if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) 373 if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
374 fatal_sigsegv(); 374 fatal_sigsegv();
375 375
376 if (put_fp_registers(pid, regs->fp))
377 fatal_sigsegv();
378
376 /* Now we set local_using_sysemu to be used for one loop */ 379 /* Now we set local_using_sysemu to be used for one loop */
377 local_using_sysemu = get_using_sysemu(); 380 local_using_sysemu = get_using_sysemu();
378 381
@@ -399,6 +402,12 @@ void userspace(struct uml_pt_regs *regs)
399 fatal_sigsegv(); 402 fatal_sigsegv();
400 } 403 }
401 404
405 if (get_fp_registers(pid, regs->fp)) {
406 printk(UM_KERN_ERR "userspace - get_fp_registers failed, "
407 "errno = %d\n", errno);
408 fatal_sigsegv();
409 }
410
402 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ 411 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */
403 412
404 if (WIFSTOPPED(status)) { 413 if (WIFSTOPPED(status)) {
@@ -457,10 +466,11 @@ void userspace(struct uml_pt_regs *regs)
457} 466}
458 467
459static unsigned long thread_regs[MAX_REG_NR]; 468static unsigned long thread_regs[MAX_REG_NR];
469static unsigned long thread_fp_regs[FP_SIZE];
460 470
461static int __init init_thread_regs(void) 471static int __init init_thread_regs(void)
462{ 472{
463 get_safe_registers(thread_regs); 473 get_safe_registers(thread_regs, thread_fp_regs);
464 /* Set parent's instruction pointer to start of clone-stub */ 474 /* Set parent's instruction pointer to start of clone-stub */
465 thread_regs[REGS_IP_INDEX] = STUB_CODE + 475 thread_regs[REGS_IP_INDEX] = STUB_CODE +
466 (unsigned long) stub_clone_handler - 476 (unsigned long) stub_clone_handler -
@@ -503,6 +513,13 @@ int copy_context_skas0(unsigned long new_stack, int pid)
503 return err; 513 return err;
504 } 514 }
505 515
516 err = put_fp_registers(pid, thread_fp_regs);
517 if (err < 0) {
518 printk(UM_KERN_ERR "copy_context_skas0 : put_fp_registers "
519 "failed, pid = %d, err = %d\n", pid, err);
520 return err;
521 }
522
506 /* set a well known return code for detection of child write failure */ 523 /* set a well known return code for detection of child write failure */
507 child_data->err = 12345678; 524 child_data->err = 12345678;
508 525
diff --git a/arch/um/sys-i386/asm/ptrace.h b/arch/um/sys-i386/asm/ptrace.h
index 0273e4d09af..5d2a5911253 100644
--- a/arch/um/sys-i386/asm/ptrace.h
+++ b/arch/um/sys-i386/asm/ptrace.h
@@ -42,11 +42,6 @@
42 */ 42 */
43struct user_desc; 43struct user_desc;
44 44
45extern int get_fpxregs(struct user_fxsr_struct __user *buf,
46 struct task_struct *child);
47extern int set_fpxregs(struct user_fxsr_struct __user *buf,
48 struct task_struct *tsk);
49
50extern int ptrace_get_thread_area(struct task_struct *child, int idx, 45extern int ptrace_get_thread_area(struct task_struct *child, int idx,
51 struct user_desc __user *user_desc); 46 struct user_desc __user *user_desc);
52 47
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index d23b2d3ea38..3375c271785 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -145,7 +145,7 @@ int peek_user(struct task_struct *child, long addr, long data)
145 return put_user(tmp, (unsigned long __user *) data); 145 return put_user(tmp, (unsigned long __user *) data);
146} 146}
147 147
148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 148static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
149{ 149{
150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
151 struct user_i387_struct fpregs; 151 struct user_i387_struct fpregs;
@@ -161,7 +161,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
161 return n; 161 return n;
162} 162}
163 163
164int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 164static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
165{ 165{
166 int n, cpu = ((struct thread_info *) child->stack)->cpu; 166 int n, cpu = ((struct thread_info *) child->stack)->cpu;
167 struct user_i387_struct fpregs; 167 struct user_i387_struct fpregs;
@@ -174,7 +174,7 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
174 (unsigned long *) &fpregs); 174 (unsigned long *) &fpregs);
175} 175}
176 176
177int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 177static int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
178{ 178{
179 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 179 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
180 struct user_fxsr_struct fpregs; 180 struct user_fxsr_struct fpregs;
@@ -190,7 +190,7 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
190 return n; 190 return n;
191} 191}
192 192
193int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 193static int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
194{ 194{
195 int n, cpu = ((struct thread_info *) child->stack)->cpu; 195 int n, cpu = ((struct thread_info *) child->stack)->cpu;
196 struct user_fxsr_struct fpregs; 196 struct user_fxsr_struct fpregs;
@@ -206,5 +206,23 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
206long subarch_ptrace(struct task_struct *child, long request, 206long subarch_ptrace(struct task_struct *child, long request,
207 unsigned long addr, unsigned long data) 207 unsigned long addr, unsigned long data)
208{ 208{
209 return -EIO; 209 int ret = -EIO;
210 void __user *datap = (void __user *) data;
211 switch (request) {
212 case PTRACE_GETFPREGS: /* Get the child FPU state. */
213 ret = get_fpregs(datap, child);
214 break;
215 case PTRACE_SETFPREGS: /* Set the child FPU state. */
216 ret = set_fpregs(datap, child);
217 break;
218 case PTRACE_GETFPXREGS: /* Get the child FPU state. */
219 ret = get_fpxregs(datap, child);
220 break;
221 case PTRACE_SETFPXREGS: /* Set the child FPU state. */
222 ret = set_fpxregs(datap, child);
223 break;
224 default:
225 ret = -EIO;
226 }
227 return ret;
210} 228}
diff --git a/arch/um/sys-i386/shared/sysdep/ptrace.h b/arch/um/sys-i386/shared/sysdep/ptrace.h
index d50e62e0707..c398a507611 100644
--- a/arch/um/sys-i386/shared/sysdep/ptrace.h
+++ b/arch/um/sys-i386/shared/sysdep/ptrace.h
@@ -53,6 +53,7 @@ extern int sysemu_supported;
53 53
54struct uml_pt_regs { 54struct uml_pt_regs {
55 unsigned long gp[MAX_REG_NR]; 55 unsigned long gp[MAX_REG_NR];
56 unsigned long fp[HOST_FPX_SIZE];
56 struct faultinfo faultinfo; 57 struct faultinfo faultinfo;
57 long syscall; 58 long syscall;
58 int is_user; 59 int is_user;
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index f43613643cd..4005506834f 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -145,7 +145,7 @@ int is_syscall(unsigned long addr)
145 return instr == 0x050f; 145 return instr == 0x050f;
146} 146}
147 147
148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 148static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
149{ 149{
150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
151 long fpregs[HOST_FP_SIZE]; 151 long fpregs[HOST_FP_SIZE];
@@ -162,7 +162,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
162 return n; 162 return n;
163} 163}
164 164
165int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 165static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
166{ 166{
167 int n, cpu = ((struct thread_info *) child->stack)->cpu; 167 int n, cpu = ((struct thread_info *) child->stack)->cpu;
168 long fpregs[HOST_FP_SIZE]; 168 long fpregs[HOST_FP_SIZE];
@@ -182,12 +182,16 @@ long subarch_ptrace(struct task_struct *child, long request,
182 void __user *datap = (void __user *) data; 182 void __user *datap = (void __user *) data;
183 183
184 switch (request) { 184 switch (request) {
185 case PTRACE_GETFPXREGS: /* Get the child FPU state. */ 185 case PTRACE_GETFPREGS: /* Get the child FPU state. */
186 ret = get_fpregs(datap, child); 186 ret = get_fpregs(datap, child);
187 break; 187 break;
188 case PTRACE_SETFPXREGS: /* Set the child FPU state. */ 188 case PTRACE_SETFPREGS: /* Set the child FPU state. */
189 ret = set_fpregs(datap, child); 189 ret = set_fpregs(datap, child);
190 break; 190 break;
191 case PTRACE_ARCH_PRCTL:
192 /* XXX Calls ptrace on the host - needs some SMP thinking */
193 ret = arch_prctl(child, data, (void __user *) addr);
194 break;
191 } 195 }
192 196
193 return ret; 197 return ret;
diff --git a/arch/um/sys-x86_64/shared/sysdep/ptrace.h b/arch/um/sys-x86_64/shared/sysdep/ptrace.h
index fdba5457947..8ee8f8e12af 100644
--- a/arch/um/sys-x86_64/shared/sysdep/ptrace.h
+++ b/arch/um/sys-x86_64/shared/sysdep/ptrace.h
@@ -85,6 +85,7 @@
85 85
86struct uml_pt_regs { 86struct uml_pt_regs {
87 unsigned long gp[MAX_REG_NR]; 87 unsigned long gp[MAX_REG_NR];
88 unsigned long fp[HOST_FP_SIZE];
88 struct faultinfo faultinfo; 89 struct faultinfo faultinfo;
89 long syscall; 90 long syscall;
90 int is_user; 91 int is_user;
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 100eab842e6..4892fbb54eb 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -102,7 +102,7 @@ void pci_puv3_preinit(void)
102 writel(readl(PCIBRI_CMD) | PCIBRI_CMD_IO | PCIBRI_CMD_MEM, PCIBRI_CMD); 102 writel(readl(PCIBRI_CMD) | PCIBRI_CMD_IO | PCIBRI_CMD_MEM, PCIBRI_CMD);
103} 103}
104 104
105static int __init pci_puv3_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 105static int __init pci_puv3_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
106{ 106{
107 if (dev->bus->number == 0) { 107 if (dev->bus->number == 0) {
108#ifdef CONFIG_ARCH_FPGA /* 4 pci slots */ 108#ifdef CONFIG_ARCH_FPGA /* 4 pci slots */
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 78fe57dcfc5..6a47bb22657 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -72,6 +72,7 @@ config X86
72 select USE_GENERIC_SMP_HELPERS if SMP 72 select USE_GENERIC_SMP_HELPERS if SMP
73 select HAVE_BPF_JIT if (X86_64 && NET) 73 select HAVE_BPF_JIT if (X86_64 && NET)
74 select CLKEVT_I8253 74 select CLKEVT_I8253
75 select ARCH_HAVE_NMI_SAFE_CMPXCHG
75 76
76config INSTRUCTION_DECODER 77config INSTRUCTION_DECODER
77 def_bool (KPROBES || PERF_EVENTS) 78 def_bool (KPROBES || PERF_EVENTS)
@@ -1905,7 +1906,7 @@ config PCI_BIOS
1905# x86-64 doesn't support PCI BIOS access from long mode so always go direct. 1906# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
1906config PCI_DIRECT 1907config PCI_DIRECT
1907 def_bool y 1908 def_bool y
1908 depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC)) 1909 depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC || PCI_GOMMCONFIG))
1909 1910
1910config PCI_MMCONFIG 1911config PCI_MMCONFIG
1911 def_bool y 1912 def_bool y
@@ -2024,11 +2025,44 @@ config OLPC
2024 Add support for detecting the unique features of the OLPC 2025 Add support for detecting the unique features of the OLPC
2025 XO hardware. 2026 XO hardware.
2026 2027
2027config OLPC_XO1 2028config OLPC_XO1_PM
2028 tristate "OLPC XO-1 support" 2029 bool "OLPC XO-1 Power Management"
2029 depends on OLPC && MFD_CS5535 2030 depends on OLPC && MFD_CS5535 && PM_SLEEP
2030 ---help--- 2031 select MFD_CORE
2031 Add support for non-essential features of the OLPC XO-1 laptop. 2032 ---help---
2033 Add support for poweroff and suspend of the OLPC XO-1 laptop.
2034
2035config OLPC_XO1_RTC
2036 bool "OLPC XO-1 Real Time Clock"
2037 depends on OLPC_XO1_PM && RTC_DRV_CMOS
2038 ---help---
2039 Add support for the XO-1 real time clock, which can be used as a
2040 programmable wakeup source.
2041
2042config OLPC_XO1_SCI
2043 bool "OLPC XO-1 SCI extras"
2044 depends on OLPC && OLPC_XO1_PM
2045 select POWER_SUPPLY
2046 select GPIO_CS5535
2047 select MFD_CORE
2048 ---help---
2049 Add support for SCI-based features of the OLPC XO-1 laptop:
2050 - EC-driven system wakeups
2051 - Power button
2052 - Ebook switch
2053 - Lid switch
2054 - AC adapter status updates
2055 - Battery status updates
2056
2057config OLPC_XO15_SCI
2058 bool "OLPC XO-1.5 SCI extras"
2059 depends on OLPC && ACPI
2060 select POWER_SUPPLY
2061 ---help---
2062 Add support for SCI-based features of the OLPC XO-1.5 laptop:
2063 - EC-driven system wakeups
2064 - AC adapter status updates
2065 - Battery status updates
2032 2066
2033endif # X86_32 2067endif # X86_32
2034 2068
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index a0e866d233e..54edb207ff3 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -672,7 +672,7 @@ ia32_sys_call_table:
672 .quad sys32_vm86_warning /* vm86 */ 672 .quad sys32_vm86_warning /* vm86 */
673 .quad quiet_ni_syscall /* query_module */ 673 .quad quiet_ni_syscall /* query_module */
674 .quad sys_poll 674 .quad sys_poll
675 .quad compat_sys_nfsservctl 675 .quad quiet_ni_syscall /* old nfsservctl */
676 .quad sys_setresgid16 /* 170 */ 676 .quad sys_setresgid16 /* 170 */
677 .quad sys_getresgid16 677 .quad sys_getresgid16
678 .quad sys_prctl 678 .quad sys_prctl
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 5852519b2d0..f6f5c53dc90 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -43,7 +43,7 @@
43#include <asm/mman.h> 43#include <asm/mman.h>
44#include <asm/types.h> 44#include <asm/types.h>
45#include <asm/uaccess.h> 45#include <asm/uaccess.h>
46#include <asm/atomic.h> 46#include <linux/atomic.h>
47#include <asm/vgtod.h> 47#include <asm/vgtod.h>
48#include <asm/sys_ia32.h> 48#include <asm/sys_ia32.h>
49 49
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 4a0b7c7e2cc..7b3ca8324b6 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -8,7 +8,7 @@
8#include <asm/cpufeature.h> 8#include <asm/cpufeature.h>
9#include <asm/processor.h> 9#include <asm/processor.h>
10#include <asm/apicdef.h> 10#include <asm/apicdef.h>
11#include <asm/atomic.h> 11#include <linux/atomic.h>
12#include <asm/fixmap.h> 12#include <asm/fixmap.h>
13#include <asm/mpspec.h> 13#include <asm/mpspec.h>
14#include <asm/system.h> 14#include <asm/system.h>
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 952a826ac4e..10572e309ab 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -221,15 +221,15 @@ static inline int atomic_xchg(atomic_t *v, int new)
221} 221}
222 222
223/** 223/**
224 * atomic_add_unless - add unless the number is already a given value 224 * __atomic_add_unless - add unless the number is already a given value
225 * @v: pointer of type atomic_t 225 * @v: pointer of type atomic_t
226 * @a: the amount to add to v... 226 * @a: the amount to add to v...
227 * @u: ...unless v is equal to u. 227 * @u: ...unless v is equal to u.
228 * 228 *
229 * Atomically adds @a to @v, so long as @v was not already @u. 229 * Atomically adds @a to @v, so long as @v was not already @u.
230 * Returns non-zero if @v was not @u, and zero otherwise. 230 * Returns the old value of @v.
231 */ 231 */
232static inline int atomic_add_unless(atomic_t *v, int a, int u) 232static inline int __atomic_add_unless(atomic_t *v, int a, int u)
233{ 233{
234 int c, old; 234 int c, old;
235 c = atomic_read(v); 235 c = atomic_read(v);
@@ -241,10 +241,9 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
241 break; 241 break;
242 c = old; 242 c = old;
243 } 243 }
244 return c != (u); 244 return c;
245} 245}
246 246
247#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
248 247
249/* 248/*
250 * atomic_dec_if_positive - decrement by 1 if old value positive 249 * atomic_dec_if_positive - decrement by 1 if old value positive
@@ -319,5 +318,4 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
319# include "atomic64_64.h" 318# include "atomic64_64.h"
320#endif 319#endif
321 320
322#include <asm-generic/atomic-long.h>
323#endif /* _ASM_X86_ATOMIC_H */ 321#endif /* _ASM_X86_ATOMIC_H */
diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h
index 2a934aa19a4..24098aafce0 100644
--- a/arch/x86/include/asm/atomic64_32.h
+++ b/arch/x86/include/asm/atomic64_32.h
@@ -263,7 +263,7 @@ static inline int atomic64_add_negative(long long i, atomic64_t *v)
263 * @u: ...unless v is equal to u. 263 * @u: ...unless v is equal to u.
264 * 264 *
265 * Atomically adds @a to @v, so long as it was not @u. 265 * Atomically adds @a to @v, so long as it was not @u.
266 * Returns non-zero if @v was not @u, and zero otherwise. 266 * Returns the old value of @v.
267 */ 267 */
268static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u) 268static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)
269{ 269{
diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h
index 49fd1ea2295..017594d403f 100644
--- a/arch/x86/include/asm/atomic64_64.h
+++ b/arch/x86/include/asm/atomic64_64.h
@@ -202,7 +202,7 @@ static inline long atomic64_xchg(atomic64_t *v, long new)
202 * @u: ...unless v is equal to u. 202 * @u: ...unless v is equal to u.
203 * 203 *
204 * Atomically adds @a to @v, so long as it was not @u. 204 * Atomically adds @a to @v, so long as it was not @u.
205 * Returns non-zero if @v was not @u, and zero otherwise. 205 * Returns the old value of @v.
206 */ 206 */
207static inline int atomic64_add_unless(atomic64_t *v, long a, long u) 207static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
208{ 208{
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index 69d58131bc8..1775d6e5920 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -458,10 +458,7 @@ static inline int fls(int x)
458 458
459#include <asm-generic/bitops/le.h> 459#include <asm-generic/bitops/le.h>
460 460
461#define ext2_set_bit_atomic(lock, nr, addr) \ 461#include <asm-generic/bitops/ext2-atomic-setbit.h>
462 test_and_set_bit((nr), (unsigned long *)(addr))
463#define ext2_clear_bit_atomic(lock, nr, addr) \
464 test_and_clear_bit((nr), (unsigned long *)(addr))
465 462
466#endif /* __KERNEL__ */ 463#endif /* __KERNEL__ */
467#endif /* _ASM_X86_BITOPS_H */ 464#endif /* _ASM_X86_BITOPS_H */
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 7b439d9aea2..41935fadfdf 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -27,8 +27,8 @@ static inline void fill_ldt(struct desc_struct *desc, const struct user_desc *in
27 27
28 desc->base2 = (info->base_addr & 0xff000000) >> 24; 28 desc->base2 = (info->base_addr & 0xff000000) >> 24;
29 /* 29 /*
30 * Don't allow setting of the lm bit. It is useless anyway 30 * Don't allow setting of the lm bit. It would confuse
31 * because 64bit system calls require __USER_CS: 31 * user_64bit_mode and would get overridden by sysret anyway.
32 */ 32 */
33 desc->l = 0; 33 desc->l = 0;
34} 34}
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 13f5504c76c..09199052060 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -21,7 +21,7 @@
21#include <linux/profile.h> 21#include <linux/profile.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23 23
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/sections.h> 26#include <asm/sections.h>
27 27
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index d02804d650c..d8e8eefbe24 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -40,8 +40,6 @@
40#include <linux/compiler.h> 40#include <linux/compiler.h>
41#include <asm/page.h> 41#include <asm/page.h>
42 42
43#include <xen/xen.h>
44
45#define build_mmio_read(name, size, type, reg, barrier) \ 43#define build_mmio_read(name, size, type, reg, barrier) \
46static inline type name(const volatile void __iomem *addr) \ 44static inline type name(const volatile void __iomem *addr) \
47{ type ret; asm volatile("mov" size " %1,%0":reg (ret) \ 45{ type ret; asm volatile("mov" size " %1,%0":reg (ret) \
@@ -334,6 +332,7 @@ extern void fixup_early_ioremap(void);
334extern bool is_early_ioremap_ptep(pte_t *ptep); 332extern bool is_early_ioremap_ptep(pte_t *ptep);
335 333
336#ifdef CONFIG_XEN 334#ifdef CONFIG_XEN
335#include <xen/xen.h>
337struct bio_vec; 336struct bio_vec;
338 337
339extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, 338extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index f9a320984a1..7e50f06393a 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -17,7 +17,6 @@
17 * Vectors 0 ... 31 : system traps and exceptions - hardcoded events 17 * Vectors 0 ... 31 : system traps and exceptions - hardcoded events
18 * Vectors 32 ... 127 : device interrupts 18 * Vectors 32 ... 127 : device interrupts
19 * Vector 128 : legacy int80 syscall interface 19 * Vector 128 : legacy int80 syscall interface
20 * Vector 204 : legacy x86_64 vsyscall emulation
21 * Vectors 129 ... INVALIDATE_TLB_VECTOR_START-1 except 204 : device interrupts 20 * Vectors 129 ... INVALIDATE_TLB_VECTOR_START-1 except 204 : device interrupts
22 * Vectors INVALIDATE_TLB_VECTOR_START ... 255 : special interrupts 21 * Vectors INVALIDATE_TLB_VECTOR_START ... 255 : special interrupts
23 * 22 *
@@ -51,9 +50,6 @@
51#ifdef CONFIG_X86_32 50#ifdef CONFIG_X86_32
52# define SYSCALL_VECTOR 0x80 51# define SYSCALL_VECTOR 0x80
53#endif 52#endif
54#ifdef CONFIG_X86_64
55# define VSYSCALL_EMU_VECTOR 0xcc
56#endif
57 53
58/* 54/*
59 * Vectors 0x30-0x3f are used for ISA interrupts. 55 * Vectors 0x30-0x3f are used for ISA interrupts.
diff --git a/arch/x86/include/asm/kdebug.h b/arch/x86/include/asm/kdebug.h
index fe2cc6e105f..d73f1571bde 100644
--- a/arch/x86/include/asm/kdebug.h
+++ b/arch/x86/include/asm/kdebug.h
@@ -28,7 +28,6 @@ extern void show_registers(struct pt_regs *regs);
28extern void show_trace(struct task_struct *t, struct pt_regs *regs, 28extern void show_trace(struct task_struct *t, struct pt_regs *regs,
29 unsigned long *sp, unsigned long bp); 29 unsigned long *sp, unsigned long bp);
30extern void __show_regs(struct pt_regs *regs, int all); 30extern void __show_regs(struct pt_regs *regs, int all);
31extern void show_regs(struct pt_regs *regs);
32extern unsigned long oops_begin(void); 31extern unsigned long oops_begin(void);
33extern void oops_end(unsigned long, struct pt_regs *, int signr); 32extern void oops_end(unsigned long, struct pt_regs *, int signr);
34#ifdef CONFIG_KEXEC 33#ifdef CONFIG_KEXEC
diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
index 2e9972468a5..9cdae5d47e8 100644
--- a/arch/x86/include/asm/local.h
+++ b/arch/x86/include/asm/local.h
@@ -4,7 +4,7 @@
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5 5
6#include <asm/system.h> 6#include <asm/system.h>
7#include <asm/atomic.h> 7#include <linux/atomic.h>
8#include <asm/asm.h> 8#include <asm/asm.h>
9 9
10typedef struct { 10typedef struct {
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 716b48af786..c9321f34e55 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -124,7 +124,7 @@ extern struct atomic_notifier_head x86_mce_decoder_chain;
124 124
125#include <linux/percpu.h> 125#include <linux/percpu.h>
126#include <linux/init.h> 126#include <linux/init.h>
127#include <asm/atomic.h> 127#include <linux/atomic.h>
128 128
129extern int mce_disabled; 129extern int mce_disabled;
130extern int mce_p5_enabled; 130extern int mce_p5_enabled;
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 8b5393ec108..69021528b43 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -2,7 +2,7 @@
2#define _ASM_X86_MMU_CONTEXT_H 2#define _ASM_X86_MMU_CONTEXT_H
3 3
4#include <asm/desc.h> 4#include <asm/desc.h>
5#include <asm/atomic.h> 5#include <linux/atomic.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm/tlbflush.h> 7#include <asm/tlbflush.h>
8#include <asm/paravirt.h> 8#include <asm/paravirt.h>
diff --git a/arch/x86/include/asm/olpc.h b/arch/x86/include/asm/olpc.h
index 5ca6801b75f..87bdbca72f9 100644
--- a/arch/x86/include/asm/olpc.h
+++ b/arch/x86/include/asm/olpc.h
@@ -13,6 +13,7 @@ struct olpc_platform_t {
13 13
14#define OLPC_F_PRESENT 0x01 14#define OLPC_F_PRESENT 0x01
15#define OLPC_F_DCON 0x02 15#define OLPC_F_DCON 0x02
16#define OLPC_F_EC_WIDE_SCI 0x04
16 17
17#ifdef CONFIG_OLPC 18#ifdef CONFIG_OLPC
18 19
@@ -62,6 +63,13 @@ static inline int olpc_board_at_least(uint32_t rev)
62 return olpc_platform_info.boardrev >= rev; 63 return olpc_platform_info.boardrev >= rev;
63} 64}
64 65
66extern void olpc_ec_wakeup_set(u16 value);
67extern void olpc_ec_wakeup_clear(u16 value);
68extern bool olpc_ec_wakeup_available(void);
69
70extern int olpc_ec_mask_write(u16 bits);
71extern int olpc_ec_sci_query(u16 *sci_value);
72
65#else 73#else
66 74
67static inline int machine_is_olpc(void) 75static inline int machine_is_olpc(void)
@@ -74,6 +82,20 @@ static inline int olpc_has_dcon(void)
74 return 0; 82 return 0;
75} 83}
76 84
85static inline void olpc_ec_wakeup_set(u16 value) { }
86static inline void olpc_ec_wakeup_clear(u16 value) { }
87
88static inline bool olpc_ec_wakeup_available(void)
89{
90 return false;
91}
92
93#endif
94
95#ifdef CONFIG_OLPC_XO1_PM
96extern void do_olpc_suspend_lowlevel(void);
97extern void olpc_xo1_pm_wakeup_set(u16 value);
98extern void olpc_xo1_pm_wakeup_clear(u16 value);
77#endif 99#endif
78 100
79extern int pci_olpc_init(void); 101extern int pci_olpc_init(void);
@@ -83,14 +105,19 @@ extern int pci_olpc_init(void);
83extern int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen, 105extern int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
84 unsigned char *outbuf, size_t outlen); 106 unsigned char *outbuf, size_t outlen);
85 107
86extern int olpc_ec_mask_set(uint8_t bits);
87extern int olpc_ec_mask_unset(uint8_t bits);
88
89/* EC commands */ 108/* EC commands */
90 109
91#define EC_FIRMWARE_REV 0x08 110#define EC_FIRMWARE_REV 0x08
92#define EC_WLAN_ENTER_RESET 0x35 111#define EC_WRITE_SCI_MASK 0x1b
93#define EC_WLAN_LEAVE_RESET 0x25 112#define EC_WAKE_UP_WLAN 0x24
113#define EC_WLAN_LEAVE_RESET 0x25
114#define EC_READ_EB_MODE 0x2a
115#define EC_SET_SCI_INHIBIT 0x32
116#define EC_SET_SCI_INHIBIT_RELEASE 0x34
117#define EC_WLAN_ENTER_RESET 0x35
118#define EC_WRITE_EXT_SCI_MASK 0x38
119#define EC_SCI_QUERY 0x84
120#define EC_EXT_SCI_QUERY 0x85
94 121
95/* SCI source values */ 122/* SCI source values */
96 123
@@ -99,10 +126,12 @@ extern int olpc_ec_mask_unset(uint8_t bits);
99#define EC_SCI_SRC_BATTERY 0x02 126#define EC_SCI_SRC_BATTERY 0x02
100#define EC_SCI_SRC_BATSOC 0x04 127#define EC_SCI_SRC_BATSOC 0x04
101#define EC_SCI_SRC_BATERR 0x08 128#define EC_SCI_SRC_BATERR 0x08
102#define EC_SCI_SRC_EBOOK 0x10 129#define EC_SCI_SRC_EBOOK 0x10 /* XO-1 only */
103#define EC_SCI_SRC_WLAN 0x20 130#define EC_SCI_SRC_WLAN 0x20 /* XO-1 only */
104#define EC_SCI_SRC_ACPWR 0x40 131#define EC_SCI_SRC_ACPWR 0x40
105#define EC_SCI_SRC_ALL 0x7F 132#define EC_SCI_SRC_BATCRIT 0x80
133#define EC_SCI_SRC_GPWAKE 0x100 /* XO-1.5 only */
134#define EC_SCI_SRC_ALL 0x1FF
106 135
107/* GPIO assignments */ 136/* GPIO assignments */
108 137
@@ -116,7 +145,7 @@ extern int olpc_ec_mask_unset(uint8_t bits);
116#define OLPC_GPIO_SMB_CLK 14 145#define OLPC_GPIO_SMB_CLK 14
117#define OLPC_GPIO_SMB_DATA 15 146#define OLPC_GPIO_SMB_DATA 15
118#define OLPC_GPIO_WORKAUX geode_gpio(24) 147#define OLPC_GPIO_WORKAUX geode_gpio(24)
119#define OLPC_GPIO_LID geode_gpio(26) 148#define OLPC_GPIO_LID 26
120#define OLPC_GPIO_ECSCI geode_gpio(27) 149#define OLPC_GPIO_ECSCI 27
121 150
122#endif /* _ASM_X86_OLPC_H */ 151#endif /* _ASM_X86_OLPC_H */
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index 2c765216311..8e8b9a4987e 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -41,6 +41,7 @@
41 41
42#include <asm/desc_defs.h> 42#include <asm/desc_defs.h>
43#include <asm/kmap_types.h> 43#include <asm/kmap_types.h>
44#include <asm/pgtable_types.h>
44 45
45struct page; 46struct page;
46struct thread_struct; 47struct thread_struct;
@@ -63,6 +64,11 @@ struct paravirt_callee_save {
63struct pv_info { 64struct pv_info {
64 unsigned int kernel_rpl; 65 unsigned int kernel_rpl;
65 int shared_kernel_pmd; 66 int shared_kernel_pmd;
67
68#ifdef CONFIG_X86_64
69 u16 extra_user_64bit_cs; /* __USER_CS if none */
70#endif
71
66 int paravirt_enabled; 72 int paravirt_enabled;
67 const char *name; 73 const char *name;
68}; 74};
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 219371546af..0d1171c9772 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -751,8 +751,6 @@ static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
751 :: "a" (eax), "c" (ecx)); 751 :: "a" (eax), "c" (ecx));
752} 752}
753 753
754extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
755
756extern void select_idle_routine(const struct cpuinfo_x86 *c); 754extern void select_idle_routine(const struct cpuinfo_x86 *c);
757extern void init_amd_e400_c1e_mask(void); 755extern void init_amd_e400_c1e_mask(void);
758 756
diff --git a/arch/x86/include/asm/prom.h b/arch/x86/include/asm/prom.h
index df1287019e6..644dd885f05 100644
--- a/arch/x86/include/asm/prom.h
+++ b/arch/x86/include/asm/prom.h
@@ -19,7 +19,7 @@
19#include <linux/pci.h> 19#include <linux/pci.h>
20 20
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/atomic.h> 22#include <linux/atomic.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/irq_controller.h> 24#include <asm/irq_controller.h>
25 25
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 94e7618fcac..35664547125 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -131,6 +131,9 @@ struct pt_regs {
131#ifdef __KERNEL__ 131#ifdef __KERNEL__
132 132
133#include <linux/init.h> 133#include <linux/init.h>
134#ifdef CONFIG_PARAVIRT
135#include <asm/paravirt_types.h>
136#endif
134 137
135struct cpuinfo_x86; 138struct cpuinfo_x86;
136struct task_struct; 139struct task_struct;
@@ -187,6 +190,22 @@ static inline int v8086_mode(struct pt_regs *regs)
187#endif 190#endif
188} 191}
189 192
193#ifdef CONFIG_X86_64
194static inline bool user_64bit_mode(struct pt_regs *regs)
195{
196#ifndef CONFIG_PARAVIRT
197 /*
198 * On non-paravirt systems, this is the only long mode CPL 3
199 * selector. We do not allow long mode selectors in the LDT.
200 */
201 return regs->cs == __USER_CS;
202#else
203 /* Headers are too twisted for this to go in paravirt.h. */
204 return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
205#endif
206}
207#endif
208
190/* 209/*
191 * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode 210 * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
192 * when it traps. The previous stack will be directly underneath the saved 211 * when it traps. The previous stack will be directly underneath the saved
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index a518c0a4504..c59cc97fe6c 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -44,7 +44,7 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
44 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); 44 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
45#elif defined(__x86_64__) 45#elif defined(__x86_64__)
46 __asm__ ( 46 __asm__ (
47 "mul %[mul_frac] ; shrd $32, %[hi], %[lo]" 47 "mulq %[mul_frac] ; shrd $32, %[hi], %[lo]"
48 : [lo]"=a"(product), 48 : [lo]"=a"(product),
49 [hi]"=d"(tmp) 49 [hi]"=d"(tmp)
50 : "0"(delta), 50 : "0"(delta),
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index e9e51f710e6..ee67edf86fd 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_X86_SPINLOCK_H 1#ifndef _ASM_X86_SPINLOCK_H
2#define _ASM_X86_SPINLOCK_H 2#define _ASM_X86_SPINLOCK_H
3 3
4#include <asm/atomic.h> 4#include <linux/atomic.h>
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/processor.h> 6#include <asm/processor.h>
7#include <linux/compiler.h> 7#include <linux/compiler.h>
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 1f2e61e2898..a1fe5c127b5 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -21,7 +21,7 @@ struct task_struct;
21struct exec_domain; 21struct exec_domain;
22#include <asm/processor.h> 22#include <asm/processor.h>
23#include <asm/ftrace.h> 23#include <asm/ftrace.h>
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25 25
26struct thread_info { 26struct thread_info {
27 struct task_struct *task; /* main task structure */ 27 struct task_struct *task; /* main task structure */
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 2bae0a513b4..0012d0902c5 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -40,7 +40,6 @@ asmlinkage void alignment_check(void);
40asmlinkage void machine_check(void); 40asmlinkage void machine_check(void);
41#endif /* CONFIG_X86_MCE */ 41#endif /* CONFIG_X86_MCE */
42asmlinkage void simd_coprocessor_error(void); 42asmlinkage void simd_coprocessor_error(void);
43asmlinkage void emulate_vsyscall(void);
44 43
45dotraplinkage void do_divide_error(struct pt_regs *, long); 44dotraplinkage void do_divide_error(struct pt_regs *, long);
46dotraplinkage void do_debug(struct pt_regs *, long); 45dotraplinkage void do_debug(struct pt_regs *, long);
@@ -67,7 +66,6 @@ dotraplinkage void do_alignment_check(struct pt_regs *, long);
67dotraplinkage void do_machine_check(struct pt_regs *, long); 66dotraplinkage void do_machine_check(struct pt_regs *, long);
68#endif 67#endif
69dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long); 68dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long);
70dotraplinkage void do_emulate_vsyscall(struct pt_regs *, long);
71#ifdef CONFIG_X86_32 69#ifdef CONFIG_X86_32
72dotraplinkage void do_iret_error(struct pt_regs *, long); 70dotraplinkage void do_iret_error(struct pt_regs *, long);
73#endif 71#endif
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index 705bf139288..20104057344 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -414,7 +414,7 @@ __SYSCALL(__NR_query_module, sys_ni_syscall)
414__SYSCALL(__NR_quotactl, sys_quotactl) 414__SYSCALL(__NR_quotactl, sys_quotactl)
415 415
416#define __NR_nfsservctl 180 416#define __NR_nfsservctl 180
417__SYSCALL(__NR_nfsservctl, sys_nfsservctl) 417__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
418 418
419/* reserved for LiS/STREAMS */ 419/* reserved for LiS/STREAMS */
420#define __NR_getpmsg 181 420#define __NR_getpmsg 181
@@ -681,6 +681,8 @@ __SYSCALL(__NR_syncfs, sys_syncfs)
681__SYSCALL(__NR_sendmmsg, sys_sendmmsg) 681__SYSCALL(__NR_sendmmsg, sys_sendmmsg)
682#define __NR_setns 308 682#define __NR_setns 308
683__SYSCALL(__NR_setns, sys_setns) 683__SYSCALL(__NR_setns, sys_setns)
684#define __NR_getcpu 309
685__SYSCALL(__NR_getcpu, sys_getcpu)
684 686
685#ifndef __NO_STUBS 687#ifndef __NO_STUBS
686#define __ARCH_WANT_OLD_READDIR 688#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h
index 60107072c28..eaea1d31f75 100644
--- a/arch/x86/include/asm/vsyscall.h
+++ b/arch/x86/include/asm/vsyscall.h
@@ -27,6 +27,12 @@ extern struct timezone sys_tz;
27 27
28extern void map_vsyscall(void); 28extern void map_vsyscall(void);
29 29
30/*
31 * Called on instruction fetch fault in vsyscall page.
32 * Returns true if handled.
33 */
34extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
35
30#endif /* __KERNEL__ */ 36#endif /* __KERNEL__ */
31 37
32#endif /* _ASM_X86_VSYSCALL_H */ 38#endif /* _ASM_X86_VSYSCALL_H */
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 64a619d47d3..7ff4669580c 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -39,7 +39,7 @@ typedef struct xpaddr {
39 ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE)) 39 ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE))
40 40
41extern unsigned long *machine_to_phys_mapping; 41extern unsigned long *machine_to_phys_mapping;
42extern unsigned int machine_to_phys_order; 42extern unsigned long machine_to_phys_nr;
43 43
44extern unsigned long get_phys_to_machine(unsigned long pfn); 44extern unsigned long get_phys_to_machine(unsigned long pfn);
45extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); 45extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
@@ -87,7 +87,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
87 if (xen_feature(XENFEAT_auto_translated_physmap)) 87 if (xen_feature(XENFEAT_auto_translated_physmap))
88 return mfn; 88 return mfn;
89 89
90 if (unlikely((mfn >> machine_to_phys_order) != 0)) { 90 if (unlikely(mfn >= machine_to_phys_nr)) {
91 pfn = ~0; 91 pfn = ~0;
92 goto try_override; 92 goto try_override;
93 } 93 }
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 04105574c8e..82f2912155a 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -17,19 +17,6 @@ CFLAGS_REMOVE_ftrace.o = -pg
17CFLAGS_REMOVE_early_printk.o = -pg 17CFLAGS_REMOVE_early_printk.o = -pg
18endif 18endif
19 19
20#
21# vsyscalls (which work on the user stack) should have
22# no stack-protector checks:
23#
24nostackp := $(call cc-option, -fno-stack-protector)
25CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp)
26CFLAGS_hpet.o := $(nostackp)
27CFLAGS_paravirt.o := $(nostackp)
28GCOV_PROFILE_vsyscall_64.o := n
29GCOV_PROFILE_hpet.o := n
30GCOV_PROFILE_tsc.o := n
31GCOV_PROFILE_paravirt.o := n
32
33obj-y := process_$(BITS).o signal.o entry_$(BITS).o 20obj-y := process_$(BITS).o signal.o entry_$(BITS).o
34obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 21obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
35obj-y += time.o ioport.o ldt.o dumpstack.o 22obj-y += time.o ioport.o ldt.o dumpstack.o
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 5812404a0d4..f50e7fb2a20 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -149,6 +149,29 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
149} 149}
150EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe); 150EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);
151 151
152/*
153 * This uses new MONITOR/MWAIT instructions on P4 processors with PNI,
154 * which can obviate IPI to trigger checking of need_resched.
155 * We execute MONITOR against need_resched and enter optimized wait state
156 * through MWAIT. Whenever someone changes need_resched, we would be woken
157 * up from MWAIT (without an IPI).
158 *
159 * New with Core Duo processors, MWAIT can take some hints based on CPU
160 * capability.
161 */
162void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
163{
164 if (!need_resched()) {
165 if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR))
166 clflush((void *)&current_thread_info()->flags);
167
168 __monitor((void *)&current_thread_info()->flags, 0, 0);
169 smp_mb();
170 if (!need_resched())
171 __mwait(ax, cx);
172 }
173}
174
152void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx) 175void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx)
153{ 176{
154 unsigned int cpu = smp_processor_id(); 177 unsigned int cpu = smp_processor_id();
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index b117efd24f7..8a439d364b9 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -30,7 +30,7 @@
30#include <linux/syscore_ops.h> 30#include <linux/syscore_ops.h>
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/gfp.h> 32#include <linux/gfp.h>
33#include <asm/atomic.h> 33#include <linux/atomic.h>
34#include <asm/mtrr.h> 34#include <asm/mtrr.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/proto.h> 36#include <asm/proto.h>
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index b24be38c8cf..52fa56399a5 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -38,7 +38,7 @@
38#include <asm/perf_event.h> 38#include <asm/perf_event.h>
39#include <asm/x86_init.h> 39#include <asm/x86_init.h>
40#include <asm/pgalloc.h> 40#include <asm/pgalloc.h>
41#include <asm/atomic.h> 41#include <linux/atomic.h>
42#include <asm/mpspec.h> 42#include <asm/mpspec.h>
43#include <asm/i8259.h> 43#include <asm/i8259.h>
44#include <asm/proto.h> 44#include <asm/proto.h>
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
index 9536b3fe43f..5d513bc47b6 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -48,7 +48,7 @@
48#include <linux/io.h> 48#include <linux/io.h>
49 49
50#include <asm/apicdef.h> 50#include <asm/apicdef.h>
51#include <asm/atomic.h> 51#include <linux/atomic.h>
52#include <asm/fixmap.h> 52#include <asm/fixmap.h>
53#include <asm/mpspec.h> 53#include <asm/mpspec.h>
54#include <asm/setup.h> 54#include <asm/setup.h>
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index adc66c3a1fe..34b18594e72 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -207,7 +207,6 @@ static int __cpuinit uv_wakeup_secondary(int phys_apicid, unsigned long start_ri
207 ((start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) | 207 ((start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) |
208 APIC_DM_INIT; 208 APIC_DM_INIT;
209 uv_write_global_mmr64(pnode, UVH_IPI_INT, val); 209 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
210 mdelay(10);
211 210
212 val = (1UL << UVH_IPI_INT_SEND_SHFT) | 211 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
213 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) | 212 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 22a073d7fbf..62184390a60 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -21,7 +21,7 @@
21#include <linux/topology.h> 21#include <linux/topology.h>
22#include <linux/cpumask.h> 22#include <linux/cpumask.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25#include <asm/proto.h> 25#include <asm/proto.h>
26#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/apic.h> 27#include <asm/apic.h>
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 08119a37e53..6b96110bb0c 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -149,7 +149,6 @@ struct set_mtrr_data {
149 */ 149 */
150static int mtrr_rendezvous_handler(void *info) 150static int mtrr_rendezvous_handler(void *info)
151{ 151{
152#ifdef CONFIG_SMP
153 struct set_mtrr_data *data = info; 152 struct set_mtrr_data *data = info;
154 153
155 /* 154 /*
@@ -171,7 +170,6 @@ static int mtrr_rendezvous_handler(void *info)
171 } else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) { 170 } else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) {
172 mtrr_if->set_all(); 171 mtrr_if->set_all();
173 } 172 }
174#endif
175 return 0; 173 return 0;
176} 174}
177 175
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 4ee3abf20ed..cfa62ec090e 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1900,6 +1900,9 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
1900 1900
1901 perf_callchain_store(entry, regs->ip); 1901 perf_callchain_store(entry, regs->ip);
1902 1902
1903 if (!current->mm)
1904 return;
1905
1903 if (perf_callchain_user32(regs, entry)) 1906 if (perf_callchain_user32(regs, entry))
1904 return; 1907 return;
1905 1908
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 45fbb8f7f54..f88af2c2a56 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1590,6 +1590,7 @@ static __init int intel_pmu_init(void)
1590 break; 1590 break;
1591 1591
1592 case 42: /* SandyBridge */ 1592 case 42: /* SandyBridge */
1593 case 45: /* SandyBridge, "Romely-EP" */
1593 memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, 1594 memcpy(hw_cache_event_ids, snb_hw_cache_event_ids,
1594 sizeof(hw_cache_event_ids)); 1595 sizeof(hw_cache_event_ids));
1595 1596
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 5c1a9197491..f3f6f534400 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -54,6 +54,7 @@
54#include <asm/ftrace.h> 54#include <asm/ftrace.h>
55#include <asm/irq_vectors.h> 55#include <asm/irq_vectors.h>
56#include <asm/cpufeature.h> 56#include <asm/cpufeature.h>
57#include <asm/alternative-asm.h>
57 58
58/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ 59/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */
59#include <linux/elf-em.h> 60#include <linux/elf-em.h>
@@ -873,12 +874,7 @@ ENTRY(simd_coprocessor_error)
873661: pushl_cfi $do_general_protection 874661: pushl_cfi $do_general_protection
874662: 875662:
875.section .altinstructions,"a" 876.section .altinstructions,"a"
876 .balign 4 877 altinstruction_entry 661b, 663f, X86_FEATURE_XMM, 662b-661b, 664f-663f
877 .long 661b
878 .long 663f
879 .word X86_FEATURE_XMM
880 .byte 662b-661b
881 .byte 664f-663f
882.previous 878.previous
883.section .altinstr_replacement,"ax" 879.section .altinstr_replacement,"ax"
884663: pushl $do_simd_coprocessor_error 880663: pushl $do_simd_coprocessor_error
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e13329d800c..6419bb05ecd 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1111,7 +1111,6 @@ zeroentry spurious_interrupt_bug do_spurious_interrupt_bug
1111zeroentry coprocessor_error do_coprocessor_error 1111zeroentry coprocessor_error do_coprocessor_error
1112errorentry alignment_check do_alignment_check 1112errorentry alignment_check do_alignment_check
1113zeroentry simd_coprocessor_error do_simd_coprocessor_error 1113zeroentry simd_coprocessor_error do_simd_coprocessor_error
1114zeroentry emulate_vsyscall do_emulate_vsyscall
1115 1114
1116 1115
1117 /* Reload gs selector with exception handling */ 1116 /* Reload gs selector with exception handling */
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index 65b8f5c2eeb..610485223bd 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -14,7 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16 16
17#include <asm/atomic.h> 17#include <linux/atomic.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/timer.h> 19#include <asm/timer.h>
20#include <asm/hw_irq.h> 20#include <asm/hw_irq.h>
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index f09d4bbe2d2..b3300e6bace 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -15,7 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17 17
18#include <asm/atomic.h> 18#include <linux/atomic.h>
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/timer.h> 20#include <asm/timer.h>
21#include <asm/hw_irq.h> 21#include <asm/hw_irq.h>
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 613a7931ecc..d90272e6bc4 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -307,6 +307,10 @@ struct pv_info pv_info = {
307 .paravirt_enabled = 0, 307 .paravirt_enabled = 0,
308 .kernel_rpl = 0, 308 .kernel_rpl = 0,
309 .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */ 309 .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */
310
311#ifdef CONFIG_X86_64
312 .extra_user_64bit_cs = __USER_CS,
313#endif
310}; 314};
311 315
312struct pv_init_ops pv_init_ops = { 316struct pv_init_ops pv_init_ops = {
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index e1ba8cb24e4..e7e3b019c43 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -438,29 +438,6 @@ void cpu_idle_wait(void)
438} 438}
439EXPORT_SYMBOL_GPL(cpu_idle_wait); 439EXPORT_SYMBOL_GPL(cpu_idle_wait);
440 440
441/*
442 * This uses new MONITOR/MWAIT instructions on P4 processors with PNI,
443 * which can obviate IPI to trigger checking of need_resched.
444 * We execute MONITOR against need_resched and enter optimized wait state
445 * through MWAIT. Whenever someone changes need_resched, we would be woken
446 * up from MWAIT (without an IPI).
447 *
448 * New with Core Duo processors, MWAIT can take some hints based on CPU
449 * capability.
450 */
451void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
452{
453 if (!need_resched()) {
454 if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR))
455 clflush((void *)&current_thread_info()->flags);
456
457 __monitor((void *)&current_thread_info()->flags, 0, 0);
458 smp_mb();
459 if (!need_resched())
460 __mwait(ax, cx);
461 }
462}
463
464/* Default MONITOR/MWAIT with no hints, used for default C1 state */ 441/* Default MONITOR/MWAIT with no hints, used for default C1 state */
465static void mwait_idle(void) 442static void mwait_idle(void)
466{ 443{
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index a069c0c1e2f..2196c703c5e 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -38,6 +38,7 @@
38#include <linux/uaccess.h> 38#include <linux/uaccess.h>
39#include <linux/io.h> 39#include <linux/io.h>
40#include <linux/kdebug.h> 40#include <linux/kdebug.h>
41#include <linux/cpuidle.h>
41 42
42#include <asm/pgtable.h> 43#include <asm/pgtable.h>
43#include <asm/system.h> 44#include <asm/system.h>
@@ -109,7 +110,8 @@ void cpu_idle(void)
109 local_irq_disable(); 110 local_irq_disable();
110 /* Don't trace irqs off for idle */ 111 /* Don't trace irqs off for idle */
111 stop_critical_timings(); 112 stop_critical_timings();
112 pm_idle(); 113 if (cpuidle_idle_call())
114 pm_idle();
113 start_critical_timings(); 115 start_critical_timings();
114 } 116 }
115 tick_nohz_restart_sched_tick(); 117 tick_nohz_restart_sched_tick();
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index ca6f7ab8df3..f693e44e1bf 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -37,6 +37,7 @@
37#include <linux/uaccess.h> 37#include <linux/uaccess.h>
38#include <linux/io.h> 38#include <linux/io.h>
39#include <linux/ftrace.h> 39#include <linux/ftrace.h>
40#include <linux/cpuidle.h>
40 41
41#include <asm/pgtable.h> 42#include <asm/pgtable.h>
42#include <asm/system.h> 43#include <asm/system.h>
@@ -136,7 +137,8 @@ void cpu_idle(void)
136 enter_idle(); 137 enter_idle();
137 /* Don't trace irqs off for idle */ 138 /* Don't trace irqs off for idle */
138 stop_critical_timings(); 139 stop_critical_timings();
139 pm_idle(); 140 if (cpuidle_idle_call())
141 pm_idle();
140 start_critical_timings(); 142 start_critical_timings();
141 143
142 /* In many cases the interrupt that ended idle 144 /* In many cases the interrupt that ended idle
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index 7977f0cfe33..c346d116148 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -74,7 +74,7 @@ static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs)
74 74
75#ifdef CONFIG_X86_64 75#ifdef CONFIG_X86_64
76 case 0x40 ... 0x4f: 76 case 0x40 ... 0x4f:
77 if (regs->cs != __USER_CS) 77 if (!user_64bit_mode(regs))
78 /* 32-bit mode: register increment */ 78 /* 32-bit mode: register increment */
79 return 0; 79 return 0;
80 /* 64-bit mode: REX prefix */ 80 /* 64-bit mode: REX prefix */
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index fbb0a045a1a..bc19be332bc 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -168,7 +168,7 @@ ENTRY(sys_call_table)
168 .long ptregs_vm86 168 .long ptregs_vm86
169 .long sys_ni_syscall /* Old sys_query_module */ 169 .long sys_ni_syscall /* Old sys_query_module */
170 .long sys_poll 170 .long sys_poll
171 .long sys_nfsservctl 171 .long sys_ni_syscall /* Old nfsservctl */
172 .long sys_setresgid16 /* 170 */ 172 .long sys_setresgid16 /* 170 */
173 .long sys_getresgid16 173 .long sys_getresgid16
174 .long sys_prctl 174 .long sys_prctl
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index fbc097a085c..6913369c234 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -49,7 +49,7 @@
49#include <asm/stacktrace.h> 49#include <asm/stacktrace.h>
50#include <asm/processor.h> 50#include <asm/processor.h>
51#include <asm/debugreg.h> 51#include <asm/debugreg.h>
52#include <asm/atomic.h> 52#include <linux/atomic.h>
53#include <asm/system.h> 53#include <asm/system.h>
54#include <asm/traps.h> 54#include <asm/traps.h>
55#include <asm/desc.h> 55#include <asm/desc.h>
@@ -872,12 +872,6 @@ void __init trap_init(void)
872 set_bit(SYSCALL_VECTOR, used_vectors); 872 set_bit(SYSCALL_VECTOR, used_vectors);
873#endif 873#endif
874 874
875#ifdef CONFIG_X86_64
876 BUG_ON(test_bit(VSYSCALL_EMU_VECTOR, used_vectors));
877 set_system_intr_gate(VSYSCALL_EMU_VECTOR, &emulate_vsyscall);
878 set_bit(VSYSCALL_EMU_VECTOR, used_vectors);
879#endif
880
881 /* 875 /*
882 * Should be a barrier for any external CPU state: 876 * Should be a barrier for any external CPU state:
883 */ 877 */
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 4aa9c54a9b7..0f703f10901 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -71,7 +71,6 @@ PHDRS {
71 text PT_LOAD FLAGS(5); /* R_E */ 71 text PT_LOAD FLAGS(5); /* R_E */
72 data PT_LOAD FLAGS(6); /* RW_ */ 72 data PT_LOAD FLAGS(6); /* RW_ */
73#ifdef CONFIG_X86_64 73#ifdef CONFIG_X86_64
74 user PT_LOAD FLAGS(5); /* R_E */
75#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
76 percpu PT_LOAD FLAGS(6); /* RW_ */ 75 percpu PT_LOAD FLAGS(6); /* RW_ */
77#endif 76#endif
@@ -154,44 +153,16 @@ SECTIONS
154 153
155#ifdef CONFIG_X86_64 154#ifdef CONFIG_X86_64
156 155
157#define VSYSCALL_ADDR (-10*1024*1024) 156 . = ALIGN(PAGE_SIZE);
158
159#define VLOAD_OFFSET (VSYSCALL_ADDR - __vsyscall_0 + LOAD_OFFSET)
160#define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
161
162#define VVIRT_OFFSET (VSYSCALL_ADDR - __vsyscall_0)
163#define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
164
165 . = ALIGN(4096);
166 __vsyscall_0 = .;
167
168 . = VSYSCALL_ADDR;
169 .vsyscall : AT(VLOAD(.vsyscall)) {
170 *(.vsyscall_0)
171
172 . = 1024;
173 *(.vsyscall_1)
174
175 . = 2048;
176 *(.vsyscall_2)
177
178 . = 4096; /* Pad the whole page. */
179 } :user =0xcc
180 . = ALIGN(__vsyscall_0 + PAGE_SIZE, PAGE_SIZE);
181
182#undef VSYSCALL_ADDR
183#undef VLOAD_OFFSET
184#undef VLOAD
185#undef VVIRT_OFFSET
186#undef VVIRT
187
188 __vvar_page = .; 157 __vvar_page = .;
189 158
190 .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) { 159 .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) {
160 /* work around gold bug 13023 */
161 __vvar_beginning_hack = .;
191 162
192 /* Place all vvars at the offsets in asm/vvar.h. */ 163 /* Place all vvars at the offsets in asm/vvar.h. */
193#define EMIT_VVAR(name, offset) \ 164#define EMIT_VVAR(name, offset) \
194 . = offset; \ 165 . = __vvar_beginning_hack + offset; \
195 *(.vvar_ ## name) 166 *(.vvar_ ## name)
196#define __VVAR_KERNEL_LDS 167#define __VVAR_KERNEL_LDS
197#include <asm/vvar.h> 168#include <asm/vvar.h>
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index dda7dff9cef..18ae83dd1cd 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -18,9 +18,6 @@
18 * use the vDSO. 18 * use the vDSO.
19 */ 19 */
20 20
21/* Disable profiling for userspace code: */
22#define DISABLE_BRANCH_PROFILING
23
24#include <linux/time.h> 21#include <linux/time.h>
25#include <linux/init.h> 22#include <linux/init.h>
26#include <linux/kernel.h> 23#include <linux/kernel.h>
@@ -50,12 +47,36 @@
50#include <asm/vgtod.h> 47#include <asm/vgtod.h>
51#include <asm/traps.h> 48#include <asm/traps.h>
52 49
50#define CREATE_TRACE_POINTS
51#include "vsyscall_trace.h"
52
53DEFINE_VVAR(int, vgetcpu_mode); 53DEFINE_VVAR(int, vgetcpu_mode);
54DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) = 54DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
55{ 55{
56 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock), 56 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock),
57}; 57};
58 58
59static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE;
60
61static int __init vsyscall_setup(char *str)
62{
63 if (str) {
64 if (!strcmp("emulate", str))
65 vsyscall_mode = EMULATE;
66 else if (!strcmp("native", str))
67 vsyscall_mode = NATIVE;
68 else if (!strcmp("none", str))
69 vsyscall_mode = NONE;
70 else
71 return -EINVAL;
72
73 return 0;
74 }
75
76 return -EINVAL;
77}
78early_param("vsyscall", vsyscall_setup);
79
59void update_vsyscall_tz(void) 80void update_vsyscall_tz(void)
60{ 81{
61 unsigned long flags; 82 unsigned long flags;
@@ -100,7 +121,7 @@ static void warn_bad_vsyscall(const char *level, struct pt_regs *regs,
100 121
101 printk("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n", 122 printk("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n",
102 level, tsk->comm, task_pid_nr(tsk), 123 level, tsk->comm, task_pid_nr(tsk),
103 message, regs->ip - 2, regs->cs, 124 message, regs->ip, regs->cs,
104 regs->sp, regs->ax, regs->si, regs->di); 125 regs->sp, regs->ax, regs->si, regs->di);
105} 126}
106 127
@@ -118,46 +139,39 @@ static int addr_to_vsyscall_nr(unsigned long addr)
118 return nr; 139 return nr;
119} 140}
120 141
121void dotraplinkage do_emulate_vsyscall(struct pt_regs *regs, long error_code) 142bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
122{ 143{
123 struct task_struct *tsk; 144 struct task_struct *tsk;
124 unsigned long caller; 145 unsigned long caller;
125 int vsyscall_nr; 146 int vsyscall_nr;
126 long ret; 147 long ret;
127 148
128 local_irq_enable();
129
130 /* 149 /*
131 * Real 64-bit user mode code has cs == __USER_CS. Anything else 150 * No point in checking CS -- the only way to get here is a user mode
132 * is bogus. 151 * trap to a high address, which means that we're in 64-bit user code.
133 */ 152 */
134 if (regs->cs != __USER_CS) {
135 /*
136 * If we trapped from kernel mode, we might as well OOPS now
137 * instead of returning to some random address and OOPSing
138 * then.
139 */
140 BUG_ON(!user_mode(regs));
141 153
142 /* Compat mode and non-compat 32-bit CS should both segfault. */ 154 WARN_ON_ONCE(address != regs->ip);
143 warn_bad_vsyscall(KERN_WARNING, regs, 155
144 "illegal int 0xcc from 32-bit mode"); 156 if (vsyscall_mode == NONE) {
145 goto sigsegv; 157 warn_bad_vsyscall(KERN_INFO, regs,
158 "vsyscall attempted with vsyscall=none");
159 return false;
146 } 160 }
147 161
148 /* 162 vsyscall_nr = addr_to_vsyscall_nr(address);
149 * x86-ism here: regs->ip points to the instruction after the int 0xcc, 163
150 * and int 0xcc is two bytes long. 164 trace_emulate_vsyscall(vsyscall_nr);
151 */ 165
152 vsyscall_nr = addr_to_vsyscall_nr(regs->ip - 2);
153 if (vsyscall_nr < 0) { 166 if (vsyscall_nr < 0) {
154 warn_bad_vsyscall(KERN_WARNING, regs, 167 warn_bad_vsyscall(KERN_WARNING, regs,
155 "illegal int 0xcc (exploit attempt?)"); 168 "misaligned vsyscall (exploit attempt or buggy program) -- look up the vsyscall kernel parameter if you need a workaround");
156 goto sigsegv; 169 goto sigsegv;
157 } 170 }
158 171
159 if (get_user(caller, (unsigned long __user *)regs->sp) != 0) { 172 if (get_user(caller, (unsigned long __user *)regs->sp) != 0) {
160 warn_bad_vsyscall(KERN_WARNING, regs, "int 0xcc with bad stack (exploit attempt?)"); 173 warn_bad_vsyscall(KERN_WARNING, regs,
174 "vsyscall with bad stack (exploit attempt?)");
161 goto sigsegv; 175 goto sigsegv;
162 } 176 }
163 177
@@ -202,13 +216,11 @@ void dotraplinkage do_emulate_vsyscall(struct pt_regs *regs, long error_code)
202 regs->ip = caller; 216 regs->ip = caller;
203 regs->sp += 8; 217 regs->sp += 8;
204 218
205 local_irq_disable(); 219 return true;
206 return;
207 220
208sigsegv: 221sigsegv:
209 regs->ip -= 2; /* The faulting instruction should be the int 0xcc. */
210 force_sig(SIGSEGV, current); 222 force_sig(SIGSEGV, current);
211 local_irq_disable(); 223 return true;
212} 224}
213 225
214/* 226/*
@@ -256,15 +268,21 @@ cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg)
256 268
257void __init map_vsyscall(void) 269void __init map_vsyscall(void)
258{ 270{
259 extern char __vsyscall_0; 271 extern char __vsyscall_page;
260 unsigned long physaddr_page0 = __pa_symbol(&__vsyscall_0); 272 unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page);
261 extern char __vvar_page; 273 extern char __vvar_page;
262 unsigned long physaddr_vvar_page = __pa_symbol(&__vvar_page); 274 unsigned long physaddr_vvar_page = __pa_symbol(&__vvar_page);
263 275
264 /* Note that VSYSCALL_MAPPED_PAGES must agree with the code below. */ 276 __set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_vsyscall,
265 __set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_page0, PAGE_KERNEL_VSYSCALL); 277 vsyscall_mode == NATIVE
278 ? PAGE_KERNEL_VSYSCALL
279 : PAGE_KERNEL_VVAR);
280 BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_FIRST_PAGE) !=
281 (unsigned long)VSYSCALL_START);
282
266 __set_fixmap(VVAR_PAGE, physaddr_vvar_page, PAGE_KERNEL_VVAR); 283 __set_fixmap(VVAR_PAGE, physaddr_vvar_page, PAGE_KERNEL_VVAR);
267 BUILD_BUG_ON((unsigned long)__fix_to_virt(VVAR_PAGE) != (unsigned long)VVAR_ADDRESS); 284 BUILD_BUG_ON((unsigned long)__fix_to_virt(VVAR_PAGE) !=
285 (unsigned long)VVAR_ADDRESS);
268} 286}
269 287
270static int __init vsyscall_init(void) 288static int __init vsyscall_init(void)
diff --git a/arch/x86/kernel/vsyscall_emu_64.S b/arch/x86/kernel/vsyscall_emu_64.S
index ffa845eae5c..c9596a9af15 100644
--- a/arch/x86/kernel/vsyscall_emu_64.S
+++ b/arch/x86/kernel/vsyscall_emu_64.S
@@ -7,21 +7,31 @@
7 */ 7 */
8 8
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10
10#include <asm/irq_vectors.h> 11#include <asm/irq_vectors.h>
12#include <asm/page_types.h>
13#include <asm/unistd_64.h>
14
15__PAGE_ALIGNED_DATA
16 .globl __vsyscall_page
17 .balign PAGE_SIZE, 0xcc
18 .type __vsyscall_page, @object
19__vsyscall_page:
20
21 mov $__NR_gettimeofday, %rax
22 syscall
23 ret
11 24
12/* The unused parts of the page are filled with 0xcc by the linker script. */ 25 .balign 1024, 0xcc
26 mov $__NR_time, %rax
27 syscall
28 ret
13 29
14.section .vsyscall_0, "a" 30 .balign 1024, 0xcc
15ENTRY(vsyscall_0) 31 mov $__NR_getcpu, %rax
16 int $VSYSCALL_EMU_VECTOR 32 syscall
17END(vsyscall_0) 33 ret
18 34
19.section .vsyscall_1, "a" 35 .balign 4096, 0xcc
20ENTRY(vsyscall_1)
21 int $VSYSCALL_EMU_VECTOR
22END(vsyscall_1)
23 36
24.section .vsyscall_2, "a" 37 .size __vsyscall_page, 4096
25ENTRY(vsyscall_2)
26 int $VSYSCALL_EMU_VECTOR
27END(vsyscall_2)
diff --git a/arch/x86/kernel/vsyscall_trace.h b/arch/x86/kernel/vsyscall_trace.h
new file mode 100644
index 00000000000..a8b2edec54f
--- /dev/null
+++ b/arch/x86/kernel/vsyscall_trace.h
@@ -0,0 +1,29 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM vsyscall
3
4#if !defined(__VSYSCALL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define __VSYSCALL_TRACE_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT(emulate_vsyscall,
10
11 TP_PROTO(int nr),
12
13 TP_ARGS(nr),
14
15 TP_STRUCT__entry(__field(int, nr)),
16
17 TP_fast_assign(
18 __entry->nr = nr;
19 ),
20
21 TP_printk("nr = %d", __entry->nr)
22);
23
24#endif
25
26#undef TRACE_INCLUDE_PATH
27#define TRACE_INCLUDE_PATH ../../arch/x86/kernel
28#define TRACE_INCLUDE_FILE vsyscall_trace
29#include <trace/define_trace.h>
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 988724b236b..ff5790d8e99 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -22,6 +22,8 @@ config KVM
22 depends on HAVE_KVM 22 depends on HAVE_KVM
23 # for device assignment: 23 # for device assignment:
24 depends on PCI 24 depends on PCI
25 # for TASKSTATS/TASK_DELAY_ACCT:
26 depends on NET
25 select PREEMPT_NOTIFIERS 27 select PREEMPT_NOTIFIERS
26 select MMU_NOTIFIER 28 select MMU_NOTIFIER
27 select ANON_INODES 29 select ANON_INODES
@@ -31,6 +33,7 @@ config KVM
31 select KVM_ASYNC_PF 33 select KVM_ASYNC_PF
32 select USER_RETURN_NOTIFIER 34 select USER_RETURN_NOTIFIER
33 select KVM_MMIO 35 select KVM_MMIO
36 select TASKSTATS
34 select TASK_DELAY_ACCT 37 select TASK_DELAY_ACCT
35 ---help--- 38 ---help---
36 Support hosting fully virtualized guest machines using hardware 39 Support hosting fully virtualized guest machines using hardware
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 2b2255b1f04..57dcbd4308f 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -33,7 +33,7 @@
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/current.h> 34#include <asm/current.h>
35#include <asm/apicdef.h> 35#include <asm/apicdef.h>
36#include <asm/atomic.h> 36#include <linux/atomic.h>
37#include "kvm_cache_regs.h" 37#include "kvm_cache_regs.h"
38#include "irq.h" 38#include "irq.h"
39#include "trace.h" 39#include "trace.h"
diff --git a/arch/x86/kvm/timer.c b/arch/x86/kvm/timer.c
index abd86e865be..ae432ea1cd8 100644
--- a/arch/x86/kvm/timer.c
+++ b/arch/x86/kvm/timer.c
@@ -15,7 +15,7 @@
15#include <linux/kvm_host.h> 15#include <linux/kvm_host.h>
16#include <linux/kvm.h> 16#include <linux/kvm.h>
17#include <linux/hrtimer.h> 17#include <linux/hrtimer.h>
18#include <asm/atomic.h> 18#include <linux/atomic.h>
19#include "kvm_timer.h" 19#include "kvm_timer.h"
20 20
21static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *ktimer) 21static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *ktimer)
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c
index 540179e8e9f..042f6826bf5 100644
--- a/arch/x86/lib/atomic64_32.c
+++ b/arch/x86/lib/atomic64_32.c
@@ -4,7 +4,7 @@
4 4
5#include <asm/processor.h> 5#include <asm/processor.h>
6#include <asm/cmpxchg.h> 6#include <asm/cmpxchg.h>
7#include <asm/atomic.h> 7#include <linux/atomic.h>
8 8
9long long atomic64_read_cx8(long long, const atomic64_t *v); 9long long atomic64_read_cx8(long long, const atomic64_t *v);
10EXPORT_SYMBOL(atomic64_read_cx8); 10EXPORT_SYMBOL(atomic64_read_cx8);
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 4d09df054e3..0d17c8c50ac 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -17,6 +17,7 @@
17#include <asm/traps.h> /* dotraplinkage, ... */ 17#include <asm/traps.h> /* dotraplinkage, ... */
18#include <asm/pgalloc.h> /* pgd_*(), ... */ 18#include <asm/pgalloc.h> /* pgd_*(), ... */
19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ 19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
20#include <asm/vsyscall.h>
20 21
21/* 22/*
22 * Page fault error code bits: 23 * Page fault error code bits:
@@ -105,7 +106,7 @@ check_prefetch_opcode(struct pt_regs *regs, unsigned char *instr,
105 * but for now it's good enough to assume that long 106 * but for now it's good enough to assume that long
106 * mode only uses well known segments or kernel. 107 * mode only uses well known segments or kernel.
107 */ 108 */
108 return (!user_mode(regs)) || (regs->cs == __USER_CS); 109 return (!user_mode(regs) || user_64bit_mode(regs));
109#endif 110#endif
110 case 0x60: 111 case 0x60:
111 /* 0x64 thru 0x67 are valid prefixes in all modes. */ 112 /* 0x64 thru 0x67 are valid prefixes in all modes. */
@@ -720,6 +721,18 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
720 if (is_errata100(regs, address)) 721 if (is_errata100(regs, address))
721 return; 722 return;
722 723
724#ifdef CONFIG_X86_64
725 /*
726 * Instruction fetch faults in the vsyscall page might need
727 * emulation.
728 */
729 if (unlikely((error_code & PF_INSTR) &&
730 ((address & ~0xfff) == VSYSCALL_START))) {
731 if (emulate_vsyscall(regs, address))
732 return;
733 }
734#endif
735
723 if (unlikely(show_unhandled_signals)) 736 if (unlikely(show_unhandled_signals))
724 show_signal_msg(regs, error_code, address, tsk); 737 show_signal_msg(regs, error_code, address, tsk);
725 738
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index c83c3d02c60..de54b9b278a 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -33,7 +33,7 @@
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34#include <linux/mmiotrace.h> 34#include <linux/mmiotrace.h>
35#include <asm/e820.h> /* for ISA_START_ADDRESS */ 35#include <asm/e820.h> /* for ISA_START_ADDRESS */
36#include <asm/atomic.h> 36#include <linux/atomic.h>
37#include <linux/percpu.h> 37#include <linux/percpu.h>
38#include <linux/cpu.h> 38#include <linux/cpu.h>
39 39
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 68c3c139520..039d91315bc 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -246,10 +246,9 @@ static void add_resources(struct pci_root_info *info)
246 246
247 conflict = insert_resource_conflict(root, res); 247 conflict = insert_resource_conflict(root, res);
248 if (conflict) 248 if (conflict)
249 dev_err(&info->bridge->dev, 249 dev_info(&info->bridge->dev,
250 "address space collision: host bridge window %pR " 250 "ignoring host bridge window %pR (conflicts with %s %pR)\n",
251 "conflicts with %s %pR\n", 251 res, conflict->name, conflict);
252 res, conflict->name, conflict);
253 else 252 else
254 pci_bus_add_resource(info->bus, res, 0); 253 pci_bus_add_resource(info->bus, res, 0);
255 } 254 }
@@ -361,6 +360,20 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
361 } 360 }
362 } 361 }
363 362
363 /* After the PCI-E bus has been walked and all devices discovered,
364 * configure any settings of the fabric that might be necessary.
365 */
366 if (bus) {
367 struct pci_bus *child;
368 list_for_each_entry(child, &bus->children, node) {
369 struct pci_dev *self = child->self;
370 if (!self)
371 continue;
372
373 pcie_bus_configure_settings(child, self->pcie_mpss);
374 }
375 }
376
364 if (!bus) 377 if (!bus)
365 kfree(sd); 378 kfree(sd);
366 379
diff --git a/arch/x86/pci/ce4100.c b/arch/x86/pci/ce4100.c
index 67858be4b52..99176094500 100644
--- a/arch/x86/pci/ce4100.c
+++ b/arch/x86/pci/ce4100.c
@@ -257,6 +257,7 @@ static int ce4100_conf_read(unsigned int seg, unsigned int bus,
257{ 257{
258 int i; 258 int i;
259 259
260 WARN_ON(seg);
260 if (bus == 1) { 261 if (bus == 1) {
261 for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) { 262 for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) {
262 if (bus1_fixups[i].dev_func == devfn && 263 if (bus1_fixups[i].dev_func == devfn &&
@@ -282,6 +283,7 @@ static int ce4100_conf_write(unsigned int seg, unsigned int bus,
282{ 283{
283 int i; 284 int i;
284 285
286 WARN_ON(seg);
285 if (bus == 1) { 287 if (bus == 1) {
286 for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) { 288 for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) {
287 if (bus1_fixups[i].dev_func == devfn && 289 if (bus1_fixups[i].dev_func == devfn &&
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 5fe75026ecc..92df322e0b5 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -247,13 +247,6 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
247 }, 247 },
248#endif /* __i386__ */ 248#endif /* __i386__ */
249 { 249 {
250 .callback = find_sort_method,
251 .ident = "Dell System",
252 .matches = {
253 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
254 },
255 },
256 {
257 .callback = set_bf_sort, 250 .callback = set_bf_sort,
258 .ident = "Dell PowerEdge 1950", 251 .ident = "Dell PowerEdge 1950",
259 .matches = { 252 .matches = {
@@ -294,6 +287,13 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
294 }, 287 },
295 }, 288 },
296 { 289 {
290 .callback = find_sort_method,
291 .ident = "Dell System",
292 .matches = {
293 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
294 },
295 },
296 {
297 .callback = set_bf_sort, 297 .callback = set_bf_sort,
298 .ident = "HP ProLiant BL20p G3", 298 .ident = "HP ProLiant BL20p G3",
299 .matches = { 299 .matches = {
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c
index e6fd8473fb7..4f2c70439d7 100644
--- a/arch/x86/pci/direct.c
+++ b/arch/x86/pci/direct.c
@@ -22,7 +22,7 @@ static int pci_conf1_read(unsigned int seg, unsigned int bus,
22{ 22{
23 unsigned long flags; 23 unsigned long flags;
24 24
25 if ((bus > 255) || (devfn > 255) || (reg > 4095)) { 25 if (seg || (bus > 255) || (devfn > 255) || (reg > 4095)) {
26 *value = -1; 26 *value = -1;
27 return -EINVAL; 27 return -EINVAL;
28 } 28 }
@@ -53,7 +53,7 @@ static int pci_conf1_write(unsigned int seg, unsigned int bus,
53{ 53{
54 unsigned long flags; 54 unsigned long flags;
55 55
56 if ((bus > 255) || (devfn > 255) || (reg > 4095)) 56 if (seg || (bus > 255) || (devfn > 255) || (reg > 4095))
57 return -EINVAL; 57 return -EINVAL;
58 58
59 raw_spin_lock_irqsave(&pci_config_lock, flags); 59 raw_spin_lock_irqsave(&pci_config_lock, flags);
@@ -97,6 +97,7 @@ static int pci_conf2_read(unsigned int seg, unsigned int bus,
97 unsigned long flags; 97 unsigned long flags;
98 int dev, fn; 98 int dev, fn;
99 99
100 WARN_ON(seg);
100 if ((bus > 255) || (devfn > 255) || (reg > 255)) { 101 if ((bus > 255) || (devfn > 255) || (reg > 255)) {
101 *value = -1; 102 *value = -1;
102 return -EINVAL; 103 return -EINVAL;
@@ -138,6 +139,7 @@ static int pci_conf2_write(unsigned int seg, unsigned int bus,
138 unsigned long flags; 139 unsigned long flags;
139 int dev, fn; 140 int dev, fn;
140 141
142 WARN_ON(seg);
141 if ((bus > 255) || (devfn > 255) || (reg > 255)) 143 if ((bus > 255) || (devfn > 255) || (reg > 255))
142 return -EINVAL; 144 return -EINVAL;
143 145
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index 5c9e2458df4..512a88c4150 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -34,6 +34,7 @@ static int pci_conf1_mq_read(unsigned int seg, unsigned int bus,
34 unsigned long flags; 34 unsigned long flags;
35 void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus)); 35 void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus));
36 36
37 WARN_ON(seg);
37 if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) 38 if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
38 return -EINVAL; 39 return -EINVAL;
39 40
@@ -73,6 +74,7 @@ static int pci_conf1_mq_write(unsigned int seg, unsigned int bus,
73 unsigned long flags; 74 unsigned long flags;
74 void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus)); 75 void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus));
75 76
77 WARN_ON(seg);
76 if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) 78 if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
77 return -EINVAL; 79 return -EINVAL;
78 80
diff --git a/arch/x86/pci/olpc.c b/arch/x86/pci/olpc.c
index 13700ec8e2e..5262603b04d 100644
--- a/arch/x86/pci/olpc.c
+++ b/arch/x86/pci/olpc.c
@@ -206,6 +206,8 @@ static int pci_olpc_read(unsigned int seg, unsigned int bus,
206{ 206{
207 uint32_t *addr; 207 uint32_t *addr;
208 208
209 WARN_ON(seg);
210
209 /* Use the hardware mechanism for non-simulated devices */ 211 /* Use the hardware mechanism for non-simulated devices */
210 if (!is_simulated(bus, devfn)) 212 if (!is_simulated(bus, devfn))
211 return pci_direct_conf1.read(seg, bus, devfn, reg, len, value); 213 return pci_direct_conf1.read(seg, bus, devfn, reg, len, value);
@@ -264,6 +266,8 @@ static int pci_olpc_read(unsigned int seg, unsigned int bus,
264static int pci_olpc_write(unsigned int seg, unsigned int bus, 266static int pci_olpc_write(unsigned int seg, unsigned int bus,
265 unsigned int devfn, int reg, int len, uint32_t value) 267 unsigned int devfn, int reg, int len, uint32_t value)
266{ 268{
269 WARN_ON(seg);
270
267 /* Use the hardware mechanism for non-simulated devices */ 271 /* Use the hardware mechanism for non-simulated devices */
268 if (!is_simulated(bus, devfn)) 272 if (!is_simulated(bus, devfn))
269 return pci_direct_conf1.write(seg, bus, devfn, reg, len, value); 273 return pci_direct_conf1.write(seg, bus, devfn, reg, len, value);
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index a5f7d0d63de..f6855355146 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -181,6 +181,7 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
181 unsigned long flags; 181 unsigned long flags;
182 unsigned long bx = (bus << 8) | devfn; 182 unsigned long bx = (bus << 8) | devfn;
183 183
184 WARN_ON(seg);
184 if (!value || (bus > 255) || (devfn > 255) || (reg > 255)) 185 if (!value || (bus > 255) || (devfn > 255) || (reg > 255))
185 return -EINVAL; 186 return -EINVAL;
186 187
@@ -247,6 +248,7 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
247 unsigned long flags; 248 unsigned long flags;
248 unsigned long bx = (bus << 8) | devfn; 249 unsigned long bx = (bus << 8) | devfn;
249 250
251 WARN_ON(seg);
250 if ((bus > 255) || (devfn > 255) || (reg > 255)) 252 if ((bus > 255) || (devfn > 255) || (reg > 255))
251 return -EINVAL; 253 return -EINVAL;
252 254
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index 03008f72eb0..6f2f8eeed17 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -24,7 +24,7 @@ static void pci_visws_disable_irq(struct pci_dev *dev) { }
24 24
25unsigned int pci_bus0, pci_bus1; 25unsigned int pci_bus0, pci_bus1;
26 26
27static int __init visws_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 27static int __init visws_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
28{ 28{
29 int irq, bus = dev->bus->number; 29 int irq, bus = dev->bus->number;
30 30
diff --git a/arch/x86/platform/mrst/Makefile b/arch/x86/platform/mrst/Makefile
index f61ccdd4934..1ea38775a6d 100644
--- a/arch/x86/platform/mrst/Makefile
+++ b/arch/x86/platform/mrst/Makefile
@@ -1,3 +1,4 @@
1obj-$(CONFIG_X86_MRST) += mrst.o 1obj-$(CONFIG_X86_MRST) += mrst.o
2obj-$(CONFIG_X86_MRST) += vrtc.o 2obj-$(CONFIG_X86_MRST) += vrtc.o
3obj-$(CONFIG_EARLY_PRINTK_MRST) += early_printk_mrst.o 3obj-$(CONFIG_EARLY_PRINTK_MRST) += early_printk_mrst.o
4obj-$(CONFIG_X86_MRST) += pmu.o
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index 7000e74b308..58425adc22c 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -689,7 +689,9 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
689 irq_attr.trigger = 1; 689 irq_attr.trigger = 1;
690 irq_attr.polarity = 1; 690 irq_attr.polarity = 1;
691 io_apic_set_pci_routing(NULL, pentry->irq, &irq_attr); 691 io_apic_set_pci_routing(NULL, pentry->irq, &irq_attr);
692 } 692 } else
693 pentry->irq = 0; /* No irq */
694
693 switch (pentry->type) { 695 switch (pentry->type) {
694 case SFI_DEV_TYPE_IPC: 696 case SFI_DEV_TYPE_IPC:
695 /* ID as IRQ is a hack that will go away */ 697 /* ID as IRQ is a hack that will go away */
diff --git a/arch/x86/platform/mrst/pmu.c b/arch/x86/platform/mrst/pmu.c
new file mode 100644
index 00000000000..9281da7d91b
--- /dev/null
+++ b/arch/x86/platform/mrst/pmu.c
@@ -0,0 +1,817 @@
1/*
2 * mrst/pmu.c - driver for MRST Power Management Unit
3 *
4 * Copyright (c) 2011, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#include <linux/cpuidle.h>
21#include <linux/debugfs.h>
22#include <linux/delay.h>
23#include <linux/interrupt.h>
24#include <linux/module.h>
25#include <linux/pci.h>
26#include <linux/seq_file.h>
27#include <linux/sfi.h>
28#include <asm/intel_scu_ipc.h>
29#include "pmu.h"
30
31#define IPCMSG_FW_REVISION 0xF4
32
33struct mrst_device {
34 u16 pci_dev_num; /* DEBUG only */
35 u16 lss;
36 u16 latest_request;
37 unsigned int pci_state_counts[PCI_D3cold + 1]; /* DEBUG only */
38};
39
40/*
41 * comlete list of MRST PCI devices
42 */
43static struct mrst_device mrst_devs[] = {
44/* 0 */ { 0x0800, LSS_SPI0 }, /* Moorestown SPI Ctrl 0 */
45/* 1 */ { 0x0801, LSS_SPI1 }, /* Moorestown SPI Ctrl 1 */
46/* 2 */ { 0x0802, LSS_I2C0 }, /* Moorestown I2C 0 */
47/* 3 */ { 0x0803, LSS_I2C1 }, /* Moorestown I2C 1 */
48/* 4 */ { 0x0804, LSS_I2C2 }, /* Moorestown I2C 2 */
49/* 5 */ { 0x0805, LSS_KBD }, /* Moorestown Keyboard Ctrl */
50/* 6 */ { 0x0806, LSS_USB_HC }, /* Moorestown USB Ctrl */
51/* 7 */ { 0x0807, LSS_SD_HC0 }, /* Moorestown SD Host Ctrl 0 */
52/* 8 */ { 0x0808, LSS_SD_HC1 }, /* Moorestown SD Host Ctrl 1 */
53/* 9 */ { 0x0809, LSS_NAND }, /* Moorestown NAND Ctrl */
54/* 10 */ { 0x080a, LSS_AUDIO }, /* Moorestown Audio Ctrl */
55/* 11 */ { 0x080b, LSS_IMAGING }, /* Moorestown ISP */
56/* 12 */ { 0x080c, LSS_SECURITY }, /* Moorestown Security Controller */
57/* 13 */ { 0x080d, LSS_DISPLAY }, /* Moorestown External Displays */
58/* 14 */ { 0x080e, 0 }, /* Moorestown SCU IPC */
59/* 15 */ { 0x080f, LSS_GPIO }, /* Moorestown GPIO Controller */
60/* 16 */ { 0x0810, 0 }, /* Moorestown Power Management Unit */
61/* 17 */ { 0x0811, LSS_USB_OTG }, /* Moorestown OTG Ctrl */
62/* 18 */ { 0x0812, LSS_SPI2 }, /* Moorestown SPI Ctrl 2 */
63/* 19 */ { 0x0813, 0 }, /* Moorestown SC DMA */
64/* 20 */ { 0x0814, LSS_AUDIO_LPE }, /* Moorestown LPE DMA */
65/* 21 */ { 0x0815, LSS_AUDIO_SSP }, /* Moorestown SSP0 */
66
67/* 22 */ { 0x084F, LSS_SD_HC2 }, /* Moorestown SD Host Ctrl 2 */
68
69/* 23 */ { 0x4102, 0 }, /* Lincroft */
70/* 24 */ { 0x4110, 0 }, /* Lincroft */
71};
72
73/* n.b. We ignore PCI-id 0x815 in LSS9 b/c MeeGo has no driver for it */
74static u16 mrst_lss9_pci_ids[] = {0x080a, 0x0814, 0};
75static u16 mrst_lss10_pci_ids[] = {0x0800, 0x0801, 0x0802, 0x0803,
76 0x0804, 0x0805, 0x080f, 0};
77
78/* handle concurrent SMP invokations of pmu_pci_set_power_state() */
79static spinlock_t mrst_pmu_power_state_lock;
80
81static unsigned int wake_counters[MRST_NUM_LSS]; /* DEBUG only */
82static unsigned int pmu_irq_stats[INT_INVALID + 1]; /* DEBUG only */
83
84static int graphics_is_off;
85static int lss_s0i3_enabled;
86static bool mrst_pmu_s0i3_enable;
87
88/* debug counters */
89static u32 pmu_wait_ready_calls;
90static u32 pmu_wait_ready_udelays;
91static u32 pmu_wait_ready_udelays_max;
92static u32 pmu_wait_done_calls;
93static u32 pmu_wait_done_udelays;
94static u32 pmu_wait_done_udelays_max;
95static u32 pmu_set_power_state_entry;
96static u32 pmu_set_power_state_send_cmd;
97
98static struct mrst_device *pci_id_2_mrst_dev(u16 pci_dev_num)
99{
100 int index = 0;
101
102 if ((pci_dev_num >= 0x0800) && (pci_dev_num <= 0x815))
103 index = pci_dev_num - 0x800;
104 else if (pci_dev_num == 0x084F)
105 index = 22;
106 else if (pci_dev_num == 0x4102)
107 index = 23;
108 else if (pci_dev_num == 0x4110)
109 index = 24;
110
111 if (pci_dev_num != mrst_devs[index].pci_dev_num) {
112 WARN_ONCE(1, FW_BUG "Unknown PCI device 0x%04X\n", pci_dev_num);
113 return 0;
114 }
115
116 return &mrst_devs[index];
117}
118
119/**
120 * mrst_pmu_validate_cstates
121 * @dev: cpuidle_device
122 *
123 * Certain states are not appropriate for governor to pick in some cases.
124 * This function will be called as cpuidle_device's prepare callback and
125 * thus tells governor to ignore such states when selecting the next state
126 * to enter.
127 */
128
129#define IDLE_STATE4_IS_C6 4
130#define IDLE_STATE5_IS_S0I3 5
131
132int mrst_pmu_invalid_cstates(void)
133{
134 int cpu = smp_processor_id();
135
136 /*
137 * Demote to C4 if the PMU is busy.
138 * Since LSS changes leave the busy bit clear...
139 * busy means either the PMU is waiting for an ACK-C6 that
140 * isn't coming due to an MWAIT that returned immediately;
141 * or we returned from S0i3 successfully, and the PMU
142 * is not done sending us interrupts.
143 */
144 if (pmu_read_busy_status())
145 return 1 << IDLE_STATE4_IS_C6 | 1 << IDLE_STATE5_IS_S0I3;
146
147 /*
148 * Disallow S0i3 if: PMU is not initialized, or CPU1 is active,
149 * or if device LSS is insufficient, or the GPU is active,
150 * or if it has been explicitly disabled.
151 */
152 if (!pmu_reg || !cpumask_equal(cpu_online_mask, cpumask_of(cpu)) ||
153 !lss_s0i3_enabled || !graphics_is_off || !mrst_pmu_s0i3_enable)
154 return 1 << IDLE_STATE5_IS_S0I3;
155 else
156 return 0;
157}
158
159/*
160 * pmu_update_wake_counters(): read PM_WKS, update wake_counters[]
161 * DEBUG only.
162 */
163static void pmu_update_wake_counters(void)
164{
165 int lss;
166 u32 wake_status;
167
168 wake_status = pmu_read_wks();
169
170 for (lss = 0; lss < MRST_NUM_LSS; ++lss) {
171 if (wake_status & (1 << lss))
172 wake_counters[lss]++;
173 }
174}
175
176int mrst_pmu_s0i3_entry(void)
177{
178 int status;
179
180 /* Clear any possible error conditions */
181 pmu_write_ics(0x300);
182
183 /* set wake control to current D-states */
184 pmu_write_wssc(S0I3_SSS_TARGET);
185
186 status = mrst_s0i3_entry(PM_S0I3_COMMAND, &pmu_reg->pm_cmd);
187 pmu_update_wake_counters();
188 return status;
189}
190
191/* poll for maximum of 5ms for busy bit to clear */
192static int pmu_wait_ready(void)
193{
194 int udelays;
195
196 pmu_wait_ready_calls++;
197
198 for (udelays = 0; udelays < 500; ++udelays) {
199 if (udelays > pmu_wait_ready_udelays_max)
200 pmu_wait_ready_udelays_max = udelays;
201
202 if (pmu_read_busy_status() == 0)
203 return 0;
204
205 udelay(10);
206 pmu_wait_ready_udelays++;
207 }
208
209 /*
210 * if this fires, observe
211 * /sys/kernel/debug/mrst_pmu_wait_ready_calls
212 * /sys/kernel/debug/mrst_pmu_wait_ready_udelays
213 */
214 WARN_ONCE(1, "SCU not ready for 5ms");
215 return -EBUSY;
216}
217/* poll for maximum of 50ms us for busy bit to clear */
218static int pmu_wait_done(void)
219{
220 int udelays;
221
222 pmu_wait_done_calls++;
223
224 for (udelays = 0; udelays < 500; ++udelays) {
225 if (udelays > pmu_wait_done_udelays_max)
226 pmu_wait_done_udelays_max = udelays;
227
228 if (pmu_read_busy_status() == 0)
229 return 0;
230
231 udelay(100);
232 pmu_wait_done_udelays++;
233 }
234
235 /*
236 * if this fires, observe
237 * /sys/kernel/debug/mrst_pmu_wait_done_calls
238 * /sys/kernel/debug/mrst_pmu_wait_done_udelays
239 */
240 WARN_ONCE(1, "SCU not done for 50ms");
241 return -EBUSY;
242}
243
244u32 mrst_pmu_msi_is_disabled(void)
245{
246 return pmu_msi_is_disabled();
247}
248
249void mrst_pmu_enable_msi(void)
250{
251 pmu_msi_enable();
252}
253
254/**
255 * pmu_irq - pmu driver interrupt handler
256 * Context: interrupt context
257 */
258static irqreturn_t pmu_irq(int irq, void *dummy)
259{
260 union pmu_pm_ics pmu_ics;
261
262 pmu_ics.value = pmu_read_ics();
263
264 if (!pmu_ics.bits.pending)
265 return IRQ_NONE;
266
267 switch (pmu_ics.bits.cause) {
268 case INT_SPURIOUS:
269 case INT_CMD_DONE:
270 case INT_CMD_ERR:
271 case INT_WAKE_RX:
272 case INT_SS_ERROR:
273 case INT_S0IX_MISS:
274 case INT_NO_ACKC6:
275 pmu_irq_stats[pmu_ics.bits.cause]++;
276 break;
277 default:
278 pmu_irq_stats[INT_INVALID]++;
279 }
280
281 pmu_write_ics(pmu_ics.value); /* Clear pending interrupt */
282
283 return IRQ_HANDLED;
284}
285
286/*
287 * Translate PCI power management to MRST LSS D-states
288 */
289static int pci_2_mrst_state(int lss, pci_power_t pci_state)
290{
291 switch (pci_state) {
292 case PCI_D0:
293 if (SSMSK(D0i1, lss) & D0I1_ACG_SSS_TARGET)
294 return D0i1;
295 else
296 return D0;
297 case PCI_D1:
298 return D0i1;
299 case PCI_D2:
300 return D0i2;
301 case PCI_D3hot:
302 case PCI_D3cold:
303 return D0i3;
304 default:
305 WARN(1, "pci_state %d\n", pci_state);
306 return 0;
307 }
308}
309
310static int pmu_issue_command(u32 pm_ssc)
311{
312 union pmu_pm_set_cfg_cmd_t command;
313
314 if (pmu_read_busy_status()) {
315 pr_debug("pmu is busy, Operation not permitted\n");
316 return -1;
317 }
318
319 /*
320 * enable interrupts in PMU so that interrupts are
321 * propagated when ioc bit for a particular set
322 * command is set
323 */
324
325 pmu_irq_enable();
326
327 /* Configure the sub systems for pmu2 */
328
329 pmu_write_ssc(pm_ssc);
330
331 /*
332 * Send the set config command for pmu its configured
333 * for mode CM_IMMEDIATE & hence with No Trigger
334 */
335
336 command.pmu2_params.d_param.cfg_mode = CM_IMMEDIATE;
337 command.pmu2_params.d_param.cfg_delay = 0;
338 command.pmu2_params.d_param.rsvd = 0;
339
340 /* construct the command to send SET_CFG to particular PMU */
341 command.pmu2_params.d_param.cmd = SET_CFG_CMD;
342 command.pmu2_params.d_param.ioc = 0;
343 command.pmu2_params.d_param.mode_id = 0;
344 command.pmu2_params.d_param.sys_state = SYS_STATE_S0I0;
345
346 /* write the value of PM_CMD into particular PMU */
347 pr_debug("pmu command being written %x\n",
348 command.pmu_pm_set_cfg_cmd_value);
349
350 pmu_write_cmd(command.pmu_pm_set_cfg_cmd_value);
351
352 return 0;
353}
354
355static u16 pmu_min_lss_pci_req(u16 *ids, u16 pci_state)
356{
357 u16 existing_request;
358 int i;
359
360 for (i = 0; ids[i]; ++i) {
361 struct mrst_device *mrst_dev;
362
363 mrst_dev = pci_id_2_mrst_dev(ids[i]);
364 if (unlikely(!mrst_dev))
365 continue;
366
367 existing_request = mrst_dev->latest_request;
368 if (existing_request < pci_state)
369 pci_state = existing_request;
370 }
371 return pci_state;
372}
373
374/**
375 * pmu_pci_set_power_state - Callback function is used by all the PCI devices
376 * for a platform specific device power on/shutdown.
377 */
378
379int pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t pci_state)
380{
381 u32 old_sss, new_sss;
382 int status = 0;
383 struct mrst_device *mrst_dev;
384
385 pmu_set_power_state_entry++;
386
387 BUG_ON(pdev->vendor != PCI_VENDOR_ID_INTEL);
388 BUG_ON(pci_state < PCI_D0 || pci_state > PCI_D3cold);
389
390 mrst_dev = pci_id_2_mrst_dev(pdev->device);
391 if (unlikely(!mrst_dev))
392 return -ENODEV;
393
394 mrst_dev->pci_state_counts[pci_state]++; /* count invocations */
395
396 /* PMU driver calls self as part of PCI initialization, ignore */
397 if (pdev->device == PCI_DEV_ID_MRST_PMU)
398 return 0;
399
400 BUG_ON(!pmu_reg); /* SW bug if called before initialized */
401
402 spin_lock(&mrst_pmu_power_state_lock);
403
404 if (pdev->d3_delay) {
405 dev_dbg(&pdev->dev, "d3_delay %d, should be 0\n",
406 pdev->d3_delay);
407 pdev->d3_delay = 0;
408 }
409 /*
410 * If Lincroft graphics, simply remember state
411 */
412 if ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY
413 && !((pdev->class & PCI_SUB_CLASS_MASK) >> 8)) {
414 if (pci_state == PCI_D0)
415 graphics_is_off = 0;
416 else
417 graphics_is_off = 1;
418 goto ret;
419 }
420
421 if (!mrst_dev->lss)
422 goto ret; /* device with no LSS */
423
424 if (mrst_dev->latest_request == pci_state)
425 goto ret; /* no change */
426
427 mrst_dev->latest_request = pci_state; /* record latest request */
428
429 /*
430 * LSS9 and LSS10 contain multiple PCI devices.
431 * Use the lowest numbered (highest power) state in the LSS
432 */
433 if (mrst_dev->lss == 9)
434 pci_state = pmu_min_lss_pci_req(mrst_lss9_pci_ids, pci_state);
435 else if (mrst_dev->lss == 10)
436 pci_state = pmu_min_lss_pci_req(mrst_lss10_pci_ids, pci_state);
437
438 status = pmu_wait_ready();
439 if (status)
440 goto ret;
441
442 old_sss = pmu_read_sss();
443 new_sss = old_sss & ~SSMSK(3, mrst_dev->lss);
444 new_sss |= SSMSK(pci_2_mrst_state(mrst_dev->lss, pci_state),
445 mrst_dev->lss);
446
447 if (new_sss == old_sss)
448 goto ret; /* nothing to do */
449
450 pmu_set_power_state_send_cmd++;
451
452 status = pmu_issue_command(new_sss);
453
454 if (unlikely(status != 0)) {
455 dev_err(&pdev->dev, "Failed to Issue a PM command\n");
456 goto ret;
457 }
458
459 if (pmu_wait_done())
460 goto ret;
461
462 lss_s0i3_enabled =
463 ((pmu_read_sss() & S0I3_SSS_TARGET) == S0I3_SSS_TARGET);
464ret:
465 spin_unlock(&mrst_pmu_power_state_lock);
466 return status;
467}
468
469#ifdef CONFIG_DEBUG_FS
470static char *d0ix_names[] = {"D0", "D0i1", "D0i2", "D0i3"};
471
472static inline const char *d0ix_name(int state)
473{
474 return d0ix_names[(int) state];
475}
476
477static int debug_mrst_pmu_show(struct seq_file *s, void *unused)
478{
479 struct pci_dev *pdev = NULL;
480 u32 cur_pmsss;
481 int lss;
482
483 seq_printf(s, "0x%08X D0I1_ACG_SSS_TARGET\n", D0I1_ACG_SSS_TARGET);
484
485 cur_pmsss = pmu_read_sss();
486
487 seq_printf(s, "0x%08X S0I3_SSS_TARGET\n", S0I3_SSS_TARGET);
488
489 seq_printf(s, "0x%08X Current SSS ", cur_pmsss);
490 seq_printf(s, lss_s0i3_enabled ? "\n" : "[BLOCKS s0i3]\n");
491
492 if (cpumask_equal(cpu_online_mask, cpumask_of(0)))
493 seq_printf(s, "cpu0 is only cpu online\n");
494 else
495 seq_printf(s, "cpu0 is NOT only cpu online [BLOCKS S0i3]\n");
496
497 seq_printf(s, "GFX: %s\n", graphics_is_off ? "" : "[BLOCKS s0i3]");
498
499
500 for_each_pci_dev(pdev) {
501 int pos;
502 u16 pmcsr;
503 struct mrst_device *mrst_dev;
504 int i;
505
506 mrst_dev = pci_id_2_mrst_dev(pdev->device);
507
508 seq_printf(s, "%s %04x/%04X %-16.16s ",
509 dev_name(&pdev->dev),
510 pdev->vendor, pdev->device,
511 dev_driver_string(&pdev->dev));
512
513 if (unlikely (!mrst_dev)) {
514 seq_printf(s, " UNKNOWN\n");
515 continue;
516 }
517
518 if (mrst_dev->lss)
519 seq_printf(s, "LSS %2d %-4s ", mrst_dev->lss,
520 d0ix_name(((cur_pmsss >>
521 (mrst_dev->lss * 2)) & 0x3)));
522 else
523 seq_printf(s, " ");
524
525 /* PCI PM config space setting */
526 pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
527 if (pos != 0) {
528 pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);
529 seq_printf(s, "PCI-%-4s",
530 pci_power_name(pmcsr & PCI_PM_CTRL_STATE_MASK));
531 } else {
532 seq_printf(s, " ");
533 }
534
535 seq_printf(s, " %s ", pci_power_name(mrst_dev->latest_request));
536 for (i = 0; i <= PCI_D3cold; ++i)
537 seq_printf(s, "%d ", mrst_dev->pci_state_counts[i]);
538
539 if (mrst_dev->lss) {
540 unsigned int lssmask;
541
542 lssmask = SSMSK(D0i3, mrst_dev->lss);
543
544 if ((lssmask & S0I3_SSS_TARGET) &&
545 ((lssmask & cur_pmsss) !=
546 (lssmask & S0I3_SSS_TARGET)))
547 seq_printf(s , "[BLOCKS s0i3]");
548 }
549
550 seq_printf(s, "\n");
551 }
552 seq_printf(s, "Wake Counters:\n");
553 for (lss = 0; lss < MRST_NUM_LSS; ++lss)
554 seq_printf(s, "LSS%d %d\n", lss, wake_counters[lss]);
555
556 seq_printf(s, "Interrupt Counters:\n");
557 seq_printf(s,
558 "INT_SPURIOUS \t%8u\n" "INT_CMD_DONE \t%8u\n"
559 "INT_CMD_ERR \t%8u\n" "INT_WAKE_RX \t%8u\n"
560 "INT_SS_ERROR \t%8u\n" "INT_S0IX_MISS\t%8u\n"
561 "INT_NO_ACKC6 \t%8u\n" "INT_INVALID \t%8u\n",
562 pmu_irq_stats[INT_SPURIOUS], pmu_irq_stats[INT_CMD_DONE],
563 pmu_irq_stats[INT_CMD_ERR], pmu_irq_stats[INT_WAKE_RX],
564 pmu_irq_stats[INT_SS_ERROR], pmu_irq_stats[INT_S0IX_MISS],
565 pmu_irq_stats[INT_NO_ACKC6], pmu_irq_stats[INT_INVALID]);
566
567 seq_printf(s, "mrst_pmu_wait_ready_calls %8d\n",
568 pmu_wait_ready_calls);
569 seq_printf(s, "mrst_pmu_wait_ready_udelays %8d\n",
570 pmu_wait_ready_udelays);
571 seq_printf(s, "mrst_pmu_wait_ready_udelays_max %8d\n",
572 pmu_wait_ready_udelays_max);
573 seq_printf(s, "mrst_pmu_wait_done_calls %8d\n",
574 pmu_wait_done_calls);
575 seq_printf(s, "mrst_pmu_wait_done_udelays %8d\n",
576 pmu_wait_done_udelays);
577 seq_printf(s, "mrst_pmu_wait_done_udelays_max %8d\n",
578 pmu_wait_done_udelays_max);
579 seq_printf(s, "mrst_pmu_set_power_state_entry %8d\n",
580 pmu_set_power_state_entry);
581 seq_printf(s, "mrst_pmu_set_power_state_send_cmd %8d\n",
582 pmu_set_power_state_send_cmd);
583 seq_printf(s, "SCU busy: %d\n", pmu_read_busy_status());
584
585 return 0;
586}
587
588static int debug_mrst_pmu_open(struct inode *inode, struct file *file)
589{
590 return single_open(file, debug_mrst_pmu_show, NULL);
591}
592
593static const struct file_operations devices_state_operations = {
594 .open = debug_mrst_pmu_open,
595 .read = seq_read,
596 .llseek = seq_lseek,
597 .release = single_release,
598};
599#endif /* DEBUG_FS */
600
601/*
602 * Validate SCU PCI shim PCI vendor capability byte
603 * against LSS hard-coded in mrst_devs[] above.
604 * DEBUG only.
605 */
606static void pmu_scu_firmware_debug(void)
607{
608 struct pci_dev *pdev = NULL;
609
610 for_each_pci_dev(pdev) {
611 struct mrst_device *mrst_dev;
612 u8 pci_config_lss;
613 int pos;
614
615 mrst_dev = pci_id_2_mrst_dev(pdev->device);
616 if (unlikely(!mrst_dev)) {
617 printk(KERN_ERR FW_BUG "pmu: Unknown "
618 "PCI device 0x%04X\n", pdev->device);
619 continue;
620 }
621
622 if (mrst_dev->lss == 0)
623 continue; /* no LSS in our table */
624
625 pos = pci_find_capability(pdev, PCI_CAP_ID_VNDR);
626 if (!pos != 0) {
627 printk(KERN_ERR FW_BUG "pmu: 0x%04X "
628 "missing PCI Vendor Capability\n",
629 pdev->device);
630 continue;
631 }
632 pci_read_config_byte(pdev, pos + 4, &pci_config_lss);
633 if (!(pci_config_lss & PCI_VENDOR_CAP_LOG_SS_MASK)) {
634 printk(KERN_ERR FW_BUG "pmu: 0x%04X "
635 "invalid PCI Vendor Capability 0x%x "
636 " expected LSS 0x%X\n",
637 pdev->device, pci_config_lss, mrst_dev->lss);
638 continue;
639 }
640 pci_config_lss &= PCI_VENDOR_CAP_LOG_ID_MASK;
641
642 if (mrst_dev->lss == pci_config_lss)
643 continue;
644
645 printk(KERN_ERR FW_BUG "pmu: 0x%04X LSS = %d, expected %d\n",
646 pdev->device, pci_config_lss, mrst_dev->lss);
647 }
648}
649
650/**
651 * pmu_probe
652 */
653static int __devinit pmu_probe(struct pci_dev *pdev,
654 const struct pci_device_id *pci_id)
655{
656 int ret;
657 struct mrst_pmu_reg *pmu;
658
659 /* Init the device */
660 ret = pci_enable_device(pdev);
661 if (ret) {
662 dev_err(&pdev->dev, "Unable to Enable PCI device\n");
663 return ret;
664 }
665
666 ret = pci_request_regions(pdev, MRST_PMU_DRV_NAME);
667 if (ret < 0) {
668 dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n");
669 goto out_err1;
670 }
671
672 /* Map the memory of PMU reg base */
673 pmu = pci_iomap(pdev, 0, 0);
674 if (!pmu) {
675 dev_err(&pdev->dev, "Unable to map the PMU address space\n");
676 ret = -ENOMEM;
677 goto out_err2;
678 }
679
680#ifdef CONFIG_DEBUG_FS
681 /* /sys/kernel/debug/mrst_pmu */
682 (void) debugfs_create_file("mrst_pmu", S_IFREG | S_IRUGO,
683 NULL, NULL, &devices_state_operations);
684#endif
685 pmu_reg = pmu; /* success */
686
687 if (request_irq(pdev->irq, pmu_irq, 0, MRST_PMU_DRV_NAME, NULL)) {
688 dev_err(&pdev->dev, "Registering isr has failed\n");
689 ret = -1;
690 goto out_err3;
691 }
692
693 pmu_scu_firmware_debug();
694
695 pmu_write_wkc(S0I3_WAKE_SOURCES); /* Enable S0i3 wakeup sources */
696
697 pmu_wait_ready();
698
699 pmu_write_ssc(D0I1_ACG_SSS_TARGET); /* Enable Auto-Clock_Gating */
700 pmu_write_cmd(0x201);
701
702 spin_lock_init(&mrst_pmu_power_state_lock);
703
704 /* Enable the hardware interrupt */
705 pmu_irq_enable();
706 return 0;
707
708out_err3:
709 free_irq(pdev->irq, NULL);
710 pci_iounmap(pdev, pmu_reg);
711 pmu_reg = NULL;
712out_err2:
713 pci_release_region(pdev, 0);
714out_err1:
715 pci_disable_device(pdev);
716 return ret;
717}
718
719static void __devexit pmu_remove(struct pci_dev *pdev)
720{
721 dev_err(&pdev->dev, "Mid PM pmu_remove called\n");
722
723 /* Freeing up the irq */
724 free_irq(pdev->irq, NULL);
725
726 pci_iounmap(pdev, pmu_reg);
727 pmu_reg = NULL;
728
729 /* disable the current PCI device */
730 pci_release_region(pdev, 0);
731 pci_disable_device(pdev);
732}
733
734static DEFINE_PCI_DEVICE_TABLE(pmu_pci_ids) = {
735 { PCI_VDEVICE(INTEL, PCI_DEV_ID_MRST_PMU), 0 },
736 { }
737};
738
739MODULE_DEVICE_TABLE(pci, pmu_pci_ids);
740
741static struct pci_driver driver = {
742 .name = MRST_PMU_DRV_NAME,
743 .id_table = pmu_pci_ids,
744 .probe = pmu_probe,
745 .remove = __devexit_p(pmu_remove),
746};
747
748/**
749 * pmu_pci_register - register the PMU driver as PCI device
750 */
751static int __init pmu_pci_register(void)
752{
753 return pci_register_driver(&driver);
754}
755
756/* Register and probe via fs_initcall() to preceed device_initcall() */
757fs_initcall(pmu_pci_register);
758
759static void __exit mid_pci_cleanup(void)
760{
761 pci_unregister_driver(&driver);
762}
763
764static int ia_major;
765static int ia_minor;
766
767static int pmu_sfi_parse_oem(struct sfi_table_header *table)
768{
769 struct sfi_table_simple *sb;
770
771 sb = (struct sfi_table_simple *)table;
772 ia_major = (sb->pentry[1] >> 0) & 0xFFFF;
773 ia_minor = (sb->pentry[1] >> 16) & 0xFFFF;
774 printk(KERN_INFO "mrst_pmu: IA FW version v%x.%x\n",
775 ia_major, ia_minor);
776
777 return 0;
778}
779
780static int __init scu_fw_check(void)
781{
782 int ret;
783 u32 fw_version;
784
785 if (!pmu_reg)
786 return 0; /* this driver didn't probe-out */
787
788 sfi_table_parse("OEMB", NULL, NULL, pmu_sfi_parse_oem);
789
790 if (ia_major < 0x6005 || ia_minor < 0x1525) {
791 WARN(1, "mrst_pmu: IA FW version too old\n");
792 return -1;
793 }
794
795 ret = intel_scu_ipc_command(IPCMSG_FW_REVISION, 0, NULL, 0,
796 &fw_version, 1);
797
798 if (ret) {
799 WARN(1, "mrst_pmu: IPC FW version? %d\n", ret);
800 } else {
801 int scu_major = (fw_version >> 8) & 0xFF;
802 int scu_minor = (fw_version >> 0) & 0xFF;
803
804 printk(KERN_INFO "mrst_pmu: firmware v%x\n", fw_version);
805
806 if ((scu_major >= 0xC0) && (scu_minor >= 0x49)) {
807 printk(KERN_INFO "mrst_pmu: enabling S0i3\n");
808 mrst_pmu_s0i3_enable = true;
809 } else {
810 WARN(1, "mrst_pmu: S0i3 disabled, old firmware %X.%X",
811 scu_major, scu_minor);
812 }
813 }
814 return 0;
815}
816late_initcall(scu_fw_check);
817module_exit(mid_pci_cleanup);
diff --git a/arch/x86/platform/mrst/pmu.h b/arch/x86/platform/mrst/pmu.h
new file mode 100644
index 00000000000..bfbfe64b167
--- /dev/null
+++ b/arch/x86/platform/mrst/pmu.h
@@ -0,0 +1,234 @@
1/*
2 * mrst/pmu.h - private definitions for MRST Power Management Unit mrst/pmu.c
3 *
4 * Copyright (c) 2011, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifndef _MRST_PMU_H_
21#define _MRST_PMU_H_
22
23#define PCI_DEV_ID_MRST_PMU 0x0810
24#define MRST_PMU_DRV_NAME "mrst_pmu"
25#define PCI_SUB_CLASS_MASK 0xFF00
26
27#define PCI_VENDOR_CAP_LOG_ID_MASK 0x7F
28#define PCI_VENDOR_CAP_LOG_SS_MASK 0x80
29
30#define SUB_SYS_ALL_D0I1 0x01155555
31#define S0I3_WAKE_SOURCES 0x00001FFF
32
33#define PM_S0I3_COMMAND \
34 ((0 << 31) | /* Reserved */ \
35 (0 << 30) | /* Core must be idle */ \
36 (0xc2 << 22) | /* ACK C6 trigger */ \
37 (3 << 19) | /* Trigger on DMI message */ \
38 (3 << 16) | /* Enter S0i3 */ \
39 (0 << 13) | /* Numeric mode ID (sw) */ \
40 (3 << 9) | /* Trigger mode */ \
41 (0 << 8) | /* Do not interrupt */ \
42 (1 << 0)) /* Set configuration */
43
44#define LSS_DMI 0
45#define LSS_SD_HC0 1
46#define LSS_SD_HC1 2
47#define LSS_NAND 3
48#define LSS_IMAGING 4
49#define LSS_SECURITY 5
50#define LSS_DISPLAY 6
51#define LSS_USB_HC 7
52#define LSS_USB_OTG 8
53#define LSS_AUDIO 9
54#define LSS_AUDIO_LPE 9
55#define LSS_AUDIO_SSP 9
56#define LSS_I2C0 10
57#define LSS_I2C1 10
58#define LSS_I2C2 10
59#define LSS_KBD 10
60#define LSS_SPI0 10
61#define LSS_SPI1 10
62#define LSS_SPI2 10
63#define LSS_GPIO 10
64#define LSS_SRAM 11 /* used by SCU, do not touch */
65#define LSS_SD_HC2 12
66/* LSS hardware bits 15,14,13 are hardwired to 0, thus unusable */
67#define MRST_NUM_LSS 13
68
69#define MIN(a, b) (((a) < (b)) ? (a) : (b))
70
71#define SSMSK(mask, lss) ((mask) << ((lss) * 2))
72#define D0 0
73#define D0i1 1
74#define D0i2 2
75#define D0i3 3
76
77#define S0I3_SSS_TARGET ( \
78 SSMSK(D0i1, LSS_DMI) | \
79 SSMSK(D0i3, LSS_SD_HC0) | \
80 SSMSK(D0i3, LSS_SD_HC1) | \
81 SSMSK(D0i3, LSS_NAND) | \
82 SSMSK(D0i3, LSS_SD_HC2) | \
83 SSMSK(D0i3, LSS_IMAGING) | \
84 SSMSK(D0i3, LSS_SECURITY) | \
85 SSMSK(D0i3, LSS_DISPLAY) | \
86 SSMSK(D0i3, LSS_USB_HC) | \
87 SSMSK(D0i3, LSS_USB_OTG) | \
88 SSMSK(D0i3, LSS_AUDIO) | \
89 SSMSK(D0i1, LSS_I2C0))
90
91/*
92 * D0i1 on Langwell is Autonomous Clock Gating (ACG).
93 * Enable ACG on every LSS except camera and audio
94 */
95#define D0I1_ACG_SSS_TARGET \
96 (SUB_SYS_ALL_D0I1 & ~SSMSK(D0i1, LSS_IMAGING) & ~SSMSK(D0i1, LSS_AUDIO))
97
98enum cm_mode {
99 CM_NOP, /* ignore the config mode value */
100 CM_IMMEDIATE,
101 CM_DELAY,
102 CM_TRIGGER,
103 CM_INVALID
104};
105
106enum sys_state {
107 SYS_STATE_S0I0,
108 SYS_STATE_S0I1,
109 SYS_STATE_S0I2,
110 SYS_STATE_S0I3,
111 SYS_STATE_S3,
112 SYS_STATE_S5
113};
114
115#define SET_CFG_CMD 1
116
117enum int_status {
118 INT_SPURIOUS = 0,
119 INT_CMD_DONE = 1,
120 INT_CMD_ERR = 2,
121 INT_WAKE_RX = 3,
122 INT_SS_ERROR = 4,
123 INT_S0IX_MISS = 5,
124 INT_NO_ACKC6 = 6,
125 INT_INVALID = 7,
126};
127
128/* PMU register interface */
129static struct mrst_pmu_reg {
130 u32 pm_sts; /* 0x00 */
131 u32 pm_cmd; /* 0x04 */
132 u32 pm_ics; /* 0x08 */
133 u32 _resv1; /* 0x0C */
134 u32 pm_wkc[2]; /* 0x10 */
135 u32 pm_wks[2]; /* 0x18 */
136 u32 pm_ssc[4]; /* 0x20 */
137 u32 pm_sss[4]; /* 0x30 */
138 u32 pm_wssc[4]; /* 0x40 */
139 u32 pm_c3c4; /* 0x50 */
140 u32 pm_c5c6; /* 0x54 */
141 u32 pm_msi_disable; /* 0x58 */
142} *pmu_reg;
143
144static inline u32 pmu_read_sts(void) { return readl(&pmu_reg->pm_sts); }
145static inline u32 pmu_read_ics(void) { return readl(&pmu_reg->pm_ics); }
146static inline u32 pmu_read_wks(void) { return readl(&pmu_reg->pm_wks[0]); }
147static inline u32 pmu_read_sss(void) { return readl(&pmu_reg->pm_sss[0]); }
148
149static inline void pmu_write_cmd(u32 arg) { writel(arg, &pmu_reg->pm_cmd); }
150static inline void pmu_write_ics(u32 arg) { writel(arg, &pmu_reg->pm_ics); }
151static inline void pmu_write_wkc(u32 arg) { writel(arg, &pmu_reg->pm_wkc[0]); }
152static inline void pmu_write_ssc(u32 arg) { writel(arg, &pmu_reg->pm_ssc[0]); }
153static inline void pmu_write_wssc(u32 arg)
154 { writel(arg, &pmu_reg->pm_wssc[0]); }
155
156static inline void pmu_msi_enable(void) { writel(0, &pmu_reg->pm_msi_disable); }
157static inline u32 pmu_msi_is_disabled(void)
158 { return readl(&pmu_reg->pm_msi_disable); }
159
160union pmu_pm_ics {
161 struct {
162 u32 cause:8;
163 u32 enable:1;
164 u32 pending:1;
165 u32 reserved:22;
166 } bits;
167 u32 value;
168};
169
170static inline void pmu_irq_enable(void)
171{
172 union pmu_pm_ics pmu_ics;
173
174 pmu_ics.value = pmu_read_ics();
175 pmu_ics.bits.enable = 1;
176 pmu_write_ics(pmu_ics.value);
177}
178
179union pmu_pm_status {
180 struct {
181 u32 pmu_rev:8;
182 u32 pmu_busy:1;
183 u32 mode_id:4;
184 u32 Reserved:19;
185 } pmu_status_parts;
186 u32 pmu_status_value;
187};
188
189static inline int pmu_read_busy_status(void)
190{
191 union pmu_pm_status result;
192
193 result.pmu_status_value = pmu_read_sts();
194
195 return result.pmu_status_parts.pmu_busy;
196}
197
198/* pmu set config parameters */
199struct cfg_delay_param_t {
200 u32 cmd:8;
201 u32 ioc:1;
202 u32 cfg_mode:4;
203 u32 mode_id:3;
204 u32 sys_state:3;
205 u32 cfg_delay:8;
206 u32 rsvd:5;
207};
208
209struct cfg_trig_param_t {
210 u32 cmd:8;
211 u32 ioc:1;
212 u32 cfg_mode:4;
213 u32 mode_id:3;
214 u32 sys_state:3;
215 u32 cfg_trig_type:3;
216 u32 cfg_trig_val:8;
217 u32 cmbi:1;
218 u32 rsvd1:1;
219};
220
221union pmu_pm_set_cfg_cmd_t {
222 union {
223 struct cfg_delay_param_t d_param;
224 struct cfg_trig_param_t t_param;
225 } pmu2_params;
226 u32 pmu_pm_set_cfg_cmd_value;
227};
228
229#ifdef FUTURE_PATCH
230extern int mrst_s0i3_entry(u32 regval, u32 *regaddr);
231#else
232static inline int mrst_s0i3_entry(u32 regval, u32 *regaddr) { return -1; }
233#endif
234#endif
diff --git a/arch/x86/platform/olpc/Makefile b/arch/x86/platform/olpc/Makefile
index 81c5e2165c2..fd332c53394 100644
--- a/arch/x86/platform/olpc/Makefile
+++ b/arch/x86/platform/olpc/Makefile
@@ -1,2 +1,5 @@
1obj-$(CONFIG_OLPC) += olpc.o olpc_ofw.o olpc_dt.o 1obj-$(CONFIG_OLPC) += olpc.o olpc_ofw.o olpc_dt.o
2obj-$(CONFIG_OLPC_XO1) += olpc-xo1.o 2obj-$(CONFIG_OLPC_XO1_PM) += olpc-xo1-pm.o xo1-wakeup.o
3obj-$(CONFIG_OLPC_XO1_RTC) += olpc-xo1-rtc.o
4obj-$(CONFIG_OLPC_XO1_SCI) += olpc-xo1-sci.o
5obj-$(CONFIG_OLPC_XO15_SCI) += olpc-xo15-sci.o
diff --git a/arch/x86/platform/olpc/olpc-xo1-pm.c b/arch/x86/platform/olpc/olpc-xo1-pm.c
new file mode 100644
index 00000000000..6f3855a5a2f
--- /dev/null
+++ b/arch/x86/platform/olpc/olpc-xo1-pm.c
@@ -0,0 +1,215 @@
1/*
2 * Support for power management features of the OLPC XO-1 laptop
3 *
4 * Copyright (C) 2010 Andres Salomon <dilinger@queued.net>
5 * Copyright (C) 2010 One Laptop per Child
6 * Copyright (C) 2006 Red Hat, Inc.
7 * Copyright (C) 2006 Advanced Micro Devices, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#include <linux/cs5535.h>
16#include <linux/platform_device.h>
17#include <linux/pm.h>
18#include <linux/mfd/core.h>
19#include <linux/suspend.h>
20
21#include <asm/io.h>
22#include <asm/olpc.h>
23
24#define DRV_NAME "olpc-xo1-pm"
25
26static unsigned long acpi_base;
27static unsigned long pms_base;
28
29static u16 wakeup_mask = CS5536_PM_PWRBTN;
30
31static struct {
32 unsigned long address;
33 unsigned short segment;
34} ofw_bios_entry = { 0xF0000 + PAGE_OFFSET, __KERNEL_CS };
35
36/* Set bits in the wakeup mask */
37void olpc_xo1_pm_wakeup_set(u16 value)
38{
39 wakeup_mask |= value;
40}
41EXPORT_SYMBOL_GPL(olpc_xo1_pm_wakeup_set);
42
43/* Clear bits in the wakeup mask */
44void olpc_xo1_pm_wakeup_clear(u16 value)
45{
46 wakeup_mask &= ~value;
47}
48EXPORT_SYMBOL_GPL(olpc_xo1_pm_wakeup_clear);
49
50static int xo1_power_state_enter(suspend_state_t pm_state)
51{
52 unsigned long saved_sci_mask;
53 int r;
54
55 /* Only STR is supported */
56 if (pm_state != PM_SUSPEND_MEM)
57 return -EINVAL;
58
59 r = olpc_ec_cmd(EC_SET_SCI_INHIBIT, NULL, 0, NULL, 0);
60 if (r)
61 return r;
62
63 /*
64 * Save SCI mask (this gets lost since PM1_EN is used as a mask for
65 * wakeup events, which is not necessarily the same event set)
66 */
67 saved_sci_mask = inl(acpi_base + CS5536_PM1_STS);
68 saved_sci_mask &= 0xffff0000;
69
70 /* Save CPU state */
71 do_olpc_suspend_lowlevel();
72
73 /* Resume path starts here */
74
75 /* Restore SCI mask (using dword access to CS5536_PM1_EN) */
76 outl(saved_sci_mask, acpi_base + CS5536_PM1_STS);
77
78 /* Tell the EC to stop inhibiting SCIs */
79 olpc_ec_cmd(EC_SET_SCI_INHIBIT_RELEASE, NULL, 0, NULL, 0);
80
81 /*
82 * Tell the wireless module to restart USB communication.
83 * Must be done twice.
84 */
85 olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0);
86 olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0);
87
88 return 0;
89}
90
91asmlinkage int xo1_do_sleep(u8 sleep_state)
92{
93 void *pgd_addr = __va(read_cr3());
94
95 /* Program wakeup mask (using dword access to CS5536_PM1_EN) */
96 outl(wakeup_mask << 16, acpi_base + CS5536_PM1_STS);
97
98 __asm__("movl %0,%%eax" : : "r" (pgd_addr));
99 __asm__("call *(%%edi); cld"
100 : : "D" (&ofw_bios_entry));
101 __asm__("movb $0x34, %al\n\t"
102 "outb %al, $0x70\n\t"
103 "movb $0x30, %al\n\t"
104 "outb %al, $0x71\n\t");
105 return 0;
106}
107
108static void xo1_power_off(void)
109{
110 printk(KERN_INFO "OLPC XO-1 power off sequence...\n");
111
112 /* Enable all of these controls with 0 delay */
113 outl(0x40000000, pms_base + CS5536_PM_SCLK);
114 outl(0x40000000, pms_base + CS5536_PM_IN_SLPCTL);
115 outl(0x40000000, pms_base + CS5536_PM_WKXD);
116 outl(0x40000000, pms_base + CS5536_PM_WKD);
117
118 /* Clear status bits (possibly unnecessary) */
119 outl(0x0002ffff, pms_base + CS5536_PM_SSC);
120 outl(0xffffffff, acpi_base + CS5536_PM_GPE0_STS);
121
122 /* Write SLP_EN bit to start the machinery */
123 outl(0x00002000, acpi_base + CS5536_PM1_CNT);
124}
125
126static int xo1_power_state_valid(suspend_state_t pm_state)
127{
128 /* suspend-to-RAM only */
129 return pm_state == PM_SUSPEND_MEM;
130}
131
132static const struct platform_suspend_ops xo1_suspend_ops = {
133 .valid = xo1_power_state_valid,
134 .enter = xo1_power_state_enter,
135};
136
137static int __devinit xo1_pm_probe(struct platform_device *pdev)
138{
139 struct resource *res;
140 int err;
141
142 /* don't run on non-XOs */
143 if (!machine_is_olpc())
144 return -ENODEV;
145
146 err = mfd_cell_enable(pdev);
147 if (err)
148 return err;
149
150 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
151 if (!res) {
152 dev_err(&pdev->dev, "can't fetch device resource info\n");
153 return -EIO;
154 }
155 if (strcmp(pdev->name, "cs5535-pms") == 0)
156 pms_base = res->start;
157 else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0)
158 acpi_base = res->start;
159
160 /* If we have both addresses, we can override the poweroff hook */
161 if (pms_base && acpi_base) {
162 suspend_set_ops(&xo1_suspend_ops);
163 pm_power_off = xo1_power_off;
164 printk(KERN_INFO "OLPC XO-1 support registered\n");
165 }
166
167 return 0;
168}
169
170static int __devexit xo1_pm_remove(struct platform_device *pdev)
171{
172 mfd_cell_disable(pdev);
173
174 if (strcmp(pdev->name, "cs5535-pms") == 0)
175 pms_base = 0;
176 else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0)
177 acpi_base = 0;
178
179 pm_power_off = NULL;
180 return 0;
181}
182
183static struct platform_driver cs5535_pms_driver = {
184 .driver = {
185 .name = "cs5535-pms",
186 .owner = THIS_MODULE,
187 },
188 .probe = xo1_pm_probe,
189 .remove = __devexit_p(xo1_pm_remove),
190};
191
192static struct platform_driver cs5535_acpi_driver = {
193 .driver = {
194 .name = "olpc-xo1-pm-acpi",
195 .owner = THIS_MODULE,
196 },
197 .probe = xo1_pm_probe,
198 .remove = __devexit_p(xo1_pm_remove),
199};
200
201static int __init xo1_pm_init(void)
202{
203 int r;
204
205 r = platform_driver_register(&cs5535_pms_driver);
206 if (r)
207 return r;
208
209 r = platform_driver_register(&cs5535_acpi_driver);
210 if (r)
211 platform_driver_unregister(&cs5535_pms_driver);
212
213 return r;
214}
215arch_initcall(xo1_pm_init);
diff --git a/arch/x86/platform/olpc/olpc-xo1-rtc.c b/arch/x86/platform/olpc/olpc-xo1-rtc.c
new file mode 100644
index 00000000000..a2b4efddd61
--- /dev/null
+++ b/arch/x86/platform/olpc/olpc-xo1-rtc.c
@@ -0,0 +1,81 @@
1/*
2 * Support for OLPC XO-1 Real Time Clock (RTC)
3 *
4 * Copyright (C) 2011 One Laptop per Child
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
12#include <linux/mc146818rtc.h>
13#include <linux/platform_device.h>
14#include <linux/rtc.h>
15#include <linux/of.h>
16
17#include <asm/msr.h>
18#include <asm/olpc.h>
19
20static void rtc_wake_on(struct device *dev)
21{
22 olpc_xo1_pm_wakeup_set(CS5536_PM_RTC);
23}
24
25static void rtc_wake_off(struct device *dev)
26{
27 olpc_xo1_pm_wakeup_clear(CS5536_PM_RTC);
28}
29
30static struct resource rtc_platform_resource[] = {
31 [0] = {
32 .start = RTC_PORT(0),
33 .end = RTC_PORT(1),
34 .flags = IORESOURCE_IO,
35 },
36 [1] = {
37 .start = RTC_IRQ,
38 .end = RTC_IRQ,
39 .flags = IORESOURCE_IRQ,
40 }
41};
42
43static struct cmos_rtc_board_info rtc_info = {
44 .rtc_day_alarm = 0,
45 .rtc_mon_alarm = 0,
46 .rtc_century = 0,
47 .wake_on = rtc_wake_on,
48 .wake_off = rtc_wake_off,
49};
50
51static struct platform_device xo1_rtc_device = {
52 .name = "rtc_cmos",
53 .id = -1,
54 .num_resources = ARRAY_SIZE(rtc_platform_resource),
55 .dev.platform_data = &rtc_info,
56 .resource = rtc_platform_resource,
57};
58
59static int __init xo1_rtc_init(void)
60{
61 int r;
62 struct device_node *node;
63
64 node = of_find_compatible_node(NULL, NULL, "olpc,xo1-rtc");
65 if (!node)
66 return 0;
67 of_node_put(node);
68
69 pr_info("olpc-xo1-rtc: Initializing OLPC XO-1 RTC\n");
70 rdmsrl(MSR_RTC_DOMA_OFFSET, rtc_info.rtc_day_alarm);
71 rdmsrl(MSR_RTC_MONA_OFFSET, rtc_info.rtc_mon_alarm);
72 rdmsrl(MSR_RTC_CEN_OFFSET, rtc_info.rtc_century);
73
74 r = platform_device_register(&xo1_rtc_device);
75 if (r)
76 return r;
77
78 device_init_wakeup(&xo1_rtc_device.dev, 1);
79 return 0;
80}
81arch_initcall(xo1_rtc_init);
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
new file mode 100644
index 00000000000..1d4c783d732
--- /dev/null
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -0,0 +1,614 @@
1/*
2 * Support for OLPC XO-1 System Control Interrupts (SCI)
3 *
4 * Copyright (C) 2010 One Laptop per Child
5 * Copyright (C) 2006 Red Hat, Inc.
6 * Copyright (C) 2006 Advanced Micro Devices, Inc.
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
14#include <linux/cs5535.h>
15#include <linux/device.h>
16#include <linux/gpio.h>
17#include <linux/input.h>
18#include <linux/interrupt.h>
19#include <linux/platform_device.h>
20#include <linux/pm.h>
21#include <linux/mfd/core.h>
22#include <linux/power_supply.h>
23#include <linux/suspend.h>
24#include <linux/workqueue.h>
25
26#include <asm/io.h>
27#include <asm/msr.h>
28#include <asm/olpc.h>
29
30#define DRV_NAME "olpc-xo1-sci"
31#define PFX DRV_NAME ": "
32
33static unsigned long acpi_base;
34static struct input_dev *power_button_idev;
35static struct input_dev *ebook_switch_idev;
36static struct input_dev *lid_switch_idev;
37
38static int sci_irq;
39
40static bool lid_open;
41static bool lid_inverted;
42static int lid_wake_mode;
43
44enum lid_wake_modes {
45 LID_WAKE_ALWAYS,
46 LID_WAKE_OPEN,
47 LID_WAKE_CLOSE,
48};
49
50static const char * const lid_wake_mode_names[] = {
51 [LID_WAKE_ALWAYS] = "always",
52 [LID_WAKE_OPEN] = "open",
53 [LID_WAKE_CLOSE] = "close",
54};
55
56static void battery_status_changed(void)
57{
58 struct power_supply *psy = power_supply_get_by_name("olpc-battery");
59
60 if (psy) {
61 power_supply_changed(psy);
62 put_device(psy->dev);
63 }
64}
65
66static void ac_status_changed(void)
67{
68 struct power_supply *psy = power_supply_get_by_name("olpc-ac");
69
70 if (psy) {
71 power_supply_changed(psy);
72 put_device(psy->dev);
73 }
74}
75
76/* Report current ebook switch state through input layer */
77static void send_ebook_state(void)
78{
79 unsigned char state;
80
81 if (olpc_ec_cmd(EC_READ_EB_MODE, NULL, 0, &state, 1)) {
82 pr_err(PFX "failed to get ebook state\n");
83 return;
84 }
85
86 input_report_switch(ebook_switch_idev, SW_TABLET_MODE, state);
87 input_sync(ebook_switch_idev);
88}
89
90static void flip_lid_inverter(void)
91{
92 /* gpio is high; invert so we'll get l->h event interrupt */
93 if (lid_inverted)
94 cs5535_gpio_clear(OLPC_GPIO_LID, GPIO_INPUT_INVERT);
95 else
96 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_INPUT_INVERT);
97 lid_inverted = !lid_inverted;
98}
99
100static void detect_lid_state(void)
101{
102 /*
103 * the edge detector hookup on the gpio inputs on the geode is
104 * odd, to say the least. See http://dev.laptop.org/ticket/5703
105 * for details, but in a nutshell: we don't use the edge
106 * detectors. instead, we make use of an anomoly: with the both
107 * edge detectors turned off, we still get an edge event on a
108 * positive edge transition. to take advantage of this, we use the
109 * front-end inverter to ensure that that's the edge we're always
110 * going to see next.
111 */
112
113 int state;
114
115 state = cs5535_gpio_isset(OLPC_GPIO_LID, GPIO_READ_BACK);
116 lid_open = !state ^ !lid_inverted; /* x ^^ y */
117 if (!state)
118 return;
119
120 flip_lid_inverter();
121}
122
123/* Report current lid switch state through input layer */
124static void send_lid_state(void)
125{
126 input_report_switch(lid_switch_idev, SW_LID, !lid_open);
127 input_sync(lid_switch_idev);
128}
129
130static ssize_t lid_wake_mode_show(struct device *dev,
131 struct device_attribute *attr, char *buf)
132{
133 const char *mode = lid_wake_mode_names[lid_wake_mode];
134 return sprintf(buf, "%s\n", mode);
135}
136static ssize_t lid_wake_mode_set(struct device *dev,
137 struct device_attribute *attr,
138 const char *buf, size_t count)
139{
140 int i;
141 for (i = 0; i < ARRAY_SIZE(lid_wake_mode_names); i++) {
142 const char *mode = lid_wake_mode_names[i];
143 if (strlen(mode) != count || strncasecmp(mode, buf, count))
144 continue;
145
146 lid_wake_mode = i;
147 return count;
148 }
149 return -EINVAL;
150}
151static DEVICE_ATTR(lid_wake_mode, S_IWUSR | S_IRUGO, lid_wake_mode_show,
152 lid_wake_mode_set);
153
154/*
155 * Process all items in the EC's SCI queue.
156 *
157 * This is handled in a workqueue because olpc_ec_cmd can be slow (and
158 * can even timeout).
159 *
160 * If propagate_events is false, the queue is drained without events being
161 * generated for the interrupts.
162 */
163static void process_sci_queue(bool propagate_events)
164{
165 int r;
166 u16 data;
167
168 do {
169 r = olpc_ec_sci_query(&data);
170 if (r || !data)
171 break;
172
173 pr_debug(PFX "SCI 0x%x received\n", data);
174
175 switch (data) {
176 case EC_SCI_SRC_BATERR:
177 case EC_SCI_SRC_BATSOC:
178 case EC_SCI_SRC_BATTERY:
179 case EC_SCI_SRC_BATCRIT:
180 battery_status_changed();
181 break;
182 case EC_SCI_SRC_ACPWR:
183 ac_status_changed();
184 break;
185 }
186
187 if (data == EC_SCI_SRC_EBOOK && propagate_events)
188 send_ebook_state();
189 } while (data);
190
191 if (r)
192 pr_err(PFX "Failed to clear SCI queue");
193}
194
195static void process_sci_queue_work(struct work_struct *work)
196{
197 process_sci_queue(true);
198}
199
200static DECLARE_WORK(sci_work, process_sci_queue_work);
201
202static irqreturn_t xo1_sci_intr(int irq, void *dev_id)
203{
204 struct platform_device *pdev = dev_id;
205 u32 sts;
206 u32 gpe;
207
208 sts = inl(acpi_base + CS5536_PM1_STS);
209 outl(sts | 0xffff, acpi_base + CS5536_PM1_STS);
210
211 gpe = inl(acpi_base + CS5536_PM_GPE0_STS);
212 outl(0xffffffff, acpi_base + CS5536_PM_GPE0_STS);
213
214 dev_dbg(&pdev->dev, "sts %x gpe %x\n", sts, gpe);
215
216 if (sts & CS5536_PWRBTN_FLAG && !(sts & CS5536_WAK_FLAG)) {
217 input_report_key(power_button_idev, KEY_POWER, 1);
218 input_sync(power_button_idev);
219 input_report_key(power_button_idev, KEY_POWER, 0);
220 input_sync(power_button_idev);
221 }
222
223 if (gpe & CS5536_GPIOM7_PME_FLAG) { /* EC GPIO */
224 cs5535_gpio_set(OLPC_GPIO_ECSCI, GPIO_NEGATIVE_EDGE_STS);
225 schedule_work(&sci_work);
226 }
227
228 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_STS);
229 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_STS);
230 detect_lid_state();
231 send_lid_state();
232
233 return IRQ_HANDLED;
234}
235
236static int xo1_sci_suspend(struct platform_device *pdev, pm_message_t state)
237{
238 if (device_may_wakeup(&power_button_idev->dev))
239 olpc_xo1_pm_wakeup_set(CS5536_PM_PWRBTN);
240 else
241 olpc_xo1_pm_wakeup_clear(CS5536_PM_PWRBTN);
242
243 if (device_may_wakeup(&ebook_switch_idev->dev))
244 olpc_ec_wakeup_set(EC_SCI_SRC_EBOOK);
245 else
246 olpc_ec_wakeup_clear(EC_SCI_SRC_EBOOK);
247
248 if (!device_may_wakeup(&lid_switch_idev->dev)) {
249 cs5535_gpio_clear(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
250 } else if ((lid_open && lid_wake_mode == LID_WAKE_OPEN) ||
251 (!lid_open && lid_wake_mode == LID_WAKE_CLOSE)) {
252 flip_lid_inverter();
253
254 /* we may have just caused an event */
255 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_STS);
256 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_STS);
257
258 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
259 }
260
261 return 0;
262}
263
264static int xo1_sci_resume(struct platform_device *pdev)
265{
266 /*
267 * We don't know what may have happened while we were asleep.
268 * Reestablish our lid setup so we're sure to catch all transitions.
269 */
270 detect_lid_state();
271 send_lid_state();
272 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
273
274 /* Enable all EC events */
275 olpc_ec_mask_write(EC_SCI_SRC_ALL);
276
277 /* Power/battery status might have changed too */
278 battery_status_changed();
279 ac_status_changed();
280 return 0;
281}
282
283static int __devinit setup_sci_interrupt(struct platform_device *pdev)
284{
285 u32 lo, hi;
286 u32 sts;
287 int r;
288
289 rdmsr(0x51400020, lo, hi);
290 sci_irq = (lo >> 20) & 15;
291
292 if (sci_irq) {
293 dev_info(&pdev->dev, "SCI is mapped to IRQ %d\n", sci_irq);
294 } else {
295 /* Zero means masked */
296 dev_info(&pdev->dev, "SCI unmapped. Mapping to IRQ 3\n");
297 sci_irq = 3;
298 lo |= 0x00300000;
299 wrmsrl(0x51400020, lo);
300 }
301
302 /* Select level triggered in PIC */
303 if (sci_irq < 8) {
304 lo = inb(CS5536_PIC_INT_SEL1);
305 lo |= 1 << sci_irq;
306 outb(lo, CS5536_PIC_INT_SEL1);
307 } else {
308 lo = inb(CS5536_PIC_INT_SEL2);
309 lo |= 1 << (sci_irq - 8);
310 outb(lo, CS5536_PIC_INT_SEL2);
311 }
312
313 /* Enable SCI from power button, and clear pending interrupts */
314 sts = inl(acpi_base + CS5536_PM1_STS);
315 outl((CS5536_PM_PWRBTN << 16) | 0xffff, acpi_base + CS5536_PM1_STS);
316
317 r = request_irq(sci_irq, xo1_sci_intr, 0, DRV_NAME, pdev);
318 if (r)
319 dev_err(&pdev->dev, "can't request interrupt\n");
320
321 return r;
322}
323
324static int __devinit setup_ec_sci(void)
325{
326 int r;
327
328 r = gpio_request(OLPC_GPIO_ECSCI, "OLPC-ECSCI");
329 if (r)
330 return r;
331
332 gpio_direction_input(OLPC_GPIO_ECSCI);
333
334 /* Clear pending EC SCI events */
335 cs5535_gpio_set(OLPC_GPIO_ECSCI, GPIO_NEGATIVE_EDGE_STS);
336 cs5535_gpio_set(OLPC_GPIO_ECSCI, GPIO_POSITIVE_EDGE_STS);
337
338 /*
339 * Enable EC SCI events, and map them to both a PME and the SCI
340 * interrupt.
341 *
342 * Ordinarily, in addition to functioning as GPIOs, Geode GPIOs can
343 * be mapped to regular interrupts *or* Geode-specific Power
344 * Management Events (PMEs) - events that bring the system out of
345 * suspend. In this case, we want both of those things - the system
346 * wakeup, *and* the ability to get an interrupt when an event occurs.
347 *
348 * To achieve this, we map the GPIO to a PME, and then we use one
349 * of the many generic knobs on the CS5535 PIC to additionally map the
350 * PME to the regular SCI interrupt line.
351 */
352 cs5535_gpio_set(OLPC_GPIO_ECSCI, GPIO_EVENTS_ENABLE);
353
354 /* Set the SCI to cause a PME event on group 7 */
355 cs5535_gpio_setup_event(OLPC_GPIO_ECSCI, 7, 1);
356
357 /* And have group 7 also fire the SCI interrupt */
358 cs5535_pic_unreqz_select_high(7, sci_irq);
359
360 return 0;
361}
362
363static void free_ec_sci(void)
364{
365 gpio_free(OLPC_GPIO_ECSCI);
366}
367
368static int __devinit setup_lid_events(void)
369{
370 int r;
371
372 r = gpio_request(OLPC_GPIO_LID, "OLPC-LID");
373 if (r)
374 return r;
375
376 gpio_direction_input(OLPC_GPIO_LID);
377
378 cs5535_gpio_clear(OLPC_GPIO_LID, GPIO_INPUT_INVERT);
379 lid_inverted = 0;
380
381 /* Clear edge detection and event enable for now */
382 cs5535_gpio_clear(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
383 cs5535_gpio_clear(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_EN);
384 cs5535_gpio_clear(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_EN);
385 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_STS);
386 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_STS);
387
388 /* Set the LID to cause an PME event on group 6 */
389 cs5535_gpio_setup_event(OLPC_GPIO_LID, 6, 1);
390
391 /* Set PME group 6 to fire the SCI interrupt */
392 cs5535_gpio_set_irq(6, sci_irq);
393
394 /* Enable the event */
395 cs5535_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
396
397 return 0;
398}
399
400static void free_lid_events(void)
401{
402 gpio_free(OLPC_GPIO_LID);
403}
404
405static int __devinit setup_power_button(struct platform_device *pdev)
406{
407 int r;
408
409 power_button_idev = input_allocate_device();
410 if (!power_button_idev)
411 return -ENOMEM;
412
413 power_button_idev->name = "Power Button";
414 power_button_idev->phys = DRV_NAME "/input0";
415 set_bit(EV_KEY, power_button_idev->evbit);
416 set_bit(KEY_POWER, power_button_idev->keybit);
417
418 power_button_idev->dev.parent = &pdev->dev;
419 device_init_wakeup(&power_button_idev->dev, 1);
420
421 r = input_register_device(power_button_idev);
422 if (r) {
423 dev_err(&pdev->dev, "failed to register power button: %d\n", r);
424 input_free_device(power_button_idev);
425 }
426
427 return r;
428}
429
430static void free_power_button(void)
431{
432 input_unregister_device(power_button_idev);
433 input_free_device(power_button_idev);
434}
435
436static int __devinit setup_ebook_switch(struct platform_device *pdev)
437{
438 int r;
439
440 ebook_switch_idev = input_allocate_device();
441 if (!ebook_switch_idev)
442 return -ENOMEM;
443
444 ebook_switch_idev->name = "EBook Switch";
445 ebook_switch_idev->phys = DRV_NAME "/input1";
446 set_bit(EV_SW, ebook_switch_idev->evbit);
447 set_bit(SW_TABLET_MODE, ebook_switch_idev->swbit);
448
449 ebook_switch_idev->dev.parent = &pdev->dev;
450 device_set_wakeup_capable(&ebook_switch_idev->dev, true);
451
452 r = input_register_device(ebook_switch_idev);
453 if (r) {
454 dev_err(&pdev->dev, "failed to register ebook switch: %d\n", r);
455 input_free_device(ebook_switch_idev);
456 }
457
458 return r;
459}
460
461static void free_ebook_switch(void)
462{
463 input_unregister_device(ebook_switch_idev);
464 input_free_device(ebook_switch_idev);
465}
466
467static int __devinit setup_lid_switch(struct platform_device *pdev)
468{
469 int r;
470
471 lid_switch_idev = input_allocate_device();
472 if (!lid_switch_idev)
473 return -ENOMEM;
474
475 lid_switch_idev->name = "Lid Switch";
476 lid_switch_idev->phys = DRV_NAME "/input2";
477 set_bit(EV_SW, lid_switch_idev->evbit);
478 set_bit(SW_LID, lid_switch_idev->swbit);
479
480 lid_switch_idev->dev.parent = &pdev->dev;
481 device_set_wakeup_capable(&lid_switch_idev->dev, true);
482
483 r = input_register_device(lid_switch_idev);
484 if (r) {
485 dev_err(&pdev->dev, "failed to register lid switch: %d\n", r);
486 goto err_register;
487 }
488
489 r = device_create_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
490 if (r) {
491 dev_err(&pdev->dev, "failed to create wake mode attr: %d\n", r);
492 goto err_create_attr;
493 }
494
495 return 0;
496
497err_create_attr:
498 input_unregister_device(lid_switch_idev);
499err_register:
500 input_free_device(lid_switch_idev);
501 return r;
502}
503
504static void free_lid_switch(void)
505{
506 device_remove_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
507 input_unregister_device(lid_switch_idev);
508 input_free_device(lid_switch_idev);
509}
510
511static int __devinit xo1_sci_probe(struct platform_device *pdev)
512{
513 struct resource *res;
514 int r;
515
516 /* don't run on non-XOs */
517 if (!machine_is_olpc())
518 return -ENODEV;
519
520 r = mfd_cell_enable(pdev);
521 if (r)
522 return r;
523
524 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
525 if (!res) {
526 dev_err(&pdev->dev, "can't fetch device resource info\n");
527 return -EIO;
528 }
529 acpi_base = res->start;
530
531 r = setup_power_button(pdev);
532 if (r)
533 return r;
534
535 r = setup_ebook_switch(pdev);
536 if (r)
537 goto err_ebook;
538
539 r = setup_lid_switch(pdev);
540 if (r)
541 goto err_lid;
542
543 r = setup_lid_events();
544 if (r)
545 goto err_lidevt;
546
547 r = setup_ec_sci();
548 if (r)
549 goto err_ecsci;
550
551 /* Enable PME generation for EC-generated events */
552 outl(CS5536_GPIOM6_PME_EN | CS5536_GPIOM7_PME_EN,
553 acpi_base + CS5536_PM_GPE0_EN);
554
555 /* Clear pending events */
556 outl(0xffffffff, acpi_base + CS5536_PM_GPE0_STS);
557 process_sci_queue(false);
558
559 /* Initial sync */
560 send_ebook_state();
561 detect_lid_state();
562 send_lid_state();
563
564 r = setup_sci_interrupt(pdev);
565 if (r)
566 goto err_sci;
567
568 /* Enable all EC events */
569 olpc_ec_mask_write(EC_SCI_SRC_ALL);
570
571 return r;
572
573err_sci:
574 free_ec_sci();
575err_ecsci:
576 free_lid_events();
577err_lidevt:
578 free_lid_switch();
579err_lid:
580 free_ebook_switch();
581err_ebook:
582 free_power_button();
583 return r;
584}
585
586static int __devexit xo1_sci_remove(struct platform_device *pdev)
587{
588 mfd_cell_disable(pdev);
589 free_irq(sci_irq, pdev);
590 cancel_work_sync(&sci_work);
591 free_ec_sci();
592 free_lid_events();
593 free_lid_switch();
594 free_ebook_switch();
595 free_power_button();
596 acpi_base = 0;
597 return 0;
598}
599
600static struct platform_driver xo1_sci_driver = {
601 .driver = {
602 .name = "olpc-xo1-sci-acpi",
603 },
604 .probe = xo1_sci_probe,
605 .remove = __devexit_p(xo1_sci_remove),
606 .suspend = xo1_sci_suspend,
607 .resume = xo1_sci_resume,
608};
609
610static int __init xo1_sci_init(void)
611{
612 return platform_driver_register(&xo1_sci_driver);
613}
614arch_initcall(xo1_sci_init);
diff --git a/arch/x86/platform/olpc/olpc-xo1.c b/arch/x86/platform/olpc/olpc-xo1.c
deleted file mode 100644
index ab81fb27176..00000000000
--- a/arch/x86/platform/olpc/olpc-xo1.c
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * Support for features of the OLPC XO-1 laptop
3 *
4 * Copyright (C) 2010 Andres Salomon <dilinger@queued.net>
5 * Copyright (C) 2010 One Laptop per Child
6 * Copyright (C) 2006 Red Hat, Inc.
7 * Copyright (C) 2006 Advanced Micro Devices, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#include <linux/module.h>
16#include <linux/platform_device.h>
17#include <linux/pm.h>
18#include <linux/mfd/core.h>
19
20#include <asm/io.h>
21#include <asm/olpc.h>
22
23#define DRV_NAME "olpc-xo1"
24
25/* PMC registers (PMS block) */
26#define PM_SCLK 0x10
27#define PM_IN_SLPCTL 0x20
28#define PM_WKXD 0x34
29#define PM_WKD 0x30
30#define PM_SSC 0x54
31
32/* PM registers (ACPI block) */
33#define PM1_CNT 0x08
34#define PM_GPE0_STS 0x18
35
36static unsigned long acpi_base;
37static unsigned long pms_base;
38
39static void xo1_power_off(void)
40{
41 printk(KERN_INFO "OLPC XO-1 power off sequence...\n");
42
43 /* Enable all of these controls with 0 delay */
44 outl(0x40000000, pms_base + PM_SCLK);
45 outl(0x40000000, pms_base + PM_IN_SLPCTL);
46 outl(0x40000000, pms_base + PM_WKXD);
47 outl(0x40000000, pms_base + PM_WKD);
48
49 /* Clear status bits (possibly unnecessary) */
50 outl(0x0002ffff, pms_base + PM_SSC);
51 outl(0xffffffff, acpi_base + PM_GPE0_STS);
52
53 /* Write SLP_EN bit to start the machinery */
54 outl(0x00002000, acpi_base + PM1_CNT);
55}
56
57static int __devinit olpc_xo1_probe(struct platform_device *pdev)
58{
59 struct resource *res;
60 int err;
61
62 /* don't run on non-XOs */
63 if (!machine_is_olpc())
64 return -ENODEV;
65
66 err = mfd_cell_enable(pdev);
67 if (err)
68 return err;
69
70 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
71 if (!res) {
72 dev_err(&pdev->dev, "can't fetch device resource info\n");
73 return -EIO;
74 }
75 if (strcmp(pdev->name, "cs5535-pms") == 0)
76 pms_base = res->start;
77 else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0)
78 acpi_base = res->start;
79
80 /* If we have both addresses, we can override the poweroff hook */
81 if (pms_base && acpi_base) {
82 pm_power_off = xo1_power_off;
83 printk(KERN_INFO "OLPC XO-1 support registered\n");
84 }
85
86 return 0;
87}
88
89static int __devexit olpc_xo1_remove(struct platform_device *pdev)
90{
91 mfd_cell_disable(pdev);
92
93 if (strcmp(pdev->name, "cs5535-pms") == 0)
94 pms_base = 0;
95 else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0)
96 acpi_base = 0;
97
98 pm_power_off = NULL;
99 return 0;
100}
101
102static struct platform_driver cs5535_pms_drv = {
103 .driver = {
104 .name = "cs5535-pms",
105 .owner = THIS_MODULE,
106 },
107 .probe = olpc_xo1_probe,
108 .remove = __devexit_p(olpc_xo1_remove),
109};
110
111static struct platform_driver cs5535_acpi_drv = {
112 .driver = {
113 .name = "olpc-xo1-pm-acpi",
114 .owner = THIS_MODULE,
115 },
116 .probe = olpc_xo1_probe,
117 .remove = __devexit_p(olpc_xo1_remove),
118};
119
120static int __init olpc_xo1_init(void)
121{
122 int r;
123
124 r = platform_driver_register(&cs5535_pms_drv);
125 if (r)
126 return r;
127
128 r = platform_driver_register(&cs5535_acpi_drv);
129 if (r)
130 platform_driver_unregister(&cs5535_pms_drv);
131
132 return r;
133}
134
135static void __exit olpc_xo1_exit(void)
136{
137 platform_driver_unregister(&cs5535_acpi_drv);
138 platform_driver_unregister(&cs5535_pms_drv);
139}
140
141MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>");
142MODULE_LICENSE("GPL");
143MODULE_ALIAS("platform:cs5535-pms");
144
145module_init(olpc_xo1_init);
146module_exit(olpc_xo1_exit);
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
new file mode 100644
index 00000000000..2b235b77d9a
--- /dev/null
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -0,0 +1,168 @@
1/*
2 * Support for OLPC XO-1.5 System Control Interrupts (SCI)
3 *
4 * Copyright (C) 2009-2010 One Laptop per Child
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
12#include <linux/device.h>
13#include <linux/slab.h>
14#include <linux/workqueue.h>
15#include <linux/power_supply.h>
16
17#include <acpi/acpi_bus.h>
18#include <acpi/acpi_drivers.h>
19#include <asm/olpc.h>
20
21#define DRV_NAME "olpc-xo15-sci"
22#define PFX DRV_NAME ": "
23#define XO15_SCI_CLASS DRV_NAME
24#define XO15_SCI_DEVICE_NAME "OLPC XO-1.5 SCI"
25
26static unsigned long xo15_sci_gpe;
27
28static void battery_status_changed(void)
29{
30 struct power_supply *psy = power_supply_get_by_name("olpc-battery");
31
32 if (psy) {
33 power_supply_changed(psy);
34 put_device(psy->dev);
35 }
36}
37
38static void ac_status_changed(void)
39{
40 struct power_supply *psy = power_supply_get_by_name("olpc-ac");
41
42 if (psy) {
43 power_supply_changed(psy);
44 put_device(psy->dev);
45 }
46}
47
48static void process_sci_queue(void)
49{
50 u16 data;
51 int r;
52
53 do {
54 r = olpc_ec_sci_query(&data);
55 if (r || !data)
56 break;
57
58 pr_debug(PFX "SCI 0x%x received\n", data);
59
60 switch (data) {
61 case EC_SCI_SRC_BATERR:
62 case EC_SCI_SRC_BATSOC:
63 case EC_SCI_SRC_BATTERY:
64 case EC_SCI_SRC_BATCRIT:
65 battery_status_changed();
66 break;
67 case EC_SCI_SRC_ACPWR:
68 ac_status_changed();
69 break;
70 }
71 } while (data);
72
73 if (r)
74 pr_err(PFX "Failed to clear SCI queue");
75}
76
77static void process_sci_queue_work(struct work_struct *work)
78{
79 process_sci_queue();
80}
81
82static DECLARE_WORK(sci_work, process_sci_queue_work);
83
84static u32 xo15_sci_gpe_handler(acpi_handle gpe_device, u32 gpe, void *context)
85{
86 schedule_work(&sci_work);
87 return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE;
88}
89
90static int xo15_sci_add(struct acpi_device *device)
91{
92 unsigned long long tmp;
93 acpi_status status;
94
95 if (!device)
96 return -EINVAL;
97
98 strcpy(acpi_device_name(device), XO15_SCI_DEVICE_NAME);
99 strcpy(acpi_device_class(device), XO15_SCI_CLASS);
100
101 /* Get GPE bit assignment (EC events). */
102 status = acpi_evaluate_integer(device->handle, "_GPE", NULL, &tmp);
103 if (ACPI_FAILURE(status))
104 return -EINVAL;
105
106 xo15_sci_gpe = tmp;
107 status = acpi_install_gpe_handler(NULL, xo15_sci_gpe,
108 ACPI_GPE_EDGE_TRIGGERED,
109 xo15_sci_gpe_handler, device);
110 if (ACPI_FAILURE(status))
111 return -ENODEV;
112
113 dev_info(&device->dev, "Initialized, GPE = 0x%lx\n", xo15_sci_gpe);
114
115 /* Flush queue, and enable all SCI events */
116 process_sci_queue();
117 olpc_ec_mask_write(EC_SCI_SRC_ALL);
118
119 acpi_enable_gpe(NULL, xo15_sci_gpe);
120
121 /* Enable wake-on-EC */
122 if (device->wakeup.flags.valid)
123 device_init_wakeup(&device->dev, true);
124
125 return 0;
126}
127
128static int xo15_sci_remove(struct acpi_device *device, int type)
129{
130 acpi_disable_gpe(NULL, xo15_sci_gpe);
131 acpi_remove_gpe_handler(NULL, xo15_sci_gpe, xo15_sci_gpe_handler);
132 cancel_work_sync(&sci_work);
133 return 0;
134}
135
136static int xo15_sci_resume(struct acpi_device *device)
137{
138 /* Enable all EC events */
139 olpc_ec_mask_write(EC_SCI_SRC_ALL);
140
141 /* Power/battery status might have changed */
142 battery_status_changed();
143 ac_status_changed();
144
145 return 0;
146}
147
148static const struct acpi_device_id xo15_sci_device_ids[] = {
149 {"XO15EC", 0},
150 {"", 0},
151};
152
153static struct acpi_driver xo15_sci_drv = {
154 .name = DRV_NAME,
155 .class = XO15_SCI_CLASS,
156 .ids = xo15_sci_device_ids,
157 .ops = {
158 .add = xo15_sci_add,
159 .remove = xo15_sci_remove,
160 .resume = xo15_sci_resume,
161 },
162};
163
164static int __init xo15_sci_init(void)
165{
166 return acpi_bus_register_driver(&xo15_sci_drv);
167}
168device_initcall(xo15_sci_init);
diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c
index 0060fd59ea0..7cce722667b 100644
--- a/arch/x86/platform/olpc/olpc.c
+++ b/arch/x86/platform/olpc/olpc.c
@@ -19,6 +19,7 @@
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/syscore_ops.h>
22 23
23#include <asm/geode.h> 24#include <asm/geode.h>
24#include <asm/setup.h> 25#include <asm/setup.h>
@@ -30,6 +31,9 @@ EXPORT_SYMBOL_GPL(olpc_platform_info);
30 31
31static DEFINE_SPINLOCK(ec_lock); 32static DEFINE_SPINLOCK(ec_lock);
32 33
34/* EC event mask to be applied during suspend (defining wakeup sources). */
35static u16 ec_wakeup_mask;
36
33/* what the timeout *should* be (in ms) */ 37/* what the timeout *should* be (in ms) */
34#define EC_BASE_TIMEOUT 20 38#define EC_BASE_TIMEOUT 20
35 39
@@ -157,13 +161,13 @@ restart:
157 if (inbuf && inlen) { 161 if (inbuf && inlen) {
158 /* write data to EC */ 162 /* write data to EC */
159 for (i = 0; i < inlen; i++) { 163 for (i = 0; i < inlen; i++) {
164 pr_devel("olpc-ec: sending cmd arg 0x%x\n", inbuf[i]);
165 outb(inbuf[i], 0x68);
160 if (wait_on_ibf(0x6c, 0)) { 166 if (wait_on_ibf(0x6c, 0)) {
161 printk(KERN_ERR "olpc-ec: timeout waiting for" 167 printk(KERN_ERR "olpc-ec: timeout waiting for"
162 " EC accept data!\n"); 168 " EC accept data!\n");
163 goto err; 169 goto err;
164 } 170 }
165 pr_devel("olpc-ec: sending cmd arg 0x%x\n", inbuf[i]);
166 outb(inbuf[i], 0x68);
167 } 171 }
168 } 172 }
169 if (outbuf && outlen) { 173 if (outbuf && outlen) {
@@ -188,6 +192,88 @@ err:
188} 192}
189EXPORT_SYMBOL_GPL(olpc_ec_cmd); 193EXPORT_SYMBOL_GPL(olpc_ec_cmd);
190 194
195void olpc_ec_wakeup_set(u16 value)
196{
197 ec_wakeup_mask |= value;
198}
199EXPORT_SYMBOL_GPL(olpc_ec_wakeup_set);
200
201void olpc_ec_wakeup_clear(u16 value)
202{
203 ec_wakeup_mask &= ~value;
204}
205EXPORT_SYMBOL_GPL(olpc_ec_wakeup_clear);
206
207/*
208 * Returns true if the compile and runtime configurations allow for EC events
209 * to wake the system.
210 */
211bool olpc_ec_wakeup_available(void)
212{
213 if (!machine_is_olpc())
214 return false;
215
216 /*
217 * XO-1 EC wakeups are available when olpc-xo1-sci driver is
218 * compiled in
219 */
220#ifdef CONFIG_OLPC_XO1_SCI
221 if (olpc_platform_info.boardrev < olpc_board_pre(0xd0)) /* XO-1 */
222 return true;
223#endif
224
225 /*
226 * XO-1.5 EC wakeups are available when olpc-xo15-sci driver is
227 * compiled in
228 */
229#ifdef CONFIG_OLPC_XO15_SCI
230 if (olpc_platform_info.boardrev >= olpc_board_pre(0xd0)) /* XO-1.5 */
231 return true;
232#endif
233
234 return false;
235}
236EXPORT_SYMBOL_GPL(olpc_ec_wakeup_available);
237
238int olpc_ec_mask_write(u16 bits)
239{
240 if (olpc_platform_info.flags & OLPC_F_EC_WIDE_SCI) {
241 __be16 ec_word = cpu_to_be16(bits);
242 return olpc_ec_cmd(EC_WRITE_EXT_SCI_MASK, (void *) &ec_word, 2,
243 NULL, 0);
244 } else {
245 unsigned char ec_byte = bits & 0xff;
246 return olpc_ec_cmd(EC_WRITE_SCI_MASK, &ec_byte, 1, NULL, 0);
247 }
248}
249EXPORT_SYMBOL_GPL(olpc_ec_mask_write);
250
251int olpc_ec_sci_query(u16 *sci_value)
252{
253 int ret;
254
255 if (olpc_platform_info.flags & OLPC_F_EC_WIDE_SCI) {
256 __be16 ec_word;
257 ret = olpc_ec_cmd(EC_EXT_SCI_QUERY,
258 NULL, 0, (void *) &ec_word, 2);
259 if (ret == 0)
260 *sci_value = be16_to_cpu(ec_word);
261 } else {
262 unsigned char ec_byte;
263 ret = olpc_ec_cmd(EC_SCI_QUERY, NULL, 0, &ec_byte, 1);
264 if (ret == 0)
265 *sci_value = ec_byte;
266 }
267
268 return ret;
269}
270EXPORT_SYMBOL_GPL(olpc_ec_sci_query);
271
272static int olpc_ec_suspend(void)
273{
274 return olpc_ec_mask_write(ec_wakeup_mask);
275}
276
191static bool __init check_ofw_architecture(struct device_node *root) 277static bool __init check_ofw_architecture(struct device_node *root)
192{ 278{
193 const char *olpc_arch; 279 const char *olpc_arch;
@@ -242,6 +328,10 @@ static int __init add_xo1_platform_devices(void)
242 return 0; 328 return 0;
243} 329}
244 330
331static struct syscore_ops olpc_syscore_ops = {
332 .suspend = olpc_ec_suspend,
333};
334
245static int __init olpc_init(void) 335static int __init olpc_init(void)
246{ 336{
247 int r = 0; 337 int r = 0;
@@ -266,6 +356,9 @@ static int __init olpc_init(void)
266 !cs5535_has_vsa2()) 356 !cs5535_has_vsa2())
267 x86_init.pci.arch_init = pci_olpc_init; 357 x86_init.pci.arch_init = pci_olpc_init;
268#endif 358#endif
359 /* EC version 0x5f adds support for wide SCI mask */
360 if (olpc_platform_info.ecver >= 0x5f)
361 olpc_platform_info.flags |= OLPC_F_EC_WIDE_SCI;
269 362
270 printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n", 363 printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n",
271 ((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "", 364 ((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "",
@@ -278,6 +371,8 @@ static int __init olpc_init(void)
278 return r; 371 return r;
279 } 372 }
280 373
374 register_syscore_ops(&olpc_syscore_ops);
375
281 return 0; 376 return 0;
282} 377}
283 378
diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
index d39f63d017d..d6ee9298692 100644
--- a/arch/x86/platform/olpc/olpc_dt.c
+++ b/arch/x86/platform/olpc/olpc_dt.c
@@ -165,6 +165,107 @@ static struct of_pdt_ops prom_olpc_ops __initdata = {
165 .pkg2path = olpc_dt_pkg2path, 165 .pkg2path = olpc_dt_pkg2path,
166}; 166};
167 167
168static phandle __init olpc_dt_finddevice(const char *path)
169{
170 phandle node;
171 const void *args[] = { path };
172 void *res[] = { &node };
173
174 if (olpc_ofw("finddevice", args, res)) {
175 pr_err("olpc_dt: finddevice failed!\n");
176 return 0;
177 }
178
179 if ((s32) node == -1)
180 return 0;
181
182 return node;
183}
184
185static int __init olpc_dt_interpret(const char *words)
186{
187 int result;
188 const void *args[] = { words };
189 void *res[] = { &result };
190
191 if (olpc_ofw("interpret", args, res)) {
192 pr_err("olpc_dt: interpret failed!\n");
193 return -1;
194 }
195
196 return result;
197}
198
199/*
200 * Extract board revision directly from OFW device tree.
201 * We can't use olpc_platform_info because that hasn't been set up yet.
202 */
203static u32 __init olpc_dt_get_board_revision(void)
204{
205 phandle node;
206 __be32 rev;
207 int r;
208
209 node = olpc_dt_finddevice("/");
210 if (!node)
211 return 0;
212
213 r = olpc_dt_getproperty(node, "board-revision-int",
214 (char *) &rev, sizeof(rev));
215 if (r < 0)
216 return 0;
217
218 return be32_to_cpu(rev);
219}
220
221void __init olpc_dt_fixup(void)
222{
223 int r;
224 char buf[64];
225 phandle node;
226 u32 board_rev;
227
228 node = olpc_dt_finddevice("/battery@0");
229 if (!node)
230 return;
231
232 /*
233 * If the battery node has a compatible property, we are running a new
234 * enough firmware and don't have fixups to make.
235 */
236 r = olpc_dt_getproperty(node, "compatible", buf, sizeof(buf));
237 if (r > 0)
238 return;
239
240 pr_info("PROM DT: Old firmware detected, applying fixes\n");
241
242 /* Add olpc,xo1-battery compatible marker to battery node */
243 olpc_dt_interpret("\" /battery@0\" find-device"
244 " \" olpc,xo1-battery\" +compatible"
245 " device-end");
246
247 board_rev = olpc_dt_get_board_revision();
248 if (!board_rev)
249 return;
250
251 if (board_rev >= olpc_board_pre(0xd0)) {
252 /* XO-1.5: add dcon device */
253 olpc_dt_interpret("\" /pci/display@1\" find-device"
254 " new-device"
255 " \" dcon\" device-name \" olpc,xo1-dcon\" +compatible"
256 " finish-device device-end");
257 } else {
258 /* XO-1: add dcon device, mark RTC as olpc,xo1-rtc */
259 olpc_dt_interpret("\" /pci/display@1,1\" find-device"
260 " new-device"
261 " \" dcon\" device-name \" olpc,xo1-dcon\" +compatible"
262 " finish-device device-end"
263 " \" /rtc\" find-device"
264 " \" olpc,xo1-rtc\" +compatible"
265 " device-end");
266 }
267}
268
168void __init olpc_dt_build_devicetree(void) 269void __init olpc_dt_build_devicetree(void)
169{ 270{
170 phandle root; 271 phandle root;
@@ -172,6 +273,8 @@ void __init olpc_dt_build_devicetree(void)
172 if (!olpc_ofw_is_installed()) 273 if (!olpc_ofw_is_installed())
173 return; 274 return;
174 275
276 olpc_dt_fixup();
277
175 root = olpc_dt_getsibling(0); 278 root = olpc_dt_getsibling(0);
176 if (!root) { 279 if (!root) {
177 pr_err("PROM: unable to get root node from OFW!\n"); 280 pr_err("PROM: unable to get root node from OFW!\n");
diff --git a/arch/x86/platform/olpc/xo1-wakeup.S b/arch/x86/platform/olpc/xo1-wakeup.S
new file mode 100644
index 00000000000..948deb28975
--- /dev/null
+++ b/arch/x86/platform/olpc/xo1-wakeup.S
@@ -0,0 +1,124 @@
1.text
2#include <linux/linkage.h>
3#include <asm/segment.h>
4#include <asm/page.h>
5#include <asm/pgtable_32.h>
6
7 .macro writepost,value
8 movb $0x34, %al
9 outb %al, $0x70
10 movb $\value, %al
11 outb %al, $0x71
12 .endm
13
14wakeup_start:
15 # OFW lands us here, running in protected mode, with a
16 # kernel-compatible GDT already setup.
17
18 # Clear any dangerous flags
19 pushl $0
20 popfl
21
22 writepost 0x31
23
24 # Set up %cr3
25 movl $initial_page_table - __PAGE_OFFSET, %eax
26 movl %eax, %cr3
27
28 movl saved_cr4, %eax
29 movl %eax, %cr4
30
31 movl saved_cr0, %eax
32 movl %eax, %cr0
33
34 # Control registers were modified, pipeline resync is needed
35 jmp 1f
361:
37
38 movw $__KERNEL_DS, %ax
39 movw %ax, %ss
40 movw %ax, %ds
41 movw %ax, %es
42 movw %ax, %fs
43 movw %ax, %gs
44
45 lgdt saved_gdt
46 lidt saved_idt
47 lldt saved_ldt
48 ljmp $(__KERNEL_CS),$1f
491:
50 movl %cr3, %eax
51 movl %eax, %cr3
52 wbinvd
53
54 # Go back to the return point
55 jmp ret_point
56
57save_registers:
58 sgdt saved_gdt
59 sidt saved_idt
60 sldt saved_ldt
61
62 pushl %edx
63 movl %cr4, %edx
64 movl %edx, saved_cr4
65
66 movl %cr0, %edx
67 movl %edx, saved_cr0
68
69 popl %edx
70
71 movl %ebx, saved_context_ebx
72 movl %ebp, saved_context_ebp
73 movl %esi, saved_context_esi
74 movl %edi, saved_context_edi
75
76 pushfl
77 popl saved_context_eflags
78
79 ret
80
81restore_registers:
82 movl saved_context_ebp, %ebp
83 movl saved_context_ebx, %ebx
84 movl saved_context_esi, %esi
85 movl saved_context_edi, %edi
86
87 pushl saved_context_eflags
88 popfl
89
90 ret
91
92ENTRY(do_olpc_suspend_lowlevel)
93 call save_processor_state
94 call save_registers
95
96 # This is the stack context we want to remember
97 movl %esp, saved_context_esp
98
99 pushl $3
100 call xo1_do_sleep
101
102 jmp wakeup_start
103 .p2align 4,,7
104ret_point:
105 movl saved_context_esp, %esp
106
107 writepost 0x32
108
109 call restore_registers
110 call restore_processor_state
111 ret
112
113.data
114saved_gdt: .long 0,0
115saved_idt: .long 0,0
116saved_ldt: .long 0
117saved_cr4: .long 0
118saved_cr0: .long 0
119saved_context_esp: .long 0
120saved_context_edi: .long 0
121saved_context_esi: .long 0
122saved_context_ebx: .long 0
123saved_context_ebp: .long 0
124saved_context_eflags: .long 0
diff --git a/arch/x86/vdso/vdso.S b/arch/x86/vdso/vdso.S
index 1b979c12ba8..01f5e3b4613 100644
--- a/arch/x86/vdso/vdso.S
+++ b/arch/x86/vdso/vdso.S
@@ -9,6 +9,7 @@ __PAGE_ALIGNED_DATA
9vdso_start: 9vdso_start:
10 .incbin "arch/x86/vdso/vdso.so" 10 .incbin "arch/x86/vdso/vdso.so"
11vdso_end: 11vdso_end:
12 .align PAGE_SIZE /* extra data here leaks to userspace. */
12 13
13.previous 14.previous
14 15
diff --git a/arch/x86/vdso/vdso32/sysenter.S b/arch/x86/vdso/vdso32/sysenter.S
index e2800affa75..e354bceee0e 100644
--- a/arch/x86/vdso/vdso32/sysenter.S
+++ b/arch/x86/vdso/vdso32/sysenter.S
@@ -43,7 +43,7 @@ __kernel_vsyscall:
43 .space 7,0x90 43 .space 7,0x90
44 44
45 /* 14: System call restart point is here! (SYSENTER_RETURN-2) */ 45 /* 14: System call restart point is here! (SYSENTER_RETURN-2) */
46 jmp .Lenter_kernel 46 int $0x80
47 /* 16: System call normal return point is here! */ 47 /* 16: System call normal return point is here! */
48VDSO32_SYSENTER_RETURN: /* Symbol used by sysenter.c via vdso32-syms.h */ 48VDSO32_SYSENTER_RETURN: /* Symbol used by sysenter.c via vdso32-syms.h */
49 pop %ebp 49 pop %ebp
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index ccf73b2f3e6..add2c2d729c 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -13,7 +13,9 @@ CFLAGS_mmu.o := $(nostackp)
13obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ 13obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
14 time.o xen-asm.o xen-asm_$(BITS).o \ 14 time.o xen-asm.o xen-asm_$(BITS).o \
15 grant-table.o suspend.o platform-pci-unplug.o \ 15 grant-table.o suspend.o platform-pci-unplug.o \
16 p2m.o trace.o 16 p2m.o
17
18obj-$(CONFIG_EVENT_TRACING) += trace.o
17 19
18obj-$(CONFIG_SMP) += smp.o 20obj-$(CONFIG_SMP) += smp.o
19obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o 21obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 974a528458a..2d69617950f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL_GPL(xen_domain_type);
77 77
78unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START; 78unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START;
79EXPORT_SYMBOL(machine_to_phys_mapping); 79EXPORT_SYMBOL(machine_to_phys_mapping);
80unsigned int machine_to_phys_order; 80unsigned long machine_to_phys_nr;
81EXPORT_SYMBOL(machine_to_phys_order); 81EXPORT_SYMBOL(machine_to_phys_nr);
82 82
83struct start_info *xen_start_info; 83struct start_info *xen_start_info;
84EXPORT_SYMBOL_GPL(xen_start_info); 84EXPORT_SYMBOL_GPL(xen_start_info);
@@ -951,6 +951,10 @@ static const struct pv_info xen_info __initconst = {
951 .paravirt_enabled = 1, 951 .paravirt_enabled = 1,
952 .shared_kernel_pmd = 0, 952 .shared_kernel_pmd = 0,
953 953
954#ifdef CONFIG_X86_64
955 .extra_user_64bit_cs = FLAT_USER_CS64,
956#endif
957
954 .name = "Xen", 958 .name = "Xen",
955}; 959};
956 960
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index f987bde77c4..20a61427506 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1713,15 +1713,19 @@ static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
1713void __init xen_setup_machphys_mapping(void) 1713void __init xen_setup_machphys_mapping(void)
1714{ 1714{
1715 struct xen_machphys_mapping mapping; 1715 struct xen_machphys_mapping mapping;
1716 unsigned long machine_to_phys_nr_ents;
1717 1716
1718 if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) { 1717 if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
1719 machine_to_phys_mapping = (unsigned long *)mapping.v_start; 1718 machine_to_phys_mapping = (unsigned long *)mapping.v_start;
1720 machine_to_phys_nr_ents = mapping.max_mfn + 1; 1719 machine_to_phys_nr = mapping.max_mfn + 1;
1721 } else { 1720 } else {
1722 machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES; 1721 machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
1723 } 1722 }
1724 machine_to_phys_order = fls(machine_to_phys_nr_ents - 1); 1723#ifdef CONFIG_X86_32
1724 if ((machine_to_phys_mapping + machine_to_phys_nr)
1725 < machine_to_phys_mapping)
1726 machine_to_phys_nr = (unsigned long *)NULL
1727 - machine_to_phys_mapping;
1728#endif
1725} 1729}
1726 1730
1727#ifdef CONFIG_X86_64 1731#ifdef CONFIG_X86_64
@@ -1916,6 +1920,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
1916# endif 1920# endif
1917#else 1921#else
1918 case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE: 1922 case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE:
1923 case VVAR_PAGE:
1919#endif 1924#endif
1920 case FIX_TEXT_POKE0: 1925 case FIX_TEXT_POKE0:
1921 case FIX_TEXT_POKE1: 1926 case FIX_TEXT_POKE1:
@@ -1956,7 +1961,8 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
1956#ifdef CONFIG_X86_64 1961#ifdef CONFIG_X86_64
1957 /* Replicate changes to map the vsyscall page into the user 1962 /* Replicate changes to map the vsyscall page into the user
1958 pagetable vsyscall mapping. */ 1963 pagetable vsyscall mapping. */
1959 if (idx >= VSYSCALL_LAST_PAGE && idx <= VSYSCALL_FIRST_PAGE) { 1964 if ((idx >= VSYSCALL_LAST_PAGE && idx <= VSYSCALL_FIRST_PAGE) ||
1965 idx == VVAR_PAGE) {
1960 unsigned long vaddr = __fix_to_virt(idx); 1966 unsigned long vaddr = __fix_to_virt(idx);
1961 set_pte_vaddr_pud(level3_user_vsyscall, vaddr, pte); 1967 set_pte_vaddr_pud(level3_user_vsyscall, vaddr, pte);
1962 } 1968 }
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 60aeeb56948..c3b8d440873 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -9,6 +9,7 @@
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/pm.h> 10#include <linux/pm.h>
11#include <linux/memblock.h> 11#include <linux/memblock.h>
12#include <linux/cpuidle.h>
12 13
13#include <asm/elf.h> 14#include <asm/elf.h>
14#include <asm/vdso.h> 15#include <asm/vdso.h>
@@ -92,8 +93,6 @@ static unsigned long __init xen_release_chunk(phys_addr_t start_addr,
92 if (end <= start) 93 if (end <= start)
93 return 0; 94 return 0;
94 95
95 printk(KERN_INFO "xen_release_chunk: looking at area pfn %lx-%lx: ",
96 start, end);
97 for(pfn = start; pfn < end; pfn++) { 96 for(pfn = start; pfn < end; pfn++) {
98 unsigned long mfn = pfn_to_mfn(pfn); 97 unsigned long mfn = pfn_to_mfn(pfn);
99 98
@@ -106,14 +105,14 @@ static unsigned long __init xen_release_chunk(phys_addr_t start_addr,
106 105
107 ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, 106 ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
108 &reservation); 107 &reservation);
109 WARN(ret != 1, "Failed to release memory %lx-%lx err=%d\n", 108 WARN(ret != 1, "Failed to release pfn %lx err=%d\n", pfn, ret);
110 start, end, ret);
111 if (ret == 1) { 109 if (ret == 1) {
112 __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); 110 __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
113 len++; 111 len++;
114 } 112 }
115 } 113 }
116 printk(KERN_CONT "%ld pages freed\n", len); 114 printk(KERN_INFO "Freeing %lx-%lx pfn range: %lu pages freed\n",
115 start, end, len);
117 116
118 return len; 117 return len;
119} 118}
@@ -139,7 +138,7 @@ static unsigned long __init xen_return_unused_memory(unsigned long max_pfn,
139 if (last_end < max_addr) 138 if (last_end < max_addr)
140 released += xen_release_chunk(last_end, max_addr); 139 released += xen_release_chunk(last_end, max_addr);
141 140
142 printk(KERN_INFO "released %ld pages of unused memory\n", released); 141 printk(KERN_INFO "released %lu pages of unused memory\n", released);
143 return released; 142 return released;
144} 143}
145 144
@@ -185,6 +184,19 @@ static unsigned long __init xen_set_identity(const struct e820entry *list,
185 PFN_UP(start_pci), PFN_DOWN(last)); 184 PFN_UP(start_pci), PFN_DOWN(last));
186 return identity; 185 return identity;
187} 186}
187
188static unsigned long __init xen_get_max_pages(void)
189{
190 unsigned long max_pages = MAX_DOMAIN_PAGES;
191 domid_t domid = DOMID_SELF;
192 int ret;
193
194 ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
195 if (ret > 0)
196 max_pages = ret;
197 return min(max_pages, MAX_DOMAIN_PAGES);
198}
199
188/** 200/**
189 * machine_specific_memory_setup - Hook for machine specific memory setup. 201 * machine_specific_memory_setup - Hook for machine specific memory setup.
190 **/ 202 **/
@@ -293,6 +305,12 @@ char * __init xen_memory_setup(void)
293 305
294 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 306 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
295 307
308 extra_limit = xen_get_max_pages();
309 if (extra_limit >= max_pfn)
310 extra_pages = extra_limit - max_pfn;
311 else
312 extra_pages = 0;
313
296 extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); 314 extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820);
297 315
298 /* 316 /*
@@ -426,7 +444,7 @@ void __init xen_arch_setup(void)
426#ifdef CONFIG_X86_32 444#ifdef CONFIG_X86_32
427 boot_cpu_data.hlt_works_ok = 1; 445 boot_cpu_data.hlt_works_ok = 1;
428#endif 446#endif
429 pm_idle = default_idle; 447 disable_cpuidle();
430 boot_option_idle_override = IDLE_HALT; 448 boot_option_idle_override = IDLE_HALT;
431 449
432 fiddle_vdso(); 450 fiddle_vdso();
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index b4533a86d7e..d4fc6d454f8 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -32,6 +32,7 @@
32#include <xen/page.h> 32#include <xen/page.h>
33#include <xen/events.h> 33#include <xen/events.h>
34 34
35#include <xen/hvc-console.h>
35#include "xen-ops.h" 36#include "xen-ops.h"
36#include "mmu.h" 37#include "mmu.h"
37 38
@@ -207,6 +208,15 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
207 unsigned cpu; 208 unsigned cpu;
208 unsigned int i; 209 unsigned int i;
209 210
211 if (skip_ioapic_setup) {
212 char *m = (max_cpus == 0) ?
213 "The nosmp parameter is incompatible with Xen; " \
214 "use Xen dom0_max_vcpus=1 parameter" :
215 "The noapic parameter is incompatible with Xen";
216
217 xen_raw_printk(m);
218 panic(m);
219 }
210 xen_init_lock_cpu(0); 220 xen_init_lock_cpu(0);
211 221
212 smp_store_cpu_info(0); 222 smp_store_cpu_info(0);
@@ -521,8 +531,6 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
521 native_smp_prepare_cpus(max_cpus); 531 native_smp_prepare_cpus(max_cpus);
522 WARN_ON(xen_smp_intr_init(0)); 532 WARN_ON(xen_smp_intr_init(0));
523 533
524 if (!xen_have_vector_callback)
525 return;
526 xen_init_lock_cpu(0); 534 xen_init_lock_cpu(0);
527 xen_init_spinlocks(); 535 xen_init_spinlocks();
528} 536}
@@ -546,6 +554,8 @@ static void xen_hvm_cpu_die(unsigned int cpu)
546 554
547void __init xen_hvm_smp_init(void) 555void __init xen_hvm_smp_init(void)
548{ 556{
557 if (!xen_have_vector_callback)
558 return;
549 smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus; 559 smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
550 smp_ops.smp_send_reschedule = xen_smp_send_reschedule; 560 smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
551 smp_ops.cpu_up = xen_hvm_cpu_up; 561 smp_ops.cpu_up = xen_hvm_cpu_up;
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 5158c505bef..163b4679556 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -168,9 +168,10 @@ cycle_t xen_clocksource_read(void)
168 struct pvclock_vcpu_time_info *src; 168 struct pvclock_vcpu_time_info *src;
169 cycle_t ret; 169 cycle_t ret;
170 170
171 src = &get_cpu_var(xen_vcpu)->time; 171 preempt_disable_notrace();
172 src = &__get_cpu_var(xen_vcpu)->time;
172 ret = pvclock_clocksource_read(src); 173 ret = pvclock_clocksource_read(src);
173 put_cpu_var(xen_vcpu); 174 preempt_enable_notrace();
174 return ret; 175 return ret;
175} 176}
176 177
diff --git a/arch/x86/xen/trace.c b/arch/x86/xen/trace.c
index 734beba2a08..520022d1a18 100644
--- a/arch/x86/xen/trace.c
+++ b/arch/x86/xen/trace.c
@@ -1,4 +1,5 @@
1#include <linux/ftrace.h> 1#include <linux/ftrace.h>
2#include <xen/interface/xen.h>
2 3
3#define N(x) [__HYPERVISOR_##x] = "("#x")" 4#define N(x) [__HYPERVISOR_##x] = "("#x")"
4static const char *xen_hypercall_names[] = { 5static const char *xen_hypercall_names[] = {
diff --git a/arch/x86/xen/xen-asm_32.S b/arch/x86/xen/xen-asm_32.S
index 22a2093b586..b040b0e518c 100644
--- a/arch/x86/xen/xen-asm_32.S
+++ b/arch/x86/xen/xen-asm_32.S
@@ -113,11 +113,13 @@ xen_iret_start_crit:
113 113
114 /* 114 /*
115 * If there's something pending, mask events again so we can 115 * If there's something pending, mask events again so we can
116 * jump back into xen_hypervisor_callback 116 * jump back into xen_hypervisor_callback. Otherwise do not
117 * touch XEN_vcpu_info_mask.
117 */ 118 */
118 sete XEN_vcpu_info_mask(%eax) 119 jne 1f
120 movb $1, XEN_vcpu_info_mask(%eax)
119 121
120 popl %eax 1221: popl %eax
121 123
122 /* 124 /*
123 * From this point on the registers are restored and the stack 125 * From this point on the registers are restored and the stack
diff --git a/arch/xtensa/include/asm/atomic.h b/arch/xtensa/include/asm/atomic.h
index a96a0619d0b..23592eff67a 100644
--- a/arch/xtensa/include/asm/atomic.h
+++ b/arch/xtensa/include/asm/atomic.h
@@ -225,15 +225,15 @@ static inline int atomic_sub_return(int i, atomic_t * v)
225#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 225#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
226 226
227/** 227/**
228 * atomic_add_unless - add unless the number is a given value 228 * __atomic_add_unless - add unless the number is a given value
229 * @v: pointer of type atomic_t 229 * @v: pointer of type atomic_t
230 * @a: the amount to add to v... 230 * @a: the amount to add to v...
231 * @u: ...unless v is equal to u. 231 * @u: ...unless v is equal to u.
232 * 232 *
233 * Atomically adds @a to @v, so long as it was not @u. 233 * Atomically adds @a to @v, so long as it was not @u.
234 * Returns non-zero if @v was not @u, and zero otherwise. 234 * Returns the old value of @v.
235 */ 235 */
236static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 236static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
237{ 237{
238 int c, old; 238 int c, old;
239 c = atomic_read(v); 239 c = atomic_read(v);
@@ -245,10 +245,9 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
245 break; 245 break;
246 c = old; 246 c = old;
247 } 247 }
248 return c != (u); 248 return c;
249} 249}
250 250
251#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
252 251
253static inline void atomic_clear_mask(unsigned int mask, atomic_t *v) 252static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
254{ 253{
@@ -292,7 +291,6 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
292#define smp_mb__before_atomic_inc() barrier() 291#define smp_mb__before_atomic_inc() barrier()
293#define smp_mb__after_atomic_inc() barrier() 292#define smp_mb__after_atomic_inc() barrier()
294 293
295#include <asm-generic/atomic-long.h>
296#endif /* __KERNEL__ */ 294#endif /* __KERNEL__ */
297 295
298#endif /* _XTENSA_ATOMIC_H */ 296#endif /* _XTENSA_ATOMIC_H */
diff --git a/arch/xtensa/include/asm/bitops.h b/arch/xtensa/include/asm/bitops.h
index c8fac8d8190..40aa7fe77f6 100644
--- a/arch/xtensa/include/asm/bitops.h
+++ b/arch/xtensa/include/asm/bitops.h
@@ -108,19 +108,7 @@ static inline unsigned long __fls(unsigned long word)
108#include <asm-generic/bitops/find.h> 108#include <asm-generic/bitops/find.h>
109#include <asm-generic/bitops/le.h> 109#include <asm-generic/bitops/le.h>
110 110
111#ifdef __XTENSA_EL__ 111#include <asm-generic/bitops/ext2-atomic-setbit.h>
112# define ext2_set_bit_atomic(lock,nr,addr) \
113 test_and_set_bit((nr), (unsigned long*)(addr))
114# define ext2_clear_bit_atomic(lock,nr,addr) \
115 test_and_clear_bit((nr), (unsigned long*)(addr))
116#elif defined(__XTENSA_EB__)
117# define ext2_set_bit_atomic(lock,nr,addr) \
118 test_and_set_bit((nr) ^ 0x18, (unsigned long*)(addr))
119# define ext2_clear_bit_atomic(lock,nr,addr) \
120 test_and_clear_bit((nr) ^ 0x18, (unsigned long*)(addr))
121#else
122# error processor byte order undefined!
123#endif
124 112
125#include <asm-generic/bitops/hweight.h> 113#include <asm-generic/bitops/hweight.h>
126#include <asm-generic/bitops/lock.h> 114#include <asm-generic/bitops/lock.h>
diff --git a/arch/xtensa/include/asm/posix_types.h b/arch/xtensa/include/asm/posix_types.h
index 43f9dd1126a..6b2190c3588 100644
--- a/arch/xtensa/include/asm/posix_types.h
+++ b/arch/xtensa/include/asm/posix_types.h
@@ -58,7 +58,7 @@ typedef struct {
58 58
59#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) 59#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
60#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) 60#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
61#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) 61#define __FD_ISSET(d, set) (!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d)))
62#define __FD_ZERO(set) \ 62#define __FD_ZERO(set) \
63 ((void) memset ((void *) (set), 0, sizeof (__kernel_fd_set))) 63 ((void) memset ((void *) (set), 0, sizeof (__kernel_fd_set)))
64 64
diff --git a/arch/xtensa/include/asm/ptrace.h b/arch/xtensa/include/asm/ptrace.h
index 0d42c934b66..d85d38da8ee 100644
--- a/arch/xtensa/include/asm/ptrace.h
+++ b/arch/xtensa/include/asm/ptrace.h
@@ -120,7 +120,6 @@ struct pt_regs {
120 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1) 120 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
121# define user_mode(regs) (((regs)->ps & 0x00000020)!=0) 121# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
122# define instruction_pointer(regs) ((regs)->pc) 122# define instruction_pointer(regs) ((regs)->pc)
123extern void show_regs(struct pt_regs *);
124 123
125# ifndef CONFIG_SMP 124# ifndef CONFIG_SMP
126# define profile_pc(regs) instruction_pointer(regs) 125# define profile_pc(regs) instruction_pointer(regs)
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
index a6f934f37f1..798ee6d285a 100644
--- a/arch/xtensa/include/asm/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
@@ -455,7 +455,7 @@ __SYSCALL(203, sys_reboot, 3)
455#define __NR_quotactl 204 455#define __NR_quotactl 204
456__SYSCALL(204, sys_quotactl, 4) 456__SYSCALL(204, sys_quotactl, 4)
457#define __NR_nfsservctl 205 457#define __NR_nfsservctl 205
458__SYSCALL(205, sys_nfsservctl, 3) 458__SYSCALL(205, sys_ni_syscall, 0)
459#define __NR__sysctl 206 459#define __NR__sysctl 206
460__SYSCALL(206, sys_sysctl, 1) 460__SYSCALL(206, sys_sysctl, 1)
461#define __NR_bdflush 207 461#define __NR_bdflush 207
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index e3558b9a58b..47041e7c088 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -40,7 +40,7 @@
40#include <asm/platform.h> 40#include <asm/platform.h>
41#include <asm/mmu.h> 41#include <asm/mmu.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/atomic.h> 43#include <linux/atomic.h>
44#include <asm/asm-offsets.h> 44#include <asm/asm-offsets.h>
45#include <asm/regs.h> 45#include <asm/regs.h>
46 46