aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arc/include/asm/cache.h4
-rw-r--r--arch/arc/include/uapi/asm/ptrace.h1
-rw-r--r--arch/arc/kernel/ctx_sw_asm.S2
-rw-r--r--arch/arc/kernel/devtree.c2
-rw-r--r--arch/arc/kernel/head.S7
-rw-r--r--arch/arc/kernel/ptrace.c4
-rw-r--r--arch/arc/kernel/smp.c15
-rw-r--r--arch/arc/kernel/vmlinux.lds.S2
-rw-r--r--arch/arc/mm/cache_arc700.c25
-rw-r--r--arch/arm/Kconfig72
-rw-r--r--arch/arm/Kconfig.debug1
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/boot/dts/Makefile2
-rw-r--r--arch/arm/boot/dts/am43x-epos-evm.dts4
-rw-r--r--arch/arm/boot/dts/armada-375-db.dts2
-rw-r--r--arch/arm/boot/dts/armada-380.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-385-db.dts4
-rw-r--r--arch/arm/boot/dts/armada-385-rd.dts2
-rw-r--r--arch/arm/boot/dts/armada-385.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-38x.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts2
-rw-r--r--arch/arm/boot/dts/at91sam9261.dtsi21
-rw-r--r--arch/arm/boot/dts/at91sam9261ek.dts4
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi4
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi4
-rw-r--r--arch/arm/boot/dts/dra7.dtsi12
-rw-r--r--arch/arm/boot/dts/dra7xx-clocks.dtsi16
-rw-r--r--arch/arm/boot/dts/emev2.dtsi2
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi2
-rw-r--r--arch/arm/boot/dts/imx51-babbage.dts10
-rw-r--r--arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts4
-rw-r--r--arch/arm/boot/dts/imx53-m53evk.dts40
-rw-r--r--arch/arm/boot/dts/imx6dl-hummingboard.dts10
-rw-r--r--arch/arm/boot/dts/imx6q-gw51xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6qdl-cubox-i.dtsi27
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw51xx.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw52xx.dtsi4
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw53xx.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-microsom.dtsi13
-rw-r--r--arch/arm/boot/dts/imx6sl.dtsi2
-rw-r--r--arch/arm/boot/dts/integratorap.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts4
-rw-r--r--arch/arm/boot/dts/omap3-beagle-xm.dts6
-rw-r--r--arch/arm/boot/dts/omap3-evm-common.dtsi7
-rw-r--r--arch/arm/boot/dts/omap3-n900.dts5
-rw-r--r--arch/arm/boot/dts/omap5.dtsi1
-rw-r--r--arch/arm/boot/dts/r7s72100.dtsi1
-rw-r--r--arch/arm/boot/dts/stih415.dtsi8
-rw-r--r--arch/arm/boot/dts/stih416-b2020e.dts (renamed from arch/arm/boot/dts/stih416-b2020-revE.dts)0
-rw-r--r--arch/arm/boot/dts/stih416.dtsi8
-rw-r--r--arch/arm/common/scoop.c1
-rw-r--r--arch/arm/configs/bcm_defconfig2
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig1
-rw-r--r--arch/arm/configs/multi_v7_defconfig5
-rw-r--r--arch/arm/configs/mvebu_v7_defconfig2
-rw-r--r--arch/arm/configs/omap2plus_defconfig1
-rw-r--r--arch/arm/configs/s5p64x0_defconfig68
-rw-r--r--arch/arm/configs/s5pc100_defconfig49
-rw-r--r--arch/arm/include/asm/ftrace.h2
-rw-r--r--arch/arm/include/asm/gpio.h7
-rw-r--r--arch/arm/include/asm/mcpm.h2
-rw-r--r--arch/arm/include/asm/thread_info.h6
-rw-r--r--arch/arm/include/debug/clps711x.S38
-rw-r--r--arch/arm/kernel/perf_event_v7.c4
-rw-r--r--arch/arm/kernel/ptrace.c7
-rw-r--r--arch/arm/mach-bcm/Kconfig7
-rw-r--r--arch/arm/mach-berlin/Kconfig6
-rw-r--r--arch/arm/mach-clps711x/board-autcpu12.c1
-rw-r--r--arch/arm/mach-clps711x/board-cdb89712.c1
-rw-r--r--arch/arm/mach-clps711x/board-clep7312.c3
-rw-r--r--arch/arm/mach-clps711x/board-edb7211.c8
-rw-r--r--arch/arm/mach-clps711x/board-p720t.c1
-rw-r--r--arch/arm/mach-clps711x/common.c12
-rw-r--r--arch/arm/mach-clps711x/common.h1
-rw-r--r--arch/arm/mach-clps711x/devices.c10
-rw-r--r--arch/arm/mach-clps711x/include/mach/debug-macro.S38
-rw-r--r--arch/arm/mach-clps711x/include/mach/hardware.h5
-rw-r--r--arch/arm/mach-cns3xxx/Kconfig7
-rw-r--r--arch/arm/mach-davinci/Kconfig1
-rw-r--r--arch/arm/mach-exynos/Kconfig7
-rw-r--r--arch/arm/mach-exynos/common.h1
-rw-r--r--arch/arm/mach-exynos/exynos.c31
-rw-r--r--arch/arm/mach-exynos/hotplug.c8
-rw-r--r--arch/arm/mach-exynos/mcpm-exynos.c11
-rw-r--r--arch/arm/mach-exynos/platsmp.c26
-rw-r--r--arch/arm/mach-exynos/pm.c15
-rw-r--r--arch/arm/mach-highbank/Kconfig1
-rw-r--r--arch/arm/mach-imx/Kconfig22
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c1
-rw-r--r--arch/arm/mach-integrator/Kconfig3
-rw-r--r--arch/arm/mach-integrator/impd1.c12
-rw-r--r--arch/arm/mach-integrator/include/mach/memory.h34
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c26
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c26
-rw-r--r--arch/arm/mach-keystone/Kconfig1
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-pxa910.h1
-rw-r--r--arch/arm/mach-moxart/Kconfig2
-rw-r--r--arch/arm/mach-mvebu/Kconfig9
-rw-r--r--arch/arm/mach-mvebu/Makefile2
-rw-r--r--arch/arm/mach-mvebu/board-v7.c29
-rw-r--r--arch/arm/mach-mvebu/pmsu.c9
-rw-r--r--arch/arm/mach-mvebu/pmsu_ll.S25
-rw-r--r--arch/arm/mach-nomadik/Kconfig4
-rw-r--r--arch/arm/mach-omap2/Kconfig11
-rw-r--r--arch/arm/mach-omap2/Makefile6
-rw-r--r--arch/arm/mach-omap2/cm33xx.h2
-rw-r--r--arch/arm/mach-omap2/common.h8
-rw-r--r--arch/arm/mach-omap2/id.c12
-rw-r--r--arch/arm/mach-omap2/mux.c6
-rw-r--r--arch/arm/mach-omap2/omap4-common.c20
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c73
-rw-r--r--arch/arm/mach-omap2/soc.h1
-rw-r--r--arch/arm/mach-prima2/Kconfig6
-rw-r--r--arch/arm/mach-pxa/corgi.c2
-rw-r--r--arch/arm/mach-pxa/generic.c12
-rw-r--r--arch/arm/mach-pxa/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-pxa/pxa25x.c7
-rw-r--r--arch/arm/mach-pxa/pxa27x.c10
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-pxa/sleep.S2
-rw-r--r--arch/arm/mach-qcom/Kconfig6
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig2
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig4
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig100
-rw-r--r--arch/arm/mach-s5p64x0/Makefile36
-rw-r--r--arch/arm/mach-s5p64x0/Makefile.boot2
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c632
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c701
-rw-r--r--arch/arm/mach-s5p64x0/clock.c236
-rw-r--r--arch/arm/mach-s5p64x0/clock.h38
-rw-r--r--arch/arm/mach-s5p64x0/common.c490
-rw-r--r--arch/arm/mach-s5p64x0/common.h56
-rw-r--r--arch/arm/mach-s5p64x0/dev-audio.c176
-rw-r--r--arch/arm/mach-s5p64x0/dma.c128
-rw-r--r--arch/arm/mach-s5p64x0/i2c.h16
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/debug-macro.S32
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/dma.h26
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/gpio.h132
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/hardware.h18
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/irqs.h148
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/map.h96
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/pm-core.h119
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-clock.h98
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-gpio.h68
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-irq.h18
-rw-r--r--arch/arm/mach-s5p64x0/irq-pm.c98
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6440.c280
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6450.c299
-rw-r--r--arch/arm/mach-s5p64x0/pm.c202
-rw-r--r--arch/arm/mach-s5p64x0/setup-fb-24bpp.c29
-rw-r--r--arch/arm/mach-s5p64x0/setup-i2c0.c38
-rw-r--r--arch/arm/mach-s5p64x0/setup-i2c1.c38
-rw-r--r--arch/arm/mach-s5p64x0/setup-sdhci-gpio.c104
-rw-r--r--arch/arm/mach-s5p64x0/setup-spi.c38
-rw-r--r--arch/arm/mach-s5pc100/Kconfig80
-rw-r--r--arch/arm/mach-s5pc100/Makefile32
-rw-r--r--arch/arm/mach-s5pc100/Makefile.boot2
-rw-r--r--arch/arm/mach-s5pc100/clock.c1361
-rw-r--r--arch/arm/mach-s5pc100/common.c255
-rw-r--r--arch/arm/mach-s5pc100/common.h30
-rw-r--r--arch/arm/mach-s5pc100/dev-audio.c239
-rw-r--r--arch/arm/mach-s5pc100/dma.c130
-rw-r--r--arch/arm/mach-s5pc100/include/mach/debug-macro.S39
-rw-r--r--arch/arm/mach-s5pc100/include/mach/dma.h26
-rw-r--r--arch/arm/mach-s5pc100/include/mach/entry-macro.S19
-rw-r--r--arch/arm/mach-s5pc100/include/mach/gpio.h144
-rw-r--r--arch/arm/mach-s5pc100/include/mach/hardware.h14
-rw-r--r--arch/arm/mach-s5pc100/include/mach/irqs.h115
-rw-r--r--arch/arm/mach-s5pc100/include/mach/map.h137
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-clock.h80
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-gpio.h38
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-irq.h18
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c264
-rw-r--r--arch/arm/mach-s5pc100/setup-fb-24bpp.c35
-rw-r--r--arch/arm/mach-s5pc100/setup-i2c0.c28
-rw-r--r--arch/arm/mach-s5pc100/setup-i2c1.c28
-rw-r--r--arch/arm/mach-s5pc100/setup-ide.c57
-rw-r--r--arch/arm/mach-s5pc100/setup-keypad.c23
-rw-r--r--arch/arm/mach-s5pc100/setup-sdhci-gpio.c70
-rw-r--r--arch/arm/mach-s5pc100/setup-spi.c41
-rw-r--r--arch/arm/mach-s5pv210/Kconfig3
-rw-r--r--arch/arm/mach-s5pv210/dev-audio.c2
-rw-r--r--arch/arm/mach-s5pv210/include/mach/gpio-samsung.h (renamed from arch/arm/mach-s5pv210/include/mach/gpio.h)7
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c1
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c1
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c1
-rw-r--r--arch/arm/mach-s5pv210/setup-fb-24bpp.c2
-rw-r--r--arch/arm/mach-s5pv210/setup-fimc.c3
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c0.c2
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c1.c2
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c2.c2
-rw-r--r--arch/arm/mach-s5pv210/setup-ide.c2
-rw-r--r--arch/arm/mach-s5pv210/setup-keypad.c2
-rw-r--r--arch/arm/mach-s5pv210/setup-sdhci-gpio.c2
-rw-r--r--arch/arm/mach-s5pv210/setup-spi.c2
-rw-r--r--arch/arm/mach-sa1100/collie.c7
-rw-r--r--arch/arm/mach-shmobile/Kconfig6
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm-reference.c6
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c8
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva-reference.c6
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c8
-rw-r--r--arch/arm/mach-shmobile/board-bockw-reference.c6
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c8
-rw-r--r--arch/arm/mach-shmobile/board-genmai-reference.c10
-rw-r--r--arch/arm/mach-shmobile/board-genmai.c10
-rw-r--r--arch/arm/mach-shmobile/board-koelsch-reference.c8
-rw-r--r--arch/arm/mach-shmobile/board-koelsch.c6
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c6
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c8
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c14
-rw-r--r--arch/arm/mach-shmobile/board-lager.c21
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c12
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c4
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c5
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c7
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c8
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7791.c6
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c4
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c4
-rw-r--r--arch/arm/mach-shmobile/clock.c6
-rw-r--r--arch/arm/mach-shmobile/clock.h (renamed from arch/arm/mach-shmobile/include/mach/clock.h)0
-rw-r--r--arch/arm/mach-shmobile/common.h (renamed from arch/arm/mach-shmobile/include/mach/common.h)0
-rw-r--r--arch/arm/mach-shmobile/console.c2
-rw-r--r--arch/arm/mach-shmobile/dma-register.h (renamed from arch/arm/mach-shmobile/include/mach/dma-register.h)0
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h16
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h12
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c5
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c9
-rw-r--r--arch/arm/mach-shmobile/intc.h (renamed from arch/arm/mach-shmobile/include/mach/intc.h)0
-rw-r--r--arch/arm/mach-shmobile/irqs.h21
-rw-r--r--arch/arm/mach-shmobile/platsmp-apmu.c2
-rw-r--r--arch/arm/mach-shmobile/platsmp-scu.c2
-rw-r--r--arch/arm/mach-shmobile/platsmp.c2
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7740.c4
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7779.c15
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7790.c6
-rw-r--r--arch/arm/mach-shmobile/pm-rcar.c2
-rw-r--r--arch/arm/mach-shmobile/pm-rcar.h (renamed from arch/arm/mach-shmobile/include/mach/pm-rcar.h)0
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c2
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.h (renamed from arch/arm/mach-shmobile/include/mach/pm-rmobile.h)0
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c8
-rw-r--r--arch/arm/mach-shmobile/pm-sh73a0.c2
-rw-r--r--arch/arm/mach-shmobile/r7s72100.h (renamed from arch/arm/mach-shmobile/include/mach/r7s72100.h)1
-rw-r--r--arch/arm/mach-shmobile/r8a73a4.h (renamed from arch/arm/mach-shmobile/include/mach/r8a73a4.h)0
-rw-r--r--arch/arm/mach-shmobile/r8a7740.h (renamed from arch/arm/mach-shmobile/include/mach/r8a7740.h)2
-rw-r--r--arch/arm/mach-shmobile/r8a7778.h (renamed from arch/arm/mach-shmobile/include/mach/r8a7778.h)0
-rw-r--r--arch/arm/mach-shmobile/r8a7790.h (renamed from arch/arm/mach-shmobile/include/mach/r8a7790.h)3
-rw-r--r--arch/arm/mach-shmobile/rcar-gen2.h (renamed from arch/arm/mach-shmobile/include/mach/rcar-gen2.h)0
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c19
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c15
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c10
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c12
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c8
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c20
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c6
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c4
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c12
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c11
-rw-r--r--arch/arm/mach-shmobile/sh7372.h (renamed from arch/arm/mach-shmobile/include/mach/sh7372.h)4
-rw-r--r--arch/arm/mach-shmobile/sh73a0.h (renamed from arch/arm/mach-shmobile/include/mach/sh73a0.h)0
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c2
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7790.c8
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7791.c4
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c6
-rw-r--r--arch/arm/mach-spear/Kconfig1
-rw-r--r--arch/arm/mach-spear/spear1310.c2
-rw-r--r--arch/arm/mach-spear/spear1340.c6
-rw-r--r--arch/arm/mach-spear/spear13xx.c2
-rw-r--r--arch/arm/mach-sti/Kconfig6
-rw-r--r--arch/arm/mach-sti/platsmp.c6
-rw-r--r--arch/arm/mach-sunxi/sunxi.c77
-rw-r--r--arch/arm/mach-tegra/Kconfig8
-rw-r--r--arch/arm/mach-u300/Kconfig6
-rw-r--r--arch/arm/mach-ux500/Kconfig9
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c2
-rw-r--r--arch/arm/mach-ux500/cache-l2x0.c18
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c8
-rw-r--r--arch/arm/mach-ux500/cpu.c2
-rw-r--r--arch/arm/mach-ux500/timer.c2
-rw-r--r--arch/arm/mach-versatile/core.c2
-rw-r--r--arch/arm/mach-vexpress/Kconfig10
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c3
-rw-r--r--arch/arm/mach-vt8500/Kconfig1
-rw-r--r--arch/arm/mach-vt8500/vt8500.c6
-rw-r--r--arch/arm/mach-zynq/Kconfig1
-rw-r--r--arch/arm/mm/Kconfig9
-rw-r--r--arch/arm/mm/cache-l2x0.c31
-rw-r--r--arch/arm/mm/nommu.c1
-rw-r--r--arch/arm/mm/proc-arm925.S1
-rw-r--r--arch/arm/plat-samsung/Kconfig56
-rw-r--r--arch/arm/plat-samsung/adc.c2
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h29
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h17
-rw-r--r--arch/arm/plat-samsung/include/plat/fb.h14
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-core.h3
-rw-r--r--arch/arm/plat-samsung/include/plat/s5p-clock.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h77
-rw-r--r--arch/arm/plat-samsung/pm-gpio.c2
-rw-r--r--arch/arm/plat-samsung/s5p-irq-eint.c2
-rw-r--r--arch/arm/plat-versatile/Kconfig3
-rw-r--r--arch/arm/plat-versatile/Makefile1
-rw-r--r--arch/arm/plat-versatile/clcd.c182
-rw-r--r--arch/arm/plat-versatile/include/plat/clcd.h9
-rw-r--r--arch/arm64/Kconfig3
-rw-r--r--arch/arm64/boot/dts/apm-mustang.dts4
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi36
-rw-r--r--arch/arm64/configs/defconfig15
-rw-r--r--arch/arm64/crypto/ghash-ce-core.S92
-rw-r--r--arch/arm64/crypto/ghash-ce-glue.c5
-rw-r--r--arch/arm64/include/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/dma-mapping.h2
-rw-r--r--arch/arm64/include/asm/pgtable.h4
-rw-r--r--arch/arm64/include/asm/ptrace.h4
-rw-r--r--arch/arm64/include/uapi/asm/posix_types.h10
-rw-r--r--arch/arm64/include/uapi/asm/sigcontext.h2
-rw-r--r--arch/arm64/kernel/efi-entry.S3
-rw-r--r--arch/arm64/kernel/entry-ftrace.S2
-rw-r--r--arch/arm64/kernel/entry.S1
-rw-r--r--arch/arm64/kernel/head.S3
-rw-r--r--arch/arm64/kernel/ptrace.c32
-rw-r--r--arch/arm64/mm/flush.c3
-rw-r--r--arch/arm64/mm/init.c10
-rw-r--r--arch/ia64/hp/common/sba_iommu.c64
-rw-r--r--arch/ia64/include/uapi/asm/fcntl.h1
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/include/asm/sigcontext.h2
-rw-r--r--arch/mips/include/asm/uasm.h4
-rw-r--r--arch/mips/include/uapi/asm/inst.h1
-rw-r--r--arch/mips/include/uapi/asm/sigcontext.h8
-rw-r--r--arch/mips/kernel/asm-offsets.c3
-rw-r--r--arch/mips/kernel/irq-msc01.c2
-rw-r--r--arch/mips/kernel/pm-cps.c4
-rw-r--r--arch/mips/kernel/r4k_fpu.S213
-rw-r--r--arch/mips/kernel/signal.c79
-rw-r--r--arch/mips/kernel/signal32.c74
-rw-r--r--arch/mips/kernel/smp-cps.c2
-rw-r--r--arch/mips/kvm/kvm_mips.c1
-rw-r--r--arch/mips/math-emu/ieee754.c23
-rw-r--r--arch/mips/mm/uasm-micromips.c1
-rw-r--r--arch/mips/mm/uasm-mips.c3
-rw-r--r--arch/mips/mm/uasm.c10
-rw-r--r--arch/mips/net/bpf_jit.c266
-rw-r--r--arch/powerpc/Kconfig.debug1
-rw-r--r--arch/powerpc/include/asm/code-patching.h11
-rw-r--r--arch/powerpc/include/asm/opal.h29
-rw-r--r--arch/powerpc/include/asm/swab.h43
-rw-r--r--arch/powerpc/kernel/ftrace.c52
-rw-r--r--arch/powerpc/kernel/iomap.c20
-rw-r--r--arch/powerpc/kernel/kprobes.c9
-rw-r--r--arch/powerpc/kernel/module_64.c11
-rw-r--r--arch/powerpc/kernel/prom.c7
-rw-r--r--arch/powerpc/kernel/prom_init.c211
-rw-r--r--arch/powerpc/kernel/prom_init_check.sh4
-rw-r--r--arch/powerpc/kernel/setup-common.c10
-rw-r--r--arch/powerpc/kernel/signal_32.c9
-rw-r--r--arch/powerpc/kernel/signal_64.c9
-rw-r--r--arch/powerpc/platforms/cell/cbe_thermal.c2
-rw-r--r--arch/powerpc/platforms/powernv/Makefile2
-rw-r--r--arch/powerpc/platforms/powernv/opal-takeover.S140
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c5
-rw-r--r--arch/s390/configs/default_defconfig5
-rw-r--r--arch/s390/configs/gcov_defconfig5
-rw-r--r--arch/s390/configs/performance_defconfig5
-rw-r--r--arch/s390/configs/zfcpdump_defconfig3
-rw-r--r--arch/s390/defconfig8
-rw-r--r--arch/s390/include/asm/mmu_context.h33
-rw-r--r--arch/s390/include/asm/switch_to.h4
-rw-r--r--arch/s390/include/uapi/asm/Kbuild1
-rw-r--r--arch/s390/include/uapi/asm/sie.h26
-rw-r--r--arch/s390/include/uapi/asm/ucontext.h8
-rw-r--r--arch/s390/kernel/compat_linux.h4
-rw-r--r--arch/sparc/crypto/aes_glue.c6
-rw-r--r--arch/sparc/include/asm/atomic_32.h8
-rw-r--r--arch/sparc/include/asm/atomic_64.h18
-rw-r--r--arch/sparc/include/asm/auxio.h7
-rw-r--r--arch/sparc/include/asm/auxio_32.h6
-rw-r--r--arch/sparc/include/asm/auxio_64.h6
-rw-r--r--arch/sparc/include/asm/bitext.h6
-rw-r--r--arch/sparc/include/asm/bitops_32.h6
-rw-r--r--arch/sparc/include/asm/bitops_64.h24
-rw-r--r--arch/sparc/include/asm/btext.h2
-rw-r--r--arch/sparc/include/asm/bug.h4
-rw-r--r--arch/sparc/include/asm/cacheflush_32.h8
-rw-r--r--arch/sparc/include/asm/cacheflush_64.h24
-rw-r--r--arch/sparc/include/asm/checksum_32.h4
-rw-r--r--arch/sparc/include/asm/checksum_64.h32
-rw-r--r--arch/sparc/include/asm/cmpxchg_32.h6
-rw-r--r--arch/sparc/include/asm/cmpxchg_64.h4
-rw-r--r--arch/sparc/include/asm/cpudata.h10
-rw-r--r--arch/sparc/include/asm/cpudata_64.h5
-rw-r--r--arch/sparc/include/asm/delay_32.h4
-rw-r--r--arch/sparc/include/asm/delay_64.h4
-rw-r--r--arch/sparc/include/asm/device.h2
-rw-r--r--arch/sparc/include/asm/dma-mapping.h2
-rw-r--r--arch/sparc/include/asm/ebus_dma.h16
-rw-r--r--arch/sparc/include/asm/floppy_32.h14
-rw-r--r--arch/sparc/include/asm/floppy_64.h2
-rw-r--r--arch/sparc/include/asm/ftrace.h6
-rw-r--r--arch/sparc/include/asm/highmem.h10
-rw-r--r--arch/sparc/include/asm/hvtramp.h2
-rw-r--r--arch/sparc/include/asm/hypervisor.h325
-rw-r--r--arch/sparc/include/asm/idprom.h2
-rw-r--r--arch/sparc/include/asm/io-unit.h2
-rw-r--r--arch/sparc/include/asm/io_32.h299
-rw-r--r--arch/sparc/include/asm/io_64.h21
-rw-r--r--arch/sparc/include/asm/iommu_32.h10
-rw-r--r--arch/sparc/include/asm/iommu_64.h6
-rw-r--r--arch/sparc/include/asm/irq_32.h3
-rw-r--r--arch/sparc/include/asm/irq_64.h46
-rw-r--r--arch/sparc/include/asm/irqflags_32.h6
-rw-r--r--arch/sparc/include/asm/kdebug_64.h2
-rw-r--r--arch/sparc/include/asm/kgdb.h5
-rw-r--r--arch/sparc/include/asm/kprobes.h8
-rw-r--r--arch/sparc/include/asm/ldc.h66
-rw-r--r--arch/sparc/include/asm/leon.h54
-rw-r--r--arch/sparc/include/asm/leon_pci.h4
-rw-r--r--arch/sparc/include/asm/mc146818rtc.h5
-rw-r--r--arch/sparc/include/asm/mdesc.h32
-rw-r--r--arch/sparc/include/asm/mmu_64.h6
-rw-r--r--arch/sparc/include/asm/mmu_context_64.h24
-rw-r--r--arch/sparc/include/asm/nmi.h10
-rw-r--r--arch/sparc/include/asm/oplib_32.h68
-rw-r--r--arch/sparc/include/asm/oplib_64.h112
-rw-r--r--arch/sparc/include/asm/page.h3
-rw-r--r--arch/sparc/include/asm/page_64.h8
-rw-r--r--arch/sparc/include/asm/pci_64.h14
-rw-r--r--arch/sparc/include/asm/pcic.h8
-rw-r--r--arch/sparc/include/asm/pcr.h6
-rw-r--r--arch/sparc/include/asm/pgalloc_32.h2
-rw-r--r--arch/sparc/include/asm/pgalloc_64.h16
-rw-r--r--arch/sparc/include/asm/pgtable_32.h11
-rw-r--r--arch/sparc/include/asm/pgtable_64.h58
-rw-r--r--arch/sparc/include/asm/processor_32.h5
-rw-r--r--arch/sparc/include/asm/processor_64.h6
-rw-r--r--arch/sparc/include/asm/prom.h24
-rw-r--r--arch/sparc/include/asm/ptrace.h2
-rw-r--r--arch/sparc/include/asm/setup.h39
-rw-r--r--arch/sparc/include/asm/sfp-machine_32.h28
-rw-r--r--arch/sparc/include/asm/smp_32.h6
-rw-r--r--arch/sparc/include/asm/smp_64.h24
-rw-r--r--arch/sparc/include/asm/spitfire.h2
-rw-r--r--arch/sparc/include/asm/stacktrace.h2
-rw-r--r--arch/sparc/include/asm/starfire.h8
-rw-r--r--arch/sparc/include/asm/string_32.h12
-rw-r--r--arch/sparc/include/asm/string_64.h12
-rw-r--r--arch/sparc/include/asm/switch_to_32.h6
-rw-r--r--arch/sparc/include/asm/switch_to_64.h4
-rw-r--r--arch/sparc/include/asm/syscalls.h8
-rw-r--r--arch/sparc/include/asm/timer_32.h6
-rw-r--r--arch/sparc/include/asm/timer_64.h6
-rw-r--r--arch/sparc/include/asm/tlb_64.h8
-rw-r--r--arch/sparc/include/asm/tlbflush_64.h22
-rw-r--r--arch/sparc/include/asm/topology_64.h2
-rw-r--r--arch/sparc/include/asm/trap_block.h6
-rw-r--r--arch/sparc/include/asm/uaccess.h2
-rw-r--r--arch/sparc/include/asm/uaccess_32.h14
-rw-r--r--arch/sparc/include/asm/uaccess_64.h50
-rw-r--r--arch/sparc/include/asm/vio.h36
-rw-r--r--arch/sparc/include/asm/visasm.h3
-rw-r--r--arch/sparc/include/asm/xor_64.h28
-rw-r--r--arch/sparc/kernel/Makefile1
-rw-r--r--arch/sparc/kernel/audit.c8
-rw-r--r--arch/sparc/kernel/auxio_32.c9
-rw-r--r--arch/sparc/kernel/btext.c2
-rw-r--r--arch/sparc/kernel/compat_audit.c1
-rw-r--r--arch/sparc/kernel/cpu.c1
-rw-r--r--arch/sparc/kernel/cpumap.h4
-rw-r--r--arch/sparc/kernel/devices.c12
-rw-r--r--arch/sparc/kernel/entry.h259
-rw-r--r--arch/sparc/kernel/iommu.c3
-rw-r--r--arch/sparc/kernel/iommu_common.h14
-rw-r--r--arch/sparc/kernel/ioport.c6
-rw-r--r--arch/sparc/kernel/irq.h11
-rw-r--r--arch/sparc/kernel/irq_32.c1
-rw-r--r--arch/sparc/kernel/kernel.h124
-rw-r--r--arch/sparc/kernel/kgdb_64.c2
-rw-r--r--arch/sparc/kernel/kprobes.c5
-rw-r--r--arch/sparc/kernel/leon_kernel.c10
-rw-r--r--arch/sparc/kernel/leon_pci.c79
-rw-r--r--arch/sparc/kernel/leon_pci_grpci1.c16
-rw-r--r--arch/sparc/kernel/leon_pci_grpci2.c22
-rw-r--r--arch/sparc/kernel/leon_pmc.c8
-rw-r--r--arch/sparc/kernel/leon_smp.c13
-rw-r--r--arch/sparc/kernel/of_device_common.c4
-rw-r--r--arch/sparc/kernel/pci.c1
-rw-r--r--arch/sparc/kernel/pci_impl.h30
-rw-r--r--arch/sparc/kernel/pci_sun4v.h156
-rw-r--r--arch/sparc/kernel/pcic.c116
-rw-r--r--arch/sparc/kernel/perf_event.c23
-rw-r--r--arch/sparc/kernel/process_32.c12
-rw-r--r--arch/sparc/kernel/process_64.c20
-rw-r--r--arch/sparc/kernel/prom.h2
-rw-r--r--arch/sparc/kernel/prom_64.c5
-rw-r--r--arch/sparc/kernel/psycho_common.h22
-rw-r--r--arch/sparc/kernel/ptrace_32.c2
-rw-r--r--arch/sparc/kernel/setup_32.c4
-rw-r--r--arch/sparc/kernel/signal32.c56
-rw-r--r--arch/sparc/kernel/signal_32.c11
-rw-r--r--arch/sparc/kernel/signal_64.c6
-rw-r--r--arch/sparc/kernel/smp_32.c13
-rw-r--r--arch/sparc/kernel/smp_64.c16
-rw-r--r--arch/sparc/kernel/sun4d_irq.c17
-rw-r--r--arch/sparc/kernel/sys_sparc32.c2
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c10
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c1
-rw-r--r--arch/sparc/kernel/systbls.h124
-rw-r--r--arch/sparc/kernel/tadpole.c126
-rw-r--r--arch/sparc/kernel/time_32.c8
-rw-r--r--arch/sparc/kernel/traps_32.c4
-rw-r--r--arch/sparc/kernel/traps_64.c11
-rw-r--r--arch/sparc/kernel/unaligned_32.c4
-rw-r--r--arch/sparc/kernel/unaligned_64.c2
-rw-r--r--arch/sparc/kernel/windows.c3
-rw-r--r--arch/sparc/lib/Makefile2
-rw-r--r--arch/sparc/math-emu/sfp-util_32.h20
-rw-r--r--arch/sparc/math-emu/sfp-util_64.h12
-rw-r--r--arch/sparc/mm/fault_32.c9
-rw-r--r--arch/sparc/mm/fault_64.c4
-rw-r--r--arch/sparc/mm/init_32.c7
-rw-r--r--arch/sparc/mm/init_64.c9
-rw-r--r--arch/sparc/mm/init_64.h4
-rw-r--r--arch/sparc/mm/io-unit.c21
-rw-r--r--arch/sparc/mm/iommu.c25
-rw-r--r--arch/sparc/mm/leon_mm.c4
-rw-r--r--arch/sparc/mm/mm_32.h24
-rw-r--r--arch/sparc/mm/srmmu.c13
-rw-r--r--arch/sparc/mm/srmmu.h4
-rw-r--r--arch/sparc/mm/tsb.c1
-rw-r--r--arch/sparc/prom/misc_64.c5
-rw-r--r--arch/unicore32/Kconfig6
-rw-r--r--arch/unicore32/include/asm/io.h27
-rw-r--r--arch/unicore32/include/asm/pgtable.h10
-rw-r--r--arch/unicore32/include/asm/ptrace.h1
-rw-r--r--arch/unicore32/kernel/clock.c8
-rw-r--r--arch/unicore32/kernel/ksyms.c41
-rw-r--r--arch/unicore32/kernel/ksyms.h2
-rw-r--r--arch/unicore32/kernel/module.c11
-rw-r--r--arch/unicore32/kernel/process.c1
-rw-r--r--arch/unicore32/kernel/setup.c4
-rw-r--r--arch/unicore32/mm/alignment.c1
-rw-r--r--arch/unicore32/mm/proc-syms.c2
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/boot/compressed/aslr.c9
-rw-r--r--arch/x86/include/asm/irq.h2
-rw-r--r--arch/x86/include/asm/kvm_host.h4
-rw-r--r--arch/x86/include/asm/ptrace.h16
-rw-r--r--arch/x86/kernel/apic/hw_nmi.c18
-rw-r--r--arch/x86/kernel/entry_32.S10
-rw-r--r--arch/x86/kernel/signal.c2
-rw-r--r--arch/x86/kernel/traps.c7
-rw-r--r--arch/x86/kvm/svm.c1
-rw-r--r--arch/x86/kvm/x86.c2
-rw-r--r--arch/x86/vdso/Makefile24
-rw-r--r--arch/x86/vdso/vclock_gettime.c3
-rw-r--r--arch/x86/vdso/vdso-fakesections.c41
-rw-r--r--arch/x86/vdso/vdso-layout.lds.S64
-rw-r--r--arch/x86/vdso/vdso.lds.S2
-rw-r--r--arch/x86/vdso/vdso2c.c73
-rw-r--r--arch/x86/vdso/vdso2c.h199
-rw-r--r--arch/x86/vdso/vdso32/vdso-fakesections.c1
-rw-r--r--arch/x86/vdso/vdsox32.lds.S2
-rw-r--r--arch/x86/xen/enlighten.c5
-rw-r--r--arch/x86/xen/setup.c60
-rw-r--r--arch/x86/xen/xen-ops.h1
572 files changed, 3543 insertions, 12348 deletions
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index c1d3d2da1191..b3c750979aa1 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -60,7 +60,7 @@ extern void read_decode_cache_bcr(void);
60#define ARC_REG_IC_IVIC 0x10 60#define ARC_REG_IC_IVIC 0x10
61#define ARC_REG_IC_CTRL 0x11 61#define ARC_REG_IC_CTRL 0x11
62#define ARC_REG_IC_IVIL 0x19 62#define ARC_REG_IC_IVIL 0x19
63#if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4) 63#if defined(CONFIG_ARC_MMU_V3)
64#define ARC_REG_IC_PTAG 0x1E 64#define ARC_REG_IC_PTAG 0x1E
65#endif 65#endif
66 66
@@ -74,7 +74,7 @@ extern void read_decode_cache_bcr(void);
74#define ARC_REG_DC_IVDL 0x4A 74#define ARC_REG_DC_IVDL 0x4A
75#define ARC_REG_DC_FLSH 0x4B 75#define ARC_REG_DC_FLSH 0x4B
76#define ARC_REG_DC_FLDL 0x4C 76#define ARC_REG_DC_FLDL 0x4C
77#if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4) 77#if defined(CONFIG_ARC_MMU_V3)
78#define ARC_REG_DC_PTAG 0x5C 78#define ARC_REG_DC_PTAG 0x5C
79#endif 79#endif
80 80
diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h
index 2618cc13ba75..76a7739aab1c 100644
--- a/arch/arc/include/uapi/asm/ptrace.h
+++ b/arch/arc/include/uapi/asm/ptrace.h
@@ -11,6 +11,7 @@
11#ifndef _UAPI__ASM_ARC_PTRACE_H 11#ifndef _UAPI__ASM_ARC_PTRACE_H
12#define _UAPI__ASM_ARC_PTRACE_H 12#define _UAPI__ASM_ARC_PTRACE_H
13 13
14#define PTRACE_GET_THREAD_AREA 25
14 15
15#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
16/* 17/*
diff --git a/arch/arc/kernel/ctx_sw_asm.S b/arch/arc/kernel/ctx_sw_asm.S
index 2ff0347a2fd7..e248594097e7 100644
--- a/arch/arc/kernel/ctx_sw_asm.S
+++ b/arch/arc/kernel/ctx_sw_asm.S
@@ -10,9 +10,9 @@
10 * -This is the more "natural" hand written assembler 10 * -This is the more "natural" hand written assembler
11 */ 11 */
12 12
13#include <linux/linkage.h>
13#include <asm/entry.h> /* For the SAVE_* macros */ 14#include <asm/entry.h> /* For the SAVE_* macros */
14#include <asm/asm-offsets.h> 15#include <asm/asm-offsets.h>
15#include <asm/linkage.h>
16 16
17#define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4) 17#define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4)
18 18
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
index 0b3ef4025d89..fffdb5e41b20 100644
--- a/arch/arc/kernel/devtree.c
+++ b/arch/arc/kernel/devtree.c
@@ -41,7 +41,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt)
41{ 41{
42 const struct machine_desc *mdesc; 42 const struct machine_desc *mdesc;
43 unsigned long dt_root; 43 unsigned long dt_root;
44 void *clk; 44 const void *clk;
45 int len; 45 int len;
46 46
47 if (!early_init_dt_scan(dt)) 47 if (!early_init_dt_scan(dt))
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 07a58f2d3077..4d2481bd8b98 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -77,10 +77,11 @@ stext:
77 ; Clear BSS before updating any globals 77 ; Clear BSS before updating any globals
78 ; XXX: use ZOL here 78 ; XXX: use ZOL here
79 mov r5, __bss_start 79 mov r5, __bss_start
80 mov r6, __bss_stop 80 sub r6, __bss_stop, r5
81 lsr.f lp_count, r6, 2
82 lpnz 1f
83 st.ab 0, [r5, 4]
811: 841:
82 st.ab 0, [r5,4]
83 brlt r5, r6, 1b
84 85
85 ; Uboot - kernel ABI 86 ; Uboot - kernel ABI
86 ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 87 ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2
diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c
index 5d76706139dd..13b3ffb27a38 100644
--- a/arch/arc/kernel/ptrace.c
+++ b/arch/arc/kernel/ptrace.c
@@ -146,6 +146,10 @@ long arch_ptrace(struct task_struct *child, long request,
146 pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data); 146 pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data);
147 147
148 switch (request) { 148 switch (request) {
149 case PTRACE_GET_THREAD_AREA:
150 ret = put_user(task_thread_info(child)->thr_ptr,
151 (unsigned long __user *)data);
152 break;
149 default: 153 default:
150 ret = ptrace_request(child, request, addr, data); 154 ret = ptrace_request(child, request, addr, data);
151 break; 155 break;
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index cf90b6f4d3e0..c802bb500602 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -337,8 +337,19 @@ irqreturn_t do_IPI(int irq, void *dev_id)
337 * API called by platform code to hookup arch-common ISR to their IPI IRQ 337 * API called by platform code to hookup arch-common ISR to their IPI IRQ
338 */ 338 */
339static DEFINE_PER_CPU(int, ipi_dev); 339static DEFINE_PER_CPU(int, ipi_dev);
340
341static struct irqaction arc_ipi_irq = {
342 .name = "IPI Interrupt",
343 .flags = IRQF_PERCPU,
344 .handler = do_IPI,
345};
346
340int smp_ipi_irq_setup(int cpu, int irq) 347int smp_ipi_irq_setup(int cpu, int irq)
341{ 348{
342 int *dev_id = &per_cpu(ipi_dev, smp_processor_id()); 349 if (!cpu)
343 return request_percpu_irq(irq, do_IPI, "IPI Interrupt", dev_id); 350 return setup_irq(irq, &arc_ipi_irq);
351 else
352 arch_unmask_irq(irq);
353
354 return 0;
344} 355}
diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S
index 2555f5886af6..dd35bde39f69 100644
--- a/arch/arc/kernel/vmlinux.lds.S
+++ b/arch/arc/kernel/vmlinux.lds.S
@@ -116,7 +116,7 @@ SECTIONS
116 116
117 _edata = .; 117 _edata = .;
118 118
119 BSS_SECTION(0, 0, 0) 119 BSS_SECTION(4, 4, 4)
120 120
121#ifdef CONFIG_ARC_DW2_UNWIND 121#ifdef CONFIG_ARC_DW2_UNWIND
122 . = ALIGN(PAGE_SIZE); 122 . = ALIGN(PAGE_SIZE);
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index 1f676c4794e0..353b202c37c9 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -389,7 +389,7 @@ static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr,
389/*********************************************************** 389/***********************************************************
390 * Machine specific helper for per line I-Cache invalidate. 390 * Machine specific helper for per line I-Cache invalidate.
391 */ 391 */
392static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr, 392static void __ic_line_inv_vaddr_local(unsigned long paddr, unsigned long vaddr,
393 unsigned long sz) 393 unsigned long sz)
394{ 394{
395 unsigned long flags; 395 unsigned long flags;
@@ -405,6 +405,23 @@ static inline void __ic_entire_inv(void)
405 read_aux_reg(ARC_REG_IC_CTRL); /* blocks */ 405 read_aux_reg(ARC_REG_IC_CTRL); /* blocks */
406} 406}
407 407
408struct ic_line_inv_vaddr_ipi {
409 unsigned long paddr, vaddr;
410 int sz;
411};
412
413static void __ic_line_inv_vaddr_helper(void *info)
414{
415 struct ic_line_inv_vaddr_ipi *ic_inv = (struct ic_line_inv_vaddr_ipi*) info;
416 __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz);
417}
418
419static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr,
420 unsigned long sz)
421{
422 struct ic_line_inv_vaddr_ipi ic_inv = { paddr, vaddr , sz};
423 on_each_cpu(__ic_line_inv_vaddr_helper, &ic_inv, 1);
424}
408#else 425#else
409 426
410#define __ic_entire_inv() 427#define __ic_entire_inv()
@@ -553,12 +570,8 @@ void flush_icache_range(unsigned long kstart, unsigned long kend)
553 */ 570 */
554void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len) 571void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len)
555{ 572{
556 unsigned long flags;
557
558 local_irq_save(flags);
559 __ic_line_inv_vaddr(paddr, vaddr, len);
560 __dc_line_op(paddr, vaddr, len, OP_FLUSH_N_INV); 573 __dc_line_op(paddr, vaddr, len, OP_FLUSH_N_INV);
561 local_irq_restore(flags); 574 __ic_line_inv_vaddr(paddr, vaddr, len);
562} 575}
563 576
564/* wrapper to compile time eliminate alignment checks in flush loop */ 577/* wrapper to compile time eliminate alignment checks in flush loop */
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 87b63fde06d7..c32064de77d8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -175,13 +175,6 @@ config ARCH_HAS_ILOG2_U32
175config ARCH_HAS_ILOG2_U64 175config ARCH_HAS_ILOG2_U64
176 bool 176 bool
177 177
178config ARCH_HAS_CPUFREQ
179 bool
180 help
181 Internal node to signify that the ARCH has CPUFREQ support
182 and that the relevant menu configurations are displayed for
183 it.
184
185config ARCH_HAS_BANDGAP 178config ARCH_HAS_BANDGAP
186 bool 179 bool
187 180
@@ -246,13 +239,6 @@ config ARM_PATCH_PHYS_VIRT
246 this feature (eg, building a kernel for a single machine) and 239 this feature (eg, building a kernel for a single machine) and
247 you need to shrink the kernel to the minimal size. 240 you need to shrink the kernel to the minimal size.
248 241
249config NEED_MACH_GPIO_H
250 bool
251 help
252 Select this when mach/gpio.h is required to provide special
253 definitions for this platform. The need for mach/gpio.h should
254 be avoided when possible.
255
256config NEED_MACH_IO_H 242config NEED_MACH_IO_H
257 bool 243 bool
258 help 244 help
@@ -318,7 +304,6 @@ config ARCH_MULTIPLATFORM
318 304
319config ARCH_INTEGRATOR 305config ARCH_INTEGRATOR
320 bool "ARM Ltd. Integrator family" 306 bool "ARM Ltd. Integrator family"
321 select ARCH_HAS_CPUFREQ
322 select ARM_AMBA 307 select ARM_AMBA
323 select ARM_PATCH_PHYS_VIRT 308 select ARM_PATCH_PHYS_VIRT
324 select AUTO_ZRELADDR 309 select AUTO_ZRELADDR
@@ -328,7 +313,6 @@ config ARCH_INTEGRATOR
328 select HAVE_TCM 313 select HAVE_TCM
329 select ICST 314 select ICST
330 select MULTI_IRQ_HANDLER 315 select MULTI_IRQ_HANDLER
331 select NEED_MACH_MEMORY_H
332 select PLAT_VERSATILE 316 select PLAT_VERSATILE
333 select SPARSE_IRQ 317 select SPARSE_IRQ
334 select USE_OF 318 select USE_OF
@@ -538,7 +522,6 @@ config ARCH_DOVE
538 522
539config ARCH_KIRKWOOD 523config ARCH_KIRKWOOD
540 bool "Marvell Kirkwood" 524 bool "Marvell Kirkwood"
541 select ARCH_HAS_CPUFREQ
542 select ARCH_REQUIRE_GPIOLIB 525 select ARCH_REQUIRE_GPIOLIB
543 select CPU_FEROCEON 526 select CPU_FEROCEON
544 select GENERIC_CLOCKEVENTS 527 select GENERIC_CLOCKEVENTS
@@ -637,7 +620,6 @@ config ARCH_LPC32XX
637config ARCH_PXA 620config ARCH_PXA
638 bool "PXA2xx/PXA3xx-based" 621 bool "PXA2xx/PXA3xx-based"
639 depends on MMU 622 depends on MMU
640 select ARCH_HAS_CPUFREQ
641 select ARCH_MTD_XIP 623 select ARCH_MTD_XIP
642 select ARCH_REQUIRE_GPIOLIB 624 select ARCH_REQUIRE_GPIOLIB
643 select ARM_CPU_SUSPEND if PM 625 select ARM_CPU_SUSPEND if PM
@@ -707,7 +689,6 @@ config ARCH_RPC
707 689
708config ARCH_SA1100 690config ARCH_SA1100
709 bool "SA1100-based" 691 bool "SA1100-based"
710 select ARCH_HAS_CPUFREQ
711 select ARCH_MTD_XIP 692 select ARCH_MTD_XIP
712 select ARCH_REQUIRE_GPIOLIB 693 select ARCH_REQUIRE_GPIOLIB
713 select ARCH_SPARSEMEM_ENABLE 694 select ARCH_SPARSEMEM_ENABLE
@@ -725,7 +706,6 @@ config ARCH_SA1100
725 706
726config ARCH_S3C24XX 707config ARCH_S3C24XX
727 bool "Samsung S3C24XX SoCs" 708 bool "Samsung S3C24XX SoCs"
728 select ARCH_HAS_CPUFREQ
729 select ARCH_REQUIRE_GPIOLIB 709 select ARCH_REQUIRE_GPIOLIB
730 select ATAGS 710 select ATAGS
731 select CLKDEV_LOOKUP 711 select CLKDEV_LOOKUP
@@ -746,7 +726,6 @@ config ARCH_S3C24XX
746 726
747config ARCH_S3C64XX 727config ARCH_S3C64XX
748 bool "Samsung S3C64XX" 728 bool "Samsung S3C64XX"
749 select ARCH_HAS_CPUFREQ
750 select ARCH_REQUIRE_GPIOLIB 729 select ARCH_REQUIRE_GPIOLIB
751 select ARM_AMBA 730 select ARM_AMBA
752 select ARM_VIC 731 select ARM_VIC
@@ -771,45 +750,8 @@ config ARCH_S3C64XX
771 help 750 help
772 Samsung S3C64XX series based systems 751 Samsung S3C64XX series based systems
773 752
774config ARCH_S5P64X0
775 bool "Samsung S5P6440 S5P6450"
776 select ATAGS
777 select CLKDEV_LOOKUP
778 select CLKSRC_SAMSUNG_PWM
779 select CPU_V6
780 select GENERIC_CLOCKEVENTS
781 select GPIO_SAMSUNG
782 select HAVE_S3C2410_I2C if I2C
783 select HAVE_S3C2410_WATCHDOG if WATCHDOG
784 select HAVE_S3C_RTC if RTC_CLASS
785 select NEED_MACH_GPIO_H
786 select SAMSUNG_ATAGS
787 select SAMSUNG_WDT_RESET
788 help
789 Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440,
790 SMDK6450.
791
792config ARCH_S5PC100
793 bool "Samsung S5PC100"
794 select ARCH_REQUIRE_GPIOLIB
795 select ATAGS
796 select CLKDEV_LOOKUP
797 select CLKSRC_SAMSUNG_PWM
798 select CPU_V7
799 select GENERIC_CLOCKEVENTS
800 select GPIO_SAMSUNG
801 select HAVE_S3C2410_I2C if I2C
802 select HAVE_S3C2410_WATCHDOG if WATCHDOG
803 select HAVE_S3C_RTC if RTC_CLASS
804 select NEED_MACH_GPIO_H
805 select SAMSUNG_ATAGS
806 select SAMSUNG_WDT_RESET
807 help
808 Samsung S5PC100 series based systems
809
810config ARCH_S5PV210 753config ARCH_S5PV210
811 bool "Samsung S5PV210/S5PC110" 754 bool "Samsung S5PV210/S5PC110"
812 select ARCH_HAS_CPUFREQ
813 select ARCH_HAS_HOLES_MEMORYMODEL 755 select ARCH_HAS_HOLES_MEMORYMODEL
814 select ARCH_SPARSEMEM_ENABLE 756 select ARCH_SPARSEMEM_ENABLE
815 select ATAGS 757 select ATAGS
@@ -821,7 +763,6 @@ config ARCH_S5PV210
821 select HAVE_S3C2410_I2C if I2C 763 select HAVE_S3C2410_I2C if I2C
822 select HAVE_S3C2410_WATCHDOG if WATCHDOG 764 select HAVE_S3C2410_WATCHDOG if WATCHDOG
823 select HAVE_S3C_RTC if RTC_CLASS 765 select HAVE_S3C_RTC if RTC_CLASS
824 select NEED_MACH_GPIO_H
825 select NEED_MACH_MEMORY_H 766 select NEED_MACH_MEMORY_H
826 select SAMSUNG_ATAGS 767 select SAMSUNG_ATAGS
827 help 768 help
@@ -845,7 +786,6 @@ config ARCH_DAVINCI
845config ARCH_OMAP1 786config ARCH_OMAP1
846 bool "TI OMAP1" 787 bool "TI OMAP1"
847 depends on MMU 788 depends on MMU
848 select ARCH_HAS_CPUFREQ
849 select ARCH_HAS_HOLES_MEMORYMODEL 789 select ARCH_HAS_HOLES_MEMORYMODEL
850 select ARCH_OMAP 790 select ARCH_OMAP
851 select ARCH_REQUIRE_GPIOLIB 791 select ARCH_REQUIRE_GPIOLIB
@@ -1009,8 +949,6 @@ source "arch/arm/mach-rockchip/Kconfig"
1009 949
1010source "arch/arm/mach-sa1100/Kconfig" 950source "arch/arm/mach-sa1100/Kconfig"
1011 951
1012source "arch/arm/plat-samsung/Kconfig"
1013
1014source "arch/arm/mach-socfpga/Kconfig" 952source "arch/arm/mach-socfpga/Kconfig"
1015 953
1016source "arch/arm/mach-spear/Kconfig" 954source "arch/arm/mach-spear/Kconfig"
@@ -1021,13 +959,10 @@ source "arch/arm/mach-s3c24xx/Kconfig"
1021 959
1022source "arch/arm/mach-s3c64xx/Kconfig" 960source "arch/arm/mach-s3c64xx/Kconfig"
1023 961
1024source "arch/arm/mach-s5p64x0/Kconfig"
1025
1026source "arch/arm/mach-s5pc100/Kconfig"
1027
1028source "arch/arm/mach-s5pv210/Kconfig" 962source "arch/arm/mach-s5pv210/Kconfig"
1029 963
1030source "arch/arm/mach-exynos/Kconfig" 964source "arch/arm/mach-exynos/Kconfig"
965source "arch/arm/plat-samsung/Kconfig"
1031 966
1032source "arch/arm/mach-shmobile/Kconfig" 967source "arch/arm/mach-shmobile/Kconfig"
1033 968
@@ -1585,7 +1520,7 @@ source kernel/Kconfig.preempt
1585 1520
1586config HZ_FIXED 1521config HZ_FIXED
1587 int 1522 int
1588 default 200 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \ 1523 default 200 if ARCH_EBSA110 || ARCH_S3C24XX || \
1589 ARCH_S5PV210 || ARCH_EXYNOS4 1524 ARCH_S5PV210 || ARCH_EXYNOS4
1590 default AT91_TIMER_HZ if ARCH_AT91 1525 default AT91_TIMER_HZ if ARCH_AT91
1591 default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE_LEGACY 1526 default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE_LEGACY
@@ -2109,9 +2044,7 @@ endmenu
2109 2044
2110menu "CPU Power Management" 2045menu "CPU Power Management"
2111 2046
2112if ARCH_HAS_CPUFREQ
2113source "drivers/cpufreq/Kconfig" 2047source "drivers/cpufreq/Kconfig"
2114endif
2115 2048
2116source "drivers/cpuidle/Kconfig" 2049source "drivers/cpuidle/Kconfig"
2117 2050
@@ -2212,7 +2145,6 @@ menu "Power management options"
2212source "kernel/power/Kconfig" 2145source "kernel/power/Kconfig"
2213 2146
2214config ARCH_SUSPEND_POSSIBLE 2147config ARCH_SUSPEND_POSSIBLE
2215 depends on !ARCH_S5PC100
2216 depends on CPU_ARM920T || CPU_ARM926T || CPU_FEROCEON || CPU_SA1100 || \ 2148 depends on CPU_ARM920T || CPU_ARM926T || CPU_FEROCEON || CPU_SA1100 || \
2217 CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK 2149 CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK
2218 def_bool y 2150 def_bool y
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 8f90595069a1..a9176b9b00fc 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -991,6 +991,7 @@ config DEBUG_STI_UART
991config DEBUG_LL_INCLUDE 991config DEBUG_LL_INCLUDE
992 string 992 string
993 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 993 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
994 default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2
994 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X 995 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X
995 default "debug/exynos.S" if DEBUG_EXYNOS_UART 996 default "debug/exynos.S" if DEBUG_EXYNOS_UART
996 default "debug/efm32.S" if DEBUG_LL_UART_EFM32 997 default "debug/efm32.S" if DEBUG_LL_UART_EFM32
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 6721fab13734..d3f470c2201b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -187,8 +187,6 @@ machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip
187machine-$(CONFIG_ARCH_RPC) += rpc 187machine-$(CONFIG_ARCH_RPC) += rpc
188machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx 188machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx
189machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx 189machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx
190machine-$(CONFIG_ARCH_S5P64X0) += s5p64x0
191machine-$(CONFIG_ARCH_S5PC100) += s5pc100
192machine-$(CONFIG_ARCH_S5PV210) += s5pv210 190machine-$(CONFIG_ARCH_S5PV210) += s5pv210
193machine-$(CONFIG_ARCH_SA1100) += sa1100 191machine-$(CONFIG_ARCH_SA1100) += sa1100
194machine-$(CONFIG_ARCH_SHMOBILE) += shmobile 192machine-$(CONFIG_ARCH_SHMOBILE) += shmobile
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 5986ff63b901..adb5ed9e269e 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -357,7 +357,7 @@ dtb-$(CONFIG_ARCH_STI)+= stih407-b2120.dtb \
357 stih415-b2020.dtb \ 357 stih415-b2020.dtb \
358 stih416-b2000.dtb \ 358 stih416-b2000.dtb \
359 stih416-b2020.dtb \ 359 stih416-b2020.dtb \
360 stih416-b2020-revE.dtb 360 stih416-b2020e.dtb
361dtb-$(CONFIG_MACH_SUN4I) += \ 361dtb-$(CONFIG_MACH_SUN4I) += \
362 sun4i-a10-a1000.dtb \ 362 sun4i-a10-a1000.dtb \
363 sun4i-a10-cubieboard.dtb \ 363 sun4i-a10-cubieboard.dtb \
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
index 19f1f7e87597..90098f98a5c8 100644
--- a/arch/arm/boot/dts/am43x-epos-evm.dts
+++ b/arch/arm/boot/dts/am43x-epos-evm.dts
@@ -319,6 +319,10 @@
319 phy-mode = "rmii"; 319 phy-mode = "rmii";
320}; 320};
321 321
322&phy_sel {
323 rmii-clock-ext;
324};
325
322&i2c0 { 326&i2c0 {
323 status = "okay"; 327 status = "okay";
324 pinctrl-names = "default"; 328 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/armada-375-db.dts b/arch/arm/boot/dts/armada-375-db.dts
index 772fec2d26ce..1e2919d43d78 100644
--- a/arch/arm/boot/dts/armada-375-db.dts
+++ b/arch/arm/boot/dts/armada-375-db.dts
@@ -91,6 +91,8 @@
91 marvell,nand-keep-config; 91 marvell,nand-keep-config;
92 marvell,nand-enable-arbiter; 92 marvell,nand-enable-arbiter;
93 nand-on-flash-bbt; 93 nand-on-flash-bbt;
94 nand-ecc-strength = <4>;
95 nand-ecc-step-size = <512>;
94 96
95 partition@0 { 97 partition@0 {
96 label = "U-Boot"; 98 label = "U-Boot";
diff --git a/arch/arm/boot/dts/armada-380.dtsi b/arch/arm/boot/dts/armada-380.dtsi
index e69bc6759c39..4173a8ab34e7 100644
--- a/arch/arm/boot/dts/armada-380.dtsi
+++ b/arch/arm/boot/dts/armada-380.dtsi
@@ -16,7 +16,7 @@
16 16
17/ { 17/ {
18 model = "Marvell Armada 380 family SoC"; 18 model = "Marvell Armada 380 family SoC";
19 compatible = "marvell,armada380", "marvell,armada38x"; 19 compatible = "marvell,armada380";
20 20
21 cpus { 21 cpus {
22 #address-cells = <1>; 22 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/armada-385-db.dts b/arch/arm/boot/dts/armada-385-db.dts
index ff9637dd8d0f..1af886f1e486 100644
--- a/arch/arm/boot/dts/armada-385-db.dts
+++ b/arch/arm/boot/dts/armada-385-db.dts
@@ -16,7 +16,7 @@
16 16
17/ { 17/ {
18 model = "Marvell Armada 385 Development Board"; 18 model = "Marvell Armada 385 Development Board";
19 compatible = "marvell,a385-db", "marvell,armada385", "marvell,armada38x"; 19 compatible = "marvell,a385-db", "marvell,armada385", "marvell,armada380";
20 20
21 chosen { 21 chosen {
22 bootargs = "console=ttyS0,115200 earlyprintk"; 22 bootargs = "console=ttyS0,115200 earlyprintk";
@@ -98,6 +98,8 @@
98 marvell,nand-keep-config; 98 marvell,nand-keep-config;
99 marvell,nand-enable-arbiter; 99 marvell,nand-enable-arbiter;
100 nand-on-flash-bbt; 100 nand-on-flash-bbt;
101 nand-ecc-strength = <4>;
102 nand-ecc-step-size = <512>;
101 103
102 partition@0 { 104 partition@0 {
103 label = "U-Boot"; 105 label = "U-Boot";
diff --git a/arch/arm/boot/dts/armada-385-rd.dts b/arch/arm/boot/dts/armada-385-rd.dts
index 40893255a3f0..aaca2861dc87 100644
--- a/arch/arm/boot/dts/armada-385-rd.dts
+++ b/arch/arm/boot/dts/armada-385-rd.dts
@@ -17,7 +17,7 @@
17 17
18/ { 18/ {
19 model = "Marvell Armada 385 Reference Design"; 19 model = "Marvell Armada 385 Reference Design";
20 compatible = "marvell,a385-rd", "marvell,armada385", "marvell,armada38x"; 20 compatible = "marvell,a385-rd", "marvell,armada385", "marvell,armada380";
21 21
22 chosen { 22 chosen {
23 bootargs = "console=ttyS0,115200 earlyprintk"; 23 bootargs = "console=ttyS0,115200 earlyprintk";
diff --git a/arch/arm/boot/dts/armada-385.dtsi b/arch/arm/boot/dts/armada-385.dtsi
index f011009bf4cf..6283d7912f71 100644
--- a/arch/arm/boot/dts/armada-385.dtsi
+++ b/arch/arm/boot/dts/armada-385.dtsi
@@ -16,7 +16,7 @@
16 16
17/ { 17/ {
18 model = "Marvell Armada 385 family SoC"; 18 model = "Marvell Armada 385 family SoC";
19 compatible = "marvell,armada385", "marvell,armada38x"; 19 compatible = "marvell,armada385", "marvell,armada380";
20 20
21 cpus { 21 cpus {
22 #address-cells = <1>; 22 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index 3de364e81b52..689fa1a46728 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -20,7 +20,7 @@
20 20
21/ { 21/ {
22 model = "Marvell Armada 38x family SoC"; 22 model = "Marvell Armada 38x family SoC";
23 compatible = "marvell,armada38x"; 23 compatible = "marvell,armada380";
24 24
25 aliases { 25 aliases {
26 gpio0 = &gpio0; 26 gpio0 = &gpio0;
diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
index e5c6a0492ca0..4e5a59ee1501 100644
--- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
+++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
@@ -25,7 +25,7 @@
25 25
26 memory { 26 memory {
27 device_type = "memory"; 27 device_type = "memory";
28 reg = <0 0x00000000 0 0xC0000000>; /* 3 GB */ 28 reg = <0 0x00000000 0 0x40000000>; /* 1 GB soldered on */
29 }; 29 };
30 30
31 soc { 31 soc {
diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi
index b309c1c6e848..04927db1d6bf 100644
--- a/arch/arm/boot/dts/at91sam9261.dtsi
+++ b/arch/arm/boot/dts/at91sam9261.dtsi
@@ -568,24 +568,17 @@
568 #size-cells = <0>; 568 #size-cells = <0>;
569 #interrupt-cells = <1>; 569 #interrupt-cells = <1>;
570 570
571 slow_rc_osc: slow_rc_osc { 571 main_osc: main_osc {
572 compatible = "fixed-clock"; 572 compatible = "atmel,at91rm9200-clk-main-osc";
573 #clock-cells = <0>; 573 #clock-cells = <0>;
574 clock-frequency = <32768>; 574 interrupts-extended = <&pmc AT91_PMC_MOSCS>;
575 clock-accuracy = <50000000>; 575 clocks = <&main_xtal>;
576 };
577
578 clk32k: slck {
579 compatible = "atmel,at91sam9260-clk-slow";
580 #clock-cells = <0>;
581 clocks = <&slow_rc_osc &slow_xtal>;
582 }; 576 };
583 577
584 main: mainck { 578 main: mainck {
585 compatible = "atmel,at91rm9200-clk-main"; 579 compatible = "atmel,at91rm9200-clk-main";
586 #clock-cells = <0>; 580 #clock-cells = <0>;
587 interrupts-extended = <&pmc AT91_PMC_MOSCS>; 581 clocks = <&main_osc>;
588 clocks = <&main_xtal>;
589 }; 582 };
590 583
591 plla: pllack { 584 plla: pllack {
@@ -615,7 +608,7 @@
615 compatible = "atmel,at91rm9200-clk-master"; 608 compatible = "atmel,at91rm9200-clk-master";
616 #clock-cells = <0>; 609 #clock-cells = <0>;
617 interrupts-extended = <&pmc AT91_PMC_MCKRDY>; 610 interrupts-extended = <&pmc AT91_PMC_MCKRDY>;
618 clocks = <&clk32k>, <&main>, <&plla>, <&pllb>; 611 clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>;
619 atmel,clk-output-range = <0 94000000>; 612 atmel,clk-output-range = <0 94000000>;
620 atmel,clk-divisors = <1 2 4 0>; 613 atmel,clk-divisors = <1 2 4 0>;
621 }; 614 };
@@ -632,7 +625,7 @@
632 #address-cells = <1>; 625 #address-cells = <1>;
633 #size-cells = <0>; 626 #size-cells = <0>;
634 interrupt-parent = <&pmc>; 627 interrupt-parent = <&pmc>;
635 clocks = <&clk32k>, <&main>, <&plla>, <&pllb>; 628 clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>;
636 629
637 prog0: prog0 { 630 prog0: prog0 {
638 #clock-cells = <0>; 631 #clock-cells = <0>;
diff --git a/arch/arm/boot/dts/at91sam9261ek.dts b/arch/arm/boot/dts/at91sam9261ek.dts
index c6683ea8b743..aa35a7aec9a8 100644
--- a/arch/arm/boot/dts/at91sam9261ek.dts
+++ b/arch/arm/boot/dts/at91sam9261ek.dts
@@ -20,6 +20,10 @@
20 reg = <0x20000000 0x4000000>; 20 reg = <0x20000000 0x4000000>;
21 }; 21 };
22 22
23 slow_xtal {
24 clock-frequency = <32768>;
25 };
26
23 main_xtal { 27 main_xtal {
24 clock-frequency = <18432000>; 28 clock-frequency = <18432000>;
25 }; 29 };
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index d1b82e6635d5..287795985e32 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -132,8 +132,8 @@
132 <595000000 650000000 3 0>, 132 <595000000 650000000 3 0>,
133 <545000000 600000000 0 1>, 133 <545000000 600000000 0 1>,
134 <495000000 555000000 1 1>, 134 <495000000 555000000 1 1>,
135 <445000000 500000000 1 2>, 135 <445000000 500000000 2 1>,
136 <400000000 450000000 1 3>; 136 <400000000 450000000 3 1>;
137 }; 137 };
138 138
139 plladiv: plladivck { 139 plladiv: plladivck {
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 1a57298636a5..d6133f497207 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -140,8 +140,8 @@
140 595000000 650000000 3 0 140 595000000 650000000 3 0
141 545000000 600000000 0 1 141 545000000 600000000 0 1
142 495000000 555000000 1 1 142 495000000 555000000 1 1
143 445000000 500000000 1 2 143 445000000 500000000 2 1
144 400000000 450000000 1 3>; 144 400000000 450000000 3 1>;
145 }; 145 };
146 146
147 plladiv: plladivck { 147 plladiv: plladivck {
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index c29945e07c5a..80127638b379 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -773,7 +773,6 @@
773 clocks = <&qspi_gfclk_div>; 773 clocks = <&qspi_gfclk_div>;
774 clock-names = "fck"; 774 clock-names = "fck";
775 num-cs = <4>; 775 num-cs = <4>;
776 interrupts = <0 343 0x4>;
777 status = "disabled"; 776 status = "disabled";
778 }; 777 };
779 778
@@ -984,6 +983,17 @@
984 #size-cells = <1>; 983 #size-cells = <1>;
985 status = "disabled"; 984 status = "disabled";
986 }; 985 };
986
987 atl: atl@4843c000 {
988 compatible = "ti,dra7-atl";
989 reg = <0x4843c000 0x3ff>;
990 ti,hwmods = "atl";
991 ti,provided-clocks = <&atl_clkin0_ck>, <&atl_clkin1_ck>,
992 <&atl_clkin2_ck>, <&atl_clkin3_ck>;
993 clocks = <&atl_gfclk_mux>;
994 clock-names = "fck";
995 status = "disabled";
996 };
987 }; 997 };
988}; 998};
989 999
diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi
index b03cfe49d22b..c90c76de84d6 100644
--- a/arch/arm/boot/dts/dra7xx-clocks.dtsi
+++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi
@@ -10,26 +10,26 @@
10&cm_core_aon_clocks { 10&cm_core_aon_clocks {
11 atl_clkin0_ck: atl_clkin0_ck { 11 atl_clkin0_ck: atl_clkin0_ck {
12 #clock-cells = <0>; 12 #clock-cells = <0>;
13 compatible = "fixed-clock"; 13 compatible = "ti,dra7-atl-clock";
14 clock-frequency = <0>; 14 clocks = <&atl_gfclk_mux>;
15 }; 15 };
16 16
17 atl_clkin1_ck: atl_clkin1_ck { 17 atl_clkin1_ck: atl_clkin1_ck {
18 #clock-cells = <0>; 18 #clock-cells = <0>;
19 compatible = "fixed-clock"; 19 compatible = "ti,dra7-atl-clock";
20 clock-frequency = <0>; 20 clocks = <&atl_gfclk_mux>;
21 }; 21 };
22 22
23 atl_clkin2_ck: atl_clkin2_ck { 23 atl_clkin2_ck: atl_clkin2_ck {
24 #clock-cells = <0>; 24 #clock-cells = <0>;
25 compatible = "fixed-clock"; 25 compatible = "ti,dra7-atl-clock";
26 clock-frequency = <0>; 26 clocks = <&atl_gfclk_mux>;
27 }; 27 };
28 28
29 atl_clkin3_ck: atl_clkin3_ck { 29 atl_clkin3_ck: atl_clkin3_ck {
30 #clock-cells = <0>; 30 #clock-cells = <0>;
31 compatible = "fixed-clock"; 31 compatible = "ti,dra7-atl-clock";
32 clock-frequency = <0>; 32 clocks = <&atl_gfclk_mux>;
33 }; 33 };
34 34
35 hdmi_clkin_ck: hdmi_clkin_ck { 35 hdmi_clkin_ck: hdmi_clkin_ck {
diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
index e37985fa10e2..00eeed3721b6 100644
--- a/arch/arm/boot/dts/emev2.dtsi
+++ b/arch/arm/boot/dts/emev2.dtsi
@@ -31,11 +31,13 @@
31 device_type = "cpu"; 31 device_type = "cpu";
32 compatible = "arm,cortex-a9"; 32 compatible = "arm,cortex-a9";
33 reg = <0>; 33 reg = <0>;
34 clock-frequency = <533000000>;
34 }; 35 };
35 cpu@1 { 36 cpu@1 {
36 device_type = "cpu"; 37 device_type = "cpu";
37 compatible = "arm,cortex-a9"; 38 compatible = "arm,cortex-a9";
38 reg = <1>; 39 reg = <1>;
40 clock-frequency = <533000000>;
39 }; 41 };
40 }; 42 };
41 43
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index b8ece4be41ca..fbaf426d2daa 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -113,7 +113,7 @@
113 compatible = "arm,cortex-a9-gic"; 113 compatible = "arm,cortex-a9-gic";
114 #interrupt-cells = <3>; 114 #interrupt-cells = <3>;
115 interrupt-controller; 115 interrupt-controller;
116 reg = <0x10490000 0x1000>, <0x10480000 0x100>; 116 reg = <0x10490000 0x10000>, <0x10480000 0x10000>;
117 }; 117 };
118 118
119 combiner: interrupt-controller@10440000 { 119 combiner: interrupt-controller@10440000 {
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index 6bc3243a80d3..181d77fa2fa6 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -315,15 +315,15 @@
315&esdhc1 { 315&esdhc1 {
316 pinctrl-names = "default"; 316 pinctrl-names = "default";
317 pinctrl-0 = <&pinctrl_esdhc1>; 317 pinctrl-0 = <&pinctrl_esdhc1>;
318 fsl,cd-controller; 318 cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
319 fsl,wp-controller; 319 wp-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
320 status = "okay"; 320 status = "okay";
321}; 321};
322 322
323&esdhc2 { 323&esdhc2 {
324 pinctrl-names = "default"; 324 pinctrl-names = "default";
325 pinctrl-0 = <&pinctrl_esdhc2>; 325 pinctrl-0 = <&pinctrl_esdhc2>;
326 cd-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; 326 cd-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
327 wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; 327 wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
328 status = "okay"; 328 status = "okay";
329}; 329};
@@ -468,8 +468,8 @@
468 MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5 468 MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5
469 MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5 469 MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5
470 MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5 470 MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5
471 MX51_PAD_GPIO1_0__SD1_CD 0x20d5 471 MX51_PAD_GPIO1_0__GPIO1_0 0x100
472 MX51_PAD_GPIO1_1__SD1_WP 0x20d5 472 MX51_PAD_GPIO1_1__GPIO1_1 0x100
473 >; 473 >;
474 }; 474 };
475 475
diff --git a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts
index 75e66c9c6144..31cfb7f2b02e 100644
--- a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts
+++ b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts
@@ -107,7 +107,7 @@
107&esdhc1 { 107&esdhc1 {
108 pinctrl-names = "default"; 108 pinctrl-names = "default";
109 pinctrl-0 = <&pinctrl_esdhc1 &pinctrl_esdhc1_cd>; 109 pinctrl-0 = <&pinctrl_esdhc1 &pinctrl_esdhc1_cd>;
110 fsl,cd-controller; 110 cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
111 status = "okay"; 111 status = "okay";
112}; 112};
113 113
@@ -206,7 +206,7 @@
206 206
207 pinctrl_esdhc1_cd: esdhc1_cd { 207 pinctrl_esdhc1_cd: esdhc1_cd {
208 fsl,pins = < 208 fsl,pins = <
209 MX51_PAD_GPIO1_0__SD1_CD 0x20d5 209 MX51_PAD_GPIO1_0__GPIO1_0 0xd5
210 >; 210 >;
211 }; 211 };
212 212
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts b/arch/arm/boot/dts/imx53-m53evk.dts
index d5d146a8b149..c4956b0ffb35 100644
--- a/arch/arm/boot/dts/imx53-m53evk.dts
+++ b/arch/arm/boot/dts/imx53-m53evk.dts
@@ -21,27 +21,25 @@
21 <0xb0000000 0x20000000>; 21 <0xb0000000 0x20000000>;
22 }; 22 };
23 23
24 soc { 24 display1: display@di1 {
25 display1: display@di1 { 25 compatible = "fsl,imx-parallel-display";
26 compatible = "fsl,imx-parallel-display"; 26 interface-pix-fmt = "bgr666";
27 interface-pix-fmt = "bgr666"; 27 pinctrl-names = "default";
28 pinctrl-names = "default"; 28 pinctrl-0 = <&pinctrl_ipu_disp1>;
29 pinctrl-0 = <&pinctrl_ipu_disp1>; 29
30 30 display-timings {
31 display-timings { 31 800x480p60 {
32 800x480p60 { 32 native-mode;
33 native-mode; 33 clock-frequency = <31500000>;
34 clock-frequency = <31500000>; 34 hactive = <800>;
35 hactive = <800>; 35 vactive = <480>;
36 vactive = <480>; 36 hfront-porch = <40>;
37 hfront-porch = <40>; 37 hback-porch = <88>;
38 hback-porch = <88>; 38 hsync-len = <128>;
39 hsync-len = <128>; 39 vback-porch = <33>;
40 vback-porch = <33>; 40 vfront-porch = <9>;
41 vfront-porch = <9>; 41 vsync-len = <3>;
42 vsync-len = <3>; 42 vsync-active = <1>;
43 vsync-active = <1>;
44 };
45 }; 43 };
46 }; 44 };
47 45
diff --git a/arch/arm/boot/dts/imx6dl-hummingboard.dts b/arch/arm/boot/dts/imx6dl-hummingboard.dts
index 5373a5f2782b..c8e51dd41b8f 100644
--- a/arch/arm/boot/dts/imx6dl-hummingboard.dts
+++ b/arch/arm/boot/dts/imx6dl-hummingboard.dts
@@ -143,6 +143,14 @@
143 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>; 143 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>;
144 }; 144 };
145 145
146 pinctrl_hummingboard_usbotg_id: hummingboard-usbotg-id {
147 /*
148 * Similar to pinctrl_usbotg_2, but we want it
149 * pulled down for a fixed host connection.
150 */
151 fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>;
152 };
153
146 pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus { 154 pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus {
147 fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>; 155 fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>;
148 }; 156 };
@@ -178,6 +186,8 @@
178}; 186};
179 187
180&usbotg { 188&usbotg {
189 pinctrl-names = "default";
190 pinctrl-0 = <&pinctrl_hummingboard_usbotg_id>;
181 vbus-supply = <&reg_usbotg_vbus>; 191 vbus-supply = <&reg_usbotg_vbus>;
182 status = "okay"; 192 status = "okay";
183}; 193};
diff --git a/arch/arm/boot/dts/imx6q-gw51xx.dts b/arch/arm/boot/dts/imx6q-gw51xx.dts
index af4929aee075..0e1406e58eff 100644
--- a/arch/arm/boot/dts/imx6q-gw51xx.dts
+++ b/arch/arm/boot/dts/imx6q-gw51xx.dts
@@ -11,7 +11,7 @@
11 11
12/dts-v1/; 12/dts-v1/;
13#include "imx6q.dtsi" 13#include "imx6q.dtsi"
14#include "imx6qdl-gw54xx.dtsi" 14#include "imx6qdl-gw51xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 Quad GW51XX"; 17 model = "Gateworks Ventana i.MX6 Quad GW51XX";
diff --git a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
index 25da82a03110..e8e781656b3f 100644
--- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
@@ -12,6 +12,19 @@
12 pinctrl-0 = <&pinctrl_cubox_i_ir>; 12 pinctrl-0 = <&pinctrl_cubox_i_ir>;
13 }; 13 };
14 14
15 pwmleds {
16 compatible = "pwm-leds";
17 pinctrl-names = "default";
18 pinctrl-0 = <&pinctrl_cubox_i_pwm1>;
19
20 front {
21 active-low;
22 label = "imx6:red:front";
23 max-brightness = <248>;
24 pwms = <&pwm1 0 50000>;
25 };
26 };
27
15 regulators { 28 regulators {
16 compatible = "simple-bus"; 29 compatible = "simple-bus";
17 30
@@ -109,6 +122,10 @@
109 >; 122 >;
110 }; 123 };
111 124
125 pinctrl_cubox_i_pwm1: cubox-i-pwm1-front-led {
126 fsl,pins = <MX6QDL_PAD_DISP0_DAT8__PWM1_OUT 0x1b0b0>;
127 };
128
112 pinctrl_cubox_i_spdif: cubox-i-spdif { 129 pinctrl_cubox_i_spdif: cubox-i-spdif {
113 fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; 130 fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>;
114 }; 131 };
@@ -117,6 +134,14 @@
117 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; 134 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>;
118 }; 135 };
119 136
137 pinctrl_cubox_i_usbotg_id: cubox-i-usbotg-id {
138 /*
139 * The Cubox-i pulls this low, but as it's pointless
140 * leaving it as a pull-up, even if it is just 10uA.
141 */
142 fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>;
143 };
144
120 pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { 145 pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus {
121 fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x4001b0b0>; 146 fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x4001b0b0>;
122 }; 147 };
@@ -153,6 +178,8 @@
153}; 178};
154 179
155&usbotg { 180&usbotg {
181 pinctrl-names = "default";
182 pinctrl-0 = <&pinctrl_cubox_i_usbotg_id>;
156 vbus-supply = <&reg_usbotg_vbus>; 183 vbus-supply = <&reg_usbotg_vbus>;
157 status = "okay"; 184 status = "okay";
158}; 185};
diff --git a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
index 31665adcbf39..0db15af41cb1 100644
--- a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
@@ -161,7 +161,7 @@
161 status = "okay"; 161 status = "okay";
162 162
163 pmic: ltc3676@3c { 163 pmic: ltc3676@3c {
164 compatible = "ltc,ltc3676"; 164 compatible = "lltc,ltc3676";
165 reg = <0x3c>; 165 reg = <0x3c>;
166 166
167 regulators { 167 regulators {
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
index 367af3ec9435..744c8a2d81f6 100644
--- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
@@ -220,7 +220,7 @@
220 }; 220 };
221 221
222 pmic: ltc3676@3c { 222 pmic: ltc3676@3c {
223 compatible = "ltc,ltc3676"; 223 compatible = "lltc,ltc3676";
224 reg = <0x3c>; 224 reg = <0x3c>;
225 225
226 regulators { 226 regulators {
@@ -288,7 +288,7 @@
288 codec: sgtl5000@0a { 288 codec: sgtl5000@0a {
289 compatible = "fsl,sgtl5000"; 289 compatible = "fsl,sgtl5000";
290 reg = <0x0a>; 290 reg = <0x0a>;
291 clocks = <&clks 169>; 291 clocks = <&clks 201>;
292 VDDA-supply = <&reg_1p8v>; 292 VDDA-supply = <&reg_1p8v>;
293 VDDIO-supply = <&reg_3p3v>; 293 VDDIO-supply = <&reg_3p3v>;
294 }; 294 };
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
index c91b5a6c769b..adf150c1be90 100644
--- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
@@ -234,7 +234,7 @@
234 }; 234 };
235 235
236 pmic: ltc3676@3c { 236 pmic: ltc3676@3c {
237 compatible = "ltc,ltc3676"; 237 compatible = "lltc,ltc3676";
238 reg = <0x3c>; 238 reg = <0x3c>;
239 239
240 regulators { 240 regulators {
diff --git a/arch/arm/boot/dts/imx6qdl-microsom.dtsi b/arch/arm/boot/dts/imx6qdl-microsom.dtsi
index d729d0b15f25..79eac6849d4c 100644
--- a/arch/arm/boot/dts/imx6qdl-microsom.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-microsom.dtsi
@@ -10,14 +10,6 @@
10 MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1 10 MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1
11 >; 11 >;
12 }; 12 };
13
14 pinctrl_microsom_usbotg: microsom-usbotg {
15 /*
16 * Similar to pinctrl_usbotg_2, but we want it
17 * pulled down for a fixed host connection.
18 */
19 fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>;
20 };
21 }; 13 };
22}; 14};
23 15
@@ -26,8 +18,3 @@
26 pinctrl-0 = <&pinctrl_microsom_uart1>; 18 pinctrl-0 = <&pinctrl_microsom_uart1>;
27 status = "okay"; 19 status = "okay";
28}; 20};
29
30&usbotg {
31 pinctrl-names = "default";
32 pinctrl-0 = <&pinctrl_microsom_usbotg>;
33};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 2d4e5285f3f3..57d4abe03a94 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -686,7 +686,7 @@
686 compatible = "fsl,imx6sl-fec", "fsl,imx25-fec"; 686 compatible = "fsl,imx6sl-fec", "fsl,imx25-fec";
687 reg = <0x02188000 0x4000>; 687 reg = <0x02188000 0x4000>;
688 interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>; 688 interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>;
689 clocks = <&clks IMX6SL_CLK_ENET_REF>, 689 clocks = <&clks IMX6SL_CLK_ENET>,
690 <&clks IMX6SL_CLK_ENET_REF>; 690 <&clks IMX6SL_CLK_ENET_REF>;
691 clock-names = "ipg", "ahb"; 691 clock-names = "ipg", "ahb";
692 status = "disabled"; 692 status = "disabled";
diff --git a/arch/arm/boot/dts/integratorap.dts b/arch/arm/boot/dts/integratorap.dts
index b10e6351da53..cf06e32ee108 100644
--- a/arch/arm/boot/dts/integratorap.dts
+++ b/arch/arm/boot/dts/integratorap.dts
@@ -8,6 +8,7 @@
8/ { 8/ {
9 model = "ARM Integrator/AP"; 9 model = "ARM Integrator/AP";
10 compatible = "arm,integrator-ap"; 10 compatible = "arm,integrator-ap";
11 dma-ranges = <0x80000000 0x0 0x80000000>;
11 12
12 aliases { 13 aliases {
13 arm,timer-primary = &timer2; 14 arm,timer-primary = &timer2;
diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
index c5a1fc75c7a3..b2d9834bf458 100644
--- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
+++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
@@ -105,7 +105,6 @@
105 compatible = "ethernet-phy-id0141.0cb0", 105 compatible = "ethernet-phy-id0141.0cb0",
106 "ethernet-phy-ieee802.3-c22"; 106 "ethernet-phy-ieee802.3-c22";
107 reg = <0>; 107 reg = <0>;
108 phy-connection-type = "rgmii-id";
109 }; 108 };
110 109
111 ethphy1: ethernet-phy@1 { 110 ethphy1: ethernet-phy@1 {
@@ -113,7 +112,6 @@
113 compatible = "ethernet-phy-id0141.0cb0", 112 compatible = "ethernet-phy-id0141.0cb0",
114 "ethernet-phy-ieee802.3-c22"; 113 "ethernet-phy-ieee802.3-c22";
115 reg = <1>; 114 reg = <1>;
116 phy-connection-type = "rgmii-id";
117 }; 115 };
118}; 116};
119 117
@@ -121,6 +119,7 @@
121 status = "okay"; 119 status = "okay";
122 ethernet0-port@0 { 120 ethernet0-port@0 {
123 phy-handle = <&ethphy0>; 121 phy-handle = <&ethphy0>;
122 phy-connection-type = "rgmii-id";
124 }; 123 };
125}; 124};
126 125
@@ -128,5 +127,6 @@
128 status = "okay"; 127 status = "okay";
129 ethernet1-port@0 { 128 ethernet1-port@0 {
130 phy-handle = <&ethphy1>; 129 phy-handle = <&ethphy1>;
130 phy-connection-type = "rgmii-id";
131 }; 131 };
132}; 132};
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index cf0be662297e..1becefce821b 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -251,6 +251,11 @@
251 codec { 251 codec {
252 }; 252 };
253 }; 253 };
254
255 twl_power: power {
256 compatible = "ti,twl4030-power-beagleboard-xm", "ti,twl4030-power-idle-osc-off";
257 ti,use_poweroff;
258 };
254 }; 259 };
255}; 260};
256 261
@@ -301,6 +306,7 @@
301}; 306};
302 307
303&uart3 { 308&uart3 {
309 interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
304 pinctrl-names = "default"; 310 pinctrl-names = "default";
305 pinctrl-0 = <&uart3_pins>; 311 pinctrl-0 = <&uart3_pins>;
306}; 312};
diff --git a/arch/arm/boot/dts/omap3-evm-common.dtsi b/arch/arm/boot/dts/omap3-evm-common.dtsi
index 8ae8f007c8ad..c8747c7f1cc8 100644
--- a/arch/arm/boot/dts/omap3-evm-common.dtsi
+++ b/arch/arm/boot/dts/omap3-evm-common.dtsi
@@ -50,6 +50,13 @@
50 gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>; 50 gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>;
51}; 51};
52 52
53&twl {
54 twl_power: power {
55 compatible = "ti,twl4030-power-omap3-evm", "ti,twl4030-power-idle";
56 ti,use_poweroff;
57 };
58};
59
53&i2c2 { 60&i2c2 {
54 clock-frequency = <400000>; 61 clock-frequency = <400000>;
55}; 62};
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index ae8ae3f4f9bf..1fe45d1f75ec 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -351,6 +351,11 @@
351 compatible = "ti,twl4030-audio"; 351 compatible = "ti,twl4030-audio";
352 ti,enable-vibra = <1>; 352 ti,enable-vibra = <1>;
353 }; 353 };
354
355 twl_power: power {
356 compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off";
357 ti,use_poweroff;
358 };
354}; 359};
355 360
356&twl_keypad { 361&twl_keypad {
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 3bfda16c8b52..a4ed54988866 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -45,7 +45,6 @@
45 45
46 operating-points = < 46 operating-points = <
47 /* kHz uV */ 47 /* kHz uV */
48 500000 880000
49 1000000 1060000 48 1000000 1060000
50 1500000 1250000 49 1500000 1250000
51 >; 50 >;
diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index f50fbc8f3bd9..bdee22541189 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -144,6 +144,7 @@
144 device_type = "cpu"; 144 device_type = "cpu";
145 compatible = "arm,cortex-a9"; 145 compatible = "arm,cortex-a9";
146 reg = <0>; 146 reg = <0>;
147 clock-frequency = <400000000>;
147 }; 148 };
148 }; 149 };
149 150
diff --git a/arch/arm/boot/dts/stih415.dtsi b/arch/arm/boot/dts/stih415.dtsi
index d6f254f302fe..a0f6f75fe3b5 100644
--- a/arch/arm/boot/dts/stih415.dtsi
+++ b/arch/arm/boot/dts/stih415.dtsi
@@ -169,8 +169,8 @@
169 169
170 pinctrl-names = "default"; 170 pinctrl-names = "default";
171 pinctrl-0 = <&pinctrl_mii0>; 171 pinctrl-0 = <&pinctrl_mii0>;
172 clock-names = "stmmaceth"; 172 clock-names = "stmmaceth", "sti-ethclk";
173 clocks = <&clk_s_a1_ls CLK_GMAC0_PHY>; 173 clocks = <&clk_s_a1_ls CLK_ICN_IF_2>, <&clk_s_a1_ls CLK_GMAC0_PHY>;
174 }; 174 };
175 175
176 ethernet1: dwmac@fef08000 { 176 ethernet1: dwmac@fef08000 {
@@ -192,8 +192,8 @@
192 reset-names = "stmmaceth"; 192 reset-names = "stmmaceth";
193 pinctrl-names = "default"; 193 pinctrl-names = "default";
194 pinctrl-0 = <&pinctrl_mii1>; 194 pinctrl-0 = <&pinctrl_mii1>;
195 clock-names = "stmmaceth"; 195 clock-names = "stmmaceth", "sti-ethclk";
196 clocks = <&clk_s_a0_ls CLK_ETH1_PHY>; 196 clocks = <&clk_s_a0_ls CLK_ICN_REG>, <&clk_s_a0_ls CLK_ETH1_PHY>;
197 }; 197 };
198 198
199 rc: rc@fe518000 { 199 rc: rc@fe518000 {
diff --git a/arch/arm/boot/dts/stih416-b2020-revE.dts b/arch/arm/boot/dts/stih416-b2020e.dts
index ba0fa2caaf18..ba0fa2caaf18 100644
--- a/arch/arm/boot/dts/stih416-b2020-revE.dts
+++ b/arch/arm/boot/dts/stih416-b2020e.dts
diff --git a/arch/arm/boot/dts/stih416.dtsi b/arch/arm/boot/dts/stih416.dtsi
index 06473c5d9ea9..84758d76d064 100644
--- a/arch/arm/boot/dts/stih416.dtsi
+++ b/arch/arm/boot/dts/stih416.dtsi
@@ -175,8 +175,8 @@
175 reset-names = "stmmaceth"; 175 reset-names = "stmmaceth";
176 pinctrl-names = "default"; 176 pinctrl-names = "default";
177 pinctrl-0 = <&pinctrl_mii0>; 177 pinctrl-0 = <&pinctrl_mii0>;
178 clock-names = "stmmaceth"; 178 clock-names = "stmmaceth", "sti-ethclk";
179 clocks = <&clk_s_a1_ls CLK_GMAC0_PHY>; 179 clocks = <&clk_s_a1_ls CLK_ICN_IF_2>, <&clk_s_a1_ls CLK_GMAC0_PHY>;
180 }; 180 };
181 181
182 ethernet1: dwmac@fef08000 { 182 ethernet1: dwmac@fef08000 {
@@ -197,8 +197,8 @@
197 reset-names = "stmmaceth"; 197 reset-names = "stmmaceth";
198 pinctrl-names = "default"; 198 pinctrl-names = "default";
199 pinctrl-0 = <&pinctrl_mii1>; 199 pinctrl-0 = <&pinctrl_mii1>;
200 clock-names = "stmmaceth"; 200 clock-names = "stmmaceth", "sti-ethclk";
201 clocks = <&clk_s_a0_ls CLK_ETH1_PHY>; 201 clocks = <&clk_s_a0_ls CLK_ICN_REG>, <&clk_s_a0_ls CLK_ETH1_PHY>;
202 }; 202 };
203 203
204 rc: rc@fe518000 { 204 rc: rc@fe518000 {
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 6ef146edd0cd..a20fa80776d3 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -182,7 +182,6 @@ static int scoop_probe(struct platform_device *pdev)
182 struct scoop_config *inf; 182 struct scoop_config *inf;
183 struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 183 struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
184 int ret; 184 int ret;
185 int temp;
186 185
187 if (!mem) 186 if (!mem)
188 return -EINVAL; 187 return -EINVAL;
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index 9d13dae99125..4bf72264b175 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_defconfig
@@ -94,10 +94,10 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y
94CONFIG_BACKLIGHT_PWM=y 94CONFIG_BACKLIGHT_PWM=y
95# CONFIG_USB_SUPPORT is not set 95# CONFIG_USB_SUPPORT is not set
96CONFIG_MMC=y 96CONFIG_MMC=y
97CONFIG_MMC_UNSAFE_RESUME=y
98CONFIG_MMC_BLOCK_MINORS=32 97CONFIG_MMC_BLOCK_MINORS=32
99CONFIG_MMC_TEST=y 98CONFIG_MMC_TEST=y
100CONFIG_MMC_SDHCI=y 99CONFIG_MMC_SDHCI=y
100CONFIG_MMC_SDHCI_PLTFM=y
101CONFIG_MMC_SDHCI_BCM_KONA=y 101CONFIG_MMC_SDHCI_BCM_KONA=y
102CONFIG_NEW_LEDS=y 102CONFIG_NEW_LEDS=y
103CONFIG_LEDS_CLASS=y 103CONFIG_LEDS_CLASS=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index ef8815327e5b..59b7e45142d8 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -186,6 +186,7 @@ CONFIG_VIDEO_MX3=y
186CONFIG_V4L_MEM2MEM_DRIVERS=y 186CONFIG_V4L_MEM2MEM_DRIVERS=y
187CONFIG_VIDEO_CODA=y 187CONFIG_VIDEO_CODA=y
188CONFIG_SOC_CAMERA_OV2640=y 188CONFIG_SOC_CAMERA_OV2640=y
189CONFIG_IMX_IPUV3_CORE=y
189CONFIG_DRM=y 190CONFIG_DRM=y
190CONFIG_DRM_PANEL_SIMPLE=y 191CONFIG_DRM_PANEL_SIMPLE=y
191CONFIG_BACKLIGHT_LCD_SUPPORT=y 192CONFIG_BACKLIGHT_LCD_SUPPORT=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index e2d62048e198..534836497998 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -223,12 +223,12 @@ CONFIG_POWER_RESET_GPIO=y
223CONFIG_POWER_RESET_SUN6I=y 223CONFIG_POWER_RESET_SUN6I=y
224CONFIG_SENSORS_LM90=y 224CONFIG_SENSORS_LM90=y
225CONFIG_THERMAL=y 225CONFIG_THERMAL=y
226CONFIG_DOVE_THERMAL=y
227CONFIG_ARMADA_THERMAL=y 226CONFIG_ARMADA_THERMAL=y
228CONFIG_WATCHDOG=y 227CONFIG_WATCHDOG=y
229CONFIG_ORION_WATCHDOG=y 228CONFIG_ORION_WATCHDOG=y
230CONFIG_SUNXI_WATCHDOG=y 229CONFIG_SUNXI_WATCHDOG=y
231CONFIG_MFD_AS3722=y 230CONFIG_MFD_AS3722=y
231CONFIG_MFD_BCM590XX=y
232CONFIG_MFD_CROS_EC=y 232CONFIG_MFD_CROS_EC=y
233CONFIG_MFD_CROS_EC_SPI=y 233CONFIG_MFD_CROS_EC_SPI=y
234CONFIG_MFD_MAX8907=y 234CONFIG_MFD_MAX8907=y
@@ -240,6 +240,7 @@ CONFIG_MFD_TPS65910=y
240CONFIG_REGULATOR_VIRTUAL_CONSUMER=y 240CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
241CONFIG_REGULATOR_AB8500=y 241CONFIG_REGULATOR_AB8500=y
242CONFIG_REGULATOR_AS3722=y 242CONFIG_REGULATOR_AS3722=y
243CONFIG_REGULATOR_BCM590XX=y
243CONFIG_REGULATOR_GPIO=y 244CONFIG_REGULATOR_GPIO=y
244CONFIG_REGULATOR_MAX8907=y 245CONFIG_REGULATOR_MAX8907=y
245CONFIG_REGULATOR_PALMAS=y 246CONFIG_REGULATOR_PALMAS=y
@@ -300,6 +301,7 @@ CONFIG_MMC=y
300CONFIG_MMC_BLOCK_MINORS=16 301CONFIG_MMC_BLOCK_MINORS=16
301CONFIG_MMC_ARMMMCI=y 302CONFIG_MMC_ARMMMCI=y
302CONFIG_MMC_SDHCI=y 303CONFIG_MMC_SDHCI=y
304CONFIG_MMC_SDHCI_PLTFM=y
303CONFIG_MMC_SDHCI_OF_ARASAN=y 305CONFIG_MMC_SDHCI_OF_ARASAN=y
304CONFIG_MMC_SDHCI_ESDHC_IMX=y 306CONFIG_MMC_SDHCI_ESDHC_IMX=y
305CONFIG_MMC_SDHCI_DOVE=y 307CONFIG_MMC_SDHCI_DOVE=y
@@ -352,6 +354,7 @@ CONFIG_MFD_NVEC=y
352CONFIG_KEYBOARD_NVEC=y 354CONFIG_KEYBOARD_NVEC=y
353CONFIG_SERIO_NVEC_PS2=y 355CONFIG_SERIO_NVEC_PS2=y
354CONFIG_NVEC_POWER=y 356CONFIG_NVEC_POWER=y
357CONFIG_QCOM_GSBI=y
355CONFIG_COMMON_CLK_QCOM=y 358CONFIG_COMMON_CLK_QCOM=y
356CONFIG_MSM_GCC_8660=y 359CONFIG_MSM_GCC_8660=y
357CONFIG_MSM_MMCC_8960=y 360CONFIG_MSM_MMCC_8960=y
diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig
index e11170e37442..b0bfefa23902 100644
--- a/arch/arm/configs/mvebu_v7_defconfig
+++ b/arch/arm/configs/mvebu_v7_defconfig
@@ -14,6 +14,7 @@ CONFIG_MACH_ARMADA_370=y
14CONFIG_MACH_ARMADA_375=y 14CONFIG_MACH_ARMADA_375=y
15CONFIG_MACH_ARMADA_38X=y 15CONFIG_MACH_ARMADA_38X=y
16CONFIG_MACH_ARMADA_XP=y 16CONFIG_MACH_ARMADA_XP=y
17CONFIG_MACH_DOVE=y
17CONFIG_NEON=y 18CONFIG_NEON=y
18# CONFIG_CACHE_L2X0 is not set 19# CONFIG_CACHE_L2X0 is not set
19# CONFIG_SWP_EMULATE is not set 20# CONFIG_SWP_EMULATE is not set
@@ -52,6 +53,7 @@ CONFIG_INPUT_EVDEV=y
52CONFIG_KEYBOARD_GPIO=y 53CONFIG_KEYBOARD_GPIO=y
53CONFIG_SERIAL_8250=y 54CONFIG_SERIAL_8250=y
54CONFIG_SERIAL_8250_CONSOLE=y 55CONFIG_SERIAL_8250_CONSOLE=y
56CONFIG_SERIAL_OF_PLATFORM=y
55CONFIG_I2C=y 57CONFIG_I2C=y
56CONFIG_SPI=y 58CONFIG_SPI=y
57CONFIG_SPI_ORION=y 59CONFIG_SPI_ORION=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 59066cf0271a..536a137863cb 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -32,6 +32,7 @@ CONFIG_SOC_OMAP5=y
32CONFIG_SOC_AM33XX=y 32CONFIG_SOC_AM33XX=y
33CONFIG_SOC_AM43XX=y 33CONFIG_SOC_AM43XX=y
34CONFIG_SOC_DRA7XX=y 34CONFIG_SOC_DRA7XX=y
35CONFIG_CACHE_L2X0=y
35CONFIG_ARM_THUMBEE=y 36CONFIG_ARM_THUMBEE=y
36CONFIG_ARM_ERRATA_411920=y 37CONFIG_ARM_ERRATA_411920=y
37CONFIG_SMP=y 38CONFIG_SMP=y
diff --git a/arch/arm/configs/s5p64x0_defconfig b/arch/arm/configs/s5p64x0_defconfig
deleted file mode 100644
index ad6b61b0bd11..000000000000
--- a/arch/arm/configs/s5p64x0_defconfig
+++ /dev/null
@@ -1,68 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSFS_DEPRECATED_V2=y
3CONFIG_BLK_DEV_INITRD=y
4CONFIG_KALLSYMS_ALL=y
5CONFIG_MODULES=y
6CONFIG_MODULE_UNLOAD=y
7# CONFIG_BLK_DEV_BSG is not set
8CONFIG_ARCH_S5P64X0=y
9CONFIG_S3C_BOOT_ERROR_RESET=y
10CONFIG_S3C_LOWLEVEL_UART_PORT=1
11CONFIG_MACH_SMDK6440=y
12CONFIG_MACH_SMDK6450=y
13CONFIG_NO_HZ=y
14CONFIG_HIGH_RES_TIMERS=y
15CONFIG_CPU_32v6K=y
16CONFIG_AEABI=y
17CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc"
18CONFIG_FPE_NWFPE=y
19CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
20# CONFIG_PREVENT_FIRMWARE_BUILD is not set
21CONFIG_BLK_DEV_RAM=y
22CONFIG_BLK_DEV_RAM_SIZE=8192
23# CONFIG_MISC_DEVICES is not set
24CONFIG_SCSI=y
25CONFIG_BLK_DEV_SD=y
26CONFIG_CHR_DEV_SG=y
27CONFIG_INPUT_EVDEV=y
28CONFIG_INPUT_TOUCHSCREEN=y
29CONFIG_SERIAL_8250=y
30CONFIG_SERIAL_8250_NR_UARTS=3
31CONFIG_SERIAL_SAMSUNG=y
32CONFIG_SERIAL_SAMSUNG_CONSOLE=y
33CONFIG_HW_RANDOM=y
34# CONFIG_HWMON is not set
35CONFIG_DISPLAY_SUPPORT=y
36# CONFIG_VGA_CONSOLE is not set
37# CONFIG_HID_SUPPORT is not set
38# CONFIG_USB_SUPPORT is not set
39CONFIG_EXT2_FS=y
40CONFIG_EXT3_FS=y
41CONFIG_EXT3_FS_POSIX_ACL=y
42CONFIG_EXT3_FS_SECURITY=y
43CONFIG_INOTIFY=y
44CONFIG_MSDOS_FS=y
45CONFIG_VFAT_FS=y
46CONFIG_TMPFS=y
47CONFIG_TMPFS_POSIX_ACL=y
48CONFIG_CRAMFS=y
49CONFIG_ROMFS_FS=y
50CONFIG_NLS_CODEPAGE_437=y
51CONFIG_NLS_ASCII=y
52CONFIG_NLS_ISO8859_1=y
53CONFIG_MAGIC_SYSRQ=y
54CONFIG_DEBUG_KERNEL=y
55CONFIG_DEBUG_RT_MUTEXES=y
56CONFIG_DEBUG_SPINLOCK=y
57CONFIG_DEBUG_MUTEXES=y
58CONFIG_DEBUG_SPINLOCK_SLEEP=y
59CONFIG_DEBUG_INFO=y
60# CONFIG_RCU_CPU_STALL_DETECTOR is not set
61CONFIG_SYSCTL_SYSCALL_CHECK=y
62CONFIG_DEBUG_USER=y
63CONFIG_DEBUG_ERRORS=y
64CONFIG_DEBUG_LL=y
65CONFIG_DEBUG_S3C_UART=1
66CONFIG_CRYPTO=y
67# CONFIG_CRYPTO_ANSI_CPRNG is not set
68CONFIG_CRC_CCITT=y
diff --git a/arch/arm/configs/s5pc100_defconfig b/arch/arm/configs/s5pc100_defconfig
deleted file mode 100644
index 41bafc94dd85..000000000000
--- a/arch/arm/configs/s5pc100_defconfig
+++ /dev/null
@@ -1,49 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSFS_DEPRECATED_V2=y
3CONFIG_BLK_DEV_INITRD=y
4CONFIG_KALLSYMS_ALL=y
5CONFIG_MODULES=y
6CONFIG_MODULE_UNLOAD=y
7# CONFIG_BLK_DEV_BSG is not set
8CONFIG_ARCH_S5PC100=y
9CONFIG_MACH_SMDKC100=y
10CONFIG_AEABI=y
11CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=cramfs init=/linuxrc console=ttySAC2,115200 mem=128M"
12CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
13CONFIG_BLK_DEV_LOOP=y
14CONFIG_BLK_DEV_RAM=y
15CONFIG_BLK_DEV_RAM_SIZE=8192
16CONFIG_EEPROM_AT24=y
17CONFIG_SERIAL_8250=y
18CONFIG_SERIAL_SAMSUNG=y
19CONFIG_SERIAL_SAMSUNG_CONSOLE=y
20CONFIG_HW_RANDOM=y
21CONFIG_I2C=y
22CONFIG_I2C_CHARDEV=y
23# CONFIG_VGA_CONSOLE is not set
24CONFIG_MMC=y
25CONFIG_MMC_DEBUG=y
26CONFIG_MMC_UNSAFE_RESUME=y
27CONFIG_SDIO_UART=y
28CONFIG_MMC_SDHCI=y
29CONFIG_EXT2_FS=y
30CONFIG_EXT3_FS=y
31CONFIG_EXT3_FS_POSIX_ACL=y
32CONFIG_EXT3_FS_SECURITY=y
33CONFIG_INOTIFY=y
34CONFIG_TMPFS=y
35CONFIG_TMPFS_POSIX_ACL=y
36CONFIG_CRAMFS=y
37CONFIG_ROMFS_FS=y
38CONFIG_MAGIC_SYSRQ=y
39CONFIG_DEBUG_KERNEL=y
40CONFIG_DEBUG_RT_MUTEXES=y
41CONFIG_DEBUG_SPINLOCK=y
42CONFIG_DEBUG_MUTEXES=y
43CONFIG_DEBUG_SPINLOCK_SLEEP=y
44CONFIG_DEBUG_INFO=y
45# CONFIG_RCU_CPU_STALL_DETECTOR is not set
46CONFIG_SYSCTL_SYSCALL_CHECK=y
47CONFIG_DEBUG_USER=y
48CONFIG_DEBUG_ERRORS=y
49CONFIG_DEBUG_LL=y
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index eb577f4f5f70..39eb16b0066f 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -52,7 +52,7 @@ extern inline void *return_address(unsigned int level)
52 52
53#endif 53#endif
54 54
55#define ftrace_return_addr(n) return_address(n) 55#define ftrace_return_address(n) return_address(n)
56 56
57#endif /* ifndef __ASSEMBLY__ */ 57#endif /* ifndef __ASSEMBLY__ */
58 58
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 477e0206e016..504dcddebfcc 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -5,12 +5,6 @@
5#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO 5#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
6#endif 6#endif
7 7
8/* not all ARM platforms necessarily support this API ... */
9#ifdef CONFIG_NEED_MACH_GPIO_H
10#include <mach/gpio.h>
11#endif
12
13#ifndef __ARM_GPIOLIB_COMPLEX
14/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */ 8/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
15#include <asm-generic/gpio.h> 9#include <asm-generic/gpio.h>
16 10
@@ -18,7 +12,6 @@
18#define gpio_get_value __gpio_get_value 12#define gpio_get_value __gpio_get_value
19#define gpio_set_value __gpio_set_value 13#define gpio_set_value __gpio_set_value
20#define gpio_cansleep __gpio_cansleep 14#define gpio_cansleep __gpio_cansleep
21#endif
22 15
23/* 16/*
24 * Provide a default gpio_to_irq() which should satisfy every case. 17 * Provide a default gpio_to_irq() which should satisfy every case.
diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h
index d9702eb0b02b..94060adba174 100644
--- a/arch/arm/include/asm/mcpm.h
+++ b/arch/arm/include/asm/mcpm.h
@@ -208,8 +208,6 @@ struct sync_struct {
208 struct mcpm_sync_struct clusters[MAX_NR_CLUSTERS]; 208 struct mcpm_sync_struct clusters[MAX_NR_CLUSTERS];
209}; 209};
210 210
211extern unsigned long sync_phys; /* physical address of *mcpm_sync */
212
213void __mcpm_cpu_going_down(unsigned int cpu, unsigned int cluster); 211void __mcpm_cpu_going_down(unsigned int cpu, unsigned int cluster);
214void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster); 212void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster);
215void __mcpm_outbound_leave_critical(unsigned int cluster, int state); 213void __mcpm_outbound_leave_critical(unsigned int cluster, int state);
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index f989d7c22dc5..e4e4208a9130 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -114,8 +114,14 @@ static inline struct thread_info *current_thread_info(void)
114 ((unsigned long)(task_thread_info(tsk)->cpu_context.pc)) 114 ((unsigned long)(task_thread_info(tsk)->cpu_context.pc))
115#define thread_saved_sp(tsk) \ 115#define thread_saved_sp(tsk) \
116 ((unsigned long)(task_thread_info(tsk)->cpu_context.sp)) 116 ((unsigned long)(task_thread_info(tsk)->cpu_context.sp))
117
118#ifndef CONFIG_THUMB2_KERNEL
117#define thread_saved_fp(tsk) \ 119#define thread_saved_fp(tsk) \
118 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) 120 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
121#else
122#define thread_saved_fp(tsk) \
123 ((unsigned long)(task_thread_info(tsk)->cpu_context.r7))
124#endif
119 125
120extern void crunch_task_disable(struct thread_info *); 126extern void crunch_task_disable(struct thread_info *);
121extern void crunch_task_copy(struct thread_info *, void *); 127extern void crunch_task_copy(struct thread_info *, void *);
diff --git a/arch/arm/include/debug/clps711x.S b/arch/arm/include/debug/clps711x.S
new file mode 100644
index 000000000000..abe225436686
--- /dev/null
+++ b/arch/arm/include/debug/clps711x.S
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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
10#ifndef CONFIG_DEBUG_CLPS711X_UART2
11#define CLPS711X_UART_PADDR (0x80000000 + 0x0000)
12#define CLPS711X_UART_VADDR (0xfeff0000 + 0x0000)
13#else
14#define CLPS711X_UART_PADDR (0x80000000 + 0x1000)
15#define CLPS711X_UART_VADDR (0xfeff0000 + 0x1000)
16#endif
17
18#define SYSFLG (0x0140)
19#define SYSFLG_UBUSY (1 << 11)
20#define UARTDR (0x0480)
21
22 .macro addruart, rp, rv, tmp
23 ldr \rv, =CLPS711X_UART_VADDR
24 ldr \rp, =CLPS711X_UART_PADDR
25 .endm
26
27 .macro waituart,rd,rx
28 .endm
29
30 .macro senduart,rd,rx
31 str \rd, [\rx, #UARTDR]
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #SYSFLG]
36 tst \rd, #SYSFLG_UBUSY
37 bne 1001b
38 .endm
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 2037f7205987..1d37568c547a 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -1924,7 +1924,7 @@ static int krait_pmu_get_event_idx(struct pmu_hw_events *cpuc,
1924 struct perf_event *event) 1924 struct perf_event *event)
1925{ 1925{
1926 int idx; 1926 int idx;
1927 int bit; 1927 int bit = -1;
1928 unsigned int prefix; 1928 unsigned int prefix;
1929 unsigned int region; 1929 unsigned int region;
1930 unsigned int code; 1930 unsigned int code;
@@ -1953,7 +1953,7 @@ static int krait_pmu_get_event_idx(struct pmu_hw_events *cpuc,
1953 } 1953 }
1954 1954
1955 idx = armv7pmu_get_event_idx(cpuc, event); 1955 idx = armv7pmu_get_event_idx(cpuc, event);
1956 if (idx < 0 && krait_event) 1956 if (idx < 0 && bit >= 0)
1957 clear_bit(bit, cpuc->used_mask); 1957 clear_bit(bit, cpuc->used_mask);
1958 1958
1959 return idx; 1959 return idx;
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 0dd3b79b15c3..0c27ed6f3f23 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -908,7 +908,7 @@ enum ptrace_syscall_dir {
908 PTRACE_SYSCALL_EXIT, 908 PTRACE_SYSCALL_EXIT,
909}; 909};
910 910
911static int tracehook_report_syscall(struct pt_regs *regs, 911static void tracehook_report_syscall(struct pt_regs *regs,
912 enum ptrace_syscall_dir dir) 912 enum ptrace_syscall_dir dir)
913{ 913{
914 unsigned long ip; 914 unsigned long ip;
@@ -926,7 +926,6 @@ static int tracehook_report_syscall(struct pt_regs *regs,
926 current_thread_info()->syscall = -1; 926 current_thread_info()->syscall = -1;
927 927
928 regs->ARM_ip = ip; 928 regs->ARM_ip = ip;
929 return current_thread_info()->syscall;
930} 929}
931 930
932asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) 931asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
@@ -938,7 +937,9 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
938 return -1; 937 return -1;
939 938
940 if (test_thread_flag(TIF_SYSCALL_TRACE)) 939 if (test_thread_flag(TIF_SYSCALL_TRACE))
941 scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); 940 tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
941
942 scno = current_thread_info()->syscall;
942 943
943 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 944 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
944 trace_sys_enter(regs, scno); 945 trace_sys_enter(regs, scno);
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 9bc6db1c1348..41c839167e87 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -1,10 +1,9 @@
1config ARCH_BCM 1menuconfig ARCH_BCM
2 bool "Broadcom SoC Support" if ARCH_MULTI_V6_V7 2 bool "Broadcom SoC Support" if ARCH_MULTI_V6_V7
3 help 3 help
4 This enables support for Broadcom ARM based SoC chips 4 This enables support for Broadcom ARM based SoC chips
5 5
6menu "Broadcom SoC Selection" 6if ARCH_BCM
7 depends on ARCH_BCM
8 7
9config ARCH_BCM_MOBILE 8config ARCH_BCM_MOBILE
10 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7 9 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7
@@ -88,4 +87,4 @@ config ARCH_BCM_5301X
88 different SoC or with the older BCM47XX and BCM53XX based 87 different SoC or with the older BCM47XX and BCM53XX based
89 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx 88 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx
90 89
91endmenu 90endif
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index 101e0f356730..2631cfc5ab0d 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_BERLIN 1menuconfig ARCH_BERLIN
2 bool "Marvell Berlin SoCs" if ARCH_MULTI_V7 2 bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_GIC 4 select ARM_GIC
@@ -9,8 +9,6 @@ config ARCH_BERLIN
9 9
10if ARCH_BERLIN 10if ARCH_BERLIN
11 11
12menu "Marvell Berlin SoC variants"
13
14config MACH_BERLIN_BG2 12config MACH_BERLIN_BG2
15 bool "Marvell Armada 1500 (BG2)" 13 bool "Marvell Armada 1500 (BG2)"
16 select CACHE_L2X0 14 select CACHE_L2X0
@@ -30,6 +28,4 @@ config MACH_BERLIN_BG2Q
30 select HAVE_ARM_TWD if SMP 28 select HAVE_ARM_TWD if SMP
31 select PINCTRL_BERLIN_BG2Q 29 select PINCTRL_BERLIN_BG2Q
32 30
33endmenu
34
35endif 31endif
diff --git a/arch/arm/mach-clps711x/board-autcpu12.c b/arch/arm/mach-clps711x/board-autcpu12.c
index d62ca16d5394..45abf6bd5f68 100644
--- a/arch/arm/mach-clps711x/board-autcpu12.c
+++ b/arch/arm/mach-clps711x/board-autcpu12.c
@@ -266,7 +266,6 @@ MACHINE_START(AUTCPU12, "autronix autcpu12")
266 /* Maintainer: Thomas Gleixner */ 266 /* Maintainer: Thomas Gleixner */
267 .atag_offset = 0x20000, 267 .atag_offset = 0x20000,
268 .map_io = clps711x_map_io, 268 .map_io = clps711x_map_io,
269 .init_early = clps711x_init_early,
270 .init_irq = clps711x_init_irq, 269 .init_irq = clps711x_init_irq,
271 .init_time = clps711x_timer_init, 270 .init_time = clps711x_timer_init,
272 .init_machine = autcpu12_init, 271 .init_machine = autcpu12_init,
diff --git a/arch/arm/mach-clps711x/board-cdb89712.c b/arch/arm/mach-clps711x/board-cdb89712.c
index e261a47f2aff..1ec378c334e5 100644
--- a/arch/arm/mach-clps711x/board-cdb89712.c
+++ b/arch/arm/mach-clps711x/board-cdb89712.c
@@ -140,7 +140,6 @@ MACHINE_START(CDB89712, "Cirrus-CDB89712")
140 /* Maintainer: Ray Lehtiniemi */ 140 /* Maintainer: Ray Lehtiniemi */
141 .atag_offset = 0x100, 141 .atag_offset = 0x100,
142 .map_io = clps711x_map_io, 142 .map_io = clps711x_map_io,
143 .init_early = clps711x_init_early,
144 .init_irq = clps711x_init_irq, 143 .init_irq = clps711x_init_irq,
145 .init_time = clps711x_timer_init, 144 .init_time = clps711x_timer_init,
146 .init_machine = cdb89712_init, 145 .init_machine = cdb89712_init,
diff --git a/arch/arm/mach-clps711x/board-clep7312.c b/arch/arm/mach-clps711x/board-clep7312.c
index 94a7add88a3f..f9ca22b646bf 100644
--- a/arch/arm/mach-clps711x/board-clep7312.c
+++ b/arch/arm/mach-clps711x/board-clep7312.c
@@ -25,6 +25,7 @@
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26 26
27#include "common.h" 27#include "common.h"
28#include "devices.h"
28 29
29static void __init 30static void __init
30fixup_clep7312(struct tag *tags, char **cmdline) 31fixup_clep7312(struct tag *tags, char **cmdline)
@@ -37,8 +38,8 @@ MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
37 .atag_offset = 0x0100, 38 .atag_offset = 0x0100,
38 .fixup = fixup_clep7312, 39 .fixup = fixup_clep7312,
39 .map_io = clps711x_map_io, 40 .map_io = clps711x_map_io,
40 .init_early = clps711x_init_early,
41 .init_irq = clps711x_init_irq, 41 .init_irq = clps711x_init_irq,
42 .init_time = clps711x_timer_init, 42 .init_time = clps711x_timer_init,
43 .init_machine = clps711x_devices_init,
43 .restart = clps711x_restart, 44 .restart = clps711x_restart,
44MACHINE_END 45MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
index f9828f89972a..e6e06099d052 100644
--- a/arch/arm/mach-clps711x/board-edb7211.c
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -148,11 +148,6 @@ fixup_edb7211(struct tag *tags, char **cmdline)
148 memblock_add(0xc1000000, SZ_8M); 148 memblock_add(0xc1000000, SZ_8M);
149} 149}
150 150
151static void __init edb7211_init(void)
152{
153 clps711x_devices_init();
154}
155
156static void __init edb7211_init_late(void) 151static void __init edb7211_init_late(void)
157{ 152{
158 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); 153 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
@@ -178,10 +173,9 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
178 .fixup = fixup_edb7211, 173 .fixup = fixup_edb7211,
179 .reserve = edb7211_reserve, 174 .reserve = edb7211_reserve,
180 .map_io = clps711x_map_io, 175 .map_io = clps711x_map_io,
181 .init_early = clps711x_init_early,
182 .init_irq = clps711x_init_irq, 176 .init_irq = clps711x_init_irq,
183 .init_time = clps711x_timer_init, 177 .init_time = clps711x_timer_init,
184 .init_machine = edb7211_init, 178 .init_machine = clps711x_devices_init,
185 .init_late = edb7211_init_late, 179 .init_late = edb7211_init_late,
186 .restart = clps711x_restart, 180 .restart = clps711x_restart,
187MACHINE_END 181MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-p720t.c b/arch/arm/mach-clps711x/board-p720t.c
index 0cf0e51e6546..b9937676b6be 100644
--- a/arch/arm/mach-clps711x/board-p720t.c
+++ b/arch/arm/mach-clps711x/board-p720t.c
@@ -365,7 +365,6 @@ MACHINE_START(P720T, "ARM-Prospector720T")
365 .atag_offset = 0x100, 365 .atag_offset = 0x100,
366 .fixup = fixup_p720t, 366 .fixup = fixup_p720t,
367 .map_io = clps711x_map_io, 367 .map_io = clps711x_map_io,
368 .init_early = clps711x_init_early,
369 .init_irq = clps711x_init_irq, 368 .init_irq = clps711x_init_irq,
370 .init_time = clps711x_timer_init, 369 .init_time = clps711x_timer_init,
371 .init_machine = p720t_init, 370 .init_machine = p720t_init,
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index aee81fa46ccf..2a6323b15782 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -193,15 +193,3 @@ void clps711x_restart(enum reboot_mode mode, const char *cmd)
193{ 193{
194 soft_restart(0); 194 soft_restart(0);
195} 195}
196
197static void clps711x_idle(void)
198{
199 clps_writel(1, HALT);
200 asm("mov r0, r0");
201 asm("mov r0, r0");
202}
203
204void __init clps711x_init_early(void)
205{
206 arm_pm_idle = clps711x_idle;
207}
diff --git a/arch/arm/mach-clps711x/common.h b/arch/arm/mach-clps711x/common.h
index 7489139d5d63..f88189963898 100644
--- a/arch/arm/mach-clps711x/common.h
+++ b/arch/arm/mach-clps711x/common.h
@@ -13,7 +13,6 @@ extern void clps711x_map_io(void);
13extern void clps711x_init_irq(void); 13extern void clps711x_init_irq(void);
14extern void clps711x_timer_init(void); 14extern void clps711x_timer_init(void);
15extern void clps711x_restart(enum reboot_mode mode, const char *cmd); 15extern void clps711x_restart(enum reboot_mode mode, const char *cmd);
16extern void clps711x_init_early(void);
17 16
18/* drivers/irqchip/irq-clps711x.c */ 17/* drivers/irqchip/irq-clps711x.c */
19void clps711x_intc_init(phys_addr_t, resource_size_t); 18void clps711x_intc_init(phys_addr_t, resource_size_t);
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c
index 2001488a5ef2..0c689d3a6710 100644
--- a/arch/arm/mach-clps711x/devices.c
+++ b/arch/arm/mach-clps711x/devices.c
@@ -14,6 +14,15 @@
14 14
15#include <mach/hardware.h> 15#include <mach/hardware.h>
16 16
17static const struct resource clps711x_cpuidle_res __initconst =
18 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + HALT, SZ_128);
19
20static void __init clps711x_add_cpuidle(void)
21{
22 platform_device_register_simple("clps711x-cpuidle", PLATFORM_DEVID_NONE,
23 &clps711x_cpuidle_res, 1);
24}
25
17static const phys_addr_t clps711x_gpios[][2] __initconst = { 26static const phys_addr_t clps711x_gpios[][2] __initconst = {
18 { PADR, PADDR }, 27 { PADR, PADDR },
19 { PBDR, PBDDR }, 28 { PBDR, PBDDR },
@@ -83,6 +92,7 @@ static void __init clps711x_add_uart(void)
83 92
84void __init clps711x_devices_init(void) 93void __init clps711x_devices_init(void)
85{ 94{
95 clps711x_add_cpuidle();
86 clps711x_add_gpio(); 96 clps711x_add_gpio();
87 clps711x_add_syscon(); 97 clps711x_add_syscon();
88 clps711x_add_uart(); 98 clps711x_add_uart();
diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S
deleted file mode 100644
index cb3684f8dae0..000000000000
--- a/arch/arm/mach-clps711x/include/mach/debug-macro.S
+++ /dev/null
@@ -1,38 +0,0 @@
1/* arch/arm/mach-clps711x/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#include <mach/hardware.h>
15
16 .macro addruart, rp, rv, tmp
17#ifndef CONFIG_DEBUG_CLPS711X_UART2
18 mov \rp, #0x0000 @ UART1
19#else
20 mov \rp, #0x1000 @ UART2
21#endif
22 orr \rv, \rp, #CLPS711X_VIRT_BASE
23 orr \rp, \rp, #CLPS711X_PHYS_BASE
24 .endm
25
26 .macro senduart,rd,rx
27 str \rd, [\rx, #0x0480] @ UARTDR
28 .endm
29
30 .macro waituart,rd,rx
31 .endm
32
33 .macro busyuart,rd,rx
341001: ldr \rd, [\rx, #0x0140] @ SYSFLGx
35 tst \rd, #1 << 11 @ UBUSYx
36 bne 1001b
37 .endm
38
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h
index 5d6afda1c0e8..833129c9f798 100644
--- a/arch/arm/mach-clps711x/include/mach/hardware.h
+++ b/arch/arm/mach-clps711x/include/mach/hardware.h
@@ -24,10 +24,7 @@
24 24
25#include <mach/clps711x.h> 25#include <mach/clps711x.h>
26 26
27#define IO_ADDRESS(x) (0xdc000000 + (((x) & 0x03ffffff) | \ 27#define CLPS711X_VIRT_BASE IOMEM(0xfeff0000)
28 (((x) >> 2) & 0x3c000000)))
29
30#define CLPS711X_VIRT_BASE IOMEM(IO_ADDRESS(CLPS711X_PHYS_BASE))
31 28
32#ifndef __ASSEMBLY__ 29#ifndef __ASSEMBLY__
33#define clps_readb(off) readb(CLPS711X_VIRT_BASE + (off)) 30#define clps_readb(off) readb(CLPS711X_VIRT_BASE + (off))
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig
index 66838f42037f..3c22a1990ecd 100644
--- a/arch/arm/mach-cns3xxx/Kconfig
+++ b/arch/arm/mach-cns3xxx/Kconfig
@@ -1,12 +1,11 @@
1config ARCH_CNS3XXX 1menuconfig ARCH_CNS3XXX
2 bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6 2 bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6
3 select ARM_GIC 3 select ARM_GIC
4 select PCI_DOMAINS if PCI 4 select PCI_DOMAINS if PCI
5 help 5 help
6 Support for Cavium Networks CNS3XXX platform. 6 Support for Cavium Networks CNS3XXX platform.
7 7
8menu "CNS3XXX platform type" 8if ARCH_CNS3XXX
9 depends on ARCH_CNS3XXX
10 9
11config MACH_CNS3420VB 10config MACH_CNS3420VB
12 bool "Support for CNS3420 Validation Board" 11 bool "Support for CNS3420 Validation Board"
@@ -17,4 +16,4 @@ config MACH_CNS3420VB
17 This is a platform with an on-board ARM11 MPCore and has support 16 This is a platform with an on-board ARM11 MPCore and has support
18 for USB, USB-OTG, MMC/SD/SDIO, SATA, PCI-E, etc. 17 for USB, USB-OTG, MMC/SD/SDIO, SATA, PCI-E, etc.
19 18
20endmenu 19endif
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index db18ef866593..584e8d4e2892 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -39,7 +39,6 @@ config ARCH_DAVINCI_DA830
39config ARCH_DAVINCI_DA850 39config ARCH_DAVINCI_DA850
40 bool "DA850/OMAP-L138/AM18x based system" 40 bool "DA850/OMAP-L138/AM18x based system"
41 select ARCH_DAVINCI_DA8XX 41 select ARCH_DAVINCI_DA8XX
42 select ARCH_HAS_CPUFREQ
43 select CP_INTC 42 select CP_INTC
44 43
45config ARCH_DAVINCI_DA8XX 44config ARCH_DAVINCI_DA8XX
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index d58995c9a95a..8f9b66c4ac78 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -7,10 +7,9 @@
7 7
8# Configuration options for the EXYNOS4 8# Configuration options for the EXYNOS4
9 9
10config ARCH_EXYNOS 10menuconfig ARCH_EXYNOS
11 bool "Samsung EXYNOS" if ARCH_MULTI_V7 11 bool "Samsung EXYNOS" if ARCH_MULTI_V7
12 select ARCH_HAS_BANDGAP 12 select ARCH_HAS_BANDGAP
13 select ARCH_HAS_CPUFREQ
14 select ARCH_HAS_HOLES_MEMORYMODEL 13 select ARCH_HAS_HOLES_MEMORYMODEL
15 select ARCH_REQUIRE_GPIOLIB 14 select ARCH_REQUIRE_GPIOLIB
16 select ARM_AMBA 15 select ARM_AMBA
@@ -30,8 +29,6 @@ config ARCH_EXYNOS
30 29
31if ARCH_EXYNOS 30if ARCH_EXYNOS
32 31
33menu "SAMSUNG EXYNOS SoCs Support"
34
35config ARCH_EXYNOS3 32config ARCH_EXYNOS3
36 bool "SAMSUNG EXYNOS3" 33 bool "SAMSUNG EXYNOS3"
37 select ARM_CPU_SUSPEND if PM 34 select ARM_CPU_SUSPEND if PM
@@ -118,8 +115,6 @@ config SOC_EXYNOS5800
118 default y 115 default y
119 depends on SOC_EXYNOS5420 116 depends on SOC_EXYNOS5420
120 117
121endmenu
122
123config EXYNOS5420_MCPM 118config EXYNOS5420_MCPM
124 bool "Exynos5420 Multi-Cluster PM support" 119 bool "Exynos5420 Multi-Cluster PM support"
125 depends on MCPM && SOC_EXYNOS5420 120 depends on MCPM && SOC_EXYNOS5420
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 16617bdb37a9..1ee91763fa7c 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -118,6 +118,7 @@ extern void __iomem *sysram_ns_base_addr;
118extern void __iomem *sysram_base_addr; 118extern void __iomem *sysram_base_addr;
119void exynos_init_io(void); 119void exynos_init_io(void);
120void exynos_restart(enum reboot_mode mode, const char *cmd); 120void exynos_restart(enum reboot_mode mode, const char *cmd);
121void exynos_sysram_init(void);
121void exynos_cpuidle_init(void); 122void exynos_cpuidle_init(void);
122void exynos_cpufreq_init(void); 123void exynos_cpufreq_init(void);
123void exynos_init_late(void); 124void exynos_init_late(void);
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 90aab4d75d08..f38cf7c110cc 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -184,6 +184,28 @@ void __init exynos_cpufreq_init(void)
184 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); 184 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
185} 185}
186 186
187void __iomem *sysram_base_addr;
188void __iomem *sysram_ns_base_addr;
189
190void __init exynos_sysram_init(void)
191{
192 struct device_node *node;
193
194 for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") {
195 if (!of_device_is_available(node))
196 continue;
197 sysram_base_addr = of_iomap(node, 0);
198 break;
199 }
200
201 for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") {
202 if (!of_device_is_available(node))
203 continue;
204 sysram_ns_base_addr = of_iomap(node, 0);
205 break;
206 }
207}
208
187void __init exynos_init_late(void) 209void __init exynos_init_late(void)
188{ 210{
189 if (of_machine_is_compatible("samsung,exynos5440")) 211 if (of_machine_is_compatible("samsung,exynos5440"))
@@ -198,7 +220,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
198 int depth, void *data) 220 int depth, void *data)
199{ 221{
200 struct map_desc iodesc; 222 struct map_desc iodesc;
201 __be32 *reg; 223 const __be32 *reg;
202 int len; 224 int len;
203 225
204 if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && 226 if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") &&
@@ -271,6 +293,13 @@ static void __init exynos_dt_machine_init(void)
271 } 293 }
272 } 294 }
273 295
296 /*
297 * This is called from smp_prepare_cpus if we've built for SMP, but
298 * we still need to set it up for PM and firmware ops if not.
299 */
300 if (!IS_ENABLED(SMP))
301 exynos_sysram_init();
302
274 exynos_cpuidle_init(); 303 exynos_cpuidle_init();
275 exynos_cpufreq_init(); 304 exynos_cpufreq_init();
276 305
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 69fa48397394..8a134d019cb3 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -46,13 +46,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
46 if (cpu == 1) 46 if (cpu == 1)
47 exynos_cpu_power_down(cpu); 47 exynos_cpu_power_down(cpu);
48 48
49 /* 49 wfi();
50 * here's the WFI
51 */
52 asm(".word 0xe320f003\n"
53 :
54 :
55 : "memory", "cc");
56 50
57 if (pen_release == cpu_logical_map(cpu)) { 51 if (pen_release == cpu_logical_map(cpu)) {
58 /* 52 /*
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index 0498d0b887ef..ace0ed617476 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -25,7 +25,6 @@
25 25
26#define EXYNOS5420_CPUS_PER_CLUSTER 4 26#define EXYNOS5420_CPUS_PER_CLUSTER 4
27#define EXYNOS5420_NR_CLUSTERS 2 27#define EXYNOS5420_NR_CLUSTERS 2
28#define MCPM_BOOT_ADDR_OFFSET 0x1c
29 28
30/* 29/*
31 * The common v7_exit_coherency_flush API could not be used because of the 30 * The common v7_exit_coherency_flush API could not be used because of the
@@ -343,11 +342,13 @@ static int __init exynos_mcpm_init(void)
343 pr_info("Exynos MCPM support installed\n"); 342 pr_info("Exynos MCPM support installed\n");
344 343
345 /* 344 /*
346 * Future entries into the kernel can now go 345 * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr
347 * through the cluster entry vectors. 346 * as part of secondary_cpu_start(). Let's redirect it to the
347 * mcpm_entry_point().
348 */ 348 */
349 __raw_writel(virt_to_phys(mcpm_entry_point), 349 __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */
350 ns_sram_base_addr + MCPM_BOOT_ADDR_OFFSET); 350 __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */
351 __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8);
351 352
352 iounmap(ns_sram_base_addr); 353 iounmap(ns_sram_base_addr);
353 354
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index ec02422e8499..1c8d31e39520 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -32,28 +32,6 @@
32 32
33extern void exynos4_secondary_startup(void); 33extern void exynos4_secondary_startup(void);
34 34
35void __iomem *sysram_base_addr;
36void __iomem *sysram_ns_base_addr;
37
38static void __init exynos_smp_prepare_sysram(void)
39{
40 struct device_node *node;
41
42 for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") {
43 if (!of_device_is_available(node))
44 continue;
45 sysram_base_addr = of_iomap(node, 0);
46 break;
47 }
48
49 for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") {
50 if (!of_device_is_available(node))
51 continue;
52 sysram_ns_base_addr = of_iomap(node, 0);
53 break;
54 }
55}
56
57static inline void __iomem *cpu_boot_reg_base(void) 35static inline void __iomem *cpu_boot_reg_base(void)
58{ 36{
59 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) 37 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
@@ -234,11 +212,11 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
234{ 212{
235 int i; 213 int i;
236 214
215 exynos_sysram_init();
216
237 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) 217 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
238 scu_enable(scu_base_addr()); 218 scu_enable(scu_base_addr());
239 219
240 exynos_smp_prepare_sysram();
241
242 /* 220 /*
243 * Write the address of secondary startup into the 221 * Write the address of secondary startup into the
244 * system-wide flags register. The boot monitor waits 222 * system-wide flags register. The boot monitor waits
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 87c0d34c7fba..202ca73e49c4 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -300,7 +300,7 @@ static int exynos_pm_suspend(void)
300 tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0); 300 tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
301 __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION); 301 __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
302 302
303 if (!soc_is_exynos5250()) 303 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
304 exynos_cpu_save_register(); 304 exynos_cpu_save_register();
305 305
306 return 0; 306 return 0;
@@ -334,7 +334,7 @@ static void exynos_pm_resume(void)
334 if (exynos_pm_central_resume()) 334 if (exynos_pm_central_resume())
335 goto early_wakeup; 335 goto early_wakeup;
336 336
337 if (!soc_is_exynos5250()) 337 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
338 exynos_cpu_restore_register(); 338 exynos_cpu_restore_register();
339 339
340 /* For release retention */ 340 /* For release retention */
@@ -353,7 +353,7 @@ static void exynos_pm_resume(void)
353 353
354 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save)); 354 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
355 355
356 if (!soc_is_exynos5250()) 356 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
357 scu_enable(S5P_VA_SCU); 357 scu_enable(S5P_VA_SCU);
358 358
359early_wakeup: 359early_wakeup:
@@ -440,15 +440,18 @@ static int exynos_cpu_pm_notifier(struct notifier_block *self,
440 case CPU_PM_ENTER: 440 case CPU_PM_ENTER:
441 if (cpu == 0) { 441 if (cpu == 0) {
442 exynos_pm_central_suspend(); 442 exynos_pm_central_suspend();
443 exynos_cpu_save_register(); 443 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
444 exynos_cpu_save_register();
444 } 445 }
445 break; 446 break;
446 447
447 case CPU_PM_EXIT: 448 case CPU_PM_EXIT:
448 if (cpu == 0) { 449 if (cpu == 0) {
449 if (!soc_is_exynos5250()) 450 if (read_cpuid_part_number() ==
451 ARM_CPU_PART_CORTEX_A9) {
450 scu_enable(S5P_VA_SCU); 452 scu_enable(S5P_VA_SCU);
451 exynos_cpu_restore_register(); 453 exynos_cpu_restore_register();
454 }
452 exynos_pm_central_resume(); 455 exynos_pm_central_resume();
453 } 456 }
454 break; 457 break;
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index 830b76e70250..a5960e2ac090 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -1,7 +1,6 @@
1config ARCH_HIGHBANK 1config ARCH_HIGHBANK
2 bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7 2 bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7
3 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 3 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
4 select ARCH_HAS_CPUFREQ
5 select ARCH_HAS_HOLES_MEMORYMODEL 4 select ARCH_HAS_HOLES_MEMORYMODEL
6 select ARCH_HAS_OPP 5 select ARCH_HAS_OPP
7 select ARCH_SUPPORTS_BIG_ENDIAN 6 select ARCH_SUPPORTS_BIG_ENDIAN
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 8d42eab76d53..4b5185748f74 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_MXC 1menuconfig ARCH_MXC
2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7
3 select ARCH_HAS_CPUFREQ
4 select ARCH_HAS_OPP 3 select ARCH_HAS_OPP
5 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
6 select ARM_CPU_SUSPEND if PM 5 select ARM_CPU_SUSPEND if PM
@@ -13,8 +12,7 @@ config ARCH_MXC
13 help 12 help
14 Support for Freescale MXC/iMX-based family of processors 13 Support for Freescale MXC/iMX-based family of processors
15 14
16menu "Freescale i.MX support" 15if ARCH_MXC
17 depends on ARCH_MXC
18 16
19config MXC_TZIC 17config MXC_TZIC
20 bool 18 bool
@@ -99,7 +97,6 @@ config SOC_IMX25
99 97
100config SOC_IMX27 98config SOC_IMX27
101 bool 99 bool
102 select ARCH_HAS_CPUFREQ
103 select ARCH_HAS_OPP 100 select ARCH_HAS_OPP
104 select CPU_ARM926T 101 select CPU_ARM926T
105 select IMX_HAVE_IOMUX_V1 102 select IMX_HAVE_IOMUX_V1
@@ -124,7 +121,6 @@ config SOC_IMX35
124 121
125config SOC_IMX5 122config SOC_IMX5
126 bool 123 bool
127 select ARCH_HAS_CPUFREQ
128 select ARCH_HAS_OPP 124 select ARCH_HAS_OPP
129 select ARCH_MXC_IOMUX_V3 125 select ARCH_MXC_IOMUX_V3
130 select MXC_TZIC 126 select MXC_TZIC
@@ -738,9 +734,9 @@ config SOC_IMX6
738 select HAVE_IMX_MMDC 734 select HAVE_IMX_MMDC
739 select HAVE_IMX_SRC 735 select HAVE_IMX_SRC
740 select MFD_SYSCON 736 select MFD_SYSCON
741 select PL310_ERRATA_588369 if CACHE_PL310 737 select PL310_ERRATA_588369 if CACHE_L2X0
742 select PL310_ERRATA_727915 if CACHE_PL310 738 select PL310_ERRATA_727915 if CACHE_L2X0
743 select PL310_ERRATA_769419 if CACHE_PL310 739 select PL310_ERRATA_769419 if CACHE_L2X0
744 740
745config SOC_IMX6Q 741config SOC_IMX6Q
746 bool "i.MX6 Quad/DualLite support" 742 bool "i.MX6 Quad/DualLite support"
@@ -775,9 +771,9 @@ config SOC_VF610
775 select ARM_GIC 771 select ARM_GIC
776 select PINCTRL_VF610 772 select PINCTRL_VF610
777 select VF_PIT_TIMER 773 select VF_PIT_TIMER
778 select PL310_ERRATA_588369 if CACHE_PL310 774 select PL310_ERRATA_588369 if CACHE_L2X0
779 select PL310_ERRATA_727915 if CACHE_PL310 775 select PL310_ERRATA_727915 if CACHE_L2X0
780 select PL310_ERRATA_769419 if CACHE_PL310 776 select PL310_ERRATA_769419 if CACHE_L2X0
781 777
782 help 778 help
783 This enable support for Freescale Vybrid VF610 processor. 779 This enable support for Freescale Vybrid VF610 processor.
@@ -786,4 +782,4 @@ endif
786 782
787source "arch/arm/mach-imx/devices/Kconfig" 783source "arch/arm/mach-imx/devices/Kconfig"
788 784
789endmenu 785endif
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index 21cf06cebade..5408ca70c8d6 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -312,6 +312,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
312 clks[IMX6SL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); 312 clks[IMX6SL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2);
313 clks[IMX6SL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); 313 clks[IMX6SL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4);
314 clks[IMX6SL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); 314 clks[IMX6SL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6);
315 clks[IMX6SL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10);
315 clks[IMX6SL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); 316 clks[IMX6SL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12);
316 clks[IMX6SL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); 317 clks[IMX6SL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14);
317 clks[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16); 318 clks[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16);
diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index ba43321001d8..c455e974bbfe 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -17,7 +17,6 @@ config ARCH_INTEGRATOR_CP
17 bool "Support Integrator/CP platform" 17 bool "Support Integrator/CP platform"
18 select ARCH_CINTEGRATOR 18 select ARCH_CINTEGRATOR
19 select ARM_TIMER_SP804 19 select ARM_TIMER_SP804
20 select PLAT_VERSATILE_CLCD
21 select SERIAL_AMBA_PL011 if TTY 20 select SERIAL_AMBA_PL011 if TTY
22 select SERIAL_AMBA_PL011_CONSOLE if TTY 21 select SERIAL_AMBA_PL011_CONSOLE if TTY
23 select SOC_BUS 22 select SOC_BUS
@@ -28,7 +27,7 @@ config ARCH_CINTEGRATOR
28 bool 27 bool
29 28
30config INTEGRATOR_IMPD1 29config INTEGRATOR_IMPD1
31 tristate "Include support for Integrator/IM-PD1" 30 bool "Include support for Integrator/IM-PD1"
32 depends on ARCH_INTEGRATOR_AP 31 depends on ARCH_INTEGRATOR_AP
33 select ARCH_REQUIRE_GPIOLIB 32 select ARCH_REQUIRE_GPIOLIB
34 select ARM_VIC 33 select ARM_VIC
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 0e870ea818c4..3ce880729cff 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -308,7 +308,12 @@ static struct impd1_device impd1_devs[] = {
308 */ 308 */
309#define IMPD1_VALID_IRQS 0x00000bffU 309#define IMPD1_VALID_IRQS 0x00000bffU
310 310
311static int __init impd1_probe(struct lm_device *dev) 311/*
312 * As this module is bool, it is OK to have this as __init_refok() - no
313 * probe calls will be done after the initial system bootup, as devices
314 * are discovered as part of the machine startup.
315 */
316static int __init_refok impd1_probe(struct lm_device *dev)
312{ 317{
313 struct impd1_module *impd1; 318 struct impd1_module *impd1;
314 int irq_base; 319 int irq_base;
@@ -397,6 +402,11 @@ static void impd1_remove(struct lm_device *dev)
397static struct lm_driver impd1_driver = { 402static struct lm_driver impd1_driver = {
398 .drv = { 403 .drv = {
399 .name = "impd1", 404 .name = "impd1",
405 /*
406 * As we're dropping the probe() function, suppress driver
407 * binding from sysfs.
408 */
409 .suppress_bind_attrs = true,
400 }, 410 },
401 .probe = impd1_probe, 411 .probe = impd1_probe,
402 .remove = impd1_remove, 412 .remove = impd1_remove,
diff --git a/arch/arm/mach-integrator/include/mach/memory.h b/arch/arm/mach-integrator/include/mach/memory.h
deleted file mode 100644
index 334d5e271889..000000000000
--- a/arch/arm/mach-integrator/include/mach/memory.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * arch/arm/mach-integrator/include/mach/memory.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23/*
24 * Physical DRAM offset.
25 */
26#define PLAT_PHYS_OFFSET UL(0x00000000)
27
28#define BUS_OFFSET UL(0x80000000)
29#define __virt_to_bus(x) ((x) - PAGE_OFFSET + BUS_OFFSET)
30#define __bus_to_virt(x) ((x) - BUS_OFFSET + PAGE_OFFSET)
31#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - PHYS_OFFSET))
32#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - PHYS_OFFSET))
33
34#endif
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index dd0cc677d596..660ca6feff40 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -480,25 +480,18 @@ static const struct of_device_id ebi_match[] = {
480static void __init ap_init_of(void) 480static void __init ap_init_of(void)
481{ 481{
482 unsigned long sc_dec; 482 unsigned long sc_dec;
483 struct device_node *root;
484 struct device_node *syscon; 483 struct device_node *syscon;
485 struct device_node *ebi; 484 struct device_node *ebi;
486 struct device *parent; 485 struct device *parent;
487 struct soc_device *soc_dev; 486 struct soc_device *soc_dev;
488 struct soc_device_attribute *soc_dev_attr; 487 struct soc_device_attribute *soc_dev_attr;
489 u32 ap_sc_id; 488 u32 ap_sc_id;
490 int err;
491 int i; 489 int i;
492 490
493 /* Here we create an SoC device for the root node */ 491 syscon = of_find_matching_node(NULL, ap_syscon_match);
494 root = of_find_node_by_path("/");
495 if (!root)
496 return;
497
498 syscon = of_find_matching_node(root, ap_syscon_match);
499 if (!syscon) 492 if (!syscon)
500 return; 493 return;
501 ebi = of_find_matching_node(root, ebi_match); 494 ebi = of_find_matching_node(NULL, ebi_match);
502 if (!ebi) 495 if (!ebi)
503 return; 496 return;
504 497
@@ -509,19 +502,17 @@ static void __init ap_init_of(void)
509 if (!ebi_base) 502 if (!ebi_base)
510 return; 503 return;
511 504
505 of_platform_populate(NULL, of_default_bus_match_table,
506 ap_auxdata_lookup, NULL);
507
512 ap_sc_id = readl(ap_syscon_base); 508 ap_sc_id = readl(ap_syscon_base);
513 509
514 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 510 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
515 if (!soc_dev_attr) 511 if (!soc_dev_attr)
516 return; 512 return;
517 513
518 err = of_property_read_string(root, "compatible", 514 soc_dev_attr->soc_id = "XVC";
519 &soc_dev_attr->soc_id); 515 soc_dev_attr->machine = "Integrator/AP";
520 if (err)
521 return;
522 err = of_property_read_string(root, "model", &soc_dev_attr->machine);
523 if (err)
524 return;
525 soc_dev_attr->family = "Integrator"; 516 soc_dev_attr->family = "Integrator";
526 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", 517 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
527 'A' + (ap_sc_id & 0x0f)); 518 'A' + (ap_sc_id & 0x0f));
@@ -536,9 +527,6 @@ static void __init ap_init_of(void)
536 parent = soc_device_to_device(soc_dev); 527 parent = soc_device_to_device(soc_dev);
537 integrator_init_sysfs(parent, ap_sc_id); 528 integrator_init_sysfs(parent, ap_sc_id);
538 529
539 of_platform_populate(root, of_default_bus_match_table,
540 ap_auxdata_lookup, parent);
541
542 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); 530 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
543 for (i = 0; i < 4; i++) { 531 for (i = 0; i < 4; i++) {
544 struct lm_device *lmdev; 532 struct lm_device *lmdev;
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index a938242b0c95..e39097068cf9 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -18,6 +18,7 @@
18#include <linux/amba/bus.h> 18#include <linux/amba/bus.h>
19#include <linux/amba/kmi.h> 19#include <linux/amba/kmi.h>
20#include <linux/amba/clcd.h> 20#include <linux/amba/clcd.h>
21#include <linux/platform_data/video-clcd-versatile.h>
21#include <linux/amba/mmci.h> 22#include <linux/amba/mmci.h>
22#include <linux/io.h> 23#include <linux/io.h>
23#include <linux/irqchip/versatile-fpga.h> 24#include <linux/irqchip/versatile-fpga.h>
@@ -36,8 +37,6 @@
36#include <asm/mach/map.h> 37#include <asm/mach/map.h>
37#include <asm/mach/time.h> 38#include <asm/mach/time.h>
38 39
39#include <plat/clcd.h>
40
41#include "hardware.h" 40#include "hardware.h"
42#include "cm.h" 41#include "cm.h"
43#include "common.h" 42#include "common.h"
@@ -279,20 +278,13 @@ static const struct of_device_id intcp_syscon_match[] = {
279 278
280static void __init intcp_init_of(void) 279static void __init intcp_init_of(void)
281{ 280{
282 struct device_node *root;
283 struct device_node *cpcon; 281 struct device_node *cpcon;
284 struct device *parent; 282 struct device *parent;
285 struct soc_device *soc_dev; 283 struct soc_device *soc_dev;
286 struct soc_device_attribute *soc_dev_attr; 284 struct soc_device_attribute *soc_dev_attr;
287 u32 intcp_sc_id; 285 u32 intcp_sc_id;
288 int err;
289
290 /* Here we create an SoC device for the root node */
291 root = of_find_node_by_path("/");
292 if (!root)
293 return;
294 286
295 cpcon = of_find_matching_node(root, intcp_syscon_match); 287 cpcon = of_find_matching_node(NULL, intcp_syscon_match);
296 if (!cpcon) 288 if (!cpcon)
297 return; 289 return;
298 290
@@ -300,19 +292,17 @@ static void __init intcp_init_of(void)
300 if (!intcp_con_base) 292 if (!intcp_con_base)
301 return; 293 return;
302 294
295 of_platform_populate(NULL, of_default_bus_match_table,
296 intcp_auxdata_lookup, NULL);
297
303 intcp_sc_id = readl(intcp_con_base); 298 intcp_sc_id = readl(intcp_con_base);
304 299
305 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 300 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
306 if (!soc_dev_attr) 301 if (!soc_dev_attr)
307 return; 302 return;
308 303
309 err = of_property_read_string(root, "compatible", 304 soc_dev_attr->soc_id = "XCV";
310 &soc_dev_attr->soc_id); 305 soc_dev_attr->machine = "Integrator/CP";
311 if (err)
312 return;
313 err = of_property_read_string(root, "model", &soc_dev_attr->machine);
314 if (err)
315 return;
316 soc_dev_attr->family = "Integrator"; 306 soc_dev_attr->family = "Integrator";
317 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", 307 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
318 'A' + (intcp_sc_id & 0x0f)); 308 'A' + (intcp_sc_id & 0x0f));
@@ -326,8 +316,6 @@ static void __init intcp_init_of(void)
326 316
327 parent = soc_device_to_device(soc_dev); 317 parent = soc_device_to_device(soc_dev);
328 integrator_init_sysfs(parent, intcp_sc_id); 318 integrator_init_sysfs(parent, intcp_sc_id);
329 of_platform_populate(root, of_default_bus_match_table,
330 intcp_auxdata_lookup, parent);
331} 319}
332 320
333static const char * intcp_dt_board_compat[] = { 321static const char * intcp_dt_board_compat[] = {
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index f50bc936cb84..98a156afaa94 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -1,6 +1,7 @@
1config ARCH_KEYSTONE 1config ARCH_KEYSTONE
2 bool "Texas Instruments Keystone Devices" 2 bool "Texas Instruments Keystone Devices"
3 depends on ARCH_MULTI_V7 3 depends on ARCH_MULTI_V7
4 depends on ARM_PATCH_PHYS_VIRT
4 select ARM_GIC 5 select ARM_GIC
5 select HAVE_ARM_ARCH_TIMER 6 select HAVE_ARM_ARCH_TIMER
6 select CLKSRC_MMIO 7 select CLKSRC_MMIO
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa910.h b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
index fbd7ee8e4897..8c78f2b16452 100644
--- a/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
@@ -23,7 +23,6 @@
23#define SM_nCS0_nCS0 MFP_CFG(SM_nCS0, AF0) 23#define SM_nCS0_nCS0 MFP_CFG(SM_nCS0, AF0)
24#define SM_ADV_SM_ADV MFP_CFG(SM_ADV, AF0) 24#define SM_ADV_SM_ADV MFP_CFG(SM_ADV, AF0)
25#define SM_SCLK_SM_SCLK MFP_CFG(SM_SCLK, AF0) 25#define SM_SCLK_SM_SCLK MFP_CFG(SM_SCLK, AF0)
26#define SM_SCLK_SM_SCLK MFP_CFG(SM_SCLK, AF0)
27#define SM_BE0_SM_BE0 MFP_CFG(SM_BE0, AF1) 26#define SM_BE0_SM_BE0 MFP_CFG(SM_BE0, AF1)
28#define SM_BE1_SM_BE1 MFP_CFG(SM_BE1, AF1) 27#define SM_BE1_SM_BE1 MFP_CFG(SM_BE1, AF1)
29 28
diff --git a/arch/arm/mach-moxart/Kconfig b/arch/arm/mach-moxart/Kconfig
index 82a4ba8578a2..f49328c39bef 100644
--- a/arch/arm/mach-moxart/Kconfig
+++ b/arch/arm/mach-moxart/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_MOXART 1menuconfig ARCH_MOXART
2 bool "MOXA ART SoC" if ARCH_MULTI_V4 2 bool "MOXA ART SoC" if ARCH_MULTI_V4
3 select CPU_FA526 3 select CPU_FA526
4 select ARM_DMA_MEM_BUFFERABLE 4 select ARM_DMA_MEM_BUFFERABLE
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 6090b9eb00c8..b9bc599a5fd0 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_MVEBU 1menuconfig ARCH_MVEBU
2 bool "Marvell Engineering Business Unit (MVEBU) SoCs" if (ARCH_MULTI_V7 || ARCH_MULTI_V5) 2 bool "Marvell Engineering Business Unit (MVEBU) SoCs" if (ARCH_MULTI_V7 || ARCH_MULTI_V5)
3 select ARCH_SUPPORTS_BIG_ENDIAN 3 select ARCH_SUPPORTS_BIG_ENDIAN
4 select CLKSRC_MMIO 4 select CLKSRC_MMIO
@@ -10,15 +10,15 @@ config ARCH_MVEBU
10 select ZONE_DMA if ARM_LPAE 10 select ZONE_DMA if ARM_LPAE
11 select ARCH_REQUIRE_GPIOLIB 11 select ARCH_REQUIRE_GPIOLIB
12 select PCI_QUIRKS if PCI 12 select PCI_QUIRKS if PCI
13 select OF_ADDRESS_PCI
13 14
14if ARCH_MVEBU 15if ARCH_MVEBU
15 16
16menu "Marvell EBU SoC variants"
17
18config MACH_MVEBU_V7 17config MACH_MVEBU_V7
19 bool 18 bool
20 select ARMADA_370_XP_TIMER 19 select ARMADA_370_XP_TIMER
21 select CACHE_L2X0 20 select CACHE_L2X0
21 select ARM_CPU_SUSPEND
22 22
23config MACH_ARMADA_370 23config MACH_ARMADA_370
24 bool "Marvell Armada 370 boards" if ARCH_MULTI_V7 24 bool "Marvell Armada 370 boards" if ARCH_MULTI_V7
@@ -84,7 +84,6 @@ config MACH_DOVE
84 84
85config MACH_KIRKWOOD 85config MACH_KIRKWOOD
86 bool "Marvell Kirkwood boards" if ARCH_MULTI_V5 86 bool "Marvell Kirkwood boards" if ARCH_MULTI_V5
87 select ARCH_HAS_CPUFREQ
88 select ARCH_REQUIRE_GPIOLIB 87 select ARCH_REQUIRE_GPIOLIB
89 select CPU_FEROCEON 88 select CPU_FEROCEON
90 select KIRKWOOD_CLK 89 select KIRKWOOD_CLK
@@ -97,6 +96,4 @@ config MACH_KIRKWOOD
97 Say 'Y' here if you want your kernel to support boards based 96 Say 'Y' here if you want your kernel to support boards based
98 on the Marvell Kirkwood device tree. 97 on the Marvell Kirkwood device tree.
99 98
100endmenu
101
102endif 99endif
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 2ecb828e4a8b..1636cdbef01a 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -7,7 +7,7 @@ CFLAGS_pmsu.o := -march=armv7-a
7obj-y += system-controller.o mvebu-soc-id.o 7obj-y += system-controller.o mvebu-soc-id.o
8 8
9ifeq ($(CONFIG_MACH_MVEBU_V7),y) 9ifeq ($(CONFIG_MACH_MVEBU_V7),y)
10obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o 10obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o pmsu_ll.o
11obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o 11obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o
12obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 12obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
13endif 13endif
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
index 8bb742fdf5ca..b2524d689f21 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -23,6 +23,7 @@
23#include <linux/mbus.h> 23#include <linux/mbus.h>
24#include <linux/signal.h> 24#include <linux/signal.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/irqchip.h>
26#include <asm/hardware/cache-l2x0.h> 27#include <asm/hardware/cache-l2x0.h>
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
@@ -71,17 +72,23 @@ static int armada_375_external_abort_wa(unsigned long addr, unsigned int fsr,
71 return 1; 72 return 1;
72} 73}
73 74
74static void __init mvebu_timer_and_clk_init(void) 75static void __init mvebu_init_irq(void)
75{ 76{
76 of_clk_init(NULL); 77 irqchip_init();
77 clocksource_of_init();
78 mvebu_scu_enable(); 78 mvebu_scu_enable();
79 coherency_init(); 79 coherency_init();
80 BUG_ON(mvebu_mbus_dt_init(coherency_available())); 80 BUG_ON(mvebu_mbus_dt_init(coherency_available()));
81}
82
83static void __init external_abort_quirk(void)
84{
85 u32 dev, rev;
81 86
82 if (of_machine_is_compatible("marvell,armada375")) 87 if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > ARMADA_375_Z1_REV)
83 hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0, 88 return;
84 "imprecise external abort"); 89
90 hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0,
91 "imprecise external abort");
85} 92}
86 93
87static void __init i2c_quirk(void) 94static void __init i2c_quirk(void)
@@ -169,8 +176,10 @@ static void __init mvebu_dt_init(void)
169{ 176{
170 if (of_machine_is_compatible("plathome,openblocks-ax3-4")) 177 if (of_machine_is_compatible("plathome,openblocks-ax3-4"))
171 i2c_quirk(); 178 i2c_quirk();
172 if (of_machine_is_compatible("marvell,a375-db")) 179 if (of_machine_is_compatible("marvell,a375-db")) {
180 external_abort_quirk();
173 thermal_quirk(); 181 thermal_quirk();
182 }
174 183
175 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 184 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
176} 185}
@@ -185,7 +194,7 @@ DT_MACHINE_START(ARMADA_370_XP_DT, "Marvell Armada 370/XP (Device Tree)")
185 .l2c_aux_mask = ~0, 194 .l2c_aux_mask = ~0,
186 .smp = smp_ops(armada_xp_smp_ops), 195 .smp = smp_ops(armada_xp_smp_ops),
187 .init_machine = mvebu_dt_init, 196 .init_machine = mvebu_dt_init,
188 .init_time = mvebu_timer_and_clk_init, 197 .init_irq = mvebu_init_irq,
189 .restart = mvebu_restart, 198 .restart = mvebu_restart,
190 .dt_compat = armada_370_xp_dt_compat, 199 .dt_compat = armada_370_xp_dt_compat,
191MACHINE_END 200MACHINE_END
@@ -198,7 +207,7 @@ static const char * const armada_375_dt_compat[] = {
198DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)") 207DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)")
199 .l2c_aux_val = 0, 208 .l2c_aux_val = 0,
200 .l2c_aux_mask = ~0, 209 .l2c_aux_mask = ~0,
201 .init_time = mvebu_timer_and_clk_init, 210 .init_irq = mvebu_init_irq,
202 .init_machine = mvebu_dt_init, 211 .init_machine = mvebu_dt_init,
203 .restart = mvebu_restart, 212 .restart = mvebu_restart,
204 .dt_compat = armada_375_dt_compat, 213 .dt_compat = armada_375_dt_compat,
@@ -213,7 +222,7 @@ static const char * const armada_38x_dt_compat[] = {
213DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)") 222DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)")
214 .l2c_aux_val = 0, 223 .l2c_aux_val = 0,
215 .l2c_aux_mask = ~0, 224 .l2c_aux_mask = ~0,
216 .init_time = mvebu_timer_and_clk_init, 225 .init_irq = mvebu_init_irq,
217 .restart = mvebu_restart, 226 .restart = mvebu_restart,
218 .dt_compat = armada_38x_dt_compat, 227 .dt_compat = armada_38x_dt_compat,
219MACHINE_END 228MACHINE_END
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 53a55c8520bf..a1d407c0febe 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -66,6 +66,8 @@ static void __iomem *pmsu_mp_base;
66extern void ll_disable_coherency(void); 66extern void ll_disable_coherency(void);
67extern void ll_enable_coherency(void); 67extern void ll_enable_coherency(void);
68 68
69extern void armada_370_xp_cpu_resume(void);
70
69static struct platform_device armada_xp_cpuidle_device = { 71static struct platform_device armada_xp_cpuidle_device = {
70 .name = "cpuidle-armada-370-xp", 72 .name = "cpuidle-armada-370-xp",
71}; 73};
@@ -140,13 +142,6 @@ static void armada_370_xp_pmsu_enable_l2_powerdown_onidle(void)
140 writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL); 142 writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL);
141} 143}
142 144
143static void armada_370_xp_cpu_resume(void)
144{
145 asm volatile("bl ll_add_cpu_to_smp_group\n\t"
146 "bl ll_enable_coherency\n\t"
147 "b cpu_resume\n\t");
148}
149
150/* No locking is needed because we only access per-CPU registers */ 145/* No locking is needed because we only access per-CPU registers */
151void armada_370_xp_pmsu_idle_prepare(bool deepidle) 146void armada_370_xp_pmsu_idle_prepare(bool deepidle)
152{ 147{
diff --git a/arch/arm/mach-mvebu/pmsu_ll.S b/arch/arm/mach-mvebu/pmsu_ll.S
new file mode 100644
index 000000000000..fc3de68d8c54
--- /dev/null
+++ b/arch/arm/mach-mvebu/pmsu_ll.S
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2014 Marvell
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 * Gregory Clement <gregory.clement@free-electrons.com>
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14
15/*
16 * This is the entry point through which CPUs exiting cpuidle deep
17 * idle state are going.
18 */
19ENTRY(armada_370_xp_cpu_resume)
20ARM_BE8(setend be ) @ go BE8 if entered LE
21 bl ll_add_cpu_to_smp_group
22 bl ll_enable_coherency
23 b cpu_resume
24ENDPROC(armada_370_xp_cpu_resume)
25
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 486d301f43fd..3c61096c8627 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_NOMADIK 1menuconfig ARCH_NOMADIK
2 bool "ST-Ericsson Nomadik" 2 bool "ST-Ericsson Nomadik"
3 depends on ARCH_MULTI_V5 3 depends on ARCH_MULTI_V5
4 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
@@ -15,7 +15,6 @@ config ARCH_NOMADIK
15 Support for the Nomadik platform by ST-Ericsson 15 Support for the Nomadik platform by ST-Ericsson
16 16
17if ARCH_NOMADIK 17if ARCH_NOMADIK
18menu "Nomadik boards"
19 18
20config MACH_NOMADIK_8815NHK 19config MACH_NOMADIK_8815NHK
21 bool "ST 8815 Nomadik Hardware Kit (evaluation board)" 20 bool "ST 8815 Nomadik Hardware Kit (evaluation board)"
@@ -24,7 +23,6 @@ config MACH_NOMADIK_8815NHK
24 select I2C_ALGOBIT 23 select I2C_ALGOBIT
25 select I2C_NOMADIK 24 select I2C_NOMADIK
26 25
27endmenu
28endif 26endif
29 27
30config NOMADIK_8815 28config NOMADIK_8815
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 0ba482638ebf..1c1ed737f7ab 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -1,3 +1,6 @@
1menu "TI OMAP/AM/DM/DRA Family"
2 depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
3
1config ARCH_OMAP 4config ARCH_OMAP
2 bool 5 bool
3 6
@@ -28,12 +31,11 @@ config ARCH_OMAP4
28 select ARM_CPU_SUSPEND if PM 31 select ARM_CPU_SUSPEND if PM
29 select ARM_ERRATA_720789 32 select ARM_ERRATA_720789
30 select ARM_GIC 33 select ARM_GIC
31 select CACHE_L2X0
32 select HAVE_ARM_SCU if SMP 34 select HAVE_ARM_SCU if SMP
33 select HAVE_ARM_TWD if SMP 35 select HAVE_ARM_TWD if SMP
34 select OMAP_INTERCONNECT 36 select OMAP_INTERCONNECT
35 select PL310_ERRATA_588369 37 select PL310_ERRATA_588369 if CACHE_L2X0
36 select PL310_ERRATA_727915 38 select PL310_ERRATA_727915 if CACHE_L2X0
37 select PM_OPP if PM 39 select PM_OPP if PM
38 select PM_RUNTIME if CPU_IDLE 40 select PM_RUNTIME if CPU_IDLE
39 select ARM_ERRATA_754322 41 select ARM_ERRATA_754322
@@ -80,7 +82,6 @@ config SOC_DRA7XX
80config ARCH_OMAP2PLUS 82config ARCH_OMAP2PLUS
81 bool 83 bool
82 select ARCH_HAS_BANDGAP 84 select ARCH_HAS_BANDGAP
83 select ARCH_HAS_CPUFREQ
84 select ARCH_HAS_HOLES_MEMORYMODEL 85 select ARCH_HAS_HOLES_MEMORYMODEL
85 select ARCH_OMAP 86 select ARCH_OMAP
86 select ARCH_REQUIRE_GPIOLIB 87 select ARCH_REQUIRE_GPIOLIB
@@ -343,3 +344,5 @@ config OMAP4_ERRATA_I688
343endmenu 344endmenu
344 345
345endif 346endif
347
348endmenu
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 8421f38cf445..8ca99e9321e3 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -110,14 +110,16 @@ obj-y += prm_common.o cm_common.o
110obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o 110obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
111obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o 111obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
112obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 112obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
113obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o
114omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ 113omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \
115 prcm_mpu44xx.o prminst44xx.o \ 114 prcm_mpu44xx.o prminst44xx.o \
116 vc44xx_data.o vp44xx_data.o 115 vc44xx_data.o vp44xx_data.o
117obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) 116obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common)
118obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) 117obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common)
119obj-$(CONFIG_SOC_DRA7XX) += $(omap-prcm-4-5-common) 118obj-$(CONFIG_SOC_DRA7XX) += $(omap-prcm-4-5-common)
120obj-$(CONFIG_SOC_AM43XX) += $(omap-prcm-4-5-common) 119am33xx-43xx-prcm-common += prm33xx.o cm33xx.o
120obj-$(CONFIG_SOC_AM33XX) += $(am33xx-43xx-prcm-common)
121obj-$(CONFIG_SOC_AM43XX) += $(omap-prcm-4-5-common) \
122 $(am33xx-43xx-prcm-common)
121 123
122# OMAP voltage domains 124# OMAP voltage domains
123voltagedomain-common := voltage.o vc.o vp.o 125voltagedomain-common := voltage.o vc.o vp.o
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 15a778ce7707..bd2441790779 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -380,7 +380,7 @@ void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
380void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs); 380void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
381void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs); 381void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
382 382
383#ifdef CONFIG_SOC_AM33XX 383#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
384extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, 384extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
385 u16 clkctrl_offs); 385 u16 clkctrl_offs);
386extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, 386extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index ff029737c8f0..b2d252bf4a53 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -91,7 +91,14 @@ extern void omap3_sync32k_timer_init(void);
91extern void omap3_secure_sync32k_timer_init(void); 91extern void omap3_secure_sync32k_timer_init(void);
92extern void omap3_gptimer_timer_init(void); 92extern void omap3_gptimer_timer_init(void);
93extern void omap4_local_timer_init(void); 93extern void omap4_local_timer_init(void);
94#ifdef CONFIG_CACHE_L2X0
94int omap_l2_cache_init(void); 95int omap_l2_cache_init(void);
96#else
97static inline int omap_l2_cache_init(void)
98{
99 return 0;
100}
101#endif
95extern void omap5_realtime_timer_init(void); 102extern void omap5_realtime_timer_init(void);
96 103
97void omap2420_init_early(void); 104void omap2420_init_early(void);
@@ -241,7 +248,6 @@ static inline void __iomem *omap4_get_scu_base(void)
241} 248}
242#endif 249#endif
243 250
244extern void __init gic_init_irq(void);
245extern void gic_dist_disable(void); 251extern void gic_dist_disable(void);
246extern void gic_dist_enable(void); 252extern void gic_dist_enable(void);
247extern bool gic_dist_disabled(void); 253extern bool gic_dist_disabled(void);
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 43969da5d50b..d42022f2a71e 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -649,6 +649,18 @@ void __init dra7xxx_check_revision(void)
649 } 649 }
650 break; 650 break;
651 651
652 case 0xb9bc:
653 switch (rev) {
654 case 0:
655 omap_revision = DRA722_REV_ES1_0;
656 break;
657 default:
658 /* If we have no new revisions */
659 omap_revision = DRA722_REV_ES1_0;
660 break;
661 }
662 break;
663
652 default: 664 default:
653 /* Unknown default to latest silicon rev as default*/ 665 /* Unknown default to latest silicon rev as default*/
654 pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n", 666 pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n",
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index fd88edeb027f..f62f7537d899 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -183,8 +183,10 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
183 m0_entry = mux->muxnames[0]; 183 m0_entry = mux->muxnames[0];
184 184
185 /* First check for full name in mode0.muxmode format */ 185 /* First check for full name in mode0.muxmode format */
186 if (mode0_len && strncmp(muxname, m0_entry, mode0_len)) 186 if (mode0_len)
187 continue; 187 if (strncmp(muxname, m0_entry, mode0_len) ||
188 (strlen(m0_entry) != mode0_len))
189 continue;
188 190
189 /* Then check for muxmode only */ 191 /* Then check for muxmode only */
190 for (i = 0; i < OMAP_MUX_NR_MODES; i++) { 192 for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 326cd982a3cb..539e8106eb96 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -102,26 +102,6 @@ void __init omap_barriers_init(void)
102{} 102{}
103#endif 103#endif
104 104
105void __init gic_init_irq(void)
106{
107 void __iomem *omap_irq_base;
108
109 /* Static mapping, never released */
110 gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
111 BUG_ON(!gic_dist_base_addr);
112
113 twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_4K);
114 BUG_ON(!twd_base);
115
116 /* Static mapping, never released */
117 omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
118 BUG_ON(!omap_irq_base);
119
120 omap_wakeupgen_init();
121
122 gic_init(0, 29, gic_dist_base_addr, omap_irq_base);
123}
124
125void gic_dist_disable(void) 105void gic_dist_disable(void)
126{ 106{
127 if (gic_dist_base_addr) 107 if (gic_dist_base_addr)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index f7bb435bb543..6c074f37cdd2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -4251,9 +4251,9 @@ void __init omap_hwmod_init(void)
4251 soc_ops.enable_module = _omap4_enable_module; 4251 soc_ops.enable_module = _omap4_enable_module;
4252 soc_ops.disable_module = _omap4_disable_module; 4252 soc_ops.disable_module = _omap4_disable_module;
4253 soc_ops.wait_target_ready = _omap4_wait_target_ready; 4253 soc_ops.wait_target_ready = _omap4_wait_target_ready;
4254 soc_ops.assert_hardreset = _omap4_assert_hardreset; 4254 soc_ops.assert_hardreset = _am33xx_assert_hardreset;
4255 soc_ops.deassert_hardreset = _omap4_deassert_hardreset; 4255 soc_ops.deassert_hardreset = _am33xx_deassert_hardreset;
4256 soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; 4256 soc_ops.is_hardreset_asserted = _am33xx_is_hardreset_asserted;
4257 soc_ops.init_clkdm = _init_clkdm; 4257 soc_ops.init_clkdm = _init_clkdm;
4258 } else if (soc_is_am33xx()) { 4258 } else if (soc_is_am33xx()) {
4259 soc_ops.enable_module = _am33xx_enable_module; 4259 soc_ops.enable_module = _am33xx_enable_module;
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 290213f2cbe3..1103aa0e0d29 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -2020,6 +2020,77 @@ static struct omap_hwmod omap54xx_wd_timer2_hwmod = {
2020 }, 2020 },
2021}; 2021};
2022 2022
2023/*
2024 * 'ocp2scp' class
2025 * bridge to transform ocp interface protocol to scp (serial control port)
2026 * protocol
2027 */
2028/* ocp2scp3 */
2029static struct omap_hwmod omap54xx_ocp2scp3_hwmod;
2030/* l4_cfg -> ocp2scp3 */
2031static struct omap_hwmod_ocp_if omap54xx_l4_cfg__ocp2scp3 = {
2032 .master = &omap54xx_l4_cfg_hwmod,
2033 .slave = &omap54xx_ocp2scp3_hwmod,
2034 .clk = "l4_root_clk_div",
2035 .user = OCP_USER_MPU | OCP_USER_SDMA,
2036};
2037
2038static struct omap_hwmod omap54xx_ocp2scp3_hwmod = {
2039 .name = "ocp2scp3",
2040 .class = &omap54xx_ocp2scp_hwmod_class,
2041 .clkdm_name = "l3init_clkdm",
2042 .prcm = {
2043 .omap4 = {
2044 .clkctrl_offs = OMAP54XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET,
2045 .context_offs = OMAP54XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET,
2046 .modulemode = MODULEMODE_HWCTRL,
2047 },
2048 },
2049};
2050
2051/*
2052 * 'sata' class
2053 * sata: serial ata interface gen2 compliant ( 1 rx/ 1 tx)
2054 */
2055
2056static struct omap_hwmod_class_sysconfig omap54xx_sata_sysc = {
2057 .sysc_offs = 0x0000,
2058 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE),
2059 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
2060 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
2061 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
2062 .sysc_fields = &omap_hwmod_sysc_type2,
2063};
2064
2065static struct omap_hwmod_class omap54xx_sata_hwmod_class = {
2066 .name = "sata",
2067 .sysc = &omap54xx_sata_sysc,
2068};
2069
2070/* sata */
2071static struct omap_hwmod omap54xx_sata_hwmod = {
2072 .name = "sata",
2073 .class = &omap54xx_sata_hwmod_class,
2074 .clkdm_name = "l3init_clkdm",
2075 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
2076 .main_clk = "func_48m_fclk",
2077 .mpu_rt_idx = 1,
2078 .prcm = {
2079 .omap4 = {
2080 .clkctrl_offs = OMAP54XX_CM_L3INIT_SATA_CLKCTRL_OFFSET,
2081 .context_offs = OMAP54XX_RM_L3INIT_SATA_CONTEXT_OFFSET,
2082 .modulemode = MODULEMODE_SWCTRL,
2083 },
2084 },
2085};
2086
2087/* l4_cfg -> sata */
2088static struct omap_hwmod_ocp_if omap54xx_l4_cfg__sata = {
2089 .master = &omap54xx_l4_cfg_hwmod,
2090 .slave = &omap54xx_sata_hwmod,
2091 .clk = "l3_iclk_div",
2092 .user = OCP_USER_MPU | OCP_USER_SDMA,
2093};
2023 2094
2024/* 2095/*
2025 * Interfaces 2096 * Interfaces
@@ -2765,6 +2836,8 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
2765 &omap54xx_l4_cfg__usb_tll_hs, 2836 &omap54xx_l4_cfg__usb_tll_hs,
2766 &omap54xx_l4_cfg__usb_otg_ss, 2837 &omap54xx_l4_cfg__usb_otg_ss,
2767 &omap54xx_l4_wkup__wd_timer2, 2838 &omap54xx_l4_wkup__wd_timer2,
2839 &omap54xx_l4_cfg__ocp2scp3,
2840 &omap54xx_l4_cfg__sata,
2768 NULL, 2841 NULL,
2769}; 2842};
2770 2843
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index de2a34c423a7..01ca8086fb6c 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -462,6 +462,7 @@ IS_OMAP_TYPE(3430, 0x3430)
462#define DRA7XX_CLASS 0x07000000 462#define DRA7XX_CLASS 0x07000000
463#define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) 463#define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8))
464#define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) 464#define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8))
465#define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8))
465 466
466void omap2xxx_check_revision(void); 467void omap2xxx_check_revision(void);
467void omap3xxx_check_revision(void); 468void omap3xxx_check_revision(void);
diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig
index e4e505f52ba0..042f693ef423 100644
--- a/arch/arm/mach-prima2/Kconfig
+++ b/arch/arm/mach-prima2/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_SIRF 1menuconfig ARCH_SIRF
2 bool "CSR SiRF" if ARCH_MULTI_V7 2 bool "CSR SiRF" if ARCH_MULTI_V7
3 select ARCH_HAS_RESET_CONTROLLER 3 select ARCH_HAS_RESET_CONTROLLER
4 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
@@ -11,7 +11,7 @@ config ARCH_SIRF
11 11
12if ARCH_SIRF 12if ARCH_SIRF
13 13
14menu "CSR SiRF atlas6/primaII/Marco/Polo Specific Features" 14comment "CSR SiRF atlas6/primaII/Marco/Polo Specific Features"
15 15
16config ARCH_ATLAS6 16config ARCH_ATLAS6
17 bool "CSR SiRFSoC ATLAS6 ARM Cortex A9 Platform" 17 bool "CSR SiRFSoC ATLAS6 ARM Cortex A9 Platform"
@@ -37,8 +37,6 @@ config ARCH_MARCO
37 help 37 help
38 Support for CSR SiRFSoC ARM Cortex A9 Platform 38 Support for CSR SiRFSoC ARM Cortex A9 Platform
39 39
40endmenu
41
42config SIRF_IRQ 40config SIRF_IRQ
43 bool 41 bool
44 42
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 91dd1c7cdbcd..06022b235730 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -514,7 +514,7 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
514 .gpio_pullup = CORGI_GPIO_USB_PULLUP, 514 .gpio_pullup = CORGI_GPIO_USB_PULLUP,
515}; 515};
516 516
517#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MASTER) 517#if IS_ENABLED(CONFIG_SPI_PXA2XX)
518static struct pxa2xx_spi_master corgi_spi_info = { 518static struct pxa2xx_spi_master corgi_spi_info = {
519 .num_chipselect = 3, 519 .num_chipselect = 3,
520}; 520};
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 42254175fcf4..b31e101cad9b 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -79,19 +79,15 @@ EXPORT_SYMBOL(get_clk_frequency_khz);
79 */ 79 */
80static struct map_desc common_io_desc[] __initdata = { 80static struct map_desc common_io_desc[] __initdata = {
81 { /* Devs */ 81 { /* Devs */
82 .virtual = 0xf2000000, 82 .virtual = (unsigned long)PERIPH_VIRT,
83 .pfn = __phys_to_pfn(0x40000000), 83 .pfn = __phys_to_pfn(PERIPH_PHYS),
84 .length = 0x02000000, 84 .length = PERIPH_SIZE,
85 .type = MT_DEVICE
86 }, { /* UNCACHED_PHYS_0 */
87 .virtual = 0xff000000,
88 .pfn = __phys_to_pfn(0x00000000),
89 .length = 0x00100000,
90 .type = MT_DEVICE 85 .type = MT_DEVICE
91 } 86 }
92}; 87};
93 88
94void __init pxa_map_io(void) 89void __init pxa_map_io(void)
95{ 90{
91 debug_ll_io_init();
96 iotable_init(ARRAY_AND_SIZE(common_io_desc)); 92 iotable_init(ARRAY_AND_SIZE(common_io_desc));
97} 93}
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index ccb06e485520..8d63c211b22f 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -19,8 +19,8 @@
19 * Workarounds for at least 2 errata so far require this. 19 * Workarounds for at least 2 errata so far require this.
20 * The mapping is set in mach-pxa/generic.c. 20 * The mapping is set in mach-pxa/generic.c.
21 */ 21 */
22#define UNCACHED_PHYS_0 0xff000000 22#define UNCACHED_PHYS_0 0xfe000000
23#define UNCACHED_ADDR UNCACHED_PHYS_0 23#define UNCACHED_PHYS_0_SIZE 0x00100000
24 24
25/* 25/*
26 * Intel PXA2xx internal register mapping: 26 * Intel PXA2xx internal register mapping:
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index f2c28972084d..66e4a2b6316e 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -331,7 +331,12 @@ static struct map_desc pxa25x_io_desc[] __initdata = {
331 { /* Mem Ctl */ 331 { /* Mem Ctl */
332 .virtual = (unsigned long)SMEMC_VIRT, 332 .virtual = (unsigned long)SMEMC_VIRT,
333 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE), 333 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE),
334 .length = 0x00200000, 334 .length = SMEMC_SIZE,
335 .type = MT_DEVICE
336 }, { /* UNCACHED_PHYS_0 */
337 .virtual = UNCACHED_PHYS_0,
338 .pfn = __phys_to_pfn(0x00000000),
339 .length = UNCACHED_PHYS_0_SIZE,
335 .type = MT_DEVICE 340 .type = MT_DEVICE
336 }, 341 },
337}; 342};
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 301471a07a10..b040d7d14888 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -402,12 +402,12 @@ static struct map_desc pxa27x_io_desc[] __initdata = {
402 { /* Mem Ctl */ 402 { /* Mem Ctl */
403 .virtual = (unsigned long)SMEMC_VIRT, 403 .virtual = (unsigned long)SMEMC_VIRT,
404 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE), 404 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE),
405 .length = 0x00200000, 405 .length = SMEMC_SIZE,
406 .type = MT_DEVICE 406 .type = MT_DEVICE
407 }, { /* IMem ctl */ 407 }, { /* UNCACHED_PHYS_0 */
408 .virtual = 0xfe000000, 408 .virtual = UNCACHED_PHYS_0,
409 .pfn = __phys_to_pfn(0x58000000), 409 .pfn = __phys_to_pfn(0x00000000),
410 .length = 0x00100000, 410 .length = UNCACHED_PHYS_0_SIZE,
411 .type = MT_DEVICE 411 .type = MT_DEVICE
412 }, 412 },
413}; 413};
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 87011f3de69d..593ccd35ca97 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -416,7 +416,7 @@ static struct map_desc pxa3xx_io_desc[] __initdata = {
416 { /* Mem Ctl */ 416 { /* Mem Ctl */
417 .virtual = (unsigned long)SMEMC_VIRT, 417 .virtual = (unsigned long)SMEMC_VIRT,
418 .pfn = __phys_to_pfn(PXA3XX_SMEMC_BASE), 418 .pfn = __phys_to_pfn(PXA3XX_SMEMC_BASE),
419 .length = 0x00200000, 419 .length = SMEMC_SIZE,
420 .type = MT_DEVICE 420 .type = MT_DEVICE
421 } 421 }
422}; 422};
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index 1e544be9905d..6c5b3ffd2cd3 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -157,7 +157,7 @@ pxa_cpu_do_suspend:
157 @ Do not reorder... 157 @ Do not reorder...
158 @ Intel PXA270 Specification Update notes problems performing 158 @ Intel PXA270 Specification Update notes problems performing
159 @ external accesses after SDRAM is put in self-refresh mode 159 @ external accesses after SDRAM is put in self-refresh mode
160 @ (see Errata 39 ...hangs when entering self-refresh mode) 160 @ (see Errata 38 ...hangs when entering self-refresh mode)
161 161
162 @ force address lines low by reading at physical address 0 162 @ force address lines low by reading at physical address 0
163 ldr r3, [r2] 163 ldr r3, [r2]
diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig
index fd2b99dceb89..ee5697ba05bc 100644
--- a/arch/arm/mach-qcom/Kconfig
+++ b/arch/arm/mach-qcom/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_QCOM 1menuconfig ARCH_QCOM
2 bool "Qualcomm Support" if ARCH_MULTI_V7 2 bool "Qualcomm Support" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_GIC 4 select ARM_GIC
@@ -11,8 +11,6 @@ config ARCH_QCOM
11 11
12if ARCH_QCOM 12if ARCH_QCOM
13 13
14menu "Qualcomm SoC Selection"
15
16config ARCH_MSM8X60 14config ARCH_MSM8X60
17 bool "Enable support for MSM8X60" 15 bool "Enable support for MSM8X60"
18 select CLKSRC_QCOM 16 select CLKSRC_QCOM
@@ -25,8 +23,6 @@ config ARCH_MSM8974
25 bool "Enable support for MSM8974" 23 bool "Enable support for MSM8974"
26 select HAVE_ARM_ARCH_TIMER 24 select HAVE_ARM_ARCH_TIMER
27 25
28endmenu
29
30config QCOM_SCM 26config QCOM_SCM
31 bool 27 bool
32 28
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 8c1b39a0caa0..850e506926df 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/amba/bus.h> 26#include <linux/amba/bus.h>
27#include <linux/amba/clcd.h> 27#include <linux/amba/clcd.h>
28#include <linux/platform_data/video-clcd-versatile.h>
28#include <linux/io.h> 29#include <linux/io.h>
29#include <linux/smsc911x.h> 30#include <linux/smsc911x.h>
30#include <linux/ata_platform.h> 31#include <linux/ata_platform.h>
@@ -48,7 +49,6 @@
48#include <mach/irqs.h> 49#include <mach/irqs.h>
49#include <asm/hardware/timer-sp.h> 50#include <asm/hardware/timer-sp.h>
50 51
51#include <plat/clcd.h>
52#include <plat/sched_clock.h> 52#include <plat/sched_clock.h>
53 53
54#include "core.h" 54#include "core.h"
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 04284de7aca5..ad5316ae524e 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -117,7 +117,7 @@ config S3C24XX_SETUP_TS
117 Compile in platform device definition for Samsung TouchScreen. 117 Compile in platform device definition for Samsung TouchScreen.
118 118
119config S3C24XX_DMA 119config S3C24XX_DMA
120 bool "S3C2410 DMA support" 120 bool "S3C2410 DMA support (deprecated)"
121 select S3C_DMA 121 select S3C_DMA
122 help 122 help
123 S3C2410 DMA support. This is needed for drivers like sound which 123 S3C2410 DMA support. This is needed for drivers like sound which
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 3136d86b0d6e..26ca2427e53d 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -18,9 +18,9 @@ config CPU_S3C6410
18 Enable S3C6410 CPU support 18 Enable S3C6410 CPU support
19 19
20config S3C64XX_PL080 20config S3C64XX_PL080
21 bool "S3C64XX DMA using generic PL08x driver" 21 def_bool DMADEVICES
22 select ARM_AMBA
22 select AMBA_PL08X 23 select AMBA_PL08X
23 select SAMSUNG_DMADEV
24 24
25config S3C64XX_SETUP_SDHCI 25config S3C64XX_SETUP_SDHCI
26 bool 26 bool
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
deleted file mode 100644
index bb2111b3751e..000000000000
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ /dev/null
@@ -1,100 +0,0 @@
1# arch/arm/mach-s5p64x0/Kconfig
2#
3# Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4# http://www.samsung.com/
5#
6# Licensed under GPLv2
7
8if ARCH_S5P64X0
9
10config CPU_S5P6440
11 bool
12 select S5P_SLEEP if PM
13 select SAMSUNG_DMADEV
14 select SAMSUNG_WAKEMASK if PM
15 help
16 Enable S5P6440 CPU support
17
18config CPU_S5P6450
19 bool
20 select S5P_SLEEP if PM
21 select SAMSUNG_DMADEV
22 select SAMSUNG_WAKEMASK if PM
23 help
24 Enable S5P6450 CPU support
25
26config S5P64X0_SETUP_FB_24BPP
27 bool
28 help
29 Common setup code for S5P64X0 based boards with a LCD display
30 through RGB interface.
31
32config S5P64X0_SETUP_I2C1
33 bool
34 help
35 Common setup code for i2c bus 1.
36
37config S5P64X0_SETUP_SPI
38 bool
39 help
40 Common setup code for SPI GPIO configurations
41
42config S5P64X0_SETUP_SDHCI_GPIO
43 bool
44 help
45 Common setup code for SDHCI gpio.
46
47# machine support
48
49config MACH_SMDK6440
50 bool "SMDK6440"
51 select CPU_S5P6440
52 select S3C_DEV_FB
53 select S3C_DEV_HSMMC
54 select S3C_DEV_HSMMC1
55 select S3C_DEV_HSMMC2
56 select S3C_DEV_I2C1
57 select S3C_DEV_RTC
58 select S3C_DEV_WDT
59 select S5P64X0_SETUP_FB_24BPP
60 select S5P64X0_SETUP_I2C1
61 select S5P64X0_SETUP_SDHCI_GPIO
62 select SAMSUNG_DEV_ADC
63 select SAMSUNG_DEV_BACKLIGHT
64 select SAMSUNG_DEV_PWM
65 select SAMSUNG_DEV_TS
66 help
67 Machine support for the Samsung SMDK6440
68
69config MACH_SMDK6450
70 bool "SMDK6450"
71 select CPU_S5P6450
72 select S3C_DEV_FB
73 select S3C_DEV_HSMMC
74 select S3C_DEV_HSMMC1
75 select S3C_DEV_HSMMC2
76 select S3C_DEV_I2C1
77 select S3C_DEV_RTC
78 select S3C_DEV_WDT
79 select S5P64X0_SETUP_FB_24BPP
80 select S5P64X0_SETUP_I2C1
81 select S5P64X0_SETUP_SDHCI_GPIO
82 select SAMSUNG_DEV_ADC
83 select SAMSUNG_DEV_BACKLIGHT
84 select SAMSUNG_DEV_PWM
85 select SAMSUNG_DEV_TS
86 help
87 Machine support for the Samsung SMDK6450
88
89menu "Use 8-bit SDHCI bus width"
90
91config S5P64X0_SD_CH1_8BIT
92 bool "SDHCI Channel 1 (Slot 1)"
93 depends on MACH_SMDK6450 || MACH_SMDK6440
94 help
95 Support SDHCI Channel 1 8-bit bus.
96 If selected, Channel 2 is disabled.
97
98endmenu
99
100endif
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
deleted file mode 100644
index 12bb951187a4..000000000000
--- a/arch/arm/mach-s5p64x0/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
1# arch/arm/mach-s5p64x0/Makefile
2#
3# Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4# http://www.samsung.com
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n :=
11obj- :=
12
13# Core
14
15obj-y += common.o clock.o
16obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o
17obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o
18
19obj-$(CONFIG_PM) += pm.o irq-pm.o
20
21obj-y += dma.o
22
23# machine support
24
25obj-$(CONFIG_MACH_SMDK6440) += mach-smdk6440.o
26obj-$(CONFIG_MACH_SMDK6450) += mach-smdk6450.o
27
28# device support
29
30obj-y += dev-audio.o
31
32obj-y += setup-i2c0.o
33obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
34obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o
35obj-$(CONFIG_S5P64X0_SETUP_SPI) += setup-spi.o
36obj-$(CONFIG_S5P64X0_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-s5p64x0/Makefile.boot b/arch/arm/mach-s5p64x0/Makefile.boot
deleted file mode 100644
index 79ece4055b02..000000000000
--- a/arch/arm/mach-s5p64x0/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
deleted file mode 100644
index ae34a1d5e10a..000000000000
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ /dev/null
@@ -1,632 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/clock-s5p6440.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P6440 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/device.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26
27#include <plat/cpu-freq.h>
28#include <plat/clock.h>
29#include <plat/cpu.h>
30#include <plat/pll.h>
31#include <plat/s5p-clock.h>
32#include <plat/clock-clksrc.h>
33
34#include "clock.h"
35#include "common.h"
36
37static u32 epll_div[][5] = {
38 { 36000000, 0, 48, 1, 4 },
39 { 48000000, 0, 32, 1, 3 },
40 { 60000000, 0, 40, 1, 3 },
41 { 72000000, 0, 48, 1, 3 },
42 { 84000000, 0, 28, 1, 2 },
43 { 96000000, 0, 32, 1, 2 },
44 { 32768000, 45264, 43, 1, 4 },
45 { 45158000, 6903, 30, 1, 3 },
46 { 49152000, 50332, 32, 1, 3 },
47 { 67738000, 10398, 45, 1, 3 },
48 { 73728000, 9961, 49, 1, 3 }
49};
50
51static int s5p6440_epll_set_rate(struct clk *clk, unsigned long rate)
52{
53 unsigned int epll_con, epll_con_k;
54 unsigned int i;
55
56 if (clk->rate == rate) /* Return if nothing changed */
57 return 0;
58
59 epll_con = __raw_readl(S5P64X0_EPLL_CON);
60 epll_con_k = __raw_readl(S5P64X0_EPLL_CON_K);
61
62 epll_con_k &= ~(PLL90XX_KDIV_MASK);
63 epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
64
65 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
66 if (epll_div[i][0] == rate) {
67 epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
68 epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
69 (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
70 (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
71 break;
72 }
73 }
74
75 if (i == ARRAY_SIZE(epll_div)) {
76 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
77 return -EINVAL;
78 }
79
80 __raw_writel(epll_con, S5P64X0_EPLL_CON);
81 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
82
83 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
84 clk->rate, rate);
85
86 clk->rate = rate;
87
88 return 0;
89}
90
91static struct clk_ops s5p6440_epll_ops = {
92 .get_rate = s5p_epll_get_rate,
93 .set_rate = s5p6440_epll_set_rate,
94};
95
96static struct clksrc_clk clk_hclk = {
97 .clk = {
98 .name = "clk_hclk",
99 .parent = &clk_armclk.clk,
100 },
101 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
102};
103
104static struct clksrc_clk clk_pclk = {
105 .clk = {
106 .name = "clk_pclk",
107 .parent = &clk_hclk.clk,
108 },
109 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
110};
111static struct clksrc_clk clk_hclk_low = {
112 .clk = {
113 .name = "clk_hclk_low",
114 },
115 .sources = &clkset_hclk_low,
116 .reg_src = { .reg = S5P64X0_SYS_OTHERS, .shift = 6, .size = 1 },
117 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 8, .size = 4 },
118};
119
120static struct clksrc_clk clk_pclk_low = {
121 .clk = {
122 .name = "clk_pclk_low",
123 .parent = &clk_hclk_low.clk,
124 },
125 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
126};
127
128/*
129 * The following clocks will be disabled during clock initialization. It is
130 * recommended to keep the following clocks disabled until the driver requests
131 * for enabling the clock.
132 */
133static struct clk init_clocks_off[] = {
134 {
135 .name = "nand",
136 .parent = &clk_hclk.clk,
137 .enable = s5p64x0_mem_ctrl,
138 .ctrlbit = (1 << 2),
139 }, {
140 .name = "post",
141 .parent = &clk_hclk_low.clk,
142 .enable = s5p64x0_hclk0_ctrl,
143 .ctrlbit = (1 << 5)
144 }, {
145 .name = "2d",
146 .parent = &clk_hclk.clk,
147 .enable = s5p64x0_hclk0_ctrl,
148 .ctrlbit = (1 << 8),
149 }, {
150 .name = "dma",
151 .devname = "dma-pl330",
152 .parent = &clk_hclk_low.clk,
153 .enable = s5p64x0_hclk0_ctrl,
154 .ctrlbit = (1 << 12),
155 }, {
156 .name = "hsmmc",
157 .devname = "s3c-sdhci.0",
158 .parent = &clk_hclk_low.clk,
159 .enable = s5p64x0_hclk0_ctrl,
160 .ctrlbit = (1 << 17),
161 }, {
162 .name = "hsmmc",
163 .devname = "s3c-sdhci.1",
164 .parent = &clk_hclk_low.clk,
165 .enable = s5p64x0_hclk0_ctrl,
166 .ctrlbit = (1 << 18),
167 }, {
168 .name = "hsmmc",
169 .devname = "s3c-sdhci.2",
170 .parent = &clk_hclk_low.clk,
171 .enable = s5p64x0_hclk0_ctrl,
172 .ctrlbit = (1 << 19),
173 }, {
174 .name = "otg",
175 .parent = &clk_hclk_low.clk,
176 .enable = s5p64x0_hclk0_ctrl,
177 .ctrlbit = (1 << 20)
178 }, {
179 .name = "irom",
180 .parent = &clk_hclk.clk,
181 .enable = s5p64x0_hclk0_ctrl,
182 .ctrlbit = (1 << 25),
183 }, {
184 .name = "lcd",
185 .parent = &clk_hclk_low.clk,
186 .enable = s5p64x0_hclk1_ctrl,
187 .ctrlbit = (1 << 1),
188 }, {
189 .name = "hclk_fimgvg",
190 .parent = &clk_hclk.clk,
191 .enable = s5p64x0_hclk1_ctrl,
192 .ctrlbit = (1 << 2),
193 }, {
194 .name = "tsi",
195 .parent = &clk_hclk_low.clk,
196 .enable = s5p64x0_hclk1_ctrl,
197 .ctrlbit = (1 << 0),
198 }, {
199 .name = "watchdog",
200 .parent = &clk_pclk_low.clk,
201 .enable = s5p64x0_pclk_ctrl,
202 .ctrlbit = (1 << 5),
203 }, {
204 .name = "rtc",
205 .parent = &clk_pclk_low.clk,
206 .enable = s5p64x0_pclk_ctrl,
207 .ctrlbit = (1 << 6),
208 }, {
209 .name = "timers",
210 .parent = &clk_pclk_low.clk,
211 .enable = s5p64x0_pclk_ctrl,
212 .ctrlbit = (1 << 7),
213 }, {
214 .name = "pcm",
215 .parent = &clk_pclk_low.clk,
216 .enable = s5p64x0_pclk_ctrl,
217 .ctrlbit = (1 << 8),
218 }, {
219 .name = "adc",
220 .parent = &clk_pclk_low.clk,
221 .enable = s5p64x0_pclk_ctrl,
222 .ctrlbit = (1 << 12),
223 }, {
224 .name = "i2c",
225 .parent = &clk_pclk_low.clk,
226 .enable = s5p64x0_pclk_ctrl,
227 .ctrlbit = (1 << 17),
228 }, {
229 .name = "spi",
230 .devname = "s5p64x0-spi.0",
231 .parent = &clk_pclk_low.clk,
232 .enable = s5p64x0_pclk_ctrl,
233 .ctrlbit = (1 << 21),
234 }, {
235 .name = "spi",
236 .devname = "s5p64x0-spi.1",
237 .parent = &clk_pclk_low.clk,
238 .enable = s5p64x0_pclk_ctrl,
239 .ctrlbit = (1 << 22),
240 }, {
241 .name = "gps",
242 .parent = &clk_pclk_low.clk,
243 .enable = s5p64x0_pclk_ctrl,
244 .ctrlbit = (1 << 25),
245 }, {
246 .name = "dsim",
247 .parent = &clk_pclk_low.clk,
248 .enable = s5p64x0_pclk_ctrl,
249 .ctrlbit = (1 << 28),
250 }, {
251 .name = "etm",
252 .parent = &clk_pclk.clk,
253 .enable = s5p64x0_pclk_ctrl,
254 .ctrlbit = (1 << 29),
255 }, {
256 .name = "dmc0",
257 .parent = &clk_pclk.clk,
258 .enable = s5p64x0_pclk_ctrl,
259 .ctrlbit = (1 << 30),
260 }, {
261 .name = "pclk_fimgvg",
262 .parent = &clk_pclk.clk,
263 .enable = s5p64x0_pclk_ctrl,
264 .ctrlbit = (1 << 31),
265 }, {
266 .name = "mmc_48m",
267 .devname = "s3c-sdhci.0",
268 .parent = &clk_48m,
269 .enable = s5p64x0_sclk_ctrl,
270 .ctrlbit = (1 << 27),
271 }, {
272 .name = "mmc_48m",
273 .devname = "s3c-sdhci.1",
274 .parent = &clk_48m,
275 .enable = s5p64x0_sclk_ctrl,
276 .ctrlbit = (1 << 28),
277 }, {
278 .name = "mmc_48m",
279 .devname = "s3c-sdhci.2",
280 .parent = &clk_48m,
281 .enable = s5p64x0_sclk_ctrl,
282 .ctrlbit = (1 << 29),
283 },
284};
285
286/*
287 * The following clocks will be enabled during clock initialization.
288 */
289static struct clk init_clocks[] = {
290 {
291 .name = "intc",
292 .parent = &clk_hclk.clk,
293 .enable = s5p64x0_hclk0_ctrl,
294 .ctrlbit = (1 << 1),
295 }, {
296 .name = "mem",
297 .parent = &clk_hclk.clk,
298 .enable = s5p64x0_hclk0_ctrl,
299 .ctrlbit = (1 << 21),
300 }, {
301 .name = "uart",
302 .devname = "s3c6400-uart.0",
303 .parent = &clk_pclk_low.clk,
304 .enable = s5p64x0_pclk_ctrl,
305 .ctrlbit = (1 << 1),
306 }, {
307 .name = "uart",
308 .devname = "s3c6400-uart.1",
309 .parent = &clk_pclk_low.clk,
310 .enable = s5p64x0_pclk_ctrl,
311 .ctrlbit = (1 << 2),
312 }, {
313 .name = "uart",
314 .devname = "s3c6400-uart.2",
315 .parent = &clk_pclk_low.clk,
316 .enable = s5p64x0_pclk_ctrl,
317 .ctrlbit = (1 << 3),
318 }, {
319 .name = "uart",
320 .devname = "s3c6400-uart.3",
321 .parent = &clk_pclk_low.clk,
322 .enable = s5p64x0_pclk_ctrl,
323 .ctrlbit = (1 << 4),
324 }, {
325 .name = "gpio",
326 .parent = &clk_pclk_low.clk,
327 .enable = s5p64x0_pclk_ctrl,
328 .ctrlbit = (1 << 18),
329 },
330};
331
332static struct clk clk_iis_cd_v40 = {
333 .name = "iis_cdclk_v40",
334};
335
336static struct clk clk_pcm_cd = {
337 .name = "pcm_cdclk",
338};
339
340static struct clk *clkset_group1_list[] = {
341 &clk_mout_epll.clk,
342 &clk_dout_mpll.clk,
343 &clk_fin_epll,
344};
345
346static struct clksrc_sources clkset_group1 = {
347 .sources = clkset_group1_list,
348 .nr_sources = ARRAY_SIZE(clkset_group1_list),
349};
350
351static struct clk *clkset_uart_list[] = {
352 &clk_mout_epll.clk,
353 &clk_dout_mpll.clk,
354};
355
356static struct clksrc_sources clkset_uart = {
357 .sources = clkset_uart_list,
358 .nr_sources = ARRAY_SIZE(clkset_uart_list),
359};
360
361static struct clk *clkset_audio_list[] = {
362 &clk_mout_epll.clk,
363 &clk_dout_mpll.clk,
364 &clk_fin_epll,
365 &clk_iis_cd_v40,
366 &clk_pcm_cd,
367};
368
369static struct clksrc_sources clkset_audio = {
370 .sources = clkset_audio_list,
371 .nr_sources = ARRAY_SIZE(clkset_audio_list),
372};
373
374static struct clksrc_clk clksrcs[] = {
375 {
376 .clk = {
377 .name = "sclk_post",
378 .ctrlbit = (1 << 10),
379 .enable = s5p64x0_sclk_ctrl,
380 },
381 .sources = &clkset_group1,
382 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 26, .size = 2 },
383 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 12, .size = 4 },
384 }, {
385 .clk = {
386 .name = "sclk_dispcon",
387 .ctrlbit = (1 << 1),
388 .enable = s5p64x0_sclk1_ctrl,
389 },
390 .sources = &clkset_group1,
391 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 4, .size = 2 },
392 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 0, .size = 4 },
393 }, {
394 .clk = {
395 .name = "sclk_fimgvg",
396 .ctrlbit = (1 << 2),
397 .enable = s5p64x0_sclk1_ctrl,
398 },
399 .sources = &clkset_group1,
400 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
401 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
402 },
403};
404
405static struct clksrc_clk clk_sclk_mmc0 = {
406 .clk = {
407 .name = "sclk_mmc",
408 .devname = "s3c-sdhci.0",
409 .ctrlbit = (1 << 24),
410 .enable = s5p64x0_sclk_ctrl,
411 },
412 .sources = &clkset_group1,
413 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 18, .size = 2 },
414 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
415};
416
417static struct clksrc_clk clk_sclk_mmc1 = {
418 .clk = {
419 .name = "sclk_mmc",
420 .devname = "s3c-sdhci.1",
421 .ctrlbit = (1 << 25),
422 .enable = s5p64x0_sclk_ctrl,
423 },
424 .sources = &clkset_group1,
425 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 20, .size = 2 },
426 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
427};
428
429static struct clksrc_clk clk_sclk_mmc2 = {
430 .clk = {
431 .name = "sclk_mmc",
432 .devname = "s3c-sdhci.2",
433 .ctrlbit = (1 << 26),
434 .enable = s5p64x0_sclk_ctrl,
435 },
436 .sources = &clkset_group1,
437 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 22, .size = 2 },
438 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
439};
440
441static struct clksrc_clk clk_sclk_uclk = {
442 .clk = {
443 .name = "uclk1",
444 .ctrlbit = (1 << 5),
445 .enable = s5p64x0_sclk_ctrl,
446 },
447 .sources = &clkset_uart,
448 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 13, .size = 1 },
449 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
450};
451
452static struct clk clk_i2s0 = {
453 .name = "iis",
454 .devname = "samsung-i2s.0",
455 .parent = &clk_pclk_low.clk,
456 .enable = s5p64x0_pclk_ctrl,
457 .ctrlbit = (1 << 26),
458};
459
460static struct clksrc_clk clk_audio_bus2 = {
461 .clk = {
462 .name = "sclk_audio2",
463 .devname = "samsung-i2s.0",
464 .ctrlbit = (1 << 11),
465 .enable = s5p64x0_sclk_ctrl,
466 },
467 .sources = &clkset_audio,
468 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 0, .size = 3 },
469 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 24, .size = 4 },
470};
471
472static struct clksrc_clk clk_sclk_spi0 = {
473 .clk = {
474 .name = "sclk_spi",
475 .devname = "s5p64x0-spi.0",
476 .ctrlbit = (1 << 20),
477 .enable = s5p64x0_sclk_ctrl,
478 },
479 .sources = &clkset_group1,
480 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
481 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
482};
483
484static struct clksrc_clk clk_sclk_spi1 = {
485 .clk = {
486 .name = "sclk_spi",
487 .devname = "s5p64x0-spi.1",
488 .ctrlbit = (1 << 21),
489 .enable = s5p64x0_sclk_ctrl,
490 },
491 .sources = &clkset_group1,
492 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
493 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
494};
495
496/* Clock initialization code */
497static struct clksrc_clk *sysclks[] = {
498 &clk_mout_apll,
499 &clk_mout_epll,
500 &clk_mout_mpll,
501 &clk_dout_mpll,
502 &clk_armclk,
503 &clk_hclk,
504 &clk_pclk,
505 &clk_hclk_low,
506 &clk_pclk_low,
507};
508
509static struct clk dummy_apb_pclk = {
510 .name = "apb_pclk",
511 .id = -1,
512};
513
514static struct clk *clk_cdev[] = {
515 &clk_i2s0,
516};
517
518static struct clksrc_clk *clksrc_cdev[] = {
519 &clk_sclk_uclk,
520 &clk_sclk_spi0,
521 &clk_sclk_spi1,
522 &clk_sclk_mmc0,
523 &clk_sclk_mmc1,
524 &clk_sclk_mmc2,
525 &clk_audio_bus2,
526};
527
528static struct clk_lookup s5p6440_clk_lookup[] = {
529 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
530 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
531 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
532 CLKDEV_INIT("s5p64x0-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
533 CLKDEV_INIT("s5p64x0-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
534 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
535 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
536 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
537 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &clk_i2s0),
538 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk1", &clk_audio_bus2.clk),
539};
540
541void __init_or_cpufreq s5p6440_setup_clocks(void)
542{
543 struct clk *xtal_clk;
544
545 unsigned long xtal;
546 unsigned long fclk;
547 unsigned long hclk;
548 unsigned long hclk_low;
549 unsigned long pclk;
550 unsigned long pclk_low;
551
552 unsigned long apll;
553 unsigned long mpll;
554 unsigned long epll;
555 unsigned int ptr;
556
557 /* Set S5P6440 functions for clk_fout_epll */
558
559 clk_fout_epll.enable = s5p_epll_enable;
560 clk_fout_epll.ops = &s5p6440_epll_ops;
561
562 clk_48m.enable = s5p64x0_clk48m_ctrl;
563
564 xtal_clk = clk_get(NULL, "ext_xtal");
565 BUG_ON(IS_ERR(xtal_clk));
566
567 xtal = clk_get_rate(xtal_clk);
568 clk_put(xtal_clk);
569
570 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_APLL_CON), pll_4502);
571 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_MPLL_CON), pll_4502);
572 epll = s5p_get_pll90xx(xtal, __raw_readl(S5P64X0_EPLL_CON),
573 __raw_readl(S5P64X0_EPLL_CON_K));
574
575 clk_fout_apll.rate = apll;
576 clk_fout_mpll.rate = mpll;
577 clk_fout_epll.rate = epll;
578
579 printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
580 " E=%ld.%ldMHz\n",
581 print_mhz(apll), print_mhz(mpll), print_mhz(epll));
582
583 fclk = clk_get_rate(&clk_armclk.clk);
584 hclk = clk_get_rate(&clk_hclk.clk);
585 pclk = clk_get_rate(&clk_pclk.clk);
586 hclk_low = clk_get_rate(&clk_hclk_low.clk);
587 pclk_low = clk_get_rate(&clk_pclk_low.clk);
588
589 printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
590 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
591 print_mhz(hclk), print_mhz(hclk_low),
592 print_mhz(pclk), print_mhz(pclk_low));
593
594 clk_f.rate = fclk;
595 clk_h.rate = hclk;
596 clk_p.rate = pclk;
597
598 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
599 s3c_set_clksrc(&clksrcs[ptr], true);
600}
601
602static struct clk *clks[] __initdata = {
603 &clk_ext,
604 &clk_iis_cd_v40,
605 &clk_pcm_cd,
606};
607
608void __init s5p6440_register_clocks(void)
609{
610 int ptr;
611 unsigned int cnt;
612
613 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
614
615 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
616 s3c_register_clksrc(sysclks[ptr], 1);
617
618 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
619 for (cnt = 0; cnt < ARRAY_SIZE(clk_cdev); cnt++)
620 s3c_disable_clocks(clk_cdev[cnt], 1);
621
622 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
623 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
624 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
625 s3c_register_clksrc(clksrc_cdev[ptr], 1);
626
627 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
628 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
629 clkdev_add_table(s5p6440_clk_lookup, ARRAY_SIZE(s5p6440_clk_lookup));
630
631 s3c24xx_register_clock(&dummy_apb_pclk);
632}
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
deleted file mode 100644
index 0b3ca2ed53e9..000000000000
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ /dev/null
@@ -1,701 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/clock-s5p6450.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P6450 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/device.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26
27#include <plat/cpu-freq.h>
28#include <plat/clock.h>
29#include <plat/cpu.h>
30#include <plat/pll.h>
31#include <plat/s5p-clock.h>
32#include <plat/clock-clksrc.h>
33
34#include "clock.h"
35#include "common.h"
36
37static struct clksrc_clk clk_mout_dpll = {
38 .clk = {
39 .name = "mout_dpll",
40 },
41 .sources = &clk_src_dpll,
42 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 5, .size = 1 },
43};
44
45static u32 epll_div[][5] = {
46 { 133000000, 27307, 55, 2, 2 },
47 { 100000000, 43691, 41, 2, 2 },
48 { 480000000, 0, 80, 2, 0 },
49};
50
51static int s5p6450_epll_set_rate(struct clk *clk, unsigned long rate)
52{
53 unsigned int epll_con, epll_con_k;
54 unsigned int i;
55
56 if (clk->rate == rate) /* Return if nothing changed */
57 return 0;
58
59 epll_con = __raw_readl(S5P64X0_EPLL_CON);
60 epll_con_k = __raw_readl(S5P64X0_EPLL_CON_K);
61
62 epll_con_k &= ~(PLL90XX_KDIV_MASK);
63 epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
64
65 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
66 if (epll_div[i][0] == rate) {
67 epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
68 epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
69 (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
70 (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
71 break;
72 }
73 }
74
75 if (i == ARRAY_SIZE(epll_div)) {
76 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
77 return -EINVAL;
78 }
79
80 __raw_writel(epll_con, S5P64X0_EPLL_CON);
81 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
82
83 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
84 clk->rate, rate);
85
86 clk->rate = rate;
87
88 return 0;
89}
90
91static struct clk_ops s5p6450_epll_ops = {
92 .get_rate = s5p_epll_get_rate,
93 .set_rate = s5p6450_epll_set_rate,
94};
95
96static struct clksrc_clk clk_dout_epll = {
97 .clk = {
98 .name = "dout_epll",
99 .parent = &clk_mout_epll.clk,
100 },
101 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 24, .size = 4 },
102};
103
104static struct clksrc_clk clk_mout_hclk_sel = {
105 .clk = {
106 .name = "mout_hclk_sel",
107 },
108 .sources = &clkset_hclk_low,
109 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 15, .size = 1 },
110};
111
112static struct clk *clkset_hclk_list[] = {
113 &clk_mout_hclk_sel.clk,
114 &clk_armclk.clk,
115};
116
117static struct clksrc_sources clkset_hclk = {
118 .sources = clkset_hclk_list,
119 .nr_sources = ARRAY_SIZE(clkset_hclk_list),
120};
121
122static struct clksrc_clk clk_hclk = {
123 .clk = {
124 .name = "clk_hclk",
125 },
126 .sources = &clkset_hclk,
127 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 14, .size = 1 },
128 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
129};
130
131static struct clksrc_clk clk_pclk = {
132 .clk = {
133 .name = "clk_pclk",
134 .parent = &clk_hclk.clk,
135 },
136 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
137};
138static struct clksrc_clk clk_dout_pwm_ratio0 = {
139 .clk = {
140 .name = "clk_dout_pwm_ratio0",
141 .parent = &clk_mout_hclk_sel.clk,
142 },
143 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 16, .size = 4 },
144};
145
146static struct clksrc_clk clk_pclk_to_wdt_pwm = {
147 .clk = {
148 .name = "clk_pclk_to_wdt_pwm",
149 .parent = &clk_dout_pwm_ratio0.clk,
150 },
151 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 20, .size = 4 },
152};
153
154static struct clksrc_clk clk_hclk_low = {
155 .clk = {
156 .name = "clk_hclk_low",
157 },
158 .sources = &clkset_hclk_low,
159 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 6, .size = 1 },
160 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 8, .size = 4 },
161};
162
163static struct clksrc_clk clk_pclk_low = {
164 .clk = {
165 .name = "clk_pclk_low",
166 .parent = &clk_hclk_low.clk,
167 },
168 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
169};
170
171/*
172 * The following clocks will be disabled during clock initialization. It is
173 * recommended to keep the following clocks disabled until the driver requests
174 * for enabling the clock.
175 */
176static struct clk init_clocks_off[] = {
177 {
178 .name = "usbhost",
179 .parent = &clk_hclk_low.clk,
180 .enable = s5p64x0_hclk0_ctrl,
181 .ctrlbit = (1 << 3),
182 }, {
183 .name = "dma",
184 .devname = "dma-pl330",
185 .parent = &clk_hclk_low.clk,
186 .enable = s5p64x0_hclk0_ctrl,
187 .ctrlbit = (1 << 12),
188 }, {
189 .name = "hsmmc",
190 .devname = "s3c-sdhci.0",
191 .parent = &clk_hclk_low.clk,
192 .enable = s5p64x0_hclk0_ctrl,
193 .ctrlbit = (1 << 17),
194 }, {
195 .name = "hsmmc",
196 .devname = "s3c-sdhci.1",
197 .parent = &clk_hclk_low.clk,
198 .enable = s5p64x0_hclk0_ctrl,
199 .ctrlbit = (1 << 18),
200 }, {
201 .name = "hsmmc",
202 .devname = "s3c-sdhci.2",
203 .parent = &clk_hclk_low.clk,
204 .enable = s5p64x0_hclk0_ctrl,
205 .ctrlbit = (1 << 19),
206 }, {
207 .name = "usbotg",
208 .parent = &clk_hclk_low.clk,
209 .enable = s5p64x0_hclk0_ctrl,
210 .ctrlbit = (1 << 20),
211 }, {
212 .name = "lcd",
213 .parent = &clk_h,
214 .enable = s5p64x0_hclk1_ctrl,
215 .ctrlbit = (1 << 1),
216 }, {
217 .name = "watchdog",
218 .parent = &clk_pclk_low.clk,
219 .enable = s5p64x0_pclk_ctrl,
220 .ctrlbit = (1 << 5),
221 }, {
222 .name = "rtc",
223 .parent = &clk_pclk_low.clk,
224 .enable = s5p64x0_pclk_ctrl,
225 .ctrlbit = (1 << 6),
226 }, {
227 .name = "adc",
228 .parent = &clk_pclk_low.clk,
229 .enable = s5p64x0_pclk_ctrl,
230 .ctrlbit = (1 << 12),
231 }, {
232 .name = "i2c",
233 .devname = "s3c2440-i2c.0",
234 .parent = &clk_pclk_low.clk,
235 .enable = s5p64x0_pclk_ctrl,
236 .ctrlbit = (1 << 17),
237 }, {
238 .name = "spi",
239 .devname = "s5p64x0-spi.0",
240 .parent = &clk_pclk_low.clk,
241 .enable = s5p64x0_pclk_ctrl,
242 .ctrlbit = (1 << 21),
243 }, {
244 .name = "spi",
245 .devname = "s5p64x0-spi.1",
246 .parent = &clk_pclk_low.clk,
247 .enable = s5p64x0_pclk_ctrl,
248 .ctrlbit = (1 << 22),
249 }, {
250 .name = "i2c",
251 .devname = "s3c2440-i2c.1",
252 .parent = &clk_pclk_low.clk,
253 .enable = s5p64x0_pclk_ctrl,
254 .ctrlbit = (1 << 27),
255 }, {
256 .name = "dmc0",
257 .parent = &clk_pclk.clk,
258 .enable = s5p64x0_pclk_ctrl,
259 .ctrlbit = (1 << 30),
260 }
261};
262
263/*
264 * The following clocks will be enabled during clock initialization.
265 */
266static struct clk init_clocks[] = {
267 {
268 .name = "intc",
269 .parent = &clk_hclk.clk,
270 .enable = s5p64x0_hclk0_ctrl,
271 .ctrlbit = (1 << 1),
272 }, {
273 .name = "mem",
274 .parent = &clk_hclk.clk,
275 .enable = s5p64x0_hclk0_ctrl,
276 .ctrlbit = (1 << 21),
277 }, {
278 .name = "uart",
279 .devname = "s3c6400-uart.0",
280 .parent = &clk_pclk_low.clk,
281 .enable = s5p64x0_pclk_ctrl,
282 .ctrlbit = (1 << 1),
283 }, {
284 .name = "uart",
285 .devname = "s3c6400-uart.1",
286 .parent = &clk_pclk_low.clk,
287 .enable = s5p64x0_pclk_ctrl,
288 .ctrlbit = (1 << 2),
289 }, {
290 .name = "uart",
291 .devname = "s3c6400-uart.2",
292 .parent = &clk_pclk_low.clk,
293 .enable = s5p64x0_pclk_ctrl,
294 .ctrlbit = (1 << 3),
295 }, {
296 .name = "uart",
297 .devname = "s3c6400-uart.3",
298 .parent = &clk_pclk_low.clk,
299 .enable = s5p64x0_pclk_ctrl,
300 .ctrlbit = (1 << 4),
301 }, {
302 .name = "timers",
303 .parent = &clk_pclk_to_wdt_pwm.clk,
304 .enable = s5p64x0_pclk_ctrl,
305 .ctrlbit = (1 << 7),
306 }, {
307 .name = "gpio",
308 .parent = &clk_pclk_low.clk,
309 .enable = s5p64x0_pclk_ctrl,
310 .ctrlbit = (1 << 18),
311 },
312};
313
314static struct clk *clkset_uart_list[] = {
315 &clk_dout_epll.clk,
316 &clk_dout_mpll.clk,
317};
318
319static struct clksrc_sources clkset_uart = {
320 .sources = clkset_uart_list,
321 .nr_sources = ARRAY_SIZE(clkset_uart_list),
322};
323
324static struct clk *clkset_mali_list[] = {
325 &clk_mout_epll.clk,
326 &clk_mout_apll.clk,
327 &clk_mout_mpll.clk,
328};
329
330static struct clksrc_sources clkset_mali = {
331 .sources = clkset_mali_list,
332 .nr_sources = ARRAY_SIZE(clkset_mali_list),
333};
334
335static struct clk *clkset_group2_list[] = {
336 &clk_dout_epll.clk,
337 &clk_dout_mpll.clk,
338 &clk_ext_xtal_mux,
339};
340
341static struct clksrc_sources clkset_group2 = {
342 .sources = clkset_group2_list,
343 .nr_sources = ARRAY_SIZE(clkset_group2_list),
344};
345
346static struct clk *clkset_dispcon_list[] = {
347 &clk_dout_epll.clk,
348 &clk_dout_mpll.clk,
349 &clk_ext_xtal_mux,
350 &clk_mout_dpll.clk,
351};
352
353static struct clksrc_sources clkset_dispcon = {
354 .sources = clkset_dispcon_list,
355 .nr_sources = ARRAY_SIZE(clkset_dispcon_list),
356};
357
358static struct clk *clkset_hsmmc44_list[] = {
359 &clk_dout_epll.clk,
360 &clk_dout_mpll.clk,
361 &clk_ext_xtal_mux,
362 &s5p_clk_27m,
363 &clk_48m,
364};
365
366static struct clksrc_sources clkset_hsmmc44 = {
367 .sources = clkset_hsmmc44_list,
368 .nr_sources = ARRAY_SIZE(clkset_hsmmc44_list),
369};
370
371static struct clk *clkset_sclk_audio0_list[] = {
372 [0] = &clk_dout_epll.clk,
373 [1] = &clk_dout_mpll.clk,
374 [2] = &clk_ext_xtal_mux,
375 [3] = NULL,
376 [4] = NULL,
377};
378
379static struct clksrc_sources clkset_sclk_audio0 = {
380 .sources = clkset_sclk_audio0_list,
381 .nr_sources = ARRAY_SIZE(clkset_sclk_audio0_list),
382};
383
384static struct clksrc_clk clk_sclk_audio0 = {
385 .clk = {
386 .name = "audio-bus",
387 .devname = "samsung-i2s.0",
388 .enable = s5p64x0_sclk_ctrl,
389 .ctrlbit = (1 << 8),
390 .parent = &clk_dout_epll.clk,
391 },
392 .sources = &clkset_sclk_audio0,
393 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 10, .size = 3 },
394 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 8, .size = 4 },
395};
396
397static struct clksrc_clk clksrcs[] = {
398 {
399 .clk = {
400 .name = "sclk_fimc",
401 .ctrlbit = (1 << 10),
402 .enable = s5p64x0_sclk_ctrl,
403 },
404 .sources = &clkset_group2,
405 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 26, .size = 2 },
406 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 12, .size = 4 },
407 }, {
408 .clk = {
409 .name = "aclk_mali",
410 .ctrlbit = (1 << 2),
411 .enable = s5p64x0_sclk1_ctrl,
412 },
413 .sources = &clkset_mali,
414 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
415 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
416 }, {
417 .clk = {
418 .name = "sclk_2d",
419 .ctrlbit = (1 << 12),
420 .enable = s5p64x0_sclk_ctrl,
421 },
422 .sources = &clkset_mali,
423 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 30, .size = 2 },
424 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 20, .size = 4 },
425 }, {
426 .clk = {
427 .name = "sclk_usi",
428 .ctrlbit = (1 << 7),
429 .enable = s5p64x0_sclk_ctrl,
430 },
431 .sources = &clkset_group2,
432 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 10, .size = 2 },
433 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 16, .size = 4 },
434 }, {
435 .clk = {
436 .name = "sclk_camif",
437 .ctrlbit = (1 << 6),
438 .enable = s5p64x0_sclk_ctrl,
439 },
440 .sources = &clkset_group2,
441 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 28, .size = 2 },
442 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 20, .size = 4 },
443 }, {
444 .clk = {
445 .name = "sclk_dispcon",
446 .ctrlbit = (1 << 1),
447 .enable = s5p64x0_sclk1_ctrl,
448 },
449 .sources = &clkset_dispcon,
450 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 4, .size = 2 },
451 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 0, .size = 4 },
452 }, {
453 .clk = {
454 .name = "sclk_hsmmc44",
455 .ctrlbit = (1 << 30),
456 .enable = s5p64x0_sclk_ctrl,
457 },
458 .sources = &clkset_hsmmc44,
459 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 6, .size = 3 },
460 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 28, .size = 4 },
461 },
462};
463
464static struct clksrc_clk clk_sclk_mmc0 = {
465 .clk = {
466 .name = "sclk_mmc",
467 .devname = "s3c-sdhci.0",
468 .ctrlbit = (1 << 24),
469 .enable = s5p64x0_sclk_ctrl,
470 },
471 .sources = &clkset_group2,
472 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 18, .size = 2 },
473 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
474};
475
476static struct clksrc_clk clk_sclk_mmc1 = {
477 .clk = {
478 .name = "sclk_mmc",
479 .devname = "s3c-sdhci.1",
480 .ctrlbit = (1 << 25),
481 .enable = s5p64x0_sclk_ctrl,
482 },
483 .sources = &clkset_group2,
484 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 20, .size = 2 },
485 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
486};
487
488static struct clksrc_clk clk_sclk_mmc2 = {
489 .clk = {
490 .name = "sclk_mmc",
491 .devname = "s3c-sdhci.2",
492 .ctrlbit = (1 << 26),
493 .enable = s5p64x0_sclk_ctrl,
494 },
495 .sources = &clkset_group2,
496 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 22, .size = 2 },
497 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
498};
499
500static struct clksrc_clk clk_sclk_uclk = {
501 .clk = {
502 .name = "uclk1",
503 .ctrlbit = (1 << 5),
504 .enable = s5p64x0_sclk_ctrl,
505 },
506 .sources = &clkset_uart,
507 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 13, .size = 1 },
508 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
509};
510
511static struct clksrc_clk clk_sclk_spi0 = {
512 .clk = {
513 .name = "sclk_spi",
514 .devname = "s5p64x0-spi.0",
515 .ctrlbit = (1 << 20),
516 .enable = s5p64x0_sclk_ctrl,
517 },
518 .sources = &clkset_group2,
519 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
520 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
521};
522
523static struct clksrc_clk clk_sclk_spi1 = {
524 .clk = {
525 .name = "sclk_spi",
526 .devname = "s5p64x0-spi.1",
527 .ctrlbit = (1 << 21),
528 .enable = s5p64x0_sclk_ctrl,
529 },
530 .sources = &clkset_group2,
531 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
532 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
533};
534
535static struct clk clk_i2s0 = {
536 .name = "iis",
537 .devname = "samsung-i2s.0",
538 .parent = &clk_pclk_low.clk,
539 .enable = s5p64x0_pclk_ctrl,
540 .ctrlbit = (1 << 26),
541};
542
543static struct clk clk_i2s1 = {
544 .name = "iis",
545 .devname = "samsung-i2s.1",
546 .parent = &clk_pclk_low.clk,
547 .enable = s5p64x0_pclk_ctrl,
548 .ctrlbit = (1 << 15),
549};
550
551static struct clk clk_i2s2 = {
552 .name = "iis",
553 .devname = "samsung-i2s.2",
554 .parent = &clk_pclk_low.clk,
555 .enable = s5p64x0_pclk_ctrl,
556 .ctrlbit = (1 << 16),
557};
558
559static struct clk *clk_cdev[] = {
560 &clk_i2s0,
561 &clk_i2s1,
562 &clk_i2s2,
563};
564
565static struct clksrc_clk *clksrc_cdev[] = {
566 &clk_sclk_uclk,
567 &clk_sclk_spi0,
568 &clk_sclk_spi1,
569 &clk_sclk_mmc0,
570 &clk_sclk_mmc1,
571 &clk_sclk_mmc2,
572 &clk_sclk_audio0,
573};
574
575static struct clk_lookup s5p6450_clk_lookup[] = {
576 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
577 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
578 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
579 CLKDEV_INIT("s5p64x0-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
580 CLKDEV_INIT("s5p64x0-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
581 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
582 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
583 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
584 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &clk_i2s0),
585 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk1", &clk_sclk_audio0.clk),
586 CLKDEV_INIT("samsung-i2s.1", "i2s_opclk0", &clk_i2s1),
587 CLKDEV_INIT("samsung-i2s.2", "i2s_opclk0", &clk_i2s2),
588};
589
590/* Clock initialization code */
591static struct clksrc_clk *sysclks[] = {
592 &clk_mout_apll,
593 &clk_mout_epll,
594 &clk_dout_epll,
595 &clk_mout_mpll,
596 &clk_dout_mpll,
597 &clk_armclk,
598 &clk_mout_hclk_sel,
599 &clk_dout_pwm_ratio0,
600 &clk_pclk_to_wdt_pwm,
601 &clk_hclk,
602 &clk_pclk,
603 &clk_hclk_low,
604 &clk_pclk_low,
605};
606
607static struct clk dummy_apb_pclk = {
608 .name = "apb_pclk",
609 .id = -1,
610};
611
612void __init_or_cpufreq s5p6450_setup_clocks(void)
613{
614 struct clk *xtal_clk;
615
616 unsigned long xtal;
617 unsigned long fclk;
618 unsigned long hclk;
619 unsigned long hclk_low;
620 unsigned long pclk;
621 unsigned long pclk_low;
622
623 unsigned long apll;
624 unsigned long mpll;
625 unsigned long epll;
626 unsigned long dpll;
627 unsigned int ptr;
628
629 /* Set S5P6450 functions for clk_fout_epll */
630
631 clk_fout_epll.enable = s5p_epll_enable;
632 clk_fout_epll.ops = &s5p6450_epll_ops;
633
634 clk_48m.enable = s5p64x0_clk48m_ctrl;
635
636 xtal_clk = clk_get(NULL, "ext_xtal");
637 BUG_ON(IS_ERR(xtal_clk));
638
639 xtal = clk_get_rate(xtal_clk);
640 clk_put(xtal_clk);
641
642 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_APLL_CON), pll_4502);
643 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_MPLL_CON), pll_4502);
644 epll = s5p_get_pll90xx(xtal, __raw_readl(S5P64X0_EPLL_CON),
645 __raw_readl(S5P64X0_EPLL_CON_K));
646 dpll = s5p_get_pll46xx(xtal, __raw_readl(S5P6450_DPLL_CON),
647 __raw_readl(S5P6450_DPLL_CON_K), pll_4650c);
648
649 clk_fout_apll.rate = apll;
650 clk_fout_mpll.rate = mpll;
651 clk_fout_epll.rate = epll;
652 clk_fout_dpll.rate = dpll;
653
654 printk(KERN_INFO "S5P6450: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
655 " E=%ld.%ldMHz, D=%ld.%ldMHz\n",
656 print_mhz(apll), print_mhz(mpll), print_mhz(epll),
657 print_mhz(dpll));
658
659 fclk = clk_get_rate(&clk_armclk.clk);
660 hclk = clk_get_rate(&clk_hclk.clk);
661 pclk = clk_get_rate(&clk_pclk.clk);
662 hclk_low = clk_get_rate(&clk_hclk_low.clk);
663 pclk_low = clk_get_rate(&clk_pclk_low.clk);
664
665 printk(KERN_INFO "S5P6450: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
666 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
667 print_mhz(hclk), print_mhz(hclk_low),
668 print_mhz(pclk), print_mhz(pclk_low));
669
670 clk_f.rate = fclk;
671 clk_h.rate = hclk;
672 clk_p.rate = pclk;
673
674 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
675 s3c_set_clksrc(&clksrcs[ptr], true);
676}
677
678void __init s5p6450_register_clocks(void)
679{
680 int ptr;
681 unsigned int cnt;
682
683 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
684 s3c_register_clksrc(sysclks[ptr], 1);
685
686
687 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
688 for (cnt = 0; cnt < ARRAY_SIZE(clk_cdev); cnt++)
689 s3c_disable_clocks(clk_cdev[cnt], 1);
690
691 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
692 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
693 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
694 s3c_register_clksrc(clksrc_cdev[ptr], 1);
695
696 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
697 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
698 clkdev_add_table(s5p6450_clk_lookup, ARRAY_SIZE(s5p6450_clk_lookup));
699
700 s3c24xx_register_clock(&dummy_apb_pclk);
701}
diff --git a/arch/arm/mach-s5p64x0/clock.c b/arch/arm/mach-s5p64x0/clock.c
deleted file mode 100644
index 57e718957ef3..000000000000
--- a/arch/arm/mach-s5p64x0/clock.c
+++ /dev/null
@@ -1,236 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/clock.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/device.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26
27#include <plat/cpu-freq.h>
28#include <plat/clock.h>
29#include <plat/cpu.h>
30#include <plat/pll.h>
31#include <plat/s5p-clock.h>
32#include <plat/clock-clksrc.h>
33
34#include "common.h"
35
36struct clksrc_clk clk_mout_apll = {
37 .clk = {
38 .name = "mout_apll",
39 .id = -1,
40 },
41 .sources = &clk_src_apll,
42 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 0, .size = 1 },
43};
44
45struct clksrc_clk clk_mout_mpll = {
46 .clk = {
47 .name = "mout_mpll",
48 .id = -1,
49 },
50 .sources = &clk_src_mpll,
51 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 1, .size = 1 },
52};
53
54struct clksrc_clk clk_mout_epll = {
55 .clk = {
56 .name = "mout_epll",
57 .id = -1,
58 },
59 .sources = &clk_src_epll,
60 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 2, .size = 1 },
61};
62
63enum perf_level {
64 L0 = 532*1000,
65 L1 = 266*1000,
66 L2 = 133*1000,
67};
68
69static const u32 clock_table[][3] = {
70 /*{ARM_CLK, DIVarm, DIVhclk}*/
71 {L0 * 1000, (0 << ARM_DIV_RATIO_SHIFT), (3 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
72 {L1 * 1000, (1 << ARM_DIV_RATIO_SHIFT), (1 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
73 {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
74};
75
76static unsigned long s5p64x0_armclk_get_rate(struct clk *clk)
77{
78 unsigned long rate = clk_get_rate(clk->parent);
79 u32 clkdiv;
80
81 /* divisor mask starts at bit0, so no need to shift */
82 clkdiv = __raw_readl(ARM_CLK_DIV) & ARM_DIV_MASK;
83
84 return rate / (clkdiv + 1);
85}
86
87static unsigned long s5p64x0_armclk_round_rate(struct clk *clk,
88 unsigned long rate)
89{
90 u32 iter;
91
92 for (iter = 1 ; iter < ARRAY_SIZE(clock_table) ; iter++) {
93 if (rate > clock_table[iter][0])
94 return clock_table[iter-1][0];
95 }
96
97 return clock_table[ARRAY_SIZE(clock_table) - 1][0];
98}
99
100static int s5p64x0_armclk_set_rate(struct clk *clk, unsigned long rate)
101{
102 u32 round_tmp;
103 u32 iter;
104 u32 clk_div0_tmp;
105 u32 cur_rate = clk->ops->get_rate(clk);
106 unsigned long flags;
107
108 round_tmp = clk->ops->round_rate(clk, rate);
109 if (round_tmp == cur_rate)
110 return 0;
111
112
113 for (iter = 0 ; iter < ARRAY_SIZE(clock_table) ; iter++) {
114 if (round_tmp == clock_table[iter][0])
115 break;
116 }
117
118 if (iter >= ARRAY_SIZE(clock_table))
119 iter = ARRAY_SIZE(clock_table) - 1;
120
121 local_irq_save(flags);
122 if (cur_rate > round_tmp) {
123 /* Frequency Down */
124 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK);
125 clk_div0_tmp |= clock_table[iter][1];
126 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
127
128 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) &
129 ~(S5P64X0_CLKDIV0_HCLK_MASK);
130 clk_div0_tmp |= clock_table[iter][2];
131 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
132
133
134 } else {
135 /* Frequency Up */
136 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) &
137 ~(S5P64X0_CLKDIV0_HCLK_MASK);
138 clk_div0_tmp |= clock_table[iter][2];
139 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
140
141 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK);
142 clk_div0_tmp |= clock_table[iter][1];
143 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
144 }
145 local_irq_restore(flags);
146
147 clk->rate = clock_table[iter][0];
148
149 return 0;
150}
151
152static struct clk_ops s5p64x0_clkarm_ops = {
153 .get_rate = s5p64x0_armclk_get_rate,
154 .set_rate = s5p64x0_armclk_set_rate,
155 .round_rate = s5p64x0_armclk_round_rate,
156};
157
158struct clksrc_clk clk_armclk = {
159 .clk = {
160 .name = "armclk",
161 .id = 1,
162 .parent = &clk_mout_apll.clk,
163 .ops = &s5p64x0_clkarm_ops,
164 },
165 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 0, .size = 4 },
166};
167
168struct clksrc_clk clk_dout_mpll = {
169 .clk = {
170 .name = "dout_mpll",
171 .id = -1,
172 .parent = &clk_mout_mpll.clk,
173 },
174 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 4, .size = 1 },
175};
176
177static struct clk *clkset_hclk_low_list[] = {
178 &clk_mout_apll.clk,
179 &clk_mout_mpll.clk,
180};
181
182struct clksrc_sources clkset_hclk_low = {
183 .sources = clkset_hclk_low_list,
184 .nr_sources = ARRAY_SIZE(clkset_hclk_low_list),
185};
186
187int s5p64x0_pclk_ctrl(struct clk *clk, int enable)
188{
189 return s5p_gatectrl(S5P64X0_CLK_GATE_PCLK, clk, enable);
190}
191
192int s5p64x0_hclk0_ctrl(struct clk *clk, int enable)
193{
194 return s5p_gatectrl(S5P64X0_CLK_GATE_HCLK0, clk, enable);
195}
196
197int s5p64x0_hclk1_ctrl(struct clk *clk, int enable)
198{
199 return s5p_gatectrl(S5P64X0_CLK_GATE_HCLK1, clk, enable);
200}
201
202int s5p64x0_sclk_ctrl(struct clk *clk, int enable)
203{
204 return s5p_gatectrl(S5P64X0_CLK_GATE_SCLK0, clk, enable);
205}
206
207int s5p64x0_sclk1_ctrl(struct clk *clk, int enable)
208{
209 return s5p_gatectrl(S5P64X0_CLK_GATE_SCLK1, clk, enable);
210}
211
212int s5p64x0_mem_ctrl(struct clk *clk, int enable)
213{
214 return s5p_gatectrl(S5P64X0_CLK_GATE_MEM0, clk, enable);
215}
216
217int s5p64x0_clk48m_ctrl(struct clk *clk, int enable)
218{
219 unsigned long flags;
220 u32 val;
221
222 /* can't rely on clock lock, this register has other usages */
223 local_irq_save(flags);
224
225 val = __raw_readl(S5P64X0_OTHERS);
226 if (enable)
227 val |= S5P64X0_OTHERS_USB_SIG_MASK;
228 else
229 val &= ~S5P64X0_OTHERS_USB_SIG_MASK;
230
231 __raw_writel(val, S5P64X0_OTHERS);
232
233 local_irq_restore(flags);
234
235 return 0;
236}
diff --git a/arch/arm/mach-s5p64x0/clock.h b/arch/arm/mach-s5p64x0/clock.h
deleted file mode 100644
index 28b8e3c6bd24..000000000000
--- a/arch/arm/mach-s5p64x0/clock.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Header file for s5p64x0 clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __MACH_S5P64X0_CLOCK_H
13#define __MACH_S5P64X0_CLOCK_H __FILE__
14
15#include <linux/clk.h>
16
17extern struct clksrc_clk clk_mout_apll;
18extern struct clksrc_clk clk_mout_mpll;
19extern struct clksrc_clk clk_mout_epll;
20
21extern int s5p64x0_epll_enable(struct clk *clk, int enable);
22extern unsigned long s5p64x0_epll_get_rate(struct clk *clk);
23
24extern struct clksrc_clk clk_armclk;
25extern struct clksrc_clk clk_dout_mpll;
26
27extern struct clksrc_sources clkset_hclk_low;
28
29extern int s5p64x0_pclk_ctrl(struct clk *clk, int enable);
30extern int s5p64x0_hclk0_ctrl(struct clk *clk, int enable);
31extern int s5p64x0_hclk1_ctrl(struct clk *clk, int enable);
32extern int s5p64x0_sclk_ctrl(struct clk *clk, int enable);
33extern int s5p64x0_sclk1_ctrl(struct clk *clk, int enable);
34extern int s5p64x0_mem_ctrl(struct clk *clk, int enable);
35
36extern int s5p64x0_clk48m_ctrl(struct clk *clk, int enable);
37
38#endif /* __MACH_S5P64X0_CLOCK_H */
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
deleted file mode 100644
index 9a43be002d78..000000000000
--- a/arch/arm/mach-s5p64x0/common.c
+++ /dev/null
@@ -1,490 +0,0 @@
1/*
2 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Codes for S5P64X0 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/init.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20#include <linux/device.h>
21#include <linux/serial_core.h>
22#include <linux/serial_s3c.h>
23#include <clocksource/samsung_pwm.h>
24#include <linux/platform_device.h>
25#include <linux/sched.h>
26#include <linux/dma-mapping.h>
27#include <linux/gpio.h>
28#include <linux/irq.h>
29#include <linux/reboot.h>
30
31#include <asm/irq.h>
32#include <asm/proc-fns.h>
33#include <asm/system_misc.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include <mach/map.h>
39#include <mach/hardware.h>
40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/cpu.h>
44#include <plat/clock.h>
45#include <plat/devs.h>
46#include <plat/pm.h>
47#include <plat/sdhci.h>
48#include <plat/adc-core.h>
49#include <plat/fb-core.h>
50#include <plat/spi-core.h>
51#include <plat/gpio-cfg.h>
52#include <plat/pwm-core.h>
53#include <plat/regs-irqtype.h>
54#include <plat/watchdog-reset.h>
55
56#include "common.h"
57
58static const char name_s5p6440[] = "S5P6440";
59static const char name_s5p6450[] = "S5P6450";
60
61static struct cpu_table cpu_ids[] __initdata = {
62 {
63 .idcode = S5P6440_CPU_ID,
64 .idmask = S5P64XX_CPU_MASK,
65 .map_io = s5p6440_map_io,
66 .init_clocks = s5p6440_init_clocks,
67 .init_uarts = s5p6440_init_uarts,
68 .init = s5p64x0_init,
69 .name = name_s5p6440,
70 }, {
71 .idcode = S5P6450_CPU_ID,
72 .idmask = S5P64XX_CPU_MASK,
73 .map_io = s5p6450_map_io,
74 .init_clocks = s5p6450_init_clocks,
75 .init_uarts = s5p6450_init_uarts,
76 .init = s5p64x0_init,
77 .name = name_s5p6450,
78 },
79};
80
81/* Initial IO mappings */
82
83static struct map_desc s5p64x0_iodesc[] __initdata = {
84 {
85 .virtual = (unsigned long)S5P_VA_CHIPID,
86 .pfn = __phys_to_pfn(S5P64X0_PA_CHIPID),
87 .length = SZ_4K,
88 .type = MT_DEVICE,
89 }, {
90 .virtual = (unsigned long)S3C_VA_SYS,
91 .pfn = __phys_to_pfn(S5P64X0_PA_SYSCON),
92 .length = SZ_64K,
93 .type = MT_DEVICE,
94 }, {
95 .virtual = (unsigned long)S3C_VA_TIMER,
96 .pfn = __phys_to_pfn(S5P64X0_PA_TIMER),
97 .length = SZ_16K,
98 .type = MT_DEVICE,
99 }, {
100 .virtual = (unsigned long)S3C_VA_WATCHDOG,
101 .pfn = __phys_to_pfn(S5P64X0_PA_WDT),
102 .length = SZ_4K,
103 .type = MT_DEVICE,
104 }, {
105 .virtual = (unsigned long)S5P_VA_SROMC,
106 .pfn = __phys_to_pfn(S5P64X0_PA_SROMC),
107 .length = SZ_4K,
108 .type = MT_DEVICE,
109 }, {
110 .virtual = (unsigned long)S5P_VA_GPIO,
111 .pfn = __phys_to_pfn(S5P64X0_PA_GPIO),
112 .length = SZ_4K,
113 .type = MT_DEVICE,
114 }, {
115 .virtual = (unsigned long)VA_VIC0,
116 .pfn = __phys_to_pfn(S5P64X0_PA_VIC0),
117 .length = SZ_16K,
118 .type = MT_DEVICE,
119 }, {
120 .virtual = (unsigned long)VA_VIC1,
121 .pfn = __phys_to_pfn(S5P64X0_PA_VIC1),
122 .length = SZ_16K,
123 .type = MT_DEVICE,
124 },
125};
126
127static struct map_desc s5p6440_iodesc[] __initdata = {
128 {
129 .virtual = (unsigned long)S3C_VA_UART,
130 .pfn = __phys_to_pfn(S5P6440_PA_UART(0)),
131 .length = SZ_4K,
132 .type = MT_DEVICE,
133 },
134};
135
136static struct map_desc s5p6450_iodesc[] __initdata = {
137 {
138 .virtual = (unsigned long)S3C_VA_UART,
139 .pfn = __phys_to_pfn(S5P6450_PA_UART(0)),
140 .length = SZ_512K,
141 .type = MT_DEVICE,
142 }, {
143 .virtual = (unsigned long)S3C_VA_UART + SZ_512K,
144 .pfn = __phys_to_pfn(S5P6450_PA_UART(5)),
145 .length = SZ_4K,
146 .type = MT_DEVICE,
147 },
148};
149
150static void s5p64x0_idle(void)
151{
152 unsigned long val;
153
154 val = __raw_readl(S5P64X0_PWR_CFG);
155 val &= ~(0x3 << 5);
156 val |= (0x1 << 5);
157 __raw_writel(val, S5P64X0_PWR_CFG);
158
159 cpu_do_idle();
160}
161
162static struct samsung_pwm_variant s5p64x0_pwm_variant = {
163 .bits = 32,
164 .div_base = 0,
165 .has_tint_cstat = true,
166 .tclk_mask = 0,
167};
168
169void __init samsung_set_timer_source(unsigned int event, unsigned int source)
170{
171 s5p64x0_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
172 s5p64x0_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
173}
174
175void __init samsung_timer_init(void)
176{
177 unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
178 IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
179 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
180 };
181
182 samsung_pwm_clocksource_init(S3C_VA_TIMER,
183 timer_irqs, &s5p64x0_pwm_variant);
184}
185
186/*
187 * s5p64x0_map_io
188 *
189 * register the standard CPU IO areas
190 */
191
192void __init s5p64x0_init_io(struct map_desc *mach_desc, int size)
193{
194 /* initialize the io descriptors we need for initialization */
195 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
196 if (mach_desc)
197 iotable_init(mach_desc, size);
198
199 /* detect cpu id and rev. */
200 s5p_init_cpu(S5P64X0_SYS_ID);
201
202 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
203 samsung_wdt_reset_init(S3C_VA_WATCHDOG);
204
205 samsung_pwm_set_platdata(&s5p64x0_pwm_variant);
206}
207
208#ifdef CONFIG_CPU_S5P6440
209void __init s5p6440_map_io(void)
210{
211 /* initialize any device information early */
212 s3c_adc_setname("s3c64xx-adc");
213 s3c_fb_setname("s5p64x0-fb");
214 s3c64xx_spi_setname("s5p64x0-spi");
215
216 s5p64x0_default_sdhci0();
217 s5p64x0_default_sdhci1();
218 s5p6440_default_sdhci2();
219
220 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
221}
222#endif
223
224#ifdef CONFIG_CPU_S5P6450
225void __init s5p6450_map_io(void)
226{
227 /* initialize any device information early */
228 s3c_adc_setname("s3c64xx-adc");
229 s3c_fb_setname("s5p64x0-fb");
230 s3c64xx_spi_setname("s5p64x0-spi");
231
232 s5p64x0_default_sdhci0();
233 s5p64x0_default_sdhci1();
234 s5p6450_default_sdhci2();
235
236 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc));
237}
238#endif
239
240/*
241 * s5p64x0_init_clocks
242 *
243 * register and setup the CPU clocks
244 */
245#ifdef CONFIG_CPU_S5P6440
246void __init s5p6440_init_clocks(int xtal)
247{
248 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
249
250 s3c24xx_register_baseclocks(xtal);
251 s5p_register_clocks(xtal);
252 s5p6440_register_clocks();
253 s5p6440_setup_clocks();
254}
255#endif
256
257#ifdef CONFIG_CPU_S5P6450
258void __init s5p6450_init_clocks(int xtal)
259{
260 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
261
262 s3c24xx_register_baseclocks(xtal);
263 s5p_register_clocks(xtal);
264 s5p6450_register_clocks();
265 s5p6450_setup_clocks();
266}
267#endif
268
269/*
270 * s5p64x0_init_irq
271 *
272 * register the CPU interrupts
273 */
274#ifdef CONFIG_CPU_S5P6440
275void __init s5p6440_init_irq(void)
276{
277 /* S5P6440 supports 2 VIC */
278 u32 vic[2];
279
280 /*
281 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
282 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
283 */
284 vic[0] = 0xff800ae7;
285 vic[1] = 0xffbf23e5;
286
287 s5p_init_irq(vic, ARRAY_SIZE(vic));
288}
289#endif
290
291#ifdef CONFIG_CPU_S5P6450
292void __init s5p6450_init_irq(void)
293{
294 /* S5P6450 supports only 2 VIC */
295 u32 vic[2];
296
297 /*
298 * VIC0 is missing IRQ_VIC0[(13-15), (21-22)]
299 * VIC1 is missing IRQ VIC1[12, 14, 23]
300 */
301 vic[0] = 0xff9f1fff;
302 vic[1] = 0xff7fafff;
303
304 s5p_init_irq(vic, ARRAY_SIZE(vic));
305}
306#endif
307
308struct bus_type s5p64x0_subsys = {
309 .name = "s5p64x0-core",
310 .dev_name = "s5p64x0-core",
311};
312
313static struct device s5p64x0_dev = {
314 .bus = &s5p64x0_subsys,
315};
316
317static int __init s5p64x0_core_init(void)
318{
319 return subsys_system_register(&s5p64x0_subsys, NULL);
320}
321core_initcall(s5p64x0_core_init);
322
323int __init s5p64x0_init(void)
324{
325 printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n");
326
327 /* set idle function */
328 arm_pm_idle = s5p64x0_idle;
329
330 return device_register(&s5p64x0_dev);
331}
332
333/* uart registration process */
334#ifdef CONFIG_CPU_S5P6440
335void __init s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no)
336{
337 int uart;
338
339 for (uart = 0; uart < no; uart++) {
340 s5p_uart_resources[uart].resources->start = S5P6440_PA_UART(uart);
341 s5p_uart_resources[uart].resources->end = S5P6440_PA_UART(uart) + S5P_SZ_UART;
342 }
343
344 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
345}
346#endif
347
348#ifdef CONFIG_CPU_S5P6450
349void __init s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no)
350{
351 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
352}
353#endif
354
355#define eint_offset(irq) ((irq) - IRQ_EINT(0))
356
357static int s5p64x0_irq_eint_set_type(struct irq_data *data, unsigned int type)
358{
359 int offs = eint_offset(data->irq);
360 int shift;
361 u32 ctrl, mask;
362 u32 newvalue = 0;
363
364 if (offs > 15)
365 return -EINVAL;
366
367 switch (type) {
368 case IRQ_TYPE_NONE:
369 printk(KERN_WARNING "No edge setting!\n");
370 break;
371 case IRQ_TYPE_EDGE_RISING:
372 newvalue = S3C2410_EXTINT_RISEEDGE;
373 break;
374 case IRQ_TYPE_EDGE_FALLING:
375 newvalue = S3C2410_EXTINT_FALLEDGE;
376 break;
377 case IRQ_TYPE_EDGE_BOTH:
378 newvalue = S3C2410_EXTINT_BOTHEDGE;
379 break;
380 case IRQ_TYPE_LEVEL_LOW:
381 newvalue = S3C2410_EXTINT_LOWLEV;
382 break;
383 case IRQ_TYPE_LEVEL_HIGH:
384 newvalue = S3C2410_EXTINT_HILEV;
385 break;
386 default:
387 printk(KERN_ERR "No such irq type %d", type);
388 return -EINVAL;
389 }
390
391 shift = (offs / 2) * 4;
392 mask = 0x7 << shift;
393
394 ctrl = __raw_readl(S5P64X0_EINT0CON0) & ~mask;
395 ctrl |= newvalue << shift;
396 __raw_writel(ctrl, S5P64X0_EINT0CON0);
397
398 /* Configure the GPIO pin for 6450 or 6440 based on CPU ID */
399 if (soc_is_s5p6450())
400 s3c_gpio_cfgpin(S5P6450_GPN(offs), S3C_GPIO_SFN(2));
401 else
402 s3c_gpio_cfgpin(S5P6440_GPN(offs), S3C_GPIO_SFN(2));
403
404 return 0;
405}
406
407/*
408 * s5p64x0_irq_demux_eint
409 *
410 * This function demuxes the IRQ from the group0 external interrupts,
411 * from IRQ_EINT(0) to IRQ_EINT(15). It is designed to be inlined into
412 * the specific handlers s5p64x0_irq_demux_eintX_Y.
413 */
414static inline void s5p64x0_irq_demux_eint(unsigned int start, unsigned int end)
415{
416 u32 status = __raw_readl(S5P64X0_EINT0PEND);
417 u32 mask = __raw_readl(S5P64X0_EINT0MASK);
418 unsigned int irq;
419
420 status &= ~mask;
421 status >>= start;
422 status &= (1 << (end - start + 1)) - 1;
423
424 for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
425 if (status & 1)
426 generic_handle_irq(irq);
427 status >>= 1;
428 }
429}
430
431static void s5p64x0_irq_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
432{
433 s5p64x0_irq_demux_eint(0, 3);
434}
435
436static void s5p64x0_irq_demux_eint4_11(unsigned int irq, struct irq_desc *desc)
437{
438 s5p64x0_irq_demux_eint(4, 11);
439}
440
441static void s5p64x0_irq_demux_eint12_15(unsigned int irq,
442 struct irq_desc *desc)
443{
444 s5p64x0_irq_demux_eint(12, 15);
445}
446
447static int s5p64x0_alloc_gc(void)
448{
449 struct irq_chip_generic *gc;
450 struct irq_chip_type *ct;
451
452 gc = irq_alloc_generic_chip("s5p64x0-eint", 1, S5P_IRQ_EINT_BASE,
453 S5P_VA_GPIO, handle_level_irq);
454 if (!gc) {
455 printk(KERN_ERR "%s: irq_alloc_generic_chip for group 0"
456 "external interrupts failed\n", __func__);
457 return -EINVAL;
458 }
459
460 ct = gc->chip_types;
461 ct->chip.irq_ack = irq_gc_ack_set_bit;
462 ct->chip.irq_mask = irq_gc_mask_set_bit;
463 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
464 ct->chip.irq_set_type = s5p64x0_irq_eint_set_type;
465 ct->chip.irq_set_wake = s3c_irqext_wake;
466 ct->regs.ack = EINT0PEND_OFFSET;
467 ct->regs.mask = EINT0MASK_OFFSET;
468 irq_setup_generic_chip(gc, IRQ_MSK(16), IRQ_GC_INIT_MASK_CACHE,
469 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
470 return 0;
471}
472
473static int __init s5p64x0_init_irq_eint(void)
474{
475 int ret = s5p64x0_alloc_gc();
476 irq_set_chained_handler(IRQ_EINT0_3, s5p64x0_irq_demux_eint0_3);
477 irq_set_chained_handler(IRQ_EINT4_11, s5p64x0_irq_demux_eint4_11);
478 irq_set_chained_handler(IRQ_EINT12_15, s5p64x0_irq_demux_eint12_15);
479
480 return ret;
481}
482arch_initcall(s5p64x0_init_irq_eint);
483
484void s5p64x0_restart(enum reboot_mode mode, const char *cmd)
485{
486 if (mode != REBOOT_SOFT)
487 samsung_wdt_reset();
488
489 soft_restart(0);
490}
diff --git a/arch/arm/mach-s5p64x0/common.h b/arch/arm/mach-s5p64x0/common.h
deleted file mode 100644
index cbe7f3d731d0..000000000000
--- a/arch/arm/mach-s5p64x0/common.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for S5P64X0 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ARCH_ARM_MACH_S5P64X0_COMMON_H
13#define __ARCH_ARM_MACH_S5P64X0_COMMON_H
14
15#include <linux/reboot.h>
16
17void s5p6440_init_irq(void);
18void s5p6450_init_irq(void);
19void s5p64x0_init_io(struct map_desc *mach_desc, int size);
20
21void s5p6440_register_clocks(void);
22void s5p6440_setup_clocks(void);
23
24void s5p6450_register_clocks(void);
25void s5p6450_setup_clocks(void);
26
27void s5p64x0_restart(enum reboot_mode mode, const char *cmd);
28extern int s5p64x0_init(void);
29
30#ifdef CONFIG_CPU_S5P6440
31
32extern void s5p6440_map_io(void);
33extern void s5p6440_init_clocks(int xtal);
34
35extern void s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no);
36
37#else
38#define s5p6440_init_clocks NULL
39#define s5p6440_init_uarts NULL
40#define s5p6440_map_io NULL
41#endif
42
43#ifdef CONFIG_CPU_S5P6450
44
45extern void s5p6450_map_io(void);
46extern void s5p6450_init_clocks(int xtal);
47
48extern void s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no);
49
50#else
51#define s5p6450_init_clocks NULL
52#define s5p6450_init_uarts NULL
53#define s5p6450_map_io NULL
54#endif
55
56#endif /* __ARCH_ARM_MACH_S5P64X0_COMMON_H */
diff --git a/arch/arm/mach-s5p64x0/dev-audio.c b/arch/arm/mach-s5p64x0/dev-audio.c
deleted file mode 100644
index 723d4773c323..000000000000
--- a/arch/arm/mach-s5p64x0/dev-audio.c
+++ /dev/null
@@ -1,176 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/dev-audio.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14
15#include <plat/gpio-cfg.h>
16#include <linux/platform_data/asoc-s3c.h>
17
18#include <mach/map.h>
19#include <mach/dma.h>
20#include <mach/irqs.h>
21
22static int s5p6440_cfg_i2s(struct platform_device *pdev)
23{
24 switch (pdev->id) {
25 case 0:
26 s3c_gpio_cfgpin_range(S5P6440_GPC(4), 2, S3C_GPIO_SFN(5));
27 s3c_gpio_cfgpin(S5P6440_GPC(7), S3C_GPIO_SFN(5));
28 s3c_gpio_cfgpin_range(S5P6440_GPH(6), 4, S3C_GPIO_SFN(5));
29 break;
30 default:
31 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
32 return -EINVAL;
33 }
34
35 return 0;
36}
37
38static struct s3c_audio_pdata s5p6440_i2s_pdata = {
39 .cfg_gpio = s5p6440_cfg_i2s,
40 .type = {
41 .i2s = {
42 .quirks = QUIRK_PRI_6CHAN,
43 },
44 },
45};
46
47static struct resource s5p64x0_i2s0_resource[] = {
48 [0] = DEFINE_RES_MEM(S5P64X0_PA_I2S, SZ_256),
49 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
50 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
51};
52
53struct platform_device s5p6440_device_iis = {
54 .name = "samsung-i2s",
55 .id = 0,
56 .num_resources = ARRAY_SIZE(s5p64x0_i2s0_resource),
57 .resource = s5p64x0_i2s0_resource,
58 .dev = {
59 .platform_data = &s5p6440_i2s_pdata,
60 },
61};
62
63static int s5p6450_cfg_i2s(struct platform_device *pdev)
64{
65 switch (pdev->id) {
66 case 0:
67 s3c_gpio_cfgpin_range(S5P6450_GPR(4), 5, S3C_GPIO_SFN(5));
68 s3c_gpio_cfgpin_range(S5P6450_GPR(13), 2, S3C_GPIO_SFN(5));
69 break;
70 case 1:
71 s3c_gpio_cfgpin(S5P6440_GPB(4), S3C_GPIO_SFN(5));
72 s3c_gpio_cfgpin_range(S5P6450_GPC(0), 4, S3C_GPIO_SFN(5));
73 break;
74 case 2:
75 s3c_gpio_cfgpin_range(S5P6450_GPK(0), 5, S3C_GPIO_SFN(5));
76 break;
77 default:
78 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
79 return -EINVAL;
80 }
81
82 return 0;
83}
84
85static struct s3c_audio_pdata s5p6450_i2s0_pdata = {
86 .cfg_gpio = s5p6450_cfg_i2s,
87 .type = {
88 .i2s = {
89 .quirks = QUIRK_PRI_6CHAN,
90 },
91 },
92};
93
94struct platform_device s5p6450_device_iis0 = {
95 .name = "samsung-i2s",
96 .id = 0,
97 .num_resources = ARRAY_SIZE(s5p64x0_i2s0_resource),
98 .resource = s5p64x0_i2s0_resource,
99 .dev = {
100 .platform_data = &s5p6450_i2s0_pdata,
101 },
102};
103
104static struct s3c_audio_pdata s5p6450_i2s_pdata = {
105 .cfg_gpio = s5p6450_cfg_i2s,
106};
107
108static struct resource s5p6450_i2s1_resource[] = {
109 [0] = DEFINE_RES_MEM(S5P6450_PA_I2S1, SZ_256),
110 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
111 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
112};
113
114struct platform_device s5p6450_device_iis1 = {
115 .name = "samsung-i2s",
116 .id = 1,
117 .num_resources = ARRAY_SIZE(s5p6450_i2s1_resource),
118 .resource = s5p6450_i2s1_resource,
119 .dev = {
120 .platform_data = &s5p6450_i2s_pdata,
121 },
122};
123
124static struct resource s5p6450_i2s2_resource[] = {
125 [0] = DEFINE_RES_MEM(S5P6450_PA_I2S2, SZ_256),
126 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
127 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
128};
129
130struct platform_device s5p6450_device_iis2 = {
131 .name = "samsung-i2s",
132 .id = 2,
133 .num_resources = ARRAY_SIZE(s5p6450_i2s2_resource),
134 .resource = s5p6450_i2s2_resource,
135 .dev = {
136 .platform_data = &s5p6450_i2s_pdata,
137 },
138};
139
140/* PCM Controller platform_devices */
141
142static int s5p6440_pcm_cfg_gpio(struct platform_device *pdev)
143{
144 switch (pdev->id) {
145 case 0:
146 s3c_gpio_cfgpin_range(S5P6440_GPR(6), 3, S3C_GPIO_SFN(2));
147 s3c_gpio_cfgpin_range(S5P6440_GPR(13), 2, S3C_GPIO_SFN(2));
148 break;
149
150 default:
151 printk(KERN_DEBUG "Invalid PCM Controller number!");
152 return -EINVAL;
153 }
154
155 return 0;
156}
157
158static struct s3c_audio_pdata s5p6440_pcm_pdata = {
159 .cfg_gpio = s5p6440_pcm_cfg_gpio,
160};
161
162static struct resource s5p6440_pcm0_resource[] = {
163 [0] = DEFINE_RES_MEM(S5P64X0_PA_PCM, SZ_256),
164 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
165 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
166};
167
168struct platform_device s5p6440_device_pcm = {
169 .name = "samsung-pcm",
170 .id = 0,
171 .num_resources = ARRAY_SIZE(s5p6440_pcm0_resource),
172 .resource = s5p6440_pcm0_resource,
173 .dev = {
174 .platform_data = &s5p6440_pcm_pdata,
175 },
176};
diff --git a/arch/arm/mach-s5p64x0/dma.c b/arch/arm/mach-s5p64x0/dma.c
deleted file mode 100644
index 9c4ce085f585..000000000000
--- a/arch/arm/mach-s5p64x0/dma.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/dma.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License 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., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/
23
24#include <linux/dma-mapping.h>
25#include <linux/amba/bus.h>
26#include <linux/amba/pl330.h>
27
28#include <asm/irq.h>
29
30#include <mach/map.h>
31#include <mach/irqs.h>
32#include <mach/regs-clock.h>
33#include <mach/dma.h>
34
35#include <plat/cpu.h>
36#include <plat/devs.h>
37#include <plat/irqs.h>
38
39static u8 s5p6440_pdma_peri[] = {
40 DMACH_UART0_RX,
41 DMACH_UART0_TX,
42 DMACH_UART1_RX,
43 DMACH_UART1_TX,
44 DMACH_UART2_RX,
45 DMACH_UART2_TX,
46 DMACH_UART3_RX,
47 DMACH_UART3_TX,
48 DMACH_MAX,
49 DMACH_MAX,
50 DMACH_PCM0_TX,
51 DMACH_PCM0_RX,
52 DMACH_I2S0_TX,
53 DMACH_I2S0_RX,
54 DMACH_SPI0_TX,
55 DMACH_SPI0_RX,
56 DMACH_MAX,
57 DMACH_MAX,
58 DMACH_MAX,
59 DMACH_MAX,
60 DMACH_SPI1_TX,
61 DMACH_SPI1_RX,
62};
63
64static struct dma_pl330_platdata s5p6440_pdma_pdata = {
65 .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri),
66 .peri_id = s5p6440_pdma_peri,
67};
68
69static u8 s5p6450_pdma_peri[] = {
70 DMACH_UART0_RX,
71 DMACH_UART0_TX,
72 DMACH_UART1_RX,
73 DMACH_UART1_TX,
74 DMACH_UART2_RX,
75 DMACH_UART2_TX,
76 DMACH_UART3_RX,
77 DMACH_UART3_TX,
78 DMACH_UART4_RX,
79 DMACH_UART4_TX,
80 DMACH_PCM0_TX,
81 DMACH_PCM0_RX,
82 DMACH_I2S0_TX,
83 DMACH_I2S0_RX,
84 DMACH_SPI0_TX,
85 DMACH_SPI0_RX,
86 DMACH_PCM1_TX,
87 DMACH_PCM1_RX,
88 DMACH_PCM2_TX,
89 DMACH_PCM2_RX,
90 DMACH_SPI1_TX,
91 DMACH_SPI1_RX,
92 DMACH_USI_TX,
93 DMACH_USI_RX,
94 DMACH_MAX,
95 DMACH_I2S1_TX,
96 DMACH_I2S1_RX,
97 DMACH_I2S2_TX,
98 DMACH_I2S2_RX,
99 DMACH_PWM,
100 DMACH_UART5_RX,
101 DMACH_UART5_TX,
102};
103
104static struct dma_pl330_platdata s5p6450_pdma_pdata = {
105 .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri),
106 .peri_id = s5p6450_pdma_peri,
107};
108
109static AMBA_AHB_DEVICE(s5p64x0_pdma, "dma-pl330", 0x00041330,
110 S5P64X0_PA_PDMA, {IRQ_DMA0}, NULL);
111
112static int __init s5p64x0_dma_init(void)
113{
114 if (soc_is_s5p6450()) {
115 dma_cap_set(DMA_SLAVE, s5p6450_pdma_pdata.cap_mask);
116 dma_cap_set(DMA_CYCLIC, s5p6450_pdma_pdata.cap_mask);
117 s5p64x0_pdma_device.dev.platform_data = &s5p6450_pdma_pdata;
118 } else {
119 dma_cap_set(DMA_SLAVE, s5p6440_pdma_pdata.cap_mask);
120 dma_cap_set(DMA_CYCLIC, s5p6440_pdma_pdata.cap_mask);
121 s5p64x0_pdma_device.dev.platform_data = &s5p6440_pdma_pdata;
122 }
123
124 amba_device_register(&s5p64x0_pdma_device, &iomem_resource);
125
126 return 0;
127}
128arch_initcall(s5p64x0_dma_init);
diff --git a/arch/arm/mach-s5p64x0/i2c.h b/arch/arm/mach-s5p64x0/i2c.h
deleted file mode 100644
index 1e5bb4ea200d..000000000000
--- a/arch/arm/mach-s5p64x0/i2c.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * S5P64X0 I2C configuration
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
12extern void s5p6440_i2c0_cfg_gpio(struct platform_device *dev);
13extern void s5p6440_i2c1_cfg_gpio(struct platform_device *dev);
14
15extern void s5p6450_i2c0_cfg_gpio(struct platform_device *dev);
16extern void s5p6450_i2c1_cfg_gpio(struct platform_device *dev);
diff --git a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
deleted file mode 100644
index 8759e7882bcb..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
+++ /dev/null
@@ -1,32 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11/* pull in the relevant register and map files. */
12
13#include <linux/serial_s3c.h>
14#include <plat/map-base.h>
15#include <plat/map-s5p.h>
16
17 .macro addruart, rp, rv, tmp
18 mov \rp, #0xE0000000
19 orr \rp, \rp, #0x00100000
20 ldr \rp, [\rp, #0x118 ]
21 and \rp, \rp, #0xff000
22 teq \rp, #0x50000 @@ S5P6450
23 ldreq \rp, =0xEC800000
24 movne \rp, #0xEC000000 @@ S5P6440
25 ldrne \rv, = S3C_VA_UART
26#if CONFIG_DEBUG_S3C_UART != 0
27 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
28 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
29#endif
30 .endm
31
32#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5p64x0/include/mach/dma.h b/arch/arm/mach-s5p64x0/include/mach/dma.h
deleted file mode 100644
index 5a622af461d7..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/dma.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
3 * Jaswinder Singh <jassi.brar@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef __MACH_DMA_H
21#define __MACH_DMA_H
22
23/* This platform uses the common common DMA API driver for PL330 */
24#include <plat/dma-pl330.h>
25
26#endif /* __MACH_DMA_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/gpio.h b/arch/arm/mach-s5p64x0/include/mach/gpio.h
deleted file mode 100644
index 06cd3c9b16ac..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/gpio.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/gpio.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - GPIO lib support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__
15
16/* GPIO bank sizes */
17
18#define S5P6440_GPIO_A_NR (6)
19#define S5P6440_GPIO_B_NR (7)
20#define S5P6440_GPIO_C_NR (8)
21#define S5P6440_GPIO_F_NR (16)
22#define S5P6440_GPIO_G_NR (7)
23#define S5P6440_GPIO_H_NR (10)
24#define S5P6440_GPIO_I_NR (16)
25#define S5P6440_GPIO_J_NR (12)
26#define S5P6440_GPIO_N_NR (16)
27#define S5P6440_GPIO_P_NR (8)
28#define S5P6440_GPIO_R_NR (15)
29
30#define S5P6450_GPIO_A_NR (6)
31#define S5P6450_GPIO_B_NR (7)
32#define S5P6450_GPIO_C_NR (8)
33#define S5P6450_GPIO_D_NR (8)
34#define S5P6450_GPIO_F_NR (16)
35#define S5P6450_GPIO_G_NR (14)
36#define S5P6450_GPIO_H_NR (10)
37#define S5P6450_GPIO_I_NR (16)
38#define S5P6450_GPIO_J_NR (12)
39#define S5P6450_GPIO_K_NR (5)
40#define S5P6450_GPIO_N_NR (16)
41#define S5P6450_GPIO_P_NR (11)
42#define S5P6450_GPIO_Q_NR (14)
43#define S5P6450_GPIO_R_NR (15)
44#define S5P6450_GPIO_S_NR (8)
45
46/* GPIO bank numbers */
47
48/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
49 * space for debugging purposes so that any accidental
50 * change from one gpio bank to another can be caught.
51*/
52
53#define S5P64X0_GPIO_NEXT(__gpio) \
54 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
55
56enum s5p6440_gpio_number {
57 S5P6440_GPIO_A_START = 0,
58 S5P6440_GPIO_B_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_A),
59 S5P6440_GPIO_C_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_B),
60 S5P6440_GPIO_F_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_C),
61 S5P6440_GPIO_G_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_F),
62 S5P6440_GPIO_H_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_G),
63 S5P6440_GPIO_I_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_H),
64 S5P6440_GPIO_J_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_I),
65 S5P6440_GPIO_N_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_J),
66 S5P6440_GPIO_P_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_N),
67 S5P6440_GPIO_R_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_P),
68};
69
70enum s5p6450_gpio_number {
71 S5P6450_GPIO_A_START = 0,
72 S5P6450_GPIO_B_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_A),
73 S5P6450_GPIO_C_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_B),
74 S5P6450_GPIO_D_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_C),
75 S5P6450_GPIO_F_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_D),
76 S5P6450_GPIO_G_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_F),
77 S5P6450_GPIO_H_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_G),
78 S5P6450_GPIO_I_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_H),
79 S5P6450_GPIO_J_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_I),
80 S5P6450_GPIO_K_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_J),
81 S5P6450_GPIO_N_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_K),
82 S5P6450_GPIO_P_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_N),
83 S5P6450_GPIO_Q_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_P),
84 S5P6450_GPIO_R_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_Q),
85 S5P6450_GPIO_S_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_R),
86};
87
88/* GPIO number definitions */
89
90#define S5P6440_GPA(_nr) (S5P6440_GPIO_A_START + (_nr))
91#define S5P6440_GPB(_nr) (S5P6440_GPIO_B_START + (_nr))
92#define S5P6440_GPC(_nr) (S5P6440_GPIO_C_START + (_nr))
93#define S5P6440_GPF(_nr) (S5P6440_GPIO_F_START + (_nr))
94#define S5P6440_GPG(_nr) (S5P6440_GPIO_G_START + (_nr))
95#define S5P6440_GPH(_nr) (S5P6440_GPIO_H_START + (_nr))
96#define S5P6440_GPI(_nr) (S5P6440_GPIO_I_START + (_nr))
97#define S5P6440_GPJ(_nr) (S5P6440_GPIO_J_START + (_nr))
98#define S5P6440_GPN(_nr) (S5P6440_GPIO_N_START + (_nr))
99#define S5P6440_GPP(_nr) (S5P6440_GPIO_P_START + (_nr))
100#define S5P6440_GPR(_nr) (S5P6440_GPIO_R_START + (_nr))
101
102#define S5P6450_GPA(_nr) (S5P6450_GPIO_A_START + (_nr))
103#define S5P6450_GPB(_nr) (S5P6450_GPIO_B_START + (_nr))
104#define S5P6450_GPC(_nr) (S5P6450_GPIO_C_START + (_nr))
105#define S5P6450_GPD(_nr) (S5P6450_GPIO_D_START + (_nr))
106#define S5P6450_GPF(_nr) (S5P6450_GPIO_F_START + (_nr))
107#define S5P6450_GPG(_nr) (S5P6450_GPIO_G_START + (_nr))
108#define S5P6450_GPH(_nr) (S5P6450_GPIO_H_START + (_nr))
109#define S5P6450_GPI(_nr) (S5P6450_GPIO_I_START + (_nr))
110#define S5P6450_GPJ(_nr) (S5P6450_GPIO_J_START + (_nr))
111#define S5P6450_GPK(_nr) (S5P6450_GPIO_K_START + (_nr))
112#define S5P6450_GPN(_nr) (S5P6450_GPIO_N_START + (_nr))
113#define S5P6450_GPP(_nr) (S5P6450_GPIO_P_START + (_nr))
114#define S5P6450_GPQ(_nr) (S5P6450_GPIO_Q_START + (_nr))
115#define S5P6450_GPR(_nr) (S5P6450_GPIO_R_START + (_nr))
116#define S5P6450_GPS(_nr) (S5P6450_GPIO_S_START + (_nr))
117
118/* the end of the S5P64X0 specific gpios */
119
120#define S5P6440_GPIO_END (S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
121#define S5P6450_GPIO_END (S5P6450_GPS(S5P6450_GPIO_S_NR) + 1)
122
123#define S5P64X0_GPIO_END (S5P6440_GPIO_END > S5P6450_GPIO_END ? \
124 S5P6440_GPIO_END : S5P6450_GPIO_END)
125
126#define S3C_GPIO_END S5P64X0_GPIO_END
127
128/* define the number of gpios we need to the one after the last GPIO range */
129
130#define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA)
131
132#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/hardware.h b/arch/arm/mach-s5p64x0/include/mach/hardware.h
deleted file mode 100644
index d3e87996dd9a..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/hardware.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/hardware.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Hardware 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_HARDWARE_H
14#define __ASM_ARCH_HARDWARE_H __FILE__
15
16/* currently nothing here, placeholder */
17
18#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/irqs.h b/arch/arm/mach-s5p64x0/include/mach/irqs.h
deleted file mode 100644
index 53982db9d259..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/irqs.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/irqs.h
2 *
3 * Copyright 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - IRQ definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_IRQS_H
14#define __ASM_ARCH_IRQS_H __FILE__
15
16#include <plat/irqs.h>
17
18/* VIC0 */
19
20#define IRQ_EINT0_3 S5P_IRQ_VIC0(0)
21#define IRQ_EINT4_11 S5P_IRQ_VIC0(1)
22#define IRQ_RTC_TIC S5P_IRQ_VIC0(2)
23#define IRQ_IIS1 S5P_IRQ_VIC0(3) /* for only S5P6450 */
24#define IRQ_IIS2 S5P_IRQ_VIC0(4) /* for only S5P6450 */
25#define IRQ_IIC1 S5P_IRQ_VIC0(5)
26#define IRQ_I2SV40 S5P_IRQ_VIC0(6)
27#define IRQ_GPS S5P_IRQ_VIC0(7) /* for only S5P6450 */
28
29#define IRQ_2D S5P_IRQ_VIC0(11)
30#define IRQ_TIMER0_VIC S5P_IRQ_VIC0(23)
31#define IRQ_TIMER1_VIC S5P_IRQ_VIC0(24)
32#define IRQ_TIMER2_VIC S5P_IRQ_VIC0(25)
33#define IRQ_WDT S5P_IRQ_VIC0(26)
34#define IRQ_TIMER3_VIC S5P_IRQ_VIC0(27)
35#define IRQ_TIMER4_VIC S5P_IRQ_VIC0(28)
36#define IRQ_DISPCON0 S5P_IRQ_VIC0(29)
37#define IRQ_DISPCON1 S5P_IRQ_VIC0(30)
38#define IRQ_DISPCON2 S5P_IRQ_VIC0(31)
39
40/* VIC1 */
41
42#define IRQ_EINT12_15 S5P_IRQ_VIC1(0)
43#define IRQ_PCM0 S5P_IRQ_VIC1(2)
44#define IRQ_PCM1 S5P_IRQ_VIC1(3) /* for only S5P6450 */
45#define IRQ_PCM2 S5P_IRQ_VIC1(4) /* for only S5P6450 */
46#define IRQ_UART0 S5P_IRQ_VIC1(5)
47#define IRQ_UART1 S5P_IRQ_VIC1(6)
48#define IRQ_UART2 S5P_IRQ_VIC1(7)
49#define IRQ_UART3 S5P_IRQ_VIC1(8)
50#define IRQ_DMA0 S5P_IRQ_VIC1(9)
51#define IRQ_UART4 S5P_IRQ_VIC1(10) /* S5P6450 */
52#define IRQ_UART5 S5P_IRQ_VIC1(11) /* S5P6450 */
53#define IRQ_NFC S5P_IRQ_VIC1(13)
54#define IRQ_USI S5P_IRQ_VIC1(15) /* S5P6450 */
55#define IRQ_SPI0 S5P_IRQ_VIC1(16)
56#define IRQ_SPI1 S5P_IRQ_VIC1(17)
57#define IRQ_HSMMC2 S5P_IRQ_VIC1(17) /* Shared */
58#define IRQ_IIC S5P_IRQ_VIC1(18)
59#define IRQ_DISPCON3 S5P_IRQ_VIC1(19)
60#define IRQ_EINT_GROUPS S5P_IRQ_VIC1(21)
61#define IRQ_PMU S5P_IRQ_VIC1(23) /* S5P6440 */
62#define IRQ_HSMMC0 S5P_IRQ_VIC1(24)
63#define IRQ_HSMMC1 S5P_IRQ_VIC1(25)
64#define IRQ_OTG S5P_IRQ_VIC1(26)
65#define IRQ_DSI S5P_IRQ_VIC1(27)
66#define IRQ_RTC_ALARM S5P_IRQ_VIC1(28)
67#define IRQ_TSI S5P_IRQ_VIC1(29)
68#define IRQ_PENDN S5P_IRQ_VIC1(30)
69#define IRQ_TC IRQ_PENDN
70#define IRQ_ADC S5P_IRQ_VIC1(31)
71
72/* UART interrupts, S5P6450 has 5 UARTs */
73#define IRQ_S5P_UART_BASE4 (96)
74#define IRQ_S5P_UART_BASE5 (100)
75
76#define IRQ_S5P_UART_RX4 (IRQ_S5P_UART_BASE4 + UART_IRQ_RXD)
77#define IRQ_S5P_UART_TX4 (IRQ_S5P_UART_BASE4 + UART_IRQ_TXD)
78#define IRQ_S5P_UART_ERR4 (IRQ_S5P_UART_BASE4 + UART_IRQ_ERR)
79
80#define IRQ_S5P_UART_RX5 (IRQ_S5P_UART_BASE5 + UART_IRQ_RXD)
81#define IRQ_S5P_UART_TX5 (IRQ_S5P_UART_BASE5 + UART_IRQ_TXD)
82#define IRQ_S5P_UART_ERR5 (IRQ_S5P_UART_BASE5 + UART_IRQ_ERR)
83
84/* S3C compatibilty defines */
85#define IRQ_S3CUART_RX4 IRQ_S5P_UART_RX4
86#define IRQ_S3CUART_RX5 IRQ_S5P_UART_RX5
87
88#define IRQ_I2S0 IRQ_I2SV40
89
90#define IRQ_LCD_FIFO IRQ_DISPCON0
91#define IRQ_LCD_VSYNC IRQ_DISPCON1
92#define IRQ_LCD_SYSTEM IRQ_DISPCON2
93
94/* S5P6450 EINT feature will be added */
95
96/*
97 * Since the IRQ_EINT(x) are a linear mapping on s5p6440 we just defined
98 * them as an IRQ_EINT(x) macro from S5P_IRQ_EINT_BASE which we place
99 * after the pair of VICs.
100 */
101
102#define S5P_IRQ_EINT_BASE (S5P_IRQ_VIC1(31) + 6)
103
104#define S5P_EINT(x) ((x) + S5P_IRQ_EINT_BASE)
105
106#define S5P_EINT_BASE1 (S5P_IRQ_EINT_BASE)
107/*
108 * S5P6440 has 0-15 external interrupts in group 0. Only these can be used
109 * to wake up from sleep. If request is beyond this range, by mistake, a large
110 * return value for an irq number should be indication of something amiss.
111 */
112#define S5P_EINT_BASE2 (0xf0000000)
113
114/*
115 * Next the external interrupt groups. These are similar to the IRQ_EINT(x)
116 * that they are sourced from the GPIO pins but with a different scheme for
117 * priority and source indication.
118 *
119 * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO
120 * interrupts, but for historical reasons they are kept apart from these
121 * next interrupts.
122 *
123 * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the
124 * machine specific support files.
125 */
126
127/* Actually, #6 and #7 are missing in the EINT_GROUP1 */
128#define IRQ_EINT_GROUP1_NR (15)
129#define IRQ_EINT_GROUP2_NR (8)
130#define IRQ_EINT_GROUP5_NR (7)
131#define IRQ_EINT_GROUP6_NR (10)
132/* Actually, #0, #1 and #2 are missing in the EINT_GROUP8 */
133#define IRQ_EINT_GROUP8_NR (11)
134
135#define IRQ_EINT_GROUP_BASE S5P_EINT(16)
136#define IRQ_EINT_GROUP1_BASE (IRQ_EINT_GROUP_BASE + 0)
137#define IRQ_EINT_GROUP2_BASE (IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR)
138#define IRQ_EINT_GROUP5_BASE (IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR)
139#define IRQ_EINT_GROUP6_BASE (IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR)
140#define IRQ_EINT_GROUP8_BASE (IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR)
141
142#define IRQ_EINT_GROUP(grp, x) (IRQ_EINT_GROUP##grp##_BASE + (x))
143
144/* Set the default NR_IRQS */
145
146#define NR_IRQS (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR + 1)
147
148#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
deleted file mode 100644
index 50a6e96d6389..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/map.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/map.h
2 *
3 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Memory map definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_MAP_H
14#define __ASM_ARCH_MAP_H __FILE__
15
16#include <plat/map-base.h>
17#include <plat/map-s5p.h>
18
19#define S5P64X0_PA_SDRAM 0x20000000
20
21#define S5P64X0_PA_CHIPID 0xE0000000
22
23#define S5P64X0_PA_SYSCON 0xE0100000
24
25#define S5P64X0_PA_GPIO 0xE0308000
26
27#define S5P64X0_PA_VIC0 0xE4000000
28#define S5P64X0_PA_VIC1 0xE4100000
29
30#define S5P64X0_PA_SROMC 0xE7000000
31
32#define S5P64X0_PA_PDMA 0xE9000000
33
34#define S5P64X0_PA_TIMER 0xEA000000
35#define S5P64X0_PA_RTC 0xEA100000
36#define S5P64X0_PA_WDT 0xEA200000
37
38#define S5P6440_PA_IIC0 0xEC104000
39#define S5P6440_PA_IIC1 0xEC20F000
40#define S5P6450_PA_IIC0 0xEC100000
41#define S5P6450_PA_IIC1 0xEC200000
42
43#define S5P64X0_PA_SPI0 0xEC400000
44#define S5P64X0_PA_SPI1 0xEC500000
45
46#define S5P64X0_PA_HSOTG 0xED100000
47
48#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
49
50#define S5P64X0_PA_FB 0xEE000000
51
52#define S5P64X0_PA_I2S 0xF2000000
53#define S5P6450_PA_I2S1 0xF2800000
54#define S5P6450_PA_I2S2 0xF2900000
55
56#define S5P64X0_PA_PCM 0xF2100000
57
58#define S5P64X0_PA_ADC 0xF3000000
59
60/* Compatibiltiy Defines */
61
62#define S3C_PA_HSMMC0 S5P64X0_PA_HSMMC(0)
63#define S3C_PA_HSMMC1 S5P64X0_PA_HSMMC(1)
64#define S3C_PA_HSMMC2 S5P64X0_PA_HSMMC(2)
65#define S3C_PA_IIC S5P6440_PA_IIC0
66#define S3C_PA_IIC1 S5P6440_PA_IIC1
67#define S3C_PA_RTC S5P64X0_PA_RTC
68#define S3C_PA_WDT S5P64X0_PA_WDT
69#define S3C_PA_FB S5P64X0_PA_FB
70#define S3C_PA_SPI0 S5P64X0_PA_SPI0
71#define S3C_PA_SPI1 S5P64X0_PA_SPI1
72
73#define S5P_PA_CHIPID S5P64X0_PA_CHIPID
74#define S5P_PA_SROMC S5P64X0_PA_SROMC
75#define S5P_PA_SYSCON S5P64X0_PA_SYSCON
76#define S5P_PA_TIMER S5P64X0_PA_TIMER
77
78#define SAMSUNG_PA_ADC S5P64X0_PA_ADC
79#define SAMSUNG_PA_TIMER S5P64X0_PA_TIMER
80
81/* UART */
82
83#define S5P6440_PA_UART(x) (0xEC000000 + ((x) * S3C_UART_OFFSET))
84#define S5P6450_PA_UART(x) ((x < 5) ? (0xEC800000 + ((x) * S3C_UART_OFFSET)) : (0xEC000000))
85
86#define S5P_PA_UART0 S5P6450_PA_UART(0)
87#define S5P_PA_UART1 S5P6450_PA_UART(1)
88#define S5P_PA_UART2 S5P6450_PA_UART(2)
89#define S5P_PA_UART3 S5P6450_PA_UART(3)
90#define S5P_PA_UART4 S5P6450_PA_UART(4)
91#define S5P_PA_UART5 S5P6450_PA_UART(5)
92
93#define S5P_SZ_UART SZ_256
94#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
95
96#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/pm-core.h b/arch/arm/mach-s5p64x0/include/mach/pm-core.h
deleted file mode 100644
index 1e0eb65b2b82..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/pm-core.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/pm-core.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - PM core support for arch/arm/plat-samsung/pm.c
7 *
8 * Based on PM core support for S3C64XX by Ben Dooks
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/serial_s3c.h>
16
17#include <mach/regs-gpio.h>
18
19static inline void s3c_pm_debug_init_uart(void)
20{
21 u32 tmp = __raw_readl(S5P64X0_CLK_GATE_PCLK);
22
23 /*
24 * As a note, since the S5P64X0 UARTs generally have multiple
25 * clock sources, we simply enable PCLK at the moment and hope
26 * that the resume settings for the UART are suitable for the
27 * use with PCLK.
28 */
29 tmp |= S5P64X0_CLK_GATE_PCLK_UART0;
30 tmp |= S5P64X0_CLK_GATE_PCLK_UART1;
31 tmp |= S5P64X0_CLK_GATE_PCLK_UART2;
32 tmp |= S5P64X0_CLK_GATE_PCLK_UART3;
33
34 __raw_writel(tmp, S5P64X0_CLK_GATE_PCLK);
35 udelay(10);
36}
37
38static inline void s3c_pm_arch_prepare_irqs(void)
39{
40 /* VIC should have already been taken care of */
41
42 /* clear any pending EINT0 interrupts */
43 __raw_writel(__raw_readl(S5P64X0_EINT0PEND), S5P64X0_EINT0PEND);
44}
45
46static inline void s3c_pm_arch_stop_clocks(void) { }
47static inline void s3c_pm_arch_show_resume_irqs(void) { }
48
49/*
50 * make these defines, we currently do not have any need to change
51 * the IRQ wake controls depending on the CPU we are running on
52 */
53#define s3c_irqwake_eintallow ((1 << 16) - 1)
54#define s3c_irqwake_intallow (~0)
55
56static inline void s3c_pm_arch_update_uart(void __iomem *regs,
57 struct pm_uart_save *save)
58{
59 u32 ucon = __raw_readl(regs + S3C2410_UCON);
60 u32 ucon_clk = ucon & S3C6400_UCON_CLKMASK;
61 u32 save_clk = save->ucon & S3C6400_UCON_CLKMASK;
62 u32 new_ucon;
63 u32 delta;
64
65 /*
66 * S5P64X0 UART blocks only support level interrupts, so ensure that
67 * when we restore unused UART blocks we force the level interrupt
68 * settings.
69 */
70 save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;
71
72 /*
73 * We have a constraint on changing the clock type of the UART
74 * between UCLKx and PCLK, so ensure that when we restore UCON
75 * that the CLK field is correctly modified if the bootloader
76 * has changed anything.
77 */
78 if (ucon_clk != save_clk) {
79 new_ucon = save->ucon;
80 delta = ucon_clk ^ save_clk;
81
82 /*
83 * change from UCLKx => wrong PCLK,
84 * either UCLK can be tested for by a bit-test
85 * with UCLK0
86 */
87 if (ucon_clk & S3C6400_UCON_UCLK0 &&
88 !(save_clk & S3C6400_UCON_UCLK0) &&
89 delta & S3C6400_UCON_PCLK2) {
90 new_ucon &= ~S3C6400_UCON_UCLK0;
91 } else if (delta == S3C6400_UCON_PCLK2) {
92 /*
93 * as a precaution, don't change from
94 * PCLK2 => PCLK or vice-versa
95 */
96 new_ucon ^= S3C6400_UCON_PCLK2;
97 }
98
99 S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",
100 ucon, new_ucon, save->ucon);
101 save->ucon = new_ucon;
102 }
103}
104
105static inline void s3c_pm_restored_gpios(void)
106{
107 /* ensure sleep mode has been cleared from the system */
108 __raw_writel(0, S5P64X0_SLPEN);
109}
110
111static inline void samsung_pm_saved_gpios(void)
112{
113 /*
114 * turn on the sleep mode and keep it there, as it seems that during
115 * suspend the xCON registers get re-set and thus you can end up with
116 * problems between going to sleep and resuming.
117 */
118 __raw_writel(S5P64X0_SLPEN_USE_xSLP, S5P64X0_SLPEN);
119}
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h b/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
deleted file mode 100644
index bd91112c813c..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Clock register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_CLOCK_H
14#define __ASM_ARCH_REGS_CLOCK_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_CLKREG(x) (S3C_VA_SYS + (x))
19
20#define S5P64X0_APLL_CON S5P_CLKREG(0x0C)
21#define S5P64X0_MPLL_CON S5P_CLKREG(0x10)
22#define S5P64X0_EPLL_CON S5P_CLKREG(0x14)
23#define S5P64X0_EPLL_CON_K S5P_CLKREG(0x18)
24
25#define S5P64X0_CLK_SRC0 S5P_CLKREG(0x1C)
26
27#define S5P64X0_CLK_DIV0 S5P_CLKREG(0x20)
28#define S5P64X0_CLK_DIV1 S5P_CLKREG(0x24)
29#define S5P64X0_CLK_DIV2 S5P_CLKREG(0x28)
30
31#define S5P64X0_CLK_GATE_HCLK0 S5P_CLKREG(0x30)
32#define S5P64X0_CLK_GATE_PCLK S5P_CLKREG(0x34)
33#define S5P64X0_CLK_GATE_SCLK0 S5P_CLKREG(0x38)
34#define S5P64X0_CLK_GATE_MEM0 S5P_CLKREG(0x3C)
35
36#define S5P64X0_CLK_DIV3 S5P_CLKREG(0x40)
37
38#define S5P64X0_CLK_GATE_HCLK1 S5P_CLKREG(0x44)
39#define S5P64X0_CLK_GATE_SCLK1 S5P_CLKREG(0x48)
40
41#define S5P6450_DPLL_CON S5P_CLKREG(0x50)
42#define S5P6450_DPLL_CON_K S5P_CLKREG(0x54)
43
44#define S5P64X0_AHB_CON0 S5P_CLKREG(0x100)
45#define S5P64X0_CLK_SRC1 S5P_CLKREG(0x10C)
46
47#define S5P64X0_SYS_ID S5P_CLKREG(0x118)
48#define S5P64X0_SYS_OTHERS S5P_CLKREG(0x11C)
49
50#define S5P64X0_PWR_CFG S5P_CLKREG(0x804)
51#define S5P64X0_EINT_WAKEUP_MASK S5P_CLKREG(0x808)
52#define S5P64X0_SLEEP_CFG S5P_CLKREG(0x818)
53#define S5P64X0_PWR_STABLE S5P_CLKREG(0x828)
54
55#define S5P64X0_OTHERS S5P_CLKREG(0x900)
56#define S5P64X0_WAKEUP_STAT S5P_CLKREG(0x908)
57
58#define S5P64X0_INFORM0 S5P_CLKREG(0xA00)
59
60#define S5P64X0_CLKDIV0_HCLK_SHIFT (8)
61#define S5P64X0_CLKDIV0_HCLK_MASK (0xF << S5P64X0_CLKDIV0_HCLK_SHIFT)
62
63/* HCLK GATE Registers */
64#define S5P64X0_CLK_GATE_HCLK1_FIMGVG (1 << 2)
65#define S5P64X0_CLK_GATE_SCLK1_FIMGVG (1 << 2)
66
67/* PCLK GATE Registers */
68#define S5P64X0_CLK_GATE_PCLK_UART3 (1 << 4)
69#define S5P64X0_CLK_GATE_PCLK_UART2 (1 << 3)
70#define S5P64X0_CLK_GATE_PCLK_UART1 (1 << 2)
71#define S5P64X0_CLK_GATE_PCLK_UART0 (1 << 1)
72
73#define S5P64X0_PWR_CFG_MMC1_DISABLE (1 << 15)
74#define S5P64X0_PWR_CFG_MMC0_DISABLE (1 << 14)
75#define S5P64X0_PWR_CFG_RTC_TICK_DISABLE (1 << 11)
76#define S5P64X0_PWR_CFG_RTC_ALRM_DISABLE (1 << 10)
77#define S5P64X0_PWR_CFG_WFI_MASK (3 << 5)
78#define S5P64X0_PWR_CFG_WFI_SLEEP (3 << 5)
79
80#define S5P64X0_SLEEP_CFG_OSC_EN (1 << 0)
81
82#define S5P64X0_PWR_STABLE_PWR_CNT_VAL4 (4 << 0)
83
84#define S5P6450_OTHERS_DISABLE_INT (1 << 31)
85#define S5P64X0_OTHERS_RET_UART (1 << 26)
86#define S5P64X0_OTHERS_RET_MMC1 (1 << 25)
87#define S5P64X0_OTHERS_RET_MMC0 (1 << 24)
88#define S5P64X0_OTHERS_USB_SIG_MASK (1 << 16)
89
90/* Compatibility defines */
91
92#define ARM_CLK_DIV S5P64X0_CLK_DIV0
93#define ARM_DIV_RATIO_SHIFT 0
94#define ARM_DIV_MASK (0xF << ARM_DIV_RATIO_SHIFT)
95
96#define S5P_EPLL_CON S5P64X0_EPLL_CON
97
98#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
deleted file mode 100644
index cfdfa4fdadf2..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - GPIO register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_GPIO_H
14#define __ASM_ARCH_REGS_GPIO_H __FILE__
15
16#include <mach/map.h>
17
18/* Base addresses for each of the banks */
19
20#define S5P64X0_GPA_BASE (S5P_VA_GPIO + 0x0000)
21#define S5P64X0_GPB_BASE (S5P_VA_GPIO + 0x0020)
22#define S5P64X0_GPC_BASE (S5P_VA_GPIO + 0x0040)
23#define S5P64X0_GPF_BASE (S5P_VA_GPIO + 0x00A0)
24#define S5P64X0_GPG_BASE (S5P_VA_GPIO + 0x00C0)
25#define S5P64X0_GPH_BASE (S5P_VA_GPIO + 0x00E0)
26#define S5P64X0_GPI_BASE (S5P_VA_GPIO + 0x0100)
27#define S5P64X0_GPJ_BASE (S5P_VA_GPIO + 0x0120)
28#define S5P64X0_GPN_BASE (S5P_VA_GPIO + 0x0830)
29#define S5P64X0_GPP_BASE (S5P_VA_GPIO + 0x0160)
30#define S5P64X0_GPR_BASE (S5P_VA_GPIO + 0x0290)
31
32#define S5P6450_GPD_BASE (S5P_VA_GPIO + 0x0060)
33#define S5P6450_GPK_BASE (S5P_VA_GPIO + 0x0140)
34#define S5P6450_GPQ_BASE (S5P_VA_GPIO + 0x0180)
35#define S5P6450_GPS_BASE (S5P_VA_GPIO + 0x0300)
36
37#define S5P64X0_SPCON0 (S5P_VA_GPIO + 0x1A0)
38#define S5P64X0_SPCON0_LCD_SEL_MASK (0x3 << 0)
39#define S5P64X0_SPCON0_LCD_SEL_RGB (0x1 << 0)
40#define S5P64X0_SPCON1 (S5P_VA_GPIO + 0x2B0)
41
42#define S5P64X0_MEM0CONSLP0 (S5P_VA_GPIO + 0x1C0)
43#define S5P64X0_MEM0CONSLP1 (S5P_VA_GPIO + 0x1C4)
44#define S5P64X0_MEM0DRVCON (S5P_VA_GPIO + 0x1D0)
45#define S5P64X0_MEM1DRVCON (S5P_VA_GPIO + 0x1D4)
46
47#define S5P64X0_EINT12CON (S5P_VA_GPIO + 0x200)
48#define S5P64X0_EINT12FLTCON (S5P_VA_GPIO + 0x220)
49#define S5P64X0_EINT12MASK (S5P_VA_GPIO + 0x240)
50
51/* External interrupt control registers for group0 */
52
53#define EINT0CON0_OFFSET (0x900)
54#define EINT0FLTCON0_OFFSET (0x910)
55#define EINT0FLTCON1_OFFSET (0x914)
56#define EINT0MASK_OFFSET (0x920)
57#define EINT0PEND_OFFSET (0x924)
58
59#define S5P64X0_EINT0CON0 (S5P_VA_GPIO + EINT0CON0_OFFSET)
60#define S5P64X0_EINT0FLTCON0 (S5P_VA_GPIO + EINT0FLTCON0_OFFSET)
61#define S5P64X0_EINT0FLTCON1 (S5P_VA_GPIO + EINT0FLTCON1_OFFSET)
62#define S5P64X0_EINT0MASK (S5P_VA_GPIO + EINT0MASK_OFFSET)
63#define S5P64X0_EINT0PEND (S5P_VA_GPIO + EINT0PEND_OFFSET)
64
65#define S5P64X0_SLPEN (S5P_VA_GPIO + 0x930)
66#define S5P64X0_SLPEN_USE_xSLP (1 << 0)
67
68#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-irq.h b/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
deleted file mode 100644
index d60397d1ff40..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - IRQ register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_IRQ_H
14#define __ASM_ARCH_REGS_IRQ_H __FILE__
15
16#include <mach/map.h>
17
18#endif /* __ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s5p64x0/irq-pm.c b/arch/arm/mach-s5p64x0/irq-pm.c
deleted file mode 100644
index 2ed921e095dc..000000000000
--- a/arch/arm/mach-s5p64x0/irq-pm.c
+++ /dev/null
@@ -1,98 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/irq-pm.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Interrupt handling Power Management
7 *
8 * Based on arch/arm/mach-s3c64xx/irq-pm.c by Ben Dooks
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/syscore_ops.h>
16#include <linux/serial_core.h>
17#include <linux/serial_s3c.h>
18#include <linux/io.h>
19
20#include <plat/pm.h>
21
22#include <mach/regs-gpio.h>
23
24static struct sleep_save irq_save[] = {
25 SAVE_ITEM(S5P64X0_EINT0CON0),
26 SAVE_ITEM(S5P64X0_EINT0FLTCON0),
27 SAVE_ITEM(S5P64X0_EINT0FLTCON1),
28 SAVE_ITEM(S5P64X0_EINT0MASK),
29};
30
31static struct irq_grp_save {
32 u32 con;
33 u32 fltcon;
34 u32 mask;
35} eint_grp_save[4];
36
37#ifdef CONFIG_SERIAL_SAMSUNG
38static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS];
39#endif
40
41static int s5p64x0_irq_pm_suspend(void)
42{
43 struct irq_grp_save *grp = eint_grp_save;
44 int i;
45
46 S3C_PMDBG("%s: suspending IRQs\n", __func__);
47
48 s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
49
50#ifdef CONFIG_SERIAL_SAMSUNG
51 for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++)
52 irq_uart_mask[i] = __raw_readl(S3C_VA_UARTx(i) + S3C64XX_UINTM);
53#endif
54
55 for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {
56 grp->con = __raw_readl(S5P64X0_EINT12CON + (i * 4));
57 grp->mask = __raw_readl(S5P64X0_EINT12MASK + (i * 4));
58 grp->fltcon = __raw_readl(S5P64X0_EINT12FLTCON + (i * 4));
59 }
60
61 return 0;
62}
63
64static void s5p64x0_irq_pm_resume(void)
65{
66 struct irq_grp_save *grp = eint_grp_save;
67 int i;
68
69 S3C_PMDBG("%s: resuming IRQs\n", __func__);
70
71 s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
72
73#ifdef CONFIG_SERIAL_SAMSUNG
74 for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++)
75 __raw_writel(irq_uart_mask[i], S3C_VA_UARTx(i) + S3C64XX_UINTM);
76#endif
77
78 for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {
79 __raw_writel(grp->con, S5P64X0_EINT12CON + (i * 4));
80 __raw_writel(grp->mask, S5P64X0_EINT12MASK + (i * 4));
81 __raw_writel(grp->fltcon, S5P64X0_EINT12FLTCON + (i * 4));
82 }
83
84 S3C_PMDBG("%s: IRQ configuration restored\n", __func__);
85}
86
87static struct syscore_ops s5p64x0_irq_syscore_ops = {
88 .suspend = s5p64x0_irq_pm_suspend,
89 .resume = s5p64x0_irq_pm_resume,
90};
91
92static int __init s5p64x0_syscore_init(void)
93{
94 register_syscore_ops(&s5p64x0_irq_syscore_ops);
95
96 return 0;
97}
98core_initcall(s5p64x0_syscore_init);
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
deleted file mode 100644
index 6840e197cb2d..000000000000
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ /dev/null
@@ -1,280 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/mach-smdk6440.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/i2c.h>
19#include <linux/serial_core.h>
20#include <linux/serial_s3c.h>
21#include <linux/platform_device.h>
22#include <linux/io.h>
23#include <linux/module.h>
24#include <linux/clk.h>
25#include <linux/gpio.h>
26#include <linux/pwm_backlight.h>
27#include <linux/fb.h>
28#include <linux/mmc/host.h>
29
30#include <video/platform_lcd.h>
31#include <video/samsung_fimd.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/irq.h>
36#include <asm/mach-types.h>
37
38#include <mach/hardware.h>
39#include <mach/map.h>
40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/gpio-cfg.h>
44#include <plat/clock.h>
45#include <plat/devs.h>
46#include <plat/cpu.h>
47#include <linux/platform_data/i2c-s3c2410.h>
48#include <plat/pll.h>
49#include <plat/adc.h>
50#include <linux/platform_data/touchscreen-s3c2410.h>
51#include <plat/samsung-time.h>
52#include <plat/backlight.h>
53#include <plat/fb.h>
54#include <plat/sdhci.h>
55
56#include "common.h"
57#include "i2c.h"
58
59#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
60 S3C2410_UCON_RXILEVEL | \
61 S3C2410_UCON_TXIRQMODE | \
62 S3C2410_UCON_RXIRQMODE | \
63 S3C2410_UCON_RXFIFO_TOI | \
64 S3C2443_UCON_RXERR_IRQEN)
65
66#define SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8
67
68#define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
69 S3C2440_UFCON_TXTRIG16 | \
70 S3C2410_UFCON_RXTRIG8)
71
72static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
73 [0] = {
74 .hwport = 0,
75 .flags = 0,
76 .ucon = SMDK6440_UCON_DEFAULT,
77 .ulcon = SMDK6440_ULCON_DEFAULT,
78 .ufcon = SMDK6440_UFCON_DEFAULT,
79 },
80 [1] = {
81 .hwport = 1,
82 .flags = 0,
83 .ucon = SMDK6440_UCON_DEFAULT,
84 .ulcon = SMDK6440_ULCON_DEFAULT,
85 .ufcon = SMDK6440_UFCON_DEFAULT,
86 },
87 [2] = {
88 .hwport = 2,
89 .flags = 0,
90 .ucon = SMDK6440_UCON_DEFAULT,
91 .ulcon = SMDK6440_ULCON_DEFAULT,
92 .ufcon = SMDK6440_UFCON_DEFAULT,
93 },
94 [3] = {
95 .hwport = 3,
96 .flags = 0,
97 .ucon = SMDK6440_UCON_DEFAULT,
98 .ulcon = SMDK6440_ULCON_DEFAULT,
99 .ufcon = SMDK6440_UFCON_DEFAULT,
100 },
101};
102
103/* Frame Buffer */
104static struct s3c_fb_pd_win smdk6440_fb_win0 = {
105 .max_bpp = 32,
106 .default_bpp = 24,
107 .xres = 800,
108 .yres = 480,
109};
110
111static struct fb_videomode smdk6440_lcd_timing = {
112 .left_margin = 8,
113 .right_margin = 13,
114 .upper_margin = 7,
115 .lower_margin = 5,
116 .hsync_len = 3,
117 .vsync_len = 1,
118 .xres = 800,
119 .yres = 480,
120};
121
122static struct s3c_fb_platdata smdk6440_lcd_pdata __initdata = {
123 .win[0] = &smdk6440_fb_win0,
124 .vtiming = &smdk6440_lcd_timing,
125 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
126 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
127 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
128};
129
130/* LCD power controller */
131static void smdk6440_lte480_reset_power(struct plat_lcd_data *pd,
132 unsigned int power)
133{
134 int err;
135
136 if (power) {
137 err = gpio_request(S5P6440_GPN(5), "GPN");
138 if (err) {
139 printk(KERN_ERR "failed to request GPN for lcd reset\n");
140 return;
141 }
142
143 gpio_direction_output(S5P6440_GPN(5), 1);
144 gpio_set_value(S5P6440_GPN(5), 0);
145 gpio_set_value(S5P6440_GPN(5), 1);
146 gpio_free(S5P6440_GPN(5));
147 }
148}
149
150static struct plat_lcd_data smdk6440_lcd_power_data = {
151 .set_power = smdk6440_lte480_reset_power,
152};
153
154static struct platform_device smdk6440_lcd_lte480wv = {
155 .name = "platform-lcd",
156 .dev.parent = &s3c_device_fb.dev,
157 .dev.platform_data = &smdk6440_lcd_power_data,
158};
159
160static struct platform_device *smdk6440_devices[] __initdata = {
161 &s3c_device_adc,
162 &s3c_device_rtc,
163 &s3c_device_i2c0,
164 &s3c_device_i2c1,
165 &samsung_device_pwm,
166 &s3c_device_ts,
167 &s3c_device_wdt,
168 &s5p6440_device_iis,
169 &s3c_device_fb,
170 &smdk6440_lcd_lte480wv,
171 &s3c_device_hsmmc0,
172 &s3c_device_hsmmc1,
173 &s3c_device_hsmmc2,
174};
175
176static struct s3c_sdhci_platdata smdk6440_hsmmc0_pdata __initdata = {
177 .cd_type = S3C_SDHCI_CD_NONE,
178};
179
180static struct s3c_sdhci_platdata smdk6440_hsmmc1_pdata __initdata = {
181 .cd_type = S3C_SDHCI_CD_INTERNAL,
182#if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
183 .max_width = 8,
184 .host_caps = MMC_CAP_8_BIT_DATA,
185#endif
186};
187
188static struct s3c_sdhci_platdata smdk6440_hsmmc2_pdata __initdata = {
189 .cd_type = S3C_SDHCI_CD_NONE,
190};
191
192static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
193 .flags = 0,
194 .slave_addr = 0x10,
195 .frequency = 100*1000,
196 .sda_delay = 100,
197 .cfg_gpio = s5p6440_i2c0_cfg_gpio,
198};
199
200static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = {
201 .flags = 0,
202 .bus_num = 1,
203 .slave_addr = 0x10,
204 .frequency = 100*1000,
205 .sda_delay = 100,
206 .cfg_gpio = s5p6440_i2c1_cfg_gpio,
207};
208
209static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
210 { I2C_BOARD_INFO("24c08", 0x50), },
211 { I2C_BOARD_INFO("wm8580", 0x1b), },
212};
213
214static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = {
215 /* To be populated */
216};
217
218/* LCD Backlight data */
219static struct samsung_bl_gpio_info smdk6440_bl_gpio_info = {
220 .no = S5P6440_GPF(15),
221 .func = S3C_GPIO_SFN(2),
222};
223
224static struct platform_pwm_backlight_data smdk6440_bl_data = {
225 .pwm_id = 1,
226 .enable_gpio = -1,
227};
228
229static void __init smdk6440_map_io(void)
230{
231 s5p64x0_init_io(NULL, 0);
232 s3c24xx_init_clocks(12000000);
233 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
234 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
235}
236
237static void s5p6440_set_lcd_interface(void)
238{
239 unsigned int cfg;
240
241 /* select TFT LCD type (RGB I/F) */
242 cfg = __raw_readl(S5P64X0_SPCON0);
243 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
244 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
245 __raw_writel(cfg, S5P64X0_SPCON0);
246}
247
248static void __init smdk6440_machine_init(void)
249{
250 s3c24xx_ts_set_platdata(NULL);
251
252 s3c_i2c0_set_platdata(&s5p6440_i2c0_data);
253 s3c_i2c1_set_platdata(&s5p6440_i2c1_data);
254 i2c_register_board_info(0, smdk6440_i2c_devs0,
255 ARRAY_SIZE(smdk6440_i2c_devs0));
256 i2c_register_board_info(1, smdk6440_i2c_devs1,
257 ARRAY_SIZE(smdk6440_i2c_devs1));
258
259 s5p6440_set_lcd_interface();
260 s3c_fb_set_platdata(&smdk6440_lcd_pdata);
261
262 s3c_sdhci0_set_platdata(&smdk6440_hsmmc0_pdata);
263 s3c_sdhci1_set_platdata(&smdk6440_hsmmc1_pdata);
264 s3c_sdhci2_set_platdata(&smdk6440_hsmmc2_pdata);
265
266 platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
267
268 samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data);
269}
270
271MACHINE_START(SMDK6440, "SMDK6440")
272 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
273 .atag_offset = 0x100,
274
275 .init_irq = s5p6440_init_irq,
276 .map_io = smdk6440_map_io,
277 .init_machine = smdk6440_machine_init,
278 .init_time = samsung_timer_init,
279 .restart = s5p64x0_restart,
280MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
deleted file mode 100644
index fa1341c074ca..000000000000
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ /dev/null
@@ -1,299 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/mach-smdk6450.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/i2c.h>
19#include <linux/serial_core.h>
20#include <linux/serial_s3c.h>
21#include <linux/platform_device.h>
22#include <linux/io.h>
23#include <linux/module.h>
24#include <linux/clk.h>
25#include <linux/gpio.h>
26#include <linux/pwm_backlight.h>
27#include <linux/fb.h>
28#include <linux/mmc/host.h>
29
30#include <video/platform_lcd.h>
31#include <video/samsung_fimd.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/irq.h>
36#include <asm/mach-types.h>
37
38#include <mach/hardware.h>
39#include <mach/map.h>
40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/gpio-cfg.h>
44#include <plat/clock.h>
45#include <plat/devs.h>
46#include <plat/cpu.h>
47#include <linux/platform_data/i2c-s3c2410.h>
48#include <plat/pll.h>
49#include <plat/adc.h>
50#include <linux/platform_data/touchscreen-s3c2410.h>
51#include <plat/samsung-time.h>
52#include <plat/backlight.h>
53#include <plat/fb.h>
54#include <plat/sdhci.h>
55
56#include "common.h"
57#include "i2c.h"
58
59#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
60 S3C2410_UCON_RXILEVEL | \
61 S3C2410_UCON_TXIRQMODE | \
62 S3C2410_UCON_RXIRQMODE | \
63 S3C2410_UCON_RXFIFO_TOI | \
64 S3C2443_UCON_RXERR_IRQEN)
65
66#define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
67
68#define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
69 S3C2440_UFCON_TXTRIG16 | \
70 S3C2410_UFCON_RXTRIG8)
71
72static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
73 [0] = {
74 .hwport = 0,
75 .flags = 0,
76 .ucon = SMDK6450_UCON_DEFAULT,
77 .ulcon = SMDK6450_ULCON_DEFAULT,
78 .ufcon = SMDK6450_UFCON_DEFAULT,
79 },
80 [1] = {
81 .hwport = 1,
82 .flags = 0,
83 .ucon = SMDK6450_UCON_DEFAULT,
84 .ulcon = SMDK6450_ULCON_DEFAULT,
85 .ufcon = SMDK6450_UFCON_DEFAULT,
86 },
87 [2] = {
88 .hwport = 2,
89 .flags = 0,
90 .ucon = SMDK6450_UCON_DEFAULT,
91 .ulcon = SMDK6450_ULCON_DEFAULT,
92 .ufcon = SMDK6450_UFCON_DEFAULT,
93 },
94 [3] = {
95 .hwport = 3,
96 .flags = 0,
97 .ucon = SMDK6450_UCON_DEFAULT,
98 .ulcon = SMDK6450_ULCON_DEFAULT,
99 .ufcon = SMDK6450_UFCON_DEFAULT,
100 },
101#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
102 [4] = {
103 .hwport = 4,
104 .flags = 0,
105 .ucon = SMDK6450_UCON_DEFAULT,
106 .ulcon = SMDK6450_ULCON_DEFAULT,
107 .ufcon = SMDK6450_UFCON_DEFAULT,
108 },
109#endif
110#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
111 [5] = {
112 .hwport = 5,
113 .flags = 0,
114 .ucon = SMDK6450_UCON_DEFAULT,
115 .ulcon = SMDK6450_ULCON_DEFAULT,
116 .ufcon = SMDK6450_UFCON_DEFAULT,
117 },
118#endif
119};
120
121/* Frame Buffer */
122static struct s3c_fb_pd_win smdk6450_fb_win0 = {
123 .max_bpp = 32,
124 .default_bpp = 24,
125 .xres = 800,
126 .yres = 480,
127};
128
129static struct fb_videomode smdk6450_lcd_timing = {
130 .left_margin = 8,
131 .right_margin = 13,
132 .upper_margin = 7,
133 .lower_margin = 5,
134 .hsync_len = 3,
135 .vsync_len = 1,
136 .xres = 800,
137 .yres = 480,
138};
139
140static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = {
141 .win[0] = &smdk6450_fb_win0,
142 .vtiming = &smdk6450_lcd_timing,
143 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
144 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
145 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
146};
147
148/* LCD power controller */
149static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd,
150 unsigned int power)
151{
152 int err;
153
154 if (power) {
155 err = gpio_request(S5P6450_GPN(5), "GPN");
156 if (err) {
157 printk(KERN_ERR "failed to request GPN for lcd reset\n");
158 return;
159 }
160
161 gpio_direction_output(S5P6450_GPN(5), 1);
162 gpio_set_value(S5P6450_GPN(5), 0);
163 gpio_set_value(S5P6450_GPN(5), 1);
164 gpio_free(S5P6450_GPN(5));
165 }
166}
167
168static struct plat_lcd_data smdk6450_lcd_power_data = {
169 .set_power = smdk6450_lte480_reset_power,
170};
171
172static struct platform_device smdk6450_lcd_lte480wv = {
173 .name = "platform-lcd",
174 .dev.parent = &s3c_device_fb.dev,
175 .dev.platform_data = &smdk6450_lcd_power_data,
176};
177
178static struct platform_device *smdk6450_devices[] __initdata = {
179 &s3c_device_adc,
180 &s3c_device_rtc,
181 &s3c_device_i2c0,
182 &s3c_device_i2c1,
183 &samsung_device_pwm,
184 &s3c_device_ts,
185 &s3c_device_wdt,
186 &s5p6450_device_iis0,
187 &s3c_device_fb,
188 &smdk6450_lcd_lte480wv,
189 &s3c_device_hsmmc0,
190 &s3c_device_hsmmc1,
191 &s3c_device_hsmmc2,
192 /* s5p6450_device_spi0 will be added */
193};
194
195static struct s3c_sdhci_platdata smdk6450_hsmmc0_pdata __initdata = {
196 .cd_type = S3C_SDHCI_CD_NONE,
197};
198
199static struct s3c_sdhci_platdata smdk6450_hsmmc1_pdata __initdata = {
200 .cd_type = S3C_SDHCI_CD_NONE,
201#if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
202 .max_width = 8,
203 .host_caps = MMC_CAP_8_BIT_DATA,
204#endif
205};
206
207static struct s3c_sdhci_platdata smdk6450_hsmmc2_pdata __initdata = {
208 .cd_type = S3C_SDHCI_CD_NONE,
209};
210
211static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
212 .flags = 0,
213 .slave_addr = 0x10,
214 .frequency = 100*1000,
215 .sda_delay = 100,
216 .cfg_gpio = s5p6450_i2c0_cfg_gpio,
217};
218
219static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
220 .flags = 0,
221 .bus_num = 1,
222 .slave_addr = 0x10,
223 .frequency = 100*1000,
224 .sda_delay = 100,
225 .cfg_gpio = s5p6450_i2c1_cfg_gpio,
226};
227
228static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
229 { I2C_BOARD_INFO("wm8580", 0x1b), },
230 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
231};
232
233static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
234 { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
235};
236
237/* LCD Backlight data */
238static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
239 .no = S5P6450_GPF(15),
240 .func = S3C_GPIO_SFN(2),
241};
242
243static struct platform_pwm_backlight_data smdk6450_bl_data = {
244 .pwm_id = 1,
245 .enable_gpio = -1,
246};
247
248static void __init smdk6450_map_io(void)
249{
250 s5p64x0_init_io(NULL, 0);
251 s3c24xx_init_clocks(19200000);
252 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
253 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
254}
255
256static void s5p6450_set_lcd_interface(void)
257{
258 unsigned int cfg;
259
260 /* select TFT LCD type (RGB I/F) */
261 cfg = __raw_readl(S5P64X0_SPCON0);
262 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
263 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
264 __raw_writel(cfg, S5P64X0_SPCON0);
265}
266
267static void __init smdk6450_machine_init(void)
268{
269 s3c24xx_ts_set_platdata(NULL);
270
271 s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
272 s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
273 i2c_register_board_info(0, smdk6450_i2c_devs0,
274 ARRAY_SIZE(smdk6450_i2c_devs0));
275 i2c_register_board_info(1, smdk6450_i2c_devs1,
276 ARRAY_SIZE(smdk6450_i2c_devs1));
277
278 s5p6450_set_lcd_interface();
279 s3c_fb_set_platdata(&smdk6450_lcd_pdata);
280
281 s3c_sdhci0_set_platdata(&smdk6450_hsmmc0_pdata);
282 s3c_sdhci1_set_platdata(&smdk6450_hsmmc1_pdata);
283 s3c_sdhci2_set_platdata(&smdk6450_hsmmc2_pdata);
284
285 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
286
287 samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
288}
289
290MACHINE_START(SMDK6450, "SMDK6450")
291 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
292 .atag_offset = 0x100,
293
294 .init_irq = s5p6450_init_irq,
295 .map_io = smdk6450_map_io,
296 .init_machine = smdk6450_machine_init,
297 .init_time = samsung_timer_init,
298 .restart = s5p64x0_restart,
299MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/pm.c b/arch/arm/mach-s5p64x0/pm.c
deleted file mode 100644
index ec8229cee716..000000000000
--- a/arch/arm/mach-s5p64x0/pm.c
+++ /dev/null
@@ -1,202 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/pm.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 Power Management Support
7 *
8 * Based on arch/arm/mach-s3c64xx/pm.c by Ben Dooks
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/suspend.h>
16#include <linux/syscore_ops.h>
17#include <linux/io.h>
18
19#include <plat/cpu.h>
20#include <plat/pm.h>
21#include <plat/wakeup-mask.h>
22
23#include <mach/regs-clock.h>
24#include <mach/regs-gpio.h>
25
26static struct sleep_save s5p64x0_core_save[] = {
27 SAVE_ITEM(S5P64X0_APLL_CON),
28 SAVE_ITEM(S5P64X0_MPLL_CON),
29 SAVE_ITEM(S5P64X0_EPLL_CON),
30 SAVE_ITEM(S5P64X0_EPLL_CON_K),
31 SAVE_ITEM(S5P64X0_CLK_SRC0),
32 SAVE_ITEM(S5P64X0_CLK_SRC1),
33 SAVE_ITEM(S5P64X0_CLK_DIV0),
34 SAVE_ITEM(S5P64X0_CLK_DIV1),
35 SAVE_ITEM(S5P64X0_CLK_DIV2),
36 SAVE_ITEM(S5P64X0_CLK_DIV3),
37 SAVE_ITEM(S5P64X0_CLK_GATE_MEM0),
38 SAVE_ITEM(S5P64X0_CLK_GATE_HCLK1),
39 SAVE_ITEM(S5P64X0_CLK_GATE_SCLK1),
40};
41
42static struct sleep_save s5p64x0_misc_save[] = {
43 SAVE_ITEM(S5P64X0_AHB_CON0),
44 SAVE_ITEM(S5P64X0_SPCON0),
45 SAVE_ITEM(S5P64X0_SPCON1),
46 SAVE_ITEM(S5P64X0_MEM0CONSLP0),
47 SAVE_ITEM(S5P64X0_MEM0CONSLP1),
48 SAVE_ITEM(S5P64X0_MEM0DRVCON),
49 SAVE_ITEM(S5P64X0_MEM1DRVCON),
50};
51
52/* DPLL is present only in S5P6450 */
53static struct sleep_save s5p6450_core_save[] = {
54 SAVE_ITEM(S5P6450_DPLL_CON),
55 SAVE_ITEM(S5P6450_DPLL_CON_K),
56};
57
58void s3c_pm_configure_extint(void)
59{
60 __raw_writel(s3c_irqwake_eintmask, S5P64X0_EINT_WAKEUP_MASK);
61}
62
63void s3c_pm_restore_core(void)
64{
65 __raw_writel(0, S5P64X0_EINT_WAKEUP_MASK);
66
67 s3c_pm_do_restore_core(s5p64x0_core_save,
68 ARRAY_SIZE(s5p64x0_core_save));
69
70 if (soc_is_s5p6450())
71 s3c_pm_do_restore_core(s5p6450_core_save,
72 ARRAY_SIZE(s5p6450_core_save));
73
74 s3c_pm_do_restore(s5p64x0_misc_save, ARRAY_SIZE(s5p64x0_misc_save));
75}
76
77void s3c_pm_save_core(void)
78{
79 s3c_pm_do_save(s5p64x0_misc_save, ARRAY_SIZE(s5p64x0_misc_save));
80
81 if (soc_is_s5p6450())
82 s3c_pm_do_save(s5p6450_core_save,
83 ARRAY_SIZE(s5p6450_core_save));
84
85 s3c_pm_do_save(s5p64x0_core_save, ARRAY_SIZE(s5p64x0_core_save));
86}
87
88static int s5p64x0_cpu_suspend(unsigned long arg)
89{
90 unsigned long tmp = 0;
91
92 /*
93 * Issue the standby signal into the pm unit. Note, we
94 * issue a write-buffer drain just in case.
95 */
96 asm("b 1f\n\t"
97 ".align 5\n\t"
98 "1:\n\t"
99 "mcr p15, 0, %0, c7, c10, 5\n\t"
100 "mcr p15, 0, %0, c7, c10, 4\n\t"
101 "mcr p15, 0, %0, c7, c0, 4" : : "r" (tmp));
102
103 pr_info("Failed to suspend the system\n");
104 return 1; /* Aborting suspend */
105}
106
107/* mapping of interrupts to parts of the wakeup mask */
108static struct samsung_wakeup_mask s5p64x0_wake_irqs[] = {
109 { .irq = IRQ_RTC_ALARM, .bit = S5P64X0_PWR_CFG_RTC_ALRM_DISABLE, },
110 { .irq = IRQ_RTC_TIC, .bit = S5P64X0_PWR_CFG_RTC_TICK_DISABLE, },
111 { .irq = IRQ_HSMMC0, .bit = S5P64X0_PWR_CFG_MMC0_DISABLE, },
112 { .irq = IRQ_HSMMC1, .bit = S5P64X0_PWR_CFG_MMC1_DISABLE, },
113};
114
115static void s5p64x0_pm_prepare(void)
116{
117 u32 tmp;
118
119 samsung_sync_wakemask(S5P64X0_PWR_CFG,
120 s5p64x0_wake_irqs, ARRAY_SIZE(s5p64x0_wake_irqs));
121
122 /* store the resume address in INFORM0 register */
123 __raw_writel(virt_to_phys(s3c_cpu_resume), S5P64X0_INFORM0);
124
125 /* setup clock gating for FIMGVG block */
126 __raw_writel((__raw_readl(S5P64X0_CLK_GATE_HCLK1) | \
127 (S5P64X0_CLK_GATE_HCLK1_FIMGVG)), S5P64X0_CLK_GATE_HCLK1);
128 __raw_writel((__raw_readl(S5P64X0_CLK_GATE_SCLK1) | \
129 (S5P64X0_CLK_GATE_SCLK1_FIMGVG)), S5P64X0_CLK_GATE_SCLK1);
130
131 /* Configure the stabilization counter with wait time required */
132 __raw_writel(S5P64X0_PWR_STABLE_PWR_CNT_VAL4, S5P64X0_PWR_STABLE);
133
134 /* set WFI to SLEEP mode configuration */
135 tmp = __raw_readl(S5P64X0_SLEEP_CFG);
136 tmp &= ~(S5P64X0_SLEEP_CFG_OSC_EN);
137 __raw_writel(tmp, S5P64X0_SLEEP_CFG);
138
139 tmp = __raw_readl(S5P64X0_PWR_CFG);
140 tmp &= ~(S5P64X0_PWR_CFG_WFI_MASK);
141 tmp |= S5P64X0_PWR_CFG_WFI_SLEEP;
142 __raw_writel(tmp, S5P64X0_PWR_CFG);
143
144 /*
145 * set OTHERS register to disable interrupt before going to
146 * sleep. This bit is present only in S5P6450, it is reserved
147 * in S5P6440.
148 */
149 if (soc_is_s5p6450()) {
150 tmp = __raw_readl(S5P64X0_OTHERS);
151 tmp |= S5P6450_OTHERS_DISABLE_INT;
152 __raw_writel(tmp, S5P64X0_OTHERS);
153 }
154
155 /* ensure previous wakeup state is cleared before sleeping */
156 __raw_writel(__raw_readl(S5P64X0_WAKEUP_STAT), S5P64X0_WAKEUP_STAT);
157
158}
159
160static int s5p64x0_pm_add(struct device *dev, struct subsys_interface *sif)
161{
162 pm_cpu_prep = s5p64x0_pm_prepare;
163 pm_cpu_sleep = s5p64x0_cpu_suspend;
164
165 return 0;
166}
167
168static struct subsys_interface s5p64x0_pm_interface = {
169 .name = "s5p64x0_pm",
170 .subsys = &s5p64x0_subsys,
171 .add_dev = s5p64x0_pm_add,
172};
173
174static __init int s5p64x0_pm_drvinit(void)
175{
176 s3c_pm_init();
177
178 return subsys_interface_register(&s5p64x0_pm_interface);
179}
180arch_initcall(s5p64x0_pm_drvinit);
181
182static void s5p64x0_pm_resume(void)
183{
184 u32 tmp;
185
186 tmp = __raw_readl(S5P64X0_OTHERS);
187 tmp |= (S5P64X0_OTHERS_RET_MMC0 | S5P64X0_OTHERS_RET_MMC1 | \
188 S5P64X0_OTHERS_RET_UART);
189 __raw_writel(tmp , S5P64X0_OTHERS);
190}
191
192static struct syscore_ops s5p64x0_pm_syscore_ops = {
193 .resume = s5p64x0_pm_resume,
194};
195
196static __init int s5p64x0_pm_syscore_init(void)
197{
198 register_syscore_ops(&s5p64x0_pm_syscore_ops);
199
200 return 0;
201}
202arch_initcall(s5p64x0_pm_syscore_init);
diff --git a/arch/arm/mach-s5p64x0/setup-fb-24bpp.c b/arch/arm/mach-s5p64x0/setup-fb-24bpp.c
deleted file mode 100644
index f346ee4af54d..000000000000
--- a/arch/arm/mach-s5p64x0/setup-fb-24bpp.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/setup-fb-24bpp.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Base S5P64X0 GPIO setup information for LCD framebuffer
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/cpu.h>
17#include <plat/fb.h>
18#include <plat/gpio-cfg.h>
19
20void s5p64x0_fb_gpio_setup_24bpp(void)
21{
22 if (soc_is_s5p6440()) {
23 s3c_gpio_cfgrange_nopull(S5P6440_GPI(0), 16, S3C_GPIO_SFN(2));
24 s3c_gpio_cfgrange_nopull(S5P6440_GPJ(0), 12, S3C_GPIO_SFN(2));
25 } else if (soc_is_s5p6450()) {
26 s3c_gpio_cfgrange_nopull(S5P6450_GPI(0), 16, S3C_GPIO_SFN(2));
27 s3c_gpio_cfgrange_nopull(S5P6450_GPJ(0), 12, S3C_GPIO_SFN(2));
28 }
29}
diff --git a/arch/arm/mach-s5p64x0/setup-i2c0.c b/arch/arm/mach-s5p64x0/setup-i2c0.c
deleted file mode 100644
index 569b76ac98cb..000000000000
--- a/arch/arm/mach-s5p64x0/setup-i2c0.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/setup-i2c0.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * I2C0 GPIO configuration.
7 *
8 * Based on plat-s3c64x0/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/gpio.h>
18
19struct platform_device; /* don't need the contents */
20
21#include <plat/gpio-cfg.h>
22#include <linux/platform_data/i2c-s3c2410.h>
23
24#include "i2c.h"
25
26void s5p6440_i2c0_cfg_gpio(struct platform_device *dev)
27{
28 s3c_gpio_cfgall_range(S5P6440_GPB(5), 2,
29 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
30}
31
32void s5p6450_i2c0_cfg_gpio(struct platform_device *dev)
33{
34 s3c_gpio_cfgall_range(S5P6450_GPB(5), 2,
35 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
36}
37
38void s3c_i2c0_cfg_gpio(struct platform_device *dev) { }
diff --git a/arch/arm/mach-s5p64x0/setup-i2c1.c b/arch/arm/mach-s5p64x0/setup-i2c1.c
deleted file mode 100644
index 867374e6d0bc..000000000000
--- a/arch/arm/mach-s5p64x0/setup-i2c1.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/mach-s5p64xx/setup-i2c1.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * I2C1 GPIO configuration.
7 *
8 * Based on plat-s3c64xx/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/gpio.h>
18
19struct platform_device; /* don't need the contents */
20
21#include <plat/gpio-cfg.h>
22#include <linux/platform_data/i2c-s3c2410.h>
23
24#include "i2c.h"
25
26void s5p6440_i2c1_cfg_gpio(struct platform_device *dev)
27{
28 s3c_gpio_cfgall_range(S5P6440_GPR(9), 2,
29 S3C_GPIO_SFN(6), S3C_GPIO_PULL_UP);
30}
31
32void s5p6450_i2c1_cfg_gpio(struct platform_device *dev)
33{
34 s3c_gpio_cfgall_range(S5P6450_GPR(9), 2,
35 S3C_GPIO_SFN(6), S3C_GPIO_PULL_UP);
36}
37
38void s3c_i2c1_cfg_gpio(struct platform_device *dev) { }
diff --git a/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c b/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
deleted file mode 100644
index 8410af0d12bf..000000000000
--- a/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P64X0 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
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/platform_device.h>
14#include <linux/io.h>
15#include <linux/gpio.h>
16
17#include <mach/regs-gpio.h>
18#include <mach/regs-clock.h>
19
20#include <plat/gpio-cfg.h>
21#include <plat/sdhci.h>
22#include <plat/cpu.h>
23
24void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
25{
26 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
27
28 /* Set all the necessary GPG pins to special-function 2 */
29 if (soc_is_s5p6450())
30 s3c_gpio_cfgrange_nopull(S5P6450_GPG(0), 2 + width,
31 S3C_GPIO_SFN(2));
32 else
33 s3c_gpio_cfgrange_nopull(S5P6440_GPG(0), 2 + width,
34 S3C_GPIO_SFN(2));
35
36 /* Set GPG[6] pin to special-function 2 - MMC0 CDn */
37 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
38 if (soc_is_s5p6450()) {
39 s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
40 s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(2));
41 } else {
42 s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
43 s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(2));
44 }
45 }
46}
47
48void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
49{
50 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
51
52 /* Set GPH[0:1] pins to special-function 2 - CLK and CMD */
53 if (soc_is_s5p6450())
54 s3c_gpio_cfgrange_nopull(S5P6450_GPH(0), 2, S3C_GPIO_SFN(2));
55 else
56 s3c_gpio_cfgrange_nopull(S5P6440_GPH(0), 2 , S3C_GPIO_SFN(2));
57
58 switch (width) {
59 case 8:
60 /* Set data pins GPH[6:9] special-function 2 */
61 if (soc_is_s5p6450())
62 s3c_gpio_cfgrange_nopull(S5P6450_GPH(6), 4,
63 S3C_GPIO_SFN(2));
64 else
65 s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4,
66 S3C_GPIO_SFN(2));
67 case 4:
68 /* set data pins GPH[2:5] special-function 2 */
69 if (soc_is_s5p6450())
70 s3c_gpio_cfgrange_nopull(S5P6450_GPH(2), 4,
71 S3C_GPIO_SFN(2));
72 else
73 s3c_gpio_cfgrange_nopull(S5P6440_GPH(2), 4,
74 S3C_GPIO_SFN(2));
75 default:
76 break;
77 }
78
79 /* Set GPG[6] pin to special-funtion 3 : MMC1 CDn */
80 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
81 if (soc_is_s5p6450()) {
82 s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
83 s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(3));
84 } else {
85 s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
86 s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(3));
87 }
88 }
89}
90
91void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
92{
93 /* Set GPC[4:5] pins to special-function 3 - CLK and CMD */
94 s3c_gpio_cfgrange_nopull(S5P6440_GPC(4), 2, S3C_GPIO_SFN(3));
95
96 /* Set data pins GPH[6:9] pins to special-function 3 */
97 s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4, S3C_GPIO_SFN(3));
98}
99
100void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
101{
102 /* Set all the necessary GPG pins to special-function 3 */
103 s3c_gpio_cfgrange_nopull(S5P6450_GPG(7), 2 + width, S3C_GPIO_SFN(3));
104}
diff --git a/arch/arm/mach-s5p64x0/setup-spi.c b/arch/arm/mach-s5p64x0/setup-spi.c
deleted file mode 100644
index 7664356720ca..000000000000
--- a/arch/arm/mach-s5p64x0/setup-spi.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/setup-spi.c
2 *
3 * Copyright (C) 2011 Samsung Electronics Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h>
13
14#ifdef CONFIG_S3C64XX_DEV_SPI0
15int s3c64xx_spi0_cfg_gpio(void)
16{
17 if (soc_is_s5p6450())
18 s3c_gpio_cfgall_range(S5P6450_GPC(0), 3,
19 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
20 else
21 s3c_gpio_cfgall_range(S5P6440_GPC(0), 3,
22 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
23 return 0;
24}
25#endif
26
27#ifdef CONFIG_S3C64XX_DEV_SPI1
28int s3c64xx_spi1_cfg_gpio(void)
29{
30 if (soc_is_s5p6450())
31 s3c_gpio_cfgall_range(S5P6450_GPC(4), 3,
32 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
33 else
34 s3c_gpio_cfgall_range(S5P6440_GPC(4), 3,
35 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
36 return 0;
37}
38#endif
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
deleted file mode 100644
index 15170be97a74..000000000000
--- a/arch/arm/mach-s5pc100/Kconfig
+++ /dev/null
@@ -1,80 +0,0 @@
1# Copyright 2009 Samsung Electronics Co.
2# Byungho Min <bhmin@samsung.com>
3#
4# Licensed under GPLv2
5
6# Configuration options for the S5PC100 CPU
7
8if ARCH_S5PC100
9
10config CPU_S5PC100
11 bool
12 select S5P_EXT_INT
13 select SAMSUNG_DMADEV
14 help
15 Enable S5PC100 CPU support
16
17config S5PC100_SETUP_FB_24BPP
18 bool
19 help
20 Common setup code for S5PC1XX with an 24bpp RGB display helper.
21
22config S5PC100_SETUP_I2C1
23 bool
24 help
25 Common setup code for i2c bus 1.
26
27config S5PC100_SETUP_IDE
28 bool
29 help
30 Common setup code for S5PC100 IDE GPIO configurations
31
32config S5PC100_SETUP_KEYPAD
33 bool
34 help
35 Common setup code for KEYPAD GPIO configurations.
36
37config S5PC100_SETUP_SDHCI
38 bool
39 select S5PC100_SETUP_SDHCI_GPIO
40 help
41 Internal helper functions for S5PC100 based SDHCI systems
42
43config S5PC100_SETUP_SDHCI_GPIO
44 bool
45 help
46 Common setup code for SDHCI gpio.
47
48config S5PC100_SETUP_SPI
49 bool
50 help
51 Common setup code for SPI GPIO configurations.
52
53config MACH_SMDKC100
54 bool "SMDKC100"
55 select CPU_S5PC100
56 select S3C_DEV_FB
57 select S3C_DEV_HSMMC
58 select S3C_DEV_HSMMC1
59 select S3C_DEV_HSMMC2
60 select S3C_DEV_I2C1
61 select S3C_DEV_RTC
62 select S3C_DEV_WDT
63 select S5PC100_SETUP_FB_24BPP
64 select S5PC100_SETUP_I2C1
65 select S5PC100_SETUP_IDE
66 select S5PC100_SETUP_KEYPAD
67 select S5PC100_SETUP_SDHCI
68 select S5P_DEV_FIMC0
69 select S5P_DEV_FIMC1
70 select S5P_DEV_FIMC2
71 select SAMSUNG_DEV_ADC
72 select SAMSUNG_DEV_BACKLIGHT
73 select SAMSUNG_DEV_IDE
74 select SAMSUNG_DEV_KEYPAD
75 select SAMSUNG_DEV_PWM
76 select SAMSUNG_DEV_TS
77 help
78 Machine support for the Samsung SMDKC100
79
80endif
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
deleted file mode 100644
index 118c711f74e8..000000000000
--- a/arch/arm/mach-s5pc100/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
1# arch/arm/mach-s5pc100/Makefile
2#
3# Copyright 2009 Samsung Electronics Co.
4#
5# Licensed under GPLv2
6
7obj-y :=
8obj-m :=
9obj-n :=
10obj- :=
11
12# Core
13
14obj-y += common.o clock.o
15
16obj-y += dma.o
17
18# machine support
19
20obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o
21
22# device support
23
24obj-y += dev-audio.o
25
26obj-y += setup-i2c0.o
27obj-$(CONFIG_S5PC100_SETUP_FB_24BPP) += setup-fb-24bpp.o
28obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o
29obj-$(CONFIG_S5PC100_SETUP_IDE) += setup-ide.o
30obj-$(CONFIG_S5PC100_SETUP_KEYPAD) += setup-keypad.o
31obj-$(CONFIG_S5PC100_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
32obj-$(CONFIG_S5PC100_SETUP_SPI) += setup-spi.o
diff --git a/arch/arm/mach-s5pc100/Makefile.boot b/arch/arm/mach-s5pc100/Makefile.boot
deleted file mode 100644
index 79ece4055b02..000000000000
--- a/arch/arm/mach-s5pc100/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
deleted file mode 100644
index d0dc10ee7729..000000000000
--- a/arch/arm/mach-s5pc100/clock.c
+++ /dev/null
@@ -1,1361 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/clock.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PC100 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20
21#include <mach/map.h>
22
23#include <plat/cpu-freq.h>
24#include <mach/regs-clock.h>
25#include <plat/clock.h>
26#include <plat/cpu.h>
27#include <plat/pll.h>
28#include <plat/s5p-clock.h>
29#include <plat/clock-clksrc.h>
30
31#include "common.h"
32
33static struct clk s5p_clk_otgphy = {
34 .name = "otg_phy",
35};
36
37static struct clk dummy_apb_pclk = {
38 .name = "apb_pclk",
39 .id = -1,
40};
41
42static struct clk *clk_src_mout_href_list[] = {
43 [0] = &s5p_clk_27m,
44 [1] = &clk_fin_hpll,
45};
46
47static struct clksrc_sources clk_src_mout_href = {
48 .sources = clk_src_mout_href_list,
49 .nr_sources = ARRAY_SIZE(clk_src_mout_href_list),
50};
51
52static struct clksrc_clk clk_mout_href = {
53 .clk = {
54 .name = "mout_href",
55 },
56 .sources = &clk_src_mout_href,
57 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 },
58};
59
60static struct clk *clk_src_mout_48m_list[] = {
61 [0] = &clk_xusbxti,
62 [1] = &s5p_clk_otgphy,
63};
64
65static struct clksrc_sources clk_src_mout_48m = {
66 .sources = clk_src_mout_48m_list,
67 .nr_sources = ARRAY_SIZE(clk_src_mout_48m_list),
68};
69
70static struct clksrc_clk clk_mout_48m = {
71 .clk = {
72 .name = "mout_48m",
73 },
74 .sources = &clk_src_mout_48m,
75 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 24, .size = 1 },
76};
77
78static struct clksrc_clk clk_mout_mpll = {
79 .clk = {
80 .name = "mout_mpll",
81 },
82 .sources = &clk_src_mpll,
83 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 },
84};
85
86
87static struct clksrc_clk clk_mout_apll = {
88 .clk = {
89 .name = "mout_apll",
90 },
91 .sources = &clk_src_apll,
92 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
93};
94
95static struct clksrc_clk clk_mout_epll = {
96 .clk = {
97 .name = "mout_epll",
98 },
99 .sources = &clk_src_epll,
100 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 },
101};
102
103static struct clk *clk_src_mout_hpll_list[] = {
104 [0] = &s5p_clk_27m,
105};
106
107static struct clksrc_sources clk_src_mout_hpll = {
108 .sources = clk_src_mout_hpll_list,
109 .nr_sources = ARRAY_SIZE(clk_src_mout_hpll_list),
110};
111
112static struct clksrc_clk clk_mout_hpll = {
113 .clk = {
114 .name = "mout_hpll",
115 },
116 .sources = &clk_src_mout_hpll,
117 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
118};
119
120static struct clksrc_clk clk_div_apll = {
121 .clk = {
122 .name = "div_apll",
123 .parent = &clk_mout_apll.clk,
124 },
125 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 1 },
126};
127
128static struct clksrc_clk clk_div_arm = {
129 .clk = {
130 .name = "div_arm",
131 .parent = &clk_div_apll.clk,
132 },
133 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 },
134};
135
136static struct clksrc_clk clk_div_d0_bus = {
137 .clk = {
138 .name = "div_d0_bus",
139 .parent = &clk_div_arm.clk,
140 },
141 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 },
142};
143
144static struct clksrc_clk clk_div_pclkd0 = {
145 .clk = {
146 .name = "div_pclkd0",
147 .parent = &clk_div_d0_bus.clk,
148 },
149 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 },
150};
151
152static struct clksrc_clk clk_div_secss = {
153 .clk = {
154 .name = "div_secss",
155 .parent = &clk_div_d0_bus.clk,
156 },
157 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 3 },
158};
159
160static struct clksrc_clk clk_div_apll2 = {
161 .clk = {
162 .name = "div_apll2",
163 .parent = &clk_mout_apll.clk,
164 },
165 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 3 },
166};
167
168static struct clk *clk_src_mout_am_list[] = {
169 [0] = &clk_mout_mpll.clk,
170 [1] = &clk_div_apll2.clk,
171};
172
173static struct clksrc_sources clk_src_mout_am = {
174 .sources = clk_src_mout_am_list,
175 .nr_sources = ARRAY_SIZE(clk_src_mout_am_list),
176};
177
178static struct clksrc_clk clk_mout_am = {
179 .clk = {
180 .name = "mout_am",
181 },
182 .sources = &clk_src_mout_am,
183 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 },
184};
185
186static struct clksrc_clk clk_div_d1_bus = {
187 .clk = {
188 .name = "div_d1_bus",
189 .parent = &clk_mout_am.clk,
190 },
191 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 3 },
192};
193
194static struct clksrc_clk clk_div_mpll2 = {
195 .clk = {
196 .name = "div_mpll2",
197 .parent = &clk_mout_am.clk,
198 },
199 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 1 },
200};
201
202static struct clksrc_clk clk_div_mpll = {
203 .clk = {
204 .name = "div_mpll",
205 .parent = &clk_mout_am.clk,
206 },
207 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 2 },
208};
209
210static struct clk *clk_src_mout_onenand_list[] = {
211 [0] = &clk_div_d0_bus.clk,
212 [1] = &clk_div_d1_bus.clk,
213};
214
215static struct clksrc_sources clk_src_mout_onenand = {
216 .sources = clk_src_mout_onenand_list,
217 .nr_sources = ARRAY_SIZE(clk_src_mout_onenand_list),
218};
219
220static struct clksrc_clk clk_mout_onenand = {
221 .clk = {
222 .name = "mout_onenand",
223 },
224 .sources = &clk_src_mout_onenand,
225 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 },
226};
227
228static struct clksrc_clk clk_div_onenand = {
229 .clk = {
230 .name = "div_onenand",
231 .parent = &clk_mout_onenand.clk,
232 },
233 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 20, .size = 2 },
234};
235
236static struct clksrc_clk clk_div_pclkd1 = {
237 .clk = {
238 .name = "div_pclkd1",
239 .parent = &clk_div_d1_bus.clk,
240 },
241 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 16, .size = 3 },
242};
243
244static struct clksrc_clk clk_div_cam = {
245 .clk = {
246 .name = "div_cam",
247 .parent = &clk_div_mpll2.clk,
248 },
249 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 24, .size = 5 },
250};
251
252static struct clksrc_clk clk_div_hdmi = {
253 .clk = {
254 .name = "div_hdmi",
255 .parent = &clk_mout_hpll.clk,
256 },
257 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 28, .size = 4 },
258};
259
260static u32 epll_div[][4] = {
261 { 32750000, 131, 3, 4 },
262 { 32768000, 131, 3, 4 },
263 { 36000000, 72, 3, 3 },
264 { 45000000, 90, 3, 3 },
265 { 45158000, 90, 3, 3 },
266 { 45158400, 90, 3, 3 },
267 { 48000000, 96, 3, 3 },
268 { 49125000, 131, 4, 3 },
269 { 49152000, 131, 4, 3 },
270 { 60000000, 120, 3, 3 },
271 { 67737600, 226, 5, 3 },
272 { 67738000, 226, 5, 3 },
273 { 73800000, 246, 5, 3 },
274 { 73728000, 246, 5, 3 },
275 { 72000000, 144, 3, 3 },
276 { 84000000, 168, 3, 3 },
277 { 96000000, 96, 3, 2 },
278 { 144000000, 144, 3, 2 },
279 { 192000000, 96, 3, 1 }
280};
281
282static int s5pc100_epll_set_rate(struct clk *clk, unsigned long rate)
283{
284 unsigned int epll_con;
285 unsigned int i;
286
287 if (clk->rate == rate) /* Return if nothing changed */
288 return 0;
289
290 epll_con = __raw_readl(S5P_EPLL_CON);
291
292 epll_con &= ~(PLL65XX_MDIV_MASK | PLL65XX_PDIV_MASK | PLL65XX_SDIV_MASK);
293
294 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
295 if (epll_div[i][0] == rate) {
296 epll_con |= (epll_div[i][1] << PLL65XX_MDIV_SHIFT) |
297 (epll_div[i][2] << PLL65XX_PDIV_SHIFT) |
298 (epll_div[i][3] << PLL65XX_SDIV_SHIFT);
299 break;
300 }
301 }
302
303 if (i == ARRAY_SIZE(epll_div)) {
304 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
305 return -EINVAL;
306 }
307
308 __raw_writel(epll_con, S5P_EPLL_CON);
309
310 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
311 clk->rate, rate);
312
313 clk->rate = rate;
314
315 return 0;
316}
317
318static struct clk_ops s5pc100_epll_ops = {
319 .get_rate = s5p_epll_get_rate,
320 .set_rate = s5pc100_epll_set_rate,
321};
322
323static int s5pc100_d0_0_ctrl(struct clk *clk, int enable)
324{
325 return s5p_gatectrl(S5P_CLKGATE_D00, clk, enable);
326}
327
328static int s5pc100_d0_1_ctrl(struct clk *clk, int enable)
329{
330 return s5p_gatectrl(S5P_CLKGATE_D01, clk, enable);
331}
332
333static int s5pc100_d0_2_ctrl(struct clk *clk, int enable)
334{
335 return s5p_gatectrl(S5P_CLKGATE_D02, clk, enable);
336}
337
338static int s5pc100_d1_0_ctrl(struct clk *clk, int enable)
339{
340 return s5p_gatectrl(S5P_CLKGATE_D10, clk, enable);
341}
342
343static int s5pc100_d1_1_ctrl(struct clk *clk, int enable)
344{
345 return s5p_gatectrl(S5P_CLKGATE_D11, clk, enable);
346}
347
348static int s5pc100_d1_2_ctrl(struct clk *clk, int enable)
349{
350 return s5p_gatectrl(S5P_CLKGATE_D12, clk, enable);
351}
352
353static int s5pc100_d1_3_ctrl(struct clk *clk, int enable)
354{
355 return s5p_gatectrl(S5P_CLKGATE_D13, clk, enable);
356}
357
358static int s5pc100_d1_4_ctrl(struct clk *clk, int enable)
359{
360 return s5p_gatectrl(S5P_CLKGATE_D14, clk, enable);
361}
362
363static int s5pc100_d1_5_ctrl(struct clk *clk, int enable)
364{
365 return s5p_gatectrl(S5P_CLKGATE_D15, clk, enable);
366}
367
368static int s5pc100_sclk0_ctrl(struct clk *clk, int enable)
369{
370 return s5p_gatectrl(S5P_CLKGATE_SCLK0, clk, enable);
371}
372
373static int s5pc100_sclk1_ctrl(struct clk *clk, int enable)
374{
375 return s5p_gatectrl(S5P_CLKGATE_SCLK1, clk, enable);
376}
377
378/*
379 * The following clocks will be disabled during clock initialization. It is
380 * recommended to keep the following clocks disabled until the driver requests
381 * for enabling the clock.
382 */
383static struct clk init_clocks_off[] = {
384 {
385 .name = "cssys",
386 .parent = &clk_div_d0_bus.clk,
387 .enable = s5pc100_d0_0_ctrl,
388 .ctrlbit = (1 << 6),
389 }, {
390 .name = "secss",
391 .parent = &clk_div_d0_bus.clk,
392 .enable = s5pc100_d0_0_ctrl,
393 .ctrlbit = (1 << 5),
394 }, {
395 .name = "g2d",
396 .parent = &clk_div_d0_bus.clk,
397 .enable = s5pc100_d0_0_ctrl,
398 .ctrlbit = (1 << 4),
399 }, {
400 .name = "mdma",
401 .parent = &clk_div_d0_bus.clk,
402 .enable = s5pc100_d0_0_ctrl,
403 .ctrlbit = (1 << 3),
404 }, {
405 .name = "cfcon",
406 .parent = &clk_div_d0_bus.clk,
407 .enable = s5pc100_d0_0_ctrl,
408 .ctrlbit = (1 << 2),
409 }, {
410 .name = "nfcon",
411 .parent = &clk_div_d0_bus.clk,
412 .enable = s5pc100_d0_1_ctrl,
413 .ctrlbit = (1 << 3),
414 }, {
415 .name = "onenandc",
416 .parent = &clk_div_d0_bus.clk,
417 .enable = s5pc100_d0_1_ctrl,
418 .ctrlbit = (1 << 2),
419 }, {
420 .name = "sdm",
421 .parent = &clk_div_d0_bus.clk,
422 .enable = s5pc100_d0_2_ctrl,
423 .ctrlbit = (1 << 2),
424 }, {
425 .name = "seckey",
426 .parent = &clk_div_d0_bus.clk,
427 .enable = s5pc100_d0_2_ctrl,
428 .ctrlbit = (1 << 1),
429 }, {
430 .name = "modemif",
431 .parent = &clk_div_d1_bus.clk,
432 .enable = s5pc100_d1_0_ctrl,
433 .ctrlbit = (1 << 4),
434 }, {
435 .name = "otg",
436 .parent = &clk_div_d1_bus.clk,
437 .enable = s5pc100_d1_0_ctrl,
438 .ctrlbit = (1 << 3),
439 }, {
440 .name = "usbhost",
441 .parent = &clk_div_d1_bus.clk,
442 .enable = s5pc100_d1_0_ctrl,
443 .ctrlbit = (1 << 2),
444 }, {
445 .name = "dma",
446 .devname = "dma-pl330.1",
447 .parent = &clk_div_d1_bus.clk,
448 .enable = s5pc100_d1_0_ctrl,
449 .ctrlbit = (1 << 1),
450 }, {
451 .name = "dma",
452 .devname = "dma-pl330.0",
453 .parent = &clk_div_d1_bus.clk,
454 .enable = s5pc100_d1_0_ctrl,
455 .ctrlbit = (1 << 0),
456 }, {
457 .name = "lcd",
458 .parent = &clk_div_d1_bus.clk,
459 .enable = s5pc100_d1_1_ctrl,
460 .ctrlbit = (1 << 0),
461 }, {
462 .name = "rotator",
463 .parent = &clk_div_d1_bus.clk,
464 .enable = s5pc100_d1_1_ctrl,
465 .ctrlbit = (1 << 1),
466 }, {
467 .name = "fimc",
468 .devname = "s5p-fimc.0",
469 .parent = &clk_div_d1_bus.clk,
470 .enable = s5pc100_d1_1_ctrl,
471 .ctrlbit = (1 << 2),
472 }, {
473 .name = "fimc",
474 .devname = "s5p-fimc.1",
475 .parent = &clk_div_d1_bus.clk,
476 .enable = s5pc100_d1_1_ctrl,
477 .ctrlbit = (1 << 3),
478 }, {
479 .name = "fimc",
480 .devname = "s5p-fimc.2",
481 .enable = s5pc100_d1_1_ctrl,
482 .ctrlbit = (1 << 4),
483 }, {
484 .name = "jpeg",
485 .parent = &clk_div_d1_bus.clk,
486 .enable = s5pc100_d1_1_ctrl,
487 .ctrlbit = (1 << 5),
488 }, {
489 .name = "mipi-dsim",
490 .parent = &clk_div_d1_bus.clk,
491 .enable = s5pc100_d1_1_ctrl,
492 .ctrlbit = (1 << 6),
493 }, {
494 .name = "mipi-csis",
495 .parent = &clk_div_d1_bus.clk,
496 .enable = s5pc100_d1_1_ctrl,
497 .ctrlbit = (1 << 7),
498 }, {
499 .name = "g3d",
500 .parent = &clk_div_d1_bus.clk,
501 .enable = s5pc100_d1_0_ctrl,
502 .ctrlbit = (1 << 8),
503 }, {
504 .name = "tv",
505 .parent = &clk_div_d1_bus.clk,
506 .enable = s5pc100_d1_2_ctrl,
507 .ctrlbit = (1 << 0),
508 }, {
509 .name = "vp",
510 .parent = &clk_div_d1_bus.clk,
511 .enable = s5pc100_d1_2_ctrl,
512 .ctrlbit = (1 << 1),
513 }, {
514 .name = "mixer",
515 .parent = &clk_div_d1_bus.clk,
516 .enable = s5pc100_d1_2_ctrl,
517 .ctrlbit = (1 << 2),
518 }, {
519 .name = "hdmi",
520 .parent = &clk_div_d1_bus.clk,
521 .enable = s5pc100_d1_2_ctrl,
522 .ctrlbit = (1 << 3),
523 }, {
524 .name = "mfc",
525 .parent = &clk_div_d1_bus.clk,
526 .enable = s5pc100_d1_2_ctrl,
527 .ctrlbit = (1 << 4),
528 }, {
529 .name = "apc",
530 .parent = &clk_div_d1_bus.clk,
531 .enable = s5pc100_d1_3_ctrl,
532 .ctrlbit = (1 << 2),
533 }, {
534 .name = "iec",
535 .parent = &clk_div_d1_bus.clk,
536 .enable = s5pc100_d1_3_ctrl,
537 .ctrlbit = (1 << 3),
538 }, {
539 .name = "systimer",
540 .parent = &clk_div_d1_bus.clk,
541 .enable = s5pc100_d1_3_ctrl,
542 .ctrlbit = (1 << 7),
543 }, {
544 .name = "watchdog",
545 .parent = &clk_div_d1_bus.clk,
546 .enable = s5pc100_d1_3_ctrl,
547 .ctrlbit = (1 << 8),
548 }, {
549 .name = "rtc",
550 .parent = &clk_div_d1_bus.clk,
551 .enable = s5pc100_d1_3_ctrl,
552 .ctrlbit = (1 << 9),
553 }, {
554 .name = "i2c",
555 .devname = "s3c2440-i2c.0",
556 .parent = &clk_div_d1_bus.clk,
557 .enable = s5pc100_d1_4_ctrl,
558 .ctrlbit = (1 << 4),
559 }, {
560 .name = "i2c",
561 .devname = "s3c2440-i2c.1",
562 .parent = &clk_div_d1_bus.clk,
563 .enable = s5pc100_d1_4_ctrl,
564 .ctrlbit = (1 << 5),
565 }, {
566 .name = "spi",
567 .devname = "s5pc100-spi.0",
568 .parent = &clk_div_d1_bus.clk,
569 .enable = s5pc100_d1_4_ctrl,
570 .ctrlbit = (1 << 6),
571 }, {
572 .name = "spi",
573 .devname = "s5pc100-spi.1",
574 .parent = &clk_div_d1_bus.clk,
575 .enable = s5pc100_d1_4_ctrl,
576 .ctrlbit = (1 << 7),
577 }, {
578 .name = "spi",
579 .devname = "s5pc100-spi.2",
580 .parent = &clk_div_d1_bus.clk,
581 .enable = s5pc100_d1_4_ctrl,
582 .ctrlbit = (1 << 8),
583 }, {
584 .name = "irda",
585 .parent = &clk_div_d1_bus.clk,
586 .enable = s5pc100_d1_4_ctrl,
587 .ctrlbit = (1 << 9),
588 }, {
589 .name = "ccan",
590 .parent = &clk_div_d1_bus.clk,
591 .enable = s5pc100_d1_4_ctrl,
592 .ctrlbit = (1 << 10),
593 }, {
594 .name = "ccan",
595 .parent = &clk_div_d1_bus.clk,
596 .enable = s5pc100_d1_4_ctrl,
597 .ctrlbit = (1 << 11),
598 }, {
599 .name = "hsitx",
600 .parent = &clk_div_d1_bus.clk,
601 .enable = s5pc100_d1_4_ctrl,
602 .ctrlbit = (1 << 12),
603 }, {
604 .name = "hsirx",
605 .parent = &clk_div_d1_bus.clk,
606 .enable = s5pc100_d1_4_ctrl,
607 .ctrlbit = (1 << 13),
608 }, {
609 .name = "ac97",
610 .parent = &clk_div_pclkd1.clk,
611 .enable = s5pc100_d1_5_ctrl,
612 .ctrlbit = (1 << 3),
613 }, {
614 .name = "pcm",
615 .devname = "samsung-pcm.0",
616 .parent = &clk_div_pclkd1.clk,
617 .enable = s5pc100_d1_5_ctrl,
618 .ctrlbit = (1 << 4),
619 }, {
620 .name = "pcm",
621 .devname = "samsung-pcm.1",
622 .parent = &clk_div_pclkd1.clk,
623 .enable = s5pc100_d1_5_ctrl,
624 .ctrlbit = (1 << 5),
625 }, {
626 .name = "spdif",
627 .parent = &clk_div_pclkd1.clk,
628 .enable = s5pc100_d1_5_ctrl,
629 .ctrlbit = (1 << 6),
630 }, {
631 .name = "adc",
632 .parent = &clk_div_pclkd1.clk,
633 .enable = s5pc100_d1_5_ctrl,
634 .ctrlbit = (1 << 7),
635 }, {
636 .name = "keypad",
637 .parent = &clk_div_pclkd1.clk,
638 .enable = s5pc100_d1_5_ctrl,
639 .ctrlbit = (1 << 8),
640 }, {
641 .name = "mmc_48m",
642 .devname = "s3c-sdhci.0",
643 .parent = &clk_mout_48m.clk,
644 .enable = s5pc100_sclk0_ctrl,
645 .ctrlbit = (1 << 15),
646 }, {
647 .name = "mmc_48m",
648 .devname = "s3c-sdhci.1",
649 .parent = &clk_mout_48m.clk,
650 .enable = s5pc100_sclk0_ctrl,
651 .ctrlbit = (1 << 16),
652 }, {
653 .name = "mmc_48m",
654 .devname = "s3c-sdhci.2",
655 .parent = &clk_mout_48m.clk,
656 .enable = s5pc100_sclk0_ctrl,
657 .ctrlbit = (1 << 17),
658 },
659};
660
661static struct clk clk_hsmmc2 = {
662 .name = "hsmmc",
663 .devname = "s3c-sdhci.2",
664 .parent = &clk_div_d1_bus.clk,
665 .enable = s5pc100_d1_0_ctrl,
666 .ctrlbit = (1 << 7),
667};
668
669static struct clk clk_hsmmc1 = {
670 .name = "hsmmc",
671 .devname = "s3c-sdhci.1",
672 .parent = &clk_div_d1_bus.clk,
673 .enable = s5pc100_d1_0_ctrl,
674 .ctrlbit = (1 << 6),
675};
676
677static struct clk clk_hsmmc0 = {
678 .name = "hsmmc",
679 .devname = "s3c-sdhci.0",
680 .parent = &clk_div_d1_bus.clk,
681 .enable = s5pc100_d1_0_ctrl,
682 .ctrlbit = (1 << 5),
683};
684
685static struct clk clk_48m_spi0 = {
686 .name = "spi_48m",
687 .devname = "s5pc100-spi.0",
688 .parent = &clk_mout_48m.clk,
689 .enable = s5pc100_sclk0_ctrl,
690 .ctrlbit = (1 << 7),
691};
692
693static struct clk clk_48m_spi1 = {
694 .name = "spi_48m",
695 .devname = "s5pc100-spi.1",
696 .parent = &clk_mout_48m.clk,
697 .enable = s5pc100_sclk0_ctrl,
698 .ctrlbit = (1 << 8),
699};
700
701static struct clk clk_48m_spi2 = {
702 .name = "spi_48m",
703 .devname = "s5pc100-spi.2",
704 .parent = &clk_mout_48m.clk,
705 .enable = s5pc100_sclk0_ctrl,
706 .ctrlbit = (1 << 9),
707};
708
709static struct clk clk_i2s0 = {
710 .name = "iis",
711 .devname = "samsung-i2s.0",
712 .parent = &clk_div_pclkd1.clk,
713 .enable = s5pc100_d1_5_ctrl,
714 .ctrlbit = (1 << 0),
715};
716
717static struct clk clk_i2s1 = {
718 .name = "iis",
719 .devname = "samsung-i2s.1",
720 .parent = &clk_div_pclkd1.clk,
721 .enable = s5pc100_d1_5_ctrl,
722 .ctrlbit = (1 << 1),
723};
724
725static struct clk clk_i2s2 = {
726 .name = "iis",
727 .devname = "samsung-i2s.2",
728 .parent = &clk_div_pclkd1.clk,
729 .enable = s5pc100_d1_5_ctrl,
730 .ctrlbit = (1 << 2),
731};
732
733static struct clk clk_vclk54m = {
734 .name = "vclk_54m",
735 .rate = 54000000,
736};
737
738static struct clk clk_i2scdclk0 = {
739 .name = "i2s_cdclk0",
740};
741
742static struct clk clk_i2scdclk1 = {
743 .name = "i2s_cdclk1",
744};
745
746static struct clk clk_i2scdclk2 = {
747 .name = "i2s_cdclk2",
748};
749
750static struct clk clk_pcmcdclk0 = {
751 .name = "pcm_cdclk0",
752};
753
754static struct clk clk_pcmcdclk1 = {
755 .name = "pcm_cdclk1",
756};
757
758static struct clk *clk_src_group1_list[] = {
759 [0] = &clk_mout_epll.clk,
760 [1] = &clk_div_mpll2.clk,
761 [2] = &clk_fin_epll,
762 [3] = &clk_mout_hpll.clk,
763};
764
765static struct clksrc_sources clk_src_group1 = {
766 .sources = clk_src_group1_list,
767 .nr_sources = ARRAY_SIZE(clk_src_group1_list),
768};
769
770static struct clk *clk_src_group2_list[] = {
771 [0] = &clk_mout_epll.clk,
772 [1] = &clk_div_mpll.clk,
773};
774
775static struct clksrc_sources clk_src_group2 = {
776 .sources = clk_src_group2_list,
777 .nr_sources = ARRAY_SIZE(clk_src_group2_list),
778};
779
780static struct clk *clk_src_group3_list[] = {
781 [0] = &clk_mout_epll.clk,
782 [1] = &clk_div_mpll.clk,
783 [2] = &clk_fin_epll,
784 [3] = &clk_i2scdclk0,
785 [4] = &clk_pcmcdclk0,
786 [5] = &clk_mout_hpll.clk,
787};
788
789static struct clksrc_sources clk_src_group3 = {
790 .sources = clk_src_group3_list,
791 .nr_sources = ARRAY_SIZE(clk_src_group3_list),
792};
793
794static struct clksrc_clk clk_sclk_audio0 = {
795 .clk = {
796 .name = "sclk_audio",
797 .devname = "samsung-pcm.0",
798 .ctrlbit = (1 << 8),
799 .enable = s5pc100_sclk1_ctrl,
800 },
801 .sources = &clk_src_group3,
802 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 3 },
803 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 },
804};
805
806static struct clk *clk_src_group4_list[] = {
807 [0] = &clk_mout_epll.clk,
808 [1] = &clk_div_mpll.clk,
809 [2] = &clk_fin_epll,
810 [3] = &clk_i2scdclk1,
811 [4] = &clk_pcmcdclk1,
812 [5] = &clk_mout_hpll.clk,
813};
814
815static struct clksrc_sources clk_src_group4 = {
816 .sources = clk_src_group4_list,
817 .nr_sources = ARRAY_SIZE(clk_src_group4_list),
818};
819
820static struct clksrc_clk clk_sclk_audio1 = {
821 .clk = {
822 .name = "sclk_audio",
823 .devname = "samsung-pcm.1",
824 .ctrlbit = (1 << 9),
825 .enable = s5pc100_sclk1_ctrl,
826 },
827 .sources = &clk_src_group4,
828 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 3 },
829 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
830};
831
832static struct clk *clk_src_group5_list[] = {
833 [0] = &clk_mout_epll.clk,
834 [1] = &clk_div_mpll.clk,
835 [2] = &clk_fin_epll,
836 [3] = &clk_i2scdclk2,
837 [4] = &clk_mout_hpll.clk,
838};
839
840static struct clksrc_sources clk_src_group5 = {
841 .sources = clk_src_group5_list,
842 .nr_sources = ARRAY_SIZE(clk_src_group5_list),
843};
844
845static struct clksrc_clk clk_sclk_audio2 = {
846 .clk = {
847 .name = "sclk_audio",
848 .devname = "samsung-pcm.2",
849 .ctrlbit = (1 << 10),
850 .enable = s5pc100_sclk1_ctrl,
851 },
852 .sources = &clk_src_group5,
853 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 3 },
854 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 },
855};
856
857static struct clk *clk_src_group6_list[] = {
858 [0] = &s5p_clk_27m,
859 [1] = &clk_vclk54m,
860 [2] = &clk_div_hdmi.clk,
861};
862
863static struct clksrc_sources clk_src_group6 = {
864 .sources = clk_src_group6_list,
865 .nr_sources = ARRAY_SIZE(clk_src_group6_list),
866};
867
868static struct clk *clk_src_group7_list[] = {
869 [0] = &clk_mout_epll.clk,
870 [1] = &clk_div_mpll.clk,
871 [2] = &clk_mout_hpll.clk,
872 [3] = &clk_vclk54m,
873};
874
875static struct clksrc_sources clk_src_group7 = {
876 .sources = clk_src_group7_list,
877 .nr_sources = ARRAY_SIZE(clk_src_group7_list),
878};
879
880static struct clk *clk_src_mmc0_list[] = {
881 [0] = &clk_mout_epll.clk,
882 [1] = &clk_div_mpll.clk,
883 [2] = &clk_fin_epll,
884};
885
886static struct clksrc_sources clk_src_mmc0 = {
887 .sources = clk_src_mmc0_list,
888 .nr_sources = ARRAY_SIZE(clk_src_mmc0_list),
889};
890
891static struct clk *clk_src_mmc12_list[] = {
892 [0] = &clk_mout_epll.clk,
893 [1] = &clk_div_mpll.clk,
894 [2] = &clk_fin_epll,
895 [3] = &clk_mout_hpll.clk,
896};
897
898static struct clksrc_sources clk_src_mmc12 = {
899 .sources = clk_src_mmc12_list,
900 .nr_sources = ARRAY_SIZE(clk_src_mmc12_list),
901};
902
903static struct clk *clk_src_irda_usb_list[] = {
904 [0] = &clk_mout_epll.clk,
905 [1] = &clk_div_mpll.clk,
906 [2] = &clk_fin_epll,
907 [3] = &clk_mout_hpll.clk,
908};
909
910static struct clksrc_sources clk_src_irda_usb = {
911 .sources = clk_src_irda_usb_list,
912 .nr_sources = ARRAY_SIZE(clk_src_irda_usb_list),
913};
914
915static struct clk *clk_src_pwi_list[] = {
916 [0] = &clk_fin_epll,
917 [1] = &clk_mout_epll.clk,
918 [2] = &clk_div_mpll.clk,
919};
920
921static struct clksrc_sources clk_src_pwi = {
922 .sources = clk_src_pwi_list,
923 .nr_sources = ARRAY_SIZE(clk_src_pwi_list),
924};
925
926static struct clk *clk_sclk_spdif_list[] = {
927 [0] = &clk_sclk_audio0.clk,
928 [1] = &clk_sclk_audio1.clk,
929 [2] = &clk_sclk_audio2.clk,
930};
931
932static struct clksrc_sources clk_src_sclk_spdif = {
933 .sources = clk_sclk_spdif_list,
934 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list),
935};
936
937static struct clksrc_clk clk_sclk_spdif = {
938 .clk = {
939 .name = "sclk_spdif",
940 .ctrlbit = (1 << 11),
941 .enable = s5pc100_sclk1_ctrl,
942 .ops = &s5p_sclk_spdif_ops,
943 },
944 .sources = &clk_src_sclk_spdif,
945 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 },
946};
947
948static struct clksrc_clk clksrcs[] = {
949 {
950 .clk = {
951 .name = "sclk_mixer",
952 .ctrlbit = (1 << 6),
953 .enable = s5pc100_sclk0_ctrl,
954
955 },
956 .sources = &clk_src_group6,
957 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 28, .size = 2 },
958 }, {
959 .clk = {
960 .name = "sclk_lcd",
961 .ctrlbit = (1 << 0),
962 .enable = s5pc100_sclk1_ctrl,
963
964 },
965 .sources = &clk_src_group7,
966 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 12, .size = 2 },
967 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 },
968 }, {
969 .clk = {
970 .name = "sclk_fimc",
971 .devname = "s5p-fimc.0",
972 .ctrlbit = (1 << 1),
973 .enable = s5pc100_sclk1_ctrl,
974
975 },
976 .sources = &clk_src_group7,
977 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 16, .size = 2 },
978 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 16, .size = 4 },
979 }, {
980 .clk = {
981 .name = "sclk_fimc",
982 .devname = "s5p-fimc.1",
983 .ctrlbit = (1 << 2),
984 .enable = s5pc100_sclk1_ctrl,
985
986 },
987 .sources = &clk_src_group7,
988 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 20, .size = 2 },
989 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 },
990 }, {
991 .clk = {
992 .name = "sclk_fimc",
993 .devname = "s5p-fimc.2",
994 .ctrlbit = (1 << 3),
995 .enable = s5pc100_sclk1_ctrl,
996
997 },
998 .sources = &clk_src_group7,
999 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 24, .size = 2 },
1000 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 24, .size = 4 },
1001 }, {
1002 .clk = {
1003 .name = "sclk_irda",
1004 .ctrlbit = (1 << 10),
1005 .enable = s5pc100_sclk0_ctrl,
1006
1007 },
1008 .sources = &clk_src_irda_usb,
1009 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
1010 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
1011 }, {
1012 .clk = {
1013 .name = "sclk_irda",
1014 .ctrlbit = (1 << 10),
1015 .enable = s5pc100_sclk0_ctrl,
1016
1017 },
1018 .sources = &clk_src_mmc12,
1019 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 16, .size = 2 },
1020 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 16, .size = 4 },
1021 }, {
1022 .clk = {
1023 .name = "sclk_pwi",
1024 .ctrlbit = (1 << 1),
1025 .enable = s5pc100_sclk0_ctrl,
1026
1027 },
1028 .sources = &clk_src_pwi,
1029 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 0, .size = 2 },
1030 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 0, .size = 3 },
1031 }, {
1032 .clk = {
1033 .name = "sclk_uhost",
1034 .ctrlbit = (1 << 11),
1035 .enable = s5pc100_sclk0_ctrl,
1036
1037 },
1038 .sources = &clk_src_irda_usb,
1039 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 20, .size = 2 },
1040 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 20, .size = 4 },
1041 },
1042};
1043
1044static struct clksrc_clk clk_sclk_uart = {
1045 .clk = {
1046 .name = "uclk1",
1047 .ctrlbit = (1 << 3),
1048 .enable = s5pc100_sclk0_ctrl,
1049 },
1050 .sources = &clk_src_group2,
1051 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 1 },
1052 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 },
1053};
1054
1055static struct clksrc_clk clk_sclk_mmc0 = {
1056 .clk = {
1057 .name = "sclk_mmc",
1058 .devname = "s3c-sdhci.0",
1059 .ctrlbit = (1 << 12),
1060 .enable = s5pc100_sclk1_ctrl,
1061 },
1062 .sources = &clk_src_mmc0,
1063 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 0, .size = 2 },
1064 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 0, .size = 4 },
1065};
1066
1067static struct clksrc_clk clk_sclk_mmc1 = {
1068 .clk = {
1069 .name = "sclk_mmc",
1070 .devname = "s3c-sdhci.1",
1071 .ctrlbit = (1 << 13),
1072 .enable = s5pc100_sclk1_ctrl,
1073 },
1074 .sources = &clk_src_mmc12,
1075 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 4, .size = 2 },
1076 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 4, .size = 4 },
1077};
1078
1079static struct clksrc_clk clk_sclk_mmc2 = {
1080 .clk = {
1081 .name = "sclk_mmc",
1082 .devname = "s3c-sdhci.2",
1083 .ctrlbit = (1 << 14),
1084 .enable = s5pc100_sclk1_ctrl,
1085 },
1086 .sources = &clk_src_mmc12,
1087 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
1088 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
1089};
1090
1091static struct clksrc_clk clk_sclk_spi0 = {
1092 .clk = {
1093 .name = "sclk_spi",
1094 .devname = "s5pc100-spi.0",
1095 .ctrlbit = (1 << 4),
1096 .enable = s5pc100_sclk0_ctrl,
1097 },
1098 .sources = &clk_src_group1,
1099 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 2 },
1100 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 },
1101};
1102
1103static struct clksrc_clk clk_sclk_spi1 = {
1104 .clk = {
1105 .name = "sclk_spi",
1106 .devname = "s5pc100-spi.1",
1107 .ctrlbit = (1 << 5),
1108 .enable = s5pc100_sclk0_ctrl,
1109 },
1110 .sources = &clk_src_group1,
1111 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 2 },
1112 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 8, .size = 4 },
1113};
1114
1115static struct clksrc_clk clk_sclk_spi2 = {
1116 .clk = {
1117 .name = "sclk_spi",
1118 .devname = "s5pc100-spi.2",
1119 .ctrlbit = (1 << 6),
1120 .enable = s5pc100_sclk0_ctrl,
1121 },
1122 .sources = &clk_src_group1,
1123 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 12, .size = 2 },
1124 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 12, .size = 4 },
1125};
1126
1127/* Clock initialisation code */
1128static struct clksrc_clk *sysclks[] = {
1129 &clk_mout_apll,
1130 &clk_mout_epll,
1131 &clk_mout_mpll,
1132 &clk_mout_hpll,
1133 &clk_mout_href,
1134 &clk_mout_48m,
1135 &clk_div_apll,
1136 &clk_div_arm,
1137 &clk_div_d0_bus,
1138 &clk_div_pclkd0,
1139 &clk_div_secss,
1140 &clk_div_apll2,
1141 &clk_mout_am,
1142 &clk_div_d1_bus,
1143 &clk_div_mpll2,
1144 &clk_div_mpll,
1145 &clk_mout_onenand,
1146 &clk_div_onenand,
1147 &clk_div_pclkd1,
1148 &clk_div_cam,
1149 &clk_div_hdmi,
1150 &clk_sclk_audio0,
1151 &clk_sclk_audio1,
1152 &clk_sclk_audio2,
1153 &clk_sclk_spdif,
1154};
1155
1156static struct clk *clk_cdev[] = {
1157 &clk_hsmmc0,
1158 &clk_hsmmc1,
1159 &clk_hsmmc2,
1160 &clk_48m_spi0,
1161 &clk_48m_spi1,
1162 &clk_48m_spi2,
1163 &clk_i2s0,
1164 &clk_i2s1,
1165 &clk_i2s2,
1166};
1167
1168static struct clksrc_clk *clksrc_cdev[] = {
1169 &clk_sclk_uart,
1170 &clk_sclk_mmc0,
1171 &clk_sclk_mmc1,
1172 &clk_sclk_mmc2,
1173 &clk_sclk_spi0,
1174 &clk_sclk_spi1,
1175 &clk_sclk_spi2,
1176};
1177
1178void __init_or_cpufreq s5pc100_setup_clocks(void)
1179{
1180 unsigned long xtal;
1181 unsigned long arm;
1182 unsigned long hclkd0;
1183 unsigned long hclkd1;
1184 unsigned long pclkd0;
1185 unsigned long pclkd1;
1186 unsigned long apll;
1187 unsigned long mpll;
1188 unsigned long epll;
1189 unsigned long hpll;
1190 unsigned int ptr;
1191
1192 /* Set S5PC100 functions for clk_fout_epll */
1193 clk_fout_epll.enable = s5p_epll_enable;
1194 clk_fout_epll.ops = &s5pc100_epll_ops;
1195
1196 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1197
1198 xtal = clk_get_rate(&clk_xtal);
1199
1200 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1201
1202 apll = s5p_get_pll65xx(xtal, __raw_readl(S5P_APLL_CON));
1203 mpll = s5p_get_pll65xx(xtal, __raw_readl(S5P_MPLL_CON));
1204 epll = s5p_get_pll65xx(xtal, __raw_readl(S5P_EPLL_CON));
1205 hpll = s5p_get_pll65xx(xtal, __raw_readl(S5P_HPLL_CON));
1206
1207 printk(KERN_INFO "S5PC100: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz, E=%ld.%ldMHz, H=%ld.%ldMHz\n",
1208 print_mhz(apll), print_mhz(mpll), print_mhz(epll), print_mhz(hpll));
1209
1210 clk_fout_apll.rate = apll;
1211 clk_fout_mpll.rate = mpll;
1212 clk_fout_epll.rate = epll;
1213 clk_mout_hpll.clk.rate = hpll;
1214
1215 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1216 s3c_set_clksrc(&clksrcs[ptr], true);
1217
1218 arm = clk_get_rate(&clk_div_arm.clk);
1219 hclkd0 = clk_get_rate(&clk_div_d0_bus.clk);
1220 pclkd0 = clk_get_rate(&clk_div_pclkd0.clk);
1221 hclkd1 = clk_get_rate(&clk_div_d1_bus.clk);
1222 pclkd1 = clk_get_rate(&clk_div_pclkd1.clk);
1223
1224 printk(KERN_INFO "S5PC100: HCLKD0=%ld.%ldMHz, HCLKD1=%ld.%ldMHz, PCLKD0=%ld.%ldMHz, PCLKD1=%ld.%ldMHz\n",
1225 print_mhz(hclkd0), print_mhz(hclkd1), print_mhz(pclkd0), print_mhz(pclkd1));
1226
1227 clk_f.rate = arm;
1228 clk_h.rate = hclkd1;
1229 clk_p.rate = pclkd1;
1230}
1231
1232/*
1233 * The following clocks will be enabled during clock initialization.
1234 */
1235static struct clk init_clocks[] = {
1236 {
1237 .name = "tzic",
1238 .parent = &clk_div_d0_bus.clk,
1239 .enable = s5pc100_d0_0_ctrl,
1240 .ctrlbit = (1 << 1),
1241 }, {
1242 .name = "intc",
1243 .parent = &clk_div_d0_bus.clk,
1244 .enable = s5pc100_d0_0_ctrl,
1245 .ctrlbit = (1 << 0),
1246 }, {
1247 .name = "ebi",
1248 .parent = &clk_div_d0_bus.clk,
1249 .enable = s5pc100_d0_1_ctrl,
1250 .ctrlbit = (1 << 5),
1251 }, {
1252 .name = "intmem",
1253 .parent = &clk_div_d0_bus.clk,
1254 .enable = s5pc100_d0_1_ctrl,
1255 .ctrlbit = (1 << 4),
1256 }, {
1257 .name = "sromc",
1258 .parent = &clk_div_d0_bus.clk,
1259 .enable = s5pc100_d0_1_ctrl,
1260 .ctrlbit = (1 << 1),
1261 }, {
1262 .name = "dmc",
1263 .parent = &clk_div_d0_bus.clk,
1264 .enable = s5pc100_d0_1_ctrl,
1265 .ctrlbit = (1 << 0),
1266 }, {
1267 .name = "chipid",
1268 .parent = &clk_div_d0_bus.clk,
1269 .enable = s5pc100_d0_1_ctrl,
1270 .ctrlbit = (1 << 0),
1271 }, {
1272 .name = "gpio",
1273 .parent = &clk_div_d1_bus.clk,
1274 .enable = s5pc100_d1_3_ctrl,
1275 .ctrlbit = (1 << 1),
1276 }, {
1277 .name = "uart",
1278 .devname = "s3c6400-uart.0",
1279 .parent = &clk_div_d1_bus.clk,
1280 .enable = s5pc100_d1_4_ctrl,
1281 .ctrlbit = (1 << 0),
1282 }, {
1283 .name = "uart",
1284 .devname = "s3c6400-uart.1",
1285 .parent = &clk_div_d1_bus.clk,
1286 .enable = s5pc100_d1_4_ctrl,
1287 .ctrlbit = (1 << 1),
1288 }, {
1289 .name = "uart",
1290 .devname = "s3c6400-uart.2",
1291 .parent = &clk_div_d1_bus.clk,
1292 .enable = s5pc100_d1_4_ctrl,
1293 .ctrlbit = (1 << 2),
1294 }, {
1295 .name = "uart",
1296 .devname = "s3c6400-uart.3",
1297 .parent = &clk_div_d1_bus.clk,
1298 .enable = s5pc100_d1_4_ctrl,
1299 .ctrlbit = (1 << 3),
1300 }, {
1301 .name = "timers",
1302 .parent = &clk_div_d1_bus.clk,
1303 .enable = s5pc100_d1_3_ctrl,
1304 .ctrlbit = (1 << 6),
1305 },
1306};
1307
1308static struct clk *clks[] __initdata = {
1309 &clk_ext,
1310 &clk_i2scdclk0,
1311 &clk_i2scdclk1,
1312 &clk_i2scdclk2,
1313 &clk_pcmcdclk0,
1314 &clk_pcmcdclk1,
1315};
1316
1317static struct clk_lookup s5pc100_clk_lookup[] = {
1318 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
1319 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uart.clk),
1320 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &clk_hsmmc0),
1321 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &clk_hsmmc1),
1322 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.0", &clk_hsmmc2),
1323 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
1324 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
1325 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1326 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
1327 CLKDEV_INIT("s5pc100-spi.0", "spi_busclk1", &clk_48m_spi0),
1328 CLKDEV_INIT("s5pc100-spi.0", "spi_busclk2", &clk_sclk_spi0.clk),
1329 CLKDEV_INIT("s5pc100-spi.1", "spi_busclk1", &clk_48m_spi1),
1330 CLKDEV_INIT("s5pc100-spi.1", "spi_busclk2", &clk_sclk_spi1.clk),
1331 CLKDEV_INIT("s5pc100-spi.2", "spi_busclk1", &clk_48m_spi2),
1332 CLKDEV_INIT("s5pc100-spi.2", "spi_busclk2", &clk_sclk_spi2.clk),
1333 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &clk_i2s0),
1334 CLKDEV_INIT("samsung-i2s.1", "i2s_opclk0", &clk_i2s1),
1335 CLKDEV_INIT("samsung-i2s.2", "i2s_opclk0", &clk_i2s2),
1336};
1337
1338void __init s5pc100_register_clocks(void)
1339{
1340 int ptr;
1341
1342 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1343
1344 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1345 s3c_register_clksrc(sysclks[ptr], 1);
1346
1347 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1348 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1349 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
1350 s3c_register_clksrc(clksrc_cdev[ptr], 1);
1351
1352 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1353 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1354 clkdev_add_table(s5pc100_clk_lookup, ARRAY_SIZE(s5pc100_clk_lookup));
1355
1356 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
1357 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++)
1358 s3c_disable_clocks(clk_cdev[ptr], 1);
1359
1360 s3c24xx_register_clock(&dummy_apb_pclk);
1361}
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
deleted file mode 100644
index 6a41bf7dacf6..000000000000
--- a/arch/arm/mach-s5pc100/common.c
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Copyright 2009 Samsung Electronics Co.
6 * Byungho Min <bhmin@samsung.com>
7 *
8 * Common Codes for S5PC100
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/list.h>
19#include <linux/timer.h>
20#include <linux/init.h>
21#include <linux/clk.h>
22#include <linux/io.h>
23#include <linux/device.h>
24#include <linux/serial_core.h>
25#include <linux/serial_s3c.h>
26#include <clocksource/samsung_pwm.h>
27#include <linux/platform_device.h>
28#include <linux/sched.h>
29#include <linux/reboot.h>
30
31#include <asm/irq.h>
32#include <asm/proc-fns.h>
33#include <asm/system_misc.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include <mach/map.h>
39#include <mach/hardware.h>
40#include <mach/regs-clock.h>
41
42#include <plat/cpu.h>
43#include <plat/devs.h>
44#include <plat/clock.h>
45#include <plat/sdhci.h>
46#include <plat/adc-core.h>
47#include <plat/ata-core.h>
48#include <plat/fb-core.h>
49#include <plat/iic-core.h>
50#include <plat/onenand-core.h>
51#include <plat/pwm-core.h>
52#include <plat/spi-core.h>
53#include <plat/watchdog-reset.h>
54
55#include "common.h"
56
57static const char name_s5pc100[] = "S5PC100";
58
59static struct cpu_table cpu_ids[] __initdata = {
60 {
61 .idcode = S5PC100_CPU_ID,
62 .idmask = S5PC100_CPU_MASK,
63 .map_io = s5pc100_map_io,
64 .init_clocks = s5pc100_init_clocks,
65 .init_uarts = s5pc100_init_uarts,
66 .init = s5pc100_init,
67 .name = name_s5pc100,
68 },
69};
70
71/* Initial IO mappings */
72
73static struct map_desc s5pc100_iodesc[] __initdata = {
74 {
75 .virtual = (unsigned long)S5P_VA_CHIPID,
76 .pfn = __phys_to_pfn(S5PC100_PA_CHIPID),
77 .length = SZ_4K,
78 .type = MT_DEVICE,
79 }, {
80 .virtual = (unsigned long)S3C_VA_SYS,
81 .pfn = __phys_to_pfn(S5PC100_PA_SYSCON),
82 .length = SZ_64K,
83 .type = MT_DEVICE,
84 }, {
85 .virtual = (unsigned long)S3C_VA_TIMER,
86 .pfn = __phys_to_pfn(S5PC100_PA_TIMER),
87 .length = SZ_16K,
88 .type = MT_DEVICE,
89 }, {
90 .virtual = (unsigned long)S3C_VA_WATCHDOG,
91 .pfn = __phys_to_pfn(S5PC100_PA_WATCHDOG),
92 .length = SZ_4K,
93 .type = MT_DEVICE,
94 }, {
95 .virtual = (unsigned long)S5P_VA_SROMC,
96 .pfn = __phys_to_pfn(S5PC100_PA_SROMC),
97 .length = SZ_4K,
98 .type = MT_DEVICE,
99 }, {
100 .virtual = (unsigned long)S5P_VA_SYSTIMER,
101 .pfn = __phys_to_pfn(S5PC100_PA_SYSTIMER),
102 .length = SZ_16K,
103 .type = MT_DEVICE,
104 }, {
105 .virtual = (unsigned long)S5P_VA_GPIO,
106 .pfn = __phys_to_pfn(S5PC100_PA_GPIO),
107 .length = SZ_4K,
108 .type = MT_DEVICE,
109 }, {
110 .virtual = (unsigned long)VA_VIC0,
111 .pfn = __phys_to_pfn(S5PC100_PA_VIC0),
112 .length = SZ_16K,
113 .type = MT_DEVICE,
114 }, {
115 .virtual = (unsigned long)VA_VIC1,
116 .pfn = __phys_to_pfn(S5PC100_PA_VIC1),
117 .length = SZ_16K,
118 .type = MT_DEVICE,
119 }, {
120 .virtual = (unsigned long)VA_VIC2,
121 .pfn = __phys_to_pfn(S5PC100_PA_VIC2),
122 .length = SZ_16K,
123 .type = MT_DEVICE,
124 }, {
125 .virtual = (unsigned long)S3C_VA_UART,
126 .pfn = __phys_to_pfn(S3C_PA_UART),
127 .length = SZ_512K,
128 .type = MT_DEVICE,
129 }, {
130 .virtual = (unsigned long)S5PC100_VA_OTHERS,
131 .pfn = __phys_to_pfn(S5PC100_PA_OTHERS),
132 .length = SZ_4K,
133 .type = MT_DEVICE,
134 }
135};
136
137static struct samsung_pwm_variant s5pc100_pwm_variant = {
138 .bits = 32,
139 .div_base = 0,
140 .has_tint_cstat = true,
141 .tclk_mask = (1 << 5),
142};
143
144void __init samsung_set_timer_source(unsigned int event, unsigned int source)
145{
146 s5pc100_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
147 s5pc100_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
148}
149
150void __init samsung_timer_init(void)
151{
152 unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
153 IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
154 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
155 };
156
157 samsung_pwm_clocksource_init(S3C_VA_TIMER,
158 timer_irqs, &s5pc100_pwm_variant);
159}
160
161/*
162 * s5pc100_map_io
163 *
164 * register the standard CPU IO areas
165 */
166
167void __init s5pc100_init_io(struct map_desc *mach_desc, int size)
168{
169 /* initialize the io descriptors we need for initialization */
170 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc));
171 if (mach_desc)
172 iotable_init(mach_desc, size);
173
174 /* detect cpu id and rev. */
175 s5p_init_cpu(S5P_VA_CHIPID);
176
177 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
178
179 samsung_pwm_set_platdata(&s5pc100_pwm_variant);
180}
181
182void __init s5pc100_map_io(void)
183{
184 /* initialise device information early */
185 s5pc100_default_sdhci0();
186 s5pc100_default_sdhci1();
187 s5pc100_default_sdhci2();
188
189 s3c_adc_setname("s3c64xx-adc");
190
191 /* the i2c devices are directly compatible with s3c2440 */
192 s3c_i2c0_setname("s3c2440-i2c");
193 s3c_i2c1_setname("s3c2440-i2c");
194
195 s3c_onenand_setname("s5pc100-onenand");
196 s3c_fb_setname("s5pc100-fb");
197 s3c_cfcon_setname("s5pc100-pata");
198
199 s3c64xx_spi_setname("s5pc100-spi");
200}
201
202void __init s5pc100_init_clocks(int xtal)
203{
204 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
205
206 s3c24xx_register_baseclocks(xtal);
207 s5p_register_clocks(xtal);
208 s5pc100_register_clocks();
209 s5pc100_setup_clocks();
210 samsung_wdt_reset_init(S3C_VA_WATCHDOG);
211}
212
213void __init s5pc100_init_irq(void)
214{
215 u32 vic[] = {~0, ~0, ~0};
216
217 /* VIC0, VIC1, and VIC2 are fully populated. */
218 s5p_init_irq(vic, ARRAY_SIZE(vic));
219}
220
221static struct bus_type s5pc100_subsys = {
222 .name = "s5pc100-core",
223 .dev_name = "s5pc100-core",
224};
225
226static struct device s5pc100_dev = {
227 .bus = &s5pc100_subsys,
228};
229
230static int __init s5pc100_core_init(void)
231{
232 return subsys_system_register(&s5pc100_subsys, NULL);
233}
234core_initcall(s5pc100_core_init);
235
236int __init s5pc100_init(void)
237{
238 printk(KERN_INFO "S5PC100: Initializing architecture\n");
239 return device_register(&s5pc100_dev);
240}
241
242/* uart registration process */
243
244void __init s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no)
245{
246 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
247}
248
249void s5pc100_restart(enum reboot_mode mode, const char *cmd)
250{
251 if (mode != REBOOT_SOFT)
252 samsung_wdt_reset();
253
254 soft_restart(0);
255}
diff --git a/arch/arm/mach-s5pc100/common.h b/arch/arm/mach-s5pc100/common.h
deleted file mode 100644
index 08d782d65d7b..000000000000
--- a/arch/arm/mach-s5pc100/common.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for S5PC100 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ARCH_ARM_MACH_S5PC100_COMMON_H
13#define __ARCH_ARM_MACH_S5PC100_COMMON_H
14
15#include <linux/reboot.h>
16
17void s5pc100_init_io(struct map_desc *mach_desc, int size);
18void s5pc100_init_irq(void);
19
20void s5pc100_register_clocks(void);
21void s5pc100_setup_clocks(void);
22
23void s5pc100_restart(enum reboot_mode mode, const char *cmd);
24
25extern int s5pc100_init(void);
26extern void s5pc100_map_io(void);
27extern void s5pc100_init_clocks(int xtal);
28extern void s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no);
29
30#endif /* __ARCH_ARM_MACH_S5PC100_COMMON_H */
diff --git a/arch/arm/mach-s5pc100/dev-audio.c b/arch/arm/mach-s5pc100/dev-audio.c
deleted file mode 100644
index 46f488b09391..000000000000
--- a/arch/arm/mach-s5pc100/dev-audio.c
+++ /dev/null
@@ -1,239 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/dev-audio.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14
15#include <plat/gpio-cfg.h>
16#include <linux/platform_data/asoc-s3c.h>
17
18#include <mach/map.h>
19#include <mach/dma.h>
20#include <mach/irqs.h>
21
22static int s5pc100_cfg_i2s(struct platform_device *pdev)
23{
24 /* configure GPIO for i2s port */
25 switch (pdev->id) {
26 case 0: /* Dedicated pins */
27 break;
28 case 1:
29 s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(2));
30 break;
31 case 2:
32 s3c_gpio_cfgpin_range(S5PC100_GPG3(0), 5, S3C_GPIO_SFN(4));
33 break;
34 default:
35 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
36 return -EINVAL;
37 }
38
39 return 0;
40}
41
42static struct s3c_audio_pdata i2sv5_pdata = {
43 .cfg_gpio = s5pc100_cfg_i2s,
44 .type = {
45 .i2s = {
46 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
47 | QUIRK_NEED_RSTCLR,
48 },
49 },
50};
51
52static struct resource s5pc100_iis0_resource[] = {
53 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S0, SZ_256),
54 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
55 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
56 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
57};
58
59struct platform_device s5pc100_device_iis0 = {
60 .name = "samsung-i2s",
61 .id = 0,
62 .num_resources = ARRAY_SIZE(s5pc100_iis0_resource),
63 .resource = s5pc100_iis0_resource,
64 .dev = {
65 .platform_data = &i2sv5_pdata,
66 },
67};
68
69static struct s3c_audio_pdata i2sv3_pdata = {
70 .cfg_gpio = s5pc100_cfg_i2s,
71};
72
73static struct resource s5pc100_iis1_resource[] = {
74 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S1, SZ_256),
75 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
76 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
77};
78
79struct platform_device s5pc100_device_iis1 = {
80 .name = "samsung-i2s",
81 .id = 1,
82 .num_resources = ARRAY_SIZE(s5pc100_iis1_resource),
83 .resource = s5pc100_iis1_resource,
84 .dev = {
85 .platform_data = &i2sv3_pdata,
86 },
87};
88
89static struct resource s5pc100_iis2_resource[] = {
90 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S2, SZ_256),
91 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
92 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
93};
94
95struct platform_device s5pc100_device_iis2 = {
96 .name = "samsung-i2s",
97 .id = 2,
98 .num_resources = ARRAY_SIZE(s5pc100_iis2_resource),
99 .resource = s5pc100_iis2_resource,
100 .dev = {
101 .platform_data = &i2sv3_pdata,
102 },
103};
104
105/* PCM Controller platform_devices */
106
107static int s5pc100_pcm_cfg_gpio(struct platform_device *pdev)
108{
109 switch (pdev->id) {
110 case 0:
111 s3c_gpio_cfgpin_range(S5PC100_GPG3(0), 5, S3C_GPIO_SFN(5));
112 break;
113
114 case 1:
115 s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(3));
116 break;
117
118 default:
119 printk(KERN_DEBUG "Invalid PCM Controller number!");
120 return -EINVAL;
121 }
122
123 return 0;
124}
125
126static struct s3c_audio_pdata s3c_pcm_pdata = {
127 .cfg_gpio = s5pc100_pcm_cfg_gpio,
128};
129
130static struct resource s5pc100_pcm0_resource[] = {
131 [0] = DEFINE_RES_MEM(S5PC100_PA_PCM0, SZ_256),
132 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
133 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
134};
135
136struct platform_device s5pc100_device_pcm0 = {
137 .name = "samsung-pcm",
138 .id = 0,
139 .num_resources = ARRAY_SIZE(s5pc100_pcm0_resource),
140 .resource = s5pc100_pcm0_resource,
141 .dev = {
142 .platform_data = &s3c_pcm_pdata,
143 },
144};
145
146static struct resource s5pc100_pcm1_resource[] = {
147 [0] = DEFINE_RES_MEM(S5PC100_PA_PCM1, SZ_256),
148 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
149 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
150};
151
152struct platform_device s5pc100_device_pcm1 = {
153 .name = "samsung-pcm",
154 .id = 1,
155 .num_resources = ARRAY_SIZE(s5pc100_pcm1_resource),
156 .resource = s5pc100_pcm1_resource,
157 .dev = {
158 .platform_data = &s3c_pcm_pdata,
159 },
160};
161
162/* AC97 Controller platform devices */
163
164static int s5pc100_ac97_cfg_gpio(struct platform_device *pdev)
165{
166 return s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(4));
167}
168
169static struct resource s5pc100_ac97_resource[] = {
170 [0] = DEFINE_RES_MEM(S5PC100_PA_AC97, SZ_256),
171 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
172 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
173 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
174 [4] = DEFINE_RES_IRQ(IRQ_AC97),
175};
176
177static struct s3c_audio_pdata s3c_ac97_pdata = {
178 .cfg_gpio = s5pc100_ac97_cfg_gpio,
179};
180
181static u64 s5pc100_ac97_dmamask = DMA_BIT_MASK(32);
182
183struct platform_device s5pc100_device_ac97 = {
184 .name = "samsung-ac97",
185 .id = -1,
186 .num_resources = ARRAY_SIZE(s5pc100_ac97_resource),
187 .resource = s5pc100_ac97_resource,
188 .dev = {
189 .platform_data = &s3c_ac97_pdata,
190 .dma_mask = &s5pc100_ac97_dmamask,
191 .coherent_dma_mask = DMA_BIT_MASK(32),
192 },
193};
194
195/* S/PDIF Controller platform_device */
196static int s5pc100_spdif_cfg_gpd(struct platform_device *pdev)
197{
198 s3c_gpio_cfgpin_range(S5PC100_GPD(5), 2, S3C_GPIO_SFN(3));
199
200 return 0;
201}
202
203static int s5pc100_spdif_cfg_gpg3(struct platform_device *pdev)
204{
205 s3c_gpio_cfgpin_range(S5PC100_GPG3(5), 2, S3C_GPIO_SFN(3));
206
207 return 0;
208}
209
210static struct resource s5pc100_spdif_resource[] = {
211 [0] = DEFINE_RES_MEM(S5PC100_PA_SPDIF, SZ_256),
212 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
213};
214
215static struct s3c_audio_pdata s5p_spdif_pdata = {
216 .cfg_gpio = s5pc100_spdif_cfg_gpd,
217};
218
219static u64 s5pc100_spdif_dmamask = DMA_BIT_MASK(32);
220
221struct platform_device s5pc100_device_spdif = {
222 .name = "samsung-spdif",
223 .id = -1,
224 .num_resources = ARRAY_SIZE(s5pc100_spdif_resource),
225 .resource = s5pc100_spdif_resource,
226 .dev = {
227 .platform_data = &s5p_spdif_pdata,
228 .dma_mask = &s5pc100_spdif_dmamask,
229 .coherent_dma_mask = DMA_BIT_MASK(32),
230 },
231};
232
233void __init s5pc100_spdif_setup_gpio(int gpio)
234{
235 if (gpio == S5PC100_SPDIF_GPD)
236 s5p_spdif_pdata.cfg_gpio = s5pc100_spdif_cfg_gpd;
237 else
238 s5p_spdif_pdata.cfg_gpio = s5pc100_spdif_cfg_gpg3;
239}
diff --git a/arch/arm/mach-s5pc100/dma.c b/arch/arm/mach-s5pc100/dma.c
deleted file mode 100644
index b1418409709e..000000000000
--- a/arch/arm/mach-s5pc100/dma.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/dma.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License 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., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#include <linux/dma-mapping.h>
25#include <linux/amba/bus.h>
26#include <linux/amba/pl330.h>
27
28#include <asm/irq.h>
29#include <plat/devs.h>
30#include <plat/irqs.h>
31
32#include <mach/map.h>
33#include <mach/irqs.h>
34#include <mach/dma.h>
35
36static u8 pdma0_peri[] = {
37 DMACH_UART0_RX,
38 DMACH_UART0_TX,
39 DMACH_UART1_RX,
40 DMACH_UART1_TX,
41 DMACH_UART2_RX,
42 DMACH_UART2_TX,
43 DMACH_UART3_RX,
44 DMACH_UART3_TX,
45 DMACH_IRDA,
46 DMACH_I2S0_RX,
47 DMACH_I2S0_TX,
48 DMACH_I2S0S_TX,
49 DMACH_I2S1_RX,
50 DMACH_I2S1_TX,
51 DMACH_I2S2_RX,
52 DMACH_I2S2_TX,
53 DMACH_SPI0_RX,
54 DMACH_SPI0_TX,
55 DMACH_SPI1_RX,
56 DMACH_SPI1_TX,
57 DMACH_SPI2_RX,
58 DMACH_SPI2_TX,
59 DMACH_AC97_MICIN,
60 DMACH_AC97_PCMIN,
61 DMACH_AC97_PCMOUT,
62 DMACH_EXTERNAL,
63 DMACH_PWM,
64 DMACH_SPDIF,
65 DMACH_HSI_RX,
66 DMACH_HSI_TX,
67};
68
69static struct dma_pl330_platdata s5pc100_pdma0_pdata = {
70 .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
71 .peri_id = pdma0_peri,
72};
73
74static AMBA_AHB_DEVICE(s5pc100_pdma0, "dma-pl330.0", 0x00041330,
75 S5PC100_PA_PDMA0, {IRQ_PDMA0}, &s5pc100_pdma0_pdata);
76
77static u8 pdma1_peri[] = {
78 DMACH_UART0_RX,
79 DMACH_UART0_TX,
80 DMACH_UART1_RX,
81 DMACH_UART1_TX,
82 DMACH_UART2_RX,
83 DMACH_UART2_TX,
84 DMACH_UART3_RX,
85 DMACH_UART3_TX,
86 DMACH_IRDA,
87 DMACH_I2S0_RX,
88 DMACH_I2S0_TX,
89 DMACH_I2S0S_TX,
90 DMACH_I2S1_RX,
91 DMACH_I2S1_TX,
92 DMACH_I2S2_RX,
93 DMACH_I2S2_TX,
94 DMACH_SPI0_RX,
95 DMACH_SPI0_TX,
96 DMACH_SPI1_RX,
97 DMACH_SPI1_TX,
98 DMACH_SPI2_RX,
99 DMACH_SPI2_TX,
100 DMACH_PCM0_RX,
101 DMACH_PCM0_TX,
102 DMACH_PCM1_RX,
103 DMACH_PCM1_TX,
104 DMACH_MSM_REQ0,
105 DMACH_MSM_REQ1,
106 DMACH_MSM_REQ2,
107 DMACH_MSM_REQ3,
108};
109
110static struct dma_pl330_platdata s5pc100_pdma1_pdata = {
111 .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
112 .peri_id = pdma1_peri,
113};
114
115static AMBA_AHB_DEVICE(s5pc100_pdma1, "dma-pl330.1", 0x00041330,
116 S5PC100_PA_PDMA1, {IRQ_PDMA1}, &s5pc100_pdma1_pdata);
117
118static int __init s5pc100_dma_init(void)
119{
120 dma_cap_set(DMA_SLAVE, s5pc100_pdma0_pdata.cap_mask);
121 dma_cap_set(DMA_CYCLIC, s5pc100_pdma0_pdata.cap_mask);
122 amba_device_register(&s5pc100_pdma0_device, &iomem_resource);
123
124 dma_cap_set(DMA_SLAVE, s5pc100_pdma1_pdata.cap_mask);
125 dma_cap_set(DMA_CYCLIC, s5pc100_pdma1_pdata.cap_mask);
126 amba_device_register(&s5pc100_pdma1_device, &iomem_resource);
127
128 return 0;
129}
130arch_initcall(s5pc100_dma_init);
diff --git a/arch/arm/mach-s5pc100/include/mach/debug-macro.S b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
deleted file mode 100644
index 22c23859e45e..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/debug-macro.S
+++ /dev/null
@@ -1,39 +0,0 @@
1/* arch/arm/mach-s5pc100/include/mach/debug-macro.S
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 *
7 * Based on mach-s3c6400/include/mach/debug-macro.S
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/* pull in the relevant register and map files. */
15
16#include <linux/serial_s3c.h>
17#include <mach/map.h>
18
19 /* note, for the boot process to work we have to keep the UART
20 * virtual address aligned to an 1MiB boundary for the L1
21 * mapping the head code makes. We keep the UART virtual address
22 * aligned and add in the offset when we load the value here.
23 */
24
25 .macro addruart, rp, rv, tmp
26 ldr \rp, = S3C_PA_UART
27 ldr \rv, = S3C_VA_UART
28#if CONFIG_DEBUG_S3C_UART != 0
29 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
30 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
31#endif
32 .endm
33
34/* include the reset of the code which will do the work, we're only
35 * compiling for a single cpu processor type so the default of s3c2440
36 * will be fine with us.
37 */
38
39#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5pc100/include/mach/dma.h b/arch/arm/mach-s5pc100/include/mach/dma.h
deleted file mode 100644
index 201842a3769e..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/dma.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
3 * Jaswinder Singh <jassi.brar@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef __MACH_DMA_H
21#define __MACH_DMA_H
22
23/* This platform uses the common DMA API driver for PL330 */
24#include <plat/dma-pl330.h>
25
26#endif /* __MACH_DMA_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/entry-macro.S b/arch/arm/mach-s5pc100/include/mach/entry-macro.S
deleted file mode 100644
index bad0700457db..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/entry-macro.S
+++ /dev/null
@@ -1,19 +0,0 @@
1/* arch/arm/mach-s5pc100/include/mach/entry-macro.S
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Based on mach-s3c6400/include/mach/entry-macro.S
7 *
8 * Low-level IRQ helper macros for the Samsung S5PC1XX series
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13*/
14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
19 .endm
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio.h b/arch/arm/mach-s5pc100/include/mach/gpio.h
deleted file mode 100644
index 5e1a924b595f..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/gpio.h
+++ /dev/null
@@ -1,144 +0,0 @@
1/* arch/arm/mach-s5pc100/include/mach/gpio.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - GPIO lib support
7 *
8 * Base on mach-s3c6400/include/mach/gpio.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_GPIO_H
16#define __ASM_ARCH_GPIO_H __FILE__
17
18/* GPIO bank sizes */
19#define S5PC100_GPIO_A0_NR (8)
20#define S5PC100_GPIO_A1_NR (5)
21#define S5PC100_GPIO_B_NR (8)
22#define S5PC100_GPIO_C_NR (5)
23#define S5PC100_GPIO_D_NR (7)
24#define S5PC100_GPIO_E0_NR (8)
25#define S5PC100_GPIO_E1_NR (6)
26#define S5PC100_GPIO_F0_NR (8)
27#define S5PC100_GPIO_F1_NR (8)
28#define S5PC100_GPIO_F2_NR (8)
29#define S5PC100_GPIO_F3_NR (4)
30#define S5PC100_GPIO_G0_NR (8)
31#define S5PC100_GPIO_G1_NR (3)
32#define S5PC100_GPIO_G2_NR (7)
33#define S5PC100_GPIO_G3_NR (7)
34#define S5PC100_GPIO_H0_NR (8)
35#define S5PC100_GPIO_H1_NR (8)
36#define S5PC100_GPIO_H2_NR (8)
37#define S5PC100_GPIO_H3_NR (8)
38#define S5PC100_GPIO_I_NR (8)
39#define S5PC100_GPIO_J0_NR (8)
40#define S5PC100_GPIO_J1_NR (5)
41#define S5PC100_GPIO_J2_NR (8)
42#define S5PC100_GPIO_J3_NR (8)
43#define S5PC100_GPIO_J4_NR (4)
44#define S5PC100_GPIO_K0_NR (8)
45#define S5PC100_GPIO_K1_NR (6)
46#define S5PC100_GPIO_K2_NR (8)
47#define S5PC100_GPIO_K3_NR (8)
48#define S5PC100_GPIO_L0_NR (8)
49#define S5PC100_GPIO_L1_NR (8)
50#define S5PC100_GPIO_L2_NR (8)
51#define S5PC100_GPIO_L3_NR (8)
52#define S5PC100_GPIO_L4_NR (8)
53
54/* GPIO bank numbes */
55
56/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
57 * space for debugging purposes so that any accidental
58 * change from one gpio bank to another can be caught.
59*/
60
61#define S5PC100_GPIO_NEXT(__gpio) \
62 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
63
64enum s5p_gpio_number {
65 S5PC100_GPIO_A0_START = 0,
66 S5PC100_GPIO_A1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_A0),
67 S5PC100_GPIO_B_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_A1),
68 S5PC100_GPIO_C_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_B),
69 S5PC100_GPIO_D_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_C),
70 S5PC100_GPIO_E0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_D),
71 S5PC100_GPIO_E1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_E0),
72 S5PC100_GPIO_F0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_E1),
73 S5PC100_GPIO_F1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F0),
74 S5PC100_GPIO_F2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F1),
75 S5PC100_GPIO_F3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F2),
76 S5PC100_GPIO_G0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F3),
77 S5PC100_GPIO_G1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G0),
78 S5PC100_GPIO_G2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G1),
79 S5PC100_GPIO_G3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G2),
80 S5PC100_GPIO_H0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G3),
81 S5PC100_GPIO_H1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H0),
82 S5PC100_GPIO_H2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H1),
83 S5PC100_GPIO_H3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H2),
84 S5PC100_GPIO_I_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H3),
85 S5PC100_GPIO_J0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_I),
86 S5PC100_GPIO_J1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J0),
87 S5PC100_GPIO_J2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J1),
88 S5PC100_GPIO_J3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J2),
89 S5PC100_GPIO_J4_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J3),
90 S5PC100_GPIO_K0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J4),
91 S5PC100_GPIO_K1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K0),
92 S5PC100_GPIO_K2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K1),
93 S5PC100_GPIO_K3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K2),
94 S5PC100_GPIO_L0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K3),
95 S5PC100_GPIO_L1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L0),
96 S5PC100_GPIO_L2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L1),
97 S5PC100_GPIO_L3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L2),
98 S5PC100_GPIO_L4_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L3),
99 S5PC100_GPIO_END = S5PC100_GPIO_NEXT(S5PC100_GPIO_L4),
100};
101
102/* S5PC100 GPIO number definitions. */
103#define S5PC100_GPA0(_nr) (S5PC100_GPIO_A0_START + (_nr))
104#define S5PC100_GPA1(_nr) (S5PC100_GPIO_A1_START + (_nr))
105#define S5PC100_GPB(_nr) (S5PC100_GPIO_B_START + (_nr))
106#define S5PC100_GPC(_nr) (S5PC100_GPIO_C_START + (_nr))
107#define S5PC100_GPD(_nr) (S5PC100_GPIO_D_START + (_nr))
108#define S5PC100_GPE0(_nr) (S5PC100_GPIO_E0_START + (_nr))
109#define S5PC100_GPE1(_nr) (S5PC100_GPIO_E1_START + (_nr))
110#define S5PC100_GPF0(_nr) (S5PC100_GPIO_F0_START + (_nr))
111#define S5PC100_GPF1(_nr) (S5PC100_GPIO_F1_START + (_nr))
112#define S5PC100_GPF2(_nr) (S5PC100_GPIO_F2_START + (_nr))
113#define S5PC100_GPF3(_nr) (S5PC100_GPIO_F3_START + (_nr))
114#define S5PC100_GPG0(_nr) (S5PC100_GPIO_G0_START + (_nr))
115#define S5PC100_GPG1(_nr) (S5PC100_GPIO_G1_START + (_nr))
116#define S5PC100_GPG2(_nr) (S5PC100_GPIO_G2_START + (_nr))
117#define S5PC100_GPG3(_nr) (S5PC100_GPIO_G3_START + (_nr))
118#define S5PC100_GPH0(_nr) (S5PC100_GPIO_H0_START + (_nr))
119#define S5PC100_GPH1(_nr) (S5PC100_GPIO_H1_START + (_nr))
120#define S5PC100_GPH2(_nr) (S5PC100_GPIO_H2_START + (_nr))
121#define S5PC100_GPH3(_nr) (S5PC100_GPIO_H3_START + (_nr))
122#define S5PC100_GPI(_nr) (S5PC100_GPIO_I_START + (_nr))
123#define S5PC100_GPJ0(_nr) (S5PC100_GPIO_J0_START + (_nr))
124#define S5PC100_GPJ1(_nr) (S5PC100_GPIO_J1_START + (_nr))
125#define S5PC100_GPJ2(_nr) (S5PC100_GPIO_J2_START + (_nr))
126#define S5PC100_GPJ3(_nr) (S5PC100_GPIO_J3_START + (_nr))
127#define S5PC100_GPJ4(_nr) (S5PC100_GPIO_J4_START + (_nr))
128#define S5PC100_GPK0(_nr) (S5PC100_GPIO_K0_START + (_nr))
129#define S5PC100_GPK1(_nr) (S5PC100_GPIO_K1_START + (_nr))
130#define S5PC100_GPK2(_nr) (S5PC100_GPIO_K2_START + (_nr))
131#define S5PC100_GPK3(_nr) (S5PC100_GPIO_K3_START + (_nr))
132#define S5PC100_GPL0(_nr) (S5PC100_GPIO_L0_START + (_nr))
133#define S5PC100_GPL1(_nr) (S5PC100_GPIO_L1_START + (_nr))
134#define S5PC100_GPL2(_nr) (S5PC100_GPIO_L2_START + (_nr))
135#define S5PC100_GPL3(_nr) (S5PC100_GPIO_L3_START + (_nr))
136#define S5PC100_GPL4(_nr) (S5PC100_GPIO_L4_START + (_nr))
137
138/* It used the end of the S5PC100 gpios */
139#define S3C_GPIO_END S5PC100_GPIO_END
140
141/* define the number of gpios we need to the one after the MP04() range */
142#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1)
143
144#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/hardware.h b/arch/arm/mach-s5pc100/include/mach/hardware.h
deleted file mode 100644
index 6b38618c2fd9..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/hardware.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/hardware.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - Hardware support
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H __FILE__
11
12/* currently nothing here, placeholder */
13
14#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/irqs.h b/arch/arm/mach-s5pc100/include/mach/irqs.h
deleted file mode 100644
index d2eb4757381f..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/irqs.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/irqs.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - IRQ definitions
7 */
8
9#ifndef __ASM_ARCH_IRQS_H
10#define __ASM_ARCH_IRQS_H __FILE__
11
12#include <plat/irqs.h>
13
14/* VIC0: system, DMA, timer */
15#define IRQ_EINT16_31 S5P_IRQ_VIC0(16)
16#define IRQ_BATF S5P_IRQ_VIC0(17)
17#define IRQ_MDMA S5P_IRQ_VIC0(18)
18#define IRQ_PDMA0 S5P_IRQ_VIC0(19)
19#define IRQ_PDMA1 S5P_IRQ_VIC0(20)
20#define IRQ_TIMER0_VIC S5P_IRQ_VIC0(21)
21#define IRQ_TIMER1_VIC S5P_IRQ_VIC0(22)
22#define IRQ_TIMER2_VIC S5P_IRQ_VIC0(23)
23#define IRQ_TIMER3_VIC S5P_IRQ_VIC0(24)
24#define IRQ_TIMER4_VIC S5P_IRQ_VIC0(25)
25#define IRQ_SYSTIMER S5P_IRQ_VIC0(26)
26#define IRQ_WDT S5P_IRQ_VIC0(27)
27#define IRQ_RTC_ALARM S5P_IRQ_VIC0(28)
28#define IRQ_RTC_TIC S5P_IRQ_VIC0(29)
29#define IRQ_GPIOINT S5P_IRQ_VIC0(30)
30
31/* VIC1: ARM, power, memory, connectivity */
32#define IRQ_PMU S5P_IRQ_VIC1(0)
33#define IRQ_CORTEX1 S5P_IRQ_VIC1(1)
34#define IRQ_CORTEX2 S5P_IRQ_VIC1(2)
35#define IRQ_CORTEX3 S5P_IRQ_VIC1(3)
36#define IRQ_CORTEX4 S5P_IRQ_VIC1(4)
37#define IRQ_IEMAPC S5P_IRQ_VIC1(5)
38#define IRQ_IEMIEC S5P_IRQ_VIC1(6)
39#define IRQ_ONENAND S5P_IRQ_VIC1(7)
40#define IRQ_NFC S5P_IRQ_VIC1(8)
41#define IRQ_CFCON S5P_IRQ_VIC1(9)
42#define IRQ_UART0 S5P_IRQ_VIC1(10)
43#define IRQ_UART1 S5P_IRQ_VIC1(11)
44#define IRQ_UART2 S5P_IRQ_VIC1(12)
45#define IRQ_UART3 S5P_IRQ_VIC1(13)
46#define IRQ_IIC S5P_IRQ_VIC1(14)
47#define IRQ_SPI0 S5P_IRQ_VIC1(15)
48#define IRQ_SPI1 S5P_IRQ_VIC1(16)
49#define IRQ_SPI2 S5P_IRQ_VIC1(17)
50#define IRQ_IRDA S5P_IRQ_VIC1(18)
51#define IRQ_IIC2 S5P_IRQ_VIC1(19)
52#define IRQ_IIC3 S5P_IRQ_VIC1(20)
53#define IRQ_HSIRX S5P_IRQ_VIC1(21)
54#define IRQ_HSITX S5P_IRQ_VIC1(22)
55#define IRQ_UHOST S5P_IRQ_VIC1(23)
56#define IRQ_OTG S5P_IRQ_VIC1(24)
57#define IRQ_MSM S5P_IRQ_VIC1(25)
58#define IRQ_HSMMC0 S5P_IRQ_VIC1(26)
59#define IRQ_HSMMC1 S5P_IRQ_VIC1(27)
60#define IRQ_HSMMC2 S5P_IRQ_VIC1(28)
61#define IRQ_MIPICSI S5P_IRQ_VIC1(29)
62#define IRQ_MIPIDSI S5P_IRQ_VIC1(30)
63
64/* VIC2: multimedia, audio, security */
65#define IRQ_LCD0 S5P_IRQ_VIC2(0)
66#define IRQ_LCD1 S5P_IRQ_VIC2(1)
67#define IRQ_LCD2 S5P_IRQ_VIC2(2)
68#define IRQ_LCD3 S5P_IRQ_VIC2(3)
69#define IRQ_ROTATOR S5P_IRQ_VIC2(4)
70#define IRQ_FIMC0 S5P_IRQ_VIC2(5)
71#define IRQ_FIMC1 S5P_IRQ_VIC2(6)
72#define IRQ_FIMC2 S5P_IRQ_VIC2(7)
73#define IRQ_JPEG S5P_IRQ_VIC2(8)
74#define IRQ_2D S5P_IRQ_VIC2(9)
75#define IRQ_3D S5P_IRQ_VIC2(10)
76#define IRQ_MIXER S5P_IRQ_VIC2(11)
77#define IRQ_HDMI S5P_IRQ_VIC2(12)
78#define IRQ_IIC1 S5P_IRQ_VIC2(13)
79#define IRQ_MFC S5P_IRQ_VIC2(14)
80#define IRQ_TVENC S5P_IRQ_VIC2(15)
81#define IRQ_I2S0 S5P_IRQ_VIC2(16)
82#define IRQ_I2S1 S5P_IRQ_VIC2(17)
83#define IRQ_I2S2 S5P_IRQ_VIC2(18)
84#define IRQ_AC97 S5P_IRQ_VIC2(19)
85#define IRQ_PCM0 S5P_IRQ_VIC2(20)
86#define IRQ_PCM1 S5P_IRQ_VIC2(21)
87#define IRQ_SPDIF S5P_IRQ_VIC2(22)
88#define IRQ_ADC S5P_IRQ_VIC2(23)
89#define IRQ_PENDN S5P_IRQ_VIC2(24)
90#define IRQ_TC IRQ_PENDN
91#define IRQ_KEYPAD S5P_IRQ_VIC2(25)
92#define IRQ_CG S5P_IRQ_VIC2(26)
93#define IRQ_SEC S5P_IRQ_VIC2(27)
94#define IRQ_SECRX S5P_IRQ_VIC2(28)
95#define IRQ_SECTX S5P_IRQ_VIC2(29)
96#define IRQ_SDMIRQ S5P_IRQ_VIC2(30)
97#define IRQ_SDMFIQ S5P_IRQ_VIC2(31)
98#define IRQ_VIC_END S5P_IRQ_VIC2(31)
99
100#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
101#define S5P_EINT_BASE2 (IRQ_VIC_END + 1)
102
103/* GPIO interrupt */
104#define S5P_GPIOINT_BASE (IRQ_EINT(31) + 1)
105#define S5P_GPIOINT_GROUP_MAXNR 21
106
107/* Set the default NR_IRQS */
108#define NR_IRQS (IRQ_EINT(31) + S5P_GPIOINT_COUNT + 1)
109
110/* Compatibility */
111#define IRQ_LCD_FIFO IRQ_LCD0
112#define IRQ_LCD_VSYNC IRQ_LCD1
113#define IRQ_LCD_SYSTEM IRQ_LCD2
114
115#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
deleted file mode 100644
index 2550b6112b82..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/map.h
+++ /dev/null
@@ -1,137 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/map.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Copyright 2009 Samsung Electronics Co.
7 * Byungho Min <bhmin@samsung.com>
8 *
9 * S5PC100 - Memory map definitions
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#ifndef __ASM_ARCH_MAP_H
17#define __ASM_ARCH_MAP_H __FILE__
18
19#include <plat/map-base.h>
20#include <plat/map-s5p.h>
21
22#define S5PC100_PA_SDRAM 0x20000000
23
24#define S5PC100_PA_ONENAND 0xE7100000
25#define S5PC100_PA_ONENAND_BUF 0xB0000000
26
27#define S5PC100_PA_CHIPID 0xE0000000
28
29#define S5PC100_PA_SYSCON 0xE0100000
30
31#define S5PC100_PA_OTHERS 0xE0200000
32
33#define S5PC100_PA_GPIO 0xE0300000
34
35#define S5PC100_PA_VIC0 0xE4000000
36#define S5PC100_PA_VIC1 0xE4100000
37#define S5PC100_PA_VIC2 0xE4200000
38
39#define S5PC100_PA_SROMC 0xE7000000
40
41#define S5PC100_PA_CFCON 0xE7800000
42
43#define S5PC100_PA_MDMA 0xE8100000
44#define S5PC100_PA_PDMA0 0xE9000000
45#define S5PC100_PA_PDMA1 0xE9200000
46
47#define S5PC100_PA_TIMER 0xEA000000
48#define S5PC100_PA_SYSTIMER 0xEA100000
49#define S5PC100_PA_WATCHDOG 0xEA200000
50#define S5PC100_PA_RTC 0xEA300000
51
52#define S5PC100_PA_UART 0xEC000000
53
54#define S5PC100_PA_IIC0 0xEC100000
55#define S5PC100_PA_IIC1 0xEC200000
56
57#define S5PC100_PA_SPI0 0xEC300000
58#define S5PC100_PA_SPI1 0xEC400000
59#define S5PC100_PA_SPI2 0xEC500000
60
61#define S5PC100_PA_USB_HSOTG 0xED200000
62#define S5PC100_PA_USB_HSPHY 0xED300000
63
64#define S5PC100_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
65
66#define S5PC100_PA_FB 0xEE000000
67
68#define S5PC100_PA_FIMC0 0xEE200000
69#define S5PC100_PA_FIMC1 0xEE300000
70#define S5PC100_PA_FIMC2 0xEE400000
71
72#define S5PC100_PA_I2S0 0xF2000000
73#define S5PC100_PA_I2S1 0xF2100000
74#define S5PC100_PA_I2S2 0xF2200000
75
76#define S5PC100_PA_AC97 0xF2300000
77
78#define S5PC100_PA_PCM0 0xF2400000
79#define S5PC100_PA_PCM1 0xF2500000
80
81#define S5PC100_PA_SPDIF 0xF2600000
82
83#define S5PC100_PA_TSADC 0xF3000000
84
85#define S5PC100_PA_KEYPAD 0xF3100000
86
87/* Compatibiltiy Defines */
88
89#define S3C_PA_FB S5PC100_PA_FB
90#define S3C_PA_HSMMC0 S5PC100_PA_HSMMC(0)
91#define S3C_PA_HSMMC1 S5PC100_PA_HSMMC(1)
92#define S3C_PA_HSMMC2 S5PC100_PA_HSMMC(2)
93#define S3C_PA_IIC S5PC100_PA_IIC0
94#define S3C_PA_IIC1 S5PC100_PA_IIC1
95#define S3C_PA_KEYPAD S5PC100_PA_KEYPAD
96#define S3C_PA_ONENAND S5PC100_PA_ONENAND
97#define S3C_PA_ONENAND_BUF S5PC100_PA_ONENAND_BUF
98#define S3C_PA_RTC S5PC100_PA_RTC
99#define S3C_PA_TSADC S5PC100_PA_TSADC
100#define S3C_PA_USB_HSOTG S5PC100_PA_USB_HSOTG
101#define S3C_PA_USB_HSPHY S5PC100_PA_USB_HSPHY
102#define S3C_PA_WDT S5PC100_PA_WATCHDOG
103#define S3C_PA_SPI0 S5PC100_PA_SPI0
104#define S3C_PA_SPI1 S5PC100_PA_SPI1
105#define S3C_PA_SPI2 S5PC100_PA_SPI2
106
107#define S5P_PA_CHIPID S5PC100_PA_CHIPID
108#define S5P_PA_FIMC0 S5PC100_PA_FIMC0
109#define S5P_PA_FIMC1 S5PC100_PA_FIMC1
110#define S5P_PA_FIMC2 S5PC100_PA_FIMC2
111#define S5P_PA_SDRAM S5PC100_PA_SDRAM
112#define S5P_PA_SROMC S5PC100_PA_SROMC
113#define S5P_PA_SYSCON S5PC100_PA_SYSCON
114#define S5P_PA_TIMER S5PC100_PA_TIMER
115
116#define SAMSUNG_PA_ADC S5PC100_PA_TSADC
117#define SAMSUNG_PA_CFCON S5PC100_PA_CFCON
118#define SAMSUNG_PA_KEYPAD S5PC100_PA_KEYPAD
119#define SAMSUNG_PA_TIMER S5PC100_PA_TIMER
120
121#define S5PC100_VA_OTHERS (S3C_VA_SYS + 0x10000)
122
123#define S3C_SZ_ONENAND_BUF (SZ_256M - SZ_32M)
124
125/* UART */
126
127#define S3C_PA_UART S5PC100_PA_UART
128
129#define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET))
130#define S5P_PA_UART0 S5P_PA_UART(0)
131#define S5P_PA_UART1 S5P_PA_UART(1)
132#define S5P_PA_UART2 S5P_PA_UART(2)
133#define S5P_PA_UART3 S5P_PA_UART(3)
134
135#define S5P_SZ_UART SZ_256
136
137#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-clock.h b/arch/arm/mach-s5pc100/include/mach/regs-clock.h
deleted file mode 100644
index bc92da2e0ba2..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/regs-clock.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PC100 - Clock register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_CLOCK_H
14#define __ASM_ARCH_REGS_CLOCK_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_CLKREG(x) (S3C_VA_SYS + (x))
19
20#define S5PC100_REG_OTHERS(x) (S5PC100_VA_OTHERS + (x))
21
22#define S5P_APLL_LOCK S5P_CLKREG(0x00)
23#define S5P_MPLL_LOCK S5P_CLKREG(0x04)
24#define S5P_EPLL_LOCK S5P_CLKREG(0x08)
25#define S5P_HPLL_LOCK S5P_CLKREG(0x0C)
26
27#define S5P_APLL_CON S5P_CLKREG(0x100)
28#define S5P_MPLL_CON S5P_CLKREG(0x104)
29#define S5P_EPLL_CON S5P_CLKREG(0x108)
30#define S5P_HPLL_CON S5P_CLKREG(0x10C)
31
32#define S5P_CLK_SRC0 S5P_CLKREG(0x200)
33#define S5P_CLK_SRC1 S5P_CLKREG(0x204)
34#define S5P_CLK_SRC2 S5P_CLKREG(0x208)
35#define S5P_CLK_SRC3 S5P_CLKREG(0x20C)
36
37#define S5P_CLK_DIV0 S5P_CLKREG(0x300)
38#define S5P_CLK_DIV1 S5P_CLKREG(0x304)
39#define S5P_CLK_DIV2 S5P_CLKREG(0x308)
40#define S5P_CLK_DIV3 S5P_CLKREG(0x30C)
41#define S5P_CLK_DIV4 S5P_CLKREG(0x310)
42
43#define S5P_CLK_OUT S5P_CLKREG(0x400)
44
45#define S5P_CLKGATE_D00 S5P_CLKREG(0x500)
46#define S5P_CLKGATE_D01 S5P_CLKREG(0x504)
47#define S5P_CLKGATE_D02 S5P_CLKREG(0x508)
48
49#define S5P_CLKGATE_D10 S5P_CLKREG(0x520)
50#define S5P_CLKGATE_D11 S5P_CLKREG(0x524)
51#define S5P_CLKGATE_D12 S5P_CLKREG(0x528)
52#define S5P_CLKGATE_D13 S5P_CLKREG(0x52C)
53#define S5P_CLKGATE_D14 S5P_CLKREG(0x530)
54#define S5P_CLKGATE_D15 S5P_CLKREG(0x534)
55
56#define S5P_CLKGATE_D20 S5P_CLKREG(0x540)
57
58#define S5P_CLKGATE_SCLK0 S5P_CLKREG(0x560)
59#define S5P_CLKGATE_SCLK1 S5P_CLKREG(0x564)
60
61/* CLKDIV0 */
62#define S5P_CLKDIV0_D0_MASK (0x7<<8)
63#define S5P_CLKDIV0_D0_SHIFT (8)
64#define S5P_CLKDIV0_PCLKD0_MASK (0x7<<12)
65#define S5P_CLKDIV0_PCLKD0_SHIFT (12)
66
67/* CLKDIV1 */
68#define S5P_CLKDIV1_D1_MASK (0x7<<12)
69#define S5P_CLKDIV1_D1_SHIFT (12)
70#define S5P_CLKDIV1_PCLKD1_MASK (0x7<<16)
71#define S5P_CLKDIV1_PCLKD1_SHIFT (16)
72
73#define S5PC100_SWRESET S5PC100_REG_OTHERS(0x000)
74#define S5PC100_MEM_SYS_CFG S5PC100_REG_OTHERS(0x200)
75
76#define S5PC100_SWRESET_RESETVAL 0xc100
77
78#define MEM_SYS_CFG_EBI_FIX_PRI_CFCON 0x30
79
80#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-gpio.h b/arch/arm/mach-s5pc100/include/mach/regs-gpio.h
deleted file mode 100644
index 0bf73209ec7b..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/regs-gpio.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/plat-s5pc100/include/plat/regs-gpio.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - GPIO register definitions
7 */
8
9#ifndef __ASM_MACH_S5PC100_REGS_GPIO_H
10#define __ASM_MACH_S5PC100_REGS_GPIO_H __FILE__
11
12#include <mach/map.h>
13
14#define S5PC100EINT30CON (S5P_VA_GPIO + 0xE00)
15#define S5P_EINT_CON(x) (S5PC100EINT30CON + ((x) * 0x4))
16
17#define S5PC100EINT30FLTCON0 (S5P_VA_GPIO + 0xE80)
18#define S5P_EINT_FLTCON(x) (S5PC100EINT30FLTCON0 + ((x) * 0x4))
19
20#define S5PC100EINT30MASK (S5P_VA_GPIO + 0xF00)
21#define S5P_EINT_MASK(x) (S5PC100EINT30MASK + ((x) * 0x4))
22
23#define S5PC100EINT30PEND (S5P_VA_GPIO + 0xF40)
24#define S5P_EINT_PEND(x) (S5PC100EINT30PEND + ((x) * 0x4))
25
26#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
27
28#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
29
30#define EINT_MODE S3C_GPIO_SFN(0x2)
31
32#define EINT_GPIO_0(x) S5PC100_GPH0(x)
33#define EINT_GPIO_1(x) S5PC100_GPH1(x)
34#define EINT_GPIO_2(x) S5PC100_GPH2(x)
35#define EINT_GPIO_3(x) S5PC100_GPH3(x)
36
37#endif /* __ASM_MACH_S5PC100_REGS_GPIO_H */
38
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-irq.h b/arch/arm/mach-s5pc100/include/mach/regs-irq.h
deleted file mode 100644
index 761627897f30..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/regs-irq.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/regs-irq.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - IRQ register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_IRQ_H
14#define __ASM_ARCH_REGS_IRQ_H __FILE__
15
16#include <mach/map.h>
17
18#endif /* __ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
deleted file mode 100644
index 668af3ac31f3..000000000000
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ /dev/null
@@ -1,264 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/mach-smdkc100.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Author: Byungho Min <bhmin@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10*/
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/init.h>
18#include <linux/serial_core.h>
19#include <linux/serial_s3c.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/gpio.h>
23#include <linux/i2c.h>
24#include <linux/fb.h>
25#include <linux/delay.h>
26#include <linux/input.h>
27#include <linux/pwm_backlight.h>
28
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31
32#include <mach/map.h>
33#include <mach/regs-gpio.h>
34
35#include <video/platform_lcd.h>
36#include <video/samsung_fimd.h>
37
38#include <asm/irq.h>
39#include <asm/mach-types.h>
40
41#include <plat/gpio-cfg.h>
42
43#include <plat/clock.h>
44#include <plat/devs.h>
45#include <plat/cpu.h>
46#include <plat/fb.h>
47#include <linux/platform_data/i2c-s3c2410.h>
48#include <linux/platform_data/ata-samsung_cf.h>
49#include <plat/adc.h>
50#include <plat/keypad.h>
51#include <linux/platform_data/touchscreen-s3c2410.h>
52#include <linux/platform_data/asoc-s3c.h>
53#include <plat/backlight.h>
54#include <plat/samsung-time.h>
55
56#include "common.h"
57
58/* Following are default values for UCON, ULCON and UFCON UART registers */
59#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
60 S3C2410_UCON_RXILEVEL | \
61 S3C2410_UCON_TXIRQMODE | \
62 S3C2410_UCON_RXIRQMODE | \
63 S3C2410_UCON_RXFIFO_TOI | \
64 S3C2443_UCON_RXERR_IRQEN)
65
66#define SMDKC100_ULCON_DEFAULT S3C2410_LCON_CS8
67
68#define SMDKC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
69 S3C2440_UFCON_RXTRIG8 | \
70 S3C2440_UFCON_TXTRIG16)
71
72static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
73 [0] = {
74 .hwport = 0,
75 .flags = 0,
76 .ucon = SMDKC100_UCON_DEFAULT,
77 .ulcon = SMDKC100_ULCON_DEFAULT,
78 .ufcon = SMDKC100_UFCON_DEFAULT,
79 },
80 [1] = {
81 .hwport = 1,
82 .flags = 0,
83 .ucon = SMDKC100_UCON_DEFAULT,
84 .ulcon = SMDKC100_ULCON_DEFAULT,
85 .ufcon = SMDKC100_UFCON_DEFAULT,
86 },
87 [2] = {
88 .hwport = 2,
89 .flags = 0,
90 .ucon = SMDKC100_UCON_DEFAULT,
91 .ulcon = SMDKC100_ULCON_DEFAULT,
92 .ufcon = SMDKC100_UFCON_DEFAULT,
93 },
94 [3] = {
95 .hwport = 3,
96 .flags = 0,
97 .ucon = SMDKC100_UCON_DEFAULT,
98 .ulcon = SMDKC100_ULCON_DEFAULT,
99 .ufcon = SMDKC100_UFCON_DEFAULT,
100 },
101};
102
103/* I2C0 */
104static struct i2c_board_info i2c_devs0[] __initdata = {
105 {I2C_BOARD_INFO("wm8580", 0x1b),},
106};
107
108/* I2C1 */
109static struct i2c_board_info i2c_devs1[] __initdata = {
110};
111
112/* LCD power controller */
113static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
114 unsigned int power)
115{
116 if (power) {
117 /* module reset */
118 gpio_direction_output(S5PC100_GPH0(6), 1);
119 mdelay(100);
120 gpio_direction_output(S5PC100_GPH0(6), 0);
121 mdelay(10);
122 gpio_direction_output(S5PC100_GPH0(6), 1);
123 mdelay(10);
124 }
125}
126
127static struct plat_lcd_data smdkc100_lcd_power_data = {
128 .set_power = smdkc100_lcd_power_set,
129};
130
131static struct platform_device smdkc100_lcd_powerdev = {
132 .name = "platform-lcd",
133 .dev.parent = &s3c_device_fb.dev,
134 .dev.platform_data = &smdkc100_lcd_power_data,
135};
136
137/* Frame Buffer */
138static struct s3c_fb_pd_win smdkc100_fb_win0 = {
139 .max_bpp = 32,
140 .default_bpp = 16,
141 .xres = 800,
142 .yres = 480,
143};
144
145static struct fb_videomode smdkc100_lcd_timing = {
146 .left_margin = 8,
147 .right_margin = 13,
148 .upper_margin = 7,
149 .lower_margin = 5,
150 .hsync_len = 3,
151 .vsync_len = 1,
152 .xres = 800,
153 .yres = 480,
154 .refresh = 80,
155};
156
157static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
158 .win[0] = &smdkc100_fb_win0,
159 .vtiming = &smdkc100_lcd_timing,
160 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
161 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
162 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
163};
164
165static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
166 .setup_gpio = s5pc100_ide_setup_gpio,
167};
168
169static uint32_t smdkc100_keymap[] __initdata = {
170 /* KEY(row, col, keycode) */
171 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
172 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
173 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
174 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
175};
176
177static struct matrix_keymap_data smdkc100_keymap_data __initdata = {
178 .keymap = smdkc100_keymap,
179 .keymap_size = ARRAY_SIZE(smdkc100_keymap),
180};
181
182static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
183 .keymap_data = &smdkc100_keymap_data,
184 .rows = 2,
185 .cols = 8,
186};
187
188static struct platform_device *smdkc100_devices[] __initdata = {
189 &s3c_device_adc,
190 &s3c_device_cfcon,
191 &s3c_device_i2c0,
192 &s3c_device_i2c1,
193 &s3c_device_fb,
194 &s3c_device_hsmmc0,
195 &s3c_device_hsmmc1,
196 &s3c_device_hsmmc2,
197 &samsung_device_pwm,
198 &s3c_device_ts,
199 &s3c_device_wdt,
200 &smdkc100_lcd_powerdev,
201 &s5pc100_device_iis0,
202 &samsung_device_keypad,
203 &s5pc100_device_ac97,
204 &s3c_device_rtc,
205 &s5p_device_fimc0,
206 &s5p_device_fimc1,
207 &s5p_device_fimc2,
208 &s5pc100_device_spdif,
209};
210
211/* LCD Backlight data */
212static struct samsung_bl_gpio_info smdkc100_bl_gpio_info = {
213 .no = S5PC100_GPD(0),
214 .func = S3C_GPIO_SFN(2),
215};
216
217static struct platform_pwm_backlight_data smdkc100_bl_data = {
218 .pwm_id = 0,
219 .enable_gpio = -1,
220};
221
222static void __init smdkc100_map_io(void)
223{
224 s5pc100_init_io(NULL, 0);
225 s3c24xx_init_clocks(12000000);
226 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
227 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
228}
229
230static void __init smdkc100_machine_init(void)
231{
232 s3c24xx_ts_set_platdata(NULL);
233
234 /* I2C */
235 s3c_i2c0_set_platdata(NULL);
236 s3c_i2c1_set_platdata(NULL);
237 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
238 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
239
240 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
241 s3c_ide_set_platdata(&smdkc100_ide_pdata);
242
243 samsung_keypad_set_platdata(&smdkc100_keypad_data);
244
245 s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD);
246
247 /* LCD init */
248 gpio_request(S5PC100_GPH0(6), "GPH0");
249 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
250
251 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
252
253 samsung_bl_set(&smdkc100_bl_gpio_info, &smdkc100_bl_data);
254}
255
256MACHINE_START(SMDKC100, "SMDKC100")
257 /* Maintainer: Byungho Min <bhmin@samsung.com> */
258 .atag_offset = 0x100,
259 .init_irq = s5pc100_init_irq,
260 .map_io = smdkc100_map_io,
261 .init_machine = smdkc100_machine_init,
262 .init_time = samsung_timer_init,
263 .restart = s5pc100_restart,
264MACHINE_END
diff --git a/arch/arm/mach-s5pc100/setup-fb-24bpp.c b/arch/arm/mach-s5pc100/setup-fb-24bpp.c
deleted file mode 100644
index 8978e4cf9ed5..000000000000
--- a/arch/arm/mach-s5pc100/setup-fb-24bpp.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * linux/arch/arm/mach-s5pc100/setup-fb-24bpp.c
3 *
4 * Copyright 2009 Samsung Electronics
5 *
6 * Base S5PC100 setup information for 24bpp LCD framebuffer
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/fb.h>
16#include <linux/gpio.h>
17
18#include <mach/map.h>
19#include <plat/fb.h>
20#include <plat/gpio-cfg.h>
21
22#define DISR_OFFSET 0x7008
23
24static void s5pc100_fb_setgpios(unsigned int base, unsigned int nr)
25{
26 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(2));
27}
28
29void s5pc100_fb_gpio_setup_24bpp(void)
30{
31 s5pc100_fb_setgpios(S5PC100_GPF0(0), 8);
32 s5pc100_fb_setgpios(S5PC100_GPF1(0), 8);
33 s5pc100_fb_setgpios(S5PC100_GPF2(0), 8);
34 s5pc100_fb_setgpios(S5PC100_GPF3(0), 4);
35}
diff --git a/arch/arm/mach-s5pc100/setup-i2c0.c b/arch/arm/mach-s5pc100/setup-i2c0.c
deleted file mode 100644
index 89a6a769d622..000000000000
--- a/arch/arm/mach-s5pc100/setup-i2c0.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-i2c0.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Base S5PC100 I2C bus 0 gpio configuration
7 *
8 * Based on plat-s3c64xx/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17
18struct platform_device; /* don't need the contents */
19
20#include <linux/gpio.h>
21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h>
23
24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
25{
26 s3c_gpio_cfgall_range(S5PC100_GPD(3), 2,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28}
diff --git a/arch/arm/mach-s5pc100/setup-i2c1.c b/arch/arm/mach-s5pc100/setup-i2c1.c
deleted file mode 100644
index faa667ef02cb..000000000000
--- a/arch/arm/mach-s5pc100/setup-i2c1.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-i2c1.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Base S5PC100 I2C bus 1 gpio configuration
7 *
8 * Based on plat-s3c64xx/setup-i2c1.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17
18struct platform_device; /* don't need the contents */
19
20#include <linux/gpio.h>
21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h>
23
24void s3c_i2c1_cfg_gpio(struct platform_device *dev)
25{
26 s3c_gpio_cfgall_range(S5PC100_GPD(5), 2,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28}
diff --git a/arch/arm/mach-s5pc100/setup-ide.c b/arch/arm/mach-s5pc100/setup-ide.c
deleted file mode 100644
index 223aae044466..000000000000
--- a/arch/arm/mach-s5pc100/setup-ide.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-ide.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PC100 setup information for IDE
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/gpio.h>
15#include <linux/io.h>
16
17#include <mach/regs-clock.h>
18#include <plat/gpio-cfg.h>
19
20static void s5pc100_ide_cfg_gpios(unsigned int base, unsigned int nr)
21{
22 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(4));
23
24 for (; nr > 0; nr--, base++)
25 s5p_gpio_set_drvstr(base, S5P_GPIO_DRVSTR_LV4);
26}
27
28void s5pc100_ide_setup_gpio(void)
29{
30 u32 reg;
31
32 /* Independent CF interface, CF chip select configuration */
33 reg = readl(S5PC100_MEM_SYS_CFG) & (~0x3f);
34 writel(reg | MEM_SYS_CFG_EBI_FIX_PRI_CFCON, S5PC100_MEM_SYS_CFG);
35
36 /* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, CF_DMACK */
37 s5pc100_ide_cfg_gpios(S5PC100_GPJ0(0), 8);
38
39 /*CF_Data[0 - 7] */
40 s5pc100_ide_cfg_gpios(S5PC100_GPJ2(0), 8);
41
42 /* CF_Data[8 - 15] */
43 s5pc100_ide_cfg_gpios(S5PC100_GPJ3(0), 8);
44
45 /* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */
46 s5pc100_ide_cfg_gpios(S5PC100_GPJ4(0), 4);
47
48 /* EBI_OE, EBI_WE */
49 s3c_gpio_cfgpin_range(S5PC100_GPK0(6), 2, S3C_GPIO_SFN(0));
50
51 /* CF_OE, CF_WE */
52 s3c_gpio_cfgrange_nopull(S5PC100_GPK1(6), 8, S3C_GPIO_SFN(2));
53
54 /* CF_CD */
55 s3c_gpio_cfgpin(S5PC100_GPK3(5), S3C_GPIO_SFN(2));
56 s3c_gpio_setpull(S5PC100_GPK3(5), S3C_GPIO_PULL_NONE);
57}
diff --git a/arch/arm/mach-s5pc100/setup-keypad.c b/arch/arm/mach-s5pc100/setup-keypad.c
deleted file mode 100644
index ada377f0c206..000000000000
--- a/arch/arm/mach-s5pc100/setup-keypad.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-keypad.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * GPIO configuration for S5PC100 KeyPad device
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/gpio.h>
14#include <plat/gpio-cfg.h>
15
16void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
17{
18 /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
19 s3c_gpio_cfgrange_nopull(S5PC100_GPH3(0), rows, S3C_GPIO_SFN(3));
20
21 /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
22 s3c_gpio_cfgrange_nopull(S5PC100_GPH2(0), cols, S3C_GPIO_SFN(3));
23}
diff --git a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
deleted file mode 100644
index 6010c0310cb5..000000000000
--- a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/* linux/arch/arm/plat-s5pc100/setup-sdhci-gpio.c
2 *
3 * Copyright 2009 Samsung Eletronics
4 *
5 * S5PC100 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/gpio.h>
18#include <linux/mmc/host.h>
19#include <linux/mmc/card.h>
20
21#include <plat/gpio-cfg.h>
22#include <plat/sdhci.h>
23
24void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
25{
26 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
27 unsigned int num;
28
29 num = width;
30 /* In case of 8 width, we should decrease the 2 */
31 if (width == 8)
32 num = width - 2;
33
34 /* Set all the necessary GPG0/GPG1 pins to special-function 0 */
35 s3c_gpio_cfgrange_nopull(S5PC100_GPG0(0), 2 + num, S3C_GPIO_SFN(2));
36
37 if (width == 8)
38 s3c_gpio_cfgrange_nopull(S5PC100_GPG1(0), 2, S3C_GPIO_SFN(2));
39
40 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
41 s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP);
42 s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2));
43 }
44}
45
46void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
47{
48 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
49
50 /* Set all the necessary GPG2 pins to special-function 2 */
51 s3c_gpio_cfgrange_nopull(S5PC100_GPG2(0), 2 + width, S3C_GPIO_SFN(2));
52
53 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
54 s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP);
55 s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2));
56 }
57}
58
59void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
60{
61 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
62
63 /* Set all the necessary GPG3 pins to special-function 2 */
64 s3c_gpio_cfgrange_nopull(S5PC100_GPG3(0), 2 + width, S3C_GPIO_SFN(2));
65
66 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
67 s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP);
68 s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2));
69 }
70}
diff --git a/arch/arm/mach-s5pc100/setup-spi.c b/arch/arm/mach-s5pc100/setup-spi.c
deleted file mode 100644
index 183567961de1..000000000000
--- a/arch/arm/mach-s5pc100/setup-spi.c
+++ /dev/null
@@ -1,41 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-spi.c
2 *
3 * Copyright (C) 2011 Samsung Electronics Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h>
13
14#ifdef CONFIG_S3C64XX_DEV_SPI0
15int s3c64xx_spi0_cfg_gpio(void)
16{
17 s3c_gpio_cfgall_range(S5PC100_GPB(0), 3,
18 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
19 return 0;
20}
21#endif
22
23#ifdef CONFIG_S3C64XX_DEV_SPI1
24int s3c64xx_spi1_cfg_gpio(void)
25{
26 s3c_gpio_cfgall_range(S5PC100_GPB(4), 3,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28 return 0;
29}
30#endif
31
32#ifdef CONFIG_S3C64XX_DEV_SPI2
33int s3c64xx_spi2_cfg_gpio(void)
34{
35 s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3));
36 s3c_gpio_setpull(S5PC100_GPG3(0), S3C_GPIO_PULL_UP);
37 s3c_gpio_cfgall_range(S5PC100_GPB(2), 2,
38 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
39 return 0;
40}
41#endif
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 8c3abe521757..f60f2862856d 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,10 +11,11 @@ if ARCH_S5PV210
11 11
12config CPU_S5PV210 12config CPU_S5PV210
13 bool 13 bool
14 select ARM_AMBA
15 select PL330_DMA if DMADEVICES
14 select S5P_EXT_INT 16 select S5P_EXT_INT
15 select S5P_PM if PM 17 select S5P_PM if PM
16 select S5P_SLEEP if PM 18 select S5P_SLEEP if PM
17 select SAMSUNG_DMADEV
18 help 19 help
19 Enable S5PV210 CPU support 20 Enable S5PV210 CPU support
20 21
diff --git a/arch/arm/mach-s5pv210/dev-audio.c b/arch/arm/mach-s5pv210/dev-audio.c
index 2d67361ef431..90356ad10c54 100644
--- a/arch/arm/mach-s5pv210/dev-audio.c
+++ b/arch/arm/mach-s5pv210/dev-audio.c
@@ -10,7 +10,6 @@
10 10
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14 13
15#include <plat/gpio-cfg.h> 14#include <plat/gpio-cfg.h>
16#include <linux/platform_data/asoc-s3c.h> 15#include <linux/platform_data/asoc-s3c.h>
@@ -18,6 +17,7 @@
18#include <mach/map.h> 17#include <mach/map.h>
19#include <mach/dma.h> 18#include <mach/dma.h>
20#include <mach/irqs.h> 19#include <mach/irqs.h>
20#include <mach/gpio-samsung.h>
21 21
22#define S5PV210_AUDSS_INT_MEM (0xC0000000) 22#define S5PV210_AUDSS_INT_MEM (0xC0000000)
23 23
diff --git a/arch/arm/mach-s5pv210/include/mach/gpio.h b/arch/arm/mach-s5pv210/include/mach/gpio-samsung.h
index 6c8b903c02e4..e193b891e7b2 100644
--- a/arch/arm/mach-s5pv210/include/mach/gpio.h
+++ b/arch/arm/mach-s5pv210/include/mach/gpio-samsung.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/gpio.h 1/*
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 3 * http://www.samsung.com/
5 * 4 *
@@ -133,8 +132,4 @@ enum s5p_gpio_number {
133#define S5PV210_GPIO_END (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + 1) 132#define S5PV210_GPIO_END (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + 1)
134#define S3C_GPIO_END S5PV210_GPIO_END 133#define S3C_GPIO_END S5PV210_GPIO_END
135 134
136/* define the number of gpios we need to the one after the MP05() range */
137#define ARCH_NR_GPIOS (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + \
138 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
139
140#endif /* __ASM_ARCH_GPIO_H */ 135#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index cc37edacda26..4262d8ff1988 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -31,6 +31,7 @@
31#include <video/samsung_fimd.h> 31#include <video/samsung_fimd.h>
32#include <mach/map.h> 32#include <mach/map.h>
33#include <mach/regs-clock.h> 33#include <mach/regs-clock.h>
34#include <mach/gpio-samsung.h>
34 35
35#include <plat/gpio-cfg.h> 36#include <plat/gpio-cfg.h>
36#include <plat/devs.h> 37#include <plat/devs.h>
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index c1ce921c4088..096a8173a1d9 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -38,6 +38,7 @@
38#include <video/samsung_fimd.h> 38#include <video/samsung_fimd.h>
39#include <mach/map.h> 39#include <mach/map.h>
40#include <mach/regs-clock.h> 40#include <mach/regs-clock.h>
41#include <mach/gpio-samsung.h>
41 42
42#include <plat/gpio-cfg.h> 43#include <plat/gpio-cfg.h>
43#include <plat/devs.h> 44#include <plat/devs.h>
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 2a6655fb63e7..a146089c9ee6 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -32,6 +32,7 @@
32 32
33#include <mach/map.h> 33#include <mach/map.h>
34#include <mach/regs-clock.h> 34#include <mach/regs-clock.h>
35#include <mach/gpio-samsung.h>
35 36
36#include <plat/regs-srom.h> 37#include <plat/regs-srom.h>
37#include <plat/gpio-cfg.h> 38#include <plat/gpio-cfg.h>
diff --git a/arch/arm/mach-s5pv210/setup-fb-24bpp.c b/arch/arm/mach-s5pv210/setup-fb-24bpp.c
index 55103c8220b3..815e329f70c4 100644
--- a/arch/arm/mach-s5pv210/setup-fb-24bpp.c
+++ b/arch/arm/mach-s5pv210/setup-fb-24bpp.c
@@ -13,12 +13,12 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <linux/gpio.h>
17 16
18#include <mach/map.h> 17#include <mach/map.h>
19#include <plat/fb.h> 18#include <plat/fb.h>
20#include <mach/regs-clock.h> 19#include <mach/regs-clock.h>
21#include <plat/gpio-cfg.h> 20#include <plat/gpio-cfg.h>
21#include <mach/gpio-samsung.h>
22 22
23static void s5pv210_fb_cfg_gpios(unsigned int base, unsigned int nr) 23static void s5pv210_fb_cfg_gpios(unsigned int base, unsigned int nr)
24{ 24{
diff --git a/arch/arm/mach-s5pv210/setup-fimc.c b/arch/arm/mach-s5pv210/setup-fimc.c
index 54cc5b11be0b..36945ec437f8 100644
--- a/arch/arm/mach-s5pv210/setup-fimc.c
+++ b/arch/arm/mach-s5pv210/setup-fimc.c
@@ -8,9 +8,10 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/gpio.h> 11#include <linux/kernel.h>
12#include <plat/gpio-cfg.h> 12#include <plat/gpio-cfg.h>
13#include <plat/camport.h> 13#include <plat/camport.h>
14#include <mach/gpio-samsung.h>
14 15
15int s5pv210_fimc_setup_gpio(enum s5p_camport_id id) 16int s5pv210_fimc_setup_gpio(enum s5p_camport_id id)
16{ 17{
diff --git a/arch/arm/mach-s5pv210/setup-i2c0.c b/arch/arm/mach-s5pv210/setup-i2c0.c
index 4a15849766c0..b0f2b69ac743 100644
--- a/arch/arm/mach-s5pv210/setup-i2c0.c
+++ b/arch/arm/mach-s5pv210/setup-i2c0.c
@@ -14,12 +14,12 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/gpio.h>
18 17
19struct platform_device; /* don't need the contents */ 18struct platform_device; /* don't need the contents */
20 19
21#include <linux/platform_data/i2c-s3c2410.h> 20#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
22#include <mach/gpio-samsung.h>
23 23
24void s3c_i2c0_cfg_gpio(struct platform_device *dev) 24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
25{ 25{
diff --git a/arch/arm/mach-s5pv210/setup-i2c1.c b/arch/arm/mach-s5pv210/setup-i2c1.c
index 4777f6b97a92..aac1da7b9071 100644
--- a/arch/arm/mach-s5pv210/setup-i2c1.c
+++ b/arch/arm/mach-s5pv210/setup-i2c1.c
@@ -14,12 +14,12 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/gpio.h>
18 17
19struct platform_device; /* don't need the contents */ 18struct platform_device; /* don't need the contents */
20 19
21#include <linux/platform_data/i2c-s3c2410.h> 20#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
22#include <mach/gpio-samsung.h>
23 23
24void s3c_i2c1_cfg_gpio(struct platform_device *dev) 24void s3c_i2c1_cfg_gpio(struct platform_device *dev)
25{ 25{
diff --git a/arch/arm/mach-s5pv210/setup-i2c2.c b/arch/arm/mach-s5pv210/setup-i2c2.c
index bbce6c74b915..eff4503b903f 100644
--- a/arch/arm/mach-s5pv210/setup-i2c2.c
+++ b/arch/arm/mach-s5pv210/setup-i2c2.c
@@ -14,12 +14,12 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/gpio.h>
18 17
19struct platform_device; /* don't need the contents */ 18struct platform_device; /* don't need the contents */
20 19
21#include <linux/platform_data/i2c-s3c2410.h> 20#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
22#include <mach/gpio-samsung.h>
23 23
24void s3c_i2c2_cfg_gpio(struct platform_device *dev) 24void s3c_i2c2_cfg_gpio(struct platform_device *dev)
25{ 25{
diff --git a/arch/arm/mach-s5pv210/setup-ide.c b/arch/arm/mach-s5pv210/setup-ide.c
index ea123d546bd2..5b6042d97892 100644
--- a/arch/arm/mach-s5pv210/setup-ide.c
+++ b/arch/arm/mach-s5pv210/setup-ide.c
@@ -11,9 +11,9 @@
11*/ 11*/
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/gpio.h>
15 14
16#include <plat/gpio-cfg.h> 15#include <plat/gpio-cfg.h>
16#include <mach/gpio-samsung.h>
17 17
18static void s5pv210_ide_cfg_gpios(unsigned int base, unsigned int nr) 18static void s5pv210_ide_cfg_gpios(unsigned int base, unsigned int nr)
19{ 19{
diff --git a/arch/arm/mach-s5pv210/setup-keypad.c b/arch/arm/mach-s5pv210/setup-keypad.c
index c56420a52f48..faf6178f3a1b 100644
--- a/arch/arm/mach-s5pv210/setup-keypad.c
+++ b/arch/arm/mach-s5pv210/setup-keypad.c
@@ -11,8 +11,8 @@
11 * 11 *
12 */ 12 */
13 13
14#include <linux/gpio.h>
15#include <plat/gpio-cfg.h> 14#include <plat/gpio-cfg.h>
15#include <mach/gpio-samsung.h>
16 16
17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) 17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
18{ 18{
diff --git a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
index 0512ada00522..0dd055b47579 100644
--- a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
@@ -15,12 +15,12 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h>
19#include <linux/mmc/host.h> 18#include <linux/mmc/host.h>
20#include <linux/mmc/card.h> 19#include <linux/mmc/card.h>
21 20
22#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
23#include <plat/sdhci.h> 22#include <plat/sdhci.h>
23#include <mach/gpio-samsung.h>
24 24
25void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 25void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
26{ 26{
diff --git a/arch/arm/mach-s5pv210/setup-spi.c b/arch/arm/mach-s5pv210/setup-spi.c
index 81aecc162f82..e1faf8ea4502 100644
--- a/arch/arm/mach-s5pv210/setup-spi.c
+++ b/arch/arm/mach-s5pv210/setup-spi.c
@@ -8,8 +8,8 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h> 11#include <plat/gpio-cfg.h>
12#include <mach/gpio-samsung.h>
13 13
14#ifdef CONFIG_S3C64XX_DEV_SPI0 14#ifdef CONFIG_S3C64XX_DEV_SPI0
15int s3c64xx_spi0_cfg_gpio(void) 15int s3c64xx_spi0_cfg_gpio(void)
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index f9874ba60cc8..108939f8d053 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -329,6 +329,11 @@ static struct mtd_partition collie_partitions[] = {
329 .name = "rootfs", 329 .name = "rootfs",
330 .offset = MTDPART_OFS_APPEND, 330 .offset = MTDPART_OFS_APPEND,
331 .size = 0x00e20000, 331 .size = 0x00e20000,
332 }, {
333 .name = "bootblock",
334 .offset = MTDPART_OFS_APPEND,
335 .size = 0x00020000,
336 .mask_flags = MTD_WRITEABLE
332 } 337 }
333}; 338};
334 339
@@ -356,7 +361,7 @@ static void collie_flash_exit(void)
356} 361}
357 362
358static struct flash_platform_data collie_flash_data = { 363static struct flash_platform_data collie_flash_data = {
359 .map_name = "jedec_probe", 364 .map_name = "cfi_probe",
360 .init = collie_flash_init, 365 .init = collie_flash_init,
361 .set_vpp = collie_set_vpp, 366 .set_vpp = collie_set_vpp,
362 .exit = collie_flash_exit, 367 .exit = collie_flash_exit,
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index dbd954e61aa7..798073057e51 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -1,7 +1,7 @@
1config ARCH_SHMOBILE 1config ARCH_SHMOBILE
2 bool 2 bool
3 3
4config ARCH_SHMOBILE_MULTI 4menuconfig ARCH_SHMOBILE_MULTI
5 bool "Renesas ARM SoCs" if ARCH_MULTI_V7 5 bool "Renesas ARM SoCs" if ARCH_MULTI_V7
6 depends on MMU 6 depends on MMU
7 select ARCH_SHMOBILE 7 select ARCH_SHMOBILE
@@ -15,7 +15,7 @@ config ARCH_SHMOBILE_MULTI
15 15
16if ARCH_SHMOBILE_MULTI 16if ARCH_SHMOBILE_MULTI
17 17
18comment "Renesas ARM SoCs System Type" 18#comment "Renesas ARM SoCs System Type"
19 19
20config ARCH_EMEV2 20config ARCH_EMEV2
21 bool "Emma Mobile EV2" 21 bool "Emma Mobile EV2"
@@ -85,7 +85,6 @@ config ARCH_R8A73A4
85 select CPU_V7 85 select CPU_V7
86 select SH_CLK_CPG 86 select SH_CLK_CPG
87 select RENESAS_IRQC 87 select RENESAS_IRQC
88 select ARCH_HAS_CPUFREQ
89 select ARCH_HAS_OPP 88 select ARCH_HAS_OPP
90 select SYS_SUPPORTS_SH_CMT 89 select SYS_SUPPORTS_SH_CMT
91 select SYS_SUPPORTS_SH_TMU 90 select SYS_SUPPORTS_SH_TMU
@@ -264,7 +263,6 @@ config MACH_KOELSCH
264config MACH_KZM9G 263config MACH_KZM9G
265 bool "KZM-A9-GT board" 264 bool "KZM-A9-GT board"
266 depends on ARCH_SH73A0 265 depends on ARCH_SH73A0
267 select ARCH_HAS_CPUFREQ
268 select ARCH_HAS_OPP 266 select ARCH_HAS_OPP
269 select ARCH_REQUIRE_GPIOLIB 267 select ARCH_REQUIRE_GPIOLIB
270 select REGULATOR_FIXED_VOLTAGE if REGULATOR 268 select REGULATOR_FIXED_VOLTAGE if REGULATOR
diff --git a/arch/arm/mach-shmobile/board-ape6evm-reference.c b/arch/arm/mach-shmobile/board-ape6evm-reference.c
index 3276afcf3cc9..2f7723e5fe91 100644
--- a/arch/arm/mach-shmobile/board-ape6evm-reference.c
+++ b/arch/arm/mach-shmobile/board-ape6evm-reference.c
@@ -24,11 +24,13 @@
24#include <linux/pinctrl/machine.h> 24#include <linux/pinctrl/machine.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/sh_clk.h> 26#include <linux/sh_clk.h>
27#include <mach/common.h> 27
28#include <mach/r8a73a4.h>
29#include <asm/mach-types.h> 28#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
31 30
31#include "common.h"
32#include "r8a73a4.h"
33
32static void __init ape6evm_add_standard_devices(void) 34static void __init ape6evm_add_standard_devices(void)
33{ 35{
34 36
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index fe071a9130b7..485567876d39 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -33,12 +33,14 @@
33#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
34#include <linux/sh_clk.h> 34#include <linux/sh_clk.h>
35#include <linux/smsc911x.h> 35#include <linux/smsc911x.h>
36#include <mach/common.h> 36
37#include <mach/irqs.h>
38#include <mach/r8a73a4.h>
39#include <asm/mach-types.h> 37#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
41 39
40#include "common.h"
41#include "irqs.h"
42#include "r8a73a4.h"
43
42/* LEDS */ 44/* LEDS */
43static struct gpio_led ape6evm_leds[] = { 45static struct gpio_led ape6evm_leds[] = {
44 { 46 {
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
index f660fbb96e0b..208576667b22 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
@@ -24,11 +24,13 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <mach/common.h> 27
28#include <mach/r8a7740.h>
29#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
30#include <asm/hardware/cache-l2x0.h> 29#include <asm/hardware/cache-l2x0.h>
31 30
31#include "common.h"
32#include "r8a7740.h"
33
32/* 34/*
33 * CON1 Camera Module 35 * CON1 Camera Module
34 * CON2 Extension Bus 36 * CON2 Extension Bus
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 30fcac73a540..32339cf6ee7b 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -45,9 +45,7 @@
45#include <linux/mmc/sh_mobile_sdhi.h> 45#include <linux/mmc/sh_mobile_sdhi.h>
46#include <linux/i2c-gpio.h> 46#include <linux/i2c-gpio.h>
47#include <linux/reboot.h> 47#include <linux/reboot.h>
48#include <mach/common.h> 48
49#include <mach/irqs.h>
50#include <mach/r8a7740.h>
51#include <media/mt9t112.h> 49#include <media/mt9t112.h>
52#include <media/sh_mobile_ceu.h> 50#include <media/sh_mobile_ceu.h>
53#include <media/soc_camera.h> 51#include <media/soc_camera.h>
@@ -62,6 +60,10 @@
62#include <sound/sh_fsi.h> 60#include <sound/sh_fsi.h>
63#include <sound/simple_card.h> 61#include <sound/simple_card.h>
64 62
63#include "common.h"
64#include "irqs.h"
65#include "pm-rmobile.h"
66#include "r8a7740.h"
65#include "sh-gpio.h" 67#include "sh-gpio.h"
66 68
67/* 69/*
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
index 027373f8de82..ba840cd333b9 100644
--- a/arch/arm/mach-shmobile/board-bockw-reference.c
+++ b/arch/arm/mach-shmobile/board-bockw-reference.c
@@ -19,10 +19,12 @@
19 */ 19 */
20 20
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <mach/common.h> 22
23#include <mach/r8a7778.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25 24
25#include "common.h"
26#include "r8a7778.h"
27
26/* 28/*
27 * see board-bock.c for checking detail of dip-switch 29 * see board-bock.c for checking detail of dip-switch
28 */ 30 */
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index f444be2f241e..b4e4789017bc 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -34,14 +34,16 @@
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/flash.h> 35#include <linux/spi/flash.h>
36#include <linux/usb/renesas_usbhs.h> 36#include <linux/usb/renesas_usbhs.h>
37
37#include <media/soc_camera.h> 38#include <media/soc_camera.h>
38#include <mach/common.h>
39#include <mach/irqs.h>
40#include <mach/r8a7778.h>
41#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
42#include <sound/rcar_snd.h> 40#include <sound/rcar_snd.h>
43#include <sound/simple_card.h> 41#include <sound/simple_card.h>
44 42
43#include "common.h"
44#include "irqs.h"
45#include "r8a7778.h"
46
45#define FPGA 0x18200000 47#define FPGA 0x18200000
46#define IRQ0MR 0x30 48#define IRQ0MR 0x30
47#define COMCTLR 0x101c 49#define COMCTLR 0x101c
diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
index 2ff6ad6e608e..e5448f7b868a 100644
--- a/arch/arm/mach-shmobile/board-genmai-reference.c
+++ b/arch/arm/mach-shmobile/board-genmai-reference.c
@@ -20,12 +20,14 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <mach/clock.h> 23
24#include <mach/common.h>
25#include <mach/r7s72100.h>
26#include <asm/mach-types.h> 24#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
28 26
27#include "clock.h"
28#include "common.h"
29#include "r7s72100.h"
30
29/* 31/*
30 * This is a really crude hack to provide clkdev support to platform 32 * This is a really crude hack to provide clkdev support to platform
31 * devices until they get moved to DT. 33 * devices until they get moved to DT.
@@ -47,7 +49,7 @@ static const char * const genmai_boards_compat_dt[] __initconst = {
47}; 49};
48 50
49DT_MACHINE_START(GENMAI_DT, "genmai") 51DT_MACHINE_START(GENMAI_DT, "genmai")
50 .init_early = r7s72100_init_early, 52 .init_early = shmobile_init_delay,
51 .init_machine = genmai_add_standard_devices, 53 .init_machine = genmai_add_standard_devices,
52 .dt_compat = genmai_boards_compat_dt, 54 .dt_compat = genmai_boards_compat_dt,
53MACHINE_END 55MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
index c94201ee8596..e2a3ba4871c3 100644
--- a/arch/arm/mach-shmobile/board-genmai.c
+++ b/arch/arm/mach-shmobile/board-genmai.c
@@ -25,12 +25,14 @@
25#include <linux/sh_eth.h> 25#include <linux/sh_eth.h>
26#include <linux/spi/rspi.h> 26#include <linux/spi/rspi.h>
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <mach/common.h> 28
29#include <mach/irqs.h>
30#include <mach/r7s72100.h>
31#include <asm/mach-types.h> 29#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
33 31
32#include "common.h"
33#include "irqs.h"
34#include "r7s72100.h"
35
34/* Ether */ 36/* Ether */
35static const struct sh_eth_plat_data ether_pdata __initconst = { 37static const struct sh_eth_plat_data ether_pdata __initconst = {
36 .phy = 0x00, /* PD60610 */ 38 .phy = 0x00, /* PD60610 */
@@ -154,7 +156,7 @@ static const char * const genmai_boards_compat_dt[] __initconst = {
154}; 156};
155 157
156DT_MACHINE_START(GENMAI_DT, "genmai") 158DT_MACHINE_START(GENMAI_DT, "genmai")
157 .init_early = r7s72100_init_early, 159 .init_early = shmobile_init_delay,
158 .init_machine = genmai_add_standard_devices, 160 .init_machine = genmai_add_standard_devices,
159 .dt_compat = genmai_boards_compat_dt, 161 .dt_compat = genmai_boards_compat_dt,
160MACHINE_END 162MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
index d322a162b4b0..1d3f67d4ccd6 100644
--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
+++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
@@ -23,12 +23,12 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/platform_data/rcar-du.h> 25#include <linux/platform_data/rcar-du.h>
26#include <mach/clock.h>
27#include <mach/common.h>
28#include <mach/irqs.h>
29#include <mach/rcar-gen2.h>
30#include <mach/r8a7791.h> 26#include <mach/r8a7791.h>
31#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include "clock.h"
29#include "common.h"
30#include "irqs.h"
31#include "rcar-gen2.h"
32 32
33/* DU */ 33/* DU */
34static struct rcar_du_encoder_data koelsch_du_encoders[] = { 34static struct rcar_du_encoder_data koelsch_du_encoders[] = {
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index c6c68892caa3..0d44e7eb6508 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -45,12 +45,12 @@
45#include <linux/spi/flash.h> 45#include <linux/spi/flash.h>
46#include <linux/spi/rspi.h> 46#include <linux/spi/rspi.h>
47#include <linux/spi/spi.h> 47#include <linux/spi/spi.h>
48#include <mach/common.h>
49#include <mach/irqs.h>
50#include <mach/r8a7791.h> 48#include <mach/r8a7791.h>
51#include <mach/rcar-gen2.h>
52#include <asm/mach-types.h> 49#include <asm/mach-types.h>
53#include <asm/mach/arch.h> 50#include <asm/mach/arch.h>
51#include "common.h"
52#include "irqs.h"
53#include "rcar-gen2.h"
54 54
55/* DU */ 55/* DU */
56static struct rcar_du_encoder_data koelsch_du_encoders[] = { 56static struct rcar_du_encoder_data koelsch_du_encoders[] = {
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
index a735a1d80c28..5d2621f202d1 100644
--- a/arch/arm/mach-shmobile/board-kzm9g-reference.c
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -25,12 +25,14 @@
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <mach/sh73a0.h> 28
29#include <mach/common.h>
30#include <asm/hardware/cache-l2x0.h> 29#include <asm/hardware/cache-l2x0.h>
31#include <asm/mach-types.h> 30#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
33 32
33#include "common.h"
34#include "sh73a0.h"
35
34static void __init kzm_init(void) 36static void __init kzm_init(void)
35{ 37{
36 sh73a0_add_standard_devices_dt(); 38 sh73a0_add_standard_devices_dt();
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index f94ec8ca42c1..1320e9d063b1 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -41,16 +41,18 @@
41#include <linux/usb/r8a66597.h> 41#include <linux/usb/r8a66597.h>
42#include <linux/usb/renesas_usbhs.h> 42#include <linux/usb/renesas_usbhs.h>
43#include <linux/videodev2.h> 43#include <linux/videodev2.h>
44
44#include <sound/sh_fsi.h> 45#include <sound/sh_fsi.h>
45#include <sound/simple_card.h> 46#include <sound/simple_card.h>
46#include <mach/irqs.h>
47#include <mach/sh73a0.h>
48#include <mach/common.h>
49#include <asm/hardware/cache-l2x0.h> 47#include <asm/hardware/cache-l2x0.h>
50#include <asm/mach-types.h> 48#include <asm/mach-types.h>
51#include <asm/mach/arch.h> 49#include <asm/mach/arch.h>
52#include <video/sh_mobile_lcdc.h> 50#include <video/sh_mobile_lcdc.h>
53 51
52#include "common.h"
53#include "irqs.h"
54#include "sh73a0.h"
55
54/* 56/*
55 * external GPIO 57 * external GPIO
56 */ 58 */
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index 749832e3f33c..8dcff51a8f45 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -22,13 +22,15 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/platform_data/rcar-du.h> 24#include <linux/platform_data/rcar-du.h>
25#include <mach/clock.h> 25
26#include <mach/common.h>
27#include <mach/irqs.h>
28#include <mach/rcar-gen2.h>
29#include <mach/r8a7790.h>
30#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
31 27
28#include "clock.h"
29#include "common.h"
30#include "irqs.h"
31#include "r8a7790.h"
32#include "rcar-gen2.h"
33
32/* DU */ 34/* DU */
33static struct rcar_du_encoder_data lager_du_encoders[] = { 35static struct rcar_du_encoder_data lager_du_encoders[] = {
34 { 36 {
@@ -129,7 +131,7 @@ static const char *lager_boards_compat_dt[] __initdata = {
129 131
130DT_MACHINE_START(LAGER_DT, "lager") 132DT_MACHINE_START(LAGER_DT, "lager")
131 .smp = smp_ops(r8a7790_smp_ops), 133 .smp = smp_ops(r8a7790_smp_ops),
132 .init_early = r8a7790_init_early, 134 .init_early = shmobile_init_delay,
133 .init_time = rcar_gen2_timer_init, 135 .init_time = rcar_gen2_timer_init,
134 .init_machine = lager_add_standard_devices, 136 .init_machine = lager_add_standard_devices,
135 .init_late = shmobile_init_late, 137 .init_late = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index f8b1e05463cc..bfd9e4846fc9 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -31,6 +31,8 @@
31#include <linux/mmc/host.h> 31#include <linux/mmc/host.h>
32#include <linux/mmc/sh_mmcif.h> 32#include <linux/mmc/sh_mmcif.h>
33#include <linux/mmc/sh_mobile_sdhi.h> 33#include <linux/mmc/sh_mobile_sdhi.h>
34#include <linux/mtd/partitions.h>
35#include <linux/mtd/mtd.h>
34#include <linux/pinctrl/machine.h> 36#include <linux/pinctrl/machine.h>
35#include <linux/platform_data/camera-rcar.h> 37#include <linux/platform_data/camera-rcar.h>
36#include <linux/platform_data/gpio-rcar.h> 38#include <linux/platform_data/gpio-rcar.h>
@@ -43,22 +45,23 @@
43#include <linux/regulator/gpio-regulator.h> 45#include <linux/regulator/gpio-regulator.h>
44#include <linux/regulator/machine.h> 46#include <linux/regulator/machine.h>
45#include <linux/sh_eth.h> 47#include <linux/sh_eth.h>
48#include <linux/spi/flash.h>
49#include <linux/spi/rspi.h>
50#include <linux/spi/spi.h>
46#include <linux/usb/phy.h> 51#include <linux/usb/phy.h>
47#include <linux/usb/renesas_usbhs.h> 52#include <linux/usb/renesas_usbhs.h>
48#include <mach/common.h> 53
49#include <mach/irqs.h>
50#include <mach/r8a7790.h>
51#include <media/soc_camera.h> 54#include <media/soc_camera.h>
52#include <asm/mach-types.h> 55#include <asm/mach-types.h>
53#include <asm/mach/arch.h> 56#include <asm/mach/arch.h>
54#include <linux/mtd/partitions.h>
55#include <linux/mtd/mtd.h>
56#include <linux/spi/flash.h>
57#include <linux/spi/rspi.h>
58#include <linux/spi/spi.h>
59#include <sound/rcar_snd.h> 57#include <sound/rcar_snd.h>
60#include <sound/simple_card.h> 58#include <sound/simple_card.h>
61 59
60#include "common.h"
61#include "irqs.h"
62#include "r8a7790.h"
63#include "rcar-gen2.h"
64
62/* 65/*
63 * SSI-AK4643 66 * SSI-AK4643
64 * 67 *
@@ -886,7 +889,7 @@ static const char * const lager_boards_compat_dt[] __initconst = {
886 889
887DT_MACHINE_START(LAGER_DT, "lager") 890DT_MACHINE_START(LAGER_DT, "lager")
888 .smp = smp_ops(r8a7790_smp_ops), 891 .smp = smp_ops(r8a7790_smp_ops),
889 .init_early = r8a7790_init_early, 892 .init_early = shmobile_init_delay,
890 .init_time = rcar_gen2_timer_init, 893 .init_time = rcar_gen2_timer_init,
891 .init_machine = lager_init, 894 .init_machine = lager_init,
892 .init_late = shmobile_init_late, 895 .init_late = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 0ff4d8e45cf7..304b76f3bf4a 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -47,10 +47,11 @@
47#include <linux/regulator/fixed.h> 47#include <linux/regulator/fixed.h>
48#include <linux/regulator/machine.h> 48#include <linux/regulator/machine.h>
49#include <linux/smsc911x.h> 49#include <linux/smsc911x.h>
50#include <linux/sh_intc.h> 50#include <linux/sh_clk.h>
51#include <linux/tca6416_keypad.h> 51#include <linux/tca6416_keypad.h>
52#include <linux/usb/renesas_usbhs.h> 52#include <linux/usb/renesas_usbhs.h>
53#include <linux/dma-mapping.h> 53#include <linux/dma-mapping.h>
54
54#include <video/sh_mobile_hdmi.h> 55#include <video/sh_mobile_hdmi.h>
55#include <video/sh_mobile_lcdc.h> 56#include <video/sh_mobile_lcdc.h>
56#include <media/sh_mobile_ceu.h> 57#include <media/sh_mobile_ceu.h>
@@ -58,15 +59,14 @@
58#include <media/soc_camera_platform.h> 59#include <media/soc_camera_platform.h>
59#include <sound/sh_fsi.h> 60#include <sound/sh_fsi.h>
60#include <sound/simple_card.h> 61#include <sound/simple_card.h>
61
62#include <mach/common.h>
63#include <mach/irqs.h>
64#include <mach/sh7372.h>
65
66#include <asm/mach/arch.h> 62#include <asm/mach/arch.h>
67#include <asm/mach-types.h> 63#include <asm/mach-types.h>
68 64
65#include "common.h"
66#include "irqs.h"
67#include "pm-rmobile.h"
69#include "sh-gpio.h" 68#include "sh-gpio.h"
69#include "sh7372.h"
70 70
71/* 71/*
72 * Address Interface BusWidth note 72 * Address Interface BusWidth note
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
index 2773936bf7dc..94bd57203ff5 100644
--- a/arch/arm/mach-shmobile/board-marzen-reference.c
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -20,10 +20,10 @@
20 */ 20 */
21 21
22#include <mach/r8a7779.h> 22#include <mach/r8a7779.h>
23#include <mach/common.h>
24#include <mach/irqs.h>
25#include <asm/irq.h> 23#include <asm/irq.h>
26#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include "common.h"
26#include "irqs.h"
27 27
28static void __init marzen_init(void) 28static void __init marzen_init(void)
29{ 29{
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index d832a4477b4b..fe445ef49fb9 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -43,11 +43,11 @@
43#include <linux/mfd/tmio.h> 43#include <linux/mfd/tmio.h>
44#include <media/soc_camera.h> 44#include <media/soc_camera.h>
45#include <mach/r8a7779.h> 45#include <mach/r8a7779.h>
46#include <mach/common.h>
47#include <mach/irqs.h>
48#include <asm/mach-types.h> 46#include <asm/mach-types.h>
49#include <asm/mach/arch.h> 47#include <asm/mach/arch.h>
50#include <asm/traps.h> 48#include <asm/traps.h>
49#include "common.h"
50#include "irqs.h"
51 51
52/* Fixed 3.3V regulator to be used by SDHI0 */ 52/* Fixed 3.3V regulator to be used by SDHI0 */
53static struct regulator_consumer_supply fixed3v3_power_consumers[] = { 53static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
index df187484de5d..3eb2ec401e0c 100644
--- a/arch/arm/mach-shmobile/clock-r7s72100.c
+++ b/arch/arm/mach-shmobile/clock-r7s72100.c
@@ -19,8 +19,9 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/sh_clk.h> 20#include <linux/sh_clk.h>
21#include <linux/clkdev.h> 21#include <linux/clkdev.h>
22#include <mach/common.h> 22
23#include <mach/r7s72100.h> 23#include "common.h"
24#include "r7s72100.h"
24 25
25/* Frequency Control Registers */ 26/* Frequency Control Registers */
26#define FRQCR 0xfcfe0010 27#define FRQCR 0xfcfe0010
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index b5bc22c6a858..0f431498229b 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -22,8 +22,8 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sh_clk.h> 23#include <linux/sh_clk.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <mach/clock.h> 25#include "common.h"
26#include <mach/common.h> 26#include "clock.h"
27 27
28#define CPG_BASE 0xe6150000 28#define CPG_BASE 0xe6150000
29#define CPG_LEN 0x270 29#define CPG_LEN 0x270
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 50931e3c97c7..789091cfa37a 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -22,9 +22,10 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/sh_clk.h> 23#include <linux/sh_clk.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <mach/clock.h> 25
26#include <mach/common.h> 26#include "clock.h"
27#include <mach/r8a7740.h> 27#include "common.h"
28#include "r8a7740.h"
28 29
29/* 30/*
30 * | MDx | XTAL1/EXTAL1 | System | EXTALR | 31 * | MDx | XTAL1/EXTAL1 | System | EXTALR |
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index 13f8f3ab8840..16bbc94a1520 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -39,8 +39,8 @@
39#include <linux/io.h> 39#include <linux/io.h>
40#include <linux/sh_clk.h> 40#include <linux/sh_clk.h>
41#include <linux/clkdev.h> 41#include <linux/clkdev.h>
42#include <mach/clock.h> 42#include "clock.h"
43#include <mach/common.h> 43#include "common.h"
44 44
45#define MSTPCR0 IOMEM(0xffc80030) 45#define MSTPCR0 IOMEM(0xffc80030)
46#define MSTPCR1 IOMEM(0xffc80034) 46#define MSTPCR1 IOMEM(0xffc80034)
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index a13298bd37a8..d81539a26dbd 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -23,8 +23,8 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/sh_clk.h> 24#include <linux/sh_clk.h>
25#include <linux/clkdev.h> 25#include <linux/clkdev.h>
26#include <mach/clock.h> 26#include "clock.h"
27#include <mach/common.h> 27#include "common.h"
28 28
29/* 29/*
30 * MD1 = 1 MD1 = 0 30 * MD1 = 1 MD1 = 0
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index 296a057109e4..17435c1aa2fe 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -22,9 +22,11 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sh_clk.h> 23#include <linux/sh_clk.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <mach/clock.h> 25
26#include <mach/common.h> 26#include "clock.h"
27#include <mach/r8a7790.h> 27#include "common.h"
28#include "r8a7790.h"
29#include "rcar-gen2.h"
28 30
29/* 31/*
30 * MD EXTAL PLL0 PLL1 PLL3 32 * MD EXTAL PLL0 PLL1 PLL3
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
index e2fdfcc14436..10e193d707f5 100644
--- a/arch/arm/mach-shmobile/clock-r8a7791.c
+++ b/arch/arm/mach-shmobile/clock-r8a7791.c
@@ -23,9 +23,9 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/sh_clk.h> 24#include <linux/sh_clk.h>
25#include <linux/clkdev.h> 25#include <linux/clkdev.h>
26#include <mach/clock.h> 26#include "clock.h"
27#include <mach/common.h> 27#include "common.h"
28#include <mach/rcar-gen2.h> 28#include "rcar-gen2.h"
29 29
30/* 30/*
31 * MD EXTAL PLL0 PLL1 PLL3 31 * MD EXTAL PLL0 PLL1 PLL3
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index d16d9ca7f79e..7071676145c4 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -21,8 +21,8 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/sh_clk.h> 22#include <linux/sh_clk.h>
23#include <linux/clkdev.h> 23#include <linux/clkdev.h>
24#include <mach/clock.h> 24#include "clock.h"
25#include <mach/common.h> 25#include "common.h"
26 26
27/* SH7372 registers */ 27/* SH7372 registers */
28#define FRQCRA IOMEM(0xe6150000) 28#define FRQCRA IOMEM(0xe6150000)
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 0d9cd1fe0212..37f48383e05a 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -22,8 +22,8 @@
22#include <linux/sh_clk.h> 22#include <linux/sh_clk.h>
23#include <linux/clkdev.h> 23#include <linux/clkdev.h>
24#include <asm/processor.h> 24#include <asm/processor.h>
25#include <mach/clock.h> 25#include "clock.h"
26#include <mach/common.h> 26#include "common.h"
27 27
28#define FRQCRA IOMEM(0xe6150000) 28#define FRQCRA IOMEM(0xe6150000)
29#define FRQCRB IOMEM(0xe6150004) 29#define FRQCRB IOMEM(0xe6150004)
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index e7232a0373b9..806f94038cc4 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -25,7 +25,7 @@
25#ifdef CONFIG_COMMON_CLK 25#ifdef CONFIG_COMMON_CLK
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/clkdev.h> 27#include <linux/clkdev.h>
28#include <mach/clock.h> 28#include "clock.h"
29 29
30void __init shmobile_clk_workaround(const struct clk_name *clks, 30void __init shmobile_clk_workaround(const struct clk_name *clks,
31 int nr_clks, bool enable) 31 int nr_clks, bool enable)
@@ -49,8 +49,8 @@ void __init shmobile_clk_workaround(const struct clk_name *clks,
49#else /* CONFIG_COMMON_CLK */ 49#else /* CONFIG_COMMON_CLK */
50#include <linux/sh_clk.h> 50#include <linux/sh_clk.h>
51#include <linux/export.h> 51#include <linux/export.h>
52#include <mach/clock.h> 52#include "clock.h"
53#include <mach/common.h> 53#include "common.h"
54 54
55unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk) 55unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk)
56{ 56{
diff --git a/arch/arm/mach-shmobile/include/mach/clock.h b/arch/arm/mach-shmobile/clock.h
index 31b6417463e6..31b6417463e6 100644
--- a/arch/arm/mach-shmobile/include/mach/clock.h
+++ b/arch/arm/mach-shmobile/clock.h
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/common.h
index f7a360edcc35..f7a360edcc35 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/common.h
diff --git a/arch/arm/mach-shmobile/console.c b/arch/arm/mach-shmobile/console.c
index 9411a5bf4fd6..f2e79f2376e1 100644
--- a/arch/arm/mach-shmobile/console.c
+++ b/arch/arm/mach-shmobile/console.c
@@ -19,8 +19,8 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <mach/common.h>
23#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23#include "common.h"
24 24
25void __init shmobile_setup_console(void) 25void __init shmobile_setup_console(void)
26{ 26{
diff --git a/arch/arm/mach-shmobile/include/mach/dma-register.h b/arch/arm/mach-shmobile/dma-register.h
index 97c40bd9b94f..97c40bd9b94f 100644
--- a/arch/arm/mach-shmobile/include/mach/dma-register.h
+++ b/arch/arm/mach-shmobile/dma-register.h
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index d241bfd6926d..5aee83f079e2 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -1,24 +1,10 @@
1#ifndef __ASM_MACH_IRQS_H 1#ifndef __ASM_MACH_IRQS_H
2#define __ASM_MACH_IRQS_H 2#define __ASM_MACH_IRQS_H
3 3
4#include <linux/sh_intc.h> 4/* Stuck here until drivers/pinctl/sh-pfc gets rid of legacy code */
5
6/* GIC */
7#define gic_spi(nr) ((nr) + 32)
8#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
9
10/* INTCS */
11#define INTCS_VECT_BASE 0x3400
12#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
13#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
14 5
15/* External IRQ pins */ 6/* External IRQ pins */
16#define IRQPIN_BASE 2000 7#define IRQPIN_BASE 2000
17#define irq_pin(nr) ((nr) + IRQPIN_BASE) 8#define irq_pin(nr) ((nr) + IRQPIN_BASE)
18 9
19/* GPIO IRQ */
20#define _GPIO_IRQ_BASE 2500
21#define GPIO_IRQ_BASE(x) (_GPIO_IRQ_BASE + (32 * x))
22#define GPIO_IRQ(x, y) (_GPIO_IRQ_BASE + (32 * x) + y)
23
24#endif /* __ASM_MACH_IRQS_H */ 10#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index 88eeceaf1088..def10a29e09a 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -2,8 +2,6 @@
2#define __ASM_R8A7779_H__ 2#define __ASM_R8A7779_H__
3 3
4#include <linux/sh_clk.h> 4#include <linux/sh_clk.h>
5#include <linux/pm_domain.h>
6#include <mach/pm-rcar.h>
7 5
8/* HPB-DMA slave IDs */ 6/* HPB-DMA slave IDs */
9enum { 7enum {
@@ -12,16 +10,6 @@ enum {
12 HPBDMA_SLAVE_SDHI0_RX, 10 HPBDMA_SLAVE_SDHI0_RX,
13}; 11};
14 12
15struct r8a7779_pm_domain {
16 struct generic_pm_domain genpd;
17 struct rcar_sysc_ch ch;
18};
19
20static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
21{
22 return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
23}
24
25extern void r8a7779_init_delay(void); 13extern void r8a7779_init_delay(void);
26extern void r8a7779_init_irq_extpin(int irlm); 14extern void r8a7779_init_irq_extpin(int irlm);
27extern void r8a7779_init_irq_extpin_dt(int irlm); 15extern void r8a7779_init_irq_extpin_dt(int irlm);
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index a91caad7db7c..e2af00b1bd9d 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -22,11 +22,10 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/sh_intc.h>
26#include <mach/intc.h>
27#include <mach/irqs.h>
28#include <asm/mach-types.h> 25#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include "intc.h"
28#include "irqs.h"
30 29
31enum { 30enum {
32 UNUSED_INTCA = 0, 31 UNUSED_INTCA = 0,
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index 19a26f4579b3..44457a94897b 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -22,15 +22,16 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/sh_intc.h>
26#include <linux/irqchip.h> 25#include <linux/irqchip.h>
27#include <linux/irqchip/arm-gic.h> 26#include <linux/irqchip/arm-gic.h>
28#include <mach/intc.h> 27
29#include <mach/irqs.h>
30#include <mach/sh73a0.h>
31#include <asm/mach-types.h> 28#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
33 30
31#include "intc.h"
32#include "irqs.h"
33#include "sh73a0.h"
34
34enum { 35enum {
35 UNUSED = 0, 36 UNUSED = 0,
36 37
diff --git a/arch/arm/mach-shmobile/include/mach/intc.h b/arch/arm/mach-shmobile/intc.h
index a5603c76cfe0..a5603c76cfe0 100644
--- a/arch/arm/mach-shmobile/include/mach/intc.h
+++ b/arch/arm/mach-shmobile/intc.h
diff --git a/arch/arm/mach-shmobile/irqs.h b/arch/arm/mach-shmobile/irqs.h
new file mode 100644
index 000000000000..4ff2d2aa94f0
--- /dev/null
+++ b/arch/arm/mach-shmobile/irqs.h
@@ -0,0 +1,21 @@
1#ifndef __SHMOBILE_IRQS_H
2#define __SHMOBILE_IRQS_H
3
4#include <linux/sh_intc.h>
5#include <mach/irqs.h>
6
7/* GIC */
8#define gic_spi(nr) ((nr) + 32)
9#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
10
11/* INTCS */
12#define INTCS_VECT_BASE 0x3400
13#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
14#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
15
16/* GPIO IRQ */
17#define _GPIO_IRQ_BASE 2500
18#define GPIO_IRQ_BASE(x) (_GPIO_IRQ_BASE + (32 * x))
19#define GPIO_IRQ(x, y) (_GPIO_IRQ_BASE + (32 * x) + y)
20
21#endif /* __SHMOBILE_IRQS_H */
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index 8cb641c00fdb..fe648f5d8f06 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -16,7 +16,7 @@
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/cp15.h> 17#include <asm/cp15.h>
18#include <asm/smp_plat.h> 18#include <asm/smp_plat.h>
19#include <mach/common.h> 19#include "common.h"
20 20
21static struct { 21static struct {
22 void __iomem *iomem; 22 void __iomem *iomem;
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index 673ad6e80869..64663110ab6c 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -15,7 +15,7 @@
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/smp_plat.h> 16#include <asm/smp_plat.h>
17#include <asm/smp_scu.h> 17#include <asm/smp_scu.h>
18#include <mach/common.h> 18#include "common.h"
19 19
20static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb, 20static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
21 unsigned long action, void *hcpu) 21 unsigned long action, void *hcpu)
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 9ebc246b8d7d..3923e09e966d 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/smp_plat.h> 15#include <asm/smp_plat.h>
16#include <mach/common.h> 16#include "common.h"
17 17
18extern unsigned long shmobile_smp_fn[]; 18extern unsigned long shmobile_smp_fn[];
19extern unsigned long shmobile_smp_arg[]; 19extern unsigned long shmobile_smp_arg[];
diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
index 40b87aa1d448..a0d44d537fa0 100644
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ b/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -10,8 +10,8 @@
10 */ 10 */
11#include <linux/console.h> 11#include <linux/console.h>
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <mach/pm-rmobile.h> 13#include "common.h"
14#include <mach/common.h> 14#include "pm-rmobile.h"
15 15
16#ifdef CONFIG_PM 16#ifdef CONFIG_PM
17static int r8a7740_pd_a4s_suspend(void) 17static int r8a7740_pd_a4s_suspend(void)
diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
index d6fe189b2df6..f0f36cb5ffe7 100644
--- a/arch/arm/mach-shmobile/pm-r8a7779.c
+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -13,20 +13,31 @@
13#include <linux/suspend.h> 13#include <linux/suspend.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/pm_clock.h> 15#include <linux/pm_clock.h>
16#include <linux/pm_domain.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/irq.h> 19#include <linux/irq.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/console.h> 21#include <linux/console.h>
21#include <asm/io.h> 22#include <asm/io.h>
22#include <mach/common.h>
23#include <mach/pm-rcar.h>
24#include <mach/r8a7779.h> 23#include <mach/r8a7779.h>
24#include "common.h"
25#include "pm-rcar.h"
25 26
26/* SYSC */ 27/* SYSC */
27#define SYSCIER 0x0c 28#define SYSCIER 0x0c
28#define SYSCIMR 0x10 29#define SYSCIMR 0x10
29 30
31struct r8a7779_pm_domain {
32 struct generic_pm_domain genpd;
33 struct rcar_sysc_ch ch;
34};
35
36static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
37{
38 return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
39}
40
30#if defined(CONFIG_PM) || defined(CONFIG_SMP) 41#if defined(CONFIG_PM) || defined(CONFIG_SMP)
31 42
32static void __init r8a7779_sysc_init(void) 43static void __init r8a7779_sysc_init(void)
diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c
index fc82839e2c2a..8845433a00b3 100644
--- a/arch/arm/mach-shmobile/pm-r8a7790.c
+++ b/arch/arm/mach-shmobile/pm-r8a7790.c
@@ -11,9 +11,11 @@
11 */ 11 */
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14
14#include <asm/io.h> 15#include <asm/io.h>
15#include <mach/pm-rcar.h> 16
16#include <mach/r8a7790.h> 17#include "pm-rcar.h"
18#include "r8a7790.h"
17 19
18/* SYSC */ 20/* SYSC */
19#define SYSCIER 0x0c 21#define SYSCIER 0x0c
diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
index 1f465a12d1b1..34b8a5674f85 100644
--- a/arch/arm/mach-shmobile/pm-rcar.c
+++ b/arch/arm/mach-shmobile/pm-rcar.c
@@ -13,7 +13,7 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include <mach/pm-rcar.h> 16#include "pm-rcar.h"
17 17
18/* SYSC */ 18/* SYSC */
19#define SYSCSR 0x00 19#define SYSCSR 0x00
diff --git a/arch/arm/mach-shmobile/include/mach/pm-rcar.h b/arch/arm/mach-shmobile/pm-rcar.h
index ef3a1ef628f1..ef3a1ef628f1 100644
--- a/arch/arm/mach-shmobile/include/mach/pm-rcar.h
+++ b/arch/arm/mach-shmobile/pm-rcar.h
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index f710235aff2f..ebdd16e94a84 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -17,7 +17,7 @@
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/pm_clock.h> 18#include <linux/pm_clock.h>
19#include <asm/io.h> 19#include <asm/io.h>
20#include <mach/pm-rmobile.h> 20#include "pm-rmobile.h"
21 21
22/* SYSC */ 22/* SYSC */
23#define SPDCR IOMEM(0xe6180008) 23#define SPDCR IOMEM(0xe6180008)
diff --git a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 690553a06887..690553a06887 100644
--- a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 0de75fd394b9..7e5c2676c489 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -21,13 +21,15 @@
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/bitrev.h> 22#include <linux/bitrev.h>
23#include <linux/console.h> 23#include <linux/console.h>
24
24#include <asm/cpuidle.h> 25#include <asm/cpuidle.h>
25#include <asm/io.h> 26#include <asm/io.h>
26#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
27#include <asm/suspend.h> 28#include <asm/suspend.h>
28#include <mach/common.h> 29
29#include <mach/sh7372.h> 30#include "common.h"
30#include <mach/pm-rmobile.h> 31#include "pm-rmobile.h"
32#include "sh7372.h"
31 33
32/* DBG */ 34/* DBG */
33#define DBGREG1 IOMEM(0xe6100020) 35#define DBGREG1 IOMEM(0xe6100020)
diff --git a/arch/arm/mach-shmobile/pm-sh73a0.c b/arch/arm/mach-shmobile/pm-sh73a0.c
index 99086e98fbbc..a7e466817965 100644
--- a/arch/arm/mach-shmobile/pm-sh73a0.c
+++ b/arch/arm/mach-shmobile/pm-sh73a0.c
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include <linux/suspend.h> 11#include <linux/suspend.h>
12#include <mach/common.h> 12#include "common.h"
13 13
14#ifdef CONFIG_SUSPEND 14#ifdef CONFIG_SUSPEND
15static int sh73a0_enter_suspend(suspend_state_t suspend_state) 15static int sh73a0_enter_suspend(suspend_state_t suspend_state)
diff --git a/arch/arm/mach-shmobile/include/mach/r7s72100.h b/arch/arm/mach-shmobile/r7s72100.h
index 5f34b20ecd4a..efb723c88dd0 100644
--- a/arch/arm/mach-shmobile/include/mach/r7s72100.h
+++ b/arch/arm/mach-shmobile/r7s72100.h
@@ -3,6 +3,5 @@
3 3
4void r7s72100_add_dt_devices(void); 4void r7s72100_add_dt_devices(void);
5void r7s72100_clock_init(void); 5void r7s72100_clock_init(void);
6void r7s72100_init_early(void);
7 6
8#endif /* __ASM_R7S72100_H__ */ 7#endif /* __ASM_R7S72100_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a73a4.h b/arch/arm/mach-shmobile/r8a73a4.h
index ce8bdd1d8a8a..ce8bdd1d8a8a 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a73a4.h
+++ b/arch/arm/mach-shmobile/r8a73a4.h
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/r8a7740.h
index 5e3c9ec06303..1d1a5fd78b6b 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7740.h
+++ b/arch/arm/mach-shmobile/r8a7740.h
@@ -19,8 +19,6 @@
19#ifndef __ASM_R8A7740_H__ 19#ifndef __ASM_R8A7740_H__
20#define __ASM_R8A7740_H__ 20#define __ASM_R8A7740_H__
21 21
22#include <mach/pm-rmobile.h>
23
24/* 22/*
25 * MD_CKx pin 23 * MD_CKx pin
26 */ 24 */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/r8a7778.h
index f4076a50e970..f4076a50e970 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ b/arch/arm/mach-shmobile/r8a7778.h
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/r8a7790.h
index 0b95babe84ba..459827f1369b 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7790.h
+++ b/arch/arm/mach-shmobile/r8a7790.h
@@ -1,8 +1,6 @@
1#ifndef __ASM_R8A7790_H__ 1#ifndef __ASM_R8A7790_H__
2#define __ASM_R8A7790_H__ 2#define __ASM_R8A7790_H__
3 3
4#include <mach/rcar-gen2.h>
5
6/* DMA slave IDs */ 4/* DMA slave IDs */
7enum { 5enum {
8 RCAR_DMA_SLAVE_INVALID, 6 RCAR_DMA_SLAVE_INVALID,
@@ -33,7 +31,6 @@ void r8a7790_add_dt_devices(void);
33void r8a7790_clock_init(void); 31void r8a7790_clock_init(void);
34void r8a7790_pinmux_init(void); 32void r8a7790_pinmux_init(void);
35void r8a7790_pm_init(void); 33void r8a7790_pm_init(void);
36void r8a7790_init_early(void);
37extern struct smp_operations r8a7790_smp_ops; 34extern struct smp_operations r8a7790_smp_ops;
38 35
39#endif /* __ASM_R8A7790_H__ */ 36#endif /* __ASM_R8A7790_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h
index 43f606eb2d82..43f606eb2d82 100644
--- a/arch/arm/mach-shmobile/include/mach/rcar-gen2.h
+++ b/arch/arm/mach-shmobile/rcar-gen2.h
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index d953ff6e78a2..b06a9e8f59a5 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -16,14 +16,13 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 18 */
19#include <linux/clk-provider.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/of_platform.h> 21#include <linux/mm.h>
23#include <mach/common.h>
24#include <asm/mach-types.h> 22#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include "common.h"
27 26
28static struct map_desc emev2_io_desc[] __initdata = { 27static struct map_desc emev2_io_desc[] __initdata = {
29#ifdef CONFIG_SMP 28#ifdef CONFIG_SMP
@@ -42,17 +41,6 @@ static void __init emev2_map_io(void)
42 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc)); 41 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
43} 42}
44 43
45static void __init emev2_init_delay(void)
46{
47 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
48}
49
50static void __init emev2_add_standard_devices_dt(void)
51{
52 of_clk_init(NULL);
53 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
54}
55
56static const char *emev2_boards_compat_dt[] __initconst = { 44static const char *emev2_boards_compat_dt[] __initconst = {
57 "renesas,emev2", 45 "renesas,emev2",
58 NULL, 46 NULL,
@@ -63,8 +51,7 @@ extern struct smp_operations emev2_smp_ops;
63DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)") 51DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
64 .smp = smp_ops(emev2_smp_ops), 52 .smp = smp_ops(emev2_smp_ops),
65 .map_io = emev2_map_io, 53 .map_io = emev2_map_io,
66 .init_early = emev2_init_delay, 54 .init_early = shmobile_init_delay,
67 .init_machine = emev2_add_standard_devices_dt,
68 .init_late = shmobile_init_late, 55 .init_late = shmobile_init_late,
69 .dt_compat = emev2_boards_compat_dt, 56 .dt_compat = emev2_boards_compat_dt,
70MACHINE_END 57MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
index 412e179429cd..4a98b232d316 100644
--- a/arch/arm/mach-shmobile/setup-r7s72100.c
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -22,11 +22,13 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/sh_timer.h> 24#include <linux/sh_timer.h>
25#include <mach/common.h> 25
26#include <mach/irqs.h>
27#include <mach/r7s72100.h>
28#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
29 27
28#include "common.h"
29#include "irqs.h"
30#include "r7s72100.h"
31
30static struct resource mtu2_resources[] __initdata = { 32static struct resource mtu2_resources[] __initdata = {
31 DEFINE_RES_MEM(0xfcff0000, 0x400), 33 DEFINE_RES_MEM(0xfcff0000, 0x400),
32 DEFINE_RES_IRQ_NAMED(gic_iid(139), "tgi0a"), 34 DEFINE_RES_IRQ_NAMED(gic_iid(139), "tgi0a"),
@@ -43,11 +45,6 @@ void __init r7s72100_add_dt_devices(void)
43 r7s72100_register_mtu2(); 45 r7s72100_register_mtu2();
44} 46}
45 47
46void __init r7s72100_init_early(void)
47{
48 shmobile_setup_delay(400, 1, 3); /* Cortex-A9 @ 400MHz */
49}
50
51#ifdef CONFIG_USE_OF 48#ifdef CONFIG_USE_OF
52static const char *r7s72100_boards_compat_dt[] __initdata = { 49static const char *r7s72100_boards_compat_dt[] __initdata = {
53 "renesas,r7s72100", 50 "renesas,r7s72100",
@@ -55,7 +52,7 @@ static const char *r7s72100_boards_compat_dt[] __initdata = {
55}; 52};
56 53
57DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)") 54DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)")
58 .init_early = r7s72100_init_early, 55 .init_early = shmobile_init_delay,
59 .dt_compat = r7s72100_boards_compat_dt, 56 .dt_compat = r7s72100_boards_compat_dt,
60MACHINE_END 57MACHINE_END
61#endif /* CONFIG_USE_OF */ 58#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 9333770cfac2..f470b3cc0b7b 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -24,12 +24,14 @@
24#include <linux/serial_sci.h> 24#include <linux/serial_sci.h>
25#include <linux/sh_dma.h> 25#include <linux/sh_dma.h>
26#include <linux/sh_timer.h> 26#include <linux/sh_timer.h>
27#include <mach/common.h> 27
28#include <mach/dma-register.h>
29#include <mach/irqs.h>
30#include <mach/r8a73a4.h>
31#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
32 29
30#include "common.h"
31#include "dma-register.h"
32#include "irqs.h"
33#include "r8a73a4.h"
34
33static const struct resource pfc_resources[] = { 35static const struct resource pfc_resources[] = {
34 DEFINE_RES_MEM(0xe6050000, 0x9000), 36 DEFINE_RES_MEM(0xe6050000, 0x9000),
35}; 37};
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 35dec233301e..348af358a239 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -31,16 +31,18 @@
31#include <linux/sh_dma.h> 31#include <linux/sh_dma.h>
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <linux/platform_data/sh_ipmmu.h> 33#include <linux/platform_data/sh_ipmmu.h>
34#include <mach/dma-register.h> 34
35#include <mach/r8a7740.h>
36#include <mach/pm-rmobile.h>
37#include <mach/common.h>
38#include <mach/irqs.h>
39#include <asm/mach-types.h> 35#include <asm/mach-types.h>
40#include <asm/mach/map.h> 36#include <asm/mach/map.h>
41#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
42#include <asm/mach/time.h> 38#include <asm/mach/time.h>
43 39
40#include "common.h"
41#include "dma-register.h"
42#include "irqs.h"
43#include "pm-rmobile.h"
44#include "r8a7740.h"
45
44static struct map_desc r8a7740_io_desc[] __initdata = { 46static struct map_desc r8a7740_io_desc[] __initdata = {
45 /* 47 /*
46 * for CPGA/INTC/PFC 48 * for CPGA/INTC/PFC
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index d311ef903b39..2ccc0128b469 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -37,12 +37,14 @@
37#include <linux/usb/ehci_pdriver.h> 37#include <linux/usb/ehci_pdriver.h>
38#include <linux/usb/ohci_pdriver.h> 38#include <linux/usb/ohci_pdriver.h>
39#include <linux/dma-mapping.h> 39#include <linux/dma-mapping.h>
40#include <mach/irqs.h> 40
41#include <mach/r8a7778.h>
42#include <mach/common.h>
43#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
44#include <asm/hardware/cache-l2x0.h> 42#include <asm/hardware/cache-l2x0.h>
45 43
44#include "common.h"
45#include "irqs.h"
46#include "r8a7778.h"
47
46/* SCIF */ 48/* SCIF */
47#define R8A7778_SCIF(index, baseaddr, irq) \ 49#define R8A7778_SCIF(index, baseaddr, irq) \
48static struct plat_sci_port scif##index##_platform_data = { \ 50static struct plat_sci_port scif##index##_platform_data = { \
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index aba4ed652d54..86ec4b625a78 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -40,14 +40,14 @@
40#include <linux/usb/ehci_pdriver.h> 40#include <linux/usb/ehci_pdriver.h>
41#include <linux/usb/ohci_pdriver.h> 41#include <linux/usb/ohci_pdriver.h>
42#include <linux/pm_runtime.h> 42#include <linux/pm_runtime.h>
43#include <mach/irqs.h>
44#include <mach/r8a7779.h> 43#include <mach/r8a7779.h>
45#include <mach/common.h>
46#include <asm/mach-types.h> 44#include <asm/mach-types.h>
47#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
48#include <asm/mach/time.h> 46#include <asm/mach/time.h>
49#include <asm/mach/map.h> 47#include <asm/mach/map.h>
50#include <asm/hardware/cache-l2x0.h> 48#include <asm/hardware/cache-l2x0.h>
49#include "common.h"
50#include "irqs.h"
51 51
52static struct map_desc r8a7779_io_desc[] __initdata = { 52static struct map_desc r8a7779_io_desc[] __initdata = {
53 /* 2M entity map for 0xf0000000 (MPCORE) */ 53 /* 2M entity map for 0xf0000000 (MPCORE) */
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 6bd08b127fa4..6bf84ec48907 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -26,12 +26,15 @@
26#include <linux/serial_sci.h> 26#include <linux/serial_sci.h>
27#include <linux/sh_dma.h> 27#include <linux/sh_dma.h>
28#include <linux/sh_timer.h> 28#include <linux/sh_timer.h>
29#include <mach/common.h> 29
30#include <mach/dma-register.h>
31#include <mach/irqs.h>
32#include <mach/r8a7790.h>
33#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
34 31
32#include "common.h"
33#include "dma-register.h"
34#include "irqs.h"
35#include "r8a7790.h"
36#include "rcar-gen2.h"
37
35/* Audio-DMAC */ 38/* Audio-DMAC */
36#define AUDIO_DMAC_SLAVE(_id, _addr, t, r) \ 39#define AUDIO_DMAC_SLAVE(_id, _addr, t, r) \
37{ \ 40{ \
@@ -307,13 +310,6 @@ void __init r8a7790_add_standard_devices(void)
307 r8a7790_register_audio_dmac(1); 310 r8a7790_register_audio_dmac(1);
308} 311}
309 312
310void __init r8a7790_init_early(void)
311{
312#ifndef CONFIG_ARM_ARCH_TIMER
313 shmobile_setup_delay(1300, 2, 4); /* Cortex-A15 @ 1300MHz */
314#endif
315}
316
317#ifdef CONFIG_USE_OF 313#ifdef CONFIG_USE_OF
318 314
319static const char * const r8a7790_boards_compat_dt[] __initconst = { 315static const char * const r8a7790_boards_compat_dt[] __initconst = {
@@ -323,7 +319,7 @@ static const char * const r8a7790_boards_compat_dt[] __initconst = {
323 319
324DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)") 320DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
325 .smp = smp_ops(r8a7790_smp_ops), 321 .smp = smp_ops(r8a7790_smp_ops),
326 .init_early = r8a7790_init_early, 322 .init_early = shmobile_init_delay,
327 .init_time = rcar_gen2_timer_init, 323 .init_time = rcar_gen2_timer_init,
328 .dt_compat = r8a7790_boards_compat_dt, 324 .dt_compat = r8a7790_boards_compat_dt,
329MACHINE_END 325MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index 04a96ddb3224..f554cda4a96a 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -26,11 +26,11 @@
26#include <linux/platform_data/irq-renesas-irqc.h> 26#include <linux/platform_data/irq-renesas-irqc.h>
27#include <linux/serial_sci.h> 27#include <linux/serial_sci.h>
28#include <linux/sh_timer.h> 28#include <linux/sh_timer.h>
29#include <mach/common.h>
30#include <mach/irqs.h>
31#include <mach/r8a7791.h> 29#include <mach/r8a7791.h>
32#include <mach/rcar-gen2.h>
33#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include "common.h"
32#include "irqs.h"
33#include "rcar-gen2.h"
34 34
35static const struct resource pfc_resources[] __initconst = { 35static const struct resource pfc_resources[] __initconst = {
36 DEFINE_RES_MEM(0xe6060000, 0x250), 36 DEFINE_RES_MEM(0xe6060000, 0x250),
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 542c5a47173f..fdc714ebc4cd 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -22,9 +22,9 @@
22#include <linux/clocksource.h> 22#include <linux/clocksource.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <mach/common.h>
26#include <mach/rcar-gen2.h>
27#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include "common.h"
27#include "rcar-gen2.h"
28 28
29#define MODEMR 0xe6160060 29#define MODEMR 0xe6160060
30 30
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 2a8b9f2a2f54..9cdfcdfd38fc 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -29,20 +29,22 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/serial_sci.h> 30#include <linux/serial_sci.h>
31#include <linux/sh_dma.h> 31#include <linux/sh_dma.h>
32#include <linux/sh_intc.h>
33#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
34#include <linux/pm_domain.h> 33#include <linux/pm_domain.h>
35#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
36#include <linux/platform_data/sh_ipmmu.h> 35#include <linux/platform_data/sh_ipmmu.h>
37#include <mach/dma-register.h> 36
38#include <mach/irqs.h>
39#include <mach/sh7372.h>
40#include <mach/common.h>
41#include <asm/mach/map.h> 37#include <asm/mach/map.h>
42#include <asm/mach-types.h> 38#include <asm/mach-types.h>
43#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
44#include <asm/mach/time.h> 40#include <asm/mach/time.h>
45 41
42#include "common.h"
43#include "dma-register.h"
44#include "irqs.h"
45#include "pm-rmobile.h"
46#include "sh7372.h"
47
46static struct map_desc sh7372_io_desc[] __initdata = { 48static struct map_desc sh7372_io_desc[] __initdata = {
47 /* create a 1:1 entity map for 0xe6xxxxxx 49 /* create a 1:1 entity map for 0xe6xxxxxx
48 * used by CPGA, INTC and PFC. 50 * used by CPGA, INTC and PFC.
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index ad00724a2269..224882151667 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -29,19 +29,20 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/serial_sci.h> 30#include <linux/serial_sci.h>
31#include <linux/sh_dma.h> 31#include <linux/sh_dma.h>
32#include <linux/sh_intc.h>
33#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
34#include <linux/platform_data/sh_ipmmu.h> 33#include <linux/platform_data/sh_ipmmu.h>
35#include <linux/platform_data/irq-renesas-intc-irqpin.h> 34#include <linux/platform_data/irq-renesas-intc-irqpin.h>
36#include <mach/dma-register.h> 35
37#include <mach/irqs.h>
38#include <mach/sh73a0.h>
39#include <mach/common.h>
40#include <asm/mach-types.h> 36#include <asm/mach-types.h>
41#include <asm/mach/map.h> 37#include <asm/mach/map.h>
42#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
43#include <asm/mach/time.h> 39#include <asm/mach/time.h>
44 40
41#include "common.h"
42#include "dma-register.h"
43#include "irqs.h"
44#include "sh73a0.h"
45
45static struct map_desc sh73a0_io_desc[] __initdata = { 46static struct map_desc sh73a0_io_desc[] __initdata = {
46 /* create a 1:1 entity map for 0xe6xxxxxx 47 /* create a 1:1 entity map for 0xe6xxxxxx
47 * used by CPGA, INTC and PFC. 48 * used by CPGA, INTC and PFC.
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/sh7372.h
index 854a9f0ca040..4ad960d5075b 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/sh7372.h
@@ -11,10 +11,6 @@
11#ifndef __ASM_SH7372_H__ 11#ifndef __ASM_SH7372_H__
12#define __ASM_SH7372_H__ 12#define __ASM_SH7372_H__
13 13
14#include <linux/sh_clk.h>
15#include <linux/pm_domain.h>
16#include <mach/pm-rmobile.h>
17
18/* DMA slave IDs */ 14/* DMA slave IDs */
19enum { 15enum {
20 SHDMA_SLAVE_INVALID, 16 SHDMA_SLAVE_INVALID,
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/sh73a0.h
index 359b582dc270..359b582dc270 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/sh73a0.h
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 2dfd748da7f3..6ff1df1df9a7 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -23,9 +23,9 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <mach/common.h>
27#include <asm/smp_plat.h> 26#include <asm/smp_plat.h>
28#include <asm/smp_scu.h> 27#include <asm/smp_scu.h>
28#include "common.h"
29 29
30#define EMEV2_SCU_BASE 0x1e000000 30#define EMEV2_SCU_BASE 0x1e000000
31#define EMEV2_SMU_BASE 0xe0110000 31#define EMEV2_SMU_BASE 0xe0110000
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index e7a3201473d0..c230fc0c3fef 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -23,13 +23,13 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <mach/common.h>
27#include <mach/pm-rcar.h>
28#include <mach/r8a7779.h> 26#include <mach/r8a7779.h>
29#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
30#include <asm/smp_plat.h> 28#include <asm/smp_plat.h>
31#include <asm/smp_scu.h> 29#include <asm/smp_scu.h>
32#include <asm/smp_twd.h> 30#include <asm/smp_twd.h>
31#include "common.h"
32#include "pm-rcar.h"
33 33
34#define AVECR IOMEM(0xfe700040) 34#define AVECR IOMEM(0xfe700040)
35#define R8A7779_SCU_BASE 0xf0000000 35#define R8A7779_SCU_BASE 0xf0000000
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
index 591052799e8f..c256fdfbb5b0 100644
--- a/arch/arm/mach-shmobile/smp-r8a7790.c
+++ b/arch/arm/mach-shmobile/smp-r8a7790.c
@@ -17,10 +17,12 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20
20#include <asm/smp_plat.h> 21#include <asm/smp_plat.h>
21#include <mach/common.h> 22
22#include <mach/pm-rcar.h> 23#include "common.h"
23#include <mach/r8a7790.h> 24#include "pm-rcar.h"
25#include "r8a7790.h"
24 26
25#define RST 0xe6160000 27#define RST 0xe6160000
26#define CA15BAR 0x0020 28#define CA15BAR 0x0020
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
index ec979529f30f..2648d68650e4 100644
--- a/arch/arm/mach-shmobile/smp-r8a7791.c
+++ b/arch/arm/mach-shmobile/smp-r8a7791.c
@@ -18,9 +18,9 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21#include <mach/common.h>
22#include <mach/r8a7791.h> 21#include <mach/r8a7791.h>
23#include <mach/rcar-gen2.h> 22#include "common.h"
23#include "rcar-gen2.h"
24 24
25#define RST 0xe6160000 25#define RST 0xe6160000
26#define CA15BAR 0x0020 26#define CA15BAR 0x0020
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 13ba36a6831f..22d8f87b23e9 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -22,11 +22,13 @@
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <mach/common.h> 25
26#include <mach/sh73a0.h>
27#include <asm/smp_plat.h> 26#include <asm/smp_plat.h>
28#include <asm/smp_twd.h> 27#include <asm/smp_twd.h>
29 28
29#include "common.h"
30#include "sh73a0.h"
31
30#define WUPCR IOMEM(0xe6151010) 32#define WUPCR IOMEM(0xe6151010)
31#define SRESCR IOMEM(0xe6151018) 33#define SRESCR IOMEM(0xe6151018)
32#define PSTR IOMEM(0xe6151040) 34#define PSTR IOMEM(0xe6151040)
diff --git a/arch/arm/mach-spear/Kconfig b/arch/arm/mach-spear/Kconfig
index 0786249b2832..90df2022276a 100644
--- a/arch/arm/mach-spear/Kconfig
+++ b/arch/arm/mach-spear/Kconfig
@@ -14,7 +14,6 @@ if PLAT_SPEAR
14config ARCH_SPEAR13XX 14config ARCH_SPEAR13XX
15 bool "ST SPEAr13xx" 15 bool "ST SPEAr13xx"
16 depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE 16 depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE
17 select ARCH_HAS_CPUFREQ
18 select ARM_GIC 17 select ARM_GIC
19 select GPIO_SPEAR_SPICS 18 select GPIO_SPEAR_SPICS
20 select HAVE_ARM_SCU if SMP 19 select HAVE_ARM_SCU if SMP
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c
index 824b12a56a42..d9ce4d8000f0 100644
--- a/arch/arm/mach-spear/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -42,7 +42,7 @@ static const char * const spear1310_dt_board_compat[] = {
42 * PHYSICAL VIRTUAL 42 * PHYSICAL VIRTUAL
43 * 0xD8000000 0xFA000000 43 * 0xD8000000 0xFA000000
44 */ 44 */
45struct map_desc spear1310_io_desc[] __initdata = { 45static struct map_desc spear1310_io_desc[] __initdata = {
46 { 46 {
47 .virtual = VA_SPEAR1310_RAS_GRP1_BASE, 47 .virtual = VA_SPEAR1310_RAS_GRP1_BASE,
48 .pfn = __phys_to_pfn(SPEAR1310_RAS_GRP1_BASE), 48 .pfn = __phys_to_pfn(SPEAR1310_RAS_GRP1_BASE),
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
index 7b6bff7154e1..c601799b4aea 100644
--- a/arch/arm/mach-spear/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -93,7 +93,7 @@ static int sata_miphy_init(struct device *dev, void __iomem *addr)
93 return 0; 93 return 0;
94} 94}
95 95
96void sata_miphy_exit(struct device *dev) 96static void sata_miphy_exit(struct device *dev)
97{ 97{
98 writel(0, SPEAR1340_PCIE_SATA_CFG); 98 writel(0, SPEAR1340_PCIE_SATA_CFG);
99 writel(0, SPEAR1340_PCIE_MIPHY_CFG); 99 writel(0, SPEAR1340_PCIE_MIPHY_CFG);
@@ -107,7 +107,7 @@ void sata_miphy_exit(struct device *dev)
107 msleep(20); 107 msleep(20);
108} 108}
109 109
110int sata_suspend(struct device *dev) 110static int sata_suspend(struct device *dev)
111{ 111{
112 if (dev->power.power_state.event == PM_EVENT_FREEZE) 112 if (dev->power.power_state.event == PM_EVENT_FREEZE)
113 return 0; 113 return 0;
@@ -117,7 +117,7 @@ int sata_suspend(struct device *dev)
117 return 0; 117 return 0;
118} 118}
119 119
120int sata_resume(struct device *dev) 120static int sata_resume(struct device *dev)
121{ 121{
122 if (dev->power.power_state.event == PM_EVENT_THAW) 122 if (dev->power.power_state.event == PM_EVENT_THAW)
123 return 0; 123 return 0;
diff --git a/arch/arm/mach-spear/spear13xx.c b/arch/arm/mach-spear/spear13xx.c
index c9897ea38980..8b56fe61a492 100644
--- a/arch/arm/mach-spear/spear13xx.c
+++ b/arch/arm/mach-spear/spear13xx.c
@@ -57,7 +57,7 @@ void __init spear13xx_l2x0_init(void)
57 * 0xEC000000 0xFC000000 57 * 0xEC000000 0xFC000000
58 * 0xED000000 0xFB000000 58 * 0xED000000 0xFB000000
59 */ 59 */
60struct map_desc spear13xx_io_desc[] __initdata = { 60static struct map_desc spear13xx_io_desc[] __initdata = {
61 { 61 {
62 .virtual = (unsigned long)VA_PERIP_GRP2_BASE, 62 .virtual = (unsigned long)VA_PERIP_GRP2_BASE,
63 .pfn = __phys_to_pfn(PERIP_GRP2_BASE), 63 .pfn = __phys_to_pfn(PERIP_GRP2_BASE),
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig
index abf9ee9bbc3f..878e9ec97d0f 100644
--- a/arch/arm/mach-sti/Kconfig
+++ b/arch/arm/mach-sti/Kconfig
@@ -1,5 +1,5 @@
1menuconfig ARCH_STI 1menuconfig ARCH_STI
2 bool "STMicroelectronics Consumer Electronics SOCs with Device Trees" if ARCH_MULTI_V7 2 bool "STMicroelectronics Consumer Electronics SOCs" if ARCH_MULTI_V7
3 select ARM_GIC 3 select ARM_GIC
4 select ARM_GLOBAL_TIMER 4 select ARM_GLOBAL_TIMER
5 select PINCTRL 5 select PINCTRL
@@ -11,8 +11,8 @@ menuconfig ARCH_STI
11 select ARM_ERRATA_754322 11 select ARM_ERRATA_754322
12 select ARM_ERRATA_764369 if SMP 12 select ARM_ERRATA_764369 if SMP
13 select ARM_ERRATA_775420 13 select ARM_ERRATA_775420
14 select PL310_ERRATA_753970 if CACHE_PL310 14 select PL310_ERRATA_753970 if CACHE_L2X0
15 select PL310_ERRATA_769419 if CACHE_PL310 15 select PL310_ERRATA_769419 if CACHE_L2X0
16 help 16 help
17 Include support for STiH41x SOCs like STiH415/416 using the device tree 17 Include support for STiH41x SOCs like STiH415/416 using the device tree
18 for discovery 18 for discovery
diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
index fa2c33ffac04..d4b624f8dfcb 100644
--- a/arch/arm/mach-sti/platsmp.c
+++ b/arch/arm/mach-sti/platsmp.c
@@ -36,7 +36,7 @@ static void write_pen_release(int val)
36 36
37static DEFINE_SPINLOCK(boot_lock); 37static DEFINE_SPINLOCK(boot_lock);
38 38
39void sti_secondary_init(unsigned int cpu) 39static void sti_secondary_init(unsigned int cpu)
40{ 40{
41 trace_hardirqs_off(); 41 trace_hardirqs_off();
42 42
@@ -53,7 +53,7 @@ void sti_secondary_init(unsigned int cpu)
53 spin_unlock(&boot_lock); 53 spin_unlock(&boot_lock);
54} 54}
55 55
56int sti_boot_secondary(unsigned int cpu, struct task_struct *idle) 56static int sti_boot_secondary(unsigned int cpu, struct task_struct *idle)
57{ 57{
58 unsigned long timeout; 58 unsigned long timeout;
59 59
@@ -97,7 +97,7 @@ int sti_boot_secondary(unsigned int cpu, struct task_struct *idle)
97 return pen_release != -1 ? -ENOSYS : 0; 97 return pen_release != -1 ? -ENOSYS : 0;
98} 98}
99 99
100void __init sti_smp_prepare_cpus(unsigned int max_cpus) 100static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
101{ 101{
102 void __iomem *scu_base = NULL; 102 void __iomem *scu_base = NULL;
103 struct device_node *np = of_find_compatible_node( 103 struct device_node *np = of_find_compatible_node(
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 3f9587bb51f6..b6085084e0ff 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -12,8 +12,81 @@
12 12
13#include <linux/clk-provider.h> 13#include <linux/clk-provider.h>
14#include <linux/clocksource.h> 14#include <linux/clocksource.h>
15#include <linux/delay.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
20#include <linux/of_platform.h>
21#include <linux/io.h>
22#include <linux/reboot.h>
15 23
16#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/system_misc.h>
27
28#define SUN4I_WATCHDOG_CTRL_REG 0x00
29#define SUN4I_WATCHDOG_CTRL_RESTART BIT(0)
30#define SUN4I_WATCHDOG_MODE_REG 0x04
31#define SUN4I_WATCHDOG_MODE_ENABLE BIT(0)
32#define SUN4I_WATCHDOG_MODE_RESET_ENABLE BIT(1)
33
34#define SUN6I_WATCHDOG1_IRQ_REG 0x00
35#define SUN6I_WATCHDOG1_CTRL_REG 0x10
36#define SUN6I_WATCHDOG1_CTRL_RESTART BIT(0)
37#define SUN6I_WATCHDOG1_CONFIG_REG 0x14
38#define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0)
39#define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1)
40#define SUN6I_WATCHDOG1_MODE_REG 0x18
41#define SUN6I_WATCHDOG1_MODE_ENABLE BIT(0)
42
43static void __iomem *wdt_base;
44
45static void sun4i_restart(enum reboot_mode mode, const char *cmd)
46{
47 if (!wdt_base)
48 return;
49
50 /* Enable timer and set reset bit in the watchdog */
51 writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
52 wdt_base + SUN4I_WATCHDOG_MODE_REG);
53
54 /*
55 * Restart the watchdog. The default (and lowest) interval
56 * value for the watchdog is 0.5s.
57 */
58 writel(SUN4I_WATCHDOG_CTRL_RESTART, wdt_base + SUN4I_WATCHDOG_CTRL_REG);
59
60 while (1) {
61 mdelay(5);
62 writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
63 wdt_base + SUN4I_WATCHDOG_MODE_REG);
64 }
65}
66
67static struct of_device_id sunxi_restart_ids[] = {
68 { .compatible = "allwinner,sun4i-a10-wdt" },
69 { /*sentinel*/ }
70};
71
72static void sunxi_setup_restart(void)
73{
74 struct device_node *np;
75
76 np = of_find_matching_node(NULL, sunxi_restart_ids);
77 if (WARN(!np, "unable to setup watchdog restart"))
78 return;
79
80 wdt_base = of_iomap(np, 0);
81 WARN(!wdt_base, "failed to map watchdog base address");
82}
83
84static void __init sunxi_dt_init(void)
85{
86 sunxi_setup_restart();
87
88 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
89}
17 90
18static const char * const sunxi_board_dt_compat[] = { 91static const char * const sunxi_board_dt_compat[] = {
19 "allwinner,sun4i-a10", 92 "allwinner,sun4i-a10",
@@ -23,7 +96,9 @@ static const char * const sunxi_board_dt_compat[] = {
23}; 96};
24 97
25DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") 98DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
99 .init_machine = sunxi_dt_init,
26 .dt_compat = sunxi_board_dt_compat, 100 .dt_compat = sunxi_board_dt_compat,
101 .restart = sun4i_restart,
27MACHINE_END 102MACHINE_END
28 103
29static const char * const sun6i_board_dt_compat[] = { 104static const char * const sun6i_board_dt_compat[] = {
@@ -51,5 +126,7 @@ static const char * const sun7i_board_dt_compat[] = {
51}; 126};
52 127
53DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family") 128DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
129 .init_machine = sunxi_dt_init,
54 .dt_compat = sun7i_board_dt_compat, 130 .dt_compat = sun7i_board_dt_compat,
131 .restart = sun4i_restart,
55MACHINE_END 132MACHINE_END
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index e16999e5b735..095399618ca5 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_TEGRA 1menuconfig ARCH_TEGRA
2 bool "NVIDIA Tegra" if ARCH_MULTI_V7 2 bool "NVIDIA Tegra" if ARCH_MULTI_V7
3 select ARCH_HAS_CPUFREQ
4 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
5 select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS 4 select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
6 select ARM_GIC 5 select ARM_GIC
@@ -16,8 +15,7 @@ config ARCH_TEGRA
16 help 15 help
17 This enables support for NVIDIA Tegra based systems. 16 This enables support for NVIDIA Tegra based systems.
18 17
19menu "NVIDIA Tegra options" 18if ARCH_TEGRA
20 depends on ARCH_TEGRA
21 19
22config ARCH_TEGRA_2x_SOC 20config ARCH_TEGRA_2x_SOC
23 bool "Enable support for Tegra20 family" 21 bool "Enable support for Tegra20 family"
@@ -69,4 +67,4 @@ config TEGRA_AHB
69 which controls AHB bus master arbitration and some 67 which controls AHB bus master arbitration and some
70 performance parameters(priority, prefech size). 68 performance parameters(priority, prefech size).
71 69
72endmenu 70endif
diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig
index e3a96d7302e9..bc51a71394af 100644
--- a/arch/arm/mach-u300/Kconfig
+++ b/arch/arm/mach-u300/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_U300 1menuconfig ARCH_U300
2 bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5 2 bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5
3 depends on MMU 3 depends on MMU
4 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
@@ -16,8 +16,6 @@ config ARCH_U300
16 16
17if ARCH_U300 17if ARCH_U300
18 18
19menu "ST-Ericsson AB U300/U335 Platform"
20
21config MACH_U300 19config MACH_U300
22 depends on ARCH_U300 20 depends on ARCH_U300
23 bool "U300" 21 bool "U300"
@@ -43,6 +41,4 @@ config MACH_U300_SPIDUMMY
43 you don't need it. Selecting this will activate the 41 you don't need it. Selecting this will activate the
44 SPI framework and ARM PL022 support. 42 SPI framework and ARM PL022 support.
45 43
46endmenu
47
48endif 44endif
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index b41a42da1505..699e8601dbf0 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -1,9 +1,8 @@
1config ARCH_U8500 1menuconfig ARCH_U8500
2 bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7 2 bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7
3 depends on MMU 3 depends on MMU
4 select AB8500_CORE 4 select AB8500_CORE
5 select ABX500_CORE 5 select ABX500_CORE
6 select ARCH_HAS_CPUFREQ
7 select ARCH_REQUIRE_GPIOLIB 6 select ARCH_REQUIRE_GPIOLIB
8 select ARM_AMBA 7 select ARM_AMBA
9 select ARM_ERRATA_754322 8 select ARM_ERRATA_754322
@@ -16,7 +15,7 @@ config ARCH_U8500
16 select PINCTRL 15 select PINCTRL
17 select PINCTRL_ABX500 16 select PINCTRL_ABX500
18 select PINCTRL_NOMADIK 17 select PINCTRL_NOMADIK
19 select PL310_ERRATA_753970 if CACHE_PL310 18 select PL310_ERRATA_753970 if CACHE_L2X0
20 help 19 help
21 Support for ST-Ericsson's Ux500 architecture 20 Support for ST-Ericsson's Ux500 architecture
22 21
@@ -34,8 +33,6 @@ config UX500_SOC_DB8500
34 select REGULATOR 33 select REGULATOR
35 select REGULATOR_DB8500_PRCMU 34 select REGULATOR_DB8500_PRCMU
36 35
37menu "Ux500 target platform (boards)"
38
39config MACH_MOP500 36config MACH_MOP500
40 bool "U8500 Development platform, MOP500 versions" 37 bool "U8500 Development platform, MOP500 versions"
41 select I2C 38 select I2C
@@ -68,8 +65,6 @@ config UX500_AUTO_PLATFORM
68 a working kernel. If everything else is disabled, this 65 a working kernel. If everything else is disabled, this
69 automatically enables MACH_MOP500. 66 automatically enables MACH_MOP500.
70 67
71endmenu
72
73config UX500_DEBUG_UART 68config UX500_DEBUG_UART
74 int "Ux500 UART to use for low-level debug" 69 int "Ux500 UART to use for low-level debug"
75 default 2 70 default 2
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index a4e139aa2441..32d744e91ec2 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -796,7 +796,7 @@ static struct ab8500_regulator_reg_init ab8505_reg_init[] = {
796 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00), 796 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00),
797}; 797};
798 798
799struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = { 799static struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = {
800 /* supplies to the display/camera */ 800 /* supplies to the display/camera */
801 [AB8505_LDO_AUX1] = { 801 [AB8505_LDO_AUX1] = {
802 .constraints = { 802 .constraints = {
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index 842ebedbdd1c..e97ee556f92f 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -7,17 +7,15 @@
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/of.h> 8#include <linux/of.h>
9 9
10#include <asm/cacheflush.h>
11#include <asm/hardware/cache-l2x0.h> 10#include <asm/hardware/cache-l2x0.h>
12 11
13#include "db8500-regs.h" 12#include "db8500-regs.h"
14#include "id.h" 13#include "id.h"
15 14
16static void __iomem *l2x0_base;
17
18static int __init ux500_l2x0_unlock(void) 15static int __init ux500_l2x0_unlock(void)
19{ 16{
20 int i; 17 int i;
18 void __iomem *l2x0_base = __io_address(U8500_L2CC_BASE);
21 19
22 /* 20 /*
23 * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions 21 * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions
@@ -45,23 +43,15 @@ static void ux500_l2c310_write_sec(unsigned long val, unsigned reg)
45 43
46static int __init ux500_l2x0_init(void) 44static int __init ux500_l2x0_init(void)
47{ 45{
48 if (cpu_is_u8500_family() || cpu_is_ux540_family()) 46 /* Multiplatform guard */
49 l2x0_base = __io_address(U8500_L2CC_BASE); 47 if (!((cpu_is_u8500_family() || cpu_is_ux540_family())))
50 else
51 /* Non-Ux500 platform */
52 return -ENODEV; 48 return -ENODEV;
53 49
54 /* Unlock before init */ 50 /* Unlock before init */
55 ux500_l2x0_unlock(); 51 ux500_l2x0_unlock();
56
57 outer_cache.write_sec = ux500_l2c310_write_sec; 52 outer_cache.write_sec = ux500_l2c310_write_sec;
58 53 l2x0_of_init(0, ~0);
59 if (of_have_populated_dt())
60 l2x0_of_init(0, ~0);
61 else
62 l2x0_init(l2x0_base, 0, ~0);
63 54
64 return 0; 55 return 0;
65} 56}
66
67early_initcall(ux500_l2x0_init); 57early_initcall(ux500_l2x0_init);
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index fa308f07fae5..6f63954c8bde 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -33,11 +33,11 @@
33#include "db8500-regs.h" 33#include "db8500-regs.h"
34#include "id.h" 34#include "id.h"
35 35
36struct ab8500_platform_data ab8500_platdata = { 36static struct ab8500_platform_data ab8500_platdata = {
37 .regulator = &ab8500_regulator_plat_data, 37 .regulator = &ab8500_regulator_plat_data,
38}; 38};
39 39
40struct prcmu_pdata db8500_prcmu_pdata = { 40static struct prcmu_pdata db8500_prcmu_pdata = {
41 .ab_platdata = &ab8500_platdata, 41 .ab_platdata = &ab8500_platdata,
42 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET, 42 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
43 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET, 43 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET,
@@ -82,7 +82,7 @@ static struct map_desc u9540_io_desc[] __initdata = {
82 __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K + SZ_8K), 82 __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K + SZ_8K),
83}; 83};
84 84
85void __init u8500_map_io(void) 85static void __init u8500_map_io(void)
86{ 86{
87 /* 87 /*
88 * Map the UARTs early so that the DEBUG_LL stuff continues to work. 88 * Map the UARTs early so that the DEBUG_LL stuff continues to work.
@@ -119,7 +119,7 @@ static irqreturn_t db8500_pmu_handler(int irq, void *dev, irq_handler_t handler)
119 return ret; 119 return ret;
120} 120}
121 121
122struct arm_pmu_platdata db8500_pmu_platdata = { 122static struct arm_pmu_platdata db8500_pmu_platdata = {
123 .handle_irq = db8500_pmu_handler, 123 .handle_irq = db8500_pmu_handler,
124}; 124};
125 125
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index db16b5a04ad5..dbb2970ee7da 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -125,7 +125,7 @@ static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr,
125 soc_dev_attr->revision = ux500_get_revision(); 125 soc_dev_attr->revision = ux500_get_revision();
126} 126}
127 127
128struct device_attribute ux500_soc_attr = 128static const struct device_attribute ux500_soc_attr =
129 __ATTR(process, S_IRUGO, ux500_get_process, NULL); 129 __ATTR(process, S_IRUGO, ux500_get_process, NULL);
130 130
131struct device * __init ux500_soc_device_init(const char *soc_id) 131struct device * __init ux500_soc_device_init(const char *soc_id)
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index 87efda0aa348..ff28d8ad1ed7 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -16,7 +16,7 @@
16#include "db8500-regs.h" 16#include "db8500-regs.h"
17#include "id.h" 17#include "id.h"
18 18
19const static struct of_device_id prcmu_timer_of_match[] __initconst = { 19static const struct of_device_id prcmu_timer_of_match[] __initconst = {
20 { .compatible = "stericsson,db8500-prcmu-timer-4", }, 20 { .compatible = "stericsson,db8500-prcmu-timer-4", },
21 { }, 21 { },
22}; 22};
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index be83ba25f81b..08fb8c89f414 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -28,6 +28,7 @@
28#include <linux/of_platform.h> 28#include <linux/of_platform.h>
29#include <linux/amba/bus.h> 29#include <linux/amba/bus.h>
30#include <linux/amba/clcd.h> 30#include <linux/amba/clcd.h>
31#include <linux/platform_data/video-clcd-versatile.h>
31#include <linux/amba/pl061.h> 32#include <linux/amba/pl061.h>
32#include <linux/amba/mmci.h> 33#include <linux/amba/mmci.h>
33#include <linux/amba/pl022.h> 34#include <linux/amba/pl022.h>
@@ -53,7 +54,6 @@
53#include <mach/platform.h> 54#include <mach/platform.h>
54#include <asm/hardware/timer-sp.h> 55#include <asm/hardware/timer-sp.h>
55 56
56#include <plat/clcd.h>
57#include <plat/sched_clock.h> 57#include <plat/sched_clock.h>
58 58
59#include "core.h" 59#include "core.h"
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 90249cfc37b3..d8b9330f896a 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_VEXPRESS 1menuconfig ARCH_VEXPRESS
2 bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7 2 bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARCH_SUPPORTS_BIG_ENDIAN 4 select ARCH_SUPPORTS_BIG_ENDIAN
@@ -37,14 +37,13 @@ config ARCH_VEXPRESS
37 platforms. The traditional (ATAGs) boot method is not usable on 37 platforms. The traditional (ATAGs) boot method is not usable on
38 these boards with this option. 38 these boards with this option.
39 39
40menu "Versatile Express platform type" 40if ARCH_VEXPRESS
41 depends on ARCH_VEXPRESS
42 41
43config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA 42config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
44 bool "Enable A5 and A9 only errata work-arounds" 43 bool "Enable A5 and A9 only errata work-arounds"
45 default y 44 default y
46 select ARM_ERRATA_720789 45 select ARM_ERRATA_720789
47 select PL310_ERRATA_753970 if CACHE_PL310 46 select PL310_ERRATA_753970 if CACHE_L2X0
48 help 47 help
49 Provides common dependencies for Versatile Express platforms 48 Provides common dependencies for Versatile Express platforms
50 based on Cortex-A5 and Cortex-A9 processors. In order to 49 based on Cortex-A5 and Cortex-A9 processors. In order to
@@ -65,7 +64,6 @@ config ARCH_VEXPRESS_DCSCB
65 64
66config ARCH_VEXPRESS_SPC 65config ARCH_VEXPRESS_SPC
67 bool "Versatile Express Serial Power Controller (SPC)" 66 bool "Versatile Express Serial Power Controller (SPC)"
68 select ARCH_HAS_CPUFREQ
69 select ARCH_HAS_OPP 67 select ARCH_HAS_OPP
70 select PM_OPP 68 select PM_OPP
71 help 69 help
@@ -83,4 +81,4 @@ config ARCH_VEXPRESS_TC2_PM
83 Support for CPU and cluster power management on Versatile Express 81 Support for CPU and cluster power management on Versatile Express
84 with a TC2 (A15x2 A7x3) big.LITTLE core tile. 82 with a TC2 (A15x2 A7x3) big.LITTLE core tile.
85 83
86endmenu 84endif
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 86150d7a2e7d..27bea049380a 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -8,6 +8,7 @@
8#include <linux/platform_device.h> 8#include <linux/platform_device.h>
9#include <linux/amba/bus.h> 9#include <linux/amba/bus.h>
10#include <linux/amba/clcd.h> 10#include <linux/amba/clcd.h>
11#include <linux/platform_data/video-clcd-versatile.h>
11#include <linux/clkdev.h> 12#include <linux/clkdev.h>
12#include <linux/vexpress.h> 13#include <linux/vexpress.h>
13#include <linux/irqchip/arm-gic.h> 14#include <linux/irqchip/arm-gic.h>
@@ -29,8 +30,6 @@
29#include <mach/motherboard.h> 30#include <mach/motherboard.h>
30#include <mach/irqs.h> 31#include <mach/irqs.h>
31 32
32#include <plat/clcd.h>
33
34static struct map_desc ct_ca9x4_io_desc[] __initdata = { 33static struct map_desc ct_ca9x4_io_desc[] __initdata = {
35 { 34 {
36 .virtual = V2T_PERIPH, 35 .virtual = V2T_PERIPH,
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig
index 08f56a41cb55..aaaa24fe4d71 100644
--- a/arch/arm/mach-vt8500/Kconfig
+++ b/arch/arm/mach-vt8500/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_VT8500 1config ARCH_VT8500
2 bool 2 bool
3 select ARCH_HAS_CPUFREQ
4 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
5 select CLKDEV_LOOKUP 4 select CLKDEV_LOOKUP
6 select VT8500_TIMER 5 select VT8500_TIMER
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index 4a73464cb11b..2da7be31e7e2 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -44,7 +44,7 @@
44 44
45static void __iomem *pmc_base; 45static void __iomem *pmc_base;
46 46
47void vt8500_restart(enum reboot_mode mode, const char *cmd) 47static void vt8500_restart(enum reboot_mode mode, const char *cmd)
48{ 48{
49 if (pmc_base) 49 if (pmc_base)
50 writel(1, pmc_base + VT8500_PMSR_REG); 50 writel(1, pmc_base + VT8500_PMSR_REG);
@@ -60,7 +60,7 @@ static struct map_desc vt8500_io_desc[] __initdata = {
60 }, 60 },
61}; 61};
62 62
63void __init vt8500_map_io(void) 63static void __init vt8500_map_io(void)
64{ 64{
65 iotable_init(vt8500_io_desc, ARRAY_SIZE(vt8500_io_desc)); 65 iotable_init(vt8500_io_desc, ARRAY_SIZE(vt8500_io_desc));
66} 66}
@@ -72,7 +72,7 @@ static void vt8500_power_off(void)
72 asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); 72 asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0));
73} 73}
74 74
75void __init vt8500_init(void) 75static void __init vt8500_init(void)
76{ 76{
77 struct device_node *np; 77 struct device_node *np;
78#if defined(CONFIG_FB_VT8500) || defined(CONFIG_FB_WM8505) 78#if defined(CONFIG_FB_VT8500) || defined(CONFIG_FB_WM8505)
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 573e0db1d0f0..0c164f81e72d 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_ZYNQ 1config ARCH_ZYNQ
2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7 2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7
3 select ARCH_HAS_CPUFREQ
4 select ARCH_HAS_OPP 3 select ARCH_HAS_OPP
5 select ARCH_SUPPORTS_BIG_ENDIAN 4 select ARCH_SUPPORTS_BIG_ENDIAN
6 select ARM_AMBA 5 select ARM_AMBA
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index eda0dd0ab97b..c348eaee7ee2 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -889,9 +889,10 @@ config CACHE_L2X0
889 help 889 help
890 This option enables the L2x0 PrimeCell. 890 This option enables the L2x0 PrimeCell.
891 891
892if CACHE_L2X0
893
892config CACHE_PL310 894config CACHE_PL310
893 bool 895 bool
894 depends on CACHE_L2X0
895 default y if CPU_V7 && !(CPU_V6 || CPU_V6K) 896 default y if CPU_V7 && !(CPU_V6 || CPU_V6K)
896 help 897 help
897 This option enables optimisations for the PL310 cache 898 This option enables optimisations for the PL310 cache
@@ -899,7 +900,6 @@ config CACHE_PL310
899 900
900config PL310_ERRATA_588369 901config PL310_ERRATA_588369
901 bool "PL310 errata: Clean & Invalidate maintenance operations do not invalidate clean lines" 902 bool "PL310 errata: Clean & Invalidate maintenance operations do not invalidate clean lines"
902 depends on CACHE_L2X0
903 help 903 help
904 The PL310 L2 cache controller implements three types of Clean & 904 The PL310 L2 cache controller implements three types of Clean &
905 Invalidate maintenance operations: by Physical Address 905 Invalidate maintenance operations: by Physical Address
@@ -912,7 +912,6 @@ config PL310_ERRATA_588369
912 912
913config PL310_ERRATA_727915 913config PL310_ERRATA_727915
914 bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption" 914 bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption"
915 depends on CACHE_L2X0
916 help 915 help
917 PL310 implements the Clean & Invalidate by Way L2 cache maintenance 916 PL310 implements the Clean & Invalidate by Way L2 cache maintenance
918 operation (offset 0x7FC). This operation runs in background so that 917 operation (offset 0x7FC). This operation runs in background so that
@@ -923,7 +922,6 @@ config PL310_ERRATA_727915
923 922
924config PL310_ERRATA_753970 923config PL310_ERRATA_753970
925 bool "PL310 errata: cache sync operation may be faulty" 924 bool "PL310 errata: cache sync operation may be faulty"
926 depends on CACHE_PL310
927 help 925 help
928 This option enables the workaround for the 753970 PL310 (r3p0) erratum. 926 This option enables the workaround for the 753970 PL310 (r3p0) erratum.
929 927
@@ -938,7 +936,6 @@ config PL310_ERRATA_753970
938 936
939config PL310_ERRATA_769419 937config PL310_ERRATA_769419
940 bool "PL310 errata: no automatic Store Buffer drain" 938 bool "PL310 errata: no automatic Store Buffer drain"
941 depends on CACHE_L2X0
942 help 939 help
943 On revisions of the PL310 prior to r3p2, the Store Buffer does 940 On revisions of the PL310 prior to r3p2, the Store Buffer does
944 not automatically drain. This can cause normal, non-cacheable 941 not automatically drain. This can cause normal, non-cacheable
@@ -948,6 +945,8 @@ config PL310_ERRATA_769419
948 on systems with an outer cache, the store buffer is drained 945 on systems with an outer cache, the store buffer is drained
949 explicitly. 946 explicitly.
950 947
948endif
949
951config CACHE_TAUROS2 950config CACHE_TAUROS2
952 bool "Enable the Tauros2 L2 cache controller" 951 bool "Enable the Tauros2 L2 cache controller"
953 depends on (ARCH_DOVE || ARCH_MMP || CPU_PJ4) 952 depends on (ARCH_DOVE || ARCH_MMP || CPU_PJ4)
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index efc5cabf70e0..076172b69422 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -1069,6 +1069,33 @@ static const struct l2c_init_data of_l2c310_data __initconst = {
1069}; 1069};
1070 1070
1071/* 1071/*
1072 * This is a variant of the of_l2c310_data with .sync set to
1073 * NULL. Outer sync operations are not needed when the system is I/O
1074 * coherent, and potentially harmful in certain situations (PCIe/PL310
1075 * deadlock on Armada 375/38x due to hardware I/O coherency). The
1076 * other operations are kept because they are infrequent (therefore do
1077 * not cause the deadlock in practice) and needed for secondary CPU
1078 * boot and other power management activities.
1079 */
1080static const struct l2c_init_data of_l2c310_coherent_data __initconst = {
1081 .type = "L2C-310 Coherent",
1082 .way_size_0 = SZ_8K,
1083 .num_lock = 8,
1084 .of_parse = l2c310_of_parse,
1085 .enable = l2c310_enable,
1086 .fixup = l2c310_fixup,
1087 .save = l2c310_save,
1088 .outer_cache = {
1089 .inv_range = l2c210_inv_range,
1090 .clean_range = l2c210_clean_range,
1091 .flush_range = l2c210_flush_range,
1092 .flush_all = l2c210_flush_all,
1093 .disable = l2c310_disable,
1094 .resume = l2c310_resume,
1095 },
1096};
1097
1098/*
1072 * Note that the end addresses passed to Linux primitives are 1099 * Note that the end addresses passed to Linux primitives are
1073 * noninclusive, while the hardware cache range operations use 1100 * noninclusive, while the hardware cache range operations use
1074 * inclusive start and end addresses. 1101 * inclusive start and end addresses.
@@ -1487,6 +1514,10 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
1487 1514
1488 data = of_match_node(l2x0_ids, np)->data; 1515 data = of_match_node(l2x0_ids, np)->data;
1489 1516
1517 if (of_device_is_compatible(np, "arm,pl310-cache") &&
1518 of_property_read_bool(np, "arm,io-coherent"))
1519 data = &of_l2c310_coherent_data;
1520
1490 old_aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); 1521 old_aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
1491 if (old_aux != ((old_aux & aux_mask) | aux_val)) { 1522 if (old_aux != ((old_aux & aux_mask) | aux_val)) {
1492 pr_warn("L2C: platform modifies aux control register: 0x%08x -> 0x%08x\n", 1523 pr_warn("L2C: platform modifies aux control register: 0x%08x -> 0x%08x\n",
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index da1874f9f8cf..a014dfacd5ca 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -300,6 +300,7 @@ void __init sanity_check_meminfo(void)
300 sanity_check_meminfo_mpu(); 300 sanity_check_meminfo_mpu();
301 end = memblock_end_of_DRAM(); 301 end = memblock_end_of_DRAM();
302 high_memory = __va(end - 1) + 1; 302 high_memory = __va(end - 1) + 1;
303 memblock_set_current_limit(end);
303} 304}
304 305
305/* 306/*
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index 97448c3acf38..ba0d58e1a2a2 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -502,6 +502,7 @@ __\name\()_proc_info:
502 .long \cpu_val 502 .long \cpu_val
503 .long \cpu_mask 503 .long \cpu_mask
504 .long PMD_TYPE_SECT | \ 504 .long PMD_TYPE_SECT | \
505 PMD_SECT_CACHEABLE | \
505 PMD_BIT4 | \ 506 PMD_BIT4 | \
506 PMD_SECT_AP_WRITE | \ 507 PMD_SECT_AP_WRITE | \
507 PMD_SECT_AP_READ 508 PMD_SECT_AP_READ
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 243dfcb2ca0e..6910c8669742 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -15,7 +15,7 @@ config PLAT_SAMSUNG
15 15
16config PLAT_S5P 16config PLAT_S5P
17 bool 17 bool
18 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210) 18 depends on ARCH_S5PV210
19 default y 19 default y
20 select ARCH_REQUIRE_GPIOLIB 20 select ARCH_REQUIRE_GPIOLIB
21 select ARM_VIC 21 select ARM_VIC
@@ -29,33 +29,21 @@ config PLAT_S5P
29 29
30config SAMSUNG_PM 30config SAMSUNG_PM
31 bool 31 bool
32 depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5P64X0 || S5P_PM) 32 depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || S5P_PM)
33 default y 33 default y
34 help 34 help
35 Base platform power management code for samsung code 35 Base platform power management code for samsung code
36 36
37if PLAT_SAMSUNG 37if PLAT_SAMSUNG
38menu "Samsung Common options"
38 39
39# boot configurations 40# boot configurations
40 41
41comment "Boot options" 42comment "Boot options"
42 43
43config S3C_BOOT_ERROR_RESET
44 bool "S3C Reboot on decompression error"
45 help
46 Say y here to use the watchdog to reset the system if the
47 kernel decompressor detects an error during decompression.
48
49config S3C_BOOT_UART_FORCE_FIFO
50 bool "Force UART FIFO on during boot process"
51 default y
52 help
53 Say Y here to force the UART FIFOs on during the kernel
54 uncompressor
55
56
57config S3C_LOWLEVEL_UART_PORT 44config S3C_LOWLEVEL_UART_PORT
58 int "S3C UART to use for low-level messages" 45 int "S3C UART to use for low-level messages"
46 depends on ARCH_S3C64XX
59 default 0 47 default 0
60 help 48 help
61 Choice of which UART port to use for the low-level messages, 49 Choice of which UART port to use for the low-level messages,
@@ -90,14 +78,14 @@ config SAMSUNG_CLKSRC
90 used by newer systems such as the S3C64XX. 78 used by newer systems such as the S3C64XX.
91 79
92config S5P_CLOCK 80config S5P_CLOCK
93 def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210) 81 def_bool ARCH_S5PV210
94 help 82 help
95 Support common clock part for ARCH_S5P and ARCH_EXYNOS SoCs 83 Support common clock part for ARCH_S5P and ARCH_EXYNOS SoCs
96 84
97# options for IRQ support 85# options for IRQ support
98 86
99config S5P_IRQ 87config S5P_IRQ
100 def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210) 88 def_bool ARCH_S5PV210
101 help 89 help
102 Support common interrupt part for ARCH_S5P SoCs 90 Support common interrupt part for ARCH_S5P SoCs
103 91
@@ -105,7 +93,6 @@ config S5P_EXT_INT
105 bool 93 bool
106 help 94 help
107 Use the external interrupts (other than GPIO interrupts.) 95 Use the external interrupts (other than GPIO interrupts.)
108 Note: Do not choose this for S5P6440 and S5P6450.
109 96
110config S5P_GPIO_INT 97config S5P_GPIO_INT
111 bool 98 bool
@@ -120,22 +107,6 @@ config S5P_GPIO_DRVSTR
120 Internal configuration to get and set correct GPIO driver strength 107 Internal configuration to get and set correct GPIO driver strength
121 helper 108 helper
122 109
123config SAMSUNG_GPIO_EXTRA
124 int "Number of additional GPIO pins"
125 default 128 if SAMSUNG_GPIO_EXTRA128
126 default 64 if SAMSUNG_GPIO_EXTRA64
127 default 0
128 help
129 Use additional GPIO space in addition to the GPIO's the SOC
130 provides. This allows expanding the GPIO space for use with
131 GPIO expanders.
132
133config SAMSUNG_GPIO_EXTRA64
134 bool
135
136config SAMSUNG_GPIO_EXTRA128
137 bool
138
139config S3C_GPIO_SPACE 110config S3C_GPIO_SPACE
140 int "Space between gpio banks" 111 int "Space between gpio banks"
141 default 0 112 default 0
@@ -155,7 +126,7 @@ config S3C_GPIO_TRACK
155 126
156config S5P_DEV_UART 127config S5P_DEV_UART
157 def_bool y 128 def_bool y
158 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210) 129 depends on ARCH_S5PV210
159 130
160# ADC driver 131# ADC driver
161 132
@@ -407,17 +378,16 @@ config SAMSUNG_PM_GPIO
407 Include legacy GPIO power management code for platforms not using 378 Include legacy GPIO power management code for platforms not using
408 pinctrl-samsung driver. 379 pinctrl-samsung driver.
409 380
410endif
411
412config SAMSUNG_DMADEV 381config SAMSUNG_DMADEV
413 bool 382 bool "Use legacy Samsung DMA abstraction"
414 select ARM_AMBA 383 depends on CPU_S5PV210 || ARCH_S3C64XX
415 select DMADEVICES 384 select DMADEVICES
416 select PL330_DMA if (ARCH_EXYNOS5 || ARCH_EXYNOS4 || CPU_S5PV210 || CPU_S5PC100 || \ 385 default y
417 CPU_S5P6450 || CPU_S5P6440)
418 help 386 help
419 Use DMA device engine for PL330 DMAC. 387 Use DMA device engine for PL330 DMAC.
420 388
389endif
390
421config S5P_DEV_MFC 391config S5P_DEV_MFC
422 bool 392 bool
423 help 393 help
@@ -487,7 +457,6 @@ config S5P_PM
487 bool 457 bool
488 help 458 help
489 Common code for power management support on S5P and newer SoCs 459 Common code for power management support on S5P and newer SoCs
490 Note: Do not select this for S5P6440 and S5P6450.
491 460
492config S5P_SLEEP 461config S5P_SLEEP
493 bool 462 bool
@@ -503,4 +472,5 @@ config DEBUG_S3C_UART
503 default "2" if DEBUG_S3C_UART2 472 default "2" if DEBUG_S3C_UART2
504 default "3" if DEBUG_S3C_UART3 473 default "3" if DEBUG_S3C_UART3
505 474
475endmenu
506endif 476endif
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 79690f2f6d3f..468352633101 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -43,7 +43,7 @@ enum s3c_cpu_type {
43 TYPE_ADCV1, /* S3C24XX */ 43 TYPE_ADCV1, /* S3C24XX */
44 TYPE_ADCV11, /* S3C2443 */ 44 TYPE_ADCV11, /* S3C2443 */
45 TYPE_ADCV12, /* S3C2416, S3C2450 */ 45 TYPE_ADCV12, /* S3C2416, S3C2450 */
46 TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ 46 TYPE_ADCV2, /* S3C64XX */
47 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ 47 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
48}; 48};
49 49
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 5a237db9f9eb..d1d4659025bb 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -33,13 +33,6 @@ extern unsigned long samsung_cpu_id;
33#define S3C6410_CPU_ID 0x36410000 33#define S3C6410_CPU_ID 0x36410000
34#define S3C64XX_CPU_MASK 0xFFFFF000 34#define S3C64XX_CPU_MASK 0xFFFFF000
35 35
36#define S5P6440_CPU_ID 0x56440000
37#define S5P6450_CPU_ID 0x36450000
38#define S5P64XX_CPU_MASK 0xFFFFF000
39
40#define S5PC100_CPU_ID 0x43100000
41#define S5PC100_CPU_MASK 0xFFFFF000
42
43#define S5PV210_CPU_ID 0x43110000 36#define S5PV210_CPU_ID 0x43110000
44#define S5PV210_CPU_MASK 0xFFFFF000 37#define S5PV210_CPU_MASK 0xFFFFF000
45 38
@@ -54,9 +47,6 @@ IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
54IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) 47IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
55IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) 48IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
56IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) 49IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
57IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
58IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
59IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
60IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK) 50IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
61 51
62#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 52#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
@@ -86,24 +76,6 @@ IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
86# define soc_is_s3c64xx() 0 76# define soc_is_s3c64xx() 0
87#endif 77#endif
88 78
89#if defined(CONFIG_CPU_S5P6440)
90# define soc_is_s5p6440() is_samsung_s5p6440()
91#else
92# define soc_is_s5p6440() 0
93#endif
94
95#if defined(CONFIG_CPU_S5P6450)
96# define soc_is_s5p6450() is_samsung_s5p6450()
97#else
98# define soc_is_s5p6450() 0
99#endif
100
101#if defined(CONFIG_CPU_S5PC100)
102# define soc_is_s5pc100() is_samsung_s5pc100()
103#else
104# define soc_is_s5pc100() 0
105#endif
106
107#if defined(CONFIG_CPU_S5PV210) 79#if defined(CONFIG_CPU_S5PV210)
108# define soc_is_s5pv210() is_samsung_s5pv210() 80# define soc_is_s5pv210() is_samsung_s5pv210()
109#else 81#else
@@ -177,7 +149,6 @@ extern struct bus_type s3c2440_subsys;
177extern struct bus_type s3c2442_subsys; 149extern struct bus_type s3c2442_subsys;
178extern struct bus_type s3c2443_subsys; 150extern struct bus_type s3c2443_subsys;
179extern struct bus_type s3c6410_subsys; 151extern struct bus_type s3c6410_subsys;
180extern struct bus_type s5p64x0_subsys;
181extern struct bus_type s5pv210_subsys; 152extern struct bus_type s5pv210_subsys;
182 153
183extern void (*s5pc1xx_idle)(void); 154extern void (*s5pc1xx_idle)(void);
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index eece188ed188..5f5a28d08c2e 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -94,23 +94,6 @@ extern struct platform_device s5p_device_mixer;
94extern struct platform_device s5p_device_onenand; 94extern struct platform_device s5p_device_onenand;
95extern struct platform_device s5p_device_sdo; 95extern struct platform_device s5p_device_sdo;
96 96
97extern struct platform_device s5p6440_device_iis;
98extern struct platform_device s5p6440_device_pcm;
99
100extern struct platform_device s5p6450_device_iis0;
101extern struct platform_device s5p6450_device_iis1;
102extern struct platform_device s5p6450_device_iis2;
103extern struct platform_device s5p6450_device_pcm0;
104
105
106extern struct platform_device s5pc100_device_ac97;
107extern struct platform_device s5pc100_device_iis0;
108extern struct platform_device s5pc100_device_iis1;
109extern struct platform_device s5pc100_device_iis2;
110extern struct platform_device s5pc100_device_pcm0;
111extern struct platform_device s5pc100_device_pcm1;
112extern struct platform_device s5pc100_device_spdif;
113
114extern struct platform_device s5pv210_device_ac97; 97extern struct platform_device s5pv210_device_ac97;
115extern struct platform_device s5pv210_device_iis0; 98extern struct platform_device s5pv210_device_iis0;
116extern struct platform_device s5pv210_device_iis1; 99extern struct platform_device s5pv210_device_iis1;
diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h
index 9ae507270785..5a0e26afb961 100644
--- a/arch/arm/plat-samsung/include/plat/fb.h
+++ b/arch/arm/plat-samsung/include/plat/fb.h
@@ -41,13 +41,6 @@ extern void s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd);
41extern void s3c64xx_fb_gpio_setup_24bpp(void); 41extern void s3c64xx_fb_gpio_setup_24bpp(void);
42 42
43/** 43/**
44 * s5pc100_fb_gpio_setup_24bpp() - S5PC100 setup function for 24bpp LCD
45 *
46 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
47 */
48extern void s5pc100_fb_gpio_setup_24bpp(void);
49
50/**
51 * s5pv210_fb_gpio_setup_24bpp() - S5PV210/S5PC110 setup function for 24bpp LCD 44 * s5pv210_fb_gpio_setup_24bpp() - S5PV210/S5PC110 setup function for 24bpp LCD
52 * 45 *
53 * Initialise the GPIO for an 24bpp LCD display on the RGB interface. 46 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
@@ -61,11 +54,4 @@ extern void s5pv210_fb_gpio_setup_24bpp(void);
61 */ 54 */
62extern void exynos4_fimd0_gpio_setup_24bpp(void); 55extern void exynos4_fimd0_gpio_setup_24bpp(void);
63 56
64/**
65 * s5p64x0_fb_gpio_setup_24bpp() - S5P6440/S5P6450 setup function for 24bpp LCD
66 *
67 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
68 */
69extern void s5p64x0_fb_gpio_setup_24bpp(void);
70
71#endif /* __PLAT_S3C_FB_H */ 57#endif /* __PLAT_S3C_FB_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index cf5aae5b0975..6ce11bfdc37e 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -14,6 +14,9 @@
14#ifndef __PLAT_SAMSUNG_GPIO_CORE_H 14#ifndef __PLAT_SAMSUNG_GPIO_CORE_H
15#define __PLAT_SAMSUNG_GPIO_CORE_H 15#define __PLAT_SAMSUNG_GPIO_CORE_H
16 16
17/* Bring in machine-local definitions, especially S3C_GPIO_END */
18#include <mach/gpio-samsung.h>
19
17#define GPIOCON_OFF (0x00) 20#define GPIOCON_OFF (0x00)
18#define GPIODAT_OFF (0x04) 21#define GPIODAT_OFF (0x04)
19 22
diff --git a/arch/arm/plat-samsung/include/plat/s5p-clock.h b/arch/arm/plat-samsung/include/plat/s5p-clock.h
index 8364b4bea8b8..acacc4b88a39 100644
--- a/arch/arm/plat-samsung/include/plat/s5p-clock.h
+++ b/arch/arm/plat-samsung/include/plat/s5p-clock.h
@@ -57,7 +57,7 @@ extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable);
57extern int s5p_epll_enable(struct clk *clk, int enable); 57extern int s5p_epll_enable(struct clk *clk, int enable);
58extern unsigned long s5p_epll_get_rate(struct clk *clk); 58extern unsigned long s5p_epll_get_rate(struct clk *clk);
59 59
60/* SPDIF clk operations common for S5PC100/V210/C110 and Exynos4 */ 60/* SPDIF clk operations common for S5PV210/C110 and Exynos4 */
61extern int s5p_spdif_set_rate(struct clk *clk, unsigned long rate); 61extern int s5p_spdif_set_rate(struct clk *clk, unsigned long rate);
62extern unsigned long s5p_spdif_get_rate(struct clk *clk); 62extern unsigned long s5p_spdif_get_rate(struct clk *clk);
63 63
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index bf650218b40e..f84b6cbc8745 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -56,9 +56,6 @@ extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
56extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 56extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
57extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 57extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
58extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 58extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
59extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
60extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
61extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
62extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 59extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
63extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 60extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
64extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 61extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
@@ -68,10 +65,6 @@ extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
68extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 65extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
69extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 66extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
70extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w); 67extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
71extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
72extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
73extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
74extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
75 68
76/* S3C2416 SDHCI setup */ 69/* S3C2416 SDHCI setup */
77 70
@@ -151,76 +144,6 @@ static inline void s3c6400_default_sdhci2(void) { }
151 144
152#endif /* CONFIG_S3C64XX_SETUP_SDHCI */ 145#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
153 146
154/* S5P64X0 SDHCI setup */
155
156#ifdef CONFIG_S5P64X0_SETUP_SDHCI_GPIO
157static inline void s5p64x0_default_sdhci0(void)
158{
159#ifdef CONFIG_S3C_DEV_HSMMC
160 s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
161#endif
162}
163
164static inline void s5p64x0_default_sdhci1(void)
165{
166#ifdef CONFIG_S3C_DEV_HSMMC1
167 s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
168#endif
169}
170
171static inline void s5p6440_default_sdhci2(void)
172{
173#ifdef CONFIG_S3C_DEV_HSMMC2
174 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
175#endif
176}
177
178static inline void s5p6450_default_sdhci2(void)
179{
180#ifdef CONFIG_S3C_DEV_HSMMC2
181 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
182#endif
183}
184
185#else
186static inline void s5p64x0_default_sdhci0(void) { }
187static inline void s5p64x0_default_sdhci1(void) { }
188static inline void s5p6440_default_sdhci2(void) { }
189static inline void s5p6450_default_sdhci2(void) { }
190
191#endif /* CONFIG_S5P64X0_SETUP_SDHCI_GPIO */
192
193/* S5PC100 SDHCI setup */
194
195#ifdef CONFIG_S5PC100_SETUP_SDHCI
196static inline void s5pc100_default_sdhci0(void)
197{
198#ifdef CONFIG_S3C_DEV_HSMMC
199 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
200#endif
201}
202
203static inline void s5pc100_default_sdhci1(void)
204{
205#ifdef CONFIG_S3C_DEV_HSMMC1
206 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
207#endif
208}
209
210static inline void s5pc100_default_sdhci2(void)
211{
212#ifdef CONFIG_S3C_DEV_HSMMC2
213 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
214#endif
215}
216
217#else
218static inline void s5pc100_default_sdhci0(void) { }
219static inline void s5pc100_default_sdhci1(void) { }
220static inline void s5pc100_default_sdhci2(void) { }
221
222#endif /* CONFIG_S5PC100_SETUP_SDHCI */
223
224/* S5PV210 SDHCI setup */ 147/* S5PV210 SDHCI setup */
225 148
226#ifdef CONFIG_S5PV210_SETUP_SDHCI 149#ifdef CONFIG_S5PV210_SETUP_SDHCI
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index da268813901b..adc91662f72b 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -19,9 +19,7 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21 21
22#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX)
23#include <mach/gpio-samsung.h> 22#include <mach/gpio-samsung.h>
24#endif
25 23
26#include <plat/gpio-core.h> 24#include <plat/gpio-core.h>
27#include <plat/pm.h> 25#include <plat/pm.h>
diff --git a/arch/arm/plat-samsung/s5p-irq-eint.c b/arch/arm/plat-samsung/s5p-irq-eint.c
index ebee4dc11a94..dcd8c2cbf5bb 100644
--- a/arch/arm/plat-samsung/s5p-irq-eint.c
+++ b/arch/arm/plat-samsung/s5p-irq-eint.c
@@ -14,7 +14,6 @@
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/gpio.h>
18#include <linux/irqchip/arm-vic.h> 17#include <linux/irqchip/arm-vic.h>
19#include <linux/of.h> 18#include <linux/of.h>
20 19
@@ -26,6 +25,7 @@
26 25
27#include <plat/gpio-cfg.h> 26#include <plat/gpio-cfg.h>
28#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <mach/gpio-samsung.h>
29 29
30static inline void s5p_irq_eint_mask(struct irq_data *data) 30static inline void s5p_irq_eint_mask(struct irq_data *data)
31{ 31{
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index fce41e93b6a4..a301ca2c7d00 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -3,9 +3,6 @@ if PLAT_VERSATILE
3config PLAT_VERSATILE_CLOCK 3config PLAT_VERSATILE_CLOCK
4 bool 4 bool
5 5
6config PLAT_VERSATILE_CLCD
7 bool
8
9config PLAT_VERSATILE_SCHED_CLOCK 6config PLAT_VERSATILE_SCHED_CLOCK
10 def_bool y 7 def_bool y
11 8
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index 2e0c472958ae..03c4900ac3f4 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -1,6 +1,5 @@
1ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include 1ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
2 2
3obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o 3obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o
4obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
5obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o 4obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o
6obj-$(CONFIG_SMP) += headsmp.o platsmp.o 5obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/plat-versatile/clcd.c b/arch/arm/plat-versatile/clcd.c
deleted file mode 100644
index 6628cc27efc5..000000000000
--- a/arch/arm/plat-versatile/clcd.c
+++ /dev/null
@@ -1,182 +0,0 @@
1#include <linux/device.h>
2#include <linux/dma-mapping.h>
3#include <linux/amba/bus.h>
4#include <linux/amba/clcd.h>
5#include <plat/clcd.h>
6
7static struct clcd_panel vga = {
8 .mode = {
9 .name = "VGA",
10 .refresh = 60,
11 .xres = 640,
12 .yres = 480,
13 .pixclock = 39721,
14 .left_margin = 40,
15 .right_margin = 24,
16 .upper_margin = 32,
17 .lower_margin = 11,
18 .hsync_len = 96,
19 .vsync_len = 2,
20 .sync = 0,
21 .vmode = FB_VMODE_NONINTERLACED,
22 },
23 .width = -1,
24 .height = -1,
25 .tim2 = TIM2_BCD | TIM2_IPC,
26 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
27 .caps = CLCD_CAP_5551 | CLCD_CAP_565 | CLCD_CAP_888,
28 .bpp = 16,
29};
30
31static struct clcd_panel xvga = {
32 .mode = {
33 .name = "XVGA",
34 .refresh = 60,
35 .xres = 1024,
36 .yres = 768,
37 .pixclock = 15748,
38 .left_margin = 152,
39 .right_margin = 48,
40 .upper_margin = 23,
41 .lower_margin = 3,
42 .hsync_len = 104,
43 .vsync_len = 4,
44 .sync = 0,
45 .vmode = FB_VMODE_NONINTERLACED,
46 },
47 .width = -1,
48 .height = -1,
49 .tim2 = TIM2_BCD | TIM2_IPC,
50 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
51 .caps = CLCD_CAP_5551 | CLCD_CAP_565 | CLCD_CAP_888,
52 .bpp = 16,
53};
54
55/* Sanyo TM38QV67A02A - 3.8 inch QVGA (320x240) Color TFT */
56static struct clcd_panel sanyo_tm38qv67a02a = {
57 .mode = {
58 .name = "Sanyo TM38QV67A02A",
59 .refresh = 116,
60 .xres = 320,
61 .yres = 240,
62 .pixclock = 100000,
63 .left_margin = 6,
64 .right_margin = 6,
65 .upper_margin = 5,
66 .lower_margin = 5,
67 .hsync_len = 6,
68 .vsync_len = 6,
69 .sync = 0,
70 .vmode = FB_VMODE_NONINTERLACED,
71 },
72 .width = -1,
73 .height = -1,
74 .tim2 = TIM2_BCD,
75 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
76 .caps = CLCD_CAP_5551,
77 .bpp = 16,
78};
79
80static struct clcd_panel sanyo_2_5_in = {
81 .mode = {
82 .name = "Sanyo QVGA Portrait",
83 .refresh = 116,
84 .xres = 240,
85 .yres = 320,
86 .pixclock = 100000,
87 .left_margin = 20,
88 .right_margin = 10,
89 .upper_margin = 2,
90 .lower_margin = 2,
91 .hsync_len = 10,
92 .vsync_len = 2,
93 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
94 .vmode = FB_VMODE_NONINTERLACED,
95 },
96 .width = -1,
97 .height = -1,
98 .tim2 = TIM2_IVS | TIM2_IHS | TIM2_IPC,
99 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
100 .caps = CLCD_CAP_5551,
101 .bpp = 16,
102};
103
104/* Epson L2F50113T00 - 2.2 inch 176x220 Color TFT */
105static struct clcd_panel epson_l2f50113t00 = {
106 .mode = {
107 .name = "Epson L2F50113T00",
108 .refresh = 390,
109 .xres = 176,
110 .yres = 220,
111 .pixclock = 62500,
112 .left_margin = 3,
113 .right_margin = 2,
114 .upper_margin = 1,
115 .lower_margin = 0,
116 .hsync_len = 3,
117 .vsync_len = 2,
118 .sync = 0,
119 .vmode = FB_VMODE_NONINTERLACED,
120 },
121 .width = -1,
122 .height = -1,
123 .tim2 = TIM2_BCD | TIM2_IPC,
124 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
125 .caps = CLCD_CAP_5551,
126 .bpp = 16,
127};
128
129static struct clcd_panel *panels[] = {
130 &vga,
131 &xvga,
132 &sanyo_tm38qv67a02a,
133 &sanyo_2_5_in,
134 &epson_l2f50113t00,
135};
136
137struct clcd_panel *versatile_clcd_get_panel(const char *name)
138{
139 int i;
140
141 for (i = 0; i < ARRAY_SIZE(panels); i++)
142 if (strcmp(panels[i]->mode.name, name) == 0)
143 break;
144
145 if (i < ARRAY_SIZE(panels))
146 return panels[i];
147
148 pr_err("CLCD: couldn't get parameters for panel %s\n", name);
149
150 return NULL;
151}
152
153int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
154{
155 dma_addr_t dma;
156
157 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
158 &dma, GFP_KERNEL);
159 if (!fb->fb.screen_base) {
160 pr_err("CLCD: unable to map framebuffer\n");
161 return -ENOMEM;
162 }
163
164 fb->fb.fix.smem_start = dma;
165 fb->fb.fix.smem_len = framesize;
166
167 return 0;
168}
169
170int versatile_clcd_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vma)
171{
172 return dma_mmap_writecombine(&fb->dev->dev, vma,
173 fb->fb.screen_base,
174 fb->fb.fix.smem_start,
175 fb->fb.fix.smem_len);
176}
177
178void versatile_clcd_remove_dma(struct clcd_fb *fb)
179{
180 dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
181 fb->fb.screen_base, fb->fb.fix.smem_start);
182}
diff --git a/arch/arm/plat-versatile/include/plat/clcd.h b/arch/arm/plat-versatile/include/plat/clcd.h
deleted file mode 100644
index 6bb6a1d2019b..000000000000
--- a/arch/arm/plat-versatile/include/plat/clcd.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef PLAT_CLCD_H
2#define PLAT_CLCD_H
3
4struct clcd_panel *versatile_clcd_get_panel(const char *);
5int versatile_clcd_setup_dma(struct clcd_fb *, unsigned long);
6int versatile_clcd_mmap_dma(struct clcd_fb *, struct vm_area_struct *);
7void versatile_clcd_remove_dma(struct clcd_fb *);
8
9#endif
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7295419165e1..a474de346be6 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,8 +1,9 @@
1config ARM64 1config ARM64
2 def_bool y 2 def_bool y
3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
4 select ARCH_USE_CMPXCHG_LOCKREF 4 select ARCH_HAS_OPP
5 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 5 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
6 select ARCH_USE_CMPXCHG_LOCKREF
6 select ARCH_WANT_OPTIONAL_GPIOLIB 7 select ARCH_WANT_OPTIONAL_GPIOLIB
7 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION 8 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
8 select ARCH_WANT_FRAME_POINTERS 9 select ARCH_WANT_FRAME_POINTERS
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
index 1247ca1200b1..6541962f5d70 100644
--- a/arch/arm64/boot/dts/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm-mustang.dts
@@ -24,3 +24,7 @@
24 reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */ 24 reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */
25 }; 25 };
26}; 26};
27
28&serial0 {
29 status = "ok";
30};
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
index c5f0a47a1375..40aa96ce13c4 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -273,8 +273,9 @@
273 }; 273 };
274 274
275 serial0: serial@1c020000 { 275 serial0: serial@1c020000 {
276 status = "disabled";
276 device_type = "serial"; 277 device_type = "serial";
277 compatible = "ns16550"; 278 compatible = "ns16550a";
278 reg = <0 0x1c020000 0x0 0x1000>; 279 reg = <0 0x1c020000 0x0 0x1000>;
279 reg-shift = <2>; 280 reg-shift = <2>;
280 clock-frequency = <10000000>; /* Updated by bootloader */ 281 clock-frequency = <10000000>; /* Updated by bootloader */
@@ -282,6 +283,39 @@
282 interrupts = <0x0 0x4c 0x4>; 283 interrupts = <0x0 0x4c 0x4>;
283 }; 284 };
284 285
286 serial1: serial@1c021000 {
287 status = "disabled";
288 device_type = "serial";
289 compatible = "ns16550a";
290 reg = <0 0x1c021000 0x0 0x1000>;
291 reg-shift = <2>;
292 clock-frequency = <10000000>; /* Updated by bootloader */
293 interrupt-parent = <&gic>;
294 interrupts = <0x0 0x4d 0x4>;
295 };
296
297 serial2: serial@1c022000 {
298 status = "disabled";
299 device_type = "serial";
300 compatible = "ns16550a";
301 reg = <0 0x1c022000 0x0 0x1000>;
302 reg-shift = <2>;
303 clock-frequency = <10000000>; /* Updated by bootloader */
304 interrupt-parent = <&gic>;
305 interrupts = <0x0 0x4e 0x4>;
306 };
307
308 serial3: serial@1c023000 {
309 status = "disabled";
310 device_type = "serial";
311 compatible = "ns16550a";
312 reg = <0 0x1c023000 0x0 0x1000>;
313 reg-shift = <2>;
314 clock-frequency = <10000000>; /* Updated by bootloader */
315 interrupt-parent = <&gic>;
316 interrupts = <0x0 0x4f 0x4>;
317 };
318
285 phy1: phy@1f21a000 { 319 phy1: phy@1f21a000 {
286 compatible = "apm,xgene-phy"; 320 compatible = "apm,xgene-phy";
287 reg = <0x0 0x1f21a000 0x0 0x100>; 321 reg = <0x0 0x1f21a000 0x0 0x100>;
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 157e1d8d9a47..3421f316f5dc 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -6,9 +6,18 @@ CONFIG_NO_HZ_IDLE=y
6CONFIG_HIGH_RES_TIMERS=y 6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_BSD_PROCESS_ACCT=y 7CONFIG_BSD_PROCESS_ACCT=y
8CONFIG_BSD_PROCESS_ACCT_V3=y 8CONFIG_BSD_PROCESS_ACCT_V3=y
9CONFIG_TASKSTATS=y
10CONFIG_TASK_DELAY_ACCT=y
11CONFIG_TASK_XACCT=y
12CONFIG_TASK_IO_ACCOUNTING=y
9CONFIG_IKCONFIG=y 13CONFIG_IKCONFIG=y
10CONFIG_IKCONFIG_PROC=y 14CONFIG_IKCONFIG_PROC=y
11CONFIG_LOG_BUF_SHIFT=14 15CONFIG_LOG_BUF_SHIFT=14
16CONFIG_RESOURCE_COUNTERS=y
17CONFIG_MEMCG=y
18CONFIG_MEMCG_SWAP=y
19CONFIG_MEMCG_KMEM=y
20CONFIG_CGROUP_HUGETLB=y
12# CONFIG_UTS_NS is not set 21# CONFIG_UTS_NS is not set
13# CONFIG_IPC_NS is not set 22# CONFIG_IPC_NS is not set
14# CONFIG_PID_NS is not set 23# CONFIG_PID_NS is not set
@@ -27,6 +36,7 @@ CONFIG_ARCH_VEXPRESS=y
27CONFIG_ARCH_XGENE=y 36CONFIG_ARCH_XGENE=y
28CONFIG_SMP=y 37CONFIG_SMP=y
29CONFIG_PREEMPT=y 38CONFIG_PREEMPT=y
39CONFIG_KSM=y
30CONFIG_TRANSPARENT_HUGEPAGE=y 40CONFIG_TRANSPARENT_HUGEPAGE=y
31CONFIG_CMA=y 41CONFIG_CMA=y
32CONFIG_CMDLINE="console=ttyAMA0" 42CONFIG_CMDLINE="console=ttyAMA0"
@@ -45,6 +55,7 @@ CONFIG_IP_PNP_BOOTP=y
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 55CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46CONFIG_DEVTMPFS=y 56CONFIG_DEVTMPFS=y
47CONFIG_DMA_CMA=y 57CONFIG_DMA_CMA=y
58CONFIG_BLK_DEV_LOOP=y
48CONFIG_VIRTIO_BLK=y 59CONFIG_VIRTIO_BLK=y
49# CONFIG_SCSI_PROC_FS is not set 60# CONFIG_SCSI_PROC_FS is not set
50CONFIG_BLK_DEV_SD=y 61CONFIG_BLK_DEV_SD=y
@@ -53,6 +64,7 @@ CONFIG_ATA=y
53CONFIG_PATA_PLATFORM=y 64CONFIG_PATA_PLATFORM=y
54CONFIG_PATA_OF_PLATFORM=y 65CONFIG_PATA_OF_PLATFORM=y
55CONFIG_NETDEVICES=y 66CONFIG_NETDEVICES=y
67CONFIG_TUN=y
56CONFIG_SMC91X=y 68CONFIG_SMC91X=y
57CONFIG_SMSC911X=y 69CONFIG_SMSC911X=y
58# CONFIG_WLAN is not set 70# CONFIG_WLAN is not set
@@ -85,6 +97,8 @@ CONFIG_EXT3_FS=y
85# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 97# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
86# CONFIG_EXT3_FS_XATTR is not set 98# CONFIG_EXT3_FS_XATTR is not set
87CONFIG_EXT4_FS=y 99CONFIG_EXT4_FS=y
100CONFIG_FANOTIFY=y
101CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
88CONFIG_FUSE_FS=y 102CONFIG_FUSE_FS=y
89CONFIG_CUSE=y 103CONFIG_CUSE=y
90CONFIG_VFAT_FS=y 104CONFIG_VFAT_FS=y
@@ -104,6 +118,7 @@ CONFIG_DEBUG_KERNEL=y
104CONFIG_LOCKUP_DETECTOR=y 118CONFIG_LOCKUP_DETECTOR=y
105# CONFIG_SCHED_DEBUG is not set 119# CONFIG_SCHED_DEBUG is not set
106# CONFIG_FTRACE is not set 120# CONFIG_FTRACE is not set
121CONFIG_SECURITY=y
107CONFIG_CRYPTO_ANSI_CPRNG=y 122CONFIG_CRYPTO_ANSI_CPRNG=y
108CONFIG_ARM64_CRYPTO=y 123CONFIG_ARM64_CRYPTO=y
109CONFIG_CRYPTO_SHA1_ARM64_CE=y 124CONFIG_CRYPTO_SHA1_ARM64_CE=y
diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S
index b9e6eaf41c9b..dc457015884e 100644
--- a/arch/arm64/crypto/ghash-ce-core.S
+++ b/arch/arm64/crypto/ghash-ce-core.S
@@ -3,14 +3,6 @@
3 * 3 *
4 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org> 4 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
5 * 5 *
6 * Based on arch/x86/crypto/ghash-pmullni-intel_asm.S
7 *
8 * Copyright (c) 2009 Intel Corp.
9 * Author: Huang Ying <ying.huang@intel.com>
10 * Vinodh Gopal
11 * Erdinc Ozturk
12 * Deniz Karakoyunlu
13 *
14 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License version 2 as published 7 * under the terms of the GNU General Public License version 2 as published
16 * by the Free Software Foundation. 8 * by the Free Software Foundation.
@@ -19,13 +11,15 @@
19#include <linux/linkage.h> 11#include <linux/linkage.h>
20#include <asm/assembler.h> 12#include <asm/assembler.h>
21 13
22 DATA .req v0 14 SHASH .req v0
23 SHASH .req v1 15 SHASH2 .req v1
24 IN1 .req v2
25 T1 .req v2 16 T1 .req v2
26 T2 .req v3 17 T2 .req v3
27 T3 .req v4 18 MASK .req v4
28 VZR .req v5 19 XL .req v5
20 XM .req v6
21 XH .req v7
22 IN1 .req v7
29 23
30 .text 24 .text
31 .arch armv8-a+crypto 25 .arch armv8-a+crypto
@@ -35,61 +29,51 @@
35 * struct ghash_key const *k, const char *head) 29 * struct ghash_key const *k, const char *head)
36 */ 30 */
37ENTRY(pmull_ghash_update) 31ENTRY(pmull_ghash_update)
38 ld1 {DATA.16b}, [x1]
39 ld1 {SHASH.16b}, [x3] 32 ld1 {SHASH.16b}, [x3]
40 eor VZR.16b, VZR.16b, VZR.16b 33 ld1 {XL.16b}, [x1]
34 movi MASK.16b, #0xe1
35 ext SHASH2.16b, SHASH.16b, SHASH.16b, #8
36 shl MASK.2d, MASK.2d, #57
37 eor SHASH2.16b, SHASH2.16b, SHASH.16b
41 38
42 /* do the head block first, if supplied */ 39 /* do the head block first, if supplied */
43 cbz x4, 0f 40 cbz x4, 0f
44 ld1 {IN1.2d}, [x4] 41 ld1 {T1.2d}, [x4]
45 b 1f 42 b 1f
46 43
470: ld1 {IN1.2d}, [x2], #16 440: ld1 {T1.2d}, [x2], #16
48 sub w0, w0, #1 45 sub w0, w0, #1
491: ext IN1.16b, IN1.16b, IN1.16b, #8
50CPU_LE( rev64 IN1.16b, IN1.16b )
51 eor DATA.16b, DATA.16b, IN1.16b
52 46
53 /* multiply DATA by SHASH in GF(2^128) */ 471: /* multiply XL by SHASH in GF(2^128) */
54 ext T2.16b, DATA.16b, DATA.16b, #8 48CPU_LE( rev64 T1.16b, T1.16b )
55 ext T3.16b, SHASH.16b, SHASH.16b, #8
56 eor T2.16b, T2.16b, DATA.16b
57 eor T3.16b, T3.16b, SHASH.16b
58 49
59 pmull2 T1.1q, SHASH.2d, DATA.2d // a1 * b1 50 ext T2.16b, XL.16b, XL.16b, #8
60 pmull DATA.1q, SHASH.1d, DATA.1d // a0 * b0 51 ext IN1.16b, T1.16b, T1.16b, #8
61 pmull T2.1q, T2.1d, T3.1d // (a1 + a0)(b1 + b0) 52 eor T1.16b, T1.16b, T2.16b
62 eor T2.16b, T2.16b, T1.16b // (a0 * b1) + (a1 * b0) 53 eor XL.16b, XL.16b, IN1.16b
63 eor T2.16b, T2.16b, DATA.16b
64 54
65 ext T3.16b, VZR.16b, T2.16b, #8 55 pmull2 XH.1q, SHASH.2d, XL.2d // a1 * b1
66 ext T2.16b, T2.16b, VZR.16b, #8 56 eor T1.16b, T1.16b, XL.16b
67 eor DATA.16b, DATA.16b, T3.16b 57 pmull XL.1q, SHASH.1d, XL.1d // a0 * b0
68 eor T1.16b, T1.16b, T2.16b // <T1:DATA> is result of 58 pmull XM.1q, SHASH2.1d, T1.1d // (a1 + a0)(b1 + b0)
69 // carry-less multiplication
70 59
71 /* first phase of the reduction */ 60 ext T1.16b, XL.16b, XH.16b, #8
72 shl T3.2d, DATA.2d, #1 61 eor T2.16b, XL.16b, XH.16b
73 eor T3.16b, T3.16b, DATA.16b 62 eor XM.16b, XM.16b, T1.16b
74 shl T3.2d, T3.2d, #5 63 eor XM.16b, XM.16b, T2.16b
75 eor T3.16b, T3.16b, DATA.16b 64 pmull T2.1q, XL.1d, MASK.1d
76 shl T3.2d, T3.2d, #57
77 ext T2.16b, VZR.16b, T3.16b, #8
78 ext T3.16b, T3.16b, VZR.16b, #8
79 eor DATA.16b, DATA.16b, T2.16b
80 eor T1.16b, T1.16b, T3.16b
81 65
82 /* second phase of the reduction */ 66 mov XH.d[0], XM.d[1]
83 ushr T2.2d, DATA.2d, #5 67 mov XM.d[1], XL.d[0]
84 eor T2.16b, T2.16b, DATA.16b 68
85 ushr T2.2d, T2.2d, #1 69 eor XL.16b, XM.16b, T2.16b
86 eor T2.16b, T2.16b, DATA.16b 70 ext T2.16b, XL.16b, XL.16b, #8
87 ushr T2.2d, T2.2d, #1 71 pmull XL.1q, XL.1d, MASK.1d
88 eor T1.16b, T1.16b, T2.16b 72 eor T2.16b, T2.16b, XH.16b
89 eor DATA.16b, DATA.16b, T1.16b 73 eor XL.16b, XL.16b, T2.16b
90 74
91 cbnz w0, 0b 75 cbnz w0, 0b
92 76
93 st1 {DATA.16b}, [x1] 77 st1 {XL.16b}, [x1]
94 ret 78 ret
95ENDPROC(pmull_ghash_update) 79ENDPROC(pmull_ghash_update)
diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index b92baf3f68c7..833ec1e3f3e9 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -67,11 +67,12 @@ static int ghash_update(struct shash_desc *desc, const u8 *src,
67 blocks = len / GHASH_BLOCK_SIZE; 67 blocks = len / GHASH_BLOCK_SIZE;
68 len %= GHASH_BLOCK_SIZE; 68 len %= GHASH_BLOCK_SIZE;
69 69
70 kernel_neon_begin_partial(6); 70 kernel_neon_begin_partial(8);
71 pmull_ghash_update(blocks, ctx->digest, src, key, 71 pmull_ghash_update(blocks, ctx->digest, src, key,
72 partial ? ctx->buf : NULL); 72 partial ? ctx->buf : NULL);
73 kernel_neon_end(); 73 kernel_neon_end();
74 src += blocks * GHASH_BLOCK_SIZE; 74 src += blocks * GHASH_BLOCK_SIZE;
75 partial = 0;
75 } 76 }
76 if (len) 77 if (len)
77 memcpy(ctx->buf + partial, src, len); 78 memcpy(ctx->buf + partial, src, len);
@@ -88,7 +89,7 @@ static int ghash_final(struct shash_desc *desc, u8 *dst)
88 89
89 memset(ctx->buf + partial, 0, GHASH_BLOCK_SIZE - partial); 90 memset(ctx->buf + partial, 0, GHASH_BLOCK_SIZE - partial);
90 91
91 kernel_neon_begin_partial(6); 92 kernel_neon_begin_partial(8);
92 pmull_ghash_update(1, ctx->digest, ctx->buf, key, NULL); 93 pmull_ghash_update(1, ctx->digest, ctx->buf, key, NULL);
93 kernel_neon_end(); 94 kernel_neon_end();
94 } 95 }
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 42c7eecd2bb6..0b3fcf86e6ba 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -30,7 +30,6 @@ generic-y += msgbuf.h
30generic-y += mutex.h 30generic-y += mutex.h
31generic-y += pci.h 31generic-y += pci.h
32generic-y += poll.h 32generic-y += poll.h
33generic-y += posix_types.h
34generic-y += preempt.h 33generic-y += preempt.h
35generic-y += resource.h 34generic-y += resource.h
36generic-y += rwsem.h 35generic-y += rwsem.h
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 3a4572ec3273..dc82e52acdb3 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -26,8 +26,6 @@
26#include <xen/xen.h> 26#include <xen/xen.h>
27#include <asm/xen/hypervisor.h> 27#include <asm/xen/hypervisor.h>
28 28
29#define ARCH_HAS_DMA_GET_REQUIRED_MASK
30
31#define DMA_ERROR_CODE (~(dma_addr_t)0) 29#define DMA_ERROR_CODE (~(dma_addr_t)0)
32extern struct dma_map_ops *dma_ops; 30extern struct dma_map_ops *dma_ops;
33extern struct dma_map_ops coherent_swiotlb_dma_ops; 31extern struct dma_map_ops coherent_swiotlb_dma_ops;
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 598cc384fc1c..e0ccceb317d9 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -246,7 +246,7 @@ static inline pmd_t pte_pmd(pte_t pte)
246#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd))) 246#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd)))
247#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd))) 247#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))
248#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd))) 248#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
249#define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) &= ~PMD_TYPE_MASK)) 249#define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) & ~PMD_TYPE_MASK))
250 250
251#define __HAVE_ARCH_PMD_WRITE 251#define __HAVE_ARCH_PMD_WRITE
252#define pmd_write(pmd) pte_write(pmd_pte(pmd)) 252#define pmd_write(pmd) pte_write(pmd_pte(pmd))
@@ -292,7 +292,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
292#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ 292#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
293 PMD_TYPE_SECT) 293 PMD_TYPE_SECT)
294 294
295#ifdef ARM64_64K_PAGES 295#ifdef CONFIG_ARM64_64K_PAGES
296#define pud_sect(pud) (0) 296#define pud_sect(pud) (0)
297#else 297#else
298#define pud_sect(pud) ((pud_val(pud) & PUD_TYPE_MASK) == \ 298#define pud_sect(pud) ((pud_val(pud) & PUD_TYPE_MASK) == \
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index a429b5940be2..501000fadb6f 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -21,6 +21,10 @@
21 21
22#include <uapi/asm/ptrace.h> 22#include <uapi/asm/ptrace.h>
23 23
24/* Current Exception Level values, as contained in CurrentEL */
25#define CurrentEL_EL1 (1 << 2)
26#define CurrentEL_EL2 (2 << 2)
27
24/* AArch32-specific ptrace requests */ 28/* AArch32-specific ptrace requests */
25#define COMPAT_PTRACE_GETREGS 12 29#define COMPAT_PTRACE_GETREGS 12
26#define COMPAT_PTRACE_SETREGS 13 30#define COMPAT_PTRACE_SETREGS 13
diff --git a/arch/arm64/include/uapi/asm/posix_types.h b/arch/arm64/include/uapi/asm/posix_types.h
new file mode 100644
index 000000000000..7985ff60ca3f
--- /dev/null
+++ b/arch/arm64/include/uapi/asm/posix_types.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_POSIX_TYPES_H
2#define __ASM_POSIX_TYPES_H
3
4typedef unsigned short __kernel_old_uid_t;
5typedef unsigned short __kernel_old_gid_t;
6#define __kernel_old_uid_t __kernel_old_uid_t
7
8#include <asm-generic/posix_types.h>
9
10#endif /* __ASM_POSIX_TYPES_H */
diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h
index b72cf405b3fe..ee469be1ae1d 100644
--- a/arch/arm64/include/uapi/asm/sigcontext.h
+++ b/arch/arm64/include/uapi/asm/sigcontext.h
@@ -58,7 +58,7 @@ struct fpsimd_context {
58 58
59struct esr_context { 59struct esr_context {
60 struct _aarch64_ctx head; 60 struct _aarch64_ctx head;
61 u64 esr; 61 __u64 esr;
62}; 62};
63 63
64#endif /* _UAPI__ASM_SIGCONTEXT_H */ 64#endif /* _UAPI__ASM_SIGCONTEXT_H */
diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S
index 66716c9b9e5f..619b1dd7bcde 100644
--- a/arch/arm64/kernel/efi-entry.S
+++ b/arch/arm64/kernel/efi-entry.S
@@ -78,8 +78,7 @@ ENTRY(efi_stub_entry)
78 78
79 /* Turn off Dcache and MMU */ 79 /* Turn off Dcache and MMU */
80 mrs x0, CurrentEL 80 mrs x0, CurrentEL
81 cmp x0, #PSR_MODE_EL2t 81 cmp x0, #CurrentEL_EL2
82 ccmp x0, #PSR_MODE_EL2h, #0x4, ne
83 b.ne 1f 82 b.ne 1f
84 mrs x0, sctlr_el2 83 mrs x0, sctlr_el2
85 bic x0, x0, #1 << 0 // clear SCTLR.M 84 bic x0, x0, #1 << 0 // clear SCTLR.M
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index b051871f2965..aa5f9fcbf9ee 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -205,7 +205,7 @@ ENDPROC(ftrace_graph_caller)
205 * 205 *
206 * Run ftrace_return_to_handler() before going back to parent. 206 * Run ftrace_return_to_handler() before going back to parent.
207 * @fp is checked against the value passed by ftrace_graph_caller() 207 * @fp is checked against the value passed by ftrace_graph_caller()
208 * only when CONFIG_FUNCTION_GRAPH_FP_TEST is enabled. 208 * only when CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST is enabled.
209 */ 209 */
210ENTRY(return_to_handler) 210ENTRY(return_to_handler)
211 str x0, [sp, #-16]! 211 str x0, [sp, #-16]!
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index bf017f4ffb4f..9ce04ba6bcb0 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -279,7 +279,6 @@ el1_sp_pc:
279 */ 279 */
280 mrs x0, far_el1 280 mrs x0, far_el1
281 enable_dbg 281 enable_dbg
282 mov x1, x25
283 mov x2, sp 282 mov x2, sp
284 b do_sp_pc_abort 283 b do_sp_pc_abort
285el1_undef: 284el1_undef:
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index a96d3a6a63f6..a2c1195abb7f 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -270,8 +270,7 @@ ENDPROC(stext)
270 */ 270 */
271ENTRY(el2_setup) 271ENTRY(el2_setup)
272 mrs x0, CurrentEL 272 mrs x0, CurrentEL
273 cmp x0, #PSR_MODE_EL2t 273 cmp x0, #CurrentEL_EL2
274 ccmp x0, #PSR_MODE_EL2h, #0x4, ne
275 b.ne 1f 274 b.ne 1f
276 mrs x0, sctlr_el2 275 mrs x0, sctlr_el2
277CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2 276CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 3e926b9c0641..9fde010c945f 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -655,11 +655,16 @@ static int compat_gpr_get(struct task_struct *target,
655 reg = task_pt_regs(target)->regs[idx]; 655 reg = task_pt_regs(target)->regs[idx];
656 } 656 }
657 657
658 ret = copy_to_user(ubuf, &reg, sizeof(reg)); 658 if (kbuf) {
659 if (ret) 659 memcpy(kbuf, &reg, sizeof(reg));
660 break; 660 kbuf += sizeof(reg);
661 661 } else {
662 ubuf += sizeof(reg); 662 ret = copy_to_user(ubuf, &reg, sizeof(reg));
663 if (ret)
664 break;
665
666 ubuf += sizeof(reg);
667 }
663 } 668 }
664 669
665 return ret; 670 return ret;
@@ -689,11 +694,16 @@ static int compat_gpr_set(struct task_struct *target,
689 unsigned int idx = start + i; 694 unsigned int idx = start + i;
690 compat_ulong_t reg; 695 compat_ulong_t reg;
691 696
692 ret = copy_from_user(&reg, ubuf, sizeof(reg)); 697 if (kbuf) {
693 if (ret) 698 memcpy(&reg, kbuf, sizeof(reg));
694 return ret; 699 kbuf += sizeof(reg);
700 } else {
701 ret = copy_from_user(&reg, ubuf, sizeof(reg));
702 if (ret)
703 return ret;
695 704
696 ubuf += sizeof(reg); 705 ubuf += sizeof(reg);
706 }
697 707
698 switch (idx) { 708 switch (idx) {
699 case 15: 709 case 15:
@@ -827,6 +837,7 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off,
827 compat_ulong_t val) 837 compat_ulong_t val)
828{ 838{
829 int ret; 839 int ret;
840 mm_segment_t old_fs = get_fs();
830 841
831 if (off & 3 || off >= COMPAT_USER_SZ) 842 if (off & 3 || off >= COMPAT_USER_SZ)
832 return -EIO; 843 return -EIO;
@@ -834,10 +845,13 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off,
834 if (off >= sizeof(compat_elf_gregset_t)) 845 if (off >= sizeof(compat_elf_gregset_t))
835 return 0; 846 return 0;
836 847
848 set_fs(KERNEL_DS);
837 ret = copy_regset_from_user(tsk, &user_aarch32_view, 849 ret = copy_regset_from_user(tsk, &user_aarch32_view,
838 REGSET_COMPAT_GPR, off, 850 REGSET_COMPAT_GPR, off,
839 sizeof(compat_ulong_t), 851 sizeof(compat_ulong_t),
840 &val); 852 &val);
853 set_fs(old_fs);
854
841 return ret; 855 return ret;
842} 856}
843 857
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index e4193e3adc7f..0d64089d28b5 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -79,7 +79,8 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr)
79 return; 79 return;
80 80
81 if (!test_and_set_bit(PG_dcache_clean, &page->flags)) { 81 if (!test_and_set_bit(PG_dcache_clean, &page->flags)) {
82 __flush_dcache_area(page_address(page), PAGE_SIZE); 82 __flush_dcache_area(page_address(page),
83 PAGE_SIZE << compound_order(page));
83 __flush_icache_all(); 84 __flush_icache_all();
84 } else if (icache_is_aivivt()) { 85 } else if (icache_is_aivivt()) {
85 __flush_icache_all(); 86 __flush_icache_all();
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 091d428d64ac..f43db8a69262 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -71,7 +71,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
71 /* 4GB maximum for 32-bit only capable devices */ 71 /* 4GB maximum for 32-bit only capable devices */
72 if (IS_ENABLED(CONFIG_ZONE_DMA)) { 72 if (IS_ENABLED(CONFIG_ZONE_DMA)) {
73 unsigned long max_dma_phys = 73 unsigned long max_dma_phys =
74 (unsigned long)dma_to_phys(NULL, DMA_BIT_MASK(32) + 1); 74 (unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1);
75 max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); 75 max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT));
76 zone_size[ZONE_DMA] = max_dma - min; 76 zone_size[ZONE_DMA] = max_dma - min;
77 } 77 }
@@ -126,6 +126,8 @@ static void arm64_memory_present(void)
126 126
127void __init arm64_memblock_init(void) 127void __init arm64_memblock_init(void)
128{ 128{
129 phys_addr_t dma_phys_limit = 0;
130
129 /* Register the kernel text, kernel data and initrd with memblock */ 131 /* Register the kernel text, kernel data and initrd with memblock */
130 memblock_reserve(__pa(_text), _end - _text); 132 memblock_reserve(__pa(_text), _end - _text);
131#ifdef CONFIG_BLK_DEV_INITRD 133#ifdef CONFIG_BLK_DEV_INITRD
@@ -141,7 +143,11 @@ void __init arm64_memblock_init(void)
141 memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE); 143 memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE);
142 144
143 early_init_fdt_scan_reserved_mem(); 145 early_init_fdt_scan_reserved_mem();
144 dma_contiguous_reserve(0); 146
147 /* 4GB maximum for 32-bit only capable devices */
148 if (IS_ENABLED(CONFIG_ZONE_DMA))
149 dma_phys_limit = dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1;
150 dma_contiguous_reserve(dma_phys_limit);
145 151
146 memblock_allow_resize(); 152 memblock_allow_resize();
147 memblock_dump_all(); 153 memblock_dump_all();
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 1a871b78e570..344387a55406 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -242,7 +242,7 @@ struct ioc {
242 struct pci_dev *sac_only_dev; 242 struct pci_dev *sac_only_dev;
243}; 243};
244 244
245static struct ioc *ioc_list; 245static struct ioc *ioc_list, *ioc_found;
246static int reserve_sba_gart = 1; 246static int reserve_sba_gart = 1;
247 247
248static SBA_INLINE void sba_mark_invalid(struct ioc *, dma_addr_t, size_t); 248static SBA_INLINE void sba_mark_invalid(struct ioc *, dma_addr_t, size_t);
@@ -1809,20 +1809,13 @@ static struct ioc_iommu ioc_iommu_info[] __initdata = {
1809 { SX2000_IOC_ID, "sx2000", NULL }, 1809 { SX2000_IOC_ID, "sx2000", NULL },
1810}; 1810};
1811 1811
1812static struct ioc * 1812static void ioc_init(unsigned long hpa, struct ioc *ioc)
1813ioc_init(unsigned long hpa, void *handle)
1814{ 1813{
1815 struct ioc *ioc;
1816 struct ioc_iommu *info; 1814 struct ioc_iommu *info;
1817 1815
1818 ioc = kzalloc(sizeof(*ioc), GFP_KERNEL);
1819 if (!ioc)
1820 return NULL;
1821
1822 ioc->next = ioc_list; 1816 ioc->next = ioc_list;
1823 ioc_list = ioc; 1817 ioc_list = ioc;
1824 1818
1825 ioc->handle = handle;
1826 ioc->ioc_hpa = ioremap(hpa, 0x1000); 1819 ioc->ioc_hpa = ioremap(hpa, 0x1000);
1827 1820
1828 ioc->func_id = READ_REG(ioc->ioc_hpa + IOC_FUNC_ID); 1821 ioc->func_id = READ_REG(ioc->ioc_hpa + IOC_FUNC_ID);
@@ -1863,8 +1856,6 @@ ioc_init(unsigned long hpa, void *handle)
1863 "%s %d.%d HPA 0x%lx IOVA space %dMb at 0x%lx\n", 1856 "%s %d.%d HPA 0x%lx IOVA space %dMb at 0x%lx\n",
1864 ioc->name, (ioc->rev >> 4) & 0xF, ioc->rev & 0xF, 1857 ioc->name, (ioc->rev >> 4) & 0xF, ioc->rev & 0xF,
1865 hpa, ioc->iov_size >> 20, ioc->ibase); 1858 hpa, ioc->iov_size >> 20, ioc->ibase);
1866
1867 return ioc;
1868} 1859}
1869 1860
1870 1861
@@ -2031,22 +2022,21 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
2031#endif 2022#endif
2032} 2023}
2033 2024
2034static int 2025static void acpi_sba_ioc_add(struct ioc *ioc)
2035acpi_sba_ioc_add(struct acpi_device *device,
2036 const struct acpi_device_id *not_used)
2037{ 2026{
2038 struct ioc *ioc; 2027 acpi_handle handle = ioc->handle;
2039 acpi_status status; 2028 acpi_status status;
2040 u64 hpa, length; 2029 u64 hpa, length;
2041 struct acpi_device_info *adi; 2030 struct acpi_device_info *adi;
2042 2031
2043 status = hp_acpi_csr_space(device->handle, &hpa, &length); 2032 ioc_found = ioc->next;
2033 status = hp_acpi_csr_space(handle, &hpa, &length);
2044 if (ACPI_FAILURE(status)) 2034 if (ACPI_FAILURE(status))
2045 return 1; 2035 goto err;
2046 2036
2047 status = acpi_get_object_info(device->handle, &adi); 2037 status = acpi_get_object_info(handle, &adi);
2048 if (ACPI_FAILURE(status)) 2038 if (ACPI_FAILURE(status))
2049 return 1; 2039 goto err;
2050 2040
2051 /* 2041 /*
2052 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI 2042 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI
@@ -2067,13 +2057,13 @@ acpi_sba_ioc_add(struct acpi_device *device,
2067 if (!iovp_shift) 2057 if (!iovp_shift)
2068 iovp_shift = 12; 2058 iovp_shift = 12;
2069 2059
2070 ioc = ioc_init(hpa, device->handle); 2060 ioc_init(hpa, ioc);
2071 if (!ioc)
2072 return 1;
2073
2074 /* setup NUMA node association */ 2061 /* setup NUMA node association */
2075 sba_map_ioc_to_node(ioc, device->handle); 2062 sba_map_ioc_to_node(ioc, handle);
2076 return 0; 2063 return;
2064
2065 err:
2066 kfree(ioc);
2077} 2067}
2078 2068
2079static const struct acpi_device_id hp_ioc_iommu_device_ids[] = { 2069static const struct acpi_device_id hp_ioc_iommu_device_ids[] = {
@@ -2081,9 +2071,26 @@ static const struct acpi_device_id hp_ioc_iommu_device_ids[] = {
2081 {"HWP0004", 0}, 2071 {"HWP0004", 0},
2082 {"", 0}, 2072 {"", 0},
2083}; 2073};
2074
2075static int acpi_sba_ioc_attach(struct acpi_device *device,
2076 const struct acpi_device_id *not_used)
2077{
2078 struct ioc *ioc;
2079
2080 ioc = kzalloc(sizeof(*ioc), GFP_KERNEL);
2081 if (!ioc)
2082 return -ENOMEM;
2083
2084 ioc->next = ioc_found;
2085 ioc_found = ioc;
2086 ioc->handle = device->handle;
2087 return 1;
2088}
2089
2090
2084static struct acpi_scan_handler acpi_sba_ioc_handler = { 2091static struct acpi_scan_handler acpi_sba_ioc_handler = {
2085 .ids = hp_ioc_iommu_device_ids, 2092 .ids = hp_ioc_iommu_device_ids,
2086 .attach = acpi_sba_ioc_add, 2093 .attach = acpi_sba_ioc_attach,
2087}; 2094};
2088 2095
2089static int __init acpi_sba_ioc_init_acpi(void) 2096static int __init acpi_sba_ioc_init_acpi(void)
@@ -2118,9 +2125,12 @@ sba_init(void)
2118#endif 2125#endif
2119 2126
2120 /* 2127 /*
2121 * ioc_list should be populated by the acpi_sba_ioc_handler's .attach() 2128 * ioc_found should be populated by the acpi_sba_ioc_handler's .attach()
2122 * routine, but that only happens if acpi_scan_init() has already run. 2129 * routine, but that only happens if acpi_scan_init() has already run.
2123 */ 2130 */
2131 while (ioc_found)
2132 acpi_sba_ioc_add(ioc_found);
2133
2124 if (!ioc_list) { 2134 if (!ioc_list) {
2125#ifdef CONFIG_IA64_GENERIC 2135#ifdef CONFIG_IA64_GENERIC
2126 /* 2136 /*
diff --git a/arch/ia64/include/uapi/asm/fcntl.h b/arch/ia64/include/uapi/asm/fcntl.h
index 1dd275dc8f65..7b485876cad4 100644
--- a/arch/ia64/include/uapi/asm/fcntl.h
+++ b/arch/ia64/include/uapi/asm/fcntl.h
@@ -8,6 +8,7 @@
8#define force_o_largefile() \ 8#define force_o_largefile() \
9 (personality(current->personality) != PER_LINUX32) 9 (personality(current->personality) != PER_LINUX32)
10 10
11#include <linux/personality.h>
11#include <asm-generic/fcntl.h> 12#include <asm-generic/fcntl.h>
12 13
13#endif /* _ASM_IA64_FCNTL_H */ 14#endif /* _ASM_IA64_FCNTL_H */
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 7a469acee33c..4e238e6e661c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -269,6 +269,7 @@ config LANTIQ
269config LASAT 269config LASAT
270 bool "LASAT Networks platforms" 270 bool "LASAT Networks platforms"
271 select CEVT_R4K 271 select CEVT_R4K
272 select CRC32
272 select CSRC_R4K 273 select CSRC_R4K
273 select DMA_NONCOHERENT 274 select DMA_NONCOHERENT
274 select SYS_HAS_EARLY_PRINTK 275 select SYS_HAS_EARLY_PRINTK
diff --git a/arch/mips/include/asm/sigcontext.h b/arch/mips/include/asm/sigcontext.h
index f54bdbe85c0d..eeeb0f48c767 100644
--- a/arch/mips/include/asm/sigcontext.h
+++ b/arch/mips/include/asm/sigcontext.h
@@ -32,8 +32,6 @@ struct sigcontext32 {
32 __u32 sc_lo2; 32 __u32 sc_lo2;
33 __u32 sc_hi3; 33 __u32 sc_hi3;
34 __u32 sc_lo3; 34 __u32 sc_lo3;
35 __u64 sc_msaregs[32]; /* Most significant 64 bits */
36 __u32 sc_msa_csr;
37}; 35};
38#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */ 36#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
39#endif /* _ASM_SIGCONTEXT_H */ 37#endif /* _ASM_SIGCONTEXT_H */
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index f8d63b3b40b4..708c5d414905 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -67,6 +67,9 @@ void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
67#define Ip_u2s3u1(op) \ 67#define Ip_u2s3u1(op) \
68void ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c) 68void ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c)
69 69
70#define Ip_s3s1s2(op) \
71void ISAOPC(op)(u32 **buf, int a, int b, int c)
72
70#define Ip_u2u1s3(op) \ 73#define Ip_u2u1s3(op) \
71void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) 74void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
72 75
@@ -147,6 +150,7 @@ Ip_u2s3u1(_scd);
147Ip_u2s3u1(_sd); 150Ip_u2s3u1(_sd);
148Ip_u2u1u3(_sll); 151Ip_u2u1u3(_sll);
149Ip_u3u2u1(_sllv); 152Ip_u3u2u1(_sllv);
153Ip_s3s1s2(_slt);
150Ip_u2u1s3(_sltiu); 154Ip_u2u1s3(_sltiu);
151Ip_u3u1u2(_sltu); 155Ip_u3u1u2(_sltu);
152Ip_u2u1u3(_sra); 156Ip_u2u1u3(_sra);
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h
index 4b7160259292..4bfdb9d4c186 100644
--- a/arch/mips/include/uapi/asm/inst.h
+++ b/arch/mips/include/uapi/asm/inst.h
@@ -273,6 +273,7 @@ enum mm_32a_minor_op {
273 mm_and_op = 0x250, 273 mm_and_op = 0x250,
274 mm_or32_op = 0x290, 274 mm_or32_op = 0x290,
275 mm_xor32_op = 0x310, 275 mm_xor32_op = 0x310,
276 mm_slt_op = 0x350,
276 mm_sltu_op = 0x390, 277 mm_sltu_op = 0x390,
277}; 278};
278 279
diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h
index 681c17603a48..6c9906f59c6e 100644
--- a/arch/mips/include/uapi/asm/sigcontext.h
+++ b/arch/mips/include/uapi/asm/sigcontext.h
@@ -12,10 +12,6 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/sgidefs.h> 13#include <asm/sgidefs.h>
14 14
15/* Bits which may be set in sc_used_math */
16#define USEDMATH_FP (1 << 0)
17#define USEDMATH_MSA (1 << 1)
18
19#if _MIPS_SIM == _MIPS_SIM_ABI32 15#if _MIPS_SIM == _MIPS_SIM_ABI32
20 16
21/* 17/*
@@ -41,8 +37,6 @@ struct sigcontext {
41 unsigned long sc_lo2; 37 unsigned long sc_lo2;
42 unsigned long sc_hi3; 38 unsigned long sc_hi3;
43 unsigned long sc_lo3; 39 unsigned long sc_lo3;
44 unsigned long long sc_msaregs[32]; /* Most significant 64 bits */
45 unsigned long sc_msa_csr;
46}; 40};
47 41
48#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 42#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
@@ -76,8 +70,6 @@ struct sigcontext {
76 __u32 sc_used_math; 70 __u32 sc_used_math;
77 __u32 sc_dsp; 71 __u32 sc_dsp;
78 __u32 sc_reserved; 72 __u32 sc_reserved;
79 __u64 sc_msaregs[32];
80 __u32 sc_msa_csr;
81}; 73};
82 74
83 75
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 02f075df8f2e..4bb5107511e2 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -293,7 +293,6 @@ void output_sc_defines(void)
293 OFFSET(SC_LO2, sigcontext, sc_lo2); 293 OFFSET(SC_LO2, sigcontext, sc_lo2);
294 OFFSET(SC_HI3, sigcontext, sc_hi3); 294 OFFSET(SC_HI3, sigcontext, sc_hi3);
295 OFFSET(SC_LO3, sigcontext, sc_lo3); 295 OFFSET(SC_LO3, sigcontext, sc_lo3);
296 OFFSET(SC_MSAREGS, sigcontext, sc_msaregs);
297 BLANK(); 296 BLANK();
298} 297}
299#endif 298#endif
@@ -308,7 +307,6 @@ void output_sc_defines(void)
308 OFFSET(SC_MDLO, sigcontext, sc_mdlo); 307 OFFSET(SC_MDLO, sigcontext, sc_mdlo);
309 OFFSET(SC_PC, sigcontext, sc_pc); 308 OFFSET(SC_PC, sigcontext, sc_pc);
310 OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr); 309 OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr);
311 OFFSET(SC_MSAREGS, sigcontext, sc_msaregs);
312 BLANK(); 310 BLANK();
313} 311}
314#endif 312#endif
@@ -320,7 +318,6 @@ void output_sc32_defines(void)
320 OFFSET(SC32_FPREGS, sigcontext32, sc_fpregs); 318 OFFSET(SC32_FPREGS, sigcontext32, sc_fpregs);
321 OFFSET(SC32_FPC_CSR, sigcontext32, sc_fpc_csr); 319 OFFSET(SC32_FPC_CSR, sigcontext32, sc_fpc_csr);
322 OFFSET(SC32_FPC_EIR, sigcontext32, sc_fpc_eir); 320 OFFSET(SC32_FPC_EIR, sigcontext32, sc_fpc_eir);
323 OFFSET(SC32_MSAREGS, sigcontext32, sc_msaregs);
324 BLANK(); 321 BLANK();
325} 322}
326#endif 323#endif
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
index 4858642d543d..a734b2c2f9ea 100644
--- a/arch/mips/kernel/irq-msc01.c
+++ b/arch/mips/kernel/irq-msc01.c
@@ -126,7 +126,7 @@ void __init init_msc_irqs(unsigned long icubase, unsigned int irqbase, msc_irqma
126 126
127 board_bind_eic_interrupt = &msc_bind_eic_interrupt; 127 board_bind_eic_interrupt = &msc_bind_eic_interrupt;
128 128
129 for (; nirq >= 0; nirq--, imp++) { 129 for (; nirq > 0; nirq--, imp++) {
130 int n = imp->im_irq; 130 int n = imp->im_irq;
131 131
132 switch (imp->im_type) { 132 switch (imp->im_type) {
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
index 5aa4c6f8cf83..c4c2069d3a20 100644
--- a/arch/mips/kernel/pm-cps.c
+++ b/arch/mips/kernel/pm-cps.c
@@ -101,7 +101,7 @@ static void coupled_barrier(atomic_t *a, unsigned online)
101 if (!coupled_coherence) 101 if (!coupled_coherence)
102 return; 102 return;
103 103
104 smp_mb__before_atomic_inc(); 104 smp_mb__before_atomic();
105 atomic_inc(a); 105 atomic_inc(a);
106 106
107 while (atomic_read(a) < online) 107 while (atomic_read(a) < online)
@@ -158,7 +158,7 @@ int cps_pm_enter_state(enum cps_pm_state state)
158 158
159 /* Indicate that this CPU might not be coherent */ 159 /* Indicate that this CPU might not be coherent */
160 cpumask_clear_cpu(cpu, &cpu_coherent_mask); 160 cpumask_clear_cpu(cpu, &cpu_coherent_mask);
161 smp_mb__after_clear_bit(); 161 smp_mb__after_atomic();
162 162
163 /* Create a non-coherent mapping of the core ready_count */ 163 /* Create a non-coherent mapping of the core ready_count */
164 core_ready_count = per_cpu(ready_count, core); 164 core_ready_count = per_cpu(ready_count, core);
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index 71814272d148..8352523568e6 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -13,7 +13,6 @@
13 * Copyright (C) 1999, 2001 Silicon Graphics, Inc. 13 * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
14 */ 14 */
15#include <asm/asm.h> 15#include <asm/asm.h>
16#include <asm/asmmacro.h>
17#include <asm/errno.h> 16#include <asm/errno.h>
18#include <asm/fpregdef.h> 17#include <asm/fpregdef.h>
19#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
@@ -246,218 +245,6 @@ LEAF(_restore_fp_context32)
246 END(_restore_fp_context32) 245 END(_restore_fp_context32)
247#endif 246#endif
248 247
249#ifdef CONFIG_CPU_HAS_MSA
250
251 .macro save_sc_msareg wr, off, sc, tmp
252#ifdef CONFIG_64BIT
253 copy_u_d \tmp, \wr, 1
254 EX sd \tmp, (\off+(\wr*8))(\sc)
255#elif defined(CONFIG_CPU_LITTLE_ENDIAN)
256 copy_u_w \tmp, \wr, 2
257 EX sw \tmp, (\off+(\wr*8)+0)(\sc)
258 copy_u_w \tmp, \wr, 3
259 EX sw \tmp, (\off+(\wr*8)+4)(\sc)
260#else /* CONFIG_CPU_BIG_ENDIAN */
261 copy_u_w \tmp, \wr, 2
262 EX sw \tmp, (\off+(\wr*8)+4)(\sc)
263 copy_u_w \tmp, \wr, 3
264 EX sw \tmp, (\off+(\wr*8)+0)(\sc)
265#endif
266 .endm
267
268/*
269 * int _save_msa_context(struct sigcontext *sc)
270 *
271 * Save the upper 64 bits of each vector register along with the MSA_CSR
272 * register into sc. Returns zero on success, else non-zero.
273 */
274LEAF(_save_msa_context)
275 save_sc_msareg 0, SC_MSAREGS, a0, t0
276 save_sc_msareg 1, SC_MSAREGS, a0, t0
277 save_sc_msareg 2, SC_MSAREGS, a0, t0
278 save_sc_msareg 3, SC_MSAREGS, a0, t0
279 save_sc_msareg 4, SC_MSAREGS, a0, t0
280 save_sc_msareg 5, SC_MSAREGS, a0, t0
281 save_sc_msareg 6, SC_MSAREGS, a0, t0
282 save_sc_msareg 7, SC_MSAREGS, a0, t0
283 save_sc_msareg 8, SC_MSAREGS, a0, t0
284 save_sc_msareg 9, SC_MSAREGS, a0, t0
285 save_sc_msareg 10, SC_MSAREGS, a0, t0
286 save_sc_msareg 11, SC_MSAREGS, a0, t0
287 save_sc_msareg 12, SC_MSAREGS, a0, t0
288 save_sc_msareg 13, SC_MSAREGS, a0, t0
289 save_sc_msareg 14, SC_MSAREGS, a0, t0
290 save_sc_msareg 15, SC_MSAREGS, a0, t0
291 save_sc_msareg 16, SC_MSAREGS, a0, t0
292 save_sc_msareg 17, SC_MSAREGS, a0, t0
293 save_sc_msareg 18, SC_MSAREGS, a0, t0
294 save_sc_msareg 19, SC_MSAREGS, a0, t0
295 save_sc_msareg 20, SC_MSAREGS, a0, t0
296 save_sc_msareg 21, SC_MSAREGS, a0, t0
297 save_sc_msareg 22, SC_MSAREGS, a0, t0
298 save_sc_msareg 23, SC_MSAREGS, a0, t0
299 save_sc_msareg 24, SC_MSAREGS, a0, t0
300 save_sc_msareg 25, SC_MSAREGS, a0, t0
301 save_sc_msareg 26, SC_MSAREGS, a0, t0
302 save_sc_msareg 27, SC_MSAREGS, a0, t0
303 save_sc_msareg 28, SC_MSAREGS, a0, t0
304 save_sc_msareg 29, SC_MSAREGS, a0, t0
305 save_sc_msareg 30, SC_MSAREGS, a0, t0
306 save_sc_msareg 31, SC_MSAREGS, a0, t0
307 jr ra
308 li v0, 0
309 END(_save_msa_context)
310
311#ifdef CONFIG_MIPS32_COMPAT
312
313/*
314 * int _save_msa_context32(struct sigcontext32 *sc)
315 *
316 * Save the upper 64 bits of each vector register along with the MSA_CSR
317 * register into sc. Returns zero on success, else non-zero.
318 */
319LEAF(_save_msa_context32)
320 save_sc_msareg 0, SC32_MSAREGS, a0, t0
321 save_sc_msareg 1, SC32_MSAREGS, a0, t0
322 save_sc_msareg 2, SC32_MSAREGS, a0, t0
323 save_sc_msareg 3, SC32_MSAREGS, a0, t0
324 save_sc_msareg 4, SC32_MSAREGS, a0, t0
325 save_sc_msareg 5, SC32_MSAREGS, a0, t0
326 save_sc_msareg 6, SC32_MSAREGS, a0, t0
327 save_sc_msareg 7, SC32_MSAREGS, a0, t0
328 save_sc_msareg 8, SC32_MSAREGS, a0, t0
329 save_sc_msareg 9, SC32_MSAREGS, a0, t0
330 save_sc_msareg 10, SC32_MSAREGS, a0, t0
331 save_sc_msareg 11, SC32_MSAREGS, a0, t0
332 save_sc_msareg 12, SC32_MSAREGS, a0, t0
333 save_sc_msareg 13, SC32_MSAREGS, a0, t0
334 save_sc_msareg 14, SC32_MSAREGS, a0, t0
335 save_sc_msareg 15, SC32_MSAREGS, a0, t0
336 save_sc_msareg 16, SC32_MSAREGS, a0, t0
337 save_sc_msareg 17, SC32_MSAREGS, a0, t0
338 save_sc_msareg 18, SC32_MSAREGS, a0, t0
339 save_sc_msareg 19, SC32_MSAREGS, a0, t0
340 save_sc_msareg 20, SC32_MSAREGS, a0, t0
341 save_sc_msareg 21, SC32_MSAREGS, a0, t0
342 save_sc_msareg 22, SC32_MSAREGS, a0, t0
343 save_sc_msareg 23, SC32_MSAREGS, a0, t0
344 save_sc_msareg 24, SC32_MSAREGS, a0, t0
345 save_sc_msareg 25, SC32_MSAREGS, a0, t0
346 save_sc_msareg 26, SC32_MSAREGS, a0, t0
347 save_sc_msareg 27, SC32_MSAREGS, a0, t0
348 save_sc_msareg 28, SC32_MSAREGS, a0, t0
349 save_sc_msareg 29, SC32_MSAREGS, a0, t0
350 save_sc_msareg 30, SC32_MSAREGS, a0, t0
351 save_sc_msareg 31, SC32_MSAREGS, a0, t0
352 jr ra
353 li v0, 0
354 END(_save_msa_context32)
355
356#endif /* CONFIG_MIPS32_COMPAT */
357
358 .macro restore_sc_msareg wr, off, sc, tmp
359#ifdef CONFIG_64BIT
360 EX ld \tmp, (\off+(\wr*8))(\sc)
361 insert_d \wr, 1, \tmp
362#elif defined(CONFIG_CPU_LITTLE_ENDIAN)
363 EX lw \tmp, (\off+(\wr*8)+0)(\sc)
364 insert_w \wr, 2, \tmp
365 EX lw \tmp, (\off+(\wr*8)+4)(\sc)
366 insert_w \wr, 3, \tmp
367#else /* CONFIG_CPU_BIG_ENDIAN */
368 EX lw \tmp, (\off+(\wr*8)+4)(\sc)
369 insert_w \wr, 2, \tmp
370 EX lw \tmp, (\off+(\wr*8)+0)(\sc)
371 insert_w \wr, 3, \tmp
372#endif
373 .endm
374
375/*
376 * int _restore_msa_context(struct sigcontext *sc)
377 */
378LEAF(_restore_msa_context)
379 restore_sc_msareg 0, SC_MSAREGS, a0, t0
380 restore_sc_msareg 1, SC_MSAREGS, a0, t0
381 restore_sc_msareg 2, SC_MSAREGS, a0, t0
382 restore_sc_msareg 3, SC_MSAREGS, a0, t0
383 restore_sc_msareg 4, SC_MSAREGS, a0, t0
384 restore_sc_msareg 5, SC_MSAREGS, a0, t0
385 restore_sc_msareg 6, SC_MSAREGS, a0, t0
386 restore_sc_msareg 7, SC_MSAREGS, a0, t0
387 restore_sc_msareg 8, SC_MSAREGS, a0, t0
388 restore_sc_msareg 9, SC_MSAREGS, a0, t0
389 restore_sc_msareg 10, SC_MSAREGS, a0, t0
390 restore_sc_msareg 11, SC_MSAREGS, a0, t0
391 restore_sc_msareg 12, SC_MSAREGS, a0, t0
392 restore_sc_msareg 13, SC_MSAREGS, a0, t0
393 restore_sc_msareg 14, SC_MSAREGS, a0, t0
394 restore_sc_msareg 15, SC_MSAREGS, a0, t0
395 restore_sc_msareg 16, SC_MSAREGS, a0, t0
396 restore_sc_msareg 17, SC_MSAREGS, a0, t0
397 restore_sc_msareg 18, SC_MSAREGS, a0, t0
398 restore_sc_msareg 19, SC_MSAREGS, a0, t0
399 restore_sc_msareg 20, SC_MSAREGS, a0, t0
400 restore_sc_msareg 21, SC_MSAREGS, a0, t0
401 restore_sc_msareg 22, SC_MSAREGS, a0, t0
402 restore_sc_msareg 23, SC_MSAREGS, a0, t0
403 restore_sc_msareg 24, SC_MSAREGS, a0, t0
404 restore_sc_msareg 25, SC_MSAREGS, a0, t0
405 restore_sc_msareg 26, SC_MSAREGS, a0, t0
406 restore_sc_msareg 27, SC_MSAREGS, a0, t0
407 restore_sc_msareg 28, SC_MSAREGS, a0, t0
408 restore_sc_msareg 29, SC_MSAREGS, a0, t0
409 restore_sc_msareg 30, SC_MSAREGS, a0, t0
410 restore_sc_msareg 31, SC_MSAREGS, a0, t0
411 jr ra
412 li v0, 0
413 END(_restore_msa_context)
414
415#ifdef CONFIG_MIPS32_COMPAT
416
417/*
418 * int _restore_msa_context32(struct sigcontext32 *sc)
419 */
420LEAF(_restore_msa_context32)
421 restore_sc_msareg 0, SC32_MSAREGS, a0, t0
422 restore_sc_msareg 1, SC32_MSAREGS, a0, t0
423 restore_sc_msareg 2, SC32_MSAREGS, a0, t0
424 restore_sc_msareg 3, SC32_MSAREGS, a0, t0
425 restore_sc_msareg 4, SC32_MSAREGS, a0, t0
426 restore_sc_msareg 5, SC32_MSAREGS, a0, t0
427 restore_sc_msareg 6, SC32_MSAREGS, a0, t0
428 restore_sc_msareg 7, SC32_MSAREGS, a0, t0
429 restore_sc_msareg 8, SC32_MSAREGS, a0, t0
430 restore_sc_msareg 9, SC32_MSAREGS, a0, t0
431 restore_sc_msareg 10, SC32_MSAREGS, a0, t0
432 restore_sc_msareg 11, SC32_MSAREGS, a0, t0
433 restore_sc_msareg 12, SC32_MSAREGS, a0, t0
434 restore_sc_msareg 13, SC32_MSAREGS, a0, t0
435 restore_sc_msareg 14, SC32_MSAREGS, a0, t0
436 restore_sc_msareg 15, SC32_MSAREGS, a0, t0
437 restore_sc_msareg 16, SC32_MSAREGS, a0, t0
438 restore_sc_msareg 17, SC32_MSAREGS, a0, t0
439 restore_sc_msareg 18, SC32_MSAREGS, a0, t0
440 restore_sc_msareg 19, SC32_MSAREGS, a0, t0
441 restore_sc_msareg 20, SC32_MSAREGS, a0, t0
442 restore_sc_msareg 21, SC32_MSAREGS, a0, t0
443 restore_sc_msareg 22, SC32_MSAREGS, a0, t0
444 restore_sc_msareg 23, SC32_MSAREGS, a0, t0
445 restore_sc_msareg 24, SC32_MSAREGS, a0, t0
446 restore_sc_msareg 25, SC32_MSAREGS, a0, t0
447 restore_sc_msareg 26, SC32_MSAREGS, a0, t0
448 restore_sc_msareg 27, SC32_MSAREGS, a0, t0
449 restore_sc_msareg 28, SC32_MSAREGS, a0, t0
450 restore_sc_msareg 29, SC32_MSAREGS, a0, t0
451 restore_sc_msareg 30, SC32_MSAREGS, a0, t0
452 restore_sc_msareg 31, SC32_MSAREGS, a0, t0
453 jr ra
454 li v0, 0
455 END(_restore_msa_context32)
456
457#endif /* CONFIG_MIPS32_COMPAT */
458
459#endif /* CONFIG_CPU_HAS_MSA */
460
461 .set reorder 248 .set reorder
462 249
463 .type fault@function 250 .type fault@function
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 33133d3df3e5..9e60d117e41e 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -31,7 +31,6 @@
31#include <linux/bitops.h> 31#include <linux/bitops.h>
32#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
33#include <asm/fpu.h> 33#include <asm/fpu.h>
34#include <asm/msa.h>
35#include <asm/sim.h> 34#include <asm/sim.h>
36#include <asm/ucontext.h> 35#include <asm/ucontext.h>
37#include <asm/cpu-features.h> 36#include <asm/cpu-features.h>
@@ -48,9 +47,6 @@ static int (*restore_fp_context)(struct sigcontext __user *sc);
48extern asmlinkage int _save_fp_context(struct sigcontext __user *sc); 47extern asmlinkage int _save_fp_context(struct sigcontext __user *sc);
49extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc); 48extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc);
50 49
51extern asmlinkage int _save_msa_context(struct sigcontext __user *sc);
52extern asmlinkage int _restore_msa_context(struct sigcontext __user *sc);
53
54struct sigframe { 50struct sigframe {
55 u32 sf_ass[4]; /* argument save space for o32 */ 51 u32 sf_ass[4]; /* argument save space for o32 */
56 u32 sf_pad[2]; /* Was: signal trampoline */ 52 u32 sf_pad[2]; /* Was: signal trampoline */
@@ -100,60 +96,20 @@ static int copy_fp_from_sigcontext(struct sigcontext __user *sc)
100} 96}
101 97
102/* 98/*
103 * These functions will save only the upper 64 bits of the vector registers,
104 * since the lower 64 bits have already been saved as the scalar FP context.
105 */
106static int copy_msa_to_sigcontext(struct sigcontext __user *sc)
107{
108 int i;
109 int err = 0;
110
111 for (i = 0; i < NUM_FPU_REGS; i++) {
112 err |=
113 __put_user(get_fpr64(&current->thread.fpu.fpr[i], 1),
114 &sc->sc_msaregs[i]);
115 }
116 err |= __put_user(current->thread.fpu.msacsr, &sc->sc_msa_csr);
117
118 return err;
119}
120
121static int copy_msa_from_sigcontext(struct sigcontext __user *sc)
122{
123 int i;
124 int err = 0;
125 u64 val;
126
127 for (i = 0; i < NUM_FPU_REGS; i++) {
128 err |= __get_user(val, &sc->sc_msaregs[i]);
129 set_fpr64(&current->thread.fpu.fpr[i], 1, val);
130 }
131 err |= __get_user(current->thread.fpu.msacsr, &sc->sc_msa_csr);
132
133 return err;
134}
135
136/*
137 * Helper routines 99 * Helper routines
138 */ 100 */
139static int protected_save_fp_context(struct sigcontext __user *sc, 101static int protected_save_fp_context(struct sigcontext __user *sc)
140 unsigned used_math)
141{ 102{
142 int err; 103 int err;
143 bool save_msa = cpu_has_msa && (used_math & USEDMATH_MSA);
144#ifndef CONFIG_EVA 104#ifndef CONFIG_EVA
145 while (1) { 105 while (1) {
146 lock_fpu_owner(); 106 lock_fpu_owner();
147 if (is_fpu_owner()) { 107 if (is_fpu_owner()) {
148 err = save_fp_context(sc); 108 err = save_fp_context(sc);
149 if (save_msa && !err)
150 err = _save_msa_context(sc);
151 unlock_fpu_owner(); 109 unlock_fpu_owner();
152 } else { 110 } else {
153 unlock_fpu_owner(); 111 unlock_fpu_owner();
154 err = copy_fp_to_sigcontext(sc); 112 err = copy_fp_to_sigcontext(sc);
155 if (save_msa && !err)
156 err = copy_msa_to_sigcontext(sc);
157 } 113 }
158 if (likely(!err)) 114 if (likely(!err))
159 break; 115 break;
@@ -169,38 +125,24 @@ static int protected_save_fp_context(struct sigcontext __user *sc,
169 * EVA does not have FPU EVA instructions so saving fpu context directly 125 * EVA does not have FPU EVA instructions so saving fpu context directly
170 * does not work. 126 * does not work.
171 */ 127 */
172 disable_msa();
173 lose_fpu(1); 128 lose_fpu(1);
174 err = save_fp_context(sc); /* this might fail */ 129 err = save_fp_context(sc); /* this might fail */
175 if (save_msa && !err)
176 err = copy_msa_to_sigcontext(sc);
177#endif 130#endif
178 return err; 131 return err;
179} 132}
180 133
181static int protected_restore_fp_context(struct sigcontext __user *sc, 134static int protected_restore_fp_context(struct sigcontext __user *sc)
182 unsigned used_math)
183{ 135{
184 int err, tmp __maybe_unused; 136 int err, tmp __maybe_unused;
185 bool restore_msa = cpu_has_msa && (used_math & USEDMATH_MSA);
186#ifndef CONFIG_EVA 137#ifndef CONFIG_EVA
187 while (1) { 138 while (1) {
188 lock_fpu_owner(); 139 lock_fpu_owner();
189 if (is_fpu_owner()) { 140 if (is_fpu_owner()) {
190 err = restore_fp_context(sc); 141 err = restore_fp_context(sc);
191 if (restore_msa && !err) {
192 enable_msa();
193 err = _restore_msa_context(sc);
194 } else {
195 /* signal handler may have used MSA */
196 disable_msa();
197 }
198 unlock_fpu_owner(); 142 unlock_fpu_owner();
199 } else { 143 } else {
200 unlock_fpu_owner(); 144 unlock_fpu_owner();
201 err = copy_fp_from_sigcontext(sc); 145 err = copy_fp_from_sigcontext(sc);
202 if (!err && (used_math & USEDMATH_MSA))
203 err = copy_msa_from_sigcontext(sc);
204 } 146 }
205 if (likely(!err)) 147 if (likely(!err))
206 break; 148 break;
@@ -216,11 +158,8 @@ static int protected_restore_fp_context(struct sigcontext __user *sc,
216 * EVA does not have FPU EVA instructions so restoring fpu context 158 * EVA does not have FPU EVA instructions so restoring fpu context
217 * directly does not work. 159 * directly does not work.
218 */ 160 */
219 enable_msa();
220 lose_fpu(0); 161 lose_fpu(0);
221 err = restore_fp_context(sc); /* this might fail */ 162 err = restore_fp_context(sc); /* this might fail */
222 if (restore_msa && !err)
223 err = copy_msa_from_sigcontext(sc);
224#endif 163#endif
225 return err; 164 return err;
226} 165}
@@ -252,8 +191,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
252 err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); 191 err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
253 } 192 }
254 193
255 used_math = used_math() ? USEDMATH_FP : 0; 194 used_math = !!used_math();
256 used_math |= thread_msa_context_live() ? USEDMATH_MSA : 0;
257 err |= __put_user(used_math, &sc->sc_used_math); 195 err |= __put_user(used_math, &sc->sc_used_math);
258 196
259 if (used_math) { 197 if (used_math) {
@@ -261,7 +199,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
261 * Save FPU state to signal context. Signal handler 199 * Save FPU state to signal context. Signal handler
262 * will "inherit" current FPU state. 200 * will "inherit" current FPU state.
263 */ 201 */
264 err |= protected_save_fp_context(sc, used_math); 202 err |= protected_save_fp_context(sc);
265 } 203 }
266 return err; 204 return err;
267} 205}
@@ -286,14 +224,14 @@ int fpcsr_pending(unsigned int __user *fpcsr)
286} 224}
287 225
288static int 226static int
289check_and_restore_fp_context(struct sigcontext __user *sc, unsigned used_math) 227check_and_restore_fp_context(struct sigcontext __user *sc)
290{ 228{
291 int err, sig; 229 int err, sig;
292 230
293 err = sig = fpcsr_pending(&sc->sc_fpc_csr); 231 err = sig = fpcsr_pending(&sc->sc_fpc_csr);
294 if (err > 0) 232 if (err > 0)
295 err = 0; 233 err = 0;
296 err |= protected_restore_fp_context(sc, used_math); 234 err |= protected_restore_fp_context(sc);
297 return err ?: sig; 235 return err ?: sig;
298} 236}
299 237
@@ -333,10 +271,9 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
333 if (used_math) { 271 if (used_math) {
334 /* restore fpu context if we have used it before */ 272 /* restore fpu context if we have used it before */
335 if (!err) 273 if (!err)
336 err = check_and_restore_fp_context(sc, used_math); 274 err = check_and_restore_fp_context(sc);
337 } else { 275 } else {
338 /* signal handler may have used FPU or MSA. Disable them. */ 276 /* signal handler may have used FPU. Give it up. */
339 disable_msa();
340 lose_fpu(0); 277 lose_fpu(0);
341 } 278 }
342 279
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 299f956e4db3..bae2e6ee2109 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -30,7 +30,6 @@
30#include <asm/sim.h> 30#include <asm/sim.h>
31#include <asm/ucontext.h> 31#include <asm/ucontext.h>
32#include <asm/fpu.h> 32#include <asm/fpu.h>
33#include <asm/msa.h>
34#include <asm/war.h> 33#include <asm/war.h>
35#include <asm/vdso.h> 34#include <asm/vdso.h>
36#include <asm/dsp.h> 35#include <asm/dsp.h>
@@ -43,9 +42,6 @@ static int (*restore_fp_context32)(struct sigcontext32 __user *sc);
43extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc); 42extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc);
44extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc); 43extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc);
45 44
46extern asmlinkage int _save_msa_context32(struct sigcontext32 __user *sc);
47extern asmlinkage int _restore_msa_context32(struct sigcontext32 __user *sc);
48
49/* 45/*
50 * Including <asm/unistd.h> would give use the 64-bit syscall numbers ... 46 * Including <asm/unistd.h> would give use the 64-bit syscall numbers ...
51 */ 47 */
@@ -115,59 +111,19 @@ static int copy_fp_from_sigcontext32(struct sigcontext32 __user *sc)
115} 111}
116 112
117/* 113/*
118 * These functions will save only the upper 64 bits of the vector registers,
119 * since the lower 64 bits have already been saved as the scalar FP context.
120 */
121static int copy_msa_to_sigcontext32(struct sigcontext32 __user *sc)
122{
123 int i;
124 int err = 0;
125
126 for (i = 0; i < NUM_FPU_REGS; i++) {
127 err |=
128 __put_user(get_fpr64(&current->thread.fpu.fpr[i], 1),
129 &sc->sc_msaregs[i]);
130 }
131 err |= __put_user(current->thread.fpu.msacsr, &sc->sc_msa_csr);
132
133 return err;
134}
135
136static int copy_msa_from_sigcontext32(struct sigcontext32 __user *sc)
137{
138 int i;
139 int err = 0;
140 u64 val;
141
142 for (i = 0; i < NUM_FPU_REGS; i++) {
143 err |= __get_user(val, &sc->sc_msaregs[i]);
144 set_fpr64(&current->thread.fpu.fpr[i], 1, val);
145 }
146 err |= __get_user(current->thread.fpu.msacsr, &sc->sc_msa_csr);
147
148 return err;
149}
150
151/*
152 * sigcontext handlers 114 * sigcontext handlers
153 */ 115 */
154static int protected_save_fp_context32(struct sigcontext32 __user *sc, 116static int protected_save_fp_context32(struct sigcontext32 __user *sc)
155 unsigned used_math)
156{ 117{
157 int err; 118 int err;
158 bool save_msa = cpu_has_msa && (used_math & USEDMATH_MSA);
159 while (1) { 119 while (1) {
160 lock_fpu_owner(); 120 lock_fpu_owner();
161 if (is_fpu_owner()) { 121 if (is_fpu_owner()) {
162 err = save_fp_context32(sc); 122 err = save_fp_context32(sc);
163 if (save_msa && !err)
164 err = _save_msa_context32(sc);
165 unlock_fpu_owner(); 123 unlock_fpu_owner();
166 } else { 124 } else {
167 unlock_fpu_owner(); 125 unlock_fpu_owner();
168 err = copy_fp_to_sigcontext32(sc); 126 err = copy_fp_to_sigcontext32(sc);
169 if (save_msa && !err)
170 err = copy_msa_to_sigcontext32(sc);
171 } 127 }
172 if (likely(!err)) 128 if (likely(!err))
173 break; 129 break;
@@ -181,28 +137,17 @@ static int protected_save_fp_context32(struct sigcontext32 __user *sc,
181 return err; 137 return err;
182} 138}
183 139
184static int protected_restore_fp_context32(struct sigcontext32 __user *sc, 140static int protected_restore_fp_context32(struct sigcontext32 __user *sc)
185 unsigned used_math)
186{ 141{
187 int err, tmp __maybe_unused; 142 int err, tmp __maybe_unused;
188 bool restore_msa = cpu_has_msa && (used_math & USEDMATH_MSA);
189 while (1) { 143 while (1) {
190 lock_fpu_owner(); 144 lock_fpu_owner();
191 if (is_fpu_owner()) { 145 if (is_fpu_owner()) {
192 err = restore_fp_context32(sc); 146 err = restore_fp_context32(sc);
193 if (restore_msa && !err) {
194 enable_msa();
195 err = _restore_msa_context32(sc);
196 } else {
197 /* signal handler may have used MSA */
198 disable_msa();
199 }
200 unlock_fpu_owner(); 147 unlock_fpu_owner();
201 } else { 148 } else {
202 unlock_fpu_owner(); 149 unlock_fpu_owner();
203 err = copy_fp_from_sigcontext32(sc); 150 err = copy_fp_from_sigcontext32(sc);
204 if (restore_msa && !err)
205 err = copy_msa_from_sigcontext32(sc);
206 } 151 }
207 if (likely(!err)) 152 if (likely(!err))
208 break; 153 break;
@@ -241,8 +186,7 @@ static int setup_sigcontext32(struct pt_regs *regs,
241 err |= __put_user(mflo3(), &sc->sc_lo3); 186 err |= __put_user(mflo3(), &sc->sc_lo3);
242 } 187 }
243 188
244 used_math = used_math() ? USEDMATH_FP : 0; 189 used_math = !!used_math();
245 used_math |= thread_msa_context_live() ? USEDMATH_MSA : 0;
246 err |= __put_user(used_math, &sc->sc_used_math); 190 err |= __put_user(used_math, &sc->sc_used_math);
247 191
248 if (used_math) { 192 if (used_math) {
@@ -250,21 +194,20 @@ static int setup_sigcontext32(struct pt_regs *regs,
250 * Save FPU state to signal context. Signal handler 194 * Save FPU state to signal context. Signal handler
251 * will "inherit" current FPU state. 195 * will "inherit" current FPU state.
252 */ 196 */
253 err |= protected_save_fp_context32(sc, used_math); 197 err |= protected_save_fp_context32(sc);
254 } 198 }
255 return err; 199 return err;
256} 200}
257 201
258static int 202static int
259check_and_restore_fp_context32(struct sigcontext32 __user *sc, 203check_and_restore_fp_context32(struct sigcontext32 __user *sc)
260 unsigned used_math)
261{ 204{
262 int err, sig; 205 int err, sig;
263 206
264 err = sig = fpcsr_pending(&sc->sc_fpc_csr); 207 err = sig = fpcsr_pending(&sc->sc_fpc_csr);
265 if (err > 0) 208 if (err > 0)
266 err = 0; 209 err = 0;
267 err |= protected_restore_fp_context32(sc, used_math); 210 err |= protected_restore_fp_context32(sc);
268 return err ?: sig; 211 return err ?: sig;
269} 212}
270 213
@@ -301,10 +244,9 @@ static int restore_sigcontext32(struct pt_regs *regs,
301 if (used_math) { 244 if (used_math) {
302 /* restore fpu context if we have used it before */ 245 /* restore fpu context if we have used it before */
303 if (!err) 246 if (!err)
304 err = check_and_restore_fp_context32(sc, used_math); 247 err = check_and_restore_fp_context32(sc);
305 } else { 248 } else {
306 /* signal handler may have used FPU or MSA. Disable them. */ 249 /* signal handler may have used FPU. Give it up. */
307 disable_msa();
308 lose_fpu(0); 250 lose_fpu(0);
309 } 251 }
310 252
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index df0598d9bfdd..949f2c6827a0 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -301,7 +301,7 @@ static int cps_cpu_disable(void)
301 301
302 core_cfg = &mips_cps_core_bootcfg[current_cpu_data.core]; 302 core_cfg = &mips_cps_core_bootcfg[current_cpu_data.core];
303 atomic_sub(1 << cpu_vpe_id(&current_cpu_data), &core_cfg->vpe_mask); 303 atomic_sub(1 << cpu_vpe_id(&current_cpu_data), &core_cfg->vpe_mask);
304 smp_mb__after_atomic_dec(); 304 smp_mb__after_atomic();
305 set_cpu_online(cpu, false); 305 set_cpu_online(cpu, false);
306 cpu_clear(cpu, cpu_callin_map); 306 cpu_clear(cpu, cpu_callin_map);
307 307
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index cd5e4f568439..f3c56a182fd8 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -384,6 +384,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
384 384
385 kfree(vcpu->arch.guest_ebase); 385 kfree(vcpu->arch.guest_ebase);
386 kfree(vcpu->arch.kseg0_commpage); 386 kfree(vcpu->arch.kseg0_commpage);
387 kfree(vcpu);
387} 388}
388 389
389void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) 390void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c
index 53f1d2287084..8e97acbbe22c 100644
--- a/arch/mips/math-emu/ieee754.c
+++ b/arch/mips/math-emu/ieee754.c
@@ -34,13 +34,22 @@
34 * Special constants 34 * Special constants
35 */ 35 */
36 36
37#define DPCNST(s, b, m) \ 37/*
38 * Older GCC requires the inner braces for initialization of union ieee754dp's
39 * anonymous struct member. Without an error will result.
40 */
41#define xPCNST(s, b, m, ebias) \
38{ \ 42{ \
39 .sign = (s), \ 43 { \
40 .bexp = (b) + DP_EBIAS, \ 44 .sign = (s), \
41 .mant = (m) \ 45 .bexp = (b) + ebias, \
46 .mant = (m) \
47 } \
42} 48}
43 49
50#define DPCNST(s, b, m) \
51 xPCNST(s, b, m, DP_EBIAS)
52
44const union ieee754dp __ieee754dp_spcvals[] = { 53const union ieee754dp __ieee754dp_spcvals[] = {
45 DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */ 54 DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */
46 DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */ 55 DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */
@@ -62,11 +71,7 @@ const union ieee754dp __ieee754dp_spcvals[] = {
62}; 71};
63 72
64#define SPCNST(s, b, m) \ 73#define SPCNST(s, b, m) \
65{ \ 74 xPCNST(s, b, m, SP_EBIAS)
66 .sign = (s), \
67 .bexp = (b) + SP_EBIAS, \
68 .mant = (m) \
69}
70 75
71const union ieee754sp __ieee754sp_spcvals[] = { 76const union ieee754sp __ieee754sp_spcvals[] = {
72 SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */ 77 SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */
diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c
index 775c2800cba2..8399ddf03a02 100644
--- a/arch/mips/mm/uasm-micromips.c
+++ b/arch/mips/mm/uasm-micromips.c
@@ -102,6 +102,7 @@ static struct insn insn_table_MM[] = {
102 { insn_sd, 0, 0 }, 102 { insn_sd, 0, 0 },
103 { insn_sll, M(mm_pool32a_op, 0, 0, 0, 0, mm_sll32_op), RT | RS | RD }, 103 { insn_sll, M(mm_pool32a_op, 0, 0, 0, 0, mm_sll32_op), RT | RS | RD },
104 { insn_sllv, M(mm_pool32a_op, 0, 0, 0, 0, mm_sllv32_op), RT | RS | RD }, 104 { insn_sllv, M(mm_pool32a_op, 0, 0, 0, 0, mm_sllv32_op), RT | RS | RD },
105 { insn_slt, M(mm_pool32a_op, 0, 0, 0, 0, mm_slt_op), RT | RS | RD },
105 { insn_sltiu, M(mm_sltiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM }, 106 { insn_sltiu, M(mm_sltiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM },
106 { insn_sltu, M(mm_pool32a_op, 0, 0, 0, 0, mm_sltu_op), RT | RS | RD }, 107 { insn_sltu, M(mm_pool32a_op, 0, 0, 0, 0, mm_sltu_op), RT | RS | RD },
107 { insn_sra, M(mm_pool32a_op, 0, 0, 0, 0, mm_sra_op), RT | RS | RD }, 108 { insn_sra, M(mm_pool32a_op, 0, 0, 0, 0, mm_sra_op), RT | RS | RD },
diff --git a/arch/mips/mm/uasm-mips.c b/arch/mips/mm/uasm-mips.c
index 38792c2364f5..6708a2dbf934 100644
--- a/arch/mips/mm/uasm-mips.c
+++ b/arch/mips/mm/uasm-mips.c
@@ -89,7 +89,7 @@ static struct insn insn_table[] = {
89 { insn_lb, M(lb_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 89 { insn_lb, M(lb_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
90 { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 90 { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
91 { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, 91 { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD },
92 { insn_lh, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 92 { insn_lh, M(lh_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
93 { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 93 { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
94 { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 94 { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
95 { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM }, 95 { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM },
@@ -110,6 +110,7 @@ static struct insn insn_table[] = {
110 { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 110 { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
111 { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE }, 111 { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE },
112 { insn_sllv, M(spec_op, 0, 0, 0, 0, sllv_op), RS | RT | RD }, 112 { insn_sllv, M(spec_op, 0, 0, 0, 0, sllv_op), RS | RT | RD },
113 { insn_slt, M(spec_op, 0, 0, 0, 0, slt_op), RS | RT | RD },
113 { insn_sltiu, M(sltiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 114 { insn_sltiu, M(sltiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
114 { insn_sltu, M(spec_op, 0, 0, 0, 0, sltu_op), RS | RT | RD }, 115 { insn_sltu, M(spec_op, 0, 0, 0, 0, sltu_op), RS | RT | RD },
115 { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE }, 116 { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE },
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c
index 00515805fe41..a01b0d6cedd2 100644
--- a/arch/mips/mm/uasm.c
+++ b/arch/mips/mm/uasm.c
@@ -53,7 +53,7 @@ enum opcode {
53 insn_ld, insn_ldx, insn_lh, insn_ll, insn_lld, insn_lui, insn_lw, 53 insn_ld, insn_ldx, insn_lh, insn_ll, insn_lld, insn_lui, insn_lw,
54 insn_lwx, insn_mfc0, insn_mfhi, insn_mflo, insn_mtc0, insn_mul, 54 insn_lwx, insn_mfc0, insn_mfhi, insn_mflo, insn_mtc0, insn_mul,
55 insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, 55 insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd,
56 insn_sd, insn_sll, insn_sllv, insn_sltiu, insn_sltu, insn_sra, 56 insn_sd, insn_sll, insn_sllv, insn_slt, insn_sltiu, insn_sltu, insn_sra,
57 insn_srl, insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall, 57 insn_srl, insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall,
58 insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh, 58 insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh,
59 insn_xor, insn_xori, insn_yield, 59 insn_xor, insn_xori, insn_yield,
@@ -139,6 +139,13 @@ Ip_u1u2u3(op) \
139} \ 139} \
140UASM_EXPORT_SYMBOL(uasm_i##op); 140UASM_EXPORT_SYMBOL(uasm_i##op);
141 141
142#define I_s3s1s2(op) \
143Ip_s3s1s2(op) \
144{ \
145 build_insn(buf, insn##op, b, c, a); \
146} \
147UASM_EXPORT_SYMBOL(uasm_i##op);
148
142#define I_u2u1u3(op) \ 149#define I_u2u1u3(op) \
143Ip_u2u1u3(op) \ 150Ip_u2u1u3(op) \
144{ \ 151{ \
@@ -289,6 +296,7 @@ I_u2s3u1(_scd)
289I_u2s3u1(_sd) 296I_u2s3u1(_sd)
290I_u2u1u3(_sll) 297I_u2u1u3(_sll)
291I_u3u2u1(_sllv) 298I_u3u2u1(_sllv)
299I_s3s1s2(_slt)
292I_u2u1s3(_sltiu) 300I_u2u1s3(_sltiu)
293I_u3u1u2(_sltu) 301I_u3u1u2(_sltu)
294I_u2u1u3(_sra) 302I_u2u1u3(_sra)
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index a67b9753330b..b87390a56a2f 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -119,8 +119,6 @@
119/* Arguments used by JIT */ 119/* Arguments used by JIT */
120#define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */ 120#define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */
121 121
122#define FLAG_NEED_X_RESET (1 << 0)
123
124#define SBIT(x) (1 << (x)) /* Signed version of BIT() */ 122#define SBIT(x) (1 << (x)) /* Signed version of BIT() */
125 123
126/** 124/**
@@ -153,6 +151,8 @@ static inline int optimize_div(u32 *k)
153 return 0; 151 return 0;
154} 152}
155 153
154static inline void emit_jit_reg_move(ptr dst, ptr src, struct jit_ctx *ctx);
155
156/* Simply emit the instruction if the JIT memory space has been allocated */ 156/* Simply emit the instruction if the JIT memory space has been allocated */
157#define emit_instr(ctx, func, ...) \ 157#define emit_instr(ctx, func, ...) \
158do { \ 158do { \
@@ -166,9 +166,7 @@ do { \
166/* Determine if immediate is within the 16-bit signed range */ 166/* Determine if immediate is within the 16-bit signed range */
167static inline bool is_range16(s32 imm) 167static inline bool is_range16(s32 imm)
168{ 168{
169 if (imm >= SBIT(15) || imm < -SBIT(15)) 169 return !(imm >= SBIT(15) || imm < -SBIT(15));
170 return true;
171 return false;
172} 170}
173 171
174static inline void emit_addu(unsigned int dst, unsigned int src1, 172static inline void emit_addu(unsigned int dst, unsigned int src1,
@@ -187,7 +185,7 @@ static inline void emit_load_imm(unsigned int dst, u32 imm, struct jit_ctx *ctx)
187{ 185{
188 if (ctx->target != NULL) { 186 if (ctx->target != NULL) {
189 /* addiu can only handle s16 */ 187 /* addiu can only handle s16 */
190 if (is_range16(imm)) { 188 if (!is_range16(imm)) {
191 u32 *p = &ctx->target[ctx->idx]; 189 u32 *p = &ctx->target[ctx->idx];
192 uasm_i_lui(&p, r_tmp_imm, (s32)imm >> 16); 190 uasm_i_lui(&p, r_tmp_imm, (s32)imm >> 16);
193 p = &ctx->target[ctx->idx + 1]; 191 p = &ctx->target[ctx->idx + 1];
@@ -199,7 +197,7 @@ static inline void emit_load_imm(unsigned int dst, u32 imm, struct jit_ctx *ctx)
199 } 197 }
200 ctx->idx++; 198 ctx->idx++;
201 199
202 if (is_range16(imm)) 200 if (!is_range16(imm))
203 ctx->idx++; 201 ctx->idx++;
204} 202}
205 203
@@ -240,7 +238,7 @@ static inline void emit_daddiu(unsigned int dst, unsigned int src,
240static inline void emit_addiu(unsigned int dst, unsigned int src, 238static inline void emit_addiu(unsigned int dst, unsigned int src,
241 u32 imm, struct jit_ctx *ctx) 239 u32 imm, struct jit_ctx *ctx)
242{ 240{
243 if (is_range16(imm)) { 241 if (!is_range16(imm)) {
244 emit_load_imm(r_tmp, imm, ctx); 242 emit_load_imm(r_tmp, imm, ctx);
245 emit_addu(dst, r_tmp, src, ctx); 243 emit_addu(dst, r_tmp, src, ctx);
246 } else { 244 } else {
@@ -313,8 +311,11 @@ static inline void emit_sll(unsigned int dst, unsigned int src,
313 unsigned int sa, struct jit_ctx *ctx) 311 unsigned int sa, struct jit_ctx *ctx)
314{ 312{
315 /* sa is 5-bits long */ 313 /* sa is 5-bits long */
316 BUG_ON(sa >= BIT(5)); 314 if (sa >= BIT(5))
317 emit_instr(ctx, sll, dst, src, sa); 315 /* Shifting >= 32 results in zero */
316 emit_jit_reg_move(dst, r_zero, ctx);
317 else
318 emit_instr(ctx, sll, dst, src, sa);
318} 319}
319 320
320static inline void emit_srlv(unsigned int dst, unsigned int src, 321static inline void emit_srlv(unsigned int dst, unsigned int src,
@@ -327,8 +328,17 @@ static inline void emit_srl(unsigned int dst, unsigned int src,
327 unsigned int sa, struct jit_ctx *ctx) 328 unsigned int sa, struct jit_ctx *ctx)
328{ 329{
329 /* sa is 5-bits long */ 330 /* sa is 5-bits long */
330 BUG_ON(sa >= BIT(5)); 331 if (sa >= BIT(5))
331 emit_instr(ctx, srl, dst, src, sa); 332 /* Shifting >= 32 results in zero */
333 emit_jit_reg_move(dst, r_zero, ctx);
334 else
335 emit_instr(ctx, srl, dst, src, sa);
336}
337
338static inline void emit_slt(unsigned int dst, unsigned int src1,
339 unsigned int src2, struct jit_ctx *ctx)
340{
341 emit_instr(ctx, slt, dst, src1, src2);
332} 342}
333 343
334static inline void emit_sltu(unsigned int dst, unsigned int src1, 344static inline void emit_sltu(unsigned int dst, unsigned int src1,
@@ -341,7 +351,7 @@ static inline void emit_sltiu(unsigned dst, unsigned int src,
341 unsigned int imm, struct jit_ctx *ctx) 351 unsigned int imm, struct jit_ctx *ctx)
342{ 352{
343 /* 16 bit immediate */ 353 /* 16 bit immediate */
344 if (is_range16((s32)imm)) { 354 if (!is_range16((s32)imm)) {
345 emit_load_imm(r_tmp, imm, ctx); 355 emit_load_imm(r_tmp, imm, ctx);
346 emit_sltu(dst, src, r_tmp, ctx); 356 emit_sltu(dst, src, r_tmp, ctx);
347 } else { 357 } else {
@@ -408,7 +418,7 @@ static inline void emit_div(unsigned int dst, unsigned int src,
408 u32 *p = &ctx->target[ctx->idx]; 418 u32 *p = &ctx->target[ctx->idx];
409 uasm_i_divu(&p, dst, src); 419 uasm_i_divu(&p, dst, src);
410 p = &ctx->target[ctx->idx + 1]; 420 p = &ctx->target[ctx->idx + 1];
411 uasm_i_mfhi(&p, dst); 421 uasm_i_mflo(&p, dst);
412 } 422 }
413 ctx->idx += 2; /* 2 insts */ 423 ctx->idx += 2; /* 2 insts */
414} 424}
@@ -443,6 +453,17 @@ static inline void emit_wsbh(unsigned int dst, unsigned int src,
443 emit_instr(ctx, wsbh, dst, src); 453 emit_instr(ctx, wsbh, dst, src);
444} 454}
445 455
456/* load pointer to register */
457static inline void emit_load_ptr(unsigned int dst, unsigned int src,
458 int imm, struct jit_ctx *ctx)
459{
460 /* src contains the base addr of the 32/64-pointer */
461 if (config_enabled(CONFIG_64BIT))
462 emit_instr(ctx, ld, dst, imm, src);
463 else
464 emit_instr(ctx, lw, dst, imm, src);
465}
466
446/* load a function pointer to register */ 467/* load a function pointer to register */
447static inline void emit_load_func(unsigned int reg, ptr imm, 468static inline void emit_load_func(unsigned int reg, ptr imm,
448 struct jit_ctx *ctx) 469 struct jit_ctx *ctx)
@@ -545,29 +566,13 @@ static inline u16 align_sp(unsigned int num)
545 return num; 566 return num;
546} 567}
547 568
548static inline void update_on_xread(struct jit_ctx *ctx)
549{
550 if (!(ctx->flags & SEEN_X))
551 ctx->flags |= FLAG_NEED_X_RESET;
552
553 ctx->flags |= SEEN_X;
554}
555
556static bool is_load_to_a(u16 inst) 569static bool is_load_to_a(u16 inst)
557{ 570{
558 switch (inst) { 571 switch (inst) {
559 case BPF_S_LD_W_LEN: 572 case BPF_LD | BPF_W | BPF_LEN:
560 case BPF_S_LD_W_ABS: 573 case BPF_LD | BPF_W | BPF_ABS:
561 case BPF_S_LD_H_ABS: 574 case BPF_LD | BPF_H | BPF_ABS:
562 case BPF_S_LD_B_ABS: 575 case BPF_LD | BPF_B | BPF_ABS:
563 case BPF_S_ANC_CPU:
564 case BPF_S_ANC_IFINDEX:
565 case BPF_S_ANC_MARK:
566 case BPF_S_ANC_PROTOCOL:
567 case BPF_S_ANC_RXHASH:
568 case BPF_S_ANC_VLAN_TAG:
569 case BPF_S_ANC_VLAN_TAG_PRESENT:
570 case BPF_S_ANC_QUEUE:
571 return true; 576 return true;
572 default: 577 default:
573 return false; 578 return false;
@@ -618,7 +623,10 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset)
618 if (ctx->flags & SEEN_MEM) { 623 if (ctx->flags & SEEN_MEM) {
619 if (real_off % (RSIZE * 2)) 624 if (real_off % (RSIZE * 2))
620 real_off += RSIZE; 625 real_off += RSIZE;
621 emit_addiu(r_M, r_sp, real_off, ctx); 626 if (config_enabled(CONFIG_64BIT))
627 emit_daddiu(r_M, r_sp, real_off, ctx);
628 else
629 emit_addiu(r_M, r_sp, real_off, ctx);
622 } 630 }
623} 631}
624 632
@@ -705,11 +713,11 @@ static void build_prologue(struct jit_ctx *ctx)
705 if (ctx->flags & SEEN_SKB) 713 if (ctx->flags & SEEN_SKB)
706 emit_reg_move(r_skb, MIPS_R_A0, ctx); 714 emit_reg_move(r_skb, MIPS_R_A0, ctx);
707 715
708 if (ctx->flags & FLAG_NEED_X_RESET) 716 if (ctx->flags & SEEN_X)
709 emit_jit_reg_move(r_X, r_zero, ctx); 717 emit_jit_reg_move(r_X, r_zero, ctx);
710 718
711 /* Do not leak kernel data to userspace */ 719 /* Do not leak kernel data to userspace */
712 if ((first_inst != BPF_S_RET_K) && !(is_load_to_a(first_inst))) 720 if ((first_inst != (BPF_RET | BPF_K)) && !(is_load_to_a(first_inst)))
713 emit_jit_reg_move(r_A, r_zero, ctx); 721 emit_jit_reg_move(r_A, r_zero, ctx);
714} 722}
715 723
@@ -757,13 +765,17 @@ static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset)
757 return (u64)err << 32 | ntohl(ret); 765 return (u64)err << 32 | ntohl(ret);
758} 766}
759 767
760#define PKT_TYPE_MAX 7 768#ifdef __BIG_ENDIAN_BITFIELD
769#define PKT_TYPE_MAX (7 << 5)
770#else
771#define PKT_TYPE_MAX 7
772#endif
761static int pkt_type_offset(void) 773static int pkt_type_offset(void)
762{ 774{
763 struct sk_buff skb_probe = { 775 struct sk_buff skb_probe = {
764 .pkt_type = ~0, 776 .pkt_type = ~0,
765 }; 777 };
766 char *ct = (char *)&skb_probe; 778 u8 *ct = (u8 *)&skb_probe;
767 unsigned int off; 779 unsigned int off;
768 780
769 for (off = 0; off < sizeof(struct sk_buff); off++) { 781 for (off = 0; off < sizeof(struct sk_buff); off++) {
@@ -783,46 +795,62 @@ static int build_body(struct jit_ctx *ctx)
783 u32 k, b_off __maybe_unused; 795 u32 k, b_off __maybe_unused;
784 796
785 for (i = 0; i < prog->len; i++) { 797 for (i = 0; i < prog->len; i++) {
798 u16 code;
799
786 inst = &(prog->insns[i]); 800 inst = &(prog->insns[i]);
787 pr_debug("%s: code->0x%02x, jt->0x%x, jf->0x%x, k->0x%x\n", 801 pr_debug("%s: code->0x%02x, jt->0x%x, jf->0x%x, k->0x%x\n",
788 __func__, inst->code, inst->jt, inst->jf, inst->k); 802 __func__, inst->code, inst->jt, inst->jf, inst->k);
789 k = inst->k; 803 k = inst->k;
804 code = bpf_anc_helper(inst);
790 805
791 if (ctx->target == NULL) 806 if (ctx->target == NULL)
792 ctx->offsets[i] = ctx->idx * 4; 807 ctx->offsets[i] = ctx->idx * 4;
793 808
794 switch (inst->code) { 809 switch (code) {
795 case BPF_S_LD_IMM: 810 case BPF_LD | BPF_IMM:
796 /* A <- k ==> li r_A, k */ 811 /* A <- k ==> li r_A, k */
797 ctx->flags |= SEEN_A; 812 ctx->flags |= SEEN_A;
798 emit_load_imm(r_A, k, ctx); 813 emit_load_imm(r_A, k, ctx);
799 break; 814 break;
800 case BPF_S_LD_W_LEN: 815 case BPF_LD | BPF_W | BPF_LEN:
801 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4); 816 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4);
802 /* A <- len ==> lw r_A, offset(skb) */ 817 /* A <- len ==> lw r_A, offset(skb) */
803 ctx->flags |= SEEN_SKB | SEEN_A; 818 ctx->flags |= SEEN_SKB | SEEN_A;
804 off = offsetof(struct sk_buff, len); 819 off = offsetof(struct sk_buff, len);
805 emit_load(r_A, r_skb, off, ctx); 820 emit_load(r_A, r_skb, off, ctx);
806 break; 821 break;
807 case BPF_S_LD_MEM: 822 case BPF_LD | BPF_MEM:
808 /* A <- M[k] ==> lw r_A, offset(M) */ 823 /* A <- M[k] ==> lw r_A, offset(M) */
809 ctx->flags |= SEEN_MEM | SEEN_A; 824 ctx->flags |= SEEN_MEM | SEEN_A;
810 emit_load(r_A, r_M, SCRATCH_OFF(k), ctx); 825 emit_load(r_A, r_M, SCRATCH_OFF(k), ctx);
811 break; 826 break;
812 case BPF_S_LD_W_ABS: 827 case BPF_LD | BPF_W | BPF_ABS:
813 /* A <- P[k:4] */ 828 /* A <- P[k:4] */
814 load_order = 2; 829 load_order = 2;
815 goto load; 830 goto load;
816 case BPF_S_LD_H_ABS: 831 case BPF_LD | BPF_H | BPF_ABS:
817 /* A <- P[k:2] */ 832 /* A <- P[k:2] */
818 load_order = 1; 833 load_order = 1;
819 goto load; 834 goto load;
820 case BPF_S_LD_B_ABS: 835 case BPF_LD | BPF_B | BPF_ABS:
821 /* A <- P[k:1] */ 836 /* A <- P[k:1] */
822 load_order = 0; 837 load_order = 0;
823load: 838load:
839 /* the interpreter will deal with the negative K */
840 if ((int)k < 0)
841 return -ENOTSUPP;
842
824 emit_load_imm(r_off, k, ctx); 843 emit_load_imm(r_off, k, ctx);
825load_common: 844load_common:
845 /*
846 * We may got here from the indirect loads so
847 * return if offset is negative.
848 */
849 emit_slt(r_s0, r_off, r_zero, ctx);
850 emit_bcond(MIPS_COND_NE, r_s0, r_zero,
851 b_imm(prog->len, ctx), ctx);
852 emit_reg_move(r_ret, r_zero, ctx);
853
826 ctx->flags |= SEEN_CALL | SEEN_OFF | SEEN_S0 | 854 ctx->flags |= SEEN_CALL | SEEN_OFF | SEEN_S0 |
827 SEEN_SKB | SEEN_A; 855 SEEN_SKB | SEEN_A;
828 856
@@ -852,39 +880,42 @@ load_common:
852 emit_b(b_imm(prog->len, ctx), ctx); 880 emit_b(b_imm(prog->len, ctx), ctx);
853 emit_reg_move(r_ret, r_zero, ctx); 881 emit_reg_move(r_ret, r_zero, ctx);
854 break; 882 break;
855 case BPF_S_LD_W_IND: 883 case BPF_LD | BPF_W | BPF_IND:
856 /* A <- P[X + k:4] */ 884 /* A <- P[X + k:4] */
857 load_order = 2; 885 load_order = 2;
858 goto load_ind; 886 goto load_ind;
859 case BPF_S_LD_H_IND: 887 case BPF_LD | BPF_H | BPF_IND:
860 /* A <- P[X + k:2] */ 888 /* A <- P[X + k:2] */
861 load_order = 1; 889 load_order = 1;
862 goto load_ind; 890 goto load_ind;
863 case BPF_S_LD_B_IND: 891 case BPF_LD | BPF_B | BPF_IND:
864 /* A <- P[X + k:1] */ 892 /* A <- P[X + k:1] */
865 load_order = 0; 893 load_order = 0;
866load_ind: 894load_ind:
867 update_on_xread(ctx);
868 ctx->flags |= SEEN_OFF | SEEN_X; 895 ctx->flags |= SEEN_OFF | SEEN_X;
869 emit_addiu(r_off, r_X, k, ctx); 896 emit_addiu(r_off, r_X, k, ctx);
870 goto load_common; 897 goto load_common;
871 case BPF_S_LDX_IMM: 898 case BPF_LDX | BPF_IMM:
872 /* X <- k */ 899 /* X <- k */
873 ctx->flags |= SEEN_X; 900 ctx->flags |= SEEN_X;
874 emit_load_imm(r_X, k, ctx); 901 emit_load_imm(r_X, k, ctx);
875 break; 902 break;
876 case BPF_S_LDX_MEM: 903 case BPF_LDX | BPF_MEM:
877 /* X <- M[k] */ 904 /* X <- M[k] */
878 ctx->flags |= SEEN_X | SEEN_MEM; 905 ctx->flags |= SEEN_X | SEEN_MEM;
879 emit_load(r_X, r_M, SCRATCH_OFF(k), ctx); 906 emit_load(r_X, r_M, SCRATCH_OFF(k), ctx);
880 break; 907 break;
881 case BPF_S_LDX_W_LEN: 908 case BPF_LDX | BPF_W | BPF_LEN:
882 /* X <- len */ 909 /* X <- len */
883 ctx->flags |= SEEN_X | SEEN_SKB; 910 ctx->flags |= SEEN_X | SEEN_SKB;
884 off = offsetof(struct sk_buff, len); 911 off = offsetof(struct sk_buff, len);
885 emit_load(r_X, r_skb, off, ctx); 912 emit_load(r_X, r_skb, off, ctx);
886 break; 913 break;
887 case BPF_S_LDX_B_MSH: 914 case BPF_LDX | BPF_B | BPF_MSH:
915 /* the interpreter will deal with the negative K */
916 if ((int)k < 0)
917 return -ENOTSUPP;
918
888 /* X <- 4 * (P[k:1] & 0xf) */ 919 /* X <- 4 * (P[k:1] & 0xf) */
889 ctx->flags |= SEEN_X | SEEN_CALL | SEEN_S0 | SEEN_SKB; 920 ctx->flags |= SEEN_X | SEEN_CALL | SEEN_S0 | SEEN_SKB;
890 /* Load offset to a1 */ 921 /* Load offset to a1 */
@@ -917,50 +948,49 @@ load_ind:
917 emit_b(b_imm(prog->len, ctx), ctx); 948 emit_b(b_imm(prog->len, ctx), ctx);
918 emit_load_imm(r_ret, 0, ctx); /* delay slot */ 949 emit_load_imm(r_ret, 0, ctx); /* delay slot */
919 break; 950 break;
920 case BPF_S_ST: 951 case BPF_ST:
921 /* M[k] <- A */ 952 /* M[k] <- A */
922 ctx->flags |= SEEN_MEM | SEEN_A; 953 ctx->flags |= SEEN_MEM | SEEN_A;
923 emit_store(r_A, r_M, SCRATCH_OFF(k), ctx); 954 emit_store(r_A, r_M, SCRATCH_OFF(k), ctx);
924 break; 955 break;
925 case BPF_S_STX: 956 case BPF_STX:
926 /* M[k] <- X */ 957 /* M[k] <- X */
927 ctx->flags |= SEEN_MEM | SEEN_X; 958 ctx->flags |= SEEN_MEM | SEEN_X;
928 emit_store(r_X, r_M, SCRATCH_OFF(k), ctx); 959 emit_store(r_X, r_M, SCRATCH_OFF(k), ctx);
929 break; 960 break;
930 case BPF_S_ALU_ADD_K: 961 case BPF_ALU | BPF_ADD | BPF_K:
931 /* A += K */ 962 /* A += K */
932 ctx->flags |= SEEN_A; 963 ctx->flags |= SEEN_A;
933 emit_addiu(r_A, r_A, k, ctx); 964 emit_addiu(r_A, r_A, k, ctx);
934 break; 965 break;
935 case BPF_S_ALU_ADD_X: 966 case BPF_ALU | BPF_ADD | BPF_X:
936 /* A += X */ 967 /* A += X */
937 ctx->flags |= SEEN_A | SEEN_X; 968 ctx->flags |= SEEN_A | SEEN_X;
938 emit_addu(r_A, r_A, r_X, ctx); 969 emit_addu(r_A, r_A, r_X, ctx);
939 break; 970 break;
940 case BPF_S_ALU_SUB_K: 971 case BPF_ALU | BPF_SUB | BPF_K:
941 /* A -= K */ 972 /* A -= K */
942 ctx->flags |= SEEN_A; 973 ctx->flags |= SEEN_A;
943 emit_addiu(r_A, r_A, -k, ctx); 974 emit_addiu(r_A, r_A, -k, ctx);
944 break; 975 break;
945 case BPF_S_ALU_SUB_X: 976 case BPF_ALU | BPF_SUB | BPF_X:
946 /* A -= X */ 977 /* A -= X */
947 ctx->flags |= SEEN_A | SEEN_X; 978 ctx->flags |= SEEN_A | SEEN_X;
948 emit_subu(r_A, r_A, r_X, ctx); 979 emit_subu(r_A, r_A, r_X, ctx);
949 break; 980 break;
950 case BPF_S_ALU_MUL_K: 981 case BPF_ALU | BPF_MUL | BPF_K:
951 /* A *= K */ 982 /* A *= K */
952 /* Load K to scratch register before MUL */ 983 /* Load K to scratch register before MUL */
953 ctx->flags |= SEEN_A | SEEN_S0; 984 ctx->flags |= SEEN_A | SEEN_S0;
954 emit_load_imm(r_s0, k, ctx); 985 emit_load_imm(r_s0, k, ctx);
955 emit_mul(r_A, r_A, r_s0, ctx); 986 emit_mul(r_A, r_A, r_s0, ctx);
956 break; 987 break;
957 case BPF_S_ALU_MUL_X: 988 case BPF_ALU | BPF_MUL | BPF_X:
958 /* A *= X */ 989 /* A *= X */
959 update_on_xread(ctx);
960 ctx->flags |= SEEN_A | SEEN_X; 990 ctx->flags |= SEEN_A | SEEN_X;
961 emit_mul(r_A, r_A, r_X, ctx); 991 emit_mul(r_A, r_A, r_X, ctx);
962 break; 992 break;
963 case BPF_S_ALU_DIV_K: 993 case BPF_ALU | BPF_DIV | BPF_K:
964 /* A /= k */ 994 /* A /= k */
965 if (k == 1) 995 if (k == 1)
966 break; 996 break;
@@ -973,7 +1003,7 @@ load_ind:
973 emit_load_imm(r_s0, k, ctx); 1003 emit_load_imm(r_s0, k, ctx);
974 emit_div(r_A, r_s0, ctx); 1004 emit_div(r_A, r_s0, ctx);
975 break; 1005 break;
976 case BPF_S_ALU_MOD_K: 1006 case BPF_ALU | BPF_MOD | BPF_K:
977 /* A %= k */ 1007 /* A %= k */
978 if (k == 1 || optimize_div(&k)) { 1008 if (k == 1 || optimize_div(&k)) {
979 ctx->flags |= SEEN_A; 1009 ctx->flags |= SEEN_A;
@@ -984,9 +1014,8 @@ load_ind:
984 emit_mod(r_A, r_s0, ctx); 1014 emit_mod(r_A, r_s0, ctx);
985 } 1015 }
986 break; 1016 break;
987 case BPF_S_ALU_DIV_X: 1017 case BPF_ALU | BPF_DIV | BPF_X:
988 /* A /= X */ 1018 /* A /= X */
989 update_on_xread(ctx);
990 ctx->flags |= SEEN_X | SEEN_A; 1019 ctx->flags |= SEEN_X | SEEN_A;
991 /* Check if r_X is zero */ 1020 /* Check if r_X is zero */
992 emit_bcond(MIPS_COND_EQ, r_X, r_zero, 1021 emit_bcond(MIPS_COND_EQ, r_X, r_zero,
@@ -994,9 +1023,8 @@ load_ind:
994 emit_load_imm(r_val, 0, ctx); /* delay slot */ 1023 emit_load_imm(r_val, 0, ctx); /* delay slot */
995 emit_div(r_A, r_X, ctx); 1024 emit_div(r_A, r_X, ctx);
996 break; 1025 break;
997 case BPF_S_ALU_MOD_X: 1026 case BPF_ALU | BPF_MOD | BPF_X:
998 /* A %= X */ 1027 /* A %= X */
999 update_on_xread(ctx);
1000 ctx->flags |= SEEN_X | SEEN_A; 1028 ctx->flags |= SEEN_X | SEEN_A;
1001 /* Check if r_X is zero */ 1029 /* Check if r_X is zero */
1002 emit_bcond(MIPS_COND_EQ, r_X, r_zero, 1030 emit_bcond(MIPS_COND_EQ, r_X, r_zero,
@@ -1004,94 +1032,89 @@ load_ind:
1004 emit_load_imm(r_val, 0, ctx); /* delay slot */ 1032 emit_load_imm(r_val, 0, ctx); /* delay slot */
1005 emit_mod(r_A, r_X, ctx); 1033 emit_mod(r_A, r_X, ctx);
1006 break; 1034 break;
1007 case BPF_S_ALU_OR_K: 1035 case BPF_ALU | BPF_OR | BPF_K:
1008 /* A |= K */ 1036 /* A |= K */
1009 ctx->flags |= SEEN_A; 1037 ctx->flags |= SEEN_A;
1010 emit_ori(r_A, r_A, k, ctx); 1038 emit_ori(r_A, r_A, k, ctx);
1011 break; 1039 break;
1012 case BPF_S_ALU_OR_X: 1040 case BPF_ALU | BPF_OR | BPF_X:
1013 /* A |= X */ 1041 /* A |= X */
1014 update_on_xread(ctx);
1015 ctx->flags |= SEEN_A; 1042 ctx->flags |= SEEN_A;
1016 emit_ori(r_A, r_A, r_X, ctx); 1043 emit_ori(r_A, r_A, r_X, ctx);
1017 break; 1044 break;
1018 case BPF_S_ALU_XOR_K: 1045 case BPF_ALU | BPF_XOR | BPF_K:
1019 /* A ^= k */ 1046 /* A ^= k */
1020 ctx->flags |= SEEN_A; 1047 ctx->flags |= SEEN_A;
1021 emit_xori(r_A, r_A, k, ctx); 1048 emit_xori(r_A, r_A, k, ctx);
1022 break; 1049 break;
1023 case BPF_S_ANC_ALU_XOR_X: 1050 case BPF_ANC | SKF_AD_ALU_XOR_X:
1024 case BPF_S_ALU_XOR_X: 1051 case BPF_ALU | BPF_XOR | BPF_X:
1025 /* A ^= X */ 1052 /* A ^= X */
1026 update_on_xread(ctx);
1027 ctx->flags |= SEEN_A; 1053 ctx->flags |= SEEN_A;
1028 emit_xor(r_A, r_A, r_X, ctx); 1054 emit_xor(r_A, r_A, r_X, ctx);
1029 break; 1055 break;
1030 case BPF_S_ALU_AND_K: 1056 case BPF_ALU | BPF_AND | BPF_K:
1031 /* A &= K */ 1057 /* A &= K */
1032 ctx->flags |= SEEN_A; 1058 ctx->flags |= SEEN_A;
1033 emit_andi(r_A, r_A, k, ctx); 1059 emit_andi(r_A, r_A, k, ctx);
1034 break; 1060 break;
1035 case BPF_S_ALU_AND_X: 1061 case BPF_ALU | BPF_AND | BPF_X:
1036 /* A &= X */ 1062 /* A &= X */
1037 update_on_xread(ctx);
1038 ctx->flags |= SEEN_A | SEEN_X; 1063 ctx->flags |= SEEN_A | SEEN_X;
1039 emit_and(r_A, r_A, r_X, ctx); 1064 emit_and(r_A, r_A, r_X, ctx);
1040 break; 1065 break;
1041 case BPF_S_ALU_LSH_K: 1066 case BPF_ALU | BPF_LSH | BPF_K:
1042 /* A <<= K */ 1067 /* A <<= K */
1043 ctx->flags |= SEEN_A; 1068 ctx->flags |= SEEN_A;
1044 emit_sll(r_A, r_A, k, ctx); 1069 emit_sll(r_A, r_A, k, ctx);
1045 break; 1070 break;
1046 case BPF_S_ALU_LSH_X: 1071 case BPF_ALU | BPF_LSH | BPF_X:
1047 /* A <<= X */ 1072 /* A <<= X */
1048 ctx->flags |= SEEN_A | SEEN_X; 1073 ctx->flags |= SEEN_A | SEEN_X;
1049 update_on_xread(ctx);
1050 emit_sllv(r_A, r_A, r_X, ctx); 1074 emit_sllv(r_A, r_A, r_X, ctx);
1051 break; 1075 break;
1052 case BPF_S_ALU_RSH_K: 1076 case BPF_ALU | BPF_RSH | BPF_K:
1053 /* A >>= K */ 1077 /* A >>= K */
1054 ctx->flags |= SEEN_A; 1078 ctx->flags |= SEEN_A;
1055 emit_srl(r_A, r_A, k, ctx); 1079 emit_srl(r_A, r_A, k, ctx);
1056 break; 1080 break;
1057 case BPF_S_ALU_RSH_X: 1081 case BPF_ALU | BPF_RSH | BPF_X:
1058 ctx->flags |= SEEN_A | SEEN_X; 1082 ctx->flags |= SEEN_A | SEEN_X;
1059 update_on_xread(ctx);
1060 emit_srlv(r_A, r_A, r_X, ctx); 1083 emit_srlv(r_A, r_A, r_X, ctx);
1061 break; 1084 break;
1062 case BPF_S_ALU_NEG: 1085 case BPF_ALU | BPF_NEG:
1063 /* A = -A */ 1086 /* A = -A */
1064 ctx->flags |= SEEN_A; 1087 ctx->flags |= SEEN_A;
1065 emit_neg(r_A, ctx); 1088 emit_neg(r_A, ctx);
1066 break; 1089 break;
1067 case BPF_S_JMP_JA: 1090 case BPF_JMP | BPF_JA:
1068 /* pc += K */ 1091 /* pc += K */
1069 emit_b(b_imm(i + k + 1, ctx), ctx); 1092 emit_b(b_imm(i + k + 1, ctx), ctx);
1070 emit_nop(ctx); 1093 emit_nop(ctx);
1071 break; 1094 break;
1072 case BPF_S_JMP_JEQ_K: 1095 case BPF_JMP | BPF_JEQ | BPF_K:
1073 /* pc += ( A == K ) ? pc->jt : pc->jf */ 1096 /* pc += ( A == K ) ? pc->jt : pc->jf */
1074 condt = MIPS_COND_EQ | MIPS_COND_K; 1097 condt = MIPS_COND_EQ | MIPS_COND_K;
1075 goto jmp_cmp; 1098 goto jmp_cmp;
1076 case BPF_S_JMP_JEQ_X: 1099 case BPF_JMP | BPF_JEQ | BPF_X:
1077 ctx->flags |= SEEN_X; 1100 ctx->flags |= SEEN_X;
1078 /* pc += ( A == X ) ? pc->jt : pc->jf */ 1101 /* pc += ( A == X ) ? pc->jt : pc->jf */
1079 condt = MIPS_COND_EQ | MIPS_COND_X; 1102 condt = MIPS_COND_EQ | MIPS_COND_X;
1080 goto jmp_cmp; 1103 goto jmp_cmp;
1081 case BPF_S_JMP_JGE_K: 1104 case BPF_JMP | BPF_JGE | BPF_K:
1082 /* pc += ( A >= K ) ? pc->jt : pc->jf */ 1105 /* pc += ( A >= K ) ? pc->jt : pc->jf */
1083 condt = MIPS_COND_GE | MIPS_COND_K; 1106 condt = MIPS_COND_GE | MIPS_COND_K;
1084 goto jmp_cmp; 1107 goto jmp_cmp;
1085 case BPF_S_JMP_JGE_X: 1108 case BPF_JMP | BPF_JGE | BPF_X:
1086 ctx->flags |= SEEN_X; 1109 ctx->flags |= SEEN_X;
1087 /* pc += ( A >= X ) ? pc->jt : pc->jf */ 1110 /* pc += ( A >= X ) ? pc->jt : pc->jf */
1088 condt = MIPS_COND_GE | MIPS_COND_X; 1111 condt = MIPS_COND_GE | MIPS_COND_X;
1089 goto jmp_cmp; 1112 goto jmp_cmp;
1090 case BPF_S_JMP_JGT_K: 1113 case BPF_JMP | BPF_JGT | BPF_K:
1091 /* pc += ( A > K ) ? pc->jt : pc->jf */ 1114 /* pc += ( A > K ) ? pc->jt : pc->jf */
1092 condt = MIPS_COND_GT | MIPS_COND_K; 1115 condt = MIPS_COND_GT | MIPS_COND_K;
1093 goto jmp_cmp; 1116 goto jmp_cmp;
1094 case BPF_S_JMP_JGT_X: 1117 case BPF_JMP | BPF_JGT | BPF_X:
1095 ctx->flags |= SEEN_X; 1118 ctx->flags |= SEEN_X;
1096 /* pc += ( A > X ) ? pc->jt : pc->jf */ 1119 /* pc += ( A > X ) ? pc->jt : pc->jf */
1097 condt = MIPS_COND_GT | MIPS_COND_X; 1120 condt = MIPS_COND_GT | MIPS_COND_X;
@@ -1109,7 +1132,7 @@ jmp_cmp:
1109 } 1132 }
1110 /* A < (K|X) ? r_scrach = 1 */ 1133 /* A < (K|X) ? r_scrach = 1 */
1111 b_off = b_imm(i + inst->jf + 1, ctx); 1134 b_off = b_imm(i + inst->jf + 1, ctx);
1112 emit_bcond(MIPS_COND_GT, r_s0, r_zero, b_off, 1135 emit_bcond(MIPS_COND_NE, r_s0, r_zero, b_off,
1113 ctx); 1136 ctx);
1114 emit_nop(ctx); 1137 emit_nop(ctx);
1115 /* A > (K|X) ? scratch = 0 */ 1138 /* A > (K|X) ? scratch = 0 */
@@ -1167,7 +1190,7 @@ jmp_cmp:
1167 } 1190 }
1168 } 1191 }
1169 break; 1192 break;
1170 case BPF_S_JMP_JSET_K: 1193 case BPF_JMP | BPF_JSET | BPF_K:
1171 ctx->flags |= SEEN_S0 | SEEN_S1 | SEEN_A; 1194 ctx->flags |= SEEN_S0 | SEEN_S1 | SEEN_A;
1172 /* pc += (A & K) ? pc -> jt : pc -> jf */ 1195 /* pc += (A & K) ? pc -> jt : pc -> jf */
1173 emit_load_imm(r_s1, k, ctx); 1196 emit_load_imm(r_s1, k, ctx);
@@ -1181,7 +1204,7 @@ jmp_cmp:
1181 emit_b(b_off, ctx); 1204 emit_b(b_off, ctx);
1182 emit_nop(ctx); 1205 emit_nop(ctx);
1183 break; 1206 break;
1184 case BPF_S_JMP_JSET_X: 1207 case BPF_JMP | BPF_JSET | BPF_X:
1185 ctx->flags |= SEEN_S0 | SEEN_X | SEEN_A; 1208 ctx->flags |= SEEN_S0 | SEEN_X | SEEN_A;
1186 /* pc += (A & X) ? pc -> jt : pc -> jf */ 1209 /* pc += (A & X) ? pc -> jt : pc -> jf */
1187 emit_and(r_s0, r_A, r_X, ctx); 1210 emit_and(r_s0, r_A, r_X, ctx);
@@ -1194,7 +1217,7 @@ jmp_cmp:
1194 emit_b(b_off, ctx); 1217 emit_b(b_off, ctx);
1195 emit_nop(ctx); 1218 emit_nop(ctx);
1196 break; 1219 break;
1197 case BPF_S_RET_A: 1220 case BPF_RET | BPF_A:
1198 ctx->flags |= SEEN_A; 1221 ctx->flags |= SEEN_A;
1199 if (i != prog->len - 1) 1222 if (i != prog->len - 1)
1200 /* 1223 /*
@@ -1204,7 +1227,7 @@ jmp_cmp:
1204 emit_b(b_imm(prog->len, ctx), ctx); 1227 emit_b(b_imm(prog->len, ctx), ctx);
1205 emit_reg_move(r_ret, r_A, ctx); /* delay slot */ 1228 emit_reg_move(r_ret, r_A, ctx); /* delay slot */
1206 break; 1229 break;
1207 case BPF_S_RET_K: 1230 case BPF_RET | BPF_K:
1208 /* 1231 /*
1209 * It can emit two instructions so it does not fit on 1232 * It can emit two instructions so it does not fit on
1210 * the delay slot. 1233 * the delay slot.
@@ -1219,19 +1242,18 @@ jmp_cmp:
1219 emit_nop(ctx); 1242 emit_nop(ctx);
1220 } 1243 }
1221 break; 1244 break;
1222 case BPF_S_MISC_TAX: 1245 case BPF_MISC | BPF_TAX:
1223 /* X = A */ 1246 /* X = A */
1224 ctx->flags |= SEEN_X | SEEN_A; 1247 ctx->flags |= SEEN_X | SEEN_A;
1225 emit_jit_reg_move(r_X, r_A, ctx); 1248 emit_jit_reg_move(r_X, r_A, ctx);
1226 break; 1249 break;
1227 case BPF_S_MISC_TXA: 1250 case BPF_MISC | BPF_TXA:
1228 /* A = X */ 1251 /* A = X */
1229 ctx->flags |= SEEN_A | SEEN_X; 1252 ctx->flags |= SEEN_A | SEEN_X;
1230 update_on_xread(ctx);
1231 emit_jit_reg_move(r_A, r_X, ctx); 1253 emit_jit_reg_move(r_A, r_X, ctx);
1232 break; 1254 break;
1233 /* AUX */ 1255 /* AUX */
1234 case BPF_S_ANC_PROTOCOL: 1256 case BPF_ANC | SKF_AD_PROTOCOL:
1235 /* A = ntohs(skb->protocol */ 1257 /* A = ntohs(skb->protocol */
1236 ctx->flags |= SEEN_SKB | SEEN_OFF | SEEN_A; 1258 ctx->flags |= SEEN_SKB | SEEN_OFF | SEEN_A;
1237 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, 1259 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
@@ -1256,7 +1278,7 @@ jmp_cmp:
1256 } 1278 }
1257#endif 1279#endif
1258 break; 1280 break;
1259 case BPF_S_ANC_CPU: 1281 case BPF_ANC | SKF_AD_CPU:
1260 ctx->flags |= SEEN_A | SEEN_OFF; 1282 ctx->flags |= SEEN_A | SEEN_OFF;
1261 /* A = current_thread_info()->cpu */ 1283 /* A = current_thread_info()->cpu */
1262 BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, 1284 BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info,
@@ -1265,11 +1287,12 @@ jmp_cmp:
1265 /* $28/gp points to the thread_info struct */ 1287 /* $28/gp points to the thread_info struct */
1266 emit_load(r_A, 28, off, ctx); 1288 emit_load(r_A, 28, off, ctx);
1267 break; 1289 break;
1268 case BPF_S_ANC_IFINDEX: 1290 case BPF_ANC | SKF_AD_IFINDEX:
1269 /* A = skb->dev->ifindex */ 1291 /* A = skb->dev->ifindex */
1270 ctx->flags |= SEEN_SKB | SEEN_A | SEEN_S0; 1292 ctx->flags |= SEEN_SKB | SEEN_A | SEEN_S0;
1271 off = offsetof(struct sk_buff, dev); 1293 off = offsetof(struct sk_buff, dev);
1272 emit_load(r_s0, r_skb, off, ctx); 1294 /* Load *dev pointer */
1295 emit_load_ptr(r_s0, r_skb, off, ctx);
1273 /* error (0) in the delay slot */ 1296 /* error (0) in the delay slot */
1274 emit_bcond(MIPS_COND_EQ, r_s0, r_zero, 1297 emit_bcond(MIPS_COND_EQ, r_s0, r_zero,
1275 b_imm(prog->len, ctx), ctx); 1298 b_imm(prog->len, ctx), ctx);
@@ -1279,31 +1302,36 @@ jmp_cmp:
1279 off = offsetof(struct net_device, ifindex); 1302 off = offsetof(struct net_device, ifindex);
1280 emit_load(r_A, r_s0, off, ctx); 1303 emit_load(r_A, r_s0, off, ctx);
1281 break; 1304 break;
1282 case BPF_S_ANC_MARK: 1305 case BPF_ANC | SKF_AD_MARK:
1283 ctx->flags |= SEEN_SKB | SEEN_A; 1306 ctx->flags |= SEEN_SKB | SEEN_A;
1284 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4); 1307 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4);
1285 off = offsetof(struct sk_buff, mark); 1308 off = offsetof(struct sk_buff, mark);
1286 emit_load(r_A, r_skb, off, ctx); 1309 emit_load(r_A, r_skb, off, ctx);
1287 break; 1310 break;
1288 case BPF_S_ANC_RXHASH: 1311 case BPF_ANC | SKF_AD_RXHASH:
1289 ctx->flags |= SEEN_SKB | SEEN_A; 1312 ctx->flags |= SEEN_SKB | SEEN_A;
1290 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4); 1313 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4);
1291 off = offsetof(struct sk_buff, hash); 1314 off = offsetof(struct sk_buff, hash);
1292 emit_load(r_A, r_skb, off, ctx); 1315 emit_load(r_A, r_skb, off, ctx);
1293 break; 1316 break;
1294 case BPF_S_ANC_VLAN_TAG: 1317 case BPF_ANC | SKF_AD_VLAN_TAG:
1295 case BPF_S_ANC_VLAN_TAG_PRESENT: 1318 case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
1296 ctx->flags |= SEEN_SKB | SEEN_S0 | SEEN_A; 1319 ctx->flags |= SEEN_SKB | SEEN_S0 | SEEN_A;
1297 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, 1320 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
1298 vlan_tci) != 2); 1321 vlan_tci) != 2);
1299 off = offsetof(struct sk_buff, vlan_tci); 1322 off = offsetof(struct sk_buff, vlan_tci);
1300 emit_half_load(r_s0, r_skb, off, ctx); 1323 emit_half_load(r_s0, r_skb, off, ctx);
1301 if (inst->code == BPF_S_ANC_VLAN_TAG) 1324 if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) {
1302 emit_and(r_A, r_s0, VLAN_VID_MASK, ctx); 1325 emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx);
1303 else 1326 } else {
1304 emit_and(r_A, r_s0, VLAN_TAG_PRESENT, ctx); 1327 emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx);
1328 /* return 1 if present */
1329 emit_sltu(r_A, r_zero, r_A, ctx);
1330 }
1305 break; 1331 break;
1306 case BPF_S_ANC_PKTTYPE: 1332 case BPF_ANC | SKF_AD_PKTTYPE:
1333 ctx->flags |= SEEN_SKB;
1334
1307 off = pkt_type_offset(); 1335 off = pkt_type_offset();
1308 1336
1309 if (off < 0) 1337 if (off < 0)
@@ -1311,8 +1339,12 @@ jmp_cmp:
1311 emit_load_byte(r_tmp, r_skb, off, ctx); 1339 emit_load_byte(r_tmp, r_skb, off, ctx);
1312 /* Keep only the last 3 bits */ 1340 /* Keep only the last 3 bits */
1313 emit_andi(r_A, r_tmp, PKT_TYPE_MAX, ctx); 1341 emit_andi(r_A, r_tmp, PKT_TYPE_MAX, ctx);
1342#ifdef __BIG_ENDIAN_BITFIELD
1343 /* Get the actual packet type to the lower 3 bits */
1344 emit_srl(r_A, r_A, 5, ctx);
1345#endif
1314 break; 1346 break;
1315 case BPF_S_ANC_QUEUE: 1347 case BPF_ANC | SKF_AD_QUEUE:
1316 ctx->flags |= SEEN_SKB | SEEN_A; 1348 ctx->flags |= SEEN_SKB | SEEN_A;
1317 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, 1349 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
1318 queue_mapping) != 2); 1350 queue_mapping) != 2);
@@ -1322,8 +1354,8 @@ jmp_cmp:
1322 emit_half_load(r_A, r_skb, off, ctx); 1354 emit_half_load(r_A, r_skb, off, ctx);
1323 break; 1355 break;
1324 default: 1356 default:
1325 pr_warn("%s: Unhandled opcode: 0x%02x\n", __FILE__, 1357 pr_debug("%s: Unhandled opcode: 0x%02x\n", __FILE__,
1326 inst->code); 1358 inst->code);
1327 return -1; 1359 return -1;
1328 } 1360 }
1329 } 1361 }
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 790352f93700..35d16bd2760b 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -303,7 +303,6 @@ config PPC_EARLY_DEBUG_OPAL_VTERMNO
303 This correspond to which /dev/hvcN you want to use for early 303 This correspond to which /dev/hvcN you want to use for early
304 debug. 304 debug.
305 305
306 On OPAL v1 (takeover) this should always be 0
307 On OPAL v2, this will be 0 for network console and 1 or 2 for 306 On OPAL v2, this will be 0 for network console and 1 or 2 for
308 the machine built-in serial ports. 307 the machine built-in serial ports.
309 308
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index 37991e154ef8..840a5509b3f1 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -88,4 +88,15 @@ static inline unsigned long ppc_function_entry(void *func)
88#endif 88#endif
89} 89}
90 90
91static inline unsigned long ppc_global_function_entry(void *func)
92{
93#if defined(CONFIG_PPC64) && defined(_CALL_ELF) && _CALL_ELF == 2
94 /* PPC64 ABIv2 the global entry point is at the address */
95 return (unsigned long)func;
96#else
97 /* All other cases there is no change vs ppc_function_entry() */
98 return ppc_function_entry(func);
99#endif
100}
101
91#endif /* _ASM_POWERPC_CODE_PATCHING_H */ 102#endif /* _ASM_POWERPC_CODE_PATCHING_H */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 460018889ba9..0da1dbd42e02 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -12,27 +12,7 @@
12#ifndef __OPAL_H 12#ifndef __OPAL_H
13#define __OPAL_H 13#define __OPAL_H
14 14
15/****** Takeover interface ********/
16
17/* PAPR H-Call used to querty the HAL existence and/or instanciate
18 * it from within pHyp (tech preview only).
19 *
20 * This is exclusively used in prom_init.c
21 */
22
23#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
24
25struct opal_takeover_args {
26 u64 k_image; /* r4 */
27 u64 k_size; /* r5 */
28 u64 k_entry; /* r6 */
29 u64 k_entry2; /* r7 */
30 u64 hal_addr; /* r8 */
31 u64 rd_image; /* r9 */
32 u64 rd_size; /* r10 */
33 u64 rd_loc; /* r11 */
34};
35
36/* 16/*
37 * SG entry 17 * SG entry
38 * 18 *
@@ -55,15 +35,6 @@ struct opal_sg_list {
55/* We calculate number of sg entries based on PAGE_SIZE */ 35/* We calculate number of sg entries based on PAGE_SIZE */
56#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry)) 36#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
57 37
58extern long opal_query_takeover(u64 *hal_size, u64 *hal_align);
59
60extern long opal_do_takeover(struct opal_takeover_args *args);
61
62struct rtas_args;
63extern int opal_enter_rtas(struct rtas_args *args,
64 unsigned long data,
65 unsigned long entry);
66
67#endif /* __ASSEMBLY__ */ 38#endif /* __ASSEMBLY__ */
68 39
69/****** OPAL APIs ******/ 40/****** OPAL APIs ******/
diff --git a/arch/powerpc/include/asm/swab.h b/arch/powerpc/include/asm/swab.h
index b9bd1ca944d0..96f59de61855 100644
--- a/arch/powerpc/include/asm/swab.h
+++ b/arch/powerpc/include/asm/swab.h
@@ -9,10 +9,6 @@
9 9
10#include <uapi/asm/swab.h> 10#include <uapi/asm/swab.h>
11 11
12#ifdef __GNUC__
13#ifndef __powerpc64__
14#endif /* __powerpc64__ */
15
16static __inline__ __u16 ld_le16(const volatile __u16 *addr) 12static __inline__ __u16 ld_le16(const volatile __u16 *addr)
17{ 13{
18 __u16 val; 14 __u16 val;
@@ -20,19 +16,12 @@ static __inline__ __u16 ld_le16(const volatile __u16 *addr)
20 __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); 16 __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
21 return val; 17 return val;
22} 18}
23#define __arch_swab16p ld_le16
24 19
25static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) 20static __inline__ void st_le16(volatile __u16 *addr, const __u16 val)
26{ 21{
27 __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); 22 __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
28} 23}
29 24
30static inline void __arch_swab16s(__u16 *addr)
31{
32 st_le16(addr, *addr);
33}
34#define __arch_swab16s __arch_swab16s
35
36static __inline__ __u32 ld_le32(const volatile __u32 *addr) 25static __inline__ __u32 ld_le32(const volatile __u32 *addr)
37{ 26{
38 __u32 val; 27 __u32 val;
@@ -40,42 +29,10 @@ static __inline__ __u32 ld_le32(const volatile __u32 *addr)
40 __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); 29 __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
41 return val; 30 return val;
42} 31}
43#define __arch_swab32p ld_le32
44 32
45static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) 33static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
46{ 34{
47 __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); 35 __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
48} 36}
49 37
50static inline void __arch_swab32s(__u32 *addr)
51{
52 st_le32(addr, *addr);
53}
54#define __arch_swab32s __arch_swab32s
55
56static inline __attribute_const__ __u16 __arch_swab16(__u16 value)
57{
58 __u16 result;
59
60 __asm__("rlwimi %0,%1,8,16,23"
61 : "=r" (result)
62 : "r" (value), "0" (value >> 8));
63 return result;
64}
65#define __arch_swab16 __arch_swab16
66
67static inline __attribute_const__ __u32 __arch_swab32(__u32 value)
68{
69 __u32 result;
70
71 __asm__("rlwimi %0,%1,24,16,23\n\t"
72 "rlwimi %0,%1,8,8,15\n\t"
73 "rlwimi %0,%1,24,0,7"
74 : "=r" (result)
75 : "r" (value), "0" (value >> 24));
76 return result;
77}
78#define __arch_swab32 __arch_swab32
79
80#endif /* __GNUC__ */
81#endif /* _ASM_POWERPC_SWAB_H */ 38#endif /* _ASM_POWERPC_SWAB_H */
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index f202d0731b06..d178834fe508 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -10,6 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#define pr_fmt(fmt) "ftrace-powerpc: " fmt
14
13#include <linux/spinlock.h> 15#include <linux/spinlock.h>
14#include <linux/hardirq.h> 16#include <linux/hardirq.h>
15#include <linux/uaccess.h> 17#include <linux/uaccess.h>
@@ -105,7 +107,7 @@ __ftrace_make_nop(struct module *mod,
105 struct dyn_ftrace *rec, unsigned long addr) 107 struct dyn_ftrace *rec, unsigned long addr)
106{ 108{
107 unsigned int op; 109 unsigned int op;
108 unsigned long ptr; 110 unsigned long entry, ptr;
109 unsigned long ip = rec->ip; 111 unsigned long ip = rec->ip;
110 void *tramp; 112 void *tramp;
111 113
@@ -115,7 +117,7 @@ __ftrace_make_nop(struct module *mod,
115 117
116 /* Make sure that that this is still a 24bit jump */ 118 /* Make sure that that this is still a 24bit jump */
117 if (!is_bl_op(op)) { 119 if (!is_bl_op(op)) {
118 printk(KERN_ERR "Not expected bl: opcode is %x\n", op); 120 pr_err("Not expected bl: opcode is %x\n", op);
119 return -EINVAL; 121 return -EINVAL;
120 } 122 }
121 123
@@ -125,21 +127,21 @@ __ftrace_make_nop(struct module *mod,
125 pr_devel("ip:%lx jumps to %p", ip, tramp); 127 pr_devel("ip:%lx jumps to %p", ip, tramp);
126 128
127 if (!is_module_trampoline(tramp)) { 129 if (!is_module_trampoline(tramp)) {
128 printk(KERN_ERR "Not a trampoline\n"); 130 pr_err("Not a trampoline\n");
129 return -EINVAL; 131 return -EINVAL;
130 } 132 }
131 133
132 if (module_trampoline_target(mod, tramp, &ptr)) { 134 if (module_trampoline_target(mod, tramp, &ptr)) {
133 printk(KERN_ERR "Failed to get trampoline target\n"); 135 pr_err("Failed to get trampoline target\n");
134 return -EFAULT; 136 return -EFAULT;
135 } 137 }
136 138
137 pr_devel("trampoline target %lx", ptr); 139 pr_devel("trampoline target %lx", ptr);
138 140
141 entry = ppc_global_function_entry((void *)addr);
139 /* This should match what was called */ 142 /* This should match what was called */
140 if (ptr != ppc_function_entry((void *)addr)) { 143 if (ptr != entry) {
141 printk(KERN_ERR "addr %lx does not match expected %lx\n", 144 pr_err("addr %lx does not match expected %lx\n", ptr, entry);
142 ptr, ppc_function_entry((void *)addr));
143 return -EINVAL; 145 return -EINVAL;
144 } 146 }
145 147
@@ -179,7 +181,7 @@ __ftrace_make_nop(struct module *mod,
179 181
180 /* Make sure that that this is still a 24bit jump */ 182 /* Make sure that that this is still a 24bit jump */
181 if (!is_bl_op(op)) { 183 if (!is_bl_op(op)) {
182 printk(KERN_ERR "Not expected bl: opcode is %x\n", op); 184 pr_err("Not expected bl: opcode is %x\n", op);
183 return -EINVAL; 185 return -EINVAL;
184 } 186 }
185 187
@@ -198,7 +200,7 @@ __ftrace_make_nop(struct module *mod,
198 200
199 /* Find where the trampoline jumps to */ 201 /* Find where the trampoline jumps to */
200 if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) { 202 if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) {
201 printk(KERN_ERR "Failed to read %lx\n", tramp); 203 pr_err("Failed to read %lx\n", tramp);
202 return -EFAULT; 204 return -EFAULT;
203 } 205 }
204 206
@@ -209,7 +211,7 @@ __ftrace_make_nop(struct module *mod,
209 ((jmp[1] & 0xffff0000) != 0x398c0000) || 211 ((jmp[1] & 0xffff0000) != 0x398c0000) ||
210 (jmp[2] != 0x7d8903a6) || 212 (jmp[2] != 0x7d8903a6) ||
211 (jmp[3] != 0x4e800420)) { 213 (jmp[3] != 0x4e800420)) {
212 printk(KERN_ERR "Not a trampoline\n"); 214 pr_err("Not a trampoline\n");
213 return -EINVAL; 215 return -EINVAL;
214 } 216 }
215 217
@@ -221,8 +223,7 @@ __ftrace_make_nop(struct module *mod,
221 pr_devel(" %lx ", tramp); 223 pr_devel(" %lx ", tramp);
222 224
223 if (tramp != addr) { 225 if (tramp != addr) {
224 printk(KERN_ERR 226 pr_err("Trampoline location %08lx does not match addr\n",
225 "Trampoline location %08lx does not match addr\n",
226 tramp); 227 tramp);
227 return -EINVAL; 228 return -EINVAL;
228 } 229 }
@@ -263,15 +264,13 @@ int ftrace_make_nop(struct module *mod,
263 */ 264 */
264 if (!rec->arch.mod) { 265 if (!rec->arch.mod) {
265 if (!mod) { 266 if (!mod) {
266 printk(KERN_ERR "No module loaded addr=%lx\n", 267 pr_err("No module loaded addr=%lx\n", addr);
267 addr);
268 return -EFAULT; 268 return -EFAULT;
269 } 269 }
270 rec->arch.mod = mod; 270 rec->arch.mod = mod;
271 } else if (mod) { 271 } else if (mod) {
272 if (mod != rec->arch.mod) { 272 if (mod != rec->arch.mod) {
273 printk(KERN_ERR 273 pr_err("Record mod %p not equal to passed in mod %p\n",
274 "Record mod %p not equal to passed in mod %p\n",
275 rec->arch.mod, mod); 274 rec->arch.mod, mod);
276 return -EINVAL; 275 return -EINVAL;
277 } 276 }
@@ -307,26 +306,25 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
307 * The load offset is different depending on the ABI. For simplicity 306 * The load offset is different depending on the ABI. For simplicity
308 * just mask it out when doing the compare. 307 * just mask it out when doing the compare.
309 */ 308 */
310 if ((op[0] != 0x48000008) || ((op[1] & 0xffff00000) != 0xe8410000)) { 309 if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) {
311 printk(KERN_ERR "Unexpected call sequence: %x %x\n", 310 pr_err("Unexpected call sequence: %x %x\n", op[0], op[1]);
312 op[0], op[1]);
313 return -EINVAL; 311 return -EINVAL;
314 } 312 }
315 313
316 /* If we never set up a trampoline to ftrace_caller, then bail */ 314 /* If we never set up a trampoline to ftrace_caller, then bail */
317 if (!rec->arch.mod->arch.tramp) { 315 if (!rec->arch.mod->arch.tramp) {
318 printk(KERN_ERR "No ftrace trampoline\n"); 316 pr_err("No ftrace trampoline\n");
319 return -EINVAL; 317 return -EINVAL;
320 } 318 }
321 319
322 /* Ensure branch is within 24 bits */ 320 /* Ensure branch is within 24 bits */
323 if (create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { 321 if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
324 printk(KERN_ERR "Branch out of range"); 322 pr_err("Branch out of range\n");
325 return -EINVAL; 323 return -EINVAL;
326 } 324 }
327 325
328 if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { 326 if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
329 printk(KERN_ERR "REL24 out of range!\n"); 327 pr_err("REL24 out of range!\n");
330 return -EINVAL; 328 return -EINVAL;
331 } 329 }
332 330
@@ -345,13 +343,13 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
345 343
346 /* It should be pointing to a nop */ 344 /* It should be pointing to a nop */
347 if (op != PPC_INST_NOP) { 345 if (op != PPC_INST_NOP) {
348 printk(KERN_ERR "Expected NOP but have %x\n", op); 346 pr_err("Expected NOP but have %x\n", op);
349 return -EINVAL; 347 return -EINVAL;
350 } 348 }
351 349
352 /* If we never set up a trampoline to ftrace_caller, then bail */ 350 /* If we never set up a trampoline to ftrace_caller, then bail */
353 if (!rec->arch.mod->arch.tramp) { 351 if (!rec->arch.mod->arch.tramp) {
354 printk(KERN_ERR "No ftrace trampoline\n"); 352 pr_err("No ftrace trampoline\n");
355 return -EINVAL; 353 return -EINVAL;
356 } 354 }
357 355
@@ -359,7 +357,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
359 op = create_branch((unsigned int *)ip, 357 op = create_branch((unsigned int *)ip,
360 rec->arch.mod->arch.tramp, BRANCH_SET_LINK); 358 rec->arch.mod->arch.tramp, BRANCH_SET_LINK);
361 if (!op) { 359 if (!op) {
362 printk(KERN_ERR "REL24 out of range!\n"); 360 pr_err("REL24 out of range!\n");
363 return -EINVAL; 361 return -EINVAL;
364 } 362 }
365 363
@@ -397,7 +395,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
397 * already have a module defined. 395 * already have a module defined.
398 */ 396 */
399 if (!rec->arch.mod) { 397 if (!rec->arch.mod) {
400 printk(KERN_ERR "No module loaded\n"); 398 pr_err("No module loaded\n");
401 return -EINVAL; 399 return -EINVAL;
402 } 400 }
403 401
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index b82227e7e21b..12e48d56f771 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -23,7 +23,7 @@ unsigned int ioread16(void __iomem *addr)
23} 23}
24unsigned int ioread16be(void __iomem *addr) 24unsigned int ioread16be(void __iomem *addr)
25{ 25{
26 return in_be16(addr); 26 return readw_be(addr);
27} 27}
28unsigned int ioread32(void __iomem *addr) 28unsigned int ioread32(void __iomem *addr)
29{ 29{
@@ -31,7 +31,7 @@ unsigned int ioread32(void __iomem *addr)
31} 31}
32unsigned int ioread32be(void __iomem *addr) 32unsigned int ioread32be(void __iomem *addr)
33{ 33{
34 return in_be32(addr); 34 return readl_be(addr);
35} 35}
36EXPORT_SYMBOL(ioread8); 36EXPORT_SYMBOL(ioread8);
37EXPORT_SYMBOL(ioread16); 37EXPORT_SYMBOL(ioread16);
@@ -49,7 +49,7 @@ void iowrite16(u16 val, void __iomem *addr)
49} 49}
50void iowrite16be(u16 val, void __iomem *addr) 50void iowrite16be(u16 val, void __iomem *addr)
51{ 51{
52 out_be16(addr, val); 52 writew_be(val, addr);
53} 53}
54void iowrite32(u32 val, void __iomem *addr) 54void iowrite32(u32 val, void __iomem *addr)
55{ 55{
@@ -57,7 +57,7 @@ void iowrite32(u32 val, void __iomem *addr)
57} 57}
58void iowrite32be(u32 val, void __iomem *addr) 58void iowrite32be(u32 val, void __iomem *addr)
59{ 59{
60 out_be32(addr, val); 60 writel_be(val, addr);
61} 61}
62EXPORT_SYMBOL(iowrite8); 62EXPORT_SYMBOL(iowrite8);
63EXPORT_SYMBOL(iowrite16); 63EXPORT_SYMBOL(iowrite16);
@@ -75,15 +75,15 @@ EXPORT_SYMBOL(iowrite32be);
75 */ 75 */
76void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) 76void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
77{ 77{
78 _insb((u8 __iomem *) addr, dst, count); 78 readsb(addr, dst, count);
79} 79}
80void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) 80void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
81{ 81{
82 _insw_ns((u16 __iomem *) addr, dst, count); 82 readsw(addr, dst, count);
83} 83}
84void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) 84void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
85{ 85{
86 _insl_ns((u32 __iomem *) addr, dst, count); 86 readsl(addr, dst, count);
87} 87}
88EXPORT_SYMBOL(ioread8_rep); 88EXPORT_SYMBOL(ioread8_rep);
89EXPORT_SYMBOL(ioread16_rep); 89EXPORT_SYMBOL(ioread16_rep);
@@ -91,15 +91,15 @@ EXPORT_SYMBOL(ioread32_rep);
91 91
92void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) 92void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
93{ 93{
94 _outsb((u8 __iomem *) addr, src, count); 94 writesb(addr, src, count);
95} 95}
96void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) 96void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
97{ 97{
98 _outsw_ns((u16 __iomem *) addr, src, count); 98 writesw(addr, src, count);
99} 99}
100void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) 100void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
101{ 101{
102 _outsl_ns((u32 __iomem *) addr, src, count); 102 writesl(addr, src, count);
103} 103}
104EXPORT_SYMBOL(iowrite8_rep); 104EXPORT_SYMBOL(iowrite8_rep);
105EXPORT_SYMBOL(iowrite16_rep); 105EXPORT_SYMBOL(iowrite16_rep);
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 90fab64d911d..2f72af82513c 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -32,6 +32,7 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kdebug.h> 33#include <linux/kdebug.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <asm/code-patching.h>
35#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
36#include <asm/sstep.h> 37#include <asm/sstep.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
@@ -491,12 +492,10 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
491 return ret; 492 return ret;
492} 493}
493 494
494#ifdef CONFIG_PPC64
495unsigned long arch_deref_entry_point(void *entry) 495unsigned long arch_deref_entry_point(void *entry)
496{ 496{
497 return ((func_descr_t *)entry)->entry; 497 return ppc_global_function_entry(entry);
498} 498}
499#endif
500 499
501int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 500int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
502{ 501{
@@ -508,8 +507,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
508 /* setup return addr to the jprobe handler routine */ 507 /* setup return addr to the jprobe handler routine */
509 regs->nip = arch_deref_entry_point(jp->entry); 508 regs->nip = arch_deref_entry_point(jp->entry);
510#ifdef CONFIG_PPC64 509#ifdef CONFIG_PPC64
510#if defined(_CALL_ELF) && _CALL_ELF == 2
511 regs->gpr[12] = (unsigned long)jp->entry;
512#else
511 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); 513 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc);
512#endif 514#endif
515#endif
513 516
514 return 1; 517 return 1;
515} 518}
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 077d2ce6c5a7..d807ee626af9 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -315,8 +315,17 @@ static void dedotify_versions(struct modversion_info *vers,
315 struct modversion_info *end; 315 struct modversion_info *end;
316 316
317 for (end = (void *)vers + size; vers < end; vers++) 317 for (end = (void *)vers + size; vers < end; vers++)
318 if (vers->name[0] == '.') 318 if (vers->name[0] == '.') {
319 memmove(vers->name, vers->name+1, strlen(vers->name)); 319 memmove(vers->name, vers->name+1, strlen(vers->name));
320#ifdef ARCH_RELOCATES_KCRCTAB
321 /* The TOC symbol has no CRC computed. To avoid CRC
322 * check failing, we must force it to the expected
323 * value (see CRC check in module.c).
324 */
325 if (!strcmp(vers->name, "TOC."))
326 vers->crc = -(unsigned long)reloc_start;
327#endif
328 }
320} 329}
321 330
322/* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ 331/* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 613a860a203c..b694b0730971 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -662,13 +662,6 @@ void __init early_init_devtree(void *params)
662 of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL); 662 of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL);
663#endif 663#endif
664 664
665 /* Pre-initialize the cmd_line with the content of boot_commmand_line,
666 * which will be empty except when the content of the variable has
667 * been overriden by a bootloading mechanism. This happens typically
668 * with HAL takeover
669 */
670 strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
671
672 /* Retrieve various informations from the /chosen node of the 665 /* Retrieve various informations from the /chosen node of the
673 * device-tree, including the platform type, initrd location and 666 * device-tree, including the platform type, initrd location and
674 * size, TCE reserve, and more ... 667 * size, TCE reserve, and more ...
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 078145acf7fb..1a85d8f96739 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1268,201 +1268,6 @@ static u64 __initdata prom_opal_base;
1268static u64 __initdata prom_opal_entry; 1268static u64 __initdata prom_opal_entry;
1269#endif 1269#endif
1270 1270
1271#ifdef __BIG_ENDIAN__
1272/* XXX Don't change this structure without updating opal-takeover.S */
1273static struct opal_secondary_data {
1274 s64 ack; /* 0 */
1275 u64 go; /* 8 */
1276 struct opal_takeover_args args; /* 16 */
1277} opal_secondary_data;
1278
1279static u64 __initdata prom_opal_align;
1280static u64 __initdata prom_opal_size;
1281static int __initdata prom_rtas_start_cpu;
1282static u64 __initdata prom_rtas_data;
1283static u64 __initdata prom_rtas_entry;
1284
1285extern char opal_secondary_entry;
1286
1287static void __init prom_query_opal(void)
1288{
1289 long rc;
1290
1291 /* We must not query for OPAL presence on a machine that
1292 * supports TNK takeover (970 blades), as this uses the same
1293 * h-call with different arguments and will crash
1294 */
1295 if (PHANDLE_VALID(call_prom("finddevice", 1, 1,
1296 ADDR("/tnk-memory-map")))) {
1297 prom_printf("TNK takeover detected, skipping OPAL check\n");
1298 return;
1299 }
1300
1301 prom_printf("Querying for OPAL presence... ");
1302
1303 rc = opal_query_takeover(&prom_opal_size,
1304 &prom_opal_align);
1305 prom_debug("(rc = %ld) ", rc);
1306 if (rc != 0) {
1307 prom_printf("not there.\n");
1308 return;
1309 }
1310 of_platform = PLATFORM_OPAL;
1311 prom_printf(" there !\n");
1312 prom_debug(" opal_size = 0x%lx\n", prom_opal_size);
1313 prom_debug(" opal_align = 0x%lx\n", prom_opal_align);
1314 if (prom_opal_align < 0x10000)
1315 prom_opal_align = 0x10000;
1316}
1317
1318static int __init prom_rtas_call(int token, int nargs, int nret,
1319 int *outputs, ...)
1320{
1321 struct rtas_args rtas_args;
1322 va_list list;
1323 int i;
1324
1325 rtas_args.token = token;
1326 rtas_args.nargs = nargs;
1327 rtas_args.nret = nret;
1328 rtas_args.rets = (rtas_arg_t *)&(rtas_args.args[nargs]);
1329 va_start(list, outputs);
1330 for (i = 0; i < nargs; ++i)
1331 rtas_args.args[i] = va_arg(list, rtas_arg_t);
1332 va_end(list);
1333
1334 for (i = 0; i < nret; ++i)
1335 rtas_args.rets[i] = 0;
1336
1337 opal_enter_rtas(&rtas_args, prom_rtas_data,
1338 prom_rtas_entry);
1339
1340 if (nret > 1 && outputs != NULL)
1341 for (i = 0; i < nret-1; ++i)
1342 outputs[i] = rtas_args.rets[i+1];
1343 return (nret > 0)? rtas_args.rets[0]: 0;
1344}
1345
1346static void __init prom_opal_hold_cpus(void)
1347{
1348 int i, cnt, cpu, rc;
1349 long j;
1350 phandle node;
1351 char type[64];
1352 u32 servers[8];
1353 void *entry = (unsigned long *)&opal_secondary_entry;
1354 struct opal_secondary_data *data = &opal_secondary_data;
1355
1356 prom_debug("prom_opal_hold_cpus: start...\n");
1357 prom_debug(" - entry = 0x%x\n", entry);
1358 prom_debug(" - data = 0x%x\n", data);
1359
1360 data->ack = -1;
1361 data->go = 0;
1362
1363 /* look for cpus */
1364 for (node = 0; prom_next_node(&node); ) {
1365 type[0] = 0;
1366 prom_getprop(node, "device_type", type, sizeof(type));
1367 if (strcmp(type, "cpu") != 0)
1368 continue;
1369
1370 /* Skip non-configured cpus. */
1371 if (prom_getprop(node, "status", type, sizeof(type)) > 0)
1372 if (strcmp(type, "okay") != 0)
1373 continue;
1374
1375 cnt = prom_getprop(node, "ibm,ppc-interrupt-server#s", servers,
1376 sizeof(servers));
1377 if (cnt == PROM_ERROR)
1378 break;
1379 cnt >>= 2;
1380 for (i = 0; i < cnt; i++) {
1381 cpu = servers[i];
1382 prom_debug("CPU %d ... ", cpu);
1383 if (cpu == prom.cpu) {
1384 prom_debug("booted !\n");
1385 continue;
1386 }
1387 prom_debug("starting ... ");
1388
1389 /* Init the acknowledge var which will be reset by
1390 * the secondary cpu when it awakens from its OF
1391 * spinloop.
1392 */
1393 data->ack = -1;
1394 rc = prom_rtas_call(prom_rtas_start_cpu, 3, 1,
1395 NULL, cpu, entry, data);
1396 prom_debug("rtas rc=%d ...", rc);
1397
1398 for (j = 0; j < 100000000 && data->ack == -1; j++) {
1399 HMT_low();
1400 mb();
1401 }
1402 HMT_medium();
1403 if (data->ack != -1)
1404 prom_debug("done, PIR=0x%x\n", data->ack);
1405 else
1406 prom_debug("timeout !\n");
1407 }
1408 }
1409 prom_debug("prom_opal_hold_cpus: end...\n");
1410}
1411
1412static void __init prom_opal_takeover(void)
1413{
1414 struct opal_secondary_data *data = &opal_secondary_data;
1415 struct opal_takeover_args *args = &data->args;
1416 u64 align = prom_opal_align;
1417 u64 top_addr, opal_addr;
1418
1419 args->k_image = (u64)_stext;
1420 args->k_size = _end - _stext;
1421 args->k_entry = 0;
1422 args->k_entry2 = 0x60;
1423
1424 top_addr = _ALIGN_UP(args->k_size, align);
1425
1426 if (prom_initrd_start != 0) {
1427 args->rd_image = prom_initrd_start;
1428 args->rd_size = prom_initrd_end - args->rd_image;
1429 args->rd_loc = top_addr;
1430 top_addr = _ALIGN_UP(args->rd_loc + args->rd_size, align);
1431 }
1432
1433 /* Pickup an address for the HAL. We want to go really high
1434 * up to avoid problem with future kexecs. On the other hand
1435 * we don't want to be all over the TCEs on P5IOC2 machines
1436 * which are going to be up there too. We assume the machine
1437 * has plenty of memory, and we ask for the HAL for now to
1438 * be just below the 1G point, or above the initrd
1439 */
1440 opal_addr = _ALIGN_DOWN(0x40000000 - prom_opal_size, align);
1441 if (opal_addr < top_addr)
1442 opal_addr = top_addr;
1443 args->hal_addr = opal_addr;
1444
1445 /* Copy the command line to the kernel image */
1446 strlcpy(boot_command_line, prom_cmd_line,
1447 COMMAND_LINE_SIZE);
1448
1449 prom_debug(" k_image = 0x%lx\n", args->k_image);
1450 prom_debug(" k_size = 0x%lx\n", args->k_size);
1451 prom_debug(" k_entry = 0x%lx\n", args->k_entry);
1452 prom_debug(" k_entry2 = 0x%lx\n", args->k_entry2);
1453 prom_debug(" hal_addr = 0x%lx\n", args->hal_addr);
1454 prom_debug(" rd_image = 0x%lx\n", args->rd_image);
1455 prom_debug(" rd_size = 0x%lx\n", args->rd_size);
1456 prom_debug(" rd_loc = 0x%lx\n", args->rd_loc);
1457 prom_printf("Performing OPAL takeover,this can take a few minutes..\n");
1458 prom_close_stdin();
1459 mb();
1460 data->go = 1;
1461 for (;;)
1462 opal_do_takeover(args);
1463}
1464#endif /* __BIG_ENDIAN__ */
1465
1466/* 1271/*
1467 * Allocate room for and instantiate OPAL 1272 * Allocate room for and instantiate OPAL
1468 */ 1273 */
@@ -1597,12 +1402,6 @@ static void __init prom_instantiate_rtas(void)
1597 &val, sizeof(val)) != PROM_ERROR) 1402 &val, sizeof(val)) != PROM_ERROR)
1598 rtas_has_query_cpu_stopped = true; 1403 rtas_has_query_cpu_stopped = true;
1599 1404
1600#if defined(CONFIG_PPC_POWERNV) && defined(__BIG_ENDIAN__)
1601 /* PowerVN takeover hack */
1602 prom_rtas_data = base;
1603 prom_rtas_entry = entry;
1604 prom_getprop(rtas_node, "start-cpu", &prom_rtas_start_cpu, 4);
1605#endif
1606 prom_debug("rtas base = 0x%x\n", base); 1405 prom_debug("rtas base = 0x%x\n", base);
1607 prom_debug("rtas entry = 0x%x\n", entry); 1406 prom_debug("rtas entry = 0x%x\n", entry);
1608 prom_debug("rtas size = 0x%x\n", (long)size); 1407 prom_debug("rtas size = 0x%x\n", (long)size);
@@ -3027,16 +2826,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
3027 prom_instantiate_rtas(); 2826 prom_instantiate_rtas();
3028 2827
3029#ifdef CONFIG_PPC_POWERNV 2828#ifdef CONFIG_PPC_POWERNV
3030#ifdef __BIG_ENDIAN__
3031 /* Detect HAL and try instanciating it & doing takeover */
3032 if (of_platform == PLATFORM_PSERIES_LPAR) {
3033 prom_query_opal();
3034 if (of_platform == PLATFORM_OPAL) {
3035 prom_opal_hold_cpus();
3036 prom_opal_takeover();
3037 }
3038 } else
3039#endif /* __BIG_ENDIAN__ */
3040 if (of_platform == PLATFORM_OPAL) 2829 if (of_platform == PLATFORM_OPAL)
3041 prom_instantiate_opal(); 2830 prom_instantiate_opal();
3042#endif /* CONFIG_PPC_POWERNV */ 2831#endif /* CONFIG_PPC_POWERNV */
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index 77aa1e95e904..fe8e54b9ef7d 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -21,9 +21,7 @@ _end enter_prom memcpy memset reloc_offset __secondary_hold
21__secondary_hold_acknowledge __secondary_hold_spinloop __start 21__secondary_hold_acknowledge __secondary_hold_spinloop __start
22strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 22strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224
23reloc_got2 kernstart_addr memstart_addr linux_banner _stext 23reloc_got2 kernstart_addr memstart_addr linux_banner _stext
24opal_query_takeover opal_do_takeover opal_enter_rtas opal_secondary_entry 24__prom_init_toc_start __prom_init_toc_end btext_setup_display TOC."
25boot_command_line __prom_init_toc_start __prom_init_toc_end
26btext_setup_display TOC."
27 25
28NM="$1" 26NM="$1"
29OBJ="$2" 27OBJ="$2"
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index e239df3768ac..e5b022c55ccd 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -469,9 +469,17 @@ void __init smp_setup_cpu_maps(void)
469 } 469 }
470 470
471 for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { 471 for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
472 bool avail;
473
472 DBG(" thread %d -> cpu %d (hard id %d)\n", 474 DBG(" thread %d -> cpu %d (hard id %d)\n",
473 j, cpu, be32_to_cpu(intserv[j])); 475 j, cpu, be32_to_cpu(intserv[j]));
474 set_cpu_present(cpu, of_device_is_available(dn)); 476
477 avail = of_device_is_available(dn);
478 if (!avail)
479 avail = !of_property_match_string(dn,
480 "enable-method", "spin-table");
481
482 set_cpu_present(cpu, avail);
475 set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j])); 483 set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j]));
476 set_cpu_possible(cpu, true); 484 set_cpu_possible(cpu, true);
477 cpu++; 485 cpu++;
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 4e47db686b5d..1bc5a1755ed4 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -54,7 +54,6 @@
54 54
55#include "signal.h" 55#include "signal.h"
56 56
57#undef DEBUG_SIG
58 57
59#ifdef CONFIG_PPC64 58#ifdef CONFIG_PPC64
60#define sys_rt_sigreturn compat_sys_rt_sigreturn 59#define sys_rt_sigreturn compat_sys_rt_sigreturn
@@ -1063,10 +1062,6 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
1063 return 1; 1062 return 1;
1064 1063
1065badframe: 1064badframe:
1066#ifdef DEBUG_SIG
1067 printk("badframe in handle_rt_signal, regs=%p frame=%p newsp=%lx\n",
1068 regs, frame, newsp);
1069#endif
1070 if (show_unhandled_signals) 1065 if (show_unhandled_signals)
1071 printk_ratelimited(KERN_INFO 1066 printk_ratelimited(KERN_INFO
1072 "%s[%d]: bad frame in handle_rt_signal32: " 1067 "%s[%d]: bad frame in handle_rt_signal32: "
@@ -1484,10 +1479,6 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1484 return 1; 1479 return 1;
1485 1480
1486badframe: 1481badframe:
1487#ifdef DEBUG_SIG
1488 printk("badframe in handle_signal, regs=%p frame=%p newsp=%lx\n",
1489 regs, frame, newsp);
1490#endif
1491 if (show_unhandled_signals) 1482 if (show_unhandled_signals)
1492 printk_ratelimited(KERN_INFO 1483 printk_ratelimited(KERN_INFO
1493 "%s[%d]: bad frame in handle_signal32: " 1484 "%s[%d]: bad frame in handle_signal32: "
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index d501dc4dc3e6..97c1e4b683fc 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -38,7 +38,6 @@
38 38
39#include "signal.h" 39#include "signal.h"
40 40
41#define DEBUG_SIG 0
42 41
43#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) 42#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs))
44#define FP_REGS_SIZE sizeof(elf_fpregset_t) 43#define FP_REGS_SIZE sizeof(elf_fpregset_t)
@@ -700,10 +699,6 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
700 return 0; 699 return 0;
701 700
702badframe: 701badframe:
703#if DEBUG_SIG
704 printk("badframe in sys_rt_sigreturn, regs=%p uc=%p &uc->uc_mcontext=%p\n",
705 regs, uc, &uc->uc_mcontext);
706#endif
707 if (show_unhandled_signals) 702 if (show_unhandled_signals)
708 printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, 703 printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
709 current->comm, current->pid, "rt_sigreturn", 704 current->comm, current->pid, "rt_sigreturn",
@@ -809,10 +804,6 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
809 return 1; 804 return 1;
810 805
811badframe: 806badframe:
812#if DEBUG_SIG
813 printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n",
814 regs, frame, newsp);
815#endif
816 if (show_unhandled_signals) 807 if (show_unhandled_signals)
817 printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, 808 printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
818 current->comm, current->pid, "setup_rt_frame", 809 current->comm, current->pid, "setup_rt_frame",
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c
index 94560db788bf..2c15ff094483 100644
--- a/arch/powerpc/platforms/cell/cbe_thermal.c
+++ b/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -125,7 +125,7 @@ static ssize_t show_throttle(struct cbe_pmd_regs __iomem *pmd_regs, char *buf, i
125static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos) 125static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos)
126{ 126{
127 u64 reg_value; 127 u64 reg_value;
128 int temp; 128 unsigned int temp;
129 u64 new_value; 129 u64 new_value;
130 int ret; 130 int ret;
131 131
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
index d55891f89a2c..4ad227d04c1a 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -1,4 +1,4 @@
1obj-y += setup.o opal-takeover.o opal-wrappers.o opal.o opal-async.o 1obj-y += setup.o opal-wrappers.o opal.o opal-async.o
2obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o 2obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
3obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o 3obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
4obj-y += opal-msglog.o 4obj-y += opal-msglog.o
diff --git a/arch/powerpc/platforms/powernv/opal-takeover.S b/arch/powerpc/platforms/powernv/opal-takeover.S
deleted file mode 100644
index 11a3169ee583..000000000000
--- a/arch/powerpc/platforms/powernv/opal-takeover.S
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 * PowerNV OPAL takeover assembly code, for use by prom_init.c
3 *
4 * Copyright 2011 IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <asm/ppc_asm.h>
13#include <asm/hvcall.h>
14#include <asm/asm-offsets.h>
15#include <asm/opal.h>
16
17#define H_HAL_TAKEOVER 0x5124
18#define H_HAL_TAKEOVER_QUERY_MAGIC -1
19
20 .text
21_GLOBAL(opal_query_takeover)
22 mfcr r0
23 stw r0,8(r1)
24 stdu r1,-STACKFRAMESIZE(r1)
25 std r3,STK_PARAM(R3)(r1)
26 std r4,STK_PARAM(R4)(r1)
27 li r3,H_HAL_TAKEOVER
28 li r4,H_HAL_TAKEOVER_QUERY_MAGIC
29 HVSC
30 addi r1,r1,STACKFRAMESIZE
31 ld r10,STK_PARAM(R3)(r1)
32 std r4,0(r10)
33 ld r10,STK_PARAM(R4)(r1)
34 std r5,0(r10)
35 lwz r0,8(r1)
36 mtcrf 0xff,r0
37 blr
38
39_GLOBAL(opal_do_takeover)
40 mfcr r0
41 stw r0,8(r1)
42 mflr r0
43 std r0,16(r1)
44 bl __opal_do_takeover
45 ld r0,16(r1)
46 mtlr r0
47 lwz r0,8(r1)
48 mtcrf 0xff,r0
49 blr
50
51__opal_do_takeover:
52 ld r4,0(r3)
53 ld r5,0x8(r3)
54 ld r6,0x10(r3)
55 ld r7,0x18(r3)
56 ld r8,0x20(r3)
57 ld r9,0x28(r3)
58 ld r10,0x30(r3)
59 ld r11,0x38(r3)
60 li r3,H_HAL_TAKEOVER
61 HVSC
62 blr
63
64 .globl opal_secondary_entry
65opal_secondary_entry:
66 mr r31,r3
67 mfmsr r11
68 li r12,(MSR_SF | MSR_ISF)@highest
69 sldi r12,r12,48
70 or r11,r11,r12
71 mtmsrd r11
72 isync
73 mfspr r4,SPRN_PIR
74 std r4,0(r3)
751: HMT_LOW
76 ld r4,8(r3)
77 cmpli cr0,r4,0
78 beq 1b
79 HMT_MEDIUM
801: addi r3,r31,16
81 bl __opal_do_takeover
82 b 1b
83
84_GLOBAL(opal_enter_rtas)
85 mflr r0
86 std r0,16(r1)
87 stdu r1,-PROM_FRAME_SIZE(r1) /* Save SP and create stack space */
88
89 /* Because PROM is running in 32b mode, it clobbers the high order half
90 * of all registers that it saves. We therefore save those registers
91 * PROM might touch to the stack. (r0, r3-r13 are caller saved)
92 */
93 SAVE_GPR(2, r1)
94 SAVE_GPR(13, r1)
95 SAVE_8GPRS(14, r1)
96 SAVE_10GPRS(22, r1)
97 mfcr r10
98 mfmsr r11
99 std r10,_CCR(r1)
100 std r11,_MSR(r1)
101
102 /* Get the PROM entrypoint */
103 mtlr r5
104
105 /* Switch MSR to 32 bits mode
106 */
107 li r12,1
108 rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG)
109 andc r11,r11,r12
110 li r12,1
111 rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
112 andc r11,r11,r12
113 mtmsrd r11
114 isync
115
116 /* Enter RTAS here... */
117 blrl
118
119 /* Just make sure that r1 top 32 bits didn't get
120 * corrupt by OF
121 */
122 rldicl r1,r1,0,32
123
124 /* Restore the MSR (back to 64 bits) */
125 ld r0,_MSR(r1)
126 MTMSRD(r0)
127 isync
128
129 /* Restore other registers */
130 REST_GPR(2, r1)
131 REST_GPR(13, r1)
132 REST_8GPRS(14, r1)
133 REST_10GPRS(22, r1)
134 ld r4,_CCR(r1)
135 mtcr r4
136
137 addi r1,r1,PROM_FRAME_SIZE
138 ld r0,16(r1)
139 mtlr r0
140 blr
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 62c47bb76517..9e5353ff6d1b 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -476,6 +476,11 @@ void __init alloc_dart_table(void)
476 */ 476 */
477 dart_tablebase = (unsigned long) 477 dart_tablebase = (unsigned long)
478 __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); 478 __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L));
479 /*
480 * The DART space is later unmapped from the kernel linear mapping and
481 * accessing dart_tablebase during kmemleak scanning will fault.
482 */
483 kmemleak_no_scan((void *)dart_tablebase);
479 484
480 printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); 485 printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase);
481} 486}
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index 8df022c43af7..fd09a10a2b53 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -45,7 +45,8 @@ CONFIG_SOLARIS_X86_PARTITION=y
45CONFIG_UNIXWARE_DISKLABEL=y 45CONFIG_UNIXWARE_DISKLABEL=y
46CONFIG_CFQ_GROUP_IOSCHED=y 46CONFIG_CFQ_GROUP_IOSCHED=y
47CONFIG_DEFAULT_DEADLINE=y 47CONFIG_DEFAULT_DEADLINE=y
48CONFIG_MARCH_Z9_109=y 48CONFIG_MARCH_Z196=y
49CONFIG_TUNE_ZEC12=y
49CONFIG_NR_CPUS=256 50CONFIG_NR_CPUS=256
50CONFIG_PREEMPT=y 51CONFIG_PREEMPT=y
51CONFIG_HZ_100=y 52CONFIG_HZ_100=y
@@ -240,7 +241,6 @@ CONFIG_IP_VS_PE_SIP=m
240CONFIG_NF_CONNTRACK_IPV4=m 241CONFIG_NF_CONNTRACK_IPV4=m
241# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 242# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
242CONFIG_NF_TABLES_IPV4=m 243CONFIG_NF_TABLES_IPV4=m
243CONFIG_NFT_REJECT_IPV4=m
244CONFIG_NFT_CHAIN_ROUTE_IPV4=m 244CONFIG_NFT_CHAIN_ROUTE_IPV4=m
245CONFIG_NFT_CHAIN_NAT_IPV4=m 245CONFIG_NFT_CHAIN_NAT_IPV4=m
246CONFIG_NF_TABLES_ARP=m 246CONFIG_NF_TABLES_ARP=m
@@ -456,6 +456,7 @@ CONFIG_TN3270_FS=y
456CONFIG_WATCHDOG=y 456CONFIG_WATCHDOG=y
457CONFIG_WATCHDOG_NOWAYOUT=y 457CONFIG_WATCHDOG_NOWAYOUT=y
458CONFIG_SOFT_WATCHDOG=m 458CONFIG_SOFT_WATCHDOG=m
459CONFIG_DIAG288_WATCHDOG=m
459# CONFIG_HID is not set 460# CONFIG_HID is not set
460# CONFIG_USB_SUPPORT is not set 461# CONFIG_USB_SUPPORT is not set
461CONFIG_INFINIBAND=m 462CONFIG_INFINIBAND=m
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index c81a74e3e25a..b061180d3544 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -45,7 +45,8 @@ CONFIG_SOLARIS_X86_PARTITION=y
45CONFIG_UNIXWARE_DISKLABEL=y 45CONFIG_UNIXWARE_DISKLABEL=y
46CONFIG_CFQ_GROUP_IOSCHED=y 46CONFIG_CFQ_GROUP_IOSCHED=y
47CONFIG_DEFAULT_DEADLINE=y 47CONFIG_DEFAULT_DEADLINE=y
48CONFIG_MARCH_Z9_109=y 48CONFIG_MARCH_Z196=y
49CONFIG_TUNE_ZEC12=y
49CONFIG_NR_CPUS=256 50CONFIG_NR_CPUS=256
50CONFIG_HZ_100=y 51CONFIG_HZ_100=y
51CONFIG_MEMORY_HOTPLUG=y 52CONFIG_MEMORY_HOTPLUG=y
@@ -238,7 +239,6 @@ CONFIG_IP_VS_PE_SIP=m
238CONFIG_NF_CONNTRACK_IPV4=m 239CONFIG_NF_CONNTRACK_IPV4=m
239# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 240# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
240CONFIG_NF_TABLES_IPV4=m 241CONFIG_NF_TABLES_IPV4=m
241CONFIG_NFT_REJECT_IPV4=m
242CONFIG_NFT_CHAIN_ROUTE_IPV4=m 242CONFIG_NFT_CHAIN_ROUTE_IPV4=m
243CONFIG_NFT_CHAIN_NAT_IPV4=m 243CONFIG_NFT_CHAIN_NAT_IPV4=m
244CONFIG_NF_TABLES_ARP=m 244CONFIG_NF_TABLES_ARP=m
@@ -453,6 +453,7 @@ CONFIG_TN3270_FS=y
453CONFIG_WATCHDOG=y 453CONFIG_WATCHDOG=y
454CONFIG_WATCHDOG_NOWAYOUT=y 454CONFIG_WATCHDOG_NOWAYOUT=y
455CONFIG_SOFT_WATCHDOG=m 455CONFIG_SOFT_WATCHDOG=m
456CONFIG_DIAG288_WATCHDOG=m
456# CONFIG_HID is not set 457# CONFIG_HID is not set
457# CONFIG_USB_SUPPORT is not set 458# CONFIG_USB_SUPPORT is not set
458CONFIG_INFINIBAND=m 459CONFIG_INFINIBAND=m
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index b5ba8fe1cc64..d279baa08014 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -43,7 +43,8 @@ CONFIG_SOLARIS_X86_PARTITION=y
43CONFIG_UNIXWARE_DISKLABEL=y 43CONFIG_UNIXWARE_DISKLABEL=y
44CONFIG_CFQ_GROUP_IOSCHED=y 44CONFIG_CFQ_GROUP_IOSCHED=y
45CONFIG_DEFAULT_DEADLINE=y 45CONFIG_DEFAULT_DEADLINE=y
46CONFIG_MARCH_Z9_109=y 46CONFIG_MARCH_Z196=y
47CONFIG_TUNE_ZEC12=y
47CONFIG_NR_CPUS=256 48CONFIG_NR_CPUS=256
48CONFIG_HZ_100=y 49CONFIG_HZ_100=y
49CONFIG_MEMORY_HOTPLUG=y 50CONFIG_MEMORY_HOTPLUG=y
@@ -236,7 +237,6 @@ CONFIG_IP_VS_PE_SIP=m
236CONFIG_NF_CONNTRACK_IPV4=m 237CONFIG_NF_CONNTRACK_IPV4=m
237# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 238# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
238CONFIG_NF_TABLES_IPV4=m 239CONFIG_NF_TABLES_IPV4=m
239CONFIG_NFT_REJECT_IPV4=m
240CONFIG_NFT_CHAIN_ROUTE_IPV4=m 240CONFIG_NFT_CHAIN_ROUTE_IPV4=m
241CONFIG_NFT_CHAIN_NAT_IPV4=m 241CONFIG_NFT_CHAIN_NAT_IPV4=m
242CONFIG_NF_TABLES_ARP=m 242CONFIG_NF_TABLES_ARP=m
@@ -451,6 +451,7 @@ CONFIG_TN3270_FS=y
451CONFIG_WATCHDOG=y 451CONFIG_WATCHDOG=y
452CONFIG_WATCHDOG_NOWAYOUT=y 452CONFIG_WATCHDOG_NOWAYOUT=y
453CONFIG_SOFT_WATCHDOG=m 453CONFIG_SOFT_WATCHDOG=m
454CONFIG_DIAG288_WATCHDOG=m
454# CONFIG_HID is not set 455# CONFIG_HID is not set
455# CONFIG_USB_SUPPORT is not set 456# CONFIG_USB_SUPPORT is not set
456CONFIG_INFINIBAND=m 457CONFIG_INFINIBAND=m
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig
index cef073ca1f07..948e0e057a23 100644
--- a/arch/s390/configs/zfcpdump_defconfig
+++ b/arch/s390/configs/zfcpdump_defconfig
@@ -8,7 +8,8 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
8CONFIG_PARTITION_ADVANCED=y 8CONFIG_PARTITION_ADVANCED=y
9CONFIG_IBM_PARTITION=y 9CONFIG_IBM_PARTITION=y
10CONFIG_DEFAULT_DEADLINE=y 10CONFIG_DEFAULT_DEADLINE=y
11CONFIG_MARCH_Z9_109=y 11CONFIG_MARCH_Z196=y
12CONFIG_TUNE_ZEC12=y
12# CONFIG_COMPAT is not set 13# CONFIG_COMPAT is not set
13CONFIG_NR_CPUS=2 14CONFIG_NR_CPUS=2
14# CONFIG_HOTPLUG_CPU is not set 15# CONFIG_HOTPLUG_CPU is not set
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 4557cb7ffddf..2e56498a40df 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -135,8 +135,8 @@ CONFIG_PROVE_LOCKING=y
135CONFIG_LOCK_STAT=y 135CONFIG_LOCK_STAT=y
136CONFIG_DEBUG_LOCKDEP=y 136CONFIG_DEBUG_LOCKDEP=y
137CONFIG_DEBUG_ATOMIC_SLEEP=y 137CONFIG_DEBUG_ATOMIC_SLEEP=y
138CONFIG_DEBUG_WRITECOUNT=y
139CONFIG_DEBUG_LIST=y 138CONFIG_DEBUG_LIST=y
139CONFIG_DEBUG_PI_LIST=y
140CONFIG_DEBUG_SG=y 140CONFIG_DEBUG_SG=y
141CONFIG_DEBUG_NOTIFIERS=y 141CONFIG_DEBUG_NOTIFIERS=y
142CONFIG_PROVE_RCU=y 142CONFIG_PROVE_RCU=y
@@ -199,4 +199,10 @@ CONFIG_CRYPTO_SHA512_S390=m
199CONFIG_CRYPTO_DES_S390=m 199CONFIG_CRYPTO_DES_S390=m
200CONFIG_CRYPTO_AES_S390=m 200CONFIG_CRYPTO_AES_S390=m
201CONFIG_CRC7=m 201CONFIG_CRC7=m
202# CONFIG_XZ_DEC_X86 is not set
203# CONFIG_XZ_DEC_POWERPC is not set
204# CONFIG_XZ_DEC_IA64 is not set
205# CONFIG_XZ_DEC_ARM is not set
206# CONFIG_XZ_DEC_ARMTHUMB is not set
207# CONFIG_XZ_DEC_SPARC is not set
202CONFIG_CMM=m 208CONFIG_CMM=m
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index c28f32a45af5..3815bfea1b2d 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -33,10 +33,9 @@ static inline int init_new_context(struct task_struct *tsk,
33 33
34static inline void set_user_asce(struct mm_struct *mm) 34static inline void set_user_asce(struct mm_struct *mm)
35{ 35{
36 pgd_t *pgd = mm->pgd; 36 S390_lowcore.user_asce = mm->context.asce_bits | __pa(mm->pgd);
37 37 if (current->thread.mm_segment.ar4)
38 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd); 38 __ctl_load(S390_lowcore.user_asce, 7, 7);
39 set_fs(current->thread.mm_segment);
40 set_cpu_flag(CIF_ASCE); 39 set_cpu_flag(CIF_ASCE);
41} 40}
42 41
@@ -70,12 +69,11 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
70 /* Clear old ASCE by loading the kernel ASCE. */ 69 /* Clear old ASCE by loading the kernel ASCE. */
71 __ctl_load(S390_lowcore.kernel_asce, 1, 1); 70 __ctl_load(S390_lowcore.kernel_asce, 1, 1);
72 __ctl_load(S390_lowcore.kernel_asce, 7, 7); 71 __ctl_load(S390_lowcore.kernel_asce, 7, 7);
73 /* Delay loading of the new ASCE to control registers CR1 & CR7 */
74 set_cpu_flag(CIF_ASCE);
75 atomic_inc(&next->context.attach_count); 72 atomic_inc(&next->context.attach_count);
76 atomic_dec(&prev->context.attach_count); 73 atomic_dec(&prev->context.attach_count);
77 if (MACHINE_HAS_TLB_LC) 74 if (MACHINE_HAS_TLB_LC)
78 cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); 75 cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask);
76 S390_lowcore.user_asce = next->context.asce_bits | __pa(next->pgd);
79} 77}
80 78
81#define finish_arch_post_lock_switch finish_arch_post_lock_switch 79#define finish_arch_post_lock_switch finish_arch_post_lock_switch
@@ -84,17 +82,18 @@ static inline void finish_arch_post_lock_switch(void)
84 struct task_struct *tsk = current; 82 struct task_struct *tsk = current;
85 struct mm_struct *mm = tsk->mm; 83 struct mm_struct *mm = tsk->mm;
86 84
87 if (!mm) 85 load_kernel_asce();
88 return; 86 if (mm) {
89 preempt_disable(); 87 preempt_disable();
90 while (atomic_read(&mm->context.attach_count) >> 16) 88 while (atomic_read(&mm->context.attach_count) >> 16)
91 cpu_relax(); 89 cpu_relax();
92 90
93 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); 91 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
94 set_user_asce(mm); 92 if (mm->context.flush_mm)
95 if (mm->context.flush_mm) 93 __tlb_flush_mm(mm);
96 __tlb_flush_mm(mm); 94 preempt_enable();
97 preempt_enable(); 95 }
96 set_fs(current->thread.mm_segment);
98} 97}
99 98
100#define enter_lazy_tlb(mm,tsk) do { } while (0) 99#define enter_lazy_tlb(mm,tsk) do { } while (0)
diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h
index 29c81f82705e..df38c70cd59e 100644
--- a/arch/s390/include/asm/switch_to.h
+++ b/arch/s390/include/asm/switch_to.h
@@ -134,8 +134,4 @@ static inline void restore_access_regs(unsigned int *acrs)
134 prev = __switch_to(prev,next); \ 134 prev = __switch_to(prev,next); \
135} while (0) 135} while (0)
136 136
137#define finish_arch_switch(prev) do { \
138 set_fs(current->thread.mm_segment); \
139} while (0)
140
141#endif /* __ASM_SWITCH_TO_H */ 137#endif /* __ASM_SWITCH_TO_H */
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild
index 6a9a9eb645f5..736637363d31 100644
--- a/arch/s390/include/uapi/asm/Kbuild
+++ b/arch/s390/include/uapi/asm/Kbuild
@@ -36,6 +36,7 @@ header-y += signal.h
36header-y += socket.h 36header-y += socket.h
37header-y += sockios.h 37header-y += sockios.h
38header-y += sclp_ctl.h 38header-y += sclp_ctl.h
39header-y += sie.h
39header-y += stat.h 40header-y += stat.h
40header-y += statfs.h 41header-y += statfs.h
41header-y += swab.h 42header-y += swab.h
diff --git a/arch/s390/include/uapi/asm/sie.h b/arch/s390/include/uapi/asm/sie.h
index 3d97f610198d..5d9cc19462c4 100644
--- a/arch/s390/include/uapi/asm/sie.h
+++ b/arch/s390/include/uapi/asm/sie.h
@@ -1,8 +1,6 @@
1#ifndef _UAPI_ASM_S390_SIE_H 1#ifndef _UAPI_ASM_S390_SIE_H
2#define _UAPI_ASM_S390_SIE_H 2#define _UAPI_ASM_S390_SIE_H
3 3
4#include <asm/sigp.h>
5
6#define diagnose_codes \ 4#define diagnose_codes \
7 { 0x10, "DIAG (0x10) release pages" }, \ 5 { 0x10, "DIAG (0x10) release pages" }, \
8 { 0x44, "DIAG (0x44) time slice end" }, \ 6 { 0x44, "DIAG (0x44) time slice end" }, \
@@ -13,18 +11,18 @@
13 { 0x500, "DIAG (0x500) KVM virtio functions" }, \ 11 { 0x500, "DIAG (0x500) KVM virtio functions" }, \
14 { 0x501, "DIAG (0x501) KVM breakpoint" } 12 { 0x501, "DIAG (0x501) KVM breakpoint" }
15 13
16#define sigp_order_codes \ 14#define sigp_order_codes \
17 { SIGP_SENSE, "SIGP sense" }, \ 15 { 0x01, "SIGP sense" }, \
18 { SIGP_EXTERNAL_CALL, "SIGP external call" }, \ 16 { 0x02, "SIGP external call" }, \
19 { SIGP_EMERGENCY_SIGNAL, "SIGP emergency signal" }, \ 17 { 0x03, "SIGP emergency signal" }, \
20 { SIGP_STOP, "SIGP stop" }, \ 18 { 0x05, "SIGP stop" }, \
21 { SIGP_STOP_AND_STORE_STATUS, "SIGP stop and store status" }, \ 19 { 0x06, "SIGP restart" }, \
22 { SIGP_SET_ARCHITECTURE, "SIGP set architecture" }, \ 20 { 0x09, "SIGP stop and store status" }, \
23 { SIGP_SET_PREFIX, "SIGP set prefix" }, \ 21 { 0x0b, "SIGP initial cpu reset" }, \
24 { SIGP_SENSE_RUNNING, "SIGP sense running" }, \ 22 { 0x0d, "SIGP set prefix" }, \
25 { SIGP_RESTART, "SIGP restart" }, \ 23 { 0x0e, "SIGP store status at address" }, \
26 { SIGP_INITIAL_CPU_RESET, "SIGP initial cpu reset" }, \ 24 { 0x12, "SIGP set architecture" }, \
27 { SIGP_STORE_STATUS_AT_ADDRESS, "SIGP store status at address" } 25 { 0x15, "SIGP sense running" }
28 26
29#define icpt_prog_codes \ 27#define icpt_prog_codes \
30 { 0x0001, "Prog Operation" }, \ 28 { 0x0001, "Prog Operation" }, \
diff --git a/arch/s390/include/uapi/asm/ucontext.h b/arch/s390/include/uapi/asm/ucontext.h
index 200e06325c6a..3e077b2a4705 100644
--- a/arch/s390/include/uapi/asm/ucontext.h
+++ b/arch/s390/include/uapi/asm/ucontext.h
@@ -16,7 +16,9 @@ struct ucontext_extended {
16 struct ucontext *uc_link; 16 struct ucontext *uc_link;
17 stack_t uc_stack; 17 stack_t uc_stack;
18 _sigregs uc_mcontext; 18 _sigregs uc_mcontext;
19 unsigned long uc_sigmask[2]; 19 sigset_t uc_sigmask;
20 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
21 unsigned char __unused[128 - sizeof(sigset_t)];
20 unsigned long uc_gprs_high[16]; 22 unsigned long uc_gprs_high[16];
21}; 23};
22 24
@@ -27,7 +29,9 @@ struct ucontext {
27 struct ucontext *uc_link; 29 struct ucontext *uc_link;
28 stack_t uc_stack; 30 stack_t uc_stack;
29 _sigregs uc_mcontext; 31 _sigregs uc_mcontext;
30 sigset_t uc_sigmask; /* mask last for extensibility */ 32 sigset_t uc_sigmask;
33 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
34 unsigned char __unused[128 - sizeof(sigset_t)];
31}; 35};
32 36
33#endif /* !_ASM_S390_UCONTEXT_H */ 37#endif /* !_ASM_S390_UCONTEXT_H */
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 39ddfdb40ae8..70d4b7c4beaa 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -69,7 +69,9 @@ struct ucontext32 {
69 __u32 uc_link; /* pointer */ 69 __u32 uc_link; /* pointer */
70 compat_stack_t uc_stack; 70 compat_stack_t uc_stack;
71 _sigregs32 uc_mcontext; 71 _sigregs32 uc_mcontext;
72 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 72 compat_sigset_t uc_sigmask;
73 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
74 unsigned char __unused[128 - sizeof(compat_sigset_t)];
73}; 75};
74 76
75struct stat64_emu31; 77struct stat64_emu31;
diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c
index 503e6d96ad4e..df922f52d76d 100644
--- a/arch/sparc/crypto/aes_glue.c
+++ b/arch/sparc/crypto/aes_glue.c
@@ -124,7 +124,7 @@ extern void aes_sparc64_ctr_crypt_256(const u64 *key, const u64 *input,
124 u64 *output, unsigned int len, 124 u64 *output, unsigned int len,
125 u64 *iv); 125 u64 *iv);
126 126
127struct aes_ops aes128_ops = { 127static struct aes_ops aes128_ops = {
128 .encrypt = aes_sparc64_encrypt_128, 128 .encrypt = aes_sparc64_encrypt_128,
129 .decrypt = aes_sparc64_decrypt_128, 129 .decrypt = aes_sparc64_decrypt_128,
130 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_128, 130 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_128,
@@ -136,7 +136,7 @@ struct aes_ops aes128_ops = {
136 .ctr_crypt = aes_sparc64_ctr_crypt_128, 136 .ctr_crypt = aes_sparc64_ctr_crypt_128,
137}; 137};
138 138
139struct aes_ops aes192_ops = { 139static struct aes_ops aes192_ops = {
140 .encrypt = aes_sparc64_encrypt_192, 140 .encrypt = aes_sparc64_encrypt_192,
141 .decrypt = aes_sparc64_decrypt_192, 141 .decrypt = aes_sparc64_decrypt_192,
142 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_192, 142 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_192,
@@ -148,7 +148,7 @@ struct aes_ops aes192_ops = {
148 .ctr_crypt = aes_sparc64_ctr_crypt_192, 148 .ctr_crypt = aes_sparc64_ctr_crypt_192,
149}; 149};
150 150
151struct aes_ops aes256_ops = { 151static struct aes_ops aes256_ops = {
152 .encrypt = aes_sparc64_encrypt_256, 152 .encrypt = aes_sparc64_encrypt_256,
153 .decrypt = aes_sparc64_decrypt_256, 153 .decrypt = aes_sparc64_decrypt_256,
154 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_256, 154 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_256,
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h
index f08fe51b264d..7aed2be45b44 100644
--- a/arch/sparc/include/asm/atomic_32.h
+++ b/arch/sparc/include/asm/atomic_32.h
@@ -20,11 +20,11 @@
20 20
21#define ATOMIC_INIT(i) { (i) } 21#define ATOMIC_INIT(i) { (i) }
22 22
23extern int __atomic_add_return(int, atomic_t *); 23int __atomic_add_return(int, atomic_t *);
24extern int atomic_cmpxchg(atomic_t *, int, int); 24int atomic_cmpxchg(atomic_t *, int, int);
25#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 25#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
26extern int __atomic_add_unless(atomic_t *, int, int); 26int __atomic_add_unless(atomic_t *, int, int);
27extern void atomic_set(atomic_t *, int); 27void atomic_set(atomic_t *, int);
28 28
29#define atomic_read(v) (*(volatile int *)&(v)->counter) 29#define atomic_read(v) (*(volatile int *)&(v)->counter)
30 30
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index 8b2f1bde2889..bb894c8bec56 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -20,15 +20,15 @@
20#define atomic_set(v, i) (((v)->counter) = i) 20#define atomic_set(v, i) (((v)->counter) = i)
21#define atomic64_set(v, i) (((v)->counter) = i) 21#define atomic64_set(v, i) (((v)->counter) = i)
22 22
23extern void atomic_add(int, atomic_t *); 23void atomic_add(int, atomic_t *);
24extern void atomic64_add(long, atomic64_t *); 24void atomic64_add(long, atomic64_t *);
25extern void atomic_sub(int, atomic_t *); 25void atomic_sub(int, atomic_t *);
26extern void atomic64_sub(long, atomic64_t *); 26void atomic64_sub(long, atomic64_t *);
27 27
28extern int atomic_add_ret(int, atomic_t *); 28int atomic_add_ret(int, atomic_t *);
29extern long atomic64_add_ret(long, atomic64_t *); 29long atomic64_add_ret(long, atomic64_t *);
30extern int atomic_sub_ret(int, atomic_t *); 30int atomic_sub_ret(int, atomic_t *);
31extern long atomic64_sub_ret(long, atomic64_t *); 31long atomic64_sub_ret(long, atomic64_t *);
32 32
33#define atomic_dec_return(v) atomic_sub_ret(1, v) 33#define atomic_dec_return(v) atomic_sub_ret(1, v)
34#define atomic64_dec_return(v) atomic64_sub_ret(1, v) 34#define atomic64_dec_return(v) atomic64_sub_ret(1, v)
@@ -107,6 +107,6 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
107 107
108#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 108#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
109 109
110extern long atomic64_dec_if_positive(atomic64_t *v); 110long atomic64_dec_if_positive(atomic64_t *v);
111 111
112#endif /* !(__ARCH_SPARC64_ATOMIC__) */ 112#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/arch/sparc/include/asm/auxio.h b/arch/sparc/include/asm/auxio.h
index 13dc67f03011..3e09a07b77e9 100644
--- a/arch/sparc/include/asm/auxio.h
+++ b/arch/sparc/include/asm/auxio.h
@@ -1,5 +1,12 @@
1#ifndef ___ASM_SPARC_AUXIO_H 1#ifndef ___ASM_SPARC_AUXIO_H
2#define ___ASM_SPARC_AUXIO_H 2#define ___ASM_SPARC_AUXIO_H
3
4#ifndef __ASSEMBLY__
5
6extern void __iomem *auxio_register;
7
8#endif /* ifndef __ASSEMBLY__ */
9
3#if defined(__sparc__) && defined(__arch64__) 10#if defined(__sparc__) && defined(__arch64__)
4#include <asm/auxio_64.h> 11#include <asm/auxio_64.h>
5#else 12#else
diff --git a/arch/sparc/include/asm/auxio_32.h b/arch/sparc/include/asm/auxio_32.h
index 3a319775ae37..5d685df427b4 100644
--- a/arch/sparc/include/asm/auxio_32.h
+++ b/arch/sparc/include/asm/auxio_32.h
@@ -34,8 +34,8 @@
34 * NOTE: these routines are implementation dependent-- 34 * NOTE: these routines are implementation dependent--
35 * understand the hardware you are querying! 35 * understand the hardware you are querying!
36 */ 36 */
37extern void set_auxio(unsigned char bits_on, unsigned char bits_off); 37void set_auxio(unsigned char bits_on, unsigned char bits_off);
38extern unsigned char get_auxio(void); /* .../asm/floppy.h */ 38unsigned char get_auxio(void); /* .../asm/floppy.h */
39 39
40/* 40/*
41 * The following routines are provided for driver-compatibility 41 * The following routines are provided for driver-compatibility
@@ -78,7 +78,7 @@ do { \
78 78
79 79
80/* AUXIO2 (Power Off Control) */ 80/* AUXIO2 (Power Off Control) */
81extern __volatile__ unsigned char * auxio_power_register; 81extern volatile u8 __iomem *auxio_power_register;
82 82
83#define AUXIO_POWER_DETECT_FAILURE 32 83#define AUXIO_POWER_DETECT_FAILURE 32
84#define AUXIO_POWER_CLEAR_FAILURE 2 84#define AUXIO_POWER_CLEAR_FAILURE 2
diff --git a/arch/sparc/include/asm/auxio_64.h b/arch/sparc/include/asm/auxio_64.h
index f61cd1e3e395..6079e59a7ad1 100644
--- a/arch/sparc/include/asm/auxio_64.h
+++ b/arch/sparc/include/asm/auxio_64.h
@@ -75,8 +75,6 @@
75 75
76#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
77 77
78extern void __iomem *auxio_register;
79
80#define AUXIO_LTE_ON 1 78#define AUXIO_LTE_ON 1
81#define AUXIO_LTE_OFF 0 79#define AUXIO_LTE_OFF 0
82 80
@@ -84,7 +82,7 @@ extern void __iomem *auxio_register;
84 * 82 *
85 * on - AUXIO_LTE_ON or AUXIO_LTE_OFF 83 * on - AUXIO_LTE_ON or AUXIO_LTE_OFF
86 */ 84 */
87extern void auxio_set_lte(int on); 85void auxio_set_lte(int on);
88 86
89#define AUXIO_LED_ON 1 87#define AUXIO_LED_ON 1
90#define AUXIO_LED_OFF 0 88#define AUXIO_LED_OFF 0
@@ -93,7 +91,7 @@ extern void auxio_set_lte(int on);
93 * 91 *
94 * on - AUXIO_LED_ON or AUXIO_LED_OFF 92 * on - AUXIO_LED_ON or AUXIO_LED_OFF
95 */ 93 */
96extern void auxio_set_led(int on); 94void auxio_set_led(int on);
97 95
98#endif /* ifndef __ASSEMBLY__ */ 96#endif /* ifndef __ASSEMBLY__ */
99 97
diff --git a/arch/sparc/include/asm/bitext.h b/arch/sparc/include/asm/bitext.h
index 297b2f2fcb49..9c988bf3adb6 100644
--- a/arch/sparc/include/asm/bitext.h
+++ b/arch/sparc/include/asm/bitext.h
@@ -20,8 +20,8 @@ struct bit_map {
20 int num_colors; 20 int num_colors;
21}; 21};
22 22
23extern int bit_map_string_get(struct bit_map *t, int len, int align); 23int bit_map_string_get(struct bit_map *t, int len, int align);
24extern void bit_map_clear(struct bit_map *t, int offset, int len); 24void bit_map_clear(struct bit_map *t, int offset, int len);
25extern void bit_map_init(struct bit_map *t, unsigned long *map, int size); 25void bit_map_init(struct bit_map *t, unsigned long *map, int size);
26 26
27#endif /* defined(_SPARC_BITEXT_H) */ 27#endif /* defined(_SPARC_BITEXT_H) */
diff --git a/arch/sparc/include/asm/bitops_32.h b/arch/sparc/include/asm/bitops_32.h
index 88c9a962502c..600ed1d9c8c8 100644
--- a/arch/sparc/include/asm/bitops_32.h
+++ b/arch/sparc/include/asm/bitops_32.h
@@ -18,9 +18,9 @@
18#error only <linux/bitops.h> can be included directly 18#error only <linux/bitops.h> can be included directly
19#endif 19#endif
20 20
21extern unsigned long ___set_bit(unsigned long *addr, unsigned long mask); 21unsigned long ___set_bit(unsigned long *addr, unsigned long mask);
22extern unsigned long ___clear_bit(unsigned long *addr, unsigned long mask); 22unsigned long ___clear_bit(unsigned long *addr, unsigned long mask);
23extern unsigned long ___change_bit(unsigned long *addr, unsigned long mask); 23unsigned long ___change_bit(unsigned long *addr, unsigned long mask);
24 24
25/* 25/*
26 * Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0' 26 * Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0'
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index f1a051ca301a..2d522402a937 100644
--- a/arch/sparc/include/asm/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
@@ -15,12 +15,12 @@
15#include <asm/byteorder.h> 15#include <asm/byteorder.h>
16#include <asm/barrier.h> 16#include <asm/barrier.h>
17 17
18extern int test_and_set_bit(unsigned long nr, volatile unsigned long *addr); 18int test_and_set_bit(unsigned long nr, volatile unsigned long *addr);
19extern int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); 19int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr);
20extern int test_and_change_bit(unsigned long nr, volatile unsigned long *addr); 20int test_and_change_bit(unsigned long nr, volatile unsigned long *addr);
21extern void set_bit(unsigned long nr, volatile unsigned long *addr); 21void set_bit(unsigned long nr, volatile unsigned long *addr);
22extern void clear_bit(unsigned long nr, volatile unsigned long *addr); 22void clear_bit(unsigned long nr, volatile unsigned long *addr);
23extern void change_bit(unsigned long nr, volatile unsigned long *addr); 23void change_bit(unsigned long nr, volatile unsigned long *addr);
24 24
25#include <asm-generic/bitops/non-atomic.h> 25#include <asm-generic/bitops/non-atomic.h>
26 26
@@ -30,8 +30,8 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr);
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32 32
33extern int ffs(int x); 33int ffs(int x);
34extern unsigned long __ffs(unsigned long); 34unsigned long __ffs(unsigned long);
35 35
36#include <asm-generic/bitops/ffz.h> 36#include <asm-generic/bitops/ffz.h>
37#include <asm-generic/bitops/sched.h> 37#include <asm-generic/bitops/sched.h>
@@ -41,10 +41,10 @@ extern unsigned long __ffs(unsigned long);
41 * of bits set) of a N-bit word 41 * of bits set) of a N-bit word
42 */ 42 */
43 43
44extern unsigned long __arch_hweight64(__u64 w); 44unsigned long __arch_hweight64(__u64 w);
45extern unsigned int __arch_hweight32(unsigned int w); 45unsigned int __arch_hweight32(unsigned int w);
46extern unsigned int __arch_hweight16(unsigned int w); 46unsigned int __arch_hweight16(unsigned int w);
47extern unsigned int __arch_hweight8(unsigned int w); 47unsigned int __arch_hweight8(unsigned int w);
48 48
49#include <asm-generic/bitops/const_hweight.h> 49#include <asm-generic/bitops/const_hweight.h>
50#include <asm-generic/bitops/lock.h> 50#include <asm-generic/bitops/lock.h>
diff --git a/arch/sparc/include/asm/btext.h b/arch/sparc/include/asm/btext.h
index 9b2bc6b6ed0a..75a32b109e15 100644
--- a/arch/sparc/include/asm/btext.h
+++ b/arch/sparc/include/asm/btext.h
@@ -1,6 +1,6 @@
1#ifndef _SPARC_BTEXT_H 1#ifndef _SPARC_BTEXT_H
2#define _SPARC_BTEXT_H 2#define _SPARC_BTEXT_H
3 3
4extern int btext_find_display(void); 4int btext_find_display(void);
5 5
6#endif /* _SPARC_BTEXT_H */ 6#endif /* _SPARC_BTEXT_H */
diff --git a/arch/sparc/include/asm/bug.h b/arch/sparc/include/asm/bug.h
index 6bd9f43cb5a5..eaa8f8d38125 100644
--- a/arch/sparc/include/asm/bug.h
+++ b/arch/sparc/include/asm/bug.h
@@ -5,7 +5,7 @@
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7#ifdef CONFIG_DEBUG_BUGVERBOSE 7#ifdef CONFIG_DEBUG_BUGVERBOSE
8extern void do_BUG(const char *file, int line); 8void do_BUG(const char *file, int line);
9#define BUG() do { \ 9#define BUG() do { \
10 do_BUG(__FILE__, __LINE__); \ 10 do_BUG(__FILE__, __LINE__); \
11 __builtin_trap(); \ 11 __builtin_trap(); \
@@ -20,6 +20,6 @@ extern void do_BUG(const char *file, int line);
20#include <asm-generic/bug.h> 20#include <asm-generic/bug.h>
21 21
22struct pt_regs; 22struct pt_regs;
23extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); 23void __noreturn die_if_kernel(char *str, struct pt_regs *regs);
24 24
25#endif 25#endif
diff --git a/arch/sparc/include/asm/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h
index bb014c24f318..12164006181c 100644
--- a/arch/sparc/include/asm/cacheflush_32.h
+++ b/arch/sparc/include/asm/cacheflush_32.h
@@ -36,7 +36,7 @@
36#define flush_page_for_dma(addr) \ 36#define flush_page_for_dma(addr) \
37 sparc32_cachetlb_ops->page_for_dma(addr) 37 sparc32_cachetlb_ops->page_for_dma(addr)
38 38
39extern void sparc_flush_page_to_ram(struct page *page); 39void sparc_flush_page_to_ram(struct page *page);
40 40
41#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 41#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
42#define flush_dcache_page(page) sparc_flush_page_to_ram(page) 42#define flush_dcache_page(page) sparc_flush_page_to_ram(page)
@@ -51,8 +51,8 @@ extern void sparc_flush_page_to_ram(struct page *page);
51 * way the windows are all clean for the next process and the stack 51 * way the windows are all clean for the next process and the stack
52 * frames are up to date. 52 * frames are up to date.
53 */ 53 */
54extern void flush_user_windows(void); 54void flush_user_windows(void);
55extern void kill_user_windows(void); 55void kill_user_windows(void);
56extern void flushw_all(void); 56void flushw_all(void);
57 57
58#endif /* _SPARC_CACHEFLUSH_H */ 58#endif /* _SPARC_CACHEFLUSH_H */
diff --git a/arch/sparc/include/asm/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h
index 301736d9e7a1..38965379e350 100644
--- a/arch/sparc/include/asm/cacheflush_64.h
+++ b/arch/sparc/include/asm/cacheflush_64.h
@@ -10,7 +10,7 @@
10/* Cache flush operations. */ 10/* Cache flush operations. */
11#define flushw_all() __asm__ __volatile__("flushw") 11#define flushw_all() __asm__ __volatile__("flushw")
12 12
13extern void __flushw_user(void); 13void __flushw_user(void);
14#define flushw_user() __flushw_user() 14#define flushw_user() __flushw_user()
15 15
16#define flush_user_windows flushw_user 16#define flush_user_windows flushw_user
@@ -30,29 +30,29 @@ extern void __flushw_user(void);
30 * use block commit stores (which invalidate icache lines) during 30 * use block commit stores (which invalidate icache lines) during
31 * module load, so we need this. 31 * module load, so we need this.
32 */ 32 */
33extern void flush_icache_range(unsigned long start, unsigned long end); 33void flush_icache_range(unsigned long start, unsigned long end);
34extern void __flush_icache_page(unsigned long); 34void __flush_icache_page(unsigned long);
35 35
36extern void __flush_dcache_page(void *addr, int flush_icache); 36void __flush_dcache_page(void *addr, int flush_icache);
37extern void flush_dcache_page_impl(struct page *page); 37void flush_dcache_page_impl(struct page *page);
38#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
39extern void smp_flush_dcache_page_impl(struct page *page, int cpu); 39void smp_flush_dcache_page_impl(struct page *page, int cpu);
40extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page); 40void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
41#else 41#else
42#define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page) 42#define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)
43#define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page) 43#define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)
44#endif 44#endif
45 45
46extern void __flush_dcache_range(unsigned long start, unsigned long end); 46void __flush_dcache_range(unsigned long start, unsigned long end);
47#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 47#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
48extern void flush_dcache_page(struct page *page); 48void flush_dcache_page(struct page *page);
49 49
50#define flush_icache_page(vma, pg) do { } while(0) 50#define flush_icache_page(vma, pg) do { } while(0)
51#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) 51#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
52 52
53extern void flush_ptrace_access(struct vm_area_struct *, struct page *, 53void flush_ptrace_access(struct vm_area_struct *, struct page *,
54 unsigned long uaddr, void *kaddr, 54 unsigned long uaddr, void *kaddr,
55 unsigned long len, int write); 55 unsigned long len, int write);
56 56
57#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 57#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
58 do { \ 58 do { \
diff --git a/arch/sparc/include/asm/checksum_32.h b/arch/sparc/include/asm/checksum_32.h
index 04471dc64847..426b2389a1c2 100644
--- a/arch/sparc/include/asm/checksum_32.h
+++ b/arch/sparc/include/asm/checksum_32.h
@@ -29,7 +29,7 @@
29 * 29 *
30 * it's best to have buff aligned on a 32-bit boundary 30 * it's best to have buff aligned on a 32-bit boundary
31 */ 31 */
32extern __wsum csum_partial(const void *buff, int len, __wsum sum); 32__wsum csum_partial(const void *buff, int len, __wsum sum);
33 33
34/* the same as csum_partial, but copies from fs:src while it 34/* the same as csum_partial, but copies from fs:src while it
35 * checksums 35 * checksums
@@ -38,7 +38,7 @@ extern __wsum csum_partial(const void *buff, int len, __wsum sum);
38 * better 64-bit) boundary 38 * better 64-bit) boundary
39 */ 39 */
40 40
41extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *); 41unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *);
42 42
43static inline __wsum 43static inline __wsum
44csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) 44csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
diff --git a/arch/sparc/include/asm/checksum_64.h b/arch/sparc/include/asm/checksum_64.h
index 2ff81ae8f3af..b8779a6a5911 100644
--- a/arch/sparc/include/asm/checksum_64.h
+++ b/arch/sparc/include/asm/checksum_64.h
@@ -29,7 +29,7 @@
29 * 29 *
30 * it's best to have buff aligned on a 32-bit boundary 30 * it's best to have buff aligned on a 32-bit boundary
31 */ 31 */
32extern __wsum csum_partial(const void * buff, int len, __wsum sum); 32__wsum csum_partial(const void * buff, int len, __wsum sum);
33 33
34/* the same as csum_partial, but copies from user space while it 34/* the same as csum_partial, but copies from user space while it
35 * checksums 35 * checksums
@@ -37,12 +37,12 @@ extern __wsum csum_partial(const void * buff, int len, __wsum sum);
37 * here even more important to align src and dst on a 32-bit (or even 37 * here even more important to align src and dst on a 32-bit (or even
38 * better 64-bit) boundary 38 * better 64-bit) boundary
39 */ 39 */
40extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, 40__wsum csum_partial_copy_nocheck(const void *src, void *dst,
41 int len, __wsum sum); 41 int len, __wsum sum);
42 42
43extern long __csum_partial_copy_from_user(const void __user *src, 43long __csum_partial_copy_from_user(const void __user *src,
44 void *dst, int len, 44 void *dst, int len,
45 __wsum sum); 45 __wsum sum);
46 46
47static inline __wsum 47static inline __wsum
48csum_partial_copy_from_user(const void __user *src, 48csum_partial_copy_from_user(const void __user *src,
@@ -59,9 +59,9 @@ csum_partial_copy_from_user(const void __user *src,
59 * Copy and checksum to user 59 * Copy and checksum to user
60 */ 60 */
61#define HAVE_CSUM_COPY_USER 61#define HAVE_CSUM_COPY_USER
62extern long __csum_partial_copy_to_user(const void *src, 62long __csum_partial_copy_to_user(const void *src,
63 void __user *dst, int len, 63 void __user *dst, int len,
64 __wsum sum); 64 __wsum sum);
65 65
66static inline __wsum 66static inline __wsum
67csum_and_copy_to_user(const void *src, 67csum_and_copy_to_user(const void *src,
@@ -77,7 +77,7 @@ csum_and_copy_to_user(const void *src,
77/* ihl is always 5 or greater, almost always is 5, and iph is word aligned 77/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
78 * the majority of the time. 78 * the majority of the time.
79 */ 79 */
80extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); 80__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
81 81
82/* Fold a partial checksum without adding pseudo headers. */ 82/* Fold a partial checksum without adding pseudo headers. */
83static inline __sum16 csum_fold(__wsum sum) 83static inline __sum16 csum_fold(__wsum sum)
@@ -96,9 +96,9 @@ static inline __sum16 csum_fold(__wsum sum)
96} 96}
97 97
98static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 98static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
99 unsigned int len, 99 unsigned int len,
100 unsigned short proto, 100 unsigned short proto,
101 __wsum sum) 101 __wsum sum)
102{ 102{
103 __asm__ __volatile__( 103 __asm__ __volatile__(
104" addcc %1, %0, %0\n" 104" addcc %1, %0, %0\n"
@@ -116,9 +116,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
116 * returns a 16-bit checksum, already complemented 116 * returns a 16-bit checksum, already complemented
117 */ 117 */
118static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 118static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
119 unsigned short len, 119 unsigned short len,
120 unsigned short proto, 120 unsigned short proto,
121 __wsum sum) 121 __wsum sum)
122{ 122{
123 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 123 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
124} 124}
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h
index 1fae1a02e3c2..32c29a133f9d 100644
--- a/arch/sparc/include/asm/cmpxchg_32.h
+++ b/arch/sparc/include/asm/cmpxchg_32.h
@@ -20,7 +20,7 @@ static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned lon
20 return val; 20 return val;
21} 21}
22 22
23extern void __xchg_called_with_bad_pointer(void); 23void __xchg_called_with_bad_pointer(void);
24 24
25static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) 25static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size)
26{ 26{
@@ -45,9 +45,9 @@ static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int
45#define __HAVE_ARCH_CMPXCHG 1 45#define __HAVE_ARCH_CMPXCHG 1
46 46
47/* bug catcher for when unsupported size is used - won't link */ 47/* bug catcher for when unsupported size is used - won't link */
48extern void __cmpxchg_called_with_bad_pointer(void); 48void __cmpxchg_called_with_bad_pointer(void);
49/* we only need to support cmpxchg of a u32 on sparc */ 49/* we only need to support cmpxchg of a u32 on sparc */
50extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); 50unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_);
51 51
52/* don't worry...optimizer will get rid of most of this */ 52/* don't worry...optimizer will get rid of most of this */
53static inline unsigned long 53static inline unsigned long
diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h
index 4adefe8e2885..0e1ed6cfbf68 100644
--- a/arch/sparc/include/asm/cmpxchg_64.h
+++ b/arch/sparc/include/asm/cmpxchg_64.h
@@ -42,7 +42,7 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long
42 42
43#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 43#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
44 44
45extern void __xchg_called_with_bad_pointer(void); 45void __xchg_called_with_bad_pointer(void);
46 46
47static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, 47static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr,
48 int size) 48 int size)
@@ -91,7 +91,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
91 91
92/* This function doesn't exist, so you'll get a linker error 92/* This function doesn't exist, so you'll get a linker error
93 if something tries to do an invalid cmpxchg(). */ 93 if something tries to do an invalid cmpxchg(). */
94extern void __cmpxchg_called_with_bad_pointer(void); 94void __cmpxchg_called_with_bad_pointer(void);
95 95
96static inline unsigned long 96static inline unsigned long
97__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 97__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
index b5976de7cacd..128b56b08676 100644
--- a/arch/sparc/include/asm/cpudata.h
+++ b/arch/sparc/include/asm/cpudata.h
@@ -1,5 +1,15 @@
1#ifndef ___ASM_SPARC_CPUDATA_H 1#ifndef ___ASM_SPARC_CPUDATA_H
2#define ___ASM_SPARC_CPUDATA_H 2#define ___ASM_SPARC_CPUDATA_H
3
4#ifndef __ASSEMBLY__
5
6#include <linux/threads.h>
7#include <linux/percpu.h>
8
9extern const struct seq_operations cpuinfo_op;
10
11#endif /* !(__ASSEMBLY__) */
12
3#if defined(__sparc__) && defined(__arch64__) 13#if defined(__sparc__) && defined(__arch64__)
4#include <asm/cpudata_64.h> 14#include <asm/cpudata_64.h>
5#else 15#else
diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h
index 050ef35b9dcf..0e594076912c 100644
--- a/arch/sparc/include/asm/cpudata_64.h
+++ b/arch/sparc/include/asm/cpudata_64.h
@@ -8,9 +8,6 @@
8 8
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10 10
11#include <linux/percpu.h>
12#include <linux/threads.h>
13
14typedef struct { 11typedef struct {
15 /* Dcache line 1 */ 12 /* Dcache line 1 */
16 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ 13 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
@@ -35,8 +32,6 @@ DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
35#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu)) 32#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu))
36#define local_cpu_data() __get_cpu_var(__cpu_data) 33#define local_cpu_data() __get_cpu_var(__cpu_data)
37 34
38extern const struct seq_operations cpuinfo_op;
39
40#endif /* !(__ASSEMBLY__) */ 35#endif /* !(__ASSEMBLY__) */
41 36
42#include <asm/trap_block.h> 37#include <asm/trap_block.h>
diff --git a/arch/sparc/include/asm/delay_32.h b/arch/sparc/include/asm/delay_32.h
index bc9aba2bead6..3fb8ca144b4f 100644
--- a/arch/sparc/include/asm/delay_32.h
+++ b/arch/sparc/include/asm/delay_32.h
@@ -20,8 +20,8 @@ static inline void __delay(unsigned long loops)
20} 20}
21 21
22/* This is too messy with inline asm on the Sparc. */ 22/* This is too messy with inline asm on the Sparc. */
23extern void __udelay(unsigned long usecs, unsigned long lpj); 23void __udelay(unsigned long usecs, unsigned long lpj);
24extern void __ndelay(unsigned long nsecs, unsigned long lpj); 24void __ndelay(unsigned long nsecs, unsigned long lpj);
25 25
26#ifdef CONFIG_SMP 26#ifdef CONFIG_SMP
27#define __udelay_val cpu_data(smp_processor_id()).udelay_val 27#define __udelay_val cpu_data(smp_processor_id()).udelay_val
diff --git a/arch/sparc/include/asm/delay_64.h b/arch/sparc/include/asm/delay_64.h
index a77aa622d762..0ba5424856d8 100644
--- a/arch/sparc/include/asm/delay_64.h
+++ b/arch/sparc/include/asm/delay_64.h
@@ -8,8 +8,8 @@
8 8
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10 10
11extern void __delay(unsigned long loops); 11void __delay(unsigned long loops);
12extern void udelay(unsigned long usecs); 12void udelay(unsigned long usecs);
13#define mdelay(n) udelay((n) * 1000) 13#define mdelay(n) udelay((n) * 1000)
14 14
15#endif /* !__ASSEMBLY__ */ 15#endif /* !__ASSEMBLY__ */
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index daa6a8a5e9cd..bb3f0b0c6754 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -19,7 +19,7 @@ struct dev_archdata {
19 int numa_node; 19 int numa_node;
20}; 20};
21 21
22extern void of_propagate_archdata(struct platform_device *bus); 22void of_propagate_archdata(struct platform_device *bus);
23 23
24struct pdev_archdata { 24struct pdev_archdata {
25 struct resource resource[PROMREG_MAX]; 25 struct resource resource[PROMREG_MAX];
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 05fe53f5346e..1ee02710b2dc 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,7 @@
7 7
8#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 8#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
9 9
10extern int dma_supported(struct device *dev, u64 mask); 10int dma_supported(struct device *dev, u64 mask);
11 11
12#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 12#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
diff --git a/arch/sparc/include/asm/ebus_dma.h b/arch/sparc/include/asm/ebus_dma.h
index f07a5b541c98..fcfb4948147f 100644
--- a/arch/sparc/include/asm/ebus_dma.h
+++ b/arch/sparc/include/asm/ebus_dma.h
@@ -22,14 +22,14 @@ struct ebus_dma_info {
22 unsigned char name[64]; 22 unsigned char name[64];
23}; 23};
24 24
25extern int ebus_dma_register(struct ebus_dma_info *p); 25int ebus_dma_register(struct ebus_dma_info *p);
26extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on); 26int ebus_dma_irq_enable(struct ebus_dma_info *p, int on);
27extern void ebus_dma_unregister(struct ebus_dma_info *p); 27void ebus_dma_unregister(struct ebus_dma_info *p);
28extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr, 28int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
29 size_t len); 29 size_t len);
30extern void ebus_dma_prepare(struct ebus_dma_info *p, int write); 30void ebus_dma_prepare(struct ebus_dma_info *p, int write);
31extern unsigned int ebus_dma_residue(struct ebus_dma_info *p); 31unsigned int ebus_dma_residue(struct ebus_dma_info *p);
32extern unsigned int ebus_dma_addr(struct ebus_dma_info *p); 32unsigned int ebus_dma_addr(struct ebus_dma_info *p);
33extern void ebus_dma_enable(struct ebus_dma_info *p, int on); 33void ebus_dma_enable(struct ebus_dma_info *p, int on);
34 34
35#endif /* __ASM_SPARC_EBUS_DMA_H */ 35#endif /* __ASM_SPARC_EBUS_DMA_H */
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h
index fb3f16954c69..071b83e52f15 100644
--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -9,11 +9,12 @@
9#include <linux/of.h> 9#include <linux/of.h>
10#include <linux/of_device.h> 10#include <linux/of_device.h>
11 11
12#include <asm/page.h>
13#include <asm/pgtable.h> 12#include <asm/pgtable.h>
14#include <asm/idprom.h> 13#include <asm/idprom.h>
15#include <asm/oplib.h> 14#include <asm/oplib.h>
16#include <asm/auxio.h> 15#include <asm/auxio.h>
16#include <asm/setup.h>
17#include <asm/page.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
18 19
19/* We don't need no stinkin' I/O port allocation crap. */ 20/* We don't need no stinkin' I/O port allocation crap. */
@@ -49,7 +50,6 @@ struct sun_flpy_controller {
49 50
50/* You'll only ever find one controller on a SparcStation anyways. */ 51/* You'll only ever find one controller on a SparcStation anyways. */
51static struct sun_flpy_controller *sun_fdc = NULL; 52static struct sun_flpy_controller *sun_fdc = NULL;
52extern volatile unsigned char *fdc_status;
53 53
54struct sun_floppy_ops { 54struct sun_floppy_ops {
55 unsigned char (*fd_inb)(int port); 55 unsigned char (*fd_inb)(int port);
@@ -212,13 +212,6 @@ static void sun_82077_fd_outb(unsigned char value, int port)
212 * underruns. If non-zero, doing_pdma encodes the direction of 212 * underruns. If non-zero, doing_pdma encodes the direction of
213 * the transfer for debugging. 1=read 2=write 213 * the transfer for debugging. 1=read 2=write
214 */ 214 */
215extern char *pdma_vaddr;
216extern unsigned long pdma_size;
217extern volatile int doing_pdma;
218
219/* This is software state */
220extern char *pdma_base;
221extern unsigned long pdma_areasize;
222 215
223/* Common routines to all controller types on the Sparc. */ 216/* Common routines to all controller types on the Sparc. */
224static inline void virtual_dma_init(void) 217static inline void virtual_dma_init(void)
@@ -263,8 +256,7 @@ static inline void sun_fd_enable_dma(void)
263 pdma_areasize = pdma_size; 256 pdma_areasize = pdma_size;
264} 257}
265 258
266extern int sparc_floppy_request_irq(unsigned int irq, 259int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler);
267 irq_handler_t irq_handler);
268 260
269static int sun_fd_request_irq(void) 261static int sun_fd_request_irq(void)
270{ 262{
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index 7c90c50c200d..625756406a7e 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -296,7 +296,7 @@ struct sun_pci_dma_op {
296static struct sun_pci_dma_op sun_pci_dma_current = { -1U, 0, 0, NULL}; 296static struct sun_pci_dma_op sun_pci_dma_current = { -1U, 0, 0, NULL};
297static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL}; 297static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL};
298 298
299extern irqreturn_t floppy_interrupt(int irq, void *dev_id); 299irqreturn_t floppy_interrupt(int irq, void *dev_id);
300 300
301static unsigned char sun_pci_fd_inb(unsigned long port) 301static unsigned char sun_pci_fd_inb(unsigned long port)
302{ 302{
diff --git a/arch/sparc/include/asm/ftrace.h b/arch/sparc/include/asm/ftrace.h
index b0f18e9893db..9ec94ad116fb 100644
--- a/arch/sparc/include/asm/ftrace.h
+++ b/arch/sparc/include/asm/ftrace.h
@@ -6,7 +6,7 @@
6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ 6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
7 7
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9extern void _mcount(void); 9void _mcount(void);
10#endif 10#endif
11 11
12#endif 12#endif
@@ -22,4 +22,8 @@ struct dyn_arch_ftrace {
22}; 22};
23#endif /* CONFIG_DYNAMIC_FTRACE */ 23#endif /* CONFIG_DYNAMIC_FTRACE */
24 24
25unsigned long prepare_ftrace_return(unsigned long parent,
26 unsigned long self_addr,
27 unsigned long frame_pointer);
28
25#endif /* _ASM_SPARC64_FTRACE */ 29#endif /* _ASM_SPARC64_FTRACE */
diff --git a/arch/sparc/include/asm/highmem.h b/arch/sparc/include/asm/highmem.h
index 4f9e15c757e2..92ded294a4ec 100644
--- a/arch/sparc/include/asm/highmem.h
+++ b/arch/sparc/include/asm/highmem.h
@@ -31,7 +31,7 @@ extern unsigned long highstart_pfn, highend_pfn;
31extern pgprot_t kmap_prot; 31extern pgprot_t kmap_prot;
32extern pte_t *pkmap_page_table; 32extern pte_t *pkmap_page_table;
33 33
34extern void kmap_init(void) __init; 34void kmap_init(void) __init;
35 35
36/* 36/*
37 * Right now we initialize only a single pte table. It can be extended 37 * Right now we initialize only a single pte table. It can be extended
@@ -49,8 +49,8 @@ extern void kmap_init(void) __init;
49 49
50#define PKMAP_END (PKMAP_ADDR(LAST_PKMAP)) 50#define PKMAP_END (PKMAP_ADDR(LAST_PKMAP))
51 51
52extern void *kmap_high(struct page *page); 52void *kmap_high(struct page *page);
53extern void kunmap_high(struct page *page); 53void kunmap_high(struct page *page);
54 54
55static inline void *kmap(struct page *page) 55static inline void *kmap(struct page *page)
56{ 56{
@@ -68,8 +68,8 @@ static inline void kunmap(struct page *page)
68 kunmap_high(page); 68 kunmap_high(page);
69} 69}
70 70
71extern void *kmap_atomic(struct page *page); 71void *kmap_atomic(struct page *page);
72extern void __kunmap_atomic(void *kvaddr); 72void __kunmap_atomic(void *kvaddr);
73 73
74#define flush_cache_kmaps() flush_cache_all() 74#define flush_cache_kmaps() flush_cache_all()
75 75
diff --git a/arch/sparc/include/asm/hvtramp.h b/arch/sparc/include/asm/hvtramp.h
index b2b9b947b3a4..04b56f862bbe 100644
--- a/arch/sparc/include/asm/hvtramp.h
+++ b/arch/sparc/include/asm/hvtramp.h
@@ -19,7 +19,7 @@ struct hvtramp_descr {
19 struct hvtramp_mapping maps[1]; 19 struct hvtramp_mapping maps[1];
20}; 20};
21 21
22extern void hv_cpu_startup(unsigned long hvdescr_pa); 22void hv_cpu_startup(unsigned long hvdescr_pa);
23 23
24#endif 24#endif
25 25
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h
index ca121f0fa3ec..94b39caea3eb 100644
--- a/arch/sparc/include/asm/hypervisor.h
+++ b/arch/sparc/include/asm/hypervisor.h
@@ -98,7 +98,7 @@
98#define HV_FAST_MACH_EXIT 0x00 98#define HV_FAST_MACH_EXIT 0x00
99 99
100#ifndef __ASSEMBLY__ 100#ifndef __ASSEMBLY__
101extern void sun4v_mach_exit(unsigned long exit_code); 101void sun4v_mach_exit(unsigned long exit_code);
102#endif 102#endif
103 103
104/* Domain services. */ 104/* Domain services. */
@@ -127,9 +127,9 @@ extern void sun4v_mach_exit(unsigned long exit_code);
127#define HV_FAST_MACH_DESC 0x01 127#define HV_FAST_MACH_DESC 0x01
128 128
129#ifndef __ASSEMBLY__ 129#ifndef __ASSEMBLY__
130extern unsigned long sun4v_mach_desc(unsigned long buffer_pa, 130unsigned long sun4v_mach_desc(unsigned long buffer_pa,
131 unsigned long buf_len, 131 unsigned long buf_len,
132 unsigned long *real_buf_len); 132 unsigned long *real_buf_len);
133#endif 133#endif
134 134
135/* mach_sir() 135/* mach_sir()
@@ -148,7 +148,7 @@ extern unsigned long sun4v_mach_desc(unsigned long buffer_pa,
148#define HV_FAST_MACH_SIR 0x02 148#define HV_FAST_MACH_SIR 0x02
149 149
150#ifndef __ASSEMBLY__ 150#ifndef __ASSEMBLY__
151extern void sun4v_mach_sir(void); 151void sun4v_mach_sir(void);
152#endif 152#endif
153 153
154/* mach_set_watchdog() 154/* mach_set_watchdog()
@@ -204,8 +204,8 @@ extern void sun4v_mach_sir(void);
204#define HV_FAST_MACH_SET_WATCHDOG 0x05 204#define HV_FAST_MACH_SET_WATCHDOG 0x05
205 205
206#ifndef __ASSEMBLY__ 206#ifndef __ASSEMBLY__
207extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout, 207unsigned long sun4v_mach_set_watchdog(unsigned long timeout,
208 unsigned long *orig_timeout); 208 unsigned long *orig_timeout);
209#endif 209#endif
210 210
211/* CPU services. 211/* CPU services.
@@ -250,10 +250,10 @@ extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout,
250#define HV_FAST_CPU_START 0x10 250#define HV_FAST_CPU_START 0x10
251 251
252#ifndef __ASSEMBLY__ 252#ifndef __ASSEMBLY__
253extern unsigned long sun4v_cpu_start(unsigned long cpuid, 253unsigned long sun4v_cpu_start(unsigned long cpuid,
254 unsigned long pc, 254 unsigned long pc,
255 unsigned long rtba, 255 unsigned long rtba,
256 unsigned long arg0); 256 unsigned long arg0);
257#endif 257#endif
258 258
259/* cpu_stop() 259/* cpu_stop()
@@ -278,7 +278,7 @@ extern unsigned long sun4v_cpu_start(unsigned long cpuid,
278#define HV_FAST_CPU_STOP 0x11 278#define HV_FAST_CPU_STOP 0x11
279 279
280#ifndef __ASSEMBLY__ 280#ifndef __ASSEMBLY__
281extern unsigned long sun4v_cpu_stop(unsigned long cpuid); 281unsigned long sun4v_cpu_stop(unsigned long cpuid);
282#endif 282#endif
283 283
284/* cpu_yield() 284/* cpu_yield()
@@ -295,7 +295,7 @@ extern unsigned long sun4v_cpu_stop(unsigned long cpuid);
295#define HV_FAST_CPU_YIELD 0x12 295#define HV_FAST_CPU_YIELD 0x12
296 296
297#ifndef __ASSEMBLY__ 297#ifndef __ASSEMBLY__
298extern unsigned long sun4v_cpu_yield(void); 298unsigned long sun4v_cpu_yield(void);
299#endif 299#endif
300 300
301/* cpu_qconf() 301/* cpu_qconf()
@@ -341,9 +341,9 @@ extern unsigned long sun4v_cpu_yield(void);
341#define HV_CPU_QUEUE_NONRES_ERROR 0x3f 341#define HV_CPU_QUEUE_NONRES_ERROR 0x3f
342 342
343#ifndef __ASSEMBLY__ 343#ifndef __ASSEMBLY__
344extern unsigned long sun4v_cpu_qconf(unsigned long type, 344unsigned long sun4v_cpu_qconf(unsigned long type,
345 unsigned long queue_paddr, 345 unsigned long queue_paddr,
346 unsigned long num_queue_entries); 346 unsigned long num_queue_entries);
347#endif 347#endif
348 348
349/* cpu_qinfo() 349/* cpu_qinfo()
@@ -394,7 +394,9 @@ extern unsigned long sun4v_cpu_qconf(unsigned long type,
394#define HV_FAST_CPU_MONDO_SEND 0x42 394#define HV_FAST_CPU_MONDO_SEND 0x42
395 395
396#ifndef __ASSEMBLY__ 396#ifndef __ASSEMBLY__
397extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long cpu_list_pa, unsigned long mondo_block_pa); 397unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count,
398 unsigned long cpu_list_pa,
399 unsigned long mondo_block_pa);
398#endif 400#endif
399 401
400/* cpu_myid() 402/* cpu_myid()
@@ -425,7 +427,7 @@ extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long
425#define HV_CPU_STATE_ERROR 0x03 427#define HV_CPU_STATE_ERROR 0x03
426 428
427#ifndef __ASSEMBLY__ 429#ifndef __ASSEMBLY__
428extern long sun4v_cpu_state(unsigned long cpuid); 430long sun4v_cpu_state(unsigned long cpuid);
429#endif 431#endif
430 432
431/* cpu_set_rtba() 433/* cpu_set_rtba()
@@ -625,8 +627,8 @@ struct hv_fault_status {
625#define HV_FAST_MMU_TSB_CTX0 0x20 627#define HV_FAST_MMU_TSB_CTX0 0x20
626 628
627#ifndef __ASSEMBLY__ 629#ifndef __ASSEMBLY__
628extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions, 630unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions,
629 unsigned long tsb_desc_ra); 631 unsigned long tsb_desc_ra);
630#endif 632#endif
631 633
632/* mmu_tsb_ctxnon0() 634/* mmu_tsb_ctxnon0()
@@ -710,7 +712,7 @@ extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions,
710#define HV_FAST_MMU_DEMAP_ALL 0x24 712#define HV_FAST_MMU_DEMAP_ALL 0x24
711 713
712#ifndef __ASSEMBLY__ 714#ifndef __ASSEMBLY__
713extern void sun4v_mmu_demap_all(void); 715void sun4v_mmu_demap_all(void);
714#endif 716#endif
715 717
716/* mmu_map_perm_addr() 718/* mmu_map_perm_addr()
@@ -740,10 +742,10 @@ extern void sun4v_mmu_demap_all(void);
740#define HV_FAST_MMU_MAP_PERM_ADDR 0x25 742#define HV_FAST_MMU_MAP_PERM_ADDR 0x25
741 743
742#ifndef __ASSEMBLY__ 744#ifndef __ASSEMBLY__
743extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr, 745unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr,
744 unsigned long set_to_zero, 746 unsigned long set_to_zero,
745 unsigned long tte, 747 unsigned long tte,
746 unsigned long flags); 748 unsigned long flags);
747#endif 749#endif
748 750
749/* mmu_fault_area_conf() 751/* mmu_fault_area_conf()
@@ -945,7 +947,7 @@ extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr,
945#define HV_FAST_TOD_GET 0x50 947#define HV_FAST_TOD_GET 0x50
946 948
947#ifndef __ASSEMBLY__ 949#ifndef __ASSEMBLY__
948extern unsigned long sun4v_tod_get(unsigned long *time); 950unsigned long sun4v_tod_get(unsigned long *time);
949#endif 951#endif
950 952
951/* tod_set() 953/* tod_set()
@@ -962,7 +964,7 @@ extern unsigned long sun4v_tod_get(unsigned long *time);
962#define HV_FAST_TOD_SET 0x51 964#define HV_FAST_TOD_SET 0x51
963 965
964#ifndef __ASSEMBLY__ 966#ifndef __ASSEMBLY__
965extern unsigned long sun4v_tod_set(unsigned long time); 967unsigned long sun4v_tod_set(unsigned long time);
966#endif 968#endif
967 969
968/* Console services */ 970/* Console services */
@@ -1038,14 +1040,14 @@ extern unsigned long sun4v_tod_set(unsigned long time);
1038#define HV_FAST_CONS_WRITE 0x63 1040#define HV_FAST_CONS_WRITE 0x63
1039 1041
1040#ifndef __ASSEMBLY__ 1042#ifndef __ASSEMBLY__
1041extern long sun4v_con_getchar(long *status); 1043long sun4v_con_getchar(long *status);
1042extern long sun4v_con_putchar(long c); 1044long sun4v_con_putchar(long c);
1043extern long sun4v_con_read(unsigned long buffer, 1045long sun4v_con_read(unsigned long buffer,
1044 unsigned long size, 1046 unsigned long size,
1045 unsigned long *bytes_read); 1047 unsigned long *bytes_read);
1046extern unsigned long sun4v_con_write(unsigned long buffer, 1048unsigned long sun4v_con_write(unsigned long buffer,
1047 unsigned long size, 1049 unsigned long size,
1048 unsigned long *bytes_written); 1050 unsigned long *bytes_written);
1049#endif 1051#endif
1050 1052
1051/* mach_set_soft_state() 1053/* mach_set_soft_state()
@@ -1080,8 +1082,8 @@ extern unsigned long sun4v_con_write(unsigned long buffer,
1080#define HV_SOFT_STATE_TRANSITION 0x02 1082#define HV_SOFT_STATE_TRANSITION 0x02
1081 1083
1082#ifndef __ASSEMBLY__ 1084#ifndef __ASSEMBLY__
1083extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, 1085unsigned long sun4v_mach_set_soft_state(unsigned long soft_state,
1084 unsigned long msg_string_ra); 1086 unsigned long msg_string_ra);
1085#endif 1087#endif
1086 1088
1087/* mach_get_soft_state() 1089/* mach_get_soft_state()
@@ -1159,20 +1161,20 @@ extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state,
1159#define HV_FAST_SVC_CLRSTATUS 0x84 1161#define HV_FAST_SVC_CLRSTATUS 0x84
1160 1162
1161#ifndef __ASSEMBLY__ 1163#ifndef __ASSEMBLY__
1162extern unsigned long sun4v_svc_send(unsigned long svc_id, 1164unsigned long sun4v_svc_send(unsigned long svc_id,
1163 unsigned long buffer, 1165 unsigned long buffer,
1164 unsigned long buffer_size, 1166 unsigned long buffer_size,
1165 unsigned long *sent_bytes); 1167 unsigned long *sent_bytes);
1166extern unsigned long sun4v_svc_recv(unsigned long svc_id, 1168unsigned long sun4v_svc_recv(unsigned long svc_id,
1167 unsigned long buffer, 1169 unsigned long buffer,
1168 unsigned long buffer_size, 1170 unsigned long buffer_size,
1169 unsigned long *recv_bytes); 1171 unsigned long *recv_bytes);
1170extern unsigned long sun4v_svc_getstatus(unsigned long svc_id, 1172unsigned long sun4v_svc_getstatus(unsigned long svc_id,
1171 unsigned long *status_bits); 1173 unsigned long *status_bits);
1172extern unsigned long sun4v_svc_setstatus(unsigned long svc_id, 1174unsigned long sun4v_svc_setstatus(unsigned long svc_id,
1173 unsigned long status_bits); 1175 unsigned long status_bits);
1174extern unsigned long sun4v_svc_clrstatus(unsigned long svc_id, 1176unsigned long sun4v_svc_clrstatus(unsigned long svc_id,
1175 unsigned long status_bits); 1177 unsigned long status_bits);
1176#endif 1178#endif
1177 1179
1178/* Trap trace services. 1180/* Trap trace services.
@@ -1458,8 +1460,8 @@ struct hv_trap_trace_entry {
1458#define HV_FAST_INTR_DEVINO2SYSINO 0xa0 1460#define HV_FAST_INTR_DEVINO2SYSINO 0xa0
1459 1461
1460#ifndef __ASSEMBLY__ 1462#ifndef __ASSEMBLY__
1461extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle, 1463unsigned long sun4v_devino_to_sysino(unsigned long devhandle,
1462 unsigned long devino); 1464 unsigned long devino);
1463#endif 1465#endif
1464 1466
1465/* intr_getenabled() 1467/* intr_getenabled()
@@ -1476,7 +1478,7 @@ extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle,
1476#define HV_FAST_INTR_GETENABLED 0xa1 1478#define HV_FAST_INTR_GETENABLED 0xa1
1477 1479
1478#ifndef __ASSEMBLY__ 1480#ifndef __ASSEMBLY__
1479extern unsigned long sun4v_intr_getenabled(unsigned long sysino); 1481unsigned long sun4v_intr_getenabled(unsigned long sysino);
1480#endif 1482#endif
1481 1483
1482/* intr_setenabled() 1484/* intr_setenabled()
@@ -1492,7 +1494,8 @@ extern unsigned long sun4v_intr_getenabled(unsigned long sysino);
1492#define HV_FAST_INTR_SETENABLED 0xa2 1494#define HV_FAST_INTR_SETENABLED 0xa2
1493 1495
1494#ifndef __ASSEMBLY__ 1496#ifndef __ASSEMBLY__
1495extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long intr_enabled); 1497unsigned long sun4v_intr_setenabled(unsigned long sysino,
1498 unsigned long intr_enabled);
1496#endif 1499#endif
1497 1500
1498/* intr_getstate() 1501/* intr_getstate()
@@ -1508,7 +1511,7 @@ extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long i
1508#define HV_FAST_INTR_GETSTATE 0xa3 1511#define HV_FAST_INTR_GETSTATE 0xa3
1509 1512
1510#ifndef __ASSEMBLY__ 1513#ifndef __ASSEMBLY__
1511extern unsigned long sun4v_intr_getstate(unsigned long sysino); 1514unsigned long sun4v_intr_getstate(unsigned long sysino);
1512#endif 1515#endif
1513 1516
1514/* intr_setstate() 1517/* intr_setstate()
@@ -1528,7 +1531,7 @@ extern unsigned long sun4v_intr_getstate(unsigned long sysino);
1528#define HV_FAST_INTR_SETSTATE 0xa4 1531#define HV_FAST_INTR_SETSTATE 0xa4
1529 1532
1530#ifndef __ASSEMBLY__ 1533#ifndef __ASSEMBLY__
1531extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state); 1534unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state);
1532#endif 1535#endif
1533 1536
1534/* intr_gettarget() 1537/* intr_gettarget()
@@ -1546,7 +1549,7 @@ extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long int
1546#define HV_FAST_INTR_GETTARGET 0xa5 1549#define HV_FAST_INTR_GETTARGET 0xa5
1547 1550
1548#ifndef __ASSEMBLY__ 1551#ifndef __ASSEMBLY__
1549extern unsigned long sun4v_intr_gettarget(unsigned long sysino); 1552unsigned long sun4v_intr_gettarget(unsigned long sysino);
1550#endif 1553#endif
1551 1554
1552/* intr_settarget() 1555/* intr_settarget()
@@ -1563,7 +1566,7 @@ extern unsigned long sun4v_intr_gettarget(unsigned long sysino);
1563#define HV_FAST_INTR_SETTARGET 0xa6 1566#define HV_FAST_INTR_SETTARGET 0xa6
1564 1567
1565#ifndef __ASSEMBLY__ 1568#ifndef __ASSEMBLY__
1566extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid); 1569unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid);
1567#endif 1570#endif
1568 1571
1569/* vintr_get_cookie() 1572/* vintr_get_cookie()
@@ -1647,30 +1650,30 @@ extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cp
1647#define HV_FAST_VINTR_SET_TARGET 0xae 1650#define HV_FAST_VINTR_SET_TARGET 0xae
1648 1651
1649#ifndef __ASSEMBLY__ 1652#ifndef __ASSEMBLY__
1650extern unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle, 1653unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle,
1651 unsigned long dev_ino, 1654 unsigned long dev_ino,
1652 unsigned long *cookie); 1655 unsigned long *cookie);
1653extern unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle, 1656unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle,
1654 unsigned long dev_ino, 1657 unsigned long dev_ino,
1655 unsigned long cookie); 1658 unsigned long cookie);
1656extern unsigned long sun4v_vintr_get_valid(unsigned long dev_handle, 1659unsigned long sun4v_vintr_get_valid(unsigned long dev_handle,
1657 unsigned long dev_ino, 1660 unsigned long dev_ino,
1658 unsigned long *valid); 1661 unsigned long *valid);
1659extern unsigned long sun4v_vintr_set_valid(unsigned long dev_handle, 1662unsigned long sun4v_vintr_set_valid(unsigned long dev_handle,
1660 unsigned long dev_ino, 1663 unsigned long dev_ino,
1661 unsigned long valid); 1664 unsigned long valid);
1662extern unsigned long sun4v_vintr_get_state(unsigned long dev_handle, 1665unsigned long sun4v_vintr_get_state(unsigned long dev_handle,
1663 unsigned long dev_ino, 1666 unsigned long dev_ino,
1664 unsigned long *state); 1667 unsigned long *state);
1665extern unsigned long sun4v_vintr_set_state(unsigned long dev_handle, 1668unsigned long sun4v_vintr_set_state(unsigned long dev_handle,
1666 unsigned long dev_ino, 1669 unsigned long dev_ino,
1667 unsigned long state); 1670 unsigned long state);
1668extern unsigned long sun4v_vintr_get_target(unsigned long dev_handle, 1671unsigned long sun4v_vintr_get_target(unsigned long dev_handle,
1669 unsigned long dev_ino, 1672 unsigned long dev_ino,
1670 unsigned long *cpuid); 1673 unsigned long *cpuid);
1671extern unsigned long sun4v_vintr_set_target(unsigned long dev_handle, 1674unsigned long sun4v_vintr_set_target(unsigned long dev_handle,
1672 unsigned long dev_ino, 1675 unsigned long dev_ino,
1673 unsigned long cpuid); 1676 unsigned long cpuid);
1674#endif 1677#endif
1675 1678
1676/* PCI IO services. 1679/* PCI IO services.
@@ -2627,50 +2630,50 @@ struct ldc_mtable_entry {
2627#define HV_FAST_LDC_REVOKE 0xef 2630#define HV_FAST_LDC_REVOKE 0xef
2628 2631
2629#ifndef __ASSEMBLY__ 2632#ifndef __ASSEMBLY__
2630extern unsigned long sun4v_ldc_tx_qconf(unsigned long channel, 2633unsigned long sun4v_ldc_tx_qconf(unsigned long channel,
2631 unsigned long ra, 2634 unsigned long ra,
2632 unsigned long num_entries); 2635 unsigned long num_entries);
2633extern unsigned long sun4v_ldc_tx_qinfo(unsigned long channel, 2636unsigned long sun4v_ldc_tx_qinfo(unsigned long channel,
2634 unsigned long *ra, 2637 unsigned long *ra,
2635 unsigned long *num_entries); 2638 unsigned long *num_entries);
2636extern unsigned long sun4v_ldc_tx_get_state(unsigned long channel, 2639unsigned long sun4v_ldc_tx_get_state(unsigned long channel,
2637 unsigned long *head_off, 2640 unsigned long *head_off,
2638 unsigned long *tail_off, 2641 unsigned long *tail_off,
2639 unsigned long *chan_state); 2642 unsigned long *chan_state);
2640extern unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel, 2643unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel,
2641 unsigned long tail_off); 2644 unsigned long tail_off);
2642extern unsigned long sun4v_ldc_rx_qconf(unsigned long channel, 2645unsigned long sun4v_ldc_rx_qconf(unsigned long channel,
2643 unsigned long ra, 2646 unsigned long ra,
2644 unsigned long num_entries); 2647 unsigned long num_entries);
2645extern unsigned long sun4v_ldc_rx_qinfo(unsigned long channel, 2648unsigned long sun4v_ldc_rx_qinfo(unsigned long channel,
2646 unsigned long *ra, 2649 unsigned long *ra,
2647 unsigned long *num_entries); 2650 unsigned long *num_entries);
2648extern unsigned long sun4v_ldc_rx_get_state(unsigned long channel, 2651unsigned long sun4v_ldc_rx_get_state(unsigned long channel,
2649 unsigned long *head_off, 2652 unsigned long *head_off,
2650 unsigned long *tail_off, 2653 unsigned long *tail_off,
2651 unsigned long *chan_state); 2654 unsigned long *chan_state);
2652extern unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel, 2655unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel,
2653 unsigned long head_off); 2656 unsigned long head_off);
2654extern unsigned long sun4v_ldc_set_map_table(unsigned long channel, 2657unsigned long sun4v_ldc_set_map_table(unsigned long channel,
2655 unsigned long ra, 2658 unsigned long ra,
2656 unsigned long num_entries); 2659 unsigned long num_entries);
2657extern unsigned long sun4v_ldc_get_map_table(unsigned long channel, 2660unsigned long sun4v_ldc_get_map_table(unsigned long channel,
2658 unsigned long *ra, 2661 unsigned long *ra,
2659 unsigned long *num_entries); 2662 unsigned long *num_entries);
2660extern unsigned long sun4v_ldc_copy(unsigned long channel, 2663unsigned long sun4v_ldc_copy(unsigned long channel,
2661 unsigned long dir_code, 2664 unsigned long dir_code,
2662 unsigned long tgt_raddr, 2665 unsigned long tgt_raddr,
2663 unsigned long lcl_raddr, 2666 unsigned long lcl_raddr,
2664 unsigned long len, 2667 unsigned long len,
2665 unsigned long *actual_len); 2668 unsigned long *actual_len);
2666extern unsigned long sun4v_ldc_mapin(unsigned long channel, 2669unsigned long sun4v_ldc_mapin(unsigned long channel,
2667 unsigned long cookie, 2670 unsigned long cookie,
2668 unsigned long *ra, 2671 unsigned long *ra,
2669 unsigned long *perm); 2672 unsigned long *perm);
2670extern unsigned long sun4v_ldc_unmap(unsigned long ra); 2673unsigned long sun4v_ldc_unmap(unsigned long ra);
2671extern unsigned long sun4v_ldc_revoke(unsigned long channel, 2674unsigned long sun4v_ldc_revoke(unsigned long channel,
2672 unsigned long cookie, 2675 unsigned long cookie,
2673 unsigned long mte_cookie); 2676 unsigned long mte_cookie);
2674#endif 2677#endif
2675 2678
2676/* Performance counter services. */ 2679/* Performance counter services. */
@@ -2727,14 +2730,14 @@ extern unsigned long sun4v_ldc_revoke(unsigned long channel,
2727#define HV_FAST_N2_SET_PERFREG 0x105 2730#define HV_FAST_N2_SET_PERFREG 0x105
2728 2731
2729#ifndef __ASSEMBLY__ 2732#ifndef __ASSEMBLY__
2730extern unsigned long sun4v_niagara_getperf(unsigned long reg, 2733unsigned long sun4v_niagara_getperf(unsigned long reg,
2731 unsigned long *val); 2734 unsigned long *val);
2732extern unsigned long sun4v_niagara_setperf(unsigned long reg, 2735unsigned long sun4v_niagara_setperf(unsigned long reg,
2733 unsigned long val); 2736 unsigned long val);
2734extern unsigned long sun4v_niagara2_getperf(unsigned long reg, 2737unsigned long sun4v_niagara2_getperf(unsigned long reg,
2735 unsigned long *val); 2738 unsigned long *val);
2736extern unsigned long sun4v_niagara2_setperf(unsigned long reg, 2739unsigned long sun4v_niagara2_setperf(unsigned long reg,
2737 unsigned long val); 2740 unsigned long val);
2738#endif 2741#endif
2739 2742
2740/* MMU statistics services. 2743/* MMU statistics services.
@@ -2829,8 +2832,8 @@ struct hv_mmu_statistics {
2829#define HV_FAST_MMUSTAT_INFO 0x103 2832#define HV_FAST_MMUSTAT_INFO 0x103
2830 2833
2831#ifndef __ASSEMBLY__ 2834#ifndef __ASSEMBLY__
2832extern unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra); 2835unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra);
2833extern unsigned long sun4v_mmustat_info(unsigned long *ra); 2836unsigned long sun4v_mmustat_info(unsigned long *ra);
2834#endif 2837#endif
2835 2838
2836/* NCS crypto services */ 2839/* NCS crypto services */
@@ -2919,9 +2922,9 @@ struct hv_ncs_qtail_update_arg {
2919#define HV_FAST_NCS_REQUEST 0x110 2922#define HV_FAST_NCS_REQUEST 0x110
2920 2923
2921#ifndef __ASSEMBLY__ 2924#ifndef __ASSEMBLY__
2922extern unsigned long sun4v_ncs_request(unsigned long request, 2925unsigned long sun4v_ncs_request(unsigned long request,
2923 unsigned long arg_ra, 2926 unsigned long arg_ra,
2924 unsigned long arg_size); 2927 unsigned long arg_size);
2925#endif 2928#endif
2926 2929
2927#define HV_FAST_FIRE_GET_PERFREG 0x120 2930#define HV_FAST_FIRE_GET_PERFREG 0x120
@@ -2930,18 +2933,18 @@ extern unsigned long sun4v_ncs_request(unsigned long request,
2930#define HV_FAST_REBOOT_DATA_SET 0x172 2933#define HV_FAST_REBOOT_DATA_SET 0x172
2931 2934
2932#ifndef __ASSEMBLY__ 2935#ifndef __ASSEMBLY__
2933extern unsigned long sun4v_reboot_data_set(unsigned long ra, 2936unsigned long sun4v_reboot_data_set(unsigned long ra,
2934 unsigned long len); 2937 unsigned long len);
2935#endif 2938#endif
2936 2939
2937#define HV_FAST_VT_GET_PERFREG 0x184 2940#define HV_FAST_VT_GET_PERFREG 0x184
2938#define HV_FAST_VT_SET_PERFREG 0x185 2941#define HV_FAST_VT_SET_PERFREG 0x185
2939 2942
2940#ifndef __ASSEMBLY__ 2943#ifndef __ASSEMBLY__
2941extern unsigned long sun4v_vt_get_perfreg(unsigned long reg_num, 2944unsigned long sun4v_vt_get_perfreg(unsigned long reg_num,
2942 unsigned long *reg_val); 2945 unsigned long *reg_val);
2943extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, 2946unsigned long sun4v_vt_set_perfreg(unsigned long reg_num,
2944 unsigned long reg_val); 2947 unsigned long reg_val);
2945#endif 2948#endif
2946 2949
2947/* Function numbers for HV_CORE_TRAP. */ 2950/* Function numbers for HV_CORE_TRAP. */
@@ -2978,21 +2981,21 @@ extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num,
2978#define HV_GRP_DIAG 0x0300 2981#define HV_GRP_DIAG 0x0300
2979 2982
2980#ifndef __ASSEMBLY__ 2983#ifndef __ASSEMBLY__
2981extern unsigned long sun4v_get_version(unsigned long group, 2984unsigned long sun4v_get_version(unsigned long group,
2982 unsigned long *major, 2985 unsigned long *major,
2983 unsigned long *minor); 2986 unsigned long *minor);
2984extern unsigned long sun4v_set_version(unsigned long group, 2987unsigned long sun4v_set_version(unsigned long group,
2985 unsigned long major, 2988 unsigned long major,
2986 unsigned long minor, 2989 unsigned long minor,
2987 unsigned long *actual_minor); 2990 unsigned long *actual_minor);
2988 2991
2989extern int sun4v_hvapi_register(unsigned long group, unsigned long major, 2992int sun4v_hvapi_register(unsigned long group, unsigned long major,
2990 unsigned long *minor); 2993 unsigned long *minor);
2991extern void sun4v_hvapi_unregister(unsigned long group); 2994void sun4v_hvapi_unregister(unsigned long group);
2992extern int sun4v_hvapi_get(unsigned long group, 2995int sun4v_hvapi_get(unsigned long group,
2993 unsigned long *major, 2996 unsigned long *major,
2994 unsigned long *minor); 2997 unsigned long *minor);
2995extern void sun4v_hvapi_init(void); 2998void sun4v_hvapi_init(void);
2996#endif 2999#endif
2997 3000
2998#endif /* !(_SPARC64_HYPERVISOR_H) */ 3001#endif /* !(_SPARC64_HYPERVISOR_H) */
diff --git a/arch/sparc/include/asm/idprom.h b/arch/sparc/include/asm/idprom.h
index 6976aa2439c6..3793f7f91c42 100644
--- a/arch/sparc/include/asm/idprom.h
+++ b/arch/sparc/include/asm/idprom.h
@@ -20,6 +20,6 @@ struct idprom {
20}; 20};
21 21
22extern struct idprom *idprom; 22extern struct idprom *idprom;
23extern void idprom_init(void); 23void idprom_init(void);
24 24
25#endif /* !(_SPARC_IDPROM_H) */ 25#endif /* !(_SPARC_IDPROM_H) */
diff --git a/arch/sparc/include/asm/io-unit.h b/arch/sparc/include/asm/io-unit.h
index 01ab2f613e91..04a9701e7202 100644
--- a/arch/sparc/include/asm/io-unit.h
+++ b/arch/sparc/include/asm/io-unit.h
@@ -43,7 +43,7 @@
43struct iounit_struct { 43struct iounit_struct {
44 unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; 44 unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)];
45 spinlock_t lock; 45 spinlock_t lock;
46 iopte_t *page_table; 46 iopte_t __iomem *page_table;
47 unsigned long rotor[3]; 47 unsigned long rotor[3];
48 unsigned long limit[4]; 48 unsigned long limit[4];
49}; 49};
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index c1acbd891cbc..9f532902627c 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -2,191 +2,94 @@
2#define __SPARC_IO_H 2#define __SPARC_IO_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/types.h>
6#include <linux/ioport.h> /* struct resource */ 5#include <linux/ioport.h> /* struct resource */
7 6
8#include <asm/page.h> /* IO address mapping routines need this */ 7#define readb_relaxed(__addr) readb(__addr)
9#include <asm-generic/pci_iomap.h> 8#define readw_relaxed(__addr) readw(__addr)
10 9#define readl_relaxed(__addr) readl(__addr)
11#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
12
13static inline u32 flip_dword (u32 l)
14{
15 return ((l&0xff)<<24) | (((l>>8)&0xff)<<16) | (((l>>16)&0xff)<<8)| ((l>>24)&0xff);
16}
17
18static inline u16 flip_word (u16 w)
19{
20 return ((w&0xff) << 8) | ((w>>8)&0xff);
21}
22
23#define mmiowb()
24
25/*
26 * Memory mapped I/O to PCI
27 */
28
29static inline u8 __raw_readb(const volatile void __iomem *addr)
30{
31 return *(__force volatile u8 *)addr;
32}
33
34static inline u16 __raw_readw(const volatile void __iomem *addr)
35{
36 return *(__force volatile u16 *)addr;
37}
38
39static inline u32 __raw_readl(const volatile void __iomem *addr)
40{
41 return *(__force volatile u32 *)addr;
42}
43 10
44static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 11#define IO_SPACE_LIMIT 0xffffffff
45{
46 *(__force volatile u8 *)addr = b;
47}
48 12
49static inline void __raw_writew(u16 w, volatile void __iomem *addr) 13#define memset_io(d,c,sz) _memset_io(d,c,sz)
50{ 14#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz)
51 *(__force volatile u16 *)addr = w; 15#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
52}
53 16
54static inline void __raw_writel(u32 l, volatile void __iomem *addr) 17#include <asm-generic/io.h>
55{
56 *(__force volatile u32 *)addr = l;
57}
58 18
59static inline u8 __readb(const volatile void __iomem *addr) 19static inline void _memset_io(volatile void __iomem *dst,
20 int c, __kernel_size_t n)
60{ 21{
61 return *(__force volatile u8 *)addr; 22 volatile void __iomem *d = dst;
62}
63 23
64static inline u16 __readw(const volatile void __iomem *addr) 24 while (n--) {
65{ 25 writeb(c, d);
66 return flip_word(*(__force volatile u16 *)addr); 26 d++;
27 }
67} 28}
68 29
69static inline u32 __readl(const volatile void __iomem *addr) 30static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src,
31 __kernel_size_t n)
70{ 32{
71 return flip_dword(*(__force volatile u32 *)addr); 33 char *d = dst;
72}
73 34
74static inline void __writeb(u8 b, volatile void __iomem *addr) 35 while (n--) {
75{ 36 char tmp = readb(src);
76 *(__force volatile u8 *)addr = b; 37 *d++ = tmp;
38 src++;
39 }
77} 40}
78 41
79static inline void __writew(u16 w, volatile void __iomem *addr) 42static inline void _memcpy_toio(volatile void __iomem *dst, const void *src,
43 __kernel_size_t n)
80{ 44{
81 *(__force volatile u16 *)addr = flip_word(w); 45 const char *s = src;
82} 46 volatile void __iomem *d = dst;
83 47
84static inline void __writel(u32 l, volatile void __iomem *addr) 48 while (n--) {
85{ 49 char tmp = *s++;
86 *(__force volatile u32 *)addr = flip_dword(l); 50 writeb(tmp, d);
51 d++;
52 }
87} 53}
88 54
89#define readb(__addr) __readb(__addr)
90#define readw(__addr) __readw(__addr)
91#define readl(__addr) __readl(__addr)
92#define readb_relaxed(__addr) readb(__addr)
93#define readw_relaxed(__addr) readw(__addr)
94#define readl_relaxed(__addr) readl(__addr)
95
96#define writeb(__b, __addr) __writeb((__b),(__addr))
97#define writew(__w, __addr) __writew((__w),(__addr))
98#define writel(__l, __addr) __writel((__l),(__addr))
99
100/*
101 * I/O space operations
102 *
103 * Arrangement on a Sun is somewhat complicated.
104 *
105 * First of all, we want to use standard Linux drivers
106 * for keyboard, PC serial, etc. These drivers think
107 * they access I/O space and use inb/outb.
108 * On the other hand, EBus bridge accepts PCI *memory*
109 * cycles and converts them into ISA *I/O* cycles.
110 * Ergo, we want inb & outb to generate PCI memory cycles.
111 *
112 * If we want to issue PCI *I/O* cycles, we do this
113 * with a low 64K fixed window in PCIC. This window gets
114 * mapped somewhere into virtual kernel space and we
115 * can use inb/outb again.
116 */
117#define inb_local(__addr) __readb((void __iomem *)(unsigned long)(__addr))
118#define inb(__addr) __readb((void __iomem *)(unsigned long)(__addr))
119#define inw(__addr) __readw((void __iomem *)(unsigned long)(__addr))
120#define inl(__addr) __readl((void __iomem *)(unsigned long)(__addr))
121
122#define outb_local(__b, __addr) __writeb(__b, (void __iomem *)(unsigned long)(__addr))
123#define outb(__b, __addr) __writeb(__b, (void __iomem *)(unsigned long)(__addr))
124#define outw(__w, __addr) __writew(__w, (void __iomem *)(unsigned long)(__addr))
125#define outl(__l, __addr) __writel(__l, (void __iomem *)(unsigned long)(__addr))
126
127#define inb_p(__addr) inb(__addr)
128#define outb_p(__b, __addr) outb(__b, __addr)
129#define inw_p(__addr) inw(__addr)
130#define outw_p(__w, __addr) outw(__w, __addr)
131#define inl_p(__addr) inl(__addr)
132#define outl_p(__l, __addr) outl(__l, __addr)
133
134void outsb(unsigned long addr, const void *src, unsigned long cnt);
135void outsw(unsigned long addr, const void *src, unsigned long cnt);
136void outsl(unsigned long addr, const void *src, unsigned long cnt);
137void insb(unsigned long addr, void *dst, unsigned long count);
138void insw(unsigned long addr, void *dst, unsigned long count);
139void insl(unsigned long addr, void *dst, unsigned long count);
140
141#define IO_SPACE_LIMIT 0xffffffff
142
143/* 55/*
144 * SBus accessors. 56 * SBus accessors.
145 * 57 *
146 * SBus has only one, memory mapped, I/O space. 58 * SBus has only one, memory mapped, I/O space.
147 * We do not need to flip bytes for SBus of course. 59 * We do not need to flip bytes for SBus of course.
148 */ 60 */
149static inline u8 _sbus_readb(const volatile void __iomem *addr) 61static inline u8 sbus_readb(const volatile void __iomem *addr)
150{ 62{
151 return *(__force volatile u8 *)addr; 63 return *(__force volatile u8 *)addr;
152} 64}
153 65
154static inline u16 _sbus_readw(const volatile void __iomem *addr) 66static inline u16 sbus_readw(const volatile void __iomem *addr)
155{ 67{
156 return *(__force volatile u16 *)addr; 68 return *(__force volatile u16 *)addr;
157} 69}
158 70
159static inline u32 _sbus_readl(const volatile void __iomem *addr) 71static inline u32 sbus_readl(const volatile void __iomem *addr)
160{ 72{
161 return *(__force volatile u32 *)addr; 73 return *(__force volatile u32 *)addr;
162} 74}
163 75
164static inline void _sbus_writeb(u8 b, volatile void __iomem *addr) 76static inline void sbus_writeb(u8 b, volatile void __iomem *addr)
165{ 77{
166 *(__force volatile u8 *)addr = b; 78 *(__force volatile u8 *)addr = b;
167} 79}
168 80
169static inline void _sbus_writew(u16 w, volatile void __iomem *addr) 81static inline void sbus_writew(u16 w, volatile void __iomem *addr)
170{ 82{
171 *(__force volatile u16 *)addr = w; 83 *(__force volatile u16 *)addr = w;
172} 84}
173 85
174static inline void _sbus_writel(u32 l, volatile void __iomem *addr) 86static inline void sbus_writel(u32 l, volatile void __iomem *addr)
175{ 87{
176 *(__force volatile u32 *)addr = l; 88 *(__force volatile u32 *)addr = l;
177} 89}
178 90
179/* 91static inline void sbus_memset_io(volatile void __iomem *__dst, int c,
180 * The only reason for #define's is to hide casts to unsigned long. 92 __kernel_size_t n)
181 */
182#define sbus_readb(__addr) _sbus_readb(__addr)
183#define sbus_readw(__addr) _sbus_readw(__addr)
184#define sbus_readl(__addr) _sbus_readl(__addr)
185#define sbus_writeb(__b, __addr) _sbus_writeb(__b, __addr)
186#define sbus_writew(__w, __addr) _sbus_writew(__w, __addr)
187#define sbus_writel(__l, __addr) _sbus_writel(__l, __addr)
188
189static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_size_t n)
190{ 93{
191 while(n--) { 94 while(n--) {
192 sbus_writeb(c, __dst); 95 sbus_writeb(c, __dst);
@@ -194,22 +97,9 @@ static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_
194 } 97 }
195} 98}
196 99
197static inline void 100static inline void sbus_memcpy_fromio(void *dst,
198_memset_io(volatile void __iomem *dst, int c, __kernel_size_t n) 101 const volatile void __iomem *src,
199{ 102 __kernel_size_t n)
200 volatile void __iomem *d = dst;
201
202 while (n--) {
203 writeb(c, d);
204 d++;
205 }
206}
207
208#define memset_io(d,c,sz) _memset_io(d,c,sz)
209
210static inline void
211_sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
212 __kernel_size_t n)
213{ 103{
214 char *d = dst; 104 char *d = dst;
215 105
@@ -220,25 +110,9 @@ _sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
220 } 110 }
221} 111}
222 112
223#define sbus_memcpy_fromio(d, s, sz) _sbus_memcpy_fromio(d, s, sz) 113static inline void sbus_memcpy_toio(volatile void __iomem *dst,
224 114 const void *src,
225static inline void 115 __kernel_size_t n)
226_memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
227{
228 char *d = dst;
229
230 while (n--) {
231 char tmp = readb(src);
232 *d++ = tmp;
233 src++;
234 }
235}
236
237#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz)
238
239static inline void
240_sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
241 __kernel_size_t n)
242{ 116{
243 const char *s = src; 117 const char *s = src;
244 volatile void __iomem *d = dst; 118 volatile void __iomem *d = dst;
@@ -250,81 +124,26 @@ _sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
250 } 124 }
251} 125}
252 126
253#define sbus_memcpy_toio(d, s, sz) _sbus_memcpy_toio(d, s, sz)
254
255static inline void
256_memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
257{
258 const char *s = src;
259 volatile void __iomem *d = dst;
260
261 while (n--) {
262 char tmp = *s++;
263 writeb(tmp, d);
264 d++;
265 }
266}
267
268#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
269
270#ifdef __KERNEL__ 127#ifdef __KERNEL__
271 128
272/* 129/*
273 * Bus number may be embedded in the higher bits of the physical address. 130 * Bus number may be embedded in the higher bits of the physical address.
274 * This is why we have no bus number argument to ioremap(). 131 * This is why we have no bus number argument to ioremap().
275 */ 132 */
276extern void __iomem *ioremap(unsigned long offset, unsigned long size); 133void __iomem *ioremap(unsigned long offset, unsigned long size);
277#define ioremap_nocache(X,Y) ioremap((X),(Y)) 134#define ioremap_nocache(X,Y) ioremap((X),(Y))
278#define ioremap_wc(X,Y) ioremap((X),(Y)) 135#define ioremap_wc(X,Y) ioremap((X),(Y))
279extern void iounmap(volatile void __iomem *addr); 136void iounmap(volatile void __iomem *addr);
280
281#define ioread8(X) readb(X)
282#define ioread16(X) readw(X)
283#define ioread16be(X) __raw_readw(X)
284#define ioread32(X) readl(X)
285#define ioread32be(X) __raw_readl(X)
286#define iowrite8(val,X) writeb(val,X)
287#define iowrite16(val,X) writew(val,X)
288#define iowrite16be(val,X) __raw_writew(val,X)
289#define iowrite32(val,X) writel(val,X)
290#define iowrite32be(val,X) __raw_writel(val,X)
291
292static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)
293{
294 insb((unsigned long __force)port, buf, count);
295}
296static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count)
297{
298 insw((unsigned long __force)port, buf, count);
299}
300
301static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count)
302{
303 insl((unsigned long __force)port, buf, count);
304}
305
306static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count)
307{
308 outsb((unsigned long __force)port, buf, count);
309}
310
311static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count)
312{
313 outsw((unsigned long __force)port, buf, count);
314}
315
316static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count)
317{
318 outsl((unsigned long __force)port, buf, count);
319}
320 137
321/* Create a virtual mapping cookie for an IO port range */ 138/* Create a virtual mapping cookie for an IO port range */
322extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 139void __iomem *ioport_map(unsigned long port, unsigned int nr);
323extern void ioport_unmap(void __iomem *); 140void ioport_unmap(void __iomem *);
324 141
325/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 142/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
326struct pci_dev; 143struct pci_dev;
327extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 144void pci_iounmap(struct pci_dev *dev, void __iomem *);
145
146
328 147
329/* 148/*
330 * At the moment, we do not use CMOS_READ anywhere outside of rtc.c, 149 * At the moment, we do not use CMOS_READ anywhere outside of rtc.c,
@@ -343,21 +162,11 @@ static inline int sbus_can_burst64(void)
343 return 0; /* actually, sparc_cpu_model==sun4d */ 162 return 0; /* actually, sparc_cpu_model==sun4d */
344} 163}
345struct device; 164struct device;
346extern void sbus_set_sbus64(struct device *, int); 165void sbus_set_sbus64(struct device *, int);
347 166
348#endif 167#endif
349 168
350#define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 169#define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1
351 170
352/*
353 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
354 * access
355 */
356#define xlate_dev_mem_ptr(p) __va(p)
357
358/*
359 * Convert a virtual cached pointer to an uncached pointer
360 */
361#define xlate_dev_kmem_ptr(p) p
362 171
363#endif /* !(__SPARC_IO_H) */ 172#endif /* !(__SPARC_IO_H) */
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 09b0b88aeb2a..05381c3a4228 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -15,7 +15,6 @@
15 15
16/* BIO layer definitions. */ 16/* BIO layer definitions. */
17extern unsigned long kern_base, kern_size; 17extern unsigned long kern_base, kern_size;
18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
19 18
20static inline u8 _inb(unsigned long addr) 19static inline u8 _inb(unsigned long addr)
21{ 20{
@@ -91,12 +90,12 @@ static inline void _outl(u32 l, unsigned long addr)
91#define inl_p(__addr) inl(__addr) 90#define inl_p(__addr) inl(__addr)
92#define outl_p(__l, __addr) outl(__l, __addr) 91#define outl_p(__l, __addr) outl(__l, __addr)
93 92
94extern void outsb(unsigned long, const void *, unsigned long); 93void outsb(unsigned long, const void *, unsigned long);
95extern void outsw(unsigned long, const void *, unsigned long); 94void outsw(unsigned long, const void *, unsigned long);
96extern void outsl(unsigned long, const void *, unsigned long); 95void outsl(unsigned long, const void *, unsigned long);
97extern void insb(unsigned long, void *, unsigned long); 96void insb(unsigned long, void *, unsigned long);
98extern void insw(unsigned long, void *, unsigned long); 97void insw(unsigned long, void *, unsigned long);
99extern void insl(unsigned long, void *, unsigned long); 98void insl(unsigned long, void *, unsigned long);
100 99
101static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) 100static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)
102{ 101{
@@ -509,12 +508,12 @@ static inline void iounmap(volatile void __iomem *addr)
509#define iowrite32be(val,X) __raw_writel(val,X) 508#define iowrite32be(val,X) __raw_writel(val,X)
510 509
511/* Create a virtual mapping cookie for an IO port range */ 510/* Create a virtual mapping cookie for an IO port range */
512extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 511void __iomem *ioport_map(unsigned long port, unsigned int nr);
513extern void ioport_unmap(void __iomem *); 512void ioport_unmap(void __iomem *);
514 513
515/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 514/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
516struct pci_dev; 515struct pci_dev;
517extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 516void pci_iounmap(struct pci_dev *dev, void __iomem *);
518 517
519static inline int sbus_can_dma_64bit(void) 518static inline int sbus_can_dma_64bit(void)
520{ 519{
@@ -525,7 +524,7 @@ static inline int sbus_can_burst64(void)
525 return 1; 524 return 1;
526} 525}
527struct device; 526struct device;
528extern void sbus_set_sbus64(struct device *, int); 527void sbus_set_sbus64(struct device *, int);
529 528
530/* 529/*
531 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 530 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
diff --git a/arch/sparc/include/asm/iommu_32.h b/arch/sparc/include/asm/iommu_32.h
index 70c589c05a10..f6c066b52fd6 100644
--- a/arch/sparc/include/asm/iommu_32.h
+++ b/arch/sparc/include/asm/iommu_32.h
@@ -99,7 +99,7 @@ struct iommu_regs {
99#define IOPTE_WAZ 0x00000001 /* Write as zeros */ 99#define IOPTE_WAZ 0x00000001 /* Write as zeros */
100 100
101struct iommu_struct { 101struct iommu_struct {
102 struct iommu_regs *regs; 102 struct iommu_regs __iomem *regs;
103 iopte_t *page_table; 103 iopte_t *page_table;
104 /* For convenience */ 104 /* For convenience */
105 unsigned long start; /* First managed virtual address */ 105 unsigned long start; /* First managed virtual address */
@@ -108,14 +108,14 @@ struct iommu_struct {
108 struct bit_map usemap; 108 struct bit_map usemap;
109}; 109};
110 110
111static inline void iommu_invalidate(struct iommu_regs *regs) 111static inline void iommu_invalidate(struct iommu_regs __iomem *regs)
112{ 112{
113 regs->tlbflush = 0; 113 sbus_writel(0, &regs->tlbflush);
114} 114}
115 115
116static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) 116static inline void iommu_invalidate_page(struct iommu_regs __iomem *regs, unsigned long ba)
117{ 117{
118 regs->pageflush = (ba & PAGE_MASK); 118 sbus_writel(ba & PAGE_MASK, &regs->pageflush);
119} 119}
120 120
121#endif /* !(_SPARC_IOMMU_H) */ 121#endif /* !(_SPARC_IOMMU_H) */
diff --git a/arch/sparc/include/asm/iommu_64.h b/arch/sparc/include/asm/iommu_64.h
index caf798b56191..2b9321ab064d 100644
--- a/arch/sparc/include/asm/iommu_64.h
+++ b/arch/sparc/include/asm/iommu_64.h
@@ -58,8 +58,8 @@ struct strbuf {
58 volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)]; 58 volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)];
59}; 59};
60 60
61extern int iommu_table_init(struct iommu *iommu, int tsbsize, 61int iommu_table_init(struct iommu *iommu, int tsbsize,
62 u32 dma_offset, u32 dma_addr_mask, 62 u32 dma_offset, u32 dma_addr_mask,
63 int numa_node); 63 int numa_node);
64 64
65#endif /* !(_SPARC64_IOMMU_H) */ 65#endif /* !(_SPARC64_IOMMU_H) */
diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h
index 2ae3acaeb1b3..eecd3d8442c9 100644
--- a/arch/sparc/include/asm/irq_32.h
+++ b/arch/sparc/include/asm/irq_32.h
@@ -16,7 +16,8 @@
16 16
17#define irq_canonicalize(irq) (irq) 17#define irq_canonicalize(irq) (irq)
18 18
19extern void __init init_IRQ(void); 19void __init init_IRQ(void);
20void __init sun4d_init_sbi_irq(void);
20 21
21#define NO_IRQ 0xffffffff 22#define NO_IRQ 0xffffffff
22 23
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index abf6afe82ca8..91d219381306 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -39,32 +39,32 @@
39 */ 39 */
40#define NR_IRQS 255 40#define NR_IRQS 255
41 41
42extern void irq_install_pre_handler(int irq, 42void irq_install_pre_handler(int irq,
43 void (*func)(unsigned int, void *, void *), 43 void (*func)(unsigned int, void *, void *),
44 void *arg1, void *arg2); 44 void *arg1, void *arg2);
45#define irq_canonicalize(irq) (irq) 45#define irq_canonicalize(irq) (irq)
46extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap); 46unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap);
47extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino); 47unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino);
48extern unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino); 48unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino);
49extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *irq_p, 49unsigned int sun4v_build_msi(u32 devhandle, unsigned int *irq_p,
50 unsigned int msi_devino_start, 50 unsigned int msi_devino_start,
51 unsigned int msi_devino_end); 51 unsigned int msi_devino_end);
52extern void sun4v_destroy_msi(unsigned int irq); 52void sun4v_destroy_msi(unsigned int irq);
53extern unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p, 53unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p,
54 unsigned int msi_devino_start, 54 unsigned int msi_devino_start,
55 unsigned int msi_devino_end, 55 unsigned int msi_devino_end,
56 unsigned long imap_base, 56 unsigned long imap_base,
57 unsigned long iclr_base); 57 unsigned long iclr_base);
58extern void sun4u_destroy_msi(unsigned int irq); 58void sun4u_destroy_msi(unsigned int irq);
59 59
60extern unsigned char irq_alloc(unsigned int dev_handle, 60unsigned char irq_alloc(unsigned int dev_handle,
61 unsigned int dev_ino); 61 unsigned int dev_ino);
62#ifdef CONFIG_PCI_MSI 62#ifdef CONFIG_PCI_MSI
63extern void irq_free(unsigned int irq); 63void irq_free(unsigned int irq);
64#endif 64#endif
65 65
66extern void __init init_IRQ(void); 66void __init init_IRQ(void);
67extern void fixup_irqs(void); 67void fixup_irqs(void);
68 68
69static inline void set_softint(unsigned long bits) 69static inline void set_softint(unsigned long bits)
70{ 70{
@@ -89,7 +89,7 @@ static inline unsigned long get_softint(void)
89 return retval; 89 return retval;
90} 90}
91 91
92void arch_trigger_all_cpu_backtrace(void); 92void arch_trigger_all_cpu_backtrace(bool);
93#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace 93#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
94 94
95extern void *hardirq_stack[NR_CPUS]; 95extern void *hardirq_stack[NR_CPUS];
diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h
index e414c06615c1..71cc284f55c5 100644
--- a/arch/sparc/include/asm/irqflags_32.h
+++ b/arch/sparc/include/asm/irqflags_32.h
@@ -15,9 +15,9 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <asm/psr.h> 16#include <asm/psr.h>
17 17
18extern void arch_local_irq_restore(unsigned long); 18void arch_local_irq_restore(unsigned long);
19extern unsigned long arch_local_irq_save(void); 19unsigned long arch_local_irq_save(void);
20extern void arch_local_irq_enable(void); 20void arch_local_irq_enable(void);
21 21
22static inline notrace unsigned long arch_local_save_flags(void) 22static inline notrace unsigned long arch_local_save_flags(void)
23{ 23{
diff --git a/arch/sparc/include/asm/kdebug_64.h b/arch/sparc/include/asm/kdebug_64.h
index feb3578e12c4..04465de8f3b5 100644
--- a/arch/sparc/include/asm/kdebug_64.h
+++ b/arch/sparc/include/asm/kdebug_64.h
@@ -3,7 +3,7 @@
3 3
4struct pt_regs; 4struct pt_regs;
5 5
6extern void bad_trap(struct pt_regs *, long); 6void bad_trap(struct pt_regs *, long);
7 7
8/* Grossly misnamed. */ 8/* Grossly misnamed. */
9enum die_val { 9enum die_val {
diff --git a/arch/sparc/include/asm/kgdb.h b/arch/sparc/include/asm/kgdb.h
index b6ef301d05bf..47366af7a589 100644
--- a/arch/sparc/include/asm/kgdb.h
+++ b/arch/sparc/include/asm/kgdb.h
@@ -28,9 +28,12 @@ enum regnames {
28#define NUMREGBYTES ((GDB_CSR + 1) * 4) 28#define NUMREGBYTES ((GDB_CSR + 1) * 4)
29#else 29#else
30#define NUMREGBYTES ((GDB_Y + 1) * 8) 30#define NUMREGBYTES ((GDB_Y + 1) * 8)
31
32struct pt_regs;
33asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs);
31#endif 34#endif
32 35
33extern void arch_kgdb_breakpoint(void); 36void arch_kgdb_breakpoint(void);
34 37
35#define BREAK_INSTR_SIZE 4 38#define BREAK_INSTR_SIZE 4
36#define CACHE_FLUSH_IS_SAFE 1 39#define CACHE_FLUSH_IS_SAFE 1
diff --git a/arch/sparc/include/asm/kprobes.h b/arch/sparc/include/asm/kprobes.h
index 5879d71afdaa..a145d798e112 100644
--- a/arch/sparc/include/asm/kprobes.h
+++ b/arch/sparc/include/asm/kprobes.h
@@ -43,7 +43,9 @@ struct kprobe_ctlblk {
43 struct prev_kprobe prev_kprobe; 43 struct prev_kprobe prev_kprobe;
44}; 44};
45 45
46extern int kprobe_exceptions_notify(struct notifier_block *self, 46int kprobe_exceptions_notify(struct notifier_block *self,
47 unsigned long val, void *data); 47 unsigned long val, void *data);
48extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 48int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
49asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
50 struct pt_regs *regs);
49#endif /* _SPARC64_KPROBES_H */ 51#endif /* _SPARC64_KPROBES_H */
diff --git a/arch/sparc/include/asm/ldc.h b/arch/sparc/include/asm/ldc.h
index bdb524a7b814..c8c67f621f4f 100644
--- a/arch/sparc/include/asm/ldc.h
+++ b/arch/sparc/include/asm/ldc.h
@@ -4,9 +4,9 @@
4#include <asm/hypervisor.h> 4#include <asm/hypervisor.h>
5 5
6extern int ldom_domaining_enabled; 6extern int ldom_domaining_enabled;
7extern void ldom_set_var(const char *var, const char *value); 7void ldom_set_var(const char *var, const char *value);
8extern void ldom_reboot(const char *boot_command); 8void ldom_reboot(const char *boot_command);
9extern void ldom_power_off(void); 9void ldom_power_off(void);
10 10
11/* The event handler will be evoked when link state changes 11/* The event handler will be evoked when link state changes
12 * or data becomes available on the receive side. 12 * or data becomes available on the receive side.
@@ -51,30 +51,30 @@ struct ldc_channel_config {
51struct ldc_channel; 51struct ldc_channel;
52 52
53/* Allocate state for a channel. */ 53/* Allocate state for a channel. */
54extern struct ldc_channel *ldc_alloc(unsigned long id, 54struct ldc_channel *ldc_alloc(unsigned long id,
55 const struct ldc_channel_config *cfgp, 55 const struct ldc_channel_config *cfgp,
56 void *event_arg); 56 void *event_arg);
57 57
58/* Shut down and free state for a channel. */ 58/* Shut down and free state for a channel. */
59extern void ldc_free(struct ldc_channel *lp); 59void ldc_free(struct ldc_channel *lp);
60 60
61/* Register TX and RX queues of the link with the hypervisor. */ 61/* Register TX and RX queues of the link with the hypervisor. */
62extern int ldc_bind(struct ldc_channel *lp, const char *name); 62int ldc_bind(struct ldc_channel *lp, const char *name);
63 63
64/* For non-RAW protocols we need to complete a handshake before 64/* For non-RAW protocols we need to complete a handshake before
65 * communication can proceed. ldc_connect() does that, if the 65 * communication can proceed. ldc_connect() does that, if the
66 * handshake completes successfully, an LDC_EVENT_UP event will 66 * handshake completes successfully, an LDC_EVENT_UP event will
67 * be sent up to the driver. 67 * be sent up to the driver.
68 */ 68 */
69extern int ldc_connect(struct ldc_channel *lp); 69int ldc_connect(struct ldc_channel *lp);
70extern int ldc_disconnect(struct ldc_channel *lp); 70int ldc_disconnect(struct ldc_channel *lp);
71 71
72extern int ldc_state(struct ldc_channel *lp); 72int ldc_state(struct ldc_channel *lp);
73 73
74/* Read and write operations. Only valid when the link is up. */ 74/* Read and write operations. Only valid when the link is up. */
75extern int ldc_write(struct ldc_channel *lp, const void *buf, 75int ldc_write(struct ldc_channel *lp, const void *buf,
76 unsigned int size); 76 unsigned int size);
77extern int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size); 77int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size);
78 78
79#define LDC_MAP_SHADOW 0x01 79#define LDC_MAP_SHADOW 0x01
80#define LDC_MAP_DIRECT 0x02 80#define LDC_MAP_DIRECT 0x02
@@ -92,22 +92,22 @@ struct ldc_trans_cookie {
92}; 92};
93 93
94struct scatterlist; 94struct scatterlist;
95extern int ldc_map_sg(struct ldc_channel *lp, 95int ldc_map_sg(struct ldc_channel *lp,
96 struct scatterlist *sg, int num_sg, 96 struct scatterlist *sg, int num_sg,
97 struct ldc_trans_cookie *cookies, int ncookies, 97 struct ldc_trans_cookie *cookies, int ncookies,
98 unsigned int map_perm); 98 unsigned int map_perm);
99 99
100extern int ldc_map_single(struct ldc_channel *lp, 100int ldc_map_single(struct ldc_channel *lp,
101 void *buf, unsigned int len, 101 void *buf, unsigned int len,
102 struct ldc_trans_cookie *cookies, int ncookies, 102 struct ldc_trans_cookie *cookies, int ncookies,
103 unsigned int map_perm); 103 unsigned int map_perm);
104 104
105extern void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies, 105void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies,
106 int ncookies); 106 int ncookies);
107 107
108extern int ldc_copy(struct ldc_channel *lp, int copy_dir, 108int ldc_copy(struct ldc_channel *lp, int copy_dir,
109 void *buf, unsigned int len, unsigned long offset, 109 void *buf, unsigned int len, unsigned long offset,
110 struct ldc_trans_cookie *cookies, int ncookies); 110 struct ldc_trans_cookie *cookies, int ncookies);
111 111
112static inline int ldc_get_dring_entry(struct ldc_channel *lp, 112static inline int ldc_get_dring_entry(struct ldc_channel *lp,
113 void *buf, unsigned int len, 113 void *buf, unsigned int len,
@@ -127,12 +127,12 @@ static inline int ldc_put_dring_entry(struct ldc_channel *lp,
127 return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies); 127 return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies);
128} 128}
129 129
130extern void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len, 130void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len,
131 struct ldc_trans_cookie *cookies, 131 struct ldc_trans_cookie *cookies,
132 int *ncookies, unsigned int map_perm); 132 int *ncookies, unsigned int map_perm);
133 133
134extern void ldc_free_exp_dring(struct ldc_channel *lp, void *buf, 134void ldc_free_exp_dring(struct ldc_channel *lp, void *buf,
135 unsigned int len, 135 unsigned int len,
136 struct ldc_trans_cookie *cookies, int ncookies); 136 struct ldc_trans_cookie *cookies, int ncookies);
137 137
138#endif /* _SPARC64_LDC_H */ 138#endif /* _SPARC64_LDC_H */
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index c2f6ff6d7a35..204771cd74a5 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -82,8 +82,8 @@ static inline unsigned long leon_load_reg(unsigned long paddr)
82#define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x)) 82#define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x))
83#define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v)) 83#define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v))
84 84
85extern void leon_switch_mm(void); 85void leon_switch_mm(void);
86extern void leon_init_IRQ(void); 86void leon_init_IRQ(void);
87 87
88static inline unsigned long sparc_leon3_get_dcachecfg(void) 88static inline unsigned long sparc_leon3_get_dcachecfg(void)
89{ 89{
@@ -196,14 +196,14 @@ static inline int sparc_leon3_cpuid(void)
196#ifndef __ASSEMBLY__ 196#ifndef __ASSEMBLY__
197struct vm_area_struct; 197struct vm_area_struct;
198 198
199extern unsigned long leon_swprobe(unsigned long vaddr, unsigned long *paddr); 199unsigned long leon_swprobe(unsigned long vaddr, unsigned long *paddr);
200extern void leon_flush_icache_all(void); 200void leon_flush_icache_all(void);
201extern void leon_flush_dcache_all(void); 201void leon_flush_dcache_all(void);
202extern void leon_flush_cache_all(void); 202void leon_flush_cache_all(void);
203extern void leon_flush_tlb_all(void); 203void leon_flush_tlb_all(void);
204extern int leon_flush_during_switch; 204extern int leon_flush_during_switch;
205extern int leon_flush_needed(void); 205int leon_flush_needed(void);
206extern void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page); 206void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page);
207 207
208/* struct that hold LEON3 cache configuration registers */ 208/* struct that hold LEON3 cache configuration registers */
209struct leon3_cacheregs { 209struct leon3_cacheregs {
@@ -217,29 +217,29 @@ struct leon3_cacheregs {
217 217
218struct device_node; 218struct device_node;
219struct task_struct; 219struct task_struct;
220extern unsigned int leon_build_device_irq(unsigned int real_irq, 220unsigned int leon_build_device_irq(unsigned int real_irq,
221 irq_flow_handler_t flow_handler, 221 irq_flow_handler_t flow_handler,
222 const char *name, int do_ack); 222 const char *name, int do_ack);
223extern void leon_update_virq_handling(unsigned int virq, 223void leon_update_virq_handling(unsigned int virq,
224 irq_flow_handler_t flow_handler, 224 irq_flow_handler_t flow_handler,
225 const char *name, int do_ack); 225 const char *name, int do_ack);
226extern void leon_init_timers(void); 226void leon_init_timers(void);
227extern void leon_trans_init(struct device_node *dp); 227void leon_trans_init(struct device_node *dp);
228extern void leon_node_init(struct device_node *dp, struct device_node ***nextp); 228void leon_node_init(struct device_node *dp, struct device_node ***nextp);
229extern void init_leon(void); 229void init_leon(void);
230extern void poke_leonsparc(void); 230void poke_leonsparc(void);
231extern void leon3_getCacheRegs(struct leon3_cacheregs *regs); 231void leon3_getCacheRegs(struct leon3_cacheregs *regs);
232extern int leon3_ticker_irq; 232extern int leon3_ticker_irq;
233 233
234#ifdef CONFIG_SMP 234#ifdef CONFIG_SMP
235extern int leon_smp_nrcpus(void); 235int leon_smp_nrcpus(void);
236extern void leon_clear_profile_irq(int cpu); 236void leon_clear_profile_irq(int cpu);
237extern void leon_smp_done(void); 237void leon_smp_done(void);
238extern void leon_boot_cpus(void); 238void leon_boot_cpus(void);
239extern int leon_boot_one_cpu(int i, struct task_struct *); 239int leon_boot_one_cpu(int i, struct task_struct *);
240void leon_init_smp(void); 240void leon_init_smp(void);
241void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu); 241void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu);
242extern irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused); 242irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused);
243 243
244extern unsigned int smpleon_ipi[]; 244extern unsigned int smpleon_ipi[];
245extern unsigned int linux_trap_ipi15_leon[]; 245extern unsigned int linux_trap_ipi15_leon[];
diff --git a/arch/sparc/include/asm/leon_pci.h b/arch/sparc/include/asm/leon_pci.h
index bfd3ab3092b5..049d067ed8be 100644
--- a/arch/sparc/include/asm/leon_pci.h
+++ b/arch/sparc/include/asm/leon_pci.h
@@ -16,7 +16,7 @@ struct leon_pci_info {
16 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); 16 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
17}; 17};
18 18
19extern void leon_pci_init(struct platform_device *ofdev, 19void leon_pci_init(struct platform_device *ofdev,
20 struct leon_pci_info *info); 20 struct leon_pci_info *info);
21 21
22#endif /* _ASM_LEON_PCI_H_ */ 22#endif /* _ASM_LEON_PCI_H_ */
diff --git a/arch/sparc/include/asm/mc146818rtc.h b/arch/sparc/include/asm/mc146818rtc.h
index 67ed9e3a0235..d8e72f37dc4b 100644
--- a/arch/sparc/include/asm/mc146818rtc.h
+++ b/arch/sparc/include/asm/mc146818rtc.h
@@ -1,5 +1,10 @@
1#ifndef ___ASM_SPARC_MC146818RTC_H 1#ifndef ___ASM_SPARC_MC146818RTC_H
2#define ___ASM_SPARC_MC146818RTC_H 2#define ___ASM_SPARC_MC146818RTC_H
3
4#include <linux/spinlock.h>
5
6extern spinlock_t rtc_lock;
7
3#if defined(__sparc__) && defined(__arch64__) 8#if defined(__sparc__) && defined(__arch64__)
4#include <asm/mc146818rtc_64.h> 9#include <asm/mc146818rtc_64.h>
5#else 10#else
diff --git a/arch/sparc/include/asm/mdesc.h b/arch/sparc/include/asm/mdesc.h
index 139097f3a67b..aebeb88f70db 100644
--- a/arch/sparc/include/asm/mdesc.h
+++ b/arch/sparc/include/asm/mdesc.h
@@ -12,13 +12,13 @@ struct mdesc_handle;
12 * the first argument to all of the operational calls that work 12 * the first argument to all of the operational calls that work
13 * on mdescs. 13 * on mdescs.
14 */ 14 */
15extern struct mdesc_handle *mdesc_grab(void); 15struct mdesc_handle *mdesc_grab(void);
16extern void mdesc_release(struct mdesc_handle *); 16void mdesc_release(struct mdesc_handle *);
17 17
18#define MDESC_NODE_NULL (~(u64)0) 18#define MDESC_NODE_NULL (~(u64)0)
19 19
20extern u64 mdesc_node_by_name(struct mdesc_handle *handle, 20u64 mdesc_node_by_name(struct mdesc_handle *handle,
21 u64 from_node, const char *name); 21 u64 from_node, const char *name);
22#define mdesc_for_each_node_by_name(__hdl, __node, __name) \ 22#define mdesc_for_each_node_by_name(__hdl, __node, __name) \
23 for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \ 23 for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
24 (__node) != MDESC_NODE_NULL; \ 24 (__node) != MDESC_NODE_NULL; \
@@ -34,9 +34,9 @@ extern u64 mdesc_node_by_name(struct mdesc_handle *handle,
34 * 34 *
35 * These same rules apply to mdesc_node_name(). 35 * These same rules apply to mdesc_node_name().
36 */ 36 */
37extern const void *mdesc_get_property(struct mdesc_handle *handle, 37const void *mdesc_get_property(struct mdesc_handle *handle,
38 u64 node, const char *name, int *lenp); 38 u64 node, const char *name, int *lenp);
39extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node); 39const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
40 40
41/* MD arc iteration, the standard sequence is: 41/* MD arc iteration, the standard sequence is:
42 * 42 *
@@ -50,16 +50,16 @@ extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
50#define MDESC_ARC_TYPE_FWD "fwd" 50#define MDESC_ARC_TYPE_FWD "fwd"
51#define MDESC_ARC_TYPE_BACK "back" 51#define MDESC_ARC_TYPE_BACK "back"
52 52
53extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from, 53u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
54 const char *arc_type); 54 const char *arc_type);
55#define mdesc_for_each_arc(__arc, __hdl, __node, __type) \ 55#define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
56 for (__arc = mdesc_next_arc(__hdl, __node, __type); \ 56 for (__arc = mdesc_next_arc(__hdl, __node, __type); \
57 (__arc) != MDESC_NODE_NULL; \ 57 (__arc) != MDESC_NODE_NULL; \
58 __arc = mdesc_next_arc(__hdl, __arc, __type)) 58 __arc = mdesc_next_arc(__hdl, __arc, __type))
59 59
60extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); 60u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
61 61
62extern void mdesc_update(void); 62void mdesc_update(void);
63 63
64struct mdesc_notifier_client { 64struct mdesc_notifier_client {
65 void (*add)(struct mdesc_handle *handle, u64 node); 65 void (*add)(struct mdesc_handle *handle, u64 node);
@@ -69,12 +69,12 @@ struct mdesc_notifier_client {
69 struct mdesc_notifier_client *next; 69 struct mdesc_notifier_client *next;
70}; 70};
71 71
72extern void mdesc_register_notifier(struct mdesc_notifier_client *client); 72void mdesc_register_notifier(struct mdesc_notifier_client *client);
73 73
74extern void mdesc_fill_in_cpu_data(cpumask_t *mask); 74void mdesc_fill_in_cpu_data(cpumask_t *mask);
75extern void mdesc_populate_present_mask(cpumask_t *mask); 75void mdesc_populate_present_mask(cpumask_t *mask);
76extern void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask); 76void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask);
77 77
78extern void sun4v_mdesc_init(void); 78void sun4v_mdesc_init(void);
79 79
80#endif 80#endif
diff --git a/arch/sparc/include/asm/mmu_64.h b/arch/sparc/include/asm/mmu_64.h
index f668797ae234..70067ce184b1 100644
--- a/arch/sparc/include/asm/mmu_64.h
+++ b/arch/sparc/include/asm/mmu_64.h
@@ -67,9 +67,9 @@ struct tsb {
67 unsigned long pte; 67 unsigned long pte;
68} __attribute__((aligned(TSB_ENTRY_ALIGNMENT))); 68} __attribute__((aligned(TSB_ENTRY_ALIGNMENT)));
69 69
70extern void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte); 70void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte);
71extern void tsb_flush(unsigned long ent, unsigned long tag); 71void tsb_flush(unsigned long ent, unsigned long tag);
72extern void tsb_init(struct tsb *tsb, unsigned long size); 72void tsb_init(struct tsb *tsb, unsigned long size);
73 73
74struct tsb_config { 74struct tsb_config {
75 struct tsb *tsb; 75 struct tsb *tsb;
diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h
index 3d528f06e4b0..b84be675e507 100644
--- a/arch/sparc/include/asm/mmu_context_64.h
+++ b/arch/sparc/include/asm/mmu_context_64.h
@@ -17,20 +17,20 @@ extern spinlock_t ctx_alloc_lock;
17extern unsigned long tlb_context_cache; 17extern unsigned long tlb_context_cache;
18extern unsigned long mmu_context_bmap[]; 18extern unsigned long mmu_context_bmap[];
19 19
20extern void get_new_mmu_context(struct mm_struct *mm); 20void get_new_mmu_context(struct mm_struct *mm);
21#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
22extern void smp_new_mmu_context_version(void); 22void smp_new_mmu_context_version(void);
23#else 23#else
24#define smp_new_mmu_context_version() do { } while (0) 24#define smp_new_mmu_context_version() do { } while (0)
25#endif 25#endif
26 26
27extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); 27int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
28extern void destroy_context(struct mm_struct *mm); 28void destroy_context(struct mm_struct *mm);
29 29
30extern void __tsb_context_switch(unsigned long pgd_pa, 30void __tsb_context_switch(unsigned long pgd_pa,
31 struct tsb_config *tsb_base, 31 struct tsb_config *tsb_base,
32 struct tsb_config *tsb_huge, 32 struct tsb_config *tsb_huge,
33 unsigned long tsb_descr_pa); 33 unsigned long tsb_descr_pa);
34 34
35static inline void tsb_context_switch(struct mm_struct *mm) 35static inline void tsb_context_switch(struct mm_struct *mm)
36{ 36{
@@ -46,9 +46,11 @@ static inline void tsb_context_switch(struct mm_struct *mm)
46 , __pa(&mm->context.tsb_descr[0])); 46 , __pa(&mm->context.tsb_descr[0]));
47} 47}
48 48
49extern void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long mm_rss); 49void tsb_grow(struct mm_struct *mm,
50 unsigned long tsb_index,
51 unsigned long mm_rss);
50#ifdef CONFIG_SMP 52#ifdef CONFIG_SMP
51extern void smp_tsb_sync(struct mm_struct *mm); 53void smp_tsb_sync(struct mm_struct *mm);
52#else 54#else
53#define smp_tsb_sync(__mm) do { } while (0) 55#define smp_tsb_sync(__mm) do { } while (0)
54#endif 56#endif
@@ -66,7 +68,7 @@ extern void smp_tsb_sync(struct mm_struct *mm);
66 : "r" (CTX_HWBITS((__mm)->context)), \ 68 : "r" (CTX_HWBITS((__mm)->context)), \
67 "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU)) 69 "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU))
68 70
69extern void __flush_tlb_mm(unsigned long, unsigned long); 71void __flush_tlb_mm(unsigned long, unsigned long);
70 72
71/* Switch the current MM context. */ 73/* Switch the current MM context. */
72static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) 74static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk)
diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h
index 72e6500e7ab0..26ad2b2607c6 100644
--- a/arch/sparc/include/asm/nmi.h
+++ b/arch/sparc/include/asm/nmi.h
@@ -1,13 +1,13 @@
1#ifndef __NMI_H 1#ifndef __NMI_H
2#define __NMI_H 2#define __NMI_H
3 3
4extern int __init nmi_init(void); 4int __init nmi_init(void);
5extern void perfctr_irq(int irq, struct pt_regs *regs); 5void perfctr_irq(int irq, struct pt_regs *regs);
6extern void nmi_adjust_hz(unsigned int new_hz); 6void nmi_adjust_hz(unsigned int new_hz);
7 7
8extern atomic_t nmi_active; 8extern atomic_t nmi_active;
9 9
10extern void start_nmi_watchdog(void *unused); 10void start_nmi_watchdog(void *unused);
11extern void stop_nmi_watchdog(void *unused); 11void stop_nmi_watchdog(void *unused);
12 12
13#endif /* __NMI_H */ 13#endif /* __NMI_H */
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h
index c72f3045820c..56a09b9d7b1b 100644
--- a/arch/sparc/include/asm/oplib_32.h
+++ b/arch/sparc/include/asm/oplib_32.h
@@ -43,28 +43,28 @@ extern struct linux_nodeops *prom_nodeops;
43/* You must call prom_init() before using any of the library services, 43/* You must call prom_init() before using any of the library services,
44 * preferably as early as possible. Pass it the romvec pointer. 44 * preferably as early as possible. Pass it the romvec pointer.
45 */ 45 */
46extern void prom_init(struct linux_romvec *rom_ptr); 46void prom_init(struct linux_romvec *rom_ptr);
47 47
48/* Boot argument acquisition, returns the boot command line string. */ 48/* Boot argument acquisition, returns the boot command line string. */
49extern char *prom_getbootargs(void); 49char *prom_getbootargs(void);
50 50
51/* Miscellaneous routines, don't really fit in any category per se. */ 51/* Miscellaneous routines, don't really fit in any category per se. */
52 52
53/* Reboot the machine with the command line passed. */ 53/* Reboot the machine with the command line passed. */
54extern void prom_reboot(char *boot_command); 54void prom_reboot(char *boot_command);
55 55
56/* Evaluate the forth string passed. */ 56/* Evaluate the forth string passed. */
57extern void prom_feval(char *forth_string); 57void prom_feval(char *forth_string);
58 58
59/* Enter the prom, with possibility of continuation with the 'go' 59/* Enter the prom, with possibility of continuation with the 'go'
60 * command in newer proms. 60 * command in newer proms.
61 */ 61 */
62extern void prom_cmdline(void); 62void prom_cmdline(void);
63 63
64/* Enter the prom, with no chance of continuation for the stand-alone 64/* Enter the prom, with no chance of continuation for the stand-alone
65 * which calls this. 65 * which calls this.
66 */ 66 */
67extern void __noreturn prom_halt(void); 67void __noreturn prom_halt(void);
68 68
69/* Set the PROM 'sync' callback function to the passed function pointer. 69/* Set the PROM 'sync' callback function to the passed function pointer.
70 * When the user gives the 'sync' command at the prom prompt while the 70 * When the user gives the 'sync' command at the prom prompt while the
@@ -73,37 +73,37 @@ extern void __noreturn prom_halt(void);
73 * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX 73 * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX
74 */ 74 */
75typedef void (*sync_func_t)(void); 75typedef void (*sync_func_t)(void);
76extern void prom_setsync(sync_func_t func_ptr); 76void prom_setsync(sync_func_t func_ptr);
77 77
78/* Acquire the IDPROM of the root node in the prom device tree. This 78/* Acquire the IDPROM of the root node in the prom device tree. This
79 * gets passed a buffer where you would like it stuffed. The return value 79 * gets passed a buffer where you would like it stuffed. The return value
80 * is the format type of this idprom or 0xff on error. 80 * is the format type of this idprom or 0xff on error.
81 */ 81 */
82extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); 82unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);
83 83
84/* Get the prom major version. */ 84/* Get the prom major version. */
85extern int prom_version(void); 85int prom_version(void);
86 86
87/* Get the prom plugin revision. */ 87/* Get the prom plugin revision. */
88extern int prom_getrev(void); 88int prom_getrev(void);
89 89
90/* Get the prom firmware revision. */ 90/* Get the prom firmware revision. */
91extern int prom_getprev(void); 91int prom_getprev(void);
92 92
93/* Write a buffer of characters to the console. */ 93/* Write a buffer of characters to the console. */
94extern void prom_console_write_buf(const char *buf, int len); 94void prom_console_write_buf(const char *buf, int len);
95 95
96/* Prom's internal routines, don't use in kernel/boot code. */ 96/* Prom's internal routines, don't use in kernel/boot code. */
97extern __printf(1, 2) void prom_printf(const char *fmt, ...); 97__printf(1, 2) void prom_printf(const char *fmt, ...);
98extern void prom_write(const char *buf, unsigned int len); 98void prom_write(const char *buf, unsigned int len);
99 99
100/* Multiprocessor operations... */ 100/* Multiprocessor operations... */
101 101
102/* Start the CPU with the given device tree node, context table, and context 102/* Start the CPU with the given device tree node, context table, and context
103 * at the passed program counter. 103 * at the passed program counter.
104 */ 104 */
105extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, 105int prom_startcpu(int cpunode, struct linux_prom_registers *context_table,
106 int context, char *program_counter); 106 int context, char *program_counter);
107 107
108/* Initialize the memory lists based upon the prom version. */ 108/* Initialize the memory lists based upon the prom version. */
109void prom_meminit(void); 109void prom_meminit(void);
@@ -111,65 +111,65 @@ void prom_meminit(void);
111/* PROM device tree traversal functions... */ 111/* PROM device tree traversal functions... */
112 112
113/* Get the child node of the given node, or zero if no child exists. */ 113/* Get the child node of the given node, or zero if no child exists. */
114extern phandle prom_getchild(phandle parent_node); 114phandle prom_getchild(phandle parent_node);
115 115
116/* Get the next sibling node of the given node, or zero if no further 116/* Get the next sibling node of the given node, or zero if no further
117 * siblings exist. 117 * siblings exist.
118 */ 118 */
119extern phandle prom_getsibling(phandle node); 119phandle prom_getsibling(phandle node);
120 120
121/* Get the length, at the passed node, of the given property type. 121/* Get the length, at the passed node, of the given property type.
122 * Returns -1 on error (ie. no such property at this node). 122 * Returns -1 on error (ie. no such property at this node).
123 */ 123 */
124extern int prom_getproplen(phandle thisnode, const char *property); 124int prom_getproplen(phandle thisnode, const char *property);
125 125
126/* Fetch the requested property using the given buffer. Returns 126/* Fetch the requested property using the given buffer. Returns
127 * the number of bytes the prom put into your buffer or -1 on error. 127 * the number of bytes the prom put into your buffer or -1 on error.
128 */ 128 */
129extern int __must_check prom_getproperty(phandle thisnode, const char *property, 129int __must_check prom_getproperty(phandle thisnode, const char *property,
130 char *prop_buffer, int propbuf_size); 130 char *prop_buffer, int propbuf_size);
131 131
132/* Acquire an integer property. */ 132/* Acquire an integer property. */
133extern int prom_getint(phandle node, char *property); 133int prom_getint(phandle node, char *property);
134 134
135/* Acquire an integer property, with a default value. */ 135/* Acquire an integer property, with a default value. */
136extern int prom_getintdefault(phandle node, char *property, int defval); 136int prom_getintdefault(phandle node, char *property, int defval);
137 137
138/* Acquire a boolean property, 0=FALSE 1=TRUE. */ 138/* Acquire a boolean property, 0=FALSE 1=TRUE. */
139extern int prom_getbool(phandle node, char *prop); 139int prom_getbool(phandle node, char *prop);
140 140
141/* Acquire a string property, null string on error. */ 141/* Acquire a string property, null string on error. */
142extern void prom_getstring(phandle node, char *prop, char *buf, int bufsize); 142void prom_getstring(phandle node, char *prop, char *buf, int bufsize);
143 143
144/* Search all siblings starting at the passed node for "name" matching 144/* Search all siblings starting at the passed node for "name" matching
145 * the given string. Returns the node on success, zero on failure. 145 * the given string. Returns the node on success, zero on failure.
146 */ 146 */
147extern phandle prom_searchsiblings(phandle node_start, char *name); 147phandle prom_searchsiblings(phandle node_start, char *name);
148 148
149/* Returns the next property after the passed property for the given 149/* Returns the next property after the passed property for the given
150 * node. Returns null string on failure. 150 * node. Returns null string on failure.
151 */ 151 */
152extern char *prom_nextprop(phandle node, char *prev_property, char *buffer); 152char *prom_nextprop(phandle node, char *prev_property, char *buffer);
153 153
154/* Returns phandle of the path specified */ 154/* Returns phandle of the path specified */
155extern phandle prom_finddevice(char *name); 155phandle prom_finddevice(char *name);
156 156
157/* Set the indicated property at the given node with the passed value. 157/* Set the indicated property at the given node with the passed value.
158 * Returns the number of bytes of your value that the prom took. 158 * Returns the number of bytes of your value that the prom took.
159 */ 159 */
160extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, 160int prom_setprop(phandle node, const char *prop_name, char *prop_value,
161 int value_size); 161 int value_size);
162 162
163extern phandle prom_inst2pkg(int); 163phandle prom_inst2pkg(int);
164 164
165/* Dorking with Bus ranges... */ 165/* Dorking with Bus ranges... */
166 166
167/* Apply promlib probes OBIO ranges to registers. */ 167/* Apply promlib probes OBIO ranges to registers. */
168extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); 168void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);
169 169
170/* Apply ranges of any prom node (and optionally parent node as well) to registers. */ 170/* Apply ranges of any prom node (and optionally parent node as well) to registers. */
171extern void prom_apply_generic_ranges(phandle node, phandle parent, 171void prom_apply_generic_ranges(phandle node, phandle parent,
172 struct linux_prom_registers *sbusregs, int nregs); 172 struct linux_prom_registers *sbusregs, int nregs);
173 173
174void prom_ranges_init(void); 174void prom_ranges_init(void);
175 175
diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h
index a12dbe3b7762..f34682430fcf 100644
--- a/arch/sparc/include/asm/oplib_64.h
+++ b/arch/sparc/include/asm/oplib_64.h
@@ -62,100 +62,100 @@ struct linux_mem_p1275 {
62/* You must call prom_init() before using any of the library services, 62/* You must call prom_init() before using any of the library services,
63 * preferably as early as possible. Pass it the romvec pointer. 63 * preferably as early as possible. Pass it the romvec pointer.
64 */ 64 */
65extern void prom_init(void *cif_handler, void *cif_stack); 65void prom_init(void *cif_handler, void *cif_stack);
66 66
67/* Boot argument acquisition, returns the boot command line string. */ 67/* Boot argument acquisition, returns the boot command line string. */
68extern char *prom_getbootargs(void); 68char *prom_getbootargs(void);
69 69
70/* Miscellaneous routines, don't really fit in any category per se. */ 70/* Miscellaneous routines, don't really fit in any category per se. */
71 71
72/* Reboot the machine with the command line passed. */ 72/* Reboot the machine with the command line passed. */
73extern void prom_reboot(const char *boot_command); 73void prom_reboot(const char *boot_command);
74 74
75/* Evaluate the forth string passed. */ 75/* Evaluate the forth string passed. */
76extern void prom_feval(const char *forth_string); 76void prom_feval(const char *forth_string);
77 77
78/* Enter the prom, with possibility of continuation with the 'go' 78/* Enter the prom, with possibility of continuation with the 'go'
79 * command in newer proms. 79 * command in newer proms.
80 */ 80 */
81extern void prom_cmdline(void); 81void prom_cmdline(void);
82 82
83/* Enter the prom, with no chance of continuation for the stand-alone 83/* Enter the prom, with no chance of continuation for the stand-alone
84 * which calls this. 84 * which calls this.
85 */ 85 */
86extern void prom_halt(void) __attribute__ ((noreturn)); 86void prom_halt(void) __attribute__ ((noreturn));
87 87
88/* Halt and power-off the machine. */ 88/* Halt and power-off the machine. */
89extern void prom_halt_power_off(void) __attribute__ ((noreturn)); 89void prom_halt_power_off(void) __attribute__ ((noreturn));
90 90
91/* Acquire the IDPROM of the root node in the prom device tree. This 91/* Acquire the IDPROM of the root node in the prom device tree. This
92 * gets passed a buffer where you would like it stuffed. The return value 92 * gets passed a buffer where you would like it stuffed. The return value
93 * is the format type of this idprom or 0xff on error. 93 * is the format type of this idprom or 0xff on error.
94 */ 94 */
95extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); 95unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);
96 96
97/* Write a buffer of characters to the console. */ 97/* Write a buffer of characters to the console. */
98extern void prom_console_write_buf(const char *buf, int len); 98void prom_console_write_buf(const char *buf, int len);
99 99
100/* Prom's internal routines, don't use in kernel/boot code. */ 100/* Prom's internal routines, don't use in kernel/boot code. */
101extern __printf(1, 2) void prom_printf(const char *fmt, ...); 101__printf(1, 2) void prom_printf(const char *fmt, ...);
102extern void prom_write(const char *buf, unsigned int len); 102void prom_write(const char *buf, unsigned int len);
103 103
104/* Multiprocessor operations... */ 104/* Multiprocessor operations... */
105#ifdef CONFIG_SMP 105#ifdef CONFIG_SMP
106/* Start the CPU with the given device tree node at the passed program 106/* Start the CPU with the given device tree node at the passed program
107 * counter with the given arg passed in via register %o0. 107 * counter with the given arg passed in via register %o0.
108 */ 108 */
109extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg); 109void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg);
110 110
111/* Start the CPU with the given cpu ID at the passed program 111/* Start the CPU with the given cpu ID at the passed program
112 * counter with the given arg passed in via register %o0. 112 * counter with the given arg passed in via register %o0.
113 */ 113 */
114extern void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg); 114void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg);
115 115
116/* Stop the CPU with the given cpu ID. */ 116/* Stop the CPU with the given cpu ID. */
117extern void prom_stopcpu_cpuid(int cpuid); 117void prom_stopcpu_cpuid(int cpuid);
118 118
119/* Stop the current CPU. */ 119/* Stop the current CPU. */
120extern void prom_stopself(void); 120void prom_stopself(void);
121 121
122/* Idle the current CPU. */ 122/* Idle the current CPU. */
123extern void prom_idleself(void); 123void prom_idleself(void);
124 124
125/* Resume the CPU with the passed device tree node. */ 125/* Resume the CPU with the passed device tree node. */
126extern void prom_resumecpu(int cpunode); 126void prom_resumecpu(int cpunode);
127#endif 127#endif
128 128
129/* Power management interfaces. */ 129/* Power management interfaces. */
130 130
131/* Put the current CPU to sleep. */ 131/* Put the current CPU to sleep. */
132extern void prom_sleepself(void); 132void prom_sleepself(void);
133 133
134/* Put the entire system to sleep. */ 134/* Put the entire system to sleep. */
135extern int prom_sleepsystem(void); 135int prom_sleepsystem(void);
136 136
137/* Initiate a wakeup event. */ 137/* Initiate a wakeup event. */
138extern int prom_wakeupsystem(void); 138int prom_wakeupsystem(void);
139 139
140/* MMU and memory related OBP interfaces. */ 140/* MMU and memory related OBP interfaces. */
141 141
142/* Get unique string identifying SIMM at given physical address. */ 142/* Get unique string identifying SIMM at given physical address. */
143extern int prom_getunumber(int syndrome_code, 143int prom_getunumber(int syndrome_code,
144 unsigned long phys_addr, 144 unsigned long phys_addr,
145 char *buf, int buflen); 145 char *buf, int buflen);
146 146
147/* Retain physical memory to the caller across soft resets. */ 147/* Retain physical memory to the caller across soft resets. */
148extern int prom_retain(const char *name, unsigned long size, 148int prom_retain(const char *name, unsigned long size,
149 unsigned long align, unsigned long *paddr); 149 unsigned long align, unsigned long *paddr);
150 150
151/* Load explicit I/D TLB entries into the calling processor. */ 151/* Load explicit I/D TLB entries into the calling processor. */
152extern long prom_itlb_load(unsigned long index, 152long prom_itlb_load(unsigned long index,
153 unsigned long tte_data, 153 unsigned long tte_data,
154 unsigned long vaddr); 154 unsigned long vaddr);
155 155
156extern long prom_dtlb_load(unsigned long index, 156long prom_dtlb_load(unsigned long index,
157 unsigned long tte_data, 157 unsigned long tte_data,
158 unsigned long vaddr); 158 unsigned long vaddr);
159 159
160/* Map/Unmap client program address ranges. First the format of 160/* Map/Unmap client program address ranges. First the format of
161 * the mapping mode argument. 161 * the mapping mode argument.
@@ -170,81 +170,81 @@ extern long prom_dtlb_load(unsigned long index,
170#define PROM_MAP_IE 0x0100 /* Invert-Endianness */ 170#define PROM_MAP_IE 0x0100 /* Invert-Endianness */
171#define PROM_MAP_DEFAULT (PROM_MAP_WRITE | PROM_MAP_READ | PROM_MAP_EXEC | PROM_MAP_CACHED) 171#define PROM_MAP_DEFAULT (PROM_MAP_WRITE | PROM_MAP_READ | PROM_MAP_EXEC | PROM_MAP_CACHED)
172 172
173extern int prom_map(int mode, unsigned long size, 173int prom_map(int mode, unsigned long size,
174 unsigned long vaddr, unsigned long paddr); 174 unsigned long vaddr, unsigned long paddr);
175extern void prom_unmap(unsigned long size, unsigned long vaddr); 175void prom_unmap(unsigned long size, unsigned long vaddr);
176 176
177 177
178/* PROM device tree traversal functions... */ 178/* PROM device tree traversal functions... */
179 179
180/* Get the child node of the given node, or zero if no child exists. */ 180/* Get the child node of the given node, or zero if no child exists. */
181extern phandle prom_getchild(phandle parent_node); 181phandle prom_getchild(phandle parent_node);
182 182
183/* Get the next sibling node of the given node, or zero if no further 183/* Get the next sibling node of the given node, or zero if no further
184 * siblings exist. 184 * siblings exist.
185 */ 185 */
186extern phandle prom_getsibling(phandle node); 186phandle prom_getsibling(phandle node);
187 187
188/* Get the length, at the passed node, of the given property type. 188/* Get the length, at the passed node, of the given property type.
189 * Returns -1 on error (ie. no such property at this node). 189 * Returns -1 on error (ie. no such property at this node).
190 */ 190 */
191extern int prom_getproplen(phandle thisnode, const char *property); 191int prom_getproplen(phandle thisnode, const char *property);
192 192
193/* Fetch the requested property using the given buffer. Returns 193/* Fetch the requested property using the given buffer. Returns
194 * the number of bytes the prom put into your buffer or -1 on error. 194 * the number of bytes the prom put into your buffer or -1 on error.
195 */ 195 */
196extern int prom_getproperty(phandle thisnode, const char *property, 196int prom_getproperty(phandle thisnode, const char *property,
197 char *prop_buffer, int propbuf_size); 197 char *prop_buffer, int propbuf_size);
198 198
199/* Acquire an integer property. */ 199/* Acquire an integer property. */
200extern int prom_getint(phandle node, const char *property); 200int prom_getint(phandle node, const char *property);
201 201
202/* Acquire an integer property, with a default value. */ 202/* Acquire an integer property, with a default value. */
203extern int prom_getintdefault(phandle node, const char *property, int defval); 203int prom_getintdefault(phandle node, const char *property, int defval);
204 204
205/* Acquire a boolean property, 0=FALSE 1=TRUE. */ 205/* Acquire a boolean property, 0=FALSE 1=TRUE. */
206extern int prom_getbool(phandle node, const char *prop); 206int prom_getbool(phandle node, const char *prop);
207 207
208/* Acquire a string property, null string on error. */ 208/* Acquire a string property, null string on error. */
209extern void prom_getstring(phandle node, const char *prop, char *buf, 209void prom_getstring(phandle node, const char *prop, char *buf,
210 int bufsize); 210 int bufsize);
211 211
212/* Does the passed node have the given "name"? YES=1 NO=0 */ 212/* Does the passed node have the given "name"? YES=1 NO=0 */
213extern int prom_nodematch(phandle thisnode, const char *name); 213int prom_nodematch(phandle thisnode, const char *name);
214 214
215/* Search all siblings starting at the passed node for "name" matching 215/* Search all siblings starting at the passed node for "name" matching
216 * the given string. Returns the node on success, zero on failure. 216 * the given string. Returns the node on success, zero on failure.
217 */ 217 */
218extern phandle prom_searchsiblings(phandle node_start, const char *name); 218phandle prom_searchsiblings(phandle node_start, const char *name);
219 219
220/* Return the first property type, as a string, for the given node. 220/* Return the first property type, as a string, for the given node.
221 * Returns a null string on error. Buffer should be at least 32B long. 221 * Returns a null string on error. Buffer should be at least 32B long.
222 */ 222 */
223extern char *prom_firstprop(phandle node, char *buffer); 223char *prom_firstprop(phandle node, char *buffer);
224 224
225/* Returns the next property after the passed property for the given 225/* Returns the next property after the passed property for the given
226 * node. Returns null string on failure. Buffer should be at least 32B long. 226 * node. Returns null string on failure. Buffer should be at least 32B long.
227 */ 227 */
228extern char *prom_nextprop(phandle node, const char *prev_property, char *buf); 228char *prom_nextprop(phandle node, const char *prev_property, char *buf);
229 229
230/* Returns 1 if the specified node has given property. */ 230/* Returns 1 if the specified node has given property. */
231extern int prom_node_has_property(phandle node, const char *property); 231int prom_node_has_property(phandle node, const char *property);
232 232
233/* Returns phandle of the path specified */ 233/* Returns phandle of the path specified */
234extern phandle prom_finddevice(const char *name); 234phandle prom_finddevice(const char *name);
235 235
236/* Set the indicated property at the given node with the passed value. 236/* Set the indicated property at the given node with the passed value.
237 * Returns the number of bytes of your value that the prom took. 237 * Returns the number of bytes of your value that the prom took.
238 */ 238 */
239extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, 239int prom_setprop(phandle node, const char *prop_name, char *prop_value,
240 int value_size); 240 int value_size);
241 241
242extern phandle prom_inst2pkg(int); 242phandle prom_inst2pkg(int);
243extern void prom_sun4v_guest_soft_state(void); 243void prom_sun4v_guest_soft_state(void);
244 244
245extern int prom_ihandle2path(int handle, char *buffer, int bufsize); 245int prom_ihandle2path(int handle, char *buffer, int bufsize);
246 246
247/* Client interface level routines. */ 247/* Client interface level routines. */
248extern void p1275_cmd_direct(unsigned long *); 248void p1275_cmd_direct(unsigned long *);
249 249
250#endif /* !(__SPARC64_OPLIB_H) */ 250#endif /* !(__SPARC64_OPLIB_H) */
diff --git a/arch/sparc/include/asm/page.h b/arch/sparc/include/asm/page.h
index f21de0349025..1be2fdec6268 100644
--- a/arch/sparc/include/asm/page.h
+++ b/arch/sparc/include/asm/page.h
@@ -1,5 +1,8 @@
1#ifndef ___ASM_SPARC_PAGE_H 1#ifndef ___ASM_SPARC_PAGE_H
2#define ___ASM_SPARC_PAGE_H 2#define ___ASM_SPARC_PAGE_H
3
4#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
5
3#if defined(__sparc__) && defined(__arch64__) 6#if defined(__sparc__) && defined(__arch64__)
4#include <asm/page_64.h> 7#include <asm/page_64.h>
5#else 8#else
diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h
index aac53fcea807..bf109984a032 100644
--- a/arch/sparc/include/asm/page_64.h
+++ b/arch/sparc/include/asm/page_64.h
@@ -31,17 +31,17 @@
31 31
32#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) 32#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
33struct pt_regs; 33struct pt_regs;
34extern void hugetlb_setup(struct pt_regs *regs); 34void hugetlb_setup(struct pt_regs *regs);
35#endif 35#endif
36 36
37#define WANT_PAGE_VIRTUAL 37#define WANT_PAGE_VIRTUAL
38 38
39extern void _clear_page(void *page); 39void _clear_page(void *page);
40#define clear_page(X) _clear_page((void *)(X)) 40#define clear_page(X) _clear_page((void *)(X))
41struct page; 41struct page;
42extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page); 42void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
43#define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE) 43#define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
44extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage); 44void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage);
45 45
46/* Unlike sparc32, sparc64's parameter passing API is more 46/* Unlike sparc32, sparc64's parameter passing API is more
47 * sane in that structures which as small enough are passed 47 * sane in that structures which as small enough are passed
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index c6c7396e7627..bd00a6226169 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -52,7 +52,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
52 52
53/* Return the index of the PCI controller for device PDEV. */ 53/* Return the index of the PCI controller for device PDEV. */
54 54
55extern int pci_domain_nr(struct pci_bus *bus); 55int pci_domain_nr(struct pci_bus *bus);
56static inline int pci_proc_domain(struct pci_bus *bus) 56static inline int pci_proc_domain(struct pci_bus *bus)
57{ 57{
58 return 1; 58 return 1;
@@ -64,9 +64,9 @@ static inline int pci_proc_domain(struct pci_bus *bus)
64#define HAVE_ARCH_PCI_GET_UNMAPPED_AREA 64#define HAVE_ARCH_PCI_GET_UNMAPPED_AREA
65#define get_pci_unmapped_area get_fb_unmapped_area 65#define get_pci_unmapped_area get_fb_unmapped_area
66 66
67extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 67int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
68 enum pci_mmap_state mmap_state, 68 enum pci_mmap_state mmap_state,
69 int write_combine); 69 int write_combine);
70 70
71static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 71static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
72{ 72{
@@ -74,9 +74,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
74} 74}
75 75
76#define HAVE_ARCH_PCI_RESOURCE_TO_USER 76#define HAVE_ARCH_PCI_RESOURCE_TO_USER
77extern void pci_resource_to_user(const struct pci_dev *dev, int bar, 77void pci_resource_to_user(const struct pci_dev *dev, int bar,
78 const struct resource *rsrc, 78 const struct resource *rsrc,
79 resource_size_t *start, resource_size_t *end); 79 resource_size_t *start, resource_size_t *end);
80#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
81 81
82#endif /* __SPARC64_PCI_H */ 82#endif /* __SPARC64_PCI_H */
diff --git a/arch/sparc/include/asm/pcic.h b/arch/sparc/include/asm/pcic.h
index 6676cbcc8b6a..f41706792592 100644
--- a/arch/sparc/include/asm/pcic.h
+++ b/arch/sparc/include/asm/pcic.h
@@ -30,10 +30,10 @@ struct linux_pcic {
30}; 30};
31 31
32#ifdef CONFIG_PCIC_PCI 32#ifdef CONFIG_PCIC_PCI
33extern int pcic_present(void); 33int pcic_present(void);
34extern int pcic_probe(void); 34int pcic_probe(void);
35extern void pci_time_init(void); 35void pci_time_init(void);
36extern void sun4m_pci_init_IRQ(void); 36void sun4m_pci_init_IRQ(void);
37#else 37#else
38static inline int pcic_present(void) { return 0; } 38static inline int pcic_present(void) { return 0; }
39static inline int pcic_probe(void) { return 0; } 39static inline int pcic_probe(void) { return 0; }
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h
index 942bb17f60cd..cdf800c3326c 100644
--- a/arch/sparc/include/asm/pcr.h
+++ b/arch/sparc/include/asm/pcr.h
@@ -12,8 +12,8 @@ struct pcr_ops {
12}; 12};
13extern const struct pcr_ops *pcr_ops; 13extern const struct pcr_ops *pcr_ops;
14 14
15extern void deferred_pcr_work_irq(int irq, struct pt_regs *regs); 15void deferred_pcr_work_irq(int irq, struct pt_regs *regs);
16extern void schedule_deferred_pcr_work(void); 16void schedule_deferred_pcr_work(void);
17 17
18#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */ 18#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */
19#define PCR_STRACE 0x00000002 /* Trace supervisor events */ 19#define PCR_STRACE 0x00000002 /* Trace supervisor events */
@@ -45,6 +45,6 @@ extern void schedule_deferred_pcr_work(void);
45#define PCR_N4_PICNHT 0x00020000 /* PIC non-hypervisor trap */ 45#define PCR_N4_PICNHT 0x00020000 /* PIC non-hypervisor trap */
46#define PCR_N4_NTC 0x00040000 /* Next-To-Commit wrap */ 46#define PCR_N4_NTC 0x00040000 /* Next-To-Commit wrap */
47 47
48extern int pcr_arch_init(void); 48int pcr_arch_init(void);
49 49
50#endif /* __PCR_H */ 50#endif /* __PCR_H */
diff --git a/arch/sparc/include/asm/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h
index 9b1c36de0f18..a3890da94428 100644
--- a/arch/sparc/include/asm/pgalloc_32.h
+++ b/arch/sparc/include/asm/pgalloc_32.h
@@ -14,6 +14,8 @@ struct page;
14void *srmmu_get_nocache(int size, int align); 14void *srmmu_get_nocache(int size, int align);
15void srmmu_free_nocache(void *addr, int size); 15void srmmu_free_nocache(void *addr, int size);
16 16
17extern struct resource sparc_iomap;
18
17#define check_pgt_cache() do { } while (0) 19#define check_pgt_cache() do { } while (0)
18 20
19pgd_t *get_pgd_fast(void); 21pgd_t *get_pgd_fast(void);
diff --git a/arch/sparc/include/asm/pgalloc_64.h b/arch/sparc/include/asm/pgalloc_64.h
index bcfe063bce23..39a7ac49b00c 100644
--- a/arch/sparc/include/asm/pgalloc_64.h
+++ b/arch/sparc/include/asm/pgalloc_64.h
@@ -38,12 +38,12 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
38 kmem_cache_free(pgtable_cache, pmd); 38 kmem_cache_free(pgtable_cache, pmd);
39} 39}
40 40
41extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 41pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
42 unsigned long address); 42 unsigned long address);
43extern pgtable_t pte_alloc_one(struct mm_struct *mm, 43pgtable_t pte_alloc_one(struct mm_struct *mm,
44 unsigned long address); 44 unsigned long address);
45extern void pte_free_kernel(struct mm_struct *mm, pte_t *pte); 45void pte_free_kernel(struct mm_struct *mm, pte_t *pte);
46extern void pte_free(struct mm_struct *mm, pgtable_t ptepage); 46void pte_free(struct mm_struct *mm, pgtable_t ptepage);
47 47
48#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(MM, PMD, PTE) 48#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(MM, PMD, PTE)
49#define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE) 49#define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE)
@@ -51,12 +51,12 @@ extern void pte_free(struct mm_struct *mm, pgtable_t ptepage);
51 51
52#define check_pgt_cache() do { } while (0) 52#define check_pgt_cache() do { } while (0)
53 53
54extern void pgtable_free(void *table, bool is_page); 54void pgtable_free(void *table, bool is_page);
55 55
56#ifdef CONFIG_SMP 56#ifdef CONFIG_SMP
57 57
58struct mmu_gather; 58struct mmu_gather;
59extern void tlb_remove_table(struct mmu_gather *, void *); 59void tlb_remove_table(struct mmu_gather *, void *);
60 60
61static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) 61static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page)
62{ 62{
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 502f632f6cc7..b9b91ae19fe1 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -25,8 +25,9 @@
25struct vm_area_struct; 25struct vm_area_struct;
26struct page; 26struct page;
27 27
28extern void load_mmu(void); 28void load_mmu(void);
29extern unsigned long calc_highpages(void); 29unsigned long calc_highpages(void);
30unsigned long __init bootmem_init(unsigned long *pages_avail);
30 31
31#define pte_ERROR(e) __builtin_trap() 32#define pte_ERROR(e) __builtin_trap()
32#define pmd_ERROR(e) __builtin_trap() 33#define pmd_ERROR(e) __builtin_trap()
@@ -56,7 +57,7 @@ extern unsigned long calc_highpages(void);
56 * srmmu.c will assign the real one (which is dynamically sized) */ 57 * srmmu.c will assign the real one (which is dynamically sized) */
57#define swapper_pg_dir NULL 58#define swapper_pg_dir NULL
58 59
59extern void paging_init(void); 60void paging_init(void);
60 61
61extern unsigned long ptr_in_current_pgd; 62extern unsigned long ptr_in_current_pgd;
62 63
@@ -428,8 +429,8 @@ extern unsigned long *sparc_valid_addr_bitmap;
428#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) 429#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
429#define GET_PFN(pfn) (pfn & 0x0fffffffUL) 430#define GET_PFN(pfn) (pfn & 0x0fffffffUL)
430 431
431extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, 432int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long,
432 unsigned long, pgprot_t); 433 unsigned long, pgprot_t);
433 434
434static inline int io_remap_pfn_range(struct vm_area_struct *vma, 435static inline int io_remap_pfn_range(struct vm_area_struct *vma,
435 unsigned long from, unsigned long pfn, 436 unsigned long from, unsigned long pfn,
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 1a49ffdf9da9..3770bf5c6e1b 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -210,9 +210,9 @@ static inline bool kern_addr_valid(unsigned long addr)
210 210
211#ifndef __ASSEMBLY__ 211#ifndef __ASSEMBLY__
212 212
213extern pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long); 213pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long);
214 214
215extern unsigned long pte_sz_bits(unsigned long size); 215unsigned long pte_sz_bits(unsigned long size);
216 216
217extern pgprot_t PAGE_KERNEL; 217extern pgprot_t PAGE_KERNEL;
218extern pgprot_t PAGE_KERNEL_LOCKED; 218extern pgprot_t PAGE_KERNEL_LOCKED;
@@ -780,8 +780,8 @@ static inline int pmd_present(pmd_t pmd)
780 !__kern_addr_valid(pud_val(pud))) 780 !__kern_addr_valid(pud_val(pud)))
781 781
782#ifdef CONFIG_TRANSPARENT_HUGEPAGE 782#ifdef CONFIG_TRANSPARENT_HUGEPAGE
783extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, 783void set_pmd_at(struct mm_struct *mm, unsigned long addr,
784 pmd_t *pmdp, pmd_t pmd); 784 pmd_t *pmdp, pmd_t pmd);
785#else 785#else
786static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, 786static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
787 pmd_t *pmdp, pmd_t pmd) 787 pmd_t *pmdp, pmd_t pmd)
@@ -840,8 +840,8 @@ static inline unsigned long __pmd_page(pmd_t pmd)
840#define pte_unmap(pte) do { } while (0) 840#define pte_unmap(pte) do { } while (0)
841 841
842/* Actual page table PTE updates. */ 842/* Actual page table PTE updates. */
843extern void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, 843void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr,
844 pte_t *ptep, pte_t orig, int fullmm); 844 pte_t *ptep, pte_t orig, int fullmm);
845 845
846#define __HAVE_ARCH_PMDP_GET_AND_CLEAR 846#define __HAVE_ARCH_PMDP_GET_AND_CLEAR
847static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm, 847static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
@@ -900,28 +900,28 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
900extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 900extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
901extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD]; 901extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD];
902 902
903extern void paging_init(void); 903void paging_init(void);
904extern unsigned long find_ecache_flush_span(unsigned long size); 904unsigned long find_ecache_flush_span(unsigned long size);
905 905
906struct seq_file; 906struct seq_file;
907extern void mmu_info(struct seq_file *); 907void mmu_info(struct seq_file *);
908 908
909struct vm_area_struct; 909struct vm_area_struct;
910extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); 910void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
911#ifdef CONFIG_TRANSPARENT_HUGEPAGE 911#ifdef CONFIG_TRANSPARENT_HUGEPAGE
912extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, 912void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
913 pmd_t *pmd); 913 pmd_t *pmd);
914 914
915#define __HAVE_ARCH_PMDP_INVALIDATE 915#define __HAVE_ARCH_PMDP_INVALIDATE
916extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, 916extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
917 pmd_t *pmdp); 917 pmd_t *pmdp);
918 918
919#define __HAVE_ARCH_PGTABLE_DEPOSIT 919#define __HAVE_ARCH_PGTABLE_DEPOSIT
920extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, 920void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
921 pgtable_t pgtable); 921 pgtable_t pgtable);
922 922
923#define __HAVE_ARCH_PGTABLE_WITHDRAW 923#define __HAVE_ARCH_PGTABLE_WITHDRAW
924extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); 924pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
925#endif 925#endif
926 926
927/* Encode and de-code a swap entry */ 927/* Encode and de-code a swap entry */
@@ -937,12 +937,12 @@ extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
937#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 937#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
938 938
939/* File offset in PTE support. */ 939/* File offset in PTE support. */
940extern unsigned long pte_file(pte_t); 940unsigned long pte_file(pte_t);
941#define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT) 941#define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT)
942extern pte_t pgoff_to_pte(unsigned long); 942pte_t pgoff_to_pte(unsigned long);
943#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) 943#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
944 944
945extern int page_in_phys_avail(unsigned long paddr); 945int page_in_phys_avail(unsigned long paddr);
946 946
947/* 947/*
948 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in 948 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in
@@ -952,8 +952,8 @@ extern int page_in_phys_avail(unsigned long paddr);
952#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) 952#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
953#define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL) 953#define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL)
954 954
955extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, 955int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long,
956 unsigned long, pgprot_t); 956 unsigned long, pgprot_t);
957 957
958static inline int io_remap_pfn_range(struct vm_area_struct *vma, 958static inline int io_remap_pfn_range(struct vm_area_struct *vma,
959 unsigned long from, unsigned long pfn, 959 unsigned long from, unsigned long pfn,
@@ -981,20 +981,20 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
981/* We provide a special get_unmapped_area for framebuffer mmaps to try and use 981/* We provide a special get_unmapped_area for framebuffer mmaps to try and use
982 * the largest alignment possible such that larget PTEs can be used. 982 * the largest alignment possible such that larget PTEs can be used.
983 */ 983 */
984extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, 984unsigned long get_fb_unmapped_area(struct file *filp, unsigned long,
985 unsigned long, unsigned long, 985 unsigned long, unsigned long,
986 unsigned long); 986 unsigned long);
987#define HAVE_ARCH_FB_UNMAPPED_AREA 987#define HAVE_ARCH_FB_UNMAPPED_AREA
988 988
989extern void pgtable_cache_init(void); 989void pgtable_cache_init(void);
990extern void sun4v_register_fault_status(void); 990void sun4v_register_fault_status(void);
991extern void sun4v_ktsb_register(void); 991void sun4v_ktsb_register(void);
992extern void __init cheetah_ecache_flush_init(void); 992void __init cheetah_ecache_flush_init(void);
993extern void sun4v_patch_tlb_handlers(void); 993void sun4v_patch_tlb_handlers(void);
994 994
995extern unsigned long cmdline_memory_size; 995extern unsigned long cmdline_memory_size;
996 996
997extern asmlinkage void do_sparc64_fault(struct pt_regs *regs); 997asmlinkage void do_sparc64_fault(struct pt_regs *regs);
998 998
999#endif /* !(__ASSEMBLY__) */ 999#endif /* !(__ASSEMBLY__) */
1000 1000
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h
index 2c7baa4c4505..a564817bbc2e 100644
--- a/arch/sparc/include/asm/processor_32.h
+++ b/arch/sparc/include/asm/processor_32.h
@@ -74,7 +74,7 @@ struct thread_struct {
74} 74}
75 75
76/* Return saved PC of a blocked thread. */ 76/* Return saved PC of a blocked thread. */
77extern unsigned long thread_saved_pc(struct task_struct *t); 77unsigned long thread_saved_pc(struct task_struct *t);
78 78
79/* Do necessary setup to start up a newly executed thread. */ 79/* Do necessary setup to start up a newly executed thread. */
80static inline void start_thread(struct pt_regs * regs, unsigned long pc, 80static inline void start_thread(struct pt_regs * regs, unsigned long pc,
@@ -107,7 +107,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
107/* Free all resources held by a thread. */ 107/* Free all resources held by a thread. */
108#define release_thread(tsk) do { } while(0) 108#define release_thread(tsk) do { } while(0)
109 109
110extern unsigned long get_wchan(struct task_struct *); 110unsigned long get_wchan(struct task_struct *);
111 111
112#define task_pt_regs(tsk) ((tsk)->thread.kregs) 112#define task_pt_regs(tsk) ((tsk)->thread.kregs)
113#define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc) 113#define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc)
@@ -116,6 +116,7 @@ extern unsigned long get_wchan(struct task_struct *);
116#ifdef __KERNEL__ 116#ifdef __KERNEL__
117 117
118extern struct task_struct *last_task_used_math; 118extern struct task_struct *last_task_used_math;
119int do_mathemu(struct pt_regs *regs, struct task_struct *fpt);
119 120
120#define cpu_relax() barrier() 121#define cpu_relax() barrier()
121extern void (*sparc_idle)(void); 122extern void (*sparc_idle)(void);
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
index 4c3f7f01c709..7028fe1a7c04 100644
--- a/arch/sparc/include/asm/processor_64.h
+++ b/arch/sparc/include/asm/processor_64.h
@@ -95,7 +95,7 @@ struct thread_struct {
95 95
96/* Return saved PC of a blocked thread. */ 96/* Return saved PC of a blocked thread. */
97struct task_struct; 97struct task_struct;
98extern unsigned long thread_saved_pc(struct task_struct *); 98unsigned long thread_saved_pc(struct task_struct *);
99 99
100/* On Uniprocessor, even in RMO processes see TSO semantics */ 100/* On Uniprocessor, even in RMO processes see TSO semantics */
101#ifdef CONFIG_SMP 101#ifdef CONFIG_SMP
@@ -194,7 +194,7 @@ do { \
194/* Free all resources held by a thread. */ 194/* Free all resources held by a thread. */
195#define release_thread(tsk) do { } while (0) 195#define release_thread(tsk) do { } while (0)
196 196
197extern unsigned long get_wchan(struct task_struct *task); 197unsigned long get_wchan(struct task_struct *task);
198 198
199#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) 199#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
200#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc) 200#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)
@@ -253,6 +253,8 @@ static inline void prefetchw(const void *x)
253 253
254#define HAVE_ARCH_PICK_MMAP_LAYOUT 254#define HAVE_ARCH_PICK_MMAP_LAYOUT
255 255
256int do_mathemu(struct pt_regs *regs, struct fpustate *f, bool illegal_insn_trap);
257
256#endif /* !(__ASSEMBLY__) */ 258#endif /* !(__ASSEMBLY__) */
257 259
258#endif /* !(__ASM_SPARC64_PROCESSOR_H) */ 260#endif /* !(__ASM_SPARC64_PROCESSOR_H) */
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 11ebd659e7b6..d955c8df62d6 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -36,28 +36,28 @@ struct of_irq_controller {
36 void *data; 36 void *data;
37}; 37};
38 38
39extern struct device_node *of_find_node_by_cpuid(int cpuid); 39struct device_node *of_find_node_by_cpuid(int cpuid);
40extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 40int of_set_property(struct device_node *node, const char *name, void *val, int len);
41extern struct mutex of_set_property_mutex; 41extern struct mutex of_set_property_mutex;
42extern int of_getintprop_default(struct device_node *np, 42int of_getintprop_default(struct device_node *np,
43 const char *name, 43 const char *name,
44 int def); 44 int def);
45extern int of_find_in_proplist(const char *list, const char *match, int len); 45int of_find_in_proplist(const char *list, const char *match, int len);
46 46
47extern void prom_build_devicetree(void); 47void prom_build_devicetree(void);
48extern void of_populate_present_mask(void); 48void of_populate_present_mask(void);
49extern void of_fill_in_cpu_data(void); 49void of_fill_in_cpu_data(void);
50 50
51struct resource; 51struct resource;
52extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); 52void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
53extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); 53void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
54 54
55extern struct device_node *of_console_device; 55extern struct device_node *of_console_device;
56extern char *of_console_path; 56extern char *of_console_path;
57extern char *of_console_options; 57extern char *of_console_options;
58 58
59extern void irq_trans_init(struct device_node *dp); 59void irq_trans_init(struct device_node *dp);
60extern char *build_path_component(struct device_node *dp); 60char *build_path_component(struct device_node *dp);
61 61
62#endif /* __KERNEL__ */ 62#endif /* __KERNEL__ */
63#endif /* _SPARC_PROM_H */ 63#endif /* _SPARC_PROM_H */
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
index bdfafd7af46f..bac6a946ee00 100644
--- a/arch/sparc/include/asm/ptrace.h
+++ b/arch/sparc/include/asm/ptrace.h
@@ -73,7 +73,7 @@ static inline long regs_return_value(struct pt_regs *regs)
73 return regs->u_regs[UREG_I0]; 73 return regs->u_regs[UREG_I0];
74} 74}
75#ifdef CONFIG_SMP 75#ifdef CONFIG_SMP
76extern unsigned long profile_pc(struct pt_regs *); 76unsigned long profile_pc(struct pt_regs *);
77#else 77#else
78#define profile_pc(regs) instruction_pointer(regs) 78#define profile_pc(regs) instruction_pointer(regs)
79#endif 79#endif
diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h
index 5e35e0517318..f5fffd84d0dd 100644
--- a/arch/sparc/include/asm/setup.h
+++ b/arch/sparc/include/asm/setup.h
@@ -4,8 +4,9 @@
4#ifndef _SPARC_SETUP_H 4#ifndef _SPARC_SETUP_H
5#define _SPARC_SETUP_H 5#define _SPARC_SETUP_H
6 6
7#include <uapi/asm/setup.h> 7#include <linux/interrupt.h>
8 8
9#include <uapi/asm/setup.h>
9 10
10extern char reboot_command[]; 11extern char reboot_command[];
11 12
@@ -22,9 +23,43 @@ static inline int con_is_present(void)
22{ 23{
23 return serial_console ? 0 : 1; 24 return serial_console ? 0 : 1;
24} 25}
26
27/* from irq_32.c */
28extern volatile unsigned char *fdc_status;
29extern char *pdma_vaddr;
30extern unsigned long pdma_size;
31extern volatile int doing_pdma;
32
33/* This is software state */
34extern char *pdma_base;
35extern unsigned long pdma_areasize;
36
37int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler);
38
39/* setup_32.c */
40extern unsigned long cmdline_memory_size;
41
42/* devices.c */
43void __init device_scan(void);
44
45/* unaligned_32.c */
46unsigned long safe_compute_effective_address(struct pt_regs *, unsigned int);
47
48#endif
49
50#ifdef CONFIG_SPARC64
51/* unaligned_64.c */
52int handle_ldf_stq(u32 insn, struct pt_regs *regs);
53void handle_ld_nf(u32 insn, struct pt_regs *regs);
54
55/* init_64.c */
56extern atomic_t dcpage_flushes;
57extern atomic_t dcpage_flushes_xcall;
58
59extern int sysctl_tsb_ratio;
25#endif 60#endif
26 61
27extern void sun_do_break(void); 62void sun_do_break(void);
28extern int stop_a_enabled; 63extern int stop_a_enabled;
29extern int scons_pwroff; 64extern int scons_pwroff;
30 65
diff --git a/arch/sparc/include/asm/sfp-machine_32.h b/arch/sparc/include/asm/sfp-machine_32.h
index 01d9c3b5a73b..838c9d58f3b4 100644
--- a/arch/sparc/include/asm/sfp-machine_32.h
+++ b/arch/sparc/include/asm/sfp-machine_32.h
@@ -79,9 +79,9 @@
79 __asm__ ("addcc %r7,%8,%2\n\t" \ 79 __asm__ ("addcc %r7,%8,%2\n\t" \
80 "addxcc %r5,%6,%1\n\t" \ 80 "addxcc %r5,%6,%1\n\t" \
81 "addx %r3,%4,%0\n" \ 81 "addx %r3,%4,%0\n" \
82 : "=r" ((USItype)(r2)), \ 82 : "=r" (r2), \
83 "=&r" ((USItype)(r1)), \ 83 "=&r" (r1), \
84 "=&r" ((USItype)(r0)) \ 84 "=&r" (r0) \
85 : "%rJ" ((USItype)(x2)), \ 85 : "%rJ" ((USItype)(x2)), \
86 "rI" ((USItype)(y2)), \ 86 "rI" ((USItype)(y2)), \
87 "%rJ" ((USItype)(x1)), \ 87 "%rJ" ((USItype)(x1)), \
@@ -94,9 +94,9 @@
94 __asm__ ("subcc %r7,%8,%2\n\t" \ 94 __asm__ ("subcc %r7,%8,%2\n\t" \
95 "subxcc %r5,%6,%1\n\t" \ 95 "subxcc %r5,%6,%1\n\t" \
96 "subx %r3,%4,%0\n" \ 96 "subx %r3,%4,%0\n" \
97 : "=r" ((USItype)(r2)), \ 97 : "=r" (r2), \
98 "=&r" ((USItype)(r1)), \ 98 "=&r" (r1), \
99 "=&r" ((USItype)(r0)) \ 99 "=&r" (r0) \
100 : "%rJ" ((USItype)(x2)), \ 100 : "%rJ" ((USItype)(x2)), \
101 "rI" ((USItype)(y2)), \ 101 "rI" ((USItype)(y2)), \
102 "%rJ" ((USItype)(x1)), \ 102 "%rJ" ((USItype)(x1)), \
@@ -115,8 +115,8 @@
115 "addxcc %r6,%7,%0\n\t" \ 115 "addxcc %r6,%7,%0\n\t" \
116 "addxcc %r4,%5,%%g2\n\t" \ 116 "addxcc %r4,%5,%%g2\n\t" \
117 "addx %r2,%3,%%g1\n\t" \ 117 "addx %r2,%3,%%g1\n\t" \
118 : "=&r" ((USItype)(r1)), \ 118 : "=&r" (r1), \
119 "=&r" ((USItype)(r0)) \ 119 "=&r" (r0) \
120 : "%rJ" ((USItype)(x3)), \ 120 : "%rJ" ((USItype)(x3)), \
121 "rI" ((USItype)(y3)), \ 121 "rI" ((USItype)(y3)), \
122 "%rJ" ((USItype)(x2)), \ 122 "%rJ" ((USItype)(x2)), \
@@ -140,8 +140,8 @@
140 "subxcc %r6,%7,%0\n\t" \ 140 "subxcc %r6,%7,%0\n\t" \
141 "subxcc %r4,%5,%%g2\n\t" \ 141 "subxcc %r4,%5,%%g2\n\t" \
142 "subx %r2,%3,%%g1\n\t" \ 142 "subx %r2,%3,%%g1\n\t" \
143 : "=&r" ((USItype)(r1)), \ 143 : "=&r" (r1), \
144 "=&r" ((USItype)(r0)) \ 144 "=&r" (r0) \
145 : "%rJ" ((USItype)(x3)), \ 145 : "%rJ" ((USItype)(x3)), \
146 "rI" ((USItype)(y3)), \ 146 "rI" ((USItype)(y3)), \
147 "%rJ" ((USItype)(x2)), \ 147 "%rJ" ((USItype)(x2)), \
@@ -164,10 +164,10 @@
164 "addxcc %2,%%g0,%2\n\t" \ 164 "addxcc %2,%%g0,%2\n\t" \
165 "addxcc %1,%%g0,%1\n\t" \ 165 "addxcc %1,%%g0,%1\n\t" \
166 "addx %0,%%g0,%0\n\t" \ 166 "addx %0,%%g0,%0\n\t" \
167 : "=&r" ((USItype)(x3)), \ 167 : "=&r" (x3), \
168 "=&r" ((USItype)(x2)), \ 168 "=&r" (x2), \
169 "=&r" ((USItype)(x1)), \ 169 "=&r" (x1), \
170 "=&r" ((USItype)(x0)) \ 170 "=&r" (x0) \
171 : "rI" ((USItype)(i)), \ 171 : "rI" ((USItype)(i)), \
172 "0" ((USItype)(x3)), \ 172 "0" ((USItype)(x3)), \
173 "1" ((USItype)(x2)), \ 173 "1" ((USItype)(x2)), \
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h
index 3c8917f054de..7c24e08a88d2 100644
--- a/arch/sparc/include/asm/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
@@ -93,15 +93,15 @@ static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
93 arg1, arg2, arg3, arg4); 93 arg1, arg2, arg3, arg4);
94} 94}
95 95
96extern void arch_send_call_function_single_ipi(int cpu); 96void arch_send_call_function_single_ipi(int cpu);
97extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 97void arch_send_call_function_ipi_mask(const struct cpumask *mask);
98 98
99static inline int cpu_logical_map(int cpu) 99static inline int cpu_logical_map(int cpu)
100{ 100{
101 return cpu; 101 return cpu;
102} 102}
103 103
104extern int hard_smp_processor_id(void); 104int hard_smp_processor_id(void);
105 105
106#define raw_smp_processor_id() (current_thread_info()->cpu) 106#define raw_smp_processor_id() (current_thread_info()->cpu)
107 107
diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h
index 05710393959f..26d9e7726867 100644
--- a/arch/sparc/include/asm/smp_64.h
+++ b/arch/sparc/include/asm/smp_64.h
@@ -33,29 +33,35 @@
33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
34extern cpumask_t cpu_core_map[NR_CPUS]; 34extern cpumask_t cpu_core_map[NR_CPUS];
35 35
36extern void arch_send_call_function_single_ipi(int cpu); 36void arch_send_call_function_single_ipi(int cpu);
37extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 37void arch_send_call_function_ipi_mask(const struct cpumask *mask);
38 38
39/* 39/*
40 * General functions that each host system must provide. 40 * General functions that each host system must provide.
41 */ 41 */
42 42
43extern int hard_smp_processor_id(void); 43int hard_smp_processor_id(void);
44#define raw_smp_processor_id() (current_thread_info()->cpu) 44#define raw_smp_processor_id() (current_thread_info()->cpu)
45 45
46extern void smp_fill_in_sib_core_maps(void); 46void smp_fill_in_sib_core_maps(void);
47extern void cpu_play_dead(void); 47void cpu_play_dead(void);
48 48
49extern void smp_fetch_global_regs(void); 49void smp_fetch_global_regs(void);
50extern void smp_fetch_global_pmu(void); 50void smp_fetch_global_pmu(void);
51 51
52struct seq_file; 52struct seq_file;
53void smp_bogo(struct seq_file *); 53void smp_bogo(struct seq_file *);
54void smp_info(struct seq_file *); 54void smp_info(struct seq_file *);
55 55
56void smp_callin(void);
57void cpu_panic(void);
58void smp_synchronize_tick_client(void);
59void smp_capture(void);
60void smp_release(void);
61
56#ifdef CONFIG_HOTPLUG_CPU 62#ifdef CONFIG_HOTPLUG_CPU
57extern int __cpu_disable(void); 63int __cpu_disable(void);
58extern void __cpu_die(unsigned int cpu); 64void __cpu_die(unsigned int cpu);
59#endif 65#endif
60 66
61#endif /* !(__ASSEMBLY__) */ 67#endif /* !(__ASSEMBLY__) */
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 6b67e50fb9b4..3fc58691dbd0 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -62,7 +62,7 @@ extern enum ultra_tlb_layout tlb_type;
62extern int sun4v_chip_type; 62extern int sun4v_chip_type;
63 63
64extern int cheetah_pcache_forced_on; 64extern int cheetah_pcache_forced_on;
65extern void cheetah_enable_pcache(void); 65void cheetah_enable_pcache(void);
66 66
67#define sparc64_highest_locked_tlbent() \ 67#define sparc64_highest_locked_tlbent() \
68 (tlb_type == spitfire ? \ 68 (tlb_type == spitfire ? \
diff --git a/arch/sparc/include/asm/stacktrace.h b/arch/sparc/include/asm/stacktrace.h
index 6cee39adf6d6..c30d066f3048 100644
--- a/arch/sparc/include/asm/stacktrace.h
+++ b/arch/sparc/include/asm/stacktrace.h
@@ -1,6 +1,6 @@
1#ifndef _SPARC64_STACKTRACE_H 1#ifndef _SPARC64_STACKTRACE_H
2#define _SPARC64_STACKTRACE_H 2#define _SPARC64_STACKTRACE_H
3 3
4extern void stack_trace_flush(void); 4void stack_trace_flush(void);
5 5
6#endif /* _SPARC64_STACKTRACE_H */ 6#endif /* _SPARC64_STACKTRACE_H */
diff --git a/arch/sparc/include/asm/starfire.h b/arch/sparc/include/asm/starfire.h
index d56ce60a5992..c100dc27a0a9 100644
--- a/arch/sparc/include/asm/starfire.h
+++ b/arch/sparc/include/asm/starfire.h
@@ -11,10 +11,10 @@
11 11
12extern int this_is_starfire; 12extern int this_is_starfire;
13 13
14extern void check_if_starfire(void); 14void check_if_starfire(void);
15extern int starfire_hard_smp_processor_id(void); 15int starfire_hard_smp_processor_id(void);
16extern void starfire_hookup(int); 16void starfire_hookup(int);
17extern unsigned int starfire_translate(unsigned long imap, unsigned int upaid); 17unsigned int starfire_translate(unsigned long imap, unsigned int upaid);
18 18
19#endif 19#endif
20#endif 20#endif
diff --git a/arch/sparc/include/asm/string_32.h b/arch/sparc/include/asm/string_32.h
index 12f67857152e..69974e924611 100644
--- a/arch/sparc/include/asm/string_32.h
+++ b/arch/sparc/include/asm/string_32.h
@@ -15,7 +15,7 @@
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18extern void __memmove(void *,const void *,__kernel_size_t); 18void __memmove(void *,const void *,__kernel_size_t);
19 19
20#ifndef EXPORT_SYMTAB_STROPS 20#ifndef EXPORT_SYMTAB_STROPS
21 21
@@ -40,8 +40,8 @@ extern void __memmove(void *,const void *,__kernel_size_t);
40#undef memscan 40#undef memscan
41#define memscan(__arg0, __char, __arg2) \ 41#define memscan(__arg0, __char, __arg2) \
42({ \ 42({ \
43 extern void *__memscan_zero(void *, size_t); \ 43 void *__memscan_zero(void *, size_t); \
44 extern void *__memscan_generic(void *, int, size_t); \ 44 void *__memscan_generic(void *, int, size_t); \
45 void *__retval, *__addr = (__arg0); \ 45 void *__retval, *__addr = (__arg0); \
46 size_t __size = (__arg2); \ 46 size_t __size = (__arg2); \
47 \ 47 \
@@ -54,14 +54,14 @@ extern void __memmove(void *,const void *,__kernel_size_t);
54}) 54})
55 55
56#define __HAVE_ARCH_MEMCMP 56#define __HAVE_ARCH_MEMCMP
57extern int memcmp(const void *,const void *,__kernel_size_t); 57int memcmp(const void *,const void *,__kernel_size_t);
58 58
59/* Now the str*() stuff... */ 59/* Now the str*() stuff... */
60#define __HAVE_ARCH_STRLEN 60#define __HAVE_ARCH_STRLEN
61extern __kernel_size_t strlen(const char *); 61__kernel_size_t strlen(const char *);
62 62
63#define __HAVE_ARCH_STRNCMP 63#define __HAVE_ARCH_STRNCMP
64extern int strncmp(const char *, const char *, __kernel_size_t); 64int strncmp(const char *, const char *, __kernel_size_t);
65 65
66#endif /* !EXPORT_SYMTAB_STROPS */ 66#endif /* !EXPORT_SYMTAB_STROPS */
67 67
diff --git a/arch/sparc/include/asm/string_64.h b/arch/sparc/include/asm/string_64.h
index 9623bc213158..5936b8ff3c05 100644
--- a/arch/sparc/include/asm/string_64.h
+++ b/arch/sparc/include/asm/string_64.h
@@ -19,7 +19,7 @@
19 19
20/* First the mem*() things. */ 20/* First the mem*() things. */
21#define __HAVE_ARCH_MEMMOVE 21#define __HAVE_ARCH_MEMMOVE
22extern void *memmove(void *, const void *, __kernel_size_t); 22void *memmove(void *, const void *, __kernel_size_t);
23 23
24#define __HAVE_ARCH_MEMCPY 24#define __HAVE_ARCH_MEMCPY
25#define memcpy(t, f, n) __builtin_memcpy(t, f, n) 25#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
@@ -32,8 +32,8 @@ extern void *memmove(void *, const void *, __kernel_size_t);
32#undef memscan 32#undef memscan
33#define memscan(__arg0, __char, __arg2) \ 33#define memscan(__arg0, __char, __arg2) \
34({ \ 34({ \
35 extern void *__memscan_zero(void *, size_t); \ 35 void *__memscan_zero(void *, size_t); \
36 extern void *__memscan_generic(void *, int, size_t); \ 36 void *__memscan_generic(void *, int, size_t); \
37 void *__retval, *__addr = (__arg0); \ 37 void *__retval, *__addr = (__arg0); \
38 size_t __size = (__arg2); \ 38 size_t __size = (__arg2); \
39 \ 39 \
@@ -46,14 +46,14 @@ extern void *memmove(void *, const void *, __kernel_size_t);
46}) 46})
47 47
48#define __HAVE_ARCH_MEMCMP 48#define __HAVE_ARCH_MEMCMP
49extern int memcmp(const void *,const void *,__kernel_size_t); 49int memcmp(const void *,const void *,__kernel_size_t);
50 50
51/* Now the str*() stuff... */ 51/* Now the str*() stuff... */
52#define __HAVE_ARCH_STRLEN 52#define __HAVE_ARCH_STRLEN
53extern __kernel_size_t strlen(const char *); 53__kernel_size_t strlen(const char *);
54 54
55#define __HAVE_ARCH_STRNCMP 55#define __HAVE_ARCH_STRNCMP
56extern int strncmp(const char *, const char *, __kernel_size_t); 56int strncmp(const char *, const char *, __kernel_size_t);
57 57
58#endif /* !EXPORT_SYMTAB_STROPS */ 58#endif /* !EXPORT_SYMTAB_STROPS */
59 59
diff --git a/arch/sparc/include/asm/switch_to_32.h b/arch/sparc/include/asm/switch_to_32.h
index e32e82b76eed..16f10374feb3 100644
--- a/arch/sparc/include/asm/switch_to_32.h
+++ b/arch/sparc/include/asm/switch_to_32.h
@@ -99,8 +99,8 @@ extern struct thread_info *current_set[NR_CPUS];
99 "o0", "o1", "o2", "o3", "o7"); \ 99 "o0", "o1", "o2", "o3", "o7"); \
100 } while(0) 100 } while(0)
101 101
102extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 102void fpsave(unsigned long *fpregs, unsigned long *fsr,
103 void *fpqueue, unsigned long *fpqdepth); 103 void *fpqueue, unsigned long *fpqdepth);
104extern void synchronize_user_stack(void); 104void synchronize_user_stack(void);
105 105
106#endif /* __SPARC_SWITCH_TO_H */ 106#endif /* __SPARC_SWITCH_TO_H */
diff --git a/arch/sparc/include/asm/switch_to_64.h b/arch/sparc/include/asm/switch_to_64.h
index 8d284801f232..10e76332dc99 100644
--- a/arch/sparc/include/asm/switch_to_64.h
+++ b/arch/sparc/include/asm/switch_to_64.h
@@ -65,7 +65,7 @@ do { save_and_clear_fpu(); \
65 "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \ 65 "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \
66} while(0) 66} while(0)
67 67
68extern void synchronize_user_stack(void); 68void synchronize_user_stack(void);
69extern void fault_in_user_windows(void); 69void fault_in_user_windows(void);
70 70
71#endif /* __SPARC64_SWITCH_TO_64_H */ 71#endif /* __SPARC64_SWITCH_TO_64_H */
diff --git a/arch/sparc/include/asm/syscalls.h b/arch/sparc/include/asm/syscalls.h
index bf8972adea17..b0a0db8ea61a 100644
--- a/arch/sparc/include/asm/syscalls.h
+++ b/arch/sparc/include/asm/syscalls.h
@@ -3,9 +3,9 @@
3 3
4struct pt_regs; 4struct pt_regs;
5 5
6extern asmlinkage long sparc_do_fork(unsigned long clone_flags, 6asmlinkage long sparc_do_fork(unsigned long clone_flags,
7 unsigned long stack_start, 7 unsigned long stack_start,
8 struct pt_regs *regs, 8 struct pt_regs *regs,
9 unsigned long stack_size); 9 unsigned long stack_size);
10 10
11#endif /* _SPARC64_SYSCALLS_H */ 11#endif /* _SPARC64_SYSCALLS_H */
diff --git a/arch/sparc/include/asm/timer_32.h b/arch/sparc/include/asm/timer_32.h
index 72f40a546de3..f8e708a0aa58 100644
--- a/arch/sparc/include/asm/timer_32.h
+++ b/arch/sparc/include/asm/timer_32.h
@@ -32,13 +32,13 @@ static inline unsigned int timer_value(unsigned int value)
32 return (value + 1) << TIMER_VALUE_SHIFT; 32 return (value + 1) << TIMER_VALUE_SHIFT;
33} 33}
34 34
35extern __volatile__ unsigned int *master_l10_counter; 35extern volatile u32 __iomem *master_l10_counter;
36 36
37extern irqreturn_t notrace timer_interrupt(int dummy, void *dev_id); 37irqreturn_t notrace timer_interrupt(int dummy, void *dev_id);
38 38
39#ifdef CONFIG_SMP 39#ifdef CONFIG_SMP
40DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent); 40DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent);
41extern void register_percpu_ce(int cpu); 41void register_percpu_ce(int cpu);
42#endif 42#endif
43 43
44#endif /* !(_SPARC_TIMER_H) */ 44#endif /* !(_SPARC_TIMER_H) */
diff --git a/arch/sparc/include/asm/timer_64.h b/arch/sparc/include/asm/timer_64.h
index 01197d8215c4..fce415034000 100644
--- a/arch/sparc/include/asm/timer_64.h
+++ b/arch/sparc/include/asm/timer_64.h
@@ -23,8 +23,8 @@ struct sparc64_tick_ops {
23 23
24extern struct sparc64_tick_ops *tick_ops; 24extern struct sparc64_tick_ops *tick_ops;
25 25
26extern unsigned long sparc64_get_clock_tick(unsigned int cpu); 26unsigned long sparc64_get_clock_tick(unsigned int cpu);
27extern void setup_sparc64_timer(void); 27void setup_sparc64_timer(void);
28extern void __init time_init(void); 28void __init time_init(void);
29 29
30#endif /* _SPARC64_TIMER_H */ 30#endif /* _SPARC64_TIMER_H */
diff --git a/arch/sparc/include/asm/tlb_64.h b/arch/sparc/include/asm/tlb_64.h
index 190e18913cc6..4cb392f75d2b 100644
--- a/arch/sparc/include/asm/tlb_64.h
+++ b/arch/sparc/include/asm/tlb_64.h
@@ -8,19 +8,19 @@
8#include <asm/mmu_context.h> 8#include <asm/mmu_context.h>
9 9
10#ifdef CONFIG_SMP 10#ifdef CONFIG_SMP
11extern void smp_flush_tlb_pending(struct mm_struct *, 11void smp_flush_tlb_pending(struct mm_struct *,
12 unsigned long, unsigned long *); 12 unsigned long, unsigned long *);
13#endif 13#endif
14 14
15#ifdef CONFIG_SMP 15#ifdef CONFIG_SMP
16extern void smp_flush_tlb_mm(struct mm_struct *mm); 16void smp_flush_tlb_mm(struct mm_struct *mm);
17#define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm) 17#define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm)
18#else 18#else
19#define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT) 19#define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT)
20#endif 20#endif
21 21
22extern void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *); 22void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *);
23extern void flush_tlb_pending(void); 23void flush_tlb_pending(void);
24 24
25#define tlb_start_vma(tlb, vma) do { } while (0) 25#define tlb_start_vma(tlb, vma) do { } while (0)
26#define tlb_end_vma(tlb, vma) do { } while (0) 26#define tlb_end_vma(tlb, vma) do { } while (0)
diff --git a/arch/sparc/include/asm/tlbflush_64.h b/arch/sparc/include/asm/tlbflush_64.h
index 3c3c89f52643..816d8202fa0a 100644
--- a/arch/sparc/include/asm/tlbflush_64.h
+++ b/arch/sparc/include/asm/tlbflush_64.h
@@ -14,9 +14,9 @@ struct tlb_batch {
14 unsigned long vaddrs[TLB_BATCH_NR]; 14 unsigned long vaddrs[TLB_BATCH_NR];
15}; 15};
16 16
17extern void flush_tsb_kernel_range(unsigned long start, unsigned long end); 17void flush_tsb_kernel_range(unsigned long start, unsigned long end);
18extern void flush_tsb_user(struct tlb_batch *tb); 18void flush_tsb_user(struct tlb_batch *tb);
19extern void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr); 19void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr);
20 20
21/* TLB flush operations. */ 21/* TLB flush operations. */
22 22
@@ -36,15 +36,15 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
36 36
37#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 37#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
38 38
39extern void flush_tlb_pending(void); 39void flush_tlb_pending(void);
40extern void arch_enter_lazy_mmu_mode(void); 40void arch_enter_lazy_mmu_mode(void);
41extern void arch_leave_lazy_mmu_mode(void); 41void arch_leave_lazy_mmu_mode(void);
42#define arch_flush_lazy_mmu_mode() do {} while (0) 42#define arch_flush_lazy_mmu_mode() do {} while (0)
43 43
44/* Local cpu only. */ 44/* Local cpu only. */
45extern void __flush_tlb_all(void); 45void __flush_tlb_all(void);
46extern void __flush_tlb_page(unsigned long context, unsigned long vaddr); 46void __flush_tlb_page(unsigned long context, unsigned long vaddr);
47extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end); 47void __flush_tlb_kernel_range(unsigned long start, unsigned long end);
48 48
49#ifndef CONFIG_SMP 49#ifndef CONFIG_SMP
50 50
@@ -60,8 +60,8 @@ static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vad
60 60
61#else /* CONFIG_SMP */ 61#else /* CONFIG_SMP */
62 62
63extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); 63void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end);
64extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr); 64void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr);
65 65
66#define flush_tlb_kernel_range(start, end) \ 66#define flush_tlb_kernel_range(start, end) \
67do { flush_tsb_kernel_range(start,end); \ 67do { flush_tsb_kernel_range(start,end); \
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index a2d10fc64faf..ed8f071132e4 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -18,7 +18,7 @@ static inline int cpu_to_node(int cpu)
18 18
19struct pci_bus; 19struct pci_bus;
20#ifdef CONFIG_PCI 20#ifdef CONFIG_PCI
21extern int pcibus_to_node(struct pci_bus *pbus); 21int pcibus_to_node(struct pci_bus *pbus);
22#else 22#else
23static inline int pcibus_to_node(struct pci_bus *pbus) 23static inline int pcibus_to_node(struct pci_bus *pbus)
24{ 24{
diff --git a/arch/sparc/include/asm/trap_block.h b/arch/sparc/include/asm/trap_block.h
index 7e26b2db6211..6fd4436d32f0 100644
--- a/arch/sparc/include/asm/trap_block.h
+++ b/arch/sparc/include/asm/trap_block.h
@@ -51,11 +51,11 @@ struct trap_per_cpu {
51 unsigned long __per_cpu_base; 51 unsigned long __per_cpu_base;
52} __attribute__((aligned(64))); 52} __attribute__((aligned(64)));
53extern struct trap_per_cpu trap_block[NR_CPUS]; 53extern struct trap_per_cpu trap_block[NR_CPUS];
54extern void init_cur_cpu_trap(struct thread_info *); 54void init_cur_cpu_trap(struct thread_info *);
55extern void setup_tba(void); 55void setup_tba(void);
56extern int ncpus_probed; 56extern int ncpus_probed;
57 57
58extern unsigned long real_hard_smp_processor_id(void); 58unsigned long real_hard_smp_processor_id(void);
59 59
60struct cpuid_patch_entry { 60struct cpuid_patch_entry {
61 unsigned int addr; 61 unsigned int addr;
diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h
index 0167d26d0d1d..bd56c28fff9f 100644
--- a/arch/sparc/include/asm/uaccess.h
+++ b/arch/sparc/include/asm/uaccess.h
@@ -9,6 +9,6 @@
9#define user_addr_max() \ 9#define user_addr_max() \
10 (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) 10 (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)
11 11
12extern long strncpy_from_user(char *dest, const char __user *src, long count); 12long strncpy_from_user(char *dest, const char __user *src, long count);
13 13
14#endif 14#endif
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h
index 53a28dd59f59..9634d086fc56 100644
--- a/arch/sparc/include/asm/uaccess_32.h
+++ b/arch/sparc/include/asm/uaccess_32.h
@@ -78,9 +78,9 @@ struct exception_table_entry
78}; 78};
79 79
80/* Returns 0 if exception not found and fixup otherwise. */ 80/* Returns 0 if exception not found and fixup otherwise. */
81extern unsigned long search_extables_range(unsigned long addr, unsigned long *g2); 81unsigned long search_extables_range(unsigned long addr, unsigned long *g2);
82 82
83extern void __ret_efault(void); 83void __ret_efault(void);
84 84
85/* Uh, these should become the main single-value transfer routines.. 85/* Uh, these should become the main single-value transfer routines..
86 * They automatically use the right size if we just have the right 86 * They automatically use the right size if we just have the right
@@ -152,7 +152,7 @@ __asm__ __volatile__( \
152 : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \ 152 : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \
153 "i" (-EFAULT)) 153 "i" (-EFAULT))
154 154
155extern int __put_user_bad(void); 155int __put_user_bad(void);
156 156
157#define __get_user_check(x,addr,size,type) ({ \ 157#define __get_user_check(x,addr,size,type) ({ \
158register int __gu_ret; \ 158register int __gu_ret; \
@@ -244,9 +244,9 @@ __asm__ __volatile__( \
244 ".previous\n\t" \ 244 ".previous\n\t" \
245 : "=&r" (x) : "m" (*__m(addr)), "i" (retval)) 245 : "=&r" (x) : "m" (*__m(addr)), "i" (retval))
246 246
247extern int __get_user_bad(void); 247int __get_user_bad(void);
248 248
249extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size); 249unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);
250 250
251static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) 251static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
252{ 252{
@@ -306,8 +306,8 @@ static inline unsigned long clear_user(void __user *addr, unsigned long n)
306 return n; 306 return n;
307} 307}
308 308
309extern __must_check long strlen_user(const char __user *str); 309__must_check long strlen_user(const char __user *str);
310extern __must_check long strnlen_user(const char __user *str, long n); 310__must_check long strnlen_user(const char __user *str, long n);
311 311
312#endif /* __ASSEMBLY__ */ 312#endif /* __ASSEMBLY__ */
313 313
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index ad7e178337f1..c990a5e577f0 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -76,8 +76,8 @@ struct exception_table_entry {
76 unsigned int insn, fixup; 76 unsigned int insn, fixup;
77}; 77};
78 78
79extern void __ret_efault(void); 79void __ret_efault(void);
80extern void __retl_efault(void); 80void __retl_efault(void);
81 81
82/* Uh, these should become the main single-value transfer routines.. 82/* Uh, these should become the main single-value transfer routines..
83 * They automatically use the right size if we just have the right 83 * They automatically use the right size if we just have the right
@@ -134,7 +134,7 @@ __asm__ __volatile__( \
134 : "=r" (ret) : "r" (x), "r" (__m(addr)), \ 134 : "=r" (ret) : "r" (x), "r" (__m(addr)), \
135 "i" (-EFAULT)) 135 "i" (-EFAULT))
136 136
137extern int __put_user_bad(void); 137int __put_user_bad(void);
138 138
139#define __get_user_nocheck(data,addr,size,type) ({ \ 139#define __get_user_nocheck(data,addr,size,type) ({ \
140register int __gu_ret; \ 140register int __gu_ret; \
@@ -204,13 +204,13 @@ __asm__ __volatile__( \
204 ".previous\n\t" \ 204 ".previous\n\t" \
205 : "=r" (x) : "r" (__m(addr)), "i" (retval)) 205 : "=r" (x) : "r" (__m(addr)), "i" (retval))
206 206
207extern int __get_user_bad(void); 207int __get_user_bad(void);
208 208
209extern unsigned long __must_check ___copy_from_user(void *to, 209unsigned long __must_check ___copy_from_user(void *to,
210 const void __user *from, 210 const void __user *from,
211 unsigned long size); 211 unsigned long size);
212extern unsigned long copy_from_user_fixup(void *to, const void __user *from, 212unsigned long copy_from_user_fixup(void *to, const void __user *from,
213 unsigned long size); 213 unsigned long size);
214static inline unsigned long __must_check 214static inline unsigned long __must_check
215copy_from_user(void *to, const void __user *from, unsigned long size) 215copy_from_user(void *to, const void __user *from, unsigned long size)
216{ 216{
@@ -223,11 +223,11 @@ copy_from_user(void *to, const void __user *from, unsigned long size)
223} 223}
224#define __copy_from_user copy_from_user 224#define __copy_from_user copy_from_user
225 225
226extern unsigned long __must_check ___copy_to_user(void __user *to, 226unsigned long __must_check ___copy_to_user(void __user *to,
227 const void *from, 227 const void *from,
228 unsigned long size); 228 unsigned long size);
229extern unsigned long copy_to_user_fixup(void __user *to, const void *from, 229unsigned long copy_to_user_fixup(void __user *to, const void *from,
230 unsigned long size); 230 unsigned long size);
231static inline unsigned long __must_check 231static inline unsigned long __must_check
232copy_to_user(void __user *to, const void *from, unsigned long size) 232copy_to_user(void __user *to, const void *from, unsigned long size)
233{ 233{
@@ -239,11 +239,11 @@ copy_to_user(void __user *to, const void *from, unsigned long size)
239} 239}
240#define __copy_to_user copy_to_user 240#define __copy_to_user copy_to_user
241 241
242extern unsigned long __must_check ___copy_in_user(void __user *to, 242unsigned long __must_check ___copy_in_user(void __user *to,
243 const void __user *from, 243 const void __user *from,
244 unsigned long size); 244 unsigned long size);
245extern unsigned long copy_in_user_fixup(void __user *to, void __user *from, 245unsigned long copy_in_user_fixup(void __user *to, void __user *from,
246 unsigned long size); 246 unsigned long size);
247static inline unsigned long __must_check 247static inline unsigned long __must_check
248copy_in_user(void __user *to, void __user *from, unsigned long size) 248copy_in_user(void __user *to, void __user *from, unsigned long size)
249{ 249{
@@ -255,20 +255,20 @@ copy_in_user(void __user *to, void __user *from, unsigned long size)
255} 255}
256#define __copy_in_user copy_in_user 256#define __copy_in_user copy_in_user
257 257
258extern unsigned long __must_check __clear_user(void __user *, unsigned long); 258unsigned long __must_check __clear_user(void __user *, unsigned long);
259 259
260#define clear_user __clear_user 260#define clear_user __clear_user
261 261
262extern __must_check long strlen_user(const char __user *str); 262__must_check long strlen_user(const char __user *str);
263extern __must_check long strnlen_user(const char __user *str, long n); 263__must_check long strnlen_user(const char __user *str, long n);
264 264
265#define __copy_to_user_inatomic __copy_to_user 265#define __copy_to_user_inatomic __copy_to_user
266#define __copy_from_user_inatomic __copy_from_user 266#define __copy_from_user_inatomic __copy_from_user
267 267
268struct pt_regs; 268struct pt_regs;
269extern unsigned long compute_effective_address(struct pt_regs *, 269unsigned long compute_effective_address(struct pt_regs *,
270 unsigned int insn, 270 unsigned int insn,
271 unsigned int rd); 271 unsigned int rd);
272 272
273#endif /* __ASSEMBLY__ */ 273#endif /* __ASSEMBLY__ */
274 274
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h
index 432afa838861..e0f6c399f1d0 100644
--- a/arch/sparc/include/asm/vio.h
+++ b/arch/sparc/include/asm/vio.h
@@ -372,14 +372,14 @@ do { if (vio->debug & VIO_DEBUG_##TYPE) \
372 vio->vdev->channel_id, ## a); \ 372 vio->vdev->channel_id, ## a); \
373} while (0) 373} while (0)
374 374
375extern int __vio_register_driver(struct vio_driver *drv, struct module *owner, 375int __vio_register_driver(struct vio_driver *drv, struct module *owner,
376 const char *mod_name); 376 const char *mod_name);
377/* 377/*
378 * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded 378 * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded
379 */ 379 */
380#define vio_register_driver(driver) \ 380#define vio_register_driver(driver) \
381 __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) 381 __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
382extern void vio_unregister_driver(struct vio_driver *drv); 382void vio_unregister_driver(struct vio_driver *drv);
383 383
384static inline struct vio_driver *to_vio_driver(struct device_driver *drv) 384static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
385{ 385{
@@ -391,21 +391,21 @@ static inline struct vio_dev *to_vio_dev(struct device *dev)
391 return container_of(dev, struct vio_dev, dev); 391 return container_of(dev, struct vio_dev, dev);
392} 392}
393 393
394extern int vio_ldc_send(struct vio_driver_state *vio, void *data, int len); 394int vio_ldc_send(struct vio_driver_state *vio, void *data, int len);
395extern void vio_link_state_change(struct vio_driver_state *vio, int event); 395void vio_link_state_change(struct vio_driver_state *vio, int event);
396extern void vio_conn_reset(struct vio_driver_state *vio); 396void vio_conn_reset(struct vio_driver_state *vio);
397extern int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt); 397int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt);
398extern int vio_validate_sid(struct vio_driver_state *vio, 398int vio_validate_sid(struct vio_driver_state *vio,
399 struct vio_msg_tag *tp); 399 struct vio_msg_tag *tp);
400extern u32 vio_send_sid(struct vio_driver_state *vio); 400u32 vio_send_sid(struct vio_driver_state *vio);
401extern int vio_ldc_alloc(struct vio_driver_state *vio, 401int vio_ldc_alloc(struct vio_driver_state *vio,
402 struct ldc_channel_config *base_cfg, void *event_arg); 402 struct ldc_channel_config *base_cfg, void *event_arg);
403extern void vio_ldc_free(struct vio_driver_state *vio); 403void vio_ldc_free(struct vio_driver_state *vio);
404extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev, 404int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
405 u8 dev_class, struct vio_version *ver_table, 405 u8 dev_class, struct vio_version *ver_table,
406 int ver_table_size, struct vio_driver_ops *ops, 406 int ver_table_size, struct vio_driver_ops *ops,
407 char *name); 407 char *name);
408 408
409extern void vio_port_up(struct vio_driver_state *vio); 409void vio_port_up(struct vio_driver_state *vio);
410 410
411#endif /* _SPARC64_VIO_H */ 411#endif /* _SPARC64_VIO_H */
diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h
index 39ca301920db..b26673759283 100644
--- a/arch/sparc/include/asm/visasm.h
+++ b/arch/sparc/include/asm/visasm.h
@@ -57,7 +57,8 @@ static inline void save_and_clear_fpu(void) {
57" " : : "i" (FPRS_FEF|FPRS_DU) : 57" " : : "i" (FPRS_FEF|FPRS_DU) :
58 "o5", "g1", "g2", "g3", "g7", "cc"); 58 "o5", "g1", "g2", "g3", "g7", "cc");
59} 59}
60extern int vis_emul(struct pt_regs *, unsigned int); 60
61int vis_emul(struct pt_regs *, unsigned int);
61#endif 62#endif
62 63
63#endif /* _SPARC64_ASI_H */ 64#endif /* _SPARC64_ASI_H */
diff --git a/arch/sparc/include/asm/xor_64.h b/arch/sparc/include/asm/xor_64.h
index ee8edc68423e..50c882856031 100644
--- a/arch/sparc/include/asm/xor_64.h
+++ b/arch/sparc/include/asm/xor_64.h
@@ -20,13 +20,13 @@
20 20
21#include <asm/spitfire.h> 21#include <asm/spitfire.h>
22 22
23extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); 23void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
24extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, 24void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
25 unsigned long *); 25 unsigned long *);
26extern void xor_vis_4(unsigned long, unsigned long *, unsigned long *, 26void xor_vis_4(unsigned long, unsigned long *, unsigned long *,
27 unsigned long *, unsigned long *); 27 unsigned long *, unsigned long *);
28extern void xor_vis_5(unsigned long, unsigned long *, unsigned long *, 28void xor_vis_5(unsigned long, unsigned long *, unsigned long *,
29 unsigned long *, unsigned long *, unsigned long *); 29 unsigned long *, unsigned long *, unsigned long *);
30 30
31/* XXX Ugh, write cheetah versions... -DaveM */ 31/* XXX Ugh, write cheetah versions... -DaveM */
32 32
@@ -38,13 +38,13 @@ static struct xor_block_template xor_block_VIS = {
38 .do_5 = xor_vis_5, 38 .do_5 = xor_vis_5,
39}; 39};
40 40
41extern void xor_niagara_2(unsigned long, unsigned long *, unsigned long *); 41void xor_niagara_2(unsigned long, unsigned long *, unsigned long *);
42extern void xor_niagara_3(unsigned long, unsigned long *, unsigned long *, 42void xor_niagara_3(unsigned long, unsigned long *, unsigned long *,
43 unsigned long *); 43 unsigned long *);
44extern void xor_niagara_4(unsigned long, unsigned long *, unsigned long *, 44void xor_niagara_4(unsigned long, unsigned long *, unsigned long *,
45 unsigned long *, unsigned long *); 45 unsigned long *, unsigned long *);
46extern void xor_niagara_5(unsigned long, unsigned long *, unsigned long *, 46void xor_niagara_5(unsigned long, unsigned long *, unsigned long *,
47 unsigned long *, unsigned long *, unsigned long *); 47 unsigned long *, unsigned long *, unsigned long *);
48 48
49static struct xor_block_template xor_block_niagara = { 49static struct xor_block_template xor_block_niagara = {
50 .name = "Niagara", 50 .name = "Niagara",
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index d15cc1794b0e..7cf9c6ea3f1f 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -42,7 +42,6 @@ obj-y += time_$(BITS).o
42obj-$(CONFIG_SPARC32) += windows.o 42obj-$(CONFIG_SPARC32) += windows.o
43obj-y += cpu.o 43obj-y += cpu.o
44obj-$(CONFIG_SPARC32) += devices.o 44obj-$(CONFIG_SPARC32) += devices.o
45obj-$(CONFIG_SPARC32) += tadpole.o
46obj-y += ptrace_$(BITS).o 45obj-y += ptrace_$(BITS).o
47obj-y += unaligned_$(BITS).o 46obj-y += unaligned_$(BITS).o
48obj-y += una_asm_$(BITS).o 47obj-y += una_asm_$(BITS).o
diff --git a/arch/sparc/kernel/audit.c b/arch/sparc/kernel/audit.c
index 8fff0ac63d56..24361b494a93 100644
--- a/arch/sparc/kernel/audit.c
+++ b/arch/sparc/kernel/audit.c
@@ -3,6 +3,8 @@
3#include <linux/audit.h> 3#include <linux/audit.h>
4#include <asm/unistd.h> 4#include <asm/unistd.h>
5 5
6#include "kernel.h"
7
6static unsigned dir_class[] = { 8static unsigned dir_class[] = {
7#include <asm-generic/audit_dir_write.h> 9#include <asm-generic/audit_dir_write.h>
8~0U 10~0U
@@ -40,7 +42,6 @@ int audit_classify_arch(int arch)
40int audit_classify_syscall(int abi, unsigned syscall) 42int audit_classify_syscall(int abi, unsigned syscall)
41{ 43{
42#ifdef CONFIG_COMPAT 44#ifdef CONFIG_COMPAT
43 extern int sparc32_classify_syscall(unsigned);
44 if (abi == AUDIT_ARCH_SPARC) 45 if (abi == AUDIT_ARCH_SPARC)
45 return sparc32_classify_syscall(syscall); 46 return sparc32_classify_syscall(syscall);
46#endif 47#endif
@@ -61,11 +62,6 @@ int audit_classify_syscall(int abi, unsigned syscall)
61static int __init audit_classes_init(void) 62static int __init audit_classes_init(void)
62{ 63{
63#ifdef CONFIG_COMPAT 64#ifdef CONFIG_COMPAT
64 extern __u32 sparc32_dir_class[];
65 extern __u32 sparc32_write_class[];
66 extern __u32 sparc32_read_class[];
67 extern __u32 sparc32_chattr_class[];
68 extern __u32 sparc32_signal_class[];
69 audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class); 65 audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class);
70 audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class); 66 audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class);
71 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class); 67 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class);
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
index e20cc55fb768..ae88c223e4d3 100644
--- a/arch/sparc/kernel/auxio_32.c
+++ b/arch/sparc/kernel/auxio_32.c
@@ -9,12 +9,15 @@
9#include <linux/of.h> 9#include <linux/of.h>
10#include <linux/of_device.h> 10#include <linux/of_device.h>
11#include <linux/export.h> 11#include <linux/export.h>
12
12#include <asm/oplib.h> 13#include <asm/oplib.h>
13#include <asm/io.h> 14#include <asm/io.h>
14#include <asm/auxio.h> 15#include <asm/auxio.h>
15#include <asm/string.h> /* memset(), Linux has no bzero() */ 16#include <asm/string.h> /* memset(), Linux has no bzero() */
16#include <asm/cpu_type.h> 17#include <asm/cpu_type.h>
17 18
19#include "kernel.h"
20
18/* Probe and map in the Auxiliary I/O register */ 21/* Probe and map in the Auxiliary I/O register */
19 22
20/* auxio_register is not static because it is referenced 23/* auxio_register is not static because it is referenced
@@ -103,7 +106,7 @@ EXPORT_SYMBOL(set_auxio);
103 106
104/* sun4m power control register (AUXIO2) */ 107/* sun4m power control register (AUXIO2) */
105 108
106volatile unsigned char * auxio_power_register = NULL; 109volatile u8 __iomem *auxio_power_register = NULL;
107 110
108void __init auxio_power_probe(void) 111void __init auxio_power_probe(void)
109{ 112{
@@ -127,8 +130,8 @@ void __init auxio_power_probe(void)
127 r.flags = regs.which_io & 0xF; 130 r.flags = regs.which_io & 0xF;
128 r.start = regs.phys_addr; 131 r.start = regs.phys_addr;
129 r.end = regs.phys_addr + regs.reg_size - 1; 132 r.end = regs.phys_addr + regs.reg_size - 1;
130 auxio_power_register = (unsigned char *) of_ioremap(&r, 0, 133 auxio_power_register =
131 regs.reg_size, "auxpower"); 134 (u8 __iomem *)of_ioremap(&r, 0, regs.reg_size, "auxpower");
132 135
133 /* Display a quick message on the console. */ 136 /* Display a quick message on the console. */
134 if (auxio_power_register) 137 if (auxio_power_register)
diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c
index 57073e56ba9e..987f7ec497cc 100644
--- a/arch/sparc/kernel/btext.c
+++ b/arch/sparc/kernel/btext.c
@@ -137,7 +137,7 @@ static void scrollscreen(void)
137} 137}
138#endif /* ndef NO_SCROLL */ 138#endif /* ndef NO_SCROLL */
139 139
140void btext_drawchar(char c) 140static void btext_drawchar(char c)
141{ 141{
142 int cline = 0; 142 int cline = 0;
143#ifdef NO_SCROLL 143#ifdef NO_SCROLL
diff --git a/arch/sparc/kernel/compat_audit.c b/arch/sparc/kernel/compat_audit.c
index d865575b25bf..7062263d09c1 100644
--- a/arch/sparc/kernel/compat_audit.c
+++ b/arch/sparc/kernel/compat_audit.c
@@ -1,5 +1,6 @@
1#define __32bit_syscall_numbers__ 1#define __32bit_syscall_numbers__
2#include <asm/unistd.h> 2#include <asm/unistd.h>
3#include "kernel.h"
3 4
4unsigned sparc32_dir_class[] = { 5unsigned sparc32_dir_class[] = {
5#include <asm-generic/audit_dir_write.h> 6#include <asm-generic/audit_dir_write.h>
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 5c5125895db8..82a3a71c451e 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -22,6 +22,7 @@
22#include <asm/cpudata.h> 22#include <asm/cpudata.h>
23 23
24#include "kernel.h" 24#include "kernel.h"
25#include "entry.h"
25 26
26DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; 27DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
27EXPORT_PER_CPU_SYMBOL(__cpu_data); 28EXPORT_PER_CPU_SYMBOL(__cpu_data);
diff --git a/arch/sparc/kernel/cpumap.h b/arch/sparc/kernel/cpumap.h
index e639880ab864..9dac398c434a 100644
--- a/arch/sparc/kernel/cpumap.h
+++ b/arch/sparc/kernel/cpumap.h
@@ -2,8 +2,8 @@
2#define _CPUMAP_H 2#define _CPUMAP_H
3 3
4#ifdef CONFIG_SMP 4#ifdef CONFIG_SMP
5extern void cpu_map_rebuild(void); 5void cpu_map_rebuild(void);
6extern int map_to_cpu(unsigned int index); 6int map_to_cpu(unsigned int index);
7#define cpu_map_init() cpu_map_rebuild() 7#define cpu_map_init() cpu_map_rebuild()
8#else 8#else
9#define cpu_map_init() do {} while (0) 9#define cpu_map_init() do {} while (0)
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index 3d465e87f7e2..8d5d09f09caf 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -19,8 +19,9 @@
19#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/cpudata.h> 20#include <asm/cpudata.h>
21#include <asm/cpu_type.h> 21#include <asm/cpu_type.h>
22#include <asm/setup.h>
22 23
23extern void clock_stop_probe(void); /* tadpole.c */ 24#include "kernel.h"
24 25
25static char *cpu_mid_prop(void) 26static char *cpu_mid_prop(void)
26{ 27{
@@ -131,11 +132,6 @@ void __init device_scan(void)
131 } 132 }
132#endif /* !CONFIG_SMP */ 133#endif /* !CONFIG_SMP */
133 134
134 { 135 auxio_probe();
135 extern void auxio_probe(void); 136 auxio_power_probe();
136 extern void auxio_power_probe(void);
137 auxio_probe();
138 auxio_power_probe();
139 }
140 clock_stop_probe();
141} 137}
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index 140966fbd303..ebaba6167dd4 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -6,40 +6,39 @@
6#include <linux/init.h> 6#include <linux/init.h>
7 7
8/* irq */ 8/* irq */
9extern void handler_irq(int irq, struct pt_regs *regs); 9void handler_irq(int irq, struct pt_regs *regs);
10 10
11#ifdef CONFIG_SPARC32 11#ifdef CONFIG_SPARC32
12/* traps */ 12/* traps */
13extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type); 13void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
14extern void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, 14void do_illegal_instruction(struct pt_regs *regs, unsigned long pc,
15 unsigned long npc, unsigned long psr); 15 unsigned long npc, unsigned long psr);
16 16
17extern void do_priv_instruction(struct pt_regs *regs, unsigned long pc, 17void do_priv_instruction(struct pt_regs *regs, unsigned long pc,
18 unsigned long npc, unsigned long psr); 18 unsigned long npc, unsigned long psr);
19extern void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, 19void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc,
20 unsigned long npc, 20 unsigned long npc, unsigned long psr);
21 unsigned long psr); 21void do_fpd_trap(struct pt_regs *regs, unsigned long pc,
22extern void do_fpd_trap(struct pt_regs *regs, unsigned long pc, 22 unsigned long npc, unsigned long psr);
23void do_fpe_trap(struct pt_regs *regs, unsigned long pc,
24 unsigned long npc, unsigned long psr);
25void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
26 unsigned long npc, unsigned long psr);
27void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
28 unsigned long npc, unsigned long psr);
29void handle_reg_access(struct pt_regs *regs, unsigned long pc,
30 unsigned long npc, unsigned long psr);
31void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
23 unsigned long npc, unsigned long psr); 32 unsigned long npc, unsigned long psr);
24extern void do_fpe_trap(struct pt_regs *regs, unsigned long pc, 33void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
25 unsigned long npc, unsigned long psr); 34 unsigned long npc, unsigned long psr);
26extern void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
27 unsigned long npc, unsigned long psr);
28extern void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
29 unsigned long npc, unsigned long psr);
30extern void handle_reg_access(struct pt_regs *regs, unsigned long pc,
31 unsigned long npc, unsigned long psr);
32extern void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
33 unsigned long npc, unsigned long psr);
34extern void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
35 unsigned long npc, unsigned long psr);
36 35
37 36
38 37
39/* entry.S */ 38/* entry.S */
40extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 39void fpsave(unsigned long *fpregs, unsigned long *fsr,
41 void *fpqueue, unsigned long *fpqdepth); 40 void *fpqueue, unsigned long *fpqdepth);
42extern void fpload(unsigned long *fpregs, unsigned long *fsr); 41void fpload(unsigned long *fpregs, unsigned long *fsr);
43 42
44#else /* CONFIG_SPARC32 */ 43#else /* CONFIG_SPARC32 */
45 44
@@ -66,123 +65,123 @@ struct pause_patch_entry {
66extern struct pause_patch_entry __pause_3insn_patch, 65extern struct pause_patch_entry __pause_3insn_patch,
67 __pause_3insn_patch_end; 66 __pause_3insn_patch_end;
68 67
69extern void __init per_cpu_patch(void); 68void __init per_cpu_patch(void);
70extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, 69void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
71 struct sun4v_1insn_patch_entry *); 70 struct sun4v_1insn_patch_entry *);
72extern void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, 71void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *,
73 struct sun4v_2insn_patch_entry *); 72 struct sun4v_2insn_patch_entry *);
74extern void __init sun4v_patch(void); 73void __init sun4v_patch(void);
75extern void __init boot_cpu_id_too_large(int cpu); 74void __init boot_cpu_id_too_large(int cpu);
76extern unsigned int dcache_parity_tl1_occurred; 75extern unsigned int dcache_parity_tl1_occurred;
77extern unsigned int icache_parity_tl1_occurred; 76extern unsigned int icache_parity_tl1_occurred;
78 77
79extern asmlinkage void sparc_breakpoint(struct pt_regs *regs); 78asmlinkage void sparc_breakpoint(struct pt_regs *regs);
80extern void timer_interrupt(int irq, struct pt_regs *regs); 79void timer_interrupt(int irq, struct pt_regs *regs);
81 80
82extern void do_notify_resume(struct pt_regs *regs, 81void do_notify_resume(struct pt_regs *regs,
83 unsigned long orig_i0, 82 unsigned long orig_i0,
84 unsigned long thread_info_flags); 83 unsigned long thread_info_flags);
85 84
86extern asmlinkage int syscall_trace_enter(struct pt_regs *regs); 85asmlinkage int syscall_trace_enter(struct pt_regs *regs);
87extern asmlinkage void syscall_trace_leave(struct pt_regs *regs); 86asmlinkage void syscall_trace_leave(struct pt_regs *regs);
88 87
89extern void bad_trap_tl1(struct pt_regs *regs, long lvl); 88void bad_trap_tl1(struct pt_regs *regs, long lvl);
90 89
91extern void do_fpieee(struct pt_regs *regs); 90void do_fpieee(struct pt_regs *regs);
92extern void do_fpother(struct pt_regs *regs); 91void do_fpother(struct pt_regs *regs);
93extern void do_tof(struct pt_regs *regs); 92void do_tof(struct pt_regs *regs);
94extern void do_div0(struct pt_regs *regs); 93void do_div0(struct pt_regs *regs);
95extern void do_illegal_instruction(struct pt_regs *regs); 94void do_illegal_instruction(struct pt_regs *regs);
96extern void mem_address_unaligned(struct pt_regs *regs, 95void mem_address_unaligned(struct pt_regs *regs,
97 unsigned long sfar, 96 unsigned long sfar,
98 unsigned long sfsr); 97 unsigned long sfsr);
99extern void sun4v_do_mna(struct pt_regs *regs, 98void sun4v_do_mna(struct pt_regs *regs,
100 unsigned long addr, 99 unsigned long addr,
101 unsigned long type_ctx); 100 unsigned long type_ctx);
102extern void do_privop(struct pt_regs *regs); 101void do_privop(struct pt_regs *regs);
103extern void do_privact(struct pt_regs *regs); 102void do_privact(struct pt_regs *regs);
104extern void do_cee(struct pt_regs *regs); 103void do_cee(struct pt_regs *regs);
105extern void do_cee_tl1(struct pt_regs *regs); 104void do_cee_tl1(struct pt_regs *regs);
106extern void do_dae_tl1(struct pt_regs *regs); 105void do_dae_tl1(struct pt_regs *regs);
107extern void do_iae_tl1(struct pt_regs *regs); 106void do_iae_tl1(struct pt_regs *regs);
108extern void do_div0_tl1(struct pt_regs *regs); 107void do_div0_tl1(struct pt_regs *regs);
109extern void do_fpdis_tl1(struct pt_regs *regs); 108void do_fpdis_tl1(struct pt_regs *regs);
110extern void do_fpieee_tl1(struct pt_regs *regs); 109void do_fpieee_tl1(struct pt_regs *regs);
111extern void do_fpother_tl1(struct pt_regs *regs); 110void do_fpother_tl1(struct pt_regs *regs);
112extern void do_ill_tl1(struct pt_regs *regs); 111void do_ill_tl1(struct pt_regs *regs);
113extern void do_irq_tl1(struct pt_regs *regs); 112void do_irq_tl1(struct pt_regs *regs);
114extern void do_lddfmna_tl1(struct pt_regs *regs); 113void do_lddfmna_tl1(struct pt_regs *regs);
115extern void do_stdfmna_tl1(struct pt_regs *regs); 114void do_stdfmna_tl1(struct pt_regs *regs);
116extern void do_paw(struct pt_regs *regs); 115void do_paw(struct pt_regs *regs);
117extern void do_paw_tl1(struct pt_regs *regs); 116void do_paw_tl1(struct pt_regs *regs);
118extern void do_vaw(struct pt_regs *regs); 117void do_vaw(struct pt_regs *regs);
119extern void do_vaw_tl1(struct pt_regs *regs); 118void do_vaw_tl1(struct pt_regs *regs);
120extern void do_tof_tl1(struct pt_regs *regs); 119void do_tof_tl1(struct pt_regs *regs);
121extern void do_getpsr(struct pt_regs *regs); 120void do_getpsr(struct pt_regs *regs);
122 121
123extern void spitfire_insn_access_exception(struct pt_regs *regs, 122void spitfire_insn_access_exception(struct pt_regs *regs,
124 unsigned long sfsr, 123 unsigned long sfsr,
125 unsigned long sfar); 124 unsigned long sfar);
126extern void spitfire_insn_access_exception_tl1(struct pt_regs *regs, 125void spitfire_insn_access_exception_tl1(struct pt_regs *regs,
127 unsigned long sfsr, 126 unsigned long sfsr,
128 unsigned long sfar); 127 unsigned long sfar);
129extern void spitfire_data_access_exception(struct pt_regs *regs, 128void spitfire_data_access_exception(struct pt_regs *regs,
130 unsigned long sfsr, 129 unsigned long sfsr,
131 unsigned long sfar); 130 unsigned long sfar);
132extern void spitfire_data_access_exception_tl1(struct pt_regs *regs, 131void spitfire_data_access_exception_tl1(struct pt_regs *regs,
133 unsigned long sfsr, 132 unsigned long sfsr,
134 unsigned long sfar); 133 unsigned long sfar);
135extern void spitfire_access_error(struct pt_regs *regs, 134void spitfire_access_error(struct pt_regs *regs,
136 unsigned long status_encoded, 135 unsigned long status_encoded,
137 unsigned long afar); 136 unsigned long afar);
138 137
139extern void cheetah_fecc_handler(struct pt_regs *regs, 138void cheetah_fecc_handler(struct pt_regs *regs,
140 unsigned long afsr, 139 unsigned long afsr,
141 unsigned long afar); 140 unsigned long afar);
142extern void cheetah_cee_handler(struct pt_regs *regs, 141void cheetah_cee_handler(struct pt_regs *regs,
143 unsigned long afsr, 142 unsigned long afsr,
144 unsigned long afar); 143 unsigned long afar);
145extern void cheetah_deferred_handler(struct pt_regs *regs, 144void cheetah_deferred_handler(struct pt_regs *regs,
146 unsigned long afsr, 145 unsigned long afsr,
147 unsigned long afar); 146 unsigned long afar);
148extern void cheetah_plus_parity_error(int type, struct pt_regs *regs); 147void cheetah_plus_parity_error(int type, struct pt_regs *regs);
149 148
150extern void sun4v_insn_access_exception(struct pt_regs *regs, 149void sun4v_insn_access_exception(struct pt_regs *regs,
151 unsigned long addr, 150 unsigned long addr,
152 unsigned long type_ctx); 151 unsigned long type_ctx);
153extern void sun4v_insn_access_exception_tl1(struct pt_regs *regs, 152void sun4v_insn_access_exception_tl1(struct pt_regs *regs,
154 unsigned long addr, 153 unsigned long addr,
155 unsigned long type_ctx); 154 unsigned long type_ctx);
156extern void sun4v_data_access_exception(struct pt_regs *regs, 155void sun4v_data_access_exception(struct pt_regs *regs,
157 unsigned long addr, 156 unsigned long addr,
158 unsigned long type_ctx); 157 unsigned long type_ctx);
159extern void sun4v_data_access_exception_tl1(struct pt_regs *regs, 158void sun4v_data_access_exception_tl1(struct pt_regs *regs,
160 unsigned long addr, 159 unsigned long addr,
161 unsigned long type_ctx); 160 unsigned long type_ctx);
162extern void sun4v_resum_error(struct pt_regs *regs, 161void sun4v_resum_error(struct pt_regs *regs,
163 unsigned long offset); 162 unsigned long offset);
164extern void sun4v_resum_overflow(struct pt_regs *regs); 163void sun4v_resum_overflow(struct pt_regs *regs);
165extern void sun4v_nonresum_error(struct pt_regs *regs, 164void sun4v_nonresum_error(struct pt_regs *regs,
166 unsigned long offset); 165 unsigned long offset);
167extern void sun4v_nonresum_overflow(struct pt_regs *regs); 166void sun4v_nonresum_overflow(struct pt_regs *regs);
168 167
169extern unsigned long sun4v_err_itlb_vaddr; 168extern unsigned long sun4v_err_itlb_vaddr;
170extern unsigned long sun4v_err_itlb_ctx; 169extern unsigned long sun4v_err_itlb_ctx;
171extern unsigned long sun4v_err_itlb_pte; 170extern unsigned long sun4v_err_itlb_pte;
172extern unsigned long sun4v_err_itlb_error; 171extern unsigned long sun4v_err_itlb_error;
173 172
174extern void sun4v_itlb_error_report(struct pt_regs *regs, int tl); 173void sun4v_itlb_error_report(struct pt_regs *regs, int tl);
175 174
176extern unsigned long sun4v_err_dtlb_vaddr; 175extern unsigned long sun4v_err_dtlb_vaddr;
177extern unsigned long sun4v_err_dtlb_ctx; 176extern unsigned long sun4v_err_dtlb_ctx;
178extern unsigned long sun4v_err_dtlb_pte; 177extern unsigned long sun4v_err_dtlb_pte;
179extern unsigned long sun4v_err_dtlb_error; 178extern unsigned long sun4v_err_dtlb_error;
180 179
181extern void sun4v_dtlb_error_report(struct pt_regs *regs, int tl); 180void sun4v_dtlb_error_report(struct pt_regs *regs, int tl);
182extern void hypervisor_tlbop_error(unsigned long err, 181void hypervisor_tlbop_error(unsigned long err,
183 unsigned long op); 182 unsigned long op);
184extern void hypervisor_tlbop_error_xcall(unsigned long err, 183void hypervisor_tlbop_error_xcall(unsigned long err,
185 unsigned long op); 184 unsigned long op);
186 185
187/* WARNING: The error trap handlers in assembly know the precise 186/* WARNING: The error trap handlers in assembly know the precise
188 * layout of the following structure. 187 * layout of the following structure.
@@ -248,8 +247,8 @@ struct ino_bucket {
248extern struct ino_bucket *ivector_table; 247extern struct ino_bucket *ivector_table;
249extern unsigned long ivector_table_pa; 248extern unsigned long ivector_table_pa;
250 249
251extern void init_irqwork_curcpu(void); 250void init_irqwork_curcpu(void);
252extern void sun4v_register_mondo_queues(int this_cpu); 251void sun4v_register_mondo_queues(int this_cpu);
253 252
254#endif /* CONFIG_SPARC32 */ 253#endif /* CONFIG_SPARC32 */
255#endif /* _ENTRY_H */ 254#endif /* _ENTRY_H */
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 76663b019eb5..bfa4d0c2df42 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -21,6 +21,7 @@
21#include <asm/iommu.h> 21#include <asm/iommu.h>
22 22
23#include "iommu_common.h" 23#include "iommu_common.h"
24#include "kernel.h"
24 25
25#define STC_CTXMATCH_ADDR(STC, CTX) \ 26#define STC_CTXMATCH_ADDR(STC, CTX) \
26 ((STC)->strbuf_ctxmatch_base + ((CTX) << 3)) 27 ((STC)->strbuf_ctxmatch_base + ((CTX) << 3))
@@ -840,8 +841,6 @@ static struct dma_map_ops sun4u_dma_ops = {
840struct dma_map_ops *dma_ops = &sun4u_dma_ops; 841struct dma_map_ops *dma_ops = &sun4u_dma_ops;
841EXPORT_SYMBOL(dma_ops); 842EXPORT_SYMBOL(dma_ops);
842 843
843extern int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask);
844
845int dma_supported(struct device *dev, u64 device_mask) 844int dma_supported(struct device *dev, u64 device_mask)
846{ 845{
847 struct iommu *iommu = dev->archdata.iommu; 846 struct iommu *iommu = dev->archdata.iommu;
diff --git a/arch/sparc/kernel/iommu_common.h b/arch/sparc/kernel/iommu_common.h
index 591f5879039c..1ec0de4156e7 100644
--- a/arch/sparc/kernel/iommu_common.h
+++ b/arch/sparc/kernel/iommu_common.h
@@ -48,12 +48,12 @@ static inline int is_span_boundary(unsigned long entry,
48 return iommu_is_span_boundary(entry, nr, shift, boundary_size); 48 return iommu_is_span_boundary(entry, nr, shift, boundary_size);
49} 49}
50 50
51extern unsigned long iommu_range_alloc(struct device *dev, 51unsigned long iommu_range_alloc(struct device *dev,
52 struct iommu *iommu, 52 struct iommu *iommu,
53 unsigned long npages, 53 unsigned long npages,
54 unsigned long *handle); 54 unsigned long *handle);
55extern void iommu_range_free(struct iommu *iommu, 55void iommu_range_free(struct iommu *iommu,
56 dma_addr_t dma_addr, 56 dma_addr_t dma_addr,
57 unsigned long npages); 57 unsigned long npages);
58 58
59#endif /* _IOMMU_COMMON_H */ 59#endif /* _IOMMU_COMMON_H */
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index e7e215dfa866..7f08ec8a7c68 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -186,7 +186,7 @@ static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
186 186
187 if (name == NULL) name = "???"; 187 if (name == NULL) name = "???";
188 188
189 if ((xres = xres_alloc()) != 0) { 189 if ((xres = xres_alloc()) != NULL) {
190 tack = xres->xname; 190 tack = xres->xname;
191 res = &xres->xres; 191 res = &xres->xres;
192 } else { 192 } else {
@@ -400,7 +400,7 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
400 BUG(); 400 BUG();
401} 401}
402 402
403struct dma_map_ops sbus_dma_ops = { 403static struct dma_map_ops sbus_dma_ops = {
404 .alloc = sbus_alloc_coherent, 404 .alloc = sbus_alloc_coherent,
405 .free = sbus_free_coherent, 405 .free = sbus_free_coherent,
406 .map_page = sbus_map_page, 406 .map_page = sbus_map_page,
@@ -681,7 +681,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v)
681 const char *nm; 681 const char *nm;
682 682
683 for (r = root->child; r != NULL; r = r->sibling) { 683 for (r = root->child; r != NULL; r = r->sibling) {
684 if ((nm = r->name) == 0) nm = "???"; 684 if ((nm = r->name) == NULL) nm = "???";
685 seq_printf(m, "%016llx-%016llx: %s\n", 685 seq_printf(m, "%016llx-%016llx: %s\n",
686 (unsigned long long)r->start, 686 (unsigned long long)r->start,
687 (unsigned long long)r->end, nm); 687 (unsigned long long)r->end, nm);
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h
index b66b6aad1d6d..70a0b8ddd0ba 100644
--- a/arch/sparc/kernel/irq.h
+++ b/arch/sparc/kernel/irq.h
@@ -82,11 +82,20 @@ void handler_irq(unsigned int pil, struct pt_regs *regs);
82 82
83unsigned long leon_get_irqmask(unsigned int irq); 83unsigned long leon_get_irqmask(unsigned int irq);
84 84
85/* irq_32.c */
86void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs);
87
88/* sun4m_irq.c */
89void sun4m_nmi(struct pt_regs *regs);
90
91/* sun4d_irq.c */
92void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs);
93
85#ifdef CONFIG_SMP 94#ifdef CONFIG_SMP
86 95
87/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ 96/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
88#define SUN4D_IPI_IRQ 13 97#define SUN4D_IPI_IRQ 13
89 98
90extern void sun4d_ipi_interrupt(void); 99void sun4d_ipi_interrupt(void);
91 100
92#endif 101#endif
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index c145f6fd123b..a979e99f8751 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/cpudata.h> 19#include <asm/cpudata.h>
20#include <asm/setup.h>
20#include <asm/pcic.h> 21#include <asm/pcic.h>
21#include <asm/leon.h> 22#include <asm/leon.h>
22 23
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index a702d9ab019c..e7f652be9e61 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -2,6 +2,7 @@
2#define __SPARC_KERNEL_H 2#define __SPARC_KERNEL_H
3 3
4#include <linux/interrupt.h> 4#include <linux/interrupt.h>
5#include <linux/ftrace.h>
5 6
6#include <asm/traps.h> 7#include <asm/traps.h>
7#include <asm/head.h> 8#include <asm/head.h>
@@ -15,62 +16,111 @@ extern int ncpus_probed;
15#ifdef CONFIG_SPARC64 16#ifdef CONFIG_SPARC64
16/* setup_64.c */ 17/* setup_64.c */
17struct seq_file; 18struct seq_file;
18extern void cpucap_info(struct seq_file *); 19void cpucap_info(struct seq_file *);
19 20
20static inline unsigned long kimage_addr_to_ra(const char *p) 21static inline unsigned long kimage_addr_to_ra(const void *p)
21{ 22{
22 unsigned long val = (unsigned long) p; 23 unsigned long val = (unsigned long) p;
23 24
24 return kern_base + (val - KERNBASE); 25 return kern_base + (val - KERNBASE);
25} 26}
27
28/* sys_sparc_64.c */
29asmlinkage long sys_kern_features(void);
30
31/* unaligned_64.c */
32asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
33int handle_popc(u32 insn, struct pt_regs *regs);
34void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr);
35void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr);
36
37/* smp_64.c */
38void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs);
39void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs);
40void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs);
41void __irq_entry smp_penguin_jailcell(int irq, struct pt_regs *regs);
42void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs);
43
44/* kgdb_64.c */
45void __irq_entry smp_kgdb_capture_client(int irq, struct pt_regs *regs);
46
47/* pci.c */
48int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask);
49
50/* signal32.c */
51void do_sigreturn32(struct pt_regs *regs);
52asmlinkage void do_rt_sigreturn32(struct pt_regs *regs);
53void do_signal32(struct pt_regs * regs);
54asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp);
55
56/* compat_audit.c */
57extern unsigned sparc32_dir_class[];
58extern unsigned sparc32_chattr_class[];
59extern unsigned sparc32_write_class[];
60extern unsigned sparc32_read_class[];
61extern unsigned sparc32_signal_class[];
62int sparc32_classify_syscall(unsigned syscall);
26#endif 63#endif
27 64
28#ifdef CONFIG_SPARC32 65#ifdef CONFIG_SPARC32
29/* setup_32.c */ 66/* setup_32.c */
67struct linux_romvec;
30void sparc32_start_kernel(struct linux_romvec *rp); 68void sparc32_start_kernel(struct linux_romvec *rp);
31 69
32/* cpu.c */ 70/* cpu.c */
33extern void cpu_probe(void); 71void cpu_probe(void);
34 72
35/* traps_32.c */ 73/* traps_32.c */
36extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, 74void handle_hw_divzero(struct pt_regs *regs, unsigned long pc,
37 unsigned long npc, unsigned long psr); 75 unsigned long npc, unsigned long psr);
38/* irq_32.c */ 76/* irq_32.c */
39extern struct irqaction static_irqaction[]; 77extern struct irqaction static_irqaction[];
40extern int static_irq_count; 78extern int static_irq_count;
41extern spinlock_t irq_action_lock; 79extern spinlock_t irq_action_lock;
42 80
43extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); 81void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs);
44extern void init_IRQ(void); 82void init_IRQ(void);
45 83
46/* sun4m_irq.c */ 84/* sun4m_irq.c */
47extern void sun4m_init_IRQ(void); 85void sun4m_init_IRQ(void);
48extern void sun4m_unmask_profile_irq(void); 86void sun4m_unmask_profile_irq(void);
49extern void sun4m_clear_profile_irq(int cpu); 87void sun4m_clear_profile_irq(int cpu);
50 88
51/* sun4m_smp.c */ 89/* sun4m_smp.c */
52void sun4m_cpu_pre_starting(void *arg); 90void sun4m_cpu_pre_starting(void *arg);
53void sun4m_cpu_pre_online(void *arg); 91void sun4m_cpu_pre_online(void *arg);
92void __init smp4m_boot_cpus(void);
93int smp4m_boot_one_cpu(int i, struct task_struct *idle);
94void __init smp4m_smp_done(void);
95void smp4m_cross_call_irq(void);
96void smp4m_percpu_timer_interrupt(struct pt_regs *regs);
54 97
55/* sun4d_irq.c */ 98/* sun4d_irq.c */
56extern spinlock_t sun4d_imsk_lock; 99extern spinlock_t sun4d_imsk_lock;
57 100
58extern void sun4d_init_IRQ(void); 101void sun4d_init_IRQ(void);
59extern int sun4d_request_irq(unsigned int irq, 102int sun4d_request_irq(unsigned int irq,
60 irq_handler_t handler, 103 irq_handler_t handler,
61 unsigned long irqflags, 104 unsigned long irqflags,
62 const char *devname, void *dev_id); 105 const char *devname, void *dev_id);
63extern int show_sun4d_interrupts(struct seq_file *, void *); 106int show_sun4d_interrupts(struct seq_file *, void *);
64extern void sun4d_distribute_irqs(void); 107void sun4d_distribute_irqs(void);
65extern void sun4d_free_irq(unsigned int irq, void *dev_id); 108void sun4d_free_irq(unsigned int irq, void *dev_id);
66 109
67/* sun4d_smp.c */ 110/* sun4d_smp.c */
68void sun4d_cpu_pre_starting(void *arg); 111void sun4d_cpu_pre_starting(void *arg);
69void sun4d_cpu_pre_online(void *arg); 112void sun4d_cpu_pre_online(void *arg);
113void __init smp4d_boot_cpus(void);
114int smp4d_boot_one_cpu(int i, struct task_struct *idle);
115void __init smp4d_smp_done(void);
116void smp4d_cross_call_irq(void);
117void smp4d_percpu_timer_interrupt(struct pt_regs *regs);
70 118
71/* leon_smp.c */ 119/* leon_smp.c */
72void leon_cpu_pre_starting(void *arg); 120void leon_cpu_pre_starting(void *arg);
73void leon_cpu_pre_online(void *arg); 121void leon_cpu_pre_online(void *arg);
122void leonsmp_ipi_interrupt(void);
123void leon_cross_call_irq(void);
74 124
75/* head_32.S */ 125/* head_32.S */
76extern unsigned int t_nmi[]; 126extern unsigned int t_nmi[];
@@ -89,12 +139,48 @@ extern unsigned int real_irq_entry[];
89extern unsigned int smp4d_ticker[]; 139extern unsigned int smp4d_ticker[];
90extern unsigned int patchme_maybe_smp_msg[]; 140extern unsigned int patchme_maybe_smp_msg[];
91 141
92extern void floppy_hardint(void); 142void floppy_hardint(void);
93 143
94/* trampoline_32.S */ 144/* trampoline_32.S */
95extern unsigned long sun4m_cpu_startup; 145extern unsigned long sun4m_cpu_startup;
96extern unsigned long sun4d_cpu_startup; 146extern unsigned long sun4d_cpu_startup;
97 147
148/* process_32.c */
149asmlinkage int sparc_do_fork(unsigned long clone_flags,
150 unsigned long stack_start,
151 struct pt_regs *regs,
152 unsigned long stack_size);
153
154/* signal_32.c */
155asmlinkage void do_sigreturn(struct pt_regs *regs);
156asmlinkage void do_rt_sigreturn(struct pt_regs *regs);
157void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
158 unsigned long thread_info_flags);
159asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
160 struct sigstack __user *ossptr,
161 unsigned long sp);
162
163/* ptrace_32.c */
164asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p);
165
166/* unaligned_32.c */
167asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
168asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn);
169
170/* windows.c */
171void try_to_clear_window_buffer(struct pt_regs *regs, int who);
172
173/* auxio_32.c */
174void __init auxio_probe(void);
175void __init auxio_power_probe(void);
176
177/* pcic.c */
178extern void __iomem *pcic_regs;
179void pcic_nmi(unsigned int pend, struct pt_regs *regs);
180
181/* time_32.c */
182void __init time_init(void);
183
98#else /* CONFIG_SPARC32 */ 184#else /* CONFIG_SPARC32 */
99#endif /* CONFIG_SPARC32 */ 185#endif /* CONFIG_SPARC32 */
100#endif /* !(__SPARC_KERNEL_H) */ 186#endif /* !(__SPARC_KERNEL_H) */
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c
index b45fe3fb4d2c..cbf21d0870e0 100644
--- a/arch/sparc/kernel/kgdb_64.c
+++ b/arch/sparc/kernel/kgdb_64.c
@@ -13,6 +13,8 @@
13#include <asm/ptrace.h> 13#include <asm/ptrace.h>
14#include <asm/irq.h> 14#include <asm/irq.h>
15 15
16#include "kernel.h"
17
16void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 18void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
17{ 19{
18 struct reg_window *win; 20 struct reg_window *win;
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 1b0973503197..98d712843413 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -512,7 +512,8 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
512/* 512/*
513 * Called when the probe at kretprobe trampoline is hit 513 * Called when the probe at kretprobe trampoline is hit
514 */ 514 */
515int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 515static int __kprobes trampoline_probe_handler(struct kprobe *p,
516 struct pt_regs *regs)
516{ 517{
517 struct kretprobe_instance *ri = NULL; 518 struct kretprobe_instance *ri = NULL;
518 struct hlist_head *head, empty_rp; 519 struct hlist_head *head, empty_rp;
@@ -576,7 +577,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
576 return 1; 577 return 1;
577} 578}
578 579
579void kretprobe_trampoline_holder(void) 580static void __used kretprobe_trampoline_holder(void)
580{ 581{
581 asm volatile(".global kretprobe_trampoline\n" 582 asm volatile(".global kretprobe_trampoline\n"
582 "kretprobe_trampoline:\n" 583 "kretprobe_trampoline:\n"
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index b7c68976cbc7..683c4af999de 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -32,12 +32,12 @@ struct leon3_gptimer_regs_map *leon3_gptimer_regs; /* timer controller base addr
32 32
33int leondebug_irq_disable; 33int leondebug_irq_disable;
34int leon_debug_irqout; 34int leon_debug_irqout;
35static int dummy_master_l10_counter; 35static volatile u32 dummy_master_l10_counter;
36unsigned long amba_system_id; 36unsigned long amba_system_id;
37static DEFINE_SPINLOCK(leon_irq_lock); 37static DEFINE_SPINLOCK(leon_irq_lock);
38 38
39static unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
39unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ 40unsigned long leon3_gptimer_irq; /* interrupt controller irq number */
40unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
41unsigned int sparc_leon_eirq; 41unsigned int sparc_leon_eirq;
42#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) 42#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu])
43#define LEON_IACK (&leon3_irqctrl_regs->iclear) 43#define LEON_IACK (&leon3_irqctrl_regs->iclear)
@@ -65,7 +65,7 @@ static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)
65} 65}
66 66
67/* The extended IRQ controller has been found, this function registers it */ 67/* The extended IRQ controller has been found, this function registers it */
68void leon_eirq_setup(unsigned int eirq) 68static void leon_eirq_setup(unsigned int eirq)
69{ 69{
70 unsigned long mask, oldmask; 70 unsigned long mask, oldmask;
71 unsigned int veirq; 71 unsigned int veirq;
@@ -270,7 +270,7 @@ static u32 leon_cycles_offset(void)
270#ifdef CONFIG_SMP 270#ifdef CONFIG_SMP
271 271
272/* smp clockevent irq */ 272/* smp clockevent irq */
273irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused) 273static irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused)
274{ 274{
275 struct clock_event_device *ce; 275 struct clock_event_device *ce;
276 int cpu = smp_processor_id(); 276 int cpu = smp_processor_id();
@@ -313,7 +313,7 @@ void __init leon_init_timers(void)
313 313
314 leondebug_irq_disable = 0; 314 leondebug_irq_disable = 0;
315 leon_debug_irqout = 0; 315 leon_debug_irqout = 0;
316 master_l10_counter = (unsigned int *)&dummy_master_l10_counter; 316 master_l10_counter = (u32 __iomem *)&dummy_master_l10_counter;
317 dummy_master_l10_counter = 0; 317 dummy_master_l10_counter = 0;
318 318
319 rootnp = of_find_node_by_path("/ambapp0"); 319 rootnp = of_find_node_by_path("/ambapp0");
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index e16c4157e1ae..899b7203a4e4 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -98,82 +98,3 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
98{ 98{
99 return res->start; 99 return res->start;
100} 100}
101
102/* in/out routines taken from pcic.c
103 *
104 * This probably belongs here rather than ioport.c because
105 * we do not want this crud linked into SBus kernels.
106 * Also, think for a moment about likes of floppy.c that
107 * include architecture specific parts. They may want to redefine ins/outs.
108 *
109 * We do not use horrible macros here because we want to
110 * advance pointer by sizeof(size).
111 */
112void outsb(unsigned long addr, const void *src, unsigned long count)
113{
114 while (count) {
115 count -= 1;
116 outb(*(const char *)src, addr);
117 src += 1;
118 /* addr += 1; */
119 }
120}
121EXPORT_SYMBOL(outsb);
122
123void outsw(unsigned long addr, const void *src, unsigned long count)
124{
125 while (count) {
126 count -= 2;
127 outw(*(const short *)src, addr);
128 src += 2;
129 /* addr += 2; */
130 }
131}
132EXPORT_SYMBOL(outsw);
133
134void outsl(unsigned long addr, const void *src, unsigned long count)
135{
136 while (count) {
137 count -= 4;
138 outl(*(const long *)src, addr);
139 src += 4;
140 /* addr += 4; */
141 }
142}
143EXPORT_SYMBOL(outsl);
144
145void insb(unsigned long addr, void *dst, unsigned long count)
146{
147 while (count) {
148 count -= 1;
149 *(unsigned char *)dst = inb(addr);
150 dst += 1;
151 /* addr += 1; */
152 }
153}
154EXPORT_SYMBOL(insb);
155
156void insw(unsigned long addr, void *dst, unsigned long count)
157{
158 while (count) {
159 count -= 2;
160 *(unsigned short *)dst = inw(addr);
161 dst += 2;
162 /* addr += 2; */
163 }
164}
165EXPORT_SYMBOL(insw);
166
167void insl(unsigned long addr, void *dst, unsigned long count)
168{
169 while (count) {
170 count -= 4;
171 /*
172 * XXX I am sure we are in for an unaligned trap here.
173 */
174 *(unsigned long *)dst = inl(addr);
175 dst += 4;
176 /* addr += 4; */
177 }
178}
179EXPORT_SYMBOL(insl);
diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
index 6df26e37f879..c8bf26edfa7c 100644
--- a/arch/sparc/kernel/leon_pci_grpci1.c
+++ b/arch/sparc/kernel/leon_pci_grpci1.c
@@ -80,7 +80,7 @@ struct grpci1_regs {
80 80
81struct grpci1_priv { 81struct grpci1_priv {
82 struct leon_pci_info info; /* must be on top of this structure */ 82 struct leon_pci_info info; /* must be on top of this structure */
83 struct grpci1_regs *regs; /* GRPCI register map */ 83 struct grpci1_regs __iomem *regs; /* GRPCI register map */
84 struct device *dev; 84 struct device *dev;
85 int pci_err_mask; /* STATUS register error mask */ 85 int pci_err_mask; /* STATUS register error mask */
86 int irq; /* LEON irqctrl GRPCI IRQ */ 86 int irq; /* LEON irqctrl GRPCI IRQ */
@@ -101,7 +101,7 @@ static struct grpci1_priv *grpci1priv;
101static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus, 101static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
102 unsigned int devfn, int where, u32 val); 102 unsigned int devfn, int where, u32 val);
103 103
104int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 104static int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
105{ 105{
106 struct grpci1_priv *priv = dev->bus->sysdata; 106 struct grpci1_priv *priv = dev->bus->sysdata;
107 int irq_group; 107 int irq_group;
@@ -144,7 +144,7 @@ static int grpci1_cfg_r32(struct grpci1_priv *priv, unsigned int bus,
144 grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp); 144 grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp);
145 } else { 145 } else {
146 /* Bus always little endian (unaffected by byte-swapping) */ 146 /* Bus always little endian (unaffected by byte-swapping) */
147 *val = flip_dword(tmp); 147 *val = swab32(tmp);
148 } 148 }
149 149
150 return 0; 150 return 0;
@@ -197,7 +197,7 @@ static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
197 197
198 pci_conf = (unsigned int *) (priv->pci_conf | 198 pci_conf = (unsigned int *) (priv->pci_conf |
199 (devfn << 8) | (where & 0xfc)); 199 (devfn << 8) | (where & 0xfc));
200 LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); 200 LEON3_BYPASS_STORE_PA(pci_conf, swab32(val));
201 201
202 return 0; 202 return 0;
203} 203}
@@ -417,10 +417,10 @@ out:
417 * BAR1: peripheral DMA to host's memory (size at least 256MByte) 417 * BAR1: peripheral DMA to host's memory (size at least 256MByte)
418 * BAR2..BAR5: not implemented in hardware 418 * BAR2..BAR5: not implemented in hardware
419 */ 419 */
420void grpci1_hw_init(struct grpci1_priv *priv) 420static void grpci1_hw_init(struct grpci1_priv *priv)
421{ 421{
422 u32 ahbadr, bar_sz, data, pciadr; 422 u32 ahbadr, bar_sz, data, pciadr;
423 struct grpci1_regs *regs = priv->regs; 423 struct grpci1_regs __iomem *regs = priv->regs;
424 424
425 /* set 1:1 mapping between AHB -> PCI memory space */ 425 /* set 1:1 mapping between AHB -> PCI memory space */
426 REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000); 426 REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000);
@@ -509,7 +509,7 @@ static irqreturn_t grpci1_err_interrupt(int irq, void *arg)
509 509
510static int grpci1_of_probe(struct platform_device *ofdev) 510static int grpci1_of_probe(struct platform_device *ofdev)
511{ 511{
512 struct grpci1_regs *regs; 512 struct grpci1_regs __iomem *regs;
513 struct grpci1_priv *priv; 513 struct grpci1_priv *priv;
514 int err, len; 514 int err, len;
515 const int *tmp; 515 const int *tmp;
@@ -690,7 +690,7 @@ err3:
690err2: 690err2:
691 release_resource(&priv->info.mem_space); 691 release_resource(&priv->info.mem_space);
692err1: 692err1:
693 iounmap((void *)priv->pci_io_va); 693 iounmap((void __iomem *)priv->pci_io_va);
694 grpci1priv = NULL; 694 grpci1priv = NULL;
695 return err; 695 return err;
696} 696}
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c
index 24d6a4446349..e433a4d69fe0 100644
--- a/arch/sparc/kernel/leon_pci_grpci2.c
+++ b/arch/sparc/kernel/leon_pci_grpci2.c
@@ -191,7 +191,7 @@ struct grpci2_cap_first {
191 191
192struct grpci2_priv { 192struct grpci2_priv {
193 struct leon_pci_info info; /* must be on top of this structure */ 193 struct leon_pci_info info; /* must be on top of this structure */
194 struct grpci2_regs *regs; 194 struct grpci2_regs __iomem *regs;
195 char irq; 195 char irq;
196 char irq_mode; /* IRQ Mode from CAPSTS REG */ 196 char irq_mode; /* IRQ Mode from CAPSTS REG */
197 char bt_enabled; 197 char bt_enabled;
@@ -215,10 +215,10 @@ struct grpci2_priv {
215 struct grpci2_barcfg tgtbars[6]; 215 struct grpci2_barcfg tgtbars[6];
216}; 216};
217 217
218DEFINE_SPINLOCK(grpci2_dev_lock); 218static DEFINE_SPINLOCK(grpci2_dev_lock);
219struct grpci2_priv *grpci2priv; 219static struct grpci2_priv *grpci2priv;
220 220
221int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 221static int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
222{ 222{
223 struct grpci2_priv *priv = dev->bus->sysdata; 223 struct grpci2_priv *priv = dev->bus->sysdata;
224 int irq_group; 224 int irq_group;
@@ -270,7 +270,7 @@ static int grpci2_cfg_r32(struct grpci2_priv *priv, unsigned int bus,
270 *val = 0xffffffff; 270 *val = 0xffffffff;
271 } else { 271 } else {
272 /* Bus always little endian (unaffected by byte-swapping) */ 272 /* Bus always little endian (unaffected by byte-swapping) */
273 *val = flip_dword(tmp); 273 *val = swab32(tmp);
274 } 274 }
275 275
276 return 0; 276 return 0;
@@ -328,7 +328,7 @@ static int grpci2_cfg_w32(struct grpci2_priv *priv, unsigned int bus,
328 328
329 pci_conf = (unsigned int *) (priv->pci_conf | 329 pci_conf = (unsigned int *) (priv->pci_conf |
330 (devfn << 8) | (where & 0xfc)); 330 (devfn << 8) | (where & 0xfc));
331 LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); 331 LEON3_BYPASS_STORE_PA(pci_conf, swab32(val));
332 332
333 /* Wait until GRPCI2 signals that CFG access is done, it should be 333 /* Wait until GRPCI2 signals that CFG access is done, it should be
334 * done instantaneously unless a DMA operation is ongoing... 334 * done instantaneously unless a DMA operation is ongoing...
@@ -561,10 +561,10 @@ out:
561 return virq; 561 return virq;
562} 562}
563 563
564void grpci2_hw_init(struct grpci2_priv *priv) 564static void grpci2_hw_init(struct grpci2_priv *priv)
565{ 565{
566 u32 ahbadr, pciadr, bar_sz, capptr, io_map, data; 566 u32 ahbadr, pciadr, bar_sz, capptr, io_map, data;
567 struct grpci2_regs *regs = priv->regs; 567 struct grpci2_regs __iomem *regs = priv->regs;
568 int i; 568 int i;
569 struct grpci2_barcfg *barcfg = priv->tgtbars; 569 struct grpci2_barcfg *barcfg = priv->tgtbars;
570 570
@@ -655,7 +655,7 @@ static irqreturn_t grpci2_jump_interrupt(int irq, void *arg)
655static irqreturn_t grpci2_err_interrupt(int irq, void *arg) 655static irqreturn_t grpci2_err_interrupt(int irq, void *arg)
656{ 656{
657 struct grpci2_priv *priv = arg; 657 struct grpci2_priv *priv = arg;
658 struct grpci2_regs *regs = priv->regs; 658 struct grpci2_regs __iomem *regs = priv->regs;
659 unsigned int status; 659 unsigned int status;
660 660
661 status = REGLOAD(regs->sts_cap); 661 status = REGLOAD(regs->sts_cap);
@@ -682,7 +682,7 @@ static irqreturn_t grpci2_err_interrupt(int irq, void *arg)
682 682
683static int grpci2_of_probe(struct platform_device *ofdev) 683static int grpci2_of_probe(struct platform_device *ofdev)
684{ 684{
685 struct grpci2_regs *regs; 685 struct grpci2_regs __iomem *regs;
686 struct grpci2_priv *priv; 686 struct grpci2_priv *priv;
687 int err, i, len; 687 int err, i, len;
688 const int *tmp; 688 const int *tmp;
@@ -878,7 +878,7 @@ err4:
878 release_resource(&priv->info.mem_space); 878 release_resource(&priv->info.mem_space);
879err3: 879err3:
880 err = -ENOMEM; 880 err = -ENOMEM;
881 iounmap((void *)priv->pci_io_va); 881 iounmap((void __iomem *)priv->pci_io_va);
882err2: 882err2:
883 kfree(priv); 883 kfree(priv);
884err1: 884err1:
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c
index b0b3967a2dd2..ddcf950282ed 100644
--- a/arch/sparc/kernel/leon_pmc.c
+++ b/arch/sparc/kernel/leon_pmc.c
@@ -12,14 +12,14 @@
12#include <asm/processor.h> 12#include <asm/processor.h>
13 13
14/* List of Systems that need fixup instructions around power-down instruction */ 14/* List of Systems that need fixup instructions around power-down instruction */
15unsigned int pmc_leon_fixup_ids[] = { 15static unsigned int pmc_leon_fixup_ids[] = {
16 AEROFLEX_UT699, 16 AEROFLEX_UT699,
17 GAISLER_GR712RC, 17 GAISLER_GR712RC,
18 LEON4_NEXTREME1, 18 LEON4_NEXTREME1,
19 0 19 0
20}; 20};
21 21
22int pmc_leon_need_fixup(void) 22static int pmc_leon_need_fixup(void)
23{ 23{
24 unsigned int systemid = amba_system_id >> 16; 24 unsigned int systemid = amba_system_id >> 16;
25 unsigned int *id; 25 unsigned int *id;
@@ -38,7 +38,7 @@ int pmc_leon_need_fixup(void)
38 * CPU idle callback function for systems that need some extra handling 38 * CPU idle callback function for systems that need some extra handling
39 * See .../arch/sparc/kernel/process.c 39 * See .../arch/sparc/kernel/process.c
40 */ 40 */
41void pmc_leon_idle_fixup(void) 41static void pmc_leon_idle_fixup(void)
42{ 42{
43 /* Prepare an address to a non-cachable region. APB is always 43 /* Prepare an address to a non-cachable region. APB is always
44 * none-cachable. One instruction is executed after the Sleep 44 * none-cachable. One instruction is executed after the Sleep
@@ -62,7 +62,7 @@ void pmc_leon_idle_fixup(void)
62 * CPU idle callback function 62 * CPU idle callback function
63 * See .../arch/sparc/kernel/process.c 63 * See .../arch/sparc/kernel/process.c
64 */ 64 */
65void pmc_leon_idle(void) 65static void pmc_leon_idle(void)
66{ 66{
67 /* Interrupts need to be enabled to not hang the CPU */ 67 /* Interrupts need to be enabled to not hang the CPU */
68 local_irq_enable(); 68 local_irq_enable();
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 6edf955f987c..018ef11f57df 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -130,7 +130,7 @@ void leon_configure_cache_smp(void)
130 local_ops->tlb_all(); 130 local_ops->tlb_all();
131} 131}
132 132
133void leon_smp_setbroadcast(unsigned int mask) 133static void leon_smp_setbroadcast(unsigned int mask)
134{ 134{
135 int broadcast = 135 int broadcast =
136 ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >> 136 ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >>
@@ -148,13 +148,6 @@ void leon_smp_setbroadcast(unsigned int mask)
148 LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask); 148 LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask);
149} 149}
150 150
151unsigned int leon_smp_getbroadcast(void)
152{
153 unsigned int mask;
154 mask = LEON_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpbroadcast));
155 return mask;
156}
157
158int leon_smp_nrcpus(void) 151int leon_smp_nrcpus(void)
159{ 152{
160 int nrcpu = 153 int nrcpu =
@@ -266,10 +259,6 @@ void __init leon_smp_done(void)
266 259
267} 260}
268 261
269void leon_irq_rotate(int cpu)
270{
271}
272
273struct leon_ipi_work { 262struct leon_ipi_work {
274 int single; 263 int single;
275 int msk; 264 int msk;
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 3241f56331c2..de0ee3971f00 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -5,8 +5,10 @@
5#include <linux/mod_devicetable.h> 5#include <linux/mod_devicetable.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/irq.h> 7#include <linux/irq.h>
8#include <linux/of_device.h>
9#include <linux/of_platform.h> 8#include <linux/of_platform.h>
9#include <linux/of_address.h>
10#include <linux/of_device.h>
11#include <linux/of_irq.h>
10 12
11#include "of_device_common.h" 13#include "of_device_common.h"
12 14
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 857ad77df9c0..539babf00bb2 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -28,6 +28,7 @@
28#include <asm/apb.h> 28#include <asm/apb.h>
29 29
30#include "pci_impl.h" 30#include "pci_impl.h"
31#include "kernel.h"
31 32
32/* List of all PCI controllers found in the system. */ 33/* List of all PCI controllers found in the system. */
33struct pci_pbm_info *pci_pbm_root = NULL; 34struct pci_pbm_info *pci_pbm_root = NULL;
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 5f688531f48c..75803c780af3 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -48,8 +48,8 @@ struct sparc64_msiq_ops {
48 unsigned long devino); 48 unsigned long devino);
49}; 49};
50 50
51extern void sparc64_pbm_msi_init(struct pci_pbm_info *pbm, 51void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
52 const struct sparc64_msiq_ops *ops); 52 const struct sparc64_msiq_ops *ops);
53 53
54struct sparc64_msiq_cookie { 54struct sparc64_msiq_cookie {
55 struct pci_pbm_info *pbm; 55 struct pci_pbm_info *pbm;
@@ -158,23 +158,23 @@ extern struct pci_pbm_info *pci_pbm_root;
158extern int pci_num_pbms; 158extern int pci_num_pbms;
159 159
160/* PCI bus scanning and fixup support. */ 160/* PCI bus scanning and fixup support. */
161extern void pci_get_pbm_props(struct pci_pbm_info *pbm); 161void pci_get_pbm_props(struct pci_pbm_info *pbm);
162extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, 162struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
163 struct device *parent); 163 struct device *parent);
164extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); 164void pci_determine_mem_io_space(struct pci_pbm_info *pbm);
165 165
166/* Error reporting support. */ 166/* Error reporting support. */
167extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *); 167void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *);
168extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *); 168void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *);
169extern void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *); 169void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *);
170 170
171/* Configuration space access. */ 171/* Configuration space access. */
172extern void pci_config_read8(u8 *addr, u8 *ret); 172void pci_config_read8(u8 *addr, u8 *ret);
173extern void pci_config_read16(u16 *addr, u16 *ret); 173void pci_config_read16(u16 *addr, u16 *ret);
174extern void pci_config_read32(u32 *addr, u32 *ret); 174void pci_config_read32(u32 *addr, u32 *ret);
175extern void pci_config_write8(u8 *addr, u8 val); 175void pci_config_write8(u8 *addr, u8 val);
176extern void pci_config_write16(u16 *addr, u16 val); 176void pci_config_write16(u16 *addr, u16 val);
177extern void pci_config_write32(u32 *addr, u32 val); 177void pci_config_write32(u32 *addr, u32 val);
178 178
179extern struct pci_ops sun4u_pci_ops; 179extern struct pci_ops sun4u_pci_ops;
180extern struct pci_ops sun4v_pci_ops; 180extern struct pci_ops sun4v_pci_ops;
diff --git a/arch/sparc/kernel/pci_sun4v.h b/arch/sparc/kernel/pci_sun4v.h
index 8e9fc3a5b4f5..5642212390b2 100644
--- a/arch/sparc/kernel/pci_sun4v.h
+++ b/arch/sparc/kernel/pci_sun4v.h
@@ -6,87 +6,87 @@
6#ifndef _PCI_SUN4V_H 6#ifndef _PCI_SUN4V_H
7#define _PCI_SUN4V_H 7#define _PCI_SUN4V_H
8 8
9extern long pci_sun4v_iommu_map(unsigned long devhandle, 9long pci_sun4v_iommu_map(unsigned long devhandle,
10 unsigned long tsbid, 10 unsigned long tsbid,
11 unsigned long num_ttes, 11 unsigned long num_ttes,
12 unsigned long io_attributes, 12 unsigned long io_attributes,
13 unsigned long io_page_list_pa); 13 unsigned long io_page_list_pa);
14extern unsigned long pci_sun4v_iommu_demap(unsigned long devhandle, 14unsigned long pci_sun4v_iommu_demap(unsigned long devhandle,
15 unsigned long tsbid, 15 unsigned long tsbid,
16 unsigned long num_ttes); 16 unsigned long num_ttes);
17extern unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle, 17unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle,
18 unsigned long tsbid, 18 unsigned long tsbid,
19 unsigned long *io_attributes, 19 unsigned long *io_attributes,
20 unsigned long *real_address); 20 unsigned long *real_address);
21extern unsigned long pci_sun4v_config_get(unsigned long devhandle, 21unsigned long pci_sun4v_config_get(unsigned long devhandle,
22 unsigned long pci_device, 22 unsigned long pci_device,
23 unsigned long config_offset, 23 unsigned long config_offset,
24 unsigned long size); 24 unsigned long size);
25extern int pci_sun4v_config_put(unsigned long devhandle, 25int pci_sun4v_config_put(unsigned long devhandle,
26 unsigned long pci_device, 26 unsigned long pci_device,
27 unsigned long config_offset, 27 unsigned long config_offset,
28 unsigned long size, 28 unsigned long size,
29 unsigned long data); 29 unsigned long data);
30 30
31extern unsigned long pci_sun4v_msiq_conf(unsigned long devhandle, 31unsigned long pci_sun4v_msiq_conf(unsigned long devhandle,
32 unsigned long msiqid, 32 unsigned long msiqid,
33 unsigned long msiq_paddr, 33 unsigned long msiq_paddr,
34 unsigned long num_entries); 34 unsigned long num_entries);
35extern unsigned long pci_sun4v_msiq_info(unsigned long devhandle, 35unsigned long pci_sun4v_msiq_info(unsigned long devhandle,
36 unsigned long msiqid, 36 unsigned long msiqid,
37 unsigned long *msiq_paddr, 37 unsigned long *msiq_paddr,
38 unsigned long *num_entries); 38 unsigned long *num_entries);
39extern unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle, 39unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle,
40 unsigned long msiqid, 40 unsigned long msiqid,
41 unsigned long *valid); 41 unsigned long *valid);
42extern unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle, 42unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle,
43 unsigned long msiqid, 43 unsigned long msiqid,
44 unsigned long valid); 44 unsigned long valid);
45extern unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle, 45unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle,
46 unsigned long msiqid, 46 unsigned long msiqid,
47 unsigned long *state); 47 unsigned long *state);
48extern unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle, 48unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle,
49 unsigned long msiqid, 49 unsigned long msiqid,
50 unsigned long state); 50 unsigned long state);
51extern unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle, 51unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle,
52 unsigned long msiqid, 52 unsigned long msiqid,
53 unsigned long *head); 53 unsigned long *head);
54extern unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle, 54unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle,
55 unsigned long msiqid, 55 unsigned long msiqid,
56 unsigned long head); 56 unsigned long head);
57extern unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle, 57unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle,
58 unsigned long msiqid, 58 unsigned long msiqid,
59 unsigned long *head); 59 unsigned long *head);
60extern unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle, 60unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle,
61 unsigned long msinum, 61 unsigned long msinum,
62 unsigned long *valid); 62 unsigned long *valid);
63extern unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle, 63unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle,
64 unsigned long msinum, 64 unsigned long msinum,
65 unsigned long valid); 65 unsigned long valid);
66extern unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle, 66unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle,
67 unsigned long msinum, 67 unsigned long msinum,
68 unsigned long *msiq); 68 unsigned long *msiq);
69extern unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle, 69unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle,
70 unsigned long msinum, 70 unsigned long msinum,
71 unsigned long msiq, 71 unsigned long msiq,
72 unsigned long msitype); 72 unsigned long msitype);
73extern unsigned long pci_sun4v_msi_getstate(unsigned long devhandle, 73unsigned long pci_sun4v_msi_getstate(unsigned long devhandle,
74 unsigned long msinum, 74 unsigned long msinum,
75 unsigned long *state); 75 unsigned long *state);
76extern unsigned long pci_sun4v_msi_setstate(unsigned long devhandle, 76unsigned long pci_sun4v_msi_setstate(unsigned long devhandle,
77 unsigned long msinum, 77 unsigned long msinum,
78 unsigned long state); 78 unsigned long state);
79extern unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle, 79unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle,
80 unsigned long msinum, 80 unsigned long msinum,
81 unsigned long *msiq); 81 unsigned long *msiq);
82extern unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle, 82unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle,
83 unsigned long msinum, 83 unsigned long msinum,
84 unsigned long msiq); 84 unsigned long msiq);
85extern unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle, 85unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle,
86 unsigned long msinum, 86 unsigned long msinum,
87 unsigned long *valid); 87 unsigned long *valid);
88extern unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle, 88unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle,
89 unsigned long msinum, 89 unsigned long msinum,
90 unsigned long valid); 90 unsigned long valid);
91 91
92#endif /* !(_PCI_SUN4V_H) */ 92#endif /* !(_PCI_SUN4V_H) */
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 09f4fdd8d808..6cc78c213c01 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -36,6 +36,7 @@
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/irq_regs.h> 37#include <asm/irq_regs.h>
38 38
39#include "kernel.h"
39#include "irq.h" 40#include "irq.h"
40 41
41/* 42/*
@@ -162,8 +163,8 @@ static int pcic0_up;
162static struct linux_pcic pcic0; 163static struct linux_pcic pcic0;
163 164
164void __iomem *pcic_regs; 165void __iomem *pcic_regs;
165volatile int pcic_speculative; 166static volatile int pcic_speculative;
166volatile int pcic_trapped; 167static volatile int pcic_trapped;
167 168
168/* forward */ 169/* forward */
169unsigned int pcic_build_device_irq(struct platform_device *op, 170unsigned int pcic_build_device_irq(struct platform_device *op,
@@ -329,7 +330,7 @@ int __init pcic_probe(void)
329 330
330 pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; 331 pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr";
331 if ((pcic->pcic_config_space_addr = 332 if ((pcic->pcic_config_space_addr =
332 ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == 0) { 333 ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == NULL) {
333 prom_printf("PCIC: Error, cannot map " 334 prom_printf("PCIC: Error, cannot map "
334 "PCI Configuration Space Address.\n"); 335 "PCI Configuration Space Address.\n");
335 prom_halt(); 336 prom_halt();
@@ -341,7 +342,7 @@ int __init pcic_probe(void)
341 */ 342 */
342 pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; 343 pcic->pcic_res_cfg_data.name = "pcic_cfg_data";
343 if ((pcic->pcic_config_space_data = 344 if ((pcic->pcic_config_space_data =
344 ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == 0) { 345 ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == NULL) {
345 prom_printf("PCIC: Error, cannot map " 346 prom_printf("PCIC: Error, cannot map "
346 "PCI Configuration Space Data.\n"); 347 "PCI Configuration Space Data.\n");
347 prom_halt(); 348 prom_halt();
@@ -353,7 +354,6 @@ int __init pcic_probe(void)
353 strcpy(pbm->prom_name, namebuf); 354 strcpy(pbm->prom_name, namebuf);
354 355
355 { 356 {
356 extern volatile int t_nmi[4];
357 extern int pcic_nmi_trap_patch[4]; 357 extern int pcic_nmi_trap_patch[4];
358 358
359 t_nmi[0] = pcic_nmi_trap_patch[0]; 359 t_nmi[0] = pcic_nmi_trap_patch[0];
@@ -536,7 +536,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
536 prom_getstring(node, "name", namebuf, sizeof(namebuf)); 536 prom_getstring(node, "name", namebuf, sizeof(namebuf));
537 } 537 }
538 538
539 if ((p = pcic->pcic_imap) == 0) { 539 if ((p = pcic->pcic_imap) == NULL) {
540 dev->irq = 0; 540 dev->irq = 0;
541 return; 541 return;
542 } 542 }
@@ -670,30 +670,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
670 } 670 }
671} 671}
672 672
673/*
674 * pcic_pin_to_irq() is exported to bus probing code
675 */
676unsigned int
677pcic_pin_to_irq(unsigned int pin, const char *name)
678{
679 struct linux_pcic *pcic = &pcic0;
680 unsigned int irq;
681 unsigned int ivec;
682
683 if (pin < 4) {
684 ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_LO);
685 irq = ivec >> (pin << 2) & 0xF;
686 } else if (pin < 8) {
687 ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI);
688 irq = ivec >> ((pin-4) << 2) & 0xF;
689 } else { /* Corrupted map */
690 printk("PCIC: BAD PIN %d FOR %s\n", pin, name);
691 for (;;) {} /* XXX Cannot panic properly in case of PROLL */
692 }
693/* P3 */ /* printk("PCIC: dev %s pin %d ivec 0x%x irq %x\n", name, pin, ivec, irq); */
694 return irq;
695}
696
697/* Makes compiler happy */ 673/* Makes compiler happy */
698static volatile int pcic_timer_dummy; 674static volatile int pcic_timer_dummy;
699 675
@@ -783,7 +759,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
783void pcic_nmi(unsigned int pend, struct pt_regs *regs) 759void pcic_nmi(unsigned int pend, struct pt_regs *regs)
784{ 760{
785 761
786 pend = flip_dword(pend); 762 pend = swab32(pend);
787 763
788 if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) { 764 if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) {
789 /* 765 /*
@@ -875,82 +851,4 @@ void __init sun4m_pci_init_IRQ(void)
875 sparc_config.load_profile_irq = pcic_load_profile_irq; 851 sparc_config.load_profile_irq = pcic_load_profile_irq;
876} 852}
877 853
878/*
879 * This probably belongs here rather than ioport.c because
880 * we do not want this crud linked into SBus kernels.
881 * Also, think for a moment about likes of floppy.c that
882 * include architecture specific parts. They may want to redefine ins/outs.
883 *
884 * We do not use horrible macros here because we want to
885 * advance pointer by sizeof(size).
886 */
887void outsb(unsigned long addr, const void *src, unsigned long count)
888{
889 while (count) {
890 count -= 1;
891 outb(*(const char *)src, addr);
892 src += 1;
893 /* addr += 1; */
894 }
895}
896EXPORT_SYMBOL(outsb);
897
898void outsw(unsigned long addr, const void *src, unsigned long count)
899{
900 while (count) {
901 count -= 2;
902 outw(*(const short *)src, addr);
903 src += 2;
904 /* addr += 2; */
905 }
906}
907EXPORT_SYMBOL(outsw);
908
909void outsl(unsigned long addr, const void *src, unsigned long count)
910{
911 while (count) {
912 count -= 4;
913 outl(*(const long *)src, addr);
914 src += 4;
915 /* addr += 4; */
916 }
917}
918EXPORT_SYMBOL(outsl);
919
920void insb(unsigned long addr, void *dst, unsigned long count)
921{
922 while (count) {
923 count -= 1;
924 *(unsigned char *)dst = inb(addr);
925 dst += 1;
926 /* addr += 1; */
927 }
928}
929EXPORT_SYMBOL(insb);
930
931void insw(unsigned long addr, void *dst, unsigned long count)
932{
933 while (count) {
934 count -= 2;
935 *(unsigned short *)dst = inw(addr);
936 dst += 2;
937 /* addr += 2; */
938 }
939}
940EXPORT_SYMBOL(insw);
941
942void insl(unsigned long addr, void *dst, unsigned long count)
943{
944 while (count) {
945 count -= 4;
946 /*
947 * XXX I am sure we are in for an unaligned trap here.
948 */
949 *(unsigned long *)dst = inl(addr);
950 dst += 4;
951 /* addr += 4; */
952 }
953}
954EXPORT_SYMBOL(insl);
955
956subsys_initcall(pcic_init); 854subsys_initcall(pcic_init);
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index b5c38faa4ead..8efd33753ad3 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -110,7 +110,7 @@ struct cpu_hw_events {
110 110
111 unsigned int group_flag; 111 unsigned int group_flag;
112}; 112};
113DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; 113static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
114 114
115/* An event map describes the characteristics of a performance 115/* An event map describes the characteristics of a performance
116 * counter event. In particular it gives the encoding as well as 116 * counter event. In particular it gives the encoding as well as
@@ -1153,7 +1153,7 @@ static void perf_stop_nmi_watchdog(void *unused)
1153 cpuc->pcr[i] = pcr_ops->read_pcr(i); 1153 cpuc->pcr[i] = pcr_ops->read_pcr(i);
1154} 1154}
1155 1155
1156void perf_event_grab_pmc(void) 1156static void perf_event_grab_pmc(void)
1157{ 1157{
1158 if (atomic_inc_not_zero(&active_events)) 1158 if (atomic_inc_not_zero(&active_events))
1159 return; 1159 return;
@@ -1169,7 +1169,7 @@ void perf_event_grab_pmc(void)
1169 mutex_unlock(&pmc_grab_mutex); 1169 mutex_unlock(&pmc_grab_mutex);
1170} 1170}
1171 1171
1172void perf_event_release_pmc(void) 1172static void perf_event_release_pmc(void)
1173{ 1173{
1174 if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) { 1174 if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) {
1175 if (atomic_read(&nmi_active) == 0) 1175 if (atomic_read(&nmi_active) == 0)
@@ -1669,7 +1669,7 @@ static bool __init supported_pmu(void)
1669 return false; 1669 return false;
1670} 1670}
1671 1671
1672int __init init_hw_perf_events(void) 1672static int __init init_hw_perf_events(void)
1673{ 1673{
1674 pr_info("Performance events: "); 1674 pr_info("Performance events: ");
1675 1675
@@ -1742,10 +1742,11 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
1742 1742
1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS; 1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
1744 do { 1744 do {
1745 struct sparc_stackf *usf, sf; 1745 struct sparc_stackf __user *usf;
1746 struct sparc_stackf sf;
1746 unsigned long pc; 1747 unsigned long pc;
1747 1748
1748 usf = (struct sparc_stackf *) ufp; 1749 usf = (struct sparc_stackf __user *)ufp;
1749 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1750 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1750 break; 1751 break;
1751 1752
@@ -1765,17 +1766,19 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1765 unsigned long pc; 1766 unsigned long pc;
1766 1767
1767 if (thread32_stack_is_64bit(ufp)) { 1768 if (thread32_stack_is_64bit(ufp)) {
1768 struct sparc_stackf *usf, sf; 1769 struct sparc_stackf __user *usf;
1770 struct sparc_stackf sf;
1769 1771
1770 ufp += STACK_BIAS; 1772 ufp += STACK_BIAS;
1771 usf = (struct sparc_stackf *) ufp; 1773 usf = (struct sparc_stackf __user *)ufp;
1772 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1774 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1773 break; 1775 break;
1774 pc = sf.callers_pc & 0xffffffff; 1776 pc = sf.callers_pc & 0xffffffff;
1775 ufp = ((unsigned long) sf.fp) & 0xffffffff; 1777 ufp = ((unsigned long) sf.fp) & 0xffffffff;
1776 } else { 1778 } else {
1777 struct sparc_stackf32 *usf, sf; 1779 struct sparc_stackf32 __user *usf;
1778 usf = (struct sparc_stackf32 *) ufp; 1780 struct sparc_stackf32 sf;
1781 usf = (struct sparc_stackf32 __user *)ufp;
1779 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1782 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1780 break; 1783 break;
1781 pc = sf.callers_pc; 1784 pc = sf.callers_pc;
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 510baec1b69b..50e7b626afe8 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -10,6 +10,7 @@
10 10
11#include <stdarg.h> 11#include <stdarg.h>
12 12
13#include <linux/elfcore.h>
13#include <linux/errno.h> 14#include <linux/errno.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
@@ -23,6 +24,7 @@
23#include <linux/delay.h> 24#include <linux/delay.h>
24#include <linux/pm.h> 25#include <linux/pm.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/cpu.h>
26 28
27#include <asm/auxio.h> 29#include <asm/auxio.h>
28#include <asm/oplib.h> 30#include <asm/oplib.h>
@@ -38,6 +40,8 @@
38#include <asm/unistd.h> 40#include <asm/unistd.h>
39#include <asm/setup.h> 41#include <asm/setup.h>
40 42
43#include "kernel.h"
44
41/* 45/*
42 * Power management idle function 46 * Power management idle function
43 * Set in pm platform drivers (apc.c and pmc.c) 47 * Set in pm platform drivers (apc.c and pmc.c)
@@ -102,8 +106,12 @@ void machine_restart(char * cmd)
102void machine_power_off(void) 106void machine_power_off(void)
103{ 107{
104 if (auxio_power_register && 108 if (auxio_power_register &&
105 (strcmp(of_console_device->type, "serial") || scons_pwroff)) 109 (strcmp(of_console_device->type, "serial") || scons_pwroff)) {
106 *auxio_power_register |= AUXIO_POWER_OFF; 110 u8 power_register = sbus_readb(auxio_power_register);
111 power_register |= AUXIO_POWER_OFF;
112 sbus_writeb(power_register, auxio_power_register);
113 }
114
107 machine_halt(); 115 machine_halt();
108} 116}
109 117
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index d7b4967f8fa6..027e09986194 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -88,7 +88,7 @@ void arch_cpu_idle(void)
88} 88}
89 89
90#ifdef CONFIG_HOTPLUG_CPU 90#ifdef CONFIG_HOTPLUG_CPU
91void arch_cpu_idle_dead() 91void arch_cpu_idle_dead(void)
92{ 92{
93 sched_preempt_enable_no_resched(); 93 sched_preempt_enable_no_resched();
94 cpu_play_dead(); 94 cpu_play_dead();
@@ -239,7 +239,7 @@ static void __global_reg_poll(struct global_reg_snapshot *gp)
239 } 239 }
240} 240}
241 241
242void arch_trigger_all_cpu_backtrace(void) 242void arch_trigger_all_cpu_backtrace(bool include_self)
243{ 243{
244 struct thread_info *tp = current_thread_info(); 244 struct thread_info *tp = current_thread_info();
245 struct pt_regs *regs = get_irq_regs(); 245 struct pt_regs *regs = get_irq_regs();
@@ -251,16 +251,22 @@ void arch_trigger_all_cpu_backtrace(void)
251 251
252 spin_lock_irqsave(&global_cpu_snapshot_lock, flags); 252 spin_lock_irqsave(&global_cpu_snapshot_lock, flags);
253 253
254 memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
255
256 this_cpu = raw_smp_processor_id(); 254 this_cpu = raw_smp_processor_id();
257 255
258 __global_reg_self(tp, regs, this_cpu); 256 memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
257
258 if (include_self)
259 __global_reg_self(tp, regs, this_cpu);
259 260
260 smp_fetch_global_regs(); 261 smp_fetch_global_regs();
261 262
262 for_each_online_cpu(cpu) { 263 for_each_online_cpu(cpu) {
263 struct global_reg_snapshot *gp = &global_cpu_snapshot[cpu].reg; 264 struct global_reg_snapshot *gp;
265
266 if (!include_self && cpu == this_cpu)
267 continue;
268
269 gp = &global_cpu_snapshot[cpu].reg;
264 270
265 __global_reg_poll(gp); 271 __global_reg_poll(gp);
266 272
@@ -292,7 +298,7 @@ void arch_trigger_all_cpu_backtrace(void)
292 298
293static void sysrq_handle_globreg(int key) 299static void sysrq_handle_globreg(int key)
294{ 300{
295 arch_trigger_all_cpu_backtrace(); 301 arch_trigger_all_cpu_backtrace(true);
296} 302}
297 303
298static struct sysrq_key_op sparc_globalreg_op = { 304static struct sysrq_key_op sparc_globalreg_op = {
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index cf5fe1c0b024..890281b12b28 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -4,7 +4,7 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <asm/prom.h> 5#include <asm/prom.h>
6 6
7extern void of_console_init(void); 7void of_console_init(void);
8 8
9extern unsigned int prom_early_allocated; 9extern unsigned int prom_early_allocated;
10 10
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index 9a690d39c01b..20cc5d80a471 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -15,11 +15,12 @@
15 * 2 of the License, or (at your option) any later version. 15 * 2 of the License, or (at your option) any later version.
16 */ 16 */
17 17
18#include <linux/memblock.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/types.h>
22#include <linux/cpu.h>
21#include <linux/mm.h> 23#include <linux/mm.h>
22#include <linux/memblock.h>
23#include <linux/of.h> 24#include <linux/of.h>
24 25
25#include <asm/prom.h> 26#include <asm/prom.h>
diff --git a/arch/sparc/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h
index 590b4ed8ab5e..05a6e30a928e 100644
--- a/arch/sparc/kernel/psycho_common.h
+++ b/arch/sparc/kernel/psycho_common.h
@@ -30,19 +30,19 @@ enum psycho_error_type {
30 UE_ERR, CE_ERR, PCI_ERR 30 UE_ERR, CE_ERR, PCI_ERR
31}; 31};
32 32
33extern void psycho_check_iommu_error(struct pci_pbm_info *pbm, 33void psycho_check_iommu_error(struct pci_pbm_info *pbm,
34 unsigned long afsr, 34 unsigned long afsr,
35 unsigned long afar, 35 unsigned long afar,
36 enum psycho_error_type type); 36 enum psycho_error_type type);
37 37
38extern irqreturn_t psycho_pcierr_intr(int irq, void *dev_id); 38irqreturn_t psycho_pcierr_intr(int irq, void *dev_id);
39 39
40extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize, 40int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
41 u32 dvma_offset, u32 dma_mask, 41 u32 dvma_offset, u32 dma_mask,
42 unsigned long write_complete_offset); 42 unsigned long write_complete_offset);
43 43
44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, 44void psycho_pbm_init_common(struct pci_pbm_info *pbm,
45 struct platform_device *op, 45 struct platform_device *op,
46 const char *chip_name, int chip_type); 46 const char *chip_name, int chip_type);
47 47
48#endif /* _PSYCHO_COMMON_H */ 48#endif /* _PSYCHO_COMMON_H */
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index 896ba7c5cd8e..a331fdc11a2c 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -26,6 +26,8 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28 28
29#include "kernel.h"
30
29/* #define ALLOW_INIT_TRACING */ 31/* #define ALLOW_INIT_TRACING */
30 32
31/* 33/*
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index 1434526970a6..baef495c06bd 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -267,7 +267,7 @@ static __init void leon_patch(void)
267} 267}
268 268
269struct tt_entry *sparc_ttable; 269struct tt_entry *sparc_ttable;
270struct pt_regs fake_swapper_regs; 270static struct pt_regs fake_swapper_regs;
271 271
272/* Called from head_32.S - before we have setup anything 272/* Called from head_32.S - before we have setup anything
273 * in the kernel. Be very careful with what you do here. 273 * in the kernel. Be very careful with what you do here.
@@ -365,7 +365,7 @@ void __init setup_arch(char **cmdline_p)
365 365
366 prom_setsync(prom_sync_me); 366 prom_setsync(prom_sync_me);
367 367
368 if((boot_flags&BOOTME_DEBUG) && (linux_dbvec!=0) && 368 if((boot_flags & BOOTME_DEBUG) && (linux_dbvec != NULL) &&
369 ((*(short *)linux_dbvec) != -1)) { 369 ((*(short *)linux_dbvec) != -1)) {
370 printk("Booted under KADB. Syncing trap table.\n"); 370 printk("Booted under KADB. Syncing trap table.\n");
371 (*(linux_dbvec->teach_debugger))(); 371 (*(linux_dbvec->teach_debugger))();
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index ee789d2ef05d..62deba7be1a9 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -31,6 +31,7 @@
31#include <asm/switch_to.h> 31#include <asm/switch_to.h>
32 32
33#include "sigutil.h" 33#include "sigutil.h"
34#include "kernel.h"
34 35
35/* 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
36 * to be valid. 37 * to be valid.
@@ -145,7 +146,7 @@ void do_sigreturn32(struct pt_regs *regs)
145 unsigned int psr; 146 unsigned int psr;
146 unsigned pc, npc; 147 unsigned pc, npc;
147 sigset_t set; 148 sigset_t set;
148 unsigned seta[_COMPAT_NSIG_WORDS]; 149 compat_sigset_t seta;
149 int err, i; 150 int err, i;
150 151
151 /* Always make any pending restarted system calls return -EINTR */ 152 /* Always make any pending restarted system calls return -EINTR */
@@ -209,17 +210,13 @@ void do_sigreturn32(struct pt_regs *regs)
209 if (restore_rwin_state(compat_ptr(rwin_save))) 210 if (restore_rwin_state(compat_ptr(rwin_save)))
210 goto segv; 211 goto segv;
211 } 212 }
212 err |= __get_user(seta[0], &sf->info.si_mask); 213 err |= __get_user(seta.sig[0], &sf->info.si_mask);
213 err |= copy_from_user(seta+1, &sf->extramask, 214 err |= copy_from_user(&seta.sig[1], &sf->extramask,
214 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 215 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
215 if (err) 216 if (err)
216 goto segv; 217 goto segv;
217 switch (_NSIG_WORDS) { 218
218 case 4: set.sig[3] = seta[6] + (((long)seta[7]) << 32); 219 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
219 case 3: set.sig[2] = seta[4] + (((long)seta[5]) << 32);
220 case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32);
221 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32);
222 }
223 set_current_blocked(&set); 220 set_current_blocked(&set);
224 return; 221 return;
225 222
@@ -303,12 +300,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
303 goto segv; 300 goto segv;
304 } 301 }
305 302
306 switch (_NSIG_WORDS) { 303 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
307 case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32);
308 case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32);
309 case 2: set.sig[1] = seta.sig[2] + (((long)seta.sig[3]) << 32);
310 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
311 }
312 set_current_blocked(&set); 304 set_current_blocked(&set);
313 return; 305 return;
314segv: 306segv:
@@ -417,7 +409,7 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
417 void __user *tail; 409 void __user *tail;
418 int sigframe_size; 410 int sigframe_size;
419 u32 psr; 411 u32 psr;
420 unsigned int seta[_COMPAT_NSIG_WORDS]; 412 compat_sigset_t seta;
421 413
422 /* 1. Make sure everything is clean */ 414 /* 1. Make sure everything is clean */
423 synchronize_user_stack(); 415 synchronize_user_stack();
@@ -481,18 +473,14 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
481 err |= __put_user(0, &sf->rwin_save); 473 err |= __put_user(0, &sf->rwin_save);
482 } 474 }
483 475
484 switch (_NSIG_WORDS) { 476 /* If these change we need to know - assignments to seta relies on these sizes */
485 case 4: seta[7] = (oldset->sig[3] >> 32); 477 BUILD_BUG_ON(_NSIG_WORDS != 1);
486 seta[6] = oldset->sig[3]; 478 BUILD_BUG_ON(_COMPAT_NSIG_WORDS != 2);
487 case 3: seta[5] = (oldset->sig[2] >> 32); 479 seta.sig[1] = (oldset->sig[0] >> 32);
488 seta[4] = oldset->sig[2]; 480 seta.sig[0] = oldset->sig[0];
489 case 2: seta[3] = (oldset->sig[1] >> 32); 481
490 seta[2] = oldset->sig[1]; 482 err |= __put_user(seta.sig[0], &sf->info.si_mask);
491 case 1: seta[1] = (oldset->sig[0] >> 32); 483 err |= __copy_to_user(sf->extramask, &seta.sig[1],
492 seta[0] = oldset->sig[0];
493 }
494 err |= __put_user(seta[0], &sf->info.si_mask);
495 err |= __copy_to_user(sf->extramask, seta + 1,
496 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 484 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
497 485
498 if (!wsaved) { 486 if (!wsaved) {
@@ -622,16 +610,8 @@ static int setup_rt_frame32(struct ksignal *ksig, struct pt_regs *regs,
622 /* Setup sigaltstack */ 610 /* Setup sigaltstack */
623 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]); 611 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]);
624 612
625 switch (_NSIG_WORDS) { 613 seta.sig[1] = (oldset->sig[0] >> 32);
626 case 4: seta.sig[7] = (oldset->sig[3] >> 32); 614 seta.sig[0] = oldset->sig[0];
627 seta.sig[6] = oldset->sig[3];
628 case 3: seta.sig[5] = (oldset->sig[2] >> 32);
629 seta.sig[4] = oldset->sig[2];
630 case 2: seta.sig[3] = (oldset->sig[1] >> 32);
631 seta.sig[2] = oldset->sig[1];
632 case 1: seta.sig[1] = (oldset->sig[0] >> 32);
633 seta.sig[0] = oldset->sig[0];
634 }
635 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t)); 615 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t));
636 616
637 if (!wsaved) { 617 if (!wsaved) {
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 7d5d8e1f8415..9ee72fc8e0e4 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -28,6 +28,7 @@
28#include <asm/switch_to.h> 28#include <asm/switch_to.h>
29 29
30#include "sigutil.h" 30#include "sigutil.h"
31#include "kernel.h"
31 32
32extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 33extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
33 void *fpqueue, unsigned long *fpqdepth); 34 void *fpqueue, unsigned long *fpqdepth);
@@ -341,7 +342,7 @@ static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
341 err |= __put_user(0, &sf->extra_size); 342 err |= __put_user(0, &sf->extra_size);
342 343
343 if (psr & PSR_EF) { 344 if (psr & PSR_EF) {
344 __siginfo_fpu_t *fp = tail; 345 __siginfo_fpu_t __user *fp = tail;
345 tail += sizeof(*fp); 346 tail += sizeof(*fp);
346 err |= save_fpu_state(regs, fp); 347 err |= save_fpu_state(regs, fp);
347 err |= __put_user(fp, &sf->fpu_save); 348 err |= __put_user(fp, &sf->fpu_save);
@@ -349,7 +350,7 @@ static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
349 err |= __put_user(0, &sf->fpu_save); 350 err |= __put_user(0, &sf->fpu_save);
350 } 351 }
351 if (wsaved) { 352 if (wsaved) {
352 __siginfo_rwin_t *rwp = tail; 353 __siginfo_rwin_t __user *rwp = tail;
353 tail += sizeof(*rwp); 354 tail += sizeof(*rwp);
354 err |= save_rwin_state(wsaved, rwp); 355 err |= save_rwin_state(wsaved, rwp);
355 err |= __put_user(rwp, &sf->rwin_save); 356 err |= __put_user(rwp, &sf->rwin_save);
@@ -517,9 +518,9 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
517 } 518 }
518} 519}
519 520
520asmlinkage int 521asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
521do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr, 522 struct sigstack __user *ossptr,
522 unsigned long sp) 523 unsigned long sp)
523{ 524{
524 int ret = -EFAULT; 525 int ret = -EFAULT;
525 526
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index cd91d010e6d3..1a6999868031 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -35,9 +35,10 @@
35#include <asm/switch_to.h> 35#include <asm/switch_to.h>
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37 37
38#include "entry.h"
39#include "systbls.h"
40#include "sigutil.h" 38#include "sigutil.h"
39#include "systbls.h"
40#include "kernel.h"
41#include "entry.h"
41 42
42/* {set, get}context() needed for 64-bit SparcLinux userland. */ 43/* {set, get}context() needed for 64-bit SparcLinux userland. */
43asmlinkage void sparc64_set_context(struct pt_regs *regs) 44asmlinkage void sparc64_set_context(struct pt_regs *regs)
@@ -492,7 +493,6 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
492 493
493#ifdef CONFIG_COMPAT 494#ifdef CONFIG_COMPAT
494 if (test_thread_flag(TIF_32BIT)) { 495 if (test_thread_flag(TIF_32BIT)) {
495 extern void do_signal32(struct pt_regs *);
496 do_signal32(regs); 496 do_signal32(regs);
497 return; 497 return;
498 } 498 }
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index a102bfba6ea8..7958242d63c5 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -20,6 +20,7 @@
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/cache.h> 21#include <linux/cache.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/profile.h>
23#include <linux/cpu.h> 24#include <linux/cpu.h>
24 25
25#include <asm/ptrace.h> 26#include <asm/ptrace.h>
@@ -75,8 +76,6 @@ void smp_store_cpu_info(int id)
75 76
76void __init smp_cpus_done(unsigned int max_cpus) 77void __init smp_cpus_done(unsigned int max_cpus)
77{ 78{
78 extern void smp4m_smp_done(void);
79 extern void smp4d_smp_done(void);
80 unsigned long bogosum = 0; 79 unsigned long bogosum = 0;
81 int cpu, num = 0; 80 int cpu, num = 0;
82 81
@@ -183,8 +182,6 @@ int setup_profiling_timer(unsigned int multiplier)
183 182
184void __init smp_prepare_cpus(unsigned int max_cpus) 183void __init smp_prepare_cpus(unsigned int max_cpus)
185{ 184{
186 extern void __init smp4m_boot_cpus(void);
187 extern void __init smp4d_boot_cpus(void);
188 int i, cpuid, extra; 185 int i, cpuid, extra;
189 186
190 printk("Entering SMP Mode...\n"); 187 printk("Entering SMP Mode...\n");
@@ -261,8 +258,6 @@ void __init smp_prepare_boot_cpu(void)
261 258
262int __cpu_up(unsigned int cpu, struct task_struct *tidle) 259int __cpu_up(unsigned int cpu, struct task_struct *tidle)
263{ 260{
264 extern int smp4m_boot_one_cpu(int, struct task_struct *);
265 extern int smp4d_boot_one_cpu(int, struct task_struct *);
266 int ret=0; 261 int ret=0;
267 262
268 switch(sparc_cpu_model) { 263 switch(sparc_cpu_model) {
@@ -297,7 +292,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
297 return ret; 292 return ret;
298} 293}
299 294
300void arch_cpu_pre_starting(void *arg) 295static void arch_cpu_pre_starting(void *arg)
301{ 296{
302 local_ops->cache_all(); 297 local_ops->cache_all();
303 local_ops->tlb_all(); 298 local_ops->tlb_all();
@@ -317,7 +312,7 @@ void arch_cpu_pre_starting(void *arg)
317 } 312 }
318} 313}
319 314
320void arch_cpu_pre_online(void *arg) 315static void arch_cpu_pre_online(void *arg)
321{ 316{
322 unsigned int cpuid = hard_smp_processor_id(); 317 unsigned int cpuid = hard_smp_processor_id();
323 318
@@ -344,7 +339,7 @@ void arch_cpu_pre_online(void *arg)
344 } 339 }
345} 340}
346 341
347void sparc_start_secondary(void *arg) 342static void sparc_start_secondary(void *arg)
348{ 343{
349 unsigned int cpu; 344 unsigned int cpu;
350 345
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 745a3633ce14..41aa2478f3ca 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -25,6 +25,7 @@
25#include <linux/ftrace.h> 25#include <linux/ftrace.h>
26#include <linux/cpu.h> 26#include <linux/cpu.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/kgdb.h>
28 29
29#include <asm/head.h> 30#include <asm/head.h>
30#include <asm/ptrace.h> 31#include <asm/ptrace.h>
@@ -35,6 +36,7 @@
35#include <asm/hvtramp.h> 36#include <asm/hvtramp.h>
36#include <asm/io.h> 37#include <asm/io.h>
37#include <asm/timer.h> 38#include <asm/timer.h>
39#include <asm/setup.h>
38 40
39#include <asm/irq.h> 41#include <asm/irq.h>
40#include <asm/irq_regs.h> 42#include <asm/irq_regs.h>
@@ -52,6 +54,7 @@
52#include <asm/pcr.h> 54#include <asm/pcr.h>
53 55
54#include "cpumap.h" 56#include "cpumap.h"
57#include "kernel.h"
55 58
56DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; 59DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
57cpumask_t cpu_core_map[NR_CPUS] __read_mostly = 60cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
@@ -272,14 +275,6 @@ static void smp_synchronize_one_tick(int cpu)
272} 275}
273 276
274#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) 277#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
275/* XXX Put this in some common place. XXX */
276static unsigned long kimage_addr_to_ra(void *p)
277{
278 unsigned long val = (unsigned long) p;
279
280 return kern_base + (val - KERNBASE);
281}
282
283static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg, 278static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg,
284 void **descrp) 279 void **descrp)
285{ 280{
@@ -867,11 +862,6 @@ extern unsigned long xcall_flush_dcache_page_cheetah;
867#endif 862#endif
868extern unsigned long xcall_flush_dcache_page_spitfire; 863extern unsigned long xcall_flush_dcache_page_spitfire;
869 864
870#ifdef CONFIG_DEBUG_DCFLUSH
871extern atomic_t dcpage_flushes;
872extern atomic_t dcpage_flushes_xcall;
873#endif
874
875static inline void __local_flush_dcache_page(struct page *page) 865static inline void __local_flush_dcache_page(struct page *page)
876{ 866{
877#ifdef DCACHE_ALIASING_POSSIBLE 867#ifdef DCACHE_ALIASING_POSSIBLE
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index f8933be3ca8b..a1bb2675b280 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -143,7 +143,7 @@ static void sun4d_sbus_handler_irq(int sbusl)
143 } 143 }
144} 144}
145 145
146void sun4d_handler_irq(int pil, struct pt_regs *regs) 146void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs)
147{ 147{
148 struct pt_regs *old_regs; 148 struct pt_regs *old_regs;
149 /* SBUS IRQ level (1 - 7) */ 149 /* SBUS IRQ level (1 - 7) */
@@ -236,7 +236,7 @@ static void sun4d_shutdown_irq(struct irq_data *data)
236 irq_unlink(data->irq); 236 irq_unlink(data->irq);
237} 237}
238 238
239struct irq_chip sun4d_irq = { 239static struct irq_chip sun4d_irq = {
240 .name = "sun4d", 240 .name = "sun4d",
241 .irq_startup = sun4d_startup_irq, 241 .irq_startup = sun4d_startup_irq,
242 .irq_shutdown = sun4d_shutdown_irq, 242 .irq_shutdown = sun4d_shutdown_irq,
@@ -285,9 +285,9 @@ static void __init sun4d_load_profile_irqs(void)
285 } 285 }
286} 286}
287 287
288unsigned int _sun4d_build_device_irq(unsigned int real_irq, 288static unsigned int _sun4d_build_device_irq(unsigned int real_irq,
289 unsigned int pil, 289 unsigned int pil,
290 unsigned int board) 290 unsigned int board)
291{ 291{
292 struct sun4d_handler_data *handler_data; 292 struct sun4d_handler_data *handler_data;
293 unsigned int irq; 293 unsigned int irq;
@@ -320,8 +320,8 @@ err_out:
320 320
321 321
322 322
323unsigned int sun4d_build_device_irq(struct platform_device *op, 323static unsigned int sun4d_build_device_irq(struct platform_device *op,
324 unsigned int real_irq) 324 unsigned int real_irq)
325{ 325{
326 struct device_node *dp = op->dev.of_node; 326 struct device_node *dp = op->dev.of_node;
327 struct device_node *board_parent, *bus = dp->parent; 327 struct device_node *board_parent, *bus = dp->parent;
@@ -383,7 +383,8 @@ err_out:
383 return irq; 383 return irq;
384} 384}
385 385
386unsigned int sun4d_build_timer_irq(unsigned int board, unsigned int real_irq) 386static unsigned int sun4d_build_timer_irq(unsigned int board,
387 unsigned int real_irq)
387{ 388{
388 return _sun4d_build_device_irq(real_irq, real_irq, board); 389 return _sun4d_build_device_irq(real_irq, real_irq, board);
389} 390}
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 71368850dfc0..022c30c72ebd 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -49,6 +49,8 @@
49#include <asm/mmu_context.h> 49#include <asm/mmu_context.h>
50#include <asm/compat_signal.h> 50#include <asm/compat_signal.h>
51 51
52#include "systbls.h"
53
52asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) 54asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
53{ 55{
54 if ((int)high < 0) 56 if ((int)high < 0)
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 3a8d1844402e..646988d4c1a3 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -24,6 +24,8 @@
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/unistd.h> 25#include <asm/unistd.h>
26 26
27#include "systbls.h"
28
27/* #define DEBUG_UNIMP_SYSCALL */ 29/* #define DEBUG_UNIMP_SYSCALL */
28 30
29/* XXX Make this per-binary type, this way we can detect the type of 31/* XXX Make this per-binary type, this way we can detect the type of
@@ -68,7 +70,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
68 * sys_pipe() is the normal C calling standard for creating 70 * sys_pipe() is the normal C calling standard for creating
69 * a pipe. It's not the way unix traditionally does this, though. 71 * a pipe. It's not the way unix traditionally does this, though.
70 */ 72 */
71asmlinkage int sparc_pipe(struct pt_regs *regs) 73asmlinkage long sparc_pipe(struct pt_regs *regs)
72{ 74{
73 int fd[2]; 75 int fd[2];
74 int error; 76 int error;
@@ -93,7 +95,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len)
93 95
94/* Linux version of mmap */ 96/* Linux version of mmap */
95 97
96asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 98asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
97 unsigned long prot, unsigned long flags, unsigned long fd, 99 unsigned long prot, unsigned long flags, unsigned long fd,
98 unsigned long pgoff) 100 unsigned long pgoff)
99{ 101{
@@ -103,7 +105,7 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
103 pgoff >> (PAGE_SHIFT - 12)); 105 pgoff >> (PAGE_SHIFT - 12));
104} 106}
105 107
106asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 108asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
107 unsigned long prot, unsigned long flags, unsigned long fd, 109 unsigned long prot, unsigned long flags, unsigned long fd,
108 unsigned long off) 110 unsigned long off)
109{ 111{
@@ -197,7 +199,7 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig,
197 return ret; 199 return ret;
198} 200}
199 201
200asmlinkage int sys_getdomainname(char __user *name, int len) 202asmlinkage long sys_getdomainname(char __user *name, int len)
201{ 203{
202 int nlen, err; 204 int nlen, err;
203 205
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index beb0b5a5f21f..c85403d0496c 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -31,6 +31,7 @@
31#include <asm/unistd.h> 31#include <asm/unistd.h>
32 32
33#include "entry.h" 33#include "entry.h"
34#include "kernel.h"
34#include "systbls.h" 35#include "systbls.h"
35 36
36/* #define DEBUG_UNIMP_SYSCALL */ 37/* #define DEBUG_UNIMP_SYSCALL */
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index 26e6dd72e92a..2dab8236d490 100644
--- a/arch/sparc/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
@@ -1,41 +1,103 @@
1#ifndef _SYSTBLS_H 1#ifndef _SYSTBLS_H
2#define _SYSTBLS_H 2#define _SYSTBLS_H
3 3
4#include <linux/signal.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/compat.h>
5#include <linux/types.h> 7#include <linux/types.h>
6#include <linux/signal.h> 8
7#include <asm/utrap.h> 9#include <asm/utrap.h>
8 10
9extern asmlinkage unsigned long sys_getpagesize(void); 11asmlinkage unsigned long sys_getpagesize(void);
10extern asmlinkage long sparc_pipe(struct pt_regs *regs); 12asmlinkage long sparc_pipe(struct pt_regs *regs);
11extern asmlinkage long sys_sparc_ipc(unsigned int call, int first, 13asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs);
12 unsigned long second, 14asmlinkage long sys_getdomainname(char __user *name, int len);
13 unsigned long third, 15void do_rt_sigreturn(struct pt_regs *regs);
14 void __user *ptr, long fifth); 16asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
15extern asmlinkage long sparc64_personality(unsigned long personality); 17 unsigned long prot, unsigned long flags,
16extern asmlinkage long sys64_munmap(unsigned long addr, size_t len); 18 unsigned long fd, unsigned long off);
17extern asmlinkage unsigned long sys64_mremap(unsigned long addr, 19asmlinkage void sparc_breakpoint(struct pt_regs *regs);
18 unsigned long old_len, 20
19 unsigned long new_len, 21#ifdef CONFIG_SPARC32
20 unsigned long flags, 22asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
21 unsigned long new_addr); 23 unsigned long prot, unsigned long flags,
22extern asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs); 24 unsigned long fd, unsigned long pgoff);
23extern asmlinkage long sys_getdomainname(char __user *name, int len); 25long sparc_remap_file_pages(unsigned long start, unsigned long size,
24extern asmlinkage long sys_utrap_install(utrap_entry_t type, 26 unsigned long prot, unsigned long pgoff,
25 utrap_handler_t new_p, 27 unsigned long flags);
26 utrap_handler_t new_d,
27 utrap_handler_t __user *old_p,
28 utrap_handler_t __user *old_d);
29extern asmlinkage long sparc_memory_ordering(unsigned long model,
30 struct pt_regs *regs);
31extern asmlinkage long sys_rt_sigaction(int sig,
32 const struct sigaction __user *act,
33 struct sigaction __user *oact,
34 void __user *restorer,
35 size_t sigsetsize);
36 28
37extern asmlinkage void sparc64_set_context(struct pt_regs *regs); 29#endif /* CONFIG_SPARC32 */
38extern asmlinkage void sparc64_get_context(struct pt_regs *regs);
39extern void do_rt_sigreturn(struct pt_regs *regs);
40 30
31#ifdef CONFIG_SPARC64
32asmlinkage long sys_sparc_ipc(unsigned int call, int first,
33 unsigned long second,
34 unsigned long third,
35 void __user *ptr, long fifth);
36asmlinkage long sparc64_personality(unsigned long personality);
37asmlinkage long sys64_munmap(unsigned long addr, size_t len);
38asmlinkage unsigned long sys64_mremap(unsigned long addr,
39 unsigned long old_len,
40 unsigned long new_len,
41 unsigned long flags,
42 unsigned long new_addr);
43asmlinkage long sys_utrap_install(utrap_entry_t type,
44 utrap_handler_t new_p,
45 utrap_handler_t new_d,
46 utrap_handler_t __user *old_p,
47 utrap_handler_t __user *old_d);
48asmlinkage long sparc_memory_ordering(unsigned long model,
49 struct pt_regs *regs);
50asmlinkage void sparc64_set_context(struct pt_regs *regs);
51asmlinkage void sparc64_get_context(struct pt_regs *regs);
52asmlinkage long sys32_truncate64(const char __user * path,
53 unsigned long high,
54 unsigned long low);
55asmlinkage long sys32_ftruncate64(unsigned int fd,
56 unsigned long high,
57 unsigned long low);
58struct compat_stat64;
59asmlinkage long compat_sys_stat64(const char __user * filename,
60 struct compat_stat64 __user *statbuf);
61asmlinkage long compat_sys_lstat64(const char __user * filename,
62 struct compat_stat64 __user *statbuf);
63asmlinkage long compat_sys_fstat64(unsigned int fd,
64 struct compat_stat64 __user * statbuf);
65asmlinkage long compat_sys_fstatat64(unsigned int dfd,
66 const char __user *filename,
67 struct compat_stat64 __user * statbuf, int flag);
68asmlinkage compat_ssize_t sys32_pread64(unsigned int fd,
69 char __user *ubuf,
70 compat_size_t count,
71 unsigned long poshi,
72 unsigned long poslo);
73asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd,
74 char __user *ubuf,
75 compat_size_t count,
76 unsigned long poshi,
77 unsigned long poslo);
78asmlinkage long compat_sys_readahead(int fd,
79 unsigned long offhi,
80 unsigned long offlo,
81 compat_size_t count);
82long compat_sys_fadvise64(int fd,
83 unsigned long offhi,
84 unsigned long offlo,
85 compat_size_t len, int advice);
86long compat_sys_fadvise64_64(int fd,
87 unsigned long offhi, unsigned long offlo,
88 unsigned long lenhi, unsigned long lenlo,
89 int advice);
90long sys32_sync_file_range(unsigned int fd,
91 unsigned long off_high, unsigned long off_low,
92 unsigned long nb_high, unsigned long nb_low,
93 unsigned int flags);
94asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo,
95 u32 lenhi, u32 lenlo);
96asmlinkage long compat_sys_fstat64(unsigned int fd,
97 struct compat_stat64 __user * statbuf);
98asmlinkage long compat_sys_fstatat64(unsigned int dfd,
99 const char __user *filename,
100 struct compat_stat64 __user * statbuf,
101 int flag);
102#endif /* CONFIG_SPARC64 */
41#endif /* _SYSTBLS_H */ 103#endif /* _SYSTBLS_H */
diff --git a/arch/sparc/kernel/tadpole.c b/arch/sparc/kernel/tadpole.c
deleted file mode 100644
index 9aba8bd5a78b..000000000000
--- a/arch/sparc/kernel/tadpole.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/* tadpole.c: Probing for the tadpole clock stopping h/w at boot time.
2 *
3 * Copyright (C) 1996 David Redman (djhr@tadpole.co.uk)
4 */
5
6#include <linux/string.h>
7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/init.h>
10
11#include <asm/asi.h>
12#include <asm/oplib.h>
13#include <asm/io.h>
14
15#define MACIO_SCSI_CSR_ADDR 0x78400000
16#define MACIO_EN_DMA 0x00000200
17#define CLOCK_INIT_DONE 1
18
19static int clk_state;
20static volatile unsigned char *clk_ctrl;
21void (*cpu_pwr_save)(void);
22
23static inline unsigned int ldphys(unsigned int addr)
24{
25 unsigned long data;
26
27 __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :
28 "=r" (data) :
29 "r" (addr), "i" (ASI_M_BYPASS));
30 return data;
31}
32
33static void clk_init(void)
34{
35 __asm__ __volatile__("mov 0x6c, %%g1\n\t"
36 "mov 0x4c, %%g2\n\t"
37 "mov 0xdf, %%g3\n\t"
38 "stb %%g1, [%0+3]\n\t"
39 "stb %%g2, [%0+3]\n\t"
40 "stb %%g3, [%0+3]\n\t" : :
41 "r" (clk_ctrl) :
42 "g1", "g2", "g3");
43}
44
45static void clk_slow(void)
46{
47 __asm__ __volatile__("mov 0xcc, %%g2\n\t"
48 "mov 0x4c, %%g3\n\t"
49 "mov 0xcf, %%g4\n\t"
50 "mov 0xdf, %%g5\n\t"
51 "stb %%g2, [%0+3]\n\t"
52 "stb %%g3, [%0+3]\n\t"
53 "stb %%g4, [%0+3]\n\t"
54 "stb %%g5, [%0+3]\n\t" : :
55 "r" (clk_ctrl) :
56 "g2", "g3", "g4", "g5");
57}
58
59/*
60 * Tadpole is guaranteed to be UP, using local_irq_save.
61 */
62static void tsu_clockstop(void)
63{
64 unsigned int mcsr;
65 unsigned long flags;
66
67 if (!clk_ctrl)
68 return;
69 if (!(clk_state & CLOCK_INIT_DONE)) {
70 local_irq_save(flags);
71 clk_init();
72 clk_state |= CLOCK_INIT_DONE; /* all done */
73 local_irq_restore(flags);
74 return;
75 }
76 if (!(clk_ctrl[2] & 1))
77 return; /* no speed up yet */
78
79 local_irq_save(flags);
80
81 /* if SCSI DMA in progress, don't slow clock */
82 mcsr = ldphys(MACIO_SCSI_CSR_ADDR);
83 if ((mcsr&MACIO_EN_DMA) != 0) {
84 local_irq_restore(flags);
85 return;
86 }
87 /* TODO... the minimum clock setting ought to increase the
88 * memory refresh interval..
89 */
90 clk_slow();
91 local_irq_restore(flags);
92}
93
94static void swift_clockstop(void)
95{
96 if (!clk_ctrl)
97 return;
98 clk_ctrl[0] = 0;
99}
100
101void __init clock_stop_probe(void)
102{
103 phandle node, clk_nd;
104 char name[20];
105
106 prom_getstring(prom_root_node, "name", name, sizeof(name));
107 if (strncmp(name, "Tadpole", 7))
108 return;
109 node = prom_getchild(prom_root_node);
110 node = prom_searchsiblings(node, "obio");
111 node = prom_getchild(node);
112 clk_nd = prom_searchsiblings(node, "clk-ctrl");
113 if (!clk_nd)
114 return;
115 printk("Clock Stopping h/w detected... ");
116 clk_ctrl = (char *) prom_getint(clk_nd, "address");
117 clk_state = 0;
118 if (name[10] == '\0') {
119 cpu_pwr_save = tsu_clockstop;
120 printk("enabled (S3)\n");
121 } else if ((name[10] == 'X') || (name[10] == 'G')) {
122 cpu_pwr_save = swift_clockstop;
123 printk("enabled (%s)\n",name+7);
124 } else
125 printk("disabled %s\n",name+7);
126}
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index c4c27b0f9063..5923d1e4e7c9 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -36,6 +36,7 @@
36#include <linux/of_device.h> 36#include <linux/of_device.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38 38
39#include <asm/mc146818rtc.h>
39#include <asm/oplib.h> 40#include <asm/oplib.h>
40#include <asm/timex.h> 41#include <asm/timex.h>
41#include <asm/timer.h> 42#include <asm/timer.h>
@@ -47,6 +48,7 @@
47#include <asm/irq_regs.h> 48#include <asm/irq_regs.h>
48#include <asm/setup.h> 49#include <asm/setup.h>
49 50
51#include "kernel.h"
50#include "irq.h" 52#include "irq.h"
51 53
52static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock); 54static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock);
@@ -83,7 +85,7 @@ unsigned long profile_pc(struct pt_regs *regs)
83 85
84EXPORT_SYMBOL(profile_pc); 86EXPORT_SYMBOL(profile_pc);
85 87
86__volatile__ unsigned int *master_l10_counter; 88volatile u32 __iomem *master_l10_counter;
87 89
88int update_persistent_clock(struct timespec now) 90int update_persistent_clock(struct timespec now)
89{ 91{
@@ -143,9 +145,9 @@ static __init void setup_timer_ce(void)
143 145
144static unsigned int sbus_cycles_offset(void) 146static unsigned int sbus_cycles_offset(void)
145{ 147{
146 unsigned int val, offset; 148 u32 val, offset;
147 149
148 val = *master_l10_counter; 150 val = sbus_readl(master_l10_counter);
149 offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK; 151 offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK;
150 152
151 /* Limit hit? */ 153 /* Limit hit? */
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
index 662982946a89..6fd386c5232a 100644
--- a/arch/sparc/kernel/traps_32.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -44,7 +44,7 @@ static void instruction_dump(unsigned long *pc)
44#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t") 44#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t")
45#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t") 45#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t")
46 46
47void die_if_kernel(char *str, struct pt_regs *regs) 47void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
48{ 48{
49 static int die_counter; 49 static int die_counter;
50 int count = 0; 50 int count = 0;
@@ -219,8 +219,6 @@ static unsigned long fake_fsr;
219static unsigned long fake_queue[32] __attribute__ ((aligned (8))); 219static unsigned long fake_queue[32] __attribute__ ((aligned (8)));
220static unsigned long fake_depth; 220static unsigned long fake_depth;
221 221
222extern int do_mathemu(struct pt_regs *, struct task_struct *);
223
224void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, 222void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
225 unsigned long psr) 223 unsigned long psr)
226{ 224{
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index 4ced92f05358..fb6640ec8557 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -43,8 +43,10 @@
43#include <asm/prom.h> 43#include <asm/prom.h>
44#include <asm/memctrl.h> 44#include <asm/memctrl.h>
45#include <asm/cacheflush.h> 45#include <asm/cacheflush.h>
46#include <asm/setup.h>
46 47
47#include "entry.h" 48#include "entry.h"
49#include "kernel.h"
48#include "kstack.h" 50#include "kstack.h"
49 51
50/* When an irrecoverable trap occurs at tl > 0, the trap entry 52/* When an irrecoverable trap occurs at tl > 0, the trap entry
@@ -2209,8 +2211,6 @@ out:
2209 exception_exit(prev_state); 2211 exception_exit(prev_state);
2210} 2212}
2211 2213
2212extern int do_mathemu(struct pt_regs *, struct fpustate *, bool);
2213
2214void do_fpother(struct pt_regs *regs) 2214void do_fpother(struct pt_regs *regs)
2215{ 2215{
2216 enum ctx_state prev_state = exception_enter(); 2216 enum ctx_state prev_state = exception_enter();
@@ -2383,7 +2383,7 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2383 return (struct reg_window *) (fp + STACK_BIAS); 2383 return (struct reg_window *) (fp + STACK_BIAS);
2384} 2384}
2385 2385
2386void die_if_kernel(char *str, struct pt_regs *regs) 2386void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
2387{ 2387{
2388 static int die_counter; 2388 static int die_counter;
2389 int count = 0; 2389 int count = 0;
@@ -2433,9 +2433,6 @@ EXPORT_SYMBOL(die_if_kernel);
2433#define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19)) 2433#define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19))
2434#define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19)) 2434#define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19))
2435 2435
2436extern int handle_popc(u32 insn, struct pt_regs *regs);
2437extern int handle_ldf_stq(u32 insn, struct pt_regs *regs);
2438
2439void do_illegal_instruction(struct pt_regs *regs) 2436void do_illegal_instruction(struct pt_regs *regs)
2440{ 2437{
2441 enum ctx_state prev_state = exception_enter(); 2438 enum ctx_state prev_state = exception_enter();
@@ -2486,8 +2483,6 @@ out:
2486 exception_exit(prev_state); 2483 exception_exit(prev_state);
2487} 2484}
2488 2485
2489extern void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
2490
2491void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) 2486void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)
2492{ 2487{
2493 enum ctx_state prev_state = exception_enter(); 2488 enum ctx_state prev_state = exception_enter();
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c
index c0ec89786193..c5c61b3c6b56 100644
--- a/arch/sparc/kernel/unaligned_32.c
+++ b/arch/sparc/kernel/unaligned_32.c
@@ -16,6 +16,10 @@
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/perf_event.h> 17#include <linux/perf_event.h>
18 18
19#include <asm/setup.h>
20
21#include "kernel.h"
22
19enum direction { 23enum direction {
20 load, /* ld, ldd, ldh, ldsh */ 24 load, /* ld, ldd, ldh, ldsh */
21 store, /* st, std, sth, stsh */ 25 store, /* st, std, sth, stsh */
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index 35ab8b60d256..62098a89bbbf 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -24,8 +24,10 @@
24#include <linux/context_tracking.h> 24#include <linux/context_tracking.h>
25#include <asm/fpumacro.h> 25#include <asm/fpumacro.h>
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/setup.h>
27 28
28#include "entry.h" 29#include "entry.h"
30#include "kernel.h"
29 31
30enum direction { 32enum direction {
31 load, /* ld, ldd, ldh, ldsh */ 33 load, /* ld, ldd, ldh, ldsh */
diff --git a/arch/sparc/kernel/windows.c b/arch/sparc/kernel/windows.c
index 3107381e576d..87bab0a3857a 100644
--- a/arch/sparc/kernel/windows.c
+++ b/arch/sparc/kernel/windows.c
@@ -10,8 +10,11 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/smp.h> 11#include <linux/smp.h>
12 12
13#include <asm/cacheflush.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14 15
16#include "kernel.h"
17
15/* Do save's until all user register windows are out of the cpu. */ 18/* Do save's until all user register windows are out of the cpu. */
16void flush_user_windows(void) 19void flush_user_windows(void)
17{ 20{
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index dbe119b63b48..3269b0234093 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -41,7 +41,7 @@ lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o
41lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o 41lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
42lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o 42lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o
43 43
44obj-y += iomap.o 44obj-$(CONFIG_SPARC64) += iomap.o
45obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o 45obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o
46obj-y += ksyms.o 46obj-y += ksyms.o
47obj-$(CONFIG_SPARC64) += PeeCeeI.o 47obj-$(CONFIG_SPARC64) += PeeCeeI.o
diff --git a/arch/sparc/math-emu/sfp-util_32.h b/arch/sparc/math-emu/sfp-util_32.h
index d1b2aff3c259..bb587d5f3d9d 100644
--- a/arch/sparc/math-emu/sfp-util_32.h
+++ b/arch/sparc/math-emu/sfp-util_32.h
@@ -4,20 +4,20 @@
4#include <asm/byteorder.h> 4#include <asm/byteorder.h>
5 5
6#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ 6#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
7 __asm__ ("addcc %r4,%5,%1\n\t" \ 7 __asm__ ("addcc %r4,%5,%1\n\t" \
8 "addx %r2,%3,%0\n" \ 8 "addx %r2,%3,%0\n" \
9 : "=r" ((USItype)(sh)), \ 9 : "=r" (sh), \
10 "=&r" ((USItype)(sl)) \ 10 "=&r" (sl) \
11 : "%rJ" ((USItype)(ah)), \ 11 : "%rJ" ((USItype)(ah)), \
12 "rI" ((USItype)(bh)), \ 12 "rI" ((USItype)(bh)), \
13 "%rJ" ((USItype)(al)), \ 13 "%rJ" ((USItype)(al)), \
14 "rI" ((USItype)(bl)) \ 14 "rI" ((USItype)(bl)) \
15 : "cc") 15 : "cc")
16#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ 16#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
17 __asm__ ("subcc %r4,%5,%1\n\t" \ 17 __asm__ ("subcc %r4,%5,%1\n\t" \
18 "subx %r2,%3,%0\n" \ 18 "subx %r2,%3,%0\n" \
19 : "=r" ((USItype)(sh)), \ 19 : "=r" (sh), \
20 "=&r" ((USItype)(sl)) \ 20 "=&r" (sl) \
21 : "rJ" ((USItype)(ah)), \ 21 : "rJ" ((USItype)(ah)), \
22 "rI" ((USItype)(bh)), \ 22 "rI" ((USItype)(bh)), \
23 "rJ" ((USItype)(al)), \ 23 "rJ" ((USItype)(al)), \
@@ -65,8 +65,8 @@
65 "mulscc %%g1,0,%%g1\n\t" \ 65 "mulscc %%g1,0,%%g1\n\t" \
66 "add %%g1,%%g2,%0\n\t" \ 66 "add %%g1,%%g2,%0\n\t" \
67 "rd %%y,%1\n" \ 67 "rd %%y,%1\n" \
68 : "=r" ((USItype)(w1)), \ 68 : "=r" (w1), \
69 "=r" ((USItype)(w0)) \ 69 "=r" (w0) \
70 : "%rI" ((USItype)(u)), \ 70 : "%rI" ((USItype)(u)), \
71 "r" ((USItype)(v)) \ 71 "r" ((USItype)(v)) \
72 : "%g1", "%g2", "cc") 72 : "%g1", "%g2", "cc")
@@ -98,8 +98,8 @@
98 "sub %1,%2,%1\n\t" \ 98 "sub %1,%2,%1\n\t" \
99 "3: xnor %0,0,%0\n\t" \ 99 "3: xnor %0,0,%0\n\t" \
100 "! End of inline udiv_qrnnd\n" \ 100 "! End of inline udiv_qrnnd\n" \
101 : "=&r" ((USItype)(q)), \ 101 : "=&r" (q), \
102 "=&r" ((USItype)(r)) \ 102 "=&r" (r) \
103 : "r" ((USItype)(d)), \ 103 : "r" ((USItype)(d)), \
104 "1" ((USItype)(n1)), \ 104 "1" ((USItype)(n1)), \
105 "0" ((USItype)(n0)) : "%g1", "cc") 105 "0" ((USItype)(n0)) : "%g1", "cc")
diff --git a/arch/sparc/math-emu/sfp-util_64.h b/arch/sparc/math-emu/sfp-util_64.h
index 425d3cf01af4..51320a861cc2 100644
--- a/arch/sparc/math-emu/sfp-util_64.h
+++ b/arch/sparc/math-emu/sfp-util_64.h
@@ -17,8 +17,8 @@
17 "bcs,a,pn %%xcc, 1f\n\t" \ 17 "bcs,a,pn %%xcc, 1f\n\t" \
18 "add %0, 1, %0\n" \ 18 "add %0, 1, %0\n" \
19 "1:" \ 19 "1:" \
20 : "=r" ((UDItype)(sh)), \ 20 : "=r" (sh), \
21 "=&r" ((UDItype)(sl)) \ 21 "=&r" (sl) \
22 : "r" ((UDItype)(ah)), \ 22 : "r" ((UDItype)(ah)), \
23 "r" ((UDItype)(bh)), \ 23 "r" ((UDItype)(bh)), \
24 "r" ((UDItype)(al)), \ 24 "r" ((UDItype)(al)), \
@@ -31,8 +31,8 @@
31 "bcs,a,pn %%xcc, 1f\n\t" \ 31 "bcs,a,pn %%xcc, 1f\n\t" \
32 "sub %0, 1, %0\n" \ 32 "sub %0, 1, %0\n" \
33 "1:" \ 33 "1:" \
34 : "=r" ((UDItype)(sh)), \ 34 : "=r" (sh), \
35 "=&r" ((UDItype)(sl)) \ 35 "=&r" (sl) \
36 : "r" ((UDItype)(ah)), \ 36 : "r" ((UDItype)(ah)), \
37 "r" ((UDItype)(bh)), \ 37 "r" ((UDItype)(bh)), \
38 "r" ((UDItype)(al)), \ 38 "r" ((UDItype)(al)), \
@@ -64,8 +64,8 @@
64 "sllx %3,32,%3\n\t" \ 64 "sllx %3,32,%3\n\t" \
65 "add %1,%3,%1\n\t" \ 65 "add %1,%3,%1\n\t" \
66 "add %5,%2,%0" \ 66 "add %5,%2,%0" \
67 : "=r" ((UDItype)(wh)), \ 67 : "=r" (wh), \
68 "=&r" ((UDItype)(wl)), \ 68 "=&r" (wl), \
69 "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ 69 "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \
70 : "r" ((UDItype)(u)), \ 70 : "r" ((UDItype)(u)), \
71 "r" ((UDItype)(v)) \ 71 "r" ((UDItype)(v)) \
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index 59dbd4645725..908e8c17c902 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -26,14 +26,14 @@
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/openprom.h> 27#include <asm/openprom.h>
28#include <asm/oplib.h> 28#include <asm/oplib.h>
29#include <asm/setup.h>
29#include <asm/smp.h> 30#include <asm/smp.h>
30#include <asm/traps.h> 31#include <asm/traps.h>
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
32 33
33int show_unhandled_signals = 1; 34#include "mm_32.h"
34 35
35static void unhandled_fault(unsigned long, struct task_struct *, 36int show_unhandled_signals = 1;
36 struct pt_regs *) __attribute__ ((noreturn));
37 37
38static void __noreturn unhandled_fault(unsigned long address, 38static void __noreturn unhandled_fault(unsigned long address,
39 struct task_struct *tsk, 39 struct task_struct *tsk,
@@ -141,9 +141,6 @@ static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs,
141 force_sig_info (sig, &info, current); 141 force_sig_info (sig, &info, current);
142} 142}
143 143
144extern unsigned long safe_compute_effective_address(struct pt_regs *,
145 unsigned int);
146
147static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault) 144static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
148{ 145{
149 unsigned int insn; 146 unsigned int insn;
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 4ced3fc66130..587cd0565128 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -32,6 +32,7 @@
32#include <asm/lsu.h> 32#include <asm/lsu.h>
33#include <asm/sections.h> 33#include <asm/sections.h>
34#include <asm/mmu_context.h> 34#include <asm/mmu_context.h>
35#include <asm/setup.h>
35 36
36int show_unhandled_signals = 1; 37int show_unhandled_signals = 1;
37 38
@@ -196,9 +197,6 @@ static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
196 force_sig_info(sig, &info, current); 197 force_sig_info(sig, &info, current);
197} 198}
198 199
199extern int handle_ldf_stq(u32, struct pt_regs *);
200extern int handle_ld_nf(u32, struct pt_regs *);
201
202static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn) 200static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn)
203{ 201{
204 if (!insn) { 202 if (!insn) {
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index db6987082805..eb8287155279 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -31,10 +31,13 @@
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/vaddrs.h> 32#include <asm/vaddrs.h>
33#include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */ 33#include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */
34#include <asm/setup.h>
34#include <asm/tlb.h> 35#include <asm/tlb.h>
35#include <asm/prom.h> 36#include <asm/prom.h>
36#include <asm/leon.h> 37#include <asm/leon.h>
37 38
39#include "mm_32.h"
40
38unsigned long *sparc_valid_addr_bitmap; 41unsigned long *sparc_valid_addr_bitmap;
39EXPORT_SYMBOL(sparc_valid_addr_bitmap); 42EXPORT_SYMBOL(sparc_valid_addr_bitmap);
40 43
@@ -63,7 +66,6 @@ void show_mem(unsigned int filter)
63} 66}
64 67
65 68
66extern unsigned long cmdline_memory_size;
67unsigned long last_valid_pfn; 69unsigned long last_valid_pfn;
68 70
69unsigned long calc_highpages(void) 71unsigned long calc_highpages(void)
@@ -246,9 +248,6 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
246 * init routine based upon the Sun model type on the Sparc. 248 * init routine based upon the Sun model type on the Sparc.
247 * 249 *
248 */ 250 */
249extern void srmmu_paging_init(void);
250extern void device_scan(void);
251
252void __init paging_init(void) 251void __init paging_init(void)
253{ 252{
254 srmmu_paging_init(); 253 srmmu_paging_init();
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index ed3c969a5f4c..16b58ff11e65 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -47,6 +47,7 @@
47#include <asm/prom.h> 47#include <asm/prom.h>
48#include <asm/mdesc.h> 48#include <asm/mdesc.h>
49#include <asm/cpudata.h> 49#include <asm/cpudata.h>
50#include <asm/setup.h>
50#include <asm/irq.h> 51#include <asm/irq.h>
51 52
52#include "init_64.h" 53#include "init_64.h"
@@ -794,11 +795,11 @@ struct node_mem_mask {
794static struct node_mem_mask node_masks[MAX_NUMNODES]; 795static struct node_mem_mask node_masks[MAX_NUMNODES];
795static int num_node_masks; 796static int num_node_masks;
796 797
798#ifdef CONFIG_NEED_MULTIPLE_NODES
799
797int numa_cpu_lookup_table[NR_CPUS]; 800int numa_cpu_lookup_table[NR_CPUS];
798cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES]; 801cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES];
799 802
800#ifdef CONFIG_NEED_MULTIPLE_NODES
801
802struct mdesc_mblock { 803struct mdesc_mblock {
803 u64 base; 804 u64 base;
804 u64 size; 805 u64 size;
@@ -887,17 +888,21 @@ static void __init allocate_node_data(int nid)
887 888
888static void init_node_masks_nonnuma(void) 889static void init_node_masks_nonnuma(void)
889{ 890{
891#ifdef CONFIG_NEED_MULTIPLE_NODES
890 int i; 892 int i;
893#endif
891 894
892 numadbg("Initializing tables for non-numa.\n"); 895 numadbg("Initializing tables for non-numa.\n");
893 896
894 node_masks[0].mask = node_masks[0].val = 0; 897 node_masks[0].mask = node_masks[0].val = 0;
895 num_node_masks = 1; 898 num_node_masks = 1;
896 899
900#ifdef CONFIG_NEED_MULTIPLE_NODES
897 for (i = 0; i < NR_CPUS; i++) 901 for (i = 0; i < NR_CPUS; i++)
898 numa_cpu_lookup_table[i] = 0; 902 numa_cpu_lookup_table[i] = 0;
899 903
900 cpumask_setall(&numa_cpumask_lookup_table[0]); 904 cpumask_setall(&numa_cpumask_lookup_table[0]);
905#endif
901} 906}
902 907
903#ifdef CONFIG_NEED_MULTIPLE_NODES 908#ifdef CONFIG_NEED_MULTIPLE_NODES
diff --git a/arch/sparc/mm/init_64.h b/arch/sparc/mm/init_64.h
index 5d3782deb403..0668b364f44d 100644
--- a/arch/sparc/mm/init_64.h
+++ b/arch/sparc/mm/init_64.h
@@ -21,7 +21,7 @@ extern unsigned int sparc64_highest_unlocked_tlb_ent;
21extern unsigned long sparc64_kern_pri_context; 21extern unsigned long sparc64_kern_pri_context;
22extern unsigned long sparc64_kern_pri_nuc_bits; 22extern unsigned long sparc64_kern_pri_nuc_bits;
23extern unsigned long sparc64_kern_sec_context; 23extern unsigned long sparc64_kern_sec_context;
24extern void mmu_info(struct seq_file *m); 24void mmu_info(struct seq_file *m);
25 25
26struct linux_prom_translation { 26struct linux_prom_translation {
27 unsigned long virt; 27 unsigned long virt;
@@ -36,7 +36,7 @@ extern unsigned int prom_trans_ents;
36/* Exported for SMP bootup purposes. */ 36/* Exported for SMP bootup purposes. */
37extern unsigned long kern_locked_tte_data; 37extern unsigned long kern_locked_tte_data;
38 38
39extern void prom_world(int enter); 39void prom_world(int enter);
40 40
41#ifdef CONFIG_SPARSEMEM_VMEMMAP 41#ifdef CONFIG_SPARSEMEM_VMEMMAP
42#define VMEMMAP_CHUNK_SHIFT 22 42#define VMEMMAP_CHUNK_SHIFT 22
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index eb99862e9654..f311bf219016 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -25,6 +25,8 @@
25#include <asm/dma.h> 25#include <asm/dma.h>
26#include <asm/oplib.h> 26#include <asm/oplib.h>
27 27
28#include "mm_32.h"
29
28/* #define IOUNIT_DEBUG */ 30/* #define IOUNIT_DEBUG */
29#ifdef IOUNIT_DEBUG 31#ifdef IOUNIT_DEBUG
30#define IOD(x) printk(x) 32#define IOD(x) printk(x)
@@ -38,7 +40,8 @@
38static void __init iounit_iommu_init(struct platform_device *op) 40static void __init iounit_iommu_init(struct platform_device *op)
39{ 41{
40 struct iounit_struct *iounit; 42 struct iounit_struct *iounit;
41 iopte_t *xpt, *xptend; 43 iopte_t __iomem *xpt;
44 iopte_t __iomem *xptend;
42 45
43 iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); 46 iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
44 if (!iounit) { 47 if (!iounit) {
@@ -62,10 +65,10 @@ static void __init iounit_iommu_init(struct platform_device *op)
62 op->dev.archdata.iommu = iounit; 65 op->dev.archdata.iommu = iounit;
63 iounit->page_table = xpt; 66 iounit->page_table = xpt;
64 spin_lock_init(&iounit->lock); 67 spin_lock_init(&iounit->lock);
65 68
66 for (xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t); 69 xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t);
67 xpt < xptend;) 70 for (; xpt < xptend; xpt++)
68 iopte_val(*xpt++) = 0; 71 sbus_writel(0, xpt);
69} 72}
70 73
71static int __init iounit_init(void) 74static int __init iounit_init(void)
@@ -130,7 +133,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
130 vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK); 133 vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK);
131 for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) { 134 for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) {
132 set_bit(scan, iounit->bmap); 135 set_bit(scan, iounit->bmap);
133 iounit->page_table[scan] = iopte; 136 sbus_writel(iopte, &iounit->page_table[scan]);
134 } 137 }
135 IOD(("%08lx\n", vaddr)); 138 IOD(("%08lx\n", vaddr));
136 return vaddr; 139 return vaddr;
@@ -202,7 +205,7 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon
202 struct iounit_struct *iounit = dev->archdata.iommu; 205 struct iounit_struct *iounit = dev->archdata.iommu;
203 unsigned long page, end; 206 unsigned long page, end;
204 pgprot_t dvma_prot; 207 pgprot_t dvma_prot;
205 iopte_t *iopte; 208 iopte_t __iomem *iopte;
206 209
207 *pba = addr; 210 *pba = addr;
208 211
@@ -224,8 +227,8 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon
224 227
225 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); 228 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
226 229
227 iopte = (iopte_t *)(iounit->page_table + i); 230 iopte = iounit->page_table + i;
228 *iopte = MKIOPTE(__pa(page)); 231 sbus_writel(MKIOPTE(__pa(page)), iopte);
229 } 232 }
230 addr += PAGE_SIZE; 233 addr += PAGE_SIZE;
231 va += PAGE_SIZE; 234 va += PAGE_SIZE;
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index 28f96f27c768..491511d37e37 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -27,6 +27,8 @@
27#include <asm/iommu.h> 27#include <asm/iommu.h>
28#include <asm/dma.h> 28#include <asm/dma.h>
29 29
30#include "mm_32.h"
31
30/* 32/*
31 * This can be sized dynamically, but we will do this 33 * This can be sized dynamically, but we will do this
32 * only when we have a guidance about actual I/O pressures. 34 * only when we have a guidance about actual I/O pressures.
@@ -37,9 +39,6 @@
37#define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */ 39#define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */
38#define IOMMU_ORDER 6 /* 4096 * (1<<6) */ 40#define IOMMU_ORDER 6 /* 4096 * (1<<6) */
39 41
40/* srmmu.c */
41extern int viking_mxcc_present;
42extern int flush_page_for_dma_global;
43static int viking_flush; 42static int viking_flush;
44/* viking.S */ 43/* viking.S */
45extern void viking_flush_page(unsigned long page); 44extern void viking_flush_page(unsigned long page);
@@ -59,6 +58,8 @@ static void __init sbus_iommu_init(struct platform_device *op)
59 struct iommu_struct *iommu; 58 struct iommu_struct *iommu;
60 unsigned int impl, vers; 59 unsigned int impl, vers;
61 unsigned long *bitmap; 60 unsigned long *bitmap;
61 unsigned long control;
62 unsigned long base;
62 unsigned long tmp; 63 unsigned long tmp;
63 64
64 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); 65 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL);
@@ -73,12 +74,14 @@ static void __init sbus_iommu_init(struct platform_device *op)
73 prom_printf("Cannot map IOMMU registers\n"); 74 prom_printf("Cannot map IOMMU registers\n");
74 prom_halt(); 75 prom_halt();
75 } 76 }
76 impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28; 77
77 vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24; 78 control = sbus_readl(&iommu->regs->control);
78 tmp = iommu->regs->control; 79 impl = (control & IOMMU_CTRL_IMPL) >> 28;
79 tmp &= ~(IOMMU_CTRL_RNGE); 80 vers = (control & IOMMU_CTRL_VERS) >> 24;
80 tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); 81 control &= ~(IOMMU_CTRL_RNGE);
81 iommu->regs->control = tmp; 82 control |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB);
83 sbus_writel(control, &iommu->regs->control);
84
82 iommu_invalidate(iommu->regs); 85 iommu_invalidate(iommu->regs);
83 iommu->start = IOMMU_START; 86 iommu->start = IOMMU_START;
84 iommu->end = 0xffffffff; 87 iommu->end = 0xffffffff;
@@ -100,7 +103,9 @@ static void __init sbus_iommu_init(struct platform_device *op)
100 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); 103 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t));
101 flush_cache_all(); 104 flush_cache_all();
102 flush_tlb_all(); 105 flush_tlb_all();
103 iommu->regs->base = __pa((unsigned long) iommu->page_table) >> 4; 106
107 base = __pa((unsigned long)iommu->page_table) >> 4;
108 sbus_writel(base, &iommu->regs->base);
104 iommu_invalidate(iommu->regs); 109 iommu_invalidate(iommu->regs);
105 110
106 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); 111 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL);
diff --git a/arch/sparc/mm/leon_mm.c b/arch/sparc/mm/leon_mm.c
index 5bed085a2c17..3b17b6f7895a 100644
--- a/arch/sparc/mm/leon_mm.c
+++ b/arch/sparc/mm/leon_mm.c
@@ -15,10 +15,10 @@
15#include <asm/leon.h> 15#include <asm/leon.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17 17
18#include "srmmu.h" 18#include "mm_32.h"
19 19
20int leon_flush_during_switch = 1; 20int leon_flush_during_switch = 1;
21int srmmu_swprobe_trace; 21static int srmmu_swprobe_trace;
22 22
23static inline unsigned long leon_get_ctable_ptr(void) 23static inline unsigned long leon_get_ctable_ptr(void)
24{ 24{
diff --git a/arch/sparc/mm/mm_32.h b/arch/sparc/mm/mm_32.h
new file mode 100644
index 000000000000..a6c27ca9a721
--- /dev/null
+++ b/arch/sparc/mm/mm_32.h
@@ -0,0 +1,24 @@
1/* fault_32.c - visible as they are called from assembler */
2asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
3 unsigned long address);
4asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
5 unsigned long address);
6
7void window_overflow_fault(void);
8void window_underflow_fault(unsigned long sp);
9void window_ret_fault(struct pt_regs *regs);
10
11/* srmmu.c */
12extern char *srmmu_name;
13extern int viking_mxcc_present;
14extern int flush_page_for_dma_global;
15
16extern void (*poke_srmmu)(void);
17
18void __init srmmu_paging_init(void);
19
20/* iommu.c */
21void ld_mmu_iommu(void);
22
23/* io-unit.c */
24void ld_mmu_iounit(void);
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index cfbe53c17b0d..be65f035d18a 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -49,7 +49,7 @@
49#include <asm/mxcc.h> 49#include <asm/mxcc.h>
50#include <asm/ross.h> 50#include <asm/ross.h>
51 51
52#include "srmmu.h" 52#include "mm_32.h"
53 53
54enum mbus_module srmmu_modtype; 54enum mbus_module srmmu_modtype;
55static unsigned int hwbug_bitmask; 55static unsigned int hwbug_bitmask;
@@ -100,7 +100,6 @@ static unsigned long srmmu_nocache_end;
100#define SRMMU_NOCACHE_ALIGN_MAX (sizeof(ctxd_t)*SRMMU_MAX_CONTEXTS) 100#define SRMMU_NOCACHE_ALIGN_MAX (sizeof(ctxd_t)*SRMMU_MAX_CONTEXTS)
101 101
102void *srmmu_nocache_pool; 102void *srmmu_nocache_pool;
103void *srmmu_nocache_bitmap;
104static struct bit_map srmmu_nocache_map; 103static struct bit_map srmmu_nocache_map;
105 104
106static inline int srmmu_pmd_none(pmd_t pmd) 105static inline int srmmu_pmd_none(pmd_t pmd)
@@ -173,7 +172,7 @@ static void *__srmmu_get_nocache(int size, int align)
173 printk(KERN_ERR "srmmu: out of nocache %d: %d/%d\n", 172 printk(KERN_ERR "srmmu: out of nocache %d: %d/%d\n",
174 size, (int) srmmu_nocache_size, 173 size, (int) srmmu_nocache_size,
175 srmmu_nocache_map.used << SRMMU_NOCACHE_BITMAP_SHIFT); 174 srmmu_nocache_map.used << SRMMU_NOCACHE_BITMAP_SHIFT);
176 return 0; 175 return NULL;
177 } 176 }
178 177
179 addr = SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT); 178 addr = SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT);
@@ -269,6 +268,7 @@ static void __init srmmu_nocache_calcsize(void)
269 268
270static void __init srmmu_nocache_init(void) 269static void __init srmmu_nocache_init(void)
271{ 270{
271 void *srmmu_nocache_bitmap;
272 unsigned int bitmap_bits; 272 unsigned int bitmap_bits;
273 pgd_t *pgd; 273 pgd_t *pgd;
274 pmd_t *pmd; 274 pmd_t *pmd;
@@ -728,7 +728,7 @@ static inline unsigned long srmmu_probe(unsigned long vaddr)
728 "=r" (retval) : 728 "=r" (retval) :
729 "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE)); 729 "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE));
730 } else { 730 } else {
731 retval = leon_swprobe(vaddr, 0); 731 retval = leon_swprobe(vaddr, NULL);
732 } 732 }
733 return retval; 733 return retval;
734} 734}
@@ -865,8 +865,6 @@ static void __init map_kernel(void)
865 865
866void (*poke_srmmu)(void) = NULL; 866void (*poke_srmmu)(void) = NULL;
867 867
868extern unsigned long bootmem_init(unsigned long *pages_avail);
869
870void __init srmmu_paging_init(void) 868void __init srmmu_paging_init(void)
871{ 869{
872 int i; 870 int i;
@@ -1771,9 +1769,6 @@ static struct sparc32_cachetlb_ops smp_cachetlb_ops = {
1771/* Load up routines and constants for sun4m and sun4d mmu */ 1769/* Load up routines and constants for sun4m and sun4d mmu */
1772void __init load_mmu(void) 1770void __init load_mmu(void)
1773{ 1771{
1774 extern void ld_mmu_iommu(void);
1775 extern void ld_mmu_iounit(void);
1776
1777 /* Functions */ 1772 /* Functions */
1778 get_srmmu_type(); 1773 get_srmmu_type();
1779 1774
diff --git a/arch/sparc/mm/srmmu.h b/arch/sparc/mm/srmmu.h
deleted file mode 100644
index 5703274ccf89..000000000000
--- a/arch/sparc/mm/srmmu.h
+++ /dev/null
@@ -1,4 +0,0 @@
1/* srmmu.c */
2extern char *srmmu_name;
3
4extern void (*poke_srmmu)(void);
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index fe19b81acc09..a06576683c38 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -9,6 +9,7 @@
9#include <asm/page.h> 9#include <asm/page.h>
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11#include <asm/mmu_context.h> 11#include <asm/mmu_context.h>
12#include <asm/setup.h>
12#include <asm/tsb.h> 13#include <asm/tsb.h>
13#include <asm/tlb.h> 14#include <asm/tlb.h>
14#include <asm/oplib.h> 15#include <asm/oplib.h>
diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c
index f178b9dcc7b7..53a696d3eb3b 100644
--- a/arch/sparc/prom/misc_64.c
+++ b/arch/sparc/prom/misc_64.c
@@ -81,11 +81,6 @@ void prom_feval(const char *fstring)
81} 81}
82EXPORT_SYMBOL(prom_feval); 82EXPORT_SYMBOL(prom_feval);
83 83
84#ifdef CONFIG_SMP
85extern void smp_capture(void);
86extern void smp_release(void);
87#endif
88
89/* Drop into the prom, with the chance to continue with the 'go' 84/* Drop into the prom, with the chance to continue with the 'go'
90 * prom command. 85 * prom command.
91 */ 86 */
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index aafad6fa1667..928237a7b9ca 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -51,9 +51,6 @@ config ARCH_HAS_ILOG2_U32
51config ARCH_HAS_ILOG2_U64 51config ARCH_HAS_ILOG2_U64
52 bool 52 bool
53 53
54config ARCH_HAS_CPUFREQ
55 bool
56
57config GENERIC_HWEIGHT 54config GENERIC_HWEIGHT
58 def_bool y 55 def_bool y
59 56
@@ -87,7 +84,6 @@ config ARCH_PUV3
87 select GENERIC_CLOCKEVENTS 84 select GENERIC_CLOCKEVENTS
88 select HAVE_CLK 85 select HAVE_CLK
89 select ARCH_REQUIRE_GPIOLIB 86 select ARCH_REQUIRE_GPIOLIB
90 select ARCH_HAS_CPUFREQ
91 87
92# CONFIGs for ARCH_PUV3 88# CONFIGs for ARCH_PUV3
93 89
@@ -198,9 +194,7 @@ menu "Power management options"
198 194
199source "kernel/power/Kconfig" 195source "kernel/power/Kconfig"
200 196
201if ARCH_HAS_CPUFREQ
202source "drivers/cpufreq/Kconfig" 197source "drivers/cpufreq/Kconfig"
203endif
204 198
205config ARCH_SUSPEND_POSSIBLE 199config ARCH_SUSPEND_POSSIBLE
206 def_bool y if !ARCH_FPGA 200 def_bool y if !ARCH_FPGA
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h
index 39decb6e6f57..cb1d8fd2b16b 100644
--- a/arch/unicore32/include/asm/io.h
+++ b/arch/unicore32/include/asm/io.h
@@ -39,10 +39,37 @@ extern void __uc32_iounmap(volatile void __iomem *addr);
39#define ioremap_nocache(cookie, size) __uc32_ioremap(cookie, size) 39#define ioremap_nocache(cookie, size) __uc32_ioremap(cookie, size)
40#define iounmap(cookie) __uc32_iounmap(cookie) 40#define iounmap(cookie) __uc32_iounmap(cookie)
41 41
42#define readb_relaxed readb
43#define readw_relaxed readw
44#define readl_relaxed readl
45
42#define HAVE_ARCH_PIO_SIZE 46#define HAVE_ARCH_PIO_SIZE
43#define PIO_OFFSET (unsigned int)(PCI_IOBASE) 47#define PIO_OFFSET (unsigned int)(PCI_IOBASE)
44#define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) 48#define PIO_MASK (unsigned int)(IO_SPACE_LIMIT)
45#define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1) 49#define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1)
46 50
51#ifdef CONFIG_STRICT_DEVMEM
52
53#include <linux/ioport.h>
54#include <linux/mm.h>
55
56/*
57 * devmem_is_allowed() checks to see if /dev/mem access to a certain
58 * address is valid. The argument is a physical page number.
59 * We mimic x86 here by disallowing access to system RAM as well as
60 * device-exclusive MMIO regions. This effectively disable read()/write()
61 * on /dev/mem.
62 */
63static inline int devmem_is_allowed(unsigned long pfn)
64{
65 if (iomem_is_exclusive(pfn << PAGE_SHIFT))
66 return 0;
67 if (!page_is_ram(pfn))
68 return 1;
69 return 0;
70}
71
72#endif /* CONFIG_STRICT_DEVMEM */
73
47#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
48#endif /* __UNICORE_IO_H__ */ 75#endif /* __UNICORE_IO_H__ */
diff --git a/arch/unicore32/include/asm/pgtable.h b/arch/unicore32/include/asm/pgtable.h
index 233c25880df4..ed6f7d000fba 100644
--- a/arch/unicore32/include/asm/pgtable.h
+++ b/arch/unicore32/include/asm/pgtable.h
@@ -87,16 +87,16 @@ extern pgprot_t pgprot_kernel;
87 87
88#define PAGE_NONE pgprot_user 88#define PAGE_NONE pgprot_user
89#define PAGE_SHARED __pgprot(pgprot_val(pgprot_user | PTE_READ \ 89#define PAGE_SHARED __pgprot(pgprot_val(pgprot_user | PTE_READ \
90 | PTE_WRITE) 90 | PTE_WRITE))
91#define PAGE_SHARED_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ 91#define PAGE_SHARED_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \
92 | PTE_WRITE \ 92 | PTE_WRITE \
93 | PTE_EXEC) 93 | PTE_EXEC))
94#define PAGE_COPY __pgprot(pgprot_val(pgprot_user | PTE_READ) 94#define PAGE_COPY __pgprot(pgprot_val(pgprot_user | PTE_READ)
95#define PAGE_COPY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ 95#define PAGE_COPY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \
96 | PTE_EXEC) 96 | PTE_EXEC))
97#define PAGE_READONLY __pgprot(pgprot_val(pgprot_user | PTE_READ) 97#define PAGE_READONLY __pgprot(pgprot_val(pgprot_user | PTE_READ))
98#define PAGE_READONLY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ 98#define PAGE_READONLY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \
99 | PTE_EXEC) 99 | PTE_EXEC))
100#define PAGE_KERNEL pgprot_kernel 100#define PAGE_KERNEL pgprot_kernel
101#define PAGE_KERNEL_EXEC __pgprot(pgprot_val(pgprot_kernel | PTE_EXEC)) 101#define PAGE_KERNEL_EXEC __pgprot(pgprot_val(pgprot_kernel | PTE_EXEC))
102 102
diff --git a/arch/unicore32/include/asm/ptrace.h b/arch/unicore32/include/asm/ptrace.h
index 9df53d991c78..02bf5a415bf5 100644
--- a/arch/unicore32/include/asm/ptrace.h
+++ b/arch/unicore32/include/asm/ptrace.h
@@ -55,6 +55,7 @@ static inline int valid_user_regs(struct pt_regs *regs)
55 55
56#define instruction_pointer(regs) ((regs)->UCreg_pc) 56#define instruction_pointer(regs) ((regs)->UCreg_pc)
57#define user_stack_pointer(regs) ((regs)->UCreg_sp) 57#define user_stack_pointer(regs) ((regs)->UCreg_sp)
58#define profile_pc(regs) instruction_pointer(regs)
58 59
59#endif /* __ASSEMBLY__ */ 60#endif /* __ASSEMBLY__ */
60#endif 61#endif
diff --git a/arch/unicore32/kernel/clock.c b/arch/unicore32/kernel/clock.c
index 18d4563e6fa5..b1ca775f6f6e 100644
--- a/arch/unicore32/kernel/clock.c
+++ b/arch/unicore32/kernel/clock.c
@@ -179,7 +179,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
179 } 179 }
180#ifdef CONFIG_CPU_FREQ 180#ifdef CONFIG_CPU_FREQ
181 if (clk == &clk_mclk_clk) { 181 if (clk == &clk_mclk_clk) {
182 u32 pll_rate, divstatus = PM_DIVSTATUS; 182 u32 pll_rate, divstatus = readl(PM_DIVSTATUS);
183 int ret, i; 183 int ret, i;
184 184
185 /* lookup mclk_clk_table */ 185 /* lookup mclk_clk_table */
@@ -201,10 +201,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
201 / (((divstatus & 0x0000f000) >> 12) + 1); 201 / (((divstatus & 0x0000f000) >> 12) + 1);
202 202
203 /* set pll sys cfg reg. */ 203 /* set pll sys cfg reg. */
204 PM_PLLSYSCFG = pll_rate; 204 writel(pll_rate, PM_PLLSYSCFG);
205 205
206 PM_PMCR = PM_PMCR_CFBSYS; 206 writel(PM_PMCR_CFBSYS, PM_PMCR);
207 while ((PM_PLLDFCDONE & PM_PLLDFCDONE_SYSDFC) 207 while ((readl(PM_PLLDFCDONE) & PM_PLLDFCDONE_SYSDFC)
208 != PM_PLLDFCDONE_SYSDFC) 208 != PM_PLLDFCDONE_SYSDFC)
209 udelay(100); 209 udelay(100);
210 /* about 1ms */ 210 /* about 1ms */
diff --git a/arch/unicore32/kernel/ksyms.c b/arch/unicore32/kernel/ksyms.c
index d285d71cbe35..0323528a80fd 100644
--- a/arch/unicore32/kernel/ksyms.c
+++ b/arch/unicore32/kernel/ksyms.c
@@ -23,41 +23,15 @@
23 23
24#include "ksyms.h" 24#include "ksyms.h"
25 25
26EXPORT_SYMBOL(find_first_bit);
27EXPORT_SYMBOL(find_first_zero_bit);
26EXPORT_SYMBOL(find_next_zero_bit); 28EXPORT_SYMBOL(find_next_zero_bit);
27EXPORT_SYMBOL(find_next_bit); 29EXPORT_SYMBOL(find_next_bit);
28 30
29EXPORT_SYMBOL(__backtrace);
30
31 /* platform dependent support */ 31 /* platform dependent support */
32EXPORT_SYMBOL(__udelay); 32EXPORT_SYMBOL(__udelay);
33EXPORT_SYMBOL(__const_udelay); 33EXPORT_SYMBOL(__const_udelay);
34 34
35 /* networking */
36EXPORT_SYMBOL(csum_partial);
37EXPORT_SYMBOL(csum_partial_copy_from_user);
38EXPORT_SYMBOL(csum_partial_copy_nocheck);
39EXPORT_SYMBOL(__csum_ipv6_magic);
40
41 /* io */
42#ifndef __raw_readsb
43EXPORT_SYMBOL(__raw_readsb);
44#endif
45#ifndef __raw_readsw
46EXPORT_SYMBOL(__raw_readsw);
47#endif
48#ifndef __raw_readsl
49EXPORT_SYMBOL(__raw_readsl);
50#endif
51#ifndef __raw_writesb
52EXPORT_SYMBOL(__raw_writesb);
53#endif
54#ifndef __raw_writesw
55EXPORT_SYMBOL(__raw_writesw);
56#endif
57#ifndef __raw_writesl
58EXPORT_SYMBOL(__raw_writesl);
59#endif
60
61 /* string / mem functions */ 35 /* string / mem functions */
62EXPORT_SYMBOL(strchr); 36EXPORT_SYMBOL(strchr);
63EXPORT_SYMBOL(strrchr); 37EXPORT_SYMBOL(strrchr);
@@ -76,23 +50,12 @@ EXPORT_SYMBOL(__copy_from_user);
76EXPORT_SYMBOL(__copy_to_user); 50EXPORT_SYMBOL(__copy_to_user);
77EXPORT_SYMBOL(__clear_user); 51EXPORT_SYMBOL(__clear_user);
78 52
79EXPORT_SYMBOL(__get_user_1);
80EXPORT_SYMBOL(__get_user_2);
81EXPORT_SYMBOL(__get_user_4);
82
83EXPORT_SYMBOL(__put_user_1);
84EXPORT_SYMBOL(__put_user_2);
85EXPORT_SYMBOL(__put_user_4);
86EXPORT_SYMBOL(__put_user_8);
87
88EXPORT_SYMBOL(__ashldi3); 53EXPORT_SYMBOL(__ashldi3);
89EXPORT_SYMBOL(__ashrdi3); 54EXPORT_SYMBOL(__ashrdi3);
90EXPORT_SYMBOL(__divsi3); 55EXPORT_SYMBOL(__divsi3);
91EXPORT_SYMBOL(__lshrdi3); 56EXPORT_SYMBOL(__lshrdi3);
92EXPORT_SYMBOL(__modsi3); 57EXPORT_SYMBOL(__modsi3);
93EXPORT_SYMBOL(__muldi3);
94EXPORT_SYMBOL(__ucmpdi2); 58EXPORT_SYMBOL(__ucmpdi2);
95EXPORT_SYMBOL(__udivsi3); 59EXPORT_SYMBOL(__udivsi3);
96EXPORT_SYMBOL(__umodsi3); 60EXPORT_SYMBOL(__umodsi3);
97EXPORT_SYMBOL(__bswapsi2);
98 61
diff --git a/arch/unicore32/kernel/ksyms.h b/arch/unicore32/kernel/ksyms.h
index 185cdc712d03..31472ad9467a 100644
--- a/arch/unicore32/kernel/ksyms.h
+++ b/arch/unicore32/kernel/ksyms.h
@@ -8,8 +8,6 @@ extern void __ashrdi3(void);
8extern void __divsi3(void); 8extern void __divsi3(void);
9extern void __lshrdi3(void); 9extern void __lshrdi3(void);
10extern void __modsi3(void); 10extern void __modsi3(void);
11extern void __muldi3(void);
12extern void __ucmpdi2(void); 11extern void __ucmpdi2(void);
13extern void __udivsi3(void); 12extern void __udivsi3(void);
14extern void __umodsi3(void); 13extern void __umodsi3(void);
15extern void __bswapsi2(void);
diff --git a/arch/unicore32/kernel/module.c b/arch/unicore32/kernel/module.c
index 16bd1495b934..dc41f6dfedb6 100644
--- a/arch/unicore32/kernel/module.c
+++ b/arch/unicore32/kernel/module.c
@@ -24,14 +24,9 @@
24 24
25void *module_alloc(unsigned long size) 25void *module_alloc(unsigned long size)
26{ 26{
27 struct vm_struct *area; 27 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
28 28 GFP_KERNEL, PAGE_KERNEL_EXEC, NUMA_NO_NODE,
29 size = PAGE_ALIGN(size); 29 __builtin_return_address(0));
30 area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
31 if (!area)
32 return NULL;
33
34 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC);
35} 30}
36 31
37int 32int
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index 778ebba80827..b008e9961465 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -60,6 +60,7 @@ void machine_halt(void)
60 * Function pointers to optional machine specific functions 60 * Function pointers to optional machine specific functions
61 */ 61 */
62void (*pm_power_off)(void) = NULL; 62void (*pm_power_off)(void) = NULL;
63EXPORT_SYMBOL(pm_power_off);
63 64
64void machine_power_off(void) 65void machine_power_off(void)
65{ 66{
diff --git a/arch/unicore32/kernel/setup.c b/arch/unicore32/kernel/setup.c
index 87adbf5ebfe0..3fa317f96122 100644
--- a/arch/unicore32/kernel/setup.c
+++ b/arch/unicore32/kernel/setup.c
@@ -53,6 +53,10 @@ struct stack {
53 53
54static struct stack stacks[NR_CPUS]; 54static struct stack stacks[NR_CPUS];
55 55
56#ifdef CONFIG_VGA_CONSOLE
57struct screen_info screen_info;
58#endif
59
56char elf_platform[ELF_PLATFORM_SIZE]; 60char elf_platform[ELF_PLATFORM_SIZE];
57EXPORT_SYMBOL(elf_platform); 61EXPORT_SYMBOL(elf_platform);
58 62
diff --git a/arch/unicore32/mm/alignment.c b/arch/unicore32/mm/alignment.c
index de7dc5fdd58b..24e836023e6c 100644
--- a/arch/unicore32/mm/alignment.c
+++ b/arch/unicore32/mm/alignment.c
@@ -21,6 +21,7 @@
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/uaccess.h> 22#include <linux/uaccess.h>
23 23
24#include <asm/pgtable.h>
24#include <asm/tlbflush.h> 25#include <asm/tlbflush.h>
25#include <asm/unaligned.h> 26#include <asm/unaligned.h>
26 27
diff --git a/arch/unicore32/mm/proc-syms.c b/arch/unicore32/mm/proc-syms.c
index f30071e3665d..21c00fc85c99 100644
--- a/arch/unicore32/mm/proc-syms.c
+++ b/arch/unicore32/mm/proc-syms.c
@@ -19,5 +19,7 @@
19EXPORT_SYMBOL(cpu_dcache_clean_area); 19EXPORT_SYMBOL(cpu_dcache_clean_area);
20EXPORT_SYMBOL(cpu_set_pte); 20EXPORT_SYMBOL(cpu_set_pte);
21 21
22EXPORT_SYMBOL(__cpuc_coherent_kern_range);
23
22EXPORT_SYMBOL(__cpuc_dma_flush_range); 24EXPORT_SYMBOL(__cpuc_dma_flush_range);
23EXPORT_SYMBOL(__cpuc_dma_clean_range); 25EXPORT_SYMBOL(__cpuc_dma_clean_range);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fcefdda5136d..a8f749ef0fdc 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1672,7 +1672,6 @@ config RELOCATABLE
1672config RANDOMIZE_BASE 1672config RANDOMIZE_BASE
1673 bool "Randomize the address of the kernel image" 1673 bool "Randomize the address of the kernel image"
1674 depends on RELOCATABLE 1674 depends on RELOCATABLE
1675 depends on !HIBERNATION
1676 default n 1675 default n
1677 ---help--- 1676 ---help---
1678 Randomizes the physical and virtual address at which the 1677 Randomizes the physical and virtual address at which the
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c
index 4dbf967da50d..fc6091abedb7 100644
--- a/arch/x86/boot/compressed/aslr.c
+++ b/arch/x86/boot/compressed/aslr.c
@@ -289,10 +289,17 @@ unsigned char *choose_kernel_location(unsigned char *input,
289 unsigned long choice = (unsigned long)output; 289 unsigned long choice = (unsigned long)output;
290 unsigned long random; 290 unsigned long random;
291 291
292#ifdef CONFIG_HIBERNATION
293 if (!cmdline_find_option_bool("kaslr")) {
294 debug_putstr("KASLR disabled by default...\n");
295 goto out;
296 }
297#else
292 if (cmdline_find_option_bool("nokaslr")) { 298 if (cmdline_find_option_bool("nokaslr")) {
293 debug_putstr("KASLR disabled...\n"); 299 debug_putstr("KASLR disabled by cmdline...\n");
294 goto out; 300 goto out;
295 } 301 }
302#endif
296 303
297 /* Record the various known unsafe memory ranges. */ 304 /* Record the various known unsafe memory ranges. */
298 mem_avoid_init((unsigned long)input, input_size, 305 mem_avoid_init((unsigned long)input, input_size,
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index cb6cfcd034cf..a80cbb88ea91 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -43,7 +43,7 @@ extern int vector_used_by_percpu_irq(unsigned int vector);
43extern void init_ISA_irqs(void); 43extern void init_ISA_irqs(void);
44 44
45#ifdef CONFIG_X86_LOCAL_APIC 45#ifdef CONFIG_X86_LOCAL_APIC
46void arch_trigger_all_cpu_backtrace(void); 46void arch_trigger_all_cpu_backtrace(bool);
47#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace 47#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
48#endif 48#endif
49 49
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 49314155b66c..49205d01b9ad 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -95,7 +95,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
95#define KVM_REFILL_PAGES 25 95#define KVM_REFILL_PAGES 25
96#define KVM_MAX_CPUID_ENTRIES 80 96#define KVM_MAX_CPUID_ENTRIES 80
97#define KVM_NR_FIXED_MTRR_REGION 88 97#define KVM_NR_FIXED_MTRR_REGION 88
98#define KVM_NR_VAR_MTRR 8 98#define KVM_NR_VAR_MTRR 10
99 99
100#define ASYNC_PF_PER_VCPU 64 100#define ASYNC_PF_PER_VCPU 64
101 101
@@ -461,7 +461,7 @@ struct kvm_vcpu_arch {
461 bool nmi_injected; /* Trying to inject an NMI this entry */ 461 bool nmi_injected; /* Trying to inject an NMI this entry */
462 462
463 struct mtrr_state_type mtrr_state; 463 struct mtrr_state_type mtrr_state;
464 u32 pat; 464 u64 pat;
465 465
466 unsigned switch_db_regs; 466 unsigned switch_db_regs;
467 unsigned long db[KVM_NR_DB_REGS]; 467 unsigned long db[KVM_NR_DB_REGS];
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 14fd6fd75a19..6205f0c434db 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -231,6 +231,22 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
231 231
232#define ARCH_HAS_USER_SINGLE_STEP_INFO 232#define ARCH_HAS_USER_SINGLE_STEP_INFO
233 233
234/*
235 * When hitting ptrace_stop(), we cannot return using SYSRET because
236 * that does not restore the full CPU state, only a minimal set. The
237 * ptracer can change arbitrary register values, which is usually okay
238 * because the usual ptrace stops run off the signal delivery path which
239 * forces IRET; however, ptrace_event() stops happen in arbitrary places
240 * in the kernel and don't force IRET path.
241 *
242 * So force IRET path after a ptrace stop.
243 */
244#define arch_ptrace_stop_needed(code, info) \
245({ \
246 set_thread_flag(TIF_NOTIFY_RESUME); \
247 false; \
248})
249
234struct user_desc; 250struct user_desc;
235extern int do_get_thread_area(struct task_struct *p, int idx, 251extern int do_get_thread_area(struct task_struct *p, int idx,
236 struct user_desc __user *info); 252 struct user_desc __user *info);
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index c3fcb5de5083..6a1e71bde323 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -33,31 +33,41 @@ static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
33/* "in progress" flag of arch_trigger_all_cpu_backtrace */ 33/* "in progress" flag of arch_trigger_all_cpu_backtrace */
34static unsigned long backtrace_flag; 34static unsigned long backtrace_flag;
35 35
36void arch_trigger_all_cpu_backtrace(void) 36void arch_trigger_all_cpu_backtrace(bool include_self)
37{ 37{
38 int i; 38 int i;
39 int cpu = get_cpu();
39 40
40 if (test_and_set_bit(0, &backtrace_flag)) 41 if (test_and_set_bit(0, &backtrace_flag)) {
41 /* 42 /*
42 * If there is already a trigger_all_cpu_backtrace() in progress 43 * If there is already a trigger_all_cpu_backtrace() in progress
43 * (backtrace_flag == 1), don't output double cpu dump infos. 44 * (backtrace_flag == 1), don't output double cpu dump infos.
44 */ 45 */
46 put_cpu();
45 return; 47 return;
48 }
46 49
47 cpumask_copy(to_cpumask(backtrace_mask), cpu_online_mask); 50 cpumask_copy(to_cpumask(backtrace_mask), cpu_online_mask);
51 if (!include_self)
52 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
48 53
49 printk(KERN_INFO "sending NMI to all CPUs:\n"); 54 if (!cpumask_empty(to_cpumask(backtrace_mask))) {
50 apic->send_IPI_all(NMI_VECTOR); 55 pr_info("sending NMI to %s CPUs:\n",
56 (include_self ? "all" : "other"));
57 apic->send_IPI_mask(to_cpumask(backtrace_mask), NMI_VECTOR);
58 }
51 59
52 /* Wait for up to 10 seconds for all CPUs to do the backtrace */ 60 /* Wait for up to 10 seconds for all CPUs to do the backtrace */
53 for (i = 0; i < 10 * 1000; i++) { 61 for (i = 0; i < 10 * 1000; i++) {
54 if (cpumask_empty(to_cpumask(backtrace_mask))) 62 if (cpumask_empty(to_cpumask(backtrace_mask)))
55 break; 63 break;
56 mdelay(1); 64 mdelay(1);
65 touch_softlockup_watchdog();
57 } 66 }
58 67
59 clear_bit(0, &backtrace_flag); 68 clear_bit(0, &backtrace_flag);
60 smp_mb__after_atomic(); 69 smp_mb__after_atomic();
70 put_cpu();
61} 71}
62 72
63static int 73static int
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index f0da82b8e634..dbaa23e78b36 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -423,9 +423,10 @@ sysenter_past_esp:
423 jnz sysenter_audit 423 jnz sysenter_audit
424sysenter_do_call: 424sysenter_do_call:
425 cmpl $(NR_syscalls), %eax 425 cmpl $(NR_syscalls), %eax
426 jae syscall_badsys 426 jae sysenter_badsys
427 call *sys_call_table(,%eax,4) 427 call *sys_call_table(,%eax,4)
428 movl %eax,PT_EAX(%esp) 428 movl %eax,PT_EAX(%esp)
429sysenter_after_call:
429 LOCKDEP_SYS_EXIT 430 LOCKDEP_SYS_EXIT
430 DISABLE_INTERRUPTS(CLBR_ANY) 431 DISABLE_INTERRUPTS(CLBR_ANY)
431 TRACE_IRQS_OFF 432 TRACE_IRQS_OFF
@@ -675,7 +676,12 @@ END(syscall_fault)
675 676
676syscall_badsys: 677syscall_badsys:
677 movl $-ENOSYS,PT_EAX(%esp) 678 movl $-ENOSYS,PT_EAX(%esp)
678 jmp resume_userspace 679 jmp syscall_exit
680END(syscall_badsys)
681
682sysenter_badsys:
683 movl $-ENOSYS,PT_EAX(%esp)
684 jmp sysenter_after_call
679END(syscall_badsys) 685END(syscall_badsys)
680 CFI_ENDPROC 686 CFI_ENDPROC
681 687
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index a0da58db43a8..2851d63c1202 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -363,7 +363,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
363 363
364 /* Set up to return from userspace. */ 364 /* Set up to return from userspace. */
365 restorer = current->mm->context.vdso + 365 restorer = current->mm->context.vdso +
366 selected_vdso32->sym___kernel_sigreturn; 366 selected_vdso32->sym___kernel_rt_sigreturn;
367 if (ksig->ka.sa.sa_flags & SA_RESTORER) 367 if (ksig->ka.sa.sa_flags & SA_RESTORER)
368 restorer = ksig->ka.sa.sa_restorer; 368 restorer = ksig->ka.sa.sa_restorer;
369 put_user_ex(restorer, &frame->pretcode); 369 put_user_ex(restorer, &frame->pretcode);
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index c6eb418c5627..0d0e922fafc1 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -343,6 +343,7 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
343 if (poke_int3_handler(regs)) 343 if (poke_int3_handler(regs))
344 return; 344 return;
345 345
346 prev_state = exception_enter();
346#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP 347#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
347 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 348 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
348 SIGTRAP) == NOTIFY_STOP) 349 SIGTRAP) == NOTIFY_STOP)
@@ -351,9 +352,8 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
351 352
352#ifdef CONFIG_KPROBES 353#ifdef CONFIG_KPROBES
353 if (kprobe_int3_handler(regs)) 354 if (kprobe_int3_handler(regs))
354 return; 355 goto exit;
355#endif 356#endif
356 prev_state = exception_enter();
357 357
358 if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 358 if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
359 SIGTRAP) == NOTIFY_STOP) 359 SIGTRAP) == NOTIFY_STOP)
@@ -433,6 +433,8 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
433 unsigned long dr6; 433 unsigned long dr6;
434 int si_code; 434 int si_code;
435 435
436 prev_state = exception_enter();
437
436 get_debugreg(dr6, 6); 438 get_debugreg(dr6, 6);
437 439
438 /* Filter out all the reserved bits which are preset to 1 */ 440 /* Filter out all the reserved bits which are preset to 1 */
@@ -465,7 +467,6 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
465 if (kprobe_debug_handler(regs)) 467 if (kprobe_debug_handler(regs))
466 goto exit; 468 goto exit;
467#endif 469#endif
468 prev_state = exception_enter();
469 470
470 if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code, 471 if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code,
471 SIGTRAP) == NOTIFY_STOP) 472 SIGTRAP) == NOTIFY_STOP)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ec8366c5cfea..b5e994ad0135 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1462,6 +1462,7 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
1462 */ 1462 */
1463 if (var->unusable) 1463 if (var->unusable)
1464 var->db = 0; 1464 var->db = 0;
1465 var->dpl = to_svm(vcpu)->vmcb->save.cpl;
1465 break; 1466 break;
1466 } 1467 }
1467} 1468}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f32a02578c0d..f6449334ec45 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1898,7 +1898,7 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1898 if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) 1898 if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE))
1899 break; 1899 break;
1900 gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; 1900 gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT;
1901 if (kvm_write_guest(kvm, data, 1901 if (kvm_write_guest(kvm, gfn << HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT,
1902 &tsc_ref, sizeof(tsc_ref))) 1902 &tsc_ref, sizeof(tsc_ref)))
1903 return 1; 1903 return 1;
1904 mark_page_dirty(kvm, gfn); 1904 mark_page_dirty(kvm, gfn);
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 3c0809a0631f..61b04fe36e66 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -11,7 +11,6 @@ VDSO32-$(CONFIG_COMPAT) := y
11 11
12# files to link into the vdso 12# files to link into the vdso
13vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vdso-fakesections.o 13vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vdso-fakesections.o
14vobjs-nox32 := vdso-fakesections.o
15 14
16# files to link into kernel 15# files to link into kernel
17obj-y += vma.o 16obj-y += vma.o
@@ -67,7 +66,8 @@ $(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso2c FORCE
67# 66#
68CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ 67CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
69 $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ 68 $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \
70 -fno-omit-frame-pointer -foptimize-sibling-calls 69 -fno-omit-frame-pointer -foptimize-sibling-calls \
70 -DDISABLE_BRANCH_PROFILING
71 71
72$(vobjs): KBUILD_CFLAGS += $(CFL) 72$(vobjs): KBUILD_CFLAGS += $(CFL)
73 73
@@ -134,7 +134,7 @@ override obj-dirs = $(dir $(obj)) $(obj)/vdso32/
134 134
135targets += vdso32/vdso32.lds 135targets += vdso32/vdso32.lds
136targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o) 136targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o)
137targets += vdso32/vclock_gettime.o 137targets += vdso32/vclock_gettime.o vdso32/vdso-fakesections.o
138 138
139$(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%) 139$(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%)
140 140
@@ -150,11 +150,13 @@ KBUILD_CFLAGS_32 += -m32 -msoft-float -mregparm=0 -fpic
150KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector) 150KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector)
151KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) 151KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls)
152KBUILD_CFLAGS_32 += -fno-omit-frame-pointer 152KBUILD_CFLAGS_32 += -fno-omit-frame-pointer
153KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
153$(vdso32-images:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) 154$(vdso32-images:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
154 155
155$(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \ 156$(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \
156 $(obj)/vdso32/vdso32.lds \ 157 $(obj)/vdso32/vdso32.lds \
157 $(obj)/vdso32/vclock_gettime.o \ 158 $(obj)/vdso32/vclock_gettime.o \
159 $(obj)/vdso32/vdso-fakesections.o \
158 $(obj)/vdso32/note.o \ 160 $(obj)/vdso32/note.o \
159 $(obj)/vdso32/%.o 161 $(obj)/vdso32/%.o
160 $(call if_changed,vdso) 162 $(call if_changed,vdso)
@@ -169,14 +171,24 @@ quiet_cmd_vdso = VDSO $@
169 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' 171 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
170 172
171VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ 173VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
172 -Wl,-Bsymbolic $(LTO_CFLAGS) 174 $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS)
173GCOV_PROFILE := n 175GCOV_PROFILE := n
174 176
175# 177#
176# Install the unstripped copies of vdso*.so. 178# Install the unstripped copies of vdso*.so. If our toolchain supports
179# build-id, install .build-id links as well.
177# 180#
178quiet_cmd_vdso_install = INSTALL $(@:install_%=%) 181quiet_cmd_vdso_install = INSTALL $(@:install_%=%)
179 cmd_vdso_install = cp $< $(MODLIB)/vdso/$(@:install_%=%) 182define cmd_vdso_install
183 cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \
184 if readelf -n $< |grep -q 'Build ID'; then \
185 buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \
186 first=`echo $$buildid | cut -b-2`; \
187 last=`echo $$buildid | cut -b3-`; \
188 mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \
189 ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \
190 fi
191endef
180 192
181vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) 193vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%)
182 194
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index b2e4f493e5b0..9793322751e0 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -11,9 +11,6 @@
11 * Check with readelf after changing. 11 * Check with readelf after changing.
12 */ 12 */
13 13
14/* Disable profiling for userspace code: */
15#define DISABLE_BRANCH_PROFILING
16
17#include <uapi/linux/time.h> 14#include <uapi/linux/time.h>
18#include <asm/vgtod.h> 15#include <asm/vgtod.h>
19#include <asm/hpet.h> 16#include <asm/hpet.h>
diff --git a/arch/x86/vdso/vdso-fakesections.c b/arch/x86/vdso/vdso-fakesections.c
index cb8a8d72c24b..aa5fbfab20a5 100644
--- a/arch/x86/vdso/vdso-fakesections.c
+++ b/arch/x86/vdso/vdso-fakesections.c
@@ -2,31 +2,20 @@
2 * Copyright 2014 Andy Lutomirski 2 * Copyright 2014 Andy Lutomirski
3 * Subject to the GNU Public License, v.2 3 * Subject to the GNU Public License, v.2
4 * 4 *
5 * Hack to keep broken Go programs working. 5 * String table for loadable section headers. See vdso2c.h for why
6 * 6 * this exists.
7 * The Go runtime had a couple of bugs: it would read the section table to try
8 * to figure out how many dynamic symbols there were (it shouldn't have looked
9 * at the section table at all) and, if there were no SHT_SYNDYM section table
10 * entry, it would use an uninitialized value for the number of symbols. As a
11 * workaround, we supply a minimal section table. vdso2c will adjust the
12 * in-memory image so that "vdso_fake_sections" becomes the section table.
13 *
14 * The bug was introduced by:
15 * https://code.google.com/p/go/source/detail?r=56ea40aac72b (2012-08-31)
16 * and is being addressed in the Go runtime in this issue:
17 * https://code.google.com/p/go/issues/detail?id=8197
18 */ 7 */
19 8
20#ifndef __x86_64__ 9const char fake_shstrtab[] __attribute__((section(".fake_shstrtab"))) =
21#error This hack is specific to the 64-bit vDSO 10 ".hash\0"
22#endif 11 ".dynsym\0"
23 12 ".dynstr\0"
24#include <linux/elf.h> 13 ".gnu.version\0"
25 14 ".gnu.version_d\0"
26extern const __visible struct elf64_shdr vdso_fake_sections[]; 15 ".dynamic\0"
27const __visible struct elf64_shdr vdso_fake_sections[] = { 16 ".rodata\0"
28 { 17 ".fake_shstrtab\0" /* Yay, self-referential code. */
29 .sh_type = SHT_DYNSYM, 18 ".note\0"
30 .sh_entsize = sizeof(Elf64_Sym), 19 ".eh_frame_hdr\0"
31 } 20 ".eh_frame\0"
32}; 21 ".text";
diff --git a/arch/x86/vdso/vdso-layout.lds.S b/arch/x86/vdso/vdso-layout.lds.S
index 2ec72f651ebf..9197544eea9a 100644
--- a/arch/x86/vdso/vdso-layout.lds.S
+++ b/arch/x86/vdso/vdso-layout.lds.S
@@ -6,6 +6,16 @@
6 * This script controls its layout. 6 * This script controls its layout.
7 */ 7 */
8 8
9#if defined(BUILD_VDSO64)
10# define SHDR_SIZE 64
11#elif defined(BUILD_VDSO32) || defined(BUILD_VDSOX32)
12# define SHDR_SIZE 40
13#else
14# error unknown VDSO target
15#endif
16
17#define NUM_FAKE_SHDRS 13
18
9SECTIONS 19SECTIONS
10{ 20{
11 . = SIZEOF_HEADERS; 21 . = SIZEOF_HEADERS;
@@ -18,36 +28,53 @@ SECTIONS
18 .gnu.version_d : { *(.gnu.version_d) } 28 .gnu.version_d : { *(.gnu.version_d) }
19 .gnu.version_r : { *(.gnu.version_r) } 29 .gnu.version_r : { *(.gnu.version_r) }
20 30
31 .dynamic : { *(.dynamic) } :text :dynamic
32
33 .rodata : {
34 *(.rodata*)
35 *(.data*)
36 *(.sdata*)
37 *(.got.plt) *(.got)
38 *(.gnu.linkonce.d.*)
39 *(.bss*)
40 *(.dynbss*)
41 *(.gnu.linkonce.b.*)
42
43 /*
44 * Ideally this would live in a C file, but that won't
45 * work cleanly for x32 until we start building the x32
46 * C code using an x32 toolchain.
47 */
48 VDSO_FAKE_SECTION_TABLE_START = .;
49 . = . + NUM_FAKE_SHDRS * SHDR_SIZE;
50 VDSO_FAKE_SECTION_TABLE_END = .;
51 } :text
52
53 .fake_shstrtab : { *(.fake_shstrtab) } :text
54
55
21 .note : { *(.note.*) } :text :note 56 .note : { *(.note.*) } :text :note
22 57
23 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 58 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
24 .eh_frame : { KEEP (*(.eh_frame)) } :text 59 .eh_frame : { KEEP (*(.eh_frame)) } :text
25 60
26 .dynamic : { *(.dynamic) } :text :dynamic
27
28 .rodata : { *(.rodata*) } :text
29 .data : {
30 *(.data*)
31 *(.sdata*)
32 *(.got.plt) *(.got)
33 *(.gnu.linkonce.d.*)
34 *(.bss*)
35 *(.dynbss*)
36 *(.gnu.linkonce.b.*)
37 }
38
39 .altinstructions : { *(.altinstructions) }
40 .altinstr_replacement : { *(.altinstr_replacement) }
41 61
42 /* 62 /*
43 * Align the actual code well away from the non-instruction data. 63 * Text is well-separated from actual data: there's plenty of
44 * This is the best thing for the I-cache. 64 * stuff that isn't used at runtime in between.
45 */ 65 */
46 . = ALIGN(0x100);
47 66
48 .text : { *(.text*) } :text =0x90909090, 67 .text : { *(.text*) } :text =0x90909090,
49 68
50 /* 69 /*
70 * At the end so that eu-elflint stays happy when vdso2c strips
71 * these. A better implementation would avoid allocating space
72 * for these.
73 */
74 .altinstructions : { *(.altinstructions) } :text
75 .altinstr_replacement : { *(.altinstr_replacement) } :text
76
77 /*
51 * The remainder of the vDSO consists of special pages that are 78 * The remainder of the vDSO consists of special pages that are
52 * shared between the kernel and userspace. It needs to be at the 79 * shared between the kernel and userspace. It needs to be at the
53 * end so that it doesn't overlap the mapping of the actual 80 * end so that it doesn't overlap the mapping of the actual
@@ -75,6 +102,7 @@ SECTIONS
75 /DISCARD/ : { 102 /DISCARD/ : {
76 *(.discard) 103 *(.discard)
77 *(.discard.*) 104 *(.discard.*)
105 *(__bug_table)
78 } 106 }
79} 107}
80 108
diff --git a/arch/x86/vdso/vdso.lds.S b/arch/x86/vdso/vdso.lds.S
index 75e3404c83b1..6807932643c2 100644
--- a/arch/x86/vdso/vdso.lds.S
+++ b/arch/x86/vdso/vdso.lds.S
@@ -6,6 +6,8 @@
6 * the DSO. 6 * the DSO.
7 */ 7 */
8 8
9#define BUILD_VDSO64
10
9#include "vdso-layout.lds.S" 11#include "vdso-layout.lds.S"
10 12
11/* 13/*
diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c
index 7a6bf50f9165..238dbe82776e 100644
--- a/arch/x86/vdso/vdso2c.c
+++ b/arch/x86/vdso/vdso2c.c
@@ -23,6 +23,8 @@ enum {
23 sym_vvar_page, 23 sym_vvar_page,
24 sym_hpet_page, 24 sym_hpet_page,
25 sym_end_mapping, 25 sym_end_mapping,
26 sym_VDSO_FAKE_SECTION_TABLE_START,
27 sym_VDSO_FAKE_SECTION_TABLE_END,
26}; 28};
27 29
28const int special_pages[] = { 30const int special_pages[] = {
@@ -30,15 +32,26 @@ const int special_pages[] = {
30 sym_hpet_page, 32 sym_hpet_page,
31}; 33};
32 34
33char const * const required_syms[] = { 35struct vdso_sym {
34 [sym_vvar_page] = "vvar_page", 36 const char *name;
35 [sym_hpet_page] = "hpet_page", 37 bool export;
36 [sym_end_mapping] = "end_mapping", 38};
37 "VDSO32_NOTE_MASK", 39
38 "VDSO32_SYSENTER_RETURN", 40struct vdso_sym required_syms[] = {
39 "__kernel_vsyscall", 41 [sym_vvar_page] = {"vvar_page", true},
40 "__kernel_sigreturn", 42 [sym_hpet_page] = {"hpet_page", true},
41 "__kernel_rt_sigreturn", 43 [sym_end_mapping] = {"end_mapping", true},
44 [sym_VDSO_FAKE_SECTION_TABLE_START] = {
45 "VDSO_FAKE_SECTION_TABLE_START", false
46 },
47 [sym_VDSO_FAKE_SECTION_TABLE_END] = {
48 "VDSO_FAKE_SECTION_TABLE_END", false
49 },
50 {"VDSO32_NOTE_MASK", true},
51 {"VDSO32_SYSENTER_RETURN", true},
52 {"__kernel_vsyscall", true},
53 {"__kernel_sigreturn", true},
54 {"__kernel_rt_sigreturn", true},
42}; 55};
43 56
44__attribute__((format(printf, 1, 2))) __attribute__((noreturn)) 57__attribute__((format(printf, 1, 2))) __attribute__((noreturn))
@@ -83,37 +96,21 @@ extern void bad_put_le(void);
83 96
84#define NSYMS (sizeof(required_syms) / sizeof(required_syms[0])) 97#define NSYMS (sizeof(required_syms) / sizeof(required_syms[0]))
85 98
86#define BITS 64 99#define BITSFUNC3(name, bits) name##bits
87#define GOFUNC go64 100#define BITSFUNC2(name, bits) BITSFUNC3(name, bits)
88#define Elf_Ehdr Elf64_Ehdr 101#define BITSFUNC(name) BITSFUNC2(name, ELF_BITS)
89#define Elf_Shdr Elf64_Shdr 102
90#define Elf_Phdr Elf64_Phdr 103#define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x
91#define Elf_Sym Elf64_Sym 104#define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x)
92#define Elf_Dyn Elf64_Dyn 105#define ELF(x) ELF_BITS_XFORM(ELF_BITS, x)
106
107#define ELF_BITS 64
93#include "vdso2c.h" 108#include "vdso2c.h"
94#undef BITS 109#undef ELF_BITS
95#undef GOFUNC 110
96#undef Elf_Ehdr 111#define ELF_BITS 32
97#undef Elf_Shdr
98#undef Elf_Phdr
99#undef Elf_Sym
100#undef Elf_Dyn
101
102#define BITS 32
103#define GOFUNC go32
104#define Elf_Ehdr Elf32_Ehdr
105#define Elf_Shdr Elf32_Shdr
106#define Elf_Phdr Elf32_Phdr
107#define Elf_Sym Elf32_Sym
108#define Elf_Dyn Elf32_Dyn
109#include "vdso2c.h" 112#include "vdso2c.h"
110#undef BITS 113#undef ELF_BITS
111#undef GOFUNC
112#undef Elf_Ehdr
113#undef Elf_Shdr
114#undef Elf_Phdr
115#undef Elf_Sym
116#undef Elf_Dyn
117 114
118static void go(void *addr, size_t len, FILE *outfile, const char *name) 115static void go(void *addr, size_t len, FILE *outfile, const char *name)
119{ 116{
diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h
index c6eefaf389b9..df95a2fdff73 100644
--- a/arch/x86/vdso/vdso2c.h
+++ b/arch/x86/vdso/vdso2c.h
@@ -4,23 +4,136 @@
4 * are built for 32-bit userspace. 4 * are built for 32-bit userspace.
5 */ 5 */
6 6
7static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) 7/*
8 * We're writing a section table for a few reasons:
9 *
10 * The Go runtime had a couple of bugs: it would read the section
11 * table to try to figure out how many dynamic symbols there were (it
12 * shouldn't have looked at the section table at all) and, if there
13 * were no SHT_SYNDYM section table entry, it would use an
14 * uninitialized value for the number of symbols. An empty DYNSYM
15 * table would work, but I see no reason not to write a valid one (and
16 * keep full performance for old Go programs). This hack is only
17 * needed on x86_64.
18 *
19 * The bug was introduced on 2012-08-31 by:
20 * https://code.google.com/p/go/source/detail?r=56ea40aac72b
21 * and was fixed on 2014-06-13 by:
22 * https://code.google.com/p/go/source/detail?r=fc1cd5e12595
23 *
24 * Binutils has issues debugging the vDSO: it reads the section table to
25 * find SHT_NOTE; it won't look at PT_NOTE for the in-memory vDSO, which
26 * would break build-id if we removed the section table. Binutils
27 * also requires that shstrndx != 0. See:
28 * https://sourceware.org/bugzilla/show_bug.cgi?id=17064
29 *
30 * elfutils might not look for PT_NOTE if there is a section table at
31 * all. I don't know whether this matters for any practical purpose.
32 *
33 * For simplicity, rather than hacking up a partial section table, we
34 * just write a mostly complete one. We omit non-dynamic symbols,
35 * though, since they're rather large.
36 *
37 * Once binutils gets fixed, we might be able to drop this for all but
38 * the 64-bit vdso, since build-id only works in kernel RPMs, and
39 * systems that update to new enough kernel RPMs will likely update
40 * binutils in sync. build-id has never worked for home-built kernel
41 * RPMs without manual symlinking, and I suspect that no one ever does
42 * that.
43 */
44struct BITSFUNC(fake_sections)
45{
46 ELF(Shdr) *table;
47 unsigned long table_offset;
48 int count, max_count;
49
50 int in_shstrndx;
51 unsigned long shstr_offset;
52 const char *shstrtab;
53 size_t shstrtab_len;
54
55 int out_shstrndx;
56};
57
58static unsigned int BITSFUNC(find_shname)(struct BITSFUNC(fake_sections) *out,
59 const char *name)
60{
61 const char *outname = out->shstrtab;
62 while (outname - out->shstrtab < out->shstrtab_len) {
63 if (!strcmp(name, outname))
64 return (outname - out->shstrtab) + out->shstr_offset;
65 outname += strlen(outname) + 1;
66 }
67
68 if (*name)
69 printf("Warning: could not find output name \"%s\"\n", name);
70 return out->shstr_offset + out->shstrtab_len - 1; /* Use a null. */
71}
72
73static void BITSFUNC(init_sections)(struct BITSFUNC(fake_sections) *out)
74{
75 if (!out->in_shstrndx)
76 fail("didn't find the fake shstrndx\n");
77
78 memset(out->table, 0, out->max_count * sizeof(ELF(Shdr)));
79
80 if (out->max_count < 1)
81 fail("we need at least two fake output sections\n");
82
83 PUT_LE(&out->table[0].sh_type, SHT_NULL);
84 PUT_LE(&out->table[0].sh_name, BITSFUNC(find_shname)(out, ""));
85
86 out->count = 1;
87}
88
89static void BITSFUNC(copy_section)(struct BITSFUNC(fake_sections) *out,
90 int in_idx, const ELF(Shdr) *in,
91 const char *name)
92{
93 uint64_t flags = GET_LE(&in->sh_flags);
94
95 bool copy = flags & SHF_ALLOC &&
96 strcmp(name, ".altinstructions") &&
97 strcmp(name, ".altinstr_replacement");
98
99 if (!copy)
100 return;
101
102 if (out->count >= out->max_count)
103 fail("too many copied sections (max = %d)\n", out->max_count);
104
105 if (in_idx == out->in_shstrndx)
106 out->out_shstrndx = out->count;
107
108 out->table[out->count] = *in;
109 PUT_LE(&out->table[out->count].sh_name,
110 BITSFUNC(find_shname)(out, name));
111
112 /* elfutils requires that a strtab have the correct type. */
113 if (!strcmp(name, ".fake_shstrtab"))
114 PUT_LE(&out->table[out->count].sh_type, SHT_STRTAB);
115
116 out->count++;
117}
118
119static void BITSFUNC(go)(void *addr, size_t len,
120 FILE *outfile, const char *name)
8{ 121{
9 int found_load = 0; 122 int found_load = 0;
10 unsigned long load_size = -1; /* Work around bogus warning */ 123 unsigned long load_size = -1; /* Work around bogus warning */
11 unsigned long data_size; 124 unsigned long data_size;
12 Elf_Ehdr *hdr = (Elf_Ehdr *)addr; 125 ELF(Ehdr) *hdr = (ELF(Ehdr) *)addr;
13 int i; 126 int i;
14 unsigned long j; 127 unsigned long j;
15 Elf_Shdr *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr, 128 ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr,
16 *alt_sec = NULL; 129 *alt_sec = NULL;
17 Elf_Dyn *dyn = 0, *dyn_end = 0; 130 ELF(Dyn) *dyn = 0, *dyn_end = 0;
18 const char *secstrings; 131 const char *secstrings;
19 uint64_t syms[NSYMS] = {}; 132 uint64_t syms[NSYMS] = {};
20 133
21 uint64_t fake_sections_value = 0, fake_sections_size = 0; 134 struct BITSFUNC(fake_sections) fake_sections = {};
22 135
23 Elf_Phdr *pt = (Elf_Phdr *)(addr + GET_LE(&hdr->e_phoff)); 136 ELF(Phdr) *pt = (ELF(Phdr) *)(addr + GET_LE(&hdr->e_phoff));
24 137
25 /* Walk the segment table. */ 138 /* Walk the segment table. */
26 for (i = 0; i < GET_LE(&hdr->e_phnum); i++) { 139 for (i = 0; i < GET_LE(&hdr->e_phnum); i++) {
@@ -51,7 +164,7 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
51 for (i = 0; dyn + i < dyn_end && 164 for (i = 0; dyn + i < dyn_end &&
52 GET_LE(&dyn[i].d_tag) != DT_NULL; i++) { 165 GET_LE(&dyn[i].d_tag) != DT_NULL; i++) {
53 typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag); 166 typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag);
54 if (tag == DT_REL || tag == DT_RELSZ || 167 if (tag == DT_REL || tag == DT_RELSZ || tag == DT_RELA ||
55 tag == DT_RELENT || tag == DT_TEXTREL) 168 tag == DT_RELENT || tag == DT_TEXTREL)
56 fail("vdso image contains dynamic relocations\n"); 169 fail("vdso image contains dynamic relocations\n");
57 } 170 }
@@ -61,7 +174,7 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
61 GET_LE(&hdr->e_shentsize)*GET_LE(&hdr->e_shstrndx); 174 GET_LE(&hdr->e_shentsize)*GET_LE(&hdr->e_shstrndx);
62 secstrings = addr + GET_LE(&secstrings_hdr->sh_offset); 175 secstrings = addr + GET_LE(&secstrings_hdr->sh_offset);
63 for (i = 0; i < GET_LE(&hdr->e_shnum); i++) { 176 for (i = 0; i < GET_LE(&hdr->e_shnum); i++) {
64 Elf_Shdr *sh = addr + GET_LE(&hdr->e_shoff) + 177 ELF(Shdr) *sh = addr + GET_LE(&hdr->e_shoff) +
65 GET_LE(&hdr->e_shentsize) * i; 178 GET_LE(&hdr->e_shentsize) * i;
66 if (GET_LE(&sh->sh_type) == SHT_SYMTAB) 179 if (GET_LE(&sh->sh_type) == SHT_SYMTAB)
67 symtab_hdr = sh; 180 symtab_hdr = sh;
@@ -82,29 +195,63 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
82 i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize); 195 i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
83 i++) { 196 i++) {
84 int k; 197 int k;
85 Elf_Sym *sym = addr + GET_LE(&symtab_hdr->sh_offset) + 198 ELF(Sym) *sym = addr + GET_LE(&symtab_hdr->sh_offset) +
86 GET_LE(&symtab_hdr->sh_entsize) * i; 199 GET_LE(&symtab_hdr->sh_entsize) * i;
87 const char *name = addr + GET_LE(&strtab_hdr->sh_offset) + 200 const char *name = addr + GET_LE(&strtab_hdr->sh_offset) +
88 GET_LE(&sym->st_name); 201 GET_LE(&sym->st_name);
89 202
90 for (k = 0; k < NSYMS; k++) { 203 for (k = 0; k < NSYMS; k++) {
91 if (!strcmp(name, required_syms[k])) { 204 if (!strcmp(name, required_syms[k].name)) {
92 if (syms[k]) { 205 if (syms[k]) {
93 fail("duplicate symbol %s\n", 206 fail("duplicate symbol %s\n",
94 required_syms[k]); 207 required_syms[k].name);
95 } 208 }
96 syms[k] = GET_LE(&sym->st_value); 209 syms[k] = GET_LE(&sym->st_value);
97 } 210 }
98 } 211 }
99 212
100 if (!strcmp(name, "vdso_fake_sections")) { 213 if (!strcmp(name, "fake_shstrtab")) {
101 if (fake_sections_value) 214 ELF(Shdr) *sh;
102 fail("duplicate vdso_fake_sections\n"); 215
103 fake_sections_value = GET_LE(&sym->st_value); 216 fake_sections.in_shstrndx = GET_LE(&sym->st_shndx);
104 fake_sections_size = GET_LE(&sym->st_size); 217 fake_sections.shstrtab = addr + GET_LE(&sym->st_value);
218 fake_sections.shstrtab_len = GET_LE(&sym->st_size);
219 sh = addr + GET_LE(&hdr->e_shoff) +
220 GET_LE(&hdr->e_shentsize) *
221 fake_sections.in_shstrndx;
222 fake_sections.shstr_offset = GET_LE(&sym->st_value) -
223 GET_LE(&sh->sh_addr);
105 } 224 }
106 } 225 }
107 226
227 /* Build the output section table. */
228 if (!syms[sym_VDSO_FAKE_SECTION_TABLE_START] ||
229 !syms[sym_VDSO_FAKE_SECTION_TABLE_END])
230 fail("couldn't find fake section table\n");
231 if ((syms[sym_VDSO_FAKE_SECTION_TABLE_END] -
232 syms[sym_VDSO_FAKE_SECTION_TABLE_START]) % sizeof(ELF(Shdr)))
233 fail("fake section table size isn't a multiple of sizeof(Shdr)\n");
234 fake_sections.table = addr + syms[sym_VDSO_FAKE_SECTION_TABLE_START];
235 fake_sections.table_offset = syms[sym_VDSO_FAKE_SECTION_TABLE_START];
236 fake_sections.max_count = (syms[sym_VDSO_FAKE_SECTION_TABLE_END] -
237 syms[sym_VDSO_FAKE_SECTION_TABLE_START]) /
238 sizeof(ELF(Shdr));
239
240 BITSFUNC(init_sections)(&fake_sections);
241 for (i = 0; i < GET_LE(&hdr->e_shnum); i++) {
242 ELF(Shdr) *sh = addr + GET_LE(&hdr->e_shoff) +
243 GET_LE(&hdr->e_shentsize) * i;
244 BITSFUNC(copy_section)(&fake_sections, i, sh,
245 secstrings + GET_LE(&sh->sh_name));
246 }
247 if (!fake_sections.out_shstrndx)
248 fail("didn't generate shstrndx?!?\n");
249
250 PUT_LE(&hdr->e_shoff, fake_sections.table_offset);
251 PUT_LE(&hdr->e_shentsize, sizeof(ELF(Shdr)));
252 PUT_LE(&hdr->e_shnum, fake_sections.count);
253 PUT_LE(&hdr->e_shstrndx, fake_sections.out_shstrndx);
254
108 /* Validate mapping addresses. */ 255 /* Validate mapping addresses. */
109 for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) { 256 for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) {
110 if (!syms[i]) 257 if (!syms[i])
@@ -112,25 +259,17 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
112 259
113 if (syms[i] % 4096) 260 if (syms[i] % 4096)
114 fail("%s must be a multiple of 4096\n", 261 fail("%s must be a multiple of 4096\n",
115 required_syms[i]); 262 required_syms[i].name);
116 if (syms[i] < data_size) 263 if (syms[i] < data_size)
117 fail("%s must be after the text mapping\n", 264 fail("%s must be after the text mapping\n",
118 required_syms[i]); 265 required_syms[i].name);
119 if (syms[sym_end_mapping] < syms[i] + 4096) 266 if (syms[sym_end_mapping] < syms[i] + 4096)
120 fail("%s overruns end_mapping\n", required_syms[i]); 267 fail("%s overruns end_mapping\n",
268 required_syms[i].name);
121 } 269 }
122 if (syms[sym_end_mapping] % 4096) 270 if (syms[sym_end_mapping] % 4096)
123 fail("end_mapping must be a multiple of 4096\n"); 271 fail("end_mapping must be a multiple of 4096\n");
124 272
125 /* Remove sections or use fakes */
126 if (fake_sections_size % sizeof(Elf_Shdr))
127 fail("vdso_fake_sections size is not a multiple of %ld\n",
128 (long)sizeof(Elf_Shdr));
129 PUT_LE(&hdr->e_shoff, fake_sections_value);
130 PUT_LE(&hdr->e_shentsize, fake_sections_value ? sizeof(Elf_Shdr) : 0);
131 PUT_LE(&hdr->e_shnum, fake_sections_size / sizeof(Elf_Shdr));
132 PUT_LE(&hdr->e_shstrndx, SHN_UNDEF);
133
134 if (!name) { 273 if (!name) {
135 fwrite(addr, load_size, 1, outfile); 274 fwrite(addr, load_size, 1, outfile);
136 return; 275 return;
@@ -168,9 +307,9 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
168 (unsigned long)GET_LE(&alt_sec->sh_size)); 307 (unsigned long)GET_LE(&alt_sec->sh_size));
169 } 308 }
170 for (i = 0; i < NSYMS; i++) { 309 for (i = 0; i < NSYMS; i++) {
171 if (syms[i]) 310 if (required_syms[i].export && syms[i])
172 fprintf(outfile, "\t.sym_%s = 0x%" PRIx64 ",\n", 311 fprintf(outfile, "\t.sym_%s = 0x%" PRIx64 ",\n",
173 required_syms[i], syms[i]); 312 required_syms[i].name, syms[i]);
174 } 313 }
175 fprintf(outfile, "};\n"); 314 fprintf(outfile, "};\n");
176} 315}
diff --git a/arch/x86/vdso/vdso32/vdso-fakesections.c b/arch/x86/vdso/vdso32/vdso-fakesections.c
new file mode 100644
index 000000000000..541468e25265
--- /dev/null
+++ b/arch/x86/vdso/vdso32/vdso-fakesections.c
@@ -0,0 +1 @@
#include "../vdso-fakesections.c"
diff --git a/arch/x86/vdso/vdsox32.lds.S b/arch/x86/vdso/vdsox32.lds.S
index 46b991b578a8..697c11ece90c 100644
--- a/arch/x86/vdso/vdsox32.lds.S
+++ b/arch/x86/vdso/vdsox32.lds.S
@@ -6,6 +6,8 @@
6 * the DSO. 6 * the DSO.
7 */ 7 */
8 8
9#define BUILD_VDSOX32
10
9#include "vdso-layout.lds.S" 11#include "vdso-layout.lds.S"
10 12
11/* 13/*
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f17b29210ac4..ffb101e45731 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1537,7 +1537,10 @@ asmlinkage __visible void __init xen_start_kernel(void)
1537 if (!xen_pvh_domain()) 1537 if (!xen_pvh_domain())
1538 pv_cpu_ops = xen_cpu_ops; 1538 pv_cpu_ops = xen_cpu_ops;
1539 1539
1540 x86_init.resources.memory_setup = xen_memory_setup; 1540 if (xen_feature(XENFEAT_auto_translated_physmap))
1541 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
1542 else
1543 x86_init.resources.memory_setup = xen_memory_setup;
1541 x86_init.oem.arch_setup = xen_arch_setup; 1544 x86_init.oem.arch_setup = xen_arch_setup;
1542 x86_init.oem.banner = xen_banner; 1545 x86_init.oem.banner = xen_banner;
1543 1546
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 821a11ada590..2e555163c2fe 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -27,7 +27,6 @@
27#include <xen/interface/memory.h> 27#include <xen/interface/memory.h>
28#include <xen/interface/physdev.h> 28#include <xen/interface/physdev.h>
29#include <xen/features.h> 29#include <xen/features.h>
30#include "mmu.h"
31#include "xen-ops.h" 30#include "xen-ops.h"
32#include "vdso.h" 31#include "vdso.h"
33 32
@@ -82,9 +81,6 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
82 81
83 memblock_reserve(start, size); 82 memblock_reserve(start, size);
84 83
85 if (xen_feature(XENFEAT_auto_translated_physmap))
86 return;
87
88 xen_max_p2m_pfn = PFN_DOWN(start + size); 84 xen_max_p2m_pfn = PFN_DOWN(start + size);
89 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) { 85 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
90 unsigned long mfn = pfn_to_mfn(pfn); 86 unsigned long mfn = pfn_to_mfn(pfn);
@@ -107,7 +103,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
107 .domid = DOMID_SELF 103 .domid = DOMID_SELF
108 }; 104 };
109 unsigned long len = 0; 105 unsigned long len = 0;
110 int xlated_phys = xen_feature(XENFEAT_auto_translated_physmap);
111 unsigned long pfn; 106 unsigned long pfn;
112 int ret; 107 int ret;
113 108
@@ -121,7 +116,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
121 continue; 116 continue;
122 frame = mfn; 117 frame = mfn;
123 } else { 118 } else {
124 if (!xlated_phys && mfn != INVALID_P2M_ENTRY) 119 if (mfn != INVALID_P2M_ENTRY)
125 continue; 120 continue;
126 frame = pfn; 121 frame = pfn;
127 } 122 }
@@ -159,13 +154,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
159static unsigned long __init xen_release_chunk(unsigned long start, 154static unsigned long __init xen_release_chunk(unsigned long start,
160 unsigned long end) 155 unsigned long end)
161{ 156{
162 /*
163 * Xen already ballooned out the E820 non RAM regions for us
164 * and set them up properly in EPT.
165 */
166 if (xen_feature(XENFEAT_auto_translated_physmap))
167 return end - start;
168
169 return xen_do_chunk(start, end, true); 157 return xen_do_chunk(start, end, true);
170} 158}
171 159
@@ -234,13 +222,7 @@ static void __init xen_set_identity_and_release_chunk(
234 * (except for the ISA region which must be 1:1 mapped) to 222 * (except for the ISA region which must be 1:1 mapped) to
235 * release the refcounts (in Xen) on the original frames. 223 * release the refcounts (in Xen) on the original frames.
236 */ 224 */
237 225 for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
238 /*
239 * PVH E820 matches the hypervisor's P2M which means we need to
240 * account for the proper values of *release and *identity.
241 */
242 for (pfn = start_pfn; !xen_feature(XENFEAT_auto_translated_physmap) &&
243 pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
244 pte_t pte = __pte_ma(0); 226 pte_t pte = __pte_ma(0);
245 227
246 if (pfn < PFN_UP(ISA_END_ADDRESS)) 228 if (pfn < PFN_UP(ISA_END_ADDRESS))
@@ -518,6 +500,35 @@ char * __init xen_memory_setup(void)
518} 500}
519 501
520/* 502/*
503 * Machine specific memory setup for auto-translated guests.
504 */
505char * __init xen_auto_xlated_memory_setup(void)
506{
507 static struct e820entry map[E820MAX] __initdata;
508
509 struct xen_memory_map memmap;
510 int i;
511 int rc;
512
513 memmap.nr_entries = E820MAX;
514 set_xen_guest_handle(memmap.buffer, map);
515
516 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
517 if (rc < 0)
518 panic("No memory map (%d)\n", rc);
519
520 sanitize_e820_map(map, ARRAY_SIZE(map), &memmap.nr_entries);
521
522 for (i = 0; i < memmap.nr_entries; i++)
523 e820_add_region(map[i].addr, map[i].size, map[i].type);
524
525 memblock_reserve(__pa(xen_start_info->mfn_list),
526 xen_start_info->pt_base - xen_start_info->mfn_list);
527
528 return "Xen";
529}
530
531/*
521 * Set the bit indicating "nosegneg" library variants should be used. 532 * Set the bit indicating "nosegneg" library variants should be used.
522 * We only need to bother in pure 32-bit mode; compat 32-bit processes 533 * We only need to bother in pure 32-bit mode; compat 32-bit processes
523 * can have un-truncated segments, so wrapping around is allowed. 534 * can have un-truncated segments, so wrapping around is allowed.
@@ -590,13 +601,7 @@ void xen_enable_syscall(void)
590 } 601 }
591#endif /* CONFIG_X86_64 */ 602#endif /* CONFIG_X86_64 */
592} 603}
593void xen_enable_nmi(void) 604
594{
595#ifdef CONFIG_X86_64
596 if (register_callback(CALLBACKTYPE_nmi, (char *)nmi))
597 BUG();
598#endif
599}
600void __init xen_pvmmu_arch_setup(void) 605void __init xen_pvmmu_arch_setup(void)
601{ 606{
602 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); 607 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
@@ -611,7 +616,6 @@ void __init xen_pvmmu_arch_setup(void)
611 616
612 xen_enable_sysenter(); 617 xen_enable_sysenter();
613 xen_enable_syscall(); 618 xen_enable_syscall();
614 xen_enable_nmi();
615} 619}
616 620
617/* This function is not called for HVM domains */ 621/* This function is not called for HVM domains */
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index c834d4b231f0..97d87659f779 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -36,6 +36,7 @@ void xen_mm_unpin_all(void);
36void xen_set_pat(u64); 36void xen_set_pat(u64);
37 37
38char * __init xen_memory_setup(void); 38char * __init xen_memory_setup(void);
39char * xen_auto_xlated_memory_setup(void);
39void __init xen_arch_setup(void); 40void __init xen_arch_setup(void);
40void xen_enable_sysenter(void); 41void xen_enable_sysenter(void);
41void xen_enable_syscall(void); 42void xen_enable_syscall(void);