aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/pci.h5
-rw-r--r--arch/arm/Kconfig25
-rw-r--r--arch/arm/Kconfig.debug154
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/boot/compressed/head.S5
-rw-r--r--arch/arm/boot/dts/Makefile7
-rw-r--r--arch/arm/boot/dts/am335x-boneblack.dts1
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi2
-rw-r--r--arch/arm/boot/dts/am3517.dtsi16
-rw-r--r--arch/arm/boot/dts/am4372.dtsi6
-rw-r--r--arch/arm/boot/dts/am437x-gp-evm.dts5
-rw-r--r--arch/arm/boot/dts/armada-370-db.dts1
-rw-r--r--arch/arm/boot/dts/armada-375-db.dts5
-rw-r--r--arch/arm/boot/dts/armada-380.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-385.dtsi4
-rw-r--r--arch/arm/boot/dts/armada-xp-db.dts2
-rw-r--r--arch/arm/boot/dts/armada-xp-gp.dts10
-rw-r--r--arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts2
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi2
-rw-r--r--arch/arm/boot/dts/atlas6.dtsi1
-rw-r--r--arch/arm/boot/dts/axm5516-amarillo.dts51
-rw-r--r--arch/arm/boot/dts/axm5516-cpus.dtsi204
-rw-r--r--arch/arm/boot/dts/axm55xx.dtsi204
-rw-r--r--arch/arm/boot/dts/dra7.dtsi6
-rw-r--r--arch/arm/boot/dts/exynos4412-trats2.dts2
-rw-r--r--arch/arm/boot/dts/exynos5250-arndale.dts1
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi47
-rw-r--r--arch/arm/boot/dts/imx53-mba53.dts2
-rw-r--r--arch/arm/boot/dts/imx53.dtsi2
-rw-r--r--arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts18
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa3x0-common.dtsi18
-rw-r--r--arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi19
-rw-r--r--arch/arm/boot/dts/omap2.dtsi7
-rw-r--r--arch/arm/boot/dts/omap2420.dtsi8
-rw-r--r--arch/arm/boot/dts/omap2430.dtsi7
-rw-r--r--arch/arm/boot/dts/omap3-cm-t3x30.dtsi66
-rw-r--r--arch/arm/boot/dts/omap3-evm-37xx.dts9
-rw-r--r--arch/arm/boot/dts/omap3-igep.dtsi2
-rw-r--r--arch/arm/boot/dts/omap3-igep0020.dts4
-rw-r--r--arch/arm/boot/dts/omap3-ldp.dts4
-rw-r--r--arch/arm/boot/dts/omap3-n900.dts19
-rw-r--r--arch/arm/boot/dts/omap3-sb-t35.dtsi37
-rw-r--r--arch/arm/boot/dts/omap3-sbc-t3517.dts13
-rw-r--r--arch/arm/boot/dts/omap3.dtsi8
-rw-r--r--arch/arm/boot/dts/omap4-panda-common.dtsi15
-rw-r--r--arch/arm/boot/dts/omap4-sdp.dts6
-rw-r--r--arch/arm/boot/dts/omap4.dtsi6
-rw-r--r--arch/arm/boot/dts/omap5.dtsi7
-rw-r--r--arch/arm/boot/dts/prima2.dtsi1
-rw-r--r--arch/arm/boot/dts/r7s72100-genmai-reference.dts42
-rw-r--r--arch/arm/boot/dts/r7s72100-genmai.dts30
-rw-r--r--arch/arm/boot/dts/r7s72100.dtsi215
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi1
-rw-r--r--arch/arm/boot/dts/r8a7790-lager.dts22
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi2
-rw-r--r--arch/arm/boot/dts/r8a7791-koelsch.dts21
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi2
-rw-r--r--arch/arm/boot/dts/rk3066a.dtsi1
-rw-r--r--arch/arm/boot/dts/rk3188.dtsi1
-rw-r--r--arch/arm/boot/dts/s3c2416-smdk2416.dts13
-rw-r--r--arch/arm/boot/dts/s3c2416.dtsi42
-rw-r--r--arch/arm/boot/dts/ste-ccu8540.dts1
-rw-r--r--arch/arm/boot/dts/ste-ccu9540.dts6
-rw-r--r--arch/arm/boot/dts/ste-href.dtsi19
-rw-r--r--arch/arm/boot/dts/ste-nomadik-stn8815.dtsi4
-rw-r--r--arch/arm/boot/dts/ste-snowball.dts4
-rw-r--r--arch/arm/boot/dts/ste-u300.dts4
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi14
-rw-r--r--arch/arm/boot/dts/twl4030_omap3.dtsi19
-rw-r--r--arch/arm/boot/dts/vexpress-v2m-rs1.dtsi76
-rw-r--r--arch/arm/boot/dts/vexpress-v2m.dtsi76
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts5
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi5
-rw-r--r--arch/arm/common/bL_switcher.c10
-rw-r--r--arch/arm/common/edma.c48
-rw-r--r--arch/arm/configs/axm55xx_defconfig248
-rw-r--r--arch/arm/configs/bcm_defconfig3
-rw-r--r--arch/arm/configs/davinci_all_defconfig1
-rw-r--r--arch/arm/configs/dove_defconfig2
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig8
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig12
-rw-r--r--arch/arm/configs/kirkwood_defconfig1
-rw-r--r--arch/arm/configs/msm_defconfig25
-rw-r--r--arch/arm/configs/multi_v5_defconfig3
-rw-r--r--arch/arm/configs/multi_v7_defconfig48
-rw-r--r--arch/arm/configs/mvebu_v5_defconfig5
-rw-r--r--arch/arm/configs/mvebu_v7_defconfig11
-rw-r--r--arch/arm/configs/mxs_defconfig7
-rw-r--r--arch/arm/configs/omap2plus_defconfig8
-rw-r--r--arch/arm/configs/qcom_defconfig165
-rw-r--r--arch/arm/configs/realview-smp_defconfig2
-rw-r--r--arch/arm/configs/realview_defconfig2
-rw-r--r--arch/arm/configs/sama5_defconfig2
-rw-r--r--arch/arm/configs/shmobile_defconfig14
-rw-r--r--arch/arm/configs/sunxi_defconfig46
-rw-r--r--arch/arm/configs/tegra_defconfig10
-rw-r--r--arch/arm/configs/versatile_defconfig3
-rw-r--r--arch/arm/include/asm/pci.h5
-rw-r--r--arch/arm/include/asm/trusted_foundations.h2
-rw-r--r--arch/arm/include/asm/uaccess.h3
-rw-r--r--arch/arm/include/asm/xen/hypercall.h16
-rw-r--r--arch/arm/include/asm/xen/interface.h2
-rw-r--r--arch/arm/include/asm/xen/page.h1
-rw-r--r--arch/arm/include/debug/imx-uart.h11
-rw-r--r--arch/arm/include/debug/msm.S46
-rw-r--r--arch/arm/include/debug/s3c24xx.S46
-rw-r--r--arch/arm/include/debug/vf.S15
-rw-r--r--arch/arm/include/debug/zynq.S10
-rw-r--r--arch/arm/kernel/bios32.c12
-rw-r--r--arch/arm/kernel/entry-header.S4
-rw-r--r--arch/arm/kernel/unwind.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c8
-rw-r--r--arch/arm/mach-axxia/Kconfig16
-rw-r--r--arch/arm/mach-axxia/Makefile2
-rw-r--r--arch/arm/mach-axxia/axxia.c28
-rw-r--r--arch/arm/mach-axxia/platsmp.c89
-rw-r--r--arch/arm/mach-bcm/Kconfig61
-rw-r--r--arch/arm/mach-bcm/Makefile21
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc.c136
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc.h52
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc_asm.S41
-rw-r--r--arch/arm/mach-bcm/board_bcm21664.c5
-rw-r--r--arch/arm/mach-bcm/board_bcm281xx.c2
-rw-r--r--arch/arm/mach-bcm/kona_l2_cache.c (renamed from arch/arm/mach-bcm/kona.c)16
-rw-r--r--arch/arm/mach-bcm/kona_l2_cache.h (renamed from arch/arm/mach-bcm/kona.h)6
-rw-r--r--arch/arm/mach-berlin/Kconfig10
-rw-r--r--arch/arm/mach-cns3xxx/Kconfig1
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c4
-rw-r--r--arch/arm/mach-davinci/board-dm355-leopard.c4
-rw-r--r--arch/arm/mach-exynos/Kconfig100
-rw-r--r--arch/arm/mach-exynos/Makefile13
-rw-r--r--arch/arm/mach-exynos/common.h105
-rw-r--r--arch/arm/mach-exynos/cpuidle.c1
-rw-r--r--arch/arm/mach-exynos/exynos.c19
-rw-r--r--arch/arm/mach-exynos/firmware.c11
-rw-r--r--arch/arm/mach-exynos/hotplug.c67
-rw-r--r--arch/arm/mach-exynos/mcpm-exynos.c357
-rw-r--r--arch/arm/mach-exynos/platsmp.c13
-rw-r--r--arch/arm/mach-exynos/pm.c67
-rw-r--r--arch/arm/mach-exynos/pmu.c2
-rw-r--r--arch/arm/mach-exynos/regs-pmu.h16
-rw-r--r--arch/arm/mach-imx/Kconfig70
-rw-r--r--arch/arm/mach-imx/Makefile6
-rw-r--r--arch/arm/mach-imx/avic.c4
-rw-r--r--arch/arm/mach-imx/clk-gate2.c47
-rw-r--r--arch/arm/mach-imx/clk-imx1.c41
-rw-r--r--arch/arm/mach-imx/clk-imx25.c24
-rw-r--r--arch/arm/mach-imx/clk-imx27.c27
-rw-r--r--arch/arm/mach-imx/clk-imx31.c2
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c20
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c21
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c6
-rw-r--r--arch/arm/mach-imx/clk-imx6sx.c524
-rw-r--r--arch/arm/mach-imx/clk.h13
-rw-r--r--arch/arm/mach-imx/common.h15
-rw-r--r--arch/arm/mach-imx/cpu.c3
-rw-r--r--arch/arm/mach-imx/devices/platform-ipu-core.c2
-rw-r--r--arch/arm/mach-imx/devices/platform-mx2-emma.c2
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c231
-rw-r--r--arch/arm/mach-imx/imx25-dt.c1
-rw-r--r--arch/arm/mach-imx/imx27-dt.c1
-rw-r--r--arch/arm/mach-imx/imx31-dt.c1
-rw-r--r--arch/arm/mach-imx/imx35-dt.c1
-rw-r--r--arch/arm/mach-imx/imx51-dt.c1
-rw-r--r--arch/arm/mach-imx/mach-apf9328.c1
-rw-r--r--arch/arm/mach-imx/mach-armadillo5x0.c1
-rw-r--r--arch/arm/mach-imx/mach-bug.c1
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c1
-rw-r--r--arch/arm/mach-imx/mach-cpuimx35.c1
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51sd.c364
-rw-r--r--arch/arm/mach-imx/mach-eukrea_cpuimx25.c1
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c1
-rw-r--r--arch/arm/mach-imx/mach-imx27ipcam.c1
-rw-r--r--arch/arm/mach-imx/mach-imx27lite.c1
-rw-r--r--arch/arm/mach-imx/mach-imx50.c1
-rw-r--r--arch/arm/mach-imx/mach-imx53.c1
-rw-r--r--arch/arm/mach-imx/mach-imx6sx.c51
-rw-r--r--arch/arm/mach-imx/mach-kzm_arm11_01.c1
-rw-r--r--arch/arm/mach-imx/mach-mx1ads.c2
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c174
-rw-r--r--arch/arm/mach-imx/mach-mx25_3ds.c1
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c1
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c1
-rw-r--r--arch/arm/mach-imx/mach-mx31_3ds.c1
-rw-r--r--arch/arm/mach-imx/mach-mx31ads.c1
-rw-r--r--arch/arm/mach-imx/mach-mx31lilly.c1
-rw-r--r--arch/arm/mach-imx/mach-mx31lite.c1
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c1
-rw-r--r--arch/arm/mach-imx/mach-mx35_3ds.c1
-rw-r--r--arch/arm/mach-imx/mach-mx51_babbage.c428
-rw-r--r--arch/arm/mach-imx/mach-mxt_td60.c1
-rw-r--r--arch/arm/mach-imx/mach-pca100.c4
-rw-r--r--arch/arm/mach-imx/mach-pcm037.c1
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c1
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c1
-rw-r--r--arch/arm/mach-imx/mach-qong.c1
-rw-r--r--arch/arm/mach-imx/mach-scb9328.c1
-rw-r--r--arch/arm/mach-imx/mach-vpr200.c1
-rw-r--r--arch/arm/mach-imx/mxc.h6
-rw-r--r--arch/arm/mach-imx/time.c15
-rw-r--r--arch/arm/mach-imx/tzic.c4
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c2
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c3
-rw-r--r--arch/arm/mach-msm/Kconfig3
-rw-r--r--arch/arm/mach-msm/board-trout-gpio.c2
-rw-r--r--arch/arm/mach-msm/board-trout.c2
-rw-r--r--arch/arm/mach-msm/board-trout.h2
-rw-r--r--arch/arm/mach-mvebu/Kconfig21
-rw-r--r--arch/arm/mach-mvebu/Makefile13
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.h2
-rw-r--r--arch/arm/mach-mvebu/board-t5325.c41
-rw-r--r--arch/arm/mach-mvebu/board-v7.c82
-rw-r--r--arch/arm/mach-mvebu/board.h6
-rw-r--r--arch/arm/mach-mvebu/coherency.c340
-rw-r--r--arch/arm/mach-mvebu/coherency.h3
-rw-r--r--arch/arm/mach-mvebu/coherency_ll.S143
-rw-r--r--arch/arm/mach-mvebu/common.h3
-rw-r--r--arch/arm/mach-mvebu/cpu-reset.c103
-rw-r--r--arch/arm/mach-mvebu/dove.c2
-rw-r--r--arch/arm/mach-mvebu/headsmp-a9.S34
-rw-r--r--arch/arm/mach-mvebu/headsmp.S15
-rw-r--r--arch/arm/mach-mvebu/kirkwood.c5
-rw-r--r--arch/arm/mach-mvebu/mvebu-soc-id.c45
-rw-r--r--arch/arm/mach-mvebu/mvebu-soc-id.h4
-rw-r--r--arch/arm/mach-mvebu/platsmp-a9.c102
-rw-r--r--arch/arm/mach-mvebu/platsmp.c23
-rw-r--r--arch/arm/mach-mvebu/pmsu.c273
-rw-r--r--arch/arm/mach-mvebu/system-controller.c15
-rw-r--r--arch/arm/mach-omap1/board-h2.c2
-rw-r--r--arch/arm/mach-omap1/board-h3.c2
-rw-r--r--arch/arm/mach-omap1/board-innovator.c2
-rw-r--r--arch/arm/mach-omap1/board-osk.c2
-rw-r--r--arch/arm/mach-omap1/board-sx1.c26
-rw-r--r--arch/arm/mach-omap1/pm.c13
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c5
-rw-r--r--arch/arm/mach-omap2/board-flash.c6
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c4
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c3
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c2
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_osc.c8
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_sys.c2
-rw-r--r--arch/arm/mach-omap2/clockdomain.h3
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c15
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.h4
-rw-r--r--arch/arm/mach-omap2/cm33xx.c4
-rw-r--r--arch/arm/mach-omap2/cm33xx.h3
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c25
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h5
-rw-r--r--arch/arm/mach-omap2/cm44xx.c11
-rw-r--r--arch/arm/mach-omap2/cm_common.c2
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c14
-rw-r--r--arch/arm/mach-omap2/control.c20
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c25
-rw-r--r--arch/arm/mach-omap2/dma.c4
-rw-r--r--arch/arm/mach-omap2/gpmc.c8
-rw-r--r--arch/arm/mach-omap2/id.c39
-rw-r--r--arch/arm/mach-omap2/io.c1
-rw-r--r--arch/arm/mach-omap2/irq.c4
-rw-r--r--arch/arm/mach-omap2/mux.c8
-rw-r--r--arch/arm/mach-omap2/omap-headsmp.S6
-rw-r--r--arch/arm/mach-omap2/omap-hotplug.c4
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c18
-rw-r--r--arch/arm/mach-omap2/omap-smp.c6
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c42
-rw-r--r--arch/arm/mach-omap2/omap4-common.c18
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c99
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c285
-rw-r--r--arch/arm/mach-omap2/omap_phy_internal.c6
-rw-r--r--arch/arm/mach-omap2/omap_twl.c60
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c12
-rw-r--r--arch/arm/mach-omap2/pm.c45
-rw-r--r--arch/arm/mach-omap2/pm.h8
-rw-r--r--arch/arm/mach-omap2/pm24xx.c4
-rw-r--r--arch/arm/mach-omap2/pm34xx.c11
-rw-r--r--arch/arm/mach-omap2/pm44xx.c6
-rw-r--r--arch/arm/mach-omap2/powerdomain-common.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain.h3
-rw-r--r--arch/arm/mach-omap2/prcm-common.h24
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.c4
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h1
-rw-r--r--arch/arm/mach-omap2/prm-regbits-34xx.h11
-rw-r--r--arch/arm/mach-omap2/prm.h10
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c13
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h2
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c1
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h4
-rw-r--r--arch/arm/mach-omap2/prm33xx.c5
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c22
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h2
-rw-r--r--arch/arm/mach-omap2/prm44xx.c24
-rw-r--r--arch/arm/mach-omap2/prm_common.c17
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c4
-rw-r--r--arch/arm/mach-omap2/sdrc.h8
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c4
-rw-r--r--arch/arm/mach-omap2/soc.h5
-rw-r--r--arch/arm/mach-omap2/sr_device.c2
-rw-r--r--arch/arm/mach-omap2/sram.c16
-rw-r--r--arch/arm/mach-omap2/timer.c10
-rw-r--r--arch/arm/mach-omap2/vc.c236
-rw-r--r--arch/arm/mach-omap2/vc.h3
-rw-r--r--arch/arm/mach-omap2/wd_timer.c8
-rw-r--r--arch/arm/mach-orion5x/common.h2
-rw-r--r--arch/arm/mach-prima2/rstc.c34
-rw-r--r--arch/arm/mach-qcom/Kconfig4
-rw-r--r--arch/arm/mach-realview/core.c15
-rw-r--r--arch/arm/mach-realview/core.h1
-rw-r--r--arch/arm/mach-realview/realview_eb.c1
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c1
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c1
-rw-r--r--arch/arm/mach-realview/realview_pba8.c1
-rw-r--r--arch/arm/mach-realview/realview_pbx.c1
-rw-r--r--arch/arm/mach-rockchip/core.h2
-rw-r--r--arch/arm/mach-rockchip/platsmp.c3
-rw-r--r--arch/arm/mach-rockchip/rockchip.c1
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig70
-rw-r--r--arch/arm/mach-s3c24xx/Makefile13
-rw-r--r--arch/arm/mach-s3c24xx/clock-dclk.c195
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2410.c284
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2412.c760
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2416.c171
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2440.c217
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2443.c212
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c244x.c141
-rw-r--r--arch/arm/mach-s3c24xx/common-s3c2443.c675
-rw-r--r--arch/arm/mach-s3c24xx/common.c85
-rw-r--r--arch/arm/mach-s3c24xx/common.h21
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq-utils.c4
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/debug-macro.S101
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-clock.h18
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-gpio.h3
-rw-r--r--arch/arm/mach-s3c24xx/mach-amlm5900.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-anubis.c34
-rw-r--r--arch/arm/mach-s3c24xx/mach-at2440evb.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-bast.c34
-rw-r--r--arch/arm/mach-s3c24xx/mach-gta02.c8
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-n30.c12
-rw-r--r--arch/arm/mach-s3c24xx/mach-nexcoder.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris.c34
-rw-r--r--arch/arm/mach-s3c24xx/mach-otom.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-qt2410.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c21
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx3715.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-s3c2416-dt.c38
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2410.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2413.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2416.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2440.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2443.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-tct_hammer.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-vr1000.c34
-rw-r--r--arch/arm/mach-s3c24xx/mach-vstms.c9
-rw-r--r--arch/arm/mach-s3c24xx/pm.c17
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c56
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c43
-rw-r--r--arch/arm/mach-s3c24xx/s3c2442.c111
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c59
-rw-r--r--arch/arm/mach-shmobile/Kconfig29
-rw-r--r--arch/arm/mach-shmobile/Makefile4
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot1
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva-reference.c2
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c9
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c63
-rw-r--r--arch/arm/mach-shmobile/board-genmai-reference.c18
-rw-r--r--arch/arm/mach-shmobile/board-genmai.c44
-rw-r--r--arch/arm/mach-shmobile/board-koelsch-reference.c73
-rw-r--r--arch/arm/mach-shmobile/board-koelsch.c4
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c69
-rw-r--r--arch/arm/mach-shmobile/board-lager.c29
-rw-r--r--arch/arm/mach-shmobile/clock-emev2.c231
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c11
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c2
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c12
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c26
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c34
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7791.c25
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c9
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c5
-rw-r--r--arch/arm/mach-shmobile/clock.c28
-rw-r--r--arch/arm/mach-shmobile/include/mach/clock.h17
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h1
-rw-r--r--arch/arm/mach-shmobile/include/mach/emev2.h9
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7740.h1
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7791.h1
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c38
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c11
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c69
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c17
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c154
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c28
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c66
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c37
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c34
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c16
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c95
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c92
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c1
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7791.c15
-rw-r--r--arch/arm/mach-shmobile/timer.c45
-rw-r--r--arch/arm/mach-sti/board-dt.c1
-rw-r--r--arch/arm/mach-sunxi/Kconfig38
-rw-r--r--arch/arm/mach-sunxi/common.h19
-rw-r--r--arch/arm/mach-sunxi/platsmp.c3
-rw-r--r--arch/arm/mach-sunxi/sunxi.c113
-rw-r--r--arch/arm/mach-tegra/Kconfig1
-rw-r--r--arch/arm/mach-tegra/pmc.c24
-rw-r--r--arch/arm/mach-ux500/Makefile3
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c166
-rw-r--r--arch/arm/mach-ux500/board-mop500.h5
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c4
-rw-r--r--arch/arm/mach-versatile/core.c16
-rw-r--r--arch/arm/mach-vexpress/Kconfig2
-rw-r--r--arch/arm/mach-vexpress/core.h3
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c10
-rw-r--r--arch/arm/mach-vexpress/platsmp.c187
-rw-r--r--arch/arm/mach-vexpress/v2m.c82
-rw-r--r--arch/arm/mach-zynq/Kconfig10
-rw-r--r--arch/arm/mach-zynq/common.c71
-rw-r--r--arch/arm/mach-zynq/common.h1
-rw-r--r--arch/arm/mach-zynq/headsmp.S5
-rw-r--r--arch/arm/mach-zynq/slcr.c19
-rw-r--r--arch/arm/mm/proc-v7m.S8
-rw-r--r--arch/arm/plat-omap/counter_32k.c6
-rw-r--r--arch/arm/plat-omap/debug-leds.c14
-rw-r--r--arch/arm/plat-omap/dma.c10
-rw-r--r--arch/arm/plat-omap/dmtimer.c8
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h16
-rw-r--r--arch/arm/plat-samsung/Makefile3
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu-freq-core.h1
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h61
-rw-r--r--arch/arm/plat-versatile/Kconfig6
-rw-r--r--arch/arm/plat-versatile/Makefile1
-rw-r--r--arch/arm/plat-versatile/leds.c103
-rw-r--r--arch/arm/xen/enlighten.c9
-rw-r--r--arch/arm/xen/hypercall.S1
-rw-r--r--arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi2
-rw-r--r--arch/arm64/include/asm/memory.h1
-rw-r--r--arch/arm64/include/asm/pgtable.h2
-rw-r--r--arch/arm64/kernel/irq.c10
-rw-r--r--arch/arm64/mm/hugetlbpage.c4
-rw-r--r--arch/arm64/xen/hypercall.S1
-rw-r--r--arch/blackfin/include/asm/pci.h5
-rw-r--r--arch/cris/include/asm/pci.h1
-rw-r--r--arch/frv/include/asm/pci.h2
-rw-r--r--arch/frv/mb93090-mb00/pci-irq.c4
-rw-r--r--arch/ia64/include/asm/pci.h6
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/include/uapi/asm/unistd.h1
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/ia64/pci/fixup.c4
-rw-r--r--arch/m68k/Kconfig.debug9
-rw-r--r--arch/m68k/amiga/amisound.c2
-rw-r--r--arch/m68k/amiga/config.c20
-rw-r--r--arch/m68k/apollo/config.c20
-rw-r--r--arch/m68k/atari/stram.c71
-rw-r--r--arch/m68k/configs/amiga_defconfig5
-rw-r--r--arch/m68k/configs/apollo_defconfig5
-rw-r--r--arch/m68k/configs/atari_defconfig5
-rw-r--r--arch/m68k/configs/bvme6000_defconfig5
-rw-r--r--arch/m68k/configs/hp300_defconfig5
-rw-r--r--arch/m68k/configs/mac_defconfig5
-rw-r--r--arch/m68k/configs/multi_defconfig5
-rw-r--r--arch/m68k/configs/mvme147_defconfig5
-rw-r--r--arch/m68k/configs/mvme16x_defconfig5
-rw-r--r--arch/m68k/configs/q40_defconfig5
-rw-r--r--arch/m68k/configs/sun3_defconfig5
-rw-r--r--arch/m68k/configs/sun3x_defconfig5
-rw-r--r--arch/m68k/hp300/config.c11
-rw-r--r--arch/m68k/include/asm/atari_stram.h2
-rw-r--r--arch/m68k/include/asm/unistd.h2
-rw-r--r--arch/m68k/include/uapi/asm/unistd.h1
-rw-r--r--arch/m68k/kernel/Makefile2
-rw-r--r--arch/m68k/kernel/early_printk.c67
-rw-r--r--arch/m68k/kernel/head.S207
-rw-r--r--arch/m68k/kernel/syscalltable.S1
-rw-r--r--arch/m68k/mac/config.c29
-rw-r--r--arch/m68k/mm/motorola.c10
-rw-r--r--arch/m68k/mvme16x/config.c26
-rw-r--r--arch/metag/include/asm/barrier.h3
-rw-r--r--arch/metag/include/asm/processor.h2
-rw-r--r--arch/metag/include/uapi/asm/Kbuild2
-rw-r--r--arch/metag/include/uapi/asm/resource.h7
-rw-r--r--arch/microblaze/include/asm/pci.h5
-rw-r--r--arch/microblaze/pci/pci-common.c20
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/dec/ecc-berr.c1
-rw-r--r--arch/mips/dec/kn02xa-berr.c1
-rw-r--r--arch/mips/dec/prom/Makefile1
-rw-r--r--arch/mips/dec/prom/call_o32.S89
-rw-r--r--arch/mips/fw/lib/call_o32.S57
-rw-r--r--arch/mips/fw/sni/sniprom.c3
-rw-r--r--arch/mips/include/asm/cpu-info.h4
-rw-r--r--arch/mips/include/asm/dec/prom.h48
-rw-r--r--arch/mips/include/asm/pci.h5
-rw-r--r--arch/mips/include/asm/rm9k-ocd.h56
-rw-r--r--arch/mips/include/asm/syscall.h2
-rw-r--r--arch/mips/include/uapi/asm/inst.h398
-rw-r--r--arch/mips/include/uapi/asm/unistd.h15
-rw-r--r--arch/mips/kernel/branch.c8
-rw-r--r--arch/mips/kernel/proc.c9
-rw-r--r--arch/mips/kernel/ptrace.c14
-rw-r--r--arch/mips/kernel/scall32-o32.S1
-rw-r--r--arch/mips/kernel/scall64-64.S1
-rw-r--r--arch/mips/kernel/scall64-n32.S1
-rw-r--r--arch/mips/kernel/scall64-o32.S1
-rw-r--r--arch/mips/kernel/traps.c4
-rw-r--r--arch/mips/lantiq/dts/easy50712.dts1
-rw-r--r--arch/mips/lib/csum_partial.S9
-rw-r--r--arch/mips/lib/delay.c14
-rw-r--r--arch/mips/lib/strncpy_user.S13
-rw-r--r--arch/mips/loongson/Kconfig1
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_mfgpt.c11
-rw-r--r--arch/mips/loongson/lemote-2f/clock.c5
-rw-r--r--arch/mips/mm/page.c4
-rw-r--r--arch/mips/mm/tlb-funcs.S4
-rw-r--r--arch/mips/mm/tlbex.c7
-rw-r--r--arch/mips/mti-malta/malta-memory.c2
-rw-r--r--arch/mips/pci/pci-rc32434.c1
-rw-r--r--arch/mips/ralink/dts/mt7620a_eval.dts1
-rw-r--r--arch/mips/ralink/dts/rt2880_eval.dts1
-rw-r--r--arch/mips/ralink/dts/rt3052_eval.dts1
-rw-r--r--arch/mips/ralink/dts/rt3883_eval.dts1
-rw-r--r--arch/mn10300/include/asm/pci.h1
-rw-r--r--arch/mn10300/unit-asb2305/pci-irq.c4
-rw-r--r--arch/parisc/Kconfig1
-rw-r--r--arch/parisc/include/asm/pci.h5
-rw-r--r--arch/parisc/include/asm/processor.h5
-rw-r--r--arch/parisc/include/uapi/asm/unistd.h3
-rw-r--r--arch/parisc/kernel/sys_parisc.c6
-rw-r--r--arch/parisc/kernel/syscall.S12
-rw-r--r--arch/parisc/kernel/syscall_table.S1
-rw-r--r--arch/parisc/kernel/traps.c54
-rw-r--r--arch/parisc/mm/fault.c44
-rw-r--r--arch/powerpc/Makefile4
-rw-r--r--arch/powerpc/include/asm/pci.h5
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h7
-rw-r--r--arch/powerpc/include/asm/sections.h11
-rw-r--r--arch/powerpc/include/asm/systbl.h1
-rw-r--r--arch/powerpc/include/asm/unistd.h2
-rw-r--r--arch/powerpc/include/uapi/asm/unistd.h1
-rw-r--r--arch/powerpc/kernel/kvm.c2
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c2
-rw-r--r--arch/powerpc/kernel/pci-common.c20
-rw-r--r--arch/powerpc/kernel/pci-hotplug.c3
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c3
-rw-r--r--arch/powerpc/kernel/time.c3
-rw-r--r--arch/powerpc/kvm/book3s.c6
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c2
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S104
-rw-r--r--arch/powerpc/kvm/book3s_pr.c6
-rw-r--r--arch/powerpc/mm/hash_utils_64.c4
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c3
-rw-r--r--arch/s390/crypto/aes_s390.c3
-rw-r--r--arch/s390/crypto/des_s390.c3
-rw-r--r--arch/s390/include/asm/pci.h6
-rw-r--r--arch/s390/kvm/kvm-s390.c1
-rw-r--r--arch/s390/net/bpf_jit_comp.c2
-rw-r--r--arch/s390/pci/pci.c6
-rw-r--r--arch/s390/pci/pci_sysfs.c44
-rw-r--r--arch/sh/drivers/pci/fixups-dreamcast.c18
-rw-r--r--arch/sh/include/asm/pci.h5
-rw-r--r--arch/sh/kernel/cpu/clock-cpg.c10
-rw-r--r--arch/sh/kernel/cpu/sh2/setup-sh7619.c66
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7264.c4
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7269.c4
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-mxg.c98
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7201.c98
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7203.c133
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7206.c164
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7264.c140
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7269.c133
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7705.c78
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh770x.c78
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7710.c78
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7720.c228
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh4-202.c78
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7750.c138
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7760.c78
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7343.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7366.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c6
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7723.c10
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c10
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7734.c12
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7757.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7785.c8
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7786.c16
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-shx3.c8
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7343.c96
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c96
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c96
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c172
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c173
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7734.c235
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c48
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7763.c154
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7770.c230
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7780.c154
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7785.c154
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7786.c299
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-shx3.c150
-rw-r--r--arch/sh/kernel/cpu/sh5/setup-sh5.c79
-rw-r--r--arch/sparc/include/asm/pci_32.h5
-rw-r--r--arch/sparc/include/asm/pci_64.h5
-rw-r--r--arch/sparc/include/asm/pgtable_64.h89
-rw-r--r--arch/sparc/include/asm/tsb.h3
-rw-r--r--arch/sparc/kernel/head_64.S4
-rw-r--r--arch/sparc/kernel/ktlb.S2
-rw-r--r--arch/sparc/kernel/nmi.c21
-rw-r--r--arch/sparc/kernel/pci.c3
-rw-r--r--arch/sparc/kernel/smp_64.c6
-rw-r--r--arch/sparc/kernel/sys32.S2
-rw-r--r--arch/sparc/kernel/sysfs.c2
-rw-r--r--arch/sparc/kernel/unaligned_64.c12
-rw-r--r--arch/sparc/lib/NG2memcpy.S1
-rw-r--r--arch/sparc/mm/fault_64.c98
-rw-r--r--arch/sparc/mm/gup.c2
-rw-r--r--arch/sparc/mm/init_64.c12
-rw-r--r--arch/sparc/mm/tlb.c26
-rw-r--r--arch/sparc/mm/tsb.c14
-rw-r--r--arch/unicore32/include/asm/pci.h5
-rw-r--r--arch/x86/Makefile1
-rw-r--r--arch/x86/boot/Makefile4
-rw-r--r--arch/x86/boot/compressed/misc.c2
-rw-r--r--arch/x86/include/asm/hpet.h1
-rw-r--r--arch/x86/include/asm/hugetlb.h1
-rw-r--r--arch/x86/include/asm/page_64_types.h2
-rw-r--r--arch/x86/include/asm/pci.h1
-rw-r--r--arch/x86/include/asm/xen/hypercall.h2
-rw-r--r--arch/x86/include/asm/xen/interface.h3
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h2
-rw-r--r--arch/x86/kernel/acpi/sleep.c2
-rw-r--r--arch/x86/kernel/aperture_64.c59
-rw-r--r--arch/x86/kernel/apic/io_apic.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c4
-rw-r--r--arch/x86/kernel/cpu/mcheck/threshold.c4
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c1
-rw-r--r--arch/x86/kernel/cpu/rdrand.c1
-rw-r--r--arch/x86/kernel/early-quirks.c16
-rw-r--r--arch/x86/kernel/head32.c2
-rw-r--r--arch/x86/kernel/head64.c2
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/kernel/ldt.c4
-rw-r--r--arch/x86/kernel/process_64.c2
-rw-r--r--arch/x86/kernel/reboot.c10
-rw-r--r--arch/x86/kernel/smp.c2
-rw-r--r--arch/x86/kernel/traps.c6
-rw-r--r--arch/x86/kernel/vsmp_64.c6
-rw-r--r--arch/x86/kernel/vsyscall_gtod.c2
-rw-r--r--arch/x86/kvm/vmx.c7
-rw-r--r--arch/x86/kvm/x86.c8
-rw-r--r--arch/x86/lguest/boot.c4
-rw-r--r--arch/x86/lib/msr.c2
-rw-r--r--arch/x86/math-emu/errors.c16
-rw-r--r--arch/x86/net/bpf_jit_comp.c2
-rw-r--r--arch/x86/pci/acpi.c6
-rw-r--r--arch/x86/pci/amd_bus.c83
-rw-r--r--arch/x86/pci/broadcom_bus.c4
-rw-r--r--arch/x86/pci/fixup.c18
-rw-r--r--arch/x86/pci/i386.c27
-rw-r--r--arch/x86/platform/efi/early_printk.c83
-rw-r--r--arch/x86/platform/olpc/olpc-xo1-pm.c2
-rw-r--r--arch/x86/power/hibernate_64.c2
-rw-r--r--arch/x86/vdso/vdso32-setup.c8
-rw-r--r--arch/x86/xen/enlighten.c3
-rw-r--r--arch/x86/xen/irq.c6
-rw-r--r--arch/x86/xen/mmu.c125
-rw-r--r--arch/x86/xen/p2m.c174
-rw-r--r--arch/x86/xen/setup.c15
-rw-r--r--arch/x86/xen/suspend.c23
-rw-r--r--arch/x86/xen/xen-ops.h2
-rw-r--r--arch/xtensa/Kconfig20
-rw-r--r--arch/xtensa/boot/dts/kc705.dts11
-rw-r--r--arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi28
-rw-r--r--arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi48
-rw-r--r--arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi32
-rw-r--r--arch/xtensa/boot/dts/xtfpga.dtsi37
-rw-r--r--arch/xtensa/include/asm/bootparam.h13
-rw-r--r--arch/xtensa/include/asm/fixmap.h58
-rw-r--r--arch/xtensa/include/asm/highmem.h45
-rw-r--r--arch/xtensa/include/asm/pci.h5
-rw-r--r--arch/xtensa/include/asm/pgtable.h4
-rw-r--r--arch/xtensa/include/asm/sysmem.h38
-rw-r--r--arch/xtensa/include/asm/tlbflush.h11
-rw-r--r--arch/xtensa/kernel/setup.c46
-rw-r--r--arch/xtensa/kernel/smp.c15
-rw-r--r--arch/xtensa/kernel/xtensa_ksyms.c7
-rw-r--r--arch/xtensa/mm/Makefile1
-rw-r--r--arch/xtensa/mm/cache.c7
-rw-r--r--arch/xtensa/mm/highmem.c72
-rw-r--r--arch/xtensa/mm/init.c299
-rw-r--r--arch/xtensa/mm/mmu.c36
-rw-r--r--arch/xtensa/mm/tlb.c15
-rw-r--r--arch/xtensa/platforms/iss/Makefile3
-rw-r--r--arch/xtensa/platforms/xt2000/setup.c12
701 files changed, 9592 insertions, 12791 deletions
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index d01afb78919c..f7f680f7457d 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -59,11 +59,6 @@ struct pci_controller {
59 59
60extern void pcibios_set_master(struct pci_dev *dev); 60extern void pcibios_set_master(struct pci_dev *dev);
61 61
62extern inline void pcibios_penalize_isa_irq(int irq, int active)
63{
64 /* We don't do dynamic PCI IRQ allocation */
65}
66
67/* IOMMU controls. */ 62/* IOMMU controls. */
68 63
69/* The PCI address space does not equal the physical memory address space. 64/* The PCI address space does not equal the physical memory address space.
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2bb6bcee025c..201f5e105484 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -314,6 +314,7 @@ config ARCH_MULTIPLATFORM
314 select CLKSRC_OF 314 select CLKSRC_OF
315 select COMMON_CLK 315 select COMMON_CLK
316 select GENERIC_CLOCKEVENTS 316 select GENERIC_CLOCKEVENTS
317 select MIGHT_HAVE_PCI
317 select MULTI_IRQ_HANDLER 318 select MULTI_IRQ_HANDLER
318 select SPARSE_IRQ 319 select SPARSE_IRQ
319 select USE_OF 320 select USE_OF
@@ -754,7 +755,7 @@ config ARCH_S3C64XX
754 select ATAGS 755 select ATAGS
755 select CLKDEV_LOOKUP 756 select CLKDEV_LOOKUP
756 select CLKSRC_SAMSUNG_PWM 757 select CLKSRC_SAMSUNG_PWM
757 select COMMON_CLK 758 select COMMON_CLK_SAMSUNG
758 select CPU_V6K 759 select CPU_V6K
759 select GENERIC_CLOCKEVENTS 760 select GENERIC_CLOCKEVENTS
760 select GPIO_SAMSUNG 761 select GPIO_SAMSUNG
@@ -828,26 +829,6 @@ config ARCH_S5PV210
828 help 829 help
829 Samsung S5PV210/S5PC110 series based systems 830 Samsung S5PV210/S5PC110 series based systems
830 831
831config ARCH_EXYNOS
832 bool "Samsung EXYNOS"
833 select ARCH_HAS_CPUFREQ
834 select ARCH_HAS_HOLES_MEMORYMODEL
835 select ARCH_REQUIRE_GPIOLIB
836 select ARCH_SPARSEMEM_ENABLE
837 select ARM_GIC
838 select COMMON_CLK
839 select CPU_V7
840 select GENERIC_CLOCKEVENTS
841 select HAVE_S3C2410_I2C if I2C
842 select HAVE_S3C2410_WATCHDOG if WATCHDOG
843 select HAVE_S3C_RTC if RTC_CLASS
844 select NEED_MACH_MEMORY_H
845 select SPARSE_IRQ
846 select SRAM
847 select USE_OF
848 help
849 Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5)
850
851config ARCH_DAVINCI 832config ARCH_DAVINCI
852 bool "TI DaVinci" 833 bool "TI DaVinci"
853 select ARCH_HAS_HOLES_MEMORYMODEL 834 select ARCH_HAS_HOLES_MEMORYMODEL
@@ -951,6 +932,8 @@ source "arch/arm/mach-mvebu/Kconfig"
951 932
952source "arch/arm/mach-at91/Kconfig" 933source "arch/arm/mach-at91/Kconfig"
953 934
935source "arch/arm/mach-axxia/Kconfig"
936
954source "arch/arm/mach-bcm/Kconfig" 937source "arch/arm/mach-bcm/Kconfig"
955 938
956source "arch/arm/mach-berlin/Kconfig" 939source "arch/arm/mach-berlin/Kconfig"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index eab8ecbe69c1..8f90595069a1 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -317,6 +317,13 @@ choice
317 Say Y here if you want kernel low-level debugging support 317 Say Y here if you want kernel low-level debugging support
318 on i.MX6SL. 318 on i.MX6SL.
319 319
320 config DEBUG_IMX6SX_UART
321 bool "i.MX6SX Debug UART"
322 depends on SOC_IMX6SX
323 help
324 Say Y here if you want kernel low-level debugging support
325 on i.MX6SX.
326
320 config DEBUG_KEYSTONE_UART0 327 config DEBUG_KEYSTONE_UART0
321 bool "Kernel low-level debugging on KEYSTONE2 using UART0" 328 bool "Kernel low-level debugging on KEYSTONE2 using UART0"
322 depends on ARCH_KEYSTONE 329 depends on ARCH_KEYSTONE
@@ -349,56 +356,40 @@ choice
349 Say Y here if you want kernel low-level debugging support 356 Say Y here if you want kernel low-level debugging support
350 on MMP UART3. 357 on MMP UART3.
351 358
352 config DEBUG_MSM_UART1 359 config DEBUG_MSM_UART
353 bool "Kernel low-level debugging messages via MSM UART1" 360 bool "Kernel low-level debugging messages via MSM UART"
354 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 361 depends on ARCH_MSM
355 select DEBUG_MSM_UART
356 help 362 help
357 Say Y here if you want the debug print routines to direct 363 Say Y here if you want the debug print routines to direct
358 their output to the first serial port on MSM devices. 364 their output to the serial port on MSM devices.
359 365
360 config DEBUG_MSM_UART2 366 ARCH DEBUG_UART_PHYS DEBUG_UART_BASE #
361 bool "Kernel low-level debugging messages via MSM UART2" 367 MSM7X00A, QSD8X50 0xa9a00000 0xe1000000 UART1
362 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 368 MSM7X00A, QSD8X50 0xa9b00000 0xe1000000 UART2
363 select DEBUG_MSM_UART 369 MSM7X00A, QSD8X50 0xa9c00000 0xe1000000 UART3
364 help
365 Say Y here if you want the debug print routines to direct
366 their output to the second serial port on MSM devices.
367 370
368 config DEBUG_MSM_UART3 371 MSM7X30 0xaca00000 0xe1000000 UART1
369 bool "Kernel low-level debugging messages via MSM UART3" 372 MSM7X30 0xacb00000 0xe1000000 UART2
370 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 373 MSM7X30 0xacc00000 0xe1000000 UART3
371 select DEBUG_MSM_UART
372 help
373 Say Y here if you want the debug print routines to direct
374 their output to the third serial port on MSM devices.
375 374
376 config DEBUG_MSM8660_UART 375 Please adjust DEBUG_UART_PHYS and DEBUG_UART_BASE configuration
377 bool "Kernel low-level debugging messages via MSM 8660 UART" 376 options based on your needs.
378 depends on ARCH_MSM8X60
379 select MSM_HAS_DEBUG_UART_HS
380 select DEBUG_MSM_UART
381 help
382 Say Y here if you want the debug print routines to direct
383 their output to the serial port on MSM 8660 devices.
384 377
385 config DEBUG_MSM8960_UART 378 config DEBUG_QCOM_UARTDM
386 bool "Kernel low-level debugging messages via MSM 8960 UART" 379 bool "Kernel low-level debugging messages via QCOM UARTDM"
387 depends on ARCH_MSM8960 380 depends on ARCH_QCOM
388 select MSM_HAS_DEBUG_UART_HS
389 select DEBUG_MSM_UART
390 help 381 help
391 Say Y here if you want the debug print routines to direct 382 Say Y here if you want the debug print routines to direct
392 their output to the serial port on MSM 8960 devices. 383 their output to the serial port on Qualcomm devices.
393 384
394 config DEBUG_MSM8974_UART 385 ARCH DEBUG_UART_PHYS DEBUG_UART_BASE
395 bool "Kernel low-level debugging messages via MSM 8974 UART" 386 APQ8084 0xf995e000 0xfa75e000
396 depends on ARCH_MSM8974 387 MSM8X60 0x19c40000 0xf0040000
397 select MSM_HAS_DEBUG_UART_HS 388 MSM8960 0x16440000 0xf0040000
398 select DEBUG_MSM_UART 389 MSM8974 0xf991e000 0xfa71e000
399 help 390
400 Say Y here if you want the debug print routines to direct 391 Please adjust DEBUG_UART_PHYS and DEBUG_UART_BASE configuration
401 their output to the serial port on MSM 8974 devices. 392 options based on your needs.
402 393
403 config DEBUG_MVEBU_UART 394 config DEBUG_MVEBU_UART
404 bool "Kernel low-level debugging messages via MVEBU UART (old bootloaders)" 395 bool "Kernel low-level debugging messages via MVEBU UART (old bootloaders)"
@@ -625,6 +616,7 @@ choice
625 config DEBUG_S3C_UART0 616 config DEBUG_S3C_UART0
626 depends on PLAT_SAMSUNG 617 depends on PLAT_SAMSUNG
627 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 618 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
619 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
628 bool "Use S3C UART 0 for low-level debug" 620 bool "Use S3C UART 0 for low-level debug"
629 help 621 help
630 Say Y here if you want the debug print routines to direct 622 Say Y here if you want the debug print routines to direct
@@ -637,6 +629,7 @@ choice
637 config DEBUG_S3C_UART1 629 config DEBUG_S3C_UART1
638 depends on PLAT_SAMSUNG 630 depends on PLAT_SAMSUNG
639 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 631 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
632 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
640 bool "Use S3C UART 1 for low-level debug" 633 bool "Use S3C UART 1 for low-level debug"
641 help 634 help
642 Say Y here if you want the debug print routines to direct 635 Say Y here if you want the debug print routines to direct
@@ -649,6 +642,7 @@ choice
649 config DEBUG_S3C_UART2 642 config DEBUG_S3C_UART2
650 depends on PLAT_SAMSUNG 643 depends on PLAT_SAMSUNG
651 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 644 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
645 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
652 bool "Use S3C UART 2 for low-level debug" 646 bool "Use S3C UART 2 for low-level debug"
653 help 647 help
654 Say Y here if you want the debug print routines to direct 648 Say Y here if you want the debug print routines to direct
@@ -670,6 +664,33 @@ choice
670 The uncompressor code port configuration is now handled 664 The uncompressor code port configuration is now handled
671 by CONFIG_S3C_LOWLEVEL_UART_PORT. 665 by CONFIG_S3C_LOWLEVEL_UART_PORT.
672 666
667 config DEBUG_S3C2410_UART0
668 depends on ARCH_S3C24XX
669 select DEBUG_S3C2410_UART
670 bool "Use S3C2410/S3C2412 UART 0 for low-level debug"
671 help
672 Say Y here if you want the debug print routines to direct
673 their output to UART 0. The port must have been initialised
674 by the boot-loader before use.
675
676 config DEBUG_S3C2410_UART1
677 depends on ARCH_S3C24XX
678 select DEBUG_S3C2410_UART
679 bool "Use S3C2410/S3C2412 UART 1 for low-level debug"
680 help
681 Say Y here if you want the debug print routines to direct
682 their output to UART 1. The port must have been initialised
683 by the boot-loader before use.
684
685 config DEBUG_S3C2410_UART2
686 depends on ARCH_S3C24XX
687 select DEBUG_S3C2410_UART
688 bool "Use S3C2410/S3C2412 UART 2 for low-level debug"
689 help
690 Say Y here if you want the debug print routines to direct
691 their output to UART 2. The port must have been initialised
692 by the boot-loader before use.
693
673 config DEBUG_SOCFPGA_UART 694 config DEBUG_SOCFPGA_UART
674 depends on ARCH_SOCFPGA 695 depends on ARCH_SOCFPGA
675 bool "Use SOCFPGA UART for low-level debug" 696 bool "Use SOCFPGA UART for low-level debug"
@@ -921,6 +942,13 @@ endchoice
921config DEBUG_EXYNOS_UART 942config DEBUG_EXYNOS_UART
922 bool 943 bool
923 944
945config DEBUG_S3C2410_UART
946 bool
947 select DEBUG_S3C24XX_UART
948
949config DEBUG_S3C24XX_UART
950 bool
951
924config DEBUG_OMAP2PLUS_UART 952config DEBUG_OMAP2PLUS_UART
925 bool 953 bool
926 depends on ARCH_OMAP2PLUS 954 depends on ARCH_OMAP2PLUS
@@ -935,13 +963,23 @@ config DEBUG_IMX_UART_PORT
935 DEBUG_IMX51_UART || \ 963 DEBUG_IMX51_UART || \
936 DEBUG_IMX53_UART || \ 964 DEBUG_IMX53_UART || \
937 DEBUG_IMX6Q_UART || \ 965 DEBUG_IMX6Q_UART || \
938 DEBUG_IMX6SL_UART 966 DEBUG_IMX6SL_UART || \
967 DEBUG_IMX6SX_UART
939 default 1 968 default 1
940 depends on ARCH_MXC 969 depends on ARCH_MXC
941 help 970 help
942 Choose UART port on which kernel low-level debug messages 971 Choose UART port on which kernel low-level debug messages
943 should be output. 972 should be output.
944 973
974config DEBUG_VF_UART_PORT
975 int "Vybrid Debug UART Port Selection" if DEBUG_VF_UART
976 default 1
977 range 0 3
978 depends on SOC_VF610
979 help
980 Choose UART port on which kernel low-level debug messages
981 should be output.
982
945config DEBUG_TEGRA_UART 983config DEBUG_TEGRA_UART
946 bool 984 bool
947 depends on ARCH_TEGRA 985 depends on ARCH_TEGRA
@@ -950,10 +988,6 @@ config DEBUG_STI_UART
950 bool 988 bool
951 depends on ARCH_STI 989 depends on ARCH_STI
952 990
953config DEBUG_MSM_UART
954 bool
955 depends on ARCH_MSM || ARCH_QCOM
956
957config DEBUG_LL_INCLUDE 991config DEBUG_LL_INCLUDE
958 string 992 string
959 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
@@ -970,9 +1004,11 @@ config DEBUG_LL_INCLUDE
970 DEBUG_IMX51_UART || \ 1004 DEBUG_IMX51_UART || \
971 DEBUG_IMX53_UART ||\ 1005 DEBUG_IMX53_UART ||\
972 DEBUG_IMX6Q_UART || \ 1006 DEBUG_IMX6Q_UART || \
973 DEBUG_IMX6SL_UART 1007 DEBUG_IMX6SL_UART || \
974 default "debug/msm.S" if DEBUG_MSM_UART 1008 DEBUG_IMX6SX_UART
1009 default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM
975 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 1010 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
1011 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART
976 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 1012 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
977 default "debug/sti.S" if DEBUG_STI_UART 1013 default "debug/sti.S" if DEBUG_STI_UART
978 default "debug/tegra.S" if DEBUG_TEGRA_UART 1014 default "debug/tegra.S" if DEBUG_TEGRA_UART
@@ -1029,12 +1065,19 @@ config DEBUG_UART_PHYS
1029 default 0x40090000 if ARCH_LPC32XX 1065 default 0x40090000 if ARCH_LPC32XX
1030 default 0x40100000 if DEBUG_PXA_UART1 1066 default 0x40100000 if DEBUG_PXA_UART1
1031 default 0x42000000 if ARCH_GEMINI 1067 default 0x42000000 if ARCH_GEMINI
1068 default 0x50000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
1069 DEBUG_S3C2410_UART0)
1070 default 0x50004000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART1 || \
1071 DEBUG_S3C2410_UART1)
1072 default 0x50008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \
1073 DEBUG_S3C2410_UART2)
1032 default 0x7c0003f8 if FOOTBRIDGE 1074 default 0x7c0003f8 if FOOTBRIDGE
1033 default 0x80070000 if DEBUG_IMX23_UART 1075 default 0x80070000 if DEBUG_IMX23_UART
1034 default 0x80074000 if DEBUG_IMX28_UART 1076 default 0x80074000 if DEBUG_IMX28_UART
1035 default 0x80230000 if DEBUG_PICOXCELL_UART 1077 default 0x80230000 if DEBUG_PICOXCELL_UART
1036 default 0x808c0000 if ARCH_EP93XX 1078 default 0x808c0000 if ARCH_EP93XX
1037 default 0x90020000 if DEBUG_NSPIRE_CLASSIC_UART || DEBUG_NSPIRE_CX_UART 1079 default 0x90020000 if DEBUG_NSPIRE_CLASSIC_UART || DEBUG_NSPIRE_CX_UART
1080 default 0xa9a00000 if DEBUG_MSM_UART
1038 default 0xb0090000 if DEBUG_VEXPRESS_UART0_CRX 1081 default 0xb0090000 if DEBUG_VEXPRESS_UART0_CRX
1039 default 0xc0013000 if DEBUG_U300_UART 1082 default 0xc0013000 if DEBUG_U300_UART
1040 default 0xc8000000 if ARCH_IXP4XX && !CPU_BIG_ENDIAN 1083 default 0xc8000000 if ARCH_IXP4XX && !CPU_BIG_ENDIAN
@@ -1050,6 +1093,7 @@ config DEBUG_UART_PHYS
1050 ARCH_ORION5X 1093 ARCH_ORION5X
1051 default 0xf7fc9000 if DEBUG_BERLIN_UART 1094 default 0xf7fc9000 if DEBUG_BERLIN_UART
1052 default 0xf8b00000 if DEBUG_HI3716_UART 1095 default 0xf8b00000 if DEBUG_HI3716_UART
1096 default 0xf991e000 if DEBUG_QCOM_UARTDM
1053 default 0xfcb00000 if DEBUG_HI3620_UART 1097 default 0xfcb00000 if DEBUG_HI3620_UART
1054 default 0xfe800000 if ARCH_IOP32X 1098 default 0xfe800000 if ARCH_IOP32X
1055 default 0xffc02000 if DEBUG_SOCFPGA_UART 1099 default 0xffc02000 if DEBUG_SOCFPGA_UART
@@ -1058,11 +1102,13 @@ config DEBUG_UART_PHYS
1058 default 0xfffff700 if ARCH_IOP33X 1102 default 0xfffff700 if ARCH_IOP33X
1059 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1103 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1060 DEBUG_LL_UART_EFM32 || \ 1104 DEBUG_LL_UART_EFM32 || \
1061 DEBUG_UART_8250 || DEBUG_UART_PL01X 1105 DEBUG_UART_8250 || DEBUG_UART_PL01X || \
1106 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART
1062 1107
1063config DEBUG_UART_VIRT 1108config DEBUG_UART_VIRT
1064 hex "Virtual base address of debug UART" 1109 hex "Virtual base address of debug UART"
1065 default 0xe0010fe0 if ARCH_RPC 1110 default 0xe0010fe0 if ARCH_RPC
1111 default 0xe1000000 if DEBUG_MSM_UART
1066 default 0xf0000be0 if ARCH_EBSA110 1112 default 0xf0000be0 if ARCH_EBSA110
1067 default 0xf0009000 if DEBUG_CNS3XXX 1113 default 0xf0009000 if DEBUG_CNS3XXX
1068 default 0xf01fb000 if DEBUG_NOMADIK_UART 1114 default 0xf01fb000 if DEBUG_NOMADIK_UART
@@ -1075,9 +1121,16 @@ config DEBUG_UART_VIRT
1075 default 0xf2100000 if DEBUG_PXA_UART1 1121 default 0xf2100000 if DEBUG_PXA_UART1
1076 default 0xf4090000 if ARCH_LPC32XX 1122 default 0xf4090000 if ARCH_LPC32XX
1077 default 0xf4200000 if ARCH_GEMINI 1123 default 0xf4200000 if ARCH_GEMINI
1124 default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
1125 DEBUG_S3C2410_UART0)
1126 default 0xf7004000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART1 || \
1127 DEBUG_S3C2410_UART1)
1128 default 0xf7008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \
1129 DEBUG_S3C2410_UART2)
1078 default 0xf7fc9000 if DEBUG_BERLIN_UART 1130 default 0xf7fc9000 if DEBUG_BERLIN_UART
1079 default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9 1131 default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9
1080 default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1 1132 default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1
1133 default 0xfa71e000 if DEBUG_QCOM_UARTDM
1081 default 0xfb009000 if DEBUG_REALVIEW_STD_PORT 1134 default 0xfb009000 if DEBUG_REALVIEW_STD_PORT
1082 default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT 1135 default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT
1083 default 0xfd000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX 1136 default 0xfd000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX
@@ -1116,7 +1169,8 @@ config DEBUG_UART_VIRT
1116 default 0xff003000 if DEBUG_U300_UART 1169 default 0xff003000 if DEBUG_U300_UART
1117 default DEBUG_UART_PHYS if !MMU 1170 default DEBUG_UART_PHYS if !MMU
1118 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1171 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1119 DEBUG_UART_8250 || DEBUG_UART_PL01X 1172 DEBUG_UART_8250 || DEBUG_UART_PL01X || \
1173 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART
1120 1174
1121config DEBUG_UART_8250_SHIFT 1175config DEBUG_UART_8250_SHIFT
1122 int "Register offset shift for the 8250 debug UART" 1176 int "Register offset shift for the 8250 debug UART"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 41c1931f0155..6721fab13734 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -138,10 +138,12 @@ endif
138textofs-$(CONFIG_ARCH_MSM7X30) := 0x00208000 138textofs-$(CONFIG_ARCH_MSM7X30) := 0x00208000
139textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000 139textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
140textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000 140textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
141textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
141 142
142# Machine directory name. This list is sorted alphanumerically 143# Machine directory name. This list is sorted alphanumerically
143# by CONFIG_* macro name. 144# by CONFIG_* macro name.
144machine-$(CONFIG_ARCH_AT91) += at91 145machine-$(CONFIG_ARCH_AT91) += at91
146machine-$(CONFIG_ARCH_AXXIA) += axxia
145machine-$(CONFIG_ARCH_BCM) += bcm 147machine-$(CONFIG_ARCH_BCM) += bcm
146machine-$(CONFIG_ARCH_BERLIN) += berlin 148machine-$(CONFIG_ARCH_BERLIN) += berlin
147machine-$(CONFIG_ARCH_CLPS711X) += clps711x 149machine-$(CONFIG_ARCH_CLPS711X) += clps711x
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 066b03480b63..3a8b32df6b31 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -60,11 +60,6 @@
60 add \rb, \rb, #0x00010000 @ Ser1 60 add \rb, \rb, #0x00010000 @ Ser1
61#endif 61#endif
62 .endm 62 .endm
63#elif defined(CONFIG_ARCH_S3C24XX)
64 .macro loadsp, rb, tmp
65 mov \rb, #0x50000000
66 add \rb, \rb, #0x4000 * CONFIG_S3C_LOWLEVEL_UART_PORT
67 .endm
68#else 63#else
69 .macro loadsp, rb, tmp 64 .macro loadsp, rb, tmp
70 addruart \rb, \tmp 65 addruart \rb, \tmp
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cbe223c882d9..5986ff63b901 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -50,6 +50,7 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
50dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb 50dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb
51 51
52dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb 52dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
53dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
53dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 54dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
54dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb 55dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
55dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \ 56dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \
@@ -320,9 +321,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \
320dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb 321dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
321dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \ 322dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
322 s3c6410-smdk6410.dtb 323 s3c6410-smdk6410.dtb
323dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += emev2-kzm9d.dtb \ 324dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += r7s72100-genmai.dtb \
324 r7s72100-genmai.dtb \
325 r7s72100-genmai-reference.dtb \
326 r8a7740-armadillo800eva.dtb \ 325 r8a7740-armadillo800eva.dtb \
327 r8a7778-bockw.dtb \ 326 r8a7778-bockw.dtb \
328 r8a7778-bockw-reference.dtb \ 327 r8a7778-bockw-reference.dtb \
@@ -337,7 +336,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += emev2-kzm9d.dtb \
337 r8a73a4-ape6evm-reference.dtb \ 336 r8a73a4-ape6evm-reference.dtb \
338 sh7372-mackerel.dtb 337 sh7372-mackerel.dtb
339dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \ 338dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
340 r7s72100-genmai-reference.dtb \ 339 r7s72100-genmai.dtb \
341 r8a7791-henninger.dtb \ 340 r8a7791-henninger.dtb \
342 r8a7791-koelsch.dtb \ 341 r8a7791-koelsch.dtb \
343 r8a7790-lager.dtb 342 r8a7790-lager.dtb
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
index 6b71ad95a5cf..305975d3f531 100644
--- a/arch/arm/boot/dts/am335x-boneblack.dts
+++ b/arch/arm/boot/dts/am335x-boneblack.dts
@@ -26,7 +26,6 @@
26 pinctrl-0 = <&emmc_pins>; 26 pinctrl-0 = <&emmc_pins>;
27 bus-width = <8>; 27 bus-width = <8>;
28 status = "okay"; 28 status = "okay";
29 ti,vcc-aux-disable-is-sleep;
30}; 29};
31 30
32&am33xx_pinmux { 31&am33xx_pinmux {
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 0fb5df4ad498..586397cf6e9c 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -144,7 +144,7 @@
144 compatible = "ti,edma3"; 144 compatible = "ti,edma3";
145 ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; 145 ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
146 reg = <0x49000000 0x10000>, 146 reg = <0x49000000 0x10000>,
147 <0x44e10f90 0x10>; 147 <0x44e10f90 0x40>;
148 interrupts = <12 13 14>; 148 interrupts = <12 13 14>;
149 #dma-cells = <1>; 149 #dma-cells = <1>;
150 dma-channels = <64>; 150 dma-channels = <64>;
diff --git a/arch/arm/boot/dts/am3517.dtsi b/arch/arm/boot/dts/am3517.dtsi
index 788391f91684..5a452fdd7c5d 100644
--- a/arch/arm/boot/dts/am3517.dtsi
+++ b/arch/arm/boot/dts/am3517.dtsi
@@ -62,5 +62,21 @@
62 }; 62 };
63}; 63};
64 64
65&iva {
66 status = "disabled";
67};
68
69&mailbox {
70 status = "disabled";
71};
72
73&mmu_isp {
74 status = "disabled";
75};
76
77&smartreflex_mpu_iva {
78 status = "disabled";
79};
80
65/include/ "am35xx-clocks.dtsi" 81/include/ "am35xx-clocks.dtsi"
66/include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi" 82/include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 1f852086d9b5..1704e853f163 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -67,11 +67,15 @@
67 }; 67 };
68 68
69 ocp { 69 ocp {
70 compatible = "simple-bus"; 70 compatible = "ti,am4372-l3-noc", "simple-bus";
71 #address-cells = <1>; 71 #address-cells = <1>;
72 #size-cells = <1>; 72 #size-cells = <1>;
73 ranges; 73 ranges;
74 ti,hwmods = "l3_main"; 74 ti,hwmods = "l3_main";
75 reg = <0x44000000 0x400000
76 0x44800000 0x400000>;
77 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
78 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
75 79
76 prcm: prcm@44df0000 { 80 prcm: prcm@44df0000 {
77 compatible = "ti,am4-prcm"; 81 compatible = "ti,am4-prcm";
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
index f432685957b8..c25d15837ce9 100644
--- a/arch/arm/boot/dts/am437x-gp-evm.dts
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -221,6 +221,11 @@
221 status = "okay"; 221 status = "okay";
222}; 222};
223 223
224&gpio5 {
225 status = "okay";
226 ti,no-reset-on-init;
227};
228
224&mmc1 { 229&mmc1 {
225 status = "okay"; 230 status = "okay";
226 vmmc-supply = <&vmmcsd_fixed>; 231 vmmc-supply = <&vmmcsd_fixed>;
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index ba1a43118f8f..416f4e5a69c1 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -66,6 +66,7 @@
66 i2c@11000 { 66 i2c@11000 {
67 pinctrl-0 = <&i2c0_pins>; 67 pinctrl-0 = <&i2c0_pins>;
68 pinctrl-names = "default"; 68 pinctrl-names = "default";
69 clock-frequency = <100000>;
69 status = "okay"; 70 status = "okay";
70 audio_codec: audio-codec@4a { 71 audio_codec: audio-codec@4a {
71 compatible = "cirrus,cs42l51"; 72 compatible = "cirrus,cs42l51";
diff --git a/arch/arm/boot/dts/armada-375-db.dts b/arch/arm/boot/dts/armada-375-db.dts
index eb90b83d7d38..772fec2d26ce 100644
--- a/arch/arm/boot/dts/armada-375-db.dts
+++ b/arch/arm/boot/dts/armada-375-db.dts
@@ -78,6 +78,11 @@
78 }; 78 };
79 }; 79 };
80 80
81 sata@a0000 {
82 status = "okay";
83 nr-ports = <2>;
84 };
85
81 nand: nand@d0000 { 86 nand: nand@d0000 {
82 pinctrl-0 = <&nand_pins>; 87 pinctrl-0 = <&nand_pins>;
83 pinctrl-names = "default"; 88 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/armada-380.dtsi b/arch/arm/boot/dts/armada-380.dtsi
index aa71718b549d..e69bc6759c39 100644
--- a/arch/arm/boot/dts/armada-380.dtsi
+++ b/arch/arm/boot/dts/armada-380.dtsi
@@ -101,7 +101,7 @@
101 pcie@3,0 { 101 pcie@3,0 {
102 device_type = "pci"; 102 device_type = "pci";
103 assigned-addresses = <0x82000800 0 0x44000 0 0x2000>; 103 assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
104 reg = <0x1000 0 0 0 0>; 104 reg = <0x1800 0 0 0 0>;
105 #address-cells = <3>; 105 #address-cells = <3>;
106 #size-cells = <2>; 106 #size-cells = <2>;
107 #interrupt-cells = <1>; 107 #interrupt-cells = <1>;
diff --git a/arch/arm/boot/dts/armada-385.dtsi b/arch/arm/boot/dts/armada-385.dtsi
index 2c7990d6efa2..f011009bf4cf 100644
--- a/arch/arm/boot/dts/armada-385.dtsi
+++ b/arch/arm/boot/dts/armada-385.dtsi
@@ -112,7 +112,7 @@
112 pcie@3,0 { 112 pcie@3,0 {
113 device_type = "pci"; 113 device_type = "pci";
114 assigned-addresses = <0x82000800 0 0x44000 0 0x2000>; 114 assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
115 reg = <0x1000 0 0 0 0>; 115 reg = <0x1800 0 0 0 0>;
116 #address-cells = <3>; 116 #address-cells = <3>;
117 #size-cells = <2>; 117 #size-cells = <2>;
118 #interrupt-cells = <1>; 118 #interrupt-cells = <1>;
@@ -133,7 +133,7 @@
133 pcie@4,0 { 133 pcie@4,0 {
134 device_type = "pci"; 134 device_type = "pci";
135 assigned-addresses = <0x82000800 0 0x48000 0 0x2000>; 135 assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
136 reg = <0x1000 0 0 0 0>; 136 reg = <0x2000 0 0 0 0>;
137 #address-cells = <3>; 137 #address-cells = <3>;
138 #size-cells = <2>; 138 #size-cells = <2>;
139 #interrupt-cells = <1>; 139 #interrupt-cells = <1>;
diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts
index 2b598ef32285..42ddb2864365 100644
--- a/arch/arm/boot/dts/armada-xp-db.dts
+++ b/arch/arm/boot/dts/armada-xp-db.dts
@@ -49,7 +49,7 @@
49 /* Device Bus parameters are required */ 49 /* Device Bus parameters are required */
50 50
51 /* Read parameters */ 51 /* Read parameters */
52 devbus,bus-width = <8>; 52 devbus,bus-width = <16>;
53 devbus,turn-off-ps = <60000>; 53 devbus,turn-off-ps = <60000>;
54 devbus,badr-skew-ps = <0>; 54 devbus,badr-skew-ps = <0>;
55 devbus,acc-first-ps = <124000>; 55 devbus,acc-first-ps = <124000>;
diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
index eb0013f000b0..0478c55ca656 100644
--- a/arch/arm/boot/dts/armada-xp-gp.dts
+++ b/arch/arm/boot/dts/armada-xp-gp.dts
@@ -59,7 +59,7 @@
59 /* Device Bus parameters are required */ 59 /* Device Bus parameters are required */
60 60
61 /* Read parameters */ 61 /* Read parameters */
62 devbus,bus-width = <8>; 62 devbus,bus-width = <16>;
63 devbus,turn-off-ps = <60000>; 63 devbus,turn-off-ps = <60000>;
64 devbus,badr-skew-ps = <0>; 64 devbus,badr-skew-ps = <0>;
65 devbus,acc-first-ps = <124000>; 65 devbus,acc-first-ps = <124000>;
@@ -142,22 +142,22 @@
142 ethernet@70000 { 142 ethernet@70000 {
143 status = "okay"; 143 status = "okay";
144 phy = <&phy0>; 144 phy = <&phy0>;
145 phy-mode = "rgmii-id"; 145 phy-mode = "qsgmii";
146 }; 146 };
147 ethernet@74000 { 147 ethernet@74000 {
148 status = "okay"; 148 status = "okay";
149 phy = <&phy1>; 149 phy = <&phy1>;
150 phy-mode = "rgmii-id"; 150 phy-mode = "qsgmii";
151 }; 151 };
152 ethernet@30000 { 152 ethernet@30000 {
153 status = "okay"; 153 status = "okay";
154 phy = <&phy2>; 154 phy = <&phy2>;
155 phy-mode = "rgmii-id"; 155 phy-mode = "qsgmii";
156 }; 156 };
157 ethernet@34000 { 157 ethernet@34000 {
158 status = "okay"; 158 status = "okay";
159 phy = <&phy3>; 159 phy = <&phy3>;
160 phy-mode = "rgmii-id"; 160 phy-mode = "qsgmii";
161 }; 161 };
162 162
163 /* Front-side USB slot */ 163 /* Front-side USB slot */
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 cf26d1313d5f..e5c6a0492ca0 100644
--- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
+++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
@@ -39,7 +39,7 @@
39 /* Device Bus parameters are required */ 39 /* Device Bus parameters are required */
40 40
41 /* Read parameters */ 41 /* Read parameters */
42 devbus,bus-width = <8>; 42 devbus,bus-width = <16>;
43 devbus,turn-off-ps = <60000>; 43 devbus,turn-off-ps = <60000>;
44 devbus,badr-skew-ps = <0>; 44 devbus,badr-skew-ps = <0>;
45 devbus,acc-first-ps = <124000>; 45 devbus,acc-first-ps = <124000>;
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 366fc2cbcd64..c0e0eae16a27 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -641,7 +641,7 @@
641 trigger@3 { 641 trigger@3 {
642 reg = <3>; 642 reg = <3>;
643 trigger-name = "external"; 643 trigger-name = "external";
644 trigger-value = <0x13>; 644 trigger-value = <0xd>;
645 trigger-external; 645 trigger-external;
646 }; 646 };
647 }; 647 };
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi
index 6684d557daad..bb22842a0826 100644
--- a/arch/arm/boot/dts/atlas6.dtsi
+++ b/arch/arm/boot/dts/atlas6.dtsi
@@ -203,6 +203,7 @@
203 compatible = "sirf,prima2-tick"; 203 compatible = "sirf,prima2-tick";
204 reg = <0xb0020000 0x1000>; 204 reg = <0xb0020000 0x1000>;
205 interrupts = <0>; 205 interrupts = <0>;
206 clocks = <&clks 11>;
206 }; 207 };
207 208
208 nand@b0030000 { 209 nand@b0030000 {
diff --git a/arch/arm/boot/dts/axm5516-amarillo.dts b/arch/arm/boot/dts/axm5516-amarillo.dts
new file mode 100644
index 000000000000..a9d60471d9ff
--- /dev/null
+++ b/arch/arm/boot/dts/axm5516-amarillo.dts
@@ -0,0 +1,51 @@
1/*
2 * arch/arm/boot/dts/axm5516-amarillo.dts
3 *
4 * Copyright (C) 2013 LSI
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12/dts-v1/;
13
14/memreserve/ 0x00000000 0x00400000;
15
16#include "axm55xx.dtsi"
17#include "axm5516-cpus.dtsi"
18
19/ {
20 model = "Amarillo AXM5516";
21 compatible = "lsi,axm5516-amarillo", "lsi,axm5516";
22
23 memory {
24 device_type = "memory";
25 reg = <0 0x00000000 0x02 0x00000000>;
26 };
27};
28
29&serial0 {
30 status = "okay";
31};
32
33&serial1 {
34 status = "okay";
35};
36
37&serial2 {
38 status = "okay";
39};
40
41&serial3 {
42 status = "okay";
43};
44
45&gpio0 {
46 status = "okay";
47};
48
49&gpio1 {
50 status = "okay";
51};
diff --git a/arch/arm/boot/dts/axm5516-cpus.dtsi b/arch/arm/boot/dts/axm5516-cpus.dtsi
new file mode 100644
index 000000000000..b85f360cb125
--- /dev/null
+++ b/arch/arm/boot/dts/axm5516-cpus.dtsi
@@ -0,0 +1,204 @@
1/*
2 * arch/arm/boot/dts/axm5516-cpus.dtsi
3 *
4 * Copyright (C) 2013 LSI
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12/ {
13 cpus {
14 #address-cells = <1>;
15 #size-cells = <0>;
16
17 cpu-map {
18 cluster0 {
19 core0 {
20 cpu = <&CPU0>;
21 };
22 core1 {
23 cpu = <&CPU1>;
24 };
25 core2 {
26 cpu = <&CPU2>;
27 };
28 core3 {
29 cpu = <&CPU3>;
30 };
31 };
32 cluster1 {
33 core0 {
34 cpu = <&CPU4>;
35 };
36 core1 {
37 cpu = <&CPU5>;
38 };
39 core2 {
40 cpu = <&CPU6>;
41 };
42 core3 {
43 cpu = <&CPU7>;
44 };
45 };
46 cluster2 {
47 core0 {
48 cpu = <&CPU8>;
49 };
50 core1 {
51 cpu = <&CPU9>;
52 };
53 core2 {
54 cpu = <&CPU10>;
55 };
56 core3 {
57 cpu = <&CPU11>;
58 };
59 };
60 cluster3 {
61 core0 {
62 cpu = <&CPU12>;
63 };
64 core1 {
65 cpu = <&CPU13>;
66 };
67 core2 {
68 cpu = <&CPU14>;
69 };
70 core3 {
71 cpu = <&CPU15>;
72 };
73 };
74 };
75
76 CPU0: cpu@0 {
77 device_type = "cpu";
78 compatible = "arm,cortex-a15";
79 reg = <0x00>;
80 clock-frequency= <1400000000>;
81 cpu-release-addr = <0>; // Fixed by the boot loader
82 };
83
84 CPU1: cpu@1 {
85 device_type = "cpu";
86 compatible = "arm,cortex-a15";
87 reg = <0x01>;
88 clock-frequency= <1400000000>;
89 cpu-release-addr = <0>; // Fixed by the boot loader
90 };
91
92 CPU2: cpu@2 {
93 device_type = "cpu";
94 compatible = "arm,cortex-a15";
95 reg = <0x02>;
96 clock-frequency= <1400000000>;
97 cpu-release-addr = <0>; // Fixed by the boot loader
98 };
99
100 CPU3: cpu@3 {
101 device_type = "cpu";
102 compatible = "arm,cortex-a15";
103 reg = <0x03>;
104 clock-frequency= <1400000000>;
105 cpu-release-addr = <0>; // Fixed by the boot loader
106 };
107
108 CPU4: cpu@100 {
109 device_type = "cpu";
110 compatible = "arm,cortex-a15";
111 reg = <0x100>;
112 clock-frequency= <1400000000>;
113 cpu-release-addr = <0>; // Fixed by the boot loader
114 };
115
116 CPU5: cpu@101 {
117 device_type = "cpu";
118 compatible = "arm,cortex-a15";
119 reg = <0x101>;
120 clock-frequency= <1400000000>;
121 cpu-release-addr = <0>; // Fixed by the boot loader
122 };
123
124 CPU6: cpu@102 {
125 device_type = "cpu";
126 compatible = "arm,cortex-a15";
127 reg = <0x102>;
128 clock-frequency= <1400000000>;
129 cpu-release-addr = <0>; // Fixed by the boot loader
130 };
131
132 CPU7: cpu@103 {
133 device_type = "cpu";
134 compatible = "arm,cortex-a15";
135 reg = <0x103>;
136 clock-frequency= <1400000000>;
137 cpu-release-addr = <0>; // Fixed by the boot loader
138 };
139
140 CPU8: cpu@200 {
141 device_type = "cpu";
142 compatible = "arm,cortex-a15";
143 reg = <0x200>;
144 clock-frequency= <1400000000>;
145 cpu-release-addr = <0>; // Fixed by the boot loader
146 };
147
148 CPU9: cpu@201 {
149 device_type = "cpu";
150 compatible = "arm,cortex-a15";
151 reg = <0x201>;
152 clock-frequency= <1400000000>;
153 cpu-release-addr = <0>; // Fixed by the boot loader
154 };
155
156 CPU10: cpu@202 {
157 device_type = "cpu";
158 compatible = "arm,cortex-a15";
159 reg = <0x202>;
160 clock-frequency= <1400000000>;
161 cpu-release-addr = <0>; // Fixed by the boot loader
162 };
163
164 CPU11: cpu@203 {
165 device_type = "cpu";
166 compatible = "arm,cortex-a15";
167 reg = <0x203>;
168 clock-frequency= <1400000000>;
169 cpu-release-addr = <0>; // Fixed by the boot loader
170 };
171
172 CPU12: cpu@300 {
173 device_type = "cpu";
174 compatible = "arm,cortex-a15";
175 reg = <0x300>;
176 clock-frequency= <1400000000>;
177 cpu-release-addr = <0>; // Fixed by the boot loader
178 };
179
180 CPU13: cpu@301 {
181 device_type = "cpu";
182 compatible = "arm,cortex-a15";
183 reg = <0x301>;
184 clock-frequency= <1400000000>;
185 cpu-release-addr = <0>; // Fixed by the boot loader
186 };
187
188 CPU14: cpu@302 {
189 device_type = "cpu";
190 compatible = "arm,cortex-a15";
191 reg = <0x302>;
192 clock-frequency= <1400000000>;
193 cpu-release-addr = <0>; // Fixed by the boot loader
194 };
195
196 CPU15: cpu@303 {
197 device_type = "cpu";
198 compatible = "arm,cortex-a15";
199 reg = <0x303>;
200 clock-frequency= <1400000000>;
201 cpu-release-addr = <0>; // Fixed by the boot loader
202 };
203 };
204};
diff --git a/arch/arm/boot/dts/axm55xx.dtsi b/arch/arm/boot/dts/axm55xx.dtsi
new file mode 100644
index 000000000000..ea288f0a1d39
--- /dev/null
+++ b/arch/arm/boot/dts/axm55xx.dtsi
@@ -0,0 +1,204 @@
1/*
2 * arch/arm/boot/dts/axm55xx.dtsi
3 *
4 * Copyright (C) 2013 LSI
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <dt-bindings/interrupt-controller/arm-gic.h>
13#include <dt-bindings/clock/lsi,axm5516-clks.h>
14
15#include "skeleton64.dtsi"
16
17/ {
18 interrupt-parent = <&gic>;
19
20 aliases {
21 serial0 = &serial0;
22 serial1 = &serial1;
23 serial2 = &serial2;
24 serial3 = &serial3;
25 timer = &timer0;
26 };
27
28 clocks {
29 compatible = "simple-bus";
30 #address-cells = <2>;
31 #size-cells = <2>;
32 ranges;
33
34 clk_ref0: clk_ref0 {
35 compatible = "fixed-clock";
36 #clock-cells = <0>;
37 clock-frequency = <125000000>;
38 };
39
40 clk_ref1: clk_ref1 {
41 compatible = "fixed-clock";
42 #clock-cells = <0>;
43 clock-frequency = <125000000>;
44 };
45
46 clk_ref2: clk_ref2 {
47 compatible = "fixed-clock";
48 #clock-cells = <0>;
49 clock-frequency = <125000000>;
50 };
51
52 clks: clock-controller@2010020000 {
53 compatible = "lsi,axm5516-clks";
54 #clock-cells = <1>;
55 reg = <0x20 0x10020000 0 0x20000>;
56 };
57 };
58
59 gic: interrupt-controller@2001001000 {
60 compatible = "arm,cortex-a15-gic";
61 #interrupt-cells = <3>;
62 #address-cells = <0>;
63 interrupt-controller;
64 reg = <0x20 0x01001000 0 0x1000>,
65 <0x20 0x01002000 0 0x1000>,
66 <0x20 0x01004000 0 0x2000>,
67 <0x20 0x01006000 0 0x2000>;
68 interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) |
69 IRQ_TYPE_LEVEL_HIGH)>;
70 };
71
72 timer {
73 compatible = "arm,armv7-timer";
74 interrupts =
75 <GIC_PPI 13
76 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
77 <GIC_PPI 14
78 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
79 <GIC_PPI 11
80 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
81 <GIC_PPI 10
82 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
83 };
84
85
86 pmu {
87 compatible = "arm,cortex-a15-pmu";
88 interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
89 };
90
91 soc {
92 compatible = "simple-bus";
93 device_type = "soc";
94 #address-cells = <2>;
95 #size-cells = <2>;
96 interrupt-parent = <&gic>;
97 ranges;
98
99 syscon: syscon@2010030000 {
100 compatible = "lsi,axxia-syscon", "syscon";
101 reg = <0x20 0x10030000 0 0x2000>;
102 };
103
104 reset: reset@2010031000 {
105 compatible = "lsi,axm55xx-reset";
106 syscon = <&syscon>;
107 };
108
109 amba {
110 compatible = "arm,amba-bus";
111 #address-cells = <2>;
112 #size-cells = <2>;
113 ranges;
114
115 serial0: uart@2010080000 {
116 compatible = "arm,pl011", "arm,primecell";
117 reg = <0x20 0x10080000 0 0x1000>;
118 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
119 clocks = <&clks AXXIA_CLK_PER>;
120 clock-names = "apb_pclk";
121 status = "disabled";
122 };
123
124 serial1: uart@2010081000 {
125 compatible = "arm,pl011", "arm,primecell";
126 reg = <0x20 0x10081000 0 0x1000>;
127 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
128 clocks = <&clks AXXIA_CLK_PER>;
129 clock-names = "apb_pclk";
130 status = "disabled";
131 };
132
133 serial2: uart@2010082000 {
134 compatible = "arm,pl011", "arm,primecell";
135 reg = <0x20 0x10082000 0 0x1000>;
136 interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
137 clocks = <&clks AXXIA_CLK_PER>;
138 clock-names = "apb_pclk";
139 status = "disabled";
140 };
141
142 serial3: uart@2010083000 {
143 compatible = "arm,pl011", "arm,primecell";
144 reg = <0x20 0x10083000 0 0x1000>;
145 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
146 clocks = <&clks AXXIA_CLK_PER>;
147 clock-names = "apb_pclk";
148 status = "disabled";
149 };
150
151 timer0: timer@2010091000 {
152 compatible = "arm,sp804", "arm,primecell";
153 reg = <0x20 0x10091000 0 0x1000>;
154 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>,
155 <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>,
156 <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>,
157 <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>,
158 <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>,
159 <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>,
160 <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>,
161 <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>,
162 <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
163 clocks = <&clks AXXIA_CLK_PER>;
164 clock-names = "apb_pclk";
165 status = "okay";
166 };
167
168 gpio0: gpio@2010092000 {
169 #gpio-cells = <2>;
170 compatible = "arm,pl061", "arm,primecell";
171 gpio-controller;
172 reg = <0x20 0x10092000 0x00 0x1000>;
173 interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
174 <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
175 <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
176 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
177 <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
178 <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
179 <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>,
180 <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
181 clocks = <&clks AXXIA_CLK_PER>;
182 clock-names = "apb_pclk";
183 status = "disabled";
184 };
185
186 gpio1: gpio@2010093000 {
187 #gpio-cells = <2>;
188 compatible = "arm,pl061", "arm,primecell";
189 gpio-controller;
190 reg = <0x20 0x10093000 0x00 0x1000>;
191 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
192 clocks = <&clks AXXIA_CLK_PER>;
193 clock-names = "apb_pclk";
194 status = "disabled";
195 };
196 };
197 };
198};
199
200/*
201 Local Variables:
202 mode: C
203 End:
204*/
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index a8a0ceec6775..c29945e07c5a 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -72,13 +72,13 @@
72 * hierarchy. 72 * hierarchy.
73 */ 73 */
74 ocp { 74 ocp {
75 compatible = "ti,omap4-l3-noc", "simple-bus"; 75 compatible = "ti,dra7-l3-noc", "simple-bus";
76 #address-cells = <1>; 76 #address-cells = <1>;
77 #size-cells = <1>; 77 #size-cells = <1>;
78 ranges; 78 ranges;
79 ti,hwmods = "l3_main_1", "l3_main_2"; 79 ti,hwmods = "l3_main_1", "l3_main_2";
80 reg = <0x44000000 0x2000>, 80 reg = <0x44000000 0x1000000>,
81 <0x44800000 0x3000>; 81 <0x45000000 0x1000>;
82 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, 82 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
83 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; 83 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
84 84
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 106a7057bcaf..77878447b312 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -564,7 +564,7 @@
564 status = "okay"; 564 status = "okay";
565 565
566 ak8975@0c { 566 ak8975@0c {
567 compatible = "ak,ak8975"; 567 compatible = "asahi-kasei,ak8975";
568 reg = <0x0c>; 568 reg = <0x0c>;
569 gpios = <&gpj0 7 0>; 569 gpios = <&gpj0 7 0>;
570 }; 570 };
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index 1f5afb39355f..d0de1f50d15b 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -108,6 +108,7 @@
108 regulator-name = "VDD_IOPERI_1.8V"; 108 regulator-name = "VDD_IOPERI_1.8V";
109 regulator-min-microvolt = <1800000>; 109 regulator-min-microvolt = <1800000>;
110 regulator-max-microvolt = <1800000>; 110 regulator-max-microvolt = <1800000>;
111 regulator-always-on;
111 op_mode = <1>; 112 op_mode = <1>;
112 }; 113 };
113 114
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index 3a89cfbd6a87..e38532271ef9 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -60,6 +60,7 @@
60 compatible = "arm,cortex-a15"; 60 compatible = "arm,cortex-a15";
61 reg = <0x0>; 61 reg = <0x0>;
62 clock-frequency = <1800000000>; 62 clock-frequency = <1800000000>;
63 cci-control-port = <&cci_control1>;
63 }; 64 };
64 65
65 cpu1: cpu@1 { 66 cpu1: cpu@1 {
@@ -67,6 +68,7 @@
67 compatible = "arm,cortex-a15"; 68 compatible = "arm,cortex-a15";
68 reg = <0x1>; 69 reg = <0x1>;
69 clock-frequency = <1800000000>; 70 clock-frequency = <1800000000>;
71 cci-control-port = <&cci_control1>;
70 }; 72 };
71 73
72 cpu2: cpu@2 { 74 cpu2: cpu@2 {
@@ -74,6 +76,7 @@
74 compatible = "arm,cortex-a15"; 76 compatible = "arm,cortex-a15";
75 reg = <0x2>; 77 reg = <0x2>;
76 clock-frequency = <1800000000>; 78 clock-frequency = <1800000000>;
79 cci-control-port = <&cci_control1>;
77 }; 80 };
78 81
79 cpu3: cpu@3 { 82 cpu3: cpu@3 {
@@ -81,6 +84,7 @@
81 compatible = "arm,cortex-a15"; 84 compatible = "arm,cortex-a15";
82 reg = <0x3>; 85 reg = <0x3>;
83 clock-frequency = <1800000000>; 86 clock-frequency = <1800000000>;
87 cci-control-port = <&cci_control1>;
84 }; 88 };
85 89
86 cpu4: cpu@100 { 90 cpu4: cpu@100 {
@@ -88,6 +92,7 @@
88 compatible = "arm,cortex-a7"; 92 compatible = "arm,cortex-a7";
89 reg = <0x100>; 93 reg = <0x100>;
90 clock-frequency = <1000000000>; 94 clock-frequency = <1000000000>;
95 cci-control-port = <&cci_control0>;
91 }; 96 };
92 97
93 cpu5: cpu@101 { 98 cpu5: cpu@101 {
@@ -95,6 +100,7 @@
95 compatible = "arm,cortex-a7"; 100 compatible = "arm,cortex-a7";
96 reg = <0x101>; 101 reg = <0x101>;
97 clock-frequency = <1000000000>; 102 clock-frequency = <1000000000>;
103 cci-control-port = <&cci_control0>;
98 }; 104 };
99 105
100 cpu6: cpu@102 { 106 cpu6: cpu@102 {
@@ -102,6 +108,7 @@
102 compatible = "arm,cortex-a7"; 108 compatible = "arm,cortex-a7";
103 reg = <0x102>; 109 reg = <0x102>;
104 clock-frequency = <1000000000>; 110 clock-frequency = <1000000000>;
111 cci-control-port = <&cci_control0>;
105 }; 112 };
106 113
107 cpu7: cpu@103 { 114 cpu7: cpu@103 {
@@ -109,6 +116,26 @@
109 compatible = "arm,cortex-a7"; 116 compatible = "arm,cortex-a7";
110 reg = <0x103>; 117 reg = <0x103>;
111 clock-frequency = <1000000000>; 118 clock-frequency = <1000000000>;
119 cci-control-port = <&cci_control0>;
120 };
121 };
122
123 cci@10d20000 {
124 compatible = "arm,cci-400";
125 #address-cells = <1>;
126 #size-cells = <1>;
127 reg = <0x10d20000 0x1000>;
128 ranges = <0x0 0x10d20000 0x6000>;
129
130 cci_control0: slave-if@4000 {
131 compatible = "arm,cci-400-ctrl-if";
132 interface-type = "ace";
133 reg = <0x4000 0x1000>;
134 };
135 cci_control1: slave-if@5000 {
136 compatible = "arm,cci-400-ctrl-if";
137 interface-type = "ace";
138 reg = <0x5000 0x1000>;
112 }; 139 };
113 }; 140 };
114 141
@@ -403,7 +430,7 @@
403 spi_0: spi@12d20000 { 430 spi_0: spi@12d20000 {
404 compatible = "samsung,exynos4210-spi"; 431 compatible = "samsung,exynos4210-spi";
405 reg = <0x12d20000 0x100>; 432 reg = <0x12d20000 0x100>;
406 interrupts = <0 66 0>; 433 interrupts = <0 68 0>;
407 dmas = <&pdma0 5 434 dmas = <&pdma0 5
408 &pdma0 4>; 435 &pdma0 4>;
409 dma-names = "tx", "rx"; 436 dma-names = "tx", "rx";
@@ -419,7 +446,7 @@
419 spi_1: spi@12d30000 { 446 spi_1: spi@12d30000 {
420 compatible = "samsung,exynos4210-spi"; 447 compatible = "samsung,exynos4210-spi";
421 reg = <0x12d30000 0x100>; 448 reg = <0x12d30000 0x100>;
422 interrupts = <0 67 0>; 449 interrupts = <0 69 0>;
423 dmas = <&pdma1 5 450 dmas = <&pdma1 5
424 &pdma1 4>; 451 &pdma1 4>;
425 dma-names = "tx", "rx"; 452 dma-names = "tx", "rx";
@@ -435,7 +462,7 @@
435 spi_2: spi@12d40000 { 462 spi_2: spi@12d40000 {
436 compatible = "samsung,exynos4210-spi"; 463 compatible = "samsung,exynos4210-spi";
437 reg = <0x12d40000 0x100>; 464 reg = <0x12d40000 0x100>;
438 interrupts = <0 68 0>; 465 interrupts = <0 70 0>;
439 dmas = <&pdma0 7 466 dmas = <&pdma0 7
440 &pdma0 6>; 467 &pdma0 6>;
441 dma-names = "tx", "rx"; 468 dma-names = "tx", "rx";
@@ -567,7 +594,7 @@
567 #size-cells = <0>; 594 #size-cells = <0>;
568 pinctrl-names = "default"; 595 pinctrl-names = "default";
569 pinctrl-0 = <&i2c4_hs_bus>; 596 pinctrl-0 = <&i2c4_hs_bus>;
570 clocks = <&clock CLK_I2C4>; 597 clocks = <&clock CLK_USI0>;
571 clock-names = "hsi2c"; 598 clock-names = "hsi2c";
572 status = "disabled"; 599 status = "disabled";
573 }; 600 };
@@ -580,7 +607,7 @@
580 #size-cells = <0>; 607 #size-cells = <0>;
581 pinctrl-names = "default"; 608 pinctrl-names = "default";
582 pinctrl-0 = <&i2c5_hs_bus>; 609 pinctrl-0 = <&i2c5_hs_bus>;
583 clocks = <&clock CLK_I2C5>; 610 clocks = <&clock CLK_USI1>;
584 clock-names = "hsi2c"; 611 clock-names = "hsi2c";
585 status = "disabled"; 612 status = "disabled";
586 }; 613 };
@@ -593,7 +620,7 @@
593 #size-cells = <0>; 620 #size-cells = <0>;
594 pinctrl-names = "default"; 621 pinctrl-names = "default";
595 pinctrl-0 = <&i2c6_hs_bus>; 622 pinctrl-0 = <&i2c6_hs_bus>;
596 clocks = <&clock CLK_I2C6>; 623 clocks = <&clock CLK_USI2>;
597 clock-names = "hsi2c"; 624 clock-names = "hsi2c";
598 status = "disabled"; 625 status = "disabled";
599 }; 626 };
@@ -606,7 +633,7 @@
606 #size-cells = <0>; 633 #size-cells = <0>;
607 pinctrl-names = "default"; 634 pinctrl-names = "default";
608 pinctrl-0 = <&i2c7_hs_bus>; 635 pinctrl-0 = <&i2c7_hs_bus>;
609 clocks = <&clock CLK_I2C7>; 636 clocks = <&clock CLK_USI3>;
610 clock-names = "hsi2c"; 637 clock-names = "hsi2c";
611 status = "disabled"; 638 status = "disabled";
612 }; 639 };
@@ -619,7 +646,7 @@
619 #size-cells = <0>; 646 #size-cells = <0>;
620 pinctrl-names = "default"; 647 pinctrl-names = "default";
621 pinctrl-0 = <&i2c8_hs_bus>; 648 pinctrl-0 = <&i2c8_hs_bus>;
622 clocks = <&clock CLK_I2C8>; 649 clocks = <&clock CLK_USI4>;
623 clock-names = "hsi2c"; 650 clock-names = "hsi2c";
624 status = "disabled"; 651 status = "disabled";
625 }; 652 };
@@ -632,7 +659,7 @@
632 #size-cells = <0>; 659 #size-cells = <0>;
633 pinctrl-names = "default"; 660 pinctrl-names = "default";
634 pinctrl-0 = <&i2c9_hs_bus>; 661 pinctrl-0 = <&i2c9_hs_bus>;
635 clocks = <&clock CLK_I2C9>; 662 clocks = <&clock CLK_USI5>;
636 clock-names = "hsi2c"; 663 clock-names = "hsi2c";
637 status = "disabled"; 664 status = "disabled";
638 }; 665 };
@@ -645,7 +672,7 @@
645 #size-cells = <0>; 672 #size-cells = <0>;
646 pinctrl-names = "default"; 673 pinctrl-names = "default";
647 pinctrl-0 = <&i2c10_hs_bus>; 674 pinctrl-0 = <&i2c10_hs_bus>;
648 clocks = <&clock CLK_I2C10>; 675 clocks = <&clock CLK_USI6>;
649 clock-names = "hsi2c"; 676 clock-names = "hsi2c";
650 status = "disabled"; 677 status = "disabled";
651 }; 678 };
diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dts
index 3f2400b8560b..3e3f17aa93a1 100644
--- a/arch/arm/boot/dts/imx53-mba53.dts
+++ b/arch/arm/boot/dts/imx53-mba53.dts
@@ -248,7 +248,7 @@
248&tve { 248&tve {
249 pinctrl-names = "default"; 249 pinctrl-names = "default";
250 pinctrl-0 = <&pinctrl_vga_sync_1>; 250 pinctrl-0 = <&pinctrl_vga_sync_1>;
251 i2c-ddc-bus = <&i2c3>; 251 ddc-i2c-bus = <&i2c3>;
252 fsl,tve-mode = "vga"; 252 fsl,tve-mode = "vga";
253 fsl,hsync-pin = <4>; 253 fsl,hsync-pin = <4>;
254 fsl,vsync-pin = <6>; 254 fsl,vsync-pin = <6>;
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 375e66fad578..6456a0084388 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -116,7 +116,7 @@
116 #address-cells = <1>; 116 #address-cells = <1>;
117 #size-cells = <0>; 117 #size-cells = <0>;
118 compatible = "fsl,imx53-ipu"; 118 compatible = "fsl,imx53-ipu";
119 reg = <0x18000000 0x080000000>; 119 reg = <0x18000000 0x08000000>;
120 interrupts = <11 10>; 120 interrupts = <11 10>;
121 clocks = <&clks IMX5_CLK_IPU_GATE>, 121 clocks = <&clks IMX5_CLK_IPU_GATE>,
122 <&clks IMX5_CLK_IPU_DI0_GATE>, 122 <&clks IMX5_CLK_IPU_DI0_GATE>,
diff --git a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
index 49f9295c7bac..8f76d28759a3 100644
--- a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
+++ b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
@@ -31,6 +31,16 @@
31 stdout-path = &uart0; 31 stdout-path = &uart0;
32 }; 32 };
33 33
34 mbus {
35 pcie-controller {
36 status = "okay";
37
38 pcie@1,0 {
39 status = "okay";
40 };
41 };
42 };
43
34 ocp@f1000000 { 44 ocp@f1000000 {
35 pin-controller@10000 { 45 pin-controller@10000 {
36 pmx_usb_led: pmx-usb-led { 46 pmx_usb_led: pmx-usb-led {
@@ -69,14 +79,6 @@
69 ehci@50000 { 79 ehci@50000 {
70 status = "okay"; 80 status = "okay";
71 }; 81 };
72
73 pcie-controller {
74 status = "okay";
75
76 pcie@1,0 {
77 status = "okay";
78 };
79 };
80 }; 82 };
81 83
82 gpio-leds { 84 gpio-leds {
diff --git a/arch/arm/boot/dts/kirkwood-nsa3x0-common.dtsi b/arch/arm/boot/dts/kirkwood-nsa3x0-common.dtsi
index 9cb083b72404..2075a2e828f1 100644
--- a/arch/arm/boot/dts/kirkwood-nsa3x0-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-nsa3x0-common.dtsi
@@ -4,6 +4,16 @@
4/ { 4/ {
5 model = "ZyXEL NSA310"; 5 model = "ZyXEL NSA310";
6 6
7 mbus {
8 pcie-controller {
9 status = "okay";
10
11 pcie@1,0 {
12 status = "okay";
13 };
14 };
15 };
16
7 ocp@f1000000 { 17 ocp@f1000000 {
8 pinctrl: pin-controller@10000 { 18 pinctrl: pin-controller@10000 {
9 19
@@ -51,14 +61,6 @@
51 status = "okay"; 61 status = "okay";
52 nr-ports = <2>; 62 nr-ports = <2>;
53 }; 63 };
54
55 pcie-controller {
56 status = "okay";
57
58 pcie@1,0 {
59 status = "okay";
60 };
61 };
62 }; 64 };
63 65
64 gpio_poweroff { 66 gpio_poweroff {
diff --git a/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi b/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
index f577b7df9a29..521c587acaee 100644
--- a/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
+++ b/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
@@ -24,11 +24,10 @@
24 compatible = "smsc,lan9221", "smsc,lan9115"; 24 compatible = "smsc,lan9221", "smsc,lan9115";
25 bank-width = <2>; 25 bank-width = <2>;
26 gpmc,mux-add-data; 26 gpmc,mux-add-data;
27 gpmc,cs-on-ns = <0>; 27 gpmc,cs-on-ns = <1>;
28 gpmc,cs-rd-off-ns = <186>; 28 gpmc,cs-rd-off-ns = <180>;
29 gpmc,cs-wr-off-ns = <186>; 29 gpmc,cs-wr-off-ns = <180>;
30 gpmc,adv-on-ns = <12>; 30 gpmc,adv-rd-off-ns = <18>;
31 gpmc,adv-rd-off-ns = <48>;
32 gpmc,adv-wr-off-ns = <48>; 31 gpmc,adv-wr-off-ns = <48>;
33 gpmc,oe-on-ns = <54>; 32 gpmc,oe-on-ns = <54>;
34 gpmc,oe-off-ns = <168>; 33 gpmc,oe-off-ns = <168>;
@@ -36,12 +35,10 @@
36 gpmc,we-off-ns = <168>; 35 gpmc,we-off-ns = <168>;
37 gpmc,rd-cycle-ns = <186>; 36 gpmc,rd-cycle-ns = <186>;
38 gpmc,wr-cycle-ns = <186>; 37 gpmc,wr-cycle-ns = <186>;
39 gpmc,access-ns = <114>; 38 gpmc,access-ns = <144>;
40 gpmc,page-burst-access-ns = <6>; 39 gpmc,page-burst-access-ns = <24>;
41 gpmc,bus-turnaround-ns = <12>; 40 gpmc,bus-turnaround-ns = <90>;
42 gpmc,cycle2cycle-delay-ns = <18>; 41 gpmc,cycle2cycle-delay-ns = <90>;
43 gpmc,wr-data-mux-bus-ns = <90>;
44 gpmc,wr-access-ns = <186>;
45 gpmc,cycle2cycle-samecsen; 42 gpmc,cycle2cycle-samecsen;
46 gpmc,cycle2cycle-diffcsen; 43 gpmc,cycle2cycle-diffcsen;
47 vddvario-supply = <&vddvario>; 44 vddvario-supply = <&vddvario>;
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi
index 22f35ea142c1..8f8c07da4ac1 100644
--- a/arch/arm/boot/dts/omap2.dtsi
+++ b/arch/arm/boot/dts/omap2.dtsi
@@ -71,13 +71,6 @@
71 interrupts = <58>; 71 interrupts = <58>;
72 }; 72 };
73 73
74 mailbox: mailbox@48094000 {
75 compatible = "ti,omap2-mailbox";
76 ti,hwmods = "mailbox";
77 reg = <0x48094000 0x200>;
78 interrupts = <26>;
79 };
80
81 intc: interrupt-controller@1 { 74 intc: interrupt-controller@1 {
82 compatible = "ti,omap2-intc"; 75 compatible = "ti,omap2-intc";
83 interrupt-controller; 76 interrupt-controller;
diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
index db0f1293579c..e83b0468080c 100644
--- a/arch/arm/boot/dts/omap2420.dtsi
+++ b/arch/arm/boot/dts/omap2420.dtsi
@@ -151,6 +151,14 @@
151 dma-names = "tx", "rx"; 151 dma-names = "tx", "rx";
152 }; 152 };
153 153
154 mailbox: mailbox@48094000 {
155 compatible = "ti,omap2-mailbox";
156 reg = <0x48094000 0x200>;
157 interrupts = <26>, <34>;
158 interrupt-names = "dsp", "iva";
159 ti,hwmods = "mailbox";
160 };
161
154 timer1: timer@48028000 { 162 timer1: timer@48028000 {
155 compatible = "ti,omap2420-timer"; 163 compatible = "ti,omap2420-timer";
156 reg = <0x48028000 0x400>; 164 reg = <0x48028000 0x400>;
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index 8ff8d15184ad..c4e8013801ee 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -242,6 +242,13 @@
242 dma-names = "tx", "rx"; 242 dma-names = "tx", "rx";
243 }; 243 };
244 244
245 mailbox: mailbox@48094000 {
246 compatible = "ti,omap2-mailbox";
247 reg = <0x48094000 0x200>;
248 interrupts = <26>;
249 ti,hwmods = "mailbox";
250 };
251
245 timer1: timer@49018000 { 252 timer1: timer@49018000 {
246 compatible = "ti,omap2420-timer"; 253 compatible = "ti,omap2420-timer";
247 reg = <0x49018000 0x400>; 254 reg = <0x49018000 0x400>;
diff --git a/arch/arm/boot/dts/omap3-cm-t3x30.dtsi b/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
index d00055809e31..25ba08331d88 100644
--- a/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
+++ b/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
@@ -10,18 +10,6 @@
10 cpu0-supply = <&vcc>; 10 cpu0-supply = <&vcc>;
11 }; 11 };
12 }; 12 };
13
14 vddvario: regulator-vddvario {
15 compatible = "regulator-fixed";
16 regulator-name = "vddvario";
17 regulator-always-on;
18 };
19
20 vdd33a: regulator-vdd33a {
21 compatible = "regulator-fixed";
22 regulator-name = "vdd33a";
23 regulator-always-on;
24 };
25}; 13};
26 14
27&omap3_pmx_core { 15&omap3_pmx_core {
@@ -35,58 +23,34 @@
35 23
36 hsusb0_pins: pinmux_hsusb0_pins { 24 hsusb0_pins: pinmux_hsusb0_pins {
37 pinctrl-single,pins = < 25 pinctrl-single,pins = <
38 OMAP3_CORE1_IOPAD(0x21a0, PIN_OUTPUT | MUX_MODE0) /* hsusb0_clk.hsusb0_clk */ 26 OMAP3_CORE1_IOPAD(0x21a2, PIN_OUTPUT | MUX_MODE0) /* hsusb0_clk.hsusb0_clk */
39 OMAP3_CORE1_IOPAD(0x21a2, PIN_OUTPUT | MUX_MODE0) /* hsusb0_stp.hsusb0_stp */ 27 OMAP3_CORE1_IOPAD(0x21a4, PIN_OUTPUT | MUX_MODE0) /* hsusb0_stp.hsusb0_stp */
40 OMAP3_CORE1_IOPAD(0x21a4, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_dir.hsusb0_dir */ 28 OMAP3_CORE1_IOPAD(0x21a6, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_dir.hsusb0_dir */
41 OMAP3_CORE1_IOPAD(0x21a6, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_nxt.hsusb0_nxt */ 29 OMAP3_CORE1_IOPAD(0x21a8, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_nxt.hsusb0_nxt */
42 OMAP3_CORE1_IOPAD(0x21a8, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data0.hsusb2_data0 */ 30 OMAP3_CORE1_IOPAD(0x21aa, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data0.hsusb2_data0 */
43 OMAP3_CORE1_IOPAD(0x21aa, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data1.hsusb0_data1 */ 31 OMAP3_CORE1_IOPAD(0x21ac, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data1.hsusb0_data1 */
44 OMAP3_CORE1_IOPAD(0x21ac, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data2.hsusb0_data2 */ 32 OMAP3_CORE1_IOPAD(0x21ae, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data2.hsusb0_data2 */
45 OMAP3_CORE1_IOPAD(0x21ae, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data3 */ 33 OMAP3_CORE1_IOPAD(0x21b0, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data3 */
46 OMAP3_CORE1_IOPAD(0x21b0, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data4 */ 34 OMAP3_CORE1_IOPAD(0x21b2, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data4 */
47 OMAP3_CORE1_IOPAD(0x21b2, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data5 */ 35 OMAP3_CORE1_IOPAD(0x21b4, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data5 */
48 OMAP3_CORE1_IOPAD(0x21b4, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data6 */ 36 OMAP3_CORE1_IOPAD(0x21b6, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data6 */
49 OMAP3_CORE1_IOPAD(0x21b6, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data7 */ 37 OMAP3_CORE1_IOPAD(0x21b8, PIN_INPUT_PULLDOWN | MUX_MODE0) /* hsusb0_data7.hsusb0_data7 */
50 >; 38 >;
51 }; 39 };
52}; 40};
53 41
42#include "omap-gpmc-smsc911x.dtsi"
43
54&gpmc { 44&gpmc {
55 ranges = <5 0 0x2c000000 0x01000000>; 45 ranges = <5 0 0x2c000000 0x01000000>;
56 46
57 smsc1: ethernet@5,0 { 47 smsc1: ethernet@gpmc {
58 compatible = "smsc,lan9221", "smsc,lan9115"; 48 compatible = "smsc,lan9221", "smsc,lan9115";
59 pinctrl-names = "default"; 49 pinctrl-names = "default";
60 pinctrl-0 = <&smsc1_pins>; 50 pinctrl-0 = <&smsc1_pins>;
61 interrupt-parent = <&gpio6>; 51 interrupt-parent = <&gpio6>;
62 interrupts = <3 IRQ_TYPE_LEVEL_LOW>; 52 interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
63 reg = <5 0 0xff>; 53 reg = <5 0 0xff>;
64 bank-width = <2>;
65 gpmc,mux-add-data;
66 gpmc,cs-on-ns = <0>;
67 gpmc,cs-rd-off-ns = <186>;
68 gpmc,cs-wr-off-ns = <186>;
69 gpmc,adv-on-ns = <12>;
70 gpmc,adv-rd-off-ns = <48>;
71 gpmc,adv-wr-off-ns = <48>;
72 gpmc,oe-on-ns = <54>;
73 gpmc,oe-off-ns = <168>;
74 gpmc,we-on-ns = <54>;
75 gpmc,we-off-ns = <168>;
76 gpmc,rd-cycle-ns = <186>;
77 gpmc,wr-cycle-ns = <186>;
78 gpmc,access-ns = <114>;
79 gpmc,page-burst-access-ns = <6>;
80 gpmc,bus-turnaround-ns = <12>;
81 gpmc,cycle2cycle-delay-ns = <18>;
82 gpmc,wr-data-mux-bus-ns = <90>;
83 gpmc,wr-access-ns = <186>;
84 gpmc,cycle2cycle-samecsen;
85 gpmc,cycle2cycle-diffcsen;
86 vddvario-supply = <&vddvario>;
87 vdd33a-supply = <&vdd33a>;
88 reg-io-width = <4>;
89 smsc,save-mac-address;
90 }; 54 };
91}; 55};
92 56
diff --git a/arch/arm/boot/dts/omap3-evm-37xx.dts b/arch/arm/boot/dts/omap3-evm-37xx.dts
index 4df68ad3736a..9cba94bed7ad 100644
--- a/arch/arm/boot/dts/omap3-evm-37xx.dts
+++ b/arch/arm/boot/dts/omap3-evm-37xx.dts
@@ -89,7 +89,16 @@
89 status = "disabled"; 89 status = "disabled";
90}; 90};
91 91
92&uart1 {
93 interrupts-extended = <&intc 72 &omap3_pmx_core OMAP3_UART1_RX>;
94};
95
96&uart2 {
97 interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>;
98};
99
92&uart3 { 100&uart3 {
101 interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
93 pinctrl-names = "default"; 102 pinctrl-names = "default";
94 pinctrl-0 = <&uart3_pins>; 103 pinctrl-0 = <&uart3_pins>;
95}; 104};
diff --git a/arch/arm/boot/dts/omap3-igep.dtsi b/arch/arm/boot/dts/omap3-igep.dtsi
index b97736d98a64..e2d163bf0619 100644
--- a/arch/arm/boot/dts/omap3-igep.dtsi
+++ b/arch/arm/boot/dts/omap3-igep.dtsi
@@ -107,7 +107,7 @@
107 >; 107 >;
108 }; 108 };
109 109
110 smsc911x_pins: pinmux_smsc911x_pins { 110 smsc9221_pins: pinmux_smsc9221_pins {
111 pinctrl-single,pins = < 111 pinctrl-single,pins = <
112 0x1a2 (PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */ 112 0x1a2 (PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */
113 >; 113 >;
diff --git a/arch/arm/boot/dts/omap3-igep0020.dts b/arch/arm/boot/dts/omap3-igep0020.dts
index 7abd64f6ae21..b22caaaf774b 100644
--- a/arch/arm/boot/dts/omap3-igep0020.dts
+++ b/arch/arm/boot/dts/omap3-igep0020.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "omap3-igep.dtsi" 12#include "omap3-igep.dtsi"
13#include "omap-gpmc-smsc911x.dtsi" 13#include "omap-gpmc-smsc9221.dtsi"
14 14
15/ { 15/ {
16 model = "IGEPv2 (TI OMAP AM/DM37x)"; 16 model = "IGEPv2 (TI OMAP AM/DM37x)";
@@ -248,7 +248,7 @@
248 248
249 ethernet@gpmc { 249 ethernet@gpmc {
250 pinctrl-names = "default"; 250 pinctrl-names = "default";
251 pinctrl-0 = <&smsc911x_pins>; 251 pinctrl-0 = <&smsc9221_pins>;
252 reg = <5 0 0xff>; 252 reg = <5 0 0xff>;
253 interrupt-parent = <&gpio6>; 253 interrupt-parent = <&gpio6>;
254 interrupts = <16 IRQ_TYPE_LEVEL_LOW>; 254 interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
diff --git a/arch/arm/boot/dts/omap3-ldp.dts b/arch/arm/boot/dts/omap3-ldp.dts
index 0abe986a4ecc..476ff158ddb3 100644
--- a/arch/arm/boot/dts/omap3-ldp.dts
+++ b/arch/arm/boot/dts/omap3-ldp.dts
@@ -234,6 +234,10 @@
234 }; 234 };
235}; 235};
236 236
237&uart3 {
238 interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
239};
240
237&usb_otg_hs { 241&usb_otg_hs {
238 pinctrl-names = "default"; 242 pinctrl-names = "default";
239 pinctrl-0 = <&musb_pins>; 243 pinctrl-0 = <&musb_pins>;
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index a289910ec362..059a8ff1e6ac 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -22,6 +22,17 @@
22 }; 22 };
23 }; 23 };
24 24
25 leds {
26 compatible = "gpio-leds";
27 heartbeat {
28 label = "debug::sleep";
29 gpios = <&gpio6 2 GPIO_ACTIVE_HIGH>; /* gpio162 */
30 linux,default-trigger = "default-on";
31 pinctrl-names = "default";
32 pinctrl-0 = <&debug_leds>;
33 };
34 };
35
25 memory { 36 memory {
26 device_type = "memory"; 37 device_type = "memory";
27 reg = <0x80000000 0x10000000>; /* 256 MB */ 38 reg = <0x80000000 0x10000000>; /* 256 MB */
@@ -144,6 +155,12 @@
144 >; 155 >;
145 }; 156 };
146 157
158 debug_leds: pinmux_debug_led_pins {
159 pinctrl-single,pins = <
160 OMAP3_CORE1_IOPAD(0x2198, PIN_OUTPUT | MUX_MODE4) /* mcbsp1_clkx.gpio_162 */
161 >;
162 };
163
147 mcspi4_pins: pinmux_mcspi4_pins { 164 mcspi4_pins: pinmux_mcspi4_pins {
148 pinctrl-single,pins = < 165 pinctrl-single,pins = <
149 0x15c (PIN_INPUT_PULLDOWN | MUX_MODE1) /* mcspi4_clk */ 166 0x15c (PIN_INPUT_PULLDOWN | MUX_MODE1) /* mcspi4_clk */
@@ -696,11 +713,13 @@
696}; 713};
697 714
698&uart2 { 715&uart2 {
716 interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>;
699 pinctrl-names = "default"; 717 pinctrl-names = "default";
700 pinctrl-0 = <&uart2_pins>; 718 pinctrl-0 = <&uart2_pins>;
701}; 719};
702 720
703&uart3 { 721&uart3 {
722 interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
704 pinctrl-names = "default"; 723 pinctrl-names = "default";
705 pinctrl-0 = <&uart3_pins>; 724 pinctrl-0 = <&uart3_pins>;
706}; 725};
diff --git a/arch/arm/boot/dts/omap3-sb-t35.dtsi b/arch/arm/boot/dts/omap3-sb-t35.dtsi
index 7909c51b05a5..d59e3de1441e 100644
--- a/arch/arm/boot/dts/omap3-sb-t35.dtsi
+++ b/arch/arm/boot/dts/omap3-sb-t35.dtsi
@@ -2,20 +2,6 @@
2 * Common support for CompuLab SB-T35 used on SBC-T3530, SBC-T3517 and SBC-T3730 2 * Common support for CompuLab SB-T35 used on SBC-T3530, SBC-T3517 and SBC-T3730
3 */ 3 */
4 4
5/ {
6 vddvario_sb_t35: regulator-vddvario-sb-t35 {
7 compatible = "regulator-fixed";
8 regulator-name = "vddvario";
9 regulator-always-on;
10 };
11
12 vdd33a_sb_t35: regulator-vdd33a-sb-t35 {
13 compatible = "regulator-fixed";
14 regulator-name = "vdd33a";
15 regulator-always-on;
16 };
17};
18
19&omap3_pmx_core { 5&omap3_pmx_core {
20 smsc2_pins: pinmux_smsc2_pins { 6 smsc2_pins: pinmux_smsc2_pins {
21 pinctrl-single,pins = < 7 pinctrl-single,pins = <
@@ -37,11 +23,10 @@
37 reg = <4 0 0xff>; 23 reg = <4 0 0xff>;
38 bank-width = <2>; 24 bank-width = <2>;
39 gpmc,mux-add-data; 25 gpmc,mux-add-data;
40 gpmc,cs-on-ns = <0>; 26 gpmc,cs-on-ns = <1>;
41 gpmc,cs-rd-off-ns = <186>; 27 gpmc,cs-rd-off-ns = <180>;
42 gpmc,cs-wr-off-ns = <186>; 28 gpmc,cs-wr-off-ns = <180>;
43 gpmc,adv-on-ns = <12>; 29 gpmc,adv-rd-off-ns = <18>;
44 gpmc,adv-rd-off-ns = <48>;
45 gpmc,adv-wr-off-ns = <48>; 30 gpmc,adv-wr-off-ns = <48>;
46 gpmc,oe-on-ns = <54>; 31 gpmc,oe-on-ns = <54>;
47 gpmc,oe-off-ns = <168>; 32 gpmc,oe-off-ns = <168>;
@@ -49,16 +34,14 @@
49 gpmc,we-off-ns = <168>; 34 gpmc,we-off-ns = <168>;
50 gpmc,rd-cycle-ns = <186>; 35 gpmc,rd-cycle-ns = <186>;
51 gpmc,wr-cycle-ns = <186>; 36 gpmc,wr-cycle-ns = <186>;
52 gpmc,access-ns = <114>; 37 gpmc,access-ns = <144>;
53 gpmc,page-burst-access-ns = <6>; 38 gpmc,page-burst-access-ns = <24>;
54 gpmc,bus-turnaround-ns = <12>; 39 gpmc,bus-turnaround-ns = <90>;
55 gpmc,cycle2cycle-delay-ns = <18>; 40 gpmc,cycle2cycle-delay-ns = <90>;
56 gpmc,wr-data-mux-bus-ns = <90>;
57 gpmc,wr-access-ns = <186>;
58 gpmc,cycle2cycle-samecsen; 41 gpmc,cycle2cycle-samecsen;
59 gpmc,cycle2cycle-diffcsen; 42 gpmc,cycle2cycle-diffcsen;
60 vddvario-supply = <&vddvario_sb_t35>; 43 vddvario-supply = <&vddvario>;
61 vdd33a-supply = <&vdd33a_sb_t35>; 44 vdd33a-supply = <&vdd33a>;
62 reg-io-width = <4>; 45 reg-io-width = <4>;
63 smsc,save-mac-address; 46 smsc,save-mac-address;
64 }; 47 };
diff --git a/arch/arm/boot/dts/omap3-sbc-t3517.dts b/arch/arm/boot/dts/omap3-sbc-t3517.dts
index 024c9c6c682d..42189b65d393 100644
--- a/arch/arm/boot/dts/omap3-sbc-t3517.dts
+++ b/arch/arm/boot/dts/omap3-sbc-t3517.dts
@@ -8,6 +8,19 @@
8/ { 8/ {
9 model = "CompuLab SBC-T3517 with CM-T3517"; 9 model = "CompuLab SBC-T3517 with CM-T3517";
10 compatible = "compulab,omap3-sbc-t3517", "compulab,omap3-cm-t3517", "ti,am3517", "ti,omap3"; 10 compatible = "compulab,omap3-sbc-t3517", "compulab,omap3-cm-t3517", "ti,am3517", "ti,omap3";
11
12 /* Only one GPMC smsc9220 on SBC-T3517, CM-T3517 uses am35x Ethernet */
13 vddvario: regulator-vddvario-sb-t35 {
14 compatible = "regulator-fixed";
15 regulator-name = "vddvario";
16 regulator-always-on;
17 };
18
19 vdd33a: regulator-vdd33a-sb-t35 {
20 compatible = "regulator-fixed";
21 regulator-name = "vdd33a";
22 regulator-always-on;
23 };
11}; 24};
12 25
13&omap3_pmx_core { 26&omap3_pmx_core {
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index b8cd2d78347b..b2891a9a6975 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -61,7 +61,7 @@
61 ti,hwmods = "mpu"; 61 ti,hwmods = "mpu";
62 }; 62 };
63 63
64 iva { 64 iva: iva {
65 compatible = "ti,iva2.2"; 65 compatible = "ti,iva2.2";
66 ti,hwmods = "iva"; 66 ti,hwmods = "iva";
67 67
@@ -267,7 +267,7 @@
267 uart1: serial@4806a000 { 267 uart1: serial@4806a000 {
268 compatible = "ti,omap3-uart"; 268 compatible = "ti,omap3-uart";
269 reg = <0x4806a000 0x2000>; 269 reg = <0x4806a000 0x2000>;
270 interrupts = <72>; 270 interrupts-extended = <&intc 72>;
271 dmas = <&sdma 49 &sdma 50>; 271 dmas = <&sdma 49 &sdma 50>;
272 dma-names = "tx", "rx"; 272 dma-names = "tx", "rx";
273 ti,hwmods = "uart1"; 273 ti,hwmods = "uart1";
@@ -277,7 +277,7 @@
277 uart2: serial@4806c000 { 277 uart2: serial@4806c000 {
278 compatible = "ti,omap3-uart"; 278 compatible = "ti,omap3-uart";
279 reg = <0x4806c000 0x400>; 279 reg = <0x4806c000 0x400>;
280 interrupts = <73>; 280 interrupts-extended = <&intc 73>;
281 dmas = <&sdma 51 &sdma 52>; 281 dmas = <&sdma 51 &sdma 52>;
282 dma-names = "tx", "rx"; 282 dma-names = "tx", "rx";
283 ti,hwmods = "uart2"; 283 ti,hwmods = "uart2";
@@ -287,7 +287,7 @@
287 uart3: serial@49020000 { 287 uart3: serial@49020000 {
288 compatible = "ti,omap3-uart"; 288 compatible = "ti,omap3-uart";
289 reg = <0x49020000 0x400>; 289 reg = <0x49020000 0x400>;
290 interrupts = <74>; 290 interrupts-extended = <&intc 74>;
291 dmas = <&sdma 53 &sdma 54>; 291 dmas = <&sdma 53 &sdma 54>;
292 dma-names = "tx", "rx"; 292 dma-names = "tx", "rx";
293 ti,hwmods = "uart3"; 293 ti,hwmods = "uart3";
diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi
index d2c45bfaaa2c..8cfa3c8a72b0 100644
--- a/arch/arm/boot/dts/omap4-panda-common.dtsi
+++ b/arch/arm/boot/dts/omap4-panda-common.dtsi
@@ -481,6 +481,21 @@
481 usb-supply = <&vusb>; 481 usb-supply = <&vusb>;
482}; 482};
483 483
484&uart2 {
485 interrupts-extended = <&gic GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH
486 &omap4_pmx_core OMAP4_UART2_RX>;
487};
488
489&uart3 {
490 interrupts-extended = <&gic GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH
491 &omap4_pmx_core OMAP4_UART3_RX>;
492};
493
494&uart4 {
495 interrupts-extended = <&gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH
496 &omap4_pmx_core OMAP4_UART4_RX>;
497};
498
484&usb_otg_hs { 499&usb_otg_hs {
485 interface-type = <1>; 500 interface-type = <1>;
486 mode = <3>; 501 mode = <3>;
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 48983c8d56c2..3e1da43068f6 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -570,16 +570,22 @@
570}; 570};
571 571
572&uart2 { 572&uart2 {
573 interrupts-extended = <&gic GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH
574 &omap4_pmx_core OMAP4_UART2_RX>;
573 pinctrl-names = "default"; 575 pinctrl-names = "default";
574 pinctrl-0 = <&uart2_pins>; 576 pinctrl-0 = <&uart2_pins>;
575}; 577};
576 578
577&uart3 { 579&uart3 {
580 interrupts-extended = <&gic GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH
581 &omap4_pmx_core OMAP4_UART3_RX>;
578 pinctrl-names = "default"; 582 pinctrl-names = "default";
579 pinctrl-0 = <&uart3_pins>; 583 pinctrl-0 = <&uart3_pins>;
580}; 584};
581 585
582&uart4 { 586&uart4 {
587 interrupts-extended = <&gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH
588 &omap4_pmx_core OMAP4_UART4_RX>;
583 pinctrl-names = "default"; 589 pinctrl-names = "default";
584 pinctrl-0 = <&uart4_pins>; 590 pinctrl-0 = <&uart4_pins>;
585}; 591};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 203131ebb581..43a587e097d4 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -312,7 +312,7 @@
312 uart2: serial@4806c000 { 312 uart2: serial@4806c000 {
313 compatible = "ti,omap4-uart"; 313 compatible = "ti,omap4-uart";
314 reg = <0x4806c000 0x100>; 314 reg = <0x4806c000 0x100>;
315 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; 315 interrupts-extended = <&gic GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
316 ti,hwmods = "uart2"; 316 ti,hwmods = "uart2";
317 clock-frequency = <48000000>; 317 clock-frequency = <48000000>;
318 }; 318 };
@@ -320,7 +320,7 @@
320 uart3: serial@48020000 { 320 uart3: serial@48020000 {
321 compatible = "ti,omap4-uart"; 321 compatible = "ti,omap4-uart";
322 reg = <0x48020000 0x100>; 322 reg = <0x48020000 0x100>;
323 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; 323 interrupts-extended = <&gic GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
324 ti,hwmods = "uart3"; 324 ti,hwmods = "uart3";
325 clock-frequency = <48000000>; 325 clock-frequency = <48000000>;
326 }; 326 };
@@ -328,7 +328,7 @@
328 uart4: serial@4806e000 { 328 uart4: serial@4806e000 {
329 compatible = "ti,omap4-uart"; 329 compatible = "ti,omap4-uart";
330 reg = <0x4806e000 0x100>; 330 reg = <0x4806e000 0x100>;
331 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; 331 interrupts-extended = <&gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
332 ti,hwmods = "uart4"; 332 ti,hwmods = "uart4";
333 clock-frequency = <48000000>; 333 clock-frequency = <48000000>;
334 }; 334 };
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index fc9299ed1074..e58be57984ab 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -636,6 +636,13 @@
636 status = "disabled"; 636 status = "disabled";
637 }; 637 };
638 638
639 mailbox: mailbox@4a0f4000 {
640 compatible = "ti,omap4-mailbox";
641 reg = <0x4a0f4000 0x200>;
642 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
643 ti,hwmods = "mailbox";
644 };
645
639 timer1: timer@4ae18000 { 646 timer1: timer@4ae18000 {
640 compatible = "ti,omap5430-timer"; 647 compatible = "ti,omap5430-timer";
641 reg = <0x4ae18000 0x80>; 648 reg = <0x4ae18000 0x80>;
diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi
index 65d7d151cdc7..3df7ba860282 100644
--- a/arch/arm/boot/dts/prima2.dtsi
+++ b/arch/arm/boot/dts/prima2.dtsi
@@ -201,6 +201,7 @@
201 compatible = "sirf,prima2-tick"; 201 compatible = "sirf,prima2-tick";
202 reg = <0xb0020000 0x1000>; 202 reg = <0xb0020000 0x1000>;
203 interrupts = <0>; 203 interrupts = <0>;
204 clocks = <&clks 11>;
204 }; 205 };
205 206
206 nand@b0030000 { 207 nand@b0030000 {
diff --git a/arch/arm/boot/dts/r7s72100-genmai-reference.dts b/arch/arm/boot/dts/r7s72100-genmai-reference.dts
deleted file mode 100644
index e664611a47c8..000000000000
--- a/arch/arm/boot/dts/r7s72100-genmai-reference.dts
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * Device Tree Source for the Genmai board
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/dts-v1/;
12#include "r7s72100.dtsi"
13
14/ {
15 model = "Genmai";
16 compatible = "renesas,genmai-reference", "renesas,r7s72100";
17
18 chosen {
19 bootargs = "console=ttySC2,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
20 };
21
22 memory {
23 device_type = "memory";
24 reg = <0x08000000 0x08000000>;
25 };
26
27 lbsc {
28 #address-cells = <1>;
29 #size-cells = <1>;
30 };
31};
32
33&i2c2 {
34 status = "okay";
35 clock-frequency = <400000>;
36
37 eeprom@50 {
38 compatible = "renesas,24c128";
39 reg = <0x50>;
40 pagesize = <64>;
41 };
42};
diff --git a/arch/arm/boot/dts/r7s72100-genmai.dts b/arch/arm/boot/dts/r7s72100-genmai.dts
index b1deaf7e2e06..56849b55e1c2 100644
--- a/arch/arm/boot/dts/r7s72100-genmai.dts
+++ b/arch/arm/boot/dts/r7s72100-genmai.dts
@@ -1,7 +1,8 @@
1/* 1/*
2 * Device Tree Source for the Genmai board 2 * Device Tree Source for the Genmai board
3 * 3 *
4 * Copyright (C) 2013 Renesas Solutions Corp. 4 * Copyright (C) 2013-14 Renesas Solutions Corp.
5 * Copyright (C) 2014 Wolfram Sang, Sang Engineering <wsa@sang-engineering.com>
5 * 6 *
6 * This file is licensed under the terms of the GNU General Public License 7 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any 8 * version 2. This program is licensed "as is" without any warranty of any
@@ -15,6 +16,10 @@
15 model = "Genmai"; 16 model = "Genmai";
16 compatible = "renesas,genmai", "renesas,r7s72100"; 17 compatible = "renesas,genmai", "renesas,r7s72100";
17 18
19 aliases {
20 serial2 = &scif2;
21 };
22
18 chosen { 23 chosen {
19 bootargs = "console=ttySC2,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp"; 24 bootargs = "console=ttySC2,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
20 }; 25 };
@@ -29,3 +34,26 @@
29 #size-cells = <1>; 34 #size-cells = <1>;
30 }; 35 };
31}; 36};
37
38&extal_clk {
39 clock-frequency = <13330000>;
40};
41
42&usb_x1_clk {
43 clock-frequency = <48000000>;
44};
45
46&i2c2 {
47 status = "okay";
48 clock-frequency = <400000>;
49
50 eeprom@50 {
51 compatible = "renesas,24c128";
52 reg = <0x50>;
53 pagesize = <64>;
54 };
55};
56
57&scif2 {
58 status = "okay";
59};
diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index ee700717a34b..f50fbc8f3bd9 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -1,13 +1,15 @@
1/* 1/*
2 * Device Tree Source for the r7s72100 SoC 2 * Device Tree Source for the r7s72100 SoC
3 * 3 *
4 * Copyright (C) 2013 Renesas Solutions Corp. 4 * Copyright (C) 2013-14 Renesas Solutions Corp.
5 * Copyright (C) 2014 Wolfram Sang, Sang Engineering <wsa@sang-engineering.com>
5 * 6 *
6 * This file is licensed under the terms of the GNU General Public License 7 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any 8 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied. 9 * kind, whether express or implied.
9 */ 10 */
10 11
12#include <dt-bindings/clock/r7s72100-clock.h>
11#include <dt-bindings/interrupt-controller/irq.h> 13#include <dt-bindings/interrupt-controller/irq.h>
12 14
13/ { 15/ {
@@ -28,6 +30,112 @@
28 spi4 = &spi4; 30 spi4 = &spi4;
29 }; 31 };
30 32
33 clocks {
34 ranges;
35 #address-cells = <1>;
36 #size-cells = <1>;
37
38 /* External clocks */
39 extal_clk: extal_clk {
40 #clock-cells = <0>;
41 compatible = "fixed-clock";
42 /* If clk present, value must be set by board */
43 clock-frequency = <0>;
44 clock-output-names = "extal";
45 };
46
47 usb_x1_clk: usb_x1_clk {
48 #clock-cells = <0>;
49 compatible = "fixed-clock";
50 /* If clk present, value must be set by board */
51 clock-frequency = <0>;
52 clock-output-names = "usb_x1";
53 };
54
55 /* Special CPG clocks */
56 cpg_clocks: cpg_clocks@fcfe0000 {
57 #clock-cells = <1>;
58 compatible = "renesas,r7s72100-cpg-clocks",
59 "renesas,rz-cpg-clocks";
60 reg = <0xfcfe0000 0x18>;
61 clocks = <&extal_clk>, <&usb_x1_clk>;
62 clock-output-names = "pll", "i", "g";
63 };
64
65 /* Fixed factor clocks */
66 b_clk: b_clk {
67 #clock-cells = <0>;
68 compatible = "fixed-factor-clock";
69 clocks = <&cpg_clocks R7S72100_CLK_PLL>;
70 clock-mult = <1>;
71 clock-div = <3>;
72 clock-output-names = "b";
73 };
74 p1_clk: p1_clk {
75 #clock-cells = <0>;
76 compatible = "fixed-factor-clock";
77 clocks = <&cpg_clocks R7S72100_CLK_PLL>;
78 clock-mult = <1>;
79 clock-div = <6>;
80 clock-output-names = "p1";
81 };
82 p0_clk: p0_clk {
83 #clock-cells = <0>;
84 compatible = "fixed-factor-clock";
85 clocks = <&cpg_clocks R7S72100_CLK_PLL>;
86 clock-mult = <1>;
87 clock-div = <12>;
88 clock-output-names = "p0";
89 };
90
91 /* MSTP clocks */
92 mstp3_clks: mstp3_clks@fcfe0420 {
93 #clock-cells = <1>;
94 compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks";
95 reg = <0xfcfe0420 4>;
96 clocks = <&p0_clk>;
97 clock-indices = <R7S72100_CLK_MTU2>;
98 clock-output-names = "mtu2";
99 };
100
101 mstp4_clks: mstp4_clks@fcfe0424 {
102 #clock-cells = <1>;
103 compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks";
104 reg = <0xfcfe0424 4>;
105 clocks = <&p1_clk>, <&p1_clk>, <&p1_clk>, <&p1_clk>,
106 <&p1_clk>, <&p1_clk>, <&p1_clk>, <&p1_clk>;
107 clock-indices = <
108 R7S72100_CLK_SCIF0 R7S72100_CLK_SCIF1 R7S72100_CLK_SCIF2 R7S72100_CLK_SCIF3
109 R7S72100_CLK_SCIF4 R7S72100_CLK_SCIF5 R7S72100_CLK_SCIF6 R7S72100_CLK_SCIF7
110 >;
111 clock-output-names = "scif0", "scif1", "scif2", "scif3", "scif4", "scif5", "scif6", "scif7";
112 };
113
114 mstp9_clks: mstp9_clks@fcfe0438 {
115 #clock-cells = <1>;
116 compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks";
117 reg = <0xfcfe0438 4>;
118 clocks = <&p0_clk>, <&p0_clk>, <&p0_clk>, <&p0_clk>;
119 clock-indices = <
120 R7S72100_CLK_I2C0 R7S72100_CLK_I2C1 R7S72100_CLK_I2C2 R7S72100_CLK_I2C3
121 >;
122 clock-output-names = "i2c0", "i2c1", "i2c2", "i2c3";
123 };
124
125 mstp10_clks: mstp10_clks@fcfe043c {
126 #clock-cells = <1>;
127 compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks";
128 reg = <0xfcfe043c 4>;
129 clocks = <&p1_clk>, <&p1_clk>, <&p1_clk>, <&p1_clk>,
130 <&p1_clk>;
131 clock-indices = <
132 R7S72100_CLK_SPI0 R7S72100_CLK_SPI1 R7S72100_CLK_SPI2 R7S72100_CLK_SPI3
133 R7S72100_CLK_SPI4
134 >;
135 clock-output-names = "spi0", "spi1", "spi2", "spi3", "spi4";
136 };
137 };
138
31 cpus { 139 cpus {
32 #address-cells = <1>; 140 #address-cells = <1>;
33 #size-cells = <0>; 141 #size-cells = <0>;
@@ -61,6 +169,7 @@
61 <0 162 IRQ_TYPE_LEVEL_HIGH>, 169 <0 162 IRQ_TYPE_LEVEL_HIGH>,
62 <0 163 IRQ_TYPE_LEVEL_HIGH>, 170 <0 163 IRQ_TYPE_LEVEL_HIGH>,
63 <0 164 IRQ_TYPE_LEVEL_HIGH>; 171 <0 164 IRQ_TYPE_LEVEL_HIGH>;
172 clocks = <&mstp9_clks R7S72100_CLK_I2C0>;
64 clock-frequency = <100000>; 173 clock-frequency = <100000>;
65 status = "disabled"; 174 status = "disabled";
66 }; 175 };
@@ -78,6 +187,7 @@
78 <0 170 IRQ_TYPE_LEVEL_HIGH>, 187 <0 170 IRQ_TYPE_LEVEL_HIGH>,
79 <0 171 IRQ_TYPE_LEVEL_HIGH>, 188 <0 171 IRQ_TYPE_LEVEL_HIGH>,
80 <0 172 IRQ_TYPE_LEVEL_HIGH>; 189 <0 172 IRQ_TYPE_LEVEL_HIGH>;
190 clocks = <&mstp9_clks R7S72100_CLK_I2C1>;
81 clock-frequency = <100000>; 191 clock-frequency = <100000>;
82 status = "disabled"; 192 status = "disabled";
83 }; 193 };
@@ -95,6 +205,7 @@
95 <0 178 IRQ_TYPE_LEVEL_HIGH>, 205 <0 178 IRQ_TYPE_LEVEL_HIGH>,
96 <0 179 IRQ_TYPE_LEVEL_HIGH>, 206 <0 179 IRQ_TYPE_LEVEL_HIGH>,
97 <0 180 IRQ_TYPE_LEVEL_HIGH>; 207 <0 180 IRQ_TYPE_LEVEL_HIGH>;
208 clocks = <&mstp9_clks R7S72100_CLK_I2C2>;
98 clock-frequency = <100000>; 209 clock-frequency = <100000>;
99 status = "disabled"; 210 status = "disabled";
100 }; 211 };
@@ -112,10 +223,107 @@
112 <0 186 IRQ_TYPE_LEVEL_HIGH>, 223 <0 186 IRQ_TYPE_LEVEL_HIGH>,
113 <0 187 IRQ_TYPE_LEVEL_HIGH>, 224 <0 187 IRQ_TYPE_LEVEL_HIGH>,
114 <0 188 IRQ_TYPE_LEVEL_HIGH>; 225 <0 188 IRQ_TYPE_LEVEL_HIGH>;
226 clocks = <&mstp9_clks R7S72100_CLK_I2C3>;
115 clock-frequency = <100000>; 227 clock-frequency = <100000>;
116 status = "disabled"; 228 status = "disabled";
117 }; 229 };
118 230
231 scif0: serial@e8007000 {
232 compatible = "renesas,scif-r7s72100", "renesas,scif";
233 reg = <0xe8007000 64>;
234 interrupts = <0 190 IRQ_TYPE_LEVEL_HIGH>,
235 <0 191 IRQ_TYPE_LEVEL_HIGH>,
236 <0 192 IRQ_TYPE_LEVEL_HIGH>,
237 <0 189 IRQ_TYPE_LEVEL_HIGH>;
238 clocks = <&mstp4_clks R7S72100_CLK_SCIF0>;
239 clock-names = "sci_ick";
240 status = "disabled";
241 };
242
243 scif1: serial@e8007800 {
244 compatible = "renesas,scif-r7s72100", "renesas,scif";
245 reg = <0xe8007800 64>;
246 interrupts = <0 194 IRQ_TYPE_LEVEL_HIGH>,
247 <0 195 IRQ_TYPE_LEVEL_HIGH>,
248 <0 196 IRQ_TYPE_LEVEL_HIGH>,
249 <0 193 IRQ_TYPE_LEVEL_HIGH>;
250 clocks = <&mstp4_clks R7S72100_CLK_SCIF1>;
251 clock-names = "sci_ick";
252 status = "disabled";
253 };
254
255 scif2: serial@e8008000 {
256 compatible = "renesas,scif-r7s72100", "renesas,scif";
257 reg = <0xe8008000 64>;
258 interrupts = <0 198 IRQ_TYPE_LEVEL_HIGH>,
259 <0 199 IRQ_TYPE_LEVEL_HIGH>,
260 <0 200 IRQ_TYPE_LEVEL_HIGH>,
261 <0 197 IRQ_TYPE_LEVEL_HIGH>;
262 clocks = <&mstp4_clks R7S72100_CLK_SCIF2>;
263 clock-names = "sci_ick";
264 status = "disabled";
265 };
266
267 scif3: serial@e8008800 {
268 compatible = "renesas,scif-r7s72100", "renesas,scif";
269 reg = <0xe8008800 64>;
270 interrupts = <0 202 IRQ_TYPE_LEVEL_HIGH>,
271 <0 203 IRQ_TYPE_LEVEL_HIGH>,
272 <0 204 IRQ_TYPE_LEVEL_HIGH>,
273 <0 201 IRQ_TYPE_LEVEL_HIGH>;
274 clocks = <&mstp4_clks R7S72100_CLK_SCIF3>;
275 clock-names = "sci_ick";
276 status = "disabled";
277 };
278
279 scif4: serial@e8009000 {
280 compatible = "renesas,scif-r7s72100", "renesas,scif";
281 reg = <0xe8009000 64>;
282 interrupts = <0 206 IRQ_TYPE_LEVEL_HIGH>,
283 <0 207 IRQ_TYPE_LEVEL_HIGH>,
284 <0 208 IRQ_TYPE_LEVEL_HIGH>,
285 <0 205 IRQ_TYPE_LEVEL_HIGH>;
286 clocks = <&mstp4_clks R7S72100_CLK_SCIF4>;
287 clock-names = "sci_ick";
288 status = "disabled";
289 };
290
291 scif5: serial@e8009800 {
292 compatible = "renesas,scif-r7s72100", "renesas,scif";
293 reg = <0xe8009800 64>;
294 interrupts = <0 210 IRQ_TYPE_LEVEL_HIGH>,
295 <0 211 IRQ_TYPE_LEVEL_HIGH>,
296 <0 212 IRQ_TYPE_LEVEL_HIGH>,
297 <0 209 IRQ_TYPE_LEVEL_HIGH>;
298 clocks = <&mstp4_clks R7S72100_CLK_SCIF5>;
299 clock-names = "sci_ick";
300 status = "disabled";
301 };
302
303 scif6: serial@e800a000 {
304 compatible = "renesas,scif-r7s72100", "renesas,scif";
305 reg = <0xe800a000 64>;
306 interrupts = <0 214 IRQ_TYPE_LEVEL_HIGH>,
307 <0 215 IRQ_TYPE_LEVEL_HIGH>,
308 <0 216 IRQ_TYPE_LEVEL_HIGH>,
309 <0 213 IRQ_TYPE_LEVEL_HIGH>;
310 clocks = <&mstp4_clks R7S72100_CLK_SCIF6>;
311 clock-names = "sci_ick";
312 status = "disabled";
313 };
314
315 scif7: serial@e800a800 {
316 compatible = "renesas,scif-r7s72100", "renesas,scif";
317 reg = <0xe800a800 64>;
318 interrupts = <0 218 IRQ_TYPE_LEVEL_HIGH>,
319 <0 219 IRQ_TYPE_LEVEL_HIGH>,
320 <0 220 IRQ_TYPE_LEVEL_HIGH>,
321 <0 217 IRQ_TYPE_LEVEL_HIGH>;
322 clocks = <&mstp4_clks R7S72100_CLK_SCIF7>;
323 clock-names = "sci_ick";
324 status = "disabled";
325 };
326
119 spi0: spi@e800c800 { 327 spi0: spi@e800c800 {
120 compatible = "renesas,rspi-r7s72100", "renesas,rspi-rz"; 328 compatible = "renesas,rspi-r7s72100", "renesas,rspi-rz";
121 reg = <0xe800c800 0x24>; 329 reg = <0xe800c800 0x24>;
@@ -123,6 +331,7 @@
123 <0 239 IRQ_TYPE_LEVEL_HIGH>, 331 <0 239 IRQ_TYPE_LEVEL_HIGH>,
124 <0 240 IRQ_TYPE_LEVEL_HIGH>; 332 <0 240 IRQ_TYPE_LEVEL_HIGH>;
125 interrupt-names = "error", "rx", "tx"; 333 interrupt-names = "error", "rx", "tx";
334 clocks = <&mstp10_clks R7S72100_CLK_SPI0>;
126 num-cs = <1>; 335 num-cs = <1>;
127 #address-cells = <1>; 336 #address-cells = <1>;
128 #size-cells = <0>; 337 #size-cells = <0>;
@@ -136,6 +345,7 @@
136 <0 242 IRQ_TYPE_LEVEL_HIGH>, 345 <0 242 IRQ_TYPE_LEVEL_HIGH>,
137 <0 243 IRQ_TYPE_LEVEL_HIGH>; 346 <0 243 IRQ_TYPE_LEVEL_HIGH>;
138 interrupt-names = "error", "rx", "tx"; 347 interrupt-names = "error", "rx", "tx";
348 clocks = <&mstp10_clks R7S72100_CLK_SPI1>;
139 num-cs = <1>; 349 num-cs = <1>;
140 #address-cells = <1>; 350 #address-cells = <1>;
141 #size-cells = <0>; 351 #size-cells = <0>;
@@ -149,6 +359,7 @@
149 <0 245 IRQ_TYPE_LEVEL_HIGH>, 359 <0 245 IRQ_TYPE_LEVEL_HIGH>,
150 <0 246 IRQ_TYPE_LEVEL_HIGH>; 360 <0 246 IRQ_TYPE_LEVEL_HIGH>;
151 interrupt-names = "error", "rx", "tx"; 361 interrupt-names = "error", "rx", "tx";
362 clocks = <&mstp10_clks R7S72100_CLK_SPI2>;
152 num-cs = <1>; 363 num-cs = <1>;
153 #address-cells = <1>; 364 #address-cells = <1>;
154 #size-cells = <0>; 365 #size-cells = <0>;
@@ -162,6 +373,7 @@
162 <0 248 IRQ_TYPE_LEVEL_HIGH>, 373 <0 248 IRQ_TYPE_LEVEL_HIGH>,
163 <0 249 IRQ_TYPE_LEVEL_HIGH>; 374 <0 249 IRQ_TYPE_LEVEL_HIGH>;
164 interrupt-names = "error", "rx", "tx"; 375 interrupt-names = "error", "rx", "tx";
376 clocks = <&mstp10_clks R7S72100_CLK_SPI3>;
165 num-cs = <1>; 377 num-cs = <1>;
166 #address-cells = <1>; 378 #address-cells = <1>;
167 #size-cells = <0>; 379 #size-cells = <0>;
@@ -175,6 +387,7 @@
175 <0 251 IRQ_TYPE_LEVEL_HIGH>, 387 <0 251 IRQ_TYPE_LEVEL_HIGH>,
176 <0 252 IRQ_TYPE_LEVEL_HIGH>; 388 <0 252 IRQ_TYPE_LEVEL_HIGH>;
177 interrupt-names = "error", "rx", "tx"; 389 interrupt-names = "error", "rx", "tx";
390 clocks = <&mstp10_clks R7S72100_CLK_SPI4>;
178 num-cs = <1>; 391 num-cs = <1>;
179 #address-cells = <1>; 392 #address-cells = <1>;
180 #size-cells = <0>; 393 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 636251b2afb3..55d29f4d2ed6 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -23,6 +23,7 @@
23 compatible = "arm,cortex-a9"; 23 compatible = "arm,cortex-a9";
24 device_type = "cpu"; 24 device_type = "cpu";
25 reg = <0x0>; 25 reg = <0x0>;
26 clock-frequency = <800000000>;
26 }; 27 };
27 }; 28 };
28 29
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 86d676f62942..dd2fe46073f2 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -18,6 +18,11 @@
18 model = "Lager"; 18 model = "Lager";
19 compatible = "renesas,lager", "renesas,r8a7790"; 19 compatible = "renesas,lager", "renesas,r8a7790";
20 20
21 aliases {
22 serial6 = &scif0;
23 serial7 = &scif1;
24 };
25
21 chosen { 26 chosen {
22 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp"; 27 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
23 }; 28 };
@@ -146,7 +151,7 @@
146}; 151};
147 152
148&pfc { 153&pfc {
149 pinctrl-0 = <&du_pins &scif0_pins &scif1_pins>; 154 pinctrl-0 = <&du_pins>;
150 pinctrl-names = "default"; 155 pinctrl-names = "default";
151 156
152 du_pins: du { 157 du_pins: du {
@@ -264,6 +269,20 @@
264 }; 269 };
265}; 270};
266 271
272&scif0 {
273 pinctrl-0 = <&scif0_pins>;
274 pinctrl-names = "default";
275
276 status = "okay";
277};
278
279&scif1 {
280 pinctrl-0 = <&scif1_pins>;
281 pinctrl-names = "default";
282
283 status = "okay";
284};
285
267&msiof1 { 286&msiof1 {
268 pinctrl-0 = <&msiof1_pins>; 287 pinctrl-0 = <&msiof1_pins>;
269 pinctrl-names = "default"; 288 pinctrl-names = "default";
@@ -277,7 +296,6 @@
277 spi-cpol; 296 spi-cpol;
278 spi-cpha; 297 spi-cpha;
279 }; 298 };
280
281}; 299};
282 300
283&sdhi0 { 301&sdhi0 {
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index e6130d6ff28e..7ff29601f962 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -728,7 +728,7 @@
728 renesas,clock-indices = < 728 renesas,clock-indices = <
729 R8A7790_CLK_TMU1 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2 729 R8A7790_CLK_TMU1 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2
730 R8A7790_CLK_CMT0 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1 730 R8A7790_CLK_CMT0 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1
731 R8A7790_CLK_VSP1_DU0 R8A7790_CLK_VSP1_RT R8A7790_CLK_VSP1_SY 731 R8A7790_CLK_VSP1_DU0 R8A7790_CLK_VSP1_R R8A7790_CLK_VSP1_S
732 >; 732 >;
733 clock-output-names = 733 clock-output-names =
734 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1", 734 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 0d69813def85..05d44f9b202f 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -19,6 +19,11 @@
19 model = "Koelsch"; 19 model = "Koelsch";
20 compatible = "renesas,koelsch", "renesas,r8a7791"; 20 compatible = "renesas,koelsch", "renesas,r8a7791";
21 21
22 aliases {
23 serial6 = &scif0;
24 serial7 = &scif1;
25 };
26
22 chosen { 27 chosen {
23 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp"; 28 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
24 }; 29 };
@@ -230,7 +235,7 @@
230}; 235};
231 236
232&pfc { 237&pfc {
233 pinctrl-0 = <&du_pins &scif0_pins &scif1_pins>; 238 pinctrl-0 = <&du_pins>;
234 pinctrl-names = "default"; 239 pinctrl-names = "default";
235 240
236 i2c2_pins: i2c2 { 241 i2c2_pins: i2c2 {
@@ -310,6 +315,20 @@
310 status = "okay"; 315 status = "okay";
311}; 316};
312 317
318&scif0 {
319 pinctrl-0 = <&scif0_pins>;
320 pinctrl-names = "default";
321
322 status = "okay";
323};
324
325&scif1 {
326 pinctrl-0 = <&scif1_pins>;
327 pinctrl-names = "default";
328
329 status = "okay";
330};
331
313&sdhi0 { 332&sdhi0 {
314 pinctrl-0 = <&sdhi0_pins>; 333 pinctrl-0 = <&sdhi0_pins>;
315 pinctrl-names = "default"; 334 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 5eea08fb3722..8d7ffaeff6e0 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -733,7 +733,7 @@
733 renesas,clock-indices = < 733 renesas,clock-indices = <
734 R8A7791_CLK_TMU1 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2 734 R8A7791_CLK_TMU1 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2
735 R8A7791_CLK_CMT0 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1 735 R8A7791_CLK_CMT0 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1
736 R8A7791_CLK_VSP1_DU0 R8A7791_CLK_VSP1_SY 736 R8A7791_CLK_VSP1_DU0 R8A7791_CLK_VSP1_S
737 >; 737 >;
738 clock-output-names = 738 clock-output-names =
739 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1", 739 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi
index 048c5de00551..4387cfd420ba 100644
--- a/arch/arm/boot/dts/rk3066a.dtsi
+++ b/arch/arm/boot/dts/rk3066a.dtsi
@@ -24,6 +24,7 @@
24 cpus { 24 cpus {
25 #address-cells = <1>; 25 #address-cells = <1>;
26 #size-cells = <0>; 26 #size-cells = <0>;
27 enable-method = "rockchip,rk3066-smp";
27 28
28 cpu@0 { 29 cpu@0 {
29 device_type = "cpu"; 30 device_type = "cpu";
diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index a494fb0cff64..238c996d4a7f 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -24,6 +24,7 @@
24 cpus { 24 cpus {
25 #address-cells = <1>; 25 #address-cells = <1>;
26 #size-cells = <0>; 26 #size-cells = <0>;
27 enable-method = "rockchip,rk3066-smp";
27 28
28 cpu@0 { 29 cpu@0 {
29 device_type = "cpu"; 30 device_type = "cpu";
diff --git a/arch/arm/boot/dts/s3c2416-smdk2416.dts b/arch/arm/boot/dts/s3c2416-smdk2416.dts
index 59594cf15998..ea92fd69529a 100644
--- a/arch/arm/boot/dts/s3c2416-smdk2416.dts
+++ b/arch/arm/boot/dts/s3c2416-smdk2416.dts
@@ -19,6 +19,19 @@
19 reg = <0x30000000 0x4000000>; 19 reg = <0x30000000 0x4000000>;
20 }; 20 };
21 21
22 clocks {
23 compatible = "simple-bus";
24 #address-cells = <1>;
25 #size-cells = <1>;
26
27 xti: xti {
28 compatible = "fixed-clock";
29 clock-frequency = <12000000>;
30 clock-output-names = "xti";
31 #clock-cells = <0>;
32 };
33 };
34
22 serial@50000000 { 35 serial@50000000 {
23 status = "okay"; 36 status = "okay";
24 pinctrl-names = "default"; 37 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/s3c2416.dtsi b/arch/arm/boot/dts/s3c2416.dtsi
index e6555bdd81b8..955e4a4f8c31 100644
--- a/arch/arm/boot/dts/s3c2416.dtsi
+++ b/arch/arm/boot/dts/s3c2416.dtsi
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <dt-bindings/clock/s3c2443.h>
11#include "s3c24xx.dtsi" 12#include "s3c24xx.dtsi"
12#include "s3c2416-pinctrl.dtsi" 13#include "s3c2416-pinctrl.dtsi"
13 14
@@ -28,26 +29,53 @@
28 compatible = "samsung,s3c2416-irq"; 29 compatible = "samsung,s3c2416-irq";
29 }; 30 };
30 31
32 clocks: clock-controller@0x4c000000 {
33 compatible = "samsung,s3c2416-clock";
34 reg = <0x4c000000 0x40>;
35 #clock-cells = <1>;
36 };
37
31 pinctrl@56000000 { 38 pinctrl@56000000 {
32 compatible = "samsung,s3c2416-pinctrl"; 39 compatible = "samsung,s3c2416-pinctrl";
33 }; 40 };
34 41
42 timer@51000000 {
43 clocks = <&clocks PCLK_PWM>;
44 clock-names = "timers";
45 };
46
35 serial@50000000 { 47 serial@50000000 {
36 compatible = "samsung,s3c2440-uart"; 48 compatible = "samsung,s3c2440-uart";
49 clock-names = "uart", "clk_uart_baud2",
50 "clk_uart_baud3";
51 clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
52 <&clocks SCLK_UART>;
37 }; 53 };
38 54
39 serial@50004000 { 55 serial@50004000 {
40 compatible = "samsung,s3c2440-uart"; 56 compatible = "samsung,s3c2440-uart";
57 clock-names = "uart", "clk_uart_baud2",
58 "clk_uart_baud3";
59 clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>,
60 <&clocks SCLK_UART>;
41 }; 61 };
42 62
43 serial@50008000 { 63 serial@50008000 {
44 compatible = "samsung,s3c2440-uart"; 64 compatible = "samsung,s3c2440-uart";
65 clock-names = "uart", "clk_uart_baud2",
66 "clk_uart_baud3";
67 clocks = <&clocks PCLK_UART2>, <&clocks PCLK_UART2>,
68 <&clocks SCLK_UART>;
45 }; 69 };
46 70
47 serial@5000C000 { 71 serial@5000C000 {
48 compatible = "samsung,s3c2440-uart"; 72 compatible = "samsung,s3c2440-uart";
49 reg = <0x5000C000 0x4000>; 73 reg = <0x5000C000 0x4000>;
50 interrupts = <1 18 24 4>, <1 18 25 4>; 74 interrupts = <1 18 24 4>, <1 18 25 4>;
75 clock-names = "uart", "clk_uart_baud2",
76 "clk_uart_baud3";
77 clocks = <&clocks PCLK_UART3>, <&clocks PCLK_UART3>,
78 <&clocks SCLK_UART>;
51 status = "disabled"; 79 status = "disabled";
52 }; 80 };
53 81
@@ -55,6 +83,10 @@
55 compatible = "samsung,s3c6410-sdhci"; 83 compatible = "samsung,s3c6410-sdhci";
56 reg = <0x4AC00000 0x100>; 84 reg = <0x4AC00000 0x100>;
57 interrupts = <0 0 21 3>; 85 interrupts = <0 0 21 3>;
86 clock-names = "hsmmc", "mmc_busclk.0",
87 "mmc_busclk.2";
88 clocks = <&clocks HCLK_HSMMC0>, <&clocks HCLK_HSMMC0>,
89 <&clocks MUX_HSMMC0>;
58 status = "disabled"; 90 status = "disabled";
59 }; 91 };
60 92
@@ -62,18 +94,28 @@
62 compatible = "samsung,s3c6410-sdhci"; 94 compatible = "samsung,s3c6410-sdhci";
63 reg = <0x4A800000 0x100>; 95 reg = <0x4A800000 0x100>;
64 interrupts = <0 0 20 3>; 96 interrupts = <0 0 20 3>;
97 clock-names = "hsmmc", "mmc_busclk.0",
98 "mmc_busclk.2";
99 clocks = <&clocks HCLK_HSMMC1>, <&clocks HCLK_HSMMC1>,
100 <&clocks MUX_HSMMC1>;
65 status = "disabled"; 101 status = "disabled";
66 }; 102 };
67 103
68 watchdog@53000000 { 104 watchdog@53000000 {
69 interrupts = <1 9 27 3>; 105 interrupts = <1 9 27 3>;
106 clocks = <&clocks PCLK_WDT>;
107 clock-names = "watchdog";
70 }; 108 };
71 109
72 rtc@57000000 { 110 rtc@57000000 {
73 compatible = "samsung,s3c2416-rtc"; 111 compatible = "samsung,s3c2416-rtc";
112 clocks = <&clocks PCLK_RTC>;
113 clock-names = "rtc";
74 }; 114 };
75 115
76 i2c@54000000 { 116 i2c@54000000 {
77 compatible = "samsung,s3c2440-i2c"; 117 compatible = "samsung,s3c2440-i2c";
118 clocks = <&clocks PCLK_I2C0>;
119 clock-names = "i2c";
78 }; 120 };
79}; 121};
diff --git a/arch/arm/boot/dts/ste-ccu8540.dts b/arch/arm/boot/dts/ste-ccu8540.dts
index 7f3baf51a3a9..32dd55e5f4e6 100644
--- a/arch/arm/boot/dts/ste-ccu8540.dts
+++ b/arch/arm/boot/dts/ste-ccu8540.dts
@@ -18,6 +18,7 @@
18 compatible = "st-ericsson,ccu8540", "st-ericsson,u8540"; 18 compatible = "st-ericsson,ccu8540", "st-ericsson,u8540";
19 19
20 memory@0 { 20 memory@0 {
21 device_type = "memory";
21 reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>; 22 reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
22 }; 23 };
23 24
diff --git a/arch/arm/boot/dts/ste-ccu9540.dts b/arch/arm/boot/dts/ste-ccu9540.dts
index 229508750890..651c56d400a4 100644
--- a/arch/arm/boot/dts/ste-ccu9540.dts
+++ b/arch/arm/boot/dts/ste-ccu9540.dts
@@ -38,8 +38,8 @@
38 arm,primecell-periphid = <0x10480180>; 38 arm,primecell-periphid = <0x10480180>;
39 max-frequency = <100000000>; 39 max-frequency = <100000000>;
40 bus-width = <4>; 40 bus-width = <4>;
41 mmc-cap-sd-highspeed; 41 cap-sd-highspeed;
42 mmc-cap-mmc-highspeed; 42 cap-mmc-highspeed;
43 vmmc-supply = <&ab8500_ldo_aux3_reg>; 43 vmmc-supply = <&ab8500_ldo_aux3_reg>;
44 44
45 cd-gpios = <&gpio7 6 0x4>; // 230 45 cd-gpios = <&gpio7 6 0x4>; // 230
@@ -63,7 +63,7 @@
63 arm,primecell-periphid = <0x10480180>; 63 arm,primecell-periphid = <0x10480180>;
64 max-frequency = <100000000>; 64 max-frequency = <100000000>;
65 bus-width = <8>; 65 bus-width = <8>;
66 mmc-cap-mmc-highspeed; 66 cap-mmc-highspeed;
67 vmmc-supply = <&ab8500_ldo_aux2_reg>; 67 vmmc-supply = <&ab8500_ldo_aux2_reg>;
68 68
69 status = "okay"; 69 status = "okay";
diff --git a/arch/arm/boot/dts/ste-href.dtsi b/arch/arm/boot/dts/ste-href.dtsi
index 6cb9b68e2188..bf8f0eddc2c0 100644
--- a/arch/arm/boot/dts/ste-href.dtsi
+++ b/arch/arm/boot/dts/ste-href.dtsi
@@ -116,8 +116,15 @@
116 arm,primecell-periphid = <0x10480180>; 116 arm,primecell-periphid = <0x10480180>;
117 max-frequency = <100000000>; 117 max-frequency = <100000000>;
118 bus-width = <4>; 118 bus-width = <4>;
119 mmc-cap-sd-highspeed; 119 cap-sd-highspeed;
120 mmc-cap-mmc-highspeed; 120 cap-mmc-highspeed;
121 sd-uhs-sdr12;
122 sd-uhs-sdr25;
123 full-pwr-cycle;
124 st,sig-dir-dat0;
125 st,sig-dir-dat2;
126 st,sig-dir-cmd;
127 st,sig-pin-fbclk;
121 vmmc-supply = <&ab8500_ldo_aux3_reg>; 128 vmmc-supply = <&ab8500_ldo_aux3_reg>;
122 vqmmc-supply = <&vmmci>; 129 vqmmc-supply = <&vmmci>;
123 pinctrl-names = "default", "sleep"; 130 pinctrl-names = "default", "sleep";
@@ -132,6 +139,7 @@
132 arm,primecell-periphid = <0x10480180>; 139 arm,primecell-periphid = <0x10480180>;
133 max-frequency = <100000000>; 140 max-frequency = <100000000>;
134 bus-width = <4>; 141 bus-width = <4>;
142 non-removable;
135 pinctrl-names = "default", "sleep"; 143 pinctrl-names = "default", "sleep";
136 pinctrl-0 = <&sdi1_default_mode>; 144 pinctrl-0 = <&sdi1_default_mode>;
137 pinctrl-1 = <&sdi1_sleep_mode>; 145 pinctrl-1 = <&sdi1_sleep_mode>;
@@ -144,7 +152,9 @@
144 arm,primecell-periphid = <0x10480180>; 152 arm,primecell-periphid = <0x10480180>;
145 max-frequency = <100000000>; 153 max-frequency = <100000000>;
146 bus-width = <8>; 154 bus-width = <8>;
147 mmc-cap-mmc-highspeed; 155 cap-mmc-highspeed;
156 non-removable;
157 vmmc-supply = <&db8500_vsmps2_reg>;
148 pinctrl-names = "default", "sleep"; 158 pinctrl-names = "default", "sleep";
149 pinctrl-0 = <&sdi2_default_mode>; 159 pinctrl-0 = <&sdi2_default_mode>;
150 pinctrl-1 = <&sdi2_sleep_mode>; 160 pinctrl-1 = <&sdi2_sleep_mode>;
@@ -157,7 +167,8 @@
157 arm,primecell-periphid = <0x10480180>; 167 arm,primecell-periphid = <0x10480180>;
158 max-frequency = <100000000>; 168 max-frequency = <100000000>;
159 bus-width = <8>; 169 bus-width = <8>;
160 mmc-cap-mmc-highspeed; 170 cap-mmc-highspeed;
171 non-removable;
161 vmmc-supply = <&ab8500_ldo_aux2_reg>; 172 vmmc-supply = <&ab8500_ldo_aux2_reg>;
162 pinctrl-names = "default", "sleep"; 173 pinctrl-names = "default", "sleep";
163 pinctrl-0 = <&sdi4_default_mode>; 174 pinctrl-0 = <&sdi4_default_mode>;
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
index 5acc0449676a..d316c955bd5f 100644
--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
@@ -840,8 +840,8 @@
840 interrupts = <22>; 840 interrupts = <22>;
841 max-frequency = <48000000>; 841 max-frequency = <48000000>;
842 bus-width = <4>; 842 bus-width = <4>;
843 mmc-cap-mmc-highspeed; 843 cap-mmc-highspeed;
844 mmc-cap-sd-highspeed; 844 cap-sd-highspeed;
845 cd-gpios = <&gpio3 15 0x1>; 845 cd-gpios = <&gpio3 15 0x1>;
846 cd-inverted; 846 cd-inverted;
847 pinctrl-names = "default"; 847 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index a2f632d0be2a..474ef83229cd 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -156,7 +156,7 @@
156 arm,primecell-periphid = <0x10480180>; 156 arm,primecell-periphid = <0x10480180>;
157 max-frequency = <100000000>; 157 max-frequency = <100000000>;
158 bus-width = <4>; 158 bus-width = <4>;
159 mmc-cap-mmc-highspeed; 159 cap-mmc-highspeed;
160 vmmc-supply = <&ab8500_ldo_aux3_reg>; 160 vmmc-supply = <&ab8500_ldo_aux3_reg>;
161 vqmmc-supply = <&vmmci>; 161 vqmmc-supply = <&vmmci>;
162 pinctrl-names = "default", "sleep"; 162 pinctrl-names = "default", "sleep";
@@ -195,7 +195,7 @@
195 arm,primecell-periphid = <0x10480180>; 195 arm,primecell-periphid = <0x10480180>;
196 max-frequency = <100000000>; 196 max-frequency = <100000000>;
197 bus-width = <8>; 197 bus-width = <8>;
198 mmc-cap-mmc-highspeed; 198 cap-mmc-highspeed;
199 vmmc-supply = <&ab8500_ldo_aux2_reg>; 199 vmmc-supply = <&ab8500_ldo_aux2_reg>;
200 pinctrl-names = "default", "sleep"; 200 pinctrl-names = "default", "sleep";
201 pinctrl-0 = <&sdi4_default_mode>; 201 pinctrl-0 = <&sdi4_default_mode>;
diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts
index 6fe688e9e4da..82a661677e97 100644
--- a/arch/arm/boot/dts/ste-u300.dts
+++ b/arch/arm/boot/dts/ste-u300.dts
@@ -442,8 +442,8 @@
442 clock-names = "apb_pclk", "mclk"; 442 clock-names = "apb_pclk", "mclk";
443 max-frequency = <24000000>; 443 max-frequency = <24000000>;
444 bus-width = <4>; // SD-card slot 444 bus-width = <4>; // SD-card slot
445 mmc-cap-mmc-highspeed; 445 cap-mmc-highspeed;
446 mmc-cap-sd-highspeed; 446 cap-sd-highspeed;
447 cd-gpios = <&gpio 12 0x4>; 447 cd-gpios = <&gpio 12 0x4>;
448 cd-inverted; 448 cd-inverted;
449 vmmc-supply = <&ab3100_ldo_g_reg>; 449 vmmc-supply = <&ab3100_ldo_g_reg>;
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 56df970ffe25..385933bac114 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -93,7 +93,7 @@
93 93
94 pll4: clk@01c20018 { 94 pll4: clk@01c20018 {
95 #clock-cells = <0>; 95 #clock-cells = <0>;
96 compatible = "allwinner,sun4i-a10-pll1-clk"; 96 compatible = "allwinner,sun7i-a20-pll4-clk";
97 reg = <0x01c20018 0x4>; 97 reg = <0x01c20018 0x4>;
98 clocks = <&osc24M>; 98 clocks = <&osc24M>;
99 clock-output-names = "pll4"; 99 clock-output-names = "pll4";
@@ -115,6 +115,14 @@
115 clock-output-names = "pll6_sata", "pll6_other", "pll6"; 115 clock-output-names = "pll6_sata", "pll6_other", "pll6";
116 }; 116 };
117 117
118 pll8: clk@01c20040 {
119 #clock-cells = <0>;
120 compatible = "allwinner,sun7i-a20-pll4-clk";
121 reg = <0x01c20040 0x4>;
122 clocks = <&osc24M>;
123 clock-output-names = "pll8";
124 };
125
118 cpu: cpu@01c20054 { 126 cpu: cpu@01c20054 {
119 #clock-cells = <0>; 127 #clock-cells = <0>;
120 compatible = "allwinner,sun4i-a10-cpu-clk"; 128 compatible = "allwinner,sun4i-a10-cpu-clk";
@@ -898,9 +906,9 @@
898 #size-cells = <0>; 906 #size-cells = <0>;
899 }; 907 };
900 908
901 i2c4: i2c@01c2bc00 { 909 i2c4: i2c@01c2c000 {
902 compatible = "allwinner,sun4i-i2c"; 910 compatible = "allwinner,sun4i-i2c";
903 reg = <0x01c2bc00 0x400>; 911 reg = <0x01c2c000 0x400>;
904 interrupts = <0 89 4>; 912 interrupts = <0 89 4>;
905 clocks = <&apb1_gates 15>; 913 clocks = <&apb1_gates 15>;
906 clock-frequency = <100000>; 914 clock-frequency = <100000>;
diff --git a/arch/arm/boot/dts/twl4030_omap3.dtsi b/arch/arm/boot/dts/twl4030_omap3.dtsi
index c353ef0a6ac7..3537ae5b2146 100644
--- a/arch/arm/boot/dts/twl4030_omap3.dtsi
+++ b/arch/arm/boot/dts/twl4030_omap3.dtsi
@@ -8,7 +8,7 @@
8 8
9&twl { 9&twl {
10 pinctrl-names = "default"; 10 pinctrl-names = "default";
11 pinctrl-0 = <&twl4030_pins>; 11 pinctrl-0 = <&twl4030_pins &twl4030_vpins>;
12}; 12};
13 13
14&omap3_pmx_core { 14&omap3_pmx_core {
@@ -23,3 +23,20 @@
23 >; 23 >;
24 }; 24 };
25}; 25};
26
27/*
28 * If your board is not using the I2C4 pins with twl4030, then don't include
29 * this file. For proper idle mode signaling with sys_clkreq and sys_off_mode
30 * pins we need to configure I2C4, or else use the legacy sys_nvmode1 and
31 * sys_nvmode2 signaling.
32 */
33&omap3_pmx_wkup {
34 twl4030_vpins: pinmux_twl4030_vpins {
35 pinctrl-single,pins = <
36 OMAP3_WKUP_IOPAD(0x2a00, PIN_INPUT | MUX_MODE0) /* i2c4_scl.i2c4_scl */
37 OMAP3_WKUP_IOPAD(0x2a02, PIN_INPUT | MUX_MODE0) /* i2c4_sda.i2c4_sda */
38 OMAP3_WKUP_IOPAD(0x2a06, PIN_OUTPUT | MUX_MODE0) /* sys_clkreq.sys_clkreq */
39 OMAP3_WKUP_IOPAD(0x2a18, PIN_OUTPUT | MUX_MODE0) /* sys_off_mode.sys_off_mode */
40 >;
41 };
42};
diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
index ac870fb3fa0d..756c986995a3 100644
--- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
@@ -74,8 +74,24 @@
74 v2m_sysreg: sysreg@010000 { 74 v2m_sysreg: sysreg@010000 {
75 compatible = "arm,vexpress-sysreg"; 75 compatible = "arm,vexpress-sysreg";
76 reg = <0x010000 0x1000>; 76 reg = <0x010000 0x1000>;
77 gpio-controller; 77
78 #gpio-cells = <2>; 78 v2m_led_gpios: sys_led@08 {
79 compatible = "arm,vexpress-sysreg,sys_led";
80 gpio-controller;
81 #gpio-cells = <2>;
82 };
83
84 v2m_mmc_gpios: sys_mci@48 {
85 compatible = "arm,vexpress-sysreg,sys_mci";
86 gpio-controller;
87 #gpio-cells = <2>;
88 };
89
90 v2m_flash_gpios: sys_flash@4c {
91 compatible = "arm,vexpress-sysreg,sys_flash";
92 gpio-controller;
93 #gpio-cells = <2>;
94 };
79 }; 95 };
80 96
81 v2m_sysctl: sysctl@020000 { 97 v2m_sysctl: sysctl@020000 {
@@ -113,8 +129,8 @@
113 compatible = "arm,pl180", "arm,primecell"; 129 compatible = "arm,pl180", "arm,primecell";
114 reg = <0x050000 0x1000>; 130 reg = <0x050000 0x1000>;
115 interrupts = <9 10>; 131 interrupts = <9 10>;
116 cd-gpios = <&v2m_sysreg 0 0>; 132 cd-gpios = <&v2m_mmc_gpios 0 0>;
117 wp-gpios = <&v2m_sysreg 1 0>; 133 wp-gpios = <&v2m_mmc_gpios 1 0>;
118 max-frequency = <12000000>; 134 max-frequency = <12000000>;
119 vmmc-supply = <&v2m_fixed_3v3>; 135 vmmc-supply = <&v2m_fixed_3v3>;
120 clocks = <&v2m_clk24mhz>, <&smbclk>; 136 clocks = <&v2m_clk24mhz>, <&smbclk>;
@@ -265,6 +281,58 @@
265 clock-output-names = "v2m:refclk32khz"; 281 clock-output-names = "v2m:refclk32khz";
266 }; 282 };
267 283
284 leds {
285 compatible = "gpio-leds";
286
287 user@1 {
288 label = "v2m:green:user1";
289 gpios = <&v2m_led_gpios 0 0>;
290 linux,default-trigger = "heartbeat";
291 };
292
293 user@2 {
294 label = "v2m:green:user2";
295 gpios = <&v2m_led_gpios 1 0>;
296 linux,default-trigger = "mmc0";
297 };
298
299 user@3 {
300 label = "v2m:green:user3";
301 gpios = <&v2m_led_gpios 2 0>;
302 linux,default-trigger = "cpu0";
303 };
304
305 user@4 {
306 label = "v2m:green:user4";
307 gpios = <&v2m_led_gpios 3 0>;
308 linux,default-trigger = "cpu1";
309 };
310
311 user@5 {
312 label = "v2m:green:user5";
313 gpios = <&v2m_led_gpios 4 0>;
314 linux,default-trigger = "cpu2";
315 };
316
317 user@6 {
318 label = "v2m:green:user6";
319 gpios = <&v2m_led_gpios 5 0>;
320 linux,default-trigger = "cpu3";
321 };
322
323 user@7 {
324 label = "v2m:green:user7";
325 gpios = <&v2m_led_gpios 6 0>;
326 linux,default-trigger = "cpu4";
327 };
328
329 user@8 {
330 label = "v2m:green:user8";
331 gpios = <&v2m_led_gpios 7 0>;
332 linux,default-trigger = "cpu5";
333 };
334 };
335
268 mcc { 336 mcc {
269 compatible = "arm,vexpress,config-bus"; 337 compatible = "arm,vexpress,config-bus";
270 arm,vexpress,config-bridge = <&v2m_sysreg>; 338 arm,vexpress,config-bridge = <&v2m_sysreg>;
diff --git a/arch/arm/boot/dts/vexpress-v2m.dtsi b/arch/arm/boot/dts/vexpress-v2m.dtsi
index f1420368355b..ba856d604fb7 100644
--- a/arch/arm/boot/dts/vexpress-v2m.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m.dtsi
@@ -73,8 +73,24 @@
73 v2m_sysreg: sysreg@00000 { 73 v2m_sysreg: sysreg@00000 {
74 compatible = "arm,vexpress-sysreg"; 74 compatible = "arm,vexpress-sysreg";
75 reg = <0x00000 0x1000>; 75 reg = <0x00000 0x1000>;
76 gpio-controller; 76
77 #gpio-cells = <2>; 77 v2m_led_gpios: sys_led@08 {
78 compatible = "arm,vexpress-sysreg,sys_led";
79 gpio-controller;
80 #gpio-cells = <2>;
81 };
82
83 v2m_mmc_gpios: sys_mci@48 {
84 compatible = "arm,vexpress-sysreg,sys_mci";
85 gpio-controller;
86 #gpio-cells = <2>;
87 };
88
89 v2m_flash_gpios: sys_flash@4c {
90 compatible = "arm,vexpress-sysreg,sys_flash";
91 gpio-controller;
92 #gpio-cells = <2>;
93 };
78 }; 94 };
79 95
80 v2m_sysctl: sysctl@01000 { 96 v2m_sysctl: sysctl@01000 {
@@ -112,8 +128,8 @@
112 compatible = "arm,pl180", "arm,primecell"; 128 compatible = "arm,pl180", "arm,primecell";
113 reg = <0x05000 0x1000>; 129 reg = <0x05000 0x1000>;
114 interrupts = <9 10>; 130 interrupts = <9 10>;
115 cd-gpios = <&v2m_sysreg 0 0>; 131 cd-gpios = <&v2m_mmc_gpios 0 0>;
116 wp-gpios = <&v2m_sysreg 1 0>; 132 wp-gpios = <&v2m_mmc_gpios 1 0>;
117 max-frequency = <12000000>; 133 max-frequency = <12000000>;
118 vmmc-supply = <&v2m_fixed_3v3>; 134 vmmc-supply = <&v2m_fixed_3v3>;
119 clocks = <&v2m_clk24mhz>, <&smbclk>; 135 clocks = <&v2m_clk24mhz>, <&smbclk>;
@@ -264,6 +280,58 @@
264 clock-output-names = "v2m:refclk32khz"; 280 clock-output-names = "v2m:refclk32khz";
265 }; 281 };
266 282
283 leds {
284 compatible = "gpio-leds";
285
286 user@1 {
287 label = "v2m:green:user1";
288 gpios = <&v2m_led_gpios 0 0>;
289 linux,default-trigger = "heartbeat";
290 };
291
292 user@2 {
293 label = "v2m:green:user2";
294 gpios = <&v2m_led_gpios 1 0>;
295 linux,default-trigger = "mmc0";
296 };
297
298 user@3 {
299 label = "v2m:green:user3";
300 gpios = <&v2m_led_gpios 2 0>;
301 linux,default-trigger = "cpu0";
302 };
303
304 user@4 {
305 label = "v2m:green:user4";
306 gpios = <&v2m_led_gpios 3 0>;
307 linux,default-trigger = "cpu1";
308 };
309
310 user@5 {
311 label = "v2m:green:user5";
312 gpios = <&v2m_led_gpios 4 0>;
313 linux,default-trigger = "cpu2";
314 };
315
316 user@6 {
317 label = "v2m:green:user6";
318 gpios = <&v2m_led_gpios 5 0>;
319 linux,default-trigger = "cpu3";
320 };
321
322 user@7 {
323 label = "v2m:green:user7";
324 gpios = <&v2m_led_gpios 6 0>;
325 linux,default-trigger = "cpu4";
326 };
327
328 user@8 {
329 label = "v2m:green:user8";
330 gpios = <&v2m_led_gpios 7 0>;
331 linux,default-trigger = "cpu5";
332 };
333 };
334
267 mcc { 335 mcc {
268 compatible = "arm,vexpress,config-bus"; 336 compatible = "arm,vexpress,config-bus";
269 arm,vexpress,config-bridge = <&v2m_sysreg>; 337 arm,vexpress,config-bridge = <&v2m_sysreg>;
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index 15f98cbcb75a..a25c262326dc 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -312,6 +312,7 @@
312 arm,vexpress-sysreg,func = <12 0>; 312 arm,vexpress-sysreg,func = <12 0>;
313 label = "A15 Pcore"; 313 label = "A15 Pcore";
314 }; 314 };
315
315 power@1 { 316 power@1 {
316 /* Total power for the three A7 cores */ 317 /* Total power for the three A7 cores */
317 compatible = "arm,vexpress-power"; 318 compatible = "arm,vexpress-power";
@@ -322,14 +323,14 @@
322 energy@0 { 323 energy@0 {
323 /* Total energy for the two A15 cores */ 324 /* Total energy for the two A15 cores */
324 compatible = "arm,vexpress-energy"; 325 compatible = "arm,vexpress-energy";
325 arm,vexpress-sysreg,func = <13 0>; 326 arm,vexpress-sysreg,func = <13 0>, <13 1>;
326 label = "A15 Jcore"; 327 label = "A15 Jcore";
327 }; 328 };
328 329
329 energy@2 { 330 energy@2 {
330 /* Total energy for the three A7 cores */ 331 /* Total energy for the three A7 cores */
331 compatible = "arm,vexpress-energy"; 332 compatible = "arm,vexpress-energy";
332 arm,vexpress-sysreg,func = <13 2>; 333 arm,vexpress-sysreg,func = <13 2>, <13 3>;
333 label = "A7 Jcore"; 334 label = "A7 Jcore";
334 }; 335 };
335 }; 336 };
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index d13cdc322e17..760bbc463c5b 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -186,6 +186,11 @@
186 }; 186 };
187 }; 187 };
188 188
189 devcfg: devcfg@f8007000 {
190 compatible = "xlnx,zynq-devcfg-1.0";
191 reg = <0xf8007000 0x100>;
192 } ;
193
189 global_timer: timer@f8f00200 { 194 global_timer: timer@f8f00200 {
190 compatible = "arm,cortex-a9-global-timer"; 195 compatible = "arm,cortex-a9-global-timer";
191 reg = <0xf8f00200 0x20>; 196 reg = <0xf8f00200 0x20>;
diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
index f01c0ee0c87e..490f3dced749 100644
--- a/arch/arm/common/bL_switcher.c
+++ b/arch/arm/common/bL_switcher.c
@@ -433,8 +433,12 @@ static void bL_switcher_restore_cpus(void)
433{ 433{
434 int i; 434 int i;
435 435
436 for_each_cpu(i, &bL_switcher_removed_logical_cpus) 436 for_each_cpu(i, &bL_switcher_removed_logical_cpus) {
437 cpu_up(i); 437 struct device *cpu_dev = get_cpu_device(i);
438 int ret = device_online(cpu_dev);
439 if (ret)
440 dev_err(cpu_dev, "switcher: unable to restore CPU\n");
441 }
438} 442}
439 443
440static int bL_switcher_halve_cpus(void) 444static int bL_switcher_halve_cpus(void)
@@ -521,7 +525,7 @@ static int bL_switcher_halve_cpus(void)
521 continue; 525 continue;
522 } 526 }
523 527
524 ret = cpu_down(i); 528 ret = device_offline(get_cpu_device(i));
525 if (ret) { 529 if (ret) {
526 bL_switcher_restore_cpus(); 530 bL_switcher_restore_cpus();
527 return ret; 531 return ret;
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 41bca32409fc..5339009b3c0c 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -1423,55 +1423,38 @@ EXPORT_SYMBOL(edma_clear_event);
1423 1423
1424#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DMADEVICES) 1424#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DMADEVICES)
1425 1425
1426static int edma_of_read_u32_to_s16_array(const struct device_node *np, 1426static int edma_xbar_event_map(struct device *dev, struct device_node *node,
1427 const char *propname, s16 *out_values, 1427 struct edma_soc_info *pdata, size_t sz)
1428 size_t sz)
1429{ 1428{
1430 int ret; 1429 const char pname[] = "ti,edma-xbar-event-map";
1431
1432 ret = of_property_read_u16_array(np, propname, out_values, sz);
1433 if (ret)
1434 return ret;
1435
1436 /* Terminate it */
1437 *out_values++ = -1;
1438 *out_values++ = -1;
1439
1440 return 0;
1441}
1442
1443static int edma_xbar_event_map(struct device *dev,
1444 struct device_node *node,
1445 struct edma_soc_info *pdata, int len)
1446{
1447 int ret, i;
1448 struct resource res; 1430 struct resource res;
1449 void __iomem *xbar; 1431 void __iomem *xbar;
1450 const s16 (*xbar_chans)[2]; 1432 s16 (*xbar_chans)[2];
1433 size_t nelm = sz / sizeof(s16);
1451 u32 shift, offset, mux; 1434 u32 shift, offset, mux;
1435 int ret, i;
1452 1436
1453 xbar_chans = devm_kzalloc(dev, 1437 xbar_chans = devm_kzalloc(dev, (nelm + 2) * sizeof(s16), GFP_KERNEL);
1454 len/sizeof(s16) + 2*sizeof(s16),
1455 GFP_KERNEL);
1456 if (!xbar_chans) 1438 if (!xbar_chans)
1457 return -ENOMEM; 1439 return -ENOMEM;
1458 1440
1459 ret = of_address_to_resource(node, 1, &res); 1441 ret = of_address_to_resource(node, 1, &res);
1460 if (ret) 1442 if (ret)
1461 return -EIO; 1443 return -ENOMEM;
1462 1444
1463 xbar = devm_ioremap(dev, res.start, resource_size(&res)); 1445 xbar = devm_ioremap(dev, res.start, resource_size(&res));
1464 if (!xbar) 1446 if (!xbar)
1465 return -ENOMEM; 1447 return -ENOMEM;
1466 1448
1467 ret = edma_of_read_u32_to_s16_array(node, 1449 ret = of_property_read_u16_array(node, pname, (u16 *)xbar_chans, nelm);
1468 "ti,edma-xbar-event-map",
1469 (s16 *)xbar_chans,
1470 len/sizeof(u32));
1471 if (ret) 1450 if (ret)
1472 return -EIO; 1451 return -EIO;
1473 1452
1474 for (i = 0; xbar_chans[i][0] != -1; i++) { 1453 /* Invalidate last entry for the other user of this mess */
1454 nelm >>= 1;
1455 xbar_chans[nelm][0] = xbar_chans[nelm][1] = -1;
1456
1457 for (i = 0; i < nelm; i++) {
1475 shift = (xbar_chans[i][1] & 0x03) << 3; 1458 shift = (xbar_chans[i][1] & 0x03) << 3;
1476 offset = xbar_chans[i][1] & 0xfffffffc; 1459 offset = xbar_chans[i][1] & 0xfffffffc;
1477 mux = readl(xbar + offset); 1460 mux = readl(xbar + offset);
@@ -1480,8 +1463,7 @@ static int edma_xbar_event_map(struct device *dev,
1480 writel(mux, (xbar + offset)); 1463 writel(mux, (xbar + offset));
1481 } 1464 }
1482 1465
1483 pdata->xbar_chans = xbar_chans; 1466 pdata->xbar_chans = (const s16 (*)[2]) xbar_chans;
1484
1485 return 0; 1467 return 0;
1486} 1468}
1487 1469
diff --git a/arch/arm/configs/axm55xx_defconfig b/arch/arm/configs/axm55xx_defconfig
new file mode 100644
index 000000000000..d3260d7d5af1
--- /dev/null
+++ b/arch/arm/configs/axm55xx_defconfig
@@ -0,0 +1,248 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_FHANDLE=y
4CONFIG_AUDIT=y
5CONFIG_HIGH_RES_TIMERS=y
6CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_BSD_PROCESS_ACCT_V3=y
8CONFIG_TASKSTATS=y
9CONFIG_TASK_DELAY_ACCT=y
10CONFIG_TASK_XACCT=y
11CONFIG_TASK_IO_ACCOUNTING=y
12CONFIG_IKCONFIG=y
13CONFIG_IKCONFIG_PROC=y
14CONFIG_LOG_BUF_SHIFT=16
15CONFIG_NAMESPACES=y
16# CONFIG_UTS_NS is not set
17# CONFIG_IPC_NS is not set
18# CONFIG_PID_NS is not set
19# CONFIG_NET_NS is not set
20CONFIG_SCHED_AUTOGROUP=y
21CONFIG_RELAY=y
22CONFIG_BLK_DEV_INITRD=y
23CONFIG_SYSCTL_SYSCALL=y
24CONFIG_EMBEDDED=y
25# CONFIG_COMPAT_BRK is not set
26CONFIG_PROFILING=y
27CONFIG_MODULES=y
28CONFIG_MODULE_UNLOAD=y
29# CONFIG_IOSCHED_DEADLINE is not set
30CONFIG_ARCH_AXXIA=y
31CONFIG_GPIO_PCA953X=y
32CONFIG_ARM_LPAE=y
33CONFIG_ARM_THUMBEE=y
34CONFIG_ARM_ERRATA_430973=y
35CONFIG_ARM_ERRATA_643719=y
36CONFIG_ARM_ERRATA_720789=y
37CONFIG_ARM_ERRATA_754322=y
38CONFIG_ARM_ERRATA_754327=y
39CONFIG_ARM_ERRATA_764369=y
40CONFIG_ARM_ERRATA_775420=y
41CONFIG_ARM_ERRATA_798181=y
42CONFIG_PCI=y
43CONFIG_PCI_MSI=y
44CONFIG_PCIE_AXXIA=y
45CONFIG_SMP=y
46CONFIG_NR_CPUS=16
47CONFIG_HOTPLUG_CPU=y
48CONFIG_PREEMPT=y
49CONFIG_AEABI=y
50CONFIG_OABI_COMPAT=y
51CONFIG_HIGHMEM=y
52CONFIG_KSM=y
53CONFIG_ZBOOT_ROM_TEXT=0x0
54CONFIG_ZBOOT_ROM_BSS=0x0
55CONFIG_ARM_APPENDED_DTB=y
56CONFIG_ARM_ATAG_DTB_COMPAT=y
57CONFIG_VFP=y
58CONFIG_NEON=y
59# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
60CONFIG_BINFMT_MISC=y
61# CONFIG_SUSPEND is not set
62CONFIG_NET=y
63CONFIG_PACKET=y
64CONFIG_UNIX=y
65CONFIG_XFRM_USER=y
66CONFIG_XFRM_SUB_POLICY=y
67CONFIG_XFRM_MIGRATE=y
68CONFIG_XFRM_STATISTICS=y
69CONFIG_NET_KEY=y
70CONFIG_INET=y
71CONFIG_IP_PNP=y
72CONFIG_IP_PNP_DHCP=y
73CONFIG_IP_PNP_BOOTP=y
74CONFIG_INET_AH=y
75CONFIG_INET_ESP=y
76CONFIG_INET_IPCOMP=y
77# CONFIG_INET_LRO is not set
78# CONFIG_IPV6 is not set
79CONFIG_NETWORK_PHY_TIMESTAMPING=y
80CONFIG_BRIDGE=y
81# CONFIG_WIRELESS is not set
82CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
83CONFIG_DEVTMPFS=y
84CONFIG_DEVTMPFS_MOUNT=y
85CONFIG_MTD=y
86CONFIG_MTD_CMDLINE_PARTS=y
87CONFIG_MTD_AFS_PARTS=y
88CONFIG_MTD_BLOCK=y
89CONFIG_MTD_CFI=y
90CONFIG_MTD_CFI_INTELEXT=y
91CONFIG_MTD_CFI_AMDSTD=y
92CONFIG_MTD_CFI_STAA=y
93CONFIG_MTD_PHYSMAP=y
94CONFIG_MTD_PHYSMAP_OF=y
95CONFIG_MTD_M25P80=y
96CONFIG_PROC_DEVICETREE=y
97CONFIG_BLK_DEV_LOOP=y
98CONFIG_BLK_DEV_RAM=y
99CONFIG_EEPROM_AT24=y
100CONFIG_EEPROM_AT25=y
101CONFIG_BLK_DEV_SD=y
102CONFIG_CHR_DEV_SG=y
103CONFIG_ATA=y
104CONFIG_PATA_PLATFORM=y
105CONFIG_PATA_OF_PLATFORM=y
106CONFIG_MD=y
107CONFIG_BLK_DEV_DM=y
108CONFIG_DM_UEVENT=y
109CONFIG_NETDEVICES=y
110CONFIG_TUN=y
111CONFIG_VETH=y
112CONFIG_VIRTIO_NET=y
113# CONFIG_NET_CADENCE is not set
114# CONFIG_NET_VENDOR_BROADCOM is not set
115# CONFIG_NET_VENDOR_CIRRUS is not set
116# CONFIG_NET_VENDOR_FARADAY is not set
117# CONFIG_NET_VENDOR_INTEL is not set
118# CONFIG_NET_VENDOR_MARVELL is not set
119# CONFIG_NET_VENDOR_MICREL is not set
120# CONFIG_NET_VENDOR_NATSEMI is not set
121# CONFIG_NET_VENDOR_SEEQ is not set
122# CONFIG_NET_VENDOR_SMSC is not set
123# CONFIG_NET_VENDOR_STMICRO is not set
124# CONFIG_NET_VENDOR_VIA is not set
125# CONFIG_NET_VENDOR_WIZNET is not set
126CONFIG_BROADCOM_PHY=y
127# CONFIG_WLAN is not set
128# CONFIG_MOUSE_PS2_ALPS is not set
129# CONFIG_MOUSE_PS2_LOGIPS2PP is not set
130# CONFIG_MOUSE_PS2_SYNAPTICS is not set
131# CONFIG_MOUSE_PS2_TRACKPOINT is not set
132# CONFIG_SERIO_SERPORT is not set
133CONFIG_SERIO_AMBAKMI=y
134CONFIG_LEGACY_PTY_COUNT=16
135CONFIG_SERIAL_AMBA_PL011=y
136CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
137CONFIG_VIRTIO_CONSOLE=y
138# CONFIG_HW_RANDOM is not set
139CONFIG_I2C=y
140CONFIG_I2C_CHARDEV=y
141CONFIG_I2C_MUX=y
142CONFIG_I2C_AXXIA=y
143CONFIG_SPI=y
144CONFIG_SPI_PL022=y
145CONFIG_DP83640_PHY=y
146CONFIG_GPIOLIB=y
147CONFIG_GPIO_SYSFS=y
148CONFIG_GPIO_PL061=y
149CONFIG_POWER_SUPPLY=y
150CONFIG_POWER_RESET=y
151CONFIG_POWER_RESET_AXXIA=y
152CONFIG_SENSORS_ADT7475=y
153CONFIG_SENSORS_JC42=y
154CONFIG_SENSORS_LM75=y
155CONFIG_PMBUS=y
156CONFIG_SENSORS_LTC2978=y
157CONFIG_WATCHDOG=y
158CONFIG_ARM_SP805_WATCHDOG=y
159CONFIG_FB=y
160CONFIG_FB_ARMCLCD=y
161CONFIG_FRAMEBUFFER_CONSOLE=y
162CONFIG_LOGO=y
163# CONFIG_LOGO_LINUX_MONO is not set
164# CONFIG_LOGO_LINUX_VGA16 is not set
165CONFIG_HID_A4TECH=y
166CONFIG_HID_APPLE=y
167CONFIG_HID_BELKIN=y
168CONFIG_HID_CHERRY=y
169CONFIG_HID_CHICONY=y
170CONFIG_HID_CYPRESS=y
171CONFIG_HID_DRAGONRISE=y
172CONFIG_HID_EZKEY=y
173CONFIG_HID_KYE=y
174CONFIG_HID_GYRATION=y
175CONFIG_HID_TWINHAN=y
176CONFIG_HID_KENSINGTON=y
177CONFIG_HID_LOGITECH=y
178CONFIG_HID_MICROSOFT=y
179CONFIG_HID_MONTEREY=y
180CONFIG_HID_NTRIG=y
181CONFIG_HID_ORTEK=y
182CONFIG_HID_PANTHERLORD=y
183CONFIG_HID_PETALYNX=y
184CONFIG_HID_SAMSUNG=y
185CONFIG_HID_SUNPLUS=y
186CONFIG_HID_GREENASIA=y
187CONFIG_HID_SMARTJOYPLUS=y
188CONFIG_HID_TOPSEED=y
189CONFIG_HID_THRUSTMASTER=y
190CONFIG_HID_ZEROPLUS=y
191CONFIG_USB=y
192CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
193CONFIG_USB_EHCI_HCD=y
194# CONFIG_USB_EHCI_TT_NEWSCHED is not set
195CONFIG_USB_EHCI_HCD_AXXIA=y
196CONFIG_USB_STORAGE=y
197CONFIG_MMC=y
198CONFIG_MMC_ARMMMCI=y
199CONFIG_DMADEVICES=y
200CONFIG_PL330_DMA=y
201CONFIG_VIRT_DRIVERS=y
202CONFIG_VIRTIO_MMIO=y
203CONFIG_MAILBOX=y
204CONFIG_PL320_MBOX=y
205# CONFIG_IOMMU_SUPPORT is not set
206CONFIG_EXT2_FS=y
207CONFIG_EXT3_FS=y
208# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
209CONFIG_EXT4_FS=y
210CONFIG_AUTOFS4_FS=y
211CONFIG_FUSE_FS=y
212CONFIG_CUSE=y
213CONFIG_FSCACHE=y
214CONFIG_FSCACHE_STATS=y
215CONFIG_FSCACHE_HISTOGRAM=y
216CONFIG_FSCACHE_DEBUG=y
217CONFIG_FSCACHE_OBJECT_LIST=y
218CONFIG_CACHEFILES=y
219CONFIG_CACHEFILES_HISTOGRAM=y
220CONFIG_ISO9660_FS=y
221CONFIG_UDF_FS=y
222CONFIG_MSDOS_FS=y
223CONFIG_VFAT_FS=y
224CONFIG_NTFS_FS=y
225CONFIG_TMPFS=y
226CONFIG_JFFS2_FS=y
227CONFIG_CRAMFS=y
228CONFIG_NFS_FS=y
229CONFIG_NFS_V4=y
230CONFIG_ROOT_NFS=y
231CONFIG_NFS_FSCACHE=y
232CONFIG_SUNRPC_DEBUG=y
233CONFIG_NLS_CODEPAGE_437=y
234CONFIG_NLS_ISO8859_1=y
235CONFIG_PRINTK_TIME=y
236CONFIG_DEBUG_INFO=y
237CONFIG_DEBUG_FS=y
238CONFIG_MAGIC_SYSRQ=y
239# CONFIG_SCHED_DEBUG is not set
240CONFIG_RCU_CPU_STALL_TIMEOUT=60
241# CONFIG_FTRACE is not set
242CONFIG_DEBUG_USER=y
243CONFIG_CRYPTO_GCM=y
244CONFIG_CRYPTO_XCBC=y
245CONFIG_CRYPTO_SHA256=y
246# CONFIG_CRYPTO_ANSI_CPRNG is not set
247CONFIG_VIRTUALIZATION=y
248CONFIG_KVM=y
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index 3df3f3a79ef4..9d13dae99125 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_defconfig
@@ -91,6 +91,7 @@ CONFIG_FB=y
91CONFIG_BACKLIGHT_LCD_SUPPORT=y 91CONFIG_BACKLIGHT_LCD_SUPPORT=y
92CONFIG_LCD_CLASS_DEVICE=y 92CONFIG_LCD_CLASS_DEVICE=y
93CONFIG_BACKLIGHT_CLASS_DEVICE=y 93CONFIG_BACKLIGHT_CLASS_DEVICE=y
94CONFIG_BACKLIGHT_PWM=y
94# CONFIG_USB_SUPPORT is not set 95# CONFIG_USB_SUPPORT is not set
95CONFIG_MMC=y 96CONFIG_MMC=y
96CONFIG_MMC_UNSAFE_RESUME=y 97CONFIG_MMC_UNSAFE_RESUME=y
@@ -104,6 +105,8 @@ CONFIG_LEDS_TRIGGERS=y
104CONFIG_LEDS_TRIGGER_TIMER=y 105CONFIG_LEDS_TRIGGER_TIMER=y
105CONFIG_LEDS_TRIGGER_HEARTBEAT=y 106CONFIG_LEDS_TRIGGER_HEARTBEAT=y
106CONFIG_LEDS_TRIGGER_DEFAULT_ON=y 107CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
108CONFIG_PWM=y
109CONFIG_PWM_BCM_KONA=y
107CONFIG_EXT4_FS=y 110CONFIG_EXT4_FS=y
108CONFIG_EXT4_FS_POSIX_ACL=y 111CONFIG_EXT4_FS_POSIX_ACL=y
109CONFIG_EXT4_FS_SECURITY=y 112CONFIG_EXT4_FS_SECURITY=y
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 2a282c051cfd..2f8ff65e3ef1 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -160,7 +160,6 @@ CONFIG_USB=m
160CONFIG_USB_DEVICEFS=y 160CONFIG_USB_DEVICEFS=y
161CONFIG_USB_MON=m 161CONFIG_USB_MON=m
162CONFIG_USB_MUSB_HDRC=m 162CONFIG_USB_MUSB_HDRC=m
163CONFIG_USB_MUSB_PERIPHERAL=y
164CONFIG_USB_GADGET_MUSB_HDRC=y 163CONFIG_USB_GADGET_MUSB_HDRC=y
165CONFIG_MUSB_PIO_ONLY=y 164CONFIG_MUSB_PIO_ONLY=y
166CONFIG_USB_STORAGE=m 165CONFIG_USB_STORAGE=m
diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig
index f15955144175..701677f9248c 100644
--- a/arch/arm/configs/dove_defconfig
+++ b/arch/arm/configs/dove_defconfig
@@ -37,7 +37,6 @@ CONFIG_DEVTMPFS=y
37CONFIG_DEVTMPFS_MOUNT=y 37CONFIG_DEVTMPFS_MOUNT=y
38CONFIG_MTD=y 38CONFIG_MTD=y
39CONFIG_MTD_CMDLINE_PARTS=y 39CONFIG_MTD_CMDLINE_PARTS=y
40CONFIG_MTD_CHAR=y
41CONFIG_MTD_BLOCK=y 40CONFIG_MTD_BLOCK=y
42CONFIG_MTD_CFI=y 41CONFIG_MTD_CFI=y
43CONFIG_MTD_JEDECPROBE=y 42CONFIG_MTD_JEDECPROBE=y
@@ -48,6 +47,7 @@ CONFIG_MTD_CFI_INTELEXT=y
48CONFIG_MTD_CFI_STAA=y 47CONFIG_MTD_CFI_STAA=y
49CONFIG_MTD_PHYSMAP=y 48CONFIG_MTD_PHYSMAP=y
50CONFIG_MTD_M25P80=y 49CONFIG_MTD_M25P80=y
50CONFIG_MTD_SPI_NOR=y
51CONFIG_BLK_DEV_LOOP=y 51CONFIG_BLK_DEV_LOOP=y
52CONFIG_BLK_DEV_RAM=y 52CONFIG_BLK_DEV_RAM=y
53CONFIG_BLK_DEV_RAM_COUNT=1 53CONFIG_BLK_DEV_RAM_COUNT=1
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index f1aeb7d72712..bada59d93b67 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -80,6 +80,7 @@ CONFIG_MTD_UBI=y
80CONFIG_EEPROM_AT24=y 80CONFIG_EEPROM_AT24=y
81CONFIG_EEPROM_AT25=y 81CONFIG_EEPROM_AT25=y
82CONFIG_ATA=y 82CONFIG_ATA=y
83CONFIG_BLK_DEV_SD=y
83CONFIG_PATA_IMX=y 84CONFIG_PATA_IMX=y
84CONFIG_NETDEVICES=y 85CONFIG_NETDEVICES=y
85CONFIG_CS89x0=y 86CONFIG_CS89x0=y
@@ -153,8 +154,12 @@ CONFIG_USB_HID=m
153CONFIG_USB=y 154CONFIG_USB=y
154CONFIG_USB_EHCI_HCD=y 155CONFIG_USB_EHCI_HCD=y
155CONFIG_USB_EHCI_MXC=y 156CONFIG_USB_EHCI_MXC=y
157CONFIG_USB_STORAGE=y
158CONFIG_USB_CHIPIDEA=y
159CONFIG_USB_CHIPIDEA_UDC=y
160CONFIG_USB_CHIPIDEA_HOST=y
161CONFIG_NOP_USB_XCEIV=y
156CONFIG_MMC=y 162CONFIG_MMC=y
157CONFIG_MMC_UNSAFE_RESUME=y
158CONFIG_MMC_SDHCI=y 163CONFIG_MMC_SDHCI=y
159CONFIG_MMC_SDHCI_PLTFM=y 164CONFIG_MMC_SDHCI_PLTFM=y
160CONFIG_MMC_SDHCI_ESDHC_IMX=y 165CONFIG_MMC_SDHCI_ESDHC_IMX=y
@@ -177,7 +182,6 @@ CONFIG_RTC_DRV_MXC=y
177CONFIG_DMADEVICES=y 182CONFIG_DMADEVICES=y
178CONFIG_IMX_SDMA=y 183CONFIG_IMX_SDMA=y
179CONFIG_IMX_DMA=y 184CONFIG_IMX_DMA=y
180CONFIG_COMMON_CLK_DEBUG=y
181# CONFIG_IOMMU_SUPPORT is not set 185# CONFIG_IOMMU_SUPPORT is not set
182CONFIG_EXT2_FS=y 186CONFIG_EXT2_FS=y
183CONFIG_EXT3_FS=y 187CONFIG_EXT3_FS=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 09e974392fa1..ef8815327e5b 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -1,4 +1,3 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_KERNEL_LZO=y 1CONFIG_KERNEL_LZO=y
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_NO_HZ=y 3CONFIG_NO_HZ=y
@@ -33,7 +32,6 @@ CONFIG_MACH_PCM043=y
33CONFIG_MACH_MX35_3DS=y 32CONFIG_MACH_MX35_3DS=y
34CONFIG_MACH_VPR200=y 33CONFIG_MACH_VPR200=y
35CONFIG_MACH_IMX51_DT=y 34CONFIG_MACH_IMX51_DT=y
36CONFIG_MACH_EUKREA_CPUIMX51SD=y
37CONFIG_SOC_IMX50=y 35CONFIG_SOC_IMX50=y
38CONFIG_SOC_IMX53=y 36CONFIG_SOC_IMX53=y
39CONFIG_SOC_IMX6Q=y 37CONFIG_SOC_IMX6Q=y
@@ -46,7 +44,11 @@ CONFIG_VMSPLIT_2G=y
46CONFIG_PREEMPT_VOLUNTARY=y 44CONFIG_PREEMPT_VOLUNTARY=y
47CONFIG_AEABI=y 45CONFIG_AEABI=y
48CONFIG_HIGHMEM=y 46CONFIG_HIGHMEM=y
47CONFIG_CMA=y
49CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" 48CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
49CONFIG_CPU_FREQ=y
50CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
51CONFIG_ARM_IMX6Q_CPUFREQ=y
50CONFIG_VFP=y 52CONFIG_VFP=y
51CONFIG_NEON=y 53CONFIG_NEON=y
52CONFIG_BINFMT_MISC=m 54CONFIG_BINFMT_MISC=m
@@ -72,6 +74,7 @@ CONFIG_RFKILL_INPUT=y
72CONFIG_DEVTMPFS=y 74CONFIG_DEVTMPFS=y
73CONFIG_DEVTMPFS_MOUNT=y 75CONFIG_DEVTMPFS_MOUNT=y
74# CONFIG_STANDALONE is not set 76# CONFIG_STANDALONE is not set
77CONFIG_DMA_CMA=y
75CONFIG_IMX_WEIM=y 78CONFIG_IMX_WEIM=y
76CONFIG_CONNECTOR=y 79CONFIG_CONNECTOR=y
77CONFIG_MTD=y 80CONFIG_MTD=y
@@ -89,6 +92,7 @@ CONFIG_MTD_SST25L=y
89CONFIG_MTD_NAND=y 92CONFIG_MTD_NAND=y
90CONFIG_MTD_NAND_GPMI_NAND=y 93CONFIG_MTD_NAND_GPMI_NAND=y
91CONFIG_MTD_NAND_MXC=y 94CONFIG_MTD_NAND_MXC=y
95CONFIG_MTD_SPI_NOR=y
92CONFIG_MTD_UBI=y 96CONFIG_MTD_UBI=y
93CONFIG_BLK_DEV_LOOP=y 97CONFIG_BLK_DEV_LOOP=y
94CONFIG_BLK_DEV_RAM=y 98CONFIG_BLK_DEV_RAM=y
@@ -183,6 +187,7 @@ CONFIG_V4L_MEM2MEM_DRIVERS=y
183CONFIG_VIDEO_CODA=y 187CONFIG_VIDEO_CODA=y
184CONFIG_SOC_CAMERA_OV2640=y 188CONFIG_SOC_CAMERA_OV2640=y
185CONFIG_DRM=y 189CONFIG_DRM=y
190CONFIG_DRM_PANEL_SIMPLE=y
186CONFIG_BACKLIGHT_LCD_SUPPORT=y 191CONFIG_BACKLIGHT_LCD_SUPPORT=y
187CONFIG_LCD_CLASS_DEVICE=y 192CONFIG_LCD_CLASS_DEVICE=y
188CONFIG_LCD_L4F00242T03=y 193CONFIG_LCD_L4F00242T03=y
@@ -215,7 +220,6 @@ CONFIG_USB_GADGET=y
215CONFIG_USB_ETH=m 220CONFIG_USB_ETH=m
216CONFIG_USB_MASS_STORAGE=m 221CONFIG_USB_MASS_STORAGE=m
217CONFIG_MMC=y 222CONFIG_MMC=y
218CONFIG_MMC_UNSAFE_RESUME=y
219CONFIG_MMC_SDHCI=y 223CONFIG_MMC_SDHCI=y
220CONFIG_MMC_SDHCI_PLTFM=y 224CONFIG_MMC_SDHCI_PLTFM=y
221CONFIG_MMC_SDHCI_ESDHC_IMX=y 225CONFIG_MMC_SDHCI_ESDHC_IMX=y
@@ -245,7 +249,7 @@ CONFIG_DRM_IMX_TVE=y
245CONFIG_DRM_IMX_LDB=y 249CONFIG_DRM_IMX_LDB=y
246CONFIG_DRM_IMX_IPUV3_CORE=y 250CONFIG_DRM_IMX_IPUV3_CORE=y
247CONFIG_DRM_IMX_IPUV3=y 251CONFIG_DRM_IMX_IPUV3=y
248CONFIG_COMMON_CLK_DEBUG=y 252CONFIG_DRM_IMX_HDMI=y
249# CONFIG_IOMMU_SUPPORT is not set 253# CONFIG_IOMMU_SUPPORT is not set
250CONFIG_PWM=y 254CONFIG_PWM=y
251CONFIG_PWM_IMX=y 255CONFIG_PWM_IMX=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 2e762d94e94b..b9e480c10b10 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -61,6 +61,7 @@ CONFIG_MTD_PHYSMAP=y
61CONFIG_MTD_M25P80=y 61CONFIG_MTD_M25P80=y
62CONFIG_MTD_NAND=y 62CONFIG_MTD_NAND=y
63CONFIG_MTD_NAND_ORION=y 63CONFIG_MTD_NAND_ORION=y
64CONFIG_MTD_SPI_NOR=y
64CONFIG_BLK_DEV_LOOP=y 65CONFIG_BLK_DEV_LOOP=y
65CONFIG_EEPROM_AT24=y 66CONFIG_EEPROM_AT24=y
66# CONFIG_SCSI_PROC_FS is not set 67# CONFIG_SCSI_PROC_FS is not set
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index c5858b9eb516..7f52dad97f51 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -17,21 +17,14 @@ CONFIG_MODULE_UNLOAD=y
17CONFIG_MODULE_FORCE_UNLOAD=y 17CONFIG_MODULE_FORCE_UNLOAD=y
18CONFIG_MODVERSIONS=y 18CONFIG_MODVERSIONS=y
19CONFIG_PARTITION_ADVANCED=y 19CONFIG_PARTITION_ADVANCED=y
20CONFIG_ARCH_MSM_DT=y 20CONFIG_ARCH_MSM=y
21CONFIG_ARCH_MSM8X60=y
22CONFIG_ARCH_MSM8960=y
23CONFIG_ARCH_MSM8974=y
24CONFIG_SMP=y
25CONFIG_PREEMPT=y 21CONFIG_PREEMPT=y
26CONFIG_AEABI=y 22CONFIG_AEABI=y
27CONFIG_HIGHMEM=y 23CONFIG_HIGHMEM=y
28CONFIG_HIGHPTE=y 24CONFIG_HIGHPTE=y
29CONFIG_CLEANCACHE=y 25CONFIG_CLEANCACHE=y
30CONFIG_CC_STACKPROTECTOR=y 26CONFIG_AUTO_ZRELADDR=y
31CONFIG_ARM_APPENDED_DTB=y
32CONFIG_ARM_ATAG_DTB_COMPAT=y
33CONFIG_VFP=y 27CONFIG_VFP=y
34CONFIG_NEON=y
35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 28# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
36CONFIG_NET=y 29CONFIG_NET=y
37CONFIG_PACKET=y 30CONFIG_PACKET=y
@@ -79,16 +72,12 @@ CONFIG_SERIO_LIBPS2=y
79# CONFIG_LEGACY_PTYS is not set 72# CONFIG_LEGACY_PTYS is not set
80CONFIG_SERIAL_MSM=y 73CONFIG_SERIAL_MSM=y
81CONFIG_SERIAL_MSM_CONSOLE=y 74CONFIG_SERIAL_MSM_CONSOLE=y
82CONFIG_HW_RANDOM=y 75# CONFIG_HW_RANDOM is not set
83CONFIG_HW_RANDOM_MSM=y
84CONFIG_I2C=y 76CONFIG_I2C=y
85CONFIG_I2C_CHARDEV=y 77CONFIG_I2C_CHARDEV=y
86CONFIG_SPI=y 78CONFIG_SPI=y
87CONFIG_DEBUG_GPIO=y 79CONFIG_DEBUG_GPIO=y
88CONFIG_GPIO_SYSFS=y 80CONFIG_GPIO_SYSFS=y
89CONFIG_POWER_SUPPLY=y
90CONFIG_POWER_RESET=y
91CONFIG_POWER_RESET_MSM=y
92CONFIG_THERMAL=y 81CONFIG_THERMAL=y
93CONFIG_REGULATOR=y 82CONFIG_REGULATOR=y
94CONFIG_MEDIA_SUPPORT=y 83CONFIG_MEDIA_SUPPORT=y
@@ -100,25 +89,17 @@ CONFIG_SND_DYNAMIC_MINORS=y
100# CONFIG_SND_SPI is not set 89# CONFIG_SND_SPI is not set
101# CONFIG_SND_USB is not set 90# CONFIG_SND_USB is not set
102CONFIG_SND_SOC=y 91CONFIG_SND_SOC=y
103CONFIG_HID_BATTERY_STRENGTH=y
104CONFIG_USB=y 92CONFIG_USB=y
105CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 93CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
106CONFIG_USB_MON=y 94CONFIG_USB_MON=y
107CONFIG_USB_EHCI_HCD=y 95CONFIG_USB_EHCI_HCD=y
108CONFIG_USB_EHCI_MSM=y
109CONFIG_USB_ACM=y 96CONFIG_USB_ACM=y
110CONFIG_USB_SERIAL=y 97CONFIG_USB_SERIAL=y
111CONFIG_USB_GADGET=y 98CONFIG_USB_GADGET=y
112CONFIG_USB_GADGET_DEBUG_FILES=y 99CONFIG_USB_GADGET_DEBUG_FILES=y
113CONFIG_USB_GADGET_VBUS_DRAW=500 100CONFIG_USB_GADGET_VBUS_DRAW=500
114CONFIG_NEW_LEDS=y
115CONFIG_RTC_CLASS=y 101CONFIG_RTC_CLASS=y
116CONFIG_STAGING=y 102CONFIG_STAGING=y
117CONFIG_COMMON_CLK_QCOM=y
118CONFIG_MSM_GCC_8660=y
119CONFIG_MSM_MMCC_8960=y
120CONFIG_MSM_MMCC_8974=y
121CONFIG_MSM_IOMMU=y
122CONFIG_EXT2_FS=y 103CONFIG_EXT2_FS=y
123CONFIG_EXT2_FS_XATTR=y 104CONFIG_EXT2_FS_XATTR=y
124CONFIG_EXT3_FS=y 105CONFIG_EXT3_FS=y
diff --git a/arch/arm/configs/multi_v5_defconfig b/arch/arm/configs/multi_v5_defconfig
index aa3dfb084fed..5ebfa8bf8509 100644
--- a/arch/arm/configs/multi_v5_defconfig
+++ b/arch/arm/configs/multi_v5_defconfig
@@ -11,7 +11,6 @@ CONFIG_MODULE_UNLOAD=y
11# CONFIG_ARCH_MULTI_V7 is not set 11# CONFIG_ARCH_MULTI_V7 is not set
12CONFIG_ARCH_MVEBU=y 12CONFIG_ARCH_MVEBU=y
13CONFIG_MACH_KIRKWOOD=y 13CONFIG_MACH_KIRKWOOD=y
14CONFIG_MACH_T5325=y
15CONFIG_ARCH_MXC=y 14CONFIG_ARCH_MXC=y
16CONFIG_MACH_IMX25_DT=y 15CONFIG_MACH_IMX25_DT=y
17CONFIG_MACH_IMX27_DT=y 16CONFIG_MACH_IMX27_DT=y
@@ -108,6 +107,8 @@ CONFIG_SND=y
108CONFIG_SND_SOC=y 107CONFIG_SND_SOC=y
109CONFIG_SND_KIRKWOOD_SOC=y 108CONFIG_SND_KIRKWOOD_SOC=y
110CONFIG_SND_KIRKWOOD_SOC_T5325=y 109CONFIG_SND_KIRKWOOD_SOC_T5325=y
110CONFIG_SND_SOC_ALC5623=y
111CONFIG_SND_SIMPLE_CARD=y
111# CONFIG_ABX500_CORE is not set 112# CONFIG_ABX500_CORE is not set
112CONFIG_REGULATOR=y 113CONFIG_REGULATOR=y
113CONFIG_REGULATOR_FIXED_VOLTAGE=y 114CONFIG_REGULATOR_FIXED_VOLTAGE=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index d4e8a47a2f7c..e2d62048e198 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -5,9 +5,11 @@ CONFIG_NO_HZ=y
5CONFIG_HIGH_RES_TIMERS=y 5CONFIG_HIGH_RES_TIMERS=y
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7CONFIG_EMBEDDED=y 7CONFIG_EMBEDDED=y
8CONFIG_PERF_EVENTS=y
8CONFIG_MODULES=y 9CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
10CONFIG_PARTITION_ADVANCED=y 11CONFIG_PARTITION_ADVANCED=y
12CONFIG_ARCH_VIRT=y
11CONFIG_ARCH_MVEBU=y 13CONFIG_ARCH_MVEBU=y
12CONFIG_MACH_ARMADA_370=y 14CONFIG_MACH_ARMADA_370=y
13CONFIG_MACH_ARMADA_375=y 15CONFIG_MACH_ARMADA_375=y
@@ -15,12 +17,12 @@ CONFIG_MACH_ARMADA_38X=y
15CONFIG_MACH_ARMADA_XP=y 17CONFIG_MACH_ARMADA_XP=y
16CONFIG_MACH_DOVE=y 18CONFIG_MACH_DOVE=y
17CONFIG_ARCH_BCM=y 19CONFIG_ARCH_BCM=y
18CONFIG_ARCH_BCM_5301X=y
19CONFIG_ARCH_BCM_MOBILE=y 20CONFIG_ARCH_BCM_MOBILE=y
21CONFIG_ARCH_BCM_5301X=y
20CONFIG_ARCH_BERLIN=y 22CONFIG_ARCH_BERLIN=y
21CONFIG_MACH_BERLIN_BG2=y 23CONFIG_MACH_BERLIN_BG2=y
22CONFIG_MACH_BERLIN_BG2CD=y 24CONFIG_MACH_BERLIN_BG2CD=y
23CONFIG_GPIO_PCA953X=y 25CONFIG_MACH_BERLIN_BG2Q=y
24CONFIG_ARCH_HIGHBANK=y 26CONFIG_ARCH_HIGHBANK=y
25CONFIG_ARCH_HI3xxx=y 27CONFIG_ARCH_HI3xxx=y
26CONFIG_ARCH_KEYSTONE=y 28CONFIG_ARCH_KEYSTONE=y
@@ -34,8 +36,8 @@ CONFIG_ARCH_OMAP3=y
34CONFIG_ARCH_OMAP4=y 36CONFIG_ARCH_OMAP4=y
35CONFIG_SOC_OMAP5=y 37CONFIG_SOC_OMAP5=y
36CONFIG_SOC_AM33XX=y 38CONFIG_SOC_AM33XX=y
37CONFIG_SOC_DRA7XX=y
38CONFIG_SOC_AM43XX=y 39CONFIG_SOC_AM43XX=y
40CONFIG_SOC_DRA7XX=y
39CONFIG_ARCH_QCOM=y 41CONFIG_ARCH_QCOM=y
40CONFIG_ARCH_MSM8X60=y 42CONFIG_ARCH_MSM8X60=y
41CONFIG_ARCH_MSM8960=y 43CONFIG_ARCH_MSM8960=y
@@ -47,6 +49,7 @@ CONFIG_ARCH_SPEAR13XX=y
47CONFIG_MACH_SPEAR1310=y 49CONFIG_MACH_SPEAR1310=y
48CONFIG_MACH_SPEAR1340=y 50CONFIG_MACH_SPEAR1340=y
49CONFIG_ARCH_STI=y 51CONFIG_ARCH_STI=y
52CONFIG_ARCH_EXYNOS=y
50CONFIG_ARCH_SUNXI=y 53CONFIG_ARCH_SUNXI=y
51CONFIG_ARCH_SIRF=y 54CONFIG_ARCH_SIRF=y
52CONFIG_ARCH_TEGRA=y 55CONFIG_ARCH_TEGRA=y
@@ -61,7 +64,6 @@ CONFIG_MACH_SNOWBALL=y
61CONFIG_MACH_UX500_DT=y 64CONFIG_MACH_UX500_DT=y
62CONFIG_ARCH_VEXPRESS=y 65CONFIG_ARCH_VEXPRESS=y
63CONFIG_ARCH_VEXPRESS_CA9X4=y 66CONFIG_ARCH_VEXPRESS_CA9X4=y
64CONFIG_ARCH_VIRT=y
65CONFIG_ARCH_WM8850=y 67CONFIG_ARCH_WM8850=y
66CONFIG_ARCH_ZYNQ=y 68CONFIG_ARCH_ZYNQ=y
67CONFIG_NEON=y 69CONFIG_NEON=y
@@ -71,6 +73,7 @@ CONFIG_PCI_MSI=y
71CONFIG_PCI_MVEBU=y 73CONFIG_PCI_MVEBU=y
72CONFIG_PCI_TEGRA=y 74CONFIG_PCI_TEGRA=y
73CONFIG_SMP=y 75CONFIG_SMP=y
76CONFIG_NR_CPUS=8
74CONFIG_HIGHPTE=y 77CONFIG_HIGHPTE=y
75CONFIG_CMA=y 78CONFIG_CMA=y
76CONFIG_ARM_APPENDED_DTB=y 79CONFIG_ARM_APPENDED_DTB=y
@@ -96,6 +99,11 @@ CONFIG_INET6_IPCOMP=m
96CONFIG_IPV6_MIP6=m 99CONFIG_IPV6_MIP6=m
97CONFIG_IPV6_TUNNEL=m 100CONFIG_IPV6_TUNNEL=m
98CONFIG_IPV6_MULTIPLE_TABLES=y 101CONFIG_IPV6_MULTIPLE_TABLES=y
102CONFIG_CAN=y
103CONFIG_CAN_RAW=y
104CONFIG_CAN_BCM=y
105CONFIG_CAN_DEV=y
106CONFIG_CAN_MCP251X=y
99CONFIG_CFG80211=m 107CONFIG_CFG80211=m
100CONFIG_MAC80211=m 108CONFIG_MAC80211=m
101CONFIG_RFKILL=y 109CONFIG_RFKILL=y
@@ -112,15 +120,19 @@ CONFIG_BLK_DEV_LOOP=y
112CONFIG_ICS932S401=y 120CONFIG_ICS932S401=y
113CONFIG_APDS9802ALS=y 121CONFIG_APDS9802ALS=y
114CONFIG_ISL29003=y 122CONFIG_ISL29003=y
123CONFIG_EEPROM_AT24=y
124CONFIG_EEPROM_SUNXI_SID=y
115CONFIG_BLK_DEV_SD=y 125CONFIG_BLK_DEV_SD=y
116CONFIG_BLK_DEV_SR=y 126CONFIG_BLK_DEV_SR=y
117CONFIG_SCSI_MULTI_LUN=y 127CONFIG_SCSI_MULTI_LUN=y
118CONFIG_ATA=y 128CONFIG_ATA=y
119CONFIG_SATA_AHCI_PLATFORM=y 129CONFIG_SATA_AHCI_PLATFORM=y
130CONFIG_AHCI_SUNXI=y
120CONFIG_SATA_HIGHBANK=y 131CONFIG_SATA_HIGHBANK=y
121CONFIG_SATA_MV=y 132CONFIG_SATA_MV=y
122CONFIG_NETDEVICES=y 133CONFIG_NETDEVICES=y
123CONFIG_SUN4I_EMAC=y 134CONFIG_SUN4I_EMAC=y
135CONFIG_MACB=y
124CONFIG_NET_CALXEDA_XGMAC=y 136CONFIG_NET_CALXEDA_XGMAC=y
125CONFIG_MV643XX_ETH=y 137CONFIG_MV643XX_ETH=y
126CONFIG_MVNETA=y 138CONFIG_MVNETA=y
@@ -153,6 +165,8 @@ CONFIG_SERIAL_8250_CONSOLE=y
153CONFIG_SERIAL_8250_DW=y 165CONFIG_SERIAL_8250_DW=y
154CONFIG_SERIAL_AMBA_PL011=y 166CONFIG_SERIAL_AMBA_PL011=y
155CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 167CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
168CONFIG_SERIAL_SAMSUNG=y
169CONFIG_SERIAL_SAMSUNG_CONSOLE=y
156CONFIG_SERIAL_SIRFSOC=y 170CONFIG_SERIAL_SIRFSOC=y
157CONFIG_SERIAL_SIRFSOC_CONSOLE=y 171CONFIG_SERIAL_SIRFSOC_CONSOLE=y
158CONFIG_SERIAL_TEGRA=y 172CONFIG_SERIAL_TEGRA=y
@@ -175,7 +189,9 @@ CONFIG_I2C_CHARDEV=y
175CONFIG_I2C_MUX=y 189CONFIG_I2C_MUX=y
176CONFIG_I2C_MUX_PCA954x=y 190CONFIG_I2C_MUX_PCA954x=y
177CONFIG_I2C_MUX_PINCTRL=y 191CONFIG_I2C_MUX_PINCTRL=y
192CONFIG_I2C_CADENCE=y
178CONFIG_I2C_DESIGNWARE_PLATFORM=y 193CONFIG_I2C_DESIGNWARE_PLATFORM=y
194CONFIG_I2C_EXYNOS5=y
179CONFIG_I2C_MV64XXX=y 195CONFIG_I2C_MV64XXX=y
180CONFIG_I2C_SIRF=y 196CONFIG_I2C_SIRF=y
181CONFIG_I2C_TEGRA=y 197CONFIG_I2C_TEGRA=y
@@ -184,6 +200,8 @@ CONFIG_SPI_OMAP24XX=y
184CONFIG_SPI_ORION=y 200CONFIG_SPI_ORION=y
185CONFIG_SPI_PL022=y 201CONFIG_SPI_PL022=y
186CONFIG_SPI_SIRF=y 202CONFIG_SPI_SIRF=y
203CONFIG_SPI_SUN4I=y
204CONFIG_SPI_SUN6I=y
187CONFIG_SPI_TEGRA114=y 205CONFIG_SPI_TEGRA114=y
188CONFIG_SPI_TEGRA20_SFLASH=y 206CONFIG_SPI_TEGRA20_SFLASH=y
189CONFIG_SPI_TEGRA20_SLINK=y 207CONFIG_SPI_TEGRA20_SLINK=y
@@ -191,6 +209,8 @@ CONFIG_PINCTRL_AS3722=y
191CONFIG_PINCTRL_PALMAS=y 209CONFIG_PINCTRL_PALMAS=y
192CONFIG_GPIO_SYSFS=y 210CONFIG_GPIO_SYSFS=y
193CONFIG_GPIO_GENERIC_PLATFORM=y 211CONFIG_GPIO_GENERIC_PLATFORM=y
212CONFIG_GPIO_DWAPB=y
213CONFIG_GPIO_PCA953X=y
194CONFIG_GPIO_PCA953X_IRQ=y 214CONFIG_GPIO_PCA953X_IRQ=y
195CONFIG_GPIO_TWL4030=y 215CONFIG_GPIO_TWL4030=y
196CONFIG_GPIO_PALMAS=y 216CONFIG_GPIO_PALMAS=y
@@ -200,16 +220,19 @@ CONFIG_BATTERY_SBS=y
200CONFIG_CHARGER_TPS65090=y 220CONFIG_CHARGER_TPS65090=y
201CONFIG_POWER_RESET_AS3722=y 221CONFIG_POWER_RESET_AS3722=y
202CONFIG_POWER_RESET_GPIO=y 222CONFIG_POWER_RESET_GPIO=y
223CONFIG_POWER_RESET_SUN6I=y
203CONFIG_SENSORS_LM90=y 224CONFIG_SENSORS_LM90=y
204CONFIG_THERMAL=y 225CONFIG_THERMAL=y
205CONFIG_DOVE_THERMAL=y 226CONFIG_DOVE_THERMAL=y
206CONFIG_ARMADA_THERMAL=y 227CONFIG_ARMADA_THERMAL=y
207CONFIG_WATCHDOG=y 228CONFIG_WATCHDOG=y
208CONFIG_ORION_WATCHDOG=y 229CONFIG_ORION_WATCHDOG=y
230CONFIG_SUNXI_WATCHDOG=y
209CONFIG_MFD_AS3722=y 231CONFIG_MFD_AS3722=y
210CONFIG_MFD_CROS_EC=y 232CONFIG_MFD_CROS_EC=y
211CONFIG_MFD_CROS_EC_SPI=y 233CONFIG_MFD_CROS_EC_SPI=y
212CONFIG_MFD_MAX8907=y 234CONFIG_MFD_MAX8907=y
235CONFIG_MFD_SEC_CORE=y
213CONFIG_MFD_PALMAS=y 236CONFIG_MFD_PALMAS=y
214CONFIG_MFD_TPS65090=y 237CONFIG_MFD_TPS65090=y
215CONFIG_MFD_TPS6586X=y 238CONFIG_MFD_TPS6586X=y
@@ -220,6 +243,8 @@ CONFIG_REGULATOR_AS3722=y
220CONFIG_REGULATOR_GPIO=y 243CONFIG_REGULATOR_GPIO=y
221CONFIG_REGULATOR_MAX8907=y 244CONFIG_REGULATOR_MAX8907=y
222CONFIG_REGULATOR_PALMAS=y 245CONFIG_REGULATOR_PALMAS=y
246CONFIG_REGULATOR_S2MPS11=y
247CONFIG_REGULATOR_S5M8767=y
223CONFIG_REGULATOR_TPS51632=y 248CONFIG_REGULATOR_TPS51632=y
224CONFIG_REGULATOR_TPS62360=y 249CONFIG_REGULATOR_TPS62360=y
225CONFIG_REGULATOR_TPS65090=y 250CONFIG_REGULATOR_TPS65090=y
@@ -254,10 +279,13 @@ CONFIG_SND_SOC_TEGRA_ALC5632=y
254CONFIG_SND_SOC_TEGRA_MAX98090=y 279CONFIG_SND_SOC_TEGRA_MAX98090=y
255CONFIG_USB=y 280CONFIG_USB=y
256CONFIG_USB_XHCI_HCD=y 281CONFIG_USB_XHCI_HCD=y
282CONFIG_USB_XHCI_MVEBU=y
257CONFIG_USB_EHCI_HCD=y 283CONFIG_USB_EHCI_HCD=y
258CONFIG_USB_EHCI_TEGRA=y 284CONFIG_USB_EHCI_TEGRA=y
259CONFIG_USB_EHCI_HCD_PLATFORM=y 285CONFIG_USB_EHCI_HCD_PLATFORM=y
260CONFIG_USB_ISP1760_HCD=y 286CONFIG_USB_ISP1760_HCD=y
287CONFIG_USB_OHCI_HCD=y
288CONFIG_USB_OHCI_HCD_PLATFORM=y
261CONFIG_USB_STORAGE=y 289CONFIG_USB_STORAGE=y
262CONFIG_USB_CHIPIDEA=y 290CONFIG_USB_CHIPIDEA=y
263CONFIG_USB_CHIPIDEA_HOST=y 291CONFIG_USB_CHIPIDEA_HOST=y
@@ -272,20 +300,28 @@ CONFIG_MMC=y
272CONFIG_MMC_BLOCK_MINORS=16 300CONFIG_MMC_BLOCK_MINORS=16
273CONFIG_MMC_ARMMMCI=y 301CONFIG_MMC_ARMMMCI=y
274CONFIG_MMC_SDHCI=y 302CONFIG_MMC_SDHCI=y
303CONFIG_MMC_SDHCI_OF_ARASAN=y
275CONFIG_MMC_SDHCI_ESDHC_IMX=y 304CONFIG_MMC_SDHCI_ESDHC_IMX=y
276CONFIG_MMC_SDHCI_TEGRA=y
277CONFIG_MMC_SDHCI_DOVE=y 305CONFIG_MMC_SDHCI_DOVE=y
306CONFIG_MMC_SDHCI_TEGRA=y
307CONFIG_MMC_SDHCI_PXAV3=y
278CONFIG_MMC_SDHCI_SPEAR=y 308CONFIG_MMC_SDHCI_SPEAR=y
309CONFIG_MMC_SDHCI_S3C=y
310CONFIG_MMC_SDHCI_S3C_DMA=y
279CONFIG_MMC_SDHCI_BCM_KONA=y 311CONFIG_MMC_SDHCI_BCM_KONA=y
280CONFIG_MMC_OMAP=y 312CONFIG_MMC_OMAP=y
281CONFIG_MMC_OMAP_HS=y 313CONFIG_MMC_OMAP_HS=y
282CONFIG_MMC_MVSDIO=y 314CONFIG_MMC_MVSDIO=y
315CONFIG_MMC_SUNXI=y
316CONFIG_MMC_DW=y
317CONFIG_MMC_DW_EXYNOS=y
283CONFIG_EDAC=y 318CONFIG_EDAC=y
284CONFIG_EDAC_MM_EDAC=y 319CONFIG_EDAC_MM_EDAC=y
285CONFIG_EDAC_HIGHBANK_MC=y 320CONFIG_EDAC_HIGHBANK_MC=y
286CONFIG_EDAC_HIGHBANK_L2=y 321CONFIG_EDAC_HIGHBANK_L2=y
287CONFIG_RTC_CLASS=y 322CONFIG_RTC_CLASS=y
288CONFIG_RTC_DRV_AS3722=y 323CONFIG_RTC_DRV_AS3722=y
324CONFIG_RTC_DRV_DS1307=y
289CONFIG_RTC_DRV_MAX8907=y 325CONFIG_RTC_DRV_MAX8907=y
290CONFIG_RTC_DRV_PALMAS=y 326CONFIG_RTC_DRV_PALMAS=y
291CONFIG_RTC_DRV_TWL4030=y 327CONFIG_RTC_DRV_TWL4030=y
@@ -294,6 +330,7 @@ CONFIG_RTC_DRV_TPS65910=y
294CONFIG_RTC_DRV_EM3027=y 330CONFIG_RTC_DRV_EM3027=y
295CONFIG_RTC_DRV_PL031=y 331CONFIG_RTC_DRV_PL031=y
296CONFIG_RTC_DRV_VT8500=y 332CONFIG_RTC_DRV_VT8500=y
333CONFIG_RTC_DRV_SUNXI=y
297CONFIG_RTC_DRV_MV=y 334CONFIG_RTC_DRV_MV=y
298CONFIG_RTC_DRV_TEGRA=y 335CONFIG_RTC_DRV_TEGRA=y
299CONFIG_DMADEVICES=y 336CONFIG_DMADEVICES=y
@@ -328,6 +365,7 @@ CONFIG_PWM=y
328CONFIG_PWM_TEGRA=y 365CONFIG_PWM_TEGRA=y
329CONFIG_PWM_VT8500=y 366CONFIG_PWM_VT8500=y
330CONFIG_OMAP_USB2=y 367CONFIG_OMAP_USB2=y
368CONFIG_PHY_SUN4I_USB=y
331CONFIG_EXT4_FS=y 369CONFIG_EXT4_FS=y
332CONFIG_VFAT_FS=y 370CONFIG_VFAT_FS=y
333CONFIG_TMPFS=y 371CONFIG_TMPFS=y
diff --git a/arch/arm/configs/mvebu_v5_defconfig b/arch/arm/configs/mvebu_v5_defconfig
index 36484a37a1ca..27c732fdf21e 100644
--- a/arch/arm/configs/mvebu_v5_defconfig
+++ b/arch/arm/configs/mvebu_v5_defconfig
@@ -1,4 +1,5 @@
1CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
2CONFIG_FHANDLE=y
2CONFIG_NO_HZ=y 3CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 4CONFIG_HIGH_RES_TIMERS=y
4CONFIG_LOG_BUF_SHIFT=19 5CONFIG_LOG_BUF_SHIFT=19
@@ -11,7 +12,6 @@ CONFIG_MODULE_UNLOAD=y
11# CONFIG_ARCH_MULTI_V7 is not set 12# CONFIG_ARCH_MULTI_V7 is not set
12CONFIG_ARCH_MVEBU=y 13CONFIG_ARCH_MVEBU=y
13CONFIG_MACH_KIRKWOOD=y 14CONFIG_MACH_KIRKWOOD=y
14CONFIG_MACH_T5325=y
15# CONFIG_CPU_FEROCEON_OLD_ID is not set 15# CONFIG_CPU_FEROCEON_OLD_ID is not set
16CONFIG_PCI_MVEBU=y 16CONFIG_PCI_MVEBU=y
17CONFIG_PREEMPT=y 17CONFIG_PREEMPT=y
@@ -50,6 +50,7 @@ CONFIG_MTD_PHYSMAP=y
50CONFIG_MTD_M25P80=y 50CONFIG_MTD_M25P80=y
51CONFIG_MTD_NAND=y 51CONFIG_MTD_NAND=y
52CONFIG_MTD_NAND_ORION=y 52CONFIG_MTD_NAND_ORION=y
53CONFIG_MTD_SPI_NOR=y
53CONFIG_BLK_DEV_LOOP=y 54CONFIG_BLK_DEV_LOOP=y
54CONFIG_EEPROM_AT24=y 55CONFIG_EEPROM_AT24=y
55# CONFIG_SCSI_PROC_FS is not set 56# CONFIG_SCSI_PROC_FS is not set
@@ -100,6 +101,8 @@ CONFIG_SND=y
100CONFIG_SND_SOC=y 101CONFIG_SND_SOC=y
101CONFIG_SND_KIRKWOOD_SOC=y 102CONFIG_SND_KIRKWOOD_SOC=y
102CONFIG_SND_KIRKWOOD_SOC_T5325=y 103CONFIG_SND_KIRKWOOD_SOC_T5325=y
104CONFIG_SND_SOC_ALC5623=y
105CONFIG_SND_SIMPLE_CARD=y
103CONFIG_REGULATOR=y 106CONFIG_REGULATOR=y
104CONFIG_REGULATOR_FIXED_VOLTAGE=y 107CONFIG_REGULATOR_FIXED_VOLTAGE=y
105CONFIG_HID_DRAGONRISE=y 108CONFIG_HID_DRAGONRISE=y
diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig
index a34713d8db9f..e11170e37442 100644
--- a/arch/arm/configs/mvebu_v7_defconfig
+++ b/arch/arm/configs/mvebu_v7_defconfig
@@ -1,5 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_FHANDLE=y
3CONFIG_IRQ_DOMAIN_DEBUG=y 4CONFIG_IRQ_DOMAIN_DEBUG=y
4CONFIG_HIGH_RES_TIMERS=y 5CONFIG_HIGH_RES_TIMERS=y
5CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
@@ -17,6 +18,7 @@ CONFIG_NEON=y
17# CONFIG_CACHE_L2X0 is not set 18# CONFIG_CACHE_L2X0 is not set
18# CONFIG_SWP_EMULATE is not set 19# CONFIG_SWP_EMULATE is not set
19CONFIG_PCI=y 20CONFIG_PCI=y
21CONFIG_PCI_MSI=y
20CONFIG_PCI_MVEBU=y 22CONFIG_PCI_MVEBU=y
21CONFIG_SMP=y 23CONFIG_SMP=y
22CONFIG_AEABI=y 24CONFIG_AEABI=y
@@ -29,6 +31,9 @@ CONFIG_ARM_ATAG_DTB_COMPAT=y
29CONFIG_VFP=y 31CONFIG_VFP=y
30CONFIG_NET=y 32CONFIG_NET=y
31CONFIG_INET=y 33CONFIG_INET=y
34CONFIG_IP_PNP=y
35CONFIG_IP_PNP_DHCP=y
36CONFIG_IP_PNP_BOOTP=y
32CONFIG_BT=y 37CONFIG_BT=y
33CONFIG_BT_MRVL=y 38CONFIG_BT_MRVL=y
34CONFIG_BT_MRVL_SDIO=y 39CONFIG_BT_MRVL_SDIO=y
@@ -36,6 +41,7 @@ CONFIG_CFG80211=y
36CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 41CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
37CONFIG_BLK_DEV_SD=y 42CONFIG_BLK_DEV_SD=y
38CONFIG_ATA=y 43CONFIG_ATA=y
44CONFIG_AHCI_MVEBU=y
39CONFIG_SATA_MV=y 45CONFIG_SATA_MV=y
40CONFIG_NETDEVICES=y 46CONFIG_NETDEVICES=y
41CONFIG_MVNETA=y 47CONFIG_MVNETA=y
@@ -53,6 +59,7 @@ CONFIG_I2C_MV64XXX=y
53CONFIG_MTD=y 59CONFIG_MTD=y
54CONFIG_MTD_CHAR=y 60CONFIG_MTD_CHAR=y
55CONFIG_MTD_M25P80=y 61CONFIG_MTD_M25P80=y
62CONFIG_MTD_SPI_NOR=y
56CONFIG_MTD_CFI=y 63CONFIG_MTD_CFI=y
57CONFIG_MTD_CFI_INTELEXT=y 64CONFIG_MTD_CFI_INTELEXT=y
58CONFIG_MTD_CFI_AMDSTD=y 65CONFIG_MTD_CFI_AMDSTD=y
@@ -78,7 +85,9 @@ CONFIG_USB_EHCI_HCD=y
78CONFIG_USB_EHCI_ROOT_HUB_TT=y 85CONFIG_USB_EHCI_ROOT_HUB_TT=y
79CONFIG_USB_STORAGE=y 86CONFIG_USB_STORAGE=y
80CONFIG_USB_XHCI_HCD=y 87CONFIG_USB_XHCI_HCD=y
88CONFIG_USB_XHCI_MVEBU=y
81CONFIG_MMC=y 89CONFIG_MMC=y
90CONFIG_MMC_SDHCI_PXAV3=y
82CONFIG_MMC_MVSDIO=y 91CONFIG_MMC_MVSDIO=y
83CONFIG_NEW_LEDS=y 92CONFIG_NEW_LEDS=y
84CONFIG_LEDS_GPIO=y 93CONFIG_LEDS_GPIO=y
@@ -103,6 +112,8 @@ CONFIG_UDF_FS=m
103CONFIG_MSDOS_FS=y 112CONFIG_MSDOS_FS=y
104CONFIG_VFAT_FS=y 113CONFIG_VFAT_FS=y
105CONFIG_TMPFS=y 114CONFIG_TMPFS=y
115CONFIG_NFS_FS=y
116CONFIG_ROOT_NFS=y
106CONFIG_NLS_CODEPAGE_437=y 117CONFIG_NLS_CODEPAGE_437=y
107CONFIG_NLS_CODEPAGE_850=y 118CONFIG_NLS_CODEPAGE_850=y
108CONFIG_NLS_ISO8859_1=y 119CONFIG_NLS_ISO8859_1=y
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 6150108e15de..a9f992335eb2 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -26,7 +26,6 @@ CONFIG_ARCH_MXS=y
26# CONFIG_ARM_THUMB is not set 26# CONFIG_ARM_THUMB is not set
27CONFIG_PREEMPT_VOLUNTARY=y 27CONFIG_PREEMPT_VOLUNTARY=y
28CONFIG_AEABI=y 28CONFIG_AEABI=y
29CONFIG_FPE_NWFPE=y
30CONFIG_NET=y 29CONFIG_NET=y
31CONFIG_PACKET=y 30CONFIG_PACKET=y
32CONFIG_UNIX=y 31CONFIG_UNIX=y
@@ -51,10 +50,10 @@ CONFIG_MTD_CMDLINE_PARTS=y
51CONFIG_MTD_BLOCK=y 50CONFIG_MTD_BLOCK=y
52CONFIG_MTD_DATAFLASH=y 51CONFIG_MTD_DATAFLASH=y
53CONFIG_MTD_M25P80=y 52CONFIG_MTD_M25P80=y
54# CONFIG_M25PXX_USE_FAST_READ is not set
55CONFIG_MTD_SST25L=y 53CONFIG_MTD_SST25L=y
56CONFIG_MTD_NAND=y 54CONFIG_MTD_NAND=y
57CONFIG_MTD_NAND_GPMI_NAND=y 55CONFIG_MTD_NAND_GPMI_NAND=y
56CONFIG_MTD_SPI_NOR=y
58CONFIG_MTD_UBI=y 57CONFIG_MTD_UBI=y
59# CONFIG_BLK_DEV is not set 58# CONFIG_BLK_DEV is not set
60CONFIG_EEPROM_AT24=y 59CONFIG_EEPROM_AT24=y
@@ -120,7 +119,6 @@ CONFIG_USB_GADGET=y
120CONFIG_USB_ETH=m 119CONFIG_USB_ETH=m
121CONFIG_USB_MASS_STORAGE=m 120CONFIG_USB_MASS_STORAGE=m
122CONFIG_MMC=y 121CONFIG_MMC=y
123CONFIG_MMC_UNSAFE_RESUME=y
124CONFIG_MMC_MXS=y 122CONFIG_MMC_MXS=y
125CONFIG_NEW_LEDS=y 123CONFIG_NEW_LEDS=y
126CONFIG_LEDS_CLASS=y 124CONFIG_LEDS_CLASS=y
@@ -138,7 +136,6 @@ CONFIG_DMADEVICES=y
138CONFIG_MXS_DMA=y 136CONFIG_MXS_DMA=y
139CONFIG_STAGING=y 137CONFIG_STAGING=y
140CONFIG_MXS_LRADC=y 138CONFIG_MXS_LRADC=y
141CONFIG_COMMON_CLK_DEBUG=y
142CONFIG_IIO=y 139CONFIG_IIO=y
143CONFIG_IIO_SYSFS_TRIGGER=y 140CONFIG_IIO_SYSFS_TRIGGER=y
144CONFIG_PWM=y 141CONFIG_PWM=y
@@ -180,7 +177,7 @@ CONFIG_BLK_DEV_IO_TRACE=y
180CONFIG_STRICT_DEVMEM=y 177CONFIG_STRICT_DEVMEM=y
181CONFIG_DEBUG_USER=y 178CONFIG_DEBUG_USER=y
182# CONFIG_CRYPTO_ANSI_CPRNG is not set 179# CONFIG_CRYPTO_ANSI_CPRNG is not set
183# CONFIG_CRYPTO_HW is not set 180CONFIG_CRYPTO_DEV_MXS_DCP=y
184CONFIG_CRC_ITU_T=m 181CONFIG_CRC_ITU_T=m
185CONFIG_CRC7=m 182CONFIG_CRC7=m
186CONFIG_FONTS=y 183CONFIG_FONTS=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index a4e8d017f25b..28f3b6e3b589 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -21,6 +21,8 @@ CONFIG_MODULE_SRCVERSION_ALL=y
21# CONFIG_BLK_DEV_BSG is not set 21# CONFIG_BLK_DEV_BSG is not set
22CONFIG_PARTITION_ADVANCED=y 22CONFIG_PARTITION_ADVANCED=y
23CONFIG_ARCH_MULTI_V6=y 23CONFIG_ARCH_MULTI_V6=y
24CONFIG_POWER_AVS_OMAP=y
25CONFIG_POWER_AVS_OMAP_CLASS3=y
24CONFIG_OMAP_RESET_CLOCKS=y 26CONFIG_OMAP_RESET_CLOCKS=y
25CONFIG_OMAP_MUX_DEBUG=y 27CONFIG_OMAP_MUX_DEBUG=y
26CONFIG_ARCH_OMAP2=y 28CONFIG_ARCH_OMAP2=y
@@ -42,6 +44,7 @@ CONFIG_ARM_ATAG_DTB_COMPAT=y
42CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200" 44CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200"
43CONFIG_KEXEC=y 45CONFIG_KEXEC=y
44CONFIG_FPE_NWFPE=y 46CONFIG_FPE_NWFPE=y
47CONFIG_CPU_IDLE=y
45CONFIG_BINFMT_MISC=y 48CONFIG_BINFMT_MISC=y
46CONFIG_PM_DEBUG=y 49CONFIG_PM_DEBUG=y
47CONFIG_NET=y 50CONFIG_NET=y
@@ -159,11 +162,14 @@ CONFIG_GPIO_SYSFS=y
159CONFIG_GPIO_TWL4030=y 162CONFIG_GPIO_TWL4030=y
160CONFIG_W1=y 163CONFIG_W1=y
161CONFIG_POWER_SUPPLY=y 164CONFIG_POWER_SUPPLY=y
165CONFIG_POWER_AVS=y
162CONFIG_SENSORS_LM75=m 166CONFIG_SENSORS_LM75=m
163CONFIG_THERMAL=y 167CONFIG_THERMAL=y
164CONFIG_THERMAL_GOV_FAIR_SHARE=y 168CONFIG_THERMAL_GOV_FAIR_SHARE=y
165CONFIG_THERMAL_GOV_USER_SPACE=y 169CONFIG_THERMAL_GOV_USER_SPACE=y
170CONFIG_CPU_THERMAL=y
166CONFIG_TI_SOC_THERMAL=y 171CONFIG_TI_SOC_THERMAL=y
172CONFIG_TI_THERMAL=y
167CONFIG_OMAP4_THERMAL=y 173CONFIG_OMAP4_THERMAL=y
168CONFIG_OMAP5_THERMAL=y 174CONFIG_OMAP5_THERMAL=y
169CONFIG_DRA752_THERMAL=y 175CONFIG_DRA752_THERMAL=y
@@ -177,6 +183,7 @@ CONFIG_MFD_TPS65910=y
177CONFIG_TWL6040_CORE=y 183CONFIG_TWL6040_CORE=y
178CONFIG_REGULATOR_FIXED_VOLTAGE=y 184CONFIG_REGULATOR_FIXED_VOLTAGE=y
179CONFIG_REGULATOR_PALMAS=y 185CONFIG_REGULATOR_PALMAS=y
186CONFIG_REGULATOR_TI_ABB=y
180CONFIG_REGULATOR_TPS65023=y 187CONFIG_REGULATOR_TPS65023=y
181CONFIG_REGULATOR_TPS6507X=y 188CONFIG_REGULATOR_TPS6507X=y
182CONFIG_REGULATOR_TPS65217=y 189CONFIG_REGULATOR_TPS65217=y
@@ -239,6 +246,7 @@ CONFIG_SDIO_UART=y
239CONFIG_MMC_OMAP=y 246CONFIG_MMC_OMAP=y
240CONFIG_MMC_OMAP_HS=y 247CONFIG_MMC_OMAP_HS=y
241CONFIG_NEW_LEDS=y 248CONFIG_NEW_LEDS=y
249CONFIG_LEDS_CLASS=y
242CONFIG_LEDS_GPIO=y 250CONFIG_LEDS_GPIO=y
243CONFIG_LEDS_TRIGGERS=y 251CONFIG_LEDS_TRIGGERS=y
244CONFIG_LEDS_TRIGGER_TIMER=y 252CONFIG_LEDS_TRIGGER_TIMER=y
diff --git a/arch/arm/configs/qcom_defconfig b/arch/arm/configs/qcom_defconfig
new file mode 100644
index 000000000000..42ebd72799e6
--- /dev/null
+++ b/arch/arm/configs/qcom_defconfig
@@ -0,0 +1,165 @@
1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_SYSCTL_SYSCALL=y
8CONFIG_KALLSYMS_ALL=y
9CONFIG_EMBEDDED=y
10# CONFIG_SLUB_DEBUG is not set
11# CONFIG_COMPAT_BRK is not set
12CONFIG_PROFILING=y
13CONFIG_OPROFILE=y
14CONFIG_KPROBES=y
15CONFIG_MODULES=y
16CONFIG_MODULE_UNLOAD=y
17CONFIG_MODULE_FORCE_UNLOAD=y
18CONFIG_MODVERSIONS=y
19CONFIG_PARTITION_ADVANCED=y
20CONFIG_ARCH_QCOM=y
21CONFIG_ARCH_MSM8X60=y
22CONFIG_ARCH_MSM8960=y
23CONFIG_ARCH_MSM8974=y
24CONFIG_SMP=y
25CONFIG_PREEMPT=y
26CONFIG_AEABI=y
27CONFIG_HIGHMEM=y
28CONFIG_HIGHPTE=y
29CONFIG_CLEANCACHE=y
30CONFIG_ARM_APPENDED_DTB=y
31CONFIG_ARM_ATAG_DTB_COMPAT=y
32CONFIG_VFP=y
33CONFIG_NEON=y
34# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
35CONFIG_NET=y
36CONFIG_PACKET=y
37CONFIG_UNIX=y
38CONFIG_INET=y
39CONFIG_IP_ADVANCED_ROUTER=y
40CONFIG_IP_MULTIPLE_TABLES=y
41CONFIG_IP_ROUTE_VERBOSE=y
42CONFIG_IP_PNP=y
43CONFIG_IP_PNP_DHCP=y
44# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
45# CONFIG_INET_XFRM_MODE_TUNNEL is not set
46# CONFIG_INET_XFRM_MODE_BEET is not set
47# CONFIG_INET_LRO is not set
48# CONFIG_IPV6 is not set
49CONFIG_CFG80211=y
50CONFIG_RFKILL=y
51CONFIG_DEVTMPFS=y
52CONFIG_DEVTMPFS_MOUNT=y
53CONFIG_MTD=y
54CONFIG_MTD_BLOCK=y
55CONFIG_MTD_M25P80=y
56CONFIG_BLK_DEV_LOOP=y
57CONFIG_BLK_DEV_RAM=y
58CONFIG_SCSI=y
59CONFIG_SCSI_TGT=y
60CONFIG_BLK_DEV_SD=y
61CONFIG_CHR_DEV_SG=y
62CONFIG_CHR_DEV_SCH=y
63CONFIG_SCSI_MULTI_LUN=y
64CONFIG_SCSI_CONSTANTS=y
65CONFIG_SCSI_LOGGING=y
66CONFIG_SCSI_SCAN_ASYNC=y
67CONFIG_NETDEVICES=y
68CONFIG_DUMMY=y
69CONFIG_MDIO_BITBANG=y
70CONFIG_MDIO_GPIO=y
71CONFIG_SLIP=y
72CONFIG_SLIP_COMPRESSED=y
73CONFIG_SLIP_MODE_SLIP6=y
74CONFIG_USB_USBNET=y
75# CONFIG_USB_NET_AX8817X is not set
76# CONFIG_USB_NET_ZAURUS is not set
77CONFIG_INPUT_EVDEV=y
78# CONFIG_KEYBOARD_ATKBD is not set
79# CONFIG_MOUSE_PS2 is not set
80CONFIG_INPUT_JOYSTICK=y
81CONFIG_INPUT_TOUCHSCREEN=y
82CONFIG_INPUT_MISC=y
83CONFIG_INPUT_UINPUT=y
84CONFIG_SERIO_LIBPS2=y
85# CONFIG_LEGACY_PTYS is not set
86CONFIG_SERIAL_MSM=y
87CONFIG_SERIAL_MSM_CONSOLE=y
88CONFIG_HW_RANDOM=y
89CONFIG_HW_RANDOM_MSM=y
90CONFIG_I2C=y
91CONFIG_I2C_CHARDEV=y
92CONFIG_I2C_QUP=y
93CONFIG_SPI=y
94CONFIG_SPI_QUP=y
95CONFIG_SPMI=y
96CONFIG_PINCTRL_APQ8064=y
97CONFIG_PINCTRL_IPQ8064=y
98CONFIG_PINCTRL_MSM8X74=y
99CONFIG_DEBUG_GPIO=y
100CONFIG_GPIO_SYSFS=y
101CONFIG_POWER_SUPPLY=y
102CONFIG_POWER_RESET=y
103CONFIG_POWER_RESET_MSM=y
104CONFIG_THERMAL=y
105CONFIG_REGULATOR=y
106CONFIG_MEDIA_SUPPORT=y
107CONFIG_FB=y
108CONFIG_SOUND=y
109CONFIG_SND=y
110CONFIG_SND_DYNAMIC_MINORS=y
111# CONFIG_SND_ARM is not set
112# CONFIG_SND_SPI is not set
113# CONFIG_SND_USB is not set
114CONFIG_SND_SOC=y
115CONFIG_HID_BATTERY_STRENGTH=y
116CONFIG_USB=y
117CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
118CONFIG_USB_MON=y
119CONFIG_USB_EHCI_HCD=y
120CONFIG_USB_ACM=y
121CONFIG_USB_SERIAL=y
122CONFIG_USB_GADGET=y
123CONFIG_USB_GADGET_DEBUG_FILES=y
124CONFIG_USB_GADGET_VBUS_DRAW=500
125CONFIG_MMC=y
126CONFIG_MMC_BLOCK_MINORS=16
127CONFIG_MMC_SDHCI=y
128CONFIG_MMC_SDHCI_PLTFM=y
129CONFIG_MMC_SDHCI_MSM=y
130CONFIG_RTC_CLASS=y
131CONFIG_DMADEVICES=y
132CONFIG_QCOM_BAM_DMA=y
133CONFIG_STAGING=y
134CONFIG_QCOM_GSBI=y
135CONFIG_COMMON_CLK_QCOM=y
136CONFIG_MSM_GCC_8660=y
137CONFIG_MSM_MMCC_8960=y
138CONFIG_MSM_MMCC_8974=y
139CONFIG_MSM_IOMMU=y
140CONFIG_GENERIC_PHY=y
141CONFIG_EXT2_FS=y
142CONFIG_EXT2_FS_XATTR=y
143CONFIG_EXT3_FS=y
144# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
145CONFIG_EXT4_FS=y
146CONFIG_FUSE_FS=y
147CONFIG_VFAT_FS=y
148CONFIG_TMPFS=y
149CONFIG_JFFS2_FS=y
150CONFIG_NFS_FS=y
151CONFIG_NFS_V3_ACL=y
152CONFIG_NFS_V4=y
153CONFIG_CIFS=y
154CONFIG_NLS_CODEPAGE_437=y
155CONFIG_NLS_ASCII=y
156CONFIG_NLS_ISO8859_1=y
157CONFIG_NLS_UTF8=y
158CONFIG_PRINTK_TIME=y
159CONFIG_DYNAMIC_DEBUG=y
160CONFIG_DEBUG_INFO=y
161CONFIG_MAGIC_SYSRQ=y
162CONFIG_LOCKUP_DETECTOR=y
163# CONFIG_DETECT_HUNG_TASK is not set
164# CONFIG_SCHED_DEBUG is not set
165CONFIG_TIMER_STATS=y
diff --git a/arch/arm/configs/realview-smp_defconfig b/arch/arm/configs/realview-smp_defconfig
index abe61bf379d2..1da5d9e48224 100644
--- a/arch/arm/configs/realview-smp_defconfig
+++ b/arch/arm/configs/realview-smp_defconfig
@@ -76,8 +76,10 @@ CONFIG_MMC=y
76CONFIG_MMC_ARMMMCI=y 76CONFIG_MMC_ARMMMCI=y
77CONFIG_NEW_LEDS=y 77CONFIG_NEW_LEDS=y
78CONFIG_LEDS_CLASS=y 78CONFIG_LEDS_CLASS=y
79CONFIG_LEDS_VERSATILE=y
79CONFIG_LEDS_TRIGGERS=y 80CONFIG_LEDS_TRIGGERS=y
80CONFIG_LEDS_TRIGGER_HEARTBEAT=y 81CONFIG_LEDS_TRIGGER_HEARTBEAT=y
82CONFIG_LEDS_TRIGGER_CPU=y
81CONFIG_RTC_CLASS=y 83CONFIG_RTC_CLASS=y
82CONFIG_RTC_DRV_DS1307=y 84CONFIG_RTC_DRV_DS1307=y
83CONFIG_RTC_DRV_PL031=y 85CONFIG_RTC_DRV_PL031=y
diff --git a/arch/arm/configs/realview_defconfig b/arch/arm/configs/realview_defconfig
index 7079cbe898a8..d02e9d911bb7 100644
--- a/arch/arm/configs/realview_defconfig
+++ b/arch/arm/configs/realview_defconfig
@@ -75,8 +75,10 @@ CONFIG_MMC=y
75CONFIG_MMC_ARMMMCI=y 75CONFIG_MMC_ARMMMCI=y
76CONFIG_NEW_LEDS=y 76CONFIG_NEW_LEDS=y
77CONFIG_LEDS_CLASS=y 77CONFIG_LEDS_CLASS=y
78CONFIG_LEDS_VERSATILE=y
78CONFIG_LEDS_TRIGGERS=y 79CONFIG_LEDS_TRIGGERS=y
79CONFIG_LEDS_TRIGGER_HEARTBEAT=y 80CONFIG_LEDS_TRIGGER_HEARTBEAT=y
81CONFIG_LEDS_TRIGGER_CPU=y
80CONFIG_RTC_CLASS=y 82CONFIG_RTC_CLASS=y
81CONFIG_RTC_DRV_DS1307=y 83CONFIG_RTC_DRV_DS1307=y
82CONFIG_RTC_DRV_PL031=y 84CONFIG_RTC_DRV_PL031=y
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 869fa18ebeb2..4414990521d3 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -137,6 +137,8 @@ CONFIG_SPI_GPIO=y
137CONFIG_GPIO_SYSFS=y 137CONFIG_GPIO_SYSFS=y
138# CONFIG_HWMON is not set 138# CONFIG_HWMON is not set
139CONFIG_SSB=m 139CONFIG_SSB=m
140CONFIG_REGULATOR=y
141CONFIG_REGULATOR_ACT8865=y
140CONFIG_FB=y 142CONFIG_FB=y
141CONFIG_BACKLIGHT_LCD_SUPPORT=y 143CONFIG_BACKLIGHT_LCD_SUPPORT=y
142# CONFIG_LCD_CLASS_DEVICE is not set 144# CONFIG_LCD_CLASS_DEVICE is not set
diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
index 83b07258a385..6d6437cbbc52 100644
--- a/arch/arm/configs/shmobile_defconfig
+++ b/arch/arm/configs/shmobile_defconfig
@@ -25,6 +25,7 @@ CONFIG_SCHED_MC=y
25CONFIG_HAVE_ARM_ARCH_TIMER=y 25CONFIG_HAVE_ARM_ARCH_TIMER=y
26CONFIG_NR_CPUS=8 26CONFIG_NR_CPUS=8
27CONFIG_AEABI=y 27CONFIG_AEABI=y
28CONFIG_HIGHMEM=y
28CONFIG_ZBOOT_ROM_TEXT=0x0 29CONFIG_ZBOOT_ROM_TEXT=0x0
29CONFIG_ZBOOT_ROM_BSS=0x0 30CONFIG_ZBOOT_ROM_BSS=0x0
30CONFIG_ARM_APPENDED_DTB=y 31CONFIG_ARM_APPENDED_DTB=y
@@ -43,6 +44,7 @@ CONFIG_DEVTMPFS=y
43CONFIG_DEVTMPFS_MOUNT=y 44CONFIG_DEVTMPFS_MOUNT=y
44CONFIG_MTD=y 45CONFIG_MTD=y
45CONFIG_MTD_M25P80=y 46CONFIG_MTD_M25P80=y
47CONFIG_EEPROM_AT24=y
46CONFIG_BLK_DEV_SD=y 48CONFIG_BLK_DEV_SD=y
47CONFIG_ATA=y 49CONFIG_ATA=y
48CONFIG_SATA_RCAR=y 50CONFIG_SATA_RCAR=y
@@ -75,9 +77,11 @@ CONFIG_SERIAL_SH_SCI=y
75CONFIG_SERIAL_SH_SCI_NR_UARTS=20 77CONFIG_SERIAL_SH_SCI_NR_UARTS=20
76CONFIG_SERIAL_SH_SCI_CONSOLE=y 78CONFIG_SERIAL_SH_SCI_CONSOLE=y
77CONFIG_I2C_GPIO=y 79CONFIG_I2C_GPIO=y
80CONFIG_I2C_SH_MOBILE=y
78CONFIG_I2C_RCAR=y 81CONFIG_I2C_RCAR=y
79CONFIG_SPI=y 82CONFIG_SPI=y
80CONFIG_SPI_RSPI=y 83CONFIG_SPI_RSPI=y
84CONFIG_SPI_SH_MSIOF=y
81CONFIG_GPIO_EM=y 85CONFIG_GPIO_EM=y
82CONFIG_GPIO_RCAR=y 86CONFIG_GPIO_RCAR=y
83# CONFIG_HWMON is not set 87# CONFIG_HWMON is not set
@@ -88,10 +92,14 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
88CONFIG_REGULATOR_GPIO=y 92CONFIG_REGULATOR_GPIO=y
89CONFIG_MEDIA_SUPPORT=y 93CONFIG_MEDIA_SUPPORT=y
90CONFIG_MEDIA_CAMERA_SUPPORT=y 94CONFIG_MEDIA_CAMERA_SUPPORT=y
95CONFIG_MEDIA_CONTROLLER=y
96CONFIG_VIDEO_V4L2_SUBDEV_API=y
91CONFIG_V4L_PLATFORM_DRIVERS=y 97CONFIG_V4L_PLATFORM_DRIVERS=y
92CONFIG_SOC_CAMERA=y 98CONFIG_SOC_CAMERA=y
93CONFIG_SOC_CAMERA_PLATFORM=y 99CONFIG_SOC_CAMERA_PLATFORM=y
94CONFIG_VIDEO_RCAR_VIN=y 100CONFIG_VIDEO_RCAR_VIN=y
101CONFIG_V4L_MEM2MEM_DRIVERS=y
102CONFIG_VIDEO_RENESAS_VSP1=y
95# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set 103# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
96CONFIG_VIDEO_ADV7180=y 104CONFIG_VIDEO_ADV7180=y
97CONFIG_DRM=y 105CONFIG_DRM=y
@@ -100,7 +108,13 @@ CONFIG_SOUND=y
100CONFIG_SND=y 108CONFIG_SND=y
101CONFIG_SND_SOC=y 109CONFIG_SND_SOC=y
102CONFIG_SND_SOC_RCAR=y 110CONFIG_SND_SOC_RCAR=y
111CONFIG_USB=y
103CONFIG_USB_RCAR_GEN2_PHY=y 112CONFIG_USB_RCAR_GEN2_PHY=y
113CONFIG_USB_EHCI_HCD=y
114CONFIG_USB_OHCI_HCD=y
115CONFIG_USB_RENESAS_USBHS=y
116CONFIG_USB_GADGET=y
117CONFIG_USB_RENESAS_USBHS_UDC=y
104CONFIG_MMC=y 118CONFIG_MMC=y
105CONFIG_MMC_SDHI=y 119CONFIG_MMC_SDHI=y
106CONFIG_MMC_SH_MMCIF=y 120CONFIG_MMC_SH_MMCIF=y
diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
index b5df4a511b0a..7209bfd62074 100644
--- a/arch/arm/configs/sunxi_defconfig
+++ b/arch/arm/configs/sunxi_defconfig
@@ -1,13 +1,17 @@
1CONFIG_NO_HZ=y 1CONFIG_NO_HZ=y
2CONFIG_HIGH_RES_TIMERS=y 2CONFIG_HIGH_RES_TIMERS=y
3CONFIG_BLK_DEV_INITRD=y 3CONFIG_BLK_DEV_INITRD=y
4CONFIG_PERF_EVENTS=y
4CONFIG_ARCH_SUNXI=y 5CONFIG_ARCH_SUNXI=y
5CONFIG_SMP=y 6CONFIG_SMP=y
6CONFIG_AEABI=y 7CONFIG_AEABI=y
7CONFIG_HIGHMEM=y 8CONFIG_HIGHMEM=y
8CONFIG_HIGHPTE=y 9CONFIG_HIGHPTE=y
10CONFIG_ARM_APPENDED_DTB=y
11CONFIG_ARM_ATAG_DTB_COMPAT=y
9CONFIG_VFP=y 12CONFIG_VFP=y
10CONFIG_NEON=y 13CONFIG_NEON=y
14CONFIG_PM_RUNTIME=y
11CONFIG_NET=y 15CONFIG_NET=y
12CONFIG_PACKET=y 16CONFIG_PACKET=y
13CONFIG_UNIX=y 17CONFIG_UNIX=y
@@ -25,8 +29,12 @@ CONFIG_IP_PNP_BOOTP=y
25CONFIG_DEVTMPFS=y 29CONFIG_DEVTMPFS=y
26CONFIG_DEVTMPFS_MOUNT=y 30CONFIG_DEVTMPFS_MOUNT=y
27CONFIG_EEPROM_SUNXI_SID=y 31CONFIG_EEPROM_SUNXI_SID=y
32CONFIG_BLK_DEV_SD=y
33CONFIG_ATA=y
34CONFIG_AHCI_SUNXI=y
28CONFIG_NETDEVICES=y 35CONFIG_NETDEVICES=y
29CONFIG_SUN4I_EMAC=y 36CONFIG_SUN4I_EMAC=y
37# CONFIG_NET_VENDOR_ARC is not set
30# CONFIG_NET_CADENCE is not set 38# CONFIG_NET_CADENCE is not set
31# CONFIG_NET_VENDOR_BROADCOM is not set 39# CONFIG_NET_VENDOR_BROADCOM is not set
32# CONFIG_NET_VENDOR_CIRRUS is not set 40# CONFIG_NET_VENDOR_CIRRUS is not set
@@ -34,38 +42,66 @@ CONFIG_SUN4I_EMAC=y
34# CONFIG_NET_VENDOR_INTEL is not set 42# CONFIG_NET_VENDOR_INTEL is not set
35# CONFIG_NET_VENDOR_MARVELL is not set 43# CONFIG_NET_VENDOR_MARVELL is not set
36# CONFIG_NET_VENDOR_MICREL is not set 44# CONFIG_NET_VENDOR_MICREL is not set
45# CONFIG_NET_VENDOR_MICROCHIP is not set
37# CONFIG_NET_VENDOR_NATSEMI is not set 46# CONFIG_NET_VENDOR_NATSEMI is not set
47# CONFIG_NET_VENDOR_SAMSUNG is not set
38# CONFIG_NET_VENDOR_SEEQ is not set 48# CONFIG_NET_VENDOR_SEEQ is not set
39# CONFIG_NET_VENDOR_SMSC is not set 49# CONFIG_NET_VENDOR_SMSC is not set
40# CONFIG_NET_VENDOR_STMICRO is not set 50CONFIG_STMMAC_ETH=y
51# CONFIG_NET_VENDOR_VIA is not set
41# CONFIG_NET_VENDOR_WIZNET is not set 52# CONFIG_NET_VENDOR_WIZNET is not set
42# CONFIG_WLAN is not set 53# CONFIG_WLAN is not set
54# CONFIG_INPUT_MOUSEDEV is not set
55# CONFIG_INPUT_KEYBOARD is not set
56# CONFIG_INPUT_MOUSE is not set
43CONFIG_SERIAL_8250=y 57CONFIG_SERIAL_8250=y
44CONFIG_SERIAL_8250_CONSOLE=y 58CONFIG_SERIAL_8250_CONSOLE=y
45CONFIG_SERIAL_8250_NR_UARTS=8 59CONFIG_SERIAL_8250_NR_UARTS=8
46CONFIG_SERIAL_8250_RUNTIME_UARTS=8 60CONFIG_SERIAL_8250_RUNTIME_UARTS=8
47CONFIG_SERIAL_8250_DW=y 61CONFIG_SERIAL_8250_DW=y
62CONFIG_SERIAL_OF_PLATFORM=y
63# CONFIG_HW_RANDOM is not set
48CONFIG_I2C=y 64CONFIG_I2C=y
49# CONFIG_I2C_COMPAT is not set
50CONFIG_I2C_CHARDEV=y 65CONFIG_I2C_CHARDEV=y
51CONFIG_I2C_MV64XXX=y 66CONFIG_I2C_MV64XXX=y
52CONFIG_SPI=y 67CONFIG_SPI=y
68CONFIG_SPI_SUN4I=y
53CONFIG_SPI_SUN6I=y 69CONFIG_SPI_SUN6I=y
54CONFIG_GPIO_SYSFS=y 70CONFIG_GPIO_SYSFS=y
71CONFIG_POWER_SUPPLY=y
72CONFIG_POWER_RESET=y
73CONFIG_POWER_RESET_SUN6I=y
55# CONFIG_HWMON is not set 74# CONFIG_HWMON is not set
56CONFIG_WATCHDOG=y 75CONFIG_WATCHDOG=y
57CONFIG_SUNXI_WATCHDOG=y 76CONFIG_SUNXI_WATCHDOG=y
58# CONFIG_USB_SUPPORT is not set 77CONFIG_MFD_AXP20X=y
78CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
79CONFIG_REGULATOR_GPIO=y
80CONFIG_USB=y
81CONFIG_USB_EHCI_HCD=y
82CONFIG_USB_EHCI_HCD_PLATFORM=y
83CONFIG_USB_OHCI_HCD=y
84CONFIG_USB_OHCI_HCD_PLATFORM=y
85CONFIG_MMC=y
86CONFIG_MMC_SUNXI=y
59CONFIG_NEW_LEDS=y 87CONFIG_NEW_LEDS=y
60CONFIG_LEDS_CLASS=y 88CONFIG_LEDS_CLASS=y
61CONFIG_LEDS_GPIO=y 89CONFIG_LEDS_GPIO=y
62CONFIG_LEDS_TRIGGERS=y 90CONFIG_LEDS_TRIGGERS=y
63CONFIG_LEDS_TRIGGER_HEARTBEAT=y 91CONFIG_LEDS_TRIGGER_HEARTBEAT=y
64CONFIG_LEDS_TRIGGER_DEFAULT_ON=y 92CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
65CONFIG_COMMON_CLK_DEBUG=y 93CONFIG_RTC_CLASS=y
94# CONFIG_RTC_INTF_SYSFS is not set
95# CONFIG_RTC_INTF_PROC is not set
96CONFIG_RTC_DRV_SUNXI=y
66# CONFIG_IOMMU_SUPPORT is not set 97# CONFIG_IOMMU_SUPPORT is not set
98CONFIG_PHY_SUN4I_USB=y
99CONFIG_EXT4_FS=y
100CONFIG_VFAT_FS=y
67CONFIG_TMPFS=y 101CONFIG_TMPFS=y
68CONFIG_NFS_FS=y 102CONFIG_NFS_FS=y
103CONFIG_NFS_V3_ACL=y
104CONFIG_NFS_V4=y
69CONFIG_ROOT_NFS=y 105CONFIG_ROOT_NFS=y
70CONFIG_NLS=y
71CONFIG_PRINTK_TIME=y 106CONFIG_PRINTK_TIME=y
107CONFIG_DEBUG_FS=y
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index 2926281368ab..fb25e2982f64 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -73,6 +73,11 @@ CONFIG_INET6_IPCOMP=y
73CONFIG_IPV6_MIP6=y 73CONFIG_IPV6_MIP6=y
74CONFIG_IPV6_TUNNEL=y 74CONFIG_IPV6_TUNNEL=y
75CONFIG_IPV6_MULTIPLE_TABLES=y 75CONFIG_IPV6_MULTIPLE_TABLES=y
76CONFIG_CAN=y
77CONFIG_CAN_RAW=y
78CONFIG_CAN_BCM=y
79CONFIG_CAN_DEV=y
80CONFIG_CAN_MCP251X=y
76CONFIG_BT=y 81CONFIG_BT=y
77CONFIG_BT_RFCOMM=y 82CONFIG_BT_RFCOMM=y
78CONFIG_BT_BNEP=y 83CONFIG_BT_BNEP=y
@@ -90,6 +95,7 @@ CONFIG_DMA_CMA=y
90CONFIG_CMA_SIZE_MBYTES=64 95CONFIG_CMA_SIZE_MBYTES=64
91CONFIG_MTD=y 96CONFIG_MTD=y
92CONFIG_MTD_M25P80=y 97CONFIG_MTD_M25P80=y
98CONFIG_MTD_SPI_NOR=y
93CONFIG_PROC_DEVICETREE=y 99CONFIG_PROC_DEVICETREE=y
94CONFIG_BLK_DEV_LOOP=y 100CONFIG_BLK_DEV_LOOP=y
95CONFIG_AD525X_DPOT=y 101CONFIG_AD525X_DPOT=y
@@ -97,6 +103,7 @@ CONFIG_AD525X_DPOT_I2C=y
97CONFIG_ICS932S401=y 103CONFIG_ICS932S401=y
98CONFIG_APDS9802ALS=y 104CONFIG_APDS9802ALS=y
99CONFIG_ISL29003=y 105CONFIG_ISL29003=y
106CONFIG_EEPROM_AT24=y
100CONFIG_SCSI=y 107CONFIG_SCSI=y
101CONFIG_BLK_DEV_SD=y 108CONFIG_BLK_DEV_SD=y
102CONFIG_BLK_DEV_SR=y 109CONFIG_BLK_DEV_SR=y
@@ -112,6 +119,7 @@ CONFIG_USB_NET_SMSC95XX=y
112CONFIG_BRCMFMAC=m 119CONFIG_BRCMFMAC=m
113CONFIG_RT2X00=y 120CONFIG_RT2X00=y
114CONFIG_RT2800USB=m 121CONFIG_RT2800USB=m
122CONFIG_INPUT_JOYDEV=y
115CONFIG_INPUT_EVDEV=y 123CONFIG_INPUT_EVDEV=y
116CONFIG_KEYBOARD_GPIO=y 124CONFIG_KEYBOARD_GPIO=y
117CONFIG_KEYBOARD_TEGRA=y 125CONFIG_KEYBOARD_TEGRA=y
@@ -181,6 +189,7 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y
181# CONFIG_BACKLIGHT_GENERIC is not set 189# CONFIG_BACKLIGHT_GENERIC is not set
182CONFIG_BACKLIGHT_PWM=y 190CONFIG_BACKLIGHT_PWM=y
183CONFIG_FRAMEBUFFER_CONSOLE=y 191CONFIG_FRAMEBUFFER_CONSOLE=y
192CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
184CONFIG_LOGO=y 193CONFIG_LOGO=y
185CONFIG_SOUND=y 194CONFIG_SOUND=y
186CONFIG_SND=y 195CONFIG_SND=y
@@ -222,6 +231,7 @@ CONFIG_LEDS_TRIGGER_TRANSIENT=y
222CONFIG_LEDS_TRIGGER_CAMERA=y 231CONFIG_LEDS_TRIGGER_CAMERA=y
223CONFIG_RTC_CLASS=y 232CONFIG_RTC_CLASS=y
224CONFIG_RTC_DRV_AS3722=y 233CONFIG_RTC_DRV_AS3722=y
234CONFIG_RTC_DRV_DS1307=y
225CONFIG_RTC_DRV_MAX8907=y 235CONFIG_RTC_DRV_MAX8907=y
226CONFIG_RTC_DRV_PALMAS=y 236CONFIG_RTC_DRV_PALMAS=y
227CONFIG_RTC_DRV_TPS6586X=y 237CONFIG_RTC_DRV_TPS6586X=y
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index 073541a50e23..d52b4ffe2012 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -61,6 +61,9 @@ CONFIG_SND_ARMAACI=m
61CONFIG_MMC=y 61CONFIG_MMC=y
62CONFIG_MMC_ARMMMCI=m 62CONFIG_MMC_ARMMMCI=m
63CONFIG_NEW_LEDS=y 63CONFIG_NEW_LEDS=y
64CONFIG_LEDS_CLASS=y
65CONFIG_LEDS_VERSATILE=y
66CONFIG_LEDS_TRIGGERS=y
64CONFIG_LEDS_TRIGGER_HEARTBEAT=y 67CONFIG_LEDS_TRIGGER_HEARTBEAT=y
65CONFIG_LEDS_TRIGGER_CPU=y 68CONFIG_LEDS_TRIGGER_CPU=y
66CONFIG_EXT2_FS=y 69CONFIG_EXT2_FS=y
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index 680a83e94467..7e95d8535e24 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -31,11 +31,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
31} 31}
32#endif /* CONFIG_PCI_DOMAINS */ 32#endif /* CONFIG_PCI_DOMAINS */
33 33
34static inline void pcibios_penalize_isa_irq(int irq, int active)
35{
36 /* We don't do dynamic PCI IRQ allocation */
37}
38
39/* 34/*
40 * The PCI address space does equal the physical memory address space. 35 * The PCI address space does equal the physical memory address space.
41 * The networking and block device layers use this boolean for bounce 36 * The networking and block device layers use this boolean for bounce
diff --git a/arch/arm/include/asm/trusted_foundations.h b/arch/arm/include/asm/trusted_foundations.h
index b5f7705abcb0..624e1d436c6c 100644
--- a/arch/arm/include/asm/trusted_foundations.h
+++ b/arch/arm/include/asm/trusted_foundations.h
@@ -54,7 +54,9 @@ static inline void register_trusted_foundations(
54 */ 54 */
55 pr_err("No support for Trusted Foundations, continuing in degraded mode.\n"); 55 pr_err("No support for Trusted Foundations, continuing in degraded mode.\n");
56 pr_err("Secondary processors as well as CPU PM will be disabled.\n"); 56 pr_err("Secondary processors as well as CPU PM will be disabled.\n");
57#if IS_ENABLED(CONFIG_SMP)
57 setup_max_cpus = 0; 58 setup_max_cpus = 0;
59#endif
58 cpu_idle_poll_ctrl(true); 60 cpu_idle_poll_ctrl(true);
59} 61}
60 62
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 12c3a5decc60..75d95799b6e6 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -171,8 +171,9 @@ extern int __put_user_8(void *, unsigned long long);
171#define __put_user_check(x,p) \ 171#define __put_user_check(x,p) \
172 ({ \ 172 ({ \
173 unsigned long __limit = current_thread_info()->addr_limit - 1; \ 173 unsigned long __limit = current_thread_info()->addr_limit - 1; \
174 const typeof(*(p)) __user *__tmp_p = (p); \
174 register const typeof(*(p)) __r2 asm("r2") = (x); \ 175 register const typeof(*(p)) __r2 asm("r2") = (x); \
175 register const typeof(*(p)) __user *__p asm("r0") = (p);\ 176 register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \
176 register unsigned long __l asm("r1") = __limit; \ 177 register unsigned long __l asm("r1") = __limit; \
177 register int __e asm("r0"); \ 178 register int __e asm("r0"); \
178 switch (sizeof(*(__p))) { \ 179 switch (sizeof(*(__p))) { \
diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h
index 7704e28c3483..712b50e0a6dc 100644
--- a/arch/arm/include/asm/xen/hypercall.h
+++ b/arch/arm/include/asm/xen/hypercall.h
@@ -34,6 +34,7 @@
34#define _ASM_ARM_XEN_HYPERCALL_H 34#define _ASM_ARM_XEN_HYPERCALL_H
35 35
36#include <xen/interface/xen.h> 36#include <xen/interface/xen.h>
37#include <xen/interface/sched.h>
37 38
38long privcmd_call(unsigned call, unsigned long a1, 39long privcmd_call(unsigned call, unsigned long a1,
39 unsigned long a2, unsigned long a3, 40 unsigned long a2, unsigned long a3,
@@ -48,6 +49,16 @@ int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
48int HYPERVISOR_physdev_op(int cmd, void *arg); 49int HYPERVISOR_physdev_op(int cmd, void *arg);
49int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args); 50int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
50int HYPERVISOR_tmem_op(void *arg); 51int HYPERVISOR_tmem_op(void *arg);
52int HYPERVISOR_multicall(struct multicall_entry *calls, uint32_t nr);
53
54static inline int
55HYPERVISOR_suspend(unsigned long start_info_mfn)
56{
57 struct sched_shutdown r = { .reason = SHUTDOWN_suspend };
58
59 /* start_info_mfn is unused on ARM */
60 return HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
61}
51 62
52static inline void 63static inline void
53MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va, 64MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
@@ -63,9 +74,4 @@ MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
63 BUG(); 74 BUG();
64} 75}
65 76
66static inline int
67HYPERVISOR_multicall(void *call_list, int nr_calls)
68{
69 BUG();
70}
71#endif /* _ASM_ARM_XEN_HYPERCALL_H */ 77#endif /* _ASM_ARM_XEN_HYPERCALL_H */
diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h
index 1151188bcd83..50066006e6bd 100644
--- a/arch/arm/include/asm/xen/interface.h
+++ b/arch/arm/include/asm/xen/interface.h
@@ -40,6 +40,8 @@ typedef uint64_t xen_pfn_t;
40#define PRI_xen_pfn "llx" 40#define PRI_xen_pfn "llx"
41typedef uint64_t xen_ulong_t; 41typedef uint64_t xen_ulong_t;
42#define PRI_xen_ulong "llx" 42#define PRI_xen_ulong "llx"
43typedef int64_t xen_long_t;
44#define PRI_xen_long "llx"
43/* Guest handles for primitive C types. */ 45/* Guest handles for primitive C types. */
44__DEFINE_GUEST_HANDLE(uchar, unsigned char); 46__DEFINE_GUEST_HANDLE(uchar, unsigned char);
45__DEFINE_GUEST_HANDLE(uint, unsigned int); 47__DEFINE_GUEST_HANDLE(uint, unsigned int);
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index cf4f3e867395..ded062f9b358 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -77,7 +77,6 @@ static inline xpaddr_t machine_to_phys(xmaddr_t machine)
77} 77}
78/* VIRT <-> MACHINE conversion */ 78/* VIRT <-> MACHINE conversion */
79#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v)))) 79#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
80#define virt_to_pfn(v) (PFN_DOWN(__pa(v)))
81#define virt_to_mfn(v) (pfn_to_mfn(virt_to_pfn(v))) 80#define virt_to_mfn(v) (pfn_to_mfn(virt_to_pfn(v)))
82#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) 81#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
83 82
diff --git a/arch/arm/include/debug/imx-uart.h b/arch/arm/include/debug/imx-uart.h
index 42b823cd2d22..032a316eb802 100644
--- a/arch/arm/include/debug/imx-uart.h
+++ b/arch/arm/include/debug/imx-uart.h
@@ -81,6 +81,15 @@
81#define IMX6SL_UART_BASE_ADDR(n) IMX6SL_UART##n##_BASE_ADDR 81#define IMX6SL_UART_BASE_ADDR(n) IMX6SL_UART##n##_BASE_ADDR
82#define IMX6SL_UART_BASE(n) IMX6SL_UART_BASE_ADDR(n) 82#define IMX6SL_UART_BASE(n) IMX6SL_UART_BASE_ADDR(n)
83 83
84#define IMX6SX_UART1_BASE_ADDR 0x02020000
85#define IMX6SX_UART2_BASE_ADDR 0x021e8000
86#define IMX6SX_UART3_BASE_ADDR 0x021ec000
87#define IMX6SX_UART4_BASE_ADDR 0x021f0000
88#define IMX6SX_UART5_BASE_ADDR 0x021f4000
89#define IMX6SX_UART6_BASE_ADDR 0x022a0000
90#define IMX6SX_UART_BASE_ADDR(n) IMX6SX_UART##n##_BASE_ADDR
91#define IMX6SX_UART_BASE(n) IMX6SX_UART_BASE_ADDR(n)
92
84#define IMX_DEBUG_UART_BASE(soc) soc##_UART_BASE(CONFIG_DEBUG_IMX_UART_PORT) 93#define IMX_DEBUG_UART_BASE(soc) soc##_UART_BASE(CONFIG_DEBUG_IMX_UART_PORT)
85 94
86#ifdef CONFIG_DEBUG_IMX1_UART 95#ifdef CONFIG_DEBUG_IMX1_UART
@@ -103,6 +112,8 @@
103#define UART_PADDR IMX_DEBUG_UART_BASE(IMX6Q) 112#define UART_PADDR IMX_DEBUG_UART_BASE(IMX6Q)
104#elif defined(CONFIG_DEBUG_IMX6SL_UART) 113#elif defined(CONFIG_DEBUG_IMX6SL_UART)
105#define UART_PADDR IMX_DEBUG_UART_BASE(IMX6SL) 114#define UART_PADDR IMX_DEBUG_UART_BASE(IMX6SL)
115#elif defined(CONFIG_DEBUG_IMX6SX_UART)
116#define UART_PADDR IMX_DEBUG_UART_BASE(IMX6SX)
106#endif 117#endif
107 118
108#endif /* __DEBUG_IMX_UART_H */ 119#endif /* __DEBUG_IMX_UART_H */
diff --git a/arch/arm/include/debug/msm.S b/arch/arm/include/debug/msm.S
index 9d653d475903..9ef57612811d 100644
--- a/arch/arm/include/debug/msm.S
+++ b/arch/arm/include/debug/msm.S
@@ -15,51 +15,15 @@
15 * 15 *
16 */ 16 */
17 17
18#if defined(CONFIG_ARCH_MSM7X00A) || defined(CONFIG_ARCH_QSD8X50)
19#define MSM_UART1_PHYS 0xA9A00000
20#define MSM_UART2_PHYS 0xA9B00000
21#define MSM_UART3_PHYS 0xA9C00000
22#elif defined(CONFIG_ARCH_MSM7X30)
23#define MSM_UART1_PHYS 0xACA00000
24#define MSM_UART2_PHYS 0xACB00000
25#define MSM_UART3_PHYS 0xACC00000
26#endif
27
28#if defined(CONFIG_DEBUG_MSM_UART1)
29#define MSM_DEBUG_UART_BASE 0xE1000000
30#define MSM_DEBUG_UART_PHYS MSM_UART1_PHYS
31#elif defined(CONFIG_DEBUG_MSM_UART2)
32#define MSM_DEBUG_UART_BASE 0xE1000000
33#define MSM_DEBUG_UART_PHYS MSM_UART2_PHYS
34#elif defined(CONFIG_DEBUG_MSM_UART3)
35#define MSM_DEBUG_UART_BASE 0xE1000000
36#define MSM_DEBUG_UART_PHYS MSM_UART3_PHYS
37#endif
38
39#ifdef CONFIG_DEBUG_MSM8660_UART
40#define MSM_DEBUG_UART_BASE 0xF0040000
41#define MSM_DEBUG_UART_PHYS 0x19C40000
42#endif
43
44#ifdef CONFIG_DEBUG_MSM8960_UART
45#define MSM_DEBUG_UART_BASE 0xF0040000
46#define MSM_DEBUG_UART_PHYS 0x16440000
47#endif
48
49#ifdef CONFIG_DEBUG_MSM8974_UART
50#define MSM_DEBUG_UART_BASE 0xFA71E000
51#define MSM_DEBUG_UART_PHYS 0xF991E000
52#endif
53
54 .macro addruart, rp, rv, tmp 18 .macro addruart, rp, rv, tmp
55#ifdef MSM_DEBUG_UART_PHYS 19#ifdef CONFIG_DEBUG_UART_PHYS
56 ldr \rp, =MSM_DEBUG_UART_PHYS 20 ldr \rp, =CONFIG_DEBUG_UART_PHYS
57 ldr \rv, =MSM_DEBUG_UART_BASE 21 ldr \rv, =CONFIG_DEBUG_UART_VIRT
58#endif 22#endif
59 .endm 23 .endm
60 24
61 .macro senduart, rd, rx 25 .macro senduart, rd, rx
62#ifdef CONFIG_MSM_HAS_DEBUG_UART_HS 26#ifdef CONFIG_DEBUG_QCOM_UARTDM
63 @ Write the 1 character to UARTDM_TF 27 @ Write the 1 character to UARTDM_TF
64 str \rd, [\rx, #0x70] 28 str \rd, [\rx, #0x70]
65#else 29#else
@@ -68,7 +32,7 @@
68 .endm 32 .endm
69 33
70 .macro waituart, rd, rx 34 .macro waituart, rd, rx
71#ifdef CONFIG_MSM_HAS_DEBUG_UART_HS 35#ifdef CONFIG_DEBUG_QCOM_UARTDM
72 @ check for TX_EMT in UARTDM_SR 36 @ check for TX_EMT in UARTDM_SR
73 ldr \rd, [\rx, #0x08] 37 ldr \rd, [\rx, #0x08]
74 tst \rd, #0x08 38 tst \rd, #0x08
diff --git a/arch/arm/include/debug/s3c24xx.S b/arch/arm/include/debug/s3c24xx.S
new file mode 100644
index 000000000000..b1f54dc4888c
--- /dev/null
+++ b/arch/arm/include/debug/s3c24xx.S
@@ -0,0 +1,46 @@
1/* arch/arm/mach-s3c2410/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Copyright (C) 2005 Simtec Electronics
7 *
8 * Moved from linux/arch/arm/kernel/debug.S 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#define S3C2410_UART1_OFF (0x4000)
18
19 .macro addruart, rp, rv, tmp
20 ldr \rp, = CONFIG_DEBUG_UART_PHYS
21 ldr \rv, = CONFIG_DEBUG_UART_VIRT
22 .endm
23
24 .macro fifo_full_s3c2410 rd, rx
25 ldr \rd, [\rx, # S3C2410_UFSTAT]
26 tst \rd, #S3C2410_UFSTAT_TXFULL
27 .endm
28
29 .macro fifo_level_s3c2410 rd, rx
30 ldr \rd, [\rx, # S3C2410_UFSTAT]
31 and \rd, \rd, #S3C2410_UFSTAT_TXMASK
32 .endm
33
34/* Select the correct implementation depending on the configuration. The
35 * S3C2440 will get selected by default, as these are the most widely
36 * used variants of these
37*/
38
39#if defined(CONFIG_DEBUG_S3C2410_UART)
40#define fifo_full fifo_full_s3c2410
41#define fifo_level fifo_level_s3c2410
42#endif
43
44/* include the reset of the code which will do the work */
45
46#include <debug/samsung.S>
diff --git a/arch/arm/include/debug/vf.S b/arch/arm/include/debug/vf.S
index ba12cc44b2cb..b88933849a17 100644
--- a/arch/arm/include/debug/vf.S
+++ b/arch/arm/include/debug/vf.S
@@ -7,9 +7,20 @@
7 * 7 *
8 */ 8 */
9 9
10#define VF_UART0_BASE_ADDR 0x40027000
11#define VF_UART1_BASE_ADDR 0x40028000
12#define VF_UART2_BASE_ADDR 0x40029000
13#define VF_UART3_BASE_ADDR 0x4002a000
14#define VF_UART_BASE_ADDR(n) VF_UART##n##_BASE_ADDR
15#define VF_UART_BASE(n) VF_UART_BASE_ADDR(n)
16#define VF_UART_PHYSICAL_BASE VF_UART_BASE(CONFIG_DEBUG_VF_UART_PORT)
17
18#define VF_UART_VIRTUAL_BASE 0xfe000000
19
10 .macro addruart, rp, rv, tmp 20 .macro addruart, rp, rv, tmp
11 ldr \rp, =0x40028000 @ physical 21 ldr \rp, =VF_UART_PHYSICAL_BASE @ physical
12 ldr \rv, =0xfe028000 @ virtual 22 and \rv, \rp, #0xffffff @ offset within 16MB section
23 add \rv, \rv, #VF_UART_VIRTUAL_BASE
13 .endm 24 .endm
14 25
15 .macro senduart, rd, rx 26 .macro senduart, rd, rx
diff --git a/arch/arm/include/debug/zynq.S b/arch/arm/include/debug/zynq.S
index 0b762fafa758..bd13dedbdeff 100644
--- a/arch/arm/include/debug/zynq.S
+++ b/arch/arm/include/debug/zynq.S
@@ -20,18 +20,18 @@
20#define UART_SR_TXEMPTY 0x00000008 /* TX FIFO empty */ 20#define UART_SR_TXEMPTY 0x00000008 /* TX FIFO empty */
21 21
22#define UART0_PHYS 0xE0000000 22#define UART0_PHYS 0xE0000000
23#define UART0_VIRT 0xF0000000
23#define UART1_PHYS 0xE0001000 24#define UART1_PHYS 0xE0001000
24#define UART_SIZE SZ_4K 25#define UART1_VIRT 0xF0001000
25#define UART_VIRT 0xF0001000
26 26
27#if IS_ENABLED(CONFIG_DEBUG_ZYNQ_UART1) 27#if IS_ENABLED(CONFIG_DEBUG_ZYNQ_UART1)
28# define LL_UART_PADDR UART1_PHYS 28# define LL_UART_PADDR UART1_PHYS
29# define LL_UART_VADDR UART1_VIRT
29#else 30#else
30# define LL_UART_PADDR UART0_PHYS 31# define LL_UART_PADDR UART0_PHYS
32# define LL_UART_VADDR UART0_VIRT
31#endif 33#endif
32 34
33#define LL_UART_VADDR UART_VIRT
34
35 .macro addruart, rp, rv, tmp 35 .macro addruart, rp, rv, tmp
36 ldr \rp, =LL_UART_PADDR @ physical 36 ldr \rp, =LL_UART_PADDR @ physical
37 ldr \rv, =LL_UART_VADDR @ virtual 37 ldr \rv, =LL_UART_VADDR @ virtual
@@ -43,12 +43,14 @@
43 43
44 .macro waituart,rd,rx 44 .macro waituart,rd,rx
451001: ldr \rd, [\rx, #UART_SR_OFFSET] 451001: ldr \rd, [\rx, #UART_SR_OFFSET]
46ARM_BE8( rev \rd, \rd )
46 tst \rd, #UART_SR_TXEMPTY 47 tst \rd, #UART_SR_TXEMPTY
47 beq 1001b 48 beq 1001b
48 .endm 49 .endm
49 50
50 .macro busyuart,rd,rx 51 .macro busyuart,rd,rx
511002: ldr \rd, [\rx, #UART_SR_OFFSET] @ get status register 521002: ldr \rd, [\rx, #UART_SR_OFFSET] @ get status register
53ARM_BE8( rev \rd, \rd )
52 tst \rd, #UART_SR_TXFULL @ 54 tst \rd, #UART_SR_TXFULL @
53 bne 1002b @ wait if FIFO is full 55 bne 1002b @ wait if FIFO is full
54 .endm 56 .endm
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 16d43cd45619..17a26c17f7f5 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -545,6 +545,18 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw)
545 */ 545 */
546 pci_bus_add_devices(bus); 546 pci_bus_add_devices(bus);
547 } 547 }
548
549 list_for_each_entry(sys, &head, node) {
550 struct pci_bus *bus = sys->bus;
551
552 /* Configure PCI Express settings */
553 if (bus && !pci_has_flag(PCI_PROBE_ONLY)) {
554 struct pci_bus *child;
555
556 list_for_each_entry(child, &bus->children, node)
557 pcie_bus_configure_settings(child);
558 }
559 }
548} 560}
549 561
550#ifndef CONFIG_PCI_HOST_ITE8152 562#ifndef CONFIG_PCI_HOST_ITE8152
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 1420725142ca..efb208de75ec 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -132,6 +132,10 @@
132 orrne r5, V7M_xPSR_FRAMEPTRALIGN 132 orrne r5, V7M_xPSR_FRAMEPTRALIGN
133 biceq r5, V7M_xPSR_FRAMEPTRALIGN 133 biceq r5, V7M_xPSR_FRAMEPTRALIGN
134 134
135 @ ensure bit 0 is cleared in the PC, otherwise behaviour is
136 @ unpredictable
137 bic r4, #1
138
135 @ write basic exception frame 139 @ write basic exception frame
136 stmdb r2!, {r1, r3-r5} 140 stmdb r2!, {r1, r3-r5}
137 ldmia sp, {r1, r3-r5} 141 ldmia sp, {r1, r3-r5}
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index 3c217694ebec..cb791ac6a003 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -285,7 +285,7 @@ static int unwind_exec_pop_r4_to_rN(struct unwind_ctrl_block *ctrl,
285 if (unwind_pop_register(ctrl, &vsp, reg)) 285 if (unwind_pop_register(ctrl, &vsp, reg))
286 return -URC_FAILURE; 286 return -URC_FAILURE;
287 287
288 if (insn & 0x80) 288 if (insn & 0x8)
289 if (unwind_pop_register(ctrl, &vsp, 14)) 289 if (unwind_pop_register(ctrl, &vsp, 14))
290 return -URC_FAILURE; 290 return -URC_FAILURE;
291 291
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 14a6e35801ff..adcfb88a5d7d 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -1307,19 +1307,19 @@ static struct platform_device at91_adc_device = {
1307static struct at91_adc_trigger at91_adc_triggers[] = { 1307static struct at91_adc_trigger at91_adc_triggers[] = {
1308 [0] = { 1308 [0] = {
1309 .name = "timer-counter-0", 1309 .name = "timer-counter-0",
1310 .value = AT91_ADC_TRGSEL_TC0 | AT91_ADC_TRGEN, 1310 .value = 0x1,
1311 }, 1311 },
1312 [1] = { 1312 [1] = {
1313 .name = "timer-counter-1", 1313 .name = "timer-counter-1",
1314 .value = AT91_ADC_TRGSEL_TC1 | AT91_ADC_TRGEN, 1314 .value = 0x3,
1315 }, 1315 },
1316 [2] = { 1316 [2] = {
1317 .name = "timer-counter-2", 1317 .name = "timer-counter-2",
1318 .value = AT91_ADC_TRGSEL_TC2 | AT91_ADC_TRGEN, 1318 .value = 0x5,
1319 }, 1319 },
1320 [3] = { 1320 [3] = {
1321 .name = "external", 1321 .name = "external",
1322 .value = AT91_ADC_TRGSEL_EXTERNAL | AT91_ADC_TRGEN, 1322 .value = 0xd,
1323 .is_external = true, 1323 .is_external = true,
1324 }, 1324 },
1325}; 1325};
diff --git a/arch/arm/mach-axxia/Kconfig b/arch/arm/mach-axxia/Kconfig
new file mode 100644
index 000000000000..8be7e0ae1922
--- /dev/null
+++ b/arch/arm/mach-axxia/Kconfig
@@ -0,0 +1,16 @@
1config ARCH_AXXIA
2 bool "LSI Axxia platforms" if (ARCH_MULTI_V7 && ARM_LPAE)
3 select ARCH_DMA_ADDR_T_64BIT
4 select ARM_AMBA
5 select ARM_GIC
6 select ARM_TIMER_SP804
7 select HAVE_ARM_ARCH_TIMER
8 select MFD_SYSCON
9 select MIGHT_HAVE_PCI
10 select PCI_DOMAINS if PCI
11 select ZONE_DMA
12 help
13 This enables support for the LSI Axxia devices.
14
15 The LSI Axxia platforms require a Flattened Device Tree to be passed
16 to the kernel.
diff --git a/arch/arm/mach-axxia/Makefile b/arch/arm/mach-axxia/Makefile
new file mode 100644
index 000000000000..ec4f68b460c6
--- /dev/null
+++ b/arch/arm/mach-axxia/Makefile
@@ -0,0 +1,2 @@
1obj-y += axxia.o
2obj-$(CONFIG_SMP) += platsmp.o
diff --git a/arch/arm/mach-axxia/axxia.c b/arch/arm/mach-axxia/axxia.c
new file mode 100644
index 000000000000..19e5a1d95397
--- /dev/null
+++ b/arch/arm/mach-axxia/axxia.c
@@ -0,0 +1,28 @@
1/*
2 * Support for the LSI Axxia SoC devices based on ARM cores.
3 *
4 * Copyright (C) 2012 LSI
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#include <linux/init.h>
17#include <asm/mach/arch.h>
18
19static const char *axxia_dt_match[] __initconst = {
20 "lsi,axm5516",
21 "lsi,axm5516-sim",
22 "lsi,axm5516-emu",
23 NULL
24};
25
26DT_MACHINE_START(AXXIA_DT, "LSI Axxia AXM55XX")
27 .dt_compat = axxia_dt_match,
28MACHINE_END
diff --git a/arch/arm/mach-axxia/platsmp.c b/arch/arm/mach-axxia/platsmp.c
new file mode 100644
index 000000000000..959d4df3d2b6
--- /dev/null
+++ b/arch/arm/mach-axxia/platsmp.c
@@ -0,0 +1,89 @@
1/*
2 * linux/arch/arm/mach-axxia/platsmp.c
3 *
4 * Copyright (C) 2012 LSI Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/init.h>
12#include <linux/io.h>
13#include <linux/smp.h>
14#include <linux/of.h>
15#include <linux/of_address.h>
16#include <asm/cacheflush.h>
17
18/* Syscon register offsets for releasing cores from reset */
19#define SC_CRIT_WRITE_KEY 0x1000
20#define SC_RST_CPU_HOLD 0x1010
21
22/*
23 * Write the kernel entry point for secondary CPUs to the specified address
24 */
25static void write_release_addr(u32 release_phys)
26{
27 u32 *virt = (u32 *) phys_to_virt(release_phys);
28 writel_relaxed(virt_to_phys(secondary_startup), virt);
29 /* Make sure this store is visible to other CPUs */
30 smp_wmb();
31 __cpuc_flush_dcache_area(virt, sizeof(u32));
32}
33
34static int axxia_boot_secondary(unsigned int cpu, struct task_struct *idle)
35{
36 struct device_node *syscon_np;
37 void __iomem *syscon;
38 u32 tmp;
39
40 syscon_np = of_find_compatible_node(NULL, NULL, "lsi,axxia-syscon");
41 if (!syscon_np)
42 return -ENOENT;
43
44 syscon = of_iomap(syscon_np, 0);
45 if (!syscon)
46 return -ENOMEM;
47
48 tmp = readl(syscon + SC_RST_CPU_HOLD);
49 writel(0xab, syscon + SC_CRIT_WRITE_KEY);
50 tmp &= ~(1 << cpu);
51 writel(tmp, syscon + SC_RST_CPU_HOLD);
52
53 return 0;
54}
55
56static void __init axxia_smp_prepare_cpus(unsigned int max_cpus)
57{
58 int cpu_count = 0;
59 int cpu;
60
61 /*
62 * Initialise the present map, which describes the set of CPUs actually
63 * populated at the present time.
64 */
65 for_each_possible_cpu(cpu) {
66 struct device_node *np;
67 u32 release_phys;
68
69 np = of_get_cpu_node(cpu, NULL);
70 if (!np)
71 continue;
72 if (of_property_read_u32(np, "cpu-release-addr", &release_phys))
73 continue;
74
75 if (cpu_count < max_cpus) {
76 set_cpu_present(cpu, true);
77 cpu_count++;
78 }
79
80 if (release_phys != 0)
81 write_release_addr(release_phys);
82 }
83}
84
85static struct smp_operations axxia_smp_ops __initdata = {
86 .smp_prepare_cpus = axxia_smp_prepare_cpus,
87 .smp_boot_secondary = axxia_boot_secondary,
88};
89CPU_METHOD_OF_DECLARE(axxia_smp, "lsi,syscon-release", &axxia_smp_ops);
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 49c914cd9c7a..9bc6db1c1348 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -1,31 +1,58 @@
1config ARCH_BCM 1config ARCH_BCM
2 bool "Broadcom SoC Support" 2 bool "Broadcom SoC Support" if ARCH_MULTI_V6_V7
3 depends on ARCH_MULTIPLATFORM
4 help 3 help
5 This enables support for Broadcom ARM based SoC 4 This enables support for Broadcom ARM based SoC chips
6 chips
7
8if ARCH_BCM
9 5
10menu "Broadcom SoC Selection" 6menu "Broadcom SoC Selection"
7 depends on ARCH_BCM
11 8
12config ARCH_BCM_MOBILE 9config ARCH_BCM_MOBILE
13 bool "Broadcom Mobile SoC" if ARCH_MULTI_V7 10 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7
14 depends on MMU
15 select ARCH_REQUIRE_GPIOLIB 11 select ARCH_REQUIRE_GPIOLIB
16 select ARM_ERRATA_754322 12 select ARM_ERRATA_754322
17 select ARM_ERRATA_764369 if SMP 13 select ARM_ERRATA_764369 if SMP
14 select ARM_ERRATA_775420
18 select ARM_GIC 15 select ARM_GIC
19 select GPIO_BCM_KONA 16 select GPIO_BCM_KONA
20 select TICK_ONESHOT 17 select TICK_ONESHOT
21 select CACHE_L2X0
22 select HAVE_ARM_ARCH_TIMER 18 select HAVE_ARM_ARCH_TIMER
23 select PINCTRL 19 select PINCTRL
24 help 20 help
25 This enables support for systems based on Broadcom mobile SoCs. 21 This enables support for systems based on Broadcom mobile SoCs.
26 It currently supports the 'BCM281XX' family, which includes 22
27 BCM11130, BCM11140, BCM11351, BCM28145 and 23if ARCH_BCM_MOBILE
28 BCM28155 variants. 24
25menu "Broadcom Mobile SoC Selection"
26
27config ARCH_BCM_281XX
28 bool "Broadcom BCM281XX SoC family"
29 default y
30 help
31 Enable support for the the BCM281XX family, which includes
32 BCM11130, BCM11140, BCM11351, BCM28145 and BCM28155
33 variants.
34
35config ARCH_BCM_21664
36 bool "Broadcom BCM21664 SoC family"
37 default y
38 help
39 Enable support for the the BCM21664 family, which includes
40 BCM21663 and BCM21664 variants.
41
42config ARCH_BCM_MOBILE_L2_CACHE
43 bool "Broadcom mobile SoC level 2 cache support"
44 depends on (ARCH_BCM_281XX || ARCH_BCM_21664)
45 default y
46 select CACHE_L2X0
47 select ARCH_BCM_MOBILE_SMC
48
49config ARCH_BCM_MOBILE_SMC
50 bool
51 depends on ARCH_BCM_281XX || ARCH_BCM_21664
52
53endmenu
54
55endif
29 56
30config ARCH_BCM2835 57config ARCH_BCM2835
31 bool "Broadcom BCM2835 family" if ARCH_MULTI_V6 58 bool "Broadcom BCM2835 family" if ARCH_MULTI_V6
@@ -33,10 +60,7 @@ config ARCH_BCM2835
33 select ARM_AMBA 60 select ARM_AMBA
34 select ARM_ERRATA_411920 61 select ARM_ERRATA_411920
35 select ARM_TIMER_SP804 62 select ARM_TIMER_SP804
36 select CLKDEV_LOOKUP
37 select CLKSRC_OF 63 select CLKSRC_OF
38 select CPU_V6
39 select GENERIC_CLOCKEVENTS
40 select PINCTRL 64 select PINCTRL
41 select PINCTRL_BCM2835 65 select PINCTRL_BCM2835
42 help 66 help
@@ -45,17 +69,12 @@ config ARCH_BCM2835
45 69
46config ARCH_BCM_5301X 70config ARCH_BCM_5301X
47 bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7 71 bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7
48 depends on MMU
49 select ARM_GIC 72 select ARM_GIC
50 select CACHE_L2X0 73 select CACHE_L2X0
51 select HAVE_ARM_SCU if SMP 74 select HAVE_ARM_SCU if SMP
52 select HAVE_ARM_TWD if SMP 75 select HAVE_ARM_TWD if SMP
53 select HAVE_SMP
54 select COMMON_CLK
55 select GENERIC_CLOCKEVENTS
56 select ARM_GLOBAL_TIMER 76 select ARM_GLOBAL_TIMER
57 select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK 77 select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
58 select MIGHT_HAVE_PCI
59 help 78 help
60 Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores. 79 Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores.
61 80
@@ -70,5 +89,3 @@ config ARCH_BCM_5301X
70 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx 89 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx
71 90
72endmenu 91endmenu
73
74endif
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index a326b28c4406..731292114975 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -10,10 +10,23 @@
10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details. 11# GNU General Public License for more details.
12 12
13obj-$(CONFIG_ARCH_BCM_MOBILE) := board_bcm281xx.o board_bcm21664.o \ 13# BCM281XX
14 bcm_kona_smc.o bcm_kona_smc_asm.o kona.o 14obj-$(CONFIG_ARCH_BCM_281XX) += board_bcm281xx.o
15
16# BCM21664
17obj-$(CONFIG_ARCH_BCM_21664) += board_bcm21664.o
18
19# BCM281XX and BCM21664 L2 cache control
20obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o
21
22# Support for secure monitor traps
23obj-$(CONFIG_ARCH_BCM_MOBILE_SMC) += bcm_kona_smc.o
24ifeq ($(call as-instr,.arch_extension sec,as_has_sec),as_has_sec)
25CFLAGS_bcm_kona_smc.o += -Wa,-march=armv7-a+sec -DREQUIRES_SEC
26endif
27
28# BCM2835
15obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o 29obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o
16 30
17plus_sec := $(call as-instr,.arch_extension sec,+sec) 31# BCM5301X
18AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec)
19obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o 32obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
index 5e31e918f325..a55a7ecf146a 100644
--- a/arch/arm/mach-bcm/bcm_kona_smc.c
+++ b/arch/arm/mach-bcm/bcm_kona_smc.c
@@ -21,11 +21,8 @@
21 21
22#include "bcm_kona_smc.h" 22#include "bcm_kona_smc.h"
23 23
24struct secure_bridge_data { 24static u32 bcm_smc_buffer_phys; /* physical address */
25 void __iomem *bounce; /* virtual address */ 25static void __iomem *bcm_smc_buffer; /* virtual address */
26 u32 __iomem buffer_addr; /* physical address */
27 int initialized;
28} bridge_data;
29 26
30struct bcm_kona_smc_data { 27struct bcm_kona_smc_data {
31 unsigned service_id; 28 unsigned service_id;
@@ -33,6 +30,7 @@ struct bcm_kona_smc_data {
33 unsigned arg1; 30 unsigned arg1;
34 unsigned arg2; 31 unsigned arg2;
35 unsigned arg3; 32 unsigned arg3;
33 unsigned result;
36}; 34};
37 35
38static const struct of_device_id bcm_kona_smc_ids[] __initconst = { 36static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
@@ -41,59 +39,125 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
41 {}, 39 {},
42}; 40};
43 41
44/* Map in the bounce area */ 42/* Map in the args buffer area */
45int __init bcm_kona_smc_init(void) 43int __init bcm_kona_smc_init(void)
46{ 44{
47 struct device_node *node; 45 struct device_node *node;
46 const __be32 *prop_val;
47 u64 prop_size = 0;
48 unsigned long buffer_size;
49 u32 buffer_phys;
48 50
49 /* Read buffer addr and size from the device tree node */ 51 /* Read buffer addr and size from the device tree node */
50 node = of_find_matching_node(NULL, bcm_kona_smc_ids); 52 node = of_find_matching_node(NULL, bcm_kona_smc_ids);
51 if (!node) 53 if (!node)
52 return -ENODEV; 54 return -ENODEV;
53 55
54 /* Don't care about size or flags of the DT node */ 56 prop_val = of_get_address(node, 0, &prop_size, NULL);
55 bridge_data.buffer_addr = 57 if (!prop_val)
56 be32_to_cpu(*of_get_address(node, 0, NULL, NULL)); 58 return -EINVAL;
57 BUG_ON(!bridge_data.buffer_addr);
58 59
59 bridge_data.bounce = of_iomap(node, 0); 60 /* We assume space for four 32-bit arguments */
60 BUG_ON(!bridge_data.bounce); 61 if (prop_size < 4 * sizeof(u32) || prop_size > (u64)ULONG_MAX)
62 return -EINVAL;
63 buffer_size = (unsigned long)prop_size;
61 64
62 bridge_data.initialized = 1; 65 buffer_phys = be32_to_cpup(prop_val);
66 if (!buffer_phys)
67 return -EINVAL;
68
69 bcm_smc_buffer = ioremap(buffer_phys, buffer_size);
70 if (!bcm_smc_buffer)
71 return -ENOMEM;
72 bcm_smc_buffer_phys = buffer_phys;
63 73
64 pr_info("Kona Secure API initialized\n"); 74 pr_info("Kona Secure API initialized\n");
65 75
66 return 0; 76 return 0;
67} 77}
68 78
79/*
80 * int bcm_kona_do_smc(u32 service_id, u32 buffer_addr)
81 *
82 * Only core 0 can run the secure monitor code. If an "smc" request
83 * is initiated on a different core it must be redirected to core 0
84 * for execution. We rely on the caller to handle this.
85 *
86 * Each "smc" request supplies a service id and the address of a
87 * buffer containing parameters related to the service to be
88 * performed. A flags value defines the behavior of the level 2
89 * cache and interrupt handling while the secure monitor executes.
90 *
91 * Parameters to the "smc" request are passed in r4-r6 as follows:
92 * r4 service id
93 * r5 flags (SEC_ROM_*)
94 * r6 physical address of buffer with other parameters
95 *
96 * Execution of an "smc" request produces two distinct results.
97 *
98 * First, the secure monitor call itself (regardless of the specific
99 * service request) can succeed, or can produce an error. When an
100 * "smc" request completes this value is found in r12; it should
101 * always be SEC_EXIT_NORMAL.
102 *
103 * In addition, the particular service performed produces a result.
104 * The values that should be expected depend on the service. We
105 * therefore return this value to the caller, so it can handle the
106 * request result appropriately. This result value is found in r0
107 * when the "smc" request completes.
108 */
109static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
110{
111 register u32 ip asm("ip"); /* Also called r12 */
112 register u32 r0 asm("r0");
113 register u32 r4 asm("r4");
114 register u32 r5 asm("r5");
115 register u32 r6 asm("r6");
116
117 r4 = service_id;
118 r5 = 0x3; /* Keep IRQ and FIQ off in SM */
119 r6 = buffer_phys;
120
121 asm volatile (
122 /* Make sure we got the registers we want */
123 __asmeq("%0", "ip")
124 __asmeq("%1", "r0")
125 __asmeq("%2", "r4")
126 __asmeq("%3", "r5")
127 __asmeq("%4", "r6")
128#ifdef REQUIRES_SEC
129 ".arch_extension sec\n"
130#endif
131 " smc #0\n"
132 : "=r" (ip), "=r" (r0)
133 : "r" (r4), "r" (r5), "r" (r6)
134 : "r1", "r2", "r3", "r7", "lr");
135
136 BUG_ON(ip != SEC_EXIT_NORMAL);
137
138 return r0;
139}
140
69/* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */ 141/* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */
70static void __bcm_kona_smc(void *info) 142static void __bcm_kona_smc(void *info)
71{ 143{
72 struct bcm_kona_smc_data *data = info; 144 struct bcm_kona_smc_data *data = info;
73 u32 *args = bridge_data.bounce; 145 u32 *args = bcm_smc_buffer;
74 int rc = 0;
75 146
76 /* Must run on CPU 0 */
77 BUG_ON(smp_processor_id() != 0); 147 BUG_ON(smp_processor_id() != 0);
148 BUG_ON(!args);
78 149
79 /* Check map in the bounce area */ 150 /* Copy the four 32 bit argument values into the bounce area */
80 BUG_ON(!bridge_data.initialized); 151 writel_relaxed(data->arg0, args++);
81 152 writel_relaxed(data->arg1, args++);
82 /* Copy one 32 bit word into the bounce area */ 153 writel_relaxed(data->arg2, args++);
83 args[0] = data->arg0; 154 writel(data->arg3, args);
84 args[1] = data->arg1;
85 args[2] = data->arg2;
86 args[3] = data->arg3;
87 155
88 /* Flush caches for input data passed to Secure Monitor */ 156 /* Flush caches for input data passed to Secure Monitor */
89 if (data->service_id != SSAPI_BRCM_START_VC_CORE) 157 flush_cache_all();
90 flush_cache_all();
91
92 /* Trap into Secure Monitor */
93 rc = bcm_kona_smc_asm(data->service_id, bridge_data.buffer_addr);
94 158
95 if (rc != SEC_ROM_RET_OK) 159 /* Trap into Secure Monitor and record the request result */
96 pr_err("Secure Monitor call failed (0x%x)!\n", rc); 160 data->result = bcm_kona_do_smc(data->service_id, bcm_smc_buffer_phys);
97} 161}
98 162
99unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, 163unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
@@ -106,17 +170,13 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
106 data.arg1 = arg1; 170 data.arg1 = arg1;
107 data.arg2 = arg2; 171 data.arg2 = arg2;
108 data.arg3 = arg3; 172 data.arg3 = arg3;
173 data.result = 0;
109 174
110 /* 175 /*
111 * Due to a limitation of the secure monitor, we must use the SMP 176 * Due to a limitation of the secure monitor, we must use the SMP
112 * infrastructure to forward all secure monitor calls to Core 0. 177 * infrastructure to forward all secure monitor calls to Core 0.
113 */ 178 */
114 if (get_cpu() != 0) 179 smp_call_function_single(0, __bcm_kona_smc, &data, 1);
115 smp_call_function_single(0, __bcm_kona_smc, (void *)&data, 1);
116 else
117 __bcm_kona_smc(&data);
118 180
119 put_cpu(); 181 return data.result;
120
121 return 0;
122} 182}
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.h b/arch/arm/mach-bcm/bcm_kona_smc.h
index d098a7e76744..2e29ec67e414 100644
--- a/arch/arm/mach-bcm/bcm_kona_smc.h
+++ b/arch/arm/mach-bcm/bcm_kona_smc.h
@@ -15,55 +15,12 @@
15#define BCM_KONA_SMC_H 15#define BCM_KONA_SMC_H
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18#define FLAGS (SEC_ROM_ICACHE_ENABLE_MASK | SEC_ROM_DCACHE_ENABLE_MASK | \
19 SEC_ROM_IRQ_ENABLE_MASK | SEC_ROM_FIQ_ENABLE_MASK)
20 18
21/*! 19/* Broadcom Secure Service API service IDs, return codes, and exit codes */
22 * Definitions for IRQ & FIQ Mask for ARM 20#define SSAPI_ENABLE_L2_CACHE 0x01000002
23 */
24
25#define FIQ_IRQ_MASK 0xC0
26#define FIQ_MASK 0x40
27#define IRQ_MASK 0x80
28
29/*!
30 * Secure Mode FLAGs
31 */
32
33/* When set, enables ICache within the secure mode */
34#define SEC_ROM_ICACHE_ENABLE_MASK 0x00000001
35
36/* When set, enables DCache within the secure mode */
37#define SEC_ROM_DCACHE_ENABLE_MASK 0x00000002
38
39/* When set, enables IRQ within the secure mode */
40#define SEC_ROM_IRQ_ENABLE_MASK 0x00000004
41
42/* When set, enables FIQ within the secure mode */
43#define SEC_ROM_FIQ_ENABLE_MASK 0x00000008
44
45/* When set, enables Unified L2 cache within the secure mode */
46#define SEC_ROM_UL2_CACHE_ENABLE_MASK 0x00000010
47
48/* Broadcom Secure Service API Service IDs */
49#define SSAPI_DORMANT_ENTRY_SERV 0x01000000
50#define SSAPI_PUBLIC_OTP_SERV 0x01000001
51#define SSAPI_ENABLE_L2_CACHE 0x01000002
52#define SSAPI_DISABLE_L2_CACHE 0x01000003
53#define SSAPI_WRITE_SCU_STATUS 0x01000004
54#define SSAPI_WRITE_PWR_GATE 0x01000005
55
56/* Broadcom Secure Service API Return Codes */
57#define SEC_ROM_RET_OK 0x00000001 21#define SEC_ROM_RET_OK 0x00000001
58#define SEC_ROM_RET_FAIL 0x00000009
59
60#define SSAPI_RET_FROM_INT_SERV 0x4
61#define SEC_EXIT_NORMAL 0x1 22#define SEC_EXIT_NORMAL 0x1
62 23
63#define SSAPI_ROW_AES 0x0E000006
64#define SSAPI_BRCM_START_VC_CORE 0x0E000008
65
66#ifndef __ASSEMBLY__
67extern int __init bcm_kona_smc_init(void); 24extern int __init bcm_kona_smc_init(void);
68 25
69extern unsigned bcm_kona_smc(unsigned service_id, 26extern unsigned bcm_kona_smc(unsigned service_id,
@@ -72,9 +29,4 @@ extern unsigned bcm_kona_smc(unsigned service_id,
72 unsigned arg2, 29 unsigned arg2,
73 unsigned arg3); 30 unsigned arg3);
74 31
75extern int bcm_kona_smc_asm(u32 service_id,
76 u32 buffer_addr);
77
78#endif /* __ASSEMBLY__ */
79
80#endif /* BCM_KONA_SMC_H */ 32#endif /* BCM_KONA_SMC_H */
diff --git a/arch/arm/mach-bcm/bcm_kona_smc_asm.S b/arch/arm/mach-bcm/bcm_kona_smc_asm.S
deleted file mode 100644
index a1608480d60d..000000000000
--- a/arch/arm/mach-bcm/bcm_kona_smc_asm.S
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2013 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <linux/linkage.h>
15#include "bcm_kona_smc.h"
16
17/*
18 * int bcm_kona_smc_asm(u32 service_id, u32 buffer_addr)
19 */
20
21ENTRY(bcm_kona_smc_asm)
22 stmfd sp!, {r4-r12, lr}
23 mov r4, r0 @ service_id
24 mov r5, #3 @ Keep IRQ and FIQ off in SM
25 /*
26 * Since interrupts are disabled in the open mode, we must keep
27 * interrupts disabled in secure mode by setting R5=0x3. If interrupts
28 * are enabled in open mode, we can set R5=0x0 to allow interrupts in
29 * secure mode. If we did this, the secure monitor would return back
30 * control to the open mode to handle the interrupt prior to completing
31 * the secure service. If this happened, R12 would not be
32 * SEC_EXIT_NORMAL and we would need to call SMC again after resetting
33 * R5 (it gets clobbered by the secure monitor) and setting R4 to
34 * SSAPI_RET_FROM_INT_SERV to indicate that we want the secure monitor
35 * to finish up the previous uncompleted secure service.
36 */
37 mov r6, r1 @ buffer_addr
38 smc #0
39 /* Check r12 for SEC_EXIT_NORMAL here if interrupts are enabled */
40 ldmfd sp!, {r4-r12, pc}
41ENDPROC(bcm_kona_smc_asm)
diff --git a/arch/arm/mach-bcm/board_bcm21664.c b/arch/arm/mach-bcm/board_bcm21664.c
index acc1573fd005..f0521cc0640d 100644
--- a/arch/arm/mach-bcm/board_bcm21664.c
+++ b/arch/arm/mach-bcm/board_bcm21664.c
@@ -11,14 +11,13 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14#include <linux/clocksource.h>
15#include <linux/of_address.h> 14#include <linux/of_address.h>
16#include <linux/of_platform.h> 15#include <linux/of_platform.h>
16#include <linux/io.h>
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19 19
20#include "bcm_kona_smc.h" 20#include "kona_l2_cache.h"
21#include "kona.h"
22 21
23#define RSTMGR_DT_STRING "brcm,bcm21664-resetmgr" 22#define RSTMGR_DT_STRING "brcm,bcm21664-resetmgr"
24 23
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index 6be54c10f8cb..1ac59fc0cb15 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -17,7 +17,7 @@
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19 19
20#include "kona.h" 20#include "kona_l2_cache.h"
21 21
22#define SECWDOG_OFFSET 0x00000000 22#define SECWDOG_OFFSET 0x00000000
23#define SECWDOG_RESERVED_MASK 0xe2000000 23#define SECWDOG_RESERVED_MASK 0xe2000000
diff --git a/arch/arm/mach-bcm/kona.c b/arch/arm/mach-bcm/kona_l2_cache.c
index 768bc2837bf5..b31970377c20 100644
--- a/arch/arm/mach-bcm/kona.c
+++ b/arch/arm/mach-bcm/kona_l2_cache.c
@@ -11,19 +11,18 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14#include <linux/of_platform.h> 14
15#include <linux/init.h>
16#include <linux/printk.h>
15#include <asm/hardware/cache-l2x0.h> 17#include <asm/hardware/cache-l2x0.h>
16 18
17#include "bcm_kona_smc.h" 19#include "bcm_kona_smc.h"
18#include "kona.h"
19 20
20void __init kona_l2_cache_init(void) 21void __init kona_l2_cache_init(void)
21{ 22{
23 unsigned int result;
22 int ret; 24 int ret;
23 25
24 if (!IS_ENABLED(CONFIG_CACHE_L2X0))
25 return;
26
27 ret = bcm_kona_smc_init(); 26 ret = bcm_kona_smc_init();
28 if (ret) { 27 if (ret) {
29 pr_info("Secure API not available (%d). Skipping L2 init.\n", 28 pr_info("Secure API not available (%d). Skipping L2 init.\n",
@@ -31,7 +30,12 @@ void __init kona_l2_cache_init(void)
31 return; 30 return;
32 } 31 }
33 32
34 bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); 33 result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
34 if (result != SEC_ROM_RET_OK) {
35 pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
36 result);
37 return;
38 }
35 39
36 /* 40 /*
37 * The aux_val and aux_mask have no effect since L2 cache is already 41 * The aux_val and aux_mask have no effect since L2 cache is already
diff --git a/arch/arm/mach-bcm/kona.h b/arch/arm/mach-bcm/kona_l2_cache.h
index 3a7a017c29cd..46f84a95ab1c 100644
--- a/arch/arm/mach-bcm/kona.h
+++ b/arch/arm/mach-bcm/kona_l2_cache.h
@@ -11,4 +11,8 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14void __init kona_l2_cache_init(void); 14#ifdef CONFIG_ARCH_BCM_MOBILE_L2_CACHE
15void kona_l2_cache_init(void);
16#else
17#define kona_l2_cache_init() ((void)0)
18#endif
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index b0cb0722acd2..101e0f356730 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -1,9 +1,11 @@
1config ARCH_BERLIN 1config 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 ARM_GIC 4 select ARM_GIC
4 select GENERIC_IRQ_CHIP 5 select GENERIC_IRQ_CHIP
5 select DW_APB_ICTL 6 select DW_APB_ICTL
6 select DW_APB_TIMER_OF 7 select DW_APB_TIMER_OF
8 select PINCTRL
7 9
8if ARCH_BERLIN 10if ARCH_BERLIN
9 11
@@ -14,11 +16,19 @@ config MACH_BERLIN_BG2
14 select CACHE_L2X0 16 select CACHE_L2X0
15 select CPU_PJ4B 17 select CPU_PJ4B
16 select HAVE_ARM_TWD if SMP 18 select HAVE_ARM_TWD if SMP
19 select PINCTRL_BERLIN_BG2
17 20
18config MACH_BERLIN_BG2CD 21config MACH_BERLIN_BG2CD
19 bool "Marvell Armada 1500-mini (BG2CD)" 22 bool "Marvell Armada 1500-mini (BG2CD)"
20 select CACHE_L2X0 23 select CACHE_L2X0
21 select HAVE_ARM_TWD if SMP 24 select HAVE_ARM_TWD if SMP
25 select PINCTRL_BERLIN_BG2CD
26
27config MACH_BERLIN_BG2Q
28 bool "Marvell Armada 1500 Pro (BG2-Q)"
29 select CACHE_L2X0
30 select HAVE_ARM_TWD if SMP
31 select PINCTRL_BERLIN_BG2Q
22 32
23endmenu 33endmenu
24 34
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig
index dce8decd5d46..66838f42037f 100644
--- a/arch/arm/mach-cns3xxx/Kconfig
+++ b/arch/arm/mach-cns3xxx/Kconfig
@@ -1,7 +1,6 @@
1config ARCH_CNS3XXX 1config 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 MIGHT_HAVE_PCI
5 select PCI_DOMAINS if PCI 4 select PCI_DOMAINS if PCI
6 help 5 help
7 Support for Cavium Networks CNS3XXX platform. 6 Support for Cavium Networks CNS3XXX platform.
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index ecdc7d44fa70..06d63d5651f3 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -350,11 +350,7 @@ static struct davinci_mmc_config dm355evm_mmc_config = {
350 * you have proper Mini-B or Mini-A cables (or Mini-A adapters) 350 * you have proper Mini-B or Mini-A cables (or Mini-A adapters)
351 * the ID pin won't need any help. 351 * the ID pin won't need any help.
352 */ 352 */
353#ifdef CONFIG_USB_MUSB_PERIPHERAL
354#define USB_ID_VALUE 0 /* ID pulled high; *should* float */
355#else
356#define USB_ID_VALUE 1 /* ID pulled low */ 353#define USB_ID_VALUE 1 /* ID pulled low */
357#endif
358 354
359static struct spi_eeprom at25640a = { 355static struct spi_eeprom at25640a = {
360 .byte_len = SZ_64K / 8, 356 .byte_len = SZ_64K / 8,
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index 43bacbf15314..680a7a2d9102 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -208,11 +208,7 @@ static struct davinci_mmc_config dm355leopard_mmc_config = {
208 * you have proper Mini-B or Mini-A cables (or Mini-A adapters) 208 * you have proper Mini-B or Mini-A cables (or Mini-A adapters)
209 * the ID pin won't need any help. 209 * the ID pin won't need any help.
210 */ 210 */
211#ifdef CONFIG_USB_MUSB_PERIPHERAL
212#define USB_ID_VALUE 0 /* ID pulled high; *should* float */
213#else
214#define USB_ID_VALUE 1 /* ID pulled low */ 211#define USB_ID_VALUE 1 /* ID pulled low */
215#endif
216 212
217static struct spi_eeprom at25640a = { 213static struct spi_eeprom at25640a = {
218 .byte_len = SZ_64K / 8, 214 .byte_len = SZ_64K / 8,
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index fc8bf18e222d..d58995c9a95a 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -7,97 +7,102 @@
7 7
8# Configuration options for the EXYNOS4 8# Configuration options for the EXYNOS4
9 9
10config ARCH_EXYNOS
11 bool "Samsung EXYNOS" if ARCH_MULTI_V7
12 select ARCH_HAS_BANDGAP
13 select ARCH_HAS_CPUFREQ
14 select ARCH_HAS_HOLES_MEMORYMODEL
15 select ARCH_REQUIRE_GPIOLIB
16 select ARM_AMBA
17 select ARM_GIC
18 select COMMON_CLK_SAMSUNG
19 select HAVE_ARM_SCU if SMP
20 select HAVE_S3C2410_I2C if I2C
21 select HAVE_S3C2410_WATCHDOG if WATCHDOG
22 select HAVE_S3C_RTC if RTC_CLASS
23 select PINCTRL
24 select PINCTRL_EXYNOS
25 select PM_GENERIC_DOMAINS if PM_RUNTIME
26 select S5P_DEV_MFC
27 select SRAM
28 help
29 Support for SAMSUNG EXYNOS SoCs (EXYNOS4/5)
30
10if ARCH_EXYNOS 31if ARCH_EXYNOS
11 32
12menu "SAMSUNG EXYNOS SoCs Support" 33menu "SAMSUNG EXYNOS SoCs Support"
13 34
35config ARCH_EXYNOS3
36 bool "SAMSUNG EXYNOS3"
37 select ARM_CPU_SUSPEND if PM
38 help
39 Samsung EXYNOS3 (Crotex-A7) SoC based systems
40
14config ARCH_EXYNOS4 41config ARCH_EXYNOS4
15 bool "SAMSUNG EXYNOS4" 42 bool "SAMSUNG EXYNOS4"
16 default y 43 default y
17 select ARM_AMBA 44 select ARM_CPU_SUSPEND if PM_SLEEP
18 select CLKSRC_OF
19 select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210 45 select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210
20 select CPU_EXYNOS4210 46 select CPU_EXYNOS4210
21 select GIC_NON_BANKED 47 select GIC_NON_BANKED
22 select KEYBOARD_SAMSUNG if INPUT_KEYBOARD 48 select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
23 select HAVE_ARM_SCU if SMP
24 select HAVE_SMP
25 select MIGHT_HAVE_CACHE_L2X0 49 select MIGHT_HAVE_CACHE_L2X0
26 select PINCTRL
27 select PM_GENERIC_DOMAINS if PM_RUNTIME
28 select S5P_DEV_MFC
29 help 50 help
30 Samsung EXYNOS4 SoCs based systems 51 Samsung EXYNOS4 (Cortex-A9) SoC based systems
31 52
32config ARCH_EXYNOS5 53config ARCH_EXYNOS5
33 bool "SAMSUNG EXYNOS5" 54 bool "SAMSUNG EXYNOS5"
34 select ARM_AMBA 55 default y
35 select CLKSRC_OF
36 select HAVE_ARM_SCU if SMP
37 select HAVE_SMP
38 select PINCTRL
39 help 56 help
40 Samsung EXYNOS5 (Cortex-A15) SoC based systems 57 Samsung EXYNOS5 (Cortex-A15/A7) SoC based systems
41 58
42comment "EXYNOS SoCs" 59comment "EXYNOS SoCs"
43 60
61config SOC_EXYNOS3250
62 bool "SAMSUNG EXYNOS3250"
63 default y
64 depends on ARCH_EXYNOS3
65
44config CPU_EXYNOS4210 66config CPU_EXYNOS4210
45 bool "SAMSUNG EXYNOS4210" 67 bool "SAMSUNG EXYNOS4210"
46 default y 68 default y
47 depends on ARCH_EXYNOS4 69 depends on ARCH_EXYNOS4
48 select ARCH_HAS_BANDGAP
49 select ARM_CPU_SUSPEND if PM_SLEEP
50 select PINCTRL_EXYNOS
51 select SAMSUNG_DMADEV
52 help
53 Enable EXYNOS4210 CPU support
54 70
55config SOC_EXYNOS4212 71config SOC_EXYNOS4212
56 bool "SAMSUNG EXYNOS4212" 72 bool "SAMSUNG EXYNOS4212"
57 default y 73 default y
58 depends on ARCH_EXYNOS4 74 depends on ARCH_EXYNOS4
59 select ARCH_HAS_BANDGAP
60 select PINCTRL_EXYNOS
61 select SAMSUNG_DMADEV
62 help
63 Enable EXYNOS4212 SoC support
64 75
65config SOC_EXYNOS4412 76config SOC_EXYNOS4412
66 bool "SAMSUNG EXYNOS4412" 77 bool "SAMSUNG EXYNOS4412"
67 default y 78 default y
68 depends on ARCH_EXYNOS4 79 depends on ARCH_EXYNOS4
69 select ARCH_HAS_BANDGAP
70 select PINCTRL_EXYNOS
71 select SAMSUNG_DMADEV
72 help
73 Enable EXYNOS4412 SoC support
74 80
75config SOC_EXYNOS5250 81config SOC_EXYNOS5250
76 bool "SAMSUNG EXYNOS5250" 82 bool "SAMSUNG EXYNOS5250"
77 default y 83 default y
78 depends on ARCH_EXYNOS5 84 depends on ARCH_EXYNOS5
79 select ARCH_HAS_BANDGAP 85
80 select PINCTRL_EXYNOS 86config SOC_EXYNOS5260
81 select PM_GENERIC_DOMAINS if PM_RUNTIME 87 bool "SAMSUNG EXYNOS5260"
82 select S5P_DEV_MFC 88 default y
83 select SAMSUNG_DMADEV 89 depends on ARCH_EXYNOS5
84 help 90
85 Enable EXYNOS5250 SoC support 91config SOC_EXYNOS5410
92 bool "SAMSUNG EXYNOS5410"
93 default y
94 depends on ARCH_EXYNOS5
86 95
87config SOC_EXYNOS5420 96config SOC_EXYNOS5420
88 bool "SAMSUNG EXYNOS5420" 97 bool "SAMSUNG EXYNOS5420"
89 default y 98 default y
90 depends on ARCH_EXYNOS5 99 depends on ARCH_EXYNOS5
91 select PM_GENERIC_DOMAINS if PM_RUNTIME
92 help
93 Enable EXYNOS5420 SoC support
94 100
95config SOC_EXYNOS5440 101config SOC_EXYNOS5440
96 bool "SAMSUNG EXYNOS5440" 102 bool "SAMSUNG EXYNOS5440"
97 default y 103 default y
98 depends on ARCH_EXYNOS5 104 depends on ARCH_EXYNOS5
99 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 105 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
100 select ARCH_HAS_BANDGAP
101 select ARCH_HAS_OPP 106 select ARCH_HAS_OPP
102 select HAVE_ARM_ARCH_TIMER 107 select HAVE_ARM_ARCH_TIMER
103 select AUTO_ZRELADDR 108 select AUTO_ZRELADDR
@@ -108,6 +113,19 @@ config SOC_EXYNOS5440
108 help 113 help
109 Enable EXYNOS5440 SoC support 114 Enable EXYNOS5440 SoC support
110 115
116config SOC_EXYNOS5800
117 bool "SAMSUNG EXYNOS5800"
118 default y
119 depends on SOC_EXYNOS5420
120
111endmenu 121endmenu
112 122
123config EXYNOS5420_MCPM
124 bool "Exynos5420 Multi-Cluster PM support"
125 depends on MCPM && SOC_EXYNOS5420
126 select ARM_CCI
127 help
128 This is needed to provide CPU and cluster power management
129 on Exynos5420 implementing big.LITTLE.
130
113endif 131endif
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index a656dbe3b78c..9f3258880949 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -5,6 +5,8 @@
5# 5#
6# Licensed under GPLv2 6# Licensed under GPLv2
7 7
8ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
9
8obj-y := 10obj-y :=
9obj-m := 11obj-m :=
10obj-n := 12obj-n :=
@@ -12,20 +14,19 @@ obj- :=
12 14
13# Core 15# Core
14 16
15obj-$(CONFIG_ARCH_EXYNOS) += exynos.o 17obj-$(CONFIG_ARCH_EXYNOS) += exynos.o pmu.o exynos-smc.o firmware.o
16 18
17obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o 19obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o
18obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o 20obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
19obj-$(CONFIG_CPU_IDLE) += cpuidle.o 21obj-$(CONFIG_CPU_IDLE) += cpuidle.o
20 22
21obj-$(CONFIG_ARCH_EXYNOS) += pmu.o
22
23obj-$(CONFIG_SMP) += platsmp.o headsmp.o 23obj-$(CONFIG_SMP) += platsmp.o headsmp.o
24 24
25obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 25obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
26 26CFLAGS_hotplug.o += -march=armv7-a
27obj-$(CONFIG_ARCH_EXYNOS) += exynos-smc.o
28obj-$(CONFIG_ARCH_EXYNOS) += firmware.o
29 27
30plus_sec := $(call as-instr,.arch_extension sec,+sec) 28plus_sec := $(call as-instr,.arch_extension sec,+sec)
31AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec) 29AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec)
30
31obj-$(CONFIG_EXYNOS5420_MCPM) += mcpm-exynos.o
32CFLAGS_mcpm-exynos.o += -march=armv7-a
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 963c51fb606c..5dba5a1ee6c2 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -15,6 +15,102 @@
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16#include <linux/of.h> 16#include <linux/of.h>
17 17
18#define EXYNOS3250_SOC_ID 0xE3472000
19#define EXYNOS3_SOC_MASK 0xFFFFF000
20
21#define EXYNOS4210_CPU_ID 0x43210000
22#define EXYNOS4212_CPU_ID 0x43220000
23#define EXYNOS4412_CPU_ID 0xE4412200
24#define EXYNOS4_CPU_MASK 0xFFFE0000
25
26#define EXYNOS5250_SOC_ID 0x43520000
27#define EXYNOS5410_SOC_ID 0xE5410000
28#define EXYNOS5420_SOC_ID 0xE5420000
29#define EXYNOS5440_SOC_ID 0xE5440000
30#define EXYNOS5800_SOC_ID 0xE5422000
31#define EXYNOS5_SOC_MASK 0xFFFFF000
32
33extern unsigned long samsung_cpu_id;
34
35#define IS_SAMSUNG_CPU(name, id, mask) \
36static inline int is_samsung_##name(void) \
37{ \
38 return ((samsung_cpu_id & mask) == (id & mask)); \
39}
40
41IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
42IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
43IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
44IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
45IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
46IS_SAMSUNG_CPU(exynos5410, EXYNOS5410_SOC_ID, EXYNOS5_SOC_MASK)
47IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
48IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
49IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
50
51#if defined(CONFIG_SOC_EXYNOS3250)
52# define soc_is_exynos3250() is_samsung_exynos3250()
53#else
54# define soc_is_exynos3250() 0
55#endif
56
57#if defined(CONFIG_CPU_EXYNOS4210)
58# define soc_is_exynos4210() is_samsung_exynos4210()
59#else
60# define soc_is_exynos4210() 0
61#endif
62
63#if defined(CONFIG_SOC_EXYNOS4212)
64# define soc_is_exynos4212() is_samsung_exynos4212()
65#else
66# define soc_is_exynos4212() 0
67#endif
68
69#if defined(CONFIG_SOC_EXYNOS4412)
70# define soc_is_exynos4412() is_samsung_exynos4412()
71#else
72# define soc_is_exynos4412() 0
73#endif
74
75#define EXYNOS4210_REV_0 (0x0)
76#define EXYNOS4210_REV_1_0 (0x10)
77#define EXYNOS4210_REV_1_1 (0x11)
78
79#if defined(CONFIG_SOC_EXYNOS5250)
80# define soc_is_exynos5250() is_samsung_exynos5250()
81#else
82# define soc_is_exynos5250() 0
83#endif
84
85#if defined(CONFIG_SOC_EXYNOS5410)
86# define soc_is_exynos5410() is_samsung_exynos5410()
87#else
88# define soc_is_exynos5410() 0
89#endif
90
91#if defined(CONFIG_SOC_EXYNOS5420)
92# define soc_is_exynos5420() is_samsung_exynos5420()
93#else
94# define soc_is_exynos5420() 0
95#endif
96
97#if defined(CONFIG_SOC_EXYNOS5440)
98# define soc_is_exynos5440() is_samsung_exynos5440()
99#else
100# define soc_is_exynos5440() 0
101#endif
102
103#if defined(CONFIG_SOC_EXYNOS5800)
104# define soc_is_exynos5800() is_samsung_exynos5800()
105#else
106# define soc_is_exynos5800() 0
107#endif
108
109#define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \
110 soc_is_exynos4412())
111#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5410() || \
112 soc_is_exynos5420() || soc_is_exynos5800())
113
18void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1); 114void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
19 115
20struct map_desc; 116struct map_desc;
@@ -63,5 +159,14 @@ struct exynos_pmu_conf {
63}; 159};
64 160
65extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); 161extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
162extern void exynos_cpu_power_down(int cpu);
163extern void exynos_cpu_power_up(int cpu);
164extern int exynos_cpu_power_state(int cpu);
165extern void exynos_cluster_power_down(int cluster);
166extern void exynos_cluster_power_up(int cluster);
167extern int exynos_cluster_power_state(int cluster);
168
169extern void s5p_init_cpu(void __iomem *cpuid_addr);
170extern unsigned int samsung_rev(void);
66 171
67#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ 172#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index c57cae0e8779..3dd385ebf195 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -24,7 +24,6 @@
24#include <asm/unified.h> 24#include <asm/unified.h>
25#include <asm/cpuidle.h> 25#include <asm/cpuidle.h>
26 26
27#include <plat/cpu.h>
28#include <plat/pm.h> 27#include <plat/pm.h>
29 28
30#include <mach/map.h> 29#include <mach/map.h>
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index e973ff5de7b3..4800b1ce3d71 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -26,8 +26,6 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/memory.h> 27#include <asm/memory.h>
28 28
29#include <plat/cpu.h>
30
31#include "common.h" 29#include "common.h"
32#include "mfc.h" 30#include "mfc.h"
33#include "regs-pmu.h" 31#include "regs-pmu.h"
@@ -244,21 +242,13 @@ void __init exynos_init_io(void)
244 exynos_map_io(); 242 exynos_map_io();
245} 243}
246 244
247struct bus_type exynos_subsys = {
248 .name = "exynos-core",
249 .dev_name = "exynos-core",
250};
251
252static int __init exynos_core_init(void)
253{
254 return subsys_system_register(&exynos_subsys, NULL);
255}
256core_initcall(exynos_core_init);
257
258static int __init exynos4_l2x0_cache_init(void) 245static int __init exynos4_l2x0_cache_init(void)
259{ 246{
260 int ret; 247 int ret;
261 248
249 if (!soc_is_exynos4())
250 return 0;
251
262 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK); 252 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
263 if (ret) 253 if (ret)
264 return ret; 254 return ret;
@@ -306,12 +296,15 @@ static void __init exynos_dt_machine_init(void)
306} 296}
307 297
308static char const *exynos_dt_compat[] __initconst = { 298static char const *exynos_dt_compat[] __initconst = {
299 "samsung,exynos3",
300 "samsung,exynos3250",
309 "samsung,exynos4", 301 "samsung,exynos4",
310 "samsung,exynos4210", 302 "samsung,exynos4210",
311 "samsung,exynos4212", 303 "samsung,exynos4212",
312 "samsung,exynos4412", 304 "samsung,exynos4412",
313 "samsung,exynos5", 305 "samsung,exynos5",
314 "samsung,exynos5250", 306 "samsung,exynos5250",
307 "samsung,exynos5260",
315 "samsung,exynos5420", 308 "samsung,exynos5420",
316 "samsung,exynos5440", 309 "samsung,exynos5440",
317 NULL 310 NULL
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index 4135edbc0270..eb91d2350f8c 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -18,8 +18,6 @@
18 18
19#include <mach/map.h> 19#include <mach/map.h>
20 20
21#include <plat/cpu.h>
22
23#include "common.h" 21#include "common.h"
24#include "smc.h" 22#include "smc.h"
25 23
@@ -32,6 +30,13 @@ static int exynos_do_idle(void)
32static int exynos_cpu_boot(int cpu) 30static int exynos_cpu_boot(int cpu)
33{ 31{
34 /* 32 /*
33 * Exynos3250 doesn't need to send smc command for secondary CPU boot
34 * because Exynos3250 removes WFE in secure mode.
35 */
36 if (soc_is_exynos3250())
37 return 0;
38
39 /*
35 * The second parameter of SMC_CMD_CPU1BOOT command means CPU id. 40 * The second parameter of SMC_CMD_CPU1BOOT command means CPU id.
36 * But, Exynos4212 has only one secondary CPU so second parameter 41 * But, Exynos4212 has only one secondary CPU so second parameter
37 * isn't used for informing secure firmware about CPU id. 42 * isn't used for informing secure firmware about CPU id.
@@ -52,7 +57,7 @@ static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
52 57
53 boot_reg = sysram_ns_base_addr + 0x1c; 58 boot_reg = sysram_ns_base_addr + 0x1c;
54 59
55 if (!soc_is_exynos4212()) 60 if (!soc_is_exynos4212() && !soc_is_exynos3250())
56 boot_reg += 4*cpu; 61 boot_reg += 4*cpu;
57 62
58 __raw_writel(boot_addr, boot_reg); 63 __raw_writel(boot_addr, boot_reg);
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 5eead530c6f8..69fa48397394 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -19,61 +19,9 @@
19#include <asm/cp15.h> 19#include <asm/cp15.h>
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21 21
22#include <plat/cpu.h>
23
24#include "common.h" 22#include "common.h"
25#include "regs-pmu.h" 23#include "regs-pmu.h"
26 24
27static inline void cpu_enter_lowpower_a9(void)
28{
29 unsigned int v;
30
31 asm volatile(
32 " mcr p15, 0, %1, c7, c5, 0\n"
33 " mcr p15, 0, %1, c7, c10, 4\n"
34 /*
35 * Turn off coherency
36 */
37 " mrc p15, 0, %0, c1, c0, 1\n"
38 " bic %0, %0, %3\n"
39 " mcr p15, 0, %0, c1, c0, 1\n"
40 " mrc p15, 0, %0, c1, c0, 0\n"
41 " bic %0, %0, %2\n"
42 " mcr p15, 0, %0, c1, c0, 0\n"
43 : "=&r" (v)
44 : "r" (0), "Ir" (CR_C), "Ir" (0x40)
45 : "cc");
46}
47
48static inline void cpu_enter_lowpower_a15(void)
49{
50 unsigned int v;
51
52 asm volatile(
53 " mrc p15, 0, %0, c1, c0, 0\n"
54 " bic %0, %0, %1\n"
55 " mcr p15, 0, %0, c1, c0, 0\n"
56 : "=&r" (v)
57 : "Ir" (CR_C)
58 : "cc");
59
60 flush_cache_louis();
61
62 asm volatile(
63 /*
64 * Turn off coherency
65 */
66 " mrc p15, 0, %0, c1, c0, 1\n"
67 " bic %0, %0, %1\n"
68 " mcr p15, 0, %0, c1, c0, 1\n"
69 : "=&r" (v)
70 : "Ir" (0x40)
71 : "cc");
72
73 isb();
74 dsb();
75}
76
77static inline void cpu_leave_lowpower(void) 25static inline void cpu_leave_lowpower(void)
78{ 26{
79 unsigned int v; 27 unsigned int v;
@@ -96,7 +44,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
96 44
97 /* make cpu1 to be turned off at next WFI command */ 45 /* make cpu1 to be turned off at next WFI command */
98 if (cpu == 1) 46 if (cpu == 1)
99 __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION); 47 exynos_cpu_power_down(cpu);
100 48
101 /* 49 /*
102 * here's the WFI 50 * here's the WFI
@@ -132,19 +80,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
132void __ref exynos_cpu_die(unsigned int cpu) 80void __ref exynos_cpu_die(unsigned int cpu)
133{ 81{
134 int spurious = 0; 82 int spurious = 0;
135 int primary_part = 0;
136 83
137 /* 84 v7_exit_coherency_flush(louis);
138 * we're ready for shutdown now, so do it.
139 * Exynos4 is A9 based while Exynos5 is A15; check the CPU part
140 * number by reading the Main ID register and then perform the
141 * appropriate sequence for entering low power.
142 */
143 asm("mrc p15, 0, %0, c0, c0, 0" : "=r"(primary_part) : : "cc");
144 if ((primary_part & 0xfff0) == 0xc0f0)
145 cpu_enter_lowpower_a15();
146 else
147 cpu_enter_lowpower_a9();
148 85
149 platform_do_lowpower(cpu, &spurious); 86 platform_do_lowpower(cpu, &spurious);
150 87
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
new file mode 100644
index 000000000000..0498d0b887ef
--- /dev/null
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -0,0 +1,357 @@
1/*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * arch/arm/mach-exynos/mcpm-exynos.c
6 *
7 * Based on arch/arm/mach-vexpress/dcscb.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/arm-cci.h>
15#include <linux/delay.h>
16#include <linux/io.h>
17#include <linux/of_address.h>
18
19#include <asm/cputype.h>
20#include <asm/cp15.h>
21#include <asm/mcpm.h>
22
23#include "regs-pmu.h"
24#include "common.h"
25
26#define EXYNOS5420_CPUS_PER_CLUSTER 4
27#define EXYNOS5420_NR_CLUSTERS 2
28#define MCPM_BOOT_ADDR_OFFSET 0x1c
29
30/*
31 * The common v7_exit_coherency_flush API could not be used because of the
32 * Erratum 799270 workaround. This macro is the same as the common one (in
33 * arch/arm/include/asm/cacheflush.h) except for the erratum handling.
34 */
35#define exynos_v7_exit_coherency_flush(level) \
36 asm volatile( \
37 "stmfd sp!, {fp, ip}\n\t"\
38 "mrc p15, 0, r0, c1, c0, 0 @ get SCTLR\n\t" \
39 "bic r0, r0, #"__stringify(CR_C)"\n\t" \
40 "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR\n\t" \
41 "isb\n\t"\
42 "bl v7_flush_dcache_"__stringify(level)"\n\t" \
43 "clrex\n\t"\
44 "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR\n\t" \
45 "bic r0, r0, #(1 << 6) @ disable local coherency\n\t" \
46 /* Dummy Load of a device register to avoid Erratum 799270 */ \
47 "ldr r4, [%0]\n\t" \
48 "and r4, r4, #0\n\t" \
49 "orr r0, r0, r4\n\t" \
50 "mcr p15, 0, r0, c1, c0, 1 @ set ACTLR\n\t" \
51 "isb\n\t" \
52 "dsb\n\t" \
53 "ldmfd sp!, {fp, ip}" \
54 : \
55 : "Ir" (S5P_INFORM0) \
56 : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
57 "r9", "r10", "lr", "memory")
58
59/*
60 * We can't use regular spinlocks. In the switcher case, it is possible
61 * for an outbound CPU to call power_down() after its inbound counterpart
62 * is already live using the same logical CPU number which trips lockdep
63 * debugging.
64 */
65static arch_spinlock_t exynos_mcpm_lock = __ARCH_SPIN_LOCK_UNLOCKED;
66static int
67cpu_use_count[EXYNOS5420_CPUS_PER_CLUSTER][EXYNOS5420_NR_CLUSTERS];
68
69#define exynos_cluster_usecnt(cluster) \
70 (cpu_use_count[0][cluster] + \
71 cpu_use_count[1][cluster] + \
72 cpu_use_count[2][cluster] + \
73 cpu_use_count[3][cluster])
74
75#define exynos_cluster_unused(cluster) !exynos_cluster_usecnt(cluster)
76
77static int exynos_cluster_power_control(unsigned int cluster, int enable)
78{
79 unsigned int tries = 100;
80 unsigned int val;
81
82 if (enable) {
83 exynos_cluster_power_up(cluster);
84 val = S5P_CORE_LOCAL_PWR_EN;
85 } else {
86 exynos_cluster_power_down(cluster);
87 val = 0;
88 }
89
90 /* Wait until cluster power control is applied */
91 while (tries--) {
92 if (exynos_cluster_power_state(cluster) == val)
93 return 0;
94
95 cpu_relax();
96 }
97 pr_debug("timed out waiting for cluster %u to power %s\n", cluster,
98 enable ? "on" : "off");
99
100 return -ETIMEDOUT;
101}
102
103static int exynos_power_up(unsigned int cpu, unsigned int cluster)
104{
105 unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
106 int err = 0;
107
108 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
109 if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
110 cluster >= EXYNOS5420_NR_CLUSTERS)
111 return -EINVAL;
112
113 /*
114 * Since this is called with IRQs enabled, and no arch_spin_lock_irq
115 * variant exists, we need to disable IRQs manually here.
116 */
117 local_irq_disable();
118 arch_spin_lock(&exynos_mcpm_lock);
119
120 cpu_use_count[cpu][cluster]++;
121 if (cpu_use_count[cpu][cluster] == 1) {
122 bool was_cluster_down =
123 (exynos_cluster_usecnt(cluster) == 1);
124
125 /*
126 * Turn on the cluster (L2/COMMON) and then power on the
127 * cores.
128 */
129 if (was_cluster_down)
130 err = exynos_cluster_power_control(cluster, 1);
131
132 if (!err)
133 exynos_cpu_power_up(cpunr);
134 else
135 exynos_cluster_power_control(cluster, 0);
136 } else if (cpu_use_count[cpu][cluster] != 2) {
137 /*
138 * The only possible values are:
139 * 0 = CPU down
140 * 1 = CPU (still) up
141 * 2 = CPU requested to be up before it had a chance
142 * to actually make itself down.
143 * Any other value is a bug.
144 */
145 BUG();
146 }
147
148 arch_spin_unlock(&exynos_mcpm_lock);
149 local_irq_enable();
150
151 return err;
152}
153
154/*
155 * NOTE: This function requires the stack data to be visible through power down
156 * and can only be executed on processors like A15 and A7 that hit the cache
157 * with the C bit clear in the SCTLR register.
158 */
159static void exynos_power_down(void)
160{
161 unsigned int mpidr, cpu, cluster;
162 bool last_man = false, skip_wfi = false;
163 unsigned int cpunr;
164
165 mpidr = read_cpuid_mpidr();
166 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
167 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
168 cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
169
170 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
171 BUG_ON(cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
172 cluster >= EXYNOS5420_NR_CLUSTERS);
173
174 __mcpm_cpu_going_down(cpu, cluster);
175
176 arch_spin_lock(&exynos_mcpm_lock);
177 BUG_ON(__mcpm_cluster_state(cluster) != CLUSTER_UP);
178 cpu_use_count[cpu][cluster]--;
179 if (cpu_use_count[cpu][cluster] == 0) {
180 exynos_cpu_power_down(cpunr);
181
182 if (exynos_cluster_unused(cluster))
183 /* TODO: Turn off the cluster here to save power. */
184 last_man = true;
185 } else if (cpu_use_count[cpu][cluster] == 1) {
186 /*
187 * A power_up request went ahead of us.
188 * Even if we do not want to shut this CPU down,
189 * the caller expects a certain state as if the WFI
190 * was aborted. So let's continue with cache cleaning.
191 */
192 skip_wfi = true;
193 } else {
194 BUG();
195 }
196
197 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) {
198 arch_spin_unlock(&exynos_mcpm_lock);
199
200 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A15) {
201 /*
202 * On the Cortex-A15 we need to disable
203 * L2 prefetching before flushing the cache.
204 */
205 asm volatile(
206 "mcr p15, 1, %0, c15, c0, 3\n\t"
207 "isb\n\t"
208 "dsb"
209 : : "r" (0x400));
210 }
211
212 /* Flush all cache levels for this cluster. */
213 exynos_v7_exit_coherency_flush(all);
214
215 /*
216 * Disable cluster-level coherency by masking
217 * incoming snoops and DVM messages:
218 */
219 cci_disable_port_by_cpu(mpidr);
220
221 __mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN);
222 } else {
223 arch_spin_unlock(&exynos_mcpm_lock);
224
225 /* Disable and flush the local CPU cache. */
226 exynos_v7_exit_coherency_flush(louis);
227 }
228
229 __mcpm_cpu_down(cpu, cluster);
230
231 /* Now we are prepared for power-down, do it: */
232 if (!skip_wfi)
233 wfi();
234
235 /* Not dead at this point? Let our caller cope. */
236}
237
238static int exynos_wait_for_powerdown(unsigned int cpu, unsigned int cluster)
239{
240 unsigned int tries = 100;
241 unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
242
243 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
244 BUG_ON(cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
245 cluster >= EXYNOS5420_NR_CLUSTERS);
246
247 /* Wait for the core state to be OFF */
248 while (tries--) {
249 if (ACCESS_ONCE(cpu_use_count[cpu][cluster]) == 0) {
250 if ((exynos_cpu_power_state(cpunr) == 0))
251 return 0; /* success: the CPU is halted */
252 }
253
254 /* Otherwise, wait and retry: */
255 msleep(1);
256 }
257
258 return -ETIMEDOUT; /* timeout */
259}
260
261static const struct mcpm_platform_ops exynos_power_ops = {
262 .power_up = exynos_power_up,
263 .power_down = exynos_power_down,
264 .wait_for_powerdown = exynos_wait_for_powerdown,
265};
266
267static void __init exynos_mcpm_usage_count_init(void)
268{
269 unsigned int mpidr, cpu, cluster;
270
271 mpidr = read_cpuid_mpidr();
272 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
273 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
274
275 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
276 BUG_ON(cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
277 cluster >= EXYNOS5420_NR_CLUSTERS);
278
279 cpu_use_count[cpu][cluster] = 1;
280}
281
282/*
283 * Enable cluster-level coherency, in preparation for turning on the MMU.
284 */
285static void __naked exynos_pm_power_up_setup(unsigned int affinity_level)
286{
287 asm volatile ("\n"
288 "cmp r0, #1\n"
289 "bxne lr\n"
290 "b cci_enable_port_for_self");
291}
292
293static const struct of_device_id exynos_dt_mcpm_match[] = {
294 { .compatible = "samsung,exynos5420" },
295 { .compatible = "samsung,exynos5800" },
296 {},
297};
298
299static int __init exynos_mcpm_init(void)
300{
301 struct device_node *node;
302 void __iomem *ns_sram_base_addr;
303 int ret;
304
305 node = of_find_matching_node(NULL, exynos_dt_mcpm_match);
306 if (!node)
307 return -ENODEV;
308 of_node_put(node);
309
310 if (!cci_probed())
311 return -ENODEV;
312
313 node = of_find_compatible_node(NULL, NULL,
314 "samsung,exynos4210-sysram-ns");
315 if (!node)
316 return -ENODEV;
317
318 ns_sram_base_addr = of_iomap(node, 0);
319 of_node_put(node);
320 if (!ns_sram_base_addr) {
321 pr_err("failed to map non-secure iRAM base address\n");
322 return -ENOMEM;
323 }
324
325 /*
326 * To increase the stability of KFC reset we need to program
327 * the PMU SPARE3 register
328 */
329 __raw_writel(EXYNOS5420_SWRESET_KFC_SEL, S5P_PMU_SPARE3);
330
331 exynos_mcpm_usage_count_init();
332
333 ret = mcpm_platform_register(&exynos_power_ops);
334 if (!ret)
335 ret = mcpm_sync_init(exynos_pm_power_up_setup);
336 if (ret) {
337 iounmap(ns_sram_base_addr);
338 return ret;
339 }
340
341 mcpm_smp_set_ops();
342
343 pr_info("Exynos MCPM support installed\n");
344
345 /*
346 * Future entries into the kernel can now go
347 * through the cluster entry vectors.
348 */
349 __raw_writel(virt_to_phys(mcpm_entry_point),
350 ns_sram_base_addr + MCPM_BOOT_ADDR_OFFSET);
351
352 iounmap(ns_sram_base_addr);
353
354 return ret;
355}
356
357early_initcall(exynos_mcpm_init);
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index c11c5418e0fc..112bc66927a1 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -27,8 +27,6 @@
27#include <asm/smp_scu.h> 27#include <asm/smp_scu.h>
28#include <asm/firmware.h> 28#include <asm/firmware.h>
29 29
30#include <plat/cpu.h>
31
32#include "common.h" 30#include "common.h"
33#include "regs-pmu.h" 31#include "regs-pmu.h"
34 32
@@ -72,7 +70,7 @@ static inline void __iomem *cpu_boot_reg(int cpu)
72 return ERR_PTR(-ENODEV); 70 return ERR_PTR(-ENODEV);
73 if (soc_is_exynos4412()) 71 if (soc_is_exynos4412())
74 boot_reg += 4*cpu; 72 boot_reg += 4*cpu;
75 else if (soc_is_exynos5420()) 73 else if (soc_is_exynos5420() || soc_is_exynos5800())
76 boot_reg += 4; 74 boot_reg += 4;
77 return boot_reg; 75 return boot_reg;
78} 76}
@@ -133,15 +131,12 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle)
133 */ 131 */
134 write_pen_release(phys_cpu); 132 write_pen_release(phys_cpu);
135 133
136 if (!(__raw_readl(S5P_ARM_CORE1_STATUS) & S5P_CORE_LOCAL_PWR_EN)) { 134 if (!exynos_cpu_power_state(cpu)) {
137 __raw_writel(S5P_CORE_LOCAL_PWR_EN, 135 exynos_cpu_power_up(cpu);
138 S5P_ARM_CORE1_CONFIGURATION);
139
140 timeout = 10; 136 timeout = 10;
141 137
142 /* wait max 10 ms until cpu1 is on */ 138 /* wait max 10 ms until cpu1 is on */
143 while ((__raw_readl(S5P_ARM_CORE1_STATUS) 139 while (exynos_cpu_power_state(cpu) != S5P_CORE_LOCAL_PWR_EN) {
144 & S5P_CORE_LOCAL_PWR_EN) != S5P_CORE_LOCAL_PWR_EN) {
145 if (timeout-- == 0) 140 if (timeout-- == 0)
146 break; 141 break;
147 142
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 15af0ceb0a66..aba2ff6e443d 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -26,7 +26,6 @@
26#include <asm/smp_scu.h> 26#include <asm/smp_scu.h>
27#include <asm/suspend.h> 27#include <asm/suspend.h>
28 28
29#include <plat/cpu.h>
30#include <plat/pm-common.h> 29#include <plat/pm-common.h>
31#include <plat/pll.h> 30#include <plat/pll.h>
32#include <plat/regs-srom.h> 31#include <plat/regs-srom.h>
@@ -100,6 +99,72 @@ static int exynos_irq_set_wake(struct irq_data *data, unsigned int state)
100 return -ENOENT; 99 return -ENOENT;
101} 100}
102 101
102/**
103 * exynos_core_power_down : power down the specified cpu
104 * @cpu : the cpu to power down
105 *
106 * Power down the specified cpu. The sequence must be finished by a
107 * call to cpu_do_idle()
108 *
109 */
110void exynos_cpu_power_down(int cpu)
111{
112 __raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu));
113}
114
115/**
116 * exynos_cpu_power_up : power up the specified cpu
117 * @cpu : the cpu to power up
118 *
119 * Power up the specified cpu
120 */
121void exynos_cpu_power_up(int cpu)
122{
123 __raw_writel(S5P_CORE_LOCAL_PWR_EN,
124 EXYNOS_ARM_CORE_CONFIGURATION(cpu));
125}
126
127/**
128 * exynos_cpu_power_state : returns the power state of the cpu
129 * @cpu : the cpu to retrieve the power state from
130 *
131 */
132int exynos_cpu_power_state(int cpu)
133{
134 return (__raw_readl(EXYNOS_ARM_CORE_STATUS(cpu)) &
135 S5P_CORE_LOCAL_PWR_EN);
136}
137
138/**
139 * exynos_cluster_power_down : power down the specified cluster
140 * @cluster : the cluster to power down
141 */
142void exynos_cluster_power_down(int cluster)
143{
144 __raw_writel(0, EXYNOS_COMMON_CONFIGURATION(cluster));
145}
146
147/**
148 * exynos_cluster_power_up : power up the specified cluster
149 * @cluster : the cluster to power up
150 */
151void exynos_cluster_power_up(int cluster)
152{
153 __raw_writel(S5P_CORE_LOCAL_PWR_EN,
154 EXYNOS_COMMON_CONFIGURATION(cluster));
155}
156
157/**
158 * exynos_cluster_power_state : returns the power state of the cluster
159 * @cluster : the cluster to retrieve the power state from
160 *
161 */
162int exynos_cluster_power_state(int cluster)
163{
164 return (__raw_readl(EXYNOS_COMMON_STATUS(cluster)) &
165 S5P_CORE_LOCAL_PWR_EN);
166}
167
103/* For Cortex-A9 Diagnostic and Power control register */ 168/* For Cortex-A9 Diagnostic and Power control register */
104static unsigned int save_arm_register[2]; 169static unsigned int save_arm_register[2];
105 170
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 05c7ce15322a..fb0deda3b3a4 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -13,8 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/bug.h> 14#include <linux/bug.h>
15 15
16#include <plat/cpu.h>
17
18#include "common.h" 16#include "common.h"
19#include "regs-pmu.h" 17#include "regs-pmu.h"
20 18
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 4f6a2560d022..4179f6a6d595 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -38,6 +38,7 @@
38#define S5P_INFORM5 S5P_PMUREG(0x0814) 38#define S5P_INFORM5 S5P_PMUREG(0x0814)
39#define S5P_INFORM6 S5P_PMUREG(0x0818) 39#define S5P_INFORM6 S5P_PMUREG(0x0818)
40#define S5P_INFORM7 S5P_PMUREG(0x081C) 40#define S5P_INFORM7 S5P_PMUREG(0x081C)
41#define S5P_PMU_SPARE3 S5P_PMUREG(0x090C)
41 42
42#define S5P_ARM_CORE0_LOWPWR S5P_PMUREG(0x1000) 43#define S5P_ARM_CORE0_LOWPWR S5P_PMUREG(0x1000)
43#define S5P_DIS_IRQ_CORE0 S5P_PMUREG(0x1004) 44#define S5P_DIS_IRQ_CORE0 S5P_PMUREG(0x1004)
@@ -105,8 +106,17 @@
105#define S5P_GPS_LOWPWR S5P_PMUREG(0x139C) 106#define S5P_GPS_LOWPWR S5P_PMUREG(0x139C)
106#define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0) 107#define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0)
107 108
108#define S5P_ARM_CORE1_CONFIGURATION S5P_PMUREG(0x2080) 109#define EXYNOS_ARM_CORE0_CONFIGURATION S5P_PMUREG(0x2000)
109#define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084) 110#define EXYNOS_ARM_CORE_CONFIGURATION(_nr) \
111 (EXYNOS_ARM_CORE0_CONFIGURATION + (0x80 * (_nr)))
112#define EXYNOS_ARM_CORE_STATUS(_nr) \
113 (EXYNOS_ARM_CORE_CONFIGURATION(_nr) + 0x4)
114
115#define EXYNOS_ARM_COMMON_CONFIGURATION S5P_PMUREG(0x2500)
116#define EXYNOS_COMMON_CONFIGURATION(_nr) \
117 (EXYNOS_ARM_COMMON_CONFIGURATION + (0x80 * (_nr)))
118#define EXYNOS_COMMON_STATUS(_nr) \
119 (EXYNOS_COMMON_CONFIGURATION(_nr) + 0x4)
110 120
111#define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028) 121#define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028)
112#define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108) 122#define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108)
@@ -313,4 +323,6 @@
313 323
314#define EXYNOS5_OPTION_USE_RETENTION (1 << 4) 324#define EXYNOS5_OPTION_USE_RETENTION (1 << 4)
315 325
326#define EXYNOS5420_SWRESET_KFC_SEL 0x3
327
316#endif /* __ASM_ARCH_REGS_PMU_H */ 328#endif /* __ASM_ARCH_REGS_PMU_H */
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 5740296dc429..8d42eab76d53 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -702,61 +702,6 @@ endif
702 702
703if ARCH_MULTI_V7 703if ARCH_MULTI_V7
704 704
705comment "i.MX51 machines:"
706
707config MACH_IMX51_DT
708 bool "Support i.MX51 platforms from device tree"
709 select SOC_IMX51
710 help
711 Include support for Freescale i.MX51 based platforms
712 using the device tree for discovery
713
714config MACH_MX51_BABBAGE
715 bool "Support MX51 BABBAGE platforms"
716 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
717 select IMX_HAVE_PLATFORM_IMX2_WDT
718 select IMX_HAVE_PLATFORM_IMX_I2C
719 select IMX_HAVE_PLATFORM_IMX_UART
720 select IMX_HAVE_PLATFORM_MXC_EHCI
721 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
722 select IMX_HAVE_PLATFORM_SPI_IMX
723 select SOC_IMX51
724 help
725 Include support for MX51 Babbage platform, also known as MX51EVK in
726 u-boot. This includes specific configurations for the board and its
727 peripherals.
728
729config MACH_EUKREA_CPUIMX51SD
730 bool "Support Eukrea CPUIMX51SD module"
731 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
732 select IMX_HAVE_PLATFORM_IMX2_WDT
733 select IMX_HAVE_PLATFORM_IMX_I2C
734 select IMX_HAVE_PLATFORM_IMX_UART
735 select IMX_HAVE_PLATFORM_MXC_EHCI
736 select IMX_HAVE_PLATFORM_MXC_NAND
737 select IMX_HAVE_PLATFORM_SPI_IMX
738 select SOC_IMX51
739 help
740 Include support for Eukrea CPUIMX51SD platform. This includes
741 specific configurations for the module and its peripherals.
742
743choice
744 prompt "Baseboard"
745 depends on MACH_EUKREA_CPUIMX51SD
746 default MACH_EUKREA_MBIMXSD51_BASEBOARD
747
748config MACH_EUKREA_MBIMXSD51_BASEBOARD
749 prompt "Eukrea MBIMXSD development board"
750 bool
751 select IMX_HAVE_PLATFORM_IMX_SSI
752 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
753 select LEDS_GPIO_REGISTER
754 help
755 This adds board specific devices that can be found on Eukrea's
756 MBIMXSD evaluation board.
757
758endchoice
759
760comment "Device tree only" 705comment "Device tree only"
761 706
762config SOC_IMX50 707config SOC_IMX50
@@ -768,6 +713,12 @@ config SOC_IMX50
768 help 713 help
769 This enables support for Freescale i.MX50 processor. 714 This enables support for Freescale i.MX50 processor.
770 715
716config MACH_IMX51_DT
717 bool "i.MX51 support"
718 select SOC_IMX51
719 help
720 This enables support for Freescale i.MX51 processor
721
771config SOC_IMX53 722config SOC_IMX53
772 bool "i.MX53 support" 723 bool "i.MX53 support"
773 select HAVE_IMX_SRC 724 select HAVE_IMX_SRC
@@ -796,7 +747,6 @@ config SOC_IMX6Q
796 select ARM_ERRATA_764369 if SMP 747 select ARM_ERRATA_764369 if SMP
797 select HAVE_ARM_SCU if SMP 748 select HAVE_ARM_SCU if SMP
798 select HAVE_ARM_TWD if SMP 749 select HAVE_ARM_TWD if SMP
799 select MIGHT_HAVE_PCI
800 select PCI_DOMAINS if PCI 750 select PCI_DOMAINS if PCI
801 select PINCTRL_IMX6Q 751 select PINCTRL_IMX6Q
802 select SOC_IMX6 752 select SOC_IMX6
@@ -812,6 +762,14 @@ config SOC_IMX6SL
812 help 762 help
813 This enables support for Freescale i.MX6 SoloLite processor. 763 This enables support for Freescale i.MX6 SoloLite processor.
814 764
765config SOC_IMX6SX
766 bool "i.MX6 SoloX support"
767 select PINCTRL_IMX6SX
768 select SOC_IMX6
769
770 help
771 This enables support for Freescale i.MX6 SoloX processor.
772
815config SOC_VF610 773config SOC_VF610
816 bool "Vybrid Family VF610 support" 774 bool "Vybrid Family VF610 support"
817 select ARM_GIC 775 select ARM_GIC
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index f4ed83032dd0..bbe93bbfd003 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -101,6 +101,7 @@ obj-$(CONFIG_SMP) += headsmp.o platsmp.o
101obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 101obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
102obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o 102obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o
103obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o 103obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o
104obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o mach-imx6sx.o
104 105
105ifeq ($(CONFIG_SUSPEND),y) 106ifeq ($(CONFIG_SUSPEND),y)
106AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a 107AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a
@@ -108,11 +109,6 @@ obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o
108endif 109endif
109obj-$(CONFIG_SOC_IMX6) += pm-imx6.o 110obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
110 111
111# i.MX5 based machines
112obj-$(CONFIG_MACH_MX51_BABBAGE) += mach-mx51_babbage.o
113obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o
114obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
115
116obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o 112obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
117obj-$(CONFIG_SOC_IMX50) += mach-imx50.o 113obj-$(CONFIG_SOC_IMX50) += mach-imx50.o
118obj-$(CONFIG_SOC_IMX53) += mach-imx53.o 114obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
diff --git a/arch/arm/mach-imx/avic.c b/arch/arm/mach-imx/avic.c
index 8d1df2e4b7ac..24b103c67f82 100644
--- a/arch/arm/mach-imx/avic.c
+++ b/arch/arm/mach-imx/avic.c
@@ -135,7 +135,7 @@ static __init void avic_init_gc(int idx, unsigned int irq_start)
135 irq_setup_generic_chip(gc, IRQ_MSK(32), 0, IRQ_NOREQUEST, 0); 135 irq_setup_generic_chip(gc, IRQ_MSK(32), 0, IRQ_NOREQUEST, 0);
136} 136}
137 137
138asmlinkage void __exception_irq_entry avic_handle_irq(struct pt_regs *regs) 138static void __exception_irq_entry avic_handle_irq(struct pt_regs *regs)
139{ 139{
140 u32 nivector; 140 u32 nivector;
141 141
@@ -190,6 +190,8 @@ void __init mxc_init_irq(void __iomem *irqbase)
190 for (i = 0; i < 8; i++) 190 for (i = 0; i < 8; i++)
191 __raw_writel(0, avic_base + AVIC_NIPRIORITY(i)); 191 __raw_writel(0, avic_base + AVIC_NIPRIORITY(i));
192 192
193 set_handle_irq(avic_handle_irq);
194
193#ifdef CONFIG_FIQ 195#ifdef CONFIG_FIQ
194 /* Initialize FIQ */ 196 /* Initialize FIQ */
195 init_FIQ(FIQ_START); 197 init_FIQ(FIQ_START);
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index a2ecc006b322..4ba587da89d2 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -27,48 +27,61 @@
27 * parent - fixed parent. No clk_set_parent support 27 * parent - fixed parent. No clk_set_parent support
28 */ 28 */
29 29
30#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) 30struct clk_gate2 {
31 struct clk_hw hw;
32 void __iomem *reg;
33 u8 bit_idx;
34 u8 flags;
35 spinlock_t *lock;
36 unsigned int *share_count;
37};
38
39#define to_clk_gate2(_hw) container_of(_hw, struct clk_gate2, hw)
31 40
32static int clk_gate2_enable(struct clk_hw *hw) 41static int clk_gate2_enable(struct clk_hw *hw)
33{ 42{
34 struct clk_gate *gate = to_clk_gate(hw); 43 struct clk_gate2 *gate = to_clk_gate2(hw);
35 u32 reg; 44 u32 reg;
36 unsigned long flags = 0; 45 unsigned long flags = 0;
37 46
38 if (gate->lock) 47 spin_lock_irqsave(gate->lock, flags);
39 spin_lock_irqsave(gate->lock, flags); 48
49 if (gate->share_count && (*gate->share_count)++ > 0)
50 goto out;
40 51
41 reg = readl(gate->reg); 52 reg = readl(gate->reg);
42 reg |= 3 << gate->bit_idx; 53 reg |= 3 << gate->bit_idx;
43 writel(reg, gate->reg); 54 writel(reg, gate->reg);
44 55
45 if (gate->lock) 56out:
46 spin_unlock_irqrestore(gate->lock, flags); 57 spin_unlock_irqrestore(gate->lock, flags);
47 58
48 return 0; 59 return 0;
49} 60}
50 61
51static void clk_gate2_disable(struct clk_hw *hw) 62static void clk_gate2_disable(struct clk_hw *hw)
52{ 63{
53 struct clk_gate *gate = to_clk_gate(hw); 64 struct clk_gate2 *gate = to_clk_gate2(hw);
54 u32 reg; 65 u32 reg;
55 unsigned long flags = 0; 66 unsigned long flags = 0;
56 67
57 if (gate->lock) 68 spin_lock_irqsave(gate->lock, flags);
58 spin_lock_irqsave(gate->lock, flags); 69
70 if (gate->share_count && --(*gate->share_count) > 0)
71 goto out;
59 72
60 reg = readl(gate->reg); 73 reg = readl(gate->reg);
61 reg &= ~(3 << gate->bit_idx); 74 reg &= ~(3 << gate->bit_idx);
62 writel(reg, gate->reg); 75 writel(reg, gate->reg);
63 76
64 if (gate->lock) 77out:
65 spin_unlock_irqrestore(gate->lock, flags); 78 spin_unlock_irqrestore(gate->lock, flags);
66} 79}
67 80
68static int clk_gate2_is_enabled(struct clk_hw *hw) 81static int clk_gate2_is_enabled(struct clk_hw *hw)
69{ 82{
70 u32 reg; 83 u32 reg;
71 struct clk_gate *gate = to_clk_gate(hw); 84 struct clk_gate2 *gate = to_clk_gate2(hw);
72 85
73 reg = readl(gate->reg); 86 reg = readl(gate->reg);
74 87
@@ -87,21 +100,23 @@ static struct clk_ops clk_gate2_ops = {
87struct clk *clk_register_gate2(struct device *dev, const char *name, 100struct clk *clk_register_gate2(struct device *dev, const char *name,
88 const char *parent_name, unsigned long flags, 101 const char *parent_name, unsigned long flags,
89 void __iomem *reg, u8 bit_idx, 102 void __iomem *reg, u8 bit_idx,
90 u8 clk_gate2_flags, spinlock_t *lock) 103 u8 clk_gate2_flags, spinlock_t *lock,
104 unsigned int *share_count)
91{ 105{
92 struct clk_gate *gate; 106 struct clk_gate2 *gate;
93 struct clk *clk; 107 struct clk *clk;
94 struct clk_init_data init; 108 struct clk_init_data init;
95 109
96 gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); 110 gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL);
97 if (!gate) 111 if (!gate)
98 return ERR_PTR(-ENOMEM); 112 return ERR_PTR(-ENOMEM);
99 113
100 /* struct clk_gate assignments */ 114 /* struct clk_gate2 assignments */
101 gate->reg = reg; 115 gate->reg = reg;
102 gate->bit_idx = bit_idx; 116 gate->bit_idx = bit_idx;
103 gate->flags = clk_gate2_flags; 117 gate->flags = clk_gate2_flags;
104 gate->lock = lock; 118 gate->lock = lock;
119 gate->share_count = share_count;
105 120
106 init.name = name; 121 init.name = name;
107 init.ops = &clk_gate2_ops; 122 init.ops = &clk_gate2_ops;
diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index 15f9d223cf0b..7f739be3de2c 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -40,12 +40,14 @@
40#define SCM_GCCR IO_ADDR_SCM(0xc) 40#define SCM_GCCR IO_ADDR_SCM(0xc)
41 41
42static const char *prem_sel_clks[] = { "clk32_premult", "clk16m", }; 42static const char *prem_sel_clks[] = { "clk32_premult", "clk16m", };
43static const char *clko_sel_clks[] = { "per1", "hclk", "clk48m", "clk16m", "prem", 43static const char *clko_sel_clks[] = { "per1", "hclk", "clk48m", "clk16m",
44 "fclk", }; 44 "prem", "fclk", };
45
45enum imx1_clks { 46enum imx1_clks {
46 dummy, clk32, clk16m_ext, clk16m, clk32_premult, prem, mpll, spll, mcu, 47 dummy, clk32, clk16m_ext, clk16m, clk32_premult, prem, mpll, mpll_gate,
47 fclk, hclk, clk48m, per1, per2, per3, clko, dma_gate, csi_gate, 48 spll, spll_gate, mcu, fclk, hclk, clk48m, per1, per2, per3, clko,
48 mma_gate, usbd_gate, clk_max 49 uart3_gate, ssi2_gate, brom_gate, dma_gate, csi_gate, mma_gate,
50 usbd_gate, clk_max
49}; 51};
50 52
51static struct clk *clk[clk_max]; 53static struct clk *clk[clk_max];
@@ -62,17 +64,22 @@ int __init mx1_clocks_init(unsigned long fref)
62 clk[prem] = imx_clk_mux("prem", CCM_CSCR, 16, 1, prem_sel_clks, 64 clk[prem] = imx_clk_mux("prem", CCM_CSCR, 16, 1, prem_sel_clks,
63 ARRAY_SIZE(prem_sel_clks)); 65 ARRAY_SIZE(prem_sel_clks));
64 clk[mpll] = imx_clk_pllv1("mpll", "clk32_premult", CCM_MPCTL0); 66 clk[mpll] = imx_clk_pllv1("mpll", "clk32_premult", CCM_MPCTL0);
67 clk[mpll_gate] = imx_clk_gate("mpll_gate", "mpll", CCM_CSCR, 0);
65 clk[spll] = imx_clk_pllv1("spll", "prem", CCM_SPCTL0); 68 clk[spll] = imx_clk_pllv1("spll", "prem", CCM_SPCTL0);
69 clk[spll_gate] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1);
66 clk[mcu] = imx_clk_divider("mcu", "clk32_premult", CCM_CSCR, 15, 1); 70 clk[mcu] = imx_clk_divider("mcu", "clk32_premult", CCM_CSCR, 15, 1);
67 clk[fclk] = imx_clk_divider("fclk", "mpll", CCM_CSCR, 15, 1); 71 clk[fclk] = imx_clk_divider("fclk", "mpll_gate", CCM_CSCR, 15, 1);
68 clk[hclk] = imx_clk_divider("hclk", "spll", CCM_CSCR, 10, 4); 72 clk[hclk] = imx_clk_divider("hclk", "spll_gate", CCM_CSCR, 10, 4);
69 clk[clk48m] = imx_clk_divider("clk48m", "spll", CCM_CSCR, 26, 3); 73 clk[clk48m] = imx_clk_divider("clk48m", "spll_gate", CCM_CSCR, 26, 3);
70 clk[per1] = imx_clk_divider("per1", "spll", CCM_PCDR, 0, 4); 74 clk[per1] = imx_clk_divider("per1", "spll_gate", CCM_PCDR, 0, 4);
71 clk[per2] = imx_clk_divider("per2", "spll", CCM_PCDR, 4, 4); 75 clk[per2] = imx_clk_divider("per2", "spll_gate", CCM_PCDR, 4, 4);
72 clk[per3] = imx_clk_divider("per3", "spll", CCM_PCDR, 16, 7); 76 clk[per3] = imx_clk_divider("per3", "spll_gate", CCM_PCDR, 16, 7);
73 clk[clko] = imx_clk_mux("clko", CCM_CSCR, 29, 3, clko_sel_clks, 77 clk[clko] = imx_clk_mux("clko", CCM_CSCR, 29, 3, clko_sel_clks,
74 ARRAY_SIZE(clko_sel_clks)); 78 ARRAY_SIZE(clko_sel_clks));
75 clk[dma_gate] = imx_clk_gate("dma_gate", "hclk", SCM_GCCR, 4); 79 clk[uart3_gate] = imx_clk_gate("uart3_gate", "hclk", SCM_GCCR, 6);
80 clk[ssi2_gate] = imx_clk_gate("ssi2_gate", "hclk", SCM_GCCR, 5);
81 clk[brom_gate] = imx_clk_gate("brom_gate", "hclk", SCM_GCCR, 4);
82 clk[dma_gate] = imx_clk_gate("dma_gate", "hclk", SCM_GCCR, 3);
76 clk[csi_gate] = imx_clk_gate("csi_gate", "hclk", SCM_GCCR, 2); 83 clk[csi_gate] = imx_clk_gate("csi_gate", "hclk", SCM_GCCR, 2);
77 clk[mma_gate] = imx_clk_gate("mma_gate", "hclk", SCM_GCCR, 1); 84 clk[mma_gate] = imx_clk_gate("mma_gate", "hclk", SCM_GCCR, 1);
78 clk[usbd_gate] = imx_clk_gate("usbd_gate", "clk48m", SCM_GCCR, 0); 85 clk[usbd_gate] = imx_clk_gate("usbd_gate", "clk48m", SCM_GCCR, 0);
@@ -84,9 +91,6 @@ int __init mx1_clocks_init(unsigned long fref)
84 91
85 clk_register_clkdev(clk[dma_gate], "ahb", "imx1-dma"); 92 clk_register_clkdev(clk[dma_gate], "ahb", "imx1-dma");
86 clk_register_clkdev(clk[hclk], "ipg", "imx1-dma"); 93 clk_register_clkdev(clk[hclk], "ipg", "imx1-dma");
87 clk_register_clkdev(clk[csi_gate], NULL, "mx1-camera.0");
88 clk_register_clkdev(clk[mma_gate], "mma", NULL);
89 clk_register_clkdev(clk[usbd_gate], NULL, "imx_udc.0");
90 clk_register_clkdev(clk[per1], "per", "imx-gpt.0"); 94 clk_register_clkdev(clk[per1], "per", "imx-gpt.0");
91 clk_register_clkdev(clk[hclk], "ipg", "imx-gpt.0"); 95 clk_register_clkdev(clk[hclk], "ipg", "imx-gpt.0");
92 clk_register_clkdev(clk[per1], "per", "imx1-uart.0"); 96 clk_register_clkdev(clk[per1], "per", "imx1-uart.0");
@@ -94,20 +98,15 @@ int __init mx1_clocks_init(unsigned long fref)
94 clk_register_clkdev(clk[per1], "per", "imx1-uart.1"); 98 clk_register_clkdev(clk[per1], "per", "imx1-uart.1");
95 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.1"); 99 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.1");
96 clk_register_clkdev(clk[per1], "per", "imx1-uart.2"); 100 clk_register_clkdev(clk[per1], "per", "imx1-uart.2");
97 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.2"); 101 clk_register_clkdev(clk[uart3_gate], "ipg", "imx1-uart.2");
98 clk_register_clkdev(clk[hclk], NULL, "imx1-i2c.0"); 102 clk_register_clkdev(clk[hclk], NULL, "imx1-i2c.0");
99 clk_register_clkdev(clk[per2], "per", "imx1-cspi.0"); 103 clk_register_clkdev(clk[per2], "per", "imx1-cspi.0");
100 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.0"); 104 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.0");
101 clk_register_clkdev(clk[per2], "per", "imx1-cspi.1"); 105 clk_register_clkdev(clk[per2], "per", "imx1-cspi.1");
102 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.1"); 106 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.1");
103 clk_register_clkdev(clk[per2], NULL, "imx-mmc.0");
104 clk_register_clkdev(clk[per2], "per", "imx1-fb.0"); 107 clk_register_clkdev(clk[per2], "per", "imx1-fb.0");
105 clk_register_clkdev(clk[dummy], "ipg", "imx1-fb.0"); 108 clk_register_clkdev(clk[dummy], "ipg", "imx1-fb.0");
106 clk_register_clkdev(clk[dummy], "ahb", "imx1-fb.0"); 109 clk_register_clkdev(clk[dummy], "ahb", "imx1-fb.0");
107 clk_register_clkdev(clk[hclk], "mshc", NULL);
108 clk_register_clkdev(clk[per3], "ssi", NULL);
109 clk_register_clkdev(clk[clk32], NULL, "imx1-rtc.0");
110 clk_register_clkdev(clk[clko], "clko", NULL);
111 110
112 mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT); 111 mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT);
113 112
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index dc36e6c2f1da..ae578c096ad8 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -62,6 +62,10 @@ static struct clk_onecell_data clk_data;
62 62
63static const char *cpu_sel_clks[] = { "mpll", "mpll_cpu_3_4", }; 63static const char *cpu_sel_clks[] = { "mpll", "mpll_cpu_3_4", };
64static const char *per_sel_clks[] = { "ahb", "upll", }; 64static const char *per_sel_clks[] = { "ahb", "upll", };
65static const char *cko_sel_clks[] = { "dummy", "osc", "cpu", "ahb",
66 "ipg", "dummy", "dummy", "dummy",
67 "dummy", "dummy", "per0", "per2",
68 "per13", "per14", "usbotg_ahb", "dummy",};
65 69
66enum mx25_clks { 70enum mx25_clks {
67 dummy, osc, mpll, upll, mpll_cpu_3_4, cpu_sel, cpu, ahb, usb_div, ipg, 71 dummy, osc, mpll, upll, mpll_cpu_3_4, cpu_sel, cpu, ahb, usb_div, ipg,
@@ -82,7 +86,7 @@ enum mx25_clks {
82 pwm2_ipg, pwm3_ipg, pwm4_ipg, rngb_ipg, reserved16, scc_ipg, sdma_ipg, 86 pwm2_ipg, pwm3_ipg, pwm4_ipg, rngb_ipg, reserved16, scc_ipg, sdma_ipg,
83 sim1_ipg, sim2_ipg, slcdc_ipg, spba_ipg, ssi1_ipg, ssi2_ipg, tsc_ipg, 87 sim1_ipg, sim2_ipg, slcdc_ipg, spba_ipg, ssi1_ipg, ssi2_ipg, tsc_ipg,
84 uart1_ipg, uart2_ipg, uart3_ipg, uart4_ipg, uart5_ipg, reserved17, 88 uart1_ipg, uart2_ipg, uart3_ipg, uart4_ipg, uart5_ipg, reserved17,
85 wdt_ipg, clk_max 89 wdt_ipg, cko_div, cko_sel, cko, clk_max
86}; 90};
87 91
88static struct clk *clk[clk_max]; 92static struct clk *clk[clk_max];
@@ -117,6 +121,9 @@ static int __init __mx25_clocks_init(unsigned long osc_rate)
117 clk[per13_sel] = imx_clk_mux("per13_sel", ccm(CCM_MCR), 13, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 121 clk[per13_sel] = imx_clk_mux("per13_sel", ccm(CCM_MCR), 13, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks));
118 clk[per14_sel] = imx_clk_mux("per14_sel", ccm(CCM_MCR), 14, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 122 clk[per14_sel] = imx_clk_mux("per14_sel", ccm(CCM_MCR), 14, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks));
119 clk[per15_sel] = imx_clk_mux("per15_sel", ccm(CCM_MCR), 15, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 123 clk[per15_sel] = imx_clk_mux("per15_sel", ccm(CCM_MCR), 15, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks));
124 clk[cko_div] = imx_clk_divider("cko_div", "cko_sel", ccm(CCM_MCR), 24, 6);
125 clk[cko_sel] = imx_clk_mux("cko_sel", ccm(CCM_MCR), 20, 4, cko_sel_clks, ARRAY_SIZE(cko_sel_clks));
126 clk[cko] = imx_clk_gate("cko", "cko_div", ccm(CCM_MCR), 30);
120 clk[per0] = imx_clk_divider("per0", "per0_sel", ccm(CCM_PCDR0), 0, 6); 127 clk[per0] = imx_clk_divider("per0", "per0_sel", ccm(CCM_PCDR0), 0, 6);
121 clk[per1] = imx_clk_divider("per1", "per1_sel", ccm(CCM_PCDR0), 8, 6); 128 clk[per1] = imx_clk_divider("per1", "per1_sel", ccm(CCM_PCDR0), 8, 6);
122 clk[per2] = imx_clk_divider("per2", "per2_sel", ccm(CCM_PCDR0), 16, 6); 129 clk[per2] = imx_clk_divider("per2", "per2_sel", ccm(CCM_PCDR0), 16, 6);
@@ -230,6 +237,12 @@ static int __init __mx25_clocks_init(unsigned long osc_rate)
230 clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0"); 237 clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
231 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0"); 238 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
232 239
240 /*
241 * Let's initially set up CLKO parent as ipg, since this configuration
242 * is used on some imx25 board designs to clock the audio codec.
243 */
244 clk_set_parent(clk[cko_sel], clk[ipg]);
245
233 return 0; 246 return 0;
234} 247}
235 248
@@ -304,8 +317,6 @@ int __init mx25_clocks_init(void)
304int __init mx25_clocks_init_dt(void) 317int __init mx25_clocks_init_dt(void)
305{ 318{
306 struct device_node *np; 319 struct device_node *np;
307 void __iomem *base;
308 int irq;
309 unsigned long osc_rate = 24000000; 320 unsigned long osc_rate = 24000000;
310 321
311 /* retrieve the freqency of fixed clocks from device tree */ 322 /* retrieve the freqency of fixed clocks from device tree */
@@ -325,12 +336,7 @@ int __init mx25_clocks_init_dt(void)
325 336
326 __mx25_clocks_init(osc_rate); 337 __mx25_clocks_init(osc_rate);
327 338
328 np = of_find_compatible_node(NULL, NULL, "fsl,imx25-gpt"); 339 mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx25-gpt"));
329 base = of_iomap(np, 0);
330 WARN_ON(!base);
331 irq = irq_of_parse_and_map(np, 0);
332
333 mxc_timer_init(base, irq);
334 340
335 return 0; 341 return 0;
336} 342}
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index d2da8908b268..317a662626d6 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -82,7 +82,8 @@ enum mx27_clks {
82 csi_ahb_gate, brom_ahb_gate, ata_ahb_gate, wdog_ipg_gate, usb_ipg_gate, 82 csi_ahb_gate, brom_ahb_gate, ata_ahb_gate, wdog_ipg_gate, usb_ipg_gate,
83 uart6_ipg_gate, uart5_ipg_gate, uart4_ipg_gate, uart3_ipg_gate, 83 uart6_ipg_gate, uart5_ipg_gate, uart4_ipg_gate, uart3_ipg_gate,
84 uart2_ipg_gate, uart1_ipg_gate, ckih_div1p5, fpm, mpll_osc_sel, 84 uart2_ipg_gate, uart1_ipg_gate, ckih_div1p5, fpm, mpll_osc_sel,
85 mpll_sel, spll_gate, clk_max 85 mpll_sel, spll_gate, mshc_div, rtic_ipg_gate, mshc_ipg_gate,
86 rtic_ahb_gate, mshc_baud_gate, clk_max
86}; 87};
87 88
88static struct clk *clk[clk_max]; 89static struct clk *clk[clk_max];
@@ -117,6 +118,7 @@ int __init mx27_clocks_init(unsigned long fref)
117 clk[ipg] = imx_clk_divider("ipg", "ahb", CCM_CSCR, 8, 1); 118 clk[ipg] = imx_clk_divider("ipg", "ahb", CCM_CSCR, 8, 1);
118 } 119 }
119 120
121 clk[mshc_div] = imx_clk_divider("mshc_div", "ahb", CCM_PCDR0, 0, 6);
120 clk[nfc_div] = imx_clk_divider("nfc_div", "ahb", CCM_PCDR0, 6, 4); 122 clk[nfc_div] = imx_clk_divider("nfc_div", "ahb", CCM_PCDR0, 6, 4);
121 clk[per1_div] = imx_clk_divider("per1_div", "mpll_main2", CCM_PCDR1, 0, 6); 123 clk[per1_div] = imx_clk_divider("per1_div", "mpll_main2", CCM_PCDR1, 0, 6);
122 clk[per2_div] = imx_clk_divider("per2_div", "mpll_main2", CCM_PCDR1, 8, 6); 124 clk[per2_div] = imx_clk_divider("per2_div", "mpll_main2", CCM_PCDR1, 8, 6);
@@ -145,9 +147,11 @@ int __init mx27_clocks_init(unsigned long fref)
145 clk[sdhc1_ipg_gate] = imx_clk_gate("sdhc1_ipg_gate", "ipg", CCM_PCCR0, 5); 147 clk[sdhc1_ipg_gate] = imx_clk_gate("sdhc1_ipg_gate", "ipg", CCM_PCCR0, 5);
146 clk[scc_ipg_gate] = imx_clk_gate("scc_ipg_gate", "ipg", CCM_PCCR0, 6); 148 clk[scc_ipg_gate] = imx_clk_gate("scc_ipg_gate", "ipg", CCM_PCCR0, 6);
147 clk[sahara_ipg_gate] = imx_clk_gate("sahara_ipg_gate", "ipg", CCM_PCCR0, 7); 149 clk[sahara_ipg_gate] = imx_clk_gate("sahara_ipg_gate", "ipg", CCM_PCCR0, 7);
150 clk[rtic_ipg_gate] = imx_clk_gate("rtic_ipg_gate", "ipg", CCM_PCCR0, 8);
148 clk[rtc_ipg_gate] = imx_clk_gate("rtc_ipg_gate", "ipg", CCM_PCCR0, 9); 151 clk[rtc_ipg_gate] = imx_clk_gate("rtc_ipg_gate", "ipg", CCM_PCCR0, 9);
149 clk[pwm_ipg_gate] = imx_clk_gate("pwm_ipg_gate", "ipg", CCM_PCCR0, 11); 152 clk[pwm_ipg_gate] = imx_clk_gate("pwm_ipg_gate", "ipg", CCM_PCCR0, 11);
150 clk[owire_ipg_gate] = imx_clk_gate("owire_ipg_gate", "ipg", CCM_PCCR0, 12); 153 clk[owire_ipg_gate] = imx_clk_gate("owire_ipg_gate", "ipg", CCM_PCCR0, 12);
154 clk[mshc_ipg_gate] = imx_clk_gate("mshc_ipg_gate", "ipg", CCM_PCCR0, 13);
151 clk[lcdc_ipg_gate] = imx_clk_gate("lcdc_ipg_gate", "ipg", CCM_PCCR0, 14); 155 clk[lcdc_ipg_gate] = imx_clk_gate("lcdc_ipg_gate", "ipg", CCM_PCCR0, 14);
152 clk[kpp_ipg_gate] = imx_clk_gate("kpp_ipg_gate", "ipg", CCM_PCCR0, 15); 156 clk[kpp_ipg_gate] = imx_clk_gate("kpp_ipg_gate", "ipg", CCM_PCCR0, 15);
153 clk[iim_ipg_gate] = imx_clk_gate("iim_ipg_gate", "ipg", CCM_PCCR0, 16); 157 clk[iim_ipg_gate] = imx_clk_gate("iim_ipg_gate", "ipg", CCM_PCCR0, 16);
@@ -166,6 +170,7 @@ int __init mx27_clocks_init(unsigned long fref)
166 clk[cspi3_ipg_gate] = imx_clk_gate("cspi3_ipg_gate", "ipg", CCM_PCCR0, 29); 170 clk[cspi3_ipg_gate] = imx_clk_gate("cspi3_ipg_gate", "ipg", CCM_PCCR0, 29);
167 clk[cspi2_ipg_gate] = imx_clk_gate("cspi2_ipg_gate", "ipg", CCM_PCCR0, 30); 171 clk[cspi2_ipg_gate] = imx_clk_gate("cspi2_ipg_gate", "ipg", CCM_PCCR0, 30);
168 clk[cspi1_ipg_gate] = imx_clk_gate("cspi1_ipg_gate", "ipg", CCM_PCCR0, 31); 172 clk[cspi1_ipg_gate] = imx_clk_gate("cspi1_ipg_gate", "ipg", CCM_PCCR0, 31);
173 clk[mshc_baud_gate] = imx_clk_gate("mshc_baud_gate", "mshc_div", CCM_PCCR1, 2);
169 clk[nfc_baud_gate] = imx_clk_gate("nfc_baud_gate", "nfc_div", CCM_PCCR1, 3); 174 clk[nfc_baud_gate] = imx_clk_gate("nfc_baud_gate", "nfc_div", CCM_PCCR1, 3);
170 clk[ssi2_baud_gate] = imx_clk_gate("ssi2_baud_gate", "ssi2_div", CCM_PCCR1, 4); 175 clk[ssi2_baud_gate] = imx_clk_gate("ssi2_baud_gate", "ssi2_div", CCM_PCCR1, 4);
171 clk[ssi1_baud_gate] = imx_clk_gate("ssi1_baud_gate", "ssi1_div", CCM_PCCR1, 5); 176 clk[ssi1_baud_gate] = imx_clk_gate("ssi1_baud_gate", "ssi1_div", CCM_PCCR1, 5);
@@ -177,6 +182,7 @@ int __init mx27_clocks_init(unsigned long fref)
177 clk[usb_ahb_gate] = imx_clk_gate("usb_ahb_gate", "ahb", CCM_PCCR1, 11); 182 clk[usb_ahb_gate] = imx_clk_gate("usb_ahb_gate", "ahb", CCM_PCCR1, 11);
178 clk[slcdc_ahb_gate] = imx_clk_gate("slcdc_ahb_gate", "ahb", CCM_PCCR1, 12); 183 clk[slcdc_ahb_gate] = imx_clk_gate("slcdc_ahb_gate", "ahb", CCM_PCCR1, 12);
179 clk[sahara_ahb_gate] = imx_clk_gate("sahara_ahb_gate", "ahb", CCM_PCCR1, 13); 184 clk[sahara_ahb_gate] = imx_clk_gate("sahara_ahb_gate", "ahb", CCM_PCCR1, 13);
185 clk[rtic_ahb_gate] = imx_clk_gate("rtic_ahb_gate", "ahb", CCM_PCCR1, 14);
180 clk[lcdc_ahb_gate] = imx_clk_gate("lcdc_ahb_gate", "ahb", CCM_PCCR1, 15); 186 clk[lcdc_ahb_gate] = imx_clk_gate("lcdc_ahb_gate", "ahb", CCM_PCCR1, 15);
181 clk[vpu_ahb_gate] = imx_clk_gate("vpu_ahb_gate", "ahb", CCM_PCCR1, 16); 187 clk[vpu_ahb_gate] = imx_clk_gate("vpu_ahb_gate", "ahb", CCM_PCCR1, 16);
182 clk[fec_ahb_gate] = imx_clk_gate("fec_ahb_gate", "ahb", CCM_PCCR1, 17); 188 clk[fec_ahb_gate] = imx_clk_gate("fec_ahb_gate", "ahb", CCM_PCCR1, 17);
@@ -221,16 +227,6 @@ int __init mx27_clocks_init(unsigned long fref)
221 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.5"); 227 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.5");
222 clk_register_clkdev(clk[gpt1_ipg_gate], "ipg", "imx-gpt.0"); 228 clk_register_clkdev(clk[gpt1_ipg_gate], "ipg", "imx-gpt.0");
223 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.0"); 229 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.0");
224 clk_register_clkdev(clk[gpt2_ipg_gate], "ipg", "imx-gpt.1");
225 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.1");
226 clk_register_clkdev(clk[gpt3_ipg_gate], "ipg", "imx-gpt.2");
227 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.2");
228 clk_register_clkdev(clk[gpt4_ipg_gate], "ipg", "imx-gpt.3");
229 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.3");
230 clk_register_clkdev(clk[gpt5_ipg_gate], "ipg", "imx-gpt.4");
231 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.4");
232 clk_register_clkdev(clk[gpt6_ipg_gate], "ipg", "imx-gpt.5");
233 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.5");
234 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.0"); 230 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.0");
235 clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "imx21-mmc.0"); 231 clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "imx21-mmc.0");
236 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.1"); 232 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.1");
@@ -278,14 +274,7 @@ int __init mx27_clocks_init(unsigned long fref)
278 clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "imx27-camera.0"); 274 clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "imx27-camera.0");
279 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0"); 275 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0");
280 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0"); 276 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0");
281 clk_register_clkdev(clk[iim_ipg_gate], "iim", NULL);
282 clk_register_clkdev(clk[gpio_ipg_gate], "gpio", NULL);
283 clk_register_clkdev(clk[brom_ahb_gate], "brom", NULL);
284 clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL);
285 clk_register_clkdev(clk[rtc_ipg_gate], NULL, "imx21-rtc");
286 clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL);
287 clk_register_clkdev(clk[cpu_div], NULL, "cpu0"); 277 clk_register_clkdev(clk[cpu_div], NULL, "cpu0");
288 clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL);
289 278
290 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1); 279 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1);
291 280
@@ -296,7 +285,6 @@ int __init mx27_clocks_init(unsigned long fref)
296 return 0; 285 return 0;
297} 286}
298 287
299#ifdef CONFIG_OF
300int __init mx27_clocks_init_dt(void) 288int __init mx27_clocks_init_dt(void)
301{ 289{
302 struct device_node *np; 290 struct device_node *np;
@@ -312,4 +300,3 @@ int __init mx27_clocks_init_dt(void)
312 300
313 return mx27_clocks_init(fref); 301 return mx27_clocks_init(fref);
314} 302}
315#endif
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index b5b65f3efaf1..4a9de0835eb1 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -191,7 +191,6 @@ int __init mx31_clocks_init(unsigned long fref)
191 return 0; 191 return 0;
192} 192}
193 193
194#ifdef CONFIG_OF
195int __init mx31_clocks_init_dt(void) 194int __init mx31_clocks_init_dt(void)
196{ 195{
197 struct device_node *np; 196 struct device_node *np;
@@ -207,4 +206,3 @@ int __init mx31_clocks_init_dt(void)
207 206
208 return mx31_clocks_init(fref); 207 return mx31_clocks_init(fref);
209} 208}
210#endif
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 568ef0a4de84..21d2b111c83d 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -322,9 +322,8 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
322 322
323static void __init mx50_clocks_init(struct device_node *np) 323static void __init mx50_clocks_init(struct device_node *np)
324{ 324{
325 void __iomem *base;
326 unsigned long r; 325 unsigned long r;
327 int i, irq; 326 int i;
328 327
329 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 328 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
330 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE); 329 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
@@ -372,11 +371,7 @@ static void __init mx50_clocks_init(struct device_node *np)
372 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000); 371 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
373 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r); 372 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
374 373
375 np = of_find_compatible_node(NULL, NULL, "fsl,imx50-gpt"); 374 mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx50-gpt"));
376 base = of_iomap(np, 0);
377 WARN_ON(!base);
378 irq = irq_of_parse_and_map(np, 0);
379 mxc_timer_init(base, irq);
380} 375}
381CLK_OF_DECLARE(imx50_ccm, "fsl,imx50-ccm", mx50_clocks_init); 376CLK_OF_DECLARE(imx50_ccm, "fsl,imx50-ccm", mx50_clocks_init);
382 377
@@ -436,7 +431,6 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
436 431
437 clk_register_clkdev(clk[IMX5_CLK_HSI2C_GATE], NULL, "imx21-i2c.2"); 432 clk_register_clkdev(clk[IMX5_CLK_HSI2C_GATE], NULL, "imx21-i2c.2");
438 clk_register_clkdev(clk[IMX5_CLK_MX51_MIPI], "mipi_hsp", NULL); 433 clk_register_clkdev(clk[IMX5_CLK_MX51_MIPI], "mipi_hsp", NULL);
439 clk_register_clkdev(clk[IMX5_CLK_VPU_GATE], NULL, "imx51-vpu.0");
440 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx27-fec.0"); 434 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx27-fec.0");
441 clk_register_clkdev(clk[IMX5_CLK_USB_PHY_GATE], "phy", "mxc-ehci.0"); 435 clk_register_clkdev(clk[IMX5_CLK_USB_PHY_GATE], "phy", "mxc-ehci.0");
442 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_IPG_GATE], "ipg", "sdhci-esdhc-imx51.0"); 436 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_IPG_GATE], "ipg", "sdhci-esdhc-imx51.0");
@@ -492,9 +486,8 @@ CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init_dt);
492 486
493static void __init mx53_clocks_init(struct device_node *np) 487static void __init mx53_clocks_init(struct device_node *np)
494{ 488{
495 int i, irq; 489 int i;
496 unsigned long r; 490 unsigned long r;
497 void __iomem *base;
498 491
499 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 492 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
500 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE); 493 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
@@ -561,7 +554,6 @@ static void __init mx53_clocks_init(struct device_node *np)
561 554
562 mx5_clocks_common_init(0, 0, 0, 0); 555 mx5_clocks_common_init(0, 0, 0, 0);
563 556
564 clk_register_clkdev(clk[IMX5_CLK_VPU_GATE], NULL, "imx53-vpu.0");
565 clk_register_clkdev(clk[IMX5_CLK_I2C3_GATE], NULL, "imx21-i2c.2"); 557 clk_register_clkdev(clk[IMX5_CLK_I2C3_GATE], NULL, "imx21-i2c.2");
566 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx25-fec.0"); 558 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx25-fec.0");
567 clk_register_clkdev(clk[IMX5_CLK_USB_PHY1_GATE], "usb_phy1", "mxc-ehci.0"); 559 clk_register_clkdev(clk[IMX5_CLK_USB_PHY1_GATE], "usb_phy1", "mxc-ehci.0");
@@ -592,10 +584,6 @@ static void __init mx53_clocks_init(struct device_node *np)
592 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000); 584 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
593 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r); 585 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
594 586
595 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-gpt"); 587 mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx53-gpt"));
596 base = of_iomap(np, 0);
597 WARN_ON(!base);
598 irq = irq_of_parse_and_map(np, 0);
599 mxc_timer_init(base, irq);
600} 588}
601CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init); 589CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init);
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 2b4d6acfa34a..8e795dea02ec 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -107,7 +107,7 @@ enum mx6q_clks {
107 sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate, 107 sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate,
108 usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, eim_slow, 108 usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, eim_slow,
109 spdif, cko2_sel, cko2_podf, cko2, cko, vdoa, pll4_audio_div, 109 spdif, cko2_sel, cko2_podf, cko2, cko, vdoa, pll4_audio_div,
110 lvds1_sel, lvds2_sel, lvds1_gate, lvds2_gate, clk_max 110 lvds1_sel, lvds2_sel, lvds1_gate, lvds2_gate, esai_ahb, clk_max
111}; 111};
112 112
113static struct clk *clk[clk_max]; 113static struct clk *clk[clk_max];
@@ -140,11 +140,13 @@ static struct clk_div_table video_div_table[] = {
140 { /* sentinel */ } 140 { /* sentinel */ }
141}; 141};
142 142
143static unsigned int share_count_esai;
144
143static void __init imx6q_clocks_init(struct device_node *ccm_node) 145static void __init imx6q_clocks_init(struct device_node *ccm_node)
144{ 146{
145 struct device_node *np; 147 struct device_node *np;
146 void __iomem *base; 148 void __iomem *base;
147 int i, irq; 149 int i;
148 int ret; 150 int ret;
149 151
150 clk[dummy] = imx_clk_fixed("dummy", 0); 152 clk[dummy] = imx_clk_fixed("dummy", 0);
@@ -352,9 +354,14 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
352 clk[ecspi2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); 354 clk[ecspi2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2);
353 clk[ecspi3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); 355 clk[ecspi3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4);
354 clk[ecspi4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); 356 clk[ecspi4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6);
355 clk[ecspi5] = imx_clk_gate2("ecspi5", "ecspi_root", base + 0x6c, 8); 357 if (cpu_is_imx6dl())
358 /* ecspi5 is replaced with i2c4 on imx6dl & imx6s */
359 clk[ecspi5] = imx_clk_gate2("i2c4", "ipg_per", base + 0x6c, 8);
360 else
361 clk[ecspi5] = imx_clk_gate2("ecspi5", "ecspi_root", base + 0x6c, 8);
356 clk[enet] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10); 362 clk[enet] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10);
357 clk[esai] = imx_clk_gate2("esai", "esai_podf", base + 0x6c, 16); 363 clk[esai] = imx_clk_gate2_shared("esai", "esai_podf", base + 0x6c, 16, &share_count_esai);
364 clk[esai_ahb] = imx_clk_gate2_shared("esai_ahb", "ahb", base + 0x6c, 16, &share_count_esai);
358 clk[gpt_ipg] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20); 365 clk[gpt_ipg] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20);
359 clk[gpt_ipg_per] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22); 366 clk[gpt_ipg_per] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22);
360 if (cpu_is_imx6dl()) 367 if (cpu_is_imx6dl())
@@ -489,10 +496,6 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
489 /* Set initial power mode */ 496 /* Set initial power mode */
490 imx6q_set_lpm(WAIT_CLOCKED); 497 imx6q_set_lpm(WAIT_CLOCKED);
491 498
492 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); 499 mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"));
493 base = of_iomap(np, 0);
494 WARN_ON(!base);
495 irq = irq_of_parse_and_map(np, 0);
496 mxc_timer_init(base, irq);
497} 500}
498CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init); 501CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index f7073c0782fb..21cf06cebade 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -169,7 +169,6 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
169{ 169{
170 struct device_node *np; 170 struct device_node *np;
171 void __iomem *base; 171 void __iomem *base;
172 int irq;
173 int i; 172 int i;
174 int ret; 173 int ret;
175 174
@@ -385,9 +384,6 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
385 imx6q_set_lpm(WAIT_CLOCKED); 384 imx6q_set_lpm(WAIT_CLOCKED);
386 385
387 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt"); 386 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt");
388 base = of_iomap(np, 0); 387 mxc_timer_init_dt(np);
389 WARN_ON(!base);
390 irq = irq_of_parse_and_map(np, 0);
391 mxc_timer_init(base, irq);
392} 388}
393CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init); 389CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init);
diff --git a/arch/arm/mach-imx/clk-imx6sx.c b/arch/arm/mach-imx/clk-imx6sx.c
new file mode 100644
index 000000000000..72f8902235d1
--- /dev/null
+++ b/arch/arm/mach-imx/clk-imx6sx.c
@@ -0,0 +1,524 @@
1/*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include <dt-bindings/clock/imx6sx-clock.h>
13#include <linux/clk.h>
14#include <linux/clkdev.h>
15#include <linux/err.h>
16#include <linux/init.h>
17#include <linux/io.h>
18#include <linux/of.h>
19#include <linux/of_address.h>
20#include <linux/of_irq.h>
21#include <linux/types.h>
22
23#include "clk.h"
24#include "common.h"
25
26#define CCDR 0x4
27#define BM_CCM_CCDR_MMDC_CH0_MASK (0x2 << 16)
28
29static const char *step_sels[] = { "osc", "pll2_pfd2_396m", };
30static const char *pll1_sw_sels[] = { "pll1_sys", "step", };
31static const char *periph_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m", "pll2_pfd0_352m", "pll2_198m", };
32static const char *periph2_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m", "pll2_pfd0_352m", "pll4_audio_div", };
33static const char *periph_clk2_sels[] = { "pll3_usb_otg", "osc", "osc", };
34static const char *periph2_clk2_sels[] = { "pll3_usb_otg", "osc", };
35static const char *periph_sels[] = { "periph_pre", "periph_clk2", };
36static const char *periph2_sels[] = { "periph2_pre", "periph2_clk2", };
37static const char *ocram_sels[] = { "periph", "pll2_pfd2_396m", "periph", "pll3_pfd1_540m", };
38static const char *audio_sels[] = { "pll4_audio_div", "pll3_pfd2_508m", "pll5_video_div", "pll3_usb_otg", };
39static const char *gpu_axi_sels[] = { "pll2_pfd2_396m", "pll3_pfd0_720m", "pll3_pfd1_540m", "pll2_bus", };
40static const char *gpu_core_sels[] = { "pll3_pfd1_540m", "pll3_pfd0_720m", "pll2_bus", "pll2_pfd2_396m", };
41static const char *ldb_di0_div_sels[] = { "ldb_di0_div_3_5", "ldb_di0_div_7", };
42static const char *ldb_di1_div_sels[] = { "ldb_di1_div_3_5", "ldb_di1_div_7", };
43static const char *ldb_di0_sels[] = { "pll5_video_div", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll2_pfd3_594m", "pll2_pfd1_594m", "pll3_pfd3_454m", };
44static const char *ldb_di1_sels[] = { "pll3_usb_otg", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll2_bus", "pll3_pfd3_454m", "pll3_pfd2_508m", };
45static const char *pcie_axi_sels[] = { "axi", "ahb", };
46static const char *ssi_sels[] = { "pll3_pfd2_508m", "pll5_video_div", "pll4_audio_div", };
47static const char *qspi1_sels[] = { "pll3_usb_otg", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll2_bus", "pll3_pfd3_454m", "pll3_pfd2_508m", };
48static const char *perclk_sels[] = { "ipg", "osc", };
49static const char *usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", };
50static const char *vid_sels[] = { "pll3_pfd1_540m", "pll3_usb_otg", "pll3_pfd3_454m", "pll4_audio_div", "pll5_video_div", };
51static const char *can_sels[] = { "pll3_60m", "osc", "pll3_80m", "dummy", };
52static const char *uart_sels[] = { "pll3_80m", "osc", };
53static const char *qspi2_sels[] = { "pll2_pfd0_352m", "pll2_bus", "pll3_usb_otg", "pll2_pfd2_396m", "pll3_pfd3_454m", "dummy", "dummy", "dummy", };
54static const char *enet_pre_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd2_508m", };
55static const char *enet_sels[] = { "enet_podf", "ipp_di0", "ipp_di1", "ldb_di0", "ldb_di1", };
56static const char *m4_pre_sels[] = { "pll2_bus", "pll3_usb_otg", "osc", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd3_454m", };
57static const char *m4_sels[] = { "m4_pre_sel", "ipp_di0", "ipp_di1", "ldb_di0", "ldb_di1", };
58static const char *eim_slow_sels[] = { "ocram", "pll3_usb_otg", "pll2_pfd2_396m", "pll2_pfd0_352m", };
59static const char *ecspi_sels[] = { "pll3_60m", "osc", };
60static const char *lcdif1_pre_sels[] = { "pll2_bus", "pll3_pfd3_454m", "pll5_video_div", "pll2_pfd0_352m", "pll2_pfd1_594m", "pll3_pfd1_540m", };
61static const char *lcdif1_sels[] = { "lcdif1_podf", "ipp_di0", "ipp_di1", "ldb_di0", "ldb_di1", };
62static const char *lcdif2_pre_sels[] = { "pll2_bus", "pll3_pfd3_454m", "pll5_video_div", "pll2_pfd0_352m", "pll2_pfd3_594m", "pll3_pfd1_540m", };
63static const char *lcdif2_sels[] = { "lcdif2_podf", "ipp_di0", "ipp_di1", "ldb_di0", "ldb_di1", };
64static const char *display_sels[] = { "pll2_bus", "pll2_pfd2_396m", "pll3_usb_otg", "pll3_pfd1_540m", };
65static const char *csi_sels[] = { "osc", "pll2_pfd2_396m", "pll3_120m", "pll3_pfd1_540m", };
66static const char *cko1_sels[] = {
67 "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5_video_div",
68 "dummy", "ocram", "dummy", "pxp_axi", "epdc_axi", "lcdif_pix",
69 "epdc_pix", "ahb", "ipg", "perclk", "ckil", "pll4_audio_div",
70};
71static const char *cko2_sels[] = {
72 "dummy", "mmdc_p0_fast", "usdhc4", "usdhc1", "dummy", "wrck",
73 "ecspi_root", "dummy", "usdhc3", "pcie", "arm", "csi_core",
74 "lcdif_axi", "dummy", "osc", "dummy", "gpu2d_ovg_core",
75 "usdhc2", "ssi1", "ssi2", "ssi3", "gpu2d_core", "dummy",
76 "dummy", "dummy", "dummy", "esai_extal", "eim_slow", "uart_serial",
77 "spdif", "asrc", "dummy",
78};
79static const char *cko_sels[] = { "cko1", "cko2", };
80static const char *lvds_sels[] = {
81 "arm", "pll1_sys", "dummy", "dummy", "dummy", "dummy", "dummy", "pll5_video_div",
82 "dummy", "dummy", "pcie_ref_125m", "dummy", "usbphy1", "usbphy2",
83};
84
85static struct clk *clks[IMX6SX_CLK_CLK_END];
86static struct clk_onecell_data clk_data;
87
88static int const clks_init_on[] __initconst = {
89 IMX6SX_CLK_AIPS_TZ1, IMX6SX_CLK_AIPS_TZ2, IMX6SX_CLK_AIPS_TZ3,
90 IMX6SX_CLK_IPMUX1, IMX6SX_CLK_IPMUX2, IMX6SX_CLK_IPMUX3,
91 IMX6SX_CLK_WAKEUP, IMX6SX_CLK_MMDC_P0_FAST, IMX6SX_CLK_MMDC_P0_IPG,
92 IMX6SX_CLK_ROM, IMX6SX_CLK_ARM, IMX6SX_CLK_IPG, IMX6SX_CLK_OCRAM,
93 IMX6SX_CLK_PER2_MAIN, IMX6SX_CLK_PERCLK, IMX6SX_CLK_M4,
94 IMX6SX_CLK_QSPI1, IMX6SX_CLK_QSPI2, IMX6SX_CLK_UART_IPG,
95 IMX6SX_CLK_UART_SERIAL, IMX6SX_CLK_I2C3, IMX6SX_CLK_ECSPI5,
96 IMX6SX_CLK_CAN1_IPG, IMX6SX_CLK_CAN1_SERIAL, IMX6SX_CLK_CAN2_IPG,
97 IMX6SX_CLK_CAN2_SERIAL, IMX6SX_CLK_CANFD, IMX6SX_CLK_EPIT1,
98 IMX6SX_CLK_EPIT2,
99};
100
101static struct clk_div_table clk_enet_ref_table[] = {
102 { .val = 0, .div = 20, },
103 { .val = 1, .div = 10, },
104 { .val = 2, .div = 5, },
105 { .val = 3, .div = 4, },
106 { }
107};
108
109static struct clk_div_table post_div_table[] = {
110 { .val = 2, .div = 1, },
111 { .val = 1, .div = 2, },
112 { .val = 0, .div = 4, },
113 { }
114};
115
116static struct clk_div_table video_div_table[] = {
117 { .val = 0, .div = 1, },
118 { .val = 1, .div = 2, },
119 { .val = 2, .div = 1, },
120 { .val = 3, .div = 4, },
121 { }
122};
123
124static u32 share_count_asrc;
125static u32 share_count_audio;
126static u32 share_count_esai;
127
128static void __init imx6sx_clocks_init(struct device_node *ccm_node)
129{
130 struct device_node *np;
131 void __iomem *base;
132 int i;
133
134 clks[IMX6SX_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
135
136 clks[IMX6SX_CLK_CKIL] = of_clk_get_by_name(ccm_node, "ckil");
137 clks[IMX6SX_CLK_OSC] = of_clk_get_by_name(ccm_node, "osc");
138
139 /* ipp_di clock is external input */
140 clks[IMX6SX_CLK_IPP_DI0] = of_clk_get_by_name(ccm_node, "ipp_di0");
141 clks[IMX6SX_CLK_IPP_DI1] = of_clk_get_by_name(ccm_node, "ipp_di1");
142
143 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-anatop");
144 base = of_iomap(np, 0);
145 WARN_ON(!base);
146
147 /* type name parent_name base div_mask */
148 clks[IMX6SX_CLK_PLL1_SYS] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f);
149 clks[IMX6SX_CLK_PLL2_BUS] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1);
150 clks[IMX6SX_CLK_PLL3_USB_OTG] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x3);
151 clks[IMX6SX_CLK_PLL4_AUDIO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x7f);
152 clks[IMX6SX_CLK_PLL5_VIDEO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f);
153 clks[IMX6SX_CLK_PLL6_ENET] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3);
154 clks[IMX6SX_CLK_PLL7_USB_HOST] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host", "osc", base + 0x20, 0x3);
155
156 /*
157 * Bit 20 is the reserved and read-only bit, we do this only for:
158 * - Do nothing for usbphy clk_enable/disable
159 * - Keep refcount when do usbphy clk_enable/disable, in that case,
160 * the clk framework may need to enable/disable usbphy's parent
161 */
162 clks[IMX6SX_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20);
163 clks[IMX6SX_CLK_USBPHY2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20);
164
165 /*
166 * usbphy*_gate needs to be on after system boots up, and software
167 * never needs to control it anymore.
168 */
169 clks[IMX6SX_CLK_USBPHY1_GATE] = imx_clk_gate("usbphy1_gate", "dummy", base + 0x10, 6);
170 clks[IMX6SX_CLK_USBPHY2_GATE] = imx_clk_gate("usbphy2_gate", "dummy", base + 0x20, 6);
171
172 /* FIXME 100Mhz is used for pcie ref for all imx6 pcie, excepted imx6q */
173 clks[IMX6SX_CLK_PCIE_REF] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 5);
174 clks[IMX6SX_CLK_PCIE_REF_125M] = imx_clk_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19);
175
176 clks[IMX6SX_CLK_LVDS1_OUT] = imx_clk_gate("lvds1_out", "lvds1_sel", base + 0x160, 10);
177
178 clks[IMX6SX_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0,
179 base + 0xe0, 0, 2, 0, clk_enet_ref_table,
180 &imx_ccm_lock);
181 clks[IMX6SX_CLK_ENET2_REF] = clk_register_divider_table(NULL, "enet2_ref", "pll6_enet", 0,
182 base + 0xe0, 2, 2, 0, clk_enet_ref_table,
183 &imx_ccm_lock);
184 clks[IMX6SX_CLK_ENET2_REF_125M] = imx_clk_gate("enet2_ref_125m", "enet2_ref", base + 0xe0, 20);
185
186 clks[IMX6SX_CLK_ENET_PTP_REF] = imx_clk_fixed_factor("enet_ptp_ref", "pll6_enet", 1, 20);
187 clks[IMX6SX_CLK_ENET_PTP] = imx_clk_gate("enet_ptp_25m", "enet_ptp_ref", base + 0xe0, 21);
188
189 /* name parent_name reg idx */
190 clks[IMX6SX_CLK_PLL2_PFD0] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0);
191 clks[IMX6SX_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1);
192 clks[IMX6SX_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2);
193 clks[IMX6SX_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3_594m", "pll2_bus", base + 0x100, 3);
194 clks[IMX6SX_CLK_PLL3_PFD0] = imx_clk_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0);
195 clks[IMX6SX_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1);
196 clks[IMX6SX_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2);
197 clks[IMX6SX_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3);
198
199 /* name parent_name mult div */
200 clks[IMX6SX_CLK_PLL2_198M] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2);
201 clks[IMX6SX_CLK_PLL3_120M] = imx_clk_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4);
202 clks[IMX6SX_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6);
203 clks[IMX6SX_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8);
204 clks[IMX6SX_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2);
205 clks[IMX6SX_CLK_GPT_3M] = imx_clk_fixed_factor("gpt_3m", "osc", 1, 8);
206
207 clks[IMX6SX_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio",
208 CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock);
209 clks[IMX6SX_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div",
210 CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock);
211 clks[IMX6SX_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video",
212 CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock);
213 clks[IMX6SX_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div",
214 CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock);
215
216 /* name reg shift width parent_names num_parents */
217 clks[IMX6SX_CLK_LVDS1_SEL] = imx_clk_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels));
218
219 np = ccm_node;
220 base = of_iomap(np, 0);
221 WARN_ON(!base);
222
223 imx6q_pm_set_ccm_base(base);
224
225 /* name reg shift width parent_names num_parents */
226 clks[IMX6SX_CLK_STEP] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels));
227 clks[IMX6SX_CLK_PLL1_SW] = imx_clk_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels));
228 clks[IMX6SX_CLK_OCRAM_SEL] = imx_clk_mux("ocram_sel", base + 0x14, 6, 2, ocram_sels, ARRAY_SIZE(ocram_sels));
229 clks[IMX6SX_CLK_PERIPH_PRE] = imx_clk_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels));
230 clks[IMX6SX_CLK_PERIPH2_PRE] = imx_clk_mux("periph2_pre", base + 0x18, 21, 2, periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels));
231 clks[IMX6SX_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels));
232 clks[IMX6SX_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels));
233 clks[IMX6SX_CLK_PCIE_AXI_SEL] = imx_clk_mux("pcie_axi_sel", base + 0x18, 10, 1, pcie_axi_sels, ARRAY_SIZE(pcie_axi_sels));
234 clks[IMX6SX_CLK_GPU_AXI_SEL] = imx_clk_mux("gpu_axi_sel", base + 0x18, 8, 2, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels));
235 clks[IMX6SX_CLK_GPU_CORE_SEL] = imx_clk_mux("gpu_core_sel", base + 0x18, 4, 2, gpu_core_sels, ARRAY_SIZE(gpu_core_sels));
236 clks[IMX6SX_CLK_EIM_SLOW_SEL] = imx_clk_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels));
237 clks[IMX6SX_CLK_USDHC1_SEL] = imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels));
238 clks[IMX6SX_CLK_USDHC2_SEL] = imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels));
239 clks[IMX6SX_CLK_USDHC3_SEL] = imx_clk_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels));
240 clks[IMX6SX_CLK_USDHC4_SEL] = imx_clk_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels));
241 clks[IMX6SX_CLK_SSI3_SEL] = imx_clk_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels));
242 clks[IMX6SX_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels));
243 clks[IMX6SX_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels));
244 clks[IMX6SX_CLK_QSPI1_SEL] = imx_clk_mux_flags("qspi1_sel", base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels), CLK_SET_RATE_PARENT);
245 clks[IMX6SX_CLK_PERCLK_SEL] = imx_clk_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels));
246 clks[IMX6SX_CLK_VID_SEL] = imx_clk_mux("vid_sel", base + 0x20, 21, 3, vid_sels, ARRAY_SIZE(vid_sels));
247 clks[IMX6SX_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels));
248 clks[IMX6SX_CLK_CAN_SEL] = imx_clk_mux("can_sel", base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels));
249 clks[IMX6SX_CLK_UART_SEL] = imx_clk_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels));
250 clks[IMX6SX_CLK_QSPI2_SEL] = imx_clk_mux_flags("qspi2_sel", base + 0x2c, 15, 3, qspi2_sels, ARRAY_SIZE(qspi2_sels), CLK_SET_RATE_PARENT);
251 clks[IMX6SX_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels));
252 clks[IMX6SX_CLK_AUDIO_SEL] = imx_clk_mux("audio_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels));
253 clks[IMX6SX_CLK_ENET_PRE_SEL] = imx_clk_mux("enet_pre_sel", base + 0x34, 15, 3, enet_pre_sels, ARRAY_SIZE(enet_pre_sels));
254 clks[IMX6SX_CLK_ENET_SEL] = imx_clk_mux("enet_sel", base + 0x34, 9, 3, enet_sels, ARRAY_SIZE(enet_sels));
255 clks[IMX6SX_CLK_M4_PRE_SEL] = imx_clk_mux("m4_pre_sel", base + 0x34, 6, 3, m4_pre_sels, ARRAY_SIZE(m4_pre_sels));
256 clks[IMX6SX_CLK_M4_SEL] = imx_clk_mux("m4_sel", base + 0x34, 0, 3, m4_sels, ARRAY_SIZE(m4_sels));
257 clks[IMX6SX_CLK_ECSPI_SEL] = imx_clk_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels));
258 clks[IMX6SX_CLK_LCDIF2_PRE_SEL] = imx_clk_mux("lcdif2_pre_sel", base + 0x38, 6, 3, lcdif2_pre_sels, ARRAY_SIZE(lcdif2_pre_sels));
259 clks[IMX6SX_CLK_LCDIF2_SEL] = imx_clk_mux("lcdif2_sel", base + 0x38, 0, 3, lcdif2_sels, ARRAY_SIZE(lcdif2_sels));
260 clks[IMX6SX_CLK_DISPLAY_SEL] = imx_clk_mux("display_sel", base + 0x3c, 14, 2, display_sels, ARRAY_SIZE(display_sels));
261 clks[IMX6SX_CLK_CSI_SEL] = imx_clk_mux("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels));
262 clks[IMX6SX_CLK_CKO1_SEL] = imx_clk_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels));
263 clks[IMX6SX_CLK_CKO2_SEL] = imx_clk_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels));
264 clks[IMX6SX_CLK_CKO] = imx_clk_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels));
265
266 clks[IMX6SX_CLK_LDB_DI1_DIV_SEL] = imx_clk_mux_flags("ldb_di1_div_sel", base + 0x20, 11, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels), CLK_SET_RATE_PARENT);
267 clks[IMX6SX_CLK_LDB_DI0_DIV_SEL] = imx_clk_mux_flags("ldb_di0_div_sel", base + 0x20, 10, 1, ldb_di0_div_sels, ARRAY_SIZE(ldb_di0_div_sels), CLK_SET_RATE_PARENT);
268 clks[IMX6SX_CLK_LDB_DI1_SEL] = imx_clk_mux_flags("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di1_sels, ARRAY_SIZE(ldb_di1_sels), CLK_SET_RATE_PARENT);
269 clks[IMX6SX_CLK_LDB_DI0_SEL] = imx_clk_mux_flags("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di0_sels, ARRAY_SIZE(ldb_di0_sels), CLK_SET_RATE_PARENT);
270 clks[IMX6SX_CLK_LCDIF1_PRE_SEL] = imx_clk_mux_flags("lcdif1_pre_sel", base + 0x38, 15, 3, lcdif1_pre_sels, ARRAY_SIZE(lcdif1_pre_sels), CLK_SET_RATE_PARENT);
271 clks[IMX6SX_CLK_LCDIF1_SEL] = imx_clk_mux_flags("lcdif1_sel", base + 0x38, 9, 3, lcdif1_sels, ARRAY_SIZE(lcdif1_sels), CLK_SET_RATE_PARENT);
272
273 /* name parent_name reg shift width */
274 clks[IMX6SX_CLK_PERIPH_CLK2] = imx_clk_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3);
275 clks[IMX6SX_CLK_PERIPH2_CLK2] = imx_clk_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3);
276 clks[IMX6SX_CLK_IPG] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2);
277 clks[IMX6SX_CLK_GPU_CORE_PODF] = imx_clk_divider("gpu_core_podf", "gpu_core_sel", base + 0x18, 29, 3);
278 clks[IMX6SX_CLK_GPU_AXI_PODF] = imx_clk_divider("gpu_axi_podf", "gpu_axi_sel", base + 0x18, 26, 3);
279 clks[IMX6SX_CLK_LCDIF1_PODF] = imx_clk_divider("lcdif1_podf", "lcdif1_pred", base + 0x18, 23, 3);
280 clks[IMX6SX_CLK_QSPI1_PODF] = imx_clk_divider("qspi1_podf", "qspi1_sel", base + 0x1c, 26, 3);
281 clks[IMX6SX_CLK_EIM_SLOW_PODF] = imx_clk_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3);
282 clks[IMX6SX_CLK_LCDIF2_PODF] = imx_clk_divider("lcdif2_podf", "lcdif2_pred", base + 0x1c, 20, 3);
283 clks[IMX6SX_CLK_PERCLK] = imx_clk_divider("perclk", "perclk_sel", base + 0x1c, 0, 6);
284 clks[IMX6SX_CLK_VID_PODF] = imx_clk_divider("vid_podf", "vid_sel", base + 0x20, 24, 2);
285 clks[IMX6SX_CLK_CAN_PODF] = imx_clk_divider("can_podf", "can_sel", base + 0x20, 2, 6);
286 clks[IMX6SX_CLK_USDHC4_PODF] = imx_clk_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3);
287 clks[IMX6SX_CLK_USDHC3_PODF] = imx_clk_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3);
288 clks[IMX6SX_CLK_USDHC2_PODF] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3);
289 clks[IMX6SX_CLK_USDHC1_PODF] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3);
290 clks[IMX6SX_CLK_UART_PODF] = imx_clk_divider("uart_podf", "uart_sel", base + 0x24, 0, 6);
291 clks[IMX6SX_CLK_ESAI_PRED] = imx_clk_divider("esai_pred", "esai_sel", base + 0x28, 9, 3);
292 clks[IMX6SX_CLK_ESAI_PODF] = imx_clk_divider("esai_podf", "esai_pred", base + 0x28, 25, 3);
293 clks[IMX6SX_CLK_SSI3_PRED] = imx_clk_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3);
294 clks[IMX6SX_CLK_SSI3_PODF] = imx_clk_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6);
295 clks[IMX6SX_CLK_SSI1_PRED] = imx_clk_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3);
296 clks[IMX6SX_CLK_SSI1_PODF] = imx_clk_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6);
297 clks[IMX6SX_CLK_QSPI2_PRED] = imx_clk_divider("qspi2_pred", "qspi2_sel", base + 0x2c, 18, 3);
298 clks[IMX6SX_CLK_QSPI2_PODF] = imx_clk_divider("qspi2_podf", "qspi2_pred", base + 0x2c, 21, 6);
299 clks[IMX6SX_CLK_SSI2_PRED] = imx_clk_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3);
300 clks[IMX6SX_CLK_SSI2_PODF] = imx_clk_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6);
301 clks[IMX6SX_CLK_SPDIF_PRED] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3);
302 clks[IMX6SX_CLK_SPDIF_PODF] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3);
303 clks[IMX6SX_CLK_AUDIO_PRED] = imx_clk_divider("audio_pred", "audio_sel", base + 0x30, 12, 3);
304 clks[IMX6SX_CLK_AUDIO_PODF] = imx_clk_divider("audio_podf", "audio_pred", base + 0x30, 9, 3);
305 clks[IMX6SX_CLK_ENET_PODF] = imx_clk_divider("enet_podf", "enet_pre_sel", base + 0x34, 12, 3);
306 clks[IMX6SX_CLK_M4_PODF] = imx_clk_divider("m4_podf", "m4_sel", base + 0x34, 3, 3);
307 clks[IMX6SX_CLK_ECSPI_PODF] = imx_clk_divider("ecspi_podf", "ecspi_sel", base + 0x38, 19, 6);
308 clks[IMX6SX_CLK_LCDIF1_PRED] = imx_clk_divider("lcdif1_pred", "lcdif1_pre_sel", base + 0x38, 12, 3);
309 clks[IMX6SX_CLK_LCDIF2_PRED] = imx_clk_divider("lcdif2_pred", "lcdif2_pre_sel", base + 0x38, 3, 3);
310 clks[IMX6SX_CLK_DISPLAY_PODF] = imx_clk_divider("display_podf", "display_sel", base + 0x3c, 16, 3);
311 clks[IMX6SX_CLK_CSI_PODF] = imx_clk_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3);
312 clks[IMX6SX_CLK_CKO1_PODF] = imx_clk_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3);
313 clks[IMX6SX_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3);
314
315 clks[IMX6SX_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7);
316 clks[IMX6SX_CLK_LDB_DI0_DIV_7] = imx_clk_fixed_factor("ldb_di0_div_7", "ldb_di0_sel", 1, 7);
317 clks[IMX6SX_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7);
318 clks[IMX6SX_CLK_LDB_DI1_DIV_7] = imx_clk_fixed_factor("ldb_di1_div_7", "ldb_di1_sel", 1, 7);
319
320 /* name reg shift width busy: reg, shift parent_names num_parents */
321 clks[IMX6SX_CLK_PERIPH] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels));
322 clks[IMX6SX_CLK_PERIPH2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels));
323 /* name parent_name reg shift width busy: reg, shift */
324 clks[IMX6SX_CLK_OCRAM_PODF] = imx_clk_busy_divider("ocram_podf", "ocram_sel", base + 0x14, 16, 3, base + 0x48, 0);
325 clks[IMX6SX_CLK_AHB] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1);
326 clks[IMX6SX_CLK_MMDC_PODF] = imx_clk_busy_divider("mmdc_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2);
327 clks[IMX6SX_CLK_ARM] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16);
328
329 /* name parent_name reg shift */
330 /* CCGR0 */
331 clks[IMX6SX_CLK_AIPS_TZ1] = imx_clk_gate2("aips_tz1", "ahb", base + 0x68, 0);
332 clks[IMX6SX_CLK_AIPS_TZ2] = imx_clk_gate2("aips_tz2", "ahb", base + 0x68, 2);
333 clks[IMX6SX_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4);
334 clks[IMX6SX_CLK_ASRC_MEM] = imx_clk_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc);
335 clks[IMX6SX_CLK_ASRC_IPG] = imx_clk_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc);
336 clks[IMX6SX_CLK_CAAM_MEM] = imx_clk_gate2("caam_mem", "ahb", base + 0x68, 8);
337 clks[IMX6SX_CLK_CAAM_ACLK] = imx_clk_gate2("caam_aclk", "ahb", base + 0x68, 10);
338 clks[IMX6SX_CLK_CAAM_IPG] = imx_clk_gate2("caam_ipg", "ipg", base + 0x68, 12);
339 clks[IMX6SX_CLK_CAN1_IPG] = imx_clk_gate2("can1_ipg", "ipg", base + 0x68, 14);
340 clks[IMX6SX_CLK_CAN1_SERIAL] = imx_clk_gate2("can1_serial", "can_podf", base + 0x68, 16);
341 clks[IMX6SX_CLK_CAN2_IPG] = imx_clk_gate2("can2_ipg", "ipg", base + 0x68, 18);
342 clks[IMX6SX_CLK_CAN2_SERIAL] = imx_clk_gate2("can2_serial", "can_podf", base + 0x68, 20);
343 clks[IMX6SX_CLK_DCIC1] = imx_clk_gate2("dcic1", "display_podf", base + 0x68, 24);
344 clks[IMX6SX_CLK_DCIC2] = imx_clk_gate2("dcic2", "display_podf", base + 0x68, 26);
345 clks[IMX6SX_CLK_AIPS_TZ3] = imx_clk_gate2("aips_tz3", "ahb", base + 0x68, 30);
346
347 /* CCGR1 */
348 clks[IMX6SX_CLK_ECSPI1] = imx_clk_gate2("ecspi1", "ecspi_podf", base + 0x6c, 0);
349 clks[IMX6SX_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_podf", base + 0x6c, 2);
350 clks[IMX6SX_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_podf", base + 0x6c, 4);
351 clks[IMX6SX_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_podf", base + 0x6c, 6);
352 clks[IMX6SX_CLK_ECSPI5] = imx_clk_gate2("ecspi5", "ecspi_podf", base + 0x6c, 8);
353 clks[IMX6SX_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12);
354 clks[IMX6SX_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14);
355 clks[IMX6SX_CLK_ESAI_EXTAL] = imx_clk_gate2_shared("esai_extal", "esai_podf", base + 0x6c, 16, &share_count_esai);
356 clks[IMX6SX_CLK_ESAI_IPG] = imx_clk_gate2_shared("esai_ipg", "ahb", base + 0x6c, 16, &share_count_esai);
357 clks[IMX6SX_CLK_ESAI_MEM] = imx_clk_gate2_shared("esai_mem", "ahb", base + 0x6c, 16, &share_count_esai);
358 clks[IMX6SX_CLK_WAKEUP] = imx_clk_gate2("wakeup", "ipg", base + 0x6c, 18);
359 clks[IMX6SX_CLK_GPT_BUS] = imx_clk_gate2("gpt_bus", "perclk", base + 0x6c, 20);
360 clks[IMX6SX_CLK_GPT_SERIAL] = imx_clk_gate2("gpt_serial", "perclk", base + 0x6c, 22);
361 clks[IMX6SX_CLK_GPU] = imx_clk_gate2("gpu", "gpu_core_podf", base + 0x6c, 26);
362 clks[IMX6SX_CLK_CANFD] = imx_clk_gate2("canfd", "can_podf", base + 0x6c, 30);
363
364 /* CCGR2 */
365 clks[IMX6SX_CLK_CSI] = imx_clk_gate2("csi", "csi_podf", base + 0x70, 2);
366 clks[IMX6SX_CLK_I2C1] = imx_clk_gate2("i2c1", "perclk", base + 0x70, 6);
367 clks[IMX6SX_CLK_I2C2] = imx_clk_gate2("i2c2", "perclk", base + 0x70, 8);
368 clks[IMX6SX_CLK_I2C3] = imx_clk_gate2("i2c3", "perclk", base + 0x70, 10);
369 clks[IMX6SX_CLK_OCOTP] = imx_clk_gate2("ocotp", "ipg", base + 0x70, 12);
370 clks[IMX6SX_CLK_IOMUXC] = imx_clk_gate2("iomuxc", "lcdif1_podf", base + 0x70, 14);
371 clks[IMX6SX_CLK_IPMUX1] = imx_clk_gate2("ipmux1", "ahb", base + 0x70, 16);
372 clks[IMX6SX_CLK_IPMUX2] = imx_clk_gate2("ipmux2", "ahb", base + 0x70, 18);
373 clks[IMX6SX_CLK_IPMUX3] = imx_clk_gate2("ipmux3", "ahb", base + 0x70, 20);
374 clks[IMX6SX_CLK_TZASC1] = imx_clk_gate2("tzasc1", "mmdc_podf", base + 0x70, 22);
375 clks[IMX6SX_CLK_LCDIF_APB] = imx_clk_gate2("lcdif_apb", "display_podf", base + 0x70, 28);
376 clks[IMX6SX_CLK_PXP_AXI] = imx_clk_gate2("pxp_axi", "display_podf", base + 0x70, 30);
377
378 /* CCGR3 */
379 clks[IMX6SX_CLK_M4] = imx_clk_gate2("m4", "m4_podf", base + 0x74, 2);
380 clks[IMX6SX_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x74, 4);
381 clks[IMX6SX_CLK_ENET_AHB] = imx_clk_gate2("enet_ahb", "enet_sel", base + 0x74, 4);
382 clks[IMX6SX_CLK_DISPLAY_AXI] = imx_clk_gate2("display_axi", "display_podf", base + 0x74, 6);
383 clks[IMX6SX_CLK_LCDIF2_PIX] = imx_clk_gate2("lcdif2_pix", "lcdif2_sel", base + 0x74, 8);
384 clks[IMX6SX_CLK_LCDIF1_PIX] = imx_clk_gate2("lcdif1_pix", "lcdif1_sel", base + 0x74, 10);
385 clks[IMX6SX_CLK_LDB_DI0] = imx_clk_gate2("ldb_di0", "ldb_di0_div_sel", base + 0x74, 12);
386 clks[IMX6SX_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_podf", base + 0x74, 14);
387 clks[IMX6SX_CLK_MLB] = imx_clk_gate2("mlb", "ahb", base + 0x74, 18);
388 clks[IMX6SX_CLK_MMDC_P0_FAST] = imx_clk_gate2("mmdc_p0_fast", "mmdc_podf", base + 0x74, 20);
389 clks[IMX6SX_CLK_MMDC_P0_IPG] = imx_clk_gate2("mmdc_p0_ipg", "ipg", base + 0x74, 24);
390 clks[IMX6SX_CLK_OCRAM] = imx_clk_gate2("ocram", "ocram_podf", base + 0x74, 28);
391
392 /* CCGR4 */
393 clks[IMX6SX_CLK_PCIE_AXI] = imx_clk_gate2("pcie_axi", "display_podf", base + 0x78, 0);
394 clks[IMX6SX_CLK_QSPI2] = imx_clk_gate2("qspi2", "qspi2_podf", base + 0x78, 10);
395 clks[IMX6SX_CLK_PER1_BCH] = imx_clk_gate2("per1_bch", "usdhc3", base + 0x78, 12);
396 clks[IMX6SX_CLK_PER2_MAIN] = imx_clk_gate2("per2_main", "ahb", base + 0x78, 14);
397 clks[IMX6SX_CLK_PWM1] = imx_clk_gate2("pwm1", "perclk", base + 0x78, 16);
398 clks[IMX6SX_CLK_PWM2] = imx_clk_gate2("pwm2", "perclk", base + 0x78, 18);
399 clks[IMX6SX_CLK_PWM3] = imx_clk_gate2("pwm3", "perclk", base + 0x78, 20);
400 clks[IMX6SX_CLK_PWM4] = imx_clk_gate2("pwm4", "perclk", base + 0x78, 22);
401 clks[IMX6SX_CLK_GPMI_BCH_APB] = imx_clk_gate2("gpmi_bch_apb", "usdhc3", base + 0x78, 24);
402 clks[IMX6SX_CLK_GPMI_BCH] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26);
403 clks[IMX6SX_CLK_GPMI_IO] = imx_clk_gate2("gpmi_io", "qspi2_podf", base + 0x78, 28);
404 clks[IMX6SX_CLK_GPMI_APB] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30);
405
406 /* CCGR5 */
407 clks[IMX6SX_CLK_ROM] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0);
408 clks[IMX6SX_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6);
409 clks[IMX6SX_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12);
410 clks[IMX6SX_CLK_AUDIO] = imx_clk_gate2_shared("audio", "audio_podf", base + 0x7c, 14, &share_count_audio);
411 clks[IMX6SX_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio);
412 clks[IMX6SX_CLK_SSI1_IPG] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18);
413 clks[IMX6SX_CLK_SSI2_IPG] = imx_clk_gate2("ssi2_ipg", "ipg", base + 0x7c, 20);
414 clks[IMX6SX_CLK_SSI3_IPG] = imx_clk_gate2("ssi3_ipg", "ipg", base + 0x7c, 22);
415 clks[IMX6SX_CLK_SSI1] = imx_clk_gate2("ssi1", "ssi1_podf", base + 0x7c, 18);
416 clks[IMX6SX_CLK_SSI2] = imx_clk_gate2("ssi2", "ssi2_podf", base + 0x7c, 20);
417 clks[IMX6SX_CLK_SSI3] = imx_clk_gate2("ssi3", "ssi3_podf", base + 0x7c, 22);
418 clks[IMX6SX_CLK_UART_IPG] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24);
419 clks[IMX6SX_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_podf", base + 0x7c, 26);
420 clks[IMX6SX_CLK_SAI1_IPG] = imx_clk_gate2("sai1_ipg", "ipg", base + 0x7c, 28);
421 clks[IMX6SX_CLK_SAI2_IPG] = imx_clk_gate2("sai2_ipg", "ipg", base + 0x7c, 30);
422 clks[IMX6SX_CLK_SAI1] = imx_clk_gate2("sai1", "ssi1_podf", base + 0x7c, 28);
423 clks[IMX6SX_CLK_SAI2] = imx_clk_gate2("sai2", "ssi2_podf", base + 0x7c, 30);
424
425 /* CCGR6 */
426 clks[IMX6SX_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0);
427 clks[IMX6SX_CLK_USDHC1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2);
428 clks[IMX6SX_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4);
429 clks[IMX6SX_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6);
430 clks[IMX6SX_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8);
431 clks[IMX6SX_CLK_EIM_SLOW] = imx_clk_gate2("eim_slow", "eim_slow_podf", base + 0x80, 10);
432 clks[IMX6SX_CLK_PWM8] = imx_clk_gate2("pwm8", "perclk", base + 0x80, 16);
433 clks[IMX6SX_CLK_VADC] = imx_clk_gate2("vadc", "vid_podf", base + 0x80, 20);
434 clks[IMX6SX_CLK_GIS] = imx_clk_gate2("gis", "display_podf", base + 0x80, 22);
435 clks[IMX6SX_CLK_I2C4] = imx_clk_gate2("i2c4", "perclk", base + 0x80, 24);
436 clks[IMX6SX_CLK_PWM5] = imx_clk_gate2("pwm5", "perclk", base + 0x80, 26);
437 clks[IMX6SX_CLK_PWM6] = imx_clk_gate2("pwm6", "perclk", base + 0x80, 28);
438 clks[IMX6SX_CLK_PWM7] = imx_clk_gate2("pwm7", "perclk", base + 0x80, 30);
439
440 clks[IMX6SX_CLK_CKO1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7);
441 clks[IMX6SX_CLK_CKO2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24);
442
443 /* mask handshake of mmdc */
444 writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR);
445
446 for (i = 0; i < ARRAY_SIZE(clks); i++)
447 if (IS_ERR(clks[i]))
448 pr_err("i.MX6sx clk %d: register failed with %ld\n", i, PTR_ERR(clks[i]));
449
450 clk_data.clks = clks;
451 clk_data.clk_num = ARRAY_SIZE(clks);
452 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
453
454 clk_register_clkdev(clks[IMX6SX_CLK_GPT_BUS], "ipg", "imx-gpt.0");
455 clk_register_clkdev(clks[IMX6SX_CLK_GPT_SERIAL], "per", "imx-gpt.0");
456
457 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
458 clk_prepare_enable(clks[clks_init_on[i]]);
459
460 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
461 clk_prepare_enable(clks[IMX6SX_CLK_USBPHY1_GATE]);
462 clk_prepare_enable(clks[IMX6SX_CLK_USBPHY2_GATE]);
463 }
464
465 /* Set the default 132MHz for EIM module */
466 clk_set_parent(clks[IMX6SX_CLK_EIM_SLOW_SEL], clks[IMX6SX_CLK_PLL2_PFD2]);
467 clk_set_rate(clks[IMX6SX_CLK_EIM_SLOW], 132000000);
468
469 /* set parent clock for LCDIF1 pixel clock */
470 clk_set_parent(clks[IMX6SX_CLK_LCDIF1_PRE_SEL], clks[IMX6SX_CLK_PLL5_VIDEO_DIV]);
471 clk_set_parent(clks[IMX6SX_CLK_LCDIF1_SEL], clks[IMX6SX_CLK_LCDIF1_PODF]);
472
473 /* Set the parent clks of PCIe lvds1 and pcie_axi to be pcie ref, axi */
474 if (clk_set_parent(clks[IMX6SX_CLK_LVDS1_SEL], clks[IMX6SX_CLK_PCIE_REF_125M]))
475 pr_err("Failed to set pcie bus parent clk.\n");
476 if (clk_set_parent(clks[IMX6SX_CLK_PCIE_AXI_SEL], clks[IMX6SX_CLK_AXI]))
477 pr_err("Failed to set pcie parent clk.\n");
478
479 /*
480 * Init enet system AHB clock, set to 200Mhz
481 * pll2_pfd2_396m-> ENET_PODF-> ENET_AHB
482 */
483 clk_set_parent(clks[IMX6SX_CLK_ENET_PRE_SEL], clks[IMX6SX_CLK_PLL2_PFD2]);
484 clk_set_parent(clks[IMX6SX_CLK_ENET_SEL], clks[IMX6SX_CLK_ENET_PODF]);
485 clk_set_rate(clks[IMX6SX_CLK_ENET_PODF], 200000000);
486 clk_set_rate(clks[IMX6SX_CLK_ENET_REF], 125000000);
487 clk_set_rate(clks[IMX6SX_CLK_ENET2_REF], 125000000);
488
489 /* Audio clocks */
490 clk_set_rate(clks[IMX6SX_CLK_PLL4_AUDIO_DIV], 393216000);
491
492 clk_set_parent(clks[IMX6SX_CLK_SPDIF_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]);
493 clk_set_rate(clks[IMX6SX_CLK_SPDIF_PODF], 98304000);
494
495 clk_set_parent(clks[IMX6SX_CLK_AUDIO_SEL], clks[IMX6SX_CLK_PLL3_USB_OTG]);
496 clk_set_rate(clks[IMX6SX_CLK_AUDIO_PODF], 24000000);
497
498 clk_set_parent(clks[IMX6SX_CLK_SSI1_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]);
499 clk_set_parent(clks[IMX6SX_CLK_SSI2_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]);
500 clk_set_parent(clks[IMX6SX_CLK_SSI3_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]);
501 clk_set_rate(clks[IMX6SX_CLK_SSI1_PODF], 24576000);
502 clk_set_rate(clks[IMX6SX_CLK_SSI2_PODF], 24576000);
503 clk_set_rate(clks[IMX6SX_CLK_SSI3_PODF], 24576000);
504
505 clk_set_parent(clks[IMX6SX_CLK_ESAI_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]);
506 clk_set_rate(clks[IMX6SX_CLK_ESAI_PODF], 24576000);
507
508 /* Set parent clock for vadc */
509 clk_set_parent(clks[IMX6SX_CLK_VID_SEL], clks[IMX6SX_CLK_PLL3_USB_OTG]);
510
511 /* default parent of can_sel clock is invalid, manually set it here */
512 clk_set_parent(clks[IMX6SX_CLK_CAN_SEL], clks[IMX6SX_CLK_PLL3_60M]);
513
514 /* Update gpu clock from default 528M to 720M */
515 clk_set_parent(clks[IMX6SX_CLK_GPU_CORE_SEL], clks[IMX6SX_CLK_PLL3_PFD0]);
516 clk_set_parent(clks[IMX6SX_CLK_GPU_AXI_SEL], clks[IMX6SX_CLK_PLL3_PFD0]);
517
518 /* Set initial power mode */
519 imx6q_set_lpm(WAIT_CLOCKED);
520
521 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-gpt");
522 mxc_timer_init_dt(np);
523}
524CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init);
diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
index 048c5ad8a80b..e29f6ebe9f39 100644
--- a/arch/arm/mach-imx/clk.h
+++ b/arch/arm/mach-imx/clk.h
@@ -28,7 +28,8 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
28struct clk *clk_register_gate2(struct device *dev, const char *name, 28struct clk *clk_register_gate2(struct device *dev, const char *name,
29 const char *parent_name, unsigned long flags, 29 const char *parent_name, unsigned long flags,
30 void __iomem *reg, u8 bit_idx, 30 void __iomem *reg, u8 bit_idx,
31 u8 clk_gate_flags, spinlock_t *lock); 31 u8 clk_gate_flags, spinlock_t *lock,
32 unsigned int *share_count);
32 33
33struct clk * imx_obtain_fixed_clock( 34struct clk * imx_obtain_fixed_clock(
34 const char *name, unsigned long rate); 35 const char *name, unsigned long rate);
@@ -37,7 +38,15 @@ static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
37 void __iomem *reg, u8 shift) 38 void __iomem *reg, u8 shift)
38{ 39{
39 return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg, 40 return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
40 shift, 0, &imx_ccm_lock); 41 shift, 0, &imx_ccm_lock, NULL);
42}
43
44static inline struct clk *imx_clk_gate2_shared(const char *name,
45 const char *parent, void __iomem *reg, u8 shift,
46 unsigned int *share_count)
47{
48 return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
49 shift, 0, &imx_ccm_lock, share_count);
41} 50}
42 51
43struct clk *imx_clk_pfd(const char *name, const char *parent_name, 52struct clk *imx_clk_pfd(const char *name, const char *parent_name,
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index b5241ea76706..9ab785ce13e8 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -17,6 +17,7 @@ struct irq_data;
17struct platform_device; 17struct platform_device;
18struct pt_regs; 18struct pt_regs;
19struct clk; 19struct clk;
20struct device_node;
20enum mxc_cpu_pwr_mode; 21enum mxc_cpu_pwr_mode;
21 22
22void mx1_map_io(void); 23void mx1_map_io(void);
@@ -56,6 +57,7 @@ void imx51_init_late(void);
56void imx53_init_late(void); 57void imx53_init_late(void);
57void epit_timer_init(void __iomem *base, int irq); 58void epit_timer_init(void __iomem *base, int irq);
58void mxc_timer_init(void __iomem *, int); 59void mxc_timer_init(void __iomem *, int);
60void mxc_timer_init_dt(struct device_node *);
59int mx1_clocks_init(unsigned long fref); 61int mx1_clocks_init(unsigned long fref);
60int mx21_clocks_init(unsigned long lref, unsigned long fref); 62int mx21_clocks_init(unsigned long lref, unsigned long fref);
61int mx25_clocks_init(void); 63int mx25_clocks_init(void);
@@ -99,19 +101,6 @@ enum mx3_cpu_pwr_mode {
99void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode); 101void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode);
100void imx_print_silicon_rev(const char *cpu, int srev); 102void imx_print_silicon_rev(const char *cpu, int srev);
101 103
102void avic_handle_irq(struct pt_regs *);
103void tzic_handle_irq(struct pt_regs *);
104
105#define imx1_handle_irq avic_handle_irq
106#define imx21_handle_irq avic_handle_irq
107#define imx25_handle_irq avic_handle_irq
108#define imx27_handle_irq avic_handle_irq
109#define imx31_handle_irq avic_handle_irq
110#define imx35_handle_irq avic_handle_irq
111#define imx50_handle_irq tzic_handle_irq
112#define imx51_handle_irq tzic_handle_irq
113#define imx53_handle_irq tzic_handle_irq
114
115void imx_enable_cpu(int cpu, bool enable); 104void imx_enable_cpu(int cpu, bool enable);
116void imx_set_cpu_jump(int cpu, void *jump_addr); 105void imx_set_cpu_jump(int cpu, void *jump_addr);
117u32 imx_get_cpu_arg(int cpu); 106u32 imx_get_cpu_arg(int cpu);
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index ba3b498a67ec..bbe8ff1f0412 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -111,6 +111,9 @@ struct device * __init imx_soc_device_init(void)
111 case MXC_CPU_IMX6DL: 111 case MXC_CPU_IMX6DL:
112 soc_id = "i.MX6DL"; 112 soc_id = "i.MX6DL";
113 break; 113 break;
114 case MXC_CPU_IMX6SX:
115 soc_id = "i.MX6SX";
116 break;
114 case MXC_CPU_IMX6Q: 117 case MXC_CPU_IMX6Q:
115 soc_id = "i.MX6Q"; 118 soc_id = "i.MX6Q";
116 break; 119 break;
diff --git a/arch/arm/mach-imx/devices/platform-ipu-core.c b/arch/arm/mach-imx/devices/platform-ipu-core.c
index fc4dd7cedc11..6bd7c3f37ac0 100644
--- a/arch/arm/mach-imx/devices/platform-ipu-core.c
+++ b/arch/arm/mach-imx/devices/platform-ipu-core.c
@@ -77,7 +77,7 @@ struct platform_device *__init imx_alloc_mx3_camera(
77 77
78 pdev = platform_device_alloc("mx3-camera", 0); 78 pdev = platform_device_alloc("mx3-camera", 0);
79 if (!pdev) 79 if (!pdev)
80 goto err; 80 return ERR_PTR(-ENOMEM);
81 81
82 pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL); 82 pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
83 if (!pdev->dev.dma_mask) 83 if (!pdev->dev.dma_mask)
diff --git a/arch/arm/mach-imx/devices/platform-mx2-emma.c b/arch/arm/mach-imx/devices/platform-mx2-emma.c
index 11bd01d402f2..0dc0651825b1 100644
--- a/arch/arm/mach-imx/devices/platform-mx2-emma.c
+++ b/arch/arm/mach-imx/devices/platform-mx2-emma.c
@@ -12,7 +12,7 @@
12#define imx_mx2_emmaprp_data_entry_single(soc) \ 12#define imx_mx2_emmaprp_data_entry_single(soc) \
13 { \ 13 { \
14 .iobase = soc ## _EMMAPRP_BASE_ADDR, \ 14 .iobase = soc ## _EMMAPRP_BASE_ADDR, \
15 .iosize = SZ_32, \ 15 .iosize = SZ_256, \
16 .irq = soc ## _INT_EMMAPRP, \ 16 .irq = soc ## _INT_EMMAPRP, \
17 } 17 }
18 18
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
deleted file mode 100644
index 9be6c1e69d68..000000000000
--- a/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#include <linux/types.h>
23#include <linux/init.h>
24
25#include <linux/gpio.h>
26#include <linux/interrupt.h>
27#include <linux/leds.h>
28#include <linux/platform_device.h>
29#include <linux/input.h>
30#include <linux/i2c.h>
31#include <video/platform_lcd.h>
32#include <linux/backlight.h>
33
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/mach/map.h>
38
39#include "common.h"
40#include "devices-imx51.h"
41#include "hardware.h"
42#include "iomux-mx51.h"
43
44static iomux_v3_cfg_t eukrea_mbimxsd51_pads[] = {
45 /* LED */
46 MX51_PAD_NANDF_D10__GPIO3_30,
47 /* SWITCH */
48 NEW_PAD_CTRL(MX51_PAD_NANDF_D9__GPIO3_31, PAD_CTL_PUS_22K_UP |
49 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
50 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
51 /* UART2 */
52 MX51_PAD_UART2_RXD__UART2_RXD,
53 MX51_PAD_UART2_TXD__UART2_TXD,
54 /* UART 3 */
55 MX51_PAD_UART3_RXD__UART3_RXD,
56 MX51_PAD_UART3_TXD__UART3_TXD,
57 MX51_PAD_KEY_COL4__UART3_RTS,
58 MX51_PAD_KEY_COL5__UART3_CTS,
59 /* SD */
60 MX51_PAD_SD1_CMD__SD1_CMD,
61 MX51_PAD_SD1_CLK__SD1_CLK,
62 MX51_PAD_SD1_DATA0__SD1_DATA0,
63 MX51_PAD_SD1_DATA1__SD1_DATA1,
64 MX51_PAD_SD1_DATA2__SD1_DATA2,
65 MX51_PAD_SD1_DATA3__SD1_DATA3,
66 /* SD1 CD */
67 NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_PUS_22K_UP |
68 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
69 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
70 /* SSI */
71 MX51_PAD_AUD3_BB_TXD__AUD3_TXD,
72 MX51_PAD_AUD3_BB_RXD__AUD3_RXD,
73 MX51_PAD_AUD3_BB_CK__AUD3_TXC,
74 MX51_PAD_AUD3_BB_FS__AUD3_TXFS,
75 /* LCD Backlight */
76 MX51_PAD_DI1_D1_CS__GPIO3_4,
77 /* LCD RST */
78 MX51_PAD_CSI1_D9__GPIO3_13,
79};
80
81#define GPIO_LED1 IMX_GPIO_NR(3, 30)
82#define GPIO_SWITCH1 IMX_GPIO_NR(3, 31)
83#define GPIO_LCDRST IMX_GPIO_NR(3, 13)
84#define GPIO_LCDBL IMX_GPIO_NR(3, 4)
85
86static void eukrea_mbimxsd51_lcd_power_set(struct plat_lcd_data *pd,
87 unsigned int power)
88{
89 if (power)
90 gpio_direction_output(GPIO_LCDRST, 1);
91 else
92 gpio_direction_output(GPIO_LCDRST, 0);
93}
94
95static struct plat_lcd_data eukrea_mbimxsd51_lcd_power_data = {
96 .set_power = eukrea_mbimxsd51_lcd_power_set,
97};
98
99static struct platform_device eukrea_mbimxsd51_lcd_powerdev = {
100 .name = "platform-lcd",
101 .dev.platform_data = &eukrea_mbimxsd51_lcd_power_data,
102};
103
104static void eukrea_mbimxsd51_bl_set_intensity(int intensity)
105{
106 if (intensity)
107 gpio_direction_output(GPIO_LCDBL, 1);
108 else
109 gpio_direction_output(GPIO_LCDBL, 0);
110}
111
112static struct generic_bl_info eukrea_mbimxsd51_bl_info = {
113 .name = "eukrea_mbimxsd51-bl",
114 .max_intensity = 0xff,
115 .default_intensity = 0xff,
116 .set_bl_intensity = eukrea_mbimxsd51_bl_set_intensity,
117};
118
119static struct platform_device eukrea_mbimxsd51_bl_dev = {
120 .name = "generic-bl",
121 .id = 1,
122 .dev = {
123 .platform_data = &eukrea_mbimxsd51_bl_info,
124 },
125};
126
127static const struct gpio_led eukrea_mbimxsd51_leds[] __initconst = {
128 {
129 .name = "led1",
130 .default_trigger = "heartbeat",
131 .active_low = 1,
132 .gpio = GPIO_LED1,
133 },
134};
135
136static const struct gpio_led_platform_data
137 eukrea_mbimxsd51_led_info __initconst = {
138 .leds = eukrea_mbimxsd51_leds,
139 .num_leds = ARRAY_SIZE(eukrea_mbimxsd51_leds),
140};
141
142static struct gpio_keys_button eukrea_mbimxsd51_gpio_buttons[] = {
143 {
144 .gpio = GPIO_SWITCH1,
145 .code = BTN_0,
146 .desc = "BP1",
147 .active_low = 1,
148 .wakeup = 1,
149 },
150};
151
152static const struct gpio_keys_platform_data
153 eukrea_mbimxsd51_button_data __initconst = {
154 .buttons = eukrea_mbimxsd51_gpio_buttons,
155 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd51_gpio_buttons),
156};
157
158static const struct imxuart_platform_data uart_pdata __initconst = {
159 .flags = IMXUART_HAVE_RTSCTS,
160};
161
162static struct i2c_board_info eukrea_mbimxsd51_i2c_devices[] = {
163 {
164 I2C_BOARD_INFO("tlv320aic23", 0x1a),
165 },
166};
167
168static const
169struct imx_ssi_platform_data eukrea_mbimxsd51_ssi_pdata __initconst = {
170 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
171};
172
173static int screen_type;
174
175static int __init eukrea_mbimxsd51_screen_type(char *options)
176{
177 if (!strcmp(options, "dvi"))
178 screen_type = 1;
179 else if (!strcmp(options, "tft"))
180 screen_type = 0;
181
182 return 0;
183}
184__setup("screen_type=", eukrea_mbimxsd51_screen_type);
185
186/*
187 * system init for baseboard usage. Will be called by cpuimx51sd init.
188 *
189 * Add platform devices present on this baseboard and init
190 * them from CPU side as far as required to use them later on
191 */
192void __init eukrea_mbimxsd51_baseboard_init(void)
193{
194 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd51_pads,
195 ARRAY_SIZE(eukrea_mbimxsd51_pads)))
196 printk(KERN_ERR "error setting mbimxsd pads !\n");
197
198 imx51_add_imx_uart(1, NULL);
199 imx51_add_imx_uart(2, &uart_pdata);
200
201 imx51_add_sdhci_esdhc_imx(0, NULL);
202
203 imx51_add_imx_ssi(0, &eukrea_mbimxsd51_ssi_pdata);
204
205 gpio_request(GPIO_LED1, "LED1");
206 gpio_direction_output(GPIO_LED1, 1);
207 gpio_free(GPIO_LED1);
208
209 gpio_request(GPIO_SWITCH1, "SWITCH1");
210 gpio_direction_input(GPIO_SWITCH1);
211 gpio_free(GPIO_SWITCH1);
212
213 gpio_request(GPIO_LCDRST, "LCDRST");
214 gpio_direction_output(GPIO_LCDRST, 0);
215 gpio_request(GPIO_LCDBL, "LCDBL");
216 gpio_direction_output(GPIO_LCDBL, 0);
217 if (!screen_type) {
218 platform_device_register(&eukrea_mbimxsd51_bl_dev);
219 platform_device_register(&eukrea_mbimxsd51_lcd_powerdev);
220 } else {
221 gpio_free(GPIO_LCDRST);
222 gpio_free(GPIO_LCDBL);
223 }
224
225 i2c_register_board_info(0, eukrea_mbimxsd51_i2c_devices,
226 ARRAY_SIZE(eukrea_mbimxsd51_i2c_devices));
227
228 gpio_led_register_device(-1, &eukrea_mbimxsd51_led_info);
229 imx_add_gpio_keys(&eukrea_mbimxsd51_button_data);
230 imx_add_platform_device("eukrea_tlv320", 0, NULL, 0, NULL, 0);
231}
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
index 3e1ec5ffe630..42a65e067443 100644
--- a/arch/arm/mach-imx/imx25-dt.c
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -38,7 +38,6 @@ DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
38 .map_io = mx25_map_io, 38 .map_io = mx25_map_io,
39 .init_early = imx25_init_early, 39 .init_early = imx25_init_early,
40 .init_irq = mx25_init_irq, 40 .init_irq = mx25_init_irq,
41 .handle_irq = imx25_handle_irq,
42 .init_time = imx25_timer_init, 41 .init_time = imx25_timer_init,
43 .init_machine = imx25_dt_init, 42 .init_machine = imx25_dt_init,
44 .dt_compat = imx25_dt_board_compat, 43 .dt_compat = imx25_dt_board_compat,
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index 4e235ecb4021..17bd4058133d 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -43,7 +43,6 @@ DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)")
43 .map_io = mx27_map_io, 43 .map_io = mx27_map_io,
44 .init_early = imx27_init_early, 44 .init_early = imx27_init_early,
45 .init_irq = mx27_init_irq, 45 .init_irq = mx27_init_irq,
46 .handle_irq = imx27_handle_irq,
47 .init_time = imx27_timer_init, 46 .init_time = imx27_timer_init,
48 .init_machine = imx27_dt_init, 47 .init_machine = imx27_dt_init,
49 .dt_compat = imx27_dt_board_compat, 48 .dt_compat = imx27_dt_board_compat,
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
index e1e70ef7bc2d..581f4d6c9b8a 100644
--- a/arch/arm/mach-imx/imx31-dt.c
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -39,7 +39,6 @@ DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)")
39 .map_io = mx31_map_io, 39 .map_io = mx31_map_io,
40 .init_early = imx31_init_early, 40 .init_early = imx31_init_early,
41 .init_irq = mx31_init_irq, 41 .init_irq = mx31_init_irq,
42 .handle_irq = imx31_handle_irq,
43 .init_time = imx31_dt_timer_init, 42 .init_time = imx31_dt_timer_init,
44 .init_machine = imx31_dt_init, 43 .init_machine = imx31_dt_init,
45 .dt_compat = imx31_dt_board_compat, 44 .dt_compat = imx31_dt_board_compat,
diff --git a/arch/arm/mach-imx/imx35-dt.c b/arch/arm/mach-imx/imx35-dt.c
index 9d48e0065a63..a62854c59240 100644
--- a/arch/arm/mach-imx/imx35-dt.c
+++ b/arch/arm/mach-imx/imx35-dt.c
@@ -43,7 +43,6 @@ DT_MACHINE_START(IMX35_DT, "Freescale i.MX35 (Device Tree Support)")
43 .map_io = mx35_map_io, 43 .map_io = mx35_map_io,
44 .init_early = imx35_init_early, 44 .init_early = imx35_init_early,
45 .init_irq = imx35_irq_init, 45 .init_irq = imx35_irq_init,
46 .handle_irq = imx35_handle_irq,
47 .init_machine = imx35_dt_init, 46 .init_machine = imx35_dt_init,
48 .dt_compat = imx35_dt_board_compat, 47 .dt_compat = imx35_dt_board_compat,
49 .restart = mxc_restart, 48 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 0230d78d1413..b8cd968faa52 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -38,7 +38,6 @@ DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
38 .map_io = mx51_map_io, 38 .map_io = mx51_map_io,
39 .init_early = imx51_init_early, 39 .init_early = imx51_init_early,
40 .init_irq = mx51_init_irq, 40 .init_irq = mx51_init_irq,
41 .handle_irq = imx51_handle_irq,
42 .init_machine = imx51_dt_init, 41 .init_machine = imx51_dt_init,
43 .init_late = imx51_init_late, 42 .init_late = imx51_init_late,
44 .dt_compat = imx51_dt_board_compat, 43 .dt_compat = imx51_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-apf9328.c b/arch/arm/mach-imx/mach-apf9328.c
index 067580b2969b..ebbb5ab63529 100644
--- a/arch/arm/mach-imx/mach-apf9328.c
+++ b/arch/arm/mach-imx/mach-apf9328.c
@@ -142,7 +142,6 @@ MACHINE_START(APF9328, "Armadeus APF9328")
142 .map_io = mx1_map_io, 142 .map_io = mx1_map_io,
143 .init_early = imx1_init_early, 143 .init_early = imx1_init_early,
144 .init_irq = mx1_init_irq, 144 .init_irq = mx1_init_irq,
145 .handle_irq = imx1_handle_irq,
146 .init_time = apf9328_timer_init, 145 .init_time = apf9328_timer_init,
147 .init_machine = apf9328_init, 146 .init_machine = apf9328_init,
148 .restart = mxc_restart, 147 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c
index 58b864a3fc20..39406b7e3228 100644
--- a/arch/arm/mach-imx/mach-armadillo5x0.c
+++ b/arch/arm/mach-imx/mach-armadillo5x0.c
@@ -562,7 +562,6 @@ MACHINE_START(ARMADILLO5X0, "Armadillo-500")
562 .map_io = mx31_map_io, 562 .map_io = mx31_map_io,
563 .init_early = imx31_init_early, 563 .init_early = imx31_init_early,
564 .init_irq = mx31_init_irq, 564 .init_irq = mx31_init_irq,
565 .handle_irq = imx31_handle_irq,
566 .init_time = armadillo5x0_timer_init, 565 .init_time = armadillo5x0_timer_init,
567 .init_machine = armadillo5x0_init, 566 .init_machine = armadillo5x0_init,
568 .restart = mxc_restart, 567 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-bug.c b/arch/arm/mach-imx/mach-bug.c
index 2d00476f7d2c..c97d7cb39135 100644
--- a/arch/arm/mach-imx/mach-bug.c
+++ b/arch/arm/mach-imx/mach-bug.c
@@ -57,7 +57,6 @@ MACHINE_START(BUG, "BugLabs BUGBase")
57 .map_io = mx31_map_io, 57 .map_io = mx31_map_io,
58 .init_early = imx31_init_early, 58 .init_early = imx31_init_early,
59 .init_irq = mx31_init_irq, 59 .init_irq = mx31_init_irq,
60 .handle_irq = imx31_handle_irq,
61 .init_time = bug_timer_init, 60 .init_time = bug_timer_init,
62 .init_machine = bug_board_init, 61 .init_machine = bug_board_init,
63 .restart = mxc_restart, 62 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index ea50870bda80..75b7b6aa2720 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -314,7 +314,6 @@ MACHINE_START(EUKREA_CPUIMX27, "EUKREA CPUIMX27")
314 .map_io = mx27_map_io, 314 .map_io = mx27_map_io,
315 .init_early = imx27_init_early, 315 .init_early = imx27_init_early,
316 .init_irq = mx27_init_irq, 316 .init_irq = mx27_init_irq,
317 .handle_irq = imx27_handle_irq,
318 .init_time = eukrea_cpuimx27_timer_init, 317 .init_time = eukrea_cpuimx27_timer_init,
319 .init_machine = eukrea_cpuimx27_init, 318 .init_machine = eukrea_cpuimx27_init,
320 .restart = mxc_restart, 319 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
index 65e4c53e1554..1ffa27169045 100644
--- a/arch/arm/mach-imx/mach-cpuimx35.c
+++ b/arch/arm/mach-imx/mach-cpuimx35.c
@@ -199,7 +199,6 @@ MACHINE_START(EUKREA_CPUIMX35SD, "Eukrea CPUIMX35")
199 .map_io = mx35_map_io, 199 .map_io = mx35_map_io,
200 .init_early = imx35_init_early, 200 .init_early = imx35_init_early,
201 .init_irq = mx35_init_irq, 201 .init_irq = mx35_init_irq,
202 .handle_irq = imx35_handle_irq,
203 .init_time = eukrea_cpuimx35_timer_init, 202 .init_time = eukrea_cpuimx35_timer_init,
204 .init_machine = eukrea_cpuimx35_init, 203 .init_machine = eukrea_cpuimx35_init,
205 .restart = mxc_restart, 204 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c
deleted file mode 100644
index 1fba2b8e983f..000000000000
--- a/arch/arm/mach-imx/mach-cpuimx51sd.c
+++ /dev/null
@@ -1,364 +0,0 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * based on board-mx51_babbage.c which is
6 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
7 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
8 *
9 * The code contained herein is licensed under the GNU General Public
10 * License. You may obtain a copy of the GNU General Public License
11 * Version 2 or later at the following locations:
12 *
13 * http://www.opensource.org/licenses/gpl-license.html
14 * http://www.gnu.org/copyleft/gpl.html
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/i2c.h>
20#include <linux/i2c/tsc2007.h>
21#include <linux/gpio.h>
22#include <linux/delay.h>
23#include <linux/io.h>
24#include <linux/interrupt.h>
25#include <linux/i2c-gpio.h>
26#include <linux/spi/spi.h>
27#include <linux/can/platform/mcp251x.h>
28
29#include <asm/setup.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33
34#include "common.h"
35#include "devices-imx51.h"
36#include "eukrea-baseboards.h"
37#include "hardware.h"
38#include "iomux-mx51.h"
39
40#define USBH1_RST IMX_GPIO_NR(2, 28)
41#define ETH_RST IMX_GPIO_NR(2, 31)
42#define TSC2007_IRQGPIO_REV2 IMX_GPIO_NR(3, 12)
43#define TSC2007_IRQGPIO_REV3 IMX_GPIO_NR(4, 0)
44#define CAN_IRQGPIO IMX_GPIO_NR(1, 1)
45#define CAN_RST IMX_GPIO_NR(4, 15)
46#define CAN_NCS IMX_GPIO_NR(4, 24)
47#define CAN_RXOBF_REV2 IMX_GPIO_NR(1, 4)
48#define CAN_RXOBF_REV3 IMX_GPIO_NR(3, 12)
49#define CAN_RX1BF IMX_GPIO_NR(1, 6)
50#define CAN_TXORTS IMX_GPIO_NR(1, 7)
51#define CAN_TX1RTS IMX_GPIO_NR(1, 8)
52#define CAN_TX2RTS IMX_GPIO_NR(1, 9)
53#define I2C_SCL IMX_GPIO_NR(4, 16)
54#define I2C_SDA IMX_GPIO_NR(4, 17)
55
56/* USB_CTRL_1 */
57#define MX51_USB_CTRL_1_OFFSET 0x10
58#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
59
60#define MX51_USB_PLLDIV_12_MHZ 0x00
61#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
62#define MX51_USB_PLL_DIV_24_MHZ 0x02
63
64static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {
65 /* UART1 */
66 MX51_PAD_UART1_RXD__UART1_RXD,
67 MX51_PAD_UART1_TXD__UART1_TXD,
68 MX51_PAD_UART1_RTS__UART1_RTS,
69 MX51_PAD_UART1_CTS__UART1_CTS,
70
71 /* USB HOST1 */
72 MX51_PAD_USBH1_CLK__USBH1_CLK,
73 MX51_PAD_USBH1_DIR__USBH1_DIR,
74 MX51_PAD_USBH1_NXT__USBH1_NXT,
75 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
76 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
77 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
78 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
79 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
80 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
81 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
82 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
83 MX51_PAD_USBH1_STP__USBH1_STP,
84 MX51_PAD_EIM_CS3__GPIO2_28, /* PHY nRESET */
85
86 /* FEC */
87 MX51_PAD_EIM_DTACK__GPIO2_31, /* PHY nRESET */
88
89 /* HSI2C */
90 MX51_PAD_I2C1_CLK__GPIO4_16,
91 MX51_PAD_I2C1_DAT__GPIO4_17,
92
93 /* I2C1 */
94 MX51_PAD_SD2_CMD__I2C1_SCL,
95 MX51_PAD_SD2_CLK__I2C1_SDA,
96
97 /* CAN */
98 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
99 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
100 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
101 MX51_PAD_CSPI1_SS0__GPIO4_24, /* nCS */
102 MX51_PAD_CSI2_PIXCLK__GPIO4_15, /* nReset */
103 MX51_PAD_GPIO1_1__GPIO1_1, /* IRQ */
104 MX51_PAD_GPIO1_4__GPIO1_4, /* Control signals */
105 MX51_PAD_GPIO1_6__GPIO1_6,
106 MX51_PAD_GPIO1_7__GPIO1_7,
107 MX51_PAD_GPIO1_8__GPIO1_8,
108 MX51_PAD_GPIO1_9__GPIO1_9,
109
110 /* Touchscreen */
111 /* IRQ */
112 NEW_PAD_CTRL(MX51_PAD_GPIO_NAND__GPIO_NAND, PAD_CTL_PUS_22K_UP |
113 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
114 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
115 NEW_PAD_CTRL(MX51_PAD_NANDF_D8__GPIO4_0, PAD_CTL_PUS_22K_UP |
116 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
117 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
118};
119
120static const struct imxuart_platform_data uart_pdata __initconst = {
121 .flags = IMXUART_HAVE_RTSCTS,
122};
123
124static int tsc2007_get_pendown_state(struct device *dev)
125{
126 if (mx51_revision() < IMX_CHIP_REVISION_3_0)
127 return !gpio_get_value(TSC2007_IRQGPIO_REV2);
128 else
129 return !gpio_get_value(TSC2007_IRQGPIO_REV3);
130}
131
132static struct tsc2007_platform_data tsc2007_info = {
133 .model = 2007,
134 .x_plate_ohms = 180,
135 .get_pendown_state = tsc2007_get_pendown_state,
136};
137
138static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
139 {
140 I2C_BOARD_INFO("pcf8563", 0x51),
141 }, {
142 I2C_BOARD_INFO("tsc2007", 0x49),
143 .platform_data = &tsc2007_info,
144 },
145};
146
147static const struct mxc_nand_platform_data
148 eukrea_cpuimx51sd_nand_board_info __initconst = {
149 .width = 1,
150 .hw_ecc = 1,
151 .flash_bbt = 1,
152};
153
154/* This function is board specific as the bit mask for the plldiv will also
155be different for other Freescale SoCs, thus a common bitmask is not
156possible and cannot get place in /plat-mxc/ehci.c.*/
157static int initialize_otg_port(struct platform_device *pdev)
158{
159 u32 v;
160 void __iomem *usb_base;
161 void __iomem *usbother_base;
162
163 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
164 if (!usb_base)
165 return -ENOMEM;
166 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
167
168 /* Set the PHY clock to 19.2MHz */
169 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
170 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
171 v |= MX51_USB_PLL_DIV_19_2_MHZ;
172 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
173 iounmap(usb_base);
174
175 mdelay(10);
176
177 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
178}
179
180static int initialize_usbh1_port(struct platform_device *pdev)
181{
182 u32 v;
183 void __iomem *usb_base;
184 void __iomem *usbother_base;
185
186 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
187 if (!usb_base)
188 return -ENOMEM;
189 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
190
191 /* The clock for the USBH1 ULPI port will come from the PHY. */
192 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
193 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN,
194 usbother_base + MX51_USB_CTRL_1_OFFSET);
195 iounmap(usb_base);
196
197 mdelay(10);
198
199 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
200 MXC_EHCI_ITC_NO_THRESHOLD);
201}
202
203static const struct mxc_usbh_platform_data dr_utmi_config __initconst = {
204 .init = initialize_otg_port,
205 .portsc = MXC_EHCI_UTMI_16BIT,
206};
207
208static const struct fsl_usb2_platform_data usb_pdata __initconst = {
209 .operating_mode = FSL_USB2_DR_DEVICE,
210 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
211};
212
213static const struct mxc_usbh_platform_data usbh1_config __initconst = {
214 .init = initialize_usbh1_port,
215 .portsc = MXC_EHCI_MODE_ULPI,
216};
217
218static bool otg_mode_host __initdata;
219
220static int __init eukrea_cpuimx51sd_otg_mode(char *options)
221{
222 if (!strcmp(options, "host"))
223 otg_mode_host = true;
224 else if (!strcmp(options, "device"))
225 otg_mode_host = false;
226 else
227 pr_info("otg_mode neither \"host\" nor \"device\". "
228 "Defaulting to device\n");
229 return 1;
230}
231__setup("otg_mode=", eukrea_cpuimx51sd_otg_mode);
232
233static struct i2c_gpio_platform_data pdata = {
234 .sda_pin = I2C_SDA,
235 .sda_is_open_drain = 0,
236 .scl_pin = I2C_SCL,
237 .scl_is_open_drain = 0,
238 .udelay = 2,
239};
240
241static struct platform_device hsi2c_gpio_device = {
242 .name = "i2c-gpio",
243 .id = 0,
244 .dev.platform_data = &pdata,
245};
246
247static struct mcp251x_platform_data mcp251x_info = {
248 .oscillator_frequency = 24E6,
249};
250
251static struct spi_board_info cpuimx51sd_spi_device[] = {
252 {
253 .modalias = "mcp2515",
254 .max_speed_hz = 10000000,
255 .bus_num = 0,
256 .mode = SPI_MODE_0,
257 .chip_select = 0,
258 .platform_data = &mcp251x_info,
259 /* irq number is run-time assigned */
260 },
261};
262
263static int cpuimx51sd_spi1_cs[] = {
264 CAN_NCS,
265};
266
267static const struct spi_imx_master cpuimx51sd_ecspi1_pdata __initconst = {
268 .chipselect = cpuimx51sd_spi1_cs,
269 .num_chipselect = ARRAY_SIZE(cpuimx51sd_spi1_cs),
270};
271
272static struct platform_device *rev2_platform_devices[] __initdata = {
273 &hsi2c_gpio_device,
274};
275
276static const struct imxi2c_platform_data cpuimx51sd_i2c_data __initconst = {
277 .bitrate = 100000,
278};
279
280static void __init eukrea_cpuimx51sd_init(void)
281{
282 imx51_soc_init();
283
284 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads,
285 ARRAY_SIZE(eukrea_cpuimx51sd_pads));
286
287 imx51_add_imx_uart(0, &uart_pdata);
288 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info);
289 imx51_add_imx2_wdt(0);
290
291 gpio_request(ETH_RST, "eth_rst");
292 gpio_set_value(ETH_RST, 1);
293 imx51_add_fec(NULL);
294
295 gpio_request(CAN_IRQGPIO, "can_irq");
296 gpio_direction_input(CAN_IRQGPIO);
297 gpio_free(CAN_IRQGPIO);
298 gpio_request(CAN_NCS, "can_ncs");
299 gpio_direction_output(CAN_NCS, 1);
300 gpio_free(CAN_NCS);
301 gpio_request(CAN_RST, "can_rst");
302 gpio_direction_output(CAN_RST, 0);
303 msleep(20);
304 gpio_set_value(CAN_RST, 1);
305 imx51_add_ecspi(0, &cpuimx51sd_ecspi1_pdata);
306 cpuimx51sd_spi_device[0].irq = gpio_to_irq(CAN_IRQGPIO);
307 spi_register_board_info(cpuimx51sd_spi_device,
308 ARRAY_SIZE(cpuimx51sd_spi_device));
309
310 if (mx51_revision() < IMX_CHIP_REVISION_3_0) {
311 eukrea_cpuimx51sd_i2c_devices[1].irq =
312 gpio_to_irq(TSC2007_IRQGPIO_REV2),
313 platform_add_devices(rev2_platform_devices,
314 ARRAY_SIZE(rev2_platform_devices));
315 gpio_request(TSC2007_IRQGPIO_REV2, "tsc2007_irq");
316 gpio_direction_input(TSC2007_IRQGPIO_REV2);
317 gpio_free(TSC2007_IRQGPIO_REV2);
318 } else {
319 eukrea_cpuimx51sd_i2c_devices[1].irq =
320 gpio_to_irq(TSC2007_IRQGPIO_REV3),
321 imx51_add_imx_i2c(0, &cpuimx51sd_i2c_data);
322 gpio_request(TSC2007_IRQGPIO_REV3, "tsc2007_irq");
323 gpio_direction_input(TSC2007_IRQGPIO_REV3);
324 gpio_free(TSC2007_IRQGPIO_REV3);
325 }
326
327 i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices,
328 ARRAY_SIZE(eukrea_cpuimx51sd_i2c_devices));
329
330 if (otg_mode_host)
331 imx51_add_mxc_ehci_otg(&dr_utmi_config);
332 else {
333 initialize_otg_port(NULL);
334 imx51_add_fsl_usb2_udc(&usb_pdata);
335 }
336
337 gpio_request(USBH1_RST, "usb_rst");
338 gpio_direction_output(USBH1_RST, 0);
339 msleep(20);
340 gpio_set_value(USBH1_RST, 1);
341 imx51_add_mxc_ehci_hs(1, &usbh1_config);
342
343#ifdef CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD
344 eukrea_mbimxsd51_baseboard_init();
345#endif
346}
347
348static void __init eukrea_cpuimx51sd_timer_init(void)
349{
350 mx51_clocks_init(32768, 24000000, 22579200, 0);
351}
352
353MACHINE_START(EUKREA_CPUIMX51SD, "Eukrea CPUIMX51SD")
354 /* Maintainer: Eric Bénard <eric@eukrea.com> */
355 .atag_offset = 0x100,
356 .map_io = mx51_map_io,
357 .init_early = imx51_init_early,
358 .init_irq = mx51_init_irq,
359 .handle_irq = imx51_handle_irq,
360 .init_time = eukrea_cpuimx51sd_timer_init,
361 .init_machine = eukrea_cpuimx51sd_init,
362 .init_late = imx51_init_late,
363 .restart = mxc_restart,
364MACHINE_END
diff --git a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
index 4bf454424249..e978dda1434c 100644
--- a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
+++ b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
@@ -165,7 +165,6 @@ MACHINE_START(EUKREA_CPUIMX25SD, "Eukrea CPUIMX25")
165 .map_io = mx25_map_io, 165 .map_io = mx25_map_io,
166 .init_early = imx25_init_early, 166 .init_early = imx25_init_early,
167 .init_irq = mx25_init_irq, 167 .init_irq = mx25_init_irq,
168 .handle_irq = imx25_handle_irq,
169 .init_time = eukrea_cpuimx25_timer_init, 168 .init_time = eukrea_cpuimx25_timer_init,
170 .init_machine = eukrea_cpuimx25_init, 169 .init_machine = eukrea_cpuimx25_init,
171 .restart = mxc_restart, 170 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index 97f9c6297fcf..b61bd8ed5568 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -604,7 +604,6 @@ MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10")
604 .map_io = mx27_map_io, 604 .map_io = mx27_map_io,
605 .init_early = imx27_init_early, 605 .init_early = imx27_init_early,
606 .init_irq = mx27_init_irq, 606 .init_irq = mx27_init_irq,
607 .handle_irq = imx27_handle_irq,
608 .init_time = visstrim_m10_timer_init, 607 .init_time = visstrim_m10_timer_init,
609 .init_machine = visstrim_m10_board_init, 608 .init_machine = visstrim_m10_board_init,
610 .restart = mxc_restart, 609 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-imx27ipcam.c b/arch/arm/mach-imx/mach-imx27ipcam.c
index 1a851aea6832..bb3ca0429680 100644
--- a/arch/arm/mach-imx/mach-imx27ipcam.c
+++ b/arch/arm/mach-imx/mach-imx27ipcam.c
@@ -71,7 +71,6 @@ MACHINE_START(IMX27IPCAM, "Freescale IMX27IPCAM")
71 .map_io = mx27_map_io, 71 .map_io = mx27_map_io,
72 .init_early = imx27_init_early, 72 .init_early = imx27_init_early,
73 .init_irq = mx27_init_irq, 73 .init_irq = mx27_init_irq,
74 .handle_irq = imx27_handle_irq,
75 .init_time = mx27ipcam_timer_init, 74 .init_time = mx27ipcam_timer_init,
76 .init_machine = mx27ipcam_init, 75 .init_machine = mx27ipcam_init,
77 .restart = mxc_restart, 76 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-imx27lite.c b/arch/arm/mach-imx/mach-imx27lite.c
index 3da2e3e44ce9..9992089d3ad1 100644
--- a/arch/arm/mach-imx/mach-imx27lite.c
+++ b/arch/arm/mach-imx/mach-imx27lite.c
@@ -77,7 +77,6 @@ MACHINE_START(IMX27LITE, "LogicPD i.MX27LITE")
77 .map_io = mx27_map_io, 77 .map_io = mx27_map_io,
78 .init_early = imx27_init_early, 78 .init_early = imx27_init_early,
79 .init_irq = mx27_init_irq, 79 .init_irq = mx27_init_irq,
80 .handle_irq = imx27_handle_irq,
81 .init_time = mx27lite_timer_init, 80 .init_time = mx27lite_timer_init,
82 .init_machine = mx27lite_init, 81 .init_machine = mx27lite_init,
83 .restart = mxc_restart, 82 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-imx50.c b/arch/arm/mach-imx/mach-imx50.c
index 77b77a92bb5d..b899c0b59afd 100644
--- a/arch/arm/mach-imx/mach-imx50.c
+++ b/arch/arm/mach-imx/mach-imx50.c
@@ -31,7 +31,6 @@ static const char *imx50_dt_board_compat[] __initconst = {
31DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)") 31DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
32 .map_io = mx53_map_io, 32 .map_io = mx53_map_io,
33 .init_irq = mx53_init_irq, 33 .init_irq = mx53_init_irq,
34 .handle_irq = imx50_handle_irq,
35 .init_machine = imx50_dt_init, 34 .init_machine = imx50_dt_init,
36 .dt_compat = imx50_dt_board_compat, 35 .dt_compat = imx50_dt_board_compat,
37 .restart = mxc_restart, 36 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 65850908a4b4..2bad387956c0 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -40,7 +40,6 @@ DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
40 .map_io = mx53_map_io, 40 .map_io = mx53_map_io,
41 .init_early = imx53_init_early, 41 .init_early = imx53_init_early,
42 .init_irq = mx53_init_irq, 42 .init_irq = mx53_init_irq,
43 .handle_irq = imx53_handle_irq,
44 .init_machine = imx53_dt_init, 43 .init_machine = imx53_dt_init,
45 .init_late = imx53_init_late, 44 .init_late = imx53_init_late,
46 .dt_compat = imx53_dt_board_compat, 45 .dt_compat = imx53_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
new file mode 100644
index 000000000000..02fccf6033ac
--- /dev/null
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -0,0 +1,51 @@
1/*
2 * Copyright 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/irqchip.h>
10#include <linux/of_platform.h>
11#include <asm/mach/arch.h>
12#include <asm/mach/map.h>
13
14#include "common.h"
15
16static void __init imx6sx_init_machine(void)
17{
18 struct device *parent;
19
20 mxc_arch_reset_init_dt();
21
22 parent = imx_soc_device_init();
23 if (parent == NULL)
24 pr_warn("failed to initialize soc device\n");
25
26 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
27
28 imx_anatop_init();
29}
30
31static void __init imx6sx_init_irq(void)
32{
33 imx_init_revision_from_anatop();
34 imx_init_l2cache();
35 imx_src_init();
36 imx_gpc_init();
37 irqchip_init();
38}
39
40static const char *imx6sx_dt_compat[] __initconst = {
41 "fsl,imx6sx",
42 NULL,
43};
44
45DT_MACHINE_START(IMX6SX, "Freescale i.MX6 SoloX (Device Tree)")
46 .map_io = debug_ll_io_init,
47 .init_irq = imx6sx_init_irq,
48 .init_machine = imx6sx_init_machine,
49 .dt_compat = imx6sx_dt_compat,
50 .restart = mxc_restart,
51MACHINE_END
diff --git a/arch/arm/mach-imx/mach-kzm_arm11_01.c b/arch/arm/mach-imx/mach-kzm_arm11_01.c
index c7bc41d6b468..31df4361996f 100644
--- a/arch/arm/mach-imx/mach-kzm_arm11_01.c
+++ b/arch/arm/mach-imx/mach-kzm_arm11_01.c
@@ -289,7 +289,6 @@ MACHINE_START(KZM_ARM11_01, "Kyoto Microcomputer Co., Ltd. KZM-ARM11-01")
289 .map_io = kzm_map_io, 289 .map_io = kzm_map_io,
290 .init_early = imx31_init_early, 290 .init_early = imx31_init_early,
291 .init_irq = mx31_init_irq, 291 .init_irq = mx31_init_irq,
292 .handle_irq = imx31_handle_irq,
293 .init_time = kzm_timer_init, 292 .init_time = kzm_timer_init,
294 .init_machine = kzm_board_init, 293 .init_machine = kzm_board_init,
295 .restart = mxc_restart, 294 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx1ads.c b/arch/arm/mach-imx/mach-mx1ads.c
index 9f883e4d6fc9..77fda3de4290 100644
--- a/arch/arm/mach-imx/mach-mx1ads.c
+++ b/arch/arm/mach-imx/mach-mx1ads.c
@@ -138,7 +138,6 @@ MACHINE_START(MX1ADS, "Freescale MX1ADS")
138 .map_io = mx1_map_io, 138 .map_io = mx1_map_io,
139 .init_early = imx1_init_early, 139 .init_early = imx1_init_early,
140 .init_irq = mx1_init_irq, 140 .init_irq = mx1_init_irq,
141 .handle_irq = imx1_handle_irq,
142 .init_time = mx1ads_timer_init, 141 .init_time = mx1ads_timer_init,
143 .init_machine = mx1ads_init, 142 .init_machine = mx1ads_init,
144 .restart = mxc_restart, 143 .restart = mxc_restart,
@@ -149,7 +148,6 @@ MACHINE_START(MXLADS, "Freescale MXLADS")
149 .map_io = mx1_map_io, 148 .map_io = mx1_map_io,
150 .init_early = imx1_init_early, 149 .init_early = imx1_init_early,
151 .init_irq = mx1_init_irq, 150 .init_irq = mx1_init_irq,
152 .handle_irq = imx1_handle_irq,
153 .init_time = mx1ads_timer_init, 151 .init_time = mx1ads_timer_init,
154 .init_machine = mx1ads_init, 152 .init_machine = mx1ads_init,
155 .restart = mxc_restart, 153 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index a06aa4dc37fc..703ce31d7379 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -17,51 +17,46 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/basic_mmio_gpio.h>
20#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/regulator/fixed.h>
23#include <linux/regulator/machine.h>
21#include <asm/mach-types.h> 24#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
23#include <asm/mach/time.h>
24#include <asm/mach/map.h>
25 26
26#include "common.h" 27#include "common.h"
27#include "devices-imx21.h" 28#include "devices-imx21.h"
28#include "hardware.h" 29#include "hardware.h"
29#include "iomux-mx21.h" 30#include "iomux-mx21.h"
30 31
31/* 32#define MX21ADS_CS8900A_REG (MX21_CS1_BASE_ADDR + 0x000000)
32 * Memory-mapped I/O on MX21ADS base board 33#define MX21ADS_ST16C255_IOBASE_REG (MX21_CS1_BASE_ADDR + 0x200000)
33 */ 34#define MX21ADS_VERSION_REG (MX21_CS1_BASE_ADDR + 0x400000)
34#define MX21ADS_MMIO_BASE_ADDR 0xf5000000 35#define MX21ADS_IO_REG (MX21_CS1_BASE_ADDR + 0x800000)
35#define MX21ADS_MMIO_SIZE 0xc00000
36
37#define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \
38 (MX21ADS_MMIO_BASE_ADDR + (offset))
39 36
40#define MX21ADS_CS8900A_MMIO_SIZE 0x200000 37#define MX21ADS_MMC_CD IMX_GPIO_NR(4, 25)
41#define MX21ADS_CS8900A_IRQ_GPIO IMX_GPIO_NR(5, 11) 38#define MX21ADS_CS8900A_IRQ_GPIO IMX_GPIO_NR(5, 11)
42#define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) 39#define MX21ADS_MMGPIO_BASE (6 * 32)
43#define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000)
44#define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000)
45 40
46/* MX21ADS_IO_REG bit definitions */ 41/* MX21ADS_IO_REG bit definitions */
47#define MX21ADS_IO_SD_WP 0x0001 /* read */ 42#define MX21ADS_IO_SD_WP (MX21ADS_MMGPIO_BASE + 0)
48#define MX21ADS_IO_TP6 0x0001 /* write */ 43#define MX21ADS_IO_TP6 (MX21ADS_IO_SD_WP)
49#define MX21ADS_IO_SW_SEL 0x0002 /* read */ 44#define MX21ADS_IO_SW_SEL (MX21ADS_MMGPIO_BASE + 1)
50#define MX21ADS_IO_TP7 0x0002 /* write */ 45#define MX21ADS_IO_TP7 (MX21ADS_IO_SW_SEL)
51#define MX21ADS_IO_RESET_E_UART 0x0004 46#define MX21ADS_IO_RESET_E_UART (MX21ADS_MMGPIO_BASE + 2)
52#define MX21ADS_IO_RESET_BASE 0x0008 47#define MX21ADS_IO_RESET_BASE (MX21ADS_MMGPIO_BASE + 3)
53#define MX21ADS_IO_CSI_CTL2 0x0010 48#define MX21ADS_IO_CSI_CTL2 (MX21ADS_MMGPIO_BASE + 4)
54#define MX21ADS_IO_CSI_CTL1 0x0020 49#define MX21ADS_IO_CSI_CTL1 (MX21ADS_MMGPIO_BASE + 5)
55#define MX21ADS_IO_CSI_CTL0 0x0040 50#define MX21ADS_IO_CSI_CTL0 (MX21ADS_MMGPIO_BASE + 6)
56#define MX21ADS_IO_UART1_EN 0x0080 51#define MX21ADS_IO_UART1_EN (MX21ADS_MMGPIO_BASE + 7)
57#define MX21ADS_IO_UART4_EN 0x0100 52#define MX21ADS_IO_UART4_EN (MX21ADS_MMGPIO_BASE + 8)
58#define MX21ADS_IO_LCDON 0x0200 53#define MX21ADS_IO_LCDON (MX21ADS_MMGPIO_BASE + 9)
59#define MX21ADS_IO_IRDA_EN 0x0400 54#define MX21ADS_IO_IRDA_EN (MX21ADS_MMGPIO_BASE + 10)
60#define MX21ADS_IO_IRDA_FIR_SEL 0x0800 55#define MX21ADS_IO_IRDA_FIR_SEL (MX21ADS_MMGPIO_BASE + 11)
61#define MX21ADS_IO_IRDA_MD0_B 0x1000 56#define MX21ADS_IO_IRDA_MD0_B (MX21ADS_MMGPIO_BASE + 12)
62#define MX21ADS_IO_IRDA_MD1 0x2000 57#define MX21ADS_IO_IRDA_MD1 (MX21ADS_MMGPIO_BASE + 13)
63#define MX21ADS_IO_LED4_ON 0x4000 58#define MX21ADS_IO_LED4_ON (MX21ADS_MMGPIO_BASE + 14)
64#define MX21ADS_IO_LED3_ON 0x8000 59#define MX21ADS_IO_LED3_ON (MX21ADS_MMGPIO_BASE + 15)
65 60
66static const int mx21ads_pins[] __initconst = { 61static const int mx21ads_pins[] __initconst = {
67 62
@@ -143,11 +138,8 @@ static struct physmap_flash_data mx21ads_flash_data = {
143 .width = 4, 138 .width = 4,
144}; 139};
145 140
146static struct resource mx21ads_flash_resource = { 141static struct resource mx21ads_flash_resource =
147 .start = MX21_CS0_BASE_ADDR, 142 DEFINE_RES_MEM(MX21_CS0_BASE_ADDR, SZ_32M);
148 .end = MX21_CS0_BASE_ADDR + 0x02000000 - 1,
149 .flags = IORESOURCE_MEM,
150};
151 143
152static struct platform_device mx21ads_nor_mtd_device = { 144static struct platform_device mx21ads_nor_mtd_device = {
153 .name = "physmap-flash", 145 .name = "physmap-flash",
@@ -160,7 +152,7 @@ static struct platform_device mx21ads_nor_mtd_device = {
160}; 152};
161 153
162static struct resource mx21ads_cs8900_resources[] __initdata = { 154static struct resource mx21ads_cs8900_resources[] __initdata = {
163 DEFINE_RES_MEM(MX21_CS1_BASE_ADDR, MX21ADS_CS8900A_MMIO_SIZE), 155 DEFINE_RES_MEM(MX21ADS_CS8900A_REG, SZ_1K),
164 /* irq number is run-time assigned */ 156 /* irq number is run-time assigned */
165 DEFINE_RES_IRQ(-1), 157 DEFINE_RES_IRQ(-1),
166}; 158};
@@ -179,24 +171,50 @@ static const struct imxuart_platform_data uart_pdata_rts __initconst = {
179static const struct imxuart_platform_data uart_pdata_norts __initconst = { 171static const struct imxuart_platform_data uart_pdata_norts __initconst = {
180}; 172};
181 173
182static int mx21ads_fb_init(struct platform_device *pdev) 174static struct resource mx21ads_mmgpio_resource =
183{ 175 DEFINE_RES_MEM_NAMED(MX21ADS_IO_REG, SZ_2, "dat");
184 u16 tmp;
185 176
186 tmp = __raw_readw(MX21ADS_IO_REG); 177static struct bgpio_pdata mx21ads_mmgpio_pdata = {
187 tmp |= MX21ADS_IO_LCDON; 178 .base = MX21ADS_MMGPIO_BASE,
188 __raw_writew(tmp, MX21ADS_IO_REG); 179 .ngpio = 16,
189 return 0; 180};
190}
191 181
192static void mx21ads_fb_exit(struct platform_device *pdev) 182static struct platform_device mx21ads_mmgpio = {
193{ 183 .name = "basic-mmio-gpio",
194 u16 tmp; 184 .id = PLATFORM_DEVID_AUTO,
185 .resource = &mx21ads_mmgpio_resource,
186 .num_resources = 1,
187 .dev = {
188 .platform_data = &mx21ads_mmgpio_pdata,
189 },
190};
195 191
196 tmp = __raw_readw(MX21ADS_IO_REG); 192static struct regulator_consumer_supply mx21ads_lcd_regulator_consumer =
197 tmp &= ~MX21ADS_IO_LCDON; 193 REGULATOR_SUPPLY("lcd", "imx-fb.0");
198 __raw_writew(tmp, MX21ADS_IO_REG); 194
199} 195static struct regulator_init_data mx21ads_lcd_regulator_init_data = {
196 .constraints = {
197 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
198 },
199 .consumer_supplies = &mx21ads_lcd_regulator_consumer,
200 .num_consumer_supplies = 1,
201};
202
203static struct fixed_voltage_config mx21ads_lcd_regulator_pdata = {
204 .supply_name = "LCD",
205 .microvolts = 3300000,
206 .gpio = MX21ADS_IO_LCDON,
207 .enable_high = 1,
208 .init_data = &mx21ads_lcd_regulator_init_data,
209};
210
211static struct platform_device mx21ads_lcd_regulator = {
212 .name = "reg-fixed-voltage",
213 .id = PLATFORM_DEVID_AUTO,
214 .dev = {
215 .platform_data = &mx21ads_lcd_regulator_pdata,
216 },
217};
200 218
201/* 219/*
202 * Connected is a portrait Sharp-QVGA display 220 * Connected is a portrait Sharp-QVGA display
@@ -229,26 +247,30 @@ static const struct imx_fb_platform_data mx21ads_fb_data __initconst = {
229 .pwmr = 0x00a903ff, 247 .pwmr = 0x00a903ff,
230 .lscr1 = 0x00120300, 248 .lscr1 = 0x00120300,
231 .dmacr = 0x00020008, 249 .dmacr = 0x00020008,
232
233 .init = mx21ads_fb_init,
234 .exit = mx21ads_fb_exit,
235}; 250};
236 251
237static int mx21ads_sdhc_get_ro(struct device *dev) 252static int mx21ads_sdhc_get_ro(struct device *dev)
238{ 253{
239 return (__raw_readw(MX21ADS_IO_REG) & MX21ADS_IO_SD_WP) ? 1 : 0; 254 return gpio_get_value(MX21ADS_IO_SD_WP);
240} 255}
241 256
242static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq, 257static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq,
243 void *data) 258 void *data)
244{ 259{
245 return request_irq(gpio_to_irq(IMX_GPIO_NR(4, 25)), detect_irq, 260 int ret;
246 IRQF_TRIGGER_FALLING, "mmc-detect", data); 261
262 ret = gpio_request(MX21ADS_IO_SD_WP, "mmc-ro");
263 if (ret)
264 return ret;
265
266 return request_irq(gpio_to_irq(MX21ADS_MMC_CD), detect_irq,
267 IRQF_TRIGGER_FALLING, "mmc-detect", data);
247} 268}
248 269
249static void mx21ads_sdhc_exit(struct device *dev, void *data) 270static void mx21ads_sdhc_exit(struct device *dev, void *data)
250{ 271{
251 free_irq(gpio_to_irq(IMX_GPIO_NR(4, 25)), data); 272 free_irq(gpio_to_irq(MX21ADS_MMC_CD), data);
273 gpio_free(MX21ADS_IO_SD_WP);
252} 274}
253 275
254static const struct imxmmc_platform_data mx21ads_sdhc_pdata __initconst = { 276static const struct imxmmc_platform_data mx21ads_sdhc_pdata __initconst = {
@@ -264,29 +286,9 @@ mx21ads_nand_board_info __initconst = {
264 .hw_ecc = 1, 286 .hw_ecc = 1,
265}; 287};
266 288
267static struct map_desc mx21ads_io_desc[] __initdata = {
268 /*
269 * Memory-mapped I/O on MX21ADS Base board:
270 * - CS8900A Ethernet controller
271 * - ST16C2552CJ UART
272 * - CPU and Base board version
273 * - Base board I/O register
274 */
275 {
276 .virtual = MX21ADS_MMIO_BASE_ADDR,
277 .pfn = __phys_to_pfn(MX21_CS1_BASE_ADDR),
278 .length = MX21ADS_MMIO_SIZE,
279 .type = MT_DEVICE,
280 },
281};
282
283static void __init mx21ads_map_io(void)
284{
285 mx21_map_io();
286 iotable_init(mx21ads_io_desc, ARRAY_SIZE(mx21ads_io_desc));
287}
288
289static struct platform_device *platform_devices[] __initdata = { 289static struct platform_device *platform_devices[] __initdata = {
290 &mx21ads_mmgpio,
291 &mx21ads_lcd_regulator,
290 &mx21ads_nor_mtd_device, 292 &mx21ads_nor_mtd_device,
291}; 293};
292 294
@@ -300,12 +302,13 @@ static void __init mx21ads_board_init(void)
300 imx21_add_imx_uart0(&uart_pdata_rts); 302 imx21_add_imx_uart0(&uart_pdata_rts);
301 imx21_add_imx_uart2(&uart_pdata_norts); 303 imx21_add_imx_uart2(&uart_pdata_norts);
302 imx21_add_imx_uart3(&uart_pdata_rts); 304 imx21_add_imx_uart3(&uart_pdata_rts);
303 imx21_add_imx_fb(&mx21ads_fb_data);
304 imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata); 305 imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata);
305 imx21_add_mxc_nand(&mx21ads_nand_board_info); 306 imx21_add_mxc_nand(&mx21ads_nand_board_info);
306 307
307 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 308 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
308 309
310 imx21_add_imx_fb(&mx21ads_fb_data);
311
309 mx21ads_cs8900_resources[1].start = 312 mx21ads_cs8900_resources[1].start =
310 gpio_to_irq(MX21ADS_CS8900A_IRQ_GPIO); 313 gpio_to_irq(MX21ADS_CS8900A_IRQ_GPIO);
311 mx21ads_cs8900_resources[1].end = 314 mx21ads_cs8900_resources[1].end =
@@ -321,10 +324,9 @@ static void __init mx21ads_timer_init(void)
321MACHINE_START(MX21ADS, "Freescale i.MX21ADS") 324MACHINE_START(MX21ADS, "Freescale i.MX21ADS")
322 /* maintainer: Freescale Semiconductor, Inc. */ 325 /* maintainer: Freescale Semiconductor, Inc. */
323 .atag_offset = 0x100, 326 .atag_offset = 0x100,
324 .map_io = mx21ads_map_io, 327 .map_io = mx21_map_io,
325 .init_early = imx21_init_early, 328 .init_early = imx21_init_early,
326 .init_irq = mx21_init_irq, 329 .init_irq = mx21_init_irq,
327 .handle_irq = imx21_handle_irq,
328 .init_time = mx21ads_timer_init, 330 .init_time = mx21ads_timer_init,
329 .init_machine = mx21ads_board_init, 331 .init_machine = mx21ads_board_init,
330 .restart = mxc_restart, 332 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
index 13490c203050..ea1fa199c148 100644
--- a/arch/arm/mach-imx/mach-mx25_3ds.c
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c
@@ -263,7 +263,6 @@ MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
263 .map_io = mx25_map_io, 263 .map_io = mx25_map_io,
264 .init_early = imx25_init_early, 264 .init_early = imx25_init_early,
265 .init_irq = mx25_init_irq, 265 .init_irq = mx25_init_irq,
266 .handle_irq = imx25_handle_irq,
267 .init_time = mx25pdk_timer_init, 266 .init_time = mx25pdk_timer_init,
268 .init_machine = mx25pdk_init, 267 .init_machine = mx25pdk_init,
269 .restart = mxc_restart, 268 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 25b3e4c9bc0a..435a5428a678 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -544,7 +544,6 @@ MACHINE_START(MX27_3DS, "Freescale MX27PDK")
544 .map_io = mx27_map_io, 544 .map_io = mx27_map_io,
545 .init_early = imx27_init_early, 545 .init_early = imx27_init_early,
546 .init_irq = mx27_init_irq, 546 .init_irq = mx27_init_irq,
547 .handle_irq = imx27_handle_irq,
548 .init_time = mx27pdk_timer_init, 547 .init_time = mx27pdk_timer_init,
549 .init_machine = mx27pdk_init, 548 .init_machine = mx27pdk_init,
550 .restart = mxc_restart, 549 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index a7a4a9c67615..2f834ce8f39c 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -391,7 +391,6 @@ MACHINE_START(MX27ADS, "Freescale i.MX27ADS")
391 .map_io = mx27ads_map_io, 391 .map_io = mx27ads_map_io,
392 .init_early = imx27_init_early, 392 .init_early = imx27_init_early,
393 .init_irq = mx27_init_irq, 393 .init_irq = mx27_init_irq,
394 .handle_irq = imx27_handle_irq,
395 .init_time = mx27ads_timer_init, 394 .init_time = mx27ads_timer_init,
396 .init_machine = mx27ads_board_init, 395 .init_machine = mx27ads_board_init,
397 .restart = mxc_restart, 396 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 50044a21b388..4217871a9653 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -775,7 +775,6 @@ MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)")
775 .map_io = mx31_map_io, 775 .map_io = mx31_map_io,
776 .init_early = imx31_init_early, 776 .init_early = imx31_init_early,
777 .init_irq = mx31_init_irq, 777 .init_irq = mx31_init_irq,
778 .handle_irq = imx31_handle_irq,
779 .init_time = mx31_3ds_timer_init, 778 .init_time = mx31_3ds_timer_init,
780 .init_machine = mx31_3ds_init, 779 .init_machine = mx31_3ds_init,
781 .reserve = mx31_3ds_reserve, 780 .reserve = mx31_3ds_reserve,
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c
index daf8889125cc..d08c37c696f6 100644
--- a/arch/arm/mach-imx/mach-mx31ads.c
+++ b/arch/arm/mach-imx/mach-mx31ads.c
@@ -582,7 +582,6 @@ MACHINE_START(MX31ADS, "Freescale MX31ADS")
582 .map_io = mx31ads_map_io, 582 .map_io = mx31ads_map_io,
583 .init_early = imx31_init_early, 583 .init_early = imx31_init_early,
584 .init_irq = mx31ads_init_irq, 584 .init_irq = mx31ads_init_irq,
585 .handle_irq = imx31_handle_irq,
586 .init_time = mx31ads_timer_init, 585 .init_time = mx31ads_timer_init,
587 .init_machine = mx31ads_init, 586 .init_machine = mx31ads_init,
588 .restart = mxc_restart, 587 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c
index 832b1e2f964e..eee042fa2768 100644
--- a/arch/arm/mach-imx/mach-mx31lilly.c
+++ b/arch/arm/mach-imx/mach-mx31lilly.c
@@ -308,7 +308,6 @@ MACHINE_START(LILLY1131, "INCO startec LILLY-1131")
308 .map_io = mx31_map_io, 308 .map_io = mx31_map_io,
309 .init_early = imx31_init_early, 309 .init_early = imx31_init_early,
310 .init_irq = mx31_init_irq, 310 .init_irq = mx31_init_irq,
311 .handle_irq = imx31_handle_irq,
312 .init_time = mx31lilly_timer_init, 311 .init_time = mx31lilly_timer_init,
313 .init_machine = mx31lilly_board_init, 312 .init_machine = mx31lilly_board_init,
314 .restart = mxc_restart, 313 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index bea07299b61a..fa15d0b6118d 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -291,7 +291,6 @@ MACHINE_START(MX31LITE, "LogicPD i.MX31 SOM")
291 .map_io = mx31lite_map_io, 291 .map_io = mx31lite_map_io,
292 .init_early = imx31_init_early, 292 .init_early = imx31_init_early,
293 .init_irq = mx31_init_irq, 293 .init_irq = mx31_init_irq,
294 .handle_irq = imx31_handle_irq,
295 .init_time = mx31lite_timer_init, 294 .init_time = mx31lite_timer_init,
296 .init_machine = mx31lite_init, 295 .init_machine = mx31lite_init,
297 .restart = mxc_restart, 296 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 8f45afe785f8..08730f238449 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -600,7 +600,6 @@ MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard")
600 .map_io = mx31_map_io, 600 .map_io = mx31_map_io,
601 .init_early = imx31_init_early, 601 .init_early = imx31_init_early,
602 .init_irq = mx31_init_irq, 602 .init_irq = mx31_init_irq,
603 .handle_irq = imx31_handle_irq,
604 .init_time = mx31moboard_timer_init, 603 .init_time = mx31moboard_timer_init,
605 .init_machine = mx31moboard_init, 604 .init_machine = mx31moboard_init,
606 .restart = mxc_restart, 605 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index a42f4f07051f..4e8b184d773b 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -615,7 +615,6 @@ MACHINE_START(MX35_3DS, "Freescale MX35PDK")
615 .map_io = mx35_map_io, 615 .map_io = mx35_map_io,
616 .init_early = imx35_init_early, 616 .init_early = imx35_init_early,
617 .init_irq = mx35_init_irq, 617 .init_irq = mx35_init_irq,
618 .handle_irq = imx35_handle_irq,
619 .init_time = mx35pdk_timer_init, 618 .init_time = mx35pdk_timer_init,
620 .init_machine = mx35_3ds_init, 619 .init_machine = mx35_3ds_init,
621 .reserve = mx35_3ds_reserve, 620 .reserve = mx35_3ds_reserve,
diff --git a/arch/arm/mach-imx/mach-mx51_babbage.c b/arch/arm/mach-imx/mach-mx51_babbage.c
deleted file mode 100644
index f3d264a636fa..000000000000
--- a/arch/arm/mach-imx/mach-mx51_babbage.c
+++ /dev/null
@@ -1,428 +0,0 @@
1/*
2 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/i2c.h>
16#include <linux/gpio.h>
17#include <linux/delay.h>
18#include <linux/io.h>
19#include <linux/input.h>
20#include <linux/spi/flash.h>
21#include <linux/spi/spi.h>
22
23#include <asm/setup.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/time.h>
27
28#include "common.h"
29#include "devices-imx51.h"
30#include "hardware.h"
31#include "iomux-mx51.h"
32
33#define BABBAGE_USB_HUB_RESET IMX_GPIO_NR(1, 7)
34#define BABBAGE_USBH1_STP IMX_GPIO_NR(1, 27)
35#define BABBAGE_USB_PHY_RESET IMX_GPIO_NR(2, 5)
36#define BABBAGE_FEC_PHY_RESET IMX_GPIO_NR(2, 14)
37#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21)
38#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
39#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
40#define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6)
41#define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5)
42
43/* USB_CTRL_1 */
44#define MX51_USB_CTRL_1_OFFSET 0x10
45#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
46
47#define MX51_USB_PLLDIV_12_MHZ 0x00
48#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
49#define MX51_USB_PLL_DIV_24_MHZ 0x02
50
51static struct gpio_keys_button babbage_buttons[] = {
52 {
53 .gpio = BABBAGE_POWER_KEY,
54 .code = BTN_0,
55 .desc = "PWR",
56 .active_low = 1,
57 .wakeup = 1,
58 },
59};
60
61static const struct gpio_keys_platform_data imx_button_data __initconst = {
62 .buttons = babbage_buttons,
63 .nbuttons = ARRAY_SIZE(babbage_buttons),
64};
65
66static iomux_v3_cfg_t mx51babbage_pads[] = {
67 /* UART1 */
68 MX51_PAD_UART1_RXD__UART1_RXD,
69 MX51_PAD_UART1_TXD__UART1_TXD,
70 MX51_PAD_UART1_RTS__UART1_RTS,
71 MX51_PAD_UART1_CTS__UART1_CTS,
72
73 /* UART2 */
74 MX51_PAD_UART2_RXD__UART2_RXD,
75 MX51_PAD_UART2_TXD__UART2_TXD,
76
77 /* UART3 */
78 MX51_PAD_EIM_D25__UART3_RXD,
79 MX51_PAD_EIM_D26__UART3_TXD,
80 MX51_PAD_EIM_D27__UART3_RTS,
81 MX51_PAD_EIM_D24__UART3_CTS,
82
83 /* I2C1 */
84 MX51_PAD_EIM_D16__I2C1_SDA,
85 MX51_PAD_EIM_D19__I2C1_SCL,
86
87 /* I2C2 */
88 MX51_PAD_KEY_COL4__I2C2_SCL,
89 MX51_PAD_KEY_COL5__I2C2_SDA,
90
91 /* HSI2C */
92 MX51_PAD_I2C1_CLK__I2C1_CLK,
93 MX51_PAD_I2C1_DAT__I2C1_DAT,
94
95 /* USB HOST1 */
96 MX51_PAD_USBH1_CLK__USBH1_CLK,
97 MX51_PAD_USBH1_DIR__USBH1_DIR,
98 MX51_PAD_USBH1_NXT__USBH1_NXT,
99 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
100 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
101 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
102 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
103 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
104 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
105 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
106 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
107
108 /* USB HUB reset line*/
109 MX51_PAD_GPIO1_7__GPIO1_7,
110
111 /* USB PHY reset line */
112 MX51_PAD_EIM_D21__GPIO2_5,
113
114 /* FEC */
115 MX51_PAD_EIM_EB2__FEC_MDIO,
116 MX51_PAD_EIM_EB3__FEC_RDATA1,
117 MX51_PAD_EIM_CS2__FEC_RDATA2,
118 MX51_PAD_EIM_CS3__FEC_RDATA3,
119 MX51_PAD_EIM_CS4__FEC_RX_ER,
120 MX51_PAD_EIM_CS5__FEC_CRS,
121 MX51_PAD_NANDF_RB2__FEC_COL,
122 MX51_PAD_NANDF_RB3__FEC_RX_CLK,
123 MX51_PAD_NANDF_D9__FEC_RDATA0,
124 MX51_PAD_NANDF_D8__FEC_TDATA0,
125 MX51_PAD_NANDF_CS2__FEC_TX_ER,
126 MX51_PAD_NANDF_CS3__FEC_MDC,
127 MX51_PAD_NANDF_CS4__FEC_TDATA1,
128 MX51_PAD_NANDF_CS5__FEC_TDATA2,
129 MX51_PAD_NANDF_CS6__FEC_TDATA3,
130 MX51_PAD_NANDF_CS7__FEC_TX_EN,
131 MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK,
132
133 /* FEC PHY reset line */
134 MX51_PAD_EIM_A20__GPIO2_14,
135
136 /* SD 1 */
137 MX51_PAD_SD1_CMD__SD1_CMD,
138 MX51_PAD_SD1_CLK__SD1_CLK,
139 MX51_PAD_SD1_DATA0__SD1_DATA0,
140 MX51_PAD_SD1_DATA1__SD1_DATA1,
141 MX51_PAD_SD1_DATA2__SD1_DATA2,
142 MX51_PAD_SD1_DATA3__SD1_DATA3,
143 /* CD/WP from controller */
144 MX51_PAD_GPIO1_0__SD1_CD,
145 MX51_PAD_GPIO1_1__SD1_WP,
146
147 /* SD 2 */
148 MX51_PAD_SD2_CMD__SD2_CMD,
149 MX51_PAD_SD2_CLK__SD2_CLK,
150 MX51_PAD_SD2_DATA0__SD2_DATA0,
151 MX51_PAD_SD2_DATA1__SD2_DATA1,
152 MX51_PAD_SD2_DATA2__SD2_DATA2,
153 MX51_PAD_SD2_DATA3__SD2_DATA3,
154 /* CD/WP gpio */
155 MX51_PAD_GPIO1_6__GPIO1_6,
156 MX51_PAD_GPIO1_5__GPIO1_5,
157
158 /* eCSPI1 */
159 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
160 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
161 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
162 MX51_PAD_CSPI1_SS0__GPIO4_24,
163 MX51_PAD_CSPI1_SS1__GPIO4_25,
164
165 /* Audio */
166 MX51_PAD_AUD3_BB_TXD__AUD3_TXD,
167 MX51_PAD_AUD3_BB_RXD__AUD3_RXD,
168 MX51_PAD_AUD3_BB_CK__AUD3_TXC,
169 MX51_PAD_AUD3_BB_FS__AUD3_TXFS,
170};
171
172/* Serial ports */
173static const struct imxuart_platform_data uart_pdata __initconst = {
174 .flags = IMXUART_HAVE_RTSCTS,
175};
176
177static const struct imxi2c_platform_data babbage_i2c_data __initconst = {
178 .bitrate = 100000,
179};
180
181static const struct imxi2c_platform_data babbage_hsi2c_data __initconst = {
182 .bitrate = 400000,
183};
184
185static struct gpio mx51_babbage_usbh1_gpios[] = {
186 { BABBAGE_USBH1_STP, GPIOF_OUT_INIT_LOW, "usbh1_stp" },
187 { BABBAGE_USB_PHY_RESET, GPIOF_OUT_INIT_LOW, "usbh1_phy_reset" },
188};
189
190static int gpio_usbh1_active(void)
191{
192 iomux_v3_cfg_t usbh1stp_gpio = MX51_PAD_USBH1_STP__GPIO1_27;
193 int ret;
194
195 /* Set USBH1_STP to GPIO and toggle it */
196 mxc_iomux_v3_setup_pad(usbh1stp_gpio);
197 ret = gpio_request_array(mx51_babbage_usbh1_gpios,
198 ARRAY_SIZE(mx51_babbage_usbh1_gpios));
199
200 if (ret) {
201 pr_debug("failed to get USBH1 pins: %d\n", ret);
202 return ret;
203 }
204
205 msleep(100);
206 gpio_set_value(BABBAGE_USBH1_STP, 1);
207 gpio_set_value(BABBAGE_USB_PHY_RESET, 1);
208 gpio_free_array(mx51_babbage_usbh1_gpios,
209 ARRAY_SIZE(mx51_babbage_usbh1_gpios));
210 return 0;
211}
212
213static inline void babbage_usbhub_reset(void)
214{
215 int ret;
216
217 /* Reset USB hub */
218 ret = gpio_request_one(BABBAGE_USB_HUB_RESET,
219 GPIOF_OUT_INIT_LOW, "GPIO1_7");
220 if (ret) {
221 printk(KERN_ERR"failed to get GPIO_USB_HUB_RESET: %d\n", ret);
222 return;
223 }
224
225 msleep(2);
226 /* Deassert reset */
227 gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
228}
229
230static inline void babbage_fec_reset(void)
231{
232 int ret;
233
234 /* reset FEC PHY */
235 ret = gpio_request_one(BABBAGE_FEC_PHY_RESET,
236 GPIOF_OUT_INIT_LOW, "fec-phy-reset");
237 if (ret) {
238 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
239 return;
240 }
241 msleep(1);
242 gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
243}
244
245/* This function is board specific as the bit mask for the plldiv will also
246be different for other Freescale SoCs, thus a common bitmask is not
247possible and cannot get place in /plat-mxc/ehci.c.*/
248static int initialize_otg_port(struct platform_device *pdev)
249{
250 u32 v;
251 void __iomem *usb_base;
252 void __iomem *usbother_base;
253
254 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
255 if (!usb_base)
256 return -ENOMEM;
257 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
258
259 /* Set the PHY clock to 19.2MHz */
260 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
261 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
262 v |= MX51_USB_PLL_DIV_19_2_MHZ;
263 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
264 iounmap(usb_base);
265
266 mdelay(10);
267
268 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
269}
270
271static int initialize_usbh1_port(struct platform_device *pdev)
272{
273 u32 v;
274 void __iomem *usb_base;
275 void __iomem *usbother_base;
276
277 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
278 if (!usb_base)
279 return -ENOMEM;
280 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
281
282 /* The clock for the USBH1 ULPI port will come externally from the PHY. */
283 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
284 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET);
285 iounmap(usb_base);
286
287 mdelay(10);
288
289 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
290 MXC_EHCI_ITC_NO_THRESHOLD);
291}
292
293static const struct mxc_usbh_platform_data dr_utmi_config __initconst = {
294 .init = initialize_otg_port,
295 .portsc = MXC_EHCI_UTMI_16BIT,
296};
297
298static const struct fsl_usb2_platform_data usb_pdata __initconst = {
299 .operating_mode = FSL_USB2_DR_DEVICE,
300 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
301};
302
303static const struct mxc_usbh_platform_data usbh1_config __initconst = {
304 .init = initialize_usbh1_port,
305 .portsc = MXC_EHCI_MODE_ULPI,
306};
307
308static bool otg_mode_host __initdata;
309
310static int __init babbage_otg_mode(char *options)
311{
312 if (!strcmp(options, "host"))
313 otg_mode_host = true;
314 else if (!strcmp(options, "device"))
315 otg_mode_host = false;
316 else
317 pr_info("otg_mode neither \"host\" nor \"device\". "
318 "Defaulting to device\n");
319 return 1;
320}
321__setup("otg_mode=", babbage_otg_mode);
322
323static struct spi_board_info mx51_babbage_spi_board_info[] __initdata = {
324 {
325 .modalias = "mtd_dataflash",
326 .max_speed_hz = 25000000,
327 .bus_num = 0,
328 .chip_select = 1,
329 .mode = SPI_MODE_0,
330 .platform_data = NULL,
331 },
332};
333
334static int mx51_babbage_spi_cs[] = {
335 BABBAGE_ECSPI1_CS0,
336 BABBAGE_ECSPI1_CS1,
337};
338
339static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {
340 .chipselect = mx51_babbage_spi_cs,
341 .num_chipselect = ARRAY_SIZE(mx51_babbage_spi_cs),
342};
343
344static const struct esdhc_platform_data mx51_babbage_sd1_data __initconst = {
345 .cd_type = ESDHC_CD_CONTROLLER,
346 .wp_type = ESDHC_WP_CONTROLLER,
347};
348
349static const struct esdhc_platform_data mx51_babbage_sd2_data __initconst = {
350 .cd_gpio = BABBAGE_SD2_CD,
351 .wp_gpio = BABBAGE_SD2_WP,
352 .cd_type = ESDHC_CD_GPIO,
353 .wp_type = ESDHC_WP_GPIO,
354};
355
356void __init imx51_babbage_common_init(void)
357{
358 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads,
359 ARRAY_SIZE(mx51babbage_pads));
360}
361
362/*
363 * Board specific initialization.
364 */
365static void __init mx51_babbage_init(void)
366{
367 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
368 iomux_v3_cfg_t power_key = NEW_PAD_CTRL(MX51_PAD_EIM_A27__GPIO2_21,
369 PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH);
370
371 imx51_soc_init();
372
373 imx51_babbage_common_init();
374
375 imx51_add_imx_uart(0, &uart_pdata);
376 imx51_add_imx_uart(1, NULL);
377 imx51_add_imx_uart(2, &uart_pdata);
378
379 babbage_fec_reset();
380 imx51_add_fec(NULL);
381
382 /* Set the PAD settings for the pwr key. */
383 mxc_iomux_v3_setup_pad(power_key);
384 imx_add_gpio_keys(&imx_button_data);
385
386 imx51_add_imx_i2c(0, &babbage_i2c_data);
387 imx51_add_imx_i2c(1, &babbage_i2c_data);
388 imx51_add_hsi2c(&babbage_hsi2c_data);
389
390 if (otg_mode_host)
391 imx51_add_mxc_ehci_otg(&dr_utmi_config);
392 else {
393 initialize_otg_port(NULL);
394 imx51_add_fsl_usb2_udc(&usb_pdata);
395 }
396
397 gpio_usbh1_active();
398 imx51_add_mxc_ehci_hs(1, &usbh1_config);
399 /* setback USBH1_STP to be function */
400 mxc_iomux_v3_setup_pad(usbh1stp);
401 babbage_usbhub_reset();
402
403 imx51_add_sdhci_esdhc_imx(0, &mx51_babbage_sd1_data);
404 imx51_add_sdhci_esdhc_imx(1, &mx51_babbage_sd2_data);
405
406 spi_register_board_info(mx51_babbage_spi_board_info,
407 ARRAY_SIZE(mx51_babbage_spi_board_info));
408 imx51_add_ecspi(0, &mx51_babbage_spi_pdata);
409 imx51_add_imx2_wdt(0);
410}
411
412static void __init mx51_babbage_timer_init(void)
413{
414 mx51_clocks_init(32768, 24000000, 22579200, 0);
415}
416
417MACHINE_START(MX51_BABBAGE, "Freescale MX51 Babbage Board")
418 /* Maintainer: Amit Kucheria <amit.kucheria@canonical.com> */
419 .atag_offset = 0x100,
420 .map_io = mx51_map_io,
421 .init_early = imx51_init_early,
422 .init_irq = mx51_init_irq,
423 .handle_irq = imx51_handle_irq,
424 .init_time = mx51_babbage_timer_init,
425 .init_machine = mx51_babbage_init,
426 .init_late = imx51_init_late,
427 .restart = mxc_restart,
428MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
index c91894003da9..0b5d1ca31b9f 100644
--- a/arch/arm/mach-imx/mach-mxt_td60.c
+++ b/arch/arm/mach-imx/mach-mxt_td60.c
@@ -267,7 +267,6 @@ MACHINE_START(MXT_TD60, "Maxtrack i-MXT TD60")
267 .map_io = mx27_map_io, 267 .map_io = mx27_map_io,
268 .init_early = imx27_init_early, 268 .init_early = imx27_init_early,
269 .init_irq = mx27_init_irq, 269 .init_irq = mx27_init_irq,
270 .handle_irq = imx27_handle_irq,
271 .init_time = mxt_td60_timer_init, 270 .init_time = mxt_td60_timer_init,
272 .init_machine = mxt_td60_board_init, 271 .init_machine = mxt_td60_board_init,
273 .restart = mxc_restart, 272 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index bf3ac51d5aca..12212378c672 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -245,8 +245,7 @@ static int pca100_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
245 int ret; 245 int ret;
246 246
247 ret = request_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), detect_irq, 247 ret = request_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), detect_irq,
248 IRQF_DISABLED | IRQF_TRIGGER_FALLING, 248 IRQF_TRIGGER_FALLING, "imx-mmc-detect", data);
249 "imx-mmc-detect", data);
250 if (ret) 249 if (ret)
251 printk(KERN_ERR 250 printk(KERN_ERR
252 "pca100: Failed to request irq for sd/mmc detection\n"); 251 "pca100: Failed to request irq for sd/mmc detection\n");
@@ -421,7 +420,6 @@ MACHINE_START(PCA100, "phyCARD-i.MX27")
421 .map_io = mx27_map_io, 420 .map_io = mx27_map_io,
422 .init_early = imx27_init_early, 421 .init_early = imx27_init_early,
423 .init_irq = mx27_init_irq, 422 .init_irq = mx27_init_irq,
424 .handle_irq = imx27_handle_irq,
425 .init_machine = pca100_init, 423 .init_machine = pca100_init,
426 .init_time = pca100_timer_init, 424 .init_time = pca100_timer_init,
427 .restart = mxc_restart, 425 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
index 639a3dfb0092..81b8affb9448 100644
--- a/arch/arm/mach-imx/mach-pcm037.c
+++ b/arch/arm/mach-imx/mach-pcm037.c
@@ -703,7 +703,6 @@ MACHINE_START(PCM037, "Phytec Phycore pcm037")
703 .map_io = mx31_map_io, 703 .map_io = mx31_map_io,
704 .init_early = imx31_init_early, 704 .init_early = imx31_init_early,
705 .init_irq = mx31_init_irq, 705 .init_irq = mx31_init_irq,
706 .handle_irq = imx31_handle_irq,
707 .init_time = pcm037_timer_init, 706 .init_time = pcm037_timer_init,
708 .init_machine = pcm037_init, 707 .init_machine = pcm037_init,
709 .init_late = pcm037_init_late, 708 .init_late = pcm037_init_late,
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 592ddbe031ac..6c56fb5553c7 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -351,7 +351,6 @@ MACHINE_START(PCM038, "phyCORE-i.MX27")
351 .map_io = mx27_map_io, 351 .map_io = mx27_map_io,
352 .init_early = imx27_init_early, 352 .init_early = imx27_init_early,
353 .init_irq = mx27_init_irq, 353 .init_irq = mx27_init_irq,
354 .handle_irq = imx27_handle_irq,
355 .init_time = pcm038_timer_init, 354 .init_time = pcm038_timer_init,
356 .init_machine = pcm038_init, 355 .init_machine = pcm038_init,
357 .restart = mxc_restart, 356 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index ac504b67326b..c62b5d261345 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -400,7 +400,6 @@ MACHINE_START(PCM043, "Phytec Phycore pcm043")
400 .map_io = mx35_map_io, 400 .map_io = mx35_map_io,
401 .init_early = imx35_init_early, 401 .init_early = imx35_init_early,
402 .init_irq = mx35_init_irq, 402 .init_irq = mx35_init_irq,
403 .handle_irq = imx35_handle_irq,
404 .init_time = pcm043_timer_init, 403 .init_time = pcm043_timer_init,
405 .init_machine = pcm043_init, 404 .init_machine = pcm043_init,
406 .restart = mxc_restart, 405 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-qong.c b/arch/arm/mach-imx/mach-qong.c
index 22af27ed457e..a213e7b9cb1c 100644
--- a/arch/arm/mach-imx/mach-qong.c
+++ b/arch/arm/mach-imx/mach-qong.c
@@ -266,7 +266,6 @@ MACHINE_START(QONG, "Dave/DENX QongEVB-LITE")
266 .map_io = mx31_map_io, 266 .map_io = mx31_map_io,
267 .init_early = imx31_init_early, 267 .init_early = imx31_init_early,
268 .init_irq = mx31_init_irq, 268 .init_irq = mx31_init_irq,
269 .handle_irq = imx31_handle_irq,
270 .init_time = qong_timer_init, 269 .init_time = qong_timer_init,
271 .init_machine = qong_init, 270 .init_machine = qong_init,
272 .restart = mxc_restart, 271 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-scb9328.c b/arch/arm/mach-imx/mach-scb9328.c
index b0fa10dd79fe..1f6bc3f7ae14 100644
--- a/arch/arm/mach-imx/mach-scb9328.c
+++ b/arch/arm/mach-imx/mach-scb9328.c
@@ -137,7 +137,6 @@ MACHINE_START(SCB9328, "Synertronixx scb9328")
137 .map_io = mx1_map_io, 137 .map_io = mx1_map_io,
138 .init_early = imx1_init_early, 138 .init_early = imx1_init_early,
139 .init_irq = mx1_init_irq, 139 .init_irq = mx1_init_irq,
140 .handle_irq = imx1_handle_irq,
141 .init_time = scb9328_timer_init, 140 .init_time = scb9328_timer_init,
142 .init_machine = scb9328_init, 141 .init_machine = scb9328_init,
143 .restart = mxc_restart, 142 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c
index 8825d1217d18..872b3c6ba408 100644
--- a/arch/arm/mach-imx/mach-vpr200.c
+++ b/arch/arm/mach-imx/mach-vpr200.c
@@ -310,7 +310,6 @@ MACHINE_START(VPR200, "VPR200")
310 .map_io = mx35_map_io, 310 .map_io = mx35_map_io,
311 .init_early = imx35_init_early, 311 .init_early = imx35_init_early,
312 .init_irq = mx35_init_irq, 312 .init_irq = mx35_init_irq,
313 .handle_irq = imx35_handle_irq,
314 .init_time = vpr200_timer_init, 313 .init_time = vpr200_timer_init,
315 .init_machine = vpr200_board_init, 314 .init_machine = vpr200_board_init,
316 .restart = mxc_restart, 315 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mxc.h b/arch/arm/mach-imx/mxc.h
index b08ab3ad4a6d..75d6a37e1ae4 100644
--- a/arch/arm/mach-imx/mxc.h
+++ b/arch/arm/mach-imx/mxc.h
@@ -36,6 +36,7 @@
36#define MXC_CPU_MX53 53 36#define MXC_CPU_MX53 53
37#define MXC_CPU_IMX6SL 0x60 37#define MXC_CPU_IMX6SL 0x60
38#define MXC_CPU_IMX6DL 0x61 38#define MXC_CPU_IMX6DL 0x61
39#define MXC_CPU_IMX6SX 0x62
39#define MXC_CPU_IMX6Q 0x63 40#define MXC_CPU_IMX6Q 0x63
40 41
41#define IMX_CHIP_REVISION_1_0 0x10 42#define IMX_CHIP_REVISION_1_0 0x10
@@ -163,6 +164,11 @@ static inline bool cpu_is_imx6dl(void)
163 return __mxc_cpu_type == MXC_CPU_IMX6DL; 164 return __mxc_cpu_type == MXC_CPU_IMX6DL;
164} 165}
165 166
167static inline bool cpu_is_imx6sx(void)
168{
169 return __mxc_cpu_type == MXC_CPU_IMX6SX;
170}
171
166static inline bool cpu_is_imx6q(void) 172static inline bool cpu_is_imx6q(void)
167{ 173{
168 return __mxc_cpu_type == MXC_CPU_IMX6Q; 174 return __mxc_cpu_type == MXC_CPU_IMX6Q;
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index 65222ea0df6d..bed081e58262 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -28,6 +28,9 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/sched_clock.h> 30#include <linux/sched_clock.h>
31#include <linux/of.h>
32#include <linux/of_address.h>
33#include <linux/of_irq.h>
31 34
32#include <asm/mach/time.h> 35#include <asm/mach/time.h>
33 36
@@ -328,3 +331,15 @@ void __init mxc_timer_init(void __iomem *base, int irq)
328 /* Make irqs happen */ 331 /* Make irqs happen */
329 setup_irq(irq, &mxc_timer_irq); 332 setup_irq(irq, &mxc_timer_irq);
330} 333}
334
335void __init mxc_timer_init_dt(struct device_node *np)
336{
337 void __iomem *base;
338 int irq;
339
340 base = of_iomap(np, 0);
341 WARN_ON(!base);
342 irq = irq_of_parse_and_map(np, 0);
343
344 mxc_timer_init(base, irq);
345}
diff --git a/arch/arm/mach-imx/tzic.c b/arch/arm/mach-imx/tzic.c
index 8183178d5aa3..7828af4b2022 100644
--- a/arch/arm/mach-imx/tzic.c
+++ b/arch/arm/mach-imx/tzic.c
@@ -125,7 +125,7 @@ static __init void tzic_init_gc(int idx, unsigned int irq_start)
125 irq_setup_generic_chip(gc, IRQ_MSK(32), 0, IRQ_NOREQUEST, 0); 125 irq_setup_generic_chip(gc, IRQ_MSK(32), 0, IRQ_NOREQUEST, 0);
126} 126}
127 127
128asmlinkage void __exception_irq_entry tzic_handle_irq(struct pt_regs *regs) 128static void __exception_irq_entry tzic_handle_irq(struct pt_regs *regs)
129{ 129{
130 u32 stat; 130 u32 stat;
131 int i, irqofs, handled; 131 int i, irqofs, handled;
@@ -189,6 +189,8 @@ void __init tzic_init_irq(void __iomem *irqbase)
189 for (i = 0; i < 4; i++, irq_base += 32) 189 for (i = 0; i < 4; i++, irq_base += 32)
190 tzic_init_gc(i, irq_base); 190 tzic_init_gc(i, irq_base);
191 191
192 set_handle_irq(tzic_handle_irq);
193
192#ifdef CONFIG_FIQ 194#ifdef CONFIG_FIQ
193 /* Initialize FIQ */ 195 /* Initialize FIQ */
194 init_FIQ(FIQ_START); 196 init_FIQ(FIQ_START);
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 2801da49e2a3..ff18ff20f71f 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -195,7 +195,7 @@ static void __init kirkwood_dt_init(void)
195{ 195{
196 kirkwood_disable_mbus_error_propagation(); 196 kirkwood_disable_mbus_error_propagation();
197 197
198 BUG_ON(mvebu_mbus_dt_init()); 198 BUG_ON(mvebu_mbus_dt_init(false));
199 199
200#ifdef CONFIG_CACHE_FEROCEON_L2 200#ifdef CONFIG_CACHE_FEROCEON_L2
201 feroceon_of_init(); 201 feroceon_of_init();
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 34932e0e31fa..7858d5b6f6ce 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -202,9 +202,6 @@ static struct mmci_platform_data lpc32xx_mmci_data = {
202 .ocr_mask = MMC_VDD_30_31 | MMC_VDD_31_32 | 202 .ocr_mask = MMC_VDD_30_31 | MMC_VDD_31_32 |
203 MMC_VDD_32_33 | MMC_VDD_33_34, 203 MMC_VDD_32_33 | MMC_VDD_33_34,
204 .ios_handler = mmc_handle_ios, 204 .ios_handler = mmc_handle_ios,
205 .dma_filter = NULL,
206 /* No DMA for now since AMBA PL080 dmaengine driver only does scatter
207 * gather, and the MMCI driver doesn't do it this way */
208}; 205};
209 206
210static struct lpc32xx_slc_platform_data lpc32xx_slc_data = { 207static struct lpc32xx_slc_platform_data lpc32xx_slc_data = {
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index a7f959e58c3d..9b26976fb084 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -42,9 +42,6 @@ config ARCH_QSD8X50
42 42
43endchoice 43endchoice
44 44
45config MSM_HAS_DEBUG_UART_HS
46 bool
47
48config MSM_SOC_REV_A 45config MSM_SOC_REV_A
49 bool 46 bool
50 47
diff --git a/arch/arm/mach-msm/board-trout-gpio.c b/arch/arm/mach-msm/board-trout-gpio.c
index 87e1d01edecc..2c25050209ce 100644
--- a/arch/arm/mach-msm/board-trout-gpio.c
+++ b/arch/arm/mach-msm/board-trout-gpio.c
@@ -89,7 +89,7 @@ static int trout_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
89 .base = base_gpio, \ 89 .base = base_gpio, \
90 .ngpio = 8, \ 90 .ngpio = 8, \
91 }, \ 91 }, \
92 .reg = (void *) reg_num + TROUT_CPLD_BASE, \ 92 .reg = reg_num + TROUT_CPLD_BASE, \
93 .shadow = shadow_val, \ 93 .shadow = shadow_val, \
94 } 94 }
95 95
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 015d544aa017..5edfbd904d06 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -78,7 +78,7 @@ static void __init trout_init(void)
78 78
79static struct map_desc trout_io_desc[] __initdata = { 79static struct map_desc trout_io_desc[] __initdata = {
80 { 80 {
81 .virtual = TROUT_CPLD_BASE, 81 .virtual = (unsigned long)TROUT_CPLD_BASE,
82 .pfn = __phys_to_pfn(TROUT_CPLD_START), 82 .pfn = __phys_to_pfn(TROUT_CPLD_START),
83 .length = TROUT_CPLD_SIZE, 83 .length = TROUT_CPLD_SIZE,
84 .type = MT_DEVICE_NONSHARED 84 .type = MT_DEVICE_NONSHARED
diff --git a/arch/arm/mach-msm/board-trout.h b/arch/arm/mach-msm/board-trout.h
index b2379ede43bc..adb757abbb92 100644
--- a/arch/arm/mach-msm/board-trout.h
+++ b/arch/arm/mach-msm/board-trout.h
@@ -58,7 +58,7 @@
58#define TROUT_4_TP_LS_EN 19 58#define TROUT_4_TP_LS_EN 19
59#define TROUT_5_TP_LS_EN 1 59#define TROUT_5_TP_LS_EN 1
60 60
61#define TROUT_CPLD_BASE 0xE8100000 61#define TROUT_CPLD_BASE IOMEM(0xE8100000)
62#define TROUT_CPLD_START 0x98000000 62#define TROUT_CPLD_START 0x98000000
63#define TROUT_CPLD_SIZE SZ_4K 63#define TROUT_CPLD_SIZE SZ_4K
64 64
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 3f73eecbcfb0..6090b9eb00c8 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -3,15 +3,13 @@ config ARCH_MVEBU
3 select ARCH_SUPPORTS_BIG_ENDIAN 3 select ARCH_SUPPORTS_BIG_ENDIAN
4 select CLKSRC_MMIO 4 select CLKSRC_MMIO
5 select GENERIC_IRQ_CHIP 5 select GENERIC_IRQ_CHIP
6 select IRQ_DOMAIN
7 select PINCTRL 6 select PINCTRL
8 select PLAT_ORION 7 select PLAT_ORION
8 select SOC_BUS
9 select MVEBU_MBUS 9 select MVEBU_MBUS
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 MIGHT_HAVE_PCI
13 select PCI_QUIRKS if PCI 12 select PCI_QUIRKS if PCI
14 select OF_ADDRESS_PCI
15 13
16if ARCH_MVEBU 14if ARCH_MVEBU
17 15
@@ -38,7 +36,9 @@ config MACH_ARMADA_375
38 select ARM_ERRATA_753970 36 select ARM_ERRATA_753970
39 select ARM_GIC 37 select ARM_GIC
40 select ARMADA_375_CLK 38 select ARMADA_375_CLK
41 select CPU_V7 39 select HAVE_ARM_SCU
40 select HAVE_ARM_TWD if SMP
41 select HAVE_SMP
42 select MACH_MVEBU_V7 42 select MACH_MVEBU_V7
43 select PINCTRL_ARMADA_375 43 select PINCTRL_ARMADA_375
44 help 44 help
@@ -51,7 +51,9 @@ config MACH_ARMADA_38X
51 select ARM_ERRATA_753970 51 select ARM_ERRATA_753970
52 select ARM_GIC 52 select ARM_GIC
53 select ARMADA_38X_CLK 53 select ARMADA_38X_CLK
54 select CPU_V7 54 select HAVE_ARM_SCU
55 select HAVE_ARM_TWD if SMP
56 select HAVE_SMP
55 select MACH_MVEBU_V7 57 select MACH_MVEBU_V7
56 select PINCTRL_ARMADA_38X 58 select PINCTRL_ARMADA_38X
57 help 59 help
@@ -86,24 +88,15 @@ config MACH_KIRKWOOD
86 select ARCH_REQUIRE_GPIOLIB 88 select ARCH_REQUIRE_GPIOLIB
87 select CPU_FEROCEON 89 select CPU_FEROCEON
88 select KIRKWOOD_CLK 90 select KIRKWOOD_CLK
89 select OF_IRQ
90 select ORION_IRQCHIP 91 select ORION_IRQCHIP
91 select ORION_TIMER 92 select ORION_TIMER
92 select PCI 93 select PCI
93 select PCI_QUIRKS 94 select PCI_QUIRKS
94 select PINCTRL_KIRKWOOD 95 select PINCTRL_KIRKWOOD
95 select USE_OF
96 help 96 help
97 Say 'Y' here if you want your kernel to support boards based 97 Say 'Y' here if you want your kernel to support boards based
98 on the Marvell Kirkwood device tree. 98 on the Marvell Kirkwood device tree.
99 99
100config MACH_T5325
101 bool "HP T5325 thin client"
102 depends on MACH_KIRKWOOD
103 help
104 Say 'Y' here if you want your kernel to support the
105 HP T5325 Thin client
106
107endmenu 100endmenu
108 101
109endif 102endif
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index a63e43b6b451..2ecb828e4a8b 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -2,12 +2,15 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
2 -I$(srctree)/arch/arm/plat-orion/include 2 -I$(srctree)/arch/arm/plat-orion/include
3 3
4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a 4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a
5CFLAGS_pmsu.o := -march=armv7-a
5 6
6obj-y += system-controller.o mvebu-soc-id.o 7obj-y += system-controller.o mvebu-soc-id.o
7obj-$(CONFIG_MACH_MVEBU_V7) += board-v7.o 8
9ifeq ($(CONFIG_MACH_MVEBU_V7),y)
10obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o
11obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o
12obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
13endif
14
8obj-$(CONFIG_MACH_DOVE) += dove.o 15obj-$(CONFIG_MACH_DOVE) += dove.o
9obj-$(CONFIG_ARCH_MVEBU) += coherency.o coherency_ll.o pmsu.o
10obj-$(CONFIG_SMP) += platsmp.o headsmp.o
11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
12obj-$(CONFIG_MACH_KIRKWOOD) += kirkwood.o kirkwood-pm.o 16obj-$(CONFIG_MACH_KIRKWOOD) += kirkwood.o kirkwood-pm.o
13obj-$(CONFIG_MACH_T5325) += board-t5325.o
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index 237c86b83390..c3465f5b1250 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -20,8 +20,6 @@
20 20
21#define ARMADA_XP_MAX_CPUS 4 21#define ARMADA_XP_MAX_CPUS 4
22 22
23void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq);
24void armada_xp_mpic_smp_cpu_init(void);
25void armada_xp_secondary_startup(void); 23void armada_xp_secondary_startup(void);
26extern struct smp_operations armada_xp_smp_ops; 24extern struct smp_operations armada_xp_smp_ops;
27#endif 25#endif
diff --git a/arch/arm/mach-mvebu/board-t5325.c b/arch/arm/mach-mvebu/board-t5325.c
deleted file mode 100644
index 65ace6db9f28..000000000000
--- a/arch/arm/mach-mvebu/board-t5325.c
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * HP T5325 Board Setup
3 *
4 * Copyright (C) 2014
5 *
6 * Andrew Lunn <andrew@lunn.ch>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/i2c.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <sound/alc5623.h>
18#include "board.h"
19
20static struct platform_device hp_t5325_audio_device = {
21 .name = "t5325-audio",
22 .id = -1,
23};
24
25static struct alc5623_platform_data alc5621_data = {
26 .add_ctrl = 0x3700,
27 .jack_det_ctrl = 0x4810,
28};
29
30static struct i2c_board_info i2c_board_info[] __initdata = {
31 {
32 I2C_BOARD_INFO("alc5621", 0x1a),
33 .platform_data = &alc5621_data,
34 },
35};
36
37void __init t5325_init(void)
38{
39 i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));
40 platform_device_register(&hp_t5325_audio_device);
41}
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
index 333fca8fdc41..01cfce6ac20b 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -27,12 +27,30 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30#include <asm/smp_scu.h>
30#include "armada-370-xp.h" 31#include "armada-370-xp.h"
31#include "common.h" 32#include "common.h"
32#include "coherency.h" 33#include "coherency.h"
33#include "mvebu-soc-id.h" 34#include "mvebu-soc-id.h"
34 35
35/* 36/*
37 * Enables the SCU when available. Obviously, this is only useful on
38 * Cortex-A based SOCs, not on PJ4B based ones.
39 */
40static void __init mvebu_scu_enable(void)
41{
42 void __iomem *scu_base;
43
44 struct device_node *np =
45 of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
46 if (np) {
47 scu_base = of_iomap(np, 0);
48 scu_enable(scu_base);
49 of_node_put(np);
50 }
51}
52
53/*
36 * Early versions of Armada 375 SoC have a bug where the BootROM 54 * Early versions of Armada 375 SoC have a bug where the BootROM
37 * leaves an external data abort pending. The kernel is hit by this 55 * leaves an external data abort pending. The kernel is hit by this
38 * data abort as soon as it enters userspace, because it unmasks the 56 * data abort as soon as it enters userspace, because it unmasks the
@@ -57,11 +75,10 @@ static void __init mvebu_timer_and_clk_init(void)
57{ 75{
58 of_clk_init(NULL); 76 of_clk_init(NULL);
59 clocksource_of_init(); 77 clocksource_of_init();
78 mvebu_scu_enable();
60 coherency_init(); 79 coherency_init();
61 BUG_ON(mvebu_mbus_dt_init()); 80 BUG_ON(mvebu_mbus_dt_init(coherency_available()));
62#ifdef CONFIG_CACHE_L2X0
63 l2x0_of_init(0, ~0UL); 81 l2x0_of_init(0, ~0UL);
64#endif
65 82
66 if (of_machine_is_compatible("marvell,armada375")) 83 if (of_machine_is_compatible("marvell,armada375"))
67 hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0, 84 hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0,
@@ -78,7 +95,7 @@ static void __init i2c_quirk(void)
78 * mechanism. We can exit only if we are sure that we can 95 * mechanism. We can exit only if we are sure that we can
79 * get the SoC revision and it is more recent than A0. 96 * get the SoC revision and it is more recent than A0.
80 */ 97 */
81 if (mvebu_get_soc_id(&rev, &dev) == 0 && dev > MV78XX0_A0_REV) 98 if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > MV78XX0_A0_REV)
82 return; 99 return;
83 100
84 for_each_compatible_node(np, NULL, "marvell,mv78230-i2c") { 101 for_each_compatible_node(np, NULL, "marvell,mv78230-i2c") {
@@ -96,10 +113,66 @@ static void __init i2c_quirk(void)
96 return; 113 return;
97} 114}
98 115
116#define A375_Z1_THERMAL_FIXUP_OFFSET 0xc
117
118static void __init thermal_quirk(void)
119{
120 struct device_node *np;
121 u32 dev, rev;
122
123 if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > ARMADA_375_Z1_REV)
124 return;
125
126 for_each_compatible_node(np, NULL, "marvell,armada375-thermal") {
127 struct property *prop;
128 __be32 newval, *newprop, *oldprop;
129 int len;
130
131 /*
132 * The register offset is at a wrong location. This quirk
133 * creates a new reg property as a clone of the previous
134 * one and corrects the offset.
135 */
136 oldprop = (__be32 *)of_get_property(np, "reg", &len);
137 if (!oldprop)
138 continue;
139
140 /* Create a duplicate of the 'reg' property */
141 prop = kzalloc(sizeof(*prop), GFP_KERNEL);
142 prop->length = len;
143 prop->name = kstrdup("reg", GFP_KERNEL);
144 prop->value = kzalloc(len, GFP_KERNEL);
145 memcpy(prop->value, oldprop, len);
146
147 /* Fixup the register offset of the second entry */
148 oldprop += 2;
149 newprop = (__be32 *)prop->value + 2;
150 newval = cpu_to_be32(be32_to_cpu(*oldprop) -
151 A375_Z1_THERMAL_FIXUP_OFFSET);
152 *newprop = newval;
153 of_update_property(np, prop);
154
155 /*
156 * The thermal controller needs some quirk too, so let's change
157 * the compatible string to reflect this.
158 */
159 prop = kzalloc(sizeof(*prop), GFP_KERNEL);
160 prop->name = kstrdup("compatible", GFP_KERNEL);
161 prop->length = sizeof("marvell,armada375-z1-thermal");
162 prop->value = kstrdup("marvell,armada375-z1-thermal",
163 GFP_KERNEL);
164 of_update_property(np, prop);
165 }
166 return;
167}
168
99static void __init mvebu_dt_init(void) 169static void __init mvebu_dt_init(void)
100{ 170{
101 if (of_machine_is_compatible("plathome,openblocks-ax3-4")) 171 if (of_machine_is_compatible("plathome,openblocks-ax3-4"))
102 i2c_quirk(); 172 i2c_quirk();
173 if (of_machine_is_compatible("marvell,a375-db"))
174 thermal_quirk();
175
103 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 176 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
104} 177}
105 178
@@ -123,6 +196,7 @@ static const char * const armada_375_dt_compat[] = {
123 196
124DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)") 197DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)")
125 .init_time = mvebu_timer_and_clk_init, 198 .init_time = mvebu_timer_and_clk_init,
199 .init_machine = mvebu_dt_init,
126 .restart = mvebu_restart, 200 .restart = mvebu_restart,
127 .dt_compat = armada_375_dt_compat, 201 .dt_compat = armada_375_dt_compat,
128MACHINE_END 202MACHINE_END
diff --git a/arch/arm/mach-mvebu/board.h b/arch/arm/mach-mvebu/board.h
index de7f0a191394..9c7bb4386f8b 100644
--- a/arch/arm/mach-mvebu/board.h
+++ b/arch/arm/mach-mvebu/board.h
@@ -13,10 +13,4 @@
13#ifndef __ARCH_MVEBU_BOARD_H 13#ifndef __ARCH_MVEBU_BOARD_H
14#define __ARCH_MVEBU_BOARD_H 14#define __ARCH_MVEBU_BOARD_H
15 15
16#ifdef CONFIG_MACH_T5325
17void t5325_init(void);
18#else
19static inline void t5325_init(void) {};
20#endif
21
22#endif 16#endif
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 4e9d58148ca7..477202fd39cc 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -17,6 +17,8 @@
17 * supplies basic routines for configuring and controlling hardware coherency 17 * supplies basic routines for configuring and controlling hardware coherency
18 */ 18 */
19 19
20#define pr_fmt(fmt) "mvebu-coherency: " fmt
21
20#include <linux/kernel.h> 22#include <linux/kernel.h>
21#include <linux/init.h> 23#include <linux/init.h>
22#include <linux/of_address.h> 24#include <linux/of_address.h>
@@ -24,13 +26,19 @@
24#include <linux/smp.h> 26#include <linux/smp.h>
25#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
26#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/slab.h>
30#include <linux/mbus.h>
31#include <linux/clk.h>
32#include <linux/pci.h>
27#include <asm/smp_plat.h> 33#include <asm/smp_plat.h>
28#include <asm/cacheflush.h> 34#include <asm/cacheflush.h>
35#include <asm/mach/map.h>
29#include "armada-370-xp.h" 36#include "armada-370-xp.h"
30#include "coherency.h" 37#include "coherency.h"
38#include "mvebu-soc-id.h"
31 39
32unsigned long coherency_phys_base; 40unsigned long coherency_phys_base;
33static void __iomem *coherency_base; 41void __iomem *coherency_base;
34static void __iomem *coherency_cpu_base; 42static void __iomem *coherency_cpu_base;
35 43
36/* Coherency fabric registers */ 44/* Coherency fabric registers */
@@ -38,27 +46,190 @@ static void __iomem *coherency_cpu_base;
38 46
39#define IO_SYNC_BARRIER_CTL_OFFSET 0x0 47#define IO_SYNC_BARRIER_CTL_OFFSET 0x0
40 48
49enum {
50 COHERENCY_FABRIC_TYPE_NONE,
51 COHERENCY_FABRIC_TYPE_ARMADA_370_XP,
52 COHERENCY_FABRIC_TYPE_ARMADA_375,
53 COHERENCY_FABRIC_TYPE_ARMADA_380,
54};
55
41static struct of_device_id of_coherency_table[] = { 56static struct of_device_id of_coherency_table[] = {
42 {.compatible = "marvell,coherency-fabric"}, 57 {.compatible = "marvell,coherency-fabric",
58 .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_370_XP },
59 {.compatible = "marvell,armada-375-coherency-fabric",
60 .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_375 },
61 {.compatible = "marvell,armada-380-coherency-fabric",
62 .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_380 },
43 { /* end of list */ }, 63 { /* end of list */ },
44}; 64};
45 65
46/* Function defined in coherency_ll.S */ 66/* Functions defined in coherency_ll.S */
47int ll_set_cpu_coherent(void __iomem *base_addr, unsigned int hw_cpu_id); 67int ll_enable_coherency(void);
68void ll_add_cpu_to_smp_group(void);
48 69
49int set_cpu_coherent(unsigned int hw_cpu_id, int smp_group_id) 70int set_cpu_coherent(void)
50{ 71{
51 if (!coherency_base) { 72 if (!coherency_base) {
52 pr_warn("Can't make CPU %d cache coherent.\n", hw_cpu_id); 73 pr_warn("Can't make current CPU cache coherent.\n");
53 pr_warn("Coherency fabric is not initialized\n"); 74 pr_warn("Coherency fabric is not initialized\n");
54 return 1; 75 return 1;
55 } 76 }
56 77
57 return ll_set_cpu_coherent(coherency_base, hw_cpu_id); 78 ll_add_cpu_to_smp_group();
79 return ll_enable_coherency();
80}
81
82/*
83 * The below code implements the I/O coherency workaround on Armada
84 * 375. This workaround consists in using the two channels of the
85 * first XOR engine to trigger a XOR transaction that serves as the
86 * I/O coherency barrier.
87 */
88
89static void __iomem *xor_base, *xor_high_base;
90static dma_addr_t coherency_wa_buf_phys[CONFIG_NR_CPUS];
91static void *coherency_wa_buf[CONFIG_NR_CPUS];
92static bool coherency_wa_enabled;
93
94#define XOR_CONFIG(chan) (0x10 + (chan * 4))
95#define XOR_ACTIVATION(chan) (0x20 + (chan * 4))
96#define WINDOW_BAR_ENABLE(chan) (0x240 + ((chan) << 2))
97#define WINDOW_BASE(w) (0x250 + ((w) << 2))
98#define WINDOW_SIZE(w) (0x270 + ((w) << 2))
99#define WINDOW_REMAP_HIGH(w) (0x290 + ((w) << 2))
100#define WINDOW_OVERRIDE_CTRL(chan) (0x2A0 + ((chan) << 2))
101#define XOR_DEST_POINTER(chan) (0x2B0 + (chan * 4))
102#define XOR_BLOCK_SIZE(chan) (0x2C0 + (chan * 4))
103#define XOR_INIT_VALUE_LOW 0x2E0
104#define XOR_INIT_VALUE_HIGH 0x2E4
105
106static inline void mvebu_hwcc_armada375_sync_io_barrier_wa(void)
107{
108 int idx = smp_processor_id();
109
110 /* Write '1' to the first word of the buffer */
111 writel(0x1, coherency_wa_buf[idx]);
112
113 /* Wait until the engine is idle */
114 while ((readl(xor_base + XOR_ACTIVATION(idx)) >> 4) & 0x3)
115 ;
116
117 dmb();
118
119 /* Trigger channel */
120 writel(0x1, xor_base + XOR_ACTIVATION(idx));
121
122 /* Poll the data until it is cleared by the XOR transaction */
123 while (readl(coherency_wa_buf[idx]))
124 ;
125}
126
127static void __init armada_375_coherency_init_wa(void)
128{
129 const struct mbus_dram_target_info *dram;
130 struct device_node *xor_node;
131 struct property *xor_status;
132 struct clk *xor_clk;
133 u32 win_enable = 0;
134 int i;
135
136 pr_warn("enabling coherency workaround for Armada 375 Z1, one XOR engine disabled\n");
137
138 /*
139 * Since the workaround uses one XOR engine, we grab a
140 * reference to its Device Tree node first.
141 */
142 xor_node = of_find_compatible_node(NULL, NULL, "marvell,orion-xor");
143 BUG_ON(!xor_node);
144
145 /*
146 * Then we mark it as disabled so that the real XOR driver
147 * will not use it.
148 */
149 xor_status = kzalloc(sizeof(struct property), GFP_KERNEL);
150 BUG_ON(!xor_status);
151
152 xor_status->value = kstrdup("disabled", GFP_KERNEL);
153 BUG_ON(!xor_status->value);
154
155 xor_status->length = 8;
156 xor_status->name = kstrdup("status", GFP_KERNEL);
157 BUG_ON(!xor_status->name);
158
159 of_update_property(xor_node, xor_status);
160
161 /*
162 * And we remap the registers, get the clock, and do the
163 * initial configuration of the XOR engine.
164 */
165 xor_base = of_iomap(xor_node, 0);
166 xor_high_base = of_iomap(xor_node, 1);
167
168 xor_clk = of_clk_get_by_name(xor_node, NULL);
169 BUG_ON(!xor_clk);
170
171 clk_prepare_enable(xor_clk);
172
173 dram = mv_mbus_dram_info();
174
175 for (i = 0; i < 8; i++) {
176 writel(0, xor_base + WINDOW_BASE(i));
177 writel(0, xor_base + WINDOW_SIZE(i));
178 if (i < 4)
179 writel(0, xor_base + WINDOW_REMAP_HIGH(i));
180 }
181
182 for (i = 0; i < dram->num_cs; i++) {
183 const struct mbus_dram_window *cs = dram->cs + i;
184 writel((cs->base & 0xffff0000) |
185 (cs->mbus_attr << 8) |
186 dram->mbus_dram_target_id, xor_base + WINDOW_BASE(i));
187 writel((cs->size - 1) & 0xffff0000, xor_base + WINDOW_SIZE(i));
188
189 win_enable |= (1 << i);
190 win_enable |= 3 << (16 + (2 * i));
191 }
192
193 writel(win_enable, xor_base + WINDOW_BAR_ENABLE(0));
194 writel(win_enable, xor_base + WINDOW_BAR_ENABLE(1));
195 writel(0, xor_base + WINDOW_OVERRIDE_CTRL(0));
196 writel(0, xor_base + WINDOW_OVERRIDE_CTRL(1));
197
198 for (i = 0; i < CONFIG_NR_CPUS; i++) {
199 coherency_wa_buf[i] = kzalloc(PAGE_SIZE, GFP_KERNEL);
200 BUG_ON(!coherency_wa_buf[i]);
201
202 /*
203 * We can't use the DMA mapping API, since we don't
204 * have a valid 'struct device' pointer
205 */
206 coherency_wa_buf_phys[i] =
207 virt_to_phys(coherency_wa_buf[i]);
208 BUG_ON(!coherency_wa_buf_phys[i]);
209
210 /*
211 * Configure the XOR engine for memset operation, with
212 * a 128 bytes block size
213 */
214 writel(0x444, xor_base + XOR_CONFIG(i));
215 writel(128, xor_base + XOR_BLOCK_SIZE(i));
216 writel(coherency_wa_buf_phys[i],
217 xor_base + XOR_DEST_POINTER(i));
218 }
219
220 writel(0x0, xor_base + XOR_INIT_VALUE_LOW);
221 writel(0x0, xor_base + XOR_INIT_VALUE_HIGH);
222
223 coherency_wa_enabled = true;
58} 224}
59 225
60static inline void mvebu_hwcc_sync_io_barrier(void) 226static inline void mvebu_hwcc_sync_io_barrier(void)
61{ 227{
228 if (coherency_wa_enabled) {
229 mvebu_hwcc_armada375_sync_io_barrier_wa();
230 return;
231 }
232
62 writel(0x1, coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET); 233 writel(0x1, coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET);
63 while (readl(coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET) & 0x1); 234 while (readl(coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET) & 0x1);
64} 235}
@@ -105,8 +276,8 @@ static struct dma_map_ops mvebu_hwcc_dma_ops = {
105 .set_dma_mask = arm_dma_set_mask, 276 .set_dma_mask = arm_dma_set_mask,
106}; 277};
107 278
108static int mvebu_hwcc_platform_notifier(struct notifier_block *nb, 279static int mvebu_hwcc_notifier(struct notifier_block *nb,
109 unsigned long event, void *__dev) 280 unsigned long event, void *__dev)
110{ 281{
111 struct device *dev = __dev; 282 struct device *dev = __dev;
112 283
@@ -117,47 +288,148 @@ static int mvebu_hwcc_platform_notifier(struct notifier_block *nb,
117 return NOTIFY_OK; 288 return NOTIFY_OK;
118} 289}
119 290
120static struct notifier_block mvebu_hwcc_platform_nb = { 291static struct notifier_block mvebu_hwcc_nb = {
121 .notifier_call = mvebu_hwcc_platform_notifier, 292 .notifier_call = mvebu_hwcc_notifier,
122}; 293};
123 294
124int __init coherency_init(void) 295static void __init armada_370_coherency_init(struct device_node *np)
296{
297 struct resource res;
298
299 of_address_to_resource(np, 0, &res);
300 coherency_phys_base = res.start;
301 /*
302 * Ensure secondary CPUs will see the updated value,
303 * which they read before they join the coherency
304 * fabric, and therefore before they are coherent with
305 * the boot CPU cache.
306 */
307 sync_cache_w(&coherency_phys_base);
308 coherency_base = of_iomap(np, 0);
309 coherency_cpu_base = of_iomap(np, 1);
310 set_cpu_coherent();
311}
312
313/*
314 * This ioremap hook is used on Armada 375/38x to ensure that PCIe
315 * memory areas are mapped as MT_UNCACHED instead of MT_DEVICE. This
316 * is needed as a workaround for a deadlock issue between the PCIe
317 * interface and the cache controller.
318 */
319static void __iomem *
320armada_pcie_wa_ioremap_caller(phys_addr_t phys_addr, size_t size,
321 unsigned int mtype, void *caller)
322{
323 struct resource pcie_mem;
324
325 mvebu_mbus_get_pcie_mem_aperture(&pcie_mem);
326
327 if (pcie_mem.start <= phys_addr && (phys_addr + size) <= pcie_mem.end)
328 mtype = MT_UNCACHED;
329
330 return __arm_ioremap_caller(phys_addr, size, mtype, caller);
331}
332
333static void __init armada_375_380_coherency_init(struct device_node *np)
334{
335 struct device_node *cache_dn;
336
337 coherency_cpu_base = of_iomap(np, 0);
338 arch_ioremap_caller = armada_pcie_wa_ioremap_caller;
339
340 /*
341 * Add the PL310 property "arm,io-coherent". This makes sure the
342 * outer sync operation is not used, which allows to
343 * workaround the system erratum that causes deadlocks when
344 * doing PCIe in an SMP situation on Armada 375 and Armada
345 * 38x.
346 */
347 for_each_compatible_node(cache_dn, NULL, "arm,pl310-cache") {
348 struct property *p;
349
350 p = kzalloc(sizeof(*p), GFP_KERNEL);
351 p->name = kstrdup("arm,io-coherent", GFP_KERNEL);
352 of_add_property(cache_dn, p);
353 }
354}
355
356static int coherency_type(void)
125{ 357{
126 struct device_node *np; 358 struct device_node *np;
359 const struct of_device_id *match;
127 360
128 np = of_find_matching_node(NULL, of_coherency_table); 361 np = of_find_matching_node_and_match(NULL, of_coherency_table, &match);
129 if (np) { 362 if (np) {
130 struct resource res; 363 int type = (int) match->data;
131 pr_info("Initializing Coherency fabric\n"); 364
132 of_address_to_resource(np, 0, &res); 365 /* Armada 370/XP coherency works in both UP and SMP */
133 coherency_phys_base = res.start; 366 if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP)
134 /* 367 return type;
135 * Ensure secondary CPUs will see the updated value, 368
136 * which they read before they join the coherency 369 /* Armada 375 coherency works only on SMP */
137 * fabric, and therefore before they are coherent with 370 else if (type == COHERENCY_FABRIC_TYPE_ARMADA_375 && is_smp())
138 * the boot CPU cache. 371 return type;
139 */ 372
140 sync_cache_w(&coherency_phys_base); 373 /* Armada 380 coherency works only on SMP */
141 coherency_base = of_iomap(np, 0); 374 else if (type == COHERENCY_FABRIC_TYPE_ARMADA_380 && is_smp())
142 coherency_cpu_base = of_iomap(np, 1); 375 return type;
143 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
144 of_node_put(np);
145 } 376 }
146 377
147 return 0; 378 return COHERENCY_FABRIC_TYPE_NONE;
148} 379}
149 380
150static int __init coherency_late_init(void) 381int coherency_available(void)
382{
383 return coherency_type() != COHERENCY_FABRIC_TYPE_NONE;
384}
385
386int __init coherency_init(void)
151{ 387{
388 int type = coherency_type();
152 struct device_node *np; 389 struct device_node *np;
153 390
154 np = of_find_matching_node(NULL, of_coherency_table); 391 np = of_find_matching_node(NULL, of_coherency_table);
155 if (np) { 392
156 bus_register_notifier(&platform_bus_type, 393 if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP)
157 &mvebu_hwcc_platform_nb); 394 armada_370_coherency_init(np);
158 of_node_put(np); 395 else if (type == COHERENCY_FABRIC_TYPE_ARMADA_375 ||
396 type == COHERENCY_FABRIC_TYPE_ARMADA_380)
397 armada_375_380_coherency_init(np);
398
399 return 0;
400}
401
402static int __init coherency_late_init(void)
403{
404 int type = coherency_type();
405
406 if (type == COHERENCY_FABRIC_TYPE_NONE)
407 return 0;
408
409 if (type == COHERENCY_FABRIC_TYPE_ARMADA_375) {
410 u32 dev, rev;
411
412 if (mvebu_get_soc_id(&dev, &rev) == 0 &&
413 rev == ARMADA_375_Z1_REV)
414 armada_375_coherency_init_wa();
159 } 415 }
416
417 bus_register_notifier(&platform_bus_type,
418 &mvebu_hwcc_nb);
419
160 return 0; 420 return 0;
161} 421}
162 422
163postcore_initcall(coherency_late_init); 423postcore_initcall(coherency_late_init);
424
425#if IS_ENABLED(CONFIG_PCI)
426static int __init coherency_pci_init(void)
427{
428 if (coherency_available())
429 bus_register_notifier(&pci_bus_type,
430 &mvebu_hwcc_nb);
431 return 0;
432}
433
434arch_initcall(coherency_pci_init);
435#endif
diff --git a/arch/arm/mach-mvebu/coherency.h b/arch/arm/mach-mvebu/coherency.h
index 760226c41353..54cb7607b526 100644
--- a/arch/arm/mach-mvebu/coherency.h
+++ b/arch/arm/mach-mvebu/coherency.h
@@ -15,8 +15,9 @@
15#define __MACH_370_XP_COHERENCY_H 15#define __MACH_370_XP_COHERENCY_H
16 16
17extern unsigned long coherency_phys_base; 17extern unsigned long coherency_phys_base;
18int set_cpu_coherent(void);
18 19
19int set_cpu_coherent(unsigned int cpu_id, int smp_group_id);
20int coherency_init(void); 20int coherency_init(void);
21int coherency_available(void);
21 22
22#endif /* __MACH_370_XP_COHERENCY_H */ 23#endif /* __MACH_370_XP_COHERENCY_H */
diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S
index ee7598fe75db..510c29e079ca 100644
--- a/arch/arm/mach-mvebu/coherency_ll.S
+++ b/arch/arm/mach-mvebu/coherency_ll.S
@@ -21,38 +21,129 @@
21#define ARMADA_XP_CFB_CFG_REG_OFFSET 0x4 21#define ARMADA_XP_CFB_CFG_REG_OFFSET 0x4
22 22
23#include <asm/assembler.h> 23#include <asm/assembler.h>
24#include <asm/cp15.h>
24 25
25 .text 26 .text
27/* Returns the coherency base address in r1 (r0 is untouched) */
28ENTRY(ll_get_coherency_base)
29 mrc p15, 0, r1, c1, c0, 0
30 tst r1, #CR_M @ Check MMU bit enabled
31 bne 1f
32
33 /*
34 * MMU is disabled, use the physical address of the coherency
35 * base address.
36 */
37 adr r1, 3f
38 ldr r3, [r1]
39 ldr r1, [r1, r3]
40 b 2f
411:
42 /*
43 * MMU is enabled, use the virtual address of the coherency
44 * base address.
45 */
46 ldr r1, =coherency_base
47 ldr r1, [r1]
482:
49 mov pc, lr
50ENDPROC(ll_get_coherency_base)
51
26/* 52/*
27 * r0: Coherency fabric base register address 53 * Returns the coherency CPU mask in r3 (r0 is untouched). This
28 * r1: HW CPU id 54 * coherency CPU mask can be used with the coherency fabric
55 * configuration and control registers. Note that the mask is already
56 * endian-swapped as appropriate so that the calling functions do not
57 * have to care about endianness issues while accessing the coherency
58 * fabric registers
29 */ 59 */
30ENTRY(ll_set_cpu_coherent) 60ENTRY(ll_get_coherency_cpumask)
31 /* Create bit by cpu index */ 61 mrc 15, 0, r3, cr0, cr0, 5
32 mov r3, #(1 << 24) 62 and r3, r3, #15
33 lsl r1, r3, r1 63 mov r2, #(1 << 24)
34ARM_BE8(rev r1, r1) 64 lsl r3, r2, r3
35 65ARM_BE8(rev r3, r3)
36 /* Add CPU to SMP group - Atomic */ 66 mov pc, lr
37 add r3, r0, #ARMADA_XP_CFB_CTL_REG_OFFSET 67ENDPROC(ll_get_coherency_cpumask)
381: 68
39 ldrex r2, [r3] 69/*
40 orr r2, r2, r1 70 * ll_add_cpu_to_smp_group(), ll_enable_coherency() and
41 strex r0, r2, [r3] 71 * ll_disable_coherency() use the strex/ldrex instructions while the
42 cmp r0, #0 72 * MMU can be disabled. The Armada XP SoC has an exclusive monitor
43 bne 1b 73 * that tracks transactions to Device and/or SO memory and thanks to
44 74 * that, exclusive transactions are functional even when the MMU is
45 /* Enable coherency on CPU - Atomic */ 75 * disabled.
46 add r3, r3, #ARMADA_XP_CFB_CFG_REG_OFFSET 76 */
77
78ENTRY(ll_add_cpu_to_smp_group)
79 /*
80 * As r0 is not modified by ll_get_coherency_base() and
81 * ll_get_coherency_cpumask(), we use it to temporarly save lr
82 * and avoid it being modified by the branch and link
83 * calls. This function is used very early in the secondary
84 * CPU boot, and no stack is available at this point.
85 */
86 mov r0, lr
87 bl ll_get_coherency_base
88 bl ll_get_coherency_cpumask
89 mov lr, r0
90 add r0, r1, #ARMADA_XP_CFB_CFG_REG_OFFSET
471: 911:
48 ldrex r2, [r3] 92 ldrex r2, [r0]
49 orr r2, r2, r1 93 orr r2, r2, r3
50 strex r0, r2, [r3] 94 strex r1, r2, [r0]
51 cmp r0, #0 95 cmp r1, #0
52 bne 1b 96 bne 1b
97 mov pc, lr
98ENDPROC(ll_add_cpu_to_smp_group)
53 99
100ENTRY(ll_enable_coherency)
101 /*
102 * As r0 is not modified by ll_get_coherency_base() and
103 * ll_get_coherency_cpumask(), we use it to temporarly save lr
104 * and avoid it being modified by the branch and link
105 * calls. This function is used very early in the secondary
106 * CPU boot, and no stack is available at this point.
107 */
108 mov r0, lr
109 bl ll_get_coherency_base
110 bl ll_get_coherency_cpumask
111 mov lr, r0
112 add r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET
1131:
114 ldrex r2, [r0]
115 orr r2, r2, r3
116 strex r1, r2, [r0]
117 cmp r1, #0
118 bne 1b
54 dsb 119 dsb
55
56 mov r0, #0 120 mov r0, #0
57 mov pc, lr 121 mov pc, lr
58ENDPROC(ll_set_cpu_coherent) 122ENDPROC(ll_enable_coherency)
123
124ENTRY(ll_disable_coherency)
125 /*
126 * As r0 is not modified by ll_get_coherency_base() and
127 * ll_get_coherency_cpumask(), we use it to temporarly save lr
128 * and avoid it being modified by the branch and link
129 * calls. This function is used very early in the secondary
130 * CPU boot, and no stack is available at this point.
131 */
132 mov r0, lr
133 bl ll_get_coherency_base
134 bl ll_get_coherency_cpumask
135 mov lr, r0
136 add r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET
1371:
138 ldrex r2, [r0]
139 bic r2, r2, r3
140 strex r1, r2, [r0]
141 cmp r1, #0
142 bne 1b
143 dsb
144 mov pc, lr
145ENDPROC(ll_disable_coherency)
146
147 .align 2
1483:
149 .long coherency_phys_base - .
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index 55449c487c9e..b67fb7a10d8b 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -18,6 +18,9 @@
18#include <linux/reboot.h> 18#include <linux/reboot.h>
19 19
20void mvebu_restart(enum reboot_mode mode, const char *cmd); 20void mvebu_restart(enum reboot_mode mode, const char *cmd);
21int mvebu_cpu_reset_deassert(int cpu);
22void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr);
23void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr);
21 24
22void armada_xp_cpu_die(unsigned int cpu); 25void armada_xp_cpu_die(unsigned int cpu);
23 26
diff --git a/arch/arm/mach-mvebu/cpu-reset.c b/arch/arm/mach-mvebu/cpu-reset.c
new file mode 100644
index 000000000000..4a8f9eebebea
--- /dev/null
+++ b/arch/arm/mach-mvebu/cpu-reset.c
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2014 Marvell
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#define pr_fmt(fmt) "mvebu-cpureset: " fmt
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/of_address.h>
16#include <linux/io.h>
17#include <linux/resource.h>
18#include "armada-370-xp.h"
19
20static void __iomem *cpu_reset_base;
21static size_t cpu_reset_size;
22
23#define CPU_RESET_OFFSET(cpu) (cpu * 0x8)
24#define CPU_RESET_ASSERT BIT(0)
25
26int mvebu_cpu_reset_deassert(int cpu)
27{
28 u32 reg;
29
30 if (!cpu_reset_base)
31 return -ENODEV;
32
33 if (CPU_RESET_OFFSET(cpu) >= cpu_reset_size)
34 return -EINVAL;
35
36 reg = readl(cpu_reset_base + CPU_RESET_OFFSET(cpu));
37 reg &= ~CPU_RESET_ASSERT;
38 writel(reg, cpu_reset_base + CPU_RESET_OFFSET(cpu));
39
40 return 0;
41}
42
43static int mvebu_cpu_reset_map(struct device_node *np, int res_idx)
44{
45 struct resource res;
46
47 if (of_address_to_resource(np, res_idx, &res)) {
48 pr_err("unable to get resource\n");
49 return -ENOENT;
50 }
51
52 if (!request_mem_region(res.start, resource_size(&res),
53 np->full_name)) {
54 pr_err("unable to request region\n");
55 return -EBUSY;
56 }
57
58 cpu_reset_base = ioremap(res.start, resource_size(&res));
59 if (!cpu_reset_base) {
60 pr_err("unable to map registers\n");
61 release_mem_region(res.start, resource_size(&res));
62 return -ENOMEM;
63 }
64
65 cpu_reset_size = resource_size(&res);
66
67 return 0;
68}
69
70int __init mvebu_cpu_reset_init(void)
71{
72 struct device_node *np;
73 int res_idx;
74 int ret;
75
76 np = of_find_compatible_node(NULL, NULL,
77 "marvell,armada-370-cpu-reset");
78 if (np) {
79 res_idx = 0;
80 } else {
81 /*
82 * This code is kept for backward compatibility with
83 * old Device Trees.
84 */
85 np = of_find_compatible_node(NULL, NULL,
86 "marvell,armada-370-xp-pmsu");
87 if (np) {
88 pr_warn(FW_WARN "deprecated pmsu binding\n");
89 res_idx = 1;
90 }
91 }
92
93 /* No reset node found */
94 if (!np)
95 return -ENODEV;
96
97 ret = mvebu_cpu_reset_map(np, res_idx);
98 of_node_put(np);
99
100 return ret;
101}
102
103early_initcall(mvebu_cpu_reset_init);
diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
index 5e5a43624237..b50464ec1130 100644
--- a/arch/arm/mach-mvebu/dove.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -23,7 +23,7 @@ static void __init dove_init(void)
23#ifdef CONFIG_CACHE_TAUROS2 23#ifdef CONFIG_CACHE_TAUROS2
24 tauros2_init(0); 24 tauros2_init(0);
25#endif 25#endif
26 BUG_ON(mvebu_mbus_dt_init()); 26 BUG_ON(mvebu_mbus_dt_init(false));
27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
28} 28}
29 29
diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S
new file mode 100644
index 000000000000..5925366bc03c
--- /dev/null
+++ b/arch/arm/mach-mvebu/headsmp-a9.S
@@ -0,0 +1,34 @@
1/*
2 * SMP support: Entry point for secondary CPUs of Marvell EBU
3 * Cortex-A9 based SOCs (Armada 375 and Armada 38x).
4 *
5 * Copyright (C) 2014 Marvell
6 *
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#include <linux/linkage.h>
16#include <linux/init.h>
17
18 __CPUINIT
19#define CPU_RESUME_ADDR_REG 0xf10182d4
20
21.global armada_375_smp_cpu1_enable_code_start
22.global armada_375_smp_cpu1_enable_code_end
23
24armada_375_smp_cpu1_enable_code_start:
25 ldr r0, [pc, #4]
26 ldr r1, [r0]
27 mov pc, r1
28 .word CPU_RESUME_ADDR_REG
29armada_375_smp_cpu1_enable_code_end:
30
31ENTRY(mvebu_cortex_a9_secondary_startup)
32 bl v7_invalidate_l1
33 b secondary_startup
34ENDPROC(mvebu_cortex_a9_secondary_startup)
diff --git a/arch/arm/mach-mvebu/headsmp.S b/arch/arm/mach-mvebu/headsmp.S
index 3dd80df428f7..2c4032e368ba 100644
--- a/arch/arm/mach-mvebu/headsmp.S
+++ b/arch/arm/mach-mvebu/headsmp.S
@@ -31,21 +31,10 @@
31ENTRY(armada_xp_secondary_startup) 31ENTRY(armada_xp_secondary_startup)
32 ARM_BE8(setend be ) @ go BE8 if entered LE 32 ARM_BE8(setend be ) @ go BE8 if entered LE
33 33
34 /* Get coherency fabric base physical address */ 34 bl ll_add_cpu_to_smp_group
35 adr r0, 1f
36 ldr r1, [r0]
37 ldr r0, [r0, r1]
38 35
39 /* Read CPU id */ 36 bl ll_enable_coherency
40 mrc p15, 0, r1, c0, c0, 5
41 and r1, r1, #0xF
42 37
43 /* Add CPU to coherency fabric */
44 bl ll_set_cpu_coherent
45 b secondary_startup 38 b secondary_startup
46 39
47ENDPROC(armada_xp_secondary_startup) 40ENDPROC(armada_xp_secondary_startup)
48
49 .align 2
501:
51 .long coherency_phys_base - .
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
index 120207fc36f1..46f105913c84 100644
--- a/arch/arm/mach-mvebu/kirkwood.c
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -169,7 +169,7 @@ static void __init kirkwood_dt_init(void)
169{ 169{
170 kirkwood_disable_mbus_error_propagation(); 170 kirkwood_disable_mbus_error_propagation();
171 171
172 BUG_ON(mvebu_mbus_dt_init()); 172 BUG_ON(mvebu_mbus_dt_init(false));
173 173
174#ifdef CONFIG_CACHE_FEROCEON_L2 174#ifdef CONFIG_CACHE_FEROCEON_L2
175 feroceon_of_init(); 175 feroceon_of_init();
@@ -180,9 +180,6 @@ static void __init kirkwood_dt_init(void)
180 kirkwood_pm_init(); 180 kirkwood_pm_init();
181 kirkwood_dt_eth_fixup(); 181 kirkwood_dt_eth_fixup();
182 182
183 if (of_machine_is_compatible("hp,t5325"))
184 t5325_init();
185
186 of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL); 183 of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL);
187} 184}
188 185
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
index f3d4cf53f746..d0f35b4d4a23 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.c
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.c
@@ -23,6 +23,8 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/of_address.h> 25#include <linux/of_address.h>
26#include <linux/slab.h>
27#include <linux/sys_soc.h>
26#include "mvebu-soc-id.h" 28#include "mvebu-soc-id.h"
27 29
28#define PCIE_DEV_ID_OFF 0x0 30#define PCIE_DEV_ID_OFF 0x0
@@ -108,7 +110,18 @@ static int __init mvebu_soc_id_init(void)
108 iounmap(pci_base); 110 iounmap(pci_base);
109 111
110res_ioremap: 112res_ioremap:
111 clk_disable_unprepare(clk); 113 /*
114 * If the PCIe unit is actually enabled and we have PCI
115 * support in the kernel, we intentionally do not release the
116 * reference to the clock. We want to keep it running since
117 * the bootloader does some PCIe link configuration that the
118 * kernel is for now unable to do, and gating the clock would
119 * make us loose this precious configuration.
120 */
121 if (!of_device_is_available(child) || !IS_ENABLED(CONFIG_PCI_MVEBU)) {
122 clk_disable_unprepare(clk);
123 clk_put(clk);
124 }
112 125
113clk_err: 126clk_err:
114 of_node_put(child); 127 of_node_put(child);
@@ -116,5 +129,33 @@ clk_err:
116 129
117 return ret; 130 return ret;
118} 131}
119core_initcall(mvebu_soc_id_init); 132early_initcall(mvebu_soc_id_init);
133
134static int __init mvebu_soc_device(void)
135{
136 struct soc_device_attribute *soc_dev_attr;
137 struct soc_device *soc_dev;
138
139 /* Also protects against running on non-mvebu systems */
140 if (!is_id_valid)
141 return 0;
142
143 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
144 if (!soc_dev_attr)
145 return -ENOMEM;
146
147 soc_dev_attr->family = kasprintf(GFP_KERNEL, "Marvell");
148 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%X", soc_rev);
149 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%X", soc_dev_id);
120 150
151 soc_dev = soc_device_register(soc_dev_attr);
152 if (IS_ERR(soc_dev)) {
153 kfree(soc_dev_attr->family);
154 kfree(soc_dev_attr->revision);
155 kfree(soc_dev_attr->soc_id);
156 kfree(soc_dev_attr);
157 }
158
159 return 0;
160}
161postcore_initcall(mvebu_soc_device);
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.h b/arch/arm/mach-mvebu/mvebu-soc-id.h
index 31654252fe35..c16bb68ca81f 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.h
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.h
@@ -20,6 +20,10 @@
20#define MV78XX0_A0_REV 0x1 20#define MV78XX0_A0_REV 0x1
21#define MV78XX0_B0_REV 0x2 21#define MV78XX0_B0_REV 0x2
22 22
23/* Armada 375 */
24#define ARMADA_375_Z1_REV 0x0
25#define ARMADA_375_A0_REV 0x3
26
23#ifdef CONFIG_ARCH_MVEBU 27#ifdef CONFIG_ARCH_MVEBU
24int mvebu_get_soc_id(u32 *dev, u32 *rev); 28int mvebu_get_soc_id(u32 *dev, u32 *rev);
25#else 29#else
diff --git a/arch/arm/mach-mvebu/platsmp-a9.c b/arch/arm/mach-mvebu/platsmp-a9.c
new file mode 100644
index 000000000000..96c2c59e34b6
--- /dev/null
+++ b/arch/arm/mach-mvebu/platsmp-a9.c
@@ -0,0 +1,102 @@
1/*
2 * Symmetric Multi Processing (SMP) support for Marvell EBU Cortex-A9
3 * based SOCs (Armada 375/38x).
4 *
5 * Copyright (C) 2014 Marvell
6 *
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#include <linux/init.h>
16#include <linux/io.h>
17#include <linux/of.h>
18#include <linux/smp.h>
19#include <linux/mbus.h>
20#include <asm/smp_scu.h>
21#include <asm/smp_plat.h>
22#include "common.h"
23#include "mvebu-soc-id.h"
24#include "pmsu.h"
25
26#define CRYPT0_ENG_ID 41
27#define CRYPT0_ENG_ATTR 0x1
28#define SRAM_PHYS_BASE 0xFFFF0000
29
30#define BOOTROM_BASE 0xFFF00000
31#define BOOTROM_SIZE 0x100000
32
33extern unsigned char armada_375_smp_cpu1_enable_code_end;
34extern unsigned char armada_375_smp_cpu1_enable_code_start;
35
36void armada_375_smp_cpu1_enable_wa(void)
37{
38 void __iomem *sram_virt_base;
39
40 mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE);
41 mvebu_mbus_add_window_by_id(CRYPT0_ENG_ID, CRYPT0_ENG_ATTR,
42 SRAM_PHYS_BASE, SZ_64K);
43 sram_virt_base = ioremap(SRAM_PHYS_BASE, SZ_64K);
44
45 memcpy(sram_virt_base, &armada_375_smp_cpu1_enable_code_start,
46 &armada_375_smp_cpu1_enable_code_end
47 - &armada_375_smp_cpu1_enable_code_start);
48}
49
50extern void mvebu_cortex_a9_secondary_startup(void);
51
52static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
53 struct task_struct *idle)
54{
55 int ret, hw_cpu;
56
57 pr_info("Booting CPU %d\n", cpu);
58
59 /*
60 * Write the address of secondary startup into the system-wide
61 * flags register. The boot monitor waits until it receives a
62 * soft interrupt, and then the secondary CPU branches to this
63 * address.
64 */
65 hw_cpu = cpu_logical_map(cpu);
66
67 if (of_machine_is_compatible("marvell,armada375")) {
68 u32 dev, rev;
69
70 if (mvebu_get_soc_id(&dev, &rev) == 0 &&
71 rev == ARMADA_375_Z1_REV)
72 armada_375_smp_cpu1_enable_wa();
73
74 mvebu_system_controller_set_cpu_boot_addr(mvebu_cortex_a9_secondary_startup);
75 }
76 else {
77 mvebu_pmsu_set_cpu_boot_addr(hw_cpu,
78 mvebu_cortex_a9_secondary_startup);
79 }
80
81 smp_wmb();
82 ret = mvebu_cpu_reset_deassert(hw_cpu);
83 if (ret) {
84 pr_err("Could not start the secondary CPU: %d\n", ret);
85 return ret;
86 }
87 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
88
89 return 0;
90}
91
92static struct smp_operations mvebu_cortex_a9_smp_ops __initdata = {
93 .smp_boot_secondary = mvebu_cortex_a9_boot_secondary,
94#ifdef CONFIG_HOTPLUG_CPU
95 .cpu_die = armada_xp_cpu_die,
96#endif
97};
98
99CPU_METHOD_OF_DECLARE(mvebu_armada_375_smp, "marvell,armada-375-smp",
100 &mvebu_cortex_a9_smp_ops);
101CPU_METHOD_OF_DECLARE(mvebu_armada_380_smp, "marvell,armada-380-smp",
102 &mvebu_cortex_a9_smp_ops);
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index a6da03f5b24e..88b976b31719 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -70,16 +70,19 @@ static void __init set_secondary_cpus_clock(void)
70 } 70 }
71} 71}
72 72
73static void armada_xp_secondary_init(unsigned int cpu)
74{
75 armada_xp_mpic_smp_cpu_init();
76}
77
78static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle) 73static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
79{ 74{
75 int ret, hw_cpu;
76
80 pr_info("Booting CPU %d\n", cpu); 77 pr_info("Booting CPU %d\n", cpu);
81 78
82 armada_xp_boot_cpu(cpu, armada_xp_secondary_startup); 79 hw_cpu = cpu_logical_map(cpu);
80 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_xp_secondary_startup);
81 ret = mvebu_cpu_reset_deassert(hw_cpu);
82 if (ret) {
83 pr_warn("unable to boot CPU: %d\n", ret);
84 return ret;
85 }
83 86
84 return 0; 87 return 0;
85} 88}
@@ -90,8 +93,6 @@ static void __init armada_xp_smp_init_cpus(void)
90 93
91 if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS) 94 if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
92 panic("Invalid number of CPUs in DT\n"); 95 panic("Invalid number of CPUs in DT\n");
93
94 set_smp_cross_call(armada_mpic_send_doorbell);
95} 96}
96 97
97static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus) 98static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
@@ -102,7 +103,7 @@ static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
102 103
103 set_secondary_cpus_clock(); 104 set_secondary_cpus_clock();
104 flush_cache_all(); 105 flush_cache_all();
105 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); 106 set_cpu_coherent();
106 107
107 /* 108 /*
108 * In order to boot the secondary CPUs we need to ensure 109 * In order to boot the secondary CPUs we need to ensure
@@ -124,9 +125,11 @@ static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
124struct smp_operations armada_xp_smp_ops __initdata = { 125struct smp_operations armada_xp_smp_ops __initdata = {
125 .smp_init_cpus = armada_xp_smp_init_cpus, 126 .smp_init_cpus = armada_xp_smp_init_cpus,
126 .smp_prepare_cpus = armada_xp_smp_prepare_cpus, 127 .smp_prepare_cpus = armada_xp_smp_prepare_cpus,
127 .smp_secondary_init = armada_xp_secondary_init,
128 .smp_boot_secondary = armada_xp_boot_secondary, 128 .smp_boot_secondary = armada_xp_boot_secondary,
129#ifdef CONFIG_HOTPLUG_CPU 129#ifdef CONFIG_HOTPLUG_CPU
130 .cpu_die = armada_xp_cpu_die, 130 .cpu_die = armada_xp_cpu_die,
131#endif 131#endif
132}; 132};
133
134CPU_METHOD_OF_DECLARE(armada_xp_smp, "marvell,armada-xp-smp",
135 &armada_xp_smp_ops);
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index d71ef53107c4..53a55c8520bf 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -16,62 +16,283 @@
16 * other SOC units 16 * other SOC units
17 */ 17 */
18 18
19#define pr_fmt(fmt) "mvebu-pmsu: " fmt
20
21#include <linux/cpu_pm.h>
19#include <linux/kernel.h> 22#include <linux/kernel.h>
20#include <linux/init.h> 23#include <linux/init.h>
21#include <linux/of_address.h> 24#include <linux/of_address.h>
22#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/platform_device.h>
23#include <linux/smp.h> 27#include <linux/smp.h>
28#include <linux/resource.h>
29#include <asm/cacheflush.h>
30#include <asm/cp15.h>
24#include <asm/smp_plat.h> 31#include <asm/smp_plat.h>
25#include "pmsu.h" 32#include <asm/suspend.h>
33#include <asm/tlbflush.h>
34#include "common.h"
26 35
27static void __iomem *pmsu_mp_base; 36static void __iomem *pmsu_mp_base;
28static void __iomem *pmsu_reset_base;
29 37
30#define PMSU_BOOT_ADDR_REDIRECT_OFFSET(cpu) ((cpu * 0x100) + 0x24) 38#define PMSU_BASE_OFFSET 0x100
31#define PMSU_RESET_CTL_OFFSET(cpu) (cpu * 0x8) 39#define PMSU_REG_SIZE 0x1000
40
41/* PMSU MP registers */
42#define PMSU_CONTROL_AND_CONFIG(cpu) ((cpu * 0x100) + 0x104)
43#define PMSU_CONTROL_AND_CONFIG_DFS_REQ BIT(18)
44#define PMSU_CONTROL_AND_CONFIG_PWDDN_REQ BIT(16)
45#define PMSU_CONTROL_AND_CONFIG_L2_PWDDN BIT(20)
46
47#define PMSU_CPU_POWER_DOWN_CONTROL(cpu) ((cpu * 0x100) + 0x108)
48
49#define PMSU_CPU_POWER_DOWN_DIS_SNP_Q_SKIP BIT(0)
50
51#define PMSU_STATUS_AND_MASK(cpu) ((cpu * 0x100) + 0x10c)
52#define PMSU_STATUS_AND_MASK_CPU_IDLE_WAIT BIT(16)
53#define PMSU_STATUS_AND_MASK_SNP_Q_EMPTY_WAIT BIT(17)
54#define PMSU_STATUS_AND_MASK_IRQ_WAKEUP BIT(20)
55#define PMSU_STATUS_AND_MASK_FIQ_WAKEUP BIT(21)
56#define PMSU_STATUS_AND_MASK_DBG_WAKEUP BIT(22)
57#define PMSU_STATUS_AND_MASK_IRQ_MASK BIT(24)
58#define PMSU_STATUS_AND_MASK_FIQ_MASK BIT(25)
59
60#define PMSU_BOOT_ADDR_REDIRECT_OFFSET(cpu) ((cpu * 0x100) + 0x124)
61
62/* PMSU fabric registers */
63#define L2C_NFABRIC_PM_CTL 0x4
64#define L2C_NFABRIC_PM_CTL_PWR_DOWN BIT(20)
65
66extern void ll_disable_coherency(void);
67extern void ll_enable_coherency(void);
68
69static struct platform_device armada_xp_cpuidle_device = {
70 .name = "cpuidle-armada-370-xp",
71};
32 72
33static struct of_device_id of_pmsu_table[] = { 73static struct of_device_id of_pmsu_table[] = {
34 {.compatible = "marvell,armada-370-xp-pmsu"}, 74 { .compatible = "marvell,armada-370-pmsu", },
75 { .compatible = "marvell,armada-370-xp-pmsu", },
76 { .compatible = "marvell,armada-380-pmsu", },
35 { /* end of list */ }, 77 { /* end of list */ },
36}; 78};
37 79
38#ifdef CONFIG_SMP 80void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
39int armada_xp_boot_cpu(unsigned int cpu_id, void *boot_addr)
40{ 81{
41 int reg, hw_cpu; 82 writel(virt_to_phys(boot_addr), pmsu_mp_base +
83 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu));
84}
85
86static int __init armada_370_xp_pmsu_init(void)
87{
88 struct device_node *np;
89 struct resource res;
90 int ret = 0;
91
92 np = of_find_matching_node(NULL, of_pmsu_table);
93 if (!np)
94 return 0;
95
96 pr_info("Initializing Power Management Service Unit\n");
42 97
43 if (!pmsu_mp_base || !pmsu_reset_base) { 98 if (of_address_to_resource(np, 0, &res)) {
44 pr_warn("Can't boot CPU. PMSU is uninitialized\n"); 99 pr_err("unable to get resource\n");
45 return 1; 100 ret = -ENOENT;
101 goto out;
46 } 102 }
47 103
48 hw_cpu = cpu_logical_map(cpu_id); 104 if (of_device_is_compatible(np, "marvell,armada-370-xp-pmsu")) {
105 pr_warn(FW_WARN "deprecated pmsu binding\n");
106 res.start = res.start - PMSU_BASE_OFFSET;
107 res.end = res.start + PMSU_REG_SIZE - 1;
108 }
49 109
50 writel(virt_to_phys(boot_addr), pmsu_mp_base + 110 if (!request_mem_region(res.start, resource_size(&res),
51 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); 111 np->full_name)) {
112 pr_err("unable to request region\n");
113 ret = -EBUSY;
114 goto out;
115 }
116
117 pmsu_mp_base = ioremap(res.start, resource_size(&res));
118 if (!pmsu_mp_base) {
119 pr_err("unable to map registers\n");
120 release_mem_region(res.start, resource_size(&res));
121 ret = -ENOMEM;
122 goto out;
123 }
124
125 out:
126 of_node_put(np);
127 return ret;
128}
129
130static void armada_370_xp_pmsu_enable_l2_powerdown_onidle(void)
131{
132 u32 reg;
133
134 if (pmsu_mp_base == NULL)
135 return;
136
137 /* Enable L2 & Fabric powerdown in Deep-Idle mode - Fabric */
138 reg = readl(pmsu_mp_base + L2C_NFABRIC_PM_CTL);
139 reg |= L2C_NFABRIC_PM_CTL_PWR_DOWN;
140 writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL);
141}
142
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 */
151void armada_370_xp_pmsu_idle_prepare(bool deepidle)
152{
153 unsigned int hw_cpu = cpu_logical_map(smp_processor_id());
154 u32 reg;
155
156 if (pmsu_mp_base == NULL)
157 return;
52 158
53 /* Release CPU from reset by clearing reset bit*/ 159 /*
54 reg = readl(pmsu_reset_base + PMSU_RESET_CTL_OFFSET(hw_cpu)); 160 * Adjust the PMSU configuration to wait for WFI signal, enable
55 reg &= (~0x1); 161 * IRQ and FIQ as wakeup events, set wait for snoop queue empty
56 writel(reg, pmsu_reset_base + PMSU_RESET_CTL_OFFSET(hw_cpu)); 162 * indication and mask IRQ and FIQ from CPU
163 */
164 reg = readl(pmsu_mp_base + PMSU_STATUS_AND_MASK(hw_cpu));
165 reg |= PMSU_STATUS_AND_MASK_CPU_IDLE_WAIT |
166 PMSU_STATUS_AND_MASK_IRQ_WAKEUP |
167 PMSU_STATUS_AND_MASK_FIQ_WAKEUP |
168 PMSU_STATUS_AND_MASK_SNP_Q_EMPTY_WAIT |
169 PMSU_STATUS_AND_MASK_IRQ_MASK |
170 PMSU_STATUS_AND_MASK_FIQ_MASK;
171 writel(reg, pmsu_mp_base + PMSU_STATUS_AND_MASK(hw_cpu));
172
173 reg = readl(pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu));
174 /* ask HW to power down the L2 Cache if needed */
175 if (deepidle)
176 reg |= PMSU_CONTROL_AND_CONFIG_L2_PWDDN;
177
178 /* request power down */
179 reg |= PMSU_CONTROL_AND_CONFIG_PWDDN_REQ;
180 writel(reg, pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu));
181
182 /* Disable snoop disable by HW - SW is taking care of it */
183 reg = readl(pmsu_mp_base + PMSU_CPU_POWER_DOWN_CONTROL(hw_cpu));
184 reg |= PMSU_CPU_POWER_DOWN_DIS_SNP_Q_SKIP;
185 writel(reg, pmsu_mp_base + PMSU_CPU_POWER_DOWN_CONTROL(hw_cpu));
186}
187
188static noinline int do_armada_370_xp_cpu_suspend(unsigned long deepidle)
189{
190 armada_370_xp_pmsu_idle_prepare(deepidle);
191
192 v7_exit_coherency_flush(all);
193
194 ll_disable_coherency();
195
196 dsb();
197
198 wfi();
199
200 /* If we are here, wfi failed. As processors run out of
201 * coherency for some time, tlbs might be stale, so flush them
202 */
203 local_flush_tlb_all();
204
205 ll_enable_coherency();
206
207 /* Test the CR_C bit and set it if it was cleared */
208 asm volatile(
209 "mrc p15, 0, %0, c1, c0, 0 \n\t"
210 "tst %0, #(1 << 2) \n\t"
211 "orreq %0, %0, #(1 << 2) \n\t"
212 "mcreq p15, 0, %0, c1, c0, 0 \n\t"
213 "isb "
214 : : "r" (0));
215
216 pr_warn("Failed to suspend the system\n");
57 217
58 return 0; 218 return 0;
59} 219}
60#endif
61 220
62static int __init armada_370_xp_pmsu_init(void) 221static int armada_370_xp_cpu_suspend(unsigned long deepidle)
222{
223 return cpu_suspend(deepidle, do_armada_370_xp_cpu_suspend);
224}
225
226/* No locking is needed because we only access per-CPU registers */
227static noinline void armada_370_xp_pmsu_idle_restore(void)
228{
229 unsigned int hw_cpu = cpu_logical_map(smp_processor_id());
230 u32 reg;
231
232 if (pmsu_mp_base == NULL)
233 return;
234
235 /* cancel ask HW to power down the L2 Cache if possible */
236 reg = readl(pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu));
237 reg &= ~PMSU_CONTROL_AND_CONFIG_L2_PWDDN;
238 writel(reg, pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu));
239
240 /* cancel Enable wakeup events and mask interrupts */
241 reg = readl(pmsu_mp_base + PMSU_STATUS_AND_MASK(hw_cpu));
242 reg &= ~(PMSU_STATUS_AND_MASK_IRQ_WAKEUP | PMSU_STATUS_AND_MASK_FIQ_WAKEUP);
243 reg &= ~PMSU_STATUS_AND_MASK_CPU_IDLE_WAIT;
244 reg &= ~PMSU_STATUS_AND_MASK_SNP_Q_EMPTY_WAIT;
245 reg &= ~(PMSU_STATUS_AND_MASK_IRQ_MASK | PMSU_STATUS_AND_MASK_FIQ_MASK);
246 writel(reg, pmsu_mp_base + PMSU_STATUS_AND_MASK(hw_cpu));
247}
248
249static int armada_370_xp_cpu_pm_notify(struct notifier_block *self,
250 unsigned long action, void *hcpu)
251{
252 if (action == CPU_PM_ENTER) {
253 unsigned int hw_cpu = cpu_logical_map(smp_processor_id());
254 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_370_xp_cpu_resume);
255 } else if (action == CPU_PM_EXIT) {
256 armada_370_xp_pmsu_idle_restore();
257 }
258
259 return NOTIFY_OK;
260}
261
262static struct notifier_block armada_370_xp_cpu_pm_notifier = {
263 .notifier_call = armada_370_xp_cpu_pm_notify,
264};
265
266int __init armada_370_xp_cpu_pm_init(void)
63{ 267{
64 struct device_node *np; 268 struct device_node *np;
65 269
270 /*
271 * Check that all the requirements are available to enable
272 * cpuidle. So far, it is only supported on Armada XP, cpuidle
273 * needs the coherency fabric and the PMSU enabled
274 */
275
276 if (!of_machine_is_compatible("marvell,armadaxp"))
277 return 0;
278
279 np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
280 if (!np)
281 return 0;
282 of_node_put(np);
283
66 np = of_find_matching_node(NULL, of_pmsu_table); 284 np = of_find_matching_node(NULL, of_pmsu_table);
67 if (np) { 285 if (!np)
68 pr_info("Initializing Power Management Service Unit\n"); 286 return 0;
69 pmsu_mp_base = of_iomap(np, 0); 287 of_node_put(np);
70 pmsu_reset_base = of_iomap(np, 1); 288
71 of_node_put(np); 289 armada_370_xp_pmsu_enable_l2_powerdown_onidle();
72 } 290 armada_xp_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend;
291 platform_device_register(&armada_xp_cpuidle_device);
292 cpu_pm_register_notifier(&armada_370_xp_cpu_pm_notifier);
73 293
74 return 0; 294 return 0;
75} 295}
76 296
297arch_initcall(armada_370_xp_cpu_pm_init);
77early_initcall(armada_370_xp_pmsu_init); 298early_initcall(armada_370_xp_pmsu_init);
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index 614ba6832ff3..0c5524ac75b7 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -37,6 +37,8 @@ struct mvebu_system_controller {
37 37
38 u32 rstoutn_mask_reset_out_en; 38 u32 rstoutn_mask_reset_out_en;
39 u32 system_soft_reset; 39 u32 system_soft_reset;
40
41 u32 resume_boot_addr;
40}; 42};
41static struct mvebu_system_controller *mvebu_sc; 43static struct mvebu_system_controller *mvebu_sc;
42 44
@@ -52,6 +54,7 @@ static const struct mvebu_system_controller armada_375_system_controller = {
52 .system_soft_reset_offset = 0x58, 54 .system_soft_reset_offset = 0x58,
53 .rstoutn_mask_reset_out_en = 0x1, 55 .rstoutn_mask_reset_out_en = 0x1,
54 .system_soft_reset = 0x1, 56 .system_soft_reset = 0x1,
57 .resume_boot_addr = 0xd4,
55}; 58};
56 59
57static const struct mvebu_system_controller orion_system_controller = { 60static const struct mvebu_system_controller orion_system_controller = {
@@ -98,6 +101,16 @@ void mvebu_restart(enum reboot_mode mode, const char *cmd)
98 ; 101 ;
99} 102}
100 103
104#ifdef CONFIG_SMP
105void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr)
106{
107 BUG_ON(system_controller_base == NULL);
108 BUG_ON(mvebu_sc->resume_boot_addr == 0);
109 writel(virt_to_phys(boot_addr), system_controller_base +
110 mvebu_sc->resume_boot_addr);
111}
112#endif
113
101static int __init mvebu_system_controller_init(void) 114static int __init mvebu_system_controller_init(void)
102{ 115{
103 const struct of_device_id *match; 116 const struct of_device_id *match;
@@ -114,4 +127,4 @@ static int __init mvebu_system_controller_init(void)
114 return 0; 127 return 0;
115} 128}
116 129
117arch_initcall(mvebu_system_controller_init); 130early_initcall(mvebu_system_controller_init);
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 65d2acb31498..5b45d266d83e 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -346,7 +346,7 @@ static struct omap_usb_config h2_usb_config __initdata = {
346 /* usb1 has a Mini-AB port and external isp1301 transceiver */ 346 /* usb1 has a Mini-AB port and external isp1301 transceiver */
347 .otg = 2, 347 .otg = 2,
348 348
349#ifdef CONFIG_USB_GADGET_OMAP 349#if IS_ENABLED(CONFIG_USB_OMAP)
350 .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */ 350 .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */
351 /* .hmc_mode = 21,*/ /* 0:host(off) 1:dev(loopback) 2:host(loopback) */ 351 /* .hmc_mode = 21,*/ /* 0:host(off) 1:dev(loopback) 2:host(loopback) */
352#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 352#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 816ecd13f81e..bfed4f928663 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -366,7 +366,7 @@ static struct omap_usb_config h3_usb_config __initdata = {
366 /* usb1 has a Mini-AB port and external isp1301 transceiver */ 366 /* usb1 has a Mini-AB port and external isp1301 transceiver */
367 .otg = 2, 367 .otg = 2,
368 368
369#ifdef CONFIG_USB_GADGET_OMAP 369#if IS_ENABLED(CONFIG_USB_OMAP)
370 .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */ 370 .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */
371#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 371#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
372 /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */ 372 /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index bd5f02e9c354..c49ce83cc1eb 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -312,7 +312,7 @@ static struct omap_usb_config h2_usb_config __initdata = {
312 /* usb1 has a Mini-AB port and external isp1301 transceiver */ 312 /* usb1 has a Mini-AB port and external isp1301 transceiver */
313 .otg = 2, 313 .otg = 2,
314 314
315#ifdef CONFIG_USB_GADGET_OMAP 315#if IS_ENABLED(CONFIG_USB_OMAP)
316 .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */ 316 .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */
317 /* .hmc_mode = 21,*/ /* 0:host(off) 1:dev(loopback) 2:host(loopback) */ 317 /* .hmc_mode = 21,*/ /* 0:host(off) 1:dev(loopback) 2:host(loopback) */
318#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 318#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 3a0262156e93..7436d4cf6596 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -283,7 +283,7 @@ static struct omap_usb_config osk_usb_config __initdata = {
283 * be used, with a NONSTANDARD gender-bending cable/dongle, as 283 * be used, with a NONSTANDARD gender-bending cable/dongle, as
284 * a peripheral. 284 * a peripheral.
285 */ 285 */
286#ifdef CONFIG_USB_GADGET_OMAP 286#if IS_ENABLED(CONFIG_USB_OMAP)
287 .register_dev = 1, 287 .register_dev = 1,
288 .hmc_mode = 0, 288 .hmc_mode = 0,
289#else 289#else
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 0a8d3349149c..29e526235dc2 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -266,31 +266,6 @@ static struct physmap_flash_data sx1_flash_data = {
266 .nr_parts = ARRAY_SIZE(sx1_partitions), 266 .nr_parts = ARRAY_SIZE(sx1_partitions),
267}; 267};
268 268
269#ifdef CONFIG_SX1_OLD_FLASH
270/* MTD Intel StrataFlash - old flashes */
271static struct resource sx1_old_flash_resource[] = {
272 [0] = {
273 .start = OMAP_CS0_PHYS, /* Physical */
274 .end = OMAP_CS0_PHYS + SZ_16M - 1,,
275 .flags = IORESOURCE_MEM,
276 },
277 [1] = {
278 .start = OMAP_CS1_PHYS,
279 .end = OMAP_CS1_PHYS + SZ_8M - 1,
280 .flags = IORESOURCE_MEM,
281 },
282};
283
284static struct platform_device sx1_flash_device = {
285 .name = "physmap-flash",
286 .id = 0,
287 .dev = {
288 .platform_data = &sx1_flash_data,
289 },
290 .num_resources = 2,
291 .resource = &sx1_old_flash_resource,
292};
293#else
294/* MTD Intel 4000 flash - new flashes */ 269/* MTD Intel 4000 flash - new flashes */
295static struct resource sx1_new_flash_resource = { 270static struct resource sx1_new_flash_resource = {
296 .start = OMAP_CS0_PHYS, 271 .start = OMAP_CS0_PHYS,
@@ -307,7 +282,6 @@ static struct platform_device sx1_flash_device = {
307 .num_resources = 1, 282 .num_resources = 1,
308 .resource = &sx1_new_flash_resource, 283 .resource = &sx1_new_flash_resource,
309}; 284};
310#endif
311 285
312/*----------- USB -------------------------*/ 286/*----------- USB -------------------------*/
313 287
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index dbee729e3b6d..34b4c0044961 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -123,19 +123,8 @@ void omap1_pm_idle(void)
123#warning Enable 32kHz OS timer in order to allow sleep states in idle 123#warning Enable 32kHz OS timer in order to allow sleep states in idle
124 use_idlect1 = use_idlect1 & ~(1 << 9); 124 use_idlect1 = use_idlect1 & ~(1 << 9);
125#else 125#else
126 126 if (enable_dyn_sleep)
127 while (enable_dyn_sleep) {
128
129#ifdef CONFIG_CBUS_TAHVO_USB
130 extern int vbus_active;
131 /* Clock requirements? */
132 if (vbus_active)
133 break;
134#endif
135 do_sleep = 1; 127 do_sleep = 1;
136 break;
137 }
138
139#endif 128#endif
140 129
141#ifdef CONFIG_OMAP_DM_TIMER 130#ifdef CONFIG_OMAP_DM_TIMER
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 543d9a882de3..4f9383cecf76 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -262,12 +262,7 @@ static struct usbhs_phy_data phy_data[] __initdata = {
262 262
263static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 263static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
264 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 264 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
265#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
266 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
267 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
268#else
269 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 265 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
270#endif
271}; 266};
272 267
273#ifdef CONFIG_OMAP_MUX 268#ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index ac82512b9c8c..e87f2a83d6bf 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
142 board_nand_data.nr_parts = nr_parts; 142 board_nand_data.nr_parts = nr_parts;
143 board_nand_data.devsize = nand_type; 143 board_nand_data.devsize = nand_type;
144 144
145 board_nand_data.ecc_opt = OMAP_ECC_BCH8_CODE_HW; 145 board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_HW;
146 gpmc_nand_init(&board_nand_data, gpmc_t); 146 gpmc_nand_init(&board_nand_data, gpmc_t);
147} 147}
148#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ 148#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
@@ -160,13 +160,13 @@ static u8 get_gpmc0_type(void)
160 if (!fpga_map_addr) 160 if (!fpga_map_addr)
161 return -ENOMEM; 161 return -ENOMEM;
162 162
163 if (!(__raw_readw(fpga_map_addr + REG_FPGA_REV))) 163 if (!(readw_relaxed(fpga_map_addr + REG_FPGA_REV)))
164 /* we dont have an DEBUG FPGA??? */ 164 /* we dont have an DEBUG FPGA??? */
165 /* Depend on #defines!! default to strata boot return param */ 165 /* Depend on #defines!! default to strata boot return param */
166 goto unmap; 166 goto unmap;
167 167
168 /* S8-DIP-OFF = 1, S8-DIP-ON = 0 */ 168 /* S8-DIP-OFF = 1, S8-DIP-ON = 0 */
169 cs = __raw_readw(fpga_map_addr + REG_FPGA_DIP_SWITCH_INPUT2) & 0xf; 169 cs = readw_relaxed(fpga_map_addr + REG_FPGA_DIP_SWITCH_INPUT2) & 0xf;
170 170
171 /* ES2.0 SDP's onwards 4 dip switches are provided for CS */ 171 /* ES2.0 SDP's onwards 4 dip switches are provided for CS */
172 if (omap_rev() >= OMAP3430_REV_ES1_0) 172 if (omap_rev() >= OMAP3430_REV_ES1_0)
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 119efaf5808a..a2e035e0792a 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -121,11 +121,7 @@ static struct platform_device omap3stalker_tfp410_device = {
121static struct connector_atv_platform_data omap3stalker_tv_pdata = { 121static struct connector_atv_platform_data omap3stalker_tv_pdata = {
122 .name = "tv", 122 .name = "tv",
123 .source = "venc.0", 123 .source = "venc.0",
124#if defined(CONFIG_OMAP2_VENC_OUT_TYPE_SVIDEO)
125 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
126#elif defined(CONFIG_OMAP2_VENC_OUT_TYPE_COMPOSITE)
127 .connector_type = OMAP_DSS_VENC_TYPE_COMPOSITE, 124 .connector_type = OMAP_DSS_VENC_TYPE_COMPOSITE,
128#endif
129 .invert_polarity = false, 125 .invert_polarity = false,
130}; 126};
131 127
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index 8f5121b89688..eb8c75ec3b1a 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -456,7 +456,8 @@ static struct clk_hw_omap dpll4_m5x2_ck_hw = {
456 .clkdm_name = "dpll4_clkdm", 456 .clkdm_name = "dpll4_clkdm",
457}; 457};
458 458
459DEFINE_STRUCT_CLK(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names, dpll4_m5x2_ck_ops); 459DEFINE_STRUCT_CLK_FLAGS(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names,
460 dpll4_m5x2_ck_ops, CLK_SET_RATE_PARENT);
460 461
461static struct clk dpll4_m5x2_ck_3630 = { 462static struct clk dpll4_m5x2_ck_3630 = {
462 .name = "dpll4_m5x2_ck", 463 .name = "dpll4_m5x2_ck",
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 3ff32543493c..59cf310bc1e9 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -138,7 +138,7 @@ int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
138 if (!dd) 138 if (!dd)
139 return -EINVAL; 139 return -EINVAL;
140 140
141 tmpset.cm_clksel1_pll = __raw_readl(dd->mult_div1_reg); 141 tmpset.cm_clksel1_pll = readl_relaxed(dd->mult_div1_reg);
142 tmpset.cm_clksel1_pll &= ~(dd->mult_mask | 142 tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
143 dd->div1_mask); 143 dd->div1_mask);
144 div = ((curr_prcm_set->xtal_speed / 1000000) - 1); 144 div = ((curr_prcm_set->xtal_speed / 1000000) - 1);
diff --git a/arch/arm/mach-omap2/clkt2xxx_osc.c b/arch/arm/mach-omap2/clkt2xxx_osc.c
index 19f54d433490..0717dff1bc04 100644
--- a/arch/arm/mach-omap2/clkt2xxx_osc.c
+++ b/arch/arm/mach-omap2/clkt2xxx_osc.c
@@ -39,9 +39,9 @@ int omap2_enable_osc_ck(struct clk_hw *clk)
39{ 39{
40 u32 pcc; 40 u32 pcc;
41 41
42 pcc = __raw_readl(prcm_clksrc_ctrl); 42 pcc = readl_relaxed(prcm_clksrc_ctrl);
43 43
44 __raw_writel(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl); 44 writel_relaxed(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
45 45
46 return 0; 46 return 0;
47} 47}
@@ -57,9 +57,9 @@ void omap2_disable_osc_ck(struct clk_hw *clk)
57{ 57{
58 u32 pcc; 58 u32 pcc;
59 59
60 pcc = __raw_readl(prcm_clksrc_ctrl); 60 pcc = readl_relaxed(prcm_clksrc_ctrl);
61 61
62 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl); 62 writel_relaxed(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
63} 63}
64 64
65unsigned long omap2_osc_clk_recalc(struct clk_hw *clk, 65unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
diff --git a/arch/arm/mach-omap2/clkt2xxx_sys.c b/arch/arm/mach-omap2/clkt2xxx_sys.c
index f467d072cd02..58dd3a9b726c 100644
--- a/arch/arm/mach-omap2/clkt2xxx_sys.c
+++ b/arch/arm/mach-omap2/clkt2xxx_sys.c
@@ -33,7 +33,7 @@ u32 omap2xxx_get_sysclkdiv(void)
33{ 33{
34 u32 div; 34 u32 div;
35 35
36 div = __raw_readl(prcm_clksrc_ctrl); 36 div = readl_relaxed(prcm_clksrc_ctrl);
37 div &= OMAP_SYSCLKDIV_MASK; 37 div &= OMAP_SYSCLKDIV_MASK;
38 div >>= OMAP_SYSCLKDIV_SHIFT; 38 div >>= OMAP_SYSCLKDIV_SHIFT;
39 39
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index f17f00697cc0..82c37b1becc4 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -18,7 +18,6 @@
18 18
19#include "powerdomain.h" 19#include "powerdomain.h"
20#include "clock.h" 20#include "clock.h"
21#include "omap_hwmod.h"
22 21
23/* 22/*
24 * Clockdomain flags 23 * Clockdomain flags
@@ -98,6 +97,8 @@ struct clkdm_dep {
98/* Possible flags for struct clockdomain._flags */ 97/* Possible flags for struct clockdomain._flags */
99#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0) 98#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0)
100 99
100struct omap_hwmod;
101
101/** 102/**
102 * struct clockdomain - OMAP clockdomain 103 * struct clockdomain - OMAP clockdomain
103 * @name: clockdomain name 104 * @name: clockdomain name
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index ce25abbcffae..8be6ea50c092 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -18,9 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx.h" 21#include "prm2xxx.h"
25#include "cm.h" 22#include "cm.h"
26#include "cm2xxx.h" 23#include "cm2xxx.h"
@@ -390,7 +387,7 @@ void omap2xxx_cm_set_mod_dividers(u32 mpu, u32 dsp, u32 gfx, u32 core, u32 mdm)
390 tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & 387 tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) &
391 OMAP24XX_CLKSEL_DSS2_MASK; 388 OMAP24XX_CLKSEL_DSS2_MASK;
392 omap2_cm_write_mod_reg(core | tmp, CORE_MOD, CM_CLKSEL1); 389 omap2_cm_write_mod_reg(core | tmp, CORE_MOD, CM_CLKSEL1);
393 if (cpu_is_omap2430()) 390 if (mdm)
394 omap2_cm_write_mod_reg(mdm, OMAP2430_MDM_MOD, CM_CLKSEL); 391 omap2_cm_write_mod_reg(mdm, OMAP2430_MDM_MOD, CM_CLKSEL);
395} 392}
396 393
@@ -405,19 +402,11 @@ static struct cm_ll_data omap2xxx_cm_ll_data = {
405 402
406int __init omap2xxx_cm_init(void) 403int __init omap2xxx_cm_init(void)
407{ 404{
408 if (!cpu_is_omap24xx())
409 return 0;
410
411 return cm_register(&omap2xxx_cm_ll_data); 405 return cm_register(&omap2xxx_cm_ll_data);
412} 406}
413 407
414static void __exit omap2xxx_cm_exit(void) 408static void __exit omap2xxx_cm_exit(void)
415{ 409{
416 if (!cpu_is_omap24xx()) 410 cm_unregister(&omap2xxx_cm_ll_data);
417 return;
418
419 /* Should never happen */
420 WARN(cm_unregister(&omap2xxx_cm_ll_data),
421 "%s: cm_ll_data function pointer mismatch\n", __func__);
422} 411}
423__exitcall(omap2xxx_cm_exit); 412__exitcall(omap2xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h
index bfbd16fe9151..72928a3ce2aa 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h
@@ -52,12 +52,12 @@
52 52
53static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx) 53static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
54{ 54{
55 return __raw_readl(cm_base + module + idx); 55 return readl_relaxed(cm_base + module + idx);
56} 56}
57 57
58static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx) 58static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
59{ 59{
60 __raw_writel(val, cm_base + module + idx); 60 writel_relaxed(val, cm_base + module + idx);
61} 61}
62 62
63/* Read-modify-write a register in a CM module. Caller must lock */ 63/* Read-modify-write a register in a CM module. Caller must lock */
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 40a22e5649ae..b3f99e93def0 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -50,13 +50,13 @@
50/* Read a register in a CM instance */ 50/* Read a register in a CM instance */
51static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx) 51static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
52{ 52{
53 return __raw_readl(cm_base + inst + idx); 53 return readl_relaxed(cm_base + inst + idx);
54} 54}
55 55
56/* Write into a register in a CM */ 56/* Write into a register in a CM */
57static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx) 57static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
58{ 58{
59 __raw_writel(val, cm_base + inst + idx); 59 writel_relaxed(val, cm_base + inst + idx);
60} 60}
61 61
62/* Read-modify-write a register in CM */ 62/* Read-modify-write a register in CM */
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index cfb8891b0c0e..15a778ce7707 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -17,11 +17,8 @@
17#ifndef __ARCH_ARM_MACH_OMAP2_CM_33XX_H 17#ifndef __ARCH_ARM_MACH_OMAP2_CM_33XX_H
18#define __ARCH_ARM_MACH_OMAP2_CM_33XX_H 18#define __ARCH_ARM_MACH_OMAP2_CM_33XX_H
19 19
20#include "common.h"
21
22#include "cm.h" 20#include "cm.h"
23#include "cm-regbits-33xx.h" 21#include "cm-regbits-33xx.h"
24#include "iomap.h"
25 22
26/* CM base address */ 23/* CM base address */
27#define AM33XX_CM_BASE 0x44e00000 24#define AM33XX_CM_BASE 0x44e00000
diff --git a/arch/arm/mach-omap2/cm3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index f6f028867bfe..129a4e7f6ef5 100644
--- a/arch/arm/mach-omap2/cm3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -18,9 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx_3xxx.h" 21#include "prm2xxx_3xxx.h"
25#include "cm.h" 22#include "cm.h"
26#include "cm3xxx.h" 23#include "cm3xxx.h"
@@ -388,7 +385,8 @@ void omap3_cm_save_context(void)
388 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL1); 385 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL1);
389 cm_context.iva2_cm_clksel2 = 386 cm_context.iva2_cm_clksel2 =
390 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2); 387 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2);
391 cm_context.cm_sysconfig = __raw_readl(OMAP3430_CM_SYSCONFIG); 388 cm_context.cm_sysconfig =
389 omap2_cm_read_mod_reg(OCP_MOD, OMAP3430_CM_SYSCONFIG);
392 cm_context.sgx_cm_clksel = 390 cm_context.sgx_cm_clksel =
393 omap2_cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL); 391 omap2_cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);
394 cm_context.dss_cm_clksel = 392 cm_context.dss_cm_clksel =
@@ -418,7 +416,8 @@ void omap3_cm_save_context(void)
418 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5); 416 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
419 cm_context.pll_cm_clken2 = 417 cm_context.pll_cm_clken2 =
420 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKEN2); 418 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKEN2);
421 cm_context.cm_polctrl = __raw_readl(OMAP3430_CM_POLCTRL); 419 cm_context.cm_polctrl =
420 omap2_cm_read_mod_reg(OCP_MOD, OMAP3430_CM_POLCTRL);
422 cm_context.iva2_cm_fclken = 421 cm_context.iva2_cm_fclken =
423 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN); 422 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);
424 cm_context.iva2_cm_clken_pll = 423 cm_context.iva2_cm_clken_pll =
@@ -519,7 +518,8 @@ void omap3_cm_restore_context(void)
519 CM_CLKSEL1); 518 CM_CLKSEL1);
520 omap2_cm_write_mod_reg(cm_context.iva2_cm_clksel2, OMAP3430_IVA2_MOD, 519 omap2_cm_write_mod_reg(cm_context.iva2_cm_clksel2, OMAP3430_IVA2_MOD,
521 CM_CLKSEL2); 520 CM_CLKSEL2);
522 __raw_writel(cm_context.cm_sysconfig, OMAP3430_CM_SYSCONFIG); 521 omap2_cm_write_mod_reg(cm_context.cm_sysconfig, OCP_MOD,
522 OMAP3430_CM_SYSCONFIG);
523 omap2_cm_write_mod_reg(cm_context.sgx_cm_clksel, OMAP3430ES2_SGX_MOD, 523 omap2_cm_write_mod_reg(cm_context.sgx_cm_clksel, OMAP3430ES2_SGX_MOD,
524 CM_CLKSEL); 524 CM_CLKSEL);
525 omap2_cm_write_mod_reg(cm_context.dss_cm_clksel, OMAP3430_DSS_MOD, 525 omap2_cm_write_mod_reg(cm_context.dss_cm_clksel, OMAP3430_DSS_MOD,
@@ -547,7 +547,8 @@ void omap3_cm_restore_context(void)
547 OMAP3430ES2_CM_CLKSEL5); 547 OMAP3430ES2_CM_CLKSEL5);
548 omap2_cm_write_mod_reg(cm_context.pll_cm_clken2, PLL_MOD, 548 omap2_cm_write_mod_reg(cm_context.pll_cm_clken2, PLL_MOD,
549 OMAP3430ES2_CM_CLKEN2); 549 OMAP3430ES2_CM_CLKEN2);
550 __raw_writel(cm_context.cm_polctrl, OMAP3430_CM_POLCTRL); 550 omap2_cm_write_mod_reg(cm_context.cm_polctrl, OCP_MOD,
551 OMAP3430_CM_POLCTRL);
551 omap2_cm_write_mod_reg(cm_context.iva2_cm_fclken, OMAP3430_IVA2_MOD, 552 omap2_cm_write_mod_reg(cm_context.iva2_cm_fclken, OMAP3430_IVA2_MOD,
552 CM_FCLKEN); 553 CM_FCLKEN);
553 omap2_cm_write_mod_reg(cm_context.iva2_cm_clken_pll, OMAP3430_IVA2_MOD, 554 omap2_cm_write_mod_reg(cm_context.iva2_cm_clken_pll, OMAP3430_IVA2_MOD,
@@ -669,19 +670,11 @@ static struct cm_ll_data omap3xxx_cm_ll_data = {
669 670
670int __init omap3xxx_cm_init(void) 671int __init omap3xxx_cm_init(void)
671{ 672{
672 if (!cpu_is_omap34xx())
673 return 0;
674
675 return cm_register(&omap3xxx_cm_ll_data); 673 return cm_register(&omap3xxx_cm_ll_data);
676} 674}
677 675
678static void __exit omap3xxx_cm_exit(void) 676static void __exit omap3xxx_cm_exit(void)
679{ 677{
680 if (!cpu_is_omap34xx()) 678 cm_unregister(&omap3xxx_cm_ll_data);
681 return;
682
683 /* Should never happen */
684 WARN(cm_unregister(&omap3xxx_cm_ll_data),
685 "%s: cm_ll_data function pointer mismatch\n", __func__);
686} 679}
687__exitcall(omap3xxx_cm_exit); 680__exitcall(omap3xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
index 8224c91b4d7a..7a16b5598127 100644
--- a/arch/arm/mach-omap2/cm3xxx.h
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -29,9 +29,8 @@
29 * These registers appear once per CM module. 29 * These registers appear once per CM module.
30 */ 30 */
31 31
32#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000) 32#define OMAP3430_CM_SYSCONFIG 0x0010
33#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010) 33#define OMAP3430_CM_POLCTRL 0x009c
34#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
35 34
36#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070 35#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
37#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) 36#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
diff --git a/arch/arm/mach-omap2/cm44xx.c b/arch/arm/mach-omap2/cm44xx.c
index 535d66e2822c..fe5cc7bae489 100644
--- a/arch/arm/mach-omap2/cm44xx.c
+++ b/arch/arm/mach-omap2/cm44xx.c
@@ -18,35 +18,32 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "iomap.h"
22#include "common.h"
23#include "cm.h" 21#include "cm.h"
24#include "cm1_44xx.h" 22#include "cm1_44xx.h"
25#include "cm2_44xx.h" 23#include "cm2_44xx.h"
26#include "cm-regbits-44xx.h"
27 24
28/* CM1 hardware module low-level functions */ 25/* CM1 hardware module low-level functions */
29 26
30/* Read a register in CM1 */ 27/* Read a register in CM1 */
31u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg) 28u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg)
32{ 29{
33 return __raw_readl(OMAP44XX_CM1_REGADDR(inst, reg)); 30 return readl_relaxed(cm_base + inst + reg);
34} 31}
35 32
36/* Write into a register in CM1 */ 33/* Write into a register in CM1 */
37void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg) 34void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg)
38{ 35{
39 __raw_writel(val, OMAP44XX_CM1_REGADDR(inst, reg)); 36 writel_relaxed(val, cm_base + inst + reg);
40} 37}
41 38
42/* Read a register in CM2 */ 39/* Read a register in CM2 */
43u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg) 40u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg)
44{ 41{
45 return __raw_readl(OMAP44XX_CM2_REGADDR(inst, reg)); 42 return readl_relaxed(cm2_base + inst + reg);
46} 43}
47 44
48/* Write into a register in CM2 */ 45/* Write into a register in CM2 */
49void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg) 46void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg)
50{ 47{
51 __raw_writel(val, OMAP44XX_CM2_REGADDR(inst, reg)); 48 writel_relaxed(val, cm2_base + inst + reg);
52} 49}
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 40b3b5a84458..8f6c4710877e 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -14,11 +14,11 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/bug.h>
17 18
18#include "cm2xxx.h" 19#include "cm2xxx.h"
19#include "cm3xxx.h" 20#include "cm3xxx.h"
20#include "cm44xx.h" 21#include "cm44xx.h"
21#include "common.h"
22 22
23/* 23/*
24 * cm_ll_data: function pointers to SoC-specific implementations of 24 * cm_ll_data: function pointers to SoC-specific implementations of
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index f5c4731b6f06..12aca56942c0 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -21,8 +21,6 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include "iomap.h"
25#include "common.h"
26#include "clockdomain.h" 24#include "clockdomain.h"
27#include "cm.h" 25#include "cm.h"
28#include "cm1_44xx.h" 26#include "cm1_44xx.h"
@@ -30,12 +28,18 @@
30#include "cm44xx.h" 28#include "cm44xx.h"
31#include "cminst44xx.h" 29#include "cminst44xx.h"
32#include "cm-regbits-34xx.h" 30#include "cm-regbits-34xx.h"
33#include "cm-regbits-44xx.h"
34#include "prcm44xx.h" 31#include "prcm44xx.h"
35#include "prm44xx.h" 32#include "prm44xx.h"
36#include "prcm_mpu44xx.h" 33#include "prcm_mpu44xx.h"
37#include "prcm-common.h" 34#include "prcm-common.h"
38 35
36#define OMAP4430_IDLEST_SHIFT 16
37#define OMAP4430_IDLEST_MASK (0x3 << 16)
38#define OMAP4430_CLKTRCTRL_SHIFT 0
39#define OMAP4430_CLKTRCTRL_MASK (0x3 << 0)
40#define OMAP4430_MODULEMODE_SHIFT 0
41#define OMAP4430_MODULEMODE_MASK (0x3 << 0)
42
39/* 43/*
40 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield: 44 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield:
41 * 45 *
@@ -116,7 +120,7 @@ u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx)
116 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 120 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
117 part == OMAP4430_INVALID_PRCM_PARTITION || 121 part == OMAP4430_INVALID_PRCM_PARTITION ||
118 !_cm_bases[part]); 122 !_cm_bases[part]);
119 return __raw_readl(_cm_bases[part] + inst + idx); 123 return readl_relaxed(_cm_bases[part] + inst + idx);
120} 124}
121 125
122/* Write into a register in a CM instance */ 126/* Write into a register in a CM instance */
@@ -125,7 +129,7 @@ void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx)
125 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 129 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
126 part == OMAP4430_INVALID_PRCM_PARTITION || 130 part == OMAP4430_INVALID_PRCM_PARTITION ||
127 !_cm_bases[part]); 131 !_cm_bases[part]);
128 __raw_writel(val, _cm_bases[part] + inst + idx); 132 writel_relaxed(val, _cm_bases[part] + inst + idx);
129} 133}
130 134
131/* Read-modify-write a register in CM1. Caller must lock */ 135/* Read-modify-write a register in CM1. Caller must lock */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 44bb4d544dcf..751f3549bf6f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -151,32 +151,32 @@ void __iomem *omap_ctrl_base_get(void)
151 151
152u8 omap_ctrl_readb(u16 offset) 152u8 omap_ctrl_readb(u16 offset)
153{ 153{
154 return __raw_readb(OMAP_CTRL_REGADDR(offset)); 154 return readb_relaxed(OMAP_CTRL_REGADDR(offset));
155} 155}
156 156
157u16 omap_ctrl_readw(u16 offset) 157u16 omap_ctrl_readw(u16 offset)
158{ 158{
159 return __raw_readw(OMAP_CTRL_REGADDR(offset)); 159 return readw_relaxed(OMAP_CTRL_REGADDR(offset));
160} 160}
161 161
162u32 omap_ctrl_readl(u16 offset) 162u32 omap_ctrl_readl(u16 offset)
163{ 163{
164 return __raw_readl(OMAP_CTRL_REGADDR(offset)); 164 return readl_relaxed(OMAP_CTRL_REGADDR(offset));
165} 165}
166 166
167void omap_ctrl_writeb(u8 val, u16 offset) 167void omap_ctrl_writeb(u8 val, u16 offset)
168{ 168{
169 __raw_writeb(val, OMAP_CTRL_REGADDR(offset)); 169 writeb_relaxed(val, OMAP_CTRL_REGADDR(offset));
170} 170}
171 171
172void omap_ctrl_writew(u16 val, u16 offset) 172void omap_ctrl_writew(u16 val, u16 offset)
173{ 173{
174 __raw_writew(val, OMAP_CTRL_REGADDR(offset)); 174 writew_relaxed(val, OMAP_CTRL_REGADDR(offset));
175} 175}
176 176
177void omap_ctrl_writel(u32 val, u16 offset) 177void omap_ctrl_writel(u32 val, u16 offset)
178{ 178{
179 __raw_writel(val, OMAP_CTRL_REGADDR(offset)); 179 writel_relaxed(val, OMAP_CTRL_REGADDR(offset));
180} 180}
181 181
182/* 182/*
@@ -188,12 +188,12 @@ void omap_ctrl_writel(u32 val, u16 offset)
188 188
189u32 omap4_ctrl_pad_readl(u16 offset) 189u32 omap4_ctrl_pad_readl(u16 offset)
190{ 190{
191 return __raw_readl(OMAP4_CTRL_PAD_REGADDR(offset)); 191 return readl_relaxed(OMAP4_CTRL_PAD_REGADDR(offset));
192} 192}
193 193
194void omap4_ctrl_pad_writel(u32 val, u16 offset) 194void omap4_ctrl_pad_writel(u32 val, u16 offset)
195{ 195{
196 __raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset)); 196 writel_relaxed(val, OMAP4_CTRL_PAD_REGADDR(offset));
197} 197}
198 198
199#ifdef CONFIG_ARCH_OMAP3 199#ifdef CONFIG_ARCH_OMAP3
@@ -222,7 +222,7 @@ void omap3_ctrl_write_boot_mode(u8 bootmode)
222 * 222 *
223 * XXX This should use some omap_ctrl_writel()-type function 223 * XXX This should use some omap_ctrl_writel()-type function
224 */ 224 */
225 __raw_writel(l, OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD + 4)); 225 writel_relaxed(l, OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD + 4));
226} 226}
227 227
228#endif 228#endif
@@ -285,7 +285,7 @@ void omap3_clear_scratchpad_contents(void)
285 if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) & 285 if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) &
286 OMAP3430_GLOBAL_COLD_RST_MASK) { 286 OMAP3430_GLOBAL_COLD_RST_MASK) {
287 for ( ; offset <= max_offset; offset += 0x4) 287 for ( ; offset <= max_offset; offset += 0x4)
288 __raw_writel(0x0, (v_addr + offset)); 288 writel_relaxed(0x0, (v_addr + offset));
289 omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK, 289 omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK,
290 OMAP3430_GR_MOD, 290 OMAP3430_GR_MOD,
291 OMAP3_PRM_RSTST_OFFSET); 291 OMAP3_PRM_RSTST_OFFSET);
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index 01fc710c8181..2498ab025fa2 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -14,6 +14,7 @@
14#include <linux/cpuidle.h> 14#include <linux/cpuidle.h>
15#include <linux/cpu_pm.h> 15#include <linux/cpu_pm.h>
16#include <linux/export.h> 16#include <linux/export.h>
17#include <linux/clockchips.h>
17 18
18#include <asm/cpuidle.h> 19#include <asm/cpuidle.h>
19#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
@@ -83,6 +84,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
83{ 84{
84 struct idle_statedata *cx = state_ptr + index; 85 struct idle_statedata *cx = state_ptr + index;
85 u32 mpuss_can_lose_context = 0; 86 u32 mpuss_can_lose_context = 0;
87 int cpu_id = smp_processor_id();
86 88
87 /* 89 /*
88 * CPU0 has to wait and stay ON until CPU1 is OFF state. 90 * CPU0 has to wait and stay ON until CPU1 is OFF state.
@@ -110,6 +112,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
110 mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) && 112 mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) &&
111 (cx->mpu_logic_state == PWRDM_POWER_OFF); 113 (cx->mpu_logic_state == PWRDM_POWER_OFF);
112 114
115 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu_id);
116
113 /* 117 /*
114 * Call idle CPU PM enter notifier chain so that 118 * Call idle CPU PM enter notifier chain so that
115 * VFP and per CPU interrupt context is saved. 119 * VFP and per CPU interrupt context is saved.
@@ -165,6 +169,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
165 if (dev->cpu == 0 && mpuss_can_lose_context) 169 if (dev->cpu == 0 && mpuss_can_lose_context)
166 cpu_cluster_pm_exit(); 170 cpu_cluster_pm_exit();
167 171
172 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id);
173
168fail: 174fail:
169 cpuidle_coupled_parallel_barrier(dev, &abort_barrier); 175 cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
170 cpu_done[dev->cpu] = false; 176 cpu_done[dev->cpu] = false;
@@ -172,6 +178,16 @@ fail:
172 return index; 178 return index;
173} 179}
174 180
181/*
182 * For each cpu, setup the broadcast timer because local timers
183 * stops for the states above C1.
184 */
185static void omap_setup_broadcast_timer(void *arg)
186{
187 int cpu = smp_processor_id();
188 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
189}
190
175static struct cpuidle_driver omap4_idle_driver = { 191static struct cpuidle_driver omap4_idle_driver = {
176 .name = "omap4_idle", 192 .name = "omap4_idle",
177 .owner = THIS_MODULE, 193 .owner = THIS_MODULE,
@@ -189,8 +205,7 @@ static struct cpuidle_driver omap4_idle_driver = {
189 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ 205 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
190 .exit_latency = 328 + 440, 206 .exit_latency = 328 + 440,
191 .target_residency = 960, 207 .target_residency = 960,
192 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | 208 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED,
193 CPUIDLE_FLAG_TIMER_STOP,
194 .enter = omap_enter_idle_coupled, 209 .enter = omap_enter_idle_coupled,
195 .name = "C2", 210 .name = "C2",
196 .desc = "CPUx OFF, MPUSS CSWR", 211 .desc = "CPUx OFF, MPUSS CSWR",
@@ -199,8 +214,7 @@ static struct cpuidle_driver omap4_idle_driver = {
199 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ 214 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
200 .exit_latency = 460 + 518, 215 .exit_latency = 460 + 518,
201 .target_residency = 1100, 216 .target_residency = 1100,
202 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | 217 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED,
203 CPUIDLE_FLAG_TIMER_STOP,
204 .enter = omap_enter_idle_coupled, 218 .enter = omap_enter_idle_coupled,
205 .name = "C3", 219 .name = "C3",
206 .desc = "CPUx OFF, MPUSS OSWR", 220 .desc = "CPUx OFF, MPUSS OSWR",
@@ -231,5 +245,8 @@ int __init omap4_idle_init(void)
231 if (!cpu_clkdm[0] || !cpu_clkdm[1]) 245 if (!cpu_clkdm[0] || !cpu_clkdm[1])
232 return -ENODEV; 246 return -ENODEV;
233 247
248 /* Configure the broadcast timer on each cpu */
249 on_each_cpu(omap_setup_broadcast_timer, NULL, 1);
250
234 return cpuidle_register(&omap4_idle_driver, cpu_online_mask); 251 return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
235} 252}
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index 5689c88d986d..a6d2cf1f8d02 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -91,7 +91,7 @@ static inline void dma_write(u32 val, int reg, int lch)
91 addr += reg_map[reg].offset; 91 addr += reg_map[reg].offset;
92 addr += reg_map[reg].stride * lch; 92 addr += reg_map[reg].stride * lch;
93 93
94 __raw_writel(val, addr); 94 writel_relaxed(val, addr);
95} 95}
96 96
97static inline u32 dma_read(int reg, int lch) 97static inline u32 dma_read(int reg, int lch)
@@ -101,7 +101,7 @@ static inline u32 dma_read(int reg, int lch)
101 addr += reg_map[reg].offset; 101 addr += reg_map[reg].offset;
102 addr += reg_map[reg].stride * lch; 102 addr += reg_map[reg].stride * lch;
103 103
104 return __raw_readl(addr); 104 return readl_relaxed(addr);
105} 105}
106 106
107static void omap2_clear_dma(int lch) 107static void omap2_clear_dma(int lch)
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 9fe8c949305c..852b19a367f0 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -170,12 +170,12 @@ static irqreturn_t gpmc_handle_irq(int irq, void *dev);
170 170
171static void gpmc_write_reg(int idx, u32 val) 171static void gpmc_write_reg(int idx, u32 val)
172{ 172{
173 __raw_writel(val, gpmc_base + idx); 173 writel_relaxed(val, gpmc_base + idx);
174} 174}
175 175
176static u32 gpmc_read_reg(int idx) 176static u32 gpmc_read_reg(int idx)
177{ 177{
178 return __raw_readl(gpmc_base + idx); 178 return readl_relaxed(gpmc_base + idx);
179} 179}
180 180
181void gpmc_cs_write_reg(int cs, int idx, u32 val) 181void gpmc_cs_write_reg(int cs, int idx, u32 val)
@@ -183,7 +183,7 @@ void gpmc_cs_write_reg(int cs, int idx, u32 val)
183 void __iomem *reg_addr; 183 void __iomem *reg_addr;
184 184
185 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx; 185 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
186 __raw_writel(val, reg_addr); 186 writel_relaxed(val, reg_addr);
187} 187}
188 188
189static u32 gpmc_cs_read_reg(int cs, int idx) 189static u32 gpmc_cs_read_reg(int cs, int idx)
@@ -191,7 +191,7 @@ static u32 gpmc_cs_read_reg(int cs, int idx)
191 void __iomem *reg_addr; 191 void __iomem *reg_addr;
192 192
193 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx; 193 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
194 return __raw_readl(reg_addr); 194 return readl_relaxed(reg_addr);
195} 195}
196 196
197/* TODO: Add support for gpmc_fck to clock framework and use it */ 197/* TODO: Add support for gpmc_fck to clock framework and use it */
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 157412e4273a..43969da5d50b 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -94,7 +94,7 @@ EXPORT_SYMBOL(omap_type);
94#define OMAP_TAP_DIE_ID_44XX_2 0x020c 94#define OMAP_TAP_DIE_ID_44XX_2 0x020c
95#define OMAP_TAP_DIE_ID_44XX_3 0x0210 95#define OMAP_TAP_DIE_ID_44XX_3 0x0210
96 96
97#define read_tap_reg(reg) __raw_readl(tap_base + (reg)) 97#define read_tap_reg(reg) readl_relaxed(tap_base + (reg))
98 98
99struct omap_id { 99struct omap_id {
100 u16 hawkeye; /* Silicon type (Hawkeye id) */ 100 u16 hawkeye; /* Silicon type (Hawkeye id) */
@@ -628,6 +628,41 @@ void __init omap5xxx_check_revision(void)
628 pr_info("%s %s\n", soc_name, soc_rev); 628 pr_info("%s %s\n", soc_name, soc_rev);
629} 629}
630 630
631void __init dra7xxx_check_revision(void)
632{
633 u32 idcode;
634 u16 hawkeye;
635 u8 rev;
636
637 idcode = read_tap_reg(OMAP_TAP_IDCODE);
638 hawkeye = (idcode >> 12) & 0xffff;
639 rev = (idcode >> 28) & 0xff;
640 switch (hawkeye) {
641 case 0xb990:
642 switch (rev) {
643 case 0:
644 omap_revision = DRA752_REV_ES1_0;
645 break;
646 case 1:
647 default:
648 omap_revision = DRA752_REV_ES1_1;
649 }
650 break;
651
652 default:
653 /* Unknown default to latest silicon rev as default*/
654 pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n",
655 __func__, idcode, hawkeye, rev);
656 omap_revision = DRA752_REV_ES1_1;
657 }
658
659 sprintf(soc_name, "DRA%03x", omap_rev() >> 16);
660 sprintf(soc_rev, "ES%d.%d", (omap_rev() >> 12) & 0xf,
661 (omap_rev() >> 8) & 0xf);
662
663 pr_info("%s %s\n", soc_name, soc_rev);
664}
665
631/* 666/*
632 * Set up things for map_io and processor detection later on. Gets called 667 * Set up things for map_io and processor detection later on. Gets called
633 * pretty much first thing from board init. For multi-omap, this gets 668 * pretty much first thing from board init. For multi-omap, this gets
@@ -669,6 +704,8 @@ static const char * __init omap_get_family(void)
669 return kasprintf(GFP_KERNEL, "OMAP5"); 704 return kasprintf(GFP_KERNEL, "OMAP5");
670 else if (soc_is_am43xx()) 705 else if (soc_is_am43xx())
671 return kasprintf(GFP_KERNEL, "AM43xx"); 706 return kasprintf(GFP_KERNEL, "AM43xx");
707 else if (soc_is_dra7xx())
708 return kasprintf(GFP_KERNEL, "DRA7");
672 else 709 else
673 return kasprintf(GFP_KERNEL, "Unknown"); 710 return kasprintf(GFP_KERNEL, "Unknown");
674} 711}
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index f14f9ac2dca1..4ec3b4a93843 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -693,6 +693,7 @@ void __init dra7xx_init_early(void)
693 omap_prm_base_init(); 693 omap_prm_base_init();
694 omap_cm_base_init(); 694 omap_cm_base_init();
695 omap44xx_prm_init(); 695 omap44xx_prm_init();
696 dra7xxx_check_revision();
696 dra7xx_powerdomains_init(); 697 dra7xx_powerdomains_init();
697 dra7xx_clockdomains_init(); 698 dra7xx_clockdomains_init();
698 dra7xx_hwmod_init(); 699 dra7xx_hwmod_init();
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 6037a9a01ed5..35b8590c322e 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -83,12 +83,12 @@ struct omap3_intc_regs {
83 83
84static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg) 84static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg)
85{ 85{
86 __raw_writel(val, bank->base_reg + reg); 86 writel_relaxed(val, bank->base_reg + reg);
87} 87}
88 88
89static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg) 89static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg)
90{ 90{
91 return __raw_readl(bank->base_reg + reg); 91 return readl_relaxed(bank->base_reg + reg);
92} 92}
93 93
94/* XXX: FIQ and additional INTC support (only MPU at the moment) */ 94/* XXX: FIQ and additional INTC support (only MPU at the moment) */
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 48094b58c88f..fd88edeb027f 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -70,18 +70,18 @@ struct omap_mux_partition *omap_mux_get(const char *name)
70u16 omap_mux_read(struct omap_mux_partition *partition, u16 reg) 70u16 omap_mux_read(struct omap_mux_partition *partition, u16 reg)
71{ 71{
72 if (partition->flags & OMAP_MUX_REG_8BIT) 72 if (partition->flags & OMAP_MUX_REG_8BIT)
73 return __raw_readb(partition->base + reg); 73 return readb_relaxed(partition->base + reg);
74 else 74 else
75 return __raw_readw(partition->base + reg); 75 return readw_relaxed(partition->base + reg);
76} 76}
77 77
78void omap_mux_write(struct omap_mux_partition *partition, u16 val, 78void omap_mux_write(struct omap_mux_partition *partition, u16 val,
79 u16 reg) 79 u16 reg)
80{ 80{
81 if (partition->flags & OMAP_MUX_REG_8BIT) 81 if (partition->flags & OMAP_MUX_REG_8BIT)
82 __raw_writeb(val, partition->base + reg); 82 writeb_relaxed(val, partition->base + reg);
83 else 83 else
84 __raw_writew(val, partition->base + reg); 84 writew_relaxed(val, partition->base + reg);
85} 85}
86 86
87void omap_mux_write_array(struct omap_mux_partition *partition, 87void omap_mux_write_array(struct omap_mux_partition *partition,
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
index 75e92952c18e..4993d4bfe9b2 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Secondary CPU startup routine source file. 2 * Secondary CPU startup routine source file.
3 * 3 *
4 * Copyright (C) 2009 Texas Instruments, Inc. 4 * Copyright (C) 2009-2014 Texas Instruments, Inc.
5 * 5 *
6 * Author: 6 * Author:
7 * Santosh Shilimkar <santosh.shilimkar@ti.com> 7 * Santosh Shilimkar <santosh.shilimkar@ti.com>
@@ -28,7 +28,7 @@
28 * code. This routine also provides a holding flag into which 28 * code. This routine also provides a holding flag into which
29 * secondary core is held until we're ready for it to initialise. 29 * secondary core is held until we're ready for it to initialise.
30 * The primary core will update this flag using a hardware 30 * The primary core will update this flag using a hardware
31+ * register AuxCoreBoot0. 31 * register AuxCoreBoot0.
32 */ 32 */
33ENTRY(omap5_secondary_startup) 33ENTRY(omap5_secondary_startup)
34wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0 34wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
@@ -39,7 +39,7 @@ wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
39 cmp r0, r4 39 cmp r0, r4
40 bne wait 40 bne wait
41 b secondary_startup 41 b secondary_startup
42END(omap5_secondary_startup) 42ENDPROC(omap5_secondary_startup)
43/* 43/*
44 * OMAP4 specific entry point for secondary CPU to jump from ROM 44 * OMAP4 specific entry point for secondary CPU to jump from ROM
45 * code. This routine also provides a holding flag into which 45 * code. This routine also provides a holding flag into which
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index 458f72f9dc8f..971791fe9a3f 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -39,7 +39,7 @@ void __ref omap4_cpu_die(unsigned int cpu)
39 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0) 39 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
40 pr_err("Secure clear status failed\n"); 40 pr_err("Secure clear status failed\n");
41 } else { 41 } else {
42 __raw_writel(0, base + OMAP_AUX_CORE_BOOT_0); 42 writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0);
43 } 43 }
44 44
45 45
@@ -53,7 +53,7 @@ void __ref omap4_cpu_die(unsigned int cpu)
53 boot_cpu = omap_read_auxcoreboot0(); 53 boot_cpu = omap_read_auxcoreboot0();
54 else 54 else
55 boot_cpu = 55 boot_cpu =
56 __raw_readl(base + OMAP_AUX_CORE_BOOT_0) >> 5; 56 readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
57 57
58 if (boot_cpu == smp_processor_id()) { 58 if (boot_cpu == smp_processor_id()) {
59 /* 59 /*
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 667915d236f3..eb76e47091ad 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -116,7 +116,7 @@ static inline void set_cpu_wakeup_addr(unsigned int cpu_id, u32 addr)
116{ 116{
117 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); 117 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
118 118
119 __raw_writel(addr, pm_info->wkup_sar_addr); 119 writel_relaxed(addr, pm_info->wkup_sar_addr);
120} 120}
121 121
122/* 122/*
@@ -141,7 +141,7 @@ static void scu_pwrst_prepare(unsigned int cpu_id, unsigned int cpu_state)
141 break; 141 break;
142 } 142 }
143 143
144 __raw_writel(scu_pwr_st, pm_info->scu_sar_addr); 144 writel_relaxed(scu_pwr_st, pm_info->scu_sar_addr);
145} 145}
146 146
147/* Helper functions for MPUSS OSWR */ 147/* Helper functions for MPUSS OSWR */
@@ -179,7 +179,7 @@ static void l2x0_pwrst_prepare(unsigned int cpu_id, unsigned int save_state)
179{ 179{
180 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); 180 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
181 181
182 __raw_writel(save_state, pm_info->l2x0_sar_addr); 182 writel_relaxed(save_state, pm_info->l2x0_sar_addr);
183} 183}
184 184
185/* 185/*
@@ -192,10 +192,10 @@ static void save_l2x0_context(void)
192 u32 val; 192 u32 val;
193 void __iomem *l2x0_base = omap4_get_l2cache_base(); 193 void __iomem *l2x0_base = omap4_get_l2cache_base();
194 if (l2x0_base) { 194 if (l2x0_base) {
195 val = __raw_readl(l2x0_base + L2X0_AUX_CTRL); 195 val = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
196 __raw_writel(val, sar_base + L2X0_AUXCTRL_OFFSET); 196 writel_relaxed(val, sar_base + L2X0_AUXCTRL_OFFSET);
197 val = __raw_readl(l2x0_base + L2X0_PREFETCH_CTRL); 197 val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
198 __raw_writel(val, sar_base + L2X0_PREFETCH_CTRL_OFFSET); 198 writel_relaxed(val, sar_base + L2X0_PREFETCH_CTRL_OFFSET);
199 } 199 }
200} 200}
201#else 201#else
@@ -386,9 +386,9 @@ int __init omap4_mpuss_init(void)
386 386
387 /* Save device type on scratchpad for low level code to use */ 387 /* Save device type on scratchpad for low level code to use */
388 if (omap_type() != OMAP2_DEVICE_TYPE_GP) 388 if (omap_type() != OMAP2_DEVICE_TYPE_GP)
389 __raw_writel(1, sar_base + OMAP_TYPE_OFFSET); 389 writel_relaxed(1, sar_base + OMAP_TYPE_OFFSET);
390 else 390 else
391 __raw_writel(0, sar_base + OMAP_TYPE_OFFSET); 391 writel_relaxed(0, sar_base + OMAP_TYPE_OFFSET);
392 392
393 save_l2x0_context(); 393 save_l2x0_context();
394 394
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 17550aa39d0f..256e84ef0f67 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -99,7 +99,7 @@ static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle)
99 if (omap_secure_apis_support()) 99 if (omap_secure_apis_support())
100 omap_modify_auxcoreboot0(0x200, 0xfffffdff); 100 omap_modify_auxcoreboot0(0x200, 0xfffffdff);
101 else 101 else
102 __raw_writel(0x20, base + OMAP_AUX_CORE_BOOT_0); 102 writel_relaxed(0x20, base + OMAP_AUX_CORE_BOOT_0);
103 103
104 if (!cpu1_clkdm && !cpu1_pwrdm) { 104 if (!cpu1_clkdm && !cpu1_pwrdm) {
105 cpu1_clkdm = clkdm_lookup("mpu1_clkdm"); 105 cpu1_clkdm = clkdm_lookup("mpu1_clkdm");
@@ -227,8 +227,8 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
227 if (omap_secure_apis_support()) 227 if (omap_secure_apis_support())
228 omap_auxcoreboot_addr(virt_to_phys(startup_addr)); 228 omap_auxcoreboot_addr(virt_to_phys(startup_addr));
229 else 229 else
230 __raw_writel(virt_to_phys(omap5_secondary_startup), 230 writel_relaxed(virt_to_phys(omap5_secondary_startup),
231 base + OMAP_AUX_CORE_BOOT_1); 231 base + OMAP_AUX_CORE_BOOT_1);
232 232
233} 233}
234 234
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index 693fe486e917..37843a7d3639 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -60,19 +60,19 @@ static unsigned int omap_secure_apis;
60 */ 60 */
61static inline u32 wakeupgen_readl(u8 idx, u32 cpu) 61static inline u32 wakeupgen_readl(u8 idx, u32 cpu)
62{ 62{
63 return __raw_readl(wakeupgen_base + OMAP_WKG_ENB_A_0 + 63 return readl_relaxed(wakeupgen_base + OMAP_WKG_ENB_A_0 +
64 (cpu * CPU_ENA_OFFSET) + (idx * 4)); 64 (cpu * CPU_ENA_OFFSET) + (idx * 4));
65} 65}
66 66
67static inline void wakeupgen_writel(u32 val, u8 idx, u32 cpu) 67static inline void wakeupgen_writel(u32 val, u8 idx, u32 cpu)
68{ 68{
69 __raw_writel(val, wakeupgen_base + OMAP_WKG_ENB_A_0 + 69 writel_relaxed(val, wakeupgen_base + OMAP_WKG_ENB_A_0 +
70 (cpu * CPU_ENA_OFFSET) + (idx * 4)); 70 (cpu * CPU_ENA_OFFSET) + (idx * 4));
71} 71}
72 72
73static inline void sar_writel(u32 val, u32 offset, u8 idx) 73static inline void sar_writel(u32 val, u32 offset, u8 idx)
74{ 74{
75 __raw_writel(val, sar_base + offset + (idx * 4)); 75 writel_relaxed(val, sar_base + offset + (idx * 4));
76} 76}
77 77
78static inline int _wakeupgen_get_irq_info(u32 irq, u32 *bit_posn, u8 *reg_index) 78static inline int _wakeupgen_get_irq_info(u32 irq, u32 *bit_posn, u8 *reg_index)
@@ -231,21 +231,21 @@ static inline void omap4_irq_save_context(void)
231 } 231 }
232 232
233 /* Save AuxBoot* registers */ 233 /* Save AuxBoot* registers */
234 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); 234 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
235 __raw_writel(val, sar_base + AUXCOREBOOT0_OFFSET); 235 writel_relaxed(val, sar_base + AUXCOREBOOT0_OFFSET);
236 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_1); 236 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_1);
237 __raw_writel(val, sar_base + AUXCOREBOOT1_OFFSET); 237 writel_relaxed(val, sar_base + AUXCOREBOOT1_OFFSET);
238 238
239 /* Save SyncReq generation logic */ 239 /* Save SyncReq generation logic */
240 val = __raw_readl(wakeupgen_base + OMAP_PTMSYNCREQ_MASK); 240 val = readl_relaxed(wakeupgen_base + OMAP_PTMSYNCREQ_MASK);
241 __raw_writel(val, sar_base + PTMSYNCREQ_MASK_OFFSET); 241 writel_relaxed(val, sar_base + PTMSYNCREQ_MASK_OFFSET);
242 val = __raw_readl(wakeupgen_base + OMAP_PTMSYNCREQ_EN); 242 val = readl_relaxed(wakeupgen_base + OMAP_PTMSYNCREQ_EN);
243 __raw_writel(val, sar_base + PTMSYNCREQ_EN_OFFSET); 243 writel_relaxed(val, sar_base + PTMSYNCREQ_EN_OFFSET);
244 244
245 /* Set the Backup Bit Mask status */ 245 /* Set the Backup Bit Mask status */
246 val = __raw_readl(sar_base + SAR_BACKUP_STATUS_OFFSET); 246 val = readl_relaxed(sar_base + SAR_BACKUP_STATUS_OFFSET);
247 val |= SAR_BACKUP_STATUS_WAKEUPGEN; 247 val |= SAR_BACKUP_STATUS_WAKEUPGEN;
248 __raw_writel(val, sar_base + SAR_BACKUP_STATUS_OFFSET); 248 writel_relaxed(val, sar_base + SAR_BACKUP_STATUS_OFFSET);
249 249
250} 250}
251 251
@@ -264,15 +264,15 @@ static inline void omap5_irq_save_context(void)
264 } 264 }
265 265
266 /* Save AuxBoot* registers */ 266 /* Save AuxBoot* registers */
267 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); 267 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
268 __raw_writel(val, sar_base + OMAP5_AUXCOREBOOT0_OFFSET); 268 writel_relaxed(val, sar_base + OMAP5_AUXCOREBOOT0_OFFSET);
269 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); 269 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
270 __raw_writel(val, sar_base + OMAP5_AUXCOREBOOT1_OFFSET); 270 writel_relaxed(val, sar_base + OMAP5_AUXCOREBOOT1_OFFSET);
271 271
272 /* Set the Backup Bit Mask status */ 272 /* Set the Backup Bit Mask status */
273 val = __raw_readl(sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET); 273 val = readl_relaxed(sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET);
274 val |= SAR_BACKUP_STATUS_WAKEUPGEN; 274 val |= SAR_BACKUP_STATUS_WAKEUPGEN;
275 __raw_writel(val, sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET); 275 writel_relaxed(val, sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET);
276 276
277} 277}
278 278
@@ -306,9 +306,9 @@ static void irq_sar_clear(void)
306 if (soc_is_omap54xx()) 306 if (soc_is_omap54xx())
307 offset = OMAP5_SAR_BACKUP_STATUS_OFFSET; 307 offset = OMAP5_SAR_BACKUP_STATUS_OFFSET;
308 308
309 val = __raw_readl(sar_base + offset); 309 val = readl_relaxed(sar_base + offset);
310 val &= ~SAR_BACKUP_STATUS_WAKEUPGEN; 310 val &= ~SAR_BACKUP_STATUS_WAKEUPGEN;
311 __raw_writel(val, sar_base + offset); 311 writel_relaxed(val, sar_base + offset);
312} 312}
313 313
314/* 314/*
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 95e171a055f3..99b0154493a4 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -125,25 +125,25 @@ void __init gic_init_irq(void)
125void gic_dist_disable(void) 125void gic_dist_disable(void)
126{ 126{
127 if (gic_dist_base_addr) 127 if (gic_dist_base_addr)
128 __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL); 128 writel_relaxed(0x0, gic_dist_base_addr + GIC_DIST_CTRL);
129} 129}
130 130
131void gic_dist_enable(void) 131void gic_dist_enable(void)
132{ 132{
133 if (gic_dist_base_addr) 133 if (gic_dist_base_addr)
134 __raw_writel(0x1, gic_dist_base_addr + GIC_DIST_CTRL); 134 writel_relaxed(0x1, gic_dist_base_addr + GIC_DIST_CTRL);
135} 135}
136 136
137bool gic_dist_disabled(void) 137bool gic_dist_disabled(void)
138{ 138{
139 return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1); 139 return !(readl_relaxed(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1);
140} 140}
141 141
142void gic_timer_retrigger(void) 142void gic_timer_retrigger(void)
143{ 143{
144 u32 twd_int = __raw_readl(twd_base + TWD_TIMER_INTSTAT); 144 u32 twd_int = readl_relaxed(twd_base + TWD_TIMER_INTSTAT);
145 u32 gic_int = __raw_readl(gic_dist_base_addr + GIC_DIST_PENDING_SET); 145 u32 gic_int = readl_relaxed(gic_dist_base_addr + GIC_DIST_PENDING_SET);
146 u32 twd_ctrl = __raw_readl(twd_base + TWD_TIMER_CONTROL); 146 u32 twd_ctrl = readl_relaxed(twd_base + TWD_TIMER_CONTROL);
147 147
148 if (twd_int && !(gic_int & BIT(IRQ_LOCALTIMER))) { 148 if (twd_int && !(gic_int & BIT(IRQ_LOCALTIMER))) {
149 /* 149 /*
@@ -151,11 +151,11 @@ void gic_timer_retrigger(void)
151 * disabled. Ack the pending interrupt, and retrigger it. 151 * disabled. Ack the pending interrupt, and retrigger it.
152 */ 152 */
153 pr_warn("%s: lost localtimer interrupt\n", __func__); 153 pr_warn("%s: lost localtimer interrupt\n", __func__);
154 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT); 154 writel_relaxed(1, twd_base + TWD_TIMER_INTSTAT);
155 if (!(twd_ctrl & TWD_TIMER_CONTROL_PERIODIC)) { 155 if (!(twd_ctrl & TWD_TIMER_CONTROL_PERIODIC)) {
156 __raw_writel(1, twd_base + TWD_TIMER_COUNTER); 156 writel_relaxed(1, twd_base + TWD_TIMER_COUNTER);
157 twd_ctrl |= TWD_TIMER_CONTROL_ENABLE; 157 twd_ctrl |= TWD_TIMER_CONTROL_ENABLE;
158 __raw_writel(twd_ctrl, twd_base + TWD_TIMER_CONTROL); 158 writel_relaxed(twd_ctrl, twd_base + TWD_TIMER_CONTROL);
159 } 159 }
160 } 160 }
161} 161}
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 66c60fe1104c..f7bb435bb543 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -72,7 +72,7 @@
72 * | (../mach-omap2/omap_hwmod*) | 72 * | (../mach-omap2/omap_hwmod*) |
73 * +-------------------------------+ 73 * +-------------------------------+
74 * | OMAP clock/PRCM/register fns | 74 * | OMAP clock/PRCM/register fns |
75 * | (__raw_{read,write}l, clk*) | 75 * | ({read,write}l_relaxed, clk*) |
76 * +-------------------------------+ 76 * +-------------------------------+
77 * 77 *
78 * Device drivers should not contain any OMAP-specific code or data in 78 * Device drivers should not contain any OMAP-specific code or data in
@@ -3230,17 +3230,17 @@ static int _am33xx_is_hardreset_asserted(struct omap_hwmod *oh,
3230u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs) 3230u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs)
3231{ 3231{
3232 if (oh->flags & HWMOD_16BIT_REG) 3232 if (oh->flags & HWMOD_16BIT_REG)
3233 return __raw_readw(oh->_mpu_rt_va + reg_offs); 3233 return readw_relaxed(oh->_mpu_rt_va + reg_offs);
3234 else 3234 else
3235 return __raw_readl(oh->_mpu_rt_va + reg_offs); 3235 return readl_relaxed(oh->_mpu_rt_va + reg_offs);
3236} 3236}
3237 3237
3238void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs) 3238void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
3239{ 3239{
3240 if (oh->flags & HWMOD_16BIT_REG) 3240 if (oh->flags & HWMOD_16BIT_REG)
3241 __raw_writew(v, oh->_mpu_rt_va + reg_offs); 3241 writew_relaxed(v, oh->_mpu_rt_va + reg_offs);
3242 else 3242 else
3243 __raw_writel(v, oh->_mpu_rt_va + reg_offs); 3243 writel_relaxed(v, oh->_mpu_rt_va + reg_offs);
3244} 3244}
3245 3245
3246/** 3246/**
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 0f178623e7da..a579b89ce9b7 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -24,6 +24,7 @@
24#include "prm33xx.h" 24#include "prm33xx.h"
25#include "omap_hwmod_33xx_43xx_common_data.h" 25#include "omap_hwmod_33xx_43xx_common_data.h"
26#include "prcm43xx.h" 26#include "prcm43xx.h"
27#include "common.h"
27 28
28#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl)) 29#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
29#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl)) 30#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 1219280bb976..41e54f759934 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -3635,15 +3635,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic = {
3635 .master = &omap44xx_l4_abe_hwmod, 3635 .master = &omap44xx_l4_abe_hwmod,
3636 .slave = &omap44xx_dmic_hwmod, 3636 .slave = &omap44xx_dmic_hwmod,
3637 .clk = "ocp_abe_iclk", 3637 .clk = "ocp_abe_iclk",
3638 .user = OCP_USER_MPU, 3638 .user = OCP_USER_MPU | OCP_USER_SDMA,
3639};
3640
3641/* l4_abe -> dmic (dma) */
3642static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic_dma = {
3643 .master = &omap44xx_l4_abe_hwmod,
3644 .slave = &omap44xx_dmic_hwmod,
3645 .clk = "ocp_abe_iclk",
3646 .user = OCP_USER_SDMA,
3647}; 3639};
3648 3640
3649/* dsp -> iva */ 3641/* dsp -> iva */
@@ -4209,15 +4201,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1 = {
4209 .master = &omap44xx_l4_abe_hwmod, 4201 .master = &omap44xx_l4_abe_hwmod,
4210 .slave = &omap44xx_mcbsp1_hwmod, 4202 .slave = &omap44xx_mcbsp1_hwmod,
4211 .clk = "ocp_abe_iclk", 4203 .clk = "ocp_abe_iclk",
4212 .user = OCP_USER_MPU, 4204 .user = OCP_USER_MPU | OCP_USER_SDMA,
4213};
4214
4215/* l4_abe -> mcbsp1 (dma) */
4216static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1_dma = {
4217 .master = &omap44xx_l4_abe_hwmod,
4218 .slave = &omap44xx_mcbsp1_hwmod,
4219 .clk = "ocp_abe_iclk",
4220 .user = OCP_USER_SDMA,
4221}; 4205};
4222 4206
4223/* l4_abe -> mcbsp2 */ 4207/* l4_abe -> mcbsp2 */
@@ -4225,15 +4209,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2 = {
4225 .master = &omap44xx_l4_abe_hwmod, 4209 .master = &omap44xx_l4_abe_hwmod,
4226 .slave = &omap44xx_mcbsp2_hwmod, 4210 .slave = &omap44xx_mcbsp2_hwmod,
4227 .clk = "ocp_abe_iclk", 4211 .clk = "ocp_abe_iclk",
4228 .user = OCP_USER_MPU, 4212 .user = OCP_USER_MPU | OCP_USER_SDMA,
4229};
4230
4231/* l4_abe -> mcbsp2 (dma) */
4232static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2_dma = {
4233 .master = &omap44xx_l4_abe_hwmod,
4234 .slave = &omap44xx_mcbsp2_hwmod,
4235 .clk = "ocp_abe_iclk",
4236 .user = OCP_USER_SDMA,
4237}; 4213};
4238 4214
4239/* l4_abe -> mcbsp3 */ 4215/* l4_abe -> mcbsp3 */
@@ -4241,15 +4217,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3 = {
4241 .master = &omap44xx_l4_abe_hwmod, 4217 .master = &omap44xx_l4_abe_hwmod,
4242 .slave = &omap44xx_mcbsp3_hwmod, 4218 .slave = &omap44xx_mcbsp3_hwmod,
4243 .clk = "ocp_abe_iclk", 4219 .clk = "ocp_abe_iclk",
4244 .user = OCP_USER_MPU, 4220 .user = OCP_USER_MPU | OCP_USER_SDMA,
4245};
4246
4247/* l4_abe -> mcbsp3 (dma) */
4248static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3_dma = {
4249 .master = &omap44xx_l4_abe_hwmod,
4250 .slave = &omap44xx_mcbsp3_hwmod,
4251 .clk = "ocp_abe_iclk",
4252 .user = OCP_USER_SDMA,
4253}; 4221};
4254 4222
4255/* l4_per -> mcbsp4 */ 4223/* l4_per -> mcbsp4 */
@@ -4265,15 +4233,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm = {
4265 .master = &omap44xx_l4_abe_hwmod, 4233 .master = &omap44xx_l4_abe_hwmod,
4266 .slave = &omap44xx_mcpdm_hwmod, 4234 .slave = &omap44xx_mcpdm_hwmod,
4267 .clk = "ocp_abe_iclk", 4235 .clk = "ocp_abe_iclk",
4268 .user = OCP_USER_MPU, 4236 .user = OCP_USER_MPU | OCP_USER_SDMA,
4269};
4270
4271/* l4_abe -> mcpdm (dma) */
4272static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm_dma = {
4273 .master = &omap44xx_l4_abe_hwmod,
4274 .slave = &omap44xx_mcpdm_hwmod,
4275 .clk = "ocp_abe_iclk",
4276 .user = OCP_USER_SDMA,
4277}; 4237};
4278 4238
4279/* l4_per -> mcspi1 */ 4239/* l4_per -> mcspi1 */
@@ -4575,15 +4535,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5 = {
4575 .master = &omap44xx_l4_abe_hwmod, 4535 .master = &omap44xx_l4_abe_hwmod,
4576 .slave = &omap44xx_timer5_hwmod, 4536 .slave = &omap44xx_timer5_hwmod,
4577 .clk = "ocp_abe_iclk", 4537 .clk = "ocp_abe_iclk",
4578 .user = OCP_USER_MPU, 4538 .user = OCP_USER_MPU | OCP_USER_SDMA,
4579};
4580
4581/* l4_abe -> timer5 (dma) */
4582static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5_dma = {
4583 .master = &omap44xx_l4_abe_hwmod,
4584 .slave = &omap44xx_timer5_hwmod,
4585 .clk = "ocp_abe_iclk",
4586 .user = OCP_USER_SDMA,
4587}; 4539};
4588 4540
4589/* l4_abe -> timer6 */ 4541/* l4_abe -> timer6 */
@@ -4591,15 +4543,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6 = {
4591 .master = &omap44xx_l4_abe_hwmod, 4543 .master = &omap44xx_l4_abe_hwmod,
4592 .slave = &omap44xx_timer6_hwmod, 4544 .slave = &omap44xx_timer6_hwmod,
4593 .clk = "ocp_abe_iclk", 4545 .clk = "ocp_abe_iclk",
4594 .user = OCP_USER_MPU, 4546 .user = OCP_USER_MPU | OCP_USER_SDMA,
4595};
4596
4597/* l4_abe -> timer6 (dma) */
4598static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6_dma = {
4599 .master = &omap44xx_l4_abe_hwmod,
4600 .slave = &omap44xx_timer6_hwmod,
4601 .clk = "ocp_abe_iclk",
4602 .user = OCP_USER_SDMA,
4603}; 4547};
4604 4548
4605/* l4_abe -> timer7 */ 4549/* l4_abe -> timer7 */
@@ -4607,15 +4551,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7 = {
4607 .master = &omap44xx_l4_abe_hwmod, 4551 .master = &omap44xx_l4_abe_hwmod,
4608 .slave = &omap44xx_timer7_hwmod, 4552 .slave = &omap44xx_timer7_hwmod,
4609 .clk = "ocp_abe_iclk", 4553 .clk = "ocp_abe_iclk",
4610 .user = OCP_USER_MPU, 4554 .user = OCP_USER_MPU | OCP_USER_SDMA,
4611};
4612
4613/* l4_abe -> timer7 (dma) */
4614static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7_dma = {
4615 .master = &omap44xx_l4_abe_hwmod,
4616 .slave = &omap44xx_timer7_hwmod,
4617 .clk = "ocp_abe_iclk",
4618 .user = OCP_USER_SDMA,
4619}; 4555};
4620 4556
4621/* l4_abe -> timer8 */ 4557/* l4_abe -> timer8 */
@@ -4623,15 +4559,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8 = {
4623 .master = &omap44xx_l4_abe_hwmod, 4559 .master = &omap44xx_l4_abe_hwmod,
4624 .slave = &omap44xx_timer8_hwmod, 4560 .slave = &omap44xx_timer8_hwmod,
4625 .clk = "ocp_abe_iclk", 4561 .clk = "ocp_abe_iclk",
4626 .user = OCP_USER_MPU, 4562 .user = OCP_USER_MPU | OCP_USER_SDMA,
4627};
4628
4629/* l4_abe -> timer8 (dma) */
4630static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8_dma = {
4631 .master = &omap44xx_l4_abe_hwmod,
4632 .slave = &omap44xx_timer8_hwmod,
4633 .clk = "ocp_abe_iclk",
4634 .user = OCP_USER_SDMA,
4635}; 4563};
4636 4564
4637/* l4_per -> timer9 */ 4565/* l4_per -> timer9 */
@@ -4831,7 +4759,6 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
4831 &omap44xx_l3_instr__debugss, 4759 &omap44xx_l3_instr__debugss,
4832 &omap44xx_l4_cfg__dma_system, 4760 &omap44xx_l4_cfg__dma_system,
4833 &omap44xx_l4_abe__dmic, 4761 &omap44xx_l4_abe__dmic,
4834 &omap44xx_l4_abe__dmic_dma,
4835 &omap44xx_dsp__iva, 4762 &omap44xx_dsp__iva,
4836 /* &omap44xx_dsp__sl2if, */ 4763 /* &omap44xx_dsp__sl2if, */
4837 &omap44xx_l4_cfg__dsp, 4764 &omap44xx_l4_cfg__dsp,
@@ -4874,14 +4801,10 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
4874 &omap44xx_l4_abe__mcasp, 4801 &omap44xx_l4_abe__mcasp,
4875 &omap44xx_l4_abe__mcasp_dma, 4802 &omap44xx_l4_abe__mcasp_dma,
4876 &omap44xx_l4_abe__mcbsp1, 4803 &omap44xx_l4_abe__mcbsp1,
4877 &omap44xx_l4_abe__mcbsp1_dma,
4878 &omap44xx_l4_abe__mcbsp2, 4804 &omap44xx_l4_abe__mcbsp2,
4879 &omap44xx_l4_abe__mcbsp2_dma,
4880 &omap44xx_l4_abe__mcbsp3, 4805 &omap44xx_l4_abe__mcbsp3,
4881 &omap44xx_l4_abe__mcbsp3_dma,
4882 &omap44xx_l4_per__mcbsp4, 4806 &omap44xx_l4_per__mcbsp4,
4883 &omap44xx_l4_abe__mcpdm, 4807 &omap44xx_l4_abe__mcpdm,
4884 &omap44xx_l4_abe__mcpdm_dma,
4885 &omap44xx_l4_per__mcspi1, 4808 &omap44xx_l4_per__mcspi1,
4886 &omap44xx_l4_per__mcspi2, 4809 &omap44xx_l4_per__mcspi2,
4887 &omap44xx_l4_per__mcspi3, 4810 &omap44xx_l4_per__mcspi3,
@@ -4913,13 +4836,9 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
4913 &omap44xx_l4_per__timer3, 4836 &omap44xx_l4_per__timer3,
4914 &omap44xx_l4_per__timer4, 4837 &omap44xx_l4_per__timer4,
4915 &omap44xx_l4_abe__timer5, 4838 &omap44xx_l4_abe__timer5,
4916 &omap44xx_l4_abe__timer5_dma,
4917 &omap44xx_l4_abe__timer6, 4839 &omap44xx_l4_abe__timer6,
4918 &omap44xx_l4_abe__timer6_dma,
4919 &omap44xx_l4_abe__timer7, 4840 &omap44xx_l4_abe__timer7,
4920 &omap44xx_l4_abe__timer7_dma,
4921 &omap44xx_l4_abe__timer8, 4841 &omap44xx_l4_abe__timer8,
4922 &omap44xx_l4_abe__timer8_dma,
4923 &omap44xx_l4_per__timer9, 4842 &omap44xx_l4_per__timer9,
4924 &omap44xx_l4_per__timer10, 4843 &omap44xx_l4_per__timer10,
4925 &omap44xx_l4_per__timer11, 4844 &omap44xx_l4_per__timer11,
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 892317294fdc..290213f2cbe3 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -334,6 +334,235 @@ static struct omap_hwmod omap54xx_dmic_hwmod = {
334}; 334};
335 335
336/* 336/*
337 * 'dss' class
338 * display sub-system
339 */
340static struct omap_hwmod_class_sysconfig omap54xx_dss_sysc = {
341 .rev_offs = 0x0000,
342 .syss_offs = 0x0014,
343 .sysc_flags = SYSS_HAS_RESET_STATUS,
344};
345
346static struct omap_hwmod_class omap54xx_dss_hwmod_class = {
347 .name = "dss",
348 .sysc = &omap54xx_dss_sysc,
349 .reset = omap_dss_reset,
350};
351
352/* dss */
353static struct omap_hwmod_opt_clk dss_opt_clks[] = {
354 { .role = "32khz_clk", .clk = "dss_32khz_clk" },
355 { .role = "sys_clk", .clk = "dss_sys_clk" },
356 { .role = "hdmi_clk", .clk = "dss_48mhz_clk" },
357};
358
359static struct omap_hwmod omap54xx_dss_hwmod = {
360 .name = "dss_core",
361 .class = &omap54xx_dss_hwmod_class,
362 .clkdm_name = "dss_clkdm",
363 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
364 .main_clk = "dss_dss_clk",
365 .prcm = {
366 .omap4 = {
367 .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
368 .context_offs = OMAP54XX_RM_DSS_DSS_CONTEXT_OFFSET,
369 .modulemode = MODULEMODE_SWCTRL,
370 },
371 },
372 .opt_clks = dss_opt_clks,
373 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
374};
375
376/*
377 * 'dispc' class
378 * display controller
379 */
380
381static struct omap_hwmod_class_sysconfig omap54xx_dispc_sysc = {
382 .rev_offs = 0x0000,
383 .sysc_offs = 0x0010,
384 .syss_offs = 0x0014,
385 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
386 SYSC_HAS_ENAWAKEUP | SYSC_HAS_MIDLEMODE |
387 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
388 SYSS_HAS_RESET_STATUS),
389 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
390 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
391 .sysc_fields = &omap_hwmod_sysc_type1,
392};
393
394static struct omap_hwmod_class omap54xx_dispc_hwmod_class = {
395 .name = "dispc",
396 .sysc = &omap54xx_dispc_sysc,
397};
398
399/* dss_dispc */
400static struct omap_hwmod_opt_clk dss_dispc_opt_clks[] = {
401 { .role = "sys_clk", .clk = "dss_sys_clk" },
402};
403
404/* dss_dispc dev_attr */
405static struct omap_dss_dispc_dev_attr dss_dispc_dev_attr = {
406 .has_framedonetv_irq = 1,
407 .manager_count = 4,
408};
409
410static struct omap_hwmod omap54xx_dss_dispc_hwmod = {
411 .name = "dss_dispc",
412 .class = &omap54xx_dispc_hwmod_class,
413 .clkdm_name = "dss_clkdm",
414 .main_clk = "dss_dss_clk",
415 .prcm = {
416 .omap4 = {
417 .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
418 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
419 },
420 },
421 .opt_clks = dss_dispc_opt_clks,
422 .opt_clks_cnt = ARRAY_SIZE(dss_dispc_opt_clks),
423 .dev_attr = &dss_dispc_dev_attr,
424};
425
426/*
427 * 'dsi1' class
428 * display serial interface controller
429 */
430
431static struct omap_hwmod_class_sysconfig omap54xx_dsi1_sysc = {
432 .rev_offs = 0x0000,
433 .sysc_offs = 0x0010,
434 .syss_offs = 0x0014,
435 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
436 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
437 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
438 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
439 .sysc_fields = &omap_hwmod_sysc_type1,
440};
441
442static struct omap_hwmod_class omap54xx_dsi1_hwmod_class = {
443 .name = "dsi1",
444 .sysc = &omap54xx_dsi1_sysc,
445};
446
447/* dss_dsi1_a */
448static struct omap_hwmod_opt_clk dss_dsi1_a_opt_clks[] = {
449 { .role = "sys_clk", .clk = "dss_sys_clk" },
450};
451
452static struct omap_hwmod omap54xx_dss_dsi1_a_hwmod = {
453 .name = "dss_dsi1",
454 .class = &omap54xx_dsi1_hwmod_class,
455 .clkdm_name = "dss_clkdm",
456 .main_clk = "dss_dss_clk",
457 .prcm = {
458 .omap4 = {
459 .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
460 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
461 },
462 },
463 .opt_clks = dss_dsi1_a_opt_clks,
464 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_a_opt_clks),
465};
466
467/* dss_dsi1_c */
468static struct omap_hwmod_opt_clk dss_dsi1_c_opt_clks[] = {
469 { .role = "sys_clk", .clk = "dss_sys_clk" },
470};
471
472static struct omap_hwmod omap54xx_dss_dsi1_c_hwmod = {
473 .name = "dss_dsi2",
474 .class = &omap54xx_dsi1_hwmod_class,
475 .clkdm_name = "dss_clkdm",
476 .main_clk = "dss_dss_clk",
477 .prcm = {
478 .omap4 = {
479 .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
480 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
481 },
482 },
483 .opt_clks = dss_dsi1_c_opt_clks,
484 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_c_opt_clks),
485};
486
487/*
488 * 'hdmi' class
489 * hdmi controller
490 */
491
492static struct omap_hwmod_class_sysconfig omap54xx_hdmi_sysc = {
493 .rev_offs = 0x0000,
494 .sysc_offs = 0x0010,
495 .sysc_flags = (SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
496 SYSC_HAS_SOFTRESET),
497 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
498 SIDLE_SMART_WKUP),
499 .sysc_fields = &omap_hwmod_sysc_type2,
500};
501
502static struct omap_hwmod_class omap54xx_hdmi_hwmod_class = {
503 .name = "hdmi",
504 .sysc = &omap54xx_hdmi_sysc,
505};
506
507static struct omap_hwmod_opt_clk dss_hdmi_opt_clks[] = {
508 { .role = "sys_clk", .clk = "dss_sys_clk" },
509};
510
511static struct omap_hwmod omap54xx_dss_hdmi_hwmod = {
512 .name = "dss_hdmi",
513 .class = &omap54xx_hdmi_hwmod_class,
514 .clkdm_name = "dss_clkdm",
515 .main_clk = "dss_48mhz_clk",
516 .prcm = {
517 .omap4 = {
518 .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
519 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
520 },
521 },
522 .opt_clks = dss_hdmi_opt_clks,
523 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks),
524};
525
526/*
527 * 'rfbi' class
528 * remote frame buffer interface
529 */
530
531static struct omap_hwmod_class_sysconfig omap54xx_rfbi_sysc = {
532 .rev_offs = 0x0000,
533 .sysc_offs = 0x0010,
534 .syss_offs = 0x0014,
535 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
536 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
537 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
538 .sysc_fields = &omap_hwmod_sysc_type1,
539};
540
541static struct omap_hwmod_class omap54xx_rfbi_hwmod_class = {
542 .name = "rfbi",
543 .sysc = &omap54xx_rfbi_sysc,
544};
545
546/* dss_rfbi */
547static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
548 { .role = "ick", .clk = "l3_iclk_div" },
549};
550
551static struct omap_hwmod omap54xx_dss_rfbi_hwmod = {
552 .name = "dss_rfbi",
553 .class = &omap54xx_rfbi_hwmod_class,
554 .clkdm_name = "dss_clkdm",
555 .prcm = {
556 .omap4 = {
557 .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
558 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
559 },
560 },
561 .opt_clks = dss_rfbi_opt_clks,
562 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
563};
564
565/*
337 * 'emif' class 566 * 'emif' class
338 * external memory interface no1 (wrapper) 567 * external memory interface no1 (wrapper)
339 */ 568 */
@@ -895,7 +1124,7 @@ static struct omap_hwmod omap54xx_mcpdm_hwmod = {
895 * current exception. 1124 * current exception.
896 */ 1125 */
897 1126
898 .flags = HWMOD_EXT_OPT_MAIN_CLK, 1127 .flags = HWMOD_EXT_OPT_MAIN_CLK | HWMOD_SWSUP_SIDLE,
899 .main_clk = "pad_clks_ck", 1128 .main_clk = "pad_clks_ck",
900 .prcm = { 1129 .prcm = {
901 .omap4 = { 1130 .omap4 = {
@@ -1974,6 +2203,54 @@ static struct omap_hwmod_ocp_if omap54xx_l4_abe__dmic = {
1974 .user = OCP_USER_MPU, 2203 .user = OCP_USER_MPU,
1975}; 2204};
1976 2205
2206/* l3_main_2 -> dss */
2207static struct omap_hwmod_ocp_if omap54xx_l3_main_2__dss = {
2208 .master = &omap54xx_l3_main_2_hwmod,
2209 .slave = &omap54xx_dss_hwmod,
2210 .clk = "l3_iclk_div",
2211 .user = OCP_USER_MPU | OCP_USER_SDMA,
2212};
2213
2214/* l3_main_2 -> dss_dispc */
2215static struct omap_hwmod_ocp_if omap54xx_l3_main_2__dss_dispc = {
2216 .master = &omap54xx_l3_main_2_hwmod,
2217 .slave = &omap54xx_dss_dispc_hwmod,
2218 .clk = "l3_iclk_div",
2219 .user = OCP_USER_MPU | OCP_USER_SDMA,
2220};
2221
2222/* l3_main_2 -> dss_dsi1_a */
2223static struct omap_hwmod_ocp_if omap54xx_l3_main_2__dss_dsi1_a = {
2224 .master = &omap54xx_l3_main_2_hwmod,
2225 .slave = &omap54xx_dss_dsi1_a_hwmod,
2226 .clk = "l3_iclk_div",
2227 .user = OCP_USER_MPU | OCP_USER_SDMA,
2228};
2229
2230/* l3_main_2 -> dss_dsi1_c */
2231static struct omap_hwmod_ocp_if omap54xx_l3_main_2__dss_dsi1_c = {
2232 .master = &omap54xx_l3_main_2_hwmod,
2233 .slave = &omap54xx_dss_dsi1_c_hwmod,
2234 .clk = "l3_iclk_div",
2235 .user = OCP_USER_MPU | OCP_USER_SDMA,
2236};
2237
2238/* l3_main_2 -> dss_hdmi */
2239static struct omap_hwmod_ocp_if omap54xx_l3_main_2__dss_hdmi = {
2240 .master = &omap54xx_l3_main_2_hwmod,
2241 .slave = &omap54xx_dss_hdmi_hwmod,
2242 .clk = "l3_iclk_div",
2243 .user = OCP_USER_MPU | OCP_USER_SDMA,
2244};
2245
2246/* l3_main_2 -> dss_rfbi */
2247static struct omap_hwmod_ocp_if omap54xx_l3_main_2__dss_rfbi = {
2248 .master = &omap54xx_l3_main_2_hwmod,
2249 .slave = &omap54xx_dss_rfbi_hwmod,
2250 .clk = "l3_iclk_div",
2251 .user = OCP_USER_MPU | OCP_USER_SDMA,
2252};
2253
1977/* mpu -> emif1 */ 2254/* mpu -> emif1 */
1978static struct omap_hwmod_ocp_if omap54xx_mpu__emif1 = { 2255static struct omap_hwmod_ocp_if omap54xx_mpu__emif1 = {
1979 .master = &omap54xx_mpu_hwmod, 2256 .master = &omap54xx_mpu_hwmod,
@@ -2427,6 +2704,12 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
2427 &omap54xx_l4_cfg__dma_system, 2704 &omap54xx_l4_cfg__dma_system,
2428 &omap54xx_l4_abe__dmic, 2705 &omap54xx_l4_abe__dmic,
2429 &omap54xx_l4_cfg__mmu_dsp, 2706 &omap54xx_l4_cfg__mmu_dsp,
2707 &omap54xx_l3_main_2__dss,
2708 &omap54xx_l3_main_2__dss_dispc,
2709 &omap54xx_l3_main_2__dss_dsi1_a,
2710 &omap54xx_l3_main_2__dss_dsi1_c,
2711 &omap54xx_l3_main_2__dss_hdmi,
2712 &omap54xx_l3_main_2__dss_rfbi,
2430 &omap54xx_mpu__emif1, 2713 &omap54xx_mpu__emif1,
2431 &omap54xx_mpu__emif2, 2714 &omap54xx_mpu__emif2,
2432 &omap54xx_l4_wkup__gpio1, 2715 &omap54xx_l4_wkup__gpio1,
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index eb8a25de67ed..50640b38f0bf 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -57,7 +57,7 @@ static int __init omap4430_phy_power_down(void)
57 } 57 }
58 58
59 /* Power down the phy */ 59 /* Power down the phy */
60 __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); 60 writel_relaxed(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
61 61
62 iounmap(ctrl_base); 62 iounmap(ctrl_base);
63 63
@@ -162,7 +162,7 @@ void ti81xx_musb_phy_power(u8 on)
162 return; 162 return;
163 } 163 }
164 164
165 usbphycfg = __raw_readl(scm_base + USBCTRL0); 165 usbphycfg = readl_relaxed(scm_base + USBCTRL0);
166 166
167 if (on) { 167 if (on) {
168 if (cpu_is_ti816x()) { 168 if (cpu_is_ti816x()) {
@@ -181,7 +181,7 @@ void ti81xx_musb_phy_power(u8 on)
181 usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN; 181 usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
182 182
183 } 183 }
184 __raw_writel(usbphycfg, scm_base + USBCTRL0); 184 writel_relaxed(usbphycfg, scm_base + USBCTRL0);
185 185
186 iounmap(scm_base); 186 iounmap(scm_base);
187} 187}
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 615e5b1fb025..6bf626700557 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -46,15 +46,8 @@
46 46
47static bool is_offset_valid; 47static bool is_offset_valid;
48static u8 smps_offset; 48static u8 smps_offset;
49/*
50 * Flag to ensure Smartreflex bit in TWL
51 * being cleared in board file is not overwritten.
52 */
53static bool __initdata twl_sr_enable_autoinit;
54 49
55#define TWL4030_DCDC_GLOBAL_CFG 0x06
56#define REG_SMPS_OFFSET 0xE0 50#define REG_SMPS_OFFSET 0xE0
57#define SMARTREFLEX_ENABLE BIT(3)
58 51
59static unsigned long twl4030_vsel_to_uv(const u8 vsel) 52static unsigned long twl4030_vsel_to_uv(const u8 vsel)
60{ 53{
@@ -251,18 +244,6 @@ int __init omap3_twl_init(void)
251 if (!cpu_is_omap34xx()) 244 if (!cpu_is_omap34xx())
252 return -ENODEV; 245 return -ENODEV;
253 246
254 /*
255 * The smartreflex bit on twl4030 specifies if the setting of voltage
256 * is done over the I2C_SR path. Since this setting is independent of
257 * the actual usage of smartreflex AVS module, we enable TWL SR bit
258 * by default irrespective of whether smartreflex AVS module is enabled
259 * on the OMAP side or not. This is because without this bit enabled,
260 * the voltage scaling through vp forceupdate/bypass mechanism of
261 * voltage scaling will not function on TWL over I2C_SR.
262 */
263 if (!twl_sr_enable_autoinit)
264 omap3_twl_set_sr_bit(true);
265
266 voltdm = voltdm_lookup("mpu_iva"); 247 voltdm = voltdm_lookup("mpu_iva");
267 omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic); 248 omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic);
268 249
@@ -271,44 +252,3 @@ int __init omap3_twl_init(void)
271 252
272 return 0; 253 return 0;
273} 254}
274
275/**
276 * omap3_twl_set_sr_bit() - Set/Clear SR bit on TWL
277 * @enable: enable SR mode in twl or not
278 *
279 * If 'enable' is true, enables Smartreflex bit on TWL 4030 to make sure
280 * voltage scaling through OMAP SR works. Else, the smartreflex bit
281 * on twl4030 is cleared as there are platforms which use OMAP3 and T2 but
282 * use Synchronized Scaling Hardware Strategy (ENABLE_VMODE=1) and Direct
283 * Strategy Software Scaling Mode (ENABLE_VMODE=0), for setting the voltages,
284 * in those scenarios this bit is to be cleared (enable = false).
285 *
286 * Returns 0 on success, error is returned if I2C read/write fails.
287 */
288int __init omap3_twl_set_sr_bit(bool enable)
289{
290 u8 temp;
291 int ret;
292 if (twl_sr_enable_autoinit)
293 pr_warning("%s: unexpected multiple calls\n", __func__);
294
295 ret = twl_i2c_read_u8(TWL_MODULE_PM_RECEIVER, &temp,
296 TWL4030_DCDC_GLOBAL_CFG);
297 if (ret)
298 goto err;
299
300 if (enable)
301 temp |= SMARTREFLEX_ENABLE;
302 else
303 temp &= ~SMARTREFLEX_ENABLE;
304
305 ret = twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, temp,
306 TWL4030_DCDC_GLOBAL_CFG);
307 if (!ret) {
308 twl_sr_enable_autoinit = true;
309 return 0;
310 }
311err:
312 pr_err("%s: Error access to TWL4030 (%d)\n", __func__, ret);
313 return ret;
314}
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index ab94f3a87c32..90c88d498485 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -226,6 +226,14 @@ static void __init am3517_evm_legacy_init(void)
226 am35xx_emac_reset(); 226 am35xx_emac_reset();
227} 227}
228 228
229static struct platform_device omap3_rom_rng_device = {
230 .name = "omap3-rom-rng",
231 .id = -1,
232 .dev = {
233 .platform_data = rx51_secure_rng_call,
234 },
235};
236
229static void __init nokia_n900_legacy_init(void) 237static void __init nokia_n900_legacy_init(void)
230{ 238{
231 hsmmc2_internal_input_clk(); 239 hsmmc2_internal_input_clk();
@@ -239,6 +247,10 @@ static void __init nokia_n900_legacy_init(void)
239 pr_warning("RX-51: Not enabling ARM errata 430973 workaround\n"); 247 pr_warning("RX-51: Not enabling ARM errata 430973 workaround\n");
240 pr_warning("Thumb binaries may crash randomly without this workaround\n"); 248 pr_warning("Thumb binaries may crash randomly without this workaround\n");
241 } 249 }
250
251 pr_info("RX-51: Registring OMAP3 HWRNG device\n");
252 platform_device_register(&omap3_rom_rng_device);
253
242 } 254 }
243} 255}
244#endif /* CONFIG_ARCH_OMAP3 */ 256#endif /* CONFIG_ARCH_OMAP3 */
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index e1b41416fbf1..828aee9ea6a8 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -32,11 +32,13 @@
32#include "pm.h" 32#include "pm.h"
33#include "twl-common.h" 33#include "twl-common.h"
34 34
35#ifdef CONFIG_SUSPEND
35/* 36/*
36 * omap_pm_suspend: points to a function that does the SoC-specific 37 * omap_pm_suspend: points to a function that does the SoC-specific
37 * suspend work 38 * suspend work
38 */ 39 */
39int (*omap_pm_suspend)(void); 40static int (*omap_pm_suspend)(void);
41#endif
40 42
41#ifdef CONFIG_PM 43#ifdef CONFIG_PM
42/** 44/**
@@ -243,6 +245,15 @@ static const struct platform_suspend_ops omap_pm_ops = {
243 .valid = suspend_valid_only_mem, 245 .valid = suspend_valid_only_mem,
244}; 246};
245 247
248/**
249 * omap_common_suspend_init - Set common suspend routines for OMAP SoCs
250 * @pm_suspend: function pointer to SoC specific suspend function
251 */
252void omap_common_suspend_init(void *pm_suspend)
253{
254 omap_pm_suspend = pm_suspend;
255 suspend_set_ops(&omap_pm_ops);
256}
246#endif /* CONFIG_SUSPEND */ 257#endif /* CONFIG_SUSPEND */
247 258
248static void __init omap3_init_voltages(void) 259static void __init omap3_init_voltages(void)
@@ -287,32 +298,24 @@ omap_postcore_initcall(omap2_common_pm_init);
287 298
288int __init omap2_common_pm_late_init(void) 299int __init omap2_common_pm_late_init(void)
289{ 300{
290 /* 301 if (of_have_populated_dt()) {
291 * In the case of DT, the PMIC and SR initialization will be done using 302 omap3_twl_init();
292 * a completely different mechanism. 303 omap4_twl_init();
293 * Disable this part if a DT blob is available. 304 }
294 */
295 if (!of_have_populated_dt()) {
296
297 /* Init the voltage layer */
298 omap_pmic_late_init();
299 omap_voltage_late_init();
300 305
301 /* Initialize the voltages */ 306 /* Init the voltage layer */
302 omap3_init_voltages(); 307 omap_pmic_late_init();
303 omap4_init_voltages(); 308 omap_voltage_late_init();
304 309
305 /* Smartreflex device init */ 310 /* Initialize the voltages */
306 omap_devinit_smartreflex(); 311 omap3_init_voltages();
312 omap4_init_voltages();
307 313
308 } 314 /* Smartreflex device init */
315 omap_devinit_smartreflex();
309 316
310 /* cpufreq dummy device instantiation */ 317 /* cpufreq dummy device instantiation */
311 omap_init_cpufreq(); 318 omap_init_cpufreq();
312 319
313#ifdef CONFIG_SUSPEND
314 suspend_set_ops(&omap_pm_ops);
315#endif
316
317 return 0; 320 return 0;
318} 321}
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index d4d0fce325c7..e150102d6c06 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -34,7 +34,6 @@ extern void *omap3_secure_ram_storage;
34extern void omap3_pm_off_mode_enable(int); 34extern void omap3_pm_off_mode_enable(int);
35extern void omap_sram_idle(void); 35extern void omap_sram_idle(void);
36extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused); 36extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
37extern int (*omap_pm_suspend)(void);
38 37
39#if defined(CONFIG_PM_OPP) 38#if defined(CONFIG_PM_OPP)
40extern int omap3_opp_init(void); 39extern int omap3_opp_init(void);
@@ -147,4 +146,11 @@ static inline void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { *tstart = *
147static inline void omap_pm_setup_sr_i2c_pcb_length(u32 mm) { } 146static inline void omap_pm_setup_sr_i2c_pcb_length(u32 mm) { }
148#endif 147#endif
149 148
149#ifdef CONFIG_SUSPEND
150void omap_common_suspend_init(void *pm_suspend);
151#else
152static inline void omap_common_suspend_init(void *pm_suspend)
153{
154}
155#endif /* CONFIG_SUSPEND */
150#endif 156#endif
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 8c0759496c8d..a5ea988ff340 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -229,9 +229,7 @@ static void __init prcm_setup_regs(void)
229 clkdm_for_each(omap_pm_clkdms_setup, NULL); 229 clkdm_for_each(omap_pm_clkdms_setup, NULL);
230 clkdm_add_wkdep(mpu_clkdm, wkup_clkdm); 230 clkdm_add_wkdep(mpu_clkdm, wkup_clkdm);
231 231
232#ifdef CONFIG_SUSPEND 232 omap_common_suspend_init(omap2_enter_full_retention);
233 omap_pm_suspend = omap2_enter_full_retention;
234#endif
235 233
236 /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk 234 /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
237 * stabilisation */ 235 * stabilisation */
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 87099bb6de69..507d8eeaab95 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -50,6 +50,7 @@
50#include "sdrc.h" 50#include "sdrc.h"
51#include "sram.h" 51#include "sram.h"
52#include "control.h" 52#include "control.h"
53#include "vc.h"
53 54
54/* pm34xx errata defined in pm.h */ 55/* pm34xx errata defined in pm.h */
55u16 pm34xx_errata; 56u16 pm34xx_errata;
@@ -288,6 +289,9 @@ void omap_sram_idle(void)
288 } 289 }
289 } 290 }
290 291
292 /* Configure PMIC signaling for I2C4 or sys_off_mode */
293 omap3_vc_set_pmic_signaling(core_next_state);
294
291 omap3_intc_prepare_idle(); 295 omap3_intc_prepare_idle();
292 296
293 /* 297 /*
@@ -391,7 +395,8 @@ restore:
391 395
392 return ret; 396 return ret;
393} 397}
394 398#else
399#define omap3_pm_suspend NULL
395#endif /* CONFIG_SUSPEND */ 400#endif /* CONFIG_SUSPEND */
396 401
397 402
@@ -705,9 +710,7 @@ int __init omap3_pm_init(void)
705 per_clkdm = clkdm_lookup("per_clkdm"); 710 per_clkdm = clkdm_lookup("per_clkdm");
706 wkup_clkdm = clkdm_lookup("wkup_clkdm"); 711 wkup_clkdm = clkdm_lookup("wkup_clkdm");
707 712
708#ifdef CONFIG_SUSPEND 713 omap_common_suspend_init(omap3_pm_suspend);
709 omap_pm_suspend = omap3_pm_suspend;
710#endif
711 714
712 arm_pm_idle = omap3_pm_idle; 715 arm_pm_idle = omap3_pm_idle;
713 omap3_idle_init(); 716 omap3_idle_init();
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index eefb30cfcabd..0dda6cf8b855 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -96,6 +96,8 @@ static int omap4_pm_suspend(void)
96 96
97 return 0; 97 return 0;
98} 98}
99#else
100#define omap4_pm_suspend NULL
99#endif /* CONFIG_SUSPEND */ 101#endif /* CONFIG_SUSPEND */
100 102
101static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) 103static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
@@ -251,9 +253,7 @@ int __init omap4_pm_init(void)
251 253
252 (void) clkdm_for_each(omap_pm_clkdms_setup, NULL); 254 (void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
253 255
254#ifdef CONFIG_SUSPEND 256 omap_common_suspend_init(omap4_pm_suspend);
255 omap_pm_suspend = omap4_pm_suspend;
256#endif
257 257
258 /* Overwrite the default cpu_do_idle() */ 258 /* Overwrite the default cpu_do_idle() */
259 arm_pm_idle = omap_default_idle; 259 arm_pm_idle = omap_default_idle;
diff --git a/arch/arm/mach-omap2/powerdomain-common.c b/arch/arm/mach-omap2/powerdomain-common.c
index c0aeabfcf009..c40e5f009826 100644
--- a/arch/arm/mach-omap2/powerdomain-common.c
+++ b/arch/arm/mach-omap2/powerdomain-common.c
@@ -17,7 +17,6 @@
17#include "pm.h" 17#include "pm.h"
18#include "cm.h" 18#include "cm.h"
19#include "cm-regbits-34xx.h" 19#include "cm-regbits-34xx.h"
20#include "cm-regbits-44xx.h"
21#include "prm-regbits-34xx.h" 20#include "prm-regbits-34xx.h"
22#include "prm-regbits-44xx.h" 21#include "prm-regbits-44xx.h"
23 22
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 93a2a6e4260f..faebd5f076af 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -32,6 +32,7 @@
32 32
33#include "powerdomain.h" 33#include "powerdomain.h"
34#include "clockdomain.h" 34#include "clockdomain.h"
35#include "voltage.h"
35 36
36#include "soc.h" 37#include "soc.h"
37#include "pm.h" 38#include "pm.h"
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index da5a59ae77b6..f4727117f6cc 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -21,8 +21,6 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23 23
24#include "voltage.h"
25
26/* Powerdomain basic power states */ 24/* Powerdomain basic power states */
27#define PWRDM_POWER_OFF 0x0 25#define PWRDM_POWER_OFF 0x0
28#define PWRDM_POWER_RET 0x1 26#define PWRDM_POWER_RET 0x1
@@ -75,6 +73,7 @@
75 73
76struct clockdomain; 74struct clockdomain;
77struct powerdomain; 75struct powerdomain;
76struct voltagedomain;
78 77
79/** 78/**
80 * struct powerdomain - OMAP powerdomain 79 * struct powerdomain - OMAP powerdomain
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 0e841fd9498a..a8e4b582c527 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -428,6 +428,28 @@
428#define MAX_IOPAD_LATCH_TIME 100 428#define MAX_IOPAD_LATCH_TIME 100
429# ifndef __ASSEMBLER__ 429# ifndef __ASSEMBLER__
430 430
431#include <linux/delay.h>
432
433/**
434 * omap_test_timeout - busy-loop, testing a condition
435 * @cond: condition to test until it evaluates to true
436 * @timeout: maximum number of microseconds in the timeout
437 * @index: loop index (integer)
438 *
439 * Loop waiting for @cond to become true or until at least @timeout
440 * microseconds have passed. To use, define some integer @index in the
441 * calling code. After running, if @index == @timeout, then the loop has
442 * timed out.
443 */
444#define omap_test_timeout(cond, timeout, index) \
445({ \
446 for (index = 0; index < timeout; index++) { \
447 if (cond) \
448 break; \
449 udelay(1); \
450 } \
451})
452
431/** 453/**
432 * struct omap_prcm_irq - describes a PRCM interrupt bit 454 * struct omap_prcm_irq - describes a PRCM interrupt bit
433 * @name: a short name describing the interrupt type, e.g. "wkup" or "io" 455 * @name: a short name describing the interrupt type, e.g. "wkup" or "io"
@@ -458,6 +480,7 @@ struct omap_prcm_irq {
458 * @ocp_barrier: fn ptr to force buffered PRM writes to complete 480 * @ocp_barrier: fn ptr to force buffered PRM writes to complete
459 * @save_and_clear_irqen: fn ptr to save and clear IRQENABLE regs 481 * @save_and_clear_irqen: fn ptr to save and clear IRQENABLE regs
460 * @restore_irqen: fn ptr to save and clear IRQENABLE regs 482 * @restore_irqen: fn ptr to save and clear IRQENABLE regs
483 * @reconfigure_io_chain: fn ptr to reconfigure IO chain
461 * @saved_mask: IRQENABLE regs are saved here during suspend 484 * @saved_mask: IRQENABLE regs are saved here during suspend
462 * @priority_mask: 1 bit per IRQ, set to 1 if omap_prcm_irq.priority = true 485 * @priority_mask: 1 bit per IRQ, set to 1 if omap_prcm_irq.priority = true
463 * @base_irq: base dynamic IRQ number, returned from irq_alloc_descs() in init 486 * @base_irq: base dynamic IRQ number, returned from irq_alloc_descs() in init
@@ -479,6 +502,7 @@ struct omap_prcm_irq_setup {
479 void (*ocp_barrier)(void); 502 void (*ocp_barrier)(void);
480 void (*save_and_clear_irqen)(u32 *saved_mask); 503 void (*save_and_clear_irqen)(u32 *saved_mask);
481 void (*restore_irqen)(u32 *saved_mask); 504 void (*restore_irqen)(u32 *saved_mask);
505 void (*reconfigure_io_chain)(void);
482 u32 *saved_mask; 506 u32 *saved_mask;
483 u32 *priority_mask; 507 u32 *priority_mask;
484 int base_irq; 508 int base_irq;
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.c b/arch/arm/mach-omap2/prcm_mpu44xx.c
index c30e44a7fab0..cdbee6326d29 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.c
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.c
@@ -30,12 +30,12 @@ void __iomem *prcm_mpu_base;
30 30
31u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) 31u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
32{ 32{
33 return __raw_readl(OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 33 return readl_relaxed(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
34} 34}
35 35
36void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg) 36void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
37{ 37{
38 __raw_writel(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 38 writel_relaxed(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
39} 39}
40 40
41u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg) 41u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 059bd4f49035..ac9cb4550239 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -26,7 +26,6 @@
26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
27 27
28#include "prcm_mpu_44xx_54xx.h" 28#include "prcm_mpu_44xx_54xx.h"
29#include "common.h"
30 29
31#define OMAP4430_PRCM_MPU_BASE 0x48243000 30#define OMAP4430_PRCM_MPU_BASE 0x48243000
32 31
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h
index cebad565ed37..106132db532b 100644
--- a/arch/arm/mach-omap2/prm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-34xx.h
@@ -123,8 +123,15 @@
123#define OMAP3430_GLOBAL_SW_RST_SHIFT 1 123#define OMAP3430_GLOBAL_SW_RST_SHIFT 1
124#define OMAP3430_GLOBAL_COLD_RST_SHIFT 0 124#define OMAP3430_GLOBAL_COLD_RST_SHIFT 0
125#define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0) 125#define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0)
126#define OMAP3430_SEL_OFF_MASK (1 << 3) 126#define OMAP3430_PRM_VOLTCTRL_SEL_VMODE (1 << 4)
127#define OMAP3430_AUTO_OFF_MASK (1 << 2) 127#define OMAP3430_PRM_VOLTCTRL_SEL_OFF (1 << 3)
128#define OMAP3430_PRM_VOLTCTRL_AUTO_OFF (1 << 2)
129#define OMAP3430_PRM_VOLTCTRL_AUTO_RET (1 << 1)
130#define OMAP3430_PRM_VOLTCTRL_AUTO_SLEEP (1 << 0)
128#define OMAP3430_SETUP_TIME2_MASK (0xffff << 16) 131#define OMAP3430_SETUP_TIME2_MASK (0xffff << 16)
129#define OMAP3430_SETUP_TIME1_MASK (0xffff << 0) 132#define OMAP3430_SETUP_TIME1_MASK (0xffff << 0)
133#define OMAP3430_PRM_POLCTRL_OFFMODE_POL (1 << 3)
134#define OMAP3430_PRM_POLCTRL_CLKOUT_POL (1 << 2)
135#define OMAP3430_PRM_POLCTRL_CLKREQ_POL (1 << 1)
136#define OMAP3430_PRM_POLCTRL_EXTVOL_POL (1 << 0)
130#endif 137#endif
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 623db40fdbbd..48480d557b61 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -17,10 +17,18 @@
17 17
18# ifndef __ASSEMBLER__ 18# ifndef __ASSEMBLER__
19extern void __iomem *prm_base; 19extern void __iomem *prm_base;
20extern u16 prm_features;
20extern void omap2_set_globals_prm(void __iomem *prm); 21extern void omap2_set_globals_prm(void __iomem *prm);
21int of_prcm_init(void); 22int of_prcm_init(void);
22# endif 23# endif
23 24
25/*
26 * prm_features flag values
27 *
28 * PRM_HAS_IO_WAKEUP: has IO wakeup capability
29 * PRM_HAS_VOLTAGE: has voltage domains
30 */
31#define PRM_HAS_IO_WAKEUP (1 << 0)
24 32
25/* 33/*
26 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP 34 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
@@ -118,6 +126,7 @@ struct prm_reset_src_map {
118 * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl 126 * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl
119 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn 127 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn
120 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn 128 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
129 * @late_init: ptr to the late init function
121 * 130 *
122 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are 131 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
123 * deprecated. 132 * deprecated.
@@ -126,6 +135,7 @@ struct prm_ll_data {
126 u32 (*read_reset_sources)(void); 135 u32 (*read_reset_sources)(void);
127 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx); 136 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx);
128 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx); 137 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
138 int (*late_init)(void);
129}; 139};
130 140
131extern int prm_register(struct prm_ll_data *pld); 141extern int prm_register(struct prm_ll_data *pld);
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index 418de9c3b319..a3a3cca2bcc4 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -18,9 +18,6 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include "soc.h"
22#include "common.h"
23#include "vp.h"
24#include "powerdomain.h" 21#include "powerdomain.h"
25#include "clockdomain.h" 22#include "clockdomain.h"
26#include "prm2xxx.h" 23#include "prm2xxx.h"
@@ -201,19 +198,11 @@ static struct prm_ll_data omap2xxx_prm_ll_data = {
201 198
202int __init omap2xxx_prm_init(void) 199int __init omap2xxx_prm_init(void)
203{ 200{
204 if (!cpu_is_omap24xx())
205 return 0;
206
207 return prm_register(&omap2xxx_prm_ll_data); 201 return prm_register(&omap2xxx_prm_ll_data);
208} 202}
209 203
210static void __exit omap2xxx_prm_exit(void) 204static void __exit omap2xxx_prm_exit(void)
211{ 205{
212 if (!cpu_is_omap24xx()) 206 prm_unregister(&omap2xxx_prm_ll_data);
213 return;
214
215 /* Should never happen */
216 WARN(prm_unregister(&omap2xxx_prm_ll_data),
217 "%s: prm_ll_data function pointer mismatch\n", __func__);
218} 207}
219__exitcall(omap2xxx_prm_exit); 208__exitcall(omap2xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
index 3194dd87e0e4..d2cb6365716f 100644
--- a/arch/arm/mach-omap2/prm2xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -27,7 +27,7 @@
27 27
28/* 28/*
29 * OMAP2-specific global PRM registers 29 * OMAP2-specific global PRM registers
30 * Use __raw_{read,write}l() with these registers. 30 * Use {read,write}l_relaxed() with these registers.
31 * 31 *
32 * With a few exceptions, these are the register names beginning with 32 * With a few exceptions, these are the register names beginning with
33 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE 33 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 947f6adfed0c..c13b4e293ffa 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -16,7 +16,6 @@
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18 18
19#include "common.h"
20#include "powerdomain.h" 19#include "powerdomain.h"
21#include "prm2xxx_3xxx.h" 20#include "prm2xxx_3xxx.h"
22#include "prm-regbits-24xx.h" 21#include "prm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index 9624b40836d4..1a3a96392b97 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -55,12 +55,12 @@
55/* Power/reset management domain register get/set */ 55/* Power/reset management domain register get/set */
56static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx) 56static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
57{ 57{
58 return __raw_readl(prm_base + module + idx); 58 return readl_relaxed(prm_base + module + idx);
59} 59}
60 60
61static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) 61static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
62{ 62{
63 __raw_writel(val, prm_base + module + idx); 63 writel_relaxed(val, prm_base + module + idx);
64} 64}
65 65
66/* Read-modify-write a register in a PRM module. Caller must lock */ 66/* Read-modify-write a register in a PRM module. Caller must lock */
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index 720440737744..62709cd2f9c5 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -19,7 +19,6 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include "common.h"
23#include "powerdomain.h" 22#include "powerdomain.h"
24#include "prm33xx.h" 23#include "prm33xx.h"
25#include "prm-regbits-33xx.h" 24#include "prm-regbits-33xx.h"
@@ -27,13 +26,13 @@
27/* Read a register in a PRM instance */ 26/* Read a register in a PRM instance */
28u32 am33xx_prm_read_reg(s16 inst, u16 idx) 27u32 am33xx_prm_read_reg(s16 inst, u16 idx)
29{ 28{
30 return __raw_readl(prm_base + inst + idx); 29 return readl_relaxed(prm_base + inst + idx);
31} 30}
32 31
33/* Write into a register in a PRM instance */ 32/* Write into a register in a PRM instance */
34void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx) 33void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx)
35{ 34{
36 __raw_writel(val, prm_base + inst + idx); 35 writel_relaxed(val, prm_base + inst + idx);
37} 36}
38 37
39/* Read-modify-write a register in PRM. Caller must lock */ 38/* Read-modify-write a register in PRM. Caller must lock */
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index 7721990d2006..4bd7a2dca8af 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -43,6 +43,7 @@ static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
43 .ocp_barrier = &omap3xxx_prm_ocp_barrier, 43 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
44 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, 44 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
45 .restore_irqen = &omap3xxx_prm_restore_irqen, 45 .restore_irqen = &omap3xxx_prm_restore_irqen,
46 .reconfigure_io_chain = &omap3xxx_prm_reconfigure_io_chain,
46}; 47};
47 48
48/* 49/*
@@ -246,7 +247,7 @@ void omap3xxx_prm_reconfigure_io_chain(void)
246 */ 247 */
247static void __init omap3xxx_prm_enable_io_wakeup(void) 248static void __init omap3xxx_prm_enable_io_wakeup(void)
248{ 249{
249 if (omap3_has_io_wakeup()) 250 if (prm_features & PRM_HAS_IO_WAKEUP)
250 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, 251 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
251 PM_WKEN); 252 PM_WKEN);
252} 253}
@@ -400,23 +401,26 @@ struct pwrdm_ops omap3_pwrdm_operations = {
400 * 401 *
401 */ 402 */
402 403
404static int omap3xxx_prm_late_init(void);
405
403static struct prm_ll_data omap3xxx_prm_ll_data = { 406static struct prm_ll_data omap3xxx_prm_ll_data = {
404 .read_reset_sources = &omap3xxx_prm_read_reset_sources, 407 .read_reset_sources = &omap3xxx_prm_read_reset_sources,
408 .late_init = &omap3xxx_prm_late_init,
405}; 409};
406 410
407int __init omap3xxx_prm_init(void) 411int __init omap3xxx_prm_init(void)
408{ 412{
409 if (!cpu_is_omap34xx()) 413 if (omap3_has_io_wakeup())
410 return 0; 414 prm_features |= PRM_HAS_IO_WAKEUP;
411 415
412 return prm_register(&omap3xxx_prm_ll_data); 416 return prm_register(&omap3xxx_prm_ll_data);
413} 417}
414 418
415static int __init omap3xxx_prm_late_init(void) 419static int omap3xxx_prm_late_init(void)
416{ 420{
417 int ret; 421 int ret;
418 422
419 if (!cpu_is_omap34xx()) 423 if (!(prm_features & PRM_HAS_IO_WAKEUP))
420 return 0; 424 return 0;
421 425
422 omap3xxx_prm_enable_io_wakeup(); 426 omap3xxx_prm_enable_io_wakeup();
@@ -427,15 +431,9 @@ static int __init omap3xxx_prm_late_init(void)
427 431
428 return ret; 432 return ret;
429} 433}
430omap_subsys_initcall(omap3xxx_prm_late_init);
431 434
432static void __exit omap3xxx_prm_exit(void) 435static void __exit omap3xxx_prm_exit(void)
433{ 436{
434 if (!cpu_is_omap34xx()) 437 prm_unregister(&omap3xxx_prm_ll_data);
435 return;
436
437 /* Should never happen */
438 WARN(prm_unregister(&omap3xxx_prm_ll_data),
439 "%s: prm_ll_data function pointer mismatch\n", __func__);
440} 438}
441__exitcall(omap3xxx_prm_exit); 439__exitcall(omap3xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
index f8eb83323b1a..1dacfc5b1959 100644
--- a/arch/arm/mach-omap2/prm3xxx.h
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -26,7 +26,7 @@
26 26
27/* 27/*
28 * OMAP3-specific global PRM registers 28 * OMAP3-specific global PRM registers
29 * Use __raw_{read,write}l() with these registers. 29 * Use {read,write}l_relaxed() with these registers.
30 * 30 *
31 * With a few exceptions, these are the register names beginning with 31 * With a few exceptions, these are the register names beginning with
32 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE 32 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 03a603476cfc..a7f6ea27180a 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -47,6 +47,7 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
47 .ocp_barrier = &omap44xx_prm_ocp_barrier, 47 .ocp_barrier = &omap44xx_prm_ocp_barrier,
48 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen, 48 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen,
49 .restore_irqen = &omap44xx_prm_restore_irqen, 49 .restore_irqen = &omap44xx_prm_restore_irqen,
50 .reconfigure_io_chain = &omap44xx_prm_reconfigure_io_chain,
50}; 51};
51 52
52/* 53/*
@@ -81,13 +82,13 @@ static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
81/* Read a register in a CM/PRM instance in the PRM module */ 82/* Read a register in a CM/PRM instance in the PRM module */
82u32 omap4_prm_read_inst_reg(s16 inst, u16 reg) 83u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
83{ 84{
84 return __raw_readl(prm_base + inst + reg); 85 return readl_relaxed(prm_base + inst + reg);
85} 86}
86 87
87/* Write into a register in a CM/PRM instance in the PRM module */ 88/* Write into a register in a CM/PRM instance in the PRM module */
88void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg) 89void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
89{ 90{
90 __raw_writel(val, prm_base + inst + reg); 91 writel_relaxed(val, prm_base + inst + reg);
91} 92}
92 93
93/* Read-modify-write a register in a PRM module. Caller must lock */ 94/* Read-modify-write a register in a PRM module. Caller must lock */
@@ -649,6 +650,8 @@ struct pwrdm_ops omap4_pwrdm_operations = {
649 .pwrdm_has_voltdm = omap4_check_vcvp, 650 .pwrdm_has_voltdm = omap4_check_vcvp,
650}; 651};
651 652
653static int omap44xx_prm_late_init(void);
654
652/* 655/*
653 * XXX document 656 * XXX document
654 */ 657 */
@@ -656,34 +659,29 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
656 .read_reset_sources = &omap44xx_prm_read_reset_sources, 659 .read_reset_sources = &omap44xx_prm_read_reset_sources,
657 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old, 660 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
658 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old, 661 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
662 .late_init = &omap44xx_prm_late_init,
659}; 663};
660 664
661int __init omap44xx_prm_init(void) 665int __init omap44xx_prm_init(void)
662{ 666{
663 if (!cpu_is_omap44xx() && !soc_is_omap54xx() && !soc_is_dra7xx()) 667 if (cpu_is_omap44xx())
664 return 0; 668 prm_features |= PRM_HAS_IO_WAKEUP;
665 669
666 return prm_register(&omap44xx_prm_ll_data); 670 return prm_register(&omap44xx_prm_ll_data);
667} 671}
668 672
669static int __init omap44xx_prm_late_init(void) 673static int omap44xx_prm_late_init(void)
670{ 674{
671 if (!cpu_is_omap44xx()) 675 if (!(prm_features & PRM_HAS_IO_WAKEUP))
672 return 0; 676 return 0;
673 677
674 omap44xx_prm_enable_io_wakeup(); 678 omap44xx_prm_enable_io_wakeup();
675 679
676 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); 680 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
677} 681}
678omap_subsys_initcall(omap44xx_prm_late_init);
679 682
680static void __exit omap44xx_prm_exit(void) 683static void __exit omap44xx_prm_exit(void)
681{ 684{
682 if (!cpu_is_omap44xx()) 685 prm_unregister(&omap44xx_prm_ll_data);
683 return;
684
685 /* Should never happen */
686 WARN(prm_unregister(&omap44xx_prm_ll_data),
687 "%s: prm_ll_data function pointer mismatch\n", __func__);
688} 686}
689__exitcall(omap44xx_prm_exit); 687__exitcall(omap44xx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index b4c4ab9c8044..25e8b8232115 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -62,6 +62,8 @@ static struct omap_prcm_irq_setup *prcm_irq_setup;
62/* prm_base: base virtual address of the PRM IP block */ 62/* prm_base: base virtual address of the PRM IP block */
63void __iomem *prm_base; 63void __iomem *prm_base;
64 64
65u16 prm_features;
66
65/* 67/*
66 * prm_ll_data: function pointers to SoC-specific implementations of 68 * prm_ll_data: function pointers to SoC-specific implementations of
67 * common PRM functions 69 * common PRM functions
@@ -330,12 +332,7 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
330 332
331 if (of_have_populated_dt()) { 333 if (of_have_populated_dt()) {
332 int irq = omap_prcm_event_to_irq("io"); 334 int irq = omap_prcm_event_to_irq("io");
333 if (cpu_is_omap34xx()) 335 omap_pcs_legacy_init(irq, irq_setup->reconfigure_io_chain);
334 omap_pcs_legacy_init(irq,
335 omap3xxx_prm_reconfigure_io_chain);
336 else
337 omap_pcs_legacy_init(irq,
338 omap44xx_prm_reconfigure_io_chain);
339 } 336 }
340 337
341 return 0; 338 return 0;
@@ -530,3 +527,11 @@ int __init of_prcm_init(void)
530 527
531 return 0; 528 return 0;
532} 529}
530
531static int __init prm_late_init(void)
532{
533 if (prm_ll_data->late_init)
534 return prm_ll_data->late_init();
535 return 0;
536}
537subsys_initcall(prm_late_init);
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 05fcf6de44ee..69f0dd08629c 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -49,7 +49,7 @@ u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
49 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 49 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
50 part == OMAP4430_INVALID_PRCM_PARTITION || 50 part == OMAP4430_INVALID_PRCM_PARTITION ||
51 !_prm_bases[part]); 51 !_prm_bases[part]);
52 return __raw_readl(_prm_bases[part] + inst + idx); 52 return readl_relaxed(_prm_bases[part] + inst + idx);
53} 53}
54 54
55/* Write into a register in a PRM instance */ 55/* Write into a register in a PRM instance */
@@ -58,7 +58,7 @@ void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
58 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 58 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
59 part == OMAP4430_INVALID_PRCM_PARTITION || 59 part == OMAP4430_INVALID_PRCM_PARTITION ||
60 !_prm_bases[part]); 60 !_prm_bases[part]);
61 __raw_writel(val, _prm_bases[part] + inst + idx); 61 writel_relaxed(val, _prm_bases[part] + inst + idx);
62} 62}
63 63
64/* Read-modify-write a register in PRM. Caller must lock */ 64/* Read-modify-write a register in PRM. Caller must lock */
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index 446aa13511fd..645a2a46b213 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -31,24 +31,24 @@ extern void __iomem *omap2_sms_base;
31 31
32static inline void sdrc_write_reg(u32 val, u16 reg) 32static inline void sdrc_write_reg(u32 val, u16 reg)
33{ 33{
34 __raw_writel(val, OMAP_SDRC_REGADDR(reg)); 34 writel_relaxed(val, OMAP_SDRC_REGADDR(reg));
35} 35}
36 36
37static inline u32 sdrc_read_reg(u16 reg) 37static inline u32 sdrc_read_reg(u16 reg)
38{ 38{
39 return __raw_readl(OMAP_SDRC_REGADDR(reg)); 39 return readl_relaxed(OMAP_SDRC_REGADDR(reg));
40} 40}
41 41
42/* SMS global register get/set */ 42/* SMS global register get/set */
43 43
44static inline void sms_write_reg(u32 val, u16 reg) 44static inline void sms_write_reg(u32 val, u16 reg)
45{ 45{
46 __raw_writel(val, OMAP_SMS_REGADDR(reg)); 46 writel_relaxed(val, OMAP_SMS_REGADDR(reg));
47} 47}
48 48
49static inline u32 sms_read_reg(u16 reg) 49static inline u32 sms_read_reg(u16 reg)
50{ 50{
51 return __raw_readl(OMAP_SMS_REGADDR(reg)); 51 return readl_relaxed(OMAP_SMS_REGADDR(reg));
52} 52}
53 53
54extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms); 54extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms);
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index 907291714643..ae3f1553158d 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -103,9 +103,9 @@ u32 omap2xxx_sdrc_reprogram(u32 level, u32 force)
103 * prm2xxx.c function 103 * prm2xxx.c function
104 */ 104 */
105 if (cpu_is_omap2420()) 105 if (cpu_is_omap2420())
106 __raw_writel(0xffff, OMAP2420_PRCM_VOLTSETUP); 106 writel_relaxed(0xffff, OMAP2420_PRCM_VOLTSETUP);
107 else 107 else
108 __raw_writel(0xffff, OMAP2430_PRCM_VOLTSETUP); 108 writel_relaxed(0xffff, OMAP2430_PRCM_VOLTSETUP);
109 omap2_sram_reprogram_sdrc(level, dll_ctrl, m_type); 109 omap2_sram_reprogram_sdrc(level, dll_ctrl, m_type);
110 curr_perf_level = level; 110 curr_perf_level = level;
111 local_irq_restore(flags); 111 local_irq_restore(flags);
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index 30abcc8b20e0..de2a34c423a7 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -459,10 +459,15 @@ IS_OMAP_TYPE(3430, 0x3430)
459#define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8)) 459#define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8))
460#define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8)) 460#define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8))
461 461
462#define DRA7XX_CLASS 0x07000000
463#define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8))
464#define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8))
465
462void omap2xxx_check_revision(void); 466void omap2xxx_check_revision(void);
463void omap3xxx_check_revision(void); 467void omap3xxx_check_revision(void);
464void omap4xxx_check_revision(void); 468void omap4xxx_check_revision(void);
465void omap5xxx_check_revision(void); 469void omap5xxx_check_revision(void);
470void dra7xxx_check_revision(void);
466void omap3xxx_check_features(void); 471void omap3xxx_check_features(void);
467void ti81xx_check_features(void); 472void ti81xx_check_features(void);
468void am33xx_check_features(void); 473void am33xx_check_features(void);
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index d7bc33f15344..1b91ef0c182a 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -57,7 +57,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
57 57
58 /* 58 /*
59 * In OMAP4 the efuse registers are 24 bit aligned. 59 * In OMAP4 the efuse registers are 24 bit aligned.
60 * A __raw_readl will fail for non-32 bit aligned address 60 * A readl_relaxed will fail for non-32 bit aligned address
61 * and hence the 8-bit read and shift. 61 * and hence the 8-bit read and shift.
62 */ 62 */
63 if (cpu_is_omap44xx()) { 63 if (cpu_is_omap44xx()) {
diff --git a/arch/arm/mach-omap2/sram.c b/arch/arm/mach-omap2/sram.c
index 4bd096836235..ddf1818af228 100644
--- a/arch/arm/mach-omap2/sram.c
+++ b/arch/arm/mach-omap2/sram.c
@@ -70,16 +70,16 @@ static int is_sram_locked(void)
70 if (OMAP2_DEVICE_TYPE_GP == omap_type()) { 70 if (OMAP2_DEVICE_TYPE_GP == omap_type()) {
71 /* RAMFW: R/W access to all initiators for all qualifier sets */ 71 /* RAMFW: R/W access to all initiators for all qualifier sets */
72 if (cpu_is_omap242x()) { 72 if (cpu_is_omap242x()) {
73 __raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */ 73 writel_relaxed(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */
74 __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */ 74 writel_relaxed(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */
75 __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */ 75 writel_relaxed(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
76 } 76 }
77 if (cpu_is_omap34xx()) { 77 if (cpu_is_omap34xx()) {
78 __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */ 78 writel_relaxed(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
79 __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */ 79 writel_relaxed(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */
80 __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */ 80 writel_relaxed(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
81 __raw_writel(0x0, OMAP34XX_VA_ADDR_MATCH2); 81 writel_relaxed(0x0, OMAP34XX_VA_ADDR_MATCH2);
82 __raw_writel(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0); 82 writel_relaxed(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0);
83 } 83 }
84 return 0; 84 return 0;
85 } else 85 } else
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index b62de9f9d05c..43d03fbf4c0b 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -361,7 +361,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
361 361
362/* Clocksource code */ 362/* Clocksource code */
363static struct omap_dm_timer clksrc; 363static struct omap_dm_timer clksrc;
364static bool use_gptimer_clksrc; 364static bool use_gptimer_clksrc __initdata;
365 365
366/* 366/*
367 * clocksource 367 * clocksource
@@ -546,15 +546,15 @@ static void __init realtime_counter_init(void)
546 } 546 }
547 547
548 /* Program numerator and denumerator registers */ 548 /* Program numerator and denumerator registers */
549 reg = __raw_readl(base + INCREMENTER_NUMERATOR_OFFSET) & 549 reg = readl_relaxed(base + INCREMENTER_NUMERATOR_OFFSET) &
550 NUMERATOR_DENUMERATOR_MASK; 550 NUMERATOR_DENUMERATOR_MASK;
551 reg |= num; 551 reg |= num;
552 __raw_writel(reg, base + INCREMENTER_NUMERATOR_OFFSET); 552 writel_relaxed(reg, base + INCREMENTER_NUMERATOR_OFFSET);
553 553
554 reg = __raw_readl(base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET) & 554 reg = readl_relaxed(base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET) &
555 NUMERATOR_DENUMERATOR_MASK; 555 NUMERATOR_DENUMERATOR_MASK;
556 reg |= den; 556 reg |= den;
557 __raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET); 557 writel_relaxed(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
558 558
559 arch_timer_freq = (rate / den) * num; 559 arch_timer_freq = (rate / den) * num;
560 set_cntfreq(); 560 set_cntfreq();
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 49ac7977e03e..a4628a9e760c 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -220,10 +220,126 @@ static inline u32 omap_usec_to_32k(u32 usec)
220 return DIV_ROUND_UP_ULL(32768ULL * (u64)usec, 1000000ULL); 220 return DIV_ROUND_UP_ULL(32768ULL * (u64)usec, 1000000ULL);
221} 221}
222 222
223/* Set oscillator setup time for omap3 */ 223struct omap3_vc_timings {
224static void omap3_set_clksetup(u32 usec, struct voltagedomain *voltdm) 224 u32 voltsetup1;
225 u32 voltsetup2;
226};
227
228struct omap3_vc {
229 struct voltagedomain *vd;
230 u32 voltctrl;
231 u32 voltsetup1;
232 u32 voltsetup2;
233 struct omap3_vc_timings timings[2];
234};
235static struct omap3_vc vc;
236
237void omap3_vc_set_pmic_signaling(int core_next_state)
238{
239 struct voltagedomain *vd = vc.vd;
240 struct omap3_vc_timings *c = vc.timings;
241 u32 voltctrl, voltsetup1, voltsetup2;
242
243 voltctrl = vc.voltctrl;
244 voltsetup1 = vc.voltsetup1;
245 voltsetup2 = vc.voltsetup2;
246
247 switch (core_next_state) {
248 case PWRDM_POWER_OFF:
249 voltctrl &= ~(OMAP3430_PRM_VOLTCTRL_AUTO_RET |
250 OMAP3430_PRM_VOLTCTRL_AUTO_SLEEP);
251 voltctrl |= OMAP3430_PRM_VOLTCTRL_AUTO_OFF;
252 if (voltctrl & OMAP3430_PRM_VOLTCTRL_SEL_OFF)
253 voltsetup2 = c->voltsetup2;
254 else
255 voltsetup1 = c->voltsetup1;
256 break;
257 case PWRDM_POWER_RET:
258 default:
259 c++;
260 voltctrl &= ~(OMAP3430_PRM_VOLTCTRL_AUTO_OFF |
261 OMAP3430_PRM_VOLTCTRL_AUTO_SLEEP);
262 voltctrl |= OMAP3430_PRM_VOLTCTRL_AUTO_RET;
263 voltsetup1 = c->voltsetup1;
264 break;
265 }
266
267 if (voltctrl != vc.voltctrl) {
268 vd->write(voltctrl, OMAP3_PRM_VOLTCTRL_OFFSET);
269 vc.voltctrl = voltctrl;
270 }
271 if (voltsetup1 != vc.voltsetup1) {
272 vd->write(c->voltsetup1,
273 OMAP3_PRM_VOLTSETUP1_OFFSET);
274 vc.voltsetup1 = voltsetup1;
275 }
276 if (voltsetup2 != vc.voltsetup2) {
277 vd->write(c->voltsetup2,
278 OMAP3_PRM_VOLTSETUP2_OFFSET);
279 vc.voltsetup2 = voltsetup2;
280 }
281}
282
283#define PRM_POLCTRL_TWL_MASK (OMAP3430_PRM_POLCTRL_CLKREQ_POL | \
284 OMAP3430_PRM_POLCTRL_CLKREQ_POL)
285#define PRM_POLCTRL_TWL_VAL OMAP3430_PRM_POLCTRL_CLKREQ_POL
286
287/*
288 * Configure signal polarity for sys_clkreq and sys_off_mode pins
289 * as the default values are wrong and can cause the system to hang
290 * if any twl4030 scripts are loaded.
291 */
292static void __init omap3_vc_init_pmic_signaling(struct voltagedomain *voltdm)
293{
294 u32 val;
295
296 if (vc.vd)
297 return;
298
299 vc.vd = voltdm;
300
301 val = voltdm->read(OMAP3_PRM_POLCTRL_OFFSET);
302 if (!(val & OMAP3430_PRM_POLCTRL_CLKREQ_POL) ||
303 (val & OMAP3430_PRM_POLCTRL_CLKREQ_POL)) {
304 val |= OMAP3430_PRM_POLCTRL_CLKREQ_POL;
305 val &= ~OMAP3430_PRM_POLCTRL_OFFMODE_POL;
306 pr_debug("PM: fixing sys_clkreq and sys_off_mode polarity to 0x%x\n",
307 val);
308 voltdm->write(val, OMAP3_PRM_POLCTRL_OFFSET);
309 }
310
311 /*
312 * By default let's use I2C4 signaling for retention idle
313 * and sys_off_mode pin signaling for off idle. This way we
314 * have sys_clk_req pin go down for retention and both
315 * sys_clk_req and sys_off_mode pins will go down for off
316 * idle. And we can also scale voltages to zero for off-idle.
317 * Note that no actual voltage scaling during off-idle will
318 * happen unless the board specific twl4030 PMIC scripts are
319 * loaded.
320 */
321 val = voltdm->read(OMAP3_PRM_VOLTCTRL_OFFSET);
322 if (!(val & OMAP3430_PRM_VOLTCTRL_SEL_OFF)) {
323 val |= OMAP3430_PRM_VOLTCTRL_SEL_OFF;
324 pr_debug("PM: setting voltctrl sys_off_mode signaling to 0x%x\n",
325 val);
326 voltdm->write(val, OMAP3_PRM_VOLTCTRL_OFFSET);
327 }
328 vc.voltctrl = val;
329
330 omap3_vc_set_pmic_signaling(PWRDM_POWER_ON);
331}
332
333static void omap3_init_voltsetup1(struct voltagedomain *voltdm,
334 struct omap3_vc_timings *c, u32 idle)
225{ 335{
226 voltdm->write(omap_usec_to_32k(usec), OMAP3_PRM_CLKSETUP_OFFSET); 336 unsigned long val;
337
338 val = (voltdm->vc_param->on - idle) / voltdm->pmic->slew_rate;
339 val *= voltdm->sys_clk.rate / 8 / 1000000 + 1;
340 val <<= __ffs(voltdm->vfsm->voltsetup_mask);
341 c->voltsetup1 &= ~voltdm->vfsm->voltsetup_mask;
342 c->voltsetup1 |= val;
227} 343}
228 344
229/** 345/**
@@ -236,37 +352,21 @@ static void omap3_set_clksetup(u32 usec, struct voltagedomain *voltdm)
236 * or retention. Off mode has additionally an option to use sys_off_mode 352 * or retention. Off mode has additionally an option to use sys_off_mode
237 * pad, which uses a global signal to program the whole power IC to 353 * pad, which uses a global signal to program the whole power IC to
238 * off-mode. 354 * off-mode.
355 *
356 * Note that pmic is not controlling the voltage scaling during
357 * retention signaled over I2C4, so we can keep voltsetup2 as 0.
358 * And the oscillator is not shut off over I2C4, so no need to
359 * set clksetup.
239 */ 360 */
240static void omap3_set_i2c_timings(struct voltagedomain *voltdm, bool off_mode) 361static void omap3_set_i2c_timings(struct voltagedomain *voltdm)
241{ 362{
242 unsigned long voltsetup1; 363 struct omap3_vc_timings *c = vc.timings;
243 u32 tgt_volt;
244
245 /*
246 * Oscillator is shut down only if we are using sys_off_mode pad,
247 * thus we set a minimal setup time here
248 */
249 omap3_set_clksetup(1, voltdm);
250 364
251 if (off_mode) 365 /* Configure PRWDM_POWER_OFF over I2C4 */
252 tgt_volt = voltdm->vc_param->off; 366 omap3_init_voltsetup1(voltdm, c, voltdm->vc_param->off);
253 else 367 c++;
254 tgt_volt = voltdm->vc_param->ret; 368 /* Configure PRWDM_POWER_RET over I2C4 */
255 369 omap3_init_voltsetup1(voltdm, c, voltdm->vc_param->ret);
256 voltsetup1 = (voltdm->vc_param->on - tgt_volt) /
257 voltdm->pmic->slew_rate;
258
259 voltsetup1 = voltsetup1 * voltdm->sys_clk.rate / 8 / 1000000 + 1;
260
261 voltdm->rmw(voltdm->vfsm->voltsetup_mask,
262 voltsetup1 << __ffs(voltdm->vfsm->voltsetup_mask),
263 voltdm->vfsm->voltsetup_reg);
264
265 /*
266 * pmic is not controlling the voltage scaling during retention,
267 * thus set voltsetup2 to 0
268 */
269 voltdm->write(0, OMAP3_PRM_VOLTSETUP2_OFFSET);
270} 370}
271 371
272/** 372/**
@@ -275,69 +375,49 @@ static void omap3_set_i2c_timings(struct voltagedomain *voltdm, bool off_mode)
275 * 375 *
276 * Calculates and sets up off-mode timings for a channel. Off-mode 376 * Calculates and sets up off-mode timings for a channel. Off-mode
277 * can use either I2C based voltage scaling, or alternatively 377 * can use either I2C based voltage scaling, or alternatively
278 * sys_off_mode pad can be used to send a global command to power IC. 378 * sys_off_mode pad can be used to send a global command to power IC.n,
279 * This function first checks which mode is being used, and calls
280 * omap3_set_i2c_timings() if the system is using I2C control mode.
281 * sys_off_mode has the additional benefit that voltages can be 379 * sys_off_mode has the additional benefit that voltages can be
282 * scaled to zero volt level with TWL4030 / TWL5030, I2C can only 380 * scaled to zero volt level with TWL4030 / TWL5030, I2C can only
283 * scale to 600mV. 381 * scale to 600mV.
382 *
383 * Note that omap is not controlling the voltage scaling during
384 * off idle signaled by sys_off_mode, so we can keep voltsetup1
385 * as 0.
284 */ 386 */
285static void omap3_set_off_timings(struct voltagedomain *voltdm) 387static void omap3_set_off_timings(struct voltagedomain *voltdm)
286{ 388{
287 unsigned long clksetup; 389 struct omap3_vc_timings *c = vc.timings;
288 unsigned long voltsetup2; 390 u32 tstart, tshut, clksetup, voltoffset;
289 unsigned long voltsetup2_old;
290 u32 val;
291 u32 tstart, tshut;
292 391
293 /* check if sys_off_mode is used to control off-mode voltages */ 392 if (c->voltsetup2)
294 val = voltdm->read(OMAP3_PRM_VOLTCTRL_OFFSET);
295 if (!(val & OMAP3430_SEL_OFF_MASK)) {
296 /* No, omap is controlling them over I2C */
297 omap3_set_i2c_timings(voltdm, true);
298 return; 393 return;
299 }
300 394
301 omap_pm_get_oscillator(&tstart, &tshut); 395 omap_pm_get_oscillator(&tstart, &tshut);
302 omap3_set_clksetup(tstart, voltdm); 396 if (tstart == ULONG_MAX) {
303 397 pr_debug("PM: oscillator start-up time not initialized, using 10ms\n");
304 clksetup = voltdm->read(OMAP3_PRM_CLKSETUP_OFFSET); 398 clksetup = omap_usec_to_32k(10000);
305 399 } else {
306 /* voltsetup 2 in us */ 400 clksetup = omap_usec_to_32k(tstart);
307 voltsetup2 = voltdm->vc_param->on / voltdm->pmic->slew_rate; 401 }
308
309 /* convert to 32k clk cycles */
310 voltsetup2 = DIV_ROUND_UP(voltsetup2 * 32768, 1000000);
311
312 voltsetup2_old = voltdm->read(OMAP3_PRM_VOLTSETUP2_OFFSET);
313
314 /*
315 * Update voltsetup2 if higher than current value (needed because
316 * we have multiple channels with different ramp times), also
317 * update voltoffset always to value recommended by TRM
318 */
319 if (voltsetup2 > voltsetup2_old) {
320 voltdm->write(voltsetup2, OMAP3_PRM_VOLTSETUP2_OFFSET);
321 voltdm->write(clksetup - voltsetup2,
322 OMAP3_PRM_VOLTOFFSET_OFFSET);
323 } else
324 voltdm->write(clksetup - voltsetup2_old,
325 OMAP3_PRM_VOLTOFFSET_OFFSET);
326 402
327 /* 403 /*
328 * omap is not controlling voltage scaling during off-mode, 404 * For twl4030 errata 27, we need to allow minimum ~488.32 us wait to
329 * thus set voltsetup1 to 0 405 * switch from HFCLKIN to internal oscillator. That means timings
406 * have voltoffset fixed to 0xa in rounded up 32 KiHz cycles. And
407 * that means we can calculate the value based on the oscillator
408 * start-up time since voltoffset2 = clksetup - voltoffset.
330 */ 409 */
331 voltdm->rmw(voltdm->vfsm->voltsetup_mask, 0, 410 voltoffset = omap_usec_to_32k(488);
332 voltdm->vfsm->voltsetup_reg); 411 c->voltsetup2 = clksetup - voltoffset;
333 412 voltdm->write(clksetup, OMAP3_PRM_CLKSETUP_OFFSET);
334 /* voltoffset must be clksetup minus voltsetup2 according to TRM */ 413 voltdm->write(voltoffset, OMAP3_PRM_VOLTOFFSET_OFFSET);
335 voltdm->write(clksetup - voltsetup2, OMAP3_PRM_VOLTOFFSET_OFFSET);
336} 414}
337 415
338static void __init omap3_vc_init_channel(struct voltagedomain *voltdm) 416static void __init omap3_vc_init_channel(struct voltagedomain *voltdm)
339{ 417{
418 omap3_vc_init_pmic_signaling(voltdm);
340 omap3_set_off_timings(voltdm); 419 omap3_set_off_timings(voltdm);
420 omap3_set_i2c_timings(voltdm);
341} 421}
342 422
343/** 423/**
@@ -462,7 +542,7 @@ static void omap4_set_timings(struct voltagedomain *voltdm, bool off_mode)
462 val |= omap4_usec_to_val_scrm(tshut, OMAP4_DOWNTIME_SHIFT, 542 val |= omap4_usec_to_val_scrm(tshut, OMAP4_DOWNTIME_SHIFT,
463 OMAP4_DOWNTIME_MASK); 543 OMAP4_DOWNTIME_MASK);
464 544
465 __raw_writel(val, OMAP4_SCRM_CLKSETUPTIME); 545 writel_relaxed(val, OMAP4_SCRM_CLKSETUPTIME);
466} 546}
467 547
468/* OMAP4 specific voltage init functions */ 548/* OMAP4 specific voltage init functions */
@@ -584,7 +664,7 @@ static void __init omap4_vc_i2c_timing_init(struct voltagedomain *voltdm)
584 val = i2c_data->loadbits << 25 | i2c_data->loadbits << 29; 664 val = i2c_data->loadbits << 25 | i2c_data->loadbits << 29;
585 665
586 /* Write to SYSCTRL_PADCONF_WKUP_CTRL_I2C_2 to setup I2C pull */ 666 /* Write to SYSCTRL_PADCONF_WKUP_CTRL_I2C_2 to setup I2C pull */
587 __raw_writel(val, OMAP2_L4_IO_ADDRESS(OMAP4_CTRL_MODULE_PAD_WKUP + 667 writel_relaxed(val, OMAP2_L4_IO_ADDRESS(OMAP4_CTRL_MODULE_PAD_WKUP +
588 OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2)); 668 OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2));
589 669
590 /* HSSCLH can always be zero */ 670 /* HSSCLH can always be zero */
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 91c8d75bf2ea..cdbdd78e755e 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -117,6 +117,9 @@ extern struct omap_vc_param omap4_mpu_vc_data;
117extern struct omap_vc_param omap4_iva_vc_data; 117extern struct omap_vc_param omap4_iva_vc_data;
118extern struct omap_vc_param omap4_core_vc_data; 118extern struct omap_vc_param omap4_core_vc_data;
119 119
120void omap3_vc_set_pmic_signaling(int core_next_state);
121
122
120void omap_vc_init_channel(struct voltagedomain *voltdm); 123void omap_vc_init_channel(struct voltagedomain *voltdm);
121int omap_vc_pre_scale(struct voltagedomain *voltdm, 124int omap_vc_pre_scale(struct voltagedomain *voltdm,
122 unsigned long target_volt, 125 unsigned long target_volt,
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index d15c7bbab8e2..97d6607d447a 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -49,12 +49,12 @@ int omap2_wd_timer_disable(struct omap_hwmod *oh)
49 } 49 }
50 50
51 /* sequence required to disable watchdog */ 51 /* sequence required to disable watchdog */
52 __raw_writel(0xAAAA, base + OMAP_WDT_SPR); 52 writel_relaxed(0xAAAA, base + OMAP_WDT_SPR);
53 while (__raw_readl(base + OMAP_WDT_WPS) & 0x10) 53 while (readl_relaxed(base + OMAP_WDT_WPS) & 0x10)
54 cpu_relax(); 54 cpu_relax();
55 55
56 __raw_writel(0x5555, base + OMAP_WDT_SPR); 56 writel_relaxed(0x5555, base + OMAP_WDT_SPR);
57 while (__raw_readl(base + OMAP_WDT_WPS) & 0x10) 57 while (readl_relaxed(base + OMAP_WDT_WPS) & 0x10)
58 cpu_relax(); 58 cpu_relax();
59 59
60 return 0; 60 return 0;
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index db7e056493a0..26d6f34b6027 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -21,7 +21,7 @@ struct mv_sata_platform_data;
21#define ORION_MBUS_DEVBUS_BOOT_ATTR 0x0f 21#define ORION_MBUS_DEVBUS_BOOT_ATTR 0x0f
22#define ORION_MBUS_DEVBUS_TARGET(cs) 0x01 22#define ORION_MBUS_DEVBUS_TARGET(cs) 0x01
23#define ORION_MBUS_DEVBUS_ATTR(cs) (~(1 << cs)) 23#define ORION_MBUS_DEVBUS_ATTR(cs) (~(1 << cs))
24#define ORION_MBUS_SRAM_TARGET 0x00 24#define ORION_MBUS_SRAM_TARGET 0x09
25#define ORION_MBUS_SRAM_ATTR 0x00 25#define ORION_MBUS_SRAM_ATTR 0x00
26 26
27/* 27/*
diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
index 4887a2a4c698..3dffcb2d714e 100644
--- a/arch/arm/mach-prima2/rstc.c
+++ b/arch/arm/mach-prima2/rstc.c
@@ -36,27 +36,33 @@ static int sirfsoc_reset_module(struct reset_controller_dev *rcdev,
36 36
37 if (of_device_is_compatible(rcdev->of_node, "sirf,prima2-rstc")) { 37 if (of_device_is_compatible(rcdev->of_node, "sirf,prima2-rstc")) {
38 /* 38 /*
39 * Writing 1 to this bit resets corresponding block. Writing 0 to this 39 * Writing 1 to this bit resets corresponding block.
40 * bit de-asserts reset signal of the corresponding block. 40 * Writing 0 to this bit de-asserts reset signal of the
41 * datasheet doesn't require explicit delay between the set and clear 41 * corresponding block. datasheet doesn't require explicit
42 * of reset bit. it could be shorter if tests pass. 42 * delay between the set and clear of reset bit. it could
43 * be shorter if tests pass.
43 */ 44 */
44 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) | (1 << reset_bit), 45 writel(readl(sirfsoc_rstc_base +
46 (reset_bit / 32) * 4) | (1 << reset_bit),
45 sirfsoc_rstc_base + (reset_bit / 32) * 4); 47 sirfsoc_rstc_base + (reset_bit / 32) * 4);
46 msleep(10); 48 msleep(20);
47 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) & ~(1 << reset_bit), 49 writel(readl(sirfsoc_rstc_base +
50 (reset_bit / 32) * 4) & ~(1 << reset_bit),
48 sirfsoc_rstc_base + (reset_bit / 32) * 4); 51 sirfsoc_rstc_base + (reset_bit / 32) * 4);
49 } else { 52 } else {
50 /* 53 /*
51 * For MARCO and POLO 54 * For MARCO and POLO
52 * Writing 1 to SET register resets corresponding block. Writing 1 to CLEAR 55 * Writing 1 to SET register resets corresponding block.
53 * register de-asserts reset signal of the corresponding block. 56 * Writing 1 to CLEAR register de-asserts reset signal of the
54 * datasheet doesn't require explicit delay between the set and clear 57 * corresponding block.
55 * of reset bit. it could be shorter if tests pass. 58 * datasheet doesn't require explicit delay between the set and
59 * clear of reset bit. it could be shorter if tests pass.
56 */ 60 */
57 writel(1 << reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8); 61 writel(1 << reset_bit,
58 msleep(10); 62 sirfsoc_rstc_base + (reset_bit / 32) * 8);
59 writel(1 << reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8 + 4); 63 msleep(20);
64 writel(1 << reset_bit,
65 sirfsoc_rstc_base + (reset_bit / 32) * 8 + 4);
60 } 66 }
61 67
62 mutex_unlock(&rstc_lock); 68 mutex_unlock(&rstc_lock);
diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig
index a028be234334..fd2b99dceb89 100644
--- a/arch/arm/mach-qcom/Kconfig
+++ b/arch/arm/mach-qcom/Kconfig
@@ -2,9 +2,9 @@ config 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
5 select ARM_AMBA
5 select CLKSRC_OF 6 select CLKSRC_OF
6 select GENERIC_CLOCKEVENTS 7 select PINCTRL
7 select HAVE_SMP
8 select QCOM_SCM if SMP 8 select QCOM_SCM if SMP
9 help 9 help
10 Support for Qualcomm's devicetree based systems. 10 Support for Qualcomm's devicetree based systems.
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 1d5ee5c9a1dc..960b8dd78c44 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -148,6 +148,21 @@ struct platform_device realview_cf_device = {
148 }, 148 },
149}; 149};
150 150
151static struct resource realview_leds_resources[] = {
152 {
153 .start = REALVIEW_SYS_BASE + REALVIEW_SYS_LED_OFFSET,
154 .end = REALVIEW_SYS_BASE + REALVIEW_SYS_LED_OFFSET + 4,
155 .flags = IORESOURCE_MEM,
156 },
157};
158
159struct platform_device realview_leds_device = {
160 .name = "versatile-leds",
161 .id = -1,
162 .num_resources = ARRAY_SIZE(realview_leds_resources),
163 .resource = realview_leds_resources,
164};
165
151static struct resource realview_i2c_resource = { 166static struct resource realview_i2c_resource = {
152 .start = REALVIEW_I2C_BASE, 167 .start = REALVIEW_I2C_BASE,
153 .end = REALVIEW_I2C_BASE + SZ_4K - 1, 168 .end = REALVIEW_I2C_BASE + SZ_4K - 1,
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 602ca5ec52c5..13dc830ef469 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -37,6 +37,7 @@ struct machine_desc;
37 37
38extern struct platform_device realview_flash_device; 38extern struct platform_device realview_flash_device;
39extern struct platform_device realview_cf_device; 39extern struct platform_device realview_cf_device;
40extern struct platform_device realview_leds_device;
40extern struct platform_device realview_i2c_device; 41extern struct platform_device realview_i2c_device;
41extern struct mmci_platform_data realview_mmc0_plat_data; 42extern struct mmci_platform_data realview_mmc0_plat_data;
42extern struct mmci_platform_data realview_mmc1_plat_data; 43extern struct mmci_platform_data realview_mmc1_plat_data;
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index c85ddb2a0ad0..6bb070e80128 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -452,6 +452,7 @@ static void __init realview_eb_init(void)
452 realview_flash_register(&realview_eb_flash_resource, 1); 452 realview_flash_register(&realview_eb_flash_resource, 1);
453 platform_device_register(&realview_i2c_device); 453 platform_device_register(&realview_i2c_device);
454 platform_device_register(&char_lcd_device); 454 platform_device_register(&char_lcd_device);
455 platform_device_register(&realview_leds_device);
455 eth_device_register(); 456 eth_device_register();
456 realview_usb_register(realview_eb_isp1761_resources); 457 realview_usb_register(realview_eb_isp1761_resources);
457 458
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index c5eade76461b..173f2c15de49 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -367,6 +367,7 @@ static void __init realview_pb1176_init(void)
367 realview_usb_register(realview_pb1176_isp1761_resources); 367 realview_usb_register(realview_pb1176_isp1761_resources);
368 platform_device_register(&pmu_device); 368 platform_device_register(&pmu_device);
369 platform_device_register(&char_lcd_device); 369 platform_device_register(&char_lcd_device);
370 platform_device_register(&realview_leds_device);
370 371
371 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 372 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
372 struct amba_device *d = amba_devs[i]; 373 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index f4b0962578fe..bde7e6b1fd44 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -347,6 +347,7 @@ static void __init realview_pb11mp_init(void)
347 realview_eth_register(NULL, realview_pb11mp_smsc911x_resources); 347 realview_eth_register(NULL, realview_pb11mp_smsc911x_resources);
348 platform_device_register(&realview_i2c_device); 348 platform_device_register(&realview_i2c_device);
349 platform_device_register(&realview_cf_device); 349 platform_device_register(&realview_cf_device);
350 platform_device_register(&realview_leds_device);
350 realview_usb_register(realview_pb11mp_isp1761_resources); 351 realview_usb_register(realview_pb11mp_isp1761_resources);
351 platform_device_register(&pmu_device); 352 platform_device_register(&pmu_device);
352 353
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index 10a3e1d76891..4e57a8599265 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -289,6 +289,7 @@ static void __init realview_pba8_init(void)
289 realview_eth_register(NULL, realview_pba8_smsc911x_resources); 289 realview_eth_register(NULL, realview_pba8_smsc911x_resources);
290 platform_device_register(&realview_i2c_device); 290 platform_device_register(&realview_i2c_device);
291 platform_device_register(&realview_cf_device); 291 platform_device_register(&realview_cf_device);
292 platform_device_register(&realview_leds_device);
292 realview_usb_register(realview_pba8_isp1761_resources); 293 realview_usb_register(realview_pba8_isp1761_resources);
293 platform_device_register(&pmu_device); 294 platform_device_register(&pmu_device);
294 295
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 9d75493e3f0c..72c96caebefa 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -385,6 +385,7 @@ static void __init realview_pbx_init(void)
385 realview_eth_register(NULL, realview_pbx_smsc911x_resources); 385 realview_eth_register(NULL, realview_pbx_smsc911x_resources);
386 platform_device_register(&realview_i2c_device); 386 platform_device_register(&realview_i2c_device);
387 platform_device_register(&realview_cf_device); 387 platform_device_register(&realview_cf_device);
388 platform_device_register(&realview_leds_device);
388 realview_usb_register(realview_pbx_isp1761_resources); 389 realview_usb_register(realview_pbx_isp1761_resources);
389 390
390 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 391 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
diff --git a/arch/arm/mach-rockchip/core.h b/arch/arm/mach-rockchip/core.h
index e2e7c9dbb200..39bca96b555a 100644
--- a/arch/arm/mach-rockchip/core.h
+++ b/arch/arm/mach-rockchip/core.h
@@ -18,5 +18,3 @@ extern char rockchip_secondary_trampoline_end;
18 18
19extern unsigned long rockchip_boot_fn; 19extern unsigned long rockchip_boot_fn;
20extern void rockchip_secondary_startup(void); 20extern void rockchip_secondary_startup(void);
21
22extern struct smp_operations rockchip_smp_ops;
diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
index 072842f6491b..910835d4ccf4 100644
--- a/arch/arm/mach-rockchip/platsmp.c
+++ b/arch/arm/mach-rockchip/platsmp.c
@@ -178,7 +178,8 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
178 pmu_set_power_domain(0 + i, false); 178 pmu_set_power_domain(0 + i, false);
179} 179}
180 180
181struct smp_operations rockchip_smp_ops __initdata = { 181static struct smp_operations rockchip_smp_ops __initdata = {
182 .smp_prepare_cpus = rockchip_smp_prepare_cpus, 182 .smp_prepare_cpus = rockchip_smp_prepare_cpus,
183 .smp_boot_secondary = rockchip_boot_secondary, 183 .smp_boot_secondary = rockchip_boot_secondary,
184}; 184};
185CPU_METHOD_OF_DECLARE(rk3066_smp, "rockchip,rk3066-smp", &rockchip_smp_ops);
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index d211d6fa0d98..4499b0a31a27 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -39,7 +39,6 @@ static const char * const rockchip_board_dt_compat[] = {
39}; 39};
40 40
41DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)") 41DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
42 .smp = smp_ops(rockchip_smp_ops),
43 .init_machine = rockchip_dt_init, 42 .init_machine = rockchip_dt_init,
44 .dt_compat = rockchip_board_dt_compat, 43 .dt_compat = rockchip_board_dt_compat,
45MACHINE_END 44MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 40cf50b9940c..04284de7aca5 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -18,6 +18,8 @@ config PLAT_S3C24XX
18 help 18 help
19 Base platform code for any Samsung S3C24XX device 19 Base platform code for any Samsung S3C24XX device
20 20
21
22
21menu "SAMSUNG S3C24XX SoCs Support" 23menu "SAMSUNG S3C24XX SoCs Support"
22 24
23comment "S3C24XX SoCs" 25comment "S3C24XX SoCs"
@@ -26,8 +28,7 @@ config CPU_S3C2410
26 bool "SAMSUNG S3C2410" 28 bool "SAMSUNG S3C2410"
27 default y 29 default y
28 select CPU_ARM920T 30 select CPU_ARM920T
29 select CPU_LLSERIAL_S3C2410 31 select S3C2410_COMMON_CLK
30 select S3C2410_CLOCK
31 select S3C2410_DMA if S3C24XX_DMA 32 select S3C2410_DMA if S3C24XX_DMA
32 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ 33 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
33 select S3C2410_PM if PM 34 select S3C2410_PM if PM
@@ -39,7 +40,7 @@ config CPU_S3C2410
39config CPU_S3C2412 40config CPU_S3C2412
40 bool "SAMSUNG S3C2412" 41 bool "SAMSUNG S3C2412"
41 select CPU_ARM926T 42 select CPU_ARM926T
42 select CPU_LLSERIAL_S3C2440 43 select S3C2412_COMMON_CLK
43 select S3C2412_DMA if S3C24XX_DMA 44 select S3C2412_DMA if S3C24XX_DMA
44 select S3C2412_PM if PM 45 select S3C2412_PM if PM
45 help 46 help
@@ -48,19 +49,16 @@ config CPU_S3C2412
48config CPU_S3C2416 49config CPU_S3C2416
49 bool "SAMSUNG S3C2416/S3C2450" 50 bool "SAMSUNG S3C2416/S3C2450"
50 select CPU_ARM926T 51 select CPU_ARM926T
51 select CPU_LLSERIAL_S3C2440
52 select S3C2416_PM if PM 52 select S3C2416_PM if PM
53 select S3C2443_COMMON 53 select S3C2443_COMMON_CLK
54 select S3C2443_DMA if S3C24XX_DMA 54 select S3C2443_DMA if S3C24XX_DMA
55 select SAMSUNG_CLKSRC
56 help 55 help
57 Support for the S3C2416 SoC from the S3C24XX line 56 Support for the S3C2416 SoC from the S3C24XX line
58 57
59config CPU_S3C2440 58config CPU_S3C2440
60 bool "SAMSUNG S3C2440" 59 bool "SAMSUNG S3C2440"
61 select CPU_ARM920T 60 select CPU_ARM920T
62 select CPU_LLSERIAL_S3C2440 61 select S3C2410_COMMON_CLK
63 select S3C2410_CLOCK
64 select S3C2410_PM if PM 62 select S3C2410_PM if PM
65 select S3C2440_DMA if S3C24XX_DMA 63 select S3C2440_DMA if S3C24XX_DMA
66 help 64 help
@@ -69,8 +67,7 @@ config CPU_S3C2440
69config CPU_S3C2442 67config CPU_S3C2442
70 bool "SAMSUNG S3C2442" 68 bool "SAMSUNG S3C2442"
71 select CPU_ARM920T 69 select CPU_ARM920T
72 select CPU_LLSERIAL_S3C2440 70 select S3C2410_COMMON_CLK
73 select S3C2410_CLOCK
74 select S3C2410_DMA if S3C24XX_DMA 71 select S3C2410_DMA if S3C24XX_DMA
75 select S3C2410_PM if PM 72 select S3C2410_PM if PM
76 help 73 help
@@ -84,26 +81,13 @@ config CPU_S3C244X
84config CPU_S3C2443 81config CPU_S3C2443
85 bool "SAMSUNG S3C2443" 82 bool "SAMSUNG S3C2443"
86 select CPU_ARM920T 83 select CPU_ARM920T
87 select CPU_LLSERIAL_S3C2440 84 select S3C2443_COMMON_CLK
88 select S3C2443_COMMON
89 select S3C2443_DMA if S3C24XX_DMA 85 select S3C2443_DMA if S3C24XX_DMA
90 select SAMSUNG_CLKSRC
91 help 86 help
92 Support for the S3C2443 SoC from the S3C24XX line 87 Support for the S3C2443 SoC from the S3C24XX line
93 88
94# common code 89# common code
95 90
96config S3C2410_CLOCK
97 bool
98 help
99 Clock code for the S3C2410, and similar processors which
100 is currently includes the S3C2410, S3C2440, S3C2442.
101
102config S3C24XX_DCLK
103 bool
104 help
105 Clock code for supporting DCLK/CLKOUT on S3C24XX architectures
106
107config S3C24XX_SMDK 91config S3C24XX_SMDK
108 bool 92 bool
109 help 93 help
@@ -158,28 +142,6 @@ config S3C2410_PM
158 help 142 help
159 Power Management code common to S3C2410 and better 143 Power Management code common to S3C2410 and better
160 144
161# low-level serial option nodes
162
163config CPU_LLSERIAL_S3C2410_ONLY
164 bool
165 default y if CPU_LLSERIAL_S3C2410 && !CPU_LLSERIAL_S3C2440
166
167config CPU_LLSERIAL_S3C2440_ONLY
168 bool
169 default y if CPU_LLSERIAL_S3C2440 && !CPU_LLSERIAL_S3C2410
170
171config CPU_LLSERIAL_S3C2410
172 bool
173 help
174 Selected if there is an S3C2410 (or register compatible) serial
175 low-level implementation needed
176
177config CPU_LLSERIAL_S3C2440
178 bool
179 help
180 Selected if there is an S3C2440 (or register compatible) serial
181 low-level implementation needed
182
183config S3C24XX_PLL 145config S3C24XX_PLL
184 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)" 146 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
185 depends on ARM_S3C24XX_CPUFREQ 147 depends on ARM_S3C24XX_CPUFREQ
@@ -258,8 +220,8 @@ config ARCH_BAST
258 bool "Simtec Electronics BAST (EB2410ITX)" 220 bool "Simtec Electronics BAST (EB2410ITX)"
259 select ISA 221 select ISA
260 select MACH_BAST_IDE 222 select MACH_BAST_IDE
223 select S3C2410_COMMON_DCLK
261 select S3C2410_IOTIMING if ARM_S3C2410_CPUFREQ 224 select S3C2410_IOTIMING if ARM_S3C2410_CPUFREQ
262 select S3C24XX_DCLK
263 select S3C24XX_SIMTEC_NOR 225 select S3C24XX_SIMTEC_NOR
264 select S3C24XX_SIMTEC_PM if PM 226 select S3C24XX_SIMTEC_PM if PM
265 select S3C24XX_SIMTEC_USB 227 select S3C24XX_SIMTEC_USB
@@ -340,7 +302,7 @@ config MACH_TCT_HAMMER
340config MACH_VR1000 302config MACH_VR1000
341 bool "Thorcom VR1000" 303 bool "Thorcom VR1000"
342 select MACH_BAST_IDE 304 select MACH_BAST_IDE
343 select S3C24XX_DCLK 305 select S3C2410_COMMON_DCLK
344 select S3C24XX_SIMTEC_NOR 306 select S3C24XX_SIMTEC_NOR
345 select S3C24XX_SIMTEC_PM if PM 307 select S3C24XX_SIMTEC_PM if PM
346 select S3C24XX_SIMTEC_USB 308 select S3C24XX_SIMTEC_USB
@@ -519,8 +481,8 @@ comment "S3C2440 Boards"
519config MACH_ANUBIS 481config MACH_ANUBIS
520 bool "Simtec Electronics ANUBIS" 482 bool "Simtec Electronics ANUBIS"
521 select HAVE_PATA_PLATFORM 483 select HAVE_PATA_PLATFORM
484 select S3C2410_COMMON_DCLK
522 select S3C2440_XTAL_12000000 485 select S3C2440_XTAL_12000000
523 select S3C24XX_DCLK
524 select S3C24XX_SIMTEC_PM if PM 486 select S3C24XX_SIMTEC_PM if PM
525 select S3C_DEV_USB_HOST 487 select S3C_DEV_USB_HOST
526 help 488 help
@@ -558,9 +520,9 @@ config MACH_NEXCODER_2440
558 520
559config MACH_OSIRIS 521config MACH_OSIRIS
560 bool "Simtec IM2440D20 (OSIRIS) module" 522 bool "Simtec IM2440D20 (OSIRIS) module"
523 select S3C2410_COMMON_DCLK
561 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ 524 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
562 select S3C2440_XTAL_12000000 525 select S3C2440_XTAL_12000000
563 select S3C24XX_DCLK
564 select S3C24XX_SIMTEC_PM if PM 526 select S3C24XX_SIMTEC_PM if PM
565 select S3C_DEV_NAND 527 select S3C_DEV_NAND
566 select S3C_DEV_USB_HOST 528 select S3C_DEV_USB_HOST
@@ -629,9 +591,9 @@ config MACH_RX1950
629 bool "HP iPAQ rx1950" 591 bool "HP iPAQ rx1950"
630 select I2C 592 select I2C
631 select PM_H1940 if PM 593 select PM_H1940 if PM
594 select S3C2410_COMMON_DCLK
632 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ 595 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
633 select S3C2440_XTAL_16934400 596 select S3C2440_XTAL_16934400
634 select S3C24XX_DCLK
635 select S3C24XX_PWM 597 select S3C24XX_PWM
636 select S3C_DEV_NAND 598 select S3C_DEV_NAND
637 help 599 help
@@ -641,12 +603,6 @@ endif # CPU_S3C2442
641 603
642if CPU_S3C2443 || CPU_S3C2416 604if CPU_S3C2443 || CPU_S3C2416
643 605
644config S3C2443_COMMON
645 bool
646 help
647 Common code for the S3C2443 and similar processors, which includes
648 the S3C2416 and S3C2450.
649
650config S3C2443_DMA 606config S3C2443_DMA
651 bool 607 bool
652 help 608 help
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile
index 7f54e5b954ca..2235d0d3b38d 100644
--- a/arch/arm/mach-s3c24xx/Makefile
+++ b/arch/arm/mach-s3c24xx/Makefile
@@ -21,22 +21,22 @@ obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o
21obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o 21obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o
22obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o 22obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o
23 23
24obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o 24obj-$(CONFIG_CPU_S3C2412) += s3c2412.o
25obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o 25obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o
26obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o 26obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o
27obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o 27obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o
28 28
29obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o 29obj-$(CONFIG_CPU_S3C2416) += s3c2416.o
30obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o 30obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o
31 31
32obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o 32obj-$(CONFIG_CPU_S3C2440) += s3c2440.o
33obj-$(CONFIG_CPU_S3C2442) += s3c2442.o 33obj-$(CONFIG_CPU_S3C2442) += s3c2442.o
34obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o 34obj-$(CONFIG_CPU_S3C244X) += s3c244x.o
35obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o 35obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o
36obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o 36obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
37obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o 37obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o
38 38
39obj-$(CONFIG_CPU_S3C2443) += s3c2443.o clock-s3c2443.o 39obj-$(CONFIG_CPU_S3C2443) += s3c2443.o
40 40
41# PM 41# PM
42 42
@@ -44,16 +44,13 @@ obj-$(CONFIG_PM) += pm.o irq-pm.o sleep.o
44 44
45# common code 45# common code
46 46
47obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o
48obj-$(CONFIG_S3C24XX_DMA) += dma.o 47obj-$(CONFIG_S3C24XX_DMA) += dma.o
49 48
50obj-$(CONFIG_S3C2410_CLOCK) += clock-s3c2410.o
51obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o 49obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o
52 50
53obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o 51obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o
54obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o 52obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o
55 53
56obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o
57obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o 54obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o
58 55
59# 56#
diff --git a/arch/arm/mach-s3c24xx/clock-dclk.c b/arch/arm/mach-s3c24xx/clock-dclk.c
deleted file mode 100644
index 1edd9b2369c5..000000000000
--- a/arch/arm/mach-s3c24xx/clock-dclk.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/*
2 * Copyright (c) 2004-2008 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 * S3C24XX - definitions for DCLK and CLKOUT registers
11 */
12
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/clk.h>
16#include <linux/io.h>
17
18#include <mach/regs-clock.h>
19#include <mach/regs-gpio.h>
20
21#include <plat/clock.h>
22#include <plat/cpu.h>
23
24/* clocks that could be registered by external code */
25
26static int s3c24xx_dclk_enable(struct clk *clk, int enable)
27{
28 unsigned long dclkcon = __raw_readl(S3C24XX_DCLKCON);
29
30 if (enable)
31 dclkcon |= clk->ctrlbit;
32 else
33 dclkcon &= ~clk->ctrlbit;
34
35 __raw_writel(dclkcon, S3C24XX_DCLKCON);
36
37 return 0;
38}
39
40static int s3c24xx_dclk_setparent(struct clk *clk, struct clk *parent)
41{
42 unsigned long dclkcon;
43 unsigned int uclk;
44
45 if (parent == &clk_upll)
46 uclk = 1;
47 else if (parent == &clk_p)
48 uclk = 0;
49 else
50 return -EINVAL;
51
52 clk->parent = parent;
53
54 dclkcon = __raw_readl(S3C24XX_DCLKCON);
55
56 if (clk->ctrlbit == S3C2410_DCLKCON_DCLK0EN) {
57 if (uclk)
58 dclkcon |= S3C2410_DCLKCON_DCLK0_UCLK;
59 else
60 dclkcon &= ~S3C2410_DCLKCON_DCLK0_UCLK;
61 } else {
62 if (uclk)
63 dclkcon |= S3C2410_DCLKCON_DCLK1_UCLK;
64 else
65 dclkcon &= ~S3C2410_DCLKCON_DCLK1_UCLK;
66 }
67
68 __raw_writel(dclkcon, S3C24XX_DCLKCON);
69
70 return 0;
71}
72static unsigned long s3c24xx_calc_div(struct clk *clk, unsigned long rate)
73{
74 unsigned long div;
75
76 if ((rate == 0) || !clk->parent)
77 return 0;
78
79 div = clk_get_rate(clk->parent) / rate;
80 if (div < 2)
81 div = 2;
82 else if (div > 16)
83 div = 16;
84
85 return div;
86}
87
88static unsigned long s3c24xx_round_dclk_rate(struct clk *clk,
89 unsigned long rate)
90{
91 unsigned long div = s3c24xx_calc_div(clk, rate);
92
93 if (div == 0)
94 return 0;
95
96 return clk_get_rate(clk->parent) / div;
97}
98
99static int s3c24xx_set_dclk_rate(struct clk *clk, unsigned long rate)
100{
101 unsigned long mask, data, div = s3c24xx_calc_div(clk, rate);
102
103 if (div == 0)
104 return -EINVAL;
105
106 if (clk == &s3c24xx_dclk0) {
107 mask = S3C2410_DCLKCON_DCLK0_DIV_MASK |
108 S3C2410_DCLKCON_DCLK0_CMP_MASK;
109 data = S3C2410_DCLKCON_DCLK0_DIV(div) |
110 S3C2410_DCLKCON_DCLK0_CMP((div + 1) / 2);
111 } else if (clk == &s3c24xx_dclk1) {
112 mask = S3C2410_DCLKCON_DCLK1_DIV_MASK |
113 S3C2410_DCLKCON_DCLK1_CMP_MASK;
114 data = S3C2410_DCLKCON_DCLK1_DIV(div) |
115 S3C2410_DCLKCON_DCLK1_CMP((div + 1) / 2);
116 } else
117 return -EINVAL;
118
119 clk->rate = clk_get_rate(clk->parent) / div;
120 __raw_writel(((__raw_readl(S3C24XX_DCLKCON) & ~mask) | data),
121 S3C24XX_DCLKCON);
122 return clk->rate;
123}
124static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent)
125{
126 unsigned long mask;
127 unsigned long source;
128
129 /* calculate the MISCCR setting for the clock */
130
131 if (parent == &clk_mpll)
132 source = S3C2410_MISCCR_CLK0_MPLL;
133 else if (parent == &clk_upll)
134 source = S3C2410_MISCCR_CLK0_UPLL;
135 else if (parent == &clk_f)
136 source = S3C2410_MISCCR_CLK0_FCLK;
137 else if (parent == &clk_h)
138 source = S3C2410_MISCCR_CLK0_HCLK;
139 else if (parent == &clk_p)
140 source = S3C2410_MISCCR_CLK0_PCLK;
141 else if (clk == &s3c24xx_clkout0 && parent == &s3c24xx_dclk0)
142 source = S3C2410_MISCCR_CLK0_DCLK0;
143 else if (clk == &s3c24xx_clkout1 && parent == &s3c24xx_dclk1)
144 source = S3C2410_MISCCR_CLK0_DCLK0;
145 else
146 return -EINVAL;
147
148 clk->parent = parent;
149
150 if (clk == &s3c24xx_clkout0)
151 mask = S3C2410_MISCCR_CLK0_MASK;
152 else {
153 source <<= 4;
154 mask = S3C2410_MISCCR_CLK1_MASK;
155 }
156
157 s3c2410_modify_misccr(mask, source);
158 return 0;
159}
160
161/* external clock definitions */
162
163static struct clk_ops dclk_ops = {
164 .set_parent = s3c24xx_dclk_setparent,
165 .set_rate = s3c24xx_set_dclk_rate,
166 .round_rate = s3c24xx_round_dclk_rate,
167};
168
169struct clk s3c24xx_dclk0 = {
170 .name = "dclk0",
171 .ctrlbit = S3C2410_DCLKCON_DCLK0EN,
172 .enable = s3c24xx_dclk_enable,
173 .ops = &dclk_ops,
174};
175
176struct clk s3c24xx_dclk1 = {
177 .name = "dclk1",
178 .ctrlbit = S3C2410_DCLKCON_DCLK1EN,
179 .enable = s3c24xx_dclk_enable,
180 .ops = &dclk_ops,
181};
182
183static struct clk_ops clkout_ops = {
184 .set_parent = s3c24xx_clkout_setparent,
185};
186
187struct clk s3c24xx_clkout0 = {
188 .name = "clkout0",
189 .ops = &clkout_ops,
190};
191
192struct clk s3c24xx_clkout1 = {
193 .name = "clkout1",
194 .ops = &clkout_ops,
195};
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2410.c b/arch/arm/mach-s3c24xx/clock-s3c2410.c
deleted file mode 100644
index d1afcf9252d1..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2410.c
+++ /dev/null
@@ -1,284 +0,0 @@
1/*
2 * Copyright (c) 2006 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 *
5 * S3C2410,S3C2440,S3C2442 Clock control 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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20*/
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/kernel.h>
25#include <linux/list.h>
26#include <linux/errno.h>
27#include <linux/err.h>
28#include <linux/device.h>
29#include <linux/clk.h>
30#include <linux/mutex.h>
31#include <linux/delay.h>
32#include <linux/serial_core.h>
33#include <linux/serial_s3c.h>
34#include <linux/io.h>
35
36#include <asm/mach/map.h>
37
38#include <mach/hardware.h>
39#include <mach/regs-clock.h>
40#include <mach/regs-gpio.h>
41
42#include <plat/clock.h>
43#include <plat/cpu.h>
44
45int s3c2410_clkcon_enable(struct clk *clk, int enable)
46{
47 unsigned int clocks = clk->ctrlbit;
48 unsigned long clkcon;
49
50 clkcon = __raw_readl(S3C2410_CLKCON);
51
52 if (enable)
53 clkcon |= clocks;
54 else
55 clkcon &= ~clocks;
56
57 /* ensure none of the special function bits set */
58 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER);
59
60 __raw_writel(clkcon, S3C2410_CLKCON);
61
62 return 0;
63}
64
65static int s3c2410_upll_enable(struct clk *clk, int enable)
66{
67 unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
68 unsigned long orig = clkslow;
69
70 if (enable)
71 clkslow &= ~S3C2410_CLKSLOW_UCLK_OFF;
72 else
73 clkslow |= S3C2410_CLKSLOW_UCLK_OFF;
74
75 __raw_writel(clkslow, S3C2410_CLKSLOW);
76
77 /* if we started the UPLL, then allow to settle */
78
79 if (enable && (orig & S3C2410_CLKSLOW_UCLK_OFF))
80 udelay(200);
81
82 return 0;
83}
84
85/* standard clock definitions */
86
87static struct clk init_clocks_off[] = {
88 {
89 .name = "nand",
90 .parent = &clk_h,
91 .enable = s3c2410_clkcon_enable,
92 .ctrlbit = S3C2410_CLKCON_NAND,
93 }, {
94 .name = "sdi",
95 .parent = &clk_p,
96 .enable = s3c2410_clkcon_enable,
97 .ctrlbit = S3C2410_CLKCON_SDI,
98 }, {
99 .name = "adc",
100 .parent = &clk_p,
101 .enable = s3c2410_clkcon_enable,
102 .ctrlbit = S3C2410_CLKCON_ADC,
103 }, {
104 .name = "i2c",
105 .parent = &clk_p,
106 .enable = s3c2410_clkcon_enable,
107 .ctrlbit = S3C2410_CLKCON_IIC,
108 }, {
109 .name = "iis",
110 .parent = &clk_p,
111 .enable = s3c2410_clkcon_enable,
112 .ctrlbit = S3C2410_CLKCON_IIS,
113 }, {
114 .name = "spi",
115 .parent = &clk_p,
116 .enable = s3c2410_clkcon_enable,
117 .ctrlbit = S3C2410_CLKCON_SPI,
118 }
119};
120
121static struct clk clk_lcd = {
122 .name = "lcd",
123 .parent = &clk_h,
124 .enable = s3c2410_clkcon_enable,
125 .ctrlbit = S3C2410_CLKCON_LCDC,
126};
127
128static struct clk clk_gpio = {
129 .name = "gpio",
130 .parent = &clk_p,
131 .enable = s3c2410_clkcon_enable,
132 .ctrlbit = S3C2410_CLKCON_GPIO,
133};
134
135static struct clk clk_usb_host = {
136 .name = "usb-host",
137 .parent = &clk_h,
138 .enable = s3c2410_clkcon_enable,
139 .ctrlbit = S3C2410_CLKCON_USBH,
140};
141
142static struct clk clk_usb_device = {
143 .name = "usb-device",
144 .parent = &clk_h,
145 .enable = s3c2410_clkcon_enable,
146 .ctrlbit = S3C2410_CLKCON_USBD,
147};
148
149static struct clk clk_timers = {
150 .name = "timers",
151 .parent = &clk_p,
152 .enable = s3c2410_clkcon_enable,
153 .ctrlbit = S3C2410_CLKCON_PWMT,
154};
155
156struct clk s3c24xx_clk_uart0 = {
157 .name = "uart",
158 .devname = "s3c2410-uart.0",
159 .parent = &clk_p,
160 .enable = s3c2410_clkcon_enable,
161 .ctrlbit = S3C2410_CLKCON_UART0,
162};
163
164struct clk s3c24xx_clk_uart1 = {
165 .name = "uart",
166 .devname = "s3c2410-uart.1",
167 .parent = &clk_p,
168 .enable = s3c2410_clkcon_enable,
169 .ctrlbit = S3C2410_CLKCON_UART1,
170};
171
172struct clk s3c24xx_clk_uart2 = {
173 .name = "uart",
174 .devname = "s3c2410-uart.2",
175 .parent = &clk_p,
176 .enable = s3c2410_clkcon_enable,
177 .ctrlbit = S3C2410_CLKCON_UART2,
178};
179
180static struct clk clk_rtc = {
181 .name = "rtc",
182 .parent = &clk_p,
183 .enable = s3c2410_clkcon_enable,
184 .ctrlbit = S3C2410_CLKCON_RTC,
185};
186
187static struct clk clk_watchdog = {
188 .name = "watchdog",
189 .parent = &clk_p,
190 .ctrlbit = 0,
191};
192
193static struct clk clk_usb_bus_host = {
194 .name = "usb-bus-host",
195 .parent = &clk_usb_bus,
196};
197
198static struct clk clk_usb_bus_gadget = {
199 .name = "usb-bus-gadget",
200 .parent = &clk_usb_bus,
201};
202
203static struct clk *init_clocks[] = {
204 &clk_lcd,
205 &clk_gpio,
206 &clk_usb_host,
207 &clk_usb_device,
208 &clk_timers,
209 &s3c24xx_clk_uart0,
210 &s3c24xx_clk_uart1,
211 &s3c24xx_clk_uart2,
212 &clk_rtc,
213 &clk_watchdog,
214 &clk_usb_bus_host,
215 &clk_usb_bus_gadget,
216};
217
218/* s3c2410_baseclk_add()
219 *
220 * Add all the clocks used by the s3c2410 or compatible CPUs
221 * such as the S3C2440 and S3C2442.
222 *
223 * We cannot use a system device as we are needed before any
224 * of the init-calls that initialise the devices are actually
225 * done.
226*/
227
228int __init s3c2410_baseclk_add(void)
229{
230 unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
231 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
232 struct clk *xtal;
233 int ret;
234 int ptr;
235
236 clk_upll.enable = s3c2410_upll_enable;
237
238 if (s3c24xx_register_clock(&clk_usb_bus) < 0)
239 printk(KERN_ERR "failed to register usb bus clock\n");
240
241 /* register clocks from clock array */
242
243 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++) {
244 struct clk *clkp = init_clocks[ptr];
245
246 /* ensure that we note the clock state */
247
248 clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0;
249
250 ret = s3c24xx_register_clock(clkp);
251 if (ret < 0) {
252 printk(KERN_ERR "Failed to register clock %s (%d)\n",
253 clkp->name, ret);
254 }
255 }
256
257 /* We must be careful disabling the clocks we are not intending to
258 * be using at boot time, as subsystems such as the LCD which do
259 * their own DMA requests to the bus can cause the system to lockup
260 * if they where in the middle of requesting bus access.
261 *
262 * Disabling the LCD clock if the LCD is active is very dangerous,
263 * and therefore the bootloader should be careful to not enable
264 * the LCD clock if it is not needed.
265 */
266
267 /* install (and disable) the clocks we do not need immediately */
268
269 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
270 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
271
272 /* show the clock-slow value */
273
274 xtal = clk_get(NULL, "xtal");
275
276 printk("CLOCK: Slow mode (%ld.%ld MHz), %s, MPLL %s, UPLL %s\n",
277 print_mhz(clk_get_rate(xtal) /
278 ( 2 * S3C2410_CLKSLOW_GET_SLOWVAL(clkslow))),
279 (clkslow & S3C2410_CLKSLOW_SLOW) ? "slow" : "fast",
280 (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on",
281 (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on");
282
283 return 0;
284}
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2412.c b/arch/arm/mach-s3c24xx/clock-s3c2412.c
deleted file mode 100644
index 192a5b2550b0..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2412.c
+++ /dev/null
@@ -1,760 +0,0 @@
1/* linux/arch/arm/mach-s3c2412/clock.c
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2412,S3C2413 Clock control 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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/kernel.h>
26#include <linux/list.h>
27#include <linux/errno.h>
28#include <linux/err.h>
29#include <linux/device.h>
30#include <linux/clk.h>
31#include <linux/mutex.h>
32#include <linux/delay.h>
33#include <linux/serial_core.h>
34#include <linux/serial_s3c.h>
35#include <linux/io.h>
36
37#include <asm/mach/map.h>
38
39#include <mach/hardware.h>
40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/clock.h>
44#include <plat/cpu.h>
45
46/* We currently have to assume that the system is running
47 * from the XTPll input, and that all ***REFCLKs are being
48 * fed from it, as we cannot read the state of OM[4] from
49 * software.
50 *
51 * It would be possible for each board initialisation to
52 * set the correct muxing at initialisation
53*/
54
55static int s3c2412_clkcon_enable(struct clk *clk, int enable)
56{
57 unsigned int clocks = clk->ctrlbit;
58 unsigned long clkcon;
59
60 clkcon = __raw_readl(S3C2410_CLKCON);
61
62 if (enable)
63 clkcon |= clocks;
64 else
65 clkcon &= ~clocks;
66
67 __raw_writel(clkcon, S3C2410_CLKCON);
68
69 return 0;
70}
71
72static int s3c2412_upll_enable(struct clk *clk, int enable)
73{
74 unsigned long upllcon = __raw_readl(S3C2410_UPLLCON);
75 unsigned long orig = upllcon;
76
77 if (!enable)
78 upllcon |= S3C2412_PLLCON_OFF;
79 else
80 upllcon &= ~S3C2412_PLLCON_OFF;
81
82 __raw_writel(upllcon, S3C2410_UPLLCON);
83
84 /* allow ~150uS for the PLL to settle and lock */
85
86 if (enable && (orig & S3C2412_PLLCON_OFF))
87 udelay(150);
88
89 return 0;
90}
91
92/* clock selections */
93
94static struct clk clk_erefclk = {
95 .name = "erefclk",
96};
97
98static struct clk clk_urefclk = {
99 .name = "urefclk",
100};
101
102static int s3c2412_setparent_usysclk(struct clk *clk, struct clk *parent)
103{
104 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
105
106 if (parent == &clk_urefclk)
107 clksrc &= ~S3C2412_CLKSRC_USYSCLK_UPLL;
108 else if (parent == &clk_upll)
109 clksrc |= S3C2412_CLKSRC_USYSCLK_UPLL;
110 else
111 return -EINVAL;
112
113 clk->parent = parent;
114
115 __raw_writel(clksrc, S3C2412_CLKSRC);
116 return 0;
117}
118
119static struct clk clk_usysclk = {
120 .name = "usysclk",
121 .parent = &clk_xtal,
122 .ops = &(struct clk_ops) {
123 .set_parent = s3c2412_setparent_usysclk,
124 },
125};
126
127static struct clk clk_mrefclk = {
128 .name = "mrefclk",
129 .parent = &clk_xtal,
130};
131
132static struct clk clk_mdivclk = {
133 .name = "mdivclk",
134 .parent = &clk_xtal,
135};
136
137static int s3c2412_setparent_usbsrc(struct clk *clk, struct clk *parent)
138{
139 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
140
141 if (parent == &clk_usysclk)
142 clksrc &= ~S3C2412_CLKSRC_USBCLK_HCLK;
143 else if (parent == &clk_h)
144 clksrc |= S3C2412_CLKSRC_USBCLK_HCLK;
145 else
146 return -EINVAL;
147
148 clk->parent = parent;
149
150 __raw_writel(clksrc, S3C2412_CLKSRC);
151 return 0;
152}
153
154static unsigned long s3c2412_roundrate_usbsrc(struct clk *clk,
155 unsigned long rate)
156{
157 unsigned long parent_rate = clk_get_rate(clk->parent);
158 int div;
159
160 if (rate > parent_rate)
161 return parent_rate;
162
163 div = parent_rate / rate;
164 if (div > 2)
165 div = 2;
166
167 return parent_rate / div;
168}
169
170static unsigned long s3c2412_getrate_usbsrc(struct clk *clk)
171{
172 unsigned long parent_rate = clk_get_rate(clk->parent);
173 unsigned long div = __raw_readl(S3C2410_CLKDIVN);
174
175 return parent_rate / ((div & S3C2412_CLKDIVN_USB48DIV) ? 2 : 1);
176}
177
178static int s3c2412_setrate_usbsrc(struct clk *clk, unsigned long rate)
179{
180 unsigned long parent_rate = clk_get_rate(clk->parent);
181 unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
182
183 rate = s3c2412_roundrate_usbsrc(clk, rate);
184
185 if ((parent_rate / rate) == 2)
186 clkdivn |= S3C2412_CLKDIVN_USB48DIV;
187 else
188 clkdivn &= ~S3C2412_CLKDIVN_USB48DIV;
189
190 __raw_writel(clkdivn, S3C2410_CLKDIVN);
191 return 0;
192}
193
194static struct clk clk_usbsrc = {
195 .name = "usbsrc",
196 .ops = &(struct clk_ops) {
197 .get_rate = s3c2412_getrate_usbsrc,
198 .set_rate = s3c2412_setrate_usbsrc,
199 .round_rate = s3c2412_roundrate_usbsrc,
200 .set_parent = s3c2412_setparent_usbsrc,
201 },
202};
203
204static int s3c2412_setparent_msysclk(struct clk *clk, struct clk *parent)
205{
206 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
207
208 if (parent == &clk_mdivclk)
209 clksrc &= ~S3C2412_CLKSRC_MSYSCLK_MPLL;
210 else if (parent == &clk_mpll)
211 clksrc |= S3C2412_CLKSRC_MSYSCLK_MPLL;
212 else
213 return -EINVAL;
214
215 clk->parent = parent;
216
217 __raw_writel(clksrc, S3C2412_CLKSRC);
218 return 0;
219}
220
221static struct clk clk_msysclk = {
222 .name = "msysclk",
223 .ops = &(struct clk_ops) {
224 .set_parent = s3c2412_setparent_msysclk,
225 },
226};
227
228static int s3c2412_setparent_armclk(struct clk *clk, struct clk *parent)
229{
230 unsigned long flags;
231 unsigned long clkdiv;
232 unsigned long dvs;
233
234 /* Note, we current equate fclk andf msysclk for S3C2412 */
235
236 if (parent == &clk_msysclk || parent == &clk_f)
237 dvs = 0;
238 else if (parent == &clk_h)
239 dvs = S3C2412_CLKDIVN_DVSEN;
240 else
241 return -EINVAL;
242
243 clk->parent = parent;
244
245 /* update this under irq lockdown, clkdivn is not protected
246 * by the clock system. */
247
248 local_irq_save(flags);
249
250 clkdiv = __raw_readl(S3C2410_CLKDIVN);
251 clkdiv &= ~S3C2412_CLKDIVN_DVSEN;
252 clkdiv |= dvs;
253 __raw_writel(clkdiv, S3C2410_CLKDIVN);
254
255 local_irq_restore(flags);
256
257 return 0;
258}
259
260static struct clk clk_armclk = {
261 .name = "armclk",
262 .parent = &clk_msysclk,
263 .ops = &(struct clk_ops) {
264 .set_parent = s3c2412_setparent_armclk,
265 },
266};
267
268/* these next clocks have an divider immediately after them,
269 * so we can register them with their divider and leave out the
270 * intermediate clock stage
271*/
272static unsigned long s3c2412_roundrate_clksrc(struct clk *clk,
273 unsigned long rate)
274{
275 unsigned long parent_rate = clk_get_rate(clk->parent);
276 int div;
277
278 if (rate > parent_rate)
279 return parent_rate;
280
281 /* note, we remove the +/- 1 calculations as they cancel out */
282
283 div = (rate / parent_rate);
284
285 if (div < 1)
286 div = 1;
287 else if (div > 16)
288 div = 16;
289
290 return parent_rate / div;
291}
292
293static int s3c2412_setparent_uart(struct clk *clk, struct clk *parent)
294{
295 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
296
297 if (parent == &clk_erefclk)
298 clksrc &= ~S3C2412_CLKSRC_UARTCLK_MPLL;
299 else if (parent == &clk_mpll)
300 clksrc |= S3C2412_CLKSRC_UARTCLK_MPLL;
301 else
302 return -EINVAL;
303
304 clk->parent = parent;
305
306 __raw_writel(clksrc, S3C2412_CLKSRC);
307 return 0;
308}
309
310static unsigned long s3c2412_getrate_uart(struct clk *clk)
311{
312 unsigned long parent_rate = clk_get_rate(clk->parent);
313 unsigned long div = __raw_readl(S3C2410_CLKDIVN);
314
315 div &= S3C2412_CLKDIVN_UARTDIV_MASK;
316 div >>= S3C2412_CLKDIVN_UARTDIV_SHIFT;
317
318 return parent_rate / (div + 1);
319}
320
321static int s3c2412_setrate_uart(struct clk *clk, unsigned long rate)
322{
323 unsigned long parent_rate = clk_get_rate(clk->parent);
324 unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
325
326 rate = s3c2412_roundrate_clksrc(clk, rate);
327
328 clkdivn &= ~S3C2412_CLKDIVN_UARTDIV_MASK;
329 clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_UARTDIV_SHIFT;
330
331 __raw_writel(clkdivn, S3C2410_CLKDIVN);
332 return 0;
333}
334
335static struct clk clk_uart = {
336 .name = "uartclk",
337 .ops = &(struct clk_ops) {
338 .get_rate = s3c2412_getrate_uart,
339 .set_rate = s3c2412_setrate_uart,
340 .set_parent = s3c2412_setparent_uart,
341 .round_rate = s3c2412_roundrate_clksrc,
342 },
343};
344
345static int s3c2412_setparent_i2s(struct clk *clk, struct clk *parent)
346{
347 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
348
349 if (parent == &clk_erefclk)
350 clksrc &= ~S3C2412_CLKSRC_I2SCLK_MPLL;
351 else if (parent == &clk_mpll)
352 clksrc |= S3C2412_CLKSRC_I2SCLK_MPLL;
353 else
354 return -EINVAL;
355
356 clk->parent = parent;
357
358 __raw_writel(clksrc, S3C2412_CLKSRC);
359 return 0;
360}
361
362static unsigned long s3c2412_getrate_i2s(struct clk *clk)
363{
364 unsigned long parent_rate = clk_get_rate(clk->parent);
365 unsigned long div = __raw_readl(S3C2410_CLKDIVN);
366
367 div &= S3C2412_CLKDIVN_I2SDIV_MASK;
368 div >>= S3C2412_CLKDIVN_I2SDIV_SHIFT;
369
370 return parent_rate / (div + 1);
371}
372
373static int s3c2412_setrate_i2s(struct clk *clk, unsigned long rate)
374{
375 unsigned long parent_rate = clk_get_rate(clk->parent);
376 unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
377
378 rate = s3c2412_roundrate_clksrc(clk, rate);
379
380 clkdivn &= ~S3C2412_CLKDIVN_I2SDIV_MASK;
381 clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_I2SDIV_SHIFT;
382
383 __raw_writel(clkdivn, S3C2410_CLKDIVN);
384 return 0;
385}
386
387static struct clk clk_i2s = {
388 .name = "i2sclk",
389 .ops = &(struct clk_ops) {
390 .get_rate = s3c2412_getrate_i2s,
391 .set_rate = s3c2412_setrate_i2s,
392 .set_parent = s3c2412_setparent_i2s,
393 .round_rate = s3c2412_roundrate_clksrc,
394 },
395};
396
397static int s3c2412_setparent_cam(struct clk *clk, struct clk *parent)
398{
399 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
400
401 if (parent == &clk_usysclk)
402 clksrc &= ~S3C2412_CLKSRC_CAMCLK_HCLK;
403 else if (parent == &clk_h)
404 clksrc |= S3C2412_CLKSRC_CAMCLK_HCLK;
405 else
406 return -EINVAL;
407
408 clk->parent = parent;
409
410 __raw_writel(clksrc, S3C2412_CLKSRC);
411 return 0;
412}
413static unsigned long s3c2412_getrate_cam(struct clk *clk)
414{
415 unsigned long parent_rate = clk_get_rate(clk->parent);
416 unsigned long div = __raw_readl(S3C2410_CLKDIVN);
417
418 div &= S3C2412_CLKDIVN_CAMDIV_MASK;
419 div >>= S3C2412_CLKDIVN_CAMDIV_SHIFT;
420
421 return parent_rate / (div + 1);
422}
423
424static int s3c2412_setrate_cam(struct clk *clk, unsigned long rate)
425{
426 unsigned long parent_rate = clk_get_rate(clk->parent);
427 unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
428
429 rate = s3c2412_roundrate_clksrc(clk, rate);
430
431 clkdivn &= ~S3C2412_CLKDIVN_CAMDIV_MASK;
432 clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_CAMDIV_SHIFT;
433
434 __raw_writel(clkdivn, S3C2410_CLKDIVN);
435 return 0;
436}
437
438static struct clk clk_cam = {
439 .name = "camif-upll", /* same as 2440 name */
440 .ops = &(struct clk_ops) {
441 .get_rate = s3c2412_getrate_cam,
442 .set_rate = s3c2412_setrate_cam,
443 .set_parent = s3c2412_setparent_cam,
444 .round_rate = s3c2412_roundrate_clksrc,
445 },
446};
447
448/* standard clock definitions */
449
450static struct clk init_clocks_disable[] = {
451 {
452 .name = "nand",
453 .parent = &clk_h,
454 .enable = s3c2412_clkcon_enable,
455 .ctrlbit = S3C2412_CLKCON_NAND,
456 }, {
457 .name = "sdi",
458 .parent = &clk_p,
459 .enable = s3c2412_clkcon_enable,
460 .ctrlbit = S3C2412_CLKCON_SDI,
461 }, {
462 .name = "adc",
463 .parent = &clk_p,
464 .enable = s3c2412_clkcon_enable,
465 .ctrlbit = S3C2412_CLKCON_ADC,
466 }, {
467 .name = "i2c",
468 .parent = &clk_p,
469 .enable = s3c2412_clkcon_enable,
470 .ctrlbit = S3C2412_CLKCON_IIC,
471 }, {
472 .name = "iis",
473 .parent = &clk_p,
474 .enable = s3c2412_clkcon_enable,
475 .ctrlbit = S3C2412_CLKCON_IIS,
476 }, {
477 .name = "spi",
478 .parent = &clk_p,
479 .enable = s3c2412_clkcon_enable,
480 .ctrlbit = S3C2412_CLKCON_SPI,
481 }
482};
483
484static struct clk init_clocks[] = {
485 {
486 .name = "dma.0",
487 .parent = &clk_h,
488 .enable = s3c2412_clkcon_enable,
489 .ctrlbit = S3C2412_CLKCON_DMA0,
490 }, {
491 .name = "dma.1",
492 .parent = &clk_h,
493 .enable = s3c2412_clkcon_enable,
494 .ctrlbit = S3C2412_CLKCON_DMA1,
495 }, {
496 .name = "dma.2",
497 .parent = &clk_h,
498 .enable = s3c2412_clkcon_enable,
499 .ctrlbit = S3C2412_CLKCON_DMA2,
500 }, {
501 .name = "dma.3",
502 .parent = &clk_h,
503 .enable = s3c2412_clkcon_enable,
504 .ctrlbit = S3C2412_CLKCON_DMA3,
505 }, {
506 .name = "lcd",
507 .parent = &clk_h,
508 .enable = s3c2412_clkcon_enable,
509 .ctrlbit = S3C2412_CLKCON_LCDC,
510 }, {
511 .name = "gpio",
512 .parent = &clk_p,
513 .enable = s3c2412_clkcon_enable,
514 .ctrlbit = S3C2412_CLKCON_GPIO,
515 }, {
516 .name = "usb-host",
517 .parent = &clk_h,
518 .enable = s3c2412_clkcon_enable,
519 .ctrlbit = S3C2412_CLKCON_USBH,
520 }, {
521 .name = "usb-device",
522 .parent = &clk_h,
523 .enable = s3c2412_clkcon_enable,
524 .ctrlbit = S3C2412_CLKCON_USBD,
525 }, {
526 .name = "timers",
527 .parent = &clk_p,
528 .enable = s3c2412_clkcon_enable,
529 .ctrlbit = S3C2412_CLKCON_PWMT,
530 }, {
531 .name = "uart",
532 .devname = "s3c2412-uart.0",
533 .parent = &clk_p,
534 .enable = s3c2412_clkcon_enable,
535 .ctrlbit = S3C2412_CLKCON_UART0,
536 }, {
537 .name = "uart",
538 .devname = "s3c2412-uart.1",
539 .parent = &clk_p,
540 .enable = s3c2412_clkcon_enable,
541 .ctrlbit = S3C2412_CLKCON_UART1,
542 }, {
543 .name = "uart",
544 .devname = "s3c2412-uart.2",
545 .parent = &clk_p,
546 .enable = s3c2412_clkcon_enable,
547 .ctrlbit = S3C2412_CLKCON_UART2,
548 }, {
549 .name = "rtc",
550 .parent = &clk_p,
551 .enable = s3c2412_clkcon_enable,
552 .ctrlbit = S3C2412_CLKCON_RTC,
553 }, {
554 .name = "watchdog",
555 .parent = &clk_p,
556 .ctrlbit = 0,
557 }, {
558 .name = "usb-bus-gadget",
559 .parent = &clk_usb_bus,
560 .enable = s3c2412_clkcon_enable,
561 .ctrlbit = S3C2412_CLKCON_USB_DEV48,
562 }, {
563 .name = "usb-bus-host",
564 .parent = &clk_usb_bus,
565 .enable = s3c2412_clkcon_enable,
566 .ctrlbit = S3C2412_CLKCON_USB_HOST48,
567 }
568};
569
570/* clocks to add where we need to check their parentage */
571
572struct clk_init {
573 struct clk *clk;
574 unsigned int bit;
575 struct clk *src_0;
576 struct clk *src_1;
577};
578
579static struct clk_init clks_src[] __initdata = {
580 {
581 .clk = &clk_usysclk,
582 .bit = S3C2412_CLKSRC_USBCLK_HCLK,
583 .src_0 = &clk_urefclk,
584 .src_1 = &clk_upll,
585 }, {
586 .clk = &clk_i2s,
587 .bit = S3C2412_CLKSRC_I2SCLK_MPLL,
588 .src_0 = &clk_erefclk,
589 .src_1 = &clk_mpll,
590 }, {
591 .clk = &clk_cam,
592 .bit = S3C2412_CLKSRC_CAMCLK_HCLK,
593 .src_0 = &clk_usysclk,
594 .src_1 = &clk_h,
595 }, {
596 .clk = &clk_msysclk,
597 .bit = S3C2412_CLKSRC_MSYSCLK_MPLL,
598 .src_0 = &clk_mdivclk,
599 .src_1 = &clk_mpll,
600 }, {
601 .clk = &clk_uart,
602 .bit = S3C2412_CLKSRC_UARTCLK_MPLL,
603 .src_0 = &clk_erefclk,
604 .src_1 = &clk_mpll,
605 }, {
606 .clk = &clk_usbsrc,
607 .bit = S3C2412_CLKSRC_USBCLK_HCLK,
608 .src_0 = &clk_usysclk,
609 .src_1 = &clk_h,
610 /* here we assume OM[4] select xtal */
611 }, {
612 .clk = &clk_erefclk,
613 .bit = S3C2412_CLKSRC_EREFCLK_EXTCLK,
614 .src_0 = &clk_xtal,
615 .src_1 = &clk_ext,
616 }, {
617 .clk = &clk_urefclk,
618 .bit = S3C2412_CLKSRC_UREFCLK_EXTCLK,
619 .src_0 = &clk_xtal,
620 .src_1 = &clk_ext,
621 },
622};
623
624/* s3c2412_clk_initparents
625 *
626 * Initialise the parents for the clocks that we get at start-time
627*/
628
629static void __init s3c2412_clk_initparents(void)
630{
631 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
632 struct clk_init *cip = clks_src;
633 struct clk *src;
634 int ptr;
635 int ret;
636
637 for (ptr = 0; ptr < ARRAY_SIZE(clks_src); ptr++, cip++) {
638 ret = s3c24xx_register_clock(cip->clk);
639 if (ret < 0) {
640 printk(KERN_ERR "Failed to register clock %s (%d)\n",
641 cip->clk->name, ret);
642 }
643
644 src = (clksrc & cip->bit) ? cip->src_1 : cip->src_0;
645
646 printk(KERN_INFO "%s: parent %s\n", cip->clk->name, src->name);
647 clk_set_parent(cip->clk, src);
648 }
649}
650
651/* clocks to add straight away */
652
653static struct clk *clks[] __initdata = {
654 &clk_ext,
655 &clk_usb_bus,
656 &clk_mrefclk,
657 &clk_armclk,
658};
659
660static struct clk_lookup s3c2412_clk_lookup[] = {
661 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
662 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
663 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_usysclk),
664};
665
666int __init s3c2412_baseclk_add(void)
667{
668 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
669 unsigned int dvs;
670 struct clk *clkp;
671 int ret;
672 int ptr;
673
674 clk_upll.enable = s3c2412_upll_enable;
675 clk_usb_bus.parent = &clk_usbsrc;
676 clk_usb_bus.rate = 0x0;
677
678 clk_f.parent = &clk_msysclk;
679
680 s3c2412_clk_initparents();
681
682 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
683 clkp = clks[ptr];
684
685 ret = s3c24xx_register_clock(clkp);
686 if (ret < 0) {
687 printk(KERN_ERR "Failed to register clock %s (%d)\n",
688 clkp->name, ret);
689 }
690 }
691
692 /* set the dvs state according to what we got at boot time */
693
694 dvs = __raw_readl(S3C2410_CLKDIVN) & S3C2412_CLKDIVN_DVSEN;
695
696 if (dvs)
697 clk_armclk.parent = &clk_h;
698
699 printk(KERN_INFO "S3C2412: DVS is %s\n", dvs ? "on" : "off");
700
701 /* ensure usb bus clock is within correct rate of 48MHz */
702
703 if (clk_get_rate(&clk_usb_bus) != (48 * 1000 * 1000)) {
704 printk(KERN_INFO "Warning: USB bus clock not at 48MHz\n");
705
706 /* for the moment, let's use the UPLL, and see if we can
707 * get 48MHz */
708
709 clk_set_parent(&clk_usysclk, &clk_upll);
710 clk_set_parent(&clk_usbsrc, &clk_usysclk);
711 clk_set_rate(&clk_usbsrc, 48*1000*1000);
712 }
713
714 printk("S3C2412: upll %s, %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n",
715 (__raw_readl(S3C2410_UPLLCON) & S3C2412_PLLCON_OFF) ? "off":"on",
716 print_mhz(clk_get_rate(&clk_upll)),
717 print_mhz(clk_get_rate(&clk_usb_bus)));
718
719 /* register clocks from clock array */
720
721 clkp = init_clocks;
722 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
723 /* ensure that we note the clock state */
724
725 clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0;
726
727 ret = s3c24xx_register_clock(clkp);
728 if (ret < 0) {
729 printk(KERN_ERR "Failed to register clock %s (%d)\n",
730 clkp->name, ret);
731 }
732 }
733
734 /* We must be careful disabling the clocks we are not intending to
735 * be using at boot time, as subsystems such as the LCD which do
736 * their own DMA requests to the bus can cause the system to lockup
737 * if they where in the middle of requesting bus access.
738 *
739 * Disabling the LCD clock if the LCD is active is very dangerous,
740 * and therefore the bootloader should be careful to not enable
741 * the LCD clock if it is not needed.
742 */
743
744 /* install (and disable) the clocks we do not need immediately */
745
746 clkp = init_clocks_disable;
747 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
748
749 ret = s3c24xx_register_clock(clkp);
750 if (ret < 0) {
751 printk(KERN_ERR "Failed to register clock %s (%d)\n",
752 clkp->name, ret);
753 }
754
755 s3c2412_clkcon_enable(clkp, 0);
756 }
757
758 clkdev_add_table(s3c2412_clk_lookup, ARRAY_SIZE(s3c2412_clk_lookup));
759 return 0;
760}
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2416.c b/arch/arm/mach-s3c24xx/clock-s3c2416.c
deleted file mode 100644
index d421a72920a5..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2416.c
+++ /dev/null
@@ -1,171 +0,0 @@
1/* linux/arch/arm/mach-s3c2416/clock.c
2 *
3 * Copyright (c) 2010 Simtec Electronics
4 * Copyright (c) 2010 Ben Dooks <ben-linux@fluff.org>
5 *
6 * S3C2416 Clock control 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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/init.h>
15#include <linux/clk.h>
16
17#include <plat/clock.h>
18#include <plat/clock-clksrc.h>
19#include <plat/cpu.h>
20
21#include <plat/cpu-freq.h>
22#include <plat/pll.h>
23
24#include <asm/mach/map.h>
25
26#include <mach/regs-clock.h>
27#include <mach/regs-s3c2443-clock.h>
28
29/* armdiv
30 *
31 * this clock is sourced from msysclk and can have a number of
32 * divider values applied to it to then be fed into armclk.
33 * The real clock definition is done in s3c2443-clock.c,
34 * only the armdiv divisor table must be defined here.
35*/
36
37static unsigned int armdiv[8] = {
38 [0] = 1,
39 [1] = 2,
40 [2] = 3,
41 [3] = 4,
42 [5] = 6,
43 [7] = 8,
44};
45
46static struct clksrc_clk hsspi_eplldiv = {
47 .clk = {
48 .name = "hsspi-eplldiv",
49 .parent = &clk_esysclk.clk,
50 .ctrlbit = (1 << 14),
51 .enable = s3c2443_clkcon_enable_s,
52 },
53 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 24 },
54};
55
56static struct clk *hsspi_sources[] = {
57 [0] = &hsspi_eplldiv.clk,
58 [1] = NULL, /* to fix */
59};
60
61static struct clksrc_clk hsspi_mux = {
62 .clk = {
63 .name = "hsspi-if",
64 },
65 .sources = &(struct clksrc_sources) {
66 .sources = hsspi_sources,
67 .nr_sources = ARRAY_SIZE(hsspi_sources),
68 },
69 .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 18 },
70};
71
72static struct clksrc_clk hsmmc_div[] = {
73 [0] = {
74 .clk = {
75 .name = "hsmmc-div",
76 .devname = "s3c-sdhci.0",
77 .parent = &clk_esysclk.clk,
78 },
79 .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 },
80 },
81 [1] = {
82 .clk = {
83 .name = "hsmmc-div",
84 .devname = "s3c-sdhci.1",
85 .parent = &clk_esysclk.clk,
86 },
87 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
88 },
89};
90
91static struct clksrc_clk hsmmc_mux0 = {
92 .clk = {
93 .name = "hsmmc-if",
94 .devname = "s3c-sdhci.0",
95 .ctrlbit = (1 << 6),
96 .enable = s3c2443_clkcon_enable_s,
97 },
98 .sources = &(struct clksrc_sources) {
99 .nr_sources = 2,
100 .sources = (struct clk * []) {
101 [0] = &hsmmc_div[0].clk,
102 [1] = NULL, /* to fix */
103 },
104 },
105 .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 16 },
106};
107
108static struct clksrc_clk hsmmc_mux1 = {
109 .clk = {
110 .name = "hsmmc-if",
111 .devname = "s3c-sdhci.1",
112 .ctrlbit = (1 << 12),
113 .enable = s3c2443_clkcon_enable_s,
114 },
115 .sources = &(struct clksrc_sources) {
116 .nr_sources = 2,
117 .sources = (struct clk * []) {
118 [0] = &hsmmc_div[1].clk,
119 [1] = NULL, /* to fix */
120 },
121 },
122 .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 17 },
123};
124
125static struct clk hsmmc0_clk = {
126 .name = "hsmmc",
127 .devname = "s3c-sdhci.0",
128 .parent = &clk_h,
129 .enable = s3c2443_clkcon_enable_h,
130 .ctrlbit = S3C2416_HCLKCON_HSMMC0,
131};
132
133static struct clksrc_clk *clksrcs[] __initdata = {
134 &hsspi_eplldiv,
135 &hsspi_mux,
136 &hsmmc_div[0],
137 &hsmmc_div[1],
138 &hsmmc_mux0,
139 &hsmmc_mux1,
140};
141
142static struct clk_lookup s3c2416_clk_lookup[] = {
143 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &hsmmc0_clk),
144 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &hsmmc_mux0.clk),
145 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &hsmmc_mux1.clk),
146 /* s3c2443-spi.0 is used on s3c2416 and s3c2450 as well */
147 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &hsspi_mux.clk),
148};
149
150void __init s3c2416_init_clocks(int xtal)
151{
152 u32 epllcon = __raw_readl(S3C2443_EPLLCON);
153 u32 epllcon1 = __raw_readl(S3C2443_EPLLCON+4);
154 int ptr;
155
156 /* s3c2416 EPLL compatible with s3c64xx */
157 clk_epll.rate = s3c_get_pll6553x(xtal, epllcon, epllcon1);
158
159 clk_epll.parent = &clk_epllref.clk;
160
161 s3c2443_common_init_clocks(xtal, s3c2416_get_pll,
162 armdiv, ARRAY_SIZE(armdiv),
163 S3C2416_CLKDIV0_ARMDIV_MASK);
164
165 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
166 s3c_register_clksrc(clksrcs[ptr], 1);
167
168 s3c24xx_register_clock(&hsmmc0_clk);
169 clkdev_add_table(s3c2416_clk_lookup, ARRAY_SIZE(s3c2416_clk_lookup));
170
171}
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c
deleted file mode 100644
index 5527226fd61f..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2440.c
+++ /dev/null
@@ -1,217 +0,0 @@
1/* linux/arch/arm/mach-s3c2440/clock.c
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2440 Clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/
23
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/device.h>
31#include <linux/interrupt.h>
32#include <linux/ioport.h>
33#include <linux/mutex.h>
34#include <linux/clk.h>
35#include <linux/io.h>
36#include <linux/serial_core.h>
37#include <linux/serial_s3c.h>
38
39#include <mach/hardware.h>
40#include <linux/atomic.h>
41#include <asm/irq.h>
42
43#include <mach/regs-clock.h>
44
45#include <plat/clock.h>
46#include <plat/cpu.h>
47
48/* S3C2440 extended clock support */
49
50static unsigned long s3c2440_camif_upll_round(struct clk *clk,
51 unsigned long rate)
52{
53 unsigned long parent_rate = clk_get_rate(clk->parent);
54 int div;
55
56 if (rate > parent_rate)
57 return parent_rate;
58
59 /* note, we remove the +/- 1 calculations for the divisor */
60
61 div = (parent_rate / rate) / 2;
62
63 if (div < 1)
64 div = 1;
65 else if (div > 16)
66 div = 16;
67
68 return parent_rate / (div * 2);
69}
70
71static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate)
72{
73 unsigned long parent_rate = clk_get_rate(clk->parent);
74 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
75
76 rate = s3c2440_camif_upll_round(clk, rate);
77
78 camdivn &= ~(S3C2440_CAMDIVN_CAMCLK_SEL | S3C2440_CAMDIVN_CAMCLK_MASK);
79
80 if (rate != parent_rate) {
81 camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
82 camdivn |= (((parent_rate / rate) / 2) - 1);
83 }
84
85 __raw_writel(camdivn, S3C2440_CAMDIVN);
86
87 return 0;
88}
89
90static unsigned long s3c2440_camif_upll_getrate(struct clk *clk)
91{
92 unsigned long parent_rate = clk_get_rate(clk->parent);
93 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
94
95 if (!(camdivn & S3C2440_CAMDIVN_CAMCLK_SEL))
96 return parent_rate;
97
98 camdivn &= S3C2440_CAMDIVN_CAMCLK_MASK;
99
100 return parent_rate / (camdivn + 1) / 2;
101}
102
103/* Extra S3C2440 clocks */
104
105static struct clk s3c2440_clk_cam = {
106 .name = "camif",
107 .enable = s3c2410_clkcon_enable,
108 .ctrlbit = S3C2440_CLKCON_CAMERA,
109};
110
111static struct clk s3c2440_clk_cam_upll = {
112 .name = "camif-upll",
113 .ops = &(struct clk_ops) {
114 .set_rate = s3c2440_camif_upll_setrate,
115 .get_rate = s3c2440_camif_upll_getrate,
116 .round_rate = s3c2440_camif_upll_round,
117 },
118};
119
120static struct clk s3c2440_clk_ac97 = {
121 .name = "ac97",
122 .enable = s3c2410_clkcon_enable,
123 .ctrlbit = S3C2440_CLKCON_AC97,
124};
125
126#define S3C24XX_VA_UART0 (S3C_VA_UART)
127#define S3C24XX_VA_UART1 (S3C_VA_UART + 0x4000 )
128#define S3C24XX_VA_UART2 (S3C_VA_UART + 0x8000 )
129#define S3C24XX_VA_UART3 (S3C_VA_UART + 0xC000 )
130
131static unsigned long s3c2440_fclk_n_getrate(struct clk *clk)
132{
133 unsigned long ucon0, ucon1, ucon2, divisor;
134
135 /* the fun of calculating the uart divisors on the s3c2440 */
136 ucon0 = __raw_readl(S3C24XX_VA_UART0 + S3C2410_UCON);
137 ucon1 = __raw_readl(S3C24XX_VA_UART1 + S3C2410_UCON);
138 ucon2 = __raw_readl(S3C24XX_VA_UART2 + S3C2410_UCON);
139
140 ucon0 &= S3C2440_UCON0_DIVMASK;
141 ucon1 &= S3C2440_UCON1_DIVMASK;
142 ucon2 &= S3C2440_UCON2_DIVMASK;
143
144 if (ucon0 != 0)
145 divisor = (ucon0 >> S3C2440_UCON_DIVSHIFT) + 6;
146 else if (ucon1 != 0)
147 divisor = (ucon1 >> S3C2440_UCON_DIVSHIFT) + 21;
148 else if (ucon2 != 0)
149 divisor = (ucon2 >> S3C2440_UCON_DIVSHIFT) + 36;
150 else
151 /* manual calims 44, seems to be 9 */
152 divisor = 9;
153
154 return clk_get_rate(clk->parent) / divisor;
155}
156
157static struct clk s3c2440_clk_fclk_n = {
158 .name = "fclk_n",
159 .parent = &clk_f,
160 .ops = &(struct clk_ops) {
161 .get_rate = s3c2440_fclk_n_getrate,
162 },
163};
164
165static struct clk_lookup s3c2440_clk_lookup[] = {
166 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
167 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
168 CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n),
169 CLKDEV_INIT("s3c2440-uart.0", "uart", &s3c24xx_clk_uart0),
170 CLKDEV_INIT("s3c2440-uart.1", "uart", &s3c24xx_clk_uart1),
171 CLKDEV_INIT("s3c2440-uart.2", "uart", &s3c24xx_clk_uart2),
172 CLKDEV_INIT("s3c2440-camif", "camera", &s3c2440_clk_cam_upll),
173};
174
175static int __init_refok s3c2440_clk_add(struct device *dev, struct subsys_interface *sif)
176{
177 struct clk *clock_upll;
178 struct clk *clock_h;
179 struct clk *clock_p;
180
181 clock_p = clk_get(NULL, "pclk");
182 clock_h = clk_get(NULL, "hclk");
183 clock_upll = clk_get(NULL, "upll");
184
185 if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) {
186 printk(KERN_ERR "S3C2440: Failed to get parent clocks\n");
187 return -EINVAL;
188 }
189
190 s3c2440_clk_cam.parent = clock_h;
191 s3c2440_clk_ac97.parent = clock_p;
192 s3c2440_clk_cam_upll.parent = clock_upll;
193 s3c24xx_register_clock(&s3c2440_clk_fclk_n);
194
195 s3c24xx_register_clock(&s3c2440_clk_ac97);
196 s3c24xx_register_clock(&s3c2440_clk_cam);
197 s3c24xx_register_clock(&s3c2440_clk_cam_upll);
198 clkdev_add_table(s3c2440_clk_lookup, ARRAY_SIZE(s3c2440_clk_lookup));
199
200 clk_disable(&s3c2440_clk_ac97);
201 clk_disable(&s3c2440_clk_cam);
202
203 return 0;
204}
205
206static struct subsys_interface s3c2440_clk_interface = {
207 .name = "s3c2440_clk",
208 .subsys = &s3c2440_subsys,
209 .add_dev = s3c2440_clk_add,
210};
211
212static __init int s3c24xx_clk_init(void)
213{
214 return subsys_interface_register(&s3c2440_clk_interface);
215}
216
217arch_initcall(s3c24xx_clk_init);
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2443.c b/arch/arm/mach-s3c24xx/clock-s3c2443.c
deleted file mode 100644
index 76cd31f7804e..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2443.c
+++ /dev/null
@@ -1,212 +0,0 @@
1/* linux/arch/arm/mach-s3c2443/clock.c
2 *
3 * Copyright (c) 2007, 2010 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2443 Clock control 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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <linux/init.h>
24
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/device.h>
31#include <linux/clk.h>
32#include <linux/mutex.h>
33#include <linux/serial_core.h>
34#include <linux/io.h>
35
36#include <asm/mach/map.h>
37
38#include <mach/hardware.h>
39
40#include <mach/regs-s3c2443-clock.h>
41
42#include <plat/cpu-freq.h>
43
44#include <plat/clock.h>
45#include <plat/clock-clksrc.h>
46#include <plat/cpu.h>
47
48/* We currently have to assume that the system is running
49 * from the XTPll input, and that all ***REFCLKs are being
50 * fed from it, as we cannot read the state of OM[4] from
51 * software.
52 *
53 * It would be possible for each board initialisation to
54 * set the correct muxing at initialisation
55*/
56
57/* clock selections */
58
59/* armdiv
60 *
61 * this clock is sourced from msysclk and can have a number of
62 * divider values applied to it to then be fed into armclk.
63 * The real clock definition is done in s3c2443-clock.c,
64 * only the armdiv divisor table must be defined here.
65*/
66
67static unsigned int armdiv[16] = {
68 [S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1,
69 [S3C2443_CLKDIV0_ARMDIV_2 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 2,
70 [S3C2443_CLKDIV0_ARMDIV_3 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 3,
71 [S3C2443_CLKDIV0_ARMDIV_4 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 4,
72 [S3C2443_CLKDIV0_ARMDIV_6 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 6,
73 [S3C2443_CLKDIV0_ARMDIV_8 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 8,
74 [S3C2443_CLKDIV0_ARMDIV_12 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 12,
75 [S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16,
76};
77
78/* hsspi
79 *
80 * high-speed spi clock, sourced from esysclk
81*/
82
83static struct clksrc_clk clk_hsspi = {
84 .clk = {
85 .name = "hsspi-if",
86 .parent = &clk_esysclk.clk,
87 .ctrlbit = S3C2443_SCLKCON_HSSPICLK,
88 .enable = s3c2443_clkcon_enable_s,
89 },
90 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 4 },
91};
92
93
94/* clk_hsmcc_div
95 *
96 * this clock is sourced from epll, and is fed through a divider,
97 * to a mux controlled by sclkcon where either it or a extclk can
98 * be fed to the hsmmc block
99*/
100
101static struct clksrc_clk clk_hsmmc_div = {
102 .clk = {
103 .name = "hsmmc-div",
104 .devname = "s3c-sdhci.1",
105 .parent = &clk_esysclk.clk,
106 },
107 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
108};
109
110static int s3c2443_setparent_hsmmc(struct clk *clk, struct clk *parent)
111{
112 unsigned long clksrc = __raw_readl(S3C2443_SCLKCON);
113
114 clksrc &= ~(S3C2443_SCLKCON_HSMMCCLK_EXT |
115 S3C2443_SCLKCON_HSMMCCLK_EPLL);
116
117 if (parent == &clk_epll)
118 clksrc |= S3C2443_SCLKCON_HSMMCCLK_EPLL;
119 else if (parent == &clk_ext)
120 clksrc |= S3C2443_SCLKCON_HSMMCCLK_EXT;
121 else
122 return -EINVAL;
123
124 if (clk->usage > 0) {
125 __raw_writel(clksrc, S3C2443_SCLKCON);
126 }
127
128 clk->parent = parent;
129 return 0;
130}
131
132static int s3c2443_enable_hsmmc(struct clk *clk, int enable)
133{
134 return s3c2443_setparent_hsmmc(clk, clk->parent);
135}
136
137static struct clk clk_hsmmc = {
138 .name = "hsmmc-if",
139 .devname = "s3c-sdhci.1",
140 .parent = &clk_hsmmc_div.clk,
141 .enable = s3c2443_enable_hsmmc,
142 .ops = &(struct clk_ops) {
143 .set_parent = s3c2443_setparent_hsmmc,
144 },
145};
146
147/* standard clock definitions */
148
149static struct clk init_clocks_off[] = {
150 {
151 .name = "sdi",
152 .parent = &clk_p,
153 .enable = s3c2443_clkcon_enable_p,
154 .ctrlbit = S3C2443_PCLKCON_SDI,
155 }, {
156 .name = "spi",
157 .devname = "s3c2410-spi.0",
158 .parent = &clk_p,
159 .enable = s3c2443_clkcon_enable_p,
160 .ctrlbit = S3C2443_PCLKCON_SPI1,
161 }
162};
163
164/* clocks to add straight away */
165
166static struct clksrc_clk *clksrcs[] __initdata = {
167 &clk_hsspi,
168 &clk_hsmmc_div,
169};
170
171static struct clk *clks[] __initdata = {
172 &clk_hsmmc,
173};
174
175static struct clk_lookup s3c2443_clk_lookup[] = {
176 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_hsmmc),
177 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &clk_hsspi.clk),
178};
179
180void __init s3c2443_init_clocks(int xtal)
181{
182 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
183 int ptr;
184
185 clk_epll.rate = s3c2443_get_epll(epllcon, xtal);
186 clk_epll.parent = &clk_epllref.clk;
187
188 s3c2443_common_init_clocks(xtal, s3c2443_get_mpll,
189 armdiv, ARRAY_SIZE(armdiv),
190 S3C2443_CLKDIV0_ARMDIV_MASK);
191
192 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
193
194 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
195 s3c_register_clksrc(clksrcs[ptr], 1);
196
197 /* We must be careful disabling the clocks we are not intending to
198 * be using at boot time, as subsystems such as the LCD which do
199 * their own DMA requests to the bus can cause the system to lockup
200 * if they where in the middle of requesting bus access.
201 *
202 * Disabling the LCD clock if the LCD is active is very dangerous,
203 * and therefore the bootloader should be careful to not enable
204 * the LCD clock if it is not needed.
205 */
206
207 /* install (and disable) the clocks we do not need immediately */
208
209 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
210 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
211 clkdev_add_table(s3c2443_clk_lookup, ARRAY_SIZE(s3c2443_clk_lookup));
212}
diff --git a/arch/arm/mach-s3c24xx/clock-s3c244x.c b/arch/arm/mach-s3c24xx/clock-s3c244x.c
deleted file mode 100644
index 6d9b688c442b..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c244x.c
+++ /dev/null
@@ -1,141 +0,0 @@
1/* linux/arch/arm/plat-s3c24xx/s3c24xx-clock.c
2 *
3 * Copyright (c) 2004-2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2440/S3C2442 Common clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/
23
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/device.h>
31#include <linux/interrupt.h>
32#include <linux/ioport.h>
33#include <linux/clk.h>
34#include <linux/io.h>
35
36#include <mach/hardware.h>
37#include <linux/atomic.h>
38#include <asm/irq.h>
39
40#include <mach/regs-clock.h>
41
42#include <plat/clock.h>
43#include <plat/cpu.h>
44
45static int s3c2440_setparent_armclk(struct clk *clk, struct clk *parent)
46{
47 unsigned long camdivn;
48 unsigned long dvs;
49
50 if (parent == &clk_f)
51 dvs = 0;
52 else if (parent == &clk_h)
53 dvs = S3C2440_CAMDIVN_DVSEN;
54 else
55 return -EINVAL;
56
57 clk->parent = parent;
58
59 camdivn = __raw_readl(S3C2440_CAMDIVN);
60 camdivn &= ~S3C2440_CAMDIVN_DVSEN;
61 camdivn |= dvs;
62 __raw_writel(camdivn, S3C2440_CAMDIVN);
63
64 return 0;
65}
66
67static struct clk clk_arm = {
68 .name = "armclk",
69 .id = -1,
70 .ops = &(struct clk_ops) {
71 .set_parent = s3c2440_setparent_armclk,
72 },
73};
74
75static int s3c244x_clk_add(struct device *dev, struct subsys_interface *sif)
76{
77 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
78 unsigned long clkdivn;
79 struct clk *clock_upll;
80 int ret;
81
82 printk("S3C244X: Clock Support, DVS %s\n",
83 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");
84
85 clk_arm.parent = (camdivn & S3C2440_CAMDIVN_DVSEN) ? &clk_h : &clk_f;
86
87 ret = s3c24xx_register_clock(&clk_arm);
88 if (ret < 0) {
89 printk(KERN_ERR "S3C24XX: Failed to add armclk (%d)\n", ret);
90 return ret;
91 }
92
93 clock_upll = clk_get(NULL, "upll");
94 if (IS_ERR(clock_upll)) {
95 printk(KERN_ERR "S3C244X: Failed to get upll clock\n");
96 return -ENOENT;
97 }
98
99 /* check rate of UPLL, and if it is near 96MHz, then change
100 * to using half the UPLL rate for the system */
101
102 if (clk_get_rate(clock_upll) > (94 * MHZ)) {
103 clk_usb_bus.rate = clk_get_rate(clock_upll) / 2;
104
105 spin_lock(&clocks_lock);
106
107 clkdivn = __raw_readl(S3C2410_CLKDIVN);
108 clkdivn |= S3C2440_CLKDIVN_UCLK;
109 __raw_writel(clkdivn, S3C2410_CLKDIVN);
110
111 spin_unlock(&clocks_lock);
112 }
113
114 return 0;
115}
116
117static struct subsys_interface s3c2440_clk_interface = {
118 .name = "s3c2440_clk",
119 .subsys = &s3c2440_subsys,
120 .add_dev = s3c244x_clk_add,
121};
122
123static int s3c2440_clk_init(void)
124{
125 return subsys_interface_register(&s3c2440_clk_interface);
126}
127
128arch_initcall(s3c2440_clk_init);
129
130static struct subsys_interface s3c2442_clk_interface = {
131 .name = "s3c2442_clk",
132 .subsys = &s3c2442_subsys,
133 .add_dev = s3c244x_clk_add,
134};
135
136static int s3c2442_clk_init(void)
137{
138 return subsys_interface_register(&s3c2442_clk_interface);
139}
140
141arch_initcall(s3c2442_clk_init);
diff --git a/arch/arm/mach-s3c24xx/common-s3c2443.c b/arch/arm/mach-s3c24xx/common-s3c2443.c
deleted file mode 100644
index 65d3eef73090..000000000000
--- a/arch/arm/mach-s3c24xx/common-s3c2443.c
+++ /dev/null
@@ -1,675 +0,0 @@
1/*
2 * Common code for SoCs starting with the S3C2443
3 *
4 * Copyright (c) 2007, 2010 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/init.h>
19#include <linux/clk.h>
20#include <linux/io.h>
21
22#include <mach/regs-s3c2443-clock.h>
23
24#include <plat/clock.h>
25#include <plat/clock-clksrc.h>
26#include <plat/cpu.h>
27
28#include <plat/cpu-freq.h>
29
30
31static int s3c2443_gate(void __iomem *reg, struct clk *clk, int enable)
32{
33 u32 ctrlbit = clk->ctrlbit;
34 u32 con = __raw_readl(reg);
35
36 if (enable)
37 con |= ctrlbit;
38 else
39 con &= ~ctrlbit;
40
41 __raw_writel(con, reg);
42 return 0;
43}
44
45int s3c2443_clkcon_enable_h(struct clk *clk, int enable)
46{
47 return s3c2443_gate(S3C2443_HCLKCON, clk, enable);
48}
49
50int s3c2443_clkcon_enable_p(struct clk *clk, int enable)
51{
52 return s3c2443_gate(S3C2443_PCLKCON, clk, enable);
53}
54
55int s3c2443_clkcon_enable_s(struct clk *clk, int enable)
56{
57 return s3c2443_gate(S3C2443_SCLKCON, clk, enable);
58}
59
60/* mpllref is a direct descendant of clk_xtal by default, but it is not
61 * elided as the EPLL can be either sourced by the XTAL or EXTCLK and as
62 * such directly equating the two source clocks is impossible.
63 */
64static struct clk clk_mpllref = {
65 .name = "mpllref",
66 .parent = &clk_xtal,
67};
68
69static struct clk *clk_epllref_sources[] = {
70 [0] = &clk_mpllref,
71 [1] = &clk_mpllref,
72 [2] = &clk_xtal,
73 [3] = &clk_ext,
74};
75
76struct clksrc_clk clk_epllref = {
77 .clk = {
78 .name = "epllref",
79 },
80 .sources = &(struct clksrc_sources) {
81 .sources = clk_epllref_sources,
82 .nr_sources = ARRAY_SIZE(clk_epllref_sources),
83 },
84 .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 7 },
85};
86
87/* esysclk
88 *
89 * this is sourced from either the EPLL or the EPLLref clock
90*/
91
92static struct clk *clk_sysclk_sources[] = {
93 [0] = &clk_epllref.clk,
94 [1] = &clk_epll,
95};
96
97struct clksrc_clk clk_esysclk = {
98 .clk = {
99 .name = "esysclk",
100 .parent = &clk_epll,
101 },
102 .sources = &(struct clksrc_sources) {
103 .sources = clk_sysclk_sources,
104 .nr_sources = ARRAY_SIZE(clk_sysclk_sources),
105 },
106 .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 6 },
107};
108
109static unsigned long s3c2443_getrate_mdivclk(struct clk *clk)
110{
111 unsigned long parent_rate = clk_get_rate(clk->parent);
112 unsigned long div = __raw_readl(S3C2443_CLKDIV0);
113
114 div &= S3C2443_CLKDIV0_EXTDIV_MASK;
115 div >>= (S3C2443_CLKDIV0_EXTDIV_SHIFT-1); /* x2 */
116
117 return parent_rate / (div + 1);
118}
119
120static struct clk clk_mdivclk = {
121 .name = "mdivclk",
122 .parent = &clk_mpllref,
123 .ops = &(struct clk_ops) {
124 .get_rate = s3c2443_getrate_mdivclk,
125 },
126};
127
128static struct clk *clk_msysclk_sources[] = {
129 [0] = &clk_mpllref,
130 [1] = &clk_mpll,
131 [2] = &clk_mdivclk,
132 [3] = &clk_mpllref,
133};
134
135static struct clksrc_clk clk_msysclk = {
136 .clk = {
137 .name = "msysclk",
138 .parent = &clk_xtal,
139 },
140 .sources = &(struct clksrc_sources) {
141 .sources = clk_msysclk_sources,
142 .nr_sources = ARRAY_SIZE(clk_msysclk_sources),
143 },
144 .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 3 },
145};
146
147/* prediv
148 *
149 * this divides the msysclk down to pass to h/p/etc.
150 */
151
152static unsigned long s3c2443_prediv_getrate(struct clk *clk)
153{
154 unsigned long rate = clk_get_rate(clk->parent);
155 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
156
157 clkdiv0 &= S3C2443_CLKDIV0_PREDIV_MASK;
158 clkdiv0 >>= S3C2443_CLKDIV0_PREDIV_SHIFT;
159
160 return rate / (clkdiv0 + 1);
161}
162
163static struct clk clk_prediv = {
164 .name = "prediv",
165 .parent = &clk_msysclk.clk,
166 .ops = &(struct clk_ops) {
167 .get_rate = s3c2443_prediv_getrate,
168 },
169};
170
171/* hclk divider
172 *
173 * divides the prediv and provides the hclk.
174 */
175
176static unsigned long s3c2443_hclkdiv_getrate(struct clk *clk)
177{
178 unsigned long rate = clk_get_rate(clk->parent);
179 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
180
181 clkdiv0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;
182
183 return rate / (clkdiv0 + 1);
184}
185
186static struct clk_ops clk_h_ops = {
187 .get_rate = s3c2443_hclkdiv_getrate,
188};
189
190/* pclk divider
191 *
192 * divides the hclk and provides the pclk.
193 */
194
195static unsigned long s3c2443_pclkdiv_getrate(struct clk *clk)
196{
197 unsigned long rate = clk_get_rate(clk->parent);
198 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
199
200 clkdiv0 = ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 1 : 0);
201
202 return rate / (clkdiv0 + 1);
203}
204
205static struct clk_ops clk_p_ops = {
206 .get_rate = s3c2443_pclkdiv_getrate,
207};
208
209/* armdiv
210 *
211 * this clock is sourced from msysclk and can have a number of
212 * divider values applied to it to then be fed into armclk.
213*/
214
215static unsigned int *armdiv;
216static int nr_armdiv;
217static int armdivmask;
218
219static unsigned long s3c2443_armclk_roundrate(struct clk *clk,
220 unsigned long rate)
221{
222 unsigned long parent = clk_get_rate(clk->parent);
223 unsigned long calc;
224 unsigned best = 256; /* bigger than any value */
225 unsigned div;
226 int ptr;
227
228 if (!nr_armdiv)
229 return -EINVAL;
230
231 for (ptr = 0; ptr < nr_armdiv; ptr++) {
232 div = armdiv[ptr];
233 if (div) {
234 /* cpufreq provides 266mhz as 266666000 not 266666666 */
235 calc = (parent / div / 1000) * 1000;
236 if (calc <= rate && div < best)
237 best = div;
238 }
239 }
240
241 return parent / best;
242}
243
244static unsigned long s3c2443_armclk_getrate(struct clk *clk)
245{
246 unsigned long rate = clk_get_rate(clk->parent);
247 unsigned long clkcon0;
248 int val;
249
250 if (!nr_armdiv || !armdivmask)
251 return -EINVAL;
252
253 clkcon0 = __raw_readl(S3C2443_CLKDIV0);
254 clkcon0 &= armdivmask;
255 val = clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT;
256
257 return rate / armdiv[val];
258}
259
260static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
261{
262 unsigned long parent = clk_get_rate(clk->parent);
263 unsigned long calc;
264 unsigned div;
265 unsigned best = 256; /* bigger than any value */
266 int ptr;
267 int val = -1;
268
269 if (!nr_armdiv || !armdivmask)
270 return -EINVAL;
271
272 for (ptr = 0; ptr < nr_armdiv; ptr++) {
273 div = armdiv[ptr];
274 if (div) {
275 /* cpufreq provides 266mhz as 266666000 not 266666666 */
276 calc = (parent / div / 1000) * 1000;
277 if (calc <= rate && div < best) {
278 best = div;
279 val = ptr;
280 }
281 }
282 }
283
284 if (val >= 0) {
285 unsigned long clkcon0;
286
287 clkcon0 = __raw_readl(S3C2443_CLKDIV0);
288 clkcon0 &= ~armdivmask;
289 clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT;
290 __raw_writel(clkcon0, S3C2443_CLKDIV0);
291 }
292
293 return (val == -1) ? -EINVAL : 0;
294}
295
296static struct clk clk_armdiv = {
297 .name = "armdiv",
298 .parent = &clk_msysclk.clk,
299 .ops = &(struct clk_ops) {
300 .round_rate = s3c2443_armclk_roundrate,
301 .get_rate = s3c2443_armclk_getrate,
302 .set_rate = s3c2443_armclk_setrate,
303 },
304};
305
306/* armclk
307 *
308 * this is the clock fed into the ARM core itself, from armdiv or from hclk.
309 */
310
311static struct clk *clk_arm_sources[] = {
312 [0] = &clk_armdiv,
313 [1] = &clk_h,
314};
315
316static struct clksrc_clk clk_arm = {
317 .clk = {
318 .name = "armclk",
319 },
320 .sources = &(struct clksrc_sources) {
321 .sources = clk_arm_sources,
322 .nr_sources = ARRAY_SIZE(clk_arm_sources),
323 },
324 .reg_src = { .reg = S3C2443_CLKDIV0, .size = 1, .shift = 13 },
325};
326
327/* usbhost
328 *
329 * usb host bus-clock, usually 48MHz to provide USB bus clock timing
330*/
331
332static struct clksrc_clk clk_usb_bus_host = {
333 .clk = {
334 .name = "usb-bus-host-parent",
335 .parent = &clk_esysclk.clk,
336 .ctrlbit = S3C2443_SCLKCON_USBHOST,
337 .enable = s3c2443_clkcon_enable_s,
338 },
339 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 4 },
340};
341
342/* common clksrc clocks */
343
344static struct clksrc_clk clksrc_clks[] = {
345 {
346 /* camera interface bus-clock, divided down from esysclk */
347 .clk = {
348 .name = "camif-upll", /* same as 2440 name */
349 .parent = &clk_esysclk.clk,
350 .ctrlbit = S3C2443_SCLKCON_CAMCLK,
351 .enable = s3c2443_clkcon_enable_s,
352 },
353 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 26 },
354 }, {
355 .clk = {
356 .name = "display-if",
357 .parent = &clk_esysclk.clk,
358 .ctrlbit = S3C2443_SCLKCON_DISPCLK,
359 .enable = s3c2443_clkcon_enable_s,
360 },
361 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 8, .shift = 16 },
362 },
363};
364
365static struct clksrc_clk clk_esys_uart = {
366 /* ART baud-rate clock sourced from esysclk via a divisor */
367 .clk = {
368 .name = "uartclk",
369 .parent = &clk_esysclk.clk,
370 },
371 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 8 },
372};
373
374static struct clk clk_i2s_ext = {
375 .name = "i2s-ext",
376};
377
378/* i2s_eplldiv
379 *
380 * This clock is the output from the I2S divisor of ESYSCLK, and is separate
381 * from the mux that comes after it (cannot merge into one single clock)
382*/
383
384static struct clksrc_clk clk_i2s_eplldiv = {
385 .clk = {
386 .name = "i2s-eplldiv",
387 .parent = &clk_esysclk.clk,
388 },
389 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 12, },
390};
391
392/* i2s-ref
393 *
394 * i2s bus reference clock, selectable from external, esysclk or epllref
395 *
396 * Note, this used to be two clocks, but was compressed into one.
397*/
398
399static struct clk *clk_i2s_srclist[] = {
400 [0] = &clk_i2s_eplldiv.clk,
401 [1] = &clk_i2s_ext,
402 [2] = &clk_epllref.clk,
403 [3] = &clk_epllref.clk,
404};
405
406static struct clksrc_clk clk_i2s = {
407 .clk = {
408 .name = "i2s-if",
409 .ctrlbit = S3C2443_SCLKCON_I2SCLK,
410 .enable = s3c2443_clkcon_enable_s,
411
412 },
413 .sources = &(struct clksrc_sources) {
414 .sources = clk_i2s_srclist,
415 .nr_sources = ARRAY_SIZE(clk_i2s_srclist),
416 },
417 .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 14 },
418};
419
420static struct clk init_clocks_off[] = {
421 {
422 .name = "iis",
423 .parent = &clk_p,
424 .enable = s3c2443_clkcon_enable_p,
425 .ctrlbit = S3C2443_PCLKCON_IIS,
426 }, {
427 .name = "adc",
428 .parent = &clk_p,
429 .enable = s3c2443_clkcon_enable_p,
430 .ctrlbit = S3C2443_PCLKCON_ADC,
431 }, {
432 .name = "i2c",
433 .parent = &clk_p,
434 .enable = s3c2443_clkcon_enable_p,
435 .ctrlbit = S3C2443_PCLKCON_IIC,
436 }
437};
438
439static struct clk init_clocks[] = {
440 {
441 .name = "dma.0",
442 .parent = &clk_h,
443 .enable = s3c2443_clkcon_enable_h,
444 .ctrlbit = S3C2443_HCLKCON_DMA0,
445 }, {
446 .name = "dma.1",
447 .parent = &clk_h,
448 .enable = s3c2443_clkcon_enable_h,
449 .ctrlbit = S3C2443_HCLKCON_DMA1,
450 }, {
451 .name = "dma.2",
452 .parent = &clk_h,
453 .enable = s3c2443_clkcon_enable_h,
454 .ctrlbit = S3C2443_HCLKCON_DMA2,
455 }, {
456 .name = "dma.3",
457 .parent = &clk_h,
458 .enable = s3c2443_clkcon_enable_h,
459 .ctrlbit = S3C2443_HCLKCON_DMA3,
460 }, {
461 .name = "dma.4",
462 .parent = &clk_h,
463 .enable = s3c2443_clkcon_enable_h,
464 .ctrlbit = S3C2443_HCLKCON_DMA4,
465 }, {
466 .name = "dma.5",
467 .parent = &clk_h,
468 .enable = s3c2443_clkcon_enable_h,
469 .ctrlbit = S3C2443_HCLKCON_DMA5,
470 }, {
471 .name = "gpio",
472 .parent = &clk_p,
473 .enable = s3c2443_clkcon_enable_p,
474 .ctrlbit = S3C2443_PCLKCON_GPIO,
475 }, {
476 .name = "usb-host",
477 .parent = &clk_h,
478 .enable = s3c2443_clkcon_enable_h,
479 .ctrlbit = S3C2443_HCLKCON_USBH,
480 }, {
481 .name = "usb-device",
482 .parent = &clk_h,
483 .enable = s3c2443_clkcon_enable_h,
484 .ctrlbit = S3C2443_HCLKCON_USBD,
485 }, {
486 .name = "lcd",
487 .parent = &clk_h,
488 .enable = s3c2443_clkcon_enable_h,
489 .ctrlbit = S3C2443_HCLKCON_LCDC,
490
491 }, {
492 .name = "timers",
493 .parent = &clk_p,
494 .enable = s3c2443_clkcon_enable_p,
495 .ctrlbit = S3C2443_PCLKCON_PWMT,
496 }, {
497 .name = "cfc",
498 .parent = &clk_h,
499 .enable = s3c2443_clkcon_enable_h,
500 .ctrlbit = S3C2443_HCLKCON_CFC,
501 }, {
502 .name = "ssmc",
503 .parent = &clk_h,
504 .enable = s3c2443_clkcon_enable_h,
505 .ctrlbit = S3C2443_HCLKCON_SSMC,
506 }, {
507 .name = "uart",
508 .devname = "s3c2440-uart.0",
509 .parent = &clk_p,
510 .enable = s3c2443_clkcon_enable_p,
511 .ctrlbit = S3C2443_PCLKCON_UART0,
512 }, {
513 .name = "uart",
514 .devname = "s3c2440-uart.1",
515 .parent = &clk_p,
516 .enable = s3c2443_clkcon_enable_p,
517 .ctrlbit = S3C2443_PCLKCON_UART1,
518 }, {
519 .name = "uart",
520 .devname = "s3c2440-uart.2",
521 .parent = &clk_p,
522 .enable = s3c2443_clkcon_enable_p,
523 .ctrlbit = S3C2443_PCLKCON_UART2,
524 }, {
525 .name = "uart",
526 .devname = "s3c2440-uart.3",
527 .parent = &clk_p,
528 .enable = s3c2443_clkcon_enable_p,
529 .ctrlbit = S3C2443_PCLKCON_UART3,
530 }, {
531 .name = "rtc",
532 .parent = &clk_p,
533 .enable = s3c2443_clkcon_enable_p,
534 .ctrlbit = S3C2443_PCLKCON_RTC,
535 }, {
536 .name = "watchdog",
537 .parent = &clk_p,
538 .ctrlbit = S3C2443_PCLKCON_WDT,
539 }, {
540 .name = "ac97",
541 .parent = &clk_p,
542 .ctrlbit = S3C2443_PCLKCON_AC97,
543 }, {
544 .name = "nand",
545 .parent = &clk_h,
546 }, {
547 .name = "usb-bus-host",
548 .parent = &clk_usb_bus_host.clk,
549 }
550};
551
552static struct clk hsmmc1_clk = {
553 .name = "hsmmc",
554 .devname = "s3c-sdhci.1",
555 .parent = &clk_h,
556 .enable = s3c2443_clkcon_enable_h,
557 .ctrlbit = S3C2443_HCLKCON_HSMMC,
558};
559
560static struct clk hsspi_clk = {
561 .name = "spi",
562 .devname = "s3c2443-spi.0",
563 .parent = &clk_p,
564 .enable = s3c2443_clkcon_enable_p,
565 .ctrlbit = S3C2443_PCLKCON_HSSPI,
566};
567
568/* EPLLCON compatible enough to get on/off information */
569
570void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
571{
572 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
573 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
574 struct clk *xtal_clk;
575 unsigned long xtal;
576 unsigned long pll;
577 int ptr;
578
579 xtal_clk = clk_get(NULL, "xtal");
580 xtal = clk_get_rate(xtal_clk);
581 clk_put(xtal_clk);
582
583 pll = get_mpll(mpllcon, xtal);
584 clk_msysclk.clk.rate = pll;
585 clk_mpll.rate = pll;
586
587 printk("CPU: MPLL %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n",
588 (mpllcon & S3C2443_PLLCON_OFF) ? "off" : "on",
589 print_mhz(pll), print_mhz(clk_get_rate(&clk_armdiv)),
590 print_mhz(clk_get_rate(&clk_h)),
591 print_mhz(clk_get_rate(&clk_p)));
592
593 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_clks); ptr++)
594 s3c_set_clksrc(&clksrc_clks[ptr], true);
595
596 /* ensure usb bus clock is within correct rate of 48MHz */
597
598 if (clk_get_rate(&clk_usb_bus_host.clk) != (48 * 1000 * 1000)) {
599 printk(KERN_INFO "Warning: USB host bus not at 48MHz\n");
600 clk_set_rate(&clk_usb_bus_host.clk, 48*1000*1000);
601 }
602
603 printk("CPU: EPLL %s %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n",
604 (epllcon & S3C2443_PLLCON_OFF) ? "off" : "on",
605 print_mhz(clk_get_rate(&clk_epll)),
606 print_mhz(clk_get_rate(&clk_usb_bus)));
607}
608
609static struct clk *clks[] __initdata = {
610 &clk_prediv,
611 &clk_mpllref,
612 &clk_mdivclk,
613 &clk_ext,
614 &clk_epll,
615 &clk_usb_bus,
616 &clk_armdiv,
617 &hsmmc1_clk,
618 &hsspi_clk,
619};
620
621static struct clksrc_clk *clksrcs[] __initdata = {
622 &clk_i2s_eplldiv,
623 &clk_i2s,
624 &clk_usb_bus_host,
625 &clk_epllref,
626 &clk_esysclk,
627 &clk_msysclk,
628 &clk_arm,
629};
630
631static struct clk_lookup s3c2443_clk_lookup[] = {
632 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
633 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
634 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_esys_uart.clk),
635 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &hsmmc1_clk),
636 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk0", &hsspi_clk),
637};
638
639void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
640 unsigned int *divs, int nr_divs,
641 int divmask)
642{
643 int ptr;
644
645 armdiv = divs;
646 nr_armdiv = nr_divs;
647 armdivmask = divmask;
648
649 /* s3c2443 parents h clock from prediv */
650 clk_h.parent = &clk_prediv;
651 clk_h.ops = &clk_h_ops;
652
653 /* and p clock from h clock */
654 clk_p.parent = &clk_h;
655 clk_p.ops = &clk_p_ops;
656
657 clk_usb_bus.parent = &clk_usb_bus_host.clk;
658 clk_epll.parent = &clk_epllref.clk;
659
660 s3c24xx_register_baseclocks(xtal);
661 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
662
663 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
664 s3c_register_clksrc(clksrcs[ptr], 1);
665
666 s3c_register_clksrc(clksrc_clks, ARRAY_SIZE(clksrc_clks));
667 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
668
669 /* See s3c2443/etc notes on disabling clocks at init time */
670 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
671 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
672 clkdev_add_table(s3c2443_clk_lookup, ARRAY_SIZE(s3c2443_clk_lookup));
673
674 s3c2443_common_setup_clocks(get_mpll);
675}
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 1bc8e73c94f9..c0763b837745 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -53,6 +53,7 @@
53#include <plat/cpu-freq.h> 53#include <plat/cpu-freq.h>
54#include <plat/pll.h> 54#include <plat/pll.h>
55#include <plat/pwm-core.h> 55#include <plat/pwm-core.h>
56#include <plat/watchdog-reset.h>
56 57
57#include "common.h" 58#include "common.h"
58 59
@@ -73,7 +74,6 @@ static struct cpu_table cpu_ids[] __initdata = {
73 .idcode = 0x32410000, 74 .idcode = 0x32410000,
74 .idmask = 0xffffffff, 75 .idmask = 0xffffffff,
75 .map_io = s3c2410_map_io, 76 .map_io = s3c2410_map_io,
76 .init_clocks = s3c2410_init_clocks,
77 .init_uarts = s3c2410_init_uarts, 77 .init_uarts = s3c2410_init_uarts,
78 .init = s3c2410_init, 78 .init = s3c2410_init,
79 .name = name_s3c2410 79 .name = name_s3c2410
@@ -82,7 +82,6 @@ static struct cpu_table cpu_ids[] __initdata = {
82 .idcode = 0x32410002, 82 .idcode = 0x32410002,
83 .idmask = 0xffffffff, 83 .idmask = 0xffffffff,
84 .map_io = s3c2410_map_io, 84 .map_io = s3c2410_map_io,
85 .init_clocks = s3c2410_init_clocks,
86 .init_uarts = s3c2410_init_uarts, 85 .init_uarts = s3c2410_init_uarts,
87 .init = s3c2410a_init, 86 .init = s3c2410a_init,
88 .name = name_s3c2410a 87 .name = name_s3c2410a
@@ -91,7 +90,6 @@ static struct cpu_table cpu_ids[] __initdata = {
91 .idcode = 0x32440000, 90 .idcode = 0x32440000,
92 .idmask = 0xffffffff, 91 .idmask = 0xffffffff,
93 .map_io = s3c2440_map_io, 92 .map_io = s3c2440_map_io,
94 .init_clocks = s3c244x_init_clocks,
95 .init_uarts = s3c244x_init_uarts, 93 .init_uarts = s3c244x_init_uarts,
96 .init = s3c2440_init, 94 .init = s3c2440_init,
97 .name = name_s3c2440 95 .name = name_s3c2440
@@ -100,7 +98,6 @@ static struct cpu_table cpu_ids[] __initdata = {
100 .idcode = 0x32440001, 98 .idcode = 0x32440001,
101 .idmask = 0xffffffff, 99 .idmask = 0xffffffff,
102 .map_io = s3c2440_map_io, 100 .map_io = s3c2440_map_io,
103 .init_clocks = s3c244x_init_clocks,
104 .init_uarts = s3c244x_init_uarts, 101 .init_uarts = s3c244x_init_uarts,
105 .init = s3c2440_init, 102 .init = s3c2440_init,
106 .name = name_s3c2440a 103 .name = name_s3c2440a
@@ -109,7 +106,6 @@ static struct cpu_table cpu_ids[] __initdata = {
109 .idcode = 0x32440aaa, 106 .idcode = 0x32440aaa,
110 .idmask = 0xffffffff, 107 .idmask = 0xffffffff,
111 .map_io = s3c2442_map_io, 108 .map_io = s3c2442_map_io,
112 .init_clocks = s3c244x_init_clocks,
113 .init_uarts = s3c244x_init_uarts, 109 .init_uarts = s3c244x_init_uarts,
114 .init = s3c2442_init, 110 .init = s3c2442_init,
115 .name = name_s3c2442 111 .name = name_s3c2442
@@ -118,7 +114,6 @@ static struct cpu_table cpu_ids[] __initdata = {
118 .idcode = 0x32440aab, 114 .idcode = 0x32440aab,
119 .idmask = 0xffffffff, 115 .idmask = 0xffffffff,
120 .map_io = s3c2442_map_io, 116 .map_io = s3c2442_map_io,
121 .init_clocks = s3c244x_init_clocks,
122 .init_uarts = s3c244x_init_uarts, 117 .init_uarts = s3c244x_init_uarts,
123 .init = s3c2442_init, 118 .init = s3c2442_init,
124 .name = name_s3c2442b 119 .name = name_s3c2442b
@@ -127,7 +122,6 @@ static struct cpu_table cpu_ids[] __initdata = {
127 .idcode = 0x32412001, 122 .idcode = 0x32412001,
128 .idmask = 0xffffffff, 123 .idmask = 0xffffffff,
129 .map_io = s3c2412_map_io, 124 .map_io = s3c2412_map_io,
130 .init_clocks = s3c2412_init_clocks,
131 .init_uarts = s3c2412_init_uarts, 125 .init_uarts = s3c2412_init_uarts,
132 .init = s3c2412_init, 126 .init = s3c2412_init,
133 .name = name_s3c2412, 127 .name = name_s3c2412,
@@ -136,7 +130,6 @@ static struct cpu_table cpu_ids[] __initdata = {
136 .idcode = 0x32412003, 130 .idcode = 0x32412003,
137 .idmask = 0xffffffff, 131 .idmask = 0xffffffff,
138 .map_io = s3c2412_map_io, 132 .map_io = s3c2412_map_io,
139 .init_clocks = s3c2412_init_clocks,
140 .init_uarts = s3c2412_init_uarts, 133 .init_uarts = s3c2412_init_uarts,
141 .init = s3c2412_init, 134 .init = s3c2412_init,
142 .name = name_s3c2412, 135 .name = name_s3c2412,
@@ -145,7 +138,6 @@ static struct cpu_table cpu_ids[] __initdata = {
145 .idcode = 0x32450003, 138 .idcode = 0x32450003,
146 .idmask = 0xffffffff, 139 .idmask = 0xffffffff,
147 .map_io = s3c2416_map_io, 140 .map_io = s3c2416_map_io,
148 .init_clocks = s3c2416_init_clocks,
149 .init_uarts = s3c2416_init_uarts, 141 .init_uarts = s3c2416_init_uarts,
150 .init = s3c2416_init, 142 .init = s3c2416_init,
151 .name = name_s3c2416, 143 .name = name_s3c2416,
@@ -154,7 +146,6 @@ static struct cpu_table cpu_ids[] __initdata = {
154 .idcode = 0x32443001, 146 .idcode = 0x32443001,
155 .idmask = 0xffffffff, 147 .idmask = 0xffffffff,
156 .map_io = s3c2443_map_io, 148 .map_io = s3c2443_map_io,
157 .init_clocks = s3c2443_init_clocks,
158 .init_uarts = s3c2443_init_uarts, 149 .init_uarts = s3c2443_init_uarts,
159 .init = s3c2443_init, 150 .init = s3c2443_init,
160 .name = name_s3c2443, 151 .name = name_s3c2443,
@@ -316,21 +307,6 @@ struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
316 }, 307 },
317}; 308};
318 309
319/* initialise all the clocks */
320
321void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
322 unsigned long hclk,
323 unsigned long pclk)
324{
325 clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
326 clk_xtal.rate);
327
328 clk_mpll.rate = fclk;
329 clk_h.rate = hclk;
330 clk_p.rate = pclk;
331 clk_f.rate = fclk;
332}
333
334#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 310#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
335 defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) 311 defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
336static struct resource s3c2410_dma_resource[] = { 312static struct resource s3c2410_dma_resource[] = {
@@ -534,3 +510,62 @@ struct platform_device s3c2443_device_dma = {
534 }, 510 },
535}; 511};
536#endif 512#endif
513
514#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
515void __init s3c2410_init_clocks(int xtal)
516{
517 s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
518 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
519}
520#endif
521
522#ifdef CONFIG_CPU_S3C2412
523void __init s3c2412_init_clocks(int xtal)
524{
525 s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
526}
527#endif
528
529#ifdef CONFIG_CPU_S3C2416
530void __init s3c2416_init_clocks(int xtal)
531{
532 s3c2443_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
533}
534#endif
535
536#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
537void __init s3c2440_init_clocks(int xtal)
538{
539 s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
540 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
541}
542#endif
543
544#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
545void __init s3c2442_init_clocks(int xtal)
546{
547 s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
548 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
549}
550#endif
551
552#ifdef CONFIG_CPU_S3C2443
553void __init s3c2443_init_clocks(int xtal)
554{
555 s3c2443_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
556}
557#endif
558
559#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2440) || \
560 defined(CONFIG_CPU_S3C2442)
561static struct resource s3c2410_dclk_resource[] = {
562 [0] = DEFINE_RES_MEM(0x56000084, 0x4),
563};
564
565struct platform_device s3c2410_device_dclk = {
566 .name = "s3c2410-dclk",
567 .id = 0,
568 .num_resources = ARRAY_SIZE(s3c2410_dclk_resource),
569 .resource = s3c2410_dclk_resource,
570};
571#endif
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
index e46c10417216..ac3ff12a0601 100644
--- a/arch/arm/mach-s3c24xx/common.h
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -67,16 +67,15 @@ extern struct syscore_ops s3c2416_irq_syscore_ops;
67#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) 67#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
68extern void s3c244x_map_io(void); 68extern void s3c244x_map_io(void);
69extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no); 69extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
70extern void s3c244x_init_clocks(int xtal);
71extern void s3c244x_restart(enum reboot_mode mode, const char *cmd); 70extern void s3c244x_restart(enum reboot_mode mode, const char *cmd);
72#else 71#else
73#define s3c244x_init_clocks NULL
74#define s3c244x_init_uarts NULL 72#define s3c244x_init_uarts NULL
75#endif 73#endif
76 74
77#ifdef CONFIG_CPU_S3C2440 75#ifdef CONFIG_CPU_S3C2440
78extern int s3c2440_init(void); 76extern int s3c2440_init(void);
79extern void s3c2440_map_io(void); 77extern void s3c2440_map_io(void);
78extern void s3c2440_init_clocks(int xtal);
80extern void s3c2440_init_irq(void); 79extern void s3c2440_init_irq(void);
81#else 80#else
82#define s3c2440_init NULL 81#define s3c2440_init NULL
@@ -86,6 +85,7 @@ extern void s3c2440_init_irq(void);
86#ifdef CONFIG_CPU_S3C2442 85#ifdef CONFIG_CPU_S3C2442
87extern int s3c2442_init(void); 86extern int s3c2442_init(void);
88extern void s3c2442_map_io(void); 87extern void s3c2442_map_io(void);
88extern void s3c2442_init_clocks(int xtal);
89extern void s3c2442_init_irq(void); 89extern void s3c2442_init_irq(void);
90#else 90#else
91#define s3c2442_init NULL 91#define s3c2442_init NULL
@@ -114,4 +114,21 @@ extern struct platform_device s3c2412_device_dma;
114extern struct platform_device s3c2440_device_dma; 114extern struct platform_device s3c2440_device_dma;
115extern struct platform_device s3c2443_device_dma; 115extern struct platform_device s3c2443_device_dma;
116 116
117extern struct platform_device s3c2410_device_dclk;
118
119#ifdef CONFIG_S3C2410_COMMON_CLK
120void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
121 int current_soc,
122 void __iomem *reg_base);
123#endif
124#ifdef CONFIG_S3C2412_COMMON_CLK
125void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
126 unsigned long ext_f, void __iomem *reg_base);
127#endif
128#ifdef CONFIG_S3C2443_COMMON_CLK
129void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
130 int current_soc,
131 void __iomem *reg_base);
132#endif
133
117#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */ 134#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
diff --git a/arch/arm/mach-s3c24xx/cpufreq-utils.c b/arch/arm/mach-s3c24xx/cpufreq-utils.c
index 2a0aa5684e72..d4d9514335f4 100644
--- a/arch/arm/mach-s3c24xx/cpufreq-utils.c
+++ b/arch/arm/mach-s3c24xx/cpufreq-utils.c
@@ -14,6 +14,7 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/cpufreq.h> 15#include <linux/cpufreq.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/clk.h>
17 18
18#include <mach/map.h> 19#include <mach/map.h>
19#include <mach/regs-clock.h> 20#include <mach/regs-clock.h>
@@ -60,5 +61,6 @@ void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
60 */ 61 */
61void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg) 62void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
62{ 63{
63 __raw_writel(cfg->pll.driver_data, S3C2410_MPLLCON); 64 if (!IS_ERR(cfg->mpll))
65 clk_set_rate(cfg->mpll, cfg->pll.frequency);
64} 66}
diff --git a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
deleted file mode 100644
index 2f39737544c0..000000000000
--- a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
+++ /dev/null
@@ -1,101 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Copyright (C) 2005 Simtec Electronics
7 *
8 * Moved from linux/arch/arm/kernel/debug.S 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 <mach/map.h>
16#include <mach/regs-gpio.h>
17#include <linux/serial_s3c.h>
18
19#define S3C2410_UART1_OFF (0x4000)
20#define SHIFT_2440TXF (14-9)
21
22 .macro addruart, rp, rv, tmp
23 ldr \rp, = S3C24XX_PA_UART
24 ldr \rv, = S3C24XX_VA_UART
25#if CONFIG_DEBUG_S3C_UART != 0
26 add \rp, \rp, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
27 add \rv, \rv, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
28#endif
29 .endm
30
31 .macro fifo_full_s3c24xx rd, rx
32 @ check for arm920 vs arm926. currently assume all arm926
33 @ devices have an 64 byte FIFO identical to the s3c2440
34 mrc p15, 0, \rd, c0, c0
35 and \rd, \rd, #0xff0
36 teq \rd, #0x260
37 beq 1004f
38 mrc p15, 0, \rd, c1, c0
39 tst \rd, #1
40 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
41 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
42 bic \rd, \rd, #0xff000
43 ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
44 and \rd, \rd, #0x00ff0000
45 teq \rd, #0x00440000 @ is it 2440?
461004:
47 ldr \rd, [\rx, # S3C2410_UFSTAT]
48 moveq \rd, \rd, lsr #SHIFT_2440TXF
49 tst \rd, #S3C2410_UFSTAT_TXFULL
50 .endm
51
52 .macro fifo_full_s3c2410 rd, rx
53 ldr \rd, [\rx, # S3C2410_UFSTAT]
54 tst \rd, #S3C2410_UFSTAT_TXFULL
55 .endm
56
57/* fifo level reading */
58
59 .macro fifo_level_s3c24xx rd, rx
60 @ check for arm920 vs arm926. currently assume all arm926
61 @ devices have an 64 byte FIFO identical to the s3c2440
62 mrc p15, 0, \rd, c0, c0
63 and \rd, \rd, #0xff0
64 teq \rd, #0x260
65 beq 10000f
66 mrc p15, 0, \rd, c1, c0
67 tst \rd, #1
68 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
69 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
70 bic \rd, \rd, #0xff000
71 ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
72 and \rd, \rd, #0x00ff0000
73 teq \rd, #0x00440000 @ is it 2440?
74
7510000:
76 ldr \rd, [\rx, # S3C2410_UFSTAT]
77 andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
78 andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
79 .endm
80
81 .macro fifo_level_s3c2410 rd, rx
82 ldr \rd, [\rx, # S3C2410_UFSTAT]
83 and \rd, \rd, #S3C2410_UFSTAT_TXMASK
84 .endm
85
86/* Select the correct implementation depending on the configuration. The
87 * S3C2440 will get selected by default, as these are the most widely
88 * used variants of these
89*/
90
91#if defined(CONFIG_CPU_LLSERIAL_S3C2410_ONLY)
92#define fifo_full fifo_full_s3c2410
93#define fifo_level fifo_level_s3c2410
94#elif !defined(CONFIG_CPU_LLSERIAL_S3C2440_ONLY)
95#define fifo_full fifo_full_s3c24xx
96#define fifo_level fifo_level_s3c24xx
97#endif
98
99/* include the reset of the code which will do the work */
100
101#include <debug/samsung.S>
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
index 3415b60082d7..3db6c10de023 100644
--- a/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
@@ -42,24 +42,6 @@
42#define S3C2410_CLKCON_IIS (1<<17) 42#define S3C2410_CLKCON_IIS (1<<17)
43#define S3C2410_CLKCON_SPI (1<<18) 43#define S3C2410_CLKCON_SPI (1<<18)
44 44
45/* DCLKCON register addresses in gpio.h */
46
47#define S3C2410_DCLKCON_DCLK0EN (1<<0)
48#define S3C2410_DCLKCON_DCLK0_PCLK (0<<1)
49#define S3C2410_DCLKCON_DCLK0_UCLK (1<<1)
50#define S3C2410_DCLKCON_DCLK0_DIV(x) (((x) - 1 )<<4)
51#define S3C2410_DCLKCON_DCLK0_CMP(x) (((x) - 1 )<<8)
52#define S3C2410_DCLKCON_DCLK0_DIV_MASK ((0xf)<<4)
53#define S3C2410_DCLKCON_DCLK0_CMP_MASK ((0xf)<<8)
54
55#define S3C2410_DCLKCON_DCLK1EN (1<<16)
56#define S3C2410_DCLKCON_DCLK1_PCLK (0<<17)
57#define S3C2410_DCLKCON_DCLK1_UCLK (1<<17)
58#define S3C2410_DCLKCON_DCLK1_DIV(x) (((x) - 1) <<20)
59#define S3C2410_DCLKCON_DCLK1_CMP(x) (((x) - 1) <<24)
60#define S3C2410_DCLKCON_DCLK1_DIV_MASK ((0xf) <<20)
61#define S3C2410_DCLKCON_DCLK1_CMP_MASK ((0xf) <<24)
62
63#define S3C2410_CLKDIVN_PDIVN (1<<0) 45#define S3C2410_CLKDIVN_PDIVN (1<<0)
64#define S3C2410_CLKDIVN_HDIVN (1<<1) 46#define S3C2410_CLKDIVN_HDIVN (1<<1)
65 47
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
index c2ef016032ab..c6583cfa5835 100644
--- a/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
@@ -457,9 +457,6 @@
457 457
458/* miscellaneous control */ 458/* miscellaneous control */
459#define S3C2410_MISCCR S3C2410_GPIOREG(0x80) 459#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
460#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
461
462#define S3C24XX_DCLKCON S3C24XX_GPIOREG2(0x84)
463 460
464/* see clock.h for dclk definitions */ 461/* see clock.h for dclk definitions */
465 462
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index 8ac9554aa996..5157e250dd13 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -161,11 +161,16 @@ static struct platform_device *amlm5900_devices[] __initdata = {
161static void __init amlm5900_map_io(void) 161static void __init amlm5900_map_io(void)
162{ 162{
163 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); 163 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
164 s3c24xx_init_clocks(0);
165 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); 164 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
166 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 165 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
167} 166}
168 167
168static void __init amlm5900_init_time(void)
169{
170 s3c2410_init_clocks(12000000);
171 samsung_timer_init();
172}
173
169#ifdef CONFIG_FB_S3C2410 174#ifdef CONFIG_FB_S3C2410
170static struct s3c2410fb_display __initdata amlm5900_lcd_info = { 175static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
171 .width = 160, 176 .width = 160,
@@ -241,6 +246,6 @@ MACHINE_START(AML_M5900, "AML_M5900")
241 .map_io = amlm5900_map_io, 246 .map_io = amlm5900_map_io,
242 .init_irq = s3c2410_init_irq, 247 .init_irq = s3c2410_init_irq,
243 .init_machine = amlm5900_init, 248 .init_machine = amlm5900_init,
244 .init_time = samsung_timer_init, 249 .init_time = amlm5900_init_time,
245 .restart = s3c2410_restart, 250 .restart = s3c2410_restart,
246MACHINE_END 251MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 81a270af2336..e053581cab0b 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -46,7 +46,6 @@
46 46
47#include <net/ax88796.h> 47#include <net/ax88796.h>
48 48
49#include <plat/clock.h>
50#include <plat/devs.h> 49#include <plat/devs.h>
51#include <plat/cpu.h> 50#include <plat/cpu.h>
52#include <linux/platform_data/asoc-s3c24xx_simtec.h> 51#include <linux/platform_data/asoc-s3c24xx_simtec.h>
@@ -352,6 +351,7 @@ static struct platform_device anubis_device_sm501 = {
352/* Standard Anubis devices */ 351/* Standard Anubis devices */
353 352
354static struct platform_device *anubis_devices[] __initdata = { 353static struct platform_device *anubis_devices[] __initdata = {
354 &s3c2410_device_dclk,
355 &s3c_device_ohci, 355 &s3c_device_ohci,
356 &s3c_device_wdt, 356 &s3c_device_wdt,
357 &s3c_device_adc, 357 &s3c_device_adc,
@@ -364,14 +364,6 @@ static struct platform_device *anubis_devices[] __initdata = {
364 &anubis_device_sm501, 364 &anubis_device_sm501,
365}; 365};
366 366
367static struct clk *anubis_clocks[] __initdata = {
368 &s3c24xx_dclk0,
369 &s3c24xx_dclk1,
370 &s3c24xx_clkout0,
371 &s3c24xx_clkout1,
372 &s3c24xx_uclk,
373};
374
375/* I2C devices. */ 367/* I2C devices. */
376 368
377static struct i2c_board_info anubis_i2c_devs[] __initdata = { 369static struct i2c_board_info anubis_i2c_devs[] __initdata = {
@@ -394,23 +386,7 @@ static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = {
394 386
395static void __init anubis_map_io(void) 387static void __init anubis_map_io(void)
396{ 388{
397 /* initialise the clocks */
398
399 s3c24xx_dclk0.parent = &clk_upll;
400 s3c24xx_dclk0.rate = 12*1000*1000;
401
402 s3c24xx_dclk1.parent = &clk_upll;
403 s3c24xx_dclk1.rate = 24*1000*1000;
404
405 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
406 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
407
408 s3c24xx_uclk.parent = &s3c24xx_clkout1;
409
410 s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks));
411
412 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); 389 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
413 s3c24xx_init_clocks(0);
414 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); 390 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
415 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 391 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
416 392
@@ -428,6 +404,12 @@ static void __init anubis_map_io(void)
428 } 404 }
429} 405}
430 406
407static void __init anubis_init_time(void)
408{
409 s3c2440_init_clocks(12000000);
410 samsung_timer_init();
411}
412
431static void __init anubis_init(void) 413static void __init anubis_init(void)
432{ 414{
433 s3c_i2c0_set_platdata(NULL); 415 s3c_i2c0_set_platdata(NULL);
@@ -447,6 +429,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
447 .map_io = anubis_map_io, 429 .map_io = anubis_map_io,
448 .init_machine = anubis_init, 430 .init_machine = anubis_init,
449 .init_irq = s3c2440_init_irq, 431 .init_irq = s3c2440_init_irq,
450 .init_time = samsung_timer_init, 432 .init_time = anubis_init_time,
451 .restart = s3c244x_restart, 433 .restart = s3c244x_restart,
452MACHINE_END 434MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index d8f6bb1096cb..9db768f448a5 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -45,7 +45,6 @@
45#include <linux/mtd/nand_ecc.h> 45#include <linux/mtd/nand_ecc.h>
46#include <linux/mtd/partitions.h> 46#include <linux/mtd/partitions.h>
47 47
48#include <plat/clock.h>
49#include <plat/devs.h> 48#include <plat/devs.h>
50#include <plat/cpu.h> 49#include <plat/cpu.h>
51#include <linux/platform_data/mmc-s3cmci.h> 50#include <linux/platform_data/mmc-s3cmci.h>
@@ -192,11 +191,16 @@ static struct platform_device *at2440evb_devices[] __initdata = {
192static void __init at2440evb_map_io(void) 191static void __init at2440evb_map_io(void)
193{ 192{
194 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); 193 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
195 s3c24xx_init_clocks(16934400);
196 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); 194 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
197 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 195 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
198} 196}
199 197
198static void __init at2440evb_init_time(void)
199{
200 s3c2440_init_clocks(16934400);
201 samsung_timer_init();
202}
203
200static void __init at2440evb_init(void) 204static void __init at2440evb_init(void)
201{ 205{
202 s3c24xx_fb_set_platdata(&at2440evb_fb_info); 206 s3c24xx_fb_set_platdata(&at2440evb_fb_info);
@@ -213,6 +217,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
213 .map_io = at2440evb_map_io, 217 .map_io = at2440evb_map_io,
214 .init_machine = at2440evb_init, 218 .init_machine = at2440evb_init,
215 .init_irq = s3c2440_init_irq, 219 .init_irq = s3c2440_init_irq,
216 .init_time = samsung_timer_init, 220 .init_time = at2440evb_init_time,
217 .restart = s3c244x_restart, 221 .restart = s3c244x_restart,
218MACHINE_END 222MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index e371ff53a408..f9112b801a33 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -51,7 +51,6 @@
51#include <mach/regs-lcd.h> 51#include <mach/regs-lcd.h>
52#include <mach/gpio-samsung.h> 52#include <mach/gpio-samsung.h>
53 53
54#include <plat/clock.h>
55#include <plat/cpu.h> 54#include <plat/cpu.h>
56#include <plat/cpu-freq.h> 55#include <plat/cpu-freq.h>
57#include <plat/devs.h> 56#include <plat/devs.h>
@@ -523,6 +522,7 @@ static struct s3c_hwmon_pdata bast_hwmon_info = {
523// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0 522// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0
524 523
525static struct platform_device *bast_devices[] __initdata = { 524static struct platform_device *bast_devices[] __initdata = {
525 &s3c2410_device_dclk,
526 &s3c_device_ohci, 526 &s3c_device_ohci,
527 &s3c_device_lcd, 527 &s3c_device_lcd,
528 &s3c_device_wdt, 528 &s3c_device_wdt,
@@ -537,14 +537,6 @@ static struct platform_device *bast_devices[] __initdata = {
537 &bast_sio, 537 &bast_sio,
538}; 538};
539 539
540static struct clk *bast_clocks[] __initdata = {
541 &s3c24xx_dclk0,
542 &s3c24xx_dclk1,
543 &s3c24xx_clkout0,
544 &s3c24xx_clkout1,
545 &s3c24xx_uclk,
546};
547
548static struct s3c_cpufreq_board __initdata bast_cpufreq = { 540static struct s3c_cpufreq_board __initdata bast_cpufreq = {
549 .refresh = 7800, /* 7.8usec */ 541 .refresh = 7800, /* 7.8usec */
550 .auto_io = 1, 542 .auto_io = 1,
@@ -558,29 +550,19 @@ static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = {
558 550
559static void __init bast_map_io(void) 551static void __init bast_map_io(void)
560{ 552{
561 /* initialise the clocks */
562
563 s3c24xx_dclk0.parent = &clk_upll;
564 s3c24xx_dclk0.rate = 12*1000*1000;
565
566 s3c24xx_dclk1.parent = &clk_upll;
567 s3c24xx_dclk1.rate = 24*1000*1000;
568
569 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
570 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
571
572 s3c24xx_uclk.parent = &s3c24xx_clkout1;
573
574 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
575
576 s3c_hwmon_set_platdata(&bast_hwmon_info); 553 s3c_hwmon_set_platdata(&bast_hwmon_info);
577 554
578 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 555 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
579 s3c24xx_init_clocks(0);
580 s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); 556 s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
581 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 557 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
582} 558}
583 559
560static void __init bast_init_time(void)
561{
562 s3c2410_init_clocks(12000000);
563 samsung_timer_init();
564}
565
584static void __init bast_init(void) 566static void __init bast_init(void)
585{ 567{
586 register_syscore_ops(&bast_pm_syscore_ops); 568 register_syscore_ops(&bast_pm_syscore_ops);
@@ -608,6 +590,6 @@ MACHINE_START(BAST, "Simtec-BAST")
608 .map_io = bast_map_io, 590 .map_io = bast_map_io,
609 .init_irq = s3c2410_init_irq, 591 .init_irq = s3c2410_init_irq,
610 .init_machine = bast_init, 592 .init_machine = bast_init,
611 .init_time = samsung_timer_init, 593 .init_time = bast_init_time,
612 .restart = s3c2410_restart, 594 .restart = s3c2410_restart,
613MACHINE_END 595MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index dc4db849f0fd..fc3a08d0cb3f 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -501,7 +501,6 @@ static struct platform_device gta02_buttons_device = {
501static void __init gta02_map_io(void) 501static void __init gta02_map_io(void)
502{ 502{
503 s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); 503 s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
504 s3c24xx_init_clocks(12000000);
505 s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); 504 s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
506 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 505 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
507} 506}
@@ -585,6 +584,11 @@ static void __init gta02_machine_init(void)
585 regulator_has_full_constraints(); 584 regulator_has_full_constraints();
586} 585}
587 586
587static void __init gta02_init_time(void)
588{
589 s3c2442_init_clocks(12000000);
590 samsung_timer_init();
591}
588 592
589MACHINE_START(NEO1973_GTA02, "GTA02") 593MACHINE_START(NEO1973_GTA02, "GTA02")
590 /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ 594 /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */
@@ -592,6 +596,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
592 .map_io = gta02_map_io, 596 .map_io = gta02_map_io,
593 .init_irq = s3c2442_init_irq, 597 .init_irq = s3c2442_init_irq,
594 .init_machine = gta02_machine_init, 598 .init_machine = gta02_machine_init,
595 .init_time = samsung_timer_init, 599 .init_time = gta02_init_time,
596 .restart = s3c244x_restart, 600 .restart = s3c244x_restart,
597MACHINE_END 601MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index e453acd92cbf..fbf5487ae5d1 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -57,7 +57,6 @@
57#include <mach/regs-lcd.h> 57#include <mach/regs-lcd.h>
58#include <mach/gpio-samsung.h> 58#include <mach/gpio-samsung.h>
59 59
60#include <plat/clock.h>
61#include <plat/cpu.h> 60#include <plat/cpu.h>
62#include <plat/devs.h> 61#include <plat/devs.h>
63#include <plat/gpio-cfg.h> 62#include <plat/gpio-cfg.h>
@@ -646,7 +645,6 @@ static struct platform_device *h1940_devices[] __initdata = {
646static void __init h1940_map_io(void) 645static void __init h1940_map_io(void)
647{ 646{
648 s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); 647 s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
649 s3c24xx_init_clocks(0);
650 s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); 648 s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
651 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 649 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
652 650
@@ -662,6 +660,12 @@ static void __init h1940_map_io(void)
662 WARN_ON(gpiochip_add(&h1940_latch_gpiochip)); 660 WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
663} 661}
664 662
663static void __init h1940_init_time(void)
664{
665 s3c2410_init_clocks(12000000);
666 samsung_timer_init();
667}
668
665/* H1940 and RX3715 need to reserve this for suspend */ 669/* H1940 and RX3715 need to reserve this for suspend */
666static void __init h1940_reserve(void) 670static void __init h1940_reserve(void)
667{ 671{
@@ -739,6 +743,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
739 .reserve = h1940_reserve, 743 .reserve = h1940_reserve,
740 .init_irq = s3c2410_init_irq, 744 .init_irq = s3c2410_init_irq,
741 .init_machine = h1940_init, 745 .init_machine = h1940_init,
742 .init_time = samsung_timer_init, 746 .init_time = h1940_init_time,
743 .restart = s3c2410_restart, 747 .restart = s3c2410_restart,
744MACHINE_END 748MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index 5faa7239e7d6..e81ea82c55f9 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -507,11 +507,16 @@ static struct syscore_ops jive_pm_syscore_ops = {
507static void __init jive_map_io(void) 507static void __init jive_map_io(void)
508{ 508{
509 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); 509 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
510 s3c24xx_init_clocks(12000000);
511 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); 510 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
512 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 511 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
513} 512}
514 513
514static void __init jive_init_time(void)
515{
516 s3c2412_init_clocks(12000000);
517 samsung_timer_init();
518}
519
515static void jive_power_off(void) 520static void jive_power_off(void)
516{ 521{
517 printk(KERN_INFO "powering system down...\n"); 522 printk(KERN_INFO "powering system down...\n");
@@ -665,6 +670,6 @@ MACHINE_START(JIVE, "JIVE")
665 .init_irq = s3c2412_init_irq, 670 .init_irq = s3c2412_init_irq,
666 .map_io = jive_map_io, 671 .map_io = jive_map_io,
667 .init_machine = jive_machine_init, 672 .init_machine = jive_machine_init,
668 .init_time = samsung_timer_init, 673 .init_time = jive_init_time,
669 .restart = s3c2412_restart, 674 .restart = s3c2412_restart,
670MACHINE_END 675MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 9e57fd9f4f3b..5cc40ec1d254 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -54,7 +54,6 @@
54#include <linux/mtd/partitions.h> 54#include <linux/mtd/partitions.h>
55 55
56#include <plat/gpio-cfg.h> 56#include <plat/gpio-cfg.h>
57#include <plat/clock.h>
58#include <plat/devs.h> 57#include <plat/devs.h>
59#include <plat/cpu.h> 58#include <plat/cpu.h>
60#include <plat/samsung-time.h> 59#include <plat/samsung-time.h>
@@ -525,11 +524,16 @@ static struct platform_device *mini2440_devices[] __initdata = {
525static void __init mini2440_map_io(void) 524static void __init mini2440_map_io(void)
526{ 525{
527 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); 526 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
528 s3c24xx_init_clocks(12000000);
529 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); 527 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
530 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 528 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
531} 529}
532 530
531static void __init mini2440_init_time(void)
532{
533 s3c2440_init_clocks(12000000);
534 samsung_timer_init();
535}
536
533/* 537/*
534 * mini2440_features string 538 * mini2440_features string
535 * 539 *
@@ -690,6 +694,6 @@ MACHINE_START(MINI2440, "MINI2440")
690 .map_io = mini2440_map_io, 694 .map_io = mini2440_map_io,
691 .init_machine = mini2440_init, 695 .init_machine = mini2440_init,
692 .init_irq = s3c2440_init_irq, 696 .init_irq = s3c2440_init_irq,
693 .init_time = samsung_timer_init, 697 .init_time = mini2440_init_time,
694 .restart = s3c244x_restart, 698 .restart = s3c244x_restart,
695MACHINE_END 699MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index 4cccaad34847..3ac2a54348d6 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -45,7 +45,6 @@
45 45
46#include <linux/platform_data/i2c-s3c2410.h> 46#include <linux/platform_data/i2c-s3c2410.h>
47 47
48#include <plat/clock.h>
49#include <plat/cpu.h> 48#include <plat/cpu.h>
50#include <plat/devs.h> 49#include <plat/devs.h>
51#include <linux/platform_data/mmc-s3cmci.h> 50#include <linux/platform_data/mmc-s3cmci.h>
@@ -535,11 +534,16 @@ static void __init n30_map_io(void)
535{ 534{
536 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc)); 535 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
537 n30_hwinit(); 536 n30_hwinit();
538 s3c24xx_init_clocks(0);
539 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); 537 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
540 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 538 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
541} 539}
542 540
541static void __init n30_init_time(void)
542{
543 s3c2410_init_clocks(12000000);
544 samsung_timer_init();
545}
546
543/* GPB3 is the line that controls the pull-up for the USB D+ line */ 547/* GPB3 is the line that controls the pull-up for the USB D+ line */
544 548
545static void __init n30_init(void) 549static void __init n30_init(void)
@@ -591,7 +595,7 @@ MACHINE_START(N30, "Acer-N30")
591 Ben Dooks <ben-linux@fluff.org> 595 Ben Dooks <ben-linux@fluff.org>
592 */ 596 */
593 .atag_offset = 0x100, 597 .atag_offset = 0x100,
594 .init_time = samsung_timer_init, 598 .init_time = n30_init_time,
595 .init_machine = n30_init, 599 .init_machine = n30_init,
596 .init_irq = s3c2410_init_irq, 600 .init_irq = s3c2410_init_irq,
597 .map_io = n30_map_io, 601 .map_io = n30_map_io,
@@ -602,7 +606,7 @@ MACHINE_START(N35, "Acer-N35")
602 /* Maintainer: Christer Weinigel <christer@weinigel.se> 606 /* Maintainer: Christer Weinigel <christer@weinigel.se>
603 */ 607 */
604 .atag_offset = 0x100, 608 .atag_offset = 0x100,
605 .init_time = samsung_timer_init, 609 .init_time = n30_init_time,
606 .init_machine = n30_init, 610 .init_machine = n30_init,
607 .init_irq = s3c2410_init_irq, 611 .init_irq = s3c2410_init_irq,
608 .map_io = n30_map_io, 612 .map_io = n30_map_io,
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index 3066851f584d..c82c281ce351 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -42,7 +42,6 @@
42#include <linux/platform_data/i2c-s3c2410.h> 42#include <linux/platform_data/i2c-s3c2410.h>
43 43
44#include <plat/gpio-cfg.h> 44#include <plat/gpio-cfg.h>
45#include <plat/clock.h>
46#include <plat/devs.h> 45#include <plat/devs.h>
47#include <plat/cpu.h> 46#include <plat/cpu.h>
48#include <plat/samsung-time.h> 47#include <plat/samsung-time.h>
@@ -135,13 +134,18 @@ static void __init nexcoder_sensorboard_init(void)
135static void __init nexcoder_map_io(void) 134static void __init nexcoder_map_io(void)
136{ 135{
137 s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc)); 136 s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
138 s3c24xx_init_clocks(0);
139 s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); 137 s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
140 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 138 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
141 139
142 nexcoder_sensorboard_init(); 140 nexcoder_sensorboard_init();
143} 141}
144 142
143static void __init nexcoder_init_time(void)
144{
145 s3c2440_init_clocks(12000000);
146 samsung_timer_init();
147}
148
145static void __init nexcoder_init(void) 149static void __init nexcoder_init(void)
146{ 150{
147 s3c_i2c0_set_platdata(NULL); 151 s3c_i2c0_set_platdata(NULL);
@@ -154,6 +158,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
154 .map_io = nexcoder_map_io, 158 .map_io = nexcoder_map_io,
155 .init_machine = nexcoder_init, 159 .init_machine = nexcoder_init,
156 .init_irq = s3c2440_init_irq, 160 .init_irq = s3c2440_init_irq,
157 .init_time = samsung_timer_init, 161 .init_time = nexcoder_init_time,
158 .restart = s3c244x_restart, 162 .restart = s3c244x_restart,
159MACHINE_END 163MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index a4ae4bb3666d..189147b80eca 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -40,7 +40,6 @@
40#include <linux/mtd/nand_ecc.h> 40#include <linux/mtd/nand_ecc.h>
41#include <linux/mtd/partitions.h> 41#include <linux/mtd/partitions.h>
42 42
43#include <plat/clock.h>
44#include <plat/cpu.h> 43#include <plat/cpu.h>
45#include <plat/cpu-freq.h> 44#include <plat/cpu-freq.h>
46#include <plat/devs.h> 45#include <plat/devs.h>
@@ -344,20 +343,13 @@ static struct i2c_board_info osiris_i2c_devs[] __initdata = {
344/* Standard Osiris devices */ 343/* Standard Osiris devices */
345 344
346static struct platform_device *osiris_devices[] __initdata = { 345static struct platform_device *osiris_devices[] __initdata = {
346 &s3c2410_device_dclk,
347 &s3c_device_i2c0, 347 &s3c_device_i2c0,
348 &s3c_device_wdt, 348 &s3c_device_wdt,
349 &s3c_device_nand, 349 &s3c_device_nand,
350 &osiris_pcmcia, 350 &osiris_pcmcia,
351}; 351};
352 352
353static struct clk *osiris_clocks[] __initdata = {
354 &s3c24xx_dclk0,
355 &s3c24xx_dclk1,
356 &s3c24xx_clkout0,
357 &s3c24xx_clkout1,
358 &s3c24xx_uclk,
359};
360
361static struct s3c_cpufreq_board __initdata osiris_cpufreq = { 353static struct s3c_cpufreq_board __initdata osiris_cpufreq = {
362 .refresh = 7800, /* refresh period is 7.8usec */ 354 .refresh = 7800, /* refresh period is 7.8usec */
363 .auto_io = 1, 355 .auto_io = 1,
@@ -368,23 +360,7 @@ static void __init osiris_map_io(void)
368{ 360{
369 unsigned long flags; 361 unsigned long flags;
370 362
371 /* initialise the clocks */
372
373 s3c24xx_dclk0.parent = &clk_upll;
374 s3c24xx_dclk0.rate = 12*1000*1000;
375
376 s3c24xx_dclk1.parent = &clk_upll;
377 s3c24xx_dclk1.rate = 24*1000*1000;
378
379 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
380 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
381
382 s3c24xx_uclk.parent = &s3c24xx_clkout1;
383
384 s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks));
385
386 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); 363 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
387 s3c24xx_init_clocks(0);
388 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); 364 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
389 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 365 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
390 366
@@ -408,6 +384,12 @@ static void __init osiris_map_io(void)
408 local_irq_restore(flags); 384 local_irq_restore(flags);
409} 385}
410 386
387static void __init osiris_init_time(void)
388{
389 s3c2440_init_clocks(12000000);
390 samsung_timer_init();
391}
392
411static void __init osiris_init(void) 393static void __init osiris_init(void)
412{ 394{
413 register_syscore_ops(&osiris_pm_syscore_ops); 395 register_syscore_ops(&osiris_pm_syscore_ops);
@@ -429,6 +411,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
429 .map_io = osiris_map_io, 411 .map_io = osiris_map_io,
430 .init_irq = s3c2440_init_irq, 412 .init_irq = s3c2440_init_irq,
431 .init_machine = osiris_init, 413 .init_machine = osiris_init,
432 .init_time = samsung_timer_init, 414 .init_time = osiris_init_time,
433 .restart = s3c244x_restart, 415 .restart = s3c244x_restart,
434MACHINE_END 416MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index bdb3faac2d9b..45833001186d 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -30,7 +30,6 @@
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/regs-gpio.h> 31#include <mach/regs-gpio.h>
32 32
33#include <plat/clock.h>
34#include <plat/cpu.h> 33#include <plat/cpu.h>
35#include <plat/devs.h> 34#include <plat/devs.h>
36#include <plat/samsung-time.h> 35#include <plat/samsung-time.h>
@@ -100,11 +99,16 @@ static struct platform_device *otom11_devices[] __initdata = {
100static void __init otom11_map_io(void) 99static void __init otom11_map_io(void)
101{ 100{
102 s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); 101 s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
103 s3c24xx_init_clocks(0);
104 s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); 102 s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
105 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 103 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
106} 104}
107 105
106static void __init otom11_init_time(void)
107{
108 s3c2410_init_clocks(12000000);
109 samsung_timer_init();
110}
111
108static void __init otom11_init(void) 112static void __init otom11_init(void)
109{ 113{
110 s3c_i2c0_set_platdata(NULL); 114 s3c_i2c0_set_platdata(NULL);
@@ -117,6 +121,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
117 .map_io = otom11_map_io, 121 .map_io = otom11_map_io,
118 .init_machine = otom11_init, 122 .init_machine = otom11_init,
119 .init_irq = s3c2410_init_irq, 123 .init_irq = s3c2410_init_irq,
120 .init_time = samsung_timer_init, 124 .init_time = otom11_init_time,
121 .restart = s3c2410_restart, 125 .restart = s3c2410_restart,
122MACHINE_END 126MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 8c12787a8fd3..228c9094519d 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -304,11 +304,16 @@ __setup("tft=", qt2410_tft_setup);
304static void __init qt2410_map_io(void) 304static void __init qt2410_map_io(void)
305{ 305{
306 s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); 306 s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
307 s3c24xx_init_clocks(12*1000*1000);
308 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); 307 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
309 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 308 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
310} 309}
311 310
311static void __init qt2410_init_time(void)
312{
313 s3c2410_init_clocks(12000000);
314 samsung_timer_init();
315}
316
312static void __init qt2410_machine_init(void) 317static void __init qt2410_machine_init(void)
313{ 318{
314 s3c_nand_set_platdata(&qt2410_nand_info); 319 s3c_nand_set_platdata(&qt2410_nand_info);
@@ -346,6 +351,6 @@ MACHINE_START(QT2410, "QT2410")
346 .map_io = qt2410_map_io, 351 .map_io = qt2410_map_io,
347 .init_irq = s3c2410_init_irq, 352 .init_irq = s3c2410_init_irq,
348 .init_machine = qt2410_machine_init, 353 .init_machine = qt2410_machine_init,
349 .init_time = samsung_timer_init, 354 .init_time = qt2410_init_time,
350 .restart = s3c2410_restart, 355 .restart = s3c2410_restart,
351MACHINE_END 356MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index afb784e934c8..e2c6541909c1 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -54,7 +54,6 @@
54#include <mach/regs-lcd.h> 54#include <mach/regs-lcd.h>
55#include <mach/gpio-samsung.h> 55#include <mach/gpio-samsung.h>
56 56
57#include <plat/clock.h>
58#include <plat/cpu.h> 57#include <plat/cpu.h>
59#include <plat/devs.h> 58#include <plat/devs.h>
60#include <plat/pm.h> 59#include <plat/pm.h>
@@ -710,6 +709,7 @@ static struct i2c_board_info rx1950_i2c_devices[] = {
710}; 709};
711 710
712static struct platform_device *rx1950_devices[] __initdata = { 711static struct platform_device *rx1950_devices[] __initdata = {
712 &s3c2410_device_dclk,
713 &s3c_device_lcd, 713 &s3c_device_lcd,
714 &s3c_device_wdt, 714 &s3c_device_wdt,
715 &s3c_device_i2c0, 715 &s3c_device_i2c0,
@@ -728,20 +728,9 @@ static struct platform_device *rx1950_devices[] __initdata = {
728 &rx1950_leds, 728 &rx1950_leds,
729}; 729};
730 730
731static struct clk *rx1950_clocks[] __initdata = {
732 &s3c24xx_clkout0,
733 &s3c24xx_clkout1,
734};
735
736static void __init rx1950_map_io(void) 731static void __init rx1950_map_io(void)
737{ 732{
738 s3c24xx_clkout0.parent = &clk_h;
739 s3c24xx_clkout1.parent = &clk_f;
740
741 s3c24xx_register_clocks(rx1950_clocks, ARRAY_SIZE(rx1950_clocks));
742
743 s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); 733 s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
744 s3c24xx_init_clocks(16934000);
745 s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); 734 s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
746 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 735 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
747 736
@@ -754,6 +743,12 @@ static void __init rx1950_map_io(void)
754 s3c_pm_init(); 743 s3c_pm_init();
755} 744}
756 745
746static void __init rx1950_init_time(void)
747{
748 s3c2442_init_clocks(16934000);
749 samsung_timer_init();
750}
751
757static void __init rx1950_init_machine(void) 752static void __init rx1950_init_machine(void)
758{ 753{
759 int i; 754 int i;
@@ -816,6 +811,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
816 .reserve = rx1950_reserve, 811 .reserve = rx1950_reserve,
817 .init_irq = s3c2442_init_irq, 812 .init_irq = s3c2442_init_irq,
818 .init_machine = rx1950_init_machine, 813 .init_machine = rx1950_init_machine,
819 .init_time = samsung_timer_init, 814 .init_time = rx1950_init_time,
820 .restart = s3c244x_restart, 815 .restart = s3c244x_restart,
821MACHINE_END 816MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index e6535ce1bc5c..6e749ec3a2ea 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -46,7 +46,6 @@
46#include <mach/regs-lcd.h> 46#include <mach/regs-lcd.h>
47#include <mach/gpio-samsung.h> 47#include <mach/gpio-samsung.h>
48 48
49#include <plat/clock.h>
50#include <plat/cpu.h> 49#include <plat/cpu.h>
51#include <plat/devs.h> 50#include <plat/devs.h>
52#include <plat/pm.h> 51#include <plat/pm.h>
@@ -179,11 +178,16 @@ static struct platform_device *rx3715_devices[] __initdata = {
179static void __init rx3715_map_io(void) 178static void __init rx3715_map_io(void)
180{ 179{
181 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); 180 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
182 s3c24xx_init_clocks(16934000);
183 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); 181 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
184 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 182 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
185} 183}
186 184
185static void __init rx3715_init_time(void)
186{
187 s3c2440_init_clocks(16934000);
188 samsung_timer_init();
189}
190
187/* H1940 and RX3715 need to reserve this for suspend */ 191/* H1940 and RX3715 need to reserve this for suspend */
188static void __init rx3715_reserve(void) 192static void __init rx3715_reserve(void)
189{ 193{
@@ -210,6 +214,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
210 .reserve = rx3715_reserve, 214 .reserve = rx3715_reserve,
211 .init_irq = s3c2440_init_irq, 215 .init_irq = s3c2440_init_irq,
212 .init_machine = rx3715_init_machine, 216 .init_machine = rx3715_init_machine,
213 .init_time = samsung_timer_init, 217 .init_time = rx3715_init_time,
214 .restart = s3c244x_restart, 218 .restart = s3c244x_restart,
215MACHINE_END 219MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
index 70f0900d4bca..e4dcb9aa2ca2 100644
--- a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
+++ b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
@@ -18,7 +18,6 @@
18#include <linux/clocksource.h> 18#include <linux/clocksource.h>
19#include <linux/irqchip.h> 19#include <linux/irqchip.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <linux/serial_core.h>
22#include <linux/serial_s3c.h> 21#include <linux/serial_s3c.h>
23 22
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
@@ -29,48 +28,14 @@
29 28
30#include "common.h" 29#include "common.h"
31 30
32/*
33 * The following lookup table is used to override device names when devices
34 * are registered from device tree. This is temporarily added to enable
35 * device tree support addition for the S3C2416 architecture.
36 *
37 * For drivers that require platform data to be provided from the machine
38 * file, a platform data pointer can also be supplied along with the
39 * devices names. Usually, the platform data elements that cannot be parsed
40 * from the device tree by the drivers (example: function pointers) are
41 * supplied. But it should be noted that this is a temporary mechanism and
42 * at some point, the drivers should be capable of parsing all the platform
43 * data from the device tree.
44 */
45static const struct of_dev_auxdata s3c2416_auxdata_lookup[] __initconst = {
46 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART,
47 "s3c2440-uart.0", NULL),
48 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x4000,
49 "s3c2440-uart.1", NULL),
50 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x8000,
51 "s3c2440-uart.2", NULL),
52 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0xC000,
53 "s3c2440-uart.3", NULL),
54 OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC0,
55 "s3c-sdhci.0", NULL),
56 OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC1,
57 "s3c-sdhci.1", NULL),
58 OF_DEV_AUXDATA("samsung,s3c2440-i2c", S3C_PA_IIC,
59 "s3c2440-i2c.0", NULL),
60 {},
61};
62
63static void __init s3c2416_dt_map_io(void) 31static void __init s3c2416_dt_map_io(void)
64{ 32{
65 s3c24xx_init_io(NULL, 0); 33 s3c24xx_init_io(NULL, 0);
66 s3c24xx_init_clocks(12000000);
67} 34}
68 35
69static void __init s3c2416_dt_machine_init(void) 36static void __init s3c2416_dt_machine_init(void)
70{ 37{
71 of_platform_populate(NULL, of_default_bus_match_table, 38 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
72 s3c2416_auxdata_lookup, NULL);
73
74 s3c_pm_init(); 39 s3c_pm_init();
75} 40}
76 41
@@ -86,6 +51,5 @@ DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)")
86 .map_io = s3c2416_dt_map_io, 51 .map_io = s3c2416_dt_map_io,
87 .init_irq = irqchip_init, 52 .init_irq = irqchip_init,
88 .init_machine = s3c2416_dt_machine_init, 53 .init_machine = s3c2416_dt_machine_init,
89 .init_time = clocksource_of_init,
90 .restart = s3c2416_restart, 54 .restart = s3c2416_restart,
91MACHINE_END 55MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index f32924ee0e9f..419fadd6e446 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -99,11 +99,16 @@ static struct platform_device *smdk2410_devices[] __initdata = {
99static void __init smdk2410_map_io(void) 99static void __init smdk2410_map_io(void)
100{ 100{
101 s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); 101 s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
102 s3c24xx_init_clocks(0);
103 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); 102 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
104 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 103 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
105} 104}
106 105
106static void __init smdk2410_init_time(void)
107{
108 s3c2410_init_clocks(12000000);
109 samsung_timer_init();
110}
111
107static void __init smdk2410_init(void) 112static void __init smdk2410_init(void)
108{ 113{
109 s3c_i2c0_set_platdata(NULL); 114 s3c_i2c0_set_platdata(NULL);
@@ -118,6 +123,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
118 .map_io = smdk2410_map_io, 123 .map_io = smdk2410_map_io,
119 .init_irq = s3c2410_init_irq, 124 .init_irq = s3c2410_init_irq,
120 .init_machine = smdk2410_init, 125 .init_machine = smdk2410_init,
121 .init_time = samsung_timer_init, 126 .init_time = smdk2410_init_time,
122 .restart = s3c2410_restart, 127 .restart = s3c2410_restart,
123MACHINE_END 128MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index 233fe52d2015..a38f8a049e22 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -106,11 +106,16 @@ static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
106static void __init smdk2413_map_io(void) 106static void __init smdk2413_map_io(void)
107{ 107{
108 s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); 108 s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
109 s3c24xx_init_clocks(12000000);
110 s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); 109 s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
111 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 110 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
112} 111}
113 112
113static void __init smdk2413_init_time(void)
114{
115 s3c2412_init_clocks(12000000);
116 samsung_timer_init();
117}
118
114static void __init smdk2413_machine_init(void) 119static void __init smdk2413_machine_init(void)
115{ /* Turn off suspend on both USB ports, and switch the 120{ /* Turn off suspend on both USB ports, and switch the
116 * selectable USB port to USB device mode. */ 121 * selectable USB port to USB device mode. */
@@ -159,6 +164,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
159 .init_irq = s3c2412_init_irq, 164 .init_irq = s3c2412_init_irq,
160 .map_io = smdk2413_map_io, 165 .map_io = smdk2413_map_io,
161 .init_machine = smdk2413_machine_init, 166 .init_machine = smdk2413_machine_init,
162 .init_time = samsung_timer_init, 167 .init_time = smdk2413_init_time,
163 .restart = s3c2412_restart, 168 .restart = s3c2412_restart,
164MACHINE_END 169MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index b3b54d8e1410..fa6f30d23601 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -219,10 +219,15 @@ static struct platform_device *smdk2416_devices[] __initdata = {
219 &s3c2443_device_dma, 219 &s3c2443_device_dma,
220}; 220};
221 221
222static void __init smdk2416_init_time(void)
223{
224 s3c2416_init_clocks(12000000);
225 samsung_timer_init();
226}
227
222static void __init smdk2416_map_io(void) 228static void __init smdk2416_map_io(void)
223{ 229{
224 s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); 230 s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
225 s3c24xx_init_clocks(12000000);
226 s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); 231 s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
227 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 232 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
228} 233}
@@ -257,6 +262,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
257 .init_irq = s3c2416_init_irq, 262 .init_irq = s3c2416_init_irq,
258 .map_io = smdk2416_map_io, 263 .map_io = smdk2416_map_io,
259 .init_machine = smdk2416_machine_init, 264 .init_machine = smdk2416_machine_init,
260 .init_time = samsung_timer_init, 265 .init_time = smdk2416_init_time,
261 .restart = s3c2416_restart, 266 .restart = s3c2416_restart,
262MACHINE_END 267MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index d071dcfea548..5fb89c0ae17a 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -38,7 +38,6 @@
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <linux/platform_data/i2c-s3c2410.h> 39#include <linux/platform_data/i2c-s3c2410.h>
40 40
41#include <plat/clock.h>
42#include <plat/devs.h> 41#include <plat/devs.h>
43#include <plat/cpu.h> 42#include <plat/cpu.h>
44#include <plat/samsung-time.h> 43#include <plat/samsung-time.h>
@@ -159,11 +158,16 @@ static struct platform_device *smdk2440_devices[] __initdata = {
159static void __init smdk2440_map_io(void) 158static void __init smdk2440_map_io(void)
160{ 159{
161 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); 160 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
162 s3c24xx_init_clocks(16934400);
163 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); 161 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
164 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 162 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
165} 163}
166 164
165static void __init smdk2440_init_time(void)
166{
167 s3c2440_init_clocks(16934400);
168 samsung_timer_init();
169}
170
167static void __init smdk2440_machine_init(void) 171static void __init smdk2440_machine_init(void)
168{ 172{
169 s3c24xx_fb_set_platdata(&smdk2440_fb_info); 173 s3c24xx_fb_set_platdata(&smdk2440_fb_info);
@@ -180,6 +184,6 @@ MACHINE_START(S3C2440, "SMDK2440")
180 .init_irq = s3c2440_init_irq, 184 .init_irq = s3c2440_init_irq,
181 .map_io = smdk2440_map_io, 185 .map_io = smdk2440_map_io,
182 .init_machine = smdk2440_machine_init, 186 .init_machine = smdk2440_machine_init,
183 .init_time = samsung_timer_init, 187 .init_time = smdk2440_init_time,
184 .restart = s3c244x_restart, 188 .restart = s3c244x_restart,
185MACHINE_END 189MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 06c4d77de3a5..ef5d5ea33182 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -121,11 +121,16 @@ static struct platform_device *smdk2443_devices[] __initdata = {
121static void __init smdk2443_map_io(void) 121static void __init smdk2443_map_io(void)
122{ 122{
123 s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); 123 s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
124 s3c24xx_init_clocks(12000000);
125 s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); 124 s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
126 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 125 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
127} 126}
128 127
128static void __init smdk2443_init_time(void)
129{
130 s3c2443_init_clocks(12000000);
131 samsung_timer_init();
132}
133
129static void __init smdk2443_machine_init(void) 134static void __init smdk2443_machine_init(void)
130{ 135{
131 s3c_i2c0_set_platdata(NULL); 136 s3c_i2c0_set_platdata(NULL);
@@ -145,6 +150,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
145 .init_irq = s3c2443_init_irq, 150 .init_irq = s3c2443_init_irq,
146 .map_io = smdk2443_map_io, 151 .map_io = smdk2443_map_io,
147 .init_machine = smdk2443_machine_init, 152 .init_machine = smdk2443_machine_init,
148 .init_time = samsung_timer_init, 153 .init_time = smdk2443_init_time,
149 .restart = s3c2443_restart, 154 .restart = s3c2443_restart,
150MACHINE_END 155MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 4108b2f0cede..c616ca2d409e 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -135,11 +135,16 @@ static struct platform_device *tct_hammer_devices[] __initdata = {
135static void __init tct_hammer_map_io(void) 135static void __init tct_hammer_map_io(void)
136{ 136{
137 s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); 137 s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
138 s3c24xx_init_clocks(0);
139 s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); 138 s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
140 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 139 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
141} 140}
142 141
142static void __init tct_hammer_init_time(void)
143{
144 s3c2410_init_clocks(12000000);
145 samsung_timer_init();
146}
147
143static void __init tct_hammer_init(void) 148static void __init tct_hammer_init(void)
144{ 149{
145 s3c_i2c0_set_platdata(NULL); 150 s3c_i2c0_set_platdata(NULL);
@@ -151,6 +156,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
151 .map_io = tct_hammer_map_io, 156 .map_io = tct_hammer_map_io,
152 .init_irq = s3c2410_init_irq, 157 .init_irq = s3c2410_init_irq,
153 .init_machine = tct_hammer_init, 158 .init_machine = tct_hammer_init,
154 .init_time = samsung_timer_init, 159 .init_time = tct_hammer_init_time,
155 .restart = s3c2410_restart, 160 .restart = s3c2410_restart,
156MACHINE_END 161MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 1cc5b1bd51cd..f88c584c3001 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -43,7 +43,6 @@
43#include <mach/regs-gpio.h> 43#include <mach/regs-gpio.h>
44#include <mach/gpio-samsung.h> 44#include <mach/gpio-samsung.h>
45 45
46#include <plat/clock.h>
47#include <plat/cpu.h> 46#include <plat/cpu.h>
48#include <plat/devs.h> 47#include <plat/devs.h>
49#include <plat/samsung-time.h> 48#include <plat/samsung-time.h>
@@ -286,6 +285,7 @@ static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
286/* devices for this board */ 285/* devices for this board */
287 286
288static struct platform_device *vr1000_devices[] __initdata = { 287static struct platform_device *vr1000_devices[] __initdata = {
288 &s3c2410_device_dclk,
289 &s3c_device_ohci, 289 &s3c_device_ohci,
290 &s3c_device_lcd, 290 &s3c_device_lcd,
291 &s3c_device_wdt, 291 &s3c_device_wdt,
@@ -299,14 +299,6 @@ static struct platform_device *vr1000_devices[] __initdata = {
299 &vr1000_led3, 299 &vr1000_led3,
300}; 300};
301 301
302static struct clk *vr1000_clocks[] __initdata = {
303 &s3c24xx_dclk0,
304 &s3c24xx_dclk1,
305 &s3c24xx_clkout0,
306 &s3c24xx_clkout1,
307 &s3c24xx_uclk,
308};
309
310static void vr1000_power_off(void) 302static void vr1000_power_off(void)
311{ 303{
312 gpio_direction_output(S3C2410_GPB(9), 1); 304 gpio_direction_output(S3C2410_GPB(9), 1);
@@ -314,29 +306,19 @@ static void vr1000_power_off(void)
314 306
315static void __init vr1000_map_io(void) 307static void __init vr1000_map_io(void)
316{ 308{
317 /* initialise clock sources */
318
319 s3c24xx_dclk0.parent = &clk_upll;
320 s3c24xx_dclk0.rate = 12*1000*1000;
321
322 s3c24xx_dclk1.parent = NULL;
323 s3c24xx_dclk1.rate = 3692307;
324
325 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
326 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
327
328 s3c24xx_uclk.parent = &s3c24xx_clkout1;
329
330 s3c24xx_register_clocks(vr1000_clocks, ARRAY_SIZE(vr1000_clocks));
331
332 pm_power_off = vr1000_power_off; 309 pm_power_off = vr1000_power_off;
333 310
334 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); 311 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
335 s3c24xx_init_clocks(0);
336 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); 312 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
337 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 313 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
338} 314}
339 315
316static void __init vr1000_init_time(void)
317{
318 s3c2410_init_clocks(12000000);
319 samsung_timer_init();
320}
321
340static void __init vr1000_init(void) 322static void __init vr1000_init(void)
341{ 323{
342 s3c_i2c0_set_platdata(NULL); 324 s3c_i2c0_set_platdata(NULL);
@@ -357,6 +339,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
357 .map_io = vr1000_map_io, 339 .map_io = vr1000_map_io,
358 .init_machine = vr1000_init, 340 .init_machine = vr1000_init,
359 .init_irq = s3c2410_init_irq, 341 .init_irq = s3c2410_init_irq,
360 .init_time = samsung_timer_init, 342 .init_time = vr1000_init_time,
361 .restart = s3c2410_restart, 343 .restart = s3c2410_restart,
362MACHINE_END 344MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index 40868c0e0a68..6b706c915387 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -142,11 +142,16 @@ static void __init vstms_fixup(struct tag *tags, char **cmdline,
142static void __init vstms_map_io(void) 142static void __init vstms_map_io(void)
143{ 143{
144 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); 144 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
145 s3c24xx_init_clocks(12000000);
146 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); 145 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
147 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 146 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
148} 147}
149 148
149static void __init vstms_init_time(void)
150{
151 s3c2412_init_clocks(12000000);
152 samsung_timer_init();
153}
154
150static void __init vstms_init(void) 155static void __init vstms_init(void)
151{ 156{
152 s3c_i2c0_set_platdata(NULL); 157 s3c_i2c0_set_platdata(NULL);
@@ -162,6 +167,6 @@ MACHINE_START(VSTMS, "VSTMS")
162 .init_irq = s3c2412_init_irq, 167 .init_irq = s3c2412_init_irq,
163 .init_machine = vstms_init, 168 .init_machine = vstms_init,
164 .map_io = vstms_map_io, 169 .map_io = vstms_map_io,
165 .init_time = samsung_timer_init, 170 .init_time = vstms_init_time,
166 .restart = s3c2412_restart, 171 .restart = s3c2412_restart,
167MACHINE_END 172MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/pm.c b/arch/arm/mach-s3c24xx/pm.c
index 68ea5b7e5dc7..b19256ec8d40 100644
--- a/arch/arm/mach-s3c24xx/pm.c
+++ b/arch/arm/mach-s3c24xx/pm.c
@@ -51,9 +51,6 @@
51#define PFX "s3c24xx-pm: " 51#define PFX "s3c24xx-pm: "
52 52
53static struct sleep_save core_save[] = { 53static struct sleep_save core_save[] = {
54 SAVE_ITEM(S3C2410_LOCKTIME),
55 SAVE_ITEM(S3C2410_CLKCON),
56
57 /* we restore the timings here, with the proviso that the board 54 /* we restore the timings here, with the proviso that the board
58 * brings the system up in an slower, or equal frequency setting 55 * brings the system up in an slower, or equal frequency setting
59 * to the original system. 56 * to the original system.
@@ -69,18 +66,6 @@ static struct sleep_save core_save[] = {
69 SAVE_ITEM(S3C2410_BANKCON3), 66 SAVE_ITEM(S3C2410_BANKCON3),
70 SAVE_ITEM(S3C2410_BANKCON4), 67 SAVE_ITEM(S3C2410_BANKCON4),
71 SAVE_ITEM(S3C2410_BANKCON5), 68 SAVE_ITEM(S3C2410_BANKCON5),
72
73#ifndef CONFIG_CPU_FREQ
74 SAVE_ITEM(S3C2410_CLKDIVN),
75 SAVE_ITEM(S3C2410_MPLLCON),
76 SAVE_ITEM(S3C2410_REFRESH),
77#endif
78 SAVE_ITEM(S3C2410_UPLLCON),
79 SAVE_ITEM(S3C2410_CLKSLOW),
80};
81
82static struct sleep_save misc_save[] = {
83 SAVE_ITEM(S3C2410_DCLKCON),
84}; 69};
85 70
86/* s3c_pm_check_resume_pin 71/* s3c_pm_check_resume_pin
@@ -140,12 +125,10 @@ void s3c_pm_configure_extint(void)
140void s3c_pm_restore_core(void) 125void s3c_pm_restore_core(void)
141{ 126{
142 s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save)); 127 s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
143 s3c_pm_do_restore(misc_save, ARRAY_SIZE(misc_save));
144} 128}
145 129
146void s3c_pm_save_core(void) 130void s3c_pm_save_core(void)
147{ 131{
148 s3c_pm_do_save(misc_save, ARRAY_SIZE(misc_save));
149 s3c_pm_do_save(core_save, ARRAY_SIZE(core_save)); 132 s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
150} 133}
151 134
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index 04b58cb49888..7eab88829883 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -85,62 +85,6 @@ void __init s3c2410_map_io(void)
85 85
86void __init_or_cpufreq s3c2410_setup_clocks(void) 86void __init_or_cpufreq s3c2410_setup_clocks(void)
87{ 87{
88 struct clk *xtal_clk;
89 unsigned long tmp;
90 unsigned long xtal;
91 unsigned long fclk;
92 unsigned long hclk;
93 unsigned long pclk;
94
95 xtal_clk = clk_get(NULL, "xtal");
96 xtal = clk_get_rate(xtal_clk);
97 clk_put(xtal_clk);
98
99 /* now we've got our machine bits initialised, work out what
100 * clocks we've got */
101
102 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal);
103
104 tmp = __raw_readl(S3C2410_CLKDIVN);
105
106 /* work out clock scalings */
107
108 hclk = fclk / ((tmp & S3C2410_CLKDIVN_HDIVN) ? 2 : 1);
109 pclk = hclk / ((tmp & S3C2410_CLKDIVN_PDIVN) ? 2 : 1);
110
111 /* print brieft summary of clocks, etc */
112
113 printk("S3C2410: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
114 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
115
116 /* initialise the clocks here, to allow other things like the
117 * console to use them
118 */
119
120 s3c24xx_setup_clocks(fclk, hclk, pclk);
121}
122
123/* fake ARMCLK for use with cpufreq, etc. */
124
125static struct clk s3c2410_armclk = {
126 .name = "armclk",
127 .parent = &clk_f,
128 .id = -1,
129};
130
131static struct clk_lookup s3c2410_clk_lookup[] = {
132 CLKDEV_INIT(NULL, "clk_uart_baud0", &clk_p),
133 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
134};
135
136void __init s3c2410_init_clocks(int xtal)
137{
138 s3c24xx_register_baseclocks(xtal);
139 s3c2410_setup_clocks();
140 s3c2410_baseclk_add();
141 s3c24xx_register_clock(&s3c2410_armclk);
142 clkdev_add_table(s3c2410_clk_lookup, ARRAY_SIZE(s3c2410_clk_lookup));
143 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
144} 88}
145 89
146struct bus_type s3c2410_subsys = { 90struct bus_type s3c2410_subsys = {
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index 657cbaca80ac..d49f52fbc842 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -173,49 +173,6 @@ void __init s3c2412_map_io(void)
173 173
174void __init_or_cpufreq s3c2412_setup_clocks(void) 174void __init_or_cpufreq s3c2412_setup_clocks(void)
175{ 175{
176 struct clk *xtal_clk;
177 unsigned long tmp;
178 unsigned long xtal;
179 unsigned long fclk;
180 unsigned long hclk;
181 unsigned long pclk;
182
183 xtal_clk = clk_get(NULL, "xtal");
184 xtal = clk_get_rate(xtal_clk);
185 clk_put(xtal_clk);
186
187 /* now we've got our machine bits initialised, work out what
188 * clocks we've got */
189
190 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal * 2);
191
192 clk_mpll.rate = fclk;
193
194 tmp = __raw_readl(S3C2410_CLKDIVN);
195
196 /* work out clock scalings */
197
198 hclk = fclk / ((tmp & S3C2412_CLKDIVN_HDIVN_MASK) + 1);
199 hclk /= ((tmp & S3C2412_CLKDIVN_ARMDIVN) ? 2 : 1);
200 pclk = hclk / ((tmp & S3C2412_CLKDIVN_PDIVN) ? 2 : 1);
201
202 /* print brieft summary of clocks, etc */
203
204 printk("S3C2412: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
205 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
206
207 s3c24xx_setup_clocks(fclk, hclk, pclk);
208}
209
210void __init s3c2412_init_clocks(int xtal)
211{
212 /* initialise the clocks here, to allow other things like the
213 * console to use them
214 */
215
216 s3c24xx_register_baseclocks(xtal);
217 s3c2412_setup_clocks();
218 s3c2412_baseclk_add();
219} 176}
220 177
221/* need to register the subsystem before we actually register the device, and 178/* need to register the subsystem before we actually register the device, and
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c
index 2c8adc028538..fb9da2b603a2 100644
--- a/arch/arm/mach-s3c24xx/s3c2442.c
+++ b/arch/arm/mach-s3c24xx/s3c2442.c
@@ -53,117 +53,6 @@
53 53
54#include "common.h" 54#include "common.h"
55 55
56/* S3C2442 extended clock support */
57
58static unsigned long s3c2442_camif_upll_round(struct clk *clk,
59 unsigned long rate)
60{
61 unsigned long parent_rate = clk_get_rate(clk->parent);
62 int div;
63
64 if (rate > parent_rate)
65 return parent_rate;
66
67 div = parent_rate / rate;
68
69 if (div == 3)
70 return parent_rate / 3;
71
72 /* note, we remove the +/- 1 calculations for the divisor */
73
74 div /= 2;
75
76 if (div < 1)
77 div = 1;
78 else if (div > 16)
79 div = 16;
80
81 return parent_rate / (div * 2);
82}
83
84static int s3c2442_camif_upll_setrate(struct clk *clk, unsigned long rate)
85{
86 unsigned long parent_rate = clk_get_rate(clk->parent);
87 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
88
89 rate = s3c2442_camif_upll_round(clk, rate);
90
91 camdivn &= ~S3C2442_CAMDIVN_CAMCLK_DIV3;
92
93 if (rate == parent_rate) {
94 camdivn &= ~S3C2440_CAMDIVN_CAMCLK_SEL;
95 } else if ((parent_rate / rate) == 3) {
96 camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
97 camdivn |= S3C2442_CAMDIVN_CAMCLK_DIV3;
98 } else {
99 camdivn &= ~S3C2440_CAMDIVN_CAMCLK_MASK;
100 camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
101 camdivn |= (((parent_rate / rate) / 2) - 1);
102 }
103
104 __raw_writel(camdivn, S3C2440_CAMDIVN);
105
106 return 0;
107}
108
109/* Extra S3C2442 clocks */
110
111static struct clk s3c2442_clk_cam = {
112 .name = "camif",
113 .id = -1,
114 .enable = s3c2410_clkcon_enable,
115 .ctrlbit = S3C2440_CLKCON_CAMERA,
116};
117
118static struct clk s3c2442_clk_cam_upll = {
119 .name = "camif-upll",
120 .id = -1,
121 .ops = &(struct clk_ops) {
122 .set_rate = s3c2442_camif_upll_setrate,
123 .round_rate = s3c2442_camif_upll_round,
124 },
125};
126
127static int s3c2442_clk_add(struct device *dev, struct subsys_interface *sif)
128{
129 struct clk *clock_upll;
130 struct clk *clock_h;
131 struct clk *clock_p;
132
133 clock_p = clk_get(NULL, "pclk");
134 clock_h = clk_get(NULL, "hclk");
135 clock_upll = clk_get(NULL, "upll");
136
137 if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) {
138 printk(KERN_ERR "S3C2442: Failed to get parent clocks\n");
139 return -EINVAL;
140 }
141
142 s3c2442_clk_cam.parent = clock_h;
143 s3c2442_clk_cam_upll.parent = clock_upll;
144
145 s3c24xx_register_clock(&s3c2442_clk_cam);
146 s3c24xx_register_clock(&s3c2442_clk_cam_upll);
147
148 clk_disable(&s3c2442_clk_cam);
149
150 return 0;
151}
152
153static struct subsys_interface s3c2442_clk_interface = {
154 .name = "s3c2442_clk",
155 .subsys = &s3c2442_subsys,
156 .add_dev = s3c2442_clk_add,
157};
158
159static __init int s3c2442_clk_init(void)
160{
161 return subsys_interface_register(&s3c2442_clk_interface);
162}
163
164arch_initcall(s3c2442_clk_init);
165
166
167static struct device s3c2442_dev = { 56static struct device s3c2442_dev = {
168 .bus = &s3c2442_subsys, 57 .bus = &s3c2442_subsys,
169}; 58};
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index fe30ebb234d2..4a64bcc9eb51 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -46,6 +46,7 @@
46#include <plat/nand-core.h> 46#include <plat/nand-core.h>
47#include <plat/watchdog-reset.h> 47#include <plat/watchdog-reset.h>
48 48
49#include "common.h"
49#include "regs-dsc.h" 50#include "regs-dsc.h"
50 51
51static struct map_desc s3c244x_iodesc[] __initdata = { 52static struct map_desc s3c244x_iodesc[] __initdata = {
@@ -74,67 +75,11 @@ void __init s3c244x_map_io(void)
74 s3c_nand_setname("s3c2440-nand"); 75 s3c_nand_setname("s3c2440-nand");
75 s3c_device_ts.name = "s3c2440-ts"; 76 s3c_device_ts.name = "s3c2440-ts";
76 s3c_device_usbgadget.name = "s3c2440-usbgadget"; 77 s3c_device_usbgadget.name = "s3c2440-usbgadget";
78 s3c2410_device_dclk.name = "s3c2440-dclk";
77} 79}
78 80
79void __init_or_cpufreq s3c244x_setup_clocks(void) 81void __init_or_cpufreq s3c244x_setup_clocks(void)
80{ 82{
81 struct clk *xtal_clk;
82 unsigned long clkdiv;
83 unsigned long camdiv;
84 unsigned long xtal;
85 unsigned long hclk, fclk, pclk;
86 int hdiv = 1;
87
88 xtal_clk = clk_get(NULL, "xtal");
89 xtal = clk_get_rate(xtal_clk);
90 clk_put(xtal_clk);
91
92 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2;
93
94 clkdiv = __raw_readl(S3C2410_CLKDIVN);
95 camdiv = __raw_readl(S3C2440_CAMDIVN);
96
97 /* work out clock scalings */
98
99 switch (clkdiv & S3C2440_CLKDIVN_HDIVN_MASK) {
100 case S3C2440_CLKDIVN_HDIVN_1:
101 hdiv = 1;
102 break;
103
104 case S3C2440_CLKDIVN_HDIVN_2:
105 hdiv = 2;
106 break;
107
108 case S3C2440_CLKDIVN_HDIVN_4_8:
109 hdiv = (camdiv & S3C2440_CAMDIVN_HCLK4_HALF) ? 8 : 4;
110 break;
111
112 case S3C2440_CLKDIVN_HDIVN_3_6:
113 hdiv = (camdiv & S3C2440_CAMDIVN_HCLK3_HALF) ? 6 : 3;
114 break;
115 }
116
117 hclk = fclk / hdiv;
118 pclk = hclk / ((clkdiv & S3C2440_CLKDIVN_PDIVN) ? 2 : 1);
119
120 /* print brief summary of clocks, etc */
121
122 printk("S3C244X: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
123 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
124
125 s3c24xx_setup_clocks(fclk, hclk, pclk);
126}
127
128void __init s3c244x_init_clocks(int xtal)
129{
130 /* initialise the clocks here, to allow other things like the
131 * console to use them, and to add new ones after the initialisation
132 */
133
134 s3c24xx_register_baseclocks(xtal);
135 s3c244x_setup_clocks();
136 s3c2410_baseclk_add();
137 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
138} 83}
139 84
140/* Since the S3C2442 and S3C2440 share items, put both subsystems here */ 85/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 0f92ba8e7884..dbd954e61aa7 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -8,7 +8,6 @@ config ARCH_SHMOBILE_MULTI
8 select HAVE_ARM_SCU if SMP 8 select HAVE_ARM_SCU if SMP
9 select HAVE_ARM_TWD if SMP 9 select HAVE_ARM_TWD if SMP
10 select ARM_GIC 10 select ARM_GIC
11 select MIGHT_HAVE_PCI
12 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 11 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
13 select NO_IOPORT_MAP 12 select NO_IOPORT_MAP
14 select PINCTRL 13 select PINCTRL
@@ -108,6 +107,7 @@ config ARCH_R8A7778
108 select SH_CLK_CPG 107 select SH_CLK_CPG
109 select ARM_GIC 108 select ARM_GIC
110 select SYS_SUPPORTS_SH_TMU 109 select SYS_SUPPORTS_SH_TMU
110 select RENESAS_INTC_IRQPIN
111 111
112config ARCH_R8A7779 112config ARCH_R8A7779
113 bool "R-Car H1 (R8A77790)" 113 bool "R-Car H1 (R8A77790)"
@@ -140,16 +140,6 @@ config ARCH_R8A7791
140 select SYS_SUPPORTS_SH_CMT 140 select SYS_SUPPORTS_SH_CMT
141 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 141 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
142 142
143config ARCH_EMEV2
144 bool "Emma Mobile EV2"
145 select ARCH_WANT_OPTIONAL_GPIOLIB
146 select ARM_GIC
147 select CPU_V7
148 select MIGHT_HAVE_PCI
149 select USE_OF
150 select AUTO_ZRELADDR
151 select SYS_SUPPORTS_EM_STI
152
153config ARCH_R7S72100 143config ARCH_R7S72100
154 bool "RZ/A1H (R7S72100)" 144 bool "RZ/A1H (R7S72100)"
155 select ARCH_WANT_OPTIONAL_GPIOLIB 145 select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -205,8 +195,8 @@ config MACH_ARMADILLO800EVA_REFERENCE
205 select SND_SOC_WM8978 if SND_SIMPLE_CARD 195 select SND_SOC_WM8978 if SND_SIMPLE_CARD
206 select USE_OF 196 select USE_OF
207 ---help--- 197 ---help---
208 Use reference implementation of Aramdillo800 EVA board support 198 Use reference implementation of Armadillo800 EVA board support
209 which makes a greater use of device tree at the expense 199 which makes greater use of device tree at the expense
210 of not supporting a number of devices. 200 of not supporting a number of devices.
211 201
212 This is intended to aid developers 202 This is intended to aid developers
@@ -216,7 +206,6 @@ config MACH_BOCKW
216 depends on ARCH_R8A7778 206 depends on ARCH_R8A7778
217 select ARCH_REQUIRE_GPIOLIB 207 select ARCH_REQUIRE_GPIOLIB
218 select REGULATOR_FIXED_VOLTAGE if REGULATOR 208 select REGULATOR_FIXED_VOLTAGE if REGULATOR
219 select RENESAS_INTC_IRQPIN
220 select SND_SOC_AK4554 if SND_SIMPLE_CARD 209 select SND_SOC_AK4554 if SND_SIMPLE_CARD
221 select SND_SOC_AK4642 if SND_SIMPLE_CARD 210 select SND_SOC_AK4642 if SND_SIMPLE_CARD
222 select USE_OF 211 select USE_OF
@@ -225,7 +214,6 @@ config MACH_BOCKW_REFERENCE
225 bool "BOCK-W - Reference Device Tree Implementation" 214 bool "BOCK-W - Reference Device Tree Implementation"
226 depends on ARCH_R8A7778 215 depends on ARCH_R8A7778
227 select ARCH_REQUIRE_GPIOLIB 216 select ARCH_REQUIRE_GPIOLIB
228 select RENESAS_INTC_IRQPIN
229 select REGULATOR_FIXED_VOLTAGE if REGULATOR 217 select REGULATOR_FIXED_VOLTAGE if REGULATOR
230 select USE_OF 218 select USE_OF
231 ---help--- 219 ---help---
@@ -240,17 +228,6 @@ config MACH_GENMAI
240 depends on ARCH_R7S72100 228 depends on ARCH_R7S72100
241 select USE_OF 229 select USE_OF
242 230
243config MACH_GENMAI_REFERENCE
244 bool "Genmai board - Reference Device Tree Implementation"
245 depends on ARCH_R7S72100
246 select USE_OF
247 ---help---
248 Use reference implementation of Genmai board support
249 which makes use of device tree at the expense
250 of not supporting a number of devices.
251
252 This is intended to aid developers
253
254config MACH_MARZEN 231config MACH_MARZEN
255 bool "MARZEN board" 232 bool "MARZEN board"
256 depends on ARCH_R8A7779 233 depends on ARCH_R8A7779
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 4caffc912a81..38d5fe825e93 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -21,8 +21,8 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
21obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o 21obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
22 22
23# Clock objects 23# Clock objects
24ifndef CONFIG_COMMON_CLK
25obj-y += clock.o 24obj-y += clock.o
25ifndef CONFIG_COMMON_CLK
26obj-$(CONFIG_ARCH_SH7372) += clock-sh7372.o 26obj-$(CONFIG_ARCH_SH7372) += clock-sh7372.o
27obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o 27obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o
28obj-$(CONFIG_ARCH_R8A73A4) += clock-r8a73a4.o 28obj-$(CONFIG_ARCH_R8A73A4) += clock-r8a73a4.o
@@ -31,7 +31,6 @@ obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
31obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o 31obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
32obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o 32obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o
33obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o 33obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o
34obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o
35obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o 34obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o
36endif 35endif
37 36
@@ -67,7 +66,6 @@ obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
67obj-$(CONFIG_MACH_BOCKW) += board-bockw.o 66obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
68obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o 67obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
69obj-$(CONFIG_MACH_GENMAI) += board-genmai.o 68obj-$(CONFIG_MACH_GENMAI) += board-genmai.o
70obj-$(CONFIG_MACH_GENMAI_REFERENCE) += board-genmai-reference.o
71obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 69obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
72obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o 70obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
73obj-$(CONFIG_MACH_LAGER) += board-lager.o 71obj-$(CONFIG_MACH_LAGER) += board-lager.o
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index 99455ecafa05..918fccffa1b6 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -7,7 +7,6 @@ loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
7loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000 7loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
8loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000 8loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
9loadaddr-$(CONFIG_MACH_GENMAI) += 0x08008000 9loadaddr-$(CONFIG_MACH_GENMAI) += 0x08008000
10loadaddr-$(CONFIG_MACH_GENMAI_REFERENCE) += 0x08008000
11loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000 10loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000
12loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000 11loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
13loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000 12loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
index 57d1a78367b6..57d246eb8813 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
@@ -187,7 +187,7 @@ static const char *eva_boards_compat_dt[] __initdata = {
187 187
188DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference") 188DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference")
189 .map_io = r8a7740_map_io, 189 .map_io = r8a7740_map_io,
190 .init_early = r8a7740_init_delay, 190 .init_early = shmobile_init_delay,
191 .init_irq = r8a7740_init_irq_of, 191 .init_irq = r8a7740_init_irq_of,
192 .init_machine = eva_init, 192 .init_machine = eva_init,
193 .init_late = shmobile_init_late, 193 .init_late = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 486063db2a2f..bc2cf7a89534 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1017,7 +1017,7 @@ static struct asoc_simple_card_info fsi2_hdmi_info = {
1017 .platform = "sh_fsi2", 1017 .platform = "sh_fsi2",
1018 .cpu_dai = { 1018 .cpu_dai = {
1019 .name = "fsib-dai", 1019 .name = "fsib-dai",
1020 .fmt = SND_SOC_DAIFMT_CBM_CFM, 1020 .fmt = SND_SOC_DAIFMT_CBS_CFS,
1021 }, 1021 },
1022 .codec_dai = { 1022 .codec_dai = {
1023 .name = "sh_mobile_hdmi-hifi", 1023 .name = "sh_mobile_hdmi-hifi",
@@ -1300,11 +1300,6 @@ static void __init eva_earlytimer_init(void)
1300 eva_clock_init(); 1300 eva_clock_init();
1301} 1301}
1302 1302
1303static void __init eva_add_early_devices(void)
1304{
1305 r8a7740_add_early_devices();
1306}
1307
1308#define RESCNT2 IOMEM(0xe6188020) 1303#define RESCNT2 IOMEM(0xe6188020)
1309static void eva_restart(enum reboot_mode mode, const char *cmd) 1304static void eva_restart(enum reboot_mode mode, const char *cmd)
1310{ 1305{
@@ -1319,7 +1314,7 @@ static const char *eva_boards_compat_dt[] __initdata = {
1319 1314
1320DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva") 1315DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
1321 .map_io = r8a7740_map_io, 1316 .map_io = r8a7740_map_io,
1322 .init_early = eva_add_early_devices, 1317 .init_early = r8a7740_add_early_devices,
1323 .init_irq = r8a7740_init_irq_of, 1318 .init_irq = r8a7740_init_irq_of,
1324 .init_machine = eva_init, 1319 .init_machine = eva_init,
1325 .init_late = shmobile_init_late, 1320 .init_late = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index b4122f8cb8d9..f444be2f241e 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -345,24 +345,39 @@ static struct rsnd_ssi_platform_info rsnd_ssi[] = {
345 RSND_SSI_UNUSED, /* SSI 0 */ 345 RSND_SSI_UNUSED, /* SSI 0 */
346 RSND_SSI_UNUSED, /* SSI 1 */ 346 RSND_SSI_UNUSED, /* SSI 1 */
347 RSND_SSI_UNUSED, /* SSI 2 */ 347 RSND_SSI_UNUSED, /* SSI 2 */
348 RSND_SSI_SET(1, HPBDMA_SLAVE_HPBIF3_TX, gic_iid(0x85), RSND_SSI_PLAY), 348 RSND_SSI(HPBDMA_SLAVE_HPBIF3_TX, gic_iid(0x85), 0),
349 RSND_SSI_SET(2, HPBDMA_SLAVE_HPBIF4_RX, gic_iid(0x85), RSND_SSI_CLK_PIN_SHARE), 349 RSND_SSI(HPBDMA_SLAVE_HPBIF4_RX, gic_iid(0x85), RSND_SSI_CLK_PIN_SHARE),
350 RSND_SSI_SET(0, HPBDMA_SLAVE_HPBIF5_TX, gic_iid(0x86), RSND_SSI_PLAY), 350 RSND_SSI(HPBDMA_SLAVE_HPBIF5_TX, gic_iid(0x86), 0),
351 RSND_SSI_SET(0, HPBDMA_SLAVE_HPBIF6_RX, gic_iid(0x86), 0), 351 RSND_SSI(HPBDMA_SLAVE_HPBIF6_RX, gic_iid(0x86), 0),
352 RSND_SSI_SET(3, HPBDMA_SLAVE_HPBIF7_TX, gic_iid(0x86), RSND_SSI_PLAY), 352 RSND_SSI(HPBDMA_SLAVE_HPBIF7_TX, gic_iid(0x86), 0),
353 RSND_SSI_SET(4, HPBDMA_SLAVE_HPBIF8_RX, gic_iid(0x86), RSND_SSI_CLK_PIN_SHARE), 353 RSND_SSI(HPBDMA_SLAVE_HPBIF8_RX, gic_iid(0x86), RSND_SSI_CLK_PIN_SHARE),
354}; 354};
355 355
356static struct rsnd_scu_platform_info rsnd_scu[9] = { 356static struct rsnd_src_platform_info rsnd_src[9] = {
357 { .flags = 0, }, /* SRU 0 */ 357 RSND_SRC_UNUSED, /* SRU 0 */
358 { .flags = 0, }, /* SRU 1 */ 358 RSND_SRC_UNUSED, /* SRU 1 */
359 { .flags = 0, }, /* SRU 2 */ 359 RSND_SRC_UNUSED, /* SRU 2 */
360 { .flags = RSND_SCU_USE_HPBIF, }, 360 RSND_SRC(0, 0),
361 { .flags = RSND_SCU_USE_HPBIF, }, 361 RSND_SRC(0, 0),
362 { .flags = RSND_SCU_USE_HPBIF, }, 362 RSND_SRC(0, 0),
363 { .flags = RSND_SCU_USE_HPBIF, }, 363 RSND_SRC(0, 0),
364 { .flags = RSND_SCU_USE_HPBIF, }, 364 RSND_SRC(0, 0),
365 { .flags = RSND_SCU_USE_HPBIF, }, 365 RSND_SRC(0, 0),
366};
367
368static struct rsnd_dai_platform_info rsnd_dai[] = {
369 {
370 .playback = { .ssi = &rsnd_ssi[5], .src = &rsnd_src[5] },
371 .capture = { .ssi = &rsnd_ssi[6], .src = &rsnd_src[6] },
372 }, {
373 .playback = { .ssi = &rsnd_ssi[3], .src = &rsnd_src[3] },
374 }, {
375 .capture = { .ssi = &rsnd_ssi[4], .src = &rsnd_src[4] },
376 }, {
377 .playback = { .ssi = &rsnd_ssi[7], .src = &rsnd_src[7] },
378 }, {
379 .capture = { .ssi = &rsnd_ssi[8], .src = &rsnd_src[8] },
380 },
366}; 381};
367 382
368enum { 383enum {
@@ -437,8 +452,10 @@ static struct rcar_snd_info rsnd_info = {
437 .flags = RSND_GEN1, 452 .flags = RSND_GEN1,
438 .ssi_info = rsnd_ssi, 453 .ssi_info = rsnd_ssi,
439 .ssi_info_nr = ARRAY_SIZE(rsnd_ssi), 454 .ssi_info_nr = ARRAY_SIZE(rsnd_ssi),
440 .scu_info = rsnd_scu, 455 .src_info = rsnd_src,
441 .scu_info_nr = ARRAY_SIZE(rsnd_scu), 456 .src_info_nr = ARRAY_SIZE(rsnd_src),
457 .dai_info = rsnd_dai,
458 .dai_info_nr = ARRAY_SIZE(rsnd_dai),
442 .start = rsnd_start, 459 .start = rsnd_start,
443 .stop = rsnd_stop, 460 .stop = rsnd_stop,
444}; 461};
@@ -591,6 +608,7 @@ static void __init bockw_init(void)
591{ 608{
592 void __iomem *base; 609 void __iomem *base;
593 struct clk *clk; 610 struct clk *clk;
611 struct platform_device *pdev;
594 int i; 612 int i;
595 613
596 r8a7778_clock_init(); 614 r8a7778_clock_init();
@@ -673,9 +691,6 @@ static void __init bockw_init(void)
673 } 691 }
674 692
675 /* for Audio */ 693 /* for Audio */
676 clk = clk_get(NULL, "audio_clk_b");
677 clk_set_rate(clk, 24576000);
678 clk_put(clk);
679 rsnd_codec_power(5, 1); /* enable ak4642 */ 694 rsnd_codec_power(5, 1); /* enable ak4642 */
680 695
681 platform_device_register_simple( 696 platform_device_register_simple(
@@ -684,11 +699,15 @@ static void __init bockw_init(void)
684 platform_device_register_simple( 699 platform_device_register_simple(
685 "ak4554-adc-dac", 1, NULL, 0); 700 "ak4554-adc-dac", 1, NULL, 0);
686 701
687 platform_device_register_resndata( 702 pdev = platform_device_register_resndata(
688 &platform_bus, "rcar_sound", -1, 703 &platform_bus, "rcar_sound", -1,
689 rsnd_resources, ARRAY_SIZE(rsnd_resources), 704 rsnd_resources, ARRAY_SIZE(rsnd_resources),
690 &rsnd_info, sizeof(rsnd_info)); 705 &rsnd_info, sizeof(rsnd_info));
691 706
707 clk = clk_get(&pdev->dev, "clk_b");
708 clk_set_rate(clk, 24576000);
709 clk_put(clk);
710
692 for (i = 0; i < ARRAY_SIZE(rsnd_card_info); i++) { 711 for (i = 0; i < ARRAY_SIZE(rsnd_card_info); i++) {
693 struct platform_device_info cardinfo = { 712 struct platform_device_info cardinfo = {
694 .parent = &platform_bus, 713 .parent = &platform_bus,
diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
index 7630c1053e32..2ff6ad6e608e 100644
--- a/arch/arm/mach-shmobile/board-genmai-reference.c
+++ b/arch/arm/mach-shmobile/board-genmai-reference.c
@@ -18,27 +18,31 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21#include <linux/clk-provider.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <mach/clock.h>
24#include <mach/common.h> 24#include <mach/common.h>
25#include <mach/r7s72100.h> 25#include <mach/r7s72100.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28 28
29/*
30 * This is a really crude hack to provide clkdev support to platform
31 * devices until they get moved to DT.
32 */
33static const struct clk_name clk_names[] = {
34 { "mtu2", "fck", "sh-mtu2" },
35};
36
29static void __init genmai_add_standard_devices(void) 37static void __init genmai_add_standard_devices(void)
30{ 38{
31#ifdef CONFIG_COMMON_CLK 39 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), true);
32 of_clk_init(NULL);
33#else
34 r7s72100_clock_init();
35#endif
36 r7s72100_add_dt_devices(); 40 r7s72100_add_dt_devices();
37 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 41 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
38} 42}
39 43
40static const char * const genmai_boards_compat_dt[] __initconst = { 44static const char * const genmai_boards_compat_dt[] __initconst = {
41 "renesas,genmai-reference", 45 "renesas,genmai",
42 NULL, 46 NULL,
43}; 47};
44 48
diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
index 6c328d63b819..c94201ee8596 100644
--- a/arch/arm/mach-shmobile/board-genmai.c
+++ b/arch/arm/mach-shmobile/board-genmai.c
@@ -21,6 +21,7 @@
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/serial_sci.h>
24#include <linux/sh_eth.h> 25#include <linux/sh_eth.h>
25#include <linux/spi/rspi.h> 26#include <linux/spi/rspi.h>
26#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
@@ -89,6 +90,40 @@ static const struct spi_board_info spi_info[] __initconst = {
89 }, 90 },
90}; 91};
91 92
93/* SCIF */
94#define R7S72100_SCIF(index, baseaddr, irq) \
95static const struct plat_sci_port scif##index##_platform_data = { \
96 .type = PORT_SCIF, \
97 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, \
98 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
99 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | \
100 SCSCR_REIE, \
101}; \
102 \
103static struct resource scif##index##_resources[] = { \
104 DEFINE_RES_MEM(baseaddr, 0x100), \
105 DEFINE_RES_IRQ(irq + 1), \
106 DEFINE_RES_IRQ(irq + 2), \
107 DEFINE_RES_IRQ(irq + 3), \
108 DEFINE_RES_IRQ(irq), \
109} \
110
111R7S72100_SCIF(0, 0xe8007000, gic_iid(221));
112R7S72100_SCIF(1, 0xe8007800, gic_iid(225));
113R7S72100_SCIF(2, 0xe8008000, gic_iid(229));
114R7S72100_SCIF(3, 0xe8008800, gic_iid(233));
115R7S72100_SCIF(4, 0xe8009000, gic_iid(237));
116R7S72100_SCIF(5, 0xe8009800, gic_iid(241));
117R7S72100_SCIF(6, 0xe800a000, gic_iid(245));
118R7S72100_SCIF(7, 0xe800a800, gic_iid(249));
119
120#define r7s72100_register_scif(index) \
121 platform_device_register_resndata(&platform_bus, "sh-sci", index, \
122 scif##index##_resources, \
123 ARRAY_SIZE(scif##index##_resources), \
124 &scif##index##_platform_data, \
125 sizeof(scif##index##_platform_data))
126
92static void __init genmai_add_standard_devices(void) 127static void __init genmai_add_standard_devices(void)
93{ 128{
94 r7s72100_clock_init(); 129 r7s72100_clock_init();
@@ -102,6 +137,15 @@ static void __init genmai_add_standard_devices(void)
102 r7s72100_register_rspi(3); 137 r7s72100_register_rspi(3);
103 r7s72100_register_rspi(4); 138 r7s72100_register_rspi(4);
104 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info)); 139 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
140
141 r7s72100_register_scif(0);
142 r7s72100_register_scif(1);
143 r7s72100_register_scif(2);
144 r7s72100_register_scif(3);
145 r7s72100_register_scif(4);
146 r7s72100_register_scif(5);
147 r7s72100_register_scif(6);
148 r7s72100_register_scif(7);
105} 149}
106 150
107static const char * const genmai_boards_compat_dt[] __initconst = { 151static const char * const genmai_boards_compat_dt[] __initconst = {
diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
index a3fd30242bd8..d322a162b4b0 100644
--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
+++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
@@ -19,12 +19,11 @@
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21 21
22#include <linux/clk.h>
23#include <linux/clkdev.h>
24#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
25#include <linux/kernel.h> 23#include <linux/kernel.h>
26#include <linux/of_platform.h> 24#include <linux/of_platform.h>
27#include <linux/platform_data/rcar-du.h> 25#include <linux/platform_data/rcar-du.h>
26#include <mach/clock.h>
28#include <mach/common.h> 27#include <mach/common.h>
29#include <mach/irqs.h> 28#include <mach/irqs.h>
30#include <mach/rcar-gen2.h> 29#include <mach/rcar-gen2.h>
@@ -82,49 +81,35 @@ static void __init koelsch_add_du_device(void)
82 platform_device_register_full(&info); 81 platform_device_register_full(&info);
83} 82}
84 83
85static void __init koelsch_add_standard_devices(void) 84/*
86{ 85 * This is a really crude hack to provide clkdev support to platform
87 /* 86 * devices until they get moved to DT.
88 * This is a really crude hack to provide clkdev support to the CMT and 87 */
89 * DU devices until they get moved to DT. 88static const struct clk_name clk_names[] __initconst = {
90 */ 89 { "cmt0", "fck", "sh-cmt-48-gen2.0" },
91 static const struct clk_name { 90 { "du0", "du.0", "rcar-du-r8a7791" },
92 const char *clk; 91 { "du1", "du.1", "rcar-du-r8a7791" },
93 const char *con_id; 92 { "lvds0", "lvds.0", "rcar-du-r8a7791" },
94 const char *dev_id; 93};
95 } clk_names[] = {
96 { "cmt0", NULL, "sh_cmt.0" },
97 { "scifa0", NULL, "sh-sci.0" },
98 { "scifa1", NULL, "sh-sci.1" },
99 { "scifb0", NULL, "sh-sci.2" },
100 { "scifb1", NULL, "sh-sci.3" },
101 { "scifb2", NULL, "sh-sci.4" },
102 { "scifa2", NULL, "sh-sci.5" },
103 { "scif0", NULL, "sh-sci.6" },
104 { "scif1", NULL, "sh-sci.7" },
105 { "scif2", NULL, "sh-sci.8" },
106 { "scif3", NULL, "sh-sci.9" },
107 { "scif4", NULL, "sh-sci.10" },
108 { "scif5", NULL, "sh-sci.11" },
109 { "scifa3", NULL, "sh-sci.12" },
110 { "scifa4", NULL, "sh-sci.13" },
111 { "scifa5", NULL, "sh-sci.14" },
112 { "du0", "du.0", "rcar-du-r8a7791" },
113 { "du1", "du.1", "rcar-du-r8a7791" },
114 { "lvds0", "lvds.0", "rcar-du-r8a7791" },
115 };
116 struct clk *clk;
117 unsigned int i;
118 94
119 for (i = 0; i < ARRAY_SIZE(clk_names); ++i) { 95/*
120 clk = clk_get(NULL, clk_names[i].clk); 96 * This is a really crude hack to work around core platform clock issues
121 if (!IS_ERR(clk)) { 97 */
122 clk_register_clkdev(clk, clk_names[i].con_id, 98static const struct clk_name clk_enables[] __initconst = {
123 clk_names[i].dev_id); 99 { "ether", NULL, "ee700000.ethernet" },
124 clk_put(clk); 100 { "i2c2", NULL, "e6530000.i2c" },
125 } 101 { "msiof0", NULL, "e6e20000.spi" },
126 } 102 { "qspi_mod", NULL, "e6b10000.spi" },
103 { "sdhi0", NULL, "ee100000.sd" },
104 { "sdhi1", NULL, "ee140000.sd" },
105 { "sdhi2", NULL, "ee160000.sd" },
106 { "thermal", NULL, "e61f0000.thermal" },
107};
127 108
109static void __init koelsch_add_standard_devices(void)
110{
111 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
112 shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
128 r8a7791_add_dt_devices(); 113 r8a7791_add_dt_devices();
129 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 114 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
130 115
@@ -139,7 +124,7 @@ static const char * const koelsch_boards_compat_dt[] __initconst = {
139 124
140DT_MACHINE_START(KOELSCH_DT, "koelsch") 125DT_MACHINE_START(KOELSCH_DT, "koelsch")
141 .smp = smp_ops(r8a7791_smp_ops), 126 .smp = smp_ops(r8a7791_smp_ops),
142 .init_early = r8a7791_init_early, 127 .init_early = shmobile_init_delay,
143 .init_time = rcar_gen2_timer_init, 128 .init_time = rcar_gen2_timer_init,
144 .init_machine = koelsch_add_standard_devices, 129 .init_machine = koelsch_add_standard_devices,
145 .init_late = shmobile_init_late, 130 .init_late = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index 5a034ff405d0..c6c68892caa3 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -216,7 +216,7 @@ static const struct spi_board_info spi_info[] __initconst = {
216 { 216 {
217 .modalias = "m25p80", 217 .modalias = "m25p80",
218 .platform_data = &spi_flash_data, 218 .platform_data = &spi_flash_data,
219 .mode = SPI_MODE_0, 219 .mode = SPI_MODE_0 | SPI_TX_QUAD | SPI_RX_QUAD,
220 .max_speed_hz = 30000000, 220 .max_speed_hz = 30000000,
221 .bus_num = 0, 221 .bus_num = 0,
222 .chip_select = 0, 222 .chip_select = 0,
@@ -522,7 +522,7 @@ static const char * const koelsch_boards_compat_dt[] __initconst = {
522 522
523DT_MACHINE_START(KOELSCH_DT, "koelsch") 523DT_MACHINE_START(KOELSCH_DT, "koelsch")
524 .smp = smp_ops(r8a7791_smp_ops), 524 .smp = smp_ops(r8a7791_smp_ops),
525 .init_early = r8a7791_init_early, 525 .init_early = shmobile_init_delay,
526 .init_time = rcar_gen2_timer_init, 526 .init_time = rcar_gen2_timer_init,
527 .init_machine = koelsch_init, 527 .init_machine = koelsch_init,
528 .init_late = shmobile_init_late, 528 .init_late = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index 440aac36d693..749832e3f33c 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -18,12 +18,11 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21#include <linux/clk.h>
22#include <linux/clkdev.h>
23#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
24#include <linux/init.h> 22#include <linux/init.h>
25#include <linux/of_platform.h> 23#include <linux/of_platform.h>
26#include <linux/platform_data/rcar-du.h> 24#include <linux/platform_data/rcar-du.h>
25#include <mach/clock.h>
27#include <mach/common.h> 26#include <mach/common.h>
28#include <mach/irqs.h> 27#include <mach/irqs.h>
29#include <mach/rcar-gen2.h> 28#include <mach/rcar-gen2.h>
@@ -86,46 +85,36 @@ static void __init lager_add_du_device(void)
86 platform_device_register_full(&info); 85 platform_device_register_full(&info);
87} 86}
88 87
89static void __init lager_add_standard_devices(void) 88/*
90{ 89 * This is a really crude hack to provide clkdev support to platform
91 /* 90 * devices until they get moved to DT.
92 * This is a really crude hack to provide clkdev support to platform 91 */
93 * devices until they get moved to DT. 92static const struct clk_name clk_names[] __initconst = {
94 */ 93 { "cmt0", "fck", "sh-cmt-48-gen2.0" },
95 static const struct clk_name { 94 { "du0", "du.0", "rcar-du-r8a7790" },
96 const char *clk; 95 { "du1", "du.1", "rcar-du-r8a7790" },
97 const char *con_id; 96 { "du2", "du.2", "rcar-du-r8a7790" },
98 const char *dev_id; 97 { "lvds0", "lvds.0", "rcar-du-r8a7790" },
99 } clk_names[] = { 98 { "lvds1", "lvds.1", "rcar-du-r8a7790" },
100 { "cmt0", NULL, "sh_cmt.0" }, 99};
101 { "scifa0", NULL, "sh-sci.0" },
102 { "scifa1", NULL, "sh-sci.1" },
103 { "scifb0", NULL, "sh-sci.2" },
104 { "scifb1", NULL, "sh-sci.3" },
105 { "scifb2", NULL, "sh-sci.4" },
106 { "scifa2", NULL, "sh-sci.5" },
107 { "scif0", NULL, "sh-sci.6" },
108 { "scif1", NULL, "sh-sci.7" },
109 { "hscif0", NULL, "sh-sci.8" },
110 { "hscif1", NULL, "sh-sci.9" },
111 { "du0", "du.0", "rcar-du-r8a7790" },
112 { "du1", "du.1", "rcar-du-r8a7790" },
113 { "du2", "du.2", "rcar-du-r8a7790" },
114 { "lvds0", "lvds.0", "rcar-du-r8a7790" },
115 { "lvds1", "lvds.1", "rcar-du-r8a7790" },
116 };
117 struct clk *clk;
118 unsigned int i;
119 100
120 for (i = 0; i < ARRAY_SIZE(clk_names); ++i) { 101/*
121 clk = clk_get(NULL, clk_names[i].clk); 102 * This is a really crude hack to work around core platform clock issues
122 if (!IS_ERR(clk)) { 103 */
123 clk_register_clkdev(clk, clk_names[i].con_id, 104static const struct clk_name clk_enables[] __initconst = {
124 clk_names[i].dev_id); 105 { "ether", NULL, "ee700000.ethernet" },
125 clk_put(clk); 106 { "msiof1", NULL, "e6e10000.spi" },
126 } 107 { "mmcif1", NULL, "ee220000.mmc" },
127 } 108 { "qspi_mod", NULL, "e6b10000.spi" },
109 { "sdhi0", NULL, "ee100000.sd" },
110 { "sdhi2", NULL, "ee140000.sd" },
111 { "thermal", NULL, "e61f0000.thermal" },
112};
128 113
114static void __init lager_add_standard_devices(void)
115{
116 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
117 shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
129 r8a7790_add_dt_devices(); 118 r8a7790_add_dt_devices();
130 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 119 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
131 120
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 18c7e0311aa6..f8b1e05463cc 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -325,12 +325,12 @@ static const struct rspi_plat_data qspi_pdata __initconst = {
325 325
326static const struct spi_board_info spi_info[] __initconst = { 326static const struct spi_board_info spi_info[] __initconst = {
327 { 327 {
328 .modalias = "m25p80", 328 .modalias = "m25p80",
329 .platform_data = &spi_flash_data, 329 .platform_data = &spi_flash_data,
330 .mode = SPI_MODE_0, 330 .mode = SPI_MODE_0 | SPI_TX_QUAD | SPI_RX_QUAD,
331 .max_speed_hz = 30000000, 331 .max_speed_hz = 30000000,
332 .bus_num = 0, 332 .bus_num = 0,
333 .chip_select = 0, 333 .chip_select = 0,
334 }, 334 },
335}; 335};
336 336
@@ -567,20 +567,27 @@ static struct resource rsnd_resources[] __initdata = {
567}; 567};
568 568
569static struct rsnd_ssi_platform_info rsnd_ssi[] = { 569static struct rsnd_ssi_platform_info rsnd_ssi[] = {
570 RSND_SSI_SET(0, 0, gic_spi(370), RSND_SSI_PLAY), 570 RSND_SSI(0, gic_spi(370), 0),
571 RSND_SSI_SET(0, 0, gic_spi(371), RSND_SSI_CLK_PIN_SHARE), 571 RSND_SSI(0, gic_spi(371), RSND_SSI_CLK_PIN_SHARE),
572}; 572};
573 573
574static struct rsnd_scu_platform_info rsnd_scu[2] = { 574static struct rsnd_src_platform_info rsnd_src[2] = {
575 /* no member at this point */ 575 /* no member at this point */
576}; 576};
577 577
578static struct rsnd_dai_platform_info rsnd_dai = {
579 .playback = { .ssi = &rsnd_ssi[0], },
580 .capture = { .ssi = &rsnd_ssi[1], },
581};
582
578static struct rcar_snd_info rsnd_info = { 583static struct rcar_snd_info rsnd_info = {
579 .flags = RSND_GEN2, 584 .flags = RSND_GEN2,
580 .ssi_info = rsnd_ssi, 585 .ssi_info = rsnd_ssi,
581 .ssi_info_nr = ARRAY_SIZE(rsnd_ssi), 586 .ssi_info_nr = ARRAY_SIZE(rsnd_ssi),
582 .scu_info = rsnd_scu, 587 .src_info = rsnd_src,
583 .scu_info_nr = ARRAY_SIZE(rsnd_scu), 588 .src_info_nr = ARRAY_SIZE(rsnd_src),
589 .dai_info = &rsnd_dai,
590 .dai_info_nr = 1,
584}; 591};
585 592
586static struct asoc_simple_card_info rsnd_card_info = { 593static struct asoc_simple_card_info rsnd_card_info = {
diff --git a/arch/arm/mach-shmobile/clock-emev2.c b/arch/arm/mach-shmobile/clock-emev2.c
deleted file mode 100644
index 5ac13ba71d54..000000000000
--- a/arch/arm/mach-shmobile/clock-emev2.c
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * Emma Mobile EV2 clock framework support
3 *
4 * Copyright (C) 2012 Magnus Damm
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; version 2 of the License.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/io.h>
22#include <linux/sh_clk.h>
23#include <linux/clkdev.h>
24#include <mach/common.h>
25
26#define EMEV2_SMU_BASE 0xe0110000
27
28/* EMEV2 SMU registers */
29#define USIAU0_RSTCTRL 0x094
30#define USIBU1_RSTCTRL 0x0ac
31#define USIBU2_RSTCTRL 0x0b0
32#define USIBU3_RSTCTRL 0x0b4
33#define STI_RSTCTRL 0x124
34#define USIAU0GCLKCTRL 0x4a0
35#define USIBU1GCLKCTRL 0x4b8
36#define USIBU2GCLKCTRL 0x4bc
37#define USIBU3GCLKCTRL 0x04c0
38#define STIGCLKCTRL 0x528
39#define USIAU0SCLKDIV 0x61c
40#define USIB2SCLKDIV 0x65c
41#define USIB3SCLKDIV 0x660
42#define STI_CLKSEL 0x688
43
44/* not pretty, but hey */
45static void __iomem *smu_base;
46
47static void emev2_smu_write(unsigned long value, int offs)
48{
49 BUG_ON(!smu_base || (offs >= PAGE_SIZE));
50 iowrite32(value, smu_base + offs);
51}
52
53static struct clk_mapping smu_mapping = {
54 .phys = EMEV2_SMU_BASE,
55 .len = PAGE_SIZE,
56};
57
58/* Fixed 32 KHz root clock from C32K pin */
59static struct clk c32k_clk = {
60 .rate = 32768,
61 .mapping = &smu_mapping,
62};
63
64/* PLL3 multiplies C32K with 7000 */
65static unsigned long pll3_recalc(struct clk *clk)
66{
67 return clk->parent->rate * 7000;
68}
69
70static struct sh_clk_ops pll3_clk_ops = {
71 .recalc = pll3_recalc,
72};
73
74static struct clk pll3_clk = {
75 .ops = &pll3_clk_ops,
76 .parent = &c32k_clk,
77};
78
79static struct clk *main_clks[] = {
80 &c32k_clk,
81 &pll3_clk,
82};
83
84enum { SCLKDIV_USIAU0, SCLKDIV_USIBU2, SCLKDIV_USIBU1, SCLKDIV_USIBU3,
85 SCLKDIV_NR };
86
87#define SCLKDIV(_reg, _shift) \
88{ \
89 .parent = &pll3_clk, \
90 .enable_reg = IOMEM(EMEV2_SMU_BASE + (_reg)), \
91 .enable_bit = _shift, \
92}
93
94static struct clk sclkdiv_clks[SCLKDIV_NR] = {
95 [SCLKDIV_USIAU0] = SCLKDIV(USIAU0SCLKDIV, 0),
96 [SCLKDIV_USIBU2] = SCLKDIV(USIB2SCLKDIV, 16),
97 [SCLKDIV_USIBU1] = SCLKDIV(USIB2SCLKDIV, 0),
98 [SCLKDIV_USIBU3] = SCLKDIV(USIB3SCLKDIV, 0),
99};
100
101enum { GCLK_USIAU0_SCLK, GCLK_USIBU1_SCLK, GCLK_USIBU2_SCLK, GCLK_USIBU3_SCLK,
102 GCLK_STI_SCLK,
103 GCLK_NR };
104
105#define GCLK_SCLK(_parent, _reg) \
106{ \
107 .parent = _parent, \
108 .enable_reg = IOMEM(EMEV2_SMU_BASE + (_reg)), \
109 .enable_bit = 1, /* SCLK_GCC */ \
110}
111
112static struct clk gclk_clks[GCLK_NR] = {
113 [GCLK_USIAU0_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIAU0],
114 USIAU0GCLKCTRL),
115 [GCLK_USIBU1_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU1],
116 USIBU1GCLKCTRL),
117 [GCLK_USIBU2_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU2],
118 USIBU2GCLKCTRL),
119 [GCLK_USIBU3_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU3],
120 USIBU3GCLKCTRL),
121 [GCLK_STI_SCLK] = GCLK_SCLK(&c32k_clk, STIGCLKCTRL),
122};
123
124static int emev2_gclk_enable(struct clk *clk)
125{
126 iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
127 clk->mapped_reg);
128 return 0;
129}
130
131static void emev2_gclk_disable(struct clk *clk)
132{
133 iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
134 clk->mapped_reg);
135}
136
137static struct sh_clk_ops emev2_gclk_clk_ops = {
138 .enable = emev2_gclk_enable,
139 .disable = emev2_gclk_disable,
140 .recalc = followparent_recalc,
141};
142
143static int __init emev2_gclk_register(struct clk *clks, int nr)
144{
145 struct clk *clkp;
146 int ret = 0;
147 int k;
148
149 for (k = 0; !ret && (k < nr); k++) {
150 clkp = clks + k;
151 clkp->ops = &emev2_gclk_clk_ops;
152 ret |= clk_register(clkp);
153 }
154
155 return ret;
156}
157
158static unsigned long emev2_sclkdiv_recalc(struct clk *clk)
159{
160 unsigned int sclk_div;
161
162 sclk_div = (ioread32(clk->mapped_reg) >> clk->enable_bit) & 0xff;
163
164 return clk->parent->rate / (sclk_div + 1);
165}
166
167static struct sh_clk_ops emev2_sclkdiv_clk_ops = {
168 .recalc = emev2_sclkdiv_recalc,
169};
170
171static int __init emev2_sclkdiv_register(struct clk *clks, int nr)
172{
173 struct clk *clkp;
174 int ret = 0;
175 int k;
176
177 for (k = 0; !ret && (k < nr); k++) {
178 clkp = clks + k;
179 clkp->ops = &emev2_sclkdiv_clk_ops;
180 ret |= clk_register(clkp);
181 }
182
183 return ret;
184}
185
186static struct clk_lookup lookups[] = {
187 CLKDEV_DEV_ID("serial8250-em.0", &gclk_clks[GCLK_USIAU0_SCLK]),
188 CLKDEV_DEV_ID("e1020000.uart", &gclk_clks[GCLK_USIAU0_SCLK]),
189 CLKDEV_DEV_ID("serial8250-em.1", &gclk_clks[GCLK_USIBU1_SCLK]),
190 CLKDEV_DEV_ID("e1030000.uart", &gclk_clks[GCLK_USIBU1_SCLK]),
191 CLKDEV_DEV_ID("serial8250-em.2", &gclk_clks[GCLK_USIBU2_SCLK]),
192 CLKDEV_DEV_ID("e1040000.uart", &gclk_clks[GCLK_USIBU2_SCLK]),
193 CLKDEV_DEV_ID("serial8250-em.3", &gclk_clks[GCLK_USIBU3_SCLK]),
194 CLKDEV_DEV_ID("e1050000.uart", &gclk_clks[GCLK_USIBU3_SCLK]),
195 CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
196 CLKDEV_DEV_ID("e0180000.sti", &gclk_clks[GCLK_STI_SCLK]),
197};
198
199void __init emev2_clock_init(void)
200{
201 int k, ret = 0;
202
203 smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
204 BUG_ON(!smu_base);
205
206 /* setup STI timer to run on 32.768 kHz and deassert reset */
207 emev2_smu_write(0, STI_CLKSEL);
208 emev2_smu_write(1, STI_RSTCTRL);
209
210 /* deassert reset for UART0->UART3 */
211 emev2_smu_write(2, USIAU0_RSTCTRL);
212 emev2_smu_write(2, USIBU1_RSTCTRL);
213 emev2_smu_write(2, USIBU2_RSTCTRL);
214 emev2_smu_write(2, USIBU3_RSTCTRL);
215
216 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
217 ret = clk_register(main_clks[k]);
218
219 if (!ret)
220 ret = emev2_sclkdiv_register(sclkdiv_clks, SCLKDIV_NR);
221
222 if (!ret)
223 ret = emev2_gclk_register(gclk_clks, GCLK_NR);
224
225 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
226
227 if (!ret)
228 shmobile_clk_init();
229 else
230 panic("failed to setup emev2 clocks\n");
231}
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
index bee0073c9b64..df187484de5d 100644
--- a/arch/arm/mach-shmobile/clock-r7s72100.c
+++ b/arch/arm/mach-shmobile/clock-r7s72100.c
@@ -194,17 +194,7 @@ static struct clk_lookup lookups[] = {
194 CLKDEV_DEV_ID("rspi-rz.2", &mstp_clks[MSTP105]), 194 CLKDEV_DEV_ID("rspi-rz.2", &mstp_clks[MSTP105]),
195 CLKDEV_DEV_ID("rspi-rz.3", &mstp_clks[MSTP104]), 195 CLKDEV_DEV_ID("rspi-rz.3", &mstp_clks[MSTP104]),
196 CLKDEV_DEV_ID("rspi-rz.4", &mstp_clks[MSTP103]), 196 CLKDEV_DEV_ID("rspi-rz.4", &mstp_clks[MSTP103]),
197 CLKDEV_DEV_ID("e800c800.spi", &mstp_clks[MSTP107]),
198 CLKDEV_DEV_ID("e800d000.spi", &mstp_clks[MSTP106]),
199 CLKDEV_DEV_ID("e800d800.spi", &mstp_clks[MSTP105]),
200 CLKDEV_DEV_ID("e800e000.spi", &mstp_clks[MSTP104]),
201 CLKDEV_DEV_ID("e800e800.spi", &mstp_clks[MSTP103]),
202 CLKDEV_DEV_ID("fcfee000.i2c", &mstp_clks[MSTP97]),
203 CLKDEV_DEV_ID("fcfee400.i2c", &mstp_clks[MSTP96]),
204 CLKDEV_DEV_ID("fcfee800.i2c", &mstp_clks[MSTP95]),
205 CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),
206 CLKDEV_DEV_ID("r7s72100-ether", &mstp_clks[MSTP74]), 197 CLKDEV_DEV_ID("r7s72100-ether", &mstp_clks[MSTP74]),
207 CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]),
208 198
209 /* ICK */ 199 /* ICK */
210 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]), 200 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]),
@@ -215,6 +205,7 @@ static struct clk_lookup lookups[] = {
215 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]), 205 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]),
216 CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]), 206 CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]),
217 CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]), 207 CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
208 CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP33]),
218}; 209};
219 210
220void __init r7s72100_clock_init(void) 211void __init r7s72100_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index 7348d58f500e..b5bc22c6a858 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -597,7 +597,7 @@ static struct clk_lookup lookups[] = {
597 CLKDEV_DEV_ID("e6560000.i2c", &mstp_clks[MSTP317]), 597 CLKDEV_DEV_ID("e6560000.i2c", &mstp_clks[MSTP317]),
598 CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]), 598 CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]),
599 CLKDEV_DEV_ID("e6510000.i2c", &mstp_clks[MSTP323]), 599 CLKDEV_DEV_ID("e6510000.i2c", &mstp_clks[MSTP323]),
600 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), 600 CLKDEV_ICK_ID("fck", "sh-cmt-48-gen2.1", &mstp_clks[MSTP329]),
601 CLKDEV_DEV_ID("e60b0000.i2c", &mstp_clks[MSTP409]), 601 CLKDEV_DEV_ID("e60b0000.i2c", &mstp_clks[MSTP409]),
602 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP410]), 602 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP410]),
603 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP411]), 603 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP411]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index dd989f93498f..50931e3c97c7 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -548,15 +548,9 @@ static struct clk_lookup lookups[] = {
548 548
549 /* MSTP32 clocks */ 549 /* MSTP32 clocks */
550 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), 550 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]),
551 CLKDEV_DEV_ID("sh_tmu.3", &mstp_clks[MSTP111]),
552 CLKDEV_DEV_ID("sh_tmu.4", &mstp_clks[MSTP111]),
553 CLKDEV_DEV_ID("sh_tmu.5", &mstp_clks[MSTP111]),
554 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), 551 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]),
555 CLKDEV_DEV_ID("fff20000.i2c", &mstp_clks[MSTP116]), 552 CLKDEV_DEV_ID("fff20000.i2c", &mstp_clks[MSTP116]),
556 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), 553 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]),
557 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]),
558 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]),
559 CLKDEV_DEV_ID("sh_tmu.2", &mstp_clks[MSTP125]),
560 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), 554 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]),
561 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]), 555 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]),
562 556
@@ -583,7 +577,6 @@ static struct clk_lookup lookups[] = {
583 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), 577 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
584 CLKDEV_DEV_ID("e6cc0000.sci", &mstp_clks[MSTP230]), 578 CLKDEV_DEV_ID("e6cc0000.sci", &mstp_clks[MSTP230]),
585 579
586 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]),
587 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), 580 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
588 CLKDEV_DEV_ID("fe1f0000.sound", &mstp_clks[MSTP328]), 581 CLKDEV_DEV_ID("fe1f0000.sound", &mstp_clks[MSTP328]),
589 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), 582 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
@@ -596,7 +589,7 @@ static struct clk_lookup lookups[] = {
596 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), 589 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
597 CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]), 590 CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]),
598 CLKDEV_DEV_ID("r8a7740-gether", &mstp_clks[MSTP309]), 591 CLKDEV_DEV_ID("r8a7740-gether", &mstp_clks[MSTP309]),
599 CLKDEV_DEV_ID("e9a00000.sh-eth", &mstp_clks[MSTP309]), 592 CLKDEV_DEV_ID("e9a00000.ethernet", &mstp_clks[MSTP309]),
600 CLKDEV_DEV_ID("renesas-tpu-pwm", &mstp_clks[MSTP304]), 593 CLKDEV_DEV_ID("renesas-tpu-pwm", &mstp_clks[MSTP304]),
601 CLKDEV_DEV_ID("e6600000.pwm", &mstp_clks[MSTP304]), 594 CLKDEV_DEV_ID("e6600000.pwm", &mstp_clks[MSTP304]),
602 595
@@ -604,6 +597,9 @@ static struct clk_lookup lookups[] = {
604 CLKDEV_DEV_ID("e6870000.sd", &mstp_clks[MSTP415]), 597 CLKDEV_DEV_ID("e6870000.sd", &mstp_clks[MSTP415]),
605 598
606 /* ICK */ 599 /* ICK */
600 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP111]),
601 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]),
602 CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]),
607 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]), 603 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
608 CLKDEV_ICK_ID("func", "renesas_usbhs", &mstp_clks[MSTP407]), 604 CLKDEV_ICK_ID("func", "renesas_usbhs", &mstp_clks[MSTP407]),
609 CLKDEV_ICK_ID("phy", "renesas_usbhs", &mstp_clks[MSTP406]), 605 CLKDEV_ICK_ID("phy", "renesas_usbhs", &mstp_clks[MSTP406]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index 9989b1b06ffd..13f8f3ab8840 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -175,10 +175,6 @@ static struct clk mstp_clks[MSTP_NR] = {
175 175
176static struct clk_lookup lookups[] = { 176static struct clk_lookup lookups[] = {
177 /* main */ 177 /* main */
178 CLKDEV_CON_ID("audio_clk_a", &audio_clk_a),
179 CLKDEV_CON_ID("audio_clk_b", &audio_clk_b),
180 CLKDEV_CON_ID("audio_clk_c", &audio_clk_c),
181 CLKDEV_CON_ID("audio_clk_internal", &s1_clk),
182 CLKDEV_CON_ID("shyway_clk", &s_clk), 178 CLKDEV_CON_ID("shyway_clk", &s_clk),
183 CLKDEV_CON_ID("peripheral_clk", &p_clk), 179 CLKDEV_CON_ID("peripheral_clk", &p_clk),
184 180
@@ -211,8 +207,6 @@ static struct clk_lookup lookups[] = {
211 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */ 207 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */
212 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */ 208 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */
213 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */ 209 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
214 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */
215 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP015]), /* TMU01 */
216 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */ 210 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
217 CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */ 211 CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */
218 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */ 212 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
@@ -234,15 +228,17 @@ static struct clk_lookup lookups[] = {
234 CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP309]), 228 CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP309]),
235 CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP308]), 229 CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP308]),
236 CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP307]), 230 CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP307]),
237 CLKDEV_ICK_ID("scu.0", "rcar_sound", &mstp_clks[MSTP531]), 231 CLKDEV_ICK_ID("src.0", "rcar_sound", &mstp_clks[MSTP531]),
238 CLKDEV_ICK_ID("scu.1", "rcar_sound", &mstp_clks[MSTP530]), 232 CLKDEV_ICK_ID("src.1", "rcar_sound", &mstp_clks[MSTP530]),
239 CLKDEV_ICK_ID("scu.2", "rcar_sound", &mstp_clks[MSTP529]), 233 CLKDEV_ICK_ID("src.2", "rcar_sound", &mstp_clks[MSTP529]),
240 CLKDEV_ICK_ID("scu.3", "rcar_sound", &mstp_clks[MSTP528]), 234 CLKDEV_ICK_ID("src.3", "rcar_sound", &mstp_clks[MSTP528]),
241 CLKDEV_ICK_ID("scu.4", "rcar_sound", &mstp_clks[MSTP527]), 235 CLKDEV_ICK_ID("src.4", "rcar_sound", &mstp_clks[MSTP527]),
242 CLKDEV_ICK_ID("scu.5", "rcar_sound", &mstp_clks[MSTP526]), 236 CLKDEV_ICK_ID("src.5", "rcar_sound", &mstp_clks[MSTP526]),
243 CLKDEV_ICK_ID("scu.6", "rcar_sound", &mstp_clks[MSTP525]), 237 CLKDEV_ICK_ID("src.6", "rcar_sound", &mstp_clks[MSTP525]),
244 CLKDEV_ICK_ID("scu.7", "rcar_sound", &mstp_clks[MSTP524]), 238 CLKDEV_ICK_ID("src.7", "rcar_sound", &mstp_clks[MSTP524]),
245 CLKDEV_ICK_ID("scu.8", "rcar_sound", &mstp_clks[MSTP523]), 239 CLKDEV_ICK_ID("src.8", "rcar_sound", &mstp_clks[MSTP523]),
240 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]),
241 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP015]),
246}; 242};
247 243
248void __init r8a7778_clock_init(void) 244void __init r8a7778_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 8e403ae0c7b2..a13298bd37a8 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -173,9 +173,7 @@ static struct clk_lookup lookups[] = {
173 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ 173 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
174 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ 174 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
175 CLKDEV_DEV_ID("ohci-platform.0", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */ 175 CLKDEV_DEV_ID("ohci-platform.0", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
176 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */ 176 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]), /* TMU0 */
177 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP016]), /* TMU01 */
178 CLKDEV_DEV_ID("sh_tmu.2", &mstp_clks[MSTP016]), /* TMU02 */
179 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ 177 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
180 CLKDEV_DEV_ID("ffc70000.i2c", &mstp_clks[MSTP030]), /* I2C0 */ 178 CLKDEV_DEV_ID("ffc70000.i2c", &mstp_clks[MSTP030]), /* I2C0 */
181 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */ 179 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index 3f93503f5b96..296a057109e4 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -249,10 +249,10 @@ static struct clk mstp_clks[MSTP_NR] = {
249 [MSTP1007] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR10, 7, MSTPSR10, 0), /* SSI8 */ 249 [MSTP1007] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR10, 7, MSTPSR10, 0), /* SSI8 */
250 [MSTP1006] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR10, 6, MSTPSR10, 0), /* SSI9 */ 250 [MSTP1006] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR10, 6, MSTPSR10, 0), /* SSI9 */
251 [MSTP1005] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR10, 5, MSTPSR10, 0), /* SSI ALL */ 251 [MSTP1005] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR10, 5, MSTPSR10, 0), /* SSI ALL */
252 [MSTP931] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 31, MSTPSR9, 0), /* I2C0 */ 252 [MSTP931] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 31, MSTPSR9, 0), /* I2C0 */
253 [MSTP930] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 30, MSTPSR9, 0), /* I2C1 */ 253 [MSTP930] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 30, MSTPSR9, 0), /* I2C1 */
254 [MSTP929] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 29, MSTPSR9, 0), /* I2C2 */ 254 [MSTP929] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 29, MSTPSR9, 0), /* I2C2 */
255 [MSTP928] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 28, MSTPSR9, 0), /* I2C3 */ 255 [MSTP928] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 28, MSTPSR9, 0), /* I2C3 */
256 [MSTP917] = SH_CLK_MSTP32_STS(&qspi_clk, SMSTPCR9, 17, MSTPSR9, 0), /* QSPI */ 256 [MSTP917] = SH_CLK_MSTP32_STS(&qspi_clk, SMSTPCR9, 17, MSTPSR9, 0), /* QSPI */
257 [MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */ 257 [MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */
258 [MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */ 258 [MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */
@@ -294,10 +294,6 @@ static struct clk mstp_clks[MSTP_NR] = {
294static struct clk_lookup lookups[] = { 294static struct clk_lookup lookups[] = {
295 295
296 /* main clocks */ 296 /* main clocks */
297 CLKDEV_CON_ID("audio_clk_a", &audio_clk_a),
298 CLKDEV_CON_ID("audio_clk_b", &audio_clk_b),
299 CLKDEV_CON_ID("audio_clk_c", &audio_clk_c),
300 CLKDEV_CON_ID("audio_clk_internal", &m2_clk),
301 CLKDEV_CON_ID("extal", &extal_clk), 297 CLKDEV_CON_ID("extal", &extal_clk),
302 CLKDEV_CON_ID("extal_div2", &extal_div2_clk), 298 CLKDEV_CON_ID("extal_div2", &extal_div2_clk),
303 CLKDEV_CON_ID("main", &main_clk), 299 CLKDEV_CON_ID("main", &main_clk),
@@ -361,7 +357,6 @@ static struct clk_lookup lookups[] = {
361 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]), 357 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]),
362 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]), 358 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]),
363 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), 359 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
364 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
365 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]), 360 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]),
366 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP704]), 361 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP704]),
367 CLKDEV_DEV_ID("pci-rcar-gen2.0", &mstp_clks[MSTP703]), 362 CLKDEV_DEV_ID("pci-rcar-gen2.0", &mstp_clks[MSTP703]),
@@ -371,6 +366,7 @@ static struct clk_lookup lookups[] = {
371 CLKDEV_DEV_ID("sata-r8a7790.1", &mstp_clks[MSTP814]), 366 CLKDEV_DEV_ID("sata-r8a7790.1", &mstp_clks[MSTP814]),
372 367
373 /* ICK */ 368 /* ICK */
369 CLKDEV_ICK_ID("fck", "sh-cmt-48-gen2.0", &mstp_clks[MSTP124]),
374 CLKDEV_ICK_ID("usbhs", "usb_phy_rcar_gen2", &mstp_clks[MSTP704]), 370 CLKDEV_ICK_ID("usbhs", "usb_phy_rcar_gen2", &mstp_clks[MSTP704]),
375 CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7790", &mstp_clks[MSTP726]), 371 CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7790", &mstp_clks[MSTP726]),
376 CLKDEV_ICK_ID("lvds.1", "rcar-du-r8a7790", &mstp_clks[MSTP725]), 372 CLKDEV_ICK_ID("lvds.1", "rcar-du-r8a7790", &mstp_clks[MSTP725]),
@@ -381,16 +377,16 @@ static struct clk_lookup lookups[] = {
381 CLKDEV_ICK_ID("clk_b", "rcar_sound", &audio_clk_b), 377 CLKDEV_ICK_ID("clk_b", "rcar_sound", &audio_clk_b),
382 CLKDEV_ICK_ID("clk_c", "rcar_sound", &audio_clk_c), 378 CLKDEV_ICK_ID("clk_c", "rcar_sound", &audio_clk_c),
383 CLKDEV_ICK_ID("clk_i", "rcar_sound", &m2_clk), 379 CLKDEV_ICK_ID("clk_i", "rcar_sound", &m2_clk),
384 CLKDEV_ICK_ID("scu.0", "rcar_sound", &mstp_clks[MSTP1031]), 380 CLKDEV_ICK_ID("src.0", "rcar_sound", &mstp_clks[MSTP1031]),
385 CLKDEV_ICK_ID("scu.1", "rcar_sound", &mstp_clks[MSTP1030]), 381 CLKDEV_ICK_ID("src.1", "rcar_sound", &mstp_clks[MSTP1030]),
386 CLKDEV_ICK_ID("scu.2", "rcar_sound", &mstp_clks[MSTP1029]), 382 CLKDEV_ICK_ID("src.2", "rcar_sound", &mstp_clks[MSTP1029]),
387 CLKDEV_ICK_ID("scu.3", "rcar_sound", &mstp_clks[MSTP1028]), 383 CLKDEV_ICK_ID("src.3", "rcar_sound", &mstp_clks[MSTP1028]),
388 CLKDEV_ICK_ID("scu.4", "rcar_sound", &mstp_clks[MSTP1027]), 384 CLKDEV_ICK_ID("src.4", "rcar_sound", &mstp_clks[MSTP1027]),
389 CLKDEV_ICK_ID("scu.5", "rcar_sound", &mstp_clks[MSTP1026]), 385 CLKDEV_ICK_ID("src.5", "rcar_sound", &mstp_clks[MSTP1026]),
390 CLKDEV_ICK_ID("scu.6", "rcar_sound", &mstp_clks[MSTP1025]), 386 CLKDEV_ICK_ID("src.6", "rcar_sound", &mstp_clks[MSTP1025]),
391 CLKDEV_ICK_ID("scu.7", "rcar_sound", &mstp_clks[MSTP1024]), 387 CLKDEV_ICK_ID("src.7", "rcar_sound", &mstp_clks[MSTP1024]),
392 CLKDEV_ICK_ID("scu.8", "rcar_sound", &mstp_clks[MSTP1023]), 388 CLKDEV_ICK_ID("src.8", "rcar_sound", &mstp_clks[MSTP1023]),
393 CLKDEV_ICK_ID("scu.9", "rcar_sound", &mstp_clks[MSTP1022]), 389 CLKDEV_ICK_ID("src.9", "rcar_sound", &mstp_clks[MSTP1022]),
394 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP1015]), 390 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP1015]),
395 CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP1014]), 391 CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP1014]),
396 CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP1013]), 392 CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP1013]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
index 701383fe3267..e2fdfcc14436 100644
--- a/arch/arm/mach-shmobile/clock-r8a7791.c
+++ b/arch/arm/mach-shmobile/clock-r8a7791.c
@@ -25,6 +25,7 @@
25#include <linux/clkdev.h> 25#include <linux/clkdev.h>
26#include <mach/clock.h> 26#include <mach/clock.h>
27#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/rcar-gen2.h>
28 29
29/* 30/*
30 * MD EXTAL PLL0 PLL1 PLL3 31 * MD EXTAL PLL0 PLL1 PLL3
@@ -43,8 +44,6 @@
43 * see "p1 / 2" on R8A7791_CLOCK_ROOT() below 44 * see "p1 / 2" on R8A7791_CLOCK_ROOT() below
44 */ 45 */
45 46
46#define MD(nr) (1 << nr)
47
48#define CPG_BASE 0xe6150000 47#define CPG_BASE 0xe6150000
49#define CPG_LEN 0x1000 48#define CPG_LEN 0x1000
50 49
@@ -68,7 +67,6 @@
68#define MSTPSR9 IOMEM(0xe61509a4) 67#define MSTPSR9 IOMEM(0xe61509a4)
69#define MSTPSR11 IOMEM(0xe61509ac) 68#define MSTPSR11 IOMEM(0xe61509ac)
70 69
71#define MODEMR 0xE6160060
72#define SDCKCR 0xE6150074 70#define SDCKCR 0xE6150074
73#define SD1CKCR 0xE6150078 71#define SD1CKCR 0xE6150078
74#define SD2CKCR 0xE615026c 72#define SD2CKCR 0xE615026c
@@ -190,12 +188,12 @@ static struct clk mstp_clks[MSTP_NR] = {
190 [MSTP1108] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 8, MSTPSR11, 0), /* SCIFA5 */ 188 [MSTP1108] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 8, MSTPSR11, 0), /* SCIFA5 */
191 [MSTP1107] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 7, MSTPSR11, 0), /* SCIFA4 */ 189 [MSTP1107] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 7, MSTPSR11, 0), /* SCIFA4 */
192 [MSTP1106] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 6, MSTPSR11, 0), /* SCIFA3 */ 190 [MSTP1106] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 6, MSTPSR11, 0), /* SCIFA3 */
193 [MSTP931] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 31, MSTPSR9, 0), /* I2C0 */ 191 [MSTP931] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 31, MSTPSR9, 0), /* I2C0 */
194 [MSTP930] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 30, MSTPSR9, 0), /* I2C1 */ 192 [MSTP930] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 30, MSTPSR9, 0), /* I2C1 */
195 [MSTP929] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 29, MSTPSR9, 0), /* I2C2 */ 193 [MSTP929] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 29, MSTPSR9, 0), /* I2C2 */
196 [MSTP928] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 28, MSTPSR9, 0), /* I2C3 */ 194 [MSTP928] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 28, MSTPSR9, 0), /* I2C3 */
197 [MSTP927] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 27, MSTPSR9, 0), /* I2C4 */ 195 [MSTP927] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 27, MSTPSR9, 0), /* I2C4 */
198 [MSTP925] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 25, MSTPSR9, 0), /* I2C5 */ 196 [MSTP925] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 25, MSTPSR9, 0), /* I2C5 */
199 [MSTP917] = SH_CLK_MSTP32_STS(&qspi_clk, SMSTPCR9, 17, MSTPSR9, 0), /* QSPI */ 197 [MSTP917] = SH_CLK_MSTP32_STS(&qspi_clk, SMSTPCR9, 17, MSTPSR9, 0), /* QSPI */
200 [MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */ 198 [MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */
201 [MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */ 199 [MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */
@@ -266,7 +264,7 @@ static struct clk_lookup lookups[] = {
266 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 264 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
267 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP312]), 265 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP312]),
268 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), 266 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]),
269 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), 267 CLKDEV_ICK_ID("fck", "sh-cmt-48-gen2.0", &mstp_clks[MSTP124]),
270 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]), 268 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]),
271 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 269 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
272 CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]), 270 CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]),
@@ -295,14 +293,9 @@ static struct clk_lookup lookups[] = {
295 293
296void __init r8a7791_clock_init(void) 294void __init r8a7791_clock_init(void)
297{ 295{
298 void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE); 296 u32 mode = rcar_gen2_read_mode_pins();
299 u32 mode;
300 int k, ret = 0; 297 int k, ret = 0;
301 298
302 BUG_ON(!modemr);
303 mode = ioread32(modemr);
304 iounmap(modemr);
305
306 switch (mode & (MD(14) | MD(13))) { 299 switch (mode & (MD(14) | MD(13))) {
307 case 0: 300 case 0:
308 R8A7791_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88); 301 R8A7791_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88);
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 28489978b09c..d16d9ca7f79e 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -515,8 +515,6 @@ static struct clk_lookup lookups[] = {
515 CLKDEV_DEV_ID("uio_pdrv_genirq.1", &mstp_clks[MSTP128]), /* VEU0 */ 515 CLKDEV_DEV_ID("uio_pdrv_genirq.1", &mstp_clks[MSTP128]), /* VEU0 */
516 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU */ 516 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU */
517 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2 */ 517 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2 */
518 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */
519 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */
520 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX0 */ 518 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX0 */
521 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */ 519 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */
522 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */ 520 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */
@@ -565,10 +563,7 @@ static struct clk_lookup lookups[] = {
565 CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */ 563 CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */
566 CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */ 564 CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */
567 CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[MSTP406]), /* USB1 */ 565 CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[MSTP406]), /* USB1 */
568 CLKDEV_DEV_ID("sh_cmt.4", &mstp_clks[MSTP405]), /* CMT4 */
569 CLKDEV_DEV_ID("sh_cmt.3", &mstp_clks[MSTP404]), /* CMT3 */
570 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ 566 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
571 CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */
572 567
573 /* ICK */ 568 /* ICK */
574 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 569 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
@@ -580,7 +575,11 @@ static struct clk_lookup lookups[] = {
580 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]), 575 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
581 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]), 576 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]),
582 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]), 577 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]),
578 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]), /* TMU0 */
583 CLKDEV_ICK_ID("spu2", "sh_fsi2", &mstp_clks[MSTP223]), 579 CLKDEV_ICK_ID("spu2", "sh_fsi2", &mstp_clks[MSTP223]),
580 CLKDEV_ICK_ID("fck", "sh-cmt-32-fast.4", &mstp_clks[MSTP405]), /* CMT4 */
581 CLKDEV_ICK_ID("fck", "sh-cmt-32-fast.3", &mstp_clks[MSTP404]), /* CMT3 */
582 CLKDEV_ICK_ID("fck", "sh-cmt-32-fast.2", &mstp_clks[MSTP400]), /* CMT2 */
584 CLKDEV_ICK_ID("diva", "sh_fsi2", &fsidivs[FSIDIV_A]), 583 CLKDEV_ICK_ID("diva", "sh_fsi2", &fsidivs[FSIDIV_A]),
585 CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]), 584 CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]),
586 CLKDEV_ICK_ID("xcka", "sh_fsi2", &fsiack_clk), 585 CLKDEV_ICK_ID("xcka", "sh_fsi2", &fsiack_clk),
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 23edf8360c27..0d9cd1fe0212 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -633,8 +633,6 @@ static struct clk_lookup lookups[] = {
633 CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */ 633 CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */
634 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */ 634 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */
635 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2-RX0 */ 635 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2-RX0 */
636 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */
637 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */
638 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ 636 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */
639 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ 637 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */
640 CLKDEV_DEV_ID("e6820000.i2c", &mstp_clks[MSTP116]), /* I2C0 */ 638 CLKDEV_DEV_ID("e6820000.i2c", &mstp_clks[MSTP116]), /* I2C0 */
@@ -650,7 +648,6 @@ static struct clk_lookup lookups[] = {
650 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */ 648 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
651 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ 649 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
652 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ 650 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
653 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
654 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */ 651 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */
655 CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */ 652 CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */
656 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ 653 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */
@@ -683,6 +680,8 @@ static struct clk_lookup lookups[] = {
683 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), 680 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
684 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk), 681 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
685 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk), 682 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
683 CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]), /* CMT1 */
684 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]), /* TMU0 */
686}; 685};
687 686
688void __init sh73a0_clock_init(void) 687void __init sh73a0_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index ad7df629d995..e7232a0373b9 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -21,6 +21,32 @@
21 */ 21 */
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/init.h> 23#include <linux/init.h>
24
25#ifdef CONFIG_COMMON_CLK
26#include <linux/clk.h>
27#include <linux/clkdev.h>
28#include <mach/clock.h>
29
30void __init shmobile_clk_workaround(const struct clk_name *clks,
31 int nr_clks, bool enable)
32{
33 const struct clk_name *clkn;
34 struct clk *clk;
35 unsigned int i;
36
37 for (i = 0; i < nr_clks; ++i) {
38 clkn = clks + i;
39 clk = clk_get(NULL, clkn->clk);
40 if (!IS_ERR(clk)) {
41 clk_register_clkdev(clk, clkn->con_id, clkn->dev_id);
42 if (enable)
43 clk_prepare_enable(clk);
44 clk_put(clk);
45 }
46 }
47}
48
49#else /* CONFIG_COMMON_CLK */
24#include <linux/sh_clk.h> 50#include <linux/sh_clk.h>
25#include <linux/export.h> 51#include <linux/export.h>
26#include <mach/clock.h> 52#include <mach/clock.h>
@@ -58,3 +84,5 @@ void __clk_put(struct clk *clk)
58{ 84{
59} 85}
60EXPORT_SYMBOL(__clk_put); 86EXPORT_SYMBOL(__clk_put);
87
88#endif /* CONFIG_COMMON_CLK */
diff --git a/arch/arm/mach-shmobile/include/mach/clock.h b/arch/arm/mach-shmobile/include/mach/clock.h
index 03e56074928c..31b6417463e6 100644
--- a/arch/arm/mach-shmobile/include/mach/clock.h
+++ b/arch/arm/mach-shmobile/include/mach/clock.h
@@ -1,6 +1,22 @@
1#ifndef CLOCK_H 1#ifndef CLOCK_H
2#define CLOCK_H 2#define CLOCK_H
3 3
4#ifdef CONFIG_COMMON_CLK
5/* temporary clock configuration helper for platform devices */
6
7struct clk_name {
8 const char *clk;
9 const char *con_id;
10 const char *dev_id;
11};
12
13void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks,
14 bool enable);
15
16#else /* CONFIG_COMMON_CLK */
17/* legacy clock implementation */
18
19struct clk;
4unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk); 20unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
5extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops; 21extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
6 22
@@ -36,4 +52,5 @@ do { \
36 (p)->div = d; \ 52 (p)->div = d; \
37} while (0) 53} while (0)
38 54
55#endif /* CONFIG_COMMON_CLK */
39#endif 56#endif
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index cb8e32deb2a3..f7a360edcc35 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -4,6 +4,7 @@
4extern void shmobile_earlytimer_init(void); 4extern void shmobile_earlytimer_init(void);
5extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz, 5extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
6 unsigned int mult, unsigned int div); 6 unsigned int mult, unsigned int div);
7extern void shmobile_init_delay(void);
7struct twd_local_timer; 8struct twd_local_timer;
8extern void shmobile_setup_console(void); 9extern void shmobile_setup_console(void);
9extern void shmobile_boot_vector(void); 10extern void shmobile_boot_vector(void);
diff --git a/arch/arm/mach-shmobile/include/mach/emev2.h b/arch/arm/mach-shmobile/include/mach/emev2.h
deleted file mode 100644
index fcb142a14e07..000000000000
--- a/arch/arm/mach-shmobile/include/mach/emev2.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_EMEV2_H__
2#define __ASM_EMEV2_H__
3
4extern void emev2_map_io(void);
5extern void emev2_init_delay(void);
6extern void emev2_clock_init(void);
7extern struct smp_operations emev2_smp_ops;
8
9#endif /* __ASM_EMEV2_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h
index d07932f872b6..5e3c9ec06303 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7740.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h
@@ -47,7 +47,6 @@ enum {
47}; 47};
48 48
49extern void r8a7740_meram_workaround(void); 49extern void r8a7740_meram_workaround(void);
50extern void r8a7740_init_delay(void);
51extern void r8a7740_init_irq_of(void); 50extern void r8a7740_init_irq_of(void);
52extern void r8a7740_map_io(void); 51extern void r8a7740_map_io(void);
53extern void r8a7740_add_early_devices(void); 52extern void r8a7740_add_early_devices(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/include/mach/r8a7791.h
index 200fa699f730..664274cc4b64 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7791.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7791.h
@@ -5,7 +5,6 @@ void r8a7791_add_standard_devices(void);
5void r8a7791_add_dt_devices(void); 5void r8a7791_add_dt_devices(void);
6void r8a7791_clock_init(void); 6void r8a7791_clock_init(void);
7void r8a7791_pinmux_init(void); 7void r8a7791_pinmux_init(void);
8void r8a7791_init_early(void);
9extern struct smp_operations r8a7791_smp_ops; 8extern struct smp_operations r8a7791_smp_ops;
10 9
11#endif /* __ASM_R8A7791_H__ */ 10#endif /* __ASM_R8A7791_H__ */
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 1fc05d9453d0..f710235aff2f 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -99,39 +99,7 @@ static int rmobile_pd_power_up(struct generic_pm_domain *genpd)
99 99
100static bool rmobile_pd_active_wakeup(struct device *dev) 100static bool rmobile_pd_active_wakeup(struct device *dev)
101{ 101{
102 bool (*active_wakeup)(struct device *dev); 102 return true;
103
104 active_wakeup = dev_gpd_data(dev)->ops.active_wakeup;
105 return active_wakeup ? active_wakeup(dev) : true;
106}
107
108static int rmobile_pd_stop_dev(struct device *dev)
109{
110 int (*stop)(struct device *dev);
111
112 stop = dev_gpd_data(dev)->ops.stop;
113 if (stop) {
114 int ret = stop(dev);
115 if (ret)
116 return ret;
117 }
118 return pm_clk_suspend(dev);
119}
120
121static int rmobile_pd_start_dev(struct device *dev)
122{
123 int (*start)(struct device *dev);
124 int ret;
125
126 ret = pm_clk_resume(dev);
127 if (ret)
128 return ret;
129
130 start = dev_gpd_data(dev)->ops.start;
131 if (start)
132 ret = start(dev);
133
134 return ret;
135} 103}
136 104
137static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) 105static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
@@ -140,8 +108,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
140 struct dev_power_governor *gov = rmobile_pd->gov; 108 struct dev_power_governor *gov = rmobile_pd->gov;
141 109
142 pm_genpd_init(genpd, gov ? : &simple_qos_governor, false); 110 pm_genpd_init(genpd, gov ? : &simple_qos_governor, false);
143 genpd->dev_ops.stop = rmobile_pd_stop_dev; 111 genpd->dev_ops.stop = pm_clk_suspend;
144 genpd->dev_ops.start = rmobile_pd_start_dev; 112 genpd->dev_ops.start = pm_clk_resume;
145 genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; 113 genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup;
146 genpd->dev_irq_safe = true; 114 genpd->dev_irq_safe = true;
147 genpd->power_off = rmobile_pd_power_down; 115 genpd->power_off = rmobile_pd_power_down;
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index c71d667007b8..d953ff6e78a2 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -21,7 +21,6 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <mach/common.h> 23#include <mach/common.h>
24#include <mach/emev2.h>
25#include <asm/mach-types.h> 24#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 26#include <asm/mach/map.h>
@@ -38,23 +37,19 @@ static struct map_desc emev2_io_desc[] __initdata = {
38#endif 37#endif
39}; 38};
40 39
41void __init emev2_map_io(void) 40static void __init emev2_map_io(void)
42{ 41{
43 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc)); 42 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
44} 43}
45 44
46void __init emev2_init_delay(void) 45static void __init emev2_init_delay(void)
47{ 46{
48 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */ 47 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
49} 48}
50 49
51static void __init emev2_add_standard_devices_dt(void) 50static void __init emev2_add_standard_devices_dt(void)
52{ 51{
53#ifdef CONFIG_COMMON_CLK
54 of_clk_init(NULL); 52 of_clk_init(NULL);
55#else
56 emev2_clock_init();
57#endif
58 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 53 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
59} 54}
60 55
@@ -63,6 +58,8 @@ static const char *emev2_boards_compat_dt[] __initconst = {
63 NULL, 58 NULL,
64}; 59};
65 60
61extern struct smp_operations emev2_smp_ops;
62
66DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)") 63DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
67 .smp = smp_ops(emev2_smp_ops), 64 .smp = smp_ops(emev2_smp_ops),
68 .map_io = emev2_map_io, 65 .map_io = emev2_map_io,
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
index 9c0b3a9d5f7a..412e179429cd 100644
--- a/arch/arm/mach-shmobile/setup-r7s72100.c
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -21,77 +21,26 @@
21#include <linux/irq.h> 21#include <linux/irq.h>
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/serial_sci.h>
25#include <linux/sh_timer.h> 24#include <linux/sh_timer.h>
26#include <mach/common.h> 25#include <mach/common.h>
27#include <mach/irqs.h> 26#include <mach/irqs.h>
28#include <mach/r7s72100.h> 27#include <mach/r7s72100.h>
29#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
30 29
31#define R7S72100_SCIF(index, baseaddr, irq) \ 30static struct resource mtu2_resources[] __initdata = {
32static const struct plat_sci_port scif##index##_platform_data = { \ 31 DEFINE_RES_MEM(0xfcff0000, 0x400),
33 .type = PORT_SCIF, \ 32 DEFINE_RES_IRQ_NAMED(gic_iid(139), "tgi0a"),
34 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, \
35 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
36 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | \
37 SCSCR_REIE, \
38}; \
39 \
40static struct resource scif##index##_resources[] = { \
41 DEFINE_RES_MEM(baseaddr, 0x100), \
42 DEFINE_RES_IRQ(irq + 1), \
43 DEFINE_RES_IRQ(irq + 2), \
44 DEFINE_RES_IRQ(irq + 3), \
45 DEFINE_RES_IRQ(irq), \
46} \
47
48R7S72100_SCIF(0, 0xe8007000, gic_iid(221));
49R7S72100_SCIF(1, 0xe8007800, gic_iid(225));
50R7S72100_SCIF(2, 0xe8008000, gic_iid(229));
51R7S72100_SCIF(3, 0xe8008800, gic_iid(233));
52R7S72100_SCIF(4, 0xe8009000, gic_iid(237));
53R7S72100_SCIF(5, 0xe8009800, gic_iid(241));
54R7S72100_SCIF(6, 0xe800a000, gic_iid(245));
55R7S72100_SCIF(7, 0xe800a800, gic_iid(249));
56
57#define r7s72100_register_scif(index) \
58 platform_device_register_resndata(&platform_bus, "sh-sci", index, \
59 scif##index##_resources, \
60 ARRAY_SIZE(scif##index##_resources), \
61 &scif##index##_platform_data, \
62 sizeof(scif##index##_platform_data))
63
64
65static struct sh_timer_config mtu2_0_platform_data __initdata = {
66 .name = "MTU2_0",
67 .timer_bit = 0,
68 .channel_offset = -0x80,
69 .clockevent_rating = 200,
70};
71
72static struct resource mtu2_0_resources[] __initdata = {
73 DEFINE_RES_MEM(0xfcff0300, 0x27),
74 DEFINE_RES_IRQ(gic_iid(139)), /* MTU2 TGI0A */
75}; 33};
76 34
77#define r7s72100_register_mtu2(idx) \ 35#define r7s72100_register_mtu2() \
78 platform_device_register_resndata(&platform_bus, "sh_mtu2", \ 36 platform_device_register_resndata(&platform_bus, "sh-mtu2", \
79 idx, mtu2_##idx##_resources, \ 37 -1, mtu2_resources, \
80 ARRAY_SIZE(mtu2_##idx##_resources), \ 38 ARRAY_SIZE(mtu2_resources), \
81 &mtu2_##idx##_platform_data, \ 39 NULL, 0)
82 sizeof(struct sh_timer_config))
83 40
84void __init r7s72100_add_dt_devices(void) 41void __init r7s72100_add_dt_devices(void)
85{ 42{
86 r7s72100_register_scif(0); 43 r7s72100_register_mtu2();
87 r7s72100_register_scif(1);
88 r7s72100_register_scif(2);
89 r7s72100_register_scif(3);
90 r7s72100_register_scif(4);
91 r7s72100_register_scif(5);
92 r7s72100_register_scif(6);
93 r7s72100_register_scif(7);
94 r7s72100_register_mtu2(0);
95} 44}
96 45
97void __init r7s72100_init_early(void) 46void __init r7s72100_init_early(void)
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index cd36f8078325..9333770cfac2 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -169,20 +169,17 @@ static const struct resource thermal0_resources[] = {
169 thermal0_resources, \ 169 thermal0_resources, \
170 ARRAY_SIZE(thermal0_resources)) 170 ARRAY_SIZE(thermal0_resources))
171 171
172static struct sh_timer_config cmt10_platform_data = { 172static struct sh_timer_config cmt1_platform_data = {
173 .name = "CMT10", 173 .channels_mask = 0xff,
174 .timer_bit = 0,
175 .clockevent_rating = 80,
176}; 174};
177 175
178static struct resource cmt10_resources[] = { 176static struct resource cmt1_resources[] = {
179 DEFINE_RES_MEM(0xe6130010, 0x0c), 177 DEFINE_RES_MEM(0xe6130000, 0x1004),
180 DEFINE_RES_MEM(0xe6130000, 0x04), 178 DEFINE_RES_IRQ(gic_spi(120)),
181 DEFINE_RES_IRQ(gic_spi(120)), /* CMT1_0 */
182}; 179};
183 180
184#define r8a7790_register_cmt(idx) \ 181#define r8a7790_register_cmt(idx) \
185 platform_device_register_resndata(&platform_bus, "sh_cmt", \ 182 platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \
186 idx, cmt##idx##_resources, \ 183 idx, cmt##idx##_resources, \
187 ARRAY_SIZE(cmt##idx##_resources), \ 184 ARRAY_SIZE(cmt##idx##_resources), \
188 &cmt##idx##_platform_data, \ 185 &cmt##idx##_platform_data, \
@@ -196,7 +193,7 @@ void __init r8a73a4_add_dt_devices(void)
196 r8a73a4_register_scif(3); 193 r8a73a4_register_scif(3);
197 r8a73a4_register_scif(4); 194 r8a73a4_register_scif(4);
198 r8a73a4_register_scif(5); 195 r8a73a4_register_scif(5);
199 r8a7790_register_cmt(10); 196 r8a7790_register_cmt(1);
200} 197}
201 198
202/* DMA */ 199/* DMA */
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 8f3c68101d59..35dec233301e 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -237,126 +237,45 @@ R8A7740_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(107));
237R8A7740_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(108)); 237R8A7740_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(108));
238 238
239/* CMT */ 239/* CMT */
240static struct sh_timer_config cmt10_platform_data = { 240static struct sh_timer_config cmt1_platform_data = {
241 .name = "CMT10", 241 .channels_mask = 0x3f,
242 .channel_offset = 0x10,
243 .timer_bit = 0,
244 .clockevent_rating = 125,
245 .clocksource_rating = 125,
246}; 242};
247 243
248static struct resource cmt10_resources[] = { 244static struct resource cmt1_resources[] = {
249 [0] = { 245 DEFINE_RES_MEM(0xe6138000, 0x170),
250 .name = "CMT10", 246 DEFINE_RES_IRQ(gic_spi(58)),
251 .start = 0xe6138010,
252 .end = 0xe613801b,
253 .flags = IORESOURCE_MEM,
254 },
255 [1] = {
256 .start = gic_spi(58),
257 .flags = IORESOURCE_IRQ,
258 },
259}; 247};
260 248
261static struct platform_device cmt10_device = { 249static struct platform_device cmt1_device = {
262 .name = "sh_cmt", 250 .name = "sh-cmt-48",
263 .id = 10, 251 .id = 1,
264 .dev = { 252 .dev = {
265 .platform_data = &cmt10_platform_data, 253 .platform_data = &cmt1_platform_data,
266 }, 254 },
267 .resource = cmt10_resources, 255 .resource = cmt1_resources,
268 .num_resources = ARRAY_SIZE(cmt10_resources), 256 .num_resources = ARRAY_SIZE(cmt1_resources),
269}; 257};
270 258
271/* TMU */ 259/* TMU */
272static struct sh_timer_config tmu00_platform_data = { 260static struct sh_timer_config tmu0_platform_data = {
273 .name = "TMU00", 261 .channels_mask = 7,
274 .channel_offset = 0x4,
275 .timer_bit = 0,
276 .clockevent_rating = 200,
277}; 262};
278 263
279static struct resource tmu00_resources[] = { 264static struct resource tmu0_resources[] = {
280 [0] = { 265 DEFINE_RES_MEM(0xfff80000, 0x2c),
281 .name = "TMU00", 266 DEFINE_RES_IRQ(gic_spi(198)),
282 .start = 0xfff80008, 267 DEFINE_RES_IRQ(gic_spi(199)),
283 .end = 0xfff80014 - 1, 268 DEFINE_RES_IRQ(gic_spi(200)),
284 .flags = IORESOURCE_MEM,
285 },
286 [1] = {
287 .start = gic_spi(198),
288 .flags = IORESOURCE_IRQ,
289 },
290}; 269};
291 270
292static struct platform_device tmu00_device = { 271static struct platform_device tmu0_device = {
293 .name = "sh_tmu", 272 .name = "sh-tmu",
294 .id = 0, 273 .id = 0,
295 .dev = { 274 .dev = {
296 .platform_data = &tmu00_platform_data, 275 .platform_data = &tmu0_platform_data,
297 },
298 .resource = tmu00_resources,
299 .num_resources = ARRAY_SIZE(tmu00_resources),
300};
301
302static struct sh_timer_config tmu01_platform_data = {
303 .name = "TMU01",
304 .channel_offset = 0x10,
305 .timer_bit = 1,
306 .clocksource_rating = 200,
307};
308
309static struct resource tmu01_resources[] = {
310 [0] = {
311 .name = "TMU01",
312 .start = 0xfff80014,
313 .end = 0xfff80020 - 1,
314 .flags = IORESOURCE_MEM,
315 },
316 [1] = {
317 .start = gic_spi(199),
318 .flags = IORESOURCE_IRQ,
319 },
320};
321
322static struct platform_device tmu01_device = {
323 .name = "sh_tmu",
324 .id = 1,
325 .dev = {
326 .platform_data = &tmu01_platform_data,
327 }, 276 },
328 .resource = tmu01_resources, 277 .resource = tmu0_resources,
329 .num_resources = ARRAY_SIZE(tmu01_resources), 278 .num_resources = ARRAY_SIZE(tmu0_resources),
330};
331
332static struct sh_timer_config tmu02_platform_data = {
333 .name = "TMU02",
334 .channel_offset = 0x1C,
335 .timer_bit = 2,
336 .clocksource_rating = 200,
337};
338
339static struct resource tmu02_resources[] = {
340 [0] = {
341 .name = "TMU02",
342 .start = 0xfff80020,
343 .end = 0xfff8002C - 1,
344 .flags = IORESOURCE_MEM,
345 },
346 [1] = {
347 .start = gic_spi(200),
348 .flags = IORESOURCE_IRQ,
349 },
350};
351
352static struct platform_device tmu02_device = {
353 .name = "sh_tmu",
354 .id = 2,
355 .dev = {
356 .platform_data = &tmu02_platform_data,
357 },
358 .resource = tmu02_resources,
359 .num_resources = ARRAY_SIZE(tmu02_resources),
360}; 279};
361 280
362/* IPMMUI (an IPMMU module for ICB/LMB) */ 281/* IPMMUI (an IPMMU module for ICB/LMB) */
@@ -400,7 +319,7 @@ static struct platform_device *r8a7740_devices_dt[] __initdata = {
400 &scif6_device, 319 &scif6_device,
401 &scif7_device, 320 &scif7_device,
402 &scif8_device, 321 &scif8_device,
403 &cmt10_device, 322 &cmt1_device,
404}; 323};
405 324
406static struct platform_device *r8a7740_early_devices[] __initdata = { 325static struct platform_device *r8a7740_early_devices[] __initdata = {
@@ -408,9 +327,7 @@ static struct platform_device *r8a7740_early_devices[] __initdata = {
408 &irqpin1_device, 327 &irqpin1_device,
409 &irqpin2_device, 328 &irqpin2_device,
410 &irqpin3_device, 329 &irqpin3_device,
411 &tmu00_device, 330 &tmu0_device,
412 &tmu01_device,
413 &tmu02_device,
414 &ipmmu_device, 331 &ipmmu_device,
415}; 332};
416 333
@@ -765,7 +682,7 @@ static struct platform_device *r8a7740_late_devices[] __initdata = {
765 * "Media RAM (MERAM)" on r8a7740 documentation 682 * "Media RAM (MERAM)" on r8a7740 documentation
766 */ 683 */
767#define MEBUFCNTR 0xFE950098 684#define MEBUFCNTR 0xFE950098
768void r8a7740_meram_workaround(void) 685void __init r8a7740_meram_workaround(void)
769{ 686{
770 void __iomem *reg; 687 void __iomem *reg;
771 688
@@ -869,17 +786,6 @@ void __init r8a7740_add_early_devices(void)
869 786
870#ifdef CONFIG_USE_OF 787#ifdef CONFIG_USE_OF
871 788
872void __init r8a7740_add_early_devices_dt(void)
873{
874 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
875
876 early_platform_add_devices(r8a7740_early_devices,
877 ARRAY_SIZE(r8a7740_early_devices));
878
879 /* setup early console here as well */
880 shmobile_setup_console();
881}
882
883void __init r8a7740_add_standard_devices_dt(void) 789void __init r8a7740_add_standard_devices_dt(void)
884{ 790{
885 platform_add_devices(r8a7740_devices_dt, 791 platform_add_devices(r8a7740_devices_dt,
@@ -887,11 +793,6 @@ void __init r8a7740_add_standard_devices_dt(void)
887 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 793 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
888} 794}
889 795
890void __init r8a7740_init_delay(void)
891{
892 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
893};
894
895void __init r8a7740_init_irq_of(void) 796void __init r8a7740_init_irq_of(void)
896{ 797{
897 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10); 798 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
@@ -935,9 +836,10 @@ static const char *r8a7740_boards_compat_dt[] __initdata = {
935 836
936DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)") 837DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
937 .map_io = r8a7740_map_io, 838 .map_io = r8a7740_map_io,
938 .init_early = r8a7740_init_delay, 839 .init_early = shmobile_init_delay,
939 .init_irq = r8a7740_init_irq_of, 840 .init_irq = r8a7740_init_irq_of,
940 .init_machine = r8a7740_generic_init, 841 .init_machine = r8a7740_generic_init,
842 .init_late = shmobile_init_late,
941 .dt_compat = r8a7740_boards_compat_dt, 843 .dt_compat = r8a7740_boards_compat_dt,
942MACHINE_END 844MACHINE_END
943 845
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 6d694526e4ca..8c02e24f2483 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -71,33 +71,20 @@ R8A7778_SCIF(5, 0xffe45000, gic_iid(0x6b));
71 sizeof(scif##index##_platform_data)) 71 sizeof(scif##index##_platform_data))
72 72
73/* TMU */ 73/* TMU */
74static struct resource sh_tmu0_resources[] __initdata = { 74static struct sh_timer_config sh_tmu0_platform_data = {
75 DEFINE_RES_MEM(0xffd80008, 12), 75 .channels_mask = 7,
76 DEFINE_RES_IRQ(gic_iid(0x40)),
77};
78
79static struct sh_timer_config sh_tmu0_platform_data __initdata = {
80 .name = "TMU00",
81 .channel_offset = 0x4,
82 .timer_bit = 0,
83 .clockevent_rating = 200,
84}; 76};
85 77
86static struct resource sh_tmu1_resources[] __initdata = { 78static struct resource sh_tmu0_resources[] = {
87 DEFINE_RES_MEM(0xffd80014, 12), 79 DEFINE_RES_MEM(0xffd80000, 0x30),
80 DEFINE_RES_IRQ(gic_iid(0x40)),
88 DEFINE_RES_IRQ(gic_iid(0x41)), 81 DEFINE_RES_IRQ(gic_iid(0x41)),
89}; 82 DEFINE_RES_IRQ(gic_iid(0x42)),
90
91static struct sh_timer_config sh_tmu1_platform_data __initdata = {
92 .name = "TMU01",
93 .channel_offset = 0x10,
94 .timer_bit = 1,
95 .clocksource_rating = 200,
96}; 83};
97 84
98#define r8a7778_register_tmu(idx) \ 85#define r8a7778_register_tmu(idx) \
99 platform_device_register_resndata( \ 86 platform_device_register_resndata( \
100 &platform_bus, "sh_tmu", idx, \ 87 &platform_bus, "sh-tmu", idx, \
101 sh_tmu##idx##_resources, \ 88 sh_tmu##idx##_resources, \
102 ARRAY_SIZE(sh_tmu##idx##_resources), \ 89 ARRAY_SIZE(sh_tmu##idx##_resources), \
103 &sh_tmu##idx##_platform_data, \ 90 &sh_tmu##idx##_platform_data, \
@@ -312,7 +299,6 @@ void __init r8a7778_add_dt_devices(void)
312 r8a7778_register_scif(4); 299 r8a7778_register_scif(4);
313 r8a7778_register_scif(5); 300 r8a7778_register_scif(5);
314 r8a7778_register_tmu(0); 301 r8a7778_register_tmu(0);
315 r8a7778_register_tmu(1);
316} 302}
317 303
318/* HPB-DMA */ 304/* HPB-DMA */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 8e860b36997a..d197b5adc886 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -219,64 +219,25 @@ R8A7779_SCIF(4, 0xffe44000, gic_iid(0x7c));
219R8A7779_SCIF(5, 0xffe45000, gic_iid(0x7d)); 219R8A7779_SCIF(5, 0xffe45000, gic_iid(0x7d));
220 220
221/* TMU */ 221/* TMU */
222static struct sh_timer_config tmu00_platform_data = { 222static struct sh_timer_config tmu0_platform_data = {
223 .name = "TMU00", 223 .channels_mask = 7,
224 .channel_offset = 0x4,
225 .timer_bit = 0,
226 .clockevent_rating = 200,
227}; 224};
228 225
229static struct resource tmu00_resources[] = { 226static struct resource tmu0_resources[] = {
230 [0] = { 227 DEFINE_RES_MEM(0xffd80000, 0x30),
231 .name = "TMU00", 228 DEFINE_RES_IRQ(gic_iid(0x40)),
232 .start = 0xffd80008, 229 DEFINE_RES_IRQ(gic_iid(0x41)),
233 .end = 0xffd80013, 230 DEFINE_RES_IRQ(gic_iid(0x42)),
234 .flags = IORESOURCE_MEM,
235 },
236 [1] = {
237 .start = gic_iid(0x40),
238 .flags = IORESOURCE_IRQ,
239 },
240}; 231};
241 232
242static struct platform_device tmu00_device = { 233static struct platform_device tmu0_device = {
243 .name = "sh_tmu", 234 .name = "sh-tmu",
244 .id = 0, 235 .id = 0,
245 .dev = { 236 .dev = {
246 .platform_data = &tmu00_platform_data, 237 .platform_data = &tmu0_platform_data,
247 },
248 .resource = tmu00_resources,
249 .num_resources = ARRAY_SIZE(tmu00_resources),
250};
251
252static struct sh_timer_config tmu01_platform_data = {
253 .name = "TMU01",
254 .channel_offset = 0x10,
255 .timer_bit = 1,
256 .clocksource_rating = 200,
257};
258
259static struct resource tmu01_resources[] = {
260 [0] = {
261 .name = "TMU01",
262 .start = 0xffd80014,
263 .end = 0xffd8001f,
264 .flags = IORESOURCE_MEM,
265 },
266 [1] = {
267 .start = gic_iid(0x41),
268 .flags = IORESOURCE_IRQ,
269 },
270};
271
272static struct platform_device tmu01_device = {
273 .name = "sh_tmu",
274 .id = 1,
275 .dev = {
276 .platform_data = &tmu01_platform_data,
277 }, 238 },
278 .resource = tmu01_resources, 239 .resource = tmu0_resources,
279 .num_resources = ARRAY_SIZE(tmu01_resources), 240 .num_resources = ARRAY_SIZE(tmu0_resources),
280}; 241};
281 242
282/* I2C */ 243/* I2C */
@@ -685,8 +646,7 @@ static struct platform_device *r8a7779_devices_dt[] __initdata = {
685 &scif3_device, 646 &scif3_device,
686 &scif4_device, 647 &scif4_device,
687 &scif5_device, 648 &scif5_device,
688 &tmu00_device, 649 &tmu0_device,
689 &tmu01_device,
690}; 650};
691 651
692static struct platform_device *r8a7779_standard_devices[] __initdata = { 652static struct platform_device *r8a7779_standard_devices[] __initdata = {
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index c4616f0698c6..6bd08b127fa4 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -185,12 +185,6 @@ void __init r8a7790_pinmux_init(void)
185 r8a7790_register_gpio(3); 185 r8a7790_register_gpio(3);
186 r8a7790_register_gpio(4); 186 r8a7790_register_gpio(4);
187 r8a7790_register_gpio(5); 187 r8a7790_register_gpio(5);
188 r8a7790_register_i2c(0);
189 r8a7790_register_i2c(1);
190 r8a7790_register_i2c(2);
191 r8a7790_register_i2c(3);
192 r8a7790_register_audio_dmac(0);
193 r8a7790_register_audio_dmac(1);
194} 188}
195 189
196#define __R8A7790_SCIF(scif_type, _scscr, index, baseaddr, irq) \ 190#define __R8A7790_SCIF(scif_type, _scscr, index, baseaddr, irq) \
@@ -269,20 +263,17 @@ static const struct resource thermal_resources[] __initconst = {
269 thermal_resources, \ 263 thermal_resources, \
270 ARRAY_SIZE(thermal_resources)) 264 ARRAY_SIZE(thermal_resources))
271 265
272static const struct sh_timer_config cmt00_platform_data __initconst = { 266static struct sh_timer_config cmt0_platform_data = {
273 .name = "CMT00", 267 .channels_mask = 0x60,
274 .timer_bit = 0,
275 .clockevent_rating = 80,
276}; 268};
277 269
278static const struct resource cmt00_resources[] __initconst = { 270static struct resource cmt0_resources[] = {
279 DEFINE_RES_MEM(0xffca0510, 0x0c), 271 DEFINE_RES_MEM(0xffca0000, 0x1004),
280 DEFINE_RES_MEM(0xffca0500, 0x04), 272 DEFINE_RES_IRQ(gic_spi(142)),
281 DEFINE_RES_IRQ(gic_spi(142)), /* CMT0_0 */
282}; 273};
283 274
284#define r8a7790_register_cmt(idx) \ 275#define r8a7790_register_cmt(idx) \
285 platform_device_register_resndata(&platform_bus, "sh_cmt", \ 276 platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \
286 idx, cmt##idx##_resources, \ 277 idx, cmt##idx##_resources, \
287 ARRAY_SIZE(cmt##idx##_resources), \ 278 ARRAY_SIZE(cmt##idx##_resources), \
288 &cmt##idx##_platform_data, \ 279 &cmt##idx##_platform_data, \
@@ -290,6 +281,11 @@ static const struct resource cmt00_resources[] __initconst = {
290 281
291void __init r8a7790_add_dt_devices(void) 282void __init r8a7790_add_dt_devices(void)
292{ 283{
284 r8a7790_register_cmt(0);
285}
286
287void __init r8a7790_add_standard_devices(void)
288{
293 r8a7790_register_scif(0); 289 r8a7790_register_scif(0);
294 r8a7790_register_scif(1); 290 r8a7790_register_scif(1);
295 r8a7790_register_scif(2); 291 r8a7790_register_scif(2);
@@ -300,14 +296,15 @@ void __init r8a7790_add_dt_devices(void)
300 r8a7790_register_scif(7); 296 r8a7790_register_scif(7);
301 r8a7790_register_scif(8); 297 r8a7790_register_scif(8);
302 r8a7790_register_scif(9); 298 r8a7790_register_scif(9);
303 r8a7790_register_cmt(00);
304}
305
306void __init r8a7790_add_standard_devices(void)
307{
308 r8a7790_add_dt_devices(); 299 r8a7790_add_dt_devices();
309 r8a7790_register_irqc(0); 300 r8a7790_register_irqc(0);
310 r8a7790_register_thermal(); 301 r8a7790_register_thermal();
302 r8a7790_register_i2c(0);
303 r8a7790_register_i2c(1);
304 r8a7790_register_i2c(2);
305 r8a7790_register_i2c(3);
306 r8a7790_register_audio_dmac(0);
307 r8a7790_register_audio_dmac(1);
311} 308}
312 309
313void __init r8a7790_init_early(void) 310void __init r8a7790_init_early(void)
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index e28404e43860..04a96ddb3224 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -128,20 +128,17 @@ R8A7791_SCIFA(14, 0xe6c80000, gic_spi(31)); /* SCIFA5 */
128 &scif##index##_platform_data, \ 128 &scif##index##_platform_data, \
129 sizeof(scif##index##_platform_data)) 129 sizeof(scif##index##_platform_data))
130 130
131static const struct sh_timer_config cmt00_platform_data __initconst = { 131static struct sh_timer_config cmt0_platform_data = {
132 .name = "CMT00", 132 .channels_mask = 0x60,
133 .timer_bit = 0,
134 .clockevent_rating = 80,
135}; 133};
136 134
137static const struct resource cmt00_resources[] __initconst = { 135static struct resource cmt0_resources[] = {
138 DEFINE_RES_MEM(0xffca0510, 0x0c), 136 DEFINE_RES_MEM(0xffca0000, 0x1004),
139 DEFINE_RES_MEM(0xffca0500, 0x04), 137 DEFINE_RES_IRQ(gic_spi(142)),
140 DEFINE_RES_IRQ(gic_spi(142)), /* CMT0_0 */
141}; 138};
142 139
143#define r8a7791_register_cmt(idx) \ 140#define r8a7791_register_cmt(idx) \
144 platform_device_register_resndata(&platform_bus, "sh_cmt", \ 141 platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \
145 idx, cmt##idx##_resources, \ 142 idx, cmt##idx##_resources, \
146 ARRAY_SIZE(cmt##idx##_resources), \ 143 ARRAY_SIZE(cmt##idx##_resources), \
147 &cmt##idx##_platform_data, \ 144 &cmt##idx##_platform_data, \
@@ -185,6 +182,11 @@ static const struct resource thermal_resources[] __initconst = {
185 182
186void __init r8a7791_add_dt_devices(void) 183void __init r8a7791_add_dt_devices(void)
187{ 184{
185 r8a7791_register_cmt(0);
186}
187
188void __init r8a7791_add_standard_devices(void)
189{
188 r8a7791_register_scif(0); 190 r8a7791_register_scif(0);
189 r8a7791_register_scif(1); 191 r8a7791_register_scif(1);
190 r8a7791_register_scif(2); 192 r8a7791_register_scif(2);
@@ -200,23 +202,11 @@ void __init r8a7791_add_dt_devices(void)
200 r8a7791_register_scif(12); 202 r8a7791_register_scif(12);
201 r8a7791_register_scif(13); 203 r8a7791_register_scif(13);
202 r8a7791_register_scif(14); 204 r8a7791_register_scif(14);
203 r8a7791_register_cmt(00);
204}
205
206void __init r8a7791_add_standard_devices(void)
207{
208 r8a7791_add_dt_devices(); 205 r8a7791_add_dt_devices();
209 r8a7791_register_irqc(0); 206 r8a7791_register_irqc(0);
210 r8a7791_register_thermal(); 207 r8a7791_register_thermal();
211} 208}
212 209
213void __init r8a7791_init_early(void)
214{
215#ifndef CONFIG_ARM_ARCH_TIMER
216 shmobile_setup_delay(1300, 2, 4); /* Cortex-A15 @ 1300MHz */
217#endif
218}
219
220#ifdef CONFIG_USE_OF 210#ifdef CONFIG_USE_OF
221static const char *r8a7791_boards_compat_dt[] __initdata = { 211static const char *r8a7791_boards_compat_dt[] __initdata = {
222 "renesas,r8a7791", 212 "renesas,r8a7791",
@@ -225,7 +215,7 @@ static const char *r8a7791_boards_compat_dt[] __initdata = {
225 215
226DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)") 216DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
227 .smp = smp_ops(r8a7791_smp_ops), 217 .smp = smp_ops(r8a7791_smp_ops),
228 .init_early = r8a7791_init_early, 218 .init_early = shmobile_init_delay,
229 .init_time = rcar_gen2_timer_init, 219 .init_time = rcar_gen2_timer_init,
230 .dt_compat = r8a7791_boards_compat_dt, 220 .dt_compat = r8a7791_boards_compat_dt,
231MACHINE_END 221MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 10604480f325..542c5a47173f 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -30,12 +30,16 @@
30 30
31u32 rcar_gen2_read_mode_pins(void) 31u32 rcar_gen2_read_mode_pins(void)
32{ 32{
33 void __iomem *modemr = ioremap_nocache(MODEMR, 4); 33 static u32 mode;
34 u32 mode; 34 static bool mode_valid;
35 35
36 BUG_ON(!modemr); 36 if (!mode_valid) {
37 mode = ioread32(modemr); 37 void __iomem *modemr = ioremap_nocache(MODEMR, 4);
38 iounmap(modemr); 38 BUG_ON(!modemr);
39 mode = ioread32(modemr);
40 iounmap(modemr);
41 mode_valid = true;
42 }
39 43
40 return mode; 44 return mode;
41} 45}
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 27301278c208..2a8b9f2a2f54 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -119,28 +119,16 @@ SH7372_SCIF(PORT_SCIFB, 6, 0xe6c30000, evt2irq(0x0d60));
119 119
120/* CMT */ 120/* CMT */
121static struct sh_timer_config cmt2_platform_data = { 121static struct sh_timer_config cmt2_platform_data = {
122 .name = "CMT2", 122 .channels_mask = 0x20,
123 .channel_offset = 0x40,
124 .timer_bit = 5,
125 .clockevent_rating = 125,
126 .clocksource_rating = 125,
127}; 123};
128 124
129static struct resource cmt2_resources[] = { 125static struct resource cmt2_resources[] = {
130 [0] = { 126 DEFINE_RES_MEM(0xe6130000, 0x50),
131 .name = "CMT2", 127 DEFINE_RES_IRQ(evt2irq(0x0b80)),
132 .start = 0xe6130040,
133 .end = 0xe613004b,
134 .flags = IORESOURCE_MEM,
135 },
136 [1] = {
137 .start = evt2irq(0x0b80), /* CMT2 */
138 .flags = IORESOURCE_IRQ,
139 },
140}; 128};
141 129
142static struct platform_device cmt2_device = { 130static struct platform_device cmt2_device = {
143 .name = "sh_cmt", 131 .name = "sh-cmt-32-fast",
144 .id = 2, 132 .id = 2,
145 .dev = { 133 .dev = {
146 .platform_data = &cmt2_platform_data, 134 .platform_data = &cmt2_platform_data,
@@ -150,64 +138,25 @@ static struct platform_device cmt2_device = {
150}; 138};
151 139
152/* TMU */ 140/* TMU */
153static struct sh_timer_config tmu00_platform_data = { 141static struct sh_timer_config tmu0_platform_data = {
154 .name = "TMU00", 142 .channels_mask = 7,
155 .channel_offset = 0x4,
156 .timer_bit = 0,
157 .clockevent_rating = 200,
158}; 143};
159 144
160static struct resource tmu00_resources[] = { 145static struct resource tmu0_resources[] = {
161 [0] = { 146 DEFINE_RES_MEM(0xfff60000, 0x2c),
162 .name = "TMU00", 147 DEFINE_RES_IRQ(intcs_evt2irq(0xe80)),
163 .start = 0xfff60008, 148 DEFINE_RES_IRQ(intcs_evt2irq(0xea0)),
164 .end = 0xfff60013, 149 DEFINE_RES_IRQ(intcs_evt2irq(0xec0)),
165 .flags = IORESOURCE_MEM,
166 },
167 [1] = {
168 .start = intcs_evt2irq(0xe80), /* TMU_TUNI0 */
169 .flags = IORESOURCE_IRQ,
170 },
171}; 150};
172 151
173static struct platform_device tmu00_device = { 152static struct platform_device tmu0_device = {
174 .name = "sh_tmu", 153 .name = "sh-tmu",
175 .id = 0, 154 .id = 0,
176 .dev = { 155 .dev = {
177 .platform_data = &tmu00_platform_data, 156 .platform_data = &tmu0_platform_data,
178 },
179 .resource = tmu00_resources,
180 .num_resources = ARRAY_SIZE(tmu00_resources),
181};
182
183static struct sh_timer_config tmu01_platform_data = {
184 .name = "TMU01",
185 .channel_offset = 0x10,
186 .timer_bit = 1,
187 .clocksource_rating = 200,
188};
189
190static struct resource tmu01_resources[] = {
191 [0] = {
192 .name = "TMU01",
193 .start = 0xfff60014,
194 .end = 0xfff6001f,
195 .flags = IORESOURCE_MEM,
196 },
197 [1] = {
198 .start = intcs_evt2irq(0xea0), /* TMU_TUNI1 */
199 .flags = IORESOURCE_IRQ,
200 },
201};
202
203static struct platform_device tmu01_device = {
204 .name = "sh_tmu",
205 .id = 1,
206 .dev = {
207 .platform_data = &tmu01_platform_data,
208 }, 157 },
209 .resource = tmu01_resources, 158 .resource = tmu0_resources,
210 .num_resources = ARRAY_SIZE(tmu01_resources), 159 .num_resources = ARRAY_SIZE(tmu0_resources),
211}; 160};
212 161
213/* I2C */ 162/* I2C */
@@ -952,8 +901,7 @@ static struct platform_device *sh7372_early_devices[] __initdata = {
952 &scif5_device, 901 &scif5_device,
953 &scif6_device, 902 &scif6_device,
954 &cmt2_device, 903 &cmt2_device,
955 &tmu00_device, 904 &tmu0_device,
956 &tmu01_device,
957 &ipmmu_device, 905 &ipmmu_device,
958}; 906};
959 907
@@ -1000,8 +948,7 @@ void __init sh7372_add_standard_devices(void)
1000 { "A4R", &veu2_device, }, 948 { "A4R", &veu2_device, },
1001 { "A4R", &veu3_device, }, 949 { "A4R", &veu3_device, },
1002 { "A4R", &jpu_device, }, 950 { "A4R", &jpu_device, },
1003 { "A4R", &tmu00_device, }, 951 { "A4R", &tmu0_device, },
1004 { "A4R", &tmu01_device, },
1005 }; 952 };
1006 953
1007 sh7372_init_pm_domains(); 954 sh7372_init_pm_domains();
@@ -1037,11 +984,7 @@ void __init sh7372_add_early_devices_dt(void)
1037{ 984{
1038 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */ 985 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
1039 986
1040 early_platform_add_devices(sh7372_early_devices, 987 sh7372_add_early_devices();
1041 ARRAY_SIZE(sh7372_early_devices));
1042
1043 /* setup early console here as well */
1044 shmobile_setup_console();
1045} 988}
1046 989
1047void __init sh7372_add_standard_devices_dt(void) 990void __init sh7372_add_standard_devices_dt(void)
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index f74ab530c71d..ad00724a2269 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -104,86 +104,45 @@ SH73A0_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(156));
104SH73A0_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(143)); 104SH73A0_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(143));
105SH73A0_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(80)); 105SH73A0_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(80));
106 106
107static struct sh_timer_config cmt10_platform_data = { 107static struct sh_timer_config cmt1_platform_data = {
108 .name = "CMT10", 108 .channels_mask = 0x3f,
109 .channel_offset = 0x10,
110 .timer_bit = 0,
111 .clockevent_rating = 80,
112 .clocksource_rating = 125,
113}; 109};
114 110
115static struct resource cmt10_resources[] = { 111static struct resource cmt1_resources[] = {
116 [0] = { 112 DEFINE_RES_MEM(0xe6138000, 0x200),
117 .name = "CMT10", 113 DEFINE_RES_IRQ(gic_spi(65)),
118 .start = 0xe6138010,
119 .end = 0xe613801b,
120 .flags = IORESOURCE_MEM,
121 },
122 [1] = {
123 .start = gic_spi(65),
124 .flags = IORESOURCE_IRQ,
125 },
126}; 114};
127 115
128static struct platform_device cmt10_device = { 116static struct platform_device cmt1_device = {
129 .name = "sh_cmt", 117 .name = "sh-cmt-48",
130 .id = 10, 118 .id = 1,
131 .dev = { 119 .dev = {
132 .platform_data = &cmt10_platform_data, 120 .platform_data = &cmt1_platform_data,
133 }, 121 },
134 .resource = cmt10_resources, 122 .resource = cmt1_resources,
135 .num_resources = ARRAY_SIZE(cmt10_resources), 123 .num_resources = ARRAY_SIZE(cmt1_resources),
136}; 124};
137 125
138/* TMU */ 126/* TMU */
139static struct sh_timer_config tmu00_platform_data = { 127static struct sh_timer_config tmu0_platform_data = {
140 .name = "TMU00", 128 .channels_mask = 7,
141 .channel_offset = 0x4,
142 .timer_bit = 0,
143 .clockevent_rating = 200,
144}; 129};
145 130
146static struct resource tmu00_resources[] = { 131static struct resource tmu0_resources[] = {
147 [0] = DEFINE_RES_MEM(0xfff60008, 0xc), 132 DEFINE_RES_MEM(0xfff60000, 0x2c),
148 [1] = { 133 DEFINE_RES_IRQ(intcs_evt2irq(0xe80)),
149 .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */ 134 DEFINE_RES_IRQ(intcs_evt2irq(0xea0)),
150 .flags = IORESOURCE_IRQ, 135 DEFINE_RES_IRQ(intcs_evt2irq(0xec0)),
151 },
152}; 136};
153 137
154static struct platform_device tmu00_device = { 138static struct platform_device tmu0_device = {
155 .name = "sh_tmu", 139 .name = "sh-tmu",
156 .id = 0, 140 .id = 0,
157 .dev = { 141 .dev = {
158 .platform_data = &tmu00_platform_data, 142 .platform_data = &tmu0_platform_data,
159 },
160 .resource = tmu00_resources,
161 .num_resources = ARRAY_SIZE(tmu00_resources),
162};
163
164static struct sh_timer_config tmu01_platform_data = {
165 .name = "TMU01",
166 .channel_offset = 0x10,
167 .timer_bit = 1,
168 .clocksource_rating = 200,
169};
170
171static struct resource tmu01_resources[] = {
172 [0] = DEFINE_RES_MEM(0xfff60014, 0xc),
173 [1] = {
174 .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
175 .flags = IORESOURCE_IRQ,
176 },
177};
178
179static struct platform_device tmu01_device = {
180 .name = "sh_tmu",
181 .id = 1,
182 .dev = {
183 .platform_data = &tmu01_platform_data,
184 }, 143 },
185 .resource = tmu01_resources, 144 .resource = tmu0_resources,
186 .num_resources = ARRAY_SIZE(tmu01_resources), 145 .num_resources = ARRAY_SIZE(tmu0_resources),
187}; 146};
188 147
189static struct resource i2c0_resources[] = { 148static struct resource i2c0_resources[] = {
@@ -746,12 +705,11 @@ static struct platform_device *sh73a0_devices_dt[] __initdata = {
746 &scif6_device, 705 &scif6_device,
747 &scif7_device, 706 &scif7_device,
748 &scif8_device, 707 &scif8_device,
749 &cmt10_device, 708 &cmt1_device,
750}; 709};
751 710
752static struct platform_device *sh73a0_early_devices[] __initdata = { 711static struct platform_device *sh73a0_early_devices[] __initdata = {
753 &tmu00_device, 712 &tmu0_device,
754 &tmu01_device,
755 &ipmmu_device, 713 &ipmmu_device,
756}; 714};
757 715
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index f2ca92308f75..2dfd748da7f3 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -24,7 +24,6 @@
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> 26#include <mach/common.h>
27#include <mach/emev2.h>
28#include <asm/smp_plat.h> 27#include <asm/smp_plat.h>
29#include <asm/smp_scu.h> 28#include <asm/smp_scu.h>
30 29
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
index 2df5bd190fe4..ec979529f30f 100644
--- a/arch/arm/mach-shmobile/smp-r8a7791.c
+++ b/arch/arm/mach-shmobile/smp-r8a7791.c
@@ -20,6 +20,7 @@
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21#include <mach/common.h> 21#include <mach/common.h>
22#include <mach/r8a7791.h> 22#include <mach/r8a7791.h>
23#include <mach/rcar-gen2.h>
23 24
24#define RST 0xe6160000 25#define RST 0xe6160000
25#define CA15BAR 0x0020 26#define CA15BAR 0x0020
@@ -51,9 +52,21 @@ static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
51 iounmap(p); 52 iounmap(p);
52} 53}
53 54
55static int r8a7791_smp_boot_secondary(unsigned int cpu,
56 struct task_struct *idle)
57{
58 /* Error out when hardware debug mode is enabled */
59 if (rcar_gen2_read_mode_pins() & BIT(21)) {
60 pr_warn("Unable to boot CPU%u when MD21 is set\n", cpu);
61 return -ENOTSUPP;
62 }
63
64 return shmobile_smp_apmu_boot_secondary(cpu, idle);
65}
66
54struct smp_operations r8a7791_smp_ops __initdata = { 67struct smp_operations r8a7791_smp_ops __initdata = {
55 .smp_prepare_cpus = r8a7791_smp_prepare_cpus, 68 .smp_prepare_cpus = r8a7791_smp_prepare_cpus,
56 .smp_boot_secondary = shmobile_smp_apmu_boot_secondary, 69 .smp_boot_secondary = r8a7791_smp_boot_secondary,
57#ifdef CONFIG_HOTPLUG_CPU 70#ifdef CONFIG_HOTPLUG_CPU
58 .cpu_disable = shmobile_smp_cpu_disable, 71 .cpu_disable = shmobile_smp_cpu_disable,
59 .cpu_die = shmobile_smp_apmu_cpu_die, 72 .cpu_die = shmobile_smp_apmu_cpu_die,
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 62d7052d6f21..68bc0b82226d 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -21,6 +21,24 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/clocksource.h> 22#include <linux/clocksource.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/of_address.h>
25
26void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz,
27 unsigned int mult, unsigned int div)
28{
29 /* calculate a worst-case loops-per-jiffy value
30 * based on maximum cpu core hz setting and the
31 * __delay() implementation in arch/arm/lib/delay.S
32 *
33 * this will result in a longer delay than expected
34 * when the cpu core runs on lower frequencies.
35 */
36
37 unsigned int value = HZ * div / mult;
38
39 if (!preset_lpj)
40 preset_lpj = max_cpu_core_hz / value;
41}
24 42
25void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, 43void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
26 unsigned int mult, unsigned int div) 44 unsigned int mult, unsigned int div)
@@ -39,6 +57,33 @@ void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
39 preset_lpj = max_cpu_core_mhz * value; 57 preset_lpj = max_cpu_core_mhz * value;
40} 58}
41 59
60void __init shmobile_init_delay(void)
61{
62 struct device_node *np, *parent;
63 u32 max_freq, freq;
64
65 max_freq = 0;
66
67 parent = of_find_node_by_path("/cpus");
68 if (parent) {
69 for_each_child_of_node(parent, np) {
70 if (!of_property_read_u32(np, "clock-frequency", &freq))
71 max_freq = max(max_freq, freq);
72 }
73 of_node_put(parent);
74 }
75
76 if (max_freq) {
77 if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
78 shmobile_setup_delay_hz(max_freq, 1, 3);
79 else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
80 shmobile_setup_delay_hz(max_freq, 1, 3);
81 else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15"))
82 if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
83 shmobile_setup_delay_hz(max_freq, 2, 4);
84 }
85}
86
42static void __init shmobile_late_time_init(void) 87static void __init shmobile_late_time_init(void)
43{ 88{
44 /* 89 /*
diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
index 1217fb598cfd..df731f2322fa 100644
--- a/arch/arm/mach-sti/board-dt.c
+++ b/arch/arm/mach-sti/board-dt.c
@@ -36,6 +36,7 @@ static void __init stih41x_machine_init(void)
36static const char *stih41x_dt_match[] __initdata = { 36static const char *stih41x_dt_match[] __initdata = {
37 "st,stih415", 37 "st,stih415",
38 "st,stih416", 38 "st,stih416",
39 "st,stih407",
39 NULL 40 NULL
40}; 41};
41 42
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index b57d7d53b9d3..0fbd4f156bfa 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1,14 +1,38 @@
1config ARCH_SUNXI 1menuconfig ARCH_SUNXI
2 bool "Allwinner A1X SOCs" if ARCH_MULTI_V7 2 bool "Allwinner SoCs" if ARCH_MULTI_V7
3 select ARCH_HAS_RESET_CONTROLLER
4 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
5 select ARM_GIC
6 select ARM_PSCI
7 select CLKSRC_MMIO 4 select CLKSRC_MMIO
8 select GENERIC_IRQ_CHIP 5 select GENERIC_IRQ_CHIP
9 select HAVE_ARM_ARCH_TIMER
10 select PINCTRL 6 select PINCTRL
11 select PINCTRL_SUNXI 7 select PINCTRL_SUNXI
12 select RESET_CONTROLLER
13 select SUN4I_TIMER 8 select SUN4I_TIMER
9
10if ARCH_SUNXI
11
12config MACH_SUN4I
13 bool "Allwinner A10 (sun4i) SoCs support"
14 default ARCH_SUNXI
15
16config MACH_SUN5I
17 bool "Allwinner A10s / A13 (sun5i) SoCs support"
18 default ARCH_SUNXI
19 select SUN5I_HSTIMER
20
21config MACH_SUN6I
22 bool "Allwinner A31 (sun6i) SoCs support"
23 default ARCH_SUNXI
24 select ARCH_HAS_RESET_CONTROLLER
25 select ARM_GIC
26 select MFD_SUN6I_PRCM
27 select RESET_CONTROLLER
28 select SUN5I_HSTIMER
29
30config MACH_SUN7I
31 bool "Allwinner A20 (sun7i) SoCs support"
32 default ARCH_SUNXI
33 select ARM_GIC
34 select ARM_PSCI
35 select HAVE_ARM_ARCH_TIMER
14 select SUN5I_HSTIMER 36 select SUN5I_HSTIMER
37
38endif
diff --git a/arch/arm/mach-sunxi/common.h b/arch/arm/mach-sunxi/common.h
deleted file mode 100644
index 9e5ac4756cbb..000000000000
--- a/arch/arm/mach-sunxi/common.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Core functions for Allwinner SoCs
3 *
4 * Copyright (C) 2013 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef __ARCH_SUNXI_COMMON_H_
14#define __ARCH_SUNXI_COMMON_H_
15
16void sun6i_secondary_startup(void);
17extern struct smp_operations sun6i_smp_ops;
18
19#endif /* __ARCH_SUNXI_COMMON_H_ */
diff --git a/arch/arm/mach-sunxi/platsmp.c b/arch/arm/mach-sunxi/platsmp.c
index 0c7dbce033cc..c53077bb8c3f 100644
--- a/arch/arm/mach-sunxi/platsmp.c
+++ b/arch/arm/mach-sunxi/platsmp.c
@@ -21,8 +21,6 @@
21#include <linux/of_address.h> 21#include <linux/of_address.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23 23
24#include "common.h"
25
26#define CPUCFG_CPU_PWR_CLAMP_STATUS_REG(cpu) ((cpu) * 0x40 + 0x64) 24#define CPUCFG_CPU_PWR_CLAMP_STATUS_REG(cpu) ((cpu) * 0x40 + 0x64)
27#define CPUCFG_CPU_RST_CTRL_REG(cpu) (((cpu) + 1) * 0x40) 25#define CPUCFG_CPU_RST_CTRL_REG(cpu) (((cpu) + 1) * 0x40)
28#define CPUCFG_CPU_CTRL_REG(cpu) (((cpu) + 1) * 0x40 + 0x04) 26#define CPUCFG_CPU_CTRL_REG(cpu) (((cpu) + 1) * 0x40 + 0x04)
@@ -122,3 +120,4 @@ struct smp_operations sun6i_smp_ops __initdata = {
122 .smp_prepare_cpus = sun6i_smp_prepare_cpus, 120 .smp_prepare_cpus = sun6i_smp_prepare_cpus,
123 .smp_boot_secondary = sun6i_smp_boot_secondary, 121 .smp_boot_secondary = sun6i_smp_boot_secondary,
124}; 122};
123CPU_METHOD_OF_DECLARE(sun6i_smp, "allwinner,sun6i-a31", &sun6i_smp_ops);
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 460b5a4962ef..3f9587bb51f6 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -12,111 +12,8 @@
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>
23 15
24#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/system_misc.h>
27
28#include "common.h"
29
30#define SUN4I_WATCHDOG_CTRL_REG 0x00
31#define SUN4I_WATCHDOG_CTRL_RESTART BIT(0)
32#define SUN4I_WATCHDOG_MODE_REG 0x04
33#define SUN4I_WATCHDOG_MODE_ENABLE BIT(0)
34#define SUN4I_WATCHDOG_MODE_RESET_ENABLE BIT(1)
35
36#define SUN6I_WATCHDOG1_IRQ_REG 0x00
37#define SUN6I_WATCHDOG1_CTRL_REG 0x10
38#define SUN6I_WATCHDOG1_CTRL_RESTART BIT(0)
39#define SUN6I_WATCHDOG1_CONFIG_REG 0x14
40#define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0)
41#define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1)
42#define SUN6I_WATCHDOG1_MODE_REG 0x18
43#define SUN6I_WATCHDOG1_MODE_ENABLE BIT(0)
44
45static void __iomem *wdt_base;
46
47static void sun4i_restart(enum reboot_mode mode, const char *cmd)
48{
49 if (!wdt_base)
50 return;
51
52 /* Enable timer and set reset bit in the watchdog */
53 writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
54 wdt_base + SUN4I_WATCHDOG_MODE_REG);
55
56 /*
57 * Restart the watchdog. The default (and lowest) interval
58 * value for the watchdog is 0.5s.
59 */
60 writel(SUN4I_WATCHDOG_CTRL_RESTART, wdt_base + SUN4I_WATCHDOG_CTRL_REG);
61
62 while (1) {
63 mdelay(5);
64 writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
65 wdt_base + SUN4I_WATCHDOG_MODE_REG);
66 }
67}
68
69static void sun6i_restart(enum reboot_mode mode, const char *cmd)
70{
71 if (!wdt_base)
72 return;
73
74 /* Disable interrupts */
75 writel(0, wdt_base + SUN6I_WATCHDOG1_IRQ_REG);
76
77 /* We want to disable the IRQ and just reset the whole system */
78 writel(SUN6I_WATCHDOG1_CONFIG_RESTART,
79 wdt_base + SUN6I_WATCHDOG1_CONFIG_REG);
80
81 /* Enable timer. The default and lowest interval value is 0.5s */
82 writel(SUN6I_WATCHDOG1_MODE_ENABLE,
83 wdt_base + SUN6I_WATCHDOG1_MODE_REG);
84
85 /* Restart the watchdog. */
86 writel(SUN6I_WATCHDOG1_CTRL_RESTART,
87 wdt_base + SUN6I_WATCHDOG1_CTRL_REG);
88
89 while (1) {
90 mdelay(5);
91 writel(SUN6I_WATCHDOG1_MODE_ENABLE,
92 wdt_base + SUN6I_WATCHDOG1_MODE_REG);
93 }
94}
95
96static struct of_device_id sunxi_restart_ids[] = {
97 { .compatible = "allwinner,sun4i-a10-wdt" },
98 { .compatible = "allwinner,sun6i-a31-wdt" },
99 { /*sentinel*/ }
100};
101
102static void sunxi_setup_restart(void)
103{
104 struct device_node *np;
105
106 np = of_find_matching_node(NULL, sunxi_restart_ids);
107 if (WARN(!np, "unable to setup watchdog restart"))
108 return;
109
110 wdt_base = of_iomap(np, 0);
111 WARN(!wdt_base, "failed to map watchdog base address");
112}
113
114static void __init sunxi_dt_init(void)
115{
116 sunxi_setup_restart();
117
118 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
119}
120 17
121static const char * const sunxi_board_dt_compat[] = { 18static const char * const sunxi_board_dt_compat[] = {
122 "allwinner,sun4i-a10", 19 "allwinner,sun4i-a10",
@@ -126,9 +23,7 @@ static const char * const sunxi_board_dt_compat[] = {
126}; 23};
127 24
128DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") 25DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
129 .init_machine = sunxi_dt_init,
130 .dt_compat = sunxi_board_dt_compat, 26 .dt_compat = sunxi_board_dt_compat,
131 .restart = sun4i_restart,
132MACHINE_END 27MACHINE_END
133 28
134static const char * const sun6i_board_dt_compat[] = { 29static const char * const sun6i_board_dt_compat[] = {
@@ -140,16 +35,14 @@ extern void __init sun6i_reset_init(void);
140static void __init sun6i_timer_init(void) 35static void __init sun6i_timer_init(void)
141{ 36{
142 of_clk_init(NULL); 37 of_clk_init(NULL);
143 sun6i_reset_init(); 38 if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
39 sun6i_reset_init();
144 clocksource_of_init(); 40 clocksource_of_init();
145} 41}
146 42
147DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family") 43DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
148 .init_machine = sunxi_dt_init,
149 .init_time = sun6i_timer_init, 44 .init_time = sun6i_timer_init,
150 .dt_compat = sun6i_board_dt_compat, 45 .dt_compat = sun6i_board_dt_compat,
151 .restart = sun6i_restart,
152 .smp = smp_ops(sun6i_smp_ops),
153MACHINE_END 46MACHINE_END
154 47
155static const char * const sun7i_board_dt_compat[] = { 48static const char * const sun7i_board_dt_compat[] = {
@@ -158,7 +51,5 @@ static const char * const sun7i_board_dt_compat[] = {
158}; 51};
159 52
160DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family") 53DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
161 .init_machine = sunxi_dt_init,
162 .dt_compat = sun7i_board_dt_compat, 54 .dt_compat = sun7i_board_dt_compat,
163 .restart = sun4i_restart,
164MACHINE_END 55MACHINE_END
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 55b305d51669..e16999e5b735 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -7,7 +7,6 @@ config ARCH_TEGRA
7 select CLKSRC_MMIO 7 select CLKSRC_MMIO
8 select HAVE_ARM_SCU if SMP 8 select HAVE_ARM_SCU if SMP
9 select HAVE_ARM_TWD if SMP 9 select HAVE_ARM_TWD if SMP
10 select MIGHT_HAVE_PCI
11 select PINCTRL 10 select PINCTRL
12 select ARCH_HAS_RESET_CONTROLLER 11 select ARCH_HAS_RESET_CONTROLLER
13 select RESET_CONTROLLER 12 select RESET_CONTROLLER
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index fb7920201ab4..7c7123e7557b 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -41,6 +41,14 @@
41#define PMC_REMOVE_CLAMPING 0x34 41#define PMC_REMOVE_CLAMPING 0x34
42#define PMC_PWRGATE_STATUS 0x38 42#define PMC_PWRGATE_STATUS 0x38
43 43
44#define PMC_SCRATCH0 0x50
45#define PMC_SCRATCH0_MODE_RECOVERY (1 << 31)
46#define PMC_SCRATCH0_MODE_BOOTLOADER (1 << 30)
47#define PMC_SCRATCH0_MODE_RCM (1 << 1)
48#define PMC_SCRATCH0_MODE_MASK (PMC_SCRATCH0_MODE_RECOVERY | \
49 PMC_SCRATCH0_MODE_BOOTLOADER | \
50 PMC_SCRATCH0_MODE_RCM)
51
44#define PMC_CPUPWRGOOD_TIMER 0xc8 52#define PMC_CPUPWRGOOD_TIMER 0xc8
45#define PMC_CPUPWROFF_TIMER 0xcc 53#define PMC_CPUPWROFF_TIMER 0xcc
46 54
@@ -165,6 +173,22 @@ void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
165{ 173{
166 u32 val; 174 u32 val;
167 175
176 val = tegra_pmc_readl(PMC_SCRATCH0);
177 val &= ~PMC_SCRATCH0_MODE_MASK;
178
179 if (cmd) {
180 if (strcmp(cmd, "recovery") == 0)
181 val |= PMC_SCRATCH0_MODE_RECOVERY;
182
183 if (strcmp(cmd, "bootloader") == 0)
184 val |= PMC_SCRATCH0_MODE_BOOTLOADER;
185
186 if (strcmp(cmd, "forced-recovery") == 0)
187 val |= PMC_SCRATCH0_MODE_RCM;
188 }
189
190 tegra_pmc_writel(val, PMC_SCRATCH0);
191
168 val = tegra_pmc_readl(0); 192 val = tegra_pmc_readl(0);
169 val |= 0x10; 193 val |= 0x10;
170 tegra_pmc_writel(val, 0); 194 tegra_pmc_writel(val, 0);
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index de544aabf292..9741de956b3e 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -5,8 +5,7 @@
5obj-y := cpu.o id.o timer.o pm.o 5obj-y := cpu.o id.o timer.o pm.o
6obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 6obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o 7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o
8obj-$(CONFIG_MACH_MOP500) += board-mop500-sdi.o \ 8obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \
9 board-mop500-regulators.o \
10 board-mop500-audio.o 9 board-mop500-audio.o
11obj-$(CONFIG_SMP) += platsmp.o headsmp.o 10obj-$(CONFIG_SMP) += platsmp.o headsmp.o
12obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
deleted file mode 100644
index fcbf3a13a539..000000000000
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Hanumath Prasad <hanumath.prasad@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#include <linux/kernel.h>
9#include <linux/gpio.h>
10#include <linux/amba/bus.h>
11#include <linux/amba/mmci.h>
12#include <linux/mmc/host.h>
13#include <linux/platform_device.h>
14#include <linux/platform_data/dma-ste-dma40.h>
15
16#include <asm/mach-types.h>
17
18#include "db8500-regs.h"
19#include "board-mop500.h"
20#include "ste-dma40-db8500.h"
21
22/*
23 * v2 has a new version of this block that need to be forced, the number found
24 * in hardware is incorrect
25 */
26#define U8500_SDI_V2_PERIPHID 0x10480180
27
28/*
29 * SDI 0 (MicroSD slot)
30 */
31
32#ifdef CONFIG_STE_DMA40
33struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = {
34 .mode = STEDMA40_MODE_LOGICAL,
35 .dir = DMA_DEV_TO_MEM,
36 .dev_type = DB8500_DMA_DEV29_SD_MM0,
37};
38
39static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
40 .mode = STEDMA40_MODE_LOGICAL,
41 .dir = DMA_MEM_TO_DEV,
42 .dev_type = DB8500_DMA_DEV29_SD_MM0,
43};
44#endif
45
46struct mmci_platform_data mop500_sdi0_data = {
47 .f_max = 100000000,
48 .capabilities = MMC_CAP_4_BIT_DATA |
49 MMC_CAP_SD_HIGHSPEED |
50 MMC_CAP_MMC_HIGHSPEED |
51 MMC_CAP_ERASE |
52 MMC_CAP_UHS_SDR12 |
53 MMC_CAP_UHS_SDR25,
54 .gpio_wp = -1,
55 .sigdir = MCI_ST_FBCLKEN |
56 MCI_ST_CMDDIREN |
57 MCI_ST_DATA0DIREN |
58 MCI_ST_DATA2DIREN,
59#ifdef CONFIG_STE_DMA40
60 .dma_filter = stedma40_filter,
61 .dma_rx_param = &mop500_sdi0_dma_cfg_rx,
62 .dma_tx_param = &mop500_sdi0_dma_cfg_tx,
63#endif
64};
65
66/*
67 * SDI1 (SDIO WLAN)
68 */
69#ifdef CONFIG_STE_DMA40
70static struct stedma40_chan_cfg sdi1_dma_cfg_rx = {
71 .mode = STEDMA40_MODE_LOGICAL,
72 .dir = DMA_DEV_TO_MEM,
73 .dev_type = DB8500_DMA_DEV32_SD_MM1,
74};
75
76static struct stedma40_chan_cfg sdi1_dma_cfg_tx = {
77 .mode = STEDMA40_MODE_LOGICAL,
78 .dir = DMA_MEM_TO_DEV,
79 .dev_type = DB8500_DMA_DEV32_SD_MM1,
80};
81#endif
82
83struct mmci_platform_data mop500_sdi1_data = {
84 .ocr_mask = MMC_VDD_29_30,
85 .f_max = 100000000,
86 .capabilities = MMC_CAP_4_BIT_DATA |
87 MMC_CAP_NONREMOVABLE,
88 .gpio_cd = -1,
89 .gpio_wp = -1,
90#ifdef CONFIG_STE_DMA40
91 .dma_filter = stedma40_filter,
92 .dma_rx_param = &sdi1_dma_cfg_rx,
93 .dma_tx_param = &sdi1_dma_cfg_tx,
94#endif
95};
96
97/*
98 * SDI 2 (POP eMMC, not on DB8500ed)
99 */
100
101#ifdef CONFIG_STE_DMA40
102struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = {
103 .mode = STEDMA40_MODE_LOGICAL,
104 .dir = DMA_DEV_TO_MEM,
105 .dev_type = DB8500_DMA_DEV28_SD_MM2,
106};
107
108static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
109 .mode = STEDMA40_MODE_LOGICAL,
110 .dir = DMA_MEM_TO_DEV,
111 .dev_type = DB8500_DMA_DEV28_SD_MM2,
112};
113#endif
114
115struct mmci_platform_data mop500_sdi2_data = {
116 .ocr_mask = MMC_VDD_165_195,
117 .f_max = 100000000,
118 .capabilities = MMC_CAP_4_BIT_DATA |
119 MMC_CAP_8_BIT_DATA |
120 MMC_CAP_NONREMOVABLE |
121 MMC_CAP_MMC_HIGHSPEED |
122 MMC_CAP_ERASE |
123 MMC_CAP_CMD23,
124 .gpio_cd = -1,
125 .gpio_wp = -1,
126#ifdef CONFIG_STE_DMA40
127 .dma_filter = stedma40_filter,
128 .dma_rx_param = &mop500_sdi2_dma_cfg_rx,
129 .dma_tx_param = &mop500_sdi2_dma_cfg_tx,
130#endif
131};
132
133/*
134 * SDI 4 (on-board eMMC)
135 */
136
137#ifdef CONFIG_STE_DMA40
138struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = {
139 .mode = STEDMA40_MODE_LOGICAL,
140 .dir = DMA_DEV_TO_MEM,
141 .dev_type = DB8500_DMA_DEV42_SD_MM4,
142};
143
144static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
145 .mode = STEDMA40_MODE_LOGICAL,
146 .dir = DMA_MEM_TO_DEV,
147 .dev_type = DB8500_DMA_DEV42_SD_MM4,
148};
149#endif
150
151struct mmci_platform_data mop500_sdi4_data = {
152 .f_max = 100000000,
153 .capabilities = MMC_CAP_4_BIT_DATA |
154 MMC_CAP_8_BIT_DATA |
155 MMC_CAP_NONREMOVABLE |
156 MMC_CAP_MMC_HIGHSPEED |
157 MMC_CAP_ERASE |
158 MMC_CAP_CMD23,
159 .gpio_cd = -1,
160 .gpio_wp = -1,
161#ifdef CONFIG_STE_DMA40
162 .dma_filter = stedma40_filter,
163 .dma_rx_param = &mop500_sdi4_dma_cfg_rx,
164 .dma_tx_param = &mop500_sdi4_dma_cfg_tx,
165#endif
166};
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index 32cc0d8d8a0e..7c7b0adca582 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -8,12 +8,7 @@
8#define __BOARD_MOP500_H 8#define __BOARD_MOP500_H
9 9
10#include <linux/platform_data/asoc-ux500-msp.h> 10#include <linux/platform_data/asoc-ux500-msp.h>
11#include <linux/amba/mmci.h>
12 11
13extern struct mmci_platform_data mop500_sdi0_data;
14extern struct mmci_platform_data mop500_sdi1_data;
15extern struct mmci_platform_data mop500_sdi2_data;
16extern struct mmci_platform_data mop500_sdi4_data;
17extern struct msp_i2s_platform_data msp0_platform_data; 12extern struct msp_i2s_platform_data msp0_platform_data;
18extern struct msp_i2s_platform_data msp1_platform_data; 13extern struct msp_i2s_platform_data msp1_platform_data;
19extern struct msp_i2s_platform_data msp2_platform_data; 14extern struct msp_i2s_platform_data msp2_platform_data;
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 8820f602fcd2..fa308f07fae5 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -146,10 +146,6 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
146 /* Requires call-back bindings. */ 146 /* Requires call-back bindings. */
147 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), 147 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
148 /* Requires DMA bindings. */ 148 /* Requires DMA bindings. */
149 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
150 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data),
151 OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data),
152 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
153 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, 149 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
154 "ux500-msp-i2s.0", &msp0_platform_data), 150 "ux500-msp-i2s.0", &msp0_platform_data),
155 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000, 151 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index f2c89fb8fca9..be83ba25f81b 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -310,6 +310,21 @@ static struct platform_device char_lcd_device = {
310 .resource = char_lcd_resources, 310 .resource = char_lcd_resources,
311}; 311};
312 312
313static struct resource leds_resources[] = {
314 {
315 .start = VERSATILE_SYS_BASE + VERSATILE_SYS_LED_OFFSET,
316 .end = VERSATILE_SYS_BASE + VERSATILE_SYS_LED_OFFSET + 4,
317 .flags = IORESOURCE_MEM,
318 },
319};
320
321static struct platform_device leds_device = {
322 .name = "versatile-leds",
323 .id = -1,
324 .num_resources = ARRAY_SIZE(leds_resources),
325 .resource = leds_resources,
326};
327
313/* 328/*
314 * Clock handling 329 * Clock handling
315 */ 330 */
@@ -795,6 +810,7 @@ void __init versatile_init(void)
795 platform_device_register(&versatile_i2c_device); 810 platform_device_register(&versatile_i2c_device);
796 platform_device_register(&smc91x_device); 811 platform_device_register(&smc91x_device);
797 platform_device_register(&char_lcd_device); 812 platform_device_register(&char_lcd_device);
813 platform_device_register(&leds_device);
798 814
799 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 815 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
800 struct amba_device *d = amba_devs[i]; 816 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 657d52d0391f..b8ac752fd24b 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -18,6 +18,8 @@ config ARCH_VEXPRESS
18 select POWER_SUPPLY 18 select POWER_SUPPLY
19 select REGULATOR_FIXED_VOLTAGE if REGULATOR 19 select REGULATOR_FIXED_VOLTAGE if REGULATOR
20 select VEXPRESS_CONFIG 20 select VEXPRESS_CONFIG
21 select VEXPRESS_SYSCFG
22 select MFD_VEXPRESS_SYSREG
21 help 23 help
22 This option enables support for systems using Cortex processor based 24 This option enables support for systems using Cortex processor based
23 ARM core and logic (FPGA) tiles on the Versatile Express motherboard, 25 ARM core and logic (FPGA) tiles on the Versatile Express motherboard,
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index bde4374ab6d5..152fad91b3ae 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -4,10 +4,9 @@
4/* Tile's peripherals static mappings should start here */ 4/* Tile's peripherals static mappings should start here */
5#define V2T_PERIPH 0xf8200000 5#define V2T_PERIPH 0xf8200000
6 6
7void vexpress_dt_smp_map_io(void);
8
9bool vexpress_smp_init_ops(void); 7bool vexpress_smp_init_ops(void);
10 8
11extern struct smp_operations vexpress_smp_ops; 9extern struct smp_operations vexpress_smp_ops;
10extern struct smp_operations vexpress_smp_dt_ops;
12 11
13extern void vexpress_cpu_die(unsigned int cpu); 12extern void vexpress_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 6f34497a4245..494d70bfddad 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -128,6 +128,10 @@ static struct platform_device pmu_device = {
128 .resource = pmu_resources, 128 .resource = pmu_resources,
129}; 129};
130 130
131static struct clk_lookup osc1_lookup = {
132 .dev_id = "ct:clcd",
133};
134
131static struct platform_device osc1_device = { 135static struct platform_device osc1_device = {
132 .name = "vexpress-osc", 136 .name = "vexpress-osc",
133 .id = 1, 137 .id = 1,
@@ -135,6 +139,7 @@ static struct platform_device osc1_device = {
135 .resource = (struct resource []) { 139 .resource = (struct resource []) {
136 VEXPRESS_RES_FUNC(0xf, 1), 140 VEXPRESS_RES_FUNC(0xf, 1),
137 }, 141 },
142 .dev.platform_data = &osc1_lookup,
138}; 143};
139 144
140static void __init ct_ca9x4_init(void) 145static void __init ct_ca9x4_init(void)
@@ -155,10 +160,7 @@ static void __init ct_ca9x4_init(void)
155 amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource); 160 amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource);
156 161
157 platform_device_register(&pmu_device); 162 platform_device_register(&pmu_device);
158 platform_device_register(&osc1_device); 163 vexpress_syscfg_device_register(&osc1_device);
159
160 WARN_ON(clk_register_clkdev(vexpress_osc_setup(&osc1_device.dev),
161 NULL, "ct:clcd"));
162} 164}
163 165
164#ifdef CONFIG_SMP 166#ifdef CONFIG_SMP
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 993c9ae5dc5e..a1f3804fd5a5 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -12,8 +12,7 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/of.h> 15#include <linux/of_address.h>
16#include <linux/of_fdt.h>
17#include <linux/vexpress.h> 16#include <linux/vexpress.h>
18 17
19#include <asm/mcpm.h> 18#include <asm/mcpm.h>
@@ -26,154 +25,13 @@
26 25
27#include "core.h" 26#include "core.h"
28 27
29#if defined(CONFIG_OF)
30
31static enum {
32 GENERIC_SCU,
33 CORTEX_A9_SCU,
34} vexpress_dt_scu __initdata = GENERIC_SCU;
35
36static struct map_desc vexpress_dt_cortex_a9_scu_map __initdata = {
37 .virtual = V2T_PERIPH,
38 /* .pfn set in vexpress_dt_init_cortex_a9_scu() */
39 .length = SZ_128,
40 .type = MT_DEVICE,
41};
42
43static void *vexpress_dt_cortex_a9_scu_base __initdata;
44
45const static char *vexpress_dt_cortex_a9_match[] __initconst = {
46 "arm,cortex-a5-scu",
47 "arm,cortex-a9-scu",
48 NULL
49};
50
51static int __init vexpress_dt_find_scu(unsigned long node,
52 const char *uname, int depth, void *data)
53{
54 if (of_flat_dt_match(node, vexpress_dt_cortex_a9_match)) {
55 phys_addr_t phys_addr;
56 __be32 *reg = of_get_flat_dt_prop(node, "reg", NULL);
57
58 if (WARN_ON(!reg))
59 return -EINVAL;
60
61 phys_addr = be32_to_cpup(reg);
62 vexpress_dt_scu = CORTEX_A9_SCU;
63
64 vexpress_dt_cortex_a9_scu_map.pfn = __phys_to_pfn(phys_addr);
65 iotable_init(&vexpress_dt_cortex_a9_scu_map, 1);
66 vexpress_dt_cortex_a9_scu_base = ioremap(phys_addr, SZ_256);
67 if (WARN_ON(!vexpress_dt_cortex_a9_scu_base))
68 return -EFAULT;
69 }
70
71 return 0;
72}
73
74void __init vexpress_dt_smp_map_io(void)
75{
76 if (initial_boot_params)
77 WARN_ON(of_scan_flat_dt(vexpress_dt_find_scu, NULL));
78}
79
80static int __init vexpress_dt_cpus_num(unsigned long node, const char *uname,
81 int depth, void *data)
82{
83 static int prev_depth = -1;
84 static int nr_cpus = -1;
85
86 if (prev_depth > depth && nr_cpus > 0)
87 return nr_cpus;
88
89 if (nr_cpus < 0 && strcmp(uname, "cpus") == 0)
90 nr_cpus = 0;
91
92 if (nr_cpus >= 0) {
93 const char *device_type = of_get_flat_dt_prop(node,
94 "device_type", NULL);
95
96 if (device_type && strcmp(device_type, "cpu") == 0)
97 nr_cpus++;
98 }
99
100 prev_depth = depth;
101
102 return 0;
103}
104
105static void __init vexpress_dt_smp_init_cpus(void)
106{
107 int ncores = 0, i;
108
109 switch (vexpress_dt_scu) {
110 case GENERIC_SCU:
111 ncores = of_scan_flat_dt(vexpress_dt_cpus_num, NULL);
112 break;
113 case CORTEX_A9_SCU:
114 ncores = scu_get_core_count(vexpress_dt_cortex_a9_scu_base);
115 break;
116 default:
117 WARN_ON(1);
118 break;
119 }
120
121 if (ncores < 2)
122 return;
123
124 if (ncores > nr_cpu_ids) {
125 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
126 ncores, nr_cpu_ids);
127 ncores = nr_cpu_ids;
128 }
129
130 for (i = 0; i < ncores; ++i)
131 set_cpu_possible(i, true);
132}
133
134static void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
135{
136 int i;
137
138 switch (vexpress_dt_scu) {
139 case GENERIC_SCU:
140 for (i = 0; i < max_cpus; i++)
141 set_cpu_present(i, true);
142 break;
143 case CORTEX_A9_SCU:
144 scu_enable(vexpress_dt_cortex_a9_scu_base);
145 break;
146 default:
147 WARN_ON(1);
148 break;
149 }
150}
151
152#else
153
154static void __init vexpress_dt_smp_init_cpus(void)
155{
156 WARN_ON(1);
157}
158
159void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
160{
161 WARN_ON(1);
162}
163
164#endif
165
166/* 28/*
167 * Initialise the CPU possible map early - this describes the CPUs 29 * Initialise the CPU possible map early - this describes the CPUs
168 * which may be present or become present in the system. 30 * which may be present or become present in the system.
169 */ 31 */
170static void __init vexpress_smp_init_cpus(void) 32static void __init vexpress_smp_init_cpus(void)
171{ 33{
172 if (ct_desc) 34 ct_desc->init_cpu_map();
173 ct_desc->init_cpu_map();
174 else
175 vexpress_dt_smp_init_cpus();
176
177} 35}
178 36
179static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus) 37static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
@@ -182,10 +40,7 @@ static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
182 * Initialise the present map, which describes the set of CPUs 40 * Initialise the present map, which describes the set of CPUs
183 * actually populated at the present time. 41 * actually populated at the present time.
184 */ 42 */
185 if (ct_desc) 43 ct_desc->smp_enable(max_cpus);
186 ct_desc->smp_enable(max_cpus);
187 else
188 vexpress_dt_smp_prepare_cpus(max_cpus);
189 44
190 /* 45 /*
191 * Write the address of secondary startup into the 46 * Write the address of secondary startup into the
@@ -223,3 +78,39 @@ bool __init vexpress_smp_init_ops(void)
223#endif 78#endif
224 return false; 79 return false;
225} 80}
81
82#if defined(CONFIG_OF)
83
84static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = {
85 { .compatible = "arm,cortex-a5-scu", },
86 { .compatible = "arm,cortex-a9-scu", },
87 {}
88};
89
90static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
91{
92 struct device_node *scu = of_find_matching_node(NULL,
93 vexpress_smp_dt_scu_match);
94
95 if (scu)
96 scu_enable(of_iomap(scu, 0));
97
98 /*
99 * Write the address of secondary startup into the
100 * system-wide flags register. The boot monitor waits
101 * until it receives a soft interrupt, and then the
102 * secondary CPU branches to this address.
103 */
104 vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
105}
106
107struct smp_operations __initdata vexpress_smp_dt_ops = {
108 .smp_prepare_cpus = vexpress_smp_dt_prepare_cpus,
109 .smp_secondary_init = versatile_secondary_init,
110 .smp_boot_secondary = versatile_boot_secondary,
111#ifdef CONFIG_HOTPLUG_CPU
112 .cpu_die = vexpress_cpu_die,
113#endif
114};
115
116#endif
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 4f8b8cb17ff5..38f4f6f37770 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -201,8 +201,9 @@ static struct platform_device v2m_cf_device = {
201 201
202static struct mmci_platform_data v2m_mmci_data = { 202static struct mmci_platform_data v2m_mmci_data = {
203 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 203 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
204 .gpio_wp = VEXPRESS_GPIO_MMC_WPROT, 204 .status = vexpress_get_mci_cardin,
205 .gpio_cd = VEXPRESS_GPIO_MMC_CARDIN, 205 .gpio_cd = -1,
206 .gpio_wp = -1,
206}; 207};
207 208
208static struct resource v2m_sysreg_resources[] = { 209static struct resource v2m_sysreg_resources[] = {
@@ -340,11 +341,6 @@ static void __init v2m_init(void)
340 regulator_register_fixed(0, v2m_eth_supplies, 341 regulator_register_fixed(0, v2m_eth_supplies,
341 ARRAY_SIZE(v2m_eth_supplies)); 342 ARRAY_SIZE(v2m_eth_supplies));
342 343
343 platform_device_register(&v2m_muxfpga_device);
344 platform_device_register(&v2m_shutdown_device);
345 platform_device_register(&v2m_reboot_device);
346 platform_device_register(&v2m_dvimode_device);
347
348 platform_device_register(&v2m_sysreg_device); 344 platform_device_register(&v2m_sysreg_device);
349 platform_device_register(&v2m_pcie_i2c_device); 345 platform_device_register(&v2m_pcie_i2c_device);
350 platform_device_register(&v2m_ddc_i2c_device); 346 platform_device_register(&v2m_ddc_i2c_device);
@@ -356,6 +352,11 @@ static void __init v2m_init(void)
356 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++) 352 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++)
357 amba_device_register(v2m_amba_devs[i], &iomem_resource); 353 amba_device_register(v2m_amba_devs[i], &iomem_resource);
358 354
355 vexpress_syscfg_device_register(&v2m_muxfpga_device);
356 vexpress_syscfg_device_register(&v2m_shutdown_device);
357 vexpress_syscfg_device_register(&v2m_reboot_device);
358 vexpress_syscfg_device_register(&v2m_dvimode_device);
359
359 ct_desc->init_tile(); 360 ct_desc->init_tile();
360} 361}
361 362
@@ -369,71 +370,10 @@ MACHINE_START(VEXPRESS, "ARM-Versatile Express")
369 .init_machine = v2m_init, 370 .init_machine = v2m_init,
370MACHINE_END 371MACHINE_END
371 372
372static struct map_desc v2m_rs1_io_desc __initdata = {
373 .virtual = V2M_PERIPH,
374 .pfn = __phys_to_pfn(0x1c000000),
375 .length = SZ_2M,
376 .type = MT_DEVICE,
377};
378
379static int __init v2m_dt_scan_memory_map(unsigned long node, const char *uname,
380 int depth, void *data)
381{
382 const char **map = data;
383
384 if (strcmp(uname, "motherboard") != 0)
385 return 0;
386
387 *map = of_get_flat_dt_prop(node, "arm,v2m-memory-map", NULL);
388
389 return 1;
390}
391
392void __init v2m_dt_map_io(void)
393{
394 const char *map = NULL;
395
396 of_scan_flat_dt(v2m_dt_scan_memory_map, &map);
397
398 if (map && strcmp(map, "rs1") == 0)
399 iotable_init(&v2m_rs1_io_desc, 1);
400 else
401 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc));
402
403#if defined(CONFIG_SMP)
404 vexpress_dt_smp_map_io();
405#endif
406}
407
408void __init v2m_dt_init_early(void)
409{
410 u32 dt_hbi;
411
412 vexpress_sysreg_of_early_init();
413
414 /* Confirm board type against DT property, if available */
415 if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
416 u32 hbi = vexpress_get_hbi(VEXPRESS_SITE_MASTER);
417
418 if (WARN_ON(dt_hbi != hbi))
419 pr_warning("vexpress: DT HBI (%x) is not matching "
420 "hardware (%x)!\n", dt_hbi, hbi);
421 }
422
423 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000);
424}
425
426static const struct of_device_id v2m_dt_bus_match[] __initconst = {
427 { .compatible = "simple-bus", },
428 { .compatible = "arm,amba-bus", },
429 { .compatible = "arm,vexpress,config-bus", },
430 {}
431};
432
433static void __init v2m_dt_init(void) 373static void __init v2m_dt_init(void)
434{ 374{
435 l2x0_of_init(0x00400000, 0xfe0fffff); 375 l2x0_of_init(0x00400000, 0xfe0fffff);
436 of_platform_populate(NULL, v2m_dt_bus_match, NULL, NULL); 376 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
437} 377}
438 378
439static const char * const v2m_dt_match[] __initconst = { 379static const char * const v2m_dt_match[] __initconst = {
@@ -443,9 +383,7 @@ static const char * const v2m_dt_match[] __initconst = {
443 383
444DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express") 384DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
445 .dt_compat = v2m_dt_match, 385 .dt_compat = v2m_dt_match,
446 .smp = smp_ops(vexpress_smp_ops), 386 .smp = smp_ops(vexpress_smp_dt_ops),
447 .smp_init = smp_init_ops(vexpress_smp_init_ops), 387 .smp_init = smp_init_ops(vexpress_smp_init_ops),
448 .map_io = v2m_dt_map_io,
449 .init_early = v2m_dt_init_early,
450 .init_machine = v2m_dt_init, 388 .init_machine = v2m_dt_init,
451MACHINE_END 389MACHINE_END
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 58c2b844e0a3..573e0db1d0f0 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -1,14 +1,16 @@
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 ARM_AMBA
4 select ARM_GIC
5 select ARCH_HAS_CPUFREQ 3 select ARCH_HAS_CPUFREQ
6 select ARCH_HAS_OPP 4 select ARCH_HAS_OPP
5 select ARCH_SUPPORTS_BIG_ENDIAN
6 select ARM_AMBA
7 select ARM_GIC
8 select ARM_GLOBAL_TIMER if !CPU_FREQ
9 select CADENCE_TTC_TIMER
7 select HAVE_ARM_SCU if SMP 10 select HAVE_ARM_SCU if SMP
8 select HAVE_ARM_TWD if SMP 11 select HAVE_ARM_TWD if SMP
9 select ICST 12 select ICST
10 select CADENCE_TTC_TIMER
11 select ARM_GLOBAL_TIMER if !CPU_FREQ
12 select MFD_SYSCON 13 select MFD_SYSCON
14 select SOC_BUS
13 help 15 help
14 Support for Xilinx Zynq ARM Cortex A9 Platform 16 Support for Xilinx Zynq ARM Cortex A9 Platform
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 6fcc584c1a11..edbd9d83f407 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -29,6 +29,8 @@
29#include <linux/memblock.h> 29#include <linux/memblock.h>
30#include <linux/irqchip.h> 30#include <linux/irqchip.h>
31#include <linux/irqchip/arm-gic.h> 31#include <linux/irqchip/arm-gic.h>
32#include <linux/slab.h>
33#include <linux/sys_soc.h>
32 34
33#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 36#include <asm/mach/map.h>
@@ -37,10 +39,15 @@
37#include <asm/page.h> 39#include <asm/page.h>
38#include <asm/pgtable.h> 40#include <asm/pgtable.h>
39#include <asm/smp_scu.h> 41#include <asm/smp_scu.h>
42#include <asm/system_info.h>
40#include <asm/hardware/cache-l2x0.h> 43#include <asm/hardware/cache-l2x0.h>
41 44
42#include "common.h" 45#include "common.h"
43 46
47#define ZYNQ_DEVCFG_MCTRL 0x80
48#define ZYNQ_DEVCFG_PS_VERSION_SHIFT 28
49#define ZYNQ_DEVCFG_PS_VERSION_MASK 0xF
50
44void __iomem *zynq_scu_base; 51void __iomem *zynq_scu_base;
45 52
46/** 53/**
@@ -60,19 +67,81 @@ static struct platform_device zynq_cpuidle_device = {
60}; 67};
61 68
62/** 69/**
70 * zynq_get_revision - Get Zynq silicon revision
71 *
72 * Return: Silicon version or -1 otherwise
73 */
74static int __init zynq_get_revision(void)
75{
76 struct device_node *np;
77 void __iomem *zynq_devcfg_base;
78 u32 revision;
79
80 np = of_find_compatible_node(NULL, NULL, "xlnx,zynq-devcfg-1.0");
81 if (!np) {
82 pr_err("%s: no devcfg node found\n", __func__);
83 return -1;
84 }
85
86 zynq_devcfg_base = of_iomap(np, 0);
87 if (!zynq_devcfg_base) {
88 pr_err("%s: Unable to map I/O memory\n", __func__);
89 return -1;
90 }
91
92 revision = readl(zynq_devcfg_base + ZYNQ_DEVCFG_MCTRL);
93 revision >>= ZYNQ_DEVCFG_PS_VERSION_SHIFT;
94 revision &= ZYNQ_DEVCFG_PS_VERSION_MASK;
95
96 iounmap(zynq_devcfg_base);
97
98 return revision;
99}
100
101/**
63 * zynq_init_machine - System specific initialization, intended to be 102 * zynq_init_machine - System specific initialization, intended to be
64 * called from board specific initialization. 103 * called from board specific initialization.
65 */ 104 */
66static void __init zynq_init_machine(void) 105static void __init zynq_init_machine(void)
67{ 106{
68 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 107 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
108 struct soc_device_attribute *soc_dev_attr;
109 struct soc_device *soc_dev;
110 struct device *parent = NULL;
69 111
70 /* 112 /*
71 * 64KB way size, 8-way associativity, parity disabled 113 * 64KB way size, 8-way associativity, parity disabled
72 */ 114 */
73 l2x0_of_init(0x02060000, 0xF0F0FFFF); 115 l2x0_of_init(0x02060000, 0xF0F0FFFF);
74 116
75 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 117 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
118 if (!soc_dev_attr)
119 goto out;
120
121 system_rev = zynq_get_revision();
122
123 soc_dev_attr->family = kasprintf(GFP_KERNEL, "Xilinx Zynq");
124 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "0x%x", system_rev);
125 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "0x%x",
126 zynq_slcr_get_device_id());
127
128 soc_dev = soc_device_register(soc_dev_attr);
129 if (IS_ERR(soc_dev)) {
130 kfree(soc_dev_attr->family);
131 kfree(soc_dev_attr->revision);
132 kfree(soc_dev_attr->soc_id);
133 kfree(soc_dev_attr);
134 goto out;
135 }
136
137 parent = soc_device_to_device(soc_dev);
138
139out:
140 /*
141 * Finished with the static registrations now; fill in the missing
142 * devices
143 */
144 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
76 145
77 platform_device_register(&zynq_cpuidle_device); 146 platform_device_register(&zynq_cpuidle_device);
78 platform_device_register_full(&devinfo); 147 platform_device_register_full(&devinfo);
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index b097844d3175..f652f0a884a6 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -24,6 +24,7 @@ extern int zynq_early_slcr_init(void);
24extern void zynq_slcr_system_reset(void); 24extern void zynq_slcr_system_reset(void);
25extern void zynq_slcr_cpu_stop(int cpu); 25extern void zynq_slcr_cpu_stop(int cpu);
26extern void zynq_slcr_cpu_start(int cpu); 26extern void zynq_slcr_cpu_start(int cpu);
27extern u32 zynq_slcr_get_device_id(void);
27 28
28#ifdef CONFIG_SMP 29#ifdef CONFIG_SMP
29extern void secondary_startup(void); 30extern void secondary_startup(void);
diff --git a/arch/arm/mach-zynq/headsmp.S b/arch/arm/mach-zynq/headsmp.S
index 57a32869f0aa..dd8c071941e7 100644
--- a/arch/arm/mach-zynq/headsmp.S
+++ b/arch/arm/mach-zynq/headsmp.S
@@ -8,9 +8,12 @@
8 */ 8 */
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <asm/assembler.h>
11 12
12ENTRY(zynq_secondary_trampoline) 13ENTRY(zynq_secondary_trampoline)
13 ldr r0, [pc] 14ARM_BE8(setend be) @ ensure we are in BE8 mode
15 ldr r0, zynq_secondary_trampoline_jump
16ARM_BE8(rev r0, r0)
14 bx r0 17 bx r0
15.globl zynq_secondary_trampoline_jump 18.globl zynq_secondary_trampoline_jump
16zynq_secondary_trampoline_jump: 19zynq_secondary_trampoline_jump:
diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c
index a37d49a6e657..c43a2d16e223 100644
--- a/arch/arm/mach-zynq/slcr.c
+++ b/arch/arm/mach-zynq/slcr.c
@@ -26,10 +26,13 @@
26#define SLCR_PS_RST_CTRL_OFFSET 0x200 /* PS Software Reset Control */ 26#define SLCR_PS_RST_CTRL_OFFSET 0x200 /* PS Software Reset Control */
27#define SLCR_A9_CPU_RST_CTRL_OFFSET 0x244 /* CPU Software Reset Control */ 27#define SLCR_A9_CPU_RST_CTRL_OFFSET 0x244 /* CPU Software Reset Control */
28#define SLCR_REBOOT_STATUS_OFFSET 0x258 /* PS Reboot Status */ 28#define SLCR_REBOOT_STATUS_OFFSET 0x258 /* PS Reboot Status */
29#define SLCR_PSS_IDCODE 0x530 /* PS IDCODE */
29 30
30#define SLCR_UNLOCK_MAGIC 0xDF0D 31#define SLCR_UNLOCK_MAGIC 0xDF0D
31#define SLCR_A9_CPU_CLKSTOP 0x10 32#define SLCR_A9_CPU_CLKSTOP 0x10
32#define SLCR_A9_CPU_RST 0x1 33#define SLCR_A9_CPU_RST 0x1
34#define SLCR_PSS_IDCODE_DEVICE_SHIFT 12
35#define SLCR_PSS_IDCODE_DEVICE_MASK 0x1F
33 36
34static void __iomem *zynq_slcr_base; 37static void __iomem *zynq_slcr_base;
35static struct regmap *zynq_slcr_regmap; 38static struct regmap *zynq_slcr_regmap;
@@ -83,6 +86,22 @@ static inline int zynq_slcr_unlock(void)
83} 86}
84 87
85/** 88/**
89 * zynq_slcr_get_device_id - Read device code id
90 *
91 * Return: Device code id
92 */
93u32 zynq_slcr_get_device_id(void)
94{
95 u32 val;
96
97 zynq_slcr_read(&val, SLCR_PSS_IDCODE);
98 val >>= SLCR_PSS_IDCODE_DEVICE_SHIFT;
99 val &= SLCR_PSS_IDCODE_DEVICE_MASK;
100
101 return val;
102}
103
104/**
86 * zynq_slcr_system_reset - Reset the entire system. 105 * zynq_slcr_system_reset - Reset the entire system.
87 */ 106 */
88void zynq_slcr_system_reset(void) 107void zynq_slcr_system_reset(void)
diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S
index 0c93588fcb91..1ca37c72f12f 100644
--- a/arch/arm/mm/proc-v7m.S
+++ b/arch/arm/mm/proc-v7m.S
@@ -123,6 +123,11 @@ __v7m_setup:
123 mov pc, lr 123 mov pc, lr
124ENDPROC(__v7m_setup) 124ENDPROC(__v7m_setup)
125 125
126 .align 2
127__v7m_setup_stack:
128 .space 4 * 8 @ 8 registers
129__v7m_setup_stack_top:
130
126 define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1 131 define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1
127 132
128 .section ".rodata" 133 .section ".rodata"
@@ -152,6 +157,3 @@ __v7m_proc_info:
152 .long nop_cache_fns @ proc_info_list.cache 157 .long nop_cache_fns @ proc_info_list.cache
153 .size __v7m_proc_info, . - __v7m_proc_info 158 .size __v7m_proc_info, . - __v7m_proc_info
154 159
155__v7m_setup_stack:
156 .space 4 * 8 @ 8 registers
157__v7m_setup_stack_top:
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 384a776d8eb2..61b4d705c267 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -40,7 +40,7 @@ static void __iomem *sync32k_cnt_reg;
40 40
41static u64 notrace omap_32k_read_sched_clock(void) 41static u64 notrace omap_32k_read_sched_clock(void)
42{ 42{
43 return sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0; 43 return sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0;
44} 44}
45 45
46/** 46/**
@@ -64,7 +64,7 @@ static void omap_read_persistent_clock(struct timespec *ts)
64 spin_lock_irqsave(&read_persistent_clock_lock, flags); 64 spin_lock_irqsave(&read_persistent_clock_lock, flags);
65 65
66 last_cycles = cycles; 66 last_cycles = cycles;
67 cycles = sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0; 67 cycles = sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0;
68 68
69 nsecs = clocksource_cyc2ns(cycles - last_cycles, 69 nsecs = clocksource_cyc2ns(cycles - last_cycles,
70 persistent_mult, persistent_shift); 70 persistent_mult, persistent_shift);
@@ -95,7 +95,7 @@ int __init omap_init_clocksource_32k(void __iomem *vbase)
95 * The 'SCHEME' bits(30-31) of the revision register is used 95 * The 'SCHEME' bits(30-31) of the revision register is used
96 * to identify the version. 96 * to identify the version.
97 */ 97 */
98 if (__raw_readl(vbase + OMAP2_32KSYNCNT_REV_OFF) & 98 if (readl_relaxed(vbase + OMAP2_32KSYNCNT_REV_OFF) &
99 OMAP2_32KSYNCNT_REV_SCHEME) 99 OMAP2_32KSYNCNT_REV_SCHEME)
100 sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_HIGH; 100 sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_HIGH;
101 else 101 else
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index aa7ebc6bcd65..48b69de89a5d 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -85,12 +85,12 @@ static void dbg_led_set(struct led_classdev *cdev,
85 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); 85 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev);
86 u16 reg; 86 u16 reg;
87 87
88 reg = __raw_readw(&fpga->leds); 88 reg = readw_relaxed(&fpga->leds);
89 if (b != LED_OFF) 89 if (b != LED_OFF)
90 reg |= led->mask; 90 reg |= led->mask;
91 else 91 else
92 reg &= ~led->mask; 92 reg &= ~led->mask;
93 __raw_writew(reg, &fpga->leds); 93 writew_relaxed(reg, &fpga->leds);
94} 94}
95 95
96static enum led_brightness dbg_led_get(struct led_classdev *cdev) 96static enum led_brightness dbg_led_get(struct led_classdev *cdev)
@@ -98,7 +98,7 @@ static enum led_brightness dbg_led_get(struct led_classdev *cdev)
98 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); 98 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev);
99 u16 reg; 99 u16 reg;
100 100
101 reg = __raw_readw(&fpga->leds); 101 reg = readw_relaxed(&fpga->leds);
102 return (reg & led->mask) ? LED_FULL : LED_OFF; 102 return (reg & led->mask) ? LED_FULL : LED_OFF;
103} 103}
104 104
@@ -112,7 +112,7 @@ static int fpga_probe(struct platform_device *pdev)
112 return -ENODEV; 112 return -ENODEV;
113 113
114 fpga = ioremap(iomem->start, resource_size(iomem)); 114 fpga = ioremap(iomem->start, resource_size(iomem));
115 __raw_writew(0xff, &fpga->leds); 115 writew_relaxed(0xff, &fpga->leds);
116 116
117 for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) { 117 for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) {
118 struct dbg_led *led; 118 struct dbg_led *led;
@@ -138,15 +138,15 @@ static int fpga_probe(struct platform_device *pdev)
138 138
139static int fpga_suspend_noirq(struct device *dev) 139static int fpga_suspend_noirq(struct device *dev)
140{ 140{
141 fpga_led_state = __raw_readw(&fpga->leds); 141 fpga_led_state = readw_relaxed(&fpga->leds);
142 __raw_writew(0xff, &fpga->leds); 142 writew_relaxed(0xff, &fpga->leds);
143 143
144 return 0; 144 return 0;
145} 145}
146 146
147static int fpga_resume_noirq(struct device *dev) 147static int fpga_resume_noirq(struct device *dev)
148{ 148{
149 __raw_writew(~fpga_led_state, &fpga->leds); 149 writew_relaxed(~fpga_led_state, &fpga->leds);
150 return 0; 150 return 0;
151} 151}
152 152
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 5f5b975887fc..b5608b1f9fbd 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -70,6 +70,7 @@ static u32 errata;
70 70
71static struct omap_dma_global_context_registers { 71static struct omap_dma_global_context_registers {
72 u32 dma_irqenable_l0; 72 u32 dma_irqenable_l0;
73 u32 dma_irqenable_l1;
73 u32 dma_ocp_sysconfig; 74 u32 dma_ocp_sysconfig;
74 u32 dma_gcr; 75 u32 dma_gcr;
75} omap_dma_global_context; 76} omap_dma_global_context;
@@ -1973,10 +1974,17 @@ static struct irqaction omap24xx_dma_irq;
1973 1974
1974/*----------------------------------------------------------------------------*/ 1975/*----------------------------------------------------------------------------*/
1975 1976
1977/*
1978 * Note that we are currently using only IRQENABLE_L0 and L1.
1979 * As the DSP may be using IRQENABLE_L2 and L3, let's not
1980 * touch those for now.
1981 */
1976void omap_dma_global_context_save(void) 1982void omap_dma_global_context_save(void)
1977{ 1983{
1978 omap_dma_global_context.dma_irqenable_l0 = 1984 omap_dma_global_context.dma_irqenable_l0 =
1979 p->dma_read(IRQENABLE_L0, 0); 1985 p->dma_read(IRQENABLE_L0, 0);
1986 omap_dma_global_context.dma_irqenable_l1 =
1987 p->dma_read(IRQENABLE_L1, 0);
1980 omap_dma_global_context.dma_ocp_sysconfig = 1988 omap_dma_global_context.dma_ocp_sysconfig =
1981 p->dma_read(OCP_SYSCONFIG, 0); 1989 p->dma_read(OCP_SYSCONFIG, 0);
1982 omap_dma_global_context.dma_gcr = p->dma_read(GCR, 0); 1990 omap_dma_global_context.dma_gcr = p->dma_read(GCR, 0);
@@ -1991,6 +1999,8 @@ void omap_dma_global_context_restore(void)
1991 OCP_SYSCONFIG, 0); 1999 OCP_SYSCONFIG, 0);
1992 p->dma_write(omap_dma_global_context.dma_irqenable_l0, 2000 p->dma_write(omap_dma_global_context.dma_irqenable_l0,
1993 IRQENABLE_L0, 0); 2001 IRQENABLE_L0, 0);
2002 p->dma_write(omap_dma_global_context.dma_irqenable_l1,
2003 IRQENABLE_L1, 0);
1994 2004
1995 if (IS_DMA_ERRATA(DMA_ROMCODE_BUG)) 2005 if (IS_DMA_ERRATA(DMA_ROMCODE_BUG))
1996 p->dma_write(0x3 , IRQSTATUS_L0, 0); 2006 p->dma_write(0x3 , IRQSTATUS_L0, 0);
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 869254cebf84..db10169a08de 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -103,7 +103,7 @@ static void omap_timer_restore_context(struct omap_dm_timer *timer)
103 timer->context.tmar); 103 timer->context.tmar);
104 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 104 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG,
105 timer->context.tsicr); 105 timer->context.tsicr);
106 __raw_writel(timer->context.tier, timer->irq_ena); 106 writel_relaxed(timer->context.tier, timer->irq_ena);
107 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, 107 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG,
108 timer->context.tclr); 108 timer->context.tclr);
109} 109}
@@ -699,9 +699,9 @@ int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
699 omap_dm_timer_enable(timer); 699 omap_dm_timer_enable(timer);
700 700
701 if (timer->revision == 1) 701 if (timer->revision == 1)
702 l = __raw_readl(timer->irq_ena) & ~mask; 702 l = readl_relaxed(timer->irq_ena) & ~mask;
703 703
704 __raw_writel(l, timer->irq_dis); 704 writel_relaxed(l, timer->irq_dis);
705 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_WAKEUP_EN_REG) & ~mask; 705 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_WAKEUP_EN_REG) & ~mask;
706 omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, l); 706 omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, l);
707 707
@@ -722,7 +722,7 @@ unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
722 return 0; 722 return 0;
723 } 723 }
724 724
725 l = __raw_readl(timer->irq_stat); 725 l = readl_relaxed(timer->irq_stat);
726 726
727 return l; 727 return l;
728} 728}
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 2861b155485a..dd79f3005cdf 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -280,20 +280,20 @@ static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
280 int posted) 280 int posted)
281{ 281{
282 if (posted) 282 if (posted)
283 while (__raw_readl(timer->pend) & (reg >> WPSHIFT)) 283 while (readl_relaxed(timer->pend) & (reg >> WPSHIFT))
284 cpu_relax(); 284 cpu_relax();
285 285
286 return __raw_readl(timer->func_base + (reg & 0xff)); 286 return readl_relaxed(timer->func_base + (reg & 0xff));
287} 287}
288 288
289static inline void __omap_dm_timer_write(struct omap_dm_timer *timer, 289static inline void __omap_dm_timer_write(struct omap_dm_timer *timer,
290 u32 reg, u32 val, int posted) 290 u32 reg, u32 val, int posted)
291{ 291{
292 if (posted) 292 if (posted)
293 while (__raw_readl(timer->pend) & (reg >> WPSHIFT)) 293 while (readl_relaxed(timer->pend) & (reg >> WPSHIFT))
294 cpu_relax(); 294 cpu_relax();
295 295
296 __raw_writel(val, timer->func_base + (reg & 0xff)); 296 writel_relaxed(val, timer->func_base + (reg & 0xff));
297} 297}
298 298
299static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer) 299static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
@@ -301,7 +301,7 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
301 u32 tidr; 301 u32 tidr;
302 302
303 /* Assume v1 ip if bits [31:16] are zero */ 303 /* Assume v1 ip if bits [31:16] are zero */
304 tidr = __raw_readl(timer->io_base); 304 tidr = readl_relaxed(timer->io_base);
305 if (!(tidr >> 16)) { 305 if (!(tidr >> 16)) {
306 timer->revision = 1; 306 timer->revision = 1;
307 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET; 307 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET;
@@ -385,7 +385,7 @@ static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer,
385 } 385 }
386 386
387 /* Ack possibly pending interrupt */ 387 /* Ack possibly pending interrupt */
388 __raw_writel(OMAP_TIMER_INT_OVERFLOW, timer->irq_stat); 388 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, timer->irq_stat);
389} 389}
390 390
391static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer, 391static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer,
@@ -399,7 +399,7 @@ static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer,
399static inline void __omap_dm_timer_int_enable(struct omap_dm_timer *timer, 399static inline void __omap_dm_timer_int_enable(struct omap_dm_timer *timer,
400 unsigned int value) 400 unsigned int value)
401{ 401{
402 __raw_writel(value, timer->irq_ena); 402 writel_relaxed(value, timer->irq_ena);
403 __omap_dm_timer_write(timer, OMAP_TIMER_WAKEUP_EN_REG, value, 0); 403 __omap_dm_timer_write(timer, OMAP_TIMER_WAKEUP_EN_REG, value, 0);
404} 404}
405 405
@@ -412,7 +412,7 @@ __omap_dm_timer_read_counter(struct omap_dm_timer *timer, int posted)
412static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer, 412static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer,
413 unsigned int value) 413 unsigned int value)
414{ 414{
415 __raw_writel(value, timer->irq_stat); 415 writel_relaxed(value, timer->irq_stat);
416} 416}
417 417
418#endif /* __ASM_ARCH_DMTIMER_H */ 418#endif /* __ASM_ARCH_DMTIMER_H */
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 25c826ed3b65..5e5beaa9ae15 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -4,6 +4,9 @@
4# 4#
5# Licensed under GPLv2 5# Licensed under GPLv2
6 6
7ccflags-$(CONFIG_ARCH_MULTI_V7) += -I$(srctree)/$(src)/include
8ccflags-$(CONFIG_ARCH_EXYNOS) += -I$(srctree)/arch/arm/mach-exynos/include
9
7obj-y := 10obj-y :=
8obj-m := 11obj-m :=
9obj-n := dummy.o 12obj-n := dummy.o
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
index 7231c8e4975e..72d4178ad23b 100644
--- a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
@@ -119,6 +119,7 @@ struct s3c_plltab {
119struct s3c_cpufreq_config { 119struct s3c_cpufreq_config {
120 struct s3c_freq freq; 120 struct s3c_freq freq;
121 struct s3c_freq max; 121 struct s3c_freq max;
122 struct clk *mpll;
122 struct cpufreq_frequency_table pll; 123 struct cpufreq_frequency_table pll;
123 struct s3c_clkdivs divs; 124 struct s3c_clkdivs divs;
124 struct s3c_cpufreq_info *info; /* for core, not drivers */ 125 struct s3c_cpufreq_info *info; /* for core, not drivers */
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 5992b8dd9b89..5a237db9f9eb 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -43,16 +43,6 @@ extern unsigned long samsung_cpu_id;
43#define S5PV210_CPU_ID 0x43110000 43#define S5PV210_CPU_ID 0x43110000
44#define S5PV210_CPU_MASK 0xFFFFF000 44#define S5PV210_CPU_MASK 0xFFFFF000
45 45
46#define EXYNOS4210_CPU_ID 0x43210000
47#define EXYNOS4212_CPU_ID 0x43220000
48#define EXYNOS4412_CPU_ID 0xE4412200
49#define EXYNOS4_CPU_MASK 0xFFFE0000
50
51#define EXYNOS5250_SOC_ID 0x43520000
52#define EXYNOS5420_SOC_ID 0xE5420000
53#define EXYNOS5440_SOC_ID 0xE5440000
54#define EXYNOS5_SOC_MASK 0xFFFFF000
55
56#define IS_SAMSUNG_CPU(name, id, mask) \ 46#define IS_SAMSUNG_CPU(name, id, mask) \
57static inline int is_samsung_##name(void) \ 47static inline int is_samsung_##name(void) \
58{ \ 48{ \
@@ -68,12 +58,6 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
68IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) 58IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
69IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) 59IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
70IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK) 60IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
71IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
72IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
73IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
74IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
75IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
76IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
77 61
78#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 62#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
79 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ 63 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
@@ -126,50 +110,6 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
126# define soc_is_s5pv210() 0 110# define soc_is_s5pv210() 0
127#endif 111#endif
128 112
129#if defined(CONFIG_CPU_EXYNOS4210)
130# define soc_is_exynos4210() is_samsung_exynos4210()
131#else
132# define soc_is_exynos4210() 0
133#endif
134
135#if defined(CONFIG_SOC_EXYNOS4212)
136# define soc_is_exynos4212() is_samsung_exynos4212()
137#else
138# define soc_is_exynos4212() 0
139#endif
140
141#if defined(CONFIG_SOC_EXYNOS4412)
142# define soc_is_exynos4412() is_samsung_exynos4412()
143#else
144# define soc_is_exynos4412() 0
145#endif
146
147#define EXYNOS4210_REV_0 (0x0)
148#define EXYNOS4210_REV_1_0 (0x10)
149#define EXYNOS4210_REV_1_1 (0x11)
150
151#if defined(CONFIG_SOC_EXYNOS5250)
152# define soc_is_exynos5250() is_samsung_exynos5250()
153#else
154# define soc_is_exynos5250() 0
155#endif
156
157#if defined(CONFIG_SOC_EXYNOS5420)
158# define soc_is_exynos5420() is_samsung_exynos5420()
159#else
160# define soc_is_exynos5420() 0
161#endif
162
163#if defined(CONFIG_SOC_EXYNOS5440)
164# define soc_is_exynos5440() is_samsung_exynos5440()
165#else
166# define soc_is_exynos5440() 0
167#endif
168
169#define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \
170 soc_is_exynos4412())
171#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5420())
172
173#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } 113#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
174 114
175#ifndef KHZ 115#ifndef KHZ
@@ -239,7 +179,6 @@ extern struct bus_type s3c2443_subsys;
239extern struct bus_type s3c6410_subsys; 179extern struct bus_type s3c6410_subsys;
240extern struct bus_type s5p64x0_subsys; 180extern struct bus_type s5p64x0_subsys;
241extern struct bus_type s5pv210_subsys; 181extern struct bus_type s5pv210_subsys;
242extern struct bus_type exynos_subsys;
243 182
244extern void (*s5pc1xx_idle)(void); 183extern void (*s5pc1xx_idle)(void);
245 184
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 2c4332b9f948..fce41e93b6a4 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -6,12 +6,6 @@ config PLAT_VERSATILE_CLOCK
6config PLAT_VERSATILE_CLCD 6config PLAT_VERSATILE_CLCD
7 bool 7 bool
8 8
9config PLAT_VERSATILE_LEDS
10 def_bool y if NEW_LEDS
11 depends on ARCH_REALVIEW || ARCH_VERSATILE
12 select LEDS_CLASS
13 select LEDS_TRIGGERS
14
15config PLAT_VERSATILE_SCHED_CLOCK 9config PLAT_VERSATILE_SCHED_CLOCK
16 def_bool y 10 def_bool y
17 11
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index f88d448b629c..2e0c472958ae 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -2,6 +2,5 @@ ccflags-$(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 4obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
5obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o
6obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o 5obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o
7obj-$(CONFIG_SMP) += headsmp.o platsmp.o 6obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c
deleted file mode 100644
index d2490d00b46c..000000000000
--- a/arch/arm/plat-versatile/leds.c
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * Driver for the 8 user LEDs found on the RealViews and Versatiles
3 * Based on DaVinci's DM365 board code
4 *
5 * License terms: GNU General Public License (GPL) version 2
6 * Author: Linus Walleij <triad@df.lth.se>
7 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/io.h>
11#include <linux/slab.h>
12#include <linux/leds.h>
13
14#include <mach/hardware.h>
15#include <mach/platform.h>
16
17#ifdef VERSATILE_SYS_BASE
18#define LEDREG (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
19#endif
20
21#ifdef REALVIEW_SYS_BASE
22#define LEDREG (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET)
23#endif
24
25struct versatile_led {
26 struct led_classdev cdev;
27 u8 mask;
28};
29
30/*
31 * The triggers lines up below will only be used if the
32 * LED triggers are compiled in.
33 */
34static const struct {
35 const char *name;
36 const char *trigger;
37} versatile_leds[] = {
38 { "versatile:0", "heartbeat", },
39 { "versatile:1", "mmc0", },
40 { "versatile:2", "cpu0" },
41 { "versatile:3", "cpu1" },
42 { "versatile:4", "cpu2" },
43 { "versatile:5", "cpu3" },
44 { "versatile:6", },
45 { "versatile:7", },
46};
47
48static void versatile_led_set(struct led_classdev *cdev,
49 enum led_brightness b)
50{
51 struct versatile_led *led = container_of(cdev,
52 struct versatile_led, cdev);
53 u32 reg = readl(LEDREG);
54
55 if (b != LED_OFF)
56 reg |= led->mask;
57 else
58 reg &= ~led->mask;
59 writel(reg, LEDREG);
60}
61
62static enum led_brightness versatile_led_get(struct led_classdev *cdev)
63{
64 struct versatile_led *led = container_of(cdev,
65 struct versatile_led, cdev);
66 u32 reg = readl(LEDREG);
67
68 return (reg & led->mask) ? LED_FULL : LED_OFF;
69}
70
71static int __init versatile_leds_init(void)
72{
73 int i;
74
75 /* All ON */
76 writel(0xff, LEDREG);
77 for (i = 0; i < ARRAY_SIZE(versatile_leds); i++) {
78 struct versatile_led *led;
79
80 led = kzalloc(sizeof(*led), GFP_KERNEL);
81 if (!led)
82 break;
83
84 led->cdev.name = versatile_leds[i].name;
85 led->cdev.brightness_set = versatile_led_set;
86 led->cdev.brightness_get = versatile_led_get;
87 led->cdev.default_trigger = versatile_leds[i].trigger;
88 led->mask = BIT(i);
89
90 if (led_classdev_register(NULL, &led->cdev) < 0) {
91 kfree(led);
92 break;
93 }
94 }
95
96 return 0;
97}
98
99/*
100 * Since we may have triggers on any subsystem, defer registration
101 * until after subsystem_init.
102 */
103fs_initcall(versatile_leds_init);
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index b96723e258a0..1e632430570b 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -339,6 +339,14 @@ static int __init xen_pm_init(void)
339} 339}
340late_initcall(xen_pm_init); 340late_initcall(xen_pm_init);
341 341
342
343/* empty stubs */
344void xen_arch_pre_suspend(void) { }
345void xen_arch_post_suspend(int suspend_cancelled) { }
346void xen_timer_resume(void) { }
347void xen_arch_resume(void) { }
348
349
342/* In the hypervisor.S file. */ 350/* In the hypervisor.S file. */
343EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op); 351EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);
344EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op); 352EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);
@@ -350,4 +358,5 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
350EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op); 358EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
351EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op); 359EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
352EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op); 360EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op);
361EXPORT_SYMBOL_GPL(HYPERVISOR_multicall);
353EXPORT_SYMBOL_GPL(privcmd_call); 362EXPORT_SYMBOL_GPL(privcmd_call);
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S
index d1cf7b7c2200..44e3a5f10c4c 100644
--- a/arch/arm/xen/hypercall.S
+++ b/arch/arm/xen/hypercall.S
@@ -89,6 +89,7 @@ HYPERCALL2(memory_op);
89HYPERCALL2(physdev_op); 89HYPERCALL2(physdev_op);
90HYPERCALL3(vcpu_op); 90HYPERCALL3(vcpu_op);
91HYPERCALL1(tmem_op); 91HYPERCALL1(tmem_op);
92HYPERCALL2(multicall);
92 93
93ENTRY(privcmd_call) 94ENTRY(privcmd_call)
94 stmdb sp!, {r4} 95 stmdb sp!, {r4}
diff --git a/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
index 2f2ecd217363..ac2cb2418025 100644
--- a/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
+++ b/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
@@ -200,7 +200,7 @@
200 }; 200 };
201 201
202 mcc { 202 mcc {
203 compatible = "arm,vexpress,config-bus", "simple-bus"; 203 compatible = "arm,vexpress,config-bus";
204 arm,vexpress,config-bridge = <&v2m_sysreg>; 204 arm,vexpress,config-bridge = <&v2m_sysreg>;
205 205
206 v2m_oscclk1: osc@1 { 206 v2m_oscclk1: osc@1 {
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index e94f9458aa6f..993bce527b85 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -138,6 +138,7 @@ static inline void *phys_to_virt(phys_addr_t x)
138#define __pa(x) __virt_to_phys((unsigned long)(x)) 138#define __pa(x) __virt_to_phys((unsigned long)(x))
139#define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) 139#define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x)))
140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
141#define virt_to_pfn(x) __phys_to_pfn(__virt_to_phys(x))
141 142
142/* 143/*
143 * virt_to_page(k) convert a _valid_ virtual address to struct page * 144 * virt_to_page(k) convert a _valid_ virtual address to struct page *
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 90c811f05a2e..7b1c67a0b485 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -266,7 +266,7 @@ static inline pmd_t pte_pmd(pte_t pte)
266 266
267#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK)) 267#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
268 268
269#define set_pmd_at(mm, addr, pmdp, pmd) set_pmd(pmdp, pmd) 269#define set_pmd_at(mm, addr, pmdp, pmd) set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd))
270 270
271static inline int has_transparent_hugepage(void) 271static inline int has_transparent_hugepage(void)
272{ 272{
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c
index 473e5dbf8f39..0f08dfd69ebc 100644
--- a/arch/arm64/kernel/irq.c
+++ b/arch/arm64/kernel/irq.c
@@ -97,11 +97,15 @@ static bool migrate_one_irq(struct irq_desc *desc)
97 if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) 97 if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
98 return false; 98 return false;
99 99
100 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { 100 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids)
101 affinity = cpu_online_mask;
102 ret = true; 101 ret = true;
103 }
104 102
103 /*
104 * when using forced irq_set_affinity we must ensure that the cpu
105 * being offlined is not present in the affinity mask, it may be
106 * selected as the target CPU otherwise
107 */
108 affinity = cpu_online_mask;
105 c = irq_data_get_irq_chip(d); 109 c = irq_data_get_irq_chip(d);
106 if (!c->irq_set_affinity) 110 if (!c->irq_set_affinity)
107 pr_debug("IRQ%u: unable to set affinity\n", d->irq); 111 pr_debug("IRQ%u: unable to set affinity\n", d->irq);
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 5e9aec358306..31eb959e9aa8 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -51,7 +51,11 @@ int pmd_huge(pmd_t pmd)
51 51
52int pud_huge(pud_t pud) 52int pud_huge(pud_t pud)
53{ 53{
54#ifndef __PAGETABLE_PMD_FOLDED
54 return !(pud_val(pud) & PUD_TABLE_BIT); 55 return !(pud_val(pud) & PUD_TABLE_BIT);
56#else
57 return 0;
58#endif
55} 59}
56 60
57int pmd_huge_support(void) 61int pmd_huge_support(void)
diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S
index 531342ec4bcf..8bbe9401f4f0 100644
--- a/arch/arm64/xen/hypercall.S
+++ b/arch/arm64/xen/hypercall.S
@@ -80,6 +80,7 @@ HYPERCALL2(memory_op);
80HYPERCALL2(physdev_op); 80HYPERCALL2(physdev_op);
81HYPERCALL3(vcpu_op); 81HYPERCALL3(vcpu_op);
82HYPERCALL1(tmem_op); 82HYPERCALL1(tmem_op);
83HYPERCALL2(multicall);
83 84
84ENTRY(privcmd_call) 85ENTRY(privcmd_call)
85 mov x16, x0 86 mov x16, x0
diff --git a/arch/blackfin/include/asm/pci.h b/arch/blackfin/include/asm/pci.h
index 74352c4597d9..c737909fba47 100644
--- a/arch/blackfin/include/asm/pci.h
+++ b/arch/blackfin/include/asm/pci.h
@@ -10,9 +10,4 @@
10#define PCIBIOS_MIN_IO 0x00001000 10#define PCIBIOS_MIN_IO 0x00001000
11#define PCIBIOS_MIN_MEM 0x10000000 11#define PCIBIOS_MIN_MEM 0x10000000
12 12
13static inline void pcibios_penalize_isa_irq(int irq)
14{
15 /* We don't do dynamic PCI IRQ allocation */
16}
17
18#endif /* _ASM_BFIN_PCI_H */ 13#endif /* _ASM_BFIN_PCI_H */
diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h
index f666734926d5..cc2399c175e9 100644
--- a/arch/cris/include/asm/pci.h
+++ b/arch/cris/include/asm/pci.h
@@ -20,7 +20,6 @@ void pcibios_config_init(void);
20struct pci_bus * pcibios_scan_root(int bus); 20struct pci_bus * pcibios_scan_root(int bus);
21 21
22void pcibios_set_master(struct pci_dev *dev); 22void pcibios_set_master(struct pci_dev *dev);
23void pcibios_penalize_isa_irq(int irq);
24struct irq_routing_table *pcibios_get_irq_routing_table(void); 23struct irq_routing_table *pcibios_get_irq_routing_table(void);
25int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); 24int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
26 25
diff --git a/arch/frv/include/asm/pci.h b/arch/frv/include/asm/pci.h
index ef03baf5d89d..2035a4d3f9b9 100644
--- a/arch/frv/include/asm/pci.h
+++ b/arch/frv/include/asm/pci.h
@@ -24,8 +24,6 @@ struct pci_dev;
24 24
25extern void pcibios_set_master(struct pci_dev *dev); 25extern void pcibios_set_master(struct pci_dev *dev);
26 26
27extern void pcibios_penalize_isa_irq(int irq);
28
29#ifdef CONFIG_MMU 27#ifdef CONFIG_MMU
30extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle); 28extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
31extern void consistent_free(void *vaddr); 29extern void consistent_free(void *vaddr);
diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c
index c677b9d81d30..1c35c93f942b 100644
--- a/arch/frv/mb93090-mb00/pci-irq.c
+++ b/arch/frv/mb93090-mb00/pci-irq.c
@@ -55,10 +55,6 @@ void __init pcibios_fixup_irqs(void)
55 } 55 }
56} 56}
57 57
58void __init pcibios_penalize_isa_irq(int irq)
59{
60}
61
62void pcibios_enable_irq(struct pci_dev *dev) 58void pcibios_enable_irq(struct pci_dev *dev)
63{ 59{
64 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 60 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 7d41cc089822..52af5ed9f60b 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -50,12 +50,6 @@ struct pci_dev;
50extern unsigned long ia64_max_iommu_merge_mask; 50extern unsigned long ia64_max_iommu_merge_mask;
51#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL) 51#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL)
52 52
53static inline void
54pcibios_penalize_isa_irq (int irq, int active)
55{
56 /* We don't do dynamic PCI IRQ allocation */
57}
58
59#include <asm-generic/pci-dma-compat.h> 53#include <asm-generic/pci-dma-compat.h>
60 54
61#ifdef CONFIG_PCI 55#ifdef CONFIG_PCI
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index ae763d8bf55a..fb13dc5e8f8c 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -11,7 +11,7 @@
11 11
12 12
13 13
14#define NR_syscalls 314 /* length of syscall table */ 14#define NR_syscalls 315 /* length of syscall table */
15 15
16/* 16/*
17 * The following defines stop scripts/checksyscalls.sh from complaining about 17 * The following defines stop scripts/checksyscalls.sh from complaining about
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index 715e85f858de..7de0a2d65da4 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -327,5 +327,6 @@
327#define __NR_finit_module 1335 327#define __NR_finit_module 1335
328#define __NR_sched_setattr 1336 328#define __NR_sched_setattr 1336
329#define __NR_sched_getattr 1337 329#define __NR_sched_getattr 1337
330#define __NR_renameat2 1338
330 331
331#endif /* _UAPI_ASM_IA64_UNISTD_H */ 332#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index fa8d61a312a7..ba3d03503e84 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1775,6 +1775,7 @@ sys_call_table:
1775 data8 sys_finit_module // 1335 1775 data8 sys_finit_module // 1335
1776 data8 sys_sched_setattr 1776 data8 sys_sched_setattr
1777 data8 sys_sched_getattr 1777 data8 sys_sched_getattr
1778 data8 sys_renameat2
1778 1779
1779 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1780 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
1780#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ 1781#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index eee069a0b539..1fe9aa5068ea 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -49,9 +49,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
49 * type BRIDGE, or CARDBUS. Host to PCI controllers use 49 * type BRIDGE, or CARDBUS. Host to PCI controllers use
50 * PCI header type NORMAL. 50 * PCI header type NORMAL.
51 */ 51 */
52 if (bridge 52 if (bridge && (pci_is_bridge(bridge))) {
53 &&((bridge->hdr_type == PCI_HEADER_TYPE_BRIDGE)
54 ||(bridge->hdr_type == PCI_HEADER_TYPE_CARDBUS))) {
55 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, 53 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
56 &config); 54 &config);
57 if (!(config & PCI_BRIDGE_CTL_VGA)) 55 if (!(config & PCI_BRIDGE_CTL_VGA))
diff --git a/arch/m68k/Kconfig.debug b/arch/m68k/Kconfig.debug
index 229682721240..64776d7ac199 100644
--- a/arch/m68k/Kconfig.debug
+++ b/arch/m68k/Kconfig.debug
@@ -12,12 +12,17 @@ config BOOTPARAM_STRING
12 12
13config EARLY_PRINTK 13config EARLY_PRINTK
14 bool "Early printk" 14 bool "Early printk"
15 depends on MVME16x || MAC 15 depends on !(SUN3 || M68360 || M68000 || COLDFIRE)
16 help 16 help
17 Write kernel log output directly to a serial port. 17 Write kernel log output directly to a serial port.
18 Where implemented, output goes to the framebuffer as well.
19 PROM console functionality on Sun 3x is not affected by this option.
20
21 Pass "earlyprintk" on the kernel command line to get a
22 boot console.
18 23
19 This is useful for kernel debugging when your machine crashes very 24 This is useful for kernel debugging when your machine crashes very
20 early before the console code is initialized. 25 early, i.e. before the normal console driver is loaded.
21 You should normally say N here, unless you want to debug such a crash. 26 You should normally say N here, unless you want to debug such a crash.
22 27
23if !MMU 28if !MMU
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index 2559eefc6aff..90a60d758f8b 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -51,7 +51,7 @@ void __init amiga_init_sound(void)
51 51
52 snd_data = amiga_chip_alloc_res(sizeof(sine_data), &beep_res); 52 snd_data = amiga_chip_alloc_res(sizeof(sine_data), &beep_res);
53 if (!snd_data) { 53 if (!snd_data) {
54 printk (KERN_CRIT "amiga init_sound: failed to allocate chipmem\n"); 54 pr_crit("amiga init_sound: failed to allocate chipmem\n");
55 return; 55 return;
56 } 56 }
57 memcpy (snd_data, sine_data, sizeof(sine_data)); 57 memcpy (snd_data, sine_data, sizeof(sine_data));
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 9625b7132227..01693df7f2f6 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -183,7 +183,7 @@ int __init amiga_parse_bootinfo(const struct bi_record *record)
183 dev->boardaddr = be32_to_cpu(cd->cd_BoardAddr); 183 dev->boardaddr = be32_to_cpu(cd->cd_BoardAddr);
184 dev->boardsize = be32_to_cpu(cd->cd_BoardSize); 184 dev->boardsize = be32_to_cpu(cd->cd_BoardSize);
185 } else 185 } else
186 printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); 186 pr_warn("amiga_parse_bootinfo: too many AutoConfig devices\n");
187#endif /* CONFIG_ZORRO */ 187#endif /* CONFIG_ZORRO */
188 break; 188 break;
189 189
@@ -209,9 +209,9 @@ static void __init amiga_identify(void)
209 209
210 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present)); 210 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
211 211
212 printk("Amiga hardware found: "); 212 pr_info("Amiga hardware found: ");
213 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) { 213 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
214 printk("[%s] ", amiga_models[amiga_model-AMI_500]); 214 pr_cont("[%s] ", amiga_models[amiga_model-AMI_500]);
215 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]); 215 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
216 } 216 }
217 217
@@ -322,7 +322,7 @@ static void __init amiga_identify(void)
322 322
323#define AMIGAHW_ANNOUNCE(name, str) \ 323#define AMIGAHW_ANNOUNCE(name, str) \
324 if (AMIGAHW_PRESENT(name)) \ 324 if (AMIGAHW_PRESENT(name)) \
325 printk(str) 325 pr_cont(str)
326 326
327 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO "); 327 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
328 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER "); 328 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
@@ -354,8 +354,8 @@ static void __init amiga_identify(void)
354 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK "); 354 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
355 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA "); 355 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
356 if (AMIGAHW_PRESENT(ZORRO)) 356 if (AMIGAHW_PRESENT(ZORRO))
357 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : ""); 357 pr_cont("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
358 printk("\n"); 358 pr_cont("\n");
359 359
360#undef AMIGAHW_ANNOUNCE 360#undef AMIGAHW_ANNOUNCE
361} 361}
@@ -424,7 +424,7 @@ void __init config_amiga(void)
424 if (m68k_memory[i].addr < 16*1024*1024) { 424 if (m68k_memory[i].addr < 16*1024*1024) {
425 if (i == 0) { 425 if (i == 0) {
426 /* don't cut off the branch we're sitting on */ 426 /* don't cut off the branch we're sitting on */
427 printk("Warning: kernel runs in Zorro II memory\n"); 427 pr_warn("Warning: kernel runs in Zorro II memory\n");
428 continue; 428 continue;
429 } 429 }
430 disabled_z2mem += m68k_memory[i].size; 430 disabled_z2mem += m68k_memory[i].size;
@@ -435,8 +435,8 @@ void __init config_amiga(void)
435 } 435 }
436 } 436 }
437 if (disabled_z2mem) 437 if (disabled_z2mem)
438 printk("%dK of Zorro II memory will not be used as system memory\n", 438 pr_info("%dK of Zorro II memory will not be used as system memory\n",
439 disabled_z2mem>>10); 439 disabled_z2mem>>10);
440 } 440 }
441 441
442 /* request all RAM */ 442 /* request all RAM */
@@ -475,7 +475,7 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
475 jiffy_ticks = DIV_ROUND_CLOSEST(amiga_eclock, HZ); 475 jiffy_ticks = DIV_ROUND_CLOSEST(amiga_eclock, HZ);
476 476
477 if (request_resource(&mb_resources._ciab, &sched_res)) 477 if (request_resource(&mb_resources._ciab, &sched_res))
478 printk("Cannot allocate ciab.ta{lo,hi}\n"); 478 pr_warn("Cannot allocate ciab.ta{lo,hi}\n");
479 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */ 479 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
480 ciab.talo = jiffy_ticks % 256; 480 ciab.talo = jiffy_ticks % 256;
481 ciab.tahi = jiffy_ticks / 256; 481 ciab.tahi = jiffy_ticks / 256;
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index 9268c0f96376..6e62d66c396e 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -65,8 +65,8 @@ int __init apollo_parse_bootinfo(const struct bi_record *record)
65 65
66static void __init dn_setup_model(void) 66static void __init dn_setup_model(void)
67{ 67{
68 printk("Apollo hardware found: "); 68 pr_info("Apollo hardware found: [%s]\n",
69 printk("[%s]\n", apollo_models[apollo_model - APOLLO_DN3000]); 69 apollo_models[apollo_model - APOLLO_DN3000]);
70 70
71 switch(apollo_model) { 71 switch(apollo_model) {
72 case APOLLO_UNKNOWN: 72 case APOLLO_UNKNOWN:
@@ -197,8 +197,10 @@ void dn_sched_init(irq_handler_t timer_routine)
197 *(volatile unsigned char *)(pica+1)&=(~8); 197 *(volatile unsigned char *)(pica+1)&=(~8);
198 198
199#if 0 199#if 0
200 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(apollo_timer + 0x3)); 200 pr_info("*(0x10803) %02x\n",
201 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(apollo_timer + 0x3)); 201 *(volatile unsigned char *)(apollo_timer + 0x3));
202 pr_info("*(0x10803) %02x\n",
203 *(volatile unsigned char *)(apollo_timer + 0x3));
202#endif 204#endif
203 205
204 if (request_irq(IRQ_APOLLO, dn_timer_int, 0, "time", timer_routine)) 206 if (request_irq(IRQ_APOLLO, dn_timer_int, 0, "time", timer_routine))
@@ -236,12 +238,10 @@ int dn_dummy_hwclk(int op, struct rtc_time *t) {
236 238
237} 239}
238 240
239int dn_dummy_set_clock_mmss(unsigned long nowtime) { 241int dn_dummy_set_clock_mmss(unsigned long nowtime)
240 242{
241 printk("set_clock_mmss\n"); 243 pr_info("set_clock_mmss\n");
242 244 return 0;
243 return 0;
244
245} 245}
246 246
247void dn_dummy_reset(void) { 247void dn_dummy_reset(void) {
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 0810c8d56e59..5f8cb5a234d9 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -47,6 +47,7 @@ static struct resource stram_pool = {
47 47
48static unsigned long pool_size = 1024*1024; 48static unsigned long pool_size = 1024*1024;
49 49
50static unsigned long stram_virt_offset;
50 51
51static int __init atari_stram_setup(char *arg) 52static int __init atari_stram_setup(char *arg)
52{ 53{
@@ -67,14 +68,12 @@ early_param("stram_pool", atari_stram_setup);
67void __init atari_stram_init(void) 68void __init atari_stram_init(void)
68{ 69{
69 int i; 70 int i;
70 void *stram_start;
71 71
72 /* 72 /*
73 * determine whether kernel code resides in ST-RAM 73 * determine whether kernel code resides in ST-RAM
74 * (then ST-RAM is the first memory block at virtual 0x0) 74 * (then ST-RAM is the first memory block at virtual 0x0)
75 */ 75 */
76 stram_start = phys_to_virt(0); 76 kernel_in_stram = (m68k_memory[0].addr == 0);
77 kernel_in_stram = (stram_start == 0);
78 77
79 for (i = 0; i < m68k_num_memory; ++i) { 78 for (i = 0; i < m68k_num_memory; ++i) {
80 if (m68k_memory[i].addr == 0) { 79 if (m68k_memory[i].addr == 0) {
@@ -89,24 +88,62 @@ void __init atari_stram_init(void)
89 88
90/* 89/*
91 * This function is called from setup_arch() to reserve the pages needed for 90 * This function is called from setup_arch() to reserve the pages needed for
92 * ST-RAM management. 91 * ST-RAM management, if the kernel resides in ST-RAM.
93 */ 92 */
94void __init atari_stram_reserve_pages(void *start_mem) 93void __init atari_stram_reserve_pages(void *start_mem)
95{ 94{
96 /* 95 if (kernel_in_stram) {
97 * always reserve first page of ST-RAM, the first 2 KiB are 96 pr_debug("atari_stram pool: kernel in ST-RAM, using alloc_bootmem!\n");
98 * supervisor-only! 97 stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size);
99 */ 98 stram_pool.end = stram_pool.start + pool_size - 1;
100 if (!kernel_in_stram) 99 request_resource(&iomem_resource, &stram_pool);
101 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT); 100 stram_virt_offset = 0;
101 pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
102 pool_size, &stram_pool);
103 pr_debug("atari_stram pool: stram_virt_offset = %lx\n",
104 stram_virt_offset);
105 }
106}
102 107
103 stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size);
104 stram_pool.end = stram_pool.start + pool_size - 1;
105 request_resource(&iomem_resource, &stram_pool);
106 108
107 pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n", 109/*
108 pool_size, &stram_pool); 110 * This function is called as arch initcall to reserve the pages needed for
111 * ST-RAM management, if the kernel does not reside in ST-RAM.
112 */
113int __init atari_stram_map_pages(void)
114{
115 if (!kernel_in_stram) {
116 /*
117 * Skip page 0, as the fhe first 2 KiB are supervisor-only!
118 */
119 pr_debug("atari_stram pool: kernel not in ST-RAM, using ioremap!\n");
120 stram_pool.start = PAGE_SIZE;
121 stram_pool.end = stram_pool.start + pool_size - 1;
122 request_resource(&iomem_resource, &stram_pool);
123 stram_virt_offset = (unsigned long) ioremap(stram_pool.start,
124 resource_size(&stram_pool)) - stram_pool.start;
125 pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
126 pool_size, &stram_pool);
127 pr_debug("atari_stram pool: stram_virt_offset = %lx\n",
128 stram_virt_offset);
129 }
130 return 0;
131}
132arch_initcall(atari_stram_map_pages);
133
134
135void *atari_stram_to_virt(unsigned long phys)
136{
137 return (void *)(phys + stram_virt_offset);
138}
139EXPORT_SYMBOL(atari_stram_to_virt);
140
141
142unsigned long atari_stram_to_phys(void *virt)
143{
144 return (unsigned long)(virt - stram_virt_offset);
109} 145}
146EXPORT_SYMBOL(atari_stram_to_phys);
110 147
111 148
112void *atari_stram_alloc(unsigned long size, const char *owner) 149void *atari_stram_alloc(unsigned long size, const char *owner)
@@ -134,14 +171,14 @@ void *atari_stram_alloc(unsigned long size, const char *owner)
134 } 171 }
135 172
136 pr_debug("atari_stram_alloc: returning %pR\n", res); 173 pr_debug("atari_stram_alloc: returning %pR\n", res);
137 return (void *)res->start; 174 return atari_stram_to_virt(res->start);
138} 175}
139EXPORT_SYMBOL(atari_stram_alloc); 176EXPORT_SYMBOL(atari_stram_alloc);
140 177
141 178
142void atari_stram_free(void *addr) 179void atari_stram_free(void *addr)
143{ 180{
144 unsigned long start = (unsigned long)addr; 181 unsigned long start = atari_stram_to_phys(addr);
145 struct resource *res; 182 struct resource *res;
146 unsigned long size; 183 unsigned long size;
147 184
diff --git a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_defconfig
index 96da4963d14b..d7eac833a94f 100644
--- a/arch/m68k/configs/amiga_defconfig
+++ b/arch/m68k/configs/amiga_defconfig
@@ -159,6 +159,7 @@ CONFIG_IP_SET_BITMAP_IP=m
159CONFIG_IP_SET_BITMAP_IPMAC=m 159CONFIG_IP_SET_BITMAP_IPMAC=m
160CONFIG_IP_SET_BITMAP_PORT=m 160CONFIG_IP_SET_BITMAP_PORT=m
161CONFIG_IP_SET_HASH_IP=m 161CONFIG_IP_SET_HASH_IP=m
162CONFIG_IP_SET_HASH_IPMARK=m
162CONFIG_IP_SET_HASH_IPPORT=m 163CONFIG_IP_SET_HASH_IPPORT=m
163CONFIG_IP_SET_HASH_IPPORTIP=m 164CONFIG_IP_SET_HASH_IPPORTIP=m
164CONFIG_IP_SET_HASH_IPPORTNET=m 165CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -227,6 +228,7 @@ CONFIG_DNS_RESOLVER=y
227CONFIG_BATMAN_ADV=m 228CONFIG_BATMAN_ADV=m
228CONFIG_BATMAN_ADV_DAT=y 229CONFIG_BATMAN_ADV_DAT=y
229CONFIG_BATMAN_ADV_NC=y 230CONFIG_BATMAN_ADV_NC=y
231CONFIG_BATMAN_ADV_MCAST=y
230CONFIG_NETLINK_DIAG=m 232CONFIG_NETLINK_DIAG=m
231CONFIG_NET_MPLS_GSO=m 233CONFIG_NET_MPLS_GSO=m
232# CONFIG_WIRELESS is not set 234# CONFIG_WIRELESS is not set
@@ -279,6 +281,7 @@ CONFIG_DM_CRYPT=m
279CONFIG_DM_SNAPSHOT=m 281CONFIG_DM_SNAPSHOT=m
280CONFIG_DM_THIN_PROVISIONING=m 282CONFIG_DM_THIN_PROVISIONING=m
281CONFIG_DM_CACHE=m 283CONFIG_DM_CACHE=m
284CONFIG_DM_ERA=m
282CONFIG_DM_MIRROR=m 285CONFIG_DM_MIRROR=m
283CONFIG_DM_RAID=m 286CONFIG_DM_RAID=m
284CONFIG_DM_ZERO=m 287CONFIG_DM_ZERO=m
@@ -305,7 +308,6 @@ CONFIG_VETH=m
305CONFIG_A2065=y 308CONFIG_A2065=y
306CONFIG_ARIADNE=y 309CONFIG_ARIADNE=y
307# CONFIG_NET_VENDOR_ARC is not set 310# CONFIG_NET_VENDOR_ARC is not set
308# CONFIG_NET_CADENCE is not set
309# CONFIG_NET_VENDOR_BROADCOM is not set 311# CONFIG_NET_VENDOR_BROADCOM is not set
310# CONFIG_NET_VENDOR_CIRRUS is not set 312# CONFIG_NET_VENDOR_CIRRUS is not set
311# CONFIG_NET_VENDOR_HP is not set 313# CONFIG_NET_VENDOR_HP is not set
@@ -315,6 +317,7 @@ CONFIG_ARIADNE=y
315CONFIG_HYDRA=y 317CONFIG_HYDRA=y
316CONFIG_APNE=y 318CONFIG_APNE=y
317CONFIG_ZORRO8390=y 319CONFIG_ZORRO8390=y
320# CONFIG_NET_VENDOR_SAMSUNG is not set
318# CONFIG_NET_VENDOR_SEEQ is not set 321# CONFIG_NET_VENDOR_SEEQ is not set
319# CONFIG_NET_VENDOR_SMSC is not set 322# CONFIG_NET_VENDOR_SMSC is not set
320# CONFIG_NET_VENDOR_STMICRO is not set 323# CONFIG_NET_VENDOR_STMICRO is not set
diff --git a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_defconfig
index 1b8739f50cbf..650ee75de6cd 100644
--- a/arch/m68k/configs/apollo_defconfig
+++ b/arch/m68k/configs/apollo_defconfig
@@ -157,6 +157,7 @@ CONFIG_IP_SET_BITMAP_IP=m
157CONFIG_IP_SET_BITMAP_IPMAC=m 157CONFIG_IP_SET_BITMAP_IPMAC=m
158CONFIG_IP_SET_BITMAP_PORT=m 158CONFIG_IP_SET_BITMAP_PORT=m
159CONFIG_IP_SET_HASH_IP=m 159CONFIG_IP_SET_HASH_IP=m
160CONFIG_IP_SET_HASH_IPMARK=m
160CONFIG_IP_SET_HASH_IPPORT=m 161CONFIG_IP_SET_HASH_IPPORT=m
161CONFIG_IP_SET_HASH_IPPORTIP=m 162CONFIG_IP_SET_HASH_IPPORTIP=m
162CONFIG_IP_SET_HASH_IPPORTNET=m 163CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -225,6 +226,7 @@ CONFIG_DNS_RESOLVER=y
225CONFIG_BATMAN_ADV=m 226CONFIG_BATMAN_ADV=m
226CONFIG_BATMAN_ADV_DAT=y 227CONFIG_BATMAN_ADV_DAT=y
227CONFIG_BATMAN_ADV_NC=y 228CONFIG_BATMAN_ADV_NC=y
229CONFIG_BATMAN_ADV_MCAST=y
228CONFIG_NETLINK_DIAG=m 230CONFIG_NETLINK_DIAG=m
229CONFIG_NET_MPLS_GSO=m 231CONFIG_NET_MPLS_GSO=m
230# CONFIG_WIRELESS is not set 232# CONFIG_WIRELESS is not set
@@ -261,6 +263,7 @@ CONFIG_DM_CRYPT=m
261CONFIG_DM_SNAPSHOT=m 263CONFIG_DM_SNAPSHOT=m
262CONFIG_DM_THIN_PROVISIONING=m 264CONFIG_DM_THIN_PROVISIONING=m
263CONFIG_DM_CACHE=m 265CONFIG_DM_CACHE=m
266CONFIG_DM_ERA=m
264CONFIG_DM_MIRROR=m 267CONFIG_DM_MIRROR=m
265CONFIG_DM_RAID=m 268CONFIG_DM_RAID=m
266CONFIG_DM_ZERO=m 269CONFIG_DM_ZERO=m
@@ -284,12 +287,12 @@ CONFIG_NETCONSOLE=m
284CONFIG_NETCONSOLE_DYNAMIC=y 287CONFIG_NETCONSOLE_DYNAMIC=y
285CONFIG_VETH=m 288CONFIG_VETH=m
286# CONFIG_NET_VENDOR_ARC is not set 289# CONFIG_NET_VENDOR_ARC is not set
287# CONFIG_NET_CADENCE is not set
288# CONFIG_NET_VENDOR_BROADCOM is not set 290# CONFIG_NET_VENDOR_BROADCOM is not set
289# CONFIG_NET_VENDOR_INTEL is not set 291# CONFIG_NET_VENDOR_INTEL is not set
290# CONFIG_NET_VENDOR_MARVELL is not set 292# CONFIG_NET_VENDOR_MARVELL is not set
291# CONFIG_NET_VENDOR_MICREL is not set 293# CONFIG_NET_VENDOR_MICREL is not set
292# CONFIG_NET_VENDOR_NATSEMI is not set 294# CONFIG_NET_VENDOR_NATSEMI is not set
295# CONFIG_NET_VENDOR_SAMSUNG is not set
293# CONFIG_NET_VENDOR_SEEQ is not set 296# CONFIG_NET_VENDOR_SEEQ is not set
294# CONFIG_NET_VENDOR_STMICRO is not set 297# CONFIG_NET_VENDOR_STMICRO is not set
295# CONFIG_NET_VENDOR_VIA is not set 298# CONFIG_NET_VENDOR_VIA is not set
diff --git a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_defconfig
index 6ea4e91f0caa..3142e69342fa 100644
--- a/arch/m68k/configs/atari_defconfig
+++ b/arch/m68k/configs/atari_defconfig
@@ -156,6 +156,7 @@ CONFIG_IP_SET_BITMAP_IP=m
156CONFIG_IP_SET_BITMAP_IPMAC=m 156CONFIG_IP_SET_BITMAP_IPMAC=m
157CONFIG_IP_SET_BITMAP_PORT=m 157CONFIG_IP_SET_BITMAP_PORT=m
158CONFIG_IP_SET_HASH_IP=m 158CONFIG_IP_SET_HASH_IP=m
159CONFIG_IP_SET_HASH_IPMARK=m
159CONFIG_IP_SET_HASH_IPPORT=m 160CONFIG_IP_SET_HASH_IPPORT=m
160CONFIG_IP_SET_HASH_IPPORTIP=m 161CONFIG_IP_SET_HASH_IPPORTIP=m
161CONFIG_IP_SET_HASH_IPPORTNET=m 162CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -224,6 +225,7 @@ CONFIG_DNS_RESOLVER=y
224CONFIG_BATMAN_ADV=m 225CONFIG_BATMAN_ADV=m
225CONFIG_BATMAN_ADV_DAT=y 226CONFIG_BATMAN_ADV_DAT=y
226CONFIG_BATMAN_ADV_NC=y 227CONFIG_BATMAN_ADV_NC=y
228CONFIG_BATMAN_ADV_MCAST=y
227CONFIG_NETLINK_DIAG=m 229CONFIG_NETLINK_DIAG=m
228CONFIG_NET_MPLS_GSO=m 230CONFIG_NET_MPLS_GSO=m
229# CONFIG_WIRELESS is not set 231# CONFIG_WIRELESS is not set
@@ -269,6 +271,7 @@ CONFIG_DM_CRYPT=m
269CONFIG_DM_SNAPSHOT=m 271CONFIG_DM_SNAPSHOT=m
270CONFIG_DM_THIN_PROVISIONING=m 272CONFIG_DM_THIN_PROVISIONING=m
271CONFIG_DM_CACHE=m 273CONFIG_DM_CACHE=m
274CONFIG_DM_ERA=m
272CONFIG_DM_MIRROR=m 275CONFIG_DM_MIRROR=m
273CONFIG_DM_RAID=m 276CONFIG_DM_RAID=m
274CONFIG_DM_ZERO=m 277CONFIG_DM_ZERO=m
@@ -293,11 +296,11 @@ CONFIG_NETCONSOLE_DYNAMIC=y
293CONFIG_VETH=m 296CONFIG_VETH=m
294CONFIG_ATARILANCE=y 297CONFIG_ATARILANCE=y
295# CONFIG_NET_VENDOR_ARC is not set 298# CONFIG_NET_VENDOR_ARC is not set
296# CONFIG_NET_CADENCE is not set
297# CONFIG_NET_VENDOR_BROADCOM is not set 299# CONFIG_NET_VENDOR_BROADCOM is not set
298# CONFIG_NET_VENDOR_INTEL is not set 300# CONFIG_NET_VENDOR_INTEL is not set
299# CONFIG_NET_VENDOR_MARVELL is not set 301# CONFIG_NET_VENDOR_MARVELL is not set
300# CONFIG_NET_VENDOR_MICREL is not set 302# CONFIG_NET_VENDOR_MICREL is not set
303# CONFIG_NET_VENDOR_SAMSUNG is not set
301# CONFIG_NET_VENDOR_SEEQ is not set 304# CONFIG_NET_VENDOR_SEEQ is not set
302# CONFIG_NET_VENDOR_STMICRO is not set 305# CONFIG_NET_VENDOR_STMICRO is not set
303# CONFIG_NET_VENDOR_VIA is not set 306# CONFIG_NET_VENDOR_VIA is not set
diff --git a/arch/m68k/configs/bvme6000_defconfig b/arch/m68k/configs/bvme6000_defconfig
index e5a12739ff2d..0daa8a172f30 100644
--- a/arch/m68k/configs/bvme6000_defconfig
+++ b/arch/m68k/configs/bvme6000_defconfig
@@ -155,6 +155,7 @@ CONFIG_IP_SET_BITMAP_IP=m
155CONFIG_IP_SET_BITMAP_IPMAC=m 155CONFIG_IP_SET_BITMAP_IPMAC=m
156CONFIG_IP_SET_BITMAP_PORT=m 156CONFIG_IP_SET_BITMAP_PORT=m
157CONFIG_IP_SET_HASH_IP=m 157CONFIG_IP_SET_HASH_IP=m
158CONFIG_IP_SET_HASH_IPMARK=m
158CONFIG_IP_SET_HASH_IPPORT=m 159CONFIG_IP_SET_HASH_IPPORT=m
159CONFIG_IP_SET_HASH_IPPORTIP=m 160CONFIG_IP_SET_HASH_IPPORTIP=m
160CONFIG_IP_SET_HASH_IPPORTNET=m 161CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -223,6 +224,7 @@ CONFIG_DNS_RESOLVER=y
223CONFIG_BATMAN_ADV=m 224CONFIG_BATMAN_ADV=m
224CONFIG_BATMAN_ADV_DAT=y 225CONFIG_BATMAN_ADV_DAT=y
225CONFIG_BATMAN_ADV_NC=y 226CONFIG_BATMAN_ADV_NC=y
227CONFIG_BATMAN_ADV_MCAST=y
226CONFIG_NETLINK_DIAG=m 228CONFIG_NETLINK_DIAG=m
227CONFIG_NET_MPLS_GSO=m 229CONFIG_NET_MPLS_GSO=m
228# CONFIG_WIRELESS is not set 230# CONFIG_WIRELESS is not set
@@ -260,6 +262,7 @@ CONFIG_DM_CRYPT=m
260CONFIG_DM_SNAPSHOT=m 262CONFIG_DM_SNAPSHOT=m
261CONFIG_DM_THIN_PROVISIONING=m 263CONFIG_DM_THIN_PROVISIONING=m
262CONFIG_DM_CACHE=m 264CONFIG_DM_CACHE=m
265CONFIG_DM_ERA=m
263CONFIG_DM_MIRROR=m 266CONFIG_DM_MIRROR=m
264CONFIG_DM_RAID=m 267CONFIG_DM_RAID=m
265CONFIG_DM_ZERO=m 268CONFIG_DM_ZERO=m
@@ -283,12 +286,12 @@ CONFIG_NETCONSOLE=m
283CONFIG_NETCONSOLE_DYNAMIC=y 286CONFIG_NETCONSOLE_DYNAMIC=y
284CONFIG_VETH=m 287CONFIG_VETH=m
285# CONFIG_NET_VENDOR_ARC is not set 288# CONFIG_NET_VENDOR_ARC is not set
286# CONFIG_NET_CADENCE is not set
287# CONFIG_NET_VENDOR_BROADCOM is not set 289# CONFIG_NET_VENDOR_BROADCOM is not set
288CONFIG_BVME6000_NET=y 290CONFIG_BVME6000_NET=y
289# CONFIG_NET_VENDOR_MARVELL is not set 291# CONFIG_NET_VENDOR_MARVELL is not set
290# CONFIG_NET_VENDOR_MICREL is not set 292# CONFIG_NET_VENDOR_MICREL is not set
291# CONFIG_NET_VENDOR_NATSEMI is not set 293# CONFIG_NET_VENDOR_NATSEMI is not set
294# CONFIG_NET_VENDOR_SAMSUNG is not set
292# CONFIG_NET_VENDOR_SEEQ is not set 295# CONFIG_NET_VENDOR_SEEQ is not set
293# CONFIG_NET_VENDOR_STMICRO is not set 296# CONFIG_NET_VENDOR_STMICRO is not set
294# CONFIG_NET_VENDOR_VIA is not set 297# CONFIG_NET_VENDOR_VIA is not set
diff --git a/arch/m68k/configs/hp300_defconfig b/arch/m68k/configs/hp300_defconfig
index 8936d7fb0f0f..88af78f7bad9 100644
--- a/arch/m68k/configs/hp300_defconfig
+++ b/arch/m68k/configs/hp300_defconfig
@@ -157,6 +157,7 @@ CONFIG_IP_SET_BITMAP_IP=m
157CONFIG_IP_SET_BITMAP_IPMAC=m 157CONFIG_IP_SET_BITMAP_IPMAC=m
158CONFIG_IP_SET_BITMAP_PORT=m 158CONFIG_IP_SET_BITMAP_PORT=m
159CONFIG_IP_SET_HASH_IP=m 159CONFIG_IP_SET_HASH_IP=m
160CONFIG_IP_SET_HASH_IPMARK=m
160CONFIG_IP_SET_HASH_IPPORT=m 161CONFIG_IP_SET_HASH_IPPORT=m
161CONFIG_IP_SET_HASH_IPPORTIP=m 162CONFIG_IP_SET_HASH_IPPORTIP=m
162CONFIG_IP_SET_HASH_IPPORTNET=m 163CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -225,6 +226,7 @@ CONFIG_DNS_RESOLVER=y
225CONFIG_BATMAN_ADV=m 226CONFIG_BATMAN_ADV=m
226CONFIG_BATMAN_ADV_DAT=y 227CONFIG_BATMAN_ADV_DAT=y
227CONFIG_BATMAN_ADV_NC=y 228CONFIG_BATMAN_ADV_NC=y
229CONFIG_BATMAN_ADV_MCAST=y
228CONFIG_NETLINK_DIAG=m 230CONFIG_NETLINK_DIAG=m
229CONFIG_NET_MPLS_GSO=m 231CONFIG_NET_MPLS_GSO=m
230# CONFIG_WIRELESS is not set 232# CONFIG_WIRELESS is not set
@@ -261,6 +263,7 @@ CONFIG_DM_CRYPT=m
261CONFIG_DM_SNAPSHOT=m 263CONFIG_DM_SNAPSHOT=m
262CONFIG_DM_THIN_PROVISIONING=m 264CONFIG_DM_THIN_PROVISIONING=m
263CONFIG_DM_CACHE=m 265CONFIG_DM_CACHE=m
266CONFIG_DM_ERA=m
264CONFIG_DM_MIRROR=m 267CONFIG_DM_MIRROR=m
265CONFIG_DM_RAID=m 268CONFIG_DM_RAID=m
266CONFIG_DM_ZERO=m 269CONFIG_DM_ZERO=m
@@ -285,12 +288,12 @@ CONFIG_NETCONSOLE_DYNAMIC=y
285CONFIG_VETH=m 288CONFIG_VETH=m
286CONFIG_HPLANCE=y 289CONFIG_HPLANCE=y
287# CONFIG_NET_VENDOR_ARC is not set 290# CONFIG_NET_VENDOR_ARC is not set
288# CONFIG_NET_CADENCE is not set
289# CONFIG_NET_VENDOR_BROADCOM is not set 291# CONFIG_NET_VENDOR_BROADCOM is not set
290# CONFIG_NET_VENDOR_INTEL is not set 292# CONFIG_NET_VENDOR_INTEL is not set
291# CONFIG_NET_VENDOR_MARVELL is not set 293# CONFIG_NET_VENDOR_MARVELL is not set
292# CONFIG_NET_VENDOR_MICREL is not set 294# CONFIG_NET_VENDOR_MICREL is not set
293# CONFIG_NET_VENDOR_NATSEMI is not set 295# CONFIG_NET_VENDOR_NATSEMI is not set
296# CONFIG_NET_VENDOR_SAMSUNG is not set
294# CONFIG_NET_VENDOR_SEEQ is not set 297# CONFIG_NET_VENDOR_SEEQ is not set
295# CONFIG_NET_VENDOR_STMICRO is not set 298# CONFIG_NET_VENDOR_STMICRO is not set
296# CONFIG_NET_VENDOR_VIA is not set 299# CONFIG_NET_VENDOR_VIA is not set
diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig
index be5342cca25b..66f915574a85 100644
--- a/arch/m68k/configs/mac_defconfig
+++ b/arch/m68k/configs/mac_defconfig
@@ -156,6 +156,7 @@ CONFIG_IP_SET_BITMAP_IP=m
156CONFIG_IP_SET_BITMAP_IPMAC=m 156CONFIG_IP_SET_BITMAP_IPMAC=m
157CONFIG_IP_SET_BITMAP_PORT=m 157CONFIG_IP_SET_BITMAP_PORT=m
158CONFIG_IP_SET_HASH_IP=m 158CONFIG_IP_SET_HASH_IP=m
159CONFIG_IP_SET_HASH_IPMARK=m
159CONFIG_IP_SET_HASH_IPPORT=m 160CONFIG_IP_SET_HASH_IPPORT=m
160CONFIG_IP_SET_HASH_IPPORTIP=m 161CONFIG_IP_SET_HASH_IPPORTIP=m
161CONFIG_IP_SET_HASH_IPPORTNET=m 162CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -227,6 +228,7 @@ CONFIG_DNS_RESOLVER=y
227CONFIG_BATMAN_ADV=m 228CONFIG_BATMAN_ADV=m
228CONFIG_BATMAN_ADV_DAT=y 229CONFIG_BATMAN_ADV_DAT=y
229CONFIG_BATMAN_ADV_NC=y 230CONFIG_BATMAN_ADV_NC=y
231CONFIG_BATMAN_ADV_MCAST=y
230CONFIG_NETLINK_DIAG=m 232CONFIG_NETLINK_DIAG=m
231CONFIG_NET_MPLS_GSO=m 233CONFIG_NET_MPLS_GSO=m
232# CONFIG_WIRELESS is not set 234# CONFIG_WIRELESS is not set
@@ -270,6 +272,7 @@ CONFIG_DM_CRYPT=m
270CONFIG_DM_SNAPSHOT=m 272CONFIG_DM_SNAPSHOT=m
271CONFIG_DM_THIN_PROVISIONING=m 273CONFIG_DM_THIN_PROVISIONING=m
272CONFIG_DM_CACHE=m 274CONFIG_DM_CACHE=m
275CONFIG_DM_ERA=m
273CONFIG_DM_MIRROR=m 276CONFIG_DM_MIRROR=m
274CONFIG_DM_RAID=m 277CONFIG_DM_RAID=m
275CONFIG_DM_ZERO=m 278CONFIG_DM_ZERO=m
@@ -301,7 +304,6 @@ CONFIG_NETCONSOLE_DYNAMIC=y
301CONFIG_VETH=m 304CONFIG_VETH=m
302CONFIG_MACMACE=y 305CONFIG_MACMACE=y
303# CONFIG_NET_VENDOR_ARC is not set 306# CONFIG_NET_VENDOR_ARC is not set
304# CONFIG_NET_CADENCE is not set
305# CONFIG_NET_VENDOR_BROADCOM is not set 307# CONFIG_NET_VENDOR_BROADCOM is not set
306CONFIG_MAC89x0=y 308CONFIG_MAC89x0=y
307# CONFIG_NET_VENDOR_INTEL is not set 309# CONFIG_NET_VENDOR_INTEL is not set
@@ -309,6 +311,7 @@ CONFIG_MAC89x0=y
309# CONFIG_NET_VENDOR_MICREL is not set 311# CONFIG_NET_VENDOR_MICREL is not set
310CONFIG_MACSONIC=y 312CONFIG_MACSONIC=y
311CONFIG_MAC8390=y 313CONFIG_MAC8390=y
314# CONFIG_NET_VENDOR_SAMSUNG is not set
312# CONFIG_NET_VENDOR_SEEQ is not set 315# CONFIG_NET_VENDOR_SEEQ is not set
313# CONFIG_NET_VENDOR_SMSC is not set 316# CONFIG_NET_VENDOR_SMSC is not set
314# CONFIG_NET_VENDOR_STMICRO is not set 317# CONFIG_NET_VENDOR_STMICRO is not set
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
index f27194ade167..5eaa49924fa6 100644
--- a/arch/m68k/configs/multi_defconfig
+++ b/arch/m68k/configs/multi_defconfig
@@ -165,6 +165,7 @@ CONFIG_IP_SET_BITMAP_IP=m
165CONFIG_IP_SET_BITMAP_IPMAC=m 165CONFIG_IP_SET_BITMAP_IPMAC=m
166CONFIG_IP_SET_BITMAP_PORT=m 166CONFIG_IP_SET_BITMAP_PORT=m
167CONFIG_IP_SET_HASH_IP=m 167CONFIG_IP_SET_HASH_IP=m
168CONFIG_IP_SET_HASH_IPMARK=m
168CONFIG_IP_SET_HASH_IPPORT=m 169CONFIG_IP_SET_HASH_IPPORT=m
169CONFIG_IP_SET_HASH_IPPORTIP=m 170CONFIG_IP_SET_HASH_IPPORTIP=m
170CONFIG_IP_SET_HASH_IPPORTNET=m 171CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -236,6 +237,7 @@ CONFIG_DNS_RESOLVER=y
236CONFIG_BATMAN_ADV=m 237CONFIG_BATMAN_ADV=m
237CONFIG_BATMAN_ADV_DAT=y 238CONFIG_BATMAN_ADV_DAT=y
238CONFIG_BATMAN_ADV_NC=y 239CONFIG_BATMAN_ADV_NC=y
240CONFIG_BATMAN_ADV_MCAST=y
239CONFIG_NETLINK_DIAG=m 241CONFIG_NETLINK_DIAG=m
240CONFIG_NET_MPLS_GSO=m 242CONFIG_NET_MPLS_GSO=m
241# CONFIG_WIRELESS is not set 243# CONFIG_WIRELESS is not set
@@ -302,6 +304,7 @@ CONFIG_DM_CRYPT=m
302CONFIG_DM_SNAPSHOT=m 304CONFIG_DM_SNAPSHOT=m
303CONFIG_DM_THIN_PROVISIONING=m 305CONFIG_DM_THIN_PROVISIONING=m
304CONFIG_DM_CACHE=m 306CONFIG_DM_CACHE=m
307CONFIG_DM_ERA=m
305CONFIG_DM_MIRROR=m 308CONFIG_DM_MIRROR=m
306CONFIG_DM_RAID=m 309CONFIG_DM_RAID=m
307CONFIG_DM_ZERO=m 310CONFIG_DM_ZERO=m
@@ -340,7 +343,6 @@ CONFIG_MVME147_NET=y
340CONFIG_SUN3LANCE=y 343CONFIG_SUN3LANCE=y
341CONFIG_MACMACE=y 344CONFIG_MACMACE=y
342# CONFIG_NET_VENDOR_ARC is not set 345# CONFIG_NET_VENDOR_ARC is not set
343# CONFIG_NET_CADENCE is not set
344# CONFIG_NET_VENDOR_BROADCOM is not set 346# CONFIG_NET_VENDOR_BROADCOM is not set
345CONFIG_MAC89x0=y 347CONFIG_MAC89x0=y
346# CONFIG_NET_VENDOR_HP is not set 348# CONFIG_NET_VENDOR_HP is not set
@@ -354,6 +356,7 @@ CONFIG_MAC8390=y
354CONFIG_NE2000=m 356CONFIG_NE2000=m
355CONFIG_APNE=y 357CONFIG_APNE=y
356CONFIG_ZORRO8390=y 358CONFIG_ZORRO8390=y
359# CONFIG_NET_VENDOR_SAMSUNG is not set
357# CONFIG_NET_VENDOR_SEEQ is not set 360# CONFIG_NET_VENDOR_SEEQ is not set
358# CONFIG_NET_VENDOR_STMICRO is not set 361# CONFIG_NET_VENDOR_STMICRO is not set
359# CONFIG_NET_VENDOR_VIA is not set 362# CONFIG_NET_VENDOR_VIA is not set
diff --git a/arch/m68k/configs/mvme147_defconfig b/arch/m68k/configs/mvme147_defconfig
index c3887603c1db..324d0b4d8351 100644
--- a/arch/m68k/configs/mvme147_defconfig
+++ b/arch/m68k/configs/mvme147_defconfig
@@ -154,6 +154,7 @@ CONFIG_IP_SET_BITMAP_IP=m
154CONFIG_IP_SET_BITMAP_IPMAC=m 154CONFIG_IP_SET_BITMAP_IPMAC=m
155CONFIG_IP_SET_BITMAP_PORT=m 155CONFIG_IP_SET_BITMAP_PORT=m
156CONFIG_IP_SET_HASH_IP=m 156CONFIG_IP_SET_HASH_IP=m
157CONFIG_IP_SET_HASH_IPMARK=m
157CONFIG_IP_SET_HASH_IPPORT=m 158CONFIG_IP_SET_HASH_IPPORT=m
158CONFIG_IP_SET_HASH_IPPORTIP=m 159CONFIG_IP_SET_HASH_IPPORTIP=m
159CONFIG_IP_SET_HASH_IPPORTNET=m 160CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -222,6 +223,7 @@ CONFIG_DNS_RESOLVER=y
222CONFIG_BATMAN_ADV=m 223CONFIG_BATMAN_ADV=m
223CONFIG_BATMAN_ADV_DAT=y 224CONFIG_BATMAN_ADV_DAT=y
224CONFIG_BATMAN_ADV_NC=y 225CONFIG_BATMAN_ADV_NC=y
226CONFIG_BATMAN_ADV_MCAST=y
225CONFIG_NETLINK_DIAG=m 227CONFIG_NETLINK_DIAG=m
226CONFIG_NET_MPLS_GSO=m 228CONFIG_NET_MPLS_GSO=m
227# CONFIG_WIRELESS is not set 229# CONFIG_WIRELESS is not set
@@ -259,6 +261,7 @@ CONFIG_DM_CRYPT=m
259CONFIG_DM_SNAPSHOT=m 261CONFIG_DM_SNAPSHOT=m
260CONFIG_DM_THIN_PROVISIONING=m 262CONFIG_DM_THIN_PROVISIONING=m
261CONFIG_DM_CACHE=m 263CONFIG_DM_CACHE=m
264CONFIG_DM_ERA=m
262CONFIG_DM_MIRROR=m 265CONFIG_DM_MIRROR=m
263CONFIG_DM_RAID=m 266CONFIG_DM_RAID=m
264CONFIG_DM_ZERO=m 267CONFIG_DM_ZERO=m
@@ -283,12 +286,12 @@ CONFIG_NETCONSOLE_DYNAMIC=y
283CONFIG_VETH=m 286CONFIG_VETH=m
284CONFIG_MVME147_NET=y 287CONFIG_MVME147_NET=y
285# CONFIG_NET_VENDOR_ARC is not set 288# CONFIG_NET_VENDOR_ARC is not set
286# CONFIG_NET_CADENCE is not set
287# CONFIG_NET_VENDOR_BROADCOM is not set 289# CONFIG_NET_VENDOR_BROADCOM is not set
288# CONFIG_NET_VENDOR_INTEL is not set 290# CONFIG_NET_VENDOR_INTEL is not set
289# CONFIG_NET_VENDOR_MARVELL is not set 291# CONFIG_NET_VENDOR_MARVELL is not set
290# CONFIG_NET_VENDOR_MICREL is not set 292# CONFIG_NET_VENDOR_MICREL is not set
291# CONFIG_NET_VENDOR_NATSEMI is not set 293# CONFIG_NET_VENDOR_NATSEMI is not set
294# CONFIG_NET_VENDOR_SAMSUNG is not set
292# CONFIG_NET_VENDOR_SEEQ is not set 295# CONFIG_NET_VENDOR_SEEQ is not set
293# CONFIG_NET_VENDOR_STMICRO is not set 296# CONFIG_NET_VENDOR_STMICRO is not set
294# CONFIG_NET_VENDOR_VIA is not set 297# CONFIG_NET_VENDOR_VIA is not set
diff --git a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16x_defconfig
index f7ff784d05ac..f0cb4338952e 100644
--- a/arch/m68k/configs/mvme16x_defconfig
+++ b/arch/m68k/configs/mvme16x_defconfig
@@ -155,6 +155,7 @@ CONFIG_IP_SET_BITMAP_IP=m
155CONFIG_IP_SET_BITMAP_IPMAC=m 155CONFIG_IP_SET_BITMAP_IPMAC=m
156CONFIG_IP_SET_BITMAP_PORT=m 156CONFIG_IP_SET_BITMAP_PORT=m
157CONFIG_IP_SET_HASH_IP=m 157CONFIG_IP_SET_HASH_IP=m
158CONFIG_IP_SET_HASH_IPMARK=m
158CONFIG_IP_SET_HASH_IPPORT=m 159CONFIG_IP_SET_HASH_IPPORT=m
159CONFIG_IP_SET_HASH_IPPORTIP=m 160CONFIG_IP_SET_HASH_IPPORTIP=m
160CONFIG_IP_SET_HASH_IPPORTNET=m 161CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -223,6 +224,7 @@ CONFIG_DNS_RESOLVER=y
223CONFIG_BATMAN_ADV=m 224CONFIG_BATMAN_ADV=m
224CONFIG_BATMAN_ADV_DAT=y 225CONFIG_BATMAN_ADV_DAT=y
225CONFIG_BATMAN_ADV_NC=y 226CONFIG_BATMAN_ADV_NC=y
227CONFIG_BATMAN_ADV_MCAST=y
226CONFIG_NETLINK_DIAG=m 228CONFIG_NETLINK_DIAG=m
227CONFIG_NET_MPLS_GSO=m 229CONFIG_NET_MPLS_GSO=m
228# CONFIG_WIRELESS is not set 230# CONFIG_WIRELESS is not set
@@ -260,6 +262,7 @@ CONFIG_DM_CRYPT=m
260CONFIG_DM_SNAPSHOT=m 262CONFIG_DM_SNAPSHOT=m
261CONFIG_DM_THIN_PROVISIONING=m 263CONFIG_DM_THIN_PROVISIONING=m
262CONFIG_DM_CACHE=m 264CONFIG_DM_CACHE=m
265CONFIG_DM_ERA=m
263CONFIG_DM_MIRROR=m 266CONFIG_DM_MIRROR=m
264CONFIG_DM_RAID=m 267CONFIG_DM_RAID=m
265CONFIG_DM_ZERO=m 268CONFIG_DM_ZERO=m
@@ -283,12 +286,12 @@ CONFIG_NETCONSOLE=m
283CONFIG_NETCONSOLE_DYNAMIC=y 286CONFIG_NETCONSOLE_DYNAMIC=y
284CONFIG_VETH=m 287CONFIG_VETH=m
285# CONFIG_NET_VENDOR_ARC is not set 288# CONFIG_NET_VENDOR_ARC is not set
286# CONFIG_NET_CADENCE is not set
287# CONFIG_NET_VENDOR_BROADCOM is not set 289# CONFIG_NET_VENDOR_BROADCOM is not set
288CONFIG_MVME16x_NET=y 290CONFIG_MVME16x_NET=y
289# CONFIG_NET_VENDOR_MARVELL is not set 291# CONFIG_NET_VENDOR_MARVELL is not set
290# CONFIG_NET_VENDOR_MICREL is not set 292# CONFIG_NET_VENDOR_MICREL is not set
291# CONFIG_NET_VENDOR_NATSEMI is not set 293# CONFIG_NET_VENDOR_NATSEMI is not set
294# CONFIG_NET_VENDOR_SAMSUNG is not set
292# CONFIG_NET_VENDOR_SEEQ is not set 295# CONFIG_NET_VENDOR_SEEQ is not set
293# CONFIG_NET_VENDOR_STMICRO is not set 296# CONFIG_NET_VENDOR_STMICRO is not set
294# CONFIG_NET_VENDOR_VIA is not set 297# CONFIG_NET_VENDOR_VIA is not set
diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig
index f0c72ab037be..d6cf0880c463 100644
--- a/arch/m68k/configs/q40_defconfig
+++ b/arch/m68k/configs/q40_defconfig
@@ -155,6 +155,7 @@ CONFIG_IP_SET_BITMAP_IP=m
155CONFIG_IP_SET_BITMAP_IPMAC=m 155CONFIG_IP_SET_BITMAP_IPMAC=m
156CONFIG_IP_SET_BITMAP_PORT=m 156CONFIG_IP_SET_BITMAP_PORT=m
157CONFIG_IP_SET_HASH_IP=m 157CONFIG_IP_SET_HASH_IP=m
158CONFIG_IP_SET_HASH_IPMARK=m
158CONFIG_IP_SET_HASH_IPPORT=m 159CONFIG_IP_SET_HASH_IPPORT=m
159CONFIG_IP_SET_HASH_IPPORTIP=m 160CONFIG_IP_SET_HASH_IPPORTIP=m
160CONFIG_IP_SET_HASH_IPPORTNET=m 161CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -223,6 +224,7 @@ CONFIG_DNS_RESOLVER=y
223CONFIG_BATMAN_ADV=m 224CONFIG_BATMAN_ADV=m
224CONFIG_BATMAN_ADV_DAT=y 225CONFIG_BATMAN_ADV_DAT=y
225CONFIG_BATMAN_ADV_NC=y 226CONFIG_BATMAN_ADV_NC=y
227CONFIG_BATMAN_ADV_MCAST=y
226CONFIG_NETLINK_DIAG=m 228CONFIG_NETLINK_DIAG=m
227CONFIG_NET_MPLS_GSO=m 229CONFIG_NET_MPLS_GSO=m
228# CONFIG_WIRELESS is not set 230# CONFIG_WIRELESS is not set
@@ -266,6 +268,7 @@ CONFIG_DM_CRYPT=m
266CONFIG_DM_SNAPSHOT=m 268CONFIG_DM_SNAPSHOT=m
267CONFIG_DM_THIN_PROVISIONING=m 269CONFIG_DM_THIN_PROVISIONING=m
268CONFIG_DM_CACHE=m 270CONFIG_DM_CACHE=m
271CONFIG_DM_ERA=m
269CONFIG_DM_MIRROR=m 272CONFIG_DM_MIRROR=m
270CONFIG_DM_RAID=m 273CONFIG_DM_RAID=m
271CONFIG_DM_ZERO=m 274CONFIG_DM_ZERO=m
@@ -291,7 +294,6 @@ CONFIG_VETH=m
291# CONFIG_NET_VENDOR_3COM is not set 294# CONFIG_NET_VENDOR_3COM is not set
292# CONFIG_NET_VENDOR_AMD is not set 295# CONFIG_NET_VENDOR_AMD is not set
293# CONFIG_NET_VENDOR_ARC is not set 296# CONFIG_NET_VENDOR_ARC is not set
294# CONFIG_NET_CADENCE is not set
295# CONFIG_NET_VENDOR_BROADCOM is not set 297# CONFIG_NET_VENDOR_BROADCOM is not set
296# CONFIG_NET_VENDOR_CIRRUS is not set 298# CONFIG_NET_VENDOR_CIRRUS is not set
297# CONFIG_NET_VENDOR_HP is not set 299# CONFIG_NET_VENDOR_HP is not set
@@ -299,6 +301,7 @@ CONFIG_VETH=m
299# CONFIG_NET_VENDOR_MARVELL is not set 301# CONFIG_NET_VENDOR_MARVELL is not set
300# CONFIG_NET_VENDOR_MICREL is not set 302# CONFIG_NET_VENDOR_MICREL is not set
301CONFIG_NE2000=m 303CONFIG_NE2000=m
304# CONFIG_NET_VENDOR_SAMSUNG is not set
302# CONFIG_NET_VENDOR_SEEQ is not set 305# CONFIG_NET_VENDOR_SEEQ is not set
303# CONFIG_NET_VENDOR_SMSC is not set 306# CONFIG_NET_VENDOR_SMSC is not set
304# CONFIG_NET_VENDOR_STMICRO is not set 307# CONFIG_NET_VENDOR_STMICRO is not set
diff --git a/arch/m68k/configs/sun3_defconfig b/arch/m68k/configs/sun3_defconfig
index 7bca0f464521..f4e88d1c7472 100644
--- a/arch/m68k/configs/sun3_defconfig
+++ b/arch/m68k/configs/sun3_defconfig
@@ -152,6 +152,7 @@ CONFIG_IP_SET_BITMAP_IP=m
152CONFIG_IP_SET_BITMAP_IPMAC=m 152CONFIG_IP_SET_BITMAP_IPMAC=m
153CONFIG_IP_SET_BITMAP_PORT=m 153CONFIG_IP_SET_BITMAP_PORT=m
154CONFIG_IP_SET_HASH_IP=m 154CONFIG_IP_SET_HASH_IP=m
155CONFIG_IP_SET_HASH_IPMARK=m
155CONFIG_IP_SET_HASH_IPPORT=m 156CONFIG_IP_SET_HASH_IPPORT=m
156CONFIG_IP_SET_HASH_IPPORTIP=m 157CONFIG_IP_SET_HASH_IPPORTIP=m
157CONFIG_IP_SET_HASH_IPPORTNET=m 158CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -220,6 +221,7 @@ CONFIG_DNS_RESOLVER=y
220CONFIG_BATMAN_ADV=m 221CONFIG_BATMAN_ADV=m
221CONFIG_BATMAN_ADV_DAT=y 222CONFIG_BATMAN_ADV_DAT=y
222CONFIG_BATMAN_ADV_NC=y 223CONFIG_BATMAN_ADV_NC=y
224CONFIG_BATMAN_ADV_MCAST=y
223CONFIG_NETLINK_DIAG=m 225CONFIG_NETLINK_DIAG=m
224CONFIG_NET_MPLS_GSO=m 226CONFIG_NET_MPLS_GSO=m
225# CONFIG_WIRELESS is not set 227# CONFIG_WIRELESS is not set
@@ -257,6 +259,7 @@ CONFIG_DM_CRYPT=m
257CONFIG_DM_SNAPSHOT=m 259CONFIG_DM_SNAPSHOT=m
258CONFIG_DM_THIN_PROVISIONING=m 260CONFIG_DM_THIN_PROVISIONING=m
259CONFIG_DM_CACHE=m 261CONFIG_DM_CACHE=m
262CONFIG_DM_ERA=m
260CONFIG_DM_MIRROR=m 263CONFIG_DM_MIRROR=m
261CONFIG_DM_RAID=m 264CONFIG_DM_RAID=m
262CONFIG_DM_ZERO=m 265CONFIG_DM_ZERO=m
@@ -281,11 +284,11 @@ CONFIG_NETCONSOLE_DYNAMIC=y
281CONFIG_VETH=m 284CONFIG_VETH=m
282CONFIG_SUN3LANCE=y 285CONFIG_SUN3LANCE=y
283# CONFIG_NET_VENDOR_ARC is not set 286# CONFIG_NET_VENDOR_ARC is not set
284# CONFIG_NET_CADENCE is not set
285CONFIG_SUN3_82586=y 287CONFIG_SUN3_82586=y
286# CONFIG_NET_VENDOR_MARVELL is not set 288# CONFIG_NET_VENDOR_MARVELL is not set
287# CONFIG_NET_VENDOR_MICREL is not set 289# CONFIG_NET_VENDOR_MICREL is not set
288# CONFIG_NET_VENDOR_NATSEMI is not set 290# CONFIG_NET_VENDOR_NATSEMI is not set
291# CONFIG_NET_VENDOR_SAMSUNG is not set
289# CONFIG_NET_VENDOR_SEEQ is not set 292# CONFIG_NET_VENDOR_SEEQ is not set
290# CONFIG_NET_VENDOR_STMICRO is not set 293# CONFIG_NET_VENDOR_STMICRO is not set
291# CONFIG_NET_VENDOR_SUN is not set 294# CONFIG_NET_VENDOR_SUN is not set
diff --git a/arch/m68k/configs/sun3x_defconfig b/arch/m68k/configs/sun3x_defconfig
index 317f3e1fec95..49f4032c1ad6 100644
--- a/arch/m68k/configs/sun3x_defconfig
+++ b/arch/m68k/configs/sun3x_defconfig
@@ -152,6 +152,7 @@ CONFIG_IP_SET_BITMAP_IP=m
152CONFIG_IP_SET_BITMAP_IPMAC=m 152CONFIG_IP_SET_BITMAP_IPMAC=m
153CONFIG_IP_SET_BITMAP_PORT=m 153CONFIG_IP_SET_BITMAP_PORT=m
154CONFIG_IP_SET_HASH_IP=m 154CONFIG_IP_SET_HASH_IP=m
155CONFIG_IP_SET_HASH_IPMARK=m
155CONFIG_IP_SET_HASH_IPPORT=m 156CONFIG_IP_SET_HASH_IPPORT=m
156CONFIG_IP_SET_HASH_IPPORTIP=m 157CONFIG_IP_SET_HASH_IPPORTIP=m
157CONFIG_IP_SET_HASH_IPPORTNET=m 158CONFIG_IP_SET_HASH_IPPORTNET=m
@@ -220,6 +221,7 @@ CONFIG_DNS_RESOLVER=y
220CONFIG_BATMAN_ADV=m 221CONFIG_BATMAN_ADV=m
221CONFIG_BATMAN_ADV_DAT=y 222CONFIG_BATMAN_ADV_DAT=y
222CONFIG_BATMAN_ADV_NC=y 223CONFIG_BATMAN_ADV_NC=y
224CONFIG_BATMAN_ADV_MCAST=y
223CONFIG_NETLINK_DIAG=m 225CONFIG_NETLINK_DIAG=m
224CONFIG_NET_MPLS_GSO=m 226CONFIG_NET_MPLS_GSO=m
225# CONFIG_WIRELESS is not set 227# CONFIG_WIRELESS is not set
@@ -257,6 +259,7 @@ CONFIG_DM_CRYPT=m
257CONFIG_DM_SNAPSHOT=m 259CONFIG_DM_SNAPSHOT=m
258CONFIG_DM_THIN_PROVISIONING=m 260CONFIG_DM_THIN_PROVISIONING=m
259CONFIG_DM_CACHE=m 261CONFIG_DM_CACHE=m
262CONFIG_DM_ERA=m
260CONFIG_DM_MIRROR=m 263CONFIG_DM_MIRROR=m
261CONFIG_DM_RAID=m 264CONFIG_DM_RAID=m
262CONFIG_DM_ZERO=m 265CONFIG_DM_ZERO=m
@@ -281,12 +284,12 @@ CONFIG_NETCONSOLE_DYNAMIC=y
281CONFIG_VETH=m 284CONFIG_VETH=m
282CONFIG_SUN3LANCE=y 285CONFIG_SUN3LANCE=y
283# CONFIG_NET_VENDOR_ARC is not set 286# CONFIG_NET_VENDOR_ARC is not set
284# CONFIG_NET_CADENCE is not set
285# CONFIG_NET_VENDOR_BROADCOM is not set 287# CONFIG_NET_VENDOR_BROADCOM is not set
286# CONFIG_NET_VENDOR_INTEL is not set 288# CONFIG_NET_VENDOR_INTEL is not set
287# CONFIG_NET_VENDOR_MARVELL is not set 289# CONFIG_NET_VENDOR_MARVELL is not set
288# CONFIG_NET_VENDOR_MICREL is not set 290# CONFIG_NET_VENDOR_MICREL is not set
289# CONFIG_NET_VENDOR_NATSEMI is not set 291# CONFIG_NET_VENDOR_NATSEMI is not set
292# CONFIG_NET_VENDOR_SAMSUNG is not set
290# CONFIG_NET_VENDOR_SEEQ is not set 293# CONFIG_NET_VENDOR_SEEQ is not set
291# CONFIG_NET_VENDOR_STMICRO is not set 294# CONFIG_NET_VENDOR_STMICRO is not set
292# CONFIG_NET_VENDOR_VIA is not set 295# CONFIG_NET_VENDOR_VIA is not set
diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c
index 2e5a787ea11b..a9befe65adc4 100644
--- a/arch/m68k/hp300/config.c
+++ b/arch/m68k/hp300/config.c
@@ -87,7 +87,7 @@ int __init hp300_parse_bootinfo(const struct bi_record *record)
87 /* serial port address: ignored here */ 87 /* serial port address: ignored here */
88 break; 88 break;
89 89
90 default: 90 default:
91 unknown = 1; 91 unknown = 1;
92 } 92 }
93 93
@@ -262,11 +262,12 @@ void __init config_hp300(void)
262#endif 262#endif
263 mach_max_dma_address = 0xffffffff; 263 mach_max_dma_address = 0xffffffff;
264 264
265 if (hp300_model >= HP_330 && hp300_model <= HP_433S && hp300_model != HP_350) { 265 if (hp300_model >= HP_330 && hp300_model <= HP_433S &&
266 printk(KERN_INFO "Detected HP9000 model %s\n", hp300_models[hp300_model-HP_320]); 266 hp300_model != HP_350) {
267 pr_info("Detected HP9000 model %s\n",
268 hp300_models[hp300_model-HP_320]);
267 strcat(hp300_model_name, hp300_models[hp300_model-HP_320]); 269 strcat(hp300_model_name, hp300_models[hp300_model-HP_320]);
268 } 270 } else {
269 else {
270 panic("Unknown HP9000 Model"); 271 panic("Unknown HP9000 Model");
271 } 272 }
272#ifdef CONFIG_SERIAL_8250_CONSOLE 273#ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/m68k/include/asm/atari_stram.h b/arch/m68k/include/asm/atari_stram.h
index 62e27598af91..4e771c22d6a9 100644
--- a/arch/m68k/include/asm/atari_stram.h
+++ b/arch/m68k/include/asm/atari_stram.h
@@ -8,6 +8,8 @@
8/* public interface */ 8/* public interface */
9void *atari_stram_alloc(unsigned long size, const char *owner); 9void *atari_stram_alloc(unsigned long size, const char *owner);
10void atari_stram_free(void *); 10void atari_stram_free(void *);
11void *atari_stram_to_virt(unsigned long phys);
12unsigned long atari_stram_to_phys(void *);
11 13
12/* functions called internally by other parts of the kernel */ 14/* functions called internally by other parts of the kernel */
13void atari_stram_init(void); 15void atari_stram_init(void);
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 9d38b73989eb..33afa56ad47a 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -4,7 +4,7 @@
4#include <uapi/asm/unistd.h> 4#include <uapi/asm/unistd.h>
5 5
6 6
7#define NR_syscalls 351 7#define NR_syscalls 352
8 8
9#define __ARCH_WANT_OLD_READDIR 9#define __ARCH_WANT_OLD_READDIR
10#define __ARCH_WANT_OLD_STAT 10#define __ARCH_WANT_OLD_STAT
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h
index b932dd470041..9cd82fbc7817 100644
--- a/arch/m68k/include/uapi/asm/unistd.h
+++ b/arch/m68k/include/uapi/asm/unistd.h
@@ -356,5 +356,6 @@
356#define __NR_finit_module 348 356#define __NR_finit_module 348
357#define __NR_sched_setattr 349 357#define __NR_sched_setattr 349
358#define __NR_sched_getattr 350 358#define __NR_sched_getattr 350
359#define __NR_renameat2 351
359 360
360#endif /* _UAPI_ASM_M68K_UNISTD_H_ */ 361#endif /* _UAPI_ASM_M68K_UNISTD_H_ */
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index 2d5d9be16273..e47778f8588d 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -25,3 +25,5 @@ obj-$(CONFIG_HAS_DMA) += dma.o
25obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 25obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
26obj-$(CONFIG_BOOTINFO_PROC) += bootinfo_proc.o 26obj-$(CONFIG_BOOTINFO_PROC) += bootinfo_proc.o
27 27
28obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
29
diff --git a/arch/m68k/kernel/early_printk.c b/arch/m68k/kernel/early_printk.c
new file mode 100644
index 000000000000..ff9708d71921
--- /dev/null
+++ b/arch/m68k/kernel/early_printk.c
@@ -0,0 +1,67 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2014 Finn Thain
7 */
8
9#include <linux/kernel.h>
10#include <linux/console.h>
11#include <linux/init.h>
12#include <linux/string.h>
13#include <asm/setup.h>
14
15extern void mvme16x_cons_write(struct console *co,
16 const char *str, unsigned count);
17
18asmlinkage void __init debug_cons_nputs(const char *s, unsigned n);
19
20static void __ref debug_cons_write(struct console *c,
21 const char *s, unsigned n)
22{
23#if !(defined(CONFIG_SUN3) || defined(CONFIG_M68360) || \
24 defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE))
25 if (MACH_IS_MVME16x)
26 mvme16x_cons_write(c, s, n);
27 else
28 debug_cons_nputs(s, n);
29#endif
30}
31
32static struct console early_console_instance = {
33 .name = "debug",
34 .write = debug_cons_write,
35 .flags = CON_PRINTBUFFER | CON_BOOT,
36 .index = -1
37};
38
39static int __init setup_early_printk(char *buf)
40{
41 if (early_console || buf)
42 return 0;
43
44 early_console = &early_console_instance;
45 register_console(early_console);
46
47 return 0;
48}
49early_param("earlyprintk", setup_early_printk);
50
51/*
52 * debug_cons_nputs() defined in arch/m68k/kernel/head.S cannot be called
53 * after init sections are discarded (for platforms that use it).
54 */
55#if !(defined(CONFIG_SUN3) || defined(CONFIG_M68360) || \
56 defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE))
57
58static int __init unregister_early_console(void)
59{
60 if (!early_console || MACH_IS_MVME16x)
61 return 0;
62
63 return unregister_console(early_console);
64}
65late_initcall(unregister_early_console);
66
67#endif
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 3ab329b88521..dbb118e1a4e0 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -153,7 +153,7 @@
153 * ------------ 153 * ------------
154 * The console is also able to be turned off. The console in head.S 154 * The console is also able to be turned off. The console in head.S
155 * is specifically for debugging and can be very useful. It is surrounded by 155 * is specifically for debugging and can be very useful. It is surrounded by
156 * #ifdef CONSOLE/#endif clauses so it doesn't have to ship in known-good 156 * #ifdef / #endif clauses so it doesn't have to ship in known-good
157 * kernels. It's basic algorithm is to determine the size of the screen 157 * kernels. It's basic algorithm is to determine the size of the screen
158 * (in height/width and bit depth) and then use that information for 158 * (in height/width and bit depth) and then use that information for
159 * displaying an 8x8 font or an 8x16 (widthxheight). I prefer the 8x8 for 159 * displaying an 8x8 font or an 8x16 (widthxheight). I prefer the 8x8 for
@@ -198,9 +198,8 @@
198 * CONFIG_xxx: These are the obvious machine configuration defines created 198 * CONFIG_xxx: These are the obvious machine configuration defines created
199 * during configuration. These are defined in autoconf.h. 199 * during configuration. These are defined in autoconf.h.
200 * 200 *
201 * CONSOLE: There is support for head.S console in this file. This 201 * CONSOLE_DEBUG: Only supports a Mac frame buffer but could easily be
202 * console can talk to a Mac frame buffer, but could easily be extrapolated 202 * extended to support other platforms.
203 * to extend it to support other platforms.
204 * 203 *
205 * TEST_MMU: This is a test harness for running on any given machine but 204 * TEST_MMU: This is a test harness for running on any given machine but
206 * getting an MMU dump for another class of machine. The classes of machines 205 * getting an MMU dump for another class of machine. The classes of machines
@@ -222,7 +221,7 @@
222 * MMU_PRINT: There is a routine built into head.S that can display the 221 * MMU_PRINT: There is a routine built into head.S that can display the
223 * MMU data structures. It outputs its result through the serial_putc 222 * MMU data structures. It outputs its result through the serial_putc
224 * interface. So where ever that winds up driving data, that's where the 223 * interface. So where ever that winds up driving data, that's where the
225 * mmu struct will appear. On the Macintosh that's typically the console. 224 * mmu struct will appear.
226 * 225 *
227 * SERIAL_DEBUG: There are a series of putc() macro statements 226 * SERIAL_DEBUG: There are a series of putc() macro statements
228 * scattered through out the code to give progress of status to the 227 * scattered through out the code to give progress of status to the
@@ -250,8 +249,8 @@
250 * USE_MFP: Use the ST-MFP port (Modem1) for serial debug. 249 * USE_MFP: Use the ST-MFP port (Modem1) for serial debug.
251 * 250 *
252 * Macintosh constants: 251 * Macintosh constants:
253 * MAC_USE_SCC_A: Use SCC port A (modem) for serial debug and early console. 252 * MAC_USE_SCC_A: Use SCC port A (modem) for serial debug.
254 * MAC_USE_SCC_B: Use SCC port B (printer) for serial debug and early console. 253 * MAC_USE_SCC_B: Use SCC port B (printer) for serial debug.
255 */ 254 */
256 255
257#include <linux/linkage.h> 256#include <linux/linkage.h>
@@ -268,27 +267,17 @@
268#include <asm/pgtable.h> 267#include <asm/pgtable.h>
269#include <asm/page.h> 268#include <asm/page.h>
270#include <asm/asm-offsets.h> 269#include <asm/asm-offsets.h>
271
272#ifdef CONFIG_MAC 270#ifdef CONFIG_MAC
273 271# include <asm/machw.h>
274#include <asm/machw.h>
275
276#ifdef CONFIG_FRAMEBUFFER_CONSOLE
277#define CONSOLE
278#endif 272#endif
279 273
280#ifdef CONFIG_EARLY_PRINTK 274#ifdef CONFIG_EARLY_PRINTK
281#define SERIAL_DEBUG 275# define SERIAL_DEBUG
282#else 276# if defined(CONFIG_MAC) && defined(CONFIG_FONT_SUPPORT)
283#undef SERIAL_DEBUG 277# define CONSOLE_DEBUG
278# endif
284#endif 279#endif
285 280
286#else /* !CONFIG_MAC */
287
288#define SERIAL_DEBUG
289
290#endif /* !CONFIG_MAC */
291
292#undef MMU_PRINT 281#undef MMU_PRINT
293#undef MMU_NOCACHE_KERNEL 282#undef MMU_NOCACHE_KERNEL
294#undef DEBUG 283#undef DEBUG
@@ -303,6 +292,7 @@
303 292
304.globl kernel_pg_dir 293.globl kernel_pg_dir
305.globl availmem 294.globl availmem
295.globl m68k_init_mapped_size
306.globl m68k_pgtable_cachemode 296.globl m68k_pgtable_cachemode
307.globl m68k_supervisor_cachemode 297.globl m68k_supervisor_cachemode
308#ifdef CONFIG_MVME16x 298#ifdef CONFIG_MVME16x
@@ -480,22 +470,21 @@ func_define serial_putc,1
480func_define console_putc,1 470func_define console_putc,1
481 471
482func_define console_init 472func_define console_init
483func_define console_put_stats
484func_define console_put_penguin 473func_define console_put_penguin
485func_define console_plot_pixel,3 474func_define console_plot_pixel,3
486func_define console_scroll 475func_define console_scroll
487 476
488.macro putc ch 477.macro putc ch
489#if defined(CONSOLE) || defined(SERIAL_DEBUG) 478#if defined(CONSOLE_DEBUG) || defined(SERIAL_DEBUG)
490 pea \ch 479 pea \ch
491#endif 480#endif
492#ifdef CONSOLE 481#ifdef CONSOLE_DEBUG
493 func_call console_putc 482 func_call console_putc
494#endif 483#endif
495#ifdef SERIAL_DEBUG 484#ifdef SERIAL_DEBUG
496 func_call serial_putc 485 func_call serial_putc
497#endif 486#endif
498#if defined(CONSOLE) || defined(SERIAL_DEBUG) 487#if defined(CONSOLE_DEBUG) || defined(SERIAL_DEBUG)
499 addql #4,%sp 488 addql #4,%sp
500#endif 489#endif
501.endm 490.endm
@@ -515,7 +504,7 @@ func_define putn,1
515.endm 504.endm
516 505
517.macro puts string 506.macro puts string
518#if defined(CONSOLE) || defined(SERIAL_DEBUG) 507#if defined(CONSOLE_DEBUG) || defined(SERIAL_DEBUG)
519 __INITDATA 508 __INITDATA
520.Lstr\@: 509.Lstr\@:
521 .string "\string" 510 .string "\string"
@@ -651,11 +640,9 @@ ENTRY(__start)
651 lea %pc@(L(mac_rowbytes)),%a1 640 lea %pc@(L(mac_rowbytes)),%a1
652 movel %a0@,%a1@ 641 movel %a0@,%a1@
653 642
654#ifdef SERIAL_DEBUG
655 get_bi_record BI_MAC_SCCBASE 643 get_bi_record BI_MAC_SCCBASE
656 lea %pc@(L(mac_sccbase)),%a1 644 lea %pc@(L(mac_sccbase)),%a1
657 movel %a0@,%a1@ 645 movel %a0@,%a1@
658#endif
659 646
660L(test_notmac): 647L(test_notmac):
661#endif /* CONFIG_MAC */ 648#endif /* CONFIG_MAC */
@@ -885,13 +872,12 @@ L(nothp):
885 */ 872 */
886#ifdef CONFIG_MAC 873#ifdef CONFIG_MAC
887 is_not_mac(L(nocon)) 874 is_not_mac(L(nocon))
888# ifdef CONSOLE 875# ifdef CONSOLE_DEBUG
889 console_init 876 console_init
890# ifdef CONFIG_LOGO 877# ifdef CONFIG_LOGO
891 console_put_penguin 878 console_put_penguin
892# endif /* CONFIG_LOGO */ 879# endif /* CONFIG_LOGO */
893 console_put_stats 880# endif /* CONSOLE_DEBUG */
894# endif /* CONSOLE */
895L(nocon): 881L(nocon):
896#endif /* CONFIG_MAC */ 882#endif /* CONFIG_MAC */
897 883
@@ -922,10 +908,21 @@ L(nocon):
922 * 908 *
923 * This block of code does what's necessary to map in the various kinds 909 * This block of code does what's necessary to map in the various kinds
924 * of machines for execution of Linux. 910 * of machines for execution of Linux.
925 * First map the first 4 MB of kernel code & data 911 * First map the first 4, 8, or 16 MB of kernel code & data
926 */ 912 */
927 913
928 mmu_map #PAGE_OFFSET,%pc@(L(phys_kernel_start)),#4*1024*1024,\ 914 get_bi_record BI_MEMCHUNK
915 movel %a0@(4),%d0
916 movel #16*1024*1024,%d1
917 cmpl %d0,%d1
918 jls 1f
919 lsrl #1,%d1
920 cmpl %d0,%d1
921 jls 1f
922 lsrl #1,%d1
9231:
924 movel %d1,m68k_init_mapped_size
925 mmu_map #PAGE_OFFSET,%pc@(L(phys_kernel_start)),%d1,\
929 %pc@(m68k_supervisor_cachemode) 926 %pc@(m68k_supervisor_cachemode)
930 927
931 putc 'C' 928 putc 'C'
@@ -1396,15 +1393,13 @@ L(mmu_fixup_done):
1396 andl L(mac_videobase),%d0 1393 andl L(mac_videobase),%d0
1397 addl #VIDEOMEMBASE,%d0 1394 addl #VIDEOMEMBASE,%d0
1398 movel %d0,L(mac_videobase) 1395 movel %d0,L(mac_videobase)
1399#if defined(CONSOLE) 1396#ifdef CONSOLE_DEBUG
1400 movel %pc@(L(phys_kernel_start)),%d0 1397 movel %pc@(L(phys_kernel_start)),%d0
1401 subl #PAGE_OFFSET,%d0 1398 subl #PAGE_OFFSET,%d0
1402 subl %d0,L(console_font) 1399 subl %d0,L(console_font)
1403 subl %d0,L(console_font_data) 1400 subl %d0,L(console_font_data)
1404#endif 1401#endif
1405#ifdef SERIAL_DEBUG
1406 orl #0x50000000,L(mac_sccbase) 1402 orl #0x50000000,L(mac_sccbase)
1407#endif
14081: 14031:
1409#endif 1404#endif
1410 1405
@@ -2734,7 +2729,12 @@ func_return get_new_page
2734 */ 2729 */
2735 2730
2736#ifdef CONFIG_MAC 2731#ifdef CONFIG_MAC
2732/* You may define either or both of these. */
2733#define MAC_USE_SCC_A /* Modem port */
2734#define MAC_USE_SCC_B /* Printer port */
2737 2735
2736#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
2737/* Initialisation table for SCC with 3.6864 MHz PCLK */
2738L(scc_initable_mac): 2738L(scc_initable_mac):
2739 .byte 4,0x44 /* x16, 1 stopbit, no parity */ 2739 .byte 4,0x44 /* x16, 1 stopbit, no parity */
2740 .byte 3,0xc0 /* receiver: 8 bpc */ 2740 .byte 3,0xc0 /* receiver: 8 bpc */
@@ -2748,6 +2748,7 @@ L(scc_initable_mac):
2748 .byte -1 2748 .byte -1
2749 .even 2749 .even
2750#endif 2750#endif
2751#endif /* CONFIG_MAC */
2751 2752
2752#ifdef CONFIG_ATARI 2753#ifdef CONFIG_ATARI
2753/* #define USE_PRINTER */ 2754/* #define USE_PRINTER */
@@ -2756,14 +2757,12 @@ L(scc_initable_mac):
2756#define USE_MFP 2757#define USE_MFP
2757 2758
2758#if defined(USE_SCC_A) || defined(USE_SCC_B) 2759#if defined(USE_SCC_A) || defined(USE_SCC_B)
2759#define USE_SCC 2760/* Initialisation table for SCC with 7.9872 MHz PCLK */
2760/* Initialisation table for SCC */ 2761/* PCLK == 8.0539 gives baud == 9680.1 */
2761L(scc_initable): 2762L(scc_initable_atari):
2762 .byte 9,12 /* Reset */
2763 .byte 4,0x44 /* x16, 1 stopbit, no parity */ 2763 .byte 4,0x44 /* x16, 1 stopbit, no parity */
2764 .byte 3,0xc0 /* receiver: 8 bpc */ 2764 .byte 3,0xc0 /* receiver: 8 bpc */
2765 .byte 5,0xe2 /* transmitter: 8 bpc, assert dtr/rts */ 2765 .byte 5,0xe2 /* transmitter: 8 bpc, assert dtr/rts */
2766 .byte 9,0 /* no interrupts */
2767 .byte 10,0 /* NRZ */ 2766 .byte 10,0 /* NRZ */
2768 .byte 11,0x50 /* use baud rate generator */ 2767 .byte 11,0x50 /* use baud rate generator */
2769 .byte 12,24,13,0 /* 9600 baud */ 2768 .byte 12,24,13,0 /* 9600 baud */
@@ -2812,7 +2811,7 @@ LMFP_UDR = 0xfffa2f
2812 */ 2811 */
2813 2812
2814/* 2813/*
2815 * Initialize serial port hardware for 9600/8/1 2814 * Initialize serial port hardware
2816 */ 2815 */
2817func_start serial_init,%d0/%d1/%a0/%a1 2816func_start serial_init,%d0/%d1/%a0/%a1
2818 /* 2817 /*
@@ -2822,7 +2821,7 @@ func_start serial_init,%d0/%d1/%a0/%a1
2822 * d0 = boot info offset 2821 * d0 = boot info offset
2823 * CONFIG_ATARI 2822 * CONFIG_ATARI
2824 * a0 = address of SCC 2823 * a0 = address of SCC
2825 * a1 = Liobase address/address of scc_initable 2824 * a1 = Liobase address/address of scc_initable_atari
2826 * d0 = init data for serial port 2825 * d0 = init data for serial port
2827 * CONFIG_MAC 2826 * CONFIG_MAC
2828 * a0 = address of SCC 2827 * a0 = address of SCC
@@ -2843,6 +2842,7 @@ func_start serial_init,%d0/%d1/%a0/%a1
2843| movew #61,CUSTOMBASE+C_SERPER-ZTWOBASE 2842| movew #61,CUSTOMBASE+C_SERPER-ZTWOBASE
28441: 28431:
2845#endif 2844#endif
2845
2846#ifdef CONFIG_ATARI 2846#ifdef CONFIG_ATARI
2847 is_not_atari(4f) 2847 is_not_atari(4f)
2848 movel %pc@(L(iobase)),%a1 2848 movel %pc@(L(iobase)),%a1
@@ -2857,9 +2857,21 @@ func_start serial_init,%d0/%d1/%a0/%a1
2857 moveb %a1@(LPSG_READ),%d0 2857 moveb %a1@(LPSG_READ),%d0
2858 bset #5,%d0 2858 bset #5,%d0
2859 moveb %d0,%a1@(LPSG_WRITE) 2859 moveb %d0,%a1@(LPSG_WRITE)
2860#elif defined(USE_SCC) 2860#elif defined(USE_SCC_A) || defined(USE_SCC_B)
2861 lea %a1@(LSCC_CTRL),%a0 2861 lea %a1@(LSCC_CTRL),%a0
2862 lea %pc@(L(scc_initable)),%a1 2862 /* Reset SCC register pointer */
2863 moveb %a0@,%d0
2864 /* Reset SCC device: write register pointer then register value */
2865 moveb #9,%a0@
2866 moveb #0xc0,%a0@
2867 /* Wait for 5 PCLK cycles, which is about 63 CPU cycles */
2868 /* 5 / 7.9872 MHz = approx. 0.63 us = 63 / 100 MHz */
2869 movel #32,%d0
28702:
2871 subq #1,%d0
2872 jne 2b
2873 /* Initialize channel */
2874 lea %pc@(L(scc_initable_atari)),%a1
28632: moveb %a1@+,%d0 28752: moveb %a1@+,%d0
2864 jmi 3f 2876 jmi 3f
2865 moveb %d0,%a0@ 2877 moveb %d0,%a0@
@@ -2877,21 +2889,14 @@ func_start serial_init,%d0/%d1/%a0/%a1
2877 jra L(serial_init_done) 2889 jra L(serial_init_done)
28784: 28904:
2879#endif 2891#endif
2892
2880#ifdef CONFIG_MAC 2893#ifdef CONFIG_MAC
2881 is_not_mac(L(serial_init_not_mac)) 2894 is_not_mac(L(serial_init_not_mac))
2882 2895#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
2883#ifdef SERIAL_DEBUG
2884
2885/* You may define either or both of these. */
2886#define MAC_USE_SCC_A /* Modem port */
2887#define MAC_USE_SCC_B /* Printer port */
2888
2889#define mac_scc_cha_b_ctrl_offset 0x0 2896#define mac_scc_cha_b_ctrl_offset 0x0
2890#define mac_scc_cha_a_ctrl_offset 0x2 2897#define mac_scc_cha_a_ctrl_offset 0x2
2891#define mac_scc_cha_b_data_offset 0x4 2898#define mac_scc_cha_b_data_offset 0x4
2892#define mac_scc_cha_a_data_offset 0x6 2899#define mac_scc_cha_a_data_offset 0x6
2893
2894#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
2895 movel %pc@(L(mac_sccbase)),%a0 2900 movel %pc@(L(mac_sccbase)),%a0
2896 /* Reset SCC register pointer */ 2901 /* Reset SCC register pointer */
2897 moveb %a0@(mac_scc_cha_a_ctrl_offset),%d0 2902 moveb %a0@(mac_scc_cha_a_ctrl_offset),%d0
@@ -2905,7 +2910,6 @@ func_start serial_init,%d0/%d1/%a0/%a1
2905 subq #1,%d0 2910 subq #1,%d0
2906 jne 5b 2911 jne 5b
2907#endif 2912#endif
2908
2909#ifdef MAC_USE_SCC_A 2913#ifdef MAC_USE_SCC_A
2910 /* Initialize channel A */ 2914 /* Initialize channel A */
2911 lea %pc@(L(scc_initable_mac)),%a1 2915 lea %pc@(L(scc_initable_mac)),%a1
@@ -2916,7 +2920,6 @@ func_start serial_init,%d0/%d1/%a0/%a1
2916 jra 5b 2920 jra 5b
29176: 29216:
2918#endif /* MAC_USE_SCC_A */ 2922#endif /* MAC_USE_SCC_A */
2919
2920#ifdef MAC_USE_SCC_B 2923#ifdef MAC_USE_SCC_B
2921 /* Initialize channel B */ 2924 /* Initialize channel B */
2922 lea %pc@(L(scc_initable_mac)),%a1 2925 lea %pc@(L(scc_initable_mac)),%a1
@@ -2927,9 +2930,6 @@ func_start serial_init,%d0/%d1/%a0/%a1
2927 jra 7b 2930 jra 7b
29288: 29318:
2929#endif /* MAC_USE_SCC_B */ 2932#endif /* MAC_USE_SCC_B */
2930
2931#endif /* SERIAL_DEBUG */
2932
2933 jra L(serial_init_done) 2933 jra L(serial_init_done)
2934L(serial_init_not_mac): 2934L(serial_init_not_mac):
2935#endif /* CONFIG_MAC */ 2935#endif /* CONFIG_MAC */
@@ -2959,6 +2959,15 @@ L(serial_init_not_mac):
29592: 29592:
2960#endif 2960#endif
2961 2961
2962#ifdef CONFIG_MVME16x
2963 is_not_mvme16x(L(serial_init_not_mvme16x))
2964 moveb #0x10,M167_PCSCCMICR
2965 moveb #0x10,M167_PCSCCTICR
2966 moveb #0x10,M167_PCSCCRICR
2967 jra L(serial_init_done)
2968L(serial_init_not_mvme16x):
2969#endif
2970
2962#ifdef CONFIG_APOLLO 2971#ifdef CONFIG_APOLLO
2963/* We count on the PROM initializing SIO1 */ 2972/* We count on the PROM initializing SIO1 */
2964#endif 2973#endif
@@ -2998,27 +3007,19 @@ func_start serial_putc,%d0/%d1/%a0/%a1
2998 3007
2999#ifdef CONFIG_MAC 3008#ifdef CONFIG_MAC
3000 is_not_mac(5f) 3009 is_not_mac(5f)
3001
3002#ifdef SERIAL_DEBUG
3003
3004#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B) 3010#if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
3005 movel %pc@(L(mac_sccbase)),%a1 3011 movel %pc@(L(mac_sccbase)),%a1
3006#endif 3012#endif
3007
3008#ifdef MAC_USE_SCC_A 3013#ifdef MAC_USE_SCC_A
30093: btst #2,%a1@(mac_scc_cha_a_ctrl_offset) 30143: btst #2,%a1@(mac_scc_cha_a_ctrl_offset)
3010 jeq 3b 3015 jeq 3b
3011 moveb %d0,%a1@(mac_scc_cha_a_data_offset) 3016 moveb %d0,%a1@(mac_scc_cha_a_data_offset)
3012#endif /* MAC_USE_SCC_A */ 3017#endif /* MAC_USE_SCC_A */
3013
3014#ifdef MAC_USE_SCC_B 3018#ifdef MAC_USE_SCC_B
30154: btst #2,%a1@(mac_scc_cha_b_ctrl_offset) 30194: btst #2,%a1@(mac_scc_cha_b_ctrl_offset)
3016 jeq 4b 3020 jeq 4b
3017 moveb %d0,%a1@(mac_scc_cha_b_data_offset) 3021 moveb %d0,%a1@(mac_scc_cha_b_data_offset)
3018#endif /* MAC_USE_SCC_B */ 3022#endif /* MAC_USE_SCC_B */
3019
3020#endif /* SERIAL_DEBUG */
3021
3022 jra L(serial_putc_done) 3023 jra L(serial_putc_done)
30235: 30245:
3024#endif /* CONFIG_MAC */ 3025#endif /* CONFIG_MAC */
@@ -3039,7 +3040,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1
3039 nop 3040 nop
3040 bset #5,%d0 3041 bset #5,%d0
3041 moveb %d0,%a1@(LPSG_WRITE) 3042 moveb %d0,%a1@(LPSG_WRITE)
3042#elif defined(USE_SCC) 3043#elif defined(USE_SCC_A) || defined(USE_SCC_B)
30433: btst #2,%a1@(LSCC_CTRL) 30443: btst #2,%a1@(LSCC_CTRL)
3044 jeq 3b 3045 jeq 3b
3045 moveb %d0,%a1@(LSCC_DATA) 3046 moveb %d0,%a1@(LSCC_DATA)
@@ -3195,7 +3196,7 @@ func_start puts,%d0/%a0
3195 movel ARG1,%a0 3196 movel ARG1,%a0
3196 jra 2f 3197 jra 2f
31971: 31981:
3198#ifdef CONSOLE 3199#ifdef CONSOLE_DEBUG
3199 console_putc %d0 3200 console_putc %d0
3200#endif 3201#endif
3201#ifdef SERIAL_DEBUG 3202#ifdef SERIAL_DEBUG
@@ -3224,7 +3225,7 @@ func_start putn,%d0-%d2
3224 jls 2f 3225 jls 2f
3225 addb #'A'-('9'+1),%d2 3226 addb #'A'-('9'+1),%d2
32262: 32272:
3227#ifdef CONSOLE 3228#ifdef CONSOLE_DEBUG
3228 console_putc %d2 3229 console_putc %d2
3229#endif 3230#endif
3230#ifdef SERIAL_DEBUG 3231#ifdef SERIAL_DEBUG
@@ -3234,21 +3235,19 @@ func_start putn,%d0-%d2
3234 3235
3235func_return putn 3236func_return putn
3236 3237
3237#ifdef CONFIG_MAC 3238#ifdef CONFIG_EARLY_PRINTK
3238/* 3239/*
3239 * mac_early_print
3240 *
3241 * This routine takes its parameters on the stack. It then 3240 * This routine takes its parameters on the stack. It then
3242 * turns around and calls the internal routines. This routine 3241 * turns around and calls the internal routines. This routine
3243 * is used by the boot console. 3242 * is used by the boot console.
3244 * 3243 *
3245 * The calling parameters are: 3244 * The calling parameters are:
3246 * void mac_early_print(const char *str, unsigned length); 3245 * void debug_cons_nputs(const char *str, unsigned length)
3247 * 3246 *
3248 * This routine does NOT understand variable arguments only 3247 * This routine does NOT understand variable arguments only
3249 * simple strings! 3248 * simple strings!
3250 */ 3249 */
3251ENTRY(mac_early_print) 3250ENTRY(debug_cons_nputs)
3252 moveml %d0/%d1/%a0,%sp@- 3251 moveml %d0/%d1/%a0,%sp@-
3253 movew %sr,%sp@- 3252 movew %sr,%sp@-
3254 ori #0x0700,%sr 3253 ori #0x0700,%sr
@@ -3256,7 +3255,7 @@ ENTRY(mac_early_print)
3256 movel %sp@(22),%d1 /* fetch parameter */ 3255 movel %sp@(22),%d1 /* fetch parameter */
3257 jra 2f 3256 jra 2f
32581: 32571:
3259#ifdef CONSOLE 3258#ifdef CONSOLE_DEBUG
3260 console_putc %d0 3259 console_putc %d0
3261#endif 3260#endif
3262#ifdef SERIAL_DEBUG 3261#ifdef SERIAL_DEBUG
@@ -3270,7 +3269,7 @@ ENTRY(mac_early_print)
3270 movew %sp@+,%sr 3269 movew %sp@+,%sr
3271 moveml %sp@+,%d0/%d1/%a0 3270 moveml %sp@+,%d0/%d1/%a0
3272 rts 3271 rts
3273#endif /* CONFIG_MAC */ 3272#endif /* CONFIG_EARLY_PRINTK */
3274 3273
3275#if defined(CONFIG_HP300) || defined(CONFIG_APOLLO) 3274#if defined(CONFIG_HP300) || defined(CONFIG_APOLLO)
3276func_start set_leds,%d0/%a0 3275func_start set_leds,%d0/%a0
@@ -3292,7 +3291,7 @@ func_start set_leds,%d0/%a0
3292func_return set_leds 3291func_return set_leds
3293#endif 3292#endif
3294 3293
3295#ifdef CONSOLE 3294#ifdef CONSOLE_DEBUG
3296/* 3295/*
3297 * For continuity, see the data alignment 3296 * For continuity, see the data alignment
3298 * to which this structure is tied. 3297 * to which this structure is tied.
@@ -3396,43 +3395,6 @@ L(console_clear_loop):
33961: 33951:
3397func_return console_init 3396func_return console_init
3398 3397
3399func_start console_put_stats,%a0/%d7
3400 /*
3401 * Some of the register usage that follows
3402 * a0 = pointer to boot_info
3403 * d7 = value of boot_info fields
3404 */
3405 puts "\nMacLinux\n"
3406
3407#ifdef SERIAL_DEBUG
3408 puts "\n vidaddr:"
3409 putn %pc@(L(mac_videobase)) /* video addr. */
3410
3411 puts "\n _stext:"
3412 lea %pc@(_stext),%a0
3413 putn %a0
3414
3415 puts "\nbootinfo:"
3416 lea %pc@(_end),%a0
3417 putn %a0
3418
3419 puts "\n cpuid:"
3420 putn %pc@(L(cputype))
3421
3422# ifdef CONFIG_MAC
3423 puts "\n sccbase:"
3424 putn %pc@(L(mac_sccbase))
3425# endif
3426# ifdef MMU_PRINT
3427 putc '\n'
3428 jbsr mmu_print_machine_cpu_types
3429# endif
3430#endif /* SERIAL_DEBUG */
3431
3432 putc '\n'
3433
3434func_return console_put_stats
3435
3436#ifdef CONFIG_LOGO 3398#ifdef CONFIG_LOGO
3437func_start console_put_penguin,%a0-%a1/%d0-%d7 3399func_start console_put_penguin,%a0-%a1/%d0-%d7
3438 /* 3400 /*
@@ -3774,12 +3736,15 @@ L(white_16):
3774 3736
3775L(console_plot_pixel_exit): 3737L(console_plot_pixel_exit):
3776func_return console_plot_pixel 3738func_return console_plot_pixel
3777#endif /* CONSOLE */ 3739#endif /* CONSOLE_DEBUG */
3778 3740
3779 3741
3780__INITDATA 3742__INITDATA
3781 .align 4 3743 .align 4
3782 3744
3745m68k_init_mapped_size:
3746 .long 0
3747
3783#if defined(CONFIG_ATARI) || defined(CONFIG_AMIGA) || \ 3748#if defined(CONFIG_ATARI) || defined(CONFIG_AMIGA) || \
3784 defined(CONFIG_HP300) || defined(CONFIG_APOLLO) 3749 defined(CONFIG_HP300) || defined(CONFIG_APOLLO)
3785L(custom): 3750L(custom):
@@ -3787,7 +3752,7 @@ L(iobase):
3787 .long 0 3752 .long 0
3788#endif 3753#endif
3789 3754
3790#if defined(CONSOLE) 3755#ifdef CONSOLE_DEBUG
3791L(console_globals): 3756L(console_globals):
3792 .long 0 /* cursor column */ 3757 .long 0 /* cursor column */
3793 .long 0 /* cursor row */ 3758 .long 0 /* cursor row */
@@ -3798,7 +3763,7 @@ L(console_font):
3798 .long 0 /* pointer to console font (struct font_desc) */ 3763 .long 0 /* pointer to console font (struct font_desc) */
3799L(console_font_data): 3764L(console_font_data):
3800 .long 0 /* pointer to console font data */ 3765 .long 0 /* pointer to console font data */
3801#endif /* CONSOLE */ 3766#endif /* CONSOLE_DEBUG */
3802 3767
3803#if defined(MMU_PRINT) 3768#if defined(MMU_PRINT)
3804L(mmu_print_data): 3769L(mmu_print_data):
@@ -3838,7 +3803,9 @@ M167_CYIER = 0xfff45011
3838M167_CYLICR = 0xfff45026 3803M167_CYLICR = 0xfff45026
3839M167_CYTEOIR = 0xfff45085 3804M167_CYTEOIR = 0xfff45085
3840M167_CYTDR = 0xfff450f8 3805M167_CYTDR = 0xfff450f8
3806M167_PCSCCMICR = 0xfff4201d
3841M167_PCSCCTICR = 0xfff4201e 3807M167_PCSCCTICR = 0xfff4201e
3808M167_PCSCCRICR = 0xfff4201f
3842M167_PCTPIACKR = 0xfff42025 3809M167_PCTPIACKR = 0xfff42025
3843#endif 3810#endif
3844 3811
@@ -3856,10 +3823,8 @@ L(mac_dimensions):
3856 .long 0 3823 .long 0
3857L(mac_rowbytes): 3824L(mac_rowbytes):
3858 .long 0 3825 .long 0
3859#ifdef SERIAL_DEBUG
3860L(mac_sccbase): 3826L(mac_sccbase):
3861 .long 0 3827 .long 0
3862#endif
3863#endif /* CONFIG_MAC */ 3828#endif /* CONFIG_MAC */
3864 3829
3865#if defined (CONFIG_APOLLO) 3830#if defined (CONFIG_APOLLO)
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
index b6223dc41d82..501e10212789 100644
--- a/arch/m68k/kernel/syscalltable.S
+++ b/arch/m68k/kernel/syscalltable.S
@@ -371,4 +371,5 @@ ENTRY(sys_call_table)
371 .long sys_finit_module 371 .long sys_finit_module
372 .long sys_sched_setattr 372 .long sys_sched_setattr
373 .long sys_sched_getattr /* 350 */ 373 .long sys_sched_getattr /* 350 */
374 .long sys_renameat2
374 375
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 982c3fe73c4a..a471eab1a4dd 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -71,31 +71,6 @@ static void mac_get_model(char *str);
71static void mac_identify(void); 71static void mac_identify(void);
72static void mac_report_hardware(void); 72static void mac_report_hardware(void);
73 73
74#ifdef CONFIG_EARLY_PRINTK
75asmlinkage void __init mac_early_print(const char *s, unsigned n);
76
77static void __init mac_early_cons_write(struct console *con,
78 const char *s, unsigned n)
79{
80 mac_early_print(s, n);
81}
82
83static struct console __initdata mac_early_cons = {
84 .name = "early",
85 .write = mac_early_cons_write,
86 .flags = CON_PRINTBUFFER | CON_BOOT,
87 .index = -1
88};
89
90int __init mac_unregister_early_cons(void)
91{
92 /* mac_early_print can't be used after init sections are discarded */
93 return unregister_console(&mac_early_cons);
94}
95
96late_initcall(mac_unregister_early_cons);
97#endif
98
99static void __init mac_sched_init(irq_handler_t vector) 74static void __init mac_sched_init(irq_handler_t vector)
100{ 75{
101 via_init_clock(vector); 76 via_init_clock(vector);
@@ -190,10 +165,6 @@ void __init config_mac(void)
190 mach_beep = mac_mksound; 165 mach_beep = mac_mksound;
191#endif 166#endif
192 167
193#ifdef CONFIG_EARLY_PRINTK
194 register_console(&mac_early_cons);
195#endif
196
197 /* 168 /*
198 * Determine hardware present 169 * Determine hardware present
199 */ 170 */
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 7d4024432163..b958916e5eac 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -45,7 +45,7 @@ EXPORT_SYMBOL(mm_cachebits);
45#endif 45#endif
46 46
47/* size of memory already mapped in head.S */ 47/* size of memory already mapped in head.S */
48#define INIT_MAPPED_SIZE (4UL<<20) 48extern __initdata unsigned long m68k_init_mapped_size;
49 49
50extern unsigned long availmem; 50extern unsigned long availmem;
51 51
@@ -271,10 +271,12 @@ void __init paging_init(void)
271 */ 271 */
272 addr = m68k_memory[0].addr; 272 addr = m68k_memory[0].addr;
273 size = m68k_memory[0].size; 273 size = m68k_memory[0].size;
274 free_bootmem_node(NODE_DATA(0), availmem, min(INIT_MAPPED_SIZE, size) - (availmem - addr)); 274 free_bootmem_node(NODE_DATA(0), availmem,
275 min(m68k_init_mapped_size, size) - (availmem - addr));
275 map_node(0); 276 map_node(0);
276 if (size > INIT_MAPPED_SIZE) 277 if (size > m68k_init_mapped_size)
277 free_bootmem_node(NODE_DATA(0), addr + INIT_MAPPED_SIZE, size - INIT_MAPPED_SIZE); 278 free_bootmem_node(NODE_DATA(0), addr + m68k_init_mapped_size,
279 size - m68k_init_mapped_size);
278 280
279 for (i = 1; i < m68k_num_memory; i++) 281 for (i = 1; i < m68k_num_memory; i++)
280 map_node(i); 282 map_node(i);
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index eab7d342757e..a53803cc66cd 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -213,7 +213,7 @@ static void __init mvme16x_init_IRQ (void)
213#define CySCRH (0x22) 213#define CySCRH (0x22)
214#define CyTFTC (0x80) 214#define CyTFTC (0x80)
215 215
216static void cons_write(struct console *co, const char *str, unsigned count) 216void mvme16x_cons_write(struct console *co, const char *str, unsigned count)
217{ 217{
218 volatile unsigned char *base_addr = (u_char *)CD2401_ADDR; 218 volatile unsigned char *base_addr = (u_char *)CD2401_ADDR;
219 volatile u_char sink; 219 volatile u_char sink;
@@ -268,20 +268,6 @@ static void cons_write(struct console *co, const char *str, unsigned count)
268 base_addr[CyIER] = ier; 268 base_addr[CyIER] = ier;
269} 269}
270 270
271static struct console cons_info =
272{
273 .name = "sercon",
274 .write = cons_write,
275 .flags = CON_PRINTBUFFER | CON_BOOT,
276 .index = -1,
277};
278
279static void __init mvme16x_early_console(void)
280{
281 register_console(&cons_info);
282
283 printk(KERN_INFO "MVME16x: early console registered\n");
284}
285#endif 271#endif
286 272
287void __init config_mvme16x(void) 273void __init config_mvme16x(void)
@@ -336,16 +322,6 @@ void __init config_mvme16x(void)
336 else 322 else
337 { 323 {
338 mvme16x_config = MVME16x_CONFIG_GOT_LP | MVME16x_CONFIG_GOT_CD2401; 324 mvme16x_config = MVME16x_CONFIG_GOT_LP | MVME16x_CONFIG_GOT_CD2401;
339
340 /* Dont allow any interrupts from the CD2401 until the interrupt */
341 /* handlers are installed */
342
343 pcc2chip[PccSCCMICR] = 0x10;
344 pcc2chip[PccSCCTICR] = 0x10;
345 pcc2chip[PccSCCRICR] = 0x10;
346#ifdef CONFIG_EARLY_PRINTK
347 mvme16x_early_console();
348#endif
349 } 325 }
350} 326}
351 327
diff --git a/arch/metag/include/asm/barrier.h b/arch/metag/include/asm/barrier.h
index 5d6b4b407dda..2d6f0de77325 100644
--- a/arch/metag/include/asm/barrier.h
+++ b/arch/metag/include/asm/barrier.h
@@ -15,6 +15,7 @@ static inline void wr_fence(void)
15 volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_FENCE; 15 volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_FENCE;
16 barrier(); 16 barrier();
17 *flushptr = 0; 17 *flushptr = 0;
18 barrier();
18} 19}
19 20
20#else /* CONFIG_METAG_META21 */ 21#else /* CONFIG_METAG_META21 */
@@ -35,6 +36,7 @@ static inline void wr_fence(void)
35 *flushptr = 0; 36 *flushptr = 0;
36 *flushptr = 0; 37 *flushptr = 0;
37 *flushptr = 0; 38 *flushptr = 0;
39 barrier();
38} 40}
39 41
40#endif /* !CONFIG_METAG_META21 */ 42#endif /* !CONFIG_METAG_META21 */
@@ -68,6 +70,7 @@ static inline void fence(void)
68 volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_ATOMIC_UNLOCK; 70 volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_ATOMIC_UNLOCK;
69 barrier(); 71 barrier();
70 *flushptr = 0; 72 *flushptr = 0;
73 barrier();
71} 74}
72#define smp_mb() fence() 75#define smp_mb() fence()
73#define smp_rmb() fence() 76#define smp_rmb() fence()
diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h
index f16477d1f571..a8a37477c66e 100644
--- a/arch/metag/include/asm/processor.h
+++ b/arch/metag/include/asm/processor.h
@@ -22,6 +22,8 @@
22/* Add an extra page of padding at the top of the stack for the guard page. */ 22/* Add an extra page of padding at the top of the stack for the guard page. */
23#define STACK_TOP (TASK_SIZE - PAGE_SIZE) 23#define STACK_TOP (TASK_SIZE - PAGE_SIZE)
24#define STACK_TOP_MAX STACK_TOP 24#define STACK_TOP_MAX STACK_TOP
25/* Maximum virtual space for stack */
26#define STACK_SIZE_MAX (CONFIG_MAX_STACK_SIZE_MB*1024*1024)
25 27
26/* This decides where the kernel will search for a free chunk of vm 28/* This decides where the kernel will search for a free chunk of vm
27 * space during mmap's. 29 * space during mmap's.
diff --git a/arch/metag/include/uapi/asm/Kbuild b/arch/metag/include/uapi/asm/Kbuild
index 84e09feb4d54..ab78be2b6eb0 100644
--- a/arch/metag/include/uapi/asm/Kbuild
+++ b/arch/metag/include/uapi/asm/Kbuild
@@ -4,11 +4,11 @@ include include/uapi/asm-generic/Kbuild.asm
4header-y += byteorder.h 4header-y += byteorder.h
5header-y += ech.h 5header-y += ech.h
6header-y += ptrace.h 6header-y += ptrace.h
7header-y += resource.h
8header-y += sigcontext.h 7header-y += sigcontext.h
9header-y += siginfo.h 8header-y += siginfo.h
10header-y += swab.h 9header-y += swab.h
11header-y += unistd.h 10header-y += unistd.h
12 11
13generic-y += mman.h 12generic-y += mman.h
13generic-y += resource.h
14generic-y += setup.h 14generic-y += setup.h
diff --git a/arch/metag/include/uapi/asm/resource.h b/arch/metag/include/uapi/asm/resource.h
deleted file mode 100644
index 526d23cc3054..000000000000
--- a/arch/metag/include/uapi/asm/resource.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _UAPI_METAG_RESOURCE_H
2#define _UAPI_METAG_RESOURCE_H
3
4#define _STK_LIM_MAX (1 << 28)
5#include <asm-generic/resource.h>
6
7#endif /* _UAPI_METAG_RESOURCE_H */
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index 935f9bec414a..335524040fff 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -44,11 +44,6 @@ struct pci_dev;
44 */ 44 */
45#define pcibios_assign_all_busses() 0 45#define pcibios_assign_all_busses() 0
46 46
47static inline void pcibios_penalize_isa_irq(int irq, int active)
48{
49 /* We don't do dynamic PCI IRQ allocation */
50}
51
52#ifdef CONFIG_PCI 47#ifdef CONFIG_PCI
53extern void set_pci_dma_ops(struct dma_map_ops *dma_ops); 48extern void set_pci_dma_ops(struct dma_map_ops *dma_ops);
54extern struct dma_map_ops *get_pci_dma_ops(void); 49extern struct dma_map_ops *get_pci_dma_ops(void);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 70996cc66aa2..a59de1bc1ce0 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -168,26 +168,6 @@ struct pci_controller *pci_find_hose_for_OF_device(struct device_node *node)
168 return NULL; 168 return NULL;
169} 169}
170 170
171static ssize_t pci_show_devspec(struct device *dev,
172 struct device_attribute *attr, char *buf)
173{
174 struct pci_dev *pdev;
175 struct device_node *np;
176
177 pdev = to_pci_dev(dev);
178 np = pci_device_to_OF_node(pdev);
179 if (np == NULL || np->full_name == NULL)
180 return 0;
181 return sprintf(buf, "%s", np->full_name);
182}
183static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
184
185/* Add sysfs properties */
186int pcibios_add_platform_entries(struct pci_dev *pdev)
187{
188 return device_create_file(&pdev->dev, &dev_attr_devspec);
189}
190
191void pcibios_set_master(struct pci_dev *dev) 171void pcibios_set_master(struct pci_dev *dev)
192{ 172{
193 /* No special bus mastering setup handling */ 173 /* No special bus mastering setup handling */
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 1a5b4032cb66..60a359cfa328 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -151,7 +151,7 @@ cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
151 -Wa,--trap 151 -Wa,--trap
152cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \ 152cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
153 -Wa,--trap 153 -Wa,--trap
154cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \ 154cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1 -mno-mdmx -mno-mips3d,-march=r5000) \
155 -Wa,--trap 155 -Wa,--trap
156cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap 156cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap
157cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \ 157cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \
diff --git a/arch/mips/dec/ecc-berr.c b/arch/mips/dec/ecc-berr.c
index 5abf4e894216..2a66e908f6a9 100644
--- a/arch/mips/dec/ecc-berr.c
+++ b/arch/mips/dec/ecc-berr.c
@@ -21,6 +21,7 @@
21#include <asm/addrspace.h> 21#include <asm/addrspace.h>
22#include <asm/bootinfo.h> 22#include <asm/bootinfo.h>
23#include <asm/cpu.h> 23#include <asm/cpu.h>
24#include <asm/cpu-type.h>
24#include <asm/irq_regs.h> 25#include <asm/irq_regs.h>
25#include <asm/processor.h> 26#include <asm/processor.h>
26#include <asm/ptrace.h> 27#include <asm/ptrace.h>
diff --git a/arch/mips/dec/kn02xa-berr.c b/arch/mips/dec/kn02xa-berr.c
index f434b759e3b9..ec606363b806 100644
--- a/arch/mips/dec/kn02xa-berr.c
+++ b/arch/mips/dec/kn02xa-berr.c
@@ -19,6 +19,7 @@
19#include <linux/types.h> 19#include <linux/types.h>
20 20
21#include <asm/addrspace.h> 21#include <asm/addrspace.h>
22#include <asm/cpu-type.h>
22#include <asm/irq_regs.h> 23#include <asm/irq_regs.h>
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
24#include <asm/traps.h> 25#include <asm/traps.h>
diff --git a/arch/mips/dec/prom/Makefile b/arch/mips/dec/prom/Makefile
index 064ae7a76bdc..ae73e42ac20b 100644
--- a/arch/mips/dec/prom/Makefile
+++ b/arch/mips/dec/prom/Makefile
@@ -6,4 +6,3 @@
6lib-y += init.o memory.o cmdline.o identify.o console.o 6lib-y += init.o memory.o cmdline.o identify.o console.o
7 7
8lib-$(CONFIG_32BIT) += locore.o 8lib-$(CONFIG_32BIT) += locore.o
9lib-$(CONFIG_64BIT) += call_o32.o
diff --git a/arch/mips/dec/prom/call_o32.S b/arch/mips/dec/prom/call_o32.S
deleted file mode 100644
index 8c8498159e43..000000000000
--- a/arch/mips/dec/prom/call_o32.S
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * O32 interface for the 64 (or N32) ABI.
3 *
4 * Copyright (C) 2002 Maciej W. Rozycki
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/asm.h>
13#include <asm/regdef.h>
14
15/* Maximum number of arguments supported. Must be even! */
16#define O32_ARGC 32
17/* Number of static registers we save. */
18#define O32_STATC 11
19/* Frame size for both of the above. */
20#define O32_FRAMESZ (4 * O32_ARGC + SZREG * O32_STATC)
21
22 .text
23
24/*
25 * O32 function call dispatcher, for interfacing 32-bit ROM routines.
26 *
27 * The standard 64 (N32) calling sequence is supported, with a0
28 * holding a function pointer, a1-a7 -- its first seven arguments
29 * and the stack -- remaining ones (up to O32_ARGC, including a1-a7).
30 * Static registers, gp and fp are preserved, v0 holds a result.
31 * This code relies on the called o32 function for sp and ra
32 * restoration and thus both this dispatcher and the current stack
33 * have to be placed in a KSEGx (or KUSEG) address space. Any
34 * pointers passed have to point to addresses within one of these
35 * spaces as well.
36 */
37NESTED(call_o32, O32_FRAMESZ, ra)
38 REG_SUBU sp,O32_FRAMESZ
39
40 REG_S ra,O32_FRAMESZ-1*SZREG(sp)
41 REG_S fp,O32_FRAMESZ-2*SZREG(sp)
42 REG_S gp,O32_FRAMESZ-3*SZREG(sp)
43 REG_S s7,O32_FRAMESZ-4*SZREG(sp)
44 REG_S s6,O32_FRAMESZ-5*SZREG(sp)
45 REG_S s5,O32_FRAMESZ-6*SZREG(sp)
46 REG_S s4,O32_FRAMESZ-7*SZREG(sp)
47 REG_S s3,O32_FRAMESZ-8*SZREG(sp)
48 REG_S s2,O32_FRAMESZ-9*SZREG(sp)
49 REG_S s1,O32_FRAMESZ-10*SZREG(sp)
50 REG_S s0,O32_FRAMESZ-11*SZREG(sp)
51
52 move jp,a0
53
54 sll a0,a1,zero
55 sll a1,a2,zero
56 sll a2,a3,zero
57 sll a3,a4,zero
58 sw a5,0x10(sp)
59 sw a6,0x14(sp)
60 sw a7,0x18(sp)
61
62 PTR_LA t0,O32_FRAMESZ(sp)
63 PTR_LA t1,0x1c(sp)
64 li t2,O32_ARGC-7
651:
66 lw t3,(t0)
67 REG_ADDU t0,SZREG
68 sw t3,(t1)
69 REG_SUBU t2,1
70 REG_ADDU t1,4
71 bnez t2,1b
72
73 jalr jp
74
75 REG_L s0,O32_FRAMESZ-11*SZREG(sp)
76 REG_L s1,O32_FRAMESZ-10*SZREG(sp)
77 REG_L s2,O32_FRAMESZ-9*SZREG(sp)
78 REG_L s3,O32_FRAMESZ-8*SZREG(sp)
79 REG_L s4,O32_FRAMESZ-7*SZREG(sp)
80 REG_L s5,O32_FRAMESZ-6*SZREG(sp)
81 REG_L s6,O32_FRAMESZ-5*SZREG(sp)
82 REG_L s7,O32_FRAMESZ-4*SZREG(sp)
83 REG_L gp,O32_FRAMESZ-3*SZREG(sp)
84 REG_L fp,O32_FRAMESZ-2*SZREG(sp)
85 REG_L ra,O32_FRAMESZ-1*SZREG(sp)
86
87 REG_ADDU sp,O32_FRAMESZ
88 jr ra
89END(call_o32)
diff --git a/arch/mips/fw/lib/call_o32.S b/arch/mips/fw/lib/call_o32.S
index b308b2a0613e..4703fe4dbd9a 100644
--- a/arch/mips/fw/lib/call_o32.S
+++ b/arch/mips/fw/lib/call_o32.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * O32 interface for the 64 (or N32) ABI. 2 * O32 interface for the 64 (or N32) ABI.
3 * 3 *
4 * Copyright (C) 2002 Maciej W. Rozycki 4 * Copyright (C) 2002, 2014 Maciej W. Rozycki
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
@@ -12,28 +12,37 @@
12#include <asm/asm.h> 12#include <asm/asm.h>
13#include <asm/regdef.h> 13#include <asm/regdef.h>
14 14
15/* O32 register size. */
16#define O32_SZREG 4
15/* Maximum number of arguments supported. Must be even! */ 17/* Maximum number of arguments supported. Must be even! */
16#define O32_ARGC 32 18#define O32_ARGC 32
17/* Number of static registers we save. */ 19/* Number of static registers we save. */
18#define O32_STATC 11 20#define O32_STATC 11
19/* Frame size for static register */ 21/* Argument area frame size. */
20#define O32_FRAMESZ (SZREG * O32_STATC) 22#define O32_ARGSZ (O32_SZREG * O32_ARGC)
21/* Frame size on new stack */ 23/* Static register save area frame size. */
22#define O32_FRAMESZ_NEW (SZREG + 4 * O32_ARGC) 24#define O32_STATSZ (SZREG * O32_STATC)
25/* Stack pointer register save area frame size. */
26#define O32_SPSZ SZREG
27/* Combined area frame size. */
28#define O32_FRAMESZ (O32_ARGSZ + O32_SPSZ + O32_STATSZ)
29/* Switched stack frame size. */
30#define O32_NFRAMESZ (O32_ARGSZ + O32_SPSZ)
23 31
24 .text 32 .text
25 33
26/* 34/*
27 * O32 function call dispatcher, for interfacing 32-bit ROM routines. 35 * O32 function call dispatcher, for interfacing 32-bit ROM routines.
28 * 36 *
29 * The standard 64 (N32) calling sequence is supported, with a0 37 * The standard 64 (N32) calling sequence is supported, with a0 holding
30 * holding a function pointer, a1 a new stack pointer, a2-a7 -- its 38 * a function pointer, a1 a pointer to the new stack to call the
31 * first six arguments and the stack -- remaining ones (up to O32_ARGC, 39 * function with or 0 if no stack switching is requested, a2-a7 -- the
32 * including a2-a7). Static registers, gp and fp are preserved, v0 holds 40 * function call's first six arguments, and the stack -- the remaining
33 * a result. This code relies on the called o32 function for sp and ra 41 * arguments (up to O32_ARGC, including a2-a7). Static registers, gp
34 * restoration and this dispatcher has to be placed in a KSEGx (or KUSEG) 42 * and fp are preserved, v0 holds the result. This code relies on the
35 * address space. Any pointers passed have to point to addresses within 43 * called o32 function for sp and ra restoration and this dispatcher has
36 * one of these spaces as well. 44 * to be placed in a KSEGx (or KUSEG) address space. Any pointers
45 * passed have to point to addresses within one of these spaces as well.
37 */ 46 */
38NESTED(call_o32, O32_FRAMESZ, ra) 47NESTED(call_o32, O32_FRAMESZ, ra)
39 REG_SUBU sp,O32_FRAMESZ 48 REG_SUBU sp,O32_FRAMESZ
@@ -51,32 +60,36 @@ NESTED(call_o32, O32_FRAMESZ, ra)
51 REG_S s0,O32_FRAMESZ-11*SZREG(sp) 60 REG_S s0,O32_FRAMESZ-11*SZREG(sp)
52 61
53 move jp,a0 62 move jp,a0
54 REG_SUBU s0,a1,O32_FRAMESZ_NEW 63
55 REG_S sp,O32_FRAMESZ_NEW-1*SZREG(s0) 64 move fp,sp
65 beqz a1,0f
66 REG_SUBU fp,a1,O32_NFRAMESZ
670:
68 REG_S sp,O32_NFRAMESZ-1*SZREG(fp)
56 69
57 sll a0,a2,zero 70 sll a0,a2,zero
58 sll a1,a3,zero 71 sll a1,a3,zero
59 sll a2,a4,zero 72 sll a2,a4,zero
60 sll a3,a5,zero 73 sll a3,a5,zero
61 sw a6,0x10(s0) 74 sw a6,4*O32_SZREG(fp)
62 sw a7,0x14(s0) 75 sw a7,5*O32_SZREG(fp)
63 76
64 PTR_LA t0,O32_FRAMESZ(sp) 77 PTR_LA t0,O32_FRAMESZ(sp)
65 PTR_LA t1,0x18(s0) 78 PTR_LA t1,6*O32_SZREG(fp)
66 li t2,O32_ARGC-6 79 li t2,O32_ARGC-6
671: 801:
68 lw t3,(t0) 81 lw t3,(t0)
69 REG_ADDU t0,SZREG 82 REG_ADDU t0,SZREG
70 sw t3,(t1) 83 sw t3,(t1)
71 REG_SUBU t2,1 84 REG_SUBU t2,1
72 REG_ADDU t1,4 85 REG_ADDU t1,O32_SZREG
73 bnez t2,1b 86 bnez t2,1b
74 87
75 move sp,s0 88 move sp,fp
76 89
77 jalr jp 90 jalr jp
78 91
79 REG_L sp,O32_FRAMESZ_NEW-1*SZREG(sp) 92 REG_L sp,O32_NFRAMESZ-1*SZREG(sp)
80 93
81 REG_L s0,O32_FRAMESZ-11*SZREG(sp) 94 REG_L s0,O32_FRAMESZ-11*SZREG(sp)
82 REG_L s1,O32_FRAMESZ-10*SZREG(sp) 95 REG_L s1,O32_FRAMESZ-10*SZREG(sp)
diff --git a/arch/mips/fw/sni/sniprom.c b/arch/mips/fw/sni/sniprom.c
index 2c2cb182af4e..6aa264b9856a 100644
--- a/arch/mips/fw/sni/sniprom.c
+++ b/arch/mips/fw/sni/sniprom.c
@@ -40,7 +40,8 @@
40 40
41#ifdef CONFIG_64BIT 41#ifdef CONFIG_64BIT
42 42
43static u8 o32_stk[16384]; 43/* O32 stack has to be 8-byte aligned. */
44static u64 o32_stk[4096];
44#define O32_STK &o32_stk[sizeof(o32_stk)] 45#define O32_STK &o32_stk[sizeof(o32_stk)]
45 46
46#define __PROM_O32(fun, arg) fun arg __asm__(#fun); \ 47#define __PROM_O32(fun, arg) fun arg __asm__(#fun); \
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h
index dc2135be2a3a..ff2707ab3295 100644
--- a/arch/mips/include/asm/cpu-info.h
+++ b/arch/mips/include/asm/cpu-info.h
@@ -39,14 +39,14 @@ struct cache_desc {
39#define MIPS_CACHE_PINDEX 0x00000020 /* Physically indexed cache */ 39#define MIPS_CACHE_PINDEX 0x00000020 /* Physically indexed cache */
40 40
41struct cpuinfo_mips { 41struct cpuinfo_mips {
42 unsigned int udelay_val; 42 unsigned long asid_cache;
43 unsigned int asid_cache;
44 43
45 /* 44 /*
46 * Capability and feature descriptor structure for MIPS CPU 45 * Capability and feature descriptor structure for MIPS CPU
47 */ 46 */
48 unsigned long options; 47 unsigned long options;
49 unsigned long ases; 48 unsigned long ases;
49 unsigned int udelay_val;
50 unsigned int processor_id; 50 unsigned int processor_id;
51 unsigned int fpu_id; 51 unsigned int fpu_id;
52 unsigned int msa_id; 52 unsigned int msa_id;
diff --git a/arch/mips/include/asm/dec/prom.h b/arch/mips/include/asm/dec/prom.h
index c0ead6313845..b59a2103b61a 100644
--- a/arch/mips/include/asm/dec/prom.h
+++ b/arch/mips/include/asm/dec/prom.h
@@ -113,31 +113,31 @@ extern int (*__pmax_close)(int);
113#define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \ 113#define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \
114 __asm__(#fun " = call_o32") 114 __asm__(#fun " = call_o32")
115 115
116int __DEC_PROM_O32(_rex_bootinit, (int (*)(void))); 116int __DEC_PROM_O32(_rex_bootinit, (int (*)(void), void *));
117int __DEC_PROM_O32(_rex_bootread, (int (*)(void))); 117int __DEC_PROM_O32(_rex_bootread, (int (*)(void), void *));
118int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), memmap *)); 118int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), void *, memmap *));
119unsigned long *__DEC_PROM_O32(_rex_slot_address, 119unsigned long *__DEC_PROM_O32(_rex_slot_address,
120 (unsigned long *(*)(int), int)); 120 (unsigned long *(*)(int), void *, int));
121void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void))); 121void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void), void *));
122int __DEC_PROM_O32(_rex_getsysid, (int (*)(void))); 122int __DEC_PROM_O32(_rex_getsysid, (int (*)(void), void *));
123void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void))); 123void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void), void *));
124 124
125int __DEC_PROM_O32(_prom_getchar, (int (*)(void))); 125int __DEC_PROM_O32(_prom_getchar, (int (*)(void), void *));
126char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), char *)); 126char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), void *, char *));
127int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), char *, ...)); 127int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), void *, char *, ...));
128 128
129 129
130#define rex_bootinit() _rex_bootinit(__rex_bootinit) 130#define rex_bootinit() _rex_bootinit(__rex_bootinit, NULL)
131#define rex_bootread() _rex_bootread(__rex_bootread) 131#define rex_bootread() _rex_bootread(__rex_bootread, NULL)
132#define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, x) 132#define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, NULL, x)
133#define rex_slot_address(x) _rex_slot_address(__rex_slot_address, x) 133#define rex_slot_address(x) _rex_slot_address(__rex_slot_address, NULL, x)
134#define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo) 134#define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo, NULL)
135#define rex_getsysid() _rex_getsysid(__rex_getsysid) 135#define rex_getsysid() _rex_getsysid(__rex_getsysid, NULL)
136#define rex_clear_cache() _rex_clear_cache(__rex_clear_cache) 136#define rex_clear_cache() _rex_clear_cache(__rex_clear_cache, NULL)
137 137
138#define prom_getchar() _prom_getchar(__prom_getchar) 138#define prom_getchar() _prom_getchar(__prom_getchar, NULL)
139#define prom_getenv(x) _prom_getenv(__prom_getenv, x) 139#define prom_getenv(x) _prom_getenv(__prom_getenv, NULL, x)
140#define prom_printf(x...) _prom_printf(__prom_printf, x) 140#define prom_printf(x...) _prom_printf(__prom_printf, NULL, x)
141 141
142#else /* !CONFIG_64BIT */ 142#else /* !CONFIG_64BIT */
143 143
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 12d6842962be..974b0e308963 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -73,11 +73,6 @@ extern unsigned long PCIBIOS_MIN_MEM;
73 73
74extern void pcibios_set_master(struct pci_dev *dev); 74extern void pcibios_set_master(struct pci_dev *dev);
75 75
76static inline void pcibios_penalize_isa_irq(int irq, int active)
77{
78 /* We don't do dynamic PCI IRQ allocation */
79}
80
81#define HAVE_PCI_MMAP 76#define HAVE_PCI_MMAP
82 77
83extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 78extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
diff --git a/arch/mips/include/asm/rm9k-ocd.h b/arch/mips/include/asm/rm9k-ocd.h
deleted file mode 100644
index b0b80d9ecf96..000000000000
--- a/arch/mips/include/asm/rm9k-ocd.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#if !defined(_ASM_RM9K_OCD_H)
21#define _ASM_RM9K_OCD_H
22
23#include <linux/types.h>
24#include <linux/spinlock.h>
25#include <asm/io.h>
26
27extern volatile void __iomem * const ocd_base;
28extern volatile void __iomem * const titan_base;
29
30#define ocd_addr(__x__) (ocd_base + (__x__))
31#define titan_addr(__x__) (titan_base + (__x__))
32#define scram_addr(__x__) (scram_base + (__x__))
33
34/* OCD register access */
35#define ocd_readl(__offs__) __raw_readl(ocd_addr(__offs__))
36#define ocd_readw(__offs__) __raw_readw(ocd_addr(__offs__))
37#define ocd_readb(__offs__) __raw_readb(ocd_addr(__offs__))
38#define ocd_writel(__val__, __offs__) \
39 __raw_writel((__val__), ocd_addr(__offs__))
40#define ocd_writew(__val__, __offs__) \
41 __raw_writew((__val__), ocd_addr(__offs__))
42#define ocd_writeb(__val__, __offs__) \
43 __raw_writeb((__val__), ocd_addr(__offs__))
44
45/* TITAN register access - 32 bit-wide only */
46#define titan_readl(__offs__) __raw_readl(titan_addr(__offs__))
47#define titan_writel(__val__, __offs__) \
48 __raw_writel((__val__), titan_addr(__offs__))
49
50/* Protect access to shared TITAN registers */
51extern spinlock_t titan_lock;
52extern int titan_irqflags;
53#define lock_titan_regs() spin_lock_irqsave(&titan_lock, titan_irqflags)
54#define unlock_titan_regs() spin_unlock_irqrestore(&titan_lock, titan_irqflags)
55
56#endif /* !defined(_ASM_RM9K_OCD_H) */
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index c6e9cd2bca8d..17960fe7a8ce 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -133,6 +133,8 @@ static inline int syscall_get_arch(void)
133#ifdef CONFIG_64BIT 133#ifdef CONFIG_64BIT
134 if (!test_thread_flag(TIF_32BIT_REGS)) 134 if (!test_thread_flag(TIF_32BIT_REGS))
135 arch |= __AUDIT_ARCH_64BIT; 135 arch |= __AUDIT_ARCH_64BIT;
136 if (test_thread_flag(TIF_32BIT_ADDR))
137 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
136#endif 138#endif
137#if defined(__LITTLE_ENDIAN) 139#if defined(__LITTLE_ENDIAN)
138 arch |= __AUDIT_ARCH_LE; 140 arch |= __AUDIT_ARCH_LE;
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h
index df6e775f3fef..3125797f2a88 100644
--- a/arch/mips/include/uapi/asm/inst.h
+++ b/arch/mips/include/uapi/asm/inst.h
@@ -484,13 +484,13 @@ enum MIPS6e_i8_func {
484 * Damn ... bitfields depend from byteorder :-( 484 * Damn ... bitfields depend from byteorder :-(
485 */ 485 */
486#ifdef __MIPSEB__ 486#ifdef __MIPSEB__
487#define BITFIELD_FIELD(field, more) \ 487#define __BITFIELD_FIELD(field, more) \
488 field; \ 488 field; \
489 more 489 more
490 490
491#elif defined(__MIPSEL__) 491#elif defined(__MIPSEL__)
492 492
493#define BITFIELD_FIELD(field, more) \ 493#define __BITFIELD_FIELD(field, more) \
494 more \ 494 more \
495 field; 495 field;
496 496
@@ -499,112 +499,112 @@ enum MIPS6e_i8_func {
499#endif 499#endif
500 500
501struct j_format { 501struct j_format {
502 BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */ 502 __BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */
503 BITFIELD_FIELD(unsigned int target : 26, 503 __BITFIELD_FIELD(unsigned int target : 26,
504 ;)) 504 ;))
505}; 505};
506 506
507struct i_format { /* signed immediate format */ 507struct i_format { /* signed immediate format */
508 BITFIELD_FIELD(unsigned int opcode : 6, 508 __BITFIELD_FIELD(unsigned int opcode : 6,
509 BITFIELD_FIELD(unsigned int rs : 5, 509 __BITFIELD_FIELD(unsigned int rs : 5,
510 BITFIELD_FIELD(unsigned int rt : 5, 510 __BITFIELD_FIELD(unsigned int rt : 5,
511 BITFIELD_FIELD(signed int simmediate : 16, 511 __BITFIELD_FIELD(signed int simmediate : 16,
512 ;)))) 512 ;))))
513}; 513};
514 514
515struct u_format { /* unsigned immediate format */ 515struct u_format { /* unsigned immediate format */
516 BITFIELD_FIELD(unsigned int opcode : 6, 516 __BITFIELD_FIELD(unsigned int opcode : 6,
517 BITFIELD_FIELD(unsigned int rs : 5, 517 __BITFIELD_FIELD(unsigned int rs : 5,
518 BITFIELD_FIELD(unsigned int rt : 5, 518 __BITFIELD_FIELD(unsigned int rt : 5,
519 BITFIELD_FIELD(unsigned int uimmediate : 16, 519 __BITFIELD_FIELD(unsigned int uimmediate : 16,
520 ;)))) 520 ;))))
521}; 521};
522 522
523struct c_format { /* Cache (>= R6000) format */ 523struct c_format { /* Cache (>= R6000) format */
524 BITFIELD_FIELD(unsigned int opcode : 6, 524 __BITFIELD_FIELD(unsigned int opcode : 6,
525 BITFIELD_FIELD(unsigned int rs : 5, 525 __BITFIELD_FIELD(unsigned int rs : 5,
526 BITFIELD_FIELD(unsigned int c_op : 3, 526 __BITFIELD_FIELD(unsigned int c_op : 3,
527 BITFIELD_FIELD(unsigned int cache : 2, 527 __BITFIELD_FIELD(unsigned int cache : 2,
528 BITFIELD_FIELD(unsigned int simmediate : 16, 528 __BITFIELD_FIELD(unsigned int simmediate : 16,
529 ;))))) 529 ;)))))
530}; 530};
531 531
532struct r_format { /* Register format */ 532struct r_format { /* Register format */
533 BITFIELD_FIELD(unsigned int opcode : 6, 533 __BITFIELD_FIELD(unsigned int opcode : 6,
534 BITFIELD_FIELD(unsigned int rs : 5, 534 __BITFIELD_FIELD(unsigned int rs : 5,
535 BITFIELD_FIELD(unsigned int rt : 5, 535 __BITFIELD_FIELD(unsigned int rt : 5,
536 BITFIELD_FIELD(unsigned int rd : 5, 536 __BITFIELD_FIELD(unsigned int rd : 5,
537 BITFIELD_FIELD(unsigned int re : 5, 537 __BITFIELD_FIELD(unsigned int re : 5,
538 BITFIELD_FIELD(unsigned int func : 6, 538 __BITFIELD_FIELD(unsigned int func : 6,
539 ;)))))) 539 ;))))))
540}; 540};
541 541
542struct p_format { /* Performance counter format (R10000) */ 542struct p_format { /* Performance counter format (R10000) */
543 BITFIELD_FIELD(unsigned int opcode : 6, 543 __BITFIELD_FIELD(unsigned int opcode : 6,
544 BITFIELD_FIELD(unsigned int rs : 5, 544 __BITFIELD_FIELD(unsigned int rs : 5,
545 BITFIELD_FIELD(unsigned int rt : 5, 545 __BITFIELD_FIELD(unsigned int rt : 5,
546 BITFIELD_FIELD(unsigned int rd : 5, 546 __BITFIELD_FIELD(unsigned int rd : 5,
547 BITFIELD_FIELD(unsigned int re : 5, 547 __BITFIELD_FIELD(unsigned int re : 5,
548 BITFIELD_FIELD(unsigned int func : 6, 548 __BITFIELD_FIELD(unsigned int func : 6,
549 ;)))))) 549 ;))))))
550}; 550};
551 551
552struct f_format { /* FPU register format */ 552struct f_format { /* FPU register format */
553 BITFIELD_FIELD(unsigned int opcode : 6, 553 __BITFIELD_FIELD(unsigned int opcode : 6,
554 BITFIELD_FIELD(unsigned int : 1, 554 __BITFIELD_FIELD(unsigned int : 1,
555 BITFIELD_FIELD(unsigned int fmt : 4, 555 __BITFIELD_FIELD(unsigned int fmt : 4,
556 BITFIELD_FIELD(unsigned int rt : 5, 556 __BITFIELD_FIELD(unsigned int rt : 5,
557 BITFIELD_FIELD(unsigned int rd : 5, 557 __BITFIELD_FIELD(unsigned int rd : 5,
558 BITFIELD_FIELD(unsigned int re : 5, 558 __BITFIELD_FIELD(unsigned int re : 5,
559 BITFIELD_FIELD(unsigned int func : 6, 559 __BITFIELD_FIELD(unsigned int func : 6,
560 ;))))))) 560 ;)))))))
561}; 561};
562 562
563struct ma_format { /* FPU multiply and add format (MIPS IV) */ 563struct ma_format { /* FPU multiply and add format (MIPS IV) */
564 BITFIELD_FIELD(unsigned int opcode : 6, 564 __BITFIELD_FIELD(unsigned int opcode : 6,
565 BITFIELD_FIELD(unsigned int fr : 5, 565 __BITFIELD_FIELD(unsigned int fr : 5,
566 BITFIELD_FIELD(unsigned int ft : 5, 566 __BITFIELD_FIELD(unsigned int ft : 5,
567 BITFIELD_FIELD(unsigned int fs : 5, 567 __BITFIELD_FIELD(unsigned int fs : 5,
568 BITFIELD_FIELD(unsigned int fd : 5, 568 __BITFIELD_FIELD(unsigned int fd : 5,
569 BITFIELD_FIELD(unsigned int func : 4, 569 __BITFIELD_FIELD(unsigned int func : 4,
570 BITFIELD_FIELD(unsigned int fmt : 2, 570 __BITFIELD_FIELD(unsigned int fmt : 2,
571 ;))))))) 571 ;)))))))
572}; 572};
573 573
574struct b_format { /* BREAK and SYSCALL */ 574struct b_format { /* BREAK and SYSCALL */
575 BITFIELD_FIELD(unsigned int opcode : 6, 575 __BITFIELD_FIELD(unsigned int opcode : 6,
576 BITFIELD_FIELD(unsigned int code : 20, 576 __BITFIELD_FIELD(unsigned int code : 20,
577 BITFIELD_FIELD(unsigned int func : 6, 577 __BITFIELD_FIELD(unsigned int func : 6,
578 ;))) 578 ;)))
579}; 579};
580 580
581struct ps_format { /* MIPS-3D / paired single format */ 581struct ps_format { /* MIPS-3D / paired single format */
582 BITFIELD_FIELD(unsigned int opcode : 6, 582 __BITFIELD_FIELD(unsigned int opcode : 6,
583 BITFIELD_FIELD(unsigned int rs : 5, 583 __BITFIELD_FIELD(unsigned int rs : 5,
584 BITFIELD_FIELD(unsigned int ft : 5, 584 __BITFIELD_FIELD(unsigned int ft : 5,
585 BITFIELD_FIELD(unsigned int fs : 5, 585 __BITFIELD_FIELD(unsigned int fs : 5,
586 BITFIELD_FIELD(unsigned int fd : 5, 586 __BITFIELD_FIELD(unsigned int fd : 5,
587 BITFIELD_FIELD(unsigned int func : 6, 587 __BITFIELD_FIELD(unsigned int func : 6,
588 ;)))))) 588 ;))))))
589}; 589};
590 590
591struct v_format { /* MDMX vector format */ 591struct v_format { /* MDMX vector format */
592 BITFIELD_FIELD(unsigned int opcode : 6, 592 __BITFIELD_FIELD(unsigned int opcode : 6,
593 BITFIELD_FIELD(unsigned int sel : 4, 593 __BITFIELD_FIELD(unsigned int sel : 4,
594 BITFIELD_FIELD(unsigned int fmt : 1, 594 __BITFIELD_FIELD(unsigned int fmt : 1,
595 BITFIELD_FIELD(unsigned int vt : 5, 595 __BITFIELD_FIELD(unsigned int vt : 5,
596 BITFIELD_FIELD(unsigned int vs : 5, 596 __BITFIELD_FIELD(unsigned int vs : 5,
597 BITFIELD_FIELD(unsigned int vd : 5, 597 __BITFIELD_FIELD(unsigned int vd : 5,
598 BITFIELD_FIELD(unsigned int func : 6, 598 __BITFIELD_FIELD(unsigned int func : 6,
599 ;))))))) 599 ;)))))))
600}; 600};
601 601
602struct spec3_format { /* SPEC3 */ 602struct spec3_format { /* SPEC3 */
603 BITFIELD_FIELD(unsigned int opcode:6, 603 __BITFIELD_FIELD(unsigned int opcode:6,
604 BITFIELD_FIELD(unsigned int rs:5, 604 __BITFIELD_FIELD(unsigned int rs:5,
605 BITFIELD_FIELD(unsigned int rt:5, 605 __BITFIELD_FIELD(unsigned int rt:5,
606 BITFIELD_FIELD(signed int simmediate:9, 606 __BITFIELD_FIELD(signed int simmediate:9,
607 BITFIELD_FIELD(unsigned int func:7, 607 __BITFIELD_FIELD(unsigned int func:7,
608 ;))))) 608 ;)))))
609}; 609};
610 610
@@ -616,141 +616,141 @@ struct spec3_format { /* SPEC3 */
616 * if it is MIPS32 instruction re-encoded for use in the microMIPS ASE. 616 * if it is MIPS32 instruction re-encoded for use in the microMIPS ASE.
617 */ 617 */
618struct fb_format { /* FPU branch format (MIPS32) */ 618struct fb_format { /* FPU branch format (MIPS32) */
619 BITFIELD_FIELD(unsigned int opcode : 6, 619 __BITFIELD_FIELD(unsigned int opcode : 6,
620 BITFIELD_FIELD(unsigned int bc : 5, 620 __BITFIELD_FIELD(unsigned int bc : 5,
621 BITFIELD_FIELD(unsigned int cc : 3, 621 __BITFIELD_FIELD(unsigned int cc : 3,
622 BITFIELD_FIELD(unsigned int flag : 2, 622 __BITFIELD_FIELD(unsigned int flag : 2,
623 BITFIELD_FIELD(signed int simmediate : 16, 623 __BITFIELD_FIELD(signed int simmediate : 16,
624 ;))))) 624 ;)))))
625}; 625};
626 626
627struct fp0_format { /* FPU multiply and add format (MIPS32) */ 627struct fp0_format { /* FPU multiply and add format (MIPS32) */
628 BITFIELD_FIELD(unsigned int opcode : 6, 628 __BITFIELD_FIELD(unsigned int opcode : 6,
629 BITFIELD_FIELD(unsigned int fmt : 5, 629 __BITFIELD_FIELD(unsigned int fmt : 5,
630 BITFIELD_FIELD(unsigned int ft : 5, 630 __BITFIELD_FIELD(unsigned int ft : 5,
631 BITFIELD_FIELD(unsigned int fs : 5, 631 __BITFIELD_FIELD(unsigned int fs : 5,
632 BITFIELD_FIELD(unsigned int fd : 5, 632 __BITFIELD_FIELD(unsigned int fd : 5,
633 BITFIELD_FIELD(unsigned int func : 6, 633 __BITFIELD_FIELD(unsigned int func : 6,
634 ;)))))) 634 ;))))))
635}; 635};
636 636
637struct mm_fp0_format { /* FPU multipy and add format (microMIPS) */ 637struct mm_fp0_format { /* FPU multipy and add format (microMIPS) */
638 BITFIELD_FIELD(unsigned int opcode : 6, 638 __BITFIELD_FIELD(unsigned int opcode : 6,
639 BITFIELD_FIELD(unsigned int ft : 5, 639 __BITFIELD_FIELD(unsigned int ft : 5,
640 BITFIELD_FIELD(unsigned int fs : 5, 640 __BITFIELD_FIELD(unsigned int fs : 5,
641 BITFIELD_FIELD(unsigned int fd : 5, 641 __BITFIELD_FIELD(unsigned int fd : 5,
642 BITFIELD_FIELD(unsigned int fmt : 3, 642 __BITFIELD_FIELD(unsigned int fmt : 3,
643 BITFIELD_FIELD(unsigned int op : 2, 643 __BITFIELD_FIELD(unsigned int op : 2,
644 BITFIELD_FIELD(unsigned int func : 6, 644 __BITFIELD_FIELD(unsigned int func : 6,
645 ;))))))) 645 ;)))))))
646}; 646};
647 647
648struct fp1_format { /* FPU mfc1 and cfc1 format (MIPS32) */ 648struct fp1_format { /* FPU mfc1 and cfc1 format (MIPS32) */
649 BITFIELD_FIELD(unsigned int opcode : 6, 649 __BITFIELD_FIELD(unsigned int opcode : 6,
650 BITFIELD_FIELD(unsigned int op : 5, 650 __BITFIELD_FIELD(unsigned int op : 5,
651 BITFIELD_FIELD(unsigned int rt : 5, 651 __BITFIELD_FIELD(unsigned int rt : 5,
652 BITFIELD_FIELD(unsigned int fs : 5, 652 __BITFIELD_FIELD(unsigned int fs : 5,
653 BITFIELD_FIELD(unsigned int fd : 5, 653 __BITFIELD_FIELD(unsigned int fd : 5,
654 BITFIELD_FIELD(unsigned int func : 6, 654 __BITFIELD_FIELD(unsigned int func : 6,
655 ;)))))) 655 ;))))))
656}; 656};
657 657
658struct mm_fp1_format { /* FPU mfc1 and cfc1 format (microMIPS) */ 658struct mm_fp1_format { /* FPU mfc1 and cfc1 format (microMIPS) */
659 BITFIELD_FIELD(unsigned int opcode : 6, 659 __BITFIELD_FIELD(unsigned int opcode : 6,
660 BITFIELD_FIELD(unsigned int rt : 5, 660 __BITFIELD_FIELD(unsigned int rt : 5,
661 BITFIELD_FIELD(unsigned int fs : 5, 661 __BITFIELD_FIELD(unsigned int fs : 5,
662 BITFIELD_FIELD(unsigned int fmt : 2, 662 __BITFIELD_FIELD(unsigned int fmt : 2,
663 BITFIELD_FIELD(unsigned int op : 8, 663 __BITFIELD_FIELD(unsigned int op : 8,
664 BITFIELD_FIELD(unsigned int func : 6, 664 __BITFIELD_FIELD(unsigned int func : 6,
665 ;)))))) 665 ;))))))
666}; 666};
667 667
668struct mm_fp2_format { /* FPU movt and movf format (microMIPS) */ 668struct mm_fp2_format { /* FPU movt and movf format (microMIPS) */
669 BITFIELD_FIELD(unsigned int opcode : 6, 669 __BITFIELD_FIELD(unsigned int opcode : 6,
670 BITFIELD_FIELD(unsigned int fd : 5, 670 __BITFIELD_FIELD(unsigned int fd : 5,
671 BITFIELD_FIELD(unsigned int fs : 5, 671 __BITFIELD_FIELD(unsigned int fs : 5,
672 BITFIELD_FIELD(unsigned int cc : 3, 672 __BITFIELD_FIELD(unsigned int cc : 3,
673 BITFIELD_FIELD(unsigned int zero : 2, 673 __BITFIELD_FIELD(unsigned int zero : 2,
674 BITFIELD_FIELD(unsigned int fmt : 2, 674 __BITFIELD_FIELD(unsigned int fmt : 2,
675 BITFIELD_FIELD(unsigned int op : 3, 675 __BITFIELD_FIELD(unsigned int op : 3,
676 BITFIELD_FIELD(unsigned int func : 6, 676 __BITFIELD_FIELD(unsigned int func : 6,
677 ;)))))))) 677 ;))))))))
678}; 678};
679 679
680struct mm_fp3_format { /* FPU abs and neg format (microMIPS) */ 680struct mm_fp3_format { /* FPU abs and neg format (microMIPS) */
681 BITFIELD_FIELD(unsigned int opcode : 6, 681 __BITFIELD_FIELD(unsigned int opcode : 6,
682 BITFIELD_FIELD(unsigned int rt : 5, 682 __BITFIELD_FIELD(unsigned int rt : 5,
683 BITFIELD_FIELD(unsigned int fs : 5, 683 __BITFIELD_FIELD(unsigned int fs : 5,
684 BITFIELD_FIELD(unsigned int fmt : 3, 684 __BITFIELD_FIELD(unsigned int fmt : 3,
685 BITFIELD_FIELD(unsigned int op : 7, 685 __BITFIELD_FIELD(unsigned int op : 7,
686 BITFIELD_FIELD(unsigned int func : 6, 686 __BITFIELD_FIELD(unsigned int func : 6,
687 ;)))))) 687 ;))))))
688}; 688};
689 689
690struct mm_fp4_format { /* FPU c.cond format (microMIPS) */ 690struct mm_fp4_format { /* FPU c.cond format (microMIPS) */
691 BITFIELD_FIELD(unsigned int opcode : 6, 691 __BITFIELD_FIELD(unsigned int opcode : 6,
692 BITFIELD_FIELD(unsigned int rt : 5, 692 __BITFIELD_FIELD(unsigned int rt : 5,
693 BITFIELD_FIELD(unsigned int fs : 5, 693 __BITFIELD_FIELD(unsigned int fs : 5,
694 BITFIELD_FIELD(unsigned int cc : 3, 694 __BITFIELD_FIELD(unsigned int cc : 3,
695 BITFIELD_FIELD(unsigned int fmt : 3, 695 __BITFIELD_FIELD(unsigned int fmt : 3,
696 BITFIELD_FIELD(unsigned int cond : 4, 696 __BITFIELD_FIELD(unsigned int cond : 4,
697 BITFIELD_FIELD(unsigned int func : 6, 697 __BITFIELD_FIELD(unsigned int func : 6,
698 ;))))))) 698 ;)))))))
699}; 699};
700 700
701struct mm_fp5_format { /* FPU lwxc1 and swxc1 format (microMIPS) */ 701struct mm_fp5_format { /* FPU lwxc1 and swxc1 format (microMIPS) */
702 BITFIELD_FIELD(unsigned int opcode : 6, 702 __BITFIELD_FIELD(unsigned int opcode : 6,
703 BITFIELD_FIELD(unsigned int index : 5, 703 __BITFIELD_FIELD(unsigned int index : 5,
704 BITFIELD_FIELD(unsigned int base : 5, 704 __BITFIELD_FIELD(unsigned int base : 5,
705 BITFIELD_FIELD(unsigned int fd : 5, 705 __BITFIELD_FIELD(unsigned int fd : 5,
706 BITFIELD_FIELD(unsigned int op : 5, 706 __BITFIELD_FIELD(unsigned int op : 5,
707 BITFIELD_FIELD(unsigned int func : 6, 707 __BITFIELD_FIELD(unsigned int func : 6,
708 ;)))))) 708 ;))))))
709}; 709};
710 710
711struct fp6_format { /* FPU madd and msub format (MIPS IV) */ 711struct fp6_format { /* FPU madd and msub format (MIPS IV) */
712 BITFIELD_FIELD(unsigned int opcode : 6, 712 __BITFIELD_FIELD(unsigned int opcode : 6,
713 BITFIELD_FIELD(unsigned int fr : 5, 713 __BITFIELD_FIELD(unsigned int fr : 5,
714 BITFIELD_FIELD(unsigned int ft : 5, 714 __BITFIELD_FIELD(unsigned int ft : 5,
715 BITFIELD_FIELD(unsigned int fs : 5, 715 __BITFIELD_FIELD(unsigned int fs : 5,
716 BITFIELD_FIELD(unsigned int fd : 5, 716 __BITFIELD_FIELD(unsigned int fd : 5,
717 BITFIELD_FIELD(unsigned int func : 6, 717 __BITFIELD_FIELD(unsigned int func : 6,
718 ;)))))) 718 ;))))))
719}; 719};
720 720
721struct mm_fp6_format { /* FPU madd and msub format (microMIPS) */ 721struct mm_fp6_format { /* FPU madd and msub format (microMIPS) */
722 BITFIELD_FIELD(unsigned int opcode : 6, 722 __BITFIELD_FIELD(unsigned int opcode : 6,
723 BITFIELD_FIELD(unsigned int ft : 5, 723 __BITFIELD_FIELD(unsigned int ft : 5,
724 BITFIELD_FIELD(unsigned int fs : 5, 724 __BITFIELD_FIELD(unsigned int fs : 5,
725 BITFIELD_FIELD(unsigned int fd : 5, 725 __BITFIELD_FIELD(unsigned int fd : 5,
726 BITFIELD_FIELD(unsigned int fr : 5, 726 __BITFIELD_FIELD(unsigned int fr : 5,
727 BITFIELD_FIELD(unsigned int func : 6, 727 __BITFIELD_FIELD(unsigned int func : 6,
728 ;)))))) 728 ;))))))
729}; 729};
730 730
731struct mm_i_format { /* Immediate format (microMIPS) */ 731struct mm_i_format { /* Immediate format (microMIPS) */
732 BITFIELD_FIELD(unsigned int opcode : 6, 732 __BITFIELD_FIELD(unsigned int opcode : 6,
733 BITFIELD_FIELD(unsigned int rt : 5, 733 __BITFIELD_FIELD(unsigned int rt : 5,
734 BITFIELD_FIELD(unsigned int rs : 5, 734 __BITFIELD_FIELD(unsigned int rs : 5,
735 BITFIELD_FIELD(signed int simmediate : 16, 735 __BITFIELD_FIELD(signed int simmediate : 16,
736 ;)))) 736 ;))))
737}; 737};
738 738
739struct mm_m_format { /* Multi-word load/store format (microMIPS) */ 739struct mm_m_format { /* Multi-word load/store format (microMIPS) */
740 BITFIELD_FIELD(unsigned int opcode : 6, 740 __BITFIELD_FIELD(unsigned int opcode : 6,
741 BITFIELD_FIELD(unsigned int rd : 5, 741 __BITFIELD_FIELD(unsigned int rd : 5,
742 BITFIELD_FIELD(unsigned int base : 5, 742 __BITFIELD_FIELD(unsigned int base : 5,
743 BITFIELD_FIELD(unsigned int func : 4, 743 __BITFIELD_FIELD(unsigned int func : 4,
744 BITFIELD_FIELD(signed int simmediate : 12, 744 __BITFIELD_FIELD(signed int simmediate : 12,
745 ;))))) 745 ;)))))
746}; 746};
747 747
748struct mm_x_format { /* Scaled indexed load format (microMIPS) */ 748struct mm_x_format { /* Scaled indexed load format (microMIPS) */
749 BITFIELD_FIELD(unsigned int opcode : 6, 749 __BITFIELD_FIELD(unsigned int opcode : 6,
750 BITFIELD_FIELD(unsigned int index : 5, 750 __BITFIELD_FIELD(unsigned int index : 5,
751 BITFIELD_FIELD(unsigned int base : 5, 751 __BITFIELD_FIELD(unsigned int base : 5,
752 BITFIELD_FIELD(unsigned int rd : 5, 752 __BITFIELD_FIELD(unsigned int rd : 5,
753 BITFIELD_FIELD(unsigned int func : 11, 753 __BITFIELD_FIELD(unsigned int func : 11,
754 ;))))) 754 ;)))))
755}; 755};
756 756
@@ -758,51 +758,51 @@ struct mm_x_format { /* Scaled indexed load format (microMIPS) */
758 * microMIPS instruction formats (16-bit length) 758 * microMIPS instruction formats (16-bit length)
759 */ 759 */
760struct mm_b0_format { /* Unconditional branch format (microMIPS) */ 760struct mm_b0_format { /* Unconditional branch format (microMIPS) */
761 BITFIELD_FIELD(unsigned int opcode : 6, 761 __BITFIELD_FIELD(unsigned int opcode : 6,
762 BITFIELD_FIELD(signed int simmediate : 10, 762 __BITFIELD_FIELD(signed int simmediate : 10,
763 BITFIELD_FIELD(unsigned int : 16, /* Ignored */ 763 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
764 ;))) 764 ;)))
765}; 765};
766 766
767struct mm_b1_format { /* Conditional branch format (microMIPS) */ 767struct mm_b1_format { /* Conditional branch format (microMIPS) */
768 BITFIELD_FIELD(unsigned int opcode : 6, 768 __BITFIELD_FIELD(unsigned int opcode : 6,
769 BITFIELD_FIELD(unsigned int rs : 3, 769 __BITFIELD_FIELD(unsigned int rs : 3,
770 BITFIELD_FIELD(signed int simmediate : 7, 770 __BITFIELD_FIELD(signed int simmediate : 7,
771 BITFIELD_FIELD(unsigned int : 16, /* Ignored */ 771 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
772 ;)))) 772 ;))))
773}; 773};
774 774
775struct mm16_m_format { /* Multi-word load/store format */ 775struct mm16_m_format { /* Multi-word load/store format */
776 BITFIELD_FIELD(unsigned int opcode : 6, 776 __BITFIELD_FIELD(unsigned int opcode : 6,
777 BITFIELD_FIELD(unsigned int func : 4, 777 __BITFIELD_FIELD(unsigned int func : 4,
778 BITFIELD_FIELD(unsigned int rlist : 2, 778 __BITFIELD_FIELD(unsigned int rlist : 2,
779 BITFIELD_FIELD(unsigned int imm : 4, 779 __BITFIELD_FIELD(unsigned int imm : 4,
780 BITFIELD_FIELD(unsigned int : 16, /* Ignored */ 780 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
781 ;))))) 781 ;)))))
782}; 782};
783 783
784struct mm16_rb_format { /* Signed immediate format */ 784struct mm16_rb_format { /* Signed immediate format */
785 BITFIELD_FIELD(unsigned int opcode : 6, 785 __BITFIELD_FIELD(unsigned int opcode : 6,
786 BITFIELD_FIELD(unsigned int rt : 3, 786 __BITFIELD_FIELD(unsigned int rt : 3,
787 BITFIELD_FIELD(unsigned int base : 3, 787 __BITFIELD_FIELD(unsigned int base : 3,
788 BITFIELD_FIELD(signed int simmediate : 4, 788 __BITFIELD_FIELD(signed int simmediate : 4,
789 BITFIELD_FIELD(unsigned int : 16, /* Ignored */ 789 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
790 ;))))) 790 ;)))))
791}; 791};
792 792
793struct mm16_r3_format { /* Load from global pointer format */ 793struct mm16_r3_format { /* Load from global pointer format */
794 BITFIELD_FIELD(unsigned int opcode : 6, 794 __BITFIELD_FIELD(unsigned int opcode : 6,
795 BITFIELD_FIELD(unsigned int rt : 3, 795 __BITFIELD_FIELD(unsigned int rt : 3,
796 BITFIELD_FIELD(signed int simmediate : 7, 796 __BITFIELD_FIELD(signed int simmediate : 7,
797 BITFIELD_FIELD(unsigned int : 16, /* Ignored */ 797 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
798 ;)))) 798 ;))))
799}; 799};
800 800
801struct mm16_r5_format { /* Load/store from stack pointer format */ 801struct mm16_r5_format { /* Load/store from stack pointer format */
802 BITFIELD_FIELD(unsigned int opcode : 6, 802 __BITFIELD_FIELD(unsigned int opcode : 6,
803 BITFIELD_FIELD(unsigned int rt : 5, 803 __BITFIELD_FIELD(unsigned int rt : 5,
804 BITFIELD_FIELD(signed int simmediate : 5, 804 __BITFIELD_FIELD(signed int simmediate : 5,
805 BITFIELD_FIELD(unsigned int : 16, /* Ignored */ 805 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
806 ;)))) 806 ;))))
807}; 807};
808 808
@@ -810,57 +810,57 @@ struct mm16_r5_format { /* Load/store from stack pointer format */
810 * MIPS16e instruction formats (16-bit length) 810 * MIPS16e instruction formats (16-bit length)
811 */ 811 */
812struct m16e_rr { 812struct m16e_rr {
813 BITFIELD_FIELD(unsigned int opcode : 5, 813 __BITFIELD_FIELD(unsigned int opcode : 5,
814 BITFIELD_FIELD(unsigned int rx : 3, 814 __BITFIELD_FIELD(unsigned int rx : 3,
815 BITFIELD_FIELD(unsigned int nd : 1, 815 __BITFIELD_FIELD(unsigned int nd : 1,
816 BITFIELD_FIELD(unsigned int l : 1, 816 __BITFIELD_FIELD(unsigned int l : 1,
817 BITFIELD_FIELD(unsigned int ra : 1, 817 __BITFIELD_FIELD(unsigned int ra : 1,
818 BITFIELD_FIELD(unsigned int func : 5, 818 __BITFIELD_FIELD(unsigned int func : 5,
819 ;)))))) 819 ;))))))
820}; 820};
821 821
822struct m16e_jal { 822struct m16e_jal {
823 BITFIELD_FIELD(unsigned int opcode : 5, 823 __BITFIELD_FIELD(unsigned int opcode : 5,
824 BITFIELD_FIELD(unsigned int x : 1, 824 __BITFIELD_FIELD(unsigned int x : 1,
825 BITFIELD_FIELD(unsigned int imm20_16 : 5, 825 __BITFIELD_FIELD(unsigned int imm20_16 : 5,
826 BITFIELD_FIELD(signed int imm25_21 : 5, 826 __BITFIELD_FIELD(signed int imm25_21 : 5,
827 ;)))) 827 ;))))
828}; 828};
829 829
830struct m16e_i64 { 830struct m16e_i64 {
831 BITFIELD_FIELD(unsigned int opcode : 5, 831 __BITFIELD_FIELD(unsigned int opcode : 5,
832 BITFIELD_FIELD(unsigned int func : 3, 832 __BITFIELD_FIELD(unsigned int func : 3,
833 BITFIELD_FIELD(unsigned int imm : 8, 833 __BITFIELD_FIELD(unsigned int imm : 8,
834 ;))) 834 ;)))
835}; 835};
836 836
837struct m16e_ri64 { 837struct m16e_ri64 {
838 BITFIELD_FIELD(unsigned int opcode : 5, 838 __BITFIELD_FIELD(unsigned int opcode : 5,
839 BITFIELD_FIELD(unsigned int func : 3, 839 __BITFIELD_FIELD(unsigned int func : 3,
840 BITFIELD_FIELD(unsigned int ry : 3, 840 __BITFIELD_FIELD(unsigned int ry : 3,
841 BITFIELD_FIELD(unsigned int imm : 5, 841 __BITFIELD_FIELD(unsigned int imm : 5,
842 ;)))) 842 ;))))
843}; 843};
844 844
845struct m16e_ri { 845struct m16e_ri {
846 BITFIELD_FIELD(unsigned int opcode : 5, 846 __BITFIELD_FIELD(unsigned int opcode : 5,
847 BITFIELD_FIELD(unsigned int rx : 3, 847 __BITFIELD_FIELD(unsigned int rx : 3,
848 BITFIELD_FIELD(unsigned int imm : 8, 848 __BITFIELD_FIELD(unsigned int imm : 8,
849 ;))) 849 ;)))
850}; 850};
851 851
852struct m16e_rri { 852struct m16e_rri {
853 BITFIELD_FIELD(unsigned int opcode : 5, 853 __BITFIELD_FIELD(unsigned int opcode : 5,
854 BITFIELD_FIELD(unsigned int rx : 3, 854 __BITFIELD_FIELD(unsigned int rx : 3,
855 BITFIELD_FIELD(unsigned int ry : 3, 855 __BITFIELD_FIELD(unsigned int ry : 3,
856 BITFIELD_FIELD(unsigned int imm : 5, 856 __BITFIELD_FIELD(unsigned int imm : 5,
857 ;)))) 857 ;))))
858}; 858};
859 859
860struct m16e_i8 { 860struct m16e_i8 {
861 BITFIELD_FIELD(unsigned int opcode : 5, 861 __BITFIELD_FIELD(unsigned int opcode : 5,
862 BITFIELD_FIELD(unsigned int func : 3, 862 __BITFIELD_FIELD(unsigned int func : 3,
863 BITFIELD_FIELD(unsigned int imm : 8, 863 __BITFIELD_FIELD(unsigned int imm : 8,
864 ;))) 864 ;)))
865}; 865};
866 866
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index d6e154a9e6a5..5805414777e0 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -371,16 +371,17 @@
371#define __NR_finit_module (__NR_Linux + 348) 371#define __NR_finit_module (__NR_Linux + 348)
372#define __NR_sched_setattr (__NR_Linux + 349) 372#define __NR_sched_setattr (__NR_Linux + 349)
373#define __NR_sched_getattr (__NR_Linux + 350) 373#define __NR_sched_getattr (__NR_Linux + 350)
374#define __NR_renameat2 (__NR_Linux + 351)
374 375
375/* 376/*
376 * Offset of the last Linux o32 flavoured syscall 377 * Offset of the last Linux o32 flavoured syscall
377 */ 378 */
378#define __NR_Linux_syscalls 350 379#define __NR_Linux_syscalls 351
379 380
380#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 381#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
381 382
382#define __NR_O32_Linux 4000 383#define __NR_O32_Linux 4000
383#define __NR_O32_Linux_syscalls 350 384#define __NR_O32_Linux_syscalls 351
384 385
385#if _MIPS_SIM == _MIPS_SIM_ABI64 386#if _MIPS_SIM == _MIPS_SIM_ABI64
386 387
@@ -699,16 +700,17 @@
699#define __NR_getdents64 (__NR_Linux + 308) 700#define __NR_getdents64 (__NR_Linux + 308)
700#define __NR_sched_setattr (__NR_Linux + 309) 701#define __NR_sched_setattr (__NR_Linux + 309)
701#define __NR_sched_getattr (__NR_Linux + 310) 702#define __NR_sched_getattr (__NR_Linux + 310)
703#define __NR_renameat2 (__NR_Linux + 311)
702 704
703/* 705/*
704 * Offset of the last Linux 64-bit flavoured syscall 706 * Offset of the last Linux 64-bit flavoured syscall
705 */ 707 */
706#define __NR_Linux_syscalls 310 708#define __NR_Linux_syscalls 311
707 709
708#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 710#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
709 711
710#define __NR_64_Linux 5000 712#define __NR_64_Linux 5000
711#define __NR_64_Linux_syscalls 310 713#define __NR_64_Linux_syscalls 311
712 714
713#if _MIPS_SIM == _MIPS_SIM_NABI32 715#if _MIPS_SIM == _MIPS_SIM_NABI32
714 716
@@ -1031,15 +1033,16 @@
1031#define __NR_finit_module (__NR_Linux + 312) 1033#define __NR_finit_module (__NR_Linux + 312)
1032#define __NR_sched_setattr (__NR_Linux + 313) 1034#define __NR_sched_setattr (__NR_Linux + 313)
1033#define __NR_sched_getattr (__NR_Linux + 314) 1035#define __NR_sched_getattr (__NR_Linux + 314)
1036#define __NR_renameat2 (__NR_Linux + 315)
1034 1037
1035/* 1038/*
1036 * Offset of the last N32 flavoured syscall 1039 * Offset of the last N32 flavoured syscall
1037 */ 1040 */
1038#define __NR_Linux_syscalls 314 1041#define __NR_Linux_syscalls 315
1039 1042
1040#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1043#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
1041 1044
1042#define __NR_N32_Linux 6000 1045#define __NR_N32_Linux 6000
1043#define __NR_N32_Linux_syscalls 314 1046#define __NR_N32_Linux_syscalls 315
1044 1047
1045#endif /* _UAPI_ASM_UNISTD_H */ 1048#endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 4d78bf445a9c..76122ff5cb5e 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -317,7 +317,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
317 if (regs->regs[insn.i_format.rs] == 317 if (regs->regs[insn.i_format.rs] ==
318 regs->regs[insn.i_format.rt]) { 318 regs->regs[insn.i_format.rt]) {
319 epc = epc + 4 + (insn.i_format.simmediate << 2); 319 epc = epc + 4 + (insn.i_format.simmediate << 2);
320 if (insn.i_format.rt == beql_op) 320 if (insn.i_format.opcode == beql_op)
321 ret = BRANCH_LIKELY_TAKEN; 321 ret = BRANCH_LIKELY_TAKEN;
322 } else 322 } else
323 epc += 8; 323 epc += 8;
@@ -329,7 +329,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
329 if (regs->regs[insn.i_format.rs] != 329 if (regs->regs[insn.i_format.rs] !=
330 regs->regs[insn.i_format.rt]) { 330 regs->regs[insn.i_format.rt]) {
331 epc = epc + 4 + (insn.i_format.simmediate << 2); 331 epc = epc + 4 + (insn.i_format.simmediate << 2);
332 if (insn.i_format.rt == bnel_op) 332 if (insn.i_format.opcode == bnel_op)
333 ret = BRANCH_LIKELY_TAKEN; 333 ret = BRANCH_LIKELY_TAKEN;
334 } else 334 } else
335 epc += 8; 335 epc += 8;
@@ -341,7 +341,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
341 /* rt field assumed to be zero */ 341 /* rt field assumed to be zero */
342 if ((long)regs->regs[insn.i_format.rs] <= 0) { 342 if ((long)regs->regs[insn.i_format.rs] <= 0) {
343 epc = epc + 4 + (insn.i_format.simmediate << 2); 343 epc = epc + 4 + (insn.i_format.simmediate << 2);
344 if (insn.i_format.rt == bnel_op) 344 if (insn.i_format.opcode == blezl_op)
345 ret = BRANCH_LIKELY_TAKEN; 345 ret = BRANCH_LIKELY_TAKEN;
346 } else 346 } else
347 epc += 8; 347 epc += 8;
@@ -353,7 +353,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
353 /* rt field assumed to be zero */ 353 /* rt field assumed to be zero */
354 if ((long)regs->regs[insn.i_format.rs] > 0) { 354 if ((long)regs->regs[insn.i_format.rs] > 0) {
355 epc = epc + 4 + (insn.i_format.simmediate << 2); 355 epc = epc + 4 + (insn.i_format.simmediate << 2);
356 if (insn.i_format.rt == bnel_op) 356 if (insn.i_format.opcode == bgtzl_op)
357 ret = BRANCH_LIKELY_TAKEN; 357 ret = BRANCH_LIKELY_TAKEN;
358 } else 358 } else
359 epc += 8; 359 epc += 8;
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index e40971b51d2f..037a44d962f3 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -124,14 +124,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
124 seq_printf(m, "kscratch registers\t: %d\n", 124 seq_printf(m, "kscratch registers\t: %d\n",
125 hweight8(cpu_data[n].kscratch_mask)); 125 hweight8(cpu_data[n].kscratch_mask));
126 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core); 126 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
127#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) 127
128 if (cpu_has_mipsmt) {
129 seq_printf(m, "VPE\t\t\t: %d\n", cpu_data[n].vpe_id);
130#if defined(CONFIG_MIPS_MT_SMTC)
131 seq_printf(m, "TC\t\t\t: %d\n", cpu_data[n].tc_id);
132#endif
133 }
134#endif
135 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", 128 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
136 cpu_has_vce ? "%u" : "not available"); 129 cpu_has_vce ? "%u" : "not available");
137 seq_printf(m, fmt, 'D', vced_count); 130 seq_printf(m, fmt, 'D', vced_count);
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 71f85f427034..f639ccd5060c 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -163,7 +163,7 @@ int ptrace_get_watch_regs(struct task_struct *child,
163 enum pt_watch_style style; 163 enum pt_watch_style style;
164 int i; 164 int i;
165 165
166 if (!cpu_has_watch || current_cpu_data.watch_reg_use_cnt == 0) 166 if (!cpu_has_watch || boot_cpu_data.watch_reg_use_cnt == 0)
167 return -EIO; 167 return -EIO;
168 if (!access_ok(VERIFY_WRITE, addr, sizeof(struct pt_watch_regs))) 168 if (!access_ok(VERIFY_WRITE, addr, sizeof(struct pt_watch_regs)))
169 return -EIO; 169 return -EIO;
@@ -177,14 +177,14 @@ int ptrace_get_watch_regs(struct task_struct *child,
177#endif 177#endif
178 178
179 __put_user(style, &addr->style); 179 __put_user(style, &addr->style);
180 __put_user(current_cpu_data.watch_reg_use_cnt, 180 __put_user(boot_cpu_data.watch_reg_use_cnt,
181 &addr->WATCH_STYLE.num_valid); 181 &addr->WATCH_STYLE.num_valid);
182 for (i = 0; i < current_cpu_data.watch_reg_use_cnt; i++) { 182 for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
183 __put_user(child->thread.watch.mips3264.watchlo[i], 183 __put_user(child->thread.watch.mips3264.watchlo[i],
184 &addr->WATCH_STYLE.watchlo[i]); 184 &addr->WATCH_STYLE.watchlo[i]);
185 __put_user(child->thread.watch.mips3264.watchhi[i] & 0xfff, 185 __put_user(child->thread.watch.mips3264.watchhi[i] & 0xfff,
186 &addr->WATCH_STYLE.watchhi[i]); 186 &addr->WATCH_STYLE.watchhi[i]);
187 __put_user(current_cpu_data.watch_reg_masks[i], 187 __put_user(boot_cpu_data.watch_reg_masks[i],
188 &addr->WATCH_STYLE.watch_masks[i]); 188 &addr->WATCH_STYLE.watch_masks[i]);
189 } 189 }
190 for (; i < 8; i++) { 190 for (; i < 8; i++) {
@@ -204,12 +204,12 @@ int ptrace_set_watch_regs(struct task_struct *child,
204 unsigned long lt[NUM_WATCH_REGS]; 204 unsigned long lt[NUM_WATCH_REGS];
205 u16 ht[NUM_WATCH_REGS]; 205 u16 ht[NUM_WATCH_REGS];
206 206
207 if (!cpu_has_watch || current_cpu_data.watch_reg_use_cnt == 0) 207 if (!cpu_has_watch || boot_cpu_data.watch_reg_use_cnt == 0)
208 return -EIO; 208 return -EIO;
209 if (!access_ok(VERIFY_READ, addr, sizeof(struct pt_watch_regs))) 209 if (!access_ok(VERIFY_READ, addr, sizeof(struct pt_watch_regs)))
210 return -EIO; 210 return -EIO;
211 /* Check the values. */ 211 /* Check the values. */
212 for (i = 0; i < current_cpu_data.watch_reg_use_cnt; i++) { 212 for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
213 __get_user(lt[i], &addr->WATCH_STYLE.watchlo[i]); 213 __get_user(lt[i], &addr->WATCH_STYLE.watchlo[i]);
214#ifdef CONFIG_32BIT 214#ifdef CONFIG_32BIT
215 if (lt[i] & __UA_LIMIT) 215 if (lt[i] & __UA_LIMIT)
@@ -228,7 +228,7 @@ int ptrace_set_watch_regs(struct task_struct *child,
228 return -EINVAL; 228 return -EINVAL;
229 } 229 }
230 /* Install them. */ 230 /* Install them. */
231 for (i = 0; i < current_cpu_data.watch_reg_use_cnt; i++) { 231 for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
232 if (lt[i] & 7) 232 if (lt[i] & 7)
233 watch_active = 1; 233 watch_active = 1;
234 child->thread.watch.mips3264.watchlo[i] = lt[i]; 234 child->thread.watch.mips3264.watchlo[i] = lt[i];
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index fdc70b400442..3245474f19d5 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -577,3 +577,4 @@ EXPORT(sys_call_table)
577 PTR sys_finit_module 577 PTR sys_finit_module
578 PTR sys_sched_setattr 578 PTR sys_sched_setattr
579 PTR sys_sched_getattr /* 4350 */ 579 PTR sys_sched_getattr /* 4350 */
580 PTR sys_renameat2
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index dd99c3285aea..be2fedd4ae33 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -430,4 +430,5 @@ EXPORT(sys_call_table)
430 PTR sys_getdents64 430 PTR sys_getdents64
431 PTR sys_sched_setattr 431 PTR sys_sched_setattr
432 PTR sys_sched_getattr /* 5310 */ 432 PTR sys_sched_getattr /* 5310 */
433 PTR sys_renameat2
433 .size sys_call_table,.-sys_call_table 434 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index f68d2f4f0090..c1dbcda4b816 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -423,4 +423,5 @@ EXPORT(sysn32_call_table)
423 PTR sys_finit_module 423 PTR sys_finit_module
424 PTR sys_sched_setattr 424 PTR sys_sched_setattr
425 PTR sys_sched_getattr 425 PTR sys_sched_getattr
426 PTR sys_renameat2 /* 6315 */
426 .size sysn32_call_table,.-sysn32_call_table 427 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 70f6acecd928..f1343ccd7ed7 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -556,4 +556,5 @@ EXPORT(sys32_call_table)
556 PTR sys_finit_module 556 PTR sys_finit_module
557 PTR sys_sched_setattr 557 PTR sys_sched_setattr
558 PTR sys_sched_getattr /* 4350 */ 558 PTR sys_sched_getattr /* 4350 */
559 PTR sys_renameat2
559 .size sys32_call_table,.-sys32_call_table 560 .size sys32_call_table,.-sys32_call_table
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 074e857ced28..8119ac2fdfc9 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1545,7 +1545,7 @@ asmlinkage void cache_parity_error(void)
1545 reg_val & (1<<30) ? "secondary" : "primary", 1545 reg_val & (1<<30) ? "secondary" : "primary",
1546 reg_val & (1<<31) ? "data" : "insn"); 1546 reg_val & (1<<31) ? "data" : "insn");
1547 if (cpu_has_mips_r2 && 1547 if (cpu_has_mips_r2 &&
1548 ((current_cpu_data.processor_id && 0xff0000) == PRID_COMP_MIPS)) { 1548 ((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS)) {
1549 pr_err("Error bits: %s%s%s%s%s%s%s%s\n", 1549 pr_err("Error bits: %s%s%s%s%s%s%s%s\n",
1550 reg_val & (1<<29) ? "ED " : "", 1550 reg_val & (1<<29) ? "ED " : "",
1551 reg_val & (1<<28) ? "ET " : "", 1551 reg_val & (1<<28) ? "ET " : "",
@@ -1585,7 +1585,7 @@ asmlinkage void do_ftlb(void)
1585 1585
1586 /* For the moment, report the problem and hang. */ 1586 /* For the moment, report the problem and hang. */
1587 if (cpu_has_mips_r2 && 1587 if (cpu_has_mips_r2 &&
1588 ((current_cpu_data.processor_id && 0xff0000) == PRID_COMP_MIPS)) { 1588 ((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS)) {
1589 pr_err("FTLB error exception, cp0_ecc=0x%08x:\n", 1589 pr_err("FTLB error exception, cp0_ecc=0x%08x:\n",
1590 read_c0_ecc()); 1590 read_c0_ecc());
1591 pr_err("cp0_errorepc == %0*lx\n", field, read_c0_errorepc()); 1591 pr_err("cp0_errorepc == %0*lx\n", field, read_c0_errorepc());
diff --git a/arch/mips/lantiq/dts/easy50712.dts b/arch/mips/lantiq/dts/easy50712.dts
index fac1f5b178eb..143b8a37b5e4 100644
--- a/arch/mips/lantiq/dts/easy50712.dts
+++ b/arch/mips/lantiq/dts/easy50712.dts
@@ -8,6 +8,7 @@
8 }; 8 };
9 9
10 memory@0 { 10 memory@0 {
11 device_type = "memory";
11 reg = <0x0 0x2000000>; 12 reg = <0x0 0x2000000>;
12 }; 13 };
13 14
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
index 2e4825e48388..9901237563c5 100644
--- a/arch/mips/lib/csum_partial.S
+++ b/arch/mips/lib/csum_partial.S
@@ -56,14 +56,20 @@
56#define UNIT(unit) ((unit)*NBYTES) 56#define UNIT(unit) ((unit)*NBYTES)
57 57
58#define ADDC(sum,reg) \ 58#define ADDC(sum,reg) \
59 .set push; \
60 .set noat; \
59 ADD sum, reg; \ 61 ADD sum, reg; \
60 sltu v1, sum, reg; \ 62 sltu v1, sum, reg; \
61 ADD sum, v1; \ 63 ADD sum, v1; \
64 .set pop
62 65
63#define ADDC32(sum,reg) \ 66#define ADDC32(sum,reg) \
67 .set push; \
68 .set noat; \
64 addu sum, reg; \ 69 addu sum, reg; \
65 sltu v1, sum, reg; \ 70 sltu v1, sum, reg; \
66 addu sum, v1; \ 71 addu sum, v1; \
72 .set pop
67 73
68#define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3) \ 74#define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3) \
69 LOAD _t0, (offset + UNIT(0))(src); \ 75 LOAD _t0, (offset + UNIT(0))(src); \
@@ -710,6 +716,8 @@ LEAF(csum_partial)
710 ADDC(sum, t2) 716 ADDC(sum, t2)
711.Ldone\@: 717.Ldone\@:
712 /* fold checksum */ 718 /* fold checksum */
719 .set push
720 .set noat
713#ifdef USE_DOUBLE 721#ifdef USE_DOUBLE
714 dsll32 v1, sum, 0 722 dsll32 v1, sum, 0
715 daddu sum, v1 723 daddu sum, v1
@@ -732,6 +740,7 @@ LEAF(csum_partial)
732 or sum, sum, t0 740 or sum, sum, t0
7331: 7411:
734#endif 742#endif
743 .set pop
735 .set reorder 744 .set reorder
736 ADDC32(sum, psum) 745 ADDC32(sum, psum)
737 jr ra 746 jr ra
diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c
index 44713af15a62..705cfb7c1a74 100644
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 1994 by Waldorf Electronics 6 * Copyright (C) 1994 by Waldorf Electronics
7 * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle 7 * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2007 Maciej W. Rozycki 9 * Copyright (C) 2007, 2014 Maciej W. Rozycki
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/param.h> 12#include <linux/param.h>
@@ -15,6 +15,12 @@
15#include <asm/compiler.h> 15#include <asm/compiler.h>
16#include <asm/war.h> 16#include <asm/war.h>
17 17
18#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
19#define GCC_DADDI_IMM_ASM() "I"
20#else
21#define GCC_DADDI_IMM_ASM() "r"
22#endif
23
18void __delay(unsigned long loops) 24void __delay(unsigned long loops)
19{ 25{
20 __asm__ __volatile__ ( 26 __asm__ __volatile__ (
@@ -22,13 +28,13 @@ void __delay(unsigned long loops)
22 " .align 3 \n" 28 " .align 3 \n"
23 "1: bnez %0, 1b \n" 29 "1: bnez %0, 1b \n"
24#if BITS_PER_LONG == 32 30#if BITS_PER_LONG == 32
25 " subu %0, 1 \n" 31 " subu %0, %1 \n"
26#else 32#else
27 " dsubu %0, 1 \n" 33 " dsubu %0, %1 \n"
28#endif 34#endif
29 " .set reorder \n" 35 " .set reorder \n"
30 : "=r" (loops) 36 : "=r" (loops)
31 : "0" (loops)); 37 : GCC_DADDI_IMM_ASM() (1), "0" (loops));
32} 38}
33EXPORT_SYMBOL(__delay); 39EXPORT_SYMBOL(__delay);
34 40
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S
index d3301cd1e9a5..3c32baf8b494 100644
--- a/arch/mips/lib/strncpy_user.S
+++ b/arch/mips/lib/strncpy_user.S
@@ -35,7 +35,6 @@ LEAF(__strncpy_from_\func\()_asm)
35 bnez v0, .Lfault\@ 35 bnez v0, .Lfault\@
36 36
37FEXPORT(__strncpy_from_\func\()_nocheck_asm) 37FEXPORT(__strncpy_from_\func\()_nocheck_asm)
38 .set noreorder
39 move t0, zero 38 move t0, zero
40 move v1, a1 39 move v1, a1
41.ifeqs "\func","kernel" 40.ifeqs "\func","kernel"
@@ -45,21 +44,21 @@ FEXPORT(__strncpy_from_\func\()_nocheck_asm)
45.endif 44.endif
46 PTR_ADDIU v1, 1 45 PTR_ADDIU v1, 1
47 R10KCBARRIER(0(ra)) 46 R10KCBARRIER(0(ra))
47 sb v0, (a0)
48 beqz v0, 2f 48 beqz v0, 2f
49 sb v0, (a0)
50 PTR_ADDIU t0, 1 49 PTR_ADDIU t0, 1
50 PTR_ADDIU a0, 1
51 bne t0, a2, 1b 51 bne t0, a2, 1b
52 PTR_ADDIU a0, 1
532: PTR_ADDU v0, a1, t0 522: PTR_ADDU v0, a1, t0
54 xor v0, a1 53 xor v0, a1
55 bltz v0, .Lfault\@ 54 bltz v0, .Lfault\@
56 nop 55 move v0, t0
57 jr ra # return n 56 jr ra # return n
58 move v0, t0
59 END(__strncpy_from_\func\()_asm) 57 END(__strncpy_from_\func\()_asm)
60 58
61.Lfault\@: jr ra 59.Lfault\@:
62 li v0, -EFAULT 60 li v0, -EFAULT
61 jr ra
63 62
64 .section __ex_table,"a" 63 .section __ex_table,"a"
65 PTR 1b, .Lfault\@ 64 PTR 1b, .Lfault\@
diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
index 7397be226a06..603d79a95f47 100644
--- a/arch/mips/loongson/Kconfig
+++ b/arch/mips/loongson/Kconfig
@@ -64,7 +64,6 @@ config LEMOTE_MACH3A
64 bool "Lemote Loongson 3A family machines" 64 bool "Lemote Loongson 3A family machines"
65 select ARCH_SPARSEMEM_ENABLE 65 select ARCH_SPARSEMEM_ENABLE
66 select GENERIC_ISA_DMA_SUPPORT_BROKEN 66 select GENERIC_ISA_DMA_SUPPORT_BROKEN
67 select GENERIC_HARDIRQS_NO__DO_IRQ
68 select BOOT_ELF32 67 select BOOT_ELF32
69 select BOARD_SCACHE 68 select BOARD_SCACHE
70 select CSRC_R4K 69 select CSRC_R4K
diff --git a/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c b/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
index c639b9db0012..12c75db23420 100644
--- a/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
+++ b/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
@@ -27,8 +27,7 @@
27 27
28#include <cs5536/cs5536_mfgpt.h> 28#include <cs5536/cs5536_mfgpt.h>
29 29
30DEFINE_SPINLOCK(mfgpt_lock); 30static DEFINE_RAW_SPINLOCK(mfgpt_lock);
31EXPORT_SYMBOL(mfgpt_lock);
32 31
33static u32 mfgpt_base; 32static u32 mfgpt_base;
34 33
@@ -55,7 +54,7 @@ EXPORT_SYMBOL(enable_mfgpt0_counter);
55static void init_mfgpt_timer(enum clock_event_mode mode, 54static void init_mfgpt_timer(enum clock_event_mode mode,
56 struct clock_event_device *evt) 55 struct clock_event_device *evt)
57{ 56{
58 spin_lock(&mfgpt_lock); 57 raw_spin_lock(&mfgpt_lock);
59 58
60 switch (mode) { 59 switch (mode) {
61 case CLOCK_EVT_MODE_PERIODIC: 60 case CLOCK_EVT_MODE_PERIODIC:
@@ -79,7 +78,7 @@ static void init_mfgpt_timer(enum clock_event_mode mode,
79 /* Nothing to do here */ 78 /* Nothing to do here */
80 break; 79 break;
81 } 80 }
82 spin_unlock(&mfgpt_lock); 81 raw_spin_unlock(&mfgpt_lock);
83} 82}
84 83
85static struct clock_event_device mfgpt_clockevent = { 84static struct clock_event_device mfgpt_clockevent = {
@@ -157,7 +156,7 @@ static cycle_t mfgpt_read(struct clocksource *cs)
157 static int old_count; 156 static int old_count;
158 static u32 old_jifs; 157 static u32 old_jifs;
159 158
160 spin_lock_irqsave(&mfgpt_lock, flags); 159 raw_spin_lock_irqsave(&mfgpt_lock, flags);
161 /* 160 /*
162 * Although our caller may have the read side of xtime_lock, 161 * Although our caller may have the read side of xtime_lock,
163 * this is now a seqlock, and we are cheating in this routine 162 * this is now a seqlock, and we are cheating in this routine
@@ -191,7 +190,7 @@ static cycle_t mfgpt_read(struct clocksource *cs)
191 old_count = count; 190 old_count = count;
192 old_jifs = jifs; 191 old_jifs = jifs;
193 192
194 spin_unlock_irqrestore(&mfgpt_lock, flags); 193 raw_spin_unlock_irqrestore(&mfgpt_lock, flags);
195 194
196 return (cycle_t) (jifs * COMPARE) + count; 195 return (cycle_t) (jifs * COMPARE) + count;
197} 196}
diff --git a/arch/mips/loongson/lemote-2f/clock.c b/arch/mips/loongson/lemote-2f/clock.c
index e1f427f4f5f3..67dd94ef28e6 100644
--- a/arch/mips/loongson/lemote-2f/clock.c
+++ b/arch/mips/loongson/lemote-2f/clock.c
@@ -91,6 +91,7 @@ EXPORT_SYMBOL(clk_put);
91 91
92int clk_set_rate(struct clk *clk, unsigned long rate) 92int clk_set_rate(struct clk *clk, unsigned long rate)
93{ 93{
94 unsigned int rate_khz = rate / 1000;
94 int ret = 0; 95 int ret = 0;
95 int regval; 96 int regval;
96 int i; 97 int i;
@@ -111,10 +112,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
111 if (loongson2_clockmod_table[i].frequency == 112 if (loongson2_clockmod_table[i].frequency ==
112 CPUFREQ_ENTRY_INVALID) 113 CPUFREQ_ENTRY_INVALID)
113 continue; 114 continue;
114 if (rate == loongson2_clockmod_table[i].frequency) 115 if (rate_khz == loongson2_clockmod_table[i].frequency)
115 break; 116 break;
116 } 117 }
117 if (rate != loongson2_clockmod_table[i].frequency) 118 if (rate_khz != loongson2_clockmod_table[i].frequency)
118 return -ENOTSUPP; 119 return -ENOTSUPP;
119 120
120 clk->rate = rate; 121 clk->rate = rate;
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 58033c44690d..b611102e23b5 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -273,7 +273,7 @@ void build_clear_page(void)
273 uasm_i_ori(&buf, A2, A0, off); 273 uasm_i_ori(&buf, A2, A0, off);
274 274
275 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) 275 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
276 uasm_i_lui(&buf, AT, 0xa000); 276 uasm_i_lui(&buf, AT, uasm_rel_hi(0xa0000000));
277 277
278 off = cache_line_size ? min(8, pref_bias_clear_store / cache_line_size) 278 off = cache_line_size ? min(8, pref_bias_clear_store / cache_line_size)
279 * cache_line_size : 0; 279 * cache_line_size : 0;
@@ -424,7 +424,7 @@ void build_copy_page(void)
424 uasm_i_ori(&buf, A2, A0, off); 424 uasm_i_ori(&buf, A2, A0, off);
425 425
426 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) 426 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
427 uasm_i_lui(&buf, AT, 0xa000); 427 uasm_i_lui(&buf, AT, uasm_rel_hi(0xa0000000));
428 428
429 off = cache_line_size ? min(8, pref_bias_copy_load / cache_line_size) * 429 off = cache_line_size ? min(8, pref_bias_copy_load / cache_line_size) *
430 cache_line_size : 0; 430 cache_line_size : 0;
diff --git a/arch/mips/mm/tlb-funcs.S b/arch/mips/mm/tlb-funcs.S
index 30a494db99c2..a5427c6e9757 100644
--- a/arch/mips/mm/tlb-funcs.S
+++ b/arch/mips/mm/tlb-funcs.S
@@ -16,8 +16,10 @@
16 16
17#define FASTPATH_SIZE 128 17#define FASTPATH_SIZE 128
18 18
19EXPORT(tlbmiss_handler_setup_pgd_start)
19LEAF(tlbmiss_handler_setup_pgd) 20LEAF(tlbmiss_handler_setup_pgd)
20 .space 16 * 4 211: j 1b /* Dummy, will be replaced. */
22 .space 64
21END(tlbmiss_handler_setup_pgd) 23END(tlbmiss_handler_setup_pgd)
22EXPORT(tlbmiss_handler_setup_pgd_end) 24EXPORT(tlbmiss_handler_setup_pgd_end)
23 25
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index ee88367ab3ad..f99ec587b151 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -1422,16 +1422,17 @@ static void build_r4000_tlb_refill_handler(void)
1422extern u32 handle_tlbl[], handle_tlbl_end[]; 1422extern u32 handle_tlbl[], handle_tlbl_end[];
1423extern u32 handle_tlbs[], handle_tlbs_end[]; 1423extern u32 handle_tlbs[], handle_tlbs_end[];
1424extern u32 handle_tlbm[], handle_tlbm_end[]; 1424extern u32 handle_tlbm[], handle_tlbm_end[];
1425extern u32 tlbmiss_handler_setup_pgd[], tlbmiss_handler_setup_pgd_end[]; 1425extern u32 tlbmiss_handler_setup_pgd_start[], tlbmiss_handler_setup_pgd[];
1426extern u32 tlbmiss_handler_setup_pgd_end[];
1426 1427
1427static void build_setup_pgd(void) 1428static void build_setup_pgd(void)
1428{ 1429{
1429 const int a0 = 4; 1430 const int a0 = 4;
1430 const int __maybe_unused a1 = 5; 1431 const int __maybe_unused a1 = 5;
1431 const int __maybe_unused a2 = 6; 1432 const int __maybe_unused a2 = 6;
1432 u32 *p = tlbmiss_handler_setup_pgd; 1433 u32 *p = tlbmiss_handler_setup_pgd_start;
1433 const int tlbmiss_handler_setup_pgd_size = 1434 const int tlbmiss_handler_setup_pgd_size =
1434 tlbmiss_handler_setup_pgd_end - tlbmiss_handler_setup_pgd; 1435 tlbmiss_handler_setup_pgd_end - tlbmiss_handler_setup_pgd_start;
1435#ifndef CONFIG_MIPS_PGD_C0_CONTEXT 1436#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
1436 long pgdc = (long)pgd_current; 1437 long pgdc = (long)pgd_current;
1437#endif 1438#endif
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index 6d0f4ab3632d..f2364e419682 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -27,7 +27,7 @@ unsigned long physical_memsize = 0L;
27fw_memblock_t * __init fw_getmdesc(int eva) 27fw_memblock_t * __init fw_getmdesc(int eva)
28{ 28{
29 char *memsize_str, *ememsize_str __maybe_unused = NULL, *ptr; 29 char *memsize_str, *ememsize_str __maybe_unused = NULL, *ptr;
30 unsigned long memsize, ememsize __maybe_unused = 0; 30 unsigned long memsize = 0, ememsize __maybe_unused = 0;
31 static char cmdline[COMMAND_LINE_SIZE] __initdata; 31 static char cmdline[COMMAND_LINE_SIZE] __initdata;
32 int tmp; 32 int tmp;
33 33
diff --git a/arch/mips/pci/pci-rc32434.c b/arch/mips/pci/pci-rc32434.c
index b128cb973ebe..7f6ce6d734c0 100644
--- a/arch/mips/pci/pci-rc32434.c
+++ b/arch/mips/pci/pci-rc32434.c
@@ -53,7 +53,6 @@ static struct resource rc32434_res_pci_mem1 = {
53 .start = 0x50000000, 53 .start = 0x50000000,
54 .end = 0x5FFFFFFF, 54 .end = 0x5FFFFFFF,
55 .flags = IORESOURCE_MEM, 55 .flags = IORESOURCE_MEM,
56 .parent = &rc32434_res_pci_mem1,
57 .sibling = NULL, 56 .sibling = NULL,
58 .child = &rc32434_res_pci_mem2 57 .child = &rc32434_res_pci_mem2
59}; 58};
diff --git a/arch/mips/ralink/dts/mt7620a_eval.dts b/arch/mips/ralink/dts/mt7620a_eval.dts
index 35eb874ab7f1..709f58132f5c 100644
--- a/arch/mips/ralink/dts/mt7620a_eval.dts
+++ b/arch/mips/ralink/dts/mt7620a_eval.dts
@@ -7,6 +7,7 @@
7 model = "Ralink MT7620A evaluation board"; 7 model = "Ralink MT7620A evaluation board";
8 8
9 memory@0 { 9 memory@0 {
10 device_type = "memory";
10 reg = <0x0 0x2000000>; 11 reg = <0x0 0x2000000>;
11 }; 12 };
12 13
diff --git a/arch/mips/ralink/dts/rt2880_eval.dts b/arch/mips/ralink/dts/rt2880_eval.dts
index 322d7002595b..0a685db093d4 100644
--- a/arch/mips/ralink/dts/rt2880_eval.dts
+++ b/arch/mips/ralink/dts/rt2880_eval.dts
@@ -7,6 +7,7 @@
7 model = "Ralink RT2880 evaluation board"; 7 model = "Ralink RT2880 evaluation board";
8 8
9 memory@0 { 9 memory@0 {
10 device_type = "memory";
10 reg = <0x8000000 0x2000000>; 11 reg = <0x8000000 0x2000000>;
11 }; 12 };
12 13
diff --git a/arch/mips/ralink/dts/rt3052_eval.dts b/arch/mips/ralink/dts/rt3052_eval.dts
index 0ac73ea28198..ec9e9a035541 100644
--- a/arch/mips/ralink/dts/rt3052_eval.dts
+++ b/arch/mips/ralink/dts/rt3052_eval.dts
@@ -7,6 +7,7 @@
7 model = "Ralink RT3052 evaluation board"; 7 model = "Ralink RT3052 evaluation board";
8 8
9 memory@0 { 9 memory@0 {
10 device_type = "memory";
10 reg = <0x0 0x2000000>; 11 reg = <0x0 0x2000000>;
11 }; 12 };
12 13
diff --git a/arch/mips/ralink/dts/rt3883_eval.dts b/arch/mips/ralink/dts/rt3883_eval.dts
index 2fa6b330bf4f..e8df21a5d10d 100644
--- a/arch/mips/ralink/dts/rt3883_eval.dts
+++ b/arch/mips/ralink/dts/rt3883_eval.dts
@@ -7,6 +7,7 @@
7 model = "Ralink RT3883 evaluation board"; 7 model = "Ralink RT3883 evaluation board";
8 8
9 memory@0 { 9 memory@0 {
10 device_type = "memory";
10 reg = <0x0 0x2000000>; 11 reg = <0x0 0x2000000>;
11 }; 12 };
12 13
diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h
index 166323824683..5f70af25c7d0 100644
--- a/arch/mn10300/include/asm/pci.h
+++ b/arch/mn10300/include/asm/pci.h
@@ -48,7 +48,6 @@ extern void unit_pci_init(void);
48#define PCIBIOS_MIN_MEM 0xB8000000 48#define PCIBIOS_MIN_MEM 0xB8000000
49 49
50void pcibios_set_master(struct pci_dev *dev); 50void pcibios_set_master(struct pci_dev *dev);
51void pcibios_penalize_isa_irq(int irq);
52 51
53/* Dynamic DMA mapping stuff. 52/* Dynamic DMA mapping stuff.
54 * i386 has everything mapped statically. 53 * i386 has everything mapped statically.
diff --git a/arch/mn10300/unit-asb2305/pci-irq.c b/arch/mn10300/unit-asb2305/pci-irq.c
index 77439da04671..fcb28ceb824d 100644
--- a/arch/mn10300/unit-asb2305/pci-irq.c
+++ b/arch/mn10300/unit-asb2305/pci-irq.c
@@ -40,10 +40,6 @@ void __init pcibios_fixup_irqs(void)
40 } 40 }
41} 41}
42 42
43void __init pcibios_penalize_isa_irq(int irq)
44{
45}
46
47void pcibios_enable_irq(struct pci_dev *dev) 43void pcibios_enable_irq(struct pci_dev *dev)
48{ 44{
49 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 45 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 1faefed32749..108d48e652af 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -22,6 +22,7 @@ config PARISC
22 select GENERIC_SMP_IDLE_THREAD 22 select GENERIC_SMP_IDLE_THREAD
23 select GENERIC_STRNCPY_FROM_USER 23 select GENERIC_STRNCPY_FROM_USER
24 select SYSCTL_ARCH_UNALIGN_ALLOW 24 select SYSCTL_ARCH_UNALIGN_ALLOW
25 select SYSCTL_EXCEPTION_TRACE
25 select HAVE_MOD_ARCH_SPECIFIC 26 select HAVE_MOD_ARCH_SPECIFIC
26 select VIRT_TO_BUS 27 select VIRT_TO_BUS
27 select MODULES_USE_ELF_RELA 28 select MODULES_USE_ELF_RELA
diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h
index 465154076d23..20df2b04fc09 100644
--- a/arch/parisc/include/asm/pci.h
+++ b/arch/parisc/include/asm/pci.h
@@ -215,11 +215,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
215} 215}
216#endif 216#endif
217 217
218static inline void pcibios_penalize_isa_irq(int irq, int active)
219{
220 /* We don't need to penalize isa irq's */
221}
222
223static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 218static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
224{ 219{
225 return channel ? 15 : 14; 220 return channel ? 15 : 14;
diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h
index 198a86feb574..d951c9681ab3 100644
--- a/arch/parisc/include/asm/processor.h
+++ b/arch/parisc/include/asm/processor.h
@@ -55,6 +55,11 @@
55#define STACK_TOP TASK_SIZE 55#define STACK_TOP TASK_SIZE
56#define STACK_TOP_MAX DEFAULT_TASK_SIZE 56#define STACK_TOP_MAX DEFAULT_TASK_SIZE
57 57
58/* Allow bigger stacks for 64-bit processes */
59#define STACK_SIZE_MAX (USER_WIDE_MODE \
60 ? (1 << 30) /* 1 GB */ \
61 : (CONFIG_MAX_STACK_SIZE_MB*1024*1024))
62
58#endif 63#endif
59 64
60#ifndef __ASSEMBLY__ 65#ifndef __ASSEMBLY__
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
index 265ae5190b0a..47e0e21d2272 100644
--- a/arch/parisc/include/uapi/asm/unistd.h
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -829,8 +829,9 @@
829#define __NR_sched_setattr (__NR_Linux + 334) 829#define __NR_sched_setattr (__NR_Linux + 334)
830#define __NR_sched_getattr (__NR_Linux + 335) 830#define __NR_sched_getattr (__NR_Linux + 335)
831#define __NR_utimes (__NR_Linux + 336) 831#define __NR_utimes (__NR_Linux + 336)
832#define __NR_renameat2 (__NR_Linux + 337)
832 833
833#define __NR_Linux_syscalls (__NR_utimes + 1) 834#define __NR_Linux_syscalls (__NR_renameat2 + 1)
834 835
835 836
836#define __IGNORE_select /* newselect */ 837#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 31ffa9b55322..e1ffea2f9a0b 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -72,10 +72,10 @@ static unsigned long mmap_upper_limit(void)
72{ 72{
73 unsigned long stack_base; 73 unsigned long stack_base;
74 74
75 /* Limit stack size to 1GB - see setup_arg_pages() in fs/exec.c */ 75 /* Limit stack size - see setup_arg_pages() in fs/exec.c */
76 stack_base = rlimit_max(RLIMIT_STACK); 76 stack_base = rlimit_max(RLIMIT_STACK);
77 if (stack_base > (1 << 30)) 77 if (stack_base > STACK_SIZE_MAX)
78 stack_base = 1 << 30; 78 stack_base = STACK_SIZE_MAX;
79 79
80 return PAGE_ALIGN(STACK_TOP - stack_base); 80 return PAGE_ALIGN(STACK_TOP - stack_base);
81} 81}
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index a63bb179f79a..838786011037 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -589,10 +589,13 @@ cas_nocontend:
589# endif 589# endif
590/* ENABLE_LWS_DEBUG */ 590/* ENABLE_LWS_DEBUG */
591 591
592 rsm PSW_SM_I, %r0 /* Disable interrupts */
593 /* COW breaks can cause contention on UP systems */
592 LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */ 594 LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */
593 cmpb,<>,n %r0, %r28, cas_action /* Did we get it? */ 595 cmpb,<>,n %r0, %r28, cas_action /* Did we get it? */
594cas_wouldblock: 596cas_wouldblock:
595 ldo 2(%r0), %r28 /* 2nd case */ 597 ldo 2(%r0), %r28 /* 2nd case */
598 ssm PSW_SM_I, %r0
596 b lws_exit /* Contended... */ 599 b lws_exit /* Contended... */
597 ldo -EAGAIN(%r0), %r21 /* Spin in userspace */ 600 ldo -EAGAIN(%r0), %r21 /* Spin in userspace */
598 601
@@ -619,15 +622,17 @@ cas_action:
619 stw %r1, 4(%sr2,%r20) 622 stw %r1, 4(%sr2,%r20)
620#endif 623#endif
621 /* The load and store could fail */ 624 /* The load and store could fail */
6221: ldw 0(%sr3,%r26), %r28 6251: ldw,ma 0(%sr3,%r26), %r28
623 sub,<> %r28, %r25, %r0 626 sub,<> %r28, %r25, %r0
6242: stw %r24, 0(%sr3,%r26) 6272: stw,ma %r24, 0(%sr3,%r26)
625 /* Free lock */ 628 /* Free lock */
626 stw %r20, 0(%sr2,%r20) 629 stw,ma %r20, 0(%sr2,%r20)
627#if ENABLE_LWS_DEBUG 630#if ENABLE_LWS_DEBUG
628 /* Clear thread register indicator */ 631 /* Clear thread register indicator */
629 stw %r0, 4(%sr2,%r20) 632 stw %r0, 4(%sr2,%r20)
630#endif 633#endif
634 /* Enable interrupts */
635 ssm PSW_SM_I, %r0
631 /* Return to userspace, set no error */ 636 /* Return to userspace, set no error */
632 b lws_exit 637 b lws_exit
633 copy %r0, %r21 638 copy %r0, %r21
@@ -639,6 +644,7 @@ cas_action:
639#if ENABLE_LWS_DEBUG 644#if ENABLE_LWS_DEBUG
640 stw %r0, 4(%sr2,%r20) 645 stw %r0, 4(%sr2,%r20)
641#endif 646#endif
647 ssm PSW_SM_I, %r0
642 b lws_exit 648 b lws_exit
643 ldo -EFAULT(%r0),%r21 /* set errno */ 649 ldo -EFAULT(%r0),%r21 /* set errno */
644 nop 650 nop
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 83ead0ea127d..c5fa7a697fba 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -432,6 +432,7 @@
432 ENTRY_SAME(sched_setattr) 432 ENTRY_SAME(sched_setattr)
433 ENTRY_SAME(sched_getattr) /* 335 */ 433 ENTRY_SAME(sched_getattr) /* 335 */
434 ENTRY_COMP(utimes) 434 ENTRY_COMP(utimes)
435 ENTRY_SAME(renameat2)
435 436
436 /* Nothing yet */ 437 /* Nothing yet */
437 438
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 1cd1d0c83b6d..47ee620d15d2 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/console.h> 26#include <linux/console.h>
27#include <linux/bug.h> 27#include <linux/bug.h>
28#include <linux/ratelimit.h>
28 29
29#include <asm/assembly.h> 30#include <asm/assembly.h>
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
@@ -42,9 +43,6 @@
42 43
43#include "../math-emu/math-emu.h" /* for handle_fpe() */ 44#include "../math-emu/math-emu.h" /* for handle_fpe() */
44 45
45#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
46 /* dumped to the console via printk) */
47
48#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 46#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
49DEFINE_SPINLOCK(pa_dbit_lock); 47DEFINE_SPINLOCK(pa_dbit_lock);
50#endif 48#endif
@@ -160,6 +158,17 @@ void show_regs(struct pt_regs *regs)
160 } 158 }
161} 159}
162 160
161static DEFINE_RATELIMIT_STATE(_hppa_rs,
162 DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);
163
164#define parisc_printk_ratelimited(critical, regs, fmt, ...) { \
165 if ((critical || show_unhandled_signals) && __ratelimit(&_hppa_rs)) { \
166 printk(fmt, ##__VA_ARGS__); \
167 show_regs(regs); \
168 } \
169}
170
171
163static void do_show_stack(struct unwind_frame_info *info) 172static void do_show_stack(struct unwind_frame_info *info)
164{ 173{
165 int i = 1; 174 int i = 1;
@@ -229,12 +238,10 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
229 if (err == 0) 238 if (err == 0)
230 return; /* STFU */ 239 return; /* STFU */
231 240
232 printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", 241 parisc_printk_ratelimited(1, regs,
242 KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
233 current->comm, task_pid_nr(current), str, err, regs->iaoq[0]); 243 current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
234#ifdef PRINT_USER_FAULTS 244
235 /* XXX for debugging only */
236 show_regs(regs);
237#endif
238 return; 245 return;
239 } 246 }
240 247
@@ -321,14 +328,11 @@ static void handle_break(struct pt_regs *regs)
321 (tt == BUG_TRAP_TYPE_NONE) ? 9 : 0); 328 (tt == BUG_TRAP_TYPE_NONE) ? 9 : 0);
322 } 329 }
323 330
324#ifdef PRINT_USER_FAULTS 331 if (unlikely(iir != GDB_BREAK_INSN))
325 if (unlikely(iir != GDB_BREAK_INSN)) { 332 parisc_printk_ratelimited(0, regs,
326 printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n", 333 KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",
327 iir & 31, (iir>>13) & ((1<<13)-1), 334 iir & 31, (iir>>13) & ((1<<13)-1),
328 task_pid_nr(current), current->comm); 335 task_pid_nr(current), current->comm);
329 show_regs(regs);
330 }
331#endif
332 336
333 /* send standard GDB signal */ 337 /* send standard GDB signal */
334 handle_gdb_break(regs, TRAP_BRKPT); 338 handle_gdb_break(regs, TRAP_BRKPT);
@@ -758,11 +762,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
758 762
759 default: 763 default:
760 if (user_mode(regs)) { 764 if (user_mode(regs)) {
761#ifdef PRINT_USER_FAULTS 765 parisc_printk_ratelimited(0, regs, KERN_DEBUG
762 printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n", 766 "handle_interruption() pid=%d command='%s'\n",
763 task_pid_nr(current), current->comm); 767 task_pid_nr(current), current->comm);
764 show_regs(regs);
765#endif
766 /* SIGBUS, for lack of a better one. */ 768 /* SIGBUS, for lack of a better one. */
767 si.si_signo = SIGBUS; 769 si.si_signo = SIGBUS;
768 si.si_code = BUS_OBJERR; 770 si.si_code = BUS_OBJERR;
@@ -779,16 +781,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
779 781
780 if (user_mode(regs)) { 782 if (user_mode(regs)) {
781 if ((fault_space >> SPACEID_SHIFT) != (regs->sr[7] >> SPACEID_SHIFT)) { 783 if ((fault_space >> SPACEID_SHIFT) != (regs->sr[7] >> SPACEID_SHIFT)) {
782#ifdef PRINT_USER_FAULTS 784 parisc_printk_ratelimited(0, regs, KERN_DEBUG
783 if (fault_space == 0) 785 "User fault %d on space 0x%08lx, pid=%d command='%s'\n",
784 printk(KERN_DEBUG "User Fault on Kernel Space "); 786 code, fault_space,
785 else 787 task_pid_nr(current), current->comm);
786 printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ",
787 code);
788 printk(KERN_CONT "pid=%d command='%s'\n",
789 task_pid_nr(current), current->comm);
790 show_regs(regs);
791#endif
792 si.si_signo = SIGSEGV; 788 si.si_signo = SIGSEGV;
793 si.si_errno = 0; 789 si.si_errno = 0;
794 si.si_code = SEGV_MAPERR; 790 si.si_code = SEGV_MAPERR;
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 747550762f3c..3ca9c1131cfe 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -19,10 +19,6 @@
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20#include <asm/traps.h> 20#include <asm/traps.h>
21 21
22#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
23 /* dumped to the console via printk) */
24
25
26/* Various important other fields */ 22/* Various important other fields */
27#define bit22set(x) (x & 0x00000200) 23#define bit22set(x) (x & 0x00000200)
28#define bits23_25set(x) (x & 0x000001c0) 24#define bits23_25set(x) (x & 0x000001c0)
@@ -34,6 +30,8 @@
34 30
35DEFINE_PER_CPU(struct exception_data, exception_data); 31DEFINE_PER_CPU(struct exception_data, exception_data);
36 32
33int show_unhandled_signals = 1;
34
37/* 35/*
38 * parisc_acctyp(unsigned int inst) -- 36 * parisc_acctyp(unsigned int inst) --
39 * Given a PA-RISC memory access instruction, determine if the 37 * Given a PA-RISC memory access instruction, determine if the
@@ -173,6 +171,32 @@ int fixup_exception(struct pt_regs *regs)
173 return 0; 171 return 0;
174} 172}
175 173
174/*
175 * Print out info about fatal segfaults, if the show_unhandled_signals
176 * sysctl is set:
177 */
178static inline void
179show_signal_msg(struct pt_regs *regs, unsigned long code,
180 unsigned long address, struct task_struct *tsk,
181 struct vm_area_struct *vma)
182{
183 if (!unhandled_signal(tsk, SIGSEGV))
184 return;
185
186 if (!printk_ratelimit())
187 return;
188
189 pr_warn("\n");
190 pr_warn("do_page_fault() command='%s' type=%lu address=0x%08lx",
191 tsk->comm, code, address);
192 print_vma_addr(KERN_CONT " in ", regs->iaoq[0]);
193 if (vma)
194 pr_warn(" vm_start = 0x%08lx, vm_end = 0x%08lx\n",
195 vma->vm_start, vma->vm_end);
196
197 show_regs(regs);
198}
199
176void do_page_fault(struct pt_regs *regs, unsigned long code, 200void do_page_fault(struct pt_regs *regs, unsigned long code,
177 unsigned long address) 201 unsigned long address)
178{ 202{
@@ -270,16 +294,8 @@ bad_area:
270 if (user_mode(regs)) { 294 if (user_mode(regs)) {
271 struct siginfo si; 295 struct siginfo si;
272 296
273#ifdef PRINT_USER_FAULTS 297 show_signal_msg(regs, code, address, tsk, vma);
274 printk(KERN_DEBUG "\n"); 298
275 printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
276 task_pid_nr(tsk), tsk->comm, code, address);
277 if (vma) {
278 printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
279 vma->vm_start, vma->vm_end);
280 }
281 show_regs(regs);
282#endif
283 switch (code) { 299 switch (code) {
284 case 15: /* Data TLB miss fault/Data page fault */ 300 case 15: /* Data TLB miss fault/Data page fault */
285 /* send SIGSEGV when outside of vma */ 301 /* send SIGSEGV when outside of vma */
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 4c0cedf4e2c7..ce4c68a4a823 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -150,7 +150,9 @@ endif
150 150
151CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell) 151CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell)
152 152
153KBUILD_CPPFLAGS += -Iarch/$(ARCH) 153asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
154
155KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr)
154KBUILD_AFLAGS += -Iarch/$(ARCH) 156KBUILD_AFLAGS += -Iarch/$(ARCH)
155KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) 157KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
156CPP = $(CC) -E $(KBUILD_CFLAGS) 158CPP = $(CC) -E $(KBUILD_CFLAGS)
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 95145a15c708..1b0739bc14b5 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -46,11 +46,6 @@ struct pci_dev;
46#define pcibios_assign_all_busses() \ 46#define pcibios_assign_all_busses() \
47 (pci_has_flag(PCI_REASSIGN_ALL_BUS)) 47 (pci_has_flag(PCI_REASSIGN_ALL_BUS))
48 48
49static inline void pcibios_penalize_isa_irq(int irq, int active)
50{
51 /* We don't do dynamic PCI IRQ allocation */
52}
53
54#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 49#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
55static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 50static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
56{ 51{
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 6586a40a46ce..cded7c1278ef 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -318,11 +318,16 @@ n:
318 addi reg,reg,(name - 0b)@l; 318 addi reg,reg,(name - 0b)@l;
319 319
320#ifdef __powerpc64__ 320#ifdef __powerpc64__
321#ifdef HAVE_AS_ATHIGH
322#define __AS_ATHIGH high
323#else
324#define __AS_ATHIGH h
325#endif
321#define LOAD_REG_IMMEDIATE(reg,expr) \ 326#define LOAD_REG_IMMEDIATE(reg,expr) \
322 lis reg,(expr)@highest; \ 327 lis reg,(expr)@highest; \
323 ori reg,reg,(expr)@higher; \ 328 ori reg,reg,(expr)@higher; \
324 rldicr reg,reg,32,31; \ 329 rldicr reg,reg,32,31; \
325 oris reg,reg,(expr)@h; \ 330 oris reg,reg,(expr)@__AS_ATHIGH; \
326 ori reg,reg,(expr)@l; 331 ori reg,reg,(expr)@l;
327 332
328#define LOAD_REG_ADDR(reg,name) \ 333#define LOAD_REG_ADDR(reg,name) \
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
index d0e784e0ff48..521790330672 100644
--- a/arch/powerpc/include/asm/sections.h
+++ b/arch/powerpc/include/asm/sections.h
@@ -39,6 +39,17 @@ static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
39 (unsigned long)_stext < end; 39 (unsigned long)_stext < end;
40} 40}
41 41
42static inline int overlaps_kvm_tmp(unsigned long start, unsigned long end)
43{
44#ifdef CONFIG_KVM_GUEST
45 extern char kvm_tmp[];
46 return start < (unsigned long)kvm_tmp &&
47 (unsigned long)&kvm_tmp[1024 * 1024] < end;
48#else
49 return 0;
50#endif
51}
52
42#undef dereference_function_descriptor 53#undef dereference_function_descriptor
43static inline void *dereference_function_descriptor(void *ptr) 54static inline void *dereference_function_descriptor(void *ptr)
44{ 55{
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 3ddf70276706..ea4dc3a89c1f 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -361,3 +361,4 @@ SYSCALL(finit_module)
361SYSCALL(ni_syscall) /* sys_kcmp */ 361SYSCALL(ni_syscall) /* sys_kcmp */
362SYSCALL_SPU(sched_setattr) 362SYSCALL_SPU(sched_setattr)
363SYSCALL_SPU(sched_getattr) 363SYSCALL_SPU(sched_getattr)
364SYSCALL_SPU(renameat2)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 4494f029b632..9b892bbd9d84 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
12#include <uapi/asm/unistd.h> 12#include <uapi/asm/unistd.h>
13 13
14 14
15#define __NR_syscalls 357 15#define __NR_syscalls 358
16 16
17#define __NR__exit __NR_exit 17#define __NR__exit __NR_exit
18#define NR_syscalls __NR_syscalls 18#define NR_syscalls __NR_syscalls
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h
index 881bf2e2560d..2d526f7b48da 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -379,5 +379,6 @@
379#define __NR_kcmp 354 379#define __NR_kcmp 354
380#define __NR_sched_setattr 355 380#define __NR_sched_setattr 355
381#define __NR_sched_getattr 356 381#define __NR_sched_getattr 356
382#define __NR_renameat2 357
382 383
383#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ 384#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 6a0175297b0d..dd8695f6cb6d 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -74,7 +74,7 @@
74#define KVM_INST_MTSRIN 0x7c0001e4 74#define KVM_INST_MTSRIN 0x7c0001e4
75 75
76static bool kvm_patching_worked = true; 76static bool kvm_patching_worked = true;
77static char kvm_tmp[1024 * 1024]; 77char kvm_tmp[1024 * 1024];
78static int kvm_tmp_index; 78static int kvm_tmp_index;
79 79
80static inline void kvm_patch_ins(u32 *inst, u32 new_inst) 80static inline void kvm_patch_ins(u32 *inst, u32 new_inst)
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 59d229a2a3e0..879b3aacac32 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -237,7 +237,7 @@ static void wake_offline_cpus(void)
237 if (!cpu_online(cpu)) { 237 if (!cpu_online(cpu)) {
238 printk(KERN_INFO "kexec: Waking offline cpu %d.\n", 238 printk(KERN_INFO "kexec: Waking offline cpu %d.\n",
239 cpu); 239 cpu);
240 cpu_up(cpu); 240 WARN_ON(cpu_up(cpu));
241 } 241 }
242 } 242 }
243} 243}
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index d9476c1fc959..24d342e91790 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -201,26 +201,6 @@ struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
201 return NULL; 201 return NULL;
202} 202}
203 203
204static ssize_t pci_show_devspec(struct device *dev,
205 struct device_attribute *attr, char *buf)
206{
207 struct pci_dev *pdev;
208 struct device_node *np;
209
210 pdev = to_pci_dev (dev);
211 np = pci_device_to_OF_node(pdev);
212 if (np == NULL || np->full_name == NULL)
213 return 0;
214 return sprintf(buf, "%s", np->full_name);
215}
216static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
217
218/* Add sysfs properties */
219int pcibios_add_platform_entries(struct pci_dev *pdev)
220{
221 return device_create_file(&pdev->dev, &dev_attr_devspec);
222}
223
224/* 204/*
225 * Reads the interrupt pin to determine if interrupt is use by card. 205 * Reads the interrupt pin to determine if interrupt is use by card.
226 * If the interrupt is used, then gets the interrupt line from the 206 * If the interrupt is used, then gets the interrupt line from the
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
index c1e17ae68a08..5b789177aa29 100644
--- a/arch/powerpc/kernel/pci-hotplug.c
+++ b/arch/powerpc/kernel/pci-hotplug.c
@@ -98,8 +98,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus)
98 max = bus->busn_res.start; 98 max = bus->busn_res.start;
99 for (pass = 0; pass < 2; pass++) { 99 for (pass = 0; pass < 2; pass++) {
100 list_for_each_entry(dev, &bus->devices, bus_list) { 100 list_for_each_entry(dev, &bus->devices, bus_list) {
101 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 101 if (pci_is_bridge(dev))
102 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
103 max = pci_scan_bridge(bus, dev, 102 max = pci_scan_bridge(bus, dev,
104 max, pass); 103 max, pass);
105 } 104 }
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 83c26d829991..059e244484fe 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -362,8 +362,7 @@ static void __of_scan_bus(struct device_node *node, struct pci_bus *bus,
362 362
363 /* Now scan child busses */ 363 /* Now scan child busses */
364 list_for_each_entry(dev, &bus->devices, bus_list) { 364 list_for_each_entry(dev, &bus->devices, bus_list) {
365 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 365 if (pci_is_bridge(dev)) {
366 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
367 of_scan_pci_bridge(dev); 366 of_scan_pci_bridge(dev);
368 } 367 }
369 } 368 }
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 122a580f7322..7e711bdcc6da 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -813,9 +813,6 @@ static void __init clocksource_init(void)
813static int decrementer_set_next_event(unsigned long evt, 813static int decrementer_set_next_event(unsigned long evt,
814 struct clock_event_device *dev) 814 struct clock_event_device *dev)
815{ 815{
816 /* Don't adjust the decrementer if some irq work is pending */
817 if (test_irq_work_pending())
818 return 0;
819 __get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt; 816 __get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt;
820 set_dec(evt); 817 set_dec(evt);
821 818
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 94e597e6f15c..7af190a266b3 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -886,7 +886,7 @@ static int kvmppc_book3s_init(void)
886 r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); 886 r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
887 if (r) 887 if (r)
888 return r; 888 return r;
889#ifdef CONFIG_KVM_BOOK3S_32 889#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
890 r = kvmppc_book3s_init_pr(); 890 r = kvmppc_book3s_init_pr();
891#endif 891#endif
892 return r; 892 return r;
@@ -895,7 +895,7 @@ static int kvmppc_book3s_init(void)
895 895
896static void kvmppc_book3s_exit(void) 896static void kvmppc_book3s_exit(void)
897{ 897{
898#ifdef CONFIG_KVM_BOOK3S_32 898#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
899 kvmppc_book3s_exit_pr(); 899 kvmppc_book3s_exit_pr();
900#endif 900#endif
901 kvm_exit(); 901 kvm_exit();
@@ -905,7 +905,7 @@ module_init(kvmppc_book3s_init);
905module_exit(kvmppc_book3s_exit); 905module_exit(kvmppc_book3s_exit);
906 906
907/* On 32bit this is our one and only kernel module */ 907/* On 32bit this is our one and only kernel module */
908#ifdef CONFIG_KVM_BOOK3S_32 908#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
909MODULE_ALIAS_MISCDEV(KVM_MINOR); 909MODULE_ALIAS_MISCDEV(KVM_MINOR);
910MODULE_ALIAS("devname:kvm"); 910MODULE_ALIAS("devname:kvm");
911#endif 911#endif
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 1d6c56ad5b60..8fcc36306a02 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -234,7 +234,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
234 pte_size = psize; 234 pte_size = psize;
235 pte = lookup_linux_pte_and_update(pgdir, hva, writing, 235 pte = lookup_linux_pte_and_update(pgdir, hva, writing,
236 &pte_size); 236 &pte_size);
237 if (pte_present(pte)) { 237 if (pte_present(pte) && !pte_numa(pte)) {
238 if (writing && !pte_write(pte)) 238 if (writing && !pte_write(pte))
239 /* make the actual HPTE be read-only */ 239 /* make the actual HPTE be read-only */
240 ptel = hpte_make_readonly(ptel); 240 ptel = hpte_make_readonly(ptel);
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index b031f932c0cc..07c8b5b0f9d2 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1323,6 +1323,110 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1323 mr r3, r9 1323 mr r3, r9
1324 bl kvmppc_save_fp 1324 bl kvmppc_save_fp
1325 1325
1326#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1327BEGIN_FTR_SECTION
1328 b 2f
1329END_FTR_SECTION_IFCLR(CPU_FTR_TM)
1330 /* Turn on TM. */
1331 mfmsr r8
1332 li r0, 1
1333 rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG
1334 mtmsrd r8
1335
1336 ld r5, VCPU_MSR(r9)
1337 rldicl. r5, r5, 64 - MSR_TS_S_LG, 62
1338 beq 1f /* TM not active in guest. */
1339
1340 li r3, TM_CAUSE_KVM_RESCHED
1341
1342 /* Clear the MSR RI since r1, r13 are all going to be foobar. */
1343 li r5, 0
1344 mtmsrd r5, 1
1345
1346 /* All GPRs are volatile at this point. */
1347 TRECLAIM(R3)
1348
1349 /* Temporarily store r13 and r9 so we have some regs to play with */
1350 SET_SCRATCH0(r13)
1351 GET_PACA(r13)
1352 std r9, PACATMSCRATCH(r13)
1353 ld r9, HSTATE_KVM_VCPU(r13)
1354
1355 /* Get a few more GPRs free. */
1356 std r29, VCPU_GPRS_TM(29)(r9)
1357 std r30, VCPU_GPRS_TM(30)(r9)
1358 std r31, VCPU_GPRS_TM(31)(r9)
1359
1360 /* Save away PPR and DSCR soon so don't run with user values. */
1361 mfspr r31, SPRN_PPR
1362 HMT_MEDIUM
1363 mfspr r30, SPRN_DSCR
1364 ld r29, HSTATE_DSCR(r13)
1365 mtspr SPRN_DSCR, r29
1366
1367 /* Save all but r9, r13 & r29-r31 */
1368 reg = 0
1369 .rept 29
1370 .if (reg != 9) && (reg != 13)
1371 std reg, VCPU_GPRS_TM(reg)(r9)
1372 .endif
1373 reg = reg + 1
1374 .endr
1375 /* ... now save r13 */
1376 GET_SCRATCH0(r4)
1377 std r4, VCPU_GPRS_TM(13)(r9)
1378 /* ... and save r9 */
1379 ld r4, PACATMSCRATCH(r13)
1380 std r4, VCPU_GPRS_TM(9)(r9)
1381
1382 /* Reload stack pointer and TOC. */
1383 ld r1, HSTATE_HOST_R1(r13)
1384 ld r2, PACATOC(r13)
1385
1386 /* Set MSR RI now we have r1 and r13 back. */
1387 li r5, MSR_RI
1388 mtmsrd r5, 1
1389
1390 /* Save away checkpinted SPRs. */
1391 std r31, VCPU_PPR_TM(r9)
1392 std r30, VCPU_DSCR_TM(r9)
1393 mflr r5
1394 mfcr r6
1395 mfctr r7
1396 mfspr r8, SPRN_AMR
1397 mfspr r10, SPRN_TAR
1398 std r5, VCPU_LR_TM(r9)
1399 stw r6, VCPU_CR_TM(r9)
1400 std r7, VCPU_CTR_TM(r9)
1401 std r8, VCPU_AMR_TM(r9)
1402 std r10, VCPU_TAR_TM(r9)
1403
1404 /* Restore r12 as trap number. */
1405 lwz r12, VCPU_TRAP(r9)
1406
1407 /* Save FP/VSX. */
1408 addi r3, r9, VCPU_FPRS_TM
1409 bl .store_fp_state
1410 addi r3, r9, VCPU_VRS_TM
1411 bl .store_vr_state
1412 mfspr r6, SPRN_VRSAVE
1413 stw r6, VCPU_VRSAVE_TM(r9)
14141:
1415 /*
1416 * We need to save these SPRs after the treclaim so that the software
1417 * error code is recorded correctly in the TEXASR. Also the user may
1418 * change these outside of a transaction, so they must always be
1419 * context switched.
1420 */
1421 mfspr r5, SPRN_TFHAR
1422 mfspr r6, SPRN_TFIAR
1423 mfspr r7, SPRN_TEXASR
1424 std r5, VCPU_TFHAR(r9)
1425 std r6, VCPU_TFIAR(r9)
1426 std r7, VCPU_TEXASR(r9)
14272:
1428#endif
1429
1326 /* Increment yield count if they have a VPA */ 1430 /* Increment yield count if they have a VPA */
1327 ld r8, VCPU_VPA(r9) /* do they have a VPA? */ 1431 ld r8, VCPU_VPA(r9) /* do they have a VPA? */
1328 cmpdi r8, 0 1432 cmpdi r8, 0
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index c5c052a9729c..02f1defd8bb9 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1153,7 +1153,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct kvm *kvm,
1153 goto free_vcpu; 1153 goto free_vcpu;
1154 vcpu->arch.book3s = vcpu_book3s; 1154 vcpu->arch.book3s = vcpu_book3s;
1155 1155
1156#ifdef CONFIG_KVM_BOOK3S_32 1156#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
1157 vcpu->arch.shadow_vcpu = 1157 vcpu->arch.shadow_vcpu =
1158 kzalloc(sizeof(*vcpu->arch.shadow_vcpu), GFP_KERNEL); 1158 kzalloc(sizeof(*vcpu->arch.shadow_vcpu), GFP_KERNEL);
1159 if (!vcpu->arch.shadow_vcpu) 1159 if (!vcpu->arch.shadow_vcpu)
@@ -1198,7 +1198,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct kvm *kvm,
1198uninit_vcpu: 1198uninit_vcpu:
1199 kvm_vcpu_uninit(vcpu); 1199 kvm_vcpu_uninit(vcpu);
1200free_shadow_vcpu: 1200free_shadow_vcpu:
1201#ifdef CONFIG_KVM_BOOK3S_32 1201#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
1202 kfree(vcpu->arch.shadow_vcpu); 1202 kfree(vcpu->arch.shadow_vcpu);
1203free_vcpu3s: 1203free_vcpu3s:
1204#endif 1204#endif
@@ -1215,7 +1215,7 @@ static void kvmppc_core_vcpu_free_pr(struct kvm_vcpu *vcpu)
1215 1215
1216 free_page((unsigned long)vcpu->arch.shared & PAGE_MASK); 1216 free_page((unsigned long)vcpu->arch.shared & PAGE_MASK);
1217 kvm_vcpu_uninit(vcpu); 1217 kvm_vcpu_uninit(vcpu);
1218#ifdef CONFIG_KVM_BOOK3S_32 1218#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
1219 kfree(vcpu->arch.shadow_vcpu); 1219 kfree(vcpu->arch.shadow_vcpu);
1220#endif 1220#endif
1221 vfree(vcpu_book3s); 1221 vfree(vcpu_book3s);
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index d766d6ee33fe..06ba83b036d3 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -207,6 +207,10 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
207 if (overlaps_kernel_text(vaddr, vaddr + step)) 207 if (overlaps_kernel_text(vaddr, vaddr + step))
208 tprot &= ~HPTE_R_N; 208 tprot &= ~HPTE_R_N;
209 209
210 /* Make kvm guest trampolines executable */
211 if (overlaps_kvm_tmp(vaddr, vaddr + step))
212 tprot &= ~HPTE_R_N;
213
210 /* 214 /*
211 * If relocatable, check if it overlaps interrupt vectors that 215 * If relocatable, check if it overlaps interrupt vectors that
212 * are copied down to real 0. For relocatable kernel 216 * are copied down to real 0. For relocatable kernel
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 253fefe3d1a0..5b51079f3e3b 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -549,7 +549,8 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option)
549 ret = ioda_eeh_phb_reset(hose, option); 549 ret = ioda_eeh_phb_reset(hose, option);
550 } else { 550 } else {
551 bus = eeh_pe_bus_get(pe); 551 bus = eeh_pe_bus_get(pe);
552 if (pci_is_root_bus(bus)) 552 if (pci_is_root_bus(bus) ||
553 pci_is_root_bus(bus->parent))
553 ret = ioda_eeh_root_reset(hose, option); 554 ret = ioda_eeh_root_reset(hose, option);
554 else 555 else
555 ret = ioda_eeh_bridge_reset(hose, bus->self, option); 556 ret = ioda_eeh_bridge_reset(hose, bus->self, option);
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index cf3c0089bef2..23223cd63e54 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -820,6 +820,9 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
820 else 820 else
821 memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); 821 memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
822 spin_unlock(&ctrblk_lock); 822 spin_unlock(&ctrblk_lock);
823 } else {
824 if (!nbytes)
825 memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
823 } 826 }
824 /* 827 /*
825 * final block may be < AES_BLOCK_SIZE, copy only nbytes 828 * final block may be < AES_BLOCK_SIZE, copy only nbytes
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index 0a5aac8a9412..7acb77f7ef1a 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -429,6 +429,9 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
429 else 429 else
430 memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); 430 memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
431 spin_unlock(&ctrblk_lock); 431 spin_unlock(&ctrblk_lock);
432 } else {
433 if (!nbytes)
434 memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
432 } 435 }
433 /* final block may be < DES_BLOCK_SIZE, copy only nbytes */ 436 /* final block may be < DES_BLOCK_SIZE, copy only nbytes */
434 if (nbytes) { 437 if (nbytes) {
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 2583466f576b..79b5f0783a30 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -120,6 +120,8 @@ static inline bool zdev_enabled(struct zpci_dev *zdev)
120 return (zdev->fh & (1UL << 31)) ? true : false; 120 return (zdev->fh & (1UL << 31)) ? true : false;
121} 121}
122 122
123extern const struct attribute_group *zpci_attr_groups[];
124
123/* ----------------------------------------------------------------------------- 125/* -----------------------------------------------------------------------------
124 Prototypes 126 Prototypes
125----------------------------------------------------------------------------- */ 127----------------------------------------------------------------------------- */
@@ -166,10 +168,6 @@ static inline void zpci_exit_slot(struct zpci_dev *zdev) {}
166struct zpci_dev *get_zdev(struct pci_dev *); 168struct zpci_dev *get_zdev(struct pci_dev *);
167struct zpci_dev *get_zdev_by_fid(u32); 169struct zpci_dev *get_zdev_by_fid(u32);
168 170
169/* sysfs */
170int zpci_sysfs_add_device(struct device *);
171void zpci_sysfs_remove_device(struct device *);
172
173/* DMA */ 171/* DMA */
174int zpci_dma_init(void); 172int zpci_dma_init(void);
175void zpci_dma_exit(void); 173void zpci_dma_exit(void);
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index b3ecb8f5b6ce..9ae6664ff08c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -158,6 +158,7 @@ int kvm_dev_ioctl_check_extension(long ext)
158 case KVM_CAP_ONE_REG: 158 case KVM_CAP_ONE_REG:
159 case KVM_CAP_ENABLE_CAP: 159 case KVM_CAP_ENABLE_CAP:
160 case KVM_CAP_S390_CSS_SUPPORT: 160 case KVM_CAP_S390_CSS_SUPPORT:
161 case KVM_CAP_IRQFD:
161 case KVM_CAP_IOEVENTFD: 162 case KVM_CAP_IOEVENTFD:
162 case KVM_CAP_DEVICE_CTRL: 163 case KVM_CAP_DEVICE_CTRL:
163 case KVM_CAP_ENABLE_CAP_VM: 164 case KVM_CAP_ENABLE_CAP_VM:
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 452d3ebd9d0f..e9f8fa9337fe 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -811,7 +811,7 @@ static struct bpf_binary_header *bpf_alloc_binary(unsigned int bpfsize,
811 return NULL; 811 return NULL;
812 memset(header, 0, sz); 812 memset(header, 0, sz);
813 header->pages = sz / PAGE_SIZE; 813 header->pages = sz / PAGE_SIZE;
814 hole = sz - (bpfsize + sizeof(*header)); 814 hole = min(sz - (bpfsize + sizeof(*header)), PAGE_SIZE - sizeof(*header));
815 /* Insert random number of illegal instructions before BPF code 815 /* Insert random number of illegal instructions before BPF code
816 * and make sure the first instruction starts at an even address. 816 * and make sure the first instruction starts at an even address.
817 */ 817 */
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 1df1d29ac81d..bdf02570d1df 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -530,11 +530,6 @@ static void zpci_unmap_resources(struct zpci_dev *zdev)
530 } 530 }
531} 531}
532 532
533int pcibios_add_platform_entries(struct pci_dev *pdev)
534{
535 return zpci_sysfs_add_device(&pdev->dev);
536}
537
538static int __init zpci_irq_init(void) 533static int __init zpci_irq_init(void)
539{ 534{
540 int rc; 535 int rc;
@@ -671,6 +666,7 @@ int pcibios_add_device(struct pci_dev *pdev)
671 int i; 666 int i;
672 667
673 zdev->pdev = pdev; 668 zdev->pdev = pdev;
669 pdev->dev.groups = zpci_attr_groups;
674 zpci_map_resources(zdev); 670 zpci_map_resources(zdev);
675 671
676 for (i = 0; i < PCI_BAR_COUNT; i++) { 672 for (i = 0; i < PCI_BAR_COUNT; i++) {
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
index ab4a91393005..b56a3958f1a7 100644
--- a/arch/s390/pci/pci_sysfs.c
+++ b/arch/s390/pci/pci_sysfs.c
@@ -72,36 +72,18 @@ static ssize_t store_recover(struct device *dev, struct device_attribute *attr,
72} 72}
73static DEVICE_ATTR(recover, S_IWUSR, NULL, store_recover); 73static DEVICE_ATTR(recover, S_IWUSR, NULL, store_recover);
74 74
75static struct device_attribute *zpci_dev_attrs[] = { 75static struct attribute *zpci_dev_attrs[] = {
76 &dev_attr_function_id, 76 &dev_attr_function_id.attr,
77 &dev_attr_function_handle, 77 &dev_attr_function_handle.attr,
78 &dev_attr_pchid, 78 &dev_attr_pchid.attr,
79 &dev_attr_pfgid, 79 &dev_attr_pfgid.attr,
80 &dev_attr_recover, 80 &dev_attr_recover.attr,
81 NULL,
82};
83static struct attribute_group zpci_attr_group = {
84 .attrs = zpci_dev_attrs,
85};
86const struct attribute_group *zpci_attr_groups[] = {
87 &zpci_attr_group,
81 NULL, 88 NULL,
82}; 89};
83
84int zpci_sysfs_add_device(struct device *dev)
85{
86 int i, rc = 0;
87
88 for (i = 0; zpci_dev_attrs[i]; i++) {
89 rc = device_create_file(dev, zpci_dev_attrs[i]);
90 if (rc)
91 goto error;
92 }
93 return 0;
94
95error:
96 while (--i >= 0)
97 device_remove_file(dev, zpci_dev_attrs[i]);
98 return rc;
99}
100
101void zpci_sysfs_remove_device(struct device *dev)
102{
103 int i;
104
105 for (i = 0; zpci_dev_attrs[i]; i++)
106 device_remove_file(dev, zpci_dev_attrs[i]);
107}
diff --git a/arch/sh/drivers/pci/fixups-dreamcast.c b/arch/sh/drivers/pci/fixups-dreamcast.c
index d6cde700e316..1d1c5a227e50 100644
--- a/arch/sh/drivers/pci/fixups-dreamcast.c
+++ b/arch/sh/drivers/pci/fixups-dreamcast.c
@@ -31,6 +31,8 @@
31static void gapspci_fixup_resources(struct pci_dev *dev) 31static void gapspci_fixup_resources(struct pci_dev *dev)
32{ 32{
33 struct pci_channel *p = dev->sysdata; 33 struct pci_channel *p = dev->sysdata;
34 struct resource res;
35 struct pci_bus_region region;
34 36
35 printk(KERN_NOTICE "PCI: Fixing up device %s\n", pci_name(dev)); 37 printk(KERN_NOTICE "PCI: Fixing up device %s\n", pci_name(dev));
36 38
@@ -50,11 +52,21 @@ static void gapspci_fixup_resources(struct pci_dev *dev)
50 52
51 /* 53 /*
52 * Redirect dma memory allocations to special memory window. 54 * Redirect dma memory allocations to special memory window.
55 *
56 * If this GAPSPCI region were mapped by a BAR, the CPU
57 * phys_addr_t would be pci_resource_start(), and the bus
58 * address would be pci_bus_address(pci_resource_start()).
59 * But apparently there's no BAR mapping it, so we just
60 * "know" its CPU address is GAPSPCI_DMA_BASE.
53 */ 61 */
62 res.start = GAPSPCI_DMA_BASE;
63 res.end = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1;
64 res.flags = IORESOURCE_MEM;
65 pcibios_resource_to_bus(dev->bus, &region, &res);
54 BUG_ON(!dma_declare_coherent_memory(&dev->dev, 66 BUG_ON(!dma_declare_coherent_memory(&dev->dev,
55 GAPSPCI_DMA_BASE, 67 res.start,
56 GAPSPCI_DMA_BASE, 68 region.start,
57 GAPSPCI_DMA_SIZE, 69 resource_size(&res),
58 DMA_MEMORY_MAP | 70 DMA_MEMORY_MAP |
59 DMA_MEMORY_EXCLUSIVE)); 71 DMA_MEMORY_EXCLUSIVE));
60 break; 72 break;
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index bff96c2e7d25..5b4511552998 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -70,11 +70,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
70 enum pci_mmap_state mmap_state, int write_combine); 70 enum pci_mmap_state mmap_state, int write_combine);
71extern void pcibios_set_master(struct pci_dev *dev); 71extern void pcibios_set_master(struct pci_dev *dev);
72 72
73static inline void pcibios_penalize_isa_irq(int irq, int active)
74{
75 /* We don't do dynamic PCI IRQ allocation */
76}
77
78/* Dynamic DMA mapping stuff. 73/* Dynamic DMA mapping stuff.
79 * SuperH has everything mapped statically like x86. 74 * SuperH has everything mapped statically like x86.
80 */ 75 */
diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
index f59b1f30d44b..8525a671266f 100644
--- a/arch/sh/kernel/cpu/clock-cpg.c
+++ b/arch/sh/kernel/cpu/clock-cpg.c
@@ -56,9 +56,13 @@ int __init __deprecated cpg_clk_init(void)
56 56
57 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 57 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
58 58
59 clk_add_alias("tmu_fck", NULL, "peripheral_clk", NULL); 59 clk_add_alias("fck", "sh-tmu-sh3.0", "peripheral_clk", NULL);
60 clk_add_alias("mtu2_fck", NULL, "peripheral_clk", NULL); 60 clk_add_alias("fck", "sh-tmu.0", "peripheral_clk", NULL);
61 clk_add_alias("cmt_fck", NULL, "peripheral_clk", NULL); 61 clk_add_alias("fck", "sh-tmu.1", "peripheral_clk", NULL);
62 clk_add_alias("fck", "sh-tmu.2", "peripheral_clk", NULL);
63 clk_add_alias("fck", "sh-mtu2", "peripheral_clk", NULL);
64 clk_add_alias("fck", "sh-cmt-16.0", "peripheral_clk", NULL);
65 clk_add_alias("fck", "sh-cmt-32.0", "peripheral_clk", NULL);
62 clk_add_alias("sci_ick", NULL, "peripheral_clk", NULL); 66 clk_add_alias("sci_ick", NULL, "peripheral_clk", NULL);
63 67
64 return ret; 68 return ret;
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
index 3860b0be56c7..58c19adae900 100644
--- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
@@ -152,62 +152,24 @@ static struct platform_device eth_device = {
152 .resource = eth_resources, 152 .resource = eth_resources,
153}; 153};
154 154
155static struct sh_timer_config cmt0_platform_data = { 155static struct sh_timer_config cmt_platform_data = {
156 .channel_offset = 0x02, 156 .channels_mask = 3,
157 .timer_bit = 0,
158 .clockevent_rating = 125,
159 .clocksource_rating = 0, /* disabled due to code generation issues */
160}; 157};
161 158
162static struct resource cmt0_resources[] = { 159static struct resource cmt_resources[] = {
163 [0] = { 160 DEFINE_RES_MEM(0xf84a0070, 0x10),
164 .start = 0xf84a0072, 161 DEFINE_RES_IRQ(86),
165 .end = 0xf84a0077, 162 DEFINE_RES_IRQ(87),
166 .flags = IORESOURCE_MEM,
167 },
168 [1] = {
169 .start = 86,
170 .flags = IORESOURCE_IRQ,
171 },
172}; 163};
173 164
174static struct platform_device cmt0_device = { 165static struct platform_device cmt_device = {
175 .name = "sh_cmt", 166 .name = "sh-cmt-16",
176 .id = 0, 167 .id = 0,
177 .dev = { 168 .dev = {
178 .platform_data = &cmt0_platform_data, 169 .platform_data = &cmt_platform_data,
179 },
180 .resource = cmt0_resources,
181 .num_resources = ARRAY_SIZE(cmt0_resources),
182};
183
184static struct sh_timer_config cmt1_platform_data = {
185 .channel_offset = 0x08,
186 .timer_bit = 1,
187 .clockevent_rating = 125,
188 .clocksource_rating = 0, /* disabled due to code generation issues */
189};
190
191static struct resource cmt1_resources[] = {
192 [0] = {
193 .start = 0xf84a0078,
194 .end = 0xf84a007d,
195 .flags = IORESOURCE_MEM,
196 },
197 [1] = {
198 .start = 87,
199 .flags = IORESOURCE_IRQ,
200 },
201};
202
203static struct platform_device cmt1_device = {
204 .name = "sh_cmt",
205 .id = 1,
206 .dev = {
207 .platform_data = &cmt1_platform_data,
208 }, 170 },
209 .resource = cmt1_resources, 171 .resource = cmt_resources,
210 .num_resources = ARRAY_SIZE(cmt1_resources), 172 .num_resources = ARRAY_SIZE(cmt_resources),
211}; 173};
212 174
213static struct platform_device *sh7619_devices[] __initdata = { 175static struct platform_device *sh7619_devices[] __initdata = {
@@ -215,8 +177,7 @@ static struct platform_device *sh7619_devices[] __initdata = {
215 &scif1_device, 177 &scif1_device,
216 &scif2_device, 178 &scif2_device,
217 &eth_device, 179 &eth_device,
218 &cmt0_device, 180 &cmt_device,
219 &cmt1_device,
220}; 181};
221 182
222static int __init sh7619_devices_setup(void) 183static int __init sh7619_devices_setup(void)
@@ -235,8 +196,7 @@ static struct platform_device *sh7619_early_devices[] __initdata = {
235 &scif0_device, 196 &scif0_device,
236 &scif1_device, 197 &scif1_device,
237 &scif2_device, 198 &scif2_device,
238 &cmt0_device, 199 &cmt_device,
239 &cmt1_device,
240}; 200};
241 201
242#define STBCR3 0xf80a0000 202#define STBCR3 0xf80a0000
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7264.c b/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
index fdf585c95289..8638fba6cd7f 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
@@ -117,9 +117,9 @@ static struct clk_lookup lookups[] = {
117 /* MSTP clocks */ 117 /* MSTP clocks */
118 CLKDEV_CON_ID("sci_ick", &mstp_clks[MSTP77]), 118 CLKDEV_CON_ID("sci_ick", &mstp_clks[MSTP77]),
119 CLKDEV_CON_ID("vdc3", &mstp_clks[MSTP74]), 119 CLKDEV_CON_ID("vdc3", &mstp_clks[MSTP74]),
120 CLKDEV_CON_ID("cmt_fck", &mstp_clks[MSTP72]), 120 CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]),
121 CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]), 121 CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]),
122 CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP35]), 122 CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP35]),
123 CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP34]), 123 CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP34]),
124 CLKDEV_CON_ID("sdhi1", &mstp_clks[MSTP33]), 124 CLKDEV_CON_ID("sdhi1", &mstp_clks[MSTP33]),
125 CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]), 125 CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]),
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7269.c b/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
index 6b787620de99..f8a5c2abdfb3 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
@@ -158,9 +158,9 @@ static struct clk_lookup lookups[] = {
158 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]), 158 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]),
159 CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]), 159 CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]),
160 CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]), 160 CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
161 CLKDEV_CON_ID("cmt_fck", &mstp_clks[MSTP72]), 161 CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]),
162 CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]), 162 CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]),
163 CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP35]), 163 CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP35]),
164 CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]), 164 CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]),
165 CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP30]), 165 CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP30]),
166}; 166};
diff --git a/arch/sh/kernel/cpu/sh2a/setup-mxg.c b/arch/sh/kernel/cpu/sh2a/setup-mxg.c
index 63e996f9a7ed..26fcdbd4127a 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-mxg.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-mxg.c
@@ -114,88 +114,18 @@ static struct intc_mask_reg mask_registers[] __initdata = {
114static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups, 114static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups,
115 mask_registers, prio_registers, NULL); 115 mask_registers, prio_registers, NULL);
116 116
117static struct sh_timer_config mtu2_0_platform_data = { 117static struct resource mtu2_resources[] = {
118 .channel_offset = -0x80, 118 DEFINE_RES_MEM(0xff801000, 0x400),
119 .timer_bit = 0, 119 DEFINE_RES_IRQ_NAMED(228, "tgi0a"),
120 .clockevent_rating = 200, 120 DEFINE_RES_IRQ_NAMED(234, "tgi1a"),
121 DEFINE_RES_IRQ_NAMED(240, "tgi2a"),
121}; 122};
122 123
123static struct resource mtu2_0_resources[] = { 124static struct platform_device mtu2_device = {
124 [0] = { 125 .name = "sh-mtu2",
125 .start = 0xff801300, 126 .id = -1,
126 .end = 0xff801326, 127 .resource = mtu2_resources,
127 .flags = IORESOURCE_MEM, 128 .num_resources = ARRAY_SIZE(mtu2_resources),
128 },
129 [1] = {
130 .start = 228,
131 .flags = IORESOURCE_IRQ,
132 },
133};
134
135static struct platform_device mtu2_0_device = {
136 .name = "sh_mtu2",
137 .id = 0,
138 .dev = {
139 .platform_data = &mtu2_0_platform_data,
140 },
141 .resource = mtu2_0_resources,
142 .num_resources = ARRAY_SIZE(mtu2_0_resources),
143};
144
145static struct sh_timer_config mtu2_1_platform_data = {
146 .channel_offset = -0x100,
147 .timer_bit = 1,
148 .clockevent_rating = 200,
149};
150
151static struct resource mtu2_1_resources[] = {
152 [0] = {
153 .start = 0xff801380,
154 .end = 0xff801390,
155 .flags = IORESOURCE_MEM,
156 },
157 [1] = {
158 .start = 234,
159 .flags = IORESOURCE_IRQ,
160 },
161};
162
163static struct platform_device mtu2_1_device = {
164 .name = "sh_mtu2",
165 .id = 1,
166 .dev = {
167 .platform_data = &mtu2_1_platform_data,
168 },
169 .resource = mtu2_1_resources,
170 .num_resources = ARRAY_SIZE(mtu2_1_resources),
171};
172
173static struct sh_timer_config mtu2_2_platform_data = {
174 .channel_offset = 0x80,
175 .timer_bit = 2,
176 .clockevent_rating = 200,
177};
178
179static struct resource mtu2_2_resources[] = {
180 [0] = {
181 .start = 0xff801000,
182 .end = 0xff80100a,
183 .flags = IORESOURCE_MEM,
184 },
185 [1] = {
186 .start = 240,
187 .flags = IORESOURCE_IRQ,
188 },
189};
190
191static struct platform_device mtu2_2_device = {
192 .name = "sh_mtu2",
193 .id = 2,
194 .dev = {
195 .platform_data = &mtu2_2_platform_data,
196 },
197 .resource = mtu2_2_resources,
198 .num_resources = ARRAY_SIZE(mtu2_2_resources),
199}; 129};
200 130
201static struct plat_sci_port scif0_platform_data = { 131static struct plat_sci_port scif0_platform_data = {
@@ -221,9 +151,7 @@ static struct platform_device scif0_device = {
221 151
222static struct platform_device *mxg_devices[] __initdata = { 152static struct platform_device *mxg_devices[] __initdata = {
223 &scif0_device, 153 &scif0_device,
224 &mtu2_0_device, 154 &mtu2_device,
225 &mtu2_1_device,
226 &mtu2_2_device,
227}; 155};
228 156
229static int __init mxg_devices_setup(void) 157static int __init mxg_devices_setup(void)
@@ -240,9 +168,7 @@ void __init plat_irq_setup(void)
240 168
241static struct platform_device *mxg_early_devices[] __initdata = { 169static struct platform_device *mxg_early_devices[] __initdata = {
242 &scif0_device, 170 &scif0_device,
243 &mtu2_0_device, 171 &mtu2_device,
244 &mtu2_1_device,
245 &mtu2_2_device,
246}; 172};
247 173
248void __init plat_early_device_setup(void) 174void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
index 2c6874461536..abc0ce9fb800 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
@@ -365,88 +365,18 @@ static struct platform_device rtc_device = {
365 .resource = rtc_resources, 365 .resource = rtc_resources,
366}; 366};
367 367
368static struct sh_timer_config mtu2_0_platform_data = { 368static struct resource mtu2_resources[] = {
369 .channel_offset = -0x80, 369 DEFINE_RES_MEM(0xfffe4000, 0x400),
370 .timer_bit = 0, 370 DEFINE_RES_IRQ_NAMED(108, "tgi0a"),
371 .clockevent_rating = 200, 371 DEFINE_RES_IRQ_NAMED(116, "tgi1a"),
372 DEFINE_RES_IRQ_NAMED(124, "tgi1b"),
372}; 373};
373 374
374static struct resource mtu2_0_resources[] = { 375static struct platform_device mtu2_device = {
375 [0] = { 376 .name = "sh-mtu2",
376 .start = 0xfffe4300, 377 .id = -1,
377 .end = 0xfffe4326, 378 .resource = mtu2_resources,
378 .flags = IORESOURCE_MEM, 379 .num_resources = ARRAY_SIZE(mtu2_resources),
379 },
380 [1] = {
381 .start = 108,
382 .flags = IORESOURCE_IRQ,
383 },
384};
385
386static struct platform_device mtu2_0_device = {
387 .name = "sh_mtu2",
388 .id = 0,
389 .dev = {
390 .platform_data = &mtu2_0_platform_data,
391 },
392 .resource = mtu2_0_resources,
393 .num_resources = ARRAY_SIZE(mtu2_0_resources),
394};
395
396static struct sh_timer_config mtu2_1_platform_data = {
397 .channel_offset = -0x100,
398 .timer_bit = 1,
399 .clockevent_rating = 200,
400};
401
402static struct resource mtu2_1_resources[] = {
403 [0] = {
404 .start = 0xfffe4380,
405 .end = 0xfffe4390,
406 .flags = IORESOURCE_MEM,
407 },
408 [1] = {
409 .start = 116,
410 .flags = IORESOURCE_IRQ,
411 },
412};
413
414static struct platform_device mtu2_1_device = {
415 .name = "sh_mtu2",
416 .id = 1,
417 .dev = {
418 .platform_data = &mtu2_1_platform_data,
419 },
420 .resource = mtu2_1_resources,
421 .num_resources = ARRAY_SIZE(mtu2_1_resources),
422};
423
424static struct sh_timer_config mtu2_2_platform_data = {
425 .channel_offset = 0x80,
426 .timer_bit = 2,
427 .clockevent_rating = 200,
428};
429
430static struct resource mtu2_2_resources[] = {
431 [0] = {
432 .start = 0xfffe4000,
433 .end = 0xfffe400a,
434 .flags = IORESOURCE_MEM,
435 },
436 [1] = {
437 .start = 124,
438 .flags = IORESOURCE_IRQ,
439 },
440};
441
442static struct platform_device mtu2_2_device = {
443 .name = "sh_mtu2",
444 .id = 2,
445 .dev = {
446 .platform_data = &mtu2_2_platform_data,
447 },
448 .resource = mtu2_2_resources,
449 .num_resources = ARRAY_SIZE(mtu2_2_resources),
450}; 380};
451 381
452static struct platform_device *sh7201_devices[] __initdata = { 382static struct platform_device *sh7201_devices[] __initdata = {
@@ -459,9 +389,7 @@ static struct platform_device *sh7201_devices[] __initdata = {
459 &scif6_device, 389 &scif6_device,
460 &scif7_device, 390 &scif7_device,
461 &rtc_device, 391 &rtc_device,
462 &mtu2_0_device, 392 &mtu2_device,
463 &mtu2_1_device,
464 &mtu2_2_device,
465}; 393};
466 394
467static int __init sh7201_devices_setup(void) 395static int __init sh7201_devices_setup(void)
@@ -485,9 +413,7 @@ static struct platform_device *sh7201_early_devices[] __initdata = {
485 &scif5_device, 413 &scif5_device,
486 &scif6_device, 414 &scif6_device,
487 &scif7_device, 415 &scif7_device,
488 &mtu2_0_device, 416 &mtu2_device,
489 &mtu2_1_device,
490 &mtu2_2_device,
491}; 417};
492 418
493#define STBCR3 0xfffe0408 419#define STBCR3 0xfffe0408
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
index d55a0f30ada3..3b4894cba92f 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
@@ -265,118 +265,37 @@ static struct platform_device scif3_device = {
265 }, 265 },
266}; 266};
267 267
268static struct sh_timer_config cmt0_platform_data = { 268static struct sh_timer_config cmt_platform_data = {
269 .channel_offset = 0x02, 269 .channels_mask = 3,
270 .timer_bit = 0,
271 .clockevent_rating = 125,
272 .clocksource_rating = 0, /* disabled due to code generation issues */
273}; 270};
274 271
275static struct resource cmt0_resources[] = { 272static struct resource cmt_resources[] = {
276 [0] = { 273 DEFINE_RES_MEM(0xfffec000, 0x10),
277 .start = 0xfffec002, 274 DEFINE_RES_IRQ(142),
278 .end = 0xfffec007, 275 DEFINE_RES_IRQ(143),
279 .flags = IORESOURCE_MEM,
280 },
281 [1] = {
282 .start = 142,
283 .flags = IORESOURCE_IRQ,
284 },
285};
286
287static struct platform_device cmt0_device = {
288 .name = "sh_cmt",
289 .id = 0,
290 .dev = {
291 .platform_data = &cmt0_platform_data,
292 },
293 .resource = cmt0_resources,
294 .num_resources = ARRAY_SIZE(cmt0_resources),
295};
296
297static struct sh_timer_config cmt1_platform_data = {
298 .channel_offset = 0x08,
299 .timer_bit = 1,
300 .clockevent_rating = 125,
301 .clocksource_rating = 0, /* disabled due to code generation issues */
302};
303
304static struct resource cmt1_resources[] = {
305 [0] = {
306 .start = 0xfffec008,
307 .end = 0xfffec00d,
308 .flags = IORESOURCE_MEM,
309 },
310 [1] = {
311 .start = 143,
312 .flags = IORESOURCE_IRQ,
313 },
314};
315
316static struct platform_device cmt1_device = {
317 .name = "sh_cmt",
318 .id = 1,
319 .dev = {
320 .platform_data = &cmt1_platform_data,
321 },
322 .resource = cmt1_resources,
323 .num_resources = ARRAY_SIZE(cmt1_resources),
324};
325
326static struct sh_timer_config mtu2_0_platform_data = {
327 .channel_offset = -0x80,
328 .timer_bit = 0,
329 .clockevent_rating = 200,
330};
331
332static struct resource mtu2_0_resources[] = {
333 [0] = {
334 .start = 0xfffe4300,
335 .end = 0xfffe4326,
336 .flags = IORESOURCE_MEM,
337 },
338 [1] = {
339 .start = 146,
340 .flags = IORESOURCE_IRQ,
341 },
342}; 276};
343 277
344static struct platform_device mtu2_0_device = { 278static struct platform_device cmt_device = {
345 .name = "sh_mtu2", 279 .name = "sh-cmt-16",
346 .id = 0, 280 .id = 0,
347 .dev = { 281 .dev = {
348 .platform_data = &mtu2_0_platform_data, 282 .platform_data = &cmt_platform_data,
349 }, 283 },
350 .resource = mtu2_0_resources, 284 .resource = cmt_resources,
351 .num_resources = ARRAY_SIZE(mtu2_0_resources), 285 .num_resources = ARRAY_SIZE(cmt_resources),
352}; 286};
353 287
354static struct sh_timer_config mtu2_1_platform_data = { 288static struct resource mtu2_resources[] = {
355 .channel_offset = -0x100, 289 DEFINE_RES_MEM(0xfffe4000, 0x400),
356 .timer_bit = 1, 290 DEFINE_RES_IRQ_NAMED(146, "tgi0a"),
357 .clockevent_rating = 200, 291 DEFINE_RES_IRQ_NAMED(153, "tgi1a"),
358}; 292};
359 293
360static struct resource mtu2_1_resources[] = { 294static struct platform_device mtu2_device = {
361 [0] = { 295 .name = "sh-mtu2",
362 .start = 0xfffe4380, 296 .id = -1,
363 .end = 0xfffe4390, 297 .resource = mtu2_resources,
364 .flags = IORESOURCE_MEM, 298 .num_resources = ARRAY_SIZE(mtu2_resources),
365 },
366 [1] = {
367 .start = 153,
368 .flags = IORESOURCE_IRQ,
369 },
370};
371
372static struct platform_device mtu2_1_device = {
373 .name = "sh_mtu2",
374 .id = 1,
375 .dev = {
376 .platform_data = &mtu2_1_platform_data,
377 },
378 .resource = mtu2_1_resources,
379 .num_resources = ARRAY_SIZE(mtu2_1_resources),
380}; 299};
381 300
382static struct resource rtc_resources[] = { 301static struct resource rtc_resources[] = {
@@ -404,10 +323,8 @@ static struct platform_device *sh7203_devices[] __initdata = {
404 &scif1_device, 323 &scif1_device,
405 &scif2_device, 324 &scif2_device,
406 &scif3_device, 325 &scif3_device,
407 &cmt0_device, 326 &cmt_device,
408 &cmt1_device, 327 &mtu2_device,
409 &mtu2_0_device,
410 &mtu2_1_device,
411 &rtc_device, 328 &rtc_device,
412}; 329};
413 330
@@ -428,10 +345,8 @@ static struct platform_device *sh7203_early_devices[] __initdata = {
428 &scif1_device, 345 &scif1_device,
429 &scif2_device, 346 &scif2_device,
430 &scif3_device, 347 &scif3_device,
431 &cmt0_device, 348 &cmt_device,
432 &cmt1_device, 349 &mtu2_device,
433 &mtu2_0_device,
434 &mtu2_1_device,
435}; 350};
436 351
437#define STBCR3 0xfffe0408 352#define STBCR3 0xfffe0408
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
index 241e745e3ced..49bc5a34bec1 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
@@ -217,146 +217,38 @@ static struct platform_device scif3_device = {
217 }, 217 },
218}; 218};
219 219
220static struct sh_timer_config cmt0_platform_data = { 220static struct sh_timer_config cmt_platform_data = {
221 .channel_offset = 0x02, 221 .channels_mask = 3,
222 .timer_bit = 0,
223 .clockevent_rating = 125,
224 .clocksource_rating = 0, /* disabled due to code generation issues */
225}; 222};
226 223
227static struct resource cmt0_resources[] = { 224static struct resource cmt_resources[] = {
228 [0] = { 225 DEFINE_RES_MEM(0xfffec000, 0x10),
229 .start = 0xfffec002, 226 DEFINE_RES_IRQ(140),
230 .end = 0xfffec007, 227 DEFINE_RES_IRQ(144),
231 .flags = IORESOURCE_MEM,
232 },
233 [1] = {
234 .start = 140,
235 .flags = IORESOURCE_IRQ,
236 },
237};
238
239static struct platform_device cmt0_device = {
240 .name = "sh_cmt",
241 .id = 0,
242 .dev = {
243 .platform_data = &cmt0_platform_data,
244 },
245 .resource = cmt0_resources,
246 .num_resources = ARRAY_SIZE(cmt0_resources),
247};
248
249static struct sh_timer_config cmt1_platform_data = {
250 .channel_offset = 0x08,
251 .timer_bit = 1,
252 .clockevent_rating = 125,
253 .clocksource_rating = 0, /* disabled due to code generation issues */
254};
255
256static struct resource cmt1_resources[] = {
257 [0] = {
258 .start = 0xfffec008,
259 .end = 0xfffec00d,
260 .flags = IORESOURCE_MEM,
261 },
262 [1] = {
263 .start = 144,
264 .flags = IORESOURCE_IRQ,
265 },
266};
267
268static struct platform_device cmt1_device = {
269 .name = "sh_cmt",
270 .id = 1,
271 .dev = {
272 .platform_data = &cmt1_platform_data,
273 },
274 .resource = cmt1_resources,
275 .num_resources = ARRAY_SIZE(cmt1_resources),
276};
277
278static struct sh_timer_config mtu2_0_platform_data = {
279 .channel_offset = -0x80,
280 .timer_bit = 0,
281 .clockevent_rating = 200,
282};
283
284static struct resource mtu2_0_resources[] = {
285 [0] = {
286 .start = 0xfffe4300,
287 .end = 0xfffe4326,
288 .flags = IORESOURCE_MEM,
289 },
290 [1] = {
291 .start = 156,
292 .flags = IORESOURCE_IRQ,
293 },
294}; 228};
295 229
296static struct platform_device mtu2_0_device = { 230static struct platform_device cmt_device = {
297 .name = "sh_mtu2", 231 .name = "sh-cmt-16",
298 .id = 0, 232 .id = 0,
299 .dev = { 233 .dev = {
300 .platform_data = &mtu2_0_platform_data, 234 .platform_data = &cmt_platform_data,
301 }, 235 },
302 .resource = mtu2_0_resources, 236 .resource = cmt_resources,
303 .num_resources = ARRAY_SIZE(mtu2_0_resources), 237 .num_resources = ARRAY_SIZE(cmt_resources),
304}; 238};
305 239
306static struct sh_timer_config mtu2_1_platform_data = { 240static struct resource mtu2_resources[] = {
307 .channel_offset = -0x100, 241 DEFINE_RES_MEM(0xfffe4000, 0x400),
308 .timer_bit = 1, 242 DEFINE_RES_IRQ_NAMED(156, "tgi0a"),
309 .clockevent_rating = 200, 243 DEFINE_RES_IRQ_NAMED(164, "tgi1a"),
244 DEFINE_RES_IRQ_NAMED(180, "tgi2a"),
310}; 245};
311 246
312static struct resource mtu2_1_resources[] = { 247static struct platform_device mtu2_device = {
313 [0] = { 248 .name = "sh-mtu2s",
314 .start = 0xfffe4380, 249 .id = -1,
315 .end = 0xfffe4390, 250 .resource = mtu2_resources,
316 .flags = IORESOURCE_MEM, 251 .num_resources = ARRAY_SIZE(mtu2_resources),
317 },
318 [1] = {
319 .start = 164,
320 .flags = IORESOURCE_IRQ,
321 },
322};
323
324static struct platform_device mtu2_1_device = {
325 .name = "sh_mtu2",
326 .id = 1,
327 .dev = {
328 .platform_data = &mtu2_1_platform_data,
329 },
330 .resource = mtu2_1_resources,
331 .num_resources = ARRAY_SIZE(mtu2_1_resources),
332};
333
334static struct sh_timer_config mtu2_2_platform_data = {
335 .channel_offset = 0x80,
336 .timer_bit = 2,
337 .clockevent_rating = 200,
338};
339
340static struct resource mtu2_2_resources[] = {
341 [0] = {
342 .start = 0xfffe4000,
343 .end = 0xfffe400a,
344 .flags = IORESOURCE_MEM,
345 },
346 [1] = {
347 .start = 180,
348 .flags = IORESOURCE_IRQ,
349 },
350};
351
352static struct platform_device mtu2_2_device = {
353 .name = "sh_mtu2",
354 .id = 2,
355 .dev = {
356 .platform_data = &mtu2_2_platform_data,
357 },
358 .resource = mtu2_2_resources,
359 .num_resources = ARRAY_SIZE(mtu2_2_resources),
360}; 252};
361 253
362static struct platform_device *sh7206_devices[] __initdata = { 254static struct platform_device *sh7206_devices[] __initdata = {
@@ -364,11 +256,8 @@ static struct platform_device *sh7206_devices[] __initdata = {
364 &scif1_device, 256 &scif1_device,
365 &scif2_device, 257 &scif2_device,
366 &scif3_device, 258 &scif3_device,
367 &cmt0_device, 259 &cmt_device,
368 &cmt1_device, 260 &mtu2_device,
369 &mtu2_0_device,
370 &mtu2_1_device,
371 &mtu2_2_device,
372}; 261};
373 262
374static int __init sh7206_devices_setup(void) 263static int __init sh7206_devices_setup(void)
@@ -388,11 +277,8 @@ static struct platform_device *sh7206_early_devices[] __initdata = {
388 &scif1_device, 277 &scif1_device,
389 &scif2_device, 278 &scif2_device,
390 &scif3_device, 279 &scif3_device,
391 &cmt0_device, 280 &cmt_device,
392 &cmt1_device, 281 &mtu2_device,
393 &mtu2_0_device,
394 &mtu2_1_device,
395 &mtu2_2_device,
396}; 282};
397 283
398#define STBCR3 0xfffe0408 284#define STBCR3 0xfffe0408
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7264.c b/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
index ad5b0f429882..608146455562 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
@@ -433,125 +433,37 @@ static struct platform_device scif7_device = {
433 }, 433 },
434}; 434};
435 435
436static struct sh_timer_config cmt0_platform_data = { 436static struct sh_timer_config cmt_platform_data = {
437 .channel_offset = 0x02, 437 .channels_mask = 3,
438 .timer_bit = 0,
439 .clockevent_rating = 125,
440 .clocksource_rating = 0, /* disabled due to code generation issues */
441}; 438};
442 439
443static struct resource cmt0_resources[] = { 440static struct resource cmt_resources[] = {
444 [0] = { 441 DEFINE_RES_MEM(0xfffec000, 0x10),
445 .name = "CMT0", 442 DEFINE_RES_IRQ(175),
446 .start = 0xfffec002, 443 DEFINE_RES_IRQ(176),
447 .end = 0xfffec007,
448 .flags = IORESOURCE_MEM,
449 },
450 [1] = {
451 .start = 175,
452 .flags = IORESOURCE_IRQ,
453 },
454};
455
456static struct platform_device cmt0_device = {
457 .name = "sh_cmt",
458 .id = 0,
459 .dev = {
460 .platform_data = &cmt0_platform_data,
461 },
462 .resource = cmt0_resources,
463 .num_resources = ARRAY_SIZE(cmt0_resources),
464};
465
466static struct sh_timer_config cmt1_platform_data = {
467 .name = "CMT1",
468 .channel_offset = 0x08,
469 .timer_bit = 1,
470 .clockevent_rating = 125,
471 .clocksource_rating = 0, /* disabled due to code generation issues */
472};
473
474static struct resource cmt1_resources[] = {
475 [0] = {
476 .name = "CMT1",
477 .start = 0xfffec008,
478 .end = 0xfffec00d,
479 .flags = IORESOURCE_MEM,
480 },
481 [1] = {
482 .start = 176,
483 .flags = IORESOURCE_IRQ,
484 },
485};
486
487static struct platform_device cmt1_device = {
488 .name = "sh_cmt",
489 .id = 1,
490 .dev = {
491 .platform_data = &cmt1_platform_data,
492 },
493 .resource = cmt1_resources,
494 .num_resources = ARRAY_SIZE(cmt1_resources),
495};
496
497static struct sh_timer_config mtu2_0_platform_data = {
498 .name = "MTU2_0",
499 .channel_offset = -0x80,
500 .timer_bit = 0,
501 .clockevent_rating = 200,
502};
503
504static struct resource mtu2_0_resources[] = {
505 [0] = {
506 .name = "MTU2_0",
507 .start = 0xfffe4300,
508 .end = 0xfffe4326,
509 .flags = IORESOURCE_MEM,
510 },
511 [1] = {
512 .start = 179,
513 .flags = IORESOURCE_IRQ,
514 },
515}; 444};
516 445
517static struct platform_device mtu2_0_device = { 446static struct platform_device cmt_device = {
518 .name = "sh_mtu2", 447 .name = "sh-cmt-16",
519 .id = 0, 448 .id = 0,
520 .dev = { 449 .dev = {
521 .platform_data = &mtu2_0_platform_data, 450 .platform_data = &cmt_platform_data,
522 }, 451 },
523 .resource = mtu2_0_resources, 452 .resource = cmt_resources,
524 .num_resources = ARRAY_SIZE(mtu2_0_resources), 453 .num_resources = ARRAY_SIZE(cmt_resources),
525}; 454};
526 455
527static struct sh_timer_config mtu2_1_platform_data = { 456static struct resource mtu2_resources[] = {
528 .name = "MTU2_1", 457 DEFINE_RES_MEM(0xfffe4000, 0x400),
529 .channel_offset = -0x100, 458 DEFINE_RES_IRQ_NAMED(179, "tgi0a"),
530 .timer_bit = 1, 459 DEFINE_RES_IRQ_NAMED(186, "tgi1a"),
531 .clockevent_rating = 200,
532}; 460};
533 461
534static struct resource mtu2_1_resources[] = { 462static struct platform_device mtu2_device = {
535 [0] = { 463 .name = "sh-mtu2",
536 .name = "MTU2_1", 464 .id = -1,
537 .start = 0xfffe4380, 465 .resource = mtu2_resources,
538 .end = 0xfffe4390, 466 .num_resources = ARRAY_SIZE(mtu2_resources),
539 .flags = IORESOURCE_MEM,
540 },
541 [1] = {
542 .start = 186,
543 .flags = IORESOURCE_IRQ,
544 },
545};
546
547static struct platform_device mtu2_1_device = {
548 .name = "sh_mtu2",
549 .id = 1,
550 .dev = {
551 .platform_data = &mtu2_1_platform_data,
552 },
553 .resource = mtu2_1_resources,
554 .num_resources = ARRAY_SIZE(mtu2_1_resources),
555}; 467};
556 468
557static struct resource rtc_resources[] = { 469static struct resource rtc_resources[] = {
@@ -620,10 +532,8 @@ static struct platform_device *sh7264_devices[] __initdata = {
620 &scif5_device, 532 &scif5_device,
621 &scif6_device, 533 &scif6_device,
622 &scif7_device, 534 &scif7_device,
623 &cmt0_device, 535 &cmt_device,
624 &cmt1_device, 536 &mtu2_device,
625 &mtu2_0_device,
626 &mtu2_1_device,
627 &rtc_device, 537 &rtc_device,
628 &r8a66597_usb_host_device, 538 &r8a66597_usb_host_device,
629}; 539};
@@ -649,10 +559,8 @@ static struct platform_device *sh7264_early_devices[] __initdata = {
649 &scif5_device, 559 &scif5_device,
650 &scif6_device, 560 &scif6_device,
651 &scif7_device, 561 &scif7_device,
652 &cmt0_device, 562 &cmt_device,
653 &cmt1_device, 563 &mtu2_device,
654 &mtu2_0_device,
655 &mtu2_1_device,
656}; 564};
657 565
658void __init plat_early_device_setup(void) 566void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7269.c b/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
index 3995119f65dc..16ce5aa77bdd 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
@@ -455,118 +455,37 @@ static struct platform_device scif7_device = {
455 }, 455 },
456}; 456};
457 457
458static struct sh_timer_config cmt0_platform_data = { 458static struct sh_timer_config cmt_platform_data = {
459 .channel_offset = 0x02, 459 .channels_mask = 3,
460 .timer_bit = 0,
461 .clockevent_rating = 125,
462 .clocksource_rating = 0, /* disabled due to code generation issues */
463}; 460};
464 461
465static struct resource cmt0_resources[] = { 462static struct resource cmt_resources[] = {
466 [0] = { 463 DEFINE_RES_MEM(0xfffec000, 0x10),
467 .start = 0xfffec002, 464 DEFINE_RES_IRQ(188),
468 .end = 0xfffec007, 465 DEFINE_RES_IRQ(189),
469 .flags = IORESOURCE_MEM,
470 },
471 [1] = {
472 .start = 188,
473 .flags = IORESOURCE_IRQ,
474 },
475};
476
477static struct platform_device cmt0_device = {
478 .name = "sh_cmt",
479 .id = 0,
480 .dev = {
481 .platform_data = &cmt0_platform_data,
482 },
483 .resource = cmt0_resources,
484 .num_resources = ARRAY_SIZE(cmt0_resources),
485};
486
487static struct sh_timer_config cmt1_platform_data = {
488 .channel_offset = 0x08,
489 .timer_bit = 1,
490 .clockevent_rating = 125,
491 .clocksource_rating = 0, /* disabled due to code generation issues */
492};
493
494static struct resource cmt1_resources[] = {
495 [0] = {
496 .start = 0xfffec008,
497 .end = 0xfffec00d,
498 .flags = IORESOURCE_MEM,
499 },
500 [1] = {
501 .start = 189,
502 .flags = IORESOURCE_IRQ,
503 },
504};
505
506static struct platform_device cmt1_device = {
507 .name = "sh_cmt",
508 .id = 1,
509 .dev = {
510 .platform_data = &cmt1_platform_data,
511 },
512 .resource = cmt1_resources,
513 .num_resources = ARRAY_SIZE(cmt1_resources),
514};
515
516static struct sh_timer_config mtu2_0_platform_data = {
517 .channel_offset = -0x80,
518 .timer_bit = 0,
519 .clockevent_rating = 200,
520};
521
522static struct resource mtu2_0_resources[] = {
523 [0] = {
524 .start = 0xfffe4300,
525 .end = 0xfffe4326,
526 .flags = IORESOURCE_MEM,
527 },
528 [1] = {
529 .start = 192,
530 .flags = IORESOURCE_IRQ,
531 },
532}; 466};
533 467
534static struct platform_device mtu2_0_device = { 468static struct platform_device cmt_device = {
535 .name = "sh_mtu2", 469 .name = "sh-cmt-16",
536 .id = 0, 470 .id = 0,
537 .dev = { 471 .dev = {
538 .platform_data = &mtu2_0_platform_data, 472 .platform_data = &cmt_platform_data,
539 }, 473 },
540 .resource = mtu2_0_resources, 474 .resource = cmt_resources,
541 .num_resources = ARRAY_SIZE(mtu2_0_resources), 475 .num_resources = ARRAY_SIZE(cmt_resources),
542}; 476};
543 477
544static struct sh_timer_config mtu2_1_platform_data = { 478static struct resource mtu2_resources[] = {
545 .channel_offset = -0x100, 479 DEFINE_RES_MEM(0xfffe4000, 0x400),
546 .timer_bit = 1, 480 DEFINE_RES_IRQ_NAMED(192, "tgi0a"),
547 .clockevent_rating = 200, 481 DEFINE_RES_IRQ_NAMED(203, "tgi1a"),
548}; 482};
549 483
550static struct resource mtu2_1_resources[] = { 484static struct platform_device mtu2_device = {
551 [0] = { 485 .name = "sh-mtu2",
552 .start = 0xfffe4380, 486 .id = -1,
553 .end = 0xfffe4390, 487 .resource = mtu2_resources,
554 .flags = IORESOURCE_MEM, 488 .num_resources = ARRAY_SIZE(mtu2_resources),
555 },
556 [1] = {
557 .start = 203,
558 .flags = IORESOURCE_IRQ,
559 },
560};
561
562static struct platform_device mtu2_1_device = {
563 .name = "sh_mtu2",
564 .id = 1,
565 .dev = {
566 .platform_data = &mtu2_1_platform_data,
567 },
568 .resource = mtu2_1_resources,
569 .num_resources = ARRAY_SIZE(mtu2_1_resources),
570}; 489};
571 490
572static struct resource rtc_resources[] = { 491static struct resource rtc_resources[] = {
@@ -629,10 +548,8 @@ static struct platform_device *sh7269_devices[] __initdata = {
629 &scif5_device, 548 &scif5_device,
630 &scif6_device, 549 &scif6_device,
631 &scif7_device, 550 &scif7_device,
632 &cmt0_device, 551 &cmt_device,
633 &cmt1_device, 552 &mtu2_device,
634 &mtu2_0_device,
635 &mtu2_1_device,
636 &rtc_device, 553 &rtc_device,
637 &r8a66597_usb_host_device, 554 &r8a66597_usb_host_device,
638}; 555};
@@ -658,10 +575,8 @@ static struct platform_device *sh7269_early_devices[] __initdata = {
658 &scif5_device, 575 &scif5_device,
659 &scif6_device, 576 &scif6_device,
660 &scif7_device, 577 &scif7_device,
661 &cmt0_device, 578 &cmt_device,
662 &cmt1_device, 579 &mtu2_device,
663 &mtu2_0_device,
664 &mtu2_1_device,
665}; 580};
666 581
667void __init plat_early_device_setup(void) 582void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
index c76b2543b85f..6a72fd14de21 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
@@ -143,25 +143,18 @@ static struct platform_device rtc_device = {
143}; 143};
144 144
145static struct sh_timer_config tmu0_platform_data = { 145static struct sh_timer_config tmu0_platform_data = {
146 .channel_offset = 0x02, 146 .channels_mask = 7,
147 .timer_bit = 0,
148 .clockevent_rating = 200,
149}; 147};
150 148
151static struct resource tmu0_resources[] = { 149static struct resource tmu0_resources[] = {
152 [0] = { 150 DEFINE_RES_MEM(0xfffffe90, 0x2c),
153 .start = 0xfffffe94, 151 DEFINE_RES_IRQ(evt2irq(0x400)),
154 .end = 0xfffffe9f, 152 DEFINE_RES_IRQ(evt2irq(0x420)),
155 .flags = IORESOURCE_MEM, 153 DEFINE_RES_IRQ(evt2irq(0x440)),
156 },
157 [1] = {
158 .start = evt2irq(0x400),
159 .flags = IORESOURCE_IRQ,
160 },
161}; 154};
162 155
163static struct platform_device tmu0_device = { 156static struct platform_device tmu0_device = {
164 .name = "sh_tmu", 157 .name = "sh-tmu-sh3",
165 .id = 0, 158 .id = 0,
166 .dev = { 159 .dev = {
167 .platform_data = &tmu0_platform_data, 160 .platform_data = &tmu0_platform_data,
@@ -170,67 +163,10 @@ static struct platform_device tmu0_device = {
170 .num_resources = ARRAY_SIZE(tmu0_resources), 163 .num_resources = ARRAY_SIZE(tmu0_resources),
171}; 164};
172 165
173static struct sh_timer_config tmu1_platform_data = {
174 .channel_offset = 0xe,
175 .timer_bit = 1,
176 .clocksource_rating = 200,
177};
178
179static struct resource tmu1_resources[] = {
180 [0] = {
181 .start = 0xfffffea0,
182 .end = 0xfffffeab,
183 .flags = IORESOURCE_MEM,
184 },
185 [1] = {
186 .start = evt2irq(0x420),
187 .flags = IORESOURCE_IRQ,
188 },
189};
190
191static struct platform_device tmu1_device = {
192 .name = "sh_tmu",
193 .id = 1,
194 .dev = {
195 .platform_data = &tmu1_platform_data,
196 },
197 .resource = tmu1_resources,
198 .num_resources = ARRAY_SIZE(tmu1_resources),
199};
200
201static struct sh_timer_config tmu2_platform_data = {
202 .channel_offset = 0x1a,
203 .timer_bit = 2,
204};
205
206static struct resource tmu2_resources[] = {
207 [0] = {
208 .start = 0xfffffeac,
209 .end = 0xfffffebb,
210 .flags = IORESOURCE_MEM,
211 },
212 [1] = {
213 .start = evt2irq(0x440),
214 .flags = IORESOURCE_IRQ,
215 },
216};
217
218static struct platform_device tmu2_device = {
219 .name = "sh_tmu",
220 .id = 2,
221 .dev = {
222 .platform_data = &tmu2_platform_data,
223 },
224 .resource = tmu2_resources,
225 .num_resources = ARRAY_SIZE(tmu2_resources),
226};
227
228static struct platform_device *sh7705_devices[] __initdata = { 166static struct platform_device *sh7705_devices[] __initdata = {
229 &scif0_device, 167 &scif0_device,
230 &scif1_device, 168 &scif1_device,
231 &tmu0_device, 169 &tmu0_device,
232 &tmu1_device,
233 &tmu2_device,
234 &rtc_device, 170 &rtc_device,
235}; 171};
236 172
@@ -245,8 +181,6 @@ static struct platform_device *sh7705_early_devices[] __initdata = {
245 &scif0_device, 181 &scif0_device,
246 &scif1_device, 182 &scif1_device,
247 &tmu0_device, 183 &tmu0_device,
248 &tmu1_device,
249 &tmu2_device,
250}; 184};
251 185
252void __init plat_early_device_setup(void) 186void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
index ff1465c0519c..9139d14b9c53 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
@@ -185,25 +185,18 @@ static struct platform_device scif2_device = {
185#endif 185#endif
186 186
187static struct sh_timer_config tmu0_platform_data = { 187static struct sh_timer_config tmu0_platform_data = {
188 .channel_offset = 0x02, 188 .channels_mask = 7,
189 .timer_bit = 0,
190 .clockevent_rating = 200,
191}; 189};
192 190
193static struct resource tmu0_resources[] = { 191static struct resource tmu0_resources[] = {
194 [0] = { 192 DEFINE_RES_MEM(0xfffffe90, 0x2c),
195 .start = 0xfffffe94, 193 DEFINE_RES_IRQ(evt2irq(0x400)),
196 .end = 0xfffffe9f, 194 DEFINE_RES_IRQ(evt2irq(0x420)),
197 .flags = IORESOURCE_MEM, 195 DEFINE_RES_IRQ(evt2irq(0x440)),
198 },
199 [1] = {
200 .start = evt2irq(0x400),
201 .flags = IORESOURCE_IRQ,
202 },
203}; 196};
204 197
205static struct platform_device tmu0_device = { 198static struct platform_device tmu0_device = {
206 .name = "sh_tmu", 199 .name = "sh-tmu-sh3",
207 .id = 0, 200 .id = 0,
208 .dev = { 201 .dev = {
209 .platform_data = &tmu0_platform_data, 202 .platform_data = &tmu0_platform_data,
@@ -212,61 +205,6 @@ static struct platform_device tmu0_device = {
212 .num_resources = ARRAY_SIZE(tmu0_resources), 205 .num_resources = ARRAY_SIZE(tmu0_resources),
213}; 206};
214 207
215static struct sh_timer_config tmu1_platform_data = {
216 .channel_offset = 0xe,
217 .timer_bit = 1,
218 .clocksource_rating = 200,
219};
220
221static struct resource tmu1_resources[] = {
222 [0] = {
223 .start = 0xfffffea0,
224 .end = 0xfffffeab,
225 .flags = IORESOURCE_MEM,
226 },
227 [1] = {
228 .start = evt2irq(0x420),
229 .flags = IORESOURCE_IRQ,
230 },
231};
232
233static struct platform_device tmu1_device = {
234 .name = "sh_tmu",
235 .id = 1,
236 .dev = {
237 .platform_data = &tmu1_platform_data,
238 },
239 .resource = tmu1_resources,
240 .num_resources = ARRAY_SIZE(tmu1_resources),
241};
242
243static struct sh_timer_config tmu2_platform_data = {
244 .channel_offset = 0x1a,
245 .timer_bit = 2,
246};
247
248static struct resource tmu2_resources[] = {
249 [0] = {
250 .start = 0xfffffeac,
251 .end = 0xfffffebb,
252 .flags = IORESOURCE_MEM,
253 },
254 [1] = {
255 .start = evt2irq(0x440),
256 .flags = IORESOURCE_IRQ,
257 },
258};
259
260static struct platform_device tmu2_device = {
261 .name = "sh_tmu",
262 .id = 2,
263 .dev = {
264 .platform_data = &tmu2_platform_data,
265 },
266 .resource = tmu2_resources,
267 .num_resources = ARRAY_SIZE(tmu2_resources),
268};
269
270static struct platform_device *sh770x_devices[] __initdata = { 208static struct platform_device *sh770x_devices[] __initdata = {
271 &scif0_device, 209 &scif0_device,
272#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ 210#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
@@ -279,8 +217,6 @@ static struct platform_device *sh770x_devices[] __initdata = {
279 &scif2_device, 217 &scif2_device,
280#endif 218#endif
281 &tmu0_device, 219 &tmu0_device,
282 &tmu1_device,
283 &tmu2_device,
284 &rtc_device, 220 &rtc_device,
285}; 221};
286 222
@@ -303,8 +239,6 @@ static struct platform_device *sh770x_early_devices[] __initdata = {
303 &scif2_device, 239 &scif2_device,
304#endif 240#endif
305 &tmu0_device, 241 &tmu0_device,
306 &tmu1_device,
307 &tmu2_device,
308}; 242};
309 243
310void __init plat_early_device_setup(void) 244void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
index e2ce9360ed5a..e9ed300dba5c 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
@@ -142,25 +142,18 @@ static struct platform_device scif1_device = {
142}; 142};
143 143
144static struct sh_timer_config tmu0_platform_data = { 144static struct sh_timer_config tmu0_platform_data = {
145 .channel_offset = 0x02, 145 .channels_mask = 7,
146 .timer_bit = 0,
147 .clockevent_rating = 200,
148}; 146};
149 147
150static struct resource tmu0_resources[] = { 148static struct resource tmu0_resources[] = {
151 [0] = { 149 DEFINE_RES_MEM(0xa412fe90, 0x28),
152 .start = 0xa412fe94, 150 DEFINE_RES_IRQ(evt2irq(0x400)),
153 .end = 0xa412fe9f, 151 DEFINE_RES_IRQ(evt2irq(0x420)),
154 .flags = IORESOURCE_MEM, 152 DEFINE_RES_IRQ(evt2irq(0x440)),
155 },
156 [1] = {
157 .start = evt2irq(0x400),
158 .flags = IORESOURCE_IRQ,
159 },
160}; 153};
161 154
162static struct platform_device tmu0_device = { 155static struct platform_device tmu0_device = {
163 .name = "sh_tmu", 156 .name = "sh-tmu-sh3",
164 .id = 0, 157 .id = 0,
165 .dev = { 158 .dev = {
166 .platform_data = &tmu0_platform_data, 159 .platform_data = &tmu0_platform_data,
@@ -169,67 +162,10 @@ static struct platform_device tmu0_device = {
169 .num_resources = ARRAY_SIZE(tmu0_resources), 162 .num_resources = ARRAY_SIZE(tmu0_resources),
170}; 163};
171 164
172static struct sh_timer_config tmu1_platform_data = {
173 .channel_offset = 0xe,
174 .timer_bit = 1,
175 .clocksource_rating = 200,
176};
177
178static struct resource tmu1_resources[] = {
179 [0] = {
180 .start = 0xa412fea0,
181 .end = 0xa412feab,
182 .flags = IORESOURCE_MEM,
183 },
184 [1] = {
185 .start = evt2irq(0x420),
186 .flags = IORESOURCE_IRQ,
187 },
188};
189
190static struct platform_device tmu1_device = {
191 .name = "sh_tmu",
192 .id = 1,
193 .dev = {
194 .platform_data = &tmu1_platform_data,
195 },
196 .resource = tmu1_resources,
197 .num_resources = ARRAY_SIZE(tmu1_resources),
198};
199
200static struct sh_timer_config tmu2_platform_data = {
201 .channel_offset = 0x1a,
202 .timer_bit = 2,
203};
204
205static struct resource tmu2_resources[] = {
206 [0] = {
207 .start = 0xa412feac,
208 .end = 0xa412feb5,
209 .flags = IORESOURCE_MEM,
210 },
211 [1] = {
212 .start = evt2irq(0x440),
213 .flags = IORESOURCE_IRQ,
214 },
215};
216
217static struct platform_device tmu2_device = {
218 .name = "sh_tmu",
219 .id = 2,
220 .dev = {
221 .platform_data = &tmu2_platform_data,
222 },
223 .resource = tmu2_resources,
224 .num_resources = ARRAY_SIZE(tmu2_resources),
225};
226
227static struct platform_device *sh7710_devices[] __initdata = { 165static struct platform_device *sh7710_devices[] __initdata = {
228 &scif0_device, 166 &scif0_device,
229 &scif1_device, 167 &scif1_device,
230 &tmu0_device, 168 &tmu0_device,
231 &tmu1_device,
232 &tmu2_device,
233 &rtc_device, 169 &rtc_device,
234}; 170};
235 171
@@ -244,8 +180,6 @@ static struct platform_device *sh7710_early_devices[] __initdata = {
244 &scif0_device, 180 &scif0_device,
245 &scif1_device, 181 &scif1_device,
246 &tmu0_device, 182 &tmu0_device,
247 &tmu1_device,
248 &tmu2_device,
249}; 183};
250 184
251void __init plat_early_device_setup(void) 185void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
index 1d5729dc0724..84df85a5b800 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
@@ -152,163 +152,38 @@ static struct platform_device usbf_device = {
152 .resource = usbf_resources, 152 .resource = usbf_resources,
153}; 153};
154 154
155static struct sh_timer_config cmt0_platform_data = { 155static struct sh_timer_config cmt_platform_data = {
156 .channel_offset = 0x10, 156 .channels_mask = 0x1f,
157 .timer_bit = 0,
158 .clockevent_rating = 125,
159 .clocksource_rating = 125,
160}; 157};
161 158
162static struct resource cmt0_resources[] = { 159static struct resource cmt_resources[] = {
163 [0] = { 160 DEFINE_RES_MEM(0x044a0000, 0x60),
164 .start = 0x044a0010, 161 DEFINE_RES_IRQ(evt2irq(0xf00)),
165 .end = 0x044a001b,
166 .flags = IORESOURCE_MEM,
167 },
168 [1] = {
169 .start = evt2irq(0xf00),
170 .flags = IORESOURCE_IRQ,
171 },
172}; 162};
173 163
174static struct platform_device cmt0_device = { 164static struct platform_device cmt_device = {
175 .name = "sh_cmt", 165 .name = "sh-cmt-32",
176 .id = 0, 166 .id = 0,
177 .dev = { 167 .dev = {
178 .platform_data = &cmt0_platform_data, 168 .platform_data = &cmt_platform_data,
179 },
180 .resource = cmt0_resources,
181 .num_resources = ARRAY_SIZE(cmt0_resources),
182};
183
184static struct sh_timer_config cmt1_platform_data = {
185 .channel_offset = 0x20,
186 .timer_bit = 1,
187};
188
189static struct resource cmt1_resources[] = {
190 [0] = {
191 .start = 0x044a0020,
192 .end = 0x044a002b,
193 .flags = IORESOURCE_MEM,
194 },
195 [1] = {
196 .start = evt2irq(0xf00),
197 .flags = IORESOURCE_IRQ,
198 },
199};
200
201static struct platform_device cmt1_device = {
202 .name = "sh_cmt",
203 .id = 1,
204 .dev = {
205 .platform_data = &cmt1_platform_data,
206 },
207 .resource = cmt1_resources,
208 .num_resources = ARRAY_SIZE(cmt1_resources),
209};
210
211static struct sh_timer_config cmt2_platform_data = {
212 .channel_offset = 0x30,
213 .timer_bit = 2,
214};
215
216static struct resource cmt2_resources[] = {
217 [0] = {
218 .start = 0x044a0030,
219 .end = 0x044a003b,
220 .flags = IORESOURCE_MEM,
221 },
222 [1] = {
223 .start = evt2irq(0xf00),
224 .flags = IORESOURCE_IRQ,
225 },
226};
227
228static struct platform_device cmt2_device = {
229 .name = "sh_cmt",
230 .id = 2,
231 .dev = {
232 .platform_data = &cmt2_platform_data,
233 },
234 .resource = cmt2_resources,
235 .num_resources = ARRAY_SIZE(cmt2_resources),
236};
237
238static struct sh_timer_config cmt3_platform_data = {
239 .channel_offset = 0x40,
240 .timer_bit = 3,
241};
242
243static struct resource cmt3_resources[] = {
244 [0] = {
245 .start = 0x044a0040,
246 .end = 0x044a004b,
247 .flags = IORESOURCE_MEM,
248 },
249 [1] = {
250 .start = evt2irq(0xf00),
251 .flags = IORESOURCE_IRQ,
252 },
253};
254
255static struct platform_device cmt3_device = {
256 .name = "sh_cmt",
257 .id = 3,
258 .dev = {
259 .platform_data = &cmt3_platform_data,
260 }, 169 },
261 .resource = cmt3_resources, 170 .resource = cmt_resources,
262 .num_resources = ARRAY_SIZE(cmt3_resources), 171 .num_resources = ARRAY_SIZE(cmt_resources),
263};
264
265static struct sh_timer_config cmt4_platform_data = {
266 .channel_offset = 0x50,
267 .timer_bit = 4,
268};
269
270static struct resource cmt4_resources[] = {
271 [0] = {
272 .start = 0x044a0050,
273 .end = 0x044a005b,
274 .flags = IORESOURCE_MEM,
275 },
276 [1] = {
277 .start = evt2irq(0xf00),
278 .flags = IORESOURCE_IRQ,
279 },
280};
281
282static struct platform_device cmt4_device = {
283 .name = "sh_cmt",
284 .id = 4,
285 .dev = {
286 .platform_data = &cmt4_platform_data,
287 },
288 .resource = cmt4_resources,
289 .num_resources = ARRAY_SIZE(cmt4_resources),
290}; 172};
291 173
292static struct sh_timer_config tmu0_platform_data = { 174static struct sh_timer_config tmu0_platform_data = {
293 .channel_offset = 0x02, 175 .channels_mask = 7,
294 .timer_bit = 0,
295 .clockevent_rating = 200,
296}; 176};
297 177
298static struct resource tmu0_resources[] = { 178static struct resource tmu0_resources[] = {
299 [0] = { 179 DEFINE_RES_MEM(0xa412fe90, 0x28),
300 .start = 0xa412fe94, 180 DEFINE_RES_IRQ(evt2irq(0x400)),
301 .end = 0xa412fe9f, 181 DEFINE_RES_IRQ(evt2irq(0x420)),
302 .flags = IORESOURCE_MEM, 182 DEFINE_RES_IRQ(evt2irq(0x440)),
303 },
304 [1] = {
305 .start = evt2irq(0x400),
306 .flags = IORESOURCE_IRQ,
307 },
308}; 183};
309 184
310static struct platform_device tmu0_device = { 185static struct platform_device tmu0_device = {
311 .name = "sh_tmu", 186 .name = "sh-tmu-sh3",
312 .id = 0, 187 .id = 0,
313 .dev = { 188 .dev = {
314 .platform_data = &tmu0_platform_data, 189 .platform_data = &tmu0_platform_data,
@@ -317,72 +192,11 @@ static struct platform_device tmu0_device = {
317 .num_resources = ARRAY_SIZE(tmu0_resources), 192 .num_resources = ARRAY_SIZE(tmu0_resources),
318}; 193};
319 194
320static struct sh_timer_config tmu1_platform_data = {
321 .channel_offset = 0xe,
322 .timer_bit = 1,
323 .clocksource_rating = 200,
324};
325
326static struct resource tmu1_resources[] = {
327 [0] = {
328 .start = 0xa412fea0,
329 .end = 0xa412feab,
330 .flags = IORESOURCE_MEM,
331 },
332 [1] = {
333 .start = evt2irq(0x420),
334 .flags = IORESOURCE_IRQ,
335 },
336};
337
338static struct platform_device tmu1_device = {
339 .name = "sh_tmu",
340 .id = 1,
341 .dev = {
342 .platform_data = &tmu1_platform_data,
343 },
344 .resource = tmu1_resources,
345 .num_resources = ARRAY_SIZE(tmu1_resources),
346};
347
348static struct sh_timer_config tmu2_platform_data = {
349 .channel_offset = 0x1a,
350 .timer_bit = 2,
351};
352
353static struct resource tmu2_resources[] = {
354 [0] = {
355 .start = 0xa412feac,
356 .end = 0xa412feb5,
357 .flags = IORESOURCE_MEM,
358 },
359 [1] = {
360 .start = evt2irq(0x440),
361 .flags = IORESOURCE_IRQ,
362 },
363};
364
365static struct platform_device tmu2_device = {
366 .name = "sh_tmu",
367 .id = 2,
368 .dev = {
369 .platform_data = &tmu2_platform_data,
370 },
371 .resource = tmu2_resources,
372 .num_resources = ARRAY_SIZE(tmu2_resources),
373};
374
375static struct platform_device *sh7720_devices[] __initdata = { 195static struct platform_device *sh7720_devices[] __initdata = {
376 &scif0_device, 196 &scif0_device,
377 &scif1_device, 197 &scif1_device,
378 &cmt0_device, 198 &cmt_device,
379 &cmt1_device,
380 &cmt2_device,
381 &cmt3_device,
382 &cmt4_device,
383 &tmu0_device, 199 &tmu0_device,
384 &tmu1_device,
385 &tmu2_device,
386 &rtc_device, 200 &rtc_device,
387 &usb_ohci_device, 201 &usb_ohci_device,
388 &usbf_device, 202 &usbf_device,
@@ -398,14 +212,8 @@ arch_initcall(sh7720_devices_setup);
398static struct platform_device *sh7720_early_devices[] __initdata = { 212static struct platform_device *sh7720_early_devices[] __initdata = {
399 &scif0_device, 213 &scif0_device,
400 &scif1_device, 214 &scif1_device,
401 &cmt0_device, 215 &cmt_device,
402 &cmt1_device,
403 &cmt2_device,
404 &cmt3_device,
405 &cmt4_device,
406 &tmu0_device, 216 &tmu0_device,
407 &tmu1_device,
408 &tmu2_device,
409}; 217};
410 218
411void __init plat_early_device_setup(void) 219void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
index a8bd778d5ac8..e7a7b3cdf68d 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
@@ -41,25 +41,18 @@ static struct platform_device scif0_device = {
41}; 41};
42 42
43static struct sh_timer_config tmu0_platform_data = { 43static struct sh_timer_config tmu0_platform_data = {
44 .channel_offset = 0x04, 44 .channels_mask = 7,
45 .timer_bit = 0,
46 .clockevent_rating = 200,
47}; 45};
48 46
49static struct resource tmu0_resources[] = { 47static struct resource tmu0_resources[] = {
50 [0] = { 48 DEFINE_RES_MEM(0xffd80000, 0x30),
51 .start = 0xffd80008, 49 DEFINE_RES_IRQ(evt2irq(0x400)),
52 .end = 0xffd80013, 50 DEFINE_RES_IRQ(evt2irq(0x420)),
53 .flags = IORESOURCE_MEM, 51 DEFINE_RES_IRQ(evt2irq(0x440)),
54 },
55 [1] = {
56 .start = evt2irq(0x400),
57 .flags = IORESOURCE_IRQ,
58 },
59}; 52};
60 53
61static struct platform_device tmu0_device = { 54static struct platform_device tmu0_device = {
62 .name = "sh_tmu", 55 .name = "sh-tmu",
63 .id = 0, 56 .id = 0,
64 .dev = { 57 .dev = {
65 .platform_data = &tmu0_platform_data, 58 .platform_data = &tmu0_platform_data,
@@ -68,66 +61,9 @@ static struct platform_device tmu0_device = {
68 .num_resources = ARRAY_SIZE(tmu0_resources), 61 .num_resources = ARRAY_SIZE(tmu0_resources),
69}; 62};
70 63
71static struct sh_timer_config tmu1_platform_data = {
72 .channel_offset = 0x10,
73 .timer_bit = 1,
74 .clocksource_rating = 200,
75};
76
77static struct resource tmu1_resources[] = {
78 [0] = {
79 .start = 0xffd80014,
80 .end = 0xffd8001f,
81 .flags = IORESOURCE_MEM,
82 },
83 [1] = {
84 .start = evt2irq(0x420),
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89static struct platform_device tmu1_device = {
90 .name = "sh_tmu",
91 .id = 1,
92 .dev = {
93 .platform_data = &tmu1_platform_data,
94 },
95 .resource = tmu1_resources,
96 .num_resources = ARRAY_SIZE(tmu1_resources),
97};
98
99static struct sh_timer_config tmu2_platform_data = {
100 .channel_offset = 0x1c,
101 .timer_bit = 2,
102};
103
104static struct resource tmu2_resources[] = {
105 [0] = {
106 .start = 0xffd80020,
107 .end = 0xffd8002f,
108 .flags = IORESOURCE_MEM,
109 },
110 [1] = {
111 .start = evt2irq(0x440),
112 .flags = IORESOURCE_IRQ,
113 },
114};
115
116static struct platform_device tmu2_device = {
117 .name = "sh_tmu",
118 .id = 2,
119 .dev = {
120 .platform_data = &tmu2_platform_data,
121 },
122 .resource = tmu2_resources,
123 .num_resources = ARRAY_SIZE(tmu2_resources),
124};
125
126static struct platform_device *sh4202_devices[] __initdata = { 64static struct platform_device *sh4202_devices[] __initdata = {
127 &scif0_device, 65 &scif0_device,
128 &tmu0_device, 66 &tmu0_device,
129 &tmu1_device,
130 &tmu2_device,
131}; 67};
132 68
133static int __init sh4202_devices_setup(void) 69static int __init sh4202_devices_setup(void)
@@ -140,8 +76,6 @@ arch_initcall(sh4202_devices_setup);
140static struct platform_device *sh4202_early_devices[] __initdata = { 76static struct platform_device *sh4202_early_devices[] __initdata = {
141 &scif0_device, 77 &scif0_device,
142 &tmu0_device, 78 &tmu0_device,
143 &tmu1_device,
144 &tmu2_device,
145}; 79};
146 80
147void __init plat_early_device_setup(void) 81void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
index a447a248491f..5f08c59b9f3e 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
@@ -82,25 +82,18 @@ static struct platform_device scif_device = {
82}; 82};
83 83
84static struct sh_timer_config tmu0_platform_data = { 84static struct sh_timer_config tmu0_platform_data = {
85 .channel_offset = 0x04, 85 .channels_mask = 7,
86 .timer_bit = 0,
87 .clockevent_rating = 200,
88}; 86};
89 87
90static struct resource tmu0_resources[] = { 88static struct resource tmu0_resources[] = {
91 [0] = { 89 DEFINE_RES_MEM(0xffd80000, 0x30),
92 .start = 0xffd80008, 90 DEFINE_RES_IRQ(evt2irq(0x400)),
93 .end = 0xffd80013, 91 DEFINE_RES_IRQ(evt2irq(0x420)),
94 .flags = IORESOURCE_MEM, 92 DEFINE_RES_IRQ(evt2irq(0x440)),
95 },
96 [1] = {
97 .start = evt2irq(0x400),
98 .flags = IORESOURCE_IRQ,
99 },
100}; 93};
101 94
102static struct platform_device tmu0_device = { 95static struct platform_device tmu0_device = {
103 .name = "sh_tmu", 96 .name = "sh-tmu",
104 .id = 0, 97 .id = 0,
105 .dev = { 98 .dev = {
106 .platform_data = &tmu0_platform_data, 99 .platform_data = &tmu0_platform_data,
@@ -109,26 +102,23 @@ static struct platform_device tmu0_device = {
109 .num_resources = ARRAY_SIZE(tmu0_resources), 102 .num_resources = ARRAY_SIZE(tmu0_resources),
110}; 103};
111 104
105/* SH7750R, SH7751 and SH7751R all have two extra timer channels */
106#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
107 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
108 defined(CONFIG_CPU_SUBTYPE_SH7751R)
109
112static struct sh_timer_config tmu1_platform_data = { 110static struct sh_timer_config tmu1_platform_data = {
113 .channel_offset = 0x10, 111 .channels_mask = 3,
114 .timer_bit = 1,
115 .clocksource_rating = 200,
116}; 112};
117 113
118static struct resource tmu1_resources[] = { 114static struct resource tmu1_resources[] = {
119 [0] = { 115 DEFINE_RES_MEM(0xfe100000, 0x20),
120 .start = 0xffd80014, 116 DEFINE_RES_IRQ(evt2irq(0xb00)),
121 .end = 0xffd8001f, 117 DEFINE_RES_IRQ(evt2irq(0xb80)),
122 .flags = IORESOURCE_MEM,
123 },
124 [1] = {
125 .start = evt2irq(0x420),
126 .flags = IORESOURCE_IRQ,
127 },
128}; 118};
129 119
130static struct platform_device tmu1_device = { 120static struct platform_device tmu1_device = {
131 .name = "sh_tmu", 121 .name = "sh-tmu",
132 .id = 1, 122 .id = 1,
133 .dev = { 123 .dev = {
134 .platform_data = &tmu1_platform_data, 124 .platform_data = &tmu1_platform_data,
@@ -137,104 +127,15 @@ static struct platform_device tmu1_device = {
137 .num_resources = ARRAY_SIZE(tmu1_resources), 127 .num_resources = ARRAY_SIZE(tmu1_resources),
138}; 128};
139 129
140static struct sh_timer_config tmu2_platform_data = {
141 .channel_offset = 0x1c,
142 .timer_bit = 2,
143};
144
145static struct resource tmu2_resources[] = {
146 [0] = {
147 .start = 0xffd80020,
148 .end = 0xffd8002f,
149 .flags = IORESOURCE_MEM,
150 },
151 [1] = {
152 .start = evt2irq(0x440),
153 .flags = IORESOURCE_IRQ,
154 },
155};
156
157static struct platform_device tmu2_device = {
158 .name = "sh_tmu",
159 .id = 2,
160 .dev = {
161 .platform_data = &tmu2_platform_data,
162 },
163 .resource = tmu2_resources,
164 .num_resources = ARRAY_SIZE(tmu2_resources),
165};
166
167/* SH7750R, SH7751 and SH7751R all have two extra timer channels */
168#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
169 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
170 defined(CONFIG_CPU_SUBTYPE_SH7751R)
171
172static struct sh_timer_config tmu3_platform_data = {
173 .channel_offset = 0x04,
174 .timer_bit = 0,
175};
176
177static struct resource tmu3_resources[] = {
178 [0] = {
179 .start = 0xfe100008,
180 .end = 0xfe100013,
181 .flags = IORESOURCE_MEM,
182 },
183 [1] = {
184 .start = evt2irq(0xb00),
185 .flags = IORESOURCE_IRQ,
186 },
187};
188
189static struct platform_device tmu3_device = {
190 .name = "sh_tmu",
191 .id = 3,
192 .dev = {
193 .platform_data = &tmu3_platform_data,
194 },
195 .resource = tmu3_resources,
196 .num_resources = ARRAY_SIZE(tmu3_resources),
197};
198
199static struct sh_timer_config tmu4_platform_data = {
200 .channel_offset = 0x10,
201 .timer_bit = 1,
202};
203
204static struct resource tmu4_resources[] = {
205 [0] = {
206 .start = 0xfe100014,
207 .end = 0xfe10001f,
208 .flags = IORESOURCE_MEM,
209 },
210 [1] = {
211 .start = evt2irq(0xb80),
212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct platform_device tmu4_device = {
217 .name = "sh_tmu",
218 .id = 4,
219 .dev = {
220 .platform_data = &tmu4_platform_data,
221 },
222 .resource = tmu4_resources,
223 .num_resources = ARRAY_SIZE(tmu4_resources),
224};
225
226#endif 130#endif
227 131
228static struct platform_device *sh7750_devices[] __initdata = { 132static struct platform_device *sh7750_devices[] __initdata = {
229 &rtc_device, 133 &rtc_device,
230 &tmu0_device, 134 &tmu0_device,
231 &tmu1_device,
232 &tmu2_device,
233#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ 135#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
234 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 136 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
235 defined(CONFIG_CPU_SUBTYPE_SH7751R) 137 defined(CONFIG_CPU_SUBTYPE_SH7751R)
236 &tmu3_device, 138 &tmu1_device,
237 &tmu4_device,
238#endif 139#endif
239}; 140};
240 141
@@ -254,13 +155,10 @@ arch_initcall(sh7750_devices_setup);
254 155
255static struct platform_device *sh7750_early_devices[] __initdata = { 156static struct platform_device *sh7750_early_devices[] __initdata = {
256 &tmu0_device, 157 &tmu0_device,
257 &tmu1_device,
258 &tmu2_device,
259#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ 158#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
260 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 159 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
261 defined(CONFIG_CPU_SUBTYPE_SH7751R) 160 defined(CONFIG_CPU_SUBTYPE_SH7751R)
262 &tmu3_device, 161 &tmu1_device,
263 &tmu4_device,
264#endif 162#endif
265}; 163};
266 164
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
index 1abd9fb4a386..973b736b3b98 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
@@ -227,25 +227,18 @@ static struct platform_device scif3_device = {
227}; 227};
228 228
229static struct sh_timer_config tmu0_platform_data = { 229static struct sh_timer_config tmu0_platform_data = {
230 .channel_offset = 0x04, 230 .channels_mask = 7,
231 .timer_bit = 0,
232 .clockevent_rating = 200,
233}; 231};
234 232
235static struct resource tmu0_resources[] = { 233static struct resource tmu0_resources[] = {
236 [0] = { 234 DEFINE_RES_MEM(0xffd80000, 0x30),
237 .start = 0xffd80008, 235 DEFINE_RES_IRQ(evt2irq(0x400)),
238 .end = 0xffd80013, 236 DEFINE_RES_IRQ(evt2irq(0x420)),
239 .flags = IORESOURCE_MEM, 237 DEFINE_RES_IRQ(evt2irq(0x440)),
240 },
241 [1] = {
242 .start = evt2irq(0x400),
243 .flags = IORESOURCE_IRQ,
244 },
245}; 238};
246 239
247static struct platform_device tmu0_device = { 240static struct platform_device tmu0_device = {
248 .name = "sh_tmu", 241 .name = "sh-tmu",
249 .id = 0, 242 .id = 0,
250 .dev = { 243 .dev = {
251 .platform_data = &tmu0_platform_data, 244 .platform_data = &tmu0_platform_data,
@@ -254,61 +247,6 @@ static struct platform_device tmu0_device = {
254 .num_resources = ARRAY_SIZE(tmu0_resources), 247 .num_resources = ARRAY_SIZE(tmu0_resources),
255}; 248};
256 249
257static struct sh_timer_config tmu1_platform_data = {
258 .channel_offset = 0x10,
259 .timer_bit = 1,
260 .clocksource_rating = 200,
261};
262
263static struct resource tmu1_resources[] = {
264 [0] = {
265 .start = 0xffd80014,
266 .end = 0xffd8001f,
267 .flags = IORESOURCE_MEM,
268 },
269 [1] = {
270 .start = evt2irq(0x420),
271 .flags = IORESOURCE_IRQ,
272 },
273};
274
275static struct platform_device tmu1_device = {
276 .name = "sh_tmu",
277 .id = 1,
278 .dev = {
279 .platform_data = &tmu1_platform_data,
280 },
281 .resource = tmu1_resources,
282 .num_resources = ARRAY_SIZE(tmu1_resources),
283};
284
285static struct sh_timer_config tmu2_platform_data = {
286 .channel_offset = 0x1c,
287 .timer_bit = 2,
288};
289
290static struct resource tmu2_resources[] = {
291 [0] = {
292 .start = 0xffd80020,
293 .end = 0xffd8002f,
294 .flags = IORESOURCE_MEM,
295 },
296 [1] = {
297 .start = evt2irq(0x440),
298 .flags = IORESOURCE_IRQ,
299 },
300};
301
302static struct platform_device tmu2_device = {
303 .name = "sh_tmu",
304 .id = 2,
305 .dev = {
306 .platform_data = &tmu2_platform_data,
307 },
308 .resource = tmu2_resources,
309 .num_resources = ARRAY_SIZE(tmu2_resources),
310};
311
312 250
313static struct platform_device *sh7760_devices[] __initdata = { 251static struct platform_device *sh7760_devices[] __initdata = {
314 &scif0_device, 252 &scif0_device,
@@ -316,8 +254,6 @@ static struct platform_device *sh7760_devices[] __initdata = {
316 &scif2_device, 254 &scif2_device,
317 &scif3_device, 255 &scif3_device,
318 &tmu0_device, 256 &tmu0_device,
319 &tmu1_device,
320 &tmu2_device,
321}; 257};
322 258
323static int __init sh7760_devices_setup(void) 259static int __init sh7760_devices_setup(void)
@@ -333,8 +269,6 @@ static struct platform_device *sh7760_early_devices[] __initdata = {
333 &scif2_device, 269 &scif2_device,
334 &scif3_device, 270 &scif3_device,
335 &tmu0_device, 271 &tmu0_device,
336 &tmu1_device,
337 &tmu2_device,
338}; 272};
339 273
340void __init plat_early_device_setup(void) 274void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
index 53638e231cd0..9edc06c02dcf 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
@@ -227,7 +227,7 @@ static struct clk_lookup lookups[] = {
227 CLKDEV_CON_ID("hudi0", &mstp_clks[MSTP019]), 227 CLKDEV_CON_ID("hudi0", &mstp_clks[MSTP019]),
228 CLKDEV_CON_ID("ubc0", &mstp_clks[MSTP017]), 228 CLKDEV_CON_ID("ubc0", &mstp_clks[MSTP017]),
229 CLKDEV_CON_ID("tmu_fck", &mstp_clks[MSTP015]), 229 CLKDEV_CON_ID("tmu_fck", &mstp_clks[MSTP015]),
230 CLKDEV_CON_ID("cmt_fck", &mstp_clks[MSTP014]), 230 CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[MSTP014]),
231 CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]), 231 CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]),
232 CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]), 232 CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]),
233 CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]), 233 CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
index 22e485d1990b..955b9add7810 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
@@ -225,7 +225,7 @@ static struct clk_lookup lookups[] = {
225 CLKDEV_CON_ID("hudi0", &mstp_clks[MSTP019]), 225 CLKDEV_CON_ID("hudi0", &mstp_clks[MSTP019]),
226 CLKDEV_CON_ID("ubc0", &mstp_clks[MSTP017]), 226 CLKDEV_CON_ID("ubc0", &mstp_clks[MSTP017]),
227 CLKDEV_CON_ID("tmu_fck", &mstp_clks[MSTP015]), 227 CLKDEV_CON_ID("tmu_fck", &mstp_clks[MSTP015]),
228 CLKDEV_CON_ID("cmt_fck", &mstp_clks[MSTP014]), 228 CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[MSTP014]),
229 CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]), 229 CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]),
230 CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]), 230 CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]),
231 CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]), 231 CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index c4cb740e4d10..8f07a1a38692 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -203,11 +203,9 @@ static struct clk_lookup lookups[] = {
203 CLKDEV_CON_ID("uram0", &mstp_clks[HWBLK_URAM]), 203 CLKDEV_CON_ID("uram0", &mstp_clks[HWBLK_URAM]),
204 CLKDEV_CON_ID("xymem0", &mstp_clks[HWBLK_XYMEM]), 204 CLKDEV_CON_ID("xymem0", &mstp_clks[HWBLK_XYMEM]),
205 205
206 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU]), 206 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[HWBLK_TMU]),
207 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU]),
208 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU]),
209 207
210 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), 208 CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[HWBLK_CMT]),
211 CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]), 209 CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
212 CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]), 210 CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]),
213 211
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
index 37c41c7747a3..ccbcab550df2 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
@@ -236,7 +236,7 @@ static struct clk_lookup lookups[] = {
236 CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]), 236 CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]),
237 CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]), 237 CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]),
238 CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]), 238 CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]),
239 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), 239 CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[HWBLK_CMT]),
240 CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]), 240 CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
241 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]), 241 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]),
242 CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]), 242 CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]),
@@ -264,12 +264,8 @@ static struct clk_lookup lookups[] = {
264 CLKDEV_CON_ID("veu0", &mstp_clks[HWBLK_VEU2H0]), 264 CLKDEV_CON_ID("veu0", &mstp_clks[HWBLK_VEU2H0]),
265 CLKDEV_CON_ID("vpu0", &mstp_clks[HWBLK_VPU]), 265 CLKDEV_CON_ID("vpu0", &mstp_clks[HWBLK_VPU]),
266 266
267 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU0]), 267 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[HWBLK_TMU0]),
268 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU0]), 268 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[HWBLK_TMU1]),
269 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU0]),
270 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[HWBLK_TMU1]),
271 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[HWBLK_TMU1]),
272 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[HWBLK_TMU1]),
273 269
274 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[HWBLK_SCIF0]), 270 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[HWBLK_SCIF0]),
275 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[HWBLK_SCIF1]), 271 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[HWBLK_SCIF1]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 0128af3399b7..f579dd528198 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -304,17 +304,13 @@ static struct clk_lookup lookups[] = {
304 CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]), 304 CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]),
305 CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]), 305 CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]),
306 306
307 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU0]), 307 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[HWBLK_TMU0]),
308 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU0]), 308 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[HWBLK_TMU1]),
309 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU0]),
310 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[HWBLK_TMU1]),
311 309
312 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]), 310 CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[HWBLK_CMT]),
313 CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]), 311 CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
314 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]), 312 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]),
315 313
316 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[HWBLK_TMU1]),
317 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[HWBLK_TMU1]),
318 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[HWBLK_SCIF0]), 314 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[HWBLK_SCIF0]),
319 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[HWBLK_SCIF1]), 315 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[HWBLK_SCIF1]),
320 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[HWBLK_SCIF2]), 316 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[HWBLK_SCIF2]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7734.c b/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
index ed9501519ab3..1fdf1ee672de 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
@@ -201,15 +201,9 @@ static struct clk_lookup lookups[] = {
201 CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP022]), 201 CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP022]),
202 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP021]), 202 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP021]),
203 CLKDEV_CON_ID("hscif", &mstp_clks[MSTP019]), 203 CLKDEV_CON_ID("hscif", &mstp_clks[MSTP019]),
204 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP016]), 204 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]),
205 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP016]), 205 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP015]),
206 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP016]), 206 CLKDEV_ICK_ID("fck", "sh-tmu.2", &mstp_clks[MSTP014]),
207 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP015]),
208 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP015]),
209 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP015]),
210 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.6", &mstp_clks[MSTP014]),
211 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.7", &mstp_clks[MSTP014]),
212 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.8", &mstp_clks[MSTP014]),
213 CLKDEV_CON_ID("ssi0", &mstp_clks[MSTP012]), 207 CLKDEV_CON_ID("ssi0", &mstp_clks[MSTP012]),
214 CLKDEV_CON_ID("ssi1", &mstp_clks[MSTP011]), 208 CLKDEV_CON_ID("ssi1", &mstp_clks[MSTP011]),
215 CLKDEV_CON_ID("ssi2", &mstp_clks[MSTP010]), 209 CLKDEV_CON_ID("ssi2", &mstp_clks[MSTP010]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
index 5c0e3c335161..9a28fdb36387 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
@@ -123,8 +123,8 @@ static struct clk_lookup lookups[] = {
123 CLKDEV_CON_ID("riic6", &mstp_clks[MSTP000]), 123 CLKDEV_CON_ID("riic6", &mstp_clks[MSTP000]),
124 CLKDEV_CON_ID("riic7", &mstp_clks[MSTP000]), 124 CLKDEV_CON_ID("riic7", &mstp_clks[MSTP000]),
125 125
126 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP113]), 126 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP113]),
127 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP114]), 127 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP114]),
128 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP112]), 128 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP112]),
129 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP111]), 129 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP111]),
130 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP110]), 130 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP110]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
index 1c83788db76a..17d0ea55a5a2 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
@@ -146,12 +146,8 @@ static struct clk_lookup lookups[] = {
146 CLKDEV_CON_ID("mmcif_fck", &mstp_clks[MSTP013]), 146 CLKDEV_CON_ID("mmcif_fck", &mstp_clks[MSTP013]),
147 CLKDEV_CON_ID("flctl_fck", &mstp_clks[MSTP012]), 147 CLKDEV_CON_ID("flctl_fck", &mstp_clks[MSTP012]),
148 148
149 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]), 149 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP008]),
150 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]), 150 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP009]),
151 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]),
152 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]),
153 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
154 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
155 151
156 CLKDEV_CON_ID("siof_fck", &mstp_clks[MSTP003]), 152 CLKDEV_CON_ID("siof_fck", &mstp_clks[MSTP003]),
157 CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]), 153 CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
index 8bba6f159023..bec2a83f1ba5 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
@@ -155,18 +155,10 @@ static struct clk_lookup lookups[] = {
155 CLKDEV_CON_ID("i2c1_fck", &mstp_clks[MSTP015]), 155 CLKDEV_CON_ID("i2c1_fck", &mstp_clks[MSTP015]),
156 CLKDEV_CON_ID("i2c0_fck", &mstp_clks[MSTP014]), 156 CLKDEV_CON_ID("i2c0_fck", &mstp_clks[MSTP014]),
157 157
158 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]), 158 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP008]),
159 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]), 159 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP009]),
160 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]), 160 CLKDEV_ICK_ID("fck", "sh-tmu.2", &mstp_clks[MSTP010]),
161 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]), 161 CLKDEV_ICK_ID("fck", "sh-tmu.3", &mstp_clks[MSTP011]),
162 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
163 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
164 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.6", &mstp_clks[MSTP010]),
165 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.7", &mstp_clks[MSTP010]),
166 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.8", &mstp_clks[MSTP010]),
167 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.9", &mstp_clks[MSTP011]),
168 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.10", &mstp_clks[MSTP011]),
169 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.11", &mstp_clks[MSTP011]),
170 162
171 CLKDEV_CON_ID("sdif1_fck", &mstp_clks[MSTP005]), 163 CLKDEV_CON_ID("sdif1_fck", &mstp_clks[MSTP005]),
172 CLKDEV_CON_ID("sdif0_fck", &mstp_clks[MSTP004]), 164 CLKDEV_CON_ID("sdif0_fck", &mstp_clks[MSTP004]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-shx3.c b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
index a9422dab0ce7..9a49a44f6f94 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
@@ -124,12 +124,8 @@ static struct clk_lookup lookups[] = {
124 CLKDEV_CON_ID("fe1_fck", &mstp_clks[MSTP001]), 124 CLKDEV_CON_ID("fe1_fck", &mstp_clks[MSTP001]),
125 CLKDEV_CON_ID("fe0_fck", &mstp_clks[MSTP000]), 125 CLKDEV_CON_ID("fe0_fck", &mstp_clks[MSTP000]),
126 126
127 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]), 127 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP008]),
128 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]), 128 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP009]),
129 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]),
130 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]),
131 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
132 CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
133 129
134 CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]), 130 CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]),
135 CLKDEV_CON_ID("dmac_11_6_fck", &mstp_clks[MSTP105]), 131 CLKDEV_CON_ID("dmac_11_6_fck", &mstp_clks[MSTP105]),
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
index 245d19254489..ceb3dedad983 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
@@ -228,26 +228,16 @@ static struct platform_device jpu_device = {
228}; 228};
229 229
230static struct sh_timer_config cmt_platform_data = { 230static struct sh_timer_config cmt_platform_data = {
231 .channel_offset = 0x60, 231 .channels_mask = 0x20,
232 .timer_bit = 5,
233 .clockevent_rating = 125,
234 .clocksource_rating = 200,
235}; 232};
236 233
237static struct resource cmt_resources[] = { 234static struct resource cmt_resources[] = {
238 [0] = { 235 DEFINE_RES_MEM(0x044a0000, 0x70),
239 .start = 0x044a0060, 236 DEFINE_RES_IRQ(evt2irq(0xf00)),
240 .end = 0x044a006b,
241 .flags = IORESOURCE_MEM,
242 },
243 [1] = {
244 .start = evt2irq(0xf00),
245 .flags = IORESOURCE_IRQ,
246 },
247}; 237};
248 238
249static struct platform_device cmt_device = { 239static struct platform_device cmt_device = {
250 .name = "sh_cmt", 240 .name = "sh-cmt-32",
251 .id = 0, 241 .id = 0,
252 .dev = { 242 .dev = {
253 .platform_data = &cmt_platform_data, 243 .platform_data = &cmt_platform_data,
@@ -257,25 +247,18 @@ static struct platform_device cmt_device = {
257}; 247};
258 248
259static struct sh_timer_config tmu0_platform_data = { 249static struct sh_timer_config tmu0_platform_data = {
260 .channel_offset = 0x04, 250 .channels_mask = 7,
261 .timer_bit = 0,
262 .clockevent_rating = 200,
263}; 251};
264 252
265static struct resource tmu0_resources[] = { 253static struct resource tmu0_resources[] = {
266 [0] = { 254 DEFINE_RES_MEM(0xffd80000, 0x2c),
267 .start = 0xffd80008, 255 DEFINE_RES_IRQ(evt2irq(0x400)),
268 .end = 0xffd80013, 256 DEFINE_RES_IRQ(evt2irq(0x420)),
269 .flags = IORESOURCE_MEM, 257 DEFINE_RES_IRQ(evt2irq(0x440)),
270 },
271 [1] = {
272 .start = evt2irq(0x400),
273 .flags = IORESOURCE_IRQ,
274 },
275}; 258};
276 259
277static struct platform_device tmu0_device = { 260static struct platform_device tmu0_device = {
278 .name = "sh_tmu", 261 .name = "sh-tmu",
279 .id = 0, 262 .id = 0,
280 .dev = { 263 .dev = {
281 .platform_data = &tmu0_platform_data, 264 .platform_data = &tmu0_platform_data,
@@ -284,61 +267,6 @@ static struct platform_device tmu0_device = {
284 .num_resources = ARRAY_SIZE(tmu0_resources), 267 .num_resources = ARRAY_SIZE(tmu0_resources),
285}; 268};
286 269
287static struct sh_timer_config tmu1_platform_data = {
288 .channel_offset = 0x10,
289 .timer_bit = 1,
290 .clocksource_rating = 200,
291};
292
293static struct resource tmu1_resources[] = {
294 [0] = {
295 .start = 0xffd80014,
296 .end = 0xffd8001f,
297 .flags = IORESOURCE_MEM,
298 },
299 [1] = {
300 .start = evt2irq(0x420),
301 .flags = IORESOURCE_IRQ,
302 },
303};
304
305static struct platform_device tmu1_device = {
306 .name = "sh_tmu",
307 .id = 1,
308 .dev = {
309 .platform_data = &tmu1_platform_data,
310 },
311 .resource = tmu1_resources,
312 .num_resources = ARRAY_SIZE(tmu1_resources),
313};
314
315static struct sh_timer_config tmu2_platform_data = {
316 .channel_offset = 0x1c,
317 .timer_bit = 2,
318};
319
320static struct resource tmu2_resources[] = {
321 [0] = {
322 .start = 0xffd80020,
323 .end = 0xffd8002b,
324 .flags = IORESOURCE_MEM,
325 },
326 [1] = {
327 .start = evt2irq(0x440),
328 .flags = IORESOURCE_IRQ,
329 },
330};
331
332static struct platform_device tmu2_device = {
333 .name = "sh_tmu",
334 .id = 2,
335 .dev = {
336 .platform_data = &tmu2_platform_data,
337 },
338 .resource = tmu2_resources,
339 .num_resources = ARRAY_SIZE(tmu2_resources),
340};
341
342static struct platform_device *sh7343_devices[] __initdata = { 270static struct platform_device *sh7343_devices[] __initdata = {
343 &scif0_device, 271 &scif0_device,
344 &scif1_device, 272 &scif1_device,
@@ -346,8 +274,6 @@ static struct platform_device *sh7343_devices[] __initdata = {
346 &scif3_device, 274 &scif3_device,
347 &cmt_device, 275 &cmt_device,
348 &tmu0_device, 276 &tmu0_device,
349 &tmu1_device,
350 &tmu2_device,
351 &iic0_device, 277 &iic0_device,
352 &iic1_device, 278 &iic1_device,
353 &vpu_device, 279 &vpu_device,
@@ -373,8 +299,6 @@ static struct platform_device *sh7343_early_devices[] __initdata = {
373 &scif3_device, 299 &scif3_device,
374 &cmt_device, 300 &cmt_device,
375 &tmu0_device, 301 &tmu0_device,
376 &tmu1_device,
377 &tmu2_device,
378}; 302};
379 303
380void __init plat_early_device_setup(void) 304void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index 6f56cbd76b20..f75f67343139 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -176,26 +176,16 @@ static struct platform_device veu1_device = {
176}; 176};
177 177
178static struct sh_timer_config cmt_platform_data = { 178static struct sh_timer_config cmt_platform_data = {
179 .channel_offset = 0x60, 179 .channels_mask = 0x20,
180 .timer_bit = 5,
181 .clockevent_rating = 125,
182 .clocksource_rating = 200,
183}; 180};
184 181
185static struct resource cmt_resources[] = { 182static struct resource cmt_resources[] = {
186 [0] = { 183 DEFINE_RES_MEM(0x044a0000, 0x70),
187 .start = 0x044a0060, 184 DEFINE_RES_IRQ(evt2irq(0xf00)),
188 .end = 0x044a006b,
189 .flags = IORESOURCE_MEM,
190 },
191 [1] = {
192 .start = evt2irq(0xf00),
193 .flags = IORESOURCE_IRQ,
194 },
195}; 185};
196 186
197static struct platform_device cmt_device = { 187static struct platform_device cmt_device = {
198 .name = "sh_cmt", 188 .name = "sh-cmt-32",
199 .id = 0, 189 .id = 0,
200 .dev = { 190 .dev = {
201 .platform_data = &cmt_platform_data, 191 .platform_data = &cmt_platform_data,
@@ -205,25 +195,18 @@ static struct platform_device cmt_device = {
205}; 195};
206 196
207static struct sh_timer_config tmu0_platform_data = { 197static struct sh_timer_config tmu0_platform_data = {
208 .channel_offset = 0x04, 198 .channels_mask = 7,
209 .timer_bit = 0,
210 .clockevent_rating = 200,
211}; 199};
212 200
213static struct resource tmu0_resources[] = { 201static struct resource tmu0_resources[] = {
214 [0] = { 202 DEFINE_RES_MEM(0xffd80000, 0x2c),
215 .start = 0xffd80008, 203 DEFINE_RES_IRQ(evt2irq(0x400)),
216 .end = 0xffd80013, 204 DEFINE_RES_IRQ(evt2irq(0x420)),
217 .flags = IORESOURCE_MEM, 205 DEFINE_RES_IRQ(evt2irq(0x440)),
218 },
219 [1] = {
220 .start = 16,
221 .flags = IORESOURCE_IRQ,
222 },
223}; 206};
224 207
225static struct platform_device tmu0_device = { 208static struct platform_device tmu0_device = {
226 .name = "sh_tmu", 209 .name = "sh-tmu",
227 .id = 0, 210 .id = 0,
228 .dev = { 211 .dev = {
229 .platform_data = &tmu0_platform_data, 212 .platform_data = &tmu0_platform_data,
@@ -232,67 +215,10 @@ static struct platform_device tmu0_device = {
232 .num_resources = ARRAY_SIZE(tmu0_resources), 215 .num_resources = ARRAY_SIZE(tmu0_resources),
233}; 216};
234 217
235static struct sh_timer_config tmu1_platform_data = {
236 .channel_offset = 0x10,
237 .timer_bit = 1,
238 .clocksource_rating = 200,
239};
240
241static struct resource tmu1_resources[] = {
242 [0] = {
243 .start = 0xffd80014,
244 .end = 0xffd8001f,
245 .flags = IORESOURCE_MEM,
246 },
247 [1] = {
248 .start = evt2irq(0x420),
249 .flags = IORESOURCE_IRQ,
250 },
251};
252
253static struct platform_device tmu1_device = {
254 .name = "sh_tmu",
255 .id = 1,
256 .dev = {
257 .platform_data = &tmu1_platform_data,
258 },
259 .resource = tmu1_resources,
260 .num_resources = ARRAY_SIZE(tmu1_resources),
261};
262
263static struct sh_timer_config tmu2_platform_data = {
264 .channel_offset = 0x1c,
265 .timer_bit = 2,
266};
267
268static struct resource tmu2_resources[] = {
269 [0] = {
270 .start = 0xffd80020,
271 .end = 0xffd8002b,
272 .flags = IORESOURCE_MEM,
273 },
274 [1] = {
275 .start = evt2irq(0x440),
276 .flags = IORESOURCE_IRQ,
277 },
278};
279
280static struct platform_device tmu2_device = {
281 .name = "sh_tmu",
282 .id = 2,
283 .dev = {
284 .platform_data = &tmu2_platform_data,
285 },
286 .resource = tmu2_resources,
287 .num_resources = ARRAY_SIZE(tmu2_resources),
288};
289
290static struct platform_device *sh7366_devices[] __initdata = { 218static struct platform_device *sh7366_devices[] __initdata = {
291 &scif0_device, 219 &scif0_device,
292 &cmt_device, 220 &cmt_device,
293 &tmu0_device, 221 &tmu0_device,
294 &tmu1_device,
295 &tmu2_device,
296 &iic_device, 222 &iic_device,
297 &usb_host_device, 223 &usb_host_device,
298 &vpu_device, 224 &vpu_device,
@@ -315,8 +241,6 @@ static struct platform_device *sh7366_early_devices[] __initdata = {
315 &scif0_device, 241 &scif0_device,
316 &cmt_device, 242 &cmt_device,
317 &tmu0_device, 243 &tmu0_device,
318 &tmu1_device,
319 &tmu2_device,
320}; 244};
321 245
322void __init plat_early_device_setup(void) 246void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 5a94efc8d4ce..57f83a92a505 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -413,26 +413,16 @@ static struct platform_device jpu_device = {
413}; 413};
414 414
415static struct sh_timer_config cmt_platform_data = { 415static struct sh_timer_config cmt_platform_data = {
416 .channel_offset = 0x60, 416 .channels_mask = 0x20,
417 .timer_bit = 5,
418 .clockevent_rating = 125,
419 .clocksource_rating = 125,
420}; 417};
421 418
422static struct resource cmt_resources[] = { 419static struct resource cmt_resources[] = {
423 [0] = { 420 DEFINE_RES_MEM(0x044a0000, 0x70),
424 .start = 0x044a0060, 421 DEFINE_RES_IRQ(evt2irq(0xf00)),
425 .end = 0x044a006b,
426 .flags = IORESOURCE_MEM,
427 },
428 [1] = {
429 .start = evt2irq(0xf00),
430 .flags = IORESOURCE_IRQ,
431 },
432}; 422};
433 423
434static struct platform_device cmt_device = { 424static struct platform_device cmt_device = {
435 .name = "sh_cmt", 425 .name = "sh-cmt-32",
436 .id = 0, 426 .id = 0,
437 .dev = { 427 .dev = {
438 .platform_data = &cmt_platform_data, 428 .platform_data = &cmt_platform_data,
@@ -442,25 +432,18 @@ static struct platform_device cmt_device = {
442}; 432};
443 433
444static struct sh_timer_config tmu0_platform_data = { 434static struct sh_timer_config tmu0_platform_data = {
445 .channel_offset = 0x04, 435 .channels_mask = 7,
446 .timer_bit = 0,
447 .clockevent_rating = 200,
448}; 436};
449 437
450static struct resource tmu0_resources[] = { 438static struct resource tmu0_resources[] = {
451 [0] = { 439 DEFINE_RES_MEM(0xffd80000, 0x2c),
452 .start = 0xffd80008, 440 DEFINE_RES_IRQ(evt2irq(0x400)),
453 .end = 0xffd80013, 441 DEFINE_RES_IRQ(evt2irq(0x420)),
454 .flags = IORESOURCE_MEM, 442 DEFINE_RES_IRQ(evt2irq(0x440)),
455 },
456 [1] = {
457 .start = evt2irq(0x400),
458 .flags = IORESOURCE_IRQ,
459 },
460}; 443};
461 444
462static struct platform_device tmu0_device = { 445static struct platform_device tmu0_device = {
463 .name = "sh_tmu", 446 .name = "sh-tmu",
464 .id = 0, 447 .id = 0,
465 .dev = { 448 .dev = {
466 .platform_data = &tmu0_platform_data, 449 .platform_data = &tmu0_platform_data,
@@ -469,61 +452,6 @@ static struct platform_device tmu0_device = {
469 .num_resources = ARRAY_SIZE(tmu0_resources), 452 .num_resources = ARRAY_SIZE(tmu0_resources),
470}; 453};
471 454
472static struct sh_timer_config tmu1_platform_data = {
473 .channel_offset = 0x10,
474 .timer_bit = 1,
475 .clocksource_rating = 200,
476};
477
478static struct resource tmu1_resources[] = {
479 [0] = {
480 .start = 0xffd80014,
481 .end = 0xffd8001f,
482 .flags = IORESOURCE_MEM,
483 },
484 [1] = {
485 .start = evt2irq(0x420),
486 .flags = IORESOURCE_IRQ,
487 },
488};
489
490static struct platform_device tmu1_device = {
491 .name = "sh_tmu",
492 .id = 1,
493 .dev = {
494 .platform_data = &tmu1_platform_data,
495 },
496 .resource = tmu1_resources,
497 .num_resources = ARRAY_SIZE(tmu1_resources),
498};
499
500static struct sh_timer_config tmu2_platform_data = {
501 .channel_offset = 0x1c,
502 .timer_bit = 2,
503};
504
505static struct resource tmu2_resources[] = {
506 [0] = {
507 .start = 0xffd80020,
508 .end = 0xffd8002b,
509 .flags = IORESOURCE_MEM,
510 },
511 [1] = {
512 .start = 18,
513 .flags = IORESOURCE_IRQ,
514 },
515};
516
517static struct platform_device tmu2_device = {
518 .name = "sh_tmu",
519 .id = 2,
520 .dev = {
521 .platform_data = &tmu2_platform_data,
522 },
523 .resource = tmu2_resources,
524 .num_resources = ARRAY_SIZE(tmu2_resources),
525};
526
527static struct siu_platform siu_platform_data = { 455static struct siu_platform siu_platform_data = {
528 .dma_slave_tx_a = SHDMA_SLAVE_SIUA_TX, 456 .dma_slave_tx_a = SHDMA_SLAVE_SIUA_TX,
529 .dma_slave_rx_a = SHDMA_SLAVE_SIUA_RX, 457 .dma_slave_rx_a = SHDMA_SLAVE_SIUA_RX,
@@ -559,8 +487,6 @@ static struct platform_device *sh7722_devices[] __initdata = {
559 &scif2_device, 487 &scif2_device,
560 &cmt_device, 488 &cmt_device,
561 &tmu0_device, 489 &tmu0_device,
562 &tmu1_device,
563 &tmu2_device,
564 &rtc_device, 490 &rtc_device,
565 &usbf_device, 491 &usbf_device,
566 &iic_device, 492 &iic_device,
@@ -588,8 +514,6 @@ static struct platform_device *sh7722_early_devices[] __initdata = {
588 &scif2_device, 514 &scif2_device,
589 &cmt_device, 515 &cmt_device,
590 &tmu0_device, 516 &tmu0_device,
591 &tmu1_device,
592 &tmu2_device,
593}; 517};
594 518
595void __init plat_early_device_setup(void) 519void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index 3c5eb0993a75..3533b56dd465 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -245,26 +245,16 @@ static struct platform_device veu1_device = {
245}; 245};
246 246
247static struct sh_timer_config cmt_platform_data = { 247static struct sh_timer_config cmt_platform_data = {
248 .channel_offset = 0x60, 248 .channels_mask = 0x20,
249 .timer_bit = 5,
250 .clockevent_rating = 125,
251 .clocksource_rating = 125,
252}; 249};
253 250
254static struct resource cmt_resources[] = { 251static struct resource cmt_resources[] = {
255 [0] = { 252 DEFINE_RES_MEM(0x044a0000, 0x70),
256 .start = 0x044a0060, 253 DEFINE_RES_IRQ(evt2irq(0xf00)),
257 .end = 0x044a006b,
258 .flags = IORESOURCE_MEM,
259 },
260 [1] = {
261 .start = evt2irq(0xf00),
262 .flags = IORESOURCE_IRQ,
263 },
264}; 254};
265 255
266static struct platform_device cmt_device = { 256static struct platform_device cmt_device = {
267 .name = "sh_cmt", 257 .name = "sh-cmt-32",
268 .id = 0, 258 .id = 0,
269 .dev = { 259 .dev = {
270 .platform_data = &cmt_platform_data, 260 .platform_data = &cmt_platform_data,
@@ -274,25 +264,18 @@ static struct platform_device cmt_device = {
274}; 264};
275 265
276static struct sh_timer_config tmu0_platform_data = { 266static struct sh_timer_config tmu0_platform_data = {
277 .channel_offset = 0x04, 267 .channels_mask = 7,
278 .timer_bit = 0,
279 .clockevent_rating = 200,
280}; 268};
281 269
282static struct resource tmu0_resources[] = { 270static struct resource tmu0_resources[] = {
283 [0] = { 271 DEFINE_RES_MEM(0xffd80000, 0x2c),
284 .start = 0xffd80008, 272 DEFINE_RES_IRQ(evt2irq(0x400)),
285 .end = 0xffd80013, 273 DEFINE_RES_IRQ(evt2irq(0x420)),
286 .flags = IORESOURCE_MEM, 274 DEFINE_RES_IRQ(evt2irq(0x440)),
287 },
288 [1] = {
289 .start = evt2irq(0x400),
290 .flags = IORESOURCE_IRQ,
291 },
292}; 275};
293 276
294static struct platform_device tmu0_device = { 277static struct platform_device tmu0_device = {
295 .name = "sh_tmu", 278 .name = "sh-tmu",
296 .id = 0, 279 .id = 0,
297 .dev = { 280 .dev = {
298 .platform_data = &tmu0_platform_data, 281 .platform_data = &tmu0_platform_data,
@@ -302,25 +285,18 @@ static struct platform_device tmu0_device = {
302}; 285};
303 286
304static struct sh_timer_config tmu1_platform_data = { 287static struct sh_timer_config tmu1_platform_data = {
305 .channel_offset = 0x10, 288 .channels_mask = 7,
306 .timer_bit = 1,
307 .clocksource_rating = 200,
308}; 289};
309 290
310static struct resource tmu1_resources[] = { 291static struct resource tmu1_resources[] = {
311 [0] = { 292 DEFINE_RES_MEM(0xffd90000, 0x2c),
312 .start = 0xffd80014, 293 DEFINE_RES_IRQ(evt2irq(0x920)),
313 .end = 0xffd8001f, 294 DEFINE_RES_IRQ(evt2irq(0x940)),
314 .flags = IORESOURCE_MEM, 295 DEFINE_RES_IRQ(evt2irq(0x960)),
315 },
316 [1] = {
317 .start = evt2irq(0x420),
318 .flags = IORESOURCE_IRQ,
319 },
320}; 296};
321 297
322static struct platform_device tmu1_device = { 298static struct platform_device tmu1_device = {
323 .name = "sh_tmu", 299 .name = "sh-tmu",
324 .id = 1, 300 .id = 1,
325 .dev = { 301 .dev = {
326 .platform_data = &tmu1_platform_data, 302 .platform_data = &tmu1_platform_data,
@@ -329,114 +305,6 @@ static struct platform_device tmu1_device = {
329 .num_resources = ARRAY_SIZE(tmu1_resources), 305 .num_resources = ARRAY_SIZE(tmu1_resources),
330}; 306};
331 307
332static struct sh_timer_config tmu2_platform_data = {
333 .channel_offset = 0x1c,
334 .timer_bit = 2,
335};
336
337static struct resource tmu2_resources[] = {
338 [0] = {
339 .start = 0xffd80020,
340 .end = 0xffd8002b,
341 .flags = IORESOURCE_MEM,
342 },
343 [1] = {
344 .start = evt2irq(0x440),
345 .flags = IORESOURCE_IRQ,
346 },
347};
348
349static struct platform_device tmu2_device = {
350 .name = "sh_tmu",
351 .id = 2,
352 .dev = {
353 .platform_data = &tmu2_platform_data,
354 },
355 .resource = tmu2_resources,
356 .num_resources = ARRAY_SIZE(tmu2_resources),
357};
358
359static struct sh_timer_config tmu3_platform_data = {
360 .channel_offset = 0x04,
361 .timer_bit = 0,
362};
363
364static struct resource tmu3_resources[] = {
365 [0] = {
366 .start = 0xffd90008,
367 .end = 0xffd90013,
368 .flags = IORESOURCE_MEM,
369 },
370 [1] = {
371 .start = evt2irq(0x920),
372 .flags = IORESOURCE_IRQ,
373 },
374};
375
376static struct platform_device tmu3_device = {
377 .name = "sh_tmu",
378 .id = 3,
379 .dev = {
380 .platform_data = &tmu3_platform_data,
381 },
382 .resource = tmu3_resources,
383 .num_resources = ARRAY_SIZE(tmu3_resources),
384};
385
386static struct sh_timer_config tmu4_platform_data = {
387 .channel_offset = 0x10,
388 .timer_bit = 1,
389};
390
391static struct resource tmu4_resources[] = {
392 [0] = {
393 .start = 0xffd90014,
394 .end = 0xffd9001f,
395 .flags = IORESOURCE_MEM,
396 },
397 [1] = {
398 .start = evt2irq(0x940),
399 .flags = IORESOURCE_IRQ,
400 },
401};
402
403static struct platform_device tmu4_device = {
404 .name = "sh_tmu",
405 .id = 4,
406 .dev = {
407 .platform_data = &tmu4_platform_data,
408 },
409 .resource = tmu4_resources,
410 .num_resources = ARRAY_SIZE(tmu4_resources),
411};
412
413static struct sh_timer_config tmu5_platform_data = {
414 .channel_offset = 0x1c,
415 .timer_bit = 2,
416};
417
418static struct resource tmu5_resources[] = {
419 [0] = {
420 .start = 0xffd90020,
421 .end = 0xffd9002b,
422 .flags = IORESOURCE_MEM,
423 },
424 [1] = {
425 .start = evt2irq(0x920),
426 .flags = IORESOURCE_IRQ,
427 },
428};
429
430static struct platform_device tmu5_device = {
431 .name = "sh_tmu",
432 .id = 5,
433 .dev = {
434 .platform_data = &tmu5_platform_data,
435 },
436 .resource = tmu5_resources,
437 .num_resources = ARRAY_SIZE(tmu5_resources),
438};
439
440static struct resource rtc_resources[] = { 308static struct resource rtc_resources[] = {
441 [0] = { 309 [0] = {
442 .start = 0xa465fec0, 310 .start = 0xa465fec0,
@@ -527,10 +395,6 @@ static struct platform_device *sh7723_devices[] __initdata = {
527 &cmt_device, 395 &cmt_device,
528 &tmu0_device, 396 &tmu0_device,
529 &tmu1_device, 397 &tmu1_device,
530 &tmu2_device,
531 &tmu3_device,
532 &tmu4_device,
533 &tmu5_device,
534 &rtc_device, 398 &rtc_device,
535 &iic_device, 399 &iic_device,
536 &sh7723_usb_host_device, 400 &sh7723_usb_host_device,
@@ -560,10 +424,6 @@ static struct platform_device *sh7723_early_devices[] __initdata = {
560 &cmt_device, 424 &cmt_device,
561 &tmu0_device, 425 &tmu0_device,
562 &tmu1_device, 426 &tmu1_device,
563 &tmu2_device,
564 &tmu3_device,
565 &tmu4_device,
566 &tmu5_device,
567}; 427};
568 428
569void __init plat_early_device_setup(void) 429void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index 60ebbc6842ff..b9e84b1d3aa7 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -648,26 +648,16 @@ static struct platform_device beu1_device = {
648}; 648};
649 649
650static struct sh_timer_config cmt_platform_data = { 650static struct sh_timer_config cmt_platform_data = {
651 .channel_offset = 0x60, 651 .channels_mask = 0x20,
652 .timer_bit = 5,
653 .clockevent_rating = 125,
654 .clocksource_rating = 200,
655}; 652};
656 653
657static struct resource cmt_resources[] = { 654static struct resource cmt_resources[] = {
658 [0] = { 655 DEFINE_RES_MEM(0x044a0000, 0x70),
659 .start = 0x044a0060, 656 DEFINE_RES_IRQ(evt2irq(0xf00)),
660 .end = 0x044a006b,
661 .flags = IORESOURCE_MEM,
662 },
663 [1] = {
664 .start = evt2irq(0xf00),
665 .flags = IORESOURCE_IRQ,
666 },
667}; 657};
668 658
669static struct platform_device cmt_device = { 659static struct platform_device cmt_device = {
670 .name = "sh_cmt", 660 .name = "sh-cmt-32",
671 .id = 0, 661 .id = 0,
672 .dev = { 662 .dev = {
673 .platform_data = &cmt_platform_data, 663 .platform_data = &cmt_platform_data,
@@ -677,25 +667,18 @@ static struct platform_device cmt_device = {
677}; 667};
678 668
679static struct sh_timer_config tmu0_platform_data = { 669static struct sh_timer_config tmu0_platform_data = {
680 .channel_offset = 0x04, 670 .channels_mask = 7,
681 .timer_bit = 0,
682 .clockevent_rating = 200,
683}; 671};
684 672
685static struct resource tmu0_resources[] = { 673static struct resource tmu0_resources[] = {
686 [0] = { 674 DEFINE_RES_MEM(0xffd80000, 0x2c),
687 .start = 0xffd80008, 675 DEFINE_RES_IRQ(evt2irq(0x400)),
688 .end = 0xffd80013, 676 DEFINE_RES_IRQ(evt2irq(0x420)),
689 .flags = IORESOURCE_MEM, 677 DEFINE_RES_IRQ(evt2irq(0x440)),
690 },
691 [1] = {
692 .start = evt2irq(0x400),
693 .flags = IORESOURCE_IRQ,
694 },
695}; 678};
696 679
697static struct platform_device tmu0_device = { 680static struct platform_device tmu0_device = {
698 .name = "sh_tmu", 681 .name = "sh-tmu",
699 .id = 0, 682 .id = 0,
700 .dev = { 683 .dev = {
701 .platform_data = &tmu0_platform_data, 684 .platform_data = &tmu0_platform_data,
@@ -705,25 +688,18 @@ static struct platform_device tmu0_device = {
705}; 688};
706 689
707static struct sh_timer_config tmu1_platform_data = { 690static struct sh_timer_config tmu1_platform_data = {
708 .channel_offset = 0x10, 691 .channels_mask = 7,
709 .timer_bit = 1,
710 .clocksource_rating = 200,
711}; 692};
712 693
713static struct resource tmu1_resources[] = { 694static struct resource tmu1_resources[] = {
714 [0] = { 695 DEFINE_RES_MEM(0xffd90000, 0x2c),
715 .start = 0xffd80014, 696 DEFINE_RES_IRQ(evt2irq(0x920)),
716 .end = 0xffd8001f, 697 DEFINE_RES_IRQ(evt2irq(0x940)),
717 .flags = IORESOURCE_MEM, 698 DEFINE_RES_IRQ(evt2irq(0x960)),
718 },
719 [1] = {
720 .start = evt2irq(0x420),
721 .flags = IORESOURCE_IRQ,
722 },
723}; 699};
724 700
725static struct platform_device tmu1_device = { 701static struct platform_device tmu1_device = {
726 .name = "sh_tmu", 702 .name = "sh-tmu",
727 .id = 1, 703 .id = 1,
728 .dev = { 704 .dev = {
729 .platform_data = &tmu1_platform_data, 705 .platform_data = &tmu1_platform_data,
@@ -732,115 +708,6 @@ static struct platform_device tmu1_device = {
732 .num_resources = ARRAY_SIZE(tmu1_resources), 708 .num_resources = ARRAY_SIZE(tmu1_resources),
733}; 709};
734 710
735static struct sh_timer_config tmu2_platform_data = {
736 .channel_offset = 0x1c,
737 .timer_bit = 2,
738};
739
740static struct resource tmu2_resources[] = {
741 [0] = {
742 .start = 0xffd80020,
743 .end = 0xffd8002b,
744 .flags = IORESOURCE_MEM,
745 },
746 [1] = {
747 .start = evt2irq(0x440),
748 .flags = IORESOURCE_IRQ,
749 },
750};
751
752static struct platform_device tmu2_device = {
753 .name = "sh_tmu",
754 .id = 2,
755 .dev = {
756 .platform_data = &tmu2_platform_data,
757 },
758 .resource = tmu2_resources,
759 .num_resources = ARRAY_SIZE(tmu2_resources),
760};
761
762
763static struct sh_timer_config tmu3_platform_data = {
764 .channel_offset = 0x04,
765 .timer_bit = 0,
766};
767
768static struct resource tmu3_resources[] = {
769 [0] = {
770 .start = 0xffd90008,
771 .end = 0xffd90013,
772 .flags = IORESOURCE_MEM,
773 },
774 [1] = {
775 .start = evt2irq(0x920),
776 .flags = IORESOURCE_IRQ,
777 },
778};
779
780static struct platform_device tmu3_device = {
781 .name = "sh_tmu",
782 .id = 3,
783 .dev = {
784 .platform_data = &tmu3_platform_data,
785 },
786 .resource = tmu3_resources,
787 .num_resources = ARRAY_SIZE(tmu3_resources),
788};
789
790static struct sh_timer_config tmu4_platform_data = {
791 .channel_offset = 0x10,
792 .timer_bit = 1,
793};
794
795static struct resource tmu4_resources[] = {
796 [0] = {
797 .start = 0xffd90014,
798 .end = 0xffd9001f,
799 .flags = IORESOURCE_MEM,
800 },
801 [1] = {
802 .start = evt2irq(0x940),
803 .flags = IORESOURCE_IRQ,
804 },
805};
806
807static struct platform_device tmu4_device = {
808 .name = "sh_tmu",
809 .id = 4,
810 .dev = {
811 .platform_data = &tmu4_platform_data,
812 },
813 .resource = tmu4_resources,
814 .num_resources = ARRAY_SIZE(tmu4_resources),
815};
816
817static struct sh_timer_config tmu5_platform_data = {
818 .channel_offset = 0x1c,
819 .timer_bit = 2,
820};
821
822static struct resource tmu5_resources[] = {
823 [0] = {
824 .start = 0xffd90020,
825 .end = 0xffd9002b,
826 .flags = IORESOURCE_MEM,
827 },
828 [1] = {
829 .start = evt2irq(0x920),
830 .flags = IORESOURCE_IRQ,
831 },
832};
833
834static struct platform_device tmu5_device = {
835 .name = "sh_tmu",
836 .id = 5,
837 .dev = {
838 .platform_data = &tmu5_platform_data,
839 },
840 .resource = tmu5_resources,
841 .num_resources = ARRAY_SIZE(tmu5_resources),
842};
843
844/* JPU */ 711/* JPU */
845static struct uio_info jpu_platform_data = { 712static struct uio_info jpu_platform_data = {
846 .name = "JPU", 713 .name = "JPU",
@@ -938,10 +805,6 @@ static struct platform_device *sh7724_devices[] __initdata = {
938 &cmt_device, 805 &cmt_device,
939 &tmu0_device, 806 &tmu0_device,
940 &tmu1_device, 807 &tmu1_device,
941 &tmu2_device,
942 &tmu3_device,
943 &tmu4_device,
944 &tmu5_device,
945 &dma0_device, 808 &dma0_device,
946 &dma1_device, 809 &dma1_device,
947 &rtc_device, 810 &rtc_device,
@@ -981,10 +844,6 @@ static struct platform_device *sh7724_early_devices[] __initdata = {
981 &cmt_device, 844 &cmt_device,
982 &tmu0_device, 845 &tmu0_device,
983 &tmu1_device, 846 &tmu1_device,
984 &tmu2_device,
985 &tmu3_device,
986 &tmu4_device,
987 &tmu5_device,
988}; 847};
989 848
990void __init plat_early_device_setup(void) 849void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7734.c b/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
index dad4ed1b2f94..f617bcb734df 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
@@ -200,25 +200,18 @@ static struct platform_device i2c0_device = {
200 200
201/* TMU */ 201/* TMU */
202static struct sh_timer_config tmu0_platform_data = { 202static struct sh_timer_config tmu0_platform_data = {
203 .channel_offset = 0x04, 203 .channels_mask = 7,
204 .timer_bit = 0,
205 .clockevent_rating = 200,
206}; 204};
207 205
208static struct resource tmu0_resources[] = { 206static struct resource tmu0_resources[] = {
209 [0] = { 207 DEFINE_RES_MEM(0xffd80000, 0x30),
210 .start = 0xFFD80008, 208 DEFINE_RES_IRQ(evt2irq(0x400)),
211 .end = 0xFFD80014 - 1, 209 DEFINE_RES_IRQ(evt2irq(0x420)),
212 .flags = IORESOURCE_MEM, 210 DEFINE_RES_IRQ(evt2irq(0x440)),
213 },
214 [1] = {
215 .start = evt2irq(0x400),
216 .flags = IORESOURCE_IRQ,
217 },
218}; 211};
219 212
220static struct platform_device tmu0_device = { 213static struct platform_device tmu0_device = {
221 .name = "sh_tmu", 214 .name = "sh-tmu",
222 .id = 0, 215 .id = 0,
223 .dev = { 216 .dev = {
224 .platform_data = &tmu0_platform_data, 217 .platform_data = &tmu0_platform_data,
@@ -228,26 +221,19 @@ static struct platform_device tmu0_device = {
228}; 221};
229 222
230static struct sh_timer_config tmu1_platform_data = { 223static struct sh_timer_config tmu1_platform_data = {
231 .channel_offset = 0x10, 224 .channels_mask = 7,
232 .timer_bit = 1,
233 .clocksource_rating = 200,
234}; 225};
235 226
236static struct resource tmu1_resources[] = { 227static struct resource tmu1_resources[] = {
237 [0] = { 228 DEFINE_RES_MEM(0xffd81000, 0x30),
238 .start = 0xFFD80014, 229 DEFINE_RES_IRQ(evt2irq(0x480)),
239 .end = 0xFFD80020 - 1, 230 DEFINE_RES_IRQ(evt2irq(0x4a0)),
240 .flags = IORESOURCE_MEM, 231 DEFINE_RES_IRQ(evt2irq(0x4c0)),
241 },
242 [1] = {
243 .start = evt2irq(0x420),
244 .flags = IORESOURCE_IRQ,
245 },
246}; 232};
247 233
248static struct platform_device tmu1_device = { 234static struct platform_device tmu1_device = {
249 .name = "sh_tmu", 235 .name = "sh-tmu",
250 .id = 1, 236 .id = 1,
251 .dev = { 237 .dev = {
252 .platform_data = &tmu1_platform_data, 238 .platform_data = &tmu1_platform_data,
253 }, 239 },
@@ -256,25 +242,19 @@ static struct platform_device tmu1_device = {
256}; 242};
257 243
258static struct sh_timer_config tmu2_platform_data = { 244static struct sh_timer_config tmu2_platform_data = {
259 .channel_offset = 0x1c, 245 .channels_mask = 7,
260 .timer_bit = 2,
261}; 246};
262 247
263static struct resource tmu2_resources[] = { 248static struct resource tmu2_resources[] = {
264 [0] = { 249 DEFINE_RES_MEM(0xffd82000, 0x30),
265 .start = 0xFFD80020, 250 DEFINE_RES_IRQ(evt2irq(0x500)),
266 .end = 0xFFD80030 - 1, 251 DEFINE_RES_IRQ(evt2irq(0x520)),
267 .flags = IORESOURCE_MEM, 252 DEFINE_RES_IRQ(evt2irq(0x540)),
268 },
269 [1] = {
270 .start = evt2irq(0x440),
271 .flags = IORESOURCE_IRQ,
272 },
273}; 253};
274 254
275static struct platform_device tmu2_device = { 255static struct platform_device tmu2_device = {
276 .name = "sh_tmu", 256 .name = "sh-tmu",
277 .id = 2, 257 .id = 2,
278 .dev = { 258 .dev = {
279 .platform_data = &tmu2_platform_data, 259 .platform_data = &tmu2_platform_data,
280 }, 260 },
@@ -282,169 +262,6 @@ static struct platform_device tmu2_device = {
282 .num_resources = ARRAY_SIZE(tmu2_resources), 262 .num_resources = ARRAY_SIZE(tmu2_resources),
283}; 263};
284 264
285
286static struct sh_timer_config tmu3_platform_data = {
287 .channel_offset = 0x04,
288 .timer_bit = 0,
289};
290
291static struct resource tmu3_resources[] = {
292 [0] = {
293 .start = 0xFFD81008,
294 .end = 0xFFD81014 - 1,
295 .flags = IORESOURCE_MEM,
296 },
297 [1] = {
298 .start = evt2irq(0x480),
299 .flags = IORESOURCE_IRQ,
300 },
301};
302
303static struct platform_device tmu3_device = {
304 .name = "sh_tmu",
305 .id = 3,
306 .dev = {
307 .platform_data = &tmu3_platform_data,
308 },
309 .resource = tmu3_resources,
310 .num_resources = ARRAY_SIZE(tmu3_resources),
311};
312
313static struct sh_timer_config tmu4_platform_data = {
314 .channel_offset = 0x10,
315 .timer_bit = 1,
316};
317
318static struct resource tmu4_resources[] = {
319 [0] = {
320 .start = 0xFFD81014,
321 .end = 0xFFD81020 - 1,
322 .flags = IORESOURCE_MEM,
323 },
324 [1] = {
325 .start = evt2irq(0x4A0),
326 .flags = IORESOURCE_IRQ,
327 },
328};
329
330static struct platform_device tmu4_device = {
331 .name = "sh_tmu",
332 .id = 4,
333 .dev = {
334 .platform_data = &tmu4_platform_data,
335 },
336 .resource = tmu4_resources,
337 .num_resources = ARRAY_SIZE(tmu4_resources),
338};
339
340static struct sh_timer_config tmu5_platform_data = {
341 .channel_offset = 0x1c,
342 .timer_bit = 2,
343};
344
345static struct resource tmu5_resources[] = {
346 [0] = {
347 .start = 0xFFD81020,
348 .end = 0xFFD81030 - 1,
349 .flags = IORESOURCE_MEM,
350 },
351 [1] = {
352 .start = evt2irq(0x4C0),
353 .flags = IORESOURCE_IRQ,
354 },
355};
356
357static struct platform_device tmu5_device = {
358 .name = "sh_tmu",
359 .id = 5,
360 .dev = {
361 .platform_data = &tmu5_platform_data,
362 },
363 .resource = tmu5_resources,
364 .num_resources = ARRAY_SIZE(tmu5_resources),
365};
366
367static struct sh_timer_config tmu6_platform_data = {
368 .channel_offset = 0x4,
369 .timer_bit = 0,
370};
371
372static struct resource tmu6_resources[] = {
373 [0] = {
374 .start = 0xFFD82008,
375 .end = 0xFFD82014 - 1,
376 .flags = IORESOURCE_MEM,
377 },
378 [1] = {
379 .start = evt2irq(0x500),
380 .flags = IORESOURCE_IRQ,
381 },
382};
383
384static struct platform_device tmu6_device = {
385 .name = "sh_tmu",
386 .id = 6,
387 .dev = {
388 .platform_data = &tmu6_platform_data,
389 },
390 .resource = tmu6_resources,
391 .num_resources = ARRAY_SIZE(tmu6_resources),
392};
393
394static struct sh_timer_config tmu7_platform_data = {
395 .channel_offset = 0x10,
396 .timer_bit = 1,
397};
398
399static struct resource tmu7_resources[] = {
400 [0] = {
401 .start = 0xFFD82014,
402 .end = 0xFFD82020 - 1,
403 .flags = IORESOURCE_MEM,
404 },
405 [1] = {
406 .start = evt2irq(0x520),
407 .flags = IORESOURCE_IRQ,
408 },
409};
410
411static struct platform_device tmu7_device = {
412 .name = "sh_tmu",
413 .id = 7,
414 .dev = {
415 .platform_data = &tmu7_platform_data,
416 },
417 .resource = tmu7_resources,
418 .num_resources = ARRAY_SIZE(tmu7_resources),
419};
420
421static struct sh_timer_config tmu8_platform_data = {
422 .channel_offset = 0x1c,
423 .timer_bit = 2,
424};
425
426static struct resource tmu8_resources[] = {
427 [0] = {
428 .start = 0xFFD82020,
429 .end = 0xFFD82030 - 1,
430 .flags = IORESOURCE_MEM,
431 },
432 [1] = {
433 .start = evt2irq(0x540),
434 .flags = IORESOURCE_IRQ,
435 },
436};
437
438static struct platform_device tmu8_device = {
439 .name = "sh_tmu",
440 .id = 8,
441 .dev = {
442 .platform_data = &tmu8_platform_data,
443 },
444 .resource = tmu8_resources,
445 .num_resources = ARRAY_SIZE(tmu8_resources),
446};
447
448static struct platform_device *sh7734_devices[] __initdata = { 265static struct platform_device *sh7734_devices[] __initdata = {
449 &scif0_device, 266 &scif0_device,
450 &scif1_device, 267 &scif1_device,
@@ -455,12 +272,6 @@ static struct platform_device *sh7734_devices[] __initdata = {
455 &tmu0_device, 272 &tmu0_device,
456 &tmu1_device, 273 &tmu1_device,
457 &tmu2_device, 274 &tmu2_device,
458 &tmu3_device,
459 &tmu4_device,
460 &tmu5_device,
461 &tmu6_device,
462 &tmu7_device,
463 &tmu8_device,
464 &rtc_device, 275 &rtc_device,
465}; 276};
466 277
@@ -474,12 +285,6 @@ static struct platform_device *sh7734_early_devices[] __initdata = {
474 &tmu0_device, 285 &tmu0_device,
475 &tmu1_device, 286 &tmu1_device,
476 &tmu2_device, 287 &tmu2_device,
477 &tmu3_device,
478 &tmu4_device,
479 &tmu5_device,
480 &tmu6_device,
481 &tmu7_device,
482 &tmu8_device,
483}; 288};
484 289
485void __init plat_early_device_setup(void) 290void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index e43e5db53913..7b24ec4b409a 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -87,25 +87,17 @@ static struct platform_device scif4_device = {
87}; 87};
88 88
89static struct sh_timer_config tmu0_platform_data = { 89static struct sh_timer_config tmu0_platform_data = {
90 .channel_offset = 0x04, 90 .channels_mask = 3,
91 .timer_bit = 0,
92 .clockevent_rating = 200,
93}; 91};
94 92
95static struct resource tmu0_resources[] = { 93static struct resource tmu0_resources[] = {
96 [0] = { 94 DEFINE_RES_MEM(0xfe430000, 0x20),
97 .start = 0xfe430008, 95 DEFINE_RES_IRQ(evt2irq(0x580)),
98 .end = 0xfe430013, 96 DEFINE_RES_IRQ(evt2irq(0x5a0)),
99 .flags = IORESOURCE_MEM,
100 },
101 [1] = {
102 .start = evt2irq(0x580),
103 .flags = IORESOURCE_IRQ,
104 },
105}; 97};
106 98
107static struct platform_device tmu0_device = { 99static struct platform_device tmu0_device = {
108 .name = "sh_tmu", 100 .name = "sh-tmu",
109 .id = 0, 101 .id = 0,
110 .dev = { 102 .dev = {
111 .platform_data = &tmu0_platform_data, 103 .platform_data = &tmu0_platform_data,
@@ -114,34 +106,6 @@ static struct platform_device tmu0_device = {
114 .num_resources = ARRAY_SIZE(tmu0_resources), 106 .num_resources = ARRAY_SIZE(tmu0_resources),
115}; 107};
116 108
117static struct sh_timer_config tmu1_platform_data = {
118 .channel_offset = 0x10,
119 .timer_bit = 1,
120 .clocksource_rating = 200,
121};
122
123static struct resource tmu1_resources[] = {
124 [0] = {
125 .start = 0xfe430014,
126 .end = 0xfe43001f,
127 .flags = IORESOURCE_MEM,
128 },
129 [1] = {
130 .start = evt2irq(0x5a0),
131 .flags = IORESOURCE_IRQ,
132 },
133};
134
135static struct platform_device tmu1_device = {
136 .name = "sh_tmu",
137 .id = 1,
138 .dev = {
139 .platform_data = &tmu1_platform_data,
140 },
141 .resource = tmu1_resources,
142 .num_resources = ARRAY_SIZE(tmu1_resources),
143};
144
145static struct resource spi0_resources[] = { 109static struct resource spi0_resources[] = {
146 [0] = { 110 [0] = {
147 .start = 0xfe002000, 111 .start = 0xfe002000,
@@ -782,7 +746,6 @@ static struct platform_device *sh7757_devices[] __initdata = {
782 &scif3_device, 746 &scif3_device,
783 &scif4_device, 747 &scif4_device,
784 &tmu0_device, 748 &tmu0_device,
785 &tmu1_device,
786 &dma0_device, 749 &dma0_device,
787 &dma1_device, 750 &dma1_device,
788 &dma2_device, 751 &dma2_device,
@@ -806,7 +769,6 @@ static struct platform_device *sh7757_early_devices[] __initdata = {
806 &scif3_device, 769 &scif3_device,
807 &scif4_device, 770 &scif4_device,
808 &tmu0_device, 771 &tmu0_device,
809 &tmu1_device,
810}; 772};
811 773
812void __init plat_early_device_setup(void) 774void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
index 5eebbd7f4c21..5a47d670ddec 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
@@ -158,25 +158,18 @@ static struct platform_device usbf_device = {
158}; 158};
159 159
160static struct sh_timer_config tmu0_platform_data = { 160static struct sh_timer_config tmu0_platform_data = {
161 .channel_offset = 0x04, 161 .channels_mask = 7,
162 .timer_bit = 0,
163 .clockevent_rating = 200,
164}; 162};
165 163
166static struct resource tmu0_resources[] = { 164static struct resource tmu0_resources[] = {
167 [0] = { 165 DEFINE_RES_MEM(0xffd80000, 0x30),
168 .start = 0xffd80008, 166 DEFINE_RES_IRQ(evt2irq(0x580)),
169 .end = 0xffd80013, 167 DEFINE_RES_IRQ(evt2irq(0x5a0)),
170 .flags = IORESOURCE_MEM, 168 DEFINE_RES_IRQ(evt2irq(0x5c0)),
171 },
172 [1] = {
173 .start = evt2irq(0x580),
174 .flags = IORESOURCE_IRQ,
175 },
176}; 169};
177 170
178static struct platform_device tmu0_device = { 171static struct platform_device tmu0_device = {
179 .name = "sh_tmu", 172 .name = "sh-tmu",
180 .id = 0, 173 .id = 0,
181 .dev = { 174 .dev = {
182 .platform_data = &tmu0_platform_data, 175 .platform_data = &tmu0_platform_data,
@@ -186,25 +179,18 @@ static struct platform_device tmu0_device = {
186}; 179};
187 180
188static struct sh_timer_config tmu1_platform_data = { 181static struct sh_timer_config tmu1_platform_data = {
189 .channel_offset = 0x10, 182 .channels_mask = 7,
190 .timer_bit = 1,
191 .clocksource_rating = 200,
192}; 183};
193 184
194static struct resource tmu1_resources[] = { 185static struct resource tmu1_resources[] = {
195 [0] = { 186 DEFINE_RES_MEM(0xffd88000, 0x2c),
196 .start = 0xffd80014, 187 DEFINE_RES_IRQ(evt2irq(0xe00)),
197 .end = 0xffd8001f, 188 DEFINE_RES_IRQ(evt2irq(0xe20)),
198 .flags = IORESOURCE_MEM, 189 DEFINE_RES_IRQ(evt2irq(0xe40)),
199 },
200 [1] = {
201 .start = evt2irq(0x5a0),
202 .flags = IORESOURCE_IRQ,
203 },
204}; 190};
205 191
206static struct platform_device tmu1_device = { 192static struct platform_device tmu1_device = {
207 .name = "sh_tmu", 193 .name = "sh-tmu",
208 .id = 1, 194 .id = 1,
209 .dev = { 195 .dev = {
210 .platform_data = &tmu1_platform_data, 196 .platform_data = &tmu1_platform_data,
@@ -213,124 +199,12 @@ static struct platform_device tmu1_device = {
213 .num_resources = ARRAY_SIZE(tmu1_resources), 199 .num_resources = ARRAY_SIZE(tmu1_resources),
214}; 200};
215 201
216static struct sh_timer_config tmu2_platform_data = {
217 .channel_offset = 0x1c,
218 .timer_bit = 2,
219};
220
221static struct resource tmu2_resources[] = {
222 [0] = {
223 .start = 0xffd80020,
224 .end = 0xffd8002f,
225 .flags = IORESOURCE_MEM,
226 },
227 [1] = {
228 .start = evt2irq(0x5c0),
229 .flags = IORESOURCE_IRQ,
230 },
231};
232
233static struct platform_device tmu2_device = {
234 .name = "sh_tmu",
235 .id = 2,
236 .dev = {
237 .platform_data = &tmu2_platform_data,
238 },
239 .resource = tmu2_resources,
240 .num_resources = ARRAY_SIZE(tmu2_resources),
241};
242
243static struct sh_timer_config tmu3_platform_data = {
244 .channel_offset = 0x04,
245 .timer_bit = 0,
246};
247
248static struct resource tmu3_resources[] = {
249 [0] = {
250 .start = 0xffd88008,
251 .end = 0xffd88013,
252 .flags = IORESOURCE_MEM,
253 },
254 [1] = {
255 .start = evt2irq(0xe00),
256 .flags = IORESOURCE_IRQ,
257 },
258};
259
260static struct platform_device tmu3_device = {
261 .name = "sh_tmu",
262 .id = 3,
263 .dev = {
264 .platform_data = &tmu3_platform_data,
265 },
266 .resource = tmu3_resources,
267 .num_resources = ARRAY_SIZE(tmu3_resources),
268};
269
270static struct sh_timer_config tmu4_platform_data = {
271 .channel_offset = 0x10,
272 .timer_bit = 1,
273};
274
275static struct resource tmu4_resources[] = {
276 [0] = {
277 .start = 0xffd88014,
278 .end = 0xffd8801f,
279 .flags = IORESOURCE_MEM,
280 },
281 [1] = {
282 .start = evt2irq(0xe20),
283 .flags = IORESOURCE_IRQ,
284 },
285};
286
287static struct platform_device tmu4_device = {
288 .name = "sh_tmu",
289 .id = 4,
290 .dev = {
291 .platform_data = &tmu4_platform_data,
292 },
293 .resource = tmu4_resources,
294 .num_resources = ARRAY_SIZE(tmu4_resources),
295};
296
297static struct sh_timer_config tmu5_platform_data = {
298 .channel_offset = 0x1c,
299 .timer_bit = 2,
300};
301
302static struct resource tmu5_resources[] = {
303 [0] = {
304 .start = 0xffd88020,
305 .end = 0xffd8802b,
306 .flags = IORESOURCE_MEM,
307 },
308 [1] = {
309 .start = evt2irq(0xe40),
310 .flags = IORESOURCE_IRQ,
311 },
312};
313
314static struct platform_device tmu5_device = {
315 .name = "sh_tmu",
316 .id = 5,
317 .dev = {
318 .platform_data = &tmu5_platform_data,
319 },
320 .resource = tmu5_resources,
321 .num_resources = ARRAY_SIZE(tmu5_resources),
322};
323
324static struct platform_device *sh7763_devices[] __initdata = { 202static struct platform_device *sh7763_devices[] __initdata = {
325 &scif0_device, 203 &scif0_device,
326 &scif1_device, 204 &scif1_device,
327 &scif2_device, 205 &scif2_device,
328 &tmu0_device, 206 &tmu0_device,
329 &tmu1_device, 207 &tmu1_device,
330 &tmu2_device,
331 &tmu3_device,
332 &tmu4_device,
333 &tmu5_device,
334 &rtc_device, 208 &rtc_device,
335 &usb_ohci_device, 209 &usb_ohci_device,
336 &usbf_device, 210 &usbf_device,
@@ -349,10 +223,6 @@ static struct platform_device *sh7763_early_devices[] __initdata = {
349 &scif2_device, 223 &scif2_device,
350 &tmu0_device, 224 &tmu0_device,
351 &tmu1_device, 225 &tmu1_device,
352 &tmu2_device,
353 &tmu3_device,
354 &tmu4_device,
355 &tmu5_device,
356}; 226};
357 227
358void __init plat_early_device_setup(void) 228void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
index e1ba8cb74e5a..e9b532a76c37 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
@@ -226,25 +226,18 @@ static struct platform_device scif9_device = {
226}; 226};
227 227
228static struct sh_timer_config tmu0_platform_data = { 228static struct sh_timer_config tmu0_platform_data = {
229 .channel_offset = 0x04, 229 .channels_mask = 7,
230 .timer_bit = 0,
231 .clockevent_rating = 200,
232}; 230};
233 231
234static struct resource tmu0_resources[] = { 232static struct resource tmu0_resources[] = {
235 [0] = { 233 DEFINE_RES_MEM(0xffd80000, 0x30),
236 .start = 0xffd80008, 234 DEFINE_RES_IRQ(evt2irq(0x400)),
237 .end = 0xffd80013, 235 DEFINE_RES_IRQ(evt2irq(0x420)),
238 .flags = IORESOURCE_MEM, 236 DEFINE_RES_IRQ(evt2irq(0x440)),
239 },
240 [1] = {
241 .start = evt2irq(0x400),
242 .flags = IORESOURCE_IRQ,
243 },
244}; 237};
245 238
246static struct platform_device tmu0_device = { 239static struct platform_device tmu0_device = {
247 .name = "sh_tmu", 240 .name = "sh-tmu",
248 .id = 0, 241 .id = 0,
249 .dev = { 242 .dev = {
250 .platform_data = &tmu0_platform_data, 243 .platform_data = &tmu0_platform_data,
@@ -254,25 +247,18 @@ static struct platform_device tmu0_device = {
254}; 247};
255 248
256static struct sh_timer_config tmu1_platform_data = { 249static struct sh_timer_config tmu1_platform_data = {
257 .channel_offset = 0x10, 250 .channels_mask = 7,
258 .timer_bit = 1,
259 .clocksource_rating = 200,
260}; 251};
261 252
262static struct resource tmu1_resources[] = { 253static struct resource tmu1_resources[] = {
263 [0] = { 254 DEFINE_RES_MEM(0xffd81000, 0x30),
264 .start = 0xffd80014, 255 DEFINE_RES_IRQ(evt2irq(0x460)),
265 .end = 0xffd8001f, 256 DEFINE_RES_IRQ(evt2irq(0x480)),
266 .flags = IORESOURCE_MEM, 257 DEFINE_RES_IRQ(evt2irq(0x4a0)),
267 },
268 [1] = {
269 .start = evt2irq(0x420),
270 .flags = IORESOURCE_IRQ,
271 },
272}; 258};
273 259
274static struct platform_device tmu1_device = { 260static struct platform_device tmu1_device = {
275 .name = "sh_tmu", 261 .name = "sh-tmu",
276 .id = 1, 262 .id = 1,
277 .dev = { 263 .dev = {
278 .platform_data = &tmu1_platform_data, 264 .platform_data = &tmu1_platform_data,
@@ -282,24 +268,18 @@ static struct platform_device tmu1_device = {
282}; 268};
283 269
284static struct sh_timer_config tmu2_platform_data = { 270static struct sh_timer_config tmu2_platform_data = {
285 .channel_offset = 0x1c, 271 .channels_mask = 7,
286 .timer_bit = 2,
287}; 272};
288 273
289static struct resource tmu2_resources[] = { 274static struct resource tmu2_resources[] = {
290 [0] = { 275 DEFINE_RES_MEM(0xffd82000, 0x2c),
291 .start = 0xffd80020, 276 DEFINE_RES_IRQ(evt2irq(0x4c0)),
292 .end = 0xffd8002f, 277 DEFINE_RES_IRQ(evt2irq(0x4e0)),
293 .flags = IORESOURCE_MEM, 278 DEFINE_RES_IRQ(evt2irq(0x500)),
294 },
295 [1] = {
296 .start = evt2irq(0x440),
297 .flags = IORESOURCE_IRQ,
298 },
299}; 279};
300 280
301static struct platform_device tmu2_device = { 281static struct platform_device tmu2_device = {
302 .name = "sh_tmu", 282 .name = "sh-tmu",
303 .id = 2, 283 .id = 2,
304 .dev = { 284 .dev = {
305 .platform_data = &tmu2_platform_data, 285 .platform_data = &tmu2_platform_data,
@@ -308,168 +288,6 @@ static struct platform_device tmu2_device = {
308 .num_resources = ARRAY_SIZE(tmu2_resources), 288 .num_resources = ARRAY_SIZE(tmu2_resources),
309}; 289};
310 290
311static struct sh_timer_config tmu3_platform_data = {
312 .channel_offset = 0x04,
313 .timer_bit = 0,
314};
315
316static struct resource tmu3_resources[] = {
317 [0] = {
318 .start = 0xffd81008,
319 .end = 0xffd81013,
320 .flags = IORESOURCE_MEM,
321 },
322 [1] = {
323 .start = evt2irq(0x460),
324 .flags = IORESOURCE_IRQ,
325 },
326};
327
328static struct platform_device tmu3_device = {
329 .name = "sh_tmu",
330 .id = 3,
331 .dev = {
332 .platform_data = &tmu3_platform_data,
333 },
334 .resource = tmu3_resources,
335 .num_resources = ARRAY_SIZE(tmu3_resources),
336};
337
338static struct sh_timer_config tmu4_platform_data = {
339 .channel_offset = 0x10,
340 .timer_bit = 1,
341};
342
343static struct resource tmu4_resources[] = {
344 [0] = {
345 .start = 0xffd81014,
346 .end = 0xffd8101f,
347 .flags = IORESOURCE_MEM,
348 },
349 [1] = {
350 .start = evt2irq(0x480),
351 .flags = IORESOURCE_IRQ,
352 },
353};
354
355static struct platform_device tmu4_device = {
356 .name = "sh_tmu",
357 .id = 4,
358 .dev = {
359 .platform_data = &tmu4_platform_data,
360 },
361 .resource = tmu4_resources,
362 .num_resources = ARRAY_SIZE(tmu4_resources),
363};
364
365static struct sh_timer_config tmu5_platform_data = {
366 .channel_offset = 0x1c,
367 .timer_bit = 2,
368};
369
370static struct resource tmu5_resources[] = {
371 [0] = {
372 .start = 0xffd81020,
373 .end = 0xffd8102f,
374 .flags = IORESOURCE_MEM,
375 },
376 [1] = {
377 .start = evt2irq(0x4a0),
378 .flags = IORESOURCE_IRQ,
379 },
380};
381
382static struct platform_device tmu5_device = {
383 .name = "sh_tmu",
384 .id = 5,
385 .dev = {
386 .platform_data = &tmu5_platform_data,
387 },
388 .resource = tmu5_resources,
389 .num_resources = ARRAY_SIZE(tmu5_resources),
390};
391
392static struct sh_timer_config tmu6_platform_data = {
393 .channel_offset = 0x04,
394 .timer_bit = 0,
395};
396
397static struct resource tmu6_resources[] = {
398 [0] = {
399 .start = 0xffd82008,
400 .end = 0xffd82013,
401 .flags = IORESOURCE_MEM,
402 },
403 [1] = {
404 .start = evt2irq(0x4c0),
405 .flags = IORESOURCE_IRQ,
406 },
407};
408
409static struct platform_device tmu6_device = {
410 .name = "sh_tmu",
411 .id = 6,
412 .dev = {
413 .platform_data = &tmu6_platform_data,
414 },
415 .resource = tmu6_resources,
416 .num_resources = ARRAY_SIZE(tmu6_resources),
417};
418
419static struct sh_timer_config tmu7_platform_data = {
420 .channel_offset = 0x10,
421 .timer_bit = 1,
422};
423
424static struct resource tmu7_resources[] = {
425 [0] = {
426 .start = 0xffd82014,
427 .end = 0xffd8201f,
428 .flags = IORESOURCE_MEM,
429 },
430 [1] = {
431 .start = evt2irq(0x4e0),
432 .flags = IORESOURCE_IRQ,
433 },
434};
435
436static struct platform_device tmu7_device = {
437 .name = "sh_tmu",
438 .id = 7,
439 .dev = {
440 .platform_data = &tmu7_platform_data,
441 },
442 .resource = tmu7_resources,
443 .num_resources = ARRAY_SIZE(tmu7_resources),
444};
445
446static struct sh_timer_config tmu8_platform_data = {
447 .channel_offset = 0x1c,
448 .timer_bit = 2,
449};
450
451static struct resource tmu8_resources[] = {
452 [0] = {
453 .start = 0xffd82020,
454 .end = 0xffd8202b,
455 .flags = IORESOURCE_MEM,
456 },
457 [1] = {
458 .start = evt2irq(0x500),
459 .flags = IORESOURCE_IRQ,
460 },
461};
462
463static struct platform_device tmu8_device = {
464 .name = "sh_tmu",
465 .id = 8,
466 .dev = {
467 .platform_data = &tmu8_platform_data,
468 },
469 .resource = tmu8_resources,
470 .num_resources = ARRAY_SIZE(tmu8_resources),
471};
472
473static struct platform_device *sh7770_devices[] __initdata = { 291static struct platform_device *sh7770_devices[] __initdata = {
474 &scif0_device, 292 &scif0_device,
475 &scif1_device, 293 &scif1_device,
@@ -484,12 +302,6 @@ static struct platform_device *sh7770_devices[] __initdata = {
484 &tmu0_device, 302 &tmu0_device,
485 &tmu1_device, 303 &tmu1_device,
486 &tmu2_device, 304 &tmu2_device,
487 &tmu3_device,
488 &tmu4_device,
489 &tmu5_device,
490 &tmu6_device,
491 &tmu7_device,
492 &tmu8_device,
493}; 305};
494 306
495static int __init sh7770_devices_setup(void) 307static int __init sh7770_devices_setup(void)
@@ -513,12 +325,6 @@ static struct platform_device *sh7770_early_devices[] __initdata = {
513 &tmu0_device, 325 &tmu0_device,
514 &tmu1_device, 326 &tmu1_device,
515 &tmu2_device, 327 &tmu2_device,
516 &tmu3_device,
517 &tmu4_device,
518 &tmu5_device,
519 &tmu6_device,
520 &tmu7_device,
521 &tmu8_device,
522}; 328};
523 329
524void __init plat_early_device_setup(void) 330void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
index 668e54bafa86..3ee7dd9b3a65 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
@@ -62,25 +62,18 @@ static struct platform_device scif1_device = {
62}; 62};
63 63
64static struct sh_timer_config tmu0_platform_data = { 64static struct sh_timer_config tmu0_platform_data = {
65 .channel_offset = 0x04, 65 .channels_mask = 7,
66 .timer_bit = 0,
67 .clockevent_rating = 200,
68}; 66};
69 67
70static struct resource tmu0_resources[] = { 68static struct resource tmu0_resources[] = {
71 [0] = { 69 DEFINE_RES_MEM(0xffd80000, 0x30),
72 .start = 0xffd80008, 70 DEFINE_RES_IRQ(evt2irq(0x580)),
73 .end = 0xffd80013, 71 DEFINE_RES_IRQ(evt2irq(0x5a0)),
74 .flags = IORESOURCE_MEM, 72 DEFINE_RES_IRQ(evt2irq(0x5c0)),
75 },
76 [1] = {
77 .start = evt2irq(0x580),
78 .flags = IORESOURCE_IRQ,
79 },
80}; 73};
81 74
82static struct platform_device tmu0_device = { 75static struct platform_device tmu0_device = {
83 .name = "sh_tmu", 76 .name = "sh-tmu",
84 .id = 0, 77 .id = 0,
85 .dev = { 78 .dev = {
86 .platform_data = &tmu0_platform_data, 79 .platform_data = &tmu0_platform_data,
@@ -90,25 +83,18 @@ static struct platform_device tmu0_device = {
90}; 83};
91 84
92static struct sh_timer_config tmu1_platform_data = { 85static struct sh_timer_config tmu1_platform_data = {
93 .channel_offset = 0x10, 86 .channels_mask = 7,
94 .timer_bit = 1,
95 .clocksource_rating = 200,
96}; 87};
97 88
98static struct resource tmu1_resources[] = { 89static struct resource tmu1_resources[] = {
99 [0] = { 90 DEFINE_RES_MEM(0xffdc0000, 0x2c),
100 .start = 0xffd80014, 91 DEFINE_RES_IRQ(evt2irq(0xe00)),
101 .end = 0xffd8001f, 92 DEFINE_RES_IRQ(evt2irq(0xe20)),
102 .flags = IORESOURCE_MEM, 93 DEFINE_RES_IRQ(evt2irq(0xe40)),
103 },
104 [1] = {
105 .start = evt2irq(0x5a0),
106 .flags = IORESOURCE_IRQ,
107 },
108}; 94};
109 95
110static struct platform_device tmu1_device = { 96static struct platform_device tmu1_device = {
111 .name = "sh_tmu", 97 .name = "sh-tmu",
112 .id = 1, 98 .id = 1,
113 .dev = { 99 .dev = {
114 .platform_data = &tmu1_platform_data, 100 .platform_data = &tmu1_platform_data,
@@ -117,114 +103,6 @@ static struct platform_device tmu1_device = {
117 .num_resources = ARRAY_SIZE(tmu1_resources), 103 .num_resources = ARRAY_SIZE(tmu1_resources),
118}; 104};
119 105
120static struct sh_timer_config tmu2_platform_data = {
121 .channel_offset = 0x1c,
122 .timer_bit = 2,
123};
124
125static struct resource tmu2_resources[] = {
126 [0] = {
127 .start = 0xffd80020,
128 .end = 0xffd8002f,
129 .flags = IORESOURCE_MEM,
130 },
131 [1] = {
132 .start = evt2irq(0x5c0),
133 .flags = IORESOURCE_IRQ,
134 },
135};
136
137static struct platform_device tmu2_device = {
138 .name = "sh_tmu",
139 .id = 2,
140 .dev = {
141 .platform_data = &tmu2_platform_data,
142 },
143 .resource = tmu2_resources,
144 .num_resources = ARRAY_SIZE(tmu2_resources),
145};
146
147static struct sh_timer_config tmu3_platform_data = {
148 .channel_offset = 0x04,
149 .timer_bit = 0,
150};
151
152static struct resource tmu3_resources[] = {
153 [0] = {
154 .start = 0xffdc0008,
155 .end = 0xffdc0013,
156 .flags = IORESOURCE_MEM,
157 },
158 [1] = {
159 .start = evt2irq(0xe00),
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164static struct platform_device tmu3_device = {
165 .name = "sh_tmu",
166 .id = 3,
167 .dev = {
168 .platform_data = &tmu3_platform_data,
169 },
170 .resource = tmu3_resources,
171 .num_resources = ARRAY_SIZE(tmu3_resources),
172};
173
174static struct sh_timer_config tmu4_platform_data = {
175 .channel_offset = 0x10,
176 .timer_bit = 1,
177};
178
179static struct resource tmu4_resources[] = {
180 [0] = {
181 .start = 0xffdc0014,
182 .end = 0xffdc001f,
183 .flags = IORESOURCE_MEM,
184 },
185 [1] = {
186 .start = evt2irq(0xe20),
187 .flags = IORESOURCE_IRQ,
188 },
189};
190
191static struct platform_device tmu4_device = {
192 .name = "sh_tmu",
193 .id = 4,
194 .dev = {
195 .platform_data = &tmu4_platform_data,
196 },
197 .resource = tmu4_resources,
198 .num_resources = ARRAY_SIZE(tmu4_resources),
199};
200
201static struct sh_timer_config tmu5_platform_data = {
202 .channel_offset = 0x1c,
203 .timer_bit = 2,
204};
205
206static struct resource tmu5_resources[] = {
207 [0] = {
208 .start = 0xffdc0020,
209 .end = 0xffdc002b,
210 .flags = IORESOURCE_MEM,
211 },
212 [1] = {
213 .start = evt2irq(0xe40),
214 .flags = IORESOURCE_IRQ,
215 },
216};
217
218static struct platform_device tmu5_device = {
219 .name = "sh_tmu",
220 .id = 5,
221 .dev = {
222 .platform_data = &tmu5_platform_data,
223 },
224 .resource = tmu5_resources,
225 .num_resources = ARRAY_SIZE(tmu5_resources),
226};
227
228static struct resource rtc_resources[] = { 106static struct resource rtc_resources[] = {
229 [0] = { 107 [0] = {
230 .start = 0xffe80000, 108 .start = 0xffe80000,
@@ -386,10 +264,6 @@ static struct platform_device *sh7780_devices[] __initdata = {
386 &scif1_device, 264 &scif1_device,
387 &tmu0_device, 265 &tmu0_device,
388 &tmu1_device, 266 &tmu1_device,
389 &tmu2_device,
390 &tmu3_device,
391 &tmu4_device,
392 &tmu5_device,
393 &rtc_device, 267 &rtc_device,
394 &dma0_device, 268 &dma0_device,
395 &dma1_device, 269 &dma1_device,
@@ -407,10 +281,6 @@ static struct platform_device *sh7780_early_devices[] __initdata = {
407 &scif1_device, 281 &scif1_device,
408 &tmu0_device, 282 &tmu0_device,
409 &tmu1_device, 283 &tmu1_device,
410 &tmu2_device,
411 &tmu3_device,
412 &tmu4_device,
413 &tmu5_device,
414}; 284};
415 285
416void __init plat_early_device_setup(void) 286void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
index 4aa679140209..c72d5a5d0995 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
@@ -152,25 +152,18 @@ static struct platform_device scif5_device = {
152}; 152};
153 153
154static struct sh_timer_config tmu0_platform_data = { 154static struct sh_timer_config tmu0_platform_data = {
155 .channel_offset = 0x04, 155 .channels_mask = 7,
156 .timer_bit = 0,
157 .clockevent_rating = 200,
158}; 156};
159 157
160static struct resource tmu0_resources[] = { 158static struct resource tmu0_resources[] = {
161 [0] = { 159 DEFINE_RES_MEM(0xffd80000, 0x30),
162 .start = 0xffd80008, 160 DEFINE_RES_IRQ(evt2irq(0x580)),
163 .end = 0xffd80013, 161 DEFINE_RES_IRQ(evt2irq(0x5a0)),
164 .flags = IORESOURCE_MEM, 162 DEFINE_RES_IRQ(evt2irq(0x5c0)),
165 },
166 [1] = {
167 .start = evt2irq(0x580),
168 .flags = IORESOURCE_IRQ,
169 },
170}; 163};
171 164
172static struct platform_device tmu0_device = { 165static struct platform_device tmu0_device = {
173 .name = "sh_tmu", 166 .name = "sh-tmu",
174 .id = 0, 167 .id = 0,
175 .dev = { 168 .dev = {
176 .platform_data = &tmu0_platform_data, 169 .platform_data = &tmu0_platform_data,
@@ -180,25 +173,18 @@ static struct platform_device tmu0_device = {
180}; 173};
181 174
182static struct sh_timer_config tmu1_platform_data = { 175static struct sh_timer_config tmu1_platform_data = {
183 .channel_offset = 0x10, 176 .channels_mask = 7,
184 .timer_bit = 1,
185 .clocksource_rating = 200,
186}; 177};
187 178
188static struct resource tmu1_resources[] = { 179static struct resource tmu1_resources[] = {
189 [0] = { 180 DEFINE_RES_MEM(0xffdc0000, 0x2c),
190 .start = 0xffd80014, 181 DEFINE_RES_IRQ(evt2irq(0xe00)),
191 .end = 0xffd8001f, 182 DEFINE_RES_IRQ(evt2irq(0xe20)),
192 .flags = IORESOURCE_MEM, 183 DEFINE_RES_IRQ(evt2irq(0xe40)),
193 },
194 [1] = {
195 .start = evt2irq(0x5a0),
196 .flags = IORESOURCE_IRQ,
197 },
198}; 184};
199 185
200static struct platform_device tmu1_device = { 186static struct platform_device tmu1_device = {
201 .name = "sh_tmu", 187 .name = "sh-tmu",
202 .id = 1, 188 .id = 1,
203 .dev = { 189 .dev = {
204 .platform_data = &tmu1_platform_data, 190 .platform_data = &tmu1_platform_data,
@@ -207,114 +193,6 @@ static struct platform_device tmu1_device = {
207 .num_resources = ARRAY_SIZE(tmu1_resources), 193 .num_resources = ARRAY_SIZE(tmu1_resources),
208}; 194};
209 195
210static struct sh_timer_config tmu2_platform_data = {
211 .channel_offset = 0x1c,
212 .timer_bit = 2,
213};
214
215static struct resource tmu2_resources[] = {
216 [0] = {
217 .start = 0xffd80020,
218 .end = 0xffd8002f,
219 .flags = IORESOURCE_MEM,
220 },
221 [1] = {
222 .start = evt2irq(0x5c0),
223 .flags = IORESOURCE_IRQ,
224 },
225};
226
227static struct platform_device tmu2_device = {
228 .name = "sh_tmu",
229 .id = 2,
230 .dev = {
231 .platform_data = &tmu2_platform_data,
232 },
233 .resource = tmu2_resources,
234 .num_resources = ARRAY_SIZE(tmu2_resources),
235};
236
237static struct sh_timer_config tmu3_platform_data = {
238 .channel_offset = 0x04,
239 .timer_bit = 0,
240};
241
242static struct resource tmu3_resources[] = {
243 [0] = {
244 .start = 0xffdc0008,
245 .end = 0xffdc0013,
246 .flags = IORESOURCE_MEM,
247 },
248 [1] = {
249 .start = evt2irq(0xe00),
250 .flags = IORESOURCE_IRQ,
251 },
252};
253
254static struct platform_device tmu3_device = {
255 .name = "sh_tmu",
256 .id = 3,
257 .dev = {
258 .platform_data = &tmu3_platform_data,
259 },
260 .resource = tmu3_resources,
261 .num_resources = ARRAY_SIZE(tmu3_resources),
262};
263
264static struct sh_timer_config tmu4_platform_data = {
265 .channel_offset = 0x10,
266 .timer_bit = 1,
267};
268
269static struct resource tmu4_resources[] = {
270 [0] = {
271 .start = 0xffdc0014,
272 .end = 0xffdc001f,
273 .flags = IORESOURCE_MEM,
274 },
275 [1] = {
276 .start = evt2irq(0xe20),
277 .flags = IORESOURCE_IRQ,
278 },
279};
280
281static struct platform_device tmu4_device = {
282 .name = "sh_tmu",
283 .id = 4,
284 .dev = {
285 .platform_data = &tmu4_platform_data,
286 },
287 .resource = tmu4_resources,
288 .num_resources = ARRAY_SIZE(tmu4_resources),
289};
290
291static struct sh_timer_config tmu5_platform_data = {
292 .channel_offset = 0x1c,
293 .timer_bit = 2,
294};
295
296static struct resource tmu5_resources[] = {
297 [0] = {
298 .start = 0xffdc0020,
299 .end = 0xffdc002b,
300 .flags = IORESOURCE_MEM,
301 },
302 [1] = {
303 .start = evt2irq(0xe40),
304 .flags = IORESOURCE_IRQ,
305 },
306};
307
308static struct platform_device tmu5_device = {
309 .name = "sh_tmu",
310 .id = 5,
311 .dev = {
312 .platform_data = &tmu5_platform_data,
313 },
314 .resource = tmu5_resources,
315 .num_resources = ARRAY_SIZE(tmu5_resources),
316};
317
318/* DMA */ 196/* DMA */
319static const struct sh_dmae_channel sh7785_dmae0_channels[] = { 197static const struct sh_dmae_channel sh7785_dmae0_channels[] = {
320 { 198 {
@@ -460,10 +338,6 @@ static struct platform_device *sh7785_devices[] __initdata = {
460 &scif5_device, 338 &scif5_device,
461 &tmu0_device, 339 &tmu0_device,
462 &tmu1_device, 340 &tmu1_device,
463 &tmu2_device,
464 &tmu3_device,
465 &tmu4_device,
466 &tmu5_device,
467 &dma0_device, 341 &dma0_device,
468 &dma1_device, 342 &dma1_device,
469}; 343};
@@ -484,10 +358,6 @@ static struct platform_device *sh7785_early_devices[] __initdata = {
484 &scif5_device, 358 &scif5_device,
485 &tmu0_device, 359 &tmu0_device,
486 &tmu1_device, 360 &tmu1_device,
487 &tmu2_device,
488 &tmu3_device,
489 &tmu4_device,
490 &tmu5_device,
491}; 361};
492 362
493void __init plat_early_device_setup(void) 363void __init plat_early_device_setup(void)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index 5d619a551a3b..479e79bdd3d0 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -175,25 +175,18 @@ static struct platform_device scif5_device = {
175}; 175};
176 176
177static struct sh_timer_config tmu0_platform_data = { 177static struct sh_timer_config tmu0_platform_data = {
178 .channel_offset = 0x04, 178 .channels_mask = 7,
179 .timer_bit = 0,
180 .clockevent_rating = 200,
181}; 179};
182 180
183static struct resource tmu0_resources[] = { 181static struct resource tmu0_resources[] = {
184 [0] = { 182 DEFINE_RES_MEM(0xffd80000, 0x30),
185 .start = 0xffd80008, 183 DEFINE_RES_IRQ(evt2irq(0x400)),
186 .end = 0xffd80013, 184 DEFINE_RES_IRQ(evt2irq(0x420)),
187 .flags = IORESOURCE_MEM, 185 DEFINE_RES_IRQ(evt2irq(0x440)),
188 },
189 [1] = {
190 .start = evt2irq(0x400),
191 .flags = IORESOURCE_IRQ,
192 },
193}; 186};
194 187
195static struct platform_device tmu0_device = { 188static struct platform_device tmu0_device = {
196 .name = "sh_tmu", 189 .name = "sh-tmu",
197 .id = 0, 190 .id = 0,
198 .dev = { 191 .dev = {
199 .platform_data = &tmu0_platform_data, 192 .platform_data = &tmu0_platform_data,
@@ -203,25 +196,18 @@ static struct platform_device tmu0_device = {
203}; 196};
204 197
205static struct sh_timer_config tmu1_platform_data = { 198static struct sh_timer_config tmu1_platform_data = {
206 .channel_offset = 0x10, 199 .channels_mask = 7,
207 .timer_bit = 1,
208 .clocksource_rating = 200,
209}; 200};
210 201
211static struct resource tmu1_resources[] = { 202static struct resource tmu1_resources[] = {
212 [0] = { 203 DEFINE_RES_MEM(0xffda0000, 0x2c),
213 .start = 0xffd80014, 204 DEFINE_RES_IRQ(evt2irq(0x480)),
214 .end = 0xffd8001f, 205 DEFINE_RES_IRQ(evt2irq(0x4a0)),
215 .flags = IORESOURCE_MEM, 206 DEFINE_RES_IRQ(evt2irq(0x4c0)),
216 },
217 [1] = {
218 .start = evt2irq(0x420),
219 .flags = IORESOURCE_IRQ,
220 },
221}; 207};
222 208
223static struct platform_device tmu1_device = { 209static struct platform_device tmu1_device = {
224 .name = "sh_tmu", 210 .name = "sh-tmu",
225 .id = 1, 211 .id = 1,
226 .dev = { 212 .dev = {
227 .platform_data = &tmu1_platform_data, 213 .platform_data = &tmu1_platform_data,
@@ -231,24 +217,18 @@ static struct platform_device tmu1_device = {
231}; 217};
232 218
233static struct sh_timer_config tmu2_platform_data = { 219static struct sh_timer_config tmu2_platform_data = {
234 .channel_offset = 0x1c, 220 .channels_mask = 7,
235 .timer_bit = 2,
236}; 221};
237 222
238static struct resource tmu2_resources[] = { 223static struct resource tmu2_resources[] = {
239 [0] = { 224 DEFINE_RES_MEM(0xffdc0000, 0x2c),
240 .start = 0xffd80020, 225 DEFINE_RES_IRQ(evt2irq(0x7a0)),
241 .end = 0xffd8002f, 226 DEFINE_RES_IRQ(evt2irq(0x7a0)),
242 .flags = IORESOURCE_MEM, 227 DEFINE_RES_IRQ(evt2irq(0x7a0)),
243 },
244 [1] = {
245 .start = evt2irq(0x440),
246 .flags = IORESOURCE_IRQ,
247 },
248}; 228};
249 229
250static struct platform_device tmu2_device = { 230static struct platform_device tmu2_device = {
251 .name = "sh_tmu", 231 .name = "sh-tmu",
252 .id = 2, 232 .id = 2,
253 .dev = { 233 .dev = {
254 .platform_data = &tmu2_platform_data, 234 .platform_data = &tmu2_platform_data,
@@ -258,24 +238,18 @@ static struct platform_device tmu2_device = {
258}; 238};
259 239
260static struct sh_timer_config tmu3_platform_data = { 240static struct sh_timer_config tmu3_platform_data = {
261 .channel_offset = 0x04, 241 .channels_mask = 7,
262 .timer_bit = 0,
263}; 242};
264 243
265static struct resource tmu3_resources[] = { 244static struct resource tmu3_resources[] = {
266 [0] = { 245 DEFINE_RES_MEM(0xffde0000, 0x2c),
267 .start = 0xffda0008, 246 DEFINE_RES_IRQ(evt2irq(0x7c0)),
268 .end = 0xffda0013, 247 DEFINE_RES_IRQ(evt2irq(0x7c0)),
269 .flags = IORESOURCE_MEM, 248 DEFINE_RES_IRQ(evt2irq(0x7c0)),
270 },
271 [1] = {
272 .start = evt2irq(0x480),
273 .flags = IORESOURCE_IRQ,
274 },
275}; 249};
276 250
277static struct platform_device tmu3_device = { 251static struct platform_device tmu3_device = {
278 .name = "sh_tmu", 252 .name = "sh-tmu",
279 .id = 3, 253 .id = 3,
280 .dev = { 254 .dev = {
281 .platform_data = &tmu3_platform_data, 255 .platform_data = &tmu3_platform_data,
@@ -284,222 +258,6 @@ static struct platform_device tmu3_device = {
284 .num_resources = ARRAY_SIZE(tmu3_resources), 258 .num_resources = ARRAY_SIZE(tmu3_resources),
285}; 259};
286 260
287static struct sh_timer_config tmu4_platform_data = {
288 .channel_offset = 0x10,
289 .timer_bit = 1,
290};
291
292static struct resource tmu4_resources[] = {
293 [0] = {
294 .start = 0xffda0014,
295 .end = 0xffda001f,
296 .flags = IORESOURCE_MEM,
297 },
298 [1] = {
299 .start = evt2irq(0x4a0),
300 .flags = IORESOURCE_IRQ,
301 },
302};
303
304static struct platform_device tmu4_device = {
305 .name = "sh_tmu",
306 .id = 4,
307 .dev = {
308 .platform_data = &tmu4_platform_data,
309 },
310 .resource = tmu4_resources,
311 .num_resources = ARRAY_SIZE(tmu4_resources),
312};
313
314static struct sh_timer_config tmu5_platform_data = {
315 .channel_offset = 0x1c,
316 .timer_bit = 2,
317};
318
319static struct resource tmu5_resources[] = {
320 [0] = {
321 .start = 0xffda0020,
322 .end = 0xffda002b,
323 .flags = IORESOURCE_MEM,
324 },
325 [1] = {
326 .start = evt2irq(0x4c0),
327 .flags = IORESOURCE_IRQ,
328 },
329};
330
331static struct platform_device tmu5_device = {
332 .name = "sh_tmu",
333 .id = 5,
334 .dev = {
335 .platform_data = &tmu5_platform_data,
336 },
337 .resource = tmu5_resources,
338 .num_resources = ARRAY_SIZE(tmu5_resources),
339};
340
341static struct sh_timer_config tmu6_platform_data = {
342 .channel_offset = 0x04,
343 .timer_bit = 0,
344};
345
346static struct resource tmu6_resources[] = {
347 [0] = {
348 .start = 0xffdc0008,
349 .end = 0xffdc0013,
350 .flags = IORESOURCE_MEM,
351 },
352 [1] = {
353 .start = evt2irq(0x7a0),
354 .flags = IORESOURCE_IRQ,
355 },
356};
357
358static struct platform_device tmu6_device = {
359 .name = "sh_tmu",
360 .id = 6,
361 .dev = {
362 .platform_data = &tmu6_platform_data,
363 },
364 .resource = tmu6_resources,
365 .num_resources = ARRAY_SIZE(tmu6_resources),
366};
367
368static struct sh_timer_config tmu7_platform_data = {
369 .channel_offset = 0x10,
370 .timer_bit = 1,
371};
372
373static struct resource tmu7_resources[] = {
374 [0] = {
375 .start = 0xffdc0014,
376 .end = 0xffdc001f,
377 .flags = IORESOURCE_MEM,
378 },
379 [1] = {
380 .start = evt2irq(0x7a0),
381 .flags = IORESOURCE_IRQ,
382 },
383};
384
385static struct platform_device tmu7_device = {
386 .name = "sh_tmu",
387 .id = 7,
388 .dev = {
389 .platform_data = &tmu7_platform_data,
390 },
391 .resource = tmu7_resources,
392 .num_resources = ARRAY_SIZE(tmu7_resources),
393};
394
395static struct sh_timer_config tmu8_platform_data = {
396 .channel_offset = 0x1c,
397 .timer_bit = 2,
398};
399
400static struct resource tmu8_resources[] = {
401 [0] = {
402 .start = 0xffdc0020,
403 .end = 0xffdc002b,
404 .flags = IORESOURCE_MEM,
405 },
406 [1] = {
407 .start = evt2irq(0x7a0),
408 .flags = IORESOURCE_IRQ,
409 },
410};
411
412static struct platform_device tmu8_device = {
413 .name = "sh_tmu",
414 .id = 8,
415 .dev = {
416 .platform_data = &tmu8_platform_data,
417 },
418 .resource = tmu8_resources,
419 .num_resources = ARRAY_SIZE(tmu8_resources),
420};
421
422static struct sh_timer_config tmu9_platform_data = {
423 .channel_offset = 0x04,
424 .timer_bit = 0,
425};
426
427static struct resource tmu9_resources[] = {
428 [0] = {
429 .start = 0xffde0008,
430 .end = 0xffde0013,
431 .flags = IORESOURCE_MEM,
432 },
433 [1] = {
434 .start = evt2irq(0x7c0),
435 .flags = IORESOURCE_IRQ,
436 },
437};
438
439static struct platform_device tmu9_device = {
440 .name = "sh_tmu",
441 .id = 9,
442 .dev = {
443 .platform_data = &tmu9_platform_data,
444 },
445 .resource = tmu9_resources,
446 .num_resources = ARRAY_SIZE(tmu9_resources),
447};
448
449static struct sh_timer_config tmu10_platform_data = {
450 .channel_offset = 0x10,
451 .timer_bit = 1,
452};
453
454static struct resource tmu10_resources[] = {
455 [0] = {
456 .start = 0xffde0014,
457 .end = 0xffde001f,
458 .flags = IORESOURCE_MEM,
459 },
460 [1] = {
461 .start = evt2irq(0x7c0),
462 .flags = IORESOURCE_IRQ,
463 },
464};
465
466static struct platform_device tmu10_device = {
467 .name = "sh_tmu",
468 .id = 10,
469 .dev = {
470 .platform_data = &tmu10_platform_data,
471 },
472 .resource = tmu10_resources,
473 .num_resources = ARRAY_SIZE(tmu10_resources),
474};
475
476static struct sh_timer_config tmu11_platform_data = {
477 .channel_offset = 0x1c,
478 .timer_bit = 2,
479};
480
481static struct resource tmu11_resources[] = {
482 [0] = {
483 .start = 0xffde0020,
484 .end = 0xffde002b,
485 .flags = IORESOURCE_MEM,
486 },
487 [1] = {
488 .start = evt2irq(0x7c0),
489 .flags = IORESOURCE_IRQ,
490 },
491};
492
493static struct platform_device tmu11_device = {
494 .name = "sh_tmu",
495 .id = 11,
496 .dev = {
497 .platform_data = &tmu11_platform_data,
498 },
499 .resource = tmu11_resources,
500 .num_resources = ARRAY_SIZE(tmu11_resources),
501};
502
503static const struct sh_dmae_channel dmac0_channels[] = { 261static const struct sh_dmae_channel dmac0_channels[] = {
504 { 262 {
505 .offset = 0, 263 .offset = 0,
@@ -641,15 +399,6 @@ static struct platform_device *sh7786_early_devices[] __initdata = {
641 &tmu0_device, 399 &tmu0_device,
642 &tmu1_device, 400 &tmu1_device,
643 &tmu2_device, 401 &tmu2_device,
644 &tmu3_device,
645 &tmu4_device,
646 &tmu5_device,
647 &tmu6_device,
648 &tmu7_device,
649 &tmu8_device,
650 &tmu9_device,
651 &tmu10_device,
652 &tmu11_device,
653}; 402};
654 403
655static struct platform_device *sh7786_devices[] __initdata = { 404static struct platform_device *sh7786_devices[] __initdata = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
index 0856bcbb1da0..a78c5feb4e3b 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
@@ -100,25 +100,18 @@ static struct platform_device scif2_device = {
100}; 100};
101 101
102static struct sh_timer_config tmu0_platform_data = { 102static struct sh_timer_config tmu0_platform_data = {
103 .channel_offset = 0x04, 103 .channels_mask = 7,
104 .timer_bit = 0,
105 .clockevent_rating = 200,
106}; 104};
107 105
108static struct resource tmu0_resources[] = { 106static struct resource tmu0_resources[] = {
109 [0] = { 107 DEFINE_RES_MEM(0xffc10000, 0x30),
110 .start = 0xffc10008, 108 DEFINE_RES_IRQ(evt2irq(0x400)),
111 .end = 0xffc10013, 109 DEFINE_RES_IRQ(evt2irq(0x420)),
112 .flags = IORESOURCE_MEM, 110 DEFINE_RES_IRQ(evt2irq(0x440)),
113 },
114 [1] = {
115 .start = evt2irq(0x400),
116 .flags = IORESOURCE_IRQ,
117 },
118}; 111};
119 112
120static struct platform_device tmu0_device = { 113static struct platform_device tmu0_device = {
121 .name = "sh_tmu", 114 .name = "sh-tmu",
122 .id = 0, 115 .id = 0,
123 .dev = { 116 .dev = {
124 .platform_data = &tmu0_platform_data, 117 .platform_data = &tmu0_platform_data,
@@ -128,25 +121,18 @@ static struct platform_device tmu0_device = {
128}; 121};
129 122
130static struct sh_timer_config tmu1_platform_data = { 123static struct sh_timer_config tmu1_platform_data = {
131 .channel_offset = 0x10, 124 .channels_mask = 7,
132 .timer_bit = 1,
133 .clocksource_rating = 200,
134}; 125};
135 126
136static struct resource tmu1_resources[] = { 127static struct resource tmu1_resources[] = {
137 [0] = { 128 DEFINE_RES_MEM(0xffc20000, 0x2c),
138 .start = 0xffc10014, 129 DEFINE_RES_IRQ(evt2irq(0x460)),
139 .end = 0xffc1001f, 130 DEFINE_RES_IRQ(evt2irq(0x480)),
140 .flags = IORESOURCE_MEM, 131 DEFINE_RES_IRQ(evt2irq(0x4a0)),
141 },
142 [1] = {
143 .start = evt2irq(0x420),
144 .flags = IORESOURCE_IRQ,
145 },
146}; 132};
147 133
148static struct platform_device tmu1_device = { 134static struct platform_device tmu1_device = {
149 .name = "sh_tmu", 135 .name = "sh-tmu",
150 .id = 1, 136 .id = 1,
151 .dev = { 137 .dev = {
152 .platform_data = &tmu1_platform_data, 138 .platform_data = &tmu1_platform_data,
@@ -155,124 +141,12 @@ static struct platform_device tmu1_device = {
155 .num_resources = ARRAY_SIZE(tmu1_resources), 141 .num_resources = ARRAY_SIZE(tmu1_resources),
156}; 142};
157 143
158static struct sh_timer_config tmu2_platform_data = {
159 .channel_offset = 0x1c,
160 .timer_bit = 2,
161};
162
163static struct resource tmu2_resources[] = {
164 [0] = {
165 .start = 0xffc10020,
166 .end = 0xffc1002f,
167 .flags = IORESOURCE_MEM,
168 },
169 [1] = {
170 .start = evt2irq(0x440),
171 .flags = IORESOURCE_IRQ,
172 },
173};
174
175static struct platform_device tmu2_device = {
176 .name = "sh_tmu",
177 .id = 2,
178 .dev = {
179 .platform_data = &tmu2_platform_data,
180 },
181 .resource = tmu2_resources,
182 .num_resources = ARRAY_SIZE(tmu2_resources),
183};
184
185static struct sh_timer_config tmu3_platform_data = {
186 .channel_offset = 0x04,
187 .timer_bit = 0,
188};
189
190static struct resource tmu3_resources[] = {
191 [0] = {
192 .start = 0xffc20008,
193 .end = 0xffc20013,
194 .flags = IORESOURCE_MEM,
195 },
196 [1] = {
197 .start = evt2irq(0x460),
198 .flags = IORESOURCE_IRQ,
199 },
200};
201
202static struct platform_device tmu3_device = {
203 .name = "sh_tmu",
204 .id = 3,
205 .dev = {
206 .platform_data = &tmu3_platform_data,
207 },
208 .resource = tmu3_resources,
209 .num_resources = ARRAY_SIZE(tmu3_resources),
210};
211
212static struct sh_timer_config tmu4_platform_data = {
213 .channel_offset = 0x10,
214 .timer_bit = 1,
215};
216
217static struct resource tmu4_resources[] = {
218 [0] = {
219 .start = 0xffc20014,
220 .end = 0xffc2001f,
221 .flags = IORESOURCE_MEM,
222 },
223 [1] = {
224 .start = evt2irq(0x480),
225 .flags = IORESOURCE_IRQ,
226 },
227};
228
229static struct platform_device tmu4_device = {
230 .name = "sh_tmu",
231 .id = 4,
232 .dev = {
233 .platform_data = &tmu4_platform_data,
234 },
235 .resource = tmu4_resources,
236 .num_resources = ARRAY_SIZE(tmu4_resources),
237};
238
239static struct sh_timer_config tmu5_platform_data = {
240 .channel_offset = 0x1c,
241 .timer_bit = 2,
242};
243
244static struct resource tmu5_resources[] = {
245 [0] = {
246 .start = 0xffc20020,
247 .end = 0xffc2002b,
248 .flags = IORESOURCE_MEM,
249 },
250 [1] = {
251 .start = evt2irq(0x4a0),
252 .flags = IORESOURCE_IRQ,
253 },
254};
255
256static struct platform_device tmu5_device = {
257 .name = "sh_tmu",
258 .id = 5,
259 .dev = {
260 .platform_data = &tmu5_platform_data,
261 },
262 .resource = tmu5_resources,
263 .num_resources = ARRAY_SIZE(tmu5_resources),
264};
265
266static struct platform_device *shx3_early_devices[] __initdata = { 144static struct platform_device *shx3_early_devices[] __initdata = {
267 &scif0_device, 145 &scif0_device,
268 &scif1_device, 146 &scif1_device,
269 &scif2_device, 147 &scif2_device,
270 &tmu0_device, 148 &tmu0_device,
271 &tmu1_device, 149 &tmu1_device,
272 &tmu2_device,
273 &tmu3_device,
274 &tmu4_device,
275 &tmu5_device,
276}; 150};
277 151
278static int __init shx3_devices_setup(void) 152static int __init shx3_devices_setup(void)
diff --git a/arch/sh/kernel/cpu/sh5/setup-sh5.c b/arch/sh/kernel/cpu/sh5/setup-sh5.c
index 14d68213d16b..1bf0b2cf6652 100644
--- a/arch/sh/kernel/cpu/sh5/setup-sh5.c
+++ b/arch/sh/kernel/cpu/sh5/setup-sh5.c
@@ -71,30 +71,20 @@ static struct platform_device rtc_device = {
71 71
72#define TMU_BLOCK_OFF 0x01020000 72#define TMU_BLOCK_OFF 0x01020000
73#define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF 73#define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
74#define TMU0_BASE (TMU_BASE + 0x8 + (0xc * 0x0))
75#define TMU1_BASE (TMU_BASE + 0x8 + (0xc * 0x1))
76#define TMU2_BASE (TMU_BASE + 0x8 + (0xc * 0x2))
77 74
78static struct sh_timer_config tmu0_platform_data = { 75static struct sh_timer_config tmu0_platform_data = {
79 .channel_offset = 0x04, 76 .channels_mask = 7,
80 .timer_bit = 0,
81 .clockevent_rating = 200,
82}; 77};
83 78
84static struct resource tmu0_resources[] = { 79static struct resource tmu0_resources[] = {
85 [0] = { 80 DEFINE_RES_MEM(TMU_BASE, 0x30),
86 .start = TMU0_BASE, 81 DEFINE_RES_IRQ(IRQ_TUNI0),
87 .end = TMU0_BASE + 0xc - 1, 82 DEFINE_RES_IRQ(IRQ_TUNI1),
88 .flags = IORESOURCE_MEM, 83 DEFINE_RES_IRQ(IRQ_TUNI2),
89 },
90 [1] = {
91 .start = IRQ_TUNI0,
92 .flags = IORESOURCE_IRQ,
93 },
94}; 84};
95 85
96static struct platform_device tmu0_device = { 86static struct platform_device tmu0_device = {
97 .name = "sh_tmu", 87 .name = "sh-tmu",
98 .id = 0, 88 .id = 0,
99 .dev = { 89 .dev = {
100 .platform_data = &tmu0_platform_data, 90 .platform_data = &tmu0_platform_data,
@@ -103,66 +93,9 @@ static struct platform_device tmu0_device = {
103 .num_resources = ARRAY_SIZE(tmu0_resources), 93 .num_resources = ARRAY_SIZE(tmu0_resources),
104}; 94};
105 95
106static struct sh_timer_config tmu1_platform_data = {
107 .channel_offset = 0x10,
108 .timer_bit = 1,
109 .clocksource_rating = 200,
110};
111
112static struct resource tmu1_resources[] = {
113 [0] = {
114 .start = TMU1_BASE,
115 .end = TMU1_BASE + 0xc - 1,
116 .flags = IORESOURCE_MEM,
117 },
118 [1] = {
119 .start = IRQ_TUNI1,
120 .flags = IORESOURCE_IRQ,
121 },
122};
123
124static struct platform_device tmu1_device = {
125 .name = "sh_tmu",
126 .id = 1,
127 .dev = {
128 .platform_data = &tmu1_platform_data,
129 },
130 .resource = tmu1_resources,
131 .num_resources = ARRAY_SIZE(tmu1_resources),
132};
133
134static struct sh_timer_config tmu2_platform_data = {
135 .channel_offset = 0x1c,
136 .timer_bit = 2,
137};
138
139static struct resource tmu2_resources[] = {
140 [0] = {
141 .start = TMU2_BASE,
142 .end = TMU2_BASE + 0xc - 1,
143 .flags = IORESOURCE_MEM,
144 },
145 [1] = {
146 .start = IRQ_TUNI2,
147 .flags = IORESOURCE_IRQ,
148 },
149};
150
151static struct platform_device tmu2_device = {
152 .name = "sh_tmu",
153 .id = 2,
154 .dev = {
155 .platform_data = &tmu2_platform_data,
156 },
157 .resource = tmu2_resources,
158 .num_resources = ARRAY_SIZE(tmu2_resources),
159};
160
161static struct platform_device *sh5_early_devices[] __initdata = { 96static struct platform_device *sh5_early_devices[] __initdata = {
162 &scif0_device, 97 &scif0_device,
163 &tmu0_device, 98 &tmu0_device,
164 &tmu1_device,
165 &tmu2_device,
166}; 99};
167 100
168static struct platform_device *sh5_devices[] __initdata = { 101static struct platform_device *sh5_devices[] __initdata = {
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h
index dc503297481f..53e9b4987db0 100644
--- a/arch/sparc/include/asm/pci_32.h
+++ b/arch/sparc/include/asm/pci_32.h
@@ -16,11 +16,6 @@
16 16
17#define PCI_IRQ_NONE 0xffffffff 17#define PCI_IRQ_NONE 0xffffffff
18 18
19static inline void pcibios_penalize_isa_irq(int irq, int active)
20{
21 /* We don't do dynamic PCI IRQ allocation */
22}
23
24/* Dynamic DMA mapping stuff. 19/* Dynamic DMA mapping stuff.
25 */ 20 */
26#define PCI_DMA_BUS_IS_PHYS (0) 21#define PCI_DMA_BUS_IS_PHYS (0)
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index 1633b718d3bc..c6c7396e7627 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -16,11 +16,6 @@
16 16
17#define PCI_IRQ_NONE 0xffffffff 17#define PCI_IRQ_NONE 0xffffffff
18 18
19static inline void pcibios_penalize_isa_irq(int irq, int active)
20{
21 /* We don't do dynamic PCI IRQ allocation */
22}
23
24/* The PCI address space does not equal the physical memory 19/* The PCI address space does not equal the physical memory
25 * address space. The networking and block device layers use 20 * address space. The networking and block device layers use
26 * this boolean for bounce buffer decisions. 21 * this boolean for bounce buffer decisions.
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 0f9e94537eee..1a49ffdf9da9 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -24,7 +24,8 @@
24 24
25/* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB). 25/* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB).
26 * The page copy blockops can use 0x6000000 to 0x8000000. 26 * The page copy blockops can use 0x6000000 to 0x8000000.
27 * The TSB is mapped in the 0x8000000 to 0xa000000 range. 27 * The 8K TSB is mapped in the 0x8000000 to 0x8400000 range.
28 * The 4M TSB is mapped in the 0x8400000 to 0x8800000 range.
28 * The PROM resides in an area spanning 0xf0000000 to 0x100000000. 29 * The PROM resides in an area spanning 0xf0000000 to 0x100000000.
29 * The vmalloc area spans 0x100000000 to 0x200000000. 30 * The vmalloc area spans 0x100000000 to 0x200000000.
30 * Since modules need to be in the lowest 32-bits of the address space, 31 * Since modules need to be in the lowest 32-bits of the address space,
@@ -33,7 +34,8 @@
33 * 0x400000000. 34 * 0x400000000.
34 */ 35 */
35#define TLBTEMP_BASE _AC(0x0000000006000000,UL) 36#define TLBTEMP_BASE _AC(0x0000000006000000,UL)
36#define TSBMAP_BASE _AC(0x0000000008000000,UL) 37#define TSBMAP_8K_BASE _AC(0x0000000008000000,UL)
38#define TSBMAP_4M_BASE _AC(0x0000000008400000,UL)
37#define MODULES_VADDR _AC(0x0000000010000000,UL) 39#define MODULES_VADDR _AC(0x0000000010000000,UL)
38#define MODULES_LEN _AC(0x00000000e0000000,UL) 40#define MODULES_LEN _AC(0x00000000e0000000,UL)
39#define MODULES_END _AC(0x00000000f0000000,UL) 41#define MODULES_END _AC(0x00000000f0000000,UL)
@@ -71,6 +73,23 @@
71 73
72#include <linux/sched.h> 74#include <linux/sched.h>
73 75
76extern unsigned long sparc64_valid_addr_bitmap[];
77
78/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
79static inline bool __kern_addr_valid(unsigned long paddr)
80{
81 if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL)
82 return false;
83 return test_bit(paddr >> ILOG2_4MB, sparc64_valid_addr_bitmap);
84}
85
86static inline bool kern_addr_valid(unsigned long addr)
87{
88 unsigned long paddr = __pa(addr);
89
90 return __kern_addr_valid(paddr);
91}
92
74/* Entries per page directory level. */ 93/* Entries per page directory level. */
75#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3)) 94#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3))
76#define PTRS_PER_PMD (1UL << PMD_BITS) 95#define PTRS_PER_PMD (1UL << PMD_BITS)
@@ -79,9 +98,12 @@
79/* Kernel has a separate 44bit address space. */ 98/* Kernel has a separate 44bit address space. */
80#define FIRST_USER_ADDRESS 0 99#define FIRST_USER_ADDRESS 0
81 100
82#define pte_ERROR(e) __builtin_trap() 101#define pmd_ERROR(e) \
83#define pmd_ERROR(e) __builtin_trap() 102 pr_err("%s:%d: bad pmd %p(%016lx) seen at (%pS)\n", \
84#define pgd_ERROR(e) __builtin_trap() 103 __FILE__, __LINE__, &(e), pmd_val(e), __builtin_return_address(0))
104#define pgd_ERROR(e) \
105 pr_err("%s:%d: bad pgd %p(%016lx) seen at (%pS)\n", \
106 __FILE__, __LINE__, &(e), pgd_val(e), __builtin_return_address(0))
85 107
86#endif /* !(__ASSEMBLY__) */ 108#endif /* !(__ASSEMBLY__) */
87 109
@@ -258,8 +280,8 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)
258{ 280{
259 unsigned long mask, tmp; 281 unsigned long mask, tmp;
260 282
261 /* SUN4U: 0x600307ffffffecb8 (negated == 0x9ffcf80000001347) 283 /* SUN4U: 0x630107ffffffec38 (negated == 0x9cfef800000013c7)
262 * SUN4V: 0x30ffffffffffee17 (negated == 0xcf000000000011e8) 284 * SUN4V: 0x33ffffffffffee07 (negated == 0xcc000000000011f8)
263 * 285 *
264 * Even if we use negation tricks the result is still a 6 286 * Even if we use negation tricks the result is still a 6
265 * instruction sequence, so don't try to play fancy and just 287 * instruction sequence, so don't try to play fancy and just
@@ -289,10 +311,10 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)
289 " .previous\n" 311 " .previous\n"
290 : "=r" (mask), "=r" (tmp) 312 : "=r" (mask), "=r" (tmp)
291 : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U | 313 : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U |
292 _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U | 314 _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U |
293 _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U), 315 _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U),
294 "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | 316 "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V |
295 _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V | 317 _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V |
296 _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V)); 318 _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V));
297 319
298 return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask)); 320 return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask));
@@ -633,7 +655,7 @@ static inline unsigned long pmd_large(pmd_t pmd)
633{ 655{
634 pte_t pte = __pte(pmd_val(pmd)); 656 pte_t pte = __pte(pmd_val(pmd));
635 657
636 return (pte_val(pte) & _PAGE_PMD_HUGE) && pte_present(pte); 658 return pte_val(pte) & _PAGE_PMD_HUGE;
637} 659}
638 660
639#ifdef CONFIG_TRANSPARENT_HUGEPAGE 661#ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -719,20 +741,6 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd)
719 return __pmd(pte_val(pte)); 741 return __pmd(pte_val(pte));
720} 742}
721 743
722static inline pmd_t pmd_mknotpresent(pmd_t pmd)
723{
724 unsigned long mask;
725
726 if (tlb_type == hypervisor)
727 mask = _PAGE_PRESENT_4V;
728 else
729 mask = _PAGE_PRESENT_4U;
730
731 pmd_val(pmd) &= ~mask;
732
733 return pmd;
734}
735
736static inline pmd_t pmd_mksplitting(pmd_t pmd) 744static inline pmd_t pmd_mksplitting(pmd_t pmd)
737{ 745{
738 pte_t pte = __pte(pmd_val(pmd)); 746 pte_t pte = __pte(pmd_val(pmd));
@@ -757,6 +765,20 @@ static inline int pmd_present(pmd_t pmd)
757 765
758#define pmd_none(pmd) (!pmd_val(pmd)) 766#define pmd_none(pmd) (!pmd_val(pmd))
759 767
768/* pmd_bad() is only called on non-trans-huge PMDs. Our encoding is
769 * very simple, it's just the physical address. PTE tables are of
770 * size PAGE_SIZE so make sure the sub-PAGE_SIZE bits are clear and
771 * the top bits outside of the range of any physical address size we
772 * support are clear as well. We also validate the physical itself.
773 */
774#define pmd_bad(pmd) ((pmd_val(pmd) & ~PAGE_MASK) || \
775 !__kern_addr_valid(pmd_val(pmd)))
776
777#define pud_none(pud) (!pud_val(pud))
778
779#define pud_bad(pud) ((pud_val(pud) & ~PAGE_MASK) || \
780 !__kern_addr_valid(pud_val(pud)))
781
760#ifdef CONFIG_TRANSPARENT_HUGEPAGE 782#ifdef CONFIG_TRANSPARENT_HUGEPAGE
761extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, 783extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
762 pmd_t *pmdp, pmd_t pmd); 784 pmd_t *pmdp, pmd_t pmd);
@@ -790,10 +812,7 @@ static inline unsigned long __pmd_page(pmd_t pmd)
790#define pud_page_vaddr(pud) \ 812#define pud_page_vaddr(pud) \
791 ((unsigned long) __va(pud_val(pud))) 813 ((unsigned long) __va(pud_val(pud)))
792#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud)) 814#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud))
793#define pmd_bad(pmd) (0)
794#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) 815#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
795#define pud_none(pud) (!pud_val(pud))
796#define pud_bad(pud) (0)
797#define pud_present(pud) (pud_val(pud) != 0U) 816#define pud_present(pud) (pud_val(pud) != 0U)
798#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) 817#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL)
799 818
@@ -893,6 +912,10 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
893extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, 912extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
894 pmd_t *pmd); 913 pmd_t *pmd);
895 914
915#define __HAVE_ARCH_PMDP_INVALIDATE
916extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
917 pmd_t *pmdp);
918
896#define __HAVE_ARCH_PGTABLE_DEPOSIT 919#define __HAVE_ARCH_PGTABLE_DEPOSIT
897extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, 920extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
898 pgtable_t pgtable); 921 pgtable_t pgtable);
@@ -919,18 +942,6 @@ extern unsigned long pte_file(pte_t);
919extern pte_t pgoff_to_pte(unsigned long); 942extern pte_t pgoff_to_pte(unsigned long);
920#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) 943#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
921 944
922extern unsigned long sparc64_valid_addr_bitmap[];
923
924/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
925static inline bool kern_addr_valid(unsigned long addr)
926{
927 unsigned long paddr = __pa(addr);
928
929 if ((paddr >> 41UL) != 0UL)
930 return false;
931 return test_bit(paddr >> 22, sparc64_valid_addr_bitmap);
932}
933
934extern int page_in_phys_avail(unsigned long paddr); 945extern int page_in_phys_avail(unsigned long paddr);
935 946
936/* 947/*
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index 2230f80d9fe3..90916f955cac 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -171,7 +171,8 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
171 andcc REG1, REG2, %g0; \ 171 andcc REG1, REG2, %g0; \
172 be,pt %xcc, 700f; \ 172 be,pt %xcc, 700f; \
173 sethi %hi(4 * 1024 * 1024), REG2; \ 173 sethi %hi(4 * 1024 * 1024), REG2; \
174 andn REG1, REG2, REG1; \ 174 brgez,pn REG1, FAIL_LABEL; \
175 andn REG1, REG2, REG1; \
175 and VADDR, REG2, REG2; \ 176 and VADDR, REG2, REG2; \
176 brlz,pt REG1, PTE_LABEL; \ 177 brlz,pt REG1, PTE_LABEL; \
177 or REG1, REG2, REG1; \ 178 or REG1, REG2, REG1; \
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 26b706a1867d..452f04fe8da6 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -282,8 +282,8 @@ sun4v_chip_type:
282 stx %l2, [%l4 + 0x0] 282 stx %l2, [%l4 + 0x0]
283 ldx [%sp + 2047 + 128 + 0x50], %l3 ! physaddr low 283 ldx [%sp + 2047 + 128 + 0x50], %l3 ! physaddr low
284 /* 4MB align */ 284 /* 4MB align */
285 srlx %l3, 22, %l3 285 srlx %l3, ILOG2_4MB, %l3
286 sllx %l3, 22, %l3 286 sllx %l3, ILOG2_4MB, %l3
287 stx %l3, [%l4 + 0x8] 287 stx %l3, [%l4 + 0x8]
288 288
289 /* Leave service as-is, "call-method" */ 289 /* Leave service as-is, "call-method" */
diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S
index 542e96ac4d39..605d49204580 100644
--- a/arch/sparc/kernel/ktlb.S
+++ b/arch/sparc/kernel/ktlb.S
@@ -277,7 +277,7 @@ kvmap_dtlb_load:
277#ifdef CONFIG_SPARSEMEM_VMEMMAP 277#ifdef CONFIG_SPARSEMEM_VMEMMAP
278kvmap_vmemmap: 278kvmap_vmemmap:
279 sub %g4, %g5, %g5 279 sub %g4, %g5, %g5
280 srlx %g5, 22, %g5 280 srlx %g5, ILOG2_4MB, %g5
281 sethi %hi(vmemmap_table), %g1 281 sethi %hi(vmemmap_table), %g1
282 sllx %g5, 3, %g5 282 sllx %g5, 3, %g5
283 or %g1, %lo(vmemmap_table), %g1 283 or %g1, %lo(vmemmap_table), %g1
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
index 6479256fd5a4..337094556916 100644
--- a/arch/sparc/kernel/nmi.c
+++ b/arch/sparc/kernel/nmi.c
@@ -68,27 +68,16 @@ EXPORT_SYMBOL(touch_nmi_watchdog);
68 68
69static void die_nmi(const char *str, struct pt_regs *regs, int do_panic) 69static void die_nmi(const char *str, struct pt_regs *regs, int do_panic)
70{ 70{
71 int this_cpu = smp_processor_id();
72
71 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, 73 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0,
72 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) 74 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
73 return; 75 return;
74 76
75 console_verbose();
76 bust_spinlocks(1);
77
78 printk(KERN_EMERG "%s", str);
79 printk(" on CPU%d, ip %08lx, registers:\n",
80 smp_processor_id(), regs->tpc);
81 show_regs(regs);
82 dump_stack();
83
84 bust_spinlocks(0);
85
86 if (do_panic || panic_on_oops) 77 if (do_panic || panic_on_oops)
87 panic("Non maskable interrupt"); 78 panic("Watchdog detected hard LOCKUP on cpu %d", this_cpu);
88 79 else
89 nmi_exit(); 80 WARN(1, "Watchdog detected hard LOCKUP on cpu %d", this_cpu);
90 local_irq_enable();
91 do_exit(SIGBUS);
92} 81}
93 82
94notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs) 83notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 1555bbcae1ee..857ad77df9c0 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -543,8 +543,7 @@ static void pci_of_scan_bus(struct pci_pbm_info *pbm,
543 printk("PCI: dev header type: %x\n", 543 printk("PCI: dev header type: %x\n",
544 dev->hdr_type); 544 dev->hdr_type);
545 545
546 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 546 if (pci_is_bridge(dev))
547 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
548 of_scan_pci_bridge(pbm, child, dev); 547 of_scan_pci_bridge(pbm, child, dev);
549 } 548 }
550} 549}
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 9781048161ab..745a3633ce14 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -149,7 +149,7 @@ void cpu_panic(void)
149#define NUM_ROUNDS 64 /* magic value */ 149#define NUM_ROUNDS 64 /* magic value */
150#define NUM_ITERS 5 /* likewise */ 150#define NUM_ITERS 5 /* likewise */
151 151
152static DEFINE_SPINLOCK(itc_sync_lock); 152static DEFINE_RAW_SPINLOCK(itc_sync_lock);
153static unsigned long go[SLAVE + 1]; 153static unsigned long go[SLAVE + 1];
154 154
155#define DEBUG_TICK_SYNC 0 155#define DEBUG_TICK_SYNC 0
@@ -257,7 +257,7 @@ static void smp_synchronize_one_tick(int cpu)
257 go[MASTER] = 0; 257 go[MASTER] = 0;
258 membar_safe("#StoreLoad"); 258 membar_safe("#StoreLoad");
259 259
260 spin_lock_irqsave(&itc_sync_lock, flags); 260 raw_spin_lock_irqsave(&itc_sync_lock, flags);
261 { 261 {
262 for (i = 0; i < NUM_ROUNDS*NUM_ITERS; i++) { 262 for (i = 0; i < NUM_ROUNDS*NUM_ITERS; i++) {
263 while (!go[MASTER]) 263 while (!go[MASTER])
@@ -268,7 +268,7 @@ static void smp_synchronize_one_tick(int cpu)
268 membar_safe("#StoreLoad"); 268 membar_safe("#StoreLoad");
269 } 269 }
270 } 270 }
271 spin_unlock_irqrestore(&itc_sync_lock, flags); 271 raw_spin_unlock_irqrestore(&itc_sync_lock, flags);
272} 272}
273 273
274#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) 274#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index f7c72b6efc27..d066eb18650c 100644
--- a/arch/sparc/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
@@ -44,7 +44,7 @@ SIGN1(sys32_timer_settime, compat_sys_timer_settime, %o1)
44SIGN1(sys32_io_submit, compat_sys_io_submit, %o1) 44SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
45SIGN1(sys32_mq_open, compat_sys_mq_open, %o1) 45SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
46SIGN1(sys32_select, compat_sys_select, %o0) 46SIGN1(sys32_select, compat_sys_select, %o0)
47SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) 47SIGN1(sys32_futex, compat_sys_futex, %o1)
48SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0) 48SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0)
49SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0) 49SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
50SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0) 50SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index a364000ca1aa..7f41d40b7e6e 100644
--- a/arch/sparc/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -151,7 +151,7 @@ static ssize_t store_mmustat_enable(struct device *s,
151 size_t count) 151 size_t count)
152{ 152{
153 unsigned long val, err; 153 unsigned long val, err;
154 int ret = sscanf(buf, "%ld", &val); 154 int ret = sscanf(buf, "%lu", &val);
155 155
156 if (ret != 1) 156 if (ret != 1)
157 return -EINVAL; 157 return -EINVAL;
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index 3c1a7cb31579..35ab8b60d256 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -166,17 +166,23 @@ static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
166unsigned long compute_effective_address(struct pt_regs *regs, 166unsigned long compute_effective_address(struct pt_regs *regs,
167 unsigned int insn, unsigned int rd) 167 unsigned int insn, unsigned int rd)
168{ 168{
169 int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
169 unsigned int rs1 = (insn >> 14) & 0x1f; 170 unsigned int rs1 = (insn >> 14) & 0x1f;
170 unsigned int rs2 = insn & 0x1f; 171 unsigned int rs2 = insn & 0x1f;
171 int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; 172 unsigned long addr;
172 173
173 if (insn & 0x2000) { 174 if (insn & 0x2000) {
174 maybe_flush_windows(rs1, 0, rd, from_kernel); 175 maybe_flush_windows(rs1, 0, rd, from_kernel);
175 return (fetch_reg(rs1, regs) + sign_extend_imm13(insn)); 176 addr = (fetch_reg(rs1, regs) + sign_extend_imm13(insn));
176 } else { 177 } else {
177 maybe_flush_windows(rs1, rs2, rd, from_kernel); 178 maybe_flush_windows(rs1, rs2, rd, from_kernel);
178 return (fetch_reg(rs1, regs) + fetch_reg(rs2, regs)); 179 addr = (fetch_reg(rs1, regs) + fetch_reg(rs2, regs));
179 } 180 }
181
182 if (!from_kernel && test_thread_flag(TIF_32BIT))
183 addr &= 0xffffffff;
184
185 return addr;
180} 186}
181 187
182/* This is just to make gcc think die_if_kernel does return... */ 188/* This is just to make gcc think die_if_kernel does return... */
diff --git a/arch/sparc/lib/NG2memcpy.S b/arch/sparc/lib/NG2memcpy.S
index 2c20ad63ddbf..30eee6e8a81b 100644
--- a/arch/sparc/lib/NG2memcpy.S
+++ b/arch/sparc/lib/NG2memcpy.S
@@ -236,6 +236,7 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
236 */ 236 */
237 VISEntryHalf 237 VISEntryHalf
238 238
239 membar #Sync
239 alignaddr %o1, %g0, %g0 240 alignaddr %o1, %g0, %g0
240 241
241 add %o1, (64 - 1), %o4 242 add %o1, (64 - 1), %o4
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 69bb818fdd79..4ced3fc66130 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -96,38 +96,51 @@ static unsigned int get_user_insn(unsigned long tpc)
96 pte_t *ptep, pte; 96 pte_t *ptep, pte;
97 unsigned long pa; 97 unsigned long pa;
98 u32 insn = 0; 98 u32 insn = 0;
99 unsigned long pstate;
100 99
101 if (pgd_none(*pgdp)) 100 if (pgd_none(*pgdp) || unlikely(pgd_bad(*pgdp)))
102 goto outret; 101 goto out;
103 pudp = pud_offset(pgdp, tpc); 102 pudp = pud_offset(pgdp, tpc);
104 if (pud_none(*pudp)) 103 if (pud_none(*pudp) || unlikely(pud_bad(*pudp)))
105 goto outret; 104 goto out;
106 pmdp = pmd_offset(pudp, tpc);
107 if (pmd_none(*pmdp))
108 goto outret;
109 105
110 /* This disables preemption for us as well. */ 106 /* This disables preemption for us as well. */
111 __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate)); 107 local_irq_disable();
112 __asm__ __volatile__("wrpr %0, %1, %%pstate" 108
113 : : "r" (pstate), "i" (PSTATE_IE)); 109 pmdp = pmd_offset(pudp, tpc);
114 ptep = pte_offset_map(pmdp, tpc); 110 if (pmd_none(*pmdp) || unlikely(pmd_bad(*pmdp)))
115 pte = *ptep; 111 goto out_irq_enable;
116 if (!pte_present(pte))
117 goto out;
118 112
119 pa = (pte_pfn(pte) << PAGE_SHIFT); 113#ifdef CONFIG_TRANSPARENT_HUGEPAGE
120 pa += (tpc & ~PAGE_MASK); 114 if (pmd_trans_huge(*pmdp)) {
115 if (pmd_trans_splitting(*pmdp))
116 goto out_irq_enable;
121 117
122 /* Use phys bypass so we don't pollute dtlb/dcache. */ 118 pa = pmd_pfn(*pmdp) << PAGE_SHIFT;
123 __asm__ __volatile__("lduwa [%1] %2, %0" 119 pa += tpc & ~HPAGE_MASK;
124 : "=r" (insn)
125 : "r" (pa), "i" (ASI_PHYS_USE_EC));
126 120
121 /* Use phys bypass so we don't pollute dtlb/dcache. */
122 __asm__ __volatile__("lduwa [%1] %2, %0"
123 : "=r" (insn)
124 : "r" (pa), "i" (ASI_PHYS_USE_EC));
125 } else
126#endif
127 {
128 ptep = pte_offset_map(pmdp, tpc);
129 pte = *ptep;
130 if (pte_present(pte)) {
131 pa = (pte_pfn(pte) << PAGE_SHIFT);
132 pa += (tpc & ~PAGE_MASK);
133
134 /* Use phys bypass so we don't pollute dtlb/dcache. */
135 __asm__ __volatile__("lduwa [%1] %2, %0"
136 : "=r" (insn)
137 : "r" (pa), "i" (ASI_PHYS_USE_EC));
138 }
139 pte_unmap(ptep);
140 }
141out_irq_enable:
142 local_irq_enable();
127out: 143out:
128 pte_unmap(ptep);
129 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate));
130outret:
131 return insn; 144 return insn;
132} 145}
133 146
@@ -153,7 +166,8 @@ show_signal_msg(struct pt_regs *regs, int sig, int code,
153} 166}
154 167
155static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, 168static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
156 unsigned int insn, int fault_code) 169 unsigned long fault_addr, unsigned int insn,
170 int fault_code)
157{ 171{
158 unsigned long addr; 172 unsigned long addr;
159 siginfo_t info; 173 siginfo_t info;
@@ -161,10 +175,18 @@ static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
161 info.si_code = code; 175 info.si_code = code;
162 info.si_signo = sig; 176 info.si_signo = sig;
163 info.si_errno = 0; 177 info.si_errno = 0;
164 if (fault_code & FAULT_CODE_ITLB) 178 if (fault_code & FAULT_CODE_ITLB) {
165 addr = regs->tpc; 179 addr = regs->tpc;
166 else 180 } else {
167 addr = compute_effective_address(regs, insn, 0); 181 /* If we were able to probe the faulting instruction, use it
182 * to compute a precise fault address. Otherwise use the fault
183 * time provided address which may only have page granularity.
184 */
185 if (insn)
186 addr = compute_effective_address(regs, insn, 0);
187 else
188 addr = fault_addr;
189 }
168 info.si_addr = (void __user *) addr; 190 info.si_addr = (void __user *) addr;
169 info.si_trapno = 0; 191 info.si_trapno = 0;
170 192
@@ -239,7 +261,7 @@ static void __kprobes do_kernel_fault(struct pt_regs *regs, int si_code,
239 /* The si_code was set to make clear whether 261 /* The si_code was set to make clear whether
240 * this was a SEGV_MAPERR or SEGV_ACCERR fault. 262 * this was a SEGV_MAPERR or SEGV_ACCERR fault.
241 */ 263 */
242 do_fault_siginfo(si_code, SIGSEGV, regs, insn, fault_code); 264 do_fault_siginfo(si_code, SIGSEGV, regs, address, insn, fault_code);
243 return; 265 return;
244 } 266 }
245 267
@@ -259,18 +281,6 @@ static void noinline __kprobes bogus_32bit_fault_tpc(struct pt_regs *regs)
259 show_regs(regs); 281 show_regs(regs);
260} 282}
261 283
262static void noinline __kprobes bogus_32bit_fault_address(struct pt_regs *regs,
263 unsigned long addr)
264{
265 static int times;
266
267 if (times++ < 10)
268 printk(KERN_ERR "FAULT[%s:%d]: 32-bit process "
269 "reports 64-bit fault address [%lx]\n",
270 current->comm, current->pid, addr);
271 show_regs(regs);
272}
273
274asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) 284asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
275{ 285{
276 enum ctx_state prev_state = exception_enter(); 286 enum ctx_state prev_state = exception_enter();
@@ -300,10 +310,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
300 goto intr_or_no_mm; 310 goto intr_or_no_mm;
301 } 311 }
302 } 312 }
303 if (unlikely((address >> 32) != 0)) { 313 if (unlikely((address >> 32) != 0))
304 bogus_32bit_fault_address(regs, address);
305 goto intr_or_no_mm; 314 goto intr_or_no_mm;
306 }
307 } 315 }
308 316
309 if (regs->tstate & TSTATE_PRIV) { 317 if (regs->tstate & TSTATE_PRIV) {
@@ -525,7 +533,7 @@ do_sigbus:
525 * Send a sigbus, regardless of whether we were in kernel 533 * Send a sigbus, regardless of whether we were in kernel
526 * or user mode. 534 * or user mode.
527 */ 535 */
528 do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, insn, fault_code); 536 do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, address, insn, fault_code);
529 537
530 /* Kernel mode? Handle exceptions or die */ 538 /* Kernel mode? Handle exceptions or die */
531 if (regs->tstate & TSTATE_PRIV) 539 if (regs->tstate & TSTATE_PRIV)
diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c
index c4d3da68b800..1aed0432c64b 100644
--- a/arch/sparc/mm/gup.c
+++ b/arch/sparc/mm/gup.c
@@ -73,7 +73,7 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
73 struct page *head, *page, *tail; 73 struct page *head, *page, *tail;
74 int refs; 74 int refs;
75 75
76 if (!pmd_large(pmd)) 76 if (!(pmd_val(pmd) & _PAGE_VALID))
77 return 0; 77 return 0;
78 78
79 if (write && !pmd_write(pmd)) 79 if (write && !pmd_write(pmd))
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index eafbc65c9c47..ed3c969a5f4c 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -588,7 +588,7 @@ static void __init remap_kernel(void)
588 int i, tlb_ent = sparc64_highest_locked_tlbent(); 588 int i, tlb_ent = sparc64_highest_locked_tlbent();
589 589
590 tte_vaddr = (unsigned long) KERNBASE; 590 tte_vaddr = (unsigned long) KERNBASE;
591 phys_page = (prom_boot_mapping_phys_low >> 22UL) << 22UL; 591 phys_page = (prom_boot_mapping_phys_low >> ILOG2_4MB) << ILOG2_4MB;
592 tte_data = kern_large_tte(phys_page); 592 tte_data = kern_large_tte(phys_page);
593 593
594 kern_locked_tte_data = tte_data; 594 kern_locked_tte_data = tte_data;
@@ -1881,7 +1881,7 @@ void __init paging_init(void)
1881 1881
1882 BUILD_BUG_ON(NR_CPUS > 4096); 1882 BUILD_BUG_ON(NR_CPUS > 4096);
1883 1883
1884 kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; 1884 kern_base = (prom_boot_mapping_phys_low >> ILOG2_4MB) << ILOG2_4MB;
1885 kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; 1885 kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
1886 1886
1887 /* Invalidate both kernel TSBs. */ 1887 /* Invalidate both kernel TSBs. */
@@ -1937,7 +1937,7 @@ void __init paging_init(void)
1937 shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE); 1937 shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE);
1938 1938
1939 real_end = (unsigned long)_end; 1939 real_end = (unsigned long)_end;
1940 num_kernel_image_mappings = DIV_ROUND_UP(real_end - KERNBASE, 1 << 22); 1940 num_kernel_image_mappings = DIV_ROUND_UP(real_end - KERNBASE, 1 << ILOG2_4MB);
1941 printk("Kernel: Using %d locked TLB entries for main kernel image.\n", 1941 printk("Kernel: Using %d locked TLB entries for main kernel image.\n",
1942 num_kernel_image_mappings); 1942 num_kernel_image_mappings);
1943 1943
@@ -2094,7 +2094,7 @@ static void __init setup_valid_addr_bitmap_from_pavail(unsigned long *bitmap)
2094 2094
2095 if (new_start <= old_start && 2095 if (new_start <= old_start &&
2096 new_end >= (old_start + PAGE_SIZE)) { 2096 new_end >= (old_start + PAGE_SIZE)) {
2097 set_bit(old_start >> 22, bitmap); 2097 set_bit(old_start >> ILOG2_4MB, bitmap);
2098 goto do_next_page; 2098 goto do_next_page;
2099 } 2099 }
2100 } 2100 }
@@ -2143,7 +2143,7 @@ void __init mem_init(void)
2143 addr = PAGE_OFFSET + kern_base; 2143 addr = PAGE_OFFSET + kern_base;
2144 last = PAGE_ALIGN(kern_size) + addr; 2144 last = PAGE_ALIGN(kern_size) + addr;
2145 while (addr < last) { 2145 while (addr < last) {
2146 set_bit(__pa(addr) >> 22, sparc64_valid_addr_bitmap); 2146 set_bit(__pa(addr) >> ILOG2_4MB, sparc64_valid_addr_bitmap);
2147 addr += PAGE_SIZE; 2147 addr += PAGE_SIZE;
2148 } 2148 }
2149 2149
@@ -2267,7 +2267,7 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
2267 void *block; 2267 void *block;
2268 2268
2269 if (!(*vmem_pp & _PAGE_VALID)) { 2269 if (!(*vmem_pp & _PAGE_VALID)) {
2270 block = vmemmap_alloc_block(1UL << 22, node); 2270 block = vmemmap_alloc_block(1UL << ILOG2_4MB, node);
2271 if (!block) 2271 if (!block)
2272 return -ENOMEM; 2272 return -ENOMEM;
2273 2273
diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index b12cb5e72812..b89aba217e3b 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -134,7 +134,7 @@ no_cache_flush:
134 134
135#ifdef CONFIG_TRANSPARENT_HUGEPAGE 135#ifdef CONFIG_TRANSPARENT_HUGEPAGE
136static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr, 136static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
137 pmd_t pmd, bool exec) 137 pmd_t pmd)
138{ 138{
139 unsigned long end; 139 unsigned long end;
140 pte_t *pte; 140 pte_t *pte;
@@ -142,8 +142,11 @@ static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
142 pte = pte_offset_map(&pmd, vaddr); 142 pte = pte_offset_map(&pmd, vaddr);
143 end = vaddr + HPAGE_SIZE; 143 end = vaddr + HPAGE_SIZE;
144 while (vaddr < end) { 144 while (vaddr < end) {
145 if (pte_val(*pte) & _PAGE_VALID) 145 if (pte_val(*pte) & _PAGE_VALID) {
146 bool exec = pte_exec(*pte);
147
146 tlb_batch_add_one(mm, vaddr, exec); 148 tlb_batch_add_one(mm, vaddr, exec);
149 }
147 pte++; 150 pte++;
148 vaddr += PAGE_SIZE; 151 vaddr += PAGE_SIZE;
149 } 152 }
@@ -177,19 +180,30 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
177 } 180 }
178 181
179 if (!pmd_none(orig)) { 182 if (!pmd_none(orig)) {
180 pte_t orig_pte = __pte(pmd_val(orig));
181 bool exec = pte_exec(orig_pte);
182
183 addr &= HPAGE_MASK; 183 addr &= HPAGE_MASK;
184 if (pmd_trans_huge(orig)) { 184 if (pmd_trans_huge(orig)) {
185 pte_t orig_pte = __pte(pmd_val(orig));
186 bool exec = pte_exec(orig_pte);
187
185 tlb_batch_add_one(mm, addr, exec); 188 tlb_batch_add_one(mm, addr, exec);
186 tlb_batch_add_one(mm, addr + REAL_HPAGE_SIZE, exec); 189 tlb_batch_add_one(mm, addr + REAL_HPAGE_SIZE, exec);
187 } else { 190 } else {
188 tlb_batch_pmd_scan(mm, addr, orig, exec); 191 tlb_batch_pmd_scan(mm, addr, orig);
189 } 192 }
190 } 193 }
191} 194}
192 195
196void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
197 pmd_t *pmdp)
198{
199 pmd_t entry = *pmdp;
200
201 pmd_val(entry) &= ~_PAGE_VALID;
202
203 set_pmd_at(vma->vm_mm, address, pmdp, entry);
204 flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
205}
206
193void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, 207void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
194 pgtable_t pgtable) 208 pgtable_t pgtable)
195{ 209{
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index f5d506fdddad..fe19b81acc09 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -133,7 +133,19 @@ static void setup_tsb_params(struct mm_struct *mm, unsigned long tsb_idx, unsign
133 mm->context.tsb_block[tsb_idx].tsb_nentries = 133 mm->context.tsb_block[tsb_idx].tsb_nentries =
134 tsb_bytes / sizeof(struct tsb); 134 tsb_bytes / sizeof(struct tsb);
135 135
136 base = TSBMAP_BASE; 136 switch (tsb_idx) {
137 case MM_TSB_BASE:
138 base = TSBMAP_8K_BASE;
139 break;
140#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
141 case MM_TSB_HUGE:
142 base = TSBMAP_4M_BASE;
143 break;
144#endif
145 default:
146 BUG();
147 }
148
137 tte = pgprot_val(PAGE_KERNEL_LOCKED); 149 tte = pgprot_val(PAGE_KERNEL_LOCKED);
138 tsb_paddr = __pa(mm->context.tsb_block[tsb_idx].tsb); 150 tsb_paddr = __pa(mm->context.tsb_block[tsb_idx].tsb);
139 BUG_ON(tsb_paddr & (tsb_bytes - 1UL)); 151 BUG_ON(tsb_paddr & (tsb_bytes - 1UL));
diff --git a/arch/unicore32/include/asm/pci.h b/arch/unicore32/include/asm/pci.h
index f5e108f4a151..654407e98619 100644
--- a/arch/unicore32/include/asm/pci.h
+++ b/arch/unicore32/include/asm/pci.h
@@ -18,11 +18,6 @@
18#include <asm-generic/pci.h> 18#include <asm-generic/pci.h>
19#include <mach/hardware.h> /* for PCIBIOS_MIN_* */ 19#include <mach/hardware.h> /* for PCIBIOS_MIN_* */
20 20
21static inline void pcibios_penalize_isa_irq(int irq, int active)
22{
23 /* We don't do dynamic PCI IRQ allocation */
24}
25
26#ifdef CONFIG_PCI 21#ifdef CONFIG_PCI
27static inline void pci_dma_burst_advice(struct pci_dev *pdev, 22static inline void pci_dma_burst_advice(struct pci_dev *pdev,
28 enum pci_dma_burst_strategy *strat, 23 enum pci_dma_burst_strategy *strat,
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index ce6ad7e6a7d7..33f71b01fd22 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -79,6 +79,7 @@ else
79 UTS_MACHINE := x86_64 79 UTS_MACHINE := x86_64
80 CHECKFLAGS += -D__x86_64__ -m64 80 CHECKFLAGS += -D__x86_64__ -m64
81 81
82 biarch := -m64
82 KBUILD_AFLAGS += -m64 83 KBUILD_AFLAGS += -m64
83 KBUILD_CFLAGS += -m64 84 KBUILD_CFLAGS += -m64
84 85
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index abb9eba61b50..dbe8dd2fe247 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -71,7 +71,7 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
71 71
72SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) 72SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
73 73
74sed-voffset := -e 's/^\([0-9a-fA-F]*\) . \(_text\|_end\)$$/\#define VO_\2 0x\1/p' 74sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|_end\)$$/\#define VO_\2 0x\1/p'
75 75
76quiet_cmd_voffset = VOFFSET $@ 76quiet_cmd_voffset = VOFFSET $@
77 cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@ 77 cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@
@@ -80,7 +80,7 @@ targets += voffset.h
80$(obj)/voffset.h: vmlinux FORCE 80$(obj)/voffset.h: vmlinux FORCE
81 $(call if_changed,voffset) 81 $(call if_changed,voffset)
82 82
83sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p' 83sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p'
84 84
85quiet_cmd_zoffset = ZOFFSET $@ 85quiet_cmd_zoffset = ZOFFSET $@
86 cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@ 86 cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 17684615374b..57ab74df7eea 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -354,7 +354,7 @@ static void parse_elf(void *output)
354 free(phdrs); 354 free(phdrs);
355} 355}
356 356
357asmlinkage void *decompress_kernel(void *rmode, memptr heap, 357asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
358 unsigned char *input_data, 358 unsigned char *input_data,
359 unsigned long input_len, 359 unsigned long input_len,
360 unsigned char *output, 360 unsigned char *output,
diff --git a/arch/x86/include/asm/hpet.h b/arch/x86/include/asm/hpet.h
index b18df579c0e9..36f7125945e3 100644
--- a/arch/x86/include/asm/hpet.h
+++ b/arch/x86/include/asm/hpet.h
@@ -63,6 +63,7 @@
63/* hpet memory map physical address */ 63/* hpet memory map physical address */
64extern unsigned long hpet_address; 64extern unsigned long hpet_address;
65extern unsigned long force_hpet_address; 65extern unsigned long force_hpet_address;
66extern int boot_hpet_disable;
66extern u8 hpet_blockid; 67extern u8 hpet_blockid;
67extern int hpet_force_user; 68extern int hpet_force_user;
68extern u8 hpet_msi_disable; 69extern u8 hpet_msi_disable;
diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h
index a8091216963b..68c05398bba9 100644
--- a/arch/x86/include/asm/hugetlb.h
+++ b/arch/x86/include/asm/hugetlb.h
@@ -52,6 +52,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
52static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, 52static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
53 unsigned long addr, pte_t *ptep) 53 unsigned long addr, pte_t *ptep)
54{ 54{
55 ptep_clear_flush(vma, addr, ptep);
55} 56}
56 57
57static inline int huge_pte_none(pte_t pte) 58static inline int huge_pte_none(pte_t pte)
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index 8de6d9cf3b95..678205195ae1 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_X86_PAGE_64_DEFS_H 1#ifndef _ASM_X86_PAGE_64_DEFS_H
2#define _ASM_X86_PAGE_64_DEFS_H 2#define _ASM_X86_PAGE_64_DEFS_H
3 3
4#define THREAD_SIZE_ORDER 1 4#define THREAD_SIZE_ORDER 2
5#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) 5#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
6#define CURRENT_MASK (~(THREAD_SIZE - 1)) 6#define CURRENT_MASK (~(THREAD_SIZE - 1))
7 7
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 96ae4f4040bb..0892ea0e683f 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -68,7 +68,6 @@ void pcibios_config_init(void);
68void pcibios_scan_root(int bus); 68void pcibios_scan_root(int bus);
69 69
70void pcibios_set_master(struct pci_dev *dev); 70void pcibios_set_master(struct pci_dev *dev);
71void pcibios_penalize_isa_irq(int irq, int active);
72struct irq_routing_table *pcibios_get_irq_routing_table(void); 71struct irq_routing_table *pcibios_get_irq_routing_table(void);
73int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); 72int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
74 73
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index e709884d0ef9..ca08a27b90b3 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -343,7 +343,7 @@ HYPERVISOR_memory_op(unsigned int cmd, void *arg)
343} 343}
344 344
345static inline int 345static inline int
346HYPERVISOR_multicall(void *call_list, int nr_calls) 346HYPERVISOR_multicall(void *call_list, uint32_t nr_calls)
347{ 347{
348 return _hypercall2(int, multicall, call_list, nr_calls); 348 return _hypercall2(int, multicall, call_list, nr_calls);
349} 349}
diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h
index fd9cb7695b5f..3400dbaec3c3 100644
--- a/arch/x86/include/asm/xen/interface.h
+++ b/arch/x86/include/asm/xen/interface.h
@@ -54,6 +54,9 @@ typedef unsigned long xen_pfn_t;
54#define PRI_xen_pfn "lx" 54#define PRI_xen_pfn "lx"
55typedef unsigned long xen_ulong_t; 55typedef unsigned long xen_ulong_t;
56#define PRI_xen_ulong "lx" 56#define PRI_xen_ulong "lx"
57typedef long xen_long_t;
58#define PRI_xen_long "lx"
59
57/* Guest handles for primitive C types. */ 60/* Guest handles for primitive C types. */
58__DEFINE_GUEST_HANDLE(uchar, unsigned char); 61__DEFINE_GUEST_HANDLE(uchar, unsigned char);
59__DEFINE_GUEST_HANDLE(uint, unsigned int); 62__DEFINE_GUEST_HANDLE(uint, unsigned int);
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index c827ace3121b..fcf2b3ae1bf0 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -384,7 +384,7 @@
384#define MSR_IA32_MISC_ENABLE_MWAIT_BIT 18 384#define MSR_IA32_MISC_ENABLE_MWAIT_BIT 18
385#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << MSR_IA32_MISC_ENABLE_MWAIT_BIT) 385#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << MSR_IA32_MISC_ENABLE_MWAIT_BIT)
386#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT 22 386#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT 22
387#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT); 387#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT)
388#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT 23 388#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT 23
389#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT) 389#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT)
390#define MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT 34 390#define MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT 34
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 3a2ae4c88948..31368207837c 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -31,7 +31,7 @@ static char temp_stack[4096];
31 * 31 *
32 * Wrapper around acpi_enter_sleep_state() to be called by assmebly. 32 * Wrapper around acpi_enter_sleep_state() to be called by assmebly.
33 */ 33 */
34acpi_status asmlinkage x86_acpi_enter_sleep_state(u8 state) 34acpi_status asmlinkage __visible x86_acpi_enter_sleep_state(u8 state)
35{ 35{
36 return acpi_enter_sleep_state(state); 36 return acpi_enter_sleep_state(state);
37} 37}
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 9fa8aa051f54..76164e173a24 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -10,6 +10,8 @@
10 * 10 *
11 * Copyright 2002 Andi Kleen, SuSE Labs. 11 * Copyright 2002 Andi Kleen, SuSE Labs.
12 */ 12 */
13#define pr_fmt(fmt) "AGP: " fmt
14
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/types.h> 16#include <linux/types.h>
15#include <linux/init.h> 17#include <linux/init.h>
@@ -75,14 +77,13 @@ static u32 __init allocate_aperture(void)
75 addr = memblock_find_in_range(GART_MIN_ADDR, GART_MAX_ADDR, 77 addr = memblock_find_in_range(GART_MIN_ADDR, GART_MAX_ADDR,
76 aper_size, aper_size); 78 aper_size, aper_size);
77 if (!addr) { 79 if (!addr) {
78 printk(KERN_ERR 80 pr_err("Cannot allocate aperture memory hole [mem %#010lx-%#010lx] (%uKB)\n",
79 "Cannot allocate aperture memory hole (%lx,%uK)\n", 81 addr, addr + aper_size - 1, aper_size >> 10);
80 addr, aper_size>>10);
81 return 0; 82 return 0;
82 } 83 }
83 memblock_reserve(addr, aper_size); 84 memblock_reserve(addr, aper_size);
84 printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n", 85 pr_info("Mapping aperture over RAM [mem %#010lx-%#010lx] (%uKB)\n",
85 aper_size >> 10, addr); 86 addr, addr + aper_size - 1, aper_size >> 10);
86 register_nosave_region(addr >> PAGE_SHIFT, 87 register_nosave_region(addr >> PAGE_SHIFT,
87 (addr+aper_size) >> PAGE_SHIFT); 88 (addr+aper_size) >> PAGE_SHIFT);
88 89
@@ -126,10 +127,11 @@ static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
126 u64 aper; 127 u64 aper;
127 u32 old_order; 128 u32 old_order;
128 129
129 printk(KERN_INFO "AGP bridge at %02x:%02x:%02x\n", bus, slot, func); 130 pr_info("pci 0000:%02x:%02x:%02x: AGP bridge\n", bus, slot, func);
130 apsizereg = read_pci_config_16(bus, slot, func, cap + 0x14); 131 apsizereg = read_pci_config_16(bus, slot, func, cap + 0x14);
131 if (apsizereg == 0xffffffff) { 132 if (apsizereg == 0xffffffff) {
132 printk(KERN_ERR "APSIZE in AGP bridge unreadable\n"); 133 pr_err("pci 0000:%02x:%02x.%d: APSIZE unreadable\n",
134 bus, slot, func);
133 return 0; 135 return 0;
134 } 136 }
135 137
@@ -153,16 +155,18 @@ static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
153 * On some sick chips, APSIZE is 0. It means it wants 4G 155 * On some sick chips, APSIZE is 0. It means it wants 4G
154 * so let double check that order, and lets trust AMD NB settings: 156 * so let double check that order, and lets trust AMD NB settings:
155 */ 157 */
156 printk(KERN_INFO "Aperture from AGP @ %Lx old size %u MB\n", 158 pr_info("pci 0000:%02x:%02x.%d: AGP aperture [bus addr %#010Lx-%#010Lx] (old size %uMB)\n",
157 aper, 32 << old_order); 159 bus, slot, func, aper, aper + (32ULL << (old_order + 20)) - 1,
160 32 << old_order);
158 if (aper + (32ULL<<(20 + *order)) > 0x100000000ULL) { 161 if (aper + (32ULL<<(20 + *order)) > 0x100000000ULL) {
159 printk(KERN_INFO "Aperture size %u MB (APSIZE %x) is not right, using settings from NB\n", 162 pr_info("pci 0000:%02x:%02x.%d: AGP aperture size %uMB (APSIZE %#x) is not right, using settings from NB\n",
160 32 << *order, apsizereg); 163 bus, slot, func, 32 << *order, apsizereg);
161 *order = old_order; 164 *order = old_order;
162 } 165 }
163 166
164 printk(KERN_INFO "Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n", 167 pr_info("pci 0000:%02x:%02x.%d: AGP aperture [bus addr %#010Lx-%#010Lx] (%uMB, APSIZE %#x)\n",
165 aper, 32 << *order, apsizereg); 168 bus, slot, func, aper, aper + (32ULL << (*order + 20)) - 1,
169 32 << *order, apsizereg);
166 170
167 if (!aperture_valid(aper, (32*1024*1024) << *order, 32<<20)) 171 if (!aperture_valid(aper, (32*1024*1024) << *order, 32<<20))
168 return 0; 172 return 0;
@@ -218,7 +222,7 @@ static u32 __init search_agp_bridge(u32 *order, int *valid_agp)
218 } 222 }
219 } 223 }
220 } 224 }
221 printk(KERN_INFO "No AGP bridge found\n"); 225 pr_info("No AGP bridge found\n");
222 226
223 return 0; 227 return 0;
224} 228}
@@ -310,7 +314,8 @@ void __init early_gart_iommu_check(void)
310 if (e820_any_mapped(aper_base, aper_base + aper_size, 314 if (e820_any_mapped(aper_base, aper_base + aper_size,
311 E820_RAM)) { 315 E820_RAM)) {
312 /* reserve it, so we can reuse it in second kernel */ 316 /* reserve it, so we can reuse it in second kernel */
313 printk(KERN_INFO "update e820 for GART\n"); 317 pr_info("e820: reserve [mem %#010Lx-%#010Lx] for GART\n",
318 aper_base, aper_base + aper_size - 1);
314 e820_add_region(aper_base, aper_size, E820_RESERVED); 319 e820_add_region(aper_base, aper_size, E820_RESERVED);
315 update_e820(); 320 update_e820();
316 } 321 }
@@ -354,7 +359,7 @@ int __init gart_iommu_hole_init(void)
354 !early_pci_allowed()) 359 !early_pci_allowed())
355 return -ENODEV; 360 return -ENODEV;
356 361
357 printk(KERN_INFO "Checking aperture...\n"); 362 pr_info("Checking aperture...\n");
358 363
359 if (!fallback_aper_force) 364 if (!fallback_aper_force)
360 agp_aper_base = search_agp_bridge(&agp_aper_order, &valid_agp); 365 agp_aper_base = search_agp_bridge(&agp_aper_order, &valid_agp);
@@ -395,8 +400,9 @@ int __init gart_iommu_hole_init(void)
395 aper_base = read_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE) & 0x7fff; 400 aper_base = read_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE) & 0x7fff;
396 aper_base <<= 25; 401 aper_base <<= 25;
397 402
398 printk(KERN_INFO "Node %d: aperture @ %Lx size %u MB\n", 403 pr_info("Node %d: aperture [bus addr %#010Lx-%#010Lx] (%uMB)\n",
399 node, aper_base, aper_size >> 20); 404 node, aper_base, aper_base + aper_size - 1,
405 aper_size >> 20);
400 node++; 406 node++;
401 407
402 if (!aperture_valid(aper_base, aper_size, 64<<20)) { 408 if (!aperture_valid(aper_base, aper_size, 64<<20)) {
@@ -407,9 +413,9 @@ int __init gart_iommu_hole_init(void)
407 if (!no_iommu && 413 if (!no_iommu &&
408 max_pfn > MAX_DMA32_PFN && 414 max_pfn > MAX_DMA32_PFN &&
409 !printed_gart_size_msg) { 415 !printed_gart_size_msg) {
410 printk(KERN_ERR "you are using iommu with agp, but GART size is less than 64M\n"); 416 pr_err("you are using iommu with agp, but GART size is less than 64MB\n");
411 printk(KERN_ERR "please increase GART size in your BIOS setup\n"); 417 pr_err("please increase GART size in your BIOS setup\n");
412 printk(KERN_ERR "if BIOS doesn't have that option, contact your HW vendor!\n"); 418 pr_err("if BIOS doesn't have that option, contact your HW vendor!\n");
413 printed_gart_size_msg = 1; 419 printed_gart_size_msg = 1;
414 } 420 }
415 } else { 421 } else {
@@ -446,13 +452,10 @@ out:
446 force_iommu || 452 force_iommu ||
447 valid_agp || 453 valid_agp ||
448 fallback_aper_force) { 454 fallback_aper_force) {
449 printk(KERN_INFO 455 pr_info("Your BIOS doesn't leave a aperture memory hole\n");
450 "Your BIOS doesn't leave a aperture memory hole\n"); 456 pr_info("Please enable the IOMMU option in the BIOS setup\n");
451 printk(KERN_INFO 457 pr_info("This costs you %dMB of RAM\n",
452 "Please enable the IOMMU option in the BIOS setup\n"); 458 32 << fallback_aper_order);
453 printk(KERN_INFO
454 "This costs you %d MB of RAM\n",
455 32 << fallback_aper_order);
456 459
457 aper_order = fallback_aper_order; 460 aper_order = fallback_aper_order;
458 aper_alloc = allocate_aperture(); 461 aper_alloc = allocate_aperture();
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index d23aa82e7a7b..992060e09897 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2189,7 +2189,7 @@ void send_cleanup_vector(struct irq_cfg *cfg)
2189 cfg->move_in_progress = 0; 2189 cfg->move_in_progress = 0;
2190} 2190}
2191 2191
2192asmlinkage void smp_irq_move_cleanup_interrupt(void) 2192asmlinkage __visible void smp_irq_move_cleanup_interrupt(void)
2193{ 2193{
2194 unsigned vector, me; 2194 unsigned vector, me;
2195 2195
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index d921b7ee6595..36a1bb6d1ee0 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -429,14 +429,14 @@ static inline void __smp_thermal_interrupt(void)
429 smp_thermal_vector(); 429 smp_thermal_vector();
430} 430}
431 431
432asmlinkage void smp_thermal_interrupt(struct pt_regs *regs) 432asmlinkage __visible void smp_thermal_interrupt(struct pt_regs *regs)
433{ 433{
434 entering_irq(); 434 entering_irq();
435 __smp_thermal_interrupt(); 435 __smp_thermal_interrupt();
436 exiting_ack_irq(); 436 exiting_ack_irq();
437} 437}
438 438
439asmlinkage void smp_trace_thermal_interrupt(struct pt_regs *regs) 439asmlinkage __visible void smp_trace_thermal_interrupt(struct pt_regs *regs)
440{ 440{
441 entering_irq(); 441 entering_irq();
442 trace_thermal_apic_entry(THERMAL_APIC_VECTOR); 442 trace_thermal_apic_entry(THERMAL_APIC_VECTOR);
diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c
index fe6b1c86645b..7245980186ee 100644
--- a/arch/x86/kernel/cpu/mcheck/threshold.c
+++ b/arch/x86/kernel/cpu/mcheck/threshold.c
@@ -24,14 +24,14 @@ static inline void __smp_threshold_interrupt(void)
24 mce_threshold_vector(); 24 mce_threshold_vector();
25} 25}
26 26
27asmlinkage void smp_threshold_interrupt(void) 27asmlinkage __visible void smp_threshold_interrupt(void)
28{ 28{
29 entering_irq(); 29 entering_irq();
30 __smp_threshold_interrupt(); 30 __smp_threshold_interrupt();
31 exiting_ack_irq(); 31 exiting_ack_irq();
32} 32}
33 33
34asmlinkage void smp_trace_threshold_interrupt(void) 34asmlinkage __visible void smp_trace_threshold_interrupt(void)
35{ 35{
36 entering_irq(); 36 entering_irq();
37 trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR); 37 trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR);
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index aa333d966886..adb02aa62af5 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -169,7 +169,6 @@ static struct event_constraint intel_slm_event_constraints[] __read_mostly =
169{ 169{
170 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ 170 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
171 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ 171 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
172 FIXED_EVENT_CONSTRAINT(0x013c, 2), /* CPU_CLK_UNHALTED.REF */
173 FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF */ 172 FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF */
174 EVENT_CONSTRAINT_END 173 EVENT_CONSTRAINT_END
175}; 174};
diff --git a/arch/x86/kernel/cpu/rdrand.c b/arch/x86/kernel/cpu/rdrand.c
index 384df5105fbc..136ac74dee82 100644
--- a/arch/x86/kernel/cpu/rdrand.c
+++ b/arch/x86/kernel/cpu/rdrand.c
@@ -27,6 +27,7 @@
27static int __init x86_rdrand_setup(char *s) 27static int __init x86_rdrand_setup(char *s)
28{ 28{
29 setup_clear_cpu_cap(X86_FEATURE_RDRAND); 29 setup_clear_cpu_cap(X86_FEATURE_RDRAND);
30 setup_clear_cpu_cap(X86_FEATURE_RDSEED);
30 return 1; 31 return 1;
31} 32}
32__setup("nordrand", x86_rdrand_setup); 33__setup("nordrand", x86_rdrand_setup);
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 6e2537c32190..6cda0baeac9d 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -17,6 +17,7 @@
17#include <asm/dma.h> 17#include <asm/dma.h>
18#include <asm/io_apic.h> 18#include <asm/io_apic.h>
19#include <asm/apic.h> 19#include <asm/apic.h>
20#include <asm/hpet.h>
20#include <asm/iommu.h> 21#include <asm/iommu.h>
21#include <asm/gart.h> 22#include <asm/gart.h>
22#include <asm/irq_remapping.h> 23#include <asm/irq_remapping.h>
@@ -530,6 +531,15 @@ static void __init intel_graphics_stolen(int num, int slot, int func)
530 } 531 }
531} 532}
532 533
534static void __init force_disable_hpet(int num, int slot, int func)
535{
536#ifdef CONFIG_HPET_TIMER
537 boot_hpet_disable = 1;
538 pr_info("x86/hpet: Will disable the HPET for this platform because it's not reliable\n");
539#endif
540}
541
542
533#define QFLAG_APPLY_ONCE 0x1 543#define QFLAG_APPLY_ONCE 0x1
534#define QFLAG_APPLIED 0x2 544#define QFLAG_APPLIED 0x2
535#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) 545#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -567,6 +577,12 @@ static struct chipset early_qrk[] __initdata = {
567 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, 577 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
568 { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID, 578 { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID,
569 QFLAG_APPLY_ONCE, intel_graphics_stolen }, 579 QFLAG_APPLY_ONCE, intel_graphics_stolen },
580 /*
581 * HPET on current version of Baytrail platform has accuracy
582 * problems, disable it for now:
583 */
584 { PCI_VENDOR_ID_INTEL, 0x0f00,
585 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet},
570 {} 586 {}
571}; 587};
572 588
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index c61a14a4a310..d6c1b9836995 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -29,7 +29,7 @@ static void __init i386_default_early_setup(void)
29 reserve_ebda_region(); 29 reserve_ebda_region();
30} 30}
31 31
32asmlinkage void __init i386_start_kernel(void) 32asmlinkage __visible void __init i386_start_kernel(void)
33{ 33{
34 sanitize_boot_params(&boot_params); 34 sanitize_boot_params(&boot_params);
35 35
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 85126ccbdf6b..068054f4bf20 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -137,7 +137,7 @@ static void __init copy_bootdata(char *real_mode_data)
137 } 137 }
138} 138}
139 139
140asmlinkage void __init x86_64_start_kernel(char * real_mode_data) 140asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
141{ 141{
142 int i; 142 int i;
143 143
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 8d80ae011603..4177bfbc80b0 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -88,7 +88,7 @@ static inline void hpet_clear_mapping(void)
88/* 88/*
89 * HPET command line enable / disable 89 * HPET command line enable / disable
90 */ 90 */
91static int boot_hpet_disable; 91int boot_hpet_disable;
92int hpet_force_user; 92int hpet_force_user;
93static int hpet_verbose; 93static int hpet_verbose;
94 94
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index af1d14a9ebda..dcbbaa165bde 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -20,6 +20,8 @@
20#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
21#include <asm/syscalls.h> 21#include <asm/syscalls.h>
22 22
23int sysctl_ldt16 = 0;
24
23#ifdef CONFIG_SMP 25#ifdef CONFIG_SMP
24static void flush_ldt(void *current_mm) 26static void flush_ldt(void *current_mm)
25{ 27{
@@ -234,7 +236,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
234 * IRET leaking the high bits of the kernel stack address. 236 * IRET leaking the high bits of the kernel stack address.
235 */ 237 */
236#ifdef CONFIG_X86_64 238#ifdef CONFIG_X86_64
237 if (!ldt_info.seg_32bit) { 239 if (!ldt_info.seg_32bit && !sysctl_ldt16) {
238 error = -EINVAL; 240 error = -EINVAL;
239 goto out_unlock; 241 goto out_unlock;
240 } 242 }
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 9c0280f93d05..898d077617a9 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -52,7 +52,7 @@
52 52
53asmlinkage extern void ret_from_fork(void); 53asmlinkage extern void ret_from_fork(void);
54 54
55asmlinkage DEFINE_PER_CPU(unsigned long, old_rsp); 55__visible DEFINE_PER_CPU(unsigned long, old_rsp);
56 56
57/* Prints also some state that isn't saved in the pt_regs */ 57/* Prints also some state that isn't saved in the pt_regs */
58void __show_regs(struct pt_regs *regs, int all) 58void __show_regs(struct pt_regs *regs, int all)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 3399d3a99730..52b1157c53eb 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -191,6 +191,16 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
191 }, 191 },
192 }, 192 },
193 193
194 /* Certec */
195 { /* Handle problems with rebooting on Certec BPC600 */
196 .callback = set_pci_reboot,
197 .ident = "Certec BPC600",
198 .matches = {
199 DMI_MATCH(DMI_SYS_VENDOR, "Certec"),
200 DMI_MATCH(DMI_PRODUCT_NAME, "BPC600"),
201 },
202 },
203
194 /* Dell */ 204 /* Dell */
195 { /* Handle problems with rebooting on Dell DXP061 */ 205 { /* Handle problems with rebooting on Dell DXP061 */
196 .callback = set_bios_reboot, 206 .callback = set_bios_reboot,
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 7c3a5a61f2e4..be8e1bde07aa 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -168,7 +168,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)
168 * this function calls the 'stop' function on all other CPUs in the system. 168 * this function calls the 'stop' function on all other CPUs in the system.
169 */ 169 */
170 170
171asmlinkage void smp_reboot_interrupt(void) 171asmlinkage __visible void smp_reboot_interrupt(void)
172{ 172{
173 ack_APIC_irq(); 173 ack_APIC_irq();
174 irq_enter(); 174 irq_enter();
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 57409f6b8c62..f73b5d435bdc 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -357,7 +357,7 @@ exit:
357 * for scheduling or signal handling. The actual stack switch is done in 357 * for scheduling or signal handling. The actual stack switch is done in
358 * entry.S 358 * entry.S
359 */ 359 */
360asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) 360asmlinkage __visible __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
361{ 361{
362 struct pt_regs *regs = eregs; 362 struct pt_regs *regs = eregs;
363 /* Did already sync */ 363 /* Did already sync */
@@ -601,11 +601,11 @@ do_spurious_interrupt_bug(struct pt_regs *regs, long error_code)
601#endif 601#endif
602} 602}
603 603
604asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void) 604asmlinkage __visible void __attribute__((weak)) smp_thermal_interrupt(void)
605{ 605{
606} 606}
607 607
608asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void) 608asmlinkage __visible void __attribute__((weak)) smp_threshold_interrupt(void)
609{ 609{
610} 610}
611 611
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 5edc34b5b951..b99b9ad8540c 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -36,7 +36,7 @@ static int irq_routing_comply = 1;
36 * and vice versa. 36 * and vice versa.
37 */ 37 */
38 38
39asmlinkage unsigned long vsmp_save_fl(void) 39asmlinkage __visible unsigned long vsmp_save_fl(void)
40{ 40{
41 unsigned long flags = native_save_fl(); 41 unsigned long flags = native_save_fl();
42 42
@@ -56,7 +56,7 @@ __visible void vsmp_restore_fl(unsigned long flags)
56} 56}
57PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl); 57PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
58 58
59asmlinkage void vsmp_irq_disable(void) 59asmlinkage __visible void vsmp_irq_disable(void)
60{ 60{
61 unsigned long flags = native_save_fl(); 61 unsigned long flags = native_save_fl();
62 62
@@ -64,7 +64,7 @@ asmlinkage void vsmp_irq_disable(void)
64} 64}
65PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable); 65PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
66 66
67asmlinkage void vsmp_irq_enable(void) 67asmlinkage __visible void vsmp_irq_enable(void)
68{ 68{
69 unsigned long flags = native_save_fl(); 69 unsigned long flags = native_save_fl();
70 70
diff --git a/arch/x86/kernel/vsyscall_gtod.c b/arch/x86/kernel/vsyscall_gtod.c
index f9c6e56e14b5..9531fbb123ba 100644
--- a/arch/x86/kernel/vsyscall_gtod.c
+++ b/arch/x86/kernel/vsyscall_gtod.c
@@ -43,7 +43,7 @@ void update_vsyscall(struct timekeeper *tk)
43 vdata->monotonic_time_sec = tk->xtime_sec 43 vdata->monotonic_time_sec = tk->xtime_sec
44 + tk->wall_to_monotonic.tv_sec; 44 + tk->wall_to_monotonic.tv_sec;
45 vdata->monotonic_time_snsec = tk->xtime_nsec 45 vdata->monotonic_time_snsec = tk->xtime_nsec
46 + (tk->wall_to_monotonic.tv_nsec 46 + ((u64)tk->wall_to_monotonic.tv_nsec
47 << tk->shift); 47 << tk->shift);
48 while (vdata->monotonic_time_snsec >= 48 while (vdata->monotonic_time_snsec >=
49 (((u64)NSEC_PER_SEC) << tk->shift)) { 49 (((u64)NSEC_PER_SEC) << tk->shift)) {
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 33e8c028842f..138ceffc6377 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7778,7 +7778,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7778 7778
7779 exec_control = vmcs12->pin_based_vm_exec_control; 7779 exec_control = vmcs12->pin_based_vm_exec_control;
7780 exec_control |= vmcs_config.pin_based_exec_ctrl; 7780 exec_control |= vmcs_config.pin_based_exec_ctrl;
7781 exec_control &= ~PIN_BASED_VMX_PREEMPTION_TIMER; 7781 exec_control &= ~(PIN_BASED_VMX_PREEMPTION_TIMER |
7782 PIN_BASED_POSTED_INTR);
7782 vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, exec_control); 7783 vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, exec_control);
7783 7784
7784 vmx->nested.preemption_timer_expired = false; 7785 vmx->nested.preemption_timer_expired = false;
@@ -7815,7 +7816,9 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7815 if (!vmx->rdtscp_enabled) 7816 if (!vmx->rdtscp_enabled)
7816 exec_control &= ~SECONDARY_EXEC_RDTSCP; 7817 exec_control &= ~SECONDARY_EXEC_RDTSCP;
7817 /* Take the following fields only from vmcs12 */ 7818 /* Take the following fields only from vmcs12 */
7818 exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; 7819 exec_control &= ~(SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
7820 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
7821 SECONDARY_EXEC_APIC_REGISTER_VIRT);
7819 if (nested_cpu_has(vmcs12, 7822 if (nested_cpu_has(vmcs12,
7820 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)) 7823 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS))
7821 exec_control |= vmcs12->secondary_vm_exec_control; 7824 exec_control |= vmcs12->secondary_vm_exec_control;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8b8fc0b792ba..20316c67b824 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -106,6 +106,8 @@ EXPORT_SYMBOL_GPL(kvm_max_guest_tsc_khz);
106static u32 tsc_tolerance_ppm = 250; 106static u32 tsc_tolerance_ppm = 250;
107module_param(tsc_tolerance_ppm, uint, S_IRUGO | S_IWUSR); 107module_param(tsc_tolerance_ppm, uint, S_IRUGO | S_IWUSR);
108 108
109static bool backwards_tsc_observed = false;
110
109#define KVM_NR_SHARED_MSRS 16 111#define KVM_NR_SHARED_MSRS 16
110 112
111struct kvm_shared_msrs_global { 113struct kvm_shared_msrs_global {
@@ -280,7 +282,7 @@ int kvm_set_apic_base(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
280} 282}
281EXPORT_SYMBOL_GPL(kvm_set_apic_base); 283EXPORT_SYMBOL_GPL(kvm_set_apic_base);
282 284
283asmlinkage void kvm_spurious_fault(void) 285asmlinkage __visible void kvm_spurious_fault(void)
284{ 286{
285 /* Fault while not rebooting. We want the trace. */ 287 /* Fault while not rebooting. We want the trace. */
286 BUG(); 288 BUG();
@@ -1486,7 +1488,8 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm)
1486 &ka->master_kernel_ns, 1488 &ka->master_kernel_ns,
1487 &ka->master_cycle_now); 1489 &ka->master_cycle_now);
1488 1490
1489 ka->use_master_clock = host_tsc_clocksource & vcpus_matched; 1491 ka->use_master_clock = host_tsc_clocksource && vcpus_matched
1492 && !backwards_tsc_observed;
1490 1493
1491 if (ka->use_master_clock) 1494 if (ka->use_master_clock)
1492 atomic_set(&kvm_guest_has_master_clock, 1); 1495 atomic_set(&kvm_guest_has_master_clock, 1);
@@ -6945,6 +6948,7 @@ int kvm_arch_hardware_enable(void *garbage)
6945 */ 6948 */
6946 if (backwards_tsc) { 6949 if (backwards_tsc) {
6947 u64 delta_cyc = max_tsc - local_tsc; 6950 u64 delta_cyc = max_tsc - local_tsc;
6951 backwards_tsc_observed = true;
6948 list_for_each_entry(kvm, &vm_list, vm_list) { 6952 list_for_each_entry(kvm, &vm_list, vm_list) {
6949 kvm_for_each_vcpu(i, vcpu, kvm) { 6953 kvm_for_each_vcpu(i, vcpu, kvm) {
6950 vcpu->arch.tsc_offset_adjustment += delta_cyc; 6954 vcpu->arch.tsc_offset_adjustment += delta_cyc;
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index ad1fb5f53925..aae94132bc24 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -233,13 +233,13 @@ static void lguest_end_context_switch(struct task_struct *next)
233 * flags word contains all kind of stuff, but in practice Linux only cares 233 * flags word contains all kind of stuff, but in practice Linux only cares
234 * about the interrupt flag. Our "save_flags()" just returns that. 234 * about the interrupt flag. Our "save_flags()" just returns that.
235 */ 235 */
236asmlinkage unsigned long lguest_save_fl(void) 236asmlinkage __visible unsigned long lguest_save_fl(void)
237{ 237{
238 return lguest_data.irq_enabled; 238 return lguest_data.irq_enabled;
239} 239}
240 240
241/* Interrupts go off... */ 241/* Interrupts go off... */
242asmlinkage void lguest_irq_disable(void) 242asmlinkage __visible void lguest_irq_disable(void)
243{ 243{
244 lguest_data.irq_enabled = 0; 244 lguest_data.irq_enabled = 0;
245} 245}
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index db9db446b71a..43623739c7cf 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -76,7 +76,7 @@ static inline int __flip_bit(u32 msr, u8 bit, bool set)
76 if (m1.q == m.q) 76 if (m1.q == m.q)
77 return 0; 77 return 0;
78 78
79 err = msr_write(msr, &m); 79 err = msr_write(msr, &m1);
80 if (err) 80 if (err)
81 return err; 81 return err;
82 82
diff --git a/arch/x86/math-emu/errors.c b/arch/x86/math-emu/errors.c
index a5449089cd9f..9e6545f269e5 100644
--- a/arch/x86/math-emu/errors.c
+++ b/arch/x86/math-emu/errors.c
@@ -302,7 +302,7 @@ static struct {
302 0x242 in div_Xsig.S 302 0x242 in div_Xsig.S
303 */ 303 */
304 304
305asmlinkage void FPU_exception(int n) 305asmlinkage __visible void FPU_exception(int n)
306{ 306{
307 int i, int_type; 307 int i, int_type;
308 308
@@ -492,7 +492,7 @@ int real_2op_NaN(FPU_REG const *b, u_char tagb,
492 492
493/* Invalid arith operation on Valid registers */ 493/* Invalid arith operation on Valid registers */
494/* Returns < 0 if the exception is unmasked */ 494/* Returns < 0 if the exception is unmasked */
495asmlinkage int arith_invalid(int deststnr) 495asmlinkage __visible int arith_invalid(int deststnr)
496{ 496{
497 497
498 EXCEPTION(EX_Invalid); 498 EXCEPTION(EX_Invalid);
@@ -507,7 +507,7 @@ asmlinkage int arith_invalid(int deststnr)
507} 507}
508 508
509/* Divide a finite number by zero */ 509/* Divide a finite number by zero */
510asmlinkage int FPU_divide_by_zero(int deststnr, u_char sign) 510asmlinkage __visible int FPU_divide_by_zero(int deststnr, u_char sign)
511{ 511{
512 FPU_REG *dest = &st(deststnr); 512 FPU_REG *dest = &st(deststnr);
513 int tag = TAG_Valid; 513 int tag = TAG_Valid;
@@ -539,7 +539,7 @@ int set_precision_flag(int flags)
539} 539}
540 540
541/* This may be called often, so keep it lean */ 541/* This may be called often, so keep it lean */
542asmlinkage void set_precision_flag_up(void) 542asmlinkage __visible void set_precision_flag_up(void)
543{ 543{
544 if (control_word & CW_Precision) 544 if (control_word & CW_Precision)
545 partial_status |= (SW_Precision | SW_C1); /* The masked response */ 545 partial_status |= (SW_Precision | SW_C1); /* The masked response */
@@ -548,7 +548,7 @@ asmlinkage void set_precision_flag_up(void)
548} 548}
549 549
550/* This may be called often, so keep it lean */ 550/* This may be called often, so keep it lean */
551asmlinkage void set_precision_flag_down(void) 551asmlinkage __visible void set_precision_flag_down(void)
552{ 552{
553 if (control_word & CW_Precision) { /* The masked response */ 553 if (control_word & CW_Precision) { /* The masked response */
554 partial_status &= ~SW_C1; 554 partial_status &= ~SW_C1;
@@ -557,7 +557,7 @@ asmlinkage void set_precision_flag_down(void)
557 EXCEPTION(EX_Precision); 557 EXCEPTION(EX_Precision);
558} 558}
559 559
560asmlinkage int denormal_operand(void) 560asmlinkage __visible int denormal_operand(void)
561{ 561{
562 if (control_word & CW_Denormal) { /* The masked response */ 562 if (control_word & CW_Denormal) { /* The masked response */
563 partial_status |= SW_Denorm_Op; 563 partial_status |= SW_Denorm_Op;
@@ -568,7 +568,7 @@ asmlinkage int denormal_operand(void)
568 } 568 }
569} 569}
570 570
571asmlinkage int arith_overflow(FPU_REG *dest) 571asmlinkage __visible int arith_overflow(FPU_REG *dest)
572{ 572{
573 int tag = TAG_Valid; 573 int tag = TAG_Valid;
574 574
@@ -596,7 +596,7 @@ asmlinkage int arith_overflow(FPU_REG *dest)
596 596
597} 597}
598 598
599asmlinkage int arith_underflow(FPU_REG *dest) 599asmlinkage __visible int arith_underflow(FPU_REG *dest)
600{ 600{
601 int tag = TAG_Valid; 601 int tag = TAG_Valid;
602 602
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index dc017735bb91..6d5663a599a7 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -171,7 +171,7 @@ static struct bpf_binary_header *bpf_alloc_binary(unsigned int proglen,
171 memset(header, 0xcc, sz); /* fill whole space with int3 instructions */ 171 memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
172 172
173 header->pages = sz / PAGE_SIZE; 173 header->pages = sz / PAGE_SIZE;
174 hole = sz - (proglen + sizeof(*header)); 174 hole = min(sz - (proglen + sizeof(*header)), PAGE_SIZE - sizeof(*header));
175 175
176 /* insert a random number of int3 instructions before BPF code */ 176 /* insert a random number of int3 instructions before BPF code */
177 *image_ptr = &header->image[prandom_u32() % hole]; 177 *image_ptr = &header->image[prandom_u32() % hole];
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 01edac6c5e18..5075371ab593 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -489,8 +489,12 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
489 } 489 }
490 490
491 node = acpi_get_node(device->handle); 491 node = acpi_get_node(device->handle);
492 if (node == NUMA_NO_NODE) 492 if (node == NUMA_NO_NODE) {
493 node = x86_pci_root_bus_node(busnum); 493 node = x86_pci_root_bus_node(busnum);
494 if (node != 0 && node != NUMA_NO_NODE)
495 dev_info(&device->dev, FW_BUG "no _PXM; falling back to node %d from hardware (may be inconsistent with ACPI node numbers)\n",
496 node);
497 }
494 498
495 if (node != NUMA_NO_NODE && !node_online(node)) 499 if (node != NUMA_NO_NODE && !node_online(node))
496 node = NUMA_NO_NODE; 500 node = NUMA_NO_NODE;
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index e88f4c53d7f6..c20d2cc7ef64 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -11,27 +11,33 @@
11 11
12#include "bus_numa.h" 12#include "bus_numa.h"
13 13
14/* 14#define AMD_NB_F0_NODE_ID 0x60
15 * This discovers the pcibus <-> node mapping on AMD K8. 15#define AMD_NB_F0_UNIT_ID 0x64
16 * also get peer root bus resource for io,mmio 16#define AMD_NB_F1_CONFIG_MAP_REG 0xe0
17 */ 17
18#define RANGE_NUM 16
19#define AMD_NB_F1_CONFIG_MAP_RANGES 4
18 20
19struct pci_hostbridge_probe { 21struct amd_hostbridge {
20 u32 bus; 22 u32 bus;
21 u32 slot; 23 u32 slot;
22 u32 vendor;
23 u32 device; 24 u32 device;
24}; 25};
25 26
26static struct pci_hostbridge_probe pci_probes[] __initdata = { 27/*
27 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1100 }, 28 * IMPORTANT NOTE:
28 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1200 }, 29 * hb_probes[] and early_root_info_init() is in maintenance mode.
29 { 0xff, 0, PCI_VENDOR_ID_AMD, 0x1200 }, 30 * It only supports K8, Fam10h, Fam11h, and Fam15h_00h-0fh .
30 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1300 }, 31 * Future processor will rely on information in ACPI.
32 */
33static struct amd_hostbridge hb_probes[] __initdata = {
34 { 0, 0x18, 0x1100 }, /* K8 */
35 { 0, 0x18, 0x1200 }, /* Family10h */
36 { 0xff, 0, 0x1200 }, /* Family10h */
37 { 0, 0x18, 0x1300 }, /* Family11h */
38 { 0, 0x18, 0x1600 }, /* Family15h */
31}; 39};
32 40
33#define RANGE_NUM 16
34
35static struct pci_root_info __init *find_pci_root_info(int node, int link) 41static struct pci_root_info __init *find_pci_root_info(int node, int link)
36{ 42{
37 struct pci_root_info *info; 43 struct pci_root_info *info;
@@ -45,12 +51,12 @@ static struct pci_root_info __init *find_pci_root_info(int node, int link)
45} 51}
46 52
47/** 53/**
48 * early_fill_mp_bus_to_node() 54 * early_root_info_init()
49 * called before pcibios_scan_root and pci_scan_bus 55 * called before pcibios_scan_root and pci_scan_bus
50 * fills the mp_bus_to_cpumask array based according to the LDT Bus Number 56 * fills the mp_bus_to_cpumask array based according
51 * Registers found in the K8 northbridge 57 * to the LDT Bus Number Registers found in the northbridge.
52 */ 58 */
53static int __init early_fill_mp_bus_info(void) 59static int __init early_root_info_init(void)
54{ 60{
55 int i; 61 int i;
56 unsigned bus; 62 unsigned bus;
@@ -75,19 +81,21 @@ static int __init early_fill_mp_bus_info(void)
75 return -1; 81 return -1;
76 82
77 found = false; 83 found = false;
78 for (i = 0; i < ARRAY_SIZE(pci_probes); i++) { 84 for (i = 0; i < ARRAY_SIZE(hb_probes); i++) {
79 u32 id; 85 u32 id;
80 u16 device; 86 u16 device;
81 u16 vendor; 87 u16 vendor;
82 88
83 bus = pci_probes[i].bus; 89 bus = hb_probes[i].bus;
84 slot = pci_probes[i].slot; 90 slot = hb_probes[i].slot;
85 id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID); 91 id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID);
86
87 vendor = id & 0xffff; 92 vendor = id & 0xffff;
88 device = (id>>16) & 0xffff; 93 device = (id>>16) & 0xffff;
89 if (pci_probes[i].vendor == vendor && 94
90 pci_probes[i].device == device) { 95 if (vendor != PCI_VENDOR_ID_AMD)
96 continue;
97
98 if (hb_probes[i].device == device) {
91 found = true; 99 found = true;
92 break; 100 break;
93 } 101 }
@@ -96,10 +104,16 @@ static int __init early_fill_mp_bus_info(void)
96 if (!found) 104 if (!found)
97 return 0; 105 return 0;
98 106
99 for (i = 0; i < 4; i++) { 107 /*
108 * We should learn topology and routing information from _PXM and
109 * _CRS methods in the ACPI namespace. We extract node numbers
110 * here to work around BIOSes that don't supply _PXM.
111 */
112 for (i = 0; i < AMD_NB_F1_CONFIG_MAP_RANGES; i++) {
100 int min_bus; 113 int min_bus;
101 int max_bus; 114 int max_bus;
102 reg = read_pci_config(bus, slot, 1, 0xe0 + (i << 2)); 115 reg = read_pci_config(bus, slot, 1,
116 AMD_NB_F1_CONFIG_MAP_REG + (i << 2));
103 117
104 /* Check if that register is enabled for bus range */ 118 /* Check if that register is enabled for bus range */
105 if ((reg & 7) != 3) 119 if ((reg & 7) != 3)
@@ -113,10 +127,21 @@ static int __init early_fill_mp_bus_info(void)
113 info = alloc_pci_root_info(min_bus, max_bus, node, link); 127 info = alloc_pci_root_info(min_bus, max_bus, node, link);
114 } 128 }
115 129
130 /*
131 * The following code extracts routing information for use on old
132 * systems where Linux doesn't automatically use host bridge _CRS
133 * methods (or when the user specifies "pci=nocrs").
134 *
135 * We only do this through Fam11h, because _CRS should be enough on
136 * newer systems.
137 */
138 if (boot_cpu_data.x86 > 0x11)
139 return 0;
140
116 /* get the default node and link for left over res */ 141 /* get the default node and link for left over res */
117 reg = read_pci_config(bus, slot, 0, 0x60); 142 reg = read_pci_config(bus, slot, 0, AMD_NB_F0_NODE_ID);
118 def_node = (reg >> 8) & 0x07; 143 def_node = (reg >> 8) & 0x07;
119 reg = read_pci_config(bus, slot, 0, 0x64); 144 reg = read_pci_config(bus, slot, 0, AMD_NB_F0_UNIT_ID);
120 def_link = (reg >> 8) & 0x03; 145 def_link = (reg >> 8) & 0x03;
121 146
122 memset(range, 0, sizeof(range)); 147 memset(range, 0, sizeof(range));
@@ -363,7 +388,7 @@ static int __init pci_io_ecs_init(void)
363 int cpu; 388 int cpu;
364 389
365 /* assume all cpus from fam10h have IO ECS */ 390 /* assume all cpus from fam10h have IO ECS */
366 if (boot_cpu_data.x86 < 0x10) 391 if (boot_cpu_data.x86 < 0x10)
367 return 0; 392 return 0;
368 393
369 /* Try the PCI method first. */ 394 /* Try the PCI method first. */
@@ -387,7 +412,7 @@ static int __init amd_postcore_init(void)
387 if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) 412 if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
388 return 0; 413 return 0;
389 414
390 early_fill_mp_bus_info(); 415 early_root_info_init();
391 pci_io_ecs_init(); 416 pci_io_ecs_init();
392 417
393 return 0; 418 return 0;
diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c
index 614392ced7d6..bb461cfd01ab 100644
--- a/arch/x86/pci/broadcom_bus.c
+++ b/arch/x86/pci/broadcom_bus.c
@@ -60,8 +60,8 @@ static void __init cnb20le_res(u8 bus, u8 slot, u8 func)
60 word1 = read_pci_config_16(bus, slot, func, 0xc4); 60 word1 = read_pci_config_16(bus, slot, func, 0xc4);
61 word2 = read_pci_config_16(bus, slot, func, 0xc6); 61 word2 = read_pci_config_16(bus, slot, func, 0xc6);
62 if (word1 != word2) { 62 if (word1 != word2) {
63 res.start = (word1 << 16) | 0x0000; 63 res.start = ((resource_size_t) word1 << 16) | 0x0000;
64 res.end = (word2 << 16) | 0xffff; 64 res.end = ((resource_size_t) word2 << 16) | 0xffff;
65 res.flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; 65 res.flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
66 update_res(info, res.start, res.end, res.flags, 0); 66 update_res(info, res.start, res.end, res.flags, 0);
67 } 67 }
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 94ae9ae9574f..b5e60268d93f 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -6,6 +6,7 @@
6#include <linux/dmi.h> 6#include <linux/dmi.h>
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/vgaarb.h> 8#include <linux/vgaarb.h>
9#include <asm/hpet.h>
9#include <asm/pci_x86.h> 10#include <asm/pci_x86.h>
10 11
11static void pci_fixup_i450nx(struct pci_dev *d) 12static void pci_fixup_i450nx(struct pci_dev *d)
@@ -337,9 +338,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
337 * type BRIDGE, or CARDBUS. Host to PCI controllers use 338 * type BRIDGE, or CARDBUS. Host to PCI controllers use
338 * PCI header type NORMAL. 339 * PCI header type NORMAL.
339 */ 340 */
340 if (bridge 341 if (bridge && (pci_is_bridge(bridge))) {
341 && ((bridge->hdr_type == PCI_HEADER_TYPE_BRIDGE)
342 || (bridge->hdr_type == PCI_HEADER_TYPE_CARDBUS))) {
343 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, 342 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
344 &config); 343 &config);
345 if (!(config & PCI_BRIDGE_CTL_VGA)) 344 if (!(config & PCI_BRIDGE_CTL_VGA))
@@ -526,6 +525,19 @@ static void sb600_disable_hpet_bar(struct pci_dev *dev)
526} 525}
527DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, 0x4385, sb600_disable_hpet_bar); 526DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, 0x4385, sb600_disable_hpet_bar);
528 527
528#ifdef CONFIG_HPET_TIMER
529static void sb600_hpet_quirk(struct pci_dev *dev)
530{
531 struct resource *r = &dev->resource[1];
532
533 if (r->flags & IORESOURCE_MEM && r->start == hpet_address) {
534 r->flags |= IORESOURCE_PCI_FIXED;
535 dev_info(&dev->dev, "reg 0x14 contains HPET; making it immovable\n");
536 }
537}
538DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, 0x4385, sb600_hpet_quirk);
539#endif
540
529/* 541/*
530 * Twinhead H12Y needs us to block out a region otherwise we map devices 542 * Twinhead H12Y needs us to block out a region otherwise we map devices
531 * there and any access kills the box. 543 * there and any access kills the box.
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index db6b1ab43255..a19ed92e74e4 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -271,11 +271,16 @@ static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
271 "BAR %d: reserving %pr (d=%d, p=%d)\n", 271 "BAR %d: reserving %pr (d=%d, p=%d)\n",
272 idx, r, disabled, pass); 272 idx, r, disabled, pass);
273 if (pci_claim_resource(dev, idx) < 0) { 273 if (pci_claim_resource(dev, idx) < 0) {
274 /* We'll assign a new address later */ 274 if (r->flags & IORESOURCE_PCI_FIXED) {
275 pcibios_save_fw_addr(dev, 275 dev_info(&dev->dev, "BAR %d %pR is immovable\n",
276 idx, r->start); 276 idx, r);
277 r->end -= r->start; 277 } else {
278 r->start = 0; 278 /* We'll assign a new address later */
279 pcibios_save_fw_addr(dev,
280 idx, r->start);
281 r->end -= r->start;
282 r->start = 0;
283 }
279 } 284 }
280 } 285 }
281 } 286 }
@@ -356,6 +361,12 @@ static int __init pcibios_assign_resources(void)
356 return 0; 361 return 0;
357} 362}
358 363
364/**
365 * called in fs_initcall (one below subsys_initcall),
366 * give a chance for motherboard reserve resources
367 */
368fs_initcall(pcibios_assign_resources);
369
359void pcibios_resource_survey_bus(struct pci_bus *bus) 370void pcibios_resource_survey_bus(struct pci_bus *bus)
360{ 371{
361 dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n"); 372 dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n");
@@ -392,12 +403,6 @@ void __init pcibios_resource_survey(void)
392 ioapic_insert_resources(); 403 ioapic_insert_resources();
393} 404}
394 405
395/**
396 * called in fs_initcall (one below subsys_initcall),
397 * give a chance for motherboard reserve resources
398 */
399fs_initcall(pcibios_assign_resources);
400
401static const struct vm_operations_struct pci_mmap_ops = { 406static const struct vm_operations_struct pci_mmap_ops = {
402 .access = generic_access_phys, 407 .access = generic_access_phys,
403}; 408};
diff --git a/arch/x86/platform/efi/early_printk.c b/arch/x86/platform/efi/early_printk.c
index 81b506d5befd..524142117296 100644
--- a/arch/x86/platform/efi/early_printk.c
+++ b/arch/x86/platform/efi/early_printk.c
@@ -14,48 +14,92 @@
14 14
15static const struct font_desc *font; 15static const struct font_desc *font;
16static u32 efi_x, efi_y; 16static u32 efi_x, efi_y;
17static void *efi_fb;
18static bool early_efi_keep;
17 19
18static __init void early_efi_clear_scanline(unsigned int y) 20/*
21 * efi earlyprintk need use early_ioremap to map the framebuffer.
22 * But early_ioremap is not usable for earlyprintk=efi,keep, ioremap should
23 * be used instead. ioremap will be available after paging_init() which is
24 * earlier than initcall callbacks. Thus adding this early initcall function
25 * early_efi_map_fb to map the whole efi framebuffer.
26 */
27static __init int early_efi_map_fb(void)
19{ 28{
20 unsigned long base, *dst; 29 unsigned long base, size;
21 u16 len; 30
31 if (!early_efi_keep)
32 return 0;
22 33
23 base = boot_params.screen_info.lfb_base; 34 base = boot_params.screen_info.lfb_base;
24 len = boot_params.screen_info.lfb_linelength; 35 size = boot_params.screen_info.lfb_size;
36 efi_fb = ioremap(base, size);
37
38 return efi_fb ? 0 : -ENOMEM;
39}
40early_initcall(early_efi_map_fb);
41
42/*
43 * early_efi_map maps efi framebuffer region [start, start + len -1]
44 * In case earlyprintk=efi,keep we have the whole framebuffer mapped already
45 * so just return the offset efi_fb + start.
46 */
47static __init_refok void *early_efi_map(unsigned long start, unsigned long len)
48{
49 unsigned long base;
50
51 base = boot_params.screen_info.lfb_base;
52
53 if (efi_fb)
54 return (efi_fb + start);
55 else
56 return early_ioremap(base + start, len);
57}
25 58
26 dst = early_ioremap(base + y*len, len); 59static __init_refok void early_efi_unmap(void *addr, unsigned long len)
60{
61 if (!efi_fb)
62 early_iounmap(addr, len);
63}
64
65static void early_efi_clear_scanline(unsigned int y)
66{
67 unsigned long *dst;
68 u16 len;
69
70 len = boot_params.screen_info.lfb_linelength;
71 dst = early_efi_map(y*len, len);
27 if (!dst) 72 if (!dst)
28 return; 73 return;
29 74
30 memset(dst, 0, len); 75 memset(dst, 0, len);
31 early_iounmap(dst, len); 76 early_efi_unmap(dst, len);
32} 77}
33 78
34static __init void early_efi_scroll_up(void) 79static void early_efi_scroll_up(void)
35{ 80{
36 unsigned long base, *dst, *src; 81 unsigned long *dst, *src;
37 u16 len; 82 u16 len;
38 u32 i, height; 83 u32 i, height;
39 84
40 base = boot_params.screen_info.lfb_base;
41 len = boot_params.screen_info.lfb_linelength; 85 len = boot_params.screen_info.lfb_linelength;
42 height = boot_params.screen_info.lfb_height; 86 height = boot_params.screen_info.lfb_height;
43 87
44 for (i = 0; i < height - font->height; i++) { 88 for (i = 0; i < height - font->height; i++) {
45 dst = early_ioremap(base + i*len, len); 89 dst = early_efi_map(i*len, len);
46 if (!dst) 90 if (!dst)
47 return; 91 return;
48 92
49 src = early_ioremap(base + (i + font->height) * len, len); 93 src = early_efi_map((i + font->height) * len, len);
50 if (!src) { 94 if (!src) {
51 early_iounmap(dst, len); 95 early_efi_unmap(dst, len);
52 return; 96 return;
53 } 97 }
54 98
55 memmove(dst, src, len); 99 memmove(dst, src, len);
56 100
57 early_iounmap(src, len); 101 early_efi_unmap(src, len);
58 early_iounmap(dst, len); 102 early_efi_unmap(dst, len);
59 } 103 }
60} 104}
61 105
@@ -79,16 +123,14 @@ static void early_efi_write_char(u32 *dst, unsigned char c, unsigned int h)
79 } 123 }
80} 124}
81 125
82static __init void 126static void
83early_efi_write(struct console *con, const char *str, unsigned int num) 127early_efi_write(struct console *con, const char *str, unsigned int num)
84{ 128{
85 struct screen_info *si; 129 struct screen_info *si;
86 unsigned long base;
87 unsigned int len; 130 unsigned int len;
88 const char *s; 131 const char *s;
89 void *dst; 132 void *dst;
90 133
91 base = boot_params.screen_info.lfb_base;
92 si = &boot_params.screen_info; 134 si = &boot_params.screen_info;
93 len = si->lfb_linelength; 135 len = si->lfb_linelength;
94 136
@@ -109,7 +151,7 @@ early_efi_write(struct console *con, const char *str, unsigned int num)
109 for (h = 0; h < font->height; h++) { 151 for (h = 0; h < font->height; h++) {
110 unsigned int n, x; 152 unsigned int n, x;
111 153
112 dst = early_ioremap(base + (efi_y + h) * len, len); 154 dst = early_efi_map((efi_y + h) * len, len);
113 if (!dst) 155 if (!dst)
114 return; 156 return;
115 157
@@ -123,7 +165,7 @@ early_efi_write(struct console *con, const char *str, unsigned int num)
123 s++; 165 s++;
124 } 166 }
125 167
126 early_iounmap(dst, len); 168 early_efi_unmap(dst, len);
127 } 169 }
128 170
129 num -= count; 171 num -= count;
@@ -179,6 +221,9 @@ static __init int early_efi_setup(struct console *con, char *options)
179 for (i = 0; i < (yres - efi_y) / font->height; i++) 221 for (i = 0; i < (yres - efi_y) / font->height; i++)
180 early_efi_scroll_up(); 222 early_efi_scroll_up();
181 223
224 /* early_console_register will unset CON_BOOT in case ,keep */
225 if (!(con->flags & CON_BOOT))
226 early_efi_keep = true;
182 return 0; 227 return 0;
183} 228}
184 229
diff --git a/arch/x86/platform/olpc/olpc-xo1-pm.c b/arch/x86/platform/olpc/olpc-xo1-pm.c
index ff0174dda810..a9acde72d4ed 100644
--- a/arch/x86/platform/olpc/olpc-xo1-pm.c
+++ b/arch/x86/platform/olpc/olpc-xo1-pm.c
@@ -75,7 +75,7 @@ static int xo1_power_state_enter(suspend_state_t pm_state)
75 return 0; 75 return 0;
76} 76}
77 77
78asmlinkage int xo1_do_sleep(u8 sleep_state) 78asmlinkage __visible int xo1_do_sleep(u8 sleep_state)
79{ 79{
80 void *pgd_addr = __va(read_cr3()); 80 void *pgd_addr = __va(read_cr3());
81 81
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index 304fca20d96e..35e2bb6c0f37 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -23,7 +23,7 @@
23extern __visible const void __nosave_begin, __nosave_end; 23extern __visible const void __nosave_begin, __nosave_end;
24 24
25/* Defined in hibernate_asm_64.S */ 25/* Defined in hibernate_asm_64.S */
26extern asmlinkage int restore_image(void); 26extern asmlinkage __visible int restore_image(void);
27 27
28/* 28/*
29 * Address to jump to in the last phase of restore in order to get to the image 29 * Address to jump to in the last phase of restore in order to get to the image
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 00348980a3a6..e1f220e3ca68 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -39,6 +39,7 @@
39#ifdef CONFIG_X86_64 39#ifdef CONFIG_X86_64
40#define vdso_enabled sysctl_vsyscall32 40#define vdso_enabled sysctl_vsyscall32
41#define arch_setup_additional_pages syscall32_setup_pages 41#define arch_setup_additional_pages syscall32_setup_pages
42extern int sysctl_ldt16;
42#endif 43#endif
43 44
44/* 45/*
@@ -249,6 +250,13 @@ static struct ctl_table abi_table2[] = {
249 .mode = 0644, 250 .mode = 0644,
250 .proc_handler = proc_dointvec 251 .proc_handler = proc_dointvec
251 }, 252 },
253 {
254 .procname = "ldt16",
255 .data = &sysctl_ldt16,
256 .maxlen = sizeof(int),
257 .mode = 0644,
258 .proc_handler = proc_dointvec
259 },
252 {} 260 {}
253}; 261};
254 262
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 201d09a7c46b..f17b29210ac4 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1339,6 +1339,7 @@ xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
1339 1339
1340static struct notifier_block xen_panic_block = { 1340static struct notifier_block xen_panic_block = {
1341 .notifier_call= xen_panic_event, 1341 .notifier_call= xen_panic_event,
1342 .priority = INT_MIN
1342}; 1343};
1343 1344
1344int xen_panic_handler_init(void) 1345int xen_panic_handler_init(void)
@@ -1515,7 +1516,7 @@ static void __init xen_pvh_early_guest_init(void)
1515} 1516}
1516 1517
1517/* First C function to be called on Xen boot */ 1518/* First C function to be called on Xen boot */
1518asmlinkage void __init xen_start_kernel(void) 1519asmlinkage __visible void __init xen_start_kernel(void)
1519{ 1520{
1520 struct physdev_set_iopl set_iopl; 1521 struct physdev_set_iopl set_iopl;
1521 int rc; 1522 int rc;
diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
index 08f763de26fe..a1207cb6472a 100644
--- a/arch/x86/xen/irq.c
+++ b/arch/x86/xen/irq.c
@@ -23,7 +23,7 @@ void xen_force_evtchn_callback(void)
23 (void)HYPERVISOR_xen_version(0, NULL); 23 (void)HYPERVISOR_xen_version(0, NULL);
24} 24}
25 25
26asmlinkage unsigned long xen_save_fl(void) 26asmlinkage __visible unsigned long xen_save_fl(void)
27{ 27{
28 struct vcpu_info *vcpu; 28 struct vcpu_info *vcpu;
29 unsigned long flags; 29 unsigned long flags;
@@ -63,7 +63,7 @@ __visible void xen_restore_fl(unsigned long flags)
63} 63}
64PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl); 64PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl);
65 65
66asmlinkage void xen_irq_disable(void) 66asmlinkage __visible void xen_irq_disable(void)
67{ 67{
68 /* There's a one instruction preempt window here. We need to 68 /* There's a one instruction preempt window here. We need to
69 make sure we're don't switch CPUs between getting the vcpu 69 make sure we're don't switch CPUs between getting the vcpu
@@ -74,7 +74,7 @@ asmlinkage void xen_irq_disable(void)
74} 74}
75PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable); 75PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
76 76
77asmlinkage void xen_irq_enable(void) 77asmlinkage __visible void xen_irq_enable(void)
78{ 78{
79 struct vcpu_info *vcpu; 79 struct vcpu_info *vcpu;
80 80
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 86e02eabb640..6f6e15d28466 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -2510,6 +2510,95 @@ void __init xen_hvm_init_mmu_ops(void)
2510} 2510}
2511#endif 2511#endif
2512 2512
2513#ifdef CONFIG_XEN_PVH
2514/*
2515 * Map foreign gfn (fgfn), to local pfn (lpfn). This for the user
2516 * space creating new guest on pvh dom0 and needing to map domU pages.
2517 */
2518static int xlate_add_to_p2m(unsigned long lpfn, unsigned long fgfn,
2519 unsigned int domid)
2520{
2521 int rc, err = 0;
2522 xen_pfn_t gpfn = lpfn;
2523 xen_ulong_t idx = fgfn;
2524
2525 struct xen_add_to_physmap_range xatp = {
2526 .domid = DOMID_SELF,
2527 .foreign_domid = domid,
2528 .size = 1,
2529 .space = XENMAPSPACE_gmfn_foreign,
2530 };
2531 set_xen_guest_handle(xatp.idxs, &idx);
2532 set_xen_guest_handle(xatp.gpfns, &gpfn);
2533 set_xen_guest_handle(xatp.errs, &err);
2534
2535 rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &xatp);
2536 if (rc < 0)
2537 return rc;
2538 return err;
2539}
2540
2541static int xlate_remove_from_p2m(unsigned long spfn, int count)
2542{
2543 struct xen_remove_from_physmap xrp;
2544 int i, rc;
2545
2546 for (i = 0; i < count; i++) {
2547 xrp.domid = DOMID_SELF;
2548 xrp.gpfn = spfn+i;
2549 rc = HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &xrp);
2550 if (rc)
2551 break;
2552 }
2553 return rc;
2554}
2555
2556struct xlate_remap_data {
2557 unsigned long fgfn; /* foreign domain's gfn */
2558 pgprot_t prot;
2559 domid_t domid;
2560 int index;
2561 struct page **pages;
2562};
2563
2564static int xlate_map_pte_fn(pte_t *ptep, pgtable_t token, unsigned long addr,
2565 void *data)
2566{
2567 int rc;
2568 struct xlate_remap_data *remap = data;
2569 unsigned long pfn = page_to_pfn(remap->pages[remap->index++]);
2570 pte_t pteval = pte_mkspecial(pfn_pte(pfn, remap->prot));
2571
2572 rc = xlate_add_to_p2m(pfn, remap->fgfn, remap->domid);
2573 if (rc)
2574 return rc;
2575 native_set_pte(ptep, pteval);
2576
2577 return 0;
2578}
2579
2580static int xlate_remap_gfn_range(struct vm_area_struct *vma,
2581 unsigned long addr, unsigned long mfn,
2582 int nr, pgprot_t prot, unsigned domid,
2583 struct page **pages)
2584{
2585 int err;
2586 struct xlate_remap_data pvhdata;
2587
2588 BUG_ON(!pages);
2589
2590 pvhdata.fgfn = mfn;
2591 pvhdata.prot = prot;
2592 pvhdata.domid = domid;
2593 pvhdata.index = 0;
2594 pvhdata.pages = pages;
2595 err = apply_to_page_range(vma->vm_mm, addr, nr << PAGE_SHIFT,
2596 xlate_map_pte_fn, &pvhdata);
2597 flush_tlb_all();
2598 return err;
2599}
2600#endif
2601
2513#define REMAP_BATCH_SIZE 16 2602#define REMAP_BATCH_SIZE 16
2514 2603
2515struct remap_data { 2604struct remap_data {
@@ -2522,7 +2611,7 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token,
2522 unsigned long addr, void *data) 2611 unsigned long addr, void *data)
2523{ 2612{
2524 struct remap_data *rmd = data; 2613 struct remap_data *rmd = data;
2525 pte_t pte = pte_mkspecial(pfn_pte(rmd->mfn++, rmd->prot)); 2614 pte_t pte = pte_mkspecial(mfn_pte(rmd->mfn++, rmd->prot));
2526 2615
2527 rmd->mmu_update->ptr = virt_to_machine(ptep).maddr; 2616 rmd->mmu_update->ptr = virt_to_machine(ptep).maddr;
2528 rmd->mmu_update->val = pte_val_ma(pte); 2617 rmd->mmu_update->val = pte_val_ma(pte);
@@ -2544,13 +2633,18 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
2544 unsigned long range; 2633 unsigned long range;
2545 int err = 0; 2634 int err = 0;
2546 2635
2547 if (xen_feature(XENFEAT_auto_translated_physmap))
2548 return -EINVAL;
2549
2550 prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP);
2551
2552 BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_IO)) == (VM_PFNMAP | VM_IO))); 2636 BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_IO)) == (VM_PFNMAP | VM_IO)));
2553 2637
2638 if (xen_feature(XENFEAT_auto_translated_physmap)) {
2639#ifdef CONFIG_XEN_PVH
2640 /* We need to update the local page tables and the xen HAP */
2641 return xlate_remap_gfn_range(vma, addr, mfn, nr, prot,
2642 domid, pages);
2643#else
2644 return -EINVAL;
2645#endif
2646 }
2647
2554 rmd.mfn = mfn; 2648 rmd.mfn = mfn;
2555 rmd.prot = prot; 2649 rmd.prot = prot;
2556 2650
@@ -2588,6 +2682,25 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
2588 if (!pages || !xen_feature(XENFEAT_auto_translated_physmap)) 2682 if (!pages || !xen_feature(XENFEAT_auto_translated_physmap))
2589 return 0; 2683 return 0;
2590 2684
2685#ifdef CONFIG_XEN_PVH
2686 while (numpgs--) {
2687 /*
2688 * The mmu has already cleaned up the process mmu
2689 * resources at this point (lookup_address will return
2690 * NULL).
2691 */
2692 unsigned long pfn = page_to_pfn(pages[numpgs]);
2693
2694 xlate_remove_from_p2m(pfn, 1);
2695 }
2696 /*
2697 * We don't need to flush tlbs because as part of
2698 * xlate_remove_from_p2m, the hypervisor will do tlb flushes
2699 * after removing the p2m entries from the EPT/NPT
2700 */
2701 return 0;
2702#else
2591 return -EINVAL; 2703 return -EINVAL;
2704#endif
2592} 2705}
2593EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range); 2706EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range);
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 85e5d78c9874..9bb3d82ffec8 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -36,7 +36,7 @@
36 * pfn_to_mfn(0xc0000)=0xc0000 36 * pfn_to_mfn(0xc0000)=0xc0000
37 * 37 *
38 * The benefit of this is, that we can assume for non-RAM regions (think 38 * The benefit of this is, that we can assume for non-RAM regions (think
39 * PCI BARs, or ACPI spaces), we can create mappings easily b/c we 39 * PCI BARs, or ACPI spaces), we can create mappings easily because we
40 * get the PFN value to match the MFN. 40 * get the PFN value to match the MFN.
41 * 41 *
42 * For this to work efficiently we have one new page p2m_identity and 42 * For this to work efficiently we have one new page p2m_identity and
@@ -60,7 +60,7 @@
60 * There is also a digram of the P2M at the end that can help. 60 * There is also a digram of the P2M at the end that can help.
61 * Imagine your E820 looking as so: 61 * Imagine your E820 looking as so:
62 * 62 *
63 * 1GB 2GB 63 * 1GB 2GB 4GB
64 * /-------------------+---------\/----\ /----------\ /---+-----\ 64 * /-------------------+---------\/----\ /----------\ /---+-----\
65 * | System RAM | Sys RAM ||ACPI| | reserved | | Sys RAM | 65 * | System RAM | Sys RAM ||ACPI| | reserved | | Sys RAM |
66 * \-------------------+---------/\----/ \----------/ \---+-----/ 66 * \-------------------+---------/\----/ \----------/ \---+-----/
@@ -77,9 +77,8 @@
77 * of the PFN and the end PFN (263424 and 512256 respectively). The first step 77 * of the PFN and the end PFN (263424 and 512256 respectively). The first step
78 * is to reserve_brk a top leaf page if the p2m[1] is missing. The top leaf page 78 * is to reserve_brk a top leaf page if the p2m[1] is missing. The top leaf page
79 * covers 512^2 of page estate (1GB) and in case the start or end PFN is not 79 * covers 512^2 of page estate (1GB) and in case the start or end PFN is not
80 * aligned on 512^2*PAGE_SIZE (1GB) we loop on aligned 1GB PFNs from start pfn 80 * aligned on 512^2*PAGE_SIZE (1GB) we reserve_brk new middle and leaf pages as
81 * to end pfn. We reserve_brk top leaf pages if they are missing (means they 81 * required to split any existing p2m_mid_missing middle pages.
82 * point to p2m_mid_missing).
83 * 82 *
84 * With the E820 example above, 263424 is not 1GB aligned so we allocate a 83 * With the E820 example above, 263424 is not 1GB aligned so we allocate a
85 * reserve_brk page which will cover the PFNs estate from 0x40000 to 0x80000. 84 * reserve_brk page which will cover the PFNs estate from 0x40000 to 0x80000.
@@ -88,7 +87,7 @@
88 * Next stage is to determine if we need to do a more granular boundary check 87 * Next stage is to determine if we need to do a more granular boundary check
89 * on the 4MB (or 2MB depending on architecture) off the start and end pfn's. 88 * on the 4MB (or 2MB depending on architecture) off the start and end pfn's.
90 * We check if the start pfn and end pfn violate that boundary check, and if 89 * We check if the start pfn and end pfn violate that boundary check, and if
91 * so reserve_brk a middle (p2m[x][y]) leaf page. This way we have a much finer 90 * so reserve_brk a (p2m[x][y]) leaf page. This way we have a much finer
92 * granularity of setting which PFNs are missing and which ones are identity. 91 * granularity of setting which PFNs are missing and which ones are identity.
93 * In our example 263424 and 512256 both fail the check so we reserve_brk two 92 * In our example 263424 and 512256 both fail the check so we reserve_brk two
94 * pages. Populate them with INVALID_P2M_ENTRY (so they both have "missing" 93 * pages. Populate them with INVALID_P2M_ENTRY (so they both have "missing"
@@ -102,9 +101,10 @@
102 * 101 *
103 * The next step is to walk from the start pfn to the end pfn setting 102 * The next step is to walk from the start pfn to the end pfn setting
104 * the IDENTITY_FRAME_BIT on each PFN. This is done in set_phys_range_identity. 103 * the IDENTITY_FRAME_BIT on each PFN. This is done in set_phys_range_identity.
105 * If we find that the middle leaf is pointing to p2m_missing we can swap it 104 * If we find that the middle entry is pointing to p2m_missing we can swap it
106 * over to p2m_identity - this way covering 4MB (or 2MB) PFN space. At this 105 * over to p2m_identity - this way covering 4MB (or 2MB) PFN space (and
107 * point we do not need to worry about boundary aligment (so no need to 106 * similarly swapping p2m_mid_missing for p2m_mid_identity for larger regions).
107 * At this point we do not need to worry about boundary aligment (so no need to
108 * reserve_brk a middle page, figure out which PFNs are "missing" and which 108 * reserve_brk a middle page, figure out which PFNs are "missing" and which
109 * ones are identity), as that has been done earlier. If we find that the 109 * ones are identity), as that has been done earlier. If we find that the
110 * middle leaf is not occupied by p2m_identity or p2m_missing, we dereference 110 * middle leaf is not occupied by p2m_identity or p2m_missing, we dereference
@@ -118,6 +118,9 @@
118 * considered missing). In our case, p2m[1][2][0->255] and p2m[1][488][257->511] 118 * considered missing). In our case, p2m[1][2][0->255] and p2m[1][488][257->511]
119 * contain the INVALID_P2M_ENTRY value and are considered "missing." 119 * contain the INVALID_P2M_ENTRY value and are considered "missing."
120 * 120 *
121 * Finally, the region beyond the end of of the E820 (4 GB in this example)
122 * is set to be identity (in case there are MMIO regions placed here).
123 *
121 * This is what the p2m ends up looking (for the E820 above) with this 124 * This is what the p2m ends up looking (for the E820 above) with this
122 * fabulous drawing: 125 * fabulous drawing:
123 * 126 *
@@ -129,21 +132,27 @@
129 * |-----| \ | [p2m_identity]+\\ | .... | 132 * |-----| \ | [p2m_identity]+\\ | .... |
130 * | 2 |--\ \-------------------->| ... | \\ \----------------/ 133 * | 2 |--\ \-------------------->| ... | \\ \----------------/
131 * |-----| \ \---------------/ \\ 134 * |-----| \ \---------------/ \\
132 * | 3 |\ \ \\ p2m_identity 135 * | 3 |-\ \ \\ p2m_identity [1]
133 * |-----| \ \-------------------->/---------------\ /-----------------\ 136 * |-----| \ \-------------------->/---------------\ /-----------------\
134 * | .. +->+ | [p2m_identity]+-->| ~0, ~0, ~0, ... | 137 * | .. |\ | | [p2m_identity]+-->| ~0, ~0, ~0, ... |
135 * \-----/ / | [p2m_identity]+-->| ..., ~0 | 138 * \-----/ | | | [p2m_identity]+-->| ..., ~0 |
136 * / /---------------\ | .... | \-----------------/ 139 * | | | .... | \-----------------/
137 * / | IDENTITY[@0] | /-+-[x], ~0, ~0.. | 140 * | | +-[x], ~0, ~0.. +\
138 * / | IDENTITY[@256]|<----/ \---------------/ 141 * | | \---------------/ \
139 * / | ~0, ~0, .... | 142 * | | \-> /---------------\
140 * | \---------------/ 143 * | V p2m_mid_missing p2m_missing | IDENTITY[@0] |
141 * | 144 * | /-----------------\ /------------\ | IDENTITY[@256]|
142 * p2m_mid_missing p2m_missing 145 * | | [p2m_missing] +---->| ~0, ~0, ...| | ~0, ~0, .... |
143 * /-----------------\ /------------\ 146 * | | [p2m_missing] +---->| ..., ~0 | \---------------/
144 * | [p2m_missing] +---->| ~0, ~0, ~0 | 147 * | | ... | \------------/
145 * | [p2m_missing] +---->| ..., ~0 | 148 * | \-----------------/
146 * \-----------------/ \------------/ 149 * |
150 * | p2m_mid_identity
151 * | /-----------------\
152 * \-->| [p2m_identity] +---->[1]
153 * | [p2m_identity] +---->[1]
154 * | ... |
155 * \-----------------/
147 * 156 *
148 * where ~0 is INVALID_P2M_ENTRY. IDENTITY is (PFN | IDENTITY_BIT) 157 * where ~0 is INVALID_P2M_ENTRY. IDENTITY is (PFN | IDENTITY_BIT)
149 */ 158 */
@@ -187,13 +196,15 @@ static RESERVE_BRK_ARRAY(unsigned long, p2m_top_mfn, P2M_TOP_PER_PAGE);
187static RESERVE_BRK_ARRAY(unsigned long *, p2m_top_mfn_p, P2M_TOP_PER_PAGE); 196static RESERVE_BRK_ARRAY(unsigned long *, p2m_top_mfn_p, P2M_TOP_PER_PAGE);
188 197
189static RESERVE_BRK_ARRAY(unsigned long, p2m_identity, P2M_PER_PAGE); 198static RESERVE_BRK_ARRAY(unsigned long, p2m_identity, P2M_PER_PAGE);
199static RESERVE_BRK_ARRAY(unsigned long *, p2m_mid_identity, P2M_MID_PER_PAGE);
200static RESERVE_BRK_ARRAY(unsigned long, p2m_mid_identity_mfn, P2M_MID_PER_PAGE);
190 201
191RESERVE_BRK(p2m_mid, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE))); 202RESERVE_BRK(p2m_mid, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE)));
192RESERVE_BRK(p2m_mid_mfn, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE))); 203RESERVE_BRK(p2m_mid_mfn, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE)));
193 204
194/* We might hit two boundary violations at the start and end, at max each 205/* We might hit two boundary violations at the start and end, at max each
195 * boundary violation will require three middle nodes. */ 206 * boundary violation will require three middle nodes. */
196RESERVE_BRK(p2m_mid_identity, PAGE_SIZE * 2 * 3); 207RESERVE_BRK(p2m_mid_extra, PAGE_SIZE * 2 * 3);
197 208
198/* When we populate back during bootup, the amount of pages can vary. The 209/* When we populate back during bootup, the amount of pages can vary. The
199 * max we have is seen is 395979, but that does not mean it can't be more. 210 * max we have is seen is 395979, but that does not mean it can't be more.
@@ -242,20 +253,20 @@ static void p2m_top_mfn_p_init(unsigned long **top)
242 top[i] = p2m_mid_missing_mfn; 253 top[i] = p2m_mid_missing_mfn;
243} 254}
244 255
245static void p2m_mid_init(unsigned long **mid) 256static void p2m_mid_init(unsigned long **mid, unsigned long *leaf)
246{ 257{
247 unsigned i; 258 unsigned i;
248 259
249 for (i = 0; i < P2M_MID_PER_PAGE; i++) 260 for (i = 0; i < P2M_MID_PER_PAGE; i++)
250 mid[i] = p2m_missing; 261 mid[i] = leaf;
251} 262}
252 263
253static void p2m_mid_mfn_init(unsigned long *mid) 264static void p2m_mid_mfn_init(unsigned long *mid, unsigned long *leaf)
254{ 265{
255 unsigned i; 266 unsigned i;
256 267
257 for (i = 0; i < P2M_MID_PER_PAGE; i++) 268 for (i = 0; i < P2M_MID_PER_PAGE; i++)
258 mid[i] = virt_to_mfn(p2m_missing); 269 mid[i] = virt_to_mfn(leaf);
259} 270}
260 271
261static void p2m_init(unsigned long *p2m) 272static void p2m_init(unsigned long *p2m)
@@ -286,7 +297,9 @@ void __ref xen_build_mfn_list_list(void)
286 /* Pre-initialize p2m_top_mfn to be completely missing */ 297 /* Pre-initialize p2m_top_mfn to be completely missing */
287 if (p2m_top_mfn == NULL) { 298 if (p2m_top_mfn == NULL) {
288 p2m_mid_missing_mfn = extend_brk(PAGE_SIZE, PAGE_SIZE); 299 p2m_mid_missing_mfn = extend_brk(PAGE_SIZE, PAGE_SIZE);
289 p2m_mid_mfn_init(p2m_mid_missing_mfn); 300 p2m_mid_mfn_init(p2m_mid_missing_mfn, p2m_missing);
301 p2m_mid_identity_mfn = extend_brk(PAGE_SIZE, PAGE_SIZE);
302 p2m_mid_mfn_init(p2m_mid_identity_mfn, p2m_identity);
290 303
291 p2m_top_mfn_p = extend_brk(PAGE_SIZE, PAGE_SIZE); 304 p2m_top_mfn_p = extend_brk(PAGE_SIZE, PAGE_SIZE);
292 p2m_top_mfn_p_init(p2m_top_mfn_p); 305 p2m_top_mfn_p_init(p2m_top_mfn_p);
@@ -295,7 +308,8 @@ void __ref xen_build_mfn_list_list(void)
295 p2m_top_mfn_init(p2m_top_mfn); 308 p2m_top_mfn_init(p2m_top_mfn);
296 } else { 309 } else {
297 /* Reinitialise, mfn's all change after migration */ 310 /* Reinitialise, mfn's all change after migration */
298 p2m_mid_mfn_init(p2m_mid_missing_mfn); 311 p2m_mid_mfn_init(p2m_mid_missing_mfn, p2m_missing);
312 p2m_mid_mfn_init(p2m_mid_identity_mfn, p2m_identity);
299 } 313 }
300 314
301 for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += P2M_PER_PAGE) { 315 for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += P2M_PER_PAGE) {
@@ -327,7 +341,7 @@ void __ref xen_build_mfn_list_list(void)
327 * it too late. 341 * it too late.
328 */ 342 */
329 mid_mfn_p = extend_brk(PAGE_SIZE, PAGE_SIZE); 343 mid_mfn_p = extend_brk(PAGE_SIZE, PAGE_SIZE);
330 p2m_mid_mfn_init(mid_mfn_p); 344 p2m_mid_mfn_init(mid_mfn_p, p2m_missing);
331 345
332 p2m_top_mfn_p[topidx] = mid_mfn_p; 346 p2m_top_mfn_p[topidx] = mid_mfn_p;
333 } 347 }
@@ -365,16 +379,17 @@ void __init xen_build_dynamic_phys_to_machine(void)
365 379
366 p2m_missing = extend_brk(PAGE_SIZE, PAGE_SIZE); 380 p2m_missing = extend_brk(PAGE_SIZE, PAGE_SIZE);
367 p2m_init(p2m_missing); 381 p2m_init(p2m_missing);
382 p2m_identity = extend_brk(PAGE_SIZE, PAGE_SIZE);
383 p2m_init(p2m_identity);
368 384
369 p2m_mid_missing = extend_brk(PAGE_SIZE, PAGE_SIZE); 385 p2m_mid_missing = extend_brk(PAGE_SIZE, PAGE_SIZE);
370 p2m_mid_init(p2m_mid_missing); 386 p2m_mid_init(p2m_mid_missing, p2m_missing);
387 p2m_mid_identity = extend_brk(PAGE_SIZE, PAGE_SIZE);
388 p2m_mid_init(p2m_mid_identity, p2m_identity);
371 389
372 p2m_top = extend_brk(PAGE_SIZE, PAGE_SIZE); 390 p2m_top = extend_brk(PAGE_SIZE, PAGE_SIZE);
373 p2m_top_init(p2m_top); 391 p2m_top_init(p2m_top);
374 392
375 p2m_identity = extend_brk(PAGE_SIZE, PAGE_SIZE);
376 p2m_init(p2m_identity);
377
378 /* 393 /*
379 * The domain builder gives us a pre-constructed p2m array in 394 * The domain builder gives us a pre-constructed p2m array in
380 * mfn_list for all the pages initially given to us, so we just 395 * mfn_list for all the pages initially given to us, so we just
@@ -386,7 +401,7 @@ void __init xen_build_dynamic_phys_to_machine(void)
386 401
387 if (p2m_top[topidx] == p2m_mid_missing) { 402 if (p2m_top[topidx] == p2m_mid_missing) {
388 unsigned long **mid = extend_brk(PAGE_SIZE, PAGE_SIZE); 403 unsigned long **mid = extend_brk(PAGE_SIZE, PAGE_SIZE);
389 p2m_mid_init(mid); 404 p2m_mid_init(mid, p2m_missing);
390 405
391 p2m_top[topidx] = mid; 406 p2m_top[topidx] = mid;
392 } 407 }
@@ -492,7 +507,7 @@ unsigned long get_phys_to_machine(unsigned long pfn)
492 unsigned topidx, mididx, idx; 507 unsigned topidx, mididx, idx;
493 508
494 if (unlikely(pfn >= MAX_P2M_PFN)) 509 if (unlikely(pfn >= MAX_P2M_PFN))
495 return INVALID_P2M_ENTRY; 510 return IDENTITY_FRAME(pfn);
496 511
497 topidx = p2m_top_index(pfn); 512 topidx = p2m_top_index(pfn);
498 mididx = p2m_mid_index(pfn); 513 mididx = p2m_mid_index(pfn);
@@ -545,7 +560,7 @@ static bool alloc_p2m(unsigned long pfn)
545 if (!mid) 560 if (!mid)
546 return false; 561 return false;
547 562
548 p2m_mid_init(mid); 563 p2m_mid_init(mid, p2m_missing);
549 564
550 if (cmpxchg(top_p, p2m_mid_missing, mid) != p2m_mid_missing) 565 if (cmpxchg(top_p, p2m_mid_missing, mid) != p2m_mid_missing)
551 free_p2m_page(mid); 566 free_p2m_page(mid);
@@ -565,7 +580,7 @@ static bool alloc_p2m(unsigned long pfn)
565 if (!mid_mfn) 580 if (!mid_mfn)
566 return false; 581 return false;
567 582
568 p2m_mid_mfn_init(mid_mfn); 583 p2m_mid_mfn_init(mid_mfn, p2m_missing);
569 584
570 missing_mfn = virt_to_mfn(p2m_mid_missing_mfn); 585 missing_mfn = virt_to_mfn(p2m_mid_missing_mfn);
571 mid_mfn_mfn = virt_to_mfn(mid_mfn); 586 mid_mfn_mfn = virt_to_mfn(mid_mfn);
@@ -596,7 +611,7 @@ static bool alloc_p2m(unsigned long pfn)
596 return true; 611 return true;
597} 612}
598 613
599static bool __init early_alloc_p2m_middle(unsigned long pfn, bool check_boundary) 614static bool __init early_alloc_p2m(unsigned long pfn, bool check_boundary)
600{ 615{
601 unsigned topidx, mididx, idx; 616 unsigned topidx, mididx, idx;
602 unsigned long *p2m; 617 unsigned long *p2m;
@@ -638,7 +653,7 @@ static bool __init early_alloc_p2m_middle(unsigned long pfn, bool check_boundary
638 return true; 653 return true;
639} 654}
640 655
641static bool __init early_alloc_p2m(unsigned long pfn) 656static bool __init early_alloc_p2m_middle(unsigned long pfn)
642{ 657{
643 unsigned topidx = p2m_top_index(pfn); 658 unsigned topidx = p2m_top_index(pfn);
644 unsigned long *mid_mfn_p; 659 unsigned long *mid_mfn_p;
@@ -649,7 +664,7 @@ static bool __init early_alloc_p2m(unsigned long pfn)
649 if (mid == p2m_mid_missing) { 664 if (mid == p2m_mid_missing) {
650 mid = extend_brk(PAGE_SIZE, PAGE_SIZE); 665 mid = extend_brk(PAGE_SIZE, PAGE_SIZE);
651 666
652 p2m_mid_init(mid); 667 p2m_mid_init(mid, p2m_missing);
653 668
654 p2m_top[topidx] = mid; 669 p2m_top[topidx] = mid;
655 670
@@ -658,12 +673,12 @@ static bool __init early_alloc_p2m(unsigned long pfn)
658 /* And the save/restore P2M tables.. */ 673 /* And the save/restore P2M tables.. */
659 if (mid_mfn_p == p2m_mid_missing_mfn) { 674 if (mid_mfn_p == p2m_mid_missing_mfn) {
660 mid_mfn_p = extend_brk(PAGE_SIZE, PAGE_SIZE); 675 mid_mfn_p = extend_brk(PAGE_SIZE, PAGE_SIZE);
661 p2m_mid_mfn_init(mid_mfn_p); 676 p2m_mid_mfn_init(mid_mfn_p, p2m_missing);
662 677
663 p2m_top_mfn_p[topidx] = mid_mfn_p; 678 p2m_top_mfn_p[topidx] = mid_mfn_p;
664 p2m_top_mfn[topidx] = virt_to_mfn(mid_mfn_p); 679 p2m_top_mfn[topidx] = virt_to_mfn(mid_mfn_p);
665 /* Note: we don't set mid_mfn_p[midix] here, 680 /* Note: we don't set mid_mfn_p[midix] here,
666 * look in early_alloc_p2m_middle */ 681 * look in early_alloc_p2m() */
667 } 682 }
668 return true; 683 return true;
669} 684}
@@ -739,7 +754,7 @@ found:
739 754
740 /* This shouldn't happen */ 755 /* This shouldn't happen */
741 if (WARN_ON(p2m_top[topidx] == p2m_mid_missing)) 756 if (WARN_ON(p2m_top[topidx] == p2m_mid_missing))
742 early_alloc_p2m(set_pfn); 757 early_alloc_p2m_middle(set_pfn);
743 758
744 if (WARN_ON(p2m_top[topidx][mididx] != p2m_missing)) 759 if (WARN_ON(p2m_top[topidx][mididx] != p2m_missing))
745 return false; 760 return false;
@@ -754,13 +769,13 @@ found:
754bool __init early_set_phys_to_machine(unsigned long pfn, unsigned long mfn) 769bool __init early_set_phys_to_machine(unsigned long pfn, unsigned long mfn)
755{ 770{
756 if (unlikely(!__set_phys_to_machine(pfn, mfn))) { 771 if (unlikely(!__set_phys_to_machine(pfn, mfn))) {
757 if (!early_alloc_p2m(pfn)) 772 if (!early_alloc_p2m_middle(pfn))
758 return false; 773 return false;
759 774
760 if (early_can_reuse_p2m_middle(pfn, mfn)) 775 if (early_can_reuse_p2m_middle(pfn, mfn))
761 return __set_phys_to_machine(pfn, mfn); 776 return __set_phys_to_machine(pfn, mfn);
762 777
763 if (!early_alloc_p2m_middle(pfn, false /* boundary crossover OK!*/)) 778 if (!early_alloc_p2m(pfn, false /* boundary crossover OK!*/))
764 return false; 779 return false;
765 780
766 if (!__set_phys_to_machine(pfn, mfn)) 781 if (!__set_phys_to_machine(pfn, mfn))
@@ -769,12 +784,30 @@ bool __init early_set_phys_to_machine(unsigned long pfn, unsigned long mfn)
769 784
770 return true; 785 return true;
771} 786}
787
788static void __init early_split_p2m(unsigned long pfn)
789{
790 unsigned long mididx, idx;
791
792 mididx = p2m_mid_index(pfn);
793 idx = p2m_index(pfn);
794
795 /*
796 * Allocate new middle and leaf pages if this pfn lies in the
797 * middle of one.
798 */
799 if (mididx || idx)
800 early_alloc_p2m_middle(pfn);
801 if (idx)
802 early_alloc_p2m(pfn, false);
803}
804
772unsigned long __init set_phys_range_identity(unsigned long pfn_s, 805unsigned long __init set_phys_range_identity(unsigned long pfn_s,
773 unsigned long pfn_e) 806 unsigned long pfn_e)
774{ 807{
775 unsigned long pfn; 808 unsigned long pfn;
776 809
777 if (unlikely(pfn_s >= MAX_P2M_PFN || pfn_e >= MAX_P2M_PFN)) 810 if (unlikely(pfn_s >= MAX_P2M_PFN))
778 return 0; 811 return 0;
779 812
780 if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) 813 if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
@@ -783,19 +816,30 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s,
783 if (pfn_s > pfn_e) 816 if (pfn_s > pfn_e)
784 return 0; 817 return 0;
785 818
786 for (pfn = (pfn_s & ~(P2M_MID_PER_PAGE * P2M_PER_PAGE - 1)); 819 if (pfn_e > MAX_P2M_PFN)
787 pfn < ALIGN(pfn_e, (P2M_MID_PER_PAGE * P2M_PER_PAGE)); 820 pfn_e = MAX_P2M_PFN;
788 pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE)
789 {
790 WARN_ON(!early_alloc_p2m(pfn));
791 }
792 821
793 early_alloc_p2m_middle(pfn_s, true); 822 early_split_p2m(pfn_s);
794 early_alloc_p2m_middle(pfn_e, true); 823 early_split_p2m(pfn_e);
824
825 for (pfn = pfn_s; pfn < pfn_e;) {
826 unsigned topidx = p2m_top_index(pfn);
827 unsigned mididx = p2m_mid_index(pfn);
795 828
796 for (pfn = pfn_s; pfn < pfn_e; pfn++)
797 if (!__set_phys_to_machine(pfn, IDENTITY_FRAME(pfn))) 829 if (!__set_phys_to_machine(pfn, IDENTITY_FRAME(pfn)))
798 break; 830 break;
831 pfn++;
832
833 /*
834 * If the PFN was set to a middle or leaf identity
835 * page the remainder must also be identity, so skip
836 * ahead to the next middle or leaf entry.
837 */
838 if (p2m_top[topidx] == p2m_mid_identity)
839 pfn = ALIGN(pfn, P2M_MID_PER_PAGE * P2M_PER_PAGE);
840 else if (p2m_top[topidx][mididx] == p2m_identity)
841 pfn = ALIGN(pfn, P2M_PER_PAGE);
842 }
799 843
800 if (!WARN((pfn - pfn_s) != (pfn_e - pfn_s), 844 if (!WARN((pfn - pfn_s) != (pfn_e - pfn_s),
801 "Identity mapping failed. We are %ld short of 1-1 mappings!\n", 845 "Identity mapping failed. We are %ld short of 1-1 mappings!\n",
@@ -825,8 +869,22 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
825 869
826 /* For sparse holes were the p2m leaf has real PFN along with 870 /* For sparse holes were the p2m leaf has real PFN along with
827 * PCI holes, stick in the PFN as the MFN value. 871 * PCI holes, stick in the PFN as the MFN value.
872 *
873 * set_phys_range_identity() will have allocated new middle
874 * and leaf pages as required so an existing p2m_mid_missing
875 * or p2m_missing mean that whole range will be identity so
876 * these can be switched to p2m_mid_identity or p2m_identity.
828 */ 877 */
829 if (mfn != INVALID_P2M_ENTRY && (mfn & IDENTITY_FRAME_BIT)) { 878 if (mfn != INVALID_P2M_ENTRY && (mfn & IDENTITY_FRAME_BIT)) {
879 if (p2m_top[topidx] == p2m_mid_identity)
880 return true;
881
882 if (p2m_top[topidx] == p2m_mid_missing) {
883 WARN_ON(cmpxchg(&p2m_top[topidx], p2m_mid_missing,
884 p2m_mid_identity) != p2m_mid_missing);
885 return true;
886 }
887
830 if (p2m_top[topidx][mididx] == p2m_identity) 888 if (p2m_top[topidx][mididx] == p2m_identity)
831 return true; 889 return true;
832 890
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 0982233b9b84..210426a26cc0 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -89,10 +89,10 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
89 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) { 89 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
90 unsigned long mfn = pfn_to_mfn(pfn); 90 unsigned long mfn = pfn_to_mfn(pfn);
91 91
92 if (WARN(mfn == pfn, "Trying to over-write 1-1 mapping (pfn: %lx)\n", pfn)) 92 if (WARN_ONCE(mfn == pfn, "Trying to over-write 1-1 mapping (pfn: %lx)\n", pfn))
93 continue; 93 continue;
94 WARN(mfn != INVALID_P2M_ENTRY, "Trying to remove %lx which has %lx mfn!\n", 94 WARN_ONCE(mfn != INVALID_P2M_ENTRY, "Trying to remove %lx which has %lx mfn!\n",
95 pfn, mfn); 95 pfn, mfn);
96 96
97 __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); 97 __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
98 } 98 }
@@ -469,6 +469,15 @@ char * __init xen_memory_setup(void)
469 } 469 }
470 470
471 /* 471 /*
472 * Set the rest as identity mapped, in case PCI BARs are
473 * located here.
474 *
475 * PFNs above MAX_P2M_PFN are considered identity mapped as
476 * well.
477 */
478 set_phys_range_identity(map[i-1].addr / PAGE_SIZE, ~0ul);
479
480 /*
472 * In domU, the ISA region is normal, usable memory, but we 481 * In domU, the ISA region is normal, usable memory, but we
473 * reserve ISA memory anyway because too many things poke 482 * reserve ISA memory anyway because too many things poke
474 * about in there. 483 * about in there.
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 45329c8c226e..c4df9dbd63b7 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -12,8 +12,10 @@
12#include "xen-ops.h" 12#include "xen-ops.h"
13#include "mmu.h" 13#include "mmu.h"
14 14
15void xen_arch_pre_suspend(void) 15static void xen_pv_pre_suspend(void)
16{ 16{
17 xen_mm_pin_all();
18
17 xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); 19 xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
18 xen_start_info->console.domU.mfn = 20 xen_start_info->console.domU.mfn =
19 mfn_to_pfn(xen_start_info->console.domU.mfn); 21 mfn_to_pfn(xen_start_info->console.domU.mfn);
@@ -26,7 +28,7 @@ void xen_arch_pre_suspend(void)
26 BUG(); 28 BUG();
27} 29}
28 30
29void xen_arch_hvm_post_suspend(int suspend_cancelled) 31static void xen_hvm_post_suspend(int suspend_cancelled)
30{ 32{
31#ifdef CONFIG_XEN_PVHVM 33#ifdef CONFIG_XEN_PVHVM
32 int cpu; 34 int cpu;
@@ -41,7 +43,7 @@ void xen_arch_hvm_post_suspend(int suspend_cancelled)
41#endif 43#endif
42} 44}
43 45
44void xen_arch_post_suspend(int suspend_cancelled) 46static void xen_pv_post_suspend(int suspend_cancelled)
45{ 47{
46 xen_build_mfn_list_list(); 48 xen_build_mfn_list_list();
47 49
@@ -60,6 +62,21 @@ void xen_arch_post_suspend(int suspend_cancelled)
60 xen_vcpu_restore(); 62 xen_vcpu_restore();
61 } 63 }
62 64
65 xen_mm_unpin_all();
66}
67
68void xen_arch_pre_suspend(void)
69{
70 if (xen_pv_domain())
71 xen_pv_pre_suspend();
72}
73
74void xen_arch_post_suspend(int cancelled)
75{
76 if (xen_pv_domain())
77 xen_pv_post_suspend(cancelled);
78 else
79 xen_hvm_post_suspend(cancelled);
63} 80}
64 81
65static void xen_vcpu_notify_restore(void *data) 82static void xen_vcpu_notify_restore(void *data)
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 1cb6f4c37300..c834d4b231f0 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -31,6 +31,8 @@ void xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn);
31void xen_reserve_top(void); 31void xen_reserve_top(void);
32extern unsigned long xen_max_p2m_pfn; 32extern unsigned long xen_max_p2m_pfn;
33 33
34void xen_mm_pin_all(void);
35void xen_mm_unpin_all(void);
34void xen_set_pat(u64); 36void xen_set_pat(u64);
35 37
36char * __init xen_memory_setup(void); 38char * __init xen_memory_setup(void);
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 02d6d29a63c1..3a617af60d46 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -14,6 +14,7 @@ config XTENSA
14 select GENERIC_PCI_IOMAP 14 select GENERIC_PCI_IOMAP
15 select ARCH_WANT_IPC_PARSE_VERSION 15 select ARCH_WANT_IPC_PARSE_VERSION
16 select ARCH_WANT_OPTIONAL_GPIOLIB 16 select ARCH_WANT_OPTIONAL_GPIOLIB
17 select BUILDTIME_EXTABLE_SORT
17 select CLONE_BACKWARDS 18 select CLONE_BACKWARDS
18 select IRQ_DOMAIN 19 select IRQ_DOMAIN
19 select HAVE_OPROFILE 20 select HAVE_OPROFILE
@@ -189,6 +190,24 @@ config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
189 190
190 If in doubt, say Y. 191 If in doubt, say Y.
191 192
193config HIGHMEM
194 bool "High Memory Support"
195 help
196 Linux can use the full amount of RAM in the system by
197 default. However, the default MMUv2 setup only maps the
198 lowermost 128 MB of memory linearly to the areas starting
199 at 0xd0000000 (cached) and 0xd8000000 (uncached).
200 When there are more than 128 MB memory in the system not
201 all of it can be "permanently mapped" by the kernel.
202 The physical memory that's not permanently mapped is called
203 "high memory".
204
205 If you are compiling a kernel which will never run on a
206 machine with more than 128 MB total physical RAM, answer
207 N here.
208
209 If unsure, say Y.
210
192endmenu 211endmenu
193 212
194config XTENSA_CALIBRATE_CCOUNT 213config XTENSA_CALIBRATE_CCOUNT
@@ -224,7 +243,6 @@ choice
224 243
225config XTENSA_PLATFORM_ISS 244config XTENSA_PLATFORM_ISS
226 bool "ISS" 245 bool "ISS"
227 depends on TTY
228 select XTENSA_CALIBRATE_CCOUNT 246 select XTENSA_CALIBRATE_CCOUNT
229 select SERIAL_CONSOLE 247 select SERIAL_CONSOLE
230 help 248 help
diff --git a/arch/xtensa/boot/dts/kc705.dts b/arch/xtensa/boot/dts/kc705.dts
new file mode 100644
index 000000000000..742a347be67a
--- /dev/null
+++ b/arch/xtensa/boot/dts/kc705.dts
@@ -0,0 +1,11 @@
1/dts-v1/;
2/include/ "xtfpga.dtsi"
3/include/ "xtfpga-flash-128m.dtsi"
4
5/ {
6 compatible = "cdns,xtensa-kc705";
7 memory@0 {
8 device_type = "memory";
9 reg = <0x00000000 0x08000000>;
10 };
11};
diff --git a/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi b/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi
new file mode 100644
index 000000000000..d3a88e029873
--- /dev/null
+++ b/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi
@@ -0,0 +1,28 @@
1/ {
2 soc {
3 flash: flash@00000000 {
4 #address-cells = <1>;
5 #size-cells = <1>;
6 compatible = "cfi-flash";
7 reg = <0x00000000 0x08000000>;
8 bank-width = <2>;
9 device-width = <2>;
10 partition@0x0 {
11 label = "data";
12 reg = <0x00000000 0x06000000>;
13 };
14 partition@0x6000000 {
15 label = "boot loader area";
16 reg = <0x06000000 0x00800000>;
17 };
18 partition@0x6800000 {
19 label = "kernel image";
20 reg = <0x06800000 0x017e0000>;
21 };
22 partition@0x7fe0000 {
23 label = "boot environment";
24 reg = <0x07fe0000 0x00020000>;
25 };
26 };
27 };
28};
diff --git a/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi b/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi
index e5703c7beeb6..1d97203c18e7 100644
--- a/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi
+++ b/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi
@@ -1,26 +1,28 @@
1/ { 1/ {
2 flash: flash@f8000000 { 2 soc {
3 #address-cells = <1>; 3 flash: flash@08000000 {
4 #size-cells = <1>; 4 #address-cells = <1>;
5 compatible = "cfi-flash"; 5 #size-cells = <1>;
6 reg = <0xf8000000 0x01000000>; 6 compatible = "cfi-flash";
7 bank-width = <2>; 7 reg = <0x08000000 0x01000000>;
8 device-width = <2>; 8 bank-width = <2>;
9 partition@0x0 { 9 device-width = <2>;
10 label = "boot loader area"; 10 partition@0x0 {
11 reg = <0x00000000 0x00400000>; 11 label = "boot loader area";
12 reg = <0x00000000 0x00400000>;
13 };
14 partition@0x400000 {
15 label = "kernel image";
16 reg = <0x00400000 0x00600000>;
17 };
18 partition@0xa00000 {
19 label = "data";
20 reg = <0x00a00000 0x005e0000>;
21 };
22 partition@0xfe0000 {
23 label = "boot environment";
24 reg = <0x00fe0000 0x00020000>;
25 };
12 }; 26 };
13 partition@0x400000 { 27 };
14 label = "kernel image";
15 reg = <0x00400000 0x00600000>;
16 };
17 partition@0xa00000 {
18 label = "data";
19 reg = <0x00a00000 0x005e0000>;
20 };
21 partition@0xfe0000 {
22 label = "boot environment";
23 reg = <0x00fe0000 0x00020000>;
24 };
25 };
26}; 28};
diff --git a/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi b/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi
index 6f9c10d6b689..d1c621ca8be1 100644
--- a/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi
+++ b/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi
@@ -1,18 +1,20 @@
1/ { 1/ {
2 flash: flash@f8000000 { 2 soc {
3 #address-cells = <1>; 3 flash: flash@08000000 {
4 #size-cells = <1>; 4 #address-cells = <1>;
5 compatible = "cfi-flash"; 5 #size-cells = <1>;
6 reg = <0xf8000000 0x00400000>; 6 compatible = "cfi-flash";
7 bank-width = <2>; 7 reg = <0x08000000 0x00400000>;
8 device-width = <2>; 8 bank-width = <2>;
9 partition@0x0 { 9 device-width = <2>;
10 label = "boot loader area"; 10 partition@0x0 {
11 reg = <0x00000000 0x003f0000>; 11 label = "boot loader area";
12 reg = <0x00000000 0x003f0000>;
13 };
14 partition@0x3f0000 {
15 label = "boot environment";
16 reg = <0x003f0000 0x00010000>;
17 };
12 }; 18 };
13 partition@0x3f0000 { 19 };
14 label = "boot environment";
15 reg = <0x003f0000 0x00010000>;
16 };
17 };
18}; 20};
diff --git a/arch/xtensa/boot/dts/xtfpga.dtsi b/arch/xtensa/boot/dts/xtfpga.dtsi
index e7370b11348e..dec9178840f6 100644
--- a/arch/xtensa/boot/dts/xtfpga.dtsi
+++ b/arch/xtensa/boot/dts/xtfpga.dtsi
@@ -42,21 +42,28 @@
42 }; 42 };
43 }; 43 };
44 44
45 serial0: serial@fd050020 { 45 soc {
46 device_type = "serial"; 46 #address-cells = <1>;
47 compatible = "ns16550a"; 47 #size-cells = <1>;
48 no-loopback-test; 48 compatible = "simple-bus";
49 reg = <0xfd050020 0x20>; 49 ranges = <0x00000000 0xf0000000 0x10000000>;
50 reg-shift = <2>;
51 interrupts = <0 1>; /* external irq 0 */
52 clocks = <&osc>;
53 };
54 50
55 enet0: ethoc@fd030000 { 51 serial0: serial@0d050020 {
56 compatible = "opencores,ethoc"; 52 device_type = "serial";
57 reg = <0xfd030000 0x4000 0xfd800000 0x4000>; 53 compatible = "ns16550a";
58 interrupts = <1 1>; /* external irq 1 */ 54 no-loopback-test;
59 local-mac-address = [00 50 c2 13 6f 00]; 55 reg = <0x0d050020 0x20>;
60 clocks = <&osc>; 56 reg-shift = <2>;
57 interrupts = <0 1>; /* external irq 0 */
58 clocks = <&osc>;
59 };
60
61 enet0: ethoc@0d030000 {
62 compatible = "opencores,ethoc";
63 reg = <0x0d030000 0x4000 0x0d800000 0x4000>;
64 interrupts = <1 1>; /* external irq 1 */
65 local-mac-address = [00 50 c2 13 6f 00];
66 clocks = <&osc>;
67 };
61 }; 68 };
62}; 69};
diff --git a/arch/xtensa/include/asm/bootparam.h b/arch/xtensa/include/asm/bootparam.h
index 23392c5630ce..892aab399ac8 100644
--- a/arch/xtensa/include/asm/bootparam.h
+++ b/arch/xtensa/include/asm/bootparam.h
@@ -37,23 +37,14 @@ typedef struct bp_tag {
37 unsigned long data[0]; /* data */ 37 unsigned long data[0]; /* data */
38} bp_tag_t; 38} bp_tag_t;
39 39
40typedef struct meminfo { 40struct bp_meminfo {
41 unsigned long type; 41 unsigned long type;
42 unsigned long start; 42 unsigned long start;
43 unsigned long end; 43 unsigned long end;
44} meminfo_t; 44};
45
46#define SYSMEM_BANKS_MAX 5
47 45
48#define MEMORY_TYPE_CONVENTIONAL 0x1000 46#define MEMORY_TYPE_CONVENTIONAL 0x1000
49#define MEMORY_TYPE_NONE 0x2000 47#define MEMORY_TYPE_NONE 0x2000
50 48
51typedef struct sysmem_info {
52 int nr_banks;
53 meminfo_t bank[SYSMEM_BANKS_MAX];
54} sysmem_info_t;
55
56extern sysmem_info_t sysmem;
57
58#endif 49#endif
59#endif 50#endif
diff --git a/arch/xtensa/include/asm/fixmap.h b/arch/xtensa/include/asm/fixmap.h
new file mode 100644
index 000000000000..9f6c33d0428a
--- /dev/null
+++ b/arch/xtensa/include/asm/fixmap.h
@@ -0,0 +1,58 @@
1/*
2 * fixmap.h: compile-time virtual memory allocation
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1998 Ingo Molnar
9 *
10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
11 */
12
13#ifndef _ASM_FIXMAP_H
14#define _ASM_FIXMAP_H
15
16#include <asm/pgtable.h>
17#ifdef CONFIG_HIGHMEM
18#include <linux/threads.h>
19#include <asm/kmap_types.h>
20#endif
21
22/*
23 * Here we define all the compile-time 'special' virtual
24 * addresses. The point is to have a constant address at
25 * compile time, but to set the physical address only
26 * in the boot process. We allocate these special addresses
27 * from the end of the consistent memory region backwards.
28 * Also this lets us do fail-safe vmalloc(), we
29 * can guarantee that these special addresses and
30 * vmalloc()-ed addresses never overlap.
31 *
32 * these 'compile-time allocated' memory buffers are
33 * fixed-size 4k pages. (or larger if used with an increment
34 * higher than 1) use fixmap_set(idx,phys) to associate
35 * physical memory with fixmap indices.
36 */
37enum fixed_addresses {
38#ifdef CONFIG_HIGHMEM
39 /* reserved pte's for temporary kernel mappings */
40 FIX_KMAP_BEGIN,
41 FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1,
42#endif
43 __end_of_fixed_addresses
44};
45
46#define FIXADDR_TOP (VMALLOC_START - PAGE_SIZE)
47#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
48#define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK)
49
50#include <asm-generic/fixmap.h>
51
52#define kmap_get_fixmap_pte(vaddr) \
53 pte_offset_kernel( \
54 pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), \
55 (vaddr) \
56 )
57
58#endif
diff --git a/arch/xtensa/include/asm/highmem.h b/arch/xtensa/include/asm/highmem.h
index 80be15124697..2653ef5d55f1 100644
--- a/arch/xtensa/include/asm/highmem.h
+++ b/arch/xtensa/include/asm/highmem.h
@@ -6,11 +6,54 @@
6 * this archive for more details. 6 * this archive for more details.
7 * 7 *
8 * Copyright (C) 2003 - 2005 Tensilica Inc. 8 * Copyright (C) 2003 - 2005 Tensilica Inc.
9 * Copyright (C) 2014 Cadence Design Systems Inc.
9 */ 10 */
10 11
11#ifndef _XTENSA_HIGHMEM_H 12#ifndef _XTENSA_HIGHMEM_H
12#define _XTENSA_HIGHMEM_H 13#define _XTENSA_HIGHMEM_H
13 14
14extern void flush_cache_kmaps(void); 15#include <asm/cacheflush.h>
16#include <asm/fixmap.h>
17#include <asm/kmap_types.h>
18#include <asm/pgtable.h>
19
20#define PKMAP_BASE (FIXADDR_START - PMD_SIZE)
21#define LAST_PKMAP PTRS_PER_PTE
22#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
23#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
24#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
25
26#define kmap_prot PAGE_KERNEL
27
28extern pte_t *pkmap_page_table;
29
30void *kmap_high(struct page *page);
31void kunmap_high(struct page *page);
32
33static inline void *kmap(struct page *page)
34{
35 BUG_ON(in_interrupt());
36 if (!PageHighMem(page))
37 return page_address(page);
38 return kmap_high(page);
39}
40
41static inline void kunmap(struct page *page)
42{
43 BUG_ON(in_interrupt());
44 if (!PageHighMem(page))
45 return;
46 kunmap_high(page);
47}
48
49static inline void flush_cache_kmaps(void)
50{
51 flush_cache_all();
52}
53
54void *kmap_atomic(struct page *page);
55void __kunmap_atomic(void *kvaddr);
56
57void kmap_init(void);
15 58
16#endif 59#endif
diff --git a/arch/xtensa/include/asm/pci.h b/arch/xtensa/include/asm/pci.h
index 614be031a79a..5d52dc43dfe7 100644
--- a/arch/xtensa/include/asm/pci.h
+++ b/arch/xtensa/include/asm/pci.h
@@ -22,11 +22,6 @@
22 22
23extern struct pci_controller* pcibios_alloc_controller(void); 23extern struct pci_controller* pcibios_alloc_controller(void);
24 24
25static inline void pcibios_penalize_isa_irq(int irq)
26{
27 /* We don't do dynamic PCI IRQ allocation */
28}
29
30/* Assume some values. (We should revise them, if necessary) */ 25/* Assume some values. (We should revise them, if necessary) */
31 26
32#define PCIBIOS_MIN_IO 0x2000 27#define PCIBIOS_MIN_IO 0x2000
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 216446295ada..4b0ca35a93b1 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -310,6 +310,10 @@ set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval)
310 update_pte(ptep, pteval); 310 update_pte(ptep, pteval);
311} 311}
312 312
313static inline void set_pte(pte_t *ptep, pte_t pteval)
314{
315 update_pte(ptep, pteval);
316}
313 317
314static inline void 318static inline void
315set_pmd(pmd_t *pmdp, pmd_t pmdval) 319set_pmd(pmd_t *pmdp, pmd_t pmdval)
diff --git a/arch/xtensa/include/asm/sysmem.h b/arch/xtensa/include/asm/sysmem.h
new file mode 100644
index 000000000000..c015c5c8e3f7
--- /dev/null
+++ b/arch/xtensa/include/asm/sysmem.h
@@ -0,0 +1,38 @@
1/*
2 * sysmem-related prototypes.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2014 Cadence Design Systems Inc.
9 */
10
11#ifndef _XTENSA_SYSMEM_H
12#define _XTENSA_SYSMEM_H
13
14#define SYSMEM_BANKS_MAX 31
15
16struct meminfo {
17 unsigned long start;
18 unsigned long end;
19};
20
21/*
22 * Bank array is sorted by .start.
23 * Banks don't overlap and there's at least one page gap
24 * between adjacent bank entries.
25 */
26struct sysmem_info {
27 int nr_banks;
28 struct meminfo bank[SYSMEM_BANKS_MAX];
29};
30
31extern struct sysmem_info sysmem;
32
33int add_sysmem_bank(unsigned long start, unsigned long end);
34int mem_reserve(unsigned long, unsigned long, int);
35void bootmem_init(void);
36void zones_init(void);
37
38#endif /* _XTENSA_SYSMEM_H */
diff --git a/arch/xtensa/include/asm/tlbflush.h b/arch/xtensa/include/asm/tlbflush.h
index fc34274ce41b..06875feb27c2 100644
--- a/arch/xtensa/include/asm/tlbflush.h
+++ b/arch/xtensa/include/asm/tlbflush.h
@@ -36,6 +36,7 @@ void local_flush_tlb_page(struct vm_area_struct *vma,
36 unsigned long page); 36 unsigned long page);
37void local_flush_tlb_range(struct vm_area_struct *vma, 37void local_flush_tlb_range(struct vm_area_struct *vma,
38 unsigned long start, unsigned long end); 38 unsigned long start, unsigned long end);
39void local_flush_tlb_kernel_range(unsigned long start, unsigned long end);
39 40
40#ifdef CONFIG_SMP 41#ifdef CONFIG_SMP
41 42
@@ -44,12 +45,7 @@ void flush_tlb_mm(struct mm_struct *);
44void flush_tlb_page(struct vm_area_struct *, unsigned long); 45void flush_tlb_page(struct vm_area_struct *, unsigned long);
45void flush_tlb_range(struct vm_area_struct *, unsigned long, 46void flush_tlb_range(struct vm_area_struct *, unsigned long,
46 unsigned long); 47 unsigned long);
47 48void flush_tlb_kernel_range(unsigned long start, unsigned long end);
48static inline void flush_tlb_kernel_range(unsigned long start,
49 unsigned long end)
50{
51 flush_tlb_all();
52}
53 49
54#else /* !CONFIG_SMP */ 50#else /* !CONFIG_SMP */
55 51
@@ -58,7 +54,8 @@ static inline void flush_tlb_kernel_range(unsigned long start,
58#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page) 54#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
59#define flush_tlb_range(vma, vmaddr, end) local_flush_tlb_range(vma, vmaddr, \ 55#define flush_tlb_range(vma, vmaddr, end) local_flush_tlb_range(vma, vmaddr, \
60 end) 56 end)
61#define flush_tlb_kernel_range(start, end) local_flush_tlb_all() 57#define flush_tlb_kernel_range(start, end) local_flush_tlb_kernel_range(start, \
58 end)
62 59
63#endif /* CONFIG_SMP */ 60#endif /* CONFIG_SMP */
64 61
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 84fe931bb60e..9757bb74e532 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -50,6 +50,7 @@
50#include <asm/param.h> 50#include <asm/param.h>
51#include <asm/traps.h> 51#include <asm/traps.h>
52#include <asm/smp.h> 52#include <asm/smp.h>
53#include <asm/sysmem.h>
53 54
54#include <platform/hardware.h> 55#include <platform/hardware.h>
55 56
@@ -88,12 +89,6 @@ static char __initdata command_line[COMMAND_LINE_SIZE];
88static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; 89static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
89#endif 90#endif
90 91
91sysmem_info_t __initdata sysmem;
92
93extern int mem_reserve(unsigned long, unsigned long, int);
94extern void bootmem_init(void);
95extern void zones_init(void);
96
97/* 92/*
98 * Boot parameter parsing. 93 * Boot parameter parsing.
99 * 94 *
@@ -113,31 +108,14 @@ typedef struct tagtable {
113 108
114/* parse current tag */ 109/* parse current tag */
115 110
116static int __init add_sysmem_bank(unsigned long type, unsigned long start,
117 unsigned long end)
118{
119 if (sysmem.nr_banks >= SYSMEM_BANKS_MAX) {
120 printk(KERN_WARNING
121 "Ignoring memory bank 0x%08lx size %ldKB\n",
122 start, end - start);
123 return -EINVAL;
124 }
125 sysmem.bank[sysmem.nr_banks].type = type;
126 sysmem.bank[sysmem.nr_banks].start = PAGE_ALIGN(start);
127 sysmem.bank[sysmem.nr_banks].end = end & PAGE_MASK;
128 sysmem.nr_banks++;
129
130 return 0;
131}
132
133static int __init parse_tag_mem(const bp_tag_t *tag) 111static int __init parse_tag_mem(const bp_tag_t *tag)
134{ 112{
135 meminfo_t *mi = (meminfo_t *)(tag->data); 113 struct bp_meminfo *mi = (struct bp_meminfo *)(tag->data);
136 114
137 if (mi->type != MEMORY_TYPE_CONVENTIONAL) 115 if (mi->type != MEMORY_TYPE_CONVENTIONAL)
138 return -1; 116 return -1;
139 117
140 return add_sysmem_bank(mi->type, mi->start, mi->end); 118 return add_sysmem_bank(mi->start, mi->end);
141} 119}
142 120
143__tagtable(BP_TAG_MEMORY, parse_tag_mem); 121__tagtable(BP_TAG_MEMORY, parse_tag_mem);
@@ -146,8 +124,8 @@ __tagtable(BP_TAG_MEMORY, parse_tag_mem);
146 124
147static int __init parse_tag_initrd(const bp_tag_t* tag) 125static int __init parse_tag_initrd(const bp_tag_t* tag)
148{ 126{
149 meminfo_t* mi; 127 struct bp_meminfo *mi = (struct bp_meminfo *)(tag->data);
150 mi = (meminfo_t*)(tag->data); 128
151 initrd_start = (unsigned long)__va(mi->start); 129 initrd_start = (unsigned long)__va(mi->start);
152 initrd_end = (unsigned long)__va(mi->end); 130 initrd_end = (unsigned long)__va(mi->end);
153 131
@@ -255,7 +233,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
255 return; 233 return;
256 234
257 size &= PAGE_MASK; 235 size &= PAGE_MASK;
258 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size); 236 add_sysmem_bank(base, base + size);
259} 237}
260 238
261void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) 239void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
@@ -292,8 +270,6 @@ device_initcall(xtensa_device_probe);
292 270
293void __init init_arch(bp_tag_t *bp_start) 271void __init init_arch(bp_tag_t *bp_start)
294{ 272{
295 sysmem.nr_banks = 0;
296
297 /* Parse boot parameters */ 273 /* Parse boot parameters */
298 274
299 if (bp_start) 275 if (bp_start)
@@ -304,10 +280,9 @@ void __init init_arch(bp_tag_t *bp_start)
304#endif 280#endif
305 281
306 if (sysmem.nr_banks == 0) { 282 if (sysmem.nr_banks == 0) {
307 sysmem.nr_banks = 1; 283 add_sysmem_bank(PLATFORM_DEFAULT_MEM_START,
308 sysmem.bank[0].start = PLATFORM_DEFAULT_MEM_START; 284 PLATFORM_DEFAULT_MEM_START +
309 sysmem.bank[0].end = PLATFORM_DEFAULT_MEM_START 285 PLATFORM_DEFAULT_MEM_SIZE);
310 + PLATFORM_DEFAULT_MEM_SIZE;
311 } 286 }
312 287
313#ifdef CONFIG_CMDLINE_BOOL 288#ifdef CONFIG_CMDLINE_BOOL
@@ -487,7 +462,7 @@ void __init setup_arch(char **cmdline_p)
487#ifdef CONFIG_BLK_DEV_INITRD 462#ifdef CONFIG_BLK_DEV_INITRD
488 if (initrd_start < initrd_end) { 463 if (initrd_start < initrd_end) {
489 initrd_is_mapped = mem_reserve(__pa(initrd_start), 464 initrd_is_mapped = mem_reserve(__pa(initrd_start),
490 __pa(initrd_end), 0); 465 __pa(initrd_end), 0) == 0;
491 initrd_below_start_ok = 1; 466 initrd_below_start_ok = 1;
492 } else { 467 } else {
493 initrd_start = 0; 468 initrd_start = 0;
@@ -532,6 +507,7 @@ void __init setup_arch(char **cmdline_p)
532 __pa(&_Level6InterruptVector_text_end), 0); 507 __pa(&_Level6InterruptVector_text_end), 0);
533#endif 508#endif
534 509
510 parse_early_param();
535 bootmem_init(); 511 bootmem_init();
536 512
537 unflatten_and_copy_device_tree(); 513 unflatten_and_copy_device_tree();
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c
index aa8bd8717927..40b5a3771fb0 100644
--- a/arch/xtensa/kernel/smp.c
+++ b/arch/xtensa/kernel/smp.c
@@ -496,6 +496,21 @@ void flush_tlb_range(struct vm_area_struct *vma,
496 on_each_cpu(ipi_flush_tlb_range, &fd, 1); 496 on_each_cpu(ipi_flush_tlb_range, &fd, 1);
497} 497}
498 498
499static void ipi_flush_tlb_kernel_range(void *arg)
500{
501 struct flush_data *fd = arg;
502 local_flush_tlb_kernel_range(fd->addr1, fd->addr2);
503}
504
505void flush_tlb_kernel_range(unsigned long start, unsigned long end)
506{
507 struct flush_data fd = {
508 .addr1 = start,
509 .addr2 = end,
510 };
511 on_each_cpu(ipi_flush_tlb_kernel_range, &fd, 1);
512}
513
499/* Cache flush functions */ 514/* Cache flush functions */
500 515
501static void ipi_flush_cache_all(void *arg) 516static void ipi_flush_cache_all(void *arg)
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c
index 80b33ed51f31..4d2872fd9bb5 100644
--- a/arch/xtensa/kernel/xtensa_ksyms.c
+++ b/arch/xtensa/kernel/xtensa_ksyms.c
@@ -20,6 +20,7 @@
20#include <linux/in6.h> 20#include <linux/in6.h>
21 21
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/cacheflush.h>
23#include <asm/checksum.h> 24#include <asm/checksum.h>
24#include <asm/dma.h> 25#include <asm/dma.h>
25#include <asm/io.h> 26#include <asm/io.h>
@@ -105,6 +106,7 @@ EXPORT_SYMBOL(csum_partial_copy_generic);
105 * Architecture-specific symbols 106 * Architecture-specific symbols
106 */ 107 */
107EXPORT_SYMBOL(__xtensa_copy_user); 108EXPORT_SYMBOL(__xtensa_copy_user);
109EXPORT_SYMBOL(__invalidate_icache_range);
108 110
109/* 111/*
110 * Kernel hacking ... 112 * Kernel hacking ...
@@ -127,3 +129,8 @@ EXPORT_SYMBOL(common_exception_return);
127#ifdef CONFIG_FUNCTION_TRACER 129#ifdef CONFIG_FUNCTION_TRACER
128EXPORT_SYMBOL(_mcount); 130EXPORT_SYMBOL(_mcount);
129#endif 131#endif
132
133EXPORT_SYMBOL(__invalidate_dcache_range);
134#if XCHAL_DCACHE_IS_WRITEBACK
135EXPORT_SYMBOL(__flush_dcache_range);
136#endif
diff --git a/arch/xtensa/mm/Makefile b/arch/xtensa/mm/Makefile
index f0b646d2f843..f54f78e24d7b 100644
--- a/arch/xtensa/mm/Makefile
+++ b/arch/xtensa/mm/Makefile
@@ -4,3 +4,4 @@
4 4
5obj-y := init.o cache.o misc.o 5obj-y := init.o cache.o misc.o
6obj-$(CONFIG_MMU) += fault.o mmu.o tlb.o 6obj-$(CONFIG_MMU) += fault.o mmu.o tlb.o
7obj-$(CONFIG_HIGHMEM) += highmem.o
diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c
index ba4c47f291b1..63cbb867dadd 100644
--- a/arch/xtensa/mm/cache.c
+++ b/arch/xtensa/mm/cache.c
@@ -59,6 +59,10 @@
59 * 59 *
60 */ 60 */
61 61
62#if (DCACHE_WAY_SIZE > PAGE_SIZE) && defined(CONFIG_HIGHMEM)
63#error "HIGHMEM is not supported on cores with aliasing cache."
64#endif
65
62#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK 66#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
63 67
64/* 68/*
@@ -179,10 +183,11 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep)
179#else 183#else
180 if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags) 184 if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags)
181 && (vma->vm_flags & VM_EXEC) != 0) { 185 && (vma->vm_flags & VM_EXEC) != 0) {
182 unsigned long paddr = (unsigned long) page_address(page); 186 unsigned long paddr = (unsigned long)kmap_atomic(page);
183 __flush_dcache_page(paddr); 187 __flush_dcache_page(paddr);
184 __invalidate_icache_page(paddr); 188 __invalidate_icache_page(paddr);
185 set_bit(PG_arch_1, &page->flags); 189 set_bit(PG_arch_1, &page->flags);
190 kunmap_atomic((void *)paddr);
186 } 191 }
187#endif 192#endif
188} 193}
diff --git a/arch/xtensa/mm/highmem.c b/arch/xtensa/mm/highmem.c
new file mode 100644
index 000000000000..17a8c0d6fd17
--- /dev/null
+++ b/arch/xtensa/mm/highmem.c
@@ -0,0 +1,72 @@
1/*
2 * High memory support for Xtensa architecture
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2014 Cadence Design Systems Inc.
9 */
10
11#include <linux/export.h>
12#include <linux/highmem.h>
13#include <asm/tlbflush.h>
14
15static pte_t *kmap_pte;
16
17void *kmap_atomic(struct page *page)
18{
19 enum fixed_addresses idx;
20 unsigned long vaddr;
21 int type;
22
23 pagefault_disable();
24 if (!PageHighMem(page))
25 return page_address(page);
26
27 type = kmap_atomic_idx_push();
28 idx = type + KM_TYPE_NR * smp_processor_id();
29 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
30#ifdef CONFIG_DEBUG_HIGHMEM
31 BUG_ON(!pte_none(*(kmap_pte - idx)));
32#endif
33 set_pte(kmap_pte - idx, mk_pte(page, PAGE_KERNEL_EXEC));
34
35 return (void *)vaddr;
36}
37EXPORT_SYMBOL(kmap_atomic);
38
39void __kunmap_atomic(void *kvaddr)
40{
41 int idx, type;
42
43 if (kvaddr >= (void *)FIXADDR_START &&
44 kvaddr < (void *)FIXADDR_TOP) {
45 type = kmap_atomic_idx();
46 idx = type + KM_TYPE_NR * smp_processor_id();
47
48 /*
49 * Force other mappings to Oops if they'll try to access this
50 * pte without first remap it. Keeping stale mappings around
51 * is a bad idea also, in case the page changes cacheability
52 * attributes or becomes a protected page in a hypervisor.
53 */
54 pte_clear(&init_mm, kvaddr, kmap_pte - idx);
55 local_flush_tlb_kernel_range((unsigned long)kvaddr,
56 (unsigned long)kvaddr + PAGE_SIZE);
57
58 kmap_atomic_idx_pop();
59 }
60
61 pagefault_enable();
62}
63EXPORT_SYMBOL(__kunmap_atomic);
64
65void __init kmap_init(void)
66{
67 unsigned long kmap_vstart;
68
69 /* cache the first kmap pte */
70 kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN);
71 kmap_pte = kmap_get_fixmap_pte(kmap_vstart);
72}
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index aff108df92d3..4224256bb215 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -8,6 +8,7 @@
8 * for more details. 8 * for more details.
9 * 9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc. 10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 * Copyright (C) 2014 Cadence Design Systems Inc.
11 * 12 *
12 * Chris Zankel <chris@zankel.net> 13 * Chris Zankel <chris@zankel.net>
13 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com> 14 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
@@ -19,6 +20,7 @@
19#include <linux/errno.h> 20#include <linux/errno.h>
20#include <linux/bootmem.h> 21#include <linux/bootmem.h>
21#include <linux/gfp.h> 22#include <linux/gfp.h>
23#include <linux/highmem.h>
22#include <linux/swap.h> 24#include <linux/swap.h>
23#include <linux/mman.h> 25#include <linux/mman.h>
24#include <linux/nodemask.h> 26#include <linux/nodemask.h>
@@ -27,11 +29,133 @@
27#include <asm/bootparam.h> 29#include <asm/bootparam.h>
28#include <asm/page.h> 30#include <asm/page.h>
29#include <asm/sections.h> 31#include <asm/sections.h>
32#include <asm/sysmem.h>
33
34struct sysmem_info sysmem __initdata;
35
36static void __init sysmem_dump(void)
37{
38 unsigned i;
39
40 pr_debug("Sysmem:\n");
41 for (i = 0; i < sysmem.nr_banks; ++i)
42 pr_debug(" 0x%08lx - 0x%08lx (%ldK)\n",
43 sysmem.bank[i].start, sysmem.bank[i].end,
44 (sysmem.bank[i].end - sysmem.bank[i].start) >> 10);
45}
46
47/*
48 * Find bank with maximal .start such that bank.start <= start
49 */
50static inline struct meminfo * __init find_bank(unsigned long start)
51{
52 unsigned i;
53 struct meminfo *it = NULL;
54
55 for (i = 0; i < sysmem.nr_banks; ++i)
56 if (sysmem.bank[i].start <= start)
57 it = sysmem.bank + i;
58 else
59 break;
60 return it;
61}
62
63/*
64 * Move all memory banks starting at 'from' to a new place at 'to',
65 * adjust nr_banks accordingly.
66 * Both 'from' and 'to' must be inside the sysmem.bank.
67 *
68 * Returns: 0 (success), -ENOMEM (not enough space in the sysmem.bank).
69 */
70static int __init move_banks(struct meminfo *to, struct meminfo *from)
71{
72 unsigned n = sysmem.nr_banks - (from - sysmem.bank);
73
74 if (to > from && to - from + sysmem.nr_banks > SYSMEM_BANKS_MAX)
75 return -ENOMEM;
76 if (to != from)
77 memmove(to, from, n * sizeof(struct meminfo));
78 sysmem.nr_banks += to - from;
79 return 0;
80}
81
82/*
83 * Add new bank to sysmem. Resulting sysmem is the union of bytes of the
84 * original sysmem and the new bank.
85 *
86 * Returns: 0 (success), < 0 (error)
87 */
88int __init add_sysmem_bank(unsigned long start, unsigned long end)
89{
90 unsigned i;
91 struct meminfo *it = NULL;
92 unsigned long sz;
93 unsigned long bank_sz = 0;
94
95 if (start == end ||
96 (start < end) != (PAGE_ALIGN(start) < (end & PAGE_MASK))) {
97 pr_warn("Ignoring small memory bank 0x%08lx size: %ld bytes\n",
98 start, end - start);
99 return -EINVAL;
100 }
101
102 start = PAGE_ALIGN(start);
103 end &= PAGE_MASK;
104 sz = end - start;
105
106 it = find_bank(start);
107
108 if (it)
109 bank_sz = it->end - it->start;
110
111 if (it && bank_sz >= start - it->start) {
112 if (end - it->start > bank_sz)
113 it->end = end;
114 else
115 return 0;
116 } else {
117 if (!it)
118 it = sysmem.bank;
119 else
120 ++it;
121
122 if (it - sysmem.bank < sysmem.nr_banks &&
123 it->start - start <= sz) {
124 it->start = start;
125 if (it->end - it->start < sz)
126 it->end = end;
127 else
128 return 0;
129 } else {
130 if (move_banks(it + 1, it) < 0) {
131 pr_warn("Ignoring memory bank 0x%08lx size %ld bytes\n",
132 start, end - start);
133 return -EINVAL;
134 }
135 it->start = start;
136 it->end = end;
137 return 0;
138 }
139 }
140 sz = it->end - it->start;
141 for (i = it + 1 - sysmem.bank; i < sysmem.nr_banks; ++i)
142 if (sysmem.bank[i].start - it->start <= sz) {
143 if (sz < sysmem.bank[i].end - it->start)
144 it->end = sysmem.bank[i].end;
145 } else {
146 break;
147 }
148
149 move_banks(it + 1, sysmem.bank + i);
150 return 0;
151}
30 152
31/* 153/*
32 * mem_reserve(start, end, must_exist) 154 * mem_reserve(start, end, must_exist)
33 * 155 *
34 * Reserve some memory from the memory pool. 156 * Reserve some memory from the memory pool.
157 * If must_exist is set and a part of the region being reserved does not exist
158 * memory map is not altered.
35 * 159 *
36 * Parameters: 160 * Parameters:
37 * start Start of region, 161 * start Start of region,
@@ -39,53 +163,69 @@
39 * must_exist Must exist in memory pool. 163 * must_exist Must exist in memory pool.
40 * 164 *
41 * Returns: 165 * Returns:
42 * 0 (memory area couldn't be mapped) 166 * 0 (success)
43 * -1 (success) 167 * < 0 (error)
44 */ 168 */
45 169
46int __init mem_reserve(unsigned long start, unsigned long end, int must_exist) 170int __init mem_reserve(unsigned long start, unsigned long end, int must_exist)
47{ 171{
48 int i; 172 struct meminfo *it;
49 173 struct meminfo *rm = NULL;
50 if (start == end) 174 unsigned long sz;
51 return 0; 175 unsigned long bank_sz = 0;
52 176
53 start = start & PAGE_MASK; 177 start = start & PAGE_MASK;
54 end = PAGE_ALIGN(end); 178 end = PAGE_ALIGN(end);
179 sz = end - start;
180 if (!sz)
181 return -EINVAL;
55 182
56 for (i = 0; i < sysmem.nr_banks; i++) 183 it = find_bank(start);
57 if (start < sysmem.bank[i].end 184
58 && end >= sysmem.bank[i].start) 185 if (it)
59 break; 186 bank_sz = it->end - it->start;
60 187
61 if (i == sysmem.nr_banks) { 188 if ((!it || end - it->start > bank_sz) && must_exist) {
62 if (must_exist) 189 pr_warn("mem_reserve: [0x%0lx, 0x%0lx) not in any region!\n",
63 printk (KERN_WARNING "mem_reserve: [0x%0lx, 0x%0lx) " 190 start, end);
64 "not in any region!\n", start, end); 191 return -EINVAL;
65 return 0;
66 } 192 }
67 193
68 if (start > sysmem.bank[i].start) { 194 if (it && start - it->start < bank_sz) {
69 if (end < sysmem.bank[i].end) { 195 if (start == it->start) {
70 /* split entry */ 196 if (end - it->start < bank_sz) {
71 if (sysmem.nr_banks >= SYSMEM_BANKS_MAX) 197 it->start = end;
72 panic("meminfo overflow\n"); 198 return 0;
73 sysmem.bank[sysmem.nr_banks].start = end; 199 } else {
74 sysmem.bank[sysmem.nr_banks].end = sysmem.bank[i].end; 200 rm = it;
75 sysmem.nr_banks++; 201 }
202 } else {
203 it->end = start;
204 if (end - it->start < bank_sz)
205 return add_sysmem_bank(end,
206 it->start + bank_sz);
207 ++it;
76 } 208 }
77 sysmem.bank[i].end = start; 209 }
78 210
79 } else if (end < sysmem.bank[i].end) { 211 if (!it)
80 sysmem.bank[i].start = end; 212 it = sysmem.bank;
81 213
82 } else { 214 for (; it < sysmem.bank + sysmem.nr_banks; ++it) {
83 /* remove entry */ 215 if (it->end - start <= sz) {
84 sysmem.nr_banks--; 216 if (!rm)
85 sysmem.bank[i].start = sysmem.bank[sysmem.nr_banks].start; 217 rm = it;
86 sysmem.bank[i].end = sysmem.bank[sysmem.nr_banks].end; 218 } else {
219 if (it->start - start < sz)
220 it->start = end;
221 break;
222 }
87 } 223 }
88 return -1; 224
225 if (rm)
226 move_banks(rm, it);
227
228 return 0;
89} 229}
90 230
91 231
@@ -99,6 +239,7 @@ void __init bootmem_init(void)
99 unsigned long bootmap_start, bootmap_size; 239 unsigned long bootmap_start, bootmap_size;
100 int i; 240 int i;
101 241
242 sysmem_dump();
102 max_low_pfn = max_pfn = 0; 243 max_low_pfn = max_pfn = 0;
103 min_low_pfn = ~0; 244 min_low_pfn = ~0;
104 245
@@ -156,19 +297,13 @@ void __init bootmem_init(void)
156 297
157void __init zones_init(void) 298void __init zones_init(void)
158{ 299{
159 unsigned long zones_size[MAX_NR_ZONES];
160 int i;
161
162 /* All pages are DMA-able, so we put them all in the DMA zone. */ 300 /* All pages are DMA-able, so we put them all in the DMA zone. */
163 301 unsigned long zones_size[MAX_NR_ZONES] = {
164 zones_size[ZONE_DMA] = max_low_pfn - ARCH_PFN_OFFSET; 302 [ZONE_DMA] = max_low_pfn - ARCH_PFN_OFFSET,
165 for (i = 1; i < MAX_NR_ZONES; i++)
166 zones_size[i] = 0;
167
168#ifdef CONFIG_HIGHMEM 303#ifdef CONFIG_HIGHMEM
169 zones_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn; 304 [ZONE_HIGHMEM] = max_pfn - max_low_pfn,
170#endif 305#endif
171 306 };
172 free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL); 307 free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL);
173} 308}
174 309
@@ -178,16 +313,38 @@ void __init zones_init(void)
178 313
179void __init mem_init(void) 314void __init mem_init(void)
180{ 315{
181 max_mapnr = max_low_pfn - ARCH_PFN_OFFSET;
182 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
183
184#ifdef CONFIG_HIGHMEM 316#ifdef CONFIG_HIGHMEM
185#error HIGHGMEM not implemented in init.c 317 unsigned long tmp;
318
319 reset_all_zones_managed_pages();
320 for (tmp = max_low_pfn; tmp < max_pfn; tmp++)
321 free_highmem_page(pfn_to_page(tmp));
186#endif 322#endif
187 323
324 max_mapnr = max_pfn - ARCH_PFN_OFFSET;
325 high_memory = (void *)__va(max_low_pfn << PAGE_SHIFT);
326
188 free_all_bootmem(); 327 free_all_bootmem();
189 328
190 mem_init_print_info(NULL); 329 mem_init_print_info(NULL);
330 pr_info("virtual kernel memory layout:\n"
331#ifdef CONFIG_HIGHMEM
332 " pkmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
333 " fixmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
334#endif
335 " vmalloc : 0x%08x - 0x%08x (%5u MB)\n"
336 " lowmem : 0x%08x - 0x%08lx (%5lu MB)\n",
337#ifdef CONFIG_HIGHMEM
338 PKMAP_BASE, PKMAP_BASE + LAST_PKMAP * PAGE_SIZE,
339 (LAST_PKMAP*PAGE_SIZE) >> 10,
340 FIXADDR_START, FIXADDR_TOP,
341 (FIXADDR_TOP - FIXADDR_START) >> 10,
342#endif
343 VMALLOC_START, VMALLOC_END,
344 (VMALLOC_END - VMALLOC_START) >> 20,
345 PAGE_OFFSET, PAGE_OFFSET +
346 (max_low_pfn - min_low_pfn) * PAGE_SIZE,
347 ((max_low_pfn - min_low_pfn) * PAGE_SIZE) >> 20);
191} 348}
192 349
193#ifdef CONFIG_BLK_DEV_INITRD 350#ifdef CONFIG_BLK_DEV_INITRD
@@ -204,3 +361,53 @@ void free_initmem(void)
204{ 361{
205 free_initmem_default(-1); 362 free_initmem_default(-1);
206} 363}
364
365static void __init parse_memmap_one(char *p)
366{
367 char *oldp;
368 unsigned long start_at, mem_size;
369
370 if (!p)
371 return;
372
373 oldp = p;
374 mem_size = memparse(p, &p);
375 if (p == oldp)
376 return;
377
378 switch (*p) {
379 case '@':
380 start_at = memparse(p + 1, &p);
381 add_sysmem_bank(start_at, start_at + mem_size);
382 break;
383
384 case '$':
385 start_at = memparse(p + 1, &p);
386 mem_reserve(start_at, start_at + mem_size, 0);
387 break;
388
389 case 0:
390 mem_reserve(mem_size, 0, 0);
391 break;
392
393 default:
394 pr_warn("Unrecognized memmap syntax: %s\n", p);
395 break;
396 }
397}
398
399static int __init parse_memmap_opt(char *str)
400{
401 while (str) {
402 char *k = strchr(str, ',');
403
404 if (k)
405 *k++ = 0;
406
407 parse_memmap_one(str);
408 str = k;
409 }
410
411 return 0;
412}
413early_param("memmap", parse_memmap_opt);
diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c
index 861203e958da..3429b483d9f8 100644
--- a/arch/xtensa/mm/mmu.c
+++ b/arch/xtensa/mm/mmu.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Extracted from init.c 4 * Extracted from init.c
5 */ 5 */
6#include <linux/bootmem.h>
6#include <linux/percpu.h> 7#include <linux/percpu.h>
7#include <linux/init.h> 8#include <linux/init.h>
8#include <linux/string.h> 9#include <linux/string.h>
@@ -16,9 +17,44 @@
16#include <asm/initialize_mmu.h> 17#include <asm/initialize_mmu.h>
17#include <asm/io.h> 18#include <asm/io.h>
18 19
20#if defined(CONFIG_HIGHMEM)
21static void * __init init_pmd(unsigned long vaddr)
22{
23 pgd_t *pgd = pgd_offset_k(vaddr);
24 pmd_t *pmd = pmd_offset(pgd, vaddr);
25
26 if (pmd_none(*pmd)) {
27 unsigned i;
28 pte_t *pte = alloc_bootmem_low_pages(PAGE_SIZE);
29
30 for (i = 0; i < 1024; i++)
31 pte_clear(NULL, 0, pte + i);
32
33 set_pmd(pmd, __pmd(((unsigned long)pte) & PAGE_MASK));
34 BUG_ON(pte != pte_offset_kernel(pmd, 0));
35 pr_debug("%s: vaddr: 0x%08lx, pmd: 0x%p, pte: 0x%p\n",
36 __func__, vaddr, pmd, pte);
37 return pte;
38 } else {
39 return pte_offset_kernel(pmd, 0);
40 }
41}
42
43static void __init fixedrange_init(void)
44{
45 BUILD_BUG_ON(FIXADDR_SIZE > PMD_SIZE);
46 init_pmd(__fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK);
47}
48#endif
49
19void __init paging_init(void) 50void __init paging_init(void)
20{ 51{
21 memset(swapper_pg_dir, 0, PAGE_SIZE); 52 memset(swapper_pg_dir, 0, PAGE_SIZE);
53#ifdef CONFIG_HIGHMEM
54 fixedrange_init();
55 pkmap_page_table = init_pmd(PKMAP_BASE);
56 kmap_init();
57#endif
22} 58}
23 59
24/* 60/*
diff --git a/arch/xtensa/mm/tlb.c b/arch/xtensa/mm/tlb.c
index ade623826788..5ece856c5725 100644
--- a/arch/xtensa/mm/tlb.c
+++ b/arch/xtensa/mm/tlb.c
@@ -149,6 +149,21 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
149 local_irq_restore(flags); 149 local_irq_restore(flags);
150} 150}
151 151
152void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
153{
154 if (end > start && start >= TASK_SIZE && end <= PAGE_OFFSET &&
155 end - start < _TLB_ENTRIES << PAGE_SHIFT) {
156 start &= PAGE_MASK;
157 while (start < end) {
158 invalidate_itlb_mapping(start);
159 invalidate_dtlb_mapping(start);
160 start += PAGE_SIZE;
161 }
162 } else {
163 local_flush_tlb_all();
164 }
165}
166
152#ifdef CONFIG_DEBUG_TLB_SANITY 167#ifdef CONFIG_DEBUG_TLB_SANITY
153 168
154static unsigned get_pte_for_vaddr(unsigned vaddr) 169static unsigned get_pte_for_vaddr(unsigned vaddr)
diff --git a/arch/xtensa/platforms/iss/Makefile b/arch/xtensa/platforms/iss/Makefile
index d2369b799c50..b3e89291cfba 100644
--- a/arch/xtensa/platforms/iss/Makefile
+++ b/arch/xtensa/platforms/iss/Makefile
@@ -4,6 +4,7 @@
4# "prom monitor" library routines under Linux. 4# "prom monitor" library routines under Linux.
5# 5#
6 6
7obj-y = console.o setup.o 7obj-y = setup.o
8obj-$(CONFIG_TTY) += console.o
8obj-$(CONFIG_NET) += network.o 9obj-$(CONFIG_NET) += network.o
9obj-$(CONFIG_BLK_DEV_SIMDISK) += simdisk.o 10obj-$(CONFIG_BLK_DEV_SIMDISK) += simdisk.o
diff --git a/arch/xtensa/platforms/xt2000/setup.c b/arch/xtensa/platforms/xt2000/setup.c
index f9bc87966290..b90555cb8089 100644
--- a/arch/xtensa/platforms/xt2000/setup.c
+++ b/arch/xtensa/platforms/xt2000/setup.c
@@ -92,18 +92,8 @@ void __init platform_setup(char** cmdline)
92 92
93/* early initialization */ 93/* early initialization */
94 94
95extern sysmem_info_t __initdata sysmem; 95void __init platform_init(bp_tag_t *first)
96
97void platform_init(bp_tag_t* first)
98{ 96{
99 /* Set default memory block if not provided by the bootloader. */
100
101 if (sysmem.nr_banks == 0) {
102 sysmem.nr_banks = 1;
103 sysmem.bank[0].start = PLATFORM_DEFAULT_MEM_START;
104 sysmem.bank[0].end = PLATFORM_DEFAULT_MEM_START
105 + PLATFORM_DEFAULT_MEM_SIZE;
106 }
107} 97}
108 98
109/* Heartbeat. Let the LED blink. */ 99/* Heartbeat. Let the LED blink. */